1const E=(e,n)=>n.some(t=>e instanceof t);let I,B;function M(){return I||(I=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function L(){return B||(B=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const w=new WeakMap,m=new WeakMap,p=new WeakMap,f=new WeakMap,y=new WeakMap;function g(e){const n=new Promise((t,r)=>{const i=()=>{e.removeEventListener("success",c),e.removeEventListener("error",o)},c=()=>{t(a(e.result)),i()},o=()=>{r(e.error),i()};e.addEventListener("success",c),e.addEventListener("error",o)});return n.then(t=>{t instanceof IDBCursor&&w.set(t,e)}).catch(()=>{}),y.set(n,e),n}function P(e){if(m.has(e))return;const n=new Promise((t,r)=>{const i=()=>{e.removeEventListener("complete",c),e.removeEventListener("error",o),e.removeEventListener("abort",o)},c=()=>{t(),i()},o=()=>{r(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",c),e.addEventListener("error",o),e.addEventListener("abort",o)});m.set(e,n)}let l={get(e,n,t){if(e instanceof IDBTransaction){if(n==="done")return m.get(e);if(n==="objectStoreNames")return e.objectStoreNames||p.get(e);if(n==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return a(e[n])},set(e,n,t){return e[n]=t,!0},has(e,n){return e instanceof IDBTransaction&&(n==="done"||n==="store")?!0:n in e}};function C(e){l=e(l)}function S(e){return e===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(n,...t){const r=e.call(h(this),n,...t);return p.set(r,n.sort?n.sort():[n]),a(r)}:L().includes(e)?function(...n){return e.apply(h(this),n),a(w.get(this))}:function(...n){return a(e.apply(h(this),n))}}function T(e){return typeof e=="function"?S(e):(e instanceof IDBTransaction&&P(e),E(e,M())?new Proxy(e,l):e)}function a(e){if(e instanceof IDBRequest)return g(e);if(f.has(e))return f.get(e);const n=T(e);return n!==e&&(f.set(e,n),y.set(n,e)),n}const h=e=>y.get(e);function x(e,n,{blocked:t,upgrade:r,blocking:i,terminated:c}={}){const o=indexedDB.open(e,n),u=a(o);return r&&o.addEventListener("upgradeneeded",s=>{r(a(o.result),s.oldVersion,s.newVersion,a(o.transaction),s)}),t&&o.addEventListener("blocked",s=>t(s.oldVersion,s.newVersion,s)),u.then(s=>{c&&s.addEventListener("close",()=>c()),i&&s.addEventListener("versionchange",d=>i(d.oldVersion,d.newVersion,d))}).catch(()=>{}),u}function A(e,{blocked:n}={}){const t=indexedDB.deleteDatabase(e);return n&&t.addEventListener("blocked",r=>n(r.oldVersion,r)),a(t).then(()=>{})}const V=["get","getKey","getAll","getAllKeys","count"],j=["put","add","delete","clear"],D=new Map;function b(e,n){if(!(e instanceof IDBDatabase&&!(n in e)&&typeof n=="string"))return;if(D.get(n))return D.get(n);const t=n.replace(/FromIndex$/,""),r=n!==t,i=j.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||V.includes(t)))return;const c=async function(o,...u){const s=this.transaction(o,i?"readwrite":"readonly");let d=s.store;return r&&(d=d.index(u.shift())),(await Promise.all([d[t](...u),i&&s.done]))[0]};return D.set(n,c),c}C(e=>({...e,get:(n,t,r)=>b(n,t)||e.get(n,t,r),has:(n,t)=>!!b(n,t)||e.has(n,t)}));export{A as deleteDB,x as openDB,h as unwrap,a as wrap};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.