@libp2p/http-utils 2.0.2 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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 P0=Object.create;var ri=Object.defineProperty;var U0=Object.getOwnPropertyDescriptor;var F0=Object.getOwnPropertyNames;var k0=Object.getPrototypeOf,M0=Object.prototype.hasOwnProperty;var V=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Oe=(t,e)=>{for(var r in e)ri(t,r,{get:e[r],enumerable:!0})},xf=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of F0(e))!M0.call(t,i)&&i!==r&&ri(t,i,{get:()=>e[i],enumerable:!(n=U0(e,i))||n.enumerable});return t};var q0=(t,e,r)=>(r=t!=null?P0(k0(t)):{},xf(e||!t||!t.__esModule?ri(r,"default",{value:t,enumerable:!0}):r,t)),$0=t=>xf(ri({},"__esModule",{value:!0}),t);var ed=V(ro=>{"use strict";ro.byteLength=vw;ro.toByteArray=Cw;ro.fromByteArray=Ow;var rt=[],ke=[],Rw=typeof Uint8Array<"u"?Uint8Array:Array,Wa="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(sr=0,Ql=Wa.length;sr<Ql;++sr)rt[sr]=Wa[sr],ke[Wa.charCodeAt(sr)]=sr;var sr,Ql;ke[45]=62;ke[95]=63;function Jl(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 vw(t){var e=Jl(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Bw(t,e,r){return(e+r)*3/4-r}function Cw(t){var e,r=Jl(t),n=r[0],i=r[1],o=new Rw(Bw(t,n,i)),s=0,a=i>0?n-4:n,f;for(f=0;f<a;f+=4)e=ke[t.charCodeAt(f)]<<18|ke[t.charCodeAt(f+1)]<<12|ke[t.charCodeAt(f+2)]<<6|ke[t.charCodeAt(f+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=ke[t.charCodeAt(f)]<<2|ke[t.charCodeAt(f+1)]>>4,o[s++]=e&255),i===1&&(e=ke[t.charCodeAt(f)]<<10|ke[t.charCodeAt(f+1)]<<4|ke[t.charCodeAt(f+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function Dw(t){return rt[t>>18&63]+rt[t>>12&63]+rt[t>>6&63]+rt[t&63]}function Lw(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(Dw(n));return i.join("")}function Ow(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(Lw(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 td=V(za=>{za.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,f=(1<<a)-1,c=f>>1,u=-7,l=r?i-1:0,h=r?-1:1,d=t[e+l];for(l+=h,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=o*256+t[e+l],l+=h,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=s*256+t[e+l],l+=h,u-=8);if(o===0)o=1-c;else{if(o===f)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)};za.write=function(t,e,r,n,i,o){var s,a,f,c=o*8-i-1,u=(1<<c)-1,l=u>>1,h=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,w=n?1:-1,p=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=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+l>=1?e+=h/f:e+=h*Math.pow(2,1-l),e*f>=2&&(s++,f/=2),s+l>=u?(a=0,s=u):s+l>=1?(a=(e*f-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+=w,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+d]=s&255,d+=w,s/=256,c-=8);t[r+d-w]|=p*128}});var _t=V(Kr=>{"use strict";var Ga=ed(),$r=td(),rd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Kr.Buffer=g;Kr.SlowBuffer=Mw;Kr.INSPECT_MAX_BYTES=50;var no=2147483647;Kr.kMaxLength=no;g.TYPED_ARRAY_SUPPORT=Nw();!g.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 Nw(){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(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function St(t){if(t>no)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,g.prototype),e}function g(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 sd(t,e,r)}g.poolSize=8192;function sd(t,e,r){if(typeof t=="string")return Uw(t,e);if(ArrayBuffer.isView(t))return Fw(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 g.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 g.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)}g.from=function(t,e,r){return sd(t,e,r)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function ad(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 Pw(t,e,r){return ad(t),t<=0?St(t):e!==void 0?typeof r=="string"?St(t).fill(e,r):St(t).fill(e):St(t)}g.alloc=function(t,e,r){return Pw(t,e,r)};function Qa(t){return ad(t),St(t<0?0:Ja(t)|0)}g.allocUnsafe=function(t){return Qa(t)};g.allocUnsafeSlow=function(t){return Qa(t)};function Uw(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!g.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=cd(t,e)|0,n=St(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=St(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function Fw(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,g.prototype),n}function kw(t){if(g.isBuffer(t)){let e=Ja(t.length)|0,r=St(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||tc(t.length)?St(0):Ya(t);if(t.type==="Buffer"&&Array.isArray(t.data))return Ya(t.data)}function Ja(t){if(t>=no)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+no.toString(16)+" bytes");return t|0}function Mw(t){return+t!=t&&(t=0),g.alloc(+t)}g.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==g.prototype};g.compare=function(e,r){if(nt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),nt(r,Uint8Array)&&(r=g.from(r,r.offset,r.byteLength)),!g.isBuffer(e)||!g.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};g.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}};g.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return g.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=g.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let s=e[n];if(nt(s,Uint8Array))o+s.length>i.length?(g.isBuffer(s)||(s=g.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(g.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function cd(t,e){if(g.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 md(t).length;default:if(i)return n?-1:Xa(t).length;e=(""+e).toLowerCase(),i=!0}}g.byteLength=cd;function qw(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 Zw(this,e,r);case"utf8":case"utf-8":return ud(this,e,r);case"ascii":return Gw(this,e,r);case"latin1":case"binary":return Yw(this,e,r);case"base64":return Ww(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Xw(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}g.prototype._isBuffer=!0;function ar(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}g.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)ar(this,r,r+1);return this};g.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)ar(this,r,r+3),ar(this,r+1,r+2);return this};g.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)ar(this,r,r+7),ar(this,r+1,r+6),ar(this,r+2,r+5),ar(this,r+3,r+4);return this};g.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?ud(this,0,e):qw.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(e){if(!g.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:g.compare(this,e)===0};g.prototype.inspect=function(){let e="",r=Kr.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};rd&&(g.prototype[rd]=g.prototype.inspect);g.prototype.compare=function(e,r,n,i,o){if(nt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),!g.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,f=Math.min(s,a),c=this.slice(i,o),u=e.slice(r,n);for(let l=0;l<f;++l)if(c[l]!==u[l]){s=c[l],a=u[l];break}return s<a?-1:a<s?1:0};function fd(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,tc(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=g.from(e,n)),g.isBuffer(e))return e.length===0?-1:nd(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):nd(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function nd(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 f(u,l){return o===1?u[l]:u.readUInt16BE(l*o)}let c;if(i){let u=-1;for(c=r;c<s;c++)if(f(t,c)===f(e,u===-1?0:c-u)){if(u===-1&&(u=c),c-u+1===a)return u*o}else u!==-1&&(c-=c-u),u=-1}else for(r+a>s&&(r=s-a),c=r;c>=0;c--){let u=!0;for(let l=0;l<a;l++)if(f(t,c+l)!==f(e,l)){u=!1;break}if(u)return c}return-1}g.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};g.prototype.indexOf=function(e,r,n){return fd(this,e,r,n,!0)};g.prototype.lastIndexOf=function(e,r,n){return fd(this,e,r,n,!1)};function $w(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(tc(a))return s;t[r+s]=a}return s}function Hw(t,e,r,n){return io(Xa(e,t.length-r),t,r,n)}function Kw(t,e,r,n){return io(tg(e),t,r,n)}function jw(t,e,r,n){return io(md(e),t,r,n)}function Vw(t,e,r,n){return io(rg(e,t.length-r),t,r,n)}g.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 $w(this,e,r,n);case"utf8":case"utf-8":return Hw(this,e,r,n);case"ascii":case"latin1":case"binary":return Kw(this,e,r,n);case"base64":return jw(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return Vw(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Ww(t,e,r){return e===0&&r===t.length?Ga.fromByteArray(t):Ga.fromByteArray(t.slice(e,r))}function ud(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 f,c,u,l;switch(a){case 1:o<128&&(s=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(s=l));break;case 3:f=t[i+1],c=t[i+2],(f&192)===128&&(c&192)===128&&(l=(o&15)<<12|(f&63)<<6|c&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:f=t[i+1],c=t[i+2],u=t[i+3],(f&192)===128&&(c&192)===128&&(u&192)===128&&(l=(o&15)<<18|(f&63)<<12|(c&63)<<6|u&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 zw(n)}var id=4096;function zw(t){let e=t.length;if(e<=id)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=id));return r}function Gw(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 Yw(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 Zw(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+=ng[t[o]];return i}function Xw(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}g.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,g.prototype),i};function me(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")}g.prototype.readUintLE=g.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return i};g.prototype.readUintBE=g.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};g.prototype.readUint8=g.prototype.readUInt8=function(e,r){return e=e>>>0,r||me(e,1,this.length),this[e]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||me(e,2,this.length),this[e]|this[e+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||me(e,2,this.length),this[e]<<8|this[e+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||me(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};g.prototype.readBigUInt64LE=jt(function(e){e=e>>>0,Hr(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))});g.prototype.readBigUInt64BE=jt(function(e){e=e>>>0,Hr(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)});g.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(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};g.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(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};g.prototype.readInt8=function(e,r){return e=e>>>0,r||me(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};g.prototype.readInt16LE=function(e,r){e=e>>>0,r||me(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};g.prototype.readInt16BE=function(e,r){e=e>>>0,r||me(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};g.prototype.readInt32LE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};g.prototype.readInt32BE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};g.prototype.readBigInt64LE=jt(function(e){e=e>>>0,Hr(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)});g.prototype.readBigInt64BE=jt(function(e){e=e>>>0,Hr(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)});g.prototype.readFloatLE=function(e,r){return e=e>>>0,r||me(e,4,this.length),$r.read(this,e,!0,23,4)};g.prototype.readFloatBE=function(e,r){return e=e>>>0,r||me(e,4,this.length),$r.read(this,e,!1,23,4)};g.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||me(e,8,this.length),$r.read(this,e,!0,52,8)};g.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||me(e,8,this.length),$r.read(this,e,!1,52,8)};function Le(t,e,r,n,i,o){if(!g.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")}g.prototype.writeUintLE=g.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};g.prototype.writeUintBE=g.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};g.prototype.writeUint8=g.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};g.prototype.writeUint16LE=g.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};g.prototype.writeUint16BE=g.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};g.prototype.writeUint32LE=g.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};g.prototype.writeUint32BE=g.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 ld(t,e,r,n,i){bd(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 dd(t,e,r,n,i){bd(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}g.prototype.writeBigUInt64LE=jt(function(e,r=0){return ld(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeBigUInt64BE=jt(function(e,r=0){return dd(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let f=Math.pow(2,8*n-1);Le(this,e,r,n,f-1,-f)}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};g.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let f=Math.pow(2,8*n-1);Le(this,e,r,n,f-1,-f)}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};g.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};g.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};g.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};g.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};g.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};g.prototype.writeBigInt64LE=jt(function(e,r=0){return ld(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});g.prototype.writeBigInt64BE=jt(function(e,r=0){return dd(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function hd(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 pd(t,e,r,n,i){return e=+e,r=r>>>0,i||hd(t,e,r,4,34028234663852886e22,-34028234663852886e22),$r.write(t,e,r,n,23,4),r+4}g.prototype.writeFloatLE=function(e,r,n){return pd(this,e,r,!0,n)};g.prototype.writeFloatBE=function(e,r,n){return pd(this,e,r,!1,n)};function yd(t,e,r,n,i){return e=+e,r=r>>>0,i||hd(t,e,r,8,17976931348623157e292,-17976931348623157e292),$r.write(t,e,r,n,52,8),r+8}g.prototype.writeDoubleLE=function(e,r,n){return yd(this,e,r,!0,n)};g.prototype.writeDoubleBE=function(e,r,n){return yd(this,e,r,!1,n)};g.prototype.copy=function(e,r,n,i){if(!g.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};g.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"&&!g.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=g.isBuffer(e)?e:g.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 qr={};function ec(t,e,r){qr[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}`}}}ec("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ec("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ec("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=od(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=od(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function od(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 Qw(t,e,r){Hr(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&qn(e,t.length-(r+1))}function bd(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 qr.ERR_OUT_OF_RANGE("value",a,t)}Qw(n,i,o)}function Hr(t,e){if(typeof t!="number")throw new qr.ERR_INVALID_ARG_TYPE(e,"number",t)}function qn(t,e,r){throw Math.floor(t)!==t?(Hr(t,r),new qr.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new qr.ERR_BUFFER_OUT_OF_BOUNDS:new qr.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var Jw=/[^+/0-9A-Za-z-_]/g;function eg(t){if(t=t.split("=")[0],t=t.trim().replace(Jw,""),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 tg(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function rg(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 md(t){return Ga.toByteArray(eg(t))}function io(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 tc(t){return t!==t}var ng=(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 jt(t){return typeof BigInt>"u"?ig:t}function ig(){throw new Error("BigInt not supported")}});var Z=V((XT,wd)=>{"use strict";var rc=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}};wd.exports={AggregateError:rc,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 nc=V((QT,gd)=>{"use strict";gd.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 Te=V((JT,Sd)=>{"use strict";var{format:og,inspect:oo}=nc(),{AggregateError:sg}=Z(),ag=globalThis.AggregateError||sg,cg=Symbol("kIsNodeError"),fg=["string","function","number","object","Function","Object","boolean","bigint","symbol"],ug=/^([A-Z][a-z0-9]*)+$/,lg="__node_internal_",so={};function cr(t,e){if(!t)throw new so.ERR_INTERNAL_ASSERTION(e)}function xd(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 dg(t,e,r){if(typeof e=="function")return cr(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 cr(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:og(e,...r)}function Se(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(dg(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[cg]=!0,so[t]=n}function Ed(t){let e=lg+t.name;return Object.defineProperty(t,"name",{value:e}),t}function hg(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new ag([e,t],e.message);return r.code=e.code,r}return t||e}var ic=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new so.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Se("ERR_ASSERTION","%s",Error);Se("ERR_INVALID_ARG_TYPE",(t,e,r)=>{cr(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 f of e)cr(typeof f=="string","All expected entries have to be of type string"),fg.includes(f)?i.push(f.toLowerCase()):ug.test(f)?o.push(f):(cr(f!=="object",'The value "object" should be written as "Object"'),s.push(f));if(o.length>0){let f=i.indexOf("object");f!==-1&&(i.splice(i,f,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 f=i.pop();n+=`one of type ${i.join(", ")}, or ${f}`}}(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 f=o.pop();n+=`an instance of ${o.join(", ")}, or ${f}`}}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 f=s.pop();n+=`one of ${s.join(", ")}, or ${f}`}}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 f=oo(r,{depth:-1});n+=`. Received ${f}`}}else{let f=oo(r,{colors:!1});f.length>25&&(f=`${f.slice(0,25)}...`),n+=`. Received type ${typeof r} (${f})`}return n},TypeError);Se("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=oo(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Se("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);Se("ERR_MISSING_ARGS",(...t)=>{cr(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);Se("ERR_OUT_OF_RANGE",(t,e,r)=>{cr(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=xd(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=xd(n)),n+="n"}else n=oo(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Se("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Se("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Se("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Se("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Se("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Se("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Se("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Se("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Se("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Se("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Se("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);Sd.exports={AbortError:ic,aggregateTwoErrors:Ed(hg),hideStackFrames:Ed,codes:so}});var jr=V((eI,ao)=>{"use strict";var{AbortController:_d,AbortSignal:pg}=typeof self<"u"?self:typeof window<"u"?window:void 0;ao.exports=_d;ao.exports.AbortSignal=pg;ao.exports.default=_d});var $n=V((tI,oc)=>{"use strict";var Vr=typeof Reflect=="object"?Reflect:null,Ad=Vr&&typeof Vr.apply=="function"?Vr.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},co;Vr&&typeof Vr.ownKeys=="function"?co=Vr.ownKeys:Object.getOwnPropertySymbols?co=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:co=function(e){return Object.getOwnPropertyNames(e)};function yg(t){console&&console.warn&&console.warn(t)}var Id=Number.isNaN||function(e){return e!==e};function z(){z.init.call(this)}oc.exports=z;oc.exports.once=gg;z.EventEmitter=z;z.prototype._events=void 0;z.prototype._eventsCount=0;z.prototype._maxListeners=void 0;var Td=10;function fo(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 Td},set:function(t){if(typeof t!="number"||t<0||Id(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");Td=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||Id(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 Rd(t){return t._maxListeners===void 0?z.defaultMaxListeners:t._maxListeners}z.prototype.getMaxListeners=function(){return Rd(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 f=o[e];if(f===void 0)return!1;if(typeof f=="function")Ad(f,this,r);else for(var c=f.length,u=Ld(f,c),n=0;n<c;++n)Ad(u[n],this,r);return!0};function vd(t,e,r,n){var i,o,s;if(fo(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=Rd(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,yg(a)}return t}z.prototype.addListener=function(e,r){return vd(this,e,r,!1)};z.prototype.on=z.prototype.addListener;z.prototype.prependListener=function(e,r){return vd(this,e,r,!0)};function bg(){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 Bd(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=bg.bind(n);return i.listener=r,n.wrapFn=i,i}z.prototype.once=function(e,r){return fo(r),this.on(e,Bd(this,e,r)),this};z.prototype.prependOnceListener=function(e,r){return fo(r),this.prependListener(e,Bd(this,e,r)),this};z.prototype.removeListener=function(e,r){var n,i,o,s,a;if(fo(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():mg(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 Cd(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?wg(i):Ld(i,i.length)}z.prototype.listeners=function(e){return Cd(this,e,!0)};z.prototype.rawListeners=function(e){return Cd(this,e,!1)};z.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):Dd.call(t,e)};z.prototype.listenerCount=Dd;function Dd(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?co(this._events):[]};function Ld(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function mg(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function wg(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function gg(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"&&xg(t,i,{once:!0})})}function xg(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 Ce=V((rI,ac)=>{"use strict";var Eg=_t(),{format:Sg,inspect:_g}=nc(),{codes:{ERR_INVALID_ARG_TYPE:sc}}=Te(),{kResistStopPropagation:Ag,AggregateError:Tg,SymbolDispose:Ig}=Z(),Rg=globalThis.AbortSignal||jr().AbortSignal,vg=globalThis.AbortController||jr().AbortController,Bg=Object.getPrototypeOf(async function(){}).constructor,Nd=globalThis.Blob||Eg.Blob,Cg=typeof Nd<"u"?function(e){return e instanceof Nd}:function(e){return!1},Pd=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new sc(e,"AbortSignal",t)},Dg=(t,e)=>{if(typeof t!="function")throw new sc(e,"Function",t)};ac.exports={AggregateError:Tg,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:Sg,inspect:_g,types:{isAsyncFunction(t){return t instanceof Bg},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:Cg,deprecate(t,e){return t},addAbortListener:$n().addAbortListener||function(e,r){if(e===void 0)throw new sc("signal","AbortSignal",e);Pd(e,"signal"),Dg(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[Ag]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[Ig](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:Rg.any||function(e){if(e.length===1)return e[0];let r=new vg,n=()=>r.abort();return e.forEach(i=>{Pd(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};ac.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var zr=V((nI,Vd)=>{"use strict";var{ArrayIsArray:fc,ArrayPrototypeIncludes:Md,ArrayPrototypeJoin:qd,ArrayPrototypeMap:Lg,NumberIsInteger:uc,NumberIsNaN:Og,NumberMAX_SAFE_INTEGER:Ng,NumberMIN_SAFE_INTEGER:Pg,NumberParseInt:Ug,ObjectPrototypeHasOwnProperty:Fg,RegExpPrototypeExec:$d,String:kg,StringPrototypeToUpperCase:Mg,StringPrototypeTrim:qg}=Z(),{hideStackFrames:Me,codes:{ERR_SOCKET_BAD_PORT:$g,ERR_INVALID_ARG_TYPE:Ie,ERR_INVALID_ARG_VALUE:Wr,ERR_OUT_OF_RANGE:fr,ERR_UNKNOWN_SIGNAL:Ud}}=Te(),{normalizeEncoding:Hg}=Ce(),{isAsyncFunction:Kg,isArrayBufferView:jg}=Ce().types,Fd={};function Vg(t){return t===(t|0)}function Wg(t){return t===t>>>0}var zg=/^[0-7]+$/,Gg="must be a 32-bit unsigned integer or an octal string";function Yg(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if($d(zg,t)===null)throw new Wr(e,t,Gg);t=Ug(t,8)}return Hd(t,e),t}var Zg=Me((t,e,r=Pg,n=Ng)=>{if(typeof t!="number")throw new Ie(e,"number",t);if(!uc(t))throw new fr(e,"an integer",t);if(t<r||t>n)throw new fr(e,`>= ${r} && <= ${n}`,t)}),Xg=Me((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Ie(e,"number",t);if(!uc(t))throw new fr(e,"an integer",t);if(t<r||t>n)throw new fr(e,`>= ${r} && <= ${n}`,t)}),Hd=Me((t,e,r=!1)=>{if(typeof t!="number")throw new Ie(e,"number",t);if(!uc(t))throw new fr(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new fr(e,`>= ${n} && <= ${i}`,t)});function lc(t,e){if(typeof t!="string")throw new Ie(e,"string",t)}function Qg(t,e,r=void 0,n){if(typeof t!="number")throw new Ie(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&Og(t))throw new fr(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var Jg=Me((t,e,r)=>{if(!Md(r,t)){let i="must be one of: "+qd(Lg(r,o=>typeof o=="string"?`'${o}'`:kg(o)),", ");throw new Wr(e,t,i)}});function Kd(t,e){if(typeof t!="boolean")throw new Ie(e,"boolean",t)}function cc(t,e,r){return t==null||!Fg(t,e)?r:t[e]}var ex=Me((t,e,r=null)=>{let n=cc(r,"allowArray",!1),i=cc(r,"allowFunction",!1);if(!cc(r,"nullable",!1)&&t===null||!n&&fc(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new Ie(e,"Object",t)}),tx=Me((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Ie(e,"a dictionary",t)}),uo=Me((t,e,r=0)=>{if(!fc(t))throw new Ie(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new Wr(e,t,n)}});function rx(t,e){uo(t,e);for(let r=0;r<t.length;r++)lc(t[r],`${e}[${r}]`)}function nx(t,e){uo(t,e);for(let r=0;r<t.length;r++)Kd(t[r],`${e}[${r}]`)}function ix(t,e){uo(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new Ie(i,"AbortSignal",n);jd(n,i)}}function ox(t,e="signal"){if(lc(t,e),Fd[t]===void 0)throw Fd[Mg(t)]!==void 0?new Ud(t+" (signals must use all capital letters)"):new Ud(t)}var sx=Me((t,e="buffer")=>{if(!jg(t))throw new Ie(e,["Buffer","TypedArray","DataView"],t)});function ax(t,e){let r=Hg(e),n=t.length;if(r==="hex"&&n%2!==0)throw new Wr("encoding",e,`is invalid for data of length ${n}`)}function cx(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&qg(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new $g(e,t,r);return t|0}var jd=Me((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Ie(e,"AbortSignal",t)}),fx=Me((t,e)=>{if(typeof t!="function")throw new Ie(e,"Function",t)}),ux=Me((t,e)=>{if(typeof t!="function"||Kg(t))throw new Ie(e,"Function",t)}),lx=Me((t,e)=>{if(t!==void 0)throw new Ie(e,"undefined",t)});function dx(t,e,r){if(!Md(r,t))throw new Ie(e,`('${qd(r,"|")}')`,t)}var hx=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function kd(t,e){if(typeof t>"u"||!$d(hx,t))throw new Wr(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function px(t){if(typeof t=="string")return kd(t,"hints"),t;if(fc(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];kd(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new Wr("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Vd.exports={isInt32:Vg,isUint32:Wg,parseFileMode:Yg,validateArray:uo,validateStringArray:rx,validateBooleanArray:nx,validateAbortSignalArray:ix,validateBoolean:Kd,validateBuffer:sx,validateDictionary:tx,validateEncoding:ax,validateFunction:fx,validateInt32:Xg,validateInteger:Zg,validateNumber:Qg,validateObject:ex,validateOneOf:Jg,validatePlainFunction:ux,validatePort:cx,validateSignalName:ox,validateString:lc,validateUint32:Hd,validateUndefined:lx,validateUnion:dx,validateAbortSignal:jd,validateLinkHeaderValue:px}});var Vt=V((iI,Yd)=>{var ie=Yd.exports={},it,ot;function dc(){throw new Error("setTimeout has not been defined")}function hc(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?it=setTimeout:it=dc}catch{it=dc}try{typeof clearTimeout=="function"?ot=clearTimeout:ot=hc}catch{ot=hc}})();function Wd(t){if(it===setTimeout)return setTimeout(t,0);if((it===dc||!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 yx(t){if(ot===clearTimeout)return clearTimeout(t);if((ot===hc||!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 At=[],Gr=!1,ur,lo=-1;function bx(){!Gr||!ur||(Gr=!1,ur.length?At=ur.concat(At):lo=-1,At.length&&zd())}function zd(){if(!Gr){var t=Wd(bx);Gr=!0;for(var e=At.length;e;){for(ur=At,At=[];++lo<e;)ur&&ur[lo].run();lo=-1,e=At.length}ur=null,Gr=!1,yx(t)}}ie.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];At.push(new Gd(t,e)),At.length===1&&!Gr&&Wd(zd)};function Gd(t,e){this.fun=t,this.array=e}Gd.prototype.run=function(){this.fun.apply(null,this.array)};ie.title="browser";ie.browser=!0;ie.env={};ie.argv=[];ie.version="";ie.versions={};function Tt(){}ie.on=Tt;ie.addListener=Tt;ie.once=Tt;ie.off=Tt;ie.removeListener=Tt;ie.removeAllListeners=Tt;ie.emit=Tt;ie.prependListener=Tt;ie.prependOnceListener=Tt;ie.listeners=function(t){return[]};ie.binding=function(t){throw new Error("process.binding is not supported")};ie.cwd=function(){return"/"};ie.chdir=function(t){throw new Error("process.chdir is not supported")};ie.umask=function(){return 0}});var at=V((oI,uh)=>{"use strict";var{SymbolAsyncIterator:Zd,SymbolIterator:Xd,SymbolFor:lr}=Z(),Qd=lr("nodejs.stream.destroyed"),Jd=lr("nodejs.stream.errored"),pc=lr("nodejs.stream.readable"),yc=lr("nodejs.stream.writable"),eh=lr("nodejs.stream.disturbed"),mx=lr("nodejs.webstream.isClosedPromise"),wx=lr("nodejs.webstream.controllerErrorFunction");function ho(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 po(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 gx(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 th(t){return!!(t&&!st(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function rh(t){return!!(t&&!st(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function nh(t){return!!(t&&!st(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function xx(t){return th(t)||rh(t)||nh(t)}function Ex(t,e){return t==null?!1:e===!0?typeof t[Zd]=="function":e===!1?typeof t[Xd]=="function":typeof t[Zd]=="function"||typeof t[Xd]=="function"}function yo(t){if(!st(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Qd]||n!=null&&n.destroyed)}function ih(t){if(!po(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 Sx(t,e){if(!po(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 _x(t){if(!ho(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 oh(t,e){if(!ho(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 sh(t){return t&&t[pc]!=null?t[pc]:typeof t?.readable!="boolean"?null:yo(t)?!1:ho(t)&&t.readable&&!oh(t)}function ah(t){return t&&t[yc]!=null?t[yc]:typeof t?.writable!="boolean"?null:yo(t)?!1:po(t)&&t.writable&&!ih(t)}function Ax(t,e){return st(t)?yo(t)?!0:!(e?.readable!==!1&&sh(t)||e?.writable!==!1&&ah(t)):null}function Tx(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 Ix(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 Rx(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"&&ch(t)?t._closed:null}function ch(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function fh(t){return typeof t._sent100=="boolean"&&ch(t)}function vx(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 Bx(t){if(!st(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&fh(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function Cx(t){var e;return!!(t&&((e=t[eh])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function Dx(t){var e,r,n,i,o,s,a,f,c,u;return!!(t&&((e=(r=(n=(i=(o=(s=t[Jd])!==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:(f=t._writableState)===null||f===void 0?void 0:f.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((u=t._writableState)===null||u===void 0)&&u.errored))}uh.exports={isDestroyed:yo,kIsDestroyed:Qd,isDisturbed:Cx,kIsDisturbed:eh,isErrored:Dx,kIsErrored:Jd,isReadable:sh,kIsReadable:pc,kIsClosedPromise:mx,kControllerErrorFunction:wx,kIsWritable:yc,isClosed:Rx,isDuplexNodeStream:gx,isFinished:Ax,isIterable:Ex,isReadableNodeStream:ho,isReadableStream:th,isReadableEnded:_x,isReadableFinished:oh,isReadableErrored:Ix,isNodeStream:st,isWebStream:xx,isWritable:ah,isWritableNodeStream:po,isWritableStream:rh,isWritableEnded:ih,isWritableFinished:Sx,isWritableErrored:Tx,isServerRequest:vx,isServerResponse:fh,willEmitClose:Bx,isTransformStream:nh}});var It=V((sI,xc)=>{"use strict";var Wt=Vt(),{AbortError:gh,codes:Lx}=Te(),{ERR_INVALID_ARG_TYPE:Ox,ERR_STREAM_PREMATURE_CLOSE:lh}=Lx,{kEmptyObject:mc,once:wc}=Ce(),{validateAbortSignal:Nx,validateFunction:Px,validateObject:Ux,validateBoolean:Fx}=zr(),{Promise:kx,PromisePrototypeThen:Mx,SymbolDispose:xh}=Z(),{isClosed:qx,isReadable:dh,isReadableNodeStream:bc,isReadableStream:$x,isReadableFinished:hh,isReadableErrored:ph,isWritable:yh,isWritableNodeStream:bh,isWritableStream:Hx,isWritableFinished:mh,isWritableErrored:wh,isNodeStream:Kx,willEmitClose:jx,kIsClosedPromise:Vx}=at(),Yr;function Wx(t){return t.setHeader&&typeof t.abort=="function"}var gc=()=>{};function Eh(t,e,r){var n,i;if(arguments.length===2?(r=e,e=mc):e==null?e=mc:Ux(e,"options"),Px(r,"callback"),Nx(e.signal,"options.signal"),r=wc(r),$x(t)||Hx(t))return zx(t,e,r);if(!Kx(t))throw new Ox("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:bc(t),s=(i=e.writable)!==null&&i!==void 0?i:bh(t),a=t._writableState,f=t._readableState,c=()=>{t.writable||h()},u=jx(t)&&bc(t)===o&&bh(t)===s,l=mh(t,!1),h=()=>{l=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||o))&&(!o||d)&&r.call(t)},d=hh(t,!1),w=()=>{d=!0,t.destroyed&&(u=!1),!(u&&(!t.writable||s))&&(!s||l)&&r.call(t)},p=R=>{r.call(t,R)},y=qx(t),b=()=>{y=!0;let R=wh(t)||ph(t);if(R&&typeof R!="boolean")return r.call(t,R);if(o&&!d&&bc(t,!0)&&!hh(t,!1))return r.call(t,new lh);if(s&&!l&&!mh(t,!1))return r.call(t,new lh);r.call(t)},E=()=>{y=!0;let R=wh(t)||ph(t);if(R&&typeof R!="boolean")return r.call(t,R);r.call(t)},A=()=>{t.req.on("finish",h)};Wx(t)?(t.on("complete",h),u||t.on("abort",b),t.req?A():t.on("request",A)):s&&!a&&(t.on("end",c),t.on("close",c)),!u&&typeof t.aborted=="boolean"&&t.on("aborted",b),t.on("end",w),t.on("finish",h),e.error!==!1&&t.on("error",p),t.on("close",b),y?Wt.nextTick(b):a!=null&&a.errorEmitted||f!=null&&f.errorEmitted?u||Wt.nextTick(E):(!o&&(!u||dh(t))&&(l||yh(t)===!1)||!s&&(!u||yh(t))&&(d||dh(t)===!1)||f&&t.req&&t.aborted)&&Wt.nextTick(E);let T=()=>{r=gc,t.removeListener("aborted",b),t.removeListener("complete",h),t.removeListener("abort",b),t.removeListener("request",A),t.req&&t.req.removeListener("finish",h),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",h),t.removeListener("end",w),t.removeListener("error",p),t.removeListener("close",b)};if(e.signal&&!y){let R=()=>{let F=r;T(),F.call(t,new gh(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Wt.nextTick(R);else{Yr=Yr||Ce().addAbortListener;let F=Yr(e.signal,R),D=r;r=wc((...B)=>{F[xh](),D.apply(t,B)})}}return T}function zx(t,e,r){let n=!1,i=gc;if(e.signal)if(i=()=>{n=!0,r.call(t,new gh(void 0,{cause:e.signal.reason}))},e.signal.aborted)Wt.nextTick(i);else{Yr=Yr||Ce().addAbortListener;let s=Yr(e.signal,i),a=r;r=wc((...f)=>{s[xh](),a.apply(t,f)})}let o=(...s)=>{n||Wt.nextTick(()=>r.apply(t,s))};return Mx(t[Vx].promise,o,o),gc}function Gx(t,e){var r;let n=!1;return e===null&&(e=mc),(r=e)!==null&&r!==void 0&&r.cleanup&&(Fx(e.cleanup,"cleanup"),n=e.cleanup),new kx((i,o)=>{let s=Eh(t,e,a=>{n&&s(),a?o(a):i()})})}xc.exports=Eh;xc.exports.finished=Gx});var dr=V((aI,Bh)=>{"use strict";var ct=Vt(),{aggregateTwoErrors:Yx,codes:{ERR_MULTIPLE_CALLBACK:Zx},AbortError:Xx}=Te(),{Symbol:Ah}=Z(),{kIsDestroyed:Qx,isDestroyed:Jx,isFinished:eE,isServerRequest:tE}=at(),Th=Ah("kDestroy"),Ec=Ah("kConstruct");function Ih(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function rE(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):(Ih(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?Sh(this,t,e):this.once(Th,function(o){Sh(this,Yx(o,t),e)}),this)}function Sh(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;Ih(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?ct.nextTick(nE,t,o):ct.nextTick(Rh,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function nE(t,e){Sc(t,e),Rh(t)}function Rh(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 Sc(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 iE(){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 _c(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?ct.nextTick(Sc,t,e):Sc(t,e))}function oE(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(Ec,e),!(t.listenerCount(Ec)>1)&&ct.nextTick(sE,t)}function sE(t){let e=!1;function r(n){if(e){_c(t,n??new Zx);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(Th,n):n?_c(t,n,!0):ct.nextTick(aE,t)}try{t._construct(n=>{ct.nextTick(r,n)})}catch(n){ct.nextTick(r,n)}}function aE(t){t.emit(Ec)}function _h(t){return t?.setHeader&&typeof t.abort=="function"}function vh(t){t.emit("close")}function cE(t,e){t.emit("error",e),ct.nextTick(vh,t)}function fE(t,e){!t||Jx(t)||(!e&&!eE(t)&&(e=new Xx),tE(t)?(t.socket=null,t.destroy(e)):_h(t)?t.abort():_h(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ct.nextTick(cE,t,e):ct.nextTick(vh,t),t.destroyed||(t[Qx]=!0))}Bh.exports={construct:oE,destroyer:fE,destroy:rE,undestroy:iE,errorOrDestroy:_c}});var wo=V((cI,Dh)=>{"use strict";var{ArrayIsArray:uE,ObjectSetPrototypeOf:Ch}=Z(),{EventEmitter:bo}=$n();function mo(t){bo.call(this,t)}Ch(mo.prototype,bo.prototype);Ch(mo,bo);mo.prototype.pipe=function(t,e){let r=this;function n(u){t.writable&&t.write(u)===!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 f(u){c(),bo.listenerCount(this,"error")===0&&this.emit("error",u)}Ac(r,"error",f),Ac(t,"error",f);function c(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",f),t.removeListener("error",f),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 Ac(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):uE(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}Dh.exports={Stream:mo,prependListener:Ac}});var Hn=V((fI,go)=>{"use strict";var{SymbolDispose:lE}=Z(),{AbortError:Lh,codes:dE}=Te(),{isNodeStream:Oh,isWebStream:hE,kControllerErrorFunction:pE}=at(),yE=It(),{ERR_INVALID_ARG_TYPE:Nh}=dE,Tc,bE=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new Nh(e,"AbortSignal",t)};go.exports.addAbortSignal=function(e,r){if(bE(e,"signal"),!Oh(r)&&!hE(r))throw new Nh("stream",["ReadableStream","WritableStream","Stream"],r);return go.exports.addAbortSignalNoValidate(e,r)};go.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=Oh(e)?()=>{e.destroy(new Lh(void 0,{cause:t.reason}))}:()=>{e[pE](new Lh(void 0,{cause:t.reason}))};if(t.aborted)r();else{Tc=Tc||Ce().addAbortListener;let n=Tc(t,r);yE(e,n[lE])}return e}});var Fh=V((lI,Uh)=>{"use strict";var{StringPrototypeSlice:Ph,SymbolIterator:mE,TypedArrayPrototypeSet:xo,Uint8Array:wE}=Z(),{Buffer:Ic}=_t(),{inspect:gE}=Ce();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 Ic.alloc(0);let r=Ic.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)xo(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}*[mE](){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+=Ph(o,0,e),this.head=n,n.data=Ph(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Ic.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)xo(r,s,n-e),e-=s.length;else{e===s.length?(xo(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(xo(r,new wE(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 gE(this,{...r,depth:0,customInspect:!1})}}});var Kn=V((dI,$h)=>{"use strict";var{MathFloor:xE,NumberIsInteger:EE}=Z(),{validateInteger:SE}=zr(),{ERR_INVALID_ARG_VALUE:_E}=Te().codes,kh=16*1024,Mh=16;function AE(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function qh(t){return t?Mh:kh}function TE(t,e){SE(e,"value",0),t?Mh=e:kh=e}function IE(t,e,r,n){let i=AE(e,n,r);if(i!=null){if(!EE(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new _E(o,i)}return xE(i)}return qh(t.objectMode)}$h.exports={getHighWaterMark:IE,getDefaultHighWaterMark:qh,setDefaultHighWaterMark:TE}});var jh=V((Rc,Kh)=>{var Eo=_t(),ft=Eo.Buffer;function Hh(t,e){for(var r in t)e[r]=t[r]}ft.from&&ft.alloc&&ft.allocUnsafe&&ft.allocUnsafeSlow?Kh.exports=Eo:(Hh(Eo,Rc),Rc.Buffer=hr);function hr(t,e,r){return ft(t,e,r)}hr.prototype=Object.create(ft.prototype);Hh(ft,hr);hr.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ft(t,e,r)};hr.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ft(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};hr.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ft(t)};hr.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Eo.SlowBuffer(t)}});var zh=V(Wh=>{"use strict";var Bc=jh().Buffer,Vh=Bc.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 vE(t){var e=RE(t);if(typeof e!="string"&&(Bc.isEncoding===Vh||!Vh(t)))throw new Error("Unknown encoding: "+t);return e||t}Wh.StringDecoder=jn;function jn(t){this.encoding=vE(t);var e;switch(this.encoding){case"utf16le":this.text=NE,this.end=PE,e=4;break;case"utf8":this.fillLast=DE,e=4;break;case"base64":this.text=UE,this.end=FE,e=3;break;default:this.write=kE,this.end=ME;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Bc.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=OE;jn.prototype.text=LE;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 vc(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function BE(t,e,r){var n=e.length-1;if(n<r)return 0;var i=vc(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=vc(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=vc(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function CE(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 DE(t){var e=this.lastTotal-this.lastNeed,r=CE(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 LE(t,e){var r=BE(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 OE(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function NE(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 PE(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 UE(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 FE(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 ME(t){return t&&t.length?this.write(t):""}});var Cc=V((pI,Xh)=>{"use strict";var Gh=Vt(),{PromisePrototypeThen:qE,SymbolAsyncIterator:Yh,SymbolIterator:Zh}=Z(),{Buffer:$E}=_t(),{ERR_INVALID_ARG_TYPE:HE,ERR_STREAM_NULL_VALUES:KE}=Te().codes;function jE(t,e,r){let n;if(typeof e=="string"||e instanceof $E)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[Yh])i=!0,n=e[Yh]();else if(e&&e[Zh])i=!1,n=e[Zh]();else throw new HE("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,f())},o._destroy=function(c,u){qE(a(c),()=>Gh.nextTick(u,c),l=>Gh.nextTick(u,l||c))};async function a(c){let u=c!=null,l=typeof n.throw=="function";if(u&&l){let{value:h,done:d}=await n.throw(c);if(await h,d)return}if(typeof n.return=="function"){let{value:h}=await n.return();await h}}async function f(){for(;;){try{let{value:c,done:u}=i?await n.next():n.next();if(u)o.push(null);else{let l=c&&typeof c.then=="function"?await c:c;if(l===null)throw s=!1,new KE;if(o.push(l))continue;s=!1}}catch(c){o.destroy(c)}break}}return o}Xh.exports=jE});var Wn=V((yI,yp)=>{"use strict";var Ze=Vt(),{ArrayPrototypeIndexOf:VE,NumberIsInteger:WE,NumberIsNaN:zE,NumberParseInt:GE,ObjectDefineProperties:kc,ObjectKeys:YE,ObjectSetPrototypeOf:ep,Promise:tp,SafeSet:ZE,SymbolAsyncDispose:XE,SymbolAsyncIterator:QE,Symbol:JE}=Z();yp.exports=M;M.ReadableState=To;var{EventEmitter:e1}=$n(),{Stream:zt,prependListener:t1}=wo(),{Buffer:Dc}=_t(),{addAbortSignal:r1}=Hn(),rp=It(),H=Ce().debuglog("stream",t=>{H=t}),n1=Fh(),Qr=dr(),{getHighWaterMark:i1,getDefaultHighWaterMark:o1}=Kn(),{aggregateTwoErrors:Qh,codes:{ERR_INVALID_ARG_TYPE:s1,ERR_METHOD_NOT_IMPLEMENTED:a1,ERR_OUT_OF_RANGE:c1,ERR_STREAM_PUSH_AFTER_EOF:f1,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:u1},AbortError:l1}=Te(),{validateObject:d1}=zr(),pr=JE("kPaused"),{StringDecoder:np}=zh(),h1=Cc();ep(M.prototype,zt.prototype);ep(M,zt);var Lc=()=>{},{errorOrDestroy:Zr}=Qr,Xr=1,p1=2,ip=4,Vn=8,op=16,So=32,_o=64,sp=128,y1=256,b1=512,m1=1024,Uc=2048,Fc=4096,w1=8192,g1=16384,x1=32768,ap=65536,E1=1<<17,S1=1<<18;function le(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}kc(To.prototype,{objectMode:le(Xr),ended:le(p1),endEmitted:le(ip),reading:le(Vn),constructed:le(op),sync:le(So),needReadable:le(_o),emittedReadable:le(sp),readableListening:le(y1),resumeScheduled:le(b1),errorEmitted:le(m1),emitClose:le(Uc),autoDestroy:le(Fc),destroyed:le(w1),closed:le(g1),closeEmitted:le(x1),multiAwaitDrain:le(ap),readingMore:le(E1),dataEmitted:le(S1)});function To(t,e,r){typeof r!="boolean"&&(r=e instanceof ut()),this.state=Uc|Fc|op|So,t&&t.objectMode&&(this.state|=Xr),r&&t&&t.readableObjectMode&&(this.state|=Xr),this.highWaterMark=t?i1(this,t,"readableHighWaterMark",r):o1(!1),this.buffer=new n1,this.length=0,this.pipes=[],this.flowing=null,this[pr]=null,t&&t.emitClose===!1&&(this.state&=~Uc),t&&t.autoDestroy===!1&&(this.state&=~Fc),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new np(t.encoding),this.encoding=t.encoding)}function M(t){if(!(this instanceof M))return new M(t);let e=this instanceof ut();this._readableState=new To(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&&r1(t.signal,this)),zt.call(this,t),Qr.construct(this,()=>{this._readableState.needReadable&&Ao(this,this._readableState)})}M.prototype.destroy=Qr.destroy;M.prototype._undestroy=Qr.undestroy;M.prototype._destroy=function(t,e){e(t)};M.prototype[e1.captureRejectionSymbol]=function(t){this.destroy(t)};M.prototype[XE]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new l1,this.destroy(t)),new tp((e,r)=>rp(this,n=>n&&n!==t?r(n):e(null)))};M.prototype.push=function(t,e){return cp(this,t,e,!1)};M.prototype.unshift=function(t,e){return cp(this,t,e,!0)};function cp(t,e,r,n){H("readableAddChunk",e);let i=t._readableState,o;if((i.state&Xr)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=Dc.from(e,r).toString(i.encoding):(e=Dc.from(e,r),r=""))):e instanceof Dc?r="":zt._isUint8Array(e)?(e=zt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new s1("chunk",["string","Buffer","Uint8Array"],e))),o)Zr(t,o);else if(e===null)i.state&=~Vn,T1(t,i);else if((i.state&Xr)!==0||e&&e.length>0)if(n)if((i.state&ip)!==0)Zr(t,new u1);else{if(i.destroyed||i.errored)return!1;Oc(t,i,e,!0)}else if(i.ended)Zr(t,new f1);else{if(i.destroyed||i.errored)return!1;i.state&=~Vn,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Oc(t,i,e,!1):Ao(t,i)):Oc(t,i,e,!1)}else n||(i.state&=~Vn,Ao(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Oc(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&ap)!==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&_o)!==0&&Io(t)),Ao(t,e)}M.prototype.isPaused=function(){let t=this._readableState;return t[pr]===!0||t.flowing===!1};M.prototype.setEncoding=function(t){let e=new np(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 _1=1073741824;function A1(t){if(t>_1)throw new c1("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function Jh(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&Xr)!==0?1:zE(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){H("read",t),t===void 0?t=NaN:WE(t)||(t=GE(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=A1(t)),t!==0&&(e.state&=~sp),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Nc(this):Io(this),null;if(t=Jh(t,e),t===0&&e.ended)return e.length===0&&Nc(this),null;let n=(e.state&_o)!==0;if(H("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,H("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,H("reading, ended or constructing",n);else if(n){H("do read"),e.state|=Vn|So,e.length===0&&(e.state|=_o);try{this._read(e.highWaterMark)}catch(o){Zr(this,o)}e.state&=~So,e.reading||(t=Jh(r,e))}let i;return t>0?i=hp(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&&Nc(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function T1(t,e){if(H("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?Io(t):(e.needReadable=!1,e.emittedReadable=!0,fp(t))}}function Io(t){let e=t._readableState;H("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H("emitReadable",e.flowing),e.emittedReadable=!0,Ze.nextTick(fp,t))}function fp(t){let e=t._readableState;H("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,lp(t)}function Ao(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ze.nextTick(I1,t,e))}function I1(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(H("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}M.prototype._read=function(t){throw new a1("_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 ZE(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),H("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Ze.stdout&&t!==Ze.stderr?a:y;n.endEmitted?Ze.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(b,E){H("onunpipe"),b===r&&E&&E.hasUnpiped===!1&&(E.hasUnpiped=!0,u())}function a(){H("onend"),t.end()}let f,c=!1;function u(){H("cleanup"),t.removeListener("close",w),t.removeListener("finish",p),f&&t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",y),r.removeListener("data",h),c=!0,f&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&f()}function l(){c||(n.pipes.length===1&&n.pipes[0]===t?(H("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(H("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),f||(f=R1(r,t),t.on("drain",f))}r.on("data",h);function h(b){H("ondata");let E=t.write(b);H("dest.write",E),E===!1&&l()}function d(b){if(H("onerror",b),y(),t.removeListener("error",d),t.listenerCount("error")===0){let E=t._writableState||t._readableState;E&&!E.errorEmitted?Zr(t,b):t.emit("error",b)}}t1(t,"error",d);function w(){t.removeListener("finish",p),y()}t.once("close",w);function p(){H("onfinish"),t.removeListener("close",w),y()}t.once("finish",p);function y(){H("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?l():n.flowing||(H("pipe resume"),r.resume()),t};function R1(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(H("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(H("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=VE(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=zt.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,H("on readable",n.length,n.reading),n.length?Io(this):n.reading||Ze.nextTick(v1,this)),r};M.prototype.addListener=M.prototype.on;M.prototype.removeListener=function(t,e){let r=zt.prototype.removeListener.call(this,t,e);return t==="readable"&&Ze.nextTick(up,this),r};M.prototype.off=M.prototype.removeListener;M.prototype.removeAllListeners=function(t){let e=zt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ze.nextTick(up,this),e};function up(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[pr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function v1(t){H("readable nexttick read 0"),t.read(0)}M.prototype.resume=function(){let t=this._readableState;return t.flowing||(H("resume"),t.flowing=!t.readableListening,B1(this,t)),t[pr]=!1,this};function B1(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ze.nextTick(C1,t,e))}function C1(t,e){H("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),lp(t),e.flowing&&!e.reading&&t.read(0)}M.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[pr]=!0,this};function lp(t){let e=t._readableState;for(H("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=YE(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[QE]=function(){return dp(this)};M.prototype.iterator=function(t){return t!==void 0&&d1(t,"options"),dp(this,t)};function dp(t,e){typeof t.read!="function"&&(t=M.wrap(t,{objectMode:!0}));let r=D1(t,e);return r.stream=t,r}async function*D1(t,e){let r=Lc;function n(s){this===t?(r(),r=Lc):r=s}t.on("readable",n);let i,o=rp(t,{writable:!1},s=>{i=s?Qh(i,s):null,r(),r=Lc});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 tp(n)}}}catch(s){throw i=Qh(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?Qr.destroyer(t,null):(t.off("readable",n),o())}}kc(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}}});kc(To.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[pr]!==!1},set(t){this[pr]=!!t}}});M._fromList=hp;function hp(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 Nc(t){let e=t._readableState;H("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ze.nextTick(L1,e,t))}function L1(t,e){if(H("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)Ze.nextTick(O1,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function O1(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}M.from=function(t,e){return h1(M,t,e)};var Pc;function pp(){return Pc===void 0&&(Pc={}),Pc}M.fromWeb=function(t,e){return pp().newStreamReadableFromReadableStream(t,e)};M.toWeb=function(t,e){return pp().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){Qr.destroyer(t,i),o(i)}}).wrap(t)}});var Do=V((bI,Rp)=>{"use strict";var yr=Vt(),{ArrayPrototypeSlice:wp,Error:N1,FunctionPrototypeSymbolHasInstance:gp,ObjectDefineProperty:xp,ObjectDefineProperties:P1,ObjectSetPrototypeOf:Ep,StringPrototypeToLowerCase:U1,Symbol:F1,SymbolHasInstance:k1}=Z();Rp.exports=J;J.WritableState=Yn;var{EventEmitter:M1}=$n(),zn=wo().Stream,{Buffer:Ro}=_t(),Co=dr(),{addAbortSignal:q1}=Hn(),{getHighWaterMark:$1,getDefaultHighWaterMark:H1}=Kn(),{ERR_INVALID_ARG_TYPE:K1,ERR_METHOD_NOT_IMPLEMENTED:j1,ERR_MULTIPLE_CALLBACK:Sp,ERR_STREAM_CANNOT_PIPE:V1,ERR_STREAM_DESTROYED:Gn,ERR_STREAM_ALREADY_FINISHED:W1,ERR_STREAM_NULL_VALUES:z1,ERR_STREAM_WRITE_AFTER_END:G1,ERR_UNKNOWN_ENCODING:_p}=Te().codes,{errorOrDestroy:Jr}=Co;Ep(J.prototype,zn.prototype);Ep(J,zn);function $c(){}var en=F1("kOnFinished");function Yn(t,e,r){typeof r!="boolean"&&(r=e instanceof ut()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?$1(this,t,"writableHighWaterMark",r):H1(!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=Z1.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,Bo(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[en]=[]}function Bo(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}Yn.prototype.getBuffer=function(){return wp(this.buffered,this.bufferedIndex)};xp(Yn.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function J(t){let e=this instanceof ut();if(!e&&!gp(J,this))return new J(t);this._writableState=new Yn(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&&q1(t.signal,this)),zn.call(this,t),Co.construct(this,()=>{let r=this._writableState;r.writing||Kc(this,r),jc(this,r)})}xp(J,k1,{__proto__:null,value:function(t){return gp(this,t)?!0:this!==J?!1:t&&t._writableState instanceof Yn}});J.prototype.pipe=function(){Jr(this,new V1)};function Ap(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"&&!Ro.isEncoding(r))throw new _p(r);typeof n!="function"&&(n=$c)}if(e===null)throw new z1;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=Ro.from(e,r),r="buffer");else if(e instanceof Ro)r="buffer";else if(zn._isUint8Array(e))e=zn._uint8ArrayToBuffer(e),r="buffer";else throw new K1("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new G1:i.destroyed&&(o=new Gn("write")),o?(yr.nextTick(n,o),Jr(t,o,!0),o):(i.pendingcb++,Y1(t,i,e,r,n))}J.prototype.write=function(t,e,r){return Ap(this,t,e,r)===!0};J.prototype.cork=function(){this._writableState.corked++};J.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Kc(this,t))};J.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=U1(e)),!Ro.isEncoding(e))throw new _p(e);return this._writableState.defaultEncoding=e,this};function Y1(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!==$c&&(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 bp(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new Gn("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function mp(t,e,r,n){--e.pendingcb,n(r),Hc(e),Jr(t,r)}function Z1(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){Jr(t,new Sp);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?yr.nextTick(mp,t,r,e,i):mp(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Kc(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},yr.nextTick(X1,r.afterWriteTickInfo)):Tp(t,r,1,i))}function X1({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,Tp(t,e,r,n)}function Tp(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&&Hc(e),jc(t,e)}function Hc(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 Gn("write"))}let r=t[en].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new Gn("end"))}Bo(t)}function Kc(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?$c:c=>{for(let u=s;u<r.length;++u)r[u].callback(c)},f=e.allNoop&&s===0?r:wp(r,s);f.allBuffers=e.allBuffers,bp(t,e,!0,e.length,f,"",a),Bo(e)}else{do{let{chunk:a,encoding:f,callback:c}=r[s];r[s++]=null;let u=i?1:a.length;bp(t,e,!1,u,a,f,c)}while(s<r.length&&!e.writing);s===r.length?Bo(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}J.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new j1("_write()")};J.prototype._writev=null;J.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=Ap(this,t,e);o instanceof N1&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,jc(this,n,!0),n.ended=!0):n.finished?i=new W1("end"):n.destroyed&&(i=new Gn("end"))),typeof r=="function"&&(i||n.finished?yr.nextTick(r,i):n[en].push(r)),this};function vo(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 Q1(t,e){let r=!1;function n(i){if(r){Jr(t,i??Sp());return}if(r=!0,e.pendingcb--,i){let o=e[en].splice(0);for(let s=0;s<o.length;s++)o[s](i);Jr(t,i,e.sync)}else vo(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,yr.nextTick(qc,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function J1(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,Q1(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function jc(t,e,r){vo(e)&&(J1(t,e),e.pendingcb===0&&(r?(e.pendingcb++,yr.nextTick((n,i)=>{vo(i)?qc(n,i):i.pendingcb--},t,e)):vo(e)&&(e.pendingcb++,qc(t,e))))}function qc(t,e){e.pendingcb--,e.finished=!0;let r=e[en].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()}}P1(J.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 e2=Co.destroy;J.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[en].length)&&yr.nextTick(Hc,r),e2.call(this,t,e),this};J.prototype._undestroy=Co.undestroy;J.prototype._destroy=function(t,e){e(t)};J.prototype[M1.captureRejectionSymbol]=function(t){this.destroy(t)};var Mc;function Ip(){return Mc===void 0&&(Mc={}),Mc}J.fromWeb=function(t,e){return Ip().newStreamWritableFromWritableStream(t,e)};J.toWeb=function(t){return Ip().newWritableStreamFromStreamWritable(t)}});var Hp=V((mI,$p)=>{var Vc=Vt(),t2=_t(),{isReadable:r2,isWritable:n2,isIterable:vp,isNodeStream:i2,isReadableNodeStream:Bp,isWritableNodeStream:Cp,isDuplexNodeStream:o2,isReadableStream:Dp,isWritableStream:Lp}=at(),Op=It(),{AbortError:Mp,codes:{ERR_INVALID_ARG_TYPE:s2,ERR_INVALID_RETURN_VALUE:Np}}=Te(),{destroyer:rn}=dr(),a2=ut(),qp=Wn(),c2=Do(),{createDeferredPromise:Pp}=Ce(),Up=Cc(),Fp=globalThis.Blob||t2.Blob,f2=typeof Fp<"u"?function(e){return e instanceof Fp}:function(e){return!1},u2=globalThis.AbortController||jr().AbortController,{FunctionPrototypeCall:kp}=Z(),Gt=class extends a2{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)}};$p.exports=function t(e,r){if(o2(e))return e;if(Bp(e))return tn({readable:e});if(Cp(e))return tn({writable:e});if(i2(e))return tn({writable:!1,readable:!1});if(Dp(e))return tn({readable:qp.fromWeb(e)});if(Lp(e))return tn({writable:c2.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=l2(e);if(vp(i))return Up(Gt,i,{objectMode:!0,write:o,final:s,destroy:a});let f=i?.then;if(typeof f=="function"){let c,u=kp(f,i,l=>{if(l!=null)throw new Np("nully","body",l)},l=>{rn(c,l)});return c=new Gt({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await u,Vc.nextTick(l,null)}catch(h){Vc.nextTick(l,h)}})},destroy:a})}throw new Np("Iterable, AsyncIterable or AsyncFunction",r,i)}if(f2(e))return t(e.arrayBuffer());if(vp(e))return Up(Gt,e,{objectMode:!0,writable:!1});if(Dp(e?.readable)&&Lp(e?.writable))return Gt.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?Bp(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?Cp(e?.writable)?e?.writable:t(e.writable):void 0;return tn({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return kp(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{rn(i,o)}),i=new Gt({objectMode:!0,writable:!1,read(){}})}throw new s2(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function l2(t){let{promise:e,resolve:r}=Pp(),n=new u2,i=n.signal;return{value:t((async function*(){for(;;){let s=e;e=null;let{chunk:a,done:f,cb:c}=await s;if(Vc.nextTick(c),f)return;if(i.aborted)throw new Mp(void 0,{cause:i.reason});({promise:e,resolve:r}=Pp()),yield a}})(),{signal:i}),write(s,a,f){let c=r;r=null,c({chunk:s,done:!1,cb:f})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function tn(t){let e=t.readable&&typeof t.readable.read!="function"?qp.wrap(t.readable):t.readable,r=t.writable,n=!!r2(e),i=!!n2(r),o,s,a,f,c;function u(l){let h=f;f=null,h?h(l):l&&c.destroy(l)}return c=new Gt({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(Op(r,l=>{i=!1,l&&rn(e,l),u(l)}),c._write=function(l,h,d){r.write(l,h)?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&&rn(e,l),u(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,h){!l&&f!==null&&(l=new Mp),a=null,o=null,s=null,f===null?h(l):(f=h,rn(r,l),rn(e,l))},c}});var ut=V((wI,Vp)=>{"use strict";var{ObjectDefineProperties:d2,ObjectGetOwnPropertyDescriptor:Rt,ObjectKeys:h2,ObjectSetPrototypeOf:Kp}=Z();Vp.exports=Xe;var Gc=Wn(),qe=Do();Kp(Xe.prototype,Gc.prototype);Kp(Xe,Gc);{let t=h2(qe.prototype);for(let e=0;e<t.length;e++){let r=t[e];Xe.prototype[r]||(Xe.prototype[r]=qe.prototype[r])}}function Xe(t){if(!(this instanceof Xe))return new Xe(t);Gc.call(this,t),qe.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}d2(Xe.prototype,{writable:{__proto__:null,...Rt(qe.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Rt(qe.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Rt(qe.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Rt(qe.prototype,"writableBuffer")},writableLength:{__proto__:null,...Rt(qe.prototype,"writableLength")},writableFinished:{__proto__:null,...Rt(qe.prototype,"writableFinished")},writableCorked:{__proto__:null,...Rt(qe.prototype,"writableCorked")},writableEnded:{__proto__:null,...Rt(qe.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Rt(qe.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 Wc;function jp(){return Wc===void 0&&(Wc={}),Wc}Xe.fromWeb=function(t,e){return jp().newStreamDuplexFromReadableWritablePair(t,e)};Xe.toWeb=function(t){return jp().newReadableWritablePairFromDuplex(t)};var zc;Xe.from=function(t){return zc||(zc=Hp()),zc(t,"body")}});var Xc=V((gI,zp)=>{"use strict";var{ObjectSetPrototypeOf:Wp,Symbol:p2}=Z();zp.exports=vt;var{ERR_METHOD_NOT_IMPLEMENTED:y2}=Te().codes,Zc=ut(),{getHighWaterMark:b2}=Kn();Wp(vt.prototype,Zc.prototype);Wp(vt,Zc);var Zn=p2("kCallback");function vt(t){if(!(this instanceof vt))return new vt(t);let e=t?b2(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),Zc.call(this,t),this._readableState.sync=!1,this[Zn]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",m2)}function Yc(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 m2(){this._final!==Yc&&Yc.call(this)}vt.prototype._final=Yc;vt.prototype._transform=function(t,e,r){throw new y2("_transform()")};vt.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[Zn]=r})};vt.prototype._read=function(){if(this[Zn]){let t=this[Zn];this[Zn]=null,t()}}});var Jc=V((xI,Yp)=>{"use strict";var{ObjectSetPrototypeOf:Gp}=Z();Yp.exports=nn;var Qc=Xc();Gp(nn.prototype,Qc.prototype);Gp(nn,Qc);function nn(t){if(!(this instanceof nn))return new nn(t);Qc.call(this,t)}nn.prototype._transform=function(t,e,r){r(null,t)}});var Po=V((EI,e0)=>{var Xn=Vt(),{ArrayIsArray:w2,Promise:g2,SymbolAsyncIterator:x2,SymbolDispose:E2}=Z(),No=It(),{once:S2}=Ce(),_2=dr(),Zp=ut(),{aggregateTwoErrors:A2,codes:{ERR_INVALID_ARG_TYPE:ff,ERR_INVALID_RETURN_VALUE:ef,ERR_MISSING_ARGS:T2,ERR_STREAM_DESTROYED:I2,ERR_STREAM_PREMATURE_CLOSE:R2},AbortError:v2}=Te(),{validateFunction:B2,validateAbortSignal:C2}=zr(),{isIterable:br,isReadable:tf,isReadableNodeStream:Oo,isNodeStream:Xp,isTransformStream:on,isWebStream:D2,isReadableStream:rf,isReadableFinished:L2}=at(),O2=globalThis.AbortController||jr().AbortController,nf,of,sf;function Qp(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=No(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,_2.destroyer(t,o||new I2("pipe")))},cleanup:i}}function N2(t){return B2(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function af(t){if(br(t))return t;if(Oo(t))return P2(t);throw new ff("val",["Readable","Iterable","AsyncIterable"],t)}async function*P2(t){of||(of=Wn()),yield*of.prototype[x2].call(t)}async function Lo(t,e,r,{end:n}){let i,o=null,s=c=>{if(c&&(i=c),o){let u=o;o=null,u()}},a=()=>new g2((c,u)=>{i?u(i):o=()=>{i?u(i):c()}});e.on("drain",s);let f=No(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?A2(i,c):c)}finally{f(),e.off("drain",s)}}async function cf(t,e,r,{end:n}){on(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 U2(...t){return Jp(t,S2(N2(t)))}function Jp(t,e,r){if(t.length===1&&w2(t[0])&&(t=t[0]),t.length<2)throw new T2("streams");let n=new O2,i=n.signal,o=r?.signal,s=[];C2(o,"options.signal");function a(){w(new v2)}sf=sf||Ce().addAbortListener;let f;o&&(f=sf(o,a));let c,u,l=[],h=0;function d(A){w(A,--h===0)}function w(A,T){var R;if(A&&(!c||c.code==="ERR_STREAM_PREMATURE_CLOSE")&&(c=A),!(!c&&!T)){for(;l.length;)l.shift()(c);(R=f)===null||R===void 0||R[E2](),n.abort(),T&&(c||s.forEach(F=>F()),Xn.nextTick(e,c,u))}}let p;for(let A=0;A<t.length;A++){let T=t[A],R=A<t.length-1,F=A>0,D=R||r?.end!==!1,B=A===t.length-1;if(Xp(T)){let P=function(q){q&&q.name!=="AbortError"&&q.code!=="ERR_STREAM_PREMATURE_CLOSE"&&d(q)};var E=P;if(D){let{destroy:q,cleanup:k}=Qp(T,R,F);l.push(q),tf(T)&&B&&s.push(k)}T.on("error",P),tf(T)&&B&&s.push(()=>{T.removeListener("error",P)})}if(A===0)if(typeof T=="function"){if(p=T({signal:i}),!br(p))throw new ef("Iterable, AsyncIterable or Stream","source",p)}else br(T)||Oo(T)||on(T)?p=T:p=Zp.from(T);else if(typeof T=="function"){if(on(p)){var y;p=af((y=p)===null||y===void 0?void 0:y.readable)}else p=af(p);if(p=T(p,{signal:i}),R){if(!br(p,!0))throw new ef("AsyncIterable",`transform[${A-1}]`,p)}else{var b;nf||(nf=Jc());let P=new nf({objectMode:!0}),q=(b=p)===null||b===void 0?void 0:b.then;if(typeof q=="function")h++,q.call(p,x=>{u=x,x!=null&&P.write(x),D&&P.end(),Xn.nextTick(d)},x=>{P.destroy(x),Xn.nextTick(d,x)});else if(br(p,!0))h++,Lo(p,P,d,{end:D});else if(rf(p)||on(p)){let x=p.readable||p;h++,Lo(x,P,d,{end:D})}else throw new ef("AsyncIterable or Promise","destination",p);p=P;let{destroy:k,cleanup:m}=Qp(p,!1,!0);l.push(k),B&&s.push(m)}}else if(Xp(T)){if(Oo(p)){h+=2;let P=F2(p,T,d,{end:D});tf(T)&&B&&s.push(P)}else if(on(p)||rf(p)){let P=p.readable||p;h++,Lo(P,T,d,{end:D})}else if(br(p))h++,Lo(p,T,d,{end:D});else throw new ff("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=T}else if(D2(T)){if(Oo(p))h++,cf(af(p),T,d,{end:D});else if(rf(p)||br(p))h++,cf(p,T,d,{end:D});else if(on(p))h++,cf(p.readable,T,d,{end:D});else throw new ff("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],p);p=T}else p=Zp.from(T)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Xn.nextTick(a),p}function F2(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;L2(t)?Xn.nextTick(s):t.once("end",s)}else r();return No(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)}),No(e,{readable:!1,writable:!0},r)}e0.exports={pipelineImpl:Jp,pipeline:U2}});var lf=V((SI,s0)=>{"use strict";var{pipeline:k2}=Po(),Uo=ut(),{destroyer:M2}=dr(),{isNodeStream:Fo,isReadable:t0,isWritable:r0,isWebStream:uf,isTransformStream:mr,isWritableStream:n0,isReadableStream:i0}=at(),{AbortError:q2,codes:{ERR_INVALID_ARG_VALUE:o0,ERR_MISSING_ARGS:$2}}=Te(),H2=It();s0.exports=function(...e){if(e.length===0)throw new $2("streams");if(e.length===1)return Uo.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=Uo.from(e[0])),typeof e[e.length-1]=="function"){let d=e.length-1;e[d]=Uo.from(e[d])}for(let d=0;d<e.length;++d)if(!(!Fo(e[d])&&!uf(e[d]))){if(d<e.length-1&&!(t0(e[d])||i0(e[d])||mr(e[d])))throw new o0(`streams[${d}]`,r[d],"must be readable");if(d>0&&!(r0(e[d])||n0(e[d])||mr(e[d])))throw new o0(`streams[${d}]`,r[d],"must be writable")}let n,i,o,s,a;function f(d){let w=s;s=null,w?w(d):d?a.destroy(d):!h&&!l&&a.destroy()}let c=e[0],u=k2(e,f),l=!!(r0(c)||n0(c)||mr(c)),h=!!(t0(u)||i0(u)||mr(u));if(a=new Uo({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(u!=null&&u.readableObjectMode),writable:l,readable:h}),l){if(Fo(c))a._write=function(w,p,y){c.write(w,p)?y():n=y},a._final=function(w){c.end(),i=w},c.on("drain",function(){if(n){let w=n;n=null,w()}});else if(uf(c)){let p=(mr(c)?c.writable:c).getWriter();a._write=async function(y,b,E){try{await p.ready,p.write(y).catch(()=>{}),E()}catch(A){E(A)}},a._final=async function(y){try{await p.ready,p.close().catch(()=>{}),i=y}catch(b){y(b)}}}let d=mr(u)?u.readable:u;H2(d,()=>{if(i){let w=i;i=null,w()}})}if(h){if(Fo(u))u.on("readable",function(){if(o){let d=o;o=null,d()}}),u.on("end",function(){a.push(null)}),a._read=function(){for(;;){let d=u.read();if(d===null){o=a._read;return}if(!a.push(d))return}};else if(uf(u)){let w=(mr(u)?u.readable:u).getReader();a._read=async function(){for(;;)try{let{value:p,done:y}=await w.read();if(!a.push(p))return;if(y){a.push(null);return}}catch{return}}}}return a._destroy=function(d,w){!d&&s!==null&&(d=new q2),o=null,n=null,i=null,s===null?w(d):(s=w,Fo(u)&&M2(u,d))},a}});var b0=V((_I,pf)=>{"use strict";var K2=globalThis.AbortController||jr().AbortController,{codes:{ERR_INVALID_ARG_VALUE:j2,ERR_INVALID_ARG_TYPE:Qn,ERR_MISSING_ARGS:V2,ERR_OUT_OF_RANGE:W2},AbortError:lt}=Te(),{validateAbortSignal:wr,validateInteger:a0,validateObject:gr}=zr(),z2=Z().Symbol("kWeak"),G2=Z().Symbol("kResistStopPropagation"),{finished:Y2}=It(),Z2=lf(),{addAbortSignalNoValidate:X2}=Hn(),{isWritable:Q2,isNodeStream:J2}=at(),{deprecate:eS}=Ce(),{ArrayPrototypePush:tS,Boolean:rS,MathFloor:c0,Number:nS,NumberIsNaN:iS,Promise:f0,PromiseReject:u0,PromiseResolve:oS,PromisePrototypeThen:l0,Symbol:h0}=Z(),ko=h0("kEmpty"),d0=h0("kEof");function sS(t,e){if(e!=null&&gr(e,"options"),e?.signal!=null&&wr(e.signal,"options.signal"),J2(t)&&!Q2(t))throw new j2("stream",t,"must be writable");let r=Z2(this,t);return e!=null&&e.signal&&X2(e.signal,r),r}function Mo(t,e){if(typeof t!="function")throw new Qn("fn",["Function","AsyncFunction"],t);e!=null&&gr(e,"options"),e?.signal!=null&&wr(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=c0(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=c0(e.highWaterMark)),a0(r,"options.concurrency",1),a0(n,"options.highWaterMark",0),n+=r,async function*(){let o=Ce().AbortSignalAny([e?.signal].filter(rS)),s=this,a=[],f={signal:o},c,u,l=!1,h=0;function d(){l=!0,w()}function w(){h-=1,p()}function p(){u&&!l&&h<r&&a.length<n&&(u(),u=null)}async function y(){try{for await(let b of s){if(l)return;if(o.aborted)throw new lt;try{if(b=t(b,f),b===ko)continue;b=oS(b)}catch(E){b=u0(E)}h+=1,l0(b,w,d),a.push(b),c&&(c(),c=null),!l&&(a.length>=n||h>=r)&&await new f0(E=>{u=E})}a.push(d0)}catch(b){let E=u0(b);l0(E,w,d),a.push(E)}finally{l=!0,c&&(c(),c=null)}}y();try{for(;;){for(;a.length>0;){let b=await a[0];if(b===d0)return;if(o.aborted)throw new lt;b!==ko&&(yield b),a.shift(),p()}await new f0(b=>{c=b})}}finally{l=!0,u&&(u(),u=null)}}.call(this)}function aS(t=void 0){return t!=null&&gr(t,"options"),t?.signal!=null&&wr(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 p0(t,e=void 0){for await(let r of hf.call(this,t,e))return!0;return!1}async function cS(t,e=void 0){if(typeof t!="function")throw new Qn("fn",["Function","AsyncFunction"],t);return!await p0.call(this,async(...r)=>!await t(...r),e)}async function fS(t,e){for await(let r of hf.call(this,t,e))return r}async function uS(t,e){if(typeof t!="function")throw new Qn("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),ko}for await(let n of Mo.call(this,r,e));}function hf(t,e){if(typeof t!="function")throw new Qn("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:ko}return Mo.call(this,r,e)}var df=class extends V2{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function lS(t,e,r){var n;if(typeof t!="function")throw new Qn("reducer",["Function","AsyncFunction"],t);r!=null&&gr(r,"options"),r?.signal!=null&&wr(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 Y2(this.destroy(c)),c}let o=new K2,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[z2]:this,[G2]:!0};r.signal.addEventListener("abort",()=>o.abort(),c)}let a=!1;try{for await(let c of this){var f;if(a=!0,r!=null&&(f=r.signal)!==null&&f!==void 0&&f.aborted)throw new lt;i?e=await t(e,c,{signal:s}):(e=c,i=!0)}if(!a&&!i)throw new df}finally{o.abort()}return e}async function dS(t){t!=null&&gr(t,"options"),t?.signal!=null&&wr(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});tS(e,n)}return e}function hS(t,e){let r=Mo.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function y0(t){if(t=nS(t),iS(t))return 0;if(t<0)throw new W2("number",">= 0",t);return t}function pS(t,e=void 0){return e!=null&&gr(e,"options"),e?.signal!=null&&wr(e.signal,"options.signal"),t=y0(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 yS(t,e=void 0){return e!=null&&gr(e,"options"),e?.signal!=null&&wr(e.signal,"options.signal"),t=y0(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)}pf.exports.streamReturningOperators={asIndexedPairs:eS(aS,"readable.asIndexedPairs will be removed in a future version."),drop:pS,filter:hf,flatMap:hS,map:Mo,take:yS,compose:sS};pf.exports.promiseReturningOperators={every:cS,forEach:uS,reduce:lS,toArray:dS,some:p0,find:fS}});var yf=V((AI,m0)=>{"use strict";var{ArrayPrototypePop:bS,Promise:mS}=Z(),{isIterable:wS,isNodeStream:gS,isWebStream:xS}=at(),{pipelineImpl:ES}=Po(),{finished:SS}=It();bf();function _S(...t){return new mS((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!gS(o)&&!wS(o)&&!xS(o)){let s=bS(t);n=s.signal,i=s.end}ES(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}m0.exports={finished:SS,pipeline:_S}});var bf=V((TI,I0)=>{"use strict";var{Buffer:AS}=_t(),{ObjectDefineProperty:Bt,ObjectKeys:x0,ReflectApply:E0}=Z(),{promisify:{custom:S0}}=Ce(),{streamReturningOperators:w0,promiseReturningOperators:g0}=b0(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:_0}}=Te(),TS=lf(),{setDefaultHighWaterMark:IS,getDefaultHighWaterMark:RS}=Kn(),{pipeline:A0}=Po(),{destroyer:vS}=dr(),T0=It(),mf=yf(),Jn=at(),G=I0.exports=wo().Stream;G.isDestroyed=Jn.isDestroyed;G.isDisturbed=Jn.isDisturbed;G.isErrored=Jn.isErrored;G.isReadable=Jn.isReadable;G.isWritable=Jn.isWritable;G.Readable=Wn();for(let t of x0(w0)){let r=function(...n){if(new.target)throw _0();return G.Readable.from(E0(e,this,n))},e=w0[t];Bt(r,"name",{__proto__:null,value:e.name}),Bt(r,"length",{__proto__:null,value:e.length}),Bt(G.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of x0(g0)){let r=function(...n){if(new.target)throw _0();return E0(e,this,n)},e=g0[t];Bt(r,"name",{__proto__:null,value:e.name}),Bt(r,"length",{__proto__:null,value:e.length}),Bt(G.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}G.Writable=Do();G.Duplex=ut();G.Transform=Xc();G.PassThrough=Jc();G.pipeline=A0;var{addAbortSignal:BS}=Hn();G.addAbortSignal=BS;G.finished=T0;G.destroy=vS;G.compose=TS;G.setDefaultHighWaterMark=IS;G.getDefaultHighWaterMark=RS;Bt(G,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return mf}});Bt(A0,S0,{__proto__:null,enumerable:!0,get(){return mf.pipeline}});Bt(T0,S0,{__proto__:null,enumerable:!0,get(){return mf.finished}});G.Stream=G;G._isUint8Array=function(e){return e instanceof Uint8Array};G._uint8ArrayToBuffer=function(e){return AS.from(e.buffer,e.byteOffset,e.byteLength)}});var R0=V((II,oe)=>{"use strict";var de=bf(),CS=yf(),DS=de.Readable.destroy;oe.exports=de.Readable;oe.exports._uint8ArrayToBuffer=de._uint8ArrayToBuffer;oe.exports._isUint8Array=de._isUint8Array;oe.exports.isDisturbed=de.isDisturbed;oe.exports.isErrored=de.isErrored;oe.exports.isReadable=de.isReadable;oe.exports.Readable=de.Readable;oe.exports.Writable=de.Writable;oe.exports.Duplex=de.Duplex;oe.exports.Transform=de.Transform;oe.exports.PassThrough=de.PassThrough;oe.exports.addAbortSignal=de.addAbortSignal;oe.exports.finished=de.finished;oe.exports.destroy=de.destroy;oe.exports.destroy=DS;oe.exports.pipeline=de.pipeline;oe.exports.compose=de.compose;Object.defineProperty(de,"promises",{configurable:!0,enumerable:!0,get(){return CS}});oe.exports.Stream=de.Stream;oe.exports.default=oe.exports});var YS={};Oe(YS,{BAD_REQUEST:()=>MS,INTERNAL_SERVER_ERROR:()=>qS,Libp2pSocket:()=>qo,NOT_FOUND_RESPONSE:()=>kS,NOT_IMPLEMENTED_ERROR:()=>$S,Request:()=>kn,Response:()=>Va,STATUS_CODES:()=>ja,getHeader:()=>jS,getHeaders:()=>Mn,getHost:()=>L0,getServerUpgradeHeaders:()=>zS,isWebSocketUpgrade:()=>Ka,normalizeMethod:()=>VS,normalizeUrl:()=>N0,readHeaders:()=>GS,responseToStream:()=>FS,streamToRequest:()=>US,streamToSocket:()=>LS,stripHTTPPath:()=>O0,toResource:()=>KS,toURL:()=>NS,toUint8Array:()=>PS,writeHeaders:()=>D0});var Vo={};Oe(Vo,{base10:()=>G0});var XS=new Uint8Array(0);function Ef(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 Sf(t){return new TextEncoder().encode(t)}function _f(t){return new TextDecoder().decode(t)}function H0(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var p=0,y=0,b=0,E=w.length;b!==E&&w[b]===0;)b++,p++;for(var A=(E-b)*u+1>>>0,T=new Uint8Array(A);b!==E;){for(var R=w[b],F=0,D=A-1;(R!==0||F<y)&&D!==-1;D--,F++)R+=256*T[D]>>>0,T[D]=R%a>>>0,R=R/a>>>0;if(R!==0)throw new Error("Non-zero carry");y=F,b++}for(var B=A-y;B!==A&&T[B]===0;)B++;for(var P=f.repeat(p);B<A;++B)P+=t.charAt(T[B]);return P}function h(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var p=0;if(w[p]!==" "){for(var y=0,b=0;w[p]===f;)y++,p++;for(var E=(w.length-p)*c+1>>>0,A=new Uint8Array(E);w[p];){var T=r[w.charCodeAt(p)];if(T===255)return;for(var R=0,F=E-1;(T!==0||R<b)&&F!==-1;F--,R++)T+=a*A[F]>>>0,A[F]=T%256>>>0,T=T/256>>>0;if(T!==0)throw new Error("Non-zero carry");b=R,p++}if(w[p]!==" "){for(var D=E-b;D!==E&&A[D]===0;)D++;for(var B=new Uint8Array(y+(E-D)),P=y;D!==E;)B[P++]=A[D++];return B}}}function d(w){var p=h(w);if(p)return p;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:h,decode:d}}var K0=H0,j0=K0,Tf=j0;var $o=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")}},Ho=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 If(this,e)}},Ko=class{decoders;constructor(e){this.decoders=e}or(e){return If(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 If(t,e){return new Ko({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var jo=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 $o(e,r,n),this.decoder=new Ho(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Er({name:t,prefix:e,encode:r,decode:n}){return new jo(t,e,r,n)}function Ct({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=Tf(r,t);return Er({prefix:e,name:t,encode:n,decode:o=>dt(i(o))})}function V0(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,f=0;for(let c=0;c<i;++c){let u=e[t[c]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|u,s+=r,s>=8&&(s-=8,o[f++]=255&a>>s)}if(s>=r||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function W0(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],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 z0(t){let e={};for(let r=0;r<t.length;++r)e[t[r]]=r;return e}function ee({name:t,prefix:e,bitsPerChar:r,alphabet:n}){let i=z0(n);return Er({prefix:e,name:t,encode(o){return W0(o,n,r)},decode(o){return V0(o,i,r,t)}})}var G0=Ct({prefix:"9",name:"base10",alphabet:"0123456789"});var Wo={};Oe(Wo,{base16:()=>Y0,base16upper:()=>Z0});var Y0=ee({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Z0=ee({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var zo={};Oe(zo,{base2:()=>X0});var X0=ee({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Go={};Oe(Go,{base256emoji:()=>ry});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}"),Q0=Rf.reduce((t,e,r)=>(t[r]=e,t),[]),J0=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 ey(t){return t.reduce((e,r)=>(e+=Q0[r],e),"")}function ty(t){let e=[];for(let r of t){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let i=J0[n];if(i==null)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}var ry=Er({prefix:"\u{1F680}",name:"base256emoji",encode:ey,decode:ty});var Yo={};Oe(Yo,{base32:()=>Dt,base32hex:()=>sy,base32hexpad:()=>cy,base32hexpadupper:()=>fy,base32hexupper:()=>ay,base32pad:()=>iy,base32padupper:()=>oy,base32upper:()=>ny,base32z:()=>uy});var Dt=ee({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ny=ee({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),iy=ee({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),oy=ee({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),sy=ee({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ay=ee({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),cy=ee({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),fy=ee({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),uy=ee({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Zo={};Oe(Zo,{base36:()=>Yt,base36upper:()=>ly});var Yt=Ct({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),ly=Ct({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Xo={};Oe(Xo,{base58btc:()=>se,base58flickr:()=>dy});var se=Ct({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),dy=Ct({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var es={};Oe(es,{base64:()=>hy,base64pad:()=>Qo,base64url:()=>Jo,base64urlpad:()=>py});var hy=ee({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Qo=ee({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Jo=ee({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),py=ee({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var ts={};Oe(ts,{base8:()=>yy});var yy=ee({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var rs={};Oe(rs,{identity:()=>by});var by=Er({prefix:"\0",name:"identity",encode:t=>_f(t),decode:t=>Sf(t)});var h_=new TextEncoder,p_=new TextDecoder;var is={};Oe(is,{identity:()=>$e});var gy=Cf,vf=128,xy=127,Ey=~xy,Sy=Math.pow(2,31);function Cf(t,e,r){e=e||[],r=r||0;for(var n=r;t>=Sy;)e[r++]=t&255|vf,t/=128;for(;t&Ey;)e[r++]=t&255|vf,t>>>=7;return e[r]=t|0,Cf.bytes=r-n+1,e}var _y=ns,Ay=128,Bf=127;function ns(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw ns.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Bf)<<i:(s&Bf)*Math.pow(2,i),i+=7}while(s>=Ay);return ns.bytes=o-n,r}var Ty=Math.pow(2,7),Iy=Math.pow(2,14),Ry=Math.pow(2,21),vy=Math.pow(2,28),By=Math.pow(2,35),Cy=Math.pow(2,42),Dy=Math.pow(2,49),Ly=Math.pow(2,56),Oy=Math.pow(2,63),Ny=function(t){return t<Ty?1:t<Iy?2:t<Ry?3:t<vy?4:t<By?5:t<Cy?6:t<Dy?7:t<Ly?8:t<Oy?9:10},Py={encode:gy,decode:_y,encodingLength:Ny},Uy=Py,an=Uy;function cn(t,e=0){return[an.decode(t,e),an.decode.bytes]}function Sr(t,e,r=0){return an.encode(t,e,r),e}function _r(t){return an.encodingLength(t)}function Tr(t,e){let r=e.byteLength,n=_r(t),i=n+_r(r),o=new Uint8Array(i+r);return Sr(t,o,0),Sr(r,o,n),o.set(e,i),new Ar(t,r,e,o)}function fn(t){let e=dt(t),[r,n]=cn(e),[i,o]=cn(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Ar(r,i,s,e)}function Df(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Ef(t.bytes,r.bytes)}}var Ar=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var Lf=0,Fy="identity",Of=dt;function ky(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 Tr(Lf,Of(t))}var $e={code:Lf,name:Fy,encode:Of,digest:ky};var ss={};Oe(ss,{sha256:()=>ln,sha512:()=>qy});var My=20;function un({name:t,code:e,encode:r,minDigestLength:n,maxDigestLength:i}){return new os(t,e,r,n,i)}var os=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,r,n,i,o){this.name=e,this.code=r,this.encode=n,this.minDigestLength=i??My,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?Nf(n,this.code,r?.truncate):n.then(i=>Nf(i,this.code,r?.truncate))}else throw Error("Unknown type, must be binary type")}};function Nf(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 Tr(e,t)}function Uf(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var ln=un({name:"sha2-256",code:18,encode:Uf("SHA-256")}),qy=un({name:"sha2-512",code:19,encode:Uf("SHA-512")});function Ff(t,e){let{bytes:r,version:n}=t;return n===0?Hy(r,as(t),e??se.encoder):Ky(r,as(t),e??Dt.encoder)}var kf=new WeakMap;function as(t){let e=kf.get(t);if(e==null){let r=new Map;return kf.set(t,r),r}return e}var we=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!==dn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==jy)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=Tr(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&&Df(e.multihash,n.multihash)}toString(e){return Ff(this,e)}toJSON(){return{"/":Ff(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??Mf(n,i,o.bytes))}else if(r[Vy]===!0){let{version:n,multihash:i,code:o}=r,s=fn(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!==dn)throw new Error(`Version 0 CID must use dag-pb (code: ${dn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Mf(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,dn,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 Ar(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,h]=cn(e.subarray(r));return r+=h,l},i=n(),o=dn;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=$y(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 as(o).set(n,e),o}};function $y(t,e){switch(t[0]){case"Q":{let r=e??se;return[se.prefix,r.decode(`${se.prefix}${t}`)]}case se.prefix:{let r=e??se;return[se.prefix,r.decode(t)]}case Dt.prefix:{let r=e??Dt;return[Dt.prefix,r.decode(t)]}case Yt.prefix:{let r=e??Yt;return[Yt.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 Hy(t,e,r){let{prefix:n}=r;if(n!==se.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 Ky(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 dn=112,jy=18;function Mf(t,e,r){let n=_r(t),i=n+_r(e),o=new Uint8Array(i+r.byteLength);return Sr(t,o,0),Sr(e,o,n),o.set(r,i),o}var Vy=Symbol.for("@ipld/js-cid/CID");var hn={...rs,...zo,...ts,...Vo,...Wo,...Yo,...Zo,...Xo,...es,...Go},U_={...ss,...is};function ht(t=0){return new Uint8Array(t)}function Ne(t=0){return new Uint8Array(t)}function $f(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var qf=$f("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),cs=$f("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=Ne(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Wy={utf8:qf,"utf-8":qf,hex:hn.base16,latin1:cs,ascii:cs,binary:cs,...hn},ii=Wy;function X(t,e="utf8"){let r=ii[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}function O(t){if(t!==void 0&&t!==O.REQUEST&&t!==O.RESPONSE)throw new Error("type must be REQUEST or RESPONSE");t===void 0||this.initialize(t),this.maxHeaderSize=O.maxHeaderSize}O.prototype.initialize=function(t,e){if(t!==O.REQUEST&&t!==O.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};O.encoding="ascii";O.maxHeaderSize=80*1024;O.REQUEST="REQUEST";O.RESPONSE="RESPONSE";var Hf=O.kOnHeaders=1,fs=O.kOnHeadersComplete=2,oi=O.kOnBody=3,us=O.kOnMessageComplete=4;O.prototype[Hf]=O.prototype[fs]=O.prototype[oi]=O.prototype[us]=function(){};var Kf=!0;Object.defineProperty(O,"kOnExecute",{get:function(){return Kf=!1,99}});var jf=O.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"],Vf=jf.indexOf("CONNECT");O.prototype.reinitialize=O;O.prototype.close=O.prototype.pause=O.prototype.resume=O.prototype.remove=O.prototype.free=function(){};O.prototype._compatMode0_11=!1;O.prototype.getAsyncId=function(){return 0};var zy={REQUEST_LINE:!0,RESPONSE_LINE:!0,HEADER:!0};O.prototype.execute=function(t,e,r){if(!(this instanceof O))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,zy[this.state]&&(this.headerSize+=r,this.headerSize>(this.maxHeaderSize||O.maxHeaderSize))?new Error("max header size exceeded"):r};var Gy={REQUEST_LINE:!0,RESPONSE_LINE:!0,BODY_RAW:!0};O.prototype.finish=function(){if(!this.hadError){if(!Gy[this.state])return new Error("invalid state for EOF");this.state==="BODY_RAW"&&this.userCall()(this[us]())}};O.prototype.consume=O.prototype.unconsume=O.prototype.getCurrentBuffer=function(){};O.prototype.userCall=function(){this.isUserCall=!0;var t=this;return function(e){return t.isUserCall=!1,e}};O.prototype.nextRequest=function(){this.userCall()(this[us]()),this.reinitialize(this.type)};O.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+X(e.subarray(this.offset,r),O.encoding);return n.charAt(n.length-1)==="\r"&&(n=n.substr(0,n.length-1)),this.line="",this.offset=r+1,n}this.line+=X(e.subarray(this.offset,this.end),O.encoding),this.offset=this.end};var Yy=/^([^: \t]+):[ \t]*((?:.*[^ \t])|)/,Zy=/^[ \t]+(.*[^ \t])/;O.prototype.parseHeader=function(t,e){if(t.indexOf("\r")!==-1)throw si("HPE_LF_EXPECTED");var r=Yy.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 Xy=/^([A-Z-]+) ([^ ]+) HTTP\/(\d)\.(\d)$/;O.prototype.REQUEST_LINE=function(){var t=this.consumeLine();if(t){var e=Xy.exec(t);if(e===null)throw si("HPE_INVALID_CONSTANT");if(this.info.method=this._compatMode0_11?e[1]:jf.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 Qy=/^HTTP\/(\d)\.(\d) (\d{3}) ?(.*)$/;O.prototype.RESPONSE_LINE=function(){var t=this.consumeLine();if(t){var e=Qy.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"}};O.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)};O.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===O.REQUEST||e.statusCode===101:e.upgrade=e.method===Vf,this.isChunked&&e.upgrade&&(this.isChunked=!1),e.shouldKeepAlive=this.shouldKeepAlive();var a;if(Kf?a=this.userCall()(this[fs](e)):a=this.userCall()(this[fs](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"}}}};O.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")};O.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")};O.prototype.BODY_CHUNKEMPTYLINE=function(){var t=this.consumeLine();if(t!==void 0){if(t!=="")throw new Error("Expected empty line");this.state="BODY_CHUNKHEAD"}};O.prototype.BODY_CHUNKTRAILERS=function(){var t=this.consumeLine();t!==void 0&&(t?this.parseHeader(t,this.trailers):(this.trailers.length&&this.userCall()(this[Hf](this.trailers,"")),this.nextRequest()))};O.prototype.BODY_RAW=function(){this.userCall()(this[oi](this.chunk.slice(this.offset,this.end),0,this.end-this.offset)),this.offset=this.end};O.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=O["kOn"+t];Object.defineProperty(O.prototype,"on"+t,{get:function(){return this[e]},set:function(r){return this._compatMode0_11=!0,Vf="CONNECT",this[e]=r}})});function si(t){var e=new Error("Parse Error");return e.code=t,e}var Re=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},ai=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var ci=class extends Error{static name="InvalidCIDError";constructor(e="Invalid CID"){super(e),this.name="InvalidCIDError"}},fi=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var pn=class extends Error{static name="ProtocolError";constructor(e="Protocol error"){super(e),this.name="ProtocolError"}};var yn=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};var ui=Symbol.for("@libp2p/peer-id");function Wf(t){return!!t?.[ui]}function Pe(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}async function zf(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}function pt(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Ne(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return r}var Yf=Symbol.for("@achingbrain/uint8arraylist");function Gf(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?.[Yf]}var ve=class t{bufs;length;[Yf]=!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;for(let i of n.bufs)this.bufs.push(i)}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=Gf(this.bufs,e);return r.buf[r.index]}set(e,r){let n=Gf(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 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,f=a+s.byteLength;if(i=f,e>=f)continue;let c=e>=a&&e<f,u=r>a&&r<=f;if(c&&u){if(e===a&&r===f){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(u){if(r===f){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,f=this.byteLength-n.byteLength,c=n.byteLength-1,u;for(let l=r;l<=f;l+=u){u=0;for(let h=c;h>=0;h--){let d=this.get(l+h);if(n[h]!==d){u=Math.max(1,h-a[d]);break}}if(u===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=Ne(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=Ne(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(!Pe(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 ae(t,e="utf8"){let r=ii[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var Jy=parseInt("11111",2),ls=parseInt("10000000",2),eb=parseInt("01111111",2),Zf={0:bn,1:bn,2:tb,3:ib,4:ob,5:nb,6:rb,16:bn,22:bn,48:bn};function ds(t,e={offset:0}){let r=t[e.offset]&Jy;if(e.offset++,Zf[r]!=null)return Zf[r](t,e);throw new Error("No decoder for tag "+r)}function mn(t,e){let r=0;if((t[e.offset]&ls)===ls){let n=t[e.offset]&eb,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 bn(t,e){mn(t,e);let r=[];for(;!(e.offset>=t.byteLength);){let n=ds(t,e);if(n===null)break;r.push(n)}return r}function tb(t,e){let r=mn(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 rb(t,e){let r=mn(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}`,f=[];for(;e.offset<n;){let c=t[e.offset];if(e.offset++,f.push(c&127),c<128){f.reverse();let u=0;for(let l=0;l<f.length;l++)u+=f[l]<<l*7;a+=`.${u}`,f=[]}}return a}function nb(t,e){return e.offset++,null}function ib(t,e){let r=mn(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 ob(t,e){let r=mn(t,e),n=t.subarray(e.offset,e.offset+r);return e.offset+=r,n}function sb(t){let e=t.toString(16);e.length%2===1&&(e="0"+e);let r=new ve;for(let n=0;n<e.length;n+=2)r.append(Uint8Array.from([parseInt(`${e[n]}${e[n+1]}`,16)]));return r}function hs(t){if(t.byteLength<128)return Uint8Array.from([t.byteLength]);let e=sb(t.byteLength);return new ve(Uint8Array.from([e.byteLength|ls]),e)}function Xf(t){let e=new ve,r=128;return(t.subarray()[0]&r)===r&&e.append(Uint8Array.from([0])),e.append(t),new ve(Uint8Array.from([2]),hs(e),e)}function Qf(t){let e=Uint8Array.from([0]),r=new ve(e,t);return new ve(Uint8Array.from([3]),hs(r),r)}function di(t,e=48){let r=new ve;for(let n of t)r.append(n);return new ve(Uint8Array.from([e]),hs(r),r)}var ab=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),cb=Uint8Array.from([6,5,43,129,4,0,34]),fb=Uint8Array.from([6,5,43,129,4,0,35]),ub={ext:!0,kty:"EC",crv:"P-256"},lb={ext:!0,kty:"EC",crv:"P-384"},db={ext:!0,kty:"EC",crv:"P-521"},ps=32,ys=48,bs=66;function Jf(t){let e=ds(t);return eu(e)}function eu(t){let e=t[1][1][0],r=1,n,i;if(e.byteLength===ps*2+1)return n=X(e.subarray(r,r+ps),"base64url"),i=X(e.subarray(r+ps),"base64url"),new Rr({...ub,key_ops:["verify"],x:n,y:i});if(e.byteLength===ys*2+1)return n=X(e.subarray(r,r+ys),"base64url"),i=X(e.subarray(r+ys),"base64url"),new Rr({...lb,key_ops:["verify"],x:n,y:i});if(e.byteLength===bs*2+1)return n=X(e.subarray(r,r+bs),"base64url"),i=X(e.subarray(r+bs),"base64url"),new Rr({...db,key_ops:["verify"],x:n,y:i});throw new Re(`coordinates were wrong length, got ${e.byteLength}, expected 65, 97 or 133`)}function tu(t){return di([Xf(Uint8Array.from([1])),di([hb(t.crv)],160),di([Qf(new ve(Uint8Array.from([4]),ae(t.x??"","base64url"),ae(t.y??"","base64url")))],161)]).subarray()}function hb(t){if(t==="P-256")return ab;if(t==="P-384")return cb;if(t==="P-521")return fb;throw new Re(`Invalid curve ${t}`)}var Rr=class{type="ECDSA";jwk;_raw;constructor(e){this.jwk=e}get raw(){return this._raw==null&&(this._raw=tu(this.jwk)),this._raw}toMultihash(){return $e.digest(vr(this))}toCID(){return we.createV1(114,this.toMultihash())}toString(){return se.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Pe(this.raw,e.raw)}async verify(e,r,n){return zf(this.jwk,r,e,n)}};function ms(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Lt(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(`${r}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){let r=e&&`"${e}" `;throw new RangeError(`${r}expected integer >= 0, got ${t}`)}}function Ue(t,e,r=""){let n=ms(t),i=t?.length,o=e!==void 0;if(!n||o&&i!==e){let s=r&&`"${r}" `,a=o?` of length ${e}`:"",f=n?`length=${i}`:`type=${typeof t}`,c=s+"expected Uint8Array"+a+", got "+f;throw n?new RangeError(c):new TypeError(c)}return t}function hi(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Lt(t.outputLen),Lt(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Br(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 pi(t,e){Ue(t,void 0,"digestInto() output");let r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function bt(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function yi(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function He(t,e){return t<<32-e|t>>>e}var nu=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",pb=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function bi(t){if(Ue(t),nu)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=pb[t[r]];return e}var yt={_0:48,_9:57,A:65,F:70,a:97,f:102};function ru(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 wn(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(nu)try{return Uint8Array.fromHex(t)}catch(i){throw i instanceof SyntaxError?new RangeError(i.message):i}let e=t.length,r=e/2;if(e%2)throw new RangeError("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=ru(t.charCodeAt(o)),a=ru(t.charCodeAt(o+1));if(s===void 0||a===void 0){let f=t[o]+t[o+1];throw new RangeError('hex string expected, got non-hex character "'+f+'" at index '+o)}n[i]=s*16+a}return n}function ws(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];Ue(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}function gs(t,e={}){let r=(i,o)=>t(o).update(i).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=i=>t(i),Object.assign(r,e),Object.freeze(r)}function iu(t=32){Lt(t,"bytesLength");let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}var xs=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function ou(t,e,r){return t&e^~t&r}function su(t,e,r){return t&e^t&r^e&r}var gn=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,r,n,i){this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=yi(this.buffer)}update(e){Br(this),Ue(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 f=yi(e);for(;i<=o-s;s+=i)this.process(f,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){Br(this),pi(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,bt(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;n.setBigUint64(i-8,BigInt(this.length*8),o),this.process(n,0);let a=yi(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let c=f/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<c;l++)a.setUint32(4*l,u[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||=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()}},mt=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 mi=BigInt(4294967295),au=BigInt(32);function yb(t,e=!1){return e?{h:Number(t&mi),l:Number(t>>au&mi)}:{h:Number(t>>au&mi)|0,l:Number(t&mi)|0}}function cu(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}=yb(t[o],e);[n[o],i[o]]=[s,a]}return[n,i]}var Es=(t,e,r)=>t>>>r,Ss=(t,e,r)=>t<<32-r|e>>>r,Zt=(t,e,r)=>t>>>r|e<<32-r,Xt=(t,e,r)=>t<<32-r|e>>>r,xn=(t,e,r)=>t<<64-r|e>>>r-32,En=(t,e,r)=>t>>>r-32|e<<64-r;function Qe(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var fu=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),uu=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,lu=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),du=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,hu=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),pu=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var mb=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]),Ot=new Uint32Array(64),_s=class extends gn{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:f}=this;return[e,r,n,i,o,s,a,f]}set(e,r,n,i,o,s,a,f){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=f|0}process(e,r){for(let l=0;l<16;l++,r+=4)Ot[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let h=Ot[l-15],d=Ot[l-2],w=He(h,7)^He(h,18)^h>>>3,p=He(d,17)^He(d,19)^d>>>10;Ot[l]=p+Ot[l-7]+w+Ot[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:f,G:c,H:u}=this;for(let l=0;l<64;l++){let h=He(a,6)^He(a,11)^He(a,25),d=u+h+ou(a,f,c)+mb[l]+Ot[l]|0,p=(He(n,2)^He(n,13)^He(n,22))+su(n,i,o)|0;u=c,c=f,f=a,a=s+d|0,s=o,o=i,i=n,n=d+p|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,f=f+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,f,c,u)}roundClean(){bt(Ot)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),bt(this.buffer)}},As=class extends _s{A=mt[0]|0;B=mt[1]|0;C=mt[2]|0;D=mt[3]|0;E=mt[4]|0;F=mt[5]|0;G=mt[6]|0;H=mt[7]|0;constructor(){super(32)}};var yu=cu(["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))),wb=yu[0],gb=yu[1],Nt=new Uint32Array(80),Pt=new Uint32Array(80),Ts=class extends gn{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:f,Eh:c,El:u,Fh:l,Fl:h,Gh:d,Gl:w,Hh:p,Hl:y}=this;return[e,r,n,i,o,s,a,f,c,u,l,h,d,w,p,y]}set(e,r,n,i,o,s,a,f,c,u,l,h,d,w,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=f|0,this.Eh=c|0,this.El=u|0,this.Fh=l|0,this.Fl=h|0,this.Gh=d|0,this.Gl=w|0,this.Hh=p|0,this.Hl=y|0}process(e,r){for(let A=0;A<16;A++,r+=4)Nt[A]=e.getUint32(r),Pt[A]=e.getUint32(r+=4);for(let A=16;A<80;A++){let T=Nt[A-15]|0,R=Pt[A-15]|0,F=Zt(T,R,1)^Zt(T,R,8)^Es(T,R,7),D=Xt(T,R,1)^Xt(T,R,8)^Ss(T,R,7),B=Nt[A-2]|0,P=Pt[A-2]|0,q=Zt(B,P,19)^xn(B,P,61)^Es(B,P,6),k=Xt(B,P,19)^En(B,P,61)^Ss(B,P,6),m=lu(D,k,Pt[A-7],Pt[A-16]),x=du(m,F,q,Nt[A-7],Nt[A-16]);Nt[A]=x|0,Pt[A]=m|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:f,Dh:c,Dl:u,Eh:l,El:h,Fh:d,Fl:w,Gh:p,Gl:y,Hh:b,Hl:E}=this;for(let A=0;A<80;A++){let T=Zt(l,h,14)^Zt(l,h,18)^xn(l,h,41),R=Xt(l,h,14)^Xt(l,h,18)^En(l,h,41),F=l&d^~l&p,D=h&w^~h&y,B=hu(E,R,D,gb[A],Pt[A]),P=pu(B,b,T,F,wb[A],Nt[A]),q=B|0,k=Zt(n,i,28)^xn(n,i,34)^xn(n,i,39),m=Xt(n,i,28)^En(n,i,34)^En(n,i,39),x=n&o^n&a^o&a,I=i&s^i&f^s&f;b=p|0,E=y|0,p=d|0,y=w|0,d=l|0,w=h|0,{h:l,l:h}=Qe(c|0,u|0,P|0,q|0),c=a|0,u=f|0,a=o|0,f=s|0,o=n|0,s=i|0;let _=fu(q,m,I);n=uu(_,P,k,x),i=_|0}({h:n,l:i}=Qe(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Qe(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:f}=Qe(this.Ch|0,this.Cl|0,a|0,f|0),{h:c,l:u}=Qe(this.Dh|0,this.Dl|0,c|0,u|0),{h:l,l:h}=Qe(this.Eh|0,this.El|0,l|0,h|0),{h:d,l:w}=Qe(this.Fh|0,this.Fl|0,d|0,w|0),{h:p,l:y}=Qe(this.Gh|0,this.Gl|0,p|0,y|0),{h:b,l:E}=Qe(this.Hh|0,this.Hl|0,b|0,E|0),this.set(n,i,o,s,a,f,c,u,l,h,d,w,p,y,b,E)}roundClean(){bt(Nt,Pt)}destroy(){this.destroyed=!0,bt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Is=class extends Ts{Ah=ge[0]|0;Al=ge[1]|0;Bh=ge[2]|0;Bl=ge[3]|0;Ch=ge[4]|0;Cl=ge[5]|0;Dh=ge[6]|0;Dl=ge[7]|0;Eh=ge[8]|0;El=ge[9]|0;Fh=ge[10]|0;Fl=ge[11]|0;Gh=ge[12]|0;Gl=ge[13]|0;Hh=ge[14]|0;Hl=ge[15]|0;constructor(){super(64)}};var bu=gs(()=>new As,xs(1));var wi=gs(()=>new Is,xs(3));var j=(t,e,r)=>Ue(t,e,r),vs=Lt,Cr=bi,ue=(...t)=>ws(...t),Dr=t=>wn(t),Qt=ms,Sn=t=>iu(t),xi=BigInt(0),Rs=BigInt(1);function Ke(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}" `;throw new TypeError(r+"expected boolean, got type="+typeof t)}return t}function Ei(t){if(typeof t=="bigint"){if(!gi(t))throw new RangeError("positive bigint expected, got "+t)}else vs(t);return t}function je(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(r+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){let r=e&&`"${e}" `;throw new RangeError(r+"expected safe integer, got "+t)}}function _n(t){let e=Ei(t).toString(16);return e.length&1?"0"+e:e}function mu(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?xi:BigInt("0x"+t)}function Jt(t){return mu(bi(t))}function Je(t){return mu(bi(An(Ue(t)).reverse()))}function Si(t,e){if(Lt(e),e===0)throw new RangeError("zero length");t=Ei(t);let r=t.toString(16);if(r.length>e*2)throw new RangeError("number too large");return wn(r.padStart(e*2,"0"))}function Bs(t,e){return Si(t,e).reverse()}function wu(t,e){if(t=j(t),e=j(e),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 An(t){return Uint8Array.from(j(t))}function _i(t){if(typeof t!="string")throw new TypeError("ascii string expected, got "+typeof t);return Uint8Array.from(t,(e,r)=>{let n=e.charCodeAt(0);if(e.length!==1||n>127)throw new RangeError(`string contains non-ASCII character "${t[r]}" with code ${n} at position ${r}`);return n})}var gi=t=>typeof t=="bigint"&&xi<=t;function xb(t,e,r){return gi(t)&&gi(e)&&gi(r)&&e<=t&&t<r}function Lr(t,e,r,n){if(!xb(e,r,n))throw new RangeError("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Or(t){if(t<xi)throw new Error("expected non-negative bigint, got "+t);let e;for(e=0;t>xi;t>>=Rs,e+=1);return e}var Tn=t=>(Rs<<BigInt(t))-Rs;function gu(t,e,r){if(Lt(t,"hashLen"),Lt(e,"qByteLen"),typeof r!="function")throw new TypeError("hmacFn must be a function");let n=y=>new Uint8Array(y),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),a=1e3,f=n(t),c=n(t),u=0,l=()=>{f.fill(1),c.fill(0),u=0},h=(...y)=>r(c,ue(f,...y)),d=(y=i)=>{c=h(o,y),f=h(),y.length!==0&&(c=h(s,y),f=h())},w=()=>{if(u++>=a)throw new Error("drbg: tried max amount of iterations");let y=0,b=[];for(;y<e;){f=h();let E=f.slice();b.push(E),y+=f.length}return ue(...b)};return(y,b)=>{l(),d(y);let E;for(;(E=b(w()))===void 0;)d();return l(),E}}function Ve(t,e={},r={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function n(o,s,a){if(!a&&s!=="function"&&!Object.hasOwn(t,o))throw new TypeError(`param "${o}" is invalid: expected own property`);let f=t[o];if(a&&f===void 0)return;let c=typeof f;if(c!==s||f===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${c}`)}let i=(o,s)=>Object.entries(o).forEach(([a,f])=>n(a,f,s));i(e,!1),i(r,!0)}var Cs=()=>{throw new Error("not implemented")};var xe=BigInt(0),te=BigInt(1),er=BigInt(2),_u=BigInt(3),Au=BigInt(4),Tu=BigInt(5),Eb=BigInt(7),Iu=BigInt(8),Sb=BigInt(9),Ru=BigInt(16);function ne(t,e){if(e<=xe)throw new Error("mod: expected positive modulus, got "+e);let r=t%e;return r>=xe?r:e+r}function Y(t,e,r){if(e<xe)throw new Error("pow2: expected non-negative exponent, got "+e);let n=t;for(;e-- >xe;)n*=n,n%=r;return n}function xu(t,e){if(t===xe)throw new Error("invert: expected non-zero number");if(e<=xe)throw new Error("invert: expected positive modulus, got "+e);let r=ne(t,e),n=e,i=xe,o=te,s=te,a=xe;for(;r!==xe;){let c=n/r,u=n-r*c,l=i-s*c,h=o-a*c;n=r,r=u,i=s,o=a,s=l,a=h}if(n!==te)throw new Error("invert: does not exist");return ne(i,e)}function Ds(t,e,r){let n=t;if(!n.eql(n.sqr(e),r))throw new Error("Cannot find square root")}function vu(t,e){let r=t,n=(r.ORDER+te)/Au,i=r.pow(e,n);return Ds(r,i,e),i}function _b(t,e){let r=t,n=(r.ORDER-Tu)/Iu,i=r.mul(e,er),o=r.pow(i,n),s=r.mul(e,o),a=r.mul(r.mul(s,er),o),f=r.mul(s,r.sub(a,r.ONE));return Ds(r,f,e),f}function Ab(t){let e=Nr(t),r=Bu(t),n=r(e,e.neg(e.ONE)),i=r(e,n),o=r(e,e.neg(n)),s=(t+Eb)/Ru;return((a,f)=>{let c=a,u=c.pow(f,s),l=c.mul(u,n),h=c.mul(u,i),d=c.mul(u,o),w=c.eql(c.sqr(l),f),p=c.eql(c.sqr(h),f);u=c.cmov(u,l,w),l=c.cmov(d,h,p);let y=c.eql(c.sqr(l),f),b=c.cmov(u,l,y);return Ds(c,b,f),b})}function Bu(t){if(t<_u)throw new Error("sqrt is not defined for small field");let e=t-te,r=0;for(;e%er===xe;)e/=er,r++;let n=er,i=Nr(t);for(;Eu(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return vu;let o=i.pow(n,e),s=(e+te)/er;return function(f,c){let u=f;if(u.is0(c))return c;if(Eu(u,c)!==1)throw new Error("Cannot find square root");let l=r,h=u.mul(u.ONE,o),d=u.pow(c,e),w=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===l)throw new Error("Cannot find square root");let b=te<<BigInt(l-p-1),E=u.pow(h,b);l=p,h=u.sqr(E),d=u.mul(d,h),w=u.mul(w,E)}return w}}function Tb(t){return t%Au===_u?vu:t%Iu===Tu?_b:t%Ru===Sb?Ab(t):Bu(t)}var wt=(t,e)=>(ne(t,e)&te)===te,Ib=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ls(t){let e={ORDER:"bigint",BYTES:"number",BITS:"number"},r=Ib.reduce((n,i)=>(n[i]="function",n),e);if(Ve(t,r),je(t.BYTES,"BYTES"),je(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=te)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function Rb(t,e,r){let n=t;if(r<xe)throw new Error("invalid exponent, negatives unsupported");if(r===xe)return n.ONE;if(r===te)return e;let i=n.ONE,o=e;for(;r>xe;)r&te&&(i=n.mul(i,o)),o=n.sqr(o),r>>=te;return i}function In(t,e,r=!1){let n=t,i=new Array(e.length).fill(r?n.ZERO:void 0),o=e.reduce((a,f,c)=>n.is0(f)?a:(i[c]=a,n.mul(a,f)),n.ONE),s=n.inv(o);return e.reduceRight((a,f,c)=>n.is0(f)?a:(i[c]=n.mul(a,i[c]),n.mul(a,f)),s),i}function Eu(t,e){let r=t,n=(r.ORDER-te)/er,i=r.pow(e,n),o=r.eql(i,r.ONE),s=r.eql(i,r.ZERO),a=r.eql(i,r.neg(r.ONE));if(!o&&!s&&!a)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function vb(t,e){if(e!==void 0&&vs(e),t<=xe)throw new Error("invalid n length: expected positive n, got "+t);if(e!==void 0&&e<1)throw new Error("invalid n length: expected positive bit length, got "+e);let r=Or(t);if(e!==void 0&&e<r)throw new Error(`invalid n length: expected bit length (${r}) >= n.length (${e})`);let n=e!==void 0?e:r,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}var Su=new WeakMap,Ai=class{ORDER;BITS;BYTES;isLE;ZERO=xe;ONE=te;_lengths;_mod;constructor(e,r={}){if(e<=te)throw new Error("invalid field: expected ORDER > 1, got "+e);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:i,nByteLength:o}=vb(e,n);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=i,this.BYTES=o,Object.freeze(this)}create(e){return ne(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof e);return xe<=e&&e<this.ORDER}is0(e){return e===xe}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&te)===te}neg(e){return ne(-e,this.ORDER)}eql(e,r){return e===r}sqr(e){return ne(e*e,this.ORDER)}add(e,r){return ne(e+r,this.ORDER)}sub(e,r){return ne(e-r,this.ORDER)}mul(e,r){return ne(e*r,this.ORDER)}pow(e,r){return Rb(this,e,r)}div(e,r){return ne(e*xu(r,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,r){return e+r}subN(e,r){return e-r}mulN(e,r){return e*r}inv(e){return xu(e,this.ORDER)}sqrt(e){let r=Su.get(this);return r||Su.set(this,r=Tb(this.ORDER)),r(this,e)}toBytes(e){return this.isLE?Bs(e,this.BYTES):Si(e,this.BYTES)}fromBytes(e,r=!1){j(e);let{_lengths:n,BYTES:i,isLE:o,ORDER:s,_mod:a}=this;if(n){if(e.length<1||!n.includes(e.length)||e.length>i)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let c=new Uint8Array(i);c.set(e,o?0:c.length-e.length),e=c}if(e.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+e.length);let f=o?Je(e):Jt(e);if(a&&(f=ne(f,s)),!r&&!this.isValid(f))throw new Error("invalid field element: outside of range 0..ORDER");return f}invertBatch(e){return In(this,e)}cmov(e,r,n){return Ke(n,"condition"),n?r:e}};Object.freeze(Ai.prototype);function Nr(t,e={}){return new Ai(t,e)}function Cu(t){if(typeof t!="bigint")throw new Error("field order must be bigint");if(t<=te)throw new Error("field order must be greater than 1");let e=Or(t-te);return Math.ceil(e/8)}function Os(t){let e=Cu(t);return e+Math.ceil(e/2)}function Ns(t,e,r=!1){j(t);let n=t.length,i=Cu(e),o=Math.max(Os(e),16);if(n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?Je(t):Jt(t),a=ne(s,e-te)+te;return r?Bs(a,i):Si(a,i)}var Pr=BigInt(0),tr=BigInt(1);function Rn(t,e){let r=e.negate();return t?r:e}function rr(t,e){let r=In(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function Nu(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Ps(t,e){Nu(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,o=Tn(t),s=BigInt(t);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function Du(t,e,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r,a=Number(t&i),f=t>>s;a>n&&(a-=o,f+=tr);let c=e*n,u=c+Math.abs(a)-1,l=a===0,h=a<0,d=e%2!==0;return{nextN:f,offset:u,isZero:l,isNeg:h,isNegF:d,offsetF:c}}var Us=new WeakMap,Pu=new WeakMap;function Fs(t){return Pu.get(t)||1}function Lu(t){if(t!==Pr)throw new Error("invalid wNAF")}var Ur=class{BASE;ZERO;Fn;bits;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>Pr;)r&tr&&(n=n.add(i)),i=i.double(),r>>=tr;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=Ps(r,this.bits),o=[],s=e,a=s;for(let f=0;f<n;f++){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=Ps(e,this.bits);for(let a=0;a<s.windows;a++){let{nextN:f,offset:c,isZero:u,isNeg:l,isNegF:h,offsetF:d}=Du(n,a,s);n=f,u?o=o.add(Rn(h,r[d])):i=i.add(Rn(l,r[c]))}return Lu(n),{p:i,f:o}}wNAFUnsafe(e,r,n,i=this.ZERO){let o=Ps(e,this.bits);for(let s=0;s<o.windows&&n!==Pr;s++){let{nextN:a,offset:f,isZero:c,isNeg:u}=Du(n,s,o);if(n=a,!c){let l=r[f];i=i.add(u?l.negate():l)}}return Lu(n),i}getPrecomputes(e,r,n){let i=Us.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),Us.set(r,i))),i}cached(e,r,n){let i=Fs(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let o=Fs(e);return o===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),r,i)}createCache(e,r){Nu(r,this.bits),Pu.set(e,r),Us.delete(e)}hasCache(e){return Fs(e)!==1}};function Uu(t,e,r,n){let i=e,o=t.ZERO,s=t.ZERO;for(;r>Pr||n>Pr;)r&tr&&(o=o.add(i)),n&tr&&(s=s.add(i)),i=i.double(),r>>=tr,n>>=tr;return{p1:o,p2:s}}function Ou(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Ls(e),e}else return Nr(t,{isLE:r})}function Ti(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 f of["p","n","h"]){let c=e[f];if(!(typeof c=="bigint"&&c>Pr))throw new Error(`CURVE.${f} must be positive bigint`)}let i=Ou(e.p,r.Fp,n),o=Ou(e.n,r.Fn,n),a=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let f of a)if(!i.isValid(e[f]))throw new Error(`CURVE.${f} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:o}}function Ii(t,e){return function(n){let i=t(n);return{secretKey:i,publicKey:e(i)}}}var Ut=BigInt(0),ye=BigInt(1),ks=BigInt(2),Bb=BigInt(8);function Cb(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 Fu(t,e={}){let r=e,n=Ti("edwards",t,r,r.FpFnLE),{Fp:i,Fn:o}=n,s=n.CURVE,{h:a}=s;Ve(r,{},{uvRatio:"function"});let f=ks<<BigInt(o.BYTES*8)-ye,c=p=>i.create(p),u=r.uvRatio===void 0?(p,y)=>{try{return{isValid:!0,value:i.sqrt(i.div(p,y))}}catch{return{isValid:!1,value:Ut}}}:r.uvRatio;if(!Cb(i,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function l(p,y,b=!1){let E=b?ye:Ut;return Lr("coordinate "+p,y,E,f),y}function h(p){if(!(p instanceof d))throw new Error("EdwardsPoint expected")}class d{static BASE=new d(s.Gx,s.Gy,ye,c(s.Gx*s.Gy));static ZERO=new d(Ut,ye,ye,Ut);static Fp=i;static Fn=o;X;Y;Z;T;constructor(y,b,E,A){this.X=l("x",y),this.Y=l("y",b),this.Z=l("z",E,!0),this.T=l("t",A),Object.freeze(this)}static CURVE(){return s}static fromAffine(y){if(y instanceof d)throw new Error("extended point not allowed");let{x:b,y:E}=y||{};return l("x",b),l("y",E),new d(b,E,ye,c(b*E))}static fromBytes(y,b=!1){let E=i.BYTES,{a:A,d:T}=s;y=An(j(y,E,"point")),Ke(b,"zip215");let R=An(y),F=y[E-1];R[E-1]=F&-129;let D=Je(R),B=b?f:i.ORDER;Lr("point.y",D,Ut,B);let P=c(D*D),q=c(P-ye),k=c(T*P-A),{isValid:m,value:x}=u(q,k);if(!m)throw new Error("bad point: invalid y coordinate");let I=(x&ye)===ye,_=(F&128)!==0;if(!b&&x===Ut&&_)throw new Error("bad point: x=0 and x_0=1");return _!==I&&(x=c(-x)),d.fromAffine({x,y:D})}static fromHex(y,b=!1){return d.fromBytes(Dr(y),b)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,b=!0){return w.createCache(this,y),b||this.multiply(ks),this}assertValidity(){let y=this,{a:b,d:E}=s;if(y.is0())throw new Error("bad point: ZERO");let{X:A,Y:T,Z:R,T:F}=y,D=c(A*A),B=c(T*T),P=c(R*R),q=c(P*P),k=c(D*b),m=c(P*c(k+B)),x=c(q+c(E*c(D*B)));if(m!==x)throw new Error("bad point: equation left != right (1)");let I=c(A*T),_=c(R*F);if(I!==_)throw new Error("bad point: equation left != right (2)")}equals(y){h(y);let{X:b,Y:E,Z:A}=this,{X:T,Y:R,Z:F}=y,D=c(b*F),B=c(T*A),P=c(E*F),q=c(R*A);return D===B&&P===q}is0(){return this.equals(d.ZERO)}negate(){return new d(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:y}=s,{X:b,Y:E,Z:A}=this,T=c(b*b),R=c(E*E),F=c(ks*c(A*A)),D=c(y*T),B=b+E,P=c(c(B*B)-T-R),q=D+R,k=q-F,m=D-R,x=c(P*k),I=c(q*m),_=c(P*m),S=c(k*q);return new d(x,I,S,_)}add(y){h(y);let{a:b,d:E}=s,{X:A,Y:T,Z:R,T:F}=this,{X:D,Y:B,Z:P,T:q}=y,k=c(A*D),m=c(T*B),x=c(F*E*q),I=c(R*P),_=c((A+T)*(D+B)-k-m),S=I-x,v=I+x,L=c(m-b*k),C=c(_*S),N=c(v*L),U=c(_*L),K=c(S*v);return new d(C,N,K,U)}subtract(y){return h(y),this.add(y.negate())}multiply(y){if(!o.isValidNot0(y))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:b,f:E}=w.cached(this,y,A=>rr(d,A));return rr(d,[b,E])[0]}multiplyUnsafe(y){if(!o.isValid(y))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return y===Ut?d.ZERO:this.is0()||y===ye?this:w.unsafe(this,y,b=>rr(d,b))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return w.unsafe(this,s.n).is0()}toAffine(y){let b=this,E=y,{X:A,Y:T,Z:R}=b,F=b.is0();E==null&&(E=F?Bb:i.inv(R));let D=c(A*E),B=c(T*E),P=i.mul(R,E);if(F)return{x:Ut,y:ye};if(P!==ye)throw new Error("invZ was invalid");return{x:D,y:B}}clearCofactor(){return a===ye?this:this.multiplyUnsafe(a)}toBytes(){let{x:y,y:b}=this.toAffine(),E=i.toBytes(b);return E[E.length-1]|=y&ye?128:0,E}toHex(){return Cr(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let w=new Ur(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var Ri=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(e){this.ep=e}static fromBytes(e){Cs()}static fromHex(e){Cs()}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 Cr(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.ep.precompute(e,r),this}};function ku(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');let n=e,i=r;Ve(i,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",zip215:"boolean",mapToCurve:"function"});let{prehash:o}=i,{BASE:s,Fp:a,Fn:f}=t,c=n.outputLen,u=2*a.BYTES;if(c!==void 0&&(je(c,"hash.outputLen"),c!==u))throw new Error(`hash.outputLen must be ${u}, got ${c}`);let l=i.randomBytes===void 0?Sn:i.randomBytes,h=i.adjustScalarBytes===void 0?m=>m:i.adjustScalarBytes,d=i.domain===void 0?(m,x,I)=>{if(Ke(I,"phflag"),x.length||I)throw new Error("Contexts/pre-hash are not supported");return m}:i.domain;function w(m){return f.create(Je(m))}function p(m){let x=D.secretKey;j(m,D.secretKey,"secretKey");let I=j(n(m),2*x,"hashedSecretKey"),_=h(I.slice(0,x)),S=I.slice(x,2*x),v=w(_);return{head:_,prefix:S,scalar:v}}function y(m){let{head:x,prefix:I,scalar:_}=p(m),S=s.multiply(_),v=S.toBytes();return{head:x,prefix:I,scalar:_,point:S,pointBytes:v}}function b(m){return y(m).pointBytes}function E(m=Uint8Array.of(),...x){let I=ue(...x);return w(n(d(I,j(m,void 0,"context"),!!o)))}function A(m,x,I={}){m=j(m,void 0,"message"),o&&(m=o(m));let{prefix:_,scalar:S,pointBytes:v}=y(x),L=E(I.context,_,m),C=s.multiply(L).toBytes(),N=E(I.context,C,v,m),U=f.create(L+N*S);if(!f.isValid(U))throw new Error("sign failed: invalid s");let K=ue(C,f.toBytes(U));return j(K,D.signature,"result")}let T={zip215:i.zip215};function R(m,x,I,_=T){let{context:S}=_,v=_.zip215===void 0?!!T.zip215:_.zip215,L=D.signature;m=j(m,L,"signature"),x=j(x,void 0,"message"),I=j(I,D.publicKey,"publicKey"),v!==void 0&&Ke(v,"zip215"),o&&(x=o(x));let C=L/2,N=m.subarray(0,C),U=Je(m.subarray(C,L)),K,W,$;try{K=t.fromBytes(I,v),W=t.fromBytes(N,v),$=s.multiplyUnsafe(U)}catch{return!1}if(!v&&K.isSmallOrder())return!1;let fe=E(S,N,I,x);return W.add(K.multiplyUnsafe(fe)).subtract($).clearCofactor().is0()}let F=a.BYTES,D={secretKey:F,publicKey:F,signature:2*F,seed:F};function B(m){return m=m===void 0?l(D.seed):m,j(m,D.seed,"seed")}function P(m){return Qt(m)&&m.length===D.secretKey}function q(m,x){try{return!!t.fromBytes(m,x===void 0?T.zip215:x)}catch{return!1}}let k={getExtendedPublicKey:y,randomSecretKey:B,isValidSecretKey:P,isValidPublicKey:q,toMontgomery(m){let{y:x}=t.fromBytes(m),I=D.publicKey,_=I===32;if(!_&&I!==57)throw new Error("only defined for 25519 and 448");let S=_?a.div(ye+x,ye-x):a.div(x-ye,x+ye);return a.toBytes(S)},toMontgomerySecret(m){let x=D.secretKey;j(m,x);let I=n(m.subarray(0,x));return h(I).subarray(0,x)}};return Object.freeze(D),Object.freeze(k),Object.freeze({keygen:Ii(B,b),getPublicKey:b,sign:A,verify:R,utils:k,Point:t,lengths:D})}function vn(t,e){if(je(t),je(e),e<0||e>4)throw new Error("invalid I2OSP length: "+e);if(t<0||t>2**(8*e)-1)throw new Error("invalid I2OSP input: "+t);let r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=t&255,t>>>=8;return new Uint8Array(r)}function Db(t,e){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function Lb(t){if(!Qt(t)&&typeof t!="string")throw new Error("DST must be Uint8Array or ascii string");let e=typeof t=="string"?_i(t):t;if(e.length===0)throw new Error("DST must be non-empty");return e}function Ms(t,e,r,n){j(t),je(r),e=Lb(e),e.length>255&&(e=n(ue(_i("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:o}=n,s=Math.ceil(r/i);if(r>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=ue(e,vn(e.length,1)),f=new Uint8Array(o),c=vn(r,2),u=new Array(s),l=n(ue(f,t,c,vn(0,1),a));u[0]=n(ue(l,vn(1,1),a));for(let d=1;d<s;d++){let w=[Db(l,u[d-1]),vn(d+1,1),a];u[d]=n(ue(...w))}return ue(...u).slice(0,r)}var Mu="HashToScalar-";var Ob=BigInt(0),gt=BigInt(1),qu=BigInt(2);var Nb=BigInt(5),Pb=BigInt(8),Fr=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Ks={p:Fr,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Pb,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=Fr,a=t*t%o*t%o,f=Y(a,qu,o)*a%o,c=Y(f,gt,o)*t%o,u=Y(c,Nb,o)*c%o,l=Y(u,e,o)*u%o,h=Y(l,r,o)*l%o,d=Y(h,n,o)*h%o,w=Y(d,i,o)*d%o,p=Y(w,i,o)*d%o,y=Y(p,e,o)*u%o;return{pow_p_5_8:Y(y,qu,o)*t%o,b2:a}}function Fb(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var qs=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function js(t,e){let r=Fr,n=ne(e*e*e,r),i=ne(n*n*e,r),o=Ub(t*i).pow_p_5_8,s=ne(t*n*o,r),a=ne(e*s*s,r),f=s,c=ne(s*qs,r),u=a===t,l=a===ne(-t,r),h=a===ne(-t*qs,r);return u&&(s=f),(l||h)&&(s=c),wt(s,r)&&(s=ne(-s,r)),{isValid:u||l,value:s}}var kt=Fu(Ks,{uvRatio:js}),Ft=kt.Fp,Ku=kt.Fn;function kb(t){return ku(kt,wi,Object.assign({adjustScalarBytes:Fb,zip215:!0},t))}var ju=kb({});var $s=qs,Mb=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),qb=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),$b=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Hb=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),$u=t=>js(gt,t),Kb=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Hs=t=>Ft.create(Je(t)&Kb);function Hu(t){let{d:e}=Ks,r=Fr,n=b=>Ft.create(b),i=n($s*t*t),o=n((i+gt)*$b),s=BigInt(-1),a=n((s-e*i)*n(i+e)),{isValid:f,value:c}=js(o,a),u=n(c*t);wt(u,r)||(u=n(-u)),f||(c=u),f||(s=i);let l=n(s*(i-gt)*Hb-a),h=c*c,d=n((c+c)*a),w=n(l*Mb),p=n(gt-h),y=n(gt+h);return new kt(n(d*y),n(p*w),n(w*y),n(d*p))}var Mt=class t extends Ri{static BASE=new t(kt.BASE);static ZERO=new t(kt.ZERO);static Fp=Ft;static Fn=Ku;constructor(e){super(e)}static fromAffine(e){return new t(kt.fromAffine(e))}assertSame(e){if(!(e instanceof t))throw new Error("RistrettoPoint expected")}init(e){return new t(e)}static fromBytes(e){Ue(e,32);let{a:r,d:n}=Ks,i=Fr,o=T=>Ft.create(T),s=Hs(e);if(!wu(Ft.toBytes(s),e)||wt(s,i))throw new Error("invalid ristretto255 encoding 1");let a=o(s*s),f=o(gt+r*a),c=o(gt-r*a),u=o(f*f),l=o(c*c),h=o(r*n*u-l),{isValid:d,value:w}=$u(o(h*l)),p=o(w*c),y=o(w*p*h),b=o((s+s)*p);wt(b,i)&&(b=o(-b));let E=o(f*y),A=o(b*E);if(!d||wt(A,i)||E===Ob)throw new Error("invalid ristretto255 encoding 2");return new t(new kt(b,E,gt,A))}static fromHex(e){return t.fromBytes(wn(e))}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,o=Fr,s=y=>Ft.create(y),a=s(s(n+r)*s(n-r)),f=s(e*r),c=s(f*f),{value:u}=$u(s(a*c)),l=s(u*a),h=s(u*f),d=s(l*h*i),w;if(wt(i*d,o)){let y=s(r*$s),b=s(e*$s);e=y,r=b,w=s(l*qb)}else w=h;wt(e*d,o)&&(r=s(-r));let p=s((n-r)*w);return wt(p,o)&&(p=s(-p)),Ft.toBytes(p)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:o}=e.ep,s=c=>Ft.create(c),a=s(r*o)===s(n*i),f=s(n*o)===s(r*i);return a||f}is0(){return this.equals(t.ZERO)}};Object.freeze(Mt.BASE);Object.freeze(Mt.ZERO);Object.freeze(Mt.prototype);Object.freeze(Mt);var jb=Object.freeze({Point:Mt,hashToCurve(t,e){let r=e?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":e.DST,n=Ms(t,r,64,wi);return jb.deriveToCurve(n)},hashToScalar(t,e={DST:Mu}){let r=Ms(t,e.DST,64,wi);return Ku.create(Je(r))},deriveToCurve(t){Ue(t,64);let e=Hs(t.subarray(0,32)),r=Hu(e),n=Hs(t.subarray(32,64)),i=Hu(n);return new Mt(r.add(i))}});var Bn=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}},vi=class extends Error{constructor(e="Missing Web Crypto API"){super(e),this.name="WebCryptoMissingError"}};var Vu={get(t=globalThis){let e=t.crypto;if(e?.subtle==null)throw new vi("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 Bi=Vu;var Ci=32;var Vs,Vb=(async()=>{try{return await Bi.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})();async function Wb(t,e,r){if(t.buffer instanceof ArrayBuffer){let n=await Bi.get().subtle.importKey("raw",t.buffer,{name:"Ed25519"},!1,["verify"]);return await Bi.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 zb(t,e,r){return ju.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}async function Wu(t,e,r){return Vs==null&&(Vs=await Vb),Vs?Wb(t,e,r):zb(t,e,r)}function Di(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}var Li=class{type="Ed25519";raw;constructor(e){this.raw=Ws(e,Ci)}toMultihash(){return $e.digest(vr(this))}toCID(){return we.createV1(114,this.toMultihash())}toString(){return se.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Pe(this.raw,e.raw)}verify(e,r,n){n?.signal?.throwIfAborted();let i=Wu(this.raw,r,e);return Di(i)?i.then(o=>(n?.signal?.throwIfAborted(),o)):i}};function Gu(t){return t=Ws(t,Ci),new Li(t)}function Ws(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new Re(`Key must be a Uint8Array of length ${e}, got ${t.length}`);return t}var Yb=Math.pow(2,7),Zb=Math.pow(2,14),Xb=Math.pow(2,21),zs=Math.pow(2,28),Gs=Math.pow(2,35),Ys=Math.pow(2,42),Zs=Math.pow(2,49),Q=128,_e=127;function et(t){if(t<Yb)return 1;if(t<Zb)return 2;if(t<Xb)return 3;if(t<zs)return 4;if(t<Gs)return 5;if(t<Ys)return 6;if(t<Zs)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Cn(t,e,r=0){switch(et(t)){case 8:e[r++]=t&255|Q,t/=128;case 7:e[r++]=t&255|Q,t/=128;case 6:e[r++]=t&255|Q,t/=128;case 5:e[r++]=t&255|Q,t/=128;case 4:e[r++]=t&255|Q,t>>>=7;case 3:e[r++]=t&255|Q,t>>>=7;case 2:e[r++]=t&255|Q,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function Xs(t,e){let r=t[e],n=0;if(n+=r&_e,r<Q||(r=t[e+1],n+=(r&_e)<<7,r<Q)||(r=t[e+2],n+=(r&_e)<<14,r<Q)||(r=t[e+3],n+=(r&_e)<<21,r<Q)||(r=t[e+4],n+=(r&_e)*zs,r<Q)||(r=t[e+5],n+=(r&_e)*Gs,r<Q)||(r=t[e+6],n+=(r&_e)*Ys,r<Q)||(r=t[e+7],n+=(r&_e)*Zs,r<Q))return n;throw new RangeError("Could not decode varint")}function Qb(t,e){let r=t.get(e),n=0;if(n+=r&_e,r<Q||(r=t.get(e+1),n+=(r&_e)<<7,r<Q)||(r=t.get(e+2),n+=(r&_e)<<14,r<Q)||(r=t.get(e+3),n+=(r&_e)<<21,r<Q)||(r=t.get(e+4),n+=(r&_e)*zs,r<Q)||(r=t.get(e+5),n+=(r&_e)*Gs,r<Q)||(r=t.get(e+6),n+=(r&_e)*Ys,r<Q)||(r=t.get(e+7),n+=(r&_e)*Zs,r<Q))return n;throw new RangeError("Could not decode varint")}function Qs(t,e=0){return t instanceof Uint8Array?Xs(t,e):Qb(t,e)}var Js=new Float32Array([-0]),qt=new Uint8Array(Js.buffer);function Yu(t,e,r){Js[0]=t,e[r]=qt[0],e[r+1]=qt[1],e[r+2]=qt[2],e[r+3]=qt[3]}function Zu(t,e){return qt[0]=t[e],qt[1]=t[e+1],qt[2]=t[e+2],qt[3]=t[e+3],Js[0]}var ea=new Float64Array([-0]),Ae=new Uint8Array(ea.buffer);function Xu(t,e,r){ea[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 Qu(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],ea[0]}var em=BigInt(Number.MAX_SAFE_INTEGER),tm=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 nr;if(e<em&&e>tm)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>Ju&&(i=0n,++n>Ju&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return nr;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):nr}},nr=new Fe(0,0);nr.toBigInt=function(){return 0n};nr.zzEncode=nr.zzDecode=function(){return this};nr.length=function(){return 1};var Ju=4294967296n;function el(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 tl(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 ta(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 We(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function Oi(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var ra=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,We(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 We(this,4);return Oi(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw We(this,4);return Oi(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw We(this,4);let e=Zu(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw We(this,4);let e=Qu(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 We(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return tl(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw We(this,e);this.pos+=e}else do if(this.pos>=this.len)throw We(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 We(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 We(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 We(this,8);let e=Oi(this.buf,this.pos+=4),r=Oi(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=Xs(this.buf,this.pos);return this.pos+=et(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 Dn(t){return new ra(t instanceof Uint8Array?t:t.subarray())}function Ni(t,e,r){let n=Dn(t);return e.decode(n,void 0,r)}function na(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Ne(s);i+s>e&&(n=Ne(e),i=0);let a=n.subarray(i,i+=s);return(i&7)!==0&&(i=(i|7)+1),a}}var ir=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function ia(){}var sa=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},rm=na();function nm(t){return globalThis.Buffer!=null?Ne(t):rm(t)}var On=class{len;head;tail;states;constructor(){this.len=0,this.head=new ir(ia,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new ir(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new aa((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(Pi,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(Pi,r.length(),r)}uint64Number(e){return this._push(Cn,et(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(Pi,r.length(),r)}sint64Number(e){let r=Fe.fromNumber(e).zzEncode();return this._push(Pi,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(oa,1,e?1:0)}fixed32(e){return this._push(Ln,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Fe.fromBigInt(e);return this._push(Ln,4,r.lo)._push(Ln,4,r.hi)}fixed64Number(e){let r=Fe.fromNumber(e);return this._push(Ln,4,r.lo)._push(Ln,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(Yu,4,e)}double(e){return this._push(Xu,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(oa,1,0):this.uint32(r)._push(om,r,e)}string(e){let r=el(e);return r!==0?this.uint32(r)._push(ta,r,e):this._push(oa,1,0)}fork(){return this.states=new sa(this),this.head=this.tail=new ir(ia,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 ir(ia,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=nm(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function oa(t,e,r){e[r]=t&255}function im(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var aa=class extends ir{next;constructor(e,r){super(im,e,r),this.next=void 0}};function Pi(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 Ln(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 om(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(On.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(sm,e,t),this},On.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(am,e,t),this});function sm(t,e,r){e.set(t,r)}function am(t,e,r){t.length<40?ta(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set(ae(t),r)}function ca(){return new On}function Ui(t,e){let r=ca();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}function*Fi(t,e,r){let n=Dn(t);yield*e.stream(n,void 0,"$",r)}var ki={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function Mi(t,e,r,n,i){return{name:t,type:e,encode:r,decode:n,stream:i}}function fa(t){function e(o){if(t[o.toString()]==null)throw new Error("Invalid enum value");return t[o]}let r=function(s,a){let f=e(s);a.int32(f)},n=function(s){let a=s.int32();return e(a)},i=function*(s){let a=s.int32();yield e(a)};return Mi("enum",ki.VARINT,r,n,i)}function qi(t,e,r){return Mi("message",ki.LENGTH_DELIMITED,t,e,r)}var Be;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.ECDSA="ECDSA"})(Be||(Be={}));var ua;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.secp256k1=2]="secp256k1",t[t.ECDSA=3]="ECDSA"})(ua||(ua={}));(function(t){t.codec=()=>fa(ua)})(Be||(Be={}));var Nn;(function(t){let e;t.codec=()=>(e==null&&(e=qi((o,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),o.Type!=null&&(s.uint32(8),Be.codec().encode(o.Type,s)),o.Data!=null&&(s.uint32(18),s.bytes(o.Data)),a.lengthDelimited!==!1&&s.ldelim()},(o,s,a={})=>{let f={},c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{f.Type=Be.codec().decode(o);break}case 2:{f.Data=o.bytes();break}default:{o.skipType(u&7);break}}}return f},function*(o,s,a,f={}){let c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{yield{field:`${a}.Type`,value:Be.codec().decode(o)};break}case 2:{yield{field:`${a}.Data`,value:o.bytes()};break}default:{o.skipType(u&7);break}}}})),e);function r(o){return Ui(o,t.codec())}t.encode=r;function n(o,s){return Ni(o,t.codec(),s)}t.decode=n;function i(o,s){return Fi(o,t.codec(),s)}t.stream=i})(Nn||(Nn={}));var la;(function(t){let e;t.codec=()=>(e==null&&(e=qi((o,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),o.Type!=null&&(s.uint32(8),Be.codec().encode(o.Type,s)),o.Data!=null&&(s.uint32(18),s.bytes(o.Data)),a.lengthDelimited!==!1&&s.ldelim()},(o,s,a={})=>{let f={},c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{f.Type=Be.codec().decode(o);break}case 2:{f.Data=o.bytes();break}default:{o.skipType(u&7);break}}}return f},function*(o,s,a,f={}){let c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{yield{field:`${a}.Type`,value:Be.codec().decode(o)};break}case 2:{yield{field:`${a}.Data`,value:o.bytes()};break}default:{o.skipType(u&7);break}}}})),e);function r(o){return Ui(o,t.codec())}t.encode=r;function n(o,s){return Ni(o,t.codec(),s)}t.decode=n;function i(o,s){return Fi(o,t.codec(),s)}t.stream=i})(la||(la={}));var $i=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,r){if(hi(e),Ue(r,void 0,"key"),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 n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),bt(i)}update(e){return Br(this),this.iHash.update(e),this}digestInto(e){Br(this),pi(e,this),this.finished=!0;let r=e.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(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()}},nl=(()=>{let t=((e,r,n)=>new $i(e,r).update(n).digest());return t.create=(e,r)=>new $i(e,r),t})();var il=(t,e)=>(t+(t>=0?e:-e)/ol)/e;function fm(t,e,r){Lr("scalar",t,tt,r);let[[n,i],[o,s]]=e,a=il(s*t,r),f=il(-i*t,r),c=t-a*n-f*o,u=-a*i-f*s,l=c<tt,h=u<tt;l&&(c=-c),h&&(u=-u);let d=Tn(Math.ceil(Or(r)/2))+$t;if(c<tt||c>=d||u<tt||u>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:l,k1:c,k2neg:h,k2:u}}function ha(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function da(t,e){Ve(t);let r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return Ke(r.lowS,"lowS"),Ke(r.prehash,"prehash"),r.format!==void 0&&ha(r.format),r}var pa=class extends Error{constructor(e=""){super(e)}},ze={Err:pa,_tlv:{encode:(t,e)=>{let{Err:r}=ze;if(je(t,"tag"),t<0||t>255)throw new r("tlv.encode: wrong tag");if(typeof e!="string")throw new TypeError('"data" expected string, got type='+typeof e);if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=_n(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?_n(i.length/2|128):"";return _n(t)+o+i+e},decode(t,e){let{Err:r}=ze;e=j(e,void 0,"DER data");let n=0;if(t<0||t>255)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 f=i&127;if(!f)throw new r("tlv.decode(long): indefinite length not supported");if(f>4)throw new r("tlv.decode(long): byte length is too big");let c=e.subarray(n,n+f);if(c.length!==f)throw new r("tlv.decode: length bytes not complete");if(c[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let u of c)s=s<<8|u;if(n+=f,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}=ze;if(Ei(t),t<tt)throw new e("integer: negative integers are not allowed");let r=_n(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}=ze;if(t.length<1)throw new e("invalid signature integer: empty");if(t[0]&128)throw new e("invalid signature integer: negative");if(t.length>1&&t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return Jt(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=ze,i=j(t,void 0,"signature"),{v:o,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:f}=n.decode(2,o),{v:c,l:u}=n.decode(2,f);if(u.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}=ze,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),o=n+i;return e.encode(48,o)}};Object.freeze(ze._tlv);Object.freeze(ze._int);Object.freeze(ze);var tt=BigInt(0),$t=BigInt(1),ol=BigInt(2),Hi=BigInt(3),um=BigInt(4);function sl(t,e={}){let r=Ti("weierstrass",t,e),n=r.Fp,i=r.Fn,o=r.CURVE,{h:s,n:a}=o;Ve(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:f,allowInfinityPoint:c}=e;if(f&&(!n.is0(o.a)||typeof f.beta!="bigint"||!Array.isArray(f.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let u=cl(n,i);function l(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function h(k,m,x){if(c&&m.is0())return Uint8Array.of(0);let{x:I,y:_}=m.toAffine(),S=n.toBytes(I);if(Ke(x,"isCompressed"),x){l();let v=!n.isOdd(_);return ue(al(v),S)}else return ue(Uint8Array.of(4),S,n.toBytes(_))}function d(k){j(k,void 0,"Point");let{publicKey:m,publicKeyUncompressed:x}=u,I=k.length,_=k[0],S=k.subarray(1);if(c&&I===1&&_===0)return{x:n.ZERO,y:n.ZERO};if(I===m&&(_===2||_===3)){let v=n.fromBytes(S);if(!n.isValid(v))throw new Error("bad point: is not on curve, wrong x");let L=y(v),C;try{C=n.sqrt(L)}catch(K){let W=K instanceof Error?": "+K.message:"";throw new Error("bad point: is not on curve, sqrt error"+W)}l();let N=n.isOdd(C);return(_&1)===1!==N&&(C=n.neg(C)),{x:v,y:C}}else if(I===x&&_===4){let v=n.BYTES,L=n.fromBytes(S.subarray(0,v)),C=n.fromBytes(S.subarray(v,v*2));if(!b(L,C))throw new Error("bad point: is not on curve");return{x:L,y:C}}else throw new Error(`bad point: got length ${I}, expected compressed=${m} or uncompressed=${x}`)}let w=e.toBytes===void 0?h:e.toBytes,p=e.fromBytes===void 0?d:e.fromBytes;function y(k){let m=n.sqr(k),x=n.mul(m,k);return n.add(n.add(x,n.mul(k,o.a)),o.b)}function b(k,m){let x=n.sqr(m),I=y(k);return n.eql(x,I)}if(!b(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let E=n.mul(n.pow(o.a,Hi),um),A=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(E,A)))throw new Error("bad curve params: a or b");function T(k,m,x=!1){if(!n.isValid(m)||x&&n.is0(m))throw new Error(`bad point coordinate ${k}`);return m}function R(k){if(!(k instanceof B))throw new Error("Weierstrass Point expected")}function F(k){if(!f||!f.basises)throw new Error("no endo");return fm(k,f.basises,i.ORDER)}function D(k,m,x,I,_){return x=new B(n.mul(x.X,k),x.Y,x.Z),m=Rn(I,m),x=Rn(_,x),m.add(x)}class B{static BASE=new B(o.Gx,o.Gy,n.ONE);static ZERO=new B(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(m,x,I){this.X=T("x",m),this.Y=T("y",x,!0),this.Z=T("z",I),Object.freeze(this)}static CURVE(){return o}static fromAffine(m){let{x,y:I}=m||{};if(!m||!n.isValid(x)||!n.isValid(I))throw new Error("invalid affine point");if(m instanceof B)throw new Error("projective point not allowed");return n.is0(x)&&n.is0(I)?B.ZERO:new B(x,I,n.ONE)}static fromBytes(m){let x=B.fromAffine(p(j(m,void 0,"point")));return x.assertValidity(),x}static fromHex(m){return B.fromBytes(Dr(m))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(m=8,x=!0){return q.createCache(this,m),x||this.multiply(Hi),this}assertValidity(){let m=this;if(m.is0()){if(e.allowInfinityPoint&&n.is0(m.X)&&n.eql(m.Y,n.ONE)&&n.is0(m.Z))return;throw new Error("bad point: ZERO")}let{x,y:I}=m.toAffine();if(!n.isValid(x)||!n.isValid(I))throw new Error("bad point: x or y not field elements");if(!b(x,I))throw new Error("bad point: equation left != right");if(!m.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:m}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(m)}equals(m){R(m);let{X:x,Y:I,Z:_}=this,{X:S,Y:v,Z:L}=m,C=n.eql(n.mul(x,L),n.mul(S,_)),N=n.eql(n.mul(I,L),n.mul(v,_));return C&&N}negate(){return new B(this.X,n.neg(this.Y),this.Z)}double(){let{a:m,b:x}=o,I=n.mul(x,Hi),{X:_,Y:S,Z:v}=this,L=n.ZERO,C=n.ZERO,N=n.ZERO,U=n.mul(_,_),K=n.mul(S,S),W=n.mul(v,v),$=n.mul(_,S);return $=n.add($,$),N=n.mul(_,v),N=n.add(N,N),L=n.mul(m,N),C=n.mul(I,W),C=n.add(L,C),L=n.sub(K,C),C=n.add(K,C),C=n.mul(L,C),L=n.mul($,L),N=n.mul(I,N),W=n.mul(m,W),$=n.sub(U,W),$=n.mul(m,$),$=n.add($,N),N=n.add(U,U),U=n.add(N,U),U=n.add(U,W),U=n.mul(U,$),C=n.add(C,U),W=n.mul(S,v),W=n.add(W,W),U=n.mul(W,$),L=n.sub(L,U),N=n.mul(W,K),N=n.add(N,N),N=n.add(N,N),new B(L,C,N)}add(m){R(m);let{X:x,Y:I,Z:_}=this,{X:S,Y:v,Z:L}=m,C=n.ZERO,N=n.ZERO,U=n.ZERO,K=o.a,W=n.mul(o.b,Hi),$=n.mul(x,S),fe=n.mul(I,v),he=n.mul(_,L),pe=n.add(x,I),re=n.add(S,v);pe=n.mul(pe,re),re=n.add($,fe),pe=n.sub(pe,re),re=n.add(x,_);let De=n.add(S,L);return re=n.mul(re,De),De=n.add($,he),re=n.sub(re,De),De=n.add(I,_),C=n.add(v,L),De=n.mul(De,C),C=n.add(fe,he),De=n.sub(De,C),U=n.mul(K,re),C=n.mul(W,he),U=n.add(C,U),C=n.sub(fe,U),U=n.add(fe,U),N=n.mul(C,U),fe=n.add($,$),fe=n.add(fe,$),he=n.mul(K,he),re=n.mul(W,re),fe=n.add(fe,he),he=n.sub($,he),he=n.mul(K,he),re=n.add(re,he),$=n.mul(fe,re),N=n.add(N,$),$=n.mul(De,re),C=n.mul(pe,C),C=n.sub(C,$),$=n.mul(pe,fe),U=n.mul(De,U),U=n.add(U,$),new B(C,N,U)}subtract(m){return R(m),this.add(m.negate())}is0(){return this.equals(B.ZERO)}multiply(m){let{endo:x}=e;if(!i.isValidNot0(m))throw new RangeError("invalid scalar: out of range");let I,_,S=v=>q.cached(this,v,L=>rr(B,L));if(x){let{k1neg:v,k1:L,k2neg:C,k2:N}=F(m),{p:U,f:K}=S(L),{p:W,f:$}=S(N);_=K.add($),I=D(x.beta,U,W,v,C)}else{let{p:v,f:L}=S(m);I=v,_=L}return rr(B,[I,_])[0]}multiplyUnsafe(m){let{endo:x}=e,I=this,_=m;if(!i.isValid(_))throw new RangeError("invalid scalar: out of range");if(_===tt||I.is0())return B.ZERO;if(_===$t)return I;if(q.hasCache(this))return this.multiply(_);if(x){let{k1neg:S,k1:v,k2neg:L,k2:C}=F(_),{p1:N,p2:U}=Uu(B,I,v,C);return D(x.beta,N,U,S,L)}else return q.unsafe(I,_)}toAffine(m){let x=this,I=m,{X:_,Y:S,Z:v}=x;if(n.eql(v,n.ONE))return{x:_,y:S};let L=x.is0();I==null&&(I=L?n.ONE:n.inv(v));let C=n.mul(_,I),N=n.mul(S,I),U=n.mul(v,I);if(L)return{x:n.ZERO,y:n.ZERO};if(!n.eql(U,n.ONE))throw new Error("invZ was invalid");return{x:C,y:N}}isTorsionFree(){let{isTorsionFree:m}=e;return s===$t?!0:m?m(B,this):q.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:m}=e;return s===$t?this:m?m(B,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===$t?this.is0():this.clearCofactor().is0()}toBytes(m=!0){return Ke(m,"isCompressed"),this.assertValidity(),w(B,this,m)}toHex(m=!0){return Cr(this.toBytes(m))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let P=i.BITS,q=new Ur(B,e.endo?Math.ceil(P/2):P);return P>=8&&B.BASE.precompute(8),Object.freeze(B.prototype),Object.freeze(B),B}function al(t){return Uint8Array.of(t?2:3)}function cl(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function lm(t,e={}){let{Fn:r}=t,n=e.randomBytes===void 0?Sn:e.randomBytes,i=Object.assign(cl(t.Fp,r),{seed:Math.max(Os(r.ORDER),16)});function o(d){try{let w=r.fromBytes(d);return r.isValidNot0(w)}catch{return!1}}function s(d,w){let{publicKey:p,publicKeyUncompressed:y}=i;try{let b=d.length;return w===!0&&b!==p||w===!1&&b!==y?!1:!!t.fromBytes(d)}catch{return!1}}function a(d){return d=d===void 0?n(i.seed):d,Ns(j(d,i.seed,"seed"),r.ORDER)}function f(d,w=!0){return t.BASE.multiply(r.fromBytes(d)).toBytes(w)}function c(d){let{secretKey:w,publicKey:p,publicKeyUncompressed:y}=i,b=r._lengths;if(!Qt(d))return;let E=j(d,void 0,"key").length,A=E===p||E===y,T=E===w||!!b?.includes(E);if(!(A&&T))return A}function u(d,w,p=!0){if(c(d)===!0)throw new Error("first arg must be private key");if(c(w)===!1)throw new Error("second arg must be public key");let y=r.fromBytes(d);return t.fromBytes(w).multiply(y).toBytes(p)}let l={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a},h=Ii(a,f);return Object.freeze(l),Object.freeze(i),Object.freeze({getPublicKey:f,getSharedSecret:u,keygen:h,Point:t,utils:l,lengths:i})}function fl(t,e,r={}){let n=e;hi(n),Ve(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let i=r.randomBytes===void 0?Sn:r.randomBytes,o=r.hmac===void 0?(_,S)=>nl(n,_,S):r.hmac,{Fp:s,Fn:a}=t,{ORDER:f,BITS:c}=a,{keygen:u,getPublicKey:l,getSharedSecret:h,utils:d,lengths:w}=lm(t,r),p={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},y=f*ol+$t<s.ORDER;function b(_){let S=f>>$t;return _>S}function E(_,S){if(!a.isValidNot0(S))throw new Error(`invalid signature ${_}: out of range 1..Point.Fn.ORDER`);return S}function A(){if(y)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function T(_,S){ha(S);let v=w.signature,L=S==="compact"?v:S==="recovered"?v+1:void 0;return j(_,L)}class R{r;s;recovery;constructor(S,v,L){if(this.r=E("r",S),this.s=E("s",v),L!=null){if(A(),![0,1,2,3].includes(L))throw new Error("invalid recovery id");this.recovery=L}Object.freeze(this)}static fromBytes(S,v=p.format){T(S,v);let L;if(v==="der"){let{r:K,s:W}=ze.toSig(j(S));return new R(K,W)}v==="recovered"&&(L=S[0],v="compact",S=S.subarray(1));let C=w.signature/2,N=S.subarray(0,C),U=S.subarray(C,C*2);return new R(a.fromBytes(N),a.fromBytes(U),L)}static fromHex(S,v){return this.fromBytes(Dr(S),v)}assertRecovery(){let{recovery:S}=this;if(S==null)throw new Error("invalid recovery id: must be present");return S}addRecoveryBit(S){return new R(this.r,this.s,S)}recoverPublicKey(S){let{r:v,s:L}=this,C=this.assertRecovery(),N=C===2||C===3?v+f:v;if(!s.isValid(N))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let U=s.toBytes(N),K=t.fromBytes(ue(al((C&1)===0),U)),W=a.inv(N),$=D(j(S,void 0,"msgHash")),fe=a.create(-$*W),he=a.create(L*W),pe=t.BASE.multiplyUnsafe(fe).add(K.multiplyUnsafe(he));if(pe.is0())throw new Error("invalid recovery: point at infinify");return pe.assertValidity(),pe}hasHighS(){return b(this.s)}toBytes(S=p.format){if(ha(S),S==="der")return Dr(ze.hexFromSig(this));let{r:v,s:L}=this,C=a.toBytes(v),N=a.toBytes(L);return S==="recovered"?(A(),ue(Uint8Array.of(this.assertRecovery()),C,N)):ue(C,N)}toHex(S){return Cr(this.toBytes(S))}}Object.freeze(R.prototype),Object.freeze(R);let F=r.bits2int===void 0?function(S){if(S.length>8192)throw new Error("input is too large");let v=Jt(S),L=S.length*8-c;return L>0?v>>BigInt(L):v}:r.bits2int,D=r.bits2int_modN===void 0?function(S){return a.create(F(S))}:r.bits2int_modN,B=Tn(c);function P(_){return Lr("num < 2^"+c,_,tt,B),a.toBytes(_)}function q(_,S){return j(_,void 0,"message"),S?j(n(_),void 0,"prehashed message"):_}function k(_,S,v){let{lowS:L,prehash:C,extraEntropy:N}=da(v,p);_=q(_,C);let U=D(_),K=a.fromBytes(S);if(!a.isValidNot0(K))throw new Error("invalid private key");let W=[P(K),P(U)];if(N!=null&&N!==!1){let pe=N===!0?i(w.secretKey):N;W.push(j(pe,void 0,"extraEntropy"))}let $=ue(...W),fe=U;function he(pe){let re=F(pe);if(!a.isValidNot0(re))return;let De=a.inv(re),xr=t.BASE.multiply(re).toAffine(),sn=a.create(xr.x);if(sn===tt)return;let ti=a.create(De*a.create(fe+sn*K));if(ti===tt)return;let wf=(xr.x===sn?0:2)|Number(xr.y&$t),gf=ti;return L&&b(ti)&&(gf=a.neg(ti),wf^=1),new R(sn,gf,y?void 0:wf)}return{seed:$,k2sig:he}}function m(_,S,v={}){let{seed:L,k2sig:C}=k(_,S,v);return gu(n.outputLen,a.BYTES,o)(L,C).toBytes(v.format)}function x(_,S,v,L={}){let{lowS:C,prehash:N,format:U}=da(L,p);if(v=j(v,void 0,"publicKey"),S=q(S,N),!Qt(_)){let K=_ instanceof R?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+K)}T(_,U);try{let K=R.fromBytes(_,U),W=t.fromBytes(v);if(C&&K.hasHighS())return!1;let{r:$,s:fe}=K,he=D(S),pe=a.inv(fe),re=a.create(he*pe),De=a.create($*pe),xr=t.BASE.multiplyUnsafe(re).add(W.multiplyUnsafe(De));return xr.is0()?!1:a.create(xr.x)===$}catch{return!1}}function I(_,S,v={}){let{prehash:L}=da(v,p);return S=q(S,L),R.fromBytes(_,"recovered").recoverPublicKey(S).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:h,utils:d,lengths:w,Point:t,sign:m,verify:x,recoverPublicKey:I,Signature:R,hash:n})}var ba={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},dm={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var ul=BigInt(2);function hm(t){let e=ba.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),c=t*t*t%e,u=c*c*t%e,l=Y(u,r,e)*u%e,h=Y(l,r,e)*u%e,d=Y(h,ul,e)*c%e,w=Y(d,i,e)*d%e,p=Y(w,o,e)*w%e,y=Y(p,a,e)*p%e,b=Y(y,f,e)*y%e,E=Y(b,a,e)*p%e,A=Y(E,r,e)*u%e,T=Y(A,s,e)*w%e,R=Y(T,n,e)*c%e,F=Y(R,ul,e);if(!ya.eql(ya.sqr(F),t))throw new Error("Cannot find square root");return F}var ya=Nr(ba.p,{sqrt:hm}),pm=sl(ba,{Fp:ya,endo:dm}),kr=fl(pm,bu);function ll(t,e,r,n){let i=ln.digest(r instanceof Uint8Array?r:r.subarray());if(Di(i))return i.then(({digest:o})=>(n?.signal?.throwIfAborted(),kr.verify(e,o,t,{prehash:!1,format:"der"}))).catch(o=>{throw o.name==="AbortError"?o:new Bn(String(o))});try{return n?.signal?.throwIfAborted(),kr.verify(e,i.digest,t,{prehash:!1,format:"der"})}catch(o){throw new Bn(String(o))}}var Ki=class{type="secp256k1";raw;_key;constructor(e){this._key=hl(e),this.raw=dl(this._key)}toMultihash(){return $e.digest(vr(this))}toCID(){return we.createV1(114,this.toMultihash())}toString(){return se.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Pe(this.raw,e.raw)}verify(e,r,n){return ll(this._key,r,e,n)}};function pl(t){return new Ki(t)}function dl(t){return kr.Point.fromBytes(t).toBytes()}function hl(t){try{return kr.Point.fromBytes(t),t}catch(e){throw new ai(String(e))}}function yl(t){let{Type:e,Data:r}=Nn.decode(t.digest),n=r??new Uint8Array;switch(e){case Be.Ed25519:return Gu(n);case Be.secp256k1:return pl(n);case Be.ECDSA:return Jf(n);default:throw new yn}}function vr(t){return Nn.encode({Type:Be[t.type],Data:t.raw})}var bl=Symbol.for("nodejs.util.inspect.custom"),ym=114,Pn=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()})`}[ui]=!0;toString(){return this.string==null&&(this.string=se.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return we.createV1(ym,this.multihash)}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return Pe(this.multihash.bytes,e);if(typeof e=="string")return this.toString()===e;if(e?.toMultihash()?.bytes!=null)return Pe(this.multihash.bytes,e.toMultihash().bytes);throw new Error("not valid Id")}[bl](){return`PeerId(${this.toString()})`}},ji=class extends Pn{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Vi=class extends Pn{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.publicKey}},Wi=class extends Pn{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.publicKey}},bm=2336,Un=class{type="url";multihash;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=$e.digest(ae(this.url))}[bl](){return`PeerId(${this.url})`}[ui]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return we.createV1(bm,this.toMultihash())}toJSON(){return this.toString()}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=X(e)),e.toString()===this.toString())}};var mm=114,ml=2336;function wl(t,e){let r;if(t.charAt(0)==="1"||t.charAt(0)==="Q")r=fn(se.decode(`z${t}`));else{if(t.startsWith("k51qzi5uqu5")||t.startsWith("kzwfwjn5ji4")||t.startsWith("k2k4r8")||t.startsWith("bafz"))return wm(we.parse(t));if(e==null)throw new Re('Please pass a multibase decoder for strings that do not start with "1" or "Q"');r=fn(e.decode(t))}return gl(r)}function gl(t){if(xm(t))return new ji({multihash:t});if(gm(t))try{let e=yl(t);if(e.type==="Ed25519")return new Vi({multihash:t,publicKey:e});if(e.type==="secp256k1")return new Wi({multihash:t,publicKey:e})}catch{let r=X(t.digest);return new Un(new URL(r))}throw new fi("Supplied PeerID Multihash is invalid")}function wm(t){if(t?.multihash==null||t.version==null||t.version===1&&t.code!==mm&&t.code!==ml)throw new ci("Supplied PeerID CID is invalid");if(t.code===ml){let e=X(t.multihash.digest);return new Un(new URL(e))}return gl(t.multihash)}function gm(t){return t.code===$e.code}function xm(t){return t.code===ln.code}function Em(t){let e=t.getComponents(),r={},n=0;return e[n]?.name==="ip6zone"&&(r.zone=`${e[n].value}`,n++),e[n]?.name==="ip4"||e[n]?.name==="ip6"||e[n]?.name==="dns"||e[n]?.name==="dns4"||e[n]?.name==="dns6"?(r.type=e[n].name,r.host=e[n].value,n++):e[n]?.name==="dnsaddr"&&(r.type=e[n].name,r.host=`_dnsaddr.${e[n].value}`,n++),(e[n]?.name==="tcp"||e[n]?.name==="udp")&&(r.protocol=e[n].name==="tcp"?"tcp":"udp",r.port=parseInt(`${e[n].value}`),n++),e[n]?.name==="ipcidr"&&(r.type==="ip4"?r.cidr=parseInt(`${e[n].value}`):r.type==="ip6"&&(r.cidr=`${e[n].value}`),n++),r.type==null||r.host==null?null:(e[n]?.name==="tls"&&e[n+1]?.name==="sni"&&(r.sni=e[n+1].value,n+=2),r)}function ma(t){let e=Em(t);if(e==null)throw new Re(`Multiaddr ${t} was not an IPv4, IPv6, DNS, DNS4, DNS6 or DNSADDR address`);return e}var zi=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 f=a==="0",c=2**(8*i)-1;for(;;){let u=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let h=Number.parseInt(l,e);if(!Number.isNaN(h))return h});if(u===void 0)break;if(o*=e,o+=u,o>c||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&f&&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 Sm=45,_m=15,Gi=new zi;function xl(t){if(!(t.length>_m))return Gi.new(t).parseWith(()=>Gi.readIPv4Addr())}function El(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>Sm))return Gi.new(t).parseWith(()=>Gi.readIPv6Addr())}function Yi(t){return!!xl(t)}function Sl(t){return!!El(t)}var Ee=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},xt=class extends Error{static name="ValidationError";name="ValidationError"},Zi=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},Xi=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};function ga(t){return e=>X(e,t)}function xa(t){return e=>ae(e,t)}function Mr(t){return new DataView(t.buffer).getUint16(t.byteOffset).toString()}function or(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof t=="string"?parseInt(t):t),new Uint8Array(e)}function _l(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=ae(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=or(n);return pt([r,i],r.length+i.length)}function Al(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=Dt.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=or(n);return pt([r,i],r.length+i.length)}function Ea(t){let e=t.subarray(0,t.length-2),r=t.subarray(t.length-2),n=X(e,"base32"),i=Mr(r);return`${n}:${i}`}var Sa=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 Ee("Invalid byte value in IP address");e[n]=i}),e},Tl=function(t){let e=0;t=t.toString().trim();let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=Yi(r[n]),s;o&&(s=Sa(r[n]),r[n]=X(s.subarray(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,X(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 Ee("Invalid byte value in IP address");i[e++]=o>>8&255,i[e++]=o&255}return i},Il=function(t){if(t.byteLength!==4)throw new Ee("IPv4 address was incorrect length");let e=[];for(let r=0;r<t.byteLength;r++)e.push(t[r]);return e.join(".")},Rl=function(t){if(t.byteLength!==16)throw new Ee("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 Ee(`Invalid IPv6 address "${r}"`)}};function vl(t){try{let e=new URL(`http://[${t}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new Ee(`Invalid IPv6 address "${t}"`)}}var wa=Object.values(hn).map(t=>t.decoder),Am=(function(){let t=wa[0].or(wa[1]);return wa.slice(2).forEach(e=>t=t.or(e)),t})();function Bl(t){return Am.decode(t)}function Cl(t){return e=>t.encoder.encode(e)}function Tm(t){if(parseInt(t).toString()!==t)throw new xt("Value must be an integer")}function Im(t){if(t<0)throw new xt("Value must be a positive integer, or zero")}function Rm(t){return e=>{if(e>t)throw new xt(`Value must be smaller than or equal to ${t}`)}}function vm(...t){return e=>{for(let r of t)r(e)}}var Fn=vm(Tm,Im,Rm(65535));var be=-1,_a=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 Xi(`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)}))}},Et=new _a,aw=[{code:4,name:"ip4",size:32,valueToBytes:Sa,bytesToValue:Il,validate:t=>{if(!Yi(t))throw new xt(`Invalid IPv4 address "${t}"`)}},{code:6,name:"tcp",size:16,valueToBytes:or,bytesToValue:Mr,validate:Fn},{code:273,name:"udp",size:16,valueToBytes:or,bytesToValue:Mr,validate:Fn},{code:33,name:"dccp",size:16,valueToBytes:or,bytesToValue:Mr,validate:Fn},{code:41,name:"ip6",size:128,valueToBytes:Tl,bytesToValue:Rl,stringToValue:vl,validate:t=>{if(!Sl(t))throw new xt(`Invalid IPv6 address "${t}"`)}},{code:42,name:"ip6zone",size:be},{code:43,name:"ipcidr",size:8,bytesToValue:ga("base10"),valueToBytes:xa("base10")},{code:53,name:"dns",size:be},{code:54,name:"dns4",size:be},{code:55,name:"dns6",size:be},{code:56,name:"dnsaddr",size:be},{code:132,name:"sctp",size:16,valueToBytes:or,bytesToValue:Mr,validate:Fn},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:be,stringToValue:t=>decodeURIComponent(t),valueToString:t=>encodeURIComponent(t)},{code:421,name:"p2p",aliases:["ipfs"],size:be,bytesToValue:ga("base58btc"),valueToBytes:t=>t.startsWith("Q")||t.startsWith("1")?xa("base58btc")(t):we.parse(t).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:Ea,valueToBytes:_l},{code:445,name:"onion3",size:296,bytesToValue:Ea,valueToBytes:Al},{code:446,name:"garlic64",size:be},{code:447,name:"garlic32",size:be},{code:448,name:"tls"},{code:449,name:"sni",size:be},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:be,bytesToValue:Cl(Jo),valueToBytes:Bl},{code:480,name:"http"},{code:481,name:"http-path",size:be,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:be}];aw.forEach(t=>{Et.addProtocol(t)});function Dl(t){let e=[],r=0;for(;r<t.length;){let n=Qs(t,r),i=Et.getProtocol(n),o=et(n),s=cw(i,t,r+o),a=0;s>0&&i.size===be&&(a=et(s));let f=o+a+s,c={code:n,name:i.name,bytes:t.subarray(r,r+f)};if(s>0){let u=r+o+a,l=t.subarray(u,u+s);c.value=i.bytesToValue?.(l)??X(l)}e.push(c),r+=f}return e}function Ll(t){let e=0,r=[];for(let n of t){if(n.bytes==null){let i=Et.getProtocol(n.code),o=et(n.code),s,a=0,f=0;n.value!=null&&(s=i.valueToBytes?.(n.value)??ae(n.value),a=s.byteLength,i.size===be&&(f=et(a)));let c=new Uint8Array(o+f+a),u=0;Cn(n.code,c,u),u+=o,s!=null&&(i.size===be&&(Cn(a,c,u),u+=f),c.set(s,u)),n.bytes=c}r.push(n.bytes),e+=n.bytes.byteLength}return pt(r,e)}function Ol(t){if(t.charAt(0)!=="/")throw new Ee('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 f=Et.getProtocol(i);if(r==="protocol"){if(f.size==null||f.size===0){e.push({code:f.code,name:f.name}),n="",i="",r="protocol";continue}else if(a)throw new Ee(`Component ${i} was missing value`);r="value"}else if(r==="value"){let c={code:f.code,name:f.name};if(f.size!=null&&f.size!==0){if(n==="")throw new Ee(`Component ${i} was missing value`);c.value=f.stringToValue?.(n)??n}e.push(c),n="",i="",r="protocol"}}}if(i!==""&&n!=="")throw new Ee("Incomplete multiaddr");return e}function Nl(t){return`/${t.flatMap(e=>{if(e.value==null)return e.name;let r=Et.getProtocol(e.code);if(r==null)throw new Ee(`Unknown protocol code ${e.code}`);return[e.name,r.valueToString?.(e.value)??e.value]}).join("/")}`}function cw(t,e,r){return t.size==null||t.size===0?0:t.size>0?t.size/8:Qs(e,r)}var fw=Symbol.for("nodejs.util.inspect.custom"),La=Symbol.for("@multiformats/multiaddr");function uw(t){if(t==null&&(t="/"),Ji(t))return t.getComponents();if(t instanceof Uint8Array)return Dl(t);if(typeof t=="string")return t=t.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),t===""&&(t="/"),Ol(t);if(Array.isArray(t))return t;throw new Ee("Must be a string, Uint8Array, Component[], or another Multiaddr")}var Qi=class t{[La]=!0;#t;#r;#e;constructor(e="/",r={}){this.#t=uw(e),r.validate!==!1&&lw(this)}get bytes(){return this.#e==null&&(this.#e=Ll(this.#t)),this.#e}toString(){return this.#r==null&&(this.#r=Nl(this.#t)),this.#r}toJSON(){return this.toString()}getComponents(){return[...this.#t.map(e=>({...e}))]}encapsulate(e){let r=new t(e);return new t([...this.#t,...r.getComponents()],{validate:!1})}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Zi(`Address ${this.toString()} does not contain subaddress: ${r}`);return new t(n.slice(0,i),{validate:!1})}decapsulateCode(e){let r;for(let n=this.#t.length-1;n>-1;n--)if(this.#t[n].code===e){r=n;break}return new t(this.#t.slice(0,r),{validate:!1})}equals(e){return Pe(this.bytes,e.bytes)}[fw](){return`Multiaddr(${this.toString()})`}};function lw(t){t.getComponents().forEach(e=>{let r=Et.getProtocol(e.code);e.value!=null&&r.validate?.(e.value)})}function Ji(t){return!!t?.[La]}function Ht(t){return new Qi(t)}var dw=[6,53,56,54,55];function Pl(t){return kl("sni",t)?.value}function Ul(t){let e=kl("tcp",t)?.value;return e==null?"":`:${e}`}function kl(t,e){return e.find(r=>r.name===t)}function Fl(t){return t.some(({code:e})=>e===448)}function Ge(t,e){let r=Ml[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 Ml={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://${Ge(r,e)}:${t.value}`},udp:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`udp://${Ge(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`${Ge(r,e)}`},p2p:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return`${Ge(r,e)}`},http:(t,e)=>{let r=Fl(e),n=Pl(e),i=Ul(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=Ge(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=Ge(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 Ge(r,e)},sni:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");return Ge(r,e)},https:(t,e)=>{let r=e.pop();if(r==null)throw new Error("Unexpected end of multiaddr");let n=Ge(r,e);return n=n?.replace("tcp://",""),`https://${n}`},ws:(t,e)=>{let r=Fl(e),n=Pl(e),i=Ul(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=Ge(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=Ge(r,e);return n=n?.replace("tcp://",""),`wss://${n}`}};function ql(t,e){let n=Ht(t).getComponents(),i=n.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let o=Ml[i.name];if(o==null)throw new Error(`No interpreter found for ${i.name}`);let s=o(i,n)??"";return e?.assumeHttp!==!1&&dw.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 $l="[a-fA-F\\d:]",Kt=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${$l})|(?<=${$l})(?=\\s|$))`:"",Ye="(?: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}",eo=`
2
+ "use strict";var Libp2PHttpUtils=(()=>{var _b=Object.create;var Ti=Object.defineProperty;var Ab=Object.getOwnPropertyDescriptor;var vb=Object.getOwnPropertyNames;var Tb=Object.getPrototypeOf,Ib=Object.prototype.hasOwnProperty;var j=(t,e)=>()=>{try{return e||t((e={exports:{}}).exports,e),e.exports}catch(r){throw e=0,r}},G=(t,e)=>{for(var r in e)Ti(t,r,{get:e[r],enumerable:!0})},Bu=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of vb(e))!Ib.call(t,i)&&i!==r&&Ti(t,i,{get:()=>e[i],enumerable:!(n=Ab(e,i))||n.enumerable});return t};var Bb=(t,e,r)=>(r=t!=null?_b(Tb(t)):{},Bu(e||!t||!t.__esModule?Ti(r,"default",{value:t,enumerable:!0}):r,t)),Rb=t=>Bu(Ti({},"__esModule",{value:!0}),t);var $h=j(No=>{"use strict";No.byteLength=OE;No.toByteArray=NE;No.fromByteArray=kE;var rt=[],Pe=[],DE=typeof Uint8Array<"u"?Uint8Array:Array,ef="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pr=0,Mh=ef.length;pr<Mh;++pr)rt[pr]=ef[pr],Pe[ef.charCodeAt(pr)]=pr;var pr,Mh;Pe[45]=62;Pe[95]=63;function qh(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 OE(t){var e=qh(t),r=e[0],n=e[1];return(r+n)*3/4-n}function UE(t,e,r){return(e+r)*3/4-r}function NE(t){var e,r=qh(t),n=r[0],i=r[1],o=new DE(UE(t,n,i)),s=0,a=i>0?n-4:n,f;for(f=0;f<a;f+=4)e=Pe[t.charCodeAt(f)]<<18|Pe[t.charCodeAt(f+1)]<<12|Pe[t.charCodeAt(f+2)]<<6|Pe[t.charCodeAt(f+3)],o[s++]=e>>16&255,o[s++]=e>>8&255,o[s++]=e&255;return i===2&&(e=Pe[t.charCodeAt(f)]<<2|Pe[t.charCodeAt(f+1)]>>4,o[s++]=e&255),i===1&&(e=Pe[t.charCodeAt(f)]<<10|Pe[t.charCodeAt(f+1)]<<4|Pe[t.charCodeAt(f+2)]>>2,o[s++]=e>>8&255,o[s++]=e&255),o}function PE(t){return rt[t>>18&63]+rt[t>>12&63]+rt[t>>6&63]+rt[t&63]}function FE(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(PE(n));return i.join("")}function kE(t){for(var e,r=t.length,n=r%3,i=[],o=16383,s=0,a=r-n;s<a;s+=o)i.push(FE(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 Hh=j(tf=>{tf.read=function(t,e,r,n,i){var o,s,a=i*8-n-1,f=(1<<a)-1,c=f>>1,u=-7,l=r?i-1:0,p=r?-1:1,d=t[e+l];for(l+=p,o=d&(1<<-u)-1,d>>=-u,u+=a;u>0;o=o*256+t[e+l],l+=p,u-=8);for(s=o&(1<<-u)-1,o>>=-u,u+=n;u>0;s=s*256+t[e+l],l+=p,u-=8);if(o===0)o=1-c;else{if(o===f)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)};tf.write=function(t,e,r,n,i,o){var s,a,f,c=o*8-i-1,u=(1<<c)-1,l=u>>1,p=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,d=n?0:o-1,y=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=u):(s=Math.floor(Math.log(e)/Math.LN2),e*(f=Math.pow(2,-s))<1&&(s--,f*=2),s+l>=1?e+=p/f:e+=p*Math.pow(2,1-l),e*f>=2&&(s++,f/=2),s+l>=u?(a=0,s=u):s+l>=1?(a=(e*f-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+=y,a/=256,i-=8);for(s=s<<i|a,c+=i;c>0;t[r+d]=s&255,d+=y,s/=256,c-=8);t[r+d-y]|=h*128}});var At=j(cn=>{"use strict";var rf=$h(),sn=Hh(),Kh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;cn.Buffer=g;cn.SlowBuffer=VE;cn.INSPECT_MAX_BYTES=50;var Po=2147483647;cn.kMaxLength=Po;g.TYPED_ARRAY_SUPPORT=ME();!g.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 ME(){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(g.prototype,"parent",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.buffer}});Object.defineProperty(g.prototype,"offset",{enumerable:!0,get:function(){if(g.isBuffer(this))return this.byteOffset}});function _t(t){if(t>Po)throw new RangeError('The value "'+t+'" is invalid for option "size"');let e=new Uint8Array(t);return Object.setPrototypeOf(e,g.prototype),e}function g(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 af(t)}return zh(t,e,r)}g.poolSize=8192;function zh(t,e,r){if(typeof t=="string")return $E(t,e);if(ArrayBuffer.isView(t))return HE(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 of(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 g.from(n,e,r);let i=KE(t);if(i)return i;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof t[Symbol.toPrimitive]=="function")return g.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)}g.from=function(t,e,r){return zh(t,e,r)};Object.setPrototypeOf(g.prototype,Uint8Array.prototype);Object.setPrototypeOf(g,Uint8Array);function Gh(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 qE(t,e,r){return Gh(t),t<=0?_t(t):e!==void 0?typeof r=="string"?_t(t).fill(e,r):_t(t).fill(e):_t(t)}g.alloc=function(t,e,r){return qE(t,e,r)};function af(t){return Gh(t),_t(t<0?0:cf(t)|0)}g.allocUnsafe=function(t){return af(t)};g.allocUnsafeSlow=function(t){return af(t)};function $E(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!g.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=Yh(t,e)|0,n=_t(r),i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}function nf(t){let e=t.length<0?0:cf(t.length)|0,r=_t(e);for(let n=0;n<e;n+=1)r[n]=t[n]&255;return r}function HE(t){if(nt(t,Uint8Array)){let e=new Uint8Array(t);return of(e.buffer,e.byteOffset,e.byteLength)}return nf(t)}function of(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,g.prototype),n}function KE(t){if(g.isBuffer(t)){let e=cf(t.length)|0,r=_t(e);return r.length===0||t.copy(r,0,0,e),r}if(t.length!==void 0)return typeof t.length!="number"||uf(t.length)?_t(0):nf(t);if(t.type==="Buffer"&&Array.isArray(t.data))return nf(t.data)}function cf(t){if(t>=Po)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Po.toString(16)+" bytes");return t|0}function VE(t){return+t!=t&&(t=0),g.alloc(+t)}g.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==g.prototype};g.compare=function(e,r){if(nt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),nt(r,Uint8Array)&&(r=g.from(r,r.offset,r.byteLength)),!g.isBuffer(e)||!g.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};g.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}};g.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return g.alloc(0);let n;if(r===void 0)for(r=0,n=0;n<e.length;++n)r+=e[n].length;let i=g.allocUnsafe(r),o=0;for(n=0;n<e.length;++n){let s=e[n];if(nt(s,Uint8Array))o+s.length>i.length?(g.isBuffer(s)||(s=g.from(s)),s.copy(i,o)):Uint8Array.prototype.set.call(i,s,o);else if(g.isBuffer(s))s.copy(i,o);else throw new TypeError('"list" argument must be an Array of Buffers');o+=s.length}return i};function Yh(t,e){if(g.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 sf(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return ip(t).length;default:if(i)return n?-1:sf(t).length;e=(""+e).toLowerCase(),i=!0}}g.byteLength=Yh;function jE(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 t1(this,e,r);case"utf8":case"utf-8":return Xh(this,e,r);case"ascii":return JE(this,e,r);case"latin1":case"binary":return e1(this,e,r);case"base64":return XE(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r1(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}g.prototype._isBuffer=!0;function yr(t,e,r){let n=t[e];t[e]=t[r],t[r]=n}g.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)yr(this,r,r+1);return this};g.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)yr(this,r,r+3),yr(this,r+1,r+2);return this};g.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)yr(this,r,r+7),yr(this,r+1,r+6),yr(this,r+2,r+5),yr(this,r+3,r+4);return this};g.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?Xh(this,0,e):jE.apply(this,arguments)};g.prototype.toLocaleString=g.prototype.toString;g.prototype.equals=function(e){if(!g.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:g.compare(this,e)===0};g.prototype.inspect=function(){let e="",r=cn.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"};Kh&&(g.prototype[Kh]=g.prototype.inspect);g.prototype.compare=function(e,r,n,i,o){if(nt(e,Uint8Array)&&(e=g.from(e,e.offset,e.byteLength)),!g.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,f=Math.min(s,a),c=this.slice(i,o),u=e.slice(r,n);for(let l=0;l<f;++l)if(c[l]!==u[l]){s=c[l],a=u[l];break}return s<a?-1:a<s?1:0};function Zh(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,uf(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=g.from(e,n)),g.isBuffer(e))return e.length===0?-1:Vh(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):Vh(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function Vh(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 f(u,l){return o===1?u[l]:u.readUInt16BE(l*o)}let c;if(i){let u=-1;for(c=r;c<s;c++)if(f(t,c)===f(e,u===-1?0:c-u)){if(u===-1&&(u=c),c-u+1===a)return u*o}else u!==-1&&(c-=c-u),u=-1}else for(r+a>s&&(r=s-a),c=r;c>=0;c--){let u=!0;for(let l=0;l<a;l++)if(f(t,c+l)!==f(e,l)){u=!1;break}if(u)return c}return-1}g.prototype.includes=function(e,r,n){return this.indexOf(e,r,n)!==-1};g.prototype.indexOf=function(e,r,n){return Zh(this,e,r,n,!0)};g.prototype.lastIndexOf=function(e,r,n){return Zh(this,e,r,n,!1)};function WE(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(uf(a))return s;t[r+s]=a}return s}function zE(t,e,r,n){return Fo(sf(e,t.length-r),t,r,n)}function GE(t,e,r,n){return Fo(s1(e),t,r,n)}function YE(t,e,r,n){return Fo(ip(e),t,r,n)}function ZE(t,e,r,n){return Fo(a1(e,t.length-r),t,r,n)}g.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 WE(this,e,r,n);case"utf8":case"utf-8":return zE(this,e,r,n);case"ascii":case"latin1":case"binary":return GE(this,e,r,n);case"base64":return YE(this,e,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZE(this,e,r,n);default:if(s)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),s=!0}};g.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function XE(t,e,r){return e===0&&r===t.length?rf.fromByteArray(t):rf.fromByteArray(t.slice(e,r))}function Xh(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 f,c,u,l;switch(a){case 1:o<128&&(s=o);break;case 2:f=t[i+1],(f&192)===128&&(l=(o&31)<<6|f&63,l>127&&(s=l));break;case 3:f=t[i+1],c=t[i+2],(f&192)===128&&(c&192)===128&&(l=(o&15)<<12|(f&63)<<6|c&63,l>2047&&(l<55296||l>57343)&&(s=l));break;case 4:f=t[i+1],c=t[i+2],u=t[i+3],(f&192)===128&&(c&192)===128&&(u&192)===128&&(l=(o&15)<<18|(f&63)<<12|(c&63)<<6|u&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 QE(n)}var jh=4096;function QE(t){let e=t.length;if(e<=jh)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=jh));return r}function JE(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 e1(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 t1(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+=c1[t[o]];return i}function r1(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}g.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,g.prototype),i};function me(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")}g.prototype.readUintLE=g.prototype.readUIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=this[e],o=1,s=0;for(;++s<r&&(o*=256);)i+=this[e+s]*o;return i};g.prototype.readUintBE=g.prototype.readUIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(e,r,this.length);let i=this[e+--r],o=1;for(;r>0&&(o*=256);)i+=this[e+--r]*o;return i};g.prototype.readUint8=g.prototype.readUInt8=function(e,r){return e=e>>>0,r||me(e,1,this.length),this[e]};g.prototype.readUint16LE=g.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||me(e,2,this.length),this[e]|this[e+1]<<8};g.prototype.readUint16BE=g.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||me(e,2,this.length),this[e]<<8|this[e+1]};g.prototype.readUint32LE=g.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||me(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};g.prototype.readUint32BE=g.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};g.prototype.readBigUInt64LE=Zt(function(e){e=e>>>0,an(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ui(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))});g.prototype.readBigUInt64BE=Zt(function(e){e=e>>>0,an(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ui(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)});g.prototype.readIntLE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(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};g.prototype.readIntBE=function(e,r,n){e=e>>>0,r=r>>>0,n||me(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};g.prototype.readInt8=function(e,r){return e=e>>>0,r||me(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]};g.prototype.readInt16LE=function(e,r){e=e>>>0,r||me(e,2,this.length);let n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n};g.prototype.readInt16BE=function(e,r){e=e>>>0,r||me(e,2,this.length);let n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n};g.prototype.readInt32LE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};g.prototype.readInt32BE=function(e,r){return e=e>>>0,r||me(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};g.prototype.readBigInt64LE=Zt(function(e){e=e>>>0,an(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ui(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)});g.prototype.readBigInt64BE=Zt(function(e){e=e>>>0,an(e,"offset");let r=this[e],n=this[e+7];(r===void 0||n===void 0)&&ui(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)});g.prototype.readFloatLE=function(e,r){return e=e>>>0,r||me(e,4,this.length),sn.read(this,e,!0,23,4)};g.prototype.readFloatBE=function(e,r){return e=e>>>0,r||me(e,4,this.length),sn.read(this,e,!1,23,4)};g.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||me(e,8,this.length),sn.read(this,e,!0,52,8)};g.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||me(e,8,this.length),sn.read(this,e,!1,52,8)};function Le(t,e,r,n,i,o){if(!g.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")}g.prototype.writeUintLE=g.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};g.prototype.writeUintBE=g.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};g.prototype.writeUint8=g.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};g.prototype.writeUint16LE=g.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};g.prototype.writeUint16BE=g.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};g.prototype.writeUint32LE=g.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};g.prototype.writeUint32BE=g.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 Qh(t,e,r,n,i){np(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 Jh(t,e,r,n,i){np(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}g.prototype.writeBigUInt64LE=Zt(function(e,r=0){return Qh(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeBigUInt64BE=Zt(function(e,r=0){return Jh(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))});g.prototype.writeIntLE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let f=Math.pow(2,8*n-1);Le(this,e,r,n,f-1,-f)}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};g.prototype.writeIntBE=function(e,r,n,i){if(e=+e,r=r>>>0,!i){let f=Math.pow(2,8*n-1);Le(this,e,r,n,f-1,-f)}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};g.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};g.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};g.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};g.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};g.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};g.prototype.writeBigInt64LE=Zt(function(e,r=0){return Qh(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});g.prototype.writeBigInt64BE=Zt(function(e,r=0){return Jh(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function ep(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 tp(t,e,r,n,i){return e=+e,r=r>>>0,i||ep(t,e,r,4,34028234663852886e22,-34028234663852886e22),sn.write(t,e,r,n,23,4),r+4}g.prototype.writeFloatLE=function(e,r,n){return tp(this,e,r,!0,n)};g.prototype.writeFloatBE=function(e,r,n){return tp(this,e,r,!1,n)};function rp(t,e,r,n,i){return e=+e,r=r>>>0,i||ep(t,e,r,8,17976931348623157e292,-17976931348623157e292),sn.write(t,e,r,n,52,8),r+8}g.prototype.writeDoubleLE=function(e,r,n){return rp(this,e,r,!0,n)};g.prototype.writeDoubleBE=function(e,r,n){return rp(this,e,r,!1,n)};g.prototype.copy=function(e,r,n,i){if(!g.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};g.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"&&!g.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=g.isBuffer(e)?e:g.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 on={};function ff(t,e,r){on[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}`}}}ff("ERR_BUFFER_OUT_OF_BOUNDS",function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError);ff("ERR_INVALID_ARG_TYPE",function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`},TypeError);ff("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=Wh(String(r)):typeof r=="bigint"&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=Wh(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n},RangeError);function Wh(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 n1(t,e,r){an(e,"offset"),(t[e]===void 0||t[e+r]===void 0)&&ui(e,t.length-(r+1))}function np(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 on.ERR_OUT_OF_RANGE("value",a,t)}n1(n,i,o)}function an(t,e){if(typeof t!="number")throw new on.ERR_INVALID_ARG_TYPE(e,"number",t)}function ui(t,e,r){throw Math.floor(t)!==t?(an(t,r),new on.ERR_OUT_OF_RANGE(r||"offset","an integer",t)):e<0?new on.ERR_BUFFER_OUT_OF_BOUNDS:new on.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}var i1=/[^+/0-9A-Za-z-_]/g;function o1(t){if(t=t.split("=")[0],t=t.trim().replace(i1,""),t.length<2)return"";for(;t.length%4!==0;)t=t+"=";return t}function sf(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 s1(t){let e=[];for(let r=0;r<t.length;++r)e.push(t.charCodeAt(r)&255);return e}function a1(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 ip(t){return rf.toByteArray(o1(t))}function Fo(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 uf(t){return t!==t}var c1=(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 Zt(t){return typeof BigInt>"u"?f1:t}function f1(){throw new Error("BigInt not supported")}});var X=j((JR,op)=>{"use strict";var lf=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}};op.exports={AggregateError:lf,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 df=j((e5,sp)=>{"use strict";sp.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 ve=j((t5,fp)=>{"use strict";var{format:u1,inspect:ko}=df(),{AggregateError:l1}=X(),d1=globalThis.AggregateError||l1,h1=Symbol("kIsNodeError"),p1=["string","function","number","object","Function","Object","boolean","bigint","symbol"],y1=/^([A-Z][a-z0-9]*)+$/,b1="__node_internal_",Mo={};function br(t,e){if(!t)throw new Mo.ERR_INTERNAL_ASSERTION(e)}function ap(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 m1(t,e,r){if(typeof e=="function")return br(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 br(n===r.length,`Code: ${t}; The provided arguments length (${r.length}) does not match the required ones (${n}).`),r.length===0?e:u1(e,...r)}function Se(t,e,r){r||(r=Error);class n extends r{constructor(...o){super(m1(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[h1]=!0,Mo[t]=n}function cp(t){let e=b1+t.name;return Object.defineProperty(t,"name",{value:e}),t}function w1(t,e){if(t&&e&&t!==e){if(Array.isArray(e.errors))return e.errors.push(t),e;let r=new d1([e,t],e.message);return r.code=e.code,r}return t||e}var hf=class extends Error{constructor(e="The operation was aborted",r=void 0){if(r!==void 0&&typeof r!="object")throw new Mo.ERR_INVALID_ARG_TYPE("options","Object",r);super(e,r),this.code="ABORT_ERR",this.name="AbortError"}};Se("ERR_ASSERTION","%s",Error);Se("ERR_INVALID_ARG_TYPE",(t,e,r)=>{br(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 f of e)br(typeof f=="string","All expected entries have to be of type string"),p1.includes(f)?i.push(f.toLowerCase()):y1.test(f)?o.push(f):(br(f!=="object",'The value "object" should be written as "Object"'),s.push(f));if(o.length>0){let f=i.indexOf("object");f!==-1&&(i.splice(i,f,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 f=i.pop();n+=`one of type ${i.join(", ")}, or ${f}`}}(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 f=o.pop();n+=`an instance of ${o.join(", ")}, or ${f}`}}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 f=s.pop();n+=`one of ${s.join(", ")}, or ${f}`}}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 f=ko(r,{depth:-1});n+=`. Received ${f}`}}else{let f=ko(r,{colors:!1});f.length>25&&(f=`${f.slice(0,25)}...`),n+=`. Received type ${typeof r} (${f})`}return n},TypeError);Se("ERR_INVALID_ARG_VALUE",(t,e,r="is invalid")=>{let n=ko(e);return n.length>128&&(n=n.slice(0,128)+"..."),`The ${t.includes(".")?"property":"argument"} '${t}' ${r}. Received ${n}`},TypeError);Se("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);Se("ERR_MISSING_ARGS",(...t)=>{br(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);Se("ERR_OUT_OF_RANGE",(t,e,r)=>{br(e,'Missing "range" argument');let n;if(Number.isInteger(r)&&Math.abs(r)>2**32)n=ap(String(r));else if(typeof r=="bigint"){n=String(r);let i=BigInt(2)**BigInt(32);(r>i||r<-i)&&(n=ap(n)),n+="n"}else n=ko(r);return`The value of "${t}" is out of range. It must be ${e}. Received ${n}`},RangeError);Se("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Se("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Se("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Se("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Se("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Se("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Se("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Se("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Se("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Se("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Se("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);fp.exports={AbortError:hf,aggregateTwoErrors:cp(w1),hideStackFrames:cp,codes:Mo}});var fn=j((r5,qo)=>{"use strict";var{AbortController:up,AbortSignal:g1}=typeof self<"u"?self:typeof window<"u"?window:void 0;qo.exports=up;qo.exports.AbortSignal=g1;qo.exports.default=up});var li=j((n5,pf)=>{"use strict";var un=typeof Reflect=="object"?Reflect:null,lp=un&&typeof un.apply=="function"?un.apply:function(e,r,n){return Function.prototype.apply.call(e,r,n)},$o;un&&typeof un.ownKeys=="function"?$o=un.ownKeys:Object.getOwnPropertySymbols?$o=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:$o=function(e){return Object.getOwnPropertyNames(e)};function x1(t){console&&console.warn&&console.warn(t)}var hp=Number.isNaN||function(e){return e!==e};function z(){z.init.call(this)}pf.exports=z;pf.exports.once=A1;z.EventEmitter=z;z.prototype._events=void 0;z.prototype._eventsCount=0;z.prototype._maxListeners=void 0;var dp=10;function Ho(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 dp},set:function(t){if(typeof t!="number"||t<0||hp(t))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+t+".");dp=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||hp(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 pp(t){return t._maxListeners===void 0?z.defaultMaxListeners:t._maxListeners}z.prototype.getMaxListeners=function(){return pp(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 f=o[e];if(f===void 0)return!1;if(typeof f=="function")lp(f,this,r);else for(var c=f.length,u=gp(f,c),n=0;n<c;++n)lp(u[n],this,r);return!0};function yp(t,e,r,n){var i,o,s;if(Ho(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=pp(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,x1(a)}return t}z.prototype.addListener=function(e,r){return yp(this,e,r,!1)};z.prototype.on=z.prototype.addListener;z.prototype.prependListener=function(e,r){return yp(this,e,r,!0)};function E1(){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 bp(t,e,r){var n={fired:!1,wrapFn:void 0,target:t,type:e,listener:r},i=E1.bind(n);return i.listener=r,n.wrapFn=i,i}z.prototype.once=function(e,r){return Ho(r),this.on(e,bp(this,e,r)),this};z.prototype.prependOnceListener=function(e,r){return Ho(r),this.prependListener(e,bp(this,e,r)),this};z.prototype.removeListener=function(e,r){var n,i,o,s,a;if(Ho(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():S1(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 mp(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?_1(i):gp(i,i.length)}z.prototype.listeners=function(e){return mp(this,e,!0)};z.prototype.rawListeners=function(e){return mp(this,e,!1)};z.listenerCount=function(t,e){return typeof t.listenerCount=="function"?t.listenerCount(e):wp.call(t,e)};z.prototype.listenerCount=wp;function wp(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?$o(this._events):[]};function gp(t,e){for(var r=new Array(e),n=0;n<e;++n)r[n]=t[n];return r}function S1(t,e){for(;e+1<t.length;e++)t[e]=t[e+1];t.pop()}function _1(t){for(var e=new Array(t.length),r=0;r<e.length;++r)e[r]=t[r].listener||t[r];return e}function A1(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))}xp(t,e,o,{once:!0}),e!=="error"&&v1(t,i,{once:!0})})}function v1(t,e,r){typeof t.on=="function"&&xp(t,"error",e,r)}function xp(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=j((i5,bf)=>{"use strict";var T1=At(),{format:I1,inspect:B1}=df(),{codes:{ERR_INVALID_ARG_TYPE:yf}}=ve(),{kResistStopPropagation:R1,AggregateError:C1,SymbolDispose:L1}=X(),D1=globalThis.AbortSignal||fn().AbortSignal,O1=globalThis.AbortController||fn().AbortController,U1=Object.getPrototypeOf(async function(){}).constructor,Ep=globalThis.Blob||T1.Blob,N1=typeof Ep<"u"?function(e){return e instanceof Ep}:function(e){return!1},Sp=(t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new yf(e,"AbortSignal",t)},P1=(t,e)=>{if(typeof t!="function")throw new yf(e,"Function",t)};bf.exports={AggregateError:C1,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:I1,inspect:B1,types:{isAsyncFunction(t){return t instanceof U1},isArrayBufferView(t){return ArrayBuffer.isView(t)}},isBlob:N1,deprecate(t,e){return t},addAbortListener:li().addAbortListener||function(e,r){if(e===void 0)throw new yf("signal","AbortSignal",e);Sp(e,"signal"),P1(r,"listener");let n;return e.aborted?queueMicrotask(()=>r()):(e.addEventListener("abort",r,{__proto__:null,once:!0,[R1]:!0}),n=()=>{e.removeEventListener("abort",r)}),{__proto__:null,[L1](){var i;(i=n)===null||i===void 0||i()}}},AbortSignalAny:D1.any||function(e){if(e.length===1)return e[0];let r=new O1,n=()=>r.abort();return e.forEach(i=>{Sp(i,"signals"),i.addEventListener("abort",n,{once:!0})}),r.signal.addEventListener("abort",()=>{e.forEach(i=>i.removeEventListener("abort",n))},{once:!0}),r.signal}};bf.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")});var dn=j((o5,Dp)=>{"use strict";var{ArrayIsArray:wf,ArrayPrototypeIncludes:Tp,ArrayPrototypeJoin:Ip,ArrayPrototypeMap:F1,NumberIsInteger:gf,NumberIsNaN:k1,NumberMAX_SAFE_INTEGER:M1,NumberMIN_SAFE_INTEGER:q1,NumberParseInt:$1,ObjectPrototypeHasOwnProperty:H1,RegExpPrototypeExec:Bp,String:K1,StringPrototypeToUpperCase:V1,StringPrototypeTrim:j1}=X(),{hideStackFrames:Fe,codes:{ERR_SOCKET_BAD_PORT:W1,ERR_INVALID_ARG_TYPE:Te,ERR_INVALID_ARG_VALUE:ln,ERR_OUT_OF_RANGE:mr,ERR_UNKNOWN_SIGNAL:_p}}=ve(),{normalizeEncoding:z1}=Re(),{isAsyncFunction:G1,isArrayBufferView:Y1}=Re().types,Ap={};function Z1(t){return t===(t|0)}function X1(t){return t===t>>>0}var Q1=/^[0-7]+$/,J1="must be a 32-bit unsigned integer or an octal string";function e2(t,e,r){if(typeof t>"u"&&(t=r),typeof t=="string"){if(Bp(Q1,t)===null)throw new ln(e,t,J1);t=$1(t,8)}return Rp(t,e),t}var t2=Fe((t,e,r=q1,n=M1)=>{if(typeof t!="number")throw new Te(e,"number",t);if(!gf(t))throw new mr(e,"an integer",t);if(t<r||t>n)throw new mr(e,`>= ${r} && <= ${n}`,t)}),r2=Fe((t,e,r=-2147483648,n=2147483647)=>{if(typeof t!="number")throw new Te(e,"number",t);if(!gf(t))throw new mr(e,"an integer",t);if(t<r||t>n)throw new mr(e,`>= ${r} && <= ${n}`,t)}),Rp=Fe((t,e,r=!1)=>{if(typeof t!="number")throw new Te(e,"number",t);if(!gf(t))throw new mr(e,"an integer",t);let n=r?1:0,i=4294967295;if(t<n||t>i)throw new mr(e,`>= ${n} && <= ${i}`,t)});function xf(t,e){if(typeof t!="string")throw new Te(e,"string",t)}function n2(t,e,r=void 0,n){if(typeof t!="number")throw new Te(e,"number",t);if(r!=null&&t<r||n!=null&&t>n||(r!=null||n!=null)&&k1(t))throw new mr(e,`${r!=null?`>= ${r}`:""}${r!=null&&n!=null?" && ":""}${n!=null?`<= ${n}`:""}`,t)}var i2=Fe((t,e,r)=>{if(!Tp(r,t)){let i="must be one of: "+Ip(F1(r,o=>typeof o=="string"?`'${o}'`:K1(o)),", ");throw new ln(e,t,i)}});function Cp(t,e){if(typeof t!="boolean")throw new Te(e,"boolean",t)}function mf(t,e,r){return t==null||!H1(t,e)?r:t[e]}var o2=Fe((t,e,r=null)=>{let n=mf(r,"allowArray",!1),i=mf(r,"allowFunction",!1);if(!mf(r,"nullable",!1)&&t===null||!n&&wf(t)||typeof t!="object"&&(!i||typeof t!="function"))throw new Te(e,"Object",t)}),s2=Fe((t,e)=>{if(t!=null&&typeof t!="object"&&typeof t!="function")throw new Te(e,"a dictionary",t)}),Ko=Fe((t,e,r=0)=>{if(!wf(t))throw new Te(e,"Array",t);if(t.length<r){let n=`must be longer than ${r}`;throw new ln(e,t,n)}});function a2(t,e){Ko(t,e);for(let r=0;r<t.length;r++)xf(t[r],`${e}[${r}]`)}function c2(t,e){Ko(t,e);for(let r=0;r<t.length;r++)Cp(t[r],`${e}[${r}]`)}function f2(t,e){Ko(t,e);for(let r=0;r<t.length;r++){let n=t[r],i=`${e}[${r}]`;if(n==null)throw new Te(i,"AbortSignal",n);Lp(n,i)}}function u2(t,e="signal"){if(xf(t,e),Ap[t]===void 0)throw Ap[V1(t)]!==void 0?new _p(t+" (signals must use all capital letters)"):new _p(t)}var l2=Fe((t,e="buffer")=>{if(!Y1(t))throw new Te(e,["Buffer","TypedArray","DataView"],t)});function d2(t,e){let r=z1(e),n=t.length;if(r==="hex"&&n%2!==0)throw new ln("encoding",e,`is invalid for data of length ${n}`)}function h2(t,e="Port",r=!0){if(typeof t!="number"&&typeof t!="string"||typeof t=="string"&&j1(t).length===0||+t!==+t>>>0||t>65535||t===0&&!r)throw new W1(e,t,r);return t|0}var Lp=Fe((t,e)=>{if(t!==void 0&&(t===null||typeof t!="object"||!("aborted"in t)))throw new Te(e,"AbortSignal",t)}),p2=Fe((t,e)=>{if(typeof t!="function")throw new Te(e,"Function",t)}),y2=Fe((t,e)=>{if(typeof t!="function"||G1(t))throw new Te(e,"Function",t)}),b2=Fe((t,e)=>{if(t!==void 0)throw new Te(e,"undefined",t)});function m2(t,e,r){if(!Tp(r,t))throw new Te(e,`('${Ip(r,"|")}')`,t)}var w2=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function vp(t,e){if(typeof t>"u"||!Bp(w2,t))throw new ln(e,t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function g2(t){if(typeof t=="string")return vp(t,"hints"),t;if(wf(t)){let e=t.length,r="";if(e===0)return r;for(let n=0;n<e;n++){let i=t[n];vp(i,"hints"),r+=i,n!==e-1&&(r+=", ")}return r}throw new ln("hints",t,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}Dp.exports={isInt32:Z1,isUint32:X1,parseFileMode:e2,validateArray:Ko,validateStringArray:a2,validateBooleanArray:c2,validateAbortSignalArray:f2,validateBoolean:Cp,validateBuffer:l2,validateDictionary:s2,validateEncoding:d2,validateFunction:p2,validateInt32:r2,validateInteger:t2,validateNumber:n2,validateObject:o2,validateOneOf:i2,validatePlainFunction:y2,validatePort:h2,validateSignalName:u2,validateString:xf,validateUint32:Rp,validateUndefined:b2,validateUnion:m2,validateAbortSignal:Lp,validateLinkHeaderValue:g2}});var Xt=j((s5,Pp)=>{var oe=Pp.exports={},it,ot;function Ef(){throw new Error("setTimeout has not been defined")}function Sf(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?it=setTimeout:it=Ef}catch{it=Ef}try{typeof clearTimeout=="function"?ot=clearTimeout:ot=Sf}catch{ot=Sf}})();function Op(t){if(it===setTimeout)return setTimeout(t,0);if((it===Ef||!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 x2(t){if(ot===clearTimeout)return clearTimeout(t);if((ot===Sf||!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 vt=[],hn=!1,wr,Vo=-1;function E2(){!hn||!wr||(hn=!1,wr.length?vt=wr.concat(vt):Vo=-1,vt.length&&Up())}function Up(){if(!hn){var t=Op(E2);hn=!0;for(var e=vt.length;e;){for(wr=vt,vt=[];++Vo<e;)wr&&wr[Vo].run();Vo=-1,e=vt.length}wr=null,hn=!1,x2(t)}}oe.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];vt.push(new Np(t,e)),vt.length===1&&!hn&&Op(Up)};function Np(t,e){this.fun=t,this.array=e}Np.prototype.run=function(){this.fun.apply(null,this.array)};oe.title="browser";oe.browser=!0;oe.env={};oe.argv=[];oe.version="";oe.versions={};function Tt(){}oe.on=Tt;oe.addListener=Tt;oe.once=Tt;oe.off=Tt;oe.removeListener=Tt;oe.removeAllListeners=Tt;oe.emit=Tt;oe.prependListener=Tt;oe.prependOnceListener=Tt;oe.listeners=function(t){return[]};oe.binding=function(t){throw new Error("process.binding is not supported")};oe.cwd=function(){return"/"};oe.chdir=function(t){throw new Error("process.chdir is not supported")};oe.umask=function(){return 0}});var at=j((a5,Xp)=>{"use strict";var{SymbolAsyncIterator:Fp,SymbolIterator:kp,SymbolFor:gr}=X(),Mp=gr("nodejs.stream.destroyed"),qp=gr("nodejs.stream.errored"),_f=gr("nodejs.stream.readable"),Af=gr("nodejs.stream.writable"),$p=gr("nodejs.stream.disturbed"),S2=gr("nodejs.webstream.isClosedPromise"),_2=gr("nodejs.webstream.controllerErrorFunction");function jo(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 A2(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 Hp(t){return!!(t&&!st(t)&&typeof t.pipeThrough=="function"&&typeof t.getReader=="function"&&typeof t.cancel=="function")}function Kp(t){return!!(t&&!st(t)&&typeof t.getWriter=="function"&&typeof t.abort=="function")}function Vp(t){return!!(t&&!st(t)&&typeof t.readable=="object"&&typeof t.writable=="object")}function v2(t){return Hp(t)||Kp(t)||Vp(t)}function T2(t,e){return t==null?!1:e===!0?typeof t[Fp]=="function":e===!1?typeof t[kp]=="function":typeof t[Fp]=="function"||typeof t[kp]=="function"}function zo(t){if(!st(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!!(t.destroyed||t[Mp]||n!=null&&n.destroyed)}function jp(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 I2(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 B2(t){if(!jo(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 Wp(t,e){if(!jo(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 zp(t){return t&&t[_f]!=null?t[_f]:typeof t?.readable!="boolean"?null:zo(t)?!1:jo(t)&&t.readable&&!Wp(t)}function Gp(t){return t&&t[Af]!=null?t[Af]:typeof t?.writable!="boolean"?null:zo(t)?!1:Wo(t)&&t.writable&&!jp(t)}function R2(t,e){return st(t)?zo(t)?!0:!(e?.readable!==!1&&zp(t)||e?.writable!==!1&&Gp(t)):null}function C2(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 L2(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 D2(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"&&Yp(t)?t._closed:null}function Yp(t){return typeof t._closed=="boolean"&&typeof t._defaultKeepAlive=="boolean"&&typeof t._removedConnection=="boolean"&&typeof t._removedContLen=="boolean"}function Zp(t){return typeof t._sent100=="boolean"&&Yp(t)}function O2(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 U2(t){if(!st(t))return null;let e=t._writableState,r=t._readableState,n=e||r;return!n&&Zp(t)||!!(n&&n.autoDestroy&&n.emitClose&&n.closed===!1)}function N2(t){var e;return!!(t&&((e=t[$p])!==null&&e!==void 0?e:t.readableDidRead||t.readableAborted))}function P2(t){var e,r,n,i,o,s,a,f,c,u;return!!(t&&((e=(r=(n=(i=(o=(s=t[qp])!==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:(f=t._writableState)===null||f===void 0?void 0:f.errorEmitted)!==null&&r!==void 0?r:(c=t._readableState)===null||c===void 0?void 0:c.errored)!==null&&e!==void 0?e:!((u=t._writableState)===null||u===void 0)&&u.errored))}Xp.exports={isDestroyed:zo,kIsDestroyed:Mp,isDisturbed:N2,kIsDisturbed:$p,isErrored:P2,kIsErrored:qp,isReadable:zp,kIsReadable:_f,kIsClosedPromise:S2,kControllerErrorFunction:_2,kIsWritable:Af,isClosed:D2,isDuplexNodeStream:A2,isFinished:R2,isIterable:T2,isReadableNodeStream:jo,isReadableStream:Hp,isReadableEnded:B2,isReadableFinished:Wp,isReadableErrored:L2,isNodeStream:st,isWebStream:v2,isWritable:Gp,isWritableNodeStream:Wo,isWritableStream:Kp,isWritableEnded:jp,isWritableFinished:I2,isWritableErrored:C2,isServerRequest:O2,isServerResponse:Zp,willEmitClose:U2,isTransformStream:Vp}});var It=j((c5,Rf)=>{"use strict";var Qt=Xt(),{AbortError:s0,codes:F2}=ve(),{ERR_INVALID_ARG_TYPE:k2,ERR_STREAM_PREMATURE_CLOSE:Qp}=F2,{kEmptyObject:Tf,once:If}=Re(),{validateAbortSignal:M2,validateFunction:q2,validateObject:$2,validateBoolean:H2}=dn(),{Promise:K2,PromisePrototypeThen:V2,SymbolDispose:a0}=X(),{isClosed:j2,isReadable:Jp,isReadableNodeStream:vf,isReadableStream:W2,isReadableFinished:e0,isReadableErrored:t0,isWritable:r0,isWritableNodeStream:n0,isWritableStream:z2,isWritableFinished:i0,isWritableErrored:o0,isNodeStream:G2,willEmitClose:Y2,kIsClosedPromise:Z2}=at(),pn;function X2(t){return t.setHeader&&typeof t.abort=="function"}var Bf=()=>{};function c0(t,e,r){var n,i;if(arguments.length===2?(r=e,e=Tf):e==null?e=Tf:$2(e,"options"),q2(r,"callback"),M2(e.signal,"options.signal"),r=If(r),W2(t)||z2(t))return Q2(t,e,r);if(!G2(t))throw new k2("stream",["ReadableStream","WritableStream","Stream"],t);let o=(n=e.readable)!==null&&n!==void 0?n:vf(t),s=(i=e.writable)!==null&&i!==void 0?i:n0(t),a=t._writableState,f=t._readableState,c=()=>{t.writable||p()},u=Y2(t)&&vf(t)===o&&n0(t)===s,l=i0(t,!1),p=()=>{l=!0,t.destroyed&&(u=!1),!(u&&(!t.readable||o))&&(!o||d)&&r.call(t)},d=e0(t,!1),y=()=>{d=!0,t.destroyed&&(u=!1),!(u&&(!t.writable||s))&&(!s||l)&&r.call(t)},h=T=>{r.call(t,T)},b=j2(t),m=()=>{b=!0;let T=o0(t)||t0(t);if(T&&typeof T!="boolean")return r.call(t,T);if(o&&!d&&vf(t,!0)&&!e0(t,!1))return r.call(t,new Qp);if(s&&!l&&!i0(t,!1))return r.call(t,new Qp);r.call(t)},x=()=>{b=!0;let T=o0(t)||t0(t);if(T&&typeof T!="boolean")return r.call(t,T);r.call(t)},S=()=>{t.req.on("finish",p)};X2(t)?(t.on("complete",p),u||t.on("abort",m),t.req?S():t.on("request",S)):s&&!a&&(t.on("end",c),t.on("close",c)),!u&&typeof t.aborted=="boolean"&&t.on("aborted",m),t.on("end",y),t.on("finish",p),e.error!==!1&&t.on("error",h),t.on("close",m),b?Qt.nextTick(m):a!=null&&a.errorEmitted||f!=null&&f.errorEmitted?u||Qt.nextTick(x):(!o&&(!u||Jp(t))&&(l||r0(t)===!1)||!s&&(!u||r0(t))&&(d||Jp(t)===!1)||f&&t.req&&t.aborted)&&Qt.nextTick(x);let _=()=>{r=Bf,t.removeListener("aborted",m),t.removeListener("complete",p),t.removeListener("abort",m),t.removeListener("request",S),t.req&&t.req.removeListener("finish",p),t.removeListener("end",c),t.removeListener("close",c),t.removeListener("finish",p),t.removeListener("end",y),t.removeListener("error",h),t.removeListener("close",m)};if(e.signal&&!b){let T=()=>{let N=r;_(),N.call(t,new s0(void 0,{cause:e.signal.reason}))};if(e.signal.aborted)Qt.nextTick(T);else{pn=pn||Re().addAbortListener;let N=pn(e.signal,T),R=r;r=If((...I)=>{N[a0](),R.apply(t,I)})}}return _}function Q2(t,e,r){let n=!1,i=Bf;if(e.signal)if(i=()=>{n=!0,r.call(t,new s0(void 0,{cause:e.signal.reason}))},e.signal.aborted)Qt.nextTick(i);else{pn=pn||Re().addAbortListener;let s=pn(e.signal,i),a=r;r=If((...f)=>{s[a0](),a.apply(t,f)})}let o=(...s)=>{n||Qt.nextTick(()=>r.apply(t,s))};return V2(t[Z2].promise,o,o),Bf}function J2(t,e){var r;let n=!1;return e===null&&(e=Tf),(r=e)!==null&&r!==void 0&&r.cleanup&&(H2(e.cleanup,"cleanup"),n=e.cleanup),new K2((i,o)=>{let s=c0(t,e,a=>{n&&s(),a?o(a):i()})})}Rf.exports=c0;Rf.exports.finished=J2});var xr=j((f5,b0)=>{"use strict";var ct=Xt(),{aggregateTwoErrors:eS,codes:{ERR_MULTIPLE_CALLBACK:tS},AbortError:rS}=ve(),{Symbol:l0}=X(),{kIsDestroyed:nS,isDestroyed:iS,isFinished:oS,isServerRequest:sS}=at(),d0=l0("kDestroy"),Cf=l0("kConstruct");function h0(t,e,r){t&&(t.stack,e&&!e.errored&&(e.errored=t),r&&!r.errored&&(r.errored=t))}function aS(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):(h0(t,n,r),n&&(n.destroyed=!0),r&&(r.destroyed=!0),i.constructed?f0(this,t,e):this.once(d0,function(o){f0(this,eS(o,t),e)}),this)}function f0(t,e,r){let n=!1;function i(o){if(n)return;n=!0;let s=t._readableState,a=t._writableState;h0(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof r=="function"&&r(o),o?ct.nextTick(cS,t,o):ct.nextTick(p0,t)}try{t._destroy(e||null,i)}catch(o){i(o)}}function cS(t,e){Lf(t,e),p0(t)}function p0(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 Lf(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 fS(){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 Df(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?ct.nextTick(Lf,t,e):Lf(t,e))}function uS(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(Cf,e),!(t.listenerCount(Cf)>1)&&ct.nextTick(lS,t)}function lS(t){let e=!1;function r(n){if(e){Df(t,n??new tS);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(d0,n):n?Df(t,n,!0):ct.nextTick(dS,t)}try{t._construct(n=>{ct.nextTick(r,n)})}catch(n){ct.nextTick(r,n)}}function dS(t){t.emit(Cf)}function u0(t){return t?.setHeader&&typeof t.abort=="function"}function y0(t){t.emit("close")}function hS(t,e){t.emit("error",e),ct.nextTick(y0,t)}function pS(t,e){!t||iS(t)||(!e&&!oS(t)&&(e=new rS),sS(t)?(t.socket=null,t.destroy(e)):u0(t)?t.abort():u0(t.req)?t.req.abort():typeof t.destroy=="function"?t.destroy(e):typeof t.close=="function"?t.close():e?ct.nextTick(hS,t,e):ct.nextTick(y0,t),t.destroyed||(t[nS]=!0))}b0.exports={construct:uS,destroyer:pS,destroy:aS,undestroy:fS,errorOrDestroy:Df}});var Zo=j((u5,w0)=>{"use strict";var{ArrayIsArray:yS,ObjectSetPrototypeOf:m0}=X(),{EventEmitter:Go}=li();function Yo(t){Go.call(this,t)}m0(Yo.prototype,Go.prototype);m0(Yo,Go);Yo.prototype.pipe=function(t,e){let r=this;function n(u){t.writable&&t.write(u)===!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 f(u){c(),Go.listenerCount(this,"error")===0&&this.emit("error",u)}Of(r,"error",f),Of(t,"error",f);function c(){r.removeListener("data",n),t.removeListener("drain",i),r.removeListener("end",s),r.removeListener("close",a),r.removeListener("error",f),t.removeListener("error",f),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 Of(t,e,r){if(typeof t.prependListener=="function")return t.prependListener(e,r);!t._events||!t._events[e]?t.on(e,r):yS(t._events[e])?t._events[e].unshift(r):t._events[e]=[r,t._events[e]]}w0.exports={Stream:Yo,prependListener:Of}});var di=j((l5,Xo)=>{"use strict";var{SymbolDispose:bS}=X(),{AbortError:g0,codes:mS}=ve(),{isNodeStream:x0,isWebStream:wS,kControllerErrorFunction:gS}=at(),xS=It(),{ERR_INVALID_ARG_TYPE:E0}=mS,Uf,ES=(t,e)=>{if(typeof t!="object"||!("aborted"in t))throw new E0(e,"AbortSignal",t)};Xo.exports.addAbortSignal=function(e,r){if(ES(e,"signal"),!x0(r)&&!wS(r))throw new E0("stream",["ReadableStream","WritableStream","Stream"],r);return Xo.exports.addAbortSignalNoValidate(e,r)};Xo.exports.addAbortSignalNoValidate=function(t,e){if(typeof t!="object"||!("aborted"in t))return e;let r=x0(e)?()=>{e.destroy(new g0(void 0,{cause:t.reason}))}:()=>{e[gS](new g0(void 0,{cause:t.reason}))};if(t.aborted)r();else{Uf=Uf||Re().addAbortListener;let n=Uf(t,r);xS(e,n[bS])}return e}});var A0=j((h5,_0)=>{"use strict";var{StringPrototypeSlice:S0,SymbolIterator:SS,TypedArrayPrototypeSet:Qo,Uint8Array:_S}=X(),{Buffer:Nf}=At(),{inspect:AS}=Re();_0.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 Nf.alloc(0);let r=Nf.allocUnsafe(e>>>0),n=this.head,i=0;for(;n;)Qo(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}*[SS](){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+=S0(o,0,e),this.head=n,n.data=S0(o,e));break}++i}while((n=n.next)!==null);return this.length-=i,r}_getBuffer(e){let r=Nf.allocUnsafe(e),n=e,i=this.head,o=0;do{let s=i.data;if(e>s.length)Qo(r,s,n-e),e-=s.length;else{e===s.length?(Qo(r,s,n-e),++o,i.next?this.head=i.next:this.head=this.tail=null):(Qo(r,new _S(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 AS(this,{...r,depth:0,customInspect:!1})}}});var hi=j((p5,B0)=>{"use strict";var{MathFloor:vS,NumberIsInteger:TS}=X(),{validateInteger:IS}=dn(),{ERR_INVALID_ARG_VALUE:BS}=ve().codes,v0=16*1024,T0=16;function RS(t,e,r){return t.highWaterMark!=null?t.highWaterMark:e?t[r]:null}function I0(t){return t?T0:v0}function CS(t,e){IS(e,"value",0),t?T0=e:v0=e}function LS(t,e,r,n){let i=RS(e,n,r);if(i!=null){if(!TS(i)||i<0){let o=n?`options.${r}`:"options.highWaterMark";throw new BS(o,i)}return vS(i)}return I0(t.objectMode)}B0.exports={getHighWaterMark:LS,getDefaultHighWaterMark:I0,setDefaultHighWaterMark:CS}});var L0=j((Pf,C0)=>{var Jo=At(),ft=Jo.Buffer;function R0(t,e){for(var r in t)e[r]=t[r]}ft.from&&ft.alloc&&ft.allocUnsafe&&ft.allocUnsafeSlow?C0.exports=Jo:(R0(Jo,Pf),Pf.Buffer=Er);function Er(t,e,r){return ft(t,e,r)}Er.prototype=Object.create(ft.prototype);R0(ft,Er);Er.from=function(t,e,r){if(typeof t=="number")throw new TypeError("Argument must not be a number");return ft(t,e,r)};Er.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError("Argument must be a number");var n=ft(t);return e!==void 0?typeof r=="string"?n.fill(e,r):n.fill(e):n.fill(0),n};Er.allocUnsafe=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return ft(t)};Er.allocUnsafeSlow=function(t){if(typeof t!="number")throw new TypeError("Argument must be a number");return Jo.SlowBuffer(t)}});var U0=j(O0=>{"use strict";var kf=L0().Buffer,D0=kf.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 DS(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 OS(t){var e=DS(t);if(typeof e!="string"&&(kf.isEncoding===D0||!D0(t)))throw new Error("Unknown encoding: "+t);return e||t}O0.StringDecoder=pi;function pi(t){this.encoding=OS(t);var e;switch(this.encoding){case"utf16le":this.text=MS,this.end=qS,e=4;break;case"utf8":this.fillLast=PS,e=4;break;case"base64":this.text=$S,this.end=HS,e=3;break;default:this.write=KS,this.end=VS;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=kf.allocUnsafe(e)}pi.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||""};pi.prototype.end=kS;pi.prototype.text=FS;pi.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 Ff(t){return t<=127?0:t>>5===6?2:t>>4===14?3:t>>3===30?4:t>>6===2?-1:-2}function US(t,e,r){var n=e.length-1;if(n<r)return 0;var i=Ff(e[n]);return i>=0?(i>0&&(t.lastNeed=i-1),i):--n<r||i===-2?0:(i=Ff(e[n]),i>=0?(i>0&&(t.lastNeed=i-2),i):--n<r||i===-2?0:(i=Ff(e[n]),i>=0?(i>0&&(i===2?i=0:t.lastNeed=i-3),i):0))}function NS(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 PS(t){var e=this.lastTotal-this.lastNeed,r=NS(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 FS(t,e){var r=US(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 kS(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+"\uFFFD":e}function MS(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 qS(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 $S(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 HS(t){var e=t&&t.length?this.write(t):"";return this.lastNeed?e+this.lastChar.toString("base64",0,3-this.lastNeed):e}function KS(t){return t.toString(this.encoding)}function VS(t){return t&&t.length?this.write(t):""}});var Mf=j((b5,k0)=>{"use strict";var N0=Xt(),{PromisePrototypeThen:jS,SymbolAsyncIterator:P0,SymbolIterator:F0}=X(),{Buffer:WS}=At(),{ERR_INVALID_ARG_TYPE:zS,ERR_STREAM_NULL_VALUES:GS}=ve().codes;function YS(t,e,r){let n;if(typeof e=="string"||e instanceof WS)return new t({objectMode:!0,...r,read(){this.push(e),this.push(null)}});let i;if(e&&e[P0])i=!0,n=e[P0]();else if(e&&e[F0])i=!1,n=e[F0]();else throw new zS("iterable",["Iterable"],e);let o=new t({objectMode:!0,highWaterMark:1,...r}),s=!1;o._read=function(){s||(s=!0,f())},o._destroy=function(c,u){jS(a(c),()=>N0.nextTick(u,c),l=>N0.nextTick(u,l||c))};async function a(c){let u=c!=null,l=typeof n.throw=="function";if(u&&l){let{value:p,done:d}=await n.throw(c);if(await p,d)return}if(typeof n.return=="function"){let{value:p}=await n.return();await p}}async function f(){for(;;){try{let{value:c,done:u}=i?await n.next():n.next();if(u)o.push(null);else{let l=c&&typeof c.then=="function"?await c:c;if(l===null)throw s=!1,new GS;if(o.push(l))continue;s=!1}}catch(c){o.destroy(c)}break}}return o}k0.exports=YS});var bi=j((m5,ry)=>{"use strict";var Ye=Xt(),{ArrayPrototypeIndexOf:ZS,NumberIsInteger:XS,NumberIsNaN:QS,NumberParseInt:JS,ObjectDefineProperties:zf,ObjectKeys:e_,ObjectSetPrototypeOf:$0,Promise:H0,SafeSet:t_,SymbolAsyncDispose:r_,SymbolAsyncIterator:n_,Symbol:i_}=X();ry.exports=M;M.ReadableState=ns;var{EventEmitter:o_}=li(),{Stream:Jt,prependListener:s_}=Zo(),{Buffer:qf}=At(),{addAbortSignal:a_}=di(),K0=It(),H=Re().debuglog("stream",t=>{H=t}),c_=A0(),mn=xr(),{getHighWaterMark:f_,getDefaultHighWaterMark:u_}=hi(),{aggregateTwoErrors:M0,codes:{ERR_INVALID_ARG_TYPE:l_,ERR_METHOD_NOT_IMPLEMENTED:d_,ERR_OUT_OF_RANGE:h_,ERR_STREAM_PUSH_AFTER_EOF:p_,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:y_},AbortError:b_}=ve(),{validateObject:m_}=dn(),Sr=i_("kPaused"),{StringDecoder:V0}=U0(),w_=Mf();$0(M.prototype,Jt.prototype);$0(M,Jt);var $f=()=>{},{errorOrDestroy:yn}=mn,bn=1,g_=2,j0=4,yi=8,W0=16,es=32,ts=64,z0=128,x_=256,E_=512,S_=1024,jf=2048,Wf=4096,__=8192,A_=16384,v_=32768,G0=65536,T_=1<<17,I_=1<<18;function le(t){return{enumerable:!1,get(){return(this.state&t)!==0},set(e){e?this.state|=t:this.state&=~t}}}zf(ns.prototype,{objectMode:le(bn),ended:le(g_),endEmitted:le(j0),reading:le(yi),constructed:le(W0),sync:le(es),needReadable:le(ts),emittedReadable:le(z0),readableListening:le(x_),resumeScheduled:le(E_),errorEmitted:le(S_),emitClose:le(jf),autoDestroy:le(Wf),destroyed:le(__),closed:le(A_),closeEmitted:le(v_),multiAwaitDrain:le(G0),readingMore:le(T_),dataEmitted:le(I_)});function ns(t,e,r){typeof r!="boolean"&&(r=e instanceof ut()),this.state=jf|Wf|W0|es,t&&t.objectMode&&(this.state|=bn),r&&t&&t.readableObjectMode&&(this.state|=bn),this.highWaterMark=t?f_(this,t,"readableHighWaterMark",r):u_(!1),this.buffer=new c_,this.length=0,this.pipes=[],this.flowing=null,this[Sr]=null,t&&t.emitClose===!1&&(this.state&=~jf),t&&t.autoDestroy===!1&&(this.state&=~Wf),this.errored=null,this.defaultEncoding=t&&t.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,t&&t.encoding&&(this.decoder=new V0(t.encoding),this.encoding=t.encoding)}function M(t){if(!(this instanceof M))return new M(t);let e=this instanceof ut();this._readableState=new ns(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&&a_(t.signal,this)),Jt.call(this,t),mn.construct(this,()=>{this._readableState.needReadable&&rs(this,this._readableState)})}M.prototype.destroy=mn.destroy;M.prototype._undestroy=mn.undestroy;M.prototype._destroy=function(t,e){e(t)};M.prototype[o_.captureRejectionSymbol]=function(t){this.destroy(t)};M.prototype[r_]=function(){let t;return this.destroyed||(t=this.readableEnded?null:new b_,this.destroy(t)),new H0((e,r)=>K0(this,n=>n&&n!==t?r(n):e(null)))};M.prototype.push=function(t,e){return Y0(this,t,e,!1)};M.prototype.unshift=function(t,e){return Y0(this,t,e,!0)};function Y0(t,e,r,n){H("readableAddChunk",e);let i=t._readableState,o;if((i.state&bn)===0&&(typeof e=="string"?(r=r||i.defaultEncoding,i.encoding!==r&&(n&&i.encoding?e=qf.from(e,r).toString(i.encoding):(e=qf.from(e,r),r=""))):e instanceof qf?r="":Jt._isUint8Array(e)?(e=Jt._uint8ArrayToBuffer(e),r=""):e!=null&&(o=new l_("chunk",["string","Buffer","Uint8Array"],e))),o)yn(t,o);else if(e===null)i.state&=~yi,C_(t,i);else if((i.state&bn)!==0||e&&e.length>0)if(n)if((i.state&j0)!==0)yn(t,new y_);else{if(i.destroyed||i.errored)return!1;Hf(t,i,e,!0)}else if(i.ended)yn(t,new p_);else{if(i.destroyed||i.errored)return!1;i.state&=~yi,i.decoder&&!r?(e=i.decoder.write(e),i.objectMode||e.length!==0?Hf(t,i,e,!1):rs(t,i)):Hf(t,i,e,!1)}else n||(i.state&=~yi,rs(t,i));return!i.ended&&(i.length<i.highWaterMark||i.length===0)}function Hf(t,e,r,n){e.flowing&&e.length===0&&!e.sync&&t.listenerCount("data")>0?((e.state&G0)!==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&ts)!==0&&is(t)),rs(t,e)}M.prototype.isPaused=function(){let t=this._readableState;return t[Sr]===!0||t.flowing===!1};M.prototype.setEncoding=function(t){let e=new V0(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 B_=1073741824;function R_(t){if(t>B_)throw new h_("size","<= 1GiB",t);return t--,t|=t>>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,t|=t>>>16,t++,t}function q0(t,e){return t<=0||e.length===0&&e.ended?0:(e.state&bn)!==0?1:QS(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){H("read",t),t===void 0?t=NaN:XS(t)||(t=JS(t,10));let e=this._readableState,r=t;if(t>e.highWaterMark&&(e.highWaterMark=R_(t)),t!==0&&(e.state&=~z0),t===0&&e.needReadable&&((e.highWaterMark!==0?e.length>=e.highWaterMark:e.length>0)||e.ended))return H("read: emitReadable",e.length,e.ended),e.length===0&&e.ended?Kf(this):is(this),null;if(t=q0(t,e),t===0&&e.ended)return e.length===0&&Kf(this),null;let n=(e.state&ts)!==0;if(H("need readable",n),(e.length===0||e.length-t<e.highWaterMark)&&(n=!0,H("length less than watermark",n)),e.ended||e.reading||e.destroyed||e.errored||!e.constructed)n=!1,H("reading, ended or constructing",n);else if(n){H("do read"),e.state|=yi|es,e.length===0&&(e.state|=ts);try{this._read(e.highWaterMark)}catch(o){yn(this,o)}e.state&=~es,e.reading||(t=q0(r,e))}let i;return t>0?i=ey(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&&Kf(this)),i!==null&&!e.errorEmitted&&!e.closeEmitted&&(e.dataEmitted=!0,this.emit("data",i)),i};function C_(t,e){if(H("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?is(t):(e.needReadable=!1,e.emittedReadable=!0,Z0(t))}}function is(t){let e=t._readableState;H("emitReadable",e.needReadable,e.emittedReadable),e.needReadable=!1,e.emittedReadable||(H("emitReadable",e.flowing),e.emittedReadable=!0,Ye.nextTick(Z0,t))}function Z0(t){let e=t._readableState;H("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,Q0(t)}function rs(t,e){!e.readingMore&&e.constructed&&(e.readingMore=!0,Ye.nextTick(L_,t,e))}function L_(t,e){for(;!e.reading&&!e.ended&&(e.length<e.highWaterMark||e.flowing&&e.length===0);){let r=e.length;if(H("maybeReadMore read 0"),t.read(0),r===e.length)break}e.readingMore=!1}M.prototype._read=function(t){throw new d_("_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 t_(n.awaitDrainWriters?[n.awaitDrainWriters]:[]))),n.pipes.push(t),H("pipe count=%d opts=%j",n.pipes.length,e);let o=(!e||e.end!==!1)&&t!==Ye.stdout&&t!==Ye.stderr?a:b;n.endEmitted?Ye.nextTick(o):r.once("end",o),t.on("unpipe",s);function s(m,x){H("onunpipe"),m===r&&x&&x.hasUnpiped===!1&&(x.hasUnpiped=!0,u())}function a(){H("onend"),t.end()}let f,c=!1;function u(){H("cleanup"),t.removeListener("close",y),t.removeListener("finish",h),f&&t.removeListener("drain",f),t.removeListener("error",d),t.removeListener("unpipe",s),r.removeListener("end",a),r.removeListener("end",b),r.removeListener("data",p),c=!0,f&&n.awaitDrainWriters&&(!t._writableState||t._writableState.needDrain)&&f()}function l(){c||(n.pipes.length===1&&n.pipes[0]===t?(H("false write response, pause",0),n.awaitDrainWriters=t,n.multiAwaitDrain=!1):n.pipes.length>1&&n.pipes.includes(t)&&(H("false write response, pause",n.awaitDrainWriters.size),n.awaitDrainWriters.add(t)),r.pause()),f||(f=D_(r,t),t.on("drain",f))}r.on("data",p);function p(m){H("ondata");let x=t.write(m);H("dest.write",x),x===!1&&l()}function d(m){if(H("onerror",m),b(),t.removeListener("error",d),t.listenerCount("error")===0){let x=t._writableState||t._readableState;x&&!x.errorEmitted?yn(t,m):t.emit("error",m)}}s_(t,"error",d);function y(){t.removeListener("finish",h),b()}t.once("close",y);function h(){H("onfinish"),t.removeListener("close",y),b()}t.once("finish",h);function b(){H("unpipe"),r.unpipe(t)}return t.emit("pipe",r),t.writableNeedDrain===!0?l():n.flowing||(H("pipe resume"),r.resume()),t};function D_(t,e){return function(){let n=t._readableState;n.awaitDrainWriters===e?(H("pipeOnDrain",1),n.awaitDrainWriters=null):n.multiAwaitDrain&&(H("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=ZS(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=Jt.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,H("on readable",n.length,n.reading),n.length?is(this):n.reading||Ye.nextTick(O_,this)),r};M.prototype.addListener=M.prototype.on;M.prototype.removeListener=function(t,e){let r=Jt.prototype.removeListener.call(this,t,e);return t==="readable"&&Ye.nextTick(X0,this),r};M.prototype.off=M.prototype.removeListener;M.prototype.removeAllListeners=function(t){let e=Jt.prototype.removeAllListeners.apply(this,arguments);return(t==="readable"||t===void 0)&&Ye.nextTick(X0,this),e};function X0(t){let e=t._readableState;e.readableListening=t.listenerCount("readable")>0,e.resumeScheduled&&e[Sr]===!1?e.flowing=!0:t.listenerCount("data")>0?t.resume():e.readableListening||(e.flowing=null)}function O_(t){H("readable nexttick read 0"),t.read(0)}M.prototype.resume=function(){let t=this._readableState;return t.flowing||(H("resume"),t.flowing=!t.readableListening,U_(this,t)),t[Sr]=!1,this};function U_(t,e){e.resumeScheduled||(e.resumeScheduled=!0,Ye.nextTick(N_,t,e))}function N_(t,e){H("resume",e.reading),e.reading||t.read(0),e.resumeScheduled=!1,t.emit("resume"),Q0(t),e.flowing&&!e.reading&&t.read(0)}M.prototype.pause=function(){return H("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(H("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[Sr]=!0,this};function Q0(t){let e=t._readableState;for(H("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=>{yn(this,n)}),t.on("close",()=>{this.destroy()}),t.on("destroy",()=>{this.destroy()}),this._read=()=>{e&&t.resume&&(e=!1,t.resume())};let r=e_(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[n_]=function(){return J0(this)};M.prototype.iterator=function(t){return t!==void 0&&m_(t,"options"),J0(this,t)};function J0(t,e){typeof t.read!="function"&&(t=M.wrap(t,{objectMode:!0}));let r=P_(t,e);return r.stream=t,r}async function*P_(t,e){let r=$f;function n(s){this===t?(r(),r=$f):r=s}t.on("readable",n);let i,o=K0(t,{writable:!1},s=>{i=s?M0(i,s):null,r(),r=$f});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 H0(n)}}}catch(s){throw i=M0(i,s),i}finally{(i||e?.destroyOnReturn!==!1)&&(i===void 0||t._readableState.autoDestroy)?mn.destroyer(t,null):(t.off("readable",n),o())}}zf(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}}});zf(ns.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[Sr]!==!1},set(t){this[Sr]=!!t}}});M._fromList=ey;function ey(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 Kf(t){let e=t._readableState;H("endReadable",e.endEmitted),e.endEmitted||(e.ended=!0,Ye.nextTick(F_,e,t))}function F_(t,e){if(H("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)Ye.nextTick(k_,e);else if(t.autoDestroy){let r=e._writableState;(!r||r.autoDestroy&&(r.finished||r.writable===!1))&&e.destroy()}}}function k_(t){t.writable&&!t.writableEnded&&!t.destroyed&&t.end()}M.from=function(t,e){return w_(M,t,e)};var Vf;function ty(){return Vf===void 0&&(Vf={}),Vf}M.fromWeb=function(t,e){return ty().newStreamReadableFromReadableStream(t,e)};M.toWeb=function(t,e){return ty().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){mn.destroyer(t,i),o(i)}}).wrap(t)}});var fs=j((w5,py)=>{"use strict";var _r=Xt(),{ArrayPrototypeSlice:oy,Error:M_,FunctionPrototypeSymbolHasInstance:sy,ObjectDefineProperty:ay,ObjectDefineProperties:q_,ObjectSetPrototypeOf:cy,StringPrototypeToLowerCase:$_,Symbol:H_,SymbolHasInstance:K_}=X();py.exports=J;J.WritableState=gi;var{EventEmitter:V_}=li(),mi=Zo().Stream,{Buffer:os}=At(),cs=xr(),{addAbortSignal:j_}=di(),{getHighWaterMark:W_,getDefaultHighWaterMark:z_}=hi(),{ERR_INVALID_ARG_TYPE:G_,ERR_METHOD_NOT_IMPLEMENTED:Y_,ERR_MULTIPLE_CALLBACK:fy,ERR_STREAM_CANNOT_PIPE:Z_,ERR_STREAM_DESTROYED:wi,ERR_STREAM_ALREADY_FINISHED:X_,ERR_STREAM_NULL_VALUES:Q_,ERR_STREAM_WRITE_AFTER_END:J_,ERR_UNKNOWN_ENCODING:uy}=ve().codes,{errorOrDestroy:wn}=cs;cy(J.prototype,mi.prototype);cy(J,mi);function Zf(){}var gn=H_("kOnFinished");function gi(t,e,r){typeof r!="boolean"&&(r=e instanceof ut()),this.objectMode=!!(t&&t.objectMode),r&&(this.objectMode=this.objectMode||!!(t&&t.writableObjectMode)),this.highWaterMark=t?W_(this,t,"writableHighWaterMark",r):z_(!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=tA.bind(void 0,e),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,as(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[gn]=[]}function as(t){t.buffered=[],t.bufferedIndex=0,t.allBuffers=!0,t.allNoop=!0}gi.prototype.getBuffer=function(){return oy(this.buffered,this.bufferedIndex)};ay(gi.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function J(t){let e=this instanceof ut();if(!e&&!sy(J,this))return new J(t);this._writableState=new gi(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&&j_(t.signal,this)),mi.call(this,t),cs.construct(this,()=>{let r=this._writableState;r.writing||Qf(this,r),Jf(this,r)})}ay(J,K_,{__proto__:null,value:function(t){return sy(this,t)?!0:this!==J?!1:t&&t._writableState instanceof gi}});J.prototype.pipe=function(){wn(this,new Z_)};function ly(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"&&!os.isEncoding(r))throw new uy(r);typeof n!="function"&&(n=Zf)}if(e===null)throw new Q_;if(!i.objectMode)if(typeof e=="string")i.decodeStrings!==!1&&(e=os.from(e,r),r="buffer");else if(e instanceof os)r="buffer";else if(mi._isUint8Array(e))e=mi._uint8ArrayToBuffer(e),r="buffer";else throw new G_("chunk",["string","Buffer","Uint8Array"],e);let o;return i.ending?o=new J_:i.destroyed&&(o=new wi("write")),o?(_r.nextTick(n,o),wn(t,o,!0),o):(i.pendingcb++,eA(t,i,e,r,n))}J.prototype.write=function(t,e,r){return ly(this,t,e,r)===!0};J.prototype.cork=function(){this._writableState.corked++};J.prototype.uncork=function(){let t=this._writableState;t.corked&&(t.corked--,t.writing||Qf(this,t))};J.prototype.setDefaultEncoding=function(e){if(typeof e=="string"&&(e=$_(e)),!os.isEncoding(e))throw new uy(e);return this._writableState.defaultEncoding=e,this};function eA(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!==Zf&&(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 ny(t,e,r,n,i,o,s){e.writelen=n,e.writecb=s,e.writing=!0,e.sync=!0,e.destroyed?e.onwrite(new wi("write")):r?t._writev(i,e.onwrite):t._write(i,o,e.onwrite),e.sync=!1}function iy(t,e,r,n){--e.pendingcb,n(r),Xf(e),wn(t,r)}function tA(t,e){let r=t._writableState,n=r.sync,i=r.writecb;if(typeof i!="function"){wn(t,new fy);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?_r.nextTick(iy,t,r,e,i):iy(t,r,e,i)):(r.buffered.length>r.bufferedIndex&&Qf(t,r),n?r.afterWriteTickInfo!==null&&r.afterWriteTickInfo.cb===i?r.afterWriteTickInfo.count++:(r.afterWriteTickInfo={count:1,cb:i,stream:t,state:r},_r.nextTick(rA,r.afterWriteTickInfo)):dy(t,r,1,i))}function rA({stream:t,state:e,count:r,cb:n}){return e.afterWriteTickInfo=null,dy(t,e,r,n)}function dy(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&&Xf(e),Jf(t,e)}function Xf(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 wi("write"))}let r=t[gn].splice(0);for(let i=0;i<r.length;i++){var n;r[i]((n=t.errored)!==null&&n!==void 0?n:new wi("end"))}as(t)}function Qf(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?Zf:c=>{for(let u=s;u<r.length;++u)r[u].callback(c)},f=e.allNoop&&s===0?r:oy(r,s);f.allBuffers=e.allBuffers,ny(t,e,!0,e.length,f,"",a),as(e)}else{do{let{chunk:a,encoding:f,callback:c}=r[s];r[s++]=null;let u=i?1:a.length;ny(t,e,!1,u,a,f,c)}while(s<r.length&&!e.writing);s===r.length?as(e):s>256?(r.splice(0,s),e.bufferedIndex=0):e.bufferedIndex=s}e.bufferProcessing=!1}J.prototype._write=function(t,e,r){if(this._writev)this._writev([{chunk:t,encoding:e}],r);else throw new Y_("_write()")};J.prototype._writev=null;J.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=ly(this,t,e);o instanceof M_&&(i=o)}return n.corked&&(n.corked=1,this.uncork()),i||(!n.errored&&!n.ending?(n.ending=!0,Jf(this,n,!0),n.ended=!0):n.finished?i=new X_("end"):n.destroyed&&(i=new wi("end"))),typeof r=="function"&&(i||n.finished?_r.nextTick(r,i):n[gn].push(r)),this};function ss(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 nA(t,e){let r=!1;function n(i){if(r){wn(t,i??fy());return}if(r=!0,e.pendingcb--,i){let o=e[gn].splice(0);for(let s=0;s<o.length;s++)o[s](i);wn(t,i,e.sync)}else ss(e)&&(e.prefinished=!0,t.emit("prefinish"),e.pendingcb++,_r.nextTick(Yf,t,e))}e.sync=!0,e.pendingcb++;try{t._final(n)}catch(i){n(i)}e.sync=!1}function iA(t,e){!e.prefinished&&!e.finalCalled&&(typeof t._final=="function"&&!e.destroyed?(e.finalCalled=!0,nA(t,e)):(e.prefinished=!0,t.emit("prefinish")))}function Jf(t,e,r){ss(e)&&(iA(t,e),e.pendingcb===0&&(r?(e.pendingcb++,_r.nextTick((n,i)=>{ss(i)?Yf(n,i):i.pendingcb--},t,e)):ss(e)&&(e.pendingcb++,Yf(t,e))))}function Yf(t,e){e.pendingcb--,e.finished=!0;let r=e[gn].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()}}q_(J.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 oA=cs.destroy;J.prototype.destroy=function(t,e){let r=this._writableState;return!r.destroyed&&(r.bufferedIndex<r.buffered.length||r[gn].length)&&_r.nextTick(Xf,r),oA.call(this,t,e),this};J.prototype._undestroy=cs.undestroy;J.prototype._destroy=function(t,e){e(t)};J.prototype[V_.captureRejectionSymbol]=function(t){this.destroy(t)};var Gf;function hy(){return Gf===void 0&&(Gf={}),Gf}J.fromWeb=function(t,e){return hy().newStreamWritableFromWritableStream(t,e)};J.toWeb=function(t){return hy().newWritableStreamFromStreamWritable(t)}});var Ry=j((g5,By)=>{var eu=Xt(),sA=At(),{isReadable:aA,isWritable:cA,isIterable:yy,isNodeStream:fA,isReadableNodeStream:by,isWritableNodeStream:my,isDuplexNodeStream:uA,isReadableStream:wy,isWritableStream:gy}=at(),xy=It(),{AbortError:Ty,codes:{ERR_INVALID_ARG_TYPE:lA,ERR_INVALID_RETURN_VALUE:Ey}}=ve(),{destroyer:En}=xr(),dA=ut(),Iy=bi(),hA=fs(),{createDeferredPromise:Sy}=Re(),_y=Mf(),Ay=globalThis.Blob||sA.Blob,pA=typeof Ay<"u"?function(e){return e instanceof Ay}:function(e){return!1},yA=globalThis.AbortController||fn().AbortController,{FunctionPrototypeCall:vy}=X(),er=class extends dA{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)}};By.exports=function t(e,r){if(uA(e))return e;if(by(e))return xn({readable:e});if(my(e))return xn({writable:e});if(fA(e))return xn({writable:!1,readable:!1});if(wy(e))return xn({readable:Iy.fromWeb(e)});if(gy(e))return xn({writable:hA.fromWeb(e)});if(typeof e=="function"){let{value:i,write:o,final:s,destroy:a}=bA(e);if(yy(i))return _y(er,i,{objectMode:!0,write:o,final:s,destroy:a});let f=i?.then;if(typeof f=="function"){let c,u=vy(f,i,l=>{if(l!=null)throw new Ey("nully","body",l)},l=>{En(c,l)});return c=new er({objectMode:!0,readable:!1,write:o,final(l){s(async()=>{try{await u,eu.nextTick(l,null)}catch(p){eu.nextTick(l,p)}})},destroy:a})}throw new Ey("Iterable, AsyncIterable or AsyncFunction",r,i)}if(pA(e))return t(e.arrayBuffer());if(yy(e))return _y(er,e,{objectMode:!0,writable:!1});if(wy(e?.readable)&&gy(e?.writable))return er.fromWeb(e);if(typeof e?.writable=="object"||typeof e?.readable=="object"){let i=e!=null&&e.readable?by(e?.readable)?e?.readable:t(e.readable):void 0,o=e!=null&&e.writable?my(e?.writable)?e?.writable:t(e.writable):void 0;return xn({readable:i,writable:o})}let n=e?.then;if(typeof n=="function"){let i;return vy(n,e,o=>{o!=null&&i.push(o),i.push(null)},o=>{En(i,o)}),i=new er({objectMode:!0,writable:!1,read(){}})}throw new lA(r,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],e)};function bA(t){let{promise:e,resolve:r}=Sy(),n=new yA,i=n.signal;return{value:t((async function*(){for(;;){let s=e;e=null;let{chunk:a,done:f,cb:c}=await s;if(eu.nextTick(c),f)return;if(i.aborted)throw new Ty(void 0,{cause:i.reason});({promise:e,resolve:r}=Sy()),yield a}})(),{signal:i}),write(s,a,f){let c=r;r=null,c({chunk:s,done:!1,cb:f})},final(s){let a=r;r=null,a({done:!0,cb:s})},destroy(s,a){n.abort(),a(s)}}}function xn(t){let e=t.readable&&typeof t.readable.read!="function"?Iy.wrap(t.readable):t.readable,r=t.writable,n=!!aA(e),i=!!cA(r),o,s,a,f,c;function u(l){let p=f;f=null,p?p(l):l&&c.destroy(l)}return c=new er({readableObjectMode:!!(e!=null&&e.readableObjectMode),writableObjectMode:!!(r!=null&&r.writableObjectMode),readable:n,writable:i}),i&&(xy(r,l=>{i=!1,l&&En(e,l),u(l)}),c._write=function(l,p,d){r.write(l,p)?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&&(xy(e,l=>{n=!1,l&&En(e,l),u(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,p){!l&&f!==null&&(l=new Ty),a=null,o=null,s=null,f===null?p(l):(f=p,En(r,l),En(e,l))},c}});var ut=j((x5,Dy)=>{"use strict";var{ObjectDefineProperties:mA,ObjectGetOwnPropertyDescriptor:Bt,ObjectKeys:wA,ObjectSetPrototypeOf:Cy}=X();Dy.exports=Ze;var nu=bi(),ke=fs();Cy(Ze.prototype,nu.prototype);Cy(Ze,nu);{let t=wA(ke.prototype);for(let e=0;e<t.length;e++){let r=t[e];Ze.prototype[r]||(Ze.prototype[r]=ke.prototype[r])}}function Ze(t){if(!(this instanceof Ze))return new Ze(t);nu.call(this,t),ke.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}mA(Ze.prototype,{writable:{__proto__:null,...Bt(ke.prototype,"writable")},writableHighWaterMark:{__proto__:null,...Bt(ke.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...Bt(ke.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...Bt(ke.prototype,"writableBuffer")},writableLength:{__proto__:null,...Bt(ke.prototype,"writableLength")},writableFinished:{__proto__:null,...Bt(ke.prototype,"writableFinished")},writableCorked:{__proto__:null,...Bt(ke.prototype,"writableCorked")},writableEnded:{__proto__:null,...Bt(ke.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...Bt(ke.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 tu;function Ly(){return tu===void 0&&(tu={}),tu}Ze.fromWeb=function(t,e){return Ly().newStreamDuplexFromReadableWritablePair(t,e)};Ze.toWeb=function(t){return Ly().newReadableWritablePairFromDuplex(t)};var ru;Ze.from=function(t){return ru||(ru=Ry()),ru(t,"body")}});var su=j((E5,Uy)=>{"use strict";var{ObjectSetPrototypeOf:Oy,Symbol:gA}=X();Uy.exports=Rt;var{ERR_METHOD_NOT_IMPLEMENTED:xA}=ve().codes,ou=ut(),{getHighWaterMark:EA}=hi();Oy(Rt.prototype,ou.prototype);Oy(Rt,ou);var xi=gA("kCallback");function Rt(t){if(!(this instanceof Rt))return new Rt(t);let e=t?EA(this,t,"readableHighWaterMark",!0):null;e===0&&(t={...t,highWaterMark:null,readableHighWaterMark:e,writableHighWaterMark:t.writableHighWaterMark||0}),ou.call(this,t),this._readableState.sync=!1,this[xi]=null,t&&(typeof t.transform=="function"&&(this._transform=t.transform),typeof t.flush=="function"&&(this._flush=t.flush)),this.on("prefinish",SA)}function iu(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 SA(){this._final!==iu&&iu.call(this)}Rt.prototype._final=iu;Rt.prototype._transform=function(t,e,r){throw new xA("_transform()")};Rt.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[xi]=r})};Rt.prototype._read=function(){if(this[xi]){let t=this[xi];this[xi]=null,t()}}});var cu=j((S5,Py)=>{"use strict";var{ObjectSetPrototypeOf:Ny}=X();Py.exports=Sn;var au=su();Ny(Sn.prototype,au.prototype);Ny(Sn,au);function Sn(t){if(!(this instanceof Sn))return new Sn(t);au.call(this,t)}Sn.prototype._transform=function(t,e,r){r(null,t)}});var hs=j((_5,$y)=>{var Ei=Xt(),{ArrayIsArray:_A,Promise:AA,SymbolAsyncIterator:vA,SymbolDispose:TA}=X(),ds=It(),{once:IA}=Re(),BA=xr(),Fy=ut(),{aggregateTwoErrors:RA,codes:{ERR_INVALID_ARG_TYPE:mu,ERR_INVALID_RETURN_VALUE:fu,ERR_MISSING_ARGS:CA,ERR_STREAM_DESTROYED:LA,ERR_STREAM_PREMATURE_CLOSE:DA},AbortError:OA}=ve(),{validateFunction:UA,validateAbortSignal:NA}=dn(),{isIterable:Ar,isReadable:uu,isReadableNodeStream:ls,isNodeStream:ky,isTransformStream:_n,isWebStream:PA,isReadableStream:lu,isReadableFinished:FA}=at(),kA=globalThis.AbortController||fn().AbortController,du,hu,pu;function My(t,e,r){let n=!1;t.on("close",()=>{n=!0});let i=ds(t,{readable:e,writable:r},o=>{n=!o});return{destroy:o=>{n||(n=!0,BA.destroyer(t,o||new LA("pipe")))},cleanup:i}}function MA(t){return UA(t[t.length-1],"streams[stream.length - 1]"),t.pop()}function yu(t){if(Ar(t))return t;if(ls(t))return qA(t);throw new mu("val",["Readable","Iterable","AsyncIterable"],t)}async function*qA(t){hu||(hu=bi()),yield*hu.prototype[vA].call(t)}async function us(t,e,r,{end:n}){let i,o=null,s=c=>{if(c&&(i=c),o){let u=o;o=null,u()}},a=()=>new AA((c,u)=>{i?u(i):o=()=>{i?u(i):c()}});e.on("drain",s);let f=ds(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?RA(i,c):c)}finally{f(),e.off("drain",s)}}async function bu(t,e,r,{end:n}){_n(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 $A(...t){return qy(t,IA(MA(t)))}function qy(t,e,r){if(t.length===1&&_A(t[0])&&(t=t[0]),t.length<2)throw new CA("streams");let n=new kA,i=n.signal,o=r?.signal,s=[];NA(o,"options.signal");function a(){y(new OA)}pu=pu||Re().addAbortListener;let f;o&&(f=pu(o,a));let c,u,l=[],p=0;function d(S){y(S,--p===0)}function y(S,_){var T;if(S&&(!c||c.code==="ERR_STREAM_PREMATURE_CLOSE")&&(c=S),!(!c&&!_)){for(;l.length;)l.shift()(c);(T=f)===null||T===void 0||T[TA](),n.abort(),_&&(c||s.forEach(N=>N()),Ei.nextTick(e,c,u))}}let h;for(let S=0;S<t.length;S++){let _=t[S],T=S<t.length-1,N=S>0,R=T||r?.end!==!1,I=S===t.length-1;if(ky(_)){let O=function(q){q&&q.name!=="AbortError"&&q.code!=="ERR_STREAM_PREMATURE_CLOSE"&&d(q)};var x=O;if(R){let{destroy:q,cleanup:k}=My(_,T,N);l.push(q),uu(_)&&I&&s.push(k)}_.on("error",O),uu(_)&&I&&s.push(()=>{_.removeListener("error",O)})}if(S===0)if(typeof _=="function"){if(h=_({signal:i}),!Ar(h))throw new fu("Iterable, AsyncIterable or Stream","source",h)}else Ar(_)||ls(_)||_n(_)?h=_:h=Fy.from(_);else if(typeof _=="function"){if(_n(h)){var b;h=yu((b=h)===null||b===void 0?void 0:b.readable)}else h=yu(h);if(h=_(h,{signal:i}),T){if(!Ar(h,!0))throw new fu("AsyncIterable",`transform[${S-1}]`,h)}else{var m;du||(du=cu());let O=new du({objectMode:!0}),q=(m=h)===null||m===void 0?void 0:m.then;if(typeof q=="function")p++,q.call(h,E=>{u=E,E!=null&&O.write(E),R&&O.end(),Ei.nextTick(d)},E=>{O.destroy(E),Ei.nextTick(d,E)});else if(Ar(h,!0))p++,us(h,O,d,{end:R});else if(lu(h)||_n(h)){let E=h.readable||h;p++,us(E,O,d,{end:R})}else throw new fu("AsyncIterable or Promise","destination",h);h=O;let{destroy:k,cleanup:w}=My(h,!1,!0);l.push(k),I&&s.push(w)}}else if(ky(_)){if(ls(h)){p+=2;let O=HA(h,_,d,{end:R});uu(_)&&I&&s.push(O)}else if(_n(h)||lu(h)){let O=h.readable||h;p++,us(O,_,d,{end:R})}else if(Ar(h))p++,us(h,_,d,{end:R});else throw new mu("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=_}else if(PA(_)){if(ls(h))p++,bu(yu(h),_,d,{end:R});else if(lu(h)||Ar(h))p++,bu(h,_,d,{end:R});else if(_n(h))p++,bu(h.readable,_,d,{end:R});else throw new mu("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=_}else h=Fy.from(_)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&Ei.nextTick(a),h}function HA(t,e,r,{end:n}){let i=!1;if(e.on("close",()=>{i||r(new DA)}),t.pipe(e,{end:!1}),n){let s=function(){i=!0,e.end()};var o=s;FA(t)?Ei.nextTick(s):t.once("end",s)}else r();return ds(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)}),ds(e,{readable:!1,writable:!0},r)}$y.exports={pipelineImpl:qy,pipeline:$A}});var gu=j((A5,zy)=>{"use strict";var{pipeline:KA}=hs(),ps=ut(),{destroyer:VA}=xr(),{isNodeStream:ys,isReadable:Hy,isWritable:Ky,isWebStream:wu,isTransformStream:vr,isWritableStream:Vy,isReadableStream:jy}=at(),{AbortError:jA,codes:{ERR_INVALID_ARG_VALUE:Wy,ERR_MISSING_ARGS:WA}}=ve(),zA=It();zy.exports=function(...e){if(e.length===0)throw new WA("streams");if(e.length===1)return ps.from(e[0]);let r=[...e];if(typeof e[0]=="function"&&(e[0]=ps.from(e[0])),typeof e[e.length-1]=="function"){let d=e.length-1;e[d]=ps.from(e[d])}for(let d=0;d<e.length;++d)if(!(!ys(e[d])&&!wu(e[d]))){if(d<e.length-1&&!(Hy(e[d])||jy(e[d])||vr(e[d])))throw new Wy(`streams[${d}]`,r[d],"must be readable");if(d>0&&!(Ky(e[d])||Vy(e[d])||vr(e[d])))throw new Wy(`streams[${d}]`,r[d],"must be writable")}let n,i,o,s,a;function f(d){let y=s;s=null,y?y(d):d?a.destroy(d):!p&&!l&&a.destroy()}let c=e[0],u=KA(e,f),l=!!(Ky(c)||Vy(c)||vr(c)),p=!!(Hy(u)||jy(u)||vr(u));if(a=new ps({writableObjectMode:!!(c!=null&&c.writableObjectMode),readableObjectMode:!!(u!=null&&u.readableObjectMode),writable:l,readable:p}),l){if(ys(c))a._write=function(y,h,b){c.write(y,h)?b():n=b},a._final=function(y){c.end(),i=y},c.on("drain",function(){if(n){let y=n;n=null,y()}});else if(wu(c)){let h=(vr(c)?c.writable:c).getWriter();a._write=async function(b,m,x){try{await h.ready,h.write(b).catch(()=>{}),x()}catch(S){x(S)}},a._final=async function(b){try{await h.ready,h.close().catch(()=>{}),i=b}catch(m){b(m)}}}let d=vr(u)?u.readable:u;zA(d,()=>{if(i){let y=i;i=null,y()}})}if(p){if(ys(u))u.on("readable",function(){if(o){let d=o;o=null,d()}}),u.on("end",function(){a.push(null)}),a._read=function(){for(;;){let d=u.read();if(d===null){o=a._read;return}if(!a.push(d))return}};else if(wu(u)){let y=(vr(u)?u.readable:u).getReader();a._read=async function(){for(;;)try{let{value:h,done:b}=await y.read();if(!a.push(h))return;if(b){a.push(null);return}}catch{return}}}}return a._destroy=function(d,y){!d&&s!==null&&(d=new jA),o=null,n=null,i=null,s===null?y(d):(s=y,ys(u)&&VA(u,d))},a}});var nb=j((v5,Su)=>{"use strict";var GA=globalThis.AbortController||fn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:YA,ERR_INVALID_ARG_TYPE:Si,ERR_MISSING_ARGS:ZA,ERR_OUT_OF_RANGE:XA},AbortError:lt}=ve(),{validateAbortSignal:Tr,validateInteger:Gy,validateObject:Ir}=dn(),QA=X().Symbol("kWeak"),JA=X().Symbol("kResistStopPropagation"),{finished:e8}=It(),t8=gu(),{addAbortSignalNoValidate:r8}=di(),{isWritable:n8,isNodeStream:i8}=at(),{deprecate:o8}=Re(),{ArrayPrototypePush:s8,Boolean:a8,MathFloor:Yy,Number:c8,NumberIsNaN:f8,Promise:Zy,PromiseReject:Xy,PromiseResolve:u8,PromisePrototypeThen:Qy,Symbol:eb}=X(),bs=eb("kEmpty"),Jy=eb("kEof");function l8(t,e){if(e!=null&&Ir(e,"options"),e?.signal!=null&&Tr(e.signal,"options.signal"),i8(t)&&!n8(t))throw new YA("stream",t,"must be writable");let r=t8(this,t);return e!=null&&e.signal&&r8(e.signal,r),r}function ms(t,e){if(typeof t!="function")throw new Si("fn",["Function","AsyncFunction"],t);e!=null&&Ir(e,"options"),e?.signal!=null&&Tr(e.signal,"options.signal");let r=1;e?.concurrency!=null&&(r=Yy(e.concurrency));let n=r-1;return e?.highWaterMark!=null&&(n=Yy(e.highWaterMark)),Gy(r,"options.concurrency",1),Gy(n,"options.highWaterMark",0),n+=r,async function*(){let o=Re().AbortSignalAny([e?.signal].filter(a8)),s=this,a=[],f={signal:o},c,u,l=!1,p=0;function d(){l=!0,y()}function y(){p-=1,h()}function h(){u&&!l&&p<r&&a.length<n&&(u(),u=null)}async function b(){try{for await(let m of s){if(l)return;if(o.aborted)throw new lt;try{if(m=t(m,f),m===bs)continue;m=u8(m)}catch(x){m=Xy(x)}p+=1,Qy(m,y,d),a.push(m),c&&(c(),c=null),!l&&(a.length>=n||p>=r)&&await new Zy(x=>{u=x})}a.push(Jy)}catch(m){let x=Xy(m);Qy(x,y,d),a.push(x)}finally{l=!0,c&&(c(),c=null)}}b();try{for(;;){for(;a.length>0;){let m=await a[0];if(m===Jy)return;if(o.aborted)throw new lt;m!==bs&&(yield m),a.shift(),h()}await new Zy(m=>{c=m})}}finally{l=!0,u&&(u(),u=null)}}.call(this)}function d8(t=void 0){return t!=null&&Ir(t,"options"),t?.signal!=null&&Tr(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 tb(t,e=void 0){for await(let r of Eu.call(this,t,e))return!0;return!1}async function h8(t,e=void 0){if(typeof t!="function")throw new Si("fn",["Function","AsyncFunction"],t);return!await tb.call(this,async(...r)=>!await t(...r),e)}async function p8(t,e){for await(let r of Eu.call(this,t,e))return r}async function y8(t,e){if(typeof t!="function")throw new Si("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i),bs}for await(let n of ms.call(this,r,e));}function Eu(t,e){if(typeof t!="function")throw new Si("fn",["Function","AsyncFunction"],t);async function r(n,i){return await t(n,i)?n:bs}return ms.call(this,r,e)}var xu=class extends ZA{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}};async function b8(t,e,r){var n;if(typeof t!="function")throw new Si("reducer",["Function","AsyncFunction"],t);r!=null&&Ir(r,"options"),r?.signal!=null&&Tr(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 e8(this.destroy(c)),c}let o=new GA,s=o.signal;if(r!=null&&r.signal){let c={once:!0,[QA]:this,[JA]:!0};r.signal.addEventListener("abort",()=>o.abort(),c)}let a=!1;try{for await(let c of this){var f;if(a=!0,r!=null&&(f=r.signal)!==null&&f!==void 0&&f.aborted)throw new lt;i?e=await t(e,c,{signal:s}):(e=c,i=!0)}if(!a&&!i)throw new xu}finally{o.abort()}return e}async function m8(t){t!=null&&Ir(t,"options"),t?.signal!=null&&Tr(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});s8(e,n)}return e}function w8(t,e){let r=ms.call(this,t,e);return async function*(){for await(let i of r)yield*i}.call(this)}function rb(t){if(t=c8(t),f8(t))return 0;if(t<0)throw new XA("number",">= 0",t);return t}function g8(t,e=void 0){return e!=null&&Ir(e,"options"),e?.signal!=null&&Tr(e.signal,"options.signal"),t=rb(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 x8(t,e=void 0){return e!=null&&Ir(e,"options"),e?.signal!=null&&Tr(e.signal,"options.signal"),t=rb(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)}Su.exports.streamReturningOperators={asIndexedPairs:o8(d8,"readable.asIndexedPairs will be removed in a future version."),drop:g8,filter:Eu,flatMap:w8,map:ms,take:x8,compose:l8};Su.exports.promiseReturningOperators={every:h8,forEach:y8,reduce:b8,toArray:m8,some:tb,find:p8}});var _u=j((T5,ib)=>{"use strict";var{ArrayPrototypePop:E8,Promise:S8}=X(),{isIterable:_8,isNodeStream:A8,isWebStream:v8}=at(),{pipelineImpl:T8}=hs(),{finished:I8}=It();Au();function B8(...t){return new S8((e,r)=>{let n,i,o=t[t.length-1];if(o&&typeof o=="object"&&!A8(o)&&!_8(o)&&!v8(o)){let s=E8(t);n=s.signal,i=s.end}T8(t,(s,a)=>{s?r(s):e(a)},{signal:n,end:i})})}ib.exports={finished:I8,pipeline:B8}});var Au=j((I5,hb)=>{"use strict";var{Buffer:R8}=At(),{ObjectDefineProperty:Ct,ObjectKeys:ab,ReflectApply:cb}=X(),{promisify:{custom:fb}}=Re(),{streamReturningOperators:ob,promiseReturningOperators:sb}=nb(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:ub}}=ve(),C8=gu(),{setDefaultHighWaterMark:L8,getDefaultHighWaterMark:D8}=hi(),{pipeline:lb}=hs(),{destroyer:O8}=xr(),db=It(),vu=_u(),_i=at(),Y=hb.exports=Zo().Stream;Y.isDestroyed=_i.isDestroyed;Y.isDisturbed=_i.isDisturbed;Y.isErrored=_i.isErrored;Y.isReadable=_i.isReadable;Y.isWritable=_i.isWritable;Y.Readable=bi();for(let t of ab(ob)){let r=function(...n){if(new.target)throw ub();return Y.Readable.from(cb(e,this,n))},e=ob[t];Ct(r,"name",{__proto__:null,value:e.name}),Ct(r,"length",{__proto__:null,value:e.length}),Ct(Y.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}for(let t of ab(sb)){let r=function(...n){if(new.target)throw ub();return cb(e,this,n)},e=sb[t];Ct(r,"name",{__proto__:null,value:e.name}),Ct(r,"length",{__proto__:null,value:e.length}),Ct(Y.Readable.prototype,t,{__proto__:null,value:r,enumerable:!1,configurable:!0,writable:!0})}Y.Writable=fs();Y.Duplex=ut();Y.Transform=su();Y.PassThrough=cu();Y.pipeline=lb;var{addAbortSignal:U8}=di();Y.addAbortSignal=U8;Y.finished=db;Y.destroy=O8;Y.compose=C8;Y.setDefaultHighWaterMark=L8;Y.getDefaultHighWaterMark=D8;Ct(Y,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return vu}});Ct(lb,fb,{__proto__:null,enumerable:!0,get(){return vu.pipeline}});Ct(db,fb,{__proto__:null,enumerable:!0,get(){return vu.finished}});Y.Stream=Y;Y._isUint8Array=function(e){return e instanceof Uint8Array};Y._uint8ArrayToBuffer=function(e){return R8.from(e.buffer,e.byteOffset,e.byteLength)}});var pb=j((B5,se)=>{"use strict";var de=Au(),N8=_u(),P8=de.Readable.destroy;se.exports=de.Readable;se.exports._uint8ArrayToBuffer=de._uint8ArrayToBuffer;se.exports._isUint8Array=de._isUint8Array;se.exports.isDisturbed=de.isDisturbed;se.exports.isErrored=de.isErrored;se.exports.isReadable=de.isReadable;se.exports.Readable=de.Readable;se.exports.Writable=de.Writable;se.exports.Duplex=de.Duplex;se.exports.Transform=de.Transform;se.exports.PassThrough=de.PassThrough;se.exports.addAbortSignal=de.addAbortSignal;se.exports.finished=de.finished;se.exports.destroy=de.destroy;se.exports.destroy=P8;se.exports.pipeline=de.pipeline;se.exports.compose=de.compose;Object.defineProperty(de,"promises",{configurable:!0,enumerable:!0,get(){return N8}});se.exports.Stream=de.Stream;se.exports.default=se.exports});var e6={};G(e6,{BAD_REQUEST:()=>V8,INTERNAL_SERVER_ERROR:()=>j8,Libp2pSocket:()=>ws,NOT_FOUND_RESPONSE:()=>K8,NOT_IMPLEMENTED_ERROR:()=>W8,Request:()=>ci,Response:()=>Jc,STATUS_CODES:()=>Qc,getHeader:()=>Y8,getHeaders:()=>fi,getHost:()=>xb,getServerUpgradeHeaders:()=>Q8,isWebSocketUpgrade:()=>Xc,normalizeMethod:()=>Z8,normalizeUrl:()=>Sb,readHeaders:()=>J8,responseToStream:()=>H8,streamToRequest:()=>$8,streamToSocket:()=>F8,stripHTTPPath:()=>Eb,toResource:()=>G8,toURL:()=>M8,toUint8Array:()=>q8,writeHeaders:()=>gb});var _s={};G(_s,{base10:()=>Pb});var r6=new Uint8Array(0);function Ru(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 Cu(t){return new TextEncoder().encode(t)}function Lu(t){return new TextDecoder().decode(t)}function Cb(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var h=0,b=0,m=0,x=y.length;m!==x&&y[m]===0;)m++,h++;for(var S=(x-m)*u+1>>>0,_=new Uint8Array(S);m!==x;){for(var T=y[m],N=0,R=S-1;(T!==0||N<b)&&R!==-1;R--,N++)T+=256*_[R]>>>0,_[R]=T%a>>>0,T=T/a>>>0;if(T!==0)throw new Error("Non-zero carry");b=N,m++}for(var I=S-b;I!==S&&_[I]===0;)I++;for(var O=f.repeat(h);I<S;++I)O+=t.charAt(_[I]);return O}function p(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var h=0;if(y[h]!==" "){for(var b=0,m=0;y[h]===f;)b++,h++;for(var x=(y.length-h)*c+1>>>0,S=new Uint8Array(x);y[h];){var _=r[y.charCodeAt(h)];if(_===255)return;for(var T=0,N=x-1;(_!==0||T<m)&&N!==-1;N--,T++)_+=a*S[N]>>>0,S[N]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");m=T,h++}if(y[h]!==" "){for(var R=x-m;R!==x&&S[R]===0;)R++;for(var I=new Uint8Array(b+(x-R)),O=b;R!==x;)I[O++]=S[R++];return I}}}function d(y){var h=p(y);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:d}}var Lb=Cb,Db=Lb,Ou=Db;var gs=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")}},xs=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 Uu(this,e)}},Es=class{decoders;constructor(e){this.decoders=e}or(e){return Uu(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 Uu(t,e){return new Es({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var Ss=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 gs(e,r,n),this.decoder=new xs(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Rr({name:t,prefix:e,encode:r,decode:n}){return new Ss(t,e,r,n)}function Lt({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=Ou(r,t);return Rr({prefix:e,name:t,encode:n,decode:o=>dt(i(o))})}function Ob(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,f=0;for(let c=0;c<i;++c){let u=e[t[c]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|u,s+=r,s>=8&&(s-=8,o[f++]=255&a>>s)}if(s>=r||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function Ub(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],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 Nb(t){let e={};for(let r=0;r<t.length;++r)e[t[r]]=r;return e}function ee({name:t,prefix:e,bitsPerChar:r,alphabet:n}){let i=Nb(n);return Rr({prefix:e,name:t,encode(o){return Ub(o,n,r)},decode(o){return Ob(o,i,r,t)}})}var Pb=Lt({prefix:"9",name:"base10",alphabet:"0123456789"});var As={};G(As,{base16:()=>Fb,base16upper:()=>kb});var Fb=ee({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),kb=ee({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var vs={};G(vs,{base2:()=>Mb});var Mb=ee({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var Ts={};G(Ts,{base256emoji:()=>Vb});var Nu=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}"),qb=Nu.reduce((t,e,r)=>(t[r]=e,t),[]),$b=Nu.reduce((t,e,r)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return t[n]=r,t},[]);function Hb(t){return t.reduce((e,r)=>(e+=qb[r],e),"")}function Kb(t){let e=[];for(let r of t){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let i=$b[n];if(i==null)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}var Vb=Rr({prefix:"\u{1F680}",name:"base256emoji",encode:Hb,decode:Kb});var Is={};G(Is,{base32:()=>Cr,base32hex:()=>Gb,base32hexpad:()=>Zb,base32hexpadupper:()=>Xb,base32hexupper:()=>Yb,base32pad:()=>Wb,base32padupper:()=>zb,base32upper:()=>jb,base32z:()=>Qb});var Cr=ee({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),jb=ee({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wb=ee({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),zb=ee({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Gb=ee({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yb=ee({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zb=ee({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Xb=ee({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Qb=ee({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Bs={};G(Bs,{base36:()=>vn,base36upper:()=>Jb});var vn=Lt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Jb=Lt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Rs={};G(Rs,{base58btc:()=>Xe,base58flickr:()=>em});var Xe=Lt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),em=Lt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Cs={};G(Cs,{base64:()=>tm,base64pad:()=>rm,base64url:()=>nm,base64urlpad:()=>im});var tm=ee({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),rm=ee({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),nm=ee({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),im=ee({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ls={};G(Ls,{base8:()=>om});var om=ee({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Ds={};G(Ds,{identity:()=>sm});var sm=Rr({prefix:"\0",name:"identity",encode:t=>Lu(t),decode:t=>Cu(t)});var w6=new TextEncoder,g6=new TextDecoder;var Us={};G(Us,{identity:()=>Rm});var fm=ku,Pu=128,um=127,lm=~um,dm=Math.pow(2,31);function ku(t,e,r){e=e||[],r=r||0;for(var n=r;t>=dm;)e[r++]=t&255|Pu,t/=128;for(;t&lm;)e[r++]=t&255|Pu,t>>>=7;return e[r]=t|0,ku.bytes=r-n+1,e}var hm=Os,pm=128,Fu=127;function Os(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw Os.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&Fu)<<i:(s&Fu)*Math.pow(2,i),i+=7}while(s>=pm);return Os.bytes=o-n,r}var ym=Math.pow(2,7),bm=Math.pow(2,14),mm=Math.pow(2,21),wm=Math.pow(2,28),gm=Math.pow(2,35),xm=Math.pow(2,42),Em=Math.pow(2,49),Sm=Math.pow(2,56),_m=Math.pow(2,63),Am=function(t){return t<ym?1:t<bm?2:t<mm?3:t<wm?4:t<gm?5:t<xm?6:t<Em?7:t<Sm?8:t<_m?9:10},vm={encode:fm,decode:hm,encodingLength:Am},Tm=vm,Tn=Tm;function In(t,e=0){return[Tn.decode(t,e),Tn.decode.bytes]}function Lr(t,e,r=0){return Tn.encode(t,e,r),e}function Dr(t){return Tn.encodingLength(t)}function Ur(t,e){let r=e.byteLength,n=Dr(t),i=n+Dr(r),o=new Uint8Array(i+r);return Lr(t,o,0),Lr(r,o,n),o.set(e,i),new Or(t,r,e,o)}function Mu(t){let e=dt(t),[r,n]=In(e),[i,o]=In(e.subarray(n)),s=e.subarray(n+o);if(s.byteLength!==i)throw new Error("Incorrect length");return new Or(r,i,s,e)}function qu(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&Ru(t.bytes,r.bytes)}}var Or=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=n,this.bytes=i}};var $u=0,Im="identity",Hu=dt;function Bm(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 Ur($u,Hu(t))}var Rm={code:$u,name:Im,encode:Hu,digest:Bm};var Fs={};G(Fs,{sha256:()=>Lm,sha512:()=>Dm});var Cm=20;function Ps({name:t,code:e,encode:r,minDigestLength:n,maxDigestLength:i}){return new Ns(t,e,r,n,i)}var Ns=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,r,n,i,o){this.name=e,this.code=r,this.encode=n,this.minDigestLength=i??Cm,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?Ku(n,this.code,r?.truncate):n.then(i=>Ku(i,this.code,r?.truncate))}else throw Error("Unknown type, must be binary type")}};function Ku(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 Ur(e,t)}function ju(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Lm=Ps({name:"sha2-256",code:18,encode:ju("SHA-256")}),Dm=Ps({name:"sha2-512",code:19,encode:ju("SHA-512")});function Wu(t,e){let{bytes:r,version:n}=t;return n===0?Um(r,ks(t),e??Xe.encoder):Nm(r,ks(t),e??Cr.encoder)}var zu=new WeakMap;function ks(t){let e=zu.get(t);if(e==null){let r=new Map;return zu.set(t,r),r}return e}var Bi=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!==Rn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Pm)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=Ur(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&&qu(e.multihash,n.multihash)}toString(e){return Wu(this,e)}toJSON(){return{"/":Wu(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??Gu(n,i,o.bytes))}else if(r[Fm]===!0){let{version:n,multihash:i,code:o}=r,s=Mu(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!==Rn)throw new Error(`Version 0 CID must use dag-pb (code: ${Rn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=Gu(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Rn,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 Or(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,p]=In(e.subarray(r));return r+=p,l},i=n(),o=Rn;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=Om(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 ks(o).set(n,e),o}};function Om(t,e){switch(t[0]){case"Q":{let r=e??Xe;return[Xe.prefix,r.decode(`${Xe.prefix}${t}`)]}case Xe.prefix:{let r=e??Xe;return[Xe.prefix,r.decode(t)]}case Cr.prefix:{let r=e??Cr;return[Cr.prefix,r.decode(t)]}case vn.prefix:{let r=e??vn;return[vn.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 Um(t,e,r){let{prefix:n}=r;if(n!==Xe.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 Nm(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 Rn=112,Pm=18;function Gu(t,e,r){let n=Dr(t),i=n+Dr(e),o=new Uint8Array(i+r.byteLength);return Lr(t,o,0),Lr(e,o,n),o.set(r,i),o}var Fm=Symbol.for("@ipld/js-cid/CID");var Ms={...Ds,...vs,...Ls,..._s,...As,...Is,...Bs,...Rs,...Cs,...Ts},$6={...Fs,...Us};function Yu(t=0){return new Uint8Array(t)}function Xu(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Zu=Xu("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),qs=Xu("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=Yu(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),km={utf8:Zu,"utf-8":Zu,hex:Ms.base16,latin1:qs,ascii:qs,binary:qs,...Ms},Ri=km;function $s(t,e="utf8"){let r=Ri[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}function U(t){if(t!==void 0&&t!==U.REQUEST&&t!==U.RESPONSE)throw new Error("type must be REQUEST or RESPONSE");t===void 0||this.initialize(t),this.maxHeaderSize=U.maxHeaderSize}U.prototype.initialize=function(t,e){if(t!==U.REQUEST&&t!==U.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};U.encoding="ascii";U.maxHeaderSize=80*1024;U.REQUEST="REQUEST";U.RESPONSE="RESPONSE";var Qu=U.kOnHeaders=1,Hs=U.kOnHeadersComplete=2,Ci=U.kOnBody=3,Ks=U.kOnMessageComplete=4;U.prototype[Qu]=U.prototype[Hs]=U.prototype[Ci]=U.prototype[Ks]=function(){};var Ju=!0;Object.defineProperty(U,"kOnExecute",{get:function(){return Ju=!1,99}});var el=U.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"],tl=el.indexOf("CONNECT");U.prototype.reinitialize=U;U.prototype.close=U.prototype.pause=U.prototype.resume=U.prototype.remove=U.prototype.free=function(){};U.prototype._compatMode0_11=!1;U.prototype.getAsyncId=function(){return 0};var Mm={REQUEST_LINE:!0,RESPONSE_LINE:!0,HEADER:!0};U.prototype.execute=function(t,e,r){if(!(this instanceof U))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,Mm[this.state]&&(this.headerSize+=r,this.headerSize>(this.maxHeaderSize||U.maxHeaderSize))?new Error("max header size exceeded"):r};var qm={REQUEST_LINE:!0,RESPONSE_LINE:!0,BODY_RAW:!0};U.prototype.finish=function(){if(!this.hadError){if(!qm[this.state])return new Error("invalid state for EOF");this.state==="BODY_RAW"&&this.userCall()(this[Ks]())}};U.prototype.consume=U.prototype.unconsume=U.prototype.getCurrentBuffer=function(){};U.prototype.userCall=function(){this.isUserCall=!0;var t=this;return function(e){return t.isUserCall=!1,e}};U.prototype.nextRequest=function(){this.userCall()(this[Ks]()),this.reinitialize(this.type)};U.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+$s(e.subarray(this.offset,r),U.encoding);return n.charAt(n.length-1)==="\r"&&(n=n.substr(0,n.length-1)),this.line="",this.offset=r+1,n}this.line+=$s(e.subarray(this.offset,this.end),U.encoding),this.offset=this.end};var $m=/^([^: \t]+):[ \t]*((?:.*[^ \t])|)/,Hm=/^[ \t]+(.*[^ \t])/;U.prototype.parseHeader=function(t,e){if(t.indexOf("\r")!==-1)throw Li("HPE_LF_EXPECTED");var r=$m.exec(t),n=r&&r[1];if(n)e.push(n),e.push(r[2]);else{var i=Hm.exec(t);i&&e.length&&(e[e.length-1]&&(e[e.length-1]+=" "),e[e.length-1]+=i[1])}};var Km=/^([A-Z-]+) ([^ ]+) HTTP\/(\d)\.(\d)$/;U.prototype.REQUEST_LINE=function(){var t=this.consumeLine();if(t){var e=Km.exec(t);if(e===null)throw Li("HPE_INVALID_CONSTANT");if(this.info.method=this._compatMode0_11?e[1]:el.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 Vm=/^HTTP\/(\d)\.(\d) (\d{3}) ?(.*)$/;U.prototype.RESPONSE_LINE=function(){var t=this.consumeLine();if(t){var e=Vm.exec(t);if(e===null)throw Li("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"}};U.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)};U.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 Li("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===U.REQUEST||e.statusCode===101:e.upgrade=e.method===tl,this.isChunked&&e.upgrade&&(this.isChunked=!1),e.shouldKeepAlive=this.shouldKeepAlive();var a;if(Ju?a=this.userCall()(this[Hs](e)):a=this.userCall()(this[Hs](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"}}}};U.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")};U.prototype.BODY_CHUNK=function(){var t=Math.min(this.end-this.offset,this.body_bytes);this.userCall()(this[Ci](this.chunk.slice(this.offset,this.offset+t),0,t)),this.offset+=t,this.body_bytes-=t,this.body_bytes||(this.state="BODY_CHUNKEMPTYLINE")};U.prototype.BODY_CHUNKEMPTYLINE=function(){var t=this.consumeLine();if(t!==void 0){if(t!=="")throw new Error("Expected empty line");this.state="BODY_CHUNKHEAD"}};U.prototype.BODY_CHUNKTRAILERS=function(){var t=this.consumeLine();t!==void 0&&(t?this.parseHeader(t,this.trailers):(this.trailers.length&&this.userCall()(this[Qu](this.trailers,"")),this.nextRequest()))};U.prototype.BODY_RAW=function(){this.userCall()(this[Ci](this.chunk.slice(this.offset,this.end),0,this.end-this.offset)),this.offset=this.end};U.prototype.BODY_SIZED=function(){var t=Math.min(this.end-this.offset,this.body_bytes);this.userCall()(this[Ci](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=U["kOn"+t];Object.defineProperty(U.prototype,"on"+t,{get:function(){return this[e]},set:function(r){return this._compatMode0_11=!0,tl="CONNECT",this[e]=r}})});function Li(t){var e=new Error("Parse Error");return e.code=t,e}var Ie=class extends Error{static name="InvalidParametersError";constructor(e="Invalid parameters"){super(e),this.name="InvalidParametersError"}},Di=class extends Error{static name="InvalidPublicKeyError";constructor(e="Invalid public key"){super(e),this.name="InvalidPublicKeyError"}};var Oi=class extends Error{static name="InvalidCIDError";constructor(e="Invalid CID"){super(e),this.name="InvalidCIDError"}},Ui=class extends Error{static name="InvalidMultihashError";constructor(e="Invalid Multihash"){super(e),this.name="InvalidMultihashError"}};var Cn=class extends Error{static name="ProtocolError";constructor(e="Protocol error"){super(e),this.name="ProtocolError"}};var Ln=class extends Error{static name="UnsupportedKeyTypeError";constructor(e="Unsupported key type"){super(e),this.name="UnsupportedKeyTypeError"}};var Ni=Symbol.for("@libp2p/peer-id");function rl(t){return!!t?.[Ni]}var Gs={};G(Gs,{base58btc:()=>ae,base58flickr:()=>Qm});var J6=new Uint8Array(0);function nl(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 ht(t){if(t instanceof Uint8Array&&t.constructor.name==="Uint8Array")return tr(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return tr(new Uint8Array(t.buffer,t.byteOffset,t.byteLength));throw new Error("Unknown type, must be binary type")}function il(t){return new TextEncoder().encode(t)}function ol(t){return new TextDecoder().decode(t)}function jm(t){return t?.buffer instanceof ArrayBuffer}function tr(t){return jm(t)?t:t.slice()}function Wm(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,f=t.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function l(y){if(y instanceof Uint8Array||(ArrayBuffer.isView(y)?y=new Uint8Array(y.buffer,y.byteOffset,y.byteLength):Array.isArray(y)&&(y=Uint8Array.from(y))),!(y instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(y.length===0)return"";for(var h=0,b=0,m=0,x=y.length;m!==x&&y[m]===0;)m++,h++;for(var S=(x-m)*u+1>>>0,_=new Uint8Array(S);m!==x;){for(var T=y[m],N=0,R=S-1;(T!==0||N<b)&&R!==-1;R--,N++)T+=256*_[R]>>>0,_[R]=T%a>>>0,T=T/a>>>0;if(T!==0)throw new Error("Non-zero carry");b=N,m++}for(var I=S-b;I!==S&&_[I]===0;)I++;for(var O=f.repeat(h);I<S;++I)O+=t.charAt(_[I]);return O}function p(y){if(typeof y!="string")throw new TypeError("Expected String");if(y.length===0)return new Uint8Array;var h=0;if(y[h]!==" "){for(var b=0,m=0;y[h]===f;)b++,h++;for(var x=(y.length-h)*c+1>>>0,S=new Uint8Array(x);y[h];){var _=r[y.charCodeAt(h)];if(_===255)return;for(var T=0,N=x-1;(_!==0||T<m)&&N!==-1;N--,T++)_+=a*S[N]>>>0,S[N]=_%256>>>0,_=_/256>>>0;if(_!==0)throw new Error("Non-zero carry");m=T,h++}if(y[h]!==" "){for(var R=x-m;R!==x&&S[R]===0;)R++;for(var I=new Uint8Array(b+(x-R)),O=b;R!==x;)I[O++]=S[R++];return I}}}function d(y){var h=p(y);if(h)return h;throw new Error(`Non-${e} character`)}return{encode:l,decodeUnsafe:p,decode:d}}var zm=Wm,Gm=zm,al=Gm;var Vs=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")}},js=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 cl(this,e)}},Ws=class{decoders;constructor(e){this.decoders=e}or(e){return cl(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 cl(t,e){return new Ws({...t.decoders??{[t.prefix]:t},...e.decoders??{[e.prefix]:e}})}var zs=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 Vs(e,r,n),this.decoder=new js(e,r,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};function Nr({name:t,prefix:e,encode:r,decode:n}){return new zs(t,e,r,n)}function Dt({name:t,prefix:e,alphabet:r}){let{encode:n,decode:i}=al(r,t);return Nr({prefix:e,name:t,encode:n,decode:o=>ht(i(o))})}function Ym(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,f=0;for(let c=0;c<i;++c){let u=e[t[c]];if(u===void 0)throw new SyntaxError(`Non-${n} character`);a=a<<r|u,s+=r,s>=8&&(s-=8,o[f++]=255&a>>s)}if(s>=r||(255&a<<8-s)!==0)throw new SyntaxError("Unexpected end of data");return o}function Zm(t,e,r){let n=e[e.length-1]==="=",i=(1<<r)-1,o="",s=0,a=0;for(let f=0;f<t.length;++f)for(a=a<<8|t[f],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 Xm(t){let e={};for(let r=0;r<t.length;++r)e[t[r]]=r;return e}function te({name:t,prefix:e,bitsPerChar:r,alphabet:n}){let i=Xm(n);return Nr({prefix:e,name:t,encode(o){return Zm(o,n,r)},decode(o){return Ym(o,i,r,t)}})}var ae=Dt({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Qm=Dt({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ys={};G(Ys,{base32:()=>Ot,base32hex:()=>rw,base32hexpad:()=>iw,base32hexpadupper:()=>ow,base32hexupper:()=>nw,base32pad:()=>ew,base32padupper:()=>tw,base32upper:()=>Jm,base32z:()=>sw});var Ot=te({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Jm=te({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ew=te({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),tw=te({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),rw=te({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),nw=te({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),iw=te({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ow=te({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),sw=te({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Zs={};G(Zs,{base36:()=>rr,base36upper:()=>aw});var rr=Dt({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),aw=Dt({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var cw=ll,fl=128,fw=127,uw=~fw,lw=Math.pow(2,31);function ll(t,e,r){e=e||[],r=r||0;for(var n=r;t>=lw;)e[r++]=t&255|fl,t/=128;for(;t&uw;)e[r++]=t&255|fl,t>>>=7;return e[r]=t|0,ll.bytes=r-n+1,e}var dw=Xs,hw=128,ul=127;function Xs(t,n){var r=0,n=n||0,i=0,o=n,s,a=t.length;do{if(o>=a)throw Xs.bytes=0,new RangeError("Could not decode varint");s=t[o++],r+=i<28?(s&ul)<<i:(s&ul)*Math.pow(2,i),i+=7}while(s>=hw);return Xs.bytes=o-n,r}var pw=Math.pow(2,7),yw=Math.pow(2,14),bw=Math.pow(2,21),mw=Math.pow(2,28),ww=Math.pow(2,35),gw=Math.pow(2,42),xw=Math.pow(2,49),Ew=Math.pow(2,56),Sw=Math.pow(2,63),_w=function(t){return t<pw?1:t<yw?2:t<bw?3:t<mw?4:t<ww?5:t<gw?6:t<xw?7:t<Ew?8:t<Sw?9:10},Aw={encode:cw,decode:dw,encodingLength:_w},vw=Aw,Dn=vw;function On(t,e=0){return[Dn.decode(t,e),Dn.decode.bytes]}function Pr(t,e,r=0){return Dn.encode(t,e,r),e}function Fr(t){return Dn.encodingLength(t)}function Mr(t,e){let r=e.byteLength,n=Fr(t),i=n+Fr(r),o=new Uint8Array(i+r);return Pr(t,o,0),Pr(r,o,n),o.set(e,i),new kr(t,r,e,o)}function Un(t){let e=ht(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 kr(r,i,s,e)}function dl(t,e){if(t===e)return!0;{let r=e;return t.code===r.code&&t.size===r.size&&r.bytes instanceof Uint8Array&&nl(t.bytes,r.bytes)}}var kr=class{code;size;digest;bytes;constructor(e,r,n,i){this.code=e,this.size=r,this.digest=tr(n),this.bytes=tr(i)}};function hl(t,e){let{bytes:r,version:n}=t;return n===0?Iw(r,Qs(t),e??ae.encoder):Bw(r,Qs(t),e??Ot.encoder)}var pl=new WeakMap;function Qs(t){let e=pl.get(t);if(e==null){let r=new Map;return pl.set(t,r),r}return e}var we=class t{code;version;multihash;bytes;"/";constructor(e,r,n,i){this.code=r,this.version=e,this.multihash=n,this.bytes=tr(i),this["/"]=this.bytes}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!==Nn)throw new Error("Cannot convert a non dag-pb CID to CIDv0");if(r.code!==Rw)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=Mr(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&&dl(e.multihash,n.multihash)}toString(e){return hl(this,e)}toJSON(){return{"/":hl(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??yl(n,i,o.bytes))}else if(r[Cw]===!0){let{version:n,multihash:i,code:o}=r,s=Un(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!==Nn)throw new Error(`Version 0 CID must use dag-pb (code: ${Nn}) block encoding`);return new t(e,r,n,n.bytes)}case 1:{let i=yl(e,r,n.bytes);return new t(e,r,n,i)}default:throw new Error("Invalid version")}}static createV0(e){return t.create(0,Nn,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=ht(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 kr(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,p]=On(e.subarray(r));return r+=p,l},i=n(),o=Nn;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(),f=n(),c=r+f,u=c-s;return{version:i,codec:o,multihashCode:a,digestSize:f,multihashSize:u,size:c}}static parse(e,r){let[n,i]=Tw(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 Qs(o).set(n,e),o}};function Tw(t,e){switch(t[0]){case"Q":{let r=e??ae;return[ae.prefix,r.decode(`${ae.prefix}${t}`)]}case ae.prefix:{let r=e??ae;return[ae.prefix,r.decode(t)]}case Ot.prefix:{let r=e??Ot;return[Ot.prefix,r.decode(t)]}case rr.prefix:{let r=e??rr;return[rr.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 Iw(t,e,r){let{prefix:n}=r;if(n!==ae.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 Bw(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 Nn=112,Rw=18;function yl(t,e,r){let n=Fr(t),i=n+Fr(e),o=new Uint8Array(i+r.byteLength);return Pr(t,o,0),Pr(e,o,n),o.set(r,i),o}var Cw=Symbol.for("@ipld/js-cid/CID");var Js={};G(Js,{identity:()=>Me});var bl=0,Lw="identity",ml=ht;function Dw(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 Mr(bl,ml(t))}var Me={code:bl,name:Lw,encode:ml,digest:Dw};function Ut(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 Ow(t){return t.buffer instanceof ArrayBuffer}function Nt(t){return Ow(t)?t:t.slice()}async function wl(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,Nt(e),Nt(r.subarray()));return n?.signal?.throwIfAborted(),o}function pt(t=0){return new Uint8Array(t)}function Ne(t=0){return new Uint8Array(t)}function Uw(t){return t?.buffer instanceof ArrayBuffer}function gl(t){if(Uw(t))return t;let e=t.slice();return new Uint8Array(e.buffer,0,e.byteLength)}function Fi(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=Ne(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return gl(r)}var El=Symbol.for("@achingbrain/uint8arraylist");function xl(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 ki(t){return!!t?.[El]}var De=class t{bufs;length;[El]=!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(ki(n)){r+=n.byteLength;for(let i of n.bufs)this.bufs.push(i)}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(ki(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=xl(this.bufs,e);return r.buf[r.index]}set(e,r){let n=xl(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(ki(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 Fi(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:Fi(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,f=a+s.byteLength;if(i=f,e>=f)continue;let c=e>=a&&e<f,u=r>a&&r<=f;if(c&&u){if(e===a&&r===f){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(u){if(r===f){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(!ki(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,f=this.byteLength-n.byteLength,c=n.byteLength-1,u;for(let l=r;l<=f;l+=u){u=0;for(let p=c;p>=0;p--){let d=this.get(l+p);if(n[p]!==d){u=Math.max(1,p-a[d]);break}}if(u===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=Ne(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=pt(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=pt(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=pt(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=Ne(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=pt(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=pt(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=pt(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=pt(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=pt(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(!Ut(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}};var ea={};G(ea,{base10:()=>Nw});var Nw=Dt({prefix:"9",name:"base10",alphabet:"0123456789"});var ta={};G(ta,{base16:()=>Pw,base16upper:()=>Fw});var Pw=te({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),Fw=te({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ra={};G(ra,{base2:()=>kw});var kw=te({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var na={};G(na,{base256emoji:()=>Kw});var Sl=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}"),Mw=Sl.reduce((t,e,r)=>(t[r]=e,t),[]),qw=Sl.reduce((t,e,r)=>{let n=e.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${e}`);return t[n]=r,t},[]);function $w(t){return t.reduce((e,r)=>(e+=Mw[r],e),"")}function Hw(t){let e=[];for(let r of t){let n=r.codePointAt(0);if(n==null)throw new Error(`Invalid character: ${r}`);let i=qw[n];if(i==null)throw new Error(`Non-base256emoji character: ${r}`);e.push(i)}return new Uint8Array(e)}var Kw=Nr({prefix:"\u{1F680}",name:"base256emoji",encode:$w,decode:Hw});var sa={};G(sa,{base64:()=>Vw,base64pad:()=>ia,base64url:()=>oa,base64urlpad:()=>jw});var Vw=te({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),ia=te({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),oa=te({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),jw=te({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var aa={};G(aa,{base8:()=>Ww});var Ww=te({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ca={};G(ca,{identity:()=>zw});var zw=Nr({prefix:"\0",name:"identity",encode:t=>ol(t),decode:t=>il(t)});var k4=new TextEncoder,M4=new TextDecoder;var ua={};G(ua,{sha256:()=>Fn,sha512:()=>Xw});var Zw=20;function Pn({name:t,code:e,encode:r,minDigestLength:n,maxDigestLength:i}){return new fa(t,e,r,n,i)}var fa=class{name;code;encode;minDigestLength;maxDigestLength;constructor(e,r,n,i,o){this.name=e,this.code=r,this.encode=n,this.minDigestLength=i??Zw,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?_l(n,this.code,r?.truncate):n.then(i=>_l(i,this.code,r?.truncate))}else throw Error("Unknown type, must be binary type")}};function _l(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 Mr(e,t)}function vl(t){return async e=>new Uint8Array(await crypto.subtle.digest(t,e))}var Fn=Pn({name:"sha2-256",code:18,encode:vl("SHA-256")}),Xw=Pn({name:"sha2-512",code:19,encode:vl("SHA-512")});var qe={...ca,...ra,...aa,...ea,...ta,...Ys,...Zs,...Gs,...sa,...na},X4={...ua,...Js};function Il(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Tl=Il("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),la=Il("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=Ne(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Qw={utf8:Tl,"utf-8":Tl,hex:qe.base16,latin1:la,ascii:la,binary:la,...qe},Mi=Qw;function $r(t,e="utf8"){let r=Mi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}function Pt(t,e="utf8"){let r=Mi[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}var Jw=parseInt("11111",2),da=parseInt("10000000",2),eg=parseInt("01111111",2),Bl={0:kn,1:kn,2:tg,3:ig,4:og,5:ng,6:rg,16:kn,22:kn,48:kn};function ha(t,e={offset:0}){let r=t[e.offset]&Jw;if(e.offset++,Bl[r]!=null)return Bl[r](t,e);throw new Error("No decoder for tag "+r)}function Mn(t,e){let r=0;if((t[e.offset]&da)===da){let n=t[e.offset]&eg,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 kn(t,e){Mn(t,e);let r=[];for(;!(e.offset>=t.byteLength);){let n=ha(t,e);if(n===null)break;r.push(n)}return r}function tg(t,e){let r=Mn(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 rg(t,e){let r=Mn(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}`,f=[];for(;e.offset<n;){let c=t[e.offset];if(e.offset++,f.push(c&127),c<128){f.reverse();let u=0;for(let l=0;l<f.length;l++)u+=f[l]<<l*7;a+=`.${u}`,f=[]}}return a}function ng(t,e){return e.offset++,null}function ig(t,e){let r=Mn(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 og(t,e){let r=Mn(t,e),n=t.subarray(e.offset,e.offset+r);return e.offset+=r,n}function sg(t){let e=t.toString(16);e.length%2===1&&(e="0"+e);let r=new De;for(let n=0;n<e.length;n+=2)r.append(Uint8Array.from([parseInt(`${e[n]}${e[n+1]}`,16)]));return r}function pa(t){if(t.byteLength<128)return Uint8Array.from([t.byteLength]);let e=sg(t.byteLength);return new De(Uint8Array.from([e.byteLength|da]),e)}function Rl(t){let e=new De,r=128;return(t.subarray()[0]&r)===r&&e.append(Uint8Array.from([0])),e.append(t),new De(Uint8Array.from([2]),pa(e),e)}function Cl(t){let e=Uint8Array.from([0]),r=new De(e,t);return new De(Uint8Array.from([3]),pa(r),r)}function qi(t,e=48){let r=new De;for(let n of t)r.append(n);return new De(Uint8Array.from([e]),pa(r),r)}var ag=Uint8Array.from([6,8,42,134,72,206,61,3,1,7]),cg=Uint8Array.from([6,5,43,129,4,0,34]),fg=Uint8Array.from([6,5,43,129,4,0,35]),ug={ext:!0,kty:"EC",crv:"P-256"},lg={ext:!0,kty:"EC",crv:"P-384"},dg={ext:!0,kty:"EC",crv:"P-521"},ya=32,ba=48,ma=66;function Ll(t){let e=ha(t);return Dl(e)}function Dl(t){let e=t[1][1][0],r=1,n,i;if(e.byteLength===ya*2+1)return n=Pt(e.subarray(r,r+ya),"base64url"),i=Pt(e.subarray(r+ya),"base64url"),new Hr({...ug,key_ops:["verify"],x:n,y:i});if(e.byteLength===ba*2+1)return n=Pt(e.subarray(r,r+ba),"base64url"),i=Pt(e.subarray(r+ba),"base64url"),new Hr({...lg,key_ops:["verify"],x:n,y:i});if(e.byteLength===ma*2+1)return n=Pt(e.subarray(r,r+ma),"base64url"),i=Pt(e.subarray(r+ma),"base64url"),new Hr({...dg,key_ops:["verify"],x:n,y:i});throw new Ie(`coordinates were wrong length, got ${e.byteLength}, expected 65, 97 or 133`)}function Ol(t){return qi([Rl(Uint8Array.from([1])),qi([hg(t.crv)],160),qi([Cl(new De(Uint8Array.from([4]),$r(t.x??"","base64url"),$r(t.y??"","base64url")))],161)]).subarray()}function hg(t){if(t==="P-256")return ag;if(t==="P-384")return cg;if(t==="P-521")return fg;throw new Ie(`Invalid curve ${t}`)}var Hr=class{type="ECDSA";jwk;_raw;constructor(e){this.jwk=e}get raw(){return this._raw==null&&(this._raw=Ol(this.jwk)),this._raw}toMultihash(){return Me.digest(Kr(this))}toCID(){return we.createV1(114,this.toMultihash())}toString(){return ae.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ut(this.raw,e.raw)}async verify(e,r,n){return wl(this.jwk,r,e,n)}};function wa(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in t&&t.BYTES_PER_ELEMENT===1}function Ft(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(`${r}expected number, got ${typeof t}`)}if(!Number.isSafeInteger(t)||t<0){let r=e&&`"${e}" `;throw new RangeError(`${r}expected integer >= 0, got ${t}`)}}function Oe(t,e,r=""){let n=wa(t),i=t?.length,o=e!==void 0;if(!n||o&&i!==e){let s=r&&`"${r}" `,a=o?` of length ${e}`:"",f=n?`length=${i}`:`type=${typeof t}`,c=s+"expected Uint8Array"+a+", got "+f;throw n?new RangeError(c):new TypeError(c)}return t}function $i(t){if(typeof t!="function"||typeof t.create!="function")throw new TypeError("Hash must wrapped by utils.createHasher");if(Ft(t.outputLen),Ft(t.blockLen),t.outputLen<1)throw new Error('"outputLen" must be >= 1');if(t.blockLen<1)throw new Error('"blockLen" must be >= 1')}function Vr(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 Hi(t,e){Oe(t,void 0,"digestInto() output");let r=e.outputLen;if(t.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function bt(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function Ki(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function $e(t,e){return t<<32-e|t>>>e}var Nl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",pg=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Vi(t){if(Oe(t),Nl)return t.toHex();let e="";for(let r=0;r<t.length;r++)e+=pg[t[r]];return e}var yt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ul(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 qn(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);if(Nl)try{return Uint8Array.fromHex(t)}catch(i){throw i instanceof SyntaxError?new RangeError(i.message):i}let e=t.length,r=e/2;if(e%2)throw new RangeError("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=Ul(t.charCodeAt(o)),a=Ul(t.charCodeAt(o+1));if(s===void 0||a===void 0){let f=t[o]+t[o+1];throw new RangeError('hex string expected, got non-hex character "'+f+'" at index '+o)}n[i]=s*16+a}return n}function ga(...t){let e=0;for(let n=0;n<t.length;n++){let i=t[n];Oe(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}function xa(t,e={}){let r=(i,o)=>t(o).update(i).digest(),n=t(void 0);return r.outputLen=n.outputLen,r.blockLen=n.blockLen,r.canXOF=n.canXOF,r.create=i=>t(i),Object.assign(r,e),Object.freeze(r)}function Pl(t=32){Ft(t,"bytesLength");let e=typeof globalThis=="object"?globalThis.crypto:null;if(typeof e?.getRandomValues!="function")throw new Error("crypto.getRandomValues must be defined");if(t>65536)throw new RangeError(`"bytesLength" expected <= 65536, got ${t}`);return e.getRandomValues(new Uint8Array(t))}var Ea=t=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,t])});function Fl(t,e,r){return t&e^~t&r}function kl(t,e,r){return t&e^t&r^e&r}var $n=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,r,n,i){this.blockLen=e,this.outputLen=r,this.padOffset=n,this.isLE=i,this.buffer=new Uint8Array(e),this.view=Ki(this.buffer)}update(e){Vr(this),Oe(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 f=Ki(e);for(;i<=o-s;s+=i)this.process(f,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){Vr(this),Hi(e,this),this.finished=!0;let{buffer:r,view:n,blockLen:i,isLE:o}=this,{pos:s}=this;r[s++]=128,bt(this.buffer.subarray(s)),this.padOffset>i-s&&(this.process(n,0),s=0);for(let l=s;l<i;l++)r[l]=0;n.setBigUint64(i-8,BigInt(this.length*8),o),this.process(n,0);let a=Ki(e),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen must be aligned to 32bit");let c=f/4,u=this.get();if(c>u.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<c;l++)a.setUint32(4*l,u[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||=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()}},mt=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 ji=BigInt(4294967295),Ml=BigInt(32);function yg(t,e=!1){return e?{h:Number(t&ji),l:Number(t>>Ml&ji)}:{h:Number(t>>Ml&ji)|0,l:Number(t&ji)|0}}function ql(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}=yg(t[o],e);[n[o],i[o]]=[s,a]}return[n,i]}var Sa=(t,e,r)=>t>>>r,_a=(t,e,r)=>t<<32-r|e>>>r,nr=(t,e,r)=>t>>>r|e<<32-r,ir=(t,e,r)=>t<<32-r|e>>>r,Hn=(t,e,r)=>t<<64-r|e>>>r-32,Kn=(t,e,r)=>t>>>r-32|e<<64-r;function Qe(t,e,r,n){let i=(e>>>0)+(n>>>0);return{h:t+r+(i/2**32|0)|0,l:i|0}}var $l=(t,e,r)=>(t>>>0)+(e>>>0)+(r>>>0),Hl=(t,e,r,n)=>e+r+n+(t/2**32|0)|0,Kl=(t,e,r,n)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0),Vl=(t,e,r,n,i)=>e+r+n+i+(t/2**32|0)|0,jl=(t,e,r,n,i)=>(t>>>0)+(e>>>0)+(r>>>0)+(n>>>0)+(i>>>0),Wl=(t,e,r,n,i,o)=>e+r+n+i+o+(t/2**32|0)|0;var mg=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]),kt=new Uint32Array(64),Aa=class extends $n{constructor(e){super(64,e,8,!1)}get(){let{A:e,B:r,C:n,D:i,E:o,F:s,G:a,H:f}=this;return[e,r,n,i,o,s,a,f]}set(e,r,n,i,o,s,a,f){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=f|0}process(e,r){for(let l=0;l<16;l++,r+=4)kt[l]=e.getUint32(r,!1);for(let l=16;l<64;l++){let p=kt[l-15],d=kt[l-2],y=$e(p,7)^$e(p,18)^p>>>3,h=$e(d,17)^$e(d,19)^d>>>10;kt[l]=h+kt[l-7]+y+kt[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:f,G:c,H:u}=this;for(let l=0;l<64;l++){let p=$e(a,6)^$e(a,11)^$e(a,25),d=u+p+Fl(a,f,c)+mg[l]+kt[l]|0,h=($e(n,2)^$e(n,13)^$e(n,22))+kl(n,i,o)|0;u=c,c=f,f=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,f=f+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(n,i,o,s,a,f,c,u)}roundClean(){bt(kt)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),bt(this.buffer)}},va=class extends Aa{A=mt[0]|0;B=mt[1]|0;C=mt[2]|0;D=mt[3]|0;E=mt[4]|0;F=mt[5]|0;G=mt[6]|0;H=mt[7]|0;constructor(){super(32)}};var zl=ql(["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))),wg=zl[0],gg=zl[1],Mt=new Uint32Array(80),qt=new Uint32Array(80),Ta=class extends $n{constructor(e){super(128,e,16,!1)}get(){let{Ah:e,Al:r,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:f,Eh:c,El:u,Fh:l,Fl:p,Gh:d,Gl:y,Hh:h,Hl:b}=this;return[e,r,n,i,o,s,a,f,c,u,l,p,d,y,h,b]}set(e,r,n,i,o,s,a,f,c,u,l,p,d,y,h,b){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=f|0,this.Eh=c|0,this.El=u|0,this.Fh=l|0,this.Fl=p|0,this.Gh=d|0,this.Gl=y|0,this.Hh=h|0,this.Hl=b|0}process(e,r){for(let S=0;S<16;S++,r+=4)Mt[S]=e.getUint32(r),qt[S]=e.getUint32(r+=4);for(let S=16;S<80;S++){let _=Mt[S-15]|0,T=qt[S-15]|0,N=nr(_,T,1)^nr(_,T,8)^Sa(_,T,7),R=ir(_,T,1)^ir(_,T,8)^_a(_,T,7),I=Mt[S-2]|0,O=qt[S-2]|0,q=nr(I,O,19)^Hn(I,O,61)^Sa(I,O,6),k=ir(I,O,19)^Kn(I,O,61)^_a(I,O,6),w=Kl(R,k,qt[S-7],qt[S-16]),E=Vl(w,N,q,Mt[S-7],Mt[S-16]);Mt[S]=E|0,qt[S]=w|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:f,Dh:c,Dl:u,Eh:l,El:p,Fh:d,Fl:y,Gh:h,Gl:b,Hh:m,Hl:x}=this;for(let S=0;S<80;S++){let _=nr(l,p,14)^nr(l,p,18)^Hn(l,p,41),T=ir(l,p,14)^ir(l,p,18)^Kn(l,p,41),N=l&d^~l&h,R=p&y^~p&b,I=jl(x,T,R,gg[S],qt[S]),O=Wl(I,m,_,N,wg[S],Mt[S]),q=I|0,k=nr(n,i,28)^Hn(n,i,34)^Hn(n,i,39),w=ir(n,i,28)^Kn(n,i,34)^Kn(n,i,39),E=n&o^n&a^o&a,B=i&s^i&f^s&f;m=h|0,x=b|0,h=d|0,b=y|0,d=l|0,y=p|0,{h:l,l:p}=Qe(c|0,u|0,O|0,q|0),c=a|0,u=f|0,a=o|0,f=s|0,o=n|0,s=i|0;let v=$l(q,w,B);n=Hl(v,O,k,E),i=v|0}({h:n,l:i}=Qe(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=Qe(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:f}=Qe(this.Ch|0,this.Cl|0,a|0,f|0),{h:c,l:u}=Qe(this.Dh|0,this.Dl|0,c|0,u|0),{h:l,l:p}=Qe(this.Eh|0,this.El|0,l|0,p|0),{h:d,l:y}=Qe(this.Fh|0,this.Fl|0,d|0,y|0),{h,l:b}=Qe(this.Gh|0,this.Gl|0,h|0,b|0),{h:m,l:x}=Qe(this.Hh|0,this.Hl|0,m|0,x|0),this.set(n,i,o,s,a,f,c,u,l,p,d,y,h,b,m,x)}roundClean(){bt(Mt,qt)}destroy(){this.destroyed=!0,bt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Ia=class extends Ta{Ah=ge[0]|0;Al=ge[1]|0;Bh=ge[2]|0;Bl=ge[3]|0;Ch=ge[4]|0;Cl=ge[5]|0;Dh=ge[6]|0;Dl=ge[7]|0;Eh=ge[8]|0;El=ge[9]|0;Fh=ge[10]|0;Fl=ge[11]|0;Gh=ge[12]|0;Gl=ge[13]|0;Hh=ge[14]|0;Hl=ge[15]|0;constructor(){super(64)}};var Gl=xa(()=>new va,Ea(1));var Wi=xa(()=>new Ia,Ea(3));var V=(t,e,r)=>Oe(t,e,r),Ra=Ft,jr=Vi,ue=(...t)=>ga(...t),Wr=t=>qn(t),or=wa,Vn=t=>Pl(t),Gi=BigInt(0),Ba=BigInt(1);function He(t,e=""){if(typeof t!="boolean"){let r=e&&`"${e}" `;throw new TypeError(r+"expected boolean, got type="+typeof t)}return t}function Yi(t){if(typeof t=="bigint"){if(!zi(t))throw new RangeError("positive bigint expected, got "+t)}else Ra(t);return t}function Ke(t,e=""){if(typeof t!="number"){let r=e&&`"${e}" `;throw new TypeError(r+"expected number, got type="+typeof t)}if(!Number.isSafeInteger(t)){let r=e&&`"${e}" `;throw new RangeError(r+"expected safe integer, got "+t)}}function jn(t){let e=Yi(t).toString(16);return e.length&1?"0"+e:e}function Yl(t){if(typeof t!="string")throw new TypeError("hex string expected, got "+typeof t);return t===""?Gi:BigInt("0x"+t)}function sr(t){return Yl(Vi(t))}function Je(t){return Yl(Vi(Wn(Oe(t)).reverse()))}function Zi(t,e){if(Ft(e),e===0)throw new RangeError("zero length");t=Yi(t);let r=t.toString(16);if(r.length>e*2)throw new RangeError("number too large");return qn(r.padStart(e*2,"0"))}function Ca(t,e){return Zi(t,e).reverse()}function Zl(t,e){if(t=V(t),e=V(e),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 Wn(t){return Uint8Array.from(V(t))}function Xi(t){if(typeof t!="string")throw new TypeError("ascii string expected, got "+typeof t);return Uint8Array.from(t,(e,r)=>{let n=e.charCodeAt(0);if(e.length!==1||n>127)throw new RangeError(`string contains non-ASCII character "${t[r]}" with code ${n} at position ${r}`);return n})}var zi=t=>typeof t=="bigint"&&Gi<=t;function xg(t,e,r){return zi(t)&&zi(e)&&zi(r)&&e<=t&&t<r}function zr(t,e,r,n){if(!xg(e,r,n))throw new RangeError("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function Gr(t){if(t<Gi)throw new Error("expected non-negative bigint, got "+t);let e;for(e=0;t>Gi;t>>=Ba,e+=1);return e}var zn=t=>(Ba<<BigInt(t))-Ba;function Xl(t,e,r){if(Ft(t,"hashLen"),Ft(e,"qByteLen"),typeof r!="function")throw new TypeError("hmacFn must be a function");let n=b=>new Uint8Array(b),i=Uint8Array.of(),o=Uint8Array.of(0),s=Uint8Array.of(1),a=1e3,f=n(t),c=n(t),u=0,l=()=>{f.fill(1),c.fill(0),u=0},p=(...b)=>r(c,ue(f,...b)),d=(b=i)=>{c=p(o,b),f=p(),b.length!==0&&(c=p(s,b),f=p())},y=()=>{if(u++>=a)throw new Error("drbg: tried max amount of iterations");let b=0,m=[];for(;b<e;){f=p();let x=f.slice();m.push(x),b+=f.length}return ue(...m)};return(b,m)=>{l(),d(b);let x;for(;(x=m(y()))===void 0;)d();return l(),x}}function Ve(t,e={},r={}){if(Object.prototype.toString.call(t)!=="[object Object]")throw new TypeError("expected valid options object");function n(o,s,a){if(!a&&s!=="function"&&!Object.hasOwn(t,o))throw new TypeError(`param "${o}" is invalid: expected own property`);let f=t[o];if(a&&f===void 0)return;let c=typeof f;if(c!==s||f===null)throw new TypeError(`param "${o}" is invalid: expected ${s}, got ${c}`)}let i=(o,s)=>Object.entries(o).forEach(([a,f])=>n(a,f,s));i(e,!1),i(r,!0)}var La=()=>{throw new Error("not implemented")};var xe=BigInt(0),re=BigInt(1),ar=BigInt(2),td=BigInt(3),rd=BigInt(4),nd=BigInt(5),Eg=BigInt(7),id=BigInt(8),Sg=BigInt(9),od=BigInt(16);function ie(t,e){if(e<=xe)throw new Error("mod: expected positive modulus, got "+e);let r=t%e;return r>=xe?r:e+r}function Z(t,e,r){if(e<xe)throw new Error("pow2: expected non-negative exponent, got "+e);let n=t;for(;e-- >xe;)n*=n,n%=r;return n}function Ql(t,e){if(t===xe)throw new Error("invert: expected non-zero number");if(e<=xe)throw new Error("invert: expected positive modulus, got "+e);let r=ie(t,e),n=e,i=xe,o=re,s=re,a=xe;for(;r!==xe;){let c=n/r,u=n-r*c,l=i-s*c,p=o-a*c;n=r,r=u,i=s,o=a,s=l,a=p}if(n!==re)throw new Error("invert: does not exist");return ie(i,e)}function Da(t,e,r){let n=t;if(!n.eql(n.sqr(e),r))throw new Error("Cannot find square root")}function sd(t,e){let r=t,n=(r.ORDER+re)/rd,i=r.pow(e,n);return Da(r,i,e),i}function _g(t,e){let r=t,n=(r.ORDER-nd)/id,i=r.mul(e,ar),o=r.pow(i,n),s=r.mul(e,o),a=r.mul(r.mul(s,ar),o),f=r.mul(s,r.sub(a,r.ONE));return Da(r,f,e),f}function Ag(t){let e=Yr(t),r=ad(t),n=r(e,e.neg(e.ONE)),i=r(e,n),o=r(e,e.neg(n)),s=(t+Eg)/od;return((a,f)=>{let c=a,u=c.pow(f,s),l=c.mul(u,n),p=c.mul(u,i),d=c.mul(u,o),y=c.eql(c.sqr(l),f),h=c.eql(c.sqr(p),f);u=c.cmov(u,l,y),l=c.cmov(d,p,h);let b=c.eql(c.sqr(l),f),m=c.cmov(u,l,b);return Da(c,m,f),m})}function ad(t){if(t<td)throw new Error("sqrt is not defined for small field");let e=t-re,r=0;for(;e%ar===xe;)e/=ar,r++;let n=ar,i=Yr(t);for(;Jl(i,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(r===1)return sd;let o=i.pow(n,e),s=(e+re)/ar;return function(f,c){let u=f;if(u.is0(c))return c;if(Jl(u,c)!==1)throw new Error("Cannot find square root");let l=r,p=u.mul(u.ONE,o),d=u.pow(c,e),y=u.pow(c,s);for(;!u.eql(d,u.ONE);){if(u.is0(d))return u.ZERO;let h=1,b=u.sqr(d);for(;!u.eql(b,u.ONE);)if(h++,b=u.sqr(b),h===l)throw new Error("Cannot find square root");let m=re<<BigInt(l-h-1),x=u.pow(p,m);l=h,p=u.sqr(x),d=u.mul(d,p),y=u.mul(y,x)}return y}}function vg(t){return t%rd===td?sd:t%id===nd?_g:t%od===Sg?Ag(t):ad(t)}var wt=(t,e)=>(ie(t,e)&re)===re,Tg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Oa(t){let e={ORDER:"bigint",BYTES:"number",BITS:"number"},r=Tg.reduce((n,i)=>(n[i]="function",n),e);if(Ve(t,r),Ke(t.BYTES,"BYTES"),Ke(t.BITS,"BITS"),t.BYTES<1||t.BITS<1)throw new Error("invalid field: expected BYTES/BITS > 0");if(t.ORDER<=re)throw new Error("invalid field: expected ORDER > 1, got "+t.ORDER);return t}function Ig(t,e,r){let n=t;if(r<xe)throw new Error("invalid exponent, negatives unsupported");if(r===xe)return n.ONE;if(r===re)return e;let i=n.ONE,o=e;for(;r>xe;)r&re&&(i=n.mul(i,o)),o=n.sqr(o),r>>=re;return i}function Gn(t,e,r=!1){let n=t,i=new Array(e.length).fill(r?n.ZERO:void 0),o=e.reduce((a,f,c)=>n.is0(f)?a:(i[c]=a,n.mul(a,f)),n.ONE),s=n.inv(o);return e.reduceRight((a,f,c)=>n.is0(f)?a:(i[c]=n.mul(a,i[c]),n.mul(a,f)),s),i}function Jl(t,e){let r=t,n=(r.ORDER-re)/ar,i=r.pow(e,n),o=r.eql(i,r.ONE),s=r.eql(i,r.ZERO),a=r.eql(i,r.neg(r.ONE));if(!o&&!s&&!a)throw new Error("invalid Legendre symbol result");return o?1:s?0:-1}function Bg(t,e){if(e!==void 0&&Ra(e),t<=xe)throw new Error("invalid n length: expected positive n, got "+t);if(e!==void 0&&e<1)throw new Error("invalid n length: expected positive bit length, got "+e);let r=Gr(t);if(e!==void 0&&e<r)throw new Error(`invalid n length: expected bit length (${r}) >= n.length (${e})`);let n=e!==void 0?e:r,i=Math.ceil(n/8);return{nBitLength:n,nByteLength:i}}var ed=new WeakMap,Qi=class{ORDER;BITS;BYTES;isLE;ZERO=xe;ONE=re;_lengths;_mod;constructor(e,r={}){if(e<=re)throw new Error("invalid field: expected ORDER > 1, got "+e);let n;this.isLE=!1,r!=null&&typeof r=="object"&&(typeof r.BITS=="number"&&(n=r.BITS),typeof r.sqrt=="function"&&Object.defineProperty(this,"sqrt",{value:r.sqrt,enumerable:!0}),typeof r.isLE=="boolean"&&(this.isLE=r.isLE),r.allowedLengths&&(this._lengths=Object.freeze(r.allowedLengths.slice())),typeof r.modFromBytes=="boolean"&&(this._mod=r.modFromBytes));let{nBitLength:i,nByteLength:o}=Bg(e,n);if(o>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");this.ORDER=e,this.BITS=i,this.BYTES=o,Object.freeze(this)}create(e){return ie(e,this.ORDER)}isValid(e){if(typeof e!="bigint")throw new TypeError("invalid field element: expected bigint, got "+typeof e);return xe<=e&&e<this.ORDER}is0(e){return e===xe}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&re)===re}neg(e){return ie(-e,this.ORDER)}eql(e,r){return e===r}sqr(e){return ie(e*e,this.ORDER)}add(e,r){return ie(e+r,this.ORDER)}sub(e,r){return ie(e-r,this.ORDER)}mul(e,r){return ie(e*r,this.ORDER)}pow(e,r){return Ig(this,e,r)}div(e,r){return ie(e*Ql(r,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,r){return e+r}subN(e,r){return e-r}mulN(e,r){return e*r}inv(e){return Ql(e,this.ORDER)}sqrt(e){let r=ed.get(this);return r||ed.set(this,r=vg(this.ORDER)),r(this,e)}toBytes(e){return this.isLE?Ca(e,this.BYTES):Zi(e,this.BYTES)}fromBytes(e,r=!1){V(e);let{_lengths:n,BYTES:i,isLE:o,ORDER:s,_mod:a}=this;if(n){if(e.length<1||!n.includes(e.length)||e.length>i)throw new Error("Field.fromBytes: expected "+n+" bytes, got "+e.length);let c=new Uint8Array(i);c.set(e,o?0:c.length-e.length),e=c}if(e.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+e.length);let f=o?Je(e):sr(e);if(a&&(f=ie(f,s)),!r&&!this.isValid(f))throw new Error("invalid field element: outside of range 0..ORDER");return f}invertBatch(e){return Gn(this,e)}cmov(e,r,n){return He(n,"condition"),n?r:e}};Object.freeze(Qi.prototype);function Yr(t,e={}){return new Qi(t,e)}function cd(t){if(typeof t!="bigint")throw new Error("field order must be bigint");if(t<=re)throw new Error("field order must be greater than 1");let e=Gr(t-re);return Math.ceil(e/8)}function Ua(t){let e=cd(t);return e+Math.ceil(e/2)}function Na(t,e,r=!1){V(t);let n=t.length,i=cd(e),o=Math.max(Ua(e),16);if(n<o||n>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+n);let s=r?Je(t):sr(t),a=ie(s,e-re)+re;return r?Ca(a,i):Zi(a,i)}var Zr=BigInt(0),cr=BigInt(1);function Yn(t,e){let r=e.negate();return t?r:e}function fr(t,e){let r=Gn(t.Fp,e.map(n=>n.Z));return e.map((n,i)=>t.fromAffine(n.toAffine(r[i])))}function dd(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function Pa(t,e){dd(t,e);let r=Math.ceil(e/t)+1,n=2**(t-1),i=2**t,o=zn(t),s=BigInt(t);return{windows:r,windowSize:n,mask:o,maxNumber:i,shiftBy:s}}function fd(t,e,r){let{windowSize:n,mask:i,maxNumber:o,shiftBy:s}=r,a=Number(t&i),f=t>>s;a>n&&(a-=o,f+=cr);let c=e*n,u=c+Math.abs(a)-1,l=a===0,p=a<0,d=e%2!==0;return{nextN:f,offset:u,isZero:l,isNeg:p,isNegF:d,offsetF:c}}var Fa=new WeakMap,hd=new WeakMap;function ka(t){return hd.get(t)||1}function ud(t){if(t!==Zr)throw new Error("invalid wNAF")}var Xr=class{BASE;ZERO;Fn;bits;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>Zr;)r&cr&&(n=n.add(i)),i=i.double(),r>>=cr;return n}precomputeWindow(e,r){let{windows:n,windowSize:i}=Pa(r,this.bits),o=[],s=e,a=s;for(let f=0;f<n;f++){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=Pa(e,this.bits);for(let a=0;a<s.windows;a++){let{nextN:f,offset:c,isZero:u,isNeg:l,isNegF:p,offsetF:d}=fd(n,a,s);n=f,u?o=o.add(Yn(p,r[d])):i=i.add(Yn(l,r[c]))}return ud(n),{p:i,f:o}}wNAFUnsafe(e,r,n,i=this.ZERO){let o=Pa(e,this.bits);for(let s=0;s<o.windows&&n!==Zr;s++){let{nextN:a,offset:f,isZero:c,isNeg:u}=fd(n,s,o);if(n=a,!c){let l=r[f];i=i.add(u?l.negate():l)}}return ud(n),i}getPrecomputes(e,r,n){let i=Fa.get(r);return i||(i=this.precomputeWindow(r,e),e!==1&&(typeof n=="function"&&(i=n(i)),Fa.set(r,i))),i}cached(e,r,n){let i=ka(e);return this.wNAF(i,this.getPrecomputes(i,e,n),r)}unsafe(e,r,n,i){let o=ka(e);return o===1?this._unsafeLadder(e,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),r,i)}createCache(e,r){dd(r,this.bits),hd.set(e,r),Fa.delete(e)}hasCache(e){return ka(e)!==1}};function pd(t,e,r,n){let i=e,o=t.ZERO,s=t.ZERO;for(;r>Zr||n>Zr;)r&cr&&(o=o.add(i)),n&cr&&(s=s.add(i)),i=i.double(),r>>=cr,n>>=cr;return{p1:o,p2:s}}function ld(t,e,r){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Oa(e),e}else return Yr(t,{isLE:r})}function Ji(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 f of["p","n","h"]){let c=e[f];if(!(typeof c=="bigint"&&c>Zr))throw new Error(`CURVE.${f} must be positive bigint`)}let i=ld(e.p,r.Fp,n),o=ld(e.n,r.Fn,n),a=["Gx","Gy","a",t==="weierstrass"?"b":"d"];for(let f of a)if(!i.isValid(e[f]))throw new Error(`CURVE.${f} must be valid field element of CURVE.Fp`);return e=Object.freeze(Object.assign({},e)),{CURVE:e,Fp:i,Fn:o}}function eo(t,e){return function(n){let i=t(n);return{secretKey:i,publicKey:e(i)}}}var $t=BigInt(0),ye=BigInt(1),Ma=BigInt(2),Rg=BigInt(8);function Cg(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 yd(t,e={}){let r=e,n=Ji("edwards",t,r,r.FpFnLE),{Fp:i,Fn:o}=n,s=n.CURVE,{h:a}=s;Ve(r,{},{uvRatio:"function"});let f=Ma<<BigInt(o.BYTES*8)-ye,c=h=>i.create(h),u=r.uvRatio===void 0?(h,b)=>{try{return{isValid:!0,value:i.sqrt(i.div(h,b))}}catch{return{isValid:!1,value:$t}}}:r.uvRatio;if(!Cg(i,s,s.Gx,s.Gy))throw new Error("bad curve params: generator point");function l(h,b,m=!1){let x=m?ye:$t;return zr("coordinate "+h,b,x,f),b}function p(h){if(!(h instanceof d))throw new Error("EdwardsPoint expected")}class d{static BASE=new d(s.Gx,s.Gy,ye,c(s.Gx*s.Gy));static ZERO=new d($t,ye,ye,$t);static Fp=i;static Fn=o;X;Y;Z;T;constructor(b,m,x,S){this.X=l("x",b),this.Y=l("y",m),this.Z=l("z",x,!0),this.T=l("t",S),Object.freeze(this)}static CURVE(){return s}static fromAffine(b){if(b instanceof d)throw new Error("extended point not allowed");let{x:m,y:x}=b||{};return l("x",m),l("y",x),new d(m,x,ye,c(m*x))}static fromBytes(b,m=!1){let x=i.BYTES,{a:S,d:_}=s;b=Wn(V(b,x,"point")),He(m,"zip215");let T=Wn(b),N=b[x-1];T[x-1]=N&-129;let R=Je(T),I=m?f:i.ORDER;zr("point.y",R,$t,I);let O=c(R*R),q=c(O-ye),k=c(_*O-S),{isValid:w,value:E}=u(q,k);if(!w)throw new Error("bad point: invalid y coordinate");let B=(E&ye)===ye,v=(N&128)!==0;if(!m&&E===$t&&v)throw new Error("bad point: x=0 and x_0=1");return v!==B&&(E=c(-E)),d.fromAffine({x:E,y:R})}static fromHex(b,m=!1){return d.fromBytes(Wr(b),m)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(b=8,m=!0){return y.createCache(this,b),m||this.multiply(Ma),this}assertValidity(){let b=this,{a:m,d:x}=s;if(b.is0())throw new Error("bad point: ZERO");let{X:S,Y:_,Z:T,T:N}=b,R=c(S*S),I=c(_*_),O=c(T*T),q=c(O*O),k=c(R*m),w=c(O*c(k+I)),E=c(q+c(x*c(R*I)));if(w!==E)throw new Error("bad point: equation left != right (1)");let B=c(S*_),v=c(T*N);if(B!==v)throw new Error("bad point: equation left != right (2)")}equals(b){p(b);let{X:m,Y:x,Z:S}=this,{X:_,Y:T,Z:N}=b,R=c(m*N),I=c(_*S),O=c(x*N),q=c(T*S);return R===I&&O===q}is0(){return this.equals(d.ZERO)}negate(){return new d(c(-this.X),this.Y,this.Z,c(-this.T))}double(){let{a:b}=s,{X:m,Y:x,Z:S}=this,_=c(m*m),T=c(x*x),N=c(Ma*c(S*S)),R=c(b*_),I=m+x,O=c(c(I*I)-_-T),q=R+T,k=q-N,w=R-T,E=c(O*k),B=c(q*w),v=c(O*w),A=c(k*q);return new d(E,B,A,v)}add(b){p(b);let{a:m,d:x}=s,{X:S,Y:_,Z:T,T:N}=this,{X:R,Y:I,Z:O,T:q}=b,k=c(S*R),w=c(_*I),E=c(N*x*q),B=c(T*O),v=c((S+_)*(R+I)-k-w),A=B-E,C=B+E,D=c(w-m*k),L=c(v*A),P=c(C*D),F=c(v*D),K=c(A*C);return new d(L,P,K,F)}subtract(b){return p(b),this.add(b.negate())}multiply(b){if(!o.isValidNot0(b))throw new RangeError("invalid scalar: expected 1 <= sc < curve.n");let{p:m,f:x}=y.cached(this,b,S=>fr(d,S));return fr(d,[m,x])[0]}multiplyUnsafe(b){if(!o.isValid(b))throw new RangeError("invalid scalar: expected 0 <= sc < curve.n");return b===$t?d.ZERO:this.is0()||b===ye?this:y.unsafe(this,b,m=>fr(d,m))}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return y.unsafe(this,s.n).is0()}toAffine(b){let m=this,x=b,{X:S,Y:_,Z:T}=m,N=m.is0();x==null&&(x=N?Rg:i.inv(T));let R=c(S*x),I=c(_*x),O=i.mul(T,x);if(N)return{x:$t,y:ye};if(O!==ye)throw new Error("invZ was invalid");return{x:R,y:I}}clearCofactor(){return a===ye?this:this.multiplyUnsafe(a)}toBytes(){let{x:b,y:m}=this.toAffine(),x=i.toBytes(m);return x[x.length-1]|=b&ye?128:0,x}toHex(){return jr(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let y=new Xr(d,o.BITS);return o.BITS>=8&&d.BASE.precompute(8),Object.freeze(d.prototype),Object.freeze(d),d}var to=class{static BASE;static ZERO;static Fp;static Fn;ep;constructor(e){this.ep=e}static fromBytes(e){La()}static fromHex(e){La()}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 jr(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.ep.precompute(e,r),this}};function bd(t,e,r={}){if(typeof e!="function")throw new Error('"hash" function param is required');let n=e,i=r;Ve(i,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",zip215:"boolean",mapToCurve:"function"});let{prehash:o}=i,{BASE:s,Fp:a,Fn:f}=t,c=n.outputLen,u=2*a.BYTES;if(c!==void 0&&(Ke(c,"hash.outputLen"),c!==u))throw new Error(`hash.outputLen must be ${u}, got ${c}`);let l=i.randomBytes===void 0?Vn:i.randomBytes,p=i.adjustScalarBytes===void 0?w=>w:i.adjustScalarBytes,d=i.domain===void 0?(w,E,B)=>{if(He(B,"phflag"),E.length||B)throw new Error("Contexts/pre-hash are not supported");return w}:i.domain;function y(w){return f.create(Je(w))}function h(w){let E=R.secretKey;V(w,R.secretKey,"secretKey");let B=V(n(w),2*E,"hashedSecretKey"),v=p(B.slice(0,E)),A=B.slice(E,2*E),C=y(v);return{head:v,prefix:A,scalar:C}}function b(w){let{head:E,prefix:B,scalar:v}=h(w),A=s.multiply(v),C=A.toBytes();return{head:E,prefix:B,scalar:v,point:A,pointBytes:C}}function m(w){return b(w).pointBytes}function x(w=Uint8Array.of(),...E){let B=ue(...E);return y(n(d(B,V(w,void 0,"context"),!!o)))}function S(w,E,B={}){w=V(w,void 0,"message"),o&&(w=o(w));let{prefix:v,scalar:A,pointBytes:C}=b(E),D=x(B.context,v,w),L=s.multiply(D).toBytes(),P=x(B.context,L,C,w),F=f.create(D+P*A);if(!f.isValid(F))throw new Error("sign failed: invalid s");let K=ue(L,f.toBytes(F));return V(K,R.signature,"result")}let _={zip215:i.zip215};function T(w,E,B,v=_){let{context:A}=v,C=v.zip215===void 0?!!_.zip215:v.zip215,D=R.signature;w=V(w,D,"signature"),E=V(E,void 0,"message"),B=V(B,R.publicKey,"publicKey"),C!==void 0&&He(C,"zip215"),o&&(E=o(E));let L=D/2,P=w.subarray(0,L),F=Je(w.subarray(L,D)),K,W,$;try{K=t.fromBytes(B,C),W=t.fromBytes(P,C),$=s.multiplyUnsafe(F)}catch{return!1}if(!C&&K.isSmallOrder())return!1;let fe=x(A,P,B,E);return W.add(K.multiplyUnsafe(fe)).subtract($).clearCofactor().is0()}let N=a.BYTES,R={secretKey:N,publicKey:N,signature:2*N,seed:N};function I(w){return w=w===void 0?l(R.seed):w,V(w,R.seed,"seed")}function O(w){return or(w)&&w.length===R.secretKey}function q(w,E){try{return!!t.fromBytes(w,E===void 0?_.zip215:E)}catch{return!1}}let k={getExtendedPublicKey:b,randomSecretKey:I,isValidSecretKey:O,isValidPublicKey:q,toMontgomery(w){let{y:E}=t.fromBytes(w),B=R.publicKey,v=B===32;if(!v&&B!==57)throw new Error("only defined for 25519 and 448");let A=v?a.div(ye+E,ye-E):a.div(E-ye,E+ye);return a.toBytes(A)},toMontgomerySecret(w){let E=R.secretKey;V(w,E);let B=n(w.subarray(0,E));return p(B).subarray(0,E)}};return Object.freeze(R),Object.freeze(k),Object.freeze({keygen:eo(I,m),getPublicKey:m,sign:S,verify:T,utils:k,Point:t,lengths:R})}function Zn(t,e){if(Ke(t),Ke(e),e<0||e>4)throw new Error("invalid I2OSP length: "+e);if(t<0||t>2**(8*e)-1)throw new Error("invalid I2OSP input: "+t);let r=Array.from({length:e}).fill(0);for(let n=e-1;n>=0;n--)r[n]=t&255,t>>>=8;return new Uint8Array(r)}function Lg(t,e){let r=new Uint8Array(t.length);for(let n=0;n<t.length;n++)r[n]=t[n]^e[n];return r}function Dg(t){if(!or(t)&&typeof t!="string")throw new Error("DST must be Uint8Array or ascii string");let e=typeof t=="string"?Xi(t):t;if(e.length===0)throw new Error("DST must be non-empty");return e}function qa(t,e,r,n){V(t),Ke(r),e=Dg(e),e.length>255&&(e=n(ue(Xi("H2C-OVERSIZE-DST-"),e)));let{outputLen:i,blockLen:o}=n,s=Math.ceil(r/i);if(r>65535||s>255)throw new Error("expand_message_xmd: invalid lenInBytes");let a=ue(e,Zn(e.length,1)),f=new Uint8Array(o),c=Zn(r,2),u=new Array(s),l=n(ue(f,t,c,Zn(0,1),a));u[0]=n(ue(l,Zn(1,1),a));for(let d=1;d<s;d++){let y=[Lg(l,u[d-1]),Zn(d+1,1),a];u[d]=n(ue(...y))}return ue(...u).slice(0,r)}var md="HashToScalar-";var Og=BigInt(0),gt=BigInt(1),wd=BigInt(2);var Ug=BigInt(5),Ng=BigInt(8),Qr=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Va={p:Qr,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Ng,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Pg(t){let e=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),o=Qr,a=t*t%o*t%o,f=Z(a,wd,o)*a%o,c=Z(f,gt,o)*t%o,u=Z(c,Ug,o)*c%o,l=Z(u,e,o)*u%o,p=Z(l,r,o)*l%o,d=Z(p,n,o)*p%o,y=Z(d,i,o)*d%o,h=Z(y,i,o)*d%o,b=Z(h,e,o)*u%o;return{pow_p_5_8:Z(b,wd,o)*t%o,b2:a}}function Fg(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}var $a=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function ja(t,e){let r=Qr,n=ie(e*e*e,r),i=ie(n*n*e,r),o=Pg(t*i).pow_p_5_8,s=ie(t*n*o,r),a=ie(e*s*s,r),f=s,c=ie(s*$a,r),u=a===t,l=a===ie(-t,r),p=a===ie(-t*$a,r);return u&&(s=f),(l||p)&&(s=c),wt(s,r)&&(s=ie(-s,r)),{isValid:u||l,value:s}}var Kt=yd(Va,{uvRatio:ja}),Ht=Kt.Fp,Ed=Kt.Fn;function kg(t){return bd(Kt,Wi,Object.assign({adjustScalarBytes:Fg,zip215:!0},t))}var Sd=kg({});var Ha=$a,Mg=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),qg=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),$g=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),Hg=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),gd=t=>ja(gt,t),Kg=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),Ka=t=>Ht.create(Je(t)&Kg);function xd(t){let{d:e}=Va,r=Qr,n=m=>Ht.create(m),i=n(Ha*t*t),o=n((i+gt)*$g),s=BigInt(-1),a=n((s-e*i)*n(i+e)),{isValid:f,value:c}=ja(o,a),u=n(c*t);wt(u,r)||(u=n(-u)),f||(c=u),f||(s=i);let l=n(s*(i-gt)*Hg-a),p=c*c,d=n((c+c)*a),y=n(l*Mg),h=n(gt-p),b=n(gt+p);return new Kt(n(d*b),n(h*y),n(y*b),n(d*h))}var Vt=class t extends to{static BASE=new t(Kt.BASE);static ZERO=new t(Kt.ZERO);static Fp=Ht;static Fn=Ed;constructor(e){super(e)}static fromAffine(e){return new t(Kt.fromAffine(e))}assertSame(e){if(!(e instanceof t))throw new Error("RistrettoPoint expected")}init(e){return new t(e)}static fromBytes(e){Oe(e,32);let{a:r,d:n}=Va,i=Qr,o=_=>Ht.create(_),s=Ka(e);if(!Zl(Ht.toBytes(s),e)||wt(s,i))throw new Error("invalid ristretto255 encoding 1");let a=o(s*s),f=o(gt+r*a),c=o(gt-r*a),u=o(f*f),l=o(c*c),p=o(r*n*u-l),{isValid:d,value:y}=gd(o(p*l)),h=o(y*c),b=o(y*h*p),m=o((s+s)*h);wt(m,i)&&(m=o(-m));let x=o(f*b),S=o(m*x);if(!d||wt(S,i)||x===Og)throw new Error("invalid ristretto255 encoding 2");return new t(new Kt(m,x,gt,S))}static fromHex(e){return t.fromBytes(qn(e))}toBytes(){let{X:e,Y:r,Z:n,T:i}=this.ep,o=Qr,s=b=>Ht.create(b),a=s(s(n+r)*s(n-r)),f=s(e*r),c=s(f*f),{value:u}=gd(s(a*c)),l=s(u*a),p=s(u*f),d=s(l*p*i),y;if(wt(i*d,o)){let b=s(r*Ha),m=s(e*Ha);e=b,r=m,y=s(l*qg)}else y=p;wt(e*d,o)&&(r=s(-r));let h=s((n-r)*y);return wt(h,o)&&(h=s(-h)),Ht.toBytes(h)}equals(e){this.assertSame(e);let{X:r,Y:n}=this.ep,{X:i,Y:o}=e.ep,s=c=>Ht.create(c),a=s(r*o)===s(n*i),f=s(n*o)===s(r*i);return a||f}is0(){return this.equals(t.ZERO)}};Object.freeze(Vt.BASE);Object.freeze(Vt.ZERO);Object.freeze(Vt.prototype);Object.freeze(Vt);var Vg=Object.freeze({Point:Vt,hashToCurve(t,e){let r=e?.DST===void 0?"ristretto255_XMD:SHA-512_R255MAP_RO_":e.DST,n=qa(t,r,64,Wi);return Vg.deriveToCurve(n)},hashToScalar(t,e={DST:md}){let r=qa(t,e.DST,64,Wi);return Ed.create(Je(r))},deriveToCurve(t){Oe(t,64);let e=Ka(t.subarray(0,32)),r=xd(e),n=Ka(t.subarray(32,64)),i=xd(n);return new Vt(r.add(i))}});var Xn=class extends Error{constructor(e="An error occurred while verifying a message"){super(e),this.name="VerificationError"}},ro=class extends Error{constructor(e="Missing Web Crypto API"){super(e),this.name="WebCryptoMissingError"}};var no={get(t=globalThis){let e=t.crypto;if(e?.subtle==null)throw new ro("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 io=32;var Wa,jg=(async()=>{try{return await no.get().subtle.generateKey({name:"Ed25519"},!0,["sign","verify"]),!0}catch{return!1}})();async function Wg(t,e,r){if(t.buffer instanceof ArrayBuffer){let n=await no.get().subtle.importKey("raw",t.buffer,{name:"Ed25519"},!1,["verify"]);return await no.get().subtle.verify({name:"Ed25519"},n,Nt(e),Nt(r instanceof Uint8Array?r:r.subarray()))}throw new TypeError("WebCrypto does not support SharedArrayBuffer for Ed25519 keys")}function zg(t,e,r){return Sd.verify(e,r instanceof Uint8Array?r:r.subarray(),t)}async function _d(t,e,r){return Wa==null&&(Wa=await jg),Wa?Wg(t,e,r):zg(t,e,r)}function oo(t){return t==null?!1:typeof t.then=="function"&&typeof t.catch=="function"&&typeof t.finally=="function"}var so=class{type="Ed25519";raw;constructor(e){this.raw=za(e,io)}toMultihash(){return Me.digest(Kr(this))}toCID(){return we.createV1(114,this.toMultihash())}toString(){return ae.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ut(this.raw,e.raw)}verify(e,r,n){n?.signal?.throwIfAborted();let i=_d(this.raw,r,e);return oo(i)?i.then(o=>(n?.signal?.throwIfAborted(),o)):i}};function vd(t){return t=za(t,io),new so(t)}function za(t,e){if(t=Uint8Array.from(t??[]),t.length!==e)throw new Ie(`Key must be a Uint8Array of length ${e}, got ${t.length}`);return t}var Yg=Math.pow(2,7),Zg=Math.pow(2,14),Xg=Math.pow(2,21),Ga=Math.pow(2,28),Ya=Math.pow(2,35),Za=Math.pow(2,42),Xa=Math.pow(2,49),Q=128,_e=127;function et(t){if(t<Yg)return 1;if(t<Zg)return 2;if(t<Xg)return 3;if(t<Ga)return 4;if(t<Ya)return 5;if(t<Za)return 6;if(t<Xa)return 7;if(Number.MAX_SAFE_INTEGER!=null&&t>Number.MAX_SAFE_INTEGER)throw new RangeError("Could not encode varint");return 8}function Qn(t,e,r=0){switch(et(t)){case 8:e[r++]=t&255|Q,t/=128;case 7:e[r++]=t&255|Q,t/=128;case 6:e[r++]=t&255|Q,t/=128;case 5:e[r++]=t&255|Q,t/=128;case 4:e[r++]=t&255|Q,t>>>=7;case 3:e[r++]=t&255|Q,t>>>=7;case 2:e[r++]=t&255|Q,t>>>=7;case 1:{e[r++]=t&255,t>>>=7;break}default:throw new Error("unreachable")}return e}function Qa(t,e){let r=t[e],n=0;if(n+=r&_e,r<Q||(r=t[e+1],n+=(r&_e)<<7,r<Q)||(r=t[e+2],n+=(r&_e)<<14,r<Q)||(r=t[e+3],n+=(r&_e)<<21,r<Q)||(r=t[e+4],n+=(r&_e)*Ga,r<Q)||(r=t[e+5],n+=(r&_e)*Ya,r<Q)||(r=t[e+6],n+=(r&_e)*Za,r<Q)||(r=t[e+7],n+=(r&_e)*Xa,r<Q))return n;throw new RangeError("Could not decode varint")}function Qg(t,e){let r=t.get(e),n=0;if(n+=r&_e,r<Q||(r=t.get(e+1),n+=(r&_e)<<7,r<Q)||(r=t.get(e+2),n+=(r&_e)<<14,r<Q)||(r=t.get(e+3),n+=(r&_e)<<21,r<Q)||(r=t.get(e+4),n+=(r&_e)*Ga,r<Q)||(r=t.get(e+5),n+=(r&_e)*Ya,r<Q)||(r=t.get(e+6),n+=(r&_e)*Za,r<Q)||(r=t.get(e+7),n+=(r&_e)*Xa,r<Q))return n;throw new RangeError("Could not decode varint")}function Ja(t,e=0){return t instanceof Uint8Array?Qa(t,e):Qg(t,e)}var ec=new Float32Array([-0]),jt=new Uint8Array(ec.buffer);function Td(t,e,r){ec[0]=t,e[r]=jt[0],e[r+1]=jt[1],e[r+2]=jt[2],e[r+3]=jt[3]}function Id(t,e){return jt[0]=t[e],jt[1]=t[e+1],jt[2]=t[e+2],jt[3]=t[e+3],ec[0]}var tc=new Float64Array([-0]),Ae=new Uint8Array(tc.buffer);function Bd(t,e,r){tc[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 Rd(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],tc[0]}var ex=BigInt(Number.MAX_SAFE_INTEGER),tx=BigInt(Number.MIN_SAFE_INTEGER),Ue=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 ur;if(e<ex&&e>tx)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>Cd&&(i=0n,++n>Cd&&(n=0n))),new t(Number(i),Number(n))}static fromNumber(e){if(e===0)return ur;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):ur}},ur=new Ue(0,0);ur.toBigInt=function(){return 0n};ur.zzEncode=ur.zzDecode=function(){return this};ur.length=function(){return 1};var Cd=4294967296n;function Ld(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 Dd(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 rc(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 je(t,e){return RangeError(`index out of range: ${t.pos} + ${e??1} > ${t.len}`)}function ao(t,e){return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0}var nc=class{buf;pos;len;_slice=Uint8Array.prototype.subarray;constructor(e){this.buf=Nt(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,je(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 je(this,4);return ao(this.buf,this.pos+=4)}sfixed32(){if(this.pos+4>this.len)throw je(this,4);return ao(this.buf,this.pos+=4)|0}float(){if(this.pos+4>this.len)throw je(this,4);let e=Id(this.buf,this.pos);return this.pos+=4,e}double(){if(this.pos+8>this.len)throw je(this,4);let e=Rd(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 je(this,e);return this.pos+=e,r===n?new Uint8Array(0):this.buf.subarray(r,n)}string(){let e=this.bytes();return Dd(e,0,e.length)}skip(e){if(typeof e=="number"){if(this.pos+e>this.len)throw je(this,e);this.pos+=e}else do if(this.pos>=this.len)throw je(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 Ue(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 je(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 je(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 je(this,8);let e=ao(this.buf,this.pos+=4),r=ao(this.buf,this.pos+=4);return new Ue(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=Qa(this.buf,this.pos);return this.pos+=et(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 Jn(t){return new nc(t instanceof Uint8Array?t:t.subarray())}function co(t,e,r){let n=Jn(t);return e.decode(n,void 0,r)}function ic(t){let e=t??8192,r=e>>>1,n,i=e;return function(s){if(s<1||s>r)return Ne(s);i+s>e&&(n=Ne(e),i=0);let a=n.subarray(i,i+=s);return(i&7)!==0&&(i=(i|7)+1),a}}var lr=class{fn;len;next;val;constructor(e,r,n){this.fn=e,this.len=r,this.next=void 0,this.val=n}};function oc(){}var ac=class{head;tail;len;next;constructor(e){this.head=e.head,this.tail=e.tail,this.len=e.len,this.next=e.states}},rx=ic();function nx(t){return globalThis.Buffer!=null?Ne(t):rx(t)}var ti=class{len;head;tail;states;constructor(){this.len=0,this.head=new lr(oc,0,0),this.tail=this.head,this.states=null}_push(e,r,n){return this.tail=this.tail.next=new lr(e,r,n),this.len+=r,this}uint32(e){return this.len+=(this.tail=this.tail.next=new cc((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(fo,10,Ue.fromNumber(e)):this.uint32(e)}sint32(e){return this.uint32((e<<1^e>>31)>>>0)}uint64(e){let r=Ue.fromBigInt(e);return this._push(fo,r.length(),r)}uint64Number(e){return this._push(Qn,et(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=Ue.fromBigInt(e).zzEncode();return this._push(fo,r.length(),r)}sint64Number(e){let r=Ue.fromNumber(e).zzEncode();return this._push(fo,r.length(),r)}sint64String(e){return this.sint64(BigInt(e))}bool(e){return this._push(sc,1,e?1:0)}fixed32(e){return this._push(ei,4,e>>>0)}sfixed32(e){return this.fixed32(e)}fixed64(e){let r=Ue.fromBigInt(e);return this._push(ei,4,r.lo)._push(ei,4,r.hi)}fixed64Number(e){let r=Ue.fromNumber(e);return this._push(ei,4,r.lo)._push(ei,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(Td,4,e)}double(e){return this._push(Bd,8,e)}bytes(e){let r=e.length>>>0;return r===0?this._push(sc,1,0):this.uint32(r)._push(ox,r,e)}string(e){let r=Ld(e);return r!==0?this.uint32(r)._push(rc,r,e):this._push(sc,1,0)}fork(){return this.states=new ac(this),this.head=this.tail=new lr(oc,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 lr(oc,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=nx(this.len),n=0;for(;e!=null;)e.fn(e.val,r,n),n+=e.len,e=e.next;return r}};function sc(t,e,r){e[r]=t&255}function ix(t,e,r){for(;t>127;)e[r++]=t&127|128,t>>>=7;e[r]=t}var cc=class extends lr{next;constructor(e,r){super(ix,e,r),this.next=void 0}};function fo(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 ei(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 ox(t,e,r){e.set(t,r)}globalThis.Buffer!=null&&(ti.prototype.bytes=function(t){let e=t.length>>>0;return this.uint32(e),e>0&&this._push(sx,e,t),this},ti.prototype.string=function(t){let e=globalThis.Buffer.byteLength(t);return this.uint32(e),e>0&&this._push(ax,e,t),this});function sx(t,e,r){e.set(t,r)}function ax(t,e,r){t.length<40?rc(t,e,r):e.utf8Write!=null?e.utf8Write(t,r):e.set($r(t),r)}function fc(){return new ti}function uo(t,e){let r=fc();return e.encode(t,r,{lengthDelimited:!1}),r.finish()}function*lo(t,e,r){let n=Jn(t);yield*e.stream(n,void 0,"$",r)}var ho={VARINT:0,BIT64:1,LENGTH_DELIMITED:2,START_GROUP:3,END_GROUP:4,BIT32:5};function po(t,e,r,n,i){return{name:t,type:e,encode:r,decode:n,stream:i}}function uc(t){function e(o){if(t[o.toString()]==null)throw new Error("Invalid enum value");return t[o]}let r=function(s,a){let f=e(s);a.int32(f)},n=function(s){let a=s.int32();return e(a)},i=function*(s){let a=s.int32();yield e(a)};return po("enum",ho.VARINT,r,n,i)}function yo(t,e,r){return po("message",ho.LENGTH_DELIMITED,t,e,r)}var Be;(function(t){t.RSA="RSA",t.Ed25519="Ed25519",t.secp256k1="secp256k1",t.ECDSA="ECDSA"})(Be||(Be={}));var lc;(function(t){t[t.RSA=0]="RSA",t[t.Ed25519=1]="Ed25519",t[t.secp256k1=2]="secp256k1",t[t.ECDSA=3]="ECDSA"})(lc||(lc={}));(function(t){t.codec=()=>uc(lc)})(Be||(Be={}));var ri;(function(t){let e;t.codec=()=>(e==null&&(e=yo((o,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),o.Type!=null&&(s.uint32(8),Be.codec().encode(o.Type,s)),o.Data!=null&&(s.uint32(18),s.bytes(o.Data)),a.lengthDelimited!==!1&&s.ldelim()},(o,s,a={})=>{let f={},c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{f.Type=Be.codec().decode(o);break}case 2:{f.Data=o.bytes();break}default:{o.skipType(u&7);break}}}return f},function*(o,s,a,f={}){let c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{yield{field:`${a}.Type`,value:Be.codec().decode(o)};break}case 2:{yield{field:`${a}.Data`,value:o.bytes()};break}default:{o.skipType(u&7);break}}}})),e);function r(o){return uo(o,t.codec())}t.encode=r;function n(o,s){return co(o,t.codec(),s)}t.decode=n;function i(o,s){return lo(o,t.codec(),s)}t.stream=i})(ri||(ri={}));var dc;(function(t){let e;t.codec=()=>(e==null&&(e=yo((o,s,a={})=>{a.lengthDelimited!==!1&&s.fork(),o.Type!=null&&(s.uint32(8),Be.codec().encode(o.Type,s)),o.Data!=null&&(s.uint32(18),s.bytes(o.Data)),a.lengthDelimited!==!1&&s.ldelim()},(o,s,a={})=>{let f={},c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{f.Type=Be.codec().decode(o);break}case 2:{f.Data=o.bytes();break}default:{o.skipType(u&7);break}}}return f},function*(o,s,a,f={}){let c=s==null?o.len:o.pos+s;for(;o.pos<c;){let u=o.uint32();switch(u>>>3){case 1:{yield{field:`${a}.Type`,value:Be.codec().decode(o)};break}case 2:{yield{field:`${a}.Data`,value:o.bytes()};break}default:{o.skipType(u&7);break}}}})),e);function r(o){return uo(o,t.codec())}t.encode=r;function n(o,s){return co(o,t.codec(),s)}t.decode=n;function i(o,s){return lo(o,t.codec(),s)}t.stream=i})(dc||(dc={}));var bo=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,r){if($i(e),Oe(r,void 0,"key"),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 n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),bt(i)}update(e){return Vr(this),this.iHash.update(e),this}digestInto(e){Vr(this),Hi(e,this),this.finished=!0;let r=e.subarray(0,this.outputLen);this.iHash.digestInto(r),this.oHash.update(r),this.oHash.digestInto(r),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(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()}},Ud=(()=>{let t=((e,r,n)=>new bo(e,r).update(n).digest());return t.create=(e,r)=>new bo(e,r),t})();var Nd=(t,e)=>(t+(t>=0?e:-e)/Pd)/e;function fx(t,e,r){zr("scalar",t,tt,r);let[[n,i],[o,s]]=e,a=Nd(s*t,r),f=Nd(-i*t,r),c=t-a*n-f*o,u=-a*i-f*s,l=c<tt,p=u<tt;l&&(c=-c),p&&(u=-u);let d=zn(Math.ceil(Gr(r)/2))+Wt;if(c<tt||c>=d||u<tt||u>=d)throw new Error("splitScalar (endomorphism): failed for k");return{k1neg:l,k1:c,k2neg:p,k2:u}}function pc(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function hc(t,e){Ve(t);let r={};for(let n of Object.keys(e))r[n]=t[n]===void 0?e[n]:t[n];return He(r.lowS,"lowS"),He(r.prehash,"prehash"),r.format!==void 0&&pc(r.format),r}var yc=class extends Error{constructor(e=""){super(e)}},We={Err:yc,_tlv:{encode:(t,e)=>{let{Err:r}=We;if(Ke(t,"tag"),t<0||t>255)throw new r("tlv.encode: wrong tag");if(typeof e!="string")throw new TypeError('"data" expected string, got type='+typeof e);if(e.length&1)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=jn(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?jn(i.length/2|128):"";return jn(t)+o+i+e},decode(t,e){let{Err:r}=We;e=V(e,void 0,"DER data");let n=0;if(t<0||t>255)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 f=i&127;if(!f)throw new r("tlv.decode(long): indefinite length not supported");if(f>4)throw new r("tlv.decode(long): byte length is too big");let c=e.subarray(n,n+f);if(c.length!==f)throw new r("tlv.decode: length bytes not complete");if(c[0]===0)throw new r("tlv.decode(long): zero leftmost byte");for(let u of c)s=s<<8|u;if(n+=f,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}=We;if(Yi(t),t<tt)throw new e("integer: negative integers are not allowed");let r=jn(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}=We;if(t.length<1)throw new e("invalid signature integer: empty");if(t[0]&128)throw new e("invalid signature integer: negative");if(t.length>1&&t[0]===0&&!(t[1]&128))throw new e("invalid signature integer: unnecessary leading zero");return sr(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=We,i=V(t,void 0,"signature"),{v:o,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");let{v:a,l:f}=n.decode(2,o),{v:c,l:u}=n.decode(2,f);if(u.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}=We,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s)),o=n+i;return e.encode(48,o)}};Object.freeze(We._tlv);Object.freeze(We._int);Object.freeze(We);var tt=BigInt(0),Wt=BigInt(1),Pd=BigInt(2),mo=BigInt(3),ux=BigInt(4);function Fd(t,e={}){let r=Ji("weierstrass",t,e),n=r.Fp,i=r.Fn,o=r.CURVE,{h:s,n:a}=o;Ve(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object"});let{endo:f,allowInfinityPoint:c}=e;if(f&&(!n.is0(o.a)||typeof f.beta!="bigint"||!Array.isArray(f.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');let u=Md(n,i);function l(){if(!n.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function p(k,w,E){if(c&&w.is0())return Uint8Array.of(0);let{x:B,y:v}=w.toAffine(),A=n.toBytes(B);if(He(E,"isCompressed"),E){l();let C=!n.isOdd(v);return ue(kd(C),A)}else return ue(Uint8Array.of(4),A,n.toBytes(v))}function d(k){V(k,void 0,"Point");let{publicKey:w,publicKeyUncompressed:E}=u,B=k.length,v=k[0],A=k.subarray(1);if(c&&B===1&&v===0)return{x:n.ZERO,y:n.ZERO};if(B===w&&(v===2||v===3)){let C=n.fromBytes(A);if(!n.isValid(C))throw new Error("bad point: is not on curve, wrong x");let D=b(C),L;try{L=n.sqrt(D)}catch(K){let W=K instanceof Error?": "+K.message:"";throw new Error("bad point: is not on curve, sqrt error"+W)}l();let P=n.isOdd(L);return(v&1)===1!==P&&(L=n.neg(L)),{x:C,y:L}}else if(B===E&&v===4){let C=n.BYTES,D=n.fromBytes(A.subarray(0,C)),L=n.fromBytes(A.subarray(C,C*2));if(!m(D,L))throw new Error("bad point: is not on curve");return{x:D,y:L}}else throw new Error(`bad point: got length ${B}, expected compressed=${w} or uncompressed=${E}`)}let y=e.toBytes===void 0?p:e.toBytes,h=e.fromBytes===void 0?d:e.fromBytes;function b(k){let w=n.sqr(k),E=n.mul(w,k);return n.add(n.add(E,n.mul(k,o.a)),o.b)}function m(k,w){let E=n.sqr(w),B=b(k);return n.eql(E,B)}if(!m(o.Gx,o.Gy))throw new Error("bad curve params: generator point");let x=n.mul(n.pow(o.a,mo),ux),S=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(x,S)))throw new Error("bad curve params: a or b");function _(k,w,E=!1){if(!n.isValid(w)||E&&n.is0(w))throw new Error(`bad point coordinate ${k}`);return w}function T(k){if(!(k instanceof I))throw new Error("Weierstrass Point expected")}function N(k){if(!f||!f.basises)throw new Error("no endo");return fx(k,f.basises,i.ORDER)}function R(k,w,E,B,v){return E=new I(n.mul(E.X,k),E.Y,E.Z),w=Yn(B,w),E=Yn(v,E),w.add(E)}class I{static BASE=new I(o.Gx,o.Gy,n.ONE);static ZERO=new I(n.ZERO,n.ONE,n.ZERO);static Fp=n;static Fn=i;X;Y;Z;constructor(w,E,B){this.X=_("x",w),this.Y=_("y",E,!0),this.Z=_("z",B),Object.freeze(this)}static CURVE(){return o}static fromAffine(w){let{x:E,y:B}=w||{};if(!w||!n.isValid(E)||!n.isValid(B))throw new Error("invalid affine point");if(w instanceof I)throw new Error("projective point not allowed");return n.is0(E)&&n.is0(B)?I.ZERO:new I(E,B,n.ONE)}static fromBytes(w){let E=I.fromAffine(h(V(w,void 0,"point")));return E.assertValidity(),E}static fromHex(w){return I.fromBytes(Wr(w))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(w=8,E=!0){return q.createCache(this,w),E||this.multiply(mo),this}assertValidity(){let w=this;if(w.is0()){if(e.allowInfinityPoint&&n.is0(w.X)&&n.eql(w.Y,n.ONE)&&n.is0(w.Z))return;throw new Error("bad point: ZERO")}let{x:E,y:B}=w.toAffine();if(!n.isValid(E)||!n.isValid(B))throw new Error("bad point: x or y not field elements");if(!m(E,B))throw new Error("bad point: equation left != right");if(!w.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:w}=this.toAffine();if(!n.isOdd)throw new Error("Field doesn't support isOdd");return!n.isOdd(w)}equals(w){T(w);let{X:E,Y:B,Z:v}=this,{X:A,Y:C,Z:D}=w,L=n.eql(n.mul(E,D),n.mul(A,v)),P=n.eql(n.mul(B,D),n.mul(C,v));return L&&P}negate(){return new I(this.X,n.neg(this.Y),this.Z)}double(){let{a:w,b:E}=o,B=n.mul(E,mo),{X:v,Y:A,Z:C}=this,D=n.ZERO,L=n.ZERO,P=n.ZERO,F=n.mul(v,v),K=n.mul(A,A),W=n.mul(C,C),$=n.mul(v,A);return $=n.add($,$),P=n.mul(v,C),P=n.add(P,P),D=n.mul(w,P),L=n.mul(B,W),L=n.add(D,L),D=n.sub(K,L),L=n.add(K,L),L=n.mul(D,L),D=n.mul($,D),P=n.mul(B,P),W=n.mul(w,W),$=n.sub(F,W),$=n.mul(w,$),$=n.add($,P),P=n.add(F,F),F=n.add(P,F),F=n.add(F,W),F=n.mul(F,$),L=n.add(L,F),W=n.mul(A,C),W=n.add(W,W),F=n.mul(W,$),D=n.sub(D,F),P=n.mul(W,K),P=n.add(P,P),P=n.add(P,P),new I(D,L,P)}add(w){T(w);let{X:E,Y:B,Z:v}=this,{X:A,Y:C,Z:D}=w,L=n.ZERO,P=n.ZERO,F=n.ZERO,K=o.a,W=n.mul(o.b,mo),$=n.mul(E,A),fe=n.mul(B,C),he=n.mul(v,D),pe=n.add(E,B),ne=n.add(A,C);pe=n.mul(pe,ne),ne=n.add($,fe),pe=n.sub(pe,ne),ne=n.add(E,v);let Ce=n.add(A,D);return ne=n.mul(ne,Ce),Ce=n.add($,he),ne=n.sub(ne,Ce),Ce=n.add(B,v),L=n.add(C,D),Ce=n.mul(Ce,L),L=n.add(fe,he),Ce=n.sub(Ce,L),F=n.mul(K,ne),L=n.mul(W,he),F=n.add(L,F),L=n.sub(fe,F),F=n.add(fe,F),P=n.mul(L,F),fe=n.add($,$),fe=n.add(fe,$),he=n.mul(K,he),ne=n.mul(W,ne),fe=n.add(fe,he),he=n.sub($,he),he=n.mul(K,he),ne=n.add(ne,he),$=n.mul(fe,ne),P=n.add(P,$),$=n.mul(Ce,ne),L=n.mul(pe,L),L=n.sub(L,$),$=n.mul(pe,fe),F=n.mul(Ce,F),F=n.add(F,$),new I(L,P,F)}subtract(w){return T(w),this.add(w.negate())}is0(){return this.equals(I.ZERO)}multiply(w){let{endo:E}=e;if(!i.isValidNot0(w))throw new RangeError("invalid scalar: out of range");let B,v,A=C=>q.cached(this,C,D=>fr(I,D));if(E){let{k1neg:C,k1:D,k2neg:L,k2:P}=N(w),{p:F,f:K}=A(D),{p:W,f:$}=A(P);v=K.add($),B=R(E.beta,F,W,C,L)}else{let{p:C,f:D}=A(w);B=C,v=D}return fr(I,[B,v])[0]}multiplyUnsafe(w){let{endo:E}=e,B=this,v=w;if(!i.isValid(v))throw new RangeError("invalid scalar: out of range");if(v===tt||B.is0())return I.ZERO;if(v===Wt)return B;if(q.hasCache(this))return this.multiply(v);if(E){let{k1neg:A,k1:C,k2neg:D,k2:L}=N(v),{p1:P,p2:F}=pd(I,B,C,L);return R(E.beta,P,F,A,D)}else return q.unsafe(B,v)}toAffine(w){let E=this,B=w,{X:v,Y:A,Z:C}=E;if(n.eql(C,n.ONE))return{x:v,y:A};let D=E.is0();B==null&&(B=D?n.ONE:n.inv(C));let L=n.mul(v,B),P=n.mul(A,B),F=n.mul(C,B);if(D)return{x:n.ZERO,y:n.ZERO};if(!n.eql(F,n.ONE))throw new Error("invZ was invalid");return{x:L,y:P}}isTorsionFree(){let{isTorsionFree:w}=e;return s===Wt?!0:w?w(I,this):q.unsafe(this,a).is0()}clearCofactor(){let{clearCofactor:w}=e;return s===Wt?this:w?w(I,this):this.multiplyUnsafe(s)}isSmallOrder(){return s===Wt?this.is0():this.clearCofactor().is0()}toBytes(w=!0){return He(w,"isCompressed"),this.assertValidity(),y(I,this,w)}toHex(w=!0){return jr(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}let O=i.BITS,q=new Xr(I,e.endo?Math.ceil(O/2):O);return O>=8&&I.BASE.precompute(8),Object.freeze(I.prototype),Object.freeze(I),I}function kd(t){return Uint8Array.of(t?2:3)}function Md(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function lx(t,e={}){let{Fn:r}=t,n=e.randomBytes===void 0?Vn:e.randomBytes,i=Object.assign(Md(t.Fp,r),{seed:Math.max(Ua(r.ORDER),16)});function o(d){try{let y=r.fromBytes(d);return r.isValidNot0(y)}catch{return!1}}function s(d,y){let{publicKey:h,publicKeyUncompressed:b}=i;try{let m=d.length;return y===!0&&m!==h||y===!1&&m!==b?!1:!!t.fromBytes(d)}catch{return!1}}function a(d){return d=d===void 0?n(i.seed):d,Na(V(d,i.seed,"seed"),r.ORDER)}function f(d,y=!0){return t.BASE.multiply(r.fromBytes(d)).toBytes(y)}function c(d){let{secretKey:y,publicKey:h,publicKeyUncompressed:b}=i,m=r._lengths;if(!or(d))return;let x=V(d,void 0,"key").length,S=x===h||x===b,_=x===y||!!m?.includes(x);if(!(S&&_))return S}function u(d,y,h=!0){if(c(d)===!0)throw new Error("first arg must be private key");if(c(y)===!1)throw new Error("second arg must be public key");let b=r.fromBytes(d);return t.fromBytes(y).multiply(b).toBytes(h)}let l={isValidSecretKey:o,isValidPublicKey:s,randomSecretKey:a},p=eo(a,f);return Object.freeze(l),Object.freeze(i),Object.freeze({getPublicKey:f,getSharedSecret:u,keygen:p,Point:t,utils:l,lengths:i})}function qd(t,e,r={}){let n=e;$i(n),Ve(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"}),r=Object.assign({},r);let i=r.randomBytes===void 0?Vn:r.randomBytes,o=r.hmac===void 0?(v,A)=>Ud(n,v,A):r.hmac,{Fp:s,Fn:a}=t,{ORDER:f,BITS:c}=a,{keygen:u,getPublicKey:l,getSharedSecret:p,utils:d,lengths:y}=lx(t,r),h={prehash:!0,lowS:typeof r.lowS=="boolean"?r.lowS:!0,format:"compact",extraEntropy:!1},b=f*Pd+Wt<s.ORDER;function m(v){let A=f>>Wt;return v>A}function x(v,A){if(!a.isValidNot0(A))throw new Error(`invalid signature ${v}: out of range 1..Point.Fn.ORDER`);return A}function S(){if(b)throw new Error('"recovered" sig type is not supported for cofactor >2 curves')}function _(v,A){pc(A);let C=y.signature,D=A==="compact"?C:A==="recovered"?C+1:void 0;return V(v,D)}class T{r;s;recovery;constructor(A,C,D){if(this.r=x("r",A),this.s=x("s",C),D!=null){if(S(),![0,1,2,3].includes(D))throw new Error("invalid recovery id");this.recovery=D}Object.freeze(this)}static fromBytes(A,C=h.format){_(A,C);let D;if(C==="der"){let{r:K,s:W}=We.toSig(V(A));return new T(K,W)}C==="recovered"&&(D=A[0],C="compact",A=A.subarray(1));let L=y.signature/2,P=A.subarray(0,L),F=A.subarray(L,L*2);return new T(a.fromBytes(P),a.fromBytes(F),D)}static fromHex(A,C){return this.fromBytes(Wr(A),C)}assertRecovery(){let{recovery:A}=this;if(A==null)throw new Error("invalid recovery id: must be present");return A}addRecoveryBit(A){return new T(this.r,this.s,A)}recoverPublicKey(A){let{r:C,s:D}=this,L=this.assertRecovery(),P=L===2||L===3?C+f:C;if(!s.isValid(P))throw new Error("invalid recovery id: sig.r+curve.n != R.x");let F=s.toBytes(P),K=t.fromBytes(ue(kd((L&1)===0),F)),W=a.inv(P),$=R(V(A,void 0,"msgHash")),fe=a.create(-$*W),he=a.create(D*W),pe=t.BASE.multiplyUnsafe(fe).add(K.multiplyUnsafe(he));if(pe.is0())throw new Error("invalid recovery: point at infinify");return pe.assertValidity(),pe}hasHighS(){return m(this.s)}toBytes(A=h.format){if(pc(A),A==="der")return Wr(We.hexFromSig(this));let{r:C,s:D}=this,L=a.toBytes(C),P=a.toBytes(D);return A==="recovered"?(S(),ue(Uint8Array.of(this.assertRecovery()),L,P)):ue(L,P)}toHex(A){return jr(this.toBytes(A))}}Object.freeze(T.prototype),Object.freeze(T);let N=r.bits2int===void 0?function(A){if(A.length>8192)throw new Error("input is too large");let C=sr(A),D=A.length*8-c;return D>0?C>>BigInt(D):C}:r.bits2int,R=r.bits2int_modN===void 0?function(A){return a.create(N(A))}:r.bits2int_modN,I=zn(c);function O(v){return zr("num < 2^"+c,v,tt,I),a.toBytes(v)}function q(v,A){return V(v,void 0,"message"),A?V(n(v),void 0,"prehashed message"):v}function k(v,A,C){let{lowS:D,prehash:L,extraEntropy:P}=hc(C,h);v=q(v,L);let F=R(v),K=a.fromBytes(A);if(!a.isValidNot0(K))throw new Error("invalid private key");let W=[O(K),O(F)];if(P!=null&&P!==!1){let pe=P===!0?i(y.secretKey):P;W.push(V(pe,void 0,"extraEntropy"))}let $=ue(...W),fe=F;function he(pe){let ne=N(pe);if(!a.isValidNot0(ne))return;let Ce=a.inv(ne),Br=t.BASE.multiply(ne).toAffine(),An=a.create(Br.x);if(An===tt)return;let vi=a.create(Ce*a.create(fe+An*K));if(vi===tt)return;let Tu=(Br.x===An?0:2)|Number(Br.y&Wt),Iu=vi;return D&&m(vi)&&(Iu=a.neg(vi),Tu^=1),new T(An,Iu,b?void 0:Tu)}return{seed:$,k2sig:he}}function w(v,A,C={}){let{seed:D,k2sig:L}=k(v,A,C);return Xl(n.outputLen,a.BYTES,o)(D,L).toBytes(C.format)}function E(v,A,C,D={}){let{lowS:L,prehash:P,format:F}=hc(D,h);if(C=V(C,void 0,"publicKey"),A=q(A,P),!or(v)){let K=v instanceof T?", use sig.toBytes()":"";throw new Error("verify expects Uint8Array signature"+K)}_(v,F);try{let K=T.fromBytes(v,F),W=t.fromBytes(C);if(L&&K.hasHighS())return!1;let{r:$,s:fe}=K,he=R(A),pe=a.inv(fe),ne=a.create(he*pe),Ce=a.create($*pe),Br=t.BASE.multiplyUnsafe(ne).add(W.multiplyUnsafe(Ce));return Br.is0()?!1:a.create(Br.x)===$}catch{return!1}}function B(v,A,C={}){let{prehash:D}=hc(C,h);return A=q(A,D),T.fromBytes(v,"recovered").recoverPublicKey(A).toBytes()}return Object.freeze({keygen:u,getPublicKey:l,getSharedSecret:p,utils:d,lengths:y,Point:t,sign:w,verify:E,recoverPublicKey:B,Signature:T,hash:n})}var mc={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},dx={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]};var $d=BigInt(2);function hx(t){let e=mc.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),c=t*t*t%e,u=c*c*t%e,l=Z(u,r,e)*u%e,p=Z(l,r,e)*u%e,d=Z(p,$d,e)*c%e,y=Z(d,i,e)*d%e,h=Z(y,o,e)*y%e,b=Z(h,a,e)*h%e,m=Z(b,f,e)*b%e,x=Z(m,a,e)*h%e,S=Z(x,r,e)*u%e,_=Z(S,s,e)*y%e,T=Z(_,n,e)*c%e,N=Z(T,$d,e);if(!bc.eql(bc.sqr(N),t))throw new Error("Cannot find square root");return N}var bc=Yr(mc.p,{sqrt:hx}),px=Fd(mc,{Fp:bc,endo:dx}),Jr=qd(px,Gl);function Hd(t,e,r,n){let i=Fn.digest(r instanceof Uint8Array?r:r.subarray());if(oo(i))return i.then(({digest:o})=>(n?.signal?.throwIfAborted(),Jr.verify(e,o,t,{prehash:!1,format:"der"}))).catch(o=>{throw o.name==="AbortError"?o:new Xn(String(o))});try{return n?.signal?.throwIfAborted(),Jr.verify(e,i.digest,t,{prehash:!1,format:"der"})}catch(o){throw new Xn(String(o))}}var wo=class{type="secp256k1";raw;_key;constructor(e){this._key=Vd(e),this.raw=Kd(this._key)}toMultihash(){return Me.digest(Kr(this))}toCID(){return we.createV1(114,this.toMultihash())}toString(){return ae.encode(this.toMultihash().bytes).substring(1)}equals(e){return e==null||!(e.raw instanceof Uint8Array)?!1:Ut(this.raw,e.raw)}verify(e,r,n){return Hd(this._key,r,e,n)}};function jd(t){return new wo(t)}function Kd(t){return Jr.Point.fromBytes(t).toBytes()}function Vd(t){try{return Jr.Point.fromBytes(t),t}catch(e){throw new Di(String(e))}}function Wd(t){let{Type:e,Data:r}=ri.decode(t.digest),n=r??new Uint8Array;switch(e){case Be.Ed25519:return vd(n);case Be.secp256k1:return jd(n);case Be.ECDSA:return Ll(n);default:throw new Ln}}function Kr(t){return ri.encode({Type:Be[t.type],Data:t.raw})}function zd(t=0){return new Uint8Array(t)}function Yd(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var Gd=Yd("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),wc=Yd("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=zd(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),yx={utf8:Gd,"utf-8":Gd,hex:qe.base16,latin1:wc,ascii:wc,binary:wc,...qe},go=yx;function ni(t,e="utf8"){let r=go[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}function gc(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 Zd(t,e="utf8"){let r=go[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var Xd=Symbol.for("nodejs.util.inspect.custom"),bx=114,ii=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()})`}[Ni]=!0;toString(){return this.string==null&&(this.string=ae.encode(this.multihash.bytes).slice(1)),this.string}toMultihash(){return this.multihash}toCID(){return we.createV1(bx,this.multihash)}toJSON(){return this.toString()}equals(e){if(e==null)return!1;if(e instanceof Uint8Array)return gc(this.multihash.bytes,e);if(typeof e=="string")return this.toString()===e;if(e?.toMultihash()?.bytes!=null)return gc(this.multihash.bytes,e.toMultihash().bytes);throw new Error("not valid Id")}[Xd](){return`PeerId(${this.toString()})`}},xo=class extends ii{type="RSA";publicKey;constructor(e){super({...e,type:"RSA"}),this.publicKey=e.publicKey}},Eo=class extends ii{type="Ed25519";publicKey;constructor(e){super({...e,type:"Ed25519"}),this.publicKey=e.publicKey}},So=class extends ii{type="secp256k1";publicKey;constructor(e){super({...e,type:"secp256k1"}),this.publicKey=e.publicKey}},mx=2336,oi=class{type="url";multihash;publicKey;url;constructor(e){this.url=e.toString(),this.multihash=Me.digest(Zd(this.url))}[Xd](){return`PeerId(${this.url})`}[Ni]=!0;toString(){return this.toCID().toString()}toMultihash(){return this.multihash}toCID(){return we.createV1(mx,this.toMultihash())}toJSON(){return this.toString()}equals(e){return e==null?!1:(e instanceof Uint8Array&&(e=ni(e)),e.toString()===this.toString())}};var wx=114,Qd=2336;function Jd(t,e){let r;if(t.charAt(0)==="1"||t.charAt(0)==="Q")r=Un(ae.decode(`z${t}`));else{if(t.startsWith("k51qzi5uqu5")||t.startsWith("kzwfwjn5ji4")||t.startsWith("k2k4r8")||t.startsWith("bafz"))return gx(we.parse(t));if(e==null)throw new Ie('Please pass a multibase decoder for strings that do not start with "1" or "Q"');r=Un(e.decode(t))}return eh(r)}function eh(t){if(Ex(t))return new xo({multihash:t});if(xx(t))try{let e=Wd(t);if(e.type==="Ed25519")return new Eo({multihash:t,publicKey:e});if(e.type==="secp256k1")return new So({multihash:t,publicKey:e})}catch{let r=ni(t.digest);return new oi(new URL(r))}throw new Ui("Supplied PeerID Multihash is invalid")}function gx(t){if(t?.multihash==null||t.version==null||t.version===1&&t.code!==wx&&t.code!==Qd)throw new Oi("Supplied PeerID CID is invalid");if(t.code===Qd){let e=ni(t.multihash.digest);return new oi(new URL(e))}return eh(t.multihash)}function xx(t){return t.code===Me.code}function Ex(t){return t.code===Fn.code}function Sx(t){let e=t.getComponents(),r={},n=0;return e[n]?.name==="ip6zone"&&(r.zone=`${e[n].value}`,n++),e[n]?.name==="ip4"||e[n]?.name==="ip6"||e[n]?.name==="dns"||e[n]?.name==="dns4"||e[n]?.name==="dns6"?(r.type=e[n].name,r.host=e[n].value,n++):e[n]?.name==="dnsaddr"&&(r.type=e[n].name,r.host=`_dnsaddr.${e[n].value}`,n++),(e[n]?.name==="tcp"||e[n]?.name==="udp")&&(r.protocol=e[n].name==="tcp"?"tcp":"udp",r.port=parseInt(`${e[n].value}`),n++),e[n]?.name==="ipcidr"&&(r.type==="ip4"?r.cidr=parseInt(`${e[n].value}`):r.type==="ip6"&&(r.cidr=`${e[n].value}`),n++),r.type==null||r.host==null?null:(e[n]?.name==="tls"&&e[n+1]?.name==="sni"&&(r.sni=e[n+1].value,n+=2),r)}function xc(t){let e=Sx(t);if(e==null)throw new Ie(`Multiaddr ${t} was not an IPv4, IPv6, DNS, DNS4, DNS6 or DNSADDR address`);return e}var _o=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 f=a==="0",c=2**(8*i)-1;for(;;){let u=this.readAtomically(()=>{let l=this.readChar();if(l===void 0)return;let p=Number.parseInt(l,e);if(!Number.isNaN(p))return p});if(u===void 0)break;if(o*=e,o+=u,o>c||(s+=1,r!==void 0&&s>r))return}if(s!==0)return!n&&f&&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 _x=45,Ax=15,Ao=new _o;function th(t){if(!(t.length>Ax))return Ao.new(t).parseWith(()=>Ao.readIPv4Addr())}function rh(t){if(t.includes("%")&&(t=t.split("%")[0]),!(t.length>_x))return Ao.new(t).parseWith(()=>Ao.readIPv6Addr())}function vo(t){return!!th(t)}function nh(t){return!!rh(t)}function Ec(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 vx(t){return t.buffer instanceof ArrayBuffer}function Sc(t){return vx(t)?t:t.slice()}function en(t=0){return new Uint8Array(t)}function Tx(t){return t?.buffer instanceof ArrayBuffer}function _c(t){if(Tx(t))return t;let e=t.slice();return new Uint8Array(e.buffer,0,e.byteLength)}function tn(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=en(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return _c(r)}function oh(t,e,r,n){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:r},decoder:{decode:n}}}var ih=oh("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ac=oh("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=en(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}),Ix={utf8:ih,"utf-8":ih,hex:qe.base16,latin1:Ac,ascii:Ac,binary:Ac,...qe},To=Ix;function rn(t,e="utf8"){let r=To[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}function zt(t,e="utf8"){let r=To[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.encoder.encode(t).substring(1)}var Ee=class extends Error{static name="InvalidMultiaddrError";name="InvalidMultiaddrError"},xt=class extends Error{static name="ValidationError";name="ValidationError"},Io=class extends Error{static name="InvalidParametersError";name="InvalidParametersError"},Bo=class extends Error{static name="UnknownProtocolError";name="UnknownProtocolError"};function Tc(t){return e=>zt(e,t)}function Ic(t){return e=>rn(e,t)}function nn(t){return new DataView(t.buffer).getUint16(t.byteOffset).toString()}function dr(t){let e=new ArrayBuffer(2);return new DataView(e).setUint16(0,typeof t=="string"?parseInt(t):t),new Uint8Array(e)}function sh(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=rn(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=dr(n);return tn([r,i],r.length+i.length)}function ah(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=Ot.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=dr(n);return tn([r,i],r.length+i.length)}function Bc(t){let e=t.subarray(0,t.length-2),r=t.subarray(t.length-2),n=zt(e,"base32"),i=nn(r);return`${n}:${i}`}var Rc=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 Ee("Invalid byte value in IP address");e[n]=i}),e},ch=function(t){let e=0;t=t.toString().trim();let r=t.split(":",8),n;for(n=0;n<r.length;n++){let o=vo(r[n]),s;o&&(s=Rc(r[n]),r[n]=zt(s.subarray(0,2),"base16")),s!=null&&++n<8&&r.splice(n,0,zt(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 Ee("Invalid byte value in IP address");i[e++]=o>>8&255,i[e++]=o&255}return i},fh=function(t){if(t.byteLength!==4)throw new Ee("IPv4 address was incorrect length");let e=[];for(let r=0;r<t.byteLength;r++)e.push(t[r]);return e.join(".")},uh=function(t){if(t.byteLength!==16)throw new Ee("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 Ee(`Invalid IPv6 address "${r}"`)}};function lh(t){try{let e=new URL(`http://[${t}]`);return e.hostname.substring(1,e.hostname.length-1)}catch{throw new Ee(`Invalid IPv6 address "${t}"`)}}var vc=Object.values(qe).map(t=>t.decoder),Bx=(function(){let t=vc[0].or(vc[1]);return vc.slice(2).forEach(e=>t=t.or(e)),t})();function dh(t){return Bx.decode(t)}function hh(t){return e=>t.encoder.encode(e)}function Rx(t){if(parseInt(t).toString()!==t)throw new xt("Value must be an integer")}function Cx(t){if(t<0)throw new xt("Value must be a positive integer, or zero")}function Lx(t){return e=>{if(e>t)throw new xt(`Value must be smaller than or equal to ${t}`)}}function Dx(...t){return e=>{for(let r of t)r(e)}}var si=Dx(Rx,Cx,Lx(65535));var be=-1,Cc=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 Bo(`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)}))}},Et=new Cc,lE=[{code:4,name:"ip4",size:32,valueToBytes:Rc,bytesToValue:fh,validate:t=>{if(!vo(t))throw new xt(`Invalid IPv4 address "${t}"`)}},{code:6,name:"tcp",size:16,valueToBytes:dr,bytesToValue:nn,validate:si},{code:273,name:"udp",size:16,valueToBytes:dr,bytesToValue:nn,validate:si},{code:33,name:"dccp",size:16,valueToBytes:dr,bytesToValue:nn,validate:si},{code:41,name:"ip6",size:128,valueToBytes:ch,bytesToValue:uh,stringToValue:lh,validate:t=>{if(!nh(t))throw new xt(`Invalid IPv6 address "${t}"`)}},{code:42,name:"ip6zone",size:be},{code:43,name:"ipcidr",size:8,bytesToValue:Tc("base10"),valueToBytes:Ic("base10")},{code:53,name:"dns",size:be},{code:54,name:"dns4",size:be},{code:55,name:"dns6",size:be},{code:56,name:"dnsaddr",size:be},{code:132,name:"sctp",size:16,valueToBytes:dr,bytesToValue:nn,validate:si},{code:301,name:"udt"},{code:302,name:"utp"},{code:400,name:"unix",size:be,stringToValue:t=>decodeURIComponent(t),valueToString:t=>encodeURIComponent(t)},{code:421,name:"p2p",aliases:["ipfs"],size:be,bytesToValue:Tc("base58btc"),valueToBytes:t=>t.startsWith("Q")||t.startsWith("1")?Ic("base58btc")(t):we.parse(t).multihash.bytes},{code:444,name:"onion",size:96,bytesToValue:Bc,valueToBytes:sh},{code:445,name:"onion3",size:296,bytesToValue:Bc,valueToBytes:ah},{code:446,name:"garlic64",size:be},{code:447,name:"garlic32",size:be},{code:448,name:"tls"},{code:449,name:"sni",size:be},{code:454,name:"noise"},{code:460,name:"quic"},{code:461,name:"quic-v1"},{code:465,name:"webtransport"},{code:466,name:"certhash",size:be,bytesToValue:hh(oa),valueToBytes:dh},{code:480,name:"http"},{code:481,name:"http-path",size:be,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:be}];lE.forEach(t=>{Et.addProtocol(t)});function ph(t){let e=[],r=0;for(;r<t.length;){let n=Ja(t,r),i=Et.getProtocol(n),o=et(n),s=dE(i,t,r+o),a=0;s>0&&i.size===be&&(a=et(s));let f=o+a+s,c={code:n,name:i.name,bytes:Sc(t.subarray(r,r+f))};if(s>0){let u=r+o+a,l=t.subarray(u,u+s);c.value=i.bytesToValue?.(l)??zt(l)}e.push(c),r+=f}return e}function yh(t){let e=0,r=[];for(let n of t){if(n.bytes==null){let i=Et.getProtocol(n.code),o=et(n.code),s,a=0,f=0;n.value!=null&&(s=i.valueToBytes?.(n.value)??rn(n.value),a=s.byteLength,i.size===be&&(f=et(a)));let c=new Uint8Array(o+f+a),u=0;Qn(n.code,c,u),u+=o,s!=null&&(i.size===be&&(Qn(a,c,u),u+=f),c.set(s,u)),n.bytes=c}r.push(n.bytes),e+=n.bytes.byteLength}return tn(r,e)}function bh(t){if(t.charAt(0)!=="/")throw new Ee('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 f=Et.getProtocol(i);if(r==="protocol"){if(f.size==null||f.size===0){e.push({code:f.code,name:f.name}),n="",i="",r="protocol";continue}else if(a)throw new Ee(`Component ${i} was missing value`);r="value"}else if(r==="value"){let c={code:f.code,name:f.name};if(f.size!=null&&f.size!==0){if(n==="")throw new Ee(`Component ${i} was missing value`);c.value=f.stringToValue?.(n)??n}e.push(c),n="",i="",r="protocol"}}}if(i!==""&&n!=="")throw new Ee("Incomplete multiaddr");return e}function mh(t){return`/${t.flatMap(e=>{if(e.value==null)return e.name;let r=Et.getProtocol(e.code);if(r==null)throw new Ee(`Unknown protocol code ${e.code}`);return[e.name,r.valueToString?.(e.value)??e.value]}).join("/")}`}function dE(t,e,r){return t.size==null||t.size===0?0:t.size>0?t.size/8:Ja(e,r)}var hE=Symbol.for("nodejs.util.inspect.custom"),Mc=Symbol.for("@multiformats/multiaddr");function pE(t){if(t==null&&(t="/"),Co(t))return t.getComponents();if(t instanceof Uint8Array)return ph(t);if(typeof t=="string")return t=t.replace(/\/(\/)+/,"/").replace(/(\/)+$/,""),t===""&&(t="/"),bh(t);if(Array.isArray(t))return t;throw new Ee("Must be a string, Uint8Array, Component[], or another Multiaddr")}var Ro=class t{[Mc]=!0;#t;#r;#e;constructor(e="/",r={}){this.#t=pE(e),r.validate!==!1&&yE(this)}get bytes(){return this.#e==null&&(this.#e=yh(this.#t)),this.#e}toString(){return this.#r==null&&(this.#r=mh(this.#t)),this.#r}toJSON(){return this.toString()}getComponents(){return[...this.#t.map(e=>({...e}))]}encapsulate(e){let r=new t(e);return new t([...this.#t,...r.getComponents()],{validate:!1})}decapsulate(e){let r=e.toString(),n=this.toString(),i=n.lastIndexOf(r);if(i<0)throw new Io(`Address ${this.toString()} does not contain subaddress: ${r}`);return new t(n.slice(0,i),{validate:!1})}decapsulateCode(e){let r;for(let n=this.#t.length-1;n>-1;n--)if(this.#t[n].code===e){r=n;break}return new t(this.#t.slice(0,r),{validate:!1})}equals(e){return Ec(this.bytes,e.bytes)}[hE](){return`Multiaddr(${this.toString()})`}};function yE(t){t.getComponents().forEach(e=>{let r=Et.getProtocol(e.code);e.value!=null&&r.validate?.(e.value)})}function Co(t){return!!t?.[Mc]}function Gt(t){return new Ro(t)}var bE=[6,53,56,54,55];function wh(t){return Eh("sni",t)?.value}function gh(t){let e=Eh("tcp",t)?.value;return e==null?"":`:${e}`}function Eh(t,e){return e.find(r=>r.name===t)}function xh(t){return t.some(({code:e})=>e===448)}function ze(t,e){let r=Sh[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 Sh={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=xh(e),n=wh(e),i=gh(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=xh(e),n=wh(e),i=gh(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 _h(t,e){let n=Gt(t).getComponents(),i=n.pop();if(i==null)throw new Error("Unexpected end of multiaddr");let o=Sh[i.name];if(o==null)throw new Error(`No interpreter found for ${i.name}`);let s=o(i,n)??"";return e?.assumeHttp!==!1&&bE.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 Ah="[a-fA-F\\d:]",Yt=t=>t&&t.includeBoundaries?`(?:(?<=\\s|^)(?=${Ah})|(?<=${Ah})(?=\\s|$))`:"",Ge="(?: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}",Lo=`
4
4
  (?:
5
5
  (?:${ce}:){7}(?:${ce}|:)| // 1:2:3:4:5:6:7:: 1:2:3:4:5:6:7:8
6
- (?:${ce}:){6}(?:${Ye}|:${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}(?::${Ye}|(?::${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}:${Ye}|(?::${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}:${Ye}|(?::${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}:${Ye}|(?::${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}:${Ye}|(?::${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}:${Ye}|(?::${ce}){1,7}|:)) // ::2:3:4:5:6:7:8 ::2:3:4:5:6:7:8 ::8 ::1.2.3.4
6
+ (?:${ce}:){6}(?:${Ge}|:${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}(?::${Ge}|(?::${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}:${Ge}|(?::${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}:${Ge}|(?::${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}:${Ge}|(?::${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}:${Ge}|(?::${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}:${Ge}|(?::${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(),hw=new RegExp(`(?:^${Ye}$)|(?:^${eo}$)`),pw=new RegExp(`^${Ye}$`),yw=new RegExp(`^${eo}$`),Oa=t=>t&&t.exact?hw:new RegExp(`(?:${Kt(t)}${Ye}${Kt(t)})|(?:${Kt(t)}${eo}${Kt(t)})`,"g");Oa.v4=t=>t&&t.exact?pw:new RegExp(`${Kt(t)}${Ye}${Kt(t)}`,"g");Oa.v6=t=>t&&t.exact?yw:new RegExp(`${Kt(t)}${eo}${Kt(t)}`,"g");var Na=Oa;function Pa(t){let e=(...r)=>t(...r);return Object.defineProperty(e,"name",{value:`functionTimeout(${t.name||"<anonymous>"})`,configurable:!0}),e}function Hl(){return!1}var{toString:bw}=Object.prototype;function Ua(t){return bw.call(t)==="[object RegExp]"}var Kl={global:"g",ignoreCase:"i",multiline:"m",dotAll:"s",sticky:"y",unicode:"u"};function Fa(t,e={}){if(!Ua(t))throw new TypeError("Expected a RegExp instance");let r=Object.keys(Kl).map(i=>(typeof e[i]=="boolean"?e[i]:t[i])?Kl[i]:"").join(""),n=new RegExp(e.source||t.source,r);return n.lastIndex=typeof e.lastIndex=="number"?e.lastIndex:t.lastIndex,n}function ka(t,e,{timeout:r}={}){try{return Pa(()=>Fa(t).test(e),{timeout:r})()}catch(n){if(Hl(n))return!1;throw n}}var mw=15,ww=45,jl={timeout:400};function Ma(t){return t.length>ww?!1:ka(Na.v6({exact:!0}),t,jl)}function Vl(t){return t.length>mw?!1:ka(Na.v4({exact:!0}),t,jl)}var Wl={http:"80",https:"443",ws:"80",wss:"443"},gw=["http","https","ws","wss"];function zl(t,e){e=e??{};let r=e.defaultDnsType??"dns",{scheme:n,hostname:i,port:o,path:s}=xw(t),a=[Ew(i,r),Sw(o,n),_w(n)];s!=null&&a.push(Aw(s));let f="/"+a.filter(c=>!!c).reduce((c,u)=>c.concat(u),[]).join("/");return Ht(f)}function xw(t){let[e]=t.split(":");gw.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 f=Tw(e);f!=null&&(i=f),f==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 Ew(t,e){if(!(t==null||t==="")){if(Vl(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 Sw(t,e){if(!(t==null||t===""))return e==="udp"?["udp",t]:["tcp",t]}function _w(t){if(t.match(/^tcp$|^udp$/)==null)return t==="https"?["/tls/http"]:t==="wss"?["/tls/ws"]:[t]}function Aw(t){if(!(t==null||t===""))return["http-path",encodeURIComponent(t)]}function Tw(t){if(!(t==null||t===""||Wl[t]==null))return Wl[t]}function Gl(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 qa(t,e={}){let r=Gl(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 Iw=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Yl=un({name:"sha-1",code:17,encode:Iw("SHA-1")});var to=class extends Error{static name="AbortError";name="AbortError";constructor(e="The operation was aborted",...r){super(e,...r)}};async function Zl(t,e,r,n){let i=new to(n?.errorMessage);n?.errorCode!=null&&(i.code=n.errorCode);let o=n?.errorEvent??"error";return r?.aborted===!0?Promise.reject(i):new Promise((s,a)=>{function f(){Ha(r,"abort",l),Ha(t,e,c),Ha(t,o,u)}let c=h=>{try{if(n?.filter?.(h)===!1)return}catch(d){f(),a(d);return}f(),s(h)},u=h=>{if(f(),h instanceof Error){a(h);return}a(h.detail??n?.error??new Error(`The "${n?.errorEvent}" event was emitted but the event had no '.detail' field. Pass an 'error' option to race-event to change this message.`))},l=()=>{f(),a(i)};$a(r,"abort",l),$a(t,e,c),$a(t,o,u)})}function $a(t,e,r){t!=null&&(Xl(t)?t.addEventListener(e,r):t.addListener(e,r))}function Ha(t,e,r){t!=null&&(Xl(t)?t.removeEventListener(e,r):t.removeListener(e,r))}function Xl(t){return typeof t.addEventListener=="function"&&typeof t.removeEventListener=="function"}var kn=class extends globalThis.Request{constructor(e,r={}){let n=r.method??"GET",i=Mn(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 ja={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 Va=class extends globalThis.Response{constructor(e,r={}){let n=Mn(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:ja[i],writable:!1},headers:{value:n,writable:!1}})}};var B0=q0(R0(),1),v0=2147483647,qo=class extends B0.Duplex{autoSelectFamilyAttemptedAddresses=[];connecting=!1;pending=!1;remoteAddress;bytesRead;bytesWritten;timeout=v0;allowHalfOpen;remoteFamily;remotePort;#t;#r;#e;constructor(...e){super(),this.bytesRead=0,this.bytesWritten=0,this.allowHalfOpen=!0,this.remoteAddress="",e.length===2?(this.gotStream({stream:e[0],connection:e[1]}),this.#t=Promise.resolve(e[0])):this.#t=e[0].then(this.gotStream.bind(this),r=>{throw this.emit("error",r),r})}gotStream({stream:e,connection:r}){return this.#e=e.log.newScope("libp2p-socket"),this.remoteAddress=r.remoteAddr.toString(),e.addEventListener("message",n=>{this.push(n.data.subarray())}),e.addEventListener("close",n=>{n.error!=null?this.destroy(n.error):this.push(null)}),e.pause(),this.emit("connect"),e}getStream(e){if(this.#r!=null){e(this.#r);return}this.#t.then(r=>{this.#r=r,e(r)},r=>{this.emit("error",r)})}destroy(e){return super.destroy(e)}_write(e,r,n){this.#e?.("write %d bytes",e.byteLength),this.bytesWritten+=e.byteLength,this.getStream(i=>{i.send(e)?n():i.onDrain().then(()=>{n()},o=>{n(o)})})}_read(e){this.#e?.("asked to read %d bytes",e),this.getStream(r=>{r.resume()})}_destroy(e,r){this.#e?.("destroy with %d bytes buffered - %e",this.bufferSize,e),this.getStream(n=>{e!=null?(n.abort(e),r()):n.close().then(()=>{r()}).catch(i=>{n.abort(i),r(i)})})}_final(e){this.#e?.("final"),this.getStream(r=>{r.close().then(()=>{e()}).catch(n=>{r.abort(n),e(n)})})}get readyState(){return this.#r?.status==="closed"?"closed":this.#r?.writeStatus==="closed"||this.#r?.writeStatus==="closing"?"readOnly":this.#r?.readStatus==="closed"||this.#r?.readStatus==="closing"?"writeOnly":"open"}get bufferSize(){return this.writableLength}destroySoon(){this.#e?.("destroySoon with %d bytes buffered",this.bufferSize),this.destroy()}connect(...e){return this.#e?.("connect %o",e),this}setEncoding(e){return this.#e?.("setEncoding %s",e),this}resetAndDestroy(){return this.#e?.("resetAndDestroy"),this.getStream(e=>{e.abort(new Error("Libp2pSocket.resetAndDestroy"))}),this}setTimeout(e,r){return this.#e?.("setTimeout %d",e),r!=null&&this.addListener("timeout",r),this.timeout=e===0?v0:e,this}setNoDelay(e){return this.#e?.("setNoDelay %b",e),this}setKeepAlive(e,r){return this.#e?.("setKeepAlive %b %d",e,r),this}address(){return this.#e?.("address"),{}}unref(){return this.#e?.("unref"),this}ref(){return this.#e?.("ref"),this}write(e,r,n){return super.write(e,r,n)}};function LS(t,e){return new qo(t,e)}var OS=["dns","dns4","dns6","dnsaddr"];function NS(t,e){if(t instanceof URL)return t;let r=L0(t,e),{httpPath:n}=O0(t);return new URL(`http://${r}${n}`)}function PS(t){return t instanceof Uint8Array?t:t instanceof DataView?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t,0,t.byteLength)}function US(t,e){let r={method:t.method,headers:t.headers};if((r.method!=="GET"||t.upgrade)&&r.method!=="HEAD"){let n=e;t.upgrade||(n=HS(e,t.headers.get("content-length"))),r.body=qa(n),r.duplex="half"}return new kn(N0(t).toString(),r)}async function FS(t,e){if(e.send(ae([`HTTP/1.1 ${t.status} ${t.statusText}`,...D0(t.headers),"",""].join(`\r
15
- `))),t.body==null){await e.close().catch(n=>{e.abort(n)});return}let r=t.body.getReader();for(;;){let n=await r.read();if(n.value!=null&&(e.send(n.value)||await e.onDrain()),n.done)break}await e.close().catch(n=>{e.abort(n)})}var kS=ae(["HTTP/1.1 404 Not Found","Connection: close","",""].join(`\r
16
- `)),MS=ae(["HTTP/1.1 400 Bad Request","Connection: close","",""].join(`\r
17
- `)),qS=ae(["HTTP/1.1 500 Internal Server Error","Connection: close","",""].join(`\r
18
- `)),$S=ae(["HTTP/1.1 501 Not Implemented","Connection: close","",""].join(`\r
19
- `));function D0(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*HS(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 KS(t,e){if(typeof t=="string"&&(t.startsWith("/")?t=Ht(t):t=new URL(t)),Wf(t)&&(t=Ht(`/p2p/${t}`)),t instanceof URL&&t.protocol==="multiaddr:"&&(t=zl(t.toString())),Ji(t)&&(t=[t]),Array.isArray(t)){for(let r of t)if(r.getComponents().some(({name:i})=>i==="http")){let i=ql(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 Mn(t={}){return t.headers instanceof Headers||(t.headers=new Headers(t.headers)),t.headers}function jS(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 ei(t){return t!=null&&t!==""}function L0(t,e){let r,n=80,i="http:";if(t instanceof URL&&(r=t.hostname,n=parseInt(t.port,10),i=t.protocol),ei(r)||(r=e.get("host")??void 0),!ei(r)&&Array.isArray(t))for(let o of t){let a=o.getComponents().filter(({name:f})=>OS.includes(f))?.[0]?.value;if(a!=null){r=a;break}}if(!ei(r)&&Array.isArray(t))for(let o of t){let s=o.getComponents().findLast(a=>a.code===421)?.value;try{let a=ma(o);a.port!=null&&(n=a.port)}catch{}if(s!=null){r=wl(s).toCID().toString(Yt);break}}if(!ei(r)&&Array.isArray(t))for(let o of t)try{let s=ma(o);s.host!=null&&(r=s.host);break}catch{}if(ei(r))return i==="http:"&&n!==80&&(r=`${r}:${n}`),i==="https:"&&n!==443&&(r=`${r}:${n}`),r;throw new Re("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 O0(t){let e="/";return t=t.map(r=>Ht(r.getComponents().filter(n=>n.name==="http-path"?(e=n.value??"/",!1):!0))),{httpPath:e,addresses:t}}function VS(t,e=["GET"]){return t==null?e:(typeof t=="string"&&(t=[t]),t.map(r=>r.toUpperCase()))}function N0(t){let e=t.url??"/";if(e.startsWith("http"))return new URL(e);let r=WS(t);return new URL(`http://${r}${e}`)}function WS(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 Re("Could not read host");return e}function Ka(t,e){return t==="GET"&&e.get("connection")?.toLowerCase()==="upgrade"&&e.get("upgrade")?.toLowerCase()==="websocket"}function C0(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 zS(t){if(C0(t,"sec-websocket-version")!=="13")throw new pn("Invalid version");let e=C0(t,"sec-websocket-key");if(e==null)throw new pn("Missing sec-websocket-key");let r=`${e}258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,n=await Yl.digest(ae(r)),i=Qo.encode(n.digest).substring(1);return new Headers({Upgrade:"websocket",Connection:"upgrade","Sec-WebSocket-Accept":i})}async function GS(t,e){let r=new O("REQUEST"),n=new ve,i;r[O.kOnHeadersComplete]=o=>{let s=new Headers;for(let a=0;a<o.headers.length;a+=2)s.set(o.headers[a].toLowerCase(),o.headers[a+1]);i={...o,headers:s,raw:n,method:O.methods[o.method]}};try{for(;;){let{data:o}=await Zl(t,"message",e?.signal),s=o.subarray(),a=r.execute(s,0,s.byteLength);if(a instanceof Error)throw a;if(n.append(s.subarray(0,a)),a<s.byteLength&&t.push(s.subarray(a)),i!=null)return i}}catch(o){t.abort(o)}finally{r.finish()}throw new Error("Failed to read header info from request")}return $0(YS);})();
14
+ `.replace(/\s*\/\/.*$/gm,"").replace(/\n/g,"").trim(),mE=new RegExp(`(?:^${Ge}$)|(?:^${Lo}$)`),wE=new RegExp(`^${Ge}$`),gE=new RegExp(`^${Lo}$`),qc=t=>t&&t.exact?mE:new RegExp(`(?:${Yt(t)}${Ge}${Yt(t)})|(?:${Yt(t)}${Lo}${Yt(t)})`,"g");qc.v4=t=>t&&t.exact?wE:new RegExp(`${Yt(t)}${Ge}${Yt(t)}`,"g");qc.v6=t=>t&&t.exact?gE:new RegExp(`${Yt(t)}${Lo}${Yt(t)}`,"g");var $c=qc;function Hc(t){let e=(...r)=>t(...r);return Object.defineProperty(e,"name",{value:`functionTimeout(${t.name||"<anonymous>"})`,configurable:!0}),e}function vh(){return!1}var{toString:xE}=Object.prototype;function Kc(t){return xE.call(t)==="[object RegExp]"}var Th={global:"g",ignoreCase:"i",multiline:"m",dotAll:"s",sticky:"y",unicode:"u"};function Vc(t,e={}){if(!Kc(t))throw new TypeError("Expected a RegExp instance");let r=Object.keys(Th).map(i=>(typeof e[i]=="boolean"?e[i]:t[i])?Th[i]:"").join(""),n=new RegExp(e.source||t.source,r);return n.lastIndex=typeof e.lastIndex=="number"?e.lastIndex:t.lastIndex,n}function jc(t,e,{timeout:r}={}){try{return Hc(()=>Vc(t).test(e),{timeout:r})()}catch(n){if(vh(n))return!1;throw n}}var EE=15,SE=45,Ih={timeout:400};function Wc(t){return t.length>SE?!1:jc($c.v6({exact:!0}),t,Ih)}function Bh(t){return t.length>EE?!1:jc($c.v4({exact:!0}),t,Ih)}var Rh={http:"80",https:"443",ws:"80",wss:"443"},_E=["http","https","ws","wss"];function Ch(t,e){e=e??{};let r=e.defaultDnsType??"dns",{scheme:n,hostname:i,port:o,path:s}=AE(t),a=[vE(i,r),TE(o,n),IE(n)];s!=null&&a.push(BE(s));let f="/"+a.filter(c=>!!c).reduce((c,u)=>c.concat(u),[]).join("/");return Gt(f)}function AE(t){let[e]=t.split(":");_E.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 f=RE(e);f!=null&&(i=f),f==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 vE(t,e){if(!(t==null||t==="")){if(Bh(t))return["ip4",t];if(Wc(t))return["ip6",t];if(t[0]==="["){let r=t.substring(1,t.length-1);if(Wc(r))return["ip6",r]}return[e,t]}}function TE(t,e){if(!(t==null||t===""))return e==="udp"?["udp",t]:["tcp",t]}function IE(t){if(t.match(/^tcp$|^udp$/)==null)return t==="https"?["/tls/http"]:t==="wss"?["/tls/ws"]:[t]}function BE(t){if(!(t==null||t===""))return["http-path",encodeURIComponent(t)]}function RE(t){if(!(t==null||t===""||Rh[t]==null))return Rh[t]}function Lh(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 zc(t,e={}){let r=Lh(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 CE=t=>async e=>new Uint8Array(await crypto.subtle.digest(t,e)),Dh=Pn({name:"sha-1",code:17,encode:CE("SHA-1")});var Do=class extends Error{static name="AbortError";name="AbortError";constructor(e="The operation was aborted",...r){super(e,...r)}};async function Oh(t,e,r,n){let i=new Do(n?.errorMessage);n?.errorCode!=null&&(i.code=n.errorCode);let o=n?.errorEvent??"error";return r?.aborted===!0?Promise.reject(i):new Promise((s,a)=>{function f(){Yc(r,"abort",l),Yc(t,e,c),Yc(t,o,u)}let c=p=>{try{if(n?.filter?.(p)===!1)return}catch(d){f(),a(d);return}f(),s(p)},u=p=>{if(f(),p instanceof Error){a(p);return}a(p.detail??n?.error??new Error(`The "${n?.errorEvent}" event was emitted but the event had no '.detail' field. Pass an 'error' option to race-event to change this message.`))},l=()=>{f(),a(i)};Gc(r,"abort",l),Gc(t,e,c),Gc(t,o,u)})}function Gc(t,e,r){t!=null&&(Uh(t)?t.addEventListener(e,r):t.addListener(e,r))}function Yc(t,e,r){t!=null&&(Uh(t)?t.removeEventListener(e,r):t.removeListener(e,r))}function Uh(t){return typeof t.addEventListener=="function"&&typeof t.removeEventListener=="function"}function St(t=0){return new Uint8Array(t)}function ai(t=0){return new Uint8Array(t)}function LE(t){return t?.buffer instanceof ArrayBuffer}function Nh(t){if(LE(t))return t;let e=t.slice();return new Uint8Array(e.buffer,0,e.byteLength)}function Zc(t,e){e==null&&(e=t.reduce((i,o)=>i+o.length,0));let r=ai(e),n=0;for(let i of t)r.set(i,n),n+=i.length;return Nh(r)}function Ph(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}var kh=Symbol.for("@achingbrain/uint8arraylist");function Fh(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 Oo(t){return!!t?.[kh]}var Uo=class t{bufs;length;[kh]=!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(Oo(n)){r+=n.byteLength;for(let i of n.bufs)this.bufs.push(i)}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(Oo(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=Fh(this.bufs,e);return r.buf[r.index]}set(e,r){let n=Fh(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(Oo(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 Zc(n,i)}subarray(e,r){let{bufs:n,length:i}=this._subList(e,r);return n.length===1?n[0]:Zc(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,f=a+s.byteLength;if(i=f,e>=f)continue;let c=e>=a&&e<f,u=r>a&&r<=f;if(c&&u){if(e===a&&r===f){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(u){if(r===f){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(!Oo(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,f=this.byteLength-n.byteLength,c=n.byteLength-1,u;for(let l=r;l<=f;l+=u){u=0;for(let p=c;p>=0;p--){let d=this.get(l+p);if(n[p]!==d){u=Math.max(1,p-a[d]);break}}if(u===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=ai(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=St(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=St(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=St(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=ai(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=St(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=St(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=St(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=St(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=St(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(!Ph(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 hr(t,e="utf8"){let r=Ri[e];if(r==null)throw new Error(`Unsupported encoding "${e}"`);return r.decoder.decode(`${r.prefix}${t}`)}var ci=class extends globalThis.Request{constructor(e,r={}){let n=r.method??"GET",i=fi(r),o=r.body;Xc(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 Qc={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 Jc=class extends globalThis.Response{constructor(e,r={}){let n=fi(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:Qc[i],writable:!1},headers:{value:n,writable:!1}})}};var bb=Bb(pb(),1),yb=2147483647,ws=class extends bb.Duplex{autoSelectFamilyAttemptedAddresses=[];connecting=!1;pending=!1;remoteAddress;bytesRead;bytesWritten;timeout=yb;allowHalfOpen;remoteFamily;remotePort;#t;#r;#e;constructor(...e){super(),this.bytesRead=0,this.bytesWritten=0,this.allowHalfOpen=!0,this.remoteAddress="",e.length===2?(this.gotStream({stream:e[0],connection:e[1]}),this.#t=Promise.resolve(e[0])):this.#t=e[0].then(this.gotStream.bind(this),r=>{throw this.emit("error",r),r})}gotStream({stream:e,connection:r}){return this.#e=e.log.newScope("libp2p-socket"),this.remoteAddress=r.remoteAddr.toString(),e.addEventListener("message",n=>{this.push(n.data.subarray())}),e.addEventListener("close",n=>{n.error!=null?this.destroy(n.error):this.push(null)}),e.pause(),this.emit("connect"),e}getStream(e){if(this.#r!=null){e(this.#r);return}this.#t.then(r=>{this.#r=r,e(r)},r=>{this.emit("error",r)})}destroy(e){return super.destroy(e)}_write(e,r,n){this.#e?.("write %d bytes",e.byteLength),this.bytesWritten+=e.byteLength,this.getStream(i=>{i.send(e)?n():i.onDrain().then(()=>{n()},o=>{n(o)})})}_read(e){this.#e?.("asked to read %d bytes",e),this.getStream(r=>{r.resume()})}_destroy(e,r){this.#e?.("destroy with %d bytes buffered - %e",this.bufferSize,e),this.getStream(n=>{e!=null?(n.abort(e),r()):n.close().then(()=>{r()}).catch(i=>{n.abort(i),r(i)})})}_final(e){this.#e?.("final"),this.getStream(r=>{r.close().then(()=>{e()}).catch(n=>{r.abort(n),e(n)})})}get readyState(){return this.#r?.status==="closed"?"closed":this.#r?.writeStatus==="closed"||this.#r?.writeStatus==="closing"?"readOnly":this.#r?.readStatus==="closed"||this.#r?.readStatus==="closing"?"writeOnly":"open"}get bufferSize(){return this.writableLength}destroySoon(){this.#e?.("destroySoon with %d bytes buffered",this.bufferSize),this.destroy()}connect(...e){return this.#e?.("connect %o",e),this}setEncoding(e){return this.#e?.("setEncoding %s",e),this}resetAndDestroy(){return this.#e?.("resetAndDestroy"),this.getStream(e=>{e.abort(new Error("Libp2pSocket.resetAndDestroy"))}),this}setTimeout(e,r){return this.#e?.("setTimeout %d",e),r!=null&&this.addListener("timeout",r),this.timeout=e===0?yb:e,this}setNoDelay(e){return this.#e?.("setNoDelay %b",e),this}setKeepAlive(e,r){return this.#e?.("setKeepAlive %b %d",e,r),this}address(){return this.#e?.("address"),{}}unref(){return this.#e?.("unref"),this}ref(){return this.#e?.("ref"),this}write(e,r,n){return super.write(e,r,n)}};function F8(t,e){return new ws(t,e)}var k8=["dns","dns4","dns6","dnsaddr"];function M8(t,e){if(t instanceof URL)return t;let r=xb(t,e),{httpPath:n}=Eb(t);return new URL(`http://${r}${n}`)}function q8(t){return t instanceof Uint8Array?t:t instanceof DataView?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):new Uint8Array(t,0,t.byteLength)}function $8(t,e){let r={method:t.method,headers:t.headers};if((r.method!=="GET"||t.upgrade)&&r.method!=="HEAD"){let n=e;t.upgrade||(n=z8(e,t.headers.get("content-length"))),r.body=zc(n),r.duplex="half"}return new ci(Sb(t).toString(),r)}async function H8(t,e){if(e.send(hr([`HTTP/1.1 ${t.status} ${t.statusText}`,...gb(t.headers),"",""].join(`\r
15
+ `))),t.body==null){await e.close().catch(n=>{e.abort(n)});return}let r=t.body.getReader();for(;;){let n=await r.read();if(n.value!=null&&(e.send(n.value)||await e.onDrain()),n.done)break}await e.close().catch(n=>{e.abort(n)})}var K8=hr(["HTTP/1.1 404 Not Found","Connection: close","",""].join(`\r
16
+ `)),V8=hr(["HTTP/1.1 400 Bad Request","Connection: close","",""].join(`\r
17
+ `)),j8=hr(["HTTP/1.1 500 Internal Server Error","Connection: close","",""].join(`\r
18
+ `)),W8=hr(["HTTP/1.1 501 Not Implemented","Connection: close","",""].join(`\r
19
+ `));function gb(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*z8(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 G8(t,e){if(typeof t=="string"&&(t.startsWith("/")?t=Gt(t):t=new URL(t)),rl(t)&&(t=Gt(`/p2p/${t}`)),t instanceof URL&&t.protocol==="multiaddr:"&&(t=Ch(t.toString())),Co(t)&&(t=[t]),Array.isArray(t)){for(let r of t)if(r.getComponents().some(({name:i})=>i==="http")){let i=_h(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 fi(t={}){return t.headers instanceof Headers||(t.headers=new Headers(t.headers)),t.headers}function Y8(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 Ai(t){return t!=null&&t!==""}function mb(t){switch(t){case"https:":return 443;case"wss:":return 443;case"http:":return 80;case"ws:":return 80;default:return 80}}function xb(t,e){let r,n=80,i="http:";if(t instanceof URL&&(n=t.port===""?mb(t.protocol):parseInt(t.port,10),r=t.hostname,i=t.protocol),Ai(r)||(r=e.get("host")??void 0),!Ai(r)&&Array.isArray(t))for(let o of t){let a=o.getComponents().filter(({name:f})=>k8.includes(f))?.[0]?.value;if(a!=null){r=a;break}}if(!Ai(r)&&Array.isArray(t))for(let o of t){let s=o.getComponents().findLast(a=>a.code===421)?.value;try{let a=xc(o);a.port!=null&&(n=a.port)}catch{}if(s!=null){r=Jd(s).toCID().toString(rr);break}}if(!Ai(r)&&Array.isArray(t))for(let o of t)try{let s=xc(o);s.host!=null&&(r=s.host);break}catch{}if(Ai(r))return n!==mb(i)&&(r=`${r}:${n}`),r;throw new Ie("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 Eb(t){let e="/";return t=t.map(r=>Gt(r.getComponents().filter(n=>n.name==="http-path"?(e=n.value??"/",!1):!0))),{httpPath:e,addresses:t}}function Z8(t,e=["GET"]){return t==null?e:(typeof t=="string"&&(t=[t]),t.map(r=>r.toUpperCase()))}function Sb(t){let e=t.url??"/";if(e.startsWith("http"))return new URL(e);let r=X8(t);return new URL(`http://${r}${e}`)}function X8(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 Ie("Could not read host");return e}function Xc(t,e){return t==="GET"&&e.get("connection")?.toLowerCase()==="upgrade"&&e.get("upgrade")?.toLowerCase()==="websocket"}function wb(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 Q8(t){if(wb(t,"sec-websocket-version")!=="13")throw new Cn("Invalid version");let e=wb(t,"sec-websocket-key");if(e==null)throw new Cn("Missing sec-websocket-key");let r=`${e}258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,n=await Dh.digest(hr(r)),i=ia.encode(n.digest).substring(1);return new Headers({Upgrade:"websocket",Connection:"upgrade","Sec-WebSocket-Accept":i})}async function J8(t,e){let r=new U("REQUEST"),n=new Uo,i;r[U.kOnHeadersComplete]=o=>{let s=new Headers;for(let a=0;a<o.headers.length;a+=2)s.set(o.headers[a].toLowerCase(),o.headers[a+1]);i={...o,headers:s,raw:n,method:U.methods[o.method]}};try{for(;;){let{data:o}=await Oh(t,"message",e?.signal),s=o.subarray(),a=r.execute(s,0,s.byteLength);if(a instanceof Error)throw a;if(n.append(s.subarray(0,a)),a<s.byteLength&&t.push(s.subarray(a)),i!=null)return i}}catch(o){t.abort(o)}finally{r.finish()}throw new Error("Failed to read header info from request")}return Rb(e6);})();
20
20
  /*! Bundled license information:
21
21
 
22
22
  ieee754/index.js: