function r(e){return new Promise((n,t)=>{e.oncomplete=e.onsuccess=()=>n(e.result),e.onabort=e.onerror=()=>t(e.error)})}function l(e,n){let t;const u=()=>{if(t)return t;const o=indexedDB.open(e);return o.onupgradeneeded=()=>o.result.createObjectStore(n),t=r(o),t.then(i=>{i.onclose=()=>t=void 0},()=>{}),t};return(o,i)=>u().then(s=>i(s.transaction(n,o).objectStore(n)))}let a;function c(){return a||(a=l("keyval-store","keyval")),a}function f(e,n=c()){return n("readonly",t=>r(t.get(e)))}function p(e,n,t=c()){return t("readwrite",u=>(u.put(n,e),r(u.transaction)))}function y(e,n=c()){return n("readwrite",t=>(t.delete(e),r(t.transaction)))}function h(e=c()){return e("readwrite",n=>(n.clear(),r(n.transaction)))}function d(e,n){return e.openCursor().onsuccess=function(){this.result&&(n(this.result),this.result.continue())},r(e.transaction)}function g(e=c()){return e("readonly",n=>{if(n.getAllKeys)return r(n.getAllKeys());const t=[];return d(n,u=>t.push(u.key)).then(()=>t)})}export{h as a,l as c,y as d,f as g,g as k,p as s};
