@enbox/dids 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +41 -1
  2. package/dist/browser.js +6 -10
  3. package/dist/browser.js.map +4 -4
  4. package/dist/browser.mjs +6 -10
  5. package/dist/browser.mjs.map +4 -4
  6. package/dist/esm/bearer-did.js +5 -5
  7. package/dist/esm/bearer-did.js.map +1 -1
  8. package/dist/esm/did.js +13 -6
  9. package/dist/esm/did.js.map +1 -1
  10. package/dist/esm/methods/did-dht.js +34 -25
  11. package/dist/esm/methods/did-dht.js.map +1 -1
  12. package/dist/esm/methods/did-ion.js +9 -7
  13. package/dist/esm/methods/did-ion.js.map +1 -1
  14. package/dist/esm/methods/did-jwk.js +3 -3
  15. package/dist/esm/methods/did-jwk.js.map +1 -1
  16. package/dist/esm/methods/did-key.js +12 -240
  17. package/dist/esm/methods/did-key.js.map +1 -1
  18. package/dist/esm/methods/did-web.js +3 -2
  19. package/dist/esm/methods/did-web.js.map +1 -1
  20. package/dist/esm/resolver/resolver-cache-level.js +1 -1
  21. package/dist/esm/resolver/resolver-cache-level.js.map +1 -1
  22. package/dist/esm/resolver/resolver-cache-noop.js +10 -10
  23. package/dist/esm/resolver/resolver-cache-noop.js.map +1 -1
  24. package/dist/esm/resolver/universal-resolver.js +3 -3
  25. package/dist/esm/resolver/universal-resolver.js.map +1 -1
  26. package/dist/esm/utils.js +37 -21
  27. package/dist/esm/utils.js.map +1 -1
  28. package/dist/types/bearer-did.d.ts +3 -2
  29. package/dist/types/bearer-did.d.ts.map +1 -1
  30. package/dist/types/did.d.ts.map +1 -1
  31. package/dist/types/methods/did-dht.d.ts +4 -4
  32. package/dist/types/methods/did-dht.d.ts.map +1 -1
  33. package/dist/types/methods/did-ion.d.ts +3 -2
  34. package/dist/types/methods/did-ion.d.ts.map +1 -1
  35. package/dist/types/methods/did-jwk.d.ts +2 -2
  36. package/dist/types/methods/did-jwk.d.ts.map +1 -1
  37. package/dist/types/methods/did-key.d.ts +3 -52
  38. package/dist/types/methods/did-key.d.ts.map +1 -1
  39. package/dist/types/methods/did-method.d.ts +3 -3
  40. package/dist/types/methods/did-method.d.ts.map +1 -1
  41. package/dist/types/resolver/resolver-cache-level.d.ts.map +1 -1
  42. package/dist/types/resolver/universal-resolver.d.ts +2 -2
  43. package/dist/types/resolver/universal-resolver.d.ts.map +1 -1
  44. package/dist/types/types/did-core.d.ts +1 -1
  45. package/dist/types/types/did-core.d.ts.map +1 -1
  46. package/dist/types/utils.d.ts +8 -5
  47. package/dist/types/utils.d.ts.map +1 -1
  48. package/dist/utils.js +1 -5
  49. package/dist/utils.js.map +4 -4
  50. package/package.json +30 -40
  51. package/src/bearer-did.ts +12 -11
  52. package/src/did.ts +8 -6
  53. package/src/methods/did-dht.ts +35 -35
  54. package/src/methods/did-ion.ts +12 -11
  55. package/src/methods/did-jwk.ts +6 -6
  56. package/src/methods/did-key.ts +24 -305
  57. package/src/methods/did-method.ts +3 -3
  58. package/src/methods/did-web.ts +2 -2
  59. package/src/resolver/resolver-cache-level.ts +4 -4
  60. package/src/resolver/resolver-cache-noop.ts +10 -10
  61. package/src/resolver/universal-resolver.ts +5 -5
  62. package/src/types/did-core.ts +3 -3
  63. package/src/utils.ts +28 -26
  64. package/dist/cjs/index.js +0 -6303
  65. package/dist/cjs/index.js.map +0 -7
  66. package/dist/cjs/package.json +0 -1
  67. package/dist/cjs/utils.js +0 -245
  68. package/dist/cjs/utils.js.map +0 -7
package/dist/utils.js CHANGED
@@ -1,5 +1,4 @@
1
- var wd=Object.create;var vi=Object.defineProperty;var gd=Object.getOwnPropertyDescriptor;var bd=Object.getOwnPropertyNames;var md=Object.getPrototypeOf,xd=Object.prototype.hasOwnProperty;var m=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ed=(t,e)=>{for(var r in e)vi(t,r,{get:e[r],enumerable:!0})},_d=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of bd(e))!xd.call(t,i)&&i!==r&&vi(t,i,{get:()=>e[i],enumerable:!(n=gd(e,i))||n.enumerable});return t};var c=(t,e,r)=>(r=t!=null?wd(md(t)):{},_d(e||!t||!t.__esModule?vi(r,"default",{value:t,enumerable:!0}):r,t));var fa=m(on=>{"use strict";var g0=c(f());on.byteLength=Sd;on.toByteArray=Td;on.fromByteArray=kd;var we=[],ie=[],vd=typeof Uint8Array<"u"?Uint8Array:Array,Si="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ct=0,ua=Si.length;ct<ua;++ct)we[ct]=Si[ct],ie[Si.charCodeAt(ct)]=ct;var ct,ua;ie[45]=62;ie[95]=63;function ca(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Sd(t){var e=ca(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Ad(t,e,r){return(e+r)*3/4-r}function Td(t){var e,r=ca(t),n=r[0],i=r[1],o=new vd(Ad(t,n,i)),s=0,a=i>0?n-4:n,l;for(l=0;l<a;l+=4)e=ie[t.charCodeAt(l)]<<18|ie[t.charCodeAt(l+1)]<<12|ie[t.charCodeAt(l+2)]<<6|ie[t.charCodeAt(l+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=ie[t.charCodeAt(l)]<<2|ie[t.charCodeAt(l+1)]>>4,o[s++]=e&255),i===1&&(e=ie[t.charCodeAt(l)]<<10|ie[t.charCodeAt(l+1)]<<4|ie[t.charCodeAt(l+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Bd(t){return we[t>>18&63]+we[t>>12&63]+we[t>>6&63]+we[t&63]}function Id(t,e,r){for(var n,i=[],o=e;o<r;o+=3)n=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(t[o+2]&255),i.push(Bd(n));return i.join("")}function kd(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Id(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(we[e>>2]+we[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(we[e>>10]+we[e>>4&63]+we[e<<2&63]+"=")),i.join("")}});var la=m(Ai=>{var m0=c(f());Ai.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,l=(1<<a)-1,u=l>>1,d=-7,h=r?i-1:0,g=r?-1:1,y=t[e+h];for(h+=g,o=y&(1<<-d)-1,y>>=-d,d+=a;d>0;o=o*256+t[e+h],h+=g,d-=8);for(s=o&(1<<-d)-1,o>>=-d,d+=n;d>0;s=s*256+t[e+h],h+=g,d-=8);if(o===0)o=1-u;else{if(o===l)return s?NaN:(y?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-u}return(y?-1:1)*s*Math.pow(2,o-n)};Ai.write=function(t,e,r,n,i,o){var s,a,l,u=o*8-i-1,d=(1<<u)-1,h=d>>1,g=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,y=n?0:o-1,b=n?1:-1,w=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=d):(s=Math.floor(Math.log(e)/Math.LN2),e*(l=Math.pow(2,-s))<1&&(s--,l*=2),s+h>=1?e+=g/l:e+=g*Math.pow(2,1-h),e*l>=2&&(s++,l/=2),s+h>=d?(a=0,s=d):s+h>=1?(a=(e*l-1)*Math.pow(2,i),s=s+h):(a=e*Math.pow(2,h-1)*Math.pow(2,i),s=0));i>=8;t[r+y]=a&255,y+=b,a/=256,i-=8);for(s=s<<i|a,u+=i;u>0;t[r+y]=s&255,y+=b,s/=256,u-=8);t[r+y-b]|=w*128}});var X=m($t=>{"use strict";var _0=c(f());var Ti=fa(),qt=la(),da=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;$t.Buffer=p;$t.SlowBuffer=Pd;$t.INSPECT_MAX_BYTES=50;var sn=2147483647;$t.kMaxLength=sn;p.TYPED_ARRAY_SUPPORT=Rd();!p.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 Rd(){try{let t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),t.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function Oe(t){if(t>sn)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,p.prototype),e}function p(t,e,r){if(typeof t=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Ri(t)}return wa(t,e,r)}p.poolSize=8192;function wa(t,e,r){if(typeof t=="string")return Ld(t,e);if(ArrayBuffer.isView(t))return Cd(t);if(t==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(ge(t,ArrayBuffer)||t&&ge(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(ge(t,SharedArrayBuffer)||t&&ge(t.buffer,SharedArrayBuffer)))return Ii(t,e,r);if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let n=t.valueOf&&t.valueOf();if(n!=null&&n!==t)return p.from(n,e,r);let i=Dd(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return p.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}p.from=function(t,e,r){return wa(t,e,r)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function ga(t){if(typeof t!="number")throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function Od(t,e,r){return ga(t),t<=0?Oe(t):e!==void 0?typeof r=="string"?Oe(t).fill(e,r):Oe(t).fill(e):Oe(t)}p.alloc=function(t,e,r){return Od(t,e,r)};function Ri(t){return ga(t),Oe(t<0?0:Oi(t)|0)}p.allocUnsafe=function(t){return Ri(t)};p.allocUnsafeSlow=function(t){return Ri(t)};function Ld(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=ba(t,e)|0,n=Oe(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Bi(t){let e=t.length<0?0:Oi(t.length)|0,r=Oe(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Cd(t){if(ge(t,Uint8Array)){let e=new Uint8Array(t);return Ii(e.buffer,e.byteOffset,e.byteLength)}return Bi(t)}function Ii(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return e===void 0&&r===void 0?n=new Uint8Array(t):r===void 0?n=new Uint8Array(t,e):n=new Uint8Array(t,e,r),Object.setPrototypeOf(n,p.prototype),n}function Dd(t){if(p.isBuffer(t)){let e=Oi(t.length)|0,r=Oe(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||Ci(t.length)?Oe(0):Bi(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Bi(t.data)}function Oi(t){if(t>=sn)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+sn.toString(16)+" bytes");return t|0}function Pd(t){return+t!=t&&(t=0),p.alloc(+t)}p.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype};p.compare=function(e,r){if(ge(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),ge(r,Uint8Array)&&(r=p.from(r,r.offset,r.byteLength)),!p.isBuffer(e)||!p.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let n=e.length,i=r.length;for(let o=0,s=Math.min(n,i);o<s;++o)if(e[o]!==r[o]){n=e[o],i=r[o];break}return n<i?-1:i<n?1:0};p.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}};p.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=p.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let s=e[n];if(ge(s,Uint8Array))o+s.length>i.length?(p.isBuffer(s)||(s=p.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(p.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function ba(t,e){if(p.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||ge(t,ArrayBuffer))return t.byteLength;if(typeof t!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);let r=t.length,n=arguments.length>2&&arguments[2]===!0;if(!n&&r===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return ki(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Ba(t).length;default:if(i)return n?-1:ki(t).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=ba;function Ud(t,e,r){let n=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return"";for(t||(t="utf8");;)switch(t){case"hex":return Hd(this,e,r);case"utf8":case"utf-8":return xa(this,e,r);case"ascii":return Vd(this,e,r);case"latin1":case"binary":return Wd(this,e,r);case"base64":return jd(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Gd(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}p.prototype._isBuffer=!0;function ft(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}p.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 r=0;r<e;r+=2)ft(this,r,r+1);return this};p.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 r=0;r<e;r+=4)ft(this,r,r+3),ft(this,r+1,r+2);return this};p.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 r=0;r<e;r+=8)ft(this,r,r+7),ft(this,r+1,r+6),ft(this,r+2,r+5),ft(this,r+3,r+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?xa(this,0,e):Ud.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.prototype.inspect=function(){let e="",r=$t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};da&&(p.prototype[da]=p.prototype.inspect);p.prototype.compare=function(e,r,n,i,o){if(ge(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),n===void 0&&(n=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),r<0||n>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&r>=n)return 0;if(i>=o)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,o>>>=0,this===e)return 0;let s=o-i,a=n-r,l=Math.min(s,a),u=this.slice(i,o),d=e.slice(r,n);for(let h=0;h<l;++h)if(u[h]!==d[h]){s=u[h],a=d[h];break}return s<a?-1:a<s?1:0};function ma(t,e,r,n,i){if(t.length===0)return-1;if(typeof r=="string"?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,Ci(r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof e=="string"&&(e=p.from(e,n)),p.isBuffer(e))return e.length===0?-1:ha(t,e,r,n,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):ha(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function ha(t,e,r,n,i){let o=1,s=t.length,a=e.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(t.length<2||e.length<2)return-1;o=2,s/=2,a/=2,r/=2}function l(d,h){return o===1?d[h]:d.readUInt16BE(h*o)}let u;if(i){let d=-1;for(u=r;u<s;u++)if(l(t,u)===l(e,d===-1?0:u-d)){if(d===-1&&(d=u),u-d+1===a)return d*o}else d!==-1&&(u-=u-d),d=-1}else for(r+a>s&&(r=s-a),u=r;u>=0;u--){let d=!0;for(let h=0;h<a;h++)if(l(t,u+h)!==l(e,h)){d=!1;break}if(d)return u}return-1}p.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};p.prototype.indexOf=function(e,r,n){return ma(this,e,r,n,!0)};p.prototype.lastIndexOf=function(e,r,n){return ma(this,e,r,n,!1)};function Md(t,e,r,n){r=Number(r)||0;let i=t.length-r;n?(n=Number(n),n>i&&(n=i)):n=i;let o=e.length;n>o/2&&(n=o/2);let s;for(s=0;s<n;++s){let a=parseInt(e.substr(s*2,2),16);if(Ci(a))return s;t[r+s]=a}return s}function Nd(t,e,r,n){return an(ki(e,t.length-r),t,r,n)}function Kd(t,e,r,n){return an(Xd(e),t,r,n)}function Fd(t,e,r,n){return an(Ba(e),t,r,n)}function qd(t,e,r,n){return an(Zd(e,t.length-r),t,r,n)}p.prototype.write=function(e,r,n,i){if(r===void 0)i="utf8",n=this.length,r=0;else if(n===void 0&&typeof r=="string")i=r,n=this.length,r=0;else if(isFinite(r))r=r>>>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 o=this.length-r;if((n===void 0||n>o)&&(n=o),e.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return Md(this,e,r,n);case"utf8":case"utf-8":return Nd(this,e,r,n);case"ascii":case"latin1":case"binary":return Kd(this,e,r,n);case"base64":return Fd(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qd(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function jd(t,e,r){return e===0&&r===t.length?Ti.fromByteArray(t):Ti.fromByteArray(t.slice(e,r))}function xa(t,e,r){r=Math.min(t.length,r);let n=[],i=e;for(;i<r;){let o=t[i],s=null,a=o>239?4:o>223?3:o>191?2:1;if(i+a<=r){let l,u,d,h;switch(a){case 1:o<128&&(s=o);break;case 2:l=t[i+1],(l&192)===128&&(h=(o&31)<<6|l&63,h>127&&(s=h));break;case 3:l=t[i+1],u=t[i+2],(l&192)===128&&(u&192)===128&&(h=(o&15)<<12|(l&63)<<6|u&63,h>2047&&(h<55296||h>57343)&&(s=h));break;case 4:l=t[i+1],u=t[i+2],d=t[i+3],(l&192)===128&&(u&192)===128&&(d&192)===128&&(h=(o&15)<<18|(l&63)<<12|(u&63)<<6|d&63,h>65535&&h<1114112&&(s=h))}}s===null?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|s&1023),n.push(s),i+=a}return $d(n)}var pa=4096;function $d(t){let e=t.length;if(e<=pa)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=pa));return r}function Vd(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]&127);return n}function Wd(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function Hd(t,e,r){let n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let o=e;o<r;++o)i+=Qd[t[o]];return i}function Gd(t,e,r){let n=t.slice(e,r),i="";for(let o=0;o<n.length-1;o+=2)i+=String.fromCharCode(n[o]+n[o+1]*256);return i}p.prototype.slice=function(e,r){let n=this.length;e=~~e,r=r===void 0?n:~~r,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),r<e&&(r=e);let i=this.subarray(e,r);return Object.setPrototypeOf(i,p.prototype),i};function q(t,e,r){if(t%1!==0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return i};p.prototype.readUintBE=p.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};p.prototype.readUint8=p.prototype.readUInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||q(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readBigUInt64LE=Ge(function(e){e=e>>>0,jt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mr(e,this.length-8);let i=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+n*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});p.prototype.readBigUInt64BE=Ge(function(e){e=e>>>0,jt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mr(e,this.length-8);let i=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+n;return(BigInt(i)<<BigInt(32))+BigInt(o)});p.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*r)),i};p.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||q(e,r,this.length);let i=r,o=1,s=this[e+--i];for(;i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*r)),s};p.prototype.readInt8=function(e,r){return e=e>>>0,r||q(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,r){e=e>>>0,r||q(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};p.prototype.readInt16BE=function(e,r){e=e>>>0,r||q(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};p.prototype.readInt32LE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,r){return e=e>>>0,r||q(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readBigInt64LE=Ge(function(e){e=e>>>0,jt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mr(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(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});p.prototype.readBigInt64BE=Ge(function(e){e=e>>>0,jt(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&mr(e,this.length-8);let i=(r<<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)});p.prototype.readFloatLE=function(e,r){return e=e>>>0,r||q(e,4,this.length),qt.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,r){return e=e>>>0,r||q(e,4,this.length),qt.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||q(e,8,this.length),qt.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||q(e,8,this.length),qt.read(this,e,!1,52,8)};function Y(t,e,r,n,i,o){if(!p.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Y(this,e,r,n,a,0)}let o=1,s=0;for(this[r]=e&255;++s<n&&(o*=256);)this[r+s]=e/o&255;return r+n};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,n=n>>>0,!i){let a=Math.pow(2,8*n)-1;Y(this,e,r,n,a,0)}let o=n-1,s=1;for(this[r+o]=e&255;--o>=0&&(s*=256);)this[r+o]=e/s&255;return r+n};p.prototype.writeUint8=p.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,1,255,0),this[r]=e&255,r+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function Ea(t,e,r,n,i){Ta(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o,o=o>>8,t[r++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,s=s>>8,t[r++]=s,r}function _a(t,e,r,n,i){Ta(e,n,i,t,r,7);let o=Number(e&BigInt(4294967295));t[r+7]=o,o=o>>8,t[r+6]=o,o=o>>8,t[r+5]=o,o=o>>8,t[r+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=s,s=s>>8,t[r+2]=s,s=s>>8,t[r+1]=s,s=s>>8,t[r]=s,r+8}p.prototype.writeBigUInt64LE=Ge(function(e,r=0){return Ea(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=Ge(function(e,r=0){return _a(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Y(this,e,r,n,l-1,-l)}let o=0,s=1,a=0;for(this[r]=e&255;++o<n&&(s*=256);)e<0&&a===0&&this[r+o-1]!==0&&(a=1),this[r+o]=(e/s>>0)-a&255;return r+n};p.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let l=Math.pow(2,8*n-1);Y(this,e,r,n,l-1,-l)}let o=n-1,s=1,a=0;for(this[r+o]=e&255;--o>=0&&(s*=256);)e<0&&a===0&&this[r+o+1]!==0&&(a=1),this[r+o]=(e/s>>0)-a&255;return r+n};p.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};p.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};p.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};p.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4};p.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Y(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};p.prototype.writeBigInt64LE=Ge(function(e,r=0){return Ea(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=Ge(function(e,r=0){return _a(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function va(t,e,r,n,i,o){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Sa(t,e,r,n,i){return e=+e,r=r>>>0,i||va(t,e,r,4,34028234663852886e22,-34028234663852886e22),qt.write(t,e,r,n,23,4),r+4}p.prototype.writeFloatLE=function(e,r,n){return Sa(this,e,r,!0,n)};p.prototype.writeFloatBE=function(e,r,n){return Sa(this,e,r,!1,n)};function Aa(t,e,r,n,i){return e=+e,r=r>>>0,i||va(t,e,r,8,17976931348623157e292,-17976931348623157e292),qt.write(t,e,r,n,52,8),r+8}p.prototype.writeDoubleLE=function(e,r,n){return Aa(this,e,r,!0,n)};p.prototype.writeDoubleBE=function(e,r,n){return Aa(this,e,r,!1,n)};p.prototype.copy=function(e,r,n,i){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(n||(n=0),!i&&i!==0&&(i=this.length),r>=e.length&&(r=e.length),r||(r=0),i>0&&i<n&&(i=n),i===n||e.length===0||this.length===0)return 0;if(r<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-r<i-n&&(i=e.length-r+n);let o=i-n;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,n,i):Uint8Array.prototype.set.call(e,this.subarray(n,i),r),o};p.prototype.fill=function(e,r,n,i){if(typeof e=="string"){if(typeof r=="string"?(i=r,r=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"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let s=e.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<n)throw new RangeError("Out of range index");if(n<=r)return this;r=r>>>0,n=n===void 0?this.length:n>>>0,e||(e=0);let o;if(typeof e=="number")for(o=r;o<n;++o)this[o]=e;else{let s=p.isBuffer(e)?e:p.from(e,i),a=s.length;if(a===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<n-r;++o)this[o+r]=s[o%a]}return this};var Ft={};function Li(t,e,r){Ft[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}Li("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Li("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Li("ERR_OUT_OF_RANGE",function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=ya(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=ya(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function ya(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function Jd(t,e,r){jt(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&mr(e,t.length-(r+1))}function Ta(t,e,r,n,i,o){if(t>r||t<e){let s=typeof e=="bigint"?"n":"",a;throw o>3?e===0||e===BigInt(0)?a=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:a=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:a=`>= ${e}${s} and <= ${r}${s}`,new Ft.ERR_OUT_OF_RANGE("value",a,t)}Jd(n,i,o)}function jt(t,e){if(typeof t!="number")throw new Ft.ERR_INVALID_ARG_TYPE(e,"number",t)}function mr(t,e,r){throw Math.floor(t)!==t?(jt(t,r),new Ft.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Ft.ERR_BUFFER_OUT_OF_BOUNDS:new Ft.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var zd=/[^+/0-9A-Za-z-_]/g;function Yd(t){if(t=t.split("=")[0],t=t.trim().replace(zd,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function ki(t,e){e=e||1/0;let r,n=t.length,i=null,o=[];for(let s=0;s<n;++s){if(r=t.charCodeAt(s),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===n){(e-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&o.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;o.push(r)}else if(r<2048){if((e-=2)<0)break;o.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;o.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return o}function Xd(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Zd(t,e){let r,n,i,o=[];for(let s=0;s<t.length&&!((e-=2)<0);++s)r=t.charCodeAt(s),n=r>>8,i=r%256,o.push(i),o.push(n);return o}function Ba(t){return Ti.toByteArray(Yd(t))}function an(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function ge(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function Ci(t){return t!==t}var Qd=function(){let t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let n=r*16;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function Ge(t){return typeof BigInt>"u"?eh:t}function eh(){throw new Error("BigInt not supported")}});var f=m(()=>{"use strict";var Ia=X().Buffer,{Buffer:th}=X();Ia.prototype.writeBigUInt64BE=th.prototype.writeBigUInt64BE;globalThis.Buffer=Ia});var Ra=m((A0,ka)=>{var T0=c(f()),rh=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,un=()=>rh.now(),nh=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t),Di=t=>t===1/0||nh(t),Pi=class t{constructor({max:e=1/0,ttl:r,updateAgeOnGet:n=!1,checkAgeOnGet:i=!1,noUpdateTTL:o=!1,dispose:s,noDisposeOnSet:a=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,r!==void 0&&!Di(r))throw new TypeError("ttl must be positive integer or Infinity if set");if(!Di(e))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=r,this.max=e,this.updateAgeOnGet=!!n,this.checkAgeOnGet=!!i,this.noUpdateTTL=!!o,this.noDisposeOnSet=!!a,s!==void 0){if(typeof s!="function")throw new TypeError("dispose must be function if set");this.dispose=s}this.timer=void 0,this.timerExpiration=void 0}setTimer(e,r){if(this.timerExpiration<e)return;this.timer&&clearTimeout(this.timer);let n=setTimeout(()=>{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(let i in this.expirations){this.setTimer(i,i-un());break}},r);n.unref&&n.unref(),this.timerExpiration=e,this.timer=n}cancelTimer(){this.timer&&(clearTimeout(this.timer),this.timerExpiration=void 0,this.timer=void 0)}cancelTimers(){return process.emitWarning('TTLCache.cancelTimers has been renamed to TTLCache.cancelTimer (no "s"), and will be removed in the next major version update'),this.cancelTimer()}clear(){let e=this.dispose!==t.prototype.dispose?[...this]:[];this.data.clear(),this.expirationMap.clear(),this.cancelTimer(),this.expirations=Object.create(null);for(let[r,n]of e)this.dispose(n,r,"delete")}setTTL(e,r=this.ttl){let n=this.expirationMap.get(e);if(n!==void 0){let i=this.expirations[n];!i||i.length<=1?delete this.expirations[n]:this.expirations[n]=i.filter(o=>o!==e)}if(r!==1/0){let i=Math.floor(un()+r);this.expirationMap.set(e,i),this.expirations[i]||(this.expirations[i]=[],this.setTimer(i,r)),this.expirations[i].push(e)}else this.expirationMap.set(e,1/0)}set(e,r,{ttl:n=this.ttl,noUpdateTTL:i=this.noUpdateTTL,noDisposeOnSet:o=this.noDisposeOnSet}={}){if(!Di(n))throw new TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(e)){i||this.setTTL(e,n);let s=this.data.get(e);s!==r&&(this.data.set(e,r),o||this.dispose(s,e,"set"))}else this.setTTL(e,n),this.data.set(e,r);for(;this.size>this.max;)this.purgeToCapacity();return this}has(e){return this.data.has(e)}getRemainingTTL(e){let r=this.expirationMap.get(e);return r===1/0?r:r!==void 0?Math.max(0,Math.ceil(r-un())):0}get(e,{updateAgeOnGet:r=this.updateAgeOnGet,ttl:n=this.ttl,checkAgeOnGet:i=this.checkAgeOnGet}={}){let o=this.data.get(e);if(i&&this.getRemainingTTL(e)===0){this.delete(e);return}return r&&this.setTTL(e,n),o}dispose(e,r){}delete(e){let r=this.expirationMap.get(e);if(r!==void 0){let n=this.data.get(e);this.data.delete(e),this.expirationMap.delete(e);let i=this.expirations[r];return i&&(i.length<=1?delete this.expirations[r]:this.expirations[r]=i.filter(o=>o!==e)),this.dispose(n,e,"delete"),this.size===0&&this.cancelTimer(),!0}return!1}purgeToCapacity(){for(let e in this.expirations){let r=this.expirations[e];if(this.size-r.length>=this.max){delete this.expirations[e];let n=[];for(let i of r)n.push([i,this.data.get(i)]),this.data.delete(i),this.expirationMap.delete(i);for(let[i,o]of n)this.dispose(o,i,"evict")}else{let n=this.size-this.max,i=[];for(let o of r.splice(0,n))i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"evict");return}}}get size(){return this.data.size}purgeStale(){let e=Math.ceil(un());for(let r in this.expirations){if(r==="Infinity"||r>e)return;let n=[...this.expirations[r]||[]],i=[];delete this.expirations[r];for(let o of n)i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"stale")}this.size===0&&this.cancelTimer()}*entries(){for(let e in this.expirations)for(let r of this.expirations[e])yield[r,this.data.get(r)]}*keys(){for(let e in this.expirations)for(let r of this.expirations[e])yield r}*values(){for(let e in this.expirations)for(let r of this.expirations[e])yield this.data.get(r)}[Symbol.iterator](){return this.entries()}};ka.exports=Pi});var Ga=m(Ha=>{"use strict";var Gx=c(f());Ha.supports=function(...e){let r=e.reduce((n,i)=>Object.assign(n,i),{});return Object.assign(r,{snapshots:r.snapshots||!1,permanence:r.permanence||!1,seek:r.seek||!1,clear:r.clear||!1,getMany:r.getMany||!1,keyIterator:r.keyIterator||!1,valueIterator:r.valueIterator||!1,iteratorNextv:r.iteratorNextv||!1,iteratorAll:r.iteratorAll||!1,status:r.status||!1,createIfMissing:r.createIfMissing||!1,errorIfExists:r.errorIfExists||!1,deferredOpen:r.deferredOpen||!1,promises:r.promises||!1,streams:r.streams||!1,encodings:Object.assign({},r.encodings),events:Object.assign({},r.events),additionalMethods:Object.assign({},r.additionalMethods)})}});var fe=m((zx,Ja)=>{"use strict";var Yx=c(f());Ja.exports=class extends Error{constructor(e,r){super(e||""),typeof r=="object"&&r!==null&&(r.code&&(this.code=String(r.code)),r.expected&&(this.expected=!0),r.transient&&(this.transient=!0),r.cause&&(this.cause=r.cause)),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}}});var Yi=m((Xx,za)=>{"use strict";var Zx=c(f()),zi=null;za.exports=function(){return zi===null&&(zi={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),zi}});var Qi=m(Ya=>{"use strict";var eE=c(f()),Xi=fe(),Uh=new Set(["buffer","view","utf8"]),Zi=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"||!Uh.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 Xi(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new Xi(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new Xi(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};Ya.Encoding=Zi});var no=m(ln=>{"use strict";var rE=c(f()),{Buffer:to}=X()||{},{Encoding:ro}=Qi(),Mh=Yi(),Ar=class extends ro{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new Tr({encode:this.encode,decode:e=>this.decode(to.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},Tr=class extends ro{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new Ar({encode:e=>{let r=this.encode(e);return to.from(r.buffer,r.byteOffset,r.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},eo=class extends ro{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new Ar({encode:e=>to.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:r}=Mh();return new Tr({encode:n=>e.encode(this.encode(n)),decode:n=>this.decode(r.decode(n)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};ln.BufferFormat=Ar;ln.ViewFormat=Tr;ln.UTF8Format=eo});var eu=m(pt=>{"use strict";var iE=c(f()),{Buffer:W}=X()||{Buffer:{isBuffer:()=>!1}},{textEncoder:Za,textDecoder:Xa}=Yi()(),{BufferFormat:Br,ViewFormat:io,UTF8Format:Qa}=no(),dn=t=>t;pt.utf8=new Qa({encode:function(t){return W.isBuffer(t)?t.toString("utf8"):ArrayBuffer.isView(t)?Xa.decode(t):String(t)},decode:dn,name:"utf8",createViewTranscoder(){return new io({encode:function(t){return ArrayBuffer.isView(t)?t:Za.encode(t)},decode:function(t){return Xa.decode(t)},name:`${this.name}+view`})},createBufferTranscoder(){return new Br({encode:function(t){return W.isBuffer(t)?t:ArrayBuffer.isView(t)?W.from(t.buffer,t.byteOffset,t.byteLength):W.from(String(t),"utf8")},decode:function(t){return t.toString("utf8")},name:`${this.name}+buffer`})}});pt.json=new Qa({encode:JSON.stringify,decode:JSON.parse,name:"json"});pt.buffer=new Br({encode:function(t){return W.isBuffer(t)?t:ArrayBuffer.isView(t)?W.from(t.buffer,t.byteOffset,t.byteLength):W.from(String(t),"utf8")},decode:dn,name:"buffer",createViewTranscoder(){return new io({encode:function(t){return ArrayBuffer.isView(t)?t:W.from(String(t),"utf8")},decode:function(t){return W.from(t.buffer,t.byteOffset,t.byteLength)},name:`${this.name}+view`})}});pt.view=new io({encode:function(t){return ArrayBuffer.isView(t)?t:Za.encode(t)},decode:dn,name:"view",createBufferTranscoder(){return new Br({encode:function(t){return W.isBuffer(t)?t:ArrayBuffer.isView(t)?W.from(t.buffer,t.byteOffset,t.byteLength):W.from(String(t),"utf8")},decode:dn,name:`${this.name}+buffer`})}});pt.hex=new Br({encode:function(t){return W.isBuffer(t)?t:W.from(String(t),"hex")},decode:function(t){return t.toString("hex")},name:"hex"});pt.base64=new Br({encode:function(t){return W.isBuffer(t)?t:W.from(String(t),"base64")},decode:function(t){return t.toString("base64")},name:"base64"})});var nu=m(ru=>{"use strict";var sE=c(f()),tu=fe(),pn=eu(),{Encoding:Nh}=Qi(),{BufferFormat:Kh,ViewFormat:Fh,UTF8Format:qh}=no(),Ir=Symbol("formats"),hn=Symbol("encodings"),jh=new Set(["buffer","view","utf8"]),oo=class{constructor(e){if(Array.isArray(e)){if(!e.every(r=>jh.has(r)))throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}else throw new TypeError("The first argument 'formats' must be an array");this[hn]=new Map,this[Ir]=new Set(e);for(let r in pn)try{this.encoding(r)}catch(n){if(n.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw n}}encodings(){return Array.from(new Set(this[hn].values()))}encoding(e){let r=this[hn].get(e);if(r===void 0){if(typeof e=="string"&&e!==""){if(r=Hh[e],!r)throw new tu(`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");r=$h(e)}let{name:n,format:i}=r;if(!this[Ir].has(i))if(this[Ir].has("view"))r=r.createViewTranscoder();else if(this[Ir].has("buffer"))r=r.createBufferTranscoder();else if(this[Ir].has("utf8"))r=r.createUTF8Transcoder();else throw new tu(`Encoding '${n}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,n,r.name,r.commonName])this[hn].set(o,r)}return r}};ru.Transcoder=oo;function $h(t){if(t instanceof Nh)return t;let e="type"in t&&typeof t.type=="string"?t.type:void 0,r=t.name||e||`anonymous-${Gh++}`;switch(Vh(t)){case"view":return new Fh({...t,name:r});case"utf8":return new qh({...t,name:r});case"buffer":return new Kh({...t,name:r});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function Vh(t){return"format"in t&&t.format!==void 0?t.format:"buffer"in t&&typeof t.buffer=="boolean"?t.buffer?"buffer":"utf8":"code"in t&&Number.isInteger(t.code)?"view":"buffer"}var Wh={binary:pn.buffer,"utf-8":pn.utf8},Hh={...pn,...Wh},Gh=0});var Jt=m((aE,so)=>{"use strict";var uE=c(f()),Gt=typeof Reflect=="object"?Reflect:null,iu=Gt&&typeof Gt.apply=="function"?Gt.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},yn;Gt&&typeof Gt.ownKeys=="function"?yn=Gt.ownKeys:Object.getOwnPropertySymbols?yn=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:yn=function(e){return Object.getOwnPropertyNames(e)};function Jh(t){console&&console.warn&&console.warn(t)}var su=Number.isNaN||function(e){return e!==e};function R(){R.init.call(this)}so.exports=R;so.exports.once=Zh;R.EventEmitter=R;R.prototype._events=void 0;R.prototype._eventsCount=0;R.prototype._maxListeners=void 0;var ou=10;function wn(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(R,"defaultMaxListeners",{enumerable:!0,get:function(){return ou},set:function(t){if(typeof t!="number"||t<0||su(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");ou=t}});R.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};R.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||su(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 au(t){return t._maxListeners===void 0?R.defaultMaxListeners:t._maxListeners}R.prototype.getMaxListeners=function(){return au(this)};R.prototype.emit=function(e){for(var r=[],n=1;n<arguments.length;n++)r.push(arguments[n]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(r.length>0&&(s=r[0]),s instanceof Error)throw s;var a=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw a.context=s,a}var l=o[e];if(l===void 0)return!1;if(typeof l=="function")iu(l,this,r);else for(var u=l.length,d=du(l,u),n=0;n<u;++n)iu(d[n],this,r);return!0};function uu(t,e,r,n){var i,o,s;if(wn(r),o=t._events,o===void 0?(o=t._events=Object.create(null),t._eventsCount=0):(o.newListener!==void 0&&(t.emit("newListener",e,r.listener?r.listener:r),o=t._events),s=o[e]),s===void 0)s=o[e]=r,++t._eventsCount;else if(typeof s=="function"?s=o[e]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),i=au(t),i>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=t,a.type=e,a.count=s.length,Jh(a)}return t}R.prototype.addListener=function(e,r){return uu(this,e,r,!1)};R.prototype.on=R.prototype.addListener;R.prototype.prependListener=function(e,r){return uu(this,e,r,!0)};function zh(){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 cu(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=zh.bind(n);return i.listener=r,n.wrapFn=i,i}R.prototype.once=function(e,r){return wn(r),this.on(e,cu(this,e,r)),this};R.prototype.prependOnceListener=function(e,r){return wn(r),this.prependListener(e,cu(this,e,r)),this};R.prototype.removeListener=function(e,r){var n,i,o,s,a;if(wn(r),i=this._events,i===void 0)return this;if(n=i[e],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,n.listener||r));else if(typeof n!="function"){for(o=-1,s=n.length-1;s>=0;s--)if(n[s]===r||n[s].listener===r){a=n[s].listener,o=s;break}if(o<0)return this;o===0?n.shift():Yh(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};R.prototype.off=R.prototype.removeListener;R.prototype.removeAllListeners=function(e){var r,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 o=Object.keys(n),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(r=n[e],typeof r=="function")this.removeListener(e,r);else if(r!==void 0)for(i=r.length-1;i>=0;i--)this.removeListener(e,r[i]);return this};function fu(t,e,r){var n=t._events;if(n===void 0)return[];var i=n[e];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?Xh(i):du(i,i.length)}R.prototype.listeners=function(e){return fu(this,e,!0)};R.prototype.rawListeners=function(e){return fu(this,e,!1)};R.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):lu.call(t,e)};R.prototype.listenerCount=lu;function lu(t){var e=this._events;if(e!==void 0){var r=e[t];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}R.prototype.eventNames=function(){return this._eventsCount>0?yn(this._events):[]};function du(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Yh(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function Xh(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Zh(t,e){return new Promise(function(r,n){function i(s){t.removeListener(e,o),n(s)}function o(){typeof t.removeListener=="function"&&t.removeListener("error",i),r([].slice.call(arguments))}hu(t,e,o,{once:!0}),e!=="error"&&Qh(t,i,{once:!0})})}function Qh(t,e,r){typeof t.on=="function"&&hu(t,"error",e,r)}function hu(t,e,r,n){if(typeof t.on=="function")n.once?t.once(e,r):t.on(e,r);else if(typeof t.addEventListener=="function")t.addEventListener(e,function i(o){n.once&&t.removeEventListener(e,i),r(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof t)}});var yu=m((cE,pu)=>{var fE=c(f());pu.exports=typeof queueMicrotask=="function"?queueMicrotask:t=>Promise.resolve().then(t)});var kr=m(ao=>{"use strict";var dE=c(f()),wu=yu();ao.fromCallback=function(t,e){if(t===void 0){var r=new Promise(function(n,i){t=function(o,s){o?i(o):n(s)}});t[e!==void 0?e:"promise"]=r}else if(typeof t!="function")throw new TypeError("Callback must be a function");return t};ao.fromPromise=function(t,e){if(e===void 0)return t;t.then(function(r){wu(()=>e(null,r))}).catch(function(r){wu(()=>e(r))})}});var gn=m(uo=>{"use strict";var pE=c(f());uo.getCallback=function(t,e){return typeof t=="function"?t:e};uo.getOptions=function(t,e){return typeof t=="object"&&t!==null?t:e!==void 0?e:{}}});var Qe=m(En=>{"use strict";var wE=c(f()),{fromCallback:co}=kr(),te=fe(),{getOptions:fo,getCallback:gu}=gn(),yt=Symbol("promise"),zt=Symbol("callback"),me=Symbol("working"),wt=Symbol("handleOne"),Ce=Symbol("handleMany"),lo=Symbol("autoClose"),Xe=Symbol("finishWork"),xe=Symbol("returnMany"),Je=Symbol("closing"),Rr=Symbol("handleClose"),bn=Symbol("closed"),Or=Symbol("closeCallbacks"),Ye=Symbol("keyEncoding"),gt=Symbol("valueEncoding"),ho=Symbol("abortOnClose"),mn=Symbol("legacy"),po=Symbol("keys"),yo=Symbol("values"),ze=Symbol("limit"),oe=Symbol("count"),xn=Object.freeze({}),ep=()=>{},bu=!1,Lr=class{constructor(e,r,n){if(typeof e!="object"||e===null){let i=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${i}`)}if(typeof r!="object"||r===null)throw new TypeError("The second argument must be an options object");this[bn]=!1,this[Or]=[],this[me]=!1,this[Je]=!1,this[lo]=!1,this[zt]=null,this[wt]=this[wt].bind(this),this[Ce]=this[Ce].bind(this),this[Rr]=this[Rr].bind(this),this[Ye]=r[Ye],this[gt]=r[gt],this[mn]=n,this[ze]=Number.isInteger(r.limit)&&r.limit>=0?r.limit:1/0,this[oe]=0,this[ho]=!!r.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[oe]}get limit(){return this[ze]}next(e){let r;if(e===void 0)r=new Promise((n,i)=>{e=(o,s,a)=>{o?i(o):this[mn]?s===void 0&&a===void 0?n():n([s,a]):n(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[Je]?this.nextTick(e,new te("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[me]?this.nextTick(e,new te("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[me]=!0,this[zt]=e,this[oe]>=this[ze]?this.nextTick(this[wt],null):this._next(this[wt])),r}_next(e){this.nextTick(e)}nextv(e,r,n){return n=gu(r,n),n=co(n,yt),r=fo(r,xn),Number.isInteger(e)?(this[Je]?this.nextTick(n,new te("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[me]?this.nextTick(n,new te("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[ze]<1/0&&(e=Math.min(e,this[ze]-this[oe])),this[me]=!0,this[zt]=n,e<=0?this.nextTick(this[Ce],null,[]):this._nextv(e,r,this[Ce])),n[yt]):(this.nextTick(n,new TypeError("The first argument 'size' must be an integer")),n[yt])}_nextv(e,r,n){let i=[],o=(s,a,l)=>{if(s)return n(s);if(this[mn]?a===void 0&&l===void 0:a===void 0)return n(null,i);i.push(this[mn]?[a,l]:a),i.length===e?n(null,i):this._next(o)};this._next(o)}all(e,r){return r=gu(e,r),r=co(r,yt),e=fo(e,xn),this[Je]?this.nextTick(r,new te("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[me]?this.nextTick(r,new te("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[me]=!0,this[zt]=r,this[lo]=!0,this[oe]>=this[ze]?this.nextTick(this[Ce],null,[]):this._all(e,this[Ce])),r[yt]}_all(e,r){let n=this[oe],i=[],o=()=>{let a=this[ze]<1/0?Math.min(1e3,this[ze]-n):1e3;a<=0?this.nextTick(r,null,i):this._nextv(a,xn,s)},s=(a,l)=>{a?r(a):l.length===0?r(null,i):(i.push.apply(i,l),n+=l.length,o())};o()}[Xe](){let e=this[zt];return this[ho]&&e===null?ep:(this[me]=!1,this[zt]=null,this[Je]&&this._close(this[Rr]),e)}[xe](e,r,n){this[lo]?this.close(e.bind(null,r,n)):e(r,n)}seek(e,r){if(r=fo(r,xn),!this[Je]){if(this[me])throw new te("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let n=this.db.keyEncoding(r.keyEncoding||this[Ye]),i=n.format;r.keyEncoding!==i&&(r={...r,keyEncoding:i});let o=this.db.prefixKey(n.encode(e),i);this._seek(o,r)}}}_seek(e,r){throw new te("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(e){return e=co(e,yt),this[bn]?this.nextTick(e):this[Je]?this[Or].push(e):(this[Je]=!0,this[Or].push(e),this[me]?this[ho]&&this[Xe]()(new te("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[Rr])),e[yt]}_close(e){this.nextTick(e)}[Rr](){this[bn]=!0,this.db.detachResource(this);let e=this[Or];this[Or]=[];for(let r of e)r()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}finally{this[bn]||await this.close()}}},Yt=class extends Lr{constructor(e,r){super(e,r,!0),this[po]=r.keys!==!1,this[yo]=r.values!==!1}[wt](e,r,n){let i=this[Xe]();if(e)return i(e);try{r=this[po]&&r!==void 0?this[Ye].decode(r):void 0,n=this[yo]&&n!==void 0?this[gt].decode(n):void 0}catch(o){return i(new Ze("entry",o))}r===void 0&&n===void 0||this[oe]++,i(null,r,n)}[Ce](e,r){let n=this[Xe]();if(e)return this[xe](n,e);try{for(let i of r){let o=i[0],s=i[1];i[0]=this[po]&&o!==void 0?this[Ye].decode(o):void 0,i[1]=this[yo]&&s!==void 0?this[gt].decode(s):void 0}}catch(i){return this[xe](n,new Ze("entries",i))}this[oe]+=r.length,this[xe](n,null,r)}end(e){return!bu&&typeof console<"u"&&(bu=!0,console.warn(new te("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(e)}},wo=class extends Lr{constructor(e,r){super(e,r,!1)}[wt](e,r){let n=this[Xe]();if(e)return n(e);try{r=r!==void 0?this[Ye].decode(r):void 0}catch(i){return n(new Ze("key",i))}r!==void 0&&this[oe]++,n(null,r)}[Ce](e,r){let n=this[Xe]();if(e)return this[xe](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[Ye].decode(o):void 0}}catch(i){return this[xe](n,new Ze("keys",i))}this[oe]+=r.length,this[xe](n,null,r)}},go=class extends Lr{constructor(e,r){super(e,r,!1)}[wt](e,r){let n=this[Xe]();if(e)return n(e);try{r=r!==void 0?this[gt].decode(r):void 0}catch(i){return n(new Ze("value",i))}r!==void 0&&this[oe]++,n(null,r)}[Ce](e,r){let n=this[Xe]();if(e)return this[xe](n,e);try{for(let i=0;i<r.length;i++){let o=r[i];r[i]=o!==void 0?this[gt].decode(o):void 0}}catch(i){return this[xe](n,new Ze("values",i))}this[oe]+=r.length,this[xe](n,null,r)}},Ze=class extends te{constructor(e,r){super(`Iterator could not decode ${e}`,{code:"LEVEL_DECODE_ERROR",cause:r})}};for(let t of["_ended property","_nexting property","_end method"])Object.defineProperty(Yt.prototype,t.split(" ")[0],{get(){throw new te(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new te(`The ${t} has been removed`,{code:"LEVEL_LEGACY"})}});Yt.keyEncoding=Ye;Yt.valueEncoding=gt;En.AbstractIterator=Yt;En.AbstractKeyIterator=wo;En.AbstractValueIterator=go});var mu=m(bo=>{"use strict";var bE=c(f()),{AbstractKeyIterator:tp,AbstractValueIterator:rp}=Qe(),bt=Symbol("iterator"),Cr=Symbol("callback"),Xt=Symbol("handleOne"),mt=Symbol("handleMany"),Dr=class extends tp{constructor(e,r){super(e,r),this[bt]=e.iterator({...r,keys:!0,values:!1}),this[Xt]=this[Xt].bind(this),this[mt]=this[mt].bind(this)}},_n=class extends rp{constructor(e,r){super(e,r),this[bt]=e.iterator({...r,keys:!1,values:!0}),this[Xt]=this[Xt].bind(this),this[mt]=this[mt].bind(this)}};for(let t of[Dr,_n]){let e=t===Dr,r=e?n=>n[0]:n=>n[1];t.prototype._next=function(n){this[Cr]=n,this[bt].next(this[Xt])},t.prototype[Xt]=function(n,i,o){let s=this[Cr];n?s(n):s(null,e?i:o)},t.prototype._nextv=function(n,i,o){this[Cr]=o,this[bt].nextv(n,i,this[mt])},t.prototype._all=function(n,i){this[Cr]=i,this[bt].all(n,this[mt])},t.prototype[mt]=function(n,i){let o=this[Cr];n?o(n):o(null,i.map(r))},t.prototype._seek=function(n,i){this[bt].seek(n,i)},t.prototype._close=function(n){this[bt].close(n)}}bo.DefaultKeyIterator=Dr;bo.DefaultValueIterator=_n});var xu=m(In=>{"use strict";var xE=c(f()),{AbstractIterator:np,AbstractKeyIterator:ip,AbstractValueIterator:op}=Qe(),mo=fe(),Q=Symbol("nut"),Tn=Symbol("undefer"),Bn=Symbol("factory"),vn=class extends np{constructor(e,r){super(e,r),this[Q]=null,this[Bn]=()=>e.iterator(r),this.db.defer(()=>this[Tn]())}},Sn=class extends ip{constructor(e,r){super(e,r),this[Q]=null,this[Bn]=()=>e.keys(r),this.db.defer(()=>this[Tn]())}},An=class extends op{constructor(e,r){super(e,r),this[Q]=null,this[Bn]=()=>e.values(r),this.db.defer(()=>this[Tn]())}};for(let t of[vn,Sn,An])t.prototype[Tn]=function(){this.db.status==="open"&&(this[Q]=this[Bn]())},t.prototype._next=function(e){this[Q]!==null?this[Q].next(e):this.db.status==="opening"?this.db.defer(()=>this._next(e)):this.nextTick(e,new mo("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._nextv=function(e,r,n){this[Q]!==null?this[Q].nextv(e,r,n):this.db.status==="opening"?this.db.defer(()=>this._nextv(e,r,n)):this.nextTick(n,new mo("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._all=function(e,r){this[Q]!==null?this[Q].all(r):this.db.status==="opening"?this.db.defer(()=>this._all(e,r)):this.nextTick(r,new mo("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},t.prototype._seek=function(e,r){this[Q]!==null?this[Q]._seek(e,r):this.db.status==="opening"&&this.db.defer(()=>this._seek(e,r))},t.prototype._close=function(e){this[Q]!==null?this[Q].close(e):this.db.status==="opening"?this.db.defer(()=>this._close(e)):this.nextTick(e)};In.DeferredIterator=vn;In.DeferredKeyIterator=Sn;In.DeferredValueIterator=An});var Eo=m(_u=>{"use strict";var _E=c(f()),{fromCallback:Eu}=kr(),kn=fe(),{getCallback:sp,getOptions:ap}=gn(),Rn=Symbol("promise"),se=Symbol("status"),Zt=Symbol("operations"),Pr=Symbol("finishClose"),Qt=Symbol("closeCallbacks"),xo=class{constructor(e){if(typeof e!="object"||e===null){let r=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${r}`)}this[Zt]=[],this[Qt]=[],this[se]="open",this[Pr]=this[Pr].bind(this),this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get length(){return this[Zt].length}put(e,r,n){if(this[se]!=="open")throw new kn("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let i=this.db._checkKey(e)||this.db._checkValue(r);if(i)throw i;let o=n&&n.sublevel!=null?n.sublevel:this.db,s=n,a=o.keyEncoding(n&&n.keyEncoding),l=o.valueEncoding(n&&n.valueEncoding),u=a.format;n={...n,keyEncoding:u,valueEncoding:l.format},o!==this.db&&(n.sublevel=null);let d=o.prefixKey(a.encode(e),u),h=l.encode(r);return this._put(d,h,n),this[Zt].push({...s,type:"put",key:e,value:r}),this}_put(e,r,n){}del(e,r){if(this[se]!=="open")throw new kn("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let n=this.db._checkKey(e);if(n)throw n;let i=r&&r.sublevel!=null?r.sublevel:this.db,o=r,s=i.keyEncoding(r&&r.keyEncoding),a=s.format;return r={...r,keyEncoding:a},i!==this.db&&(r.sublevel=null),this._del(i.prefixKey(s.encode(e),a),r),this[Zt].push({...o,type:"del",key:e}),this}_del(e,r){}clear(){if(this[se]!=="open")throw new kn("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[Zt]=[],this}_clear(){}write(e,r){return r=sp(e,r),r=Eu(r,Rn),e=ap(e),this[se]!=="open"?this.nextTick(r,new kn("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(r):(this[se]="writing",this._write(e,n=>{this[se]="closing",this[Qt].push(()=>r(n)),n||this.db.emit("batch",this[Zt]),this._close(this[Pr])})),r[Rn]}_write(e,r){}close(e){return e=Eu(e,Rn),this[se]==="closing"?this[Qt].push(e):this[se]==="closed"?this.nextTick(e):(this[Qt].push(e),this[se]!=="writing"&&(this[se]="closing",this._close(this[Pr]))),e[Rn]}_close(e){this.nextTick(e)}[Pr](){this[se]="closed",this.db.detachResource(this);let e=this[Qt];this[Qt]=[];for(let r of e)r()}};_u.AbstractChainedBatch=xo});var Su=m(vu=>{"use strict";var SE=c(f()),{AbstractChainedBatch:up}=Eo(),cp=fe(),er=Symbol("encoded"),_o=class extends up{constructor(e){super(e),this[er]=[]}_put(e,r,n){this[er].push({...n,type:"put",key:e,value:r})}_del(e,r){this[er].push({...r,type:"del",key:e})}_clear(){this[er]=[]}_write(e,r){this.db.status==="opening"?this.db.defer(()=>this._write(e,r)):this.db.status==="open"?this[er].length===0?this.nextTick(r):this.db._batch(this[er],e,r):this.nextTick(r,new cp("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};vu.DefaultChainedBatch=_o});var Bu=m((AE,Tu)=>{"use strict";var TE=c(f()),Au=fe(),fp=Object.prototype.hasOwnProperty,lp=new Set(["lt","lte","gt","gte"]);Tu.exports=function(t,e){let r={};for(let n in t)if(fp.call(t,n)&&!(n==="keyEncoding"||n==="valueEncoding")){if(n==="start"||n==="end")throw new Au(`The legacy range option '${n}' has been removed`,{code:"LEVEL_LEGACY"});if(n==="encoding")throw new Au("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});lp.has(n)?r[n]=e.encode(t[n]):r[n]=t[n]}return r.reverse=!!r.reverse,r.limit=Number.isInteger(r.limit)&&r.limit>=0?r.limit:-1,r}});var vo=m((BE,ku)=>{var IE=c(f());var Iu;ku.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:globalThis):t=>(Iu||(Iu=Promise.resolve())).then(t).catch(e=>setTimeout(()=>{throw e},0))});var Lu=m((kE,Ou)=>{"use strict";var RE=c(f()),Ru=vo();Ou.exports=function(t,...e){e.length===0?Ru(t):Ru(()=>t(...e))}});var Cu=m(On=>{"use strict";var LE=c(f()),{AbstractIterator:dp,AbstractKeyIterator:hp,AbstractValueIterator:pp}=Qe(),tr=Symbol("unfix"),le=Symbol("iterator"),xt=Symbol("handleOne"),et=Symbol("handleMany"),De=Symbol("callback"),Ur=class extends dp{constructor(e,r,n,i){super(e,r),this[le]=n,this[tr]=i,this[xt]=this[xt].bind(this),this[et]=this[et].bind(this),this[De]=null}[xt](e,r,n){let i=this[De];if(e)return i(e);r!==void 0&&(r=this[tr](r)),i(e,r,n)}[et](e,r){let n=this[De];if(e)return n(e);for(let i of r){let o=i[0];o!==void 0&&(i[0]=this[tr](o))}n(e,r)}},Mr=class extends hp{constructor(e,r,n,i){super(e,r),this[le]=n,this[tr]=i,this[xt]=this[xt].bind(this),this[et]=this[et].bind(this),this[De]=null}[xt](e,r){let n=this[De];if(e)return n(e);r!==void 0&&(r=this[tr](r)),n(e,r)}[et](e,r){let n=this[De];if(e)return n(e);for(let i=0;i<r.length;i++){let o=r[i];o!==void 0&&(r[i]=this[tr](o))}n(e,r)}},Nr=class extends pp{constructor(e,r,n){super(e,r),this[le]=n}};for(let t of[Ur,Mr])t.prototype._next=function(e){this[De]=e,this[le].next(this[xt])},t.prototype._nextv=function(e,r,n){this[De]=n,this[le].nextv(e,r,this[et])},t.prototype._all=function(e,r){this[De]=r,this[le].all(e,this[et])};for(let t of[Nr])t.prototype._next=function(e){this[le].next(e)},t.prototype._nextv=function(e,r,n){this[le].nextv(e,r,n)},t.prototype._all=function(e,r){this[le].all(e,r)};for(let t of[Ur,Mr,Nr])t.prototype._seek=function(e,r){this[le].seek(e,r)},t.prototype._close=function(e){this[le].close(e)};On.AbstractSublevelIterator=Ur;On.AbstractSublevelKeyIterator=Mr;On.AbstractSublevelValueIterator=Nr});var Mu=m((CE,Uu)=>{"use strict";var DE=c(f()),So=fe(),{Buffer:Bo}=X()||{},{AbstractSublevelIterator:yp,AbstractSublevelKeyIterator:wp,AbstractSublevelValueIterator:gp}=Cu(),Pe=Symbol("prefix"),Du=Symbol("upperBound"),Kr=Symbol("prefixRange"),re=Symbol("parent"),Ao=Symbol("unfix"),Pu=new TextEncoder,bp={separator:"!"};Uu.exports=function({AbstractLevel:t}){class e extends t{static defaults(n){if(typeof n=="string")throw new So("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(n&&n.open)throw new So("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return n==null?bp:n.separator?n:{...n,separator:"!"}}constructor(n,i,o){let{separator:s,manifest:a,...l}=e.defaults(o);i=xp(i,s);let u=s.charCodeAt(0)+1,d=n[re]||n;if(!Pu.encode(i).every(y=>y>u&&y<127))throw new So(`Prefix must use bytes > ${u} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(mp(d,a),l);let h=(n.prefix||"")+s+i+s,g=h.slice(0,-1)+String.fromCharCode(u);this[re]=d,this[Pe]=new Ln(h),this[Du]=new Ln(g),this[Ao]=new Io,this.nextTick=d.nextTick}prefixKey(n,i){if(i==="utf8")return this[Pe].utf8+n;if(n.byteLength===0)return this[Pe][i];if(i==="view"){let o=this[Pe].view,s=new Uint8Array(o.byteLength+n.byteLength);return s.set(o,0),s.set(n,o.byteLength),s}else{let o=this[Pe].buffer;return Bo.concat([o,n],o.byteLength+n.byteLength)}}[Kr](n,i){n.gte!==void 0?n.gte=this.prefixKey(n.gte,i):n.gt!==void 0?n.gt=this.prefixKey(n.gt,i):n.gte=this[Pe][i],n.lte!==void 0?n.lte=this.prefixKey(n.lte,i):n.lt!==void 0?n.lt=this.prefixKey(n.lt,i):n.lte=this[Du][i]}get prefix(){return this[Pe].utf8}get db(){return this[re]}_open(n,i){this[re].open({passive:!0},i)}_put(n,i,o,s){this[re].put(n,i,o,s)}_get(n,i,o){this[re].get(n,i,o)}_getMany(n,i,o){this[re].getMany(n,i,o)}_del(n,i,o){this[re].del(n,i,o)}_batch(n,i,o){this[re].batch(n,i,o)}_clear(n,i){this[Kr](n,n.keyEncoding),this[re].clear(n,i)}_iterator(n){this[Kr](n,n.keyEncoding);let i=this[re].iterator(n),o=this[Ao].get(this[Pe].utf8.length,n.keyEncoding);return new yp(this,n,i,o)}_keys(n){this[Kr](n,n.keyEncoding);let i=this[re].keys(n),o=this[Ao].get(this[Pe].utf8.length,n.keyEncoding);return new wp(this,n,i,o)}_values(n){this[Kr](n,n.keyEncoding);let i=this[re].values(n);return new gp(this,n,i)}}return{AbstractSublevel:e}};var mp=function(t,e){return{...t.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:To(t,"utf8"),buffer:To(t,"buffer"),view:To(t,"view")}}},To=function(t,e){return t.supports.encodings[e]?t.keyEncoding(e).name===e:!1},Ln=class{constructor(e){this.utf8=e,this.view=Pu.encode(e),this.buffer=Bo?Bo.from(this.view.buffer,0,this.view.byteLength):{}}},Io=class{constructor(){this.cache=new Map}get(e,r){let n=this.cache.get(r);return n===void 0&&(r==="view"?n=(function(i,o){return o.subarray(i)}).bind(null,e):n=(function(i,o){return o.slice(i)}).bind(null,e),this.cache.set(r,n)),n}},xp=function(t,e){let r=0,n=t.length;for(;r<n&&t[r]===e;)r++;for(;n>r&&t[n-1]===e;)n--;return t.slice(r,n)}});var Co=m(Lo=>{"use strict";var UE=c(f()),{supports:Ep}=Ga(),{Transcoder:_p}=nu(),{EventEmitter:vp}=Jt(),{fromCallback:tt}=kr(),de=fe(),{AbstractIterator:Et}=Qe(),{DefaultKeyIterator:Sp,DefaultValueIterator:Ap}=mu(),{DeferredIterator:Tp,DeferredKeyIterator:Bp,DeferredValueIterator:Ip}=xu(),{DefaultChainedBatch:Nu}=Su(),{getCallback:_t,getOptions:rt}=gn(),Cn=Bu(),_=Symbol("promise"),Ue=Symbol("landed"),vt=Symbol("resources"),ko=Symbol("closeResources"),Fr=Symbol("operations"),qr=Symbol("undefer"),Dn=Symbol("deferOpen"),Ku=Symbol("options"),A=Symbol("status"),St=Symbol("defaultOptions"),rr=Symbol("transcoder"),Pn=Symbol("keyEncoding"),Ro=Symbol("valueEncoding"),kp=()=>{},jr=class extends vp{constructor(e,r){if(super(),typeof e!="object"||e===null)throw new TypeError("The first argument 'manifest' must be an object");r=rt(r);let{keyEncoding:n,valueEncoding:i,passive:o,...s}=r;this[vt]=new Set,this[Fr]=[],this[Dn]=!0,this[Ku]=s,this[A]="opening",this.supports=Ep(e,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:e.snapshots!==!1,permanence:e.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:e.encodings||{},events:Object.assign({},e.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[rr]=new _p(Rp(this)),this[Pn]=this[rr].encoding(n||"utf8"),this[Ro]=this[rr].encoding(i||"utf8");for(let a of this[rr].encodings())this.supports.encodings[a.commonName]||(this.supports.encodings[a.commonName]=!0);this[St]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[Pn].commonName,valueEncoding:this[Ro].commonName}),key:Object.freeze({keyEncoding:this[Pn].commonName})},this.nextTick(()=>{this[Dn]&&this.open({passive:!1},kp)})}get status(){return this[A]}keyEncoding(e){return this[rr].encoding(e??this[Pn])}valueEncoding(e){return this[rr].encoding(e??this[Ro])}open(e,r){r=_t(e,r),r=tt(r,_),e={...this[Ku],...rt(e)},e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists;let n=i=>{this[A]==="closing"||this[A]==="opening"?this.once(Ue,i?()=>n(i):n):this[A]!=="open"?r(new de("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:i})):r()};return e.passive?this[A]==="opening"?this.once(Ue,n):this.nextTick(n):this[A]==="closed"||this[Dn]?(this[Dn]=!1,this[A]="opening",this.emit("opening"),this._open(e,i=>{if(i){this[A]="closed",this[ko](()=>{this.emit(Ue),n(i)}),this[qr]();return}this[A]="open",this[qr](),this.emit(Ue),this[A]==="open"&&this.emit("open"),this[A]==="open"&&this.emit("ready"),n()})):this[A]==="open"?this.nextTick(n):this.once(Ue,()=>this.open(e,r)),r[_]}_open(e,r){this.nextTick(r)}close(e){e=tt(e,_);let r=n=>{this[A]==="opening"||this[A]==="closing"?this.once(Ue,n?r(n):r):this[A]!=="closed"?e(new de("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:n})):e()};if(this[A]==="open"){this[A]="closing",this.emit("closing");let n=i=>{this[A]="open",this[qr](),this.emit(Ue),r(i)};this[ko](()=>{this._close(i=>{if(i)return n(i);this[A]="closed",this[qr](),this.emit(Ue),this[A]==="closed"&&this.emit("closed"),r()})})}else this[A]==="closed"?this.nextTick(r):this.once(Ue,()=>this.close(e));return e[_]}[ko](e){if(this[vt].size===0)return this.nextTick(e);let r=this[vt].size,n=!0,i=()=>{--r===0&&(n?this.nextTick(e):e())};for(let o of this[vt])o.close(i);n=!1,this[vt].clear()}_close(e){this.nextTick(e)}get(e,r,n){if(n=_t(r,n),n=tt(n,_),r=rt(r,this[St].entry),this[A]==="opening")return this.defer(()=>this.get(e,r,n)),n[_];if(nr(this,n))return n[_];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[_];let o=this.keyEncoding(r.keyEncoding),s=this.valueEncoding(r.valueEncoding),a=o.format,l=s.format;return(r.keyEncoding!==a||r.valueEncoding!==l)&&(r=Object.assign({},r,{keyEncoding:a,valueEncoding:l})),this._get(this.prefixKey(o.encode(e),a),r,(u,d)=>{if(u)return(u.code==="LEVEL_NOT_FOUND"||u.notFound||/NotFound/i.test(u))&&(u.code||(u.code="LEVEL_NOT_FOUND"),u.notFound||(u.notFound=!0),u.status||(u.status=404)),n(u);try{d=s.decode(d)}catch(h){return n(new de("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:h}))}n(null,d)}),n[_]}_get(e,r,n){this.nextTick(n,new Error("NotFound"))}getMany(e,r,n){if(n=_t(r,n),n=tt(n,_),r=rt(r,this[St].entry),this[A]==="opening")return this.defer(()=>this.getMany(e,r,n)),n[_];if(nr(this,n))return n[_];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'keys' must be an array")),n[_];if(e.length===0)return this.nextTick(n,null,[]),n[_];let i=this.keyEncoding(r.keyEncoding),o=this.valueEncoding(r.valueEncoding),s=i.format,a=o.format;(r.keyEncoding!==s||r.valueEncoding!==a)&&(r=Object.assign({},r,{keyEncoding:s,valueEncoding:a}));let l=new Array(e.length);for(let u=0;u<e.length;u++){let d=e[u],h=this._checkKey(d);if(h)return this.nextTick(n,h),n[_];l[u]=this.prefixKey(i.encode(d),s)}return this._getMany(l,r,(u,d)=>{if(u)return n(u);try{for(let h=0;h<d.length;h++)d[h]!==void 0&&(d[h]=o.decode(d[h]))}catch(h){return n(new de(`Could not decode one or more of ${d.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:h}))}n(null,d)}),n[_]}_getMany(e,r,n){this.nextTick(n,null,new Array(e.length).fill(void 0))}put(e,r,n,i){if(i=_t(n,i),i=tt(i,_),n=rt(n,this[St].entry),this[A]==="opening")return this.defer(()=>this.put(e,r,n,i)),i[_];if(nr(this,i))return i[_];let o=this._checkKey(e)||this._checkValue(r);if(o)return this.nextTick(i,o),i[_];let s=this.keyEncoding(n.keyEncoding),a=this.valueEncoding(n.valueEncoding),l=s.format,u=a.format;(n.keyEncoding!==l||n.valueEncoding!==u)&&(n=Object.assign({},n,{keyEncoding:l,valueEncoding:u}));let d=this.prefixKey(s.encode(e),l),h=a.encode(r);return this._put(d,h,n,g=>{if(g)return i(g);this.emit("put",e,r),i()}),i[_]}_put(e,r,n,i){this.nextTick(i)}del(e,r,n){if(n=_t(r,n),n=tt(n,_),r=rt(r,this[St].key),this[A]==="opening")return this.defer(()=>this.del(e,r,n)),n[_];if(nr(this,n))return n[_];let i=this._checkKey(e);if(i)return this.nextTick(n,i),n[_];let o=this.keyEncoding(r.keyEncoding),s=o.format;return r.keyEncoding!==s&&(r=Object.assign({},r,{keyEncoding:s})),this._del(this.prefixKey(o.encode(e),s),r,a=>{if(a)return n(a);this.emit("del",e),n()}),n[_]}_del(e,r,n){this.nextTick(n)}batch(e,r,n){if(!arguments.length){if(this[A]==="opening")return new Nu(this);if(this[A]!=="open")throw new de("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof e=="function"?n=e:n=_t(r,n),n=tt(n,_),r=rt(r,this[St].empty),this[A]==="opening")return this.defer(()=>this.batch(e,r,n)),n[_];if(nr(this,n))return n[_];if(!Array.isArray(e))return this.nextTick(n,new TypeError("The first argument 'operations' must be an array")),n[_];if(e.length===0)return this.nextTick(n),n[_];let i=new Array(e.length),{keyEncoding:o,valueEncoding:s,...a}=r;for(let l=0;l<e.length;l++){if(typeof e[l]!="object"||e[l]===null)return this.nextTick(n,new TypeError("A batch operation must be an object")),n[_];let u=Object.assign({},e[l]);if(u.type!=="put"&&u.type!=="del")return this.nextTick(n,new TypeError("A batch operation must have a type property that is 'put' or 'del'")),n[_];let d=this._checkKey(u.key);if(d)return this.nextTick(n,d),n[_];let h=u.sublevel!=null?u.sublevel:this,g=h.keyEncoding(u.keyEncoding||o),y=g.format;if(u.key=h.prefixKey(g.encode(u.key),y),u.keyEncoding=y,u.type==="put"){let b=this._checkValue(u.value);if(b)return this.nextTick(n,b),n[_];let w=h.valueEncoding(u.valueEncoding||s);u.value=w.encode(u.value),u.valueEncoding=w.format}h!==this&&(u.sublevel=null),i[l]=u}return this._batch(i,a,l=>{if(l)return n(l);this.emit("batch",e),n()}),n[_]}_batch(e,r,n){this.nextTick(n)}sublevel(e,r){return this._sublevel(e,Oo.defaults(r))}_sublevel(e,r){return new Oo(this,e,r)}prefixKey(e,r){return e}clear(e,r){if(r=_t(e,r),r=tt(r,_),e=rt(e,this[St].empty),this[A]==="opening")return this.defer(()=>this.clear(e,r)),r[_];if(nr(this,r))return r[_];let n=e,i=this.keyEncoding(e.keyEncoding);return e=Cn(e,i),e.keyEncoding=i.format,e.limit===0?this.nextTick(r):this._clear(e,o=>{if(o)return r(o);this.emit("clear",n),r()}),r[_]}_clear(e,r){this.nextTick(r)}iterator(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=Cn(e,r),e.keys=e.keys!==!1,e.values=e.values!==!1,e[Et.keyEncoding]=r,e[Et.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[A]==="opening")return new Tp(this,e);if(this[A]!=="open")throw new de("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(e)}_iterator(e){return new Et(this,e)}keys(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=Cn(e,r),e[Et.keyEncoding]=r,e[Et.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[A]==="opening")return new Bp(this,e);if(this[A]!=="open")throw new de("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(e)}_keys(e){return new Sp(this,e)}values(e){let r=this.keyEncoding(e&&e.keyEncoding),n=this.valueEncoding(e&&e.valueEncoding);if(e=Cn(e,r),e[Et.keyEncoding]=r,e[Et.valueEncoding]=n,e.keyEncoding=r.format,e.valueEncoding=n.format,this[A]==="opening")return new Ip(this,e);if(this[A]!=="open")throw new de("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(e)}_values(e){return new Ap(this,e)}defer(e){if(typeof e!="function")throw new TypeError("The first argument must be a function");this[Fr].push(e)}[qr](){if(this[Fr].length===0)return;let e=this[Fr];this[Fr]=[];for(let r of e)r()}attachResource(e){if(typeof e!="object"||e===null||typeof e.close!="function")throw new TypeError("The first argument must be a resource object");this[vt].add(e)}detachResource(e){this[vt].delete(e)}_chainedBatch(){return new Nu(this)}_checkKey(e){if(e==null)return new de("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(e){if(e==null)return new de("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};jr.prototype.nextTick=Lu();var{AbstractSublevel:Oo}=Mu()({AbstractLevel:jr});Lo.AbstractLevel=jr;Lo.AbstractSublevel=Oo;var nr=function(t,e){return t[A]!=="open"?(t.nextTick(e,new de("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},Rp=function(t){return Object.keys(t.supports.encodings).filter(e=>!!t.supports.encodings[e])}});var Do=m(At=>{"use strict";var NE=c(f());At.AbstractLevel=Co().AbstractLevel;At.AbstractSublevel=Co().AbstractSublevel;At.AbstractIterator=Qe().AbstractIterator;At.AbstractKeyIterator=Qe().AbstractKeyIterator;At.AbstractValueIterator=Qe().AbstractValueIterator;At.AbstractChainedBatch=Eo().AbstractChainedBatch});var qu=m((KE,Fu)=>{var FE=c(f());Fu.exports=Lp;var Op=vo();function Lp(t,e,r){if(typeof e!="number")throw new Error("second argument must be a Number");let n,i,o,s,a,l=!0,u;Array.isArray(t)?(n=[],o=i=t.length):(s=Object.keys(t),n={},o=i=s.length);function d(g){function y(){r&&r(g,n),r=null}l?Op(y):y()}function h(g,y,b){if(n[g]=b,y&&(a=!0),--o===0||y)d(y);else if(!a&&u<i){let w;s?(w=s[u],u+=1,t[w](function(S,x){h(w,S,x)})):(w=u,u+=1,t[w](function(S,x){h(w,S,x)}))}}u=e,o?s?s.some(function(g,y){return t[g](function(b,w){h(g,b,w)}),y===e-1}):t.some(function(g,y){return g(function(b,w){h(y,b,w)}),y===e-1}):d(null),l=!1}});var Po=m((qE,ju)=>{"use strict";var jE=c(f());ju.exports=function(e){let r=e.gte!==void 0?e.gte:e.gt!==void 0?e.gt:void 0,n=e.lte!==void 0?e.lte:e.lt!==void 0?e.lt:void 0,i=e.gte===void 0,o=e.lte===void 0;return r!==void 0&&n!==void 0?IDBKeyRange.bound(r,n,i,o):r!==void 0?IDBKeyRange.lowerBound(r,i):n!==void 0?IDBKeyRange.upperBound(n,o):null}});var Uo=m(($E,$u)=>{"use strict";var VE=c(f()),Cp=new TextEncoder;$u.exports=function(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):Cp.encode(t)}});var Ju=m(Gu=>{"use strict";var HE=c(f()),{AbstractIterator:Dp}=Do(),Vu=Po(),Un=Uo(),Ee=Symbol("cache"),Me=Symbol("finished"),ne=Symbol("options"),Ne=Symbol("currentOptions"),Tt=Symbol("position"),Mo=Symbol("location"),ir=Symbol("first"),Wu={},No=class extends Dp{constructor(e,r,n){super(e,n),this[Ee]=[],this[Me]=this.limit===0,this[ne]=n,this[Ne]={...n},this[Tt]=void 0,this[Mo]=r,this[ir]=!0}_nextv(e,r,n){if(this[ir]=!1,this[Me])return this.nextTick(n,null,[]);if(this[Ee].length>0)return e=Math.min(e,this[Ee].length),this.nextTick(n,null,this[Ee].splice(0,e));this[Tt]!==void 0&&(this[ne].reverse?(this[Ne].lt=this[Tt],this[Ne].lte=void 0):(this[Ne].gt=this[Tt],this[Ne].gte=void 0));let i;try{i=Vu(this[Ne])}catch{return this[Me]=!0,this.nextTick(n,null,[])}let o=this.db.db.transaction([this[Mo]],"readonly"),s=o.objectStore(this[Mo]),a=[];if(this[ne].reverse){let l=!this[ne].values&&s.openKeyCursor?"openKeyCursor":"openCursor";s[l](i,"prev").onsuccess=u=>{let d=u.target.result;if(d){let{key:h,value:g}=d;this[Tt]=h,a.push([this[ne].keys&&h!==void 0?Un(h):void 0,this[ne].values&&g!==void 0?Un(g):void 0]),a.length<e?d.continue():Hu(o)}else this[Me]=!0}}else{let l,u,d=()=>{if(l===void 0||u===void 0)return;let h=Math.max(l.length,u.length);h===0||e===1/0?this[Me]=!0:this[Tt]=l[h-1],a.length=h;for(let g=0;g<h;g++){let y=l[g],b=u[g];a[g]=[this[ne].keys&&y!==void 0?Un(y):void 0,this[ne].values&&b!==void 0?Un(b):void 0]}Hu(o)};this[ne].keys||e<1/0?s.getAllKeys(i,e<1/0?e:void 0).onsuccess=h=>{l=h.target.result,d()}:(l=[],this.nextTick(d)),this[ne].values?s.getAll(i,e<1/0?e:void 0).onsuccess=h=>{u=h.target.result,d()}:(u=[],this.nextTick(d))}o.onabort=()=>{n(o.error||new Error("aborted by user")),n=null},o.oncomplete=()=>{n(null,a),n=null}}_next(e){if(this[Ee].length>0){let[r,n]=this[Ee].shift();this.nextTick(e,null,r,n)}else if(this[Me])this.nextTick(e);else{let r=Math.min(100,this.limit-this.count);this[ir]&&(this[ir]=!1,r=1),this._nextv(r,Wu,(n,i)=>{if(n)return e(n);this[Ee]=i,this._next(e)})}}_all(e,r){this[ir]=!1;let n=this[Ee].splice(0,this[Ee].length),i=this.limit-this.count-n.length;if(i<=0)return this.nextTick(r,null,n);this._nextv(i,Wu,(o,s)=>{if(o)return r(o);n.length>0&&(s=n.concat(s)),r(null,s)})}_seek(e,r){this[ir]=!0,this[Ee]=[],this[Me]=!1,this[Tt]=void 0,this[Ne]={...this[ne]};let n;try{n=Vu(this[ne])}catch{this[Me]=!0;return}n!==null&&!n.includes(e)?this[Me]=!0:this[ne].reverse?this[Ne].lte=e:this[Ne].gte=e}};Gu.Iterator=No;function Hu(t){typeof t.commit=="function"&&t.commit()}});var Yu=m((GE,zu)=>{"use strict";var JE=c(f());zu.exports=function(e,r,n,i,o){if(i.limit===0)return e.nextTick(o);let s=e.db.transaction([r],"readwrite"),a=s.objectStore(r),l=0;s.oncomplete=function(){o()},s.onabort=function(){o(s.error||new Error("aborted by user"))};let u=a.openKeyCursor?"openKeyCursor":"openCursor",d=i.reverse?"prev":"next";a[u](n,d).onsuccess=function(h){let g=h.target.result;g&&(a.delete(g.key).onsuccess=function(){(i.limit<=0||++l<i.limit)&&g.continue()})}}});var rc=m(tc=>{"use strict";var YE=c(f()),{AbstractLevel:Pp}=Do(),Xu=fe(),Up=qu(),{fromCallback:Mp}=kr(),{Iterator:Np}=Ju(),Zu=Uo(),Kp=Yu(),Fp=Po(),ec="level-js-",$r=Symbol("idb"),Ko=Symbol("namePrefix"),Ke=Symbol("location"),Fo=Symbol("version"),Bt=Symbol("store"),Vr=Symbol("onComplete"),Qu=Symbol("promise"),Mn=class extends Pp{constructor(e,r,n){if(typeof r=="function"||typeof n=="function")throw new Xu("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:i,version:o,...s}=r||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),typeof e!="string")throw new Error("constructor requires a location string argument");this[Ke]=e,this[Ko]=i??ec,this[Fo]=parseInt(o||1,10),this[$r]=null}get location(){return this[Ke]}get namePrefix(){return this[Ko]}get version(){return this[Fo]}get db(){return this[$r]}get type(){return"browser-level"}_open(e,r){let n=indexedDB.open(this[Ko]+this[Ke],this[Fo]);n.onerror=function(){r(n.error||new Error("unknown error"))},n.onsuccess=()=>{this[$r]=n.result,r()},n.onupgradeneeded=i=>{let o=i.target.result;o.objectStoreNames.contains(this[Ke])||o.createObjectStore(this[Ke])}}[Bt](e){return this[$r].transaction([this[Ke]],e).objectStore(this[Ke])}[Vr](e,r){let n=e.transaction;n.onabort=function(){r(n.error||new Error("aborted by user"))},n.oncomplete=function(){r(null,e.result)}}_get(e,r,n){let i=this[Bt]("readonly"),o;try{o=i.get(e)}catch(s){return this.nextTick(n,s)}this[Vr](o,function(s,a){if(s)return n(s);if(a===void 0)return n(new Xu("Entry not found",{code:"LEVEL_NOT_FOUND"}));n(null,Zu(a))})}_getMany(e,r,n){let i=this[Bt]("readonly"),o=e.map(s=>a=>{let l;try{l=i.get(s)}catch(u){return a(u)}l.onsuccess=()=>{let u=l.result;a(null,u===void 0?u:Zu(u))},l.onerror=u=>{u.stopPropagation(),a(l.error)}});Up(o,16,n)}_del(e,r,n){let i=this[Bt]("readwrite"),o;try{o=i.delete(e)}catch(s){return this.nextTick(n,s)}this[Vr](o,n)}_put(e,r,n,i){let o=this[Bt]("readwrite"),s;try{s=o.put(r,e)}catch(a){return this.nextTick(i,a)}this[Vr](s,i)}_iterator(e){return new Np(this,this[Ke],e)}_batch(e,r,n){let i=this[Bt]("readwrite"),o=i.transaction,s=0,a;o.onabort=function(){n(a||o.error||new Error("aborted by user"))},o.oncomplete=function(){n()};function l(){let u=e[s++],d=u.key,h;try{h=u.type==="del"?i.delete(d):i.put(u.value,d)}catch(g){a=g,o.abort();return}s<e.length?h.onsuccess=l:typeof o.commit=="function"&&o.commit()}l()}_clear(e,r){let n,i;try{n=Fp(e)}catch{return this.nextTick(r)}if(e.limit>=0)return Kp(this,this[Ke],n,e,r);try{let o=this[Bt]("readwrite");i=n?o.delete(n):o.clear()}catch(o){return this.nextTick(r,o)}this[Vr](i,r)}_close(e){this[$r].close(),this.nextTick(e)}};Mn.destroy=function(t,e,r){typeof e=="function"&&(r=e,e=ec),r=Mp(r,Qu);let n=indexedDB.deleteDatabase(e+t);return n.onsuccess=function(){r()},n.onerror=function(i){r(i)},r[Qu]};tc.BrowserLevel=Mn});var ic=m(nc=>{var ZE=c(f());nc.Level=rc().BrowserLevel});var C=m((i_,oc)=>{"use strict";var o_=c(f());oc.exports={ArrayIsArray(t){return Array.isArray(t)},ArrayPrototypeIncludes(t,e){return t.includes(e)},ArrayPrototypeIndexOf(t,e){return t.indexOf(e)},ArrayPrototypeJoin(t,e){return t.join(e)},ArrayPrototypeMap(t,e){return t.map(e)},ArrayPrototypePop(t,e){return t.pop(e)},ArrayPrototypePush(t,e){return t.push(e)},ArrayPrototypeSlice(t,e,r){return t.slice(e,r)},Error,FunctionPrototypeCall(t,e,...r){return t.call(e,...r)},FunctionPrototypeSymbolHasInstance(t,e){return Function.prototype[Symbol.hasInstance].call(t,e)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(t,e){return Object.defineProperties(t,e)},ObjectDefineProperty(t,e,r){return Object.defineProperty(t,e,r)},ObjectGetOwnPropertyDescriptor(t,e){return Object.getOwnPropertyDescriptor(t,e)},ObjectKeys(t){return Object.keys(t)},ObjectSetPrototypeOf(t,e){return Object.setPrototypeOf(t,e)},Promise,PromisePrototypeCatch(t,e){return t.catch(e)},PromisePrototypeThen(t,e,r){return t.then(e,r)},PromiseReject(t){return Promise.reject(t)},PromiseResolve(t){return Promise.resolve(t)},ReflectApply:Reflect.apply,RegExpPrototypeTest(t,e){return t.test(e)},SafeSet:Set,String,StringPrototypeSlice(t,e,r){return t.slice(e,r)},StringPrototypeToLowerCase(t){return t.toLowerCase()},StringPrototypeToUpperCase(t){return t.toUpperCase()},StringPrototypeTrim(t){return t.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(t,e,r){return t.set(e,r)},Boolean,Uint8Array}});var or=m((s_,Nn)=>{"use strict";var a_=c(f()),{AbortController:sc,AbortSignal:jp}=typeof self<"u"?self:typeof window<"u"?window:void 0;Nn.exports=sc;Nn.exports.AbortSignal=jp;Nn.exports.default=sc});var H=m((u_,jo)=>{"use strict";var c_=c(f()),$p=X(),{kResistStopPropagation:Vp,SymbolDispose:Wp}=C(),Hp=globalThis.AbortSignal||or().AbortSignal,Gp=globalThis.AbortController||or().AbortController,Jp=Object.getPrototypeOf(async function(){}).constructor,ac=globalThis.Blob||$p.Blob,zp=typeof ac<"u"?function(e){return e instanceof ac}:function(e){return!1},uc=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ERR_INVALID_ARG_TYPE(e,"AbortSignal",t)},Yp=(t,e)=>{if(typeof t!="function")throw new ERR_INVALID_ARG_TYPE(e,"Function",t)},qo=class extends Error{constructor(e){if(!Array.isArray(e))throw new TypeError(`Expected input to be an Array, got ${typeof e}`);let r="";for(let n=0;n<e.length;n++)r+=` ${e[n].stack}
2
- `;super(r),this.name="AggregateError",this.errors=e}};jo.exports={AggregateError:qo,kEmptyObject:Object.freeze({}),once(t){let e=!1;return function(...r){e||(e=!0,t.apply(this,r))}},createDeferredPromise:function(){let t,e;return{promise:new Promise((n,i)=>{t=n,e=i}),resolve:t,reject:e}},promisify(t){return new Promise((e,r)=>{t((n,...i)=>n?r(n):e(...i))})},debuglog(){return function(){}},format(t,...e){return t.replace(/%([sdifj])/g,function(...[r,n]){let i=e.shift();return n==="f"?i.toFixed(6):n==="j"?JSON.stringify(i):n==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(t){switch(typeof t){case"string":if(t.includes("'"))if(t.includes('"')){if(!t.includes("`")&&!t.includes("${"))return`\`${t}\``}else return`"${t}"`;return`'${t}'`;case"number":return isNaN(t)?"NaN":Object.is(t,-0)?String(t):t;case"bigint":return`${String(t)}n`;case"boolean":case"undefined":return String(t);case"object":return"{}"}},types:{isAsyncFunction(t){return t instanceof Jp},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:zp,deprecate(t,e){return t},addAbortListener:Jt().addAbortListener||function(e,r){if(e===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",e);uc(e,"signal"),Yp(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Vp]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Wp](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:Hp.any||function(e){if(e.length===1)return e[0];let r=new Gp,n=()=>r.abort();return e.forEach(i=>{uc(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};jo.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var z=m((f_,lc)=>{"use strict";var l_=c(f()),{format:Xp,inspect:Kn,AggregateError:Zp}=H(),Qp=globalThis.AggregateError||Zp,ey=Symbol("kIsNodeError"),ty=["string","function","number","object","Function","Object","boolean","bigint","symbol"],ry=/^([A-Z][a-z0-9]*)+$/,ny="__node_internal_",Fn={};function It(t,e){if(!t)throw new Fn.ERR_INTERNAL_ASSERTION(e)}function cc(t){let e="",r=t.length,n=t[0]==="-"?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function iy(t,e,r){if(typeof e=="function")return It(e.length<=r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${e.length}).`),e(...r);let n=(e.match(/%[dfijoOs]/g)||[]).length;return It(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Xp(e,...r)}function j(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(iy(t,e,o))}toString(){return`${this.name} [${t}]: ${this.message}`}}Object.defineProperties(n.prototype,{name:{value:r.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${t}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),n.prototype.code=t,n.prototype[ey]=!0,Fn[t]=n}function fc(t){let e=ny+t.name;return Object.defineProperty(t,"name",{value:e}),t}function oy(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Qp([e,t],e.message);return r.code=e.code,r}return t||e}var $o=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Fn.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};j("ERR_ASSERTION","%s",Error);j("ERR_INVALID_ARG_TYPE",(t,e,r)=>{It(typeof t=="string","'name' must be a string"),Array.isArray(e)||(e=[e]);let n="The ";t.endsWith(" argument")?n+=`${t} `:n+=`"${t}" ${t.includes(".")?"property":"argument"} `,n+="must be ";let i=[],o=[],s=[];for(let l of e)It(typeof l=="string","All expected entries have to be of type string"),ty.includes(l)?i.push(l.toLowerCase()):ry.test(l)?o.push(l):(It(l!=="object",'The value "object" should be written as "Object"'),s.push(l));if(o.length>0){let l=i.indexOf("object");l!==-1&&(i.splice(i,l,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:n+=`of type ${i[0]}`;break;case 2:n+=`one of type ${i[0]} or ${i[1]}`;break;default:{let l=i.pop();n+=`one of type ${i.join(", ")}, or ${l}`}}(o.length>0||s.length>0)&&(n+=" or ")}if(o.length>0){switch(o.length){case 1:n+=`an instance of ${o[0]}`;break;case 2:n+=`an instance of ${o[0]} or ${o[1]}`;break;default:{let l=o.pop();n+=`an instance of ${o.join(", ")}, or ${l}`}}s.length>0&&(n+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(n+="an "),n+=`${s[0]}`;break;case 2:n+=`one of ${s[0]} or ${s[1]}`;break;default:{let l=s.pop();n+=`one of ${s.join(", ")}, or ${l}`}}if(r==null)n+=`. Received ${r}`;else if(typeof r=="function"&&r.name)n+=`. Received function ${r.name}`;else if(typeof r=="object"){var a;if((a=r.constructor)!==null&&a!==void 0&&a.name)n+=`. Received an instance of ${r.constructor.name}`;else{let l=Kn(r,{depth:-1});n+=`. Received ${l}`}}else{let l=Kn(r,{colors:!1});l.length>25&&(l=`${l.slice(0,25)}...`),n+=`. Received type ${typeof r} (${l})`}return n},TypeError);j("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=Kn(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);j("ERR_INVALID_RETURN_VALUE",(t,e,r)=>{var n;let i=r!=null&&(n=r.constructor)!==null&&n!==void 0&&n.name?`instance of ${r.constructor.name}`:`type ${typeof r}`;return`Expected ${t} to be returned from the "${e}" function but got ${i}.`},TypeError);j("ERR_MISSING_ARGS",(...t)=>{It(t.length>0,"At least one arg needs to be specified");let e,r=t.length;switch(t=(Array.isArray(t)?t:[t]).map(n=>`"${n}"`).join(" or "),r){case 1:e+=`The ${t[0]} argument`;break;case 2:e+=`The ${t[0]} and ${t[1]} arguments`;break;default:{let n=t.pop();e+=`The ${t.join(", ")}, and ${n} arguments`}break}return`${e} must be specified`},TypeError);j("ERR_OUT_OF_RANGE",(t,e,r)=>{It(e,'Missing "range" argument');let n;return Number.isInteger(r)&&Math.abs(r)>2**32?n=cc(String(r)):typeof r=="bigint"?(n=String(r),(r>2n**32n||r<-(2n**32n))&&(n=cc(n)),n+="n"):n=Kn(r),`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);j("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);j("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);j("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);j("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);j("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);j("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);j("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);j("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);j("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);j("ERR_STREAM_WRITE_AFTER_END","write after end",Error);j("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);lc.exports={AbortError:$o,aggregateTwoErrors:fc(oy),hideStackFrames:fc,codes:Fn}});var ar=m((d_,Ec)=>{"use strict";var h_=c(f()),{ArrayIsArray:Wo,ArrayPrototypeIncludes:yc,ArrayPrototypeJoin:wc,ArrayPrototypeMap:sy,NumberIsInteger:Ho,NumberIsNaN:ay,NumberMAX_SAFE_INTEGER:uy,NumberMIN_SAFE_INTEGER:cy,NumberParseInt:fy,ObjectPrototypeHasOwnProperty:ly,RegExpPrototypeExec:gc,String:dy,StringPrototypeToUpperCase:hy,StringPrototypeTrim:py}=C(),{hideStackFrames:ae,codes:{ERR_SOCKET_BAD_PORT:yy,ERR_INVALID_ARG_TYPE:G,ERR_INVALID_ARG_VALUE:sr,ERR_OUT_OF_RANGE:kt,ERR_UNKNOWN_SIGNAL:dc}}=z(),{normalizeEncoding:wy}=H(),{isAsyncFunction:gy,isArrayBufferView:by}=H().types,hc={};function my(t){return t===(t|0)}function xy(t){return t===t>>>0}var Ey=/^[0-7]+$/,_y="must be a 32-bit unsigned integer or an octal string";function vy(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(gc(Ey,t)===null)throw new sr(e,t,_y);t=fy(t,8)}return bc(t,e),t}var Sy=ae((t,e,r=cy,n=uy)=>{if(typeof t!="number")throw new G(e,"number",t);if(!Ho(t))throw new kt(e,"an integer",t);if(t<r||t>n)throw new kt(e,`>= ${r} && <= ${n}`,t)}),Ay=ae((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new G(e,"number",t);if(!Ho(t))throw new kt(e,"an integer",t);if(t<r||t>n)throw new kt(e,`>= ${r} && <= ${n}`,t)}),bc=ae((t,e,r=!1)=>{if(typeof t!="number")throw new G(e,"number",t);if(!Ho(t))throw new kt(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new kt(e,`>= ${n} && <= ${i}`,t)});function Go(t,e){if(typeof t!="string")throw new G(e,"string",t)}function Ty(t,e,r=void 0,n){if(typeof t!="number")throw new G(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&ay(t))throw new kt(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var By=ae((t,e,r)=>{if(!yc(r,t)){let i="must be one of: "+wc(sy(r,o=>typeof o=="string"?`'${o}'`:dy(o)),", ");throw new sr(e,t,i)}});function mc(t,e){if(typeof t!="boolean")throw new G(e,"boolean",t)}function Vo(t,e,r){return t==null||!ly(t,e)?r:t[e]}var Iy=ae((t,e,r=null)=>{let n=Vo(r,"allowArray",!1),i=Vo(r,"allowFunction",!1);if(!Vo(r,"nullable",!1)&&t===null||!n&&Wo(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new G(e,"Object",t)}),ky=ae((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new G(e,"a dictionary",t)}),qn=ae((t,e,r=0)=>{if(!Wo(t))throw new G(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new sr(e,t,n)}});function Ry(t,e){qn(t,e);for(let r=0;r<t.length;r++)Go(t[r],`${e}[${r}]`)}function Oy(t,e){qn(t,e);for(let r=0;r<t.length;r++)mc(t[r],`${e}[${r}]`)}function Ly(t,e){qn(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new G(i,"AbortSignal",n);xc(n,i)}}function Cy(t,e="signal"){if(Go(t,e),hc[t]===void 0)throw hc[hy(t)]!==void 0?new dc(t+" (signals must use all capital letters)"):new dc(t)}var Dy=ae((t,e="buffer")=>{if(!by(t))throw new G(e,["Buffer","TypedArray","DataView"],t)});function Py(t,e){let r=wy(e),n=t.length;if(r==="hex"&&n%2!==0)throw new sr("encoding",e,`is invalid for data of length ${n}`)}function Uy(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&py(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new yy(e,t,r);return t|0}var xc=ae((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new G(e,"AbortSignal",t)}),My=ae((t,e)=>{if(typeof t!="function")throw new G(e,"Function",t)}),Ny=ae((t,e)=>{if(typeof t!="function"||gy(t))throw new G(e,"Function",t)}),Ky=ae((t,e)=>{if(t!==void 0)throw new G(e,"undefined",t)});function Fy(t,e,r){if(!yc(r,t))throw new G(e,`('${wc(r,"|")}')`,t)}var qy=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function pc(t,e){if(typeof t>"u"||!gc(qy,t))throw new sr(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function jy(t){if(typeof t=="string")return pc(t,"hints"),t;if(Wo(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];pc(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new sr("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Ec.exports={isInt32:my,isUint32:xy,parseFileMode:vy,validateArray:qn,validateStringArray:Ry,validateBooleanArray:Oy,validateAbortSignalArray:Ly,validateBoolean:mc,validateBuffer:Dy,validateDictionary:ky,validateEncoding:Py,validateFunction:My,validateInt32:Ay,validateInteger:Sy,validateNumber:Ty,validateObject:Iy,validateOneOf:By,validatePlainFunction:Ny,validatePort:Uy,validateSignalName:Cy,validateString:Go,validateUint32:bc,validateUndefined:Ky,validateUnion:Fy,validateAbortSignal:xc,validateLinkHeaderValue:jy}});var nt=m((p_,Ac)=>{var y_=c(f()),U=Ac.exports={},_e,ve;function Jo(){throw new Error("setTimeout has not been defined")}function zo(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?_e=setTimeout:_e=Jo}catch{_e=Jo}try{typeof clearTimeout=="function"?ve=clearTimeout:ve=zo}catch{ve=zo}})();function _c(t){if(_e===setTimeout)return setTimeout(t,0);if((_e===Jo||!_e)&&setTimeout)return _e=setTimeout,setTimeout(t,0);try{return _e(t,0)}catch{try{return _e.call(null,t,0)}catch{return _e.call(this,t,0)}}}function $y(t){if(ve===clearTimeout)return clearTimeout(t);if((ve===zo||!ve)&&clearTimeout)return ve=clearTimeout,clearTimeout(t);try{return ve(t)}catch{try{return ve.call(null,t)}catch{return ve.call(this,t)}}}var Fe=[],ur=!1,Rt,jn=-1;function Vy(){!ur||!Rt||(ur=!1,Rt.length?Fe=Rt.concat(Fe):jn=-1,Fe.length&&vc())}function vc(){if(!ur){var t=_c(Vy);ur=!0;for(var e=Fe.length;e;){for(Rt=Fe,Fe=[];++jn<e;)Rt&&Rt[jn].run();jn=-1,e=Fe.length}Rt=null,ur=!1,$y(t)}}U.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];Fe.push(new Sc(t,e)),Fe.length===1&&!ur&&_c(vc)};function Sc(t,e){this.fun=t,this.array=e}Sc.prototype.run=function(){this.fun.apply(null,this.array)};U.title="browser";U.browser=!0;U.env={};U.argv=[];U.version="";U.versions={};function qe(){}U.on=qe;U.addListener=qe;U.once=qe;U.off=qe;U.removeListener=qe;U.removeAllListeners=qe;U.emit=qe;U.prependListener=qe;U.prependOnceListener=qe;U.listeners=function(t){return[]};U.binding=function(t){throw new Error("process.binding is not supported")};U.cwd=function(){return"/"};U.chdir=function(t){throw new Error("process.chdir is not supported")};U.umask=function(){return 0}});var Ae=m((w_,Fc)=>{"use strict";var g_=c(f()),{SymbolAsyncIterator:Tc,SymbolIterator:Bc,SymbolFor:Ot}=C(),Ic=Ot("nodejs.stream.destroyed"),kc=Ot("nodejs.stream.errored"),Yo=Ot("nodejs.stream.readable"),Xo=Ot("nodejs.stream.writable"),Rc=Ot("nodejs.stream.disturbed"),Wy=Ot("nodejs.webstream.isClosedPromise"),Hy=Ot("nodejs.webstream.controllerErrorFunction");function $n(t,e=!1){var r;return!!(t&&typeof t.pipe=="function"&&typeof t.on=="function"&&(!e||typeof t.pause=="function"&&typeof t.resume=="function")&&(!t._writableState||((r=t._readableState)===null||r===void 0?void 0:r.readable)!==!1)&&(!t._writableState||t._readableState))}function Vn(t){var e;return!!(t&&typeof t.write=="function"&&typeof t.on=="function"&&(!t._readableState||((e=t._writableState)===null||e===void 0?void 0:e.writable)!==!1))}function Gy(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function Se(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Oc(t){return!!(t&&!Se(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Lc(t){return!!(t&&!Se(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Cc(t){return!!(t&&!Se(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Jy(t){return Oc(t)||Lc(t)||Cc(t)}function zy(t,e){return t==null?!1:e===!0?typeof t[Tc]=="function":e===!1?typeof t[Bc]=="function":typeof t[Tc]=="function"||typeof t[Bc]=="function"}function Wn(t){if(!Se(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Ic]||n!=null&&n.destroyed)}function Dc(t){if(!Vn(t))return null;if(t.writableEnded===!0)return!0;let e=t._writableState;return e!=null&&e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Yy(t,e){if(!Vn(t))return null;if(t.writableFinished===!0)return!0;let r=t._writableState;return r!=null&&r.errored?!1:typeof r?.finished!="boolean"?null:!!(r.finished||e===!1&&r.ended===!0&&r.length===0)}function Xy(t){if(!$n(t))return null;if(t.readableEnded===!0)return!0;let e=t._readableState;return!e||e.errored?!1:typeof e?.ended!="boolean"?null:e.ended}function Pc(t,e){if(!$n(t))return null;let r=t._readableState;return r!=null&&r.errored?!1:typeof r?.endEmitted!="boolean"?null:!!(r.endEmitted||e===!1&&r.ended===!0&&r.length===0)}function Uc(t){return t&&t[Yo]!=null?t[Yo]:typeof t?.readable!="boolean"?null:Wn(t)?!1:$n(t)&&t.readable&&!Pc(t)}function Mc(t){return t&&t[Xo]!=null?t[Xo]:typeof t?.writable!="boolean"?null:Wn(t)?!1:Vn(t)&&t.writable&&!Dc(t)}function Zy(t,e){return Se(t)?Wn(t)?!0:!(e?.readable!==!1&&Uc(t)||e?.writable!==!1&&Mc(t)):null}function Qy(t){var e,r;return Se(t)?t.writableErrored?t.writableErrored:(e=(r=t._writableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function ew(t){var e,r;return Se(t)?t.readableErrored?t.readableErrored:(e=(r=t._readableState)===null||r===void 0?void 0:r.errored)!==null&&e!==void 0?e:null:null}function tw(t){if(!Se(t))return null;if(typeof t.closed=="boolean")return t.closed;let e=t._writableState,r=t._readableState;return typeof e?.closed=="boolean"||typeof r?.closed=="boolean"?e?.closed||r?.closed:typeof t._closed=="boolean"&&Nc(t)?t._closed:null}function Nc(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Kc(t){return typeof t._sent100=="boolean"&&Nc(t)}function rw(t){var e;return typeof t._consuming=="boolean"&&typeof t._dumped=="boolean"&&((e=t.req)===null||e===void 0?void 0:e.upgradeOrConnect)===void 0}function nw(t){if(!Se(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Kc(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function iw(t){var e;return!!(t&&((e=t[Rc])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function ow(t){var e,r,n,i,o,s,a,l,u,d;return!!(t&&((e=(r=(n=(i=(o=(s=t[kc])!==null&&s!==void 0?s:t.readableErrored)!==null&&o!==void 0?o:t.writableErrored)!==null&&i!==void 0?i:(a=t._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&n!==void 0?n:(l=t._writableState)===null||l===void 0?void 0:l.errorEmitted)!==null&&r!==void 0?r:(u=t._readableState)===null||u===void 0?void 0:u.errored)!==null&&e!==void 0?e:!((d=t._writableState)===null||d===void 0)&&d.errored))}Fc.exports={isDestroyed:Wn,kIsDestroyed:Ic,isDisturbed:iw,kIsDisturbed:Rc,isErrored:ow,kIsErrored:kc,isReadable:Uc,kIsReadable:Yo,kIsClosedPromise:Wy,kControllerErrorFunction:Hy,kIsWritable:Xo,isClosed:tw,isDuplexNodeStream:Gy,isFinished:Zy,isIterable:zy,isReadableNodeStream:$n,isReadableStream:Oc,isReadableEnded:Xy,isReadableFinished:Pc,isReadableErrored:ew,isNodeStream:Se,isWebStream:Jy,isWritable:Mc,isWritableNodeStream:Vn,isWritableStream:Lc,isWritableEnded:Dc,isWritableFinished:Yy,isWritableErrored:Qy,isServerRequest:rw,isServerResponse:Kc,willEmitClose:nw,isTransformStream:Cc}});var je=m((b_,rs)=>{var m_=c(f()),it=nt(),{AbortError:zc,codes:sw}=z(),{ERR_INVALID_ARG_TYPE:aw,ERR_STREAM_PREMATURE_CLOSE:qc}=sw,{kEmptyObject:Qo,once:es}=H(),{validateAbortSignal:uw,validateFunction:cw,validateObject:fw,validateBoolean:lw}=ar(),{Promise:dw,PromisePrototypeThen:hw,SymbolDispose:Yc}=C(),{isClosed:pw,isReadable:jc,isReadableNodeStream:Zo,isReadableStream:yw,isReadableFinished:$c,isReadableErrored:Vc,isWritable:Wc,isWritableNodeStream:Hc,isWritableStream:ww,isWritableFinished:Gc,isWritableErrored:Jc,isNodeStream:gw,willEmitClose:bw,kIsClosedPromise:mw}=Ae(),cr;function xw(t){return t.setHeader&&typeof t.abort=="function"}var ts=()=>{};function Xc(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Qo):e==null?e=Qo:fw(e,"options"),cw(r,"callback"),uw(e.signal,"options.signal"),r=es(r),yw(t)||ww(t))return Ew(t,e,r);if(!gw(t))throw new aw("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:Zo(t),s=(i=e.writable)!==null&&i!==void 0?i:Hc(t),a=t._writableState,l=t._readableState,u=()=>{t.writable||g()},d=bw(t)&&Zo(t)===o&&Hc(t)===s,h=Gc(t,!1),g=()=>{h=!0,t.destroyed&&(d=!1),!(d&&(!t.readable||o))&&(!o||y)&&r.call(t)},y=$c(t,!1),b=()=>{y=!0,t.destroyed&&(d=!1),!(d&&(!t.writable||s))&&(!s||h)&&r.call(t)},w=I=>{r.call(t,I)},S=pw(t),x=()=>{S=!0;let I=Jc(t)||Vc(t);if(I&&typeof I!="boolean")return r.call(t,I);if(o&&!y&&Zo(t,!0)&&!$c(t,!1))return r.call(t,new qc);if(s&&!h&&!Gc(t,!1))return r.call(t,new qc);r.call(t)},T=()=>{S=!0;let I=Jc(t)||Vc(t);if(I&&typeof I!="boolean")return r.call(t,I);r.call(t)},k=()=>{t.req.on("finish",g)};xw(t)?(t.on("complete",g),d||t.on("abort",x),t.req?k():t.on("request",k)):s&&!a&&(t.on("end",u),t.on("close",u)),!d&&typeof t.aborted=="boolean"&&t.on("aborted",x),t.on("end",b),t.on("finish",g),e.error!==!1&&t.on("error",w),t.on("close",x),S?it.nextTick(x):a!=null&&a.errorEmitted||l!=null&&l.errorEmitted?d||it.nextTick(T):(!o&&(!d||jc(t))&&(h||Wc(t)===!1)||!s&&(!d||Wc(t))&&(y||jc(t)===!1)||l&&t.req&&t.aborted)&&it.nextTick(T);let E=()=>{r=ts,t.removeListener("aborted",x),t.removeListener("complete",g),t.removeListener("abort",x),t.removeListener("request",k),t.req&&t.req.removeListener("finish",g),t.removeListener("end",u),t.removeListener("close",u),t.removeListener("finish",g),t.removeListener("end",b),t.removeListener("error",w),t.removeListener("close",x)};if(e.signal&&!S){let I=()=>{let $=r;E(),$.call(t,new zc(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)it.nextTick(I);else{cr=cr||H().addAbortListener;let $=cr(e.signal,I),L=r;r=es((...V)=>{$[Yc](),L.apply(t,V)})}}return E}function Ew(t,e,r){let n=!1,i=ts;if(e.signal)if(i=()=>{n=!0,r.call(t,new zc(void 0,{cause:e.signal.reason}))},e.signal.aborted)it.nextTick(i);else{cr=cr||H().addAbortListener;let s=cr(e.signal,i),a=r;r=es((...l)=>{s[Yc](),a.apply(t,l)})}let o=(...s)=>{n||it.nextTick(()=>r.apply(t,s))};return hw(t[mw].promise,o,o),ts}function _w(t,e){var r;let n=!1;return e===null&&(e=Qo),(r=e)!==null&&r!==void 0&&r.cleanup&&(lw(e.cleanup,"cleanup"),n=e.cleanup),new dw((i,o)=>{let s=Xc(t,e,a=>{n&&s(),a?o(a):i()})})}rs.exports=Xc;rs.exports.finished=_w});var Lt=m((x_,sf)=>{"use strict";var E_=c(f()),Te=nt(),{aggregateTwoErrors:vw,codes:{ERR_MULTIPLE_CALLBACK:Sw},AbortError:Aw}=z(),{Symbol:ef}=C(),{kIsDestroyed:Tw,isDestroyed:Bw,isFinished:Iw,isServerRequest:kw}=Ae(),tf=ef("kDestroy"),ns=ef("kConstruct");function rf(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Rw(t,e){let r=this._readableState,n=this._writableState,i=n||r;return n!=null&&n.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(rf(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Zc(this,t,e):this.once(tf,function(o){Zc(this,vw(o,t),e)}),this)}function Zc(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;rf(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?Te.nextTick(Ow,t,o):Te.nextTick(nf,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function Ow(t,e){is(t,e),nf(t)}function nf(t){let e=t._readableState,r=t._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&t.emit("close")}function is(t,e){let r=t._readableState,n=t._writableState;n!=null&&n.errorEmitted||r!=null&&r.errorEmitted||(n&&(n.errorEmitted=!0),r&&(r.errorEmitted=!0),t.emit("error",e))}function Lw(){let t=this._readableState,e=this._writableState;t&&(t.constructed=!0,t.closed=!1,t.closeEmitted=!1,t.destroyed=!1,t.errored=null,t.errorEmitted=!1,t.reading=!1,t.ended=t.readable===!1,t.endEmitted=t.readable===!1),e&&(e.constructed=!0,e.destroyed=!1,e.closed=!1,e.closeEmitted=!1,e.errored=null,e.errorEmitted=!1,e.finalCalled=!1,e.prefinished=!1,e.ended=e.writable===!1,e.ending=e.writable===!1,e.finished=e.writable===!1)}function os(t,e,r){let n=t._readableState,i=t._writableState;if(i!=null&&i.destroyed||n!=null&&n.destroyed)return this;n!=null&&n.autoDestroy||i!=null&&i.autoDestroy?t.destroy(e):e&&(e.stack,i&&!i.errored&&(i.errored=e),n&&!n.errored&&(n.errored=e),r?Te.nextTick(is,t,e):is(t,e))}function Cw(t,e){if(typeof t._construct!="function")return;let r=t._readableState,n=t._writableState;r&&(r.constructed=!1),n&&(n.constructed=!1),t.once(ns,e),!(t.listenerCount(ns)>1)&&Te.nextTick(Dw,t)}function Dw(t){let e=!1;function r(n){if(e){os(t,n??new Sw);return}e=!0;let i=t._readableState,o=t._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?t.emit(tf,n):n?os(t,n,!0):Te.nextTick(Pw,t)}try{t._construct(n=>{Te.nextTick(r,n)})}catch(n){Te.nextTick(r,n)}}function Pw(t){t.emit(ns)}function Qc(t){return t?.setHeader&&typeof t.abort=="function"}function of(t){t.emit("close")}function Uw(t,e){t.emit("error",e),Te.nextTick(of,t)}function Mw(t,e){!t||Bw(t)||(!e&&!Iw(t)&&(e=new Aw),kw(t)?(t.socket=null,t.destroy(e)):Qc(t)?t.abort():Qc(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?Te.nextTick(Uw,t,e):Te.nextTick(of,t),t.destroyed||(t[Tw]=!0))}sf.exports={construct:Cw,destroyer:Mw,destroy:Rw,undestroy:Lw,errorOrDestroy:os}});var Jn=m((__,uf)=>{"use strict";var v_=c(f()),{ArrayIsArray:Nw,ObjectSetPrototypeOf:af}=C(),{EventEmitter:Hn}=Jt();function Gn(t){Hn.call(this,t)}af(Gn.prototype,Hn.prototype);af(Gn,Hn);Gn.prototype.pipe=function(t,e){let r=this;function n(d){t.writable&&t.write(d)===!1&&r.pause&&r.pause()}r.on("data",n);function i(){r.readable&&r.resume&&r.resume()}t.on("drain",i),!t._isStdio&&(!e||e.end!==!1)&&(r.on("end",s),r.on("close",a));let o=!1;function s(){o||(o=!0,t.end())}function a(){o||(o=!0,typeof t.destroy=="function"&&t.destroy())}function l(d){u(),Hn.listenerCount(this,"error")===0&&this.emit("error",d)}ss(r,"error",l),ss(t,"error",l);function u(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",l),t.removeListener("error",l),r.removeListener("end",u),r.removeListener("close",u),t.removeListener("close",u)}return r.on("end",u),r.on("close",u),t.on("close",u),t.emit("pipe",r),t};function ss(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Nw(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}uf.exports={Stream:Gn,prependListener:ss}});var Wr=m((S_,zn)=>{"use strict";var A_=c(f()),{SymbolDispose:Kw}=C(),{AbortError:cf,codes:Fw}=z(),{isNodeStream:ff,isWebStream:qw,kControllerErrorFunction:jw}=Ae(),$w=je(),{ERR_INVALID_ARG_TYPE:lf}=Fw,as,Vw=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new lf(e,"AbortSignal",t)};zn.exports.addAbortSignal=function(e,r){if(Vw(e,"signal"),!ff(r)&&!qw(r))throw new lf("stream",["ReadableStream","WritableStream","Stream"],r);return zn.exports.addAbortSignalNoValidate(e,r)};zn.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=ff(e)?()=>{e.destroy(new cf(void 0,{cause:t.reason}))}:()=>{e[jw](new cf(void 0,{cause:t.reason}))};if(t.aborted)r();else{as=as||H().addAbortListener;let n=as(t,r);$w(e,n[Kw])}return e}});var pf=m((B_,hf)=>{"use strict";var I_=c(f()),{StringPrototypeSlice:df,SymbolIterator:Ww,TypedArrayPrototypeSet:Yn,Uint8Array:Hw}=C(),{Buffer:us}=X(),{inspect:Gw}=H();hf.exports=class{constructor(){this.head=null,this.tail=null,this.length=0}push(e){let r={data:e,next:null};this.length>0?this.tail.next=r:this.head=r,this.tail=r,++this.length}unshift(e){let r={data:e,next:this.head};this.length===0&&(this.tail=r),this.head=r,++this.length}shift(){if(this.length===0)return;let e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}clear(){this.head=this.tail=null,this.length=0}join(e){if(this.length===0)return"";let r=this.head,n=""+r.data;for(;(r=r.next)!==null;)n+=e+r.data;return n}concat(e){if(this.length===0)return us.alloc(0);let r=us.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)Yn(r,n.data,i),i+=n.data.length,n=n.next;return r}consume(e,r){let n=this.head.data;if(e<n.length){let i=n.slice(0,e);return this.head.data=n.slice(e),i}return e===n.length?this.shift():r?this._getString(e):this._getBuffer(e)}first(){return this.head.data}*[Ww](){for(let e=this.head;e;e=e.next)yield e.data}_getString(e){let r="",n=this.head,i=0;do{let o=n.data;if(e>o.length)r+=o,e-=o.length;else{e===o.length?(r+=o,++i,n.next?this.head=n.next:this.head=this.tail=null):(r+=df(o,0,e),this.head=n,n.data=df(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=us.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)Yn(r,s,n-e),e-=s.length;else{e===s.length?(Yn(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(Yn(r,new Hw(s.buffer,s.byteOffset,e),n-e),this.head=i,i.data=s.slice(e));break}++o}while((i=i.next)!==null);return this.length-=o,r}[Symbol.for("nodejs.util.inspect.custom")](e,r){return Gw(this,{...r,depth:0,customInspect:!1})}}});var Hr=m((k_,bf)=>{"use strict";var R_=c(f()),{MathFloor:Jw,NumberIsInteger:zw}=C(),{validateInteger:Yw}=ar(),{ERR_INVALID_ARG_VALUE:Xw}=z().codes,yf=16*1024,wf=16;function Zw(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function gf(t){return t?wf:yf}function Qw(t,e){Yw(e,"value",0),t?wf=e:yf=e}function eg(t,e,r,n){let i=Zw(e,n,r);if(i!=null){if(!zw(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new Xw(o,i)}return Jw(i)}return gf(t.objectMode)}bf.exports={getHighWaterMark:eg,getDefaultHighWaterMark:gf,setDefaultHighWaterMark:Qw}});var Ef=m((cs,xf)=>{var O_=c(f());var Xn=X(),Be=Xn.Buffer;function mf(t,e){for(var r in t)e[r]=t[r]}Be.from&&Be.alloc&&Be.allocUnsafe&&Be.allocUnsafeSlow?xf.exports=Xn:(mf(Xn,cs),cs.Buffer=Ct);function Ct(t,e,r){return Be(t,e,r)}Ct.prototype=Object.create(Be.prototype);mf(Be,Ct);Ct.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return Be(t,e,r)};Ct.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=Be(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Ct.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Be(t)};Ct.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Xn.SlowBuffer(t)}});var Sf=m(vf=>{"use strict";var C_=c(f()),ls=Ef().Buffer,_f=ls.isEncoding||function(t){switch(t=""+t,t&&t.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function tg(t){if(!t)return"utf8";for(var e;;)switch(t){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return t;default:if(e)return;t=(""+t).toLowerCase(),e=!0}}function rg(t){var e=tg(t);if(typeof e!="string"&&(ls.isEncoding===_f||!_f(t)))throw new Error("Unknown encoding: "+t);return e||t}vf.StringDecoder=Gr;function Gr(t){this.encoding=rg(t);var e;switch(this.encoding){case"utf16le":this.text=ug,this.end=cg,e=4;break;case"utf8":this.fillLast=og,e=4;break;case"base64":this.text=fg,this.end=lg,e=3;break;default:this.write=dg,this.end=hg;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=ls.allocUnsafe(e)}Gr.prototype.write=function(t){if(t.length===0)return"";var e,r;if(this.lastNeed){if(e=this.fillLast(t),e===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r<t.length?e?e+this.text(t,r):this.text(t,r):e||""};Gr.prototype.end=ag;Gr.prototype.text=sg;Gr.prototype.fillLast=function(t){if(this.lastNeed<=t.length)return t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,this.lastTotal-this.lastNeed,0,t.length),this.lastNeed-=t.length};function fs(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function ng(t,e,r){var n=e.length-1;if(n<r)return 0;var i=fs(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=fs(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=fs(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function ig(t,e,r){if((e[0]&192)!==128)return t.lastNeed=0,"\uFFFD";if(t.lastNeed>1&&e.length>1){if((e[1]&192)!==128)return t.lastNeed=1,"\uFFFD";if(t.lastNeed>2&&e.length>2&&(e[2]&192)!==128)return t.lastNeed=2,"\uFFFD"}}function og(t){var e=this.lastTotal-this.lastNeed,r=ig(this,t,e);if(r!==void 0)return r;if(this.lastNeed<=t.length)return t.copy(this.lastChar,e,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);t.copy(this.lastChar,e,0,t.length),this.lastNeed-=t.length}function sg(t,e){var r=ng(this,t,e);if(!this.lastNeed)return t.toString("utf8",e);this.lastTotal=r;var n=t.length-(r-this.lastNeed);return t.copy(this.lastChar,0,n),t.toString("utf8",e,n)}function ag(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function ug(t,e){if((t.length-e)%2===0){var r=t.toString("utf16le",e);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=t[t.length-1],t.toString("utf16le",e,t.length-1)}function cg(t){var e=t&&t.length?this.write(t):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return e+this.lastChar.toString("utf16le",0,r)}return e}function fg(t,e){var r=(t.length-e)%3;return r===0?t.toString("base64",e):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=t[t.length-1]:(this.lastChar[0]=t[t.length-2],this.lastChar[1]=t[t.length-1]),t.toString("base64",e,t.length-r))}function lg(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function dg(t){return t.toString(this.encoding)}function hg(t){return t&&t.length?this.write(t):""}});var ds=m((D_,If)=>{"use strict";var P_=c(f()),Af=nt(),{PromisePrototypeThen:pg,SymbolAsyncIterator:Tf,SymbolIterator:Bf}=C(),{Buffer:yg}=X(),{ERR_INVALID_ARG_TYPE:wg,ERR_STREAM_NULL_VALUES:gg}=z().codes;function bg(t,e,r){let n;if(typeof e=="string"||e instanceof yg)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[Tf])i=!0,n=e[Tf]();else if(e&&e[Bf])i=!1,n=e[Bf]();else throw new wg("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,l())},o._destroy=function(u,d){pg(a(u),()=>Af.nextTick(d,u),h=>Af.nextTick(d,h||u))};async function a(u){let d=u!=null,h=typeof n.throw=="function";if(d&&h){let{value:g,done:y}=await n.throw(u);if(await g,y)return}if(typeof n.return=="function"){let{value:g}=await n.return();await g}}async function l(){for(;;){try{let{value:u,done:d}=i?await n.next():n.next();if(d)o.push(null);else{let h=u&&typeof u.then=="function"?await u:u;if(h===null)throw s=!1,new gg;if(o.push(h))continue;s=!1}}catch(u){o.destroy(u)}break}}return o}If.exports=bg});var zr=m((U_,Hf)=>{var M_=c(f()),he=nt(),{ArrayPrototypeIndexOf:mg,NumberIsInteger:xg,NumberIsNaN:Eg,NumberParseInt:_g,ObjectDefineProperties:xs,ObjectKeys:vg,ObjectSetPrototypeOf:Of,Promise:Lf,SafeSet:Sg,SymbolAsyncDispose:Ag,SymbolAsyncIterator:Tg,Symbol:Bg}=C();Hf.exports=v;v.ReadableState=ti;var{EventEmitter:Ig}=Jt(),{Stream:ot,prependListener:kg}=Jn(),{Buffer:hs}=X(),{addAbortSignal:Rg}=Wr(),Cf=je(),B=H().debuglog("stream",t=>{B=t}),Og=pf(),dr=Lt(),{getHighWaterMark:Lg,getDefaultHighWaterMark:Cg}=Hr(),{aggregateTwoErrors:kf,codes:{ERR_INVALID_ARG_TYPE:Dg,ERR_METHOD_NOT_IMPLEMENTED:Pg,ERR_OUT_OF_RANGE:Ug,ERR_STREAM_PUSH_AFTER_EOF:Mg,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:Ng},AbortError:Kg}=z(),{validateObject:Fg}=ar(),Dt=Bg("kPaused"),{StringDecoder:Df}=Sf(),qg=ds();Of(v.prototype,ot.prototype);Of(v,ot);var ps=()=>{},{errorOrDestroy:fr}=dr,lr=1,jg=2,Pf=4,Jr=8,Uf=16,Zn=32,Qn=64,Mf=128,$g=256,Vg=512,Wg=1024,bs=2048,ms=4096,Hg=8192,Gg=16384,Jg=32768,Nf=65536,zg=1<<17,Yg=1<<18;function K(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}xs(ti.prototype,{objectMode:K(lr),ended:K(jg),endEmitted:K(Pf),reading:K(Jr),constructed:K(Uf),sync:K(Zn),needReadable:K(Qn),emittedReadable:K(Mf),readableListening:K($g),resumeScheduled:K(Vg),errorEmitted:K(Wg),emitClose:K(bs),autoDestroy:K(ms),destroyed:K(Hg),closed:K(Gg),closeEmitted:K(Jg),multiAwaitDrain:K(Nf),readingMore:K(zg),dataEmitted:K(Yg)});function ti(t,e,r){typeof r!="boolean"&&(r=e instanceof Ie()),this.state=bs|ms|Uf|Zn,t&&t.objectMode&&(this.state|=lr),r&&t&&t.readableObjectMode&&(this.state|=lr),this.highWaterMark=t?Lg(this,t,"readableHighWaterMark",r):Cg(!1),this.buffer=new Og,this.length=0,this.pipes=[],this.flowing=null,this[Dt]=null,t&&t.emitClose===!1&&(this.state&=~bs),t&&t.autoDestroy===!1&&(this.state&=~ms),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Df(t.encoding),this.encoding=t.encoding)}function v(t){if(!(this instanceof v))return new v(t);let e=this instanceof Ie();this._readableState=new ti(t,this,e),t&&(typeof t.read=="function"&&(this._read=t.read),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&!e&&Rg(t.signal,this)),ot.call(this,t),dr.construct(this,()=>{this._readableState.needReadable&&ei(this,this._readableState)})}v.prototype.destroy=dr.destroy;v.prototype._undestroy=dr.undestroy;v.prototype._destroy=function(t,e){e(t)};v.prototype[Ig.captureRejectionSymbol]=function(t){this.destroy(t)};v.prototype[Ag]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new Kg,this.destroy(t)),new Lf((e,r)=>Cf(this,n=>n&&n!==t?r(n):e(null)))};v.prototype.push=function(t,e){return Kf(this,t,e,!1)};v.prototype.unshift=function(t,e){return Kf(this,t,e,!0)};function Kf(t,e,r,n){B("readableAddChunk",e);let i=t._readableState,o;if(i.state&lr||(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=hs.from(e,r).toString(i.encoding):(e=hs.from(e,r),r=""))):e instanceof hs?r="":ot._isUint8Array(e)?(e=ot._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new Dg("chunk",["string","Buffer","Uint8Array"],e))),o)fr(t,o);else if(e===null)i.state&=~Jr,Qg(t,i);else if(i.state&lr||e&&e.length>0)if(n)if(i.state&Pf)fr(t,new Ng);else{if(i.destroyed||i.errored)return!1;ys(t,i,e,!0)}else if(i.ended)fr(t,new Mg);else{if(i.destroyed||i.errored)return!1;i.state&=~Jr,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?ys(t,i,e,!1):ei(t,i)):ys(t,i,e,!1)}else n||(i.state&=~Jr,ei(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function ys(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?(e.state&Nf?e.awaitDrainWriters.clear():e.awaitDrainWriters=null,e.dataEmitted=!0,t.emit("data",r)):(e.length+=e.objectMode?1:r.length,n?e.buffer.unshift(r):e.buffer.push(r),e.state&Qn&&ri(t)),ei(t,e)}v.prototype.isPaused=function(){let t=this._readableState;return t[Dt]===!0||t.flowing===!1};v.prototype.setEncoding=function(t){let e=new Df(t);this._readableState.decoder=e,this._readableState.encoding=this._readableState.decoder.encoding;let r=this._readableState.buffer,n="";for(let i of r)n+=e.write(i);return r.clear(),n!==""&&r.push(n),this._readableState.length=n.length,this};var Xg=1073741824;function Zg(t){if(t>Xg)throw new Ug("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Rf(t,e){return t<=0||e.length===0&&e.ended?0:e.state&lr?1:Eg(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}v.prototype.read=function(t){B("read",t),t===void 0?t=NaN:xg(t)||(t=_g(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=Zg(t)),t!==0&&(e.state&=~Mf),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return B("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?ws(this):ri(this),null;if(t=Rf(t,e),t===0&&e.ended)return e.length===0&&ws(this),null;let n=(e.state&Qn)!==0;if(B("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,B("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,B("reading, ended or constructing",n);else if(n){B("do read"),e.state|=Jr|Zn,e.length===0&&(e.state|=Qn);try{this._read(e.highWaterMark)}catch(o){fr(this,o)}e.state&=~Zn,e.reading||(t=Rf(r,e))}let i;return t>0?i=Vf(t,e):i=null,i===null?(e.needReadable=e.length<=e.highWaterMark,t=0):(e.length-=t,e.multiAwaitDrain?e.awaitDrainWriters.clear():e.awaitDrainWriters=null),e.length===0&&(e.ended||(e.needReadable=!0),r!==t&&e.ended&&ws(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function Qg(t,e){if(B("onEofChunk"),!e.ended){if(e.decoder){let r=e.decoder.end();r&&r.length&&(e.buffer.push(r),e.length+=e.objectMode?1:r.length)}e.ended=!0,e.sync?ri(t):(e.needReadable=!1,e.emittedReadable=!0,Ff(t))}}function ri(t){let e=t._readableState;B("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(B("emitReadable",e.flowing),e.emittedReadable=!0,he.nextTick(Ff,t))}function Ff(t){let e=t._readableState;B("emitReadable_",e.destroyed,e.length,e.ended),!e.destroyed&&!e.errored&&(e.length||e.ended)&&(t.emit("readable"),e.emittedReadable=!1),e.needReadable=!e.flowing&&!e.ended&&e.length<=e.highWaterMark,jf(t)}function ei(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,he.nextTick(eb,t,e))}function eb(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(B("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}v.prototype._read=function(t){throw new Pg("_read()")};v.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new Sg(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),B("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==he.stdout&&t!==he.stderr?a:S;n.endEmitted?he.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(x,T){B("onunpipe"),x===r&&T&&T.hasUnpiped===!1&&(T.hasUnpiped=!0,d())}function a(){B("onend"),t.end()}let l,u=!1;function d(){B("cleanup"),t.removeListener("close",b),t.removeListener("finish",w),l&&t.removeListener("drain",l),t.removeListener("error",y),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",S),r.removeListener("data",g),u=!0,l&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&l()}function h(){u||(n.pipes.length===1&&n.pipes[0]===t?(B("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(B("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),l||(l=tb(r,t),t.on("drain",l))}r.on("data",g);function g(x){B("ondata");let T=t.write(x);B("dest.write",T),T===!1&&h()}function y(x){if(B("onerror",x),S(),t.removeListener("error",y),t.listenerCount("error")===0){let T=t._writableState||t._readableState;T&&!T.errorEmitted?fr(t,x):t.emit("error",x)}}kg(t,"error",y);function b(){t.removeListener("finish",w),S()}t.once("close",b);function w(){B("onfinish"),t.removeListener("close",b),S()}t.once("finish",w);function S(){B("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?h():n.flowing||(B("pipe resume"),r.resume()),t};function tb(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(B("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(B("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}v.prototype.unpipe=function(t){let e=this._readableState,r={hasUnpiped:!1};if(e.pipes.length===0)return this;if(!t){let i=e.pipes;e.pipes=[],this.pause();for(let o=0;o<i.length;o++)i[o].emit("unpipe",this,{hasUnpiped:!1});return this}let n=mg(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};v.prototype.on=function(t,e){let r=ot.prototype.on.call(this,t,e),n=this._readableState;return t==="data"?(n.readableListening=this.listenerCount("readable")>0,n.flowing!==!1&&this.resume()):t==="readable"&&!n.endEmitted&&!n.readableListening&&(n.readableListening=n.needReadable=!0,n.flowing=!1,n.emittedReadable=!1,B("on readable",n.length,n.reading),n.length?ri(this):n.reading||he.nextTick(rb,this)),r};v.prototype.addListener=v.prototype.on;v.prototype.removeListener=function(t,e){let r=ot.prototype.removeListener.call(this,t,e);return t==="readable"&&he.nextTick(qf,this),r};v.prototype.off=v.prototype.removeListener;v.prototype.removeAllListeners=function(t){let e=ot.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&he.nextTick(qf,this),e};function qf(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Dt]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function rb(t){B("readable nexttick read 0"),t.read(0)}v.prototype.resume=function(){let t=this._readableState;return t.flowing||(B("resume"),t.flowing=!t.readableListening,nb(this,t)),t[Dt]=!1,this};function nb(t,e){e.resumeScheduled||(e.resumeScheduled=!0,he.nextTick(ib,t,e))}function ib(t,e){B("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),jf(t),e.flowing&&!e.reading&&t.read(0)}v.prototype.pause=function(){return B("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(B("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Dt]=!0,this};function jf(t){let e=t._readableState;for(B("flow",e.flowing);e.flowing&&t.read()!==null;);}v.prototype.wrap=function(t){let e=!1;t.on("data",n=>{!this.push(n)&&t.pause&&(e=!0,t.pause())}),t.on("end",()=>{this.push(null)}),t.on("error",n=>{fr(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=vg(t);for(let n=1;n<r.length;n++){let i=r[n];this[i]===void 0&&typeof t[i]=="function"&&(this[i]=t[i].bind(t))}return this};v.prototype[Tg]=function(){return $f(this)};v.prototype.iterator=function(t){return t!==void 0&&Fg(t,"options"),$f(this,t)};function $f(t,e){typeof t.read!="function"&&(t=v.wrap(t,{objectMode:!0}));let r=ob(t,e);return r.stream=t,r}async function*ob(t,e){let r=ps;function n(s){this===t?(r(),r=ps):r=s}t.on("readable",n);let i,o=Cf(t,{writable:!1},s=>{i=s?kf(i,s):null,r(),r=ps});try{for(;;){let s=t.destroyed?null:t.read();if(s!==null)yield s;else{if(i)throw i;if(i===null)return;await new Lf(n)}}}catch(s){throw i=kf(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?dr.destroyer(t,null):(t.off("readable",n),o())}}xs(v.prototype,{readable:{__proto__:null,get(){let t=this._readableState;return!!t&&t.readable!==!1&&!t.destroyed&&!t.errorEmitted&&!t.endEmitted},set(t){this._readableState&&(this._readableState.readable=!!t)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(t){this._readableState&&(this._readableState.flowing=t)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(t){this._readableState&&(this._readableState.destroyed=t)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}});xs(ti.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Dt]!==!1},set(t){this[Dt]=!!t}}});v._fromList=Vf;function Vf(t,e){if(e.length===0)return null;let r;return e.objectMode?r=e.buffer.shift():!t||t>=e.length?(e.decoder?r=e.buffer.join(""):e.buffer.length===1?r=e.buffer.first():r=e.buffer.concat(e.length),e.buffer.clear()):r=e.buffer.consume(t,e.decoder),r}function ws(t){let e=t._readableState;B("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,he.nextTick(sb,e,t))}function sb(t,e){if(B("endReadableNT",t.endEmitted,t.length),!t.errored&&!t.closeEmitted&&!t.endEmitted&&t.length===0){if(t.endEmitted=!0,e.emit("end"),e.writable&&e.allowHalfOpen===!1)he.nextTick(ab,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function ab(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}v.from=function(t,e){return qg(v,t,e)};var gs;function Wf(){return gs===void 0&&(gs={}),gs}v.fromWeb=function(t,e){return Wf().newStreamReadableFromReadableStream(t,e)};v.toWeb=function(t,e){return Wf().newReadableStreamFromStreamReadable(t,e)};v.wrap=function(t,e){var r,n;return new v({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){dr.destroyer(t,i),o(i)}}).wrap(t)}});var ai=m((N_,il)=>{var K_=c(f()),Pt=nt(),{ArrayPrototypeSlice:zf,Error:ub,FunctionPrototypeSymbolHasInstance:Yf,ObjectDefineProperty:Xf,ObjectDefineProperties:cb,ObjectSetPrototypeOf:Zf,StringPrototypeToLowerCase:fb,Symbol:lb,SymbolHasInstance:db}=C();il.exports=D;D.WritableState=Zr;var{EventEmitter:hb}=Jt(),Yr=Jn().Stream,{Buffer:ni}=X(),si=Lt(),{addAbortSignal:pb}=Wr(),{getHighWaterMark:yb,getDefaultHighWaterMark:wb}=Hr(),{ERR_INVALID_ARG_TYPE:gb,ERR_METHOD_NOT_IMPLEMENTED:bb,ERR_MULTIPLE_CALLBACK:Qf,ERR_STREAM_CANNOT_PIPE:mb,ERR_STREAM_DESTROYED:Xr,ERR_STREAM_ALREADY_FINISHED:xb,ERR_STREAM_NULL_VALUES:Eb,ERR_STREAM_WRITE_AFTER_END:_b,ERR_UNKNOWN_ENCODING:el}=z().codes,{errorOrDestroy:hr}=si;Zf(D.prototype,Yr.prototype);Zf(D,Yr);function vs(){}var pr=lb("kOnFinished");function Zr(t,e,r){typeof r!="boolean"&&(r=e instanceof Ie()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?yb(this,t,"writableHighWaterMark",r):wb(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;let n=!!(t&&t.decodeStrings===!1);this.decodeStrings=!n,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=Sb.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,oi(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!t||t.emitClose!==!1,this.autoDestroy=!t||t.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[pr]=[]}function oi(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Zr.prototype.getBuffer=function(){return zf(this.buffered,this.bufferedIndex)};Xf(Zr.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function D(t){let e=this instanceof Ie();if(!e&&!Yf(D,this))return new D(t);this._writableState=new Zr(t,this,e),t&&(typeof t.write=="function"&&(this._write=t.write),typeof t.writev=="function"&&(this._writev=t.writev),typeof t.destroy=="function"&&(this._destroy=t.destroy),typeof t.final=="function"&&(this._final=t.final),typeof t.construct=="function"&&(this._construct=t.construct),t.signal&&pb(t.signal,this)),Yr.call(this,t),si.construct(this,()=>{let r=this._writableState;r.writing||As(this,r),Ts(this,r)})}Xf(D,db,{__proto__:null,value:function(t){return Yf(this,t)?!0:this!==D?!1:t&&t._writableState instanceof Zr}});D.prototype.pipe=function(){hr(this,new mb)};function tl(t,e,r,n){let i=t._writableState;if(typeof r=="function")n=r,r=i.defaultEncoding;else{if(!r)r=i.defaultEncoding;else if(r!=="buffer"&&!ni.isEncoding(r))throw new el(r);typeof n!="function"&&(n=vs)}if(e===null)throw new Eb;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=ni.from(e,r),r="buffer");else if(e instanceof ni)r="buffer";else if(Yr._isUint8Array(e))e=Yr._uint8ArrayToBuffer(e),r="buffer";else throw new gb("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new _b:i.destroyed&&(o=new Xr("write")),o?(Pt.nextTick(n,o),hr(t,o,!0),o):(i.pendingcb++,vb(t,i,e,r,n))}D.prototype.write=function(t,e,r){return tl(this,t,e,r)===!0};D.prototype.cork=function(){this._writableState.corked++};D.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||As(this,t))};D.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=fb(e)),!ni.isEncoding(e))throw new el(e);return this._writableState.defaultEncoding=e,this};function vb(t,e,r,n,i){let o=e.objectMode?1:r.length;e.length+=o;let s=e.length<e.highWaterMark;return s||(e.needDrain=!0),e.writing||e.corked||e.errored||!e.constructed?(e.buffered.push({chunk:r,encoding:n,callback:i}),e.allBuffers&&n!=="buffer"&&(e.allBuffers=!1),e.allNoop&&i!==vs&&(e.allNoop=!1)):(e.writelen=o,e.writecb=i,e.writing=!0,e.sync=!0,t._write(r,n,e.onwrite),e.sync=!1),s&&!e.errored&&!e.destroyed}function Gf(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Xr("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function Jf(t,e,r,n){--e.pendingcb,n(r),Ss(e),hr(t,r)}function Sb(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){hr(t,new Qf);return}r.writing=!1,r.writecb=null,r.length-=r.writelen,r.writelen=0,e?(e.stack,r.errored||(r.errored=e),t._readableState&&!t._readableState.errored&&(t._readableState.errored=e),n?Pt.nextTick(Jf,t,r,e,i):Jf(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&As(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},Pt.nextTick(Ab,r.afterWriteTickInfo)):rl(t,r,1,i))}function Ab({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,rl(t,e,r,n)}function rl(t,e,r,n){for(!e.ending&&!t.destroyed&&e.length===0&&e.needDrain&&(e.needDrain=!1,t.emit("drain"));r-- >0;)e.pendingcb--,n();e.destroyed&&Ss(e),Ts(t,e)}function Ss(t){if(t.writing)return;for(let i=t.bufferedIndex;i<t.buffered.length;++i){var e;let{chunk:o,callback:s}=t.buffered[i],a=t.objectMode?1:o.length;t.length-=a,s((e=t.errored)!==null&&e!==void 0?e:new Xr("write"))}let r=t[pr].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Xr("end"))}oi(t)}function As(t,e){if(e.corked||e.bufferProcessing||e.destroyed||!e.constructed)return;let{buffered:r,bufferedIndex:n,objectMode:i}=e,o=r.length-n;if(!o)return;let s=n;if(e.bufferProcessing=!0,o>1&&t._writev){e.pendingcb-=o-1;let a=e.allNoop?vs:u=>{for(let d=s;d<r.length;++d)r[d].callback(u)},l=e.allNoop&&s===0?r:zf(r,s);l.allBuffers=e.allBuffers,Gf(t,e,!0,e.length,l,"",a),oi(e)}else{do{let{chunk:a,encoding:l,callback:u}=r[s];r[s++]=null;let d=i?1:a.length;Gf(t,e,!1,d,a,l,u)}while(s<r.length&&!e.writing);s===r.length?oi(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}D.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new bb("_write()")};D.prototype._writev=null;D.prototype.end=function(t,e,r){let n=this._writableState;typeof t=="function"?(r=t,t=null,e=null):typeof e=="function"&&(r=e,e=null);let i;if(t!=null){let o=tl(this,t,e);o instanceof ub&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Ts(this,n,!0),n.ended=!0):n.finished?i=new xb("end"):n.destroyed&&(i=new Xr("end"))),typeof r=="function"&&(i||n.finished?Pt.nextTick(r,i):n[pr].push(r)),this};function ii(t){return t.ending&&!t.destroyed&&t.constructed&&t.length===0&&!t.errored&&t.buffered.length===0&&!t.finished&&!t.writing&&!t.errorEmitted&&!t.closeEmitted}function Tb(t,e){let r=!1;function n(i){if(r){hr(t,i??Qf());return}if(r=!0,e.pendingcb--,i){let o=e[pr].splice(0);for(let s=0;s<o.length;s++)o[s](i);hr(t,i,e.sync)}else ii(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,Pt.nextTick(_s,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function Bb(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Tb(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Ts(t,e,r){ii(e)&&(Bb(t,e),e.pendingcb===0&&(r?(e.pendingcb++,Pt.nextTick((n,i)=>{ii(i)?_s(n,i):i.pendingcb--},t,e)):ii(e)&&(e.pendingcb++,_s(t,e))))}function _s(t,e){e.pendingcb--,e.finished=!0;let r=e[pr].splice(0);for(let n=0;n<r.length;n++)r[n]();if(t.emit("finish"),e.autoDestroy){let n=t._readableState;(!n||n.autoDestroy&&(n.endEmitted||n.readable===!1))&&t.destroy()}}cb(D.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(t){this._writableState&&(this._writableState.destroyed=t)}},writable:{__proto__:null,get(){let t=this._writableState;return!!t&&t.writable!==!1&&!t.destroyed&&!t.errored&&!t.ending&&!t.ended},set(t){this._writableState&&(this._writableState.writable=!!t)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let t=this._writableState;return t?!t.destroyed&&!t.ending&&t.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});var Ib=si.destroy;D.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[pr].length)&&Pt.nextTick(Ss,r),Ib.call(this,t,e),this};D.prototype._undestroy=si.undestroy;D.prototype._destroy=function(t,e){e(t)};D.prototype[hb.captureRejectionSymbol]=function(t){this.destroy(t)};var Es;function nl(){return Es===void 0&&(Es={}),Es}D.fromWeb=function(t,e){return nl().newStreamWritableFromWritableStream(t,e)};D.toWeb=function(t){return nl().newWritableStreamFromStreamWritable(t)}});var ml=m((F_,bl)=>{var q_=c(f()),Bs=nt(),kb=X(),{isReadable:Rb,isWritable:Ob,isIterable:ol,isNodeStream:Lb,isReadableNodeStream:sl,isWritableNodeStream:al,isDuplexNodeStream:Cb,isReadableStream:ul,isWritableStream:cl}=Ae(),fl=je(),{AbortError:wl,codes:{ERR_INVALID_ARG_TYPE:Db,ERR_INVALID_RETURN_VALUE:ll}}=z(),{destroyer:wr}=Lt(),Pb=Ie(),gl=zr(),Ub=ai(),{createDeferredPromise:dl}=H(),hl=ds(),pl=globalThis.Blob||kb.Blob,Mb=typeof pl<"u"?function(e){return e instanceof pl}:function(e){return!1},Nb=globalThis.AbortController||or().AbortController,{FunctionPrototypeCall:yl}=C(),st=class extends Pb{constructor(e){super(e),e?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),e?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}};bl.exports=function t(e,r){if(Cb(e))return e;if(sl(e))return yr({readable:e});if(al(e))return yr({writable:e});if(Lb(e))return yr({writable:!1,readable:!1});if(ul(e))return yr({readable:gl.fromWeb(e)});if(cl(e))return yr({writable:Ub.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=Kb(e);if(ol(i))return hl(st,i,{objectMode:!0,write:o,final:s,destroy:a});let l=i?.then;if(typeof l=="function"){let u,d=yl(l,i,h=>{if(h!=null)throw new ll("nully","body",h)},h=>{wr(u,h)});return u=new st({objectMode:!0,readable:!1,write:o,final(h){s(async()=>{try{await d,Bs.nextTick(h,null)}catch(g){Bs.nextTick(h,g)}})},destroy:a})}throw new ll("Iterable, AsyncIterable or AsyncFunction",r,i)}if(Mb(e))return t(e.arrayBuffer());if(ol(e))return hl(st,e,{objectMode:!0,writable:!1});if(ul(e?.readable)&&cl(e?.writable))return st.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?sl(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?al(e?.writable)?e?.writable:t(e.writable):void 0;return yr({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return yl(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{wr(i,o)}),i=new st({objectMode:!0,writable:!1,read(){}})}throw new Db(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function Kb(t){let{promise:e,resolve:r}=dl(),n=new Nb,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:l,cb:u}=await s;if(Bs.nextTick(u),l)return;if(i.aborted)throw new wl(void 0,{cause:i.reason});({promise:e,resolve:r}=dl()),yield a}}(),{signal:i}),write(s,a,l){let u=r;r=null,u({chunk:s,done:!1,cb:l})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function yr(t){let e=t.readable&&typeof t.readable.read!="function"?gl.wrap(t.readable):t.readable,r=t.writable,n=!!Rb(e),i=!!Ob(r),o,s,a,l,u;function d(h){let g=l;l=null,g?g(h):h&&u.destroy(h)}return u=new st({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(fl(r,h=>{i=!1,h&&wr(e,h),d(h)}),u._write=function(h,g,y){r.write(h,g)?y():o=y},u._final=function(h){r.end(),s=h},r.on("drain",function(){if(o){let h=o;o=null,h()}}),r.on("finish",function(){if(s){let h=s;s=null,h()}})),n&&(fl(e,h=>{n=!1,h&&wr(e,h),d(h)}),e.on("readable",function(){if(a){let h=a;a=null,h()}}),e.on("end",function(){u.push(null)}),u._read=function(){for(;;){let h=e.read();if(h===null){a=u._read;return}if(!u.push(h))return}}),u._destroy=function(h,g){!h&&l!==null&&(h=new wl),a=null,o=null,s=null,l===null?g(h):(l=g,wr(r,h),wr(e,h))},u}});var Ie=m((j_,_l)=>{"use strict";var $_=c(f()),{ObjectDefineProperties:Fb,ObjectGetOwnPropertyDescriptor:$e,ObjectKeys:qb,ObjectSetPrototypeOf:xl}=C();_l.exports=pe;var Rs=zr(),ue=ai();xl(pe.prototype,Rs.prototype);xl(pe,Rs);{let t=qb(ue.prototype);for(let e=0;e<t.length;e++){let r=t[e];pe.prototype[r]||(pe.prototype[r]=ue.prototype[r])}}function pe(t){if(!(this instanceof pe))return new pe(t);Rs.call(this,t),ue.call(this,t),t?(this.allowHalfOpen=t.allowHalfOpen!==!1,t.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),t.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}Fb(pe.prototype,{writable:{__proto__:null,...$e(ue.prototype,"writable")},writableHighWaterMark:{__proto__:null,...$e(ue.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...$e(ue.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...$e(ue.prototype,"writableBuffer")},writableLength:{__proto__:null,...$e(ue.prototype,"writableLength")},writableFinished:{__proto__:null,...$e(ue.prototype,"writableFinished")},writableCorked:{__proto__:null,...$e(ue.prototype,"writableCorked")},writableEnded:{__proto__:null,...$e(ue.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...$e(ue.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(t){this._readableState&&this._writableState&&(this._readableState.destroyed=t,this._writableState.destroyed=t)}}});var Is;function El(){return Is===void 0&&(Is={}),Is}pe.fromWeb=function(t,e){return El().newStreamDuplexFromReadableWritablePair(t,e)};pe.toWeb=function(t){return El().newReadableWritablePairFromDuplex(t)};var ks;pe.from=function(t){return ks||(ks=ml()),ks(t,"body")}});var Cs=m((V_,Sl)=>{"use strict";var W_=c(f()),{ObjectSetPrototypeOf:vl,Symbol:jb}=C();Sl.exports=Ve;var{ERR_METHOD_NOT_IMPLEMENTED:$b}=z().codes,Ls=Ie(),{getHighWaterMark:Vb}=Hr();vl(Ve.prototype,Ls.prototype);vl(Ve,Ls);var Qr=jb("kCallback");function Ve(t){if(!(this instanceof Ve))return new Ve(t);let e=t?Vb(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Ls.call(this,t),this._readableState.sync=!1,this[Qr]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",Wb)}function Os(t){typeof this._flush=="function"&&!this.destroyed?this._flush((e,r)=>{if(e){t?t(e):this.destroy(e);return}r!=null&&this.push(r),this.push(null),t&&t()}):(this.push(null),t&&t())}function Wb(){this._final!==Os&&Os.call(this)}Ve.prototype._final=Os;Ve.prototype._transform=function(t,e,r){throw new $b("_transform()")};Ve.prototype._write=function(t,e,r){let n=this._readableState,i=this._writableState,o=n.length;this._transform(t,e,(s,a)=>{if(s){r(s);return}a!=null&&this.push(a),i.ended||o===n.length||n.length<n.highWaterMark?r():this[Qr]=r})};Ve.prototype._read=function(){if(this[Qr]){let t=this[Qr];this[Qr]=null,t()}}});var Ps=m((H_,Tl)=>{"use strict";var G_=c(f()),{ObjectSetPrototypeOf:Al}=C();Tl.exports=gr;var Ds=Cs();Al(gr.prototype,Ds.prototype);Al(gr,Ds);function gr(t){if(!(this instanceof gr))return new gr(t);Ds.call(this,t)}gr.prototype._transform=function(t,e,r){r(null,t)}});var li=m((J_,Ol)=>{var z_=c(f()),en=nt(),{ArrayIsArray:Hb,Promise:Gb,SymbolAsyncIterator:Jb,SymbolDispose:zb}=C(),fi=je(),{once:Yb}=H(),Xb=Lt(),Bl=Ie(),{aggregateTwoErrors:Zb,codes:{ERR_INVALID_ARG_TYPE:Vs,ERR_INVALID_RETURN_VALUE:Us,ERR_MISSING_ARGS:Qb,ERR_STREAM_DESTROYED:em,ERR_STREAM_PREMATURE_CLOSE:tm},AbortError:rm}=z(),{validateFunction:nm,validateAbortSignal:im}=ar(),{isIterable:Ut,isReadable:Ms,isReadableNodeStream:ci,isNodeStream:Il,isTransformStream:br,isWebStream:om,isReadableStream:Ns,isReadableFinished:sm}=Ae(),am=globalThis.AbortController||or().AbortController,Ks,Fs,qs;function kl(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=fi(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,Xb.destroyer(t,o||new em("pipe")))},cleanup:i}}function um(t){return nm(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function js(t){if(Ut(t))return t;if(ci(t))return cm(t);throw new Vs("val",["Readable","Iterable","AsyncIterable"],t)}async function*cm(t){Fs||(Fs=zr()),yield*Fs.prototype[Jb].call(t)}async function ui(t,e,r,{end:n}){let i,o=null,s=u=>{if(u&&(i=u),o){let d=o;o=null,d()}},a=()=>new Gb((u,d)=>{i?d(i):o=()=>{i?d(i):u()}});e.on("drain",s);let l=fi(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let u of t)e.write(u)||await a();n&&(e.end(),await a()),r()}catch(u){r(i!==u?Zb(i,u):u)}finally{l(),e.off("drain",s)}}async function $s(t,e,r,{end:n}){br(e)&&(e=e.writable);let i=e.getWriter();try{for await(let o of t)await i.ready,i.write(o).catch(()=>{});await i.ready,n&&await i.close(),r()}catch(o){try{await i.abort(o),r(o)}catch(s){r(s)}}}function fm(...t){return Rl(t,Yb(um(t)))}function Rl(t,e,r){if(t.length===1&&Hb(t[0])&&(t=t[0]),t.length<2)throw new Qb("streams");let n=new am,i=n.signal,o=r?.signal,s=[];im(o,"options.signal");function a(){b(new rm)}qs=qs||H().addAbortListener;let l;o&&(l=qs(o,a));let u,d,h=[],g=0;function y(k){b(k,--g===0)}function b(k,E){var I;if(k&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=k),!(!u&&!E)){for(;h.length;)h.shift()(u);(I=l)===null||I===void 0||I[zb](),n.abort(),E&&(u||s.forEach($=>$()),en.nextTick(e,u,d))}}let w;for(let k=0;k<t.length;k++){let E=t[k],I=k<t.length-1,$=k>0,L=I||r?.end!==!1,V=k===t.length-1;if(Il(E)){let N=function(Re){Re&&Re.name!=="AbortError"&&Re.code!=="ERR_STREAM_PREMATURE_CLOSE"&&y(Re)};var T=N;if(L){let{destroy:Re,cleanup:_i}=kl(E,I,$);h.push(Re),Ms(E)&&V&&s.push(_i)}E.on("error",N),Ms(E)&&V&&s.push(()=>{E.removeListener("error",N)})}if(k===0)if(typeof E=="function"){if(w=E({signal:i}),!Ut(w))throw new Us("Iterable, AsyncIterable or Stream","source",w)}else Ut(E)||ci(E)||br(E)?w=E:w=Bl.from(E);else if(typeof E=="function"){if(br(w)){var S;w=js((S=w)===null||S===void 0?void 0:S.readable)}else w=js(w);if(w=E(w,{signal:i}),I){if(!Ut(w,!0))throw new Us("AsyncIterable",`transform[${k-1}]`,w)}else{var x;Ks||(Ks=Ps());let N=new Ks({objectMode:!0}),Re=(x=w)===null||x===void 0?void 0:x.then;if(typeof Re=="function")g++,Re.call(w,He=>{d=He,He!=null&&N.write(He),L&&N.end(),en.nextTick(y)},He=>{N.destroy(He),en.nextTick(y,He)});else if(Ut(w,!0))g++,ui(w,N,y,{end:L});else if(Ns(w)||br(w)){let He=w.readable||w;g++,ui(He,N,y,{end:L})}else throw new Us("AsyncIterable or Promise","destination",w);w=N;let{destroy:_i,cleanup:yd}=kl(w,!1,!0);h.push(_i),V&&s.push(yd)}}else if(Il(E)){if(ci(w)){g+=2;let N=lm(w,E,y,{end:L});Ms(E)&&V&&s.push(N)}else if(br(w)||Ns(w)){let N=w.readable||w;g++,ui(N,E,y,{end:L})}else if(Ut(w))g++,ui(w,E,y,{end:L});else throw new Vs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else if(om(E)){if(ci(w))g++,$s(js(w),E,y,{end:L});else if(Ns(w)||Ut(w))g++,$s(w,E,y,{end:L});else if(br(w))g++,$s(w.readable,E,y,{end:L});else throw new Vs("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],w);w=E}else w=Bl.from(E)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&en.nextTick(a),w}function lm(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new tm)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;sm(t)?en.nextTick(s):t.once("end",s)}else r();return fi(t,{readable:!0,writable:!1},s=>{let a=t._readableState;s&&s.code==="ERR_STREAM_PREMATURE_CLOSE"&&a&&a.ended&&!a.errored&&!a.errorEmitted?t.once("end",r).once("error",r):r(s)}),fi(e,{readable:!1,writable:!0},r)}Ol.exports={pipelineImpl:Rl,pipeline:fm}});var Hs=m((Y_,Ml)=>{"use strict";var X_=c(f()),{pipeline:dm}=li(),di=Ie(),{destroyer:hm}=Lt(),{isNodeStream:hi,isReadable:Ll,isWritable:Cl,isWebStream:Ws,isTransformStream:Mt,isWritableStream:Dl,isReadableStream:Pl}=Ae(),{AbortError:pm,codes:{ERR_INVALID_ARG_VALUE:Ul,ERR_MISSING_ARGS:ym}}=z(),wm=je();Ml.exports=function(...e){if(e.length===0)throw new ym("streams");if(e.length===1)return di.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=di.from(e[0])),typeof e[e.length-1]=="function"){let y=e.length-1;e[y]=di.from(e[y])}for(let y=0;y<e.length;++y)if(!(!hi(e[y])&&!Ws(e[y]))){if(y<e.length-1&&!(Ll(e[y])||Pl(e[y])||Mt(e[y])))throw new Ul(`streams[${y}]`,r[y],"must be readable");if(y>0&&!(Cl(e[y])||Dl(e[y])||Mt(e[y])))throw new Ul(`streams[${y}]`,r[y],"must be writable")}let n,i,o,s,a;function l(y){let b=s;s=null,b?b(y):y?a.destroy(y):!g&&!h&&a.destroy()}let u=e[0],d=dm(e,l),h=!!(Cl(u)||Dl(u)||Mt(u)),g=!!(Ll(d)||Pl(d)||Mt(d));if(a=new di({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(d!=null&&d.readableObjectMode),writable:h,readable:g}),h){if(hi(u))a._write=function(b,w,S){u.write(b,w)?S():n=S},a._final=function(b){u.end(),i=b},u.on("drain",function(){if(n){let b=n;n=null,b()}});else if(Ws(u)){let w=(Mt(u)?u.writable:u).getWriter();a._write=async function(S,x,T){try{await w.ready,w.write(S).catch(()=>{}),T()}catch(k){T(k)}},a._final=async function(S){try{await w.ready,w.close().catch(()=>{}),i=S}catch(x){S(x)}}}let y=Mt(d)?d.readable:d;wm(y,()=>{if(i){let b=i;i=null,b()}})}if(g){if(hi(d))d.on("readable",function(){if(o){let y=o;o=null,y()}}),d.on("end",function(){a.push(null)}),a._read=function(){for(;;){let y=d.read();if(y===null){o=a._read;return}if(!a.push(y))return}};else if(Ws(d)){let b=(Mt(d)?d.readable:d).getReader();a._read=async function(){for(;;)try{let{value:w,done:S}=await b.read();if(!a.push(w))return;if(S){a.push(null);return}}catch{return}}}}return a._destroy=function(y,b){!y&&s!==null&&(y=new pm),o=null,n=null,i=null,s===null?b(y):(s=b,hi(d)&&hm(d,y))},a}});var Gl=m((Z_,zs)=>{"use strict";var Q_=c(f()),gm=globalThis.AbortController||or().AbortController,{codes:{ERR_INVALID_ARG_VALUE:bm,ERR_INVALID_ARG_TYPE:tn,ERR_MISSING_ARGS:mm,ERR_OUT_OF_RANGE:xm},AbortError:ke}=z(),{validateAbortSignal:Nt,validateInteger:Nl,validateObject:Kt}=ar(),Em=C().Symbol("kWeak"),_m=C().Symbol("kResistStopPropagation"),{finished:vm}=je(),Sm=Hs(),{addAbortSignalNoValidate:Am}=Wr(),{isWritable:Tm,isNodeStream:Bm}=Ae(),{deprecate:Im}=H(),{ArrayPrototypePush:km,Boolean:Rm,MathFloor:Kl,Number:Om,NumberIsNaN:Lm,Promise:Fl,PromiseReject:ql,PromiseResolve:Cm,PromisePrototypeThen:jl,Symbol:Vl}=C(),pi=Vl("kEmpty"),$l=Vl("kEof");function Dm(t,e){if(e!=null&&Kt(e,"options"),e?.signal!=null&&Nt(e.signal,"options.signal"),Bm(t)&&!Tm(t))throw new bm("stream",t,"must be writable");let r=Sm(this,t);return e!=null&&e.signal&&Am(e.signal,r),r}function yi(t,e){if(typeof t!="function")throw new tn("fn",["Function","AsyncFunction"],t);e!=null&&Kt(e,"options"),e?.signal!=null&&Nt(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Kl(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Kl(e.highWaterMark)),Nl(r,"options.concurrency",1),Nl(n,"options.highWaterMark",0),n+=r,(async function*(){let o=H().AbortSignalAny([e?.signal].filter(Rm)),s=this,a=[],l={signal:o},u,d,h=!1,g=0;function y(){h=!0,b()}function b(){g-=1,w()}function w(){d&&!h&&g<r&&a.length<n&&(d(),d=null)}async function S(){try{for await(let x of s){if(h)return;if(o.aborted)throw new ke;try{if(x=t(x,l),x===pi)continue;x=Cm(x)}catch(T){x=ql(T)}g+=1,jl(x,b,y),a.push(x),u&&(u(),u=null),!h&&(a.length>=n||g>=r)&&await new Fl(T=>{d=T})}a.push($l)}catch(x){let T=ql(x);jl(T,b,y),a.push(T)}finally{h=!0,u&&(u(),u=null)}}S();try{for(;;){for(;a.length>0;){let x=await a[0];if(x===$l)return;if(o.aborted)throw new ke;x!==pi&&(yield x),a.shift(),w()}await new Fl(x=>{u=x})}}finally{h=!0,d&&(d(),d=null)}}).call(this)}function Pm(t=void 0){return t!=null&&Kt(t,"options"),t?.signal!=null&&Nt(t.signal,"options.signal"),(async function*(){let r=0;for await(let i of this){var n;if(t!=null&&(n=t.signal)!==null&&n!==void 0&&n.aborted)throw new ke({cause:t.signal.reason});yield[r++,i]}}).call(this)}async function Wl(t,e=void 0){for await(let r of Js.call(this,t,e))return!0;return!1}async function Um(t,e=void 0){if(typeof t!="function")throw new tn("fn",["Function","AsyncFunction"],t);return!await Wl.call(this,async(...r)=>!await t(...r),e)}async function Mm(t,e){for await(let r of Js.call(this,t,e))return r}async function Nm(t,e){if(typeof t!="function")throw new tn("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),pi}for await(let n of yi.call(this,r,e));}function Js(t,e){if(typeof t!="function")throw new tn("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:pi}return yi.call(this,r,e)}var Gs=class extends mm{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function Km(t,e,r){var n;if(typeof t!="function")throw new tn("reducer",["Function","AsyncFunction"],t);r!=null&&Kt(r,"options"),r?.signal!=null&&Nt(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let u=new ke(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await vm(this.destroy(u)),u}let o=new gm,s=o.signal;if(r!=null&&r.signal){let u={once:!0,[Em]:this,[_m]:!0};r.signal.addEventListener("abort",()=>o.abort(),u)}let a=!1;try{for await(let u of this){var l;if(a=!0,r!=null&&(l=r.signal)!==null&&l!==void 0&&l.aborted)throw new ke;i?e=await t(e,u,{signal:s}):(e=u,i=!0)}if(!a&&!i)throw new Gs}finally{o.abort()}return e}async function Fm(t){t!=null&&Kt(t,"options"),t?.signal!=null&&Nt(t.signal,"options.signal");let e=[];for await(let n of this){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new ke(void 0,{cause:t.signal.reason});km(e,n)}return e}function qm(t,e){let r=yi.call(this,t,e);return(async function*(){for await(let i of r)yield*i}).call(this)}function Hl(t){if(t=Om(t),Lm(t))return 0;if(t<0)throw new xm("number",">= 0",t);return t}function jm(t,e=void 0){return e!=null&&Kt(e,"options"),e?.signal!=null&&Nt(e.signal,"options.signal"),t=Hl(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ke;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ke;t--<=0&&(yield o)}}).call(this)}function $m(t,e=void 0){return e!=null&&Kt(e,"options"),e?.signal!=null&&Nt(e.signal,"options.signal"),t=Hl(t),(async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new ke;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new ke;if(t-- >0&&(yield o),t<=0)return}}).call(this)}zs.exports.streamReturningOperators={asIndexedPairs:Im(Pm,"readable.asIndexedPairs will be removed in a future version."),drop:jm,filter:Js,flatMap:qm,map:yi,take:$m,compose:Dm};zs.exports.promiseReturningOperators={every:Um,forEach:Nm,reduce:Km,toArray:Fm,some:Wl,find:Mm}});var Ys=m((ev,Jl)=>{"use strict";var tv=c(f()),{ArrayPrototypePop:Vm,Promise:Wm}=C(),{isIterable:Hm,isNodeStream:Gm,isWebStream:Jm}=Ae(),{pipelineImpl:zm}=li(),{finished:Ym}=je();Xs();function Xm(...t){return new Wm((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!Gm(o)&&!Hm(o)&&!Jm(o)){let s=Vm(t);n=s.signal,i=s.end}zm(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}Jl.exports={finished:Ym,pipeline:Xm}});var Xs=m((rv,nd)=>{var nv=c(f()),{Buffer:Zm}=X(),{ObjectDefineProperty:We,ObjectKeys:Xl,ReflectApply:Zl}=C(),{promisify:{custom:Ql}}=H(),{streamReturningOperators:zl,promiseReturningOperators:Yl}=Gl(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:ed}}=z(),Qm=Hs(),{setDefaultHighWaterMark:e0,getDefaultHighWaterMark:t0}=Hr(),{pipeline:td}=li(),{destroyer:r0}=Lt(),rd=je(),Zs=Ys(),rn=Ae(),O=nd.exports=Jn().Stream;O.isDestroyed=rn.isDestroyed;O.isDisturbed=rn.isDisturbed;O.isErrored=rn.isErrored;O.isReadable=rn.isReadable;O.isWritable=rn.isWritable;O.Readable=zr();for(let t of Xl(zl)){let r=function(...n){if(new.target)throw ed();return O.Readable.from(Zl(e,this,n))};Qs=r;let e=zl[t];We(r,"name",{__proto__:null,value:e.name}),We(r,"length",{__proto__:null,value:e.length}),We(O.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Qs;for(let t of Xl(Yl)){let r=function(...i){if(new.target)throw ed();return Zl(e,this,i)};Qs=r;let e=Yl[t];We(r,"name",{__proto__:null,value:e.name}),We(r,"length",{__proto__:null,value:e.length}),We(O.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}var Qs;O.Writable=ai();O.Duplex=Ie();O.Transform=Cs();O.PassThrough=Ps();O.pipeline=td;var{addAbortSignal:n0}=Wr();O.addAbortSignal=n0;O.finished=rd;O.destroy=r0;O.compose=Qm;O.setDefaultHighWaterMark=e0;O.getDefaultHighWaterMark=t0;We(O,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return Zs}});We(td,Ql,{__proto__:null,enumerable:!0,get(){return Zs.pipeline}});We(rd,Ql,{__proto__:null,enumerable:!0,get(){return Zs.finished}});O.Stream=O;O._isUint8Array=function(e){return e instanceof Uint8Array};O._uint8ArrayToBuffer=function(e){return Zm.from(e.buffer,e.byteOffset,e.byteLength)}});var ea=m((iv,M)=>{"use strict";var ov=c(f()),F=Xs(),i0=Ys(),o0=F.Readable.destroy;M.exports=F.Readable;M.exports._uint8ArrayToBuffer=F._uint8ArrayToBuffer;M.exports._isUint8Array=F._isUint8Array;M.exports.isDisturbed=F.isDisturbed;M.exports.isErrored=F.isErrored;M.exports.isReadable=F.isReadable;M.exports.Readable=F.Readable;M.exports.Writable=F.Writable;M.exports.Duplex=F.Duplex;M.exports.Transform=F.Transform;M.exports.PassThrough=F.PassThrough;M.exports.addAbortSignal=F.addAbortSignal;M.exports.finished=F.finished;M.exports.destroy=F.destroy;M.exports.destroy=o0;M.exports.pipeline=F.pipeline;M.exports.compose=F.compose;Object.defineProperty(F,"promises",{configurable:!0,enumerable:!0,get(){return i0}});M.exports.Stream=F.Stream;M.exports.default=M.exports});var wT=c(f(),1);var dv=c(f(),1);var I0=c(f(),1),ih=c(Ra(),1);var fx=c(f(),1);var H0=c(f(),1);var U0=c(f(),1);var R0=c(f(),1),k0=new Uint8Array(0);function Oa(t,e){if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(let r=0;r<t.byteLength;r++)if(t[r]!==e[r])return!1;return!0}function Vt(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")}var L0=c(f(),1);function sh(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<t.length;i++){var o=t.charAt(i),s=o.charCodeAt(0);if(r[s]!==255)throw new TypeError(o+" is ambiguous");r[s]=i}var a=t.length,l=t.charAt(0),u=Math.log(a)/Math.log(256),d=Math.log(256)/Math.log(a);function h(b){if(b instanceof Uint8Array||(ArrayBuffer.isView(b)?b=new Uint8Array(b.buffer,b.byteOffset,b.byteLength):Array.isArray(b)&&(b=Uint8Array.from(b))),!(b instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(b.length===0)return"";for(var w=0,S=0,x=0,T=b.length;x!==T&&b[x]===0;)x++,w++;for(var k=(T-x)*d+1>>>0,E=new Uint8Array(k);x!==T;){for(var I=b[x],$=0,L=k-1;(I!==0||$<S)&&L!==-1;L--,$++)I+=256*E[L]>>>0,E[L]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");S=$,x++}for(var V=k-S;V!==k&&E[V]===0;)V++;for(var N=l.repeat(w);V<k;++V)N+=t.charAt(E[V]);return N}function g(b){if(typeof b!="string")throw new TypeError("Expected String");if(b.length===0)return new Uint8Array;var w=0;if(b[w]!==" "){for(var S=0,x=0;b[w]===l;)S++,w++;for(var T=(b.length-w)*u+1>>>0,k=new Uint8Array(T);b[w];){var E=r[b.charCodeAt(w)];if(E===255)return;for(var I=0,$=T-1;(E!==0||I<x)&&$!==-1;$--,I++)E+=a*k[$]>>>0,k[$]=E%256>>>0,E=E/256>>>0;if(E!==0)throw new Error("Non-zero carry");x=I,w++}if(b[w]!==" "){for(var L=T-x;L!==T&&k[L]===0;)L++;for(var V=new Uint8Array(S+(T-L)),N=S;L!==T;)V[N++]=k[L++];return V}}}function y(b){var w=g(b);if(w)return w;throw new Error(`Non-${e} character`)}return{encode:h,decodeUnsafe:g,decode:y}}var ah=sh,uh=ah,La=uh;var Ui=class{name;prefix;baseEncode;constructor(e,r,n){this.name=e,this.prefix=r,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Mi=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){if(this.name=e,this.prefix=r,r.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=r.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return Ca(this,e)}},Ni=class{decoders;constructor(e){this.decoders=e}or(e){return Ca(this,e)}decode(e){let r=e[0],n=this.decoders[r];if(n!=null)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function Ca(t,e){return new Ni({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Ki=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,r,n,i){this.name=e,this.prefix=r,this.baseEncode=n,this.baseDecode=i,this.encoder=new Ui(e,r,n),this.decoder=new Mi(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Da({name:t,prefix:e,encode:r,decode:n}){return new Ki(t,e,r,n)}function Fi({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=La(r,t);return Da({prefix:e,name:t,encode:n,decode:o=>Vt(i(o))})}function ch(t,e,r,n){let i={};for(let d=0;d<e.length;++d)i[e[d]]=d;let o=t.length;for(;t[o-1]==="=";)--o;let s=new Uint8Array(o*r/8|0),a=0,l=0,u=0;for(let d=0;d<o;++d){let h=i[t[d]];if(h===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<r|h,a+=r,a>=8&&(a-=8,s[u++]=255&l>>a)}if(a>=r||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return s}function fh(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let l=0;l<t.length;++l)for(a=a<<8|t[l],s+=8;s>r;)s-=r,o+=e[i&a>>s];if(s!==0&&(o+=e[i&a<<r-s]),n)for(;o.length*r&7;)o+="=";return o}function J({name:t,prefix:e,bitsPerChar:r,alphabet:n}){return Da({prefix:e,name:t,encode(i){return fh(i,n,r)},decode(i){return ch(i,n,r,t)}})}var xr=J({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),N0=J({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),K0=J({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),F0=J({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),q0=J({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),j0=J({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),$0=J({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),V0=J({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),qi=J({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Y0=c(f(),1);var Z=Fi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),J0=Fi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var rx=c(f(),1);var Z0=J({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Q0=J({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),be=J({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ex=J({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ix=c(f(),1);function Pa(t){return t.byteOffset!==0||t.byteLength!==t.buffer.byteLength}function Ua(t){return typeof t!="object"||t===null?!1:typeof t[Symbol.asyncIterator]=="function"}function cn(t){let r=Object.prototype.toString.call(t).match(/\s([a-zA-Z0-9]+)/),[n,i]=r;return i}var Er=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{u(n.next(d))}catch(h){s(h)}}function l(d){try{u(n.throw(d))}catch(h){s(h)}}function u(d){d.done?o(d.value):i(d.value).then(a,l)}u((n=n.apply(t,e||[])).next())})},Ma=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(o){r[o]=t[o]&&function(s){return new Promise(function(a,l){s=t[o](s),i(a,l,s.done,s.value)})}}function i(o,s,a,l){Promise.resolve(l).then(function(u){o({value:u,done:a})},s)}},fn=new TextEncoder,lt=new TextDecoder,P=class t{constructor(e,r){this.data=e,this.format=r}static arrayBuffer(e){return new t(e,"ArrayBuffer")}static asyncIterable(e){if(!Ua(e))throw new TypeError("Input must be of type AsyncIterable.");return new t(e,"AsyncIterable")}static base32Z(e){return new t(e,"Base32Z")}static base58Btc(e){return new t(e,"Base58Btc")}static base64Url(e){return new t(e,"Base64Url")}static bufferSource(e){return new t(e,"BufferSource")}static hex(e){if(typeof e!="string")throw new TypeError("Hex input must be a string.");if(e.length%2!==0)throw new TypeError("Hex input must have an even number of characters.");return new t(e,"Hex")}static multibase(e){return new t(e,"Multibase")}static object(e){return new t(e,"Object")}static string(e){return new t(e,"String")}static uint8Array(e){return new t(e,"Uint8Array")}toArrayBuffer(){switch(this.format){case"Base58Btc":return Z.baseDecode(this.data).buffer;case"Base64Url":return be.baseDecode(this.data).buffer;case"BufferSource":{if(cn(this.data)==="ArrayBuffer")return this.data;if(ArrayBuffer.isView(this.data))return Pa(this.data)?this.data.buffer.slice(this.data.byteOffset,this.data.byteOffset+this.data.byteLength):this.data.buffer;throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":return this.toUint8Array().buffer;case"String":return this.toUint8Array().buffer;case"Uint8Array":return this.data.buffer;default:throw new TypeError(`Conversion from ${this.format} to ArrayBuffer is not supported.`)}}toArrayBufferAsync(){return Er(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":return yield(yield this.toBlobAsync()).arrayBuffer();default:throw new TypeError(`Asynchronous conversion from ${this.format} to ArrayBuffer is not supported.`)}})}toBase32Z(){switch(this.format){case"Uint8Array":return qi.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Z is not supported.`)}}toBase58Btc(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return Z.baseEncode(e)}case"Multibase":return this.data.substring(1);case"Uint8Array":return Z.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base58Btc is not supported.`)}}toBase64Url(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return be.baseEncode(e)}case"BufferSource":{let e=this.toUint8Array();return be.baseEncode(e)}case"Object":{let e=JSON.stringify(this.data),r=fn.encode(e);return be.baseEncode(r)}case"String":{let e=fn.encode(this.data);return be.baseEncode(e)}case"Uint8Array":return be.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Url is not supported.`)}}toBlobAsync(){return Er(this,void 0,void 0,function*(){var e,r,n,i;switch(this.format){case"AsyncIterable":{let l=[];try{for(var o=!0,s=Ma(this.data),a;a=yield s.next(),e=a.done,!e;o=!0){i=a.value,o=!1;let d=i;l.push(d)}}catch(d){r={error:d}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return new Blob(l)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Blob is not supported.`)}})}toHex(){let e=Array.from({length:256},(r,n)=>n.toString(16).padStart(2,"0"));switch(this.format){case"ArrayBuffer":{let r=this.toUint8Array();return t.uint8Array(r).toHex()}case"Base64Url":{let r=this.toUint8Array();return t.uint8Array(r).toHex()}case"Uint8Array":{let r="";for(let n=0;n<this.data.length;n++)r+=e[this.data[n]];return r}default:throw new TypeError(`Conversion from ${this.format} to Hex is not supported.`)}}toMultibase(){switch(this.format){case"Base58Btc":return`z${this.data}`;default:throw new TypeError(`Conversion from ${this.format} to Multibase is not supported.`)}}toObject(){switch(this.format){case"Base64Url":{let e=be.baseDecode(this.data),r=lt.decode(e);return JSON.parse(r)}case"String":return JSON.parse(this.data);case"Uint8Array":{let e=lt.decode(this.data);return JSON.parse(e)}default:throw new TypeError(`Conversion from ${this.format} to Object is not supported.`)}}toObjectAsync(){return Er(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toStringAsync();return JSON.parse(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Object is not supported.`)}})}toString(){switch(this.format){case"ArrayBuffer":return lt.decode(this.data);case"Base64Url":{let e=be.baseDecode(this.data);return lt.decode(e)}case"Object":return JSON.stringify(this.data);case"Uint8Array":return lt.decode(this.data);default:throw new TypeError(`Conversion from ${this.format} to String is not supported.`)}}toStringAsync(){return Er(this,void 0,void 0,function*(){var e,r,n,i;switch(this.format){case"AsyncIterable":{let l="";try{for(var o=!0,s=Ma(this.data),a;a=yield s.next(),e=a.done,!e;o=!0){i=a.value,o=!1;let u=i;typeof u=="string"?l+=u:l+=lt.decode(u,{stream:!0})}}catch(u){r={error:u}}finally{try{!o&&!e&&(n=s.return)&&(yield n.call(s))}finally{if(r)throw r.error}}return l+=lt.decode(void 0,{stream:!1}),l}default:throw new TypeError(`Asynchronous conversion from ${this.format} to String is not supported.`)}})}toUint8Array(){switch(this.format){case"ArrayBuffer":return new Uint8Array(this.data);case"Base32Z":return qi.baseDecode(this.data);case"Base58Btc":return Z.baseDecode(this.data);case"Base64Url":return be.baseDecode(this.data);case"BufferSource":{let e=cn(this.data);if(e==="Uint8Array")return this.data;if(e==="ArrayBuffer")return new Uint8Array(this.data);if(ArrayBuffer.isView(this.data))return new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength);throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":{let e=new Uint8Array(this.data.length/2);for(let r=0;r<this.data.length;r+=2){let n=parseInt(this.data.substring(r,r+2),16);if(isNaN(n))throw new TypeError("Input is not a valid hexadecimal string.");e[r/2]=n}return e}case"Object":{let e=JSON.stringify(this.data);return fn.encode(e)}case"String":return fn.encode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Uint8Array is not supported.`)}}toUint8ArrayAsync(){return Er(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toArrayBufferAsync();return new Uint8Array(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Uint8Array is not supported.`)}})}};var dx=c(f(),1),_r;(function(t){t.Debug="debug",t.Silent="silent"})(_r||(_r={}));var ji=class{constructor(){this.logLevel=_r.Silent}setLogLevel(e){this.logLevel=e}log(e){this.info(e)}info(e){this.logLevel!==_r.Silent&&console.info(e)}error(e){this.logLevel!==_r.Silent&&console.error(e)}},lh=new ji;typeof window<"u"&&(window.web5logger=lh);var $x=c(f(),1);var Kx=c(f(),1);var Sx=c(f(),1);var bx=c(f(),1);var Le={};Ed(Le,{decode:()=>Wt,encodeTo:()=>dt,encodingLength:()=>ht});var wx=c(f(),1);var px=c(f(),1),dh=Fa,Na=128,hh=127,ph=~hh,yh=Math.pow(2,31);function Fa(t,e,r){e=e||[],r=r||0;for(var n=r;t>=yh;)e[r++]=t&255|Na,t/=128;for(;t&ph;)e[r++]=t&255|Na,t>>>=7;return e[r]=t|0,Fa.bytes=r-n+1,e}var wh=$i,gh=128,Ka=127;function $i(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw $i.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Ka)<<i:(s&Ka)*Math.pow(2,i),i+=7}while(s>=gh);return $i.bytes=o-n,r}var bh=Math.pow(2,7),mh=Math.pow(2,14),xh=Math.pow(2,21),Eh=Math.pow(2,28),_h=Math.pow(2,35),vh=Math.pow(2,42),Sh=Math.pow(2,49),Ah=Math.pow(2,56),Th=Math.pow(2,63),Bh=function(t){return t<bh?1:t<mh?2:t<xh?3:t<Eh?4:t<_h?5:t<vh?6:t<Sh?7:t<Ah?8:t<Th?9:10},Ih={encode:dh,decode:wh,encodingLength:Bh},kh=Ih,vr=kh;function Wt(t,e=0){return[vr.decode(t,e),vr.decode.bytes]}function dt(t,e,r=0){return vr.encode(t,e,r),e}function ht(t){return vr.encodingLength(t)}function Vi(t,e){let r=e.byteLength,n=ht(t),i=n+ht(r),o=new Uint8Array(i+r);return dt(t,o,0),dt(r,o,n),o.set(e,i),new Ht(t,r,e,o)}function qa(t){let e=Vt(t),[r,n]=Wt(e),[i,o]=Wt(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ht(r,i,s,e)}function ja(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Oa(t.bytes,r.bytes)}}var Ht=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var mx=c(f(),1);function $a(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Oh(r,Hi(t),e??Z.encoder);default:return Lh(r,Hi(t),e??xr.encoder)}}var Va=new WeakMap;function Hi(t){let e=Va.get(t);if(e==null){let r=new Map;return Va.set(t,r),r}return e}var Gi=class t{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:r}=this;if(e!==Sr)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Ch)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return t.createV0(r)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:r}=this.multihash,n=Vi(e,r);return t.createV1(this.code,n)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return t.equals(this,e)}static equals(e,r){let n=r;return n!=null&&e.code===n.code&&e.version===n.version&&ja(e.multihash,n.multihash)}toString(e){return $a(this,e)}toJSON(){return{"/":$a(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let r=e;if(r instanceof t)return r;if(r["/"]!=null&&r["/"]===r.bytes||r.asCID===r){let{version:n,code:i,multihash:o,bytes:s}=r;return new t(n,i,o,s??Wa(n,i,o.bytes))}else if(r[Dh]===!0){let{version:n,multihash:i,code:o}=r,s=qa(i);return t.create(n,o,s)}else return null}static create(e,r,n){if(typeof r!="number")throw new Error("String codecs are no longer supported");if(!(n.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(r!==Sr)throw new Error(`Version 0 CID must use dag-pb (code: ${Sr}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Wa(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Sr,e)}static createV1(e,r){return t.create(1,e,r)}static decode(e){let[r,n]=t.decodeFirst(e);if(n.length!==0)throw new Error("Incorrect length");return r}static decodeFirst(e){let r=t.inspectBytes(e),n=r.size-r.multihashSize,i=Vt(e.subarray(n,n+r.multihashSize));if(i.byteLength!==r.multihashSize)throw new Error("Incorrect length");let o=i.subarray(r.multihashSize-r.digestSize),s=new Ht(r.multihashCode,r.digestSize,o,i);return[r.version===0?t.createV0(s):t.createV1(r.codec,s),e.subarray(r.size)]}static inspectBytes(e){let r=0,n=()=>{let[h,g]=Wt(e.subarray(r));return r+=g,h},i=n(),o=Sr;if(i===18?(i=0,r=0):o=n(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=r,a=n(),l=n(),u=r+l,d=u-s;return{version:i,codec:o,multihashCode:a,digestSize:l,multihashSize:d,size:u}}static parse(e,r){let[n,i]=Rh(e,r),o=t.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Hi(o).set(n,e),o}};function Rh(t,e){switch(t[0]){case"Q":{let r=e??Z;return[Z.prefix,r.decode(`${Z.prefix}${t}`)]}case Z.prefix:{let r=e??Z;return[Z.prefix,r.decode(t)]}case xr.prefix:{let r=e??xr;return[xr.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Oh(t,e,r){let{prefix:n}=r;if(n!==Z.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=e.get(n);if(i==null){let o=r.encode(t).slice(1);return e.set(n,o),o}else return i}function Lh(t,e,r){let{prefix:n}=r,i=e.get(n);if(i==null){let o=r.encode(t);return e.set(n,o),o}else return i}var Sr=112,Ch=18;function Wa(t,e,r){let n=ht(t),i=n+ht(e),o=new Uint8Array(i+r.byteLength);return dt(t,o,0),dt(e,o,n),o.set(r,i),o}var Dh=Symbol.for("@ipld/js-cid/CID");var Tx=c(f(),1);var Ox=c(f(),1);var Bx=c(f(),1);var Ix=c(f(),1);var kx=c(f(),1);var Rx=c(f(),1);var ee=class t{static addPrefix(e){var r;let{code:n,data:i,name:o}=e;if(!(o?!n:n))throw new Error("Either 'name' or 'code' must be defined, but not both.");if(n=t.codeToName.has(n)?n:t.nameToCode.get(o),n===void 0)throw new Error(`Unsupported multicodec: ${(r=e.name)!==null&&r!==void 0?r:e.code}`);let s=Le.encodingLength(n),a=new Uint8Array(s+i.byteLength);return a.set(i,s),Le.encodeTo(n,a),a}static getCodeFromData(e){let{prefixedData:r}=e,[n,i]=Le.decode(r);return n}static getCodeFromName(e){let{name:r}=e,n=t.nameToCode.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static getNameFromCode(e){let{code:r}=e,n=t.codeToName.get(r);if(n===void 0)throw new Error(`Unsupported multicodec: ${r}`);return n}static registerCodec(e){t.codeToName.set(e.code,e.name),t.nameToCode.set(e.name,e.code)}static removePrefix(e){let{prefixedData:r}=e,[n,i]=Le.decode(r),o=t.codeToName.get(n);if(o===void 0)throw new Error(`Unsupported multicodec: ${n}`);return{code:n,data:r.slice(i),name:o}}};ee.codeToName=new Map;ee.nameToCode=new Map;ee.registerCodec({code:237,name:"ed25519-pub"});ee.registerCodec({code:4864,name:"ed25519-priv"});ee.registerCodec({code:236,name:"x25519-pub"});ee.registerCodec({code:4866,name:"x25519-priv"});ee.registerCodec({code:231,name:"secp256k1-pub"});ee.registerCodec({code:4865,name:"secp256k1-priv"});var Wx=c(f(),1);function Ji(t){Object.keys(t).forEach(e=>{t[e]===void 0?delete t[e]:typeof t[e]=="object"&&Ji(t[e])})}var e_=c(f(),1),qp=c(ic(),1);var n_=c(f(),1);var fv=c(f(),1),s0=c(ea(),1);var a0=c(ea(),1);var AA=c(f(),1);var MS=c(f(),1);var Wv=c(f(),1);var Kv=c(f(),1);var Uv=c(f(),1);var Lv=c(f(),1);var vv=c(f(),1);function u0(t){return t instanceof Uint8Array||t!=null&&typeof t=="object"&&t.constructor.name==="Uint8Array"}function ta(t,...e){if(!u0(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${t.length}`)}function ra(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function id(t,e){ta(t);let r=e.outputLen;if(t.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}var Iv=c(f(),1);var gi=t=>new DataView(t.buffer,t.byteOffset,t.byteLength),ye=(t,e)=>t<<32-e|t>>>e;var Av=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function c0(t){if(typeof t!="string")throw new Error(`utf8ToBytes expected string, got ${typeof t}`);return new Uint8Array(new TextEncoder().encode(t))}function na(t){return typeof t=="string"&&(t=c0(t)),ta(t),t}var wi=class{clone(){return this._cloneInto()}},Tv={}.toString;function od(t){let e=n=>t().update(na(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function f0(t,e,r,n){if(typeof t.setBigUint64=="function")return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),a=Number(r&o),l=n?4:0,u=n?0:4;t.setUint32(e+l,s,n),t.setUint32(e+u,a,n)}var sd=(t,e,r)=>t&e^~t&r,ad=(t,e,r)=>t&e^t&r^e&r,bi=class extends wi{constructor(e,r,n,i){super(),this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=gi(this.buffer)}update(e){ra(this);let{view:r,buffer:n,blockLen:i}=this;e=na(e);let o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let l=gi(e);for(;i<=o-s;s+=i)this.process(l,s);continue}n.set(e.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(r,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){ra(this),id(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(n,0),s=0);for(let h=s;h<i;h++)r[h]=0;f0(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=gi(e),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let u=l/4,d=this.get();if(u>d.length)throw new Error("_sha2: outputLen bigger than state");for(let h=0;h<u;h++)a.setUint32(4*h,d[h],o)}digest(){let{buffer:e,outputLen:r}=this;this.digestInto(e);let n=e.slice(0,r);return this.destroy(),n}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:r,buffer:n,length:i,finished:o,destroyed:s,pos:a}=this;return e.length=i,e.pos=a,e.finished=o,e.destroyed=s,i%r&&e.buffer.set(n),e}};var l0=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),at=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ut=new Uint32Array(64),ia=class extends bi{constructor(){super(64,32,8,!1),this.A=at[0]|0,this.B=at[1]|0,this.C=at[2]|0,this.D=at[3]|0,this.E=at[4]|0,this.F=at[5]|0,this.G=at[6]|0,this.H=at[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:l}=this;return[e,r,n,i,o,s,a,l]}set(e,r,n,i,o,s,a,l){this.A=e|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=l|0}process(e,r){for(let h=0;h<16;h++,r+=4)ut[h]=e.getUint32(r,!1);for(let h=16;h<64;h++){let g=ut[h-15],y=ut[h-2],b=ye(g,7)^ye(g,18)^g>>>3,w=ye(y,17)^ye(y,19)^y>>>10;ut[h]=w+ut[h-7]+b+ut[h-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:l,G:u,H:d}=this;for(let h=0;h<64;h++){let g=ye(a,6)^ye(a,11)^ye(a,25),y=d+g+sd(a,l,u)+l0[h]+ut[h]|0,w=(ye(n,2)^ye(n,13)^ye(n,22))+ad(n,i,o)|0;d=u,u=l,l=a,a=s+y|0,s=o,o=i,i=n,n=y+w|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,d=d+this.H|0,this.set(n,i,o,s,a,l,u,d)}roundClean(){ut.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ud=od(()=>new ia);var d0=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{u(n.next(d))}catch(h){s(h)}}function l(d){try{u(n.throw(d))}catch(h){s(h)}}function u(d){d.done?o(d.value):i(d.value).then(a,l)}u((n=n.apply(t,e||[])).next())})},nn=class{static digest(e){return d0(this,arguments,void 0,function*({data:r}){return ud(r)})}};var qv=c(f(),1);var pS=c(f(),1);var rS=c(f(),1);var Zv=c(f(),1);var Gv=c(f(),1);function cd(t){let e=n=>{if(n!==null&&typeof n=="object"&&!Array.isArray(n)){let i=Object.keys(n).sort(),o={};for(let s of i)o[s]=e(n[s]);return o}return n},r=e(t);return JSON.stringify(r)}var h0=function(t,e,r,n){function i(o){return o instanceof r?o:new r(function(s){s(o)})}return new(r||(r=Promise))(function(o,s){function a(d){try{u(n.next(d))}catch(h){s(h)}}function l(d){try{u(n.throw(d))}catch(h){s(h)}}function u(d){d.done?o(d.value):i(d.value).then(a,l)}u((n=n.apply(t,e||[])).next())})};function ce(t){return h0(this,arguments,void 0,function*({jwk:e}){let r=e.kty,n;if(r==="EC")n={crv:e.crv,kty:e.kty,x:e.x,y:e.y};else if(r==="oct")n={k:e.k,kty:e.kty};else if(r==="OKP")n={crv:e.crv,kty:e.kty,x:e.x};else if(r==="RSA")n={e:e.e,kty:e.kty,n:e.n};else throw new Error(`Unsupported key type: ${r}`);Ji(n);let i=cd(n),o=P.string(i).toUint8Array(),s=yield nn.digest({data:o});return P.uint8Array(s).toBase64Url()})}var sS=c(f(),1);var SS=c(f(),1);var bS=c(f(),1);var KS=c(f(),1);var JS=c(f(),1);var $S=c(f(),1);var nA=c(f(),1);var ZS=c(f(),1);var iA=c(f(),1);var oA=c(f(),1);var sA=c(f(),1);var cA=c(f(),1);var lA=c(f(),1);var yA=c(f(),1);var mA=c(f(),1);var vA=c(f(),1);var XA=c(f(),1),xi=class t extends Error{constructor(r,n){super(`${r}: ${n}`);this.code=r;this.name="DidError",Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,t)}};var QA=c(f(),1),Ei=(o=>(o.authentication="authentication",o.assertionMethod="assertionMethod",o.keyAgreement="keyAgreement",o.capabilityInvocation="capabilityInvocation",o.capabilityDelegation="capabilityDelegation",o))(Ei||{});function sa(t){if(typeof t=="string"&&t.length!==0)return t.split("#").pop()}function uT({didDocument:t,id:e,type:r}){return t?.service?.filter(n=>!(e&&n.id!==e||r&&n.type!==r))??[]}async function cT({didDocument:t,publicKeyJwk:e,publicKeyMultibase:r}){let n=pd({didDocument:t});for(let i of n)if(e&&i.publicKeyJwk){if(await ce({jwk:e})===await ce({jwk:i.publicKeyJwk}))return i}else if(r&&i.publicKeyMultibase&&r===i.publicKeyMultibase)return i;return null}function pd({didDocument:t}){if(!t)throw new TypeError("Required parameter missing: 'didDocument'");let e=[];return e.push(...t.verificationMethod?.filter(aa)??[]),Object.keys(Ei).forEach(r=>{e.push(...t[r]?.filter(aa)??[])}),e}function fT({didDocument:t}){let r=pd({didDocument:t}).map(n=>n.type);return[...new Set(r)]}function lT({didDocument:t,methodId:e}){let r=[];return Object.keys(Ei).forEach(n=>{if(Array.isArray(t[n])){let i=t[n],o=sa(e);i.some(a=>{let l=sa(a)===o,u=aa(a)&&sa(a.id)===o;return l||u})&&r.push(n)}}),r}function p0(t){return!t||typeof t!="object"||t===null?!1:"id"in t&&"type"in t&&"serviceEndpoint"in t}function dT(t){if(!p0(t)||t.type!=="DecentralizedWebNode"||!("enc"in t&&"sig"in t))return!1;let e=r=>typeof r=="string"||Array.isArray(r)&&r.every(n=>typeof n=="string");return e(t.enc)&&e(t.sig)}function aa(t){return!(!t||typeof t!="object"||t===null||!("id"in t&&"type"in t&&"controller"in t)||typeof t.id!="string"||typeof t.type!="string"||typeof t.controller!="string")}function hT({keyBytes:t,multicodecCode:e,multicodecName:r}){let n=ee.addPrefix({code:e,data:t,name:r}),i=P.uint8Array(n).toBase58Btc();return P.base58Btc(i).toMultibase()}function pT({multibaseKeyId:t}){try{let e=P.multibase(t).toBase58Btc(),r=P.base58Btc(e).toUint8Array(),{code:n,data:i,name:o}=ee.removePrefix({prefixedData:r});return{keyBytes:i,multicodecCode:n,multicodecName:o}}catch{throw new xi("invalidDid",`Invalid multibase identifier: ${t}`)}}export{sa as extractDidFragment,uT as getServices,cT as getVerificationMethodByKey,fT as getVerificationMethodTypes,pd as getVerificationMethods,lT as getVerificationRelationshipsById,p0 as isDidService,aa as isDidVerificationMethod,dT as isDwnDidService,hT as keyBytesToMultibaseId,pT as multibaseIdToKeyBytes};
1
+ var ns=Object.create;var Er=Object.defineProperty;var is=Object.getOwnPropertyDescriptor;var os=Object.getOwnPropertyNames;var ss=Object.getPrototypeOf,cs=Object.prototype.hasOwnProperty;var v=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),us=(n,e)=>{for(var t in e)Er(n,t,{get:e[t],enumerable:!0})},as=(n,e,t,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of os(e))!cs.call(n,i)&&i!==t&&Er(n,i,{get:()=>e[i],enumerable:!(r=is(e,i))||r.enumerable});return n};var u=(n,e,t)=>(t=n!=null?ns(ss(n)):{},as(e||!n||!n.__esModule?Er(t,"default",{value:n,enumerable:!0}):t,n));var zn=v(Dt=>{"use strict";var Ru=u(a());Dt.byteLength=hs;Dt.toByteArray=ls;Dt.fromByteArray=ms;var z=[],M=[],fs=typeof Uint8Array<"u"?Uint8Array:Array,Tr="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(_e=0,Wn=Tr.length;_e<Wn;++_e)z[_e]=Tr[_e],M[Tr.charCodeAt(_e)]=_e;var _e,Wn;M[45]=62;M[95]=63;function Hn(n){var e=n.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=n.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function hs(n){var e=Hn(n),t=e[0],r=e[1];return(t+r)*3/4-r}function ds(n,e,t){return(e+t)*3/4-t}function ls(n){var e,t=Hn(n),r=t[0],i=t[1],o=new fs(ds(n,r,i)),s=0,c=i>0?r-4:r,f;for(f=0;f<c;f+=4)e=M[n.charCodeAt(f)]<<18|M[n.charCodeAt(f+1)]<<12|M[n.charCodeAt(f+2)]<<6|M[n.charCodeAt(f+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=M[n.charCodeAt(f)]<<2|M[n.charCodeAt(f+1)]>>4,o[s++]=e&255),i===1&&(e=M[n.charCodeAt(f)]<<10|M[n.charCodeAt(f+1)]<<4|M[n.charCodeAt(f+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function ps(n){return z[n>>18&63]+z[n>>12&63]+z[n>>6&63]+z[n&63]}function ys(n,e,t){for(var r,i=[],o=e;o<t;o+=3)r=(n[o]<<16&16711680)+(n[o+1]<<8&65280)+(n[o+2]&255),i.push(ps(r));return i.join("")}function ms(n){for(var e,t=n.length,r=t%3,i=[],o=16383,s=0,c=t-r;s<c;s+=o)i.push(ys(n,s,s+o>c?c:s+o));return r===1?(e=n[t-1],i.push(z[e>>2]+z[e<<4&63]+"==")):r===2&&(e=(n[t-2]<<8)+n[t-1],i.push(z[e>>10]+z[e>>4&63]+z[e<<2&63]+"=")),i.join("")}});var Yn=v(_r=>{var Nu=u(a());_r.read=function(n,e,t,r,i){var o,s,c=i*8-r-1,f=(1<<c)-1,h=f>>1,l=-7,d=t?i-1:0,y=t?-1:1,w=n[e+d];for(d+=y,o=w&(1<<-l)-1,w>>=-l,l+=c;l>0;o=o*256+n[e+d],d+=y,l-=8);for(s=o&(1<<-l)-1,o>>=-l,l+=r;l>0;s=s*256+n[e+d],d+=y,l-=8);if(o===0)o=1-h;else{if(o===f)return s?NaN:(w?-1:1)*(1/0);s=s+Math.pow(2,r),o=o-h}return(w?-1:1)*s*Math.pow(2,o-r)};_r.write=function(n,e,t,r,i,o){var s,c,f,h=o*8-i-1,l=(1<<h)-1,d=l>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,w=r?0:o-1,m=r?1:-1,b=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(c=isNaN(e)?1:0,s=l):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+d>=1?e+=y/f:e+=y*Math.pow(2,1-d),e*f>=2&&(s++,f/=2),s+d>=l?(c=0,s=l):s+d>=1?(c=(e*f-1)*Math.pow(2,i),s=s+d):(c=e*Math.pow(2,d-1)*Math.pow(2,i),s=0));i>=8;n[t+w]=c&255,w+=m,c/=256,i-=8);for(s=s<<i|c,h+=i;h>0;n[t+w]=s&255,w+=m,s/=256,h-=8);n[t+w-m]|=b*128}});var We=v(Ge=>{"use strict";var $u=u(a());var Ar=zn(),qe=Yn(),Xn=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ge.Buffer=p;Ge.SlowBuffer=Es;Ge.INSPECT_MAX_BYTES=50;var Mt=2147483647;Ge.kMaxLength=Mt;p.TYPED_ARRAY_SUPPORT=ws();!p.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 ws(){try{let n=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(n,e),n.foo()===42}catch{return!1}}Object.defineProperty(p.prototype,"parent",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.buffer}});Object.defineProperty(p.prototype,"offset",{enumerable:!0,get:function(){if(p.isBuffer(this))return this.byteOffset}});function re(n){if(n>Mt)throw new RangeError('The value "'+n+'" is invalid for option "size"');let e=new Uint8Array(n);return Object.setPrototypeOf(e,p.prototype),e}function p(n,e,t){if(typeof n=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return Kr(n)}return ti(n,e,t)}p.poolSize=8192;function ti(n,e,t){if(typeof n=="string")return xs(n,e);if(ArrayBuffer.isView(n))return vs(n);if(n==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof n);if(Y(n,ArrayBuffer)||n&&Y(n.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Y(n,SharedArrayBuffer)||n&&Y(n.buffer,SharedArrayBuffer)))return Sr(n,e,t);if(typeof n=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let r=n.valueOf&&n.valueOf();if(r!=null&&r!==n)return p.from(r,e,t);let i=bs(n);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof n[Symbol.toPrimitive]=="function")return p.from(n[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 n)}p.from=function(n,e,t){return ti(n,e,t)};Object.setPrototypeOf(p.prototype,Uint8Array.prototype);Object.setPrototypeOf(p,Uint8Array);function ri(n){if(typeof n!="number")throw new TypeError('"size" argument must be of type number');if(n<0)throw new RangeError('The value "'+n+'" is invalid for option "size"')}function gs(n,e,t){return ri(n),n<=0?re(n):e!==void 0?typeof t=="string"?re(n).fill(e,t):re(n).fill(e):re(n)}p.alloc=function(n,e,t){return gs(n,e,t)};function Kr(n){return ri(n),re(n<0?0:Ir(n)|0)}p.allocUnsafe=function(n){return Kr(n)};p.allocUnsafeSlow=function(n){return Kr(n)};function xs(n,e){if((typeof e!="string"||e==="")&&(e="utf8"),!p.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let t=ni(n,e)|0,r=re(t),i=r.write(n,e);return i!==t&&(r=r.slice(0,i)),r}function Br(n){let e=n.length<0?0:Ir(n.length)|0,t=re(e);for(let r=0;r<e;r+=1)t[r]=n[r]&255;return t}function vs(n){if(Y(n,Uint8Array)){let e=new Uint8Array(n);return Sr(e.buffer,e.byteOffset,e.byteLength)}return Br(n)}function Sr(n,e,t){if(e<0||n.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(n.byteLength<e+(t||0))throw new RangeError('"length" is outside of buffer bounds');let r;return e===void 0&&t===void 0?r=new Uint8Array(n):t===void 0?r=new Uint8Array(n,e):r=new Uint8Array(n,e,t),Object.setPrototypeOf(r,p.prototype),r}function bs(n){if(p.isBuffer(n)){let e=Ir(n.length)|0,t=re(e);return t.length===0||n.copy(t,0,0,e),t}if(n.length!==void 0)return typeof n.length!="number"||Ur(n.length)?re(0):Br(n);if(n.type==="Buffer"&&Array.isArray(n.data))return Br(n.data)}function Ir(n){if(n>=Mt)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Mt.toString(16)+" bytes");return n|0}function Es(n){return+n!=n&&(n=0),p.alloc(+n)}p.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==p.prototype};p.compare=function(e,t){if(Y(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),Y(t,Uint8Array)&&(t=p.from(t,t.offset,t.byteLength)),!p.isBuffer(e)||!p.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,i=t.length;for(let o=0,s=Math.min(r,i);o<s;++o)if(e[o]!==t[o]){r=e[o],i=t[o];break}return r<i?-1:i<r?1:0};p.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}};p.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return p.alloc(0);let r;if(t===void 0)for(t=0,r=0;r<e.length;++r)t+=e[r].length;let i=p.allocUnsafe(t),o=0;for(r=0;r<e.length;++r){let s=e[r];if(Y(s,Uint8Array))o+s.length>i.length?(p.isBuffer(s)||(s=p.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(p.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function ni(n,e){if(p.isBuffer(n))return n.length;if(ArrayBuffer.isView(n)||Y(n,ArrayBuffer))return n.byteLength;if(typeof n!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof n);let t=n.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&t===0)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return t;case"utf8":case"utf-8":return kr(n).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t*2;case"hex":return t>>>1;case"base64":return di(n).length;default:if(i)return r?-1:kr(n).length;e=(""+e).toLowerCase(),i=!0}}p.byteLength=ni;function Ts(n,e,t){let r=!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(n||(n="utf8");;)switch(n){case"hex":return Cs(this,e,t);case"utf8":case"utf-8":return oi(this,e,t);case"ascii":return Os(this,e,t);case"latin1":case"binary":return Us(this,e,t);case"base64":return Ks(this,e,t);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Ls(this,e,t);default:if(r)throw new TypeError("Unknown encoding: "+n);n=(n+"").toLowerCase(),r=!0}}p.prototype._isBuffer=!0;function Ae(n,e,t){let r=n[e];n[e]=n[t],n[t]=r}p.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)Ae(this,t,t+1);return this};p.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)Ae(this,t,t+3),Ae(this,t+1,t+2);return this};p.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)Ae(this,t,t+7),Ae(this,t+1,t+6),Ae(this,t+2,t+5),Ae(this,t+3,t+4);return this};p.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?oi(this,0,e):Ts.apply(this,arguments)};p.prototype.toLocaleString=p.prototype.toString;p.prototype.equals=function(e){if(!p.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:p.compare(this,e)===0};p.prototype.inspect=function(){let e="",t=Ge.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"};Xn&&(p.prototype[Xn]=p.prototype.inspect);p.prototype.compare=function(e,t,r,i,o){if(Y(e,Uint8Array)&&(e=p.from(e,e.offset,e.byteLength)),!p.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),r===void 0&&(r=e?e.length:0),i===void 0&&(i=0),o===void 0&&(o=this.length),t<0||r>e.length||i<0||o>this.length)throw new RangeError("out of range index");if(i>=o&&t>=r)return 0;if(i>=o)return-1;if(t>=r)return 1;if(t>>>=0,r>>>=0,i>>>=0,o>>>=0,this===e)return 0;let s=o-i,c=r-t,f=Math.min(s,c),h=this.slice(i,o),l=e.slice(t,r);for(let d=0;d<f;++d)if(h[d]!==l[d]){s=h[d],c=l[d];break}return s<c?-1:c<s?1:0};function ii(n,e,t,r,i){if(n.length===0)return-1;if(typeof t=="string"?(r=t,t=0):t>2147483647?t=2147483647:t<-2147483648&&(t=-2147483648),t=+t,Ur(t)&&(t=i?0:n.length-1),t<0&&(t=n.length+t),t>=n.length){if(i)return-1;t=n.length-1}else if(t<0)if(i)t=0;else return-1;if(typeof e=="string"&&(e=p.from(e,r)),p.isBuffer(e))return e.length===0?-1:Zn(n,e,t,r,i);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(n,e,t):Uint8Array.prototype.lastIndexOf.call(n,e,t):Zn(n,[e],t,r,i);throw new TypeError("val must be string, number or Buffer")}function Zn(n,e,t,r,i){let o=1,s=n.length,c=e.length;if(r!==void 0&&(r=String(r).toLowerCase(),r==="ucs2"||r==="ucs-2"||r==="utf16le"||r==="utf-16le")){if(n.length<2||e.length<2)return-1;o=2,s/=2,c/=2,t/=2}function f(l,d){return o===1?l[d]:l.readUInt16BE(d*o)}let h;if(i){let l=-1;for(h=t;h<s;h++)if(f(n,h)===f(e,l===-1?0:h-l)){if(l===-1&&(l=h),h-l+1===c)return l*o}else l!==-1&&(h-=h-l),l=-1}else for(t+c>s&&(t=s-c),h=t;h>=0;h--){let l=!0;for(let d=0;d<c;d++)if(f(n,h+d)!==f(e,d)){l=!1;break}if(l)return h}return-1}p.prototype.includes=function(e,t,r){return this.indexOf(e,t,r)!==-1};p.prototype.indexOf=function(e,t,r){return ii(this,e,t,r,!0)};p.prototype.lastIndexOf=function(e,t,r){return ii(this,e,t,r,!1)};function _s(n,e,t,r){t=Number(t)||0;let i=n.length-t;r?(r=Number(r),r>i&&(r=i)):r=i;let o=e.length;r>o/2&&(r=o/2);let s;for(s=0;s<r;++s){let c=parseInt(e.substr(s*2,2),16);if(Ur(c))return s;n[t+s]=c}return s}function As(n,e,t,r){return Rt(kr(e,n.length-t),n,t,r)}function Bs(n,e,t,r){return Rt(Rs(e),n,t,r)}function Ss(n,e,t,r){return Rt(di(e),n,t,r)}function ks(n,e,t,r){return Rt(Fs(e,n.length-t),n,t,r)}p.prototype.write=function(e,t,r,i){if(t===void 0)i="utf8",r=this.length,t=0;else if(r===void 0&&typeof t=="string")i=t,r=this.length,t=0;else if(isFinite(t))t=t>>>0,isFinite(r)?(r=r>>>0,i===void 0&&(i="utf8")):(i=r,r=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let o=this.length-t;if((r===void 0||r>o)&&(r=o),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");let s=!1;for(;;)switch(i){case"hex":return _s(this,e,t,r);case"utf8":case"utf-8":return As(this,e,t,r);case"ascii":case"latin1":case"binary":return Bs(this,e,t,r);case"base64":return Ss(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ks(this,e,t,r);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ks(n,e,t){return e===0&&t===n.length?Ar.fromByteArray(n):Ar.fromByteArray(n.slice(e,t))}function oi(n,e,t){t=Math.min(n.length,t);let r=[],i=e;for(;i<t;){let o=n[i],s=null,c=o>239?4:o>223?3:o>191?2:1;if(i+c<=t){let f,h,l,d;switch(c){case 1:o<128&&(s=o);break;case 2:f=n[i+1],(f&192)===128&&(d=(o&31)<<6|f&63,d>127&&(s=d));break;case 3:f=n[i+1],h=n[i+2],(f&192)===128&&(h&192)===128&&(d=(o&15)<<12|(f&63)<<6|h&63,d>2047&&(d<55296||d>57343)&&(s=d));break;case 4:f=n[i+1],h=n[i+2],l=n[i+3],(f&192)===128&&(h&192)===128&&(l&192)===128&&(d=(o&15)<<18|(f&63)<<12|(h&63)<<6|l&63,d>65535&&d<1114112&&(s=d))}}s===null?(s=65533,c=1):s>65535&&(s-=65536,r.push(s>>>10&1023|55296),s=56320|s&1023),r.push(s),i+=c}return Is(r)}var Qn=4096;function Is(n){let e=n.length;if(e<=Qn)return String.fromCharCode.apply(String,n);let t="",r=0;for(;r<e;)t+=String.fromCharCode.apply(String,n.slice(r,r+=Qn));return t}function Os(n,e,t){let r="";t=Math.min(n.length,t);for(let i=e;i<t;++i)r+=String.fromCharCode(n[i]&127);return r}function Us(n,e,t){let r="";t=Math.min(n.length,t);for(let i=e;i<t;++i)r+=String.fromCharCode(n[i]);return r}function Cs(n,e,t){let r=n.length;(!e||e<0)&&(e=0),(!t||t<0||t>r)&&(t=r);let i="";for(let o=e;o<t;++o)i+=Ns[n[o]];return i}function Ls(n,e,t){let r=n.slice(e,t),i="";for(let o=0;o<r.length-1;o+=2)i+=String.fromCharCode(r[o]+r[o+1]*256);return i}p.prototype.slice=function(e,t){let r=this.length;e=~~e,t=t===void 0?r:~~t,e<0?(e+=r,e<0&&(e=0)):e>r&&(e=r),t<0?(t+=r,t<0&&(t=0)):t>r&&(t=r),t<e&&(t=e);let i=this.subarray(e,t);return Object.setPrototypeOf(i,p.prototype),i};function _(n,e,t){if(n%1!==0||n<0)throw new RangeError("offset is not uint");if(n+e>t)throw new RangeError("Trying to access beyond buffer length")}p.prototype.readUintLE=p.prototype.readUIntLE=function(e,t,r){e=e>>>0,t=t>>>0,r||_(e,t,this.length);let i=this[e],o=1,s=0;for(;++s<t&&(o*=256);)i+=this[e+s]*o;return i};p.prototype.readUintBE=p.prototype.readUIntBE=function(e,t,r){e=e>>>0,t=t>>>0,r||_(e,t,this.length);let i=this[e+--t],o=1;for(;t>0&&(o*=256);)i+=this[e+--t]*o;return i};p.prototype.readUint8=p.prototype.readUInt8=function(e,t){return e=e>>>0,t||_(e,1,this.length),this[e]};p.prototype.readUint16LE=p.prototype.readUInt16LE=function(e,t){return e=e>>>0,t||_(e,2,this.length),this[e]|this[e+1]<<8};p.prototype.readUint16BE=p.prototype.readUInt16BE=function(e,t){return e=e>>>0,t||_(e,2,this.length),this[e]<<8|this[e+1]};p.prototype.readUint32LE=p.prototype.readUInt32LE=function(e,t){return e=e>>>0,t||_(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};p.prototype.readUint32BE=p.prototype.readUInt32BE=function(e,t){return e=e>>>0,t||_(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};p.prototype.readBigUInt64LE=de(function(e){e=e>>>0,Je(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&ut(e,this.length-8);let i=t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,o=this[++e]+this[++e]*2**8+this[++e]*2**16+r*2**24;return BigInt(i)+(BigInt(o)<<BigInt(32))});p.prototype.readBigUInt64BE=de(function(e){e=e>>>0,Je(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&ut(e,this.length-8);let i=t*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],o=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+r;return(BigInt(i)<<BigInt(32))+BigInt(o)});p.prototype.readIntLE=function(e,t,r){e=e>>>0,t=t>>>0,r||_(e,t,this.length);let i=this[e],o=1,s=0;for(;++s<t&&(o*=256);)i+=this[e+s]*o;return o*=128,i>=o&&(i-=Math.pow(2,8*t)),i};p.prototype.readIntBE=function(e,t,r){e=e>>>0,t=t>>>0,r||_(e,t,this.length);let i=t,o=1,s=this[e+--i];for(;i>0&&(o*=256);)s+=this[e+--i]*o;return o*=128,s>=o&&(s-=Math.pow(2,8*t)),s};p.prototype.readInt8=function(e,t){return e=e>>>0,t||_(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};p.prototype.readInt16LE=function(e,t){e=e>>>0,t||_(e,2,this.length);let r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};p.prototype.readInt16BE=function(e,t){e=e>>>0,t||_(e,2,this.length);let r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};p.prototype.readInt32LE=function(e,t){return e=e>>>0,t||_(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};p.prototype.readInt32BE=function(e,t){return e=e>>>0,t||_(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};p.prototype.readBigInt64LE=de(function(e){e=e>>>0,Je(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&ut(e,this.length-8);let i=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(r<<24);return(BigInt(i)<<BigInt(32))+BigInt(t+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)});p.prototype.readBigInt64BE=de(function(e){e=e>>>0,Je(e,"offset");let t=this[e],r=this[e+7];(t===void 0||r===void 0)&&ut(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+r)});p.prototype.readFloatLE=function(e,t){return e=e>>>0,t||_(e,4,this.length),qe.read(this,e,!0,23,4)};p.prototype.readFloatBE=function(e,t){return e=e>>>0,t||_(e,4,this.length),qe.read(this,e,!1,23,4)};p.prototype.readDoubleLE=function(e,t){return e=e>>>0,t||_(e,8,this.length),qe.read(this,e,!0,52,8)};p.prototype.readDoubleBE=function(e,t){return e=e>>>0,t||_(e,8,this.length),qe.read(this,e,!1,52,8)};function k(n,e,t,r,i,o){if(!p.isBuffer(n))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<o)throw new RangeError('"value" argument is out of bounds');if(t+r>n.length)throw new RangeError("Index out of range")}p.prototype.writeUintLE=p.prototype.writeUIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let c=Math.pow(2,8*r)-1;k(this,e,t,r,c,0)}let o=1,s=0;for(this[t]=e&255;++s<r&&(o*=256);)this[t+s]=e/o&255;return t+r};p.prototype.writeUintBE=p.prototype.writeUIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,r=r>>>0,!i){let c=Math.pow(2,8*r)-1;k(this,e,t,r,c,0)}let o=r-1,s=1;for(this[t+o]=e&255;--o>=0&&(s*=256);)this[t+o]=e/s&255;return t+r};p.prototype.writeUint8=p.prototype.writeUInt8=function(e,t,r){return e=+e,t=t>>>0,r||k(this,e,t,1,255,0),this[t]=e&255,t+1};p.prototype.writeUint16LE=p.prototype.writeUInt16LE=function(e,t,r){return e=+e,t=t>>>0,r||k(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2};p.prototype.writeUint16BE=p.prototype.writeUInt16BE=function(e,t,r){return e=+e,t=t>>>0,r||k(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2};p.prototype.writeUint32LE=p.prototype.writeUInt32LE=function(e,t,r){return e=+e,t=t>>>0,r||k(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};p.prototype.writeUint32BE=p.prototype.writeUInt32BE=function(e,t,r){return e=+e,t=t>>>0,r||k(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 si(n,e,t,r,i){hi(e,r,i,n,t,7);let o=Number(e&BigInt(4294967295));n[t++]=o,o=o>>8,n[t++]=o,o=o>>8,n[t++]=o,o=o>>8,n[t++]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return n[t++]=s,s=s>>8,n[t++]=s,s=s>>8,n[t++]=s,s=s>>8,n[t++]=s,t}function ci(n,e,t,r,i){hi(e,r,i,n,t,7);let o=Number(e&BigInt(4294967295));n[t+7]=o,o=o>>8,n[t+6]=o,o=o>>8,n[t+5]=o,o=o>>8,n[t+4]=o;let s=Number(e>>BigInt(32)&BigInt(4294967295));return n[t+3]=s,s=s>>8,n[t+2]=s,s=s>>8,n[t+1]=s,s=s>>8,n[t]=s,t+8}p.prototype.writeBigUInt64LE=de(function(e,t=0){return si(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeBigUInt64BE=de(function(e,t=0){return ci(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))});p.prototype.writeIntLE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let f=Math.pow(2,8*r-1);k(this,e,t,r,f-1,-f)}let o=0,s=1,c=0;for(this[t]=e&255;++o<r&&(s*=256);)e<0&&c===0&&this[t+o-1]!==0&&(c=1),this[t+o]=(e/s>>0)-c&255;return t+r};p.prototype.writeIntBE=function(e,t,r,i){if(e=+e,t=t>>>0,!i){let f=Math.pow(2,8*r-1);k(this,e,t,r,f-1,-f)}let o=r-1,s=1,c=0;for(this[t+o]=e&255;--o>=0&&(s*=256);)e<0&&c===0&&this[t+o+1]!==0&&(c=1),this[t+o]=(e/s>>0)-c&255;return t+r};p.prototype.writeInt8=function(e,t,r){return e=+e,t=t>>>0,r||k(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1};p.prototype.writeInt16LE=function(e,t,r){return e=+e,t=t>>>0,r||k(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2};p.prototype.writeInt16BE=function(e,t,r){return e=+e,t=t>>>0,r||k(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2};p.prototype.writeInt32LE=function(e,t,r){return e=+e,t=t>>>0,r||k(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};p.prototype.writeInt32BE=function(e,t,r){return e=+e,t=t>>>0,r||k(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};p.prototype.writeBigInt64LE=de(function(e,t=0){return si(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});p.prototype.writeBigInt64BE=de(function(e,t=0){return ci(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ui(n,e,t,r,i,o){if(t+r>n.length)throw new RangeError("Index out of range");if(t<0)throw new RangeError("Index out of range")}function ai(n,e,t,r,i){return e=+e,t=t>>>0,i||ui(n,e,t,4,34028234663852886e22,-34028234663852886e22),qe.write(n,e,t,r,23,4),t+4}p.prototype.writeFloatLE=function(e,t,r){return ai(this,e,t,!0,r)};p.prototype.writeFloatBE=function(e,t,r){return ai(this,e,t,!1,r)};function fi(n,e,t,r,i){return e=+e,t=t>>>0,i||ui(n,e,t,8,17976931348623157e292,-17976931348623157e292),qe.write(n,e,t,r,52,8),t+8}p.prototype.writeDoubleLE=function(e,t,r){return fi(this,e,t,!0,r)};p.prototype.writeDoubleBE=function(e,t,r){return fi(this,e,t,!1,r)};p.prototype.copy=function(e,t,r,i){if(!p.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!i&&i!==0&&(i=this.length),t>=e.length&&(t=e.length),t||(t=0),i>0&&i<r&&(i=r),i===r||e.length===0||this.length===0)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=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-r&&(i=e.length-t+r);let o=i-r;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(t,r,i):Uint8Array.prototype.set.call(e,this.subarray(r,i),t),o};p.prototype.fill=function(e,t,r,i){if(typeof e=="string"){if(typeof t=="string"?(i=t,t=0,r=this.length):typeof r=="string"&&(i=r,r=this.length),i!==void 0&&typeof i!="string")throw new TypeError("encoding must be a string");if(typeof i=="string"&&!p.isEncoding(i))throw new TypeError("Unknown encoding: "+i);if(e.length===1){let s=e.charCodeAt(0);(i==="utf8"&&s<128||i==="latin1")&&(e=s)}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;t=t>>>0,r=r===void 0?this.length:r>>>0,e||(e=0);let o;if(typeof e=="number")for(o=t;o<r;++o)this[o]=e;else{let s=p.isBuffer(e)?e:p.from(e,i),c=s.length;if(c===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(o=0;o<r-t;++o)this[o+t]=s[o%c]}return this};var $e={};function Or(n,e,t){$e[n]=class extends t{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${n}]`,this.stack,delete this.name}get code(){return n}set code(i){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:i,writable:!0})}toString(){return`${this.name} [${n}]: ${this.message}`}}}Or("ERR_BUFFER_OUT_OF_BOUNDS",function(n){return n?`${n} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Or("ERR_INVALID_ARG_TYPE",function(n,e){return`The "${n}" argument must be of type number. Received type ${typeof e}`},TypeError);Or("ERR_OUT_OF_RANGE",function(n,e,t){let r=`The value of "${n}" is out of range.`,i=t;return Number.isInteger(t)&&Math.abs(t)>2**32?i=ei(String(t)):typeof t=="bigint"&&(i=String(t),(t>BigInt(2)**BigInt(32)||t<-(BigInt(2)**BigInt(32)))&&(i=ei(i)),i+="n"),r+=` It must be ${e}. Received ${i}`,r},RangeError);function ei(n){let e="",t=n.length,r=n[0]==="-"?1:0;for(;t>=r+4;t-=3)e=`_${n.slice(t-3,t)}${e}`;return`${n.slice(0,t)}${e}`}function Ps(n,e,t){Je(e,"offset"),(n[e]===void 0||n[e+t]===void 0)&&ut(e,n.length-(t+1))}function hi(n,e,t,r,i,o){if(n>t||n<e){let s=typeof e=="bigint"?"n":"",c;throw o>3?e===0||e===BigInt(0)?c=`>= 0${s} and < 2${s} ** ${(o+1)*8}${s}`:c=`>= -(2${s} ** ${(o+1)*8-1}${s}) and < 2 ** ${(o+1)*8-1}${s}`:c=`>= ${e}${s} and <= ${t}${s}`,new $e.ERR_OUT_OF_RANGE("value",c,n)}Ps(r,i,o)}function Je(n,e){if(typeof n!="number")throw new $e.ERR_INVALID_ARG_TYPE(e,"number",n)}function ut(n,e,t){throw Math.floor(n)!==n?(Je(n,t),new $e.ERR_OUT_OF_RANGE(t||"offset","an integer",n)):e<0?new $e.ERR_BUFFER_OUT_OF_BOUNDS:new $e.ERR_OUT_OF_RANGE(t||"offset",`>= ${t?1:0} and <= ${e}`,n)}var Ds=/[^+/0-9A-Za-z-_]/g;function Ms(n){if(n=n.split("=")[0],n=n.trim().replace(Ds,""),n.length<2)return"";for(;n.length%4!==0;)n=n+"=";return n}function kr(n,e){e=e||1/0;let t,r=n.length,i=null,o=[];for(let s=0;s<r;++s){if(t=n.charCodeAt(s),t>55295&&t<57344){if(!i){if(t>56319){(e-=3)>-1&&o.push(239,191,189);continue}else if(s+1===r){(e-=3)>-1&&o.push(239,191,189);continue}i=t;continue}if(t<56320){(e-=3)>-1&&o.push(239,191,189),i=t;continue}t=(i-55296<<10|t-56320)+65536}else i&&(e-=3)>-1&&o.push(239,191,189);if(i=null,t<128){if((e-=1)<0)break;o.push(t)}else if(t<2048){if((e-=2)<0)break;o.push(t>>6|192,t&63|128)}else if(t<65536){if((e-=3)<0)break;o.push(t>>12|224,t>>6&63|128,t&63|128)}else if(t<1114112){if((e-=4)<0)break;o.push(t>>18|240,t>>12&63|128,t>>6&63|128,t&63|128)}else throw new Error("Invalid code point")}return o}function Rs(n){let e=[];for(let t=0;t<n.length;++t)e.push(n.charCodeAt(t)&255);return e}function Fs(n,e){let t,r,i,o=[];for(let s=0;s<n.length&&!((e-=2)<0);++s)t=n.charCodeAt(s),r=t>>8,i=t%256,o.push(i),o.push(r);return o}function di(n){return Ar.toByteArray(Ms(n))}function Rt(n,e,t,r){let i;for(i=0;i<r&&!(i+t>=e.length||i>=n.length);++i)e[i+t]=n[i];return i}function Y(n,e){return n instanceof e||n!=null&&n.constructor!=null&&n.constructor.name!=null&&n.constructor.name===e.name}function Ur(n){return n!==n}var Ns=function(){let n="0123456789abcdef",e=new Array(256);for(let t=0;t<16;++t){let r=t*16;for(let i=0;i<16;++i)e[r+i]=n[t]+n[i]}return e}();function de(n){return typeof BigInt>"u"?Vs:n}function Vs(){throw new Error("BigInt not supported")}});var a=v(()=>{"use strict";var li=We().Buffer,{Buffer:js}=We();li.prototype.writeBigUInt64BE=js.prototype.writeBigUInt64BE;globalThis.Buffer=li});var yi=v((Hu,pi)=>{var zu=u(a()),$s=typeof performance=="object"&&performance&&typeof performance.now=="function"?performance:Date,Ft=()=>$s.now(),qs=n=>n&&n===Math.floor(n)&&n>0&&isFinite(n),Lr=n=>n===1/0||qs(n),Pr=class n{constructor({max:e=1/0,ttl:t,updateAgeOnGet:r=!1,checkAgeOnGet:i=!1,noUpdateTTL:o=!1,dispose:s,noDisposeOnSet:c=!1}={}){if(this.expirations=Object.create(null),this.data=new Map,this.expirationMap=new Map,t!==void 0&&!Lr(t))throw new TypeError("ttl must be positive integer or Infinity if set");if(!Lr(e))throw new TypeError("max must be positive integer or Infinity");if(this.ttl=t,this.max=e,this.updateAgeOnGet=!!r,this.checkAgeOnGet=!!i,this.noUpdateTTL=!!o,this.noDisposeOnSet=!!c,s!==void 0){if(typeof s!="function")throw new TypeError("dispose must be function if set");this.dispose=s}this.timer=void 0,this.timerExpiration=void 0}setTimer(e,t){if(this.timerExpiration<e)return;this.timer&&clearTimeout(this.timer);let r=setTimeout(()=>{this.timer=void 0,this.timerExpiration=void 0,this.purgeStale();for(let i in this.expirations){this.setTimer(i,i-Ft());break}},t);r.unref&&r.unref(),this.timerExpiration=e,this.timer=r}cancelTimer(){this.timer&&(clearTimeout(this.timer),this.timerExpiration=void 0,this.timer=void 0)}cancelTimers(){return process.emitWarning('TTLCache.cancelTimers has been renamed to TTLCache.cancelTimer (no "s"), and will be removed in the next major version update'),this.cancelTimer()}clear(){let e=this.dispose!==n.prototype.dispose?[...this]:[];this.data.clear(),this.expirationMap.clear(),this.cancelTimer(),this.expirations=Object.create(null);for(let[t,r]of e)this.dispose(r,t,"delete")}setTTL(e,t=this.ttl){let r=this.expirationMap.get(e);if(r!==void 0){let i=this.expirations[r];!i||i.length<=1?delete this.expirations[r]:this.expirations[r]=i.filter(o=>o!==e)}if(t!==1/0){let i=Math.floor(Ft()+t);this.expirationMap.set(e,i),this.expirations[i]||(this.expirations[i]=[],this.setTimer(i,t)),this.expirations[i].push(e)}else this.expirationMap.set(e,1/0)}set(e,t,{ttl:r=this.ttl,noUpdateTTL:i=this.noUpdateTTL,noDisposeOnSet:o=this.noDisposeOnSet}={}){if(!Lr(r))throw new TypeError("ttl must be positive integer or Infinity");if(this.expirationMap.has(e)){i||this.setTTL(e,r);let s=this.data.get(e);s!==t&&(this.data.set(e,t),o||this.dispose(s,e,"set"))}else this.setTTL(e,r),this.data.set(e,t);for(;this.size>this.max;)this.purgeToCapacity();return this}has(e){return this.data.has(e)}getRemainingTTL(e){let t=this.expirationMap.get(e);return t===1/0?t:t!==void 0?Math.max(0,Math.ceil(t-Ft())):0}get(e,{updateAgeOnGet:t=this.updateAgeOnGet,ttl:r=this.ttl,checkAgeOnGet:i=this.checkAgeOnGet}={}){let o=this.data.get(e);if(i&&this.getRemainingTTL(e)===0){this.delete(e);return}return t&&this.setTTL(e,r),o}dispose(e,t){}delete(e){let t=this.expirationMap.get(e);if(t!==void 0){let r=this.data.get(e);this.data.delete(e),this.expirationMap.delete(e);let i=this.expirations[t];return i&&(i.length<=1?delete this.expirations[t]:this.expirations[t]=i.filter(o=>o!==e)),this.dispose(r,e,"delete"),this.size===0&&this.cancelTimer(),!0}return!1}purgeToCapacity(){for(let e in this.expirations){let t=this.expirations[e];if(this.size-t.length>=this.max){delete this.expirations[e];let r=[];for(let i of t)r.push([i,this.data.get(i)]),this.data.delete(i),this.expirationMap.delete(i);for(let[i,o]of r)this.dispose(o,i,"evict")}else{let r=this.size-this.max,i=[];for(let o of t.splice(0,r))i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"evict");return}}}get size(){return this.data.size}purgeStale(){let e=Math.ceil(Ft());for(let t in this.expirations){if(t==="Infinity"||t>e)return;let r=[...this.expirations[t]||[]],i=[];delete this.expirations[t];for(let o of r)i.push([o,this.data.get(o)]),this.data.delete(o),this.expirationMap.delete(o);for(let[o,s]of i)this.dispose(s,o,"stale")}this.size===0&&this.cancelTimer()}*entries(){for(let e in this.expirations)for(let t of this.expirations[e])yield[t,this.data.get(t)]}*keys(){for(let e in this.expirations)for(let t of this.expirations[e])yield t}*values(){for(let e in this.expirations)for(let t of this.expirations[e])yield this.data.get(t)}[Symbol.iterator](){return this.entries()}};pi.exports=Pr});var Ui=v(Oi=>{"use strict";var wf=u(a());Oi.supports=function(...e){let t=e.reduce((r,i)=>Object.assign(r,i),{});return Object.assign(t,{snapshots:t.snapshots||!1,permanence:t.permanence||!1,seek:t.seek||!1,clear:t.clear||!1,getMany:t.getMany||!1,keyIterator:t.keyIterator||!1,valueIterator:t.valueIterator||!1,iteratorNextv:t.iteratorNextv||!1,iteratorAll:t.iteratorAll||!1,status:t.status||!1,createIfMissing:t.createIfMissing||!1,errorIfExists:t.errorIfExists||!1,deferredOpen:t.deferredOpen||!1,promises:t.promises||!1,streams:t.streams||!1,encodings:Object.assign({},t.encodings),events:Object.assign({},t.events),additionalMethods:Object.assign({},t.additionalMethods)})}});var j=v((xf,Ci)=>{"use strict";var vf=u(a());Ci.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 Yr=v((bf,Li)=>{"use strict";var Ef=u(a()),zr=null;Li.exports=function(){return zr===null&&(zr={textEncoder:new TextEncoder,textDecoder:new TextDecoder}),zr}});var Qr=v(Pi=>{"use strict";var _f=u(a()),Xr=j(),Tc=new Set(["buffer","view","utf8"]),Zr=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"||!Tc.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 Xr(`Encoding '${this.name}' cannot be transcoded to 'buffer'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createViewTranscoder(){throw new Xr(`Encoding '${this.name}' cannot be transcoded to 'view'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}createUTF8Transcoder(){throw new Xr(`Encoding '${this.name}' cannot be transcoded to 'utf8'`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"})}};Pi.Encoding=Zr});var nn=v(jt=>{"use strict";var Bf=u(a()),{Buffer:tn}=We()||{},{Encoding:rn}=Qr(),_c=Yr(),pt=class extends rn{constructor(e){super({...e,format:"buffer"})}createViewTranscoder(){return new yt({encode:this.encode,decode:e=>this.decode(tn.from(e.buffer,e.byteOffset,e.byteLength)),name:`${this.name}+view`})}createBufferTranscoder(){return this}},yt=class extends rn{constructor(e){super({...e,format:"view"})}createBufferTranscoder(){return new pt({encode:e=>{let t=this.encode(e);return tn.from(t.buffer,t.byteOffset,t.byteLength)},decode:this.decode,name:`${this.name}+buffer`})}createViewTranscoder(){return this}},en=class extends rn{constructor(e){super({...e,format:"utf8"})}createBufferTranscoder(){return new pt({encode:e=>tn.from(this.encode(e),"utf8"),decode:e=>this.decode(e.toString("utf8")),name:`${this.name}+buffer`})}createViewTranscoder(){let{textEncoder:e,textDecoder:t}=_c();return new yt({encode:r=>e.encode(this.encode(r)),decode:r=>this.decode(t.decode(r)),name:`${this.name}+view`})}createUTF8Transcoder(){return this}};jt.BufferFormat=pt;jt.ViewFormat=yt;jt.UTF8Format=en});var Fi=v(Ke=>{"use strict";var kf=u(a()),{Buffer:A}=We()||{Buffer:{isBuffer:()=>!1}},{textEncoder:Mi,textDecoder:Di}=Yr()(),{BufferFormat:mt,ViewFormat:on,UTF8Format:Ri}=nn(),$t=n=>n;Ke.utf8=new Ri({encode:function(n){return A.isBuffer(n)?n.toString("utf8"):ArrayBuffer.isView(n)?Di.decode(n):String(n)},decode:$t,name:"utf8",createViewTranscoder(){return new on({encode:function(n){return ArrayBuffer.isView(n)?n:Mi.encode(n)},decode:function(n){return Di.decode(n)},name:`${this.name}+view`})},createBufferTranscoder(){return new mt({encode:function(n){return A.isBuffer(n)?n:ArrayBuffer.isView(n)?A.from(n.buffer,n.byteOffset,n.byteLength):A.from(String(n),"utf8")},decode:function(n){return n.toString("utf8")},name:`${this.name}+buffer`})}});Ke.json=new Ri({encode:JSON.stringify,decode:JSON.parse,name:"json"});Ke.buffer=new mt({encode:function(n){return A.isBuffer(n)?n:ArrayBuffer.isView(n)?A.from(n.buffer,n.byteOffset,n.byteLength):A.from(String(n),"utf8")},decode:$t,name:"buffer",createViewTranscoder(){return new on({encode:function(n){return ArrayBuffer.isView(n)?n:A.from(String(n),"utf8")},decode:function(n){return A.from(n.buffer,n.byteOffset,n.byteLength)},name:`${this.name}+view`})}});Ke.view=new on({encode:function(n){return ArrayBuffer.isView(n)?n:Mi.encode(n)},decode:$t,name:"view",createBufferTranscoder(){return new mt({encode:function(n){return A.isBuffer(n)?n:ArrayBuffer.isView(n)?A.from(n.buffer,n.byteOffset,n.byteLength):A.from(String(n),"utf8")},decode:$t,name:`${this.name}+buffer`})}});Ke.hex=new mt({encode:function(n){return A.isBuffer(n)?n:A.from(String(n),"hex")},decode:function(n){return n.toString("hex")},name:"hex"});Ke.base64=new mt({encode:function(n){return A.isBuffer(n)?n:A.from(String(n),"base64")},decode:function(n){return n.toString("base64")},name:"base64"})});var ji=v(Vi=>{"use strict";var If=u(a()),Ni=j(),Jt=Fi(),{Encoding:Ac}=Qr(),{BufferFormat:Bc,ViewFormat:Sc,UTF8Format:kc}=nn(),wt=Symbol("formats"),qt=Symbol("encodings"),Kc=new Set(["buffer","view","utf8"]),sn=class{constructor(e){if(Array.isArray(e)){if(!e.every(t=>Kc.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[qt]=new Map,this[wt]=new Set(e);for(let t in Jt)try{this.encoding(t)}catch(r){if(r.code!=="LEVEL_ENCODING_NOT_SUPPORTED")throw r}}encodings(){return Array.from(new Set(this[qt].values()))}encoding(e){let t=this[qt].get(e);if(t===void 0){if(typeof e=="string"&&e!==""){if(t=Cc[e],!t)throw new Ni(`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=Ic(e)}let{name:r,format:i}=t;if(!this[wt].has(i))if(this[wt].has("view"))t=t.createViewTranscoder();else if(this[wt].has("buffer"))t=t.createBufferTranscoder();else if(this[wt].has("utf8"))t=t.createUTF8Transcoder();else throw new Ni(`Encoding '${r}' cannot be transcoded`,{code:"LEVEL_ENCODING_NOT_SUPPORTED"});for(let o of[e,r,t.name,t.commonName])this[qt].set(o,t)}return t}};Vi.Transcoder=sn;function Ic(n){if(n instanceof Ac)return n;let e="type"in n&&typeof n.type=="string"?n.type:void 0,t=n.name||e||`anonymous-${Lc++}`;switch(Oc(n)){case"view":return new Sc({...n,name:t});case"utf8":return new kc({...n,name:t});case"buffer":return new Bc({...n,name:t});default:throw new TypeError("Format must be one of 'buffer', 'view', 'utf8'")}}function Oc(n){return"format"in n&&n.format!==void 0?n.format:"buffer"in n&&typeof n.buffer=="boolean"?n.buffer?"buffer":"utf8":"code"in n&&Number.isInteger(n.code)?"view":"buffer"}var Uc={binary:Jt.buffer,"utf-8":Jt.utf8},Cc={...Jt,...Uc},Lc=0});var Qi=v((Of,cn)=>{"use strict";var Uf=u(a()),Xe=typeof Reflect=="object"?Reflect:null,$i=Xe&&typeof Xe.apply=="function"?Xe.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Gt;Xe&&typeof Xe.ownKeys=="function"?Gt=Xe.ownKeys:Object.getOwnPropertySymbols?Gt=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Gt=function(e){return Object.getOwnPropertyNames(e)};function Pc(n){console&&console.warn&&console.warn(n)}var Ji=Number.isNaN||function(e){return e!==e};function E(){E.init.call(this)}cn.exports=E;cn.exports.once=Fc;E.EventEmitter=E;E.prototype._events=void 0;E.prototype._eventsCount=0;E.prototype._maxListeners=void 0;var qi=10;function Wt(n){if(typeof n!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof n)}Object.defineProperty(E,"defaultMaxListeners",{enumerable:!0,get:function(){return qi},set:function(n){if(typeof n!="number"||n<0||Ji(n))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+n+".");qi=n}});E.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};E.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ji(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 Gi(n){return n._maxListeners===void 0?E.defaultMaxListeners:n._maxListeners}E.prototype.getMaxListeners=function(){return Gi(this)};E.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i=e==="error",o=this._events;if(o!==void 0)i=i&&o.error===void 0;else if(!i)return!1;if(i){var s;if(t.length>0&&(s=t[0]),s instanceof Error)throw s;var c=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw c.context=s,c}var f=o[e];if(f===void 0)return!1;if(typeof f=="function")$i(f,this,t);else for(var h=f.length,l=Xi(f,h),r=0;r<h;++r)$i(l[r],this,t);return!0};function Wi(n,e,t,r){var i,o,s;if(Wt(t),o=n._events,o===void 0?(o=n._events=Object.create(null),n._eventsCount=0):(o.newListener!==void 0&&(n.emit("newListener",e,t.listener?t.listener:t),o=n._events),s=o[e]),s===void 0)s=o[e]=t,++n._eventsCount;else if(typeof s=="function"?s=o[e]=r?[t,s]:[s,t]:r?s.unshift(t):s.push(t),i=Gi(n),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(e)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=n,c.type=e,c.count=s.length,Pc(c)}return n}E.prototype.addListener=function(e,t){return Wi(this,e,t,!1)};E.prototype.on=E.prototype.addListener;E.prototype.prependListener=function(e,t){return Wi(this,e,t,!0)};function Dc(){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 Hi(n,e,t){var r={fired:!1,wrapFn:void 0,target:n,type:e,listener:t},i=Dc.bind(r);return i.listener=t,r.wrapFn=i,i}E.prototype.once=function(e,t){return Wt(t),this.on(e,Hi(this,e,t)),this};E.prototype.prependOnceListener=function(e,t){return Wt(t),this.prependListener(e,Hi(this,e,t)),this};E.prototype.removeListener=function(e,t){var r,i,o,s,c;if(Wt(t),i=this._events,i===void 0)return this;if(r=i[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(o=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){c=r[s].listener,o=s;break}if(o<0)return this;o===0?r.shift():Mc(r,o),r.length===1&&(i[e]=r[0]),i.removeListener!==void 0&&this.emit("removeListener",e,c||t)}return this};E.prototype.off=E.prototype.removeListener;E.prototype.removeAllListeners=function(e){var t,r,i;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var o=Object.keys(r),s;for(i=0;i<o.length;++i)s=o[i],s!=="removeListener"&&this.removeAllListeners(s);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(t=r[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 zi(n,e,t){var r=n._events;if(r===void 0)return[];var i=r[e];return i===void 0?[]:typeof i=="function"?t?[i.listener||i]:[i]:t?Rc(i):Xi(i,i.length)}E.prototype.listeners=function(e){return zi(this,e,!0)};E.prototype.rawListeners=function(e){return zi(this,e,!1)};E.listenerCount=function(n,e){return typeof n.listenerCount=="function"?n.listenerCount(e):Yi.call(n,e)};E.prototype.listenerCount=Yi;function Yi(n){var e=this._events;if(e!==void 0){var t=e[n];if(typeof t=="function")return 1;if(t!==void 0)return t.length}return 0}E.prototype.eventNames=function(){return this._eventsCount>0?Gt(this._events):[]};function Xi(n,e){for(var t=new Array(e),r=0;r<e;++r)t[r]=n[r];return t}function Mc(n,e){for(;e+1<n.length;e++)n[e]=n[e+1];n.pop()}function Rc(n){for(var e=new Array(n.length),t=0;t<e.length;++t)e[t]=n[t].listener||n[t];return e}function Fc(n,e){return new Promise(function(t,r){function i(s){n.removeListener(e,o),r(s)}function o(){typeof n.removeListener=="function"&&n.removeListener("error",i),t([].slice.call(arguments))}Zi(n,e,o,{once:!0}),e!=="error"&&Nc(n,i,{once:!0})})}function Nc(n,e,t){typeof n.on=="function"&&Zi(n,"error",e,t)}function Zi(n,e,t,r){if(typeof n.on=="function")r.once?n.once(e,t):n.on(e,t);else if(typeof n.addEventListener=="function")n.addEventListener(e,function i(o){r.once&&n.removeEventListener(e,i),t(o)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof n)}});var to=v((Cf,eo)=>{var Lf=u(a());eo.exports=typeof queueMicrotask=="function"?queueMicrotask:n=>Promise.resolve().then(n)});var gt=v(un=>{"use strict";var Df=u(a()),ro=to();un.fromCallback=function(n,e){if(n===void 0){var t=new Promise(function(r,i){n=function(o,s){o?i(o):r(s)}});n[e!==void 0?e:"promise"]=t}else if(typeof n!="function")throw new TypeError("Callback must be a function");return n};un.fromPromise=function(n,e){if(e===void 0)return n;n.then(function(t){ro(()=>e(null,t))}).catch(function(t){ro(()=>e(t))})}});var Ht=v(an=>{"use strict";var Rf=u(a());an.getCallback=function(n,e){return typeof n=="function"?n:e};an.getOptions=function(n,e){return typeof n=="object"&&n!==null?n:e!==void 0?e:{}}});var ge=v(Zt=>{"use strict";var Nf=u(a()),{fromCallback:fn}=gt(),U=j(),{getOptions:hn,getCallback:no}=Ht(),Ie=Symbol("promise"),Ze=Symbol("callback"),Z=Symbol("working"),Oe=Symbol("handleOne"),ie=Symbol("handleMany"),dn=Symbol("autoClose"),me=Symbol("finishWork"),Q=Symbol("returnMany"),le=Symbol("closing"),xt=Symbol("handleClose"),zt=Symbol("closed"),vt=Symbol("closeCallbacks"),ye=Symbol("keyEncoding"),Ue=Symbol("valueEncoding"),ln=Symbol("abortOnClose"),Yt=Symbol("legacy"),pn=Symbol("keys"),yn=Symbol("values"),pe=Symbol("limit"),R=Symbol("count"),Xt=Object.freeze({}),Vc=()=>{},io=!1,bt=class{constructor(e,t,r){if(typeof e!="object"||e===null){let i=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${i}`)}if(typeof t!="object"||t===null)throw new TypeError("The second argument must be an options object");this[zt]=!1,this[vt]=[],this[Z]=!1,this[le]=!1,this[dn]=!1,this[Ze]=null,this[Oe]=this[Oe].bind(this),this[ie]=this[ie].bind(this),this[xt]=this[xt].bind(this),this[ye]=t[ye],this[Ue]=t[Ue],this[Yt]=r,this[pe]=Number.isInteger(t.limit)&&t.limit>=0?t.limit:1/0,this[R]=0,this[ln]=!!t.abortOnClose,this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get count(){return this[R]}get limit(){return this[pe]}next(e){let t;if(e===void 0)t=new Promise((r,i)=>{e=(o,s,c)=>{o?i(o):this[Yt]?s===void 0&&c===void 0?r():r([s,c]):r(s)}});else if(typeof e!="function")throw new TypeError("Callback must be a function");return this[le]?this.nextTick(e,new U("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Z]?this.nextTick(e,new U("Iterator is busy: cannot call next() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Z]=!0,this[Ze]=e,this[R]>=this[pe]?this.nextTick(this[Oe],null):this._next(this[Oe])),t}_next(e){this.nextTick(e)}nextv(e,t,r){return r=no(t,r),r=fn(r,Ie),t=hn(t,Xt),Number.isInteger(e)?(this[le]?this.nextTick(r,new U("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Z]?this.nextTick(r,new U("Iterator is busy: cannot call nextv() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(e<1&&(e=1),this[pe]<1/0&&(e=Math.min(e,this[pe]-this[R])),this[Z]=!0,this[Ze]=r,e<=0?this.nextTick(this[ie],null,[]):this._nextv(e,t,this[ie])),r[Ie]):(this.nextTick(r,new TypeError("The first argument 'size' must be an integer")),r[Ie])}_nextv(e,t,r){let i=[],o=(s,c,f)=>{if(s)return r(s);if(this[Yt]?c===void 0&&f===void 0:c===void 0)return r(null,i);i.push(this[Yt]?[c,f]:c),i.length===e?r(null,i):this._next(o)};this._next(o)}all(e,t){return t=no(e,t),t=fn(t,Ie),e=hn(e,Xt),this[le]?this.nextTick(t,new U("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this[Z]?this.nextTick(t,new U("Iterator is busy: cannot call all() until previous call has completed",{code:"LEVEL_ITERATOR_BUSY"})):(this[Z]=!0,this[Ze]=t,this[dn]=!0,this[R]>=this[pe]?this.nextTick(this[ie],null,[]):this._all(e,this[ie])),t[Ie]}_all(e,t){let r=this[R],i=[],o=()=>{let c=this[pe]<1/0?Math.min(1e3,this[pe]-r):1e3;c<=0?this.nextTick(t,null,i):this._nextv(c,Xt,s)},s=(c,f)=>{c?t(c):f.length===0?t(null,i):(i.push.apply(i,f),r+=f.length,o())};o()}[me](){let e=this[Ze];return this[ln]&&e===null?Vc:(this[Z]=!1,this[Ze]=null,this[le]&&this._close(this[xt]),e)}[Q](e,t,r){this[dn]?this.close(e.bind(null,t,r)):e(t,r)}seek(e,t){if(t=hn(t,Xt),!this[le]){if(this[Z])throw new U("Iterator is busy: cannot call seek() until next() has completed",{code:"LEVEL_ITERATOR_BUSY"});{let r=this.db.keyEncoding(t.keyEncoding||this[ye]),i=r.format;t.keyEncoding!==i&&(t={...t,keyEncoding:i});let o=this.db.prefixKey(r.encode(e),i);this._seek(o,t)}}}_seek(e,t){throw new U("Iterator does not support seek()",{code:"LEVEL_NOT_SUPPORTED"})}close(e){return e=fn(e,Ie),this[zt]?this.nextTick(e):this[le]?this[vt].push(e):(this[le]=!0,this[vt].push(e),this[Z]?this[ln]&&this[me]()(new U("Aborted on iterator close()",{code:"LEVEL_ITERATOR_NOT_OPEN"})):this._close(this[xt])),e[Ie]}_close(e){this.nextTick(e)}[xt](){this[zt]=!0,this.db.detachResource(this);let e=this[vt];this[vt]=[];for(let t of e)t()}async*[Symbol.asyncIterator](){try{let e;for(;(e=await this.next())!==void 0;)yield e}finally{this[zt]||await this.close()}}},Qe=class extends bt{constructor(e,t){super(e,t,!0),this[pn]=t.keys!==!1,this[yn]=t.values!==!1}[Oe](e,t,r){let i=this[me]();if(e)return i(e);try{t=this[pn]&&t!==void 0?this[ye].decode(t):void 0,r=this[yn]&&r!==void 0?this[Ue].decode(r):void 0}catch(o){return i(new we("entry",o))}t===void 0&&r===void 0||this[R]++,i(null,t,r)}[ie](e,t){let r=this[me]();if(e)return this[Q](r,e);try{for(let i of t){let o=i[0],s=i[1];i[0]=this[pn]&&o!==void 0?this[ye].decode(o):void 0,i[1]=this[yn]&&s!==void 0?this[Ue].decode(s):void 0}}catch(i){return this[Q](r,new we("entries",i))}this[R]+=t.length,this[Q](r,null,t)}end(e){return!io&&typeof console<"u"&&(io=!0,console.warn(new U("The iterator.end() method was renamed to close() and end() is an alias that will be removed in a future version",{code:"LEVEL_LEGACY"}))),this.close(e)}},mn=class extends bt{constructor(e,t){super(e,t,!1)}[Oe](e,t){let r=this[me]();if(e)return r(e);try{t=t!==void 0?this[ye].decode(t):void 0}catch(i){return r(new we("key",i))}t!==void 0&&this[R]++,r(null,t)}[ie](e,t){let r=this[me]();if(e)return this[Q](r,e);try{for(let i=0;i<t.length;i++){let o=t[i];t[i]=o!==void 0?this[ye].decode(o):void 0}}catch(i){return this[Q](r,new we("keys",i))}this[R]+=t.length,this[Q](r,null,t)}},wn=class extends bt{constructor(e,t){super(e,t,!1)}[Oe](e,t){let r=this[me]();if(e)return r(e);try{t=t!==void 0?this[Ue].decode(t):void 0}catch(i){return r(new we("value",i))}t!==void 0&&this[R]++,r(null,t)}[ie](e,t){let r=this[me]();if(e)return this[Q](r,e);try{for(let i=0;i<t.length;i++){let o=t[i];t[i]=o!==void 0?this[Ue].decode(o):void 0}}catch(i){return this[Q](r,new we("values",i))}this[R]+=t.length,this[Q](r,null,t)}},we=class extends U{constructor(e,t){super(`Iterator could not decode ${e}`,{code:"LEVEL_DECODE_ERROR",cause:t})}};for(let n of["_ended property","_nexting property","_end method"])Object.defineProperty(Qe.prototype,n.split(" ")[0],{get(){throw new U(`The ${n} has been removed`,{code:"LEVEL_LEGACY"})},set(){throw new U(`The ${n} has been removed`,{code:"LEVEL_LEGACY"})}});Qe.keyEncoding=ye;Qe.valueEncoding=Ue;Zt.AbstractIterator=Qe;Zt.AbstractKeyIterator=mn;Zt.AbstractValueIterator=wn});var oo=v(gn=>{"use strict";var jf=u(a()),{AbstractKeyIterator:jc,AbstractValueIterator:$c}=ge(),Ce=Symbol("iterator"),Et=Symbol("callback"),et=Symbol("handleOne"),Le=Symbol("handleMany"),Tt=class extends jc{constructor(e,t){super(e,t),this[Ce]=e.iterator({...t,keys:!0,values:!1}),this[et]=this[et].bind(this),this[Le]=this[Le].bind(this)}},Qt=class extends $c{constructor(e,t){super(e,t),this[Ce]=e.iterator({...t,keys:!1,values:!0}),this[et]=this[et].bind(this),this[Le]=this[Le].bind(this)}};for(let n of[Tt,Qt]){let e=n===Tt,t=e?r=>r[0]:r=>r[1];n.prototype._next=function(r){this[Et]=r,this[Ce].next(this[et])},n.prototype[et]=function(r,i,o){let s=this[Et];r?s(r):s(null,e?i:o)},n.prototype._nextv=function(r,i,o){this[Et]=o,this[Ce].nextv(r,i,this[Le])},n.prototype._all=function(r,i){this[Et]=i,this[Ce].all(r,this[Le])},n.prototype[Le]=function(r,i){let o=this[Et];r?o(r):o(null,i.map(t))},n.prototype._seek=function(r,i){this[Ce].seek(r,i)},n.prototype._close=function(r){this[Ce].close(r)}}gn.DefaultKeyIterator=Tt;gn.DefaultValueIterator=Qt});var so=v(or=>{"use strict";var qf=u(a()),{AbstractIterator:qc,AbstractKeyIterator:Jc,AbstractValueIterator:Gc}=ge(),xn=j(),I=Symbol("nut"),nr=Symbol("undefer"),ir=Symbol("factory"),er=class extends qc{constructor(e,t){super(e,t),this[I]=null,this[ir]=()=>e.iterator(t),this.db.defer(()=>this[nr]())}},tr=class extends Jc{constructor(e,t){super(e,t),this[I]=null,this[ir]=()=>e.keys(t),this.db.defer(()=>this[nr]())}},rr=class extends Gc{constructor(e,t){super(e,t),this[I]=null,this[ir]=()=>e.values(t),this.db.defer(()=>this[nr]())}};for(let n of[er,tr,rr])n.prototype[nr]=function(){this.db.status==="open"&&(this[I]=this[ir]())},n.prototype._next=function(e){this[I]!==null?this[I].next(e):this.db.status==="opening"?this.db.defer(()=>this._next(e)):this.nextTick(e,new xn("Iterator is not open: cannot call next() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},n.prototype._nextv=function(e,t,r){this[I]!==null?this[I].nextv(e,t,r):this.db.status==="opening"?this.db.defer(()=>this._nextv(e,t,r)):this.nextTick(r,new xn("Iterator is not open: cannot call nextv() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},n.prototype._all=function(e,t){this[I]!==null?this[I].all(t):this.db.status==="opening"?this.db.defer(()=>this._all(e,t)):this.nextTick(t,new xn("Iterator is not open: cannot call all() after close()",{code:"LEVEL_ITERATOR_NOT_OPEN"}))},n.prototype._seek=function(e,t){this[I]!==null?this[I]._seek(e,t):this.db.status==="opening"&&this.db.defer(()=>this._seek(e,t))},n.prototype._close=function(e){this[I]!==null?this[I].close(e):this.db.status==="opening"?this.db.defer(()=>this._close(e)):this.nextTick(e)};or.DeferredIterator=er;or.DeferredKeyIterator=tr;or.DeferredValueIterator=rr});var bn=v(uo=>{"use strict";var Gf=u(a()),{fromCallback:co}=gt(),sr=j(),{getCallback:Wc,getOptions:Hc}=Ht(),cr=Symbol("promise"),F=Symbol("status"),tt=Symbol("operations"),_t=Symbol("finishClose"),rt=Symbol("closeCallbacks"),vn=class{constructor(e){if(typeof e!="object"||e===null){let t=e===null?"null":typeof e;throw new TypeError(`The first argument must be an abstract-level database, received ${t}`)}this[tt]=[],this[rt]=[],this[F]="open",this[_t]=this[_t].bind(this),this.db=e,this.db.attachResource(this),this.nextTick=e.nextTick}get length(){return this[tt].length}put(e,t,r){if(this[F]!=="open")throw new sr("Batch is not open: cannot call put() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let i=this.db._checkKey(e)||this.db._checkValue(t);if(i)throw i;let o=r&&r.sublevel!=null?r.sublevel:this.db,s=r,c=o.keyEncoding(r&&r.keyEncoding),f=o.valueEncoding(r&&r.valueEncoding),h=c.format;r={...r,keyEncoding:h,valueEncoding:f.format},o!==this.db&&(r.sublevel=null);let l=o.prefixKey(c.encode(e),h),d=f.encode(t);return this._put(l,d,r),this[tt].push({...s,type:"put",key:e,value:t}),this}_put(e,t,r){}del(e,t){if(this[F]!=="open")throw new sr("Batch is not open: cannot call del() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});let r=this.db._checkKey(e);if(r)throw r;let i=t&&t.sublevel!=null?t.sublevel:this.db,o=t,s=i.keyEncoding(t&&t.keyEncoding),c=s.format;return t={...t,keyEncoding:c},i!==this.db&&(t.sublevel=null),this._del(i.prefixKey(s.encode(e),c),t),this[tt].push({...o,type:"del",key:e}),this}_del(e,t){}clear(){if(this[F]!=="open")throw new sr("Batch is not open: cannot call clear() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"});return this._clear(),this[tt]=[],this}_clear(){}write(e,t){return t=Wc(e,t),t=co(t,cr),e=Hc(e),this[F]!=="open"?this.nextTick(t,new sr("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"})):this.length===0?this.close(t):(this[F]="writing",this._write(e,r=>{this[F]="closing",this[rt].push(()=>t(r)),r||this.db.emit("batch",this[tt]),this._close(this[_t])})),t[cr]}_write(e,t){}close(e){return e=co(e,cr),this[F]==="closing"?this[rt].push(e):this[F]==="closed"?this.nextTick(e):(this[rt].push(e),this[F]!=="writing"&&(this[F]="closing",this._close(this[_t]))),e[cr]}_close(e){this.nextTick(e)}[_t](){this[F]="closed",this.db.detachResource(this);let e=this[rt];this[rt]=[];for(let t of e)t()}};uo.AbstractChainedBatch=vn});var fo=v(ao=>{"use strict";var Hf=u(a()),{AbstractChainedBatch:zc}=bn(),Yc=j(),nt=Symbol("encoded"),En=class extends zc{constructor(e){super(e),this[nt]=[]}_put(e,t,r){this[nt].push({...r,type:"put",key:e,value:t})}_del(e,t){this[nt].push({...t,type:"del",key:e})}_clear(){this[nt]=[]}_write(e,t){this.db.status==="opening"?this.db.defer(()=>this._write(e,t)):this.db.status==="open"?this[nt].length===0?this.nextTick(t):this.db._batch(this[nt],e,t):this.nextTick(t,new Yc("Batch is not open: cannot call write() after write() or close()",{code:"LEVEL_BATCH_NOT_OPEN"}))}};ao.DefaultChainedBatch=En});var po=v((zf,lo)=>{"use strict";var Yf=u(a()),ho=j(),Xc=Object.prototype.hasOwnProperty,Zc=new Set(["lt","lte","gt","gte"]);lo.exports=function(n,e){let t={};for(let r in n)if(Xc.call(n,r)&&!(r==="keyEncoding"||r==="valueEncoding")){if(r==="start"||r==="end")throw new ho(`The legacy range option '${r}' has been removed`,{code:"LEVEL_LEGACY"});if(r==="encoding")throw new ho("The levelup-style 'encoding' alias has been removed, use 'valueEncoding' instead",{code:"LEVEL_LEGACY"});Zc.has(r)?t[r]=e.encode(n[r]):t[r]=n[r]}return t.reverse=!!t.reverse,t.limit=Number.isInteger(t.limit)&&t.limit>=0?t.limit:-1,t}});var Tn=v((Xf,mo)=>{var Zf=u(a());var yo;mo.exports=typeof queueMicrotask=="function"?queueMicrotask.bind(typeof window<"u"?window:globalThis):n=>(yo||(yo=Promise.resolve())).then(n).catch(e=>setTimeout(()=>{throw e},0))});var xo=v((Qf,go)=>{"use strict";var eh=u(a()),wo=Tn();go.exports=function(n,...e){e.length===0?wo(n):wo(()=>n(...e))}});var vo=v(ur=>{"use strict";var rh=u(a()),{AbstractIterator:Qc,AbstractKeyIterator:eu,AbstractValueIterator:tu}=ge(),it=Symbol("unfix"),$=Symbol("iterator"),Pe=Symbol("handleOne"),xe=Symbol("handleMany"),oe=Symbol("callback"),At=class extends Qc{constructor(e,t,r,i){super(e,t),this[$]=r,this[it]=i,this[Pe]=this[Pe].bind(this),this[xe]=this[xe].bind(this),this[oe]=null}[Pe](e,t,r){let i=this[oe];if(e)return i(e);t!==void 0&&(t=this[it](t)),i(e,t,r)}[xe](e,t){let r=this[oe];if(e)return r(e);for(let i of t){let o=i[0];o!==void 0&&(i[0]=this[it](o))}r(e,t)}},Bt=class extends eu{constructor(e,t,r,i){super(e,t),this[$]=r,this[it]=i,this[Pe]=this[Pe].bind(this),this[xe]=this[xe].bind(this),this[oe]=null}[Pe](e,t){let r=this[oe];if(e)return r(e);t!==void 0&&(t=this[it](t)),r(e,t)}[xe](e,t){let r=this[oe];if(e)return r(e);for(let i=0;i<t.length;i++){let o=t[i];o!==void 0&&(t[i]=this[it](o))}r(e,t)}},St=class extends tu{constructor(e,t,r){super(e,t),this[$]=r}};for(let n of[At,Bt])n.prototype._next=function(e){this[oe]=e,this[$].next(this[Pe])},n.prototype._nextv=function(e,t,r){this[oe]=r,this[$].nextv(e,t,this[xe])},n.prototype._all=function(e,t){this[oe]=t,this[$].all(e,this[xe])};for(let n of[St])n.prototype._next=function(e){this[$].next(e)},n.prototype._nextv=function(e,t,r){this[$].nextv(e,t,r)},n.prototype._all=function(e,t){this[$].all(e,t)};for(let n of[At,Bt,St])n.prototype._seek=function(e,t){this[$].seek(e,t)},n.prototype._close=function(e){this[$].close(e)};ur.AbstractSublevelIterator=At;ur.AbstractSublevelKeyIterator=Bt;ur.AbstractSublevelValueIterator=St});var _o=v((nh,To)=>{"use strict";var ih=u(a()),_n=j(),{Buffer:Sn}=We()||{},{AbstractSublevelIterator:ru,AbstractSublevelKeyIterator:nu,AbstractSublevelValueIterator:iu}=vo(),se=Symbol("prefix"),bo=Symbol("upperBound"),kt=Symbol("prefixRange"),C=Symbol("parent"),An=Symbol("unfix"),Eo=new TextEncoder,ou={separator:"!"};To.exports=function({AbstractLevel:n}){class e extends n{static defaults(r){if(typeof r=="string")throw new _n("The subleveldown string shorthand for { separator } has been removed",{code:"LEVEL_LEGACY"});if(r&&r.open)throw new _n("The subleveldown open option has been removed",{code:"LEVEL_LEGACY"});return r==null?ou:r.separator?r:{...r,separator:"!"}}constructor(r,i,o){let{separator:s,manifest:c,...f}=e.defaults(o);i=cu(i,s);let h=s.charCodeAt(0)+1,l=r[C]||r;if(!Eo.encode(i).every(w=>w>h&&w<127))throw new _n(`Prefix must use bytes > ${h} < 127`,{code:"LEVEL_INVALID_PREFIX"});super(su(l,c),f);let d=(r.prefix||"")+s+i+s,y=d.slice(0,-1)+String.fromCharCode(h);this[C]=l,this[se]=new ar(d),this[bo]=new ar(y),this[An]=new kn,this.nextTick=l.nextTick}prefixKey(r,i){if(i==="utf8")return this[se].utf8+r;if(r.byteLength===0)return this[se][i];if(i==="view"){let o=this[se].view,s=new Uint8Array(o.byteLength+r.byteLength);return s.set(o,0),s.set(r,o.byteLength),s}else{let o=this[se].buffer;return Sn.concat([o,r],o.byteLength+r.byteLength)}}[kt](r,i){r.gte!==void 0?r.gte=this.prefixKey(r.gte,i):r.gt!==void 0?r.gt=this.prefixKey(r.gt,i):r.gte=this[se][i],r.lte!==void 0?r.lte=this.prefixKey(r.lte,i):r.lt!==void 0?r.lt=this.prefixKey(r.lt,i):r.lte=this[bo][i]}get prefix(){return this[se].utf8}get db(){return this[C]}_open(r,i){this[C].open({passive:!0},i)}_put(r,i,o,s){this[C].put(r,i,o,s)}_get(r,i,o){this[C].get(r,i,o)}_getMany(r,i,o){this[C].getMany(r,i,o)}_del(r,i,o){this[C].del(r,i,o)}_batch(r,i,o){this[C].batch(r,i,o)}_clear(r,i){this[kt](r,r.keyEncoding),this[C].clear(r,i)}_iterator(r){this[kt](r,r.keyEncoding);let i=this[C].iterator(r),o=this[An].get(this[se].utf8.length,r.keyEncoding);return new ru(this,r,i,o)}_keys(r){this[kt](r,r.keyEncoding);let i=this[C].keys(r),o=this[An].get(this[se].utf8.length,r.keyEncoding);return new nu(this,r,i,o)}_values(r){this[kt](r,r.keyEncoding);let i=this[C].values(r);return new iu(this,r,i)}}return{AbstractSublevel:e}};var su=function(n,e){return{...n.supports,createIfMissing:!1,errorIfExists:!1,events:{},additionalMethods:{},...e,encodings:{utf8:Bn(n,"utf8"),buffer:Bn(n,"buffer"),view:Bn(n,"view")}}},Bn=function(n,e){return n.supports.encodings[e]?n.keyEncoding(e).name===e:!1},ar=class{constructor(e){this.utf8=e,this.view=Eo.encode(e),this.buffer=Sn?Sn.from(this.view.buffer,0,this.view.byteLength):{}}},kn=class{constructor(){this.cache=new Map}get(e,t){let r=this.cache.get(t);return r===void 0&&(t==="view"?r=(function(i,o){return o.subarray(i)}).bind(null,e):r=(function(i,o){return o.slice(i)}).bind(null,e),this.cache.set(t,r)),r}},cu=function(n,e){let t=0,r=n.length;for(;t<r&&n[t]===e;)t++;for(;r>t&&n[r-1]===e;)r--;return n.slice(t,r)}});var Cn=v(Un=>{"use strict";var sh=u(a()),{supports:uu}=Ui(),{Transcoder:au}=ji(),{EventEmitter:fu}=Qi(),{fromCallback:ve}=gt(),q=j(),{AbstractIterator:De}=ge(),{DefaultKeyIterator:hu,DefaultValueIterator:du}=oo(),{DeferredIterator:lu,DeferredKeyIterator:pu,DeferredValueIterator:yu}=so(),{DefaultChainedBatch:Ao}=fo(),{getCallback:Me,getOptions:be}=Ht(),fr=po(),g=Symbol("promise"),ce=Symbol("landed"),Re=Symbol("resources"),Kn=Symbol("closeResources"),Kt=Symbol("operations"),It=Symbol("undefer"),hr=Symbol("deferOpen"),Bo=Symbol("options"),x=Symbol("status"),Fe=Symbol("defaultOptions"),ot=Symbol("transcoder"),dr=Symbol("keyEncoding"),In=Symbol("valueEncoding"),mu=()=>{},Ot=class extends fu{constructor(e,t){if(super(),typeof e!="object"||e===null)throw new TypeError("The first argument 'manifest' must be an object");t=be(t);let{keyEncoding:r,valueEncoding:i,passive:o,...s}=t;this[Re]=new Set,this[Kt]=[],this[hr]=!0,this[Bo]=s,this[x]="opening",this.supports=uu(e,{status:!0,promises:!0,clear:!0,getMany:!0,deferredOpen:!0,snapshots:e.snapshots!==!1,permanence:e.permanence!==!1,keyIterator:!0,valueIterator:!0,iteratorNextv:!0,iteratorAll:!0,encodings:e.encodings||{},events:Object.assign({},e.events,{opening:!0,open:!0,closing:!0,closed:!0,put:!0,del:!0,batch:!0,clear:!0})}),this[ot]=new au(wu(this)),this[dr]=this[ot].encoding(r||"utf8"),this[In]=this[ot].encoding(i||"utf8");for(let c of this[ot].encodings())this.supports.encodings[c.commonName]||(this.supports.encodings[c.commonName]=!0);this[Fe]={empty:Object.freeze({}),entry:Object.freeze({keyEncoding:this[dr].commonName,valueEncoding:this[In].commonName}),key:Object.freeze({keyEncoding:this[dr].commonName})},this.nextTick(()=>{this[hr]&&this.open({passive:!1},mu)})}get status(){return this[x]}keyEncoding(e){return this[ot].encoding(e??this[dr])}valueEncoding(e){return this[ot].encoding(e??this[In])}open(e,t){t=Me(e,t),t=ve(t,g),e={...this[Bo],...be(e)},e.createIfMissing=e.createIfMissing!==!1,e.errorIfExists=!!e.errorIfExists;let r=i=>{this[x]==="closing"||this[x]==="opening"?this.once(ce,i?()=>r(i):r):this[x]!=="open"?t(new q("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN",cause:i})):t()};return e.passive?this[x]==="opening"?this.once(ce,r):this.nextTick(r):this[x]==="closed"||this[hr]?(this[hr]=!1,this[x]="opening",this.emit("opening"),this._open(e,i=>{if(i){this[x]="closed",this[Kn](()=>{this.emit(ce),r(i)}),this[It]();return}this[x]="open",this[It](),this.emit(ce),this[x]==="open"&&this.emit("open"),this[x]==="open"&&this.emit("ready"),r()})):this[x]==="open"?this.nextTick(r):this.once(ce,()=>this.open(e,t)),t[g]}_open(e,t){this.nextTick(t)}close(e){e=ve(e,g);let t=r=>{this[x]==="opening"||this[x]==="closing"?this.once(ce,r?t(r):t):this[x]!=="closed"?e(new q("Database is not closed",{code:"LEVEL_DATABASE_NOT_CLOSED",cause:r})):e()};if(this[x]==="open"){this[x]="closing",this.emit("closing");let r=i=>{this[x]="open",this[It](),this.emit(ce),t(i)};this[Kn](()=>{this._close(i=>{if(i)return r(i);this[x]="closed",this[It](),this.emit(ce),this[x]==="closed"&&this.emit("closed"),t()})})}else this[x]==="closed"?this.nextTick(t):this.once(ce,()=>this.close(e));return e[g]}[Kn](e){if(this[Re].size===0)return this.nextTick(e);let t=this[Re].size,r=!0,i=()=>{--t===0&&(r?this.nextTick(e):e())};for(let o of this[Re])o.close(i);r=!1,this[Re].clear()}_close(e){this.nextTick(e)}get(e,t,r){if(r=Me(t,r),r=ve(r,g),t=be(t,this[Fe].entry),this[x]==="opening")return this.defer(()=>this.get(e,t,r)),r[g];if(st(this,r))return r[g];let i=this._checkKey(e);if(i)return this.nextTick(r,i),r[g];let o=this.keyEncoding(t.keyEncoding),s=this.valueEncoding(t.valueEncoding),c=o.format,f=s.format;return(t.keyEncoding!==c||t.valueEncoding!==f)&&(t=Object.assign({},t,{keyEncoding:c,valueEncoding:f})),this._get(this.prefixKey(o.encode(e),c),t,(h,l)=>{if(h)return(h.code==="LEVEL_NOT_FOUND"||h.notFound||/NotFound/i.test(h))&&(h.code||(h.code="LEVEL_NOT_FOUND"),h.notFound||(h.notFound=!0),h.status||(h.status=404)),r(h);try{l=s.decode(l)}catch(d){return r(new q("Could not decode value",{code:"LEVEL_DECODE_ERROR",cause:d}))}r(null,l)}),r[g]}_get(e,t,r){this.nextTick(r,new Error("NotFound"))}getMany(e,t,r){if(r=Me(t,r),r=ve(r,g),t=be(t,this[Fe].entry),this[x]==="opening")return this.defer(()=>this.getMany(e,t,r)),r[g];if(st(this,r))return r[g];if(!Array.isArray(e))return this.nextTick(r,new TypeError("The first argument 'keys' must be an array")),r[g];if(e.length===0)return this.nextTick(r,null,[]),r[g];let i=this.keyEncoding(t.keyEncoding),o=this.valueEncoding(t.valueEncoding),s=i.format,c=o.format;(t.keyEncoding!==s||t.valueEncoding!==c)&&(t=Object.assign({},t,{keyEncoding:s,valueEncoding:c}));let f=new Array(e.length);for(let h=0;h<e.length;h++){let l=e[h],d=this._checkKey(l);if(d)return this.nextTick(r,d),r[g];f[h]=this.prefixKey(i.encode(l),s)}return this._getMany(f,t,(h,l)=>{if(h)return r(h);try{for(let d=0;d<l.length;d++)l[d]!==void 0&&(l[d]=o.decode(l[d]))}catch(d){return r(new q(`Could not decode one or more of ${l.length} value(s)`,{code:"LEVEL_DECODE_ERROR",cause:d}))}r(null,l)}),r[g]}_getMany(e,t,r){this.nextTick(r,null,new Array(e.length).fill(void 0))}put(e,t,r,i){if(i=Me(r,i),i=ve(i,g),r=be(r,this[Fe].entry),this[x]==="opening")return this.defer(()=>this.put(e,t,r,i)),i[g];if(st(this,i))return i[g];let o=this._checkKey(e)||this._checkValue(t);if(o)return this.nextTick(i,o),i[g];let s=this.keyEncoding(r.keyEncoding),c=this.valueEncoding(r.valueEncoding),f=s.format,h=c.format;(r.keyEncoding!==f||r.valueEncoding!==h)&&(r=Object.assign({},r,{keyEncoding:f,valueEncoding:h}));let l=this.prefixKey(s.encode(e),f),d=c.encode(t);return this._put(l,d,r,y=>{if(y)return i(y);this.emit("put",e,t),i()}),i[g]}_put(e,t,r,i){this.nextTick(i)}del(e,t,r){if(r=Me(t,r),r=ve(r,g),t=be(t,this[Fe].key),this[x]==="opening")return this.defer(()=>this.del(e,t,r)),r[g];if(st(this,r))return r[g];let i=this._checkKey(e);if(i)return this.nextTick(r,i),r[g];let o=this.keyEncoding(t.keyEncoding),s=o.format;return t.keyEncoding!==s&&(t=Object.assign({},t,{keyEncoding:s})),this._del(this.prefixKey(o.encode(e),s),t,c=>{if(c)return r(c);this.emit("del",e),r()}),r[g]}_del(e,t,r){this.nextTick(r)}batch(e,t,r){if(!arguments.length){if(this[x]==="opening")return new Ao(this);if(this[x]!=="open")throw new q("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._chainedBatch()}if(typeof e=="function"?r=e:r=Me(t,r),r=ve(r,g),t=be(t,this[Fe].empty),this[x]==="opening")return this.defer(()=>this.batch(e,t,r)),r[g];if(st(this,r))return r[g];if(!Array.isArray(e))return this.nextTick(r,new TypeError("The first argument 'operations' must be an array")),r[g];if(e.length===0)return this.nextTick(r),r[g];let i=new Array(e.length),{keyEncoding:o,valueEncoding:s,...c}=t;for(let f=0;f<e.length;f++){if(typeof e[f]!="object"||e[f]===null)return this.nextTick(r,new TypeError("A batch operation must be an object")),r[g];let h=Object.assign({},e[f]);if(h.type!=="put"&&h.type!=="del")return this.nextTick(r,new TypeError("A batch operation must have a type property that is 'put' or 'del'")),r[g];let l=this._checkKey(h.key);if(l)return this.nextTick(r,l),r[g];let d=h.sublevel!=null?h.sublevel:this,y=d.keyEncoding(h.keyEncoding||o),w=y.format;if(h.key=d.prefixKey(y.encode(h.key),w),h.keyEncoding=w,h.type==="put"){let m=this._checkValue(h.value);if(m)return this.nextTick(r,m),r[g];let b=d.valueEncoding(h.valueEncoding||s);h.value=b.encode(h.value),h.valueEncoding=b.format}d!==this&&(h.sublevel=null),i[f]=h}return this._batch(i,c,f=>{if(f)return r(f);this.emit("batch",e),r()}),r[g]}_batch(e,t,r){this.nextTick(r)}sublevel(e,t){return this._sublevel(e,On.defaults(t))}_sublevel(e,t){return new On(this,e,t)}prefixKey(e,t){return e}clear(e,t){if(t=Me(e,t),t=ve(t,g),e=be(e,this[Fe].empty),this[x]==="opening")return this.defer(()=>this.clear(e,t)),t[g];if(st(this,t))return t[g];let r=e,i=this.keyEncoding(e.keyEncoding);return e=fr(e,i),e.keyEncoding=i.format,e.limit===0?this.nextTick(t):this._clear(e,o=>{if(o)return t(o);this.emit("clear",r),t()}),t[g]}_clear(e,t){this.nextTick(t)}iterator(e){let t=this.keyEncoding(e&&e.keyEncoding),r=this.valueEncoding(e&&e.valueEncoding);if(e=fr(e,t),e.keys=e.keys!==!1,e.values=e.values!==!1,e[De.keyEncoding]=t,e[De.valueEncoding]=r,e.keyEncoding=t.format,e.valueEncoding=r.format,this[x]==="opening")return new lu(this,e);if(this[x]!=="open")throw new q("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._iterator(e)}_iterator(e){return new De(this,e)}keys(e){let t=this.keyEncoding(e&&e.keyEncoding),r=this.valueEncoding(e&&e.valueEncoding);if(e=fr(e,t),e[De.keyEncoding]=t,e[De.valueEncoding]=r,e.keyEncoding=t.format,e.valueEncoding=r.format,this[x]==="opening")return new pu(this,e);if(this[x]!=="open")throw new q("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._keys(e)}_keys(e){return new hu(this,e)}values(e){let t=this.keyEncoding(e&&e.keyEncoding),r=this.valueEncoding(e&&e.valueEncoding);if(e=fr(e,t),e[De.keyEncoding]=t,e[De.valueEncoding]=r,e.keyEncoding=t.format,e.valueEncoding=r.format,this[x]==="opening")return new yu(this,e);if(this[x]!=="open")throw new q("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"});return this._values(e)}_values(e){return new du(this,e)}defer(e){if(typeof e!="function")throw new TypeError("The first argument must be a function");this[Kt].push(e)}[It](){if(this[Kt].length===0)return;let e=this[Kt];this[Kt]=[];for(let t of e)t()}attachResource(e){if(typeof e!="object"||e===null||typeof e.close!="function")throw new TypeError("The first argument must be a resource object");this[Re].add(e)}detachResource(e){this[Re].delete(e)}_chainedBatch(){return new Ao(this)}_checkKey(e){if(e==null)return new q("Key cannot be null or undefined",{code:"LEVEL_INVALID_KEY"})}_checkValue(e){if(e==null)return new q("Value cannot be null or undefined",{code:"LEVEL_INVALID_VALUE"})}};Ot.prototype.nextTick=xo();var{AbstractSublevel:On}=_o()({AbstractLevel:Ot});Un.AbstractLevel=Ot;Un.AbstractSublevel=On;var st=function(n,e){return n[x]!=="open"?(n.nextTick(e,new q("Database is not open",{code:"LEVEL_DATABASE_NOT_OPEN"})),!0):!1},wu=function(n){return Object.keys(n.supports.encodings).filter(e=>!!n.supports.encodings[e])}});var Ln=v(Ne=>{"use strict";var uh=u(a());Ne.AbstractLevel=Cn().AbstractLevel;Ne.AbstractSublevel=Cn().AbstractSublevel;Ne.AbstractIterator=ge().AbstractIterator;Ne.AbstractKeyIterator=ge().AbstractKeyIterator;Ne.AbstractValueIterator=ge().AbstractValueIterator;Ne.AbstractChainedBatch=bn().AbstractChainedBatch});var ko=v((ah,So)=>{var fh=u(a());So.exports=xu;var gu=Tn();function xu(n,e,t){if(typeof e!="number")throw new Error("second argument must be a Number");let r,i,o,s,c,f=!0,h;Array.isArray(n)?(r=[],o=i=n.length):(s=Object.keys(n),r={},o=i=s.length);function l(y){function w(){t&&t(y,r),t=null}f?gu(w):w()}function d(y,w,m){if(r[y]=m,w&&(c=!0),--o===0||w)l(w);else if(!c&&h<i){let b;s?(b=s[h],h+=1,n[b](function(N,B){d(b,N,B)})):(b=h,h+=1,n[b](function(N,B){d(b,N,B)}))}}h=e,o?s?s.some(function(y,w){return n[y](function(m,b){d(y,m,b)}),w===e-1}):n.some(function(y,w){return y(function(m,b){d(w,m,b)}),w===e-1}):l(null),f=!1}});var Pn=v((hh,Ko)=>{"use strict";var dh=u(a());Ko.exports=function(e){let t=e.gte!==void 0?e.gte:e.gt!==void 0?e.gt:void 0,r=e.lte!==void 0?e.lte:e.lt!==void 0?e.lt:void 0,i=e.gte===void 0,o=e.lte===void 0;return t!==void 0&&r!==void 0?IDBKeyRange.bound(t,r,i,o):t!==void 0?IDBKeyRange.lowerBound(t,i):r!==void 0?IDBKeyRange.upperBound(r,o):null}});var Dn=v((lh,Io)=>{"use strict";var ph=u(a()),vu=new TextEncoder;Io.exports=function(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):vu.encode(n)}});var Po=v(Lo=>{"use strict";var mh=u(a()),{AbstractIterator:bu}=Ln(),Oo=Pn(),lr=Dn(),ee=Symbol("cache"),ue=Symbol("finished"),L=Symbol("options"),ae=Symbol("currentOptions"),Ve=Symbol("position"),Mn=Symbol("location"),ct=Symbol("first"),Uo={},Rn=class extends bu{constructor(e,t,r){super(e,r),this[ee]=[],this[ue]=this.limit===0,this[L]=r,this[ae]={...r},this[Ve]=void 0,this[Mn]=t,this[ct]=!0}_nextv(e,t,r){if(this[ct]=!1,this[ue])return this.nextTick(r,null,[]);if(this[ee].length>0)return e=Math.min(e,this[ee].length),this.nextTick(r,null,this[ee].splice(0,e));this[Ve]!==void 0&&(this[L].reverse?(this[ae].lt=this[Ve],this[ae].lte=void 0):(this[ae].gt=this[Ve],this[ae].gte=void 0));let i;try{i=Oo(this[ae])}catch{return this[ue]=!0,this.nextTick(r,null,[])}let o=this.db.db.transaction([this[Mn]],"readonly"),s=o.objectStore(this[Mn]),c=[];if(this[L].reverse){let f=!this[L].values&&s.openKeyCursor?"openKeyCursor":"openCursor";s[f](i,"prev").onsuccess=h=>{let l=h.target.result;if(l){let{key:d,value:y}=l;this[Ve]=d,c.push([this[L].keys&&d!==void 0?lr(d):void 0,this[L].values&&y!==void 0?lr(y):void 0]),c.length<e?l.continue():Co(o)}else this[ue]=!0}}else{let f,h,l=()=>{if(f===void 0||h===void 0)return;let d=Math.max(f.length,h.length);d===0||e===1/0?this[ue]=!0:this[Ve]=f[d-1],c.length=d;for(let y=0;y<d;y++){let w=f[y],m=h[y];c[y]=[this[L].keys&&w!==void 0?lr(w):void 0,this[L].values&&m!==void 0?lr(m):void 0]}Co(o)};this[L].keys||e<1/0?s.getAllKeys(i,e<1/0?e:void 0).onsuccess=d=>{f=d.target.result,l()}:(f=[],this.nextTick(l)),this[L].values?s.getAll(i,e<1/0?e:void 0).onsuccess=d=>{h=d.target.result,l()}:(h=[],this.nextTick(l))}o.onabort=()=>{r(o.error||new Error("aborted by user")),r=null},o.oncomplete=()=>{r(null,c),r=null}}_next(e){if(this[ee].length>0){let[t,r]=this[ee].shift();this.nextTick(e,null,t,r)}else if(this[ue])this.nextTick(e);else{let t=Math.min(100,this.limit-this.count);this[ct]&&(this[ct]=!1,t=1),this._nextv(t,Uo,(r,i)=>{if(r)return e(r);this[ee]=i,this._next(e)})}}_all(e,t){this[ct]=!1;let r=this[ee].splice(0,this[ee].length),i=this.limit-this.count-r.length;if(i<=0)return this.nextTick(t,null,r);this._nextv(i,Uo,(o,s)=>{if(o)return t(o);r.length>0&&(s=r.concat(s)),t(null,s)})}_seek(e,t){this[ct]=!0,this[ee]=[],this[ue]=!1,this[Ve]=void 0,this[ae]={...this[L]};let r;try{r=Oo(this[L])}catch{this[ue]=!0;return}r!==null&&!r.includes(e)?this[ue]=!0:this[L].reverse?this[ae].lte=e:this[ae].gte=e}};Lo.Iterator=Rn;function Co(n){typeof n.commit=="function"&&n.commit()}});var Mo=v((wh,Do)=>{"use strict";var gh=u(a());Do.exports=function(e,t,r,i,o){if(i.limit===0)return e.nextTick(o);let s=e.db.transaction([t],"readwrite"),c=s.objectStore(t),f=0;s.oncomplete=function(){o()},s.onabort=function(){o(s.error||new Error("aborted by user"))};let h=c.openKeyCursor?"openKeyCursor":"openCursor",l=i.reverse?"prev":"next";c[h](r,l).onsuccess=function(d){let y=d.target.result;y&&(c.delete(y.key).onsuccess=function(){(i.limit<=0||++f<i.limit)&&y.continue()})}}});var $o=v(jo=>{"use strict";var vh=u(a()),{AbstractLevel:Eu}=Ln(),Ro=j(),Tu=ko(),{fromCallback:_u}=gt(),{Iterator:Au}=Po(),Fo=Dn(),Bu=Mo(),Su=Pn(),Vo="level-js-",Ut=Symbol("idb"),Fn=Symbol("namePrefix"),fe=Symbol("location"),Nn=Symbol("version"),je=Symbol("store"),Ct=Symbol("onComplete"),No=Symbol("promise"),pr=class extends Eu{constructor(e,t,r){if(typeof t=="function"||typeof r=="function")throw new Ro("The levelup-style callback argument has been removed",{code:"LEVEL_LEGACY"});let{prefix:i,version:o,...s}=t||{};if(super({encodings:{view:!0},snapshots:!1,createIfMissing:!1,errorIfExists:!1,seek:!0},s),typeof e!="string")throw new Error("constructor requires a location string argument");this[fe]=e,this[Fn]=i??Vo,this[Nn]=parseInt(o||1,10),this[Ut]=null}get location(){return this[fe]}get namePrefix(){return this[Fn]}get version(){return this[Nn]}get db(){return this[Ut]}get type(){return"browser-level"}_open(e,t){let r=indexedDB.open(this[Fn]+this[fe],this[Nn]);r.onerror=function(){t(r.error||new Error("unknown error"))},r.onsuccess=()=>{this[Ut]=r.result,t()},r.onupgradeneeded=i=>{let o=i.target.result;o.objectStoreNames.contains(this[fe])||o.createObjectStore(this[fe])}}[je](e){return this[Ut].transaction([this[fe]],e).objectStore(this[fe])}[Ct](e,t){let r=e.transaction;r.onabort=function(){t(r.error||new Error("aborted by user"))},r.oncomplete=function(){t(null,e.result)}}_get(e,t,r){let i=this[je]("readonly"),o;try{o=i.get(e)}catch(s){return this.nextTick(r,s)}this[Ct](o,function(s,c){if(s)return r(s);if(c===void 0)return r(new Ro("Entry not found",{code:"LEVEL_NOT_FOUND"}));r(null,Fo(c))})}_getMany(e,t,r){let i=this[je]("readonly"),o=e.map(s=>c=>{let f;try{f=i.get(s)}catch(h){return c(h)}f.onsuccess=()=>{let h=f.result;c(null,h===void 0?h:Fo(h))},f.onerror=h=>{h.stopPropagation(),c(f.error)}});Tu(o,16,r)}_del(e,t,r){let i=this[je]("readwrite"),o;try{o=i.delete(e)}catch(s){return this.nextTick(r,s)}this[Ct](o,r)}_put(e,t,r,i){let o=this[je]("readwrite"),s;try{s=o.put(t,e)}catch(c){return this.nextTick(i,c)}this[Ct](s,i)}_iterator(e){return new Au(this,this[fe],e)}_batch(e,t,r){let i=this[je]("readwrite"),o=i.transaction,s=0,c;o.onabort=function(){r(c||o.error||new Error("aborted by user"))},o.oncomplete=function(){r()};function f(){let h=e[s++],l=h.key,d;try{d=h.type==="del"?i.delete(l):i.put(h.value,l)}catch(y){c=y,o.abort();return}s<e.length?d.onsuccess=f:typeof o.commit=="function"&&o.commit()}f()}_clear(e,t){let r,i;try{r=Su(e)}catch{return this.nextTick(t)}if(e.limit>=0)return Bu(this,this[fe],r,e,t);try{let o=this[je]("readwrite");i=r?o.delete(r):o.clear()}catch(o){return this.nextTick(t,o)}this[Ct](i,t)}_close(e){this[Ut].close(),this.nextTick(e)}};pr.destroy=function(n,e,t){typeof e=="function"&&(t=e,e=Vo),t=_u(t,No);let r=indexedDB.deleteDatabase(e+n);return r.onsuccess=function(){t()},r.onerror=function(i){t(i)},t[No]};jo.BrowserLevel=pr});var Jo=v(qo=>{var Eh=u(a());qo.Level=$o().BrowserLevel});var Vp=u(a(),1);var Yl=u(a(),1);var Wu=u(a(),1);var Cr;(function(n){n.AlgorithmNotSupported="algorithmNotSupported",n.EncodingError="encodingError",n.InvalidJwe="invalidJwe",n.InvalidJwk="invalidJwk",n.OperationNotSupported="operationNotSupported"})(Cr||(Cr={}));var Qd=u(a(),1);var Kh=u(a(),1);var Xu=u(a(),1),Js=u(yi(),1);var Ca=u(a(),1);var ya=u(a(),1);var oa=u(a(),1);var Qu=u(a(),1),Zu=new Uint8Array(0);function mi(n,e){if(n===e)return!0;if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.byteLength;t++)if(n[t]!==e[t])return!1;return!0}function He(n){if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")}var ta=u(a(),1);function Ws(n,e){if(n.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<n.length;i++){var o=n.charAt(i),s=o.charCodeAt(0);if(t[s]!==255)throw new TypeError(o+" is ambiguous");t[s]=i}var c=n.length,f=n.charAt(0),h=Math.log(c)/Math.log(256),l=Math.log(256)/Math.log(c);function d(m){if(m instanceof Uint8Array||(ArrayBuffer.isView(m)?m=new Uint8Array(m.buffer,m.byteOffset,m.byteLength):Array.isArray(m)&&(m=Uint8Array.from(m))),!(m instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(m.length===0)return"";for(var b=0,N=0,B=0,G=m.length;B!==G&&m[B]===0;)B++,b++;for(var W=(G-B)*l+1>>>0,D=new Uint8Array(W);B!==G;){for(var H=m[B],he=0,V=W-1;(H!==0||he<N)&&V!==-1;V--,he++)H+=256*D[V]>>>0,D[V]=H%c>>>0,H=H/c>>>0;if(H!==0)throw new Error("Non-zero carry");N=he,B++}for(var te=W-N;te!==W&&D[te]===0;)te++;for(var Pt=f.repeat(b);te<W;++te)Pt+=n.charAt(D[te]);return Pt}function y(m){if(typeof m!="string")throw new TypeError("Expected String");if(m.length===0)return new Uint8Array;var b=0;if(m[b]!==" "){for(var N=0,B=0;m[b]===f;)N++,b++;for(var G=(m.length-b)*h+1>>>0,W=new Uint8Array(G);m[b];){var D=t[m.charCodeAt(b)];if(D===255)return;for(var H=0,he=G-1;(D!==0||H<B)&&he!==-1;he--,H++)D+=c*W[he]>>>0,W[he]=D%256>>>0,D=D/256>>>0;if(D!==0)throw new Error("Non-zero carry");B=H,b++}if(m[b]!==" "){for(var V=G-B;V!==G&&W[V]===0;)V++;for(var te=new Uint8Array(N+(G-V)),Pt=N;V!==G;)te[Pt++]=W[V++];return te}}}function w(m){var b=y(m);if(b)return b;throw new Error(`Non-${e} character`)}return{encode:d,decodeUnsafe:y,decode:w}}var Hs=Ws,zs=Hs,wi=zs;var Dr=class{name;prefix;baseEncode;constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}},Mr=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,t,r){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if(typeof e=="string"){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(e){return gi(this,e)}},Rr=class{decoders;constructor(e){this.decoders=e}or(e){return gi(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r!=null)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};function gi(n,e){return new Rr({...n.decoders??{[n.prefix]:n},...e.decoders??{[e.prefix]:e}})}var Fr=class{name;prefix;baseEncode;baseDecode;encoder;decoder;constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new Dr(e,t,r),this.decoder=new Mr(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function xi({name:n,prefix:e,encode:t,decode:r}){return new Fr(n,e,t,r)}function Nr({name:n,prefix:e,alphabet:t}){let{encode:r,decode:i}=wi(t,n);return xi({prefix:e,name:n,encode:r,decode:o=>He(i(o))})}function Ys(n,e,t,r){let i={};for(let l=0;l<e.length;++l)i[e[l]]=l;let o=n.length;for(;n[o-1]==="=";)--o;let s=new Uint8Array(o*t/8|0),c=0,f=0,h=0;for(let l=0;l<o;++l){let d=i[n[l]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);f=f<<t|d,c+=t,c>=8&&(c-=8,s[h++]=255&f>>c)}if(c>=t||255&f<<8-c)throw new SyntaxError("Unexpected end of data");return s}function Xs(n,e,t){let r=e[e.length-1]==="=",i=(1<<t)-1,o="",s=0,c=0;for(let f=0;f<n.length;++f)for(c=c<<8|n[f],s+=8;s>t;)s-=t,o+=e[i&c>>s];if(s!==0&&(o+=e[i&c<<t-s]),r)for(;o.length*t&7;)o+="=";return o}function S({name:n,prefix:e,bitsPerChar:t,alphabet:r}){return xi({prefix:e,name:n,encode(i){return Xs(i,r,t)},decode(i){return Ys(i,r,t,n)}})}var at=S({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ca=S({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ua=S({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),aa=S({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fa=S({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ha=S({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),da=S({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),la=S({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Vr=S({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var xa=u(a(),1);var K=Nr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wa=Nr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Aa=u(a(),1);var ba=S({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ea=S({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),X=S({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ta=S({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Sa=u(a(),1);function vi(n){return n.byteOffset!==0||n.byteLength!==n.buffer.byteLength}function bi(n){return typeof n!="object"||n===null?!1:typeof n[Symbol.asyncIterator]=="function"}function Nt(n){let t=Object.prototype.toString.call(n).match(/\s([a-zA-Z0-9]+)/),[r,i]=t;return i}var ft=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function c(l){try{h(r.next(l))}catch(d){s(d)}}function f(l){try{h(r.throw(l))}catch(d){s(d)}}function h(l){l.done?o(l.value):i(l.value).then(c,f)}h((r=r.apply(n,e||[])).next())})},Ei=function(n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=n[Symbol.asyncIterator],t;return e?e.call(n):(n=typeof __values=="function"?__values(n):n[Symbol.iterator](),t={},r("next"),r("throw"),r("return"),t[Symbol.asyncIterator]=function(){return this},t);function r(o){t[o]=n[o]&&function(s){return new Promise(function(c,f){s=n[o](s),i(c,f,s.done,s.value)})}}function i(o,s,c,f){Promise.resolve(f).then(function(h){o({value:h,done:c})},s)}},Vt=new TextEncoder,Be=new TextDecoder,T=class n{constructor(e,t){this.data=e,this.format=t}static arrayBuffer(e){return new n(e,"ArrayBuffer")}static asyncIterable(e){if(!bi(e))throw new TypeError("Input must be of type AsyncIterable.");return new n(e,"AsyncIterable")}static base32Z(e){return new n(e,"Base32Z")}static base58Btc(e){return new n(e,"Base58Btc")}static base64Url(e){return new n(e,"Base64Url")}static bufferSource(e){return new n(e,"BufferSource")}static hex(e){if(typeof e!="string")throw new TypeError("Hex input must be a string.");if(e.length%2!==0)throw new TypeError("Hex input must have an even number of characters.");return new n(e,"Hex")}static multibase(e){return new n(e,"Multibase")}static object(e){return new n(e,"Object")}static string(e){return new n(e,"String")}static uint8Array(e){return new n(e,"Uint8Array")}toArrayBuffer(){switch(this.format){case"Base58Btc":return K.baseDecode(this.data).buffer;case"Base64Url":return X.baseDecode(this.data).buffer;case"BufferSource":{if(Nt(this.data)==="ArrayBuffer")return this.data;if(ArrayBuffer.isView(this.data))return vi(this.data)?this.data.buffer.slice(this.data.byteOffset,this.data.byteOffset+this.data.byteLength):this.data.buffer;throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":return this.toUint8Array().buffer;case"String":return this.toUint8Array().buffer;case"Uint8Array":return this.data.buffer;default:throw new TypeError(`Conversion from ${this.format} to ArrayBuffer is not supported.`)}}toArrayBufferAsync(){return ft(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":return yield(yield this.toBlobAsync()).arrayBuffer();default:throw new TypeError(`Asynchronous conversion from ${this.format} to ArrayBuffer is not supported.`)}})}toBase32Z(){switch(this.format){case"Uint8Array":return Vr.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Z is not supported.`)}}toBase58Btc(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return K.baseEncode(e)}case"Multibase":return this.data.substring(1);case"Uint8Array":return K.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base58Btc is not supported.`)}}toBase64Url(){switch(this.format){case"ArrayBuffer":{let e=new Uint8Array(this.data);return X.baseEncode(e)}case"BufferSource":{let e=this.toUint8Array();return X.baseEncode(e)}case"Object":{let e=JSON.stringify(this.data),t=Vt.encode(e);return X.baseEncode(t)}case"String":{let e=Vt.encode(this.data);return X.baseEncode(e)}case"Uint8Array":return X.baseEncode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Base64Url is not supported.`)}}toBlobAsync(){return ft(this,void 0,void 0,function*(){var e,t,r,i;switch(this.format){case"AsyncIterable":{let f=[];try{for(var o=!0,s=Ei(this.data),c;c=yield s.next(),e=c.done,!e;o=!0){i=c.value,o=!1;let l=i;f.push(l)}}catch(l){t={error:l}}finally{try{!o&&!e&&(r=s.return)&&(yield r.call(s))}finally{if(t)throw t.error}}return new Blob(f)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Blob is not supported.`)}})}toHex(){let e=Array.from({length:256},(t,r)=>r.toString(16).padStart(2,"0"));switch(this.format){case"ArrayBuffer":{let t=this.toUint8Array();return n.uint8Array(t).toHex()}case"Base64Url":{let t=this.toUint8Array();return n.uint8Array(t).toHex()}case"Uint8Array":{let t="";for(let r=0;r<this.data.length;r++)t+=e[this.data[r]];return t}default:throw new TypeError(`Conversion from ${this.format} to Hex is not supported.`)}}toMultibase(){switch(this.format){case"Base58Btc":return`z${this.data}`;default:throw new TypeError(`Conversion from ${this.format} to Multibase is not supported.`)}}toObject(){switch(this.format){case"Base64Url":{let e=X.baseDecode(this.data),t=Be.decode(e);return JSON.parse(t)}case"String":return JSON.parse(this.data);case"Uint8Array":{let e=Be.decode(this.data);return JSON.parse(e)}default:throw new TypeError(`Conversion from ${this.format} to Object is not supported.`)}}toObjectAsync(){return ft(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toStringAsync();return JSON.parse(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Object is not supported.`)}})}toString(){switch(this.format){case"ArrayBuffer":return Be.decode(this.data);case"Base64Url":{let e=X.baseDecode(this.data);return Be.decode(e)}case"Object":return JSON.stringify(this.data);case"Uint8Array":return Be.decode(this.data);default:throw new TypeError(`Conversion from ${this.format} to String is not supported.`)}}toStringAsync(){return ft(this,void 0,void 0,function*(){var e,t,r,i;switch(this.format){case"AsyncIterable":{let f="";try{for(var o=!0,s=Ei(this.data),c;c=yield s.next(),e=c.done,!e;o=!0){i=c.value,o=!1;let h=i;typeof h=="string"?f+=h:f+=Be.decode(h,{stream:!0})}}catch(h){t={error:h}}finally{try{!o&&!e&&(r=s.return)&&(yield r.call(s))}finally{if(t)throw t.error}}return f+=Be.decode(void 0,{stream:!1}),f}default:throw new TypeError(`Asynchronous conversion from ${this.format} to String is not supported.`)}})}toUint8Array(){switch(this.format){case"ArrayBuffer":return new Uint8Array(this.data);case"Base32Z":return Vr.baseDecode(this.data);case"Base58Btc":return K.baseDecode(this.data);case"Base64Url":return X.baseDecode(this.data);case"BufferSource":{let e=Nt(this.data);if(e==="Uint8Array")return this.data;if(e==="ArrayBuffer")return new Uint8Array(this.data);if(ArrayBuffer.isView(this.data))return new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength);throw new TypeError(`${this.format} value is not of type: ArrayBuffer, DataView, or TypedArray.`)}case"Hex":{let e=new Uint8Array(this.data.length/2);for(let t=0;t<this.data.length;t+=2){let r=parseInt(this.data.substring(t,t+2),16);if(isNaN(r))throw new TypeError("Input is not a valid hexadecimal string.");e[t/2]=r}return e}case"Object":{let e=JSON.stringify(this.data);return Vt.encode(e)}case"String":return Vt.encode(this.data);default:throw new TypeError(`Conversion from ${this.format} to Uint8Array is not supported.`)}}toUint8ArrayAsync(){return ft(this,void 0,void 0,function*(){switch(this.format){case"AsyncIterable":{let e=yield this.toArrayBufferAsync();return new Uint8Array(e)}default:throw new TypeError(`Asynchronous conversion from ${this.format} to Uint8Array is not supported.`)}})}};var Pa=u(a(),1),ht;(function(n){n.Debug="debug",n.Silent="silent"})(ht||(ht={}));var jr=class{constructor(){this.logLevel=ht.Silent}setLogLevel(e){this.logLevel=e}log(e){this.info(e)}info(e){this.logLevel!==ht.Silent&&console.info(e)}error(e){this.logLevel!==ht.Silent&&console.error(e)}},Zs=new jr;typeof window<"u"&&(window.web5logger=Zs);var lf=u(a(),1);var af=u(a(),1);var Wa=u(a(),1);var Va=u(a(),1);var ne={};us(ne,{decode:()=>ze,encodeTo:()=>Se,encodingLength:()=>ke});var Fa=u(a(),1);var Ma=u(a(),1),Qs=Ai,Ti=128,ec=127,tc=~ec,rc=Math.pow(2,31);function Ai(n,e,t){e=e||[],t=t||0;for(var r=t;n>=rc;)e[t++]=n&255|Ti,n/=128;for(;n&tc;)e[t++]=n&255|Ti,n>>>=7;return e[t]=n|0,Ai.bytes=t-r+1,e}var nc=$r,ic=128,_i=127;function $r(n,r){var t=0,r=r||0,i=0,o=r,s,c=n.length;do{if(o>=c)throw $r.bytes=0,new RangeError("Could not decode varint");s=n[o++],t+=i<28?(s&_i)<<i:(s&_i)*Math.pow(2,i),i+=7}while(s>=ic);return $r.bytes=o-r,t}var oc=Math.pow(2,7),sc=Math.pow(2,14),cc=Math.pow(2,21),uc=Math.pow(2,28),ac=Math.pow(2,35),fc=Math.pow(2,42),hc=Math.pow(2,49),dc=Math.pow(2,56),lc=Math.pow(2,63),pc=function(n){return n<oc?1:n<sc?2:n<cc?3:n<uc?4:n<ac?5:n<fc?6:n<hc?7:n<dc?8:n<lc?9:10},yc={encode:Qs,decode:nc,encodingLength:pc},mc=yc,dt=mc;function ze(n,e=0){return[dt.decode(n,e),dt.decode.bytes]}function Se(n,e,t=0){return dt.encode(n,e,t),e}function ke(n){return dt.encodingLength(n)}function qr(n,e){let t=e.byteLength,r=ke(n),i=r+ke(t),o=new Uint8Array(i+t);return Se(n,o,0),Se(t,o,r),o.set(e,i),new Ye(n,t,e,o)}function Bi(n){let e=He(n),[t,r]=ze(e),[i,o]=ze(e.subarray(r)),s=e.subarray(r+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ye(t,i,s,e)}function Si(n,e){if(n===e)return!0;{let t=e;return n.code===t.code&&n.size===t.size&&t.bytes instanceof Uint8Array&&mi(n.bytes,t.bytes)}}var Ye=class{code;size;digest;bytes;constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}};var ja=u(a(),1);function ki(n,e){let{bytes:t,version:r}=n;switch(r){case 0:return gc(t,Gr(n),e??K.encoder);default:return xc(t,Gr(n),e??at.encoder)}}var Ki=new WeakMap;function Gr(n){let e=Ki.get(n);if(e==null){let t=new Map;return Ki.set(n,t),t}return e}var Wr=class n{code;version;multihash;bytes;"/";constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this["/"]=i}get asCID(){return this}get byteOffset(){return this.bytes.byteOffset}get byteLength(){return this.bytes.byteLength}toV0(){switch(this.version){case 0:return this;case 1:{let{code:e,multihash:t}=this;if(e!==lt)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==vc)throw new Error("Cannot convert non sha2-256 multihash CID to CIDv0");return n.createV0(t)}default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,r=qr(e,t);return n.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 1. This is a bug please report`)}}equals(e){return n.equals(this,e)}static equals(e,t){let r=t;return r!=null&&e.code===r.code&&e.version===r.version&&Si(e.multihash,r.multihash)}toString(e){return ki(this,e)}toJSON(){return{"/":ki(this)}}link(){return this}[Symbol.toStringTag]="CID";[Symbol.for("nodejs.util.inspect.custom")](){return`CID(${this.toString()})`}static asCID(e){if(e==null)return null;let t=e;if(t instanceof n)return t;if(t["/"]!=null&&t["/"]===t.bytes||t.asCID===t){let{version:r,code:i,multihash:o,bytes:s}=t;return new n(r,i,o,s??Ii(r,i,o.bytes))}else if(t[bc]===!0){let{version:r,multihash:i,code:o}=t,s=Bi(i);return n.create(r,o,s)}else return null}static create(e,t,r){if(typeof t!="number")throw new Error("String codecs are no longer supported");if(!(r.bytes instanceof Uint8Array))throw new Error("Invalid digest");switch(e){case 0:{if(t!==lt)throw new Error(`Version 0 CID must use dag-pb (code: ${lt}) block encoding`);return new n(e,t,r,r.bytes)}case 1:{let i=Ii(e,t,r.bytes);return new n(e,t,r,i)}default:throw new Error("Invalid version")}}static createV0(e){return n.create(0,lt,e)}static createV1(e,t){return n.create(1,e,t)}static decode(e){let[t,r]=n.decodeFirst(e);if(r.length!==0)throw new Error("Incorrect length");return t}static decodeFirst(e){let t=n.inspectBytes(e),r=t.size-t.multihashSize,i=He(e.subarray(r,r+t.multihashSize));if(i.byteLength!==t.multihashSize)throw new Error("Incorrect length");let o=i.subarray(t.multihashSize-t.digestSize),s=new Ye(t.multihashCode,t.digestSize,o,i);return[t.version===0?n.createV0(s):n.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,r=()=>{let[d,y]=ze(e.subarray(t));return t+=y,d},i=r(),o=lt;if(i===18?(i=0,t=0):o=r(),i!==0&&i!==1)throw new RangeError(`Invalid CID version ${i}`);let s=t,c=r(),f=r(),h=t+f,l=h-s;return{version:i,codec:o,multihashCode:c,digestSize:f,multihashSize:l,size:h}}static parse(e,t){let[r,i]=wc(e,t),o=n.decode(i);if(o.version===0&&e[0]!=="Q")throw Error("Version 0 CID string must not include multibase prefix");return Gr(o).set(r,e),o}};function wc(n,e){switch(n[0]){case"Q":{let t=e??K;return[K.prefix,t.decode(`${K.prefix}${n}`)]}case K.prefix:{let t=e??K;return[K.prefix,t.decode(n)]}case at.prefix:{let t=e??at;return[at.prefix,t.decode(n)]}default:{if(e==null)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[n[0],e.decode(n)]}}}function gc(n,e,t){let{prefix:r}=t;if(r!==K.prefix)throw Error(`Cannot string encode V0 in ${t.name} encoding`);let i=e.get(r);if(i==null){let o=t.encode(n).slice(1);return e.set(r,o),o}else return i}function xc(n,e,t){let{prefix:r}=t,i=e.get(r);if(i==null){let o=t.encode(n);return e.set(r,o),o}else return i}var lt=112,vc=18;function Ii(n,e,t){let r=ke(n),i=r+ke(e),o=new Uint8Array(i+t.byteLength);return Se(n,o,0),Se(e,o,r),o.set(t,i),o}var bc=Symbol.for("@ipld/js-cid/CID");var za=u(a(),1);var ef=u(a(),1);var Ya=u(a(),1);var Xa=u(a(),1);var Za=u(a(),1);var Qa=u(a(),1);var O=class n{static addPrefix(e){var t;let{code:r,data:i,name:o}=e;if(!(o?!r:r))throw new Error("Either 'name' or 'code' must be defined, but not both.");if(r=n.codeToName.has(r)?r:n.nameToCode.get(o),r===void 0)throw new Error(`Unsupported multicodec: ${(t=e.name)!==null&&t!==void 0?t:e.code}`);let s=ne.encodingLength(r),c=new Uint8Array(s+i.byteLength);return c.set(i,s),ne.encodeTo(r,c),c}static getCodeFromData(e){let{prefixedData:t}=e,[r,i]=ne.decode(t);return r}static getCodeFromName(e){let{name:t}=e,r=n.nameToCode.get(t);if(r===void 0)throw new Error(`Unsupported multicodec: ${t}`);return r}static getNameFromCode(e){let{code:t}=e,r=n.codeToName.get(t);if(r===void 0)throw new Error(`Unsupported multicodec: ${t}`);return r}static registerCodec(e){n.codeToName.set(e.code,e.name),n.nameToCode.set(e.name,e.code)}static removePrefix(e){let{prefixedData:t}=e,[r,i]=ne.decode(t),o=n.codeToName.get(r);if(o===void 0)throw new Error(`Unsupported multicodec: ${r}`);return{code:r,data:t.slice(i),name:o}}};O.codeToName=new Map;O.nameToCode=new Map;O.registerCodec({code:237,name:"ed25519-pub"});O.registerCodec({code:4864,name:"ed25519-priv"});O.registerCodec({code:236,name:"x25519-pub"});O.registerCodec({code:4866,name:"x25519-priv"});O.registerCodec({code:231,name:"secp256k1-pub"});O.registerCodec({code:4865,name:"secp256k1-priv"});var yf=u(a(),1);function Hr(n){Object.keys(n).forEach(e=>{n[e]===void 0?delete n[e]:typeof n[e]=="object"&&Hr(n[e])})}var _h=u(a(),1),ku=u(Jo(),1);var Sh=u(a(),1);var Bd=u(a(),1);var Fh=u(a(),1);var pd=u(a(),1);var ed=u(a(),1);var Yh=u(a(),1);var Vh=u(a(),1);function Ku(n){return n instanceof Uint8Array||n!=null&&typeof n=="object"&&n.constructor.name==="Uint8Array"}function Vn(n,...e){if(!Ku(n))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(n.length))throw new Error(`Uint8Array expected of length ${e}, not of length=${n.length}`)}function jn(n,e=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(e&&n.finished)throw new Error("Hash#digest() has already been called")}function Go(n,e){Vn(n);let t=e.outputLen;if(n.length<t)throw new Error(`digestInto() expects output buffer of length at least ${t}`)}var Gh=u(a(),1);var mr=n=>new DataView(n.buffer,n.byteOffset,n.byteLength),J=(n,e)=>n<<32-e|n>>>e;var $h=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Iu(n){if(typeof n!="string")throw new Error(`utf8ToBytes expected string, got ${typeof n}`);return new Uint8Array(new TextEncoder().encode(n))}function $n(n){return typeof n=="string"&&(n=Iu(n)),Vn(n),n}var yr=class{clone(){return this._cloneInto()}},qh={}.toString;function Wo(n){let e=r=>n().update($n(r)).digest(),t=n();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>n(),e}function Ou(n,e,t,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(e,t,r);let i=BigInt(32),o=BigInt(4294967295),s=Number(t>>i&o),c=Number(t&o),f=r?4:0,h=r?0:4;n.setUint32(e+f,s,r),n.setUint32(e+h,c,r)}var Ho=(n,e,t)=>n&e^~n&t,zo=(n,e,t)=>n&e^n&t^e&t,wr=class extends yr{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=mr(this.buffer)}update(e){jn(this);let{view:t,buffer:r,blockLen:i}=this;e=$n(e);let o=e.length;for(let s=0;s<o;){let c=Math.min(i-this.pos,o-s);if(c===i){let f=mr(e);for(;i<=o-s;s+=i)this.process(f,s);continue}r.set(e.subarray(s,s+c),this.pos),this.pos+=c,s+=c,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){jn(this),Go(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:o}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let d=s;d<i;d++)t[d]=0;Ou(r,i-8,BigInt(this.length*8),o),this.process(r,0);let c=mr(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=f/4,l=this.get();if(h>l.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<h;d++)c.setUint32(4*d,l[d],o)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:i,finished:o,destroyed:s,pos:c}=this;return e.length=i,e.pos=c,e.finished=o,e.destroyed=s,i%t&&e.buffer.set(r),e}};var Uu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ee=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=new Uint32Array(64),qn=class extends wr{constructor(){super(64,32,8,!1),this.A=Ee[0]|0,this.B=Ee[1]|0,this.C=Ee[2]|0,this.D=Ee[3]|0,this.E=Ee[4]|0,this.F=Ee[5]|0,this.G=Ee[6]|0,this.H=Ee[7]|0}get(){let{A:e,B:t,C:r,D:i,E:o,F:s,G:c,H:f}=this;return[e,t,r,i,o,s,c,f]}set(e,t,r,i,o,s,c,f){this.A=e|0,this.B=t|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=c|0,this.H=f|0}process(e,t){for(let d=0;d<16;d++,t+=4)Te[d]=e.getUint32(t,!1);for(let d=16;d<64;d++){let y=Te[d-15],w=Te[d-2],m=J(y,7)^J(y,18)^y>>>3,b=J(w,17)^J(w,19)^w>>>10;Te[d]=b+Te[d-7]+m+Te[d-16]|0}let{A:r,B:i,C:o,D:s,E:c,F:f,G:h,H:l}=this;for(let d=0;d<64;d++){let y=J(c,6)^J(c,11)^J(c,25),w=l+y+Ho(c,f,h)+Uu[d]+Te[d]|0,b=(J(r,2)^J(r,13)^J(r,22))+zo(r,i,o)|0;l=h,h=f,f=c,c=s+w|0,s=o,o=i,i=r,r=w+b|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,c=c+this.E|0,f=f+this.F|0,h=h+this.G|0,l=l+this.H|0,this.set(r,i,o,s,c,f,h,l)}roundClean(){Te.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var Yo=Wo(()=>new qn);var fd=u(a(),1);var rd=u(a(),1);function Xo(n){let e=r=>{if(r!==null&&typeof r=="object"&&!Array.isArray(r)){let i=Object.keys(r).sort(),o={};for(let s of i)o[s]=e(r[s]);return o}return r},t=e(n);return JSON.stringify(t)}var od=u(a(),1);var Cu=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function c(l){try{h(r.next(l))}catch(d){s(d)}}function f(l){try{h(r.throw(l))}catch(d){s(d)}}function h(l){l.done?o(l.value):i(l.value).then(c,f)}h((r=r.apply(n,e||[])).next())})},Lt=class{static digest(e){return Cu(this,arguments,void 0,function*({data:t}){return Yo(t)})}};var Lu=function(n,e,t,r){function i(o){return o instanceof t?o:new t(function(s){s(o)})}return new(t||(t=Promise))(function(o,s){function c(l){try{h(r.next(l))}catch(d){s(d)}}function f(l){try{h(r.throw(l))}catch(d){s(d)}}function h(l){l.done?o(l.value):i(l.value).then(c,f)}h((r=r.apply(n,e||[])).next())})};function P(n){return Lu(this,arguments,void 0,function*({jwk:e}){let t=e.kty,r;if(t==="EC")r={crv:e.crv,kty:e.kty,x:e.x,y:e.y};else if(t==="oct")r={k:e.k,kty:e.kty};else if(t==="OKP")r={crv:e.crv,kty:e.kty,x:e.x};else if(t==="RSA")r={e:e.e,kty:e.kty,n:e.n};else throw new Error(`Unsupported key type: ${t}`);Hr(r);let i=Xo(r),o=T.string(i).toUint8Array(),s=yield Lt.digest({data:o});return T.uint8Array(s).toBase64Url()})}var gd=u(a(),1);var Dd=u(a(),1);var Id=u(a(),1);var Nd=u(a(),1);var tl=u(a(),1);var fl=u(a(),1);var ol=u(a(),1);var xl=u(a(),1);var pl=u(a(),1);var vl=u(a(),1);var bl=u(a(),1);var El=u(a(),1);var kl=u(a(),1);var Ol=u(a(),1);var Ll=u(a(),1);var Dl=u(a(),1);var Nl=u(a(),1);var ql=u(a(),1);var Hl=u(a(),1);var Ap=u(a(),1),vr=(o=>(o.authentication="authentication",o.assertionMethod="assertionMethod",o.keyAgreement="keyAgreement",o.capabilityInvocation="capabilityInvocation",o.capabilityDelegation="capabilityDelegation",o))(vr||{});var Sp=u(a(),1),br=class n extends Error{constructor(t,r){super(`${t}: ${r}`);this.code=t;this.name="DidError",Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,n)}};function Jn(n){if(typeof n=="string"&&n.length!==0)return n.split("#").pop()}function Cp({didDocument:n,id:e,type:t}){return n?.service?.filter(r=>!(e&&r.id!==e||t&&r.type!==t))??[]}async function Lp({didDocument:n,publicKeyJwk:e,publicKeyMultibase:t}){let r=rs({didDocument:n});for(let i of r)if(e&&i.publicKeyJwk){if(await P({jwk:e})===await P({jwk:i.publicKeyJwk}))return i}else if(t&&i.publicKeyMultibase&&t===i.publicKeyMultibase)return i;return null}function rs({didDocument:n}){if(!n)throw new TypeError("Required parameter missing: 'didDocument'");let e=[];return e.push(...n.verificationMethod?.filter(Gn)??[]),Object.keys(vr).forEach(t=>{e.push(...n[t]?.filter(Gn)??[])}),e}function Pp({didDocument:n}){let t=rs({didDocument:n}).map(r=>r.type);return[...new Set(t)]}function Dp({didDocument:n,methodId:e}){let t=[];return Object.keys(vr).forEach(r=>{if(Array.isArray(n[r])){let i=n[r],o=Jn(e);i.some(c=>{let f=Jn(c)===o,h=Gn(c)&&Jn(c.id)===o;return f||h})&&t.push(r)}}),t}function Pu(n){return!n||typeof n!="object"||n===null?!1:"id"in n&&"type"in n&&"serviceEndpoint"in n}function Mp(n){if(!Pu(n)||n.type!=="DecentralizedWebNode"||!("enc"in n&&"sig"in n))return!1;let e=t=>typeof t=="string"||Array.isArray(t)&&t.every(r=>typeof r=="string");return e(n.enc)&&e(n.sig)}function Gn(n){return!(!n||typeof n!="object"||n===null||!("id"in n&&"type"in n&&"controller"in n)||typeof n.id!="string"||typeof n.type!="string"||typeof n.controller!="string")}function Rp({keyBytes:n,multicodecCode:e,multicodecName:t}){let r=O.addPrefix({code:e,data:n,name:t}),i=T.uint8Array(r).toBase58Btc();return T.base58Btc(i).toMultibase()}function Fp({multibaseKeyId:n}){try{let e=T.multibase(n).toBase58Btc(),t=T.base58Btc(e).toUint8Array(),{code:r,data:i,name:o}=O.removePrefix({prefixedData:t});return{keyBytes:i,multicodecCode:r,multicodecName:o}}catch{throw new br("invalidDid",`Invalid multibase identifier: ${n}`)}}export{Jn as extractDidFragment,Cp as getServices,Lp as getVerificationMethodByKey,Pp as getVerificationMethodTypes,rs as getVerificationMethods,Dp as getVerificationRelationshipsById,Pu as isDidService,Gn as isDidVerificationMethod,Mp as isDwnDidService,Rp as keyBytesToMultibaseId,Fp as multibaseIdToKeyBytes};
3
2
  /*! Bundled license information:
4
3
 
5
4
  ieee754/index.js:
@@ -19,9 +18,6 @@ queue-microtask/index.js:
19
18
  run-parallel-limit/index.js:
20
19
  (*! run-parallel-limit. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
21
20
 
22
- safe-buffer/index.js:
23
- (*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> *)
24
-
25
21
  @noble/hashes/esm/utils.js:
26
22
  (*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
27
23
  */