function e(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function t(t,n){let r=indexedDB.open(t);r.onupgradeneeded=()=>r.result.createObjectStore(n);let i=e(r);return(e,t)=>i.then(r=>t(r.transaction(n,e).objectStore(n)))}var n;function r(){return n||=t(`keyval-store`,`keyval`),n}function i(t,n=r()){return n(`readonly`,n=>e(n.get(t)))}function a(t,n,i=r()){return i(`readwrite`,r=>(r.put(n,t),e(r.transaction)))}function o(t,n=r()){return n(`readwrite`,n=>(n.delete(t),e(n.transaction)))}function s(t=r()){return t(`readwrite`,t=>(t.clear(),e(t.transaction)))}function c(t,n){return t.openCursor().onsuccess=function(){this.result&&(n(this.result),this.result.continue())},e(t.transaction)}function l(t=r()){return t(`readonly`,t=>{if(t.getAllKeys)return e(t.getAllKeys());let n=[];return c(t,e=>n.push(e.key)).then(()=>n)})}export{l as a,i,t as n,a as o,o as r,s as t};