import{a as e}from"./dist-BuoD_Tkt.js";var t=class extends e{constructor(){super(...arguments),this.group=`CapacitorStorage`}async configure({group:e}){typeof e==`string`&&(this.group=e)}async get(e){return{value:this.impl.getItem(this.applyPrefix(e.key))}}async set(e){this.impl.setItem(this.applyPrefix(e.key),e.value)}async remove(e){this.impl.removeItem(this.applyPrefix(e.key))}async keys(){return{keys:this.rawKeys().map(e=>e.substring(this.prefix.length))}}async clear(){for(let e of this.rawKeys())this.impl.removeItem(e)}async migrate(){let e=[],t=[],n=Object.keys(this.impl).filter(e=>e.indexOf(`_cap_`)===0);for(let r of n){let n=r.substring(5),i=this.impl.getItem(r)??``,{value:a}=await this.get({key:n});typeof a==`string`?t.push(n):(await this.set({key:n,value:i}),e.push(n))}return{migrated:e,existing:t}}async removeOld(){let e=Object.keys(this.impl).filter(e=>e.indexOf(`_cap_`)===0);for(let t of e)this.impl.removeItem(t)}get impl(){return window.localStorage}get prefix(){return this.group===`NativeStorage`?``:`${this.group}.`}rawKeys(){return Object.keys(this.impl).filter(e=>e.indexOf(this.prefix)===0)}applyPrefix(e){return this.prefix+e}};export{t as PreferencesWeb};
//# sourceMappingURL=web-BQwieVi8.js.map