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zBA,EAAEW,QADhC,WAElB,IAAK,MAAMC,KAAUf,EACnBZ,KAAKI,KAAKO,WAAWgB,EAEzB,CAEA,QAAYvB,GACV,OAAO4B,OAAOC,YAChB,CAEA,UAAYhB,GACV,MAAsB,kBAAfjB,KAAKH,MAA4B,GAAK,GAAHqC,OAAMlC,KAAKH,MAAK,IAC5D,CAEQgB,OAAAA,GACN,OAAOW,OAAOZ,KAAKZ,KAAKI,MAAMqB,QAAOV,GAAgC,IAA3BA,EAAEW,QAAQ1B,KAAKiB,SAC3D,CAEQX,WAAAA,CAAYC,GAClB,OAAOP,KAAKiB,OAASV,CACvB,E","sources":["../node_modules/@capacitor/preferences/src/web.ts"],"sourcesContent":["import { WebPlugin } from '@capacitor/core';\n\nimport type {\n PreferencesPlugin,\n ConfigureOptions,\n GetOptions,\n GetResult,\n SetOptions,\n RemoveOptions,\n KeysResult,\n MigrateResult,\n} from './definitions';\n\nexport class PreferencesWeb extends WebPlugin implements PreferencesPlugin {\n private group = 'CapacitorStorage';\n\n public async configure({ group }: ConfigureOptions): Promise {\n if (typeof group === 'string') {\n this.group = group;\n }\n }\n\n public async get(options: GetOptions): Promise {\n const value = this.impl.getItem(this.applyPrefix(options.key));\n\n return { value };\n }\n\n public async set(options: SetOptions): Promise {\n this.impl.setItem(this.applyPrefix(options.key), options.value);\n }\n\n public async remove(options: RemoveOptions): Promise {\n this.impl.removeItem(this.applyPrefix(options.key));\n }\n\n public async keys(): Promise {\n const keys = this.rawKeys().map(k => k.substring(this.prefix.length));\n\n return { keys };\n }\n\n public async clear(): Promise {\n for (const key of this.rawKeys()) {\n this.impl.removeItem(key);\n }\n }\n\n public async migrate(): Promise {\n const migrated: string[] = [];\n const existing: string[] = [];\n const oldprefix = '_cap_';\n const keys = Object.keys(this.impl).filter(k => k.indexOf(oldprefix) === 0);\n\n for (const oldkey of keys) {\n const key = oldkey.substring(oldprefix.length);\n const value = this.impl.getItem(oldkey) ?? '';\n const { value: currentValue } = await this.get({ key });\n\n if (typeof currentValue === 'string') {\n existing.push(key);\n } else {\n await this.set({ key, value });\n migrated.push(key);\n }\n }\n\n return { migrated, existing };\n }\n\n public async removeOld(): Promise {\n const oldprefix = '_cap_';\n const keys = Object.keys(this.impl).filter(k => k.indexOf(oldprefix) === 0);\n for (const oldkey of keys) {\n this.impl.removeItem(oldkey);\n }\n }\n\n private get impl(): Storage {\n return window.localStorage;\n }\n\n private get prefix(): string {\n return this.group === 'NativeStorage' ? '' : `${this.group}.`;\n }\n\n private rawKeys(): string[] {\n return Object.keys(this.impl).filter(k => k.indexOf(this.prefix) === 0);\n }\n\n private applyPrefix(key: string) {\n return this.prefix + key;\n }\n}\n"],"names":["PreferencesWeb","WebPlugin","constructor","group","configure","_ref","this","get","options","value","impl","getItem","applyPrefix","key","set","setItem","remove","removeItem","keys","rawKeys","map","k","substring","prefix","length","clear","migrate","migrated","existing","oldprefix","Object","filter","indexOf","oldkey","_a","currentValue","push","removeOld","window","localStorage","concat"],"sourceRoot":""}