@permaweb/libs 0.0.45 → 0.0.46
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.cjs +2 -2
- package/dist/index.cjs.map +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +2 -2
- package/dist/index.js.map +2 -2
- package/package.json +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var LJ=Object.create;var yp=Object.defineProperty;var DJ=Object.getOwnPropertyDescriptor;var OJ=Object.getOwnPropertyNames;var qJ=Object.getPrototypeOf,UJ=Object.prototype.hasOwnProperty;var Eh=(a,o)=>()=>(a&&(o=a(a=0)),o);var St=(a,o)=>()=>(o||a((o={exports:{}}).exports,o),o.exports),wp=(a,o)=>{for(var f in o)yp(a,f,{get:o[f],enumerable:!0})},yE=(a,o,f,d)=>{if(o&&typeof o=="object"||typeof o=="function")for(let n of OJ(o))!UJ.call(a,n)&&n!==f&&yp(a,n,{get:()=>o[n],enumerable:!(d=DJ(o,n))||d.enumerable});return a};var Ae=(a,o,f)=>(f=a!=null?LJ(qJ(a)):{},yE(o||!a||!a.__esModule?yp(f,"default",{value:a,enumerable:!0}):f,a)),f0=a=>yE(yp({},"__esModule",{value:!0}),a);var Be=St((B2e,xE)=>{var Vi=xE.exports={},Rs,Is;function d3(){throw new Error("setTimeout has not been defined")}function c3(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?Rs=setTimeout:Rs=d3}catch{Rs=d3}try{typeof clearTimeout=="function"?Is=clearTimeout:Is=c3}catch{Is=c3}})();function wE(a){if(Rs===setTimeout)return setTimeout(a,0);if((Rs===d3||!Rs)&&setTimeout)return Rs=setTimeout,setTimeout(a,0);try{return Rs(a,0)}catch{try{return Rs.call(null,a,0)}catch{return Rs.call(this,a,0)}}}function FJ(a){if(Is===clearTimeout)return clearTimeout(a);if((Is===c3||!Is)&&clearTimeout)return Is=clearTimeout,clearTimeout(a);try{return Is(a)}catch{try{return Is.call(null,a)}catch{return Is.call(this,a)}}}var wf=[],pl=!1,Ah,Mp=-1;function zJ(){!pl||!Ah||(pl=!1,Ah.length?wf=Ah.concat(wf):Mp=-1,wf.length&&ME())}function ME(){if(!pl){var a=wE(zJ);pl=!0;for(var o=wf.length;o;){for(Ah=wf,wf=[];++Mp<o;)Ah&&Ah[Mp].run();Mp=-1,o=wf.length}Ah=null,pl=!1,FJ(a)}}Vi.nextTick=function(a){var o=new Array(arguments.length-1);if(arguments.length>1)for(var f=1;f<arguments.length;f++)o[f-1]=arguments[f];wf.push(new _E(a,o)),wf.length===1&&!pl&&wE(ME)};function _E(a,o){this.fun=a,this.array=o}_E.prototype.run=function(){this.fun.apply(null,this.array)};Vi.title="browser";Vi.browser=!0;Vi.env={};Vi.argv=[];Vi.version="";Vi.versions={};function Mf(){}Vi.on=Mf;Vi.addListener=Mf;Vi.once=Mf;Vi.off=Mf;Vi.removeListener=Mf;Vi.removeAllListeners=Mf;Vi.emit=Mf;Vi.prependListener=Mf;Vi.prependOnceListener=Mf;Vi.listeners=function(a){return[]};Vi.binding=function(a){throw new Error("process.binding is not supported")};Vi.cwd=function(){return"/"};Vi.chdir=function(a){throw new Error("process.chdir is not supported")};Vi.umask=function(){return 0}});var ft,Re=Eh(()=>{ft=Ae(Be())});function HJ(){if(SE)return Zd;SE=!0,Zd.byteLength=y,Zd.toByteArray=w,Zd.fromByteArray=x;for(var a=[],o=[],f=typeof Uint8Array<"u"?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,v=d.length;n<v;++n)a[n]=d[n],o[d.charCodeAt(n)]=n;o[45]=62,o[95]=63;function b(E){var R=E.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var T=E.indexOf("=");T===-1&&(T=R);var N=T===R?0:4-T%4;return[T,N]}function y(E){var R=b(E),T=R[0],N=R[1];return(T+N)*3/4-N}function M(E,R,T){return(R+T)*3/4-T}function w(E){var R,T=b(E),N=T[0],P=T[1],L=new f(M(E,N,P)),D=0,Z=P>0?N-4:N,W;for(W=0;W<Z;W+=4)R=o[E.charCodeAt(W)]<<18|o[E.charCodeAt(W+1)]<<12|o[E.charCodeAt(W+2)]<<6|o[E.charCodeAt(W+3)],L[D++]=R>>16&255,L[D++]=R>>8&255,L[D++]=R&255;return P===2&&(R=o[E.charCodeAt(W)]<<2|o[E.charCodeAt(W+1)]>>4,L[D++]=R&255),P===1&&(R=o[E.charCodeAt(W)]<<10|o[E.charCodeAt(W+1)]<<4|o[E.charCodeAt(W+2)]>>2,L[D++]=R>>8&255,L[D++]=R&255),L}function g(E){return a[E>>18&63]+a[E>>12&63]+a[E>>6&63]+a[E&63]}function _(E,R,T){for(var N,P=[],L=R;L<T;L+=3)N=(E[L]<<16&16711680)+(E[L+1]<<8&65280)+(E[L+2]&255),P.push(g(N));return P.join("")}function x(E){for(var R,T=E.length,N=T%3,P=[],L=16383,D=0,Z=T-N;D<Z;D+=L)P.push(_(E,D,D+L>Z?Z:D+L));return N===1?(R=E[T-1],P.push(a[R>>2]+a[R<<4&63]+"==")):N===2&&(R=(E[T-2]<<8)+E[T-1],P.push(a[R>>10]+a[R>>4&63]+a[R<<2&63]+"=")),P.join("")}return Zd}function KJ(){return EE||(EE=!0,_p.read=function(a,o,f,d,n){var v,b,y=n*8-d-1,M=(1<<y)-1,w=M>>1,g=-7,_=f?n-1:0,x=f?-1:1,E=a[o+_];for(_+=x,v=E&(1<<-g)-1,E>>=-g,g+=y;g>0;v=v*256+a[o+_],_+=x,g-=8);for(b=v&(1<<-g)-1,v>>=-g,g+=d;g>0;b=b*256+a[o+_],_+=x,g-=8);if(v===0)v=1-w;else{if(v===M)return b?NaN:(E?-1:1)*(1/0);b=b+Math.pow(2,d),v=v-w}return(E?-1:1)*b*Math.pow(2,v-d)},_p.write=function(a,o,f,d,n,v){var b,y,M,w=v*8-n-1,g=(1<<w)-1,_=g>>1,x=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=d?0:v-1,R=d?1:-1,T=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(y=isNaN(o)?1:0,b=g):(b=Math.floor(Math.log(o)/Math.LN2),o*(M=Math.pow(2,-b))<1&&(b--,M*=2),b+_>=1?o+=x/M:o+=x*Math.pow(2,1-_),o*M>=2&&(b++,M/=2),b+_>=g?(y=0,b=g):b+_>=1?(y=(o*M-1)*Math.pow(2,n),b=b+_):(y=o*Math.pow(2,_-1)*Math.pow(2,n),b=0));n>=8;a[f+E]=y&255,E+=R,y/=256,n-=8);for(b=b<<n|y,w+=n;w>0;a[f+E]=b&255,E+=R,b/=256,w-=8);a[f+E-R]|=T*128}),_p}function jJ(){if(AE)return Bh;AE=!0;let a=HJ(),o=KJ(),f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Bh.Buffer=b,Bh.SlowBuffer=P,Bh.INSPECT_MAX_BYTES=50;let d=2147483647;Bh.kMaxLength=d,b.TYPED_ARRAY_SUPPORT=n(),!b.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function n(){try{let $=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf($,A),$.foo()===42}catch{return!1}}Object.defineProperty(b.prototype,"parent",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.buffer}}),Object.defineProperty(b.prototype,"offset",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.byteOffset}});function v($){if($>d)throw new RangeError('The value "'+$+'" is invalid for option "size"');let A=new Uint8Array($);return Object.setPrototypeOf(A,b.prototype),A}function b($,A,I){if(typeof $=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g($)}return y($,A,I)}b.poolSize=8192;function y($,A,I){if(typeof $=="string")return _($,A);if(ArrayBuffer.isView($))return E($);if($==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(he($,ArrayBuffer)||$&&he($.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he($,SharedArrayBuffer)||$&&he($.buffer,SharedArrayBuffer)))return R($,A,I);if(typeof $=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let C=$.valueOf&&$.valueOf();if(C!=null&&C!==$)return b.from(C,A,I);let H=T($);if(H)return H;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]=="function")return b.from($[Symbol.toPrimitive]("string"),A,I);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}b.from=function($,A,I){return y($,A,I)},Object.setPrototypeOf(b.prototype,Uint8Array.prototype),Object.setPrototypeOf(b,Uint8Array);function M($){if(typeof $!="number")throw new TypeError('"size" argument must be of type number');if($<0)throw new RangeError('The value "'+$+'" is invalid for option "size"')}function w($,A,I){return M($),$<=0?v($):A!==void 0?typeof I=="string"?v($).fill(A,I):v($).fill(A):v($)}b.alloc=function($,A,I){return w($,A,I)};function g($){return M($),v($<0?0:N($)|0)}b.allocUnsafe=function($){return g($)},b.allocUnsafeSlow=function($){return g($)};function _($,A){if((typeof A!="string"||A==="")&&(A="utf8"),!b.isEncoding(A))throw new TypeError("Unknown encoding: "+A);let I=L($,A)|0,C=v(I),H=C.write($,A);return H!==I&&(C=C.slice(0,H)),C}function x($){let A=$.length<0?0:N($.length)|0,I=v(A);for(let C=0;C<A;C+=1)I[C]=$[C]&255;return I}function E($){if(he($,Uint8Array)){let A=new Uint8Array($);return R(A.buffer,A.byteOffset,A.byteLength)}return x($)}function R($,A,I){if(A<0||$.byteLength<A)throw new RangeError('"offset" is outside of buffer bounds');if($.byteLength<A+(I||0))throw new RangeError('"length" is outside of buffer bounds');let C;return A===void 0&&I===void 0?C=new Uint8Array($):I===void 0?C=new Uint8Array($,A):C=new Uint8Array($,A,I),Object.setPrototypeOf(C,b.prototype),C}function T($){if(b.isBuffer($)){let A=N($.length)|0,I=v(A);return I.length===0||$.copy(I,0,0,A),I}if($.length!==void 0)return typeof $.length!="number"||nt($.length)?v(0):x($);if($.type==="Buffer"&&Array.isArray($.data))return x($.data)}function N($){if($>=d)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d.toString(16)+" bytes");return $|0}function P($){return+$!=$&&($=0),b.alloc(+$)}b.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==b.prototype},b.compare=function(A,I){if(he(A,Uint8Array)&&(A=b.from(A,A.offset,A.byteLength)),he(I,Uint8Array)&&(I=b.from(I,I.offset,I.byteLength)),!b.isBuffer(A)||!b.isBuffer(I))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===I)return 0;let C=A.length,H=I.length;for(let ne=0,J=Math.min(C,H);ne<J;++ne)if(A[ne]!==I[ne]){C=A[ne],H=I[ne];break}return C<H?-1:H<C?1:0},b.isEncoding=function(A){switch(String(A).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},b.concat=function(A,I){if(!Array.isArray(A))throw new TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return b.alloc(0);let C;if(I===void 0)for(I=0,C=0;C<A.length;++C)I+=A[C].length;let H=b.allocUnsafe(I),ne=0;for(C=0;C<A.length;++C){let J=A[C];if(he(J,Uint8Array))ne+J.length>H.length?(b.isBuffer(J)||(J=b.from(J)),J.copy(H,ne)):Uint8Array.prototype.set.call(H,J,ne);else if(b.isBuffer(J))J.copy(H,ne);else throw new TypeError('"list" argument must be an Array of Buffers');ne+=J.length}return H};function L($,A){if(b.isBuffer($))return $.length;if(ArrayBuffer.isView($)||he($,ArrayBuffer))return $.byteLength;if(typeof $!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let I=$.length,C=arguments.length>2&&arguments[2]===!0;if(!C&&I===0)return 0;let H=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return I;case"utf8":case"utf-8":return me($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I*2;case"hex":return I>>>1;case"base64":return ye($).length;default:if(H)return C?-1:me($).length;A=(""+A).toLowerCase(),H=!0}}b.byteLength=L;function D($,A,I){let C=!1;if((A===void 0||A<0)&&(A=0),A>this.length||((I===void 0||I>this.length)&&(I=this.length),I<=0)||(I>>>=0,A>>>=0,I<=A))return"";for($||($="utf8");;)switch($){case"hex":return l(this,A,I);case"utf8":case"utf-8":return i(this,A,I);case"ascii":return c(this,A,I);case"latin1":case"binary":return m(this,A,I);case"base64":return r(this,A,I);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t(this,A,I);default:if(C)throw new TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),C=!0}}b.prototype._isBuffer=!0;function Z($,A,I){let C=$[A];$[A]=$[I],$[I]=C}b.prototype.swap16=function(){let A=this.length;if(A%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;I<A;I+=2)Z(this,I,I+1);return this},b.prototype.swap32=function(){let A=this.length;if(A%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let I=0;I<A;I+=4)Z(this,I,I+3),Z(this,I+1,I+2);return this},b.prototype.swap64=function(){let A=this.length;if(A%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let I=0;I<A;I+=8)Z(this,I,I+7),Z(this,I+1,I+6),Z(this,I+2,I+5),Z(this,I+3,I+4);return this},b.prototype.toString=function(){let A=this.length;return A===0?"":arguments.length===0?i(this,0,A):D.apply(this,arguments)},b.prototype.toLocaleString=b.prototype.toString,b.prototype.equals=function(A){if(!b.isBuffer(A))throw new TypeError("Argument must be a Buffer");return this===A?!0:b.compare(this,A)===0},b.prototype.inspect=function(){let A="",I=Bh.INSPECT_MAX_BYTES;return A=this.toString("hex",0,I).replace(/(.{2})/g,"$1 ").trim(),this.length>I&&(A+=" ... "),"<Buffer "+A+">"},f&&(b.prototype[f]=b.prototype.inspect),b.prototype.compare=function(A,I,C,H,ne){if(he(A,Uint8Array)&&(A=b.from(A,A.offset,A.byteLength)),!b.isBuffer(A))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(I===void 0&&(I=0),C===void 0&&(C=A?A.length:0),H===void 0&&(H=0),ne===void 0&&(ne=this.length),I<0||C>A.length||H<0||ne>this.length)throw new RangeError("out of range index");if(H>=ne&&I>=C)return 0;if(H>=ne)return-1;if(I>=C)return 1;if(I>>>=0,C>>>=0,H>>>=0,ne>>>=0,this===A)return 0;let J=ne-H,de=C-I,st=Math.min(J,de),le=this.slice(H,ne),ve=A.slice(I,C);for(let ot=0;ot<st;++ot)if(le[ot]!==ve[ot]){J=le[ot],de=ve[ot];break}return J<de?-1:de<J?1:0};function W($,A,I,C,H){if($.length===0)return-1;if(typeof I=="string"?(C=I,I=0):I>2147483647?I=2147483647:I<-2147483648&&(I=-2147483648),I=+I,nt(I)&&(I=H?0:$.length-1),I<0&&(I=$.length+I),I>=$.length){if(H)return-1;I=$.length-1}else if(I<0)if(H)I=0;else return-1;if(typeof A=="string"&&(A=b.from(A,C)),b.isBuffer(A))return A.length===0?-1:Q($,A,I,C,H);if(typeof A=="number")return A=A&255,typeof Uint8Array.prototype.indexOf=="function"?H?Uint8Array.prototype.indexOf.call($,A,I):Uint8Array.prototype.lastIndexOf.call($,A,I):Q($,[A],I,C,H);throw new TypeError("val must be string, number or Buffer")}function Q($,A,I,C,H){let ne=1,J=$.length,de=A.length;if(C!==void 0&&(C=String(C).toLowerCase(),C==="ucs2"||C==="ucs-2"||C==="utf16le"||C==="utf-16le")){if($.length<2||A.length<2)return-1;ne=2,J/=2,de/=2,I/=2}function st(ve,ot){return ne===1?ve[ot]:ve.readUInt16BE(ot*ne)}let le;if(H){let ve=-1;for(le=I;le<J;le++)if(st($,le)===st(A,ve===-1?0:le-ve)){if(ve===-1&&(ve=le),le-ve+1===de)return ve*ne}else ve!==-1&&(le-=le-ve),ve=-1}else for(I+de>J&&(I=J-de),le=I;le>=0;le--){let ve=!0;for(let ot=0;ot<de;ot++)if(st($,le+ot)!==st(A,ot)){ve=!1;break}if(ve)return le}return-1}b.prototype.includes=function(A,I,C){return this.indexOf(A,I,C)!==-1},b.prototype.indexOf=function(A,I,C){return W(this,A,I,C,!0)},b.prototype.lastIndexOf=function(A,I,C){return W(this,A,I,C,!1)};function K($,A,I,C){I=Number(I)||0;let H=$.length-I;C?(C=Number(C),C>H&&(C=H)):C=H;let ne=A.length;C>ne/2&&(C=ne/2);let J;for(J=0;J<C;++J){let de=parseInt(A.substr(J*2,2),16);if(nt(de))return J;$[I+J]=de}return J}function z($,A,I,C){return fe(me(A,$.length-I),$,I,C)}function X($,A,I,C){return fe(re(A),$,I,C)}function p($,A,I,C){return fe(ye(A),$,I,C)}function e($,A,I,C){return fe(ae(A,$.length-I),$,I,C)}b.prototype.write=function(A,I,C,H){if(I===void 0)H="utf8",C=this.length,I=0;else if(C===void 0&&typeof I=="string")H=I,C=this.length,I=0;else if(isFinite(I))I=I>>>0,isFinite(C)?(C=C>>>0,H===void 0&&(H="utf8")):(H=C,C=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let ne=this.length-I;if((C===void 0||C>ne)&&(C=ne),A.length>0&&(C<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");H||(H="utf8");let J=!1;for(;;)switch(H){case"hex":return K(this,A,I,C);case"utf8":case"utf-8":return z(this,A,I,C);case"ascii":case"latin1":case"binary":return X(this,A,I,C);case"base64":return p(this,A,I,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e(this,A,I,C);default:if(J)throw new TypeError("Unknown encoding: "+H);H=(""+H).toLowerCase(),J=!0}},b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function r($,A,I){return A===0&&I===$.length?a.fromByteArray($):a.fromByteArray($.slice(A,I))}function i($,A,I){I=Math.min($.length,I);let C=[],H=A;for(;H<I;){let ne=$[H],J=null,de=ne>239?4:ne>223?3:ne>191?2:1;if(H+de<=I){let st,le,ve,ot;switch(de){case 1:ne<128&&(J=ne);break;case 2:st=$[H+1],(st&192)===128&&(ot=(ne&31)<<6|st&63,ot>127&&(J=ot));break;case 3:st=$[H+1],le=$[H+2],(st&192)===128&&(le&192)===128&&(ot=(ne&15)<<12|(st&63)<<6|le&63,ot>2047&&(ot<55296||ot>57343)&&(J=ot));break;case 4:st=$[H+1],le=$[H+2],ve=$[H+3],(st&192)===128&&(le&192)===128&&(ve&192)===128&&(ot=(ne&15)<<18|(st&63)<<12|(le&63)<<6|ve&63,ot>65535&&ot<1114112&&(J=ot))}}J===null?(J=65533,de=1):J>65535&&(J-=65536,C.push(J>>>10&1023|55296),J=56320|J&1023),C.push(J),H+=de}return h(C)}let s=4096;function h($){let A=$.length;if(A<=s)return String.fromCharCode.apply(String,$);let I="",C=0;for(;C<A;)I+=String.fromCharCode.apply(String,$.slice(C,C+=s));return I}function c($,A,I){let C="";I=Math.min($.length,I);for(let H=A;H<I;++H)C+=String.fromCharCode($[H]&127);return C}function m($,A,I){let C="";I=Math.min($.length,I);for(let H=A;H<I;++H)C+=String.fromCharCode($[H]);return C}function l($,A,I){let C=$.length;(!A||A<0)&&(A=0),(!I||I<0||I>C)&&(I=C);let H="";for(let ne=A;ne<I;++ne)H+=ce[$[ne]];return H}function t($,A,I){let C=$.slice(A,I),H="";for(let ne=0;ne<C.length-1;ne+=2)H+=String.fromCharCode(C[ne]+C[ne+1]*256);return H}b.prototype.slice=function(A,I){let C=this.length;A=~~A,I=I===void 0?C:~~I,A<0?(A+=C,A<0&&(A=0)):A>C&&(A=C),I<0?(I+=C,I<0&&(I=0)):I>C&&(I=C),I<A&&(I=A);let H=this.subarray(A,I);return Object.setPrototypeOf(H,b.prototype),H};function u($,A,I){if($%1!==0||$<0)throw new RangeError("offset is not uint");if($+A>I)throw new RangeError("Trying to access beyond buffer length")}b.prototype.readUintLE=b.prototype.readUIntLE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=this[A],ne=1,J=0;for(;++J<I&&(ne*=256);)H+=this[A+J]*ne;return H},b.prototype.readUintBE=b.prototype.readUIntBE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=this[A+--I],ne=1;for(;I>0&&(ne*=256);)H+=this[A+--I]*ne;return H},b.prototype.readUint8=b.prototype.readUInt8=function(A,I){return A=A>>>0,I||u(A,1,this.length),this[A]},b.prototype.readUint16LE=b.prototype.readUInt16LE=function(A,I){return A=A>>>0,I||u(A,2,this.length),this[A]|this[A+1]<<8},b.prototype.readUint16BE=b.prototype.readUInt16BE=function(A,I){return A=A>>>0,I||u(A,2,this.length),this[A]<<8|this[A+1]},b.prototype.readUint32LE=b.prototype.readUInt32LE=function(A,I){return A=A>>>0,I||u(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216},b.prototype.readUint32BE=b.prototype.readUInt32BE=function(A,I){return A=A>>>0,I||u(A,4,this.length),this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])},b.prototype.readBigUInt64LE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=I+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24,ne=this[++A]+this[++A]*2**8+this[++A]*2**16+C*2**24;return BigInt(H)+(BigInt(ne)<<BigInt(32))}),b.prototype.readBigUInt64BE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=I*2**24+this[++A]*2**16+this[++A]*2**8+this[++A],ne=this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+C;return(BigInt(H)<<BigInt(32))+BigInt(ne)}),b.prototype.readIntLE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=this[A],ne=1,J=0;for(;++J<I&&(ne*=256);)H+=this[A+J]*ne;return ne*=128,H>=ne&&(H-=Math.pow(2,8*I)),H},b.prototype.readIntBE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=I,ne=1,J=this[A+--H];for(;H>0&&(ne*=256);)J+=this[A+--H]*ne;return ne*=128,J>=ne&&(J-=Math.pow(2,8*I)),J},b.prototype.readInt8=function(A,I){return A=A>>>0,I||u(A,1,this.length),this[A]&128?(255-this[A]+1)*-1:this[A]},b.prototype.readInt16LE=function(A,I){A=A>>>0,I||u(A,2,this.length);let C=this[A]|this[A+1]<<8;return C&32768?C|4294901760:C},b.prototype.readInt16BE=function(A,I){A=A>>>0,I||u(A,2,this.length);let C=this[A+1]|this[A]<<8;return C&32768?C|4294901760:C},b.prototype.readInt32LE=function(A,I){return A=A>>>0,I||u(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},b.prototype.readInt32BE=function(A,I){return A=A>>>0,I||u(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},b.prototype.readBigInt64LE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=this[A+4]+this[A+5]*2**8+this[A+6]*2**16+(C<<24);return(BigInt(H)<<BigInt(32))+BigInt(I+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24)}),b.prototype.readBigInt64BE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=(I<<24)+this[++A]*2**16+this[++A]*2**8+this[++A];return(BigInt(H)<<BigInt(32))+BigInt(this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+C)}),b.prototype.readFloatLE=function(A,I){return A=A>>>0,I||u(A,4,this.length),o.read(this,A,!0,23,4)},b.prototype.readFloatBE=function(A,I){return A=A>>>0,I||u(A,4,this.length),o.read(this,A,!1,23,4)},b.prototype.readDoubleLE=function(A,I){return A=A>>>0,I||u(A,8,this.length),o.read(this,A,!0,52,8)},b.prototype.readDoubleBE=function(A,I){return A=A>>>0,I||u(A,8,this.length),o.read(this,A,!1,52,8)};function S($,A,I,C,H,ne){if(!b.isBuffer($))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>H||A<ne)throw new RangeError('"value" argument is out of bounds');if(I+C>$.length)throw new RangeError("Index out of range")}b.prototype.writeUintLE=b.prototype.writeUIntLE=function(A,I,C,H){if(A=+A,I=I>>>0,C=C>>>0,!H){let de=Math.pow(2,8*C)-1;S(this,A,I,C,de,0)}let ne=1,J=0;for(this[I]=A&255;++J<C&&(ne*=256);)this[I+J]=A/ne&255;return I+C},b.prototype.writeUintBE=b.prototype.writeUIntBE=function(A,I,C,H){if(A=+A,I=I>>>0,C=C>>>0,!H){let de=Math.pow(2,8*C)-1;S(this,A,I,C,de,0)}let ne=C-1,J=1;for(this[I+ne]=A&255;--ne>=0&&(J*=256);)this[I+ne]=A/J&255;return I+C},b.prototype.writeUint8=b.prototype.writeUInt8=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,1,255,0),this[I]=A&255,I+1},b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,65535,0),this[I]=A&255,this[I+1]=A>>>8,I+2},b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,65535,0),this[I]=A>>>8,this[I+1]=A&255,I+2},b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,4294967295,0),this[I+3]=A>>>24,this[I+2]=A>>>16,this[I+1]=A>>>8,this[I]=A&255,I+4},b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,4294967295,0),this[I]=A>>>24,this[I+1]=A>>>16,this[I+2]=A>>>8,this[I+3]=A&255,I+4};function B($,A,I,C,H){Y(A,C,H,$,I,7);let ne=Number(A&BigInt(4294967295));$[I++]=ne,ne=ne>>8,$[I++]=ne,ne=ne>>8,$[I++]=ne,ne=ne>>8,$[I++]=ne;let J=Number(A>>BigInt(32)&BigInt(4294967295));return $[I++]=J,J=J>>8,$[I++]=J,J=J>>8,$[I++]=J,J=J>>8,$[I++]=J,I}function k($,A,I,C,H){Y(A,C,H,$,I,7);let ne=Number(A&BigInt(4294967295));$[I+7]=ne,ne=ne>>8,$[I+6]=ne,ne=ne>>8,$[I+5]=ne,ne=ne>>8,$[I+4]=ne;let J=Number(A>>BigInt(32)&BigInt(4294967295));return $[I+3]=J,J=J>>8,$[I+2]=J,J=J>>8,$[I+1]=J,J=J>>8,$[I]=J,I+8}b.prototype.writeBigUInt64LE=be(function(A,I=0){return B(this,A,I,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeBigUInt64BE=be(function(A,I=0){return k(this,A,I,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeIntLE=function(A,I,C,H){if(A=+A,I=I>>>0,!H){let st=Math.pow(2,8*C-1);S(this,A,I,C,st-1,-st)}let ne=0,J=1,de=0;for(this[I]=A&255;++ne<C&&(J*=256);)A<0&&de===0&&this[I+ne-1]!==0&&(de=1),this[I+ne]=(A/J>>0)-de&255;return I+C},b.prototype.writeIntBE=function(A,I,C,H){if(A=+A,I=I>>>0,!H){let st=Math.pow(2,8*C-1);S(this,A,I,C,st-1,-st)}let ne=C-1,J=1,de=0;for(this[I+ne]=A&255;--ne>=0&&(J*=256);)A<0&&de===0&&this[I+ne+1]!==0&&(de=1),this[I+ne]=(A/J>>0)-de&255;return I+C},b.prototype.writeInt8=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,1,127,-128),A<0&&(A=255+A+1),this[I]=A&255,I+1},b.prototype.writeInt16LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,32767,-32768),this[I]=A&255,this[I+1]=A>>>8,I+2},b.prototype.writeInt16BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,32767,-32768),this[I]=A>>>8,this[I+1]=A&255,I+2},b.prototype.writeInt32LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,2147483647,-2147483648),this[I]=A&255,this[I+1]=A>>>8,this[I+2]=A>>>16,this[I+3]=A>>>24,I+4},b.prototype.writeInt32BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),this[I]=A>>>24,this[I+1]=A>>>16,this[I+2]=A>>>8,this[I+3]=A&255,I+4},b.prototype.writeBigInt64LE=be(function(A,I=0){return B(this,A,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),b.prototype.writeBigInt64BE=be(function(A,I=0){return k(this,A,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function q($,A,I,C,H,ne){if(I+C>$.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("Index out of range")}function F($,A,I,C,H){return A=+A,I=I>>>0,H||q($,A,I,4),o.write($,A,I,C,23,4),I+4}b.prototype.writeFloatLE=function(A,I,C){return F(this,A,I,!0,C)},b.prototype.writeFloatBE=function(A,I,C){return F(this,A,I,!1,C)};function ee($,A,I,C,H){return A=+A,I=I>>>0,H||q($,A,I,8),o.write($,A,I,C,52,8),I+8}b.prototype.writeDoubleLE=function(A,I,C){return ee(this,A,I,!0,C)},b.prototype.writeDoubleBE=function(A,I,C){return ee(this,A,I,!1,C)},b.prototype.copy=function(A,I,C,H){if(!b.isBuffer(A))throw new TypeError("argument should be a Buffer");if(C||(C=0),!H&&H!==0&&(H=this.length),I>=A.length&&(I=A.length),I||(I=0),H>0&&H<C&&(H=C),H===C||A.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(C<0||C>=this.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("sourceEnd out of bounds");H>this.length&&(H=this.length),A.length-I<H-C&&(H=A.length-I+C);let ne=H-C;return this===A&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(I,C,H):Uint8Array.prototype.set.call(A,this.subarray(C,H),I),ne},b.prototype.fill=function(A,I,C,H){if(typeof A=="string"){if(typeof I=="string"?(H=I,I=0,C=this.length):typeof C=="string"&&(H=C,C=this.length),H!==void 0&&typeof H!="string")throw new TypeError("encoding must be a string");if(typeof H=="string"&&!b.isEncoding(H))throw new TypeError("Unknown encoding: "+H);if(A.length===1){let J=A.charCodeAt(0);(H==="utf8"&&J<128||H==="latin1")&&(A=J)}}else typeof A=="number"?A=A&255:typeof A=="boolean"&&(A=Number(A));if(I<0||this.length<I||this.length<C)throw new RangeError("Out of range index");if(C<=I)return this;I=I>>>0,C=C===void 0?this.length:C>>>0,A||(A=0);let ne;if(typeof A=="number")for(ne=I;ne<C;++ne)this[ne]=A;else{let J=b.isBuffer(A)?A:b.from(A,H),de=J.length;if(de===0)throw new TypeError('The value "'+A+'" is invalid for argument "value"');for(ne=0;ne<C-I;++ne)this[ne+I]=J[ne%de]}return this};let te={};function O($,A,I){te[$]=class extends I{constructor(){super(),Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(H){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:H,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}O("ERR_BUFFER_OUT_OF_BOUNDS",function($){return $?`${$} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),O("ERR_INVALID_ARG_TYPE",function($,A){return`The "${$}" argument must be of type number. Received type ${typeof A}`},TypeError),O("ERR_OUT_OF_RANGE",function($,A,I){let C=`The value of "${$}" is out of range.`,H=I;return Number.isInteger(I)&&Math.abs(I)>2**32?H=U(String(I)):typeof I=="bigint"&&(H=String(I),(I>BigInt(2)**BigInt(32)||I<-(BigInt(2)**BigInt(32)))&&(H=U(H)),H+="n"),C+=` It must be ${A}. Received ${H}`,C},RangeError);function U($){let A="",I=$.length,C=$[0]==="-"?1:0;for(;I>=C+4;I-=3)A=`_${$.slice(I-3,I)}${A}`;return`${$.slice(0,I)}${A}`}function oe($,A,I){j(A,"offset"),($[A]===void 0||$[A+I]===void 0)&&V(A,$.length-(I+1))}function Y($,A,I,C,H,ne){if($>I||$<A){let J=typeof A=="bigint"?"n":"",de;throw A===0||A===BigInt(0)?de=`>= 0${J} and < 2${J} ** ${(ne+1)*8}${J}`:de=`>= -(2${J} ** ${(ne+1)*8-1}${J}) and < 2 ** ${(ne+1)*8-1}${J}`,new te.ERR_OUT_OF_RANGE("value",de,$)}oe(C,H,ne)}function j($,A){if(typeof $!="number")throw new te.ERR_INVALID_ARG_TYPE(A,"number",$)}function V($,A,I){throw Math.floor($)!==$?(j($,I),new te.ERR_OUT_OF_RANGE("offset","an integer",$)):A<0?new te.ERR_BUFFER_OUT_OF_BOUNDS:new te.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${A}`,$)}let G=/[^+/0-9A-Za-z-_]/g;function ie($){if($=$.split("=")[0],$=$.trim().replace(G,""),$.length<2)return"";for(;$.length%4!==0;)$=$+"=";return $}function me($,A){A=A||1/0;let I,C=$.length,H=null,ne=[];for(let J=0;J<C;++J){if(I=$.charCodeAt(J),I>55295&&I<57344){if(!H){if(I>56319){(A-=3)>-1&&ne.push(239,191,189);continue}else if(J+1===C){(A-=3)>-1&&ne.push(239,191,189);continue}H=I;continue}if(I<56320){(A-=3)>-1&&ne.push(239,191,189),H=I;continue}I=(H-55296<<10|I-56320)+65536}else H&&(A-=3)>-1&&ne.push(239,191,189);if(H=null,I<128){if((A-=1)<0)break;ne.push(I)}else if(I<2048){if((A-=2)<0)break;ne.push(I>>6|192,I&63|128)}else if(I<65536){if((A-=3)<0)break;ne.push(I>>12|224,I>>6&63|128,I&63|128)}else if(I<1114112){if((A-=4)<0)break;ne.push(I>>18|240,I>>12&63|128,I>>6&63|128,I&63|128)}else throw new Error("Invalid code point")}return ne}function re($){let A=[];for(let I=0;I<$.length;++I)A.push($.charCodeAt(I)&255);return A}function ae($,A){let I,C,H,ne=[];for(let J=0;J<$.length&&!((A-=2)<0);++J)I=$.charCodeAt(J),C=I>>8,H=I%256,ne.push(H),ne.push(C);return ne}function ye($){return a.toByteArray(ie($))}function fe($,A,I,C){let H;for(H=0;H<C&&!(H+I>=A.length||H>=$.length);++H)A[H+I]=$[H];return H}function he($,A){return $ instanceof A||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===A.name}function nt($){return $!==$}let ce=function(){let $="0123456789abcdef",A=new Array(256);for(let I=0;I<16;++I){let C=I*16;for(let H=0;H<16;++H)A[C+H]=$[I]+$[H]}return A}();function be($){return typeof BigInt>"u"?ut:$}function ut(){throw new Error("BigInt not supported")}return Bh}var P2e,Zd,SE,_p,EE,Bh,AE,Rh,at,T2e,k2e,BE=Eh(()=>{P2e=Ae(Be());Ie();Re();Zd={},SE=!1;_p={},EE=!1;Bh={},AE=!1;Rh=jJ();Rh.Buffer;Rh.SlowBuffer;Rh.INSPECT_MAX_BYTES;Rh.kMaxLength;at=Rh.Buffer,T2e=Rh.INSPECT_MAX_BYTES,k2e=Rh.kMaxLength;});var Ie=Eh(()=>{BE()});var qE=St(y3=>{"use strict";var m6e=Ae(Be());Ie();Re();Object.defineProperty(y3,"__esModule",{value:!0});function eY(a){var o=4,f=a.length,d=f%o;if(!d)return a;var n=f,v=o-d,b=f+v,y=at.alloc(b);for(y.write(a);v--;)y.write("=",n++);return y.toString()}y3.default=eY});var FE=St(_3=>{"use strict";var M6e=Ae(Be());Ie();Re();Object.defineProperty(_3,"__esModule",{value:!0});var tY=qE();function UE(a,o){return o===void 0&&(o="utf8"),at.isBuffer(a)?w3(a.toString("base64")):w3(at.from(a,o).toString("base64"))}function rY(a,o){return o===void 0&&(o="utf8"),at.from(M3(a),"base64").toString(o)}function M3(a){return a=a.toString(),tY.default(a).replace(/\-/g,"+").replace(/_/g,"/")}function w3(a){return a.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function iY(a){return at.from(M3(a),"base64")}var ml=UE;ml.encode=UE;ml.decode=rY;ml.toBase64=M3;ml.fromBase64=w3;ml.toBuffer=iY;_3.default=ml});var Za=St((S6e,Ep)=>{var E6e=Ae(Be());Ie();Re();Ep.exports=FE().default;Ep.exports.default=Ep.exports});var x3=St(($6e,zE)=>{var P6e=Ae(Be());Ie();Re();zE.exports={}});var rA=St(Ip=>{"use strict";var G6e=Ae(Be());Ie();Re();Ip.byteLength=MY;Ip.toByteArray=xY;Ip.fromByteArray=AY;var Ps=[],Ga=[],wY=typeof Uint8Array<"u"?Uint8Array:Array,P3="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for($h=0,eA=P3.length;$h<eA;++$h)Ps[$h]=P3[$h],Ga[P3.charCodeAt($h)]=$h;var $h,eA;Ga[45]=62;Ga[95]=63;function tA(a){var o=a.length;if(o%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var f=a.indexOf("=");f===-1&&(f=o);var d=f===o?0:4-f%4;return[f,d]}function MY(a){var o=tA(a),f=o[0],d=o[1];return(f+d)*3/4-d}function _Y(a,o,f){return(o+f)*3/4-f}function xY(a){var o,f=tA(a),d=f[0],n=f[1],v=new wY(_Y(a,d,n)),b=0,y=n>0?d-4:d,M;for(M=0;M<y;M+=4)o=Ga[a.charCodeAt(M)]<<18|Ga[a.charCodeAt(M+1)]<<12|Ga[a.charCodeAt(M+2)]<<6|Ga[a.charCodeAt(M+3)],v[b++]=o>>16&255,v[b++]=o>>8&255,v[b++]=o&255;return n===2&&(o=Ga[a.charCodeAt(M)]<<2|Ga[a.charCodeAt(M+1)]>>4,v[b++]=o&255),n===1&&(o=Ga[a.charCodeAt(M)]<<10|Ga[a.charCodeAt(M+1)]<<4|Ga[a.charCodeAt(M+2)]>>2,v[b++]=o>>8&255,v[b++]=o&255),v}function SY(a){return Ps[a>>18&63]+Ps[a>>12&63]+Ps[a>>6&63]+Ps[a&63]}function EY(a,o,f){for(var d,n=[],v=o;v<f;v+=3)d=(a[v]<<16&16711680)+(a[v+1]<<8&65280)+(a[v+2]&255),n.push(SY(d));return n.join("")}function AY(a){for(var o,f=a.length,d=f%3,n=[],v=16383,b=0,y=f-d;b<y;b+=v)n.push(EY(a,b,b+v>y?y:b+v));return d===1?(o=a[f-1],n.push(Ps[o>>2]+Ps[o<<4&63]+"==")):d===2&&(o=(a[f-2]<<8)+a[f-1],n.push(Ps[o>>10]+Ps[o>>4&63]+Ps[o<<2&63]+"=")),n.join("")}});var Go=St(Va=>{"use strict";var X6e=Ae(Be());Ie();Re();Object.defineProperty(Va,"__esModule",{value:!0});Va.concatBuffers=BY;Va.b64UrlToString=RY;Va.bufferToString=nA;Va.stringToBuffer=aA;Va.stringToB64Url=IY;Va.b64UrlToBuffer=oA;Va.bufferTob64=sA;Va.bufferTob64Url=fA;Va.b64UrlEncode=hA;Va.b64UrlDecode=uA;var iA=rA();function BY(a){let o=0;for(let n=0;n<a.length;n++)o+=a[n].byteLength;let f=new Uint8Array(o),d=0;f.set(new Uint8Array(a[0]),d),d+=a[0].byteLength;for(let n=1;n<a.length;n++)f.set(new Uint8Array(a[n]),d),d+=a[n].byteLength;return f}function RY(a){let o=oA(a);return nA(o)}function nA(a){return new TextDecoder("utf-8",{fatal:!0}).decode(a)}function aA(a){return new TextEncoder().encode(a)}function IY(a){return fA(aA(a))}function oA(a){return new Uint8Array(iA.toByteArray(uA(a)))}function sA(a){return iA.fromByteArray(new Uint8Array(a))}function fA(a){return hA(sA(a))}function hA(a){try{return a.replace(/\+/g,"-").replace(/\//g,"_").replace(/\=/g,"")}catch(o){throw new Error("Failed to encode string",{cause:o})}}function uA(a){try{a=a.replace(/\-/g,"+").replace(/\_/g,"/");let o;return a.length%4==0?o=0:o=4-a.length%4,a.concat("=".repeat(o))}catch(o){throw new Error("Failed to decode string",{cause:o})}}});var l_=St(u_=>{"use strict";var s3e=Ae(Be());Ie();Re();Object.defineProperty(u_,"__esModule",{value:!0});var Y0=Go(),h_=class{keyLength=4096;publicExponent=65537;hashAlgorithm="sha256";driver;constructor(){if(!this.detectWebCrypto())throw new Error("SubtleCrypto not available!");this.driver=crypto.subtle}async generateJWK(){let o=await this.driver.generateKey({name:"RSA-PSS",modulusLength:4096,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign"]),f=await this.driver.exportKey("jwk",o.privateKey);return{kty:f.kty,e:f.e,n:f.n,d:f.d,p:f.p,q:f.q,dp:f.dp,dq:f.dq,qi:f.qi}}async sign(o,f,{saltLength:d}={}){let n=await this.driver.sign({name:"RSA-PSS",saltLength:d??32},await this.jwkToCryptoKey(o),f);return new Uint8Array(n)}async hash(o,f="SHA-256"){let d=await this.driver.digest(f,o);return new Uint8Array(d)}async verify(o,f,d){let n={kty:"RSA",e:"AQAB",n:o},v=await this.jwkToPublicCryptoKey(n),b=await this.driver.digest("SHA-256",f),y=await this.driver.verify({name:"RSA-PSS",saltLength:0},v,d,f),M=await this.driver.verify({name:"RSA-PSS",saltLength:32},v,d,f),w=Math.ceil((v.algorithm.modulusLength-1)/8)-b.byteLength-2,g=await this.driver.verify({name:"RSA-PSS",saltLength:w},v,d,f),_=y||M||g;if(!_){let x={algorithm:v.algorithm.name,modulusLength:v.algorithm.modulusLength,keyUsages:v.usages,saltLengthsAttempted:`0, 32, ${w}`};console.warn(`Transaction Verification Failed!
|
|
2
2
|
`,`Details: ${JSON.stringify(x,null,2)}
|
|
3
|
-
`,"N.B. ArweaveJS is only guaranteed to verify txs created using ArweaveJS.")}return _}async jwkToCryptoKey(o){return this.driver.importKey("jwk",o,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(o){return this.driver.importKey("jwk",o,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let o=crypto?.subtle;return o===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(d=>typeof o[d]=="function")}async encrypt(o,f,d){let n=await this.driver.importKey("raw",typeof f=="string"?Y0.stringToBuffer(f):f,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?Y0.stringToBuffer(d):Y0.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},n,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let y=await this.driver.encrypt({name:"AES-CBC",iv:b},v,o);return Y0.concatBuffers([b,y])}async decrypt(o,f,d){let n=await this.driver.importKey("raw",typeof f=="string"?Y0.stringToBuffer(f):f,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?Y0.stringToBuffer(d):Y0.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},n,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=o.slice(0,16),y=await this.driver.decrypt({name:"AES-CBC",iv:b},v,o.slice(16));return Y0.concatBuffers([y])}};u_.default=h_});var Uz=St((qz,m6)=>{var u3e=Ae(Be());Ie();Re();(function(a){"use strict";var o,f=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,d=Math.ceil,n=Math.floor,v="[BigNumber Error] ",b=v+"Number primitive has more than 15 significant digits: ",y=1e14,M=14,w=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],_=1e7,x=1e9;function E(W){var Q,K,z,X=k.prototype={constructor:k,toString:null,valueOf:null},p=new k(1),e=20,r=4,i=-7,s=21,h=-1e7,c=1e7,m=!1,l=1,t=0,u={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",B=!0;function k(U,oe){var Y,j,V,G,ie,me,re,ae,ye=this;if(!(ye instanceof k))return new k(U,oe);if(oe==null){if(U&&U._isBigNumber===!0){ye.s=U.s,!U.c||U.e>c?ye.c=ye.e=null:U.e<h?ye.c=[ye.e=0]:(ye.e=U.e,ye.c=U.c.slice());return}if((me=typeof U=="number")&&U*0==0){if(ye.s=1/U<0?(U=-U,-1):1,U===~~U){for(G=0,ie=U;ie>=10;ie/=10,G++);G>c?ye.c=ye.e=null:(ye.e=G,ye.c=[U]);return}ae=String(U)}else{if(!f.test(ae=String(U)))return z(ye,ae,me);ye.s=ae.charCodeAt(0)==45?(ae=ae.slice(1),-1):1}(G=ae.indexOf("."))>-1&&(ae=ae.replace(".","")),(ie=ae.search(/e/i))>0?(G<0&&(G=ie),G+=+ae.slice(ie+1),ae=ae.substring(0,ie)):G<0&&(G=ae.length)}else{if(P(oe,2,S.length,"Base"),oe==10&&B)return ye=new k(U),te(ye,e+ye.e+1,r);if(ae=String(U),me=typeof U=="number"){if(U*0!=0)return z(ye,ae,me,oe);if(ye.s=1/U<0?(ae=ae.slice(1),-1):1,k.DEBUG&&ae.replace(/^0\.0*|\./,"").length>15)throw Error(b+U)}else ye.s=ae.charCodeAt(0)===45?(ae=ae.slice(1),-1):1;for(Y=S.slice(0,oe),G=ie=0,re=ae.length;ie<re;ie++)if(Y.indexOf(j=ae.charAt(ie))<0){if(j=="."){if(ie>G){G=re;continue}}else if(!V&&(ae==ae.toUpperCase()&&(ae=ae.toLowerCase())||ae==ae.toLowerCase()&&(ae=ae.toUpperCase()))){V=!0,ie=-1,G=0;continue}return z(ye,String(U),me,oe)}me=!1,ae=K(ae,oe,10,ye.s),(G=ae.indexOf("."))>-1?ae=ae.replace(".",""):G=ae.length}for(ie=0;ae.charCodeAt(ie)===48;ie++);for(re=ae.length;ae.charCodeAt(--re)===48;);if(ae=ae.slice(ie,++re)){if(re-=ie,me&&k.DEBUG&&re>15&&(U>w||U!==n(U)))throw Error(b+ye.s*U);if((G=G-ie-1)>c)ye.c=ye.e=null;else if(G<h)ye.c=[ye.e=0];else{if(ye.e=G,ye.c=[],ie=(G+1)%M,G<0&&(ie+=M),ie<re){for(ie&&ye.c.push(+ae.slice(0,ie)),re-=M;ie<re;)ye.c.push(+ae.slice(ie,ie+=M));ie=M-(ae=ae.slice(ie)).length}else ie-=re;for(;ie--;ae+="0");ye.c.push(+ae)}}else ye.c=[ye.e=0]}k.clone=E,k.ROUND_UP=0,k.ROUND_DOWN=1,k.ROUND_CEIL=2,k.ROUND_FLOOR=3,k.ROUND_HALF_UP=4,k.ROUND_HALF_DOWN=5,k.ROUND_HALF_EVEN=6,k.ROUND_HALF_CEIL=7,k.ROUND_HALF_FLOOR=8,k.EUCLID=9,k.config=k.set=function(U){var oe,Y;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(oe="DECIMAL_PLACES")&&(Y=U[oe],P(Y,0,x,oe),e=Y),U.hasOwnProperty(oe="ROUNDING_MODE")&&(Y=U[oe],P(Y,0,8,oe),r=Y),U.hasOwnProperty(oe="EXPONENTIAL_AT")&&(Y=U[oe],Y&&Y.pop?(P(Y[0],-x,0,oe),P(Y[1],0,x,oe),i=Y[0],s=Y[1]):(P(Y,-x,x,oe),i=-(s=Y<0?-Y:Y))),U.hasOwnProperty(oe="RANGE"))if(Y=U[oe],Y&&Y.pop)P(Y[0],-x,-1,oe),P(Y[1],1,x,oe),h=Y[0],c=Y[1];else if(P(Y,-x,x,oe),Y)h=-(c=Y<0?-Y:Y);else throw Error(v+oe+" cannot be zero: "+Y);if(U.hasOwnProperty(oe="CRYPTO"))if(Y=U[oe],Y===!!Y)if(Y)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=Y;else throw m=!Y,Error(v+"crypto unavailable");else m=Y;else throw Error(v+oe+" not true or false: "+Y);if(U.hasOwnProperty(oe="MODULO_MODE")&&(Y=U[oe],P(Y,0,9,oe),l=Y),U.hasOwnProperty(oe="POW_PRECISION")&&(Y=U[oe],P(Y,0,x,oe),t=Y),U.hasOwnProperty(oe="FORMAT"))if(Y=U[oe],typeof Y=="object")u=Y;else throw Error(v+oe+" not an object: "+Y);if(U.hasOwnProperty(oe="ALPHABET"))if(Y=U[oe],typeof Y=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(Y))B=Y.slice(0,10)=="0123456789",S=Y;else throw Error(v+oe+" invalid: "+Y)}else throw Error(v+"Object expected: "+U);return{DECIMAL_PLACES:e,ROUNDING_MODE:r,EXPONENTIAL_AT:[i,s],RANGE:[h,c],CRYPTO:m,MODULO_MODE:l,POW_PRECISION:t,FORMAT:u,ALPHABET:S}},k.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!k.DEBUG)return!0;var oe,Y,j=U.c,V=U.e,G=U.s;e:if({}.toString.call(j)=="[object Array]"){if((G===1||G===-1)&&V>=-x&&V<=x&&V===n(V)){if(j[0]===0){if(V===0&&j.length===1)return!0;break e}if(oe=(V+1)%M,oe<1&&(oe+=M),String(j[0]).length==oe){for(oe=0;oe<j.length;oe++)if(Y=j[oe],Y<0||Y>=y||Y!==n(Y))break e;if(Y!==0)return!0}}}else if(j===null&&V===null&&(G===null||G===1||G===-1))return!0;throw Error(v+"Invalid BigNumber: "+U)},k.maximum=k.max=function(){return F(arguments,-1)},k.minimum=k.min=function(){return F(arguments,1)},k.random=function(){var U=9007199254740992,oe=Math.random()*U&2097151?function(){return n(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Y){var j,V,G,ie,me,re=0,ae=[],ye=new k(p);if(Y==null?Y=e:P(Y,0,x),ie=d(Y/M),m)if(crypto.getRandomValues){for(j=crypto.getRandomValues(new Uint32Array(ie*=2));re<ie;)me=j[re]*131072+(j[re+1]>>>11),me>=9e15?(V=crypto.getRandomValues(new Uint32Array(2)),j[re]=V[0],j[re+1]=V[1]):(ae.push(me%1e14),re+=2);re=ie/2}else if(crypto.randomBytes){for(j=crypto.randomBytes(ie*=7);re<ie;)me=(j[re]&31)*281474976710656+j[re+1]*1099511627776+j[re+2]*4294967296+j[re+3]*16777216+(j[re+4]<<16)+(j[re+5]<<8)+j[re+6],me>=9e15?crypto.randomBytes(7).copy(j,re):(ae.push(me%1e14),re+=7);re=ie/7}else throw m=!1,Error(v+"crypto unavailable");if(!m)for(;re<ie;)me=oe(),me<9e15&&(ae[re++]=me%1e14);for(ie=ae[--re],Y%=M,ie&&Y&&(me=g[M-Y],ae[re]=n(ie/me)*me);ae[re]===0;ae.pop(),re--);if(re<0)ae=[G=0];else{for(G=-1;ae[0]===0;ae.splice(0,1),G-=M);for(re=1,me=ae[0];me>=10;me/=10,re++);re<M&&(G-=M-re)}return ye.e=G,ye.c=ae,ye}}(),k.sum=function(){for(var U=1,oe=arguments,Y=new k(oe[0]);U<oe.length;)Y=Y.plus(oe[U++]);return Y},K=function(){var U="0123456789";function oe(Y,j,V,G){for(var ie,me=[0],re,ae=0,ye=Y.length;ae<ye;){for(re=me.length;re--;me[re]*=j);for(me[0]+=G.indexOf(Y.charAt(ae++)),ie=0;ie<me.length;ie++)me[ie]>V-1&&(me[ie+1]==null&&(me[ie+1]=0),me[ie+1]+=me[ie]/V|0,me[ie]%=V)}return me.reverse()}return function(Y,j,V,G,ie){var me,re,ae,ye,fe,he,nt,ce,be=Y.indexOf("."),ut=e,$=r;for(be>=0&&(ye=t,t=0,Y=Y.replace(".",""),ce=new k(j),he=ce.pow(Y.length-be),t=ye,ce.c=oe(Z(T(he.c),he.e,"0"),10,V,U),ce.e=ce.c.length),nt=oe(Y,j,V,ie?(me=S,U):(me=U,S)),ae=ye=nt.length;nt[--ye]==0;nt.pop());if(!nt[0])return me.charAt(0);if(be<0?--ae:(he.c=nt,he.e=ae,he.s=G,he=Q(he,ce,ut,$,V),nt=he.c,fe=he.r,ae=he.e),re=ae+ut+1,be=nt[re],ye=V/2,fe=fe||re<0||nt[re+1]!=null,fe=$<4?(be!=null||fe)&&($==0||$==(he.s<0?3:2)):be>ye||be==ye&&($==4||fe||$==6&&nt[re-1]&1||$==(he.s<0?8:7)),re<1||!nt[0])Y=fe?Z(me.charAt(1),-ut,me.charAt(0)):me.charAt(0);else{if(nt.length=re,fe)for(--V;++nt[--re]>V;)nt[re]=0,re||(++ae,nt=[1].concat(nt));for(ye=nt.length;!nt[--ye];);for(be=0,Y="";be<=ye;Y+=me.charAt(nt[be++]));Y=Z(Y,ae,me.charAt(0))}return Y}}(),Q=function(){function U(j,V,G){var ie,me,re,ae,ye=0,fe=j.length,he=V%_,nt=V/_|0;for(j=j.slice();fe--;)re=j[fe]%_,ae=j[fe]/_|0,ie=nt*re+ae*he,me=he*re+ie%_*_+ye,ye=(me/G|0)+(ie/_|0)+nt*ae,j[fe]=me%G;return ye&&(j=[ye].concat(j)),j}function oe(j,V,G,ie){var me,re;if(G!=ie)re=G>ie?1:-1;else for(me=re=0;me<G;me++)if(j[me]!=V[me]){re=j[me]>V[me]?1:-1;break}return re}function Y(j,V,G,ie){for(var me=0;G--;)j[G]-=me,me=j[G]<V[G]?1:0,j[G]=me*ie+j[G]-V[G];for(;!j[0]&&j.length>1;j.splice(0,1));}return function(j,V,G,ie,me){var re,ae,ye,fe,he,nt,ce,be,ut,$,A,I,C,H,ne,J,de,st=j.s==V.s?1:-1,le=j.c,ve=V.c;if(!le||!le[0]||!ve||!ve[0])return new k(!j.s||!V.s||(le?ve&&le[0]==ve[0]:!ve)?NaN:le&&le[0]==0||!ve?st*0:st/0);for(be=new k(st),ut=be.c=[],ae=j.e-V.e,st=G+ae+1,me||(me=y,ae=R(j.e/M)-R(V.e/M),st=st/M|0),ye=0;ve[ye]==(le[ye]||0);ye++);if(ve[ye]>(le[ye]||0)&&ae--,st<0)ut.push(1),fe=!0;else{for(H=le.length,J=ve.length,ye=0,st+=2,he=n(me/(ve[0]+1)),he>1&&(ve=U(ve,he,me),le=U(le,he,me),J=ve.length,H=le.length),C=J,$=le.slice(0,J),A=$.length;A<J;$[A++]=0);de=ve.slice(),de=[0].concat(de),ne=ve[0],ve[1]>=me/2&&ne++;do{if(he=0,re=oe(ve,$,J,A),re<0){if(I=$[0],J!=A&&(I=I*me+($[1]||0)),he=n(I/ne),he>1)for(he>=me&&(he=me-1),nt=U(ve,he,me),ce=nt.length,A=$.length;oe(nt,$,ce,A)==1;)he--,Y(nt,J<ce?de:ve,ce,me),ce=nt.length,re=1;else he==0&&(re=he=1),nt=ve.slice(),ce=nt.length;if(ce<A&&(nt=[0].concat(nt)),Y($,nt,A,me),A=$.length,re==-1)for(;oe(ve,$,J,A)<1;)he++,Y($,J<A?de:ve,A,me),A=$.length}else re===0&&(he++,$=[0]);ut[ye++]=he,$[0]?$[A++]=le[C]||0:($=[le[C]],A=1)}while((C++<H||$[0]!=null)&&st--);fe=$[0]!=null,ut[0]||ut.splice(0,1)}if(me==y){for(ye=1,st=ut[0];st>=10;st/=10,ye++);te(be,G+(be.e=ye+ae*M-1)+1,ie,fe)}else be.e=ae,be.r=+fe;return be}}();function q(U,oe,Y,j){var V,G,ie,me,re;if(Y==null?Y=r:P(Y,0,8),!U.c)return U.toString();if(V=U.c[0],ie=U.e,oe==null)re=T(U.c),re=j==1||j==2&&(ie<=i||ie>=s)?D(re,ie):Z(re,ie,"0");else if(U=te(new k(U),oe,Y),G=U.e,re=T(U.c),me=re.length,j==1||j==2&&(oe<=G||G<=i)){for(;me<oe;re+="0",me++);re=D(re,G)}else if(oe-=ie,re=Z(re,G,"0"),G+1>me){if(--oe>0)for(re+=".";oe--;re+="0");}else if(oe+=G-me,oe>0)for(G+1==me&&(re+=".");oe--;re+="0");return U.s<0&&V?"-"+re:re}function F(U,oe){for(var Y,j,V=1,G=new k(U[0]);V<U.length;V++)j=new k(U[V]),(!j.s||(Y=N(G,j))===oe||Y===0&&G.s===oe)&&(G=j);return G}function ee(U,oe,Y){for(var j=1,V=oe.length;!oe[--V];oe.pop());for(V=oe[0];V>=10;V/=10,j++);return(Y=j+Y*M-1)>c?U.c=U.e=null:Y<h?U.c=[U.e=0]:(U.e=Y,U.c=oe),U}z=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,oe=/^([^.]+)\.$/,Y=/^\.([^.]+)$/,j=/^-?(Infinity|NaN)$/,V=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(G,ie,me,re){var ae,ye=me?ie:ie.replace(V,"");if(j.test(ye))G.s=isNaN(ye)?null:ye<0?-1:1;else{if(!me&&(ye=ye.replace(U,function(fe,he,nt){return ae=(nt=nt.toLowerCase())=="x"?16:nt=="b"?2:8,!re||re==ae?he:fe}),re&&(ae=re,ye=ye.replace(oe,"$1").replace(Y,"0.$1")),ie!=ye))return new k(ye,ae);if(k.DEBUG)throw Error(v+"Not a"+(re?" base "+re:"")+" number: "+ie);G.s=null}G.c=G.e=null}}();function te(U,oe,Y,j){var V,G,ie,me,re,ae,ye,fe=U.c,he=g;if(fe){e:{for(V=1,me=fe[0];me>=10;me/=10,V++);if(G=oe-V,G<0)G+=M,ie=oe,re=fe[ae=0],ye=n(re/he[V-ie-1]%10);else if(ae=d((G+1)/M),ae>=fe.length)if(j){for(;fe.length<=ae;fe.push(0));re=ye=0,V=1,G%=M,ie=G-M+1}else break e;else{for(re=me=fe[ae],V=1;me>=10;me/=10,V++);G%=M,ie=G-M+V,ye=ie<0?0:n(re/he[V-ie-1]%10)}if(j=j||oe<0||fe[ae+1]!=null||(ie<0?re:re%he[V-ie-1]),j=Y<4?(ye||j)&&(Y==0||Y==(U.s<0?3:2)):ye>5||ye==5&&(Y==4||j||Y==6&&(G>0?ie>0?re/he[V-ie]:0:fe[ae-1])%10&1||Y==(U.s<0?8:7)),oe<1||!fe[0])return fe.length=0,j?(oe-=U.e+1,fe[0]=he[(M-oe%M)%M],U.e=-oe||0):fe[0]=U.e=0,U;if(G==0?(fe.length=ae,me=1,ae--):(fe.length=ae+1,me=he[M-G],fe[ae]=ie>0?n(re/he[V-ie]%he[ie])*me:0),j)for(;;)if(ae==0){for(G=1,ie=fe[0];ie>=10;ie/=10,G++);for(ie=fe[0]+=me,me=1;ie>=10;ie/=10,me++);G!=me&&(U.e++,fe[0]==y&&(fe[0]=1));break}else{if(fe[ae]+=me,fe[ae]!=y)break;fe[ae--]=0,me=1}for(G=fe.length;fe[--G]===0;fe.pop());}U.e>c?U.c=U.e=null:U.e<h&&(U.c=[U.e=0])}return U}function O(U){var oe,Y=U.e;return Y===null?U.toString():(oe=T(U.c),oe=Y<=i||Y>=s?D(oe,Y):Z(oe,Y,"0"),U.s<0?"-"+oe:oe)}return X.absoluteValue=X.abs=function(){var U=new k(this);return U.s<0&&(U.s=1),U},X.comparedTo=function(U,oe){return N(this,new k(U,oe))},X.decimalPlaces=X.dp=function(U,oe){var Y,j,V,G=this;if(U!=null)return P(U,0,x),oe==null?oe=r:P(oe,0,8),te(new k(G),U+G.e+1,oe);if(!(Y=G.c))return null;if(j=((V=Y.length-1)-R(this.e/M))*M,V=Y[V])for(;V%10==0;V/=10,j--);return j<0&&(j=0),j},X.dividedBy=X.div=function(U,oe){return Q(this,new k(U,oe),e,r)},X.dividedToIntegerBy=X.idiv=function(U,oe){return Q(this,new k(U,oe),0,1)},X.exponentiatedBy=X.pow=function(U,oe){var Y,j,V,G,ie,me,re,ae,ye,fe=this;if(U=new k(U),U.c&&!U.isInteger())throw Error(v+"Exponent not an integer: "+O(U));if(oe!=null&&(oe=new k(oe)),me=U.e>14,!fe.c||!fe.c[0]||fe.c[0]==1&&!fe.e&&fe.c.length==1||!U.c||!U.c[0])return ye=new k(Math.pow(+O(fe),me?U.s*(2-L(U)):+O(U))),oe?ye.mod(oe):ye;if(re=U.s<0,oe){if(oe.c?!oe.c[0]:!oe.s)return new k(NaN);j=!re&&fe.isInteger()&&oe.isInteger(),j&&(fe=fe.mod(oe))}else{if(U.e>9&&(fe.e>0||fe.e<-1||(fe.e==0?fe.c[0]>1||me&&fe.c[1]>=24e7:fe.c[0]<8e13||me&&fe.c[0]<=9999975e7)))return G=fe.s<0&&L(U)?-0:0,fe.e>-1&&(G=1/G),new k(re?1/G:G);t&&(G=d(t/M+2))}for(me?(Y=new k(.5),re&&(U.s=1),ae=L(U)):(V=Math.abs(+O(U)),ae=V%2),ye=new k(p);;){if(ae){if(ye=ye.times(fe),!ye.c)break;G?ye.c.length>G&&(ye.c.length=G):j&&(ye=ye.mod(oe))}if(V){if(V=n(V/2),V===0)break;ae=V%2}else if(U=U.times(Y),te(U,U.e+1,1),U.e>14)ae=L(U);else{if(V=+O(U),V===0)break;ae=V%2}fe=fe.times(fe),G?fe.c&&fe.c.length>G&&(fe.c.length=G):j&&(fe=fe.mod(oe))}return j?ye:(re&&(ye=p.div(ye)),oe?ye.mod(oe):G?te(ye,t,r,ie):ye)},X.integerValue=function(U){var oe=new k(this);return U==null?U=r:P(U,0,8),te(oe,oe.e+1,U)},X.isEqualTo=X.eq=function(U,oe){return N(this,new k(U,oe))===0},X.isFinite=function(){return!!this.c},X.isGreaterThan=X.gt=function(U,oe){return N(this,new k(U,oe))>0},X.isGreaterThanOrEqualTo=X.gte=function(U,oe){return(oe=N(this,new k(U,oe)))===1||oe===0},X.isInteger=function(){return!!this.c&&R(this.e/M)>this.c.length-2},X.isLessThan=X.lt=function(U,oe){return N(this,new k(U,oe))<0},X.isLessThanOrEqualTo=X.lte=function(U,oe){return(oe=N(this,new k(U,oe)))===-1||oe===0},X.isNaN=function(){return!this.s},X.isNegative=function(){return this.s<0},X.isPositive=function(){return this.s>0},X.isZero=function(){return!!this.c&&this.c[0]==0},X.minus=function(U,oe){var Y,j,V,G,ie=this,me=ie.s;if(U=new k(U,oe),oe=U.s,!me||!oe)return new k(NaN);if(me!=oe)return U.s=-oe,ie.plus(U);var re=ie.e/M,ae=U.e/M,ye=ie.c,fe=U.c;if(!re||!ae){if(!ye||!fe)return ye?(U.s=-oe,U):new k(fe?ie:NaN);if(!ye[0]||!fe[0])return fe[0]?(U.s=-oe,U):new k(ye[0]?ie:r==3?-0:0)}if(re=R(re),ae=R(ae),ye=ye.slice(),me=re-ae){for((G=me<0)?(me=-me,V=ye):(ae=re,V=fe),V.reverse(),oe=me;oe--;V.push(0));V.reverse()}else for(j=(G=(me=ye.length)<(oe=fe.length))?me:oe,me=oe=0;oe<j;oe++)if(ye[oe]!=fe[oe]){G=ye[oe]<fe[oe];break}if(G&&(V=ye,ye=fe,fe=V,U.s=-U.s),oe=(j=fe.length)-(Y=ye.length),oe>0)for(;oe--;ye[Y++]=0);for(oe=y-1;j>me;){if(ye[--j]<fe[j]){for(Y=j;Y&&!ye[--Y];ye[Y]=oe);--ye[Y],ye[j]+=y}ye[j]-=fe[j]}for(;ye[0]==0;ye.splice(0,1),--ae);return ye[0]?ee(U,ye,ae):(U.s=r==3?-1:1,U.c=[U.e=0],U)},X.modulo=X.mod=function(U,oe){var Y,j,V=this;return U=new k(U,oe),!V.c||!U.s||U.c&&!U.c[0]?new k(NaN):!U.c||V.c&&!V.c[0]?new k(V):(l==9?(j=U.s,U.s=1,Y=Q(V,U,0,3),U.s=j,Y.s*=j):Y=Q(V,U,0,l),U=V.minus(Y.times(U)),!U.c[0]&&l==1&&(U.s=V.s),U)},X.multipliedBy=X.times=function(U,oe){var Y,j,V,G,ie,me,re,ae,ye,fe,he,nt,ce,be,ut,$=this,A=$.c,I=(U=new k(U,oe)).c;if(!A||!I||!A[0]||!I[0])return!$.s||!U.s||A&&!A[0]&&!I||I&&!I[0]&&!A?U.c=U.e=U.s=null:(U.s*=$.s,!A||!I?U.c=U.e=null:(U.c=[0],U.e=0)),U;for(j=R($.e/M)+R(U.e/M),U.s*=$.s,re=A.length,fe=I.length,re<fe&&(ce=A,A=I,I=ce,V=re,re=fe,fe=V),V=re+fe,ce=[];V--;ce.push(0));for(be=y,ut=_,V=fe;--V>=0;){for(Y=0,he=I[V]%ut,nt=I[V]/ut|0,ie=re,G=V+ie;G>V;)ae=A[--ie]%ut,ye=A[ie]/ut|0,me=nt*ae+ye*he,ae=he*ae+me%ut*ut+ce[G]+Y,Y=(ae/be|0)+(me/ut|0)+nt*ye,ce[G--]=ae%be;ce[G]=Y}return Y?++j:ce.splice(0,1),ee(U,ce,j)},X.negated=function(){var U=new k(this);return U.s=-U.s||null,U},X.plus=function(U,oe){var Y,j=this,V=j.s;if(U=new k(U,oe),oe=U.s,!V||!oe)return new k(NaN);if(V!=oe)return U.s=-oe,j.minus(U);var G=j.e/M,ie=U.e/M,me=j.c,re=U.c;if(!G||!ie){if(!me||!re)return new k(V/0);if(!me[0]||!re[0])return re[0]?U:new k(me[0]?j:V*0)}if(G=R(G),ie=R(ie),me=me.slice(),V=G-ie){for(V>0?(ie=G,Y=re):(V=-V,Y=me),Y.reverse();V--;Y.push(0));Y.reverse()}for(V=me.length,oe=re.length,V-oe<0&&(Y=re,re=me,me=Y,oe=V),V=0;oe;)V=(me[--oe]=me[oe]+re[oe]+V)/y|0,me[oe]=y===me[oe]?0:me[oe]%y;return V&&(me=[V].concat(me),++ie),ee(U,me,ie)},X.precision=X.sd=function(U,oe){var Y,j,V,G=this;if(U!=null&&U!==!!U)return P(U,1,x),oe==null?oe=r:P(oe,0,8),te(new k(G),U,oe);if(!(Y=G.c))return null;if(V=Y.length-1,j=V*M+1,V=Y[V]){for(;V%10==0;V/=10,j--);for(V=Y[0];V>=10;V/=10,j++);}return U&&G.e+1>j&&(j=G.e+1),j},X.shiftedBy=function(U){return P(U,-w,w),this.times("1e"+U)},X.squareRoot=X.sqrt=function(){var U,oe,Y,j,V,G=this,ie=G.c,me=G.s,re=G.e,ae=e+4,ye=new k("0.5");if(me!==1||!ie||!ie[0])return new k(!me||me<0&&(!ie||ie[0])?NaN:ie?G:1/0);if(me=Math.sqrt(+O(G)),me==0||me==1/0?(oe=T(ie),(oe.length+re)%2==0&&(oe+="0"),me=Math.sqrt(+oe),re=R((re+1)/2)-(re<0||re%2),me==1/0?oe="5e"+re:(oe=me.toExponential(),oe=oe.slice(0,oe.indexOf("e")+1)+re),Y=new k(oe)):Y=new k(me+""),Y.c[0]){for(re=Y.e,me=re+ae,me<3&&(me=0);;)if(V=Y,Y=ye.times(V.plus(Q(G,V,ae,1))),T(V.c).slice(0,me)===(oe=T(Y.c)).slice(0,me))if(Y.e<re&&--me,oe=oe.slice(me-3,me+1),oe=="9999"||!j&&oe=="4999"){if(!j&&(te(V,V.e+e+2,0),V.times(V).eq(G))){Y=V;break}ae+=4,me+=4,j=1}else{(!+oe||!+oe.slice(1)&&oe.charAt(0)=="5")&&(te(Y,Y.e+e+2,1),U=!Y.times(Y).eq(G));break}}return te(Y,Y.e+e+1,r,U)},X.toExponential=function(U,oe){return U!=null&&(P(U,0,x),U++),q(this,U,oe,1)},X.toFixed=function(U,oe){return U!=null&&(P(U,0,x),U=U+this.e+1),q(this,U,oe)},X.toFormat=function(U,oe,Y){var j,V=this;if(Y==null)U!=null&&oe&&typeof oe=="object"?(Y=oe,oe=null):U&&typeof U=="object"?(Y=U,U=oe=null):Y=u;else if(typeof Y!="object")throw Error(v+"Argument not an object: "+Y);if(j=V.toFixed(U,oe),V.c){var G,ie=j.split("."),me=+Y.groupSize,re=+Y.secondaryGroupSize,ae=Y.groupSeparator||"",ye=ie[0],fe=ie[1],he=V.s<0,nt=he?ye.slice(1):ye,ce=nt.length;if(re&&(G=me,me=re,re=G,ce-=G),me>0&&ce>0){for(G=ce%me||me,ye=nt.substr(0,G);G<ce;G+=me)ye+=ae+nt.substr(G,me);re>0&&(ye+=ae+nt.slice(G)),he&&(ye="-"+ye)}j=fe?ye+(Y.decimalSeparator||"")+((re=+Y.fractionGroupSize)?fe.replace(new RegExp("\\d{"+re+"}\\B","g"),"$&"+(Y.fractionGroupSeparator||"")):fe):ye}return(Y.prefix||"")+j+(Y.suffix||"")},X.toFraction=function(U){var oe,Y,j,V,G,ie,me,re,ae,ye,fe,he,nt=this,ce=nt.c;if(U!=null&&(me=new k(U),!me.isInteger()&&(me.c||me.s!==1)||me.lt(p)))throw Error(v+"Argument "+(me.isInteger()?"out of range: ":"not an integer: ")+O(me));if(!ce)return new k(nt);for(oe=new k(p),ae=Y=new k(p),j=re=new k(p),he=T(ce),G=oe.e=he.length-nt.e-1,oe.c[0]=g[(ie=G%M)<0?M+ie:ie],U=!U||me.comparedTo(oe)>0?G>0?oe:ae:me,ie=c,c=1/0,me=new k(he),re.c[0]=0;ye=Q(me,oe,0,1),V=Y.plus(ye.times(j)),V.comparedTo(U)!=1;)Y=j,j=V,ae=re.plus(ye.times(V=ae)),re=V,oe=me.minus(ye.times(V=oe)),me=V;return V=Q(U.minus(Y),j,0,1),re=re.plus(V.times(ae)),Y=Y.plus(V.times(j)),re.s=ae.s=nt.s,G=G*2,fe=Q(ae,j,G,r).minus(nt).abs().comparedTo(Q(re,Y,G,r).minus(nt).abs())<1?[ae,j]:[re,Y],c=ie,fe},X.toNumber=function(){return+O(this)},X.toPrecision=function(U,oe){return U!=null&&P(U,1,x),q(this,U,oe,2)},X.toString=function(U){var oe,Y=this,j=Y.s,V=Y.e;return V===null?j?(oe="Infinity",j<0&&(oe="-"+oe)):oe="NaN":(U==null?oe=V<=i||V>=s?D(T(Y.c),V):Z(T(Y.c),V,"0"):U===10&&B?(Y=te(new k(Y),e+V+1,r),oe=Z(T(Y.c),Y.e,"0")):(P(U,2,S.length,"Base"),oe=K(Z(T(Y.c),V,"0"),10,U,j,!0)),j<0&&Y.c[0]&&(oe="-"+oe)),oe},X.valueOf=X.toJSON=function(){return O(this)},X._isBigNumber=!0,W!=null&&k.set(W),k}function R(W){var Q=W|0;return W>0||W===Q?Q:Q-1}function T(W){for(var Q,K,z=1,X=W.length,p=W[0]+"";z<X;){for(Q=W[z++]+"",K=M-Q.length;K--;Q="0"+Q);p+=Q}for(X=p.length;p.charCodeAt(--X)===48;);return p.slice(0,X+1||1)}function N(W,Q){var K,z,X=W.c,p=Q.c,e=W.s,r=Q.s,i=W.e,s=Q.e;if(!e||!r)return null;if(K=X&&!X[0],z=p&&!p[0],K||z)return K?z?0:-r:e;if(e!=r)return e;if(K=e<0,z=i==s,!X||!p)return z?0:!X^K?1:-1;if(!z)return i>s^K?1:-1;for(r=(i=X.length)<(s=p.length)?i:s,e=0;e<r;e++)if(X[e]!=p[e])return X[e]>p[e]^K?1:-1;return i==s?0:i>s^K?1:-1}function P(W,Q,K,z){if(W<Q||W>K||W!==n(W))throw Error(v+(z||"Argument")+(typeof W=="number"?W<Q||W>K?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function L(W){var Q=W.c.length-1;return R(W.e/M)==Q&&W.c[Q]%2!=0}function D(W,Q){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(Q<0?"e":"e+")+Q}function Z(W,Q,K){var z,X;if(Q<0){for(X=K+".";++Q;X+=K);W=X+W}else if(z=W.length,++Q>z){for(X=K,Q-=z;--Q;X+=K);W+=X}else Q<z&&(W=W.slice(0,Q)+"."+W.slice(Q));return W}o=E(),o.default=o.BigNumber=o,typeof define=="function"&&define.amd?define(function(){return o}):typeof m6<"u"&&m6.exports?m6.exports=o:(a||(a=typeof self<"u"&&self?self:window),a.BigNumber=o)})(qz)});var Fz=St(c_=>{"use strict";var p3e=Ae(Be());Ie();Re();Object.defineProperty(c_,"__esModule",{value:!0});var O0e=Uz(),d_=class{BigNum;constructor(){this.BigNum=(o,f)=>{let d=O0e.BigNumber.clone({DECIMAL_PLACES:f});return new d(o)}}winstonToAr(o,{formatted:f=!1,decimals:d=12,trim:n=!0}={}){let v=this.stringToBigNum(o,d).shiftedBy(-12);return f?v.toFormat(d):v.toFixed(d)}arToWinston(o,{formatted:f=!1}={}){let d=this.stringToBigNum(o).shiftedBy(12);return f?d.toFormat():d.toFixed(0)}compare(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.comparedTo(n)}isEqual(o,f){return this.compare(o,f)===0}isLessThan(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.isLessThan(n)}isGreaterThan(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.isGreaterThan(n)}add(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.plus(f).toFixed(0)}sub(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.minus(f).toFixed(0)}stringToBigNum(o,f=12){return this.BigNum(o,f)}};c_.default=d_});var zz=St(v_=>{"use strict";var g3e=Ae(Be());Ie();Re();Object.defineProperty(v_,"__esModule",{value:!0});var p_=class{METHOD_GET="GET";METHOD_POST="POST";config;constructor(o){this.applyConfig(o)}applyConfig(o){this.config=this.mergeDefaults(o)}getConfig(){return this.config}mergeDefaults(o){let f=o.protocol||"http",d=o.port||(f==="https"?443:80);return{host:o.host||"127.0.0.1",protocol:f,port:d,timeout:o.timeout||2e4,logging:o.logging||!1,logger:o.logger||console.log,network:o.network}}async get(o,f){return await this.request(o,{...f,method:this.METHOD_GET})}async post(o,f,d){let n=new Headers(d?.headers||{});return n.get("content-type")?.includes("application/json")||n.append("content-type","application/json"),n.append("accept","application/json, text/plain, */*"),await this.request(o,{...d,method:this.METHOD_POST,body:typeof f!="string"?JSON.stringify(f):f,headers:n})}async request(o,f){let d=new Headers(f?.headers||{}),n=`${this.config.protocol}://${this.config.host}:${this.config.port}`,v=f?.responseType;delete f?.responseType,o.startsWith("/")&&(o=o.slice(1)),this.config.network&&d.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${n}/${o}`);let b=await fetch(`${n}/${o}`,{...f||{},headers:d});this.config.logging&&this.config.logger(`Response: ${b.url} - ${b.status}`);let M=b.headers.get("content-type")?.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i)?.[1],w=b,g=async()=>{if(M)try{w.data=new TextDecoder(M).decode(await b.arrayBuffer())}catch{w.data=await b.text()}else w.data=await b.text()};if(v==="arraybuffer")w.data=await b.arrayBuffer();else if(v==="text")await g();else if(v==="webstream")w.data=q0e(b.body);else try{let _=await b.clone().json();typeof _!="object"?await g():w.data=await b.json(),_=null}catch{await g()}return w}};v_.default=p_;var q0e=a=>{let o=a;return typeof o[Symbol.asyncIterator]>"u"&&(o[Symbol.asyncIterator]=U0e(a)),o},U0e=function(a){return async function*(){let f=a.getReader();try{for(;;){let{done:d,value:n}=await f.read();if(d)return;yield n}}finally{f.releaseLock()}}}});var Hz=St(m_=>{"use strict";var _3e=Ae(Be());Ie();Re();Object.defineProperty(m_,"__esModule",{value:!0});var b_=class{api;constructor(o){this.api=o}getInfo(){return this.api.get("info").then(o=>o.data)}getPeers(){return this.api.get("peers").then(o=>o.data)}};m_.default=b_});var d1=St(g6=>{"use strict";var A3e=Ae(Be());Ie();Re();Object.defineProperty(g6,"__esModule",{value:!0});g6.getError=F0e;var g_=class extends Error{type;response;constructor(o,f={}){f.message?super(f.message):super(),this.type=o,this.response=f.response}getType(){return this.type}};g6.default=g_;function F0e(a){let o=a.data;if(typeof a.data=="string")try{o=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{o=JSON.parse(o.toString())}catch{}return o?o.error||o:a.statusText||"unknown"}});var S_=St(_i=>{"use strict";var T3e=Ae(Be());Ie();Re();Object.defineProperty(_i,"__esModule",{value:!0});_i.arrayCompare=_i.MIN_CHUNK_SIZE=_i.MAX_CHUNK_SIZE=void 0;_i.chunkData=w_;_i.generateLeaves=M_;_i.computeRootHash=z0e;_i.generateTree=jz;_i.generateTransactionChunks=H0e;_i.buildLayers=w6;_i.generateProofs=Wz;_i.arrayFlatten=__;_i.intToBuffer=v1;_i.bufferToInt=x_;_i.validatePath=c1;_i.debug=Zz;var y6=b1(),Kz=Go();_i.MAX_CHUNK_SIZE=256*1024;_i.MIN_CHUNK_SIZE=32*1024;var p1=32,ad=32;async function w_(a){let o=[],f=a,d=0;for(;f.byteLength>=_i.MAX_CHUNK_SIZE;){let n=_i.MAX_CHUNK_SIZE,v=f.byteLength-_i.MAX_CHUNK_SIZE;v>0&&v<_i.MIN_CHUNK_SIZE&&(n=Math.ceil(f.byteLength/2));let b=f.slice(0,n),y=await y6.default.crypto.hash(b);d+=b.byteLength,o.push({dataHash:y,minByteRange:d-b.byteLength,maxByteRange:d}),f=f.slice(n)}return o.push({dataHash:await y6.default.crypto.hash(f),minByteRange:d,maxByteRange:d+f.byteLength}),o}async function M_(a){return Promise.all(a.map(async({dataHash:o,minByteRange:f,maxByteRange:d})=>({type:"leaf",id:await An(await Promise.all([An(o),An(v1(d))])),dataHash:o,minByteRange:f,maxByteRange:d})))}async function z0e(a){return(await jz(a)).id}async function jz(a){return await w6(await M_(await w_(a)))}async function H0e(a){let o=await w_(a),f=await M_(o),d=await w6(f),n=await Wz(d),v=o.slice(-1)[0];return v.maxByteRange-v.minByteRange===0&&(o.splice(o.length-1,1),n.splice(n.length-1,1)),{data_root:d.id,chunks:o,proofs:n}}async function w6(a,o=0){if(a.length<2)return a[0];let f=[];for(let d=0;d<a.length;d+=2)f.push(await K0e(a[d],a[d+1]));return w6(f,o+1)}function Wz(a){let o=y_(a);return Array.isArray(o)?__(o):[o]}function y_(a,o=new Uint8Array,f=0){if(a.type=="leaf")return{offset:a.maxByteRange-1,proof:(0,Kz.concatBuffers)([o,a.dataHash,v1(a.maxByteRange)])};if(a.type=="branch"){let d=(0,Kz.concatBuffers)([o,a.leftChild.id,a.rightChild.id,v1(a.byteRange)]);return[y_(a.leftChild,d,f+1),y_(a.rightChild,d,f+1)]}throw new Error("Unexpected node type")}function __(a){let o=[];return a.forEach(f=>{Array.isArray(f)?o.push(...__(f)):o.push(f)}),o}async function K0e(a,o){return o?{type:"branch",id:await An([await An(a.id),await An(o.id),await An(v1(a.maxByteRange))]),byteRange:a.maxByteRange,maxByteRange:o.maxByteRange,leftChild:a,rightChild:o}:a}async function An(a){return Array.isArray(a)&&(a=y6.default.utils.concatBuffers(a)),new Uint8Array(await y6.default.crypto.hash(a))}function v1(a){let o=new Uint8Array(p1);for(var f=o.length-1;f>=0;f--){var d=a%256;o[f]=d,a=(a-d)/256}return o}function x_(a){let o=0;for(var f=0;f<a.length;f++)o*=256,o+=a[f];return o}var j0e=(a,o)=>a.every((f,d)=>o[d]===f);_i.arrayCompare=j0e;async function c1(a,o,f,d,n){if(d<=0)return!1;if(o>=d)return c1(a,0,d-1,d,n);if(o<0)return c1(a,0,0,d,n);if(n.length==ad+p1){let _=n.slice(0,ad),x=n.slice(_.length,_.length+p1),E=await An([await An(_),await An(x)]);return(0,_i.arrayCompare)(a,E)?{offset:d-1,leftBound:f,rightBound:d,chunkSize:d-f}:!1}let v=n.slice(0,ad),b=n.slice(v.length,v.length+ad),y=n.slice(v.length+b.length,v.length+b.length+p1),M=x_(y),w=n.slice(v.length+b.length+y.length),g=await An([await An(v),await An(b),await An(y)]);return(0,_i.arrayCompare)(a,g)?o<M?await c1(v,o,f,Math.min(d,M),w):await c1(b,o,Math.max(f,M),d,w):!1}async function Zz(a,o=""){if(a.byteLength<1)return o;let f=a.slice(0,ad),d=a.slice(f.length,f.length+ad),n=a.slice(f.length+d.length,f.length+d.length+p1),v=x_(n),b=a.slice(f.length+d.length+n.length),y=await An([await An(f),await An(d),await An(n)]),M=`${o}
|
|
3
|
+
`,"N.B. ArweaveJS is only guaranteed to verify txs created using ArweaveJS.")}return _}async jwkToCryptoKey(o){return this.driver.importKey("jwk",o,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["sign"])}async jwkToPublicCryptoKey(o){return this.driver.importKey("jwk",o,{name:"RSA-PSS",hash:{name:"SHA-256"}},!1,["verify"])}detectWebCrypto(){if(typeof crypto>"u")return!1;let o=crypto?.subtle;return o===void 0?!1:["generateKey","importKey","exportKey","digest","sign"].every(d=>typeof o[d]=="function")}async encrypt(o,f,d){let n=await this.driver.importKey("raw",typeof f=="string"?Y0.stringToBuffer(f):f,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?Y0.stringToBuffer(d):Y0.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},n,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=new Uint8Array(16);crypto.getRandomValues(b);let y=await this.driver.encrypt({name:"AES-CBC",iv:b},v,o);return Y0.concatBuffers([b,y])}async decrypt(o,f,d){let n=await this.driver.importKey("raw",typeof f=="string"?Y0.stringToBuffer(f):f,{name:"PBKDF2",length:32},!1,["deriveKey"]),v=await this.driver.deriveKey({name:"PBKDF2",salt:d?Y0.stringToBuffer(d):Y0.stringToBuffer("salt"),iterations:1e5,hash:"SHA-256"},n,{name:"AES-CBC",length:256},!1,["encrypt","decrypt"]),b=o.slice(0,16),y=await this.driver.decrypt({name:"AES-CBC",iv:b},v,o.slice(16));return Y0.concatBuffers([y])}};u_.default=h_});var Uz=St((qz,m6)=>{var u3e=Ae(Be());Ie();Re();(function(a){"use strict";var o,f=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,d=Math.ceil,n=Math.floor,v="[BigNumber Error] ",b=v+"Number primitive has more than 15 significant digits: ",y=1e14,M=14,w=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],_=1e7,x=1e9;function E(W){var Q,K,z,X=k.prototype={constructor:k,toString:null,valueOf:null},p=new k(1),e=20,r=4,i=-7,s=21,h=-1e7,c=1e7,m=!1,l=1,t=0,u={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:"\xA0",suffix:""},S="0123456789abcdefghijklmnopqrstuvwxyz",B=!0;function k(U,oe){var Y,j,V,G,ie,me,re,ae,ye=this;if(!(ye instanceof k))return new k(U,oe);if(oe==null){if(U&&U._isBigNumber===!0){ye.s=U.s,!U.c||U.e>c?ye.c=ye.e=null:U.e<h?ye.c=[ye.e=0]:(ye.e=U.e,ye.c=U.c.slice());return}if((me=typeof U=="number")&&U*0==0){if(ye.s=1/U<0?(U=-U,-1):1,U===~~U){for(G=0,ie=U;ie>=10;ie/=10,G++);G>c?ye.c=ye.e=null:(ye.e=G,ye.c=[U]);return}ae=String(U)}else{if(!f.test(ae=String(U)))return z(ye,ae,me);ye.s=ae.charCodeAt(0)==45?(ae=ae.slice(1),-1):1}(G=ae.indexOf("."))>-1&&(ae=ae.replace(".","")),(ie=ae.search(/e/i))>0?(G<0&&(G=ie),G+=+ae.slice(ie+1),ae=ae.substring(0,ie)):G<0&&(G=ae.length)}else{if(P(oe,2,S.length,"Base"),oe==10&&B)return ye=new k(U),te(ye,e+ye.e+1,r);if(ae=String(U),me=typeof U=="number"){if(U*0!=0)return z(ye,ae,me,oe);if(ye.s=1/U<0?(ae=ae.slice(1),-1):1,k.DEBUG&&ae.replace(/^0\.0*|\./,"").length>15)throw Error(b+U)}else ye.s=ae.charCodeAt(0)===45?(ae=ae.slice(1),-1):1;for(Y=S.slice(0,oe),G=ie=0,re=ae.length;ie<re;ie++)if(Y.indexOf(j=ae.charAt(ie))<0){if(j=="."){if(ie>G){G=re;continue}}else if(!V&&(ae==ae.toUpperCase()&&(ae=ae.toLowerCase())||ae==ae.toLowerCase()&&(ae=ae.toUpperCase()))){V=!0,ie=-1,G=0;continue}return z(ye,String(U),me,oe)}me=!1,ae=K(ae,oe,10,ye.s),(G=ae.indexOf("."))>-1?ae=ae.replace(".",""):G=ae.length}for(ie=0;ae.charCodeAt(ie)===48;ie++);for(re=ae.length;ae.charCodeAt(--re)===48;);if(ae=ae.slice(ie,++re)){if(re-=ie,me&&k.DEBUG&&re>15&&(U>w||U!==n(U)))throw Error(b+ye.s*U);if((G=G-ie-1)>c)ye.c=ye.e=null;else if(G<h)ye.c=[ye.e=0];else{if(ye.e=G,ye.c=[],ie=(G+1)%M,G<0&&(ie+=M),ie<re){for(ie&&ye.c.push(+ae.slice(0,ie)),re-=M;ie<re;)ye.c.push(+ae.slice(ie,ie+=M));ie=M-(ae=ae.slice(ie)).length}else ie-=re;for(;ie--;ae+="0");ye.c.push(+ae)}}else ye.c=[ye.e=0]}k.clone=E,k.ROUND_UP=0,k.ROUND_DOWN=1,k.ROUND_CEIL=2,k.ROUND_FLOOR=3,k.ROUND_HALF_UP=4,k.ROUND_HALF_DOWN=5,k.ROUND_HALF_EVEN=6,k.ROUND_HALF_CEIL=7,k.ROUND_HALF_FLOOR=8,k.EUCLID=9,k.config=k.set=function(U){var oe,Y;if(U!=null)if(typeof U=="object"){if(U.hasOwnProperty(oe="DECIMAL_PLACES")&&(Y=U[oe],P(Y,0,x,oe),e=Y),U.hasOwnProperty(oe="ROUNDING_MODE")&&(Y=U[oe],P(Y,0,8,oe),r=Y),U.hasOwnProperty(oe="EXPONENTIAL_AT")&&(Y=U[oe],Y&&Y.pop?(P(Y[0],-x,0,oe),P(Y[1],0,x,oe),i=Y[0],s=Y[1]):(P(Y,-x,x,oe),i=-(s=Y<0?-Y:Y))),U.hasOwnProperty(oe="RANGE"))if(Y=U[oe],Y&&Y.pop)P(Y[0],-x,-1,oe),P(Y[1],1,x,oe),h=Y[0],c=Y[1];else if(P(Y,-x,x,oe),Y)h=-(c=Y<0?-Y:Y);else throw Error(v+oe+" cannot be zero: "+Y);if(U.hasOwnProperty(oe="CRYPTO"))if(Y=U[oe],Y===!!Y)if(Y)if(typeof crypto<"u"&&crypto&&(crypto.getRandomValues||crypto.randomBytes))m=Y;else throw m=!Y,Error(v+"crypto unavailable");else m=Y;else throw Error(v+oe+" not true or false: "+Y);if(U.hasOwnProperty(oe="MODULO_MODE")&&(Y=U[oe],P(Y,0,9,oe),l=Y),U.hasOwnProperty(oe="POW_PRECISION")&&(Y=U[oe],P(Y,0,x,oe),t=Y),U.hasOwnProperty(oe="FORMAT"))if(Y=U[oe],typeof Y=="object")u=Y;else throw Error(v+oe+" not an object: "+Y);if(U.hasOwnProperty(oe="ALPHABET"))if(Y=U[oe],typeof Y=="string"&&!/^.?$|[+\-.\s]|(.).*\1/.test(Y))B=Y.slice(0,10)=="0123456789",S=Y;else throw Error(v+oe+" invalid: "+Y)}else throw Error(v+"Object expected: "+U);return{DECIMAL_PLACES:e,ROUNDING_MODE:r,EXPONENTIAL_AT:[i,s],RANGE:[h,c],CRYPTO:m,MODULO_MODE:l,POW_PRECISION:t,FORMAT:u,ALPHABET:S}},k.isBigNumber=function(U){if(!U||U._isBigNumber!==!0)return!1;if(!k.DEBUG)return!0;var oe,Y,j=U.c,V=U.e,G=U.s;e:if({}.toString.call(j)=="[object Array]"){if((G===1||G===-1)&&V>=-x&&V<=x&&V===n(V)){if(j[0]===0){if(V===0&&j.length===1)return!0;break e}if(oe=(V+1)%M,oe<1&&(oe+=M),String(j[0]).length==oe){for(oe=0;oe<j.length;oe++)if(Y=j[oe],Y<0||Y>=y||Y!==n(Y))break e;if(Y!==0)return!0}}}else if(j===null&&V===null&&(G===null||G===1||G===-1))return!0;throw Error(v+"Invalid BigNumber: "+U)},k.maximum=k.max=function(){return F(arguments,-1)},k.minimum=k.min=function(){return F(arguments,1)},k.random=function(){var U=9007199254740992,oe=Math.random()*U&2097151?function(){return n(Math.random()*U)}:function(){return(Math.random()*1073741824|0)*8388608+(Math.random()*8388608|0)};return function(Y){var j,V,G,ie,me,re=0,ae=[],ye=new k(p);if(Y==null?Y=e:P(Y,0,x),ie=d(Y/M),m)if(crypto.getRandomValues){for(j=crypto.getRandomValues(new Uint32Array(ie*=2));re<ie;)me=j[re]*131072+(j[re+1]>>>11),me>=9e15?(V=crypto.getRandomValues(new Uint32Array(2)),j[re]=V[0],j[re+1]=V[1]):(ae.push(me%1e14),re+=2);re=ie/2}else if(crypto.randomBytes){for(j=crypto.randomBytes(ie*=7);re<ie;)me=(j[re]&31)*281474976710656+j[re+1]*1099511627776+j[re+2]*4294967296+j[re+3]*16777216+(j[re+4]<<16)+(j[re+5]<<8)+j[re+6],me>=9e15?crypto.randomBytes(7).copy(j,re):(ae.push(me%1e14),re+=7);re=ie/7}else throw m=!1,Error(v+"crypto unavailable");if(!m)for(;re<ie;)me=oe(),me<9e15&&(ae[re++]=me%1e14);for(ie=ae[--re],Y%=M,ie&&Y&&(me=g[M-Y],ae[re]=n(ie/me)*me);ae[re]===0;ae.pop(),re--);if(re<0)ae=[G=0];else{for(G=-1;ae[0]===0;ae.splice(0,1),G-=M);for(re=1,me=ae[0];me>=10;me/=10,re++);re<M&&(G-=M-re)}return ye.e=G,ye.c=ae,ye}}(),k.sum=function(){for(var U=1,oe=arguments,Y=new k(oe[0]);U<oe.length;)Y=Y.plus(oe[U++]);return Y},K=function(){var U="0123456789";function oe(Y,j,V,G){for(var ie,me=[0],re,ae=0,ye=Y.length;ae<ye;){for(re=me.length;re--;me[re]*=j);for(me[0]+=G.indexOf(Y.charAt(ae++)),ie=0;ie<me.length;ie++)me[ie]>V-1&&(me[ie+1]==null&&(me[ie+1]=0),me[ie+1]+=me[ie]/V|0,me[ie]%=V)}return me.reverse()}return function(Y,j,V,G,ie){var me,re,ae,ye,fe,he,nt,ce,be=Y.indexOf("."),ut=e,$=r;for(be>=0&&(ye=t,t=0,Y=Y.replace(".",""),ce=new k(j),he=ce.pow(Y.length-be),t=ye,ce.c=oe(Z(T(he.c),he.e,"0"),10,V,U),ce.e=ce.c.length),nt=oe(Y,j,V,ie?(me=S,U):(me=U,S)),ae=ye=nt.length;nt[--ye]==0;nt.pop());if(!nt[0])return me.charAt(0);if(be<0?--ae:(he.c=nt,he.e=ae,he.s=G,he=Q(he,ce,ut,$,V),nt=he.c,fe=he.r,ae=he.e),re=ae+ut+1,be=nt[re],ye=V/2,fe=fe||re<0||nt[re+1]!=null,fe=$<4?(be!=null||fe)&&($==0||$==(he.s<0?3:2)):be>ye||be==ye&&($==4||fe||$==6&&nt[re-1]&1||$==(he.s<0?8:7)),re<1||!nt[0])Y=fe?Z(me.charAt(1),-ut,me.charAt(0)):me.charAt(0);else{if(nt.length=re,fe)for(--V;++nt[--re]>V;)nt[re]=0,re||(++ae,nt=[1].concat(nt));for(ye=nt.length;!nt[--ye];);for(be=0,Y="";be<=ye;Y+=me.charAt(nt[be++]));Y=Z(Y,ae,me.charAt(0))}return Y}}(),Q=function(){function U(j,V,G){var ie,me,re,ae,ye=0,fe=j.length,he=V%_,nt=V/_|0;for(j=j.slice();fe--;)re=j[fe]%_,ae=j[fe]/_|0,ie=nt*re+ae*he,me=he*re+ie%_*_+ye,ye=(me/G|0)+(ie/_|0)+nt*ae,j[fe]=me%G;return ye&&(j=[ye].concat(j)),j}function oe(j,V,G,ie){var me,re;if(G!=ie)re=G>ie?1:-1;else for(me=re=0;me<G;me++)if(j[me]!=V[me]){re=j[me]>V[me]?1:-1;break}return re}function Y(j,V,G,ie){for(var me=0;G--;)j[G]-=me,me=j[G]<V[G]?1:0,j[G]=me*ie+j[G]-V[G];for(;!j[0]&&j.length>1;j.splice(0,1));}return function(j,V,G,ie,me){var re,ae,ye,fe,he,nt,ce,be,ut,$,A,I,C,H,ne,J,de,st=j.s==V.s?1:-1,le=j.c,ve=V.c;if(!le||!le[0]||!ve||!ve[0])return new k(!j.s||!V.s||(le?ve&&le[0]==ve[0]:!ve)?NaN:le&&le[0]==0||!ve?st*0:st/0);for(be=new k(st),ut=be.c=[],ae=j.e-V.e,st=G+ae+1,me||(me=y,ae=R(j.e/M)-R(V.e/M),st=st/M|0),ye=0;ve[ye]==(le[ye]||0);ye++);if(ve[ye]>(le[ye]||0)&&ae--,st<0)ut.push(1),fe=!0;else{for(H=le.length,J=ve.length,ye=0,st+=2,he=n(me/(ve[0]+1)),he>1&&(ve=U(ve,he,me),le=U(le,he,me),J=ve.length,H=le.length),C=J,$=le.slice(0,J),A=$.length;A<J;$[A++]=0);de=ve.slice(),de=[0].concat(de),ne=ve[0],ve[1]>=me/2&&ne++;do{if(he=0,re=oe(ve,$,J,A),re<0){if(I=$[0],J!=A&&(I=I*me+($[1]||0)),he=n(I/ne),he>1)for(he>=me&&(he=me-1),nt=U(ve,he,me),ce=nt.length,A=$.length;oe(nt,$,ce,A)==1;)he--,Y(nt,J<ce?de:ve,ce,me),ce=nt.length,re=1;else he==0&&(re=he=1),nt=ve.slice(),ce=nt.length;if(ce<A&&(nt=[0].concat(nt)),Y($,nt,A,me),A=$.length,re==-1)for(;oe(ve,$,J,A)<1;)he++,Y($,J<A?de:ve,A,me),A=$.length}else re===0&&(he++,$=[0]);ut[ye++]=he,$[0]?$[A++]=le[C]||0:($=[le[C]],A=1)}while((C++<H||$[0]!=null)&&st--);fe=$[0]!=null,ut[0]||ut.splice(0,1)}if(me==y){for(ye=1,st=ut[0];st>=10;st/=10,ye++);te(be,G+(be.e=ye+ae*M-1)+1,ie,fe)}else be.e=ae,be.r=+fe;return be}}();function q(U,oe,Y,j){var V,G,ie,me,re;if(Y==null?Y=r:P(Y,0,8),!U.c)return U.toString();if(V=U.c[0],ie=U.e,oe==null)re=T(U.c),re=j==1||j==2&&(ie<=i||ie>=s)?D(re,ie):Z(re,ie,"0");else if(U=te(new k(U),oe,Y),G=U.e,re=T(U.c),me=re.length,j==1||j==2&&(oe<=G||G<=i)){for(;me<oe;re+="0",me++);re=D(re,G)}else if(oe-=ie+(j===2&&G>ie),re=Z(re,G,"0"),G+1>me){if(--oe>0)for(re+=".";oe--;re+="0");}else if(oe+=G-me,oe>0)for(G+1==me&&(re+=".");oe--;re+="0");return U.s<0&&V?"-"+re:re}function F(U,oe){for(var Y,j,V=1,G=new k(U[0]);V<U.length;V++)j=new k(U[V]),(!j.s||(Y=N(G,j))===oe||Y===0&&G.s===oe)&&(G=j);return G}function ee(U,oe,Y){for(var j=1,V=oe.length;!oe[--V];oe.pop());for(V=oe[0];V>=10;V/=10,j++);return(Y=j+Y*M-1)>c?U.c=U.e=null:Y<h?U.c=[U.e=0]:(U.e=Y,U.c=oe),U}z=function(){var U=/^(-?)0([xbo])(?=\w[\w.]*$)/i,oe=/^([^.]+)\.$/,Y=/^\.([^.]+)$/,j=/^-?(Infinity|NaN)$/,V=/^\s*\+(?=[\w.])|^\s+|\s+$/g;return function(G,ie,me,re){var ae,ye=me?ie:ie.replace(V,"");if(j.test(ye))G.s=isNaN(ye)?null:ye<0?-1:1;else{if(!me&&(ye=ye.replace(U,function(fe,he,nt){return ae=(nt=nt.toLowerCase())=="x"?16:nt=="b"?2:8,!re||re==ae?he:fe}),re&&(ae=re,ye=ye.replace(oe,"$1").replace(Y,"0.$1")),ie!=ye))return new k(ye,ae);if(k.DEBUG)throw Error(v+"Not a"+(re?" base "+re:"")+" number: "+ie);G.s=null}G.c=G.e=null}}();function te(U,oe,Y,j){var V,G,ie,me,re,ae,ye,fe=U.c,he=g;if(fe){e:{for(V=1,me=fe[0];me>=10;me/=10,V++);if(G=oe-V,G<0)G+=M,ie=oe,re=fe[ae=0],ye=n(re/he[V-ie-1]%10);else if(ae=d((G+1)/M),ae>=fe.length)if(j){for(;fe.length<=ae;fe.push(0));re=ye=0,V=1,G%=M,ie=G-M+1}else break e;else{for(re=me=fe[ae],V=1;me>=10;me/=10,V++);G%=M,ie=G-M+V,ye=ie<0?0:n(re/he[V-ie-1]%10)}if(j=j||oe<0||fe[ae+1]!=null||(ie<0?re:re%he[V-ie-1]),j=Y<4?(ye||j)&&(Y==0||Y==(U.s<0?3:2)):ye>5||ye==5&&(Y==4||j||Y==6&&(G>0?ie>0?re/he[V-ie]:0:fe[ae-1])%10&1||Y==(U.s<0?8:7)),oe<1||!fe[0])return fe.length=0,j?(oe-=U.e+1,fe[0]=he[(M-oe%M)%M],U.e=-oe||0):fe[0]=U.e=0,U;if(G==0?(fe.length=ae,me=1,ae--):(fe.length=ae+1,me=he[M-G],fe[ae]=ie>0?n(re/he[V-ie]%he[ie])*me:0),j)for(;;)if(ae==0){for(G=1,ie=fe[0];ie>=10;ie/=10,G++);for(ie=fe[0]+=me,me=1;ie>=10;ie/=10,me++);G!=me&&(U.e++,fe[0]==y&&(fe[0]=1));break}else{if(fe[ae]+=me,fe[ae]!=y)break;fe[ae--]=0,me=1}for(G=fe.length;fe[--G]===0;fe.pop());}U.e>c?U.c=U.e=null:U.e<h&&(U.c=[U.e=0])}return U}function O(U){var oe,Y=U.e;return Y===null?U.toString():(oe=T(U.c),oe=Y<=i||Y>=s?D(oe,Y):Z(oe,Y,"0"),U.s<0?"-"+oe:oe)}return X.absoluteValue=X.abs=function(){var U=new k(this);return U.s<0&&(U.s=1),U},X.comparedTo=function(U,oe){return N(this,new k(U,oe))},X.decimalPlaces=X.dp=function(U,oe){var Y,j,V,G=this;if(U!=null)return P(U,0,x),oe==null?oe=r:P(oe,0,8),te(new k(G),U+G.e+1,oe);if(!(Y=G.c))return null;if(j=((V=Y.length-1)-R(this.e/M))*M,V=Y[V])for(;V%10==0;V/=10,j--);return j<0&&(j=0),j},X.dividedBy=X.div=function(U,oe){return Q(this,new k(U,oe),e,r)},X.dividedToIntegerBy=X.idiv=function(U,oe){return Q(this,new k(U,oe),0,1)},X.exponentiatedBy=X.pow=function(U,oe){var Y,j,V,G,ie,me,re,ae,ye,fe=this;if(U=new k(U),U.c&&!U.isInteger())throw Error(v+"Exponent not an integer: "+O(U));if(oe!=null&&(oe=new k(oe)),me=U.e>14,!fe.c||!fe.c[0]||fe.c[0]==1&&!fe.e&&fe.c.length==1||!U.c||!U.c[0])return ye=new k(Math.pow(+O(fe),me?U.s*(2-L(U)):+O(U))),oe?ye.mod(oe):ye;if(re=U.s<0,oe){if(oe.c?!oe.c[0]:!oe.s)return new k(NaN);j=!re&&fe.isInteger()&&oe.isInteger(),j&&(fe=fe.mod(oe))}else{if(U.e>9&&(fe.e>0||fe.e<-1||(fe.e==0?fe.c[0]>1||me&&fe.c[1]>=24e7:fe.c[0]<8e13||me&&fe.c[0]<=9999975e7)))return G=fe.s<0&&L(U)?-0:0,fe.e>-1&&(G=1/G),new k(re?1/G:G);t&&(G=d(t/M+2))}for(me?(Y=new k(.5),re&&(U.s=1),ae=L(U)):(V=Math.abs(+O(U)),ae=V%2),ye=new k(p);;){if(ae){if(ye=ye.times(fe),!ye.c)break;G?ye.c.length>G&&(ye.c.length=G):j&&(ye=ye.mod(oe))}if(V){if(V=n(V/2),V===0)break;ae=V%2}else if(U=U.times(Y),te(U,U.e+1,1),U.e>14)ae=L(U);else{if(V=+O(U),V===0)break;ae=V%2}fe=fe.times(fe),G?fe.c&&fe.c.length>G&&(fe.c.length=G):j&&(fe=fe.mod(oe))}return j?ye:(re&&(ye=p.div(ye)),oe?ye.mod(oe):G?te(ye,t,r,ie):ye)},X.integerValue=function(U){var oe=new k(this);return U==null?U=r:P(U,0,8),te(oe,oe.e+1,U)},X.isEqualTo=X.eq=function(U,oe){return N(this,new k(U,oe))===0},X.isFinite=function(){return!!this.c},X.isGreaterThan=X.gt=function(U,oe){return N(this,new k(U,oe))>0},X.isGreaterThanOrEqualTo=X.gte=function(U,oe){return(oe=N(this,new k(U,oe)))===1||oe===0},X.isInteger=function(){return!!this.c&&R(this.e/M)>this.c.length-2},X.isLessThan=X.lt=function(U,oe){return N(this,new k(U,oe))<0},X.isLessThanOrEqualTo=X.lte=function(U,oe){return(oe=N(this,new k(U,oe)))===-1||oe===0},X.isNaN=function(){return!this.s},X.isNegative=function(){return this.s<0},X.isPositive=function(){return this.s>0},X.isZero=function(){return!!this.c&&this.c[0]==0},X.minus=function(U,oe){var Y,j,V,G,ie=this,me=ie.s;if(U=new k(U,oe),oe=U.s,!me||!oe)return new k(NaN);if(me!=oe)return U.s=-oe,ie.plus(U);var re=ie.e/M,ae=U.e/M,ye=ie.c,fe=U.c;if(!re||!ae){if(!ye||!fe)return ye?(U.s=-oe,U):new k(fe?ie:NaN);if(!ye[0]||!fe[0])return fe[0]?(U.s=-oe,U):new k(ye[0]?ie:r==3?-0:0)}if(re=R(re),ae=R(ae),ye=ye.slice(),me=re-ae){for((G=me<0)?(me=-me,V=ye):(ae=re,V=fe),V.reverse(),oe=me;oe--;V.push(0));V.reverse()}else for(j=(G=(me=ye.length)<(oe=fe.length))?me:oe,me=oe=0;oe<j;oe++)if(ye[oe]!=fe[oe]){G=ye[oe]<fe[oe];break}if(G&&(V=ye,ye=fe,fe=V,U.s=-U.s),oe=(j=fe.length)-(Y=ye.length),oe>0)for(;oe--;ye[Y++]=0);for(oe=y-1;j>me;){if(ye[--j]<fe[j]){for(Y=j;Y&&!ye[--Y];ye[Y]=oe);--ye[Y],ye[j]+=y}ye[j]-=fe[j]}for(;ye[0]==0;ye.splice(0,1),--ae);return ye[0]?ee(U,ye,ae):(U.s=r==3?-1:1,U.c=[U.e=0],U)},X.modulo=X.mod=function(U,oe){var Y,j,V=this;return U=new k(U,oe),!V.c||!U.s||U.c&&!U.c[0]?new k(NaN):!U.c||V.c&&!V.c[0]?new k(V):(l==9?(j=U.s,U.s=1,Y=Q(V,U,0,3),U.s=j,Y.s*=j):Y=Q(V,U,0,l),U=V.minus(Y.times(U)),!U.c[0]&&l==1&&(U.s=V.s),U)},X.multipliedBy=X.times=function(U,oe){var Y,j,V,G,ie,me,re,ae,ye,fe,he,nt,ce,be,ut,$=this,A=$.c,I=(U=new k(U,oe)).c;if(!A||!I||!A[0]||!I[0])return!$.s||!U.s||A&&!A[0]&&!I||I&&!I[0]&&!A?U.c=U.e=U.s=null:(U.s*=$.s,!A||!I?U.c=U.e=null:(U.c=[0],U.e=0)),U;for(j=R($.e/M)+R(U.e/M),U.s*=$.s,re=A.length,fe=I.length,re<fe&&(ce=A,A=I,I=ce,V=re,re=fe,fe=V),V=re+fe,ce=[];V--;ce.push(0));for(be=y,ut=_,V=fe;--V>=0;){for(Y=0,he=I[V]%ut,nt=I[V]/ut|0,ie=re,G=V+ie;G>V;)ae=A[--ie]%ut,ye=A[ie]/ut|0,me=nt*ae+ye*he,ae=he*ae+me%ut*ut+ce[G]+Y,Y=(ae/be|0)+(me/ut|0)+nt*ye,ce[G--]=ae%be;ce[G]=Y}return Y?++j:ce.splice(0,1),ee(U,ce,j)},X.negated=function(){var U=new k(this);return U.s=-U.s||null,U},X.plus=function(U,oe){var Y,j=this,V=j.s;if(U=new k(U,oe),oe=U.s,!V||!oe)return new k(NaN);if(V!=oe)return U.s=-oe,j.minus(U);var G=j.e/M,ie=U.e/M,me=j.c,re=U.c;if(!G||!ie){if(!me||!re)return new k(V/0);if(!me[0]||!re[0])return re[0]?U:new k(me[0]?j:V*0)}if(G=R(G),ie=R(ie),me=me.slice(),V=G-ie){for(V>0?(ie=G,Y=re):(V=-V,Y=me),Y.reverse();V--;Y.push(0));Y.reverse()}for(V=me.length,oe=re.length,V-oe<0&&(Y=re,re=me,me=Y,oe=V),V=0;oe;)V=(me[--oe]=me[oe]+re[oe]+V)/y|0,me[oe]=y===me[oe]?0:me[oe]%y;return V&&(me=[V].concat(me),++ie),ee(U,me,ie)},X.precision=X.sd=function(U,oe){var Y,j,V,G=this;if(U!=null&&U!==!!U)return P(U,1,x),oe==null?oe=r:P(oe,0,8),te(new k(G),U,oe);if(!(Y=G.c))return null;if(V=Y.length-1,j=V*M+1,V=Y[V]){for(;V%10==0;V/=10,j--);for(V=Y[0];V>=10;V/=10,j++);}return U&&G.e+1>j&&(j=G.e+1),j},X.shiftedBy=function(U){return P(U,-w,w),this.times("1e"+U)},X.squareRoot=X.sqrt=function(){var U,oe,Y,j,V,G=this,ie=G.c,me=G.s,re=G.e,ae=e+4,ye=new k("0.5");if(me!==1||!ie||!ie[0])return new k(!me||me<0&&(!ie||ie[0])?NaN:ie?G:1/0);if(me=Math.sqrt(+O(G)),me==0||me==1/0?(oe=T(ie),(oe.length+re)%2==0&&(oe+="0"),me=Math.sqrt(+oe),re=R((re+1)/2)-(re<0||re%2),me==1/0?oe="5e"+re:(oe=me.toExponential(),oe=oe.slice(0,oe.indexOf("e")+1)+re),Y=new k(oe)):Y=new k(me+""),Y.c[0]){for(re=Y.e,me=re+ae,me<3&&(me=0);;)if(V=Y,Y=ye.times(V.plus(Q(G,V,ae,1))),T(V.c).slice(0,me)===(oe=T(Y.c)).slice(0,me))if(Y.e<re&&--me,oe=oe.slice(me-3,me+1),oe=="9999"||!j&&oe=="4999"){if(!j&&(te(V,V.e+e+2,0),V.times(V).eq(G))){Y=V;break}ae+=4,me+=4,j=1}else{(!+oe||!+oe.slice(1)&&oe.charAt(0)=="5")&&(te(Y,Y.e+e+2,1),U=!Y.times(Y).eq(G));break}}return te(Y,Y.e+e+1,r,U)},X.toExponential=function(U,oe){return U!=null&&(P(U,0,x),U++),q(this,U,oe,1)},X.toFixed=function(U,oe){return U!=null&&(P(U,0,x),U=U+this.e+1),q(this,U,oe)},X.toFormat=function(U,oe,Y){var j,V=this;if(Y==null)U!=null&&oe&&typeof oe=="object"?(Y=oe,oe=null):U&&typeof U=="object"?(Y=U,U=oe=null):Y=u;else if(typeof Y!="object")throw Error(v+"Argument not an object: "+Y);if(j=V.toFixed(U,oe),V.c){var G,ie=j.split("."),me=+Y.groupSize,re=+Y.secondaryGroupSize,ae=Y.groupSeparator||"",ye=ie[0],fe=ie[1],he=V.s<0,nt=he?ye.slice(1):ye,ce=nt.length;if(re&&(G=me,me=re,re=G,ce-=G),me>0&&ce>0){for(G=ce%me||me,ye=nt.substr(0,G);G<ce;G+=me)ye+=ae+nt.substr(G,me);re>0&&(ye+=ae+nt.slice(G)),he&&(ye="-"+ye)}j=fe?ye+(Y.decimalSeparator||"")+((re=+Y.fractionGroupSize)?fe.replace(new RegExp("\\d{"+re+"}\\B","g"),"$&"+(Y.fractionGroupSeparator||"")):fe):ye}return(Y.prefix||"")+j+(Y.suffix||"")},X.toFraction=function(U){var oe,Y,j,V,G,ie,me,re,ae,ye,fe,he,nt=this,ce=nt.c;if(U!=null&&(me=new k(U),!me.isInteger()&&(me.c||me.s!==1)||me.lt(p)))throw Error(v+"Argument "+(me.isInteger()?"out of range: ":"not an integer: ")+O(me));if(!ce)return new k(nt);for(oe=new k(p),ae=Y=new k(p),j=re=new k(p),he=T(ce),G=oe.e=he.length-nt.e-1,oe.c[0]=g[(ie=G%M)<0?M+ie:ie],U=!U||me.comparedTo(oe)>0?G>0?oe:ae:me,ie=c,c=1/0,me=new k(he),re.c[0]=0;ye=Q(me,oe,0,1),V=Y.plus(ye.times(j)),V.comparedTo(U)!=1;)Y=j,j=V,ae=re.plus(ye.times(V=ae)),re=V,oe=me.minus(ye.times(V=oe)),me=V;return V=Q(U.minus(Y),j,0,1),re=re.plus(V.times(ae)),Y=Y.plus(V.times(j)),re.s=ae.s=nt.s,G=G*2,fe=Q(ae,j,G,r).minus(nt).abs().comparedTo(Q(re,Y,G,r).minus(nt).abs())<1?[ae,j]:[re,Y],c=ie,fe},X.toNumber=function(){return+O(this)},X.toPrecision=function(U,oe){return U!=null&&P(U,1,x),q(this,U,oe,2)},X.toString=function(U){var oe,Y=this,j=Y.s,V=Y.e;return V===null?j?(oe="Infinity",j<0&&(oe="-"+oe)):oe="NaN":(U==null?oe=V<=i||V>=s?D(T(Y.c),V):Z(T(Y.c),V,"0"):U===10&&B?(Y=te(new k(Y),e+V+1,r),oe=Z(T(Y.c),Y.e,"0")):(P(U,2,S.length,"Base"),oe=K(Z(T(Y.c),V,"0"),10,U,j,!0)),j<0&&Y.c[0]&&(oe="-"+oe)),oe},X.valueOf=X.toJSON=function(){return O(this)},X._isBigNumber=!0,W!=null&&k.set(W),k}function R(W){var Q=W|0;return W>0||W===Q?Q:Q-1}function T(W){for(var Q,K,z=1,X=W.length,p=W[0]+"";z<X;){for(Q=W[z++]+"",K=M-Q.length;K--;Q="0"+Q);p+=Q}for(X=p.length;p.charCodeAt(--X)===48;);return p.slice(0,X+1||1)}function N(W,Q){var K,z,X=W.c,p=Q.c,e=W.s,r=Q.s,i=W.e,s=Q.e;if(!e||!r)return null;if(K=X&&!X[0],z=p&&!p[0],K||z)return K?z?0:-r:e;if(e!=r)return e;if(K=e<0,z=i==s,!X||!p)return z?0:!X^K?1:-1;if(!z)return i>s^K?1:-1;for(r=(i=X.length)<(s=p.length)?i:s,e=0;e<r;e++)if(X[e]!=p[e])return X[e]>p[e]^K?1:-1;return i==s?0:i>s^K?1:-1}function P(W,Q,K,z){if(W<Q||W>K||W!==n(W))throw Error(v+(z||"Argument")+(typeof W=="number"?W<Q||W>K?" out of range: ":" not an integer: ":" not a primitive number: ")+String(W))}function L(W){var Q=W.c.length-1;return R(W.e/M)==Q&&W.c[Q]%2!=0}function D(W,Q){return(W.length>1?W.charAt(0)+"."+W.slice(1):W)+(Q<0?"e":"e+")+Q}function Z(W,Q,K){var z,X;if(Q<0){for(X=K+".";++Q;X+=K);W=X+W}else if(z=W.length,++Q>z){for(X=K,Q-=z;--Q;X+=K);W+=X}else Q<z&&(W=W.slice(0,Q)+"."+W.slice(Q));return W}o=E(),o.default=o.BigNumber=o,typeof define=="function"&&define.amd?define(function(){return o}):typeof m6<"u"&&m6.exports?m6.exports=o:(a||(a=typeof self<"u"&&self?self:window),a.BigNumber=o)})(qz)});var Fz=St(c_=>{"use strict";var p3e=Ae(Be());Ie();Re();Object.defineProperty(c_,"__esModule",{value:!0});var O0e=Uz(),d_=class{BigNum;constructor(){this.BigNum=(o,f)=>{let d=O0e.BigNumber.clone({DECIMAL_PLACES:f});return new d(o)}}winstonToAr(o,{formatted:f=!1,decimals:d=12,trim:n=!0}={}){let v=this.stringToBigNum(o,d).shiftedBy(-12);return f?v.toFormat(d):v.toFixed(d)}arToWinston(o,{formatted:f=!1}={}){let d=this.stringToBigNum(o).shiftedBy(12);return f?d.toFormat():d.toFixed(0)}compare(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.comparedTo(n)}isEqual(o,f){return this.compare(o,f)===0}isLessThan(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.isLessThan(n)}isGreaterThan(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.isGreaterThan(n)}add(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.plus(f).toFixed(0)}sub(o,f){let d=this.stringToBigNum(o),n=this.stringToBigNum(f);return d.minus(f).toFixed(0)}stringToBigNum(o,f=12){return this.BigNum(o,f)}};c_.default=d_});var zz=St(v_=>{"use strict";var g3e=Ae(Be());Ie();Re();Object.defineProperty(v_,"__esModule",{value:!0});var p_=class{METHOD_GET="GET";METHOD_POST="POST";config;constructor(o){this.applyConfig(o)}applyConfig(o){this.config=this.mergeDefaults(o)}getConfig(){return this.config}mergeDefaults(o){let f=o.protocol||"http",d=o.port||(f==="https"?443:80);return{host:o.host||"127.0.0.1",protocol:f,port:d,timeout:o.timeout||2e4,logging:o.logging||!1,logger:o.logger||console.log,network:o.network}}async get(o,f){return await this.request(o,{...f,method:this.METHOD_GET})}async post(o,f,d){let n=new Headers(d?.headers||{});return n.get("content-type")?.includes("application/json")||n.append("content-type","application/json"),n.append("accept","application/json, text/plain, */*"),await this.request(o,{...d,method:this.METHOD_POST,body:typeof f!="string"?JSON.stringify(f):f,headers:n})}async request(o,f){let d=new Headers(f?.headers||{}),n=`${this.config.protocol}://${this.config.host}:${this.config.port}`,v=f?.responseType;delete f?.responseType,o.startsWith("/")&&(o=o.slice(1)),this.config.network&&d.append("x-network",this.config.network),this.config.logging&&this.config.logger(`Requesting: ${n}/${o}`);let b=await fetch(`${n}/${o}`,{...f||{},headers:d});this.config.logging&&this.config.logger(`Response: ${b.url} - ${b.status}`);let M=b.headers.get("content-type")?.match(/charset=([^()<>@,;:\"/[\]?.=\s]*)/i)?.[1],w=b,g=async()=>{if(M)try{w.data=new TextDecoder(M).decode(await b.arrayBuffer())}catch{w.data=await b.text()}else w.data=await b.text()};if(v==="arraybuffer")w.data=await b.arrayBuffer();else if(v==="text")await g();else if(v==="webstream")w.data=q0e(b.body);else try{let _=await b.clone().json();typeof _!="object"?await g():w.data=await b.json(),_=null}catch{await g()}return w}};v_.default=p_;var q0e=a=>{let o=a;return typeof o[Symbol.asyncIterator]>"u"&&(o[Symbol.asyncIterator]=U0e(a)),o},U0e=function(a){return async function*(){let f=a.getReader();try{for(;;){let{done:d,value:n}=await f.read();if(d)return;yield n}}finally{f.releaseLock()}}}});var Hz=St(m_=>{"use strict";var _3e=Ae(Be());Ie();Re();Object.defineProperty(m_,"__esModule",{value:!0});var b_=class{api;constructor(o){this.api=o}getInfo(){return this.api.get("info").then(o=>o.data)}getPeers(){return this.api.get("peers").then(o=>o.data)}};m_.default=b_});var d1=St(g6=>{"use strict";var A3e=Ae(Be());Ie();Re();Object.defineProperty(g6,"__esModule",{value:!0});g6.getError=F0e;var g_=class extends Error{type;response;constructor(o,f={}){f.message?super(f.message):super(),this.type=o,this.response=f.response}getType(){return this.type}};g6.default=g_;function F0e(a){let o=a.data;if(typeof a.data=="string")try{o=JSON.parse(a.data)}catch{}if(a.data instanceof ArrayBuffer||a.data instanceof Uint8Array)try{o=JSON.parse(o.toString())}catch{}return o?o.error||o:a.statusText||"unknown"}});var S_=St(_i=>{"use strict";var T3e=Ae(Be());Ie();Re();Object.defineProperty(_i,"__esModule",{value:!0});_i.arrayCompare=_i.MIN_CHUNK_SIZE=_i.MAX_CHUNK_SIZE=void 0;_i.chunkData=w_;_i.generateLeaves=M_;_i.computeRootHash=z0e;_i.generateTree=jz;_i.generateTransactionChunks=H0e;_i.buildLayers=w6;_i.generateProofs=Wz;_i.arrayFlatten=__;_i.intToBuffer=v1;_i.bufferToInt=x_;_i.validatePath=c1;_i.debug=Zz;var y6=b1(),Kz=Go();_i.MAX_CHUNK_SIZE=256*1024;_i.MIN_CHUNK_SIZE=32*1024;var p1=32,ad=32;async function w_(a){let o=[],f=a,d=0;for(;f.byteLength>=_i.MAX_CHUNK_SIZE;){let n=_i.MAX_CHUNK_SIZE,v=f.byteLength-_i.MAX_CHUNK_SIZE;v>0&&v<_i.MIN_CHUNK_SIZE&&(n=Math.ceil(f.byteLength/2));let b=f.slice(0,n),y=await y6.default.crypto.hash(b);d+=b.byteLength,o.push({dataHash:y,minByteRange:d-b.byteLength,maxByteRange:d}),f=f.slice(n)}return o.push({dataHash:await y6.default.crypto.hash(f),minByteRange:d,maxByteRange:d+f.byteLength}),o}async function M_(a){return Promise.all(a.map(async({dataHash:o,minByteRange:f,maxByteRange:d})=>({type:"leaf",id:await An(await Promise.all([An(o),An(v1(d))])),dataHash:o,minByteRange:f,maxByteRange:d})))}async function z0e(a){return(await jz(a)).id}async function jz(a){return await w6(await M_(await w_(a)))}async function H0e(a){let o=await w_(a),f=await M_(o),d=await w6(f),n=await Wz(d),v=o.slice(-1)[0];return v.maxByteRange-v.minByteRange===0&&(o.splice(o.length-1,1),n.splice(n.length-1,1)),{data_root:d.id,chunks:o,proofs:n}}async function w6(a,o=0){if(a.length<2)return a[0];let f=[];for(let d=0;d<a.length;d+=2)f.push(await K0e(a[d],a[d+1]));return w6(f,o+1)}function Wz(a){let o=y_(a);return Array.isArray(o)?__(o):[o]}function y_(a,o=new Uint8Array,f=0){if(a.type=="leaf")return{offset:a.maxByteRange-1,proof:(0,Kz.concatBuffers)([o,a.dataHash,v1(a.maxByteRange)])};if(a.type=="branch"){let d=(0,Kz.concatBuffers)([o,a.leftChild.id,a.rightChild.id,v1(a.byteRange)]);return[y_(a.leftChild,d,f+1),y_(a.rightChild,d,f+1)]}throw new Error("Unexpected node type")}function __(a){let o=[];return a.forEach(f=>{Array.isArray(f)?o.push(...__(f)):o.push(f)}),o}async function K0e(a,o){return o?{type:"branch",id:await An([await An(a.id),await An(o.id),await An(v1(a.maxByteRange))]),byteRange:a.maxByteRange,maxByteRange:o.maxByteRange,leftChild:a,rightChild:o}:a}async function An(a){return Array.isArray(a)&&(a=y6.default.utils.concatBuffers(a)),new Uint8Array(await y6.default.crypto.hash(a))}function v1(a){let o=new Uint8Array(p1);for(var f=o.length-1;f>=0;f--){var d=a%256;o[f]=d,a=(a-d)/256}return o}function x_(a){let o=0;for(var f=0;f<a.length;f++)o*=256,o+=a[f];return o}var j0e=(a,o)=>a.every((f,d)=>o[d]===f);_i.arrayCompare=j0e;async function c1(a,o,f,d,n){if(d<=0)return!1;if(o>=d)return c1(a,0,d-1,d,n);if(o<0)return c1(a,0,0,d,n);if(n.length==ad+p1){let _=n.slice(0,ad),x=n.slice(_.length,_.length+p1),E=await An([await An(_),await An(x)]);return(0,_i.arrayCompare)(a,E)?{offset:d-1,leftBound:f,rightBound:d,chunkSize:d-f}:!1}let v=n.slice(0,ad),b=n.slice(v.length,v.length+ad),y=n.slice(v.length+b.length,v.length+b.length+p1),M=x_(y),w=n.slice(v.length+b.length+y.length),g=await An([await An(v),await An(b),await An(y)]);return(0,_i.arrayCompare)(a,g)?o<M?await c1(v,o,f,Math.min(d,M),w):await c1(b,o,Math.max(f,M),d,w):!1}async function Zz(a,o=""){if(a.byteLength<1)return o;let f=a.slice(0,ad),d=a.slice(f.length,f.length+ad),n=a.slice(f.length+d.length,f.length+d.length+p1),v=x_(n),b=a.slice(f.length+d.length+n.length),y=await An([await An(f),await An(d),await An(n)]),M=`${o}
|
|
4
4
|
${JSON.stringify(at.from(f))},${JSON.stringify(at.from(d))},${v} => ${JSON.stringify(y)}`;return Zz(b,M)}});var Yz=St(M6=>{"use strict";var N3e=Ae(Be());Ie();Re();Object.defineProperty(M6,"__esModule",{value:!0});M6.TransactionUploader=void 0;var Gz=m1(),W0e=Go(),E_=d1(),Z0e=S_(),Vz=1,G0e=["invalid_json","chunk_too_big","data_path_too_big","offset_too_big","data_size_too_big","chunk_proof_ratio_not_attractive","invalid_proof"],Jz=1e3*40,A_=class a{api;chunkIndex=0;txPosted=!1;transaction;lastRequestTimeEnd=0;totalErrors=0;data;lastResponseStatus=0;lastResponseError="";get isComplete(){return this.txPosted&&this.chunkIndex===this.transaction.chunks.chunks.length}get totalChunks(){return this.transaction.chunks.chunks.length}get uploadedChunks(){return this.chunkIndex}get pctComplete(){return Math.trunc(this.uploadedChunks/this.totalChunks*100)}constructor(o,f){if(this.api=o,!f.id)throw new Error("Transaction is not signed");if(!f.chunks)throw new Error("Transaction chunks not prepared");this.data=f.data,this.transaction=new Gz.default(Object.assign({},f,{data:new Uint8Array(0)}))}async uploadChunk(o){if(this.isComplete)throw new Error("Upload is already complete");if(this.lastResponseError!==""?this.totalErrors++:this.totalErrors=0,this.totalErrors===100)throw new Error(`Unable to complete upload: ${this.lastResponseStatus}: ${this.lastResponseError}`);let f=this.lastResponseError===""?0:Math.max(this.lastRequestTimeEnd+Jz-Date.now(),Jz);if(f>0&&(f=f-f*Math.random()*.3,await new Promise(b=>setTimeout(b,f))),this.lastResponseError="",!this.txPosted){await this.postTransaction();return}o&&(this.chunkIndex=o);let d=this.transaction.getChunk(o||this.chunkIndex,this.data);if(!await(0,Z0e.validatePath)(this.transaction.chunks.data_root,parseInt(d.offset),0,parseInt(d.data_size),W0e.b64UrlToBuffer(d.data_path)))throw new Error(`Unable to validate chunk ${this.chunkIndex}`);let v=await this.api.post("chunk",this.transaction.getChunk(this.chunkIndex,this.data)).catch(b=>(console.error(b.message),{status:-1,data:{error:b.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=v.status,this.lastResponseStatus==200)this.chunkIndex++;else if(this.lastResponseError=(0,E_.getError)(v),G0e.includes(this.lastResponseError))throw new Error(`Fatal error uploading chunk ${this.chunkIndex}: ${this.lastResponseError}`)}static async fromSerialized(o,f,d){if(!f||typeof f.chunkIndex!="number"||typeof f.transaction!="object")throw new Error("Serialized object does not match expected format.");var n=new Gz.default(f.transaction);n.chunks||await n.prepareChunks(d);let v=new a(o,n);if(v.chunkIndex=f.chunkIndex,v.lastRequestTimeEnd=f.lastRequestTimeEnd,v.lastResponseError=f.lastResponseError,v.lastResponseStatus=f.lastResponseStatus,v.txPosted=f.txPosted,v.data=d,v.transaction.data_root!==f.transaction.data_root)throw new Error("Data mismatch: Uploader doesn't match provided data.");return v}static async fromTransactionId(o,f){let d=await o.get(`tx/${f}`);if(d.status!==200)throw new Error(`Tx ${f} not found: ${d.status}`);let n=d.data;return n.data=new Uint8Array(0),{txPosted:!0,chunkIndex:0,lastResponseError:"",lastRequestTimeEnd:0,lastResponseStatus:0,transaction:n}}toJSON(){return{chunkIndex:this.chunkIndex,transaction:this.transaction,lastRequestTimeEnd:this.lastRequestTimeEnd,lastResponseStatus:this.lastResponseStatus,lastResponseError:this.lastResponseError,txPosted:this.txPosted}}async postTransaction(){if(this.totalChunks<=Vz){this.transaction.data=this.data;let d=await this.api.post("tx",this.transaction).catch(n=>(console.error(n),{status:-1,data:{error:n.message}}));if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=d.status,this.transaction.data=new Uint8Array(0),d.status>=200&&d.status<300){this.txPosted=!0,this.chunkIndex=Vz;return}throw this.lastResponseError=(0,E_.getError)(d),new Error(`Unable to upload transaction: ${d.status}, ${this.lastResponseError}`)}let f=await this.api.post("tx",this.transaction);if(this.lastRequestTimeEnd=Date.now(),this.lastResponseStatus=f.status,!(f.status>=200&&f.status<300))throw this.lastResponseError=(0,E_.getError)(f),new Error(`Unable to upload transaction: ${f.status}, ${this.lastResponseError}`);this.txPosted=!0}};M6.TransactionUploader=A_});var _6=St((D3e,Xz)=>{var O3e=Ae(Be());Ie();Re();Xz.exports={}});var Qz=St(T_=>{"use strict";var z3e=Ae(Be());Ie();Re();Object.defineProperty(T_,"__esModule",{value:!0});var B_=d1(),zf=m1(),g1=Go(),R_=Yz();_6();var I_=class{api;crypto;chunks;constructor(o,f,d){this.api=o,this.crypto=f,this.chunks=d}async getTransactionAnchor(){let o=await this.api.get("tx_anchor");if(!o.data.match(/^[a-z0-9_-]{43,}/i)||!o.ok)throw new Error(`Could not getTransactionAnchor. Received: ${o.data}. Status: ${o.status}, ${o.statusText}`);return o.data}async getPrice(o,f){let d=f?`price/${o}/${f}`:`price/${o}`,n=await this.api.get(d);if(!/^\d+$/.test(n.data)||!n.ok)throw new Error(`Could not getPrice. Received: ${n.data}. Status: ${n.status}, ${n.statusText}`);return n.data}async get(o){let f=await this.api.get(`tx/${o}`);if(f.status==200){let d=parseInt(f.data.data_size);if(f.data.format>=2&&d>0&&d<=1024*1024*12){let n=await this.getData(o);return new zf.default({...f.data,data:n})}return new zf.default({...f.data,format:f.data.format||1})}throw f.status==404?new B_.default("TX_NOT_FOUND"):f.status==410?new B_.default("TX_FAILED"):new B_.default("TX_INVALID")}fromRaw(o){return new zf.default(o)}async search(o,f){return this.api.post("arql",{op:"equals",expr1:o,expr2:f}).then(d=>d.data?d.data:[])}getStatus(o){return this.api.get(`tx/${o}/status`).then(f=>f.status==200?{status:200,confirmed:f.data}:{status:f.status,confirmed:null})}async getData(o,f){let d;try{d=await this.chunks.downloadChunkedData(o)}catch(n){console.error(`Error while trying to download chunked data for ${o}`),console.error(n)}if(!d){console.warn(`Falling back to gateway cache for ${o}`);try{let{data:n,ok:v,status:b,statusText:y}=await this.api.get(`/${o}`,{responseType:"arraybuffer"});if(!v)throw new Error("Bad http status code",{cause:{status:b,statusText:y}});d=n}catch(n){console.error(`Error while trying to download contiguous data from gateway cache for ${o}`),console.error(n)}}if(!d)throw new Error(`${o} data was not found!`);return f&&f.decode&&!f.string?d:f&&f.decode&&f.string?g1.bufferToString(d):g1.bufferTob64Url(d)}async sign(o,f,d){let v=typeof f=="object"&&(y=>{let M=!0;return["n","e","d","p","q","dp","dq","qi"].map(w=>!(w in y)&&(M=!1)),M})(f),b=typeof arweaveWallet=="object";if(!v&&!b)throw new Error("No valid JWK or external wallet found to sign transaction.");if(v){o.setOwner(f.n);let y=await o.getSignatureData(),M=await this.crypto.sign(f,y,d),w=await this.crypto.hash(M);o.setSignature({id:g1.bufferTob64Url(w),owner:f.n,signature:g1.bufferTob64Url(M)})}else if(b){try{(await arweaveWallet.getPermissions()).includes("SIGN_TRANSACTION")||await arweaveWallet.connect(["SIGN_TRANSACTION"])}catch{}let y=await arweaveWallet.sign(o,d);o.setSignature({id:y.id,owner:y.owner,reward:y.reward,tags:y.tags,signature:y.signature})}else throw new Error("An error occurred while signing. Check wallet is valid")}async verify(o){let f=await o.getSignatureData(),d=o.get("signature",{decode:!0,string:!1}),n=g1.bufferTob64Url(await this.crypto.hash(d));if(o.id!==n)throw new Error("Invalid transaction signature or ID! The transaction ID doesn't match the expected SHA-256 hash of the signature.");return this.crypto.verify(o.owner,f,d)}async post(o){if(typeof o=="string"?o=new zf.default(JSON.parse(o)):typeof o.readInt32BE=="function"?o=new zf.default(JSON.parse(o.toString())):typeof o=="object"&&!(o instanceof zf.default)&&(o=new zf.default(o)),!(o instanceof zf.default))throw new Error("Must be Transaction object");o.chunks||await o.prepareChunks(o.data);let f=await this.getUploader(o,o.data);try{for(;!f.isComplete;)await f.uploadChunk()}catch(d){if(f.lastResponseStatus>0)return{status:f.lastResponseStatus,statusText:f.lastResponseError,data:{error:f.lastResponseError}};throw d}return{status:200,statusText:"OK",data:{}}}async getUploader(o,f){let d;if(f instanceof ArrayBuffer&&(f=new Uint8Array(f)),o instanceof zf.default){if(f||(f=o.data),!(f instanceof Uint8Array))throw new Error("Data format is invalid");o.chunks||await o.prepareChunks(f),d=new R_.TransactionUploader(this.api,o),(!d.data||d.data.length===0)&&(d.data=f)}else{if(typeof o=="string"&&(o=await R_.TransactionUploader.fromTransactionId(this.api,o)),!f||!(f instanceof Uint8Array))throw new Error("Must provide data when resuming upload");d=await R_.TransactionUploader.fromSerialized(this.api,o,f)}return d}async*upload(o,f){let d=await this.getUploader(o,f);for(;!d.isComplete;)await d.uploadChunk(),yield d;return d}};T_.default=I_});var tH=St($_=>{"use strict";var W3e=Ae(Be());Ie();Re();Object.defineProperty($_,"__esModule",{value:!0});var eH=Go();_6();var k_=class{api;crypto;constructor(o,f){this.api=o,this.crypto=f}getBalance(o){return this.api.get(`wallet/${o}/balance`).then(f=>f.data)}getLastTransactionID(o){return this.api.get(`wallet/${o}/last_tx`).then(f=>f.data)}generate(){return this.crypto.generateJWK()}async jwkToAddress(o){return!o||o==="use_wallet"?this.getAddress():this.getAddress(o)}async getAddress(o){if(!o||o==="use_wallet"){try{await arweaveWallet.connect(["ACCESS_ADDRESS"])}catch{}return arweaveWallet.getActiveAddress()}else return this.ownerToAddress(o.n)}async ownerToAddress(o){return eH.bufferTob64Url(await this.crypto.hash(eH.b64UrlToBuffer(o)))}};$_.default=k_});var iH=St(y1=>{"use strict";var J3e=Ae(Be());Ie();Re();Object.defineProperty(y1,"__esModule",{value:!0});y1.SiloResource=void 0;var rH=Go(),P_=class{api;crypto;transactions;constructor(o,f,d){this.api=o,this.crypto=f,this.transactions=d}async get(o){if(!o)throw new Error("No Silo URI specified");let f=await this.parseUri(o),d=await this.transactions.search("Silo-Name",f.getAccessKey());if(d.length==0)throw new Error(`No data could be found for the Silo URI: ${o}`);let n=await this.transactions.get(d[0]);if(!n)throw new Error(`No data could be found for the Silo URI: ${o}`);let v=n.get("data",{decode:!0,string:!1});return this.crypto.decrypt(v,f.getEncryptionKey())}async readTransactionData(o,f){if(!f)throw new Error("No Silo URI specified");let d=await this.parseUri(f),n=o.get("data",{decode:!0,string:!1});return this.crypto.decrypt(n,d.getEncryptionKey())}async parseUri(o){let f=o.match(/^([a-z0-9-_]+)\.([0-9]+)/i);if(!f)throw new Error("Invalid Silo name, must be a name in the format of [a-z0-9]+.[0-9]+, e.g. 'bubble.7'");let d=f[1],n=Math.pow(2,parseInt(f[2])),v=await this.hash(rH.stringToBuffer(d),n),b=rH.bufferTob64(v.slice(0,15)),y=await this.hash(v.slice(16,31),1);return new x6(o,b,y)}async hash(o,f){let d=await this.crypto.hash(o);for(let n=0;n<f-1;n++)d=await this.crypto.hash(d);return d}};y1.default=P_;var x6=class{uri;accessKey;encryptionKey;constructor(o,f,d){this.uri=o,this.accessKey=f,this.encryptionKey=d}getUri(){return this.uri}getAccessKey(){return this.accessKey}getEncryptionKey(){return this.encryptionKey}};y1.SiloResource=x6});var aH=St(C_=>{"use strict";var eme=Ae(Be());Ie();Re();Object.defineProperty(C_,"__esModule",{value:!0});var nH=d1(),V0e=Go(),N_=class{api;constructor(o){this.api=o}async getTransactionOffset(o){let f=await this.api.get(`tx/${o}/offset`);if(f.status===200)return f.data;throw new Error(`Unable to get transaction offset: ${(0,nH.getError)(f)}`)}async getChunk(o){let f=await this.api.get(`chunk/${o}`);if(f.status===200)return f.data;throw new Error(`Unable to get chunk: ${(0,nH.getError)(f)}`)}async getChunkData(o){let f=await this.getChunk(o);return V0e.b64UrlToBuffer(f.chunk)}firstChunkOffset(o){return parseInt(o.offset)-parseInt(o.size)+1}async downloadChunkedData(o){let f=await this.getTransactionOffset(o),d=parseInt(f.size),v=parseInt(f.offset)-d+1,b=new Uint8Array(d),y=0;for(;y<d;){this.api.config.logging&&console.log(`[chunk] ${y}/${d}`);let M;try{M=await this.getChunkData(v+y)}catch{console.error(`[chunk] Failed to fetch chunk at offset ${v+y}`),console.error("[chunk] This could indicate that the chunk wasn't uploaded or hasn't yet seeded properly to a particular gateway/node")}if(M)b.set(M,y),y+=M.length;else throw new Error(`Couldn't complete data download at ${y}/${d}`)}return b}};C_.default=N_});var sH=St(D_=>{"use strict";var nme=Ae(Be());Ie();Re();Object.defineProperty(D_,"__esModule",{value:!0});var oH=d1();_6();var L_=class a{api;network;static HASH_ENDPOINT="block/hash/";static HEIGHT_ENDPOINT="block/height/";constructor(o,f){this.api=o,this.network=f}async get(o){let f=await this.api.get(`${a.HASH_ENDPOINT}${o}`);if(f.status===200)return f.data;throw f.status===404?new oH.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${f}`)}async getByHeight(o){let f=await this.api.get(`${a.HEIGHT_ENDPOINT}${o}`);if(f.status===200)return f.data;throw f.status===404?new oH.default("BLOCK_NOT_FOUND"):new Error(`Error while loading block data: ${f}`)}async getCurrent(){let{current:o}=await this.network.getInfo();return await this.get(o)}};D_.default=L_});var b1=St(q_=>{"use strict";var fme=Ae(Be());Ie();Re();Object.defineProperty(q_,"__esModule",{value:!0});var J0e=Fz(),Y0e=zz(),X0e=l_(),Q0e=Hz(),ehe=Qz(),the=tH(),fH=m1(),w1=Go(),rhe=iH(),ihe=aH(),nhe=sH(),O_=class a{api;wallets;transactions;network;blocks;ar;silo;chunks;static init;static crypto=new X0e.default;static utils=w1;constructor(o){this.api=new Y0e.default(o),this.wallets=new the.default(this.api,a.crypto),this.chunks=new ihe.default(this.api),this.transactions=new ehe.default(this.api,a.crypto,this.chunks),this.silo=new rhe.default(this.api,this.crypto,this.transactions),this.network=new Q0e.default(this.api),this.blocks=new nhe.default(this.api,this.network),this.ar=new J0e.default}get crypto(){return a.crypto}get utils(){return a.utils}getConfig(){return{api:this.api.getConfig(),crypto:null}}async createTransaction(o,f){let d={};if(Object.assign(d,o),!o.data&&!(o.target&&o.quantity))throw new Error("A new Arweave transaction must have a 'data' value, or 'target' and 'quantity' values.");if(o.owner==null&&f&&f!=="use_wallet"&&(d.owner=f.n),o.last_tx==null&&(d.last_tx=await this.transactions.getTransactionAnchor()),typeof o.data=="string"&&(o.data=w1.stringToBuffer(o.data)),o.data instanceof ArrayBuffer&&(o.data=new Uint8Array(o.data)),o.data&&!(o.data instanceof Uint8Array))throw new Error("Expected data to be a string, Uint8Array or ArrayBuffer");if(o.reward==null){let v=o.data?o.data.byteLength:0;d.reward=await this.transactions.getPrice(v,d.target)}d.data_root="",d.data_size=o.data?o.data.byteLength.toString():"0",d.data=o.data||new Uint8Array(0);let n=new fH.default(d);return await n.getSignatureData(),n}async createSiloTransaction(o,f,d){let n={};if(Object.assign(n,o),!o.data)throw new Error("Silo transactions must have a 'data' value");if(!d)throw new Error("No Silo URI specified.");if(o.target||o.quantity)throw new Error("Silo transactions can only be used for storing data, sending AR to other wallets isn't supported.");if(o.owner==null){if(!f||!f.n)throw new Error("A new Arweave transaction must either have an 'owner' attribute, or you must provide the jwk parameter.");n.owner=f.n}o.last_tx==null&&(n.last_tx=await this.transactions.getTransactionAnchor());let v=await this.silo.parseUri(d);if(typeof o.data=="string"){let y=await this.crypto.encrypt(w1.stringToBuffer(o.data),v.getEncryptionKey());n.reward=await this.transactions.getPrice(y.byteLength),n.data=w1.bufferTob64Url(y)}if(o.data instanceof Uint8Array){let y=await this.crypto.encrypt(o.data,v.getEncryptionKey());n.reward=await this.transactions.getPrice(y.byteLength),n.data=w1.bufferTob64Url(y)}let b=new fH.default(n);return b.addTag("Silo-Name",v.getAccessKey()),b.addTag("Silo-Version","0.1.0"),b}arql(o){return this.api.post("/arql",o).then(f=>f.data||[])}};q_.default=O_});var lH=St(U_=>{"use strict";var dme=Ae(Be());Ie();Re();Object.defineProperty(U_,"__esModule",{value:!0});U_.default=hH;var qa=b1();async function hH(a){if(Array.isArray(a)){let d=qa.default.utils.concatBuffers([qa.default.utils.stringToBuffer("list"),qa.default.utils.stringToBuffer(a.length.toString())]);return await uH(a,await qa.default.crypto.hash(d,"SHA-384"))}let o=qa.default.utils.concatBuffers([qa.default.utils.stringToBuffer("blob"),qa.default.utils.stringToBuffer(a.byteLength.toString())]),f=qa.default.utils.concatBuffers([await qa.default.crypto.hash(o,"SHA-384"),await qa.default.crypto.hash(a,"SHA-384")]);return await qa.default.crypto.hash(f,"SHA-384")}async function uH(a,o){if(a.length<1)return o;let f=qa.default.utils.concatBuffers([o,await hH(a[0])]),d=await qa.default.crypto.hash(f,"SHA-384");return await uH(a.slice(1),d)}});var m1=St(_1=>{"use strict";var bme=Ae(Be());Ie();Re();Object.defineProperty(_1,"__esModule",{value:!0});_1.Tag=void 0;var vn=Go(),ahe=lH(),ohe=S_(),S6=class{get(o,f){if(!Object.getOwnPropertyNames(this).includes(o))throw new Error(`Field "${o}" is not a property of the Arweave Transaction class.`);if(this[o]instanceof Uint8Array)return f&&f.decode&&f.string?vn.bufferToString(this[o]):f&&f.decode&&!f.string?this[o]:vn.bufferTob64Url(this[o]);if(this[o]instanceof Array){if(f?.decode!==void 0||f?.string!==void 0)throw o==="tags"&&console.warn(`Did you mean to use 'transaction["tags"]' ?`),new Error("Cannot decode or stringify an array.");return this[o]}return f&&f.decode==!0?f&&f.string?vn.b64UrlToString(this[o]):vn.b64UrlToBuffer(this[o]):this[o]}},M1=class extends S6{name;value;constructor(o,f,d=!1){super(),this.name=o,this.value=f}};_1.Tag=M1;var F_=class extends S6{format=2;id="";last_tx="";owner="";tags=[];target="";quantity="0";data_size="0";data=new Uint8Array;data_root="";reward="0";signature="";chunks;constructor(o={}){super(),Object.assign(this,o),typeof this.data=="string"&&(this.data=vn.b64UrlToBuffer(this.data)),o.tags&&(this.tags=o.tags.map(f=>new M1(f.name,f.value)))}addTag(o,f){this.tags.push(new M1(vn.stringToB64Url(o),vn.stringToB64Url(f)))}toJSON(){return{format:this.format,id:this.id,last_tx:this.last_tx,owner:this.owner,tags:this.tags,target:this.target,quantity:this.quantity,data:vn.bufferTob64Url(this.data),data_size:this.data_size,data_root:this.data_root,data_tree:this.data_tree,reward:this.reward,signature:this.signature}}setOwner(o){this.owner=o}setSignature({id:o,owner:f,reward:d,tags:n,signature:v}){this.id=o,this.owner=f,d&&(this.reward=d),n&&(this.tags=n),this.signature=v}async prepareChunks(o){!this.chunks&&o.byteLength>0&&(this.chunks=await(0,ohe.generateTransactionChunks)(o),this.data_root=vn.bufferTob64Url(this.chunks.data_root)),!this.chunks&&o.byteLength===0&&(this.chunks={chunks:[],data_root:new Uint8Array,proofs:[]},this.data_root="")}getChunk(o,f){if(!this.chunks)throw new Error("Chunks have not been prepared");let d=this.chunks.proofs[o],n=this.chunks.chunks[o];return{data_root:this.data_root,data_size:this.data_size,data_path:vn.bufferTob64Url(d.proof),offset:d.offset.toString(),chunk:vn.bufferTob64Url(f.slice(n.minByteRange,n.maxByteRange))}}async getSignatureData(){switch(this.format){case 1:let o=this.tags.reduce((d,n)=>vn.concatBuffers([d,n.get("name",{decode:!0,string:!1}),n.get("value",{decode:!0,string:!1})]),new Uint8Array);return vn.concatBuffers([this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),this.get("data",{decode:!0,string:!1}),vn.stringToBuffer(this.quantity),vn.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),o]);case 2:this.data_root||await this.prepareChunks(this.data);let f=this.tags.map(d=>[d.get("name",{decode:!0,string:!1}),d.get("value",{decode:!0,string:!1})]);return await(0,ahe.default)([vn.stringToBuffer(this.format.toString()),this.get("owner",{decode:!0,string:!1}),this.get("target",{decode:!0,string:!1}),vn.stringToBuffer(this.quantity),vn.stringToBuffer(this.reward),this.get("last_tx",{decode:!0,string:!1}),f,vn.stringToBuffer(this.data_size),this.get("data_root",{decode:!0,string:!1})]);default:throw new Error(`Unexpected transaction format: ${this.format}`)}}};_1.default=F_});var dH=St(E6=>{"use strict";var wme=Ae(Be());Ie();Re();Object.defineProperty(E6,"__esModule",{value:!0});E6.getDefaultConfig=void 0;var she=(a,o)=>{let f=/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/,d=o.split("."),n=d[d.length-1],v=["localhost","[::1]"];return v.includes(o)||a=="file"||v.includes(n)||!!o.match(f)||!!n.match(f)},fhe=a=>{let o=a.charAt(0)==="[",f=/^(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])$/;return!!a.match(f)||o},hhe=(a,o)=>{if(she(a,o))return{protocol:"https",host:"arweave.net",port:443};if(!fhe(o)){let f=o.split(".");if(f.length>=3){f.shift();let d=f.join(".");return{protocol:a,host:d}}}return{protocol:a,host:o}};E6.getDefaultConfig=hhe});var cH=St(X0=>{"use strict";var Sme=Ae(Be());Ie();Re();var uhe=X0&&X0.__createBinding||(Object.create?function(a,o,f,d){d===void 0&&(d=f);var n=Object.getOwnPropertyDescriptor(o,f);(!n||("get"in n?!o.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return o[f]}}),Object.defineProperty(a,d,n)}:function(a,o,f,d){d===void 0&&(d=f),a[d]=o[f]}),lhe=X0&&X0.__exportStar||function(a,o){for(var f in a)f!=="default"&&!Object.prototype.hasOwnProperty.call(o,f)&&uhe(o,a,f)};Object.defineProperty(X0,"__esModule",{value:!0});var od=b1(),dhe=dH();od.default.init=function(a={}){let o={host:"arweave.net",port:443,protocol:"https"};if(typeof location!="object"||!location.protocol||!location.hostname)return new od.default({...a,...o});let f=location.protocol.replace(":",""),d=location.hostname,n=location.port?parseInt(location.port):f=="https"?443:80,v=(0,dhe.getDefaultConfig)(f,d),b=a.protocol||v.protocol,y=a.host||v.host,M=a.port||v.port||n;return new od.default({...a,host:y,protocol:b,port:M})};typeof globalThis=="object"?globalThis.Arweave=od.default:typeof self=="object"&&(self.Arweave=od.default);lhe(b1(),X0);X0.default=od.default});var R6=St((qme,mH)=>{var Ume=Ae(Be());Ie();Re();mH.exports={}});var H_=St((gH,z_)=>{var Hme=Ae(Be());Ie();Re();(function(a,o){"use strict";function f(p,e){if(!p)throw new Error(e||"Assertion failed")}function d(p,e){p.super_=e;var r=function(){};r.prototype=e.prototype,p.prototype=new r,p.prototype.constructor=p}function n(p,e,r){if(n.isBN(p))return p;this.negative=0,this.words=null,this.length=0,this.red=null,p!==null&&((e==="le"||e==="be")&&(r=e,e=10),this._init(p||0,e||10,r||"be"))}typeof a=="object"?a.exports=n:o.BN=n,n.BN=n,n.wordSize=26;var v;try{typeof window<"u"&&typeof window.Buffer<"u"?v=window.Buffer:v=R6().Buffer}catch{}n.isBN=function(e){return e instanceof n?!0:e!==null&&typeof e=="object"&&e.constructor.wordSize===n.wordSize&&Array.isArray(e.words)},n.max=function(e,r){return e.cmp(r)>0?e:r},n.min=function(e,r){return e.cmp(r)<0?e:r},n.prototype._init=function(e,r,i){if(typeof e=="number")return this._initNumber(e,r,i);if(typeof e=="object")return this._initArray(e,r,i);r==="hex"&&(r=16),f(r===(r|0)&&r>=2&&r<=36),e=e.toString().replace(/\s+/g,"");var s=0;e[0]==="-"&&(s++,this.negative=1),s<e.length&&(r===16?this._parseHex(e,s,i):(this._parseBase(e,r,s),i==="le"&&this._initArray(this.toArray(),r,i)))},n.prototype._initNumber=function(e,r,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(f(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),i==="le"&&this._initArray(this.toArray(),r,i)},n.prototype._initArray=function(e,r,i){if(f(typeof e.length=="number"),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var h,c,m=0;if(i==="be")for(s=e.length-1,h=0;s>=0;s-=3)c=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[h]|=c<<m&67108863,this.words[h+1]=c>>>26-m&67108863,m+=24,m>=26&&(m-=26,h++);else if(i==="le")for(s=0,h=0;s<e.length;s+=3)c=e[s]|e[s+1]<<8|e[s+2]<<16,this.words[h]|=c<<m&67108863,this.words[h+1]=c>>>26-m&67108863,m+=24,m>=26&&(m-=26,h++);return this.strip()};function b(p,e){var r=p.charCodeAt(e);return r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:r-48&15}function y(p,e,r){var i=b(p,r);return r-1>=e&&(i|=b(p,r-1)<<4),i}n.prototype._parseHex=function(e,r,i){this.length=Math.ceil((e.length-r)/6),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var h=0,c=0,m;if(i==="be")for(s=e.length-1;s>=r;s-=2)m=y(e,r,s)<<h,this.words[c]|=m&67108863,h>=18?(h-=18,c+=1,this.words[c]|=m>>>26):h+=8;else{var l=e.length-r;for(s=l%2===0?r+1:r;s<e.length;s+=2)m=y(e,r,s)<<h,this.words[c]|=m&67108863,h>=18?(h-=18,c+=1,this.words[c]|=m>>>26):h+=8}this.strip()};function M(p,e,r,i){for(var s=0,h=Math.min(p.length,r),c=e;c<h;c++){var m=p.charCodeAt(c)-48;s*=i,m>=49?s+=m-49+10:m>=17?s+=m-17+10:s+=m}return s}n.prototype._parseBase=function(e,r,i){this.words=[0],this.length=1;for(var s=0,h=1;h<=67108863;h*=r)s++;s--,h=h/r|0;for(var c=e.length-i,m=c%s,l=Math.min(c,c-m)+i,t=0,u=i;u<l;u+=s)t=M(e,u,u+s,r),this.imuln(h),this.words[0]+t<67108864?this.words[0]+=t:this._iaddn(t);if(m!==0){var S=1;for(t=M(e,u,e.length,r),u=0;u<m;u++)S*=r;this.imuln(S),this.words[0]+t<67108864?this.words[0]+=t:this._iaddn(t)}this.strip()},n.prototype.copy=function(e){e.words=new Array(this.length);for(var r=0;r<this.length;r++)e.words[r]=this.words[r];e.length=this.length,e.negative=this.negative,e.red=this.red},n.prototype.clone=function(){var e=new n(null);return this.copy(e),e},n.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},n.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},n.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},n.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var w=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],g=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],_=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];n.prototype.toString=function(e,r){e=e||10,r=r|0||1;var i;if(e===16||e==="hex"){i="";for(var s=0,h=0,c=0;c<this.length;c++){var m=this.words[c],l=((m<<s|h)&16777215).toString(16);h=m>>>24-s&16777215,s+=2,s>=26&&(s-=26,c--),h!==0||c!==this.length-1?i=w[6-l.length]+l+i:i=l+i}for(h!==0&&(i=h.toString(16)+i);i.length%r!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}if(e===(e|0)&&e>=2&&e<=36){var t=g[e],u=_[e];i="";var S=this.clone();for(S.negative=0;!S.isZero();){var B=S.modn(u).toString(e);S=S.idivn(u),S.isZero()?i=B+i:i=w[t-B.length]+B+i}for(this.isZero()&&(i="0"+i);i.length%r!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}f(!1,"Base should be between 2 and 36")},n.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&f(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-e:e},n.prototype.toJSON=function(){return this.toString(16)},n.prototype.toBuffer=function(e,r){return f(typeof v<"u"),this.toArrayLike(v,e,r)},n.prototype.toArray=function(e,r){return this.toArrayLike(Array,e,r)},n.prototype.toArrayLike=function(e,r,i){var s=this.byteLength(),h=i||Math.max(1,s);f(s<=h,"byte array longer than desired length"),f(h>0,"Requested array length <= 0"),this.strip();var c=r==="le",m=new e(h),l,t,u=this.clone();if(c){for(t=0;!u.isZero();t++)l=u.andln(255),u.iushrn(8),m[t]=l;for(;t<h;t++)m[t]=0}else{for(t=0;t<h-s;t++)m[t]=0;for(t=0;!u.isZero();t++)l=u.andln(255),u.iushrn(8),m[h-t-1]=l}return m},Math.clz32?n.prototype._countBits=function(e){return 32-Math.clz32(e)}:n.prototype._countBits=function(e){var r=e,i=0;return r>=4096&&(i+=13,r>>>=13),r>=64&&(i+=7,r>>>=7),r>=8&&(i+=4,r>>>=4),r>=2&&(i+=2,r>>>=2),i+r},n.prototype._zeroBits=function(e){if(e===0)return 26;var r=e,i=0;return r&8191||(i+=13,r>>>=13),r&127||(i+=7,r>>>=7),r&15||(i+=4,r>>>=4),r&3||(i+=2,r>>>=2),r&1||i++,i},n.prototype.bitLength=function(){var e=this.words[this.length-1],r=this._countBits(e);return(this.length-1)*26+r};function x(p){for(var e=new Array(p.bitLength()),r=0;r<e.length;r++){var i=r/26|0,s=r%26;e[r]=(p.words[i]&1<<s)>>>s}return e}n.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,r=0;r<this.length;r++){var i=this._zeroBits(this.words[r]);if(e+=i,i!==26)break}return e},n.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},n.prototype.toTwos=function(e){return this.negative!==0?this.abs().inotn(e).iaddn(1):this.clone()},n.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},n.prototype.isNeg=function(){return this.negative!==0},n.prototype.neg=function(){return this.clone().ineg()},n.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},n.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var r=0;r<e.length;r++)this.words[r]=this.words[r]|e.words[r];return this.strip()},n.prototype.ior=function(e){return f((this.negative|e.negative)===0),this.iuor(e)},n.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},n.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},n.prototype.iuand=function(e){var r;this.length>e.length?r=e:r=this;for(var i=0;i<r.length;i++)this.words[i]=this.words[i]&e.words[i];return this.length=r.length,this.strip()},n.prototype.iand=function(e){return f((this.negative|e.negative)===0),this.iuand(e)},n.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},n.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},n.prototype.iuxor=function(e){var r,i;this.length>e.length?(r=this,i=e):(r=e,i=this);for(var s=0;s<i.length;s++)this.words[s]=r.words[s]^i.words[s];if(this!==r)for(;s<r.length;s++)this.words[s]=r.words[s];return this.length=r.length,this.strip()},n.prototype.ixor=function(e){return f((this.negative|e.negative)===0),this.iuxor(e)},n.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},n.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},n.prototype.inotn=function(e){f(typeof e=="number"&&e>=0);var r=Math.ceil(e/26)|0,i=e%26;this._expand(r),i>0&&r--;for(var s=0;s<r;s++)this.words[s]=~this.words[s]&67108863;return i>0&&(this.words[s]=~this.words[s]&67108863>>26-i),this.strip()},n.prototype.notn=function(e){return this.clone().inotn(e)},n.prototype.setn=function(e,r){f(typeof e=="number"&&e>=0);var i=e/26|0,s=e%26;return this._expand(i+1),r?this.words[i]=this.words[i]|1<<s:this.words[i]=this.words[i]&~(1<<s),this.strip()},n.prototype.iadd=function(e){var r;if(this.negative!==0&&e.negative===0)return this.negative=0,r=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,r=this.isub(e),e.negative=1,r._normSign();var i,s;this.length>e.length?(i=this,s=e):(i=e,s=this);for(var h=0,c=0;c<s.length;c++)r=(i.words[c]|0)+(s.words[c]|0)+h,this.words[c]=r&67108863,h=r>>>26;for(;h!==0&&c<i.length;c++)r=(i.words[c]|0)+h,this.words[c]=r&67108863,h=r>>>26;if(this.length=i.length,h!==0)this.words[this.length]=h,this.length++;else if(i!==this)for(;c<i.length;c++)this.words[c]=i.words[c];return this},n.prototype.add=function(e){var r;return e.negative!==0&&this.negative===0?(e.negative=0,r=this.sub(e),e.negative^=1,r):e.negative===0&&this.negative!==0?(this.negative=0,r=e.sub(this),this.negative=1,r):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},n.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var r=this.iadd(e);return e.negative=1,r._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(i===0)return this.negative=0,this.length=1,this.words[0]=0,this;var s,h;i>0?(s=this,h=e):(s=e,h=this);for(var c=0,m=0;m<h.length;m++)r=(s.words[m]|0)-(h.words[m]|0)+c,c=r>>26,this.words[m]=r&67108863;for(;c!==0&&m<s.length;m++)r=(s.words[m]|0)+c,c=r>>26,this.words[m]=r&67108863;if(c===0&&m<s.length&&s!==this)for(;m<s.length;m++)this.words[m]=s.words[m];return this.length=Math.max(this.length,m),s!==this&&(this.negative=1),this.strip()},n.prototype.sub=function(e){return this.clone().isub(e)};function E(p,e,r){r.negative=e.negative^p.negative;var i=p.length+e.length|0;r.length=i,i=i-1|0;var s=p.words[0]|0,h=e.words[0]|0,c=s*h,m=c&67108863,l=c/67108864|0;r.words[0]=m;for(var t=1;t<i;t++){for(var u=l>>>26,S=l&67108863,B=Math.min(t,e.length-1),k=Math.max(0,t-p.length+1);k<=B;k++){var q=t-k|0;s=p.words[q]|0,h=e.words[k]|0,c=s*h+S,u+=c/67108864|0,S=c&67108863}r.words[t]=S|0,l=u|0}return l!==0?r.words[t]=l|0:r.length--,r.strip()}var R=function(e,r,i){var s=e.words,h=r.words,c=i.words,m=0,l,t,u,S=s[0]|0,B=S&8191,k=S>>>13,q=s[1]|0,F=q&8191,ee=q>>>13,te=s[2]|0,O=te&8191,U=te>>>13,oe=s[3]|0,Y=oe&8191,j=oe>>>13,V=s[4]|0,G=V&8191,ie=V>>>13,me=s[5]|0,re=me&8191,ae=me>>>13,ye=s[6]|0,fe=ye&8191,he=ye>>>13,nt=s[7]|0,ce=nt&8191,be=nt>>>13,ut=s[8]|0,$=ut&8191,A=ut>>>13,I=s[9]|0,C=I&8191,H=I>>>13,ne=h[0]|0,J=ne&8191,de=ne>>>13,st=h[1]|0,le=st&8191,ve=st>>>13,ot=h[2]|0,we=ot&8191,Le=ot>>>13,bt=h[3]|0,Me=bt&8191,Ne=bt>>>13,mt=h[4]|0,xe=mt&8191,Ce=mt>>>13,vt=h[5]|0,se=vt&8191,ue=vt>>>13,ht=h[6]|0,pe=ht&8191,Se=ht>>>13,dt=h[7]|0,ge=dt&8191,De=dt>>>13,ct=h[8]|0,_e=ct&8191,Oe=ct>>>13,gt=h[9]|0,Ee=gt&8191,Pe=gt>>>13;i.negative=e.negative^r.negative,i.length=19,l=Math.imul(B,J),t=Math.imul(B,de),t=t+Math.imul(k,J)|0,u=Math.imul(k,de);var pt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(pt>>>26)|0,pt&=67108863,l=Math.imul(F,J),t=Math.imul(F,de),t=t+Math.imul(ee,J)|0,u=Math.imul(ee,de),l=l+Math.imul(B,le)|0,t=t+Math.imul(B,ve)|0,t=t+Math.imul(k,le)|0,u=u+Math.imul(k,ve)|0;var lt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(lt>>>26)|0,lt&=67108863,l=Math.imul(O,J),t=Math.imul(O,de),t=t+Math.imul(U,J)|0,u=Math.imul(U,de),l=l+Math.imul(F,le)|0,t=t+Math.imul(F,ve)|0,t=t+Math.imul(ee,le)|0,u=u+Math.imul(ee,ve)|0,l=l+Math.imul(B,we)|0,t=t+Math.imul(B,Le)|0,t=t+Math.imul(k,we)|0,u=u+Math.imul(k,Le)|0;var yt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(yt>>>26)|0,yt&=67108863,l=Math.imul(Y,J),t=Math.imul(Y,de),t=t+Math.imul(j,J)|0,u=Math.imul(j,de),l=l+Math.imul(O,le)|0,t=t+Math.imul(O,ve)|0,t=t+Math.imul(U,le)|0,u=u+Math.imul(U,ve)|0,l=l+Math.imul(F,we)|0,t=t+Math.imul(F,Le)|0,t=t+Math.imul(ee,we)|0,u=u+Math.imul(ee,Le)|0,l=l+Math.imul(B,Me)|0,t=t+Math.imul(B,Ne)|0,t=t+Math.imul(k,Me)|0,u=u+Math.imul(k,Ne)|0;var xt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(xt>>>26)|0,xt&=67108863,l=Math.imul(G,J),t=Math.imul(G,de),t=t+Math.imul(ie,J)|0,u=Math.imul(ie,de),l=l+Math.imul(Y,le)|0,t=t+Math.imul(Y,ve)|0,t=t+Math.imul(j,le)|0,u=u+Math.imul(j,ve)|0,l=l+Math.imul(O,we)|0,t=t+Math.imul(O,Le)|0,t=t+Math.imul(U,we)|0,u=u+Math.imul(U,Le)|0,l=l+Math.imul(F,Me)|0,t=t+Math.imul(F,Ne)|0,t=t+Math.imul(ee,Me)|0,u=u+Math.imul(ee,Ne)|0,l=l+Math.imul(B,xe)|0,t=t+Math.imul(B,Ce)|0,t=t+Math.imul(k,xe)|0,u=u+Math.imul(k,Ce)|0;var Mt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Mt>>>26)|0,Mt&=67108863,l=Math.imul(re,J),t=Math.imul(re,de),t=t+Math.imul(ae,J)|0,u=Math.imul(ae,de),l=l+Math.imul(G,le)|0,t=t+Math.imul(G,ve)|0,t=t+Math.imul(ie,le)|0,u=u+Math.imul(ie,ve)|0,l=l+Math.imul(Y,we)|0,t=t+Math.imul(Y,Le)|0,t=t+Math.imul(j,we)|0,u=u+Math.imul(j,Le)|0,l=l+Math.imul(O,Me)|0,t=t+Math.imul(O,Ne)|0,t=t+Math.imul(U,Me)|0,u=u+Math.imul(U,Ne)|0,l=l+Math.imul(F,xe)|0,t=t+Math.imul(F,Ce)|0,t=t+Math.imul(ee,xe)|0,u=u+Math.imul(ee,Ce)|0,l=l+Math.imul(B,se)|0,t=t+Math.imul(B,ue)|0,t=t+Math.imul(k,se)|0,u=u+Math.imul(k,ue)|0;var Et=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Et>>>26)|0,Et&=67108863,l=Math.imul(fe,J),t=Math.imul(fe,de),t=t+Math.imul(he,J)|0,u=Math.imul(he,de),l=l+Math.imul(re,le)|0,t=t+Math.imul(re,ve)|0,t=t+Math.imul(ae,le)|0,u=u+Math.imul(ae,ve)|0,l=l+Math.imul(G,we)|0,t=t+Math.imul(G,Le)|0,t=t+Math.imul(ie,we)|0,u=u+Math.imul(ie,Le)|0,l=l+Math.imul(Y,Me)|0,t=t+Math.imul(Y,Ne)|0,t=t+Math.imul(j,Me)|0,u=u+Math.imul(j,Ne)|0,l=l+Math.imul(O,xe)|0,t=t+Math.imul(O,Ce)|0,t=t+Math.imul(U,xe)|0,u=u+Math.imul(U,Ce)|0,l=l+Math.imul(F,se)|0,t=t+Math.imul(F,ue)|0,t=t+Math.imul(ee,se)|0,u=u+Math.imul(ee,ue)|0,l=l+Math.imul(B,pe)|0,t=t+Math.imul(B,Se)|0,t=t+Math.imul(k,pe)|0,u=u+Math.imul(k,Se)|0;var At=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(At>>>26)|0,At&=67108863,l=Math.imul(ce,J),t=Math.imul(ce,de),t=t+Math.imul(be,J)|0,u=Math.imul(be,de),l=l+Math.imul(fe,le)|0,t=t+Math.imul(fe,ve)|0,t=t+Math.imul(he,le)|0,u=u+Math.imul(he,ve)|0,l=l+Math.imul(re,we)|0,t=t+Math.imul(re,Le)|0,t=t+Math.imul(ae,we)|0,u=u+Math.imul(ae,Le)|0,l=l+Math.imul(G,Me)|0,t=t+Math.imul(G,Ne)|0,t=t+Math.imul(ie,Me)|0,u=u+Math.imul(ie,Ne)|0,l=l+Math.imul(Y,xe)|0,t=t+Math.imul(Y,Ce)|0,t=t+Math.imul(j,xe)|0,u=u+Math.imul(j,Ce)|0,l=l+Math.imul(O,se)|0,t=t+Math.imul(O,ue)|0,t=t+Math.imul(U,se)|0,u=u+Math.imul(U,ue)|0,l=l+Math.imul(F,pe)|0,t=t+Math.imul(F,Se)|0,t=t+Math.imul(ee,pe)|0,u=u+Math.imul(ee,Se)|0,l=l+Math.imul(B,ge)|0,t=t+Math.imul(B,De)|0,t=t+Math.imul(k,ge)|0,u=u+Math.imul(k,De)|0;var Bt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,l=Math.imul($,J),t=Math.imul($,de),t=t+Math.imul(A,J)|0,u=Math.imul(A,de),l=l+Math.imul(ce,le)|0,t=t+Math.imul(ce,ve)|0,t=t+Math.imul(be,le)|0,u=u+Math.imul(be,ve)|0,l=l+Math.imul(fe,we)|0,t=t+Math.imul(fe,Le)|0,t=t+Math.imul(he,we)|0,u=u+Math.imul(he,Le)|0,l=l+Math.imul(re,Me)|0,t=t+Math.imul(re,Ne)|0,t=t+Math.imul(ae,Me)|0,u=u+Math.imul(ae,Ne)|0,l=l+Math.imul(G,xe)|0,t=t+Math.imul(G,Ce)|0,t=t+Math.imul(ie,xe)|0,u=u+Math.imul(ie,Ce)|0,l=l+Math.imul(Y,se)|0,t=t+Math.imul(Y,ue)|0,t=t+Math.imul(j,se)|0,u=u+Math.imul(j,ue)|0,l=l+Math.imul(O,pe)|0,t=t+Math.imul(O,Se)|0,t=t+Math.imul(U,pe)|0,u=u+Math.imul(U,Se)|0,l=l+Math.imul(F,ge)|0,t=t+Math.imul(F,De)|0,t=t+Math.imul(ee,ge)|0,u=u+Math.imul(ee,De)|0,l=l+Math.imul(B,_e)|0,t=t+Math.imul(B,Oe)|0,t=t+Math.imul(k,_e)|0,u=u+Math.imul(k,Oe)|0;var It=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(It>>>26)|0,It&=67108863,l=Math.imul(C,J),t=Math.imul(C,de),t=t+Math.imul(H,J)|0,u=Math.imul(H,de),l=l+Math.imul($,le)|0,t=t+Math.imul($,ve)|0,t=t+Math.imul(A,le)|0,u=u+Math.imul(A,ve)|0,l=l+Math.imul(ce,we)|0,t=t+Math.imul(ce,Le)|0,t=t+Math.imul(be,we)|0,u=u+Math.imul(be,Le)|0,l=l+Math.imul(fe,Me)|0,t=t+Math.imul(fe,Ne)|0,t=t+Math.imul(he,Me)|0,u=u+Math.imul(he,Ne)|0,l=l+Math.imul(re,xe)|0,t=t+Math.imul(re,Ce)|0,t=t+Math.imul(ae,xe)|0,u=u+Math.imul(ae,Ce)|0,l=l+Math.imul(G,se)|0,t=t+Math.imul(G,ue)|0,t=t+Math.imul(ie,se)|0,u=u+Math.imul(ie,ue)|0,l=l+Math.imul(Y,pe)|0,t=t+Math.imul(Y,Se)|0,t=t+Math.imul(j,pe)|0,u=u+Math.imul(j,Se)|0,l=l+Math.imul(O,ge)|0,t=t+Math.imul(O,De)|0,t=t+Math.imul(U,ge)|0,u=u+Math.imul(U,De)|0,l=l+Math.imul(F,_e)|0,t=t+Math.imul(F,Oe)|0,t=t+Math.imul(ee,_e)|0,u=u+Math.imul(ee,Oe)|0,l=l+Math.imul(B,Ee)|0,t=t+Math.imul(B,Pe)|0,t=t+Math.imul(k,Ee)|0,u=u+Math.imul(k,Pe)|0;var Tt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Tt>>>26)|0,Tt&=67108863,l=Math.imul(C,le),t=Math.imul(C,ve),t=t+Math.imul(H,le)|0,u=Math.imul(H,ve),l=l+Math.imul($,we)|0,t=t+Math.imul($,Le)|0,t=t+Math.imul(A,we)|0,u=u+Math.imul(A,Le)|0,l=l+Math.imul(ce,Me)|0,t=t+Math.imul(ce,Ne)|0,t=t+Math.imul(be,Me)|0,u=u+Math.imul(be,Ne)|0,l=l+Math.imul(fe,xe)|0,t=t+Math.imul(fe,Ce)|0,t=t+Math.imul(he,xe)|0,u=u+Math.imul(he,Ce)|0,l=l+Math.imul(re,se)|0,t=t+Math.imul(re,ue)|0,t=t+Math.imul(ae,se)|0,u=u+Math.imul(ae,ue)|0,l=l+Math.imul(G,pe)|0,t=t+Math.imul(G,Se)|0,t=t+Math.imul(ie,pe)|0,u=u+Math.imul(ie,Se)|0,l=l+Math.imul(Y,ge)|0,t=t+Math.imul(Y,De)|0,t=t+Math.imul(j,ge)|0,u=u+Math.imul(j,De)|0,l=l+Math.imul(O,_e)|0,t=t+Math.imul(O,Oe)|0,t=t+Math.imul(U,_e)|0,u=u+Math.imul(U,Oe)|0,l=l+Math.imul(F,Ee)|0,t=t+Math.imul(F,Pe)|0,t=t+Math.imul(ee,Ee)|0,u=u+Math.imul(ee,Pe)|0;var kt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(kt>>>26)|0,kt&=67108863,l=Math.imul(C,we),t=Math.imul(C,Le),t=t+Math.imul(H,we)|0,u=Math.imul(H,Le),l=l+Math.imul($,Me)|0,t=t+Math.imul($,Ne)|0,t=t+Math.imul(A,Me)|0,u=u+Math.imul(A,Ne)|0,l=l+Math.imul(ce,xe)|0,t=t+Math.imul(ce,Ce)|0,t=t+Math.imul(be,xe)|0,u=u+Math.imul(be,Ce)|0,l=l+Math.imul(fe,se)|0,t=t+Math.imul(fe,ue)|0,t=t+Math.imul(he,se)|0,u=u+Math.imul(he,ue)|0,l=l+Math.imul(re,pe)|0,t=t+Math.imul(re,Se)|0,t=t+Math.imul(ae,pe)|0,u=u+Math.imul(ae,Se)|0,l=l+Math.imul(G,ge)|0,t=t+Math.imul(G,De)|0,t=t+Math.imul(ie,ge)|0,u=u+Math.imul(ie,De)|0,l=l+Math.imul(Y,_e)|0,t=t+Math.imul(Y,Oe)|0,t=t+Math.imul(j,_e)|0,u=u+Math.imul(j,Oe)|0,l=l+Math.imul(O,Ee)|0,t=t+Math.imul(O,Pe)|0,t=t+Math.imul(U,Ee)|0,u=u+Math.imul(U,Pe)|0;var $t=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+($t>>>26)|0,$t&=67108863,l=Math.imul(C,Me),t=Math.imul(C,Ne),t=t+Math.imul(H,Me)|0,u=Math.imul(H,Ne),l=l+Math.imul($,xe)|0,t=t+Math.imul($,Ce)|0,t=t+Math.imul(A,xe)|0,u=u+Math.imul(A,Ce)|0,l=l+Math.imul(ce,se)|0,t=t+Math.imul(ce,ue)|0,t=t+Math.imul(be,se)|0,u=u+Math.imul(be,ue)|0,l=l+Math.imul(fe,pe)|0,t=t+Math.imul(fe,Se)|0,t=t+Math.imul(he,pe)|0,u=u+Math.imul(he,Se)|0,l=l+Math.imul(re,ge)|0,t=t+Math.imul(re,De)|0,t=t+Math.imul(ae,ge)|0,u=u+Math.imul(ae,De)|0,l=l+Math.imul(G,_e)|0,t=t+Math.imul(G,Oe)|0,t=t+Math.imul(ie,_e)|0,u=u+Math.imul(ie,Oe)|0,l=l+Math.imul(Y,Ee)|0,t=t+Math.imul(Y,Pe)|0,t=t+Math.imul(j,Ee)|0,u=u+Math.imul(j,Pe)|0;var Pt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,l=Math.imul(C,xe),t=Math.imul(C,Ce),t=t+Math.imul(H,xe)|0,u=Math.imul(H,Ce),l=l+Math.imul($,se)|0,t=t+Math.imul($,ue)|0,t=t+Math.imul(A,se)|0,u=u+Math.imul(A,ue)|0,l=l+Math.imul(ce,pe)|0,t=t+Math.imul(ce,Se)|0,t=t+Math.imul(be,pe)|0,u=u+Math.imul(be,Se)|0,l=l+Math.imul(fe,ge)|0,t=t+Math.imul(fe,De)|0,t=t+Math.imul(he,ge)|0,u=u+Math.imul(he,De)|0,l=l+Math.imul(re,_e)|0,t=t+Math.imul(re,Oe)|0,t=t+Math.imul(ae,_e)|0,u=u+Math.imul(ae,Oe)|0,l=l+Math.imul(G,Ee)|0,t=t+Math.imul(G,Pe)|0,t=t+Math.imul(ie,Ee)|0,u=u+Math.imul(ie,Pe)|0;var Nt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Nt>>>26)|0,Nt&=67108863,l=Math.imul(C,se),t=Math.imul(C,ue),t=t+Math.imul(H,se)|0,u=Math.imul(H,ue),l=l+Math.imul($,pe)|0,t=t+Math.imul($,Se)|0,t=t+Math.imul(A,pe)|0,u=u+Math.imul(A,Se)|0,l=l+Math.imul(ce,ge)|0,t=t+Math.imul(ce,De)|0,t=t+Math.imul(be,ge)|0,u=u+Math.imul(be,De)|0,l=l+Math.imul(fe,_e)|0,t=t+Math.imul(fe,Oe)|0,t=t+Math.imul(he,_e)|0,u=u+Math.imul(he,Oe)|0,l=l+Math.imul(re,Ee)|0,t=t+Math.imul(re,Pe)|0,t=t+Math.imul(ae,Ee)|0,u=u+Math.imul(ae,Pe)|0;var Ct=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Ct>>>26)|0,Ct&=67108863,l=Math.imul(C,pe),t=Math.imul(C,Se),t=t+Math.imul(H,pe)|0,u=Math.imul(H,Se),l=l+Math.imul($,ge)|0,t=t+Math.imul($,De)|0,t=t+Math.imul(A,ge)|0,u=u+Math.imul(A,De)|0,l=l+Math.imul(ce,_e)|0,t=t+Math.imul(ce,Oe)|0,t=t+Math.imul(be,_e)|0,u=u+Math.imul(be,Oe)|0,l=l+Math.imul(fe,Ee)|0,t=t+Math.imul(fe,Pe)|0,t=t+Math.imul(he,Ee)|0,u=u+Math.imul(he,Pe)|0;var Lt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Lt>>>26)|0,Lt&=67108863,l=Math.imul(C,ge),t=Math.imul(C,De),t=t+Math.imul(H,ge)|0,u=Math.imul(H,De),l=l+Math.imul($,_e)|0,t=t+Math.imul($,Oe)|0,t=t+Math.imul(A,_e)|0,u=u+Math.imul(A,Oe)|0,l=l+Math.imul(ce,Ee)|0,t=t+Math.imul(ce,Pe)|0,t=t+Math.imul(be,Ee)|0,u=u+Math.imul(be,Pe)|0;var Dt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(Dt>>>26)|0,Dt&=67108863,l=Math.imul(C,_e),t=Math.imul(C,Oe),t=t+Math.imul(H,_e)|0,u=Math.imul(H,Oe),l=l+Math.imul($,Ee)|0,t=t+Math.imul($,Pe)|0,t=t+Math.imul(A,Ee)|0,u=u+Math.imul(A,Pe)|0;var qt=(m+l|0)+((t&8191)<<13)|0;m=(u+(t>>>13)|0)+(qt>>>26)|0,qt&=67108863,l=Math.imul(C,Ee),t=Math.imul(C,Pe),t=t+Math.imul(H,Ee)|0,u=Math.imul(H,Pe);var Ut=(m+l|0)+((t&8191)<<13)|0;return m=(u+(t>>>13)|0)+(Ut>>>26)|0,Ut&=67108863,c[0]=pt,c[1]=lt,c[2]=yt,c[3]=xt,c[4]=Mt,c[5]=Et,c[6]=At,c[7]=Bt,c[8]=It,c[9]=Tt,c[10]=kt,c[11]=$t,c[12]=Pt,c[13]=Nt,c[14]=Ct,c[15]=Lt,c[16]=Dt,c[17]=qt,c[18]=Ut,m!==0&&(c[19]=m,i.length++),i};Math.imul||(R=E);function T(p,e,r){r.negative=e.negative^p.negative,r.length=p.length+e.length;for(var i=0,s=0,h=0;h<r.length-1;h++){var c=s;s=0;for(var m=i&67108863,l=Math.min(h,e.length-1),t=Math.max(0,h-p.length+1);t<=l;t++){var u=h-t,S=p.words[u]|0,B=e.words[t]|0,k=S*B,q=k&67108863;c=c+(k/67108864|0)|0,q=q+m|0,m=q&67108863,c=c+(q>>>26)|0,s+=c>>>26,c&=67108863}r.words[h]=m,i=c,c=s}return i!==0?r.words[h]=i:r.length--,r.strip()}function N(p,e,r){var i=new P;return i.mulp(p,e,r)}n.prototype.mulTo=function(e,r){var i,s=this.length+e.length;return this.length===10&&e.length===10?i=R(this,e,r):s<63?i=E(this,e,r):s<1024?i=T(this,e,r):i=N(this,e,r),i};function P(p,e){this.x=p,this.y=e}P.prototype.makeRBT=function(e){for(var r=new Array(e),i=n.prototype._countBits(e)-1,s=0;s<e;s++)r[s]=this.revBin(s,i,e);return r},P.prototype.revBin=function(e,r,i){if(e===0||e===i-1)return e;for(var s=0,h=0;h<r;h++)s|=(e&1)<<r-h-1,e>>=1;return s},P.prototype.permute=function(e,r,i,s,h,c){for(var m=0;m<c;m++)s[m]=r[e[m]],h[m]=i[e[m]]},P.prototype.transform=function(e,r,i,s,h,c){this.permute(c,e,r,i,s,h);for(var m=1;m<h;m<<=1)for(var l=m<<1,t=Math.cos(2*Math.PI/l),u=Math.sin(2*Math.PI/l),S=0;S<h;S+=l)for(var B=t,k=u,q=0;q<m;q++){var F=i[S+q],ee=s[S+q],te=i[S+q+m],O=s[S+q+m],U=B*te-k*O;O=B*O+k*te,te=U,i[S+q]=F+te,s[S+q]=ee+O,i[S+q+m]=F-te,s[S+q+m]=ee-O,q!==l&&(U=t*B-u*k,k=t*k+u*B,B=U)}},P.prototype.guessLen13b=function(e,r){var i=Math.max(r,e)|1,s=i&1,h=0;for(i=i/2|0;i;i=i>>>1)h++;return 1<<h+1+s},P.prototype.conjugate=function(e,r,i){if(!(i<=1))for(var s=0;s<i/2;s++){var h=e[s];e[s]=e[i-s-1],e[i-s-1]=h,h=r[s],r[s]=-r[i-s-1],r[i-s-1]=-h}},P.prototype.normalize13b=function(e,r){for(var i=0,s=0;s<r/2;s++){var h=Math.round(e[2*s+1]/r)*8192+Math.round(e[2*s]/r)+i;e[s]=h&67108863,h<67108864?i=0:i=h/67108864|0}return e},P.prototype.convert13b=function(e,r,i,s){for(var h=0,c=0;c<r;c++)h=h+(e[c]|0),i[2*c]=h&8191,h=h>>>13,i[2*c+1]=h&8191,h=h>>>13;for(c=2*r;c<s;++c)i[c]=0;f(h===0),f((h&-8192)===0)},P.prototype.stub=function(e){for(var r=new Array(e),i=0;i<e;i++)r[i]=0;return r},P.prototype.mulp=function(e,r,i){var s=2*this.guessLen13b(e.length,r.length),h=this.makeRBT(s),c=this.stub(s),m=new Array(s),l=new Array(s),t=new Array(s),u=new Array(s),S=new Array(s),B=new Array(s),k=i.words;k.length=s,this.convert13b(e.words,e.length,m,s),this.convert13b(r.words,r.length,u,s),this.transform(m,c,l,t,s,h),this.transform(u,c,S,B,s,h);for(var q=0;q<s;q++){var F=l[q]*S[q]-t[q]*B[q];t[q]=l[q]*B[q]+t[q]*S[q],l[q]=F}return this.conjugate(l,t,s),this.transform(l,t,k,c,s,h),this.conjugate(k,c,s),this.normalize13b(k,s),i.negative=e.negative^r.negative,i.length=e.length+r.length,i.strip()},n.prototype.mul=function(e){var r=new n(null);return r.words=new Array(this.length+e.length),this.mulTo(e,r)},n.prototype.mulf=function(e){var r=new n(null);return r.words=new Array(this.length+e.length),N(this,e,r)},n.prototype.imul=function(e){return this.clone().mulTo(e,this)},n.prototype.imuln=function(e){f(typeof e=="number"),f(e<67108864);for(var r=0,i=0;i<this.length;i++){var s=(this.words[i]|0)*e,h=(s&67108863)+(r&67108863);r>>=26,r+=s/67108864|0,r+=h>>>26,this.words[i]=h&67108863}return r!==0&&(this.words[i]=r,this.length++),this.length=e===0?1:this.length,this},n.prototype.muln=function(e){return this.clone().imuln(e)},n.prototype.sqr=function(){return this.mul(this)},n.prototype.isqr=function(){return this.imul(this.clone())},n.prototype.pow=function(e){var r=x(e);if(r.length===0)return new n(1);for(var i=this,s=0;s<r.length&&r[s]===0;s++,i=i.sqr());if(++s<r.length)for(var h=i.sqr();s<r.length;s++,h=h.sqr())r[s]!==0&&(i=i.mul(h));return i},n.prototype.iushln=function(e){f(typeof e=="number"&&e>=0);var r=e%26,i=(e-r)/26,s=67108863>>>26-r<<26-r,h;if(r!==0){var c=0;for(h=0;h<this.length;h++){var m=this.words[h]&s,l=(this.words[h]|0)-m<<r;this.words[h]=l|c,c=m>>>26-r}c&&(this.words[h]=c,this.length++)}if(i!==0){for(h=this.length-1;h>=0;h--)this.words[h+i]=this.words[h];for(h=0;h<i;h++)this.words[h]=0;this.length+=i}return this.strip()},n.prototype.ishln=function(e){return f(this.negative===0),this.iushln(e)},n.prototype.iushrn=function(e,r,i){f(typeof e=="number"&&e>=0);var s;r?s=(r-r%26)/26:s=0;var h=e%26,c=Math.min((e-h)/26,this.length),m=67108863^67108863>>>h<<h,l=i;if(s-=c,s=Math.max(0,s),l){for(var t=0;t<c;t++)l.words[t]=this.words[t];l.length=c}if(c!==0)if(this.length>c)for(this.length-=c,t=0;t<this.length;t++)this.words[t]=this.words[t+c];else this.words[0]=0,this.length=1;var u=0;for(t=this.length-1;t>=0&&(u!==0||t>=s);t--){var S=this.words[t]|0;this.words[t]=u<<26-h|S>>>h,u=S&m}return l&&u!==0&&(l.words[l.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},n.prototype.ishrn=function(e,r,i){return f(this.negative===0),this.iushrn(e,r,i)},n.prototype.shln=function(e){return this.clone().ishln(e)},n.prototype.ushln=function(e){return this.clone().iushln(e)},n.prototype.shrn=function(e){return this.clone().ishrn(e)},n.prototype.ushrn=function(e){return this.clone().iushrn(e)},n.prototype.testn=function(e){f(typeof e=="number"&&e>=0);var r=e%26,i=(e-r)/26,s=1<<r;if(this.length<=i)return!1;var h=this.words[i];return!!(h&s)},n.prototype.imaskn=function(e){f(typeof e=="number"&&e>=0);var r=e%26,i=(e-r)/26;if(f(this.negative===0,"imaskn works only with positive numbers"),this.length<=i)return this;if(r!==0&&i++,this.length=Math.min(i,this.length),r!==0){var s=67108863^67108863>>>r<<r;this.words[this.length-1]&=s}return this.strip()},n.prototype.maskn=function(e){return this.clone().imaskn(e)},n.prototype.iaddn=function(e){return f(typeof e=="number"),f(e<67108864),e<0?this.isubn(-e):this.negative!==0?this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},n.prototype._iaddn=function(e){this.words[0]+=e;for(var r=0;r<this.length&&this.words[r]>=67108864;r++)this.words[r]-=67108864,r===this.length-1?this.words[r+1]=1:this.words[r+1]++;return this.length=Math.max(this.length,r+1),this},n.prototype.isubn=function(e){if(f(typeof e=="number"),f(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var r=0;r<this.length&&this.words[r]<0;r++)this.words[r]+=67108864,this.words[r+1]-=1;return this.strip()},n.prototype.addn=function(e){return this.clone().iaddn(e)},n.prototype.subn=function(e){return this.clone().isubn(e)},n.prototype.iabs=function(){return this.negative=0,this},n.prototype.abs=function(){return this.clone().iabs()},n.prototype._ishlnsubmul=function(e,r,i){var s=e.length+i,h;this._expand(s);var c,m=0;for(h=0;h<e.length;h++){c=(this.words[h+i]|0)+m;var l=(e.words[h]|0)*r;c-=l&67108863,m=(c>>26)-(l/67108864|0),this.words[h+i]=c&67108863}for(;h<this.length-i;h++)c=(this.words[h+i]|0)+m,m=c>>26,this.words[h+i]=c&67108863;if(m===0)return this.strip();for(f(m===-1),m=0,h=0;h<this.length;h++)c=-(this.words[h]|0)+m,m=c>>26,this.words[h]=c&67108863;return this.negative=1,this.strip()},n.prototype._wordDiv=function(e,r){var i=this.length-e.length,s=this.clone(),h=e,c=h.words[h.length-1]|0,m=this._countBits(c);i=26-m,i!==0&&(h=h.ushln(i),s.iushln(i),c=h.words[h.length-1]|0);var l=s.length-h.length,t;if(r!=="mod"){t=new n(null),t.length=l+1,t.words=new Array(t.length);for(var u=0;u<t.length;u++)t.words[u]=0}var S=s.clone()._ishlnsubmul(h,1,l);S.negative===0&&(s=S,t&&(t.words[l]=1));for(var B=l-1;B>=0;B--){var k=(s.words[h.length+B]|0)*67108864+(s.words[h.length+B-1]|0);for(k=Math.min(k/c|0,67108863),s._ishlnsubmul(h,k,B);s.negative!==0;)k--,s.negative=0,s._ishlnsubmul(h,1,B),s.isZero()||(s.negative^=1);t&&(t.words[B]=k)}return t&&t.strip(),s.strip(),r!=="div"&&i!==0&&s.iushrn(i),{div:t||null,mod:s}},n.prototype.divmod=function(e,r,i){if(f(!e.isZero()),this.isZero())return{div:new n(0),mod:new n(0)};var s,h,c;return this.negative!==0&&e.negative===0?(c=this.neg().divmod(e,r),r!=="mod"&&(s=c.div.neg()),r!=="div"&&(h=c.mod.neg(),i&&h.negative!==0&&h.iadd(e)),{div:s,mod:h}):this.negative===0&&e.negative!==0?(c=this.divmod(e.neg(),r),r!=="mod"&&(s=c.div.neg()),{div:s,mod:c.mod}):this.negative&e.negative?(c=this.neg().divmod(e.neg(),r),r!=="div"&&(h=c.mod.neg(),i&&h.negative!==0&&h.isub(e)),{div:c.div,mod:h}):e.length>this.length||this.cmp(e)<0?{div:new n(0),mod:this}:e.length===1?r==="div"?{div:this.divn(e.words[0]),mod:null}:r==="mod"?{div:null,mod:new n(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new n(this.modn(e.words[0]))}:this._wordDiv(e,r)},n.prototype.div=function(e){return this.divmod(e,"div",!1).div},n.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},n.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},n.prototype.divRound=function(e){var r=this.divmod(e);if(r.mod.isZero())return r.div;var i=r.div.negative!==0?r.mod.isub(e):r.mod,s=e.ushrn(1),h=e.andln(1),c=i.cmp(s);return c<0||h===1&&c===0?r.div:r.div.negative!==0?r.div.isubn(1):r.div.iaddn(1)},n.prototype.modn=function(e){f(e<=67108863);for(var r=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(r*i+(this.words[s]|0))%e;return i},n.prototype.idivn=function(e){f(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var s=(this.words[i]|0)+r*67108864;this.words[i]=s/e|0,r=s%e}return this.strip()},n.prototype.divn=function(e){return this.clone().idivn(e)},n.prototype.egcd=function(e){f(e.negative===0),f(!e.isZero());var r=this,i=e.clone();r.negative!==0?r=r.umod(e):r=r.clone();for(var s=new n(1),h=new n(0),c=new n(0),m=new n(1),l=0;r.isEven()&&i.isEven();)r.iushrn(1),i.iushrn(1),++l;for(var t=i.clone(),u=r.clone();!r.isZero();){for(var S=0,B=1;!(r.words[0]&B)&&S<26;++S,B<<=1);if(S>0)for(r.iushrn(S);S-- >0;)(s.isOdd()||h.isOdd())&&(s.iadd(t),h.isub(u)),s.iushrn(1),h.iushrn(1);for(var k=0,q=1;!(i.words[0]&q)&&k<26;++k,q<<=1);if(k>0)for(i.iushrn(k);k-- >0;)(c.isOdd()||m.isOdd())&&(c.iadd(t),m.isub(u)),c.iushrn(1),m.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(c),h.isub(m)):(i.isub(r),c.isub(s),m.isub(h))}return{a:c,b:m,gcd:i.iushln(l)}},n.prototype._invmp=function(e){f(e.negative===0),f(!e.isZero());var r=this,i=e.clone();r.negative!==0?r=r.umod(e):r=r.clone();for(var s=new n(1),h=new n(0),c=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var m=0,l=1;!(r.words[0]&l)&&m<26;++m,l<<=1);if(m>0)for(r.iushrn(m);m-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var t=0,u=1;!(i.words[0]&u)&&t<26;++t,u<<=1);if(t>0)for(i.iushrn(t);t-- >0;)h.isOdd()&&h.iadd(c),h.iushrn(1);r.cmp(i)>=0?(r.isub(i),s.isub(h)):(i.isub(r),h.isub(s))}var S;return r.cmpn(1)===0?S=s:S=h,S.cmpn(0)<0&&S.iadd(e),S},n.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var r=this.clone(),i=e.clone();r.negative=0,i.negative=0;for(var s=0;r.isEven()&&i.isEven();s++)r.iushrn(1),i.iushrn(1);do{for(;r.isEven();)r.iushrn(1);for(;i.isEven();)i.iushrn(1);var h=r.cmp(i);if(h<0){var c=r;r=i,i=c}else if(h===0||i.cmpn(1)===0)break;r.isub(i)}while(!0);return i.iushln(s)},n.prototype.invm=function(e){return this.egcd(e).a.umod(e)},n.prototype.isEven=function(){return(this.words[0]&1)===0},n.prototype.isOdd=function(){return(this.words[0]&1)===1},n.prototype.andln=function(e){return this.words[0]&e},n.prototype.bincn=function(e){f(typeof e=="number");var r=e%26,i=(e-r)/26,s=1<<r;if(this.length<=i)return this._expand(i+1),this.words[i]|=s,this;for(var h=s,c=i;h!==0&&c<this.length;c++){var m=this.words[c]|0;m+=h,h=m>>>26,m&=67108863,this.words[c]=m}return h!==0&&(this.words[c]=h,this.length++),this},n.prototype.isZero=function(){return this.length===1&&this.words[0]===0},n.prototype.cmpn=function(e){var r=e<0;if(this.negative!==0&&!r)return-1;if(this.negative===0&&r)return 1;this.strip();var i;if(this.length>1)i=1;else{r&&(e=-e),f(e<=67108863,"Number is too big");var s=this.words[0]|0;i=s===e?0:s<e?-1:1}return this.negative!==0?-i|0:i},n.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var r=this.ucmp(e);return this.negative!==0?-r|0:r},n.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var r=0,i=this.length-1;i>=0;i--){var s=this.words[i]|0,h=e.words[i]|0;if(s!==h){s<h?r=-1:s>h&&(r=1);break}}return r},n.prototype.gtn=function(e){return this.cmpn(e)===1},n.prototype.gt=function(e){return this.cmp(e)===1},n.prototype.gten=function(e){return this.cmpn(e)>=0},n.prototype.gte=function(e){return this.cmp(e)>=0},n.prototype.ltn=function(e){return this.cmpn(e)===-1},n.prototype.lt=function(e){return this.cmp(e)===-1},n.prototype.lten=function(e){return this.cmpn(e)<=0},n.prototype.lte=function(e){return this.cmp(e)<=0},n.prototype.eqn=function(e){return this.cmpn(e)===0},n.prototype.eq=function(e){return this.cmp(e)===0},n.red=function(e){return new z(e)},n.prototype.toRed=function(e){return f(!this.red,"Already a number in reduction context"),f(this.negative===0,"red works only with positives"),e.convertTo(this)._forceRed(e)},n.prototype.fromRed=function(){return f(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},n.prototype._forceRed=function(e){return this.red=e,this},n.prototype.forceRed=function(e){return f(!this.red,"Already a number in reduction context"),this._forceRed(e)},n.prototype.redAdd=function(e){return f(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},n.prototype.redIAdd=function(e){return f(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},n.prototype.redSub=function(e){return f(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},n.prototype.redISub=function(e){return f(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},n.prototype.redShl=function(e){return f(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},n.prototype.redMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},n.prototype.redIMul=function(e){return f(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},n.prototype.redSqr=function(){return f(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},n.prototype.redISqr=function(){return f(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},n.prototype.redSqrt=function(){return f(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},n.prototype.redInvm=function(){return f(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},n.prototype.redNeg=function(){return f(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},n.prototype.redPow=function(e){return f(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var L={k256:null,p224:null,p192:null,p25519:null};function D(p,e){this.name=p,this.p=new n(e,16),this.n=this.p.bitLength(),this.k=new n(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}D.prototype._tmp=function(){var e=new n(null);return e.words=new Array(Math.ceil(this.n/13)),e},D.prototype.ireduce=function(e){var r=e,i;do this.split(r,this.tmp),r=this.imulK(r),r=r.iadd(this.tmp),i=r.bitLength();while(i>this.n);var s=i<this.n?-1:r.ucmp(this.p);return s===0?(r.words[0]=0,r.length=1):s>0?r.isub(this.p):r.strip!==void 0?r.strip():r._strip(),r},D.prototype.split=function(e,r){e.iushrn(this.n,0,r)},D.prototype.imulK=function(e){return e.imul(this.k)};function Z(){D.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}d(Z,D),Z.prototype.split=function(e,r){for(var i=4194303,s=Math.min(e.length,9),h=0;h<s;h++)r.words[h]=e.words[h];if(r.length=s,e.length<=9){e.words[0]=0,e.length=1;return}var c=e.words[9];for(r.words[r.length++]=c&i,h=10;h<e.length;h++){var m=e.words[h]|0;e.words[h-10]=(m&i)<<4|c>>>22,c=m}c>>>=22,e.words[h-10]=c,c===0&&e.length>10?e.length-=10:e.length-=9},Z.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var r=0,i=0;i<e.length;i++){var s=e.words[i]|0;r+=s*977,e.words[i]=r&67108863,r=s*64+(r/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function W(){D.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}d(W,D);function Q(){D.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}d(Q,D);function K(){D.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}d(K,D),K.prototype.imulK=function(e){for(var r=0,i=0;i<e.length;i++){var s=(e.words[i]|0)*19+r,h=s&67108863;s>>>=26,e.words[i]=h,r=s}return r!==0&&(e.words[e.length++]=r),e},n._prime=function(e){if(L[e])return L[e];var r;if(e==="k256")r=new Z;else if(e==="p224")r=new W;else if(e==="p192")r=new Q;else if(e==="p25519")r=new K;else throw new Error("Unknown prime "+e);return L[e]=r,r};function z(p){if(typeof p=="string"){var e=n._prime(p);this.m=e.p,this.prime=e}else f(p.gtn(1),"modulus must be greater than 1"),this.m=p,this.prime=null}z.prototype._verify1=function(e){f(e.negative===0,"red works only with positives"),f(e.red,"red works only with red numbers")},z.prototype._verify2=function(e,r){f((e.negative|r.negative)===0,"red works only with positives"),f(e.red&&e.red===r.red,"red works only with red numbers")},z.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},z.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},z.prototype.add=function(e,r){this._verify2(e,r);var i=e.add(r);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},z.prototype.iadd=function(e,r){this._verify2(e,r);var i=e.iadd(r);return i.cmp(this.m)>=0&&i.isub(this.m),i},z.prototype.sub=function(e,r){this._verify2(e,r);var i=e.sub(r);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},z.prototype.isub=function(e,r){this._verify2(e,r);var i=e.isub(r);return i.cmpn(0)<0&&i.iadd(this.m),i},z.prototype.shl=function(e,r){return this._verify1(e),this.imod(e.ushln(r))},z.prototype.imul=function(e,r){return this._verify2(e,r),this.imod(e.imul(r))},z.prototype.mul=function(e,r){return this._verify2(e,r),this.imod(e.mul(r))},z.prototype.isqr=function(e){return this.imul(e,e.clone())},z.prototype.sqr=function(e){return this.mul(e,e)},z.prototype.sqrt=function(e){if(e.isZero())return e.clone();var r=this.m.andln(3);if(f(r%2===1),r===3){var i=this.m.add(new n(1)).iushrn(2);return this.pow(e,i)}for(var s=this.m.subn(1),h=0;!s.isZero()&&s.andln(1)===0;)h++,s.iushrn(1);f(!s.isZero());var c=new n(1).toRed(this),m=c.redNeg(),l=this.m.subn(1).iushrn(1),t=this.m.bitLength();for(t=new n(2*t*t).toRed(this);this.pow(t,l).cmp(m)!==0;)t.redIAdd(m);for(var u=this.pow(t,s),S=this.pow(e,s.addn(1).iushrn(1)),B=this.pow(e,s),k=h;B.cmp(c)!==0;){for(var q=B,F=0;q.cmp(c)!==0;F++)q=q.redSqr();f(F<k);var ee=this.pow(u,new n(1).iushln(k-F-1));S=S.redMul(ee),u=ee.redSqr(),B=B.redMul(u),k=F}return S},z.prototype.invm=function(e){var r=e._invmp(this.m);return r.negative!==0?(r.negative=0,this.imod(r).redNeg()):this.imod(r)},z.prototype.pow=function(e,r){if(r.isZero())return new n(1).toRed(this);if(r.cmpn(1)===0)return e.clone();var i=4,s=new Array(1<<i);s[0]=new n(1).toRed(this),s[1]=e;for(var h=2;h<s.length;h++)s[h]=this.mul(s[h-1],e);var c=s[0],m=0,l=0,t=r.bitLength()%26;for(t===0&&(t=26),h=r.length-1;h>=0;h--){for(var u=r.words[h],S=t-1;S>=0;S--){var B=u>>S&1;if(c!==s[0]&&(c=this.sqr(c)),B===0&&m===0){l=0;continue}m<<=1,m|=B,l++,!(l!==i&&(h!==0||S!==0))&&(c=this.mul(c,s[m]),l=0,m=0)}t=26}return c},z.prototype.convertTo=function(e){var r=e.umod(this.m);return r===e?r.clone():r},z.prototype.convertFrom=function(e){var r=e.clone();return r.red=null,r},n.mont=function(e){return new X(e)};function X(p){z.call(this,p),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new n(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}d(X,z),X.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},X.prototype.convertFrom=function(e){var r=this.imod(e.mul(this.rinv));return r.red=null,r},X.prototype.imul=function(e,r){if(e.isZero()||r.isZero())return e.words[0]=0,e.length=1,e;var i=e.imul(r),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=i.isub(s).iushrn(this.shift),c=h;return h.cmp(this.m)>=0?c=h.isub(this.m):h.cmpn(0)<0&&(c=h.iadd(this.m)),c._forceRed(this)},X.prototype.mul=function(e,r){if(e.isZero()||r.isZero())return new n(0)._forceRed(this);var i=e.mul(r),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),h=i.isub(s).iushrn(this.shift),c=h;return h.cmp(this.m)>=0?c=h.isub(this.m):h.cmpn(0)<0&&(c=h.iadd(this.m)),c._forceRed(this)},X.prototype.invm=function(e){var r=this.imod(e._invmp(this.m).mul(this.r2));return r._forceRed(this)}})(typeof z_>"u"||z_,gH)});var Cn=St((Wme,K_)=>{var Zme=Ae(Be());Ie();Re();typeof Object.create=="function"?K_.exports=function(o,f){f&&(o.super_=f,o.prototype=Object.create(f.prototype,{constructor:{value:o,enumerable:!1,writable:!0,configurable:!0}}))}:K_.exports=function(o,f){if(f){o.super_=f;var d=function(){};d.prototype=f.prototype,o.prototype=new d,o.prototype.constructor=o}}});function vhe(){if(yH)return x1;yH=!0,x1.byteLength=y,x1.toByteArray=w,x1.fromByteArray=x;for(var a=[],o=[],f=typeof Uint8Array<"u"?Uint8Array:Array,d="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",n=0,v=d.length;n<v;++n)a[n]=d[n],o[d.charCodeAt(n)]=n;o[45]=62,o[95]=63;function b(E){var R=E.length;if(R%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var T=E.indexOf("=");T===-1&&(T=R);var N=T===R?0:4-T%4;return[T,N]}function y(E){var R=b(E),T=R[0],N=R[1];return(T+N)*3/4-N}function M(E,R,T){return(R+T)*3/4-T}function w(E){var R,T=b(E),N=T[0],P=T[1],L=new f(M(E,N,P)),D=0,Z=P>0?N-4:N,W;for(W=0;W<Z;W+=4)R=o[E.charCodeAt(W)]<<18|o[E.charCodeAt(W+1)]<<12|o[E.charCodeAt(W+2)]<<6|o[E.charCodeAt(W+3)],L[D++]=R>>16&255,L[D++]=R>>8&255,L[D++]=R&255;return P===2&&(R=o[E.charCodeAt(W)]<<2|o[E.charCodeAt(W+1)]>>4,L[D++]=R&255),P===1&&(R=o[E.charCodeAt(W)]<<10|o[E.charCodeAt(W+1)]<<4|o[E.charCodeAt(W+2)]>>2,L[D++]=R>>8&255,L[D++]=R&255),L}function g(E){return a[E>>18&63]+a[E>>12&63]+a[E>>6&63]+a[E&63]}function _(E,R,T){for(var N,P=[],L=R;L<T;L+=3)N=(E[L]<<16&16711680)+(E[L+1]<<8&65280)+(E[L+2]&255),P.push(g(N));return P.join("")}function x(E){for(var R,T=E.length,N=T%3,P=[],L=16383,D=0,Z=T-N;D<Z;D+=L)P.push(_(E,D,D+L>Z?Z:D+L));return N===1?(R=E[T-1],P.push(a[R>>2]+a[R<<4&63]+"==")):N===2&&(R=(E[T-2]<<8)+E[T-1],P.push(a[R>>10]+a[R>>4&63]+a[R<<2&63]+"=")),P.join("")}return x1}function bhe(){return wH||(wH=!0,I6.read=function(a,o,f,d,n){var v,b,y=n*8-d-1,M=(1<<y)-1,w=M>>1,g=-7,_=f?n-1:0,x=f?-1:1,E=a[o+_];for(_+=x,v=E&(1<<-g)-1,E>>=-g,g+=y;g>0;v=v*256+a[o+_],_+=x,g-=8);for(b=v&(1<<-g)-1,v>>=-g,g+=d;g>0;b=b*256+a[o+_],_+=x,g-=8);if(v===0)v=1-w;else{if(v===M)return b?NaN:(E?-1:1)*(1/0);b=b+Math.pow(2,d),v=v-w}return(E?-1:1)*b*Math.pow(2,v-d)},I6.write=function(a,o,f,d,n,v){var b,y,M,w=v*8-n-1,g=(1<<w)-1,_=g>>1,x=n===23?Math.pow(2,-24)-Math.pow(2,-77):0,E=d?0:v-1,R=d?1:-1,T=o<0||o===0&&1/o<0?1:0;for(o=Math.abs(o),isNaN(o)||o===1/0?(y=isNaN(o)?1:0,b=g):(b=Math.floor(Math.log(o)/Math.LN2),o*(M=Math.pow(2,-b))<1&&(b--,M*=2),b+_>=1?o+=x/M:o+=x*Math.pow(2,1-_),o*M>=2&&(b++,M/=2),b+_>=g?(y=0,b=g):b+_>=1?(y=(o*M-1)*Math.pow(2,n),b=b+_):(y=o*Math.pow(2,_-1)*Math.pow(2,n),b=0));n>=8;a[f+E]=y&255,E+=R,y/=256,n-=8);for(b=b<<n|y,w+=n;w>0;a[f+E]=b&255,E+=R,b/=256,w-=8);a[f+E-R]|=T*128}),I6}function mhe(){if(MH)return Ru;MH=!0;let a=vhe(),o=bhe(),f=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Ru.Buffer=b,Ru.SlowBuffer=P,Ru.INSPECT_MAX_BYTES=50;let d=2147483647;Ru.kMaxLength=d,b.TYPED_ARRAY_SUPPORT=n(),!b.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function n(){try{let $=new Uint8Array(1),A={foo:function(){return 42}};return Object.setPrototypeOf(A,Uint8Array.prototype),Object.setPrototypeOf($,A),$.foo()===42}catch{return!1}}Object.defineProperty(b.prototype,"parent",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.buffer}}),Object.defineProperty(b.prototype,"offset",{enumerable:!0,get:function(){if(b.isBuffer(this))return this.byteOffset}});function v($){if($>d)throw new RangeError('The value "'+$+'" is invalid for option "size"');let A=new Uint8Array($);return Object.setPrototypeOf(A,b.prototype),A}function b($,A,I){if(typeof $=="number"){if(typeof A=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return g($)}return y($,A,I)}b.poolSize=8192;function y($,A,I){if(typeof $=="string")return _($,A);if(ArrayBuffer.isView($))return E($);if($==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $);if(he($,ArrayBuffer)||$&&he($.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(he($,SharedArrayBuffer)||$&&he($.buffer,SharedArrayBuffer)))return R($,A,I);if(typeof $=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let C=$.valueOf&&$.valueOf();if(C!=null&&C!==$)return b.from(C,A,I);let H=T($);if(H)return H;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof $[Symbol.toPrimitive]=="function")return b.from($[Symbol.toPrimitive]("string"),A,I);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof $)}b.from=function($,A,I){return y($,A,I)},Object.setPrototypeOf(b.prototype,Uint8Array.prototype),Object.setPrototypeOf(b,Uint8Array);function M($){if(typeof $!="number")throw new TypeError('"size" argument must be of type number');if($<0)throw new RangeError('The value "'+$+'" is invalid for option "size"')}function w($,A,I){return M($),$<=0?v($):A!==void 0?typeof I=="string"?v($).fill(A,I):v($).fill(A):v($)}b.alloc=function($,A,I){return w($,A,I)};function g($){return M($),v($<0?0:N($)|0)}b.allocUnsafe=function($){return g($)},b.allocUnsafeSlow=function($){return g($)};function _($,A){if((typeof A!="string"||A==="")&&(A="utf8"),!b.isEncoding(A))throw new TypeError("Unknown encoding: "+A);let I=L($,A)|0,C=v(I),H=C.write($,A);return H!==I&&(C=C.slice(0,H)),C}function x($){let A=$.length<0?0:N($.length)|0,I=v(A);for(let C=0;C<A;C+=1)I[C]=$[C]&255;return I}function E($){if(he($,Uint8Array)){let A=new Uint8Array($);return R(A.buffer,A.byteOffset,A.byteLength)}return x($)}function R($,A,I){if(A<0||$.byteLength<A)throw new RangeError('"offset" is outside of buffer bounds');if($.byteLength<A+(I||0))throw new RangeError('"length" is outside of buffer bounds');let C;return A===void 0&&I===void 0?C=new Uint8Array($):I===void 0?C=new Uint8Array($,A):C=new Uint8Array($,A,I),Object.setPrototypeOf(C,b.prototype),C}function T($){if(b.isBuffer($)){let A=N($.length)|0,I=v(A);return I.length===0||$.copy(I,0,0,A),I}if($.length!==void 0)return typeof $.length!="number"||nt($.length)?v(0):x($);if($.type==="Buffer"&&Array.isArray($.data))return x($.data)}function N($){if($>=d)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+d.toString(16)+" bytes");return $|0}function P($){return+$!=$&&($=0),b.alloc(+$)}b.isBuffer=function(A){return A!=null&&A._isBuffer===!0&&A!==b.prototype},b.compare=function(A,I){if(he(A,Uint8Array)&&(A=b.from(A,A.offset,A.byteLength)),he(I,Uint8Array)&&(I=b.from(I,I.offset,I.byteLength)),!b.isBuffer(A)||!b.isBuffer(I))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(A===I)return 0;let C=A.length,H=I.length;for(let ne=0,J=Math.min(C,H);ne<J;++ne)if(A[ne]!==I[ne]){C=A[ne],H=I[ne];break}return C<H?-1:H<C?1:0},b.isEncoding=function(A){switch(String(A).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},b.concat=function(A,I){if(!Array.isArray(A))throw new TypeError('"list" argument must be an Array of Buffers');if(A.length===0)return b.alloc(0);let C;if(I===void 0)for(I=0,C=0;C<A.length;++C)I+=A[C].length;let H=b.allocUnsafe(I),ne=0;for(C=0;C<A.length;++C){let J=A[C];if(he(J,Uint8Array))ne+J.length>H.length?(b.isBuffer(J)||(J=b.from(J)),J.copy(H,ne)):Uint8Array.prototype.set.call(H,J,ne);else if(b.isBuffer(J))J.copy(H,ne);else throw new TypeError('"list" argument must be an Array of Buffers');ne+=J.length}return H};function L($,A){if(b.isBuffer($))return $.length;if(ArrayBuffer.isView($)||he($,ArrayBuffer))return $.byteLength;if(typeof $!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof $);let I=$.length,C=arguments.length>2&&arguments[2]===!0;if(!C&&I===0)return 0;let H=!1;for(;;)switch(A){case"ascii":case"latin1":case"binary":return I;case"utf8":case"utf-8":return me($).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I*2;case"hex":return I>>>1;case"base64":return ye($).length;default:if(H)return C?-1:me($).length;A=(""+A).toLowerCase(),H=!0}}b.byteLength=L;function D($,A,I){let C=!1;if((A===void 0||A<0)&&(A=0),A>this.length||((I===void 0||I>this.length)&&(I=this.length),I<=0)||(I>>>=0,A>>>=0,I<=A))return"";for($||($="utf8");;)switch($){case"hex":return l(this,A,I);case"utf8":case"utf-8":return i(this,A,I);case"ascii":return c(this,A,I);case"latin1":case"binary":return m(this,A,I);case"base64":return r(this,A,I);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t(this,A,I);default:if(C)throw new TypeError("Unknown encoding: "+$);$=($+"").toLowerCase(),C=!0}}b.prototype._isBuffer=!0;function Z($,A,I){let C=$[A];$[A]=$[I],$[I]=C}b.prototype.swap16=function(){let A=this.length;if(A%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let I=0;I<A;I+=2)Z(this,I,I+1);return this},b.prototype.swap32=function(){let A=this.length;if(A%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let I=0;I<A;I+=4)Z(this,I,I+3),Z(this,I+1,I+2);return this},b.prototype.swap64=function(){let A=this.length;if(A%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let I=0;I<A;I+=8)Z(this,I,I+7),Z(this,I+1,I+6),Z(this,I+2,I+5),Z(this,I+3,I+4);return this},b.prototype.toString=function(){let A=this.length;return A===0?"":arguments.length===0?i(this,0,A):D.apply(this,arguments)},b.prototype.toLocaleString=b.prototype.toString,b.prototype.equals=function(A){if(!b.isBuffer(A))throw new TypeError("Argument must be a Buffer");return this===A?!0:b.compare(this,A)===0},b.prototype.inspect=function(){let A="",I=Ru.INSPECT_MAX_BYTES;return A=this.toString("hex",0,I).replace(/(.{2})/g,"$1 ").trim(),this.length>I&&(A+=" ... "),"<Buffer "+A+">"},f&&(b.prototype[f]=b.prototype.inspect),b.prototype.compare=function(A,I,C,H,ne){if(he(A,Uint8Array)&&(A=b.from(A,A.offset,A.byteLength)),!b.isBuffer(A))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof A);if(I===void 0&&(I=0),C===void 0&&(C=A?A.length:0),H===void 0&&(H=0),ne===void 0&&(ne=this.length),I<0||C>A.length||H<0||ne>this.length)throw new RangeError("out of range index");if(H>=ne&&I>=C)return 0;if(H>=ne)return-1;if(I>=C)return 1;if(I>>>=0,C>>>=0,H>>>=0,ne>>>=0,this===A)return 0;let J=ne-H,de=C-I,st=Math.min(J,de),le=this.slice(H,ne),ve=A.slice(I,C);for(let ot=0;ot<st;++ot)if(le[ot]!==ve[ot]){J=le[ot],de=ve[ot];break}return J<de?-1:de<J?1:0};function W($,A,I,C,H){if($.length===0)return-1;if(typeof I=="string"?(C=I,I=0):I>2147483647?I=2147483647:I<-2147483648&&(I=-2147483648),I=+I,nt(I)&&(I=H?0:$.length-1),I<0&&(I=$.length+I),I>=$.length){if(H)return-1;I=$.length-1}else if(I<0)if(H)I=0;else return-1;if(typeof A=="string"&&(A=b.from(A,C)),b.isBuffer(A))return A.length===0?-1:Q($,A,I,C,H);if(typeof A=="number")return A=A&255,typeof Uint8Array.prototype.indexOf=="function"?H?Uint8Array.prototype.indexOf.call($,A,I):Uint8Array.prototype.lastIndexOf.call($,A,I):Q($,[A],I,C,H);throw new TypeError("val must be string, number or Buffer")}function Q($,A,I,C,H){let ne=1,J=$.length,de=A.length;if(C!==void 0&&(C=String(C).toLowerCase(),C==="ucs2"||C==="ucs-2"||C==="utf16le"||C==="utf-16le")){if($.length<2||A.length<2)return-1;ne=2,J/=2,de/=2,I/=2}function st(ve,ot){return ne===1?ve[ot]:ve.readUInt16BE(ot*ne)}let le;if(H){let ve=-1;for(le=I;le<J;le++)if(st($,le)===st(A,ve===-1?0:le-ve)){if(ve===-1&&(ve=le),le-ve+1===de)return ve*ne}else ve!==-1&&(le-=le-ve),ve=-1}else for(I+de>J&&(I=J-de),le=I;le>=0;le--){let ve=!0;for(let ot=0;ot<de;ot++)if(st($,le+ot)!==st(A,ot)){ve=!1;break}if(ve)return le}return-1}b.prototype.includes=function(A,I,C){return this.indexOf(A,I,C)!==-1},b.prototype.indexOf=function(A,I,C){return W(this,A,I,C,!0)},b.prototype.lastIndexOf=function(A,I,C){return W(this,A,I,C,!1)};function K($,A,I,C){I=Number(I)||0;let H=$.length-I;C?(C=Number(C),C>H&&(C=H)):C=H;let ne=A.length;C>ne/2&&(C=ne/2);let J;for(J=0;J<C;++J){let de=parseInt(A.substr(J*2,2),16);if(nt(de))return J;$[I+J]=de}return J}function z($,A,I,C){return fe(me(A,$.length-I),$,I,C)}function X($,A,I,C){return fe(re(A),$,I,C)}function p($,A,I,C){return fe(ye(A),$,I,C)}function e($,A,I,C){return fe(ae(A,$.length-I),$,I,C)}b.prototype.write=function(A,I,C,H){if(I===void 0)H="utf8",C=this.length,I=0;else if(C===void 0&&typeof I=="string")H=I,C=this.length,I=0;else if(isFinite(I))I=I>>>0,isFinite(C)?(C=C>>>0,H===void 0&&(H="utf8")):(H=C,C=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let ne=this.length-I;if((C===void 0||C>ne)&&(C=ne),A.length>0&&(C<0||I<0)||I>this.length)throw new RangeError("Attempt to write outside buffer bounds");H||(H="utf8");let J=!1;for(;;)switch(H){case"hex":return K(this,A,I,C);case"utf8":case"utf-8":return z(this,A,I,C);case"ascii":case"latin1":case"binary":return X(this,A,I,C);case"base64":return p(this,A,I,C);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e(this,A,I,C);default:if(J)throw new TypeError("Unknown encoding: "+H);H=(""+H).toLowerCase(),J=!0}},b.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function r($,A,I){return A===0&&I===$.length?a.fromByteArray($):a.fromByteArray($.slice(A,I))}function i($,A,I){I=Math.min($.length,I);let C=[],H=A;for(;H<I;){let ne=$[H],J=null,de=ne>239?4:ne>223?3:ne>191?2:1;if(H+de<=I){let st,le,ve,ot;switch(de){case 1:ne<128&&(J=ne);break;case 2:st=$[H+1],(st&192)===128&&(ot=(ne&31)<<6|st&63,ot>127&&(J=ot));break;case 3:st=$[H+1],le=$[H+2],(st&192)===128&&(le&192)===128&&(ot=(ne&15)<<12|(st&63)<<6|le&63,ot>2047&&(ot<55296||ot>57343)&&(J=ot));break;case 4:st=$[H+1],le=$[H+2],ve=$[H+3],(st&192)===128&&(le&192)===128&&(ve&192)===128&&(ot=(ne&15)<<18|(st&63)<<12|(le&63)<<6|ve&63,ot>65535&&ot<1114112&&(J=ot))}}J===null?(J=65533,de=1):J>65535&&(J-=65536,C.push(J>>>10&1023|55296),J=56320|J&1023),C.push(J),H+=de}return h(C)}let s=4096;function h($){let A=$.length;if(A<=s)return String.fromCharCode.apply(String,$);let I="",C=0;for(;C<A;)I+=String.fromCharCode.apply(String,$.slice(C,C+=s));return I}function c($,A,I){let C="";I=Math.min($.length,I);for(let H=A;H<I;++H)C+=String.fromCharCode($[H]&127);return C}function m($,A,I){let C="";I=Math.min($.length,I);for(let H=A;H<I;++H)C+=String.fromCharCode($[H]);return C}function l($,A,I){let C=$.length;(!A||A<0)&&(A=0),(!I||I<0||I>C)&&(I=C);let H="";for(let ne=A;ne<I;++ne)H+=ce[$[ne]];return H}function t($,A,I){let C=$.slice(A,I),H="";for(let ne=0;ne<C.length-1;ne+=2)H+=String.fromCharCode(C[ne]+C[ne+1]*256);return H}b.prototype.slice=function(A,I){let C=this.length;A=~~A,I=I===void 0?C:~~I,A<0?(A+=C,A<0&&(A=0)):A>C&&(A=C),I<0?(I+=C,I<0&&(I=0)):I>C&&(I=C),I<A&&(I=A);let H=this.subarray(A,I);return Object.setPrototypeOf(H,b.prototype),H};function u($,A,I){if($%1!==0||$<0)throw new RangeError("offset is not uint");if($+A>I)throw new RangeError("Trying to access beyond buffer length")}b.prototype.readUintLE=b.prototype.readUIntLE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=this[A],ne=1,J=0;for(;++J<I&&(ne*=256);)H+=this[A+J]*ne;return H},b.prototype.readUintBE=b.prototype.readUIntBE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=this[A+--I],ne=1;for(;I>0&&(ne*=256);)H+=this[A+--I]*ne;return H},b.prototype.readUint8=b.prototype.readUInt8=function(A,I){return A=A>>>0,I||u(A,1,this.length),this[A]},b.prototype.readUint16LE=b.prototype.readUInt16LE=function(A,I){return A=A>>>0,I||u(A,2,this.length),this[A]|this[A+1]<<8},b.prototype.readUint16BE=b.prototype.readUInt16BE=function(A,I){return A=A>>>0,I||u(A,2,this.length),this[A]<<8|this[A+1]},b.prototype.readUint32LE=b.prototype.readUInt32LE=function(A,I){return A=A>>>0,I||u(A,4,this.length),(this[A]|this[A+1]<<8|this[A+2]<<16)+this[A+3]*16777216},b.prototype.readUint32BE=b.prototype.readUInt32BE=function(A,I){return A=A>>>0,I||u(A,4,this.length),this[A]*16777216+(this[A+1]<<16|this[A+2]<<8|this[A+3])},b.prototype.readBigUInt64LE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=I+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24,ne=this[++A]+this[++A]*2**8+this[++A]*2**16+C*2**24;return BigInt(H)+(BigInt(ne)<<BigInt(32))}),b.prototype.readBigUInt64BE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=I*2**24+this[++A]*2**16+this[++A]*2**8+this[++A],ne=this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+C;return(BigInt(H)<<BigInt(32))+BigInt(ne)}),b.prototype.readIntLE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=this[A],ne=1,J=0;for(;++J<I&&(ne*=256);)H+=this[A+J]*ne;return ne*=128,H>=ne&&(H-=Math.pow(2,8*I)),H},b.prototype.readIntBE=function(A,I,C){A=A>>>0,I=I>>>0,C||u(A,I,this.length);let H=I,ne=1,J=this[A+--H];for(;H>0&&(ne*=256);)J+=this[A+--H]*ne;return ne*=128,J>=ne&&(J-=Math.pow(2,8*I)),J},b.prototype.readInt8=function(A,I){return A=A>>>0,I||u(A,1,this.length),this[A]&128?(255-this[A]+1)*-1:this[A]},b.prototype.readInt16LE=function(A,I){A=A>>>0,I||u(A,2,this.length);let C=this[A]|this[A+1]<<8;return C&32768?C|4294901760:C},b.prototype.readInt16BE=function(A,I){A=A>>>0,I||u(A,2,this.length);let C=this[A+1]|this[A]<<8;return C&32768?C|4294901760:C},b.prototype.readInt32LE=function(A,I){return A=A>>>0,I||u(A,4,this.length),this[A]|this[A+1]<<8|this[A+2]<<16|this[A+3]<<24},b.prototype.readInt32BE=function(A,I){return A=A>>>0,I||u(A,4,this.length),this[A]<<24|this[A+1]<<16|this[A+2]<<8|this[A+3]},b.prototype.readBigInt64LE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=this[A+4]+this[A+5]*2**8+this[A+6]*2**16+(C<<24);return(BigInt(H)<<BigInt(32))+BigInt(I+this[++A]*2**8+this[++A]*2**16+this[++A]*2**24)}),b.prototype.readBigInt64BE=be(function(A){A=A>>>0,j(A,"offset");let I=this[A],C=this[A+7];(I===void 0||C===void 0)&&V(A,this.length-8);let H=(I<<24)+this[++A]*2**16+this[++A]*2**8+this[++A];return(BigInt(H)<<BigInt(32))+BigInt(this[++A]*2**24+this[++A]*2**16+this[++A]*2**8+C)}),b.prototype.readFloatLE=function(A,I){return A=A>>>0,I||u(A,4,this.length),o.read(this,A,!0,23,4)},b.prototype.readFloatBE=function(A,I){return A=A>>>0,I||u(A,4,this.length),o.read(this,A,!1,23,4)},b.prototype.readDoubleLE=function(A,I){return A=A>>>0,I||u(A,8,this.length),o.read(this,A,!0,52,8)},b.prototype.readDoubleBE=function(A,I){return A=A>>>0,I||u(A,8,this.length),o.read(this,A,!1,52,8)};function S($,A,I,C,H,ne){if(!b.isBuffer($))throw new TypeError('"buffer" argument must be a Buffer instance');if(A>H||A<ne)throw new RangeError('"value" argument is out of bounds');if(I+C>$.length)throw new RangeError("Index out of range")}b.prototype.writeUintLE=b.prototype.writeUIntLE=function(A,I,C,H){if(A=+A,I=I>>>0,C=C>>>0,!H){let de=Math.pow(2,8*C)-1;S(this,A,I,C,de,0)}let ne=1,J=0;for(this[I]=A&255;++J<C&&(ne*=256);)this[I+J]=A/ne&255;return I+C},b.prototype.writeUintBE=b.prototype.writeUIntBE=function(A,I,C,H){if(A=+A,I=I>>>0,C=C>>>0,!H){let de=Math.pow(2,8*C)-1;S(this,A,I,C,de,0)}let ne=C-1,J=1;for(this[I+ne]=A&255;--ne>=0&&(J*=256);)this[I+ne]=A/J&255;return I+C},b.prototype.writeUint8=b.prototype.writeUInt8=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,1,255,0),this[I]=A&255,I+1},b.prototype.writeUint16LE=b.prototype.writeUInt16LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,65535,0),this[I]=A&255,this[I+1]=A>>>8,I+2},b.prototype.writeUint16BE=b.prototype.writeUInt16BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,65535,0),this[I]=A>>>8,this[I+1]=A&255,I+2},b.prototype.writeUint32LE=b.prototype.writeUInt32LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,4294967295,0),this[I+3]=A>>>24,this[I+2]=A>>>16,this[I+1]=A>>>8,this[I]=A&255,I+4},b.prototype.writeUint32BE=b.prototype.writeUInt32BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,4294967295,0),this[I]=A>>>24,this[I+1]=A>>>16,this[I+2]=A>>>8,this[I+3]=A&255,I+4};function B($,A,I,C,H){Y(A,C,H,$,I,7);let ne=Number(A&BigInt(4294967295));$[I++]=ne,ne=ne>>8,$[I++]=ne,ne=ne>>8,$[I++]=ne,ne=ne>>8,$[I++]=ne;let J=Number(A>>BigInt(32)&BigInt(4294967295));return $[I++]=J,J=J>>8,$[I++]=J,J=J>>8,$[I++]=J,J=J>>8,$[I++]=J,I}function k($,A,I,C,H){Y(A,C,H,$,I,7);let ne=Number(A&BigInt(4294967295));$[I+7]=ne,ne=ne>>8,$[I+6]=ne,ne=ne>>8,$[I+5]=ne,ne=ne>>8,$[I+4]=ne;let J=Number(A>>BigInt(32)&BigInt(4294967295));return $[I+3]=J,J=J>>8,$[I+2]=J,J=J>>8,$[I+1]=J,J=J>>8,$[I]=J,I+8}b.prototype.writeBigUInt64LE=be(function(A,I=0){return B(this,A,I,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeBigUInt64BE=be(function(A,I=0){return k(this,A,I,BigInt(0),BigInt("0xffffffffffffffff"))}),b.prototype.writeIntLE=function(A,I,C,H){if(A=+A,I=I>>>0,!H){let st=Math.pow(2,8*C-1);S(this,A,I,C,st-1,-st)}let ne=0,J=1,de=0;for(this[I]=A&255;++ne<C&&(J*=256);)A<0&&de===0&&this[I+ne-1]!==0&&(de=1),this[I+ne]=(A/J>>0)-de&255;return I+C},b.prototype.writeIntBE=function(A,I,C,H){if(A=+A,I=I>>>0,!H){let st=Math.pow(2,8*C-1);S(this,A,I,C,st-1,-st)}let ne=C-1,J=1,de=0;for(this[I+ne]=A&255;--ne>=0&&(J*=256);)A<0&&de===0&&this[I+ne+1]!==0&&(de=1),this[I+ne]=(A/J>>0)-de&255;return I+C},b.prototype.writeInt8=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,1,127,-128),A<0&&(A=255+A+1),this[I]=A&255,I+1},b.prototype.writeInt16LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,32767,-32768),this[I]=A&255,this[I+1]=A>>>8,I+2},b.prototype.writeInt16BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,2,32767,-32768),this[I]=A>>>8,this[I+1]=A&255,I+2},b.prototype.writeInt32LE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,2147483647,-2147483648),this[I]=A&255,this[I+1]=A>>>8,this[I+2]=A>>>16,this[I+3]=A>>>24,I+4},b.prototype.writeInt32BE=function(A,I,C){return A=+A,I=I>>>0,C||S(this,A,I,4,2147483647,-2147483648),A<0&&(A=4294967295+A+1),this[I]=A>>>24,this[I+1]=A>>>16,this[I+2]=A>>>8,this[I+3]=A&255,I+4},b.prototype.writeBigInt64LE=be(function(A,I=0){return B(this,A,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),b.prototype.writeBigInt64BE=be(function(A,I=0){return k(this,A,I,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function q($,A,I,C,H,ne){if(I+C>$.length)throw new RangeError("Index out of range");if(I<0)throw new RangeError("Index out of range")}function F($,A,I,C,H){return A=+A,I=I>>>0,H||q($,A,I,4),o.write($,A,I,C,23,4),I+4}b.prototype.writeFloatLE=function(A,I,C){return F(this,A,I,!0,C)},b.prototype.writeFloatBE=function(A,I,C){return F(this,A,I,!1,C)};function ee($,A,I,C,H){return A=+A,I=I>>>0,H||q($,A,I,8),o.write($,A,I,C,52,8),I+8}b.prototype.writeDoubleLE=function(A,I,C){return ee(this,A,I,!0,C)},b.prototype.writeDoubleBE=function(A,I,C){return ee(this,A,I,!1,C)},b.prototype.copy=function(A,I,C,H){if(!b.isBuffer(A))throw new TypeError("argument should be a Buffer");if(C||(C=0),!H&&H!==0&&(H=this.length),I>=A.length&&(I=A.length),I||(I=0),H>0&&H<C&&(H=C),H===C||A.length===0||this.length===0)return 0;if(I<0)throw new RangeError("targetStart out of bounds");if(C<0||C>=this.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("sourceEnd out of bounds");H>this.length&&(H=this.length),A.length-I<H-C&&(H=A.length-I+C);let ne=H-C;return this===A&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(I,C,H):Uint8Array.prototype.set.call(A,this.subarray(C,H),I),ne},b.prototype.fill=function(A,I,C,H){if(typeof A=="string"){if(typeof I=="string"?(H=I,I=0,C=this.length):typeof C=="string"&&(H=C,C=this.length),H!==void 0&&typeof H!="string")throw new TypeError("encoding must be a string");if(typeof H=="string"&&!b.isEncoding(H))throw new TypeError("Unknown encoding: "+H);if(A.length===1){let J=A.charCodeAt(0);(H==="utf8"&&J<128||H==="latin1")&&(A=J)}}else typeof A=="number"?A=A&255:typeof A=="boolean"&&(A=Number(A));if(I<0||this.length<I||this.length<C)throw new RangeError("Out of range index");if(C<=I)return this;I=I>>>0,C=C===void 0?this.length:C>>>0,A||(A=0);let ne;if(typeof A=="number")for(ne=I;ne<C;++ne)this[ne]=A;else{let J=b.isBuffer(A)?A:b.from(A,H),de=J.length;if(de===0)throw new TypeError('The value "'+A+'" is invalid for argument "value"');for(ne=0;ne<C-I;++ne)this[ne+I]=J[ne%de]}return this};let te={};function O($,A,I){te[$]=class extends I{constructor(){super(),Object.defineProperty(this,"message",{value:A.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${$}]`,this.stack,delete this.name}get code(){return $}set code(H){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:H,writable:!0})}toString(){return`${this.name} [${$}]: ${this.message}`}}}O("ERR_BUFFER_OUT_OF_BOUNDS",function($){return $?`${$} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),O("ERR_INVALID_ARG_TYPE",function($,A){return`The "${$}" argument must be of type number. Received type ${typeof A}`},TypeError),O("ERR_OUT_OF_RANGE",function($,A,I){let C=`The value of "${$}" is out of range.`,H=I;return Number.isInteger(I)&&Math.abs(I)>2**32?H=U(String(I)):typeof I=="bigint"&&(H=String(I),(I>BigInt(2)**BigInt(32)||I<-(BigInt(2)**BigInt(32)))&&(H=U(H)),H+="n"),C+=` It must be ${A}. Received ${H}`,C},RangeError);function U($){let A="",I=$.length,C=$[0]==="-"?1:0;for(;I>=C+4;I-=3)A=`_${$.slice(I-3,I)}${A}`;return`${$.slice(0,I)}${A}`}function oe($,A,I){j(A,"offset"),($[A]===void 0||$[A+I]===void 0)&&V(A,$.length-(I+1))}function Y($,A,I,C,H,ne){if($>I||$<A){let J=typeof A=="bigint"?"n":"",de;throw A===0||A===BigInt(0)?de=`>= 0${J} and < 2${J} ** ${(ne+1)*8}${J}`:de=`>= -(2${J} ** ${(ne+1)*8-1}${J}) and < 2 ** ${(ne+1)*8-1}${J}`,new te.ERR_OUT_OF_RANGE("value",de,$)}oe(C,H,ne)}function j($,A){if(typeof $!="number")throw new te.ERR_INVALID_ARG_TYPE(A,"number",$)}function V($,A,I){throw Math.floor($)!==$?(j($,I),new te.ERR_OUT_OF_RANGE("offset","an integer",$)):A<0?new te.ERR_BUFFER_OUT_OF_BOUNDS:new te.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${A}`,$)}let G=/[^+/0-9A-Za-z-_]/g;function ie($){if($=$.split("=")[0],$=$.trim().replace(G,""),$.length<2)return"";for(;$.length%4!==0;)$=$+"=";return $}function me($,A){A=A||1/0;let I,C=$.length,H=null,ne=[];for(let J=0;J<C;++J){if(I=$.charCodeAt(J),I>55295&&I<57344){if(!H){if(I>56319){(A-=3)>-1&&ne.push(239,191,189);continue}else if(J+1===C){(A-=3)>-1&&ne.push(239,191,189);continue}H=I;continue}if(I<56320){(A-=3)>-1&&ne.push(239,191,189),H=I;continue}I=(H-55296<<10|I-56320)+65536}else H&&(A-=3)>-1&&ne.push(239,191,189);if(H=null,I<128){if((A-=1)<0)break;ne.push(I)}else if(I<2048){if((A-=2)<0)break;ne.push(I>>6|192,I&63|128)}else if(I<65536){if((A-=3)<0)break;ne.push(I>>12|224,I>>6&63|128,I&63|128)}else if(I<1114112){if((A-=4)<0)break;ne.push(I>>18|240,I>>12&63|128,I>>6&63|128,I&63|128)}else throw new Error("Invalid code point")}return ne}function re($){let A=[];for(let I=0;I<$.length;++I)A.push($.charCodeAt(I)&255);return A}function ae($,A){let I,C,H,ne=[];for(let J=0;J<$.length&&!((A-=2)<0);++J)I=$.charCodeAt(J),C=I>>8,H=I%256,ne.push(H),ne.push(C);return ne}function ye($){return a.toByteArray(ie($))}function fe($,A,I,C){let H;for(H=0;H<C&&!(H+I>=A.length||H>=$.length);++H)A[H+I]=$[H];return H}function he($,A){return $ instanceof A||$!=null&&$.constructor!=null&&$.constructor.name!=null&&$.constructor.name===A.name}function nt($){return $!==$}let ce=function(){let $="0123456789abcdef",A=new Array(256);for(let I=0;I<16;++I){let C=I*16;for(let H=0;H<16;++H)A[C+H]=$[I]+$[H]}return A}();function be($){return typeof BigInt>"u"?ut:$}function ut(){throw new Error("BigInt not supported")}return Ru}var Xme,x1,yH,I6,wH,Ru,MH,Iu,aa,ghe,yhe,T6=Eh(()=>{Xme=Ae(Be());Ie();Re();x1={},yH=!1;I6={},wH=!1;Ru={},MH=!1;Iu=mhe();Iu.Buffer;Iu.SlowBuffer;Iu.INSPECT_MAX_BYTES;Iu.kMaxLength;aa=Iu.Buffer,ghe=Iu.INSPECT_MAX_BYTES,yhe=Iu.kMaxLength;});var Tu={};wp(Tu,{Buffer:()=>aa,INSPECT_MAX_BYTES:()=>ghe,kMaxLength:()=>yhe});var t8e,ku=Eh(()=>{t8e=Ae(Be());Ie();Re();T6()});var $6=St((a8e,_H)=>{"use strict";var o8e=Ae(Be());Ie();Re();var k6=(ku(),f0(Tu)),sd=k6.Buffer,Io={},To;for(To in k6)k6.hasOwnProperty(To)&&(To==="SlowBuffer"||To==="Buffer"||(Io[To]=k6[To]));var fd=Io.Buffer={};for(To in sd)sd.hasOwnProperty(To)&&(To==="allocUnsafe"||To==="allocUnsafeSlow"||(fd[To]=sd[To]));Io.Buffer.prototype=sd.prototype;(!fd.from||fd.from===Uint8Array.from)&&(fd.from=function(a,o,f){if(typeof a=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof a);if(a&&typeof a.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof a);return sd(a,o,f)});fd.alloc||(fd.alloc=function(a,o,f){if(typeof a!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof a);if(a<0||a>=2*(1<<30))throw new RangeError('The value "'+a+'" is invalid for option "size"');var d=sd(a);return!o||o.length===0?d.fill(0):typeof f=="string"?d.fill(o,f):d.fill(o),d});if(!Io.kStringMaxLength)try{Io.kStringMaxLength=ft.default.binding("buffer").kStringMaxLength}catch{}Io.constants||(Io.constants={MAX_LENGTH:Io.kMaxLength},Io.kStringMaxLength&&(Io.constants.MAX_STRING_LENGTH=Io.kStringMaxLength));_H.exports=Io});var P6=St(xH=>{"use strict";var u8e=Ae(Be());Ie();Re();var whe=Cn();function ko(a){this._reporterState={obj:null,path:[],options:a||{},errors:[]}}xH.Reporter=ko;ko.prototype.isError=function(o){return o instanceof hd};ko.prototype.save=function(){let o=this._reporterState;return{obj:o.obj,pathLen:o.path.length}};ko.prototype.restore=function(o){let f=this._reporterState;f.obj=o.obj,f.path=f.path.slice(0,o.pathLen)};ko.prototype.enterKey=function(o){return this._reporterState.path.push(o)};ko.prototype.exitKey=function(o){let f=this._reporterState;f.path=f.path.slice(0,o-1)};ko.prototype.leaveKey=function(o,f,d){let n=this._reporterState;this.exitKey(o),n.obj!==null&&(n.obj[f]=d)};ko.prototype.path=function(){return this._reporterState.path.join("/")};ko.prototype.enterObject=function(){let o=this._reporterState,f=o.obj;return o.obj={},f};ko.prototype.leaveObject=function(o){let f=this._reporterState,d=f.obj;return f.obj=o,d};ko.prototype.error=function(o){let f,d=this._reporterState,n=o instanceof hd;if(n?f=o:f=new hd(d.path.map(function(v){return"["+JSON.stringify(v)+"]"}).join(""),o.message||o,o.stack),!d.options.partial)throw f;return n||d.errors.push(f),f};ko.prototype.wrapResult=function(o){let f=this._reporterState;return f.options.partial?{result:this.isError(o)?null:o,errors:f.errors}:o};function hd(a,o){this.path=a,this.rethrow(o)}whe(hd,Error);hd.prototype.rethrow=function(o){if(this.message=o+" at: "+(this.path||"(shallow)"),Error.captureStackTrace&&Error.captureStackTrace(this,hd),!this.stack)try{throw new Error(this.message)}catch(f){this.stack=f.stack}return this}});var dd=St(j_=>{"use strict";var p8e=Ae(Be());Ie();Re();var Mhe=Cn(),N6=P6().Reporter,ud=$6().Buffer;function $o(a,o){if(N6.call(this,o),!ud.isBuffer(a)){this.error("Input not Buffer");return}this.base=a,this.offset=0,this.length=a.length}Mhe($o,N6);j_.DecoderBuffer=$o;$o.isDecoderBuffer=function(o){return o instanceof $o?!0:typeof o=="object"&&ud.isBuffer(o.base)&&o.constructor.name==="DecoderBuffer"&&typeof o.offset=="number"&&typeof o.length=="number"&&typeof o.save=="function"&&typeof o.restore=="function"&&typeof o.isEmpty=="function"&&typeof o.readUInt8=="function"&&typeof o.skip=="function"&&typeof o.raw=="function"};$o.prototype.save=function(){return{offset:this.offset,reporter:N6.prototype.save.call(this)}};$o.prototype.restore=function(o){let f=new $o(this.base);return f.offset=o.offset,f.length=this.offset,this.offset=o.offset,N6.prototype.restore.call(this,o.reporter),f};$o.prototype.isEmpty=function(){return this.offset===this.length};$o.prototype.readUInt8=function(o){return this.offset+1<=this.length?this.base.readUInt8(this.offset++,!0):this.error(o||"DecoderBuffer overrun")};$o.prototype.skip=function(o,f){if(!(this.offset+o<=this.length))return this.error(f||"DecoderBuffer overrun");let d=new $o(this.base);return d._reporterState=this._reporterState,d.offset=this.offset,d.length=this.offset+o,this.offset+=o,d};$o.prototype.raw=function(o){return this.base.slice(o?o.offset:this.offset,this.length)};function ld(a,o){if(Array.isArray(a))this.length=0,this.value=a.map(function(f){return ld.isEncoderBuffer(f)||(f=new ld(f,o)),this.length+=f.length,f},this);else if(typeof a=="number"){if(!(0<=a&&a<=255))return o.error("non-byte EncoderBuffer value");this.value=a,this.length=1}else if(typeof a=="string")this.value=a,this.length=ud.byteLength(a);else if(ud.isBuffer(a))this.value=a,this.length=a.length;else return o.error("Unsupported type: "+typeof a)}j_.EncoderBuffer=ld;ld.isEncoderBuffer=function(o){return o instanceof ld?!0:typeof o=="object"&&o.constructor.name==="EncoderBuffer"&&typeof o.length=="number"&&typeof o.join=="function"};ld.prototype.join=function(o,f){return o||(o=ud.alloc(this.length)),f||(f=0),this.length===0||(Array.isArray(this.value)?this.value.forEach(function(d){d.join(o,f),f+=d.length}):(typeof this.value=="number"?o[f]=this.value:typeof this.value=="string"?o.write(this.value,f):ud.isBuffer(this.value)&&this.value.copy(o,f),f+=this.length)),o}});var Hf=St((m8e,EH)=>{var g8e=Ae(Be());Ie();Re();EH.exports=SH;function SH(a,o){if(!a)throw new Error(o||"Assertion failed")}SH.equal=function(o,f,d){if(o!=f)throw new Error(d||"Assertion failed: "+o+" != "+f)}});var C6=St((M8e,BH)=>{"use strict";var _8e=Ae(Be());Ie();Re();var _he=P6().Reporter,xhe=dd().EncoderBuffer,She=dd().DecoderBuffer,oa=Hf(),AH=["seq","seqof","set","setof","objid","bool","gentime","utctime","null_","enum","int","objDesc","bitstr","bmpstr","charstr","genstr","graphstr","ia5str","iso646str","numstr","octstr","printstr","t61str","unistr","utf8str","videostr"],Ehe=["key","obj","use","optional","explicit","implicit","def","choice","any","contains"].concat(AH),Ahe=["_peekTag","_decodeTag","_use","_decodeStr","_decodeObjid","_decodeTime","_decodeNull","_decodeInt","_decodeBool","_decodeList","_encodeComposite","_encodeStr","_encodeObjid","_encodeTime","_encodeNull","_encodeInt","_encodeBool"];function ci(a,o,f){let d={};this._baseState=d,d.name=f,d.enc=a,d.parent=o||null,d.children=null,d.tag=null,d.args=null,d.reverseArgs=null,d.choice=null,d.optional=!1,d.any=!1,d.obj=!1,d.use=null,d.useDecoder=null,d.key=null,d.default=null,d.explicit=null,d.implicit=null,d.contains=null,d.parent||(d.children=[],this._wrap())}BH.exports=ci;var Bhe=["enc","parent","children","tag","args","reverseArgs","choice","optional","any","obj","use","alteredUse","key","default","explicit","implicit","contains"];ci.prototype.clone=function(){let o=this._baseState,f={};Bhe.forEach(function(n){f[n]=o[n]});let d=new this.constructor(f.parent);return d._baseState=f,d};ci.prototype._wrap=function(){let o=this._baseState;Ehe.forEach(function(f){this[f]=function(){let n=new this.constructor(this);return o.children.push(n),n[f].apply(n,arguments)}},this)};ci.prototype._init=function(o){let f=this._baseState;oa(f.parent===null),o.call(this),f.children=f.children.filter(function(d){return d._baseState.parent===this},this),oa.equal(f.children.length,1,"Root node can have only one child")};ci.prototype._useArgs=function(o){let f=this._baseState,d=o.filter(function(n){return n instanceof this.constructor},this);o=o.filter(function(n){return!(n instanceof this.constructor)},this),d.length!==0&&(oa(f.children===null),f.children=d,d.forEach(function(n){n._baseState.parent=this},this)),o.length!==0&&(oa(f.args===null),f.args=o,f.reverseArgs=o.map(function(n){if(typeof n!="object"||n.constructor!==Object)return n;let v={};return Object.keys(n).forEach(function(b){b==(b|0)&&(b|=0);let y=n[b];v[y]=b}),v}))};Ahe.forEach(function(a){ci.prototype[a]=function(){let f=this._baseState;throw new Error(a+" not implemented for encoding: "+f.enc)}});AH.forEach(function(a){ci.prototype[a]=function(){let f=this._baseState,d=Array.prototype.slice.call(arguments);return oa(f.tag===null),f.tag=a,this._useArgs(d),this}});ci.prototype.use=function(o){oa(o);let f=this._baseState;return oa(f.use===null),f.use=o,this};ci.prototype.optional=function(){let o=this._baseState;return o.optional=!0,this};ci.prototype.def=function(o){let f=this._baseState;return oa(f.default===null),f.default=o,f.optional=!0,this};ci.prototype.explicit=function(o){let f=this._baseState;return oa(f.explicit===null&&f.implicit===null),f.explicit=o,this};ci.prototype.implicit=function(o){let f=this._baseState;return oa(f.explicit===null&&f.implicit===null),f.implicit=o,this};ci.prototype.obj=function(){let o=this._baseState,f=Array.prototype.slice.call(arguments);return o.obj=!0,f.length!==0&&this._useArgs(f),this};ci.prototype.key=function(o){let f=this._baseState;return oa(f.key===null),f.key=o,this};ci.prototype.any=function(){let o=this._baseState;return o.any=!0,this};ci.prototype.choice=function(o){let f=this._baseState;return oa(f.choice===null),f.choice=o,this._useArgs(Object.keys(o).map(function(d){return o[d]})),this};ci.prototype.contains=function(o){let f=this._baseState;return oa(f.use===null),f.contains=o,this};ci.prototype._decode=function(o,f){let d=this._baseState;if(d.parent===null)return o.wrapResult(d.children[0]._decode(o,f));let n=d.default,v=!0,b=null;if(d.key!==null&&(b=o.enterKey(d.key)),d.optional){let M=null;if(d.explicit!==null?M=d.explicit:d.implicit!==null?M=d.implicit:d.tag!==null&&(M=d.tag),M===null&&!d.any){let w=o.save();try{d.choice===null?this._decodeGeneric(d.tag,o,f):this._decodeChoice(o,f),v=!0}catch{v=!1}o.restore(w)}else if(v=this._peekTag(o,M,d.any),o.isError(v))return v}let y;if(d.obj&&v&&(y=o.enterObject()),v){if(d.explicit!==null){let w=this._decodeTag(o,d.explicit);if(o.isError(w))return w;o=w}let M=o.offset;if(d.use===null&&d.choice===null){let w;d.any&&(w=o.save());let g=this._decodeTag(o,d.implicit!==null?d.implicit:d.tag,d.any);if(o.isError(g))return g;d.any?n=o.raw(w):o=g}if(f&&f.track&&d.tag!==null&&f.track(o.path(),M,o.length,"tagged"),f&&f.track&&d.tag!==null&&f.track(o.path(),o.offset,o.length,"content"),d.any||(d.choice===null?n=this._decodeGeneric(d.tag,o,f):n=this._decodeChoice(o,f)),o.isError(n))return n;if(!d.any&&d.choice===null&&d.children!==null&&d.children.forEach(function(g){g._decode(o,f)}),d.contains&&(d.tag==="octstr"||d.tag==="bitstr")){let w=new She(n);n=this._getUse(d.contains,o._reporterState.obj)._decode(w,f)}}return d.obj&&v&&(n=o.leaveObject(y)),d.key!==null&&(n!==null||v===!0)?o.leaveKey(b,d.key,n):b!==null&&o.exitKey(b),n};ci.prototype._decodeGeneric=function(o,f,d){let n=this._baseState;return o==="seq"||o==="set"?null:o==="seqof"||o==="setof"?this._decodeList(f,o,n.args[0],d):/str$/.test(o)?this._decodeStr(f,o,d):o==="objid"&&n.args?this._decodeObjid(f,n.args[0],n.args[1],d):o==="objid"?this._decodeObjid(f,null,null,d):o==="gentime"||o==="utctime"?this._decodeTime(f,o,d):o==="null_"?this._decodeNull(f,d):o==="bool"?this._decodeBool(f,d):o==="objDesc"?this._decodeStr(f,o,d):o==="int"||o==="enum"?this._decodeInt(f,n.args&&n.args[0],d):n.use!==null?this._getUse(n.use,f._reporterState.obj)._decode(f,d):f.error("unknown tag: "+o)};ci.prototype._getUse=function(o,f){let d=this._baseState;return d.useDecoder=this._use(o,f),oa(d.useDecoder._baseState.parent===null),d.useDecoder=d.useDecoder._baseState.children[0],d.implicit!==d.useDecoder._baseState.implicit&&(d.useDecoder=d.useDecoder.clone(),d.useDecoder._baseState.implicit=d.implicit),d.useDecoder};ci.prototype._decodeChoice=function(o,f){let d=this._baseState,n=null,v=!1;return Object.keys(d.choice).some(function(b){let y=o.save(),M=d.choice[b];try{let w=M._decode(o,f);if(o.isError(w))return!1;n={type:b,value:w},v=!0}catch{return o.restore(y),!1}return!0},this),v?n:o.error("Choice not matched")};ci.prototype._createEncoderBuffer=function(o){return new xhe(o,this.reporter)};ci.prototype._encode=function(o,f,d){let n=this._baseState;if(n.default!==null&&n.default===o)return;let v=this._encodeValue(o,f,d);if(v!==void 0&&!this._skipDefault(v,f,d))return v};ci.prototype._encodeValue=function(o,f,d){let n=this._baseState;if(n.parent===null)return n.children[0]._encode(o,f||new _he);let v=null;if(this.reporter=f,n.optional&&o===void 0)if(n.default!==null)o=n.default;else return;let b=null,y=!1;if(n.any)v=this._createEncoderBuffer(o);else if(n.choice)v=this._encodeChoice(o,f);else if(n.contains)b=this._getUse(n.contains,d)._encode(o,f),y=!0;else if(n.children)b=n.children.map(function(M){if(M._baseState.tag==="null_")return M._encode(null,f,o);if(M._baseState.key===null)return f.error("Child should have a key");let w=f.enterKey(M._baseState.key);if(typeof o!="object")return f.error("Child expected, but input is not object");let g=M._encode(o[M._baseState.key],f,o);return f.leaveKey(w),g},this).filter(function(M){return M}),b=this._createEncoderBuffer(b);else if(n.tag==="seqof"||n.tag==="setof"){if(!(n.args&&n.args.length===1))return f.error("Too many args for : "+n.tag);if(!Array.isArray(o))return f.error("seqof/setof, but data is not Array");let M=this.clone();M._baseState.implicit=null,b=this._createEncoderBuffer(o.map(function(w){let g=this._baseState;return this._getUse(g.args[0],o)._encode(w,f)},M))}else n.use!==null?v=this._getUse(n.use,d)._encode(o,f):(b=this._encodePrimitive(n.tag,o),y=!0);if(!n.any&&n.choice===null){let M=n.implicit!==null?n.implicit:n.tag,w=n.implicit===null?"universal":"context";M===null?n.use===null&&f.error("Tag could be omitted only for .use()"):n.use===null&&(v=this._encodeComposite(M,y,w,b))}return n.explicit!==null&&(v=this._encodeComposite(n.explicit,!1,"context",v)),v};ci.prototype._encodeChoice=function(o,f){let d=this._baseState,n=d.choice[o.type];return n||oa(!1,o.type+" not found in "+JSON.stringify(Object.keys(d.choice))),n._encode(o.value,f)};ci.prototype._encodePrimitive=function(o,f){let d=this._baseState;if(/str$/.test(o))return this._encodeStr(f,o);if(o==="objid"&&d.args)return this._encodeObjid(f,d.reverseArgs[0],d.args[1]);if(o==="objid")return this._encodeObjid(f,null,null);if(o==="gentime"||o==="utctime")return this._encodeTime(f,o);if(o==="null_")return this._encodeNull();if(o==="int"||o==="enum")return this._encodeInt(f,d.args&&d.reverseArgs[0]);if(o==="bool")return this._encodeBool(f);if(o==="objDesc")return this._encodeStr(f,o);throw new Error("Unsupported tag: "+o)};ci.prototype._isNumstr=function(o){return/^[0-9 ]*$/.test(o)};ci.prototype._isPrintstr=function(o){return/^[A-Za-z0-9 '()+,-./:=?]*$/.test(o)}});var L6=St($u=>{"use strict";var A8e=Ae(Be());Ie();Re();function RH(a){let o={};return Object.keys(a).forEach(function(f){(f|0)==f&&(f=f|0);let d=a[f];o[d]=f}),o}$u.tagClass={0:"universal",1:"application",2:"context",3:"private"};$u.tagClassByName=RH($u.tagClass);$u.tag={0:"end",1:"bool",2:"int",3:"bitstr",4:"octstr",5:"null_",6:"objid",7:"objDesc",8:"external",9:"real",10:"enum",11:"embed",12:"utf8str",13:"relativeOid",16:"seq",17:"set",18:"numstr",19:"printstr",20:"t61str",21:"videostr",22:"ia5str",23:"utctime",24:"gentime",25:"graphstr",26:"iso646str",27:"genstr",28:"unistr",29:"charstr",30:"bmpstr"};$u.tagByName=RH($u.tag)});var Z_=St((I8e,kH)=>{"use strict";var T8e=Ae(Be());Ie();Re();var Rhe=Cn(),Kf=$6().Buffer,IH=C6(),W_=L6();function TH(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new bs,this.tree._init(a.body)}kH.exports=TH;TH.prototype.encode=function(o,f){return this.tree._encode(o,f).join()};function bs(a){IH.call(this,"der",a)}Rhe(bs,IH);bs.prototype._encodeComposite=function(o,f,d,n){let v=Ihe(o,f,d,this.reporter);if(n.length<128){let M=Kf.alloc(2);return M[0]=v,M[1]=n.length,this._createEncoderBuffer([M,n])}let b=1;for(let M=n.length;M>=256;M>>=8)b++;let y=Kf.alloc(2+b);y[0]=v,y[1]=128|b;for(let M=1+b,w=n.length;w>0;M--,w>>=8)y[M]=w&255;return this._createEncoderBuffer([y,n])};bs.prototype._encodeStr=function(o,f){if(f==="bitstr")return this._createEncoderBuffer([o.unused|0,o.data]);if(f==="bmpstr"){let d=Kf.alloc(o.length*2);for(let n=0;n<o.length;n++)d.writeUInt16BE(o.charCodeAt(n),n*2);return this._createEncoderBuffer(d)}else return f==="numstr"?this._isNumstr(o)?this._createEncoderBuffer(o):this.reporter.error("Encoding of string type: numstr supports only digits and space"):f==="printstr"?this._isPrintstr(o)?this._createEncoderBuffer(o):this.reporter.error("Encoding of string type: printstr supports only latin upper and lower case letters, digits, space, apostrophe, left and rigth parenthesis, plus sign, comma, hyphen, dot, slash, colon, equal sign, question mark"):/str$/.test(f)?this._createEncoderBuffer(o):f==="objDesc"?this._createEncoderBuffer(o):this.reporter.error("Encoding of string type: "+f+" unsupported")};bs.prototype._encodeObjid=function(o,f,d){if(typeof o=="string"){if(!f)return this.reporter.error("string objid given, but no values map found");if(!f.hasOwnProperty(o))return this.reporter.error("objid not found in values map");o=f[o].split(/[\s.]+/g);for(let y=0;y<o.length;y++)o[y]|=0}else if(Array.isArray(o)){o=o.slice();for(let y=0;y<o.length;y++)o[y]|=0}if(!Array.isArray(o))return this.reporter.error("objid() should be either array or string, got: "+JSON.stringify(o));if(!d){if(o[1]>=40)return this.reporter.error("Second objid identifier OOB");o.splice(0,2,o[0]*40+o[1])}let n=0;for(let y=0;y<o.length;y++){let M=o[y];for(n++;M>=128;M>>=7)n++}let v=Kf.alloc(n),b=v.length-1;for(let y=o.length-1;y>=0;y--){let M=o[y];for(v[b--]=M&127;(M>>=7)>0;)v[b--]=128|M&127}return this._createEncoderBuffer(v)};function Po(a){return a<10?"0"+a:a}bs.prototype._encodeTime=function(o,f){let d,n=new Date(o);return f==="gentime"?d=[Po(n.getUTCFullYear()),Po(n.getUTCMonth()+1),Po(n.getUTCDate()),Po(n.getUTCHours()),Po(n.getUTCMinutes()),Po(n.getUTCSeconds()),"Z"].join(""):f==="utctime"?d=[Po(n.getUTCFullYear()%100),Po(n.getUTCMonth()+1),Po(n.getUTCDate()),Po(n.getUTCHours()),Po(n.getUTCMinutes()),Po(n.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+f+" time is not supported yet"),this._encodeStr(d,"octstr")};bs.prototype._encodeNull=function(){return this._createEncoderBuffer("")};bs.prototype._encodeInt=function(o,f){if(typeof o=="string"){if(!f)return this.reporter.error("String int or enum given, but no values map");if(!f.hasOwnProperty(o))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(o));o=f[o]}if(typeof o!="number"&&!Kf.isBuffer(o)){let v=o.toArray();!o.sign&&v[0]&128&&v.unshift(0),o=Kf.from(v)}if(Kf.isBuffer(o)){let v=o.length;o.length===0&&v++;let b=Kf.alloc(v);return o.copy(b),o.length===0&&(b[0]=0),this._createEncoderBuffer(b)}if(o<128)return this._createEncoderBuffer(o);if(o<256)return this._createEncoderBuffer([0,o]);let d=1;for(let v=o;v>=256;v>>=8)d++;let n=new Array(d);for(let v=n.length-1;v>=0;v--)n[v]=o&255,o>>=8;return n[0]&128&&n.unshift(0),this._createEncoderBuffer(Kf.from(n))};bs.prototype._encodeBool=function(o){return this._createEncoderBuffer(o?255:0)};bs.prototype._use=function(o,f){return typeof o=="function"&&(o=o(f)),o._getEncoder("der").tree};bs.prototype._skipDefault=function(o,f,d){let n=this._baseState,v;if(n.default===null)return!1;let b=o.join();if(n.defaultBuffer===void 0&&(n.defaultBuffer=this._encodeValue(n.default,f,d).join()),b.length!==n.defaultBuffer.length)return!1;for(v=0;v<b.length;v++)if(b[v]!==n.defaultBuffer[v])return!1;return!0};function Ihe(a,o,f,d){let n;if(a==="seqof"?a="seq":a==="setof"&&(a="set"),W_.tagByName.hasOwnProperty(a))n=W_.tagByName[a];else if(typeof a=="number"&&(a|0)===a)n=a;else return d.error("Unknown tag: "+a);return n>=31?d.error("Multi-octet tag encoding unsupported"):(o||(n|=32),n|=W_.tagClassByName[f||"universal"]<<6,n)}});var PH=St((P8e,$H)=>{"use strict";var N8e=Ae(Be());Ie();Re();var The=Cn(),G_=Z_();function V_(a){G_.call(this,a),this.enc="pem"}The(V_,G_);$H.exports=V_;V_.prototype.encode=function(o,f){let n=G_.prototype.encode.call(this,o).toString("base64"),v=["-----BEGIN "+f.label+"-----"];for(let b=0;b<n.length;b+=64)v.push(n.slice(b,b+64));return v.push("-----END "+f.label+"-----"),v.join(`
|
|
5
5
|
`)}});var J_=St(CH=>{"use strict";var O8e=Ae(Be());Ie();Re();var NH=CH;NH.der=Z_();NH.pem=PH()});var X_=St((F8e,FH)=>{"use strict";var z8e=Ae(Be());Ie();Re();var khe=Cn(),$he=H_(),LH=dd().DecoderBuffer,OH=C6(),DH=L6();function qH(a){this.enc="der",this.name=a.name,this.entity=a,this.tree=new Ua,this.tree._init(a.body)}FH.exports=qH;qH.prototype.decode=function(o,f){return LH.isDecoderBuffer(o)||(o=new LH(o,f)),this.tree._decode(o,f)};function Ua(a){OH.call(this,"der",a)}khe(Ua,OH);Ua.prototype._peekTag=function(o,f,d){if(o.isEmpty())return!1;let n=o.save(),v=Y_(o,'Failed to peek tag: "'+f+'"');return o.isError(v)?v:(o.restore(n),v.tag===f||v.tagStr===f||v.tagStr+"of"===f||d)};Ua.prototype._decodeTag=function(o,f,d){let n=Y_(o,'Failed to decode tag of "'+f+'"');if(o.isError(n))return n;let v=UH(o,n.primitive,'Failed to get length of "'+f+'"');if(o.isError(v))return v;if(!d&&n.tag!==f&&n.tagStr!==f&&n.tagStr+"of"!==f)return o.error('Failed to match tag: "'+f+'"');if(n.primitive||v!==null)return o.skip(v,'Failed to match body of: "'+f+'"');let b=o.save(),y=this._skipUntilEnd(o,'Failed to skip indefinite length body: "'+this.tag+'"');return o.isError(y)?y:(v=o.offset-b.offset,o.restore(b),o.skip(v,'Failed to match body of: "'+f+'"'))};Ua.prototype._skipUntilEnd=function(o,f){for(;;){let d=Y_(o,f);if(o.isError(d))return d;let n=UH(o,d.primitive,f);if(o.isError(n))return n;let v;if(d.primitive||n!==null?v=o.skip(n):v=this._skipUntilEnd(o,f),o.isError(v))return v;if(d.tagStr==="end")break}};Ua.prototype._decodeList=function(o,f,d,n){let v=[];for(;!o.isEmpty();){let b=this._peekTag(o,"end");if(o.isError(b))return b;let y=d.decode(o,"der",n);if(o.isError(y)&&b)break;v.push(y)}return v};Ua.prototype._decodeStr=function(o,f){if(f==="bitstr"){let d=o.readUInt8();return o.isError(d)?d:{unused:d,data:o.raw()}}else if(f==="bmpstr"){let d=o.raw();if(d.length%2===1)return o.error("Decoding of string type: bmpstr length mismatch");let n="";for(let v=0;v<d.length/2;v++)n+=String.fromCharCode(d.readUInt16BE(v*2));return n}else if(f==="numstr"){let d=o.raw().toString("ascii");return this._isNumstr(d)?d:o.error("Decoding of string type: numstr unsupported characters")}else{if(f==="octstr")return o.raw();if(f==="objDesc")return o.raw();if(f==="printstr"){let d=o.raw().toString("ascii");return this._isPrintstr(d)?d:o.error("Decoding of string type: printstr unsupported characters")}else return/str$/.test(f)?o.raw().toString():o.error("Decoding of string type: "+f+" unsupported")}};Ua.prototype._decodeObjid=function(o,f,d){let n,v=[],b=0,y=0;for(;!o.isEmpty();)y=o.readUInt8(),b<<=7,b|=y&127,y&128||(v.push(b),b=0);y&128&&v.push(b);let M=v[0]/40|0,w=v[0]%40;if(d?n=v:n=[M,w].concat(v.slice(1)),f){let g=f[n.join(" ")];g===void 0&&(g=f[n.join(".")]),g!==void 0&&(n=g)}return n};Ua.prototype._decodeTime=function(o,f){let d=o.raw().toString(),n,v,b,y,M,w;if(f==="gentime")n=d.slice(0,4)|0,v=d.slice(4,6)|0,b=d.slice(6,8)|0,y=d.slice(8,10)|0,M=d.slice(10,12)|0,w=d.slice(12,14)|0;else if(f==="utctime")n=d.slice(0,2)|0,v=d.slice(2,4)|0,b=d.slice(4,6)|0,y=d.slice(6,8)|0,M=d.slice(8,10)|0,w=d.slice(10,12)|0,n<70?n=2e3+n:n=1900+n;else return o.error("Decoding "+f+" time is not supported yet");return Date.UTC(n,v-1,b,y,M,w,0)};Ua.prototype._decodeNull=function(){return null};Ua.prototype._decodeBool=function(o){let f=o.readUInt8();return o.isError(f)?f:f!==0};Ua.prototype._decodeInt=function(o,f){let d=o.raw(),n=new $he(d);return f&&(n=f[n.toString(10)]||n),n};Ua.prototype._use=function(o,f){return typeof o=="function"&&(o=o(f)),o._getDecoder("der").tree};function Y_(a,o){let f=a.readUInt8(o);if(a.isError(f))return f;let d=DH.tagClass[f>>6],n=(f&32)===0;if((f&31)===31){let b=f;for(f=0;(b&128)===128;){if(b=a.readUInt8(o),a.isError(b))return b;f<<=7,f|=b&127}}else f&=31;let v=DH.tag[f];return{cls:d,primitive:n,tag:f,tagStr:v}}function UH(a,o,f){let d=a.readUInt8(f);if(a.isError(d))return d;if(!o&&d===128)return null;if(!(d&128))return d;let n=d&127;if(n>4)return a.error("length octect is too long");d=0;for(let v=0;v<n;v++){d<<=8;let b=a.readUInt8(f);if(a.isError(b))return b;d|=b}return d}});var HH=St((j8e,zH)=>{"use strict";var W8e=Ae(Be());Ie();Re();var Phe=Cn(),Nhe=$6().Buffer,Q_=X_();function ex(a){Q_.call(this,a),this.enc="pem"}Phe(ex,Q_);zH.exports=ex;ex.prototype.decode=function(o,f){let d=o.toString().split(/[\r\n]+/g),n=f.label.toUpperCase(),v=/^-----(BEGIN|END) ([^-]+)-----$/,b=-1,y=-1;for(let g=0;g<d.length;g++){let _=d[g].match(v);if(_!==null&&_[2]===n)if(b===-1){if(_[1]!=="BEGIN")break;b=g}else{if(_[1]!=="END")break;y=g;break}}if(b===-1||y===-1)throw new Error("PEM section not found for: "+n);let M=d.slice(b+1,y).join("");M.replace(/[^a-z0-9+/=]+/gi,"");let w=Nhe.from(M,"base64");return Q_.prototype.decode.call(this,w,f)}});var tx=St(jH=>{"use strict";var J8e=Ae(Be());Ie();Re();var KH=jH;KH.der=X_();KH.pem=HH()});var ZH=St(WH=>{"use strict";var ege=Ae(Be());Ie();Re();var Che=J_(),Lhe=tx(),Dhe=Cn(),Ohe=WH;Ohe.define=function(o,f){return new cd(o,f)};function cd(a,o){this.name=a,this.body=o,this.decoders={},this.encoders={}}cd.prototype._createNamed=function(o){let f=this.name;function d(n){this._initNamed(n,f)}return Dhe(d,o),d.prototype._initNamed=function(v,b){o.call(this,v,b)},new d(this)};cd.prototype._getDecoder=function(o){return o=o||"der",this.decoders.hasOwnProperty(o)||(this.decoders[o]=this._createNamed(Lhe[o])),this.decoders[o]};cd.prototype.decode=function(o,f,d){return this._getDecoder(f).decode(o,d)};cd.prototype._getEncoder=function(o){return o=o||"der",this.encoders.hasOwnProperty(o)||(this.encoders[o]=this._createNamed(Che[o])),this.encoders[o]};cd.prototype.encode=function(o,f,d){return this._getEncoder(f).encode(o,d)}});var VH=St(GH=>{"use strict";var nge=Ae(Be());Ie();Re();var D6=GH;D6.Reporter=P6().Reporter;D6.DecoderBuffer=dd().DecoderBuffer;D6.EncoderBuffer=dd().EncoderBuffer;D6.Node=C6()});var XH=St(YH=>{"use strict";var fge=Ae(Be());Ie();Re();var JH=YH;JH._reverse=function(o){let f={};return Object.keys(o).forEach(function(d){(d|0)==d&&(d=d|0);let n=o[d];f[n]=d}),f};JH.der=L6()});var eK=St(QH=>{"use strict";var dge=Ae(Be());Ie();Re();var pd=QH;pd.bignum=H_();pd.define=ZH().define;pd.base=VH();pd.constants=XH();pd.decoders=tx();pd.encoders=J_()});var fK=St(tf=>{"use strict";var bge=Ae(Be());Ie();Re();var qhe=tf&&tf.__createBinding||(Object.create?function(a,o,f,d){d===void 0&&(d=f);var n=Object.getOwnPropertyDescriptor(o,f);(!n||("get"in n?!o.__esModule:n.writable||n.configurable))&&(n={enumerable:!0,get:function(){return o[f]}}),Object.defineProperty(a,d,n)}:function(a,o,f,d){d===void 0&&(d=f),a[d]=o[f]}),Uhe=tf&&tf.__setModuleDefault||(Object.create?function(a,o){Object.defineProperty(a,"default",{enumerable:!0,value:o})}:function(a,o){a.default=o}),Fhe=tf&&tf.__importStar||function(a){if(a&&a.__esModule)return a;var o={};if(a!=null)for(var f in a)f!=="default"&&Object.prototype.hasOwnProperty.call(a,f)&&qhe(o,a,f);return Uhe(o,a),o};Object.defineProperty(tf,"__esModule",{value:!0});tf.pemTojwk=Yhe;tf.jwkTopem=Xhe;var jf=Fhe(eK());function zhe(a){return a.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function rx(a){return zhe(at.from(a,"hex").toString("base64"))}var tK=jf.define("RSAPublicKey",function(){this.seq().obj(this.key("n").int(),this.key("e").int())}),rK=jf.define("AlgorithmIdentifier",function(){this.seq().obj(this.key("algorithm").objid(),this.key("parameters").optional().any())}),Hhe=jf.define("PublicKeyInfo",function(){this.seq().obj(this.key("algorithm").use(rK),this.key("publicKey").bitstr())}),iK=jf.define("Version",function(){this.int({0:"two-prime",1:"multi"})}),Khe=jf.define("OtherPrimeInfos",function(){this.seq().obj(this.key("ri").int(),this.key("di").int(),this.key("ti").int())}),nK=jf.define("RSAPrivateKey",function(){this.seq().obj(this.key("version").use(iK),this.key("n").int(),this.key("e").int(),this.key("d").int(),this.key("p").int(),this.key("q").int(),this.key("dp").int(),this.key("dq").int(),this.key("qi").int(),this.key("other").optional().use(Khe))}),jhe=jf.define("PrivateKeyInfo",function(){this.seq().obj(this.key("version").use(iK),this.key("algorithm").use(rK),this.key("privateKey").bitstr())});function aK(a,o){return o=o||{},Object.keys(o).forEach(function(f){a[f]=o[f]}),a}function ix(a){return a.length%2===1?"0"+a:a}function oK(a,o){var f=tK.decode(a,"der"),d=ix(f.e.toString(16)),n={kty:"RSA",n:eh(f.n),e:rx(d)};return aK(n,o)}function sK(a,o){var f=nK.decode(a,"der"),d=ix(f.e.toString(16)),n={kty:"RSA",n:eh(f.n),e:rx(d),d:eh(f.d),p:eh(f.p),q:eh(f.q),dp:eh(f.dp),dq:eh(f.dq),qi:eh(f.qi)};return aK(n,o)}function Whe(a,o){var f=Hhe.decode(a,"der");return oK(f.publicKey.data,o)}function Zhe(a,o){var f=jhe.decode(a,"der");return sK(f.privateKey.data,o)}function Ghe(a){var o=/^-----BEGIN (RSA )?(PUBLIC|PRIVATE) KEY-----$/.exec(a);if(!o)return null;var f=!!o[1],d=o[2]==="PRIVATE";return d?f?sK:Zhe:f?oK:Whe}function Vhe(a){return{n:Q0(a.n),e:Q0(a.e),d:a.d&&Q0(a.d),p:a.p&&Q0(a.p),q:a.q&&Q0(a.q),dp:a.dp&&Q0(a.dp),dq:a.dq&&Q0(a.dq),qi:a.qi&&Q0(a.qi)}}function eh(a){return rx(ix(a.toString(16)))}function Jhe(a){return new jf.bignum(at.from(a,"base64"))}function Q0(a){return/^[0-9]+$/.test(a)?new jf.bignum(a,10):Jhe(a)}function Yhe(a,o){var f=a.toString().split(/(\r\n|\r|\n)+/g);f=f.filter(function(n){return n.trim().length!==0});var d=Ghe(f[0]);return f=f.slice(1,-1).join(""),d(at.from(f.replace(/[^\w\d\+\/=]+/g,""),"base64"),o)}function Xhe(a){var o=Vhe(a),f=!!o.d,d=f?"PRIVATE":"PUBLIC",n="-----BEGIN RSA "+d+` KEY-----
|
|
6
6
|
`,v=`
|
|
@@ -76,7 +76,7 @@ nonce: bundlr`),at.from(n))}};var kBe=Ae(Be(),1);Ie();Re();var sl=class{_publicK
|
|
|
76
76
|
`)>=0,ee+te.replace(/\u001b\[\d\d?m/g,"").length+1},0);return F>60?q[0]+(k===""?"":k+`
|
|
77
77
|
`)+" "+B.join(`,
|
|
78
78
|
`)+" "+q[1]:q[0]+k+" "+B.join(", ")+" "+q[1]}Rr.types=a2e();function N(B){return Array.isArray(B)}Rr.isArray=N;function P(B){return typeof B=="boolean"}Rr.isBoolean=P;function L(B){return B===null}Rr.isNull=L;function D(B){return B==null}Rr.isNullOrUndefined=D;function Z(B){return typeof B=="number"}Rr.isNumber=Z;function W(B){return typeof B=="string"}Rr.isString=W;function Q(B){return typeof B=="symbol"}Rr.isSymbol=Q;function K(B){return B===void 0}Rr.isUndefined=K;function z(B){return X(B)&&s(B)==="[object RegExp]"}Rr.isRegExp=z,Rr.types.isRegExp=z;function X(B){return typeof B=="object"&&B!==null}Rr.isObject=X;function p(B){return X(B)&&s(B)==="[object Date]"}Rr.isDate=p,Rr.types.isDate=p;function e(B){return X(B)&&(s(B)==="[object Error]"||B instanceof Error)}Rr.isError=e,Rr.types.isNativeError=e;function r(B){return typeof B=="function"}Rr.isFunction=r;function i(B){return B===null||typeof B=="boolean"||typeof B=="number"||typeof B=="string"||typeof B=="symbol"||typeof B>"u"}Rr.isPrimitive=i,Rr.isBuffer=o2e();function s(B){return Object.prototype.toString.call(B)}function h(B){return B<10?"0"+B.toString(10):B.toString(10)}var c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function m(){var B=new Date,k=[h(B.getHours()),h(B.getMinutes()),h(B.getSeconds())].join(":");return[B.getDate(),c[B.getMonth()],k].join(" ")}Rr.log=function(){console.log("%s - %s",m(),Rr.format.apply(Rr,arguments))},Rr.inherits=Vve(),Rr._extend=function(B,k){if(!k||!X(k))return B;for(var q=Object.keys(k),F=q.length;F--;)B[q[F]]=k[q[F]];return B};function l(B,k){return Object.prototype.hasOwnProperty.call(B,k)}var t=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;Rr.promisify=function(k){if(typeof k!="function")throw new TypeError('The "original" argument must be of type Function');if(t&&k[t]){if(q=k[t],typeof q!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(q,t,{value:q,enumerable:!1,writable:!1,configurable:!0}),q}function q(){for(var F,ee,te=new Promise(function(oe,Y){F=oe,ee=Y}),O=[],U=0;U<arguments.length;U++)O.push(arguments[U]);O.push(function(oe,Y){oe?ee(oe):F(Y)});try{k.apply(this||cp,O)}catch(oe){ee(oe)}return te}return Object.setPrototypeOf(q,Object.getPrototypeOf(k)),t&&Object.defineProperty(q,t,{value:q,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(q,o(k))},Rr.promisify.custom=t;function u(B,k){if(!B){var q=new Error("Promise was rejected with a falsy value");q.reason=B,B=q}return k(B)}function S(B){if(typeof B!="function")throw new TypeError('The "original" argument must be of type Function');function k(){for(var q=[],F=0;F<arguments.length;F++)q.push(arguments[F]);var ee=q.pop();if(typeof ee!="function")throw new TypeError("The last argument must be of type Function");var te=this||cp,O=function(){return ee.apply(te,arguments)};B.apply(this||cp,q).then(function(U){a.nextTick(O.bind(null,null,U))},function(U){a.nextTick(u.bind(null,U,O))})}return Object.setPrototypeOf(k,Object.getPrototypeOf(B)),Object.defineProperties(k,o(B)),k}return Rr.callbackify=S,Rr}var Qt=s2e();Qt.format;Qt.deprecate;Qt.debuglog;Qt.inspect;Qt.types;Qt.isArray;Qt.isBoolean;Qt.isNull;Qt.isNullOrUndefined;Qt.isNumber;Qt.isString;Qt.isSymbol;Qt.isUndefined;Qt.isRegExp;Qt.isObject;Qt.isDate;Qt.isError;Qt.isFunction;Qt.isPrimitive;Qt.isBuffer;Qt.log;Qt.inherits;Qt._extend;Qt.promisify;Qt.callbackify;var TTe=Qt._extend,kTe=Qt.callbackify,$Te=Qt.debuglog,PTe=Qt.deprecate,NTe=Qt.format,CTe=Qt.inherits,LTe=Qt.inspect,DTe=Qt.isArray,OTe=Qt.isBoolean,qTe=Qt.isBuffer,UTe=Qt.isDate,FTe=Qt.isError,zTe=Qt.isFunction,HTe=Qt.isNull,KTe=Qt.isNullOrUndefined,jTe=Qt.isNumber,WTe=Qt.isObject,ZTe=Qt.isPrimitive,GTe=Qt.isRegExp,VTe=Qt.isString,JTe=Qt.isSymbol,YTe=Qt.isUndefined,XTe=Qt.log,RV=Qt.promisify,QTe=Qt.types,eke=Qt.TextEncoder=globalThis.TextEncoder,tke=Qt.TextDecoder=globalThis.TextDecoder,OS={},IV=!1;function Gi(){return IV||(IV=!0,OS={ArrayIsArray(a){return Array.isArray(a)},ArrayPrototypeIncludes(a,o){return a.includes(o)},ArrayPrototypeIndexOf(a,o){return a.indexOf(o)},ArrayPrototypeJoin(a,o){return a.join(o)},ArrayPrototypeMap(a,o){return a.map(o)},ArrayPrototypePop(a,o){return a.pop(o)},ArrayPrototypePush(a,o){return a.push(o)},ArrayPrototypeSlice(a,o,f){return a.slice(o,f)},Error,FunctionPrototypeCall(a,o,...f){return a.call(o,...f)},FunctionPrototypeSymbolHasInstance(a,o){return Function.prototype[Symbol.hasInstance].call(a,o)},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(a,o){return Object.defineProperties(a,o)},ObjectDefineProperty(a,o,f){return Object.defineProperty(a,o,f)},ObjectGetOwnPropertyDescriptor(a,o){return Object.getOwnPropertyDescriptor(a,o)},ObjectKeys(a){return Object.keys(a)},ObjectSetPrototypeOf(a,o){return Object.setPrototypeOf(a,o)},Promise,PromisePrototypeCatch(a,o){return a.catch(o)},PromisePrototypeThen(a,o,f){return a.then(o,f)},PromiseReject(a){return Promise.reject(a)},PromiseResolve(a){return Promise.resolve(a)},ReflectApply:Reflect.apply,RegExpPrototypeTest(a,o){return a.test(o)},SafeSet:Set,String,StringPrototypeSlice(a,o,f){return a.slice(o,f)},StringPrototypeToLowerCase(a){return a.toLowerCase()},StringPrototypeToUpperCase(a){return a.toUpperCase()},StringPrototypeTrim(a){return a.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(a,o,f){return a.set(o,f)},Boolean,Uint8Array}),OS}var pp={},TV=!1;function bp(){if(TV)return pp;TV=!0;let{AbortController:a,AbortSignal:o}=typeof self<"u"?self:typeof window<"u"?window:void 0;return pp=a,pp.AbortSignal=o,pp.default=a,pp}var Yb={},kV=!1;function fa(){if(kV)return Yb;kV=!0;let a=Mh(),{kResistStopPropagation:o,SymbolDispose:f}=Gi(),d=globalThis.AbortSignal||bp().AbortSignal,n=globalThis.AbortController||bp().AbortController,v=Object.getPrototypeOf(async function(){}).constructor,b=globalThis.Blob||a.Blob,y=typeof b<"u"?function(x){return x instanceof b}:function(x){return!1},M=(_,x)=>{if(_!==void 0&&(_===null||typeof _!="object"||!("aborted"in _)))throw new ERR_INVALID_ARG_TYPE(x,"AbortSignal",_)},w=(_,x)=>{if(typeof _!="function")throw new ERR_INVALID_ARG_TYPE(x,"Function",_)};class g extends Error{constructor(x){if(!Array.isArray(x))throw new TypeError(`Expected input to be an Array, got ${typeof x}`);let E="";for(let R=0;R<x.length;R++)E+=` ${x[R].stack}
|
|
79
|
-
`;super(E),this.name="AggregateError",this.errors=x}}return Yb={AggregateError:g,kEmptyObject:Object.freeze({}),once(_){let x=!1;return function(...E){x||(x=!0,_.apply(this,E))}},createDeferredPromise:function(){let _,x;return{promise:new Promise((R,T)=>{_=R,x=T}),resolve:_,reject:x}},promisify(_){return new Promise((x,E)=>{_((R,...T)=>R?E(R):x(...T))})},debuglog(){return function(){}},format(_,...x){return _.replace(/%([sdifj])/g,function(...[E,R]){let T=x.shift();return R==="f"?T.toFixed(6):R==="j"?JSON.stringify(T):R==="s"&&typeof T=="object"?`${T.constructor!==Object?T.constructor.name:""} {}`.trim():T.toString()})},inspect(_){switch(typeof _){case"string":if(_.includes("'"))if(_.includes('"')){if(!_.includes("`")&&!_.includes("${"))return`\`${_}\``}else return`"${_}"`;return`'${_}'`;case"number":return isNaN(_)?"NaN":Object.is(_,-0)?String(_):_;case"bigint":return`${String(_)}n`;case"boolean":case"undefined":return String(_);case"object":return"{}"}},types:{isAsyncFunction(_){return _ instanceof v},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:y,deprecate(_,x){return _},addAbortListener:_h.addAbortListener||function(x,E){if(x===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",x);M(x,"signal"),w(E,"listener");let R;return x.aborted?queueMicrotask(()=>E()):(x.addEventListener("abort",E,{__proto__:null,once:!0,[o]:!0}),R=()=>{x.removeEventListener("abort",E)}),{__proto__:null,[f](){var T;(T=R)===null||T===void 0||T()}}},AbortSignalAny:d.any||function(x){if(x.length===1)return x[0];let E=new n,R=()=>E.abort();return x.forEach(T=>{M(T,"signals"),T.addEventListener("abort",R,{once:!0})}),E.signal.addEventListener("abort",()=>{x.forEach(T=>T.removeEventListener("abort",R))},{once:!0}),E.signal}},Yb.promisify.custom=Symbol.for("nodejs.util.promisify.custom"),Yb}var qS={},$V=!1;function xa(){if($V)return qS;$V=!0;let{format:a,inspect:o,AggregateError:f}=fa(),d=globalThis.AggregateError||f,n=Symbol("kIsNodeError"),v=["string","function","number","object","Function","Object","boolean","bigint","symbol"],b=/^([A-Z][a-z0-9]*)+$/,y="__node_internal_",M={};function w(N,P){if(!N)throw new M.ERR_INTERNAL_ASSERTION(P)}function g(N){let P="",L=N.length,D=N[0]==="-"?1:0;for(;L>=D+4;L-=3)P=`_${N.slice(L-3,L)}${P}`;return`${N.slice(0,L)}${P}`}function _(N,P,L){if(typeof P=="function")return w(P.length<=L.length,`Code: ${N}; The provided arguments length (${L.length}) does not match the required ones (${P.length}).`),P(...L);let D=(P.match(/%[dfijoOs]/g)||[]).length;return w(D===L.length,`Code: ${N}; The provided arguments length (${L.length}) does not match the required ones (${D}).`),L.length===0?P:a(P,...L)}function x(N,P,L){L||(L=Error);class D extends L{constructor(...W){super(_(N,P,W))}toString(){return`${this.name} [${N}]: ${this.message}`}}Object.defineProperties(D.prototype,{name:{value:L.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${N}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),D.prototype.code=N,D.prototype[n]=!0,M[N]=D}function E(N){let P=y+N.name;return Object.defineProperty(N,"name",{value:P}),N}function R(N,P){if(N&&P&&N!==P){if(Array.isArray(P.errors))return P.errors.push(N),P;let L=new d([P,N],P.message);return L.code=P.code,L}return N||P}class T extends Error{constructor(P="The operation was aborted",L=void 0){if(L!==void 0&&typeof L!="object")throw new M.ERR_INVALID_ARG_TYPE("options","Object",L);super(P,L),this.code="ABORT_ERR",this.name="AbortError"}}return x("ERR_ASSERTION","%s",Error),x("ERR_INVALID_ARG_TYPE",(N,P,L)=>{w(typeof N=="string","'name' must be a string"),Array.isArray(P)||(P=[P]);let D="The ";N.endsWith(" argument")?D+=`${N} `:D+=`"${N}" ${N.includes(".")?"property":"argument"} `,D+="must be ";let Z=[],W=[],Q=[];for(let z of P)w(typeof z=="string","All expected entries have to be of type string"),v.includes(z)?Z.push(z.toLowerCase()):b.test(z)?W.push(z):(w(z!=="object",'The value "object" should be written as "Object"'),Q.push(z));if(W.length>0){let z=Z.indexOf("object");z!==-1&&(Z.splice(Z,z,1),W.push("Object"))}if(Z.length>0){switch(Z.length){case 1:D+=`of type ${Z[0]}`;break;case 2:D+=`one of type ${Z[0]} or ${Z[1]}`;break;default:{let z=Z.pop();D+=`one of type ${Z.join(", ")}, or ${z}`}}(W.length>0||Q.length>0)&&(D+=" or ")}if(W.length>0){switch(W.length){case 1:D+=`an instance of ${W[0]}`;break;case 2:D+=`an instance of ${W[0]} or ${W[1]}`;break;default:{let z=W.pop();D+=`an instance of ${W.join(", ")}, or ${z}`}}Q.length>0&&(D+=" or ")}switch(Q.length){case 0:break;case 1:Q[0].toLowerCase()!==Q[0]&&(D+="an "),D+=`${Q[0]}`;break;case 2:D+=`one of ${Q[0]} or ${Q[1]}`;break;default:{let z=Q.pop();D+=`one of ${Q.join(", ")}, or ${z}`}}if(L==null)D+=`. Received ${L}`;else if(typeof L=="function"&&L.name)D+=`. Received function ${L.name}`;else if(typeof L=="object"){var K;if((K=L.constructor)!==null&&K!==void 0&&K.name)D+=`. Received an instance of ${L.constructor.name}`;else{let z=o(L,{depth:-1});D+=`. Received ${z}`}}else{let z=o(L,{colors:!1});z.length>25&&(z=`${z.slice(0,25)}...`),D+=`. Received type ${typeof L} (${z})`}return D},TypeError),x("ERR_INVALID_ARG_VALUE",(N,P,L="is invalid")=>{let D=o(P);return D.length>128&&(D=D.slice(0,128)+"..."),`The ${N.includes(".")?"property":"argument"} '${N}' ${L}. Received ${D}`},TypeError),x("ERR_INVALID_RETURN_VALUE",(N,P,L)=>{var D;let Z=L!=null&&(D=L.constructor)!==null&&D!==void 0&&D.name?`instance of ${L.constructor.name}`:`type ${typeof L}`;return`Expected ${N} to be returned from the "${P}" function but got ${Z}.`},TypeError),x("ERR_MISSING_ARGS",(...N)=>{w(N.length>0,"At least one arg needs to be specified");let P,L=N.length;switch(N=(Array.isArray(N)?N:[N]).map(D=>`"${D}"`).join(" or "),L){case 1:P+=`The ${N[0]} argument`;break;case 2:P+=`The ${N[0]} and ${N[1]} arguments`;break;default:{let D=N.pop();P+=`The ${N.join(", ")}, and ${D} arguments`}break}return`${P} must be specified`},TypeError),x("ERR_OUT_OF_RANGE",(N,P,L)=>{w(P,'Missing "range" argument');let D;return Number.isInteger(L)&&Math.abs(L)>2**32?D=g(String(L)):typeof L=="bigint"?(D=String(L),(L>2n**32n||L<-(2n**32n))&&(D=g(D)),D+="n"):D=o(L),`The value of "${N}" is out of range. It must be ${P}. Received ${D}`},RangeError),x("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),x("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),x("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),x("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),x("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),x("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),x("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),x("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),x("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),x("ERR_STREAM_WRITE_AFTER_END","write after end",Error),x("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),qS={AbortError:T,aggregateTwoErrors:E(R),hideStackFrames:E,codes:M},qS}var US={},PV=!1;function gp(){if(PV)return US;PV=!0;let{ArrayIsArray:a,ArrayPrototypeIncludes:o,ArrayPrototypeJoin:f,ArrayPrototypeMap:d,NumberIsInteger:n,NumberIsNaN:v,NumberMAX_SAFE_INTEGER:b,NumberMIN_SAFE_INTEGER:y,NumberParseInt:M,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:g,String:_,StringPrototypeToUpperCase:x,StringPrototypeTrim:E}=Gi(),{hideStackFrames:R,codes:{ERR_SOCKET_BAD_PORT:T,ERR_INVALID_ARG_TYPE:N,ERR_INVALID_ARG_VALUE:P,ERR_OUT_OF_RANGE:L,ERR_UNKNOWN_SIGNAL:D}}=xa(),{normalizeEncoding:Z}=fa(),{isAsyncFunction:W,isArrayBufferView:Q}=fa().types,K={};function z(ye){return ye===(ye|0)}function X(ye){return ye===ye>>>0}let p=/^[0-7]+$/,e="must be a 32-bit unsigned integer or an octal string";function r(ye,fe,he){if(typeof ye>"u"&&(ye=he),typeof ye=="string"){if(g(p,ye)===null)throw new P(fe,ye,e);ye=M(ye,8)}return h(ye,fe),ye}let i=R((ye,fe,he=y,nt=b)=>{if(typeof ye!="number")throw new N(fe,"number",ye);if(!n(ye))throw new L(fe,"an integer",ye);if(ye<he||ye>nt)throw new L(fe,`>= ${he} && <= ${nt}`,ye)}),s=R((ye,fe,he=-2147483648,nt=2147483647)=>{if(typeof ye!="number")throw new N(fe,"number",ye);if(!n(ye))throw new L(fe,"an integer",ye);if(ye<he||ye>nt)throw new L(fe,`>= ${he} && <= ${nt}`,ye)}),h=R((ye,fe,he=!1)=>{if(typeof ye!="number")throw new N(fe,"number",ye);if(!n(ye))throw new L(fe,"an integer",ye);let nt=he?1:0,ce=4294967295;if(ye<nt||ye>ce)throw new L(fe,`>= ${nt} && <= ${ce}`,ye)});function c(ye,fe){if(typeof ye!="string")throw new N(fe,"string",ye)}function m(ye,fe,he=void 0,nt){if(typeof ye!="number")throw new N(fe,"number",ye);if(he!=null&&ye<he||nt!=null&&ye>nt||(he!=null||nt!=null)&&v(ye))throw new L(fe,`${he!=null?`>= ${he}`:""}${he!=null&&nt!=null?" && ":""}${nt!=null?`<= ${nt}`:""}`,ye)}let l=R((ye,fe,he)=>{if(!o(he,ye)){let ce="must be one of: "+f(d(he,be=>typeof be=="string"?`'${be}'`:_(be)),", ");throw new P(fe,ye,ce)}});function t(ye,fe){if(typeof ye!="boolean")throw new N(fe,"boolean",ye)}function u(ye,fe,he){return ye==null||!w(ye,fe)?he:ye[fe]}let S=R((ye,fe,he=null)=>{let nt=u(he,"allowArray",!1),ce=u(he,"allowFunction",!1);if(!u(he,"nullable",!1)&&ye===null||!nt&&a(ye)||typeof ye!="object"&&(!ce||typeof ye!="function"))throw new N(fe,"Object",ye)}),B=R((ye,fe)=>{if(ye!=null&&typeof ye!="object"&&typeof ye!="function")throw new N(fe,"a dictionary",ye)}),k=R((ye,fe,he=0)=>{if(!a(ye))throw new N(fe,"Array",ye);if(ye.length<he){let nt=`must be longer than ${he}`;throw new P(fe,ye,nt)}});function q(ye,fe){k(ye,fe);for(let he=0;he<ye.length;he++)c(ye[he],`${fe}[${he}]`)}function F(ye,fe){k(ye,fe);for(let he=0;he<ye.length;he++)t(ye[he],`${fe}[${he}]`)}function ee(ye,fe){k(ye,fe);for(let he=0;he<ye.length;he++){let nt=ye[he],ce=`${fe}[${he}]`;if(nt==null)throw new N(ce,"AbortSignal",nt);Y(nt,ce)}}function te(ye,fe="signal"){if(c(ye,fe),K[ye]===void 0)throw K[x(ye)]!==void 0?new D(ye+" (signals must use all capital letters)"):new D(ye)}let O=R((ye,fe="buffer")=>{if(!Q(ye))throw new N(fe,["Buffer","TypedArray","DataView"],ye)});function U(ye,fe){let he=Z(fe),nt=ye.length;if(he==="hex"&&nt%2!==0)throw new P("encoding",fe,`is invalid for data of length ${nt}`)}function oe(ye,fe="Port",he=!0){if(typeof ye!="number"&&typeof ye!="string"||typeof ye=="string"&&E(ye).length===0||+ye!==+ye>>>0||ye>65535||ye===0&&!he)throw new T(fe,ye,he);return ye|0}let Y=R((ye,fe)=>{if(ye!==void 0&&(ye===null||typeof ye!="object"||!("aborted"in ye)))throw new N(fe,"AbortSignal",ye)}),j=R((ye,fe)=>{if(typeof ye!="function")throw new N(fe,"Function",ye)}),V=R((ye,fe)=>{if(typeof ye!="function"||W(ye))throw new N(fe,"Function",ye)}),G=R((ye,fe)=>{if(ye!==void 0)throw new N(fe,"undefined",ye)});function ie(ye,fe,he){if(!o(he,ye))throw new N(fe,`('${f(he,"|")}')`,ye)}let me=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function re(ye,fe){if(typeof ye>"u"||!g(me,ye))throw new P(fe,ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ae(ye){if(typeof ye=="string")return re(ye,"hints"),ye;if(a(ye)){let fe=ye.length,he="";if(fe===0)return he;for(let nt=0;nt<fe;nt++){let ce=ye[nt];re(ce,"hints"),he+=ce,nt!==fe-1&&(he+=", ")}return he}throw new P("hints",ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return US={isInt32:z,isUint32:X,parseFileMode:r,validateArray:k,validateStringArray:q,validateBooleanArray:F,validateAbortSignalArray:ee,validateBoolean:t,validateBuffer:O,validateDictionary:B,validateEncoding:U,validateFunction:j,validateInt32:s,validateInteger:i,validateNumber:m,validateObject:S,validateOneOf:l,validatePlainFunction:V,validatePort:oe,validateSignalName:te,validateString:c,validateUint32:h,validateUndefined:G,validateUnion:ie,validateAbortSignal:Y,validateLinkHeaderValue:ae},US}var FS={},NV=!1;function s0(){if(NV)return FS;NV=!0;let{SymbolAsyncIterator:a,SymbolIterator:o,SymbolFor:f}=Gi(),d=f("nodejs.stream.destroyed"),n=f("nodejs.stream.errored"),v=f("nodejs.stream.readable"),b=f("nodejs.stream.writable"),y=f("nodejs.stream.disturbed"),M=f("nodejs.webstream.isClosedPromise"),w=f("nodejs.webstream.controllerErrorFunction");function g(u,S=!1){var B;return!!(u&&typeof u.pipe=="function"&&typeof u.on=="function"&&(!S||typeof u.pause=="function"&&typeof u.resume=="function")&&(!u._writableState||((B=u._readableState)===null||B===void 0?void 0:B.readable)!==!1)&&(!u._writableState||u._readableState))}function _(u){var S;return!!(u&&typeof u.write=="function"&&typeof u.on=="function"&&(!u._readableState||((S=u._writableState)===null||S===void 0?void 0:S.writable)!==!1))}function x(u){return!!(u&&typeof u.pipe=="function"&&u._readableState&&typeof u.on=="function"&&typeof u.write=="function")}function E(u){return u&&(u._readableState||u._writableState||typeof u.write=="function"&&typeof u.on=="function"||typeof u.pipe=="function"&&typeof u.on=="function")}function R(u){return!!(u&&!E(u)&&typeof u.pipeThrough=="function"&&typeof u.getReader=="function"&&typeof u.cancel=="function")}function T(u){return!!(u&&!E(u)&&typeof u.getWriter=="function"&&typeof u.abort=="function")}function N(u){return!!(u&&!E(u)&&typeof u.readable=="object"&&typeof u.writable=="object")}function P(u){return R(u)||T(u)||N(u)}function L(u,S){return u==null?!1:S===!0?typeof u[a]=="function":S===!1?typeof u[o]=="function":typeof u[a]=="function"||typeof u[o]=="function"}function D(u){if(!E(u))return null;let S=u._writableState,B=u._readableState,k=S||B;return!!(u.destroyed||u[d]||k!=null&&k.destroyed)}function Z(u){if(!_(u))return null;if(u.writableEnded===!0)return!0;let S=u._writableState;return S!=null&&S.errored?!1:typeof S?.ended!="boolean"?null:S.ended}function W(u,S){if(!_(u))return null;if(u.writableFinished===!0)return!0;let B=u._writableState;return B!=null&&B.errored?!1:typeof B?.finished!="boolean"?null:!!(B.finished||S===!1&&B.ended===!0&&B.length===0)}function Q(u){if(!g(u))return null;if(u.readableEnded===!0)return!0;let S=u._readableState;return!S||S.errored?!1:typeof S?.ended!="boolean"?null:S.ended}function K(u,S){if(!g(u))return null;let B=u._readableState;return B!=null&&B.errored?!1:typeof B?.endEmitted!="boolean"?null:!!(B.endEmitted||S===!1&&B.ended===!0&&B.length===0)}function z(u){return u&&u[v]!=null?u[v]:typeof u?.readable!="boolean"?null:D(u)?!1:g(u)&&u.readable&&!K(u)}function X(u){return u&&u[b]!=null?u[b]:typeof u?.writable!="boolean"?null:D(u)?!1:_(u)&&u.writable&&!Z(u)}function p(u,S){return E(u)?D(u)?!0:!(S?.readable!==!1&&z(u)||S?.writable!==!1&&X(u)):null}function e(u){var S,B;return E(u)?u.writableErrored?u.writableErrored:(S=(B=u._writableState)===null||B===void 0?void 0:B.errored)!==null&&S!==void 0?S:null:null}function r(u){var S,B;return E(u)?u.readableErrored?u.readableErrored:(S=(B=u._readableState)===null||B===void 0?void 0:B.errored)!==null&&S!==void 0?S:null:null}function i(u){if(!E(u))return null;if(typeof u.closed=="boolean")return u.closed;let S=u._writableState,B=u._readableState;return typeof S?.closed=="boolean"||typeof B?.closed=="boolean"?S?.closed||B?.closed:typeof u._closed=="boolean"&&s(u)?u._closed:null}function s(u){return typeof u._closed=="boolean"&&typeof u._defaultKeepAlive=="boolean"&&typeof u._removedConnection=="boolean"&&typeof u._removedContLen=="boolean"}function h(u){return typeof u._sent100=="boolean"&&s(u)}function c(u){var S;return typeof u._consuming=="boolean"&&typeof u._dumped=="boolean"&&((S=u.req)===null||S===void 0?void 0:S.upgradeOrConnect)===void 0}function m(u){if(!E(u))return null;let S=u._writableState,B=u._readableState,k=S||B;return!k&&h(u)||!!(k&&k.autoDestroy&&k.emitClose&&k.closed===!1)}function l(u){var S;return!!(u&&((S=u[y])!==null&&S!==void 0?S:u.readableDidRead||u.readableAborted))}function t(u){var S,B,k,q,F,ee,te,O,U,oe;return!!(u&&((S=(B=(k=(q=(F=(ee=u[n])!==null&&ee!==void 0?ee:u.readableErrored)!==null&&F!==void 0?F:u.writableErrored)!==null&&q!==void 0?q:(te=u._readableState)===null||te===void 0?void 0:te.errorEmitted)!==null&&k!==void 0?k:(O=u._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&B!==void 0?B:(U=u._readableState)===null||U===void 0?void 0:U.errored)!==null&&S!==void 0?S:!((oe=u._writableState)===null||oe===void 0)&&oe.errored))}return FS={isDestroyed:D,kIsDestroyed:d,isDisturbed:l,kIsDisturbed:y,isErrored:t,kIsErrored:n,isReadable:z,kIsReadable:v,kIsClosedPromise:M,kControllerErrorFunction:w,kIsWritable:b,isClosed:i,isDuplexNodeStream:x,isFinished:p,isIterable:L,isReadableNodeStream:g,isReadableStream:R,isReadableEnded:Q,isReadableFinished:K,isReadableErrored:r,isNodeStream:E,isWebStream:P,isWritable:X,isWritableNodeStream:_,isWritableStream:T,isWritableEnded:Z,isWritableFinished:W,isWritableErrored:e,isServerRequest:c,isServerResponse:h,willEmitClose:m,isTransformStream:N},FS}var Xb={},CV=!1;function Sh(){if(CV)return Xb;CV=!0;let a=o0,{AbortError:o,codes:f}=xa(),{ERR_INVALID_ARG_TYPE:d,ERR_STREAM_PREMATURE_CLOSE:n}=f,{kEmptyObject:v,once:b}=fa(),{validateAbortSignal:y,validateFunction:M,validateObject:w,validateBoolean:g}=gp(),{Promise:_,PromisePrototypeThen:x,SymbolDispose:E}=Gi(),{isClosed:R,isReadable:T,isReadableNodeStream:N,isReadableStream:P,isReadableFinished:L,isReadableErrored:D,isWritable:Z,isWritableNodeStream:W,isWritableStream:Q,isWritableFinished:K,isWritableErrored:z,isNodeStream:X,willEmitClose:p,kIsClosedPromise:e}=s0(),r;function i(l){return l.setHeader&&typeof l.abort=="function"}let s=()=>{};function h(l,t,u){var S,B;if(arguments.length===2?(u=t,t=v):t==null?t=v:w(t,"options"),M(u,"callback"),y(t.signal,"options.signal"),u=b(u),P(l)||Q(l))return c(l,t,u);if(!X(l))throw new d("stream",["ReadableStream","WritableStream","Stream"],l);let k=(S=t.readable)!==null&&S!==void 0?S:N(l),q=(B=t.writable)!==null&&B!==void 0?B:W(l),F=l._writableState,ee=l._readableState,te=()=>{l.writable||oe()},O=p(l)&&N(l)===k&&W(l)===q,U=K(l,!1),oe=()=>{U=!0,l.destroyed&&(O=!1),!(O&&(!l.readable||k))&&(!k||Y)&&u.call(l)},Y=L(l,!1),j=()=>{Y=!0,l.destroyed&&(O=!1),!(O&&(!l.writable||q))&&(!q||U)&&u.call(l)},V=ye=>{u.call(l,ye)},G=R(l),ie=()=>{G=!0;let ye=z(l)||D(l);if(ye&&typeof ye!="boolean")return u.call(l,ye);if(k&&!Y&&N(l,!0)&&!L(l,!1))return u.call(l,new n);if(q&&!U&&!K(l,!1))return u.call(l,new n);u.call(l)},me=()=>{G=!0;let ye=z(l)||D(l);if(ye&&typeof ye!="boolean")return u.call(l,ye);u.call(l)},re=()=>{l.req.on("finish",oe)};i(l)?(l.on("complete",oe),O||l.on("abort",ie),l.req?re():l.on("request",re)):q&&!F&&(l.on("end",te),l.on("close",te)),!O&&typeof l.aborted=="boolean"&&l.on("aborted",ie),l.on("end",j),l.on("finish",oe),t.error!==!1&&l.on("error",V),l.on("close",ie),G?a.nextTick(ie):F!=null&&F.errorEmitted||ee!=null&&ee.errorEmitted?O||a.nextTick(me):(!k&&(!O||T(l))&&(U||Z(l)===!1)||!q&&(!O||Z(l))&&(Y||T(l)===!1)||ee&&l.req&&l.aborted)&&a.nextTick(me);let ae=()=>{u=s,l.removeListener("aborted",ie),l.removeListener("complete",oe),l.removeListener("abort",ie),l.removeListener("request",re),l.req&&l.req.removeListener("finish",oe),l.removeListener("end",te),l.removeListener("close",te),l.removeListener("finish",oe),l.removeListener("end",j),l.removeListener("error",V),l.removeListener("close",ie)};if(t.signal&&!G){let ye=()=>{let fe=u;ae(),fe.call(l,new o(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)a.nextTick(ye);else{r=r||fa().addAbortListener;let fe=r(t.signal,ye),he=u;u=b((...nt)=>{fe[E](),he.apply(l,nt)})}}return ae}function c(l,t,u){let S=!1,B=s;if(t.signal)if(B=()=>{S=!0,u.call(l,new o(void 0,{cause:t.signal.reason}))},t.signal.aborted)a.nextTick(B);else{r=r||fa().addAbortListener;let q=r(t.signal,B),F=u;u=b((...ee)=>{q[E](),F.apply(l,ee)})}let k=(...q)=>{S||a.nextTick(()=>u.apply(l,q))};return x(l[e].promise,k,k),s}function m(l,t){var u;let S=!1;return t===null&&(t=v),(u=t)!==null&&u!==void 0&&u.cleanup&&(g(t.cleanup,"cleanup"),S=t.cleanup),new _((B,k)=>{let q=h(l,t,F=>{S&&q(),F?k(F):B()})})}return Xb=h,Xb.finished=m,Xb}var zS={},LV=!1;function Wd(){if(LV)return zS;LV=!0;let a=o0,{aggregateTwoErrors:o,codes:{ERR_MULTIPLE_CALLBACK:f},AbortError:d}=xa(),{Symbol:n}=Gi(),{kIsDestroyed:v,isDestroyed:b,isFinished:y,isServerRequest:M}=s0(),w=n("kDestroy"),g=n("kConstruct");function _(p,e,r){p&&(p.stack,e&&!e.errored&&(e.errored=p),r&&!r.errored&&(r.errored=p))}function x(p,e){let r=this._readableState,i=this._writableState,s=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(_(p,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),s.constructed?E(this,p,e):this.once(w,function(h){E(this,o(h,p),e)}),this)}function E(p,e,r){let i=!1;function s(h){if(i)return;i=!0;let c=p._readableState,m=p._writableState;_(h,m,c),m&&(m.closed=!0),c&&(c.closed=!0),typeof r=="function"&&r(h),h?a.nextTick(R,p,h):a.nextTick(T,p)}try{p._destroy(e||null,s)}catch(h){s(h)}}function R(p,e){N(p,e),T(p)}function T(p){let e=p._readableState,r=p._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&p.emit("close")}function N(p,e){let r=p._readableState,i=p._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),p.emit("error",e))}function P(){let p=this._readableState,e=this._writableState;p&&(p.constructed=!0,p.closed=!1,p.closeEmitted=!1,p.destroyed=!1,p.errored=null,p.errorEmitted=!1,p.reading=!1,p.ended=p.readable===!1,p.endEmitted=p.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 L(p,e,r){let i=p._readableState,s=p._writableState;if(s!=null&&s.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||s!=null&&s.autoDestroy?p.destroy(e):e&&(e.stack,s&&!s.errored&&(s.errored=e),i&&!i.errored&&(i.errored=e),r?a.nextTick(N,p,e):N(p,e))}function D(p,e){if(typeof p._construct!="function")return;let r=p._readableState,i=p._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),p.once(g,e),!(p.listenerCount(g)>1)&&a.nextTick(Z,p)}function Z(p){let e=!1;function r(i){if(e){L(p,i??new f);return}e=!0;let s=p._readableState,h=p._writableState,c=h||s;s&&(s.constructed=!0),h&&(h.constructed=!0),c.destroyed?p.emit(w,i):i?L(p,i,!0):a.nextTick(W,p)}try{p._construct(i=>{a.nextTick(r,i)})}catch(i){a.nextTick(r,i)}}function W(p){p.emit(g)}function Q(p){return p?.setHeader&&typeof p.abort=="function"}function K(p){p.emit("close")}function z(p,e){p.emit("error",e),a.nextTick(K,p)}function X(p,e){!p||b(p)||(!e&&!y(p)&&(e=new d),M(p)?(p.socket=null,p.destroy(e)):Q(p)?p.abort():Q(p.req)?p.req.abort():typeof p.destroy=="function"?p.destroy(e):typeof p.close=="function"?p.close():e?a.nextTick(z,p,e):a.nextTick(K,p),p.destroyed||(p[v]=!0))}return zS={construct:D,destroyer:X,destroy:x,undestroy:P,errorOrDestroy:L},zS}var HS={},DV=!1;function dE(){if(DV)return HS;DV=!0;let{ArrayIsArray:a,ObjectSetPrototypeOf:o}=Gi(),{EventEmitter:f}=_h;function d(v){f.call(this,v)}o(d.prototype,f.prototype),o(d,f),d.prototype.pipe=function(v,b){let y=this;function M(T){v.writable&&v.write(T)===!1&&y.pause&&y.pause()}y.on("data",M);function w(){y.readable&&y.resume&&y.resume()}v.on("drain",w),!v._isStdio&&(!b||b.end!==!1)&&(y.on("end",_),y.on("close",x));let g=!1;function _(){g||(g=!0,v.end())}function x(){g||(g=!0,typeof v.destroy=="function"&&v.destroy())}function E(T){R(),f.listenerCount(this,"error")===0&&this.emit("error",T)}n(y,"error",E),n(v,"error",E);function R(){y.removeListener("data",M),v.removeListener("drain",w),y.removeListener("end",_),y.removeListener("close",x),y.removeListener("error",E),v.removeListener("error",E),y.removeListener("end",R),y.removeListener("close",R),v.removeListener("close",R)}return y.on("end",R),y.on("close",R),v.on("close",R),v.emit("pipe",y),v};function n(v,b,y){if(typeof v.prependListener=="function")return v.prependListener(b,y);!v._events||!v._events[b]?v.on(b,y):a(v._events[b])?v._events[b].unshift(y):v._events[b]=[y,v._events[b]]}return HS={Stream:d,prependListener:n},HS}var vp={},OV=!1;function r3(){if(OV)return vp;OV=!0;let{SymbolDispose:a}=Gi(),{AbortError:o,codes:f}=xa(),{isNodeStream:d,isWebStream:n,kControllerErrorFunction:v}=s0(),b=Sh(),{ERR_INVALID_ARG_TYPE:y}=f,M,w=(g,_)=>{if(typeof g!="object"||!("aborted"in g))throw new y(_,"AbortSignal",g)};return vp.addAbortSignal=function(_,x){if(w(_,"signal"),!d(x)&&!n(x))throw new y("stream",["ReadableStream","WritableStream","Stream"],x);return vp.addAbortSignalNoValidate(_,x)},vp.addAbortSignalNoValidate=function(g,_){if(typeof g!="object"||!("aborted"in g))return _;let x=d(_)?()=>{_.destroy(new o(void 0,{cause:g.reason}))}:()=>{_[v](new o(void 0,{cause:g.reason}))};if(g.aborted)x();else{M=M||fa().addAbortListener;let E=M(g,x);b(_,E[a])}return _},vp}var KS={},qV=!1;function f2e(){if(qV)return KS;qV=!0;let{StringPrototypeSlice:a,SymbolIterator:o,TypedArrayPrototypeSet:f,Uint8Array:d}=Gi(),{Buffer:n}=Mh(),{inspect:v}=fa();return KS=class{constructor(){this.head=null,this.tail=null,this.length=0}push(y){let M={data:y,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length}unshift(y){let M={data:y,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}shift(){if(this.length===0)return;let y=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,y}clear(){this.head=this.tail=null,this.length=0}join(y){if(this.length===0)return"";let M=this.head,w=""+M.data;for(;(M=M.next)!==null;)w+=y+M.data;return w}concat(y){if(this.length===0)return n.alloc(0);let M=n.allocUnsafe(y>>>0),w=this.head,g=0;for(;w;)f(M,w.data,g),g+=w.data.length,w=w.next;return M}consume(y,M){let w=this.head.data;if(y<w.length){let g=w.slice(0,y);return this.head.data=w.slice(y),g}return y===w.length?this.shift():M?this._getString(y):this._getBuffer(y)}first(){return this.head.data}*[o](){for(let y=this.head;y;y=y.next)yield y.data}_getString(y){let M="",w=this.head,g=0;do{let _=w.data;if(y>_.length)M+=_,y-=_.length;else{y===_.length?(M+=_,++g,w.next?this.head=w.next:this.head=this.tail=null):(M+=a(_,0,y),this.head=w,w.data=a(_,y));break}++g}while((w=w.next)!==null);return this.length-=g,M}_getBuffer(y){let M=n.allocUnsafe(y),w=y,g=this.head,_=0;do{let x=g.data;if(y>x.length)f(M,x,w-y),y-=x.length;else{y===x.length?(f(M,x,w-y),++_,g.next?this.head=g.next:this.head=this.tail=null):(f(M,new d(x.buffer,x.byteOffset,y),w-y),this.head=g,g.data=x.slice(y));break}++_}while((g=g.next)!==null);return this.length-=_,M}[Symbol.for("nodejs.util.inspect.custom")](y,M){return v(this,{...M,depth:0,customInspect:!1})}},KS}var jS={},UV=!1;function i3(){if(UV)return jS;UV=!0;let{MathFloor:a,NumberIsInteger:o}=Gi(),{validateInteger:f}=gp(),{ERR_INVALID_ARG_VALUE:d}=xa().codes,n=16*1024,v=16;function b(g,_,x){return g.highWaterMark!=null?g.highWaterMark:_?g[x]:null}function y(g){return g?v:n}function M(g,_){f(_,"value",0),g?v=_:n=_}function w(g,_,x,E){let R=b(_,E,x);if(R!=null){if(!o(R)||R<0){let T=E?`options.${x}`:"options.highWaterMark";throw new d(T,R)}return a(R)}return y(g.objectMode)}return jS={getHighWaterMark:w,getDefaultHighWaterMark:y,setDefaultHighWaterMark:M},jS}var WS={},FV=!1;function hJ(){if(FV)return WS;FV=!0;let a=o0,{PromisePrototypeThen:o,SymbolAsyncIterator:f,SymbolIterator:d}=Gi(),{Buffer:n}=Mh(),{ERR_INVALID_ARG_TYPE:v,ERR_STREAM_NULL_VALUES:b}=xa().codes;function y(M,w,g){let _;if(typeof w=="string"||w instanceof n)return new M({objectMode:!0,...g,read(){this.push(w),this.push(null)}});let x;if(w&&w[f])x=!0,_=w[f]();else if(w&&w[d])x=!1,_=w[d]();else throw new v("iterable",["Iterable"],w);let E=new M({objectMode:!0,highWaterMark:1,...g}),R=!1;E._read=function(){R||(R=!0,N())},E._destroy=function(P,L){o(T(P),()=>a.nextTick(L,P),D=>a.nextTick(L,D||P))};async function T(P){let L=P!=null,D=typeof _.throw=="function";if(L&&D){let{value:Z,done:W}=await _.throw(P);if(await Z,W)return}if(typeof _.return=="function"){let{value:Z}=await _.return();await Z}}async function N(){for(;;){try{let{value:P,done:L}=x?await _.next():_.next();if(L)E.push(null);else{let D=P&&typeof P.then=="function"?await P:P;if(D===null)throw R=!1,new b;if(E.push(D))continue;R=!1}}catch(P){E.destroy(P)}break}}return E}return WS=y,WS}var ZS={},zV=!1,_t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis;function n3(){if(zV)return ZS;zV=!0;let a=o0,{ArrayPrototypeIndexOf:o,NumberIsInteger:f,NumberIsNaN:d,NumberParseInt:n,ObjectDefineProperties:v,ObjectKeys:b,ObjectSetPrototypeOf:y,Promise:M,SafeSet:w,SymbolAsyncDispose:g,SymbolAsyncIterator:_,Symbol:x}=Gi();ZS=nt,nt.ReadableState=he;let{EventEmitter:E}=_h,{Stream:R,prependListener:T}=dE(),{Buffer:N}=Mh(),{addAbortSignal:P}=r3(),L=Sh(),D=fa().debuglog("stream",se=>{D=se}),Z=f2e(),W=Wd(),{getHighWaterMark:Q,getDefaultHighWaterMark:K}=i3(),{aggregateTwoErrors:z,codes:{ERR_INVALID_ARG_TYPE:X,ERR_METHOD_NOT_IMPLEMENTED:p,ERR_OUT_OF_RANGE:e,ERR_STREAM_PUSH_AFTER_EOF:r,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:i},AbortError:s}=xa(),{validateObject:h}=gp(),c=x("kPaused"),{StringDecoder:m}=sE,l=hJ();y(nt.prototype,R.prototype),y(nt,R);let t=()=>{},{errorOrDestroy:u}=W,S=1,B=2,k=4,q=8,F=16,ee=32,te=64,O=128,U=256,oe=512,Y=1024,j=2048,V=4096,G=8192,ie=16384,me=32768,re=65536,ae=1<<17,ye=1<<18;function fe(se){return{enumerable:!1,get(){return((this||_t).state&se)!==0},set(ue){ue?(this||_t).state|=se:(this||_t).state&=~se}}}v(he.prototype,{objectMode:fe(S),ended:fe(B),endEmitted:fe(k),reading:fe(q),constructed:fe(F),sync:fe(ee),needReadable:fe(te),emittedReadable:fe(O),readableListening:fe(U),resumeScheduled:fe(oe),errorEmitted:fe(Y),emitClose:fe(j),autoDestroy:fe(V),destroyed:fe(G),closed:fe(ie),closeEmitted:fe(me),multiAwaitDrain:fe(re),readingMore:fe(ae),dataEmitted:fe(ye)});function he(se,ue,ht){typeof ht!="boolean"&&(ht=ue instanceof a0()),(this||_t).state=j|V|F|ee,se&&se.objectMode&&((this||_t).state|=S),ht&&se&&se.readableObjectMode&&((this||_t).state|=S),(this||_t).highWaterMark=se?Q(this||_t,se,"readableHighWaterMark",ht):K(!1),(this||_t).buffer=new Z,(this||_t).length=0,(this||_t).pipes=[],(this||_t).flowing=null,(this||_t)[c]=null,se&&se.emitClose===!1&&((this||_t).state&=~j),se&&se.autoDestroy===!1&&((this||_t).state&=~V),(this||_t).errored=null,(this||_t).defaultEncoding=se&&se.defaultEncoding||"utf8",(this||_t).awaitDrainWriters=null,(this||_t).decoder=null,(this||_t).encoding=null,se&&se.encoding&&((this||_t).decoder=new m(se.encoding),(this||_t).encoding=se.encoding)}function nt(se){if(!((this||_t)instanceof nt))return new nt(se);let ue=(this||_t)instanceof a0();(this||_t)._readableState=new he(se,this||_t,ue),se&&(typeof se.read=="function"&&((this||_t)._read=se.read),typeof se.destroy=="function"&&((this||_t)._destroy=se.destroy),typeof se.construct=="function"&&((this||_t)._construct=se.construct),se.signal&&!ue&&P(se.signal,this||_t)),R.call(this||_t,se),W.construct(this||_t,()=>{(this||_t)._readableState.needReadable&&ne(this||_t,(this||_t)._readableState)})}nt.prototype.destroy=W.destroy,nt.prototype._undestroy=W.undestroy,nt.prototype._destroy=function(se,ue){ue(se)},nt.prototype[E.captureRejectionSymbol]=function(se){this.destroy(se)},nt.prototype[g]=function(){let se;return(this||_t).destroyed||(se=(this||_t).readableEnded?null:new s,this.destroy(se)),new M((ue,ht)=>L(this||_t,pe=>pe&&pe!==se?ht(pe):ue(null)))},nt.prototype.push=function(se,ue){return ce(this||_t,se,ue,!1)},nt.prototype.unshift=function(se,ue){return ce(this||_t,se,ue,!0)};function ce(se,ue,ht,pe){D("readableAddChunk",ue);let Se=se._readableState,dt;if(Se.state&S||(typeof ue=="string"?(ht=ht||Se.defaultEncoding,Se.encoding!==ht&&(pe&&Se.encoding?ue=N.from(ue,ht).toString(Se.encoding):(ue=N.from(ue,ht),ht=""))):ue instanceof N?ht="":R._isUint8Array(ue)?(ue=R._uint8ArrayToBuffer(ue),ht=""):ue!=null&&(dt=new X("chunk",["string","Buffer","Uint8Array"],ue))),dt)u(se,dt);else if(ue===null)Se.state&=~q,I(se,Se);else if(Se.state&S||ue&&ue.length>0)if(pe)if(Se.state&k)u(se,new i);else{if(Se.destroyed||Se.errored)return!1;be(se,Se,ue,!0)}else if(Se.ended)u(se,new r);else{if(Se.destroyed||Se.errored)return!1;Se.state&=~q,Se.decoder&&!ht?(ue=Se.decoder.write(ue),Se.objectMode||ue.length!==0?be(se,Se,ue,!1):ne(se,Se)):be(se,Se,ue,!1)}else pe||(Se.state&=~q,ne(se,Se));return!Se.ended&&(Se.length<Se.highWaterMark||Se.length===0)}function be(se,ue,ht,pe){ue.flowing&&ue.length===0&&!ue.sync&&se.listenerCount("data")>0?(ue.state&re?ue.awaitDrainWriters.clear():ue.awaitDrainWriters=null,ue.dataEmitted=!0,se.emit("data",ht)):(ue.length+=ue.objectMode?1:ht.length,pe?ue.buffer.unshift(ht):ue.buffer.push(ht),ue.state&te&&C(se)),ne(se,ue)}nt.prototype.isPaused=function(){let se=(this||_t)._readableState;return se[c]===!0||se.flowing===!1},nt.prototype.setEncoding=function(se){let ue=new m(se);(this||_t)._readableState.decoder=ue,(this||_t)._readableState.encoding=(this||_t)._readableState.decoder.encoding;let ht=(this||_t)._readableState.buffer,pe="";for(let Se of ht)pe+=ue.write(Se);return ht.clear(),pe!==""&&ht.push(pe),(this||_t)._readableState.length=pe.length,this||_t};let ut=1073741824;function $(se){if(se>ut)throw new e("size","<= 1GiB",se);return se--,se|=se>>>1,se|=se>>>2,se|=se>>>4,se|=se>>>8,se|=se>>>16,se++,se}function A(se,ue){return se<=0||ue.length===0&&ue.ended?0:ue.state&S?1:d(se)?ue.flowing&&ue.length?ue.buffer.first().length:ue.length:se<=ue.length?se:ue.ended?ue.length:0}nt.prototype.read=function(se){D("read",se),se===void 0?se=NaN:f(se)||(se=n(se,10));let ue=(this||_t)._readableState,ht=se;if(se>ue.highWaterMark&&(ue.highWaterMark=$(se)),se!==0&&(ue.state&=~O),se===0&&ue.needReadable&&((ue.highWaterMark!==0?ue.length>=ue.highWaterMark:ue.length>0)||ue.ended))return D("read: emitReadable",ue.length,ue.ended),ue.length===0&&ue.ended?Ne(this||_t):C(this||_t),null;if(se=A(se,ue),se===0&&ue.ended)return ue.length===0&&Ne(this||_t),null;let pe=(ue.state&te)!==0;if(D("need readable",pe),(ue.length===0||ue.length-se<ue.highWaterMark)&&(pe=!0,D("length less than watermark",pe)),ue.ended||ue.reading||ue.destroyed||ue.errored||!ue.constructed)pe=!1,D("reading, ended or constructing",pe);else if(pe){D("do read"),ue.state|=q|ee,ue.length===0&&(ue.state|=te);try{this._read(ue.highWaterMark)}catch(dt){u(this||_t,dt)}ue.state&=~ee,ue.reading||(se=A(ht,ue))}let Se;return se>0?Se=Me(se,ue):Se=null,Se===null?(ue.needReadable=ue.length<=ue.highWaterMark,se=0):(ue.length-=se,ue.multiAwaitDrain?ue.awaitDrainWriters.clear():ue.awaitDrainWriters=null),ue.length===0&&(ue.ended||(ue.needReadable=!0),ht!==se&&ue.ended&&Ne(this||_t)),Se!==null&&!ue.errorEmitted&&!ue.closeEmitted&&(ue.dataEmitted=!0,this.emit("data",Se)),Se};function I(se,ue){if(D("onEofChunk"),!ue.ended){if(ue.decoder){let ht=ue.decoder.end();ht&&ht.length&&(ue.buffer.push(ht),ue.length+=ue.objectMode?1:ht.length)}ue.ended=!0,ue.sync?C(se):(ue.needReadable=!1,ue.emittedReadable=!0,H(se))}}function C(se){let ue=se._readableState;D("emitReadable",ue.needReadable,ue.emittedReadable),ue.needReadable=!1,ue.emittedReadable||(D("emitReadable",ue.flowing),ue.emittedReadable=!0,a.nextTick(H,se))}function H(se){let ue=se._readableState;D("emitReadable_",ue.destroyed,ue.length,ue.ended),!ue.destroyed&&!ue.errored&&(ue.length||ue.ended)&&(se.emit("readable"),ue.emittedReadable=!1),ue.needReadable=!ue.flowing&&!ue.ended&&ue.length<=ue.highWaterMark,we(se)}function ne(se,ue){!ue.readingMore&&ue.constructed&&(ue.readingMore=!0,a.nextTick(J,se,ue))}function J(se,ue){for(;!ue.reading&&!ue.ended&&(ue.length<ue.highWaterMark||ue.flowing&&ue.length===0);){let ht=ue.length;if(D("maybeReadMore read 0"),se.read(0),ht===ue.length)break}ue.readingMore=!1}nt.prototype._read=function(se){throw new p("_read()")},nt.prototype.pipe=function(se,ue){let ht=this||_t,pe=(this||_t)._readableState;pe.pipes.length===1&&(pe.multiAwaitDrain||(pe.multiAwaitDrain=!0,pe.awaitDrainWriters=new w(pe.awaitDrainWriters?[pe.awaitDrainWriters]:[]))),pe.pipes.push(se),D("pipe count=%d opts=%j",pe.pipes.length,ue);let dt=(!ue||ue.end!==!1)&&se!==a.stdout&&se!==a.stderr?De:yt;pe.endEmitted?a.nextTick(dt):ht.once("end",dt),se.on("unpipe",ge);function ge(xt,Mt){D("onunpipe"),xt===ht&&Mt&&Mt.hasUnpiped===!1&&(Mt.hasUnpiped=!0,Oe())}function De(){D("onend"),se.end()}let ct,_e=!1;function Oe(){D("cleanup"),se.removeListener("close",pt),se.removeListener("finish",lt),ct&&se.removeListener("drain",ct),se.removeListener("error",Pe),se.removeListener("unpipe",ge),ht.removeListener("end",De),ht.removeListener("end",yt),ht.removeListener("data",Ee),_e=!0,ct&&pe.awaitDrainWriters&&(!se._writableState||se._writableState.needDrain)&&ct()}function gt(){_e||(pe.pipes.length===1&&pe.pipes[0]===se?(D("false write response, pause",0),pe.awaitDrainWriters=se,pe.multiAwaitDrain=!1):pe.pipes.length>1&&pe.pipes.includes(se)&&(D("false write response, pause",pe.awaitDrainWriters.size),pe.awaitDrainWriters.add(se)),ht.pause()),ct||(ct=de(ht,se),se.on("drain",ct))}ht.on("data",Ee);function Ee(xt){D("ondata");let Mt=se.write(xt);D("dest.write",Mt),Mt===!1&>()}function Pe(xt){if(D("onerror",xt),yt(),se.removeListener("error",Pe),se.listenerCount("error")===0){let Mt=se._writableState||se._readableState;Mt&&!Mt.errorEmitted?u(se,xt):se.emit("error",xt)}}T(se,"error",Pe);function pt(){se.removeListener("finish",lt),yt()}se.once("close",pt);function lt(){D("onfinish"),se.removeListener("close",pt),yt()}se.once("finish",lt);function yt(){D("unpipe"),ht.unpipe(se)}return se.emit("pipe",ht),se.writableNeedDrain===!0?gt():pe.flowing||(D("pipe resume"),ht.resume()),se};function de(se,ue){return function(){let pe=se._readableState;pe.awaitDrainWriters===ue?(D("pipeOnDrain",1),pe.awaitDrainWriters=null):pe.multiAwaitDrain&&(D("pipeOnDrain",pe.awaitDrainWriters.size),pe.awaitDrainWriters.delete(ue)),(!pe.awaitDrainWriters||pe.awaitDrainWriters.size===0)&&se.listenerCount("data")&&se.resume()}}nt.prototype.unpipe=function(se){let ue=(this||_t)._readableState,ht={hasUnpiped:!1};if(ue.pipes.length===0)return this||_t;if(!se){let Se=ue.pipes;ue.pipes=[],this.pause();for(let dt=0;dt<Se.length;dt++)Se[dt].emit("unpipe",this||_t,{hasUnpiped:!1});return this||_t}let pe=o(ue.pipes,se);return pe===-1?this||_t:(ue.pipes.splice(pe,1),ue.pipes.length===0&&this.pause(),se.emit("unpipe",this||_t,ht),this||_t)},nt.prototype.on=function(se,ue){let ht=R.prototype.on.call(this||_t,se,ue),pe=(this||_t)._readableState;return se==="data"?(pe.readableListening=this.listenerCount("readable")>0,pe.flowing!==!1&&this.resume()):se==="readable"&&!pe.endEmitted&&!pe.readableListening&&(pe.readableListening=pe.needReadable=!0,pe.flowing=!1,pe.emittedReadable=!1,D("on readable",pe.length,pe.reading),pe.length?C(this||_t):pe.reading||a.nextTick(le,this||_t)),ht},nt.prototype.addListener=nt.prototype.on,nt.prototype.removeListener=function(se,ue){let ht=R.prototype.removeListener.call(this||_t,se,ue);return se==="readable"&&a.nextTick(st,this||_t),ht},nt.prototype.off=nt.prototype.removeListener,nt.prototype.removeAllListeners=function(se){let ue=R.prototype.removeAllListeners.apply(this||_t,arguments);return(se==="readable"||se===void 0)&&a.nextTick(st,this||_t),ue};function st(se){let ue=se._readableState;ue.readableListening=se.listenerCount("readable")>0,ue.resumeScheduled&&ue[c]===!1?ue.flowing=!0:se.listenerCount("data")>0?se.resume():ue.readableListening||(ue.flowing=null)}function le(se){D("readable nexttick read 0"),se.read(0)}nt.prototype.resume=function(){let se=(this||_t)._readableState;return se.flowing||(D("resume"),se.flowing=!se.readableListening,ve(this||_t,se)),se[c]=!1,this||_t};function ve(se,ue){ue.resumeScheduled||(ue.resumeScheduled=!0,a.nextTick(ot,se,ue))}function ot(se,ue){D("resume",ue.reading),ue.reading||se.read(0),ue.resumeScheduled=!1,se.emit("resume"),we(se),ue.flowing&&!ue.reading&&se.read(0)}nt.prototype.pause=function(){return D("call pause flowing=%j",(this||_t)._readableState.flowing),(this||_t)._readableState.flowing!==!1&&(D("pause"),(this||_t)._readableState.flowing=!1,this.emit("pause")),(this||_t)._readableState[c]=!0,this||_t};function we(se){let ue=se._readableState;for(D("flow",ue.flowing);ue.flowing&&se.read()!==null;);}nt.prototype.wrap=function(se){let ue=!1;se.on("data",pe=>{!this.push(pe)&&se.pause&&(ue=!0,se.pause())}),se.on("end",()=>{this.push(null)}),se.on("error",pe=>{u(this||_t,pe)}),se.on("close",()=>{this.destroy()}),se.on("destroy",()=>{this.destroy()}),(this||_t)._read=()=>{ue&&se.resume&&(ue=!1,se.resume())};let ht=b(se);for(let pe=1;pe<ht.length;pe++){let Se=ht[pe];(this||_t)[Se]===void 0&&typeof se[Se]=="function"&&((this||_t)[Se]=se[Se].bind(se))}return this||_t},nt.prototype[_]=function(){return Le(this||_t)},nt.prototype.iterator=function(se){return se!==void 0&&h(se,"options"),Le(this||_t,se)};function Le(se,ue){typeof se.read!="function"&&(se=nt.wrap(se,{objectMode:!0}));let ht=bt(se,ue);return ht.stream=se,ht}async function*bt(se,ue){let ht=t;function pe(ge){(this||_t)===se?(ht(),ht=t):ht=ge}se.on("readable",pe);let Se,dt=L(se,{writable:!1},ge=>{Se=ge?z(Se,ge):null,ht(),ht=t});try{for(;;){let ge=se.destroyed?null:se.read();if(ge!==null)yield ge;else{if(Se)throw Se;if(Se===null)return;await new M(pe)}}}catch(ge){throw Se=z(Se,ge),Se}finally{(Se||ue?.destroyOnReturn!==!1)&&(Se===void 0||se._readableState.autoDestroy)?W.destroyer(se,null):(se.off("readable",pe),dt())}}v(nt.prototype,{readable:{__proto__:null,get(){let se=(this||_t)._readableState;return!!se&&se.readable!==!1&&!se.destroyed&&!se.errorEmitted&&!se.endEmitted},set(se){(this||_t)._readableState&&((this||_t)._readableState.readable=!!se)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||_t)._readableState.readable!==!1&&((this||_t)._readableState.destroyed||(this||_t)._readableState.errored)&&!(this||_t)._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState&&(this||_t)._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState.flowing},set:function(se){(this||_t)._readableState&&((this||_t)._readableState.flowing=se)}},readableLength:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.errored:null}},closed:{__proto__:null,get(){return(this||_t)._readableState?(this||_t)._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.destroyed:!1},set(se){(this||_t)._readableState&&((this||_t)._readableState.destroyed=se)}},readableEnded:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.endEmitted:!1}}}),v(he.prototype,{pipesCount:{__proto__:null,get(){return(this||_t).pipes.length}},paused:{__proto__:null,get(){return(this||_t)[c]!==!1},set(se){(this||_t)[c]=!!se}}}),nt._fromList=Me;function Me(se,ue){if(ue.length===0)return null;let ht;return ue.objectMode?ht=ue.buffer.shift():!se||se>=ue.length?(ue.decoder?ht=ue.buffer.join(""):ue.buffer.length===1?ht=ue.buffer.first():ht=ue.buffer.concat(ue.length),ue.buffer.clear()):ht=ue.buffer.consume(se,ue.decoder),ht}function Ne(se){let ue=se._readableState;D("endReadable",ue.endEmitted),ue.endEmitted||(ue.ended=!0,a.nextTick(mt,ue,se))}function mt(se,ue){if(D("endReadableNT",se.endEmitted,se.length),!se.errored&&!se.closeEmitted&&!se.endEmitted&&se.length===0){if(se.endEmitted=!0,ue.emit("end"),ue.writable&&ue.allowHalfOpen===!1)a.nextTick(xe,ue);else if(se.autoDestroy){let ht=ue._writableState;(!ht||ht.autoDestroy&&(ht.finished||ht.writable===!1))&&ue.destroy()}}}function xe(se){se.writable&&!se.writableEnded&&!se.destroyed&&se.end()}nt.from=function(se,ue){return l(nt,se,ue)};let Ce;function vt(){return Ce===void 0&&(Ce={}),Ce}return nt.fromWeb=function(se,ue){return vt().newStreamReadableFromReadableStream(se,ue)},nt.toWeb=function(se,ue){return vt().newReadableStreamFromStreamReadable(se,ue)},nt.wrap=function(se,ue){var ht,pe;return new nt({objectMode:(ht=(pe=se.readableObjectMode)!==null&&pe!==void 0?pe:se.objectMode)!==null&&ht!==void 0?ht:!0,...ue,destroy(Se,dt){W.destroyer(se,Se),dt(Se)}}).wrap(se)},ZS}var GS={},HV=!1,Ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis;function cE(){if(HV)return GS;HV=!0;let a=o0,{ArrayPrototypeSlice:o,Error:f,FunctionPrototypeSymbolHasInstance:d,ObjectDefineProperty:n,ObjectDefineProperties:v,ObjectSetPrototypeOf:b,StringPrototypeToLowerCase:y,Symbol:M,SymbolHasInstance:w}=Gi();GS=h,h.WritableState=i;let{EventEmitter:g}=_h,_=dE().Stream,{Buffer:x}=Mh(),E=Wd(),{addAbortSignal:R}=r3(),{getHighWaterMark:T,getDefaultHighWaterMark:N}=i3(),{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:L,ERR_MULTIPLE_CALLBACK:D,ERR_STREAM_CANNOT_PIPE:Z,ERR_STREAM_DESTROYED:W,ERR_STREAM_ALREADY_FINISHED:Q,ERR_STREAM_NULL_VALUES:K,ERR_STREAM_WRITE_AFTER_END:z,ERR_UNKNOWN_ENCODING:X}=xa().codes,{errorOrDestroy:p}=E;b(h.prototype,_.prototype),b(h,_);function e(){}let r=M("kOnFinished");function i(V,G,ie){typeof ie!="boolean"&&(ie=G instanceof a0()),(this||Ot).objectMode=!!(V&&V.objectMode),ie&&((this||Ot).objectMode=(this||Ot).objectMode||!!(V&&V.writableObjectMode)),(this||Ot).highWaterMark=V?T(this||Ot,V,"writableHighWaterMark",ie):N(!1),(this||Ot).finalCalled=!1,(this||Ot).needDrain=!1,(this||Ot).ending=!1,(this||Ot).ended=!1,(this||Ot).finished=!1,(this||Ot).destroyed=!1;let me=!!(V&&V.decodeStrings===!1);(this||Ot).decodeStrings=!me,(this||Ot).defaultEncoding=V&&V.defaultEncoding||"utf8",(this||Ot).length=0,(this||Ot).writing=!1,(this||Ot).corked=0,(this||Ot).sync=!0,(this||Ot).bufferProcessing=!1,(this||Ot).onwrite=u.bind(void 0,G),(this||Ot).writecb=null,(this||Ot).writelen=0,(this||Ot).afterWriteTickInfo=null,s(this||Ot),(this||Ot).pendingcb=0,(this||Ot).constructed=!0,(this||Ot).prefinished=!1,(this||Ot).errorEmitted=!1,(this||Ot).emitClose=!V||V.emitClose!==!1,(this||Ot).autoDestroy=!V||V.autoDestroy!==!1,(this||Ot).errored=null,(this||Ot).closed=!1,(this||Ot).closeEmitted=!1,(this||Ot)[r]=[]}function s(V){V.buffered=[],V.bufferedIndex=0,V.allBuffers=!0,V.allNoop=!0}i.prototype.getBuffer=function(){return o((this||Ot).buffered,(this||Ot).bufferedIndex)},n(i.prototype,"bufferedRequestCount",{__proto__:null,get(){return(this||Ot).buffered.length-(this||Ot).bufferedIndex}});function h(V){let G=(this||Ot)instanceof a0();if(!G&&!d(h,this||Ot))return new h(V);(this||Ot)._writableState=new i(V,this||Ot,G),V&&(typeof V.write=="function"&&((this||Ot)._write=V.write),typeof V.writev=="function"&&((this||Ot)._writev=V.writev),typeof V.destroy=="function"&&((this||Ot)._destroy=V.destroy),typeof V.final=="function"&&((this||Ot)._final=V.final),typeof V.construct=="function"&&((this||Ot)._construct=V.construct),V.signal&&R(V.signal,this||Ot)),_.call(this||Ot,V),E.construct(this||Ot,()=>{let ie=(this||Ot)._writableState;ie.writing||q(this||Ot,ie),O(this||Ot,ie)})}n(h,w,{__proto__:null,value:function(V){return d(this||Ot,V)?!0:(this||Ot)!==h?!1:V&&V._writableState instanceof i}}),h.prototype.pipe=function(){p(this||Ot,new Z)};function c(V,G,ie,me){let re=V._writableState;if(typeof ie=="function")me=ie,ie=re.defaultEncoding;else{if(!ie)ie=re.defaultEncoding;else if(ie!=="buffer"&&!x.isEncoding(ie))throw new X(ie);typeof me!="function"&&(me=e)}if(G===null)throw new K;if(!re.objectMode)if(typeof G=="string")re.decodeStrings!==!1&&(G=x.from(G,ie),ie="buffer");else if(G instanceof x)ie="buffer";else if(_._isUint8Array(G))G=_._uint8ArrayToBuffer(G),ie="buffer";else throw new P("chunk",["string","Buffer","Uint8Array"],G);let ae;return re.ending?ae=new z:re.destroyed&&(ae=new W("write")),ae?(a.nextTick(me,ae),p(V,ae,!0),ae):(re.pendingcb++,m(V,re,G,ie,me))}h.prototype.write=function(V,G,ie){return c(this||Ot,V,G,ie)===!0},h.prototype.cork=function(){(this||Ot)._writableState.corked++},h.prototype.uncork=function(){let V=(this||Ot)._writableState;V.corked&&(V.corked--,V.writing||q(this||Ot,V))},h.prototype.setDefaultEncoding=function(G){if(typeof G=="string"&&(G=y(G)),!x.isEncoding(G))throw new X(G);return(this||Ot)._writableState.defaultEncoding=G,this||Ot};function m(V,G,ie,me,re){let ae=G.objectMode?1:ie.length;G.length+=ae;let ye=G.length<G.highWaterMark;return ye||(G.needDrain=!0),G.writing||G.corked||G.errored||!G.constructed?(G.buffered.push({chunk:ie,encoding:me,callback:re}),G.allBuffers&&me!=="buffer"&&(G.allBuffers=!1),G.allNoop&&re!==e&&(G.allNoop=!1)):(G.writelen=ae,G.writecb=re,G.writing=!0,G.sync=!0,V._write(ie,me,G.onwrite),G.sync=!1),ye&&!G.errored&&!G.destroyed}function l(V,G,ie,me,re,ae,ye){G.writelen=me,G.writecb=ye,G.writing=!0,G.sync=!0,G.destroyed?G.onwrite(new W("write")):ie?V._writev(re,G.onwrite):V._write(re,ae,G.onwrite),G.sync=!1}function t(V,G,ie,me){--G.pendingcb,me(ie),k(G),p(V,ie)}function u(V,G){let ie=V._writableState,me=ie.sync,re=ie.writecb;if(typeof re!="function"){p(V,new D);return}ie.writing=!1,ie.writecb=null,ie.length-=ie.writelen,ie.writelen=0,G?(G.stack,ie.errored||(ie.errored=G),V._readableState&&!V._readableState.errored&&(V._readableState.errored=G),me?a.nextTick(t,V,ie,G,re):t(V,ie,G,re)):(ie.buffered.length>ie.bufferedIndex&&q(V,ie),me?ie.afterWriteTickInfo!==null&&ie.afterWriteTickInfo.cb===re?ie.afterWriteTickInfo.count++:(ie.afterWriteTickInfo={count:1,cb:re,stream:V,state:ie},a.nextTick(S,ie.afterWriteTickInfo)):B(V,ie,1,re))}function S({stream:V,state:G,count:ie,cb:me}){return G.afterWriteTickInfo=null,B(V,G,ie,me)}function B(V,G,ie,me){for(!G.ending&&!V.destroyed&&G.length===0&&G.needDrain&&(G.needDrain=!1,V.emit("drain"));ie-- >0;)G.pendingcb--,me();G.destroyed&&k(G),O(V,G)}function k(V){if(V.writing)return;for(let re=V.bufferedIndex;re<V.buffered.length;++re){var G;let{chunk:ae,callback:ye}=V.buffered[re],fe=V.objectMode?1:ae.length;V.length-=fe,ye((G=V.errored)!==null&&G!==void 0?G:new W("write"))}let ie=V[r].splice(0);for(let re=0;re<ie.length;re++){var me;ie[re]((me=V.errored)!==null&&me!==void 0?me:new W("end"))}s(V)}function q(V,G){if(G.corked||G.bufferProcessing||G.destroyed||!G.constructed)return;let{buffered:ie,bufferedIndex:me,objectMode:re}=G,ae=ie.length-me;if(!ae)return;let ye=me;if(G.bufferProcessing=!0,ae>1&&V._writev){G.pendingcb-=ae-1;let fe=G.allNoop?e:nt=>{for(let ce=ye;ce<ie.length;++ce)ie[ce].callback(nt)},he=G.allNoop&&ye===0?ie:o(ie,ye);he.allBuffers=G.allBuffers,l(V,G,!0,G.length,he,"",fe),s(G)}else{do{let{chunk:fe,encoding:he,callback:nt}=ie[ye];ie[ye++]=null;let ce=re?1:fe.length;l(V,G,!1,ce,fe,he,nt)}while(ye<ie.length&&!G.writing);ye===ie.length?s(G):ye>256?(ie.splice(0,ye),G.bufferedIndex=0):G.bufferedIndex=ye}G.bufferProcessing=!1}h.prototype._write=function(V,G,ie){if((this||Ot)._writev)this._writev([{chunk:V,encoding:G}],ie);else throw new L("_write()")},h.prototype._writev=null,h.prototype.end=function(V,G,ie){let me=(this||Ot)._writableState;typeof V=="function"?(ie=V,V=null,G=null):typeof G=="function"&&(ie=G,G=null);let re;if(V!=null){let ae=c(this||Ot,V,G);ae instanceof f&&(re=ae)}return me.corked&&(me.corked=1,this.uncork()),re||(!me.errored&&!me.ending?(me.ending=!0,O(this||Ot,me,!0),me.ended=!0):me.finished?re=new Q("end"):me.destroyed&&(re=new W("end"))),typeof ie=="function"&&(re||me.finished?a.nextTick(ie,re):me[r].push(ie)),this||Ot};function F(V){return V.ending&&!V.destroyed&&V.constructed&&V.length===0&&!V.errored&&V.buffered.length===0&&!V.finished&&!V.writing&&!V.errorEmitted&&!V.closeEmitted}function ee(V,G){let ie=!1;function me(re){if(ie){p(V,re??D());return}if(ie=!0,G.pendingcb--,re){let ae=G[r].splice(0);for(let ye=0;ye<ae.length;ye++)ae[ye](re);p(V,re,G.sync)}else F(G)&&(G.prefinished=!0,V.emit("prefinish"),G.pendingcb++,a.nextTick(U,V,G))}G.sync=!0,G.pendingcb++;try{V._final(me)}catch(re){me(re)}G.sync=!1}function te(V,G){!G.prefinished&&!G.finalCalled&&(typeof V._final=="function"&&!G.destroyed?(G.finalCalled=!0,ee(V,G)):(G.prefinished=!0,V.emit("prefinish")))}function O(V,G,ie){F(G)&&(te(V,G),G.pendingcb===0&&(ie?(G.pendingcb++,a.nextTick((me,re)=>{F(re)?U(me,re):re.pendingcb--},V,G)):F(G)&&(G.pendingcb++,U(V,G))))}function U(V,G){G.pendingcb--,G.finished=!0;let ie=G[r].splice(0);for(let me=0;me<ie.length;me++)ie[me]();if(V.emit("finish"),G.autoDestroy){let me=V._readableState;(!me||me.autoDestroy&&(me.endEmitted||me.readable===!1))&&V.destroy()}}v(h.prototype,{closed:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.closed:!1}},destroyed:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.destroyed:!1},set(V){(this||Ot)._writableState&&((this||Ot)._writableState.destroyed=V)}},writable:{__proto__:null,get(){let V=(this||Ot)._writableState;return!!V&&V.writable!==!1&&!V.destroyed&&!V.errored&&!V.ending&&!V.ended},set(V){(this||Ot)._writableState&&((this||Ot)._writableState.writable=!!V)}},writableFinished:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return(this||Ot)._writableState&&(this||Ot)._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let V=(this||Ot)._writableState;return V?!V.destroyed&&!V.ending&&V.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return(this||Ot)._writableState&&(this||Ot)._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.corked:0}},writableLength:{__proto__:null,get(){return(this||Ot)._writableState&&(this||Ot)._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return(this||Ot)._writableState?(this||Ot)._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||Ot)._writableState.writable!==!1&&((this||Ot)._writableState.destroyed||(this||Ot)._writableState.errored)&&!(this||Ot)._writableState.finished)}}});let oe=E.destroy;h.prototype.destroy=function(V,G){let ie=(this||Ot)._writableState;return!ie.destroyed&&(ie.bufferedIndex<ie.buffered.length||ie[r].length)&&a.nextTick(k,ie),oe.call(this||Ot,V,G),this||Ot},h.prototype._undestroy=E.undestroy,h.prototype._destroy=function(V,G){G(V)},h.prototype[g.captureRejectionSymbol]=function(V){this.destroy(V)};let Y;function j(){return Y===void 0&&(Y={}),Y}return h.fromWeb=function(V,G){return j().newStreamWritableFromWritableStream(V,G)},h.toWeb=function(V){return j().newWritableStreamFromStreamWritable(V)},GS}var VS={},KV=!1;function h2e(){if(KV)return VS;KV=!0;let a=o0,o=Mh(),{isReadable:f,isWritable:d,isIterable:n,isNodeStream:v,isReadableNodeStream:b,isWritableNodeStream:y,isDuplexNodeStream:M,isReadableStream:w,isWritableStream:g}=s0(),_=Sh(),{AbortError:x,codes:{ERR_INVALID_ARG_TYPE:E,ERR_INVALID_RETURN_VALUE:R}}=xa(),{destroyer:T}=Wd(),N=a0(),P=n3(),L=cE(),{createDeferredPromise:D}=fa(),Z=hJ(),W=globalThis.Blob||o.Blob,Q=typeof W<"u"?function(i){return i instanceof W}:function(i){return!1},K=globalThis.AbortController||bp().AbortController,{FunctionPrototypeCall:z}=Gi();class X extends N{constructor(i){super(i),i?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),i?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}VS=function r(i,s){if(M(i))return i;if(b(i))return e({readable:i});if(y(i))return e({writable:i});if(v(i))return e({writable:!1,readable:!1});if(w(i))return e({readable:P.fromWeb(i)});if(g(i))return e({writable:L.fromWeb(i)});if(typeof i=="function"){let{value:c,write:m,final:l,destroy:t}=p(i);if(n(c))return Z(X,c,{objectMode:!0,write:m,final:l,destroy:t});let u=c?.then;if(typeof u=="function"){let S,B=z(u,c,k=>{if(k!=null)throw new R("nully","body",k)},k=>{T(S,k)});return S=new X({objectMode:!0,readable:!1,write:m,final(k){l(async()=>{try{await B,a.nextTick(k,null)}catch(q){a.nextTick(k,q)}})},destroy:t})}throw new R("Iterable, AsyncIterable or AsyncFunction",s,c)}if(Q(i))return r(i.arrayBuffer());if(n(i))return Z(X,i,{objectMode:!0,writable:!1});if(w(i?.readable)&&g(i?.writable))return X.fromWeb(i);if(typeof i?.writable=="object"||typeof i?.readable=="object"){let c=i!=null&&i.readable?b(i?.readable)?i?.readable:r(i.readable):void 0,m=i!=null&&i.writable?y(i?.writable)?i?.writable:r(i.writable):void 0;return e({readable:c,writable:m})}let h=i?.then;if(typeof h=="function"){let c;return z(h,i,m=>{m!=null&&c.push(m),c.push(null)},m=>{T(c,m)}),c=new X({objectMode:!0,writable:!1,read(){}})}throw new E(s,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],i)};function p(r){let{promise:i,resolve:s}=D(),h=new K,c=h.signal;return{value:r(async function*(){for(;;){let l=i;i=null;let{chunk:t,done:u,cb:S}=await l;if(a.nextTick(S),u)return;if(c.aborted)throw new x(void 0,{cause:c.reason});({promise:i,resolve:s}=D()),yield t}}(),{signal:c}),write(l,t,u){let S=s;s=null,S({chunk:l,done:!1,cb:u})},final(l){let t=s;s=null,t({done:!0,cb:l})},destroy(l,t){h.abort(),t(l)}}}function e(r){let i=r.readable&&typeof r.readable.read!="function"?P.wrap(r.readable):r.readable,s=r.writable,h=!!f(i),c=!!d(s),m,l,t,u,S;function B(k){let q=u;u=null,q?q(k):k&&S.destroy(k)}return S=new X({readableObjectMode:!!(i!=null&&i.readableObjectMode),writableObjectMode:!!(s!=null&&s.writableObjectMode),readable:h,writable:c}),c&&(_(s,k=>{c=!1,k&&T(i,k),B(k)}),S._write=function(k,q,F){s.write(k,q)?F():m=F},S._final=function(k){s.end(),l=k},s.on("drain",function(){if(m){let k=m;m=null,k()}}),s.on("finish",function(){if(l){let k=l;l=null,k()}})),h&&(_(i,k=>{h=!1,k&&T(i,k),B(k)}),i.on("readable",function(){if(t){let k=t;t=null,k()}}),i.on("end",function(){S.push(null)}),S._read=function(){for(;;){let k=i.read();if(k===null){t=S._read;return}if(!S.push(k))return}}),S._destroy=function(k,q){!k&&u!==null&&(k=new x),t=null,m=null,l=null,u===null?q(k):(u=q,T(s,k),T(i,k))},S}return VS}var JS={},jV=!1;function a0(){if(jV)return JS;jV=!0;let{ObjectDefineProperties:a,ObjectGetOwnPropertyDescriptor:o,ObjectKeys:f,ObjectSetPrototypeOf:d}=Gi();JS=b;let n=n3(),v=cE();d(b.prototype,n.prototype),d(b,n);{let g=f(v.prototype);for(let _=0;_<g.length;_++){let x=g[_];b.prototype[x]||(b.prototype[x]=v.prototype[x])}}function b(g){if(!(this instanceof b))return new b(g);n.call(this,g),v.call(this,g),g?(this.allowHalfOpen=g.allowHalfOpen!==!1,g.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),g.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}a(b.prototype,{writable:{__proto__:null,...o(v.prototype,"writable")},writableHighWaterMark:{__proto__:null,...o(v.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...o(v.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...o(v.prototype,"writableBuffer")},writableLength:{__proto__:null,...o(v.prototype,"writableLength")},writableFinished:{__proto__:null,...o(v.prototype,"writableFinished")},writableCorked:{__proto__:null,...o(v.prototype,"writableCorked")},writableEnded:{__proto__:null,...o(v.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...o(v.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(g){this._readableState&&this._writableState&&(this._readableState.destroyed=g,this._writableState.destroyed=g)}}});let y;function M(){return y===void 0&&(y={}),y}b.fromWeb=function(g,_){return M().newStreamDuplexFromReadableWritablePair(g,_)},b.toWeb=function(g){return M().newReadableWritablePairFromDuplex(g)};let w;return b.from=function(g){return w||(w=h2e()),w(g,"body")},JS}var YS={},WV=!1;function uJ(){if(WV)return YS;WV=!0;let{ObjectSetPrototypeOf:a,Symbol:o}=Gi();YS=b;let{ERR_METHOD_NOT_IMPLEMENTED:f}=xa().codes,d=a0(),{getHighWaterMark:n}=i3();a(b.prototype,d.prototype),a(b,d);let v=o("kCallback");function b(w){if(!(this instanceof b))return new b(w);let g=w?n(this,w,"readableHighWaterMark",!0):null;g===0&&(w={...w,highWaterMark:null,readableHighWaterMark:g,writableHighWaterMark:w.writableHighWaterMark||0}),d.call(this,w),this._readableState.sync=!1,this[v]=null,w&&(typeof w.transform=="function"&&(this._transform=w.transform),typeof w.flush=="function"&&(this._flush=w.flush)),this.on("prefinish",M)}function y(w){typeof this._flush=="function"&&!this.destroyed?this._flush((g,_)=>{if(g){w?w(g):this.destroy(g);return}_!=null&&this.push(_),this.push(null),w&&w()}):(this.push(null),w&&w())}function M(){this._final!==y&&y.call(this)}return b.prototype._final=y,b.prototype._transform=function(w,g,_){throw new f("_transform()")},b.prototype._write=function(w,g,_){let x=this._readableState,E=this._writableState,R=x.length;this._transform(w,g,(T,N)=>{if(T){_(T);return}N!=null&&this.push(N),E.ended||R===x.length||x.length<x.highWaterMark?_():this[v]=_})},b.prototype._read=function(){if(this[v]){let w=this[v];this[v]=null,w()}},YS}var XS={},ZV=!1;function lJ(){if(ZV)return XS;ZV=!0;let{ObjectSetPrototypeOf:a}=Gi();XS=f;let o=uJ();a(f.prototype,o.prototype),a(f,o);function f(d){if(!(this instanceof f))return new f(d);o.call(this,d)}return f.prototype._transform=function(d,n,v){v(null,d)},XS}var QS={},GV=!1;function pE(){if(GV)return QS;GV=!0;let a=o0,{ArrayIsArray:o,Promise:f,SymbolAsyncIterator:d,SymbolDispose:n}=Gi(),v=Sh(),{once:b}=fa(),y=Wd(),M=a0(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_,ERR_MISSING_ARGS:x,ERR_STREAM_DESTROYED:E,ERR_STREAM_PREMATURE_CLOSE:R},AbortError:T}=xa(),{validateFunction:N,validateAbortSignal:P}=gp(),{isIterable:L,isReadable:D,isReadableNodeStream:Z,isNodeStream:W,isTransformStream:Q,isWebStream:K,isReadableStream:z,isReadableFinished:X}=s0(),p=globalThis.AbortController||bp().AbortController,e,r,i;function s(k,q,F){let ee=!1;k.on("close",()=>{ee=!0});let te=v(k,{readable:q,writable:F},O=>{ee=!O});return{destroy:O=>{ee||(ee=!0,y.destroyer(k,O||new E("pipe")))},cleanup:te}}function h(k){return N(k[k.length-1],"streams[stream.length - 1]"),k.pop()}function c(k){if(L(k))return k;if(Z(k))return m(k);throw new g("val",["Readable","Iterable","AsyncIterable"],k)}async function*m(k){r||(r=n3()),yield*r.prototype[d].call(k)}async function l(k,q,F,{end:ee}){let te,O=null,U=j=>{if(j&&(te=j),O){let V=O;O=null,V()}},oe=()=>new f((j,V)=>{te?V(te):O=()=>{te?V(te):j()}});q.on("drain",U);let Y=v(q,{readable:!1},U);try{q.writableNeedDrain&&await oe();for await(let j of k)q.write(j)||await oe();ee&&(q.end(),await oe()),F()}catch(j){F(te!==j?w(te,j):j)}finally{Y(),q.off("drain",U)}}async function t(k,q,F,{end:ee}){Q(q)&&(q=q.writable);let te=q.getWriter();try{for await(let O of k)await te.ready,te.write(O).catch(()=>{});await te.ready,ee&&await te.close(),F()}catch(O){try{await te.abort(O),F(O)}catch(U){F(U)}}}function u(...k){return S(k,b(h(k)))}function S(k,q,F){if(k.length===1&&o(k[0])&&(k=k[0]),k.length<2)throw new x("streams");let ee=new p,te=ee.signal,O=F?.signal,U=[];P(O,"options.signal");function oe(){re(new T)}i=i||fa().addAbortListener;let Y;O&&(Y=i(O,oe));let j,V,G=[],ie=0;function me(he){re(he,--ie===0)}function re(he,nt){var ce;if(he&&(!j||j.code==="ERR_STREAM_PREMATURE_CLOSE")&&(j=he),!(!j&&!nt)){for(;G.length;)G.shift()(j);(ce=Y)===null||ce===void 0||ce[n](),ee.abort(),nt&&(j||U.forEach(be=>be()),a.nextTick(q,j,V))}}let ae;for(let he=0;he<k.length;he++){let nt=k[he],ce=he<k.length-1,be=he>0,ut=ce||F?.end!==!1,$=he===k.length-1;if(W(nt)){let A=function(I){I&&I.name!=="AbortError"&&I.code!=="ERR_STREAM_PREMATURE_CLOSE"&&me(I)};if(ut){let{destroy:I,cleanup:C}=s(nt,ce,be);G.push(I),D(nt)&&$&&U.push(C)}nt.on("error",A),D(nt)&&$&&U.push(()=>{nt.removeListener("error",A)})}if(he===0)if(typeof nt=="function"){if(ae=nt({signal:te}),!L(ae))throw new _("Iterable, AsyncIterable or Stream","source",ae)}else L(nt)||Z(nt)||Q(nt)?ae=nt:ae=M.from(nt);else if(typeof nt=="function"){if(Q(ae)){var ye;ae=c((ye=ae)===null||ye===void 0?void 0:ye.readable)}else ae=c(ae);if(ae=nt(ae,{signal:te}),ce){if(!L(ae,!0))throw new _("AsyncIterable",`transform[${he-1}]`,ae)}else{var fe;e||(e=lJ());let A=new e({objectMode:!0}),I=(fe=ae)===null||fe===void 0?void 0:fe.then;if(typeof I=="function")ie++,I.call(ae,ne=>{V=ne,ne!=null&&A.write(ne),ut&&A.end(),a.nextTick(me)},ne=>{A.destroy(ne),a.nextTick(me,ne)});else if(L(ae,!0))ie++,l(ae,A,me,{end:ut});else if(z(ae)||Q(ae)){let ne=ae.readable||ae;ie++,l(ne,A,me,{end:ut})}else throw new _("AsyncIterable or Promise","destination",ae);ae=A;let{destroy:C,cleanup:H}=s(ae,!1,!0);G.push(C),$&&U.push(H)}}else if(W(nt)){if(Z(ae)){ie+=2;let A=B(ae,nt,me,{end:ut});D(nt)&&$&&U.push(A)}else if(Q(ae)||z(ae)){let A=ae.readable||ae;ie++,l(A,nt,me,{end:ut})}else if(L(ae))ie++,l(ae,nt,me,{end:ut});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ae);ae=nt}else if(K(nt)){if(Z(ae))ie++,t(c(ae),nt,me,{end:ut});else if(z(ae)||L(ae))ie++,t(ae,nt,me,{end:ut});else if(Q(ae))ie++,t(ae.readable,nt,me,{end:ut});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ae);ae=nt}else ae=M.from(nt)}return(te!=null&&te.aborted||O!=null&&O.aborted)&&a.nextTick(oe),ae}function B(k,q,F,{end:ee}){let te=!1;if(q.on("close",()=>{te||F(new R)}),k.pipe(q,{end:!1}),ee){let O=function(){te=!0,q.end()};X(k)?a.nextTick(O):k.once("end",O)}else F();return v(k,{readable:!0,writable:!1},O=>{let U=k._readableState;O&&O.code==="ERR_STREAM_PREMATURE_CLOSE"&&U&&U.ended&&!U.errored&&!U.errorEmitted?k.once("end",F).once("error",F):F(O)}),v(q,{readable:!1,writable:!0},F)}return QS={pipelineImpl:S,pipeline:u},QS}var eE={},VV=!1;function dJ(){if(VV)return eE;VV=!0;let{pipeline:a}=pE(),o=a0(),{destroyer:f}=Wd(),{isNodeStream:d,isReadable:n,isWritable:v,isWebStream:b,isTransformStream:y,isWritableStream:M,isReadableStream:w}=s0(),{AbortError:g,codes:{ERR_INVALID_ARG_VALUE:_,ERR_MISSING_ARGS:x}}=xa(),E=Sh();return eE=function(...T){if(T.length===0)throw new x("streams");if(T.length===1)return o.from(T[0]);let N=[...T];if(typeof T[0]=="function"&&(T[0]=o.from(T[0])),typeof T[T.length-1]=="function"){let e=T.length-1;T[e]=o.from(T[e])}for(let e=0;e<T.length;++e)if(!(!d(T[e])&&!b(T[e]))){if(e<T.length-1&&!(n(T[e])||w(T[e])||y(T[e])))throw new _(`streams[${e}]`,N[e],"must be readable");if(e>0&&!(v(T[e])||M(T[e])||y(T[e])))throw new _(`streams[${e}]`,N[e],"must be writable")}let P,L,D,Z,W;function Q(e){let r=Z;Z=null,r?r(e):e?W.destroy(e):!p&&!X&&W.destroy()}let K=T[0],z=a(T,Q),X=!!(v(K)||M(K)||y(K)),p=!!(n(z)||w(z)||y(z));if(W=new o({writableObjectMode:!!(K!=null&&K.writableObjectMode),readableObjectMode:!!(z!=null&&z.readableObjectMode),writable:X,readable:p}),X){if(d(K))W._write=function(r,i,s){K.write(r,i)?s():P=s},W._final=function(r){K.end(),L=r},K.on("drain",function(){if(P){let r=P;P=null,r()}});else if(b(K)){let i=(y(K)?K.writable:K).getWriter();W._write=async function(s,h,c){try{await i.ready,i.write(s).catch(()=>{}),c()}catch(m){c(m)}},W._final=async function(s){try{await i.ready,i.close().catch(()=>{}),L=s}catch(h){s(h)}}}let e=y(z)?z.readable:z;E(e,()=>{if(L){let r=L;L=null,r()}})}if(p){if(d(z))z.on("readable",function(){if(D){let e=D;D=null,e()}}),z.on("end",function(){W.push(null)}),W._read=function(){for(;;){let e=z.read();if(e===null){D=W._read;return}if(!W.push(e))return}};else if(b(z)){let r=(y(z)?z.readable:z).getReader();W._read=async function(){for(;;)try{let{value:i,done:s}=await r.read();if(!W.push(i))return;if(s){W.push(null);return}}catch{return}}}}return W._destroy=function(e,r){!e&&Z!==null&&(e=new g),D=null,P=null,L=null,Z===null?r(e):(Z=r,d(z)&&f(z,e))},W},eE}var Qb={},JV=!1;function u2e(){if(JV)return Qb;JV=!0;let a=globalThis.AbortController||bp().AbortController,{codes:{ERR_INVALID_ARG_VALUE:o,ERR_INVALID_ARG_TYPE:f,ERR_MISSING_ARGS:d,ERR_OUT_OF_RANGE:n},AbortError:v}=xa(),{validateAbortSignal:b,validateInteger:y,validateObject:M}=gp(),w=Gi().Symbol("kWeak"),g=Gi().Symbol("kResistStopPropagation"),{finished:_}=Sh(),x=dJ(),{addAbortSignalNoValidate:E}=r3(),{isWritable:R,isNodeStream:T}=s0(),{deprecate:N}=fa(),{ArrayPrototypePush:P,Boolean:L,MathFloor:D,Number:Z,NumberIsNaN:W,Promise:Q,PromiseReject:K,PromiseResolve:z,PromisePrototypeThen:X,Symbol:p}=Gi(),e=p("kEmpty"),r=p("kEof");function i(O,U){if(U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal"),T(O)&&!R(O))throw new o("stream",O,"must be writable");let oe=x(this,O);return U!=null&&U.signal&&E(U.signal,oe),oe}function s(O,U){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal");let oe=1;U?.concurrency!=null&&(oe=D(U.concurrency));let Y=oe-1;return U?.highWaterMark!=null&&(Y=D(U.highWaterMark)),y(oe,"options.concurrency",1),y(Y,"options.highWaterMark",0),Y+=oe,async function*(){let V=fa().AbortSignalAny([U?.signal].filter(L)),G=this,ie=[],me={signal:V},re,ae,ye=!1,fe=0;function he(){ye=!0,nt()}function nt(){fe-=1,ce()}function ce(){ae&&!ye&&fe<oe&&ie.length<Y&&(ae(),ae=null)}async function be(){try{for await(let ut of G){if(ye)return;if(V.aborted)throw new v;try{if(ut=O(ut,me),ut===e)continue;ut=z(ut)}catch($){ut=K($)}fe+=1,X(ut,nt,he),ie.push(ut),re&&(re(),re=null),!ye&&(ie.length>=Y||fe>=oe)&&await new Q($=>{ae=$})}ie.push(r)}catch(ut){let $=K(ut);X($,nt,he),ie.push($)}finally{ye=!0,re&&(re(),re=null)}}be();try{for(;;){for(;ie.length>0;){let ut=await ie[0];if(ut===r)return;if(V.aborted)throw new v;ut!==e&&(yield ut),ie.shift(),ce()}await new Q(ut=>{re=ut})}}finally{ye=!0,ae&&(ae(),ae=null)}}.call(this)}function h(O=void 0){return O!=null&&M(O,"options"),O?.signal!=null&&b(O.signal,"options.signal"),async function*(){let oe=0;for await(let j of this){var Y;if(O!=null&&(Y=O.signal)!==null&&Y!==void 0&&Y.aborted)throw new v({cause:O.signal.reason});yield[oe++,j]}}.call(this)}async function c(O,U=void 0){for await(let oe of u.call(this,O,U))return!0;return!1}async function m(O,U=void 0){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);return!await c.call(this,async(...oe)=>!await O(...oe),U)}async function l(O,U){for await(let oe of u.call(this,O,U))return oe}async function t(O,U){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);async function oe(Y,j){return await O(Y,j),e}for await(let Y of s.call(this,oe,U));}function u(O,U){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);async function oe(Y,j){return await O(Y,j)?Y:e}return s.call(this,oe,U)}class S extends d{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function B(O,U,oe){var Y;if(typeof O!="function")throw new f("reducer",["Function","AsyncFunction"],O);oe!=null&&M(oe,"options"),oe?.signal!=null&&b(oe.signal,"options.signal");let j=arguments.length>1;if(oe!=null&&(Y=oe.signal)!==null&&Y!==void 0&&Y.aborted){let re=new v(void 0,{cause:oe.signal.reason});throw this.once("error",()=>{}),await _(this.destroy(re)),re}let V=new a,G=V.signal;if(oe!=null&&oe.signal){let re={once:!0,[w]:this,[g]:!0};oe.signal.addEventListener("abort",()=>V.abort(),re)}let ie=!1;try{for await(let re of this){var me;if(ie=!0,oe!=null&&(me=oe.signal)!==null&&me!==void 0&&me.aborted)throw new v;j?U=await O(U,re,{signal:G}):(U=re,j=!0)}if(!ie&&!j)throw new S}finally{V.abort()}return U}async function k(O){O!=null&&M(O,"options"),O?.signal!=null&&b(O.signal,"options.signal");let U=[];for await(let Y of this){var oe;if(O!=null&&(oe=O.signal)!==null&&oe!==void 0&&oe.aborted)throw new v(void 0,{cause:O.signal.reason});P(U,Y)}return U}function q(O,U){let oe=s.call(this,O,U);return async function*(){for await(let j of oe)yield*j}.call(this)}function F(O){if(O=Z(O),W(O))return 0;if(O<0)throw new n("number",">= 0",O);return O}function ee(O,U=void 0){return U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal"),O=F(O),async function*(){var Y;if(U!=null&&(Y=U.signal)!==null&&Y!==void 0&&Y.aborted)throw new v;for await(let V of this){var j;if(U!=null&&(j=U.signal)!==null&&j!==void 0&&j.aborted)throw new v;O--<=0&&(yield V)}}.call(this)}function te(O,U=void 0){return U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal"),O=F(O),async function*(){var Y;if(U!=null&&(Y=U.signal)!==null&&Y!==void 0&&Y.aborted)throw new v;for await(let V of this){var j;if(U!=null&&(j=U.signal)!==null&&j!==void 0&&j.aborted)throw new v;if(O-- >0&&(yield V),O<=0)return}}.call(this)}return Qb.streamReturningOperators={asIndexedPairs:N(h,"readable.asIndexedPairs will be removed in a future version."),drop:ee,filter:u,flatMap:q,map:s,take:te,compose:i},Qb.promiseReturningOperators={every:m,forEach:t,reduce:B,toArray:k,some:c,find:l},Qb}var tE={},YV=!1;function cJ(){if(YV)return tE;YV=!0;let{ArrayPrototypePop:a,Promise:o}=Gi(),{isIterable:f,isNodeStream:d,isWebStream:n}=s0(),{pipelineImpl:v}=pE(),{finished:b}=Sh();pJ();function y(...M){return new o((w,g)=>{let _,x,E=M[M.length-1];if(E&&typeof E=="object"&&!d(E)&&!f(E)&&!n(E)){let R=a(M);_=R.signal,x=R.end}v(M,(R,T)=>{R?g(R):w(T)},{signal:_,end:x})})}return tE={finished:b,pipeline:y},tE}var rE={},XV=!1,QV=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis;function pJ(){if(XV)return rE;XV=!0;let{Buffer:a}=Mh(),{ObjectDefineProperty:o,ObjectKeys:f,ReflectApply:d}=Gi(),{promisify:{custom:n}}=fa(),{streamReturningOperators:v,promiseReturningOperators:b}=u2e(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:y}}=xa(),M=dJ(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:g}=i3(),{pipeline:_}=pE(),{destroyer:x}=Wd(),E=Sh(),R=cJ(),T=s0(),N=rE=dE().Stream;N.isDestroyed=T.isDestroyed,N.isDisturbed=T.isDisturbed,N.isErrored=T.isErrored,N.isReadable=T.isReadable,N.isWritable=T.isWritable,N.Readable=n3();for(let L of f(v)){let D=function(...W){if(new.target)throw y();return N.Readable.from(d(Z,this||QV,W))},Z=v[L];o(D,"name",{__proto__:null,value:Z.name}),o(D,"length",{__proto__:null,value:Z.length}),o(N.Readable.prototype,L,{__proto__:null,value:D,enumerable:!1,configurable:!0,writable:!0})}for(let L of f(b)){let D=function(...W){if(new.target)throw y();return d(Z,this||QV,W)},Z=b[L];o(D,"name",{__proto__:null,value:Z.name}),o(D,"length",{__proto__:null,value:Z.length}),o(N.Readable.prototype,L,{__proto__:null,value:D,enumerable:!1,configurable:!0,writable:!0})}N.Writable=cE(),N.Duplex=a0(),N.Transform=uJ(),N.PassThrough=lJ(),N.pipeline=_;let{addAbortSignal:P}=r3();return N.addAbortSignal=P,N.finished=E,N.destroy=x,N.compose=M,N.setDefaultHighWaterMark=w,N.getDefaultHighWaterMark=g,o(N,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return R}}),o(_,n,{__proto__:null,enumerable:!0,get(){return R.pipeline}}),o(E,n,{__proto__:null,enumerable:!0,get(){return R.finished}}),N.Stream=N,N._isUint8Array=function(D){return D instanceof Uint8Array},N._uint8ArrayToBuffer=function(D){return a.from(D.buffer,D.byteOffset,D.byteLength)},rE}var Zi={},eJ=!1;function l2e(){if(eJ)return Zi;eJ=!0;let a=pJ(),o=cJ(),f=a.Readable.destroy;return Zi=a.Readable,Zi._uint8ArrayToBuffer=a._uint8ArrayToBuffer,Zi._isUint8Array=a._isUint8Array,Zi.isDisturbed=a.isDisturbed,Zi.isErrored=a.isErrored,Zi.isReadable=a.isReadable,Zi.Readable=a.Readable,Zi.Writable=a.Writable,Zi.Duplex=a.Duplex,Zi.Transform=a.Transform,Zi.PassThrough=a.PassThrough,Zi.addAbortSignal=a.addAbortSignal,Zi.finished=a.finished,Zi.destroy=a.destroy,Zi.destroy=f,Zi.pipeline=a.pipeline,Zi.compose=a.compose,Object.defineProperty(a,"promises",{configurable:!0,enumerable:!0,get(){return o}}),Zi.Stream=a.Stream,Zi.default=Zi,Zi}var Si=l2e();Si._uint8ArrayToBuffer;Si._isUint8Array;Si.isDisturbed;Si.isErrored;Si.isReadable;Si.Readable;Si.Writable;Si.Duplex;Si.Transform;Si.PassThrough;Si.addAbortSignal;Si.finished;Si.destroy;Si.pipeline;Si.compose;Si.Stream;var tJ=Si.Readable;tJ.wrap=function(a,o){return o=Object.assign({objectMode:a.readableObjectMode!=null||a.objectMode!=null||!0},o),o.destroy=function(f,d){a.destroy(f),d(f)},new tJ(o).wrap(a)};var ike=Si.Writable,nke=Si.Duplex,vJ=Si.Transform,bJ=Si.PassThrough,ake=Si.finished,oke=Si.pipeline,ske=Si.Stream,fke={finished:RV(Si.finished),pipeline:RV(Si.pipeline)};var dl=Ae(Za(),1);async function mJ(a){let o=gJ(a),f=(await o.next()).value;f=await ha(o,f,32);let d=Wi(f.subarray(0,32));f=f.subarray(32);let n=64*d;f=await ha(o,f,n);let v=new Array(d);for(let M=0;M<n;M+=64)v[M/64]=[Wi(f.subarray(M,M+32)),(0,dl.default)(at.from(f.subarray(M+32,M+64)))];f=f.subarray(n);let b=32+n,y=[];for(let[M,w]of v){f=await ha(o,f,jb),f=await ha(o,f,2);let g=Wi(f.subarray(0,2));f=f.subarray(2);let{sigLength:_,pubLength:x,sigName:E}=Ir[g];f=await ha(o,f,_);let R=f.subarray(0,_);f=f.subarray(_),f=await ha(o,f,x);let T=f.subarray(0,x);f=f.subarray(x),f=await ha(o,f,1);let N=f[0]===1;N&&(f=await ha(o,f,33));let P=N?f.subarray(1,33):at.allocUnsafe(0);f=f.subarray(N?33:1),f=await ha(o,f,1);let L=f[0]===1;L&&(f=await ha(o,f,33));let D=L?f.subarray(1,33):at.allocUnsafe(0);f=f.subarray(L?33:1),f=await ha(o,f,8);let Z=Wi(f.subarray(0,8));f=f.subarray(8),f=await ha(o,f,8);let W=Wi(f.subarray(0,8));f=f.subarray(8),f=await ha(o,f,W);let Q=f.subarray(0,W),K=Z!==0&&W!==0?Hd(at.from(Q)):[];if(K.length!==Z)throw new Error("Tags lengths don't match");f=f.subarray(W);let z=new vJ;z._transform=function(i,s,h){this.push(i),h()};let X=J0([(0,fi.stringToBuffer)("dataitem"),(0,fi.stringToBuffer)("1"),(0,fi.stringToBuffer)(g.toString()),T,P,D,Q,z]),p=2+_+x+(N?33:1)+(L?33:1)+16+W,e=M-p;if(f.byteLength>e)z.write(f.subarray(0,e)),f=f.subarray(e);else{let i=f.byteLength;for(z.write(f);e>i;){if(f=(await o.next()).value,!f)throw new Error(`Not enough data bytes expected: ${e} received: ${i}`);i+=f.byteLength,i>e?z.write(f.subarray(0,f.byteLength-(i-e))):z.write(f)}f=f.subarray(f.byteLength-(i-e))}if(z.end(),w!==(0,dl.default)(V0("sha256").update(R).digest()))throw new Error("ID doesn't match signature");if(!await np[g].verify(T,await X,R))throw new Error("Invalid signature");y.push({id:w,sigName:E,signature:(0,dl.default)(at.from(R)),target:(0,dl.default)(at.from(P)),anchor:(0,dl.default)(at.from(D)),owner:(0,dl.default)(at.from(T)),tags:K,dataOffset:b+p,dataSize:e}),b+=p+e}return y}async function d2e(a,o,f,d){let n=hp("",f,d),v=new bJ,b=[(0,fi.stringToBuffer)("dataitem"),(0,fi.stringToBuffer)("1"),(0,fi.stringToBuffer)(n.signatureType.toString()),n.rawOwner,n.rawTarget,n.rawAnchor,n.rawTags,a],y=await J0(b),M=at.from(await f.sign(y));return n.setSignature(M),v.write(n.getRaw()),o.pipe(v)}async function ha(a,o,f){if(o.byteLength>=f)return o;let{done:d,value:n}=await a.next();if(d&&!n)throw new Error("Invalid buffer");return ha(a,at.concat([at.from(o),at.from(n)]),f)}async function*gJ(a){for await(let o of a)yield o}var c2e=mJ,p2e={readBytes:ha,getReader:gJ};var v2e={...aS,stream:vE};globalThis.arbundles??=v2e;function cl(a){return async o=>{if(Wo(o))return o;if(!a.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await b2e(a,{data:o})}catch(f){throw new Error(f.message??"Error resolving transaction")}}}async function b2e(a,o){let f=null,d=null,n=null;if(typeof o.data=="string"&&(f=at.from(kE(o.data),"base64"),d=TE(o.data),n=$E(f)),o.data instanceof File&&(f=new Uint8Array(await o.data.arrayBuffer()),d=o.data.type,n=o.data.size),f&&d&&n)if(n<Number(p3.dispatchUploadSize))try{let v=await a.arweave.createTransaction({data:f},"use_wallet");return v.addTag(Kr.keys.contentType,d),o.tags&&o.tags.length>0&&o.tags.forEach(y=>v.addTag(y.name,y.value)),(await globalThis.window.arweaveWallet.dispatch(v)).id}catch(v){throw new Error(v.message??"Error dispatching transaction")}else try{let v=await m2e(o.data,{tags:[{name:"Content-Type",value:d},{name:"App-Name",value:"@permaweb/libs"}]},{apiUrl:p3.node1,token:"arweave",chunkSize:5242880,batchSize:3});return console.log(v),console.log("Uploaded dataItem ID:",v.id),v.id}catch(v){throw new Error(v.message??"Error uploading transaction")}else throw new Error("Error preparing transaction data")}async function m2e(a,o,f){let{apiUrl:d,token:n,chunkSize:v,batchSize:b=3}=f,y=new hl(window.arweaveWallet),M=await y.signer.getActivePublicKey();y.publicKey=at.from(M,"base64");let w=new Uint8Array(await a.arrayBuffer()),g=hp(w,y,{...o,anchor:o.anchor||(()=>{let p=new Uint8Array(32);return crypto.getRandomValues(p),btoa(String.fromCharCode(...p)).replace(/\+/g,"-").replace(/\//g,"_").slice(0,32)})()});await g.sign(y);let _=g.getRaw(),x=new Blob([_],{type:"application/octet-stream"}),E={"x-chunking-version":"2"},R=await fetch(`${d}/chunks/${n}/-1/-1`,{headers:E});if(!R.ok)throw new Error(`Failed to get upload ID: ${R.status} ${await R.text()}`);let T=await R.json(),N=T.id;if(v<T.min||v>T.max)throw new Error(`Configured chunkSize ${v} is out of allowed range ${T.min}-${T.max}`);let P=x.size,L=[];for(let p=0;p<P;p+=v)L.push(p);let D=new Set;(T.chunks??[]).forEach(([p])=>D.add(Number(p)));let Z=L.filter(p=>p>0&&!D.has(p)),W=D.has(0)?[]:[0],Q=Z.concat(W),K=p=>new Promise(e=>setTimeout(e,p));for(let p=0;p<Q.length;p+=b){let e=Q.slice(p,p+b);await Promise.all(e.map(async r=>{let s=await x.slice(r,r+v).arrayBuffer(),h=null;for(let c=1;c<=3;c++)try{let m=await fetch(`${d}/chunks/${n}/${N}/${r}`,{method:"POST",headers:{"Content-Type":"application/octet-stream",...E},body:s});if(!m.ok){let l=await m.text();throw m.status===402?new Error(`402 payment required: ${l}`):new Error(`Chunk upload error ${m.status}: ${l}`)}return}catch(m){if(h=m,c<3){await K(1e3*c);continue}}throw h}))}let z={"Content-Type":"application/octet-stream",...E},X=await fetch(`${d}/chunks/${n}/${N}/-1`,{method:"POST",headers:z});if(!X.ok){let p=await X.text();throw new Error(`Finalizing upload failed ${X.status}: ${p}`)}return X.json()}var Zke=Ae(Be(),1);Ie();Re();var y2e={},Kke=Ae(Be(),1);Ie();Re();var H$e=Ae(Be(),1);Ie();Re();var o$e=Ae(Be(),1);Ie();Re();function a3(a){return async(o,f)=>{let d=_2e(o);if(d)throw new Error(d);let n=IE[o.contentType]?.serialize(o.data)??o.data,v=M2e(o);try{return await Th(a,{tags:v,data:n},f?y=>f(y):void 0)}catch(b){throw new Error(b.message??"Error creating asset")}}}async function bE(a,o,f){try{let d=Ts(await Ih(a,{processId:o,path:"asset",fallbackAction:"Info"}));if(f?.useGateway){let n=await Wa({gateway:ua.goldsky,ids:[o],tags:null,owners:null,cursor:null});return{...n?.data?.[0]?o3(n.data[0]):{},...d}}return{id:o,...d}}catch(d){throw new Error(d.message||"Error fetching atomic asset")}}function yJ(a){return async(o,f)=>await bE(a,o,f)}async function wJ(a){try{let o=await Wa({gateway:ua.arweave,ids:a??null,tags:null,owners:null,cursor:null});return o&&o.data.length?o.data.map(f=>o3(f)):null}catch(o){throw new Error(o)}}function o3(a){let o={id:a.node.id,owner:a.node.owner.address};for(let f of a.node.tags){let d=f.name,v=(d.startsWith(`${Kr.keys.bootloader}-`)?d.slice(`${Kr.keys.bootloader}-`.length):d).split("-").map((y,M)=>M===0?y.toLowerCase():y.charAt(0).toUpperCase()+y.slice(1).toLowerCase()).join(""),b;try{b=JSON.parse(f.value)}catch{b=f.value.toString()}o[v]=b}return o}function M2e(a){let o=[{name:Kr.keys.onBoot,value:a.src??Ji.src.asset},{name:Kr.keys.creator,value:a.creator},{name:Kr.keys.assetType,value:a.assetType},{name:Kr.keys.contentType,value:a.contentType},{name:Kr.keys.implements,value:"ANS-110"},{name:Kr.keys.dateCreated,value:new Date().getTime().toString()},na("Name",a.name),na("Description",a.description),na("Topics",JSON.stringify(a.topics)),na("Ticker","ATOMIC"),na("Denomination",a.denomination?.toString()??"1"),na("TotalSupply",a.supply?.toString()??"1"),na("Transferable",a.transferable?.toString()??"true"),na("Creator",a.creator)];if(a.metadata)for(let f in a.metadata)o.push(na(vl(f),a.metadata[f].toString()));if(a.users)for(let f of a.users)o.push({name:"Auth-User",value:f});return a.tags&&a.tags.forEach(f=>o.push(f)),o}function _2e(a){if(typeof a!="object"||a===null)return"The provided arguments are invalid or empty.";let o=["name","description","topics","creator","data","contentType","assetType"];for(let f of o)if(!(f in a))return`Missing field '${f}'`;return typeof a.name!="string"||a.name.trim()===""?"Name is required":typeof a.description!="string"?"The description must be a valid string":!Array.isArray(a.topics)||a.topics.length===0?"Topics are required":typeof a.creator!="string"||a.creator.trim()===""?"Creator is required":a.data===void 0||a.data===null?"Data field is required":typeof a.contentType!="string"||a.contentType.trim()===""?"Content type must be a non-empty string":typeof a.assetType!="string"||a.assetType.trim()===""?"Type must be a non-empty string":"supply"in a&&(typeof a.supply!="number"||a.supply<=0)?"Supply must be a positive number":"denomination"in a&&(typeof a.denomination!="number"||a.denomination<=0)?"Denomination must be a positive number":"transferable"in a&&typeof a.transferable!="boolean"?"Transferable must be a boolean value":"metadata"in a&&typeof a.metadata!="object"?"Metadata must be an object":"tags"in a&&(!Array.isArray(a.tags)||a.tags.some(f=>typeof f!="object"))?"Tags must be an array of objects":"src"in a&&typeof a.src!="string"?"Source must be a valid string":null}var v$e=Ae(Be(),1);Ie();Re();var x2e="eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo",mE="lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk";function MJ(a){return async(o,f)=>{if(!a.signer)throw new Error("No signer provided");let d=cl(a),n=new Date().getTime().toString(),v=[{name:Kr.keys.creator,value:o.creator},{name:Kr.keys.ans110.title,value:Gd(o.title)},{name:Kr.keys.name,value:Gd(o.title)},{name:Kr.keys.ans110.description,value:Gd(o.description)}],b=null,y=null;try{b=o.banner?await d(o.thumbnail):mE,y=o.banner?await d(o.banner):x2e,o.thumbnail&&v.push({name:Kr.keys.thumbnail,value:b}),o.banner&&v.push({name:Kr.keys.banner,value:y})}catch(g){console.error(g)}let M=await fetch(bl(Ji.src.collection));if(!M.ok)throw new Error("Unable to fetch process src");let w=await M.text();w=w.replace(/'<NAME>'/g,v3(o.title)),w=w.replace(/'<DESCRIPTION>'/g,v3(o.description)),w=w.replace(/<CREATOR>/g,o.creator),w=w.replace(/<THUMBNAIL>/g,b||mE),w=w.replace(/<BANNER>/g,y||mE),w=w.replace(/<DATECREATED>/g,n),w=w.replace(/<LASTUPDATE>/g,n);try{let g=await Th(a,{tags:v},f?_=>f(_):void 0);if(Zo("Sending eval message to collection..."),f&&f("Sending eval message to collection..."),await a.ao.message({process:g,signer:a.signer,tags:[{name:"Action",value:"Eval"}],data:w}),!o.skipRegistry){Zo("Sending collection to registry..."),f&&f("Sending collection to registry...");let _=[{name:"Action",value:"Add-Collection"},{name:"CollectionId",value:g},{name:"Name",value:Gd(o.title)},{name:"Creator",value:o.creator},{name:"DateCreated",value:n}];y&&_.push({name:"Banner",value:y}),b&&_.push({name:"Thumbnail",value:b}),await a.ao.message({process:Ji.collectionRegistry,signer:a.signer,tags:_})}if(!o.skipActivity){Zo("Creating collection activity process..."),f&&f("Creating collection activity process...");let _=[{name:"CollectionId",value:g},{name:"DateCreated",value:n},{name:"UCM-Process",value:"Collection-Activity"},{name:"On-Boot",value:Ji.src.collectionActivity}],x=await Th(a,{tags:_},f?E=>f(E):void 0);Zo("Adding activity to collection process..."),f&&f("Adding activity to collection process..."),await a.ao.message({process:g,signer:a.signer,tags:[{name:"Action",value:"Eval"}],data:`ActivityProcess = '${x}'`})}return g}catch(g){throw new Error(g.message??"Error creating collection")}}}function _J(a){return async o=>await ks(a,{processId:o.creator,action:"Run-Action",tags:[{name:"ForwardTo",value:o.collectionId},{name:"ForwardAction",value:"Update-Assets"}],data:{Target:o.collectionId,Action:"Update-Assets",Input:{AssetIds:o.assetIds,UpdateType:o.updateType}}})}function xJ(a){return async o=>{let f=await Ih(a,{processId:o,path:"collection",fallbackAction:"Info"});return f?Ts(f):null}}function SJ(a){return async o=>{let f=o.creator?"Get-Collections-By-User":"Get-Collections",d=await Sp(a,{processId:Ji.collectionRegistry,action:f,tags:o.creator?[{name:"Creator",value:o.creator}]:null});return d&&d.Collections&&d.Collections.length?d.Collections.map(v=>({id:v.Id,title:v.Name.replace(/\[|\]/g,""),description:v.Description,creator:v.Creator,dateCreated:v.DateCreated,banner:v.Banner,thumbnail:v.Thumbnail})):null}}var x$e=Ae(Be(),1);Ie();Re();function EJ(a){let o=a3(a);return async(f,d)=>{let n=f.tags?f.tags:[];n.push({name:"Data-Source",value:f.parentId}),n.push({name:"Root-Source",value:f.rootId??f.parentId});let v={name:`Comment on ${f.parentId}`,description:`Comment on ${f.parentId}`,topics:["comment"],creator:f.creator,data:f.content,contentType:"text/plain",assetType:"comment",tags:n};return o(v,d)}}function AJ(a){return async o=>{try{let f=await bE(a,o,{useGateway:!0}),d=f?.dataSource,n=f?.rootSource;if(!d||!n)throw new Error("dataSource and rootSource must be present on a comment");return{content:await RJ(o),parentId:d,rootId:n}}catch(f){throw new Error(f.message??"Error getting comment")}}}function BJ(a){return async o=>{if(!o.parentId&&!o.rootId)throw new Error("Must provide either parentId or rootId");let f=[];o.parentId&&f.push({name:"Data-Source",values:[o.parentId??""]}),o.rootId&&f.push({name:"Root-Source",values:[o.rootId??""]});let d=await Wa({gateway:ua.goldsky,ids:null,tags:f,owners:null,cursor:null}),n=[];d&&d.data.length&&(n=d.data.map(b=>o3(b)));let v=[];for(let b of n){let y=b?.dataSource,M=b?.rootSource;if(!y||!M)throw new Error("dataSource and rootSource must be present on a comment");v.push({id:b.id,content:await RJ(b.id),parentId:y,rootId:M})}return v}}async function RJ(a){try{return await(await fetch(bl(a))).text()}catch(o){throw new Error(o.message??"Error getting comment data")}}var U$e=Ae(Be(),1);Ie();Re();var k$e=Ae(Be(),1);Ie();Re();function s3(a){return async(o,f)=>{try{let d=[{name:Kr.keys.onBoot,value:Ji.src.zone.id}];return o.tags&&o.tags.length&&o.tags.forEach(v=>d.push(v)),await Th(a,{data:o.data,tags:d},f?v=>f(v):void 0)}catch(d){throw new Error(d.message??"Error creating zone")}}}function f3(a){return async(o,f)=>{try{let d=Object.entries(o).map(([v,b])=>({key:v,value:b}));return await ks(a,{processId:f,action:"Zone-Update",data:d})}catch(d){throw new Error(d)}}}function IJ(a){return async(o,f)=>{try{return await ks(a,{processId:f,action:"Zone-Append",tags:[{name:"Path",value:o.path}],data:o.data})}catch(d){throw new Error(d)}}}function TJ(a){return async(o,f)=>{if(!Wo(f))throw new Error("Invalid zone address");let n=[];for(let v of o){if(!Wo(v.granteeId))throw new Error("Invalid granteeId address");if(v.type!=="wallet"&&v.type!=="process")throw new Error("Invalid role type");n.push({Id:v.granteeId,Roles:v.roles,Type:v.type,SendInvite:v.sendInvite})}try{return await ks(a,{processId:f,action:"Role-Set",tags:[],data:n})}catch(v){throw new Error(v)}}}function kJ(a){return async(o,f)=>{if(!(Wo(f)&&Wo(o.zoneToJoinId)))throw new Error("Invalid zone address");let n=[{name:"ZoneId",value:o.zoneToJoinId}];o.path&&n.push({name:"Path",value:o.path});try{return await ks(a,{processId:f,action:"Zone-Join",tags:n})}catch(v){throw new Error(v)}}}function h3(a){return async o=>{try{return Zo(`Updating zone to version ${Ji.src.zone.version} with source ${Ji.src.zone.id}`),await Vd(a,{processId:o.zoneId,evalTxId:Ji.src.zone.id}),await Vd(a,{processId:o.zoneId,evalSrc:`Zone.Version = '${Ji.src.zone.version}'; SyncState()`})}catch(f){throw new Error(f)}}}function u3(a){return async o=>{try{let f=await Ih(a,{processId:o,path:"zone",fallbackAction:"Info"});return Ts(f)}catch(f){throw new Error(f.message??"Error getting zone")}}}function $J(a){let o=s3(a),f=cl(a);return async(d,n)=>{let v=null,b=[{name:Kr.keys.dataProtocol,value:Kr.values.zone},{name:Kr.keys.zoneType,value:Kr.values.user}],y=async M=>{let w=M.toLowerCase();if(d[w])try{let g=await f(d[w]);b.push(na(M,g))}catch(g){n?n(`Failed to resolve ${M}: ${g.message}`):console.error(g)}};d.username&&b.push(na("Username",d.username)),d.displayName&&b.push(na("DisplayName",d.displayName)),d.description&&b.push(na("Description",d.description)),await Promise.all([y("Thumbnail"),y("Banner")]);try{v=await o({tags:b},n)}catch(M){throw new Error(M.message??"Error creating profile")}return v}}function PJ(a){let o=f3(a),f=cl(a);return async(d,n,v)=>{if(n){let b={Username:d.username,DisplayName:d.displayName,Description:d.description};if(d.thumbnail)try{b.Thumbnail=await f(d.thumbnail)}catch(y){v&&v(`Failed to resolve thumbnail: ${y.message}`)}if(d.banner)try{b.Banner=await f(d.banner)}catch(y){v&&v(`Failed to resolve banner: ${y.message}`)}try{return await o(b,n)}catch(y){throw new Error(y.message??"Error creating profile")}}else throw new Error("No profile provided")}}function NJ(a){let o=h3(a);return async f=>{try{return await o({zoneId:f.profileId})}catch(d){throw new Error(d)}}}function gE(a){let o=u3(a);return async f=>{try{let d=await o(f);if(!d)throw new Error("Error fetching profile - Not found");return{id:f,owner:d.owner,assets:d.assets,roles:d.roles,invites:d.invites,version:d.version,...d.store}}catch(d){throw new Error(d.message??"Error fetching profile")}}}function CJ(a){let o=gE(a);return async f=>{try{let d=await Wa({gateway:ua.goldsky,tags:[{name:Kr.keys.dataProtocol,values:[Kr.values.zone]},{name:Kr.keys.zoneType,values:[Kr.values.user]}],owners:[f]});return d?.data?.length>0?(d.data.sort((n,v)=>{let b=n.node.block?.timestamp??0;return(v.node.block?.timestamp??0)-b}),await o(d.data[0].node.id)):{id:null}}catch(d){throw new Error(d.message??"Error fetching profile")}}}var Y$e=Ji.src.zone.version;function E2e(a){return{createZone:s3(a),updateZone:f3(a),addToZone:IJ(a),getZone:u3(a),setZoneRoles:TJ(a),joinZone:kJ(a),updateZoneVersion:h3(a),createProfile:$J(a),updateProfile:PJ(a),updateProfileVersion:NJ(a),getProfileById:gE(a),getProfileByWalletAddress:CJ(a),createAtomicAsset:a3(a),getAtomicAsset:yJ(a),getAtomicAssets:wJ,createComment:EJ(a),getComment:AJ(a),getComments:BJ(a),createCollection:MJ(a),updateCollectionAssets:_J(a),getCollection:xJ(a),getCollections:SJ(a),resolveTransaction:cl(a),getGQLData:Wa,getAggregatedGQLData:PE,createProcess:OE(a),readProcess:DE(a),readState:LE(a),sendMessage:CE(a),mapFromProcessCase:Ts,mapToProcessCase:vl}}var X$e={init:E2e};export{Y$e as CurrentZoneVersion,y2e as Types,X$e as default};
|
|
79
|
+
`;super(E),this.name="AggregateError",this.errors=x}}return Yb={AggregateError:g,kEmptyObject:Object.freeze({}),once(_){let x=!1;return function(...E){x||(x=!0,_.apply(this,E))}},createDeferredPromise:function(){let _,x;return{promise:new Promise((R,T)=>{_=R,x=T}),resolve:_,reject:x}},promisify(_){return new Promise((x,E)=>{_((R,...T)=>R?E(R):x(...T))})},debuglog(){return function(){}},format(_,...x){return _.replace(/%([sdifj])/g,function(...[E,R]){let T=x.shift();return R==="f"?T.toFixed(6):R==="j"?JSON.stringify(T):R==="s"&&typeof T=="object"?`${T.constructor!==Object?T.constructor.name:""} {}`.trim():T.toString()})},inspect(_){switch(typeof _){case"string":if(_.includes("'"))if(_.includes('"')){if(!_.includes("`")&&!_.includes("${"))return`\`${_}\``}else return`"${_}"`;return`'${_}'`;case"number":return isNaN(_)?"NaN":Object.is(_,-0)?String(_):_;case"bigint":return`${String(_)}n`;case"boolean":case"undefined":return String(_);case"object":return"{}"}},types:{isAsyncFunction(_){return _ instanceof v},isArrayBufferView(_){return ArrayBuffer.isView(_)}},isBlob:y,deprecate(_,x){return _},addAbortListener:_h.addAbortListener||function(x,E){if(x===void 0)throw new ERR_INVALID_ARG_TYPE("signal","AbortSignal",x);M(x,"signal"),w(E,"listener");let R;return x.aborted?queueMicrotask(()=>E()):(x.addEventListener("abort",E,{__proto__:null,once:!0,[o]:!0}),R=()=>{x.removeEventListener("abort",E)}),{__proto__:null,[f](){var T;(T=R)===null||T===void 0||T()}}},AbortSignalAny:d.any||function(x){if(x.length===1)return x[0];let E=new n,R=()=>E.abort();return x.forEach(T=>{M(T,"signals"),T.addEventListener("abort",R,{once:!0})}),E.signal.addEventListener("abort",()=>{x.forEach(T=>T.removeEventListener("abort",R))},{once:!0}),E.signal}},Yb.promisify.custom=Symbol.for("nodejs.util.promisify.custom"),Yb}var qS={},$V=!1;function xa(){if($V)return qS;$V=!0;let{format:a,inspect:o,AggregateError:f}=fa(),d=globalThis.AggregateError||f,n=Symbol("kIsNodeError"),v=["string","function","number","object","Function","Object","boolean","bigint","symbol"],b=/^([A-Z][a-z0-9]*)+$/,y="__node_internal_",M={};function w(N,P){if(!N)throw new M.ERR_INTERNAL_ASSERTION(P)}function g(N){let P="",L=N.length,D=N[0]==="-"?1:0;for(;L>=D+4;L-=3)P=`_${N.slice(L-3,L)}${P}`;return`${N.slice(0,L)}${P}`}function _(N,P,L){if(typeof P=="function")return w(P.length<=L.length,`Code: ${N}; The provided arguments length (${L.length}) does not match the required ones (${P.length}).`),P(...L);let D=(P.match(/%[dfijoOs]/g)||[]).length;return w(D===L.length,`Code: ${N}; The provided arguments length (${L.length}) does not match the required ones (${D}).`),L.length===0?P:a(P,...L)}function x(N,P,L){L||(L=Error);class D extends L{constructor(...W){super(_(N,P,W))}toString(){return`${this.name} [${N}]: ${this.message}`}}Object.defineProperties(D.prototype,{name:{value:L.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${N}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),D.prototype.code=N,D.prototype[n]=!0,M[N]=D}function E(N){let P=y+N.name;return Object.defineProperty(N,"name",{value:P}),N}function R(N,P){if(N&&P&&N!==P){if(Array.isArray(P.errors))return P.errors.push(N),P;let L=new d([P,N],P.message);return L.code=P.code,L}return N||P}class T extends Error{constructor(P="The operation was aborted",L=void 0){if(L!==void 0&&typeof L!="object")throw new M.ERR_INVALID_ARG_TYPE("options","Object",L);super(P,L),this.code="ABORT_ERR",this.name="AbortError"}}return x("ERR_ASSERTION","%s",Error),x("ERR_INVALID_ARG_TYPE",(N,P,L)=>{w(typeof N=="string","'name' must be a string"),Array.isArray(P)||(P=[P]);let D="The ";N.endsWith(" argument")?D+=`${N} `:D+=`"${N}" ${N.includes(".")?"property":"argument"} `,D+="must be ";let Z=[],W=[],Q=[];for(let z of P)w(typeof z=="string","All expected entries have to be of type string"),v.includes(z)?Z.push(z.toLowerCase()):b.test(z)?W.push(z):(w(z!=="object",'The value "object" should be written as "Object"'),Q.push(z));if(W.length>0){let z=Z.indexOf("object");z!==-1&&(Z.splice(Z,z,1),W.push("Object"))}if(Z.length>0){switch(Z.length){case 1:D+=`of type ${Z[0]}`;break;case 2:D+=`one of type ${Z[0]} or ${Z[1]}`;break;default:{let z=Z.pop();D+=`one of type ${Z.join(", ")}, or ${z}`}}(W.length>0||Q.length>0)&&(D+=" or ")}if(W.length>0){switch(W.length){case 1:D+=`an instance of ${W[0]}`;break;case 2:D+=`an instance of ${W[0]} or ${W[1]}`;break;default:{let z=W.pop();D+=`an instance of ${W.join(", ")}, or ${z}`}}Q.length>0&&(D+=" or ")}switch(Q.length){case 0:break;case 1:Q[0].toLowerCase()!==Q[0]&&(D+="an "),D+=`${Q[0]}`;break;case 2:D+=`one of ${Q[0]} or ${Q[1]}`;break;default:{let z=Q.pop();D+=`one of ${Q.join(", ")}, or ${z}`}}if(L==null)D+=`. Received ${L}`;else if(typeof L=="function"&&L.name)D+=`. Received function ${L.name}`;else if(typeof L=="object"){var K;if((K=L.constructor)!==null&&K!==void 0&&K.name)D+=`. Received an instance of ${L.constructor.name}`;else{let z=o(L,{depth:-1});D+=`. Received ${z}`}}else{let z=o(L,{colors:!1});z.length>25&&(z=`${z.slice(0,25)}...`),D+=`. Received type ${typeof L} (${z})`}return D},TypeError),x("ERR_INVALID_ARG_VALUE",(N,P,L="is invalid")=>{let D=o(P);return D.length>128&&(D=D.slice(0,128)+"..."),`The ${N.includes(".")?"property":"argument"} '${N}' ${L}. Received ${D}`},TypeError),x("ERR_INVALID_RETURN_VALUE",(N,P,L)=>{var D;let Z=L!=null&&(D=L.constructor)!==null&&D!==void 0&&D.name?`instance of ${L.constructor.name}`:`type ${typeof L}`;return`Expected ${N} to be returned from the "${P}" function but got ${Z}.`},TypeError),x("ERR_MISSING_ARGS",(...N)=>{w(N.length>0,"At least one arg needs to be specified");let P,L=N.length;switch(N=(Array.isArray(N)?N:[N]).map(D=>`"${D}"`).join(" or "),L){case 1:P+=`The ${N[0]} argument`;break;case 2:P+=`The ${N[0]} and ${N[1]} arguments`;break;default:{let D=N.pop();P+=`The ${N.join(", ")}, and ${D} arguments`}break}return`${P} must be specified`},TypeError),x("ERR_OUT_OF_RANGE",(N,P,L)=>{w(P,'Missing "range" argument');let D;return Number.isInteger(L)&&Math.abs(L)>2**32?D=g(String(L)):typeof L=="bigint"?(D=String(L),(L>2n**32n||L<-(2n**32n))&&(D=g(D)),D+="n"):D=o(L),`The value of "${N}" is out of range. It must be ${P}. Received ${D}`},RangeError),x("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error),x("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error),x("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error),x("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error),x("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error),x("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError),x("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error),x("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error),x("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error),x("ERR_STREAM_WRITE_AFTER_END","write after end",Error),x("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError),qS={AbortError:T,aggregateTwoErrors:E(R),hideStackFrames:E,codes:M},qS}var US={},PV=!1;function gp(){if(PV)return US;PV=!0;let{ArrayIsArray:a,ArrayPrototypeIncludes:o,ArrayPrototypeJoin:f,ArrayPrototypeMap:d,NumberIsInteger:n,NumberIsNaN:v,NumberMAX_SAFE_INTEGER:b,NumberMIN_SAFE_INTEGER:y,NumberParseInt:M,ObjectPrototypeHasOwnProperty:w,RegExpPrototypeExec:g,String:_,StringPrototypeToUpperCase:x,StringPrototypeTrim:E}=Gi(),{hideStackFrames:R,codes:{ERR_SOCKET_BAD_PORT:T,ERR_INVALID_ARG_TYPE:N,ERR_INVALID_ARG_VALUE:P,ERR_OUT_OF_RANGE:L,ERR_UNKNOWN_SIGNAL:D}}=xa(),{normalizeEncoding:Z}=fa(),{isAsyncFunction:W,isArrayBufferView:Q}=fa().types,K={};function z(ye){return ye===(ye|0)}function X(ye){return ye===ye>>>0}let p=/^[0-7]+$/,e="must be a 32-bit unsigned integer or an octal string";function r(ye,fe,he){if(typeof ye>"u"&&(ye=he),typeof ye=="string"){if(g(p,ye)===null)throw new P(fe,ye,e);ye=M(ye,8)}return h(ye,fe),ye}let i=R((ye,fe,he=y,nt=b)=>{if(typeof ye!="number")throw new N(fe,"number",ye);if(!n(ye))throw new L(fe,"an integer",ye);if(ye<he||ye>nt)throw new L(fe,`>= ${he} && <= ${nt}`,ye)}),s=R((ye,fe,he=-2147483648,nt=2147483647)=>{if(typeof ye!="number")throw new N(fe,"number",ye);if(!n(ye))throw new L(fe,"an integer",ye);if(ye<he||ye>nt)throw new L(fe,`>= ${he} && <= ${nt}`,ye)}),h=R((ye,fe,he=!1)=>{if(typeof ye!="number")throw new N(fe,"number",ye);if(!n(ye))throw new L(fe,"an integer",ye);let nt=he?1:0,ce=4294967295;if(ye<nt||ye>ce)throw new L(fe,`>= ${nt} && <= ${ce}`,ye)});function c(ye,fe){if(typeof ye!="string")throw new N(fe,"string",ye)}function m(ye,fe,he=void 0,nt){if(typeof ye!="number")throw new N(fe,"number",ye);if(he!=null&&ye<he||nt!=null&&ye>nt||(he!=null||nt!=null)&&v(ye))throw new L(fe,`${he!=null?`>= ${he}`:""}${he!=null&&nt!=null?" && ":""}${nt!=null?`<= ${nt}`:""}`,ye)}let l=R((ye,fe,he)=>{if(!o(he,ye)){let ce="must be one of: "+f(d(he,be=>typeof be=="string"?`'${be}'`:_(be)),", ");throw new P(fe,ye,ce)}});function t(ye,fe){if(typeof ye!="boolean")throw new N(fe,"boolean",ye)}function u(ye,fe,he){return ye==null||!w(ye,fe)?he:ye[fe]}let S=R((ye,fe,he=null)=>{let nt=u(he,"allowArray",!1),ce=u(he,"allowFunction",!1);if(!u(he,"nullable",!1)&&ye===null||!nt&&a(ye)||typeof ye!="object"&&(!ce||typeof ye!="function"))throw new N(fe,"Object",ye)}),B=R((ye,fe)=>{if(ye!=null&&typeof ye!="object"&&typeof ye!="function")throw new N(fe,"a dictionary",ye)}),k=R((ye,fe,he=0)=>{if(!a(ye))throw new N(fe,"Array",ye);if(ye.length<he){let nt=`must be longer than ${he}`;throw new P(fe,ye,nt)}});function q(ye,fe){k(ye,fe);for(let he=0;he<ye.length;he++)c(ye[he],`${fe}[${he}]`)}function F(ye,fe){k(ye,fe);for(let he=0;he<ye.length;he++)t(ye[he],`${fe}[${he}]`)}function ee(ye,fe){k(ye,fe);for(let he=0;he<ye.length;he++){let nt=ye[he],ce=`${fe}[${he}]`;if(nt==null)throw new N(ce,"AbortSignal",nt);Y(nt,ce)}}function te(ye,fe="signal"){if(c(ye,fe),K[ye]===void 0)throw K[x(ye)]!==void 0?new D(ye+" (signals must use all capital letters)"):new D(ye)}let O=R((ye,fe="buffer")=>{if(!Q(ye))throw new N(fe,["Buffer","TypedArray","DataView"],ye)});function U(ye,fe){let he=Z(fe),nt=ye.length;if(he==="hex"&&nt%2!==0)throw new P("encoding",fe,`is invalid for data of length ${nt}`)}function oe(ye,fe="Port",he=!0){if(typeof ye!="number"&&typeof ye!="string"||typeof ye=="string"&&E(ye).length===0||+ye!==+ye>>>0||ye>65535||ye===0&&!he)throw new T(fe,ye,he);return ye|0}let Y=R((ye,fe)=>{if(ye!==void 0&&(ye===null||typeof ye!="object"||!("aborted"in ye)))throw new N(fe,"AbortSignal",ye)}),j=R((ye,fe)=>{if(typeof ye!="function")throw new N(fe,"Function",ye)}),V=R((ye,fe)=>{if(typeof ye!="function"||W(ye))throw new N(fe,"Function",ye)}),G=R((ye,fe)=>{if(ye!==void 0)throw new N(fe,"undefined",ye)});function ie(ye,fe,he){if(!o(he,ye))throw new N(fe,`('${f(he,"|")}')`,ye)}let me=/^(?:<[^>]*>)(?:\s*;\s*[^;"\s]+(?:=(")?[^;"\s]*\1)?)*$/;function re(ye,fe){if(typeof ye>"u"||!g(me,ye))throw new P(fe,ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}function ae(ye){if(typeof ye=="string")return re(ye,"hints"),ye;if(a(ye)){let fe=ye.length,he="";if(fe===0)return he;for(let nt=0;nt<fe;nt++){let ce=ye[nt];re(ce,"hints"),he+=ce,nt!==fe-1&&(he+=", ")}return he}throw new P("hints",ye,'must be an array or string of format "</styles.css>; rel=preload; as=style"')}return US={isInt32:z,isUint32:X,parseFileMode:r,validateArray:k,validateStringArray:q,validateBooleanArray:F,validateAbortSignalArray:ee,validateBoolean:t,validateBuffer:O,validateDictionary:B,validateEncoding:U,validateFunction:j,validateInt32:s,validateInteger:i,validateNumber:m,validateObject:S,validateOneOf:l,validatePlainFunction:V,validatePort:oe,validateSignalName:te,validateString:c,validateUint32:h,validateUndefined:G,validateUnion:ie,validateAbortSignal:Y,validateLinkHeaderValue:ae},US}var FS={},NV=!1;function s0(){if(NV)return FS;NV=!0;let{SymbolAsyncIterator:a,SymbolIterator:o,SymbolFor:f}=Gi(),d=f("nodejs.stream.destroyed"),n=f("nodejs.stream.errored"),v=f("nodejs.stream.readable"),b=f("nodejs.stream.writable"),y=f("nodejs.stream.disturbed"),M=f("nodejs.webstream.isClosedPromise"),w=f("nodejs.webstream.controllerErrorFunction");function g(u,S=!1){var B;return!!(u&&typeof u.pipe=="function"&&typeof u.on=="function"&&(!S||typeof u.pause=="function"&&typeof u.resume=="function")&&(!u._writableState||((B=u._readableState)===null||B===void 0?void 0:B.readable)!==!1)&&(!u._writableState||u._readableState))}function _(u){var S;return!!(u&&typeof u.write=="function"&&typeof u.on=="function"&&(!u._readableState||((S=u._writableState)===null||S===void 0?void 0:S.writable)!==!1))}function x(u){return!!(u&&typeof u.pipe=="function"&&u._readableState&&typeof u.on=="function"&&typeof u.write=="function")}function E(u){return u&&(u._readableState||u._writableState||typeof u.write=="function"&&typeof u.on=="function"||typeof u.pipe=="function"&&typeof u.on=="function")}function R(u){return!!(u&&!E(u)&&typeof u.pipeThrough=="function"&&typeof u.getReader=="function"&&typeof u.cancel=="function")}function T(u){return!!(u&&!E(u)&&typeof u.getWriter=="function"&&typeof u.abort=="function")}function N(u){return!!(u&&!E(u)&&typeof u.readable=="object"&&typeof u.writable=="object")}function P(u){return R(u)||T(u)||N(u)}function L(u,S){return u==null?!1:S===!0?typeof u[a]=="function":S===!1?typeof u[o]=="function":typeof u[a]=="function"||typeof u[o]=="function"}function D(u){if(!E(u))return null;let S=u._writableState,B=u._readableState,k=S||B;return!!(u.destroyed||u[d]||k!=null&&k.destroyed)}function Z(u){if(!_(u))return null;if(u.writableEnded===!0)return!0;let S=u._writableState;return S!=null&&S.errored?!1:typeof S?.ended!="boolean"?null:S.ended}function W(u,S){if(!_(u))return null;if(u.writableFinished===!0)return!0;let B=u._writableState;return B!=null&&B.errored?!1:typeof B?.finished!="boolean"?null:!!(B.finished||S===!1&&B.ended===!0&&B.length===0)}function Q(u){if(!g(u))return null;if(u.readableEnded===!0)return!0;let S=u._readableState;return!S||S.errored?!1:typeof S?.ended!="boolean"?null:S.ended}function K(u,S){if(!g(u))return null;let B=u._readableState;return B!=null&&B.errored?!1:typeof B?.endEmitted!="boolean"?null:!!(B.endEmitted||S===!1&&B.ended===!0&&B.length===0)}function z(u){return u&&u[v]!=null?u[v]:typeof u?.readable!="boolean"?null:D(u)?!1:g(u)&&u.readable&&!K(u)}function X(u){return u&&u[b]!=null?u[b]:typeof u?.writable!="boolean"?null:D(u)?!1:_(u)&&u.writable&&!Z(u)}function p(u,S){return E(u)?D(u)?!0:!(S?.readable!==!1&&z(u)||S?.writable!==!1&&X(u)):null}function e(u){var S,B;return E(u)?u.writableErrored?u.writableErrored:(S=(B=u._writableState)===null||B===void 0?void 0:B.errored)!==null&&S!==void 0?S:null:null}function r(u){var S,B;return E(u)?u.readableErrored?u.readableErrored:(S=(B=u._readableState)===null||B===void 0?void 0:B.errored)!==null&&S!==void 0?S:null:null}function i(u){if(!E(u))return null;if(typeof u.closed=="boolean")return u.closed;let S=u._writableState,B=u._readableState;return typeof S?.closed=="boolean"||typeof B?.closed=="boolean"?S?.closed||B?.closed:typeof u._closed=="boolean"&&s(u)?u._closed:null}function s(u){return typeof u._closed=="boolean"&&typeof u._defaultKeepAlive=="boolean"&&typeof u._removedConnection=="boolean"&&typeof u._removedContLen=="boolean"}function h(u){return typeof u._sent100=="boolean"&&s(u)}function c(u){var S;return typeof u._consuming=="boolean"&&typeof u._dumped=="boolean"&&((S=u.req)===null||S===void 0?void 0:S.upgradeOrConnect)===void 0}function m(u){if(!E(u))return null;let S=u._writableState,B=u._readableState,k=S||B;return!k&&h(u)||!!(k&&k.autoDestroy&&k.emitClose&&k.closed===!1)}function l(u){var S;return!!(u&&((S=u[y])!==null&&S!==void 0?S:u.readableDidRead||u.readableAborted))}function t(u){var S,B,k,q,F,ee,te,O,U,oe;return!!(u&&((S=(B=(k=(q=(F=(ee=u[n])!==null&&ee!==void 0?ee:u.readableErrored)!==null&&F!==void 0?F:u.writableErrored)!==null&&q!==void 0?q:(te=u._readableState)===null||te===void 0?void 0:te.errorEmitted)!==null&&k!==void 0?k:(O=u._writableState)===null||O===void 0?void 0:O.errorEmitted)!==null&&B!==void 0?B:(U=u._readableState)===null||U===void 0?void 0:U.errored)!==null&&S!==void 0?S:!((oe=u._writableState)===null||oe===void 0)&&oe.errored))}return FS={isDestroyed:D,kIsDestroyed:d,isDisturbed:l,kIsDisturbed:y,isErrored:t,kIsErrored:n,isReadable:z,kIsReadable:v,kIsClosedPromise:M,kControllerErrorFunction:w,kIsWritable:b,isClosed:i,isDuplexNodeStream:x,isFinished:p,isIterable:L,isReadableNodeStream:g,isReadableStream:R,isReadableEnded:Q,isReadableFinished:K,isReadableErrored:r,isNodeStream:E,isWebStream:P,isWritable:X,isWritableNodeStream:_,isWritableStream:T,isWritableEnded:Z,isWritableFinished:W,isWritableErrored:e,isServerRequest:c,isServerResponse:h,willEmitClose:m,isTransformStream:N},FS}var Xb={},CV=!1;function Sh(){if(CV)return Xb;CV=!0;let a=o0,{AbortError:o,codes:f}=xa(),{ERR_INVALID_ARG_TYPE:d,ERR_STREAM_PREMATURE_CLOSE:n}=f,{kEmptyObject:v,once:b}=fa(),{validateAbortSignal:y,validateFunction:M,validateObject:w,validateBoolean:g}=gp(),{Promise:_,PromisePrototypeThen:x,SymbolDispose:E}=Gi(),{isClosed:R,isReadable:T,isReadableNodeStream:N,isReadableStream:P,isReadableFinished:L,isReadableErrored:D,isWritable:Z,isWritableNodeStream:W,isWritableStream:Q,isWritableFinished:K,isWritableErrored:z,isNodeStream:X,willEmitClose:p,kIsClosedPromise:e}=s0(),r;function i(l){return l.setHeader&&typeof l.abort=="function"}let s=()=>{};function h(l,t,u){var S,B;if(arguments.length===2?(u=t,t=v):t==null?t=v:w(t,"options"),M(u,"callback"),y(t.signal,"options.signal"),u=b(u),P(l)||Q(l))return c(l,t,u);if(!X(l))throw new d("stream",["ReadableStream","WritableStream","Stream"],l);let k=(S=t.readable)!==null&&S!==void 0?S:N(l),q=(B=t.writable)!==null&&B!==void 0?B:W(l),F=l._writableState,ee=l._readableState,te=()=>{l.writable||oe()},O=p(l)&&N(l)===k&&W(l)===q,U=K(l,!1),oe=()=>{U=!0,l.destroyed&&(O=!1),!(O&&(!l.readable||k))&&(!k||Y)&&u.call(l)},Y=L(l,!1),j=()=>{Y=!0,l.destroyed&&(O=!1),!(O&&(!l.writable||q))&&(!q||U)&&u.call(l)},V=ye=>{u.call(l,ye)},G=R(l),ie=()=>{G=!0;let ye=z(l)||D(l);if(ye&&typeof ye!="boolean")return u.call(l,ye);if(k&&!Y&&N(l,!0)&&!L(l,!1))return u.call(l,new n);if(q&&!U&&!K(l,!1))return u.call(l,new n);u.call(l)},me=()=>{G=!0;let ye=z(l)||D(l);if(ye&&typeof ye!="boolean")return u.call(l,ye);u.call(l)},re=()=>{l.req.on("finish",oe)};i(l)?(l.on("complete",oe),O||l.on("abort",ie),l.req?re():l.on("request",re)):q&&!F&&(l.on("end",te),l.on("close",te)),!O&&typeof l.aborted=="boolean"&&l.on("aborted",ie),l.on("end",j),l.on("finish",oe),t.error!==!1&&l.on("error",V),l.on("close",ie),G?a.nextTick(ie):F!=null&&F.errorEmitted||ee!=null&&ee.errorEmitted?O||a.nextTick(me):(!k&&(!O||T(l))&&(U||Z(l)===!1)||!q&&(!O||Z(l))&&(Y||T(l)===!1)||ee&&l.req&&l.aborted)&&a.nextTick(me);let ae=()=>{u=s,l.removeListener("aborted",ie),l.removeListener("complete",oe),l.removeListener("abort",ie),l.removeListener("request",re),l.req&&l.req.removeListener("finish",oe),l.removeListener("end",te),l.removeListener("close",te),l.removeListener("finish",oe),l.removeListener("end",j),l.removeListener("error",V),l.removeListener("close",ie)};if(t.signal&&!G){let ye=()=>{let fe=u;ae(),fe.call(l,new o(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)a.nextTick(ye);else{r=r||fa().addAbortListener;let fe=r(t.signal,ye),he=u;u=b((...nt)=>{fe[E](),he.apply(l,nt)})}}return ae}function c(l,t,u){let S=!1,B=s;if(t.signal)if(B=()=>{S=!0,u.call(l,new o(void 0,{cause:t.signal.reason}))},t.signal.aborted)a.nextTick(B);else{r=r||fa().addAbortListener;let q=r(t.signal,B),F=u;u=b((...ee)=>{q[E](),F.apply(l,ee)})}let k=(...q)=>{S||a.nextTick(()=>u.apply(l,q))};return x(l[e].promise,k,k),s}function m(l,t){var u;let S=!1;return t===null&&(t=v),(u=t)!==null&&u!==void 0&&u.cleanup&&(g(t.cleanup,"cleanup"),S=t.cleanup),new _((B,k)=>{let q=h(l,t,F=>{S&&q(),F?k(F):B()})})}return Xb=h,Xb.finished=m,Xb}var zS={},LV=!1;function Wd(){if(LV)return zS;LV=!0;let a=o0,{aggregateTwoErrors:o,codes:{ERR_MULTIPLE_CALLBACK:f},AbortError:d}=xa(),{Symbol:n}=Gi(),{kIsDestroyed:v,isDestroyed:b,isFinished:y,isServerRequest:M}=s0(),w=n("kDestroy"),g=n("kConstruct");function _(p,e,r){p&&(p.stack,e&&!e.errored&&(e.errored=p),r&&!r.errored&&(r.errored=p))}function x(p,e){let r=this._readableState,i=this._writableState,s=i||r;return i!=null&&i.destroyed||r!=null&&r.destroyed?(typeof e=="function"&&e(),this):(_(p,i,r),i&&(i.destroyed=!0),r&&(r.destroyed=!0),s.constructed?E(this,p,e):this.once(w,function(h){E(this,o(h,p),e)}),this)}function E(p,e,r){let i=!1;function s(h){if(i)return;i=!0;let c=p._readableState,m=p._writableState;_(h,m,c),m&&(m.closed=!0),c&&(c.closed=!0),typeof r=="function"&&r(h),h?a.nextTick(R,p,h):a.nextTick(T,p)}try{p._destroy(e||null,s)}catch(h){s(h)}}function R(p,e){N(p,e),T(p)}function T(p){let e=p._readableState,r=p._writableState;r&&(r.closeEmitted=!0),e&&(e.closeEmitted=!0),(r!=null&&r.emitClose||e!=null&&e.emitClose)&&p.emit("close")}function N(p,e){let r=p._readableState,i=p._writableState;i!=null&&i.errorEmitted||r!=null&&r.errorEmitted||(i&&(i.errorEmitted=!0),r&&(r.errorEmitted=!0),p.emit("error",e))}function P(){let p=this._readableState,e=this._writableState;p&&(p.constructed=!0,p.closed=!1,p.closeEmitted=!1,p.destroyed=!1,p.errored=null,p.errorEmitted=!1,p.reading=!1,p.ended=p.readable===!1,p.endEmitted=p.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 L(p,e,r){let i=p._readableState,s=p._writableState;if(s!=null&&s.destroyed||i!=null&&i.destroyed)return this;i!=null&&i.autoDestroy||s!=null&&s.autoDestroy?p.destroy(e):e&&(e.stack,s&&!s.errored&&(s.errored=e),i&&!i.errored&&(i.errored=e),r?a.nextTick(N,p,e):N(p,e))}function D(p,e){if(typeof p._construct!="function")return;let r=p._readableState,i=p._writableState;r&&(r.constructed=!1),i&&(i.constructed=!1),p.once(g,e),!(p.listenerCount(g)>1)&&a.nextTick(Z,p)}function Z(p){let e=!1;function r(i){if(e){L(p,i??new f);return}e=!0;let s=p._readableState,h=p._writableState,c=h||s;s&&(s.constructed=!0),h&&(h.constructed=!0),c.destroyed?p.emit(w,i):i?L(p,i,!0):a.nextTick(W,p)}try{p._construct(i=>{a.nextTick(r,i)})}catch(i){a.nextTick(r,i)}}function W(p){p.emit(g)}function Q(p){return p?.setHeader&&typeof p.abort=="function"}function K(p){p.emit("close")}function z(p,e){p.emit("error",e),a.nextTick(K,p)}function X(p,e){!p||b(p)||(!e&&!y(p)&&(e=new d),M(p)?(p.socket=null,p.destroy(e)):Q(p)?p.abort():Q(p.req)?p.req.abort():typeof p.destroy=="function"?p.destroy(e):typeof p.close=="function"?p.close():e?a.nextTick(z,p,e):a.nextTick(K,p),p.destroyed||(p[v]=!0))}return zS={construct:D,destroyer:X,destroy:x,undestroy:P,errorOrDestroy:L},zS}var HS={},DV=!1;function dE(){if(DV)return HS;DV=!0;let{ArrayIsArray:a,ObjectSetPrototypeOf:o}=Gi(),{EventEmitter:f}=_h;function d(v){f.call(this,v)}o(d.prototype,f.prototype),o(d,f),d.prototype.pipe=function(v,b){let y=this;function M(T){v.writable&&v.write(T)===!1&&y.pause&&y.pause()}y.on("data",M);function w(){y.readable&&y.resume&&y.resume()}v.on("drain",w),!v._isStdio&&(!b||b.end!==!1)&&(y.on("end",_),y.on("close",x));let g=!1;function _(){g||(g=!0,v.end())}function x(){g||(g=!0,typeof v.destroy=="function"&&v.destroy())}function E(T){R(),f.listenerCount(this,"error")===0&&this.emit("error",T)}n(y,"error",E),n(v,"error",E);function R(){y.removeListener("data",M),v.removeListener("drain",w),y.removeListener("end",_),y.removeListener("close",x),y.removeListener("error",E),v.removeListener("error",E),y.removeListener("end",R),y.removeListener("close",R),v.removeListener("close",R)}return y.on("end",R),y.on("close",R),v.on("close",R),v.emit("pipe",y),v};function n(v,b,y){if(typeof v.prependListener=="function")return v.prependListener(b,y);!v._events||!v._events[b]?v.on(b,y):a(v._events[b])?v._events[b].unshift(y):v._events[b]=[y,v._events[b]]}return HS={Stream:d,prependListener:n},HS}var vp={},OV=!1;function r3(){if(OV)return vp;OV=!0;let{SymbolDispose:a}=Gi(),{AbortError:o,codes:f}=xa(),{isNodeStream:d,isWebStream:n,kControllerErrorFunction:v}=s0(),b=Sh(),{ERR_INVALID_ARG_TYPE:y}=f,M,w=(g,_)=>{if(typeof g!="object"||!("aborted"in g))throw new y(_,"AbortSignal",g)};return vp.addAbortSignal=function(_,x){if(w(_,"signal"),!d(x)&&!n(x))throw new y("stream",["ReadableStream","WritableStream","Stream"],x);return vp.addAbortSignalNoValidate(_,x)},vp.addAbortSignalNoValidate=function(g,_){if(typeof g!="object"||!("aborted"in g))return _;let x=d(_)?()=>{_.destroy(new o(void 0,{cause:g.reason}))}:()=>{_[v](new o(void 0,{cause:g.reason}))};if(g.aborted)x();else{M=M||fa().addAbortListener;let E=M(g,x);b(_,E[a])}return _},vp}var KS={},qV=!1;function f2e(){if(qV)return KS;qV=!0;let{StringPrototypeSlice:a,SymbolIterator:o,TypedArrayPrototypeSet:f,Uint8Array:d}=Gi(),{Buffer:n}=Mh(),{inspect:v}=fa();return KS=class{constructor(){this.head=null,this.tail=null,this.length=0}push(y){let M={data:y,next:null};this.length>0?this.tail.next=M:this.head=M,this.tail=M,++this.length}unshift(y){let M={data:y,next:this.head};this.length===0&&(this.tail=M),this.head=M,++this.length}shift(){if(this.length===0)return;let y=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,y}clear(){this.head=this.tail=null,this.length=0}join(y){if(this.length===0)return"";let M=this.head,w=""+M.data;for(;(M=M.next)!==null;)w+=y+M.data;return w}concat(y){if(this.length===0)return n.alloc(0);let M=n.allocUnsafe(y>>>0),w=this.head,g=0;for(;w;)f(M,w.data,g),g+=w.data.length,w=w.next;return M}consume(y,M){let w=this.head.data;if(y<w.length){let g=w.slice(0,y);return this.head.data=w.slice(y),g}return y===w.length?this.shift():M?this._getString(y):this._getBuffer(y)}first(){return this.head.data}*[o](){for(let y=this.head;y;y=y.next)yield y.data}_getString(y){let M="",w=this.head,g=0;do{let _=w.data;if(y>_.length)M+=_,y-=_.length;else{y===_.length?(M+=_,++g,w.next?this.head=w.next:this.head=this.tail=null):(M+=a(_,0,y),this.head=w,w.data=a(_,y));break}++g}while((w=w.next)!==null);return this.length-=g,M}_getBuffer(y){let M=n.allocUnsafe(y),w=y,g=this.head,_=0;do{let x=g.data;if(y>x.length)f(M,x,w-y),y-=x.length;else{y===x.length?(f(M,x,w-y),++_,g.next?this.head=g.next:this.head=this.tail=null):(f(M,new d(x.buffer,x.byteOffset,y),w-y),this.head=g,g.data=x.slice(y));break}++_}while((g=g.next)!==null);return this.length-=_,M}[Symbol.for("nodejs.util.inspect.custom")](y,M){return v(this,{...M,depth:0,customInspect:!1})}},KS}var jS={},UV=!1;function i3(){if(UV)return jS;UV=!0;let{MathFloor:a,NumberIsInteger:o}=Gi(),{validateInteger:f}=gp(),{ERR_INVALID_ARG_VALUE:d}=xa().codes,n=16*1024,v=16;function b(g,_,x){return g.highWaterMark!=null?g.highWaterMark:_?g[x]:null}function y(g){return g?v:n}function M(g,_){f(_,"value",0),g?v=_:n=_}function w(g,_,x,E){let R=b(_,E,x);if(R!=null){if(!o(R)||R<0){let T=E?`options.${x}`:"options.highWaterMark";throw new d(T,R)}return a(R)}return y(g.objectMode)}return jS={getHighWaterMark:w,getDefaultHighWaterMark:y,setDefaultHighWaterMark:M},jS}var WS={},FV=!1;function hJ(){if(FV)return WS;FV=!0;let a=o0,{PromisePrototypeThen:o,SymbolAsyncIterator:f,SymbolIterator:d}=Gi(),{Buffer:n}=Mh(),{ERR_INVALID_ARG_TYPE:v,ERR_STREAM_NULL_VALUES:b}=xa().codes;function y(M,w,g){let _;if(typeof w=="string"||w instanceof n)return new M({objectMode:!0,...g,read(){this.push(w),this.push(null)}});let x;if(w&&w[f])x=!0,_=w[f]();else if(w&&w[d])x=!1,_=w[d]();else throw new v("iterable",["Iterable"],w);let E=new M({objectMode:!0,highWaterMark:1,...g}),R=!1;E._read=function(){R||(R=!0,N())},E._destroy=function(P,L){o(T(P),()=>a.nextTick(L,P),D=>a.nextTick(L,D||P))};async function T(P){let L=P!=null,D=typeof _.throw=="function";if(L&&D){let{value:Z,done:W}=await _.throw(P);if(await Z,W)return}if(typeof _.return=="function"){let{value:Z}=await _.return();await Z}}async function N(){for(;;){try{let{value:P,done:L}=x?await _.next():_.next();if(L)E.push(null);else{let D=P&&typeof P.then=="function"?await P:P;if(D===null)throw R=!1,new b;if(E.push(D))continue;R=!1}}catch(P){E.destroy(P)}break}}return E}return WS=y,WS}var ZS={},zV=!1,_t=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis;function n3(){if(zV)return ZS;zV=!0;let a=o0,{ArrayPrototypeIndexOf:o,NumberIsInteger:f,NumberIsNaN:d,NumberParseInt:n,ObjectDefineProperties:v,ObjectKeys:b,ObjectSetPrototypeOf:y,Promise:M,SafeSet:w,SymbolAsyncDispose:g,SymbolAsyncIterator:_,Symbol:x}=Gi();ZS=nt,nt.ReadableState=he;let{EventEmitter:E}=_h,{Stream:R,prependListener:T}=dE(),{Buffer:N}=Mh(),{addAbortSignal:P}=r3(),L=Sh(),D=fa().debuglog("stream",se=>{D=se}),Z=f2e(),W=Wd(),{getHighWaterMark:Q,getDefaultHighWaterMark:K}=i3(),{aggregateTwoErrors:z,codes:{ERR_INVALID_ARG_TYPE:X,ERR_METHOD_NOT_IMPLEMENTED:p,ERR_OUT_OF_RANGE:e,ERR_STREAM_PUSH_AFTER_EOF:r,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:i},AbortError:s}=xa(),{validateObject:h}=gp(),c=x("kPaused"),{StringDecoder:m}=sE,l=hJ();y(nt.prototype,R.prototype),y(nt,R);let t=()=>{},{errorOrDestroy:u}=W,S=1,B=2,k=4,q=8,F=16,ee=32,te=64,O=128,U=256,oe=512,Y=1024,j=2048,V=4096,G=8192,ie=16384,me=32768,re=65536,ae=1<<17,ye=1<<18;function fe(se){return{enumerable:!1,get(){return((this||_t).state&se)!==0},set(ue){ue?(this||_t).state|=se:(this||_t).state&=~se}}}v(he.prototype,{objectMode:fe(S),ended:fe(B),endEmitted:fe(k),reading:fe(q),constructed:fe(F),sync:fe(ee),needReadable:fe(te),emittedReadable:fe(O),readableListening:fe(U),resumeScheduled:fe(oe),errorEmitted:fe(Y),emitClose:fe(j),autoDestroy:fe(V),destroyed:fe(G),closed:fe(ie),closeEmitted:fe(me),multiAwaitDrain:fe(re),readingMore:fe(ae),dataEmitted:fe(ye)});function he(se,ue,ht){typeof ht!="boolean"&&(ht=ue instanceof a0()),(this||_t).state=j|V|F|ee,se&&se.objectMode&&((this||_t).state|=S),ht&&se&&se.readableObjectMode&&((this||_t).state|=S),(this||_t).highWaterMark=se?Q(this||_t,se,"readableHighWaterMark",ht):K(!1),(this||_t).buffer=new Z,(this||_t).length=0,(this||_t).pipes=[],(this||_t).flowing=null,(this||_t)[c]=null,se&&se.emitClose===!1&&((this||_t).state&=~j),se&&se.autoDestroy===!1&&((this||_t).state&=~V),(this||_t).errored=null,(this||_t).defaultEncoding=se&&se.defaultEncoding||"utf8",(this||_t).awaitDrainWriters=null,(this||_t).decoder=null,(this||_t).encoding=null,se&&se.encoding&&((this||_t).decoder=new m(se.encoding),(this||_t).encoding=se.encoding)}function nt(se){if(!((this||_t)instanceof nt))return new nt(se);let ue=(this||_t)instanceof a0();(this||_t)._readableState=new he(se,this||_t,ue),se&&(typeof se.read=="function"&&((this||_t)._read=se.read),typeof se.destroy=="function"&&((this||_t)._destroy=se.destroy),typeof se.construct=="function"&&((this||_t)._construct=se.construct),se.signal&&!ue&&P(se.signal,this||_t)),R.call(this||_t,se),W.construct(this||_t,()=>{(this||_t)._readableState.needReadable&&ne(this||_t,(this||_t)._readableState)})}nt.prototype.destroy=W.destroy,nt.prototype._undestroy=W.undestroy,nt.prototype._destroy=function(se,ue){ue(se)},nt.prototype[E.captureRejectionSymbol]=function(se){this.destroy(se)},nt.prototype[g]=function(){let se;return(this||_t).destroyed||(se=(this||_t).readableEnded?null:new s,this.destroy(se)),new M((ue,ht)=>L(this||_t,pe=>pe&&pe!==se?ht(pe):ue(null)))},nt.prototype.push=function(se,ue){return ce(this||_t,se,ue,!1)},nt.prototype.unshift=function(se,ue){return ce(this||_t,se,ue,!0)};function ce(se,ue,ht,pe){D("readableAddChunk",ue);let Se=se._readableState,dt;if(Se.state&S||(typeof ue=="string"?(ht=ht||Se.defaultEncoding,Se.encoding!==ht&&(pe&&Se.encoding?ue=N.from(ue,ht).toString(Se.encoding):(ue=N.from(ue,ht),ht=""))):ue instanceof N?ht="":R._isUint8Array(ue)?(ue=R._uint8ArrayToBuffer(ue),ht=""):ue!=null&&(dt=new X("chunk",["string","Buffer","Uint8Array"],ue))),dt)u(se,dt);else if(ue===null)Se.state&=~q,I(se,Se);else if(Se.state&S||ue&&ue.length>0)if(pe)if(Se.state&k)u(se,new i);else{if(Se.destroyed||Se.errored)return!1;be(se,Se,ue,!0)}else if(Se.ended)u(se,new r);else{if(Se.destroyed||Se.errored)return!1;Se.state&=~q,Se.decoder&&!ht?(ue=Se.decoder.write(ue),Se.objectMode||ue.length!==0?be(se,Se,ue,!1):ne(se,Se)):be(se,Se,ue,!1)}else pe||(Se.state&=~q,ne(se,Se));return!Se.ended&&(Se.length<Se.highWaterMark||Se.length===0)}function be(se,ue,ht,pe){ue.flowing&&ue.length===0&&!ue.sync&&se.listenerCount("data")>0?(ue.state&re?ue.awaitDrainWriters.clear():ue.awaitDrainWriters=null,ue.dataEmitted=!0,se.emit("data",ht)):(ue.length+=ue.objectMode?1:ht.length,pe?ue.buffer.unshift(ht):ue.buffer.push(ht),ue.state&te&&C(se)),ne(se,ue)}nt.prototype.isPaused=function(){let se=(this||_t)._readableState;return se[c]===!0||se.flowing===!1},nt.prototype.setEncoding=function(se){let ue=new m(se);(this||_t)._readableState.decoder=ue,(this||_t)._readableState.encoding=(this||_t)._readableState.decoder.encoding;let ht=(this||_t)._readableState.buffer,pe="";for(let Se of ht)pe+=ue.write(Se);return ht.clear(),pe!==""&&ht.push(pe),(this||_t)._readableState.length=pe.length,this||_t};let ut=1073741824;function $(se){if(se>ut)throw new e("size","<= 1GiB",se);return se--,se|=se>>>1,se|=se>>>2,se|=se>>>4,se|=se>>>8,se|=se>>>16,se++,se}function A(se,ue){return se<=0||ue.length===0&&ue.ended?0:ue.state&S?1:d(se)?ue.flowing&&ue.length?ue.buffer.first().length:ue.length:se<=ue.length?se:ue.ended?ue.length:0}nt.prototype.read=function(se){D("read",se),se===void 0?se=NaN:f(se)||(se=n(se,10));let ue=(this||_t)._readableState,ht=se;if(se>ue.highWaterMark&&(ue.highWaterMark=$(se)),se!==0&&(ue.state&=~O),se===0&&ue.needReadable&&((ue.highWaterMark!==0?ue.length>=ue.highWaterMark:ue.length>0)||ue.ended))return D("read: emitReadable",ue.length,ue.ended),ue.length===0&&ue.ended?Ne(this||_t):C(this||_t),null;if(se=A(se,ue),se===0&&ue.ended)return ue.length===0&&Ne(this||_t),null;let pe=(ue.state&te)!==0;if(D("need readable",pe),(ue.length===0||ue.length-se<ue.highWaterMark)&&(pe=!0,D("length less than watermark",pe)),ue.ended||ue.reading||ue.destroyed||ue.errored||!ue.constructed)pe=!1,D("reading, ended or constructing",pe);else if(pe){D("do read"),ue.state|=q|ee,ue.length===0&&(ue.state|=te);try{this._read(ue.highWaterMark)}catch(dt){u(this||_t,dt)}ue.state&=~ee,ue.reading||(se=A(ht,ue))}let Se;return se>0?Se=Me(se,ue):Se=null,Se===null?(ue.needReadable=ue.length<=ue.highWaterMark,se=0):(ue.length-=se,ue.multiAwaitDrain?ue.awaitDrainWriters.clear():ue.awaitDrainWriters=null),ue.length===0&&(ue.ended||(ue.needReadable=!0),ht!==se&&ue.ended&&Ne(this||_t)),Se!==null&&!ue.errorEmitted&&!ue.closeEmitted&&(ue.dataEmitted=!0,this.emit("data",Se)),Se};function I(se,ue){if(D("onEofChunk"),!ue.ended){if(ue.decoder){let ht=ue.decoder.end();ht&&ht.length&&(ue.buffer.push(ht),ue.length+=ue.objectMode?1:ht.length)}ue.ended=!0,ue.sync?C(se):(ue.needReadable=!1,ue.emittedReadable=!0,H(se))}}function C(se){let ue=se._readableState;D("emitReadable",ue.needReadable,ue.emittedReadable),ue.needReadable=!1,ue.emittedReadable||(D("emitReadable",ue.flowing),ue.emittedReadable=!0,a.nextTick(H,se))}function H(se){let ue=se._readableState;D("emitReadable_",ue.destroyed,ue.length,ue.ended),!ue.destroyed&&!ue.errored&&(ue.length||ue.ended)&&(se.emit("readable"),ue.emittedReadable=!1),ue.needReadable=!ue.flowing&&!ue.ended&&ue.length<=ue.highWaterMark,we(se)}function ne(se,ue){!ue.readingMore&&ue.constructed&&(ue.readingMore=!0,a.nextTick(J,se,ue))}function J(se,ue){for(;!ue.reading&&!ue.ended&&(ue.length<ue.highWaterMark||ue.flowing&&ue.length===0);){let ht=ue.length;if(D("maybeReadMore read 0"),se.read(0),ht===ue.length)break}ue.readingMore=!1}nt.prototype._read=function(se){throw new p("_read()")},nt.prototype.pipe=function(se,ue){let ht=this||_t,pe=(this||_t)._readableState;pe.pipes.length===1&&(pe.multiAwaitDrain||(pe.multiAwaitDrain=!0,pe.awaitDrainWriters=new w(pe.awaitDrainWriters?[pe.awaitDrainWriters]:[]))),pe.pipes.push(se),D("pipe count=%d opts=%j",pe.pipes.length,ue);let dt=(!ue||ue.end!==!1)&&se!==a.stdout&&se!==a.stderr?De:yt;pe.endEmitted?a.nextTick(dt):ht.once("end",dt),se.on("unpipe",ge);function ge(xt,Mt){D("onunpipe"),xt===ht&&Mt&&Mt.hasUnpiped===!1&&(Mt.hasUnpiped=!0,Oe())}function De(){D("onend"),se.end()}let ct,_e=!1;function Oe(){D("cleanup"),se.removeListener("close",pt),se.removeListener("finish",lt),ct&&se.removeListener("drain",ct),se.removeListener("error",Pe),se.removeListener("unpipe",ge),ht.removeListener("end",De),ht.removeListener("end",yt),ht.removeListener("data",Ee),_e=!0,ct&&pe.awaitDrainWriters&&(!se._writableState||se._writableState.needDrain)&&ct()}function gt(){_e||(pe.pipes.length===1&&pe.pipes[0]===se?(D("false write response, pause",0),pe.awaitDrainWriters=se,pe.multiAwaitDrain=!1):pe.pipes.length>1&&pe.pipes.includes(se)&&(D("false write response, pause",pe.awaitDrainWriters.size),pe.awaitDrainWriters.add(se)),ht.pause()),ct||(ct=de(ht,se),se.on("drain",ct))}ht.on("data",Ee);function Ee(xt){D("ondata");let Mt=se.write(xt);D("dest.write",Mt),Mt===!1&>()}function Pe(xt){if(D("onerror",xt),yt(),se.removeListener("error",Pe),se.listenerCount("error")===0){let Mt=se._writableState||se._readableState;Mt&&!Mt.errorEmitted?u(se,xt):se.emit("error",xt)}}T(se,"error",Pe);function pt(){se.removeListener("finish",lt),yt()}se.once("close",pt);function lt(){D("onfinish"),se.removeListener("close",pt),yt()}se.once("finish",lt);function yt(){D("unpipe"),ht.unpipe(se)}return se.emit("pipe",ht),se.writableNeedDrain===!0?gt():pe.flowing||(D("pipe resume"),ht.resume()),se};function de(se,ue){return function(){let pe=se._readableState;pe.awaitDrainWriters===ue?(D("pipeOnDrain",1),pe.awaitDrainWriters=null):pe.multiAwaitDrain&&(D("pipeOnDrain",pe.awaitDrainWriters.size),pe.awaitDrainWriters.delete(ue)),(!pe.awaitDrainWriters||pe.awaitDrainWriters.size===0)&&se.listenerCount("data")&&se.resume()}}nt.prototype.unpipe=function(se){let ue=(this||_t)._readableState,ht={hasUnpiped:!1};if(ue.pipes.length===0)return this||_t;if(!se){let Se=ue.pipes;ue.pipes=[],this.pause();for(let dt=0;dt<Se.length;dt++)Se[dt].emit("unpipe",this||_t,{hasUnpiped:!1});return this||_t}let pe=o(ue.pipes,se);return pe===-1?this||_t:(ue.pipes.splice(pe,1),ue.pipes.length===0&&this.pause(),se.emit("unpipe",this||_t,ht),this||_t)},nt.prototype.on=function(se,ue){let ht=R.prototype.on.call(this||_t,se,ue),pe=(this||_t)._readableState;return se==="data"?(pe.readableListening=this.listenerCount("readable")>0,pe.flowing!==!1&&this.resume()):se==="readable"&&!pe.endEmitted&&!pe.readableListening&&(pe.readableListening=pe.needReadable=!0,pe.flowing=!1,pe.emittedReadable=!1,D("on readable",pe.length,pe.reading),pe.length?C(this||_t):pe.reading||a.nextTick(le,this||_t)),ht},nt.prototype.addListener=nt.prototype.on,nt.prototype.removeListener=function(se,ue){let ht=R.prototype.removeListener.call(this||_t,se,ue);return se==="readable"&&a.nextTick(st,this||_t),ht},nt.prototype.off=nt.prototype.removeListener,nt.prototype.removeAllListeners=function(se){let ue=R.prototype.removeAllListeners.apply(this||_t,arguments);return(se==="readable"||se===void 0)&&a.nextTick(st,this||_t),ue};function st(se){let ue=se._readableState;ue.readableListening=se.listenerCount("readable")>0,ue.resumeScheduled&&ue[c]===!1?ue.flowing=!0:se.listenerCount("data")>0?se.resume():ue.readableListening||(ue.flowing=null)}function le(se){D("readable nexttick read 0"),se.read(0)}nt.prototype.resume=function(){let se=(this||_t)._readableState;return se.flowing||(D("resume"),se.flowing=!se.readableListening,ve(this||_t,se)),se[c]=!1,this||_t};function ve(se,ue){ue.resumeScheduled||(ue.resumeScheduled=!0,a.nextTick(ot,se,ue))}function ot(se,ue){D("resume",ue.reading),ue.reading||se.read(0),ue.resumeScheduled=!1,se.emit("resume"),we(se),ue.flowing&&!ue.reading&&se.read(0)}nt.prototype.pause=function(){return D("call pause flowing=%j",(this||_t)._readableState.flowing),(this||_t)._readableState.flowing!==!1&&(D("pause"),(this||_t)._readableState.flowing=!1,this.emit("pause")),(this||_t)._readableState[c]=!0,this||_t};function we(se){let ue=se._readableState;for(D("flow",ue.flowing);ue.flowing&&se.read()!==null;);}nt.prototype.wrap=function(se){let ue=!1;se.on("data",pe=>{!this.push(pe)&&se.pause&&(ue=!0,se.pause())}),se.on("end",()=>{this.push(null)}),se.on("error",pe=>{u(this||_t,pe)}),se.on("close",()=>{this.destroy()}),se.on("destroy",()=>{this.destroy()}),(this||_t)._read=()=>{ue&&se.resume&&(ue=!1,se.resume())};let ht=b(se);for(let pe=1;pe<ht.length;pe++){let Se=ht[pe];(this||_t)[Se]===void 0&&typeof se[Se]=="function"&&((this||_t)[Se]=se[Se].bind(se))}return this||_t},nt.prototype[_]=function(){return Le(this||_t)},nt.prototype.iterator=function(se){return se!==void 0&&h(se,"options"),Le(this||_t,se)};function Le(se,ue){typeof se.read!="function"&&(se=nt.wrap(se,{objectMode:!0}));let ht=bt(se,ue);return ht.stream=se,ht}async function*bt(se,ue){let ht=t;function pe(ge){(this||_t)===se?(ht(),ht=t):ht=ge}se.on("readable",pe);let Se,dt=L(se,{writable:!1},ge=>{Se=ge?z(Se,ge):null,ht(),ht=t});try{for(;;){let ge=se.destroyed?null:se.read();if(ge!==null)yield ge;else{if(Se)throw Se;if(Se===null)return;await new M(pe)}}}catch(ge){throw Se=z(Se,ge),Se}finally{(Se||ue?.destroyOnReturn!==!1)&&(Se===void 0||se._readableState.autoDestroy)?W.destroyer(se,null):(se.off("readable",pe),dt())}}v(nt.prototype,{readable:{__proto__:null,get(){let se=(this||_t)._readableState;return!!se&&se.readable!==!1&&!se.destroyed&&!se.errorEmitted&&!se.endEmitted},set(se){(this||_t)._readableState&&((this||_t)._readableState.readable=!!se)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||_t)._readableState.readable!==!1&&((this||_t)._readableState.destroyed||(this||_t)._readableState.errored)&&!(this||_t)._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState&&(this||_t)._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return(this||_t)._readableState.flowing},set:function(se){(this||_t)._readableState&&((this||_t)._readableState.flowing=se)}},readableLength:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.errored:null}},closed:{__proto__:null,get(){return(this||_t)._readableState?(this||_t)._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.destroyed:!1},set(se){(this||_t)._readableState&&((this||_t)._readableState.destroyed=se)}},readableEnded:{__proto__:null,enumerable:!1,get(){return(this||_t)._readableState?(this||_t)._readableState.endEmitted:!1}}}),v(he.prototype,{pipesCount:{__proto__:null,get(){return(this||_t).pipes.length}},paused:{__proto__:null,get(){return(this||_t)[c]!==!1},set(se){(this||_t)[c]=!!se}}}),nt._fromList=Me;function Me(se,ue){if(ue.length===0)return null;let ht;return ue.objectMode?ht=ue.buffer.shift():!se||se>=ue.length?(ue.decoder?ht=ue.buffer.join(""):ue.buffer.length===1?ht=ue.buffer.first():ht=ue.buffer.concat(ue.length),ue.buffer.clear()):ht=ue.buffer.consume(se,ue.decoder),ht}function Ne(se){let ue=se._readableState;D("endReadable",ue.endEmitted),ue.endEmitted||(ue.ended=!0,a.nextTick(mt,ue,se))}function mt(se,ue){if(D("endReadableNT",se.endEmitted,se.length),!se.errored&&!se.closeEmitted&&!se.endEmitted&&se.length===0){if(se.endEmitted=!0,ue.emit("end"),ue.writable&&ue.allowHalfOpen===!1)a.nextTick(xe,ue);else if(se.autoDestroy){let ht=ue._writableState;(!ht||ht.autoDestroy&&(ht.finished||ht.writable===!1))&&ue.destroy()}}}function xe(se){se.writable&&!se.writableEnded&&!se.destroyed&&se.end()}nt.from=function(se,ue){return l(nt,se,ue)};let Ce;function vt(){return Ce===void 0&&(Ce={}),Ce}return nt.fromWeb=function(se,ue){return vt().newStreamReadableFromReadableStream(se,ue)},nt.toWeb=function(se,ue){return vt().newReadableStreamFromStreamReadable(se,ue)},nt.wrap=function(se,ue){var ht,pe;return new nt({objectMode:(ht=(pe=se.readableObjectMode)!==null&&pe!==void 0?pe:se.objectMode)!==null&&ht!==void 0?ht:!0,...ue,destroy(Se,dt){W.destroyer(se,Se),dt(Se)}}).wrap(se)},ZS}var GS={},HV=!1,Ot=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis;function cE(){if(HV)return GS;HV=!0;let a=o0,{ArrayPrototypeSlice:o,Error:f,FunctionPrototypeSymbolHasInstance:d,ObjectDefineProperty:n,ObjectDefineProperties:v,ObjectSetPrototypeOf:b,StringPrototypeToLowerCase:y,Symbol:M,SymbolHasInstance:w}=Gi();GS=h,h.WritableState=i;let{EventEmitter:g}=_h,_=dE().Stream,{Buffer:x}=Mh(),E=Wd(),{addAbortSignal:R}=r3(),{getHighWaterMark:T,getDefaultHighWaterMark:N}=i3(),{ERR_INVALID_ARG_TYPE:P,ERR_METHOD_NOT_IMPLEMENTED:L,ERR_MULTIPLE_CALLBACK:D,ERR_STREAM_CANNOT_PIPE:Z,ERR_STREAM_DESTROYED:W,ERR_STREAM_ALREADY_FINISHED:Q,ERR_STREAM_NULL_VALUES:K,ERR_STREAM_WRITE_AFTER_END:z,ERR_UNKNOWN_ENCODING:X}=xa().codes,{errorOrDestroy:p}=E;b(h.prototype,_.prototype),b(h,_);function e(){}let r=M("kOnFinished");function i(V,G,ie){typeof ie!="boolean"&&(ie=G instanceof a0()),(this||Ot).objectMode=!!(V&&V.objectMode),ie&&((this||Ot).objectMode=(this||Ot).objectMode||!!(V&&V.writableObjectMode)),(this||Ot).highWaterMark=V?T(this||Ot,V,"writableHighWaterMark",ie):N(!1),(this||Ot).finalCalled=!1,(this||Ot).needDrain=!1,(this||Ot).ending=!1,(this||Ot).ended=!1,(this||Ot).finished=!1,(this||Ot).destroyed=!1;let me=!!(V&&V.decodeStrings===!1);(this||Ot).decodeStrings=!me,(this||Ot).defaultEncoding=V&&V.defaultEncoding||"utf8",(this||Ot).length=0,(this||Ot).writing=!1,(this||Ot).corked=0,(this||Ot).sync=!0,(this||Ot).bufferProcessing=!1,(this||Ot).onwrite=u.bind(void 0,G),(this||Ot).writecb=null,(this||Ot).writelen=0,(this||Ot).afterWriteTickInfo=null,s(this||Ot),(this||Ot).pendingcb=0,(this||Ot).constructed=!0,(this||Ot).prefinished=!1,(this||Ot).errorEmitted=!1,(this||Ot).emitClose=!V||V.emitClose!==!1,(this||Ot).autoDestroy=!V||V.autoDestroy!==!1,(this||Ot).errored=null,(this||Ot).closed=!1,(this||Ot).closeEmitted=!1,(this||Ot)[r]=[]}function s(V){V.buffered=[],V.bufferedIndex=0,V.allBuffers=!0,V.allNoop=!0}i.prototype.getBuffer=function(){return o((this||Ot).buffered,(this||Ot).bufferedIndex)},n(i.prototype,"bufferedRequestCount",{__proto__:null,get(){return(this||Ot).buffered.length-(this||Ot).bufferedIndex}});function h(V){let G=(this||Ot)instanceof a0();if(!G&&!d(h,this||Ot))return new h(V);(this||Ot)._writableState=new i(V,this||Ot,G),V&&(typeof V.write=="function"&&((this||Ot)._write=V.write),typeof V.writev=="function"&&((this||Ot)._writev=V.writev),typeof V.destroy=="function"&&((this||Ot)._destroy=V.destroy),typeof V.final=="function"&&((this||Ot)._final=V.final),typeof V.construct=="function"&&((this||Ot)._construct=V.construct),V.signal&&R(V.signal,this||Ot)),_.call(this||Ot,V),E.construct(this||Ot,()=>{let ie=(this||Ot)._writableState;ie.writing||q(this||Ot,ie),O(this||Ot,ie)})}n(h,w,{__proto__:null,value:function(V){return d(this||Ot,V)?!0:(this||Ot)!==h?!1:V&&V._writableState instanceof i}}),h.prototype.pipe=function(){p(this||Ot,new Z)};function c(V,G,ie,me){let re=V._writableState;if(typeof ie=="function")me=ie,ie=re.defaultEncoding;else{if(!ie)ie=re.defaultEncoding;else if(ie!=="buffer"&&!x.isEncoding(ie))throw new X(ie);typeof me!="function"&&(me=e)}if(G===null)throw new K;if(!re.objectMode)if(typeof G=="string")re.decodeStrings!==!1&&(G=x.from(G,ie),ie="buffer");else if(G instanceof x)ie="buffer";else if(_._isUint8Array(G))G=_._uint8ArrayToBuffer(G),ie="buffer";else throw new P("chunk",["string","Buffer","Uint8Array"],G);let ae;return re.ending?ae=new z:re.destroyed&&(ae=new W("write")),ae?(a.nextTick(me,ae),p(V,ae,!0),ae):(re.pendingcb++,m(V,re,G,ie,me))}h.prototype.write=function(V,G,ie){return c(this||Ot,V,G,ie)===!0},h.prototype.cork=function(){(this||Ot)._writableState.corked++},h.prototype.uncork=function(){let V=(this||Ot)._writableState;V.corked&&(V.corked--,V.writing||q(this||Ot,V))},h.prototype.setDefaultEncoding=function(G){if(typeof G=="string"&&(G=y(G)),!x.isEncoding(G))throw new X(G);return(this||Ot)._writableState.defaultEncoding=G,this||Ot};function m(V,G,ie,me,re){let ae=G.objectMode?1:ie.length;G.length+=ae;let ye=G.length<G.highWaterMark;return ye||(G.needDrain=!0),G.writing||G.corked||G.errored||!G.constructed?(G.buffered.push({chunk:ie,encoding:me,callback:re}),G.allBuffers&&me!=="buffer"&&(G.allBuffers=!1),G.allNoop&&re!==e&&(G.allNoop=!1)):(G.writelen=ae,G.writecb=re,G.writing=!0,G.sync=!0,V._write(ie,me,G.onwrite),G.sync=!1),ye&&!G.errored&&!G.destroyed}function l(V,G,ie,me,re,ae,ye){G.writelen=me,G.writecb=ye,G.writing=!0,G.sync=!0,G.destroyed?G.onwrite(new W("write")):ie?V._writev(re,G.onwrite):V._write(re,ae,G.onwrite),G.sync=!1}function t(V,G,ie,me){--G.pendingcb,me(ie),k(G),p(V,ie)}function u(V,G){let ie=V._writableState,me=ie.sync,re=ie.writecb;if(typeof re!="function"){p(V,new D);return}ie.writing=!1,ie.writecb=null,ie.length-=ie.writelen,ie.writelen=0,G?(G.stack,ie.errored||(ie.errored=G),V._readableState&&!V._readableState.errored&&(V._readableState.errored=G),me?a.nextTick(t,V,ie,G,re):t(V,ie,G,re)):(ie.buffered.length>ie.bufferedIndex&&q(V,ie),me?ie.afterWriteTickInfo!==null&&ie.afterWriteTickInfo.cb===re?ie.afterWriteTickInfo.count++:(ie.afterWriteTickInfo={count:1,cb:re,stream:V,state:ie},a.nextTick(S,ie.afterWriteTickInfo)):B(V,ie,1,re))}function S({stream:V,state:G,count:ie,cb:me}){return G.afterWriteTickInfo=null,B(V,G,ie,me)}function B(V,G,ie,me){for(!G.ending&&!V.destroyed&&G.length===0&&G.needDrain&&(G.needDrain=!1,V.emit("drain"));ie-- >0;)G.pendingcb--,me();G.destroyed&&k(G),O(V,G)}function k(V){if(V.writing)return;for(let re=V.bufferedIndex;re<V.buffered.length;++re){var G;let{chunk:ae,callback:ye}=V.buffered[re],fe=V.objectMode?1:ae.length;V.length-=fe,ye((G=V.errored)!==null&&G!==void 0?G:new W("write"))}let ie=V[r].splice(0);for(let re=0;re<ie.length;re++){var me;ie[re]((me=V.errored)!==null&&me!==void 0?me:new W("end"))}s(V)}function q(V,G){if(G.corked||G.bufferProcessing||G.destroyed||!G.constructed)return;let{buffered:ie,bufferedIndex:me,objectMode:re}=G,ae=ie.length-me;if(!ae)return;let ye=me;if(G.bufferProcessing=!0,ae>1&&V._writev){G.pendingcb-=ae-1;let fe=G.allNoop?e:nt=>{for(let ce=ye;ce<ie.length;++ce)ie[ce].callback(nt)},he=G.allNoop&&ye===0?ie:o(ie,ye);he.allBuffers=G.allBuffers,l(V,G,!0,G.length,he,"",fe),s(G)}else{do{let{chunk:fe,encoding:he,callback:nt}=ie[ye];ie[ye++]=null;let ce=re?1:fe.length;l(V,G,!1,ce,fe,he,nt)}while(ye<ie.length&&!G.writing);ye===ie.length?s(G):ye>256?(ie.splice(0,ye),G.bufferedIndex=0):G.bufferedIndex=ye}G.bufferProcessing=!1}h.prototype._write=function(V,G,ie){if((this||Ot)._writev)this._writev([{chunk:V,encoding:G}],ie);else throw new L("_write()")},h.prototype._writev=null,h.prototype.end=function(V,G,ie){let me=(this||Ot)._writableState;typeof V=="function"?(ie=V,V=null,G=null):typeof G=="function"&&(ie=G,G=null);let re;if(V!=null){let ae=c(this||Ot,V,G);ae instanceof f&&(re=ae)}return me.corked&&(me.corked=1,this.uncork()),re||(!me.errored&&!me.ending?(me.ending=!0,O(this||Ot,me,!0),me.ended=!0):me.finished?re=new Q("end"):me.destroyed&&(re=new W("end"))),typeof ie=="function"&&(re||me.finished?a.nextTick(ie,re):me[r].push(ie)),this||Ot};function F(V){return V.ending&&!V.destroyed&&V.constructed&&V.length===0&&!V.errored&&V.buffered.length===0&&!V.finished&&!V.writing&&!V.errorEmitted&&!V.closeEmitted}function ee(V,G){let ie=!1;function me(re){if(ie){p(V,re??D());return}if(ie=!0,G.pendingcb--,re){let ae=G[r].splice(0);for(let ye=0;ye<ae.length;ye++)ae[ye](re);p(V,re,G.sync)}else F(G)&&(G.prefinished=!0,V.emit("prefinish"),G.pendingcb++,a.nextTick(U,V,G))}G.sync=!0,G.pendingcb++;try{V._final(me)}catch(re){me(re)}G.sync=!1}function te(V,G){!G.prefinished&&!G.finalCalled&&(typeof V._final=="function"&&!G.destroyed?(G.finalCalled=!0,ee(V,G)):(G.prefinished=!0,V.emit("prefinish")))}function O(V,G,ie){F(G)&&(te(V,G),G.pendingcb===0&&(ie?(G.pendingcb++,a.nextTick((me,re)=>{F(re)?U(me,re):re.pendingcb--},V,G)):F(G)&&(G.pendingcb++,U(V,G))))}function U(V,G){G.pendingcb--,G.finished=!0;let ie=G[r].splice(0);for(let me=0;me<ie.length;me++)ie[me]();if(V.emit("finish"),G.autoDestroy){let me=V._readableState;(!me||me.autoDestroy&&(me.endEmitted||me.readable===!1))&&V.destroy()}}v(h.prototype,{closed:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.closed:!1}},destroyed:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.destroyed:!1},set(V){(this||Ot)._writableState&&((this||Ot)._writableState.destroyed=V)}},writable:{__proto__:null,get(){let V=(this||Ot)._writableState;return!!V&&V.writable!==!1&&!V.destroyed&&!V.errored&&!V.ending&&!V.ended},set(V){(this||Ot)._writableState&&((this||Ot)._writableState.writable=!!V)}},writableFinished:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return(this||Ot)._writableState&&(this||Ot)._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){let V=(this||Ot)._writableState;return V?!V.destroyed&&!V.ending&&V.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return(this||Ot)._writableState&&(this||Ot)._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return(this||Ot)._writableState?(this||Ot)._writableState.corked:0}},writableLength:{__proto__:null,get(){return(this||Ot)._writableState&&(this||Ot)._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return(this||Ot)._writableState?(this||Ot)._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!((this||Ot)._writableState.writable!==!1&&((this||Ot)._writableState.destroyed||(this||Ot)._writableState.errored)&&!(this||Ot)._writableState.finished)}}});let oe=E.destroy;h.prototype.destroy=function(V,G){let ie=(this||Ot)._writableState;return!ie.destroyed&&(ie.bufferedIndex<ie.buffered.length||ie[r].length)&&a.nextTick(k,ie),oe.call(this||Ot,V,G),this||Ot},h.prototype._undestroy=E.undestroy,h.prototype._destroy=function(V,G){G(V)},h.prototype[g.captureRejectionSymbol]=function(V){this.destroy(V)};let Y;function j(){return Y===void 0&&(Y={}),Y}return h.fromWeb=function(V,G){return j().newStreamWritableFromWritableStream(V,G)},h.toWeb=function(V){return j().newWritableStreamFromStreamWritable(V)},GS}var VS={},KV=!1;function h2e(){if(KV)return VS;KV=!0;let a=o0,o=Mh(),{isReadable:f,isWritable:d,isIterable:n,isNodeStream:v,isReadableNodeStream:b,isWritableNodeStream:y,isDuplexNodeStream:M,isReadableStream:w,isWritableStream:g}=s0(),_=Sh(),{AbortError:x,codes:{ERR_INVALID_ARG_TYPE:E,ERR_INVALID_RETURN_VALUE:R}}=xa(),{destroyer:T}=Wd(),N=a0(),P=n3(),L=cE(),{createDeferredPromise:D}=fa(),Z=hJ(),W=globalThis.Blob||o.Blob,Q=typeof W<"u"?function(i){return i instanceof W}:function(i){return!1},K=globalThis.AbortController||bp().AbortController,{FunctionPrototypeCall:z}=Gi();class X extends N{constructor(i){super(i),i?.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),i?.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}VS=function r(i,s){if(M(i))return i;if(b(i))return e({readable:i});if(y(i))return e({writable:i});if(v(i))return e({writable:!1,readable:!1});if(w(i))return e({readable:P.fromWeb(i)});if(g(i))return e({writable:L.fromWeb(i)});if(typeof i=="function"){let{value:c,write:m,final:l,destroy:t}=p(i);if(n(c))return Z(X,c,{objectMode:!0,write:m,final:l,destroy:t});let u=c?.then;if(typeof u=="function"){let S,B=z(u,c,k=>{if(k!=null)throw new R("nully","body",k)},k=>{T(S,k)});return S=new X({objectMode:!0,readable:!1,write:m,final(k){l(async()=>{try{await B,a.nextTick(k,null)}catch(q){a.nextTick(k,q)}})},destroy:t})}throw new R("Iterable, AsyncIterable or AsyncFunction",s,c)}if(Q(i))return r(i.arrayBuffer());if(n(i))return Z(X,i,{objectMode:!0,writable:!1});if(w(i?.readable)&&g(i?.writable))return X.fromWeb(i);if(typeof i?.writable=="object"||typeof i?.readable=="object"){let c=i!=null&&i.readable?b(i?.readable)?i?.readable:r(i.readable):void 0,m=i!=null&&i.writable?y(i?.writable)?i?.writable:r(i.writable):void 0;return e({readable:c,writable:m})}let h=i?.then;if(typeof h=="function"){let c;return z(h,i,m=>{m!=null&&c.push(m),c.push(null)},m=>{T(c,m)}),c=new X({objectMode:!0,writable:!1,read(){}})}throw new E(s,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],i)};function p(r){let{promise:i,resolve:s}=D(),h=new K,c=h.signal;return{value:r(async function*(){for(;;){let l=i;i=null;let{chunk:t,done:u,cb:S}=await l;if(a.nextTick(S),u)return;if(c.aborted)throw new x(void 0,{cause:c.reason});({promise:i,resolve:s}=D()),yield t}}(),{signal:c}),write(l,t,u){let S=s;s=null,S({chunk:l,done:!1,cb:u})},final(l){let t=s;s=null,t({done:!0,cb:l})},destroy(l,t){h.abort(),t(l)}}}function e(r){let i=r.readable&&typeof r.readable.read!="function"?P.wrap(r.readable):r.readable,s=r.writable,h=!!f(i),c=!!d(s),m,l,t,u,S;function B(k){let q=u;u=null,q?q(k):k&&S.destroy(k)}return S=new X({readableObjectMode:!!(i!=null&&i.readableObjectMode),writableObjectMode:!!(s!=null&&s.writableObjectMode),readable:h,writable:c}),c&&(_(s,k=>{c=!1,k&&T(i,k),B(k)}),S._write=function(k,q,F){s.write(k,q)?F():m=F},S._final=function(k){s.end(),l=k},s.on("drain",function(){if(m){let k=m;m=null,k()}}),s.on("finish",function(){if(l){let k=l;l=null,k()}})),h&&(_(i,k=>{h=!1,k&&T(i,k),B(k)}),i.on("readable",function(){if(t){let k=t;t=null,k()}}),i.on("end",function(){S.push(null)}),S._read=function(){for(;;){let k=i.read();if(k===null){t=S._read;return}if(!S.push(k))return}}),S._destroy=function(k,q){!k&&u!==null&&(k=new x),t=null,m=null,l=null,u===null?q(k):(u=q,T(s,k),T(i,k))},S}return VS}var JS={},jV=!1;function a0(){if(jV)return JS;jV=!0;let{ObjectDefineProperties:a,ObjectGetOwnPropertyDescriptor:o,ObjectKeys:f,ObjectSetPrototypeOf:d}=Gi();JS=b;let n=n3(),v=cE();d(b.prototype,n.prototype),d(b,n);{let g=f(v.prototype);for(let _=0;_<g.length;_++){let x=g[_];b.prototype[x]||(b.prototype[x]=v.prototype[x])}}function b(g){if(!(this instanceof b))return new b(g);n.call(this,g),v.call(this,g),g?(this.allowHalfOpen=g.allowHalfOpen!==!1,g.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),g.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}a(b.prototype,{writable:{__proto__:null,...o(v.prototype,"writable")},writableHighWaterMark:{__proto__:null,...o(v.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...o(v.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...o(v.prototype,"writableBuffer")},writableLength:{__proto__:null,...o(v.prototype,"writableLength")},writableFinished:{__proto__:null,...o(v.prototype,"writableFinished")},writableCorked:{__proto__:null,...o(v.prototype,"writableCorked")},writableEnded:{__proto__:null,...o(v.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...o(v.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(g){this._readableState&&this._writableState&&(this._readableState.destroyed=g,this._writableState.destroyed=g)}}});let y;function M(){return y===void 0&&(y={}),y}b.fromWeb=function(g,_){return M().newStreamDuplexFromReadableWritablePair(g,_)},b.toWeb=function(g){return M().newReadableWritablePairFromDuplex(g)};let w;return b.from=function(g){return w||(w=h2e()),w(g,"body")},JS}var YS={},WV=!1;function uJ(){if(WV)return YS;WV=!0;let{ObjectSetPrototypeOf:a,Symbol:o}=Gi();YS=b;let{ERR_METHOD_NOT_IMPLEMENTED:f}=xa().codes,d=a0(),{getHighWaterMark:n}=i3();a(b.prototype,d.prototype),a(b,d);let v=o("kCallback");function b(w){if(!(this instanceof b))return new b(w);let g=w?n(this,w,"readableHighWaterMark",!0):null;g===0&&(w={...w,highWaterMark:null,readableHighWaterMark:g,writableHighWaterMark:w.writableHighWaterMark||0}),d.call(this,w),this._readableState.sync=!1,this[v]=null,w&&(typeof w.transform=="function"&&(this._transform=w.transform),typeof w.flush=="function"&&(this._flush=w.flush)),this.on("prefinish",M)}function y(w){typeof this._flush=="function"&&!this.destroyed?this._flush((g,_)=>{if(g){w?w(g):this.destroy(g);return}_!=null&&this.push(_),this.push(null),w&&w()}):(this.push(null),w&&w())}function M(){this._final!==y&&y.call(this)}return b.prototype._final=y,b.prototype._transform=function(w,g,_){throw new f("_transform()")},b.prototype._write=function(w,g,_){let x=this._readableState,E=this._writableState,R=x.length;this._transform(w,g,(T,N)=>{if(T){_(T);return}N!=null&&this.push(N),E.ended||R===x.length||x.length<x.highWaterMark?_():this[v]=_})},b.prototype._read=function(){if(this[v]){let w=this[v];this[v]=null,w()}},YS}var XS={},ZV=!1;function lJ(){if(ZV)return XS;ZV=!0;let{ObjectSetPrototypeOf:a}=Gi();XS=f;let o=uJ();a(f.prototype,o.prototype),a(f,o);function f(d){if(!(this instanceof f))return new f(d);o.call(this,d)}return f.prototype._transform=function(d,n,v){v(null,d)},XS}var QS={},GV=!1;function pE(){if(GV)return QS;GV=!0;let a=o0,{ArrayIsArray:o,Promise:f,SymbolAsyncIterator:d,SymbolDispose:n}=Gi(),v=Sh(),{once:b}=fa(),y=Wd(),M=a0(),{aggregateTwoErrors:w,codes:{ERR_INVALID_ARG_TYPE:g,ERR_INVALID_RETURN_VALUE:_,ERR_MISSING_ARGS:x,ERR_STREAM_DESTROYED:E,ERR_STREAM_PREMATURE_CLOSE:R},AbortError:T}=xa(),{validateFunction:N,validateAbortSignal:P}=gp(),{isIterable:L,isReadable:D,isReadableNodeStream:Z,isNodeStream:W,isTransformStream:Q,isWebStream:K,isReadableStream:z,isReadableFinished:X}=s0(),p=globalThis.AbortController||bp().AbortController,e,r,i;function s(k,q,F){let ee=!1;k.on("close",()=>{ee=!0});let te=v(k,{readable:q,writable:F},O=>{ee=!O});return{destroy:O=>{ee||(ee=!0,y.destroyer(k,O||new E("pipe")))},cleanup:te}}function h(k){return N(k[k.length-1],"streams[stream.length - 1]"),k.pop()}function c(k){if(L(k))return k;if(Z(k))return m(k);throw new g("val",["Readable","Iterable","AsyncIterable"],k)}async function*m(k){r||(r=n3()),yield*r.prototype[d].call(k)}async function l(k,q,F,{end:ee}){let te,O=null,U=j=>{if(j&&(te=j),O){let V=O;O=null,V()}},oe=()=>new f((j,V)=>{te?V(te):O=()=>{te?V(te):j()}});q.on("drain",U);let Y=v(q,{readable:!1},U);try{q.writableNeedDrain&&await oe();for await(let j of k)q.write(j)||await oe();ee&&(q.end(),await oe()),F()}catch(j){F(te!==j?w(te,j):j)}finally{Y(),q.off("drain",U)}}async function t(k,q,F,{end:ee}){Q(q)&&(q=q.writable);let te=q.getWriter();try{for await(let O of k)await te.ready,te.write(O).catch(()=>{});await te.ready,ee&&await te.close(),F()}catch(O){try{await te.abort(O),F(O)}catch(U){F(U)}}}function u(...k){return S(k,b(h(k)))}function S(k,q,F){if(k.length===1&&o(k[0])&&(k=k[0]),k.length<2)throw new x("streams");let ee=new p,te=ee.signal,O=F?.signal,U=[];P(O,"options.signal");function oe(){re(new T)}i=i||fa().addAbortListener;let Y;O&&(Y=i(O,oe));let j,V,G=[],ie=0;function me(he){re(he,--ie===0)}function re(he,nt){var ce;if(he&&(!j||j.code==="ERR_STREAM_PREMATURE_CLOSE")&&(j=he),!(!j&&!nt)){for(;G.length;)G.shift()(j);(ce=Y)===null||ce===void 0||ce[n](),ee.abort(),nt&&(j||U.forEach(be=>be()),a.nextTick(q,j,V))}}let ae;for(let he=0;he<k.length;he++){let nt=k[he],ce=he<k.length-1,be=he>0,ut=ce||F?.end!==!1,$=he===k.length-1;if(W(nt)){let A=function(I){I&&I.name!=="AbortError"&&I.code!=="ERR_STREAM_PREMATURE_CLOSE"&&me(I)};if(ut){let{destroy:I,cleanup:C}=s(nt,ce,be);G.push(I),D(nt)&&$&&U.push(C)}nt.on("error",A),D(nt)&&$&&U.push(()=>{nt.removeListener("error",A)})}if(he===0)if(typeof nt=="function"){if(ae=nt({signal:te}),!L(ae))throw new _("Iterable, AsyncIterable or Stream","source",ae)}else L(nt)||Z(nt)||Q(nt)?ae=nt:ae=M.from(nt);else if(typeof nt=="function"){if(Q(ae)){var ye;ae=c((ye=ae)===null||ye===void 0?void 0:ye.readable)}else ae=c(ae);if(ae=nt(ae,{signal:te}),ce){if(!L(ae,!0))throw new _("AsyncIterable",`transform[${he-1}]`,ae)}else{var fe;e||(e=lJ());let A=new e({objectMode:!0}),I=(fe=ae)===null||fe===void 0?void 0:fe.then;if(typeof I=="function")ie++,I.call(ae,ne=>{V=ne,ne!=null&&A.write(ne),ut&&A.end(),a.nextTick(me)},ne=>{A.destroy(ne),a.nextTick(me,ne)});else if(L(ae,!0))ie++,l(ae,A,me,{end:ut});else if(z(ae)||Q(ae)){let ne=ae.readable||ae;ie++,l(ne,A,me,{end:ut})}else throw new _("AsyncIterable or Promise","destination",ae);ae=A;let{destroy:C,cleanup:H}=s(ae,!1,!0);G.push(C),$&&U.push(H)}}else if(W(nt)){if(Z(ae)){ie+=2;let A=B(ae,nt,me,{end:ut});D(nt)&&$&&U.push(A)}else if(Q(ae)||z(ae)){let A=ae.readable||ae;ie++,l(A,nt,me,{end:ut})}else if(L(ae))ie++,l(ae,nt,me,{end:ut});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ae);ae=nt}else if(K(nt)){if(Z(ae))ie++,t(c(ae),nt,me,{end:ut});else if(z(ae)||L(ae))ie++,t(ae,nt,me,{end:ut});else if(Q(ae))ie++,t(ae.readable,nt,me,{end:ut});else throw new g("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],ae);ae=nt}else ae=M.from(nt)}return(te!=null&&te.aborted||O!=null&&O.aborted)&&a.nextTick(oe),ae}function B(k,q,F,{end:ee}){let te=!1;if(q.on("close",()=>{te||F(new R)}),k.pipe(q,{end:!1}),ee){let O=function(){te=!0,q.end()};X(k)?a.nextTick(O):k.once("end",O)}else F();return v(k,{readable:!0,writable:!1},O=>{let U=k._readableState;O&&O.code==="ERR_STREAM_PREMATURE_CLOSE"&&U&&U.ended&&!U.errored&&!U.errorEmitted?k.once("end",F).once("error",F):F(O)}),v(q,{readable:!1,writable:!0},F)}return QS={pipelineImpl:S,pipeline:u},QS}var eE={},VV=!1;function dJ(){if(VV)return eE;VV=!0;let{pipeline:a}=pE(),o=a0(),{destroyer:f}=Wd(),{isNodeStream:d,isReadable:n,isWritable:v,isWebStream:b,isTransformStream:y,isWritableStream:M,isReadableStream:w}=s0(),{AbortError:g,codes:{ERR_INVALID_ARG_VALUE:_,ERR_MISSING_ARGS:x}}=xa(),E=Sh();return eE=function(...T){if(T.length===0)throw new x("streams");if(T.length===1)return o.from(T[0]);let N=[...T];if(typeof T[0]=="function"&&(T[0]=o.from(T[0])),typeof T[T.length-1]=="function"){let e=T.length-1;T[e]=o.from(T[e])}for(let e=0;e<T.length;++e)if(!(!d(T[e])&&!b(T[e]))){if(e<T.length-1&&!(n(T[e])||w(T[e])||y(T[e])))throw new _(`streams[${e}]`,N[e],"must be readable");if(e>0&&!(v(T[e])||M(T[e])||y(T[e])))throw new _(`streams[${e}]`,N[e],"must be writable")}let P,L,D,Z,W;function Q(e){let r=Z;Z=null,r?r(e):e?W.destroy(e):!p&&!X&&W.destroy()}let K=T[0],z=a(T,Q),X=!!(v(K)||M(K)||y(K)),p=!!(n(z)||w(z)||y(z));if(W=new o({writableObjectMode:!!(K!=null&&K.writableObjectMode),readableObjectMode:!!(z!=null&&z.readableObjectMode),writable:X,readable:p}),X){if(d(K))W._write=function(r,i,s){K.write(r,i)?s():P=s},W._final=function(r){K.end(),L=r},K.on("drain",function(){if(P){let r=P;P=null,r()}});else if(b(K)){let i=(y(K)?K.writable:K).getWriter();W._write=async function(s,h,c){try{await i.ready,i.write(s).catch(()=>{}),c()}catch(m){c(m)}},W._final=async function(s){try{await i.ready,i.close().catch(()=>{}),L=s}catch(h){s(h)}}}let e=y(z)?z.readable:z;E(e,()=>{if(L){let r=L;L=null,r()}})}if(p){if(d(z))z.on("readable",function(){if(D){let e=D;D=null,e()}}),z.on("end",function(){W.push(null)}),W._read=function(){for(;;){let e=z.read();if(e===null){D=W._read;return}if(!W.push(e))return}};else if(b(z)){let r=(y(z)?z.readable:z).getReader();W._read=async function(){for(;;)try{let{value:i,done:s}=await r.read();if(!W.push(i))return;if(s){W.push(null);return}}catch{return}}}}return W._destroy=function(e,r){!e&&Z!==null&&(e=new g),D=null,P=null,L=null,Z===null?r(e):(Z=r,d(z)&&f(z,e))},W},eE}var Qb={},JV=!1;function u2e(){if(JV)return Qb;JV=!0;let a=globalThis.AbortController||bp().AbortController,{codes:{ERR_INVALID_ARG_VALUE:o,ERR_INVALID_ARG_TYPE:f,ERR_MISSING_ARGS:d,ERR_OUT_OF_RANGE:n},AbortError:v}=xa(),{validateAbortSignal:b,validateInteger:y,validateObject:M}=gp(),w=Gi().Symbol("kWeak"),g=Gi().Symbol("kResistStopPropagation"),{finished:_}=Sh(),x=dJ(),{addAbortSignalNoValidate:E}=r3(),{isWritable:R,isNodeStream:T}=s0(),{deprecate:N}=fa(),{ArrayPrototypePush:P,Boolean:L,MathFloor:D,Number:Z,NumberIsNaN:W,Promise:Q,PromiseReject:K,PromiseResolve:z,PromisePrototypeThen:X,Symbol:p}=Gi(),e=p("kEmpty"),r=p("kEof");function i(O,U){if(U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal"),T(O)&&!R(O))throw new o("stream",O,"must be writable");let oe=x(this,O);return U!=null&&U.signal&&E(U.signal,oe),oe}function s(O,U){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal");let oe=1;U?.concurrency!=null&&(oe=D(U.concurrency));let Y=oe-1;return U?.highWaterMark!=null&&(Y=D(U.highWaterMark)),y(oe,"options.concurrency",1),y(Y,"options.highWaterMark",0),Y+=oe,async function*(){let V=fa().AbortSignalAny([U?.signal].filter(L)),G=this,ie=[],me={signal:V},re,ae,ye=!1,fe=0;function he(){ye=!0,nt()}function nt(){fe-=1,ce()}function ce(){ae&&!ye&&fe<oe&&ie.length<Y&&(ae(),ae=null)}async function be(){try{for await(let ut of G){if(ye)return;if(V.aborted)throw new v;try{if(ut=O(ut,me),ut===e)continue;ut=z(ut)}catch($){ut=K($)}fe+=1,X(ut,nt,he),ie.push(ut),re&&(re(),re=null),!ye&&(ie.length>=Y||fe>=oe)&&await new Q($=>{ae=$})}ie.push(r)}catch(ut){let $=K(ut);X($,nt,he),ie.push($)}finally{ye=!0,re&&(re(),re=null)}}be();try{for(;;){for(;ie.length>0;){let ut=await ie[0];if(ut===r)return;if(V.aborted)throw new v;ut!==e&&(yield ut),ie.shift(),ce()}await new Q(ut=>{re=ut})}}finally{ye=!0,ae&&(ae(),ae=null)}}.call(this)}function h(O=void 0){return O!=null&&M(O,"options"),O?.signal!=null&&b(O.signal,"options.signal"),async function*(){let oe=0;for await(let j of this){var Y;if(O!=null&&(Y=O.signal)!==null&&Y!==void 0&&Y.aborted)throw new v({cause:O.signal.reason});yield[oe++,j]}}.call(this)}async function c(O,U=void 0){for await(let oe of u.call(this,O,U))return!0;return!1}async function m(O,U=void 0){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);return!await c.call(this,async(...oe)=>!await O(...oe),U)}async function l(O,U){for await(let oe of u.call(this,O,U))return oe}async function t(O,U){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);async function oe(Y,j){return await O(Y,j),e}for await(let Y of s.call(this,oe,U));}function u(O,U){if(typeof O!="function")throw new f("fn",["Function","AsyncFunction"],O);async function oe(Y,j){return await O(Y,j)?Y:e}return s.call(this,oe,U)}class S extends d{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function B(O,U,oe){var Y;if(typeof O!="function")throw new f("reducer",["Function","AsyncFunction"],O);oe!=null&&M(oe,"options"),oe?.signal!=null&&b(oe.signal,"options.signal");let j=arguments.length>1;if(oe!=null&&(Y=oe.signal)!==null&&Y!==void 0&&Y.aborted){let re=new v(void 0,{cause:oe.signal.reason});throw this.once("error",()=>{}),await _(this.destroy(re)),re}let V=new a,G=V.signal;if(oe!=null&&oe.signal){let re={once:!0,[w]:this,[g]:!0};oe.signal.addEventListener("abort",()=>V.abort(),re)}let ie=!1;try{for await(let re of this){var me;if(ie=!0,oe!=null&&(me=oe.signal)!==null&&me!==void 0&&me.aborted)throw new v;j?U=await O(U,re,{signal:G}):(U=re,j=!0)}if(!ie&&!j)throw new S}finally{V.abort()}return U}async function k(O){O!=null&&M(O,"options"),O?.signal!=null&&b(O.signal,"options.signal");let U=[];for await(let Y of this){var oe;if(O!=null&&(oe=O.signal)!==null&&oe!==void 0&&oe.aborted)throw new v(void 0,{cause:O.signal.reason});P(U,Y)}return U}function q(O,U){let oe=s.call(this,O,U);return async function*(){for await(let j of oe)yield*j}.call(this)}function F(O){if(O=Z(O),W(O))return 0;if(O<0)throw new n("number",">= 0",O);return O}function ee(O,U=void 0){return U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal"),O=F(O),async function*(){var Y;if(U!=null&&(Y=U.signal)!==null&&Y!==void 0&&Y.aborted)throw new v;for await(let V of this){var j;if(U!=null&&(j=U.signal)!==null&&j!==void 0&&j.aborted)throw new v;O--<=0&&(yield V)}}.call(this)}function te(O,U=void 0){return U!=null&&M(U,"options"),U?.signal!=null&&b(U.signal,"options.signal"),O=F(O),async function*(){var Y;if(U!=null&&(Y=U.signal)!==null&&Y!==void 0&&Y.aborted)throw new v;for await(let V of this){var j;if(U!=null&&(j=U.signal)!==null&&j!==void 0&&j.aborted)throw new v;if(O-- >0&&(yield V),O<=0)return}}.call(this)}return Qb.streamReturningOperators={asIndexedPairs:N(h,"readable.asIndexedPairs will be removed in a future version."),drop:ee,filter:u,flatMap:q,map:s,take:te,compose:i},Qb.promiseReturningOperators={every:m,forEach:t,reduce:B,toArray:k,some:c,find:l},Qb}var tE={},YV=!1;function cJ(){if(YV)return tE;YV=!0;let{ArrayPrototypePop:a,Promise:o}=Gi(),{isIterable:f,isNodeStream:d,isWebStream:n}=s0(),{pipelineImpl:v}=pE(),{finished:b}=Sh();pJ();function y(...M){return new o((w,g)=>{let _,x,E=M[M.length-1];if(E&&typeof E=="object"&&!d(E)&&!f(E)&&!n(E)){let R=a(M);_=R.signal,x=R.end}v(M,(R,T)=>{R?g(R):w(T)},{signal:_,end:x})})}return tE={finished:b,pipeline:y},tE}var rE={},XV=!1,QV=typeof globalThis<"u"?globalThis:typeof self<"u"?self:globalThis;function pJ(){if(XV)return rE;XV=!0;let{Buffer:a}=Mh(),{ObjectDefineProperty:o,ObjectKeys:f,ReflectApply:d}=Gi(),{promisify:{custom:n}}=fa(),{streamReturningOperators:v,promiseReturningOperators:b}=u2e(),{codes:{ERR_ILLEGAL_CONSTRUCTOR:y}}=xa(),M=dJ(),{setDefaultHighWaterMark:w,getDefaultHighWaterMark:g}=i3(),{pipeline:_}=pE(),{destroyer:x}=Wd(),E=Sh(),R=cJ(),T=s0(),N=rE=dE().Stream;N.isDestroyed=T.isDestroyed,N.isDisturbed=T.isDisturbed,N.isErrored=T.isErrored,N.isReadable=T.isReadable,N.isWritable=T.isWritable,N.Readable=n3();for(let L of f(v)){let D=function(...W){if(new.target)throw y();return N.Readable.from(d(Z,this||QV,W))},Z=v[L];o(D,"name",{__proto__:null,value:Z.name}),o(D,"length",{__proto__:null,value:Z.length}),o(N.Readable.prototype,L,{__proto__:null,value:D,enumerable:!1,configurable:!0,writable:!0})}for(let L of f(b)){let D=function(...W){if(new.target)throw y();return d(Z,this||QV,W)},Z=b[L];o(D,"name",{__proto__:null,value:Z.name}),o(D,"length",{__proto__:null,value:Z.length}),o(N.Readable.prototype,L,{__proto__:null,value:D,enumerable:!1,configurable:!0,writable:!0})}N.Writable=cE(),N.Duplex=a0(),N.Transform=uJ(),N.PassThrough=lJ(),N.pipeline=_;let{addAbortSignal:P}=r3();return N.addAbortSignal=P,N.finished=E,N.destroy=x,N.compose=M,N.setDefaultHighWaterMark=w,N.getDefaultHighWaterMark=g,o(N,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return R}}),o(_,n,{__proto__:null,enumerable:!0,get(){return R.pipeline}}),o(E,n,{__proto__:null,enumerable:!0,get(){return R.finished}}),N.Stream=N,N._isUint8Array=function(D){return D instanceof Uint8Array},N._uint8ArrayToBuffer=function(D){return a.from(D.buffer,D.byteOffset,D.byteLength)},rE}var Zi={},eJ=!1;function l2e(){if(eJ)return Zi;eJ=!0;let a=pJ(),o=cJ(),f=a.Readable.destroy;return Zi=a.Readable,Zi._uint8ArrayToBuffer=a._uint8ArrayToBuffer,Zi._isUint8Array=a._isUint8Array,Zi.isDisturbed=a.isDisturbed,Zi.isErrored=a.isErrored,Zi.isReadable=a.isReadable,Zi.Readable=a.Readable,Zi.Writable=a.Writable,Zi.Duplex=a.Duplex,Zi.Transform=a.Transform,Zi.PassThrough=a.PassThrough,Zi.addAbortSignal=a.addAbortSignal,Zi.finished=a.finished,Zi.destroy=a.destroy,Zi.destroy=f,Zi.pipeline=a.pipeline,Zi.compose=a.compose,Object.defineProperty(a,"promises",{configurable:!0,enumerable:!0,get(){return o}}),Zi.Stream=a.Stream,Zi.default=Zi,Zi}var Si=l2e();Si._uint8ArrayToBuffer;Si._isUint8Array;Si.isDisturbed;Si.isErrored;Si.isReadable;Si.Readable;Si.Writable;Si.Duplex;Si.Transform;Si.PassThrough;Si.addAbortSignal;Si.finished;Si.destroy;Si.pipeline;Si.compose;Si.Stream;var tJ=Si.Readable;tJ.wrap=function(a,o){return o=Object.assign({objectMode:a.readableObjectMode!=null||a.objectMode!=null||!0},o),o.destroy=function(f,d){a.destroy(f),d(f)},new tJ(o).wrap(a)};var ike=Si.Writable,nke=Si.Duplex,vJ=Si.Transform,bJ=Si.PassThrough,ake=Si.finished,oke=Si.pipeline,ske=Si.Stream,fke={finished:RV(Si.finished),pipeline:RV(Si.pipeline)};var dl=Ae(Za(),1);async function mJ(a){let o=gJ(a),f=(await o.next()).value;f=await ha(o,f,32);let d=Wi(f.subarray(0,32));f=f.subarray(32);let n=64*d;f=await ha(o,f,n);let v=new Array(d);for(let M=0;M<n;M+=64)v[M/64]=[Wi(f.subarray(M,M+32)),(0,dl.default)(at.from(f.subarray(M+32,M+64)))];f=f.subarray(n);let b=32+n,y=[];for(let[M,w]of v){f=await ha(o,f,jb),f=await ha(o,f,2);let g=Wi(f.subarray(0,2));f=f.subarray(2);let{sigLength:_,pubLength:x,sigName:E}=Ir[g];f=await ha(o,f,_);let R=f.subarray(0,_);f=f.subarray(_),f=await ha(o,f,x);let T=f.subarray(0,x);f=f.subarray(x),f=await ha(o,f,1);let N=f[0]===1;N&&(f=await ha(o,f,33));let P=N?f.subarray(1,33):at.allocUnsafe(0);f=f.subarray(N?33:1),f=await ha(o,f,1);let L=f[0]===1;L&&(f=await ha(o,f,33));let D=L?f.subarray(1,33):at.allocUnsafe(0);f=f.subarray(L?33:1),f=await ha(o,f,8);let Z=Wi(f.subarray(0,8));f=f.subarray(8),f=await ha(o,f,8);let W=Wi(f.subarray(0,8));f=f.subarray(8),f=await ha(o,f,W);let Q=f.subarray(0,W),K=Z!==0&&W!==0?Hd(at.from(Q)):[];if(K.length!==Z)throw new Error("Tags lengths don't match");f=f.subarray(W);let z=new vJ;z._transform=function(i,s,h){this.push(i),h()};let X=J0([(0,fi.stringToBuffer)("dataitem"),(0,fi.stringToBuffer)("1"),(0,fi.stringToBuffer)(g.toString()),T,P,D,Q,z]),p=2+_+x+(N?33:1)+(L?33:1)+16+W,e=M-p;if(f.byteLength>e)z.write(f.subarray(0,e)),f=f.subarray(e);else{let i=f.byteLength;for(z.write(f);e>i;){if(f=(await o.next()).value,!f)throw new Error(`Not enough data bytes expected: ${e} received: ${i}`);i+=f.byteLength,i>e?z.write(f.subarray(0,f.byteLength-(i-e))):z.write(f)}f=f.subarray(f.byteLength-(i-e))}if(z.end(),w!==(0,dl.default)(V0("sha256").update(R).digest()))throw new Error("ID doesn't match signature");if(!await np[g].verify(T,await X,R))throw new Error("Invalid signature");y.push({id:w,sigName:E,signature:(0,dl.default)(at.from(R)),target:(0,dl.default)(at.from(P)),anchor:(0,dl.default)(at.from(D)),owner:(0,dl.default)(at.from(T)),tags:K,dataOffset:b+p,dataSize:e}),b+=p+e}return y}async function d2e(a,o,f,d){let n=hp("",f,d),v=new bJ,b=[(0,fi.stringToBuffer)("dataitem"),(0,fi.stringToBuffer)("1"),(0,fi.stringToBuffer)(n.signatureType.toString()),n.rawOwner,n.rawTarget,n.rawAnchor,n.rawTags,a],y=await J0(b),M=at.from(await f.sign(y));return n.setSignature(M),v.write(n.getRaw()),o.pipe(v)}async function ha(a,o,f){if(o.byteLength>=f)return o;let{done:d,value:n}=await a.next();if(d&&!n)throw new Error("Invalid buffer");return ha(a,at.concat([at.from(o),at.from(n)]),f)}async function*gJ(a){for await(let o of a)yield o}var c2e=mJ,p2e={readBytes:ha,getReader:gJ};var v2e={...aS,stream:vE};globalThis.arbundles??=v2e;function cl(a){return async o=>{if(Wo(o))return o;if(!a.arweave)throw new Error("Must initialize with Arweave in order to create transactions");try{return await b2e(a,{data:o})}catch(f){throw new Error(f.message??"Error resolving transaction")}}}async function b2e(a,o){let f=null,d=null,n=null;if(typeof o.data=="string"&&(f=at.from(kE(o.data),"base64"),d=TE(o.data),n=$E(f)),o.data instanceof File&&(f=new Uint8Array(await o.data.arrayBuffer()),d=o.data.type,n=o.data.size),f&&d&&n)if(n<Number(p3.dispatchUploadSize))try{let v=await a.arweave.createTransaction({data:f},"use_wallet");return v.addTag(Kr.keys.contentType,d),o.tags&&o.tags.length>0&&o.tags.forEach(y=>v.addTag(y.name,y.value)),(await globalThis.window.arweaveWallet.dispatch(v)).id}catch(v){throw new Error(v.message??"Error dispatching transaction")}else try{let v=await m2e(o.data,{tags:[{name:"Content-Type",value:d},{name:"App-Name",value:"@permaweb/libs"}]},{apiUrl:p3.node1,token:"arweave",chunkSize:5242880,batchSize:3});return console.log(v),console.log("Uploaded dataItem ID:",v.id),v.id}catch(v){throw new Error(v.message??"Error uploading transaction")}else throw new Error("Error preparing transaction data")}async function m2e(a,o,f){let{apiUrl:d,token:n,chunkSize:v,batchSize:b=3}=f,y=new hl(window.arweaveWallet),M=await y.signer.getActivePublicKey();y.publicKey=at.from(M,"base64");let w=new Uint8Array(await a.arrayBuffer()),g=hp(w,y,{...o,anchor:o.anchor||(()=>{let p=new Uint8Array(32);return crypto.getRandomValues(p),btoa(String.fromCharCode(...p)).replace(/\+/g,"-").replace(/\//g,"_").slice(0,32)})()});await g.sign(y);let _=g.getRaw(),x=new Blob([new Uint8Array(_)],{type:"application/octet-stream"}),E={"x-chunking-version":"2"},R=await fetch(`${d}/chunks/${n}/-1/-1`,{headers:E});if(!R.ok)throw new Error(`Failed to get upload ID: ${R.status} ${await R.text()}`);let T=await R.json(),N=T.id;if(v<T.min||v>T.max)throw new Error(`Configured chunkSize ${v} is out of allowed range ${T.min}-${T.max}`);let P=x.size,L=[];for(let p=0;p<P;p+=v)L.push(p);let D=new Set;(T.chunks??[]).forEach(([p])=>D.add(Number(p)));let Z=L.filter(p=>p>0&&!D.has(p)),W=D.has(0)?[]:[0],Q=Z.concat(W),K=p=>new Promise(e=>setTimeout(e,p));for(let p=0;p<Q.length;p+=b){let e=Q.slice(p,p+b);await Promise.all(e.map(async r=>{let s=await x.slice(r,r+v).arrayBuffer(),h=null;for(let c=1;c<=3;c++)try{let m=await fetch(`${d}/chunks/${n}/${N}/${r}`,{method:"POST",headers:{"Content-Type":"application/octet-stream",...E},body:s});if(!m.ok){let l=await m.text();throw m.status===402?new Error(`402 payment required: ${l}`):new Error(`Chunk upload error ${m.status}: ${l}`)}return}catch(m){if(h=m,c<3){await K(1e3*c);continue}}throw h}))}let z={"Content-Type":"application/octet-stream",...E},X=await fetch(`${d}/chunks/${n}/${N}/-1`,{method:"POST",headers:z});if(!X.ok){let p=await X.text();throw new Error(`Finalizing upload failed ${X.status}: ${p}`)}return X.json()}var Zke=Ae(Be(),1);Ie();Re();var y2e={},Kke=Ae(Be(),1);Ie();Re();var H$e=Ae(Be(),1);Ie();Re();var o$e=Ae(Be(),1);Ie();Re();function a3(a){return async(o,f)=>{let d=_2e(o);if(d)throw new Error(d);let n=IE[o.contentType]?.serialize(o.data)??o.data,v=M2e(o);try{return await Th(a,{tags:v,data:n},f?y=>f(y):void 0)}catch(b){throw new Error(b.message??"Error creating asset")}}}async function bE(a,o,f){try{let d=Ts(await Ih(a,{processId:o,path:"asset",fallbackAction:"Info"}));if(f?.useGateway){let n=await Wa({gateway:ua.goldsky,ids:[o],tags:null,owners:null,cursor:null});return{...n?.data?.[0]?o3(n.data[0]):{},...d}}return{id:o,...d}}catch(d){throw new Error(d.message||"Error fetching atomic asset")}}function yJ(a){return async(o,f)=>await bE(a,o,f)}async function wJ(a){try{let o=await Wa({gateway:ua.arweave,ids:a??null,tags:null,owners:null,cursor:null});return o&&o.data.length?o.data.map(f=>o3(f)):null}catch(o){throw new Error(o)}}function o3(a){let o={id:a.node.id,owner:a.node.owner.address};for(let f of a.node.tags){let d=f.name,v=(d.startsWith(`${Kr.keys.bootloader}-`)?d.slice(`${Kr.keys.bootloader}-`.length):d).split("-").map((y,M)=>M===0?y.toLowerCase():y.charAt(0).toUpperCase()+y.slice(1).toLowerCase()).join(""),b;try{b=JSON.parse(f.value)}catch{b=f.value.toString()}o[v]=b}return o}function M2e(a){let o=[{name:Kr.keys.onBoot,value:a.src??Ji.src.asset},{name:Kr.keys.creator,value:a.creator},{name:Kr.keys.assetType,value:a.assetType},{name:Kr.keys.contentType,value:a.contentType},{name:Kr.keys.implements,value:"ANS-110"},{name:Kr.keys.dateCreated,value:new Date().getTime().toString()},na("Name",a.name),na("Description",a.description),na("Topics",JSON.stringify(a.topics)),na("Ticker","ATOMIC"),na("Denomination",a.denomination?.toString()??"1"),na("TotalSupply",a.supply?.toString()??"1"),na("Transferable",a.transferable?.toString()??"true"),na("Creator",a.creator)];if(a.metadata)for(let f in a.metadata)o.push(na(vl(f),a.metadata[f].toString()));if(a.users)for(let f of a.users)o.push({name:"Auth-User",value:f});return a.tags&&a.tags.forEach(f=>o.push(f)),o}function _2e(a){if(typeof a!="object"||a===null)return"The provided arguments are invalid or empty.";let o=["name","description","topics","creator","data","contentType","assetType"];for(let f of o)if(!(f in a))return`Missing field '${f}'`;return typeof a.name!="string"||a.name.trim()===""?"Name is required":typeof a.description!="string"?"The description must be a valid string":!Array.isArray(a.topics)||a.topics.length===0?"Topics are required":typeof a.creator!="string"||a.creator.trim()===""?"Creator is required":a.data===void 0||a.data===null?"Data field is required":typeof a.contentType!="string"||a.contentType.trim()===""?"Content type must be a non-empty string":typeof a.assetType!="string"||a.assetType.trim()===""?"Type must be a non-empty string":"supply"in a&&(typeof a.supply!="number"||a.supply<=0)?"Supply must be a positive number":"denomination"in a&&(typeof a.denomination!="number"||a.denomination<=0)?"Denomination must be a positive number":"transferable"in a&&typeof a.transferable!="boolean"?"Transferable must be a boolean value":"metadata"in a&&typeof a.metadata!="object"?"Metadata must be an object":"tags"in a&&(!Array.isArray(a.tags)||a.tags.some(f=>typeof f!="object"))?"Tags must be an array of objects":"src"in a&&typeof a.src!="string"?"Source must be a valid string":null}var v$e=Ae(Be(),1);Ie();Re();var x2e="eXCtpVbcd_jZ0dmU2PZ8focaKxBGECBQ8wMib7sIVPo",mE="lJovHqM9hwNjHV5JoY9NGWtt0WD-5D4gOqNL2VWW5jk";function MJ(a){return async(o,f)=>{if(!a.signer)throw new Error("No signer provided");let d=cl(a),n=new Date().getTime().toString(),v=[{name:Kr.keys.creator,value:o.creator},{name:Kr.keys.ans110.title,value:Gd(o.title)},{name:Kr.keys.name,value:Gd(o.title)},{name:Kr.keys.ans110.description,value:Gd(o.description)}],b=null,y=null;try{b=o.banner?await d(o.thumbnail):mE,y=o.banner?await d(o.banner):x2e,o.thumbnail&&v.push({name:Kr.keys.thumbnail,value:b}),o.banner&&v.push({name:Kr.keys.banner,value:y})}catch(g){console.error(g)}let M=await fetch(bl(Ji.src.collection));if(!M.ok)throw new Error("Unable to fetch process src");let w=await M.text();w=w.replace(/'<NAME>'/g,v3(o.title)),w=w.replace(/'<DESCRIPTION>'/g,v3(o.description)),w=w.replace(/<CREATOR>/g,o.creator),w=w.replace(/<THUMBNAIL>/g,b||mE),w=w.replace(/<BANNER>/g,y||mE),w=w.replace(/<DATECREATED>/g,n),w=w.replace(/<LASTUPDATE>/g,n);try{let g=await Th(a,{tags:v},f?_=>f(_):void 0);if(Zo("Sending eval message to collection..."),f&&f("Sending eval message to collection..."),await a.ao.message({process:g,signer:a.signer,tags:[{name:"Action",value:"Eval"}],data:w}),!o.skipRegistry){Zo("Sending collection to registry..."),f&&f("Sending collection to registry...");let _=[{name:"Action",value:"Add-Collection"},{name:"CollectionId",value:g},{name:"Name",value:Gd(o.title)},{name:"Creator",value:o.creator},{name:"DateCreated",value:n}];y&&_.push({name:"Banner",value:y}),b&&_.push({name:"Thumbnail",value:b}),await a.ao.message({process:Ji.collectionRegistry,signer:a.signer,tags:_})}if(!o.skipActivity){Zo("Creating collection activity process..."),f&&f("Creating collection activity process...");let _=[{name:"CollectionId",value:g},{name:"DateCreated",value:n},{name:"UCM-Process",value:"Collection-Activity"},{name:"On-Boot",value:Ji.src.collectionActivity}],x=await Th(a,{tags:_},f?E=>f(E):void 0);Zo("Adding activity to collection process..."),f&&f("Adding activity to collection process..."),await a.ao.message({process:g,signer:a.signer,tags:[{name:"Action",value:"Eval"}],data:`ActivityProcess = '${x}'`})}return g}catch(g){throw new Error(g.message??"Error creating collection")}}}function _J(a){return async o=>await ks(a,{processId:o.creator,action:"Run-Action",tags:[{name:"ForwardTo",value:o.collectionId},{name:"ForwardAction",value:"Update-Assets"}],data:{Target:o.collectionId,Action:"Update-Assets",Input:{AssetIds:o.assetIds,UpdateType:o.updateType}}})}function xJ(a){return async o=>{let f=await Ih(a,{processId:o,path:"collection",fallbackAction:"Info"});return f?Ts(f):null}}function SJ(a){return async o=>{let f=o.creator?"Get-Collections-By-User":"Get-Collections",d=await Sp(a,{processId:Ji.collectionRegistry,action:f,tags:o.creator?[{name:"Creator",value:o.creator}]:null});return d&&d.Collections&&d.Collections.length?d.Collections.map(v=>({id:v.Id,title:v.Name.replace(/\[|\]/g,""),description:v.Description,creator:v.Creator,dateCreated:v.DateCreated,banner:v.Banner,thumbnail:v.Thumbnail})):null}}var x$e=Ae(Be(),1);Ie();Re();function EJ(a){let o=a3(a);return async(f,d)=>{let n=f.tags?f.tags:[];n.push({name:"Data-Source",value:f.parentId}),n.push({name:"Root-Source",value:f.rootId??f.parentId});let v={name:`Comment on ${f.parentId}`,description:`Comment on ${f.parentId}`,topics:["comment"],creator:f.creator,data:f.content,contentType:"text/plain",assetType:"comment",tags:n};return o(v,d)}}function AJ(a){return async o=>{try{let f=await bE(a,o,{useGateway:!0}),d=f?.dataSource,n=f?.rootSource;if(!d||!n)throw new Error("dataSource and rootSource must be present on a comment");return{content:await RJ(o),parentId:d,rootId:n}}catch(f){throw new Error(f.message??"Error getting comment")}}}function BJ(a){return async o=>{if(!o.parentId&&!o.rootId)throw new Error("Must provide either parentId or rootId");let f=[];o.parentId&&f.push({name:"Data-Source",values:[o.parentId??""]}),o.rootId&&f.push({name:"Root-Source",values:[o.rootId??""]});let d=await Wa({gateway:ua.goldsky,ids:null,tags:f,owners:null,cursor:null}),n=[];d&&d.data.length&&(n=d.data.map(b=>o3(b)));let v=[];for(let b of n){let y=b?.dataSource,M=b?.rootSource;if(!y||!M)throw new Error("dataSource and rootSource must be present on a comment");v.push({id:b.id,content:await RJ(b.id),parentId:y,rootId:M})}return v}}async function RJ(a){try{return await(await fetch(bl(a))).text()}catch(o){throw new Error(o.message??"Error getting comment data")}}var U$e=Ae(Be(),1);Ie();Re();var k$e=Ae(Be(),1);Ie();Re();function s3(a){return async(o,f)=>{try{let d=[{name:Kr.keys.onBoot,value:Ji.src.zone.id}];return o.tags&&o.tags.length&&o.tags.forEach(v=>d.push(v)),await Th(a,{data:o.data,tags:d},f?v=>f(v):void 0)}catch(d){throw new Error(d.message??"Error creating zone")}}}function f3(a){return async(o,f)=>{try{let d=Object.entries(o).map(([v,b])=>({key:v,value:b}));return await ks(a,{processId:f,action:"Zone-Update",data:d})}catch(d){throw new Error(d)}}}function IJ(a){return async(o,f)=>{try{return await ks(a,{processId:f,action:"Zone-Append",tags:[{name:"Path",value:o.path}],data:o.data})}catch(d){throw new Error(d)}}}function TJ(a){return async(o,f)=>{if(!Wo(f))throw new Error("Invalid zone address");let n=[];for(let v of o){if(!Wo(v.granteeId))throw new Error("Invalid granteeId address");if(v.type!=="wallet"&&v.type!=="process")throw new Error("Invalid role type");n.push({Id:v.granteeId,Roles:v.roles,Type:v.type,SendInvite:v.sendInvite})}try{return await ks(a,{processId:f,action:"Role-Set",tags:[],data:n})}catch(v){throw new Error(v)}}}function kJ(a){return async(o,f)=>{if(!(Wo(f)&&Wo(o.zoneToJoinId)))throw new Error("Invalid zone address");let n=[{name:"ZoneId",value:o.zoneToJoinId}];o.path&&n.push({name:"Path",value:o.path});try{return await ks(a,{processId:f,action:"Zone-Join",tags:n})}catch(v){throw new Error(v)}}}function h3(a){return async o=>{try{return Zo(`Updating zone to version ${Ji.src.zone.version} with source ${Ji.src.zone.id}`),await Vd(a,{processId:o.zoneId,evalTxId:Ji.src.zone.id}),await Vd(a,{processId:o.zoneId,evalSrc:`Zone.Version = '${Ji.src.zone.version}'; SyncState()`})}catch(f){throw new Error(f)}}}function u3(a){return async o=>{try{let f=await Ih(a,{processId:o,path:"zone",fallbackAction:"Info"});return Ts(f)}catch(f){throw new Error(f.message??"Error getting zone")}}}function $J(a){let o=s3(a),f=cl(a);return async(d,n)=>{let v=null,b=[{name:Kr.keys.dataProtocol,value:Kr.values.zone},{name:Kr.keys.zoneType,value:Kr.values.user}],y=async M=>{let w=M.toLowerCase();if(d[w])try{let g=await f(d[w]);b.push(na(M,g))}catch(g){n?n(`Failed to resolve ${M}: ${g.message}`):console.error(g)}};d.username&&b.push(na("Username",d.username)),d.displayName&&b.push(na("DisplayName",d.displayName)),d.description&&b.push(na("Description",d.description)),await Promise.all([y("Thumbnail"),y("Banner")]);try{v=await o({tags:b},n)}catch(M){throw new Error(M.message??"Error creating profile")}return v}}function PJ(a){let o=f3(a),f=cl(a);return async(d,n,v)=>{if(n){let b={Username:d.username,DisplayName:d.displayName,Description:d.description};if(d.thumbnail)try{b.Thumbnail=await f(d.thumbnail)}catch(y){v&&v(`Failed to resolve thumbnail: ${y.message}`)}if(d.banner)try{b.Banner=await f(d.banner)}catch(y){v&&v(`Failed to resolve banner: ${y.message}`)}try{return await o(b,n)}catch(y){throw new Error(y.message??"Error creating profile")}}else throw new Error("No profile provided")}}function NJ(a){let o=h3(a);return async f=>{try{return await o({zoneId:f.profileId})}catch(d){throw new Error(d)}}}function gE(a){let o=u3(a);return async f=>{try{let d=await o(f);if(!d)throw new Error("Error fetching profile - Not found");return{id:f,owner:d.owner,assets:d.assets,roles:d.roles,invites:d.invites,version:d.version,...d.store}}catch(d){throw new Error(d.message??"Error fetching profile")}}}function CJ(a){let o=gE(a);return async f=>{try{let d=await Wa({gateway:ua.goldsky,tags:[{name:Kr.keys.dataProtocol,values:[Kr.values.zone]},{name:Kr.keys.zoneType,values:[Kr.values.user]}],owners:[f]});return d?.data?.length>0?(d.data.sort((n,v)=>{let b=n.node.block?.timestamp??0;return(v.node.block?.timestamp??0)-b}),await o(d.data[0].node.id)):{id:null}}catch(d){throw new Error(d.message??"Error fetching profile")}}}var Y$e=Ji.src.zone.version;function E2e(a){return{createZone:s3(a),updateZone:f3(a),addToZone:IJ(a),getZone:u3(a),setZoneRoles:TJ(a),joinZone:kJ(a),updateZoneVersion:h3(a),createProfile:$J(a),updateProfile:PJ(a),updateProfileVersion:NJ(a),getProfileById:gE(a),getProfileByWalletAddress:CJ(a),createAtomicAsset:a3(a),getAtomicAsset:yJ(a),getAtomicAssets:wJ,createComment:EJ(a),getComment:AJ(a),getComments:BJ(a),createCollection:MJ(a),updateCollectionAssets:_J(a),getCollection:xJ(a),getCollections:SJ(a),resolveTransaction:cl(a),getGQLData:Wa,getAggregatedGQLData:PE,createProcess:OE(a),readProcess:DE(a),readState:LE(a),sendMessage:CE(a),mapFromProcessCase:Ts,mapToProcessCase:vl}}var X$e={init:E2e};export{Y$e as CurrentZoneVersion,y2e as Types,X$e as default};
|
|
80
80
|
/*! Bundled license information:
|
|
81
81
|
|
|
82
82
|
@jspm/core/nodelibs/browser/chunk-DtuTasat.js:
|