UNPKG

datastore-level

Version:

Datastore implementation with level(up|down) backend

4 lines (3 loc) 126 kB
(function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.DatastoreLevel = factory()}(typeof self !== 'undefined' ? self : this, function () { "use strict";var DatastoreLevel=(()=>{var io=Object.create;var ct=Object.defineProperty;var so=Object.getOwnPropertyDescriptor;var oo=Object.getOwnPropertyNames;var ao=Object.getPrototypeOf,co=Object.prototype.hasOwnProperty;var b=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),D=(r,e)=>{for(var t in e)ct(r,t,{get:e[t],enumerable:!0})},Dn=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of oo(e))!co.call(r,i)&&i!==t&&ct(r,i,{get:()=>e[i],enumerable:!(n=so(e,i))||n.enumerable});return r};var uo=(r,e,t)=>(t=r!=null?io(ao(r)):{},Dn(e||!r||!r.__esModule?ct(t,"default",{value:r,enumerable:!0}):t,r)),lo=r=>Dn(ct({},"__esModule",{value:!0}),r);var Ai=b(vi=>{"use strict";vi.supports=function(...e){let t=e.reduce((s,o)=>Object.assign(s,o),{}),n=t.implicitSnapshots||t.snapshots||!1,i=t.explicitSnapshots||!1;return Object.assign(t,{implicitSnapshots:n,explicitSnapshots:i,snapshots:n,has:t.has||!1,permanence:t.permanence||!1,seek:t.seek||!1,createIfMissing:t.createIfMissing||!1,errorIfExists:t.errorIfExists||!1,deferredOpen:t.deferredOpen||!1,streams:t.streams||!1,encodings:Object.assign({},t.encodings),events:Object.assign({},t.events),additionalMethods:Object.assign({},t.additionalMethods),signals:Object.assign({},t.signals)})}});var $=b((Fd,ki)=>{"use strict";ki.exports=class extends Error{constructor(e,t){super(e||""),typeof t=="object"&&t!==null&&(t.code&&(this.code=String(t.code)),t.expected&&(this.expected=!0),t.transient&&(this.transient=!0),t.cause&&(this.cause=t.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var Ii=b(wt=>{"use strict";wt.byteLength=uc;wt.toByteArray=fc;wt.fromByteArray=pc;var W=[],V=[],cc=typeof Uint8Array<"u"?Uint8Array:Array,Cr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(me=0,Si=Cr.length;me<Si;++me)W[me]=Cr[me],V[Cr.charCodeAt(me)]=me;var me,Si;V[45]=62;V[95]=63;function _i(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var n=t===e?0:4-t%4;return[t,n]}function uc(r){var e=_i(r),t=e[0],n=e[1];return(t+n)*3/4-n}function lc(r,e,t){return(e+t)*3/4-t}function fc(r){var e,t=_i(r),n=t[0],i=t[1],s=new cc(lc(r,n,i)),o=0,c=i>0?n-4:n,u;for(u=0;u<c;u+=4)e=V[r.charCodeAt(u)]<<18|V[r.charCodeAt(u+1)]<<12|V[r.charCodeAt(u+2)]<<6|V[r.charCodeAt(u+3)],s[o++]=e>>16&255,s[o++]=e>>8&255,s[o++]=e&255;return i===2&&(e=V[r.charCodeAt(u)]<<2|V[r.charCodeAt(u+1)]>>4,s[o++]=e&255),i===1&&(e=V[r.charCodeAt(u)]<<10|V[r.charCodeAt(u+1)]<<4|V[r.charCodeAt(u+2)]>>2,s[o++]=e>>8&255,s[o++]=e&255),s}function hc(r){return W[r>>18&63]+W[r>>12&63]+W[r>>6&63]+W[r&63]}function dc(r,e,t){for(var n,i=[],s=e;s<t;s+=3)n=(r[s]<<16&16711680)+(r[s+1]<<8&65280)+(r[s+2]&255),i.push(hc(n));return i.join("")}function pc(r){for(var e,t=r.length,n=t%3,i=[],s=16383,o=0,c=t-n;o<c;o+=s)i.push(dc(r,o,o+s>c?c:o+s));return n===1?(e=r[t-1],i.push(W[e>>2]+W[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(W[e>>10]+W[e>>4&63]+W[e<<2&63]+"=")),i.join("")}});var Ci=b(Br=>{Br.read=function(r,e,t,n,i){var s,o,c=i*8-n-1,u=(1<<c)-1,h=u>>1,a=-7,l=t?i-1:0,d=t?-1:1,m=r[e+l];for(l+=d,s=m&(1<<-a)-1,m>>=-a,a+=c;a>0;s=s*256+r[e+l],l+=d,a-=8);for(o=s&(1<<-a)-1,s>>=-a,a+=n;a>0;o=o*256+r[e+l],l+=d,a-=8);if(s===0)s=1-h;else{if(s===u)return o?NaN:(m?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-h}return(m?-1:1)*o*Math.pow(2,s-n)};Br.write=function(r,e,t,n,i,s){var o,c,u,h=s*8-i-1,a=(1<<h)-1,l=a>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,m=n?0:s-1,p=n?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,o=a):(o=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-o))<1&&(o--,u*=2),o+l>=1?e+=d/u:e+=d*Math.pow(2,1-l),e*u>=2&&(o++,u/=2),o+l>=a?(c=0,o=a):o+l>=1?(c=(e*u-1)*Math.pow(2,i),o=o+l):(c=e*Math.pow(2,l-1)*Math.pow(2,i),o=0));i>=8;r[t+m]=c&255,m+=p,c/=256,i-=8);for(o=o<<i|c,h+=i;h>0;r[t+m]=o&255,m+=p,o/=256,h-=8);r[t+m-p]|=y*128}});var xt=b(Te=>{"use strict";var Fr=Ii(),Fe=Ci(),Bi=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Te.Buffer=f;Te.SlowBuffer=xc;Te.INSPECT_MAX_BYTES=50;var gt=2147483647;Te.kMaxLength=gt;f.TYPED_ARRAY_SUPPORT=yc();!f.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function yc(){try{let r=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(r,e),r.foo()===42}catch{return!1}}Object.defineProperty(f.prototype,"parent",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.buffer}});Object.defineProperty(f.prototype,"offset",{enumerable:!0,get:function(){if(f.isBuffer(this))return this.byteOffset}});function Q(r){if(r>gt)throw new RangeError('The value "'+r+'" is invalid for option "size"');let e=new Uint8Array(r);return Object.setPrototypeOf(e,f.prototype),e}function f(r,e,t){if(typeof r=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ur(r)}return Oi(r,e,t)}f.poolSize=8192;function Oi(r,e,t){if(typeof r=="string")return wc(r,e);if(ArrayBuffer.isView(r))return gc(r);if(r==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r);if(G(r,ArrayBuffer)||r&&G(r.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(G(r,SharedArrayBuffer)||r&&G(r.buffer,SharedArrayBuffer)))return Tr(r,e,t);if(typeof r=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=r.valueOf&&r.valueOf();if(n!=null&&n!==r)return f.from(n,e,t);let i=bc(r);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof r[Symbol.toPrimitive]=="function")return f.from(r[Symbol.toPrimitive]("string"),e,t);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof r)}f.from=function(r,e,t){return Oi(r,e,t)};Object.setPrototypeOf(f.prototype,Uint8Array.prototype);Object.setPrototypeOf(f,Uint8Array);function Ui(r){if(typeof r!="number")throw new TypeError('"size" argument must be of type number');if(r<0)throw new RangeError('The value "'+r+'" is invalid for option "size"')}function mc(r,e,t){return Ui(r),r<=0?Q(r):e!==void 0?typeof t=="string"?Q(r).fill(e,t):Q(r).fill(e):Q(r)}f.alloc=function(r,e,t){return mc(r,e,t)};function Ur(r){return Ui(r),Q(r<0?0:Rr(r)|0)}f.allocUnsafe=function(r){return Ur(r)};f.allocUnsafeSlow=function(r){return Ur(r)};function wc(r,e){if((typeof e!="string"||e==="")&&(e="utf8"),!f.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=Ri(r,e)|0,n=Q(t),i=n.write(r,e);return i!==t&&(n=n.slice(0,i)),n}function Lr(r){let e=r.length<0?0:Rr(r.length)|0,t=Q(e);for(let n=0;n<e;n+=1)t[n]=r[n]&255;return t}function gc(r){if(G(r,Uint8Array)){let e=new Uint8Array(r);return Tr(e.buffer,e.byteOffset,e.byteLength)}return Lr(r)}function Tr(r,e,t){if(e<0||r.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(r.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&t===void 0?n=new Uint8Array(r):t===void 0?n=new Uint8Array(r,e):n=new Uint8Array(r,e,t),Object.setPrototypeOf(n,f.prototype),n}function bc(r){if(f.isBuffer(r)){let e=Rr(r.length)|0,t=Q(e);return t.length===0||r.copy(t,0,0,e),t}if(r.length!==void 0)return typeof r.length!="number"||Nr(r.length)?Q(0):Lr(r);if(r.type==="Buffer"&&Array.isArray(r.data))return Lr(r.data)}function Rr(r){if(r>=gt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+gt.toString(16)+" bytes");return r|0}function xc(r){return+r!=r&&(r=0),f.alloc(+r)}f.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==f.prototype};f.compare=function(e,t){if(G(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),G(t,Uint8Array)&&(t=f.from(t,t.offset,t.byteLength)),!f.isBuffer(e)||!f.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let n=e.length,i=t.length;for(let s=0,o=Math.min(n,i);s<o;++s)if(e[s]!==t[s]){n=e[s],i=t[s];break}return n<i?-1:i<n?1:0};f.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}};f.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return f.alloc(0);let n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;let i=f.allocUnsafe(t),s=0;for(n=0;n<e.length;++n){let o=e[n];if(G(o,Uint8Array))s+o.length>i.length?(f.isBuffer(o)||(o=f.from(o)),o.copy(i,s)):Uint8Array.prototype.set.call(i,o,s);else if(f.isBuffer(o))o.copy(i,s);else throw new TypeError('"list" argument must be an Array of Buffers');s+=o.length}return i};function Ri(r,e){if(f.isBuffer(r))return r.length;if(ArrayBuffer.isView(r)||G(r,ArrayBuffer))return r.byteLength;if(typeof r!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof r);let t=r.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return Or(r).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return ji(r).length;default:if(i)return n?-1:Or(r).length;e=(""+e).toLowerCase(),i=!0}}f.byteLength=Ri;function Ec(r,e,t){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((t===void 0||t>this.length)&&(t=this.length),t<=0)||(t>>>=0,e>>>=0,t<=e))return"";for(r||(r="utf8");;)switch(r){case"hex":return Lc(this,e,t);case"utf8":case"utf-8":return Ni(this,e,t);case"ascii":return Bc(this,e,t);case"latin1":case"binary":return Fc(this,e,t);case"base64":return Ic(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Tc(this,e,t);default:if(n)throw new TypeError("Unknown encoding: "+r);r=(r+"").toLowerCase(),n=!0}}f.prototype._isBuffer=!0;function we(r,e,t){let n=r[e];r[e]=r[t],r[t]=n}f.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)we(this,t,t+1);return this};f.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)we(this,t,t+3),we(this,t+1,t+2);return this};f.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)we(this,t,t+7),we(this,t+1,t+6),we(this,t+2,t+5),we(this,t+3,t+4);return this};f.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ni(this,0,e):Ec.apply(this,arguments)};f.prototype.toLocaleString=f.prototype.toString;f.prototype.equals=function(e){if(!f.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:f.compare(this,e)===0};f.prototype.inspect=function(){let e="",t=Te.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Bi&&(f.prototype[Bi]=f.prototype.inspect);f.prototype.compare=function(e,t,n,i,s){if(G(e,Uint8Array)&&(e=f.from(e,e.offset,e.byteLength)),!f.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),t<0||n>e.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&t>=n)return 0;if(i>=s)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,i>>>=0,s>>>=0,this===e)return 0;let o=s-i,c=n-t,u=Math.min(o,c),h=this.slice(i,s),a=e.slice(t,n);for(let l=0;l<u;++l)if(h[l]!==a[l]){o=h[l],c=a[l];break}return o<c?-1:c<o?1:0};function Di(r,e,t,n,i){if(r.length===0)return-1;if(typeof t=="string"?(n=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Nr(t)&&(t=i?0:r.length-1),t<0&&(t=r.length+t),t>=r.length){if(i)return-1;t=r.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=f.from(e,n)),f.isBuffer(e))return e.length===0?-1:Fi(r,e,t,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(r,e,t):Uint8Array.prototype.lastIndexOf.call(r,e,t):Fi(r,[e],t,n,i);throw new TypeError("val must be string, number or Buffer")}function Fi(r,e,t,n,i){let s=1,o=r.length,c=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(r.length<2||e.length<2)return-1;s=2,o/=2,c/=2,t/=2}function u(a,l){return s===1?a[l]:a.readUInt16BE(l*s)}let h;if(i){let a=-1;for(h=t;h<o;h++)if(u(r,h)===u(e,a===-1?0:h-a)){if(a===-1&&(a=h),h-a+1===c)return a*s}else a!==-1&&(h-=h-a),a=-1}else for(t+c>o&&(t=o-c),h=t;h>=0;h--){let a=!0;for(let l=0;l<c;l++)if(u(r,h+l)!==u(e,l)){a=!1;break}if(a)return h}return-1}f.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1};f.prototype.indexOf=function(e,t,n){return Di(this,e,t,n,!0)};f.prototype.lastIndexOf=function(e,t,n){return Di(this,e,t,n,!1)};function vc(r,e,t,n){t=Number(t)||0;let i=r.length-t;n?(n=Number(n),n>i&&(n=i)):n=i;let s=e.length;n>s/2&&(n=s/2);let o;for(o=0;o<n;++o){let c=parseInt(e.substr(o*2,2),16);if(Nr(c))return o;r[t+o]=c}return o}function Ac(r,e,t,n){return bt(Or(e,r.length-t),r,t,n)}function kc(r,e,t,n){return bt(Dc(e),r,t,n)}function Sc(r,e,t,n){return bt(ji(e),r,t,n)}function _c(r,e,t,n){return bt(Nc(e,r.length-t),r,t,n)}f.prototype.write=function(e,t,n,i){if(t===void 0)i="utf8",n=this.length,t=0;else if(n===void 0&&typeof t=="string")i=t,n=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(n)?(n=n>>>0,i===void 0&&(i="utf8")):(i=n,n=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let s=this.length-t;if((n===void 0||n>s)&&(n=s),e.length>0&&(n<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let o=!1;for(;;)switch(i){case"hex":return vc(this,e,t,n);case"utf8":case"utf-8":return Ac(this,e,t,n);case"ascii":case"latin1":case"binary":return kc(this,e,t,n);case"base64":return Sc(this,e,t,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return _c(this,e,t,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}};f.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ic(r,e,t){return e===0&&t===r.length?Fr.fromByteArray(r):Fr.fromByteArray(r.slice(e,t))}function Ni(r,e,t){t=Math.min(r.length,t);let n=[],i=e;for(;i<t;){let s=r[i],o=null,c=s>239?4:s>223?3:s>191?2:1;if(i+c<=t){let u,h,a,l;switch(c){case 1:s<128&&(o=s);break;case 2:u=r[i+1],(u&192)===128&&(l=(s&31)<<6|u&63,l>127&&(o=l));break;case 3:u=r[i+1],h=r[i+2],(u&192)===128&&(h&192)===128&&(l=(s&15)<<12|(u&63)<<6|h&63,l>2047&&(l<55296||l>57343)&&(o=l));break;case 4:u=r[i+1],h=r[i+2],a=r[i+3],(u&192)===128&&(h&192)===128&&(a&192)===128&&(l=(s&15)<<18|(u&63)<<12|(h&63)<<6|a&63,l>65535&&l<1114112&&(o=l))}}o===null?(o=65533,c=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=c}return Cc(n)}var Li=4096;function Cc(r){let e=r.length;if(e<=Li)return String.fromCharCode.apply(String,r);let t="",n=0;for(;n<e;)t+=String.fromCharCode.apply(String,r.slice(n,n+=Li));return t}function Bc(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]&127);return n}function Fc(r,e,t){let n="";t=Math.min(r.length,t);for(let i=e;i<t;++i)n+=String.fromCharCode(r[i]);return n}function Lc(r,e,t){let n=r.length;(!e||e<0)&&(e=0),(!t||t<0||t>n)&&(t=n);let i="";for(let s=e;s<t;++s)i+=Mc[r[s]];return i}function Tc(r,e,t){let n=r.slice(e,t),i="";for(let s=0;s<n.length-1;s+=2)i+=String.fromCharCode(n[s]+n[s+1]*256);return i}f.prototype.slice=function(e,t){let n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,f.prototype),i};function B(r,e,t){if(r%1!==0||r<0)throw new RangeError("offset is not uint");if(r+e>t)throw new RangeError("Trying to access beyond buffer length")}f.prototype.readUintLE=f.prototype.readUIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=this[e],s=1,o=0;for(;++o<t&&(s*=256);)i+=this[e+o]*s;return i};f.prototype.readUintBE=f.prototype.readUIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=this[e+--t],s=1;for(;t>0&&(s*=256);)i+=this[e+--t]*s;return i};f.prototype.readUint8=f.prototype.readUInt8=function(e,t){return e=e>>>0,t||B(e,1,this.length),this[e]};f.prototype.readUint16LE=f.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||B(e,2,this.length),this[e]|this[e+1]<<8};f.prototype.readUint16BE=f.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||B(e,2,this.length),this[e]<<8|this[e+1]};f.prototype.readUint32LE=f.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};f.prototype.readUint32BE=f.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||B(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};f.prototype.readBigUInt64LE=ie(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ge(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,s=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(s)<<BigInt(32))});f.prototype.readBigUInt64BE=ie(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ge(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],s=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(s)});f.prototype.readIntLE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=this[e],s=1,o=0;for(;++o<t&&(s*=256);)i+=this[e+o]*s;return s*=128,i>=s&&(i-=Math.pow(2,8*t)),i};f.prototype.readIntBE=function(e,t,n){e=e>>>0,t=t>>>0,n||B(e,t,this.length);let i=t,s=1,o=this[e+--i];for(;i>0&&(s*=256);)o+=this[e+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*t)),o};f.prototype.readInt8=function(e,t){return e=e>>>0,t||B(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};f.prototype.readInt16LE=function(e,t){e=e>>>0,t||B(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};f.prototype.readInt16BE=function(e,t){e=e>>>0,t||B(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};f.prototype.readInt32LE=function(e,t){return e=e>>>0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};f.prototype.readInt32BE=function(e,t){return e=e>>>0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};f.prototype.readBigInt64LE=ie(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ge(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(n<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});f.prototype.readBigInt64BE=ie(function(e){e=e>>>0,Le(e,"offset");let t=this[e],n=this[e+7];(t===void 0||n===void 0)&&Ge(e,this.length-8);let i=(t<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return(BigInt(i)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n)});f.prototype.readFloatLE=function(e,t){return e=e>>>0,t||B(e,4,this.length),Fe.read(this,e,!0,23,4)};f.prototype.readFloatBE=function(e,t){return e=e>>>0,t||B(e,4,this.length),Fe.read(this,e,!1,23,4)};f.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||B(e,8,this.length),Fe.read(this,e,!0,52,8)};f.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||B(e,8,this.length),Fe.read(this,e,!1,52,8)};function U(r,e,t,n,i,s){if(!f.isBuffer(r))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(t+n>r.length)throw new RangeError("Index out of range")}f.prototype.writeUintLE=f.prototype.writeUIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;U(this,e,t,n,c,0)}let s=1,o=0;for(this[t]=e&255;++o<n&&(s*=256);)this[t+o]=e/s&255;return t+n};f.prototype.writeUintBE=f.prototype.writeUIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,n=n>>>0,!i){let c=Math.pow(2,8*n)-1;U(this,e,t,n,c,0)}let s=n-1,o=1;for(this[t+s]=e&255;--s>=0&&(o*=256);)this[t+s]=e/o&255;return t+n};f.prototype.writeUint8=f.prototype.writeUInt8=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,1,255,0),this[t]=e&255,t+1};f.prototype.writeUint16LE=f.prototype.writeUInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};f.prototype.writeUint16BE=f.prototype.writeUInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};f.prototype.writeUint32LE=f.prototype.writeUInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4};f.prototype.writeUint32BE=f.prototype.writeUInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function Mi(r,e,t,n,i){qi(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s,s=s>>8,r[t++]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,o=o>>8,r[t++]=o,t}function Pi(r,e,t,n,i){qi(e,n,i,r,t,7);let s=Number(e&BigInt(4294967295));r[t+7]=s,s=s>>8,r[t+6]=s,s=s>>8,r[t+5]=s,s=s>>8,r[t+4]=s;let o=Number(e>>BigInt(32)&BigInt(4294967295));return r[t+3]=o,o=o>>8,r[t+2]=o,o=o>>8,r[t+1]=o,o=o>>8,r[t]=o,t+8}f.prototype.writeBigUInt64LE=ie(function(e,t=0){return Mi(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeBigUInt64BE=ie(function(e,t=0){return Pi(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});f.prototype.writeIntLE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);U(this,e,t,n,u-1,-u)}let s=0,o=1,c=0;for(this[t]=e&255;++s<n&&(o*=256);)e<0&&c===0&&this[t+s-1]!==0&&(c=1),this[t+s]=(e/o>>0)-c&255;return t+n};f.prototype.writeIntBE=function(e,t,n,i){if(e=+e,t=t>>>0,!i){let u=Math.pow(2,8*n-1);U(this,e,t,n,u-1,-u)}let s=n-1,o=1,c=0;for(this[t+s]=e&255;--s>=0&&(o*=256);)e<0&&c===0&&this[t+s+1]!==0&&(c=1),this[t+s]=(e/o>>0)-c&255;return t+n};f.prototype.writeInt8=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};f.prototype.writeInt16LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};f.prototype.writeInt16BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};f.prototype.writeInt32LE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4};f.prototype.writeInt32BE=function(e,t,n){return e=+e,t=t>>>0,n||U(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};f.prototype.writeBigInt64LE=ie(function(e,t=0){return Mi(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});f.prototype.writeBigInt64BE=ie(function(e,t=0){return Pi(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Vi(r,e,t,n,i,s){if(t+n>r.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function Ki(r,e,t,n,i){return e=+e,t=t>>>0,i||Vi(r,e,t,4,34028234663852886e22,-34028234663852886e22),Fe.write(r,e,t,n,23,4),t+4}f.prototype.writeFloatLE=function(e,t,n){return Ki(this,e,t,!0,n)};f.prototype.writeFloatBE=function(e,t,n){return Ki(this,e,t,!1,n)};function $i(r,e,t,n,i){return e=+e,t=t>>>0,i||Vi(r,e,t,8,17976931348623157e292,-17976931348623157e292),Fe.write(r,e,t,n,52,8),t+8}f.prototype.writeDoubleLE=function(e,t,n){return $i(this,e,t,!0,n)};f.prototype.writeDoubleBE=function(e,t,n){return $i(this,e,t,!1,n)};f.prototype.copy=function(e,t,n,i){if(!f.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("Index out of range");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),e.length-t<i-n&&(i=e.length-t+n);let s=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),t),s};f.prototype.fill=function(e,t,n,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,n=this.length):typeof n=="string"&&(i=n,n=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!f.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let o=e.charCodeAt(0);(i==="utf8"&&o<128||i==="latin1")&&(e=o)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw new RangeError("Out of range index");if(n<=t)return this;t=t>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let s;if(typeof e=="number")for(s=t;s<n;++s)this[s]=e;else{let o=f.isBuffer(e)?e:f.from(e,i),c=o.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(s=0;s<n-t;++s)this[s+t]=o[s%c]}return this};var Be={};function Dr(r,e,t){Be[r]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${r}]`,this.stack,delete this.name}get code(){return r}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${r}]: ${this.message}`}}}Dr("ERR_BUFFER_OUT_OF_BOUNDS",function(r){return r?`${r} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Dr("ERR_INVALID_ARG_TYPE",function(r,e){return`The "${r}" argument must be of type number. Received type ${typeof e}`},TypeError);Dr("ERR_OUT_OF_RANGE",function(r,e,t){let n=`The value of "${r}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=Ti(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=Ti(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Ti(r){let e="",t=r.length,n=r[0]==="-"?1:0;for(;t>=n+4;t-=3)e=`_${r.slice(t-3,t)}${e}`;return`${r.slice(0,t)}${e}`}function Oc(r,e,t){Le(e,"offset"),(r[e]===void 0||r[e+t]===void 0)&&Ge(e,r.length-(t+1))}function qi(r,e,t,n,i,s){if(r>t||r<e){let o=typeof e=="bigint"?"n":"",c;throw s>3?e===0||e===BigInt(0)?c=`>= 0${o} and < 2${o} ** ${(s+1)*8}${o}`:c=`>= -(2${o} ** ${(s+1)*8-1}${o}) and < 2 ** ${(s+1)*8-1}${o}`:c=`>= ${e}${o} and <= ${t}${o}`,new Be.ERR_OUT_OF_RANGE("value",c,r)}Oc(n,i,s)}function Le(r,e){if(typeof r!="number")throw new Be.ERR_INVALID_ARG_TYPE(e,"number",r)}function Ge(r,e,t){throw Math.floor(r)!==r?(Le(r,t),new Be.ERR_OUT_OF_RANGE(t||"offset","an integer",r)):e<0?new Be.ERR_BUFFER_OUT_OF_BOUNDS:new Be.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,r)}var Uc=/[^+/0-9A-Za-z-_]/g;function Rc(r){if(r=r.split("=")[0],r=r.trim().replace(Uc,""),r.length<2)return"";for(;r.length%4!==0;)r=r+"=";return r}function Or(r,e){e=e||1/0;let t,n=r.length,i=null,s=[];for(let o=0;o<n;++o){if(t=r.charCodeAt(o),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&s.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;s.push(t)}else if(t<2048){if((e-=2)<0)break;s.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;s.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;s.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return s}function Dc(r){let e=[];for(let t=0;t<r.length;++t)e.push(r.charCodeAt(t)&255);return e}function Nc(r,e){let t,n,i,s=[];for(let o=0;o<r.length&&!((e-=2)<0);++o)t=r.charCodeAt(o),n=t>>8,i=t%256,s.push(i),s.push(n);return s}function ji(r){return Fr.toByteArray(Rc(r))}function bt(r,e,t,n){let i;for(i=0;i<n&&!(i+t>=e.length||i>=r.length);++i)e[i+t]=r[i];return i}function G(r,e){return r instanceof e||r!=null&&r.constructor!=null&&r.constructor.name!=null&&r.constructor.name===e.name}function Nr(r){return r!==r}var Mc=(function(){let r="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let n=t*16;for(let i=0;i<16;++i)e[n+i]=r[t]+r[i]}return e})();function ie(r){return typeof BigInt>"u"?Pc:r}function Pc(){throw new Error("BigInt not supported")}});var Pr=b((Rd,zi)=>{"use strict";var Mr=null;zi.exports=function(){return Mr===null&&(Mr={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),Mr}});var $r=b(Wi=>{"use strict";var Vr=$(),Vc=new Set(["buffer","view","utf8"]),Kr=class{constructor(e){if(this.encode=e.encode||this.encode,this.decode=e.decode||this.decode,this.name=e.name||this.name,this.format=e.format||this.format,typeof this.encode!="function")throw new TypeError("The 'encode' property must be a function");if(typeof this.decode!="function")throw new TypeError("The 'decode' property must be a function");if(this.encode=this.encode.bind(this),this.decode=this.decode.bind(this),typeof this.name!="string"||this.name==="")throw new TypeError("The 'name' property must be a string");if(typeof this.format!="string"||!Vc.has(this.format))throw new TypeError("The 'format' property must be one of 'buffer', 'view', 'utf8'");e.createViewTranscoder&&(this.createViewTranscoder=e.createViewTranscoder),e.createBufferTranscoder&&(this.createBufferTranscoder=e.createBufferTranscoder),e.createUTF8Transcoder&&(this.createUTF8Transcoder=e.createUTF8Transcoder)}get commonName(){return this.name.split("+")[0]}createBufferTranscoder(){throw new Vr(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new Vr(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new Vr(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};Wi.Encoding=Kr});var Wr=b(Et=>{"use strict";var{Buffer:jr}=xt()||{},{Encoding:zr}=$r(),Kc=Pr(),He=class extends zr{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new Je({encode:this.encode,decode:e=>this.decode(jr.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},Je=class extends zr{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new He({encode:e=>{let t=this.encode(e);return jr.from(t.buffer,t.byteOffset,t.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},qr=class extends zr{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new He({encode:e=>jr.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:t}=Kc();return new Je({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(t.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};Et.BufferFormat=He;Et.ViewFormat=Je;Et.UTF8Format=qr});var Xi=b(ge=>{"use strict";var{Buffer:L}=xt()||{Buffer:{isBuffer:()=>!1}},{textEncoder:Hi,textDecoder:Gi}=Pr()(),{BufferFormat:Xe,ViewFormat:Gr,UTF8Format:Ji}=Wr(),vt=r=>r;ge.utf8=new Ji({encode:function(r){return L.isBuffer(r)?r.toString("utf8"):ArrayBuffer.isView(r)?Gi.decode(r):String(r)},decode:vt,name:"utf8",createViewTranscoder(){return new Gr({encode:function(r){return ArrayBuffer.isView(r)?r:Hi.encode(r)},decode:function(r){return Gi.decode(r)},name:`${this.name}+view`})},createBufferTranscoder(){return new Xe({encode:function(r){return L.isBuffer(r)?r:ArrayBuffer.isView(r)?L.from(r.buffer,r.byteOffset,r.byteLength):L.from(String(r),"utf8")},decode:function(r){return r.toString("utf8")},name:`${this.name}+buffer`})}});ge.json=new Ji({encode:JSON.stringify,decode:JSON.parse,name:"json"});ge.buffer=new Xe({encode:function(r){return L.isBuffer(r)?r:ArrayBuffer.isView(r)?L.from(r.buffer,r.byteOffset,r.byteLength):L.from(String(r),"utf8")},decode:vt,name:"buffer",createViewTranscoder(){return new Gr({encode:function(r){return ArrayBuffer.isView(r)?r:L.from(String(r),"utf8")},decode:function(r){return L.from(r.buffer,r.byteOffset,r.byteLength)},name:`${this.name}+view`})}});ge.view=new Gr({encode:function(r){return ArrayBuffer.isView(r)?r:Hi.encode(r)},decode:vt,name:"view",createBufferTranscoder(){return new Xe({encode:function(r){return L.isBuffer(r)?r:ArrayBuffer.isView(r)?L.from(r.buffer,r.byteOffset,r.byteLength):L.from(String(r),"utf8")},decode:vt,name:`${this.name}+buffer`})}});ge.hex=new Xe({encode:function(r){return L.isBuffer(r)?r:L.from(String(r),"hex")},decode:function(r){return r.toString("hex")},name:"hex"});ge.base64=new Xe({encode:function(r){return L.isBuffer(r)?r:L.from(String(r),"base64")},decode:function(r){return r.toString("base64")},name:"base64"})});var Zi=b(Qi=>{"use strict";var Yi=$(),kt=Xi(),{Encoding:$c}=$r(),{BufferFormat:qc,ViewFormat:jc,UTF8Format:zc}=Wr(),Ye=Symbol("formats"),At=Symbol("encodings"),Wc=new Set(["buffer","view","utf8"]),Hr=class{constructor(e){if(Array.isArray(e)){if(!e.every(t=>Wc.has(t)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[At]=new Map,this[Ye]=new Set(e);for(let t in kt)try{this.encoding(t)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[At].values()))}encoding(e){let t=this[At].get(e);if(t===void 0){if(typeof e=="string"&&e!==""){if(t=Xc[e],!t)throw new Yi(`Encoding '${e}' is not found`,{code:"LEVEL_ENCODING_NOT_FOUND"})}else{if(typeof e!="object"||e===null)throw new TypeError("First argument 'encoding' must be a string or object");t=Gc(e)}let{name:n,format:i}=t;if(!this[Ye].has(i))if(this[Ye].has("view"))t=t.createViewTranscoder();else if(this[Ye].has("buffer"))t=t.createBufferTranscoder();else if(this[Ye].has("utf8"))t=t.createUTF8Transcoder();else throw new Yi(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let s of[e,n,t.name,t.commonName])this[At].set(s,t)}return t}};Qi.Transcoder=Hr;function Gc(r){if(r instanceof $c)return r;let e="type"in r&&typeof r.type=="string"?r.type:void 0,t=r.name||e||`anonymous-${Yc++}`;switch(Hc(r)){case"view":return new jc({...r,name:t});case"utf8":return new zc({...r,name:t});case"buffer":return new qc({...r,name:t});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function Hc(r){return"format"in r&&r.format!==void 0?r.format:"buffer"in r&&typeof r.buffer=="boolean"?r.buffer?"buffer":"utf8":"code"in r&&Number.isInteger(r.code)?"view":"buffer"}var Jc={binary:kt.buffer,"utf-8":kt.utf8},Xc={...kt,...Jc},Yc=0});var ls=b((Vd,Jr)=>{"use strict";var Oe=typeof Reflect=="object"?Reflect:null,es=Oe&&typeof Oe.apply=="function"?Oe.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},St;Oe&&typeof Oe.ownKeys=="function"?St=Oe.ownKeys:Object.getOwnPropertySymbols?St=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:St=function(e){return Object.getOwnPropertyNames(e)};function Qc(r){console&&console.warn&&console.warn(r)}var rs=Number.isNaN||function(e){return e!==e};function k(){k.init.call(this)}Jr.exports=k;Jr.exports.once=ru;k.EventEmitter=k;k.prototype._events=void 0;k.prototype._eventsCount=0;k.prototype._maxListeners=void 0;var ts=10;function _t(r){if(typeof r!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof r)}Object.defineProperty(k,"defaultMaxListeners",{enumerable:!0,get:function(){return ts},set:function(r){if(typeof r!="number"||r<0||rs(r))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+r+".");ts=r}});k.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};k.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||rs(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function ns(r){return r._maxListeners===void 0?k.defaultMaxListeners:r._maxListeners}k.prototype.getMaxListeners=function(){return ns(this)};k.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e==="error",s=this._events;if(s!==void 0)i=i&&s.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var c=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw c.context=o,c}var u=s[e];if(u===void 0)return!1;if(typeof u=="function")es(u,this,t);else for(var h=u.length,a=cs(u,h),n=0;n<h;++n)es(a[n],this,t);return!0};function is(r,e,t,n){var i,s,o;if(_t(t),s=r._events,s===void 0?(s=r._events=Object.create(null),r._eventsCount=0):(s.newListener!==void 0&&(r.emit("newListener",e,t.listener?t.listener:t),s=r._events),o=s[e]),o===void 0)o=s[e]=t,++r._eventsCount;else if(typeof o=="function"?o=s[e]=n?[t,o]:[o,t]:n?o.unshift(t):o.push(t),i=ns(r),i>0&&o.length>i&&!o.warned){o.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=r,c.type=e,c.count=o.length,Qc(c)}return r}k.prototype.addListener=function(e,t){return is(this,e,t,!1)};k.prototype.on=k.prototype.addListener;k.prototype.prependListener=function(e,t){return is(this,e,t,!0)};function Zc(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function ss(r,e,t){var n={fired:!1,wrapFn:void 0,target:r,type:e,listener:t},i=Zc.bind(n);return i.listener=t,n.wrapFn=i,i}k.prototype.once=function(e,t){return _t(t),this.on(e,ss(this,e,t)),this};k.prototype.prependOnceListener=function(e,t){return _t(t),this.prependListener(e,ss(this,e,t)),this};k.prototype.removeListener=function(e,t){var n,i,s,o,c;if(_t(t),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||t));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===t||n[o].listener===t){c=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():eu(n,s),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,c||t)}return this};k.prototype.off=k.prototype.removeListener;k.prototype.removeAllListeners=function(e){var t,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i<s.length;++i)o=s[i],o!=="removeListener"&&this.removeAllListeners(o);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t=="function")this.removeListener(e,t);else if(t!==void 0)for(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this};function os(r,e,t){var n=r._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?tu(i):cs(i,i.length)}k.prototype.listeners=function(e){return os(this,e,!0)};k.prototype.rawListeners=function(e){return os(this,e,!1)};k.listenerCount=function(r,e){return typeof r.listenerCount=="function"?r.listenerCount(e):as.call(r,e)};k.prototype.listenerCount=as;function as(r){var e=this._events;if(e!==void 0){var t=e[r];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}k.prototype.eventNames=function(){return this._eventsCount>0?St(this._events):[]};function cs(r,e){for(var t=new Array(e),n=0;n<e;++n)t[n]=r[n];return t}function eu(r,e){for(;e+1<r.length;e++)r[e]=r[e+1];r.pop()}function tu(r){for(var e=new Array(r.length),t=0;t<e.length;++t)e[t]=r[t].listener||r[t];return e}function ru(r,e){return new Promise(function(t,n){function i(o){r.removeListener(e,s),n(o)}function s(){typeof r.removeListener=="function"&&r.removeListener("error",i),t([].slice.call(arguments))}us(r,e,s,{once:!0}),e!=="error"&&nu(r,i,{once:!0})})}function nu(r,e,t){typeof r.on=="function"&&us(r,"error",e,t)}function us(r,e,t,n){if(typeof r.on=="function")n.once?r.once(e,t):r.on(e,t);else if(typeof r.addEventListener=="function")r.addEventListener(e,function i(s){n.once&&r.removeEventListener(e,i),t(s)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof r)}});var It=b((Kd,ds)=>{"use strict";var fs=Symbol("kErrors");ds.exports=function(r){if(r=r.filter(iu),r.length!==0)return r.length===1?r[0]:new Yr(r)};var Yr=class extends Error{constructor(e){let t=new Set(e.map(su).filter(Boolean)),n=Array.from(t).join("; ");super(n),hs(this,"name","CombinedError"),hs(this,fs,e),Xr(this,"stack",()=>e.map(ou).join(` `)),Xr(this,"transient",()=>e.length>0&&e.every(au)),Xr(this,"expected",()=>e.length>0&&e.every(cu))}[Symbol.iterator](){return this[fs][Symbol.iterator]()}};function hs(r,e,t){Object.defineProperty(r,e,{value:t})}function Xr(r,e,t){Object.defineProperty(r,e,{get:t})}function iu(r){return r!=null}function su(r){return r.message}function ou(r){return r.stack}function au(r){return r.transient===!0}function cu(r){return r.expected===!0}});var se=b(Ue=>{"use strict";var uu=$(),ps=new Set;Ue.getOptions=function(r,e){return typeof r=="object"&&r!==null?r:e!==void 0?e:{}};Ue.emptyOptions=Object.freeze({});Ue.noop=function(){};Ue.resolvedPromise=Promise.resolve();Ue.deprecate=function(r){if(!ps.has(r)){ps.add(r);let e=globalThis.console;typeof e<"u"&&typeof e.warn=="function"&&e.warn(new uu(r,{code:"LEVEL_LEGACY"}))}}});var Zr=b(ys=>{"use strict";var lu=$(),Qr=class extends lu{constructor(e){super("Operation has been aborted",{code:"LEVEL_ABORTED",cause:e})}get name(){return"AbortError"}};ys.AbortError=Qr});var ae=b(Bt=>{"use strict";var Qe=$(),fu=It(),{getOptions:en,emptyOptions:tn,noop:hu}=se(),{AbortError:du}=Zr(),Ct=Symbol("decodeOne"),et=Symbol("decodeMany"),oe=Symbol("keyEncoding"),be=Symbol("valueEncoding"),Re=class{#e=!1;#t=null;#r=null;#s=0;#a;#n;#o;#i;constructor(e,t){if(typeof e!="object"||e===null){let n=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${n}`)}if(typeof t!="object"||t===null)throw new TypeError("The second argument must be an options object");this[oe]=t[oe],this[be]=t[be],this.#n=Number.isInteger(t.limit)&&t.limit>=0?t.limit:1/0,this.#a=t.signal!=null?t.signal:null,this.#i=t.snapshot!=null?t.snapshot:null,this.#o=!1,this.db=e,this.db.attachResource(this)}get count(){return this.#s}get limit(){return this.#n}async next(){this.#u();try{if(this.#o||this.#s>=this.#n){this.#o=!0;return}let e=await this._next();if(e===void 0){this.#o=!0;return}try{e=this[Ct](e)}catch(t){throw new Ze(t)}return this.#s++,e}finally{this.#c()}}async _next(){}async nextv(e,t){if(!Number.isInteger(e))throw new TypeError("The first argument 'size' must be an integer");t=en(t,tn),e<1&&(e=1),this.#n<1/0&&(e=Math.min(e,this.#n-this.#s)),this.#u();try{if(this.#o||e<=0)return this.#o=!0,[];let n=await this._nextv(e,t);if(n.length===0)return this.#o=!0,n;try{this[et](n)}catch(i){throw new Ze(i)}return this.#s+=n.length,n}finally{this.#c()}}async _nextv(e,t){let n=[];for(;n.length<e;){let i=await this._next(t);if(i!==void 0)n.push(i);else{this.#o=!0;break}}return n}async all(e){e=en(e,tn),this.#u();try{if(this.#o||this.#s>=this.#n)return[];let t=await this._all(e);try{this[et](t)}catch(n){throw new Ze(n)}return this.#s+=t.length,t}catch(t){this.#c(),await this.#h(t)}finally{this.#o=!0,this.#e&&(this.#c(),await this.close())}}async _all(e){let t=this.#s,n=[];for(;;){let i=this.#n<1/0?Math.min(1e3,this.#n-t):1e3;if(i<=0)return n;let s=await this._nextv(i,e);if(s.length===0)return n;n.push.apply(n,s),t+=s.length}}seek(e,t){if(t=en(t,tn),this.#r===null){if(this.#e)throw new Qe("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let n=this.db.keyEncoding(t.keyEncoding||this[oe]),i=n.format;t.keyEncoding!==i&&(t={...t,keyEncoding:i});let s=this.db.prefixKey(n.encode(e),i,!1);this._seek(s,t),this.#o=!1}}}_seek(e,t){throw new Qe("Iterator does not implement seek()",{code:"LEVEL_NOT_SUPPORTED"})}async close(){return this.#r!==null?this.#r.catch(hu):(this.#r=new Promise((e,t)=>{this.#t=()=>{this.#t=null,this.#f().then(e,t)}}),this.#e||this.#t(),this.#r)}async _close(){}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}catch(e){await this.#h(e)}finally{await this.close()}}#u(){if(this.#r!==null)throw new Qe("Iterator is not open: cannot read after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"});if(this.#e)throw new Qe("Iterator is busy: cannot read until previous read has completed",{code:"LEVEL_ITERATOR_BUSY"});if(this.#a?.aborted)throw new du;this.#i?.ref(),this.#e=!0}#c(){this.#e=!1,this.#t?.(),this.#i?.unref()}async#f(){await this._close(),this.db.detachResource(this)}async#h(e){try{await this.close()}catch(t){throw fu([e,t])}throw e}};typeof Symbol.asyncDispose=="symbol"&&(Re.prototype[Symbol.asyncDispose]=async function(){return this.close()});var tt=class extends Re{#e;#t;constructor(e,t){super(e,t),this.#e=t.keys!==!1,this.#t=t.values!==!1}[Ct](e){let t=e[0],n=e[1];return t!==void 0&&(e[0]=this.#e?this[oe].decode(t):void 0),n!==void 0&&(e[1]=this.#t?this[be].decode(n):void 0),e}[et](e){let t=this[oe],n=this[be];for(let i of e){let s=i[0],o=i[1];s!==void 0&&(i[0]=this.#e?t.decode(s):void 0),o!==void 0&&(i[1]=this.#t?n.decode(o):void 0)}}},rn=class extends Re{[Ct](e){return this[oe].decode(e)}[et](e){let t=this[oe];for(let n=0;n<e.length;n++){let i=e[n];i!==void 0&&(e[n]=t.decode(i))}}},nn=class extends Re{[Ct](e){return this[be].decode(e)}[et](e){let t=this[be];for(let n=0;n<e.length;n++){let i=e[n];i!==void 0&&(e[n]=t.decode(i))}}},Ze=class extends Qe{constructor(e){super("Iterator could not decode data",{code:"LEVEL_DECODE_ERROR",cause:e})}};tt.keyEncoding=oe;tt.valueEncoding=be;Bt.AbstractIterator=tt;Bt.AbstractKeyIterator=rn;Bt.AbstractValueIterator=nn});var ms=b(on=>{"use strict";var{AbstractKeyIterator:pu,AbstractValueIterator:yu}=ae(),xe=Symbol("iterator"),sn=Symbol("handleOne"),Ft=Symbol("handleMany"),Lt=class extends pu{constructor(e,t){super(e,t),this[xe]=e.iterator({...t,keys:!0,values:!1})}[sn](e){return e[0]}[Ft](e){for(let t=0;t<e.length;t++)e[t]=e[t][0]}},Tt=class extends yu{constructor(e,t){super(e,t),this[xe]=e.iterator({...t,keys:!1,values:!0})}[sn](e){return e[1]}[Ft](e){for(let t=0;t<e.length;t++)e[t]=e[t][1]}};for(let r of[Lt,Tt])r.prototype._next=async function(){let e=await this[xe].next();return e===void 0?e:this[sn](e)},r.prototype._nextv=async function(e,t){let n=await this[xe].nextv(e,t);return this[Ft](n),n},r.prototype._all=async function(e){let t=await this[xe].all(e);return this[Ft](t),t},r.prototype._seek=function(e,t){this[xe].seek(e,t)},r.prototype._close=async function(){return this[xe].close()};on.DefaultKeyIterator=Lt;on.DefaultValueIterator=Tt});var ws=b(Mt=>{"use strict";var{AbstractIterator:mu,AbstractKeyIterator:wu,AbstractValueIterator:gu}=ae(),an=$(),R=Symbol("nut"),Dt=Symbol("undefer"),Nt=Symbol("factory"),H=Symbol("signalOptions"),Ot=class extends mu{constructor(e,t){super(e,t),this[R]=null,this[Nt]=()=>e.iterator(t),this[H]={signal:t.signal},this.db.defer(()=>this[Dt](),this[H])}},Ut=class extends wu{constructor(e,t){super(e,t),this[R]=null,this[Nt]=()=>e.keys(t),this[H]={signal:t.signal},this.db.defer(()=>this[Dt](),this[H])}},Rt=class extends gu{constructor(e,t){super(e,t),this[R]=null,this[Nt]=()=>e.values(t),this[H]={signal:t.signal},this.db.defer(()=>this[Dt](),this[H])}};for(let r of[Ot,Ut,Rt])r.prototype[Dt]=function(){this.db.status==="open"&&(this[R]=this[Nt]())},r.prototype._next=async function(){if(this[R]!==null)return this[R].next();if(this.db.status==="opening")return this.db.deferAsync(()=>this._next(),this[H]);throw new an("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})},r.prototype._nextv=async function(e,t){if(this[R]!==null)return this[R].nextv(e,t);if(this.db.status==="opening")return this.db.deferAsync(()=>this._nextv(e,t),this[H]);throw new an("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})},r.prototype._all=async function(e){if(this[R]!==null)return this[R].all();if(this.db.status==="opening")return this.db.deferAsync(()=>this._all(e),this[H]);throw new an("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})},r.prototype._seek=functi