@libp2p/http-utils 1.0.1 → 1.0.2

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.
package/dist/index.min.js CHANGED
@@ -1,22 +1,22 @@
1
1
  (function (root, factory) {(typeof module === 'object' && module.exports) ? module.exports = factory() : root.Libp2PHttpUtils = factory()}(typeof self !== 'undefined' ? self : this, function () {
2
- "use strict";var Libp2PHttpUtils=(()=>{var u0=Object.create;var ri=Object.defineProperty;var f0=Object.getOwnPropertyDescriptor;var c0=Object.getOwnPropertyNames;var l0=Object.getPrototypeOf,d0=Object.prototype.hasOwnProperty;var q=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Re=(t,e)=>{for(var r in e)ri(t,r,{get:e[r],enumerable:!0})},Yu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of c0(e))!d0.call(t,i)&&i!==r&&ri(t,i,{get:()=>e[i],enumerable:!(n=f0(e,i))||n.enumerable});return t};var h0=(t,e,r)=>(r=t!=null?u0(l0(t)):{},Yu(e||!t||!t.__esModule?ri(r,"default",{value:t,enumerable:!0}):r,t)),p0=t=>Yu(ri({},"__esModule",{value:!0}),t);var vl=q(Yi=>{"use strict";Yi.byteLength=nw;Yi.toByteArray=ow;Yi.fromByteArray=uw;var Qe=[],Ue=[],rw=typeof Uint8Array<"u"?Uint8Array:Array,_a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Jt=0,Al=_a.length;Jt<Al;++Jt)Qe[Jt]=_a[Jt],Ue[_a.charCodeAt(Jt)]=Jt;var Jt,Al;Ue[45]=62;Ue[95]=63;function Il(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 nw(t){var e=Il(t),r=e[0],n=e[1];return(r+n)*3/4-n}function iw(t,e,r){return(e+r)*3/4-r}function ow(t){var e,r=Il(t),n=r[0],i=r[1],o=new rw(iw(t,n,i)),s=0,a=i>0?n-4:n,u;for(u=0;u<a;u+=4)e=Ue[t.charCodeAt(u)]<<18|Ue[t.charCodeAt(u+1)]<<12|Ue[t.charCodeAt(u+2)]<<6|Ue[t.charCodeAt(u+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Ue[t.charCodeAt(u)]<<2|Ue[t.charCodeAt(u+1)]>>4,o[s++]=e&255),i===1&&(e=Ue[t.charCodeAt(u)]<<10|Ue[t.charCodeAt(u+1)]<<4|Ue[t.charCodeAt(u+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function sw(t){return Qe[t>>18&63]+Qe[t>>12&63]+Qe[t>>6&63]+Qe[t&63]}function aw(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(sw(n));return i.join("")}function uw(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(aw(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(Qe[e>>2]+Qe[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Qe[e>>10]+Qe[e>>4&63]+Qe[e<<2&63]+"=")),i.join("")}});var Tl=q(Aa=>{Aa.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,y=r?-1:1,d=t[e+l];for(l+=y,o=d&(1<<-f)-1,d>>=-f,f+=a;f>0;o=o*256+t[e+l],l+=y,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+t[e+l],l+=y,f-=8);if(o===0)o=1-c;else{if(o===u)return s?NaN:(d?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-c}return(d?-1:1)*s*Math.pow(2,o-n)};Aa.write=function(t,e,r,n,i,o){var s,a,u,c=o*8-i-1,f=(1<<c)-1,l=f>>1,y=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,x=n?1:-1,h=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=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+l>=1?e+=y/u:e+=y*Math.pow(2,1-l),e*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s=s+l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+d]=a&255,d+=x,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+d]=s&255,d+=x,s/=256,c-=8);t[r+d-x]|=h*128}});var wt=q(qr=>{"use strict";var Ia=vl(),Mr=Tl(),Rl=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;qr.Buffer=b;qr.SlowBuffer=pw;qr.INSPECT_MAX_BYTES=50;var Zi=2147483647;qr.kMaxLength=Zi;b.TYPED_ARRAY_SUPPORT=fw();!b.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 fw(){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(b.prototype,"parent",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.buffer}});Object.defineProperty(b.prototype,"offset",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.byteOffset}});function mt(t){if(t>Zi)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,b.prototype),e}function b(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 Ba(t)}return Ll(t,e,r)}b.poolSize=8192;function Ll(t,e,r){if(typeof t=="string")return lw(t,e);if(ArrayBuffer.isView(t))return dw(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(Je(t,ArrayBuffer)||t&&Je(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Je(t,SharedArrayBuffer)||t&&Je(t.buffer,SharedArrayBuffer)))return Ta(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 b.from(n,e,r);let i=hw(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return b.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)}b.from=function(t,e,r){return Ll(t,e,r)};Object.setPrototypeOf(b.prototype,Uint8Array.prototype);Object.setPrototypeOf(b,Uint8Array);function Pl(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 cw(t,e,r){return Pl(t),t<=0?mt(t):e!==void 0?typeof r=="string"?mt(t).fill(e,r):mt(t).fill(e):mt(t)}b.alloc=function(t,e,r){return cw(t,e,r)};function Ba(t){return Pl(t),mt(t<0?0:Ca(t)|0)}b.allocUnsafe=function(t){return Ba(t)};b.allocUnsafeSlow=function(t){return Ba(t)};function lw(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!b.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Nl(t,e)|0,n=mt(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function va(t){let e=t.length<0?0:Ca(t.length)|0,r=mt(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function dw(t){if(Je(t,Uint8Array)){let e=new Uint8Array(t);return Ta(e.buffer,e.byteOffset,e.byteLength)}return va(t)}function Ta(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,b.prototype),n}function hw(t){if(b.isBuffer(t)){let e=Ca(t.length)|0,r=mt(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||La(t.length)?mt(0):va(t);if(t.type==="Buffer"&&Array.isArray(t.data))return va(t.data)}function Ca(t){if(t>=Zi)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Zi.toString(16)+" bytes");return t|0}function pw(t){return+t!=t&&(t=0),b.alloc(+t)}b.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==b.prototype};b.compare=function(e,r){if(Je(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),Je(r,Uint8Array)&&(r=b.from(r,r.offset,r.byteLength)),!b.isBuffer(e)||!b.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};b.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}};b.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return b.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=b.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let s=e[n];if(Je(s,Uint8Array))o+s.length>i.length?(b.isBuffer(s)||(s=b.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(b.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function Nl(t,e){if(b.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Je(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 Ra(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Kl(t).length;default:if(i)return n?-1:Ra(t).length;e=(""+e).toLowerCase(),i=!0}}b.byteLength=Nl;function yw(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 Iw(this,e,r);case"utf8":case"utf-8":return Ul(this,e,r);case"ascii":return _w(this,e,r);case"latin1":case"binary":return Aw(this,e,r);case"base64":return Ew(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return vw(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}b.prototype._isBuffer=!0;function er(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}b.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)er(this,r,r+1);return this};b.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)er(this,r,r+3),er(this,r+1,r+2);return this};b.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)er(this,r,r+7),er(this,r+1,r+6),er(this,r+2,r+5),er(this,r+3,r+4);return this};b.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Ul(this,0,e):yw.apply(this,arguments)};b.prototype.toLocaleString=b.prototype.toString;b.prototype.equals=function(e){if(!b.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:b.compare(this,e)===0};b.prototype.inspect=function(){let e="",r=qr.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Rl&&(b.prototype[Rl]=b.prototype.inspect);b.prototype.compare=function(e,r,n,i,o){if(Je(e,Uint8Array)&&(e=b.from(e,e.offset,e.byteLength)),!b.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,u=Math.min(s,a),c=this.slice(i,o),f=e.slice(r,n);for(let l=0;l<u;++l)if(c[l]!==f[l]){s=c[l],a=f[l];break}return s<a?-1:a<s?1:0};function Ol(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,La(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=b.from(e,n)),b.isBuffer(e))return e.length===0?-1:Bl(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):Bl(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Bl(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 u(f,l){return o===1?f[l]:f.readUInt16BE(l*o)}let c;if(i){let f=-1;for(c=r;c<s;c++)if(u(t,c)===u(e,f===-1?0:c-f)){if(f===-1&&(f=c),c-f+1===a)return f*o}else f!==-1&&(c-=c-f),f=-1}else for(r+a>s&&(r=s-a),c=r;c>=0;c--){let f=!0;for(let l=0;l<a;l++)if(u(t,c+l)!==u(e,l)){f=!1;break}if(f)return c}return-1}b.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};b.prototype.indexOf=function(e,r,n){return Ol(this,e,r,n,!0)};b.prototype.lastIndexOf=function(e,r,n){return Ol(this,e,r,n,!1)};function bw(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(La(a))return s;t[r+s]=a}return s}function mw(t,e,r,n){return Xi(Ra(e,t.length-r),t,r,n)}function ww(t,e,r,n){return Xi(Cw(e),t,r,n)}function gw(t,e,r,n){return Xi(Kl(e),t,r,n)}function xw(t,e,r,n){return Xi(Dw(e,t.length-r),t,r,n)}b.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 bw(this,e,r,n);case"utf8":case"utf-8":return mw(this,e,r,n);case"ascii":case"latin1":case"binary":return ww(this,e,r,n);case"base64":return gw(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return xw(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ew(t,e,r){return e===0&&r===t.length?Ia.fromByteArray(t):Ia.fromByteArray(t.slice(e,r))}function Ul(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 u,c,f,l;switch(a){case 1:o<128&&(s=o);break;case 2:u=t[i+1],(u&192)===128&&(l=(o&31)<<6|u&63,l>127&&(s=l));break;case 3:u=t[i+1],c=t[i+2],(u&192)===128&&(c&192)===128&&(l=(o&15)<<12|(u&63)<<6|c&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(l=(o&15)<<18|(u&63)<<12|(c&63)<<6|f&63,l>65535&&l<1114112&&(s=l))}}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 Sw(n)}var Cl=4096;function Sw(t){let e=t.length;if(e<=Cl)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=Cl));return r}function _w(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 Aw(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 Iw(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+=Lw[t[o]];return i}function vw(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}b.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,b.prototype),i};function he(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")}b.prototype.readUintLE=b.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||he(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return i};b.prototype.readUintBE=b.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||he(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};b.prototype.readUint8=b.prototype.readUInt8=function(e,r){return e=e>>>0,r||he(e,1,this.length),this[e]};b.prototype.readUint16LE=b.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||he(e,2,this.length),this[e]|this[e+1]<<8};b.prototype.readUint16BE=b.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||he(e,2,this.length),this[e]<<8|this[e+1]};b.prototype.readUint32LE=b.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||he(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};b.prototype.readUint32BE=b.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||he(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};b.prototype.readBigUInt64LE=Nt(function(e){e=e>>>0,Fr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hn(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))});b.prototype.readBigUInt64BE=Nt(function(e){e=e>>>0,Fr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hn(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)});b.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||he(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};b.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||he(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};b.prototype.readInt8=function(e,r){return e=e>>>0,r||he(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};b.prototype.readInt16LE=function(e,r){e=e>>>0,r||he(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};b.prototype.readInt16BE=function(e,r){e=e>>>0,r||he(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};b.prototype.readInt32LE=function(e,r){return e=e>>>0,r||he(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};b.prototype.readInt32BE=function(e,r){return e=e>>>0,r||he(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};b.prototype.readBigInt64LE=Nt(function(e){e=e>>>0,Fr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hn(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)});b.prototype.readBigInt64BE=Nt(function(e){e=e>>>0,Fr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Hn(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)});b.prototype.readFloatLE=function(e,r){return e=e>>>0,r||he(e,4,this.length),Mr.read(this,e,!0,23,4)};b.prototype.readFloatBE=function(e,r){return e=e>>>0,r||he(e,4,this.length),Mr.read(this,e,!1,23,4)};b.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||he(e,8,this.length),Mr.read(this,e,!0,52,8)};b.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||he(e,8,this.length),Mr.read(this,e,!1,52,8)};function Te(t,e,r,n,i,o){if(!b.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")}b.prototype.writeUintLE=b.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;Te(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};b.prototype.writeUintBE=b.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;Te(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};b.prototype.writeUint8=b.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Te(this,e,r,1,255,0),this[r]=e&255,r+1};b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Te(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Te(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Te(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};b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Te(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 kl(t,e,r,n,i){$l(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 Ml(t,e,r,n,i){$l(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}b.prototype.writeBigUInt64LE=Nt(function(e,r=0){return kl(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeBigUInt64BE=Nt(function(e,r=0){return Ml(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});b.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);Te(this,e,r,n,u-1,-u)}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};b.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);Te(this,e,r,n,u-1,-u)}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};b.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Te(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};b.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Te(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};b.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Te(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};b.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Te(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};b.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Te(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};b.prototype.writeBigInt64LE=Nt(function(e,r=0){return kl(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});b.prototype.writeBigInt64BE=Nt(function(e,r=0){return Ml(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function Fl(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 ql(t,e,r,n,i){return e=+e,r=r>>>0,i||Fl(t,e,r,4,34028234663852886e22,-34028234663852886e22),Mr.write(t,e,r,n,23,4),r+4}b.prototype.writeFloatLE=function(e,r,n){return ql(this,e,r,!0,n)};b.prototype.writeFloatBE=function(e,r,n){return ql(this,e,r,!1,n)};function Hl(t,e,r,n,i){return e=+e,r=r>>>0,i||Fl(t,e,r,8,17976931348623157e292,-17976931348623157e292),Mr.write(t,e,r,n,52,8),r+8}b.prototype.writeDoubleLE=function(e,r,n){return Hl(this,e,r,!0,n)};b.prototype.writeDoubleBE=function(e,r,n){return Hl(this,e,r,!1,n)};b.prototype.copy=function(e,r,n,i){if(!b.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};b.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"&&!b.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=b.isBuffer(e)?e:b.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 kr={};function Da(t,e,r){kr[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}`}}}Da("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);Da("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);Da("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=Dl(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Dl(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Dl(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 Tw(t,e,r){Fr(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Hn(e,t.length-(r+1))}function $l(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 kr.ERR_OUT_OF_RANGE("value",a,t)}Tw(n,i,o)}function Fr(t,e){if(typeof t!="number")throw new kr.ERR_INVALID_ARG_TYPE(e,"number",t)}function Hn(t,e,r){throw Math.floor(t)!==t?(Fr(t,r),new kr.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new kr.ERR_BUFFER_OUT_OF_BOUNDS:new kr.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Rw=/[^+/0-9A-Za-z-_]/g;function Bw(t){if(t=t.split("=")[0],t=t.trim().replace(Rw,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Ra(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 Cw(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function Dw(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 Kl(t){return Ia.toByteArray(Bw(t))}function Xi(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 Je(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function La(t){return t!==t}var Lw=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 Nt(t){return typeof BigInt>"u"?Pw:t}function Pw(){throw new Error("BigInt not supported")}});var G=q((mv,Wl)=>{"use strict";var Pa=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}
3
- `;super(r),this.name="AggregateError",this.errors=e}};Wl.exports={AggregateError:Pa,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 Na=q((wv,jl)=>{"use strict";jl.exports={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"{}"}}}});var Ee=q((gv,Gl)=>{"use strict";var{format:Nw,inspect:Qi}=Na(),{AggregateError:Ow}=G(),Uw=globalThis.AggregateError||Ow,kw=Symbol("kIsNodeError"),Mw=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Fw=/^([A-Z][a-z0-9]*)+$/,qw="__node_internal_",Ji={};function tr(t,e){if(!t)throw new Ji.ERR_INTERNAL_ASSERTION(e)}function Vl(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 Hw(t,e,r){if(typeof e=="function")return tr(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 tr(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:Nw(e,...r)}function be(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(Hw(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[kw]=!0,Ji[t]=n}function zl(t){let e=qw+t.name;return Object.defineProperty(t,"name",{value:e}),t}function $w(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new Uw([e,t],e.message);return r.code=e.code,r}return t||e}var Oa=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Ji.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};be("ERR_ASSERTION","%s",Error);be("ERR_INVALID_ARG_TYPE",(t,e,r)=>{tr(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 u of e)tr(typeof u=="string","All expected entries have to be of type string"),Mw.includes(u)?i.push(u.toLowerCase()):Fw.test(u)?o.push(u):(tr(u!=="object",'The value "object" should be written as "Object"'),s.push(u));if(o.length>0){let u=i.indexOf("object");u!==-1&&(i.splice(i,u,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 u=i.pop();n+=`one of type ${i.join(", ")}, or ${u}`}}(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 u=o.pop();n+=`an instance of ${o.join(", ")}, or ${u}`}}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 u=s.pop();n+=`one of ${s.join(", ")}, or ${u}`}}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 u=Qi(r,{depth:-1});n+=`. Received ${u}`}}else{let u=Qi(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);be("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=Qi(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);be("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);be("ERR_MISSING_ARGS",(...t)=>{tr(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);be("ERR_OUT_OF_RANGE",(t,e,r)=>{tr(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=Vl(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=Vl(n)),n+="n"}else n=Qi(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);be("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);be("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);be("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);be("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);be("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);be("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);be("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);be("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);be("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);be("ERR_STREAM_WRITE_AFTER_END","write after end",Error);be("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Gl.exports={AbortError:Oa,aggregateTwoErrors:zl($w),hideStackFrames:zl,codes:Ji}});var Hr=q((xv,eo)=>{"use strict";var{AbortController:Yl,AbortSignal:Kw}=typeof self<"u"?self:typeof window<"u"?window:void 0;eo.exports=Yl;eo.exports.AbortSignal=Kw;eo.exports.default=Yl});var $n=q((Ev,Ua)=>{"use strict";var $r=typeof Reflect=="object"?Reflect:null,Zl=$r&&typeof $r.apply=="function"?$r.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},to;$r&&typeof $r.ownKeys=="function"?to=$r.ownKeys:Object.getOwnPropertySymbols?to=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:to=function(e){return Object.getOwnPropertyNames(e)};function Ww(t){console&&console.warn&&console.warn(t)}var Ql=Number.isNaN||function(e){return e!==e};function K(){K.init.call(this)}Ua.exports=K;Ua.exports.once=Gw;K.EventEmitter=K;K.prototype._events=void 0;K.prototype._eventsCount=0;K.prototype._maxListeners=void 0;var Xl=10;function ro(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(K,"defaultMaxListeners",{enumerable:!0,get:function(){return Xl},set:function(t){if(typeof t!="number"||t<0||Ql(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Xl=t}});K.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};K.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Ql(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 Jl(t){return t._maxListeners===void 0?K.defaultMaxListeners:t._maxListeners}K.prototype.getMaxListeners=function(){return Jl(this)};K.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 u=o[e];if(u===void 0)return!1;if(typeof u=="function")Zl(u,this,r);else for(var c=u.length,f=id(u,c),n=0;n<c;++n)Zl(f[n],this,r);return!0};function ed(t,e,r,n){var i,o,s;if(ro(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=Jl(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,Ww(a)}return t}K.prototype.addListener=function(e,r){return ed(this,e,r,!1)};K.prototype.on=K.prototype.addListener;K.prototype.prependListener=function(e,r){return ed(this,e,r,!0)};function jw(){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 td(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=jw.bind(n);return i.listener=r,n.wrapFn=i,i}K.prototype.once=function(e,r){return ro(r),this.on(e,td(this,e,r)),this};K.prototype.prependOnceListener=function(e,r){return ro(r),this.prependListener(e,td(this,e,r)),this};K.prototype.removeListener=function(e,r){var n,i,o,s,a;if(ro(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():Vw(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};K.prototype.off=K.prototype.removeListener;K.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 rd(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?zw(i):id(i,i.length)}K.prototype.listeners=function(e){return rd(this,e,!0)};K.prototype.rawListeners=function(e){return rd(this,e,!1)};K.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):nd.call(t,e)};K.prototype.listenerCount=nd;function nd(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}K.prototype.eventNames=function(){return this._eventsCount>0?to(this._events):[]};function id(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Vw(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function zw(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Gw(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))}od(t,e,o,{once:!0}),e!=="error"&&Yw(t,i,{once:!0})})}function Yw(t,e,r){typeof t.on=="function"&&od(t,"error",e,r)}function od(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 ve=q((Sv,Ma)=>{"use strict";var Zw=wt(),{format:Xw,inspect:Qw}=Na(),{codes:{ERR_INVALID_ARG_TYPE:ka}}=Ee(),{kResistStopPropagation:Jw,AggregateError:eg,SymbolDispose:tg}=G(),rg=globalThis.AbortSignal||Hr().AbortSignal,ng=globalThis.AbortController||Hr().AbortController,ig=Object.getPrototypeOf(async function(){}).constructor,sd=globalThis.Blob||Zw.Blob,og=typeof sd<"u"?function(e){return e instanceof sd}:function(e){return!1},ad=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ka(e,"AbortSignal",t)},sg=(t,e)=>{if(typeof t!="function")throw new ka(e,"Function",t)};Ma.exports={AggregateError:eg,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:Xw,inspect:Qw,types:{isAsyncFunction(t){return t instanceof ig},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:og,deprecate(t,e){return t},addAbortListener:$n().addAbortListener||function(e,r){if(e===void 0)throw new ka("signal","AbortSignal",e);ad(e,"signal"),sg(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Jw]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[tg](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:rg.any||function(e){if(e.length===1)return e[0];let r=new ng,n=()=>r.abort();return e.forEach(i=>{ad(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};Ma.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var Wr=q((_v,md)=>{"use strict";var{ArrayIsArray:qa,ArrayPrototypeIncludes:ld,ArrayPrototypeJoin:dd,ArrayPrototypeMap:ag,NumberIsInteger:Ha,NumberIsNaN:ug,NumberMAX_SAFE_INTEGER:fg,NumberMIN_SAFE_INTEGER:cg,NumberParseInt:lg,ObjectPrototypeHasOwnProperty:dg,RegExpPrototypeExec:hd,String:hg,StringPrototypeToUpperCase:pg,StringPrototypeTrim:yg}=G(),{hideStackFrames:ke,codes:{ERR_SOCKET_BAD_PORT:bg,ERR_INVALID_ARG_TYPE:Se,ERR_INVALID_ARG_VALUE:Kr,ERR_OUT_OF_RANGE:rr,ERR_UNKNOWN_SIGNAL:ud}}=Ee(),{normalizeEncoding:mg}=ve(),{isAsyncFunction:wg,isArrayBufferView:gg}=ve().types,fd={};function xg(t){return t===(t|0)}function Eg(t){return t===t>>>0}var Sg=/^[0-7]+$/,_g="must be a 32-bit unsigned integer or an octal string";function Ag(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(hd(Sg,t)===null)throw new Kr(e,t,_g);t=lg(t,8)}return pd(t,e),t}var Ig=ke((t,e,r=cg,n=fg)=>{if(typeof t!="number")throw new Se(e,"number",t);if(!Ha(t))throw new rr(e,"an integer",t);if(t<r||t>n)throw new rr(e,`>= ${r} && <= ${n}`,t)}),vg=ke((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Se(e,"number",t);if(!Ha(t))throw new rr(e,"an integer",t);if(t<r||t>n)throw new rr(e,`>= ${r} && <= ${n}`,t)}),pd=ke((t,e,r=!1)=>{if(typeof t!="number")throw new Se(e,"number",t);if(!Ha(t))throw new rr(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new rr(e,`>= ${n} && <= ${i}`,t)});function $a(t,e){if(typeof t!="string")throw new Se(e,"string",t)}function Tg(t,e,r=void 0,n){if(typeof t!="number")throw new Se(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&ug(t))throw new rr(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Rg=ke((t,e,r)=>{if(!ld(r,t)){let i="must be one of: "+dd(ag(r,o=>typeof o=="string"?`'${o}'`:hg(o)),", ");throw new Kr(e,t,i)}});function yd(t,e){if(typeof t!="boolean")throw new Se(e,"boolean",t)}function Fa(t,e,r){return t==null||!dg(t,e)?r:t[e]}var Bg=ke((t,e,r=null)=>{let n=Fa(r,"allowArray",!1),i=Fa(r,"allowFunction",!1);if(!Fa(r,"nullable",!1)&&t===null||!n&&qa(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new Se(e,"Object",t)}),Cg=ke((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Se(e,"a dictionary",t)}),no=ke((t,e,r=0)=>{if(!qa(t))throw new Se(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Kr(e,t,n)}});function Dg(t,e){no(t,e);for(let r=0;r<t.length;r++)$a(t[r],`${e}[${r}]`)}function Lg(t,e){no(t,e);for(let r=0;r<t.length;r++)yd(t[r],`${e}[${r}]`)}function Pg(t,e){no(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new Se(i,"AbortSignal",n);bd(n,i)}}function Ng(t,e="signal"){if($a(t,e),fd[t]===void 0)throw fd[pg(t)]!==void 0?new ud(t+" (signals must use all capital letters)"):new ud(t)}var Og=ke((t,e="buffer")=>{if(!gg(t))throw new Se(e,["Buffer","TypedArray","DataView"],t)});function Ug(t,e){let r=mg(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Kr("encoding",e,`is invalid for data of length ${n}`)}function kg(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&yg(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new bg(e,t,r);return t|0}var bd=ke((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Se(e,"AbortSignal",t)}),Mg=ke((t,e)=>{if(typeof t!="function")throw new Se(e,"Function",t)}),Fg=ke((t,e)=>{if(typeof t!="function"||wg(t))throw new Se(e,"Function",t)}),qg=ke((t,e)=>{if(t!==void 0)throw new Se(e,"undefined",t)});function Hg(t,e,r){if(!ld(r,t))throw new Se(e,`('${dd(r,"|")}')`,t)}var $g=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function cd(t,e){if(typeof t>"u"||!hd($g,t))throw new Kr(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function Kg(t){if(typeof t=="string")return cd(t,"hints"),t;if(qa(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];cd(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Kr("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}md.exports={isInt32:xg,isUint32:Eg,parseFileMode:Ag,validateArray:no,validateStringArray:Dg,validateBooleanArray:Lg,validateAbortSignalArray:Pg,validateBoolean:yd,validateBuffer:Og,validateDictionary:Cg,validateEncoding:Ug,validateFunction:Mg,validateInt32:vg,validateInteger:Ig,validateNumber:Tg,validateObject:Bg,validateOneOf:Rg,validatePlainFunction:Fg,validatePort:kg,validateSignalName:Ng,validateString:$a,validateUint32:pd,validateUndefined:qg,validateUnion:Hg,validateAbortSignal:bd,validateLinkHeaderValue:Kg}});var Ot=q((Av,Ed)=>{var re=Ed.exports={},et,tt;function Ka(){throw new Error("setTimeout has not been defined")}function Wa(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?et=setTimeout:et=Ka}catch{et=Ka}try{typeof clearTimeout=="function"?tt=clearTimeout:tt=Wa}catch{tt=Wa}})();function wd(t){if(et===setTimeout)return setTimeout(t,0);if((et===Ka||!et)&&setTimeout)return et=setTimeout,setTimeout(t,0);try{return et(t,0)}catch{try{return et.call(null,t,0)}catch{return et.call(this,t,0)}}}function Wg(t){if(tt===clearTimeout)return clearTimeout(t);if((tt===Wa||!tt)&&clearTimeout)return tt=clearTimeout,clearTimeout(t);try{return tt(t)}catch{try{return tt.call(null,t)}catch{return tt.call(this,t)}}}var gt=[],jr=!1,nr,io=-1;function jg(){!jr||!nr||(jr=!1,nr.length?gt=nr.concat(gt):io=-1,gt.length&&gd())}function gd(){if(!jr){var t=wd(jg);jr=!0;for(var e=gt.length;e;){for(nr=gt,gt=[];++io<e;)nr&&nr[io].run();io=-1,e=gt.length}nr=null,jr=!1,Wg(t)}}re.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];gt.push(new xd(t,e)),gt.length===1&&!jr&&wd(gd)};function xd(t,e){this.fun=t,this.array=e}xd.prototype.run=function(){this.fun.apply(null,this.array)};re.title="browser";re.browser=!0;re.env={};re.argv=[];re.version="";re.versions={};function xt(){}re.on=xt;re.addListener=xt;re.once=xt;re.off=xt;re.removeListener=xt;re.removeAllListeners=xt;re.emit=xt;re.prependListener=xt;re.prependOnceListener=xt;re.listeners=function(t){return[]};re.binding=function(t){throw new Error("process.binding is not supported")};re.cwd=function(){return"/"};re.chdir=function(t){throw new Error("process.chdir is not supported")};re.umask=function(){return 0}});var nt=q((Iv,Ud)=>{"use strict";var{SymbolAsyncIterator:Sd,SymbolIterator:_d,SymbolFor:ir}=G(),Ad=ir("nodejs.stream.destroyed"),Id=ir("nodejs.stream.errored"),ja=ir("nodejs.stream.readable"),Va=ir("nodejs.stream.writable"),vd=ir("nodejs.stream.disturbed"),Vg=ir("nodejs.webstream.isClosedPromise"),zg=ir("nodejs.webstream.controllerErrorFunction");function oo(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 so(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 Gg(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function rt(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Td(t){return!!(t&&!rt(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Rd(t){return!!(t&&!rt(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Bd(t){return!!(t&&!rt(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Yg(t){return Td(t)||Rd(t)||Bd(t)}function Zg(t,e){return t==null?!1:e===!0?typeof t[Sd]=="function":e===!1?typeof t[_d]=="function":typeof t[Sd]=="function"||typeof t[_d]=="function"}function ao(t){if(!rt(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Ad]||n!=null&&n.destroyed)}function Cd(t){if(!so(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 Xg(t,e){if(!so(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 Qg(t){if(!oo(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 Dd(t,e){if(!oo(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 Ld(t){return t&&t[ja]!=null?t[ja]:typeof t?.readable!="boolean"?null:ao(t)?!1:oo(t)&&t.readable&&!Dd(t)}function Pd(t){return t&&t[Va]!=null?t[Va]:typeof t?.writable!="boolean"?null:ao(t)?!1:so(t)&&t.writable&&!Cd(t)}function Jg(t,e){return rt(t)?ao(t)?!0:!(e?.readable!==!1&&Ld(t)||e?.writable!==!1&&Pd(t)):null}function ex(t){var e,r;return rt(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 tx(t){var e,r;return rt(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 rx(t){if(!rt(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"&&Nd(t)?t._closed:null}function Nd(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Od(t){return typeof t._sent100=="boolean"&&Nd(t)}function nx(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 ix(t){if(!rt(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Od(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function ox(t){var e;return!!(t&&((e=t[vd])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function sx(t){var e,r,n,i,o,s,a,u,c,f;return!!(t&&((e=(r=(n=(i=(o=(s=t[Id])!==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:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}Ud.exports={isDestroyed:ao,kIsDestroyed:Ad,isDisturbed:ox,kIsDisturbed:vd,isErrored:sx,kIsErrored:Id,isReadable:Ld,kIsReadable:ja,kIsClosedPromise:Vg,kControllerErrorFunction:zg,kIsWritable:Va,isClosed:rx,isDuplexNodeStream:Gg,isFinished:Jg,isIterable:Zg,isReadableNodeStream:oo,isReadableStream:Td,isReadableEnded:Qg,isReadableFinished:Dd,isReadableErrored:tx,isNodeStream:rt,isWebStream:Yg,isWritable:Pd,isWritableNodeStream:so,isWritableStream:Rd,isWritableEnded:Cd,isWritableFinished:Xg,isWritableErrored:ex,isServerRequest:nx,isServerResponse:Od,willEmitClose:ix,isTransformStream:Bd}});var Et=q((vv,Xa)=>{"use strict";var Ut=Ot(),{AbortError:jd,codes:ax}=Ee(),{ERR_INVALID_ARG_TYPE:ux,ERR_STREAM_PREMATURE_CLOSE:kd}=ax,{kEmptyObject:Ga,once:Ya}=ve(),{validateAbortSignal:fx,validateFunction:cx,validateObject:lx,validateBoolean:dx}=Wr(),{Promise:hx,PromisePrototypeThen:px,SymbolDispose:Vd}=G(),{isClosed:yx,isReadable:Md,isReadableNodeStream:za,isReadableStream:bx,isReadableFinished:Fd,isReadableErrored:qd,isWritable:Hd,isWritableNodeStream:$d,isWritableStream:mx,isWritableFinished:Kd,isWritableErrored:Wd,isNodeStream:wx,willEmitClose:gx,kIsClosedPromise:xx}=nt(),Vr;function Ex(t){return t.setHeader&&typeof t.abort=="function"}var Za=()=>{};function zd(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Ga):e==null?e=Ga:lx(e,"options"),cx(r,"callback"),fx(e.signal,"options.signal"),r=Ya(r),bx(t)||mx(t))return Sx(t,e,r);if(!wx(t))throw new ux("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:za(t),s=(i=e.writable)!==null&&i!==void 0?i:$d(t),a=t._writableState,u=t._readableState,c=()=>{t.writable||y()},f=gx(t)&&za(t)===o&&$d(t)===s,l=Kd(t,!1),y=()=>{l=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||o))&&(!o||d)&&r.call(t)},d=Fd(t,!1),x=()=>{d=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||s))&&(!s||l)&&r.call(t)},h=w=>{r.call(t,w)},m=yx(t),g=()=>{m=!0;let w=Wd(t)||qd(t);if(w&&typeof w!="boolean")return r.call(t,w);if(o&&!d&&za(t,!0)&&!Fd(t,!1))return r.call(t,new kd);if(s&&!l&&!Kd(t,!1))return r.call(t,new kd);r.call(t)},v=()=>{m=!0;let w=Wd(t)||qd(t);if(w&&typeof w!="boolean")return r.call(t,w);r.call(t)},I=()=>{t.req.on("finish",y)};Ex(t)?(t.on("complete",y),f||t.on("abort",g),t.req?I():t.on("request",I)):s&&!a&&(t.on("end",c),t.on("close",c)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",g),t.on("end",x),t.on("finish",y),e.error!==!1&&t.on("error",h),t.on("close",g),m?Ut.nextTick(g):a!=null&&a.errorEmitted||u!=null&&u.errorEmitted?f||Ut.nextTick(v):(!o&&(!f||Md(t))&&(l||Hd(t)===!1)||!s&&(!f||Hd(t))&&(d||Md(t)===!1)||u&&t.req&&t.aborted)&&Ut.nextTick(v);let T=()=>{r=Za,t.removeListener("aborted",g),t.removeListener("complete",y),t.removeListener("abort",g),t.removeListener("request",I),t.req&&t.req.removeListener("finish",y),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",y),t.removeListener("end",x),t.removeListener("error",h),t.removeListener("close",g)};if(e.signal&&!m){let w=()=>{let L=r;T(),L.call(t,new jd(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Ut.nextTick(w);else{Vr=Vr||ve().addAbortListener;let L=Vr(e.signal,w),B=r;r=Ya((...R)=>{L[Vd](),B.apply(t,R)})}}return T}function Sx(t,e,r){let n=!1,i=Za;if(e.signal)if(i=()=>{n=!0,r.call(t,new jd(void 0,{cause:e.signal.reason}))},e.signal.aborted)Ut.nextTick(i);else{Vr=Vr||ve().addAbortListener;let s=Vr(e.signal,i),a=r;r=Ya((...u)=>{s[Vd](),a.apply(t,u)})}let o=(...s)=>{n||Ut.nextTick(()=>r.apply(t,s))};return px(t[xx].promise,o,o),Za}function _x(t,e){var r;let n=!1;return e===null&&(e=Ga),(r=e)!==null&&r!==void 0&&r.cleanup&&(dx(e.cleanup,"cleanup"),n=e.cleanup),new hx((i,o)=>{let s=zd(t,e,a=>{n&&s(),a?o(a):i()})})}Xa.exports=zd;Xa.exports.finished=_x});var or=q((Tv,th)=>{"use strict";var it=Ot(),{aggregateTwoErrors:Ax,codes:{ERR_MULTIPLE_CALLBACK:Ix},AbortError:vx}=Ee(),{Symbol:Zd}=G(),{kIsDestroyed:Tx,isDestroyed:Rx,isFinished:Bx,isServerRequest:Cx}=nt(),Xd=Zd("kDestroy"),Qa=Zd("kConstruct");function Qd(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function Dx(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):(Qd(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Gd(this,t,e):this.once(Xd,function(o){Gd(this,Ax(o,t),e)}),this)}function Gd(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;Qd(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?it.nextTick(Lx,t,o):it.nextTick(Jd,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function Lx(t,e){Ja(t,e),Jd(t)}function Jd(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 Ja(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 Px(){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 eu(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?it.nextTick(Ja,t,e):Ja(t,e))}function Nx(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(Qa,e),!(t.listenerCount(Qa)>1)&&it.nextTick(Ox,t)}function Ox(t){let e=!1;function r(n){if(e){eu(t,n??new Ix);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(Xd,n):n?eu(t,n,!0):it.nextTick(Ux,t)}try{t._construct(n=>{it.nextTick(r,n)})}catch(n){it.nextTick(r,n)}}function Ux(t){t.emit(Qa)}function Yd(t){return t?.setHeader&&typeof t.abort=="function"}function eh(t){t.emit("close")}function kx(t,e){t.emit("error",e),it.nextTick(eh,t)}function Mx(t,e){!t||Rx(t)||(!e&&!Bx(t)&&(e=new vx),Cx(t)?(t.socket=null,t.destroy(e)):Yd(t)?t.abort():Yd(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?it.nextTick(kx,t,e):it.nextTick(eh,t),t.destroyed||(t[Tx]=!0))}th.exports={construct:Nx,destroyer:Mx,destroy:Dx,undestroy:Px,errorOrDestroy:eu}});var co=q((Rv,nh)=>{"use strict";var{ArrayIsArray:Fx,ObjectSetPrototypeOf:rh}=G(),{EventEmitter:uo}=$n();function fo(t){uo.call(this,t)}rh(fo.prototype,uo.prototype);rh(fo,uo);fo.prototype.pipe=function(t,e){let r=this;function n(f){t.writable&&t.write(f)===!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 u(f){c(),uo.listenerCount(this,"error")===0&&this.emit("error",f)}tu(r,"error",u),tu(t,"error",u);function c(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t};function tu(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):Fx(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}nh.exports={Stream:fo,prependListener:tu}});var Kn=q((Bv,lo)=>{"use strict";var{SymbolDispose:qx}=G(),{AbortError:ih,codes:Hx}=Ee(),{isNodeStream:oh,isWebStream:$x,kControllerErrorFunction:Kx}=nt(),Wx=Et(),{ERR_INVALID_ARG_TYPE:sh}=Hx,ru,jx=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new sh(e,"AbortSignal",t)};lo.exports.addAbortSignal=function(e,r){if(jx(e,"signal"),!oh(r)&&!$x(r))throw new sh("stream",["ReadableStream","WritableStream","Stream"],r);return lo.exports.addAbortSignalNoValidate(e,r)};lo.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=oh(e)?()=>{e.destroy(new ih(void 0,{cause:t.reason}))}:()=>{e[Kx](new ih(void 0,{cause:t.reason}))};if(t.aborted)r();else{ru=ru||ve().addAbortListener;let n=ru(t,r);Wx(e,n[qx])}return e}});var fh=q((Dv,uh)=>{"use strict";var{StringPrototypeSlice:ah,SymbolIterator:Vx,TypedArrayPrototypeSet:ho,Uint8Array:zx}=G(),{Buffer:nu}=wt(),{inspect:Gx}=ve();uh.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 nu.alloc(0);let r=nu.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)ho(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}*[Vx](){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+=ah(o,0,e),this.head=n,n.data=ah(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=nu.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)ho(r,s,n-e),e-=s.length;else{e===s.length?(ho(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(ho(r,new zx(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 Gx(this,{...r,depth:0,customInspect:!1})}}});var Wn=q((Lv,hh)=>{"use strict";var{MathFloor:Yx,NumberIsInteger:Zx}=G(),{validateInteger:Xx}=Wr(),{ERR_INVALID_ARG_VALUE:Qx}=Ee().codes,ch=16*1024,lh=16;function Jx(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function dh(t){return t?lh:ch}function eE(t,e){Xx(e,"value",0),t?lh=e:ch=e}function tE(t,e,r,n){let i=Jx(e,n,r);if(i!=null){if(!Zx(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new Qx(o,i)}return Yx(i)}return dh(t.objectMode)}hh.exports={getHighWaterMark:tE,getDefaultHighWaterMark:dh,setDefaultHighWaterMark:eE}});var bh=q((iu,yh)=>{var po=wt(),ot=po.Buffer;function ph(t,e){for(var r in t)e[r]=t[r]}ot.from&&ot.alloc&&ot.allocUnsafe&&ot.allocUnsafeSlow?yh.exports=po:(ph(po,iu),iu.Buffer=sr);function sr(t,e,r){return ot(t,e,r)}sr.prototype=Object.create(ot.prototype);ph(ot,sr);sr.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ot(t,e,r)};sr.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ot(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};sr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ot(t)};sr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return po.SlowBuffer(t)}});var gh=q(wh=>{"use strict";var su=bh().Buffer,mh=su.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 rE(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 nE(t){var e=rE(t);if(typeof e!="string"&&(su.isEncoding===mh||!mh(t)))throw new Error("Unknown encoding: "+t);return e||t}wh.StringDecoder=jn;function jn(t){this.encoding=nE(t);var e;switch(this.encoding){case"utf16le":this.text=fE,this.end=cE,e=4;break;case"utf8":this.fillLast=sE,e=4;break;case"base64":this.text=lE,this.end=dE,e=3;break;default:this.write=hE,this.end=pE;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=su.allocUnsafe(e)}jn.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||""};jn.prototype.end=uE;jn.prototype.text=aE;jn.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 ou(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function iE(t,e,r){var n=e.length-1;if(n<r)return 0;var i=ou(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=ou(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=ou(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function oE(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 sE(t){var e=this.lastTotal-this.lastNeed,r=oE(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 aE(t,e){var r=iE(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 uE(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function fE(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 cE(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 lE(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 dE(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function hE(t){return t.toString(this.encoding)}function pE(t){return t&&t.length?this.write(t):""}});var au=q((Nv,_h)=>{"use strict";var xh=Ot(),{PromisePrototypeThen:yE,SymbolAsyncIterator:Eh,SymbolIterator:Sh}=G(),{Buffer:bE}=wt(),{ERR_INVALID_ARG_TYPE:mE,ERR_STREAM_NULL_VALUES:wE}=Ee().codes;function gE(t,e,r){let n;if(typeof e=="string"||e instanceof bE)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[Eh])i=!0,n=e[Eh]();else if(e&&e[Sh])i=!1,n=e[Sh]();else throw new mE("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,u())},o._destroy=function(c,f){yE(a(c),()=>xh.nextTick(f,c),l=>xh.nextTick(f,l||c))};async function a(c){let f=c!=null,l=typeof n.throw=="function";if(f&&l){let{value:y,done:d}=await n.throw(c);if(await y,d)return}if(typeof n.return=="function"){let{value:y}=await n.return();await y}}async function u(){for(;;){try{let{value:c,done:f}=i?await n.next():n.next();if(f)o.push(null);else{let l=c&&typeof c.then=="function"?await c:c;if(l===null)throw s=!1,new wE;if(o.push(l))continue;s=!1}}catch(c){o.destroy(c)}break}}return o}_h.exports=gE});var zn=q((Ov,Hh)=>{"use strict";var Ve=Ot(),{ArrayPrototypeIndexOf:xE,NumberIsInteger:EE,NumberIsNaN:SE,NumberParseInt:_E,ObjectDefineProperties:yu,ObjectKeys:AE,ObjectSetPrototypeOf:vh,Promise:Th,SafeSet:IE,SymbolAsyncDispose:vE,SymbolAsyncIterator:TE,Symbol:RE}=G();Hh.exports=M;M.ReadableState=wo;var{EventEmitter:BE}=$n(),{Stream:kt,prependListener:CE}=co(),{Buffer:uu}=wt(),{addAbortSignal:DE}=Kn(),Rh=Et(),F=ve().debuglog("stream",t=>{F=t}),LE=fh(),Yr=or(),{getHighWaterMark:PE,getDefaultHighWaterMark:NE}=Wn(),{aggregateTwoErrors:Ah,codes:{ERR_INVALID_ARG_TYPE:OE,ERR_METHOD_NOT_IMPLEMENTED:UE,ERR_OUT_OF_RANGE:kE,ERR_STREAM_PUSH_AFTER_EOF:ME,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:FE},AbortError:qE}=Ee(),{validateObject:HE}=Wr(),ar=RE("kPaused"),{StringDecoder:Bh}=gh(),$E=au();vh(M.prototype,kt.prototype);vh(M,kt);var fu=()=>{},{errorOrDestroy:zr}=Yr,Gr=1,KE=2,Ch=4,Vn=8,Dh=16,yo=32,bo=64,Lh=128,WE=256,jE=512,VE=1024,hu=2048,pu=4096,zE=8192,GE=16384,YE=32768,Ph=65536,ZE=1<<17,XE=1<<18;function ae(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}yu(wo.prototype,{objectMode:ae(Gr),ended:ae(KE),endEmitted:ae(Ch),reading:ae(Vn),constructed:ae(Dh),sync:ae(yo),needReadable:ae(bo),emittedReadable:ae(Lh),readableListening:ae(WE),resumeScheduled:ae(jE),errorEmitted:ae(VE),emitClose:ae(hu),autoDestroy:ae(pu),destroyed:ae(zE),closed:ae(GE),closeEmitted:ae(YE),multiAwaitDrain:ae(Ph),readingMore:ae(ZE),dataEmitted:ae(XE)});function wo(t,e,r){typeof r!="boolean"&&(r=e instanceof st()),this.state=hu|pu|Dh|yo,t&&t.objectMode&&(this.state|=Gr),r&&t&&t.readableObjectMode&&(this.state|=Gr),this.highWaterMark=t?PE(this,t,"readableHighWaterMark",r):NE(!1),this.buffer=new LE,this.length=0,this.pipes=[],this.flowing=null,this[ar]=null,t&&t.emitClose===!1&&(this.state&=~hu),t&&t.autoDestroy===!1&&(this.state&=~pu),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Bh(t.encoding),this.encoding=t.encoding)}function M(t){if(!(this instanceof M))return new M(t);let e=this instanceof st();this._readableState=new wo(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&&DE(t.signal,this)),kt.call(this,t),Yr.construct(this,()=>{this._readableState.needReadable&&mo(this,this._readableState)})}M.prototype.destroy=Yr.destroy;M.prototype._undestroy=Yr.undestroy;M.prototype._destroy=function(t,e){e(t)};M.prototype[BE.captureRejectionSymbol]=function(t){this.destroy(t)};M.prototype[vE]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new qE,this.destroy(t)),new Th((e,r)=>Rh(this,n=>n&&n!==t?r(n):e(null)))};M.prototype.push=function(t,e){return Nh(this,t,e,!1)};M.prototype.unshift=function(t,e){return Nh(this,t,e,!0)};function Nh(t,e,r,n){F("readableAddChunk",e);let i=t._readableState,o;if((i.state&Gr)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=uu.from(e,r).toString(i.encoding):(e=uu.from(e,r),r=""))):e instanceof uu?r="":kt._isUint8Array(e)?(e=kt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new OE("chunk",["string","Buffer","Uint8Array"],e))),o)zr(t,o);else if(e===null)i.state&=~Vn,e1(t,i);else if((i.state&Gr)!==0||e&&e.length>0)if(n)if((i.state&Ch)!==0)zr(t,new FE);else{if(i.destroyed||i.errored)return!1;cu(t,i,e,!0)}else if(i.ended)zr(t,new ME);else{if(i.destroyed||i.errored)return!1;i.state&=~Vn,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?cu(t,i,e,!1):mo(t,i)):cu(t,i,e,!1)}else n||(i.state&=~Vn,mo(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function cu(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&Ph)!==0?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&bo)!==0&&go(t)),mo(t,e)}M.prototype.isPaused=function(){let t=this._readableState;return t[ar]===!0||t.flowing===!1};M.prototype.setEncoding=function(t){let e=new Bh(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 QE=1073741824;function JE(t){if(t>QE)throw new kE("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Ih(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Gr)!==0?1:SE(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}M.prototype.read=function(t){F("read",t),t===void 0?t=NaN:EE(t)||(t=_E(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=JE(t)),t!==0&&(e.state&=~Lh),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return F("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?lu(this):go(this),null;if(t=Ih(t,e),t===0&&e.ended)return e.length===0&&lu(this),null;let n=(e.state&bo)!==0;if(F("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,F("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,F("reading, ended or constructing",n);else if(n){F("do read"),e.state|=Vn|yo,e.length===0&&(e.state|=bo);try{this._read(e.highWaterMark)}catch(o){zr(this,o)}e.state&=~yo,e.reading||(t=Ih(r,e))}let i;return t>0?i=Fh(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&&lu(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function e1(t,e){if(F("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?go(t):(e.needReadable=!1,e.emittedReadable=!0,Oh(t))}}function go(t){let e=t._readableState;F("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(F("emitReadable",e.flowing),e.emittedReadable=!0,Ve.nextTick(Oh,t))}function Oh(t){let e=t._readableState;F("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,kh(t)}function mo(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ve.nextTick(t1,t,e))}function t1(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(F("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}M.prototype._read=function(t){throw new UE("_read()")};M.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new IE(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),F("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Ve.stdout&&t!==Ve.stderr?a:m;n.endEmitted?Ve.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(g,v){F("onunpipe"),g===r&&v&&v.hasUnpiped===!1&&(v.hasUnpiped=!0,f())}function a(){F("onend"),t.end()}let u,c=!1;function f(){F("cleanup"),t.removeListener("close",x),t.removeListener("finish",h),u&&t.removeListener("drain",u),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",m),r.removeListener("data",y),c=!0,u&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function l(){c||(n.pipes.length===1&&n.pipes[0]===t?(F("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(F("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=r1(r,t),t.on("drain",u))}r.on("data",y);function y(g){F("ondata");let v=t.write(g);F("dest.write",v),v===!1&&l()}function d(g){if(F("onerror",g),m(),t.removeListener("error",d),t.listenerCount("error")===0){let v=t._writableState||t._readableState;v&&!v.errorEmitted?zr(t,g):t.emit("error",g)}}CE(t,"error",d);function x(){t.removeListener("finish",h),m()}t.once("close",x);function h(){F("onfinish"),t.removeListener("close",x),m()}t.once("finish",h);function m(){F("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?l():n.flowing||(F("pipe resume"),r.resume()),t};function r1(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(F("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(F("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}M.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=xE(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};M.prototype.on=function(t,e){let r=kt.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,F("on readable",n.length,n.reading),n.length?go(this):n.reading||Ve.nextTick(n1,this)),r};M.prototype.addListener=M.prototype.on;M.prototype.removeListener=function(t,e){let r=kt.prototype.removeListener.call(this,t,e);return t==="readable"&&Ve.nextTick(Uh,this),r};M.prototype.off=M.prototype.removeListener;M.prototype.removeAllListeners=function(t){let e=kt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ve.nextTick(Uh,this),e};function Uh(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[ar]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function n1(t){F("readable nexttick read 0"),t.read(0)}M.prototype.resume=function(){let t=this._readableState;return t.flowing||(F("resume"),t.flowing=!t.readableListening,i1(this,t)),t[ar]=!1,this};function i1(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ve.nextTick(o1,t,e))}function o1(t,e){F("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),kh(t),e.flowing&&!e.reading&&t.read(0)}M.prototype.pause=function(){return F("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(F("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[ar]=!0,this};function kh(t){let e=t._readableState;for(F("flow",e.flowing);e.flowing&&t.read()!==null;);}M.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=>{zr(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=AE(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};M.prototype[TE]=function(){return Mh(this)};M.prototype.iterator=function(t){return t!==void 0&&HE(t,"options"),Mh(this,t)};function Mh(t,e){typeof t.read!="function"&&(t=M.wrap(t,{objectMode:!0}));let r=s1(t,e);return r.stream=t,r}async function*s1(t,e){let r=fu;function n(s){this===t?(r(),r=fu):r=s}t.on("readable",n);let i,o=Rh(t,{writable:!1},s=>{i=s?Ah(i,s):null,r(),r=fu});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 Th(n)}}}catch(s){throw i=Ah(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Yr.destroyer(t,null):(t.off("readable",n),o())}}yu(M.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}}});yu(wo.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[ar]!==!1},set(t){this[ar]=!!t}}});M._fromList=Fh;function Fh(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 lu(t){let e=t._readableState;F("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ve.nextTick(a1,e,t))}function a1(t,e){if(F("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)Ve.nextTick(u1,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function u1(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}M.from=function(t,e){return $E(M,t,e)};var du;function qh(){return du===void 0&&(du={}),du}M.fromWeb=function(t,e){return qh().newStreamReadableFromReadableStream(t,e)};M.toWeb=function(t,e){return qh().newReadableStreamFromStreamReadable(t,e)};M.wrap=function(t,e){var r,n;return new M({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){Yr.destroyer(t,i),o(i)}}).wrap(t)}});var Ao=q((Uv,Jh)=>{"use strict";var ur=Ot(),{ArrayPrototypeSlice:Wh,Error:f1,FunctionPrototypeSymbolHasInstance:jh,ObjectDefineProperty:Vh,ObjectDefineProperties:c1,ObjectSetPrototypeOf:zh,StringPrototypeToLowerCase:l1,Symbol:d1,SymbolHasInstance:h1}=G();Jh.exports=Q;Q.WritableState=Zn;var{EventEmitter:p1}=$n(),Gn=co().Stream,{Buffer:xo}=wt(),_o=or(),{addAbortSignal:y1}=Kn(),{getHighWaterMark:b1,getDefaultHighWaterMark:m1}=Wn(),{ERR_INVALID_ARG_TYPE:w1,ERR_METHOD_NOT_IMPLEMENTED:g1,ERR_MULTIPLE_CALLBACK:Gh,ERR_STREAM_CANNOT_PIPE:x1,ERR_STREAM_DESTROYED:Yn,ERR_STREAM_ALREADY_FINISHED:E1,ERR_STREAM_NULL_VALUES:S1,ERR_STREAM_WRITE_AFTER_END:_1,ERR_UNKNOWN_ENCODING:Yh}=Ee().codes,{errorOrDestroy:Zr}=_o;zh(Q.prototype,Gn.prototype);zh(Q,Gn);function wu(){}var Xr=d1("kOnFinished");function Zn(t,e,r){typeof r!="boolean"&&(r=e instanceof st()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?b1(this,t,"writableHighWaterMark",r):m1(!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=I1.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,So(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[Xr]=[]}function So(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Zn.prototype.getBuffer=function(){return Wh(this.buffered,this.bufferedIndex)};Vh(Zn.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function Q(t){let e=this instanceof st();if(!e&&!jh(Q,this))return new Q(t);this._writableState=new Zn(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&&y1(t.signal,this)),Gn.call(this,t),_o.construct(this,()=>{let r=this._writableState;r.writing||xu(this,r),Eu(this,r)})}Vh(Q,h1,{__proto__:null,value:function(t){return jh(this,t)?!0:this!==Q?!1:t&&t._writableState instanceof Zn}});Q.prototype.pipe=function(){Zr(this,new x1)};function Zh(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"&&!xo.isEncoding(r))throw new Yh(r);typeof n!="function"&&(n=wu)}if(e===null)throw new S1;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=xo.from(e,r),r="buffer");else if(e instanceof xo)r="buffer";else if(Gn._isUint8Array(e))e=Gn._uint8ArrayToBuffer(e),r="buffer";else throw new w1("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new _1:i.destroyed&&(o=new Yn("write")),o?(ur.nextTick(n,o),Zr(t,o,!0),o):(i.pendingcb++,A1(t,i,e,r,n))}Q.prototype.write=function(t,e,r){return Zh(this,t,e,r)===!0};Q.prototype.cork=function(){this._writableState.corked++};Q.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||xu(this,t))};Q.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=l1(e)),!xo.isEncoding(e))throw new Yh(e);return this._writableState.defaultEncoding=e,this};function A1(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!==wu&&(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 $h(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Yn("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function Kh(t,e,r,n){--e.pendingcb,n(r),gu(e),Zr(t,r)}function I1(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Zr(t,new Gh);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?ur.nextTick(Kh,t,r,e,i):Kh(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&xu(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},ur.nextTick(v1,r.afterWriteTickInfo)):Xh(t,r,1,i))}function v1({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Xh(t,e,r,n)}function Xh(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&&gu(e),Eu(t,e)}function gu(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 Yn("write"))}let r=t[Xr].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Yn("end"))}So(t)}function xu(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?wu:c=>{for(let f=s;f<r.length;++f)r[f].callback(c)},u=e.allNoop&&s===0?r:Wh(r,s);u.allBuffers=e.allBuffers,$h(t,e,!0,e.length,u,"",a),So(e)}else{do{let{chunk:a,encoding:u,callback:c}=r[s];r[s++]=null;let f=i?1:a.length;$h(t,e,!1,f,a,u,c)}while(s<r.length&&!e.writing);s===r.length?So(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}Q.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new g1("_write()")};Q.prototype._writev=null;Q.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=Zh(this,t,e);o instanceof f1&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Eu(this,n,!0),n.ended=!0):n.finished?i=new E1("end"):n.destroyed&&(i=new Yn("end"))),typeof r=="function"&&(i||n.finished?ur.nextTick(r,i):n[Xr].push(r)),this};function Eo(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 T1(t,e){let r=!1;function n(i){if(r){Zr(t,i??Gh());return}if(r=!0,e.pendingcb--,i){let o=e[Xr].splice(0);for(let s=0;s<o.length;s++)o[s](i);Zr(t,i,e.sync)}else Eo(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,ur.nextTick(mu,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function R1(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,T1(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Eu(t,e,r){Eo(e)&&(R1(t,e),e.pendingcb===0&&(r?(e.pendingcb++,ur.nextTick((n,i)=>{Eo(i)?mu(n,i):i.pendingcb--},t,e)):Eo(e)&&(e.pendingcb++,mu(t,e))))}function mu(t,e){e.pendingcb--,e.finished=!0;let r=e[Xr].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()}}c1(Q.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 B1=_o.destroy;Q.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[Xr].length)&&ur.nextTick(gu,r),B1.call(this,t,e),this};Q.prototype._undestroy=_o.undestroy;Q.prototype._destroy=function(t,e){e(t)};Q.prototype[p1.captureRejectionSymbol]=function(t){this.destroy(t)};var bu;function Qh(){return bu===void 0&&(bu={}),bu}Q.fromWeb=function(t,e){return Qh().newStreamWritableFromWritableStream(t,e)};Q.toWeb=function(t){return Qh().newWritableStreamFromStreamWritable(t)}});var pp=q((kv,hp)=>{var Su=Ot(),C1=wt(),{isReadable:D1,isWritable:L1,isIterable:ep,isNodeStream:P1,isReadableNodeStream:tp,isWritableNodeStream:rp,isDuplexNodeStream:N1,isReadableStream:np,isWritableStream:ip}=nt(),op=Et(),{AbortError:lp,codes:{ERR_INVALID_ARG_TYPE:O1,ERR_INVALID_RETURN_VALUE:sp}}=Ee(),{destroyer:Jr}=or(),U1=st(),dp=zn(),k1=Ao(),{createDeferredPromise:ap}=ve(),up=au(),fp=globalThis.Blob||C1.Blob,M1=typeof fp<"u"?function(e){return e instanceof fp}:function(e){return!1},F1=globalThis.AbortController||Hr().AbortController,{FunctionPrototypeCall:cp}=G(),Mt=class extends U1{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)}};hp.exports=function t(e,r){if(N1(e))return e;if(tp(e))return Qr({readable:e});if(rp(e))return Qr({writable:e});if(P1(e))return Qr({writable:!1,readable:!1});if(np(e))return Qr({readable:dp.fromWeb(e)});if(ip(e))return Qr({writable:k1.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=q1(e);if(ep(i))return up(Mt,i,{objectMode:!0,write:o,final:s,destroy:a});let u=i?.then;if(typeof u=="function"){let c,f=cp(u,i,l=>{if(l!=null)throw new sp("nully","body",l)},l=>{Jr(c,l)});return c=new Mt({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await f,Su.nextTick(l,null)}catch(y){Su.nextTick(l,y)}})},destroy:a})}throw new sp("Iterable, AsyncIterable or AsyncFunction",r,i)}if(M1(e))return t(e.arrayBuffer());if(ep(e))return up(Mt,e,{objectMode:!0,writable:!1});if(np(e?.readable)&&ip(e?.writable))return Mt.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?tp(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?rp(e?.writable)?e?.writable:t(e.writable):void 0;return Qr({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return cp(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{Jr(i,o)}),i=new Mt({objectMode:!0,writable:!1,read(){}})}throw new O1(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function q1(t){let{promise:e,resolve:r}=ap(),n=new F1,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:u,cb:c}=await s;if(Su.nextTick(c),u)return;if(i.aborted)throw new lp(void 0,{cause:i.reason});({promise:e,resolve:r}=ap()),yield a}}(),{signal:i}),write(s,a,u){let c=r;r=null,c({chunk:s,done:!1,cb:u})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function Qr(t){let e=t.readable&&typeof t.readable.read!="function"?dp.wrap(t.readable):t.readable,r=t.writable,n=!!D1(e),i=!!L1(r),o,s,a,u,c;function f(l){let y=u;u=null,y?y(l):l&&c.destroy(l)}return c=new Mt({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(op(r,l=>{i=!1,l&&Jr(e,l),f(l)}),c._write=function(l,y,d){r.write(l,y)?d():o=d},c._final=function(l){r.end(),s=l},r.on("drain",function(){if(o){let l=o;o=null,l()}}),r.on("finish",function(){if(s){let l=s;s=null,l()}})),n&&(op(e,l=>{n=!1,l&&Jr(e,l),f(l)}),e.on("readable",function(){if(a){let l=a;a=null,l()}}),e.on("end",function(){c.push(null)}),c._read=function(){for(;;){let l=e.read();if(l===null){a=c._read;return}if(!c.push(l))return}}),c._destroy=function(l,y){!l&&u!==null&&(l=new lp),a=null,o=null,s=null,u===null?y(l):(u=y,Jr(r,l),Jr(e,l))},c}});var st=q((Mv,mp)=>{"use strict";var{ObjectDefineProperties:H1,ObjectGetOwnPropertyDescriptor:St,ObjectKeys:$1,ObjectSetPrototypeOf:yp}=G();mp.exports=ze;var Iu=zn(),Me=Ao();yp(ze.prototype,Iu.prototype);yp(ze,Iu);{let t=$1(Me.prototype);for(let e=0;e<t.length;e++){let r=t[e];ze.prototype[r]||(ze.prototype[r]=Me.prototype[r])}}function ze(t){if(!(this instanceof ze))return new ze(t);Iu.call(this,t),Me.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}H1(ze.prototype,{writable:{__proto__:null,...St(Me.prototype,"writable")},writableHighWaterMark:{__proto__:null,...St(Me.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...St(Me.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...St(Me.prototype,"writableBuffer")},writableLength:{__proto__:null,...St(Me.prototype,"writableLength")},writableFinished:{__proto__:null,...St(Me.prototype,"writableFinished")},writableCorked:{__proto__:null,...St(Me.prototype,"writableCorked")},writableEnded:{__proto__:null,...St(Me.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...St(Me.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 _u;function bp(){return _u===void 0&&(_u={}),_u}ze.fromWeb=function(t,e){return bp().newStreamDuplexFromReadableWritablePair(t,e)};ze.toWeb=function(t){return bp().newReadableWritablePairFromDuplex(t)};var Au;ze.from=function(t){return Au||(Au=pp()),Au(t,"body")}});var Ru=q((Fv,gp)=>{"use strict";var{ObjectSetPrototypeOf:wp,Symbol:K1}=G();gp.exports=_t;var{ERR_METHOD_NOT_IMPLEMENTED:W1}=Ee().codes,Tu=st(),{getHighWaterMark:j1}=Wn();wp(_t.prototype,Tu.prototype);wp(_t,Tu);var Xn=K1("kCallback");function _t(t){if(!(this instanceof _t))return new _t(t);let e=t?j1(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Tu.call(this,t),this._readableState.sync=!1,this[Xn]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",V1)}function vu(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 V1(){this._final!==vu&&vu.call(this)}_t.prototype._final=vu;_t.prototype._transform=function(t,e,r){throw new W1("_transform()")};_t.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[Xn]=r})};_t.prototype._read=function(){if(this[Xn]){let t=this[Xn];this[Xn]=null,t()}}});var Cu=q((qv,Ep)=>{"use strict";var{ObjectSetPrototypeOf:xp}=G();Ep.exports=en;var Bu=Ru();xp(en.prototype,Bu.prototype);xp(en,Bu);function en(t){if(!(this instanceof en))return new en(t);Bu.call(this,t)}en.prototype._transform=function(t,e,r){r(null,t)}});var Ro=q((Hv,vp)=>{var Qn=Ot(),{ArrayIsArray:z1,Promise:G1,SymbolAsyncIterator:Y1,SymbolDispose:Z1}=G(),To=Et(),{once:X1}=ve(),Q1=or(),Sp=st(),{aggregateTwoErrors:J1,codes:{ERR_INVALID_ARG_TYPE:Fu,ERR_INVALID_RETURN_VALUE:Du,ERR_MISSING_ARGS:e2,ERR_STREAM_DESTROYED:t2,ERR_STREAM_PREMATURE_CLOSE:r2},AbortError:n2}=Ee(),{validateFunction:i2,validateAbortSignal:o2}=Wr(),{isIterable:fr,isReadable:Lu,isReadableNodeStream:vo,isNodeStream:_p,isTransformStream:tn,isWebStream:s2,isReadableStream:Pu,isReadableFinished:a2}=nt(),u2=globalThis.AbortController||Hr().AbortController,Nu,Ou,Uu;function Ap(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=To(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,Q1.destroyer(t,o||new t2("pipe")))},cleanup:i}}function f2(t){return i2(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function ku(t){if(fr(t))return t;if(vo(t))return c2(t);throw new Fu("val",["Readable","Iterable","AsyncIterable"],t)}async function*c2(t){Ou||(Ou=zn()),yield*Ou.prototype[Y1].call(t)}async function Io(t,e,r,{end:n}){let i,o=null,s=c=>{if(c&&(i=c),o){let f=o;o=null,f()}},a=()=>new G1((c,f)=>{i?f(i):o=()=>{i?f(i):c()}});e.on("drain",s);let u=To(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let c of t)e.write(c)||await a();n&&(e.end(),await a()),r()}catch(c){r(i!==c?J1(i,c):c)}finally{u(),e.off("drain",s)}}async function Mu(t,e,r,{end:n}){tn(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 l2(...t){return Ip(t,X1(f2(t)))}function Ip(t,e,r){if(t.length===1&&z1(t[0])&&(t=t[0]),t.length<2)throw new e2("streams");let n=new u2,i=n.signal,o=r?.signal,s=[];o2(o,"options.signal");function a(){x(new n2)}Uu=Uu||ve().addAbortListener;let u;o&&(u=Uu(o,a));let c,f,l=[],y=0;function d(I){x(I,--y===0)}function x(I,T){var w;if(I&&(!c||c.code==="ERR_STREAM_PREMATURE_CLOSE")&&(c=I),!(!c&&!T)){for(;l.length;)l.shift()(c);(w=u)===null||w===void 0||w[Z1](),n.abort(),T&&(c||s.forEach(L=>L()),Qn.nextTick(e,c,f))}}let h;for(let I=0;I<t.length;I++){let T=t[I],w=I<t.length-1,L=I>0,B=w||r?.end!==!1,R=I===t.length-1;if(_p(T)){let p=function(S){S&&S.name!=="AbortError"&&S.code!=="ERR_STREAM_PREMATURE_CLOSE"&&d(S)};var v=p;if(B){let{destroy:S,cleanup:E}=Ap(T,w,L);l.push(S),Lu(T)&&R&&s.push(E)}T.on("error",p),Lu(T)&&R&&s.push(()=>{T.removeListener("error",p)})}if(I===0)if(typeof T=="function"){if(h=T({signal:i}),!fr(h))throw new Du("Iterable, AsyncIterable or Stream","source",h)}else fr(T)||vo(T)||tn(T)?h=T:h=Sp.from(T);else if(typeof T=="function"){if(tn(h)){var m;h=ku((m=h)===null||m===void 0?void 0:m.readable)}else h=ku(h);if(h=T(h,{signal:i}),w){if(!fr(h,!0))throw new Du("AsyncIterable",`transform[${I-1}]`,h)}else{var g;Nu||(Nu=Cu());let p=new Nu({objectMode:!0}),S=(g=h)===null||g===void 0?void 0:g.then;if(typeof S=="function")y++,S.call(h,A=>{f=A,A!=null&&p.write(A),B&&p.end(),Qn.nextTick(d)},A=>{p.destroy(A),Qn.nextTick(d,A)});else if(fr(h,!0))y++,Io(h,p,d,{end:B});else if(Pu(h)||tn(h)){let A=h.readable||h;y++,Io(A,p,d,{end:B})}else throw new Du("AsyncIterable or Promise","destination",h);h=p;let{destroy:E,cleanup:_}=Ap(h,!1,!0);l.push(E),R&&s.push(_)}}else if(_p(T)){if(vo(h)){y+=2;let p=d2(h,T,d,{end:B});Lu(T)&&R&&s.push(p)}else if(tn(h)||Pu(h)){let p=h.readable||h;y++,Io(p,T,d,{end:B})}else if(fr(h))y++,Io(h,T,d,{end:B});else throw new Fu("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=T}else if(s2(T)){if(vo(h))y++,Mu(ku(h),T,d,{end:B});else if(Pu(h)||fr(h))y++,Mu(h,T,d,{end:B});else if(tn(h))y++,Mu(h.readable,T,d,{end:B});else throw new Fu("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=T}else h=Sp.from(T)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Qn.nextTick(a),h}function d2(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new r2)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;a2(t)?Qn.nextTick(s):t.once("end",s)}else r();return To(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)}),To(e,{readable:!1,writable:!0},r)}vp.exports={pipelineImpl:Ip,pipeline:l2}});var Hu=q(($v,Lp)=>{"use strict";var{pipeline:h2}=Ro(),Bo=st(),{destroyer:p2}=or(),{isNodeStream:Co,isReadable:Tp,isWritable:Rp,isWebStream:qu,isTransformStream:cr,isWritableStream:Bp,isReadableStream:Cp}=nt(),{AbortError:y2,codes:{ERR_INVALID_ARG_VALUE:Dp,ERR_MISSING_ARGS:b2}}=Ee(),m2=Et();Lp.exports=function(...e){if(e.length===0)throw new b2("streams");if(e.length===1)return Bo.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Bo.from(e[0])),typeof e[e.length-1]=="function"){let d=e.length-1;e[d]=Bo.from(e[d])}for(let d=0;d<e.length;++d)if(!(!Co(e[d])&&!qu(e[d]))){if(d<e.length-1&&!(Tp(e[d])||Cp(e[d])||cr(e[d])))throw new Dp(`streams[${d}]`,r[d],"must be readable");if(d>0&&!(Rp(e[d])||Bp(e[d])||cr(e[d])))throw new Dp(`streams[${d}]`,r[d],"must be writable")}let n,i,o,s,a;function u(d){let x=s;s=null,x?x(d):d?a.destroy(d):!y&&!l&&a.destroy()}let c=e[0],f=h2(e,u),l=!!(Rp(c)||Bp(c)||cr(c)),y=!!(Tp(f)||Cp(f)||cr(f));if(a=new Bo({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:l,readable:y}),l){if(Co(c))a._write=function(x,h,m){c.write(x,h)?m():n=m},a._final=function(x){c.end(),i=x},c.on("drain",function(){if(n){let x=n;n=null,x()}});else if(qu(c)){let h=(cr(c)?c.writable:c).getWriter();a._write=async function(m,g,v){try{await h.ready,h.write(m).catch(()=>{}),v()}catch(I){v(I)}},a._final=async function(m){try{await h.ready,h.close().catch(()=>{}),i=m}catch(g){m(g)}}}let d=cr(f)?f.readable:f;m2(d,()=>{if(i){let x=i;i=null,x()}})}if(y){if(Co(f))f.on("readable",function(){if(o){let d=o;o=null,d()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let d=f.read();if(d===null){o=a._read;return}if(!a.push(d))return}};else if(qu(f)){let x=(cr(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:h,done:m}=await x.read();if(!a.push(h))return;if(m){a.push(null);return}}catch{return}}}}return a._destroy=function(d,x){!d&&s!==null&&(d=new y2),o=null,n=null,i=null,s===null?x(d):(s=x,Co(f)&&p2(f,d))},a}});var $p=q((Kv,Wu)=>{"use strict";var w2=globalThis.AbortController||Hr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:g2,ERR_INVALID_ARG_TYPE:Jn,ERR_MISSING_ARGS:x2,ERR_OUT_OF_RANGE:E2},AbortError:at}=Ee(),{validateAbortSignal:lr,validateInteger:Pp,validateObject:dr}=Wr(),S2=G().Symbol("kWeak"),_2=G().Symbol("kResistStopPropagation"),{finished:A2}=Et(),I2=Hu(),{addAbortSignalNoValidate:v2}=Kn(),{isWritable:T2,isNodeStream:R2}=nt(),{deprecate:B2}=ve(),{ArrayPrototypePush:C2,Boolean:D2,MathFloor:Np,Number:L2,NumberIsNaN:P2,Promise:Op,PromiseReject:Up,PromiseResolve:N2,PromisePrototypeThen:kp,Symbol:Fp}=G(),Do=Fp("kEmpty"),Mp=Fp("kEof");function O2(t,e){if(e!=null&&dr(e,"options"),e?.signal!=null&&lr(e.signal,"options.signal"),R2(t)&&!T2(t))throw new g2("stream",t,"must be writable");let r=I2(this,t);return e!=null&&e.signal&&v2(e.signal,r),r}function Lo(t,e){if(typeof t!="function")throw new Jn("fn",["Function","AsyncFunction"],t);e!=null&&dr(e,"options"),e?.signal!=null&&lr(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Np(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Np(e.highWaterMark)),Pp(r,"options.concurrency",1),Pp(n,"options.highWaterMark",0),n+=r,async function*(){let o=ve().AbortSignalAny([e?.signal].filter(D2)),s=this,a=[],u={signal:o},c,f,l=!1,y=0;function d(){l=!0,x()}function x(){y-=1,h()}function h(){f&&!l&&y<r&&a.length<n&&(f(),f=null)}async function m(){try{for await(let g of s){if(l)return;if(o.aborted)throw new at;try{if(g=t(g,u),g===Do)continue;g=N2(g)}catch(v){g=Up(v)}y+=1,kp(g,x,d),a.push(g),c&&(c(),c=null),!l&&(a.length>=n||y>=r)&&await new Op(v=>{f=v})}a.push(Mp)}catch(g){let v=Up(g);kp(v,x,d),a.push(v)}finally{l=!0,c&&(c(),c=null)}}m();try{for(;;){for(;a.length>0;){let g=await a[0];if(g===Mp)return;if(o.aborted)throw new at;g!==Do&&(yield g),a.shift(),h()}await new Op(g=>{c=g})}}finally{l=!0,f&&(f(),f=null)}}.call(this)}function U2(t=void 0){return t!=null&&dr(t,"options"),t?.signal!=null&&lr(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 at({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function qp(t,e=void 0){for await(let r of Ku.call(this,t,e))return!0;return!1}async function k2(t,e=void 0){if(typeof t!="function")throw new Jn("fn",["Function","AsyncFunction"],t);return!await qp.call(this,async(...r)=>!await t(...r),e)}async function M2(t,e){for await(let r of Ku.call(this,t,e))return r}async function F2(t,e){if(typeof t!="function")throw new Jn("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),Do}for await(let n of Lo.call(this,r,e));}function Ku(t,e){if(typeof t!="function")throw new Jn("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:Do}return Lo.call(this,r,e)}var $u=class extends x2{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function q2(t,e,r){var n;if(typeof t!="function")throw new Jn("reducer",["Function","AsyncFunction"],t);r!=null&&dr(r,"options"),r?.signal!=null&&lr(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let c=new at(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await A2(this.destroy(c)),c}let o=new w2,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[S2]:this,[_2]:!0};r.signal.addEventListener("abort",()=>o.abort(),c)}let a=!1;try{for await(let c of this){var u;if(a=!0,r!=null&&(u=r.signal)!==null&&u!==void 0&&u.aborted)throw new at;i?e=await t(e,c,{signal:s}):(e=c,i=!0)}if(!a&&!i)throw new $u}finally{o.abort()}return e}async function H2(t){t!=null&&dr(t,"options"),t?.signal!=null&&lr(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 at(void 0,{cause:t.signal.reason});C2(e,n)}return e}function $2(t,e){let r=Lo.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function Hp(t){if(t=L2(t),P2(t))return 0;if(t<0)throw new E2("number",">= 0",t);return t}function K2(t,e=void 0){return e!=null&&dr(e,"options"),e?.signal!=null&&lr(e.signal,"options.signal"),t=Hp(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new at;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new at;t--<=0&&(yield o)}}.call(this)}function W2(t,e=void 0){return e!=null&&dr(e,"options"),e?.signal!=null&&lr(e.signal,"options.signal"),t=Hp(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new at;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new at;if(t-- >0&&(yield o),t<=0)return}}.call(this)}Wu.exports.streamReturningOperators={asIndexedPairs:B2(U2,"readable.asIndexedPairs will be removed in a future version."),drop:K2,filter:Ku,flatMap:$2,map:Lo,take:W2,compose:O2};Wu.exports.promiseReturningOperators={every:k2,forEach:F2,reduce:q2,toArray:H2,some:qp,find:M2}});var ju=q((Wv,Kp)=>{"use strict";var{ArrayPrototypePop:j2,Promise:V2}=G(),{isIterable:z2,isNodeStream:G2,isWebStream:Y2}=nt(),{pipelineImpl:Z2}=Ro(),{finished:X2}=Et();Vu();function Q2(...t){return new V2((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!G2(o)&&!z2(o)&&!Y2(o)){let s=j2(t);n=s.signal,i=s.end}Z2(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}Kp.exports={finished:X2,pipeline:Q2}});var Vu=q((jv,Qp)=>{"use strict";var{Buffer:J2}=wt(),{ObjectDefineProperty:At,ObjectKeys:Vp,ReflectApply:zp}=G(),{promisify:{custom:Gp}}=ve(),{streamReturningOperators:Wp,promiseReturningOperators:jp}=$p(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:Yp}}=Ee(),eS=Hu(),{setDefaultHighWaterMark:tS,getDefaultHighWaterMark:rS}=Wn(),{pipeline:Zp}=Ro(),{destroyer:nS}=or(),Xp=Et(),zu=ju(),ei=nt(),j=Qp.exports=co().Stream;j.isDestroyed=ei.isDestroyed;j.isDisturbed=ei.isDisturbed;j.isErrored=ei.isErrored;j.isReadable=ei.isReadable;j.isWritable=ei.isWritable;j.Readable=zn();for(let t of Vp(Wp)){let r=function(...n){if(new.target)throw Yp();return j.Readable.from(zp(e,this,n))},e=Wp[t];At(r,"name",{__proto__:null,value:e.name}),At(r,"length",{__proto__:null,value:e.length}),At(j.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of Vp(jp)){let r=function(...n){if(new.target)throw Yp();return zp(e,this,n)},e=jp[t];At(r,"name",{__proto__:null,value:e.name}),At(r,"length",{__proto__:null,value:e.length}),At(j.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}j.Writable=Ao();j.Duplex=st();j.Transform=Ru();j.PassThrough=Cu();j.pipeline=Zp;var{addAbortSignal:iS}=Kn();j.addAbortSignal=iS;j.finished=Xp;j.destroy=nS;j.compose=eS;j.setDefaultHighWaterMark=tS;j.getDefaultHighWaterMark=rS;At(j,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return zu}});At(Zp,Gp,{__proto__:null,enumerable:!0,get(){return zu.pipeline}});At(Xp,Gp,{__proto__:null,enumerable:!0,get(){return zu.finished}});j.Stream=j;j._isUint8Array=function(e){return e instanceof Uint8Array};j._uint8ArrayToBuffer=function(e){return J2.from(e.buffer,e.byteOffset,e.byteLength)}});var Jp=q((Vv,ne)=>{"use strict";var ue=Vu(),oS=ju(),sS=ue.Readable.destroy;ne.exports=ue.Readable;ne.exports._uint8ArrayToBuffer=ue._uint8ArrayToBuffer;ne.exports._isUint8Array=ue._isUint8Array;ne.exports.isDisturbed=ue.isDisturbed;ne.exports.isErrored=ue.isErrored;ne.exports.isReadable=ue.isReadable;ne.exports.Readable=ue.Readable;ne.exports.Writable=ue.Writable;ne.exports.Duplex=ue.Duplex;ne.exports.Transform=ue.Transform;ne.exports.PassThrough=ue.PassThrough;ne.exports.addAbortSignal=ue.addAbortSignal;ne.exports.finished=ue.finished;ne.exports.destroy=ue.destroy;ne.exports.destroy=sS;ne.exports.pipeline=ue.pipeline;ne.exports.compose=ue.compose;Object.defineProperty(ue,"promises",{configurable:!0,enumerable:!0,get(){return oS}});ne.exports.Stream=ue.Stream;ne.exports.default=ne.exports});var AS={};Re(AS,{BAD_REQUEST:()=>pS,INTERNAL_SERVER_ERROR:()=>yS,NOT_FOUND_RESPONSE:()=>hS,NOT_IMPLEMENTED_ERROR:()=>bS,Request:()=>Fn,Response:()=>Sa,STATUS_CODES:()=>Ea,getHeader:()=>gS,getHeaders:()=>qn,getHost:()=>o0,getServerUpgradeHeaders:()=>SS,isWebSocketUpgrade:()=>xa,normalizeMethod:()=>xS,normalizeUrl:()=>a0,readHeaders:()=>_S,responseToStream:()=>dS,streamToRequest:()=>lS,streamToSocket:()=>aS,stripHTTPPath:()=>s0,toResource:()=>wS,toURL:()=>fS,toUint8Array:()=>cS,writeHeaders:()=>i0});var Fo={};Re(Fo,{base10:()=>E0});var vS=new Uint8Array(0);function Zu(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 ut(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")}function Xu(t){return new TextEncoder().encode(t)}function Qu(t){return new TextDecoder().decode(t)}function y0(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,u=t.charAt(0),c=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function l(x){if(x instanceof Uint8Array||(ArrayBuffer.isView(x)?x=new Uint8Array(x.buffer,x.byteOffset,x.byteLength):Array.isArray(x)&&(x=Uint8Array.from(x))),!(x instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(x.length===0)return"";for(var h=0,m=0,g=0,v=x.length;g!==v&&x[g]===0;)g++,h++;for(var I=(v-g)*f+1>>>0,T=new Uint8Array(I);g!==v;){for(var w=x[g],L=0,B=I-1;(w!==0||L<m)&&B!==-1;B--,L++)w+=256*T[B]>>>0,T[B]=w%a>>>0,w=w/a>>>0;if(w!==0)throw new Error("Non-zero carry");m=L,g++}for(var R=I-m;R!==I&&T[R]===0;)R++;for(var p=u.repeat(h);R<I;++R)p+=t.charAt(T[R]);return p}function y(x){if(typeof x!="string")throw new TypeError("Expected String");if(x.length===0)return new Uint8Array;var h=0;if(x[h]!==" "){for(var m=0,g=0;x[h]===u;)m++,h++;for(var v=(x.length-h)*c+1>>>0,I=new Uint8Array(v);x[h];){var T=r[x.charCodeAt(h)];if(T===255)return;for(var w=0,L=v-1;(T!==0||w<g)&&L!==-1;L--,w++)T+=a*I[L]>>>0,I[L]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");g=w,h++}if(x[h]!==" "){for(var B=v-g;B!==v&&I[B]===0;)B++;for(var R=new Uint8Array(m+(v-B)),p=m;B!==v;)R[p++]=I[B++];return R}}}function d(x){var h=y(x);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:y,decode:d}}var b0=y0,m0=b0,ef=m0;var Oo=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")}},Uo=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){this.name=e,this.prefix=r;let i=r.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,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 tf(this,e)}},ko=class{decoders;constructor(e){this.decoders=e}or(e){return tf(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 tf(t,e){return new ko({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Mo=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 Oo(e,r,n),this.decoder=new Uo(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function yr({name:t,prefix:e,encode:r,decode:n}){return new Mo(t,e,r,n)}function It({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=ef(r,t);return yr({prefix:e,name:t,encode:n,decode:o=>ut(i(o))})}function w0(t,e,r,n){let i=t.length;for(;t[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),s=0,a=0,u=0;for(let c=0;c<i;++c){let f=e[t[c]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|f,s+=r,s>=8&&(s-=8,o[u++]=255&a>>s)}if(s>=r||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function g0(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<t.length;++u)for(a=a<<8|t[u],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)!==0;)o+="=";return o}function x0(t){let e={};for(let r=0;r<t.length;++r)e[t[r]]=r;return e}function J({name:t,prefix:e,bitsPerChar:r,alphabet:n}){let i=x0(n);return yr({prefix:e,name:t,encode(o){return g0(o,n,r)},decode(o){return w0(o,i,r,t)}})}var E0=It({prefix:"9",name:"base10",alphabet:"0123456789"});var qo={};Re(qo,{base16:()=>S0,base16upper:()=>_0});var S0=J({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),_0=J({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ho={};Re(Ho,{base2:()=>A0});var A0=J({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var $o={};Re($o,{base256emoji:()=>B0});var rf=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),I0=rf.reduce((t,e,r)=>(t[r]=e,t),[]),v0=rf.reduce((t,e,r)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return t[n]=r,t},[]);function T0(t){return t.reduce((e,r)=>(e+=I0[r],e),"")}function R0(t){let e=[];for(let r of t){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let i=v0[n];if(i==null)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}var B0=yr({prefix:"\u{1F680}",name:"base256emoji",encode:T0,decode:R0});var Ko={};Re(Ko,{base32:()=>vt,base32hex:()=>P0,base32hexpad:()=>O0,base32hexpadupper:()=>U0,base32hexupper:()=>N0,base32pad:()=>D0,base32padupper:()=>L0,base32upper:()=>C0,base32z:()=>k0});var vt=J({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),C0=J({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),D0=J({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),L0=J({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),P0=J({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),N0=J({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),O0=J({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),U0=J({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),k0=J({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Wo={};Re(Wo,{base36:()=>qt,base36upper:()=>M0});var qt=It({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),M0=It({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var jo={};Re(jo,{base58btc:()=>ee,base58flickr:()=>F0});var ee=It({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),F0=It({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Go={};Re(Go,{base64:()=>q0,base64pad:()=>Vo,base64url:()=>zo,base64urlpad:()=>H0});var q0=J({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Vo=J({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),zo=J({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),H0=J({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Yo={};Re(Yo,{base8:()=>$0});var $0=J({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Zo={};Re(Zo,{identity:()=>K0});var K0=yr({prefix:"\0",name:"identity",encode:t=>Qu(t),decode:t=>Xu(t)});var $S=new TextEncoder,KS=new TextDecoder;var Qo={};Re(Qo,{identity:()=>Fe});var V0=sf,nf=128,z0=127,G0=~z0,Y0=Math.pow(2,31);function sf(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Y0;)e[r++]=t&255|nf,t/=128;for(;t&G0;)e[r++]=t&255|nf,t>>>=7;return e[r]=t|0,sf.bytes=r-n+1,e}var Z0=Xo,X0=128,of=127;function Xo(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw Xo.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&of)<<i:(s&of)*Math.pow(2,i),i+=7}while(s>=X0);return Xo.bytes=o-n,r}var Q0=Math.pow(2,7),J0=Math.pow(2,14),ey=Math.pow(2,21),ty=Math.pow(2,28),ry=Math.pow(2,35),ny=Math.pow(2,42),iy=Math.pow(2,49),oy=Math.pow(2,56),sy=Math.pow(2,63),ay=function(t){return t<Q0?1:t<J0?2:t<ey?3:t<ty?4:t<ry?5:t<ny?6:t<iy?7:t<oy?8:t<sy?9:10},uy={encode:V0,decode:Z0,encodingLength:ay},fy=uy,nn=fy;function on(t,e=0){return[nn.decode(t,e),nn.decode.bytes]}function br(t,e,r=0){return nn.encode(t,e,r),e}function mr(t){return nn.encodingLength(t)}function Ht(t,e){let r=e.byteLength,n=mr(t),i=n+mr(r),o=new Uint8Array(i+r);return br(t,o,0),br(r,o,n),o.set(e,i),new wr(t,r,e,o)}function sn(t){let e=ut(t),[r,n]=on(e),[i,o]=on(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new wr(r,i,s,e)}function af(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Zu(t.bytes,r.bytes)}}var wr=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var uf=0,cy="identity",ff=ut;function ly(t){return Ht(uf,ff(t))}var Fe={code:uf,name:cy,encode:ff,digest:ly};var es={};Re(es,{sha256:()=>un,sha512:()=>dy});function an({name:t,code:e,encode:r}){return new Jo(t,e,r)}var Jo=class{name;code;encode;constructor(e,r,n){this.name=e,this.code=r,this.encode=n}digest(e){if(e instanceof Uint8Array){let r=this.encode(e);return r instanceof Uint8Array?Ht(this.code,r):r.then(n=>Ht(this.code,n))}else throw Error("Unknown type, must be binary type")}};function lf(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var un=an({name:"sha2-256",code:18,encode:lf("SHA-256")}),dy=an({name:"sha2-512",code:19,encode:lf("SHA-512")});function df(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return py(r,ts(t),e??ee.encoder);default:return yy(r,ts(t),e??vt.encoder)}}var hf=new WeakMap;function ts(t){let e=hf.get(t);if(e==null){let r=new Map;return hf.set(t,r),r}return e}var se=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!==fn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==by)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=Ht(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&&af(e.multihash,n.multihash)}toString(e){return df(this,e)}toJSON(){return{"/":df(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??pf(n,i,o.bytes))}else if(r[my]===!0){let{version:n,multihash:i,code:o}=r,s=sn(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!==fn)throw new Error(`Version 0 CID must use dag-pb (code: ${fn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=pf(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,fn,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=ut(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 wr(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[l,y]=on(e.subarray(r));return r+=y,l},i=n(),o=fn;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(),u=n(),c=r+u,f=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=hy(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 ts(o).set(n,e),o}};function hy(t,e){switch(t[0]){case"Q":{let r=e??ee;return[ee.prefix,r.decode(`${ee.prefix}${t}`)]}case ee.prefix:{let r=e??ee;return[ee.prefix,r.decode(t)]}case vt.prefix:{let r=e??vt;return[vt.prefix,r.decode(t)]}case qt.prefix:{let r=e??qt;return[qt.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function py(t,e,r){let{prefix:n}=r;if(n!==ee.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 yy(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 fn=112,by=18;function pf(t,e,r){let n=mr(t),i=n+mr(e),o=new Uint8Array(i+r.byteLength);return br(t,o,0),br(e,o,n),o.set(r,i),o}var my=Symbol.for("@ipld/js-cid/CID");var cn={...Zo,...Ho,...Yo,...Fo,...qo,...Ko,...Wo,...jo,...Go,...$o},l_={...es,...Qo};function ft(t=0){return new Uint8Array(t)}function Be(t=0){return new Uint8Array(t)}function bf(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var yf=bf("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),rs=bf("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Be(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),wy={utf8:yf,"utf-8":yf,hex:cn.base16,latin1:rs,ascii:rs,binary:rs,...cn},ii=wy;function $(t,e="utf8"){let r=ii[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}function N(t){if(t!==void 0&&t!==N.REQUEST&&t!==N.RESPONSE)throw new Error("type must be REQUEST or RESPONSE");t===void 0||this.initialize(t),this.maxHeaderSize=N.maxHeaderSize}N.prototype.initialize=function(t,e){if(t!==N.REQUEST&&t!==N.RESPONSE)throw new Error("type must be REQUEST or RESPONSE");this.type=t,this.state=t+"_LINE",this.info={headers:[],upgrade:!1},this.trailers=[],this.line="",this.isChunked=!1,this.connection="",this.headerSize=0,this.body_bytes=null,this.isUserCall=!1,this.hadError=!1};N.encoding="ascii";N.maxHeaderSize=80*1024;N.REQUEST="REQUEST";N.RESPONSE="RESPONSE";var mf=N.kOnHeaders=1,ns=N.kOnHeadersComplete=2,oi=N.kOnBody=3,is=N.kOnMessageComplete=4;N.prototype[mf]=N.prototype[ns]=N.prototype[oi]=N.prototype[is]=function(){};var wf=!0;Object.defineProperty(N,"kOnExecute",{get:function(){return wf=!1,99}});var gf=N.methods=["DELETE","GET","HEAD","POST","PUT","CONNECT","OPTIONS","TRACE","COPY","LOCK","MKCOL","MOVE","PROPFIND","PROPPATCH","SEARCH","UNLOCK","BIND","REBIND","UNBIND","ACL","REPORT","MKACTIVITY","CHECKOUT","MERGE","M-SEARCH","NOTIFY","SUBSCRIBE","UNSUBSCRIBE","PATCH","PURGE","MKCALENDAR","LINK","UNLINK","SOURCE"],xf=gf.indexOf("CONNECT");N.prototype.reinitialize=N;N.prototype.close=N.prototype.pause=N.prototype.resume=N.prototype.remove=N.prototype.free=function(){};N.prototype._compatMode0_11=!1;N.prototype.getAsyncId=function(){return 0};var gy={REQUEST_LINE:!0,RESPONSE_LINE:!0,HEADER:!0};N.prototype.execute=function(t,e,r){if(!(this instanceof N))throw new TypeError("not a HTTPParser");e=e||0,r=typeof r=="number"?r:t.length,this.chunk=t,this.offset=e;var n=this.end=e+r;try{for(;this.offset<n&&!this[this.state](););}catch(i){if(this.isUserCall)throw i;return this.hadError=!0,i}return this.chunk=null,r=this.offset-e,gy[this.state]&&(this.headerSize+=r,this.headerSize>(this.maxHeaderSize||N.maxHeaderSize))?new Error("max header size exceeded"):r};var xy={REQUEST_LINE:!0,RESPONSE_LINE:!0,BODY_RAW:!0};N.prototype.finish=function(){if(!this.hadError){if(!xy[this.state])return new Error("invalid state for EOF");this.state==="BODY_RAW"&&this.userCall()(this[is]())}};N.prototype.consume=N.prototype.unconsume=N.prototype.getCurrentBuffer=function(){};N.prototype.userCall=function(){this.isUserCall=!0;var t=this;return function(e){return t.isUserCall=!1,e}};N.prototype.nextRequest=function(){this.userCall()(this[is]()),this.reinitialize(this.type)};N.prototype.consumeLine=function(){for(var t=this.end,e=this.chunk,r=this.offset;r<t;r++)if(e[r]===10){var n=this.line+$(e.subarray(this.offset,r),N.encoding);return n.charAt(n.length-1)==="\r"&&(n=n.substr(0,n.length-1)),this.line="",this.offset=r+1,n}this.line+=$(e.subarray(this.offset,this.end),N.encoding),this.offset=this.end};var Ey=/^([^: \t]+):[ \t]*((?:.*[^ \t])|)/,Sy=/^[ \t]+(.*[^ \t])/;N.prototype.parseHeader=function(t,e){if(t.indexOf("\r")!==-1)throw si("HPE_LF_EXPECTED");var r=Ey.exec(t),n=r&&r[1];if(n)e.push(n),e.push(r[2]);else{var i=Sy.exec(t);i&&e.length&&(e[e.length-1]&&(e[e.length-1]+=" "),e[e.length-1]+=i[1])}};var _y=/^([A-Z-]+) ([^ ]+) HTTP\/(\d)\.(\d)$/;N.prototype.REQUEST_LINE=function(){var t=this.consumeLine();if(t){var e=_y.exec(t);if(e===null)throw si("HPE_INVALID_CONSTANT");if(this.info.method=this._compatMode0_11?e[1]:gf.indexOf(e[1]),this.info.method===-1)throw new Error("invalid request method");this.info.url=e[2],this.info.versionMajor=+e[3],this.info.versionMinor=+e[4],this.body_bytes=0,this.state="HEADER"}};var Ay=/^HTTP\/(\d)\.(\d) (\d{3}) ?(.*)$/;N.prototype.RESPONSE_LINE=function(){var t=this.consumeLine();if(t){var e=Ay.exec(t);if(e===null)throw si("HPE_INVALID_CONSTANT");this.info.versionMajor=+e[1],this.info.versionMinor=+e[2];var r=this.info.statusCode=+e[3];this.info.statusMessage=e[4],((r/100|0)===1||r===204||r===304)&&(this.body_bytes=0),this.state="HEADER"}};N.prototype.shouldKeepAlive=function(){if(this.info.versionMajor>0&&this.info.versionMinor>0){if(this.connection.indexOf("close")!==-1)return!1}else if(this.connection.indexOf("keep-alive")===-1)return!1;return!!(this.body_bytes!==null||this.isChunked)};N.prototype.HEADER=function(){var t=this.consumeLine();if(t!==void 0){var e=this.info;if(t)this.parseHeader(t,e.headers);else{for(var r=e.headers,n=!1,i,o=!1,s=0;s<r.length;s+=2)switch(r[s].toLowerCase()){case"transfer-encoding":this.isChunked=r[s+1].toLowerCase()==="chunked";break;case"content-length":if(i=+r[s+1],n){if(i!==this.body_bytes)throw si("HPE_UNEXPECTED_CONTENT_LENGTH")}else n=!0,this.body_bytes=i;break;case"connection":this.connection+=r[s+1].toLowerCase();break;case"upgrade":o=!0;break}this.isChunked&&n&&(n=!1,this.body_bytes=null),o&&this.connection.indexOf("upgrade")!=-1?e.upgrade=this.type===N.REQUEST||e.statusCode===101:e.upgrade=e.method===xf,this.isChunked&&e.upgrade&&(this.isChunked=!1),e.shouldKeepAlive=this.shouldKeepAlive();var a;if(wf?a=this.userCall()(this[ns](e)):a=this.userCall()(this[ns](e.versionMajor,e.versionMinor,e.headers,e.method,e.url,e.statusCode,e.statusMessage,e.upgrade,e.shouldKeepAlive)),a===2)return this.nextRequest(),!0;if(this.isChunked&&!a)this.state="BODY_CHUNKHEAD";else{if(a||this.body_bytes===0)return this.nextRequest(),e.upgrade;this.body_bytes===null?this.state="BODY_RAW":this.state="BODY_SIZED"}}}};N.prototype.BODY_CHUNKHEAD=function(){var t=this.consumeLine();t!==void 0&&(this.body_bytes=parseInt(t,16),this.body_bytes?this.state="BODY_CHUNK":this.state="BODY_CHUNKTRAILERS")};N.prototype.BODY_CHUNK=function(){var t=Math.min(this.end-this.offset,this.body_bytes);this.userCall()(this[oi](this.chunk.slice(this.offset,this.offset+t),0,t)),this.offset+=t,this.body_bytes-=t,this.body_bytes||(this.state="BODY_CHUNKEMPTYLINE")};N.prototype.BODY_CHUNKEMPTYLINE=function(){var t=this.consumeLine();if(t!==void 0){if(t!=="")throw new Error("Expected empty line");this.state="BODY_CHUNKHEAD"}};N.prototype.BODY_CHUNKTRAILERS=function(){var t=this.consumeLine();t!==void 0&&(t?this.parseHeader(t,this.trailers):(this.trailers.length&&this.userCall()(this[mf](this.trailers,"")),this.nextRequest()))};N.prototype.BODY_RAW=function(){this.userCall()(this[oi](this.chunk.slice(this.offset,this.end),0,this.end-this.offset)),this.offset=this.end};N.prototype.BODY_SIZED=function(){var t=Math.min(this.end-this.offset,this.body_bytes);this.userCall()(this[oi](this.chunk.slice(this.offset,this.offset+t),0,t)),this.offset+=t,this.body_bytes-=t,this.body_bytes||this.nextRequest()};["Headers","HeadersComplete","Body","MessageComplete"].forEach(function(t){var e=N["kOn"+t];Object.defineProperty(N.prototype,"on"+t,{get:function(){return this[e]},set:function(r){return this._compatMode0_11=!0,xf="CONNECT",this[e]=r}})});function si(t){var e=new Error("Parse Error");return e.code=t,e}var ai=Symbol.for("@libp2p/peer-id");function Ef(t){return!!t?.[ai]}var Ce=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},ui=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var fi=class extends Error{static name="InvalidCIDError";constructor(e="Invalid CID"){super(e),this.name="InvalidCIDError"}},ci=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var ln=class extends Error{static name="ProtocolError";constructor(e="Protocol error"){super(e),this.name="ProtocolError"}};var dn=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};function De(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 ct(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Be(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var _f=Symbol.for("@achingbrain/uint8arraylist");function Sf(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function li(t){return!!t?.[_f]}var ce=class t{bufs;length;[_f]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(li(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(li(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=Sf(this.bufs,e);return r.buf[r.index]}set(e,r){let n=Sf(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(li(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return ct(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:ct(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new t;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,u=a+s.byteLength;if(i=u,e>=u)continue;let c=e>=a&&e<u,f=r>a&&r<=u;if(c&&f){if(e===a&&r===u){n.push(s);break}let l=e-a;n.push(s.subarray(l,l+(r-e)));break}if(c){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(f){if(r===u){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!li(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let l=0;l<o;l++)s[l]=-1;for(let l=0;l<i;l++)s[n[l]]=l;let a=s,u=this.byteLength-n.byteLength,c=n.byteLength-1,f;for(let l=r;l<=u;l+=f){f=0;for(let y=c;y>=0;y--){let d=this.get(l+y);if(n[y]!==d){f=Math.max(1,y-a[d]);break}}if(f===0)return l}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Be(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=ft(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=ft(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=ft(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Be(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=ft(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=ft(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=ft(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=ft(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=ft(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof t)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!De(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new t;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};function Y(t,e="utf8"){let r=ii[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var Iy=parseInt("11111",2),os=parseInt("10000000",2),vy=parseInt("01111111",2),Af={0:hn,1:hn,2:Ty,3:Cy,4:Dy,5:By,6:Ry,16:hn,22:hn,48:hn};function ss(t,e={offset:0}){let r=t[e.offset]&Iy;if(e.offset++,Af[r]!=null)return Af[r](t,e);throw new Error("No decoder for tag "+r)}function pn(t,e){let r=0;if((t[e.offset]&os)===os){let n=t[e.offset]&vy,i="0x";e.offset++;for(let o=0;o<n;o++,e.offset++)i+=t[e.offset].toString(16).padStart(2,"0");r=parseInt(i,16)}else r=t[e.offset],e.offset++;return r}function hn(t,e){pn(t,e);let r=[];for(;!(e.offset>=t.byteLength);){let n=ss(t,e);if(n===null)break;r.push(n)}return r}function Ty(t,e){let r=pn(t,e),n=e.offset,i=e.offset+r,o=[];for(let s=n;s<i;s++)s===n&&t[s]===0||o.push(t[s]);return e.offset+=r,Uint8Array.from(o)}function Ry(t,e){let r=pn(t,e),n=e.offset+r,i=t[e.offset];e.offset++;let o=0,s=0;i<40?(o=0,s=i):i<80?(o=1,s=i-40):(o=2,s=i-80);let a=`${o}.${s}`,u=[];for(;e.offset<n;){let c=t[e.offset];if(e.offset++,u.push(c&127),c<128){u.reverse();let f=0;for(let l=0;l<u.length;l++)f+=u[l]<<l*7;a+=`.${f}`,u=[]}}return a}function By(t,e){return e.offset++,null}function Cy(t,e){let r=pn(t,e),n=t[e.offset];e.offset++;let i=t.subarray(e.offset,e.offset+r-1);if(e.offset+=r,n!==0)throw new Error("Unused bits in bit string is unimplemented");return i}function Dy(t,e){let r=pn(t,e),n=t.subarray(e.offset,e.offset+r);return e.offset+=r,n}function Ly(t){let e=t.toString(16);e.length%2===1&&(e="0"+e);let r=new ce;for(let n=0;n<e.length;n+=2)r.append(Uint8Array.from([parseInt(`${e[n]}${e[n+1]}`,16)]));return r}function as(t){if(t.byteLength<128)return Uint8Array.from([t.byteLength]);let e=Ly(t.byteLength);return new ce(Uint8Array.from([e.byteLength|os]),e)}function If(t){let e=new ce,r=128;return(t.subarray()[0]&r)===r&&e.append(Uint8Array.from([0])),e.append(t),new ce(Uint8Array.from([2]),as(e),e)}function vf(t){let e=Uint8Array.from([0]),r=new ce(e,t);return new ce(Uint8Array.from([3]),as(r),r)}function di(t,e=48){let r=new ce;for(let n of t)r.append(n);return new ce(Uint8Array.from([e]),as(r),r)}async function Tf(t,e,r,n){let i=await crypto.subtle.importKey("jwk",t,{name:"ECDSA",namedCurve:t.crv??"P-256"},!1,["verify"]);n?.signal?.throwIfAborted();let o=await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},i,e,r.subarray());return n?.signal?.throwIfAborted(),o}var Py=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),Ny=Uint8Array.from([6,5,43,129,4,0,34]),Oy=Uint8Array.from([6,5,43,129,4,0,35]),Uy={ext:!0,kty:"EC",crv:"P-256"},ky={ext:!0,kty:"EC",crv:"P-384"},My={ext:!0,kty:"EC",crv:"P-521"},us=32,fs=48,cs=66;function Rf(t){let e=ss(t);return Bf(e)}function Bf(t){let e=t[1][1][0],r=1,n,i;if(e.byteLength===us*2+1)return n=$(e.subarray(r,r+us),"base64url"),i=$(e.subarray(r+us),"base64url"),new xr({...Uy,key_ops:["verify"],x:n,y:i});if(e.byteLength===fs*2+1)return n=$(e.subarray(r,r+fs),"base64url"),i=$(e.subarray(r+fs),"base64url"),new xr({...ky,key_ops:["verify"],x:n,y:i});if(e.byteLength===cs*2+1)return n=$(e.subarray(r,r+cs),"base64url"),i=$(e.subarray(r+cs),"base64url"),new xr({...My,key_ops:["verify"],x:n,y:i});throw new Ce(`coordinates were wrong length, got ${e.byteLength}, expected 65, 97 or 133`)}function Cf(t){return di([If(Uint8Array.from([1])),di([Fy(t.crv)],160),di([vf(new ce(Uint8Array.from([4]),Y(t.x??"","base64url"),Y(t.y??"","base64url")))],161)]).subarray()}function Fy(t){if(t==="P-256")return Py;if(t==="P-384")return Ny;if(t==="P-521")return Oy;throw new Ce(`Invalid curve ${t}`)}var xr=class{type="ECDSA";jwk;_raw;constructor(e){this.jwk=e}get raw(){return this._raw==null&&(this._raw=Cf(this.jwk)),this._raw}toMultihash(){return Fe.digest(Er(this))}toCID(){return se.createV1(114,this.toMultihash())}toString(){return ee.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:De(this.raw,e.raw)}async verify(e,r,n){return Tf(this.jwk,r,e,n)}};var $t=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function _r(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function yn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function we(t,...e){if(!_r(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Lf(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");yn(t.outputLen),yn(t.blockLen)}function Ar(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 Pf(t,e){we(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function dt(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function hi(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function qe(t,e){return t<<32-e|t>>>e}var Nf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",qy=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ge(t){if(we(t),Nf)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=qy[t[r]];return e}var lt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Df(t){if(t>=lt._0&&t<=lt._9)return t-lt._0;if(t>=lt.A&&t<=lt.F)return t-(lt.A-10);if(t>=lt.a&&t<=lt.f)return t-(lt.a-10)}function Ir(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(Nf)return Uint8Array.fromHex(t);let e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=Df(t.charCodeAt(o)),a=Df(t.charCodeAt(o+1));if(s===void 0||a===void 0){let u=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+o)}n[i]=s*16+a}return n}function Of(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function bn(t){return typeof t=="string"&&(t=Of(t)),we(t),t}function Le(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];we(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var Sr=class{};function ls(t){let e=n=>t().update(bn(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function mn(t=32){if($t&&typeof $t.getRandomValues=="function")return $t.getRandomValues(new Uint8Array(t));if($t&&typeof $t.randomBytes=="function")return Uint8Array.from($t.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function Hy(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),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}function Uf(t,e,r){return t&e^~t&r}function kf(t,e,r){return t&e^t&r^e&r}var wn=class extends Sr{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=hi(this.buffer)}update(e){Ar(this),e=bn(e),we(e);let{view:r,buffer:n,blockLen:i}=this,o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let u=hi(e);for(;i<=o-s;s+=i)this.process(u,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){Ar(this),Pf(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,dt(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;Hy(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=hi(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let c=u/4,f=this.get();if(c>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<c;l++)a.setUint32(4*l,f[l],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.destroyed=s,e.finished=o,e.length=i,e.pos=a,i%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}},ht=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var pi=BigInt(4294967295),Mf=BigInt(32);function $y(t,e=!1){return e?{h:Number(t&pi),l:Number(t>>Mf&pi)}:{h:Number(t>>Mf&pi)|0,l:Number(t&pi)|0}}function Ff(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:s,l:a}=$y(t[o],e);[n[o],i[o]]=[s,a]}return[n,i]}var ds=(t,e,r)=>t>>>r,hs=(t,e,r)=>t<<32-r|e>>>r,Kt=(t,e,r)=>t>>>r|e<<32-r,Wt=(t,e,r)=>t<<32-r|e>>>r,gn=(t,e,r)=>t<<64-r|e>>>r-32,xn=(t,e,r)=>t>>>r-32|e<<64-r;function Ye(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var qf=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Hf=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,$f=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Kf=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,Wf=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),jf=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var Wy=Uint32Array.from([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]),Tt=new Uint32Array(64),ps=class extends wn{constructor(e=32){super(64,e,8,!1),this.A=ht[0]|0,this.B=ht[1]|0,this.C=ht[2]|0,this.D=ht[3]|0,this.E=ht[4]|0,this.F=ht[5]|0,this.G=ht[6]|0,this.H=ht[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:u}=this;return[e,r,n,i,o,s,a,u]}set(e,r,n,i,o,s,a,u){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=u|0}process(e,r){for(let l=0;l<16;l++,r+=4)Tt[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let y=Tt[l-15],d=Tt[l-2],x=qe(y,7)^qe(y,18)^y>>>3,h=qe(d,17)^qe(d,19)^d>>>10;Tt[l]=h+Tt[l-7]+x+Tt[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:u,G:c,H:f}=this;for(let l=0;l<64;l++){let y=qe(a,6)^qe(a,11)^qe(a,25),d=f+y+Uf(a,u,c)+Wy[l]+Tt[l]|0,h=(qe(n,2)^qe(n,13)^qe(n,22))+kf(n,i,o)|0;f=c,c=u,u=a,a=s+d|0,s=o,o=i,i=n,n=d+h|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,u=u+this.F|0,c=c+this.G|0,f=f+this.H|0,this.set(n,i,o,s,a,u,c,f)}roundClean(){dt(Tt)}destroy(){this.set(0,0,0,0,0,0,0,0),dt(this.buffer)}};var Vf=Ff(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),jy=Vf[0],Vy=Vf[1],Rt=new Uint32Array(80),Bt=new Uint32Array(80),ys=class extends wn{constructor(e=64){super(128,e,16,!1),this.Ah=pe[0]|0,this.Al=pe[1]|0,this.Bh=pe[2]|0,this.Bl=pe[3]|0,this.Ch=pe[4]|0,this.Cl=pe[5]|0,this.Dh=pe[6]|0,this.Dl=pe[7]|0,this.Eh=pe[8]|0,this.El=pe[9]|0,this.Fh=pe[10]|0,this.Fl=pe[11]|0,this.Gh=pe[12]|0,this.Gl=pe[13]|0,this.Hh=pe[14]|0,this.Hl=pe[15]|0}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:c,El:f,Fh:l,Fl:y,Gh:d,Gl:x,Hh:h,Hl:m}=this;return[e,r,n,i,o,s,a,u,c,f,l,y,d,x,h,m]}set(e,r,n,i,o,s,a,u,c,f,l,y,d,x,h,m){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=c|0,this.El=f|0,this.Fh=l|0,this.Fl=y|0,this.Gh=d|0,this.Gl=x|0,this.Hh=h|0,this.Hl=m|0}process(e,r){for(let I=0;I<16;I++,r+=4)Rt[I]=e.getUint32(r),Bt[I]=e.getUint32(r+=4);for(let I=16;I<80;I++){let T=Rt[I-15]|0,w=Bt[I-15]|0,L=Kt(T,w,1)^Kt(T,w,8)^ds(T,w,7),B=Wt(T,w,1)^Wt(T,w,8)^hs(T,w,7),R=Rt[I-2]|0,p=Bt[I-2]|0,S=Kt(R,p,19)^gn(R,p,61)^ds(R,p,6),E=Wt(R,p,19)^xn(R,p,61)^hs(R,p,6),_=$f(B,E,Bt[I-7],Bt[I-16]),A=Kf(_,L,S,Rt[I-7],Rt[I-16]);Rt[I]=A|0,Bt[I]=_|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:c,Dl:f,Eh:l,El:y,Fh:d,Fl:x,Gh:h,Gl:m,Hh:g,Hl:v}=this;for(let I=0;I<80;I++){let T=Kt(l,y,14)^Kt(l,y,18)^gn(l,y,41),w=Wt(l,y,14)^Wt(l,y,18)^xn(l,y,41),L=l&d^~l&h,B=y&x^~y&m,R=Wf(v,w,B,Vy[I],Bt[I]),p=jf(R,g,T,L,jy[I],Rt[I]),S=R|0,E=Kt(n,i,28)^gn(n,i,34)^gn(n,i,39),_=Wt(n,i,28)^xn(n,i,34)^xn(n,i,39),A=n&o^n&a^o&a,D=i&s^i&u^s&u;g=h|0,v=m|0,h=d|0,m=x|0,d=l|0,x=y|0,{h:l,l:y}=Ye(c|0,f|0,p|0,S|0),c=a|0,f=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let C=qf(S,_,D);n=Hf(C,p,E,A),i=C|0}({h:n,l:i}=Ye(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Ye(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=Ye(this.Ch|0,this.Cl|0,a|0,u|0),{h:c,l:f}=Ye(this.Dh|0,this.Dl|0,c|0,f|0),{h:l,l:y}=Ye(this.Eh|0,this.El|0,l|0,y|0),{h:d,l:x}=Ye(this.Fh|0,this.Fl|0,d|0,x|0),{h,l:m}=Ye(this.Gh|0,this.Gl|0,h|0,m|0),{h:g,l:v}=Ye(this.Hh|0,this.Hl|0,g|0,v|0),this.set(n,i,o,s,a,u,c,f,l,y,d,x,h,m,g,v)}roundClean(){dt(Rt,Bt)}destroy(){dt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var zf=ls(()=>new ps);var Gf=ls(()=>new ys);var ws=BigInt(0),ms=BigInt(1);function pt(t,e){if(typeof e!="boolean")throw new Error(t+" boolean expected, got "+e)}function En(t){let e=t.toString(16);return e.length&1?"0"+e:e}function Yf(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?ws:BigInt("0x"+t)}function vr(t){return Yf(Ge(t))}function jt(t){return we(t),Yf(Ge(Uint8Array.from(t).reverse()))}function yi(t,e){return Ir(t.toString(16).padStart(e*2,"0"))}function Tr(t,e){return yi(t,e).reverse()}function V(t,e,r){let n;if(typeof e=="string")try{n=Ir(e)}catch(o){throw new Error(t+" must be hex string or Uint8Array, cause: "+o)}else if(_r(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}var bs=t=>typeof t=="bigint"&&ws<=t;function Zf(t,e,r){return bs(t)&&bs(e)&&bs(r)&&e<=t&&t<r}function Ct(t,e,r,n){if(!Zf(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Xf(t){let e;for(e=0;t>ws;t>>=ms,e+=1);return e}var Vt=t=>(ms<<BigInt(t))-ms;function Qf(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=d=>new Uint8Array(d),i=d=>Uint8Array.of(d),o=n(t),s=n(t),a=0,u=()=>{o.fill(1),s.fill(0),a=0},c=(...d)=>r(s,o,...d),f=(d=n(0))=>{s=c(i(0),d),o=c(),d.length!==0&&(s=c(i(1),d),o=c())},l=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let d=0,x=[];for(;d<e;){o=c();let h=o.slice();x.push(h),d+=o.length}return Le(...x)};return(d,x)=>{u(),f(d);let h;for(;!(h=x(l()));)f();return u(),h}}function Dt(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,o,s){let a=t[i];if(s&&a===void 0)return;let u=typeof a;if(u!==o||a===null)throw new Error(`param "${i}" is invalid: expected ${o}, got ${u}`)}Object.entries(e).forEach(([i,o])=>n(i,o,!1)),Object.entries(r).forEach(([i,o])=>n(i,o,!0))}function Rr(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(i!==void 0)return i;let o=t(r,...n);return e.set(r,o),o}}var Ae=BigInt(0),le=BigInt(1),zt=BigInt(2),zy=BigInt(3),tc=BigInt(4),rc=BigInt(5),nc=BigInt(8);function Z(t,e){let r=t%e;return r>=Ae?r:e+r}function z(t,e,r){let n=t;for(;e-- >Ae;)n*=n,n%=r;return n}function Jf(t,e){if(t===Ae)throw new Error("invert: expected non-zero number");if(e<=Ae)throw new Error("invert: expected positive modulus, got "+e);let r=Z(t,e),n=e,i=Ae,o=le,s=le,a=Ae;for(;r!==Ae;){let c=n/r,f=n%r,l=i-s*c,y=o-a*c;n=r,r=f,i=s,o=a,s=l,a=y}if(n!==le)throw new Error("invert: does not exist");return Z(i,e)}function ic(t,e){let r=(t.ORDER+le)/tc,n=t.pow(e,r);if(!t.eql(t.sqr(n),e))throw new Error("Cannot find square root");return n}function Gy(t,e){let r=(t.ORDER-rc)/nc,n=t.mul(e,zt),i=t.pow(n,r),o=t.mul(e,i),s=t.mul(t.mul(o,zt),i),a=t.mul(o,t.sub(s,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}function Yy(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let e=t-le,r=0;for(;e%zt===Ae;)e/=zt,r++;let n=zt,i=He(t);for(;ec(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return ic;let o=i.pow(n,e),s=(e+le)/zt;return function(u,c){if(u.is0(c))return c;if(ec(u,c)!==1)throw new Error("Cannot find square root");let f=r,l=u.mul(u.ONE,o),y=u.pow(c,e),d=u.pow(c,s);for(;!u.eql(y,u.ONE);){if(u.is0(y))return u.ZERO;let x=1,h=u.sqr(y);for(;!u.eql(h,u.ONE);)if(x++,h=u.sqr(h),x===f)throw new Error("Cannot find square root");let m=le<<BigInt(f-x-1),g=u.pow(l,m);f=x,l=u.sqr(g),y=u.mul(y,l),d=u.mul(d,g)}return d}}function Zy(t){return t%tc===zy?ic:t%nc===rc?Gy:Yy(t)}var oc=(t,e)=>(Z(t,e)&le)===le,Xy=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function gs(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=Xy.reduce((n,i)=>(n[i]="function",n),e);return Dt(t,r),t}function Qy(t,e,r){if(r<Ae)throw new Error("invalid exponent, negatives unsupported");if(r===Ae)return t.ONE;if(r===le)return e;let n=t.ONE,i=e;for(;r>Ae;)r&le&&(n=t.mul(n,i)),i=t.sqr(i),r>>=le;return n}function Sn(t,e,r=!1){let n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((s,a,u)=>t.is0(a)?s:(n[u]=s,t.mul(s,a)),t.ONE),o=t.inv(i);return e.reduceRight((s,a,u)=>t.is0(a)?s:(n[u]=t.mul(s,n[u]),t.mul(s,a)),o),n}function ec(t,e){let r=(t.ORDER-le)/zt,n=t.pow(e,r),i=t.eql(n,t.ONE),o=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function sc(t,e){e!==void 0&&yn(e);let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function He(t,e,r=!1,n={}){if(t<=Ae)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,o;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");let f=e;f.BITS&&(i=f.BITS),f.sqrt&&(o=f.sqrt),typeof f.isLE=="boolean"&&(r=f.isLE)}else typeof e=="number"&&(i=e),n.sqrt&&(o=n.sqrt);let{nBitLength:s,nByteLength:a}=sc(t,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let u,c=Object.freeze({ORDER:t,isLE:r,BITS:s,BYTES:a,MASK:Vt(s),ZERO:Ae,ONE:le,create:f=>Z(f,t),isValid:f=>{if(typeof f!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof f);return Ae<=f&&f<t},is0:f=>f===Ae,isValidNot0:f=>!c.is0(f)&&c.isValid(f),isOdd:f=>(f&le)===le,neg:f=>Z(-f,t),eql:(f,l)=>f===l,sqr:f=>Z(f*f,t),add:(f,l)=>Z(f+l,t),sub:(f,l)=>Z(f-l,t),mul:(f,l)=>Z(f*l,t),pow:(f,l)=>Qy(c,f,l),div:(f,l)=>Z(f*Jf(l,t),t),sqrN:f=>f*f,addN:(f,l)=>f+l,subN:(f,l)=>f-l,mulN:(f,l)=>f*l,inv:f=>Jf(f,t),sqrt:o||(f=>(u||(u=Zy(t)),u(c,f))),toBytes:f=>r?Tr(f,a):yi(f,a),fromBytes:f=>{if(f.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+f.length);return r?jt(f):vr(f)},invertBatch:f=>Sn(c,f),cmov:(f,l,y)=>y?l:f});return Object.freeze(c)}function ac(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function xs(t){let e=ac(t);return e+Math.ceil(e/2)}function uc(t,e,r=!1){let n=t.length,i=ac(e),o=xs(e);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?jt(t):vr(t),a=Z(s,e-le)+le;return r?Tr(a,i):yi(a,i)}var Cr=BigInt(0),Gt=BigInt(1);function Br(t,e){let r=e.negate();return t?r:e}function bi(t,e,r){let n=e==="pz"?s=>s.pz:s=>s.ez,i=Sn(t.Fp,r.map(n));return r.map((s,a)=>s.toAffine(i[a])).map(t.fromAffine)}function dc(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Es(t,e){dc(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,o=Vt(t),s=BigInt(t);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function fc(t,e,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r,a=Number(t&i),u=t>>s;a>n&&(a-=o,u+=Gt);let c=e*n,f=c+Math.abs(a)-1,l=a===0,y=a<0,d=e%2!==0;return{nextN:u,offset:f,isZero:l,isNeg:y,isNegF:d,offsetF:c}}function Jy(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function eb(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}var Ss=new WeakMap,hc=new WeakMap;function _s(t){return hc.get(t)||1}function cc(t){if(t!==Cr)throw new Error("invalid wNAF")}function mi(t,e){return{constTimeNegate:Br,hasPrecomputes(r){return _s(r)!==1},unsafeLadder(r,n,i=t.ZERO){let o=r;for(;n>Cr;)n&Gt&&(i=i.add(o)),o=o.double(),n>>=Gt;return i},precomputeWindow(r,n){let{windows:i,windowSize:o}=Es(n,e),s=[],a=r,u=a;for(let c=0;c<i;c++){u=a,s.push(u);for(let f=1;f<o;f++)u=u.add(a),s.push(u);a=u.double()}return s},wNAF(r,n,i){let o=t.ZERO,s=t.BASE,a=Es(r,e);for(let u=0;u<a.windows;u++){let{nextN:c,offset:f,isZero:l,isNeg:y,isNegF:d,offsetF:x}=fc(i,u,a);i=c,l?s=s.add(Br(d,n[x])):o=o.add(Br(y,n[f]))}return cc(i),{p:o,f:s}},wNAFUnsafe(r,n,i,o=t.ZERO){let s=Es(r,e);for(let a=0;a<s.windows&&i!==Cr;a++){let{nextN:u,offset:c,isZero:f,isNeg:l}=fc(i,a,s);if(i=u,!f){let y=n[c];o=o.add(l?y.negate():y)}}return cc(i),o},getPrecomputes(r,n,i){let o=Ss.get(n);return o||(o=this.precomputeWindow(n,r),r!==1&&(typeof i=="function"&&(o=i(o)),Ss.set(n,o))),o},wNAFCached(r,n,i){let o=_s(r);return this.wNAF(o,this.getPrecomputes(o,r,i),n)},wNAFCachedUnsafe(r,n,i,o){let s=_s(r);return s===1?this.unsafeLadder(r,n,o):this.wNAFUnsafe(s,this.getPrecomputes(s,r,i),n,o)},setWindowSize(r,n){dc(n,e),hc.set(r,n),Ss.delete(r)}}}function pc(t,e,r,n){let i=e,o=t.ZERO,s=t.ZERO;for(;r>Cr||n>Cr;)r&Gt&&(o=o.add(i)),n&Gt&&(s=s.add(i)),i=i.double(),r>>=Gt,n>>=Gt;return{p1:o,p2:s}}function wi(t,e,r,n){Jy(r,t),eb(n,e);let i=r.length,o=n.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");let s=t.ZERO,a=Xf(BigInt(i)),u=1;a>12?u=a-3:a>4?u=a-2:a>0&&(u=2);let c=Vt(u),f=new Array(Number(c)+1).fill(s),l=Math.floor((e.BITS-1)/u)*u,y=s;for(let d=l;d>=0;d-=u){f.fill(s);for(let h=0;h<o;h++){let m=n[h],g=Number(m>>BigInt(d)&c);f[g]=f[g].add(r[h])}let x=s;for(let h=f.length-1,m=s;h>0;h--)m=m.add(f[h]),x=x.add(m);if(y=y.add(x),d!==0)for(let h=0;h<u;h++)y=y.double()}return y}function lc(t,e){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return gs(e),e}else return He(t)}function gi(t,e,r={}){if(!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(let a of["p","n","h"]){let u=e[a];if(!(typeof u=="bigint"&&u>Cr))throw new Error(`CURVE.${a} must be positive bigint`)}let n=lc(e.p,r.Fp),i=lc(e.n,r.Fn),s=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let a of s)if(!n.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:i}}var Ze=BigInt(0),Ie=BigInt(1),As=BigInt(2),tb=BigInt(8),rb={zip215:!0};function nb(t,e,r,n){let i=t.sqr(r),o=t.sqr(n),s=t.add(t.mul(e.a,i),o),a=t.add(t.ONE,t.mul(e.d,t.mul(i,o)));return t.eql(s,a)}function ib(t,e={}){let{Fp:r,Fn:n}=gi("edwards",t,e),{h:i,n:o}=t;Dt(e,{},{uvRatio:"function"});let s=As<<BigInt(n.BYTES*8)-Ie,a=h=>r.create(h),u=e.uvRatio||((h,m)=>{try{return{isValid:!0,value:r.sqrt(r.div(h,m))}}catch{return{isValid:!1,value:Ze}}});if(!nb(r,t,t.Gx,t.Gy))throw new Error("bad curve params: generator point");function c(h,m,g=!1){let v=g?Ie:Ze;return Ct("coordinate "+h,m,v,s),m}function f(h){if(!(h instanceof d))throw new Error("ExtendedPoint expected")}let l=Rr((h,m)=>{let{ex:g,ey:v,ez:I}=h,T=h.is0();m==null&&(m=T?tb:r.inv(I));let w=a(g*m),L=a(v*m),B=a(I*m);if(T)return{x:Ze,y:Ie};if(B!==Ie)throw new Error("invZ was invalid");return{x:w,y:L}}),y=Rr(h=>{let{a:m,d:g}=t;if(h.is0())throw new Error("bad point: ZERO");let{ex:v,ey:I,ez:T,et:w}=h,L=a(v*v),B=a(I*I),R=a(T*T),p=a(R*R),S=a(L*m),E=a(R*a(S+B)),_=a(p+a(g*a(L*B)));if(E!==_)throw new Error("bad point: equation left != right (1)");let A=a(v*I),D=a(T*w);if(A!==D)throw new Error("bad point: equation left != right (2)");return!0});class d{constructor(m,g,v,I){this.ex=c("x",m),this.ey=c("y",g),this.ez=c("z",v,!0),this.et=c("t",I),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(m){if(m instanceof d)throw new Error("extended point not allowed");let{x:g,y:v}=m||{};return c("x",g),c("y",v),new d(g,v,Ie,a(g*v))}static normalizeZ(m){return bi(d,"ez",m)}static msm(m,g){return wi(d,n,m,g)}_setWindowSize(m){this.precompute(m)}precompute(m=8,g=!0){return x.setWindowSize(this,m),g||this.multiply(As),this}assertValidity(){y(this)}equals(m){f(m);let{ex:g,ey:v,ez:I}=this,{ex:T,ey:w,ez:L}=m,B=a(g*L),R=a(T*I),p=a(v*L),S=a(w*I);return B===R&&p===S}is0(){return this.equals(d.ZERO)}negate(){return new d(a(-this.ex),this.ey,this.ez,a(-this.et))}double(){let{a:m}=t,{ex:g,ey:v,ez:I}=this,T=a(g*g),w=a(v*v),L=a(As*a(I*I)),B=a(m*T),R=g+v,p=a(a(R*R)-T-w),S=B+w,E=S-L,_=B-w,A=a(p*E),D=a(S*_),C=a(p*_),P=a(E*S);return new d(A,D,P,C)}add(m){f(m);let{a:g,d:v}=t,{ex:I,ey:T,ez:w,et:L}=this,{ex:B,ey:R,ez:p,et:S}=m,E=a(I*B),_=a(T*R),A=a(L*v*S),D=a(w*p),C=a((I+T)*(B+R)-E-_),P=D-A,U=D+A,O=a(_-g*E),te=a(C*P),H=a(U*O),k=a(C*O),ie=a(P*U);return new d(te,H,ie,k)}subtract(m){return this.add(m.negate())}multiply(m){let g=m;Ct("scalar",g,Ie,o);let{p:v,f:I}=x.wNAFCached(this,g,d.normalizeZ);return d.normalizeZ([v,I])[0]}multiplyUnsafe(m,g=d.ZERO){let v=m;return Ct("scalar",v,Ze,o),v===Ze?d.ZERO:this.is0()||v===Ie?this:x.wNAFCachedUnsafe(this,v,d.normalizeZ,g)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}isTorsionFree(){return x.wNAFCachedUnsafe(this,o).is0()}toAffine(m){return l(this,m)}clearCofactor(){return i===Ie?this:this.multiplyUnsafe(i)}static fromBytes(m,g=!1){return we(m),this.fromHex(m,g)}static fromHex(m,g=!1){let{d:v,a:I}=t,T=r.BYTES;m=V("pointHex",m,T),pt("zip215",g);let w=m.slice(),L=m[T-1];w[T-1]=L&-129;let B=jt(w),R=g?s:r.ORDER;Ct("pointHex.y",B,Ze,R);let p=a(B*B),S=a(p-Ie),E=a(v*p-I),{isValid:_,value:A}=u(S,E);if(!_)throw new Error("Point.fromHex: invalid y coordinate");let D=(A&Ie)===Ie,C=(L&128)!==0;if(!g&&A===Ze&&C)throw new Error("Point.fromHex: x=0 and x_0=1");return C!==D&&(A=a(-A)),d.fromAffine({x:A,y:B})}static fromPrivateScalar(m){return d.BASE.multiply(m)}toBytes(){let{x:m,y:g}=this.toAffine(),v=Tr(g,r.BYTES);return v[v.length-1]|=m&Ie?128:0,v}toRawBytes(){return this.toBytes()}toHex(){return Ge(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}d.BASE=new d(t.Gx,t.Gy,Ie,a(t.Gx*t.Gy)),d.ZERO=new d(Ze,Ie,Ie,Ze),d.Fp=r,d.Fn=n;let x=mi(d,n.BYTES*8);return d}function ob(t,e){Dt(e,{hash:"function"},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:r,hash:n}=e,{BASE:i,Fp:o,Fn:s}=t,a=s.ORDER,u=e.randomBytes||mn,c=e.adjustScalarBytes||(w=>w),f=e.domain||((w,L,B)=>{if(pt("phflag",B),L.length||B)throw new Error("Contexts/pre-hash are not supported");return w});function l(w){return s.create(w)}function y(w){return l(jt(w))}function d(w){let L=o.BYTES;w=V("private key",w,L);let B=V("hashed private key",n(w),2*L),R=c(B.slice(0,L)),p=B.slice(L,2*L),S=y(R);return{head:R,prefix:p,scalar:S}}function x(w){let{head:L,prefix:B,scalar:R}=d(w),p=i.multiply(R),S=p.toBytes();return{head:L,prefix:B,scalar:R,point:p,pointBytes:S}}function h(w){return x(w).pointBytes}function m(w=Uint8Array.of(),...L){let B=Le(...L);return y(n(f(B,V("context",w),!!r)))}function g(w,L,B={}){w=V("message",w),r&&(w=r(w));let{prefix:R,scalar:p,pointBytes:S}=x(L),E=m(B.context,R,w),_=i.multiply(E).toBytes(),A=m(B.context,_,S,w),D=l(E+A*p);Ct("signature.s",D,Ze,a);let C=o.BYTES,P=Le(_,Tr(D,C));return V("result",P,C*2)}let v=rb;function I(w,L,B,R=v){let{context:p,zip215:S}=R,E=o.BYTES;w=V("signature",w,2*E),L=V("message",L),B=V("publicKey",B,E),S!==void 0&&pt("zip215",S),r&&(L=r(L));let _=jt(w.slice(E,2*E)),A,D,C;try{A=t.fromHex(B,S),D=t.fromHex(w.slice(0,E),S),C=i.multiplyUnsafe(_)}catch{return!1}if(!S&&A.isSmallOrder())return!1;let P=m(p,D.toBytes(),A.toBytes(),L);return D.add(A.multiplyUnsafe(P)).subtract(C).clearCofactor().is0()}return i.precompute(8),{getPublicKey:h,sign:g,verify:I,utils:{getExtendedPublicKey:x,randomPrivateKey:()=>u(o.BYTES),precompute(w=8,L=t.BASE){return L.precompute(w,!1)}},Point:t}}function sb(t){let e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=He(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},o={hash:t.hash,randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,eddsaOpts:o}}function ab(t,e){return Object.assign({},e,{ExtendedPoint:e.Point,CURVE:t})}function yc(t){let{CURVE:e,curveOpts:r,eddsaOpts:n}=sb(t),i=ib(e,r),o=ob(i,n);return ab(t,o)}var DA=BigInt(0),ub=BigInt(1),bc=BigInt(2),LA=BigInt(3),fb=BigInt(5),cb=BigInt(8),xi={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:cb,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function lb(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=xi.p,a=t*t%o*t%o,u=z(a,bc,o)*a%o,c=z(u,ub,o)*t%o,f=z(c,fb,o)*c%o,l=z(f,e,o)*f%o,y=z(l,r,o)*l%o,d=z(y,n,o)*y%o,x=z(d,i,o)*d%o,h=z(x,i,o)*d%o,m=z(h,e,o)*f%o;return{pow_p_5_8:z(m,bc,o)*t%o,b2:a}}function db(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var mc=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function hb(t,e){let r=xi.p,n=Z(e*e*e,r),i=Z(n*n*e,r),o=lb(t*i).pow_p_5_8,s=Z(t*n*o,r),a=Z(e*s*s,r),u=s,c=Z(s*mc,r),f=a===t,l=a===Z(-t,r),y=a===Z(-t*mc,r);return f&&(s=u),(l||y)&&(s=c),oc(s,r)&&(s=Z(-s,r)),{isValid:f||l,value:s}}var pb=He(xi.p,void 0,!0),yb={...xi,Fp:pb,hash:Gf,adjustScalarBytes:db,uvRatio:hb},wc=yc(yb);var _n=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}},Ei=class extends Error{constructor(e="Missing Web Crypto API"){super(e),this.name="WebCryptoMissingError"}};var gc={get(t=globalThis){let e=t.crypto;if(e?.subtle==null)throw new Ei("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api");return e}};var Si=gc;var _i=32;var Is,bb=(async()=>{try{return await Si.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})();async function mb(t,e,r){if(t.buffer instanceof ArrayBuffer){let n=await Si.get().subtle.importKey("raw",t.buffer,{name:"Ed25519"},!1,["verify"]);return await Si.get().subtle.verify({name:"Ed25519"},n,e,r instanceof Uint8Array?r:r.subarray())}throw new TypeError("WebCrypto does not support SharedArrayBuffer for Ed25519 keys")}function wb(t,e,r){return wc.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}async function xc(t,e,r){return Is==null&&(Is=await bb),Is?mb(t,e,r):wb(t,e,r)}function Ai(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}var Ii=class{type="Ed25519";raw;constructor(e){this.raw=vs(e,_i)}toMultihash(){return Fe.digest(Er(this))}toCID(){return se.createV1(114,this.toMultihash())}toString(){return ee.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:De(this.raw,e.raw)}verify(e,r,n){n?.signal?.throwIfAborted();let i=xc(this.raw,r,e);return Ai(i)?i.then(o=>(n?.signal?.throwIfAborted(),o)):i}};function Sc(t){return t=vs(t,_i),new Ii(t)}function vs(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new Ce(`Key must be a Uint8Array of length ${e}, got ${t.length}`);return t}var xb=Math.pow(2,7),Eb=Math.pow(2,14),Sb=Math.pow(2,21),Ts=Math.pow(2,28),Rs=Math.pow(2,35),Bs=Math.pow(2,42),Cs=Math.pow(2,49),X=128,ge=127;function Xe(t){if(t<xb)return 1;if(t<Eb)return 2;if(t<Sb)return 3;if(t<Ts)return 4;if(t<Rs)return 5;if(t<Bs)return 6;if(t<Cs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function An(t,e,r=0){switch(Xe(t)){case 8:e[r++]=t&255|X,t/=128;case 7:e[r++]=t&255|X,t/=128;case 6:e[r++]=t&255|X,t/=128;case 5:e[r++]=t&255|X,t/=128;case 4:e[r++]=t&255|X,t>>>=7;case 3:e[r++]=t&255|X,t>>>=7;case 2:e[r++]=t&255|X,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function Ds(t,e){let r=t[e],n=0;if(n+=r&ge,r<X||(r=t[e+1],n+=(r&ge)<<7,r<X)||(r=t[e+2],n+=(r&ge)<<14,r<X)||(r=t[e+3],n+=(r&ge)<<21,r<X)||(r=t[e+4],n+=(r&ge)*Ts,r<X)||(r=t[e+5],n+=(r&ge)*Rs,r<X)||(r=t[e+6],n+=(r&ge)*Bs,r<X)||(r=t[e+7],n+=(r&ge)*Cs,r<X))return n;throw new RangeError("Could not decode varint")}function _b(t,e){let r=t.get(e),n=0;if(n+=r&ge,r<X||(r=t.get(e+1),n+=(r&ge)<<7,r<X)||(r=t.get(e+2),n+=(r&ge)<<14,r<X)||(r=t.get(e+3),n+=(r&ge)<<21,r<X)||(r=t.get(e+4),n+=(r&ge)*Ts,r<X)||(r=t.get(e+5),n+=(r&ge)*Rs,r<X)||(r=t.get(e+6),n+=(r&ge)*Bs,r<X)||(r=t.get(e+7),n+=(r&ge)*Cs,r<X))return n;throw new RangeError("Could not decode varint")}function Ls(t,e=0){return t instanceof Uint8Array?Ds(t,e):_b(t,e)}var Ps=new Float32Array([-0]),Lt=new Uint8Array(Ps.buffer);function _c(t,e,r){Ps[0]=t,e[r]=Lt[0],e[r+1]=Lt[1],e[r+2]=Lt[2],e[r+3]=Lt[3]}function Ac(t,e){return Lt[0]=t[e],Lt[1]=t[e+1],Lt[2]=t[e+2],Lt[3]=t[e+3],Ps[0]}var Ns=new Float64Array([-0]),xe=new Uint8Array(Ns.buffer);function Ic(t,e,r){Ns[0]=t,e[r]=xe[0],e[r+1]=xe[1],e[r+2]=xe[2],e[r+3]=xe[3],e[r+4]=xe[4],e[r+5]=xe[5],e[r+6]=xe[6],e[r+7]=xe[7]}function vc(t,e){return xe[0]=t[e],xe[1]=t[e+1],xe[2]=t[e+2],xe[3]=t[e+3],xe[4]=t[e+4],xe[5]=t[e+5],xe[6]=t[e+6],xe[7]=t[e+7],Ns[0]}var Ib=BigInt(Number.MAX_SAFE_INTEGER),vb=BigInt(Number.MIN_SAFE_INTEGER),Pe=class t{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return Yt;if(e<Ib&&e>vb)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>Tc&&(i=0n,++n>Tc&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return Yt;let r=e<0;r&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new t(n,i)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):Yt}},Yt=new Pe(0,0);Yt.toBigInt=function(){return 0n};Yt.zzEncode=Yt.zzDecode=function(){return this};Yt.length=function(){return 1};var Tc=4294967296n;function Rc(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Bc(t,e,r){if(r-e<1)return"";let i,o=[],s=0,a;for(;e<r;)a=t[e++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function Os(t,e,r){let n=r,i,o;for(let s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function $e(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function vi(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var Us=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,$e(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw $e(this,4);return vi(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw $e(this,4);return vi(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw $e(this,4);let e=Ac(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw $e(this,4);let e=vc(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw $e(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return Bc(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw $e(this,e);this.pos+=e}else do if(this.pos>=this.len)throw $e(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Pe(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw $e(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw $e(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw $e(this,8);let e=vi(this.buf,this.pos+=4),r=vi(this.buf,this.pos+=4);return new Pe(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=Ds(this.buf,this.pos);return this.pos+=Xe(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function ks(t){return new Us(t instanceof Uint8Array?t:t.subarray())}function Ti(t,e,r){let n=ks(t);return e.decode(n,void 0,r)}function Ms(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Be(s);i+s>e&&(n=Be(e),i=0);let a=n.subarray(i,i+=s);return(i&7)!==0&&(i=(i|7)+1),a}}var Zt=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function Fs(){}var Hs=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},Tb=Ms();function Rb(t){return globalThis.Buffer!=null?Be(t):Tb(t)}var vn=class{len;head;tail;states;constructor(){this.len=0,this.head=new Zt(Fs,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new Zt(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new $s((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(Ri,10,Pe.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Pe.fromBigInt(e);return this._push(Ri,r.length(),r)}uint64Number(e){return this._push(An,Xe(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=Pe.fromBigInt(e).zzEncode();return this._push(Ri,r.length(),r)}sint64Number(e){let r=Pe.fromNumber(e).zzEncode();return this._push(Ri,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(qs,1,e?1:0)}fixed32(e){return this._push(In,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Pe.fromBigInt(e);return this._push(In,4,r.lo)._push(In,4,r.hi)}fixed64Number(e){let r=Pe.fromNumber(e);return this._push(In,4,r.lo)._push(In,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(_c,4,e)}double(e){return this._push(Ic,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(qs,1,0):this.uint32(r)._push(Cb,r,e)}string(e){let r=Rc(e);return r!==0?this.uint32(r)._push(Os,r,e):this._push(qs,1,0)}fork(){return this.states=new Hs(this),this.head=this.tail=new Zt(Fs,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new Zt(Fs,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=Rb(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function qs(t,e,r){e[r]=t&255}function Bb(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var $s=class extends Zt{next;constructor(e,r){super(Bb,e,r),this.next=void 0}};function Ri(t,e,r){for(;t.hi!==0;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}function In(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function Cb(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(vn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(Db,e,t),this},vn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(Lb,e,t),this});function Db(t,e,r){e.set(t,r)}function Lb(t,e,r){t.length<40?Os(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(Y(t),r)}function Ks(){return new vn}function Bi(t,e){let r=Ks();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Dr;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(Dr||(Dr={}));function Ci(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function Ws(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return Ci("enum",Dr.VARINT,r,n)}function Di(t,e){return Ci("message",Dr.LENGTH_DELIMITED,t,e)}var Ne;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.ECDSA="ECDSA"})(Ne||(Ne={}));var js;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.secp256k1=2]="secp256k1",t[t.ECDSA=3]="ECDSA"})(js||(js={}));(function(t){t.codec=()=>Ws(js)})(Ne||(Ne={}));var Tn;(function(t){let e;t.codec=()=>(e==null&&(e=Di((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Ne.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n,i={})=>{let o={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let a=r.uint32();switch(a>>>3){case 1:{o.Type=Ne.codec().decode(r);break}case 2:{o.Data=r.bytes();break}default:{r.skipType(a&7);break}}}return o})),e),t.encode=r=>Bi(r,t.codec()),t.decode=(r,n)=>Ti(r,t.codec(),n)})(Tn||(Tn={}));var Vs;(function(t){let e;t.codec=()=>(e==null&&(e=Di((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),Ne.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n,i={})=>{let o={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let a=r.uint32();switch(a>>>3){case 1:{o.Type=Ne.codec().decode(r);break}case 2:{o.Data=r.bytes();break}default:{r.skipType(a&7);break}}}return o})),e),t.encode=r=>Bi(r,t.codec()),t.decode=(r,n)=>Ti(r,t.codec(),n)})(Vs||(Vs={}));var Li=class extends Sr{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Lf(e);let n=bn(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),dt(o)}update(e){return Ar(this),this.iHash.update(e),this}digestInto(e){Ar(this),we(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},zs=(t,e,r)=>new Li(t,e).update(r).digest();zs.create=(t,e)=>new Li(t,e);function Dc(t){t.lowS!==void 0&&pt("lowS",t.lowS),t.prehash!==void 0&&pt("prehash",t.prehash)}var Gs=class extends Error{constructor(e=""){super(e)}},yt={Err:Gs,_tlv:{encode:(t,e)=>{let{Err:r}=yt;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=En(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?En(i.length/2|128):"";return En(t)+o+i+e},decode(t,e){let{Err:r}=yt,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let i=e[n++],o=!!(i&128),s=0;if(!o)s=i;else{let u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let c=e.subarray(n,n+u);if(c.length!==u)throw new r("tlv.decode: length bytes not complete");if(c[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of c)s=s<<8|f;if(n+=u,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=e.subarray(n,n+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+s)}}},_int:{encode(t){let{Err:e}=yt;if(t<Rn)throw new e("integer: negative integers are not allowed");let r=En(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){let{Err:e}=yt;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return vr(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=yt,i=V("signature",t),{v:o,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:u}=n.decode(2,o),{v:c,l:f}=n.decode(2,u);if(f.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(c)}},hexFromSig(t){let{_tlv:e,_int:r}=yt,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),o=n+i;return e.encode(48,o)}},Rn=BigInt(0),Bn=BigInt(1),Nb=BigInt(2),Pi=BigInt(3),Ob=BigInt(4);function Ub(t,e,r){function n(i){let o=t.sqr(i),s=t.mul(o,i);return t.add(t.add(s,t.mul(i,e)),r)}return n}function Lc(t,e,r){let{BYTES:n}=t;function i(o){let s;if(typeof o=="bigint")s=o;else{let a=V("private key",o);if(e){if(!e.includes(a.length*2))throw new Error("invalid private key");let u=new Uint8Array(n);u.set(a,u.length-a.length),a=u}try{s=t.fromBytes(a)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof o}`)}}if(r&&(s=t.create(s)),!t.isValidNot0(s))throw new Error("invalid private key: out of range [1..N-1]");return s}return i}function kb(t,e={}){let{Fp:r,Fn:n}=gi("weierstrass",t,e),{h:i,n:o}=t;Dt(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:s}=e;if(s&&(!r.is0(t.a)||typeof s.beta!="bigint"||typeof s.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function a(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function u(R,p,S){let{x:E,y:_}=p.toAffine(),A=r.toBytes(E);if(pt("isCompressed",S),S){a();let D=!r.isOdd(_);return Le(Pc(D),A)}else return Le(Uint8Array.of(4),A,r.toBytes(_))}function c(R){we(R);let p=r.BYTES,S=p+1,E=2*p+1,_=R.length,A=R[0],D=R.subarray(1);if(_===S&&(A===2||A===3)){let C=r.fromBytes(D);if(!r.isValid(C))throw new Error("bad point: is not on curve, wrong x");let P=y(C),U;try{U=r.sqrt(P)}catch(H){let k=H instanceof Error?": "+H.message:"";throw new Error("bad point: is not on curve, sqrt error"+k)}a();let O=r.isOdd(U);return(A&1)===1!==O&&(U=r.neg(U)),{x:C,y:U}}else if(_===E&&A===4){let C=r.fromBytes(D.subarray(p*0,p*1)),P=r.fromBytes(D.subarray(p*1,p*2));if(!d(C,P))throw new Error("bad point: is not on curve");return{x:C,y:P}}else throw new Error(`bad point: got length ${_}, expected compressed=${S} or uncompressed=${E}`)}let f=e.toBytes||u,l=e.fromBytes||c,y=Ub(r,t.a,t.b);function d(R,p){let S=r.sqr(p),E=y(R);return r.eql(S,E)}if(!d(t.Gx,t.Gy))throw new Error("bad curve params: generator point");let x=r.mul(r.pow(t.a,Pi),Ob),h=r.mul(r.sqr(t.b),BigInt(27));if(r.is0(r.add(x,h)))throw new Error("bad curve params: a or b");function m(R,p,S=!1){if(!r.isValid(p)||S&&r.is0(p))throw new Error(`bad point coordinate ${R}`);return p}function g(R){if(!(R instanceof w))throw new Error("ProjectivePoint expected")}let v=Rr((R,p)=>{let{px:S,py:E,pz:_}=R;if(r.eql(_,r.ONE))return{x:S,y:E};let A=R.is0();p==null&&(p=A?r.ONE:r.inv(_));let D=r.mul(S,p),C=r.mul(E,p),P=r.mul(_,p);if(A)return{x:r.ZERO,y:r.ZERO};if(!r.eql(P,r.ONE))throw new Error("invZ was invalid");return{x:D,y:C}}),I=Rr(R=>{if(R.is0()){if(e.allowInfinityPoint&&!r.is0(R.py))return;throw new Error("bad point: ZERO")}let{x:p,y:S}=R.toAffine();if(!r.isValid(p)||!r.isValid(S))throw new Error("bad point: x or y not field elements");if(!d(p,S))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function T(R,p,S,E,_){return S=new w(r.mul(S.px,R),S.py,S.pz),p=Br(E,p),S=Br(_,S),p.add(S)}class w{constructor(p,S,E){this.px=m("x",p),this.py=m("y",S,!0),this.pz=m("z",E),Object.freeze(this)}static fromAffine(p){let{x:S,y:E}=p||{};if(!p||!r.isValid(S)||!r.isValid(E))throw new Error("invalid affine point");if(p instanceof w)throw new Error("projective point not allowed");return r.is0(S)&&r.is0(E)?w.ZERO:new w(S,E,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(p){return bi(w,"pz",p)}static fromBytes(p){return we(p),w.fromHex(p)}static fromHex(p){let S=w.fromAffine(l(V("pointHex",p)));return S.assertValidity(),S}static fromPrivateKey(p){let S=Lc(n,e.allowedPrivateKeyLengths,e.wrapPrivateKey);return w.BASE.multiply(S(p))}static msm(p,S){return wi(w,n,p,S)}precompute(p=8,S=!0){return B.setWindowSize(this,p),S||this.multiply(Pi),this}_setWindowSize(p){this.precompute(p)}assertValidity(){I(this)}hasEvenY(){let{y:p}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(p)}equals(p){g(p);let{px:S,py:E,pz:_}=this,{px:A,py:D,pz:C}=p,P=r.eql(r.mul(S,C),r.mul(A,_)),U=r.eql(r.mul(E,C),r.mul(D,_));return P&&U}negate(){return new w(this.px,r.neg(this.py),this.pz)}double(){let{a:p,b:S}=t,E=r.mul(S,Pi),{px:_,py:A,pz:D}=this,C=r.ZERO,P=r.ZERO,U=r.ZERO,O=r.mul(_,_),te=r.mul(A,A),H=r.mul(D,D),k=r.mul(_,A);return k=r.add(k,k),U=r.mul(_,D),U=r.add(U,U),C=r.mul(p,U),P=r.mul(E,H),P=r.add(C,P),C=r.sub(te,P),P=r.add(te,P),P=r.mul(C,P),C=r.mul(k,C),U=r.mul(E,U),H=r.mul(p,H),k=r.sub(O,H),k=r.mul(p,k),k=r.add(k,U),U=r.add(O,O),O=r.add(U,O),O=r.add(O,H),O=r.mul(O,k),P=r.add(P,O),H=r.mul(A,D),H=r.add(H,H),O=r.mul(H,k),C=r.sub(C,O),U=r.mul(H,te),U=r.add(U,U),U=r.add(U,U),new w(C,P,U)}add(p){g(p);let{px:S,py:E,pz:_}=this,{px:A,py:D,pz:C}=p,P=r.ZERO,U=r.ZERO,O=r.ZERO,te=t.a,H=r.mul(t.b,Pi),k=r.mul(S,A),ie=r.mul(E,D),fe=r.mul(_,C),me=r.add(S,E),W=r.add(A,D);me=r.mul(me,W),W=r.add(k,ie),me=r.sub(me,W),W=r.add(S,_);let _e=r.add(A,C);return W=r.mul(W,_e),_e=r.add(k,fe),W=r.sub(W,_e),_e=r.add(E,_),P=r.add(D,C),_e=r.mul(_e,P),P=r.add(ie,fe),_e=r.sub(_e,P),O=r.mul(te,W),P=r.mul(H,fe),O=r.add(P,O),P=r.sub(ie,O),O=r.add(ie,O),U=r.mul(P,O),ie=r.add(k,k),ie=r.add(ie,k),fe=r.mul(te,fe),W=r.mul(H,W),ie=r.add(ie,fe),fe=r.sub(k,fe),fe=r.mul(te,fe),W=r.add(W,fe),k=r.mul(ie,W),U=r.add(U,k),k=r.mul(_e,W),P=r.mul(me,P),P=r.sub(P,k),k=r.mul(me,ie),O=r.mul(_e,O),O=r.add(O,k),new w(P,U,O)}subtract(p){return this.add(p.negate())}is0(){return this.equals(w.ZERO)}multiply(p){let{endo:S}=e;if(!n.isValidNot0(p))throw new Error("invalid scalar: out of range");let E,_,A=D=>B.wNAFCached(this,D,w.normalizeZ);if(S){let{k1neg:D,k1:C,k2neg:P,k2:U}=S.splitScalar(p),{p:O,f:te}=A(C),{p:H,f:k}=A(U);_=te.add(k),E=T(S.beta,O,H,D,P)}else{let{p:D,f:C}=A(p);E=D,_=C}return w.normalizeZ([E,_])[0]}multiplyUnsafe(p){let{endo:S}=e,E=this;if(!n.isValid(p))throw new Error("invalid scalar: out of range");if(p===Rn||E.is0())return w.ZERO;if(p===Bn)return E;if(B.hasPrecomputes(this))return this.multiply(p);if(S){let{k1neg:_,k1:A,k2neg:D,k2:C}=S.splitScalar(p),{p1:P,p2:U}=pc(w,E,A,C);return T(S.beta,P,U,_,D)}else return B.wNAFCachedUnsafe(E,p)}multiplyAndAddUnsafe(p,S,E){let _=this.multiplyUnsafe(S).add(p.multiplyUnsafe(E));return _.is0()?void 0:_}toAffine(p){return v(this,p)}isTorsionFree(){let{isTorsionFree:p}=e;return i===Bn?!0:p?p(w,this):B.wNAFCachedUnsafe(this,o).is0()}clearCofactor(){let{clearCofactor:p}=e;return i===Bn?this:p?p(w,this):this.multiplyUnsafe(i)}toBytes(p=!0){return pt("isCompressed",p),this.assertValidity(),f(w,this,p)}toRawBytes(p=!0){return this.toBytes(p)}toHex(p=!0){return Ge(this.toBytes(p))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}w.BASE=new w(t.Gx,t.Gy,r.ONE),w.ZERO=new w(r.ZERO,r.ONE,r.ZERO),w.Fp=r,w.Fn=n;let L=n.BITS,B=mi(w,e.endo?Math.ceil(L/2):L);return w}function Pc(t){return Uint8Array.of(t?2:3)}function Mb(t,e,r={}){Dt(e,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=e.randomBytes||mn,i=e.hmac||((E,..._)=>zs(e.hash,E,Le(..._))),{Fp:o,Fn:s}=t,{ORDER:a,BITS:u}=s;function c(E){let _=a>>Bn;return E>_}function f(E){return c(E)?s.neg(E):E}function l(E,_){if(!s.isValidNot0(_))throw new Error(`invalid signature ${E}: out of range 1..CURVE.n`)}class y{constructor(_,A,D){l("r",_),l("s",A),this.r=_,this.s=A,D!=null&&(this.recovery=D),Object.freeze(this)}static fromCompact(_){let A=s.BYTES,D=V("compactSignature",_,A*2);return new y(s.fromBytes(D.subarray(0,A)),s.fromBytes(D.subarray(A,A*2)))}static fromDER(_){let{r:A,s:D}=yt.toSig(V("DER",_));return new y(A,D)}assertValidity(){}addRecoveryBit(_){return new y(this.r,this.s,_)}recoverPublicKey(_){let A=o.ORDER,{r:D,s:C,recovery:P}=this;if(P==null||![0,1,2,3].includes(P))throw new Error("recovery id invalid");if(a*Nb<A&&P>1)throw new Error("recovery id is ambiguous for h>1 curve");let O=P===2||P===3?D+a:D;if(!o.isValid(O))throw new Error("recovery id 2 or 3 invalid");let te=o.toBytes(O),H=t.fromHex(Le(Pc((P&1)===0),te)),k=s.inv(O),ie=I(V("msgHash",_)),fe=s.create(-ie*k),me=s.create(C*k),W=t.BASE.multiplyUnsafe(fe).add(H.multiplyUnsafe(me));if(W.is0())throw new Error("point at infinify");return W.assertValidity(),W}hasHighS(){return c(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,s.neg(this.s),this.recovery):this}toBytes(_){if(_==="compact")return Le(s.toBytes(this.r),s.toBytes(this.s));if(_==="der")return Ir(yt.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Ge(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Ge(this.toBytes("compact"))}}let d=Lc(s,r.allowedPrivateKeyLengths,r.wrapPrivateKey),x={isValidPrivateKey(E){try{return d(E),!0}catch{return!1}},normPrivateKeyToScalar:d,randomPrivateKey:()=>{let E=a;return uc(n(xs(E)),E)},precompute(E=8,_=t.BASE){return _.precompute(E,!1)}};function h(E,_=!0){return t.fromPrivateKey(E).toBytes(_)}function m(E){if(typeof E=="bigint")return!1;if(E instanceof t)return!0;let A=V("key",E).length,D=o.BYTES,C=D+1,P=2*D+1;if(!(r.allowedPrivateKeyLengths||s.BYTES===C))return A===C||A===P}function g(E,_,A=!0){if(m(E)===!0)throw new Error("first arg must be private key");if(m(_)===!1)throw new Error("second arg must be public key");return t.fromHex(_).multiply(d(E)).toBytes(A)}let v=e.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let _=vr(E),A=E.length*8-u;return A>0?_>>BigInt(A):_},I=e.bits2int_modN||function(E){return s.create(v(E))},T=Vt(u);function w(E){return Ct("num < 2^"+u,E,Rn,T),s.toBytes(E)}function L(E,_,A=B){if(["recovered","canonical"].some(me=>me in A))throw new Error("sign() legacy options not supported");let{hash:D}=e,{lowS:C,prehash:P,extraEntropy:U}=A;C==null&&(C=!0),E=V("msgHash",E),Dc(A),P&&(E=V("prehashed msgHash",D(E)));let O=I(E),te=d(_),H=[w(te),w(O)];if(U!=null&&U!==!1){let me=U===!0?n(o.BYTES):U;H.push(V("extraEntropy",me))}let k=Le(...H),ie=O;function fe(me){let W=v(me);if(!s.isValidNot0(W))return;let _e=s.inv(W),rn=t.BASE.multiply(W).toAffine(),hr=s.create(rn.x);if(hr===Rn)return;let Ft=s.create(_e*s.create(ie+hr*te));if(Ft===Rn)return;let No=(rn.x===hr?0:2)|Number(rn.y&Bn),pr=Ft;return C&&c(Ft)&&(pr=f(Ft),No^=1),new y(hr,pr,No)}return{seed:k,k2sig:fe}}let B={lowS:e.lowS,prehash:!1},R={lowS:e.lowS,prehash:!1};function p(E,_,A=B){let{seed:D,k2sig:C}=L(E,_,A);return Qf(e.hash.outputLen,s.BYTES,i)(D,C)}t.BASE.precompute(8);function S(E,_,A,D=R){let C=E;_=V("msgHash",_),A=V("publicKey",A),Dc(D);let{lowS:P,prehash:U,format:O}=D;if("strict"in D)throw new Error("options.strict was renamed to lowS");if(O!==void 0&&!["compact","der","js"].includes(O))throw new Error('format must be "compact", "der" or "js"');let te=typeof C=="string"||_r(C),H=!te&&!O&&typeof C=="object"&&C!==null&&typeof C.r=="bigint"&&typeof C.s=="bigint";if(!te&&!H)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let k,ie;try{if(H)if(O===void 0||O==="js")k=new y(C.r,C.s);else throw new Error("invalid format");if(te){try{O!=="compact"&&(k=y.fromDER(C))}catch(pr){if(!(pr instanceof yt.Err))throw pr}!k&&O!=="der"&&(k=y.fromCompact(C))}ie=t.fromHex(A)}catch{return!1}if(!k||P&&k.hasHighS())return!1;U&&(_=e.hash(_));let{r:fe,s:me}=k,W=I(_),_e=s.inv(me),rn=s.create(W*_e),hr=s.create(fe*_e),Ft=t.BASE.multiplyUnsafe(rn).add(ie.multiplyUnsafe(hr));return Ft.is0()?!1:s.create(Ft.x)===fe}return Object.freeze({getPublicKey:h,getSharedSecret:g,sign:p,verify:S,utils:x,Point:t,Signature:y})}function Fb(t){let e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=He(e.n,t.nBitLength),i={Fp:r,Fn:n,allowedPrivateKeyLengths:t.allowedPrivateKeyLengths,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,wrapPrivateKey:t.wrapPrivateKey,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:i}}function qb(t){let{CURVE:e,curveOpts:r}=Fb(t),n={hash:t.hash,hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,ecdsaOpts:n}}function Hb(t,e){return Object.assign({},e,{ProjectivePoint:e.Point,CURVE:t})}function Nc(t){let{CURVE:e,curveOpts:r,ecdsaOpts:n}=qb(t),i=kb(e,r),o=Mb(i,n,r);return Hb(t,o)}function Oc(t,e){let r=n=>Nc({...t,hash:n});return{...r(e),create:r}}var Ni={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},X8=BigInt(0),$b=BigInt(1),Ys=BigInt(2),Uc=(t,e)=>(t+e/Ys)/e;function Kb(t){let e=Ni.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,f=c*c*t%e,l=z(f,r,e)*f%e,y=z(l,r,e)*f%e,d=z(y,Ys,e)*c%e,x=z(d,i,e)*d%e,h=z(x,o,e)*x%e,m=z(h,a,e)*h%e,g=z(m,u,e)*m%e,v=z(g,a,e)*h%e,I=z(v,r,e)*f%e,T=z(I,s,e)*x%e,w=z(T,n,e)*c%e,L=z(w,Ys,e);if(!Zs.eql(Zs.sqr(L),t))throw new Error("Cannot find square root");return L}var Zs=He(Ni.p,void 0,void 0,{sqrt:Kb}),Lr=Oc({...Ni,Fp:Zs,lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=Ni.n,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-$b*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=r,s=BigInt("0x100000000000000000000000000000000"),a=Uc(o*t,e),u=Uc(-n*t,e),c=Z(t-a*r-u*i,e),f=Z(-a*n-u*o,e),l=c>s,y=f>s;if(l&&(c=e-c),y&&(f=e-f),c>s||f>s)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:l,k1:c,k2neg:y,k2:f}}}},zf);function kc(t,e,r,n){let i=un.digest(r instanceof Uint8Array?r:r.subarray());if(Ai(i))return i.then(({digest:o})=>(n?.signal?.throwIfAborted(),Lr.verify(e,o,t))).catch(o=>{throw o.name==="AbortError"?o:new _n(String(o))});try{return n?.signal?.throwIfAborted(),Lr.verify(e,i.digest,t)}catch(o){throw new _n(String(o))}}var Oi=class{type="secp256k1";raw;_key;constructor(e){this._key=Fc(e),this.raw=Mc(this._key)}toMultihash(){return Fe.digest(Er(this))}toCID(){return se.createV1(114,this.toMultihash())}toString(){return ee.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:De(this.raw,e.raw)}verify(e,r,n){return kc(this._key,r,e,n)}};function qc(t){return new Oi(t)}function Mc(t){return Lr.ProjectivePoint.fromHex(t).toRawBytes(!0)}function Fc(t){try{return Lr.ProjectivePoint.fromHex(t),t}catch(e){throw new ui(String(e))}}function Hc(t){let{Type:e,Data:r}=Tn.decode(t.digest),n=r??new Uint8Array;switch(e){case Ne.Ed25519:return Sc(n);case Ne.secp256k1:return qc(n);case Ne.ECDSA:return Rf(n);default:throw new dn}}function Er(t){return Tn.encode({Type:Ne[t.type],Data:t.raw})}var $c=Symbol.for("nodejs.util.inspect.custom"),Wb=114,Cn=class{type;multihash;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[ai]=!0;toString(){return this.string==null&&(this.string=ee.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return se.createV1(Wb,this.multihash)}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return De(this.multihash.bytes,e);if(typeof e=="string")return this.toString()===e;if(e?.toMultihash()?.bytes!=null)return De(this.multihash.bytes,e.toMultihash().bytes);throw new Error("not valid Id")}[$c](){return`PeerId(${this.toString()})`}},Ui=class extends Cn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},ki=class extends Cn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.publicKey}},Mi=class extends Cn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.publicKey}},jb=2336,Dn=class{type="url";multihash;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=Fe.digest(Y(this.url))}[$c](){return`PeerId(${this.url})`}[ai]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return se.createV1(jb,this.toMultihash())}toJSON(){return this.toString()}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=$(e)),e.toString()===this.toString())}};var Vb=114,Kc=2336;function Wc(t,e){let r;if(t.charAt(0)==="1"||t.charAt(0)==="Q")r=sn(ee.decode(`z${t}`));else{if(t.startsWith("k51qzi5uqu5")||t.startsWith("kzwfwjn5ji4")||t.startsWith("k2k4r8")||t.startsWith("bafz"))return zb(se.parse(t));if(e==null)throw new Ce('Please pass a multibase decoder for strings that do not start with "1" or "Q"');r=sn(e.decode(t))}return jc(r)}function jc(t){if(Yb(t))return new Ui({multihash:t});if(Gb(t))try{let e=Hc(t);if(e.type==="Ed25519")return new ki({multihash:t,publicKey:e});if(e.type==="secp256k1")return new Mi({multihash:t,publicKey:e})}catch{let r=$(t.digest);return new Dn(new URL(r))}throw new ci("Supplied PeerID Multihash is invalid")}function zb(t){if(t?.multihash==null||t.version==null||t.version===1&&t.code!==Vb&&t.code!==Kc)throw new fi("Supplied PeerID CID is invalid");if(t.code===Kc){let e=$(t.multihash.digest);return new Dn(new URL(e))}return jc(t.multihash)}function Gb(t){return t.code===Fe.code}function Yb(t){return t.code===un.code}var ye=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},bt=class extends Error{static name="ValidationError";name="ValidationError"},Ln=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},Fi=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};var qi=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,i){return this.readAtomically(()=>{let o=0,s=0,a=this.peekChar();if(a===void 0)return;let u=a==="0",c=2**(8*i)-1;for(;;){let f=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let y=Number.parseInt(l,e);if(!Number.isNaN(y))return y});if(f===void 0)break;if(o*=e,o+=f,o>c||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&u&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[i]=s[0],r[i+1]=s[1],r[i+2]=s[2],r[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];r[i]=o>>8,r[i+1]=o&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=e(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(n+2),[a]=e(o.subarray(0,s));return r.set(o.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var Zb=45,Xb=15,Hi=new qi;function Xs(t){if(!(t.length>Xb))return Hi.new(t).parseWith(()=>Hi.readIPv4Addr())}function Qs(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Zb))return Hi.new(t).parseWith(()=>Hi.readIPv6Addr())}function $i(t){return!!Xs(t)}function zc(t){return!!Qs(t)}function ea(t){return e=>$(e,t)}function ta(t){return e=>Y(e,t)}function Pr(t){return new DataView(t.buffer).getUint16(t.byteOffset).toString()}function Xt(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof t=="string"?parseInt(t):t),new Uint8Array(e)}function Gc(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=Y(e[0],"base32"),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Xt(n);return ct([r,i],r.length+i.length)}function Yc(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=vt.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=Xt(n);return ct([r,i],r.length+i.length)}function ra(t){let e=t.subarray(0,t.length-2),r=t.subarray(t.length-2),n=$(e,"base32"),i=Pr(r);return`${n}:${i}`}var na=function(t){t=t.toString().trim();let e=new Uint8Array(4);return t.split(/\./g).forEach((r,n)=>{let i=parseInt(r,10);if(isNaN(i)||i<0||i>255)throw new ye("Invalid byte value in IP address");e[n]=i}),e},Zc=function(t){let e=0;t=t.toString().trim();let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=$i(r[n]),s;o&&(s=na(r[n]),r[n]=$(s.subarray(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,$(s.subarray(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let o=[n,1];for(n=9-r.length;n>0;n--)o.push("0");r.splice.apply(r,o)}let i=new Uint8Array(e+16);for(n=0;n<r.length;n++){r[n]===""&&(r[n]="0");let o=parseInt(r[n],16);if(isNaN(o)||o<0||o>65535)throw new ye("Invalid byte value in IP address");i[e++]=o>>8&255,i[e++]=o&255}return i},Xc=function(t){if(t.byteLength!==4)throw new ye("IPv4 address was incorrect length");let e=[];for(let r=0;r<t.byteLength;r++)e.push(t[r]);return e.join(".")},Qc=function(t){if(t.byteLength!==16)throw new ye("IPv6 address was incorrect length");let e=[];for(let n=0;n<t.byteLength;n+=2){let i=t[n],o=t[n+1],s=`${i.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`;e.push(s)}let r=e.join(":");try{let n=new URL(`http://[${r}]`);return n.hostname.substring(1,n.hostname.length-1)}catch{throw new ye(`Invalid IPv6 address "${r}"`)}};function Jc(t){try{let e=new URL(`http://[${t}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new ye(`Invalid IPv6 address "${t}"`)}}var Js=Object.values(cn).map(t=>t.decoder),Qb=function(){let t=Js[0].or(Js[1]);return Js.slice(2).forEach(e=>t=t.or(e)),t}();function el(t){return Qb.decode(t)}function tl(t){return e=>t.encoder.encode(e)}function Jb(t){if(parseInt(t).toString()!==t)throw new bt("Value must be an integer")}function em(t){if(t<0)throw new bt("Value must be a positive integer, or zero")}function tm(t){return e=>{if(e>t)throw new bt(`Value must be smaller than or equal to ${t}`)}}function rm(...t){return e=>{for(let r of t)r(e)}}var Pn=rm(Jb,em,tm(65535));var de=-1,ia=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(e){let r;if(typeof e=="string"?r=this.protocolsByName.get(e):r=this.protocolsByCode.get(e),r==null)throw new Fi(`Protocol ${e} was unknown`);return r}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(r=>{this.protocolsByName.set(r,e)})}removeProtocol(e){let r=this.protocolsByCode.get(e);r!=null&&(this.protocolsByCode.delete(r.code),this.protocolsByName.delete(r.name),r.aliases?.forEach(n=>{this.protocolsByName.delete(n)}))}},Oe=new ia,Dm=[{code:4,name:"ip4",size:32,valueToBytes:na,bytesToValue:Xc,validate:t=>{if(!$i(t))throw new bt(`Invalid IPv4 address "${t}"`)}},{code:6,name:"tcp",size:16,valueToBytes:Xt,bytesToValue:Pr,validate:Pn},{code:273,name:"udp",size:16,valueToBytes:Xt,bytesToValue:Pr,validate:Pn},{code:33,name:"dccp",size:16,valueToBytes:Xt,bytesToValue:Pr,validate:Pn},{code:41,name:"ip6",size:128,valueToBytes:Zc,bytesToValue:Qc,stringToValue:Jc,validate:t=>{if(!zc(t))throw new bt(`Invalid IPv6 address "${t}"`)}},{code:42,name:"ip6zone",size:de},{code:43,name:"ipcidr",size:8,bytesToValue:ea("base10"),valueToBytes:ta("base10")},{code:53,name:"dns",size:de,resolvable:!0},{code:54,name:"dns4",size:de,resolvable:!0},{code:55,name:"dns6",size:de,resolvable:!0},{code:56,name:"dnsaddr",size:de,resolvable:!0},{code:132,name:"sctp",size:16,valueToBytes:Xt,bytesToValue:Pr,validate:Pn},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:de,path:!0,stringToValue:t=>decodeURIComponent(t),valueToString:t=>encodeURIComponent(t)},{code:421,name:"p2p",aliases:["ipfs"],size:de,bytesToValue:ea("base58btc"),valueToBytes:t=>t.startsWith("Q")||t.startsWith("1")?ta("base58btc")(t):se.parse(t).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:ra,valueToBytes:Gc},{code:445,name:"onion3",size:296,bytesToValue:ra,valueToBytes:Yc},{code:446,name:"garlic64",size:de},{code:447,name:"garlic32",size:de},{code:448,name:"tls"},{code:449,name:"sni",size:de},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:de,bytesToValue:tl(zo),valueToBytes:el},{code:480,name:"http"},{code:481,name:"http-path",size:de,stringToValue:t=>`/${decodeURIComponent(t)}`,valueToString:t=>encodeURIComponent(t.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:de}];Dm.forEach(t=>{Oe.addProtocol(t)});function rl(t){let e=[],r=0;for(;r<t.length;){let n=Ls(t,r),i=Oe.getProtocol(n),o=Xe(n),s=Lm(i,t,r+o),a=0;s>0&&i.size===de&&(a=Xe(s));let u=o+a+s,c={code:n,name:i.name,bytes:t.subarray(r,r+u)};if(s>0){let f=r+o+a,l=t.subarray(f,f+s);c.value=i.bytesToValue?.(l)??$(l)}e.push(c),r+=u}return e}function nl(t){let e=0,r=[];for(let n of t){if(n.bytes==null){let i=Oe.getProtocol(n.code),o=Xe(n.code),s,a=0,u=0;n.value!=null&&(s=i.valueToBytes?.(n.value)??Y(n.value),a=s.byteLength,i.size===de&&(u=Xe(a)));let c=new Uint8Array(o+u+a),f=0;An(n.code,c,f),f+=o,s!=null&&(i.size===de&&(An(a,c,f),f+=u),c.set(s,f)),n.bytes=c}r.push(n.bytes),e+=n.bytes.byteLength}return ct(r,e)}function il(t){if(t.charAt(0)!=="/")throw new ye('String multiaddr must start with "/"');let e=[],r="protocol",n="",i="";for(let o=1;o<t.length;o++){let s=t.charAt(o);s!=="/"&&(r==="protocol"?i+=t.charAt(o):n+=t.charAt(o));let a=o===t.length-1;if(s==="/"||a){let u=Oe.getProtocol(i);if(r==="protocol"){if(u.size==null||u.size===0){e.push({code:u.code,name:u.name}),n="",i="",r="protocol";continue}else if(a)throw new ye(`Component ${i} was missing value`);r="value"}else if(r==="value"){let c={code:u.code,name:u.name};if(u.size!=null&&u.size!==0){if(n==="")throw new ye(`Component ${i} was missing value`);c.value=u.stringToValue?.(n)??n}e.push(c),n="",i="",r="protocol"}}}if(i!==""&&n!=="")throw new ye("Incomplete multiaddr");return e}function ol(t){return`/${t.flatMap(e=>{if(e.value==null)return e.name;let r=Oe.getProtocol(e.code);if(r==null)throw new ye(`Unknown protocol code ${e.code}`);return[e.name,r.valueToString?.(e.value)??e.value]}).join("/")}`}function Lm(t,e,r){return t.size==null||t.size===0?0:t.size>0?t.size/8:Ls(e,r)}var Pm=Symbol.for("nodejs.util.inspect.custom"),ca=Symbol.for("@multiformats/multiaddr"),Nm=[53,54,55,56],fa=class extends Error{constructor(e="No available resolver"){super(e),this.name="NoAvailableResolverError"}};function Om(t){if(t==null&&(t="/"),Vi(t))return t.getComponents();if(t instanceof Uint8Array)return rl(t);if(typeof t=="string")return t=t.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),t===""&&(t="/"),il(t);if(Array.isArray(t))return t;throw new ye("Must be a string, Uint8Array, Component[], or another Multiaddr")}var ji=class t{[ca]=!0;#e;#t;#r;constructor(e="/",r={}){this.#e=Om(e),r.validate!==!1&&Um(this)}get bytes(){return this.#r==null&&(this.#r=nl(this.#e)),this.#r}toString(){return this.#t==null&&(this.#t=ol(this.#e)),this.#t}toJSON(){return this.toString()}toOptions(){let e,r,n,i,o="";for(let{code:a,name:u,value:c}of this.#e)a===42&&(o=`%${c??""}`),Nm.includes(a)&&(r="tcp",i=443,n=`${c??""}${o}`,e=a===55?6:4),(a===6||a===273)&&(r=u==="tcp"?"tcp":"udp",i=parseInt(c??"")),(a===4||a===41)&&(r="tcp",n=`${c??""}${o}`,e=a===41?6:4);if(e==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:i}}getComponents(){return[...this.#e]}protos(){return this.#e.map(({code:e,value:r})=>{let n=Oe.getProtocol(e);return{code:e,size:n.size??0,name:n.name,resolvable:!!n.resolvable,path:!!n.path}})}protoCodes(){return this.#e.map(({code:e})=>e)}protoNames(){return this.#e.map(({name:e})=>e)}tuples(){return this.#e.map(({code:e,value:r})=>{if(r==null)return[e];let n=Oe.getProtocol(e),i=[e];return r!=null&&i.push(n.valueToBytes?.(r)??Y(r)),i})}stringTuples(){return this.#e.map(({code:e,value:r})=>r==null?[e]:[e,r])}encapsulate(e){let r=new t(e);return new t([...this.#e,...r.getComponents()],{validate:!1})}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Ln(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,i),{validate:!1})}decapsulateCode(e){let r;for(let n=this.#e.length-1;n>-1;n--)if(this.#e[n].code===e){r=n;break}return new t(this.#e.slice(0,r),{validate:!1})}getPeerId(){try{let e=[];this.#e.forEach(({code:n,value:i})=>{n===421&&e.push([n,i]),n===290&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?$(ee.decode(`z${n}`),"base58btc"):$(se.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){for(let e of this.#e)if(Oe.getProtocol(e.code).path)return e.value??null;return null}equals(e){return De(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=sl.get(r.name);if(n==null)throw new fa(`no available resolver for ${r.name}`);return(await n(this,e)).map(o=>Ke(o))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(){return!(this.#e.length!==2||this.#e[0].code!==4&&this.#e[0].code!==41||this.#e[1].code!==6&&this.#e[1].code!==273)}[Pm](){return`Multiaddr(${this.toString()})`}};function Um(t){t.getComponents().forEach(e=>{let r=Oe.getProtocol(e.code);e.value!=null&&r.validate?.(e.value)})}var V4=parseInt("0xFFFF",16),z4=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var sl=new Map;function Vi(t){return!!t?.[ca]}function Ke(t){return new ji(t)}var Hm=[6,53,56,54,55];function fl(t){return dl("sni",t)?.value}function cl(t){let e=dl("tcp",t)?.value;return e==null?"":`:${e}`}function dl(t,e){return e.find(r=>r.name===t)}function ll(t){return t.some(({code:e})=>e===448)}function We(t,e){let r=hl[t.name];if(r==null)throw new Error(`Can't interpret protocol ${t.name}`);let n=r(t,e);return t.code===41?`[${n}]`:n}var hl={ip4:(t,e)=>t.value,ip6:(t,e)=>e.length===0?t.value:`[${t.value}]`,tcp:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`tcp://${We(r,e)}:${t.value}`},udp:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`udp://${We(r,e)}:${t.value}`},dnsaddr:(t,e)=>t.value,dns4:(t,e)=>t.value,dns6:(t,e)=>t.value,dns:(t,e)=>t.value,ipfs:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`${We(r,e)}`},p2p:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`${We(r,e)}`},http:(t,e)=>{let r=ll(e),n=fl(e),i=cl(e);if(r&&n!=null)return`https://${n}${i}`;let o=r?"https://":"http://",s=e.pop();if(s==null)throw new Error("Unexpected end of multiaddr");let a=We(s,e);return a=a?.replace("tcp://",""),`${o}${a}`},"http-path":(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");let n=We(r,e),i=decodeURIComponent(t.value??"");return`${n}${i}`},tls:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return We(r,e)},sni:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return We(r,e)},https:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");let n=We(r,e);return n=n?.replace("tcp://",""),`https://${n}`},ws:(t,e)=>{let r=ll(e),n=fl(e),i=cl(e);if(r&&n!=null)return`wss://${n}${i}`;let o=r?"wss://":"ws://",s=e.pop();if(s==null)throw new Error("Unexpected end of multiaddr");let a=We(s,e);return a=a?.replace("tcp://",""),`${o}${a}`},wss:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");let n=We(r,e);return n=n?.replace("tcp://",""),`wss://${n}`}};function pl(t,e){let n=Ke(t).getComponents(),i=n.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let o=hl[i.name];if(o==null)throw new Error(`No interpreter found for ${i.name}`);let s=o(i,n)??"";return e?.assumeHttp!==!1&&Hm.includes(i.code)&&(s=s.replace(/^.*:\/\//,""),i.value==="443"?s=`https://${s}`:s=`http://${s}`),(s.startsWith("http://")||s.startsWith("https://")||s.startsWith("ws://")||s.startsWith("wss://"))&&(s=new URL(s).toString(),s.endsWith("/")&&(s=s.substring(0,s.length-1))),s}var yl="[a-fA-F\\d:]",Pt=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${yl})|(?<=${yl})(?=\\s|$))`:"",je="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",oe="[a-fA-F\\d]{1,4}",zi=`
2
+ "use strict";var Libp2PHttpUtils=(()=>{var L0=Object.create;var pi=Object.defineProperty;var N0=Object.getOwnPropertyDescriptor;var P0=Object.getOwnPropertyNames;var O0=Object.getPrototypeOf,U0=Object.prototype.hasOwnProperty;var K=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Ne=(t,e)=>{for(var r in e)pi(t,r,{get:e[r],enumerable:!0})},gc=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of P0(e))!U0.call(t,i)&&i!==r&&pi(t,i,{get:()=>e[i],enumerable:!(n=N0(e,i))||n.enumerable});return t};var k0=(t,e,r)=>(r=t!=null?L0(O0(t)):{},gc(e||!t||!t.__esModule?pi(r,"default",{value:t,enumerable:!0}):r,t)),M0=t=>gc(pi({},"__esModule",{value:!0}),t);var Zl=K(so=>{"use strict";so.byteLength=Nw;so.toByteArray=Ow;so.fromByteArray=Mw;var rt=[],Ke=[],Lw=typeof Uint8Array<"u"?Uint8Array:Array,ja="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(fr=0,Gl=ja.length;fr<Gl;++fr)rt[fr]=ja[fr],Ke[ja.charCodeAt(fr)]=fr;var fr,Gl;Ke[45]=62;Ke[95]=63;function Yl(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 Nw(t){var e=Yl(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Pw(t,e,r){return(e+r)*3/4-r}function Ow(t){var e,r=Yl(t),n=r[0],i=r[1],o=new Lw(Pw(t,n,i)),s=0,a=i>0?n-4:n,u;for(u=0;u<a;u+=4)e=Ke[t.charCodeAt(u)]<<18|Ke[t.charCodeAt(u+1)]<<12|Ke[t.charCodeAt(u+2)]<<6|Ke[t.charCodeAt(u+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Ke[t.charCodeAt(u)]<<2|Ke[t.charCodeAt(u+1)]>>4,o[s++]=e&255),i===1&&(e=Ke[t.charCodeAt(u)]<<10|Ke[t.charCodeAt(u+1)]<<4|Ke[t.charCodeAt(u+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Uw(t){return rt[t>>18&63]+rt[t>>12&63]+rt[t>>6&63]+rt[t&63]}function kw(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(Uw(n));return i.join("")}function Mw(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(kw(t,s,s+o>a?a:s+o));return n===1?(e=t[r-1],i.push(rt[e>>2]+rt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(rt[e>>10]+rt[e>>4&63]+rt[e<<2&63]+"=")),i.join("")}});var Xl=K(za=>{za.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,u=(1<<a)-1,c=u>>1,f=-7,l=r?i-1:0,d=r?-1:1,h=t[e+l];for(l+=d,o=h&(1<<-f)-1,h>>=-f,f+=a;f>0;o=o*256+t[e+l],l+=d,f-=8);for(s=o&(1<<-f)-1,o>>=-f,f+=n;f>0;s=s*256+t[e+l],l+=d,f-=8);if(o===0)o=1-c;else{if(o===u)return s?NaN:(h?-1:1)*(1/0);s=s+Math.pow(2,n),o=o-c}return(h?-1:1)*s*Math.pow(2,o-n)};za.write=function(t,e,r,n,i,o){var s,a,u,c=o*8-i-1,f=(1<<c)-1,l=f>>1,d=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,h=n?0:o-1,p=n?1:-1,y=e<0||e===0&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(a=isNaN(e)?1:0,s=f):(s=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-s))<1&&(s--,u*=2),s+l>=1?e+=d/u:e+=d*Math.pow(2,1-l),e*u>=2&&(s++,u/=2),s+l>=f?(a=0,s=f):s+l>=1?(a=(e*u-1)*Math.pow(2,i),s=s+l):(a=e*Math.pow(2,l-1)*Math.pow(2,i),s=0));i>=8;t[r+h]=a&255,h+=p,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+h]=s&255,h+=p,s/=256,c-=8);t[r+h-p]|=y*128}});var Ct=K(Qr=>{"use strict";var Ga=Zl(),Zr=Xl(),Ql=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Qr.Buffer=m;Qr.SlowBuffer=Vw;Qr.INSPECT_MAX_BYTES=50;var ao=2147483647;Qr.kMaxLength=ao;m.TYPED_ARRAY_SUPPORT=Fw();!m.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 Fw(){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(m.prototype,"parent",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.buffer}});Object.defineProperty(m.prototype,"offset",{enumerable:!0,get:function(){if(m.isBuffer(this))return this.byteOffset}});function Rt(t){if(t>ao)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,m.prototype),e}function m(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 Qa(t)}return rd(t,e,r)}m.poolSize=8192;function rd(t,e,r){if(typeof t=="string")return Hw(t,e);if(ArrayBuffer.isView(t))return $w(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(nt(t,ArrayBuffer)||t&&nt(t.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(nt(t,SharedArrayBuffer)||t&&nt(t.buffer,SharedArrayBuffer)))return Za(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 m.from(n,e,r);let i=Kw(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return m.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)}m.from=function(t,e,r){return rd(t,e,r)};Object.setPrototypeOf(m.prototype,Uint8Array.prototype);Object.setPrototypeOf(m,Uint8Array);function nd(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 qw(t,e,r){return nd(t),t<=0?Rt(t):e!==void 0?typeof r=="string"?Rt(t).fill(e,r):Rt(t).fill(e):Rt(t)}m.alloc=function(t,e,r){return qw(t,e,r)};function Qa(t){return nd(t),Rt(t<0?0:Ja(t)|0)}m.allocUnsafe=function(t){return Qa(t)};m.allocUnsafeSlow=function(t){return Qa(t)};function Hw(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!m.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=id(t,e)|0,n=Rt(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function Ya(t){let e=t.length<0?0:Ja(t.length)|0,r=Rt(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function $w(t){if(nt(t,Uint8Array)){let e=new Uint8Array(t);return Za(e.buffer,e.byteOffset,e.byteLength)}return Ya(t)}function Za(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,m.prototype),n}function Kw(t){if(m.isBuffer(t)){let e=Ja(t.length)|0,r=Rt(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||tu(t.length)?Rt(0):Ya(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ya(t.data)}function Ja(t){if(t>=ao)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+ao.toString(16)+" bytes");return t|0}function Vw(t){return+t!=t&&(t=0),m.alloc(+t)}m.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==m.prototype};m.compare=function(e,r){if(nt(e,Uint8Array)&&(e=m.from(e,e.offset,e.byteLength)),nt(r,Uint8Array)&&(r=m.from(r,r.offset,r.byteLength)),!m.isBuffer(e)||!m.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};m.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}};m.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return m.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=m.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let s=e[n];if(nt(s,Uint8Array))o+s.length>i.length?(m.isBuffer(s)||(s=m.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(m.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function id(t,e){if(m.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||nt(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 Xa(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return hd(t).length;default:if(i)return n?-1:Xa(t).length;e=(""+e).toLowerCase(),i=!0}}m.byteLength=id;function Ww(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 tg(this,e,r);case"utf8":case"utf-8":return sd(this,e,r);case"ascii":return Jw(this,e,r);case"latin1":case"binary":return eg(this,e,r);case"base64":return Xw(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return rg(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}m.prototype._isBuffer=!0;function lr(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}m.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)lr(this,r,r+1);return this};m.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)lr(this,r,r+3),lr(this,r+1,r+2);return this};m.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)lr(this,r,r+7),lr(this,r+1,r+6),lr(this,r+2,r+5),lr(this,r+3,r+4);return this};m.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?sd(this,0,e):Ww.apply(this,arguments)};m.prototype.toLocaleString=m.prototype.toString;m.prototype.equals=function(e){if(!m.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:m.compare(this,e)===0};m.prototype.inspect=function(){let e="",r=Qr.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Ql&&(m.prototype[Ql]=m.prototype.inspect);m.prototype.compare=function(e,r,n,i,o){if(nt(e,Uint8Array)&&(e=m.from(e,e.offset,e.byteLength)),!m.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,u=Math.min(s,a),c=this.slice(i,o),f=e.slice(r,n);for(let l=0;l<u;++l)if(c[l]!==f[l]){s=c[l],a=f[l];break}return s<a?-1:a<s?1:0};function od(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,tu(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=m.from(e,n)),m.isBuffer(e))return e.length===0?-1:Jl(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):Jl(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Jl(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 u(f,l){return o===1?f[l]:f.readUInt16BE(l*o)}let c;if(i){let f=-1;for(c=r;c<s;c++)if(u(t,c)===u(e,f===-1?0:c-f)){if(f===-1&&(f=c),c-f+1===a)return f*o}else f!==-1&&(c-=c-f),f=-1}else for(r+a>s&&(r=s-a),c=r;c>=0;c--){let f=!0;for(let l=0;l<a;l++)if(u(t,c+l)!==u(e,l)){f=!1;break}if(f)return c}return-1}m.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};m.prototype.indexOf=function(e,r,n){return od(this,e,r,n,!0)};m.prototype.lastIndexOf=function(e,r,n){return od(this,e,r,n,!1)};function jw(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(tu(a))return s;t[r+s]=a}return s}function zw(t,e,r,n){return uo(Xa(e,t.length-r),t,r,n)}function Gw(t,e,r,n){return uo(sg(e),t,r,n)}function Yw(t,e,r,n){return uo(hd(e),t,r,n)}function Zw(t,e,r,n){return uo(ag(e,t.length-r),t,r,n)}m.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 jw(this,e,r,n);case"utf8":case"utf-8":return zw(this,e,r,n);case"ascii":case"latin1":case"binary":return Gw(this,e,r,n);case"base64":return Yw(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Zw(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};m.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Xw(t,e,r){return e===0&&r===t.length?Ga.fromByteArray(t):Ga.fromByteArray(t.slice(e,r))}function sd(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 u,c,f,l;switch(a){case 1:o<128&&(s=o);break;case 2:u=t[i+1],(u&192)===128&&(l=(o&31)<<6|u&63,l>127&&(s=l));break;case 3:u=t[i+1],c=t[i+2],(u&192)===128&&(c&192)===128&&(l=(o&15)<<12|(u&63)<<6|c&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:u=t[i+1],c=t[i+2],f=t[i+3],(u&192)===128&&(c&192)===128&&(f&192)===128&&(l=(o&15)<<18|(u&63)<<12|(c&63)<<6|f&63,l>65535&&l<1114112&&(s=l))}}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 Qw(n)}var ed=4096;function Qw(t){let e=t.length;if(e<=ed)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=ed));return r}function Jw(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 eg(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 tg(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+=ug[t[o]];return i}function rg(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}m.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,m.prototype),i};function we(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")}m.prototype.readUintLE=m.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||we(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return i};m.prototype.readUintBE=m.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||we(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};m.prototype.readUint8=m.prototype.readUInt8=function(e,r){return e=e>>>0,r||we(e,1,this.length),this[e]};m.prototype.readUint16LE=m.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||we(e,2,this.length),this[e]|this[e+1]<<8};m.prototype.readUint16BE=m.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||we(e,2,this.length),this[e]<<8|this[e+1]};m.prototype.readUint32LE=m.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||we(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};m.prototype.readUint32BE=m.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||we(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};m.prototype.readBigUInt64LE=Gt(function(e){e=e>>>0,Xr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(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))});m.prototype.readBigUInt64BE=Gt(function(e){e=e>>>0,Xr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(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)});m.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||we(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};m.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||we(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};m.prototype.readInt8=function(e,r){return e=e>>>0,r||we(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};m.prototype.readInt16LE=function(e,r){e=e>>>0,r||we(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};m.prototype.readInt16BE=function(e,r){e=e>>>0,r||we(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};m.prototype.readInt32LE=function(e,r){return e=e>>>0,r||we(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};m.prototype.readInt32BE=function(e,r){return e=e>>>0,r||we(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};m.prototype.readBigInt64LE=Gt(function(e){e=e>>>0,Xr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(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)});m.prototype.readBigInt64BE=Gt(function(e){e=e>>>0,Xr(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&Qn(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)});m.prototype.readFloatLE=function(e,r){return e=e>>>0,r||we(e,4,this.length),Zr.read(this,e,!0,23,4)};m.prototype.readFloatBE=function(e,r){return e=e>>>0,r||we(e,4,this.length),Zr.read(this,e,!1,23,4)};m.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||we(e,8,this.length),Zr.read(this,e,!0,52,8)};m.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||we(e,8,this.length),Zr.read(this,e,!1,52,8)};function Le(t,e,r,n,i,o){if(!m.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")}m.prototype.writeUintLE=m.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;Le(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};m.prototype.writeUintBE=m.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;Le(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};m.prototype.writeUint8=m.prototype.writeUInt8=function(e,r,n){return e=+e,r=r>>>0,n||Le(this,e,r,1,255,0),this[r]=e&255,r+1};m.prototype.writeUint16LE=m.prototype.writeUInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Le(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2};m.prototype.writeUint16BE=m.prototype.writeUInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Le(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2};m.prototype.writeUint32LE=m.prototype.writeUInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Le(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};m.prototype.writeUint32BE=m.prototype.writeUInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Le(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 ad(t,e,r,n,i){dd(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 ud(t,e,r,n,i){dd(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}m.prototype.writeBigUInt64LE=Gt(function(e,r=0){return ad(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});m.prototype.writeBigUInt64BE=Gt(function(e,r=0){return ud(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});m.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);Le(this,e,r,n,u-1,-u)}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};m.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let u=Math.pow(2,8*n-1);Le(this,e,r,n,u-1,-u)}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};m.prototype.writeInt8=function(e,r,n){return e=+e,r=r>>>0,n||Le(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1};m.prototype.writeInt16LE=function(e,r,n){return e=+e,r=r>>>0,n||Le(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2};m.prototype.writeInt16BE=function(e,r,n){return e=+e,r=r>>>0,n||Le(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2};m.prototype.writeInt32LE=function(e,r,n){return e=+e,r=r>>>0,n||Le(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};m.prototype.writeInt32BE=function(e,r,n){return e=+e,r=r>>>0,n||Le(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};m.prototype.writeBigInt64LE=Gt(function(e,r=0){return ad(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});m.prototype.writeBigInt64BE=Gt(function(e,r=0){return ud(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function cd(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 fd(t,e,r,n,i){return e=+e,r=r>>>0,i||cd(t,e,r,4,34028234663852886e22,-34028234663852886e22),Zr.write(t,e,r,n,23,4),r+4}m.prototype.writeFloatLE=function(e,r,n){return fd(this,e,r,!0,n)};m.prototype.writeFloatBE=function(e,r,n){return fd(this,e,r,!1,n)};function ld(t,e,r,n,i){return e=+e,r=r>>>0,i||cd(t,e,r,8,17976931348623157e292,-17976931348623157e292),Zr.write(t,e,r,n,52,8),r+8}m.prototype.writeDoubleLE=function(e,r,n){return ld(this,e,r,!0,n)};m.prototype.writeDoubleBE=function(e,r,n){return ld(this,e,r,!1,n)};m.prototype.copy=function(e,r,n,i){if(!m.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};m.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"&&!m.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=m.isBuffer(e)?e:m.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 Yr={};function eu(t,e,r){Yr[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}`}}}eu("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);eu("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);eu("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=td(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=td(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function td(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 ng(t,e,r){Xr(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&Qn(e,t.length-(r+1))}function dd(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 Yr.ERR_OUT_OF_RANGE("value",a,t)}ng(n,i,o)}function Xr(t,e){if(typeof t!="number")throw new Yr.ERR_INVALID_ARG_TYPE(e,"number",t)}function Qn(t,e,r){throw Math.floor(t)!==t?(Xr(t,r),new Yr.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new Yr.ERR_BUFFER_OUT_OF_BOUNDS:new Yr.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var ig=/[^+/0-9A-Za-z-_]/g;function og(t){if(t=t.split("=")[0],t=t.trim().replace(ig,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function Xa(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 sg(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function ag(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 hd(t){return Ga.toByteArray(og(t))}function uo(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 nt(t,e){return t instanceof e||t!=null&&t.constructor!=null&&t.constructor.name!=null&&t.constructor.name===e.name}function tu(t){return t!==t}var ug=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 Gt(t){return typeof BigInt>"u"?cg:t}function cg(){throw new Error("BigInt not supported")}});var X=K((Yv,pd)=>{"use strict";var ru=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}
3
+ `;super(r),this.name="AggregateError",this.errors=e}};pd.exports={AggregateError:ru,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 nu=K((Zv,yd)=>{"use strict";yd.exports={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"{}"}}}});var Ie=K((Xv,wd)=>{"use strict";var{format:fg,inspect:co}=nu(),{AggregateError:lg}=X(),dg=globalThis.AggregateError||lg,hg=Symbol("kIsNodeError"),pg=["string","function","number","object","Function","Object","boolean","bigint","symbol"],yg=/^([A-Z][a-z0-9]*)+$/,bg="__node_internal_",fo={};function dr(t,e){if(!t)throw new fo.ERR_INTERNAL_ASSERTION(e)}function bd(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 mg(t,e,r){if(typeof e=="function")return dr(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 dr(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:fg(e,...r)}function Ee(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(mg(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[hg]=!0,fo[t]=n}function md(t){let e=bg+t.name;return Object.defineProperty(t,"name",{value:e}),t}function wg(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new dg([e,t],e.message);return r.code=e.code,r}return t||e}var iu=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new fo.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Ee("ERR_ASSERTION","%s",Error);Ee("ERR_INVALID_ARG_TYPE",(t,e,r)=>{dr(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 u of e)dr(typeof u=="string","All expected entries have to be of type string"),pg.includes(u)?i.push(u.toLowerCase()):yg.test(u)?o.push(u):(dr(u!=="object",'The value "object" should be written as "Object"'),s.push(u));if(o.length>0){let u=i.indexOf("object");u!==-1&&(i.splice(i,u,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 u=i.pop();n+=`one of type ${i.join(", ")}, or ${u}`}}(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 u=o.pop();n+=`an instance of ${o.join(", ")}, or ${u}`}}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 u=s.pop();n+=`one of ${s.join(", ")}, or ${u}`}}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 u=co(r,{depth:-1});n+=`. Received ${u}`}}else{let u=co(r,{colors:!1});u.length>25&&(u=`${u.slice(0,25)}...`),n+=`. Received type ${typeof r} (${u})`}return n},TypeError);Ee("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=co(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Ee("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);Ee("ERR_MISSING_ARGS",(...t)=>{dr(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);Ee("ERR_OUT_OF_RANGE",(t,e,r)=>{dr(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=bd(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=bd(n)),n+="n"}else n=co(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Ee("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Ee("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Ee("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Ee("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Ee("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Ee("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Ee("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Ee("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Ee("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Ee("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Ee("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);wd.exports={AbortError:iu,aggregateTwoErrors:md(wg),hideStackFrames:md,codes:fo}});var Jr=K((Qv,lo)=>{"use strict";var{AbortController:gd,AbortSignal:gg}=typeof self<"u"?self:typeof window<"u"?window:void 0;lo.exports=gd;lo.exports.AbortSignal=gg;lo.exports.default=gd});var Jn=K((Jv,ou)=>{"use strict";var en=typeof Reflect=="object"?Reflect:null,xd=en&&typeof en.apply=="function"?en.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},ho;en&&typeof en.ownKeys=="function"?ho=en.ownKeys:Object.getOwnPropertySymbols?ho=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:ho=function(e){return Object.getOwnPropertyNames(e)};function xg(t){console&&console.warn&&console.warn(t)}var Sd=Number.isNaN||function(e){return e!==e};function z(){z.init.call(this)}ou.exports=z;ou.exports.once=Ag;z.EventEmitter=z;z.prototype._events=void 0;z.prototype._eventsCount=0;z.prototype._maxListeners=void 0;var Ed=10;function po(t){if(typeof t!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof t)}Object.defineProperty(z,"defaultMaxListeners",{enumerable:!0,get:function(){return Ed},set:function(t){if(typeof t!="number"||t<0||Sd(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Ed=t}});z.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};z.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||Sd(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 _d(t){return t._maxListeners===void 0?z.defaultMaxListeners:t._maxListeners}z.prototype.getMaxListeners=function(){return _d(this)};z.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 u=o[e];if(u===void 0)return!1;if(typeof u=="function")xd(u,this,r);else for(var c=u.length,f=Bd(u,c),n=0;n<c;++n)xd(f[n],this,r);return!0};function Ad(t,e,r,n){var i,o,s;if(po(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=_d(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,xg(a)}return t}z.prototype.addListener=function(e,r){return Ad(this,e,r,!1)};z.prototype.on=z.prototype.addListener;z.prototype.prependListener=function(e,r){return Ad(this,e,r,!0)};function Eg(){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 Id(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=Eg.bind(n);return i.listener=r,n.wrapFn=i,i}z.prototype.once=function(e,r){return po(r),this.on(e,Id(this,e,r)),this};z.prototype.prependOnceListener=function(e,r){return po(r),this.prependListener(e,Id(this,e,r)),this};z.prototype.removeListener=function(e,r){var n,i,o,s,a;if(po(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():Sg(n,o),n.length===1&&(i[e]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",e,a||r)}return this};z.prototype.off=z.prototype.removeListener;z.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 vd(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?_g(i):Bd(i,i.length)}z.prototype.listeners=function(e){return vd(this,e,!0)};z.prototype.rawListeners=function(e){return vd(this,e,!1)};z.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Td.call(t,e)};z.prototype.listenerCount=Td;function Td(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}z.prototype.eventNames=function(){return this._eventsCount>0?ho(this._events):[]};function Bd(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function Sg(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function _g(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function Ag(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))}Rd(t,e,o,{once:!0}),e!=="error"&&Ig(t,i,{once:!0})})}function Ig(t,e,r){typeof t.on=="function"&&Rd(t,"error",e,r)}function Rd(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 Re=K((eT,au)=>{"use strict";var vg=Ct(),{format:Tg,inspect:Bg}=nu(),{codes:{ERR_INVALID_ARG_TYPE:su}}=Ie(),{kResistStopPropagation:Rg,AggregateError:Cg,SymbolDispose:Dg}=X(),Lg=globalThis.AbortSignal||Jr().AbortSignal,Ng=globalThis.AbortController||Jr().AbortController,Pg=Object.getPrototypeOf(async function(){}).constructor,Cd=globalThis.Blob||vg.Blob,Og=typeof Cd<"u"?function(e){return e instanceof Cd}:function(e){return!1},Dd=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new su(e,"AbortSignal",t)},Ug=(t,e)=>{if(typeof t!="function")throw new su(e,"Function",t)};au.exports={AggregateError:Cg,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:Tg,inspect:Bg,types:{isAsyncFunction(t){return t instanceof Pg},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Og,deprecate(t,e){return t},addAbortListener:Jn().addAbortListener||function(e,r){if(e===void 0)throw new su("signal","AbortSignal",e);Dd(e,"signal"),Ug(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Rg]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Dg](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:Lg.any||function(e){if(e.length===1)return e[0];let r=new Ng,n=()=>r.abort();return e.forEach(i=>{Dd(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};au.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var rn=K((tT,Hd)=>{"use strict";var{ArrayIsArray:cu,ArrayPrototypeIncludes:Od,ArrayPrototypeJoin:Ud,ArrayPrototypeMap:kg,NumberIsInteger:fu,NumberIsNaN:Mg,NumberMAX_SAFE_INTEGER:Fg,NumberMIN_SAFE_INTEGER:qg,NumberParseInt:Hg,ObjectPrototypeHasOwnProperty:$g,RegExpPrototypeExec:kd,String:Kg,StringPrototypeToUpperCase:Vg,StringPrototypeTrim:Wg}=X(),{hideStackFrames:Ve,codes:{ERR_SOCKET_BAD_PORT:jg,ERR_INVALID_ARG_TYPE:ve,ERR_INVALID_ARG_VALUE:tn,ERR_OUT_OF_RANGE:hr,ERR_UNKNOWN_SIGNAL:Ld}}=Ie(),{normalizeEncoding:zg}=Re(),{isAsyncFunction:Gg,isArrayBufferView:Yg}=Re().types,Nd={};function Zg(t){return t===(t|0)}function Xg(t){return t===t>>>0}var Qg=/^[0-7]+$/,Jg="must be a 32-bit unsigned integer or an octal string";function ex(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(kd(Qg,t)===null)throw new tn(e,t,Jg);t=Hg(t,8)}return Md(t,e),t}var tx=Ve((t,e,r=qg,n=Fg)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!fu(t))throw new hr(e,"an integer",t);if(t<r||t>n)throw new hr(e,`>= ${r} && <= ${n}`,t)}),rx=Ve((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!fu(t))throw new hr(e,"an integer",t);if(t<r||t>n)throw new hr(e,`>= ${r} && <= ${n}`,t)}),Md=Ve((t,e,r=!1)=>{if(typeof t!="number")throw new ve(e,"number",t);if(!fu(t))throw new hr(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new hr(e,`>= ${n} && <= ${i}`,t)});function lu(t,e){if(typeof t!="string")throw new ve(e,"string",t)}function nx(t,e,r=void 0,n){if(typeof t!="number")throw new ve(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&Mg(t))throw new hr(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var ix=Ve((t,e,r)=>{if(!Od(r,t)){let i="must be one of: "+Ud(kg(r,o=>typeof o=="string"?`'${o}'`:Kg(o)),", ");throw new tn(e,t,i)}});function Fd(t,e){if(typeof t!="boolean")throw new ve(e,"boolean",t)}function uu(t,e,r){return t==null||!$g(t,e)?r:t[e]}var ox=Ve((t,e,r=null)=>{let n=uu(r,"allowArray",!1),i=uu(r,"allowFunction",!1);if(!uu(r,"nullable",!1)&&t===null||!n&&cu(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new ve(e,"Object",t)}),sx=Ve((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new ve(e,"a dictionary",t)}),yo=Ve((t,e,r=0)=>{if(!cu(t))throw new ve(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new tn(e,t,n)}});function ax(t,e){yo(t,e);for(let r=0;r<t.length;r++)lu(t[r],`${e}[${r}]`)}function ux(t,e){yo(t,e);for(let r=0;r<t.length;r++)Fd(t[r],`${e}[${r}]`)}function cx(t,e){yo(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new ve(i,"AbortSignal",n);qd(n,i)}}function fx(t,e="signal"){if(lu(t,e),Nd[t]===void 0)throw Nd[Vg(t)]!==void 0?new Ld(t+" (signals must use all capital letters)"):new Ld(t)}var lx=Ve((t,e="buffer")=>{if(!Yg(t))throw new ve(e,["Buffer","TypedArray","DataView"],t)});function dx(t,e){let r=zg(e),n=t.length;if(r==="hex"&&n%2!==0)throw new tn("encoding",e,`is invalid for data of length ${n}`)}function hx(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&Wg(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new jg(e,t,r);return t|0}var qd=Ve((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new ve(e,"AbortSignal",t)}),px=Ve((t,e)=>{if(typeof t!="function")throw new ve(e,"Function",t)}),yx=Ve((t,e)=>{if(typeof t!="function"||Gg(t))throw new ve(e,"Function",t)}),bx=Ve((t,e)=>{if(t!==void 0)throw new ve(e,"undefined",t)});function mx(t,e,r){if(!Od(r,t))throw new ve(e,`('${Ud(r,"|")}')`,t)}var wx=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function Pd(t,e){if(typeof t>"u"||!kd(wx,t))throw new tn(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function gx(t){if(typeof t=="string")return Pd(t,"hints"),t;if(cu(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];Pd(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new tn("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Hd.exports={isInt32:Zg,isUint32:Xg,parseFileMode:ex,validateArray:yo,validateStringArray:ax,validateBooleanArray:ux,validateAbortSignalArray:cx,validateBoolean:Fd,validateBuffer:lx,validateDictionary:sx,validateEncoding:dx,validateFunction:px,validateInt32:rx,validateInteger:tx,validateNumber:nx,validateObject:ox,validateOneOf:ix,validatePlainFunction:yx,validatePort:hx,validateSignalName:fx,validateString:lu,validateUint32:Md,validateUndefined:bx,validateUnion:mx,validateAbortSignal:qd,validateLinkHeaderValue:gx}});var Yt=K((rT,Wd)=>{var ae=Wd.exports={},it,ot;function du(){throw new Error("setTimeout has not been defined")}function hu(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?it=setTimeout:it=du}catch{it=du}try{typeof clearTimeout=="function"?ot=clearTimeout:ot=hu}catch{ot=hu}})();function $d(t){if(it===setTimeout)return setTimeout(t,0);if((it===du||!it)&&setTimeout)return it=setTimeout,setTimeout(t,0);try{return it(t,0)}catch{try{return it.call(null,t,0)}catch{return it.call(this,t,0)}}}function xx(t){if(ot===clearTimeout)return clearTimeout(t);if((ot===hu||!ot)&&clearTimeout)return ot=clearTimeout,clearTimeout(t);try{return ot(t)}catch{try{return ot.call(null,t)}catch{return ot.call(this,t)}}}var Dt=[],nn=!1,pr,bo=-1;function Ex(){!nn||!pr||(nn=!1,pr.length?Dt=pr.concat(Dt):bo=-1,Dt.length&&Kd())}function Kd(){if(!nn){var t=$d(Ex);nn=!0;for(var e=Dt.length;e;){for(pr=Dt,Dt=[];++bo<e;)pr&&pr[bo].run();bo=-1,e=Dt.length}pr=null,nn=!1,xx(t)}}ae.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];Dt.push(new Vd(t,e)),Dt.length===1&&!nn&&$d(Kd)};function Vd(t,e){this.fun=t,this.array=e}Vd.prototype.run=function(){this.fun.apply(null,this.array)};ae.title="browser";ae.browser=!0;ae.env={};ae.argv=[];ae.version="";ae.versions={};function Lt(){}ae.on=Lt;ae.addListener=Lt;ae.once=Lt;ae.off=Lt;ae.removeListener=Lt;ae.removeAllListeners=Lt;ae.emit=Lt;ae.prependListener=Lt;ae.prependOnceListener=Lt;ae.listeners=function(t){return[]};ae.binding=function(t){throw new Error("process.binding is not supported")};ae.cwd=function(){return"/"};ae.chdir=function(t){throw new Error("process.chdir is not supported")};ae.umask=function(){return 0}});var at=K((nT,sh)=>{"use strict";var{SymbolAsyncIterator:jd,SymbolIterator:zd,SymbolFor:yr}=X(),Gd=yr("nodejs.stream.destroyed"),Yd=yr("nodejs.stream.errored"),pu=yr("nodejs.stream.readable"),yu=yr("nodejs.stream.writable"),Zd=yr("nodejs.stream.disturbed"),Sx=yr("nodejs.webstream.isClosedPromise"),_x=yr("nodejs.webstream.controllerErrorFunction");function mo(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 wo(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 Ax(t){return!!(t&&typeof t.pipe=="function"&&t._readableState&&typeof t.on=="function"&&typeof t.write=="function")}function st(t){return t&&(t._readableState||t._writableState||typeof t.write=="function"&&typeof t.on=="function"||typeof t.pipe=="function"&&typeof t.on=="function")}function Xd(t){return!!(t&&!st(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Qd(t){return!!(t&&!st(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Jd(t){return!!(t&&!st(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function Ix(t){return Xd(t)||Qd(t)||Jd(t)}function vx(t,e){return t==null?!1:e===!0?typeof t[jd]=="function":e===!1?typeof t[zd]=="function":typeof t[jd]=="function"||typeof t[zd]=="function"}function go(t){if(!st(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Gd]||n!=null&&n.destroyed)}function eh(t){if(!wo(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 Tx(t,e){if(!wo(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 Bx(t){if(!mo(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 th(t,e){if(!mo(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 rh(t){return t&&t[pu]!=null?t[pu]:typeof t?.readable!="boolean"?null:go(t)?!1:mo(t)&&t.readable&&!th(t)}function nh(t){return t&&t[yu]!=null?t[yu]:typeof t?.writable!="boolean"?null:go(t)?!1:wo(t)&&t.writable&&!eh(t)}function Rx(t,e){return st(t)?go(t)?!0:!(e?.readable!==!1&&rh(t)||e?.writable!==!1&&nh(t)):null}function Cx(t){var e,r;return st(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 Dx(t){var e,r;return st(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 Lx(t){if(!st(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"&&ih(t)?t._closed:null}function ih(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function oh(t){return typeof t._sent100=="boolean"&&ih(t)}function Nx(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 Px(t){if(!st(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&oh(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Ox(t){var e;return!!(t&&((e=t[Zd])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Ux(t){var e,r,n,i,o,s,a,u,c,f;return!!(t&&((e=(r=(n=(i=(o=(s=t[Yd])!==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:(u=t._writableState)===null||u===void 0?void 0:u.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((f=t._writableState)===null||f===void 0)&&f.errored))}sh.exports={isDestroyed:go,kIsDestroyed:Gd,isDisturbed:Ox,kIsDisturbed:Zd,isErrored:Ux,kIsErrored:Yd,isReadable:rh,kIsReadable:pu,kIsClosedPromise:Sx,kControllerErrorFunction:_x,kIsWritable:yu,isClosed:Lx,isDuplexNodeStream:Ax,isFinished:Rx,isIterable:vx,isReadableNodeStream:mo,isReadableStream:Xd,isReadableEnded:Bx,isReadableFinished:th,isReadableErrored:Dx,isNodeStream:st,isWebStream:Ix,isWritable:nh,isWritableNodeStream:wo,isWritableStream:Qd,isWritableEnded:eh,isWritableFinished:Tx,isWritableErrored:Cx,isServerRequest:Nx,isServerResponse:oh,willEmitClose:Px,isTransformStream:Jd}});var Nt=K((iT,xu)=>{"use strict";var Zt=Yt(),{AbortError:yh,codes:kx}=Ie(),{ERR_INVALID_ARG_TYPE:Mx,ERR_STREAM_PREMATURE_CLOSE:ah}=kx,{kEmptyObject:mu,once:wu}=Re(),{validateAbortSignal:Fx,validateFunction:qx,validateObject:Hx,validateBoolean:$x}=rn(),{Promise:Kx,PromisePrototypeThen:Vx,SymbolDispose:bh}=X(),{isClosed:Wx,isReadable:uh,isReadableNodeStream:bu,isReadableStream:jx,isReadableFinished:ch,isReadableErrored:fh,isWritable:lh,isWritableNodeStream:dh,isWritableStream:zx,isWritableFinished:hh,isWritableErrored:ph,isNodeStream:Gx,willEmitClose:Yx,kIsClosedPromise:Zx}=at(),on;function Xx(t){return t.setHeader&&typeof t.abort=="function"}var gu=()=>{};function mh(t,e,r){var n,i;if(arguments.length===2?(r=e,e=mu):e==null?e=mu:Hx(e,"options"),qx(r,"callback"),Fx(e.signal,"options.signal"),r=wu(r),jx(t)||zx(t))return Qx(t,e,r);if(!Gx(t))throw new Mx("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:bu(t),s=(i=e.writable)!==null&&i!==void 0?i:dh(t),a=t._writableState,u=t._readableState,c=()=>{t.writable||d()},f=Yx(t)&&bu(t)===o&&dh(t)===s,l=hh(t,!1),d=()=>{l=!0,t.destroyed&&(f=!1),!(f&&(!t.readable||o))&&(!o||h)&&r.call(t)},h=ch(t,!1),p=()=>{h=!0,t.destroyed&&(f=!1),!(f&&(!t.writable||s))&&(!s||l)&&r.call(t)},y=T=>{r.call(t,T)},_=Wx(t),b=()=>{_=!0;let T=ph(t)||fh(t);if(T&&typeof T!="boolean")return r.call(t,T);if(o&&!h&&bu(t,!0)&&!ch(t,!1))return r.call(t,new ah);if(s&&!l&&!hh(t,!1))return r.call(t,new ah);r.call(t)},A=()=>{_=!0;let T=ph(t)||fh(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},w=()=>{t.req.on("finish",d)};Xx(t)?(t.on("complete",d),f||t.on("abort",b),t.req?w():t.on("request",w)):s&&!a&&(t.on("end",c),t.on("close",c)),!f&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",p),t.on("finish",d),e.error!==!1&&t.on("error",y),t.on("close",b),_?Zt.nextTick(b):a!=null&&a.errorEmitted||u!=null&&u.errorEmitted?f||Zt.nextTick(A):(!o&&(!f||uh(t))&&(l||lh(t)===!1)||!s&&(!f||lh(t))&&(h||uh(t)===!1)||u&&t.req&&t.aborted)&&Zt.nextTick(A);let I=()=>{r=gu,t.removeListener("aborted",b),t.removeListener("complete",d),t.removeListener("abort",b),t.removeListener("request",w),t.req&&t.req.removeListener("finish",d),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",d),t.removeListener("end",p),t.removeListener("error",y),t.removeListener("close",b)};if(e.signal&&!_){let T=()=>{let F=r;I(),F.call(t,new yh(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Zt.nextTick(T);else{on=on||Re().addAbortListener;let F=on(e.signal,T),U=r;r=wu((...P)=>{F[bh](),U.apply(t,P)})}}return I}function Qx(t,e,r){let n=!1,i=gu;if(e.signal)if(i=()=>{n=!0,r.call(t,new yh(void 0,{cause:e.signal.reason}))},e.signal.aborted)Zt.nextTick(i);else{on=on||Re().addAbortListener;let s=on(e.signal,i),a=r;r=wu((...u)=>{s[bh](),a.apply(t,u)})}let o=(...s)=>{n||Zt.nextTick(()=>r.apply(t,s))};return Vx(t[Zx].promise,o,o),gu}function Jx(t,e){var r;let n=!1;return e===null&&(e=mu),(r=e)!==null&&r!==void 0&&r.cleanup&&($x(e.cleanup,"cleanup"),n=e.cleanup),new Kx((i,o)=>{let s=mh(t,e,a=>{n&&s(),a?o(a):i()})})}xu.exports=mh;xu.exports.finished=Jx});var br=K((oT,Ih)=>{"use strict";var ut=Yt(),{aggregateTwoErrors:eE,codes:{ERR_MULTIPLE_CALLBACK:tE},AbortError:rE}=Ie(),{Symbol:xh}=X(),{kIsDestroyed:nE,isDestroyed:iE,isFinished:oE,isServerRequest:sE}=at(),Eh=xh("kDestroy"),Eu=xh("kConstruct");function Sh(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function aE(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):(Sh(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?wh(this,t,e):this.once(Eh,function(o){wh(this,eE(o,t),e)}),this)}function wh(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;Sh(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?ut.nextTick(uE,t,o):ut.nextTick(_h,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function uE(t,e){Su(t,e),_h(t)}function _h(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 Su(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 cE(){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 _u(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?ut.nextTick(Su,t,e):Su(t,e))}function fE(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(Eu,e),!(t.listenerCount(Eu)>1)&&ut.nextTick(lE,t)}function lE(t){let e=!1;function r(n){if(e){_u(t,n??new tE);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(Eh,n):n?_u(t,n,!0):ut.nextTick(dE,t)}try{t._construct(n=>{ut.nextTick(r,n)})}catch(n){ut.nextTick(r,n)}}function dE(t){t.emit(Eu)}function gh(t){return t?.setHeader&&typeof t.abort=="function"}function Ah(t){t.emit("close")}function hE(t,e){t.emit("error",e),ut.nextTick(Ah,t)}function pE(t,e){!t||iE(t)||(!e&&!oE(t)&&(e=new rE),sE(t)?(t.socket=null,t.destroy(e)):gh(t)?t.abort():gh(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ut.nextTick(hE,t,e):ut.nextTick(Ah,t),t.destroyed||(t[nE]=!0))}Ih.exports={construct:fE,destroyer:pE,destroy:aE,undestroy:cE,errorOrDestroy:_u}});var So=K((sT,Th)=>{"use strict";var{ArrayIsArray:yE,ObjectSetPrototypeOf:vh}=X(),{EventEmitter:xo}=Jn();function Eo(t){xo.call(this,t)}vh(Eo.prototype,xo.prototype);vh(Eo,xo);Eo.prototype.pipe=function(t,e){let r=this;function n(f){t.writable&&t.write(f)===!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 u(f){c(),xo.listenerCount(this,"error")===0&&this.emit("error",f)}Au(r,"error",u),Au(t,"error",u);function c(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",u),t.removeListener("error",u),r.removeListener("end",c),r.removeListener("close",c),t.removeListener("close",c)}return r.on("end",c),r.on("close",c),t.on("close",c),t.emit("pipe",r),t};function Au(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):yE(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Th.exports={Stream:Eo,prependListener:Au}});var ei=K((aT,_o)=>{"use strict";var{SymbolDispose:bE}=X(),{AbortError:Bh,codes:mE}=Ie(),{isNodeStream:Rh,isWebStream:wE,kControllerErrorFunction:gE}=at(),xE=Nt(),{ERR_INVALID_ARG_TYPE:Ch}=mE,Iu,EE=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Ch(e,"AbortSignal",t)};_o.exports.addAbortSignal=function(e,r){if(EE(e,"signal"),!Rh(r)&&!wE(r))throw new Ch("stream",["ReadableStream","WritableStream","Stream"],r);return _o.exports.addAbortSignalNoValidate(e,r)};_o.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Rh(e)?()=>{e.destroy(new Bh(void 0,{cause:t.reason}))}:()=>{e[gE](new Bh(void 0,{cause:t.reason}))};if(t.aborted)r();else{Iu=Iu||Re().addAbortListener;let n=Iu(t,r);xE(e,n[bE])}return e}});var Nh=K((cT,Lh)=>{"use strict";var{StringPrototypeSlice:Dh,SymbolIterator:SE,TypedArrayPrototypeSet:Ao,Uint8Array:_E}=X(),{Buffer:vu}=Ct(),{inspect:AE}=Re();Lh.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 vu.alloc(0);let r=vu.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)Ao(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}*[SE](){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+=Dh(o,0,e),this.head=n,n.data=Dh(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=vu.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)Ao(r,s,n-e),e-=s.length;else{e===s.length?(Ao(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(Ao(r,new _E(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 AE(this,{...r,depth:0,customInspect:!1})}}});var ti=K((fT,kh)=>{"use strict";var{MathFloor:IE,NumberIsInteger:vE}=X(),{validateInteger:TE}=rn(),{ERR_INVALID_ARG_VALUE:BE}=Ie().codes,Ph=16*1024,Oh=16;function RE(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function Uh(t){return t?Oh:Ph}function CE(t,e){TE(e,"value",0),t?Oh=e:Ph=e}function DE(t,e,r,n){let i=RE(e,n,r);if(i!=null){if(!vE(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new BE(o,i)}return IE(i)}return Uh(t.objectMode)}kh.exports={getHighWaterMark:DE,getDefaultHighWaterMark:Uh,setDefaultHighWaterMark:CE}});var qh=K((Tu,Fh)=>{var Io=Ct(),ct=Io.Buffer;function Mh(t,e){for(var r in t)e[r]=t[r]}ct.from&&ct.alloc&&ct.allocUnsafe&&ct.allocUnsafeSlow?Fh.exports=Io:(Mh(Io,Tu),Tu.Buffer=mr);function mr(t,e,r){return ct(t,e,r)}mr.prototype=Object.create(ct.prototype);Mh(ct,mr);mr.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ct(t,e,r)};mr.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ct(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};mr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ct(t)};mr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Io.SlowBuffer(t)}});var Kh=K($h=>{"use strict";var Ru=qh().Buffer,Hh=Ru.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 LE(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 NE(t){var e=LE(t);if(typeof e!="string"&&(Ru.isEncoding===Hh||!Hh(t)))throw new Error("Unknown encoding: "+t);return e||t}$h.StringDecoder=ri;function ri(t){this.encoding=NE(t);var e;switch(this.encoding){case"utf16le":this.text=FE,this.end=qE,e=4;break;case"utf8":this.fillLast=UE,e=4;break;case"base64":this.text=HE,this.end=$E,e=3;break;default:this.write=KE,this.end=VE;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Ru.allocUnsafe(e)}ri.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||""};ri.prototype.end=ME;ri.prototype.text=kE;ri.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 Bu(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function PE(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Bu(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Bu(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Bu(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function OE(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 UE(t){var e=this.lastTotal-this.lastNeed,r=OE(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 kE(t,e){var r=PE(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 ME(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function FE(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 qE(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 HE(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 $E(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function KE(t){return t.toString(this.encoding)}function VE(t){return t&&t.length?this.write(t):""}});var Cu=K((dT,zh)=>{"use strict";var Vh=Yt(),{PromisePrototypeThen:WE,SymbolAsyncIterator:Wh,SymbolIterator:jh}=X(),{Buffer:jE}=Ct(),{ERR_INVALID_ARG_TYPE:zE,ERR_STREAM_NULL_VALUES:GE}=Ie().codes;function YE(t,e,r){let n;if(typeof e=="string"||e instanceof jE)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[Wh])i=!0,n=e[Wh]();else if(e&&e[jh])i=!1,n=e[jh]();else throw new zE("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,u())},o._destroy=function(c,f){WE(a(c),()=>Vh.nextTick(f,c),l=>Vh.nextTick(f,l||c))};async function a(c){let f=c!=null,l=typeof n.throw=="function";if(f&&l){let{value:d,done:h}=await n.throw(c);if(await d,h)return}if(typeof n.return=="function"){let{value:d}=await n.return();await d}}async function u(){for(;;){try{let{value:c,done:f}=i?await n.next():n.next();if(f)o.push(null);else{let l=c&&typeof c.then=="function"?await c:c;if(l===null)throw s=!1,new GE;if(o.push(l))continue;s=!1}}catch(c){o.destroy(c)}break}}return o}zh.exports=YE});var ii=K((hT,lp)=>{"use strict";var Qe=Yt(),{ArrayPrototypeIndexOf:ZE,NumberIsInteger:XE,NumberIsNaN:QE,NumberParseInt:JE,ObjectDefineProperties:Mu,ObjectKeys:e1,ObjectSetPrototypeOf:Zh,Promise:Xh,SafeSet:t1,SymbolAsyncDispose:r1,SymbolAsyncIterator:n1,Symbol:i1}=X();lp.exports=H;H.ReadableState=Ro;var{EventEmitter:o1}=Jn(),{Stream:Xt,prependListener:s1}=So(),{Buffer:Du}=Ct(),{addAbortSignal:a1}=ei(),Qh=Nt(),$=Re().debuglog("stream",t=>{$=t}),u1=Nh(),un=br(),{getHighWaterMark:c1,getDefaultHighWaterMark:f1}=ti(),{aggregateTwoErrors:Gh,codes:{ERR_INVALID_ARG_TYPE:l1,ERR_METHOD_NOT_IMPLEMENTED:d1,ERR_OUT_OF_RANGE:h1,ERR_STREAM_PUSH_AFTER_EOF:p1,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:y1},AbortError:b1}=Ie(),{validateObject:m1}=rn(),wr=i1("kPaused"),{StringDecoder:Jh}=Kh(),w1=Cu();Zh(H.prototype,Xt.prototype);Zh(H,Xt);var Lu=()=>{},{errorOrDestroy:sn}=un,an=1,g1=2,ep=4,ni=8,tp=16,vo=32,To=64,rp=128,x1=256,E1=512,S1=1024,Uu=2048,ku=4096,_1=8192,A1=16384,I1=32768,np=65536,v1=1<<17,T1=1<<18;function de(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}Mu(Ro.prototype,{objectMode:de(an),ended:de(g1),endEmitted:de(ep),reading:de(ni),constructed:de(tp),sync:de(vo),needReadable:de(To),emittedReadable:de(rp),readableListening:de(x1),resumeScheduled:de(E1),errorEmitted:de(S1),emitClose:de(Uu),autoDestroy:de(ku),destroyed:de(_1),closed:de(A1),closeEmitted:de(I1),multiAwaitDrain:de(np),readingMore:de(v1),dataEmitted:de(T1)});function Ro(t,e,r){typeof r!="boolean"&&(r=e instanceof ft()),this.state=Uu|ku|tp|vo,t&&t.objectMode&&(this.state|=an),r&&t&&t.readableObjectMode&&(this.state|=an),this.highWaterMark=t?c1(this,t,"readableHighWaterMark",r):f1(!1),this.buffer=new u1,this.length=0,this.pipes=[],this.flowing=null,this[wr]=null,t&&t.emitClose===!1&&(this.state&=~Uu),t&&t.autoDestroy===!1&&(this.state&=~ku),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new Jh(t.encoding),this.encoding=t.encoding)}function H(t){if(!(this instanceof H))return new H(t);let e=this instanceof ft();this._readableState=new Ro(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&&a1(t.signal,this)),Xt.call(this,t),un.construct(this,()=>{this._readableState.needReadable&&Bo(this,this._readableState)})}H.prototype.destroy=un.destroy;H.prototype._undestroy=un.undestroy;H.prototype._destroy=function(t,e){e(t)};H.prototype[o1.captureRejectionSymbol]=function(t){this.destroy(t)};H.prototype[r1]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new b1,this.destroy(t)),new Xh((e,r)=>Qh(this,n=>n&&n!==t?r(n):e(null)))};H.prototype.push=function(t,e){return ip(this,t,e,!1)};H.prototype.unshift=function(t,e){return ip(this,t,e,!0)};function ip(t,e,r,n){$("readableAddChunk",e);let i=t._readableState,o;if((i.state&an)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Du.from(e,r).toString(i.encoding):(e=Du.from(e,r),r=""))):e instanceof Du?r="":Xt._isUint8Array(e)?(e=Xt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new l1("chunk",["string","Buffer","Uint8Array"],e))),o)sn(t,o);else if(e===null)i.state&=~ni,C1(t,i);else if((i.state&an)!==0||e&&e.length>0)if(n)if((i.state&ep)!==0)sn(t,new y1);else{if(i.destroyed||i.errored)return!1;Nu(t,i,e,!0)}else if(i.ended)sn(t,new p1);else{if(i.destroyed||i.errored)return!1;i.state&=~ni,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Nu(t,i,e,!1):Bo(t,i)):Nu(t,i,e,!1)}else n||(i.state&=~ni,Bo(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Nu(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&np)!==0?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&To)!==0&&Co(t)),Bo(t,e)}H.prototype.isPaused=function(){let t=this._readableState;return t[wr]===!0||t.flowing===!1};H.prototype.setEncoding=function(t){let e=new Jh(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 B1=1073741824;function R1(t){if(t>B1)throw new h1("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Yh(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&an)!==0?1:QE(t)?e.flowing&&e.length?e.buffer.first().length:e.length:t<=e.length?t:e.ended?e.length:0}H.prototype.read=function(t){$("read",t),t===void 0?t=NaN:XE(t)||(t=JE(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=R1(t)),t!==0&&(e.state&=~rp),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return $("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Pu(this):Co(this),null;if(t=Yh(t,e),t===0&&e.ended)return e.length===0&&Pu(this),null;let n=(e.state&To)!==0;if($("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,$("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,$("reading, ended or constructing",n);else if(n){$("do read"),e.state|=ni|vo,e.length===0&&(e.state|=To);try{this._read(e.highWaterMark)}catch(o){sn(this,o)}e.state&=~vo,e.reading||(t=Yh(r,e))}let i;return t>0?i=cp(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&&Pu(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function C1(t,e){if($("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?Co(t):(e.needReadable=!1,e.emittedReadable=!0,op(t))}}function Co(t){let e=t._readableState;$("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||($("emitReadable",e.flowing),e.emittedReadable=!0,Qe.nextTick(op,t))}function op(t){let e=t._readableState;$("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,ap(t)}function Bo(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Qe.nextTick(D1,t,e))}function D1(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if($("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}H.prototype._read=function(t){throw new d1("_read()")};H.prototype.pipe=function(t,e){let r=this,n=this._readableState;n.pipes.length===1&&(n.multiAwaitDrain||(n.multiAwaitDrain=!0,n.awaitDrainWriters=new t1(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),$("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Qe.stdout&&t!==Qe.stderr?a:_;n.endEmitted?Qe.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(b,A){$("onunpipe"),b===r&&A&&A.hasUnpiped===!1&&(A.hasUnpiped=!0,f())}function a(){$("onend"),t.end()}let u,c=!1;function f(){$("cleanup"),t.removeListener("close",p),t.removeListener("finish",y),u&&t.removeListener("drain",u),t.removeListener("error",h),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",_),r.removeListener("data",d),c=!0,u&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&u()}function l(){c||(n.pipes.length===1&&n.pipes[0]===t?($("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&($("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),u||(u=L1(r,t),t.on("drain",u))}r.on("data",d);function d(b){$("ondata");let A=t.write(b);$("dest.write",A),A===!1&&l()}function h(b){if($("onerror",b),_(),t.removeListener("error",h),t.listenerCount("error")===0){let A=t._writableState||t._readableState;A&&!A.errorEmitted?sn(t,b):t.emit("error",b)}}s1(t,"error",h);function p(){t.removeListener("finish",y),_()}t.once("close",p);function y(){$("onfinish"),t.removeListener("close",p),_()}t.once("finish",y);function _(){$("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?l():n.flowing||($("pipe resume"),r.resume()),t};function L1(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?($("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&($("pipeOnDrain",n.awaitDrainWriters.size),n.awaitDrainWriters.delete(e)),(!n.awaitDrainWriters||n.awaitDrainWriters.size===0)&&t.listenerCount("data")&&t.resume()}}H.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=ZE(e.pipes,t);return n===-1?this:(e.pipes.splice(n,1),e.pipes.length===0&&this.pause(),t.emit("unpipe",this,r),this)};H.prototype.on=function(t,e){let r=Xt.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,$("on readable",n.length,n.reading),n.length?Co(this):n.reading||Qe.nextTick(N1,this)),r};H.prototype.addListener=H.prototype.on;H.prototype.removeListener=function(t,e){let r=Xt.prototype.removeListener.call(this,t,e);return t==="readable"&&Qe.nextTick(sp,this),r};H.prototype.off=H.prototype.removeListener;H.prototype.removeAllListeners=function(t){let e=Xt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Qe.nextTick(sp,this),e};function sp(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[wr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function N1(t){$("readable nexttick read 0"),t.read(0)}H.prototype.resume=function(){let t=this._readableState;return t.flowing||($("resume"),t.flowing=!t.readableListening,P1(this,t)),t[wr]=!1,this};function P1(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Qe.nextTick(O1,t,e))}function O1(t,e){$("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),ap(t),e.flowing&&!e.reading&&t.read(0)}H.prototype.pause=function(){return $("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&($("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[wr]=!0,this};function ap(t){let e=t._readableState;for($("flow",e.flowing);e.flowing&&t.read()!==null;);}H.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=>{sn(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=e1(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};H.prototype[n1]=function(){return up(this)};H.prototype.iterator=function(t){return t!==void 0&&m1(t,"options"),up(this,t)};function up(t,e){typeof t.read!="function"&&(t=H.wrap(t,{objectMode:!0}));let r=U1(t,e);return r.stream=t,r}async function*U1(t,e){let r=Lu;function n(s){this===t?(r(),r=Lu):r=s}t.on("readable",n);let i,o=Qh(t,{writable:!1},s=>{i=s?Gh(i,s):null,r(),r=Lu});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 Xh(n)}}}catch(s){throw i=Gh(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?un.destroyer(t,null):(t.off("readable",n),o())}}Mu(H.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}}});Mu(Ro.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[wr]!==!1},set(t){this[wr]=!!t}}});H._fromList=cp;function cp(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 Pu(t){let e=t._readableState;$("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Qe.nextTick(k1,e,t))}function k1(t,e){if($("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)Qe.nextTick(M1,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function M1(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}H.from=function(t,e){return w1(H,t,e)};var Ou;function fp(){return Ou===void 0&&(Ou={}),Ou}H.fromWeb=function(t,e){return fp().newStreamReadableFromReadableStream(t,e)};H.toWeb=function(t,e){return fp().newReadableStreamFromStreamReadable(t,e)};H.wrap=function(t,e){var r,n;return new H({objectMode:(r=(n=t.readableObjectMode)!==null&&n!==void 0?n:t.objectMode)!==null&&r!==void 0?r:!0,...e,destroy(i,o){un.destroyer(t,i),o(i)}}).wrap(t)}});var Oo=K((pT,_p)=>{"use strict";var gr=Yt(),{ArrayPrototypeSlice:pp,Error:F1,FunctionPrototypeSymbolHasInstance:yp,ObjectDefineProperty:bp,ObjectDefineProperties:q1,ObjectSetPrototypeOf:mp,StringPrototypeToLowerCase:H1,Symbol:$1,SymbolHasInstance:K1}=X();_p.exports=ee;ee.WritableState=ai;var{EventEmitter:V1}=Jn(),oi=So().Stream,{Buffer:Do}=Ct(),Po=br(),{addAbortSignal:W1}=ei(),{getHighWaterMark:j1,getDefaultHighWaterMark:z1}=ti(),{ERR_INVALID_ARG_TYPE:G1,ERR_METHOD_NOT_IMPLEMENTED:Y1,ERR_MULTIPLE_CALLBACK:wp,ERR_STREAM_CANNOT_PIPE:Z1,ERR_STREAM_DESTROYED:si,ERR_STREAM_ALREADY_FINISHED:X1,ERR_STREAM_NULL_VALUES:Q1,ERR_STREAM_WRITE_AFTER_END:J1,ERR_UNKNOWN_ENCODING:gp}=Ie().codes,{errorOrDestroy:cn}=Po;mp(ee.prototype,oi.prototype);mp(ee,oi);function Hu(){}var fn=$1("kOnFinished");function ai(t,e,r){typeof r!="boolean"&&(r=e instanceof ft()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?j1(this,t,"writableHighWaterMark",r):z1(!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=t2.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,No(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[fn]=[]}function No(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}ai.prototype.getBuffer=function(){return pp(this.buffered,this.bufferedIndex)};bp(ai.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function ee(t){let e=this instanceof ft();if(!e&&!yp(ee,this))return new ee(t);this._writableState=new ai(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&&W1(t.signal,this)),oi.call(this,t),Po.construct(this,()=>{let r=this._writableState;r.writing||Ku(this,r),Vu(this,r)})}bp(ee,K1,{__proto__:null,value:function(t){return yp(this,t)?!0:this!==ee?!1:t&&t._writableState instanceof ai}});ee.prototype.pipe=function(){cn(this,new Z1)};function xp(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"&&!Do.isEncoding(r))throw new gp(r);typeof n!="function"&&(n=Hu)}if(e===null)throw new Q1;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=Do.from(e,r),r="buffer");else if(e instanceof Do)r="buffer";else if(oi._isUint8Array(e))e=oi._uint8ArrayToBuffer(e),r="buffer";else throw new G1("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new J1:i.destroyed&&(o=new si("write")),o?(gr.nextTick(n,o),cn(t,o,!0),o):(i.pendingcb++,e2(t,i,e,r,n))}ee.prototype.write=function(t,e,r){return xp(this,t,e,r)===!0};ee.prototype.cork=function(){this._writableState.corked++};ee.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Ku(this,t))};ee.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=H1(e)),!Do.isEncoding(e))throw new gp(e);return this._writableState.defaultEncoding=e,this};function e2(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!==Hu&&(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 dp(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new si("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function hp(t,e,r,n){--e.pendingcb,n(r),$u(e),cn(t,r)}function t2(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){cn(t,new wp);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?gr.nextTick(hp,t,r,e,i):hp(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Ku(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},gr.nextTick(r2,r.afterWriteTickInfo)):Ep(t,r,1,i))}function r2({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Ep(t,e,r,n)}function Ep(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&&$u(e),Vu(t,e)}function $u(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 si("write"))}let r=t[fn].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new si("end"))}No(t)}function Ku(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?Hu:c=>{for(let f=s;f<r.length;++f)r[f].callback(c)},u=e.allNoop&&s===0?r:pp(r,s);u.allBuffers=e.allBuffers,dp(t,e,!0,e.length,u,"",a),No(e)}else{do{let{chunk:a,encoding:u,callback:c}=r[s];r[s++]=null;let f=i?1:a.length;dp(t,e,!1,f,a,u,c)}while(s<r.length&&!e.writing);s===r.length?No(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}ee.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Y1("_write()")};ee.prototype._writev=null;ee.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=xp(this,t,e);o instanceof F1&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Vu(this,n,!0),n.ended=!0):n.finished?i=new X1("end"):n.destroyed&&(i=new si("end"))),typeof r=="function"&&(i||n.finished?gr.nextTick(r,i):n[fn].push(r)),this};function Lo(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 n2(t,e){let r=!1;function n(i){if(r){cn(t,i??wp());return}if(r=!0,e.pendingcb--,i){let o=e[fn].splice(0);for(let s=0;s<o.length;s++)o[s](i);cn(t,i,e.sync)}else Lo(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,gr.nextTick(qu,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function i2(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,n2(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Vu(t,e,r){Lo(e)&&(i2(t,e),e.pendingcb===0&&(r?(e.pendingcb++,gr.nextTick((n,i)=>{Lo(i)?qu(n,i):i.pendingcb--},t,e)):Lo(e)&&(e.pendingcb++,qu(t,e))))}function qu(t,e){e.pendingcb--,e.finished=!0;let r=e[fn].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()}}q1(ee.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 o2=Po.destroy;ee.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[fn].length)&&gr.nextTick($u,r),o2.call(this,t,e),this};ee.prototype._undestroy=Po.undestroy;ee.prototype._destroy=function(t,e){e(t)};ee.prototype[V1.captureRejectionSymbol]=function(t){this.destroy(t)};var Fu;function Sp(){return Fu===void 0&&(Fu={}),Fu}ee.fromWeb=function(t,e){return Sp().newStreamWritableFromWritableStream(t,e)};ee.toWeb=function(t){return Sp().newWritableStreamFromStreamWritable(t)}});var Mp=K((yT,kp)=>{var Wu=Yt(),s2=Ct(),{isReadable:a2,isWritable:u2,isIterable:Ap,isNodeStream:c2,isReadableNodeStream:Ip,isWritableNodeStream:vp,isDuplexNodeStream:f2,isReadableStream:Tp,isWritableStream:Bp}=at(),Rp=Nt(),{AbortError:Op,codes:{ERR_INVALID_ARG_TYPE:l2,ERR_INVALID_RETURN_VALUE:Cp}}=Ie(),{destroyer:dn}=br(),d2=ft(),Up=ii(),h2=Oo(),{createDeferredPromise:Dp}=Re(),Lp=Cu(),Np=globalThis.Blob||s2.Blob,p2=typeof Np<"u"?function(e){return e instanceof Np}:function(e){return!1},y2=globalThis.AbortController||Jr().AbortController,{FunctionPrototypeCall:Pp}=X(),Qt=class extends d2{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)}};kp.exports=function t(e,r){if(f2(e))return e;if(Ip(e))return ln({readable:e});if(vp(e))return ln({writable:e});if(c2(e))return ln({writable:!1,readable:!1});if(Tp(e))return ln({readable:Up.fromWeb(e)});if(Bp(e))return ln({writable:h2.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=b2(e);if(Ap(i))return Lp(Qt,i,{objectMode:!0,write:o,final:s,destroy:a});let u=i?.then;if(typeof u=="function"){let c,f=Pp(u,i,l=>{if(l!=null)throw new Cp("nully","body",l)},l=>{dn(c,l)});return c=new Qt({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await f,Wu.nextTick(l,null)}catch(d){Wu.nextTick(l,d)}})},destroy:a})}throw new Cp("Iterable, AsyncIterable or AsyncFunction",r,i)}if(p2(e))return t(e.arrayBuffer());if(Ap(e))return Lp(Qt,e,{objectMode:!0,writable:!1});if(Tp(e?.readable)&&Bp(e?.writable))return Qt.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?Ip(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?vp(e?.writable)?e?.writable:t(e.writable):void 0;return ln({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return Pp(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{dn(i,o)}),i=new Qt({objectMode:!0,writable:!1,read(){}})}throw new l2(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function b2(t){let{promise:e,resolve:r}=Dp(),n=new y2,i=n.signal;return{value:t(async function*(){for(;;){let s=e;e=null;let{chunk:a,done:u,cb:c}=await s;if(Wu.nextTick(c),u)return;if(i.aborted)throw new Op(void 0,{cause:i.reason});({promise:e,resolve:r}=Dp()),yield a}}(),{signal:i}),write(s,a,u){let c=r;r=null,c({chunk:s,done:!1,cb:u})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function ln(t){let e=t.readable&&typeof t.readable.read!="function"?Up.wrap(t.readable):t.readable,r=t.writable,n=!!a2(e),i=!!u2(r),o,s,a,u,c;function f(l){let d=u;u=null,d?d(l):l&&c.destroy(l)}return c=new Qt({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(Rp(r,l=>{i=!1,l&&dn(e,l),f(l)}),c._write=function(l,d,h){r.write(l,d)?h():o=h},c._final=function(l){r.end(),s=l},r.on("drain",function(){if(o){let l=o;o=null,l()}}),r.on("finish",function(){if(s){let l=s;s=null,l()}})),n&&(Rp(e,l=>{n=!1,l&&dn(e,l),f(l)}),e.on("readable",function(){if(a){let l=a;a=null,l()}}),e.on("end",function(){c.push(null)}),c._read=function(){for(;;){let l=e.read();if(l===null){a=c._read;return}if(!c.push(l))return}}),c._destroy=function(l,d){!l&&u!==null&&(l=new Op),a=null,o=null,s=null,u===null?d(l):(u=d,dn(r,l),dn(e,l))},c}});var ft=K((bT,Hp)=>{"use strict";var{ObjectDefineProperties:m2,ObjectGetOwnPropertyDescriptor:Pt,ObjectKeys:w2,ObjectSetPrototypeOf:Fp}=X();Hp.exports=Je;var Gu=ii(),We=Oo();Fp(Je.prototype,Gu.prototype);Fp(Je,Gu);{let t=w2(We.prototype);for(let e=0;e<t.length;e++){let r=t[e];Je.prototype[r]||(Je.prototype[r]=We.prototype[r])}}function Je(t){if(!(this instanceof Je))return new Je(t);Gu.call(this,t),We.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}m2(Je.prototype,{writable:{__proto__:null,...Pt(We.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Pt(We.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Pt(We.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Pt(We.prototype,"writableBuffer")},writableLength:{__proto__:null,...Pt(We.prototype,"writableLength")},writableFinished:{__proto__:null,...Pt(We.prototype,"writableFinished")},writableCorked:{__proto__:null,...Pt(We.prototype,"writableCorked")},writableEnded:{__proto__:null,...Pt(We.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Pt(We.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 ju;function qp(){return ju===void 0&&(ju={}),ju}Je.fromWeb=function(t,e){return qp().newStreamDuplexFromReadableWritablePair(t,e)};Je.toWeb=function(t){return qp().newReadableWritablePairFromDuplex(t)};var zu;Je.from=function(t){return zu||(zu=Mp()),zu(t,"body")}});var Xu=K((mT,Kp)=>{"use strict";var{ObjectSetPrototypeOf:$p,Symbol:g2}=X();Kp.exports=Ot;var{ERR_METHOD_NOT_IMPLEMENTED:x2}=Ie().codes,Zu=ft(),{getHighWaterMark:E2}=ti();$p(Ot.prototype,Zu.prototype);$p(Ot,Zu);var ui=g2("kCallback");function Ot(t){if(!(this instanceof Ot))return new Ot(t);let e=t?E2(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Zu.call(this,t),this._readableState.sync=!1,this[ui]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",S2)}function Yu(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 S2(){this._final!==Yu&&Yu.call(this)}Ot.prototype._final=Yu;Ot.prototype._transform=function(t,e,r){throw new x2("_transform()")};Ot.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[ui]=r})};Ot.prototype._read=function(){if(this[ui]){let t=this[ui];this[ui]=null,t()}}});var Ju=K((wT,Wp)=>{"use strict";var{ObjectSetPrototypeOf:Vp}=X();Wp.exports=hn;var Qu=Xu();Vp(hn.prototype,Qu.prototype);Vp(hn,Qu);function hn(t){if(!(this instanceof hn))return new hn(t);Qu.call(this,t)}hn.prototype._transform=function(t,e,r){r(null,t)}});var Fo=K((gT,Zp)=>{var ci=Yt(),{ArrayIsArray:_2,Promise:A2,SymbolAsyncIterator:I2,SymbolDispose:v2}=X(),Mo=Nt(),{once:T2}=Re(),B2=br(),jp=ft(),{aggregateTwoErrors:R2,codes:{ERR_INVALID_ARG_TYPE:uc,ERR_INVALID_RETURN_VALUE:ec,ERR_MISSING_ARGS:C2,ERR_STREAM_DESTROYED:D2,ERR_STREAM_PREMATURE_CLOSE:L2},AbortError:N2}=Ie(),{validateFunction:P2,validateAbortSignal:O2}=rn(),{isIterable:xr,isReadable:tc,isReadableNodeStream:ko,isNodeStream:zp,isTransformStream:pn,isWebStream:U2,isReadableStream:rc,isReadableFinished:k2}=at(),M2=globalThis.AbortController||Jr().AbortController,nc,ic,oc;function Gp(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=Mo(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,B2.destroyer(t,o||new D2("pipe")))},cleanup:i}}function F2(t){return P2(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function sc(t){if(xr(t))return t;if(ko(t))return q2(t);throw new uc("val",["Readable","Iterable","AsyncIterable"],t)}async function*q2(t){ic||(ic=ii()),yield*ic.prototype[I2].call(t)}async function Uo(t,e,r,{end:n}){let i,o=null,s=c=>{if(c&&(i=c),o){let f=o;o=null,f()}},a=()=>new A2((c,f)=>{i?f(i):o=()=>{i?f(i):c()}});e.on("drain",s);let u=Mo(e,{readable:!1},s);try{e.writableNeedDrain&&await a();for await(let c of t)e.write(c)||await a();n&&(e.end(),await a()),r()}catch(c){r(i!==c?R2(i,c):c)}finally{u(),e.off("drain",s)}}async function ac(t,e,r,{end:n}){pn(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 H2(...t){return Yp(t,T2(F2(t)))}function Yp(t,e,r){if(t.length===1&&_2(t[0])&&(t=t[0]),t.length<2)throw new C2("streams");let n=new M2,i=n.signal,o=r?.signal,s=[];O2(o,"options.signal");function a(){p(new N2)}oc=oc||Re().addAbortListener;let u;o&&(u=oc(o,a));let c,f,l=[],d=0;function h(w){p(w,--d===0)}function p(w,I){var T;if(w&&(!c||c.code==="ERR_STREAM_PREMATURE_CLOSE")&&(c=w),!(!c&&!I)){for(;l.length;)l.shift()(c);(T=u)===null||T===void 0||T[v2](),n.abort(),I&&(c||s.forEach(F=>F()),ci.nextTick(e,c,f))}}let y;for(let w=0;w<t.length;w++){let I=t[w],T=w<t.length-1,F=w>0,U=T||r?.end!==!1,P=w===t.length-1;if(zp(I)){let S=function(B){B&&B.name!=="AbortError"&&B.code!=="ERR_STREAM_PREMATURE_CLOSE"&&h(B)};var A=S;if(U){let{destroy:B,cleanup:k}=Gp(I,T,F);l.push(B),tc(I)&&P&&s.push(k)}I.on("error",S),tc(I)&&P&&s.push(()=>{I.removeListener("error",S)})}if(w===0)if(typeof I=="function"){if(y=I({signal:i}),!xr(y))throw new ec("Iterable, AsyncIterable or Stream","source",y)}else xr(I)||ko(I)||pn(I)?y=I:y=jp.from(I);else if(typeof I=="function"){if(pn(y)){var _;y=sc((_=y)===null||_===void 0?void 0:_.readable)}else y=sc(y);if(y=I(y,{signal:i}),T){if(!xr(y,!0))throw new ec("AsyncIterable",`transform[${w-1}]`,y)}else{var b;nc||(nc=Ju());let S=new nc({objectMode:!0}),B=(b=y)===null||b===void 0?void 0:b.then;if(typeof B=="function")d++,B.call(y,g=>{f=g,g!=null&&S.write(g),U&&S.end(),ci.nextTick(h)},g=>{S.destroy(g),ci.nextTick(h,g)});else if(xr(y,!0))d++,Uo(y,S,h,{end:U});else if(rc(y)||pn(y)){let g=y.readable||y;d++,Uo(g,S,h,{end:U})}else throw new ec("AsyncIterable or Promise","destination",y);y=S;let{destroy:k,cleanup:C}=Gp(y,!1,!0);l.push(k),P&&s.push(C)}}else if(zp(I)){if(ko(y)){d+=2;let S=$2(y,I,h,{end:U});tc(I)&&P&&s.push(S)}else if(pn(y)||rc(y)){let S=y.readable||y;d++,Uo(S,I,h,{end:U})}else if(xr(y))d++,Uo(y,I,h,{end:U});else throw new uc("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=I}else if(U2(I)){if(ko(y))d++,ac(sc(y),I,h,{end:U});else if(rc(y)||xr(y))d++,ac(y,I,h,{end:U});else if(pn(y))d++,ac(y.readable,I,h,{end:U});else throw new uc("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],y);y=I}else y=jp.from(I)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&ci.nextTick(a),y}function $2(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new L2)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;k2(t)?ci.nextTick(s):t.once("end",s)}else r();return Mo(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)}),Mo(e,{readable:!1,writable:!0},r)}Zp.exports={pipelineImpl:Yp,pipeline:H2}});var fc=K((xT,r0)=>{"use strict";var{pipeline:K2}=Fo(),qo=ft(),{destroyer:V2}=br(),{isNodeStream:Ho,isReadable:Xp,isWritable:Qp,isWebStream:cc,isTransformStream:Er,isWritableStream:Jp,isReadableStream:e0}=at(),{AbortError:W2,codes:{ERR_INVALID_ARG_VALUE:t0,ERR_MISSING_ARGS:j2}}=Ie(),z2=Nt();r0.exports=function(...e){if(e.length===0)throw new j2("streams");if(e.length===1)return qo.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=qo.from(e[0])),typeof e[e.length-1]=="function"){let h=e.length-1;e[h]=qo.from(e[h])}for(let h=0;h<e.length;++h)if(!(!Ho(e[h])&&!cc(e[h]))){if(h<e.length-1&&!(Xp(e[h])||e0(e[h])||Er(e[h])))throw new t0(`streams[${h}]`,r[h],"must be readable");if(h>0&&!(Qp(e[h])||Jp(e[h])||Er(e[h])))throw new t0(`streams[${h}]`,r[h],"must be writable")}let n,i,o,s,a;function u(h){let p=s;s=null,p?p(h):h?a.destroy(h):!d&&!l&&a.destroy()}let c=e[0],f=K2(e,u),l=!!(Qp(c)||Jp(c)||Er(c)),d=!!(Xp(f)||e0(f)||Er(f));if(a=new qo({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(f!=null&&f.readableObjectMode),writable:l,readable:d}),l){if(Ho(c))a._write=function(p,y,_){c.write(p,y)?_():n=_},a._final=function(p){c.end(),i=p},c.on("drain",function(){if(n){let p=n;n=null,p()}});else if(cc(c)){let y=(Er(c)?c.writable:c).getWriter();a._write=async function(_,b,A){try{await y.ready,y.write(_).catch(()=>{}),A()}catch(w){A(w)}},a._final=async function(_){try{await y.ready,y.close().catch(()=>{}),i=_}catch(b){_(b)}}}let h=Er(f)?f.readable:f;z2(h,()=>{if(i){let p=i;i=null,p()}})}if(d){if(Ho(f))f.on("readable",function(){if(o){let h=o;o=null,h()}}),f.on("end",function(){a.push(null)}),a._read=function(){for(;;){let h=f.read();if(h===null){o=a._read;return}if(!a.push(h))return}};else if(cc(f)){let p=(Er(f)?f.readable:f).getReader();a._read=async function(){for(;;)try{let{value:y,done:_}=await p.read();if(!a.push(y))return;if(_){a.push(null);return}}catch{return}}}}return a._destroy=function(h,p){!h&&s!==null&&(h=new W2),o=null,n=null,i=null,s===null?p(h):(s=p,Ho(f)&&V2(f,h))},a}});var d0=K((ET,hc)=>{"use strict";var G2=globalThis.AbortController||Jr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Y2,ERR_INVALID_ARG_TYPE:fi,ERR_MISSING_ARGS:Z2,ERR_OUT_OF_RANGE:X2},AbortError:lt}=Ie(),{validateAbortSignal:Sr,validateInteger:n0,validateObject:_r}=rn(),Q2=X().Symbol("kWeak"),J2=X().Symbol("kResistStopPropagation"),{finished:eS}=Nt(),tS=fc(),{addAbortSignalNoValidate:rS}=ei(),{isWritable:nS,isNodeStream:iS}=at(),{deprecate:oS}=Re(),{ArrayPrototypePush:sS,Boolean:aS,MathFloor:i0,Number:uS,NumberIsNaN:cS,Promise:o0,PromiseReject:s0,PromiseResolve:fS,PromisePrototypeThen:a0,Symbol:c0}=X(),$o=c0("kEmpty"),u0=c0("kEof");function lS(t,e){if(e!=null&&_r(e,"options"),e?.signal!=null&&Sr(e.signal,"options.signal"),iS(t)&&!nS(t))throw new Y2("stream",t,"must be writable");let r=tS(this,t);return e!=null&&e.signal&&rS(e.signal,r),r}function Ko(t,e){if(typeof t!="function")throw new fi("fn",["Function","AsyncFunction"],t);e!=null&&_r(e,"options"),e?.signal!=null&&Sr(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=i0(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=i0(e.highWaterMark)),n0(r,"options.concurrency",1),n0(n,"options.highWaterMark",0),n+=r,async function*(){let o=Re().AbortSignalAny([e?.signal].filter(aS)),s=this,a=[],u={signal:o},c,f,l=!1,d=0;function h(){l=!0,p()}function p(){d-=1,y()}function y(){f&&!l&&d<r&&a.length<n&&(f(),f=null)}async function _(){try{for await(let b of s){if(l)return;if(o.aborted)throw new lt;try{if(b=t(b,u),b===$o)continue;b=fS(b)}catch(A){b=s0(A)}d+=1,a0(b,p,h),a.push(b),c&&(c(),c=null),!l&&(a.length>=n||d>=r)&&await new o0(A=>{f=A})}a.push(u0)}catch(b){let A=s0(b);a0(A,p,h),a.push(A)}finally{l=!0,c&&(c(),c=null)}}_();try{for(;;){for(;a.length>0;){let b=await a[0];if(b===u0)return;if(o.aborted)throw new lt;b!==$o&&(yield b),a.shift(),y()}await new o0(b=>{c=b})}}finally{l=!0,f&&(f(),f=null)}}.call(this)}function dS(t=void 0){return t!=null&&_r(t,"options"),t?.signal!=null&&Sr(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 lt({cause:t.signal.reason});yield[r++,i]}}.call(this)}async function f0(t,e=void 0){for await(let r of dc.call(this,t,e))return!0;return!1}async function hS(t,e=void 0){if(typeof t!="function")throw new fi("fn",["Function","AsyncFunction"],t);return!await f0.call(this,async(...r)=>!await t(...r),e)}async function pS(t,e){for await(let r of dc.call(this,t,e))return r}async function yS(t,e){if(typeof t!="function")throw new fi("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),$o}for await(let n of Ko.call(this,r,e));}function dc(t,e){if(typeof t!="function")throw new fi("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:$o}return Ko.call(this,r,e)}var lc=class extends Z2{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function bS(t,e,r){var n;if(typeof t!="function")throw new fi("reducer",["Function","AsyncFunction"],t);r!=null&&_r(r,"options"),r?.signal!=null&&Sr(r.signal,"options.signal");let i=arguments.length>1;if(r!=null&&(n=r.signal)!==null&&n!==void 0&&n.aborted){let c=new lt(void 0,{cause:r.signal.reason});throw this.once("error",()=>{}),await eS(this.destroy(c)),c}let o=new G2,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[Q2]:this,[J2]:!0};r.signal.addEventListener("abort",()=>o.abort(),c)}let a=!1;try{for await(let c of this){var u;if(a=!0,r!=null&&(u=r.signal)!==null&&u!==void 0&&u.aborted)throw new lt;i?e=await t(e,c,{signal:s}):(e=c,i=!0)}if(!a&&!i)throw new lc}finally{o.abort()}return e}async function mS(t){t!=null&&_r(t,"options"),t?.signal!=null&&Sr(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 lt(void 0,{cause:t.signal.reason});sS(e,n)}return e}function wS(t,e){let r=Ko.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function l0(t){if(t=uS(t),cS(t))return 0;if(t<0)throw new X2("number",">= 0",t);return t}function gS(t,e=void 0){return e!=null&&_r(e,"options"),e?.signal!=null&&Sr(e.signal,"options.signal"),t=l0(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new lt;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new lt;t--<=0&&(yield o)}}.call(this)}function xS(t,e=void 0){return e!=null&&_r(e,"options"),e?.signal!=null&&Sr(e.signal,"options.signal"),t=l0(t),async function*(){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new lt;for await(let o of this){var i;if(e!=null&&(i=e.signal)!==null&&i!==void 0&&i.aborted)throw new lt;if(t-- >0&&(yield o),t<=0)return}}.call(this)}hc.exports.streamReturningOperators={asIndexedPairs:oS(dS,"readable.asIndexedPairs will be removed in a future version."),drop:gS,filter:dc,flatMap:wS,map:Ko,take:xS,compose:lS};hc.exports.promiseReturningOperators={every:hS,forEach:yS,reduce:bS,toArray:mS,some:f0,find:pS}});var pc=K((ST,h0)=>{"use strict";var{ArrayPrototypePop:ES,Promise:SS}=X(),{isIterable:_S,isNodeStream:AS,isWebStream:IS}=at(),{pipelineImpl:vS}=Fo(),{finished:TS}=Nt();yc();function BS(...t){return new SS((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!AS(o)&&!_S(o)&&!IS(o)){let s=ES(t);n=s.signal,i=s.end}vS(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}h0.exports={finished:TS,pipeline:BS}});var yc=K((_T,S0)=>{"use strict";var{Buffer:RS}=Ct(),{ObjectDefineProperty:Ut,ObjectKeys:b0,ReflectApply:m0}=X(),{promisify:{custom:w0}}=Re(),{streamReturningOperators:p0,promiseReturningOperators:y0}=d0(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:g0}}=Ie(),CS=fc(),{setDefaultHighWaterMark:DS,getDefaultHighWaterMark:LS}=ti(),{pipeline:x0}=Fo(),{destroyer:NS}=br(),E0=Nt(),bc=pc(),li=at(),Y=S0.exports=So().Stream;Y.isDestroyed=li.isDestroyed;Y.isDisturbed=li.isDisturbed;Y.isErrored=li.isErrored;Y.isReadable=li.isReadable;Y.isWritable=li.isWritable;Y.Readable=ii();for(let t of b0(p0)){let r=function(...n){if(new.target)throw g0();return Y.Readable.from(m0(e,this,n))},e=p0[t];Ut(r,"name",{__proto__:null,value:e.name}),Ut(r,"length",{__proto__:null,value:e.length}),Ut(Y.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of b0(y0)){let r=function(...n){if(new.target)throw g0();return m0(e,this,n)},e=y0[t];Ut(r,"name",{__proto__:null,value:e.name}),Ut(r,"length",{__proto__:null,value:e.length}),Ut(Y.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}Y.Writable=Oo();Y.Duplex=ft();Y.Transform=Xu();Y.PassThrough=Ju();Y.pipeline=x0;var{addAbortSignal:PS}=ei();Y.addAbortSignal=PS;Y.finished=E0;Y.destroy=NS;Y.compose=CS;Y.setDefaultHighWaterMark=DS;Y.getDefaultHighWaterMark=LS;Ut(Y,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return bc}});Ut(x0,w0,{__proto__:null,enumerable:!0,get(){return bc.pipeline}});Ut(E0,w0,{__proto__:null,enumerable:!0,get(){return bc.finished}});Y.Stream=Y;Y._isUint8Array=function(e){return e instanceof Uint8Array};Y._uint8ArrayToBuffer=function(e){return RS.from(e.buffer,e.byteOffset,e.byteLength)}});var _0=K((AT,ue)=>{"use strict";var he=yc(),OS=pc(),US=he.Readable.destroy;ue.exports=he.Readable;ue.exports._uint8ArrayToBuffer=he._uint8ArrayToBuffer;ue.exports._isUint8Array=he._isUint8Array;ue.exports.isDisturbed=he.isDisturbed;ue.exports.isErrored=he.isErrored;ue.exports.isReadable=he.isReadable;ue.exports.Readable=he.Readable;ue.exports.Writable=he.Writable;ue.exports.Duplex=he.Duplex;ue.exports.Transform=he.Transform;ue.exports.PassThrough=he.PassThrough;ue.exports.addAbortSignal=he.addAbortSignal;ue.exports.finished=he.finished;ue.exports.destroy=he.destroy;ue.exports.destroy=US;ue.exports.pipeline=he.pipeline;ue.exports.compose=he.compose;Object.defineProperty(he,"promises",{configurable:!0,enumerable:!0,get(){return OS}});ue.exports.Stream=he.Stream;ue.exports.default=ue.exports});var e_={};Ne(e_,{BAD_REQUEST:()=>VS,INTERNAL_SERVER_ERROR:()=>WS,Libp2pSocket:()=>Wo,NOT_FOUND_RESPONSE:()=>KS,NOT_IMPLEMENTED_ERROR:()=>jS,Request:()=>Zn,Response:()=>Wa,STATUS_CODES:()=>Va,getHeader:()=>YS,getHeaders:()=>Xn,getHost:()=>R0,getServerUpgradeHeaders:()=>QS,isWebSocketUpgrade:()=>Ka,normalizeMethod:()=>ZS,normalizeUrl:()=>D0,readHeaders:()=>JS,responseToStream:()=>$S,streamToRequest:()=>HS,streamToSocket:()=>kS,stripHTTPPath:()=>C0,toResource:()=>GS,toURL:()=>FS,toUint8Array:()=>qS,writeHeaders:()=>B0});var Zo={};Ne(Zo,{base10:()=>W0});var r_=new Uint8Array(0);function xc(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 dt(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")}function Ec(t){return new TextEncoder().encode(t)}function Sc(t){return new TextDecoder().decode(t)}function F0(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,u=t.charAt(0),c=Math.log(a)/Math.log(256),f=Math.log(256)/Math.log(a);function l(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var y=0,_=0,b=0,A=p.length;b!==A&&p[b]===0;)b++,y++;for(var w=(A-b)*f+1>>>0,I=new Uint8Array(w);b!==A;){for(var T=p[b],F=0,U=w-1;(T!==0||F<_)&&U!==-1;U--,F++)T+=256*I[U]>>>0,I[U]=T%a>>>0,T=T/a>>>0;if(T!==0)throw new Error("Non-zero carry");_=F,b++}for(var P=w-_;P!==w&&I[P]===0;)P++;for(var S=u.repeat(y);P<w;++P)S+=t.charAt(I[P]);return S}function d(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var y=0;if(p[y]!==" "){for(var _=0,b=0;p[y]===u;)_++,y++;for(var A=(p.length-y)*c+1>>>0,w=new Uint8Array(A);p[y];){var I=r[p.charCodeAt(y)];if(I===255)return;for(var T=0,F=A-1;(I!==0||T<b)&&F!==-1;F--,T++)I+=a*w[F]>>>0,w[F]=I%256>>>0,I=I/256>>>0;if(I!==0)throw new Error("Non-zero carry");b=T,y++}if(p[y]!==" "){for(var U=A-b;U!==A&&w[U]===0;)U++;for(var P=new Uint8Array(_+(A-U)),S=_;U!==A;)P[S++]=w[U++];return P}}}function h(p){var y=d(p);if(y)return y;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:d,decode:h}}var q0=F0,H0=q0,Ac=H0;var jo=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")}},zo=class{name;prefix;baseDecode;prefixCodePoint;constructor(e,r,n){this.name=e,this.prefix=r;let i=r.codePointAt(0);if(i===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=i,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 Ic(this,e)}},Go=class{decoders;constructor(e){this.decoders=e}or(e){return Ic(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 Ic(t,e){return new Go({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Yo=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 jo(e,r,n),this.decoder=new zo(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Ar({name:t,prefix:e,encode:r,decode:n}){return new Yo(t,e,r,n)}function kt({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=Ac(r,t);return Ar({prefix:e,name:t,encode:n,decode:o=>dt(i(o))})}function $0(t,e,r,n){let i=t.length;for(;t[i-1]==="=";)--i;let o=new Uint8Array(i*r/8|0),s=0,a=0,u=0;for(let c=0;c<i;++c){let f=e[t[c]];if(f===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|f,s+=r,s>=8&&(s-=8,o[u++]=255&a>>s)}if(s>=r||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function K0(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let u=0;u<t.length;++u)for(a=a<<8|t[u],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)!==0;)o+="=";return o}function V0(t){let e={};for(let r=0;r<t.length;++r)e[t[r]]=r;return e}function ie({name:t,prefix:e,bitsPerChar:r,alphabet:n}){let i=V0(n);return Ar({prefix:e,name:t,encode(o){return K0(o,n,r)},decode(o){return $0(o,i,r,t)}})}var W0=kt({prefix:"9",name:"base10",alphabet:"0123456789"});var Xo={};Ne(Xo,{base16:()=>j0,base16upper:()=>z0});var j0=ie({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),z0=ie({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Qo={};Ne(Qo,{base2:()=>G0});var G0=ie({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Jo={};Ne(Jo,{base256emoji:()=>J0});var vc=Array.from("\u{1F680}\u{1FA90}\u2604\u{1F6F0}\u{1F30C}\u{1F311}\u{1F312}\u{1F313}\u{1F314}\u{1F315}\u{1F316}\u{1F317}\u{1F318}\u{1F30D}\u{1F30F}\u{1F30E}\u{1F409}\u2600\u{1F4BB}\u{1F5A5}\u{1F4BE}\u{1F4BF}\u{1F602}\u2764\u{1F60D}\u{1F923}\u{1F60A}\u{1F64F}\u{1F495}\u{1F62D}\u{1F618}\u{1F44D}\u{1F605}\u{1F44F}\u{1F601}\u{1F525}\u{1F970}\u{1F494}\u{1F496}\u{1F499}\u{1F622}\u{1F914}\u{1F606}\u{1F644}\u{1F4AA}\u{1F609}\u263A\u{1F44C}\u{1F917}\u{1F49C}\u{1F614}\u{1F60E}\u{1F607}\u{1F339}\u{1F926}\u{1F389}\u{1F49E}\u270C\u2728\u{1F937}\u{1F631}\u{1F60C}\u{1F338}\u{1F64C}\u{1F60B}\u{1F497}\u{1F49A}\u{1F60F}\u{1F49B}\u{1F642}\u{1F493}\u{1F929}\u{1F604}\u{1F600}\u{1F5A4}\u{1F603}\u{1F4AF}\u{1F648}\u{1F447}\u{1F3B6}\u{1F612}\u{1F92D}\u2763\u{1F61C}\u{1F48B}\u{1F440}\u{1F62A}\u{1F611}\u{1F4A5}\u{1F64B}\u{1F61E}\u{1F629}\u{1F621}\u{1F92A}\u{1F44A}\u{1F973}\u{1F625}\u{1F924}\u{1F449}\u{1F483}\u{1F633}\u270B\u{1F61A}\u{1F61D}\u{1F634}\u{1F31F}\u{1F62C}\u{1F643}\u{1F340}\u{1F337}\u{1F63B}\u{1F613}\u2B50\u2705\u{1F97A}\u{1F308}\u{1F608}\u{1F918}\u{1F4A6}\u2714\u{1F623}\u{1F3C3}\u{1F490}\u2639\u{1F38A}\u{1F498}\u{1F620}\u261D\u{1F615}\u{1F33A}\u{1F382}\u{1F33B}\u{1F610}\u{1F595}\u{1F49D}\u{1F64A}\u{1F639}\u{1F5E3}\u{1F4AB}\u{1F480}\u{1F451}\u{1F3B5}\u{1F91E}\u{1F61B}\u{1F534}\u{1F624}\u{1F33C}\u{1F62B}\u26BD\u{1F919}\u2615\u{1F3C6}\u{1F92B}\u{1F448}\u{1F62E}\u{1F646}\u{1F37B}\u{1F343}\u{1F436}\u{1F481}\u{1F632}\u{1F33F}\u{1F9E1}\u{1F381}\u26A1\u{1F31E}\u{1F388}\u274C\u270A\u{1F44B}\u{1F630}\u{1F928}\u{1F636}\u{1F91D}\u{1F6B6}\u{1F4B0}\u{1F353}\u{1F4A2}\u{1F91F}\u{1F641}\u{1F6A8}\u{1F4A8}\u{1F92C}\u2708\u{1F380}\u{1F37A}\u{1F913}\u{1F619}\u{1F49F}\u{1F331}\u{1F616}\u{1F476}\u{1F974}\u25B6\u27A1\u2753\u{1F48E}\u{1F4B8}\u2B07\u{1F628}\u{1F31A}\u{1F98B}\u{1F637}\u{1F57A}\u26A0\u{1F645}\u{1F61F}\u{1F635}\u{1F44E}\u{1F932}\u{1F920}\u{1F927}\u{1F4CC}\u{1F535}\u{1F485}\u{1F9D0}\u{1F43E}\u{1F352}\u{1F617}\u{1F911}\u{1F30A}\u{1F92F}\u{1F437}\u260E\u{1F4A7}\u{1F62F}\u{1F486}\u{1F446}\u{1F3A4}\u{1F647}\u{1F351}\u2744\u{1F334}\u{1F4A3}\u{1F438}\u{1F48C}\u{1F4CD}\u{1F940}\u{1F922}\u{1F445}\u{1F4A1}\u{1F4A9}\u{1F450}\u{1F4F8}\u{1F47B}\u{1F910}\u{1F92E}\u{1F3BC}\u{1F975}\u{1F6A9}\u{1F34E}\u{1F34A}\u{1F47C}\u{1F48D}\u{1F4E3}\u{1F942}"),Y0=vc.reduce((t,e,r)=>(t[r]=e,t),[]),Z0=vc.reduce((t,e,r)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return t[n]=r,t},[]);function X0(t){return t.reduce((e,r)=>(e+=Y0[r],e),"")}function Q0(t){let e=[];for(let r of t){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let i=Z0[n];if(i==null)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}var J0=Ar({prefix:"\u{1F680}",name:"base256emoji",encode:X0,decode:Q0});var es={};Ne(es,{base32:()=>Mt,base32hex:()=>ny,base32hexpad:()=>oy,base32hexpadupper:()=>sy,base32hexupper:()=>iy,base32pad:()=>ty,base32padupper:()=>ry,base32upper:()=>ey,base32z:()=>ay});var Mt=ie({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ey=ie({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ty=ie({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ry=ie({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ny=ie({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),iy=ie({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),oy=ie({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),sy=ie({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),ay=ie({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var ts={};Ne(ts,{base36:()=>Jt,base36upper:()=>uy});var Jt=kt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),uy=kt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var rs={};Ne(rs,{base58btc:()=>oe,base58flickr:()=>cy});var oe=kt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),cy=kt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var os={};Ne(os,{base64:()=>fy,base64pad:()=>ns,base64url:()=>is,base64urlpad:()=>ly});var fy=ie({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ns=ie({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),is=ie({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ly=ie({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ss={};Ne(ss,{base8:()=>dy});var dy=ie({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var as={};Ne(as,{identity:()=>hy});var hy=Ar({prefix:"\0",name:"identity",encode:t=>Sc(t),decode:t=>Ec(t)});var w_=new TextEncoder,g_=new TextDecoder;var cs={};Ne(cs,{identity:()=>je});var by=Rc,Tc=128,my=127,wy=~my,gy=Math.pow(2,31);function Rc(t,e,r){e=e||[],r=r||0;for(var n=r;t>=gy;)e[r++]=t&255|Tc,t/=128;for(;t&wy;)e[r++]=t&255|Tc,t>>>=7;return e[r]=t|0,Rc.bytes=r-n+1,e}var xy=us,Ey=128,Bc=127;function us(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw us.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Bc)<<i:(s&Bc)*Math.pow(2,i),i+=7}while(s>=Ey);return us.bytes=o-n,r}var Sy=Math.pow(2,7),_y=Math.pow(2,14),Ay=Math.pow(2,21),Iy=Math.pow(2,28),vy=Math.pow(2,35),Ty=Math.pow(2,42),By=Math.pow(2,49),Ry=Math.pow(2,56),Cy=Math.pow(2,63),Dy=function(t){return t<Sy?1:t<_y?2:t<Ay?3:t<Iy?4:t<vy?5:t<Ty?6:t<By?7:t<Ry?8:t<Cy?9:10},Ly={encode:by,decode:xy,encodingLength:Dy},Ny=Ly,yn=Ny;function bn(t,e=0){return[yn.decode(t,e),yn.decode.bytes]}function Ir(t,e,r=0){return yn.encode(t,e,r),e}function vr(t){return yn.encodingLength(t)}function Br(t,e){let r=e.byteLength,n=vr(t),i=n+vr(r),o=new Uint8Array(i+r);return Ir(t,o,0),Ir(r,o,n),o.set(e,i),new Tr(t,r,e,o)}function mn(t){let e=dt(t),[r,n]=bn(e),[i,o]=bn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Tr(r,i,s,e)}function Cc(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&xc(t.bytes,r.bytes)}}var Tr=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var Dc=0,Py="identity",Lc=dt;function Oy(t,e){if(e?.truncate!=null&&e.truncate!==t.byteLength){if(e.truncate<0||e.truncate>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,e.truncate)}return Br(Dc,Lc(t))}var je={code:Dc,name:Py,encode:Lc,digest:Oy};var ls={};Ne(ls,{sha256:()=>gn,sha512:()=>ky});var Uy=20;function wn({name:t,code:e,encode:r,minDigestLength:n,maxDigestLength:i}){return new fs(t,e,r,n,i)}var fs=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,r,n,i,o){this.name=e,this.code=r,this.encode=n,this.minDigestLength=i??Uy,this.maxDigestLength=o}digest(e,r){if(r?.truncate!=null){if(r.truncate<this.minDigestLength)throw new Error(`Invalid truncate option, must be greater than or equal to ${this.minDigestLength}`);if(this.maxDigestLength!=null&&r.truncate>this.maxDigestLength)throw new Error(`Invalid truncate option, must be less than or equal to ${this.maxDigestLength}`)}if(e instanceof Uint8Array){let n=this.encode(e);return n instanceof Uint8Array?Nc(n,this.code,r?.truncate):n.then(i=>Nc(i,this.code,r?.truncate))}else throw Error("Unknown type, must be binary type")}};function Nc(t,e,r){if(r!=null&&r!==t.byteLength){if(r>t.byteLength)throw new Error(`Invalid truncate option, must be less than or equal to ${t.byteLength}`);t=t.subarray(0,r)}return Br(e,t)}function Oc(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var gn=wn({name:"sha2-256",code:18,encode:Oc("SHA-256")}),ky=wn({name:"sha2-512",code:19,encode:Oc("SHA-512")});function Uc(t,e){let{bytes:r,version:n}=t;switch(n){case 0:return Fy(r,ds(t),e??oe.encoder);default:return qy(r,ds(t),e??Mt.encoder)}}var kc=new WeakMap;function ds(t){let e=kc.get(t);if(e==null){let r=new Map;return kc.set(t,r),r}return e}var le=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!==xn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Hy)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=Br(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&&Cc(e.multihash,n.multihash)}toString(e){return Uc(this,e)}toJSON(){return{"/":Uc(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??Mc(n,i,o.bytes))}else if(r[$y]===!0){let{version:n,multihash:i,code:o}=r,s=mn(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!==xn)throw new Error(`Version 0 CID must use dag-pb (code: ${xn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Mc(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,xn,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=dt(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 Tr(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[l,d]=bn(e.subarray(r));return r+=d,l},i=n(),o=xn;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(),u=n(),c=r+u,f=c-s;return{version:i,codec:o,multihashCode:a,digestSize:u,multihashSize:f,size:c}}static parse(e,r){let[n,i]=My(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 ds(o).set(n,e),o}};function My(t,e){switch(t[0]){case"Q":{let r=e??oe;return[oe.prefix,r.decode(`${oe.prefix}${t}`)]}case oe.prefix:{let r=e??oe;return[oe.prefix,r.decode(t)]}case Mt.prefix:{let r=e??Mt;return[Mt.prefix,r.decode(t)]}case Jt.prefix:{let r=e??Jt;return[Jt.prefix,r.decode(t)]}default:{if(e==null)throw Error("To parse non base32, base36 or base58btc encoded CID multibase decoder must be provided");return[t[0],e.decode(t)]}}}function Fy(t,e,r){let{prefix:n}=r;if(n!==oe.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 qy(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 xn=112,Hy=18;function Mc(t,e,r){let n=vr(t),i=n+vr(e),o=new Uint8Array(i+r.byteLength);return Ir(t,o,0),Ir(e,o,n),o.set(r,i),o}var $y=Symbol.for("@ipld/js-cid/CID");var En={...as,...Qo,...ss,...Zo,...Xo,...es,...ts,...rs,...os,...Jo},H_={...ls,...cs};function ht(t=0){return new Uint8Array(t)}function Pe(t=0){return new Uint8Array(t)}function qc(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Fc=qc("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),hs=qc("ascii","a",t=>{let e="a";for(let r=0;r<t.length;r++)e+=String.fromCharCode(t[r]);return e},t=>{t=t.substring(1);let e=Pe(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Ky={utf8:Fc,"utf-8":Fc,hex:En.base16,latin1:hs,ascii:hs,binary:hs,...En},bi=Ky;function W(t,e="utf8"){let r=bi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}function D(t){if(t!==void 0&&t!==D.REQUEST&&t!==D.RESPONSE)throw new Error("type must be REQUEST or RESPONSE");t===void 0||this.initialize(t),this.maxHeaderSize=D.maxHeaderSize}D.prototype.initialize=function(t,e){if(t!==D.REQUEST&&t!==D.RESPONSE)throw new Error("type must be REQUEST or RESPONSE");this.type=t,this.state=t+"_LINE",this.info={headers:[],upgrade:!1},this.trailers=[],this.line="",this.isChunked=!1,this.connection="",this.headerSize=0,this.body_bytes=null,this.isUserCall=!1,this.hadError=!1};D.encoding="ascii";D.maxHeaderSize=80*1024;D.REQUEST="REQUEST";D.RESPONSE="RESPONSE";var Hc=D.kOnHeaders=1,ps=D.kOnHeadersComplete=2,mi=D.kOnBody=3,ys=D.kOnMessageComplete=4;D.prototype[Hc]=D.prototype[ps]=D.prototype[mi]=D.prototype[ys]=function(){};var $c=!0;Object.defineProperty(D,"kOnExecute",{get:function(){return $c=!1,99}});var Kc=D.methods=["DELETE","GET","HEAD","POST","PUT","CONNECT","OPTIONS","TRACE","COPY","LOCK","MKCOL","MOVE","PROPFIND","PROPPATCH","SEARCH","UNLOCK","BIND","REBIND","UNBIND","ACL","REPORT","MKACTIVITY","CHECKOUT","MERGE","M-SEARCH","NOTIFY","SUBSCRIBE","UNSUBSCRIBE","PATCH","PURGE","MKCALENDAR","LINK","UNLINK","SOURCE"],Vc=Kc.indexOf("CONNECT");D.prototype.reinitialize=D;D.prototype.close=D.prototype.pause=D.prototype.resume=D.prototype.remove=D.prototype.free=function(){};D.prototype._compatMode0_11=!1;D.prototype.getAsyncId=function(){return 0};var Vy={REQUEST_LINE:!0,RESPONSE_LINE:!0,HEADER:!0};D.prototype.execute=function(t,e,r){if(!(this instanceof D))throw new TypeError("not a HTTPParser");e=e||0,r=typeof r=="number"?r:t.length,this.chunk=t,this.offset=e;var n=this.end=e+r;try{for(;this.offset<n&&!this[this.state](););}catch(i){if(this.isUserCall)throw i;return this.hadError=!0,i}return this.chunk=null,r=this.offset-e,Vy[this.state]&&(this.headerSize+=r,this.headerSize>(this.maxHeaderSize||D.maxHeaderSize))?new Error("max header size exceeded"):r};var Wy={REQUEST_LINE:!0,RESPONSE_LINE:!0,BODY_RAW:!0};D.prototype.finish=function(){if(!this.hadError){if(!Wy[this.state])return new Error("invalid state for EOF");this.state==="BODY_RAW"&&this.userCall()(this[ys]())}};D.prototype.consume=D.prototype.unconsume=D.prototype.getCurrentBuffer=function(){};D.prototype.userCall=function(){this.isUserCall=!0;var t=this;return function(e){return t.isUserCall=!1,e}};D.prototype.nextRequest=function(){this.userCall()(this[ys]()),this.reinitialize(this.type)};D.prototype.consumeLine=function(){for(var t=this.end,e=this.chunk,r=this.offset;r<t;r++)if(e[r]===10){var n=this.line+W(e.subarray(this.offset,r),D.encoding);return n.charAt(n.length-1)==="\r"&&(n=n.substr(0,n.length-1)),this.line="",this.offset=r+1,n}this.line+=W(e.subarray(this.offset,this.end),D.encoding),this.offset=this.end};var jy=/^([^: \t]+):[ \t]*((?:.*[^ \t])|)/,zy=/^[ \t]+(.*[^ \t])/;D.prototype.parseHeader=function(t,e){if(t.indexOf("\r")!==-1)throw wi("HPE_LF_EXPECTED");var r=jy.exec(t),n=r&&r[1];if(n)e.push(n),e.push(r[2]);else{var i=zy.exec(t);i&&e.length&&(e[e.length-1]&&(e[e.length-1]+=" "),e[e.length-1]+=i[1])}};var Gy=/^([A-Z-]+) ([^ ]+) HTTP\/(\d)\.(\d)$/;D.prototype.REQUEST_LINE=function(){var t=this.consumeLine();if(t){var e=Gy.exec(t);if(e===null)throw wi("HPE_INVALID_CONSTANT");if(this.info.method=this._compatMode0_11?e[1]:Kc.indexOf(e[1]),this.info.method===-1)throw new Error("invalid request method");this.info.url=e[2],this.info.versionMajor=+e[3],this.info.versionMinor=+e[4],this.body_bytes=0,this.state="HEADER"}};var Yy=/^HTTP\/(\d)\.(\d) (\d{3}) ?(.*)$/;D.prototype.RESPONSE_LINE=function(){var t=this.consumeLine();if(t){var e=Yy.exec(t);if(e===null)throw wi("HPE_INVALID_CONSTANT");this.info.versionMajor=+e[1],this.info.versionMinor=+e[2];var r=this.info.statusCode=+e[3];this.info.statusMessage=e[4],((r/100|0)===1||r===204||r===304)&&(this.body_bytes=0),this.state="HEADER"}};D.prototype.shouldKeepAlive=function(){if(this.info.versionMajor>0&&this.info.versionMinor>0){if(this.connection.indexOf("close")!==-1)return!1}else if(this.connection.indexOf("keep-alive")===-1)return!1;return!!(this.body_bytes!==null||this.isChunked)};D.prototype.HEADER=function(){var t=this.consumeLine();if(t!==void 0){var e=this.info;if(t)this.parseHeader(t,e.headers);else{for(var r=e.headers,n=!1,i,o=!1,s=0;s<r.length;s+=2)switch(r[s].toLowerCase()){case"transfer-encoding":this.isChunked=r[s+1].toLowerCase()==="chunked";break;case"content-length":if(i=+r[s+1],n){if(i!==this.body_bytes)throw wi("HPE_UNEXPECTED_CONTENT_LENGTH")}else n=!0,this.body_bytes=i;break;case"connection":this.connection+=r[s+1].toLowerCase();break;case"upgrade":o=!0;break}this.isChunked&&n&&(n=!1,this.body_bytes=null),o&&this.connection.indexOf("upgrade")!=-1?e.upgrade=this.type===D.REQUEST||e.statusCode===101:e.upgrade=e.method===Vc,this.isChunked&&e.upgrade&&(this.isChunked=!1),e.shouldKeepAlive=this.shouldKeepAlive();var a;if($c?a=this.userCall()(this[ps](e)):a=this.userCall()(this[ps](e.versionMajor,e.versionMinor,e.headers,e.method,e.url,e.statusCode,e.statusMessage,e.upgrade,e.shouldKeepAlive)),a===2)return this.nextRequest(),!0;if(this.isChunked&&!a)this.state="BODY_CHUNKHEAD";else{if(a||this.body_bytes===0)return this.nextRequest(),e.upgrade;this.body_bytes===null?this.state="BODY_RAW":this.state="BODY_SIZED"}}}};D.prototype.BODY_CHUNKHEAD=function(){var t=this.consumeLine();t!==void 0&&(this.body_bytes=parseInt(t,16),this.body_bytes?this.state="BODY_CHUNK":this.state="BODY_CHUNKTRAILERS")};D.prototype.BODY_CHUNK=function(){var t=Math.min(this.end-this.offset,this.body_bytes);this.userCall()(this[mi](this.chunk.slice(this.offset,this.offset+t),0,t)),this.offset+=t,this.body_bytes-=t,this.body_bytes||(this.state="BODY_CHUNKEMPTYLINE")};D.prototype.BODY_CHUNKEMPTYLINE=function(){var t=this.consumeLine();if(t!==void 0){if(t!=="")throw new Error("Expected empty line");this.state="BODY_CHUNKHEAD"}};D.prototype.BODY_CHUNKTRAILERS=function(){var t=this.consumeLine();t!==void 0&&(t?this.parseHeader(t,this.trailers):(this.trailers.length&&this.userCall()(this[Hc](this.trailers,"")),this.nextRequest()))};D.prototype.BODY_RAW=function(){this.userCall()(this[mi](this.chunk.slice(this.offset,this.end),0,this.end-this.offset)),this.offset=this.end};D.prototype.BODY_SIZED=function(){var t=Math.min(this.end-this.offset,this.body_bytes);this.userCall()(this[mi](this.chunk.slice(this.offset,this.offset+t),0,t)),this.offset+=t,this.body_bytes-=t,this.body_bytes||this.nextRequest()};["Headers","HeadersComplete","Body","MessageComplete"].forEach(function(t){var e=D["kOn"+t];Object.defineProperty(D.prototype,"on"+t,{get:function(){return this[e]},set:function(r){return this._compatMode0_11=!0,Vc="CONNECT",this[e]=r}})});function wi(t){var e=new Error("Parse Error");return e.code=t,e}var gi=Symbol.for("@libp2p/peer-id");function Wc(t){return!!t?.[gi]}var Oe=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},xi=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var Ei=class extends Error{static name="InvalidCIDError";constructor(e="Invalid CID"){super(e),this.name="InvalidCIDError"}},Si=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var Sn=class extends Error{static name="ProtocolError";constructor(e="Protocol error"){super(e),this.name="ProtocolError"}};var _n=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};function Ue(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 pt(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Pe(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var zc=Symbol.for("@achingbrain/uint8arraylist");function jc(t,e){if(e==null||e<0)throw new RangeError("index is out of bounds");let r=0;for(let n of t){let i=r+n.byteLength;if(e<i)return{buf:n,index:e-r};r=i}throw new RangeError("index is out of bounds")}function _i(t){return!!t?.[zc]}var pe=class t{bufs;length;[zc]=!0;constructor(...e){this.bufs=[],this.length=0,e.length>0&&this.appendAll(e)}*[Symbol.iterator](){yield*this.bufs}get byteLength(){return this.length}append(...e){this.appendAll(e)}appendAll(e){let r=0;for(let n of e)if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.push(n);else if(_i(n))r+=n.byteLength,this.bufs.push(...n.bufs);else throw new Error("Could not append value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}prepend(...e){this.prependAll(e)}prependAll(e){let r=0;for(let n of e.reverse())if(n instanceof Uint8Array)r+=n.byteLength,this.bufs.unshift(n);else if(_i(n))r+=n.byteLength,this.bufs.unshift(...n.bufs);else throw new Error("Could not prepend value, must be an Uint8Array or a Uint8ArrayList");this.length+=r}get(e){let r=jc(this.bufs,e);return r.buf[r.index]}set(e,r){let n=jc(this.bufs,e);n.buf[n.index]=r}write(e,r=0){if(e instanceof Uint8Array)for(let n=0;n<e.length;n++)this.set(r+n,e[n]);else if(_i(e))for(let n=0;n<e.length;n++)this.set(r+n,e.get(n));else throw new Error("Could not write value, must be an Uint8Array or a Uint8ArrayList")}consume(e){if(e=Math.trunc(e),!(Number.isNaN(e)||e<=0)){if(e===this.byteLength){this.bufs=[],this.length=0;return}for(;this.bufs.length>0;)if(e>=this.bufs[0].byteLength)e-=this.bufs[0].byteLength,this.length-=this.bufs[0].byteLength,this.bufs.shift();else{this.bufs[0]=this.bufs[0].subarray(e),this.length-=e;break}}}slice(e,r){let{bufs:n,length:i}=this._subList(e,r);return pt(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:pt(n,i)}sublist(e,r){let{bufs:n,length:i}=this._subList(e,r),o=new t;return o.length=i,o.bufs=[...n],o}_subList(e,r){if(e=e??0,r=r??this.length,e<0&&(e=this.length+e),r<0&&(r=this.length+r),e<0||r>this.length)throw new RangeError("index is out of bounds");if(e===r)return{bufs:[],length:0};if(e===0&&r===this.length)return{bufs:this.bufs,length:this.length};let n=[],i=0;for(let o=0;o<this.bufs.length;o++){let s=this.bufs[o],a=i,u=a+s.byteLength;if(i=u,e>=u)continue;let c=e>=a&&e<u,f=r>a&&r<=u;if(c&&f){if(e===a&&r===u){n.push(s);break}let l=e-a;n.push(s.subarray(l,l+(r-e)));break}if(c){if(e===0){n.push(s);continue}n.push(s.subarray(e-a));continue}if(f){if(r===u){n.push(s);break}n.push(s.subarray(0,r-a));break}n.push(s)}return{bufs:n,length:r-e}}indexOf(e,r=0){if(!_i(e)&&!(e instanceof Uint8Array))throw new TypeError('The "value" argument must be a Uint8ArrayList or Uint8Array');let n=e instanceof Uint8Array?e:e.subarray();if(r=Number(r??0),isNaN(r)&&(r=0),r<0&&(r=this.length+r),r<0&&(r=0),e.length===0)return r>this.length?this.length:r;let i=n.byteLength;if(i===0)throw new TypeError("search must be at least 1 byte long");let o=256,s=new Int32Array(o);for(let l=0;l<o;l++)s[l]=-1;for(let l=0;l<i;l++)s[n[l]]=l;let a=s,u=this.byteLength-n.byteLength,c=n.byteLength-1,f;for(let l=r;l<=u;l+=f){f=0;for(let d=c;d>=0;d--){let h=this.get(l+d);if(n[d]!==h){f=Math.max(1,d-a[h]);break}}if(f===0)return l}return-1}getInt8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getInt8(0)}setInt8(e,r){let n=Pe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setInt8(0,r),this.write(n,e)}getInt16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt16(0,r)}setInt16(e,r,n){let i=ht(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt16(0,r,n),this.write(i,e)}getInt32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getInt32(0,r)}setInt32(e,r,n){let i=ht(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setInt32(0,r,n),this.write(i,e)}getBigInt64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigInt64(0,r)}setBigInt64(e,r,n){let i=ht(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigInt64(0,r,n),this.write(i,e)}getUint8(e){let r=this.subarray(e,e+1);return new DataView(r.buffer,r.byteOffset,r.byteLength).getUint8(0)}setUint8(e,r){let n=Pe(1);new DataView(n.buffer,n.byteOffset,n.byteLength).setUint8(0,r),this.write(n,e)}getUint16(e,r){let n=this.subarray(e,e+2);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint16(0,r)}setUint16(e,r,n){let i=ht(2);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint16(0,r,n),this.write(i,e)}getUint32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getUint32(0,r)}setUint32(e,r,n){let i=ht(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setUint32(0,r,n),this.write(i,e)}getBigUint64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getBigUint64(0,r)}setBigUint64(e,r,n){let i=ht(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setBigUint64(0,r,n),this.write(i,e)}getFloat32(e,r){let n=this.subarray(e,e+4);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat32(0,r)}setFloat32(e,r,n){let i=ht(4);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat32(0,r,n),this.write(i,e)}getFloat64(e,r){let n=this.subarray(e,e+8);return new DataView(n.buffer,n.byteOffset,n.byteLength).getFloat64(0,r)}setFloat64(e,r,n){let i=ht(8);new DataView(i.buffer,i.byteOffset,i.byteLength).setFloat64(0,r,n),this.write(i,e)}equals(e){if(e==null||!(e instanceof t)||e.bufs.length!==this.bufs.length)return!1;for(let r=0;r<this.bufs.length;r++)if(!Ue(this.bufs[r],e.bufs[r]))return!1;return!0}static fromUint8Arrays(e,r){let n=new t;return n.bufs=e,r==null&&(r=e.reduce((i,o)=>i+o.byteLength,0)),n.length=r,n}};function Q(t,e="utf8"){let r=bi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var Zy=parseInt("11111",2),bs=parseInt("10000000",2),Xy=parseInt("01111111",2),Gc={0:An,1:An,2:Qy,3:tb,4:rb,5:eb,6:Jy,16:An,22:An,48:An};function ms(t,e={offset:0}){let r=t[e.offset]&Zy;if(e.offset++,Gc[r]!=null)return Gc[r](t,e);throw new Error("No decoder for tag "+r)}function In(t,e){let r=0;if((t[e.offset]&bs)===bs){let n=t[e.offset]&Xy,i="0x";e.offset++;for(let o=0;o<n;o++,e.offset++)i+=t[e.offset].toString(16).padStart(2,"0");r=parseInt(i,16)}else r=t[e.offset],e.offset++;return r}function An(t,e){In(t,e);let r=[];for(;!(e.offset>=t.byteLength);){let n=ms(t,e);if(n===null)break;r.push(n)}return r}function Qy(t,e){let r=In(t,e),n=e.offset,i=e.offset+r,o=[];for(let s=n;s<i;s++)s===n&&t[s]===0||o.push(t[s]);return e.offset+=r,Uint8Array.from(o)}function Jy(t,e){let r=In(t,e),n=e.offset+r,i=t[e.offset];e.offset++;let o=0,s=0;i<40?(o=0,s=i):i<80?(o=1,s=i-40):(o=2,s=i-80);let a=`${o}.${s}`,u=[];for(;e.offset<n;){let c=t[e.offset];if(e.offset++,u.push(c&127),c<128){u.reverse();let f=0;for(let l=0;l<u.length;l++)f+=u[l]<<l*7;a+=`.${f}`,u=[]}}return a}function eb(t,e){return e.offset++,null}function tb(t,e){let r=In(t,e),n=t[e.offset];e.offset++;let i=t.subarray(e.offset,e.offset+r-1);if(e.offset+=r,n!==0)throw new Error("Unused bits in bit string is unimplemented");return i}function rb(t,e){let r=In(t,e),n=t.subarray(e.offset,e.offset+r);return e.offset+=r,n}function nb(t){let e=t.toString(16);e.length%2===1&&(e="0"+e);let r=new pe;for(let n=0;n<e.length;n+=2)r.append(Uint8Array.from([parseInt(`${e[n]}${e[n+1]}`,16)]));return r}function ws(t){if(t.byteLength<128)return Uint8Array.from([t.byteLength]);let e=nb(t.byteLength);return new pe(Uint8Array.from([e.byteLength|bs]),e)}function Yc(t){let e=new pe,r=128;return(t.subarray()[0]&r)===r&&e.append(Uint8Array.from([0])),e.append(t),new pe(Uint8Array.from([2]),ws(e),e)}function Zc(t){let e=Uint8Array.from([0]),r=new pe(e,t);return new pe(Uint8Array.from([3]),ws(r),r)}function Ai(t,e=48){let r=new pe;for(let n of t)r.append(n);return new pe(Uint8Array.from([e]),ws(r),r)}async function Xc(t,e,r,n){let i=await crypto.subtle.importKey("jwk",t,{name:"ECDSA",namedCurve:t.crv??"P-256"},!1,["verify"]);n?.signal?.throwIfAborted();let o=await crypto.subtle.verify({name:"ECDSA",hash:{name:"SHA-256"}},i,e,r.subarray());return n?.signal?.throwIfAborted(),o}var ib=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),ob=Uint8Array.from([6,5,43,129,4,0,34]),sb=Uint8Array.from([6,5,43,129,4,0,35]),ab={ext:!0,kty:"EC",crv:"P-256"},ub={ext:!0,kty:"EC",crv:"P-384"},cb={ext:!0,kty:"EC",crv:"P-521"},gs=32,xs=48,Es=66;function Qc(t){let e=ms(t);return Jc(e)}function Jc(t){let e=t[1][1][0],r=1,n,i;if(e.byteLength===gs*2+1)return n=W(e.subarray(r,r+gs),"base64url"),i=W(e.subarray(r+gs),"base64url"),new Cr({...ab,key_ops:["verify"],x:n,y:i});if(e.byteLength===xs*2+1)return n=W(e.subarray(r,r+xs),"base64url"),i=W(e.subarray(r+xs),"base64url"),new Cr({...ub,key_ops:["verify"],x:n,y:i});if(e.byteLength===Es*2+1)return n=W(e.subarray(r,r+Es),"base64url"),i=W(e.subarray(r+Es),"base64url"),new Cr({...cb,key_ops:["verify"],x:n,y:i});throw new Oe(`coordinates were wrong length, got ${e.byteLength}, expected 65, 97 or 133`)}function ef(t){return Ai([Yc(Uint8Array.from([1])),Ai([fb(t.crv)],160),Ai([Zc(new pe(Uint8Array.from([4]),Q(t.x??"","base64url"),Q(t.y??"","base64url")))],161)]).subarray()}function fb(t){if(t==="P-256")return ib;if(t==="P-384")return ob;if(t==="P-521")return sb;throw new Oe(`Invalid curve ${t}`)}var Cr=class{type="ECDSA";jwk;_raw;constructor(e){this.jwk=e}get raw(){return this._raw==null&&(this._raw=ef(this.jwk)),this._raw}toMultihash(){return je.digest(Dr(this))}toCID(){return le.createV1(114,this.toMultihash())}toString(){return oe.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ue(this.raw,e.raw)}async verify(e,r,n){return Xc(this.jwk,r,e,n)}};var er=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function bt(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function vn(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function De(t,...e){if(!bt(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Ii(t){if(typeof t!="function"||typeof t.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");vn(t.outputLen),vn(t.blockLen)}function Nr(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 rf(t,e){De(t);let r=e.outputLen;if(t.length<r)throw new Error("digestInto() expects output buffer of length at least "+r)}function mt(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function vi(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function ze(t,e){return t<<32-e|t>>>e}var nf=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",lb=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function $e(t){if(De(t),nf)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=lb[t[r]];return e}var yt={_0:48,_9:57,A:65,F:70,a:97,f:102};function tf(t){if(t>=yt._0&&t<=yt._9)return t-yt._0;if(t>=yt.A&&t<=yt.F)return t-(yt.A-10);if(t>=yt.a&&t<=yt.f)return t-(yt.a-10)}function tr(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);if(nf)return Uint8Array.fromHex(t);let e=t.length,r=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let i=0,o=0;i<r;i++,o+=2){let s=tf(t.charCodeAt(o)),a=tf(t.charCodeAt(o+1));if(s===void 0||a===void 0){let u=t[o]+t[o+1];throw new Error('hex string expected, got non-hex character "'+u+'" at index '+o)}n[i]=s*16+a}return n}function Ss(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function Tn(t){return typeof t=="string"&&(t=Ss(t)),De(t),t}function Te(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];De(i),e+=i.length}let r=new Uint8Array(e);for(let n=0,i=0;n<t.length;n++){let o=t[n];r.set(o,i),i+=o.length}return r}var Lr=class{};function _s(t){let e=n=>t().update(Tn(n)).digest(),r=t();return e.outputLen=r.outputLen,e.blockLen=r.blockLen,e.create=()=>t(),e}function Pr(t=32){if(er&&typeof er.getRandomValues=="function")return er.getRandomValues(new Uint8Array(t));if(er&&typeof er.randomBytes=="function")return Uint8Array.from(er.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function db(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),u=n?4:0,c=n?0:4;t.setUint32(e+u,s,n),t.setUint32(e+c,a,n)}function of(t,e,r){return t&e^~t&r}function sf(t,e,r){return t&e^t&r^e&r}var Bn=class extends Lr{constructor(e,r,n,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=vi(this.buffer)}update(e){Nr(this),e=Tn(e),De(e);let{view:r,buffer:n,blockLen:i}=this,o=e.length;for(let s=0;s<o;){let a=Math.min(i-this.pos,o-s);if(a===i){let u=vi(e);for(;i<=o-s;s+=i)this.process(u,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){Nr(this),rf(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,mt(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;db(n,i-8,BigInt(this.length*8),o),this.process(n,0);let a=vi(e),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let c=u/4,f=this.get();if(c>f.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<c;l++)a.setUint32(4*l,f[l],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.destroyed=s,e.finished=o,e.length=i,e.pos=a,i%r&&e.buffer.set(n),e}clone(){return this._cloneInto()}},wt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var ge=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]);var Ti=BigInt(4294967295),af=BigInt(32);function hb(t,e=!1){return e?{h:Number(t&Ti),l:Number(t>>af&Ti)}:{h:Number(t>>af&Ti)|0,l:Number(t&Ti)|0}}function uf(t,e=!1){let r=t.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let o=0;o<r;o++){let{h:s,l:a}=hb(t[o],e);[n[o],i[o]]=[s,a]}return[n,i]}var As=(t,e,r)=>t>>>r,Is=(t,e,r)=>t<<32-r|e>>>r,rr=(t,e,r)=>t>>>r|e<<32-r,nr=(t,e,r)=>t<<32-r|e>>>r,Rn=(t,e,r)=>t<<64-r|e>>>r-32,Cn=(t,e,r)=>t>>>r-32|e<<64-r;function et(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var cf=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),ff=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,lf=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),df=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,hf=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),pf=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var yb=Uint32Array.from([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]),Ft=new Uint32Array(64),vs=class extends Bn{constructor(e=32){super(64,e,8,!1),this.A=wt[0]|0,this.B=wt[1]|0,this.C=wt[2]|0,this.D=wt[3]|0,this.E=wt[4]|0,this.F=wt[5]|0,this.G=wt[6]|0,this.H=wt[7]|0}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:u}=this;return[e,r,n,i,o,s,a,u]}set(e,r,n,i,o,s,a,u){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=u|0}process(e,r){for(let l=0;l<16;l++,r+=4)Ft[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let d=Ft[l-15],h=Ft[l-2],p=ze(d,7)^ze(d,18)^d>>>3,y=ze(h,17)^ze(h,19)^h>>>10;Ft[l]=y+Ft[l-7]+p+Ft[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:u,G:c,H:f}=this;for(let l=0;l<64;l++){let d=ze(a,6)^ze(a,11)^ze(a,25),h=f+d+of(a,u,c)+yb[l]+Ft[l]|0,y=(ze(n,2)^ze(n,13)^ze(n,22))+sf(n,i,o)|0;f=c,c=u,u=a,a=s+h|0,s=o,o=i,i=n,n=h+y|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,u=u+this.F|0,c=c+this.G|0,f=f+this.H|0,this.set(n,i,o,s,a,u,c,f)}roundClean(){mt(Ft)}destroy(){this.set(0,0,0,0,0,0,0,0),mt(this.buffer)}};var yf=uf(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(t=>BigInt(t))),bb=yf[0],mb=yf[1],qt=new Uint32Array(80),Ht=new Uint32Array(80),Ts=class extends Bn{constructor(e=64){super(128,e,16,!1),this.Ah=ge[0]|0,this.Al=ge[1]|0,this.Bh=ge[2]|0,this.Bl=ge[3]|0,this.Ch=ge[4]|0,this.Cl=ge[5]|0,this.Dh=ge[6]|0,this.Dl=ge[7]|0,this.Eh=ge[8]|0,this.El=ge[9]|0,this.Fh=ge[10]|0,this.Fl=ge[11]|0,this.Gh=ge[12]|0,this.Gl=ge[13]|0,this.Hh=ge[14]|0,this.Hl=ge[15]|0}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:u,Eh:c,El:f,Fh:l,Fl:d,Gh:h,Gl:p,Hh:y,Hl:_}=this;return[e,r,n,i,o,s,a,u,c,f,l,d,h,p,y,_]}set(e,r,n,i,o,s,a,u,c,f,l,d,h,p,y,_){this.Ah=e|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=u|0,this.Eh=c|0,this.El=f|0,this.Fh=l|0,this.Fl=d|0,this.Gh=h|0,this.Gl=p|0,this.Hh=y|0,this.Hl=_|0}process(e,r){for(let w=0;w<16;w++,r+=4)qt[w]=e.getUint32(r),Ht[w]=e.getUint32(r+=4);for(let w=16;w<80;w++){let I=qt[w-15]|0,T=Ht[w-15]|0,F=rr(I,T,1)^rr(I,T,8)^As(I,T,7),U=nr(I,T,1)^nr(I,T,8)^Is(I,T,7),P=qt[w-2]|0,S=Ht[w-2]|0,B=rr(P,S,19)^Rn(P,S,61)^As(P,S,6),k=nr(P,S,19)^Cn(P,S,61)^Is(P,S,6),C=lf(U,k,Ht[w-7],Ht[w-16]),g=df(C,F,B,qt[w-7],qt[w-16]);qt[w]=g|0,Ht[w]=C|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:u,Dh:c,Dl:f,Eh:l,El:d,Fh:h,Fl:p,Gh:y,Gl:_,Hh:b,Hl:A}=this;for(let w=0;w<80;w++){let I=rr(l,d,14)^rr(l,d,18)^Rn(l,d,41),T=nr(l,d,14)^nr(l,d,18)^Cn(l,d,41),F=l&h^~l&y,U=d&p^~d&_,P=hf(A,T,U,mb[w],Ht[w]),S=pf(P,b,I,F,bb[w],qt[w]),B=P|0,k=rr(n,i,28)^Rn(n,i,34)^Rn(n,i,39),C=nr(n,i,28)^Cn(n,i,34)^Cn(n,i,39),g=n&o^n&a^o&a,x=i&s^i&u^s&u;b=y|0,A=_|0,y=h|0,_=p|0,h=l|0,p=d|0,{h:l,l:d}=et(c|0,f|0,S|0,B|0),c=a|0,f=u|0,a=o|0,u=s|0,o=n|0,s=i|0;let E=cf(B,C,x);n=ff(E,S,k,g),i=E|0}({h:n,l:i}=et(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=et(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:u}=et(this.Ch|0,this.Cl|0,a|0,u|0),{h:c,l:f}=et(this.Dh|0,this.Dl|0,c|0,f|0),{h:l,l:d}=et(this.Eh|0,this.El|0,l|0,d|0),{h,l:p}=et(this.Fh|0,this.Fl|0,h|0,p|0),{h:y,l:_}=et(this.Gh|0,this.Gl|0,y|0,_|0),{h:b,l:A}=et(this.Hh|0,this.Hl|0,b|0,A|0),this.set(n,i,o,s,a,u,c,f,l,d,h,p,y,_,b,A)}roundClean(){mt(qt,Ht)}destroy(){mt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var bf=_s(()=>new vs);var mf=_s(()=>new Ts);var Cs=BigInt(0),Rs=BigInt(1);function gt(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}"`;throw new Error(r+"expected boolean, got type="+typeof t)}return t}function ke(t,e,r=""){let n=bt(t),i=t?.length,o=e!==void 0;if(!n||o&&i!==e){let s=r&&`"${r}" `,a=o?` of length ${e}`:"",u=n?`length=${i}`:`type=${typeof t}`;throw new Error(s+"expected Uint8Array"+a+", got "+u)}return t}function Dn(t){let e=t.toString(16);return e.length&1?"0"+e:e}function wf(t){if(typeof t!="string")throw new Error("hex string expected, got "+typeof t);return t===""?Cs:BigInt("0x"+t)}function Or(t){return wf($e(t))}function xt(t){return De(t),wf($e(Uint8Array.from(t).reverse()))}function Bi(t,e){return tr(t.toString(16).padStart(e*2,"0"))}function Ds(t,e){return Bi(t,e).reverse()}function j(t,e,r){let n;if(typeof e=="string")try{n=tr(e)}catch(o){throw new Error(t+" must be hex string or Uint8Array, cause: "+o)}else if(bt(e))n=Uint8Array.from(e);else throw new Error(t+" must be hex string or Uint8Array");let i=n.length;if(typeof r=="number"&&i!==r)throw new Error(t+" of length "+r+" expected, got "+i);return n}function gf(t,e){if(t.length!==e.length)return!1;let r=0;for(let n=0;n<t.length;n++)r|=t[n]^e[n];return r===0}function Ls(t){return Uint8Array.from(t)}var Bs=t=>typeof t=="bigint"&&Cs<=t;function xf(t,e,r){return Bs(t)&&Bs(e)&&Bs(r)&&e<=t&&t<r}function Ln(t,e,r,n){if(!xf(e,r,n))throw new Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Ri(t){let e;for(e=0;t>Cs;t>>=Rs,e+=1);return e}var $t=t=>(Rs<<BigInt(t))-Rs;function Ef(t,e,r){if(typeof t!="number"||t<2)throw new Error("hashLen must be a number");if(typeof e!="number"||e<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=h=>new Uint8Array(h),i=h=>Uint8Array.of(h),o=n(t),s=n(t),a=0,u=()=>{o.fill(1),s.fill(0),a=0},c=(...h)=>r(s,o,...h),f=(h=n(0))=>{s=c(i(0),h),o=c(),h.length!==0&&(s=c(i(1),h),o=c())},l=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let h=0,p=[];for(;h<e;){o=c();let y=o.slice();p.push(y),h+=o.length}return Te(...p)};return(h,p)=>{u(),f(h);let y;for(;!(y=p(l()));)f();return u(),y}}function Kt(t,e,r={}){if(!t||typeof t!="object")throw new Error("expected valid options object");function n(i,o,s){let a=t[i];if(s&&a===void 0)return;let u=typeof a;if(u!==o||a===null)throw new Error(`param "${i}" is invalid: expected ${o}, got ${u}`)}Object.entries(e).forEach(([i,o])=>n(i,o,!1)),Object.entries(r).forEach(([i,o])=>n(i,o,!0))}var Ns=()=>{throw new Error("not implemented")};function Ur(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(i!==void 0)return i;let o=t(r,...n);return e.set(r,o),o}}var Be=BigInt(0),ye=BigInt(1),ir=BigInt(2),Af=BigInt(3),If=BigInt(4),vf=BigInt(5),wb=BigInt(7),Tf=BigInt(8),gb=BigInt(9),Bf=BigInt(16);function se(t,e){let r=t%e;return r>=Be?r:e+r}function Z(t,e,r){let n=t;for(;e-- >Be;)n*=n,n%=r;return n}function Sf(t,e){if(t===Be)throw new Error("invert: expected non-zero number");if(e<=Be)throw new Error("invert: expected positive modulus, got "+e);let r=se(t,e),n=e,i=Be,o=ye,s=ye,a=Be;for(;r!==Be;){let c=n/r,f=n%r,l=i-s*c,d=o-a*c;n=r,r=f,i=s,o=a,s=l,a=d}if(n!==ye)throw new Error("invert: does not exist");return se(i,e)}function Ps(t,e,r){if(!t.eql(t.sqr(e),r))throw new Error("Cannot find square root")}function Rf(t,e){let r=(t.ORDER+ye)/If,n=t.pow(e,r);return Ps(t,n,e),n}function xb(t,e){let r=(t.ORDER-vf)/Tf,n=t.mul(e,ir),i=t.pow(n,r),o=t.mul(e,i),s=t.mul(t.mul(o,ir),i),a=t.mul(o,t.sub(s,t.ONE));return Ps(t,a,e),a}function Eb(t){let e=Me(t),r=Cf(t),n=r(e,e.neg(e.ONE)),i=r(e,n),o=r(e,e.neg(n)),s=(t+wb)/Bf;return(a,u)=>{let c=a.pow(u,s),f=a.mul(c,n),l=a.mul(c,i),d=a.mul(c,o),h=a.eql(a.sqr(f),u),p=a.eql(a.sqr(l),u);c=a.cmov(c,f,h),f=a.cmov(d,l,p);let y=a.eql(a.sqr(f),u),_=a.cmov(c,f,y);return Ps(a,_,u),_}}function Cf(t){if(t<Af)throw new Error("sqrt is not defined for small field");let e=t-ye,r=0;for(;e%ir===Be;)e/=ir,r++;let n=ir,i=Me(t);for(;_f(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return Rf;let o=i.pow(n,e),s=(e+ye)/ir;return function(u,c){if(u.is0(c))return c;if(_f(u,c)!==1)throw new Error("Cannot find square root");let f=r,l=u.mul(u.ONE,o),d=u.pow(c,e),h=u.pow(c,s);for(;!u.eql(d,u.ONE);){if(u.is0(d))return u.ZERO;let p=1,y=u.sqr(d);for(;!u.eql(y,u.ONE);)if(p++,y=u.sqr(y),p===f)throw new Error("Cannot find square root");let _=ye<<BigInt(f-p-1),b=u.pow(l,_);f=p,l=u.sqr(b),d=u.mul(d,l),h=u.mul(h,b)}return h}}function Sb(t){return t%If===Af?Rf:t%Tf===vf?xb:t%Bf===gb?Eb(t):Cf(t)}var Et=(t,e)=>(se(t,e)&ye)===ye,_b=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Os(t){let e={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},r=_b.reduce((n,i)=>(n[i]="function",n),e);return Kt(t,r),t}function Ab(t,e,r){if(r<Be)throw new Error("invalid exponent, negatives unsupported");if(r===Be)return t.ONE;if(r===ye)return e;let n=t.ONE,i=e;for(;r>Be;)r&ye&&(n=t.mul(n,i)),i=t.sqr(i),r>>=ye;return n}function Nn(t,e,r=!1){let n=new Array(e.length).fill(r?t.ZERO:void 0),i=e.reduce((s,a,u)=>t.is0(a)?s:(n[u]=s,t.mul(s,a)),t.ONE),o=t.inv(i);return e.reduceRight((s,a,u)=>t.is0(a)?s:(n[u]=t.mul(s,n[u]),t.mul(s,a)),o),n}function _f(t,e){let r=(t.ORDER-ye)/ir,n=t.pow(e,r),i=t.eql(n,t.ONE),o=t.eql(n,t.ZERO),s=t.eql(n,t.neg(t.ONE));if(!i&&!o&&!s)throw new Error("invalid Legendre symbol result");return i?1:o?0:-1}function Ci(t,e){e!==void 0&&vn(e);let r=e!==void 0?e:t.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function Me(t,e,r=!1,n={}){if(t<=Be)throw new Error("invalid field: expected ORDER > 0, got "+t);let i,o,s=!1,a;if(typeof e=="object"&&e!=null){if(n.sqrt||r)throw new Error("cannot specify opts in two arguments");let d=e;d.BITS&&(i=d.BITS),d.sqrt&&(o=d.sqrt),typeof d.isLE=="boolean"&&(r=d.isLE),typeof d.modFromBytes=="boolean"&&(s=d.modFromBytes),a=d.allowedLengths}else typeof e=="number"&&(i=e),n.sqrt&&(o=n.sqrt);let{nBitLength:u,nByteLength:c}=Ci(t,i);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let f,l=Object.freeze({ORDER:t,isLE:r,BITS:u,BYTES:c,MASK:$t(u),ZERO:Be,ONE:ye,allowedLengths:a,create:d=>se(d,t),isValid:d=>{if(typeof d!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof d);return Be<=d&&d<t},is0:d=>d===Be,isValidNot0:d=>!l.is0(d)&&l.isValid(d),isOdd:d=>(d&ye)===ye,neg:d=>se(-d,t),eql:(d,h)=>d===h,sqr:d=>se(d*d,t),add:(d,h)=>se(d+h,t),sub:(d,h)=>se(d-h,t),mul:(d,h)=>se(d*h,t),pow:(d,h)=>Ab(l,d,h),div:(d,h)=>se(d*Sf(h,t),t),sqrN:d=>d*d,addN:(d,h)=>d+h,subN:(d,h)=>d-h,mulN:(d,h)=>d*h,inv:d=>Sf(d,t),sqrt:o||(d=>(f||(f=Sb(t)),f(l,d))),toBytes:d=>r?Ds(d,c):Bi(d,c),fromBytes:(d,h=!0)=>{if(a){if(!a.includes(d.length)||d.length>c)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+d.length);let y=new Uint8Array(c);y.set(d,r?0:y.length-d.length),d=y}if(d.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+d.length);let p=r?xt(d):Or(d);if(s&&(p=se(p,t)),!h&&!l.isValid(p))throw new Error("invalid field element: outside of range 0..ORDER");return p},invertBatch:d=>Nn(l,d),cmov:(d,h,p)=>p?h:d});return Object.freeze(l)}function Df(t){if(typeof t!="bigint")throw new Error("field order must be bigint");let e=t.toString(2).length;return Math.ceil(e/8)}function Us(t){let e=Df(t);return e+Math.ceil(e/2)}function ks(t,e,r=!1){let n=t.length,i=Df(e),o=Us(e);if(n<16||n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?xt(t):Or(t),a=se(s,e-ye)+ye;return r?Ds(a,i):Bi(a,i)}var kr=BigInt(0),or=BigInt(1);function Pn(t,e){let r=e.negate();return t?r:e}function St(t,e){let r=Nn(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function Of(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Ms(t,e){Of(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,o=$t(t),s=BigInt(t);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function Lf(t,e,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r,a=Number(t&i),u=t>>s;a>n&&(a-=o,u+=or);let c=e*n,f=c+Math.abs(a)-1,l=a===0,d=a<0,h=e%2!==0;return{nextN:u,offset:f,isZero:l,isNeg:d,isNegF:h,offsetF:c}}function Ib(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((r,n)=>{if(!(r instanceof e))throw new Error("invalid point at index "+n)})}function vb(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((r,n)=>{if(!e.isValid(r))throw new Error("invalid scalar at index "+n)})}var Fs=new WeakMap,Uf=new WeakMap;function qs(t){return Uf.get(t)||1}function Nf(t){if(t!==kr)throw new Error("invalid wNAF")}var Mr=class{constructor(e,r){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=r}_unsafeLadder(e,r,n=this.ZERO){let i=e;for(;r>kr;)r&or&&(n=n.add(i)),i=i.double(),r>>=or;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=Ms(r,this.bits),o=[],s=e,a=s;for(let u=0;u<n;u++){a=s,o.push(a);for(let c=1;c<i;c++)a=a.add(s),o.push(a);s=a.double()}return o}wNAF(e,r,n){if(!this.Fn.isValid(n))throw new Error("invalid scalar");let i=this.ZERO,o=this.BASE,s=Ms(e,this.bits);for(let a=0;a<s.windows;a++){let{nextN:u,offset:c,isZero:f,isNeg:l,isNegF:d,offsetF:h}=Lf(n,a,s);n=u,f?o=o.add(Pn(d,r[h])):i=i.add(Pn(l,r[c]))}return Nf(n),{p:i,f:o}}wNAFUnsafe(e,r,n,i=this.ZERO){let o=Ms(e,this.bits);for(let s=0;s<o.windows&&n!==kr;s++){let{nextN:a,offset:u,isZero:c,isNeg:f}=Lf(n,s,o);if(n=a,!c){let l=r[u];i=i.add(f?l.negate():l)}}return Nf(n),i}getPrecomputes(e,r,n){let i=Fs.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),Fs.set(r,i))),i}cached(e,r,n){let i=qs(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let o=qs(e);return o===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),r,i)}createCache(e,r){Of(r,this.bits),Uf.set(e,r),Fs.delete(e)}hasCache(e){return qs(e)!==1}};function kf(t,e,r,n){let i=e,o=t.ZERO,s=t.ZERO;for(;r>kr||n>kr;)r&or&&(o=o.add(i)),n&or&&(s=s.add(i)),i=i.double(),r>>=or,n>>=or;return{p1:o,p2:s}}function Fr(t,e,r,n){Ib(r,t),vb(n,e);let i=r.length,o=n.length;if(i!==o)throw new Error("arrays of points and scalars must have equal length");let s=t.ZERO,a=Ri(BigInt(i)),u=1;a>12?u=a-3:a>4?u=a-2:a>0&&(u=2);let c=$t(u),f=new Array(Number(c)+1).fill(s),l=Math.floor((e.BITS-1)/u)*u,d=s;for(let h=l;h>=0;h-=u){f.fill(s);for(let y=0;y<o;y++){let _=n[y],b=Number(_>>BigInt(h)&c);f[b]=f[b].add(r[y])}let p=s;for(let y=f.length-1,_=s;y>0;y--)_=_.add(f[y]),p=p.add(_);if(d=d.add(p),h!==0)for(let y=0;y<u;y++)d=d.double()}return d}function Pf(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Os(e),e}else return Me(t,{isLE:r})}function Di(t,e,r={},n){if(n===void 0&&(n=t==="edwards"),!e||typeof e!="object")throw new Error(`expected valid ${t} CURVE object`);for(let u of["p","n","h"]){let c=e[u];if(!(typeof c=="bigint"&&c>kr))throw new Error(`CURVE.${u} must be positive bigint`)}let i=Pf(e.p,r.Fp,n),o=Pf(e.n,r.Fn,n),a=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let u of a)if(!i.isValid(e[u]))throw new Error(`CURVE.${u} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:o}}var Vt=BigInt(0),be=BigInt(1),Hs=BigInt(2),Tb=BigInt(8);function Bb(t,e,r,n){let i=t.sqr(r),o=t.sqr(n),s=t.add(t.mul(e.a,i),o),a=t.add(t.ONE,t.mul(e.d,t.mul(i,o)));return t.eql(s,a)}function Rb(t,e={}){let r=Di("edwards",t,e,e.FpFnLE),{Fp:n,Fn:i}=r,o=r.CURVE,{h:s}=o;Kt(e,{},{uvRatio:"function"});let a=Hs<<BigInt(i.BYTES*8)-be,u=_=>n.create(_),c=e.uvRatio||((_,b)=>{try{return{isValid:!0,value:n.sqrt(n.div(_,b))}}catch{return{isValid:!1,value:Vt}}});if(!Bb(n,o,o.Gx,o.Gy))throw new Error("bad curve params: generator point");function f(_,b,A=!1){let w=A?be:Vt;return Ln("coordinate "+_,b,w,a),b}function l(_){if(!(_ instanceof p))throw new Error("ExtendedPoint expected")}let d=Ur((_,b)=>{let{X:A,Y:w,Z:I}=_,T=_.is0();b==null&&(b=T?Tb:n.inv(I));let F=u(A*b),U=u(w*b),P=n.mul(I,b);if(T)return{x:Vt,y:be};if(P!==be)throw new Error("invZ was invalid");return{x:F,y:U}}),h=Ur(_=>{let{a:b,d:A}=o;if(_.is0())throw new Error("bad point: ZERO");let{X:w,Y:I,Z:T,T:F}=_,U=u(w*w),P=u(I*I),S=u(T*T),B=u(S*S),k=u(U*b),C=u(S*u(k+P)),g=u(B+u(A*u(U*P)));if(C!==g)throw new Error("bad point: equation left != right (1)");let x=u(w*I),E=u(T*F);if(x!==E)throw new Error("bad point: equation left != right (2)");return!0});class p{constructor(b,A,w,I){this.X=f("x",b),this.Y=f("y",A),this.Z=f("z",w,!0),this.T=f("t",I),Object.freeze(this)}static CURVE(){return o}static fromAffine(b){if(b instanceof p)throw new Error("extended point not allowed");let{x:A,y:w}=b||{};return f("x",A),f("y",w),new p(A,w,be,u(A*w))}static fromBytes(b,A=!1){let w=n.BYTES,{a:I,d:T}=o;b=Ls(ke(b,w,"point")),gt(A,"zip215");let F=Ls(b),U=b[w-1];F[w-1]=U&-129;let P=xt(F),S=A?a:n.ORDER;Ln("point.y",P,Vt,S);let B=u(P*P),k=u(B-be),C=u(T*B-I),{isValid:g,value:x}=c(k,C);if(!g)throw new Error("bad point: invalid y coordinate");let E=(x&be)===be,v=(U&128)!==0;if(!A&&x===Vt&&v)throw new Error("bad point: x=0 and x_0=1");return v!==E&&(x=u(-x)),p.fromAffine({x,y:P})}static fromHex(b,A=!1){return p.fromBytes(j("point",b),A)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(b=8,A=!0){return y.createCache(this,b),A||this.multiply(Hs),this}assertValidity(){h(this)}equals(b){l(b);let{X:A,Y:w,Z:I}=this,{X:T,Y:F,Z:U}=b,P=u(A*U),S=u(T*I),B=u(w*U),k=u(F*I);return P===S&&B===k}is0(){return this.equals(p.ZERO)}negate(){return new p(u(-this.X),this.Y,this.Z,u(-this.T))}double(){let{a:b}=o,{X:A,Y:w,Z:I}=this,T=u(A*A),F=u(w*w),U=u(Hs*u(I*I)),P=u(b*T),S=A+w,B=u(u(S*S)-T-F),k=P+F,C=k-U,g=P-F,x=u(B*C),E=u(k*g),v=u(B*g),R=u(C*k);return new p(x,E,R,v)}add(b){l(b);let{a:A,d:w}=o,{X:I,Y:T,Z:F,T:U}=this,{X:P,Y:S,Z:B,T:k}=b,C=u(I*P),g=u(T*S),x=u(U*w*k),E=u(F*B),v=u((I+T)*(P+S)-C-g),R=E-x,O=E+x,L=u(g-A*C),N=u(v*R),M=u(O*L),q=u(v*L),te=u(R*O);return new p(N,M,te,q)}subtract(b){return this.add(b.negate())}multiply(b){if(!i.isValidNot0(b))throw new Error("invalid scalar: expected 1 <= sc < curve.n");let{p:A,f:w}=y.cached(this,b,I=>St(p,I));return St(p,[A,w])[0]}multiplyUnsafe(b,A=p.ZERO){if(!i.isValid(b))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return b===Vt?p.ZERO:this.is0()||b===be?this:y.unsafe(this,b,w=>St(p,w),A)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}isTorsionFree(){return y.unsafe(this,o.n).is0()}toAffine(b){return d(this,b)}clearCofactor(){return s===be?this:this.multiplyUnsafe(s)}toBytes(){let{x:b,y:A}=this.toAffine(),w=n.toBytes(A);return w[w.length-1]|=b&be?128:0,w}toHex(){return $e(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(b){return St(p,b)}static msm(b,A){return Fr(p,i,b,A)}_setWindowSize(b){this.precompute(b)}toRawBytes(){return this.toBytes()}}p.BASE=new p(o.Gx,o.Gy,be,u(o.Gx*o.Gy)),p.ZERO=new p(Vt,be,be,Vt),p.Fp=n,p.Fn=i;let y=new Mr(p,i.BITS);return p.BASE.precompute(8),p}var Li=class{constructor(e){this.ep=e}static fromBytes(e){Ns()}static fromHex(e){Ns()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return $e(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,r){return this.init(this.ep.precompute(e,r))}toRawBytes(){return this.toBytes()}};function Cb(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');Kt(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:i,Fp:o,Fn:s}=t,a=r.randomBytes||Pr,u=r.adjustScalarBytes||(S=>S),c=r.domain||((S,B,k)=>{if(gt(k,"phflag"),B.length||k)throw new Error("Contexts/pre-hash are not supported");return S});function f(S){return s.create(xt(S))}function l(S){let B=w.secretKey;S=j("private key",S,B);let k=j("hashed private key",e(S),2*B),C=u(k.slice(0,B)),g=k.slice(B,2*B),x=f(C);return{head:C,prefix:g,scalar:x}}function d(S){let{head:B,prefix:k,scalar:C}=l(S),g=i.multiply(C),x=g.toBytes();return{head:B,prefix:k,scalar:C,point:g,pointBytes:x}}function h(S){return d(S).pointBytes}function p(S=Uint8Array.of(),...B){let k=Te(...B);return f(e(c(k,j("context",S),!!n)))}function y(S,B,k={}){S=j("message",S),n&&(S=n(S));let{prefix:C,scalar:g,pointBytes:x}=d(B),E=p(k.context,C,S),v=i.multiply(E).toBytes(),R=p(k.context,v,x,S),O=s.create(E+R*g);if(!s.isValid(O))throw new Error("sign failed: invalid s");let L=Te(v,s.toBytes(O));return ke(L,w.signature,"result")}let _={zip215:!0};function b(S,B,k,C=_){let{context:g,zip215:x}=C,E=w.signature;S=j("signature",S,E),B=j("message",B),k=j("publicKey",k,w.publicKey),x!==void 0&&gt(x,"zip215"),n&&(B=n(B));let v=E/2,R=S.subarray(0,v),O=xt(S.subarray(v,E)),L,N,M;try{L=t.fromBytes(k,x),N=t.fromBytes(R,x),M=i.multiplyUnsafe(O)}catch{return!1}if(!x&&L.isSmallOrder())return!1;let q=p(g,N.toBytes(),L.toBytes(),B);return N.add(L.multiplyUnsafe(q)).subtract(M).clearCofactor().is0()}let A=o.BYTES,w={secretKey:A,publicKey:A,signature:2*A,seed:A};function I(S=a(w.seed)){return ke(S,w.seed,"seed")}function T(S){let B=P.randomSecretKey(S);return{secretKey:B,publicKey:h(B)}}function F(S){return bt(S)&&S.length===s.BYTES}function U(S,B){try{return!!t.fromBytes(S,B)}catch{return!1}}let P={getExtendedPublicKey:d,randomSecretKey:I,isValidSecretKey:F,isValidPublicKey:U,toMontgomery(S){let{y:B}=t.fromBytes(S),k=w.publicKey,C=k===32;if(!C&&k!==57)throw new Error("only defined for 25519 and 448");let g=C?o.div(be+B,be-B):o.div(B-be,B+be);return o.toBytes(g)},toMontgomeryPriv(S){let B=w.secretKey;ke(S,B);let k=e(S.subarray(0,B));return u(k).subarray(0,B)},randomPrivateKey:I,precompute(S=8,B=t.BASE){return B.precompute(S,!1)}};return Object.freeze({keygen:T,getPublicKey:h,sign:y,verify:b,utils:P,Point:t,lengths:w})}function Db(t){let e={a:t.a,d:t.d,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=Me(e.n,t.nBitLength,!0),i={Fp:r,Fn:n,uvRatio:t.uvRatio},o={randomBytes:t.randomBytes,adjustScalarBytes:t.adjustScalarBytes,domain:t.domain,prehash:t.prehash,mapToCurve:t.mapToCurve};return{CURVE:e,curveOpts:i,hash:t.hash,eddsaOpts:o}}function Lb(t,e){let r=e.Point;return Object.assign({},e,{ExtendedPoint:r,CURVE:t,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}function Mf(t){let{CURVE:e,curveOpts:r,hash:n,eddsaOpts:i}=Db(t),o=Rb(e,r),s=Cb(o,n,i);return Lb(t,s)}var Nb=BigInt(0),_t=BigInt(1),Ff=BigInt(2),f8=BigInt(3),Pb=BigInt(5),Ob=BigInt(8),qr=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),On={p:qr,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Ob,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Ub(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=qr,a=t*t%o*t%o,u=Z(a,Ff,o)*a%o,c=Z(u,_t,o)*t%o,f=Z(c,Pb,o)*c%o,l=Z(f,e,o)*f%o,d=Z(l,r,o)*l%o,h=Z(d,n,o)*d%o,p=Z(h,i,o)*h%o,y=Z(p,i,o)*h%o,_=Z(y,e,o)*f%o;return{pow_p_5_8:Z(_,Ff,o)*t%o,b2:a}}function kb(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var $s=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Ws(t,e){let r=qr,n=se(e*e*e,r),i=se(n*n*e,r),o=Ub(t*i).pow_p_5_8,s=se(t*n*o,r),a=se(e*s*s,r),u=s,c=se(s*$s,r),f=a===t,l=a===se(-t,r),d=a===se(-t*$s,r);return f&&(s=u),(l||d)&&(s=c),Et(s,r)&&(s=se(-s,r)),{isValid:f||l,value:s}}var Wt=Me(On.p,{isLE:!0}),Mb=Me(On.n,{isLE:!0}),Fb={...On,Fp:Wt,hash:mf,adjustScalarBytes:kb,uvRatio:Ws},At=Mf(Fb);var Ks=$s,qb=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),Hb=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),$b=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Kb=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),qf=t=>Ws(_t,t),Vb=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Vs=t=>At.Point.Fp.create(xt(t)&Vb);function Hf(t){let{d:e}=On,r=qr,n=b=>Wt.create(b),i=n(Ks*t*t),o=n((i+_t)*$b),s=BigInt(-1),a=n((s-e*i)*n(i+e)),{isValid:u,value:c}=Ws(o,a),f=n(c*t);Et(f,r)||(f=n(-f)),u||(c=f),u||(s=i);let l=n(s*(i-_t)*Kb-a),d=c*c,h=n((c+c)*a),p=n(l*qb),y=n(_t-d),_=n(_t+d);return new At.Point(n(h*_),n(y*p),n(p*_),n(h*y))}function Wb(t){De(t,64);let e=Vs(t.subarray(0,32)),r=Hf(e),n=Vs(t.subarray(32,64)),i=Hf(n);return new It(r.add(i))}var It=class t extends Li{constructor(e){super(e)}static fromAffine(e){return new t(At.Point.fromAffine(e))}assertSame(e){if(!(e instanceof t))throw new Error("RistrettoPoint expected")}init(e){return new t(e)}static hashToCurve(e){return Wb(j("ristrettoHash",e,64))}static fromBytes(e){De(e,32);let{a:r,d:n}=On,i=qr,o=I=>Wt.create(I),s=Vs(e);if(!gf(Wt.toBytes(s),e)||Et(s,i))throw new Error("invalid ristretto255 encoding 1");let a=o(s*s),u=o(_t+r*a),c=o(_t-r*a),f=o(u*u),l=o(c*c),d=o(r*n*f-l),{isValid:h,value:p}=qf(o(d*l)),y=o(p*c),_=o(p*y*d),b=o((s+s)*y);Et(b,i)&&(b=o(-b));let A=o(u*_),w=o(b*A);if(!h||Et(w,i)||A===Nb)throw new Error("invalid ristretto255 encoding 2");return new t(new At.Point(b,A,_t,w))}static fromHex(e){return t.fromBytes(j("ristrettoHex",e,32))}static msm(e,r){return Fr(t,At.Point.Fn,e,r)}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,o=qr,s=_=>Wt.create(_),a=s(s(n+r)*s(n-r)),u=s(e*r),c=s(u*u),{value:f}=qf(s(a*c)),l=s(f*a),d=s(f*u),h=s(l*d*i),p;if(Et(i*h,o)){let _=s(r*Ks),b=s(e*Ks);e=_,r=b,p=s(l*Hb)}else p=d;Et(e*h,o)&&(r=s(-r));let y=s((n-r)*p);return Et(y,o)&&(y=s(-y)),Wt.toBytes(y)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:o}=e.ep,s=c=>Wt.create(c),a=s(r*o)===s(n*i),u=s(n*o)===s(r*i);return a||u}is0(){return this.equals(t.ZERO)}};It.BASE=new It(At.Point.BASE);It.ZERO=new It(At.Point.ZERO);It.Fp=Wt;It.Fn=Mb;var Un=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}},Ni=class extends Error{constructor(e="Missing Web Crypto API"){super(e),this.name="WebCryptoMissingError"}};var $f={get(t=globalThis){let e=t.crypto;if(e?.subtle==null)throw new Ni("Missing Web Crypto API. The most likely cause of this error is that this page is being accessed from an insecure context (i.e. not HTTPS). For more information and possible resolutions see https://github.com/libp2p/js-libp2p/blob/main/packages/crypto/README.md#web-crypto-api");return e}};var Pi=$f;var Oi=32;var js,jb=(async()=>{try{return await Pi.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})();async function zb(t,e,r){if(t.buffer instanceof ArrayBuffer){let n=await Pi.get().subtle.importKey("raw",t.buffer,{name:"Ed25519"},!1,["verify"]);return await Pi.get().subtle.verify({name:"Ed25519"},n,e,r instanceof Uint8Array?r:r.subarray())}throw new TypeError("WebCrypto does not support SharedArrayBuffer for Ed25519 keys")}function Gb(t,e,r){return At.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}async function Kf(t,e,r){return js==null&&(js=await jb),js?zb(t,e,r):Gb(t,e,r)}function Ui(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}var ki=class{type="Ed25519";raw;constructor(e){this.raw=zs(e,Oi)}toMultihash(){return je.digest(Dr(this))}toCID(){return le.createV1(114,this.toMultihash())}toString(){return oe.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ue(this.raw,e.raw)}verify(e,r,n){n?.signal?.throwIfAborted();let i=Kf(this.raw,r,e);return Ui(i)?i.then(o=>(n?.signal?.throwIfAborted(),o)):i}};function Wf(t){return t=zs(t,Oi),new ki(t)}function zs(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new Oe(`Key must be a Uint8Array of length ${e}, got ${t.length}`);return t}var Zb=Math.pow(2,7),Xb=Math.pow(2,14),Qb=Math.pow(2,21),Gs=Math.pow(2,28),Ys=Math.pow(2,35),Zs=Math.pow(2,42),Xs=Math.pow(2,49),J=128,_e=127;function tt(t){if(t<Zb)return 1;if(t<Xb)return 2;if(t<Qb)return 3;if(t<Gs)return 4;if(t<Ys)return 5;if(t<Zs)return 6;if(t<Xs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function kn(t,e,r=0){switch(tt(t)){case 8:e[r++]=t&255|J,t/=128;case 7:e[r++]=t&255|J,t/=128;case 6:e[r++]=t&255|J,t/=128;case 5:e[r++]=t&255|J,t/=128;case 4:e[r++]=t&255|J,t>>>=7;case 3:e[r++]=t&255|J,t>>>=7;case 2:e[r++]=t&255|J,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function Qs(t,e){let r=t[e],n=0;if(n+=r&_e,r<J||(r=t[e+1],n+=(r&_e)<<7,r<J)||(r=t[e+2],n+=(r&_e)<<14,r<J)||(r=t[e+3],n+=(r&_e)<<21,r<J)||(r=t[e+4],n+=(r&_e)*Gs,r<J)||(r=t[e+5],n+=(r&_e)*Ys,r<J)||(r=t[e+6],n+=(r&_e)*Zs,r<J)||(r=t[e+7],n+=(r&_e)*Xs,r<J))return n;throw new RangeError("Could not decode varint")}function Jb(t,e){let r=t.get(e),n=0;if(n+=r&_e,r<J||(r=t.get(e+1),n+=(r&_e)<<7,r<J)||(r=t.get(e+2),n+=(r&_e)<<14,r<J)||(r=t.get(e+3),n+=(r&_e)<<21,r<J)||(r=t.get(e+4),n+=(r&_e)*Gs,r<J)||(r=t.get(e+5),n+=(r&_e)*Ys,r<J)||(r=t.get(e+6),n+=(r&_e)*Zs,r<J)||(r=t.get(e+7),n+=(r&_e)*Xs,r<J))return n;throw new RangeError("Could not decode varint")}function Js(t,e=0){return t instanceof Uint8Array?Qs(t,e):Jb(t,e)}var ea=new Float32Array([-0]),jt=new Uint8Array(ea.buffer);function jf(t,e,r){ea[0]=t,e[r]=jt[0],e[r+1]=jt[1],e[r+2]=jt[2],e[r+3]=jt[3]}function zf(t,e){return jt[0]=t[e],jt[1]=t[e+1],jt[2]=t[e+2],jt[3]=t[e+3],ea[0]}var ta=new Float64Array([-0]),Ae=new Uint8Array(ta.buffer);function Gf(t,e,r){ta[0]=t,e[r]=Ae[0],e[r+1]=Ae[1],e[r+2]=Ae[2],e[r+3]=Ae[3],e[r+4]=Ae[4],e[r+5]=Ae[5],e[r+6]=Ae[6],e[r+7]=Ae[7]}function Yf(t,e){return Ae[0]=t[e],Ae[1]=t[e+1],Ae[2]=t[e+2],Ae[3]=t[e+3],Ae[4]=t[e+4],Ae[5]=t[e+5],Ae[6]=t[e+6],Ae[7]=t[e+7],ta[0]}var tm=BigInt(Number.MAX_SAFE_INTEGER),rm=BigInt(Number.MIN_SAFE_INTEGER),Fe=class t{lo;hi;constructor(e,r){this.lo=e|0,this.hi=r|0}toNumber(e=!1){if(!e&&this.hi>>>31>0){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(r+n*4294967296)}return this.lo+this.hi*4294967296}toBigInt(e=!1){if(e)return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n);if(this.hi>>>31){let r=~this.lo+1>>>0,n=~this.hi>>>0;return r===0&&(n=n+1>>>0),-(BigInt(r)+(BigInt(n)<<32n))}return BigInt(this.lo>>>0)+(BigInt(this.hi>>>0)<<32n)}toString(e=!1){return this.toBigInt(e).toString()}zzEncode(){let e=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^e)>>>0,this.lo=(this.lo<<1^e)>>>0,this}zzDecode(){let e=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^e)>>>0,this.hi=(this.hi>>>1^e)>>>0,this}length(){let e=this.lo,r=(this.lo>>>28|this.hi<<4)>>>0,n=this.hi>>>24;return n===0?r===0?e<16384?e<128?1:2:e<2097152?3:4:r<16384?r<128?5:6:r<2097152?7:8:n<128?9:10}static fromBigInt(e){if(e===0n)return sr;if(e<tm&&e>rm)return this.fromNumber(Number(e));let r=e<0n;r&&(e=-e);let n=e>>32n,i=e-(n<<32n);return r&&(n=~n|0n,i=~i|0n,++i>Zf&&(i=0n,++n>Zf&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return sr;let r=e<0;r&&(e=-e);let n=e>>>0,i=(e-n)/4294967296>>>0;return r&&(i=~i>>>0,n=~n>>>0,++n>4294967295&&(n=0,++i>4294967295&&(i=0))),new t(n,i)}static from(e){return typeof e=="number"?t.fromNumber(e):typeof e=="bigint"?t.fromBigInt(e):typeof e=="string"?t.fromBigInt(BigInt(e)):e.low!=null||e.high!=null?new t(e.low>>>0,e.high>>>0):sr}},sr=new Fe(0,0);sr.toBigInt=function(){return 0n};sr.zzEncode=sr.zzDecode=function(){return this};sr.length=function(){return 1};var Zf=4294967296n;function Xf(t){let e=0,r=0;for(let n=0;n<t.length;++n)r=t.charCodeAt(n),r<128?e+=1:r<2048?e+=2:(r&64512)===55296&&(t.charCodeAt(n+1)&64512)===56320?(++n,e+=4):e+=3;return e}function Qf(t,e,r){if(r-e<1)return"";let i,o=[],s=0,a;for(;e<r;)a=t[e++],a<128?o[s++]=a:a>191&&a<224?o[s++]=(a&31)<<6|t[e++]&63:a>239&&a<365?(a=((a&7)<<18|(t[e++]&63)<<12|(t[e++]&63)<<6|t[e++]&63)-65536,o[s++]=55296+(a>>10),o[s++]=56320+(a&1023)):o[s++]=(a&15)<<12|(t[e++]&63)<<6|t[e++]&63,s>8191&&((i??(i=[])).push(String.fromCharCode.apply(String,o)),s=0);return i!=null?(s>0&&i.push(String.fromCharCode.apply(String,o.slice(0,s))),i.join("")):String.fromCharCode.apply(String,o.slice(0,s))}function ra(t,e,r){let n=r,i,o;for(let s=0;s<t.length;++s)i=t.charCodeAt(s),i<128?e[r++]=i:i<2048?(e[r++]=i>>6|192,e[r++]=i&63|128):(i&64512)===55296&&((o=t.charCodeAt(s+1))&64512)===56320?(i=65536+((i&1023)<<10)+(o&1023),++s,e[r++]=i>>18|240,e[r++]=i>>12&63|128,e[r++]=i>>6&63|128,e[r++]=i&63|128):(e[r++]=i>>12|224,e[r++]=i>>6&63|128,e[r++]=i&63|128);return r-n}function Ge(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function Mi(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var na=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=e,this.pos=0,this.len=e.length}uint32(){let e=4294967295;if(e=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128||(e=(e|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)||(e=(e|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128))return e;if((this.pos+=5)>this.len)throw this.pos=this.len,Ge(this,10);return e}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)|0}bool(){return this.uint32()!==0}fixed32(){if(this.pos+4>this.len)throw Ge(this,4);return Mi(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw Ge(this,4);return Mi(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw Ge(this,4);let e=zf(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw Ge(this,4);let e=Yf(this.buf,this.pos);return this.pos+=8,e}bytes(){let e=this.uint32(),r=this.pos,n=this.pos+e;if(n>this.len)throw Ge(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return Qf(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw Ge(this,e);this.pos+=e}else do if(this.pos>=this.len)throw Ge(this);while((this.buf[this.pos++]&128)!==0);return this}skipType(e){switch(e){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:for(;(e=this.uint32()&7)!==4;)this.skipType(e);break;case 5:this.skip(4);break;default:throw Error(`invalid wire type ${e} at offset ${this.pos}`)}return this}readLongVarint(){let e=new Fe(0,0),r=0;if(this.len-this.pos>4){for(;r<4;++r)if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e;if(e.lo=(e.lo|(this.buf[this.pos]&127)<<28)>>>0,e.hi=(e.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return e;r=0}else{for(;r<3;++r){if(this.pos>=this.len)throw Ge(this);if(e.lo=(e.lo|(this.buf[this.pos]&127)<<r*7)>>>0,this.buf[this.pos++]<128)return e}return e.lo=(e.lo|(this.buf[this.pos++]&127)<<r*7)>>>0,e}if(this.len-this.pos>4){for(;r<5;++r)if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}else for(;r<5;++r){if(this.pos>=this.len)throw Ge(this);if(e.hi=(e.hi|(this.buf[this.pos]&127)<<r*7+3)>>>0,this.buf[this.pos++]<128)return e}throw Error("invalid varint encoding")}readFixed64(){if(this.pos+8>this.len)throw Ge(this,8);let e=Mi(this.buf,this.pos+=4),r=Mi(this.buf,this.pos+=4);return new Fe(e,r)}int64(){return this.readLongVarint().toBigInt()}int64Number(){return this.readLongVarint().toNumber()}int64String(){return this.readLongVarint().toString()}uint64(){return this.readLongVarint().toBigInt(!0)}uint64Number(){let e=Qs(this.buf,this.pos);return this.pos+=tt(e),e}uint64String(){return this.readLongVarint().toString(!0)}sint64(){return this.readLongVarint().zzDecode().toBigInt()}sint64Number(){return this.readLongVarint().zzDecode().toNumber()}sint64String(){return this.readLongVarint().zzDecode().toString()}fixed64(){return this.readFixed64().toBigInt()}fixed64Number(){return this.readFixed64().toNumber()}fixed64String(){return this.readFixed64().toString()}sfixed64(){return this.readFixed64().toBigInt()}sfixed64Number(){return this.readFixed64().toNumber()}sfixed64String(){return this.readFixed64().toString()}};function ia(t){return new na(t instanceof Uint8Array?t:t.subarray())}function Fi(t,e,r){let n=ia(t);return e.decode(n,void 0,r)}function oa(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Pe(s);i+s>e&&(n=Pe(e),i=0);let a=n.subarray(i,i+=s);return(i&7)!==0&&(i=(i|7)+1),a}}var ar=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function sa(){}var ua=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},nm=oa();function im(t){return globalThis.Buffer!=null?Pe(t):nm(t)}var Fn=class{len;head;tail;states;constructor(){this.len=0,this.head=new ar(sa,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new ar(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new ca((e=e>>>0)<128?1:e<16384?2:e<2097152?3:e<268435456?4:5,e)).len,this}int32(e){return e<0?this._push(qi,10,Fe.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Fe.fromBigInt(e);return this._push(qi,r.length(),r)}uint64Number(e){return this._push(kn,tt(e),e)}uint64String(e){return this.uint64(BigInt(e))}int64(e){return this.uint64(e)}int64Number(e){return this.uint64Number(e)}int64String(e){return this.uint64String(e)}sint64(e){let r=Fe.fromBigInt(e).zzEncode();return this._push(qi,r.length(),r)}sint64Number(e){let r=Fe.fromNumber(e).zzEncode();return this._push(qi,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(aa,1,e?1:0)}fixed32(e){return this._push(Mn,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Fe.fromBigInt(e);return this._push(Mn,4,r.lo)._push(Mn,4,r.hi)}fixed64Number(e){let r=Fe.fromNumber(e);return this._push(Mn,4,r.lo)._push(Mn,4,r.hi)}fixed64String(e){return this.fixed64(BigInt(e))}sfixed64(e){return this.fixed64(e)}sfixed64Number(e){return this.fixed64Number(e)}sfixed64String(e){return this.fixed64String(e)}float(e){return this._push(jf,4,e)}double(e){return this._push(Gf,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(aa,1,0):this.uint32(r)._push(sm,r,e)}string(e){let r=Xf(e);return r!==0?this.uint32(r)._push(ra,r,e):this._push(aa,1,0)}fork(){return this.states=new ua(this),this.head=this.tail=new ar(sa,0,0),this.len=0,this}reset(){return this.states!=null?(this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next):(this.head=this.tail=new ar(sa,0,0),this.len=0),this}ldelim(){let e=this.head,r=this.tail,n=this.len;return this.reset().uint32(n),n!==0&&(this.tail.next=e.next,this.tail=r,this.len+=n),this}finish(){let e=this.head.next,r=im(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function aa(t,e,r){e[r]=t&255}function om(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var ca=class extends ar{next;constructor(e,r){super(om,e,r),this.next=void 0}};function qi(t,e,r){for(;t.hi!==0;)e[r++]=t.lo&127|128,t.lo=(t.lo>>>7|t.hi<<25)>>>0,t.hi>>>=7;for(;t.lo>127;)e[r++]=t.lo&127|128,t.lo=t.lo>>>7;e[r++]=t.lo}function Mn(t,e,r){e[r]=t&255,e[r+1]=t>>>8&255,e[r+2]=t>>>16&255,e[r+3]=t>>>24}function sm(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(Fn.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(am,e,t),this},Fn.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(um,e,t),this});function am(t,e,r){e.set(t,r)}function um(t,e,r){t.length<40?ra(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(Q(t),r)}function fa(){return new Fn}function Hi(t,e){let r=fa();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}var Hr;(function(t){t[t.VARINT=0]="VARINT",t[t.BIT64=1]="BIT64",t[t.LENGTH_DELIMITED=2]="LENGTH_DELIMITED",t[t.START_GROUP=3]="START_GROUP",t[t.END_GROUP=4]="END_GROUP",t[t.BIT32=5]="BIT32"})(Hr||(Hr={}));function $i(t,e,r,n){return{name:t,type:e,encode:r,decode:n}}function la(t){function e(i){if(t[i.toString()]==null)throw new Error("Invalid enum value");return t[i]}let r=function(o,s){let a=e(o);s.int32(a)},n=function(o){let s=o.int32();return e(s)};return $i("enum",Hr.VARINT,r,n)}function Ki(t,e){return $i("message",Hr.LENGTH_DELIMITED,t,e)}var qe;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.ECDSA="ECDSA"})(qe||(qe={}));var da;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.secp256k1=2]="secp256k1",t[t.ECDSA=3]="ECDSA"})(da||(da={}));(function(t){t.codec=()=>la(da)})(qe||(qe={}));var qn;(function(t){let e;t.codec=()=>(e==null&&(e=Ki((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),qe.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n,i={})=>{let o={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let a=r.uint32();switch(a>>>3){case 1:{o.Type=qe.codec().decode(r);break}case 2:{o.Data=r.bytes();break}default:{r.skipType(a&7);break}}}return o})),e),t.encode=r=>Hi(r,t.codec()),t.decode=(r,n)=>Fi(r,t.codec(),n)})(qn||(qn={}));var ha;(function(t){let e;t.codec=()=>(e==null&&(e=Ki((r,n,i={})=>{i.lengthDelimited!==!1&&n.fork(),r.Type!=null&&(n.uint32(8),qe.codec().encode(r.Type,n)),r.Data!=null&&(n.uint32(18),n.bytes(r.Data)),i.lengthDelimited!==!1&&n.ldelim()},(r,n,i={})=>{let o={},s=n==null?r.len:r.pos+n;for(;r.pos<s;){let a=r.uint32();switch(a>>>3){case 1:{o.Type=qe.codec().decode(r);break}case 2:{o.Data=r.bytes();break}default:{r.skipType(a&7);break}}}return o})),e),t.encode=r=>Hi(r,t.codec()),t.decode=(r,n)=>Fi(r,t.codec(),n)})(ha||(ha={}));var Vi=class extends Lr{constructor(e,r){super(),this.finished=!1,this.destroyed=!1,Ii(e);let n=Tn(r);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=e.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),mt(o)}update(e){return Nr(this),this.iHash.update(e),this}digestInto(e){Nr(this),De(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:r,iHash:n,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return e=e,e.finished=i,e.destroyed=o,e.blockLen=s,e.outputLen=a,e.oHash=r._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},pa=(t,e,r)=>new Vi(t,e).update(r).digest();pa.create=(t,e)=>new Vi(t,e);var el=(t,e)=>(t+(t>=0?e:-e)/tl)/e;function fm(t,e,r){let[[n,i],[o,s]]=e,a=el(s*t,r),u=el(-i*t,r),c=t-a*n-u*o,f=-a*i-u*s,l=c<Tt,d=f<Tt;l&&(c=-c),d&&(f=-f);let h=$t(Math.ceil(Ri(r)/2))+Kr;if(c<Tt||c>=h||f<Tt||f>=h)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:l,k1:c,k2neg:d,k2:f}}function ba(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function ya(t,e){let r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return gt(r.lowS,"lowS"),gt(r.prehash,"prehash"),r.format!==void 0&&ba(r.format),r}var ma=class extends Error{constructor(e=""){super(e)}},vt={Err:ma,_tlv:{encode:(t,e)=>{let{Err:r}=vt;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=Dn(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?Dn(i.length/2|128):"";return Dn(t)+o+i+e},decode(t,e){let{Err:r}=vt,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let i=e[n++],o=!!(i&128),s=0;if(!o)s=i;else{let u=i&127;if(!u)throw new r("tlv.decode(long): indefinite length not supported");if(u>4)throw new r("tlv.decode(long): byte length is too big");let c=e.subarray(n,n+u);if(c.length!==u)throw new r("tlv.decode: length bytes not complete");if(c[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let f of c)s=s<<8|f;if(n+=u,s<128)throw new r("tlv.decode(long): not minimal encoding")}let a=e.subarray(n,n+s);if(a.length!==s)throw new r("tlv.decode: wrong value length");return{v:a,l:e.subarray(n+s)}}},_int:{encode(t){let{Err:e}=vt;if(t<Tt)throw new e("integer: negative integers are not allowed");let r=Dn(t);if(Number.parseInt(r[0],16)&8&&(r="00"+r),r.length&1)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){let{Err:e}=vt;if(t[0]&128)throw new e("invalid signature integer: negative");if(t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Or(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=vt,i=j("signature",t),{v:o,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:u}=n.decode(2,o),{v:c,l:f}=n.decode(2,u);if(f.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(c)}},hexFromSig(t){let{_tlv:e,_int:r}=vt,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),o=n+i;return e.encode(48,o)}},Tt=BigInt(0),Kr=BigInt(1),tl=BigInt(2),Wi=BigInt(3),lm=BigInt(4);function $r(t,e){let{BYTES:r}=t,n;if(typeof e=="bigint")n=e;else{let i=j("private key",e);try{n=t.fromBytes(i)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof e}`)}}if(!t.isValidNot0(n))throw new Error("invalid private key: out of range [1..N-1]");return n}function dm(t,e={}){let r=Di("weierstrass",t,e),{Fp:n,Fn:i}=r,o=r.CURVE,{h:s,n:a}=o;Kt(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:u}=e;if(u&&(!n.is0(o.a)||typeof u.beta!="bigint"||!Array.isArray(u.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let c=nl(n,i);function f(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(C,g,x){let{x:E,y:v}=g.toAffine(),R=n.toBytes(E);if(gt(x,"isCompressed"),x){f();let O=!n.isOdd(v);return Te(rl(O),R)}else return Te(Uint8Array.of(4),R,n.toBytes(v))}function d(C){ke(C,void 0,"Point");let{publicKey:g,publicKeyUncompressed:x}=c,E=C.length,v=C[0],R=C.subarray(1);if(E===g&&(v===2||v===3)){let O=n.fromBytes(R);if(!n.isValid(O))throw new Error("bad point: is not on curve, wrong x");let L=y(O),N;try{N=n.sqrt(L)}catch(te){let G=te instanceof Error?": "+te.message:"";throw new Error("bad point: is not on curve, sqrt error"+G)}f();let M=n.isOdd(N);return(v&1)===1!==M&&(N=n.neg(N)),{x:O,y:N}}else if(E===x&&v===4){let O=n.BYTES,L=n.fromBytes(R.subarray(0,O)),N=n.fromBytes(R.subarray(O,O*2));if(!_(L,N))throw new Error("bad point: is not on curve");return{x:L,y:N}}else throw new Error(`bad point: got length ${E}, expected compressed=${g} or uncompressed=${x}`)}let h=e.toBytes||l,p=e.fromBytes||d;function y(C){let g=n.sqr(C),x=n.mul(g,C);return n.add(n.add(x,n.mul(C,o.a)),o.b)}function _(C,g){let x=n.sqr(g),E=y(C);return n.eql(x,E)}if(!_(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let b=n.mul(n.pow(o.a,Wi),lm),A=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(b,A)))throw new Error("bad curve params: a or b");function w(C,g,x=!1){if(!n.isValid(g)||x&&n.is0(g))throw new Error(`bad point coordinate ${C}`);return g}function I(C){if(!(C instanceof S))throw new Error("ProjectivePoint expected")}function T(C){if(!u||!u.basises)throw new Error("no endo");return fm(C,u.basises,i.ORDER)}let F=Ur((C,g)=>{let{X:x,Y:E,Z:v}=C;if(n.eql(v,n.ONE))return{x,y:E};let R=C.is0();g==null&&(g=R?n.ONE:n.inv(v));let O=n.mul(x,g),L=n.mul(E,g),N=n.mul(v,g);if(R)return{x:n.ZERO,y:n.ZERO};if(!n.eql(N,n.ONE))throw new Error("invZ was invalid");return{x:O,y:L}}),U=Ur(C=>{if(C.is0()){if(e.allowInfinityPoint&&!n.is0(C.Y))return;throw new Error("bad point: ZERO")}let{x:g,y:x}=C.toAffine();if(!n.isValid(g)||!n.isValid(x))throw new Error("bad point: x or y not field elements");if(!_(g,x))throw new Error("bad point: equation left != right");if(!C.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function P(C,g,x,E,v){return x=new S(n.mul(x.X,C),x.Y,x.Z),g=Pn(E,g),x=Pn(v,x),g.add(x)}class S{constructor(g,x,E){this.X=w("x",g),this.Y=w("y",x,!0),this.Z=w("z",E),Object.freeze(this)}static CURVE(){return o}static fromAffine(g){let{x,y:E}=g||{};if(!g||!n.isValid(x)||!n.isValid(E))throw new Error("invalid affine point");if(g instanceof S)throw new Error("projective point not allowed");return n.is0(x)&&n.is0(E)?S.ZERO:new S(x,E,n.ONE)}static fromBytes(g){let x=S.fromAffine(p(ke(g,void 0,"point")));return x.assertValidity(),x}static fromHex(g){return S.fromBytes(j("pointHex",g))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(g=8,x=!0){return k.createCache(this,g),x||this.multiply(Wi),this}assertValidity(){U(this)}hasEvenY(){let{y:g}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(g)}equals(g){I(g);let{X:x,Y:E,Z:v}=this,{X:R,Y:O,Z:L}=g,N=n.eql(n.mul(x,L),n.mul(R,v)),M=n.eql(n.mul(E,L),n.mul(O,v));return N&&M}negate(){return new S(this.X,n.neg(this.Y),this.Z)}double(){let{a:g,b:x}=o,E=n.mul(x,Wi),{X:v,Y:R,Z:O}=this,L=n.ZERO,N=n.ZERO,M=n.ZERO,q=n.mul(v,v),te=n.mul(R,R),G=n.mul(O,O),V=n.mul(v,R);return V=n.add(V,V),M=n.mul(v,O),M=n.add(M,M),L=n.mul(g,M),N=n.mul(E,G),N=n.add(L,N),L=n.sub(te,N),N=n.add(te,N),N=n.mul(L,N),L=n.mul(V,L),M=n.mul(E,M),G=n.mul(g,G),V=n.sub(q,G),V=n.mul(g,V),V=n.add(V,M),M=n.add(q,q),q=n.add(M,q),q=n.add(q,G),q=n.mul(q,V),N=n.add(N,q),G=n.mul(R,O),G=n.add(G,G),q=n.mul(G,V),L=n.sub(L,q),M=n.mul(G,te),M=n.add(M,M),M=n.add(M,M),new S(L,N,M)}add(g){I(g);let{X:x,Y:E,Z:v}=this,{X:R,Y:O,Z:L}=g,N=n.ZERO,M=n.ZERO,q=n.ZERO,te=o.a,G=n.mul(o.b,Wi),V=n.mul(x,R),re=n.mul(E,O),fe=n.mul(v,L),Ce=n.add(x,E),ne=n.add(R,O);Ce=n.mul(Ce,ne),ne=n.add(V,re),Ce=n.sub(Ce,ne),ne=n.add(x,v);let Se=n.add(R,L);return ne=n.mul(ne,Se),Se=n.add(V,fe),ne=n.sub(ne,Se),Se=n.add(E,v),N=n.add(O,L),Se=n.mul(Se,N),N=n.add(re,fe),Se=n.sub(Se,N),q=n.mul(te,ne),N=n.mul(G,fe),q=n.add(N,q),N=n.sub(re,q),q=n.add(re,q),M=n.mul(N,q),re=n.add(V,V),re=n.add(re,V),fe=n.mul(te,fe),ne=n.mul(G,ne),re=n.add(re,fe),fe=n.sub(V,fe),fe=n.mul(te,fe),ne=n.add(ne,fe),V=n.mul(re,ne),M=n.add(M,V),V=n.mul(Se,ne),N=n.mul(Ce,N),N=n.sub(N,V),V=n.mul(Ce,re),q=n.mul(Se,q),q=n.add(q,V),new S(N,M,q)}subtract(g){return this.add(g.negate())}is0(){return this.equals(S.ZERO)}multiply(g){let{endo:x}=e;if(!i.isValidNot0(g))throw new Error("invalid scalar: out of range");let E,v,R=O=>k.cached(this,O,L=>St(S,L));if(x){let{k1neg:O,k1:L,k2neg:N,k2:M}=T(g),{p:q,f:te}=R(L),{p:G,f:V}=R(M);v=te.add(V),E=P(x.beta,q,G,O,N)}else{let{p:O,f:L}=R(g);E=O,v=L}return St(S,[E,v])[0]}multiplyUnsafe(g){let{endo:x}=e,E=this;if(!i.isValid(g))throw new Error("invalid scalar: out of range");if(g===Tt||E.is0())return S.ZERO;if(g===Kr)return E;if(k.hasCache(this))return this.multiply(g);if(x){let{k1neg:v,k1:R,k2neg:O,k2:L}=T(g),{p1:N,p2:M}=kf(S,E,R,L);return P(x.beta,N,M,v,O)}else return k.unsafe(E,g)}multiplyAndAddUnsafe(g,x,E){let v=this.multiplyUnsafe(x).add(g.multiplyUnsafe(E));return v.is0()?void 0:v}toAffine(g){return F(this,g)}isTorsionFree(){let{isTorsionFree:g}=e;return s===Kr?!0:g?g(S,this):k.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:g}=e;return s===Kr?this:g?g(S,this):this.multiplyUnsafe(s)}isSmallOrder(){return this.multiplyUnsafe(s).is0()}toBytes(g=!0){return gt(g,"isCompressed"),this.assertValidity(),h(S,this,g)}toHex(g=!0){return $e(this.toBytes(g))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(g=!0){return this.toBytes(g)}_setWindowSize(g){this.precompute(g)}static normalizeZ(g){return St(S,g)}static msm(g,x){return Fr(S,i,g,x)}static fromPrivateKey(g){return S.BASE.multiply($r(i,g))}}S.BASE=new S(o.Gx,o.Gy,n.ONE),S.ZERO=new S(n.ZERO,n.ONE,n.ZERO),S.Fp=n,S.Fn=i;let B=i.BITS,k=new Mr(S,e.endo?Math.ceil(B/2):B);return S.BASE.precompute(8),S}function rl(t){return Uint8Array.of(t?2:3)}function nl(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function hm(t,e={}){let{Fn:r}=t,n=e.randomBytes||Pr,i=Object.assign(nl(t.Fp,r),{seed:Us(r.ORDER)});function o(h){try{return!!$r(r,h)}catch{return!1}}function s(h,p){let{publicKey:y,publicKeyUncompressed:_}=i;try{let b=h.length;return p===!0&&b!==y||p===!1&&b!==_?!1:!!t.fromBytes(h)}catch{return!1}}function a(h=n(i.seed)){return ks(ke(h,i.seed,"seed"),r.ORDER)}function u(h,p=!0){return t.BASE.multiply($r(r,h)).toBytes(p)}function c(h){let p=a(h);return{secretKey:p,publicKey:u(p)}}function f(h){if(typeof h=="bigint")return!1;if(h instanceof t)return!0;let{secretKey:p,publicKey:y,publicKeyUncompressed:_}=i;if(r.allowedLengths||p===y)return;let b=j("key",h).length;return b===y||b===_}function l(h,p,y=!0){if(f(h)===!0)throw new Error("first arg must be private key");if(f(p)===!1)throw new Error("second arg must be public key");let _=$r(r,h);return t.fromHex(p).multiply(_).toBytes(y)}return Object.freeze({getPublicKey:u,getSharedSecret:l,keygen:c,Point:t,utils:{isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a,isValidPrivateKey:o,randomPrivateKey:a,normPrivateKeyToScalar:h=>$r(r,h),precompute(h=8,p=t.BASE){return p.precompute(h,!1)}},lengths:i})}function pm(t,e,r={}){Ii(e),Kt(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=r.randomBytes||Pr,i=r.hmac||((x,...E)=>pa(e,x,Te(...E))),{Fp:o,Fn:s}=t,{ORDER:a,BITS:u}=s,{keygen:c,getPublicKey:f,getSharedSecret:l,utils:d,lengths:h}=hm(t,r),p={prehash:!1,lowS:typeof r.lowS=="boolean"?r.lowS:!1,format:void 0,extraEntropy:!1},y="compact";function _(x){let E=a>>Kr;return x>E}function b(x,E){if(!s.isValidNot0(E))throw new Error(`invalid signature ${x}: out of range 1..Point.Fn.ORDER`);return E}function A(x,E){ba(E);let v=h.signature,R=E==="compact"?v:E==="recovered"?v+1:void 0;return ke(x,R,`${E} signature`)}class w{constructor(E,v,R){this.r=b("r",E),this.s=b("s",v),R!=null&&(this.recovery=R),Object.freeze(this)}static fromBytes(E,v=y){A(E,v);let R;if(v==="der"){let{r:M,s:q}=vt.toSig(ke(E));return new w(M,q)}v==="recovered"&&(R=E[0],v="compact",E=E.subarray(1));let O=s.BYTES,L=E.subarray(0,O),N=E.subarray(O,O*2);return new w(s.fromBytes(L),s.fromBytes(N),R)}static fromHex(E,v){return this.fromBytes(tr(E),v)}addRecoveryBit(E){return new w(this.r,this.s,E)}recoverPublicKey(E){let v=o.ORDER,{r:R,s:O,recovery:L}=this;if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");if(a*tl<v&&L>1)throw new Error("recovery id is ambiguous for h>1 curve");let M=L===2||L===3?R+a:R;if(!o.isValid(M))throw new Error("recovery id 2 or 3 invalid");let q=o.toBytes(M),te=t.fromBytes(Te(rl((L&1)===0),q)),G=s.inv(M),V=T(j("msgHash",E)),re=s.create(-V*G),fe=s.create(O*G),Ce=t.BASE.multiplyUnsafe(re).add(te.multiplyUnsafe(fe));if(Ce.is0())throw new Error("point at infinify");return Ce.assertValidity(),Ce}hasHighS(){return _(this.s)}toBytes(E=y){if(ba(E),E==="der")return tr(vt.hexFromSig(this));let v=s.toBytes(this.r),R=s.toBytes(this.s);if(E==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Te(Uint8Array.of(this.recovery),v,R)}return Te(v,R)}toHex(E){return $e(this.toBytes(E))}assertValidity(){}static fromCompact(E){return w.fromBytes(j("sig",E),"compact")}static fromDER(E){return w.fromBytes(j("sig",E),"der")}normalizeS(){return this.hasHighS()?new w(this.r,s.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return $e(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return $e(this.toBytes("compact"))}}let I=r.bits2int||function(E){if(E.length>8192)throw new Error("input is too large");let v=Or(E),R=E.length*8-u;return R>0?v>>BigInt(R):v},T=r.bits2int_modN||function(E){return s.create(I(E))},F=$t(u);function U(x){return Ln("num < 2^"+u,x,Tt,F),s.toBytes(x)}function P(x,E){return ke(x,void 0,"message"),E?ke(e(x),void 0,"prehashed message"):x}function S(x,E,v){if(["recovered","canonical"].some(re=>re in v))throw new Error("sign() legacy options not supported");let{lowS:R,prehash:O,extraEntropy:L}=ya(v,p);x=P(x,O);let N=T(x),M=$r(s,E),q=[U(M),U(N)];if(L!=null&&L!==!1){let re=L===!0?n(h.secretKey):L;q.push(j("extraEntropy",re))}let te=Te(...q),G=N;function V(re){let fe=I(re);if(!s.isValidNot0(fe))return;let Ce=s.inv(fe),ne=t.BASE.multiply(fe).toAffine(),Se=s.create(ne.x);if(Se===Tt)return;let hi=s.create(Ce*s.create(G+Se*M));if(hi===Tt)return;let mc=(ne.x===Se?0:2)|Number(ne.y&Kr),wc=hi;return R&&_(hi)&&(wc=s.neg(hi),mc^=1),new w(Se,wc,mc)}return{seed:te,k2sig:V}}function B(x,E,v={}){x=j("message",x);let{seed:R,k2sig:O}=S(x,E,v);return Ef(e.outputLen,s.BYTES,i)(R,O)}function k(x){let E,v=typeof x=="string"||bt(x),R=!v&&x!==null&&typeof x=="object"&&typeof x.r=="bigint"&&typeof x.s=="bigint";if(!v&&!R)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(R)E=new w(x.r,x.s);else if(v){try{E=w.fromBytes(j("sig",x),"der")}catch(O){if(!(O instanceof vt.Err))throw O}if(!E)try{E=w.fromBytes(j("sig",x),"compact")}catch{return!1}}return E||!1}function C(x,E,v,R={}){let{lowS:O,prehash:L,format:N}=ya(R,p);if(v=j("publicKey",v),E=P(j("message",E),L),"strict"in R)throw new Error("options.strict was renamed to lowS");let M=N===void 0?k(x):w.fromBytes(j("sig",x),N);if(M===!1)return!1;try{let q=t.fromBytes(v);if(O&&M.hasHighS())return!1;let{r:te,s:G}=M,V=T(E),re=s.inv(G),fe=s.create(V*re),Ce=s.create(te*re),ne=t.BASE.multiplyUnsafe(fe).add(q.multiplyUnsafe(Ce));return ne.is0()?!1:s.create(ne.x)===te}catch{return!1}}function g(x,E,v={}){let{prehash:R}=ya(v,p);return E=P(E,R),w.fromBytes(x,"recovered").recoverPublicKey(E).toBytes()}return Object.freeze({keygen:c,getPublicKey:f,getSharedSecret:l,utils:d,lengths:h,Point:t,sign:B,verify:C,recoverPublicKey:g,Signature:w,hash:e})}function ym(t){let e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},r=t.Fp,n=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(s=>Math.ceil(s/2)))):void 0,i=Me(e.n,{BITS:t.nBitLength,allowedLengths:n,modFromBytes:t.wrapPrivateKey}),o={Fp:r,Fn:i,allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes};return{CURVE:e,curveOpts:o}}function bm(t){let{CURVE:e,curveOpts:r}=ym(t),n={hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN};return{CURVE:e,curveOpts:r,hash:t.hash,ecdsaOpts:n}}function mm(t,e){let r=e.Point;return Object.assign({},e,{ProjectivePoint:r,CURVE:Object.assign({},t,Ci(r.Fn.ORDER,r.Fn.BITS))})}function il(t){let{CURVE:e,curveOpts:r,hash:n,ecdsaOpts:i}=bm(t),o=dm(e,r),s=pm(o,n,i);return mm(t,s)}function ol(t,e){let r=n=>il({...t,hash:n});return{...r(e),create:r}}var ga={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},wm={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var sl=BigInt(2);function gm(t){let e=ga.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),u=BigInt(88),c=t*t*t%e,f=c*c*t%e,l=Z(f,r,e)*f%e,d=Z(l,r,e)*f%e,h=Z(d,sl,e)*c%e,p=Z(h,i,e)*h%e,y=Z(p,o,e)*p%e,_=Z(y,a,e)*y%e,b=Z(_,u,e)*_%e,A=Z(b,a,e)*y%e,w=Z(A,r,e)*f%e,I=Z(w,s,e)*p%e,T=Z(I,n,e)*c%e,F=Z(T,sl,e);if(!wa.eql(wa.sqr(F),t))throw new Error("Cannot find square root");return F}var wa=Me(ga.p,{sqrt:gm}),Vr=ol({...ga,Fp:wa,lowS:!0,endo:wm},bf);function al(t,e,r,n){let i=gn.digest(r instanceof Uint8Array?r:r.subarray());if(Ui(i))return i.then(({digest:o})=>(n?.signal?.throwIfAborted(),Vr.verify(e,o,t))).catch(o=>{throw o.name==="AbortError"?o:new Un(String(o))});try{return n?.signal?.throwIfAborted(),Vr.verify(e,i.digest,t)}catch(o){throw new Un(String(o))}}var ji=class{type="secp256k1";raw;_key;constructor(e){this._key=cl(e),this.raw=ul(this._key)}toMultihash(){return je.digest(Dr(this))}toCID(){return le.createV1(114,this.toMultihash())}toString(){return oe.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ue(this.raw,e.raw)}verify(e,r,n){return al(this._key,r,e,n)}};function fl(t){return new ji(t)}function ul(t){return Vr.ProjectivePoint.fromHex(t).toRawBytes(!0)}function cl(t){try{return Vr.ProjectivePoint.fromHex(t),t}catch(e){throw new xi(String(e))}}function ll(t){let{Type:e,Data:r}=qn.decode(t.digest),n=r??new Uint8Array;switch(e){case qe.Ed25519:return Wf(n);case qe.secp256k1:return fl(n);case qe.ECDSA:return Qc(n);default:throw new _n}}function Dr(t){return qn.encode({Type:qe[t.type],Data:t.raw})}var dl=Symbol.for("nodejs.util.inspect.custom"),xm=114,Hn=class{type;multihash;publicKey;string;constructor(e){this.type=e.type,this.multihash=e.multihash,Object.defineProperty(this,"string",{enumerable:!1,writable:!0})}get[Symbol.toStringTag](){return`PeerId(${this.toString()})`}[gi]=!0;toString(){return this.string==null&&(this.string=oe.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return le.createV1(xm,this.multihash)}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Ue(this.multihash.bytes,e);if(typeof e=="string")return this.toString()===e;if(e?.toMultihash()?.bytes!=null)return Ue(this.multihash.bytes,e.toMultihash().bytes);throw new Error("not valid Id")}[dl](){return`PeerId(${this.toString()})`}},zi=class extends Hn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Gi=class extends Hn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.publicKey}},Yi=class extends Hn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.publicKey}},Em=2336,$n=class{type="url";multihash;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=je.digest(Q(this.url))}[dl](){return`PeerId(${this.url})`}[gi]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return le.createV1(Em,this.toMultihash())}toJSON(){return this.toString()}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=W(e)),e.toString()===this.toString())}};var Sm=114,hl=2336;function pl(t,e){let r;if(t.charAt(0)==="1"||t.charAt(0)==="Q")r=mn(oe.decode(`z${t}`));else{if(t.startsWith("k51qzi5uqu5")||t.startsWith("kzwfwjn5ji4")||t.startsWith("k2k4r8")||t.startsWith("bafz"))return _m(le.parse(t));if(e==null)throw new Oe('Please pass a multibase decoder for strings that do not start with "1" or "Q"');r=mn(e.decode(t))}return yl(r)}function yl(t){if(Im(t))return new zi({multihash:t});if(Am(t))try{let e=ll(t);if(e.type==="Ed25519")return new Gi({multihash:t,publicKey:e});if(e.type==="secp256k1")return new Yi({multihash:t,publicKey:e})}catch{let r=W(t.digest);return new $n(new URL(r))}throw new Si("Supplied PeerID Multihash is invalid")}function _m(t){if(t?.multihash==null||t.version==null||t.version===1&&t.code!==Sm&&t.code!==hl)throw new Ei("Supplied PeerID CID is invalid");if(t.code===hl){let e=W(t.multihash.digest);return new $n(new URL(e))}return yl(t.multihash)}function Am(t){return t.code===je.code}function Im(t){return t.code===gn.code}var xe=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},Bt=class extends Error{static name="ValidationError";name="ValidationError"},Kn=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},Zi=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};var Xi=class{index=0;input="";new(e){return this.index=0,this.input=e,this}readAtomically(e){let r=this.index,n=e();return n===void 0&&(this.index=r),n}parseWith(e){let r=e();if(this.index===this.input.length)return r}peekChar(){if(!(this.index>=this.input.length))return this.input[this.index]}readChar(){if(!(this.index>=this.input.length))return this.input[this.index++]}readGivenChar(e){return this.readAtomically(()=>{let r=this.readChar();if(r===e)return r})}readSeparator(e,r,n){return this.readAtomically(()=>{if(!(r>0&&this.readGivenChar(e)===void 0))return n()})}readNumber(e,r,n,i){return this.readAtomically(()=>{let o=0,s=0,a=this.peekChar();if(a===void 0)return;let u=a==="0",c=2**(8*i)-1;for(;;){let f=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let d=Number.parseInt(l,e);if(!Number.isNaN(d))return d});if(f===void 0)break;if(o*=e,o+=f,o>c||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&u&&s>1?void 0:o})}readIPv4Addr(){return this.readAtomically(()=>{let e=new Uint8Array(4);for(let r=0;r<e.length;r++){let n=this.readSeparator(".",r,()=>this.readNumber(10,3,!1,1));if(n===void 0)return;e[r]=n}return e})}readIPv6Addr(){let e=r=>{for(let n=0;n<r.length/2;n++){let i=n*2;if(n<r.length-3){let s=this.readSeparator(":",n,()=>this.readIPv4Addr());if(s!==void 0)return r[i]=s[0],r[i+1]=s[1],r[i+2]=s[2],r[i+3]=s[3],[i+4,!0]}let o=this.readSeparator(":",n,()=>this.readNumber(16,4,!0,2));if(o===void 0)return[i,!1];r[i]=o>>8,r[i+1]=o&255}return[r.length,!1]};return this.readAtomically(()=>{let r=new Uint8Array(16),[n,i]=e(r);if(n===16)return r;if(i||this.readGivenChar(":")===void 0||this.readGivenChar(":")===void 0)return;let o=new Uint8Array(14),s=16-(n+2),[a]=e(o.subarray(0,s));return r.set(o.subarray(0,a),16-a),r})}readIPAddr(){return this.readIPv4Addr()??this.readIPv6Addr()}};var vm=45,Tm=15,Qi=new Xi;function xa(t){if(!(t.length>Tm))return Qi.new(t).parseWith(()=>Qi.readIPv4Addr())}function Ea(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>vm))return Qi.new(t).parseWith(()=>Qi.readIPv6Addr())}function Ji(t){return!!xa(t)}function ml(t){return!!Ea(t)}function _a(t){return e=>W(e,t)}function Aa(t){return e=>Q(e,t)}function Wr(t){return new DataView(t.buffer).getUint16(t.byteOffset).toString()}function ur(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof t=="string"?parseInt(t):t),new Uint8Array(e)}function wl(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==16)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion address.`);let r=Q(e[0],"base32"),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=ur(n);return pt([r,i],r.length+i.length)}function gl(t){let e=t.split(":");if(e.length!==2)throw new Error(`failed to parse onion addr: ["'${e.join('", "')}'"]' does not contain a port number`);if(e[0].length!==56)throw new Error(`failed to parse onion addr: ${e[0]} not a Tor onion3 address.`);let r=Mt.decode(`b${e[0]}`),n=parseInt(e[1],10);if(n<1||n>65536)throw new Error("Port number is not in range(1, 65536)");let i=ur(n);return pt([r,i],r.length+i.length)}function Ia(t){let e=t.subarray(0,t.length-2),r=t.subarray(t.length-2),n=W(e,"base32"),i=Wr(r);return`${n}:${i}`}var va=function(t){t=t.toString().trim();let e=new Uint8Array(4);return t.split(/\./g).forEach((r,n)=>{let i=parseInt(r,10);if(isNaN(i)||i<0||i>255)throw new xe("Invalid byte value in IP address");e[n]=i}),e},xl=function(t){let e=0;t=t.toString().trim();let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=Ji(r[n]),s;o&&(s=va(r[n]),r[n]=W(s.subarray(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,W(s.subarray(2,4),"base16"))}if(r[0]==="")for(;r.length<8;)r.unshift("0");else if(r[r.length-1]==="")for(;r.length<8;)r.push("0");else if(r.length<8){for(n=0;n<r.length&&r[n]!=="";n++);let o=[n,1];for(n=9-r.length;n>0;n--)o.push("0");r.splice.apply(r,o)}let i=new Uint8Array(e+16);for(n=0;n<r.length;n++){r[n]===""&&(r[n]="0");let o=parseInt(r[n],16);if(isNaN(o)||o<0||o>65535)throw new xe("Invalid byte value in IP address");i[e++]=o>>8&255,i[e++]=o&255}return i},El=function(t){if(t.byteLength!==4)throw new xe("IPv4 address was incorrect length");let e=[];for(let r=0;r<t.byteLength;r++)e.push(t[r]);return e.join(".")},Sl=function(t){if(t.byteLength!==16)throw new xe("IPv6 address was incorrect length");let e=[];for(let n=0;n<t.byteLength;n+=2){let i=t[n],o=t[n+1],s=`${i.toString(16).padStart(2,"0")}${o.toString(16).padStart(2,"0")}`;e.push(s)}let r=e.join(":");try{let n=new URL(`http://[${r}]`);return n.hostname.substring(1,n.hostname.length-1)}catch{throw new xe(`Invalid IPv6 address "${r}"`)}};function _l(t){try{let e=new URL(`http://[${t}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new xe(`Invalid IPv6 address "${t}"`)}}var Sa=Object.values(En).map(t=>t.decoder),Bm=function(){let t=Sa[0].or(Sa[1]);return Sa.slice(2).forEach(e=>t=t.or(e)),t}();function Al(t){return Bm.decode(t)}function Il(t){return e=>t.encoder.encode(e)}function Rm(t){if(parseInt(t).toString()!==t)throw new Bt("Value must be an integer")}function Cm(t){if(t<0)throw new Bt("Value must be a positive integer, or zero")}function Dm(t){return e=>{if(e>t)throw new Bt(`Value must be smaller than or equal to ${t}`)}}function Lm(...t){return e=>{for(let r of t)r(e)}}var Vn=Lm(Rm,Cm,Dm(65535));var me=-1,Ta=class{protocolsByCode=new Map;protocolsByName=new Map;getProtocol(e){let r;if(typeof e=="string"?r=this.protocolsByName.get(e):r=this.protocolsByCode.get(e),r==null)throw new Zi(`Protocol ${e} was unknown`);return r}addProtocol(e){this.protocolsByCode.set(e.code,e),this.protocolsByName.set(e.name,e),e.aliases?.forEach(r=>{this.protocolsByName.set(r,e)})}removeProtocol(e){let r=this.protocolsByCode.get(e);r!=null&&(this.protocolsByCode.delete(r.code),this.protocolsByName.delete(r.name),r.aliases?.forEach(n=>{this.protocolsByName.delete(n)}))}},He=new Ta,aw=[{code:4,name:"ip4",size:32,valueToBytes:va,bytesToValue:El,validate:t=>{if(!Ji(t))throw new Bt(`Invalid IPv4 address "${t}"`)}},{code:6,name:"tcp",size:16,valueToBytes:ur,bytesToValue:Wr,validate:Vn},{code:273,name:"udp",size:16,valueToBytes:ur,bytesToValue:Wr,validate:Vn},{code:33,name:"dccp",size:16,valueToBytes:ur,bytesToValue:Wr,validate:Vn},{code:41,name:"ip6",size:128,valueToBytes:xl,bytesToValue:Sl,stringToValue:_l,validate:t=>{if(!ml(t))throw new Bt(`Invalid IPv6 address "${t}"`)}},{code:42,name:"ip6zone",size:me},{code:43,name:"ipcidr",size:8,bytesToValue:_a("base10"),valueToBytes:Aa("base10")},{code:53,name:"dns",size:me,resolvable:!0},{code:54,name:"dns4",size:me,resolvable:!0},{code:55,name:"dns6",size:me,resolvable:!0},{code:56,name:"dnsaddr",size:me,resolvable:!0},{code:132,name:"sctp",size:16,valueToBytes:ur,bytesToValue:Wr,validate:Vn},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:me,path:!0,stringToValue:t=>decodeURIComponent(t),valueToString:t=>encodeURIComponent(t)},{code:421,name:"p2p",aliases:["ipfs"],size:me,bytesToValue:_a("base58btc"),valueToBytes:t=>t.startsWith("Q")||t.startsWith("1")?Aa("base58btc")(t):le.parse(t).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:Ia,valueToBytes:wl},{code:445,name:"onion3",size:296,bytesToValue:Ia,valueToBytes:gl},{code:446,name:"garlic64",size:me},{code:447,name:"garlic32",size:me},{code:448,name:"tls"},{code:449,name:"sni",size:me},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:me,bytesToValue:Il(is),valueToBytes:Al},{code:480,name:"http"},{code:481,name:"http-path",size:me,stringToValue:t=>`/${decodeURIComponent(t)}`,valueToString:t=>encodeURIComponent(t.substring(1))},{code:443,name:"https"},{code:477,name:"ws"},{code:478,name:"wss"},{code:479,name:"p2p-websocket-star"},{code:277,name:"p2p-stardust"},{code:275,name:"p2p-webrtc-star"},{code:276,name:"p2p-webrtc-direct"},{code:280,name:"webrtc-direct"},{code:281,name:"webrtc"},{code:290,name:"p2p-circuit"},{code:777,name:"memory",size:me}];aw.forEach(t=>{He.addProtocol(t)});function vl(t){let e=[],r=0;for(;r<t.length;){let n=Js(t,r),i=He.getProtocol(n),o=tt(n),s=uw(i,t,r+o),a=0;s>0&&i.size===me&&(a=tt(s));let u=o+a+s,c={code:n,name:i.name,bytes:t.subarray(r,r+u)};if(s>0){let f=r+o+a,l=t.subarray(f,f+s);c.value=i.bytesToValue?.(l)??W(l)}e.push(c),r+=u}return e}function Tl(t){let e=0,r=[];for(let n of t){if(n.bytes==null){let i=He.getProtocol(n.code),o=tt(n.code),s,a=0,u=0;n.value!=null&&(s=i.valueToBytes?.(n.value)??Q(n.value),a=s.byteLength,i.size===me&&(u=tt(a)));let c=new Uint8Array(o+u+a),f=0;kn(n.code,c,f),f+=o,s!=null&&(i.size===me&&(kn(a,c,f),f+=u),c.set(s,f)),n.bytes=c}r.push(n.bytes),e+=n.bytes.byteLength}return pt(r,e)}function Bl(t){if(t.charAt(0)!=="/")throw new xe('String multiaddr must start with "/"');let e=[],r="protocol",n="",i="";for(let o=1;o<t.length;o++){let s=t.charAt(o);s!=="/"&&(r==="protocol"?i+=t.charAt(o):n+=t.charAt(o));let a=o===t.length-1;if(s==="/"||a){let u=He.getProtocol(i);if(r==="protocol"){if(u.size==null||u.size===0){e.push({code:u.code,name:u.name}),n="",i="",r="protocol";continue}else if(a)throw new xe(`Component ${i} was missing value`);r="value"}else if(r==="value"){let c={code:u.code,name:u.name};if(u.size!=null&&u.size!==0){if(n==="")throw new xe(`Component ${i} was missing value`);c.value=u.stringToValue?.(n)??n}e.push(c),n="",i="",r="protocol"}}}if(i!==""&&n!=="")throw new xe("Incomplete multiaddr");return e}function Rl(t){return`/${t.flatMap(e=>{if(e.value==null)return e.name;let r=He.getProtocol(e.code);if(r==null)throw new xe(`Unknown protocol code ${e.code}`);return[e.name,r.valueToString?.(e.value)??e.value]}).join("/")}`}function uw(t,e,r){return t.size==null||t.size===0?0:t.size>0?t.size/8:Js(e,r)}var cw=Symbol.for("nodejs.util.inspect.custom"),Na=Symbol.for("@multiformats/multiaddr"),fw=[53,54,55,56],La=class extends Error{constructor(e="No available resolver"){super(e),this.name="NoAvailableResolverError"}};function lw(t){if(t==null&&(t="/"),no(t))return t.getComponents();if(t instanceof Uint8Array)return vl(t);if(typeof t=="string")return t=t.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),t===""&&(t="/"),Bl(t);if(Array.isArray(t))return t;throw new xe("Must be a string, Uint8Array, Component[], or another Multiaddr")}var ro=class t{[Na]=!0;#e;#t;#r;constructor(e="/",r={}){this.#e=lw(e),r.validate!==!1&&dw(this)}get bytes(){return this.#r==null&&(this.#r=Tl(this.#e)),this.#r}toString(){return this.#t==null&&(this.#t=Rl(this.#e)),this.#t}toJSON(){return this.toString()}toOptions(){let e,r,n,i,o="";for(let{code:a,name:u,value:c}of this.#e)a===42&&(o=`%${c??""}`),fw.includes(a)&&(r="tcp",i=443,n=`${c??""}${o}`,e=a===55?6:4),(a===6||a===273)&&(r=u==="tcp"?"tcp":"udp",i=parseInt(c??"")),(a===4||a===41)&&(r="tcp",n=`${c??""}${o}`,e=a===41?6:4);if(e==null||r==null||n==null||i==null)throw new Error('multiaddr must have a valid format: "/{ip4, ip6, dns4, dns6, dnsaddr}/{address}/{tcp, udp}/{port}".');return{family:e,host:n,transport:r,port:i}}getComponents(){return[...this.#e]}protos(){return this.#e.map(({code:e,value:r})=>{let n=He.getProtocol(e);return{code:e,size:n.size??0,name:n.name,resolvable:!!n.resolvable,path:!!n.path}})}protoCodes(){return this.#e.map(({code:e})=>e)}protoNames(){return this.#e.map(({name:e})=>e)}tuples(){return this.#e.map(({code:e,value:r})=>{if(r==null)return[e];let n=He.getProtocol(e),i=[e];return r!=null&&i.push(n.valueToBytes?.(r)??Q(r)),i})}stringTuples(){return this.#e.map(({code:e,value:r})=>r==null?[e]:[e,r])}encapsulate(e){let r=new t(e);return new t([...this.#e,...r.getComponents()],{validate:!1})}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Kn(`Address ${this.toString()} does not contain subaddress: ${e.toString()}`);return new t(n.slice(0,i),{validate:!1})}decapsulateCode(e){let r;for(let n=this.#e.length-1;n>-1;n--)if(this.#e[n].code===e){r=n;break}return new t(this.#e.slice(0,r),{validate:!1})}getPeerId(){try{let e=[];this.#e.forEach(({code:n,value:i})=>{n===421&&e.push([n,i]),n===290&&(e=[])});let r=e.pop();if(r?.[1]!=null){let n=r[1];return n[0]==="Q"||n[0]==="1"?W(oe.decode(`z${n}`),"base58btc"):W(le.parse(n).multihash.bytes,"base58btc")}return null}catch{return null}}getPath(){for(let e of this.#e)if(He.getProtocol(e.code).path)return e.value??null;return null}equals(e){return Ue(this.bytes,e.bytes)}async resolve(e){let r=this.protos().find(o=>o.resolvable);if(r==null)return[this];let n=Cl.get(r.name);if(n==null)throw new La(`no available resolver for ${r.name}`);return(await n(this,e)).map(o=>Ye(o))}nodeAddress(){let e=this.toOptions();if(e.transport!=="tcp"&&e.transport!=="udp")throw new Error(`multiaddr must have a valid format - no protocol with name: "${e.transport}". Must have a valid transport protocol: "{tcp, udp}"`);return{family:e.family,address:e.host,port:e.port}}isThinWaistAddress(){return!(this.#e.length!==2||this.#e[0].code!==4&&this.#e[0].code!==41||this.#e[1].code!==6&&this.#e[1].code!==273)}[cw](){return`Multiaddr(${this.toString()})`}};function dw(t){t.getComponents().forEach(e=>{let r=He.getProtocol(e.code);e.value!=null&&r.validate?.(e.value)})}var AI=parseInt("0xFFFF",16),II=new Uint8Array([0,0,0,0,0,0,0,0,0,0,255,255]);var Cl=new Map;function no(t){return!!t?.[Na]}function Ye(t){return new ro(t)}var mw=[6,53,56,54,55];function Nl(t){return Ul("sni",t)?.value}function Pl(t){let e=Ul("tcp",t)?.value;return e==null?"":`:${e}`}function Ul(t,e){return e.find(r=>r.name===t)}function Ol(t){return t.some(({code:e})=>e===448)}function Ze(t,e){let r=kl[t.name];if(r==null)throw new Error(`Can't interpret protocol ${t.name}`);let n=r(t,e);return t.code===41?`[${n}]`:n}var kl={ip4:(t,e)=>t.value,ip6:(t,e)=>e.length===0?t.value:`[${t.value}]`,tcp:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`tcp://${Ze(r,e)}:${t.value}`},udp:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`udp://${Ze(r,e)}:${t.value}`},dnsaddr:(t,e)=>t.value,dns4:(t,e)=>t.value,dns6:(t,e)=>t.value,dns:(t,e)=>t.value,ipfs:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`${Ze(r,e)}`},p2p:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`${Ze(r,e)}`},http:(t,e)=>{let r=Ol(e),n=Nl(e),i=Pl(e);if(r&&n!=null)return`https://${n}${i}`;let o=r?"https://":"http://",s=e.pop();if(s==null)throw new Error("Unexpected end of multiaddr");let a=Ze(s,e);return a=a?.replace("tcp://",""),`${o}${a}`},"http-path":(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");let n=Ze(r,e),i=decodeURIComponent(t.value??"");return`${n}${i}`},tls:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return Ze(r,e)},sni:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return Ze(r,e)},https:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");let n=Ze(r,e);return n=n?.replace("tcp://",""),`https://${n}`},ws:(t,e)=>{let r=Ol(e),n=Nl(e),i=Pl(e);if(r&&n!=null)return`wss://${n}${i}`;let o=r?"wss://":"ws://",s=e.pop();if(s==null)throw new Error("Unexpected end of multiaddr");let a=Ze(s,e);return a=a?.replace("tcp://",""),`${o}${a}`},wss:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");let n=Ze(r,e);return n=n?.replace("tcp://",""),`wss://${n}`}};function Ml(t,e){let n=Ye(t).getComponents(),i=n.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let o=kl[i.name];if(o==null)throw new Error(`No interpreter found for ${i.name}`);let s=o(i,n)??"";return e?.assumeHttp!==!1&&mw.includes(i.code)&&(s=s.replace(/^.*:\/\//,""),i.value==="443"?s=`https://${s}`:s=`http://${s}`),(s.startsWith("http://")||s.startsWith("https://")||s.startsWith("ws://")||s.startsWith("wss://"))&&(s=new URL(s).toString(),s.endsWith("/")&&(s=s.substring(0,s.length-1))),s}var Fl="[a-fA-F\\d:]",zt=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Fl})|(?<=${Fl})(?=\\s|$))`:"",Xe="(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)(?:\\.(?:25[0-5]|2[0-4]\\d|1\\d\\d|[1-9]\\d|\\d)){3}",ce="[a-fA-F\\d]{1,4}",io=`
4
4
  (?:
5
- (?:${oe}:){7}(?:${oe}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
6
- (?:${oe}:){6}(?:${je}|:${oe}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
7
- (?:${oe}:){5}(?::${je}|(?::${oe}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
8
- (?:${oe}:){4}(?:(?::${oe}){0,1}:${je}|(?::${oe}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
9
- (?:${oe}:){3}(?:(?::${oe}){0,2}:${je}|(?::${oe}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
10
- (?:${oe}:){2}(?:(?::${oe}){0,3}:${je}|(?::${oe}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
11
- (?:${oe}:){1}(?:(?::${oe}){0,4}:${je}|(?::${oe}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
12
- (?::(?:(?::${oe}){0,5}:${je}|(?::${oe}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
5
+ (?:${ce}:){7}(?:${ce}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
6
+ (?:${ce}:){6}(?:${Xe}|:${ce}|:)| // 1:2:3:4:5:6:: 1:2:3:4:5:6::8 1:2:3:4:5:6::8 1:2:3:4:5:6::1.2.3.4
7
+ (?:${ce}:){5}(?::${Xe}|(?::${ce}){1,2}|:)| // 1:2:3:4:5:: 1:2:3:4:5::7:8 1:2:3:4:5::8 1:2:3:4:5::7:1.2.3.4
8
+ (?:${ce}:){4}(?:(?::${ce}){0,1}:${Xe}|(?::${ce}){1,3}|:)| // 1:2:3:4:: 1:2:3:4::6:7:8 1:2:3:4::8 1:2:3:4::6:7:1.2.3.4
9
+ (?:${ce}:){3}(?:(?::${ce}){0,2}:${Xe}|(?::${ce}){1,4}|:)| // 1:2:3:: 1:2:3::5:6:7:8 1:2:3::8 1:2:3::5:6:7:1.2.3.4
10
+ (?:${ce}:){2}(?:(?::${ce}){0,3}:${Xe}|(?::${ce}){1,5}|:)| // 1:2:: 1:2::4:5:6:7:8 1:2::8 1:2::4:5:6:7:1.2.3.4
11
+ (?:${ce}:){1}(?:(?::${ce}){0,4}:${Xe}|(?::${ce}){1,6}|:)| // 1:: 1::3:4:5:6:7:8 1::8 1::3:4:5:6:7:1.2.3.4
12
+ (?::(?:(?::${ce}){0,5}:${Xe}|(?::${ce}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
13
13
  )(?:%[0-9a-zA-Z]{1,})? // %eth0 %1
14
- `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),$m=new RegExp(`(?:^${je}$)|(?:^${zi}$)`),Km=new RegExp(`^${je}$`),Wm=new RegExp(`^${zi}$`),la=t=>t&&t.exact?$m:new RegExp(`(?:${Pt(t)}${je}${Pt(t)})|(?:${Pt(t)}${zi}${Pt(t)})`,"g");la.v4=t=>t&&t.exact?Km:new RegExp(`${Pt(t)}${je}${Pt(t)}`,"g");la.v6=t=>t&&t.exact?Wm:new RegExp(`${Pt(t)}${zi}${Pt(t)}`,"g");var da=la;function ha(t){let e=(...r)=>t(...r);return Object.defineProperty(e,"name",{value:`functionTimeout(${t.name||"<anonymous>"})`,configurable:!0}),e}function bl(){return!1}var{toString:jm}=Object.prototype;function pa(t){return jm.call(t)==="[object RegExp]"}var ml={global:"g",ignoreCase:"i",multiline:"m",dotAll:"s",sticky:"y",unicode:"u"};function ya(t,e={}){if(!pa(t))throw new TypeError("Expected a RegExp instance");let r=Object.keys(ml).map(i=>(typeof e[i]=="boolean"?e[i]:t[i])?ml[i]:"").join(""),n=new RegExp(e.source||t.source,r);return n.lastIndex=typeof e.lastIndex=="number"?e.lastIndex:t.lastIndex,n}function ba(t,e,{timeout:r}={}){try{return ha(()=>ya(t).test(e),{timeout:r})()}catch(n){if(bl(n))return!1;throw n}}var Vm=15,zm=45,wl={timeout:400};function ma(t){return t.length>zm?!1:ba(da.v6({exact:!0}),t,wl)}function gl(t){return t.length>Vm?!1:ba(da.v4({exact:!0}),t,wl)}var xl={http:"80",https:"443",ws:"80",wss:"443"},Gm=["http","https","ws","wss"];function El(t,e){e=e??{};let r=e.defaultDnsType??"dns",{scheme:n,hostname:i,port:o,path:s}=Ym(t),a=[Zm(i,r),Xm(o,n),Qm(n)];s!=null&&a.push(Jm(s));let u="/"+a.filter(c=>!!c).reduce((c,f)=>c.concat(f),[]).join("/");return Ke(u)}function Ym(t){let[e]=t.split(":");Gm.includes(e)||(t="http"+t.substring(e.length));let{protocol:r,hostname:n,port:i,pathname:o,search:s}=new URL(t);if(i==null||i===""){let u=ew(e);u!=null&&(i=u),u==null&&r==="http:"&&(i="80")}let a;return o!=null&&o!==""&&o!=="/"&&(o.startsWith("/")&&(o=o.substring(1)),a=o),s!=null&&s!==""&&(a=a??"",a+=s),{scheme:e,hostname:n,port:i,path:a}}function Zm(t,e){if(!(t==null||t==="")){if(gl(t))return["ip4",t];if(ma(t))return["ip6",t];if(t[0]==="["){let r=t.substring(1,t.length-1);if(ma(r))return["ip6",r]}return[e,t]}}function Xm(t,e){if(!(t==null||t===""))return e==="udp"?["udp",t]:["tcp",t]}function Qm(t){if(t.match(/^tcp$|^udp$/)==null)return t==="https"?["/tls/http"]:t==="wss"?["/tls/ws"]:[t]}function Jm(t){if(!(t==null||t===""))return["http-path",encodeURIComponent(t)]}function ew(t){if(!(t==null||t===""||xl[t]==null))return xl[t]}function Ur(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var Gi=class extends Error{type;code;constructor(e,r,n){super(e??"The operation was aborted"),this.type="aborted",this.name=n??"AbortError",this.code=r??"ABORT_ERR"}};async function kn(t,e,r){if(e==null)return t;if(e.aborted)return t.catch(()=>{}),Promise.reject(new Gi(r?.errorMessage,r?.errorCode,r?.errorName));let n,i=new Gi(r?.errorMessage,r?.errorCode,r?.errorName);try{return await Promise.race([t,new Promise((o,s)=>{n=()=>{s(i)},e.addEventListener("abort",n)})])}finally{n!=null&&e.removeEventListener("abort",n)}}var wa=class{readNext;haveNext;ended;nextResult;error;constructor(){this.ended=!1,this.readNext=Ur(),this.haveNext=Ur()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=Ur(),e}async throw(e){return this.ended=!0,this.error=e,e!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(e)),{done:!0,value:void 0}}async return(){let e={done:!0,value:void 0};return this.ended=!0,this.nextResult=e,this.haveNext.resolve(),e}async push(e,r){await this._push(e,r)}async end(e,r){e!=null?await this.throw(e):await this._push(void 0,r)}async _push(e,r){if(e!=null&&this.ended)throw this.error??new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=Ur(),await kn(this.readNext.promise,r?.signal,r)}};function Mn(){return new wa}function Sl(t){if(t!=null){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}function ga(t,e={}){let r=Sl(t),n={_cancelled:!1,async start(){this._cancelled=!1},async pull(i){try{let{value:o,done:s}=await r.next();if(this._cancelled)return;if(s===!0){i.close();return}i.enqueue(o)}catch(o){i.error(o)}},cancel(){this._cancelled=!0}};return new globalThis.ReadableStream(n,e)}var tw=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),_l=an({name:"sha-1",code:17,encode:tw("SHA-1")});var Fn=class extends globalThis.Request{constructor(e,r={}){let n=r.method??"GET",i=qn(r),o=r.body;xa(n,i)&&(r.method="UPGRADE"),super(e,r),Object.defineProperties(this,{body:{value:o,writable:!1},method:{value:n,writable:!1},headers:{value:i,writable:!1}})}};var Ea={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};var Sa=class extends globalThis.Response{constructor(e,r={}){let n=qn(r),i=r.status??200;(i<200||i>599)&&(r.status=200),super(e,r),Object.defineProperties(this,{status:{value:i,writable:!1},statusText:{value:Ea[i],writable:!1},headers:{value:n,writable:!1}})}};var r0=h0(Jp(),1);var Po=class extends Error{name="UnexpectedEOFError";code="ERR_UNEXPECTED_EOF"};function e0(t,e){let r=Mn();t.sink(r).catch(async s=>{await r.end(s)}),t.sink=async s=>{for await(let a of s)await r.push(a);await r.end()};let n=t.source;t.source[Symbol.iterator]!=null?n=t.source[Symbol.iterator]():t.source[Symbol.asyncIterator]!=null&&(n=t.source[Symbol.asyncIterator]());let i=new ce;return{read:async s=>{if(s?.signal?.throwIfAborted(),s?.bytes==null){let{done:u,value:c}=await kn(n.next(),s?.signal);return u===!0?null:c}for(;i.byteLength<s.bytes;){let{value:u,done:c}=await kn(n.next(),s?.signal);if(c===!0)throw new Po("unexpected end of input");i.append(u)}let a=i.sublist(0,s.bytes);return i.consume(s.bytes),a},write:async(s,a)=>{a?.signal?.throwIfAborted(),s instanceof Uint8Array?await r.push(s,a):await r.push(s.subarray(),a)},unwrap:()=>{if(i.byteLength>0){let s=t.source;t.source=async function*(){e?.yieldBytes===!1?yield i:yield*i,yield*s}()}return t}}}var t0=2147483647,Gu=class extends r0.Duplex{autoSelectFamilyAttemptedAddresses=[];connecting=!1;pending=!1;remoteAddress;bytesRead;bytesWritten;timeout=t0;allowHalfOpen;stream;constructor(e,r){let n=e0(e);super({write:(i,o,s)=>{this.stream.log("write %d bytes",i.byteLength),this.bytesWritten+=i.byteLength,n.write(i).then(()=>{s()},a=>{s(a)})},read:i=>{this.stream.log("asked to read %d bytes",i),Promise.resolve().then(async()=>{try{for(;;){let o=await n.read({signal:AbortSignal.timeout(this.timeout)});if(o==null){this.stream.log("socket readable end closed"),this.push(null);return}if(this.bytesRead+=o.byteLength,this.stream.log("socket read %d bytes",o.byteLength),!this.push(o.subarray()))break}}catch(o){this.destroy(o)}})},destroy:(i,o)=>{this.stream.log("destroy with %d bytes buffered - %e",this.bufferSize,i),i!=null?(n.unwrap().abort(i),o()):n.unwrap().close().then(()=>{o()}).catch(s=>{e.abort(s),o(s)})},final:i=>{this.stream.log("final"),n.unwrap().closeWrite().then(()=>{i()}).catch(o=>{n.unwrap().abort(o),i(o)})}}),this.stream=e,this.remoteAddress=r.remoteAddr.toString(),this.bytesRead=0,this.bytesWritten=0,this.allowHalfOpen=!0}get readyState(){return this.stream.status==="closed"?"closed":this.stream.writeStatus==="closed"||this.stream.writeStatus==="closing"?"readOnly":this.stream.readStatus==="closed"||this.stream.readStatus==="closing"?"writeOnly":"open"}get bufferSize(){return this.writableLength}destroySoon(){this.stream.log("destroySoon with %d bytes buffered",this.bufferSize),this.destroy()}connect(...e){return this.stream.log("connect %o",e),this}setEncoding(e){return this.stream.log("setEncoding %s",e),this}resetAndDestroy(){return this.stream.log("resetAndDestroy"),this.stream.abort(new Error("Libp2pSocket.resetAndDestroy")),this}setTimeout(e,r){return this.stream.log("setTimeout %d",e),r!=null&&this.addListener("timeout",r),this.timeout=e===0?t0:e,this}setNoDelay(e){return this.stream.log("setNoDelay %b",e),this}setKeepAlive(e,r){return this.stream.log("setKeepAlive %b %d",e,r),this}address(){return this.stream.log("address"),{}}unref(){return this.stream.log("unref"),this}ref(){return this.stream.log("ref"),this}write(e,r,n){return super.write(e,r,n)}};function aS(t,e){return new Gu(t,e)}var uS=["dns","dns4","dns6","dnsaddr"];function fS(t,e){if(t instanceof URL)return t;let r=o0(t,e),{httpPath:n}=s0(t);return new URL(`http://${r}${n}`)}function cS(t){return t instanceof Uint8Array?t:t instanceof DataView?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t,0,t.byteLength)}function lS(t,e){let r={method:t.method,headers:t.headers};if((r.method!=="GET"||t.upgrade)&&r.method!=="HEAD"){let n=e.source;t.upgrade||(n=mS(e.source,t.headers.get("content-length"))),r.body=ga(n),r.duplex="half"}return new Fn(a0(t).toString(),r)}async function dS(t,e){let r=Mn();if(e.sink(r).catch(o=>{e.abort(o)}),await r.push(Y([`HTTP/1.1 ${t.status} ${t.statusText}`,...i0(t.headers),"",""].join(`\r
15
- `))),t.body==null){await r.end();return}let n=t.body.getReader(),i=await n.read();for(;i.value!=null&&await r.push(i.value),!i.done;)i=await n.read();await r.end(),await e.closeWrite().catch(o=>{e.abort(o)})}var hS=Y(["HTTP/1.1 404 Not Found","Connection: close","",""].join(`\r
16
- `)),pS=Y(["HTTP/1.1 400 Bad Request","Connection: close","",""].join(`\r
17
- `)),yS=Y(["HTTP/1.1 500 Internal Server Error","Connection: close","",""].join(`\r
18
- `)),bS=Y(["HTTP/1.1 501 Not Implemented","Connection: close","",""].join(`\r
19
- `));function i0(t){let e=[];t.get("Connection")==null&&t.set("Connection","close");for(let[r,n]of t.entries())e.push(`${r}: ${n}`);return e}async function*mS(t,e){if(e=parseInt(`${e??""}`),e==null||isNaN(e))return t;let r=0;for await(let n of t){if(r+=n.byteLength,r>e){yield n.subarray(0,r-e);return}if(yield n.subarray(),r===e)return}}function wS(t,e){if(typeof t=="string"&&(t.startsWith("/")?t=Ke(t):t=new URL(t)),Ef(t)&&(t=Ke(`/p2p/${t}`)),t instanceof URL&&t.protocol==="multiaddr:"&&(t=El(t.toString())),Vi(t)&&(t=[t]),Array.isArray(t)){for(let r of t)if(r.getComponents().some(({name:i})=>i==="http")){let i=pl(r);return new URL(`${i}${e??""}`)}}return e==null?t:t instanceof URL?new URL(`${t}${e.substring(1)}`):t.map(r=>r.encapsulate(`/http-path/${encodeURIComponent(e.substring(1))}`))}function qn(t={}){return t.headers instanceof Headers||(t.headers=new Headers(t.headers)),t.headers}function gS(t,e={}){return e instanceof Headers?e.get(t)??void 0:Array.isArray(e)?e.find(([r,n])=>{if(r===t)return n})?.[1]:e[t]}function ti(t){return t!=null&&t!==""}function o0(t,e){let r,n=80,i="http:";if(t instanceof URL&&(r=t.hostname,n=parseInt(t.port,10),i=t.protocol),ti(r)||(r=e.get("host")??void 0),!ti(r)&&Array.isArray(t))for(let o of t){let a=o.getComponents().filter(({name:u})=>uS.includes(u))?.[0]?.value;if(a!=null){r=a;break}}if(!ti(r)&&Array.isArray(t))for(let o of t){let s=o.getPeerId();try{n=o.toOptions().port}catch{}if(s!=null){r=Wc(s).toCID().toString(qt);break}}if(!ti(r)&&Array.isArray(t))for(let o of t)try{r=o.toOptions().host;break}catch{}if(ti(r))return i==="http:"&&n!==80&&(r=`${r}:${n}`),i==="https:"&&n!==443&&(r=`${r}:${n}`),r;throw new Ce("Could not determine request host name - a request must have a host header, be made to a DNS or IP-based multiaddr or an http(s) URL")}function s0(t){let e="/";return t=t.map(r=>Ke(r.getComponents().filter(n=>n.name==="http-path"?(e=n.value??"/",!1):!0))),{httpPath:e,addresses:t}}function xS(t,e=["GET"]){return t==null?e:(typeof t=="string"&&(t=[t]),t.map(r=>r.toUpperCase()))}function a0(t){let e=t.url??"/";if(e.startsWith("http"))return new URL(e);let r=ES(t);return new URL(`http://${r}${e}`)}function ES(t){let e=t.headers?.host;if(e==null&&(e=t.headers?.Host),e==null&&typeof t.headers.get=="function"&&(e=t.headers.get("host")),e==null)throw new Ce("Could not read host");return e}function xa(t,e){return t==="GET"&&e.get("connection")?.toLowerCase()==="upgrade"&&e.get("upgrade")?.toLowerCase()==="websocket"}function n0(t,e){if(t instanceof Headers)return t.get(e)??void 0;let r=t[e];return Array.isArray(r)?r.join(","):r}async function SS(t){if(n0(t,"sec-websocket-version")!=="13")throw new ln("Invalid version");let e=n0(t,"sec-websocket-key");if(e==null)throw new ln("Missing sec-websocket-key");let r=`${e}258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,n=await _l.digest(Y(r)),i=Vo.encode(n.digest).substring(1);return new Headers({Upgrade:"websocket",Connection:"upgrade","Sec-WebSocket-Accept":i})}async function _S(t){return new Promise((e,r)=>{let n=new N("REQUEST"),i=Mn(),o=new ce,s=!1;n[N.kOnHeadersComplete]=u=>{s=!0;let c=new Headers;for(let f=0;f<u.headers.length;f+=2)c.set(u.headers[f].toLowerCase(),u.headers[f+1]);e({...u,headers:c,raw:o,method:N.methods[u.method]})};let a=t.source;t.source=i,Promise.resolve().then(async()=>{for await(let u of a)s?await i.push(new ce(u)):(o.append(u),n.execute(u.subarray()));await i.end()}).catch(u=>{t.abort(u),r(u)}).finally(()=>{n.finish()})})}return p0(AS);})();
14
+ `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),ww=new RegExp(`(?:^${Xe}$)|(?:^${io}$)`),gw=new RegExp(`^${Xe}$`),xw=new RegExp(`^${io}$`),Pa=t=>t&&t.exact?ww:new RegExp(`(?:${zt(t)}${Xe}${zt(t)})|(?:${zt(t)}${io}${zt(t)})`,"g");Pa.v4=t=>t&&t.exact?gw:new RegExp(`${zt(t)}${Xe}${zt(t)}`,"g");Pa.v6=t=>t&&t.exact?xw:new RegExp(`${zt(t)}${io}${zt(t)}`,"g");var Oa=Pa;function Ua(t){let e=(...r)=>t(...r);return Object.defineProperty(e,"name",{value:`functionTimeout(${t.name||"<anonymous>"})`,configurable:!0}),e}function ql(){return!1}var{toString:Ew}=Object.prototype;function ka(t){return Ew.call(t)==="[object RegExp]"}var Hl={global:"g",ignoreCase:"i",multiline:"m",dotAll:"s",sticky:"y",unicode:"u"};function Ma(t,e={}){if(!ka(t))throw new TypeError("Expected a RegExp instance");let r=Object.keys(Hl).map(i=>(typeof e[i]=="boolean"?e[i]:t[i])?Hl[i]:"").join(""),n=new RegExp(e.source||t.source,r);return n.lastIndex=typeof e.lastIndex=="number"?e.lastIndex:t.lastIndex,n}function Fa(t,e,{timeout:r}={}){try{return Ua(()=>Ma(t).test(e),{timeout:r})()}catch(n){if(ql(n))return!1;throw n}}var Sw=15,_w=45,$l={timeout:400};function qa(t){return t.length>_w?!1:Fa(Oa.v6({exact:!0}),t,$l)}function Kl(t){return t.length>Sw?!1:Fa(Oa.v4({exact:!0}),t,$l)}var Vl={http:"80",https:"443",ws:"80",wss:"443"},Aw=["http","https","ws","wss"];function Wl(t,e){e=e??{};let r=e.defaultDnsType??"dns",{scheme:n,hostname:i,port:o,path:s}=Iw(t),a=[vw(i,r),Tw(o,n),Bw(n)];s!=null&&a.push(Rw(s));let u="/"+a.filter(c=>!!c).reduce((c,f)=>c.concat(f),[]).join("/");return Ye(u)}function Iw(t){let[e]=t.split(":");Aw.includes(e)||(t="http"+t.substring(e.length));let{protocol:r,hostname:n,port:i,pathname:o,search:s}=new URL(t);if(i==null||i===""){let u=Cw(e);u!=null&&(i=u),u==null&&r==="http:"&&(i="80")}let a;return o!=null&&o!==""&&o!=="/"&&(o.startsWith("/")&&(o=o.substring(1)),a=o),s!=null&&s!==""&&(a=a??"",a+=s),{scheme:e,hostname:n,port:i,path:a}}function vw(t,e){if(!(t==null||t==="")){if(Kl(t))return["ip4",t];if(qa(t))return["ip6",t];if(t[0]==="["){let r=t.substring(1,t.length-1);if(qa(r))return["ip6",r]}return[e,t]}}function Tw(t,e){if(!(t==null||t===""))return e==="udp"?["udp",t]:["tcp",t]}function Bw(t){if(t.match(/^tcp$|^udp$/)==null)return t==="https"?["/tls/http"]:t==="wss"?["/tls/ws"]:[t]}function Rw(t){if(!(t==null||t===""))return["http-path",encodeURIComponent(t)]}function Cw(t){if(!(t==null||t===""||Vl[t]==null))return Vl[t]}function Gr(){let t={};return t.promise=new Promise((e,r)=>{t.resolve=e,t.reject=r}),t}var oo=class extends Error{type;code;constructor(e,r,n){super(e??"The operation was aborted"),this.type="aborted",this.name=n??"AbortError",this.code=r??"ABORT_ERR"}};async function Gn(t,e,r){if(e==null)return t;if(e.aborted)return t.catch(()=>{}),Promise.reject(new oo(r?.errorMessage,r?.errorCode,r?.errorName));let n,i=new oo(r?.errorMessage,r?.errorCode,r?.errorName);try{return await Promise.race([t,new Promise((o,s)=>{n=()=>{s(i)},e.addEventListener("abort",n)})])}finally{n!=null&&e.removeEventListener("abort",n)}}var Ha=class{readNext;haveNext;ended;nextResult;error;constructor(){this.ended=!1,this.readNext=Gr(),this.haveNext=Gr()}[Symbol.asyncIterator](){return this}async next(){if(this.nextResult==null&&await this.haveNext.promise,this.nextResult==null)throw new Error("HaveNext promise resolved but nextResult was undefined");let e=this.nextResult;return this.nextResult=void 0,this.readNext.resolve(),this.readNext=Gr(),e}async throw(e){return this.ended=!0,this.error=e,e!=null&&(this.haveNext.promise.catch(()=>{}),this.haveNext.reject(e)),{done:!0,value:void 0}}async return(){let e={done:!0,value:void 0};return this.ended=!0,this.nextResult=e,this.haveNext.resolve(),e}async push(e,r){await this._push(e,r)}async end(e,r){e!=null?await this.throw(e):await this._push(void 0,r)}async _push(e,r){if(e!=null&&this.ended)throw this.error??new Error("Cannot push value onto an ended pushable");for(;this.nextResult!=null;)await this.readNext.promise;e!=null?this.nextResult={done:!1,value:e}:(this.ended=!0,this.nextResult={done:!0,value:void 0}),this.haveNext.resolve(),this.haveNext=Gr(),await Gn(this.readNext.promise,r?.signal,r)}};function Yn(){return new Ha}function jl(t){if(t!=null){if(typeof t[Symbol.iterator]=="function")return t[Symbol.iterator]();if(typeof t[Symbol.asyncIterator]=="function")return t[Symbol.asyncIterator]();if(typeof t.next=="function")return t}throw new Error("argument is not an iterator or iterable")}function $a(t,e={}){let r=jl(t),n={_cancelled:!1,async start(){this._cancelled=!1},async pull(i){try{let{value:o,done:s}=await r.next();if(this._cancelled)return;if(s===!0){i.close();return}i.enqueue(o)}catch(o){i.error(o)}},cancel(){this._cancelled=!0}};return new globalThis.ReadableStream(n,e)}var Dw=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),zl=wn({name:"sha-1",code:17,encode:Dw("SHA-1")});var Zn=class extends globalThis.Request{constructor(e,r={}){let n=r.method??"GET",i=Xn(r),o=r.body;Ka(n,i)&&(r.method="UPGRADE"),super(e,r),Object.defineProperties(this,{body:{value:o,writable:!1},method:{value:n,writable:!1},headers:{value:i,writable:!1}})}};var Va={100:"Continue",101:"Switching Protocols",102:"Processing",103:"Early Hints",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",208:"Already Reported",226:"IM Used",300:"Multiple Choices",301:"Moved Permanently",302:"Found",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Timeout",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Payload Too Large",414:"URI Too Long",415:"Unsupported Media Type",416:"Range Not Satisfiable",417:"Expectation Failed",418:"I'm a Teapot",421:"Misdirected Request",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Too Early",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",451:"Unavailable For Legal Reasons",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Timeout",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",508:"Loop Detected",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"};var Wa=class extends globalThis.Response{constructor(e,r={}){let n=Xn(r),i=r.status??200;(i<200||i>599)&&(r.status=200),super(e,r),Object.defineProperties(this,{status:{value:i,writable:!1},statusText:{value:Va[i],writable:!1},headers:{value:n,writable:!1}})}};var v0=k0(_0(),1);var Vo=class extends Error{name="UnexpectedEOFError";code="ERR_UNEXPECTED_EOF"};function A0(t,e){let r=Yn();t.sink(r).catch(async s=>{await r.end(s)}),t.sink=async s=>{for await(let a of s)await r.push(a);await r.end()};let n=t.source;t.source[Symbol.iterator]!=null?n=t.source[Symbol.iterator]():t.source[Symbol.asyncIterator]!=null&&(n=t.source[Symbol.asyncIterator]());let i=new pe;return{read:async s=>{if(s?.signal?.throwIfAborted(),s?.bytes==null){let{done:u,value:c}=await Gn(n.next(),s?.signal);return u===!0?null:c}for(;i.byteLength<s.bytes;){let{value:u,done:c}=await Gn(n.next(),s?.signal);if(c===!0)throw new Vo("unexpected end of input");i.append(u)}let a=i.sublist(0,s.bytes);return i.consume(s.bytes),a},write:async(s,a)=>{a?.signal?.throwIfAborted(),s instanceof Uint8Array?await r.push(s,a):await r.push(s.subarray(),a)},unwrap:()=>{if(i.byteLength>0){let s=t.source;t.source=async function*(){e?.yieldBytes===!1?yield i:yield*i,yield*s}()}return t}}}var I0=2147483647,Wo=class extends v0.Duplex{autoSelectFamilyAttemptedAddresses=[];connecting=!1;pending=!1;remoteAddress;bytesRead;bytesWritten;timeout=I0;allowHalfOpen;#e;#t;constructor(){super(),this.bytesRead=0,this.bytesWritten=0,this.allowHalfOpen=!0,this.remoteAddress=""}setStream(e,r){this.#t=A0(e),this.#e=e,this.remoteAddress=r.remoteAddr.toString()}_write(e,r,n){this.#e?.log("write %d bytes",e.byteLength),this.bytesWritten+=e.byteLength,this.#t?.write(e).then(()=>{n()},i=>{n(i)})}_read(e){this.#e?.log("asked to read %d bytes",e),Promise.resolve().then(async()=>{try{for(;;){let r=await this.#t?.read({signal:AbortSignal.timeout(this.timeout)});if(r==null){this.#e?.log("socket readable end closed"),this.push(null);return}if(this.bytesRead+=r.byteLength,this.#e?.log("socket read %d bytes",r.byteLength),!this.push(r.subarray()))break}}catch(r){this.destroy(r)}})}_destroy(e,r){this.#e?.log("destroy with %d bytes buffered - %e",this.bufferSize,e),e!=null?(this.#t?.unwrap().abort(e),r()):this.#t?.unwrap().close().then(()=>{r()}).catch(n=>{this.#e?.abort(n),r(n)})}_final(e){this.#e?.log("final"),this.#t?.unwrap().closeWrite().then(()=>{e()}).catch(r=>{this.#t?.unwrap().abort(r),e(r)})}get readyState(){return this.#e?.status==="closed"?"closed":this.#e?.writeStatus==="closed"||this.#e?.writeStatus==="closing"?"readOnly":this.#e?.readStatus==="closed"||this.#e?.readStatus==="closing"?"writeOnly":"open"}get bufferSize(){return this.writableLength}destroySoon(){this.#e?.log("destroySoon with %d bytes buffered",this.bufferSize),this.destroy()}connect(...e){return this.#e?.log("connect %o",e),this}setEncoding(e){return this.#e?.log("setEncoding %s",e),this}resetAndDestroy(){return this.#e?.log("resetAndDestroy"),this.#e?.abort(new Error("Libp2pSocket.resetAndDestroy")),this}setTimeout(e,r){return this.#e?.log("setTimeout %d",e),r!=null&&this.addListener("timeout",r),this.timeout=e===0?I0:e,this}setNoDelay(e){return this.#e?.log("setNoDelay %b",e),this}setKeepAlive(e,r){return this.#e?.log("setKeepAlive %b %d",e,r),this}address(){return this.#e?.log("address"),{}}unref(){return this.#e?.log("unref"),this}ref(){return this.#e?.log("ref"),this}write(e,r,n){return super.write(e,r,n)}};function kS(t,e){let r=new Wo;return r.setStream(t,e),r}var MS=["dns","dns4","dns6","dnsaddr"];function FS(t,e){if(t instanceof URL)return t;let r=R0(t,e),{httpPath:n}=C0(t);return new URL(`http://${r}${n}`)}function qS(t){return t instanceof Uint8Array?t:t instanceof DataView?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t,0,t.byteLength)}function HS(t,e){let r={method:t.method,headers:t.headers};if((r.method!=="GET"||t.upgrade)&&r.method!=="HEAD"){let n=e.source;t.upgrade||(n=zS(e.source,t.headers.get("content-length"))),r.body=$a(n),r.duplex="half"}return new Zn(D0(t).toString(),r)}async function $S(t,e){let r=Yn();if(e.sink(r).catch(o=>{e.abort(o)}),await r.push(Q([`HTTP/1.1 ${t.status} ${t.statusText}`,...B0(t.headers),"",""].join(`\r
15
+ `))),t.body==null){await r.end();return}let n=t.body.getReader(),i=await n.read();for(;i.value!=null&&await r.push(i.value),!i.done;)i=await n.read();await r.end(),await e.closeWrite().catch(o=>{e.abort(o)})}var KS=Q(["HTTP/1.1 404 Not Found","Connection: close","",""].join(`\r
16
+ `)),VS=Q(["HTTP/1.1 400 Bad Request","Connection: close","",""].join(`\r
17
+ `)),WS=Q(["HTTP/1.1 500 Internal Server Error","Connection: close","",""].join(`\r
18
+ `)),jS=Q(["HTTP/1.1 501 Not Implemented","Connection: close","",""].join(`\r
19
+ `));function B0(t){let e=[];t.get("Connection")==null&&t.set("Connection","close");for(let[r,n]of t.entries())e.push(`${r}: ${n}`);return e}async function*zS(t,e){if(e=parseInt(`${e??""}`),e==null||isNaN(e))return t;let r=0;for await(let n of t){if(r+=n.byteLength,r>e){yield n.subarray(0,r-e);return}if(yield n.subarray(),r===e)return}}function GS(t,e){if(typeof t=="string"&&(t.startsWith("/")?t=Ye(t):t=new URL(t)),Wc(t)&&(t=Ye(`/p2p/${t}`)),t instanceof URL&&t.protocol==="multiaddr:"&&(t=Wl(t.toString())),no(t)&&(t=[t]),Array.isArray(t)){for(let r of t)if(r.getComponents().some(({name:i})=>i==="http")){let i=Ml(r);return new URL(`${i}${e??""}`)}}return e==null?t:t instanceof URL?new URL(`${t}${e.substring(1)}`):t.map(r=>r.encapsulate(`/http-path/${encodeURIComponent(e.substring(1))}`))}function Xn(t={}){return t.headers instanceof Headers||(t.headers=new Headers(t.headers)),t.headers}function YS(t,e={}){return e instanceof Headers?e.get(t)??void 0:Array.isArray(e)?e.find(([r,n])=>{if(r===t)return n})?.[1]:e[t]}function di(t){return t!=null&&t!==""}function R0(t,e){let r,n=80,i="http:";if(t instanceof URL&&(r=t.hostname,n=parseInt(t.port,10),i=t.protocol),di(r)||(r=e.get("host")??void 0),!di(r)&&Array.isArray(t))for(let o of t){let a=o.getComponents().filter(({name:u})=>MS.includes(u))?.[0]?.value;if(a!=null){r=a;break}}if(!di(r)&&Array.isArray(t))for(let o of t){let s=o.getPeerId();try{n=o.toOptions().port}catch{}if(s!=null){r=pl(s).toCID().toString(Jt);break}}if(!di(r)&&Array.isArray(t))for(let o of t)try{r=o.toOptions().host;break}catch{}if(di(r))return i==="http:"&&n!==80&&(r=`${r}:${n}`),i==="https:"&&n!==443&&(r=`${r}:${n}`),r;throw new Oe("Could not determine request host name - a request must have a host header, be made to a DNS or IP-based multiaddr or an http(s) URL")}function C0(t){let e="/";return t=t.map(r=>Ye(r.getComponents().filter(n=>n.name==="http-path"?(e=n.value??"/",!1):!0))),{httpPath:e,addresses:t}}function ZS(t,e=["GET"]){return t==null?e:(typeof t=="string"&&(t=[t]),t.map(r=>r.toUpperCase()))}function D0(t){let e=t.url??"/";if(e.startsWith("http"))return new URL(e);let r=XS(t);return new URL(`http://${r}${e}`)}function XS(t){let e=t.headers?.host;if(e==null&&(e=t.headers?.Host),e==null&&typeof t.headers.get=="function"&&(e=t.headers.get("host")),e==null)throw new Oe("Could not read host");return e}function Ka(t,e){return t==="GET"&&e.get("connection")?.toLowerCase()==="upgrade"&&e.get("upgrade")?.toLowerCase()==="websocket"}function T0(t,e){if(t instanceof Headers)return t.get(e)??void 0;let r=t[e];return Array.isArray(r)?r.join(","):r}async function QS(t){if(T0(t,"sec-websocket-version")!=="13")throw new Sn("Invalid version");let e=T0(t,"sec-websocket-key");if(e==null)throw new Sn("Missing sec-websocket-key");let r=`${e}258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,n=await zl.digest(Q(r)),i=ns.encode(n.digest).substring(1);return new Headers({Upgrade:"websocket",Connection:"upgrade","Sec-WebSocket-Accept":i})}async function JS(t){return new Promise((e,r)=>{let n=new D("REQUEST"),i=Yn(),o=new pe,s=!1;n[D.kOnHeadersComplete]=u=>{s=!0;let c=new Headers;for(let f=0;f<u.headers.length;f+=2)c.set(u.headers[f].toLowerCase(),u.headers[f+1]);e({...u,headers:c,raw:o,method:D.methods[u.method]})};let a=t.source;t.source=i,Promise.resolve().then(async()=>{for await(let u of a)s?await i.push(new pe(u)):(o.append(u),n.execute(u.subarray()));await i.end()}).catch(u=>{t.abort(u),r(u)}).finally(()=>{n.finish()})})}return M0(e_);})();
20
20
  /*! Bundled license information:
21
21
 
22
22
  ieee754/index.js: