diff --git a/android/lib/src/main/res/raw/trust_min.js b/android/lib/src/main/res/raw/trust_min.js index 9c3ae6d8..dca48b8e 100644 --- a/android/lib/src/main/res/raw/trust_min.js +++ b/android/lib/src/main/res/raw/trust_min.js @@ -1,34 +1,34 @@ -(function(ft){typeof define=="function"&&define.amd?define(ft):ft()})(function(){"use strict";var ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Un(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var ie={},nf={};nf.byteLength=NE,nf.toByteArray=UE,nf.fromByteArray=HE;for(var pi=[],Fn=[],OE=typeof Uint8Array<"u"?Uint8Array:Array,Tl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ao=0,ME=Tl.length;Ao0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function NE(e){var t=Np(e),r=t[0],n=t[1];return(r+n)*3/4-n}function PE(e,t,r){return(t+r)*3/4-r}function UE(e){var t,r=Np(e),n=r[0],i=r[1],s=new OE(PE(e,n,i)),o=0,a=i>0?n-4:n,c;for(c=0;c>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=Fn[e.charCodeAt(c)]<<2|Fn[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=Fn[e.charCodeAt(c)]<<10|Fn[e.charCodeAt(c+1)]<<4|Fn[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function FE(e){return pi[e>>18&63]+pi[e>>12&63]+pi[e>>6&63]+pi[e&63]}function DE(e,t,r){for(var n,i=[],s=t;sa?a:o+s));return n===1?(t=e[r-1],i.push(pi[t>>2]+pi[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(pi[t>>10]+pi[t>>4&63]+pi[t<<2&63]+"=")),i.join("")}var kl={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */kl.read=function(e,t,r,n,i){var s,o,a=i*8-n-1,c=(1<>1,l=-7,y=r?i-1:0,A=r?-1:1,v=e[t+y];for(y+=A,s=v&(1<<-l)-1,v>>=-l,l+=a;l>0;s=s*256+e[t+y],y+=A,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+e[t+y],y+=A,l-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(v?-1:1)*o*Math.pow(2,s-n)},kl.write=function(e,t,r,n,i,s){var o,a,c,u=s*8-i-1,l=(1<>1,A=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,R=n?1:-1,O=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+y>=1?t+=A/c:t+=A*Math.pow(2,1-y),t*c>=2&&(o++,c/=2),o+y>=l?(a=0,o=l):o+y>=1?(a=(t*c-1)*Math.pow(2,i),o=o+y):(a=t*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;e[r+v]=a&255,v+=R,a/=256,i-=8);for(o=o<0;e[r+v]=o&255,v+=R,o/=256,u-=8);e[r+v-R]|=O*128};/*! +(function(ft){typeof define=="function"&&define.amd?define(ft):ft()})(function(){"use strict";var ft=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Un(e){var t=e.default;if(typeof t=="function"){var r=function(){return t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach(function(n){var i=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,i.get?i:{enumerable:!0,get:function(){return e[n]}})}),r}var ie={},ef={};ef.byteLength=BE,ef.toByteArray=RE,ef.fromByteArray=CE;for(var pi=[],Fn=[],SE=typeof Uint8Array<"u"?Uint8Array:Array,Al="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",So=0,AE=Al.length;So0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");r===-1&&(r=t);var n=r===t?0:4-r%4;return[r,n]}function BE(e){var t=Lp(e),r=t[0],n=t[1];return(r+n)*3/4-n}function IE(e,t,r){return(t+r)*3/4-r}function RE(e){var t,r=Lp(e),n=r[0],i=r[1],s=new SE(IE(e,n,i)),o=0,a=i>0?n-4:n,c;for(c=0;c>16&255,s[o++]=t>>8&255,s[o++]=t&255;return i===2&&(t=Fn[e.charCodeAt(c)]<<2|Fn[e.charCodeAt(c+1)]>>4,s[o++]=t&255),i===1&&(t=Fn[e.charCodeAt(c)]<<10|Fn[e.charCodeAt(c+1)]<<4|Fn[e.charCodeAt(c+2)]>>2,s[o++]=t>>8&255,s[o++]=t&255),s}function TE(e){return pi[e>>18&63]+pi[e>>12&63]+pi[e>>6&63]+pi[e&63]}function kE(e,t,r){for(var n,i=[],s=t;sa?a:o+s));return n===1?(t=e[r-1],i.push(pi[t>>2]+pi[t<<4&63]+"==")):n===2&&(t=(e[r-2]<<8)+e[r-1],i.push(pi[t>>10]+pi[t>>4&63]+pi[t<<2&63]+"=")),i.join("")}var Bl={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */Bl.read=function(e,t,r,n,i){var s,o,a=i*8-n-1,c=(1<>1,l=-7,y=r?i-1:0,A=r?-1:1,v=e[t+y];for(y+=A,s=v&(1<<-l)-1,v>>=-l,l+=a;l>0;s=s*256+e[t+y],y+=A,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+e[t+y],y+=A,l-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(v?-1:1)*o*Math.pow(2,s-n)},Bl.write=function(e,t,r,n,i,s){var o,a,c,u=s*8-i-1,l=(1<>1,A=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,R=n?1:-1,O=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+y>=1?t+=A/c:t+=A*Math.pow(2,1-y),t*c>=2&&(o++,c/=2),o+y>=l?(a=0,o=l):o+y>=1?(a=(t*c-1)*Math.pow(2,i),o=o+y):(a=t*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;e[r+v]=a&255,v+=R,a/=256,i-=8);for(o=o<0;e[r+v]=o&255,v+=R,o/=256,u-=8);e[r+v-R]|=O*128};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */(function(e){const t=nf,r=kl,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=F,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.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 s(){try{const C=new Uint8Array(1),w={foo:function(){return 42}};return Object.setPrototypeOf(w,Uint8Array.prototype),Object.setPrototypeOf(C,w),C.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(C){if(C>i)throw new RangeError('The value "'+C+'" is invalid for option "size"');const w=new Uint8Array(C);return Object.setPrototypeOf(w,a.prototype),w}function a(C,w,b){if(typeof C=="number"){if(typeof w=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(C)}return c(C,w,b)}a.poolSize=8192;function c(C,w,b){if(typeof C=="string")return A(C,w);if(ArrayBuffer.isView(C))return R(C);if(C==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof C);if(Wt(C,ArrayBuffer)||C&&Wt(C.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Wt(C,SharedArrayBuffer)||C&&Wt(C.buffer,SharedArrayBuffer)))return O(C,w,b);if(typeof C=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const D=C.valueOf&&C.valueOf();if(D!=null&&D!==C)return a.from(D,w,b);const V=P(C);if(V)return V;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof C[Symbol.toPrimitive]=="function")return a.from(C[Symbol.toPrimitive]("string"),w,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof C)}a.from=function(C,w,b){return c(C,w,b)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function u(C){if(typeof C!="number")throw new TypeError('"size" argument must be of type number');if(C<0)throw new RangeError('The value "'+C+'" is invalid for option "size"')}function l(C,w,b){return u(C),C<=0?o(C):w!==void 0?typeof b=="string"?o(C).fill(w,b):o(C).fill(w):o(C)}a.alloc=function(C,w,b){return l(C,w,b)};function y(C){return u(C),o(C<0?0:H(C)|0)}a.allocUnsafe=function(C){return y(C)},a.allocUnsafeSlow=function(C){return y(C)};function A(C,w){if((typeof w!="string"||w==="")&&(w="utf8"),!a.isEncoding(w))throw new TypeError("Unknown encoding: "+w);const b=N(C,w)|0;let D=o(b);const V=D.write(C,w);return V!==b&&(D=D.slice(0,V)),D}function v(C){const w=C.length<0?0:H(C.length)|0,b=o(w);for(let D=0;D=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return C|0}function F(C){return+C!=C&&(C=0),a.alloc(+C)}a.isBuffer=function(w){return w!=null&&w._isBuffer===!0&&w!==a.prototype},a.compare=function(w,b){if(Wt(w,Uint8Array)&&(w=a.from(w,w.offset,w.byteLength)),Wt(b,Uint8Array)&&(b=a.from(b,b.offset,b.byteLength)),!a.isBuffer(w)||!a.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(w===b)return 0;let D=w.length,V=b.length;for(let X=0,ae=Math.min(D,V);XV.length?(a.isBuffer(ae)||(ae=a.from(ae)),ae.copy(V,X)):Uint8Array.prototype.set.call(V,ae,X);else if(a.isBuffer(ae))ae.copy(V,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=ae.length}return V};function N(C,w){if(a.isBuffer(C))return C.length;if(ArrayBuffer.isView(C)||Wt(C,ArrayBuffer))return C.byteLength;if(typeof C!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof C);const b=C.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&b===0)return 0;let V=!1;for(;;)switch(w){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return He(C).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b*2;case"hex":return b>>>1;case"base64":return ut(C).length;default:if(V)return D?-1:He(C).length;w=(""+w).toLowerCase(),V=!0}}a.byteLength=N;function $(C,w,b){let D=!1;if((w===void 0||w<0)&&(w=0),w>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0,w>>>=0,b<=w))return"";for(C||(C="utf8");;)switch(C){case"hex":return x(this,w,b);case"utf8":case"utf-8":return f(this,w,b);case"ascii":return _(this,w,b);case"latin1":case"binary":return E(this,w,b);case"base64":return g(this,w,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,w,b);default:if(D)throw new TypeError("Unknown encoding: "+C);C=(C+"").toLowerCase(),D=!0}}a.prototype._isBuffer=!0;function q(C,w,b){const D=C[w];C[w]=C[b],C[b]=D}a.prototype.swap16=function(){const w=this.length;if(w%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;bb&&(w+=" ... "),""},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(w,b,D,V,X){if(Wt(w,Uint8Array)&&(w=a.from(w,w.offset,w.byteLength)),!a.isBuffer(w))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof w);if(b===void 0&&(b=0),D===void 0&&(D=w?w.length:0),V===void 0&&(V=0),X===void 0&&(X=this.length),b<0||D>w.length||V<0||X>this.length)throw new RangeError("out of range index");if(V>=X&&b>=D)return 0;if(V>=X)return-1;if(b>=D)return 1;if(b>>>=0,D>>>=0,V>>>=0,X>>>=0,this===w)return 0;let ae=X-V,Ze=D-b;const Ge=Math.min(ae,Ze),We=this.slice(V,X),jt=w.slice(b,D);for(let ze=0;ze2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b=+b,xt(b)&&(b=V?0:C.length-1),b<0&&(b=C.length+b),b>=C.length){if(V)return-1;b=C.length-1}else if(b<0)if(V)b=0;else return-1;if(typeof w=="string"&&(w=a.from(w,D)),a.isBuffer(w))return w.length===0?-1:Z(C,w,b,D,V);if(typeof w=="number")return w=w&255,typeof Uint8Array.prototype.indexOf=="function"?V?Uint8Array.prototype.indexOf.call(C,w,b):Uint8Array.prototype.lastIndexOf.call(C,w,b):Z(C,[w],b,D,V);throw new TypeError("val must be string, number or Buffer")}function Z(C,w,b,D,V){let X=1,ae=C.length,Ze=w.length;if(D!==void 0&&(D=String(D).toLowerCase(),D==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(C.length<2||w.length<2)return-1;X=2,ae/=2,Ze/=2,b/=2}function Ge(jt,ze){return X===1?jt[ze]:jt.readUInt16BE(ze*X)}let We;if(V){let jt=-1;for(We=b;Weae&&(b=ae-Ze),We=b;We>=0;We--){let jt=!0;for(let ze=0;zeV&&(D=V)):D=V;const X=w.length;D>X/2&&(D=X/2);let ae;for(ae=0;ae>>0,isFinite(D)?(D=D>>>0,V===void 0&&(V="utf8")):(V=D,D=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const X=this.length-b;if((D===void 0||D>X)&&(D=X),w.length>0&&(D<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let ae=!1;for(;;)switch(V){case"hex":return z(this,w,b,D);case"utf8":case"utf-8":return ee(this,w,b,D);case"ascii":case"latin1":case"binary":return se(this,w,b,D);case"base64":return Q(this,w,b,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,w,b,D);default:if(ae)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),ae=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function g(C,w,b){return w===0&&b===C.length?t.fromByteArray(C):t.fromByteArray(C.slice(w,b))}function f(C,w,b){b=Math.min(C.length,b);const D=[];let V=w;for(;V239?4:X>223?3:X>191?2:1;if(V+Ze<=b){let Ge,We,jt,ze;switch(Ze){case 1:X<128&&(ae=X);break;case 2:Ge=C[V+1],(Ge&192)===128&&(ze=(X&31)<<6|Ge&63,ze>127&&(ae=ze));break;case 3:Ge=C[V+1],We=C[V+2],(Ge&192)===128&&(We&192)===128&&(ze=(X&15)<<12|(Ge&63)<<6|We&63,ze>2047&&(ze<55296||ze>57343)&&(ae=ze));break;case 4:Ge=C[V+1],We=C[V+2],jt=C[V+3],(Ge&192)===128&&(We&192)===128&&(jt&192)===128&&(ze=(X&15)<<18|(Ge&63)<<12|(We&63)<<6|jt&63,ze>65535&&ze<1114112&&(ae=ze))}}ae===null?(ae=65533,Ze=1):ae>65535&&(ae-=65536,D.push(ae>>>10&1023|55296),ae=56320|ae&1023),D.push(ae),V+=Ze}return m(D)}const h=4096;function m(C){const w=C.length;if(w<=h)return String.fromCharCode.apply(String,C);let b="",D=0;for(;DD)&&(b=D);let V="";for(let X=w;XD&&(w=D),b<0?(b+=D,b<0&&(b=0)):b>D&&(b=D),bb)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(w,b,D){w=w>>>0,b=b>>>0,D||B(w,b,this.length);let V=this[w],X=1,ae=0;for(;++ae>>0,b=b>>>0,D||B(w,b,this.length);let V=this[w+--b],X=1;for(;b>0&&(X*=256);)V+=this[w+--b]*X;return V},a.prototype.readUint8=a.prototype.readUInt8=function(w,b){return w=w>>>0,b||B(w,1,this.length),this[w]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(w,b){return w=w>>>0,b||B(w,2,this.length),this[w]|this[w+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(w,b){return w=w>>>0,b||B(w,2,this.length),this[w]<<8|this[w+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(w,b){return w=w>>>0,b||B(w,4,this.length),(this[w]|this[w+1]<<8|this[w+2]<<16)+this[w+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(w,b){return w=w>>>0,b||B(w,4,this.length),this[w]*16777216+(this[w+1]<<16|this[w+2]<<8|this[w+3])},a.prototype.readBigUInt64LE=Xt(function(w){w=w>>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=b+this[++w]*2**8+this[++w]*2**16+this[++w]*2**24,X=this[++w]+this[++w]*2**8+this[++w]*2**16+D*2**24;return BigInt(V)+(BigInt(X)<>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=b*2**24+this[++w]*2**16+this[++w]*2**8+this[++w],X=this[++w]*2**24+this[++w]*2**16+this[++w]*2**8+D;return(BigInt(V)<>>0,b=b>>>0,D||B(w,b,this.length);let V=this[w],X=1,ae=0;for(;++ae=X&&(V-=Math.pow(2,8*b)),V},a.prototype.readIntBE=function(w,b,D){w=w>>>0,b=b>>>0,D||B(w,b,this.length);let V=b,X=1,ae=this[w+--V];for(;V>0&&(X*=256);)ae+=this[w+--V]*X;return X*=128,ae>=X&&(ae-=Math.pow(2,8*b)),ae},a.prototype.readInt8=function(w,b){return w=w>>>0,b||B(w,1,this.length),this[w]&128?(255-this[w]+1)*-1:this[w]},a.prototype.readInt16LE=function(w,b){w=w>>>0,b||B(w,2,this.length);const D=this[w]|this[w+1]<<8;return D&32768?D|4294901760:D},a.prototype.readInt16BE=function(w,b){w=w>>>0,b||B(w,2,this.length);const D=this[w+1]|this[w]<<8;return D&32768?D|4294901760:D},a.prototype.readInt32LE=function(w,b){return w=w>>>0,b||B(w,4,this.length),this[w]|this[w+1]<<8|this[w+2]<<16|this[w+3]<<24},a.prototype.readInt32BE=function(w,b){return w=w>>>0,b||B(w,4,this.length),this[w]<<24|this[w+1]<<16|this[w+2]<<8|this[w+3]},a.prototype.readBigInt64LE=Xt(function(w){w=w>>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=this[w+4]+this[w+5]*2**8+this[w+6]*2**16+(D<<24);return(BigInt(V)<>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=(b<<24)+this[++w]*2**16+this[++w]*2**8+this[++w];return(BigInt(V)<>>0,b||B(w,4,this.length),r.read(this,w,!0,23,4)},a.prototype.readFloatBE=function(w,b){return w=w>>>0,b||B(w,4,this.length),r.read(this,w,!1,23,4)},a.prototype.readDoubleLE=function(w,b){return w=w>>>0,b||B(w,8,this.length),r.read(this,w,!0,52,8)},a.prototype.readDoubleBE=function(w,b){return w=w>>>0,b||B(w,8,this.length),r.read(this,w,!1,52,8)};function d(C,w,b,D,V,X){if(!a.isBuffer(C))throw new TypeError('"buffer" argument must be a Buffer instance');if(w>V||wC.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(w,b,D,V){if(w=+w,b=b>>>0,D=D>>>0,!V){const Ze=Math.pow(2,8*D)-1;d(this,w,b,D,Ze,0)}let X=1,ae=0;for(this[b]=w&255;++ae>>0,D=D>>>0,!V){const Ze=Math.pow(2,8*D)-1;d(this,w,b,D,Ze,0)}let X=D-1,ae=1;for(this[b+X]=w&255;--X>=0&&(ae*=256);)this[b+X]=w/ae&255;return b+D},a.prototype.writeUint8=a.prototype.writeUInt8=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,1,255,0),this[b]=w&255,b+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,65535,0),this[b]=w&255,this[b+1]=w>>>8,b+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,65535,0),this[b]=w>>>8,this[b+1]=w&255,b+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,4294967295,0),this[b+3]=w>>>24,this[b+2]=w>>>16,this[b+1]=w>>>8,this[b]=w&255,b+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,4294967295,0),this[b]=w>>>24,this[b+1]=w>>>16,this[b+2]=w>>>8,this[b+3]=w&255,b+4};function k(C,w,b,D,V){Pe(w,D,V,C,b,7);let X=Number(w&BigInt(4294967295));C[b++]=X,X=X>>8,C[b++]=X,X=X>>8,C[b++]=X,X=X>>8,C[b++]=X;let ae=Number(w>>BigInt(32)&BigInt(4294967295));return C[b++]=ae,ae=ae>>8,C[b++]=ae,ae=ae>>8,C[b++]=ae,ae=ae>>8,C[b++]=ae,b}function W(C,w,b,D,V){Pe(w,D,V,C,b,7);let X=Number(w&BigInt(4294967295));C[b+7]=X,X=X>>8,C[b+6]=X,X=X>>8,C[b+5]=X,X=X>>8,C[b+4]=X;let ae=Number(w>>BigInt(32)&BigInt(4294967295));return C[b+3]=ae,ae=ae>>8,C[b+2]=ae,ae=ae>>8,C[b+1]=ae,ae=ae>>8,C[b]=ae,b+8}a.prototype.writeBigUInt64LE=Xt(function(w,b=0){return k(this,w,b,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=Xt(function(w,b=0){return W(this,w,b,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(w,b,D,V){if(w=+w,b=b>>>0,!V){const Ge=Math.pow(2,8*D-1);d(this,w,b,D,Ge-1,-Ge)}let X=0,ae=1,Ze=0;for(this[b]=w&255;++X>0)-Ze&255;return b+D},a.prototype.writeIntBE=function(w,b,D,V){if(w=+w,b=b>>>0,!V){const Ge=Math.pow(2,8*D-1);d(this,w,b,D,Ge-1,-Ge)}let X=D-1,ae=1,Ze=0;for(this[b+X]=w&255;--X>=0&&(ae*=256);)w<0&&Ze===0&&this[b+X+1]!==0&&(Ze=1),this[b+X]=(w/ae>>0)-Ze&255;return b+D},a.prototype.writeInt8=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,1,127,-128),w<0&&(w=255+w+1),this[b]=w&255,b+1},a.prototype.writeInt16LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,32767,-32768),this[b]=w&255,this[b+1]=w>>>8,b+2},a.prototype.writeInt16BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,32767,-32768),this[b]=w>>>8,this[b+1]=w&255,b+2},a.prototype.writeInt32LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,2147483647,-2147483648),this[b]=w&255,this[b+1]=w>>>8,this[b+2]=w>>>16,this[b+3]=w>>>24,b+4},a.prototype.writeInt32BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,2147483647,-2147483648),w<0&&(w=4294967295+w+1),this[b]=w>>>24,this[b+1]=w>>>16,this[b+2]=w>>>8,this[b+3]=w&255,b+4},a.prototype.writeBigInt64LE=Xt(function(w,b=0){return k(this,w,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=Xt(function(w,b=0){return W(this,w,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function K(C,w,b,D,V,X){if(b+D>C.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function re(C,w,b,D,V){return w=+w,b=b>>>0,V||K(C,w,b,4),r.write(C,w,b,D,23,4),b+4}a.prototype.writeFloatLE=function(w,b,D){return re(this,w,b,!0,D)},a.prototype.writeFloatBE=function(w,b,D){return re(this,w,b,!1,D)};function xe(C,w,b,D,V){return w=+w,b=b>>>0,V||K(C,w,b,8),r.write(C,w,b,D,52,8),b+8}a.prototype.writeDoubleLE=function(w,b,D){return xe(this,w,b,!0,D)},a.prototype.writeDoubleBE=function(w,b,D){return xe(this,w,b,!1,D)},a.prototype.copy=function(w,b,D,V){if(!a.isBuffer(w))throw new TypeError("argument should be a Buffer");if(D||(D=0),!V&&V!==0&&(V=this.length),b>=w.length&&(b=w.length),b||(b=0),V>0&&V=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),w.length-b>>0,D=D===void 0?this.length:D>>>0,w||(w=0);let X;if(typeof w=="number")for(X=b;X2**32?V=tt(String(b)):typeof b=="bigint"&&(V=String(b),(b>BigInt(2)**BigInt(32)||b<-(BigInt(2)**BigInt(32)))&&(V=tt(V)),V+="n"),D+=` It must be ${w}. Received ${V}`,D},RangeError);function tt(C){let w="",b=C.length;const D=C[0]==="-"?1:0;for(;b>=D+4;b-=3)w=`_${C.slice(b-3,b)}${w}`;return`${C.slice(0,b)}${w}`}function Ue(C,w,b){pe(w,"offset"),(C[w]===void 0||C[w+b]===void 0)&&we(w,C.length-(b+1))}function Pe(C,w,b,D,V,X){if(C>b||C3?w===0||w===BigInt(0)?Ze=`>= 0${ae} and < 2${ae} ** ${(X+1)*8}${ae}`:Ze=`>= -(2${ae} ** ${(X+1)*8-1}${ae}) and < 2 ** ${(X+1)*8-1}${ae}`:Ze=`>= ${w}${ae} and <= ${b}${ae}`,new be.ERR_OUT_OF_RANGE("value",Ze,C)}Ue(D,V,X)}function pe(C,w){if(typeof C!="number")throw new be.ERR_INVALID_ARG_TYPE(w,"number",C)}function we(C,w,b){throw Math.floor(C)!==C?(pe(C,b),new be.ERR_OUT_OF_RANGE(b||"offset","an integer",C)):w<0?new be.ERR_BUFFER_OUT_OF_BOUNDS:new be.ERR_OUT_OF_RANGE(b||"offset",`>= ${b?1:0} and <= ${w}`,C)}const ke=/[^+/0-9A-Za-z-_]/g;function vt(C){if(C=C.split("=")[0],C=C.trim().replace(ke,""),C.length<2)return"";for(;C.length%4!==0;)C=C+"=";return C}function He(C,w){w=w||1/0;let b;const D=C.length;let V=null;const X=[];for(let ae=0;ae55295&&b<57344){if(!V){if(b>56319){(w-=3)>-1&&X.push(239,191,189);continue}else if(ae+1===D){(w-=3)>-1&&X.push(239,191,189);continue}V=b;continue}if(b<56320){(w-=3)>-1&&X.push(239,191,189),V=b;continue}b=(V-55296<<10|b-56320)+65536}else V&&(w-=3)>-1&&X.push(239,191,189);if(V=null,b<128){if((w-=1)<0)break;X.push(b)}else if(b<2048){if((w-=2)<0)break;X.push(b>>6|192,b&63|128)}else if(b<65536){if((w-=3)<0)break;X.push(b>>12|224,b>>6&63|128,b&63|128)}else if(b<1114112){if((w-=4)<0)break;X.push(b>>18|240,b>>12&63|128,b>>6&63|128,b&63|128)}else throw new Error("Invalid code point")}return X}function it(C){const w=[];for(let b=0;b>8,V=b%256,X.push(V),X.push(D);return X}function ut(C){return t.toByteArray(vt(C))}function pt(C,w,b,D){let V;for(V=0;V=w.length||V>=C.length);++V)w[V+b]=C[V];return V}function Wt(C,w){return C instanceof w||C!=null&&C.constructor!=null&&C.constructor.name!=null&&C.constructor.name===w.name}function xt(C){return C!==C}const At=function(){const C="0123456789abcdef",w=new Array(256);for(let b=0;b<16;++b){const D=b*16;for(let V=0;V<16;++V)w[D+V]=C[b]+C[V]}return w}();function Xt(C){return typeof BigInt>"u"?Tt:C}function Tt(){throw new Error("BigInt not supported")}})(ie);var Dn={exports:{}},Bo=typeof Reflect=="object"?Reflect:null,Pp=Bo&&typeof Bo.apply=="function"?Bo.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},sf;Bo&&typeof Bo.ownKeys=="function"?sf=Bo.ownKeys:Object.getOwnPropertySymbols?sf=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:sf=function(t){return Object.getOwnPropertyNames(t)};function jE(e){console&&console.warn&&console.warn(e)}var Up=Number.isNaN||function(t){return t!==t};function Zt(){Zt.init.call(this)}Dn.exports=Zt,Dn.exports.once=WE,Zt.EventEmitter=Zt,Zt.prototype._events=void 0,Zt.prototype._eventsCount=0,Zt.prototype._maxListeners=void 0;var Fp=10;function of(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Zt,"defaultMaxListeners",{enumerable:!0,get:function(){return Fp},set:function(e){if(typeof e!="number"||e<0||Up(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Fp=e}}),Zt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Zt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Up(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Dp(e){return e._maxListeners===void 0?Zt.defaultMaxListeners:e._maxListeners}Zt.prototype.getMaxListeners=function(){return Dp(this)},Zt.prototype.emit=function(t){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[t];if(c===void 0)return!1;if(typeof c=="function")Pp(c,this,r);else for(var u=c.length,l=Vp(c,u),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,jE(a)}return e}Zt.prototype.addListener=function(t,r){return Hp(this,t,r,!1)},Zt.prototype.on=Zt.prototype.addListener,Zt.prototype.prependListener=function(t,r){return Hp(this,t,r,!0)};function zE(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function jp(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=zE.bind(n);return i.listener=r,n.wrapFn=i,i}Zt.prototype.once=function(t,r){return of(r),this.on(t,jp(this,t,r)),this},Zt.prototype.prependOnceListener=function(t,r){return of(r),this.prependListener(t,jp(this,t,r)),this},Zt.prototype.removeListener=function(t,r){var n,i,s,o,a;if(of(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():qE(n,s),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,a||r)}return this},Zt.prototype.off=Zt.prototype.removeListener,Zt.prototype.removeAllListeners=function(t){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(t,r[i]);return this};function zp(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?VE(i):Vp(i,i.length)}Zt.prototype.listeners=function(t){return zp(this,t,!0)},Zt.prototype.rawListeners=function(t){return zp(this,t,!1)},Zt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):qp.call(e,t)},Zt.prototype.listenerCount=qp;function qp(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Zt.prototype.eventNames=function(){return this._eventsCount>0?sf(this._events):[]};function Vp(e,t){for(var r=new Array(t),n=0;n{if(!t.has(e))throw TypeError("Cannot "+r)},af=(e,t,r)=>(Kp(e,t,"read from private field"),r?r.call(e):t.get(e)),Zp=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Gp=(e,t,r,n)=>(Kp(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),cf,Io;const Na={PROMISES:"PROMISES",CALLBACK:"CALLBACK"},Yp=class{constructor(e){Zp(this,cf,void 0),Zp(this,Io,void 0),this.setStrategy(e)}static isCallbackAdapterRequest(e){return e.id!==void 0}setHandler(e){return Gp(this,Io,e),this}request(e,t){if(!af(this,Io))throw new Error("No handler defined for Adapter");return Yp.isCallbackAdapterRequest(e)?af(this,Io).call(this,{network:t,id:e.id,name:e.method,params:e.params,object:e.params}):af(this,Io).call(this,{name:e.method,network:t,params:e.params,object:e.params})}setStrategy(e){return Gp(this,cf,e),this}getStrategy(){return af(this,cf)}};let Xp=Yp;cf=new WeakMap,Io=new WeakMap;var ZE=Object.defineProperty,GE=Object.defineProperties,YE=Object.getOwnPropertyDescriptors,Jp=Object.getOwnPropertySymbols,XE=Object.prototype.hasOwnProperty,JE=Object.prototype.propertyIsEnumerable,Qp=(e,t,r)=>t in e?ZE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,QE=(e,t)=>{for(var r in t||(t={}))XE.call(t,r)&&Qp(e,r,t[r]);if(Jp)for(var r of Jp(t))JE.call(t,r)&&Qp(e,r,t[r]);return e},ex=(e,t)=>GE(e,YE(t));class tx extends Xp{constructor(){super(Na.CALLBACK),this.callback=new Map}async request(t,r){return new Promise((n,i)=>{const s=new Date().getTime()+Math.floor(Math.random()*1e3);this.callback.set(s.toString(),{reject:i,resolve:n}),super.request(ex(QE({},t),{id:s}),r)})}sendResponse(t,r){if(this.callback.has(t.toString())){const n=this.callback.get(t.toString());this.callback.delete(t.toString()),n?.resolve(r)}else console.error(`Unable to find callback for requestId: ${t}`)}sendError(t,r){if(this.callback.has(t.toString())){const n=this.callback.get(t.toString());this.callback.delete(t.toString()),n?.reject(r)}else console.error(`Unable to find callback for requestId: ${t}`)}}class rx extends Xp{constructor(){super(Na.PROMISES)}request(t,r){return super.request(t,r)}}class Cl extends Dn.exports.EventEmitter{setAdapter(t){return this.adapter=t,this}async request(t){try{if(!this.adapter)throw new Error("No adapter set, maybe you forgot to register the provider?");const r=await this.adapter.request(t,this.getNetwork());return this.emit("onResponseReady",t,r),r}catch(r){throw r}}sendResponse(t,r){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==Na.CALLBACK)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendResponse(t,r)}sendError(t,r){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==Na.CALLBACK)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendError(t,r)}}var eg=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ro=(e,t,r)=>(eg(e,t,"read from private field"),r?r.call(e):t.get(e)),nx=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},ix=(e,t,r,n)=>(eg(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ci;class sx{constructor(t){nx(this,Ci,void 0);const r=t.strategy===Na.CALLBACK?new tx:new rx;t.handler&&r.setHandler(t.handler),this.setAdapter(r)}setHandler(t){Ro(this,Ci).setHandler(t)}setAdapter(t){return ix(this,Ci,t),this}registerProvider(t){return t.setAdapter(Ro(this,Ci)),this}registerProviders(t){return t.forEach(r=>this.registerProvider(r)),this}sendResponse(t,r){Ro(this,Ci).getStrategy()==="CALLBACK"&&Ro(this,Ci).sendResponse(t,r)}sendError(t,r){Ro(this,Ci).getStrategy()==="CALLBACK"&&Ro(this,Ci).sendError(t,r)}}Ci=new WeakMap;function tg(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function ox(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function ff(e,...t){if(!ox(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function ax(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");tg(e.outputLen),tg(e.blockLen)}function uf(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function cx(e,t){ff(e);const r=t.outputLen;if(e.lengthnew DataView(e.buffer,e.byteOffset,e.byteLength),gi=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];function rg(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Ol(e){return typeof e=="string"&&(e=rg(e)),ff(e),e}function ng(...e){let t=0;for(let n=0;ne().update(Ol(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function og(e=32){if(Ll&&typeof Ll.getRandomValues=="function")return Ll.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function fx(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,a,n)}const ux=(e,t,r)=>e&t^~e&r,lx=(e,t,r)=>e&t^e&r^t&r;class ag extends ig{constructor(t,r,n,i){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=$l(this.buffer)}update(t){uf(this);const{view:r,buffer:n,blockLen:i}=this;t=Ol(t);const s=t.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let y=o;yl.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;y>Ml&lf)}:{h:Number(e>>Ml&lf)|0,l:Number(e&lf)|0}}function hx(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0),px=(e,t,r)=>e>>>r,gx=(e,t,r)=>e<<32-r|t>>>r,yx=(e,t,r)=>e>>>r|t<<32-r,wx=(e,t,r)=>e<<32-r|t>>>r,mx=(e,t,r)=>e<<64-r|t>>>r-32,bx=(e,t,r)=>e>>>r-32|t<<64-r,vx=(e,t)=>t,_x=(e,t)=>e,Ex=(e,t,r)=>e<>>32-r,xx=(e,t,r)=>t<>>32-r,Sx=(e,t,r)=>t<>>64-r,Ax=(e,t,r)=>e<>>64-r;function Bx(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const mt={fromBig:cg,split:hx,toBig:dx,shrSH:px,shrSL:gx,rotrSH:yx,rotrSL:wx,rotrBH:mx,rotrBL:bx,rotr32H:vx,rotr32L:_x,rotlSH:Ex,rotlSL:xx,rotlBH:Sx,rotlBL:Ax,add:Bx,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},[Ix,Rx]=(()=>mt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),ts=new Uint32Array(80),rs=new Uint32Array(80);class Tx extends ag{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:y,Fl:A,Gh:v,Gl:R,Hh:O,Hl:P}=this;return[t,r,n,i,s,o,a,c,u,l,y,A,v,R,O,P]}set(t,r,n,i,s,o,a,c,u,l,y,A,v,R,O,P){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=y|0,this.Fl=A|0,this.Gh=v|0,this.Gl=R|0,this.Hh=O|0,this.Hl=P|0}process(t,r){for(let N=0;N<16;N++,r+=4)ts[N]=t.getUint32(r),rs[N]=t.getUint32(r+=4);for(let N=16;N<80;N++){const $=ts[N-15]|0,q=rs[N-15]|0,G=mt.rotrSH($,q,1)^mt.rotrSH($,q,8)^mt.shrSH($,q,7),Z=mt.rotrSL($,q,1)^mt.rotrSL($,q,8)^mt.shrSL($,q,7),z=ts[N-2]|0,ee=rs[N-2]|0,se=mt.rotrSH(z,ee,19)^mt.rotrBH(z,ee,61)^mt.shrSH(z,ee,6),Q=mt.rotrSL(z,ee,19)^mt.rotrBL(z,ee,61)^mt.shrSL(z,ee,6),I=mt.add4L(Z,Q,rs[N-7],rs[N-16]),g=mt.add4H(I,G,se,ts[N-7],ts[N-16]);ts[N]=g|0,rs[N]=I|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:y,El:A,Fh:v,Fl:R,Gh:O,Gl:P,Hh:H,Hl:F}=this;for(let N=0;N<80;N++){const $=mt.rotrSH(y,A,14)^mt.rotrSH(y,A,18)^mt.rotrBH(y,A,41),q=mt.rotrSL(y,A,14)^mt.rotrSL(y,A,18)^mt.rotrBL(y,A,41),G=y&v^~y&O,Z=A&R^~A&P,z=mt.add5L(F,q,Z,Rx[N],rs[N]),ee=mt.add5H(z,H,$,G,Ix[N],ts[N]),se=z|0,Q=mt.rotrSH(n,i,28)^mt.rotrBH(n,i,34)^mt.rotrBH(n,i,39),I=mt.rotrSL(n,i,28)^mt.rotrBL(n,i,34)^mt.rotrBL(n,i,39),g=n&s^n&a^s&a,f=i&o^i&c^o&c;H=O|0,F=P|0,O=v|0,P=R|0,v=y|0,R=A|0,{h:y,l:A}=mt.add(u|0,l|0,ee|0,se|0),u=a|0,l=c|0,a=s|0,c=o|0,s=n|0,o=i|0;const h=mt.add3L(se,I,f);n=mt.add3H(h,ee,Q,g),i=h|0}({h:n,l:i}=mt.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=mt.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=mt.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=mt.add(this.Dh|0,this.Dl|0,u|0,l|0),{h:y,l:A}=mt.add(this.Eh|0,this.El|0,y|0,A|0),{h:v,l:R}=mt.add(this.Fh|0,this.Fl|0,v|0,R|0),{h:O,l:P}=mt.add(this.Gh|0,this.Gl|0,O|0,P|0),{h:H,l:F}=mt.add(this.Hh|0,this.Hl|0,H|0,F|0),this.set(n,i,s,o,a,c,u,l,y,A,v,R,O,P,H,F)}roundClean(){ts.fill(0),rs.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const fg=sg(()=>new Tx);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ug=BigInt(0),hf=BigInt(1),kx=BigInt(2);function Hs(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Pa(e){if(!Hs(e))throw new Error("Uint8Array expected")}const Cx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function js(e){Pa(e);let t="";for(let r=0;r=Li._0&&e<=Li._9)return e-Li._0;if(e>=Li._A&&e<=Li._F)return e-(Li._A-10);if(e>=Li._a&&e<=Li._f)return e-(Li._a-10)}function To(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let i=0,s=0;iug;e>>=hf,t+=1);return t}function Nx(e,t){return e>>BigInt(t)&hf}function Px(e,t,r){return e|(r?hf:ug)<(kx<new Uint8Array(e),dg=e=>Uint8Array.from(e);function pg(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Ul(e),i=Ul(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Ul())=>{i=a(dg([0]),y),n=a(),y.length!==0&&(i=a(dg([1]),y),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const A=[];for(;y{o(),c(y);let v;for(;!(v=A(u()));)c();return o(),v}}const Ux={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Hs(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function Lo(e,t,r={}){const n=(i,s,o)=>{const a=Ux[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(t))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return e}var Fx=Object.freeze({__proto__:null,isBytes:Hs,abytes:Pa,bytesToHex:js,numberToHexUnpadded:lg,hexToNumber:Nl,hexToBytes:To,bytesToNumberBE:zs,bytesToNumberLE:ko,numberToBytesBE:Co,numberToBytesLE:Ua,numberToVarBytesBE:Lx,ensureBytes:Cr,concatBytes:qs,equalBytes:$x,utf8ToBytes:Ox,bitLen:Mx,bitGet:Nx,bitSet:Px,bitMask:Pl,createHmacDrbg:pg,validateObject:Lo});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fr=BigInt(0),hr=BigInt(1),Vs=BigInt(2),Dx=BigInt(3),Fl=BigInt(4),gg=BigInt(5),yg=BigInt(8);BigInt(9),BigInt(16);function ir(e,t){const r=e%t;return r>=Fr?r:t+r}function Hx(e,t,r){if(r<=Fr||t 0");if(r===hr)return Fr;let n=hr;for(;t>Fr;)t&hr&&(n=n*e%r),e=e*e%r,t>>=hr;return n}function wr(e,t,r){let n=e;for(;t-- >Fr;)n*=n,n%=r;return n}function Dl(e,t){if(e===Fr||t<=Fr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=ir(e,t),n=t,i=Fr,s=hr;for(;r!==Fr;){const a=n/r,c=n%r,u=i-s*a;n=r,r=c,i=s,s=u}if(n!==hr)throw new Error("invert: does not exist");return ir(i,t)}function jx(e){const t=(e-hr)/Vs;let r,n,i;for(r=e-hr,n=0;r%Vs===Fr;r/=Vs,n++);for(i=Vs;i(ir(e,t)&hr)===hr,Vx=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Wx(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=Vx.reduce((n,i)=>(n[i]="function",n),t);return Lo(e,r)}function Kx(e,t,r){if(r 0");if(r===Fr)return e.ONE;if(r===hr)return t;let n=e.ONE,i=t;for(;r>Fr;)r&hr&&(n=e.mul(n,i)),i=e.sqr(i),r>>=hr;return n}function Zx(e,t){const r=new Array(t.length),n=t.reduce((s,o,a)=>e.is0(o)?s:(r[a]=s,e.mul(s,o)),e.ONE),i=e.inv(n);return t.reduceRight((s,o,a)=>e.is0(o)?s:(r[a]=e.mul(s,r[a]),e.mul(s,o)),i),r}function wg(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function mg(e,t,r=!1,n={}){if(e<=Fr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=wg(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=zx(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:s,MASK:Pl(i),ZERO:Fr,ONE:hr,create:c=>ir(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Fr<=c&&cc===Fr,isOdd:c=>(c&hr)===hr,neg:c=>ir(-c,e),eql:(c,u)=>c===u,sqr:c=>ir(c*c,e),add:(c,u)=>ir(c+u,e),sub:(c,u)=>ir(c-u,e),mul:(c,u)=>ir(c*u,e),pow:(c,u)=>Kx(a,c,u),div:(c,u)=>ir(c*Dl(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Dl(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>Zx(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?Ua(c,s):Co(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?ko(c):zs(c)}});return Object.freeze(a)}function Gx(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}function bg(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function vg(e){const t=bg(e);return t+Math.ceil(t/2)}function Yx(e,t,r=!1){const n=e.length,i=bg(t),s=vg(t);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?zs(e):ko(e),a=ir(o,t-hr)+hr;return r?Ua(a,i):Co(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xx=BigInt(0),Hl=BigInt(1);function _g(e,t){const r=(i,s)=>{const o=s.negate();return i?o:s},n=i=>{const s=Math.ceil(t/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=e.ZERO,a=i;for(;s>Xx;)s&Hl&&(o=o.add(a)),a=a.double(),s>>=Hl;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=n(s),c=[];let u=i,l=u;for(let y=0;y>=v,P>c&&(P-=A,o+=Hl);const H=O,F=O+Math.abs(P)-1,N=R%2!==0,$=P<0;P===0?l=l.add(r(N,s[H])):u=u.add(r($,s[F]))}return{p:u,f:l}},wNAFCached(i,s,o,a){const c=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&s.set(i,a(u))),this.wNAF(c,u,o)}}}function jl(e){return Wx(e.Fp),Lo(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...wg(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ri=BigInt(0),An=BigInt(1),df=BigInt(2),Jx=BigInt(8),Qx={zip215:!0};function eS(e){const t=jl(e);return Lo(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function zl(e){const t=eS(e),{Fp:r,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=t,u=df<{try{return{isValid:!0,value:r.sqrt(E*r.inv(x))}}catch{return{isValid:!1,value:ri}}}),A=t.adjustScalarBytes||(E=>E),v=t.domain||((E,x,T)=>{if(x.length||T)throw new Error("Contexts/pre-hash are not supported");return E}),R=E=>typeof E=="bigint"&&riR(E)&&R(x)&&EE===ri||O(E,u);function H(E,x){if(O(E,x))return E;throw new Error(`Expected valid scalar < ${x}, got ${typeof E} ${E}`)}function F(E){return E===ri?E:H(E,n)}const N=new Map;function $(E){if(!(E instanceof q))throw new Error("ExtendedPoint expected")}class q{constructor(x,T,B,d){if(this.ex=x,this.ey=T,this.ez=B,this.et=d,!P(x))throw new Error("x required");if(!P(T))throw new Error("y required");if(!P(B))throw new Error("z required");if(!P(d))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(x){if(x instanceof q)throw new Error("extended point not allowed");const{x:T,y:B}=x||{};if(!P(T)||!P(B))throw new Error("invalid affine point");return new q(T,B,An,l(T*B))}static normalizeZ(x){const T=r.invertBatch(x.map(B=>B.ez));return x.map((B,d)=>B.toAffine(T[d])).map(q.fromAffine)}_setWindowSize(x){this._WINDOW_SIZE=x,N.delete(this)}assertValidity(){const{a:x,d:T}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:B,ey:d,ez:k,et:W}=this,K=l(B*B),re=l(d*d),xe=l(k*k),be=l(xe*xe),ge=l(K*x),tt=l(xe*l(ge+re)),Ue=l(be+l(T*l(K*re)));if(tt!==Ue)throw new Error("bad point: equation left != right (1)");const Pe=l(B*d),pe=l(k*W);if(Pe!==pe)throw new Error("bad point: equation left != right (2)")}equals(x){$(x);const{ex:T,ey:B,ez:d}=this,{ex:k,ey:W,ez:K}=x,re=l(T*K),xe=l(k*d),be=l(B*K),ge=l(W*d);return re===xe&&be===ge}is0(){return this.equals(q.ZERO)}negate(){return new q(l(-this.ex),this.ey,this.ez,l(-this.et))}double(){const{a:x}=t,{ex:T,ey:B,ez:d}=this,k=l(T*T),W=l(B*B),K=l(df*l(d*d)),re=l(x*k),xe=T+B,be=l(l(xe*xe)-k-W),ge=re+W,tt=ge-K,Ue=re-W,Pe=l(be*tt),pe=l(ge*Ue),we=l(be*Ue),ke=l(tt*ge);return new q(Pe,pe,ke,we)}add(x){$(x);const{a:T,d:B}=t,{ex:d,ey:k,ez:W,et:K}=this,{ex:re,ey:xe,ez:be,et:ge}=x;if(T===BigInt(-1)){const Wt=l((k-d)*(xe+re)),xt=l((k+d)*(xe-re)),At=l(xt-Wt);if(At===ri)return this.double();const Xt=l(W*df*ge),Tt=l(K*df*be),C=Tt+Xt,w=xt+Wt,b=Tt-Xt,D=l(C*At),V=l(w*b),X=l(C*b),ae=l(At*w);return new q(D,V,ae,X)}const tt=l(d*re),Ue=l(k*xe),Pe=l(K*B*ge),pe=l(W*be),we=l((d+k)*(re+xe)-tt-Ue),ke=pe-Pe,vt=pe+Pe,He=l(Ue-T*tt),it=l(we*ke),Ht=l(vt*He),ut=l(we*He),pt=l(ke*vt);return new q(it,Ht,pt,ut)}subtract(x){return this.add(x.negate())}wNAF(x){return z.wNAFCached(this,N,x,q.normalizeZ)}multiply(x){const{p:T,f:B}=this.wNAF(H(x,n));return q.normalizeZ([T,B])[0]}multiplyUnsafe(x){let T=F(x);return T===ri?Z:this.equals(Z)||T===An?this:this.equals(G)?this.wNAF(T).p:z.unsafeLadder(this,T)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return z.unsafeLadder(this,n).is0()}toAffine(x){const{ex:T,ey:B,ez:d}=this,k=this.is0();x==null&&(x=k?Jx:r.inv(d));const W=l(T*x),K=l(B*x),re=l(d*x);if(k)return{x:ri,y:An};if(re!==An)throw new Error("invZ was invalid");return{x:W,y:K}}clearCofactor(){const{h:x}=t;return x===An?this:this.multiplyUnsafe(x)}static fromHex(x,T=!1){const{d:B,a:d}=t,k=r.BYTES;x=Cr("pointHex",x,k);const W=x.slice(),K=x[k-1];W[k-1]=K&-129;const re=ko(W);re===ri||(T?H(re,u):H(re,r.ORDER));const xe=l(re*re),be=l(xe-An),ge=l(B*xe-d);let{isValid:tt,value:Ue}=y(be,ge);if(!tt)throw new Error("Point.fromHex: invalid y coordinate");const Pe=(Ue&An)===An,pe=(K&128)!==0;if(!T&&Ue===ri&&pe)throw new Error("Point.fromHex: x=0 and x_0=1");return pe!==Pe&&(Ue=l(-Ue)),q.fromAffine({x:Ue,y:re})}static fromPrivateKey(x){return Q(x).point}toRawBytes(){const{x,y:T}=this.toAffine(),B=Ua(T,r.BYTES);return B[B.length-1]|=x&An?128:0,B}toHex(){return js(this.toRawBytes())}}q.BASE=new q(t.Gx,t.Gy,An,l(t.Gx*t.Gy)),q.ZERO=new q(ri,An,An,ri);const{BASE:G,ZERO:Z}=q,z=_g(q,a*8);function ee(E){return ir(E,n)}function se(E){return ee(ko(E))}function Q(E){const x=a;E=Cr("private key",E,x);const T=Cr("hashed private key",s(E),2*x),B=A(T.slice(0,x)),d=T.slice(x,2*x),k=se(B),W=G.multiply(k),K=W.toRawBytes();return{head:B,prefix:d,scalar:k,point:W,pointBytes:K}}function I(E){return Q(E).pointBytes}function g(E=new Uint8Array,...x){const T=qs(...x);return se(s(v(T,Cr("context",E),!!i)))}function f(E,x,T={}){E=Cr("message",E),i&&(E=i(E));const{prefix:B,scalar:d,pointBytes:k}=Q(x),W=g(T.context,B,E),K=G.multiply(W).toRawBytes(),re=g(T.context,K,k,E),xe=ee(W+re*d);F(xe);const be=qs(K,Ua(xe,r.BYTES));return Cr("result",be,a*2)}const h=Qx;function m(E,x,T,B=h){const{context:d,zip215:k}=B,W=r.BYTES;E=Cr("signature",E,2*W),x=Cr("message",x),i&&(x=i(x));const K=ko(E.slice(W,2*W));let re,xe,be;try{re=q.fromHex(T,k),xe=q.fromHex(E.slice(0,W),k),be=G.multiplyUnsafe(K)}catch{return!1}if(!k&&re.isSmallOrder())return!1;const ge=g(d,xe.toRawBytes(),re.toRawBytes(),x);return xe.add(re.multiplyUnsafe(ge)).subtract(be).clearCofactor().equals(q.ZERO)}return G._setWindowSize(8),{CURVE:t,getPublicKey:I,sign:f,verify:m,ExtendedPoint:q,utils:{getExtendedPublicKey:Q,randomPrivateKey:()=>o(r.BYTES),precompute(E=8,x=q.BASE){return x._setWindowSize(E),x.multiply(BigInt(3)),x}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0),BigInt(1);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ql=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Eg=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const tS=BigInt(1),Vl=BigInt(2),rS=BigInt(5),xg=BigInt(10),nS=BigInt(20),iS=BigInt(40),Sg=BigInt(80);function sS(e){const t=ql,n=e*e%t*e%t,i=wr(n,Vl,t)*n%t,s=wr(i,tS,t)*e%t,o=wr(s,rS,t)*s%t,a=wr(o,xg,t)*o%t,c=wr(a,nS,t)*a%t,u=wr(c,iS,t)*c%t,l=wr(u,Sg,t)*u%t,y=wr(l,Sg,t)*u%t,A=wr(y,xg,t)*o%t;return{pow_p_5_8:wr(A,Vl,t)*e%t,b2:n}}function oS(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function aS(e,t){const r=ql,n=ir(t*t*t,r),i=ir(n*n*t,r),s=sS(e*i).pow_p_5_8;let o=ir(e*n*s,r);const a=ir(t*o*o,r),c=o,u=ir(o*Eg,r),l=a===e,y=a===ir(-e,r),A=a===ir(-e*Eg,r);return l&&(o=c),(y||A)&&(o=u),qx(o,r)&&(o=ir(-o,r)),{isValid:l||y,value:o}}const $i=mg(ql,void 0,!0),Wl={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:$i,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:fg,randomBytes:og,adjustScalarBytes:oS,uvRatio:aS},pf=zl(Wl);function Ag(e,t,r){if(t.length>255)throw new Error("Context is too big");return ng(rg("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}({...Wl},{...Wl});const cS=($i.ORDER+BigInt(3))/BigInt(8);$i.pow(Vl,cS),$i.sqrt($i.neg($i.ONE)),($i.ORDER-BigInt(5))/BigInt(8),BigInt(486662),Gx($i,$i.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Kl={exports:{}},fS={},uS=Object.freeze({__proto__:null,default:fS}),Bg=Un(uS);(function(e){(function(t,r){function n(g,f){if(!g)throw new Error(f||"Assertion failed")}function i(g,f){g.super_=f;var h=function(){};h.prototype=f.prototype,g.prototype=new h,g.prototype.constructor=g}function s(g,f,h){if(s.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((f==="le"||f==="be")&&(h=f,f=10),this._init(g||0,f||10,h||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=Bg.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,h){return f.cmp(h)>0?f:h},s.min=function(f,h){return f.cmp(h)<0?f:h},s.prototype._init=function(f,h,m){if(typeof f=="number")return this._initNumber(f,h,m);if(typeof f=="object")return this._initArray(f,h,m);h==="hex"&&(h=16),n(h===(h|0)&&h>=2&&h<=36),f=f.toString().replace(/\s+/g,"");var _=0;f[0]==="-"&&(_++,this.negative=1),_=0;_-=3)x=f[_]|f[_-1]<<8|f[_-2]<<16,this.words[E]|=x<>>26-T&67108863,T+=24,T>=26&&(T-=26,E++);else if(m==="le")for(_=0,E=0;_>>26-T&67108863,T+=24,T>=26&&(T-=26,E++);return this._strip()};function a(g,f){var h=g.charCodeAt(f);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+g)}function c(g,f,h){var m=a(g,h);return h-1>=f&&(m|=a(g,h-1)<<4),m}s.prototype._parseHex=function(f,h,m){this.length=Math.ceil((f.length-h)/6),this.words=new Array(this.length);for(var _=0;_=h;_-=2)T=c(f,h,_)<=18?(E-=18,x+=1,this.words[x]|=T>>>26):E+=8;else{var B=f.length-h;for(_=B%2===0?h+1:h;_=18?(E-=18,x+=1,this.words[x]|=T>>>26):E+=8}this._strip()};function u(g,f,h,m){for(var _=0,E=0,x=Math.min(g.length,h),T=f;T=49?E=B-49+10:B>=17?E=B-17+10:E=B,n(B>=0&&E1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=y}catch{s.prototype.inspect=y}else s.prototype.inspect=y;function y(){return(this.red?""}var A=["","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"],v=[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],R=[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];s.prototype.toString=function(f,h){f=f||10,h=h|0||1;var m;if(f===16||f==="hex"){m="";for(var _=0,E=0,x=0;x>>24-_&16777215,_+=2,_>=26&&(_-=26,x--),E!==0||x!==this.length-1?m=A[6-B.length]+B+m:m=B+m}for(E!==0&&(m=E.toString(16)+m);m.length%h!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(f===(f|0)&&f>=2&&f<=36){var d=v[f],k=R[f];m="";var W=this.clone();for(W.negative=0;!W.isZero();){var K=W.modrn(k).toString(f);W=W.idivn(k),W.isZero()?m=K+m:m=A[d-K.length]+K+m}for(this.isZero()&&(m="0"+m);m.length%h!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,h){return this.toArrayLike(o,f,h)}),s.prototype.toArray=function(f,h){return this.toArrayLike(Array,f,h)};var O=function(f,h){return f.allocUnsafe?f.allocUnsafe(h):new f(h)};s.prototype.toArrayLike=function(f,h,m){this._strip();var _=this.byteLength(),E=m||Math.max(1,_);n(_<=E,"byte array longer than desired length"),n(E>0,"Requested array length <= 0");var x=O(f,E),T=h==="le"?"LE":"BE";return this["_toArrayLike"+T](x,_),x},s.prototype._toArrayLikeLE=function(f,h){for(var m=0,_=0,E=0,x=0;E>8&255),m>16&255),x===6?(m>24&255),_=0,x=0):(_=T>>>24,x+=2)}if(m=0&&(f[m--]=T>>8&255),m>=0&&(f[m--]=T>>16&255),x===6?(m>=0&&(f[m--]=T>>24&255),_=0,x=0):(_=T>>>24,x+=2)}if(m>=0)for(f[m--]=_;m>=0;)f[m--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var h=f,m=0;return h>=4096&&(m+=13,h>>>=13),h>=64&&(m+=7,h>>>=7),h>=8&&(m+=4,h>>>=4),h>=2&&(m+=2,h>>>=2),m+h},s.prototype._zeroBits=function(f){if(f===0)return 26;var h=f,m=0;return h&8191||(m+=13,h>>>=13),h&127||(m+=7,h>>>=7),h&15||(m+=4,h>>>=4),h&3||(m+=2,h>>>=2),h&1||m++,m},s.prototype.bitLength=function(){var f=this.words[this.length-1],h=this._countBits(f);return(this.length-1)*26+h};function P(g){for(var f=new Array(g.bitLength()),h=0;h>>_&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,h=0;hf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var h;this.length>f.length?h=f:h=this;for(var m=0;mf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var h,m;this.length>f.length?(h=this,m=f):(h=f,m=this);for(var _=0;_f.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var h=Math.ceil(f/26)|0,m=f%26;this._expand(h),m>0&&h--;for(var _=0;_0&&(this.words[_]=~this.words[_]&67108863>>26-m),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,h){n(typeof f=="number"&&f>=0);var m=f/26|0,_=f%26;return this._expand(m+1),h?this.words[m]=this.words[m]|1<<_:this.words[m]=this.words[m]&~(1<<_),this._strip()},s.prototype.iadd=function(f){var h;if(this.negative!==0&&f.negative===0)return this.negative=0,h=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,h=this.isub(f),f.negative=1,h._normSign();var m,_;this.length>f.length?(m=this,_=f):(m=f,_=this);for(var E=0,x=0;x<_.length;x++)h=(m.words[x]|0)+(_.words[x]|0)+E,this.words[x]=h&67108863,E=h>>>26;for(;E!==0&&x>>26;if(this.length=m.length,E!==0)this.words[this.length]=E,this.length++;else if(m!==this)for(;xf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var h=this.iadd(f);return f.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var m=this.cmp(f);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _,E;m>0?(_=this,E=f):(_=f,E=this);for(var x=0,T=0;T>26,this.words[T]=h&67108863;for(;x!==0&&T<_.length;T++)h=(_.words[T]|0)+x,x=h>>26,this.words[T]=h&67108863;if(x===0&&T<_.length&&_!==this)for(;T<_.length;T++)this.words[T]=_.words[T];return this.length=Math.max(this.length,T),_!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(f){return this.clone().isub(f)};function H(g,f,h){h.negative=f.negative^g.negative;var m=g.length+f.length|0;h.length=m,m=m-1|0;var _=g.words[0]|0,E=f.words[0]|0,x=_*E,T=x&67108863,B=x/67108864|0;h.words[0]=T;for(var d=1;d>>26,W=B&67108863,K=Math.min(d,f.length-1),re=Math.max(0,d-g.length+1);re<=K;re++){var xe=d-re|0;_=g.words[xe]|0,E=f.words[re]|0,x=_*E+W,k+=x/67108864|0,W=x&67108863}h.words[d]=W|0,B=k|0}return B!==0?h.words[d]=B|0:h.length--,h._strip()}var F=function(f,h,m){var _=f.words,E=h.words,x=m.words,T=0,B,d,k,W=_[0]|0,K=W&8191,re=W>>>13,xe=_[1]|0,be=xe&8191,ge=xe>>>13,tt=_[2]|0,Ue=tt&8191,Pe=tt>>>13,pe=_[3]|0,we=pe&8191,ke=pe>>>13,vt=_[4]|0,He=vt&8191,it=vt>>>13,Ht=_[5]|0,ut=Ht&8191,pt=Ht>>>13,Wt=_[6]|0,xt=Wt&8191,At=Wt>>>13,Xt=_[7]|0,Tt=Xt&8191,C=Xt>>>13,w=_[8]|0,b=w&8191,D=w>>>13,V=_[9]|0,X=V&8191,ae=V>>>13,Ze=E[0]|0,Ge=Ze&8191,We=Ze>>>13,jt=E[1]|0,ze=jt&8191,rr=jt>>>13,Ma=E[2]|0,yr=Ma&8191,vr=Ma>>>13,Rl=E[3]|0,zt=Rl&8191,Yt=Rl>>>13,es=E[4]|0,ur=es&8191,lr=es>>>13,tf=E[5]|0,_r=tf&8191,kt=tf>>>13,rf=E[6]|0,S=rf&8191,L=rf>>>13,M=E[7]|0,p=M&8191,U=M>>>13,J=E[8]|0,Y=J&8191,ue=J>>>13,_e=E[9]|0,Ae=_e&8191,Ee=_e>>>13;m.negative=f.negative^h.negative,m.length=19,B=Math.imul(K,Ge),d=Math.imul(K,We),d=d+Math.imul(re,Ge)|0,k=Math.imul(re,We);var Bt=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,B=Math.imul(be,Ge),d=Math.imul(be,We),d=d+Math.imul(ge,Ge)|0,k=Math.imul(ge,We),B=B+Math.imul(K,ze)|0,d=d+Math.imul(K,rr)|0,d=d+Math.imul(re,ze)|0,k=k+Math.imul(re,rr)|0;var Le=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,B=Math.imul(Ue,Ge),d=Math.imul(Ue,We),d=d+Math.imul(Pe,Ge)|0,k=Math.imul(Pe,We),B=B+Math.imul(be,ze)|0,d=d+Math.imul(be,rr)|0,d=d+Math.imul(ge,ze)|0,k=k+Math.imul(ge,rr)|0,B=B+Math.imul(K,yr)|0,d=d+Math.imul(K,vr)|0,d=d+Math.imul(re,yr)|0,k=k+Math.imul(re,vr)|0;var Ke=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,B=Math.imul(we,Ge),d=Math.imul(we,We),d=d+Math.imul(ke,Ge)|0,k=Math.imul(ke,We),B=B+Math.imul(Ue,ze)|0,d=d+Math.imul(Ue,rr)|0,d=d+Math.imul(Pe,ze)|0,k=k+Math.imul(Pe,rr)|0,B=B+Math.imul(be,yr)|0,d=d+Math.imul(be,vr)|0,d=d+Math.imul(ge,yr)|0,k=k+Math.imul(ge,vr)|0,B=B+Math.imul(K,zt)|0,d=d+Math.imul(K,Yt)|0,d=d+Math.imul(re,zt)|0,k=k+Math.imul(re,Yt)|0;var Ye=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,B=Math.imul(He,Ge),d=Math.imul(He,We),d=d+Math.imul(it,Ge)|0,k=Math.imul(it,We),B=B+Math.imul(we,ze)|0,d=d+Math.imul(we,rr)|0,d=d+Math.imul(ke,ze)|0,k=k+Math.imul(ke,rr)|0,B=B+Math.imul(Ue,yr)|0,d=d+Math.imul(Ue,vr)|0,d=d+Math.imul(Pe,yr)|0,k=k+Math.imul(Pe,vr)|0,B=B+Math.imul(be,zt)|0,d=d+Math.imul(be,Yt)|0,d=d+Math.imul(ge,zt)|0,k=k+Math.imul(ge,Yt)|0,B=B+Math.imul(K,ur)|0,d=d+Math.imul(K,lr)|0,d=d+Math.imul(re,ur)|0,k=k+Math.imul(re,lr)|0;var lt=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(lt>>>26)|0,lt&=67108863,B=Math.imul(ut,Ge),d=Math.imul(ut,We),d=d+Math.imul(pt,Ge)|0,k=Math.imul(pt,We),B=B+Math.imul(He,ze)|0,d=d+Math.imul(He,rr)|0,d=d+Math.imul(it,ze)|0,k=k+Math.imul(it,rr)|0,B=B+Math.imul(we,yr)|0,d=d+Math.imul(we,vr)|0,d=d+Math.imul(ke,yr)|0,k=k+Math.imul(ke,vr)|0,B=B+Math.imul(Ue,zt)|0,d=d+Math.imul(Ue,Yt)|0,d=d+Math.imul(Pe,zt)|0,k=k+Math.imul(Pe,Yt)|0,B=B+Math.imul(be,ur)|0,d=d+Math.imul(be,lr)|0,d=d+Math.imul(ge,ur)|0,k=k+Math.imul(ge,lr)|0,B=B+Math.imul(K,_r)|0,d=d+Math.imul(K,kt)|0,d=d+Math.imul(re,_r)|0,k=k+Math.imul(re,kt)|0;var ct=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(ct>>>26)|0,ct&=67108863,B=Math.imul(xt,Ge),d=Math.imul(xt,We),d=d+Math.imul(At,Ge)|0,k=Math.imul(At,We),B=B+Math.imul(ut,ze)|0,d=d+Math.imul(ut,rr)|0,d=d+Math.imul(pt,ze)|0,k=k+Math.imul(pt,rr)|0,B=B+Math.imul(He,yr)|0,d=d+Math.imul(He,vr)|0,d=d+Math.imul(it,yr)|0,k=k+Math.imul(it,vr)|0,B=B+Math.imul(we,zt)|0,d=d+Math.imul(we,Yt)|0,d=d+Math.imul(ke,zt)|0,k=k+Math.imul(ke,Yt)|0,B=B+Math.imul(Ue,ur)|0,d=d+Math.imul(Ue,lr)|0,d=d+Math.imul(Pe,ur)|0,k=k+Math.imul(Pe,lr)|0,B=B+Math.imul(be,_r)|0,d=d+Math.imul(be,kt)|0,d=d+Math.imul(ge,_r)|0,k=k+Math.imul(ge,kt)|0,B=B+Math.imul(K,S)|0,d=d+Math.imul(K,L)|0,d=d+Math.imul(re,S)|0,k=k+Math.imul(re,L)|0;var Xe=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,B=Math.imul(Tt,Ge),d=Math.imul(Tt,We),d=d+Math.imul(C,Ge)|0,k=Math.imul(C,We),B=B+Math.imul(xt,ze)|0,d=d+Math.imul(xt,rr)|0,d=d+Math.imul(At,ze)|0,k=k+Math.imul(At,rr)|0,B=B+Math.imul(ut,yr)|0,d=d+Math.imul(ut,vr)|0,d=d+Math.imul(pt,yr)|0,k=k+Math.imul(pt,vr)|0,B=B+Math.imul(He,zt)|0,d=d+Math.imul(He,Yt)|0,d=d+Math.imul(it,zt)|0,k=k+Math.imul(it,Yt)|0,B=B+Math.imul(we,ur)|0,d=d+Math.imul(we,lr)|0,d=d+Math.imul(ke,ur)|0,k=k+Math.imul(ke,lr)|0,B=B+Math.imul(Ue,_r)|0,d=d+Math.imul(Ue,kt)|0,d=d+Math.imul(Pe,_r)|0,k=k+Math.imul(Pe,kt)|0,B=B+Math.imul(be,S)|0,d=d+Math.imul(be,L)|0,d=d+Math.imul(ge,S)|0,k=k+Math.imul(ge,L)|0,B=B+Math.imul(K,p)|0,d=d+Math.imul(K,U)|0,d=d+Math.imul(re,p)|0,k=k+Math.imul(re,U)|0;var rt=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(rt>>>26)|0,rt&=67108863,B=Math.imul(b,Ge),d=Math.imul(b,We),d=d+Math.imul(D,Ge)|0,k=Math.imul(D,We),B=B+Math.imul(Tt,ze)|0,d=d+Math.imul(Tt,rr)|0,d=d+Math.imul(C,ze)|0,k=k+Math.imul(C,rr)|0,B=B+Math.imul(xt,yr)|0,d=d+Math.imul(xt,vr)|0,d=d+Math.imul(At,yr)|0,k=k+Math.imul(At,vr)|0,B=B+Math.imul(ut,zt)|0,d=d+Math.imul(ut,Yt)|0,d=d+Math.imul(pt,zt)|0,k=k+Math.imul(pt,Yt)|0,B=B+Math.imul(He,ur)|0,d=d+Math.imul(He,lr)|0,d=d+Math.imul(it,ur)|0,k=k+Math.imul(it,lr)|0,B=B+Math.imul(we,_r)|0,d=d+Math.imul(we,kt)|0,d=d+Math.imul(ke,_r)|0,k=k+Math.imul(ke,kt)|0,B=B+Math.imul(Ue,S)|0,d=d+Math.imul(Ue,L)|0,d=d+Math.imul(Pe,S)|0,k=k+Math.imul(Pe,L)|0,B=B+Math.imul(be,p)|0,d=d+Math.imul(be,U)|0,d=d+Math.imul(ge,p)|0,k=k+Math.imul(ge,U)|0,B=B+Math.imul(K,Y)|0,d=d+Math.imul(K,ue)|0,d=d+Math.imul(re,Y)|0,k=k+Math.imul(re,ue)|0;var Je=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Je>>>26)|0,Je&=67108863,B=Math.imul(X,Ge),d=Math.imul(X,We),d=d+Math.imul(ae,Ge)|0,k=Math.imul(ae,We),B=B+Math.imul(b,ze)|0,d=d+Math.imul(b,rr)|0,d=d+Math.imul(D,ze)|0,k=k+Math.imul(D,rr)|0,B=B+Math.imul(Tt,yr)|0,d=d+Math.imul(Tt,vr)|0,d=d+Math.imul(C,yr)|0,k=k+Math.imul(C,vr)|0,B=B+Math.imul(xt,zt)|0,d=d+Math.imul(xt,Yt)|0,d=d+Math.imul(At,zt)|0,k=k+Math.imul(At,Yt)|0,B=B+Math.imul(ut,ur)|0,d=d+Math.imul(ut,lr)|0,d=d+Math.imul(pt,ur)|0,k=k+Math.imul(pt,lr)|0,B=B+Math.imul(He,_r)|0,d=d+Math.imul(He,kt)|0,d=d+Math.imul(it,_r)|0,k=k+Math.imul(it,kt)|0,B=B+Math.imul(we,S)|0,d=d+Math.imul(we,L)|0,d=d+Math.imul(ke,S)|0,k=k+Math.imul(ke,L)|0,B=B+Math.imul(Ue,p)|0,d=d+Math.imul(Ue,U)|0,d=d+Math.imul(Pe,p)|0,k=k+Math.imul(Pe,U)|0,B=B+Math.imul(be,Y)|0,d=d+Math.imul(be,ue)|0,d=d+Math.imul(ge,Y)|0,k=k+Math.imul(ge,ue)|0,B=B+Math.imul(K,Ae)|0,d=d+Math.imul(K,Ee)|0,d=d+Math.imul(re,Ae)|0,k=k+Math.imul(re,Ee)|0;var $e=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+($e>>>26)|0,$e&=67108863,B=Math.imul(X,ze),d=Math.imul(X,rr),d=d+Math.imul(ae,ze)|0,k=Math.imul(ae,rr),B=B+Math.imul(b,yr)|0,d=d+Math.imul(b,vr)|0,d=d+Math.imul(D,yr)|0,k=k+Math.imul(D,vr)|0,B=B+Math.imul(Tt,zt)|0,d=d+Math.imul(Tt,Yt)|0,d=d+Math.imul(C,zt)|0,k=k+Math.imul(C,Yt)|0,B=B+Math.imul(xt,ur)|0,d=d+Math.imul(xt,lr)|0,d=d+Math.imul(At,ur)|0,k=k+Math.imul(At,lr)|0,B=B+Math.imul(ut,_r)|0,d=d+Math.imul(ut,kt)|0,d=d+Math.imul(pt,_r)|0,k=k+Math.imul(pt,kt)|0,B=B+Math.imul(He,S)|0,d=d+Math.imul(He,L)|0,d=d+Math.imul(it,S)|0,k=k+Math.imul(it,L)|0,B=B+Math.imul(we,p)|0,d=d+Math.imul(we,U)|0,d=d+Math.imul(ke,p)|0,k=k+Math.imul(ke,U)|0,B=B+Math.imul(Ue,Y)|0,d=d+Math.imul(Ue,ue)|0,d=d+Math.imul(Pe,Y)|0,k=k+Math.imul(Pe,ue)|0,B=B+Math.imul(be,Ae)|0,d=d+Math.imul(be,Ee)|0,d=d+Math.imul(ge,Ae)|0,k=k+Math.imul(ge,Ee)|0;var De=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(De>>>26)|0,De&=67108863,B=Math.imul(X,yr),d=Math.imul(X,vr),d=d+Math.imul(ae,yr)|0,k=Math.imul(ae,vr),B=B+Math.imul(b,zt)|0,d=d+Math.imul(b,Yt)|0,d=d+Math.imul(D,zt)|0,k=k+Math.imul(D,Yt)|0,B=B+Math.imul(Tt,ur)|0,d=d+Math.imul(Tt,lr)|0,d=d+Math.imul(C,ur)|0,k=k+Math.imul(C,lr)|0,B=B+Math.imul(xt,_r)|0,d=d+Math.imul(xt,kt)|0,d=d+Math.imul(At,_r)|0,k=k+Math.imul(At,kt)|0,B=B+Math.imul(ut,S)|0,d=d+Math.imul(ut,L)|0,d=d+Math.imul(pt,S)|0,k=k+Math.imul(pt,L)|0,B=B+Math.imul(He,p)|0,d=d+Math.imul(He,U)|0,d=d+Math.imul(it,p)|0,k=k+Math.imul(it,U)|0,B=B+Math.imul(we,Y)|0,d=d+Math.imul(we,ue)|0,d=d+Math.imul(ke,Y)|0,k=k+Math.imul(ke,ue)|0,B=B+Math.imul(Ue,Ae)|0,d=d+Math.imul(Ue,Ee)|0,d=d+Math.imul(Pe,Ae)|0,k=k+Math.imul(Pe,Ee)|0;var Re=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Re>>>26)|0,Re&=67108863,B=Math.imul(X,zt),d=Math.imul(X,Yt),d=d+Math.imul(ae,zt)|0,k=Math.imul(ae,Yt),B=B+Math.imul(b,ur)|0,d=d+Math.imul(b,lr)|0,d=d+Math.imul(D,ur)|0,k=k+Math.imul(D,lr)|0,B=B+Math.imul(Tt,_r)|0,d=d+Math.imul(Tt,kt)|0,d=d+Math.imul(C,_r)|0,k=k+Math.imul(C,kt)|0,B=B+Math.imul(xt,S)|0,d=d+Math.imul(xt,L)|0,d=d+Math.imul(At,S)|0,k=k+Math.imul(At,L)|0,B=B+Math.imul(ut,p)|0,d=d+Math.imul(ut,U)|0,d=d+Math.imul(pt,p)|0,k=k+Math.imul(pt,U)|0,B=B+Math.imul(He,Y)|0,d=d+Math.imul(He,ue)|0,d=d+Math.imul(it,Y)|0,k=k+Math.imul(it,ue)|0,B=B+Math.imul(we,Ae)|0,d=d+Math.imul(we,Ee)|0,d=d+Math.imul(ke,Ae)|0,k=k+Math.imul(ke,Ee)|0;var Me=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,B=Math.imul(X,ur),d=Math.imul(X,lr),d=d+Math.imul(ae,ur)|0,k=Math.imul(ae,lr),B=B+Math.imul(b,_r)|0,d=d+Math.imul(b,kt)|0,d=d+Math.imul(D,_r)|0,k=k+Math.imul(D,kt)|0,B=B+Math.imul(Tt,S)|0,d=d+Math.imul(Tt,L)|0,d=d+Math.imul(C,S)|0,k=k+Math.imul(C,L)|0,B=B+Math.imul(xt,p)|0,d=d+Math.imul(xt,U)|0,d=d+Math.imul(At,p)|0,k=k+Math.imul(At,U)|0,B=B+Math.imul(ut,Y)|0,d=d+Math.imul(ut,ue)|0,d=d+Math.imul(pt,Y)|0,k=k+Math.imul(pt,ue)|0,B=B+Math.imul(He,Ae)|0,d=d+Math.imul(He,Ee)|0,d=d+Math.imul(it,Ae)|0,k=k+Math.imul(it,Ee)|0;var Ne=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,B=Math.imul(X,_r),d=Math.imul(X,kt),d=d+Math.imul(ae,_r)|0,k=Math.imul(ae,kt),B=B+Math.imul(b,S)|0,d=d+Math.imul(b,L)|0,d=d+Math.imul(D,S)|0,k=k+Math.imul(D,L)|0,B=B+Math.imul(Tt,p)|0,d=d+Math.imul(Tt,U)|0,d=d+Math.imul(C,p)|0,k=k+Math.imul(C,U)|0,B=B+Math.imul(xt,Y)|0,d=d+Math.imul(xt,ue)|0,d=d+Math.imul(At,Y)|0,k=k+Math.imul(At,ue)|0,B=B+Math.imul(ut,Ae)|0,d=d+Math.imul(ut,Ee)|0,d=d+Math.imul(pt,Ae)|0,k=k+Math.imul(pt,Ee)|0;var Ie=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,B=Math.imul(X,S),d=Math.imul(X,L),d=d+Math.imul(ae,S)|0,k=Math.imul(ae,L),B=B+Math.imul(b,p)|0,d=d+Math.imul(b,U)|0,d=d+Math.imul(D,p)|0,k=k+Math.imul(D,U)|0,B=B+Math.imul(Tt,Y)|0,d=d+Math.imul(Tt,ue)|0,d=d+Math.imul(C,Y)|0,k=k+Math.imul(C,ue)|0,B=B+Math.imul(xt,Ae)|0,d=d+Math.imul(xt,Ee)|0,d=d+Math.imul(At,Ae)|0,k=k+Math.imul(At,Ee)|0;var ce=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(ce>>>26)|0,ce&=67108863,B=Math.imul(X,p),d=Math.imul(X,U),d=d+Math.imul(ae,p)|0,k=Math.imul(ae,U),B=B+Math.imul(b,Y)|0,d=d+Math.imul(b,ue)|0,d=d+Math.imul(D,Y)|0,k=k+Math.imul(D,ue)|0,B=B+Math.imul(Tt,Ae)|0,d=d+Math.imul(Tt,Ee)|0,d=d+Math.imul(C,Ae)|0,k=k+Math.imul(C,Ee)|0;var fe=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(fe>>>26)|0,fe&=67108863,B=Math.imul(X,Y),d=Math.imul(X,ue),d=d+Math.imul(ae,Y)|0,k=Math.imul(ae,ue),B=B+Math.imul(b,Ae)|0,d=d+Math.imul(b,Ee)|0,d=d+Math.imul(D,Ae)|0,k=k+Math.imul(D,Ee)|0;var ye=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,B=Math.imul(X,Ae),d=Math.imul(X,Ee),d=d+Math.imul(ae,Ae)|0,k=Math.imul(ae,Ee);var he=(T+B|0)+((d&8191)<<13)|0;return T=(k+(d>>>13)|0)+(he>>>26)|0,he&=67108863,x[0]=Bt,x[1]=Le,x[2]=Ke,x[3]=Ye,x[4]=lt,x[5]=ct,x[6]=Xe,x[7]=rt,x[8]=Je,x[9]=$e,x[10]=De,x[11]=Re,x[12]=Me,x[13]=Ne,x[14]=Ie,x[15]=ce,x[16]=fe,x[17]=ye,x[18]=he,T!==0&&(x[19]=T,m.length++),m};Math.imul||(F=H);function N(g,f,h){h.negative=f.negative^g.negative,h.length=g.length+f.length;for(var m=0,_=0,E=0;E>>26)|0,_+=x>>>26,x&=67108863}h.words[E]=T,m=x,x=_}return m!==0?h.words[E]=m:h.length--,h._strip()}function $(g,f,h){return N(g,f,h)}s.prototype.mulTo=function(f,h){var m,_=this.length+f.length;return this.length===10&&f.length===10?m=F(this,f,h):_<63?m=H(this,f,h):_<1024?m=N(this,f,h):m=$(this,f,h),m},s.prototype.mul=function(f){var h=new s(null);return h.words=new Array(this.length+f.length),this.mulTo(f,h)},s.prototype.mulf=function(f){var h=new s(null);return h.words=new Array(this.length+f.length),$(this,f,h)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var h=f<0;h&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var m=0,_=0;_>=26,m+=E/67108864|0,m+=x>>>26,this.words[_]=x&67108863}return m!==0&&(this.words[_]=m,this.length++),h?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var h=P(f);if(h.length===0)return new s(1);for(var m=this,_=0;_=0);var h=f%26,m=(f-h)/26,_=67108863>>>26-h<<26-h,E;if(h!==0){var x=0;for(E=0;E>>26-h}x&&(this.words[E]=x,this.length++)}if(m!==0){for(E=this.length-1;E>=0;E--)this.words[E+m]=this.words[E];for(E=0;E=0);var _;h?_=(h-h%26)/26:_=0;var E=f%26,x=Math.min((f-E)/26,this.length),T=67108863^67108863>>>E<x)for(this.length-=x,d=0;d=0&&(k!==0||d>=_);d--){var W=this.words[d]|0;this.words[d]=k<<26-E|W>>>E,k=W&T}return B&&k!==0&&(B.words[B.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,h,m){return n(this.negative===0),this.iushrn(f,h,m)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var h=f%26,m=(f-h)/26,_=1<=0);var h=f%26,m=(f-h)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(h!==0&&m++,this.length=Math.min(m,this.length),h!==0){var _=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(B/67108864|0),this.words[E+m]=x&67108863}for(;E>26,this.words[E+m]=x&67108863;if(T===0)return this._strip();for(n(T===-1),T=0,E=0;E>26,this.words[E]=x&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,h){var m=this.length-f.length,_=this.clone(),E=f,x=E.words[E.length-1]|0,T=this._countBits(x);m=26-T,m!==0&&(E=E.ushln(m),_.iushln(m),x=E.words[E.length-1]|0);var B=_.length-E.length,d;if(h!=="mod"){d=new s(null),d.length=B+1,d.words=new Array(d.length);for(var k=0;k=0;K--){var re=(_.words[E.length+K]|0)*67108864+(_.words[E.length+K-1]|0);for(re=Math.min(re/x|0,67108863),_._ishlnsubmul(E,re,K);_.negative!==0;)re--,_.negative=0,_._ishlnsubmul(E,1,K),_.isZero()||(_.negative^=1);d&&(d.words[K]=re)}return d&&d._strip(),_._strip(),h!=="div"&&m!==0&&_.iushrn(m),{div:d||null,mod:_}},s.prototype.divmod=function(f,h,m){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var _,E,x;return this.negative!==0&&f.negative===0?(x=this.neg().divmod(f,h),h!=="mod"&&(_=x.div.neg()),h!=="div"&&(E=x.mod.neg(),m&&E.negative!==0&&E.iadd(f)),{div:_,mod:E}):this.negative===0&&f.negative!==0?(x=this.divmod(f.neg(),h),h!=="mod"&&(_=x.div.neg()),{div:_,mod:x.mod}):this.negative&f.negative?(x=this.neg().divmod(f.neg(),h),h!=="div"&&(E=x.mod.neg(),m&&E.negative!==0&&E.isub(f)),{div:x.div,mod:E}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?h==="div"?{div:this.divn(f.words[0]),mod:null}:h==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,h)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var h=this.divmod(f);if(h.mod.isZero())return h.div;var m=h.div.negative!==0?h.mod.isub(f):h.mod,_=f.ushrn(1),E=f.andln(1),x=m.cmp(_);return x<0||E===1&&x===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},s.prototype.modrn=function(f){var h=f<0;h&&(f=-f),n(f<=67108863);for(var m=(1<<26)%f,_=0,E=this.length-1;E>=0;E--)_=(m*_+(this.words[E]|0))%f;return h?-_:_},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var h=f<0;h&&(f=-f),n(f<=67108863);for(var m=0,_=this.length-1;_>=0;_--){var E=(this.words[_]|0)+m*67108864;this.words[_]=E/f|0,m=E%f}return this._strip(),h?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var h=this,m=f.clone();h.negative!==0?h=h.umod(f):h=h.clone();for(var _=new s(1),E=new s(0),x=new s(0),T=new s(1),B=0;h.isEven()&&m.isEven();)h.iushrn(1),m.iushrn(1),++B;for(var d=m.clone(),k=h.clone();!h.isZero();){for(var W=0,K=1;!(h.words[0]&K)&&W<26;++W,K<<=1);if(W>0)for(h.iushrn(W);W-- >0;)(_.isOdd()||E.isOdd())&&(_.iadd(d),E.isub(k)),_.iushrn(1),E.iushrn(1);for(var re=0,xe=1;!(m.words[0]&xe)&&re<26;++re,xe<<=1);if(re>0)for(m.iushrn(re);re-- >0;)(x.isOdd()||T.isOdd())&&(x.iadd(d),T.isub(k)),x.iushrn(1),T.iushrn(1);h.cmp(m)>=0?(h.isub(m),_.isub(x),E.isub(T)):(m.isub(h),x.isub(_),T.isub(E))}return{a:x,b:T,gcd:m.iushln(B)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var h=this,m=f.clone();h.negative!==0?h=h.umod(f):h=h.clone();for(var _=new s(1),E=new s(0),x=m.clone();h.cmpn(1)>0&&m.cmpn(1)>0;){for(var T=0,B=1;!(h.words[0]&B)&&T<26;++T,B<<=1);if(T>0)for(h.iushrn(T);T-- >0;)_.isOdd()&&_.iadd(x),_.iushrn(1);for(var d=0,k=1;!(m.words[0]&k)&&d<26;++d,k<<=1);if(d>0)for(m.iushrn(d);d-- >0;)E.isOdd()&&E.iadd(x),E.iushrn(1);h.cmp(m)>=0?(h.isub(m),_.isub(E)):(m.isub(h),E.isub(_))}var W;return h.cmpn(1)===0?W=_:W=E,W.cmpn(0)<0&&W.iadd(f),W},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var h=this.clone(),m=f.clone();h.negative=0,m.negative=0;for(var _=0;h.isEven()&&m.isEven();_++)h.iushrn(1),m.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;m.isEven();)m.iushrn(1);var E=h.cmp(m);if(E<0){var x=h;h=m,m=x}else if(E===0||m.cmpn(1)===0)break;h.isub(m)}while(!0);return m.iushln(_)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var h=f%26,m=(f-h)/26,_=1<>>26,T&=67108863,this.words[x]=T}return E!==0&&(this.words[x]=E,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var h=f<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var m;if(this.length>1)m=1;else{h&&(f=-f),n(f<=67108863,"Number is too big");var _=this.words[0]|0;m=_===f?0:_f.length)return 1;if(this.length=0;m--){var _=this.words[m]|0,E=f.words[m]|0;if(_!==E){_E&&(h=1);break}}return h},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new Q(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var q={k256:null,p224:null,p192:null,p25519:null};function G(g,f){this.name=g,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},G.prototype.ireduce=function(f){var h=f,m;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),m=h.bitLength();while(m>this.n);var _=m0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},G.prototype.split=function(f,h){f.iushrn(this.n,0,h)},G.prototype.imulK=function(f){return f.imul(this.k)};function Z(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Z,G),Z.prototype.split=function(f,h){for(var m=4194303,_=Math.min(f.length,9),E=0;E<_;E++)h.words[E]=f.words[E];if(h.length=_,f.length<=9){f.words[0]=0,f.length=1;return}var x=f.words[9];for(h.words[h.length++]=x&m,E=10;E>>22,x=T}x>>>=22,f.words[E-10]=x,x===0&&f.length>10?f.length-=10:f.length-=9},Z.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var h=0,m=0;m>>=26,f.words[m]=E,h=_}return h!==0&&(f.words[f.length++]=h),f},s._prime=function(f){if(q[f])return q[f];var h;if(f==="k256")h=new Z;else if(f==="p224")h=new z;else if(f==="p192")h=new ee;else if(f==="p25519")h=new se;else throw new Error("Unknown prime "+f);return q[f]=h,h};function Q(g){if(typeof g=="string"){var f=s._prime(g);this.m=f.p,this.prime=f}else n(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}Q.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},Q.prototype._verify2=function(f,h){n((f.negative|h.negative)===0,"red works only with positives"),n(f.red&&f.red===h.red,"red works only with red numbers")},Q.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(l(f,f.umod(this.m)._forceRed(this)),f)},Q.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},Q.prototype.add=function(f,h){this._verify2(f,h);var m=f.add(h);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},Q.prototype.iadd=function(f,h){this._verify2(f,h);var m=f.iadd(h);return m.cmp(this.m)>=0&&m.isub(this.m),m},Q.prototype.sub=function(f,h){this._verify2(f,h);var m=f.sub(h);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},Q.prototype.isub=function(f,h){this._verify2(f,h);var m=f.isub(h);return m.cmpn(0)<0&&m.iadd(this.m),m},Q.prototype.shl=function(f,h){return this._verify1(f),this.imod(f.ushln(h))},Q.prototype.imul=function(f,h){return this._verify2(f,h),this.imod(f.imul(h))},Q.prototype.mul=function(f,h){return this._verify2(f,h),this.imod(f.mul(h))},Q.prototype.isqr=function(f){return this.imul(f,f.clone())},Q.prototype.sqr=function(f){return this.mul(f,f)},Q.prototype.sqrt=function(f){if(f.isZero())return f.clone();var h=this.m.andln(3);if(n(h%2===1),h===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(f,m)}for(var _=this.m.subn(1),E=0;!_.isZero()&&_.andln(1)===0;)E++,_.iushrn(1);n(!_.isZero());var x=new s(1).toRed(this),T=x.redNeg(),B=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,B).cmp(T)!==0;)d.redIAdd(T);for(var k=this.pow(d,_),W=this.pow(f,_.addn(1).iushrn(1)),K=this.pow(f,_),re=E;K.cmp(x)!==0;){for(var xe=K,be=0;xe.cmp(x)!==0;be++)xe=xe.redSqr();n(be=0;E--){for(var k=h.words[E],W=d-1;W>=0;W--){var K=k>>W&1;if(x!==_[0]&&(x=this.sqr(x)),K===0&&T===0){B=0;continue}T<<=1,T|=K,B++,!(B!==m&&(E!==0||W!==0))&&(x=this.mul(x,_[T]),B=0,T=0)}d=26}return x},Q.prototype.convertTo=function(f){var h=f.umod(this.m);return h===f?h.clone():h},Q.prototype.convertFrom=function(f){var h=f.clone();return h.red=null,h},s.mont=function(f){return new I(f)};function I(g){Q.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(I,Q),I.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},I.prototype.convertFrom=function(f){var h=this.imod(f.mul(this.rinv));return h.red=null,h},I.prototype.imul=function(f,h){if(f.isZero()||h.isZero())return f.words[0]=0,f.length=1,f;var m=f.imul(h),_=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=m.isub(_).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},I.prototype.mul=function(f,h){if(f.isZero()||h.isZero())return new s(0)._forceRed(this);var m=f.mul(h),_=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=m.isub(_).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},I.prototype.invm=function(f){var h=this.imod(f._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(e,ft)})(Kl);var Ig=Kl.exports,gf={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ie,n=r.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(o,a,c){return n(o,a,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=n(o);return a!==void 0?typeof c=="string"?u.fill(a,c):u.fill(a):u.fill(0),u},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(gf,gf.exports);var yf=gf.exports.Buffer;function lS(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,N=new Uint8Array(F);P!==H;){for(var $=v[P],q=0,G=F-1;($!==0||q>>0,N[G]=$%o>>>0,$=$/o>>>0;if($!==0)throw new Error("Non-zero carry");O=q,P++}for(var Z=F-O;Z!==F&&N[Z]===0;)Z++;for(var z=a.repeat(R);Z>>0,F=new Uint8Array(H);v[R];){var N=t[v.charCodeAt(R)];if(N===255)return;for(var $=0,q=H-1;(N!==0||$>>0,F[q]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");P=$,R++}for(var G=H-P;G!==H&&F[G]===0;)G++;var Z=yf.allocUnsafe(O+(H-G));Z.fill(0,0,O);for(var z=O;G!==H;)Z[z++]=F[G++];return Z}function A(v){var R=y(v);if(R)return R;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:y,decode:A}}var hS=lS,dS=hS,pS="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ar=dS(pS);const gS=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ns=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),is=new Uint32Array(64);class yS extends ag{constructor(){super(64,32,8,!1),this.A=ns[0]|0,this.B=ns[1]|0,this.C=ns[2]|0,this.D=ns[3]|0,this.E=ns[4]|0,this.F=ns[5]|0,this.G=ns[6]|0,this.H=ns[7]|0}get(){const{A:t,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[t,r,n,i,s,o,a,c]}set(t,r,n,i,s,o,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,r){for(let y=0;y<16;y++,r+=4)is[y]=t.getUint32(r,!1);for(let y=16;y<64;y++){const A=is[y-15],v=is[y-2],R=gi(A,7)^gi(A,18)^A>>>3,O=gi(v,17)^gi(v,19)^v>>>10;is[y]=O+is[y-7]+R+is[y-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let y=0;y<64;y++){const A=gi(a,6)^gi(a,11)^gi(a,25),v=l+A+ux(a,c,u)+gS[y]+is[y]|0,O=(gi(n,2)^gi(n,13)^gi(n,22))+lx(n,i,s)|0;l=u,u=c,c=a,a=o+v|0,o=s,s=i,i=n,n=v+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){is.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Zl=sg(()=>new yS);var Zr={};function Oi(e,t,r){return t<=e&&e<=r}function wf(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function wS(e){for(var t=String(e),r=t.length,n=0,i=[];n57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319)if(n===r-1)i.push(65533);else{var o=e.charCodeAt(n+1);if(56320<=o&&o<=57343){var a=s&1023,c=o&1023;i.push(65536+(a<<10)+c),n+=1}else i.push(65533)}n+=1}return i}function mS(e){for(var t="",r=0;r>10)+55296,(n&1023)+56320))}return t}var mf=-1;function Gl(e){this.tokens=[].slice.call(e)}Gl.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():mf},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var $o=-1;function Yl(e,t){if(e)throw TypeError("Decoder error");return t||65533}var bf="utf-8";function vf(e,t){if(!(this instanceof vf))return new vf(e,t);if(e=e!==void 0?String(e).toLowerCase():bf,e!==bf)throw new Error("Encoding not supported. Only utf-8 is supported");t=wf(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}vf.prototype={decode:function(t,r){var n;typeof t=="object"&&t instanceof ArrayBuffer?n=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):n=new Uint8Array(0),r=wf(r),this._streaming||(this._decoder=new bS({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new Gl(n),s=[],o;!i.endOfStream()&&(o=this._decoder.handler(i,i.read()),o!==$o);)o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o));if(!this._streaming){do{if(o=this._decoder.handler(i,i.read()),o===$o)break;o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o))}while(!i.endOfStream());this._decoder=null}return s.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(s[0]===65279?(this._BOMseen=!0,s.shift()):this._BOMseen=!0),mS(s)}};function _f(e,t){if(!(this instanceof _f))return new _f(e,t);if(e=e!==void 0?String(e).toLowerCase():bf,e!==bf)throw new Error("Encoding not supported. Only utf-8 is supported");t=wf(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}_f.prototype={encode:function(t,r){t=t?String(t):"",r=wf(r),this._streaming||(this._encoder=new vS(this._options)),this._streaming=!!r.stream;for(var n=[],i=new Gl(wS(t)),s;!i.endOfStream()&&(s=this._encoder.handler(i,i.read()),s!==$o);)Array.isArray(s)?n.push.apply(n,s):n.push(s);if(!this._streaming){for(;s=this._encoder.handler(i,i.read()),s!==$o;)Array.isArray(s)?n.push.apply(n,s):n.push(s);this._encoder=null}return new Uint8Array(n)}};function bS(e){var t=e.fatal,r=0,n=0,i=0,s=128,o=191;this.handler=function(a,c){if(c===mf&&i!==0)return i=0,Yl(t);if(c===mf)return $o;if(i===0){if(Oi(c,0,127))return c;if(Oi(c,194,223))i=1,r=c-192;else if(Oi(c,224,239))c===224&&(s=160),c===237&&(o=159),i=2,r=c-224;else if(Oi(c,240,244))c===240&&(s=144),c===244&&(o=143),i=3,r=c-240;else return Yl(t);return r=r<<6*i,null}if(!Oi(c,s,o))return r=i=n=0,s=128,o=191,a.prepend(c),Yl(t);if(s=128,o=191,n+=1,r+=c-128<<6*(i-n),n!==i)return null;var u=r;return r=i=n=0,u}}function vS(e){e.fatal,this.handler=function(t,r){if(r===mf)return $o;if(Oi(r,0,127))return r;var n,i;Oi(r,128,2047)?(n=1,i=192):Oi(r,2048,65535)?(n=2,i=224):Oi(r,65536,1114111)&&(n=3,i=240);for(var s=[(r>>6*n)+i];n>0;){var o=r>>6*(n-1);s.push(128|o&63),n-=1}return s}}var _S=Object.freeze({__proto__:null,TextEncoder:_f,TextDecoder:vf}),ES=Un(_S),xS=ft&&ft.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),SS=ft&&ft.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yi=ft&&ft.__decorate||function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},AS=ft&&ft.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&xS(t,e,r);return SS(t,e),t},Rg=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zr,"__esModule",{value:!0});var Tg=Zr.deserializeUnchecked=Mg=Zr.deserialize=Og=Zr.serialize=Zr.BinaryReader=Zr.BinaryWriter=Zr.BorshError=Zr.baseDecode=Zr.baseEncode=void 0;const ss=Rg(Kl.exports),kg=Rg(Ar),BS=AS(ES),IS=typeof TextDecoder!="function"?BS.TextDecoder:TextDecoder,RS=new IS("utf-8",{fatal:!0});function TS(e){return typeof e=="string"&&(e=ie.Buffer.from(e,"utf8")),kg.default.encode(ie.Buffer.from(e))}Zr.baseEncode=TS;function kS(e){return ie.Buffer.from(kg.default.decode(e))}Zr.baseDecode=kS;const Xl=1024;class ln extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Zr.BorshError=ln;class Cg{constructor(){this.buf=ie.Buffer.alloc(Xl),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=ie.Buffer.concat([this.buf,ie.Buffer.alloc(Xl)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new ss.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new ss.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new ss.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new ss.default(t).toArray("le",64)))}writeBuffer(t){this.buf=ie.Buffer.concat([ie.Buffer.from(this.buf.subarray(0,this.length)),t,ie.Buffer.alloc(Xl)]),this.length+=t.length}writeString(t){this.maybeResize();const r=ie.Buffer.from(t,"utf8");this.writeU32(r.length),this.writeBuffer(r)}writeFixedArray(t){this.writeBuffer(ie.Buffer.from(t))}writeArray(t,r){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),r(n)}toArray(){return this.buf.subarray(0,this.length)}}Zr.BinaryWriter=Cg;function wi(e,t,r){const n=r.value;r.value=function(...i){try{return n.apply(this,i)}catch(s){if(s instanceof RangeError){const o=s.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(o)>=0)throw new ln("Reached the end of buffer when deserializing")}throw s}}}class Bn{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new ss.default(t,"le")}readU128(){const t=this.readBuffer(16);return new ss.default(t,"le")}readU256(){const t=this.readBuffer(32);return new ss.default(t,"le")}readU512(){const t=this.readBuffer(64);return new ss.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new ln(`Expected buffer length ${t} isn't within bounds`);const r=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,r}readString(){const t=this.readU32(),r=this.readBuffer(t);try{return RS.decode(r)}catch(n){throw new ln(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const r=this.readU32(),n=Array();for(let i=0;i{Ws(e,t,s,n[0],i)});else if(n.kind!==void 0)switch(n.kind){case"option":{r==null?i.writeU8(0):(i.writeU8(1),Ws(e,t,r,n.type,i));break}case"map":{i.writeU32(r.size),r.forEach((s,o)=>{Ws(e,t,o,n.key,i),Ws(e,t,s,n.value,i)});break}default:throw new ln(`FieldType ${n} unrecognized`)}else $g(e,r,i)}catch(s){throw s instanceof ln&&s.addToFieldPath(t),s}}function $g(e,t,r){if(typeof t.borshSerialize=="function"){t.borshSerialize(r);return}const n=e.get(t.constructor);if(!n)throw new ln(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([i,s])=>{Ws(e,i,t[i],s,r)});else if(n.kind==="enum"){const i=t[n.field];for(let s=0;sKs(e,t,r[0],n))}if(r.kind==="option")return n.readU8()?Ks(e,t,r.type,n):void 0;if(r.kind==="map"){let i=new Map;const s=n.readU32();for(let o=0;o=n.values.length)throw new ln(`Enum index: ${i} is out of range`);const[s,o]=n.values[i],a=Ks(e,s,o,r);return new t({[s]:a})}throw new ln(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}function LS(e,t,r,n=Bn){const i=new n(r),s=Jl(e,t,i);if(i.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const r=Object.create(this.constructor.prototype);return Object.assign(r,this),r.property=t,r}fromArray(t){}}ne.Layout=qt;function eh(e,t){return t.property?e+"["+t.property+"]":e}ne.nameWithProperty=eh;function OS(e,t){if(typeof e!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof qt))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(r,n){return t.encode(this,r,n)},writable:!0}),Object.defineProperty(e,"decode",{value(r,n){return t.decode(r,n)},writable:!0})}ne.bindConstructorLayout=OS;class wn extends qt{isCount(){throw new Error("ExternalLayout is abstract")}}ne.ExternalLayout=wn;class Ng extends wn{constructor(t=1,r){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,r),this.elementSpan=t}isCount(){return!0}decode(t,r=0){Oo(t);const n=t.length-r;return Math.floor(n/this.elementSpan)}encode(t,r,n){return 0}}ne.GreedyCount=Ng;class th extends wn{constructor(t,r=0,n){if(!(t instanceof qt))throw new TypeError("layout must be a Layout");if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=r}isCount(){return this.layout instanceof Hn||this.layout instanceof ni}decode(t,r=0){return this.layout.decode(t,r+this.offset)}encode(t,r,n=0){return this.layout.encode(t,r,n+this.offset)}}ne.OffsetLayout=th;class Hn extends qt{constructor(t,r){if(super(t,r),6o+i.encode(a,r,n+o),0);return this.count instanceof wn&&this.count.encode(t.length,r,n),s}}ne.Sequence=Vg;class Wg extends qt{constructor(t,r,n){if(!(Array.isArray(t)&&t.reduce((s,o)=>s&&o instanceof qt,!0)))throw new TypeError("fields must be array of Layout instances");typeof r=="boolean"&&n===void 0&&(n=r,r=void 0);for(const s of t)if(0>s.span&&s.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((s,o)=>s+o.getSpan(),0)}catch{}super(i,r),this.fields=t,this.decodePrefixes=!!n}getSpan(t,r=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,s)=>{const o=s.getSpan(t,r);return r+=o,i+o},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,r=0){Oo(t);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(t,r)),r+=i.getSpan(t,r),this.decodePrefixes&&t.length===r)break;return n}encode(t,r,n=0){const i=n;let s=0,o=0;for(const a of this.fields){let c=a.span;if(o=0c&&(c=a.getSpan(r,n)))}s=n,n+=c}return s+o-i}fromArray(t){const r=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?r=-1:0<=r&&(r+=n.span)}}}ne.Structure=Wg;class nh{constructor(t){this.property=t}decode(t,r){throw new Error("UnionDiscriminator is abstract")}encode(t,r,n){throw new Error("UnionDiscriminator is abstract")}}ne.UnionDiscriminator=nh;class Sf extends nh{constructor(t,r){if(!(t instanceof wn&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(r||t.property||"variant"),this.layout=t}decode(t,r){return this.layout.decode(t,r)}encode(t,r,n){return this.layout.encode(t,r,n)}}ne.UnionLayoutDiscriminator=Sf;class ih extends qt{constructor(t,r,n){let i;if(t instanceof Hn||t instanceof ni)i=new Sf(new th(t));else if(t instanceof wn&&t.isCount())i=new Sf(t);else if(t instanceof nh)i=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(r===void 0&&(r=null),!(r===null||r instanceof qt))throw new TypeError("defaultLayout must be null or a Layout");if(r!==null){if(0>r.span)throw new Error("defaultLayout must have constant span");r.property===void 0&&(r=r.replicate("content"))}let s=-1;r&&(s=r.span,0<=s&&(t instanceof Hn||t instanceof ni)&&(s+=i.layout.span)),super(s,n),this.discriminator=i,this.usesPrefixDiscriminator=t instanceof Hn||t instanceof ni,this.defaultLayout=r,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return o(a)},this.configGetSourceVariant=function(a){o=a.bind(this)}}getSpan(t,r=0){if(0<=this.span)return this.span;const n=this.getVariant(t,r);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,r)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const r=this.registry[t[this.discriminator.property]];if(r&&(!r.layout||r.property&&Object.prototype.hasOwnProperty.call(t,r.property)))return r}else for(const r in this.registry){const n=this.registry[r];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,r=0){let n;const i=this.discriminator,s=i.decode(t,r),o=this.registry[s];if(o===void 0){const a=this.defaultLayout;let c=0;this.usesPrefixDiscriminator&&(c=i.layout.span),n=this.makeDestinationObject(),n[i.property]=s,n[a.property]=a.decode(t,r+c)}else n=o.decode(t,r);return n}encode(t,r,n=0){const i=this.getSourceVariant(t);if(i===void 0){const s=this.discriminator,o=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=s.layout.span),s.encode(t[s.property],r,n),a+o.encode(t[o.property],r,n+a)}return i.encode(t,r,n)}addVariant(t,r,n){const i=new Kg(this,t,r,n);return this.registry[t]=i,i}getVariant(t,r=0){let n;return t instanceof Uint8Array?n=this.discriminator.decode(t,r):n=t,this.registry[n]}}ne.Union=ih;class Kg extends qt{constructor(t,r,n,i){if(!(t instanceof ih))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof qt))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let s=t.span;0>t.span&&(s=n?n.span:0,0<=s&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span)),super(s,i),this.union=t,this.variant=r,this.layout=n||null}getSpan(t,r=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(t,r+n)),n+i}decode(t,r=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,r))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,r+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,r,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,r,n);let s=i;if(this.layout&&(this.layout.encode(t[this.property],r,n+i),s+=this.layout.getSpan(r,n+i),0<=this.union.span&&s>this.union.span))throw new Error("encoded variant overruns containing union");return s}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}ne.VariantLayout=Kg;function No(e){return 0>e&&(e+=4294967296),e}class sh extends qt{constructor(t,r,n){if(!(t instanceof Hn||t instanceof ni))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof r=="string"&&n===void 0&&(n=r,r=!1),4=r)throw new TypeError("bits must be positive integer");const i=8*t.span,s=t.fields.reduce((o,a)=>o+a.bits,0);if(r+s>i)throw new Error("bits too long for span remainder ("+(i-s)+" of "+i+" remain)");this.container=t,this.bits=r,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==No(t&this.valueMask))throw new TypeError(eh("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const r=this.container._packedGetValue(),n=No(t<n&&(n=this.length.decode(t,r)),n}decode(t,r=0){let n=this.span;return 0>n&&(n=this.length.decode(t,r)),Nt(t).slice(r,r+n)}encode(t,r,n){let i=this.length;if(this.length instanceof wn&&(i=t.length),!(t instanceof Uint8Array&&i===t.length))throw new TypeError(eh("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>r.length)throw new RangeError("encoding overruns Uint8Array");const s=Nt(t);return Nt(r).write(s.toString("hex"),n,i,"hex"),this.length instanceof wn&&this.length.encode(i,r,n),i}}ne.Blob=Gg;class Yg extends qt{constructor(t){super(-1,t)}getSpan(t,r=0){Oo(t);let n=r;for(;nr.length)throw new RangeError("encoding overruns Buffer");const o=Nt(r);return i.copy(o,n),o[n+s]=0,s+1}}ne.CString=Yg;class Xg extends qt{constructor(t,r){if(typeof t=="string"&&r===void 0&&(r=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,r),this.maxSpan=t}getSpan(t,r=0){return Oo(t),t.length-r}decode(t,r=0){const n=this.getSpan(t,r);if(0<=this.maxSpan&&this.maxSpanr.length)throw new RangeError("encoding overruns Buffer");return i.copy(Nt(r),n),s}}ne.UTF8=Xg;class Jg extends qt{constructor(t,r){super(0,r),this.value=t}decode(t,r){return this.value}encode(t,r,n){return 0}}ne.Constant=Jg,ne.greedy=(e,t)=>new Ng(e,t);var Gs=ne.offset=(e,t,r)=>new th(e,t,r),Ut=ne.u8=e=>new Hn(1,e),jn=ne.u16=e=>new Hn(2,e);ne.u24=e=>new Hn(3,e);var qe=ne.u32=e=>new Hn(4,e);ne.u40=e=>new Hn(5,e),ne.u48=e=>new Hn(6,e);var Gr=ne.nu64=e=>new Pg(e);ne.u16be=e=>new ni(2,e),ne.u24be=e=>new ni(3,e),ne.u32be=e=>new ni(4,e),ne.u40be=e=>new ni(5,e),ne.u48be=e=>new ni(6,e),ne.nu64be=e=>new Ug(e),ne.s8=e=>new Zs(1,e),ne.s16=e=>new Zs(2,e),ne.s24=e=>new Zs(3,e),ne.s32=e=>new Zs(4,e),ne.s40=e=>new Zs(5,e),ne.s48=e=>new Zs(6,e);var In=ne.ns64=e=>new Fg(e);ne.s16be=e=>new Mo(2,e),ne.s24be=e=>new Mo(3,e),ne.s32be=e=>new Mo(4,e),ne.s40be=e=>new Mo(5,e),ne.s48be=e=>new Mo(6,e),ne.ns64be=e=>new Dg(e),ne.f32=e=>new Hg(e),ne.f32be=e=>new jg(e),ne.f64=e=>new zg(e),ne.f64be=e=>new qg(e);var Fe=ne.struct=(e,t,r)=>new Wg(e,t,r);ne.bits=(e,t,r)=>new sh(e,t,r);var en=ne.seq=(e,t,r)=>new Vg(e,t,r);ne.union=(e,t,r)=>new ih(e,t,r),ne.unionLayoutDiscriminator=(e,t)=>new Sf(e,t);var nr=ne.blob=(e,t)=>new Gg(e,t);ne.cstr=e=>new Yg(e),ne.utf8=(e,t)=>new Xg(e,t),ne.constant=(e,t)=>new Jg(e,t);var Fa={};Object.defineProperty(Fa,"__esModule",{value:!0});function MS(e){{const t=ie.Buffer.from(e);t.reverse();const r=t.toString("hex");return r.length===0?BigInt(0):BigInt(`0x${r}`)}}var NS=Fa.toBigIntLE=MS;function PS(e){{const t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}Fa.toBigIntBE=PS;function US(e,t){{const r=e.toString(16),n=ie.Buffer.from(r.padStart(t*2,"0").slice(0,t*2),"hex");return n.reverse(),n}}var FS=Fa.toBufferLE=US;function DS(e,t){{const r=e.toString(16);return ie.Buffer.from(r.padStart(t*2,"0").slice(0,t*2),"hex")}}Fa.toBufferBE=DS;class HS extends TypeError{constructor(t,r){let n;const{message:i,...s}=t,{path:o}=t,a=o.length===0?i:"At path: "+o.join(".")+" -- "+i;super(a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>{var c;return(c=n)!=null?c:n=[t,...r()]}}}function jS(e){return os(e)&&typeof e[Symbol.iterator]=="function"}function os(e){return typeof e=="object"&&e!=null}function ii(e){return typeof e=="string"?JSON.stringify(e):""+e}function zS(e){const{done:t,value:r}=e.next();return t?void 0:r}function qS(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c="Expected a value of type `"+o+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+ii(n)+"`"}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*Qg(e,t,r,n){jS(e)||(e=[e]);for(const i of e){const s=qS(i,t,r,n);s&&(yield s)}}function*ah(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&os(t.schema)&&os(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let c=!0;for(const u of t.validator(e,a))c=!1,yield[u,void 0];for(let[u,l,y]of t.entries(e,a)){const A=ah(l,y,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o});for(const v of A)v[0]?(c=!1,yield[v[0],void 0]):s&&(l=v[1],u===void 0?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):os(e)&&(e[u]=l))}if(c)for(const u of t.refiner(e,a))c=!1,yield[u,void 0];c&&(yield[void 0,e])}class mi{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return Qg(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return Qg(l,u,this,c)}:this.refiner=()=>[]}assert(t){return VS(t,this)}create(t){return Be(t,this)}is(t){return e1(t,this)}mask(t){return WS(t,this)}validate(t,r={}){return Da(t,this,r)}}function VS(e,t){const r=Da(e,t);if(r[0])throw r[0]}function Be(e,t){const r=Da(e,t,{coerce:!0});if(r[0])throw r[0];return r[1]}function WS(e,t){const r=Da(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}function e1(e,t){return!Da(e,t)[0]}function Da(e,t,r={}){const n=ah(e,t,r),i=zS(n);return i[0]?[new HS(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function Ys(e,t){return new mi({type:e,schema:null,validator:t})}function KS(){return Ys("any",()=>!0)}function Ce(e){return new mi({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+ii(t)}})}function bi(){return Ys("boolean",e=>typeof e=="boolean")}function ch(e){return Ys("instance",t=>t instanceof e||"Expected a `"+e.name+"` instance, but received: "+ii(t))}function dr(e){const t=ii(e),r=typeof e;return new mi({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||"Expected the literal `"+t+"`, but received: "+ii(n)}})}function ZS(){return Ys("never",()=>!1)}function Te(e){return new mi({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function te(){return Ys("number",e=>typeof e=="number"&&!isNaN(e)||"Expected a number, but received: "+ii(e))}function Qe(e){return new mi({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function t1(e,t){return new mi({type:"record",schema:null,*entries(r){if(os(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return os(r)||"Expected an object, but received: "+ii(r)}})}function Se(){return Ys("string",e=>typeof e=="string"||"Expected a string, but received: "+ii(e))}function fh(e){const t=ZS();return new mi({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new mi({type:"union",schema:null,validator(r,n){const i=[];for(const s of e){const[...o]=ah(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ii(r),...i]}})}function Ha(){return Ys("unknown",()=>!0)}function ja(e,t,r){return new mi({...e,coercer:(n,i)=>e1(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}var Af,GS=new Uint8Array(16);function r1(){if(!Af&&(Af=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Af))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Af(GS)}var YS=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Bf(e){return typeof e=="string"&&YS.test(e)}for(var Yr=[],uh=0;uh<256;++uh)Yr.push((uh+256).toString(16).substr(1));function If(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(Yr[e[t+0]]+Yr[e[t+1]]+Yr[e[t+2]]+Yr[e[t+3]]+"-"+Yr[e[t+4]]+Yr[e[t+5]]+"-"+Yr[e[t+6]]+Yr[e[t+7]]+"-"+Yr[e[t+8]]+Yr[e[t+9]]+"-"+Yr[e[t+10]]+Yr[e[t+11]]+Yr[e[t+12]]+Yr[e[t+13]]+Yr[e[t+14]]+Yr[e[t+15]]).toLowerCase();if(!Bf(r))throw TypeError("Stringified UUID is invalid");return r}var n1,lh,hh=0,dh=0;function XS(e,t,r){var n=t&&r||0,i=t||new Array(16);e=e||{};var s=e.node||n1,o=e.clockseq!==void 0?e.clockseq:lh;if(s==null||o==null){var a=e.random||(e.rng||r1)();s==null&&(s=n1=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=lh=(a[6]<<8|a[7])&16383)}var c=e.msecs!==void 0?e.msecs:Date.now(),u=e.nsecs!==void 0?e.nsecs:dh+1,l=c-hh+(u-dh)/1e4;if(l<0&&e.clockseq===void 0&&(o=o+1&16383),(l<0||c>hh)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");hh=c,dh=u,lh=o,c+=122192928e5;var y=((c&268435455)*1e4+u)%4294967296;i[n++]=y>>>24&255,i[n++]=y>>>16&255,i[n++]=y>>>8&255,i[n++]=y&255;var A=c/4294967296*1e4&268435455;i[n++]=A>>>8&255,i[n++]=A&255,i[n++]=A>>>24&15|16,i[n++]=A>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(var v=0;v<6;++v)i[n+v]=s[v];return t||If(i)}function i1(e){if(!Bf(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function JS(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(s&15),16);t.push(o)}return t}function o1(e){return(e+64>>>9<<4)+14+1}function n3(e,t){e[t>>5]|=128<>5]|=(e[n/8]&255)<>16)+(t>>16)+(r>>16);return n<<16|r&65535}function s3(e,t){return e<>>32-t}function Rf(e,t,r,n,i,s){return as(s3(as(as(t,e),as(n,s)),i),r)}function tn(e,t,r,n,i,s,o){return Rf(t&r|~t&n,e,t,i,s,o)}function rn(e,t,r,n,i,s,o){return Rf(t&n|r&~n,e,t,i,s,o)}function nn(e,t,r,n,i,s,o){return Rf(t^r^n,e,t,i,s,o)}function sn(e,t,r,n,i,s,o){return Rf(r^(t|~n),e,t,i,s,o)}var o3=s1("v3",48,t3),a3=o3;function c3(e,t,r){e=e||{};var n=e.random||(e.rng||r1)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return If(n)}function f3(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function ph(e,t){return e<>>32-t}function u3(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i>>0;N=F,F=H,H=ph(P,30)>>>0,P=O,O=G}r[0]=r[0]+O>>>0,r[1]=r[1]+P>>>0,r[2]=r[2]+H>>>0,r[3]=r[3]+F>>>0,r[4]=r[4]+N>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var l3=s1("v5",80,u3),h3=l3,d3="00000000-0000-0000-0000-000000000000";function p3(e){if(!Bf(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}var g3=Object.freeze({__proto__:null,v1:XS,v3:a3,v4:c3,v5:h3,NIL:d3,version:p3,validate:Bf,stringify:If,parse:i1}),a1=Un(g3);const y3=a1.v4;var w3=function(e,t,r,n){if(typeof e!="string")throw new TypeError(e+" must be a string");n=n||{};const i=typeof n.version=="number"?n.version:2;if(i!==1&&i!==2)throw new TypeError(i+" must be 1 or 2");const s={method:e};if(i===2&&(s.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");s.params=t}if(typeof r>"u"){const o=typeof n.generator=="function"?n.generator:function(){return y3()};s.id=o(s,n)}else i===2&&r===null?n.notificationIdNull&&(s.id=null):s.id=r;return s};const m3=a1.v4,b3=w3,za=function(e,t){if(!(this instanceof za))return new za(e,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return m3()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=e};var v3=za;za.prototype.request=function(e,t,r,n){const i=this;let s=null;const o=Array.isArray(e)&&typeof t=="function";if(this.options.version===1&&o)throw new TypeError("JSON-RPC 1.0 does not support batching");if(o||!o&&e&&typeof e=="object"&&typeof t=="function")n=t,s=e;else{typeof r=="function"&&(n=r,r=void 0);const u=typeof n=="function";try{s=b3(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(l){if(u)return n(l);throw l}if(!u)return s}let c;try{c=JSON.stringify(s,this.options.replacer)}catch(u){return n(u)}return this.callServer(c,function(u,l){i._parseResponse(u,l,n)}),s},za.prototype._parseResponse=function(e,t,r){if(e){r(e);return}if(!t)return r();let n;try{n=JSON.parse(t,this.options.reviver)}catch(i){return r(i)}if(r.length===3)if(Array.isArray(n)){const i=function(o){return typeof o.error<"u"},s=function(o){return!i(o)};return r(null,n.filter(i),n.filter(s))}else return r(null,n.error,n.result);r(null,n)};var c1={},gh={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function s(c,u,l,y,A){if(typeof l!="function")throw new TypeError("The listener must be a function");var v=new i(l,y||c,A),R=r?r+u:u;return c._events[R]?c._events[R].fn?c._events[R]=[c._events[R],v]:c._events[R].push(v):(c._events[R]=v,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,y;if(this._eventsCount===0)return u;for(y in l=this._events)t.call(l,y)&&u.push(r?y.slice(1):y);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=r?r+u:u,y=this._events[l];if(!y)return[];if(y.fn)return[y.fn];for(var A=0,v=y.length,R=new Array(v);A++this.rpc_id),u?this.dataPack=u:this.dataPack=new A3.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,r,n,i){return!i&&typeof n=="object"&&(i=n,n=null),new Promise((s,o)=>{if(!this.ready)return o(new Error("socket not ready"));const a=this.generate_request_id(t,r),c={jsonrpc:"2.0",method:t,params:r||void 0,id:a};this.socket.send(this.dataPack.encode(c),i,u=>{if(u)return o(u);this.queue[a]={promise:[s,o]},n&&(this.queue[a].timeout=setTimeout(()=>{delete this.queue[a],o(new Error("reply timeout"))},n))})})}async login(t){const r=await this.call("rpc.login",t);if(!r)throw new Error("authentication failed");return r}async listMethods(){return await this.call("__listMethods")}notify(t,r){return new Promise((n,i)=>{if(!this.ready)return i(new Error("socket not ready"));const s={jsonrpc:"2.0",method:t,params:r};this.socket.send(this.dataPack.encode(s),o=>{if(o)return i(o);n()})})}async subscribe(t){typeof t=="string"&&(t=[t]);const r=await this.call("rpc.on",t);if(typeof t=="string"&&r[t]!=="ok")throw new Error("Failed subscribing to an event '"+t+"' with: "+r[t]);return r}async unsubscribe(t){typeof t=="string"&&(t=[t]);const r=await this.call("rpc.off",t);if(typeof t=="string"&&r[t]!=="ok")throw new Error("Failed unsubscribing from an event with: "+r);return r}close(t,r){this.socket.close(t||1e3,r)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}_connect(t,r){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,r),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:n})=>{n instanceof ArrayBuffer&&(n=ie.Buffer.from(n).toString());try{n=this.dataPack.decode(n)}catch{return}if(n.notification&&this.listeners(n.notification).length){if(!Object.keys(n.params).length)return this.emit(n.notification);const i=[n.notification];if(n.params.constructor===Object)i.push(n.params);else for(let s=0;s{this.emit.apply(this,i)})}if(!this.queue[n.id])return n.method?Promise.resolve().then(()=>{this.emit(n.method,n?.params)}):void 0;"error"in n=="result"in n&&this.queue[n.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[n.id].timeout&&clearTimeout(this.queue[n.id].timeout),n.error?this.queue[n.id].promise[1](n.error):this.queue[n.id].promise[0](n.result),delete this.queue[n.id]}),this.socket.addEventListener("error",n=>this.emit("error",n)),this.socket.addEventListener("close",({code:n,reason:i})=>{this.ready&&setTimeout(()=>this.emit("close",n,i),0),this.ready=!1,this.socket=void 0,n!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(t,r),this.reconnect_interval)))})}}var I3=c1.default=B3,f1={};Object.defineProperty(f1,"__esModule",{value:!0});const R3=gh.exports;class T3 extends R3.EventEmitter{socket;constructor(t,r,n){super(),this.socket=new window.WebSocket(t,n),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=i=>this.emit("message",i.data),this.socket.onerror=i=>this.emit("error",i),this.socket.onclose=i=>{this.emit("close",i.code,i.reason)}}send(t,r,n){const i=n||r;try{this.socket.send(t),i()}catch(s){i(s)}}close(t,r){this.socket.close(t,r)}addEventListener(t,r,n){this.socket.addEventListener(t,r,n)}}function k3(e,t){return new T3(e,t)}var C3=f1.default=k3;const L3=[],$3=BigInt(0),qa=BigInt(1),O3=BigInt(2),M3=BigInt(7),N3=BigInt(256),P3=BigInt(113);for(let e=0,t=qa,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5];let i=$3;for(let s=0;s<7;s++)t=(t<>M3)*P3)%N3,t&O3&&(i^=qa<<(qa<Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{const l=u.toString(16);return l.length&1?`0${l}`:l},n=t(r(e.s)),i=t(r(e.r)),s=n.length/2,o=i.length/2,a=r(s),c=r(o);return`30${r(o+s+4)}02${c}${i}02${a}${n}`}},Mi=BigInt(0),zn=BigInt(1);BigInt(2);const u1=BigInt(3);BigInt(4);function H3(e){const t=U3(e),{Fp:r}=t,n=t.toBytes||((R,O,P)=>{const H=O.toAffine();return qs(Uint8Array.from([4]),r.toBytes(H.x),r.toBytes(H.y))}),i=t.fromBytes||(R=>{const O=R.subarray(1),P=r.fromBytes(O.subarray(0,r.BYTES)),H=r.fromBytes(O.subarray(r.BYTES,2*r.BYTES));return{x:P,y:H}});function s(R){const{a:O,b:P}=t,H=r.sqr(R),F=r.mul(H,R);return r.add(r.add(F,r.mul(R,O)),P)}if(!r.eql(r.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function o(R){return typeof R=="bigint"&&Mir.eql(N,r.ZERO);return F(P)&&F(H)?y.ZERO:new y(P,H,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(O){const P=r.invertBatch(O.map(H=>H.pz));return O.map((H,F)=>H.toAffine(P[F])).map(y.fromAffine)}static fromHex(O){const P=y.fromAffine(i(Cr("pointHex",O)));return P.assertValidity(),P}static fromPrivateKey(O){return y.BASE.multiply(c(O))}_setWindowSize(O){this._WINDOW_SIZE=O,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:O,y:P}=this.toAffine();if(!r.isValid(O)||!r.isValid(P))throw new Error("bad point: x or y not FE");const H=r.sqr(P),F=s(O);if(!r.eql(H,F))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:O}=this.toAffine();if(r.isOdd)return!r.isOdd(O);throw new Error("Field doesn't support isOdd")}equals(O){l(O);const{px:P,py:H,pz:F}=this,{px:N,py:$,pz:q}=O,G=r.eql(r.mul(P,q),r.mul(N,F)),Z=r.eql(r.mul(H,q),r.mul($,F));return G&&Z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:O,b:P}=t,H=r.mul(P,u1),{px:F,py:N,pz:$}=this;let q=r.ZERO,G=r.ZERO,Z=r.ZERO,z=r.mul(F,F),ee=r.mul(N,N),se=r.mul($,$),Q=r.mul(F,N);return Q=r.add(Q,Q),Z=r.mul(F,$),Z=r.add(Z,Z),q=r.mul(O,Z),G=r.mul(H,se),G=r.add(q,G),q=r.sub(ee,G),G=r.add(ee,G),G=r.mul(q,G),q=r.mul(Q,q),Z=r.mul(H,Z),se=r.mul(O,se),Q=r.sub(z,se),Q=r.mul(O,Q),Q=r.add(Q,Z),Z=r.add(z,z),z=r.add(Z,z),z=r.add(z,se),z=r.mul(z,Q),G=r.add(G,z),se=r.mul(N,$),se=r.add(se,se),z=r.mul(se,Q),q=r.sub(q,z),Z=r.mul(se,ee),Z=r.add(Z,Z),Z=r.add(Z,Z),new y(q,G,Z)}add(O){l(O);const{px:P,py:H,pz:F}=this,{px:N,py:$,pz:q}=O;let G=r.ZERO,Z=r.ZERO,z=r.ZERO;const ee=t.a,se=r.mul(t.b,u1);let Q=r.mul(P,N),I=r.mul(H,$),g=r.mul(F,q),f=r.add(P,H),h=r.add(N,$);f=r.mul(f,h),h=r.add(Q,I),f=r.sub(f,h),h=r.add(P,F);let m=r.add(N,q);return h=r.mul(h,m),m=r.add(Q,g),h=r.sub(h,m),m=r.add(H,F),G=r.add($,q),m=r.mul(m,G),G=r.add(I,g),m=r.sub(m,G),z=r.mul(ee,h),G=r.mul(se,g),z=r.add(G,z),G=r.sub(I,z),z=r.add(I,z),Z=r.mul(G,z),I=r.add(Q,Q),I=r.add(I,Q),g=r.mul(ee,g),h=r.mul(se,h),I=r.add(I,g),g=r.sub(Q,g),g=r.mul(ee,g),h=r.add(h,g),Q=r.mul(I,h),Z=r.add(Z,Q),Q=r.mul(m,h),G=r.mul(f,G),G=r.sub(G,Q),Q=r.mul(f,I),z=r.mul(m,z),z=r.add(z,Q),new y(G,Z,z)}subtract(O){return this.add(O.negate())}is0(){return this.equals(y.ZERO)}wNAF(O){return v.wNAFCached(this,u,O,P=>{const H=r.invertBatch(P.map(F=>F.pz));return P.map((F,N)=>F.toAffine(H[N])).map(y.fromAffine)})}multiplyUnsafe(O){const P=y.ZERO;if(O===Mi)return P;if(a(O),O===zn)return this;const{endo:H}=t;if(!H)return v.unsafeLadder(this,O);let{k1neg:F,k1:N,k2neg:$,k2:q}=H.splitScalar(O),G=P,Z=P,z=this;for(;N>Mi||q>Mi;)N&zn&&(G=G.add(z)),q&zn&&(Z=Z.add(z)),z=z.double(),N>>=zn,q>>=zn;return F&&(G=G.negate()),$&&(Z=Z.negate()),Z=new y(r.mul(Z.px,H.beta),Z.py,Z.pz),G.add(Z)}multiply(O){a(O);let P=O,H,F;const{endo:N}=t;if(N){const{k1neg:$,k1:q,k2neg:G,k2:Z}=N.splitScalar(P);let{p:z,f:ee}=this.wNAF(q),{p:se,f:Q}=this.wNAF(Z);z=v.constTimeNegate($,z),se=v.constTimeNegate(G,se),se=new y(r.mul(se.px,N.beta),se.py,se.pz),H=z.add(se),F=ee.add(Q)}else{const{p:$,f:q}=this.wNAF(P);H=$,F=q}return y.normalizeZ([H,F])[0]}multiplyAndAddUnsafe(O,P,H){const F=y.BASE,N=(q,G)=>G===Mi||G===zn||!q.equals(F)?q.multiplyUnsafe(G):q.multiply(G),$=N(this,P).add(N(O,H));return $.is0()?void 0:$}toAffine(O){const{px:P,py:H,pz:F}=this,N=this.is0();O==null&&(O=N?r.ONE:r.inv(F));const $=r.mul(P,O),q=r.mul(H,O),G=r.mul(F,O);if(N)return{x:r.ZERO,y:r.ZERO};if(!r.eql(G,r.ONE))throw new Error("invZ was invalid");return{x:$,y:q}}isTorsionFree(){const{h:O,isTorsionFree:P}=t;if(O===zn)return!0;if(P)return P(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:O,clearCofactor:P}=t;return O===zn?this:P?P(y,this):this.multiplyUnsafe(t.h)}toRawBytes(O=!0){return this.assertValidity(),n(y,this,O)}toHex(O=!0){return js(this.toRawBytes(O))}}y.BASE=new y(t.Gx,t.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=t.nBitLength,v=_g(y,t.endo?Math.ceil(A/2):A);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function j3(e){const t=jl(e);return Lo(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function z3(e){const t=j3(e),{Fp:r,n}=t,i=r.BYTES+1,s=2*r.BYTES+1;function o(h){return Mijs(Co(h,t.nByteLength));function R(h){const m=n>>zn;return h>m}function O(h){return R(h)?a(-h):h}const P=(h,m,_)=>zs(h.slice(m,_));class H{constructor(m,_,E){this.r=m,this.s=_,this.recovery=E,this.assertValidity()}static fromCompact(m){const _=t.nByteLength;return m=Cr("compactSignature",m,_*2),new H(P(m,0,_),P(m,_,2*_))}static fromDER(m){const{r:_,s:E}=Xs.toSig(Cr("DER",m));return new H(_,E)}assertValidity(){if(!A(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!A(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(m){return new H(this.r,this.s,m)}recoverPublicKey(m){const{r:_,s:E,recovery:x}=this,T=Z(Cr("msgHash",m));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const B=x===2||x===3?_+t.n:_;if(B>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=x&1?"03":"02",k=u.fromHex(d+v(B)),W=c(B),K=a(-T*W),re=a(E*W),xe=u.BASE.multiplyAndAddUnsafe(k,K,re);if(!xe)throw new Error("point at infinify");return xe.assertValidity(),xe}hasHighS(){return R(this.s)}normalizeS(){return this.hasHighS()?new H(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return To(this.toDERHex())}toDERHex(){return Xs.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return To(this.toCompactHex())}toCompactHex(){return v(this.r)+v(this.s)}}const F={isValidPrivateKey(h){try{return l(h),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const h=vg(t.n);return Yx(t.randomBytes(h),t.n)},precompute(h=8,m=u.BASE){return m._setWindowSize(h),m.multiply(BigInt(3)),m}};function N(h,m=!0){return u.fromPrivateKey(h).toRawBytes(m)}function $(h){const m=Hs(h),_=typeof h=="string",E=(m||_)&&h.length;return m?E===i||E===s:_?E===2*i||E===2*s:h instanceof u}function q(h,m,_=!0){if($(h))throw new Error("first arg must be private key");if(!$(m))throw new Error("second arg must be public key");return u.fromHex(m).multiply(l(h)).toRawBytes(_)}const G=t.bits2int||function(h){const m=zs(h),_=h.length*8-t.nBitLength;return _>0?m>>BigInt(_):m},Z=t.bits2int_modN||function(h){return a(G(h))},z=Pl(t.nBitLength);function ee(h){if(typeof h!="bigint")throw new Error("bigint expected");if(!(Mi<=h&&hge in _))throw new Error("sign() legacy options not supported");const{hash:E,randomBytes:x}=t;let{lowS:T,prehash:B,extraEntropy:d}=_;T==null&&(T=!0),h=Cr("msgHash",h),B&&(h=Cr("prehashed msgHash",E(h)));const k=Z(h),W=l(m),K=[ee(W),ee(k)];if(d!=null&&d!==!1){const ge=d===!0?x(r.BYTES):d;K.push(Cr("extraEntropy",ge))}const re=qs(...K),xe=k;function be(ge){const tt=G(ge);if(!A(tt))return;const Ue=c(tt),Pe=u.BASE.multiply(tt).toAffine(),pe=a(Pe.x);if(pe===Mi)return;const we=a(Ue*a(xe+pe*W));if(we===Mi)return;let ke=(Pe.x===pe?0:2)|Number(Pe.y&zn),vt=we;return T&&R(we)&&(vt=O(we),ke^=1),new H(pe,vt,ke)}return{seed:re,k2sig:be}}const Q={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};function g(h,m,_=Q){const{seed:E,k2sig:x}=se(h,m,_),T=t;return pg(T.hash.outputLen,T.nByteLength,T.hmac)(E,x)}u.BASE._setWindowSize(8);function f(h,m,_,E=I){const x=h;if(m=Cr("msgHash",m),_=Cr("publicKey",_),"strict"in E)throw new Error("options.strict was renamed to lowS");const{lowS:T,prehash:B}=E;let d,k;try{if(typeof x=="string"||Hs(x))try{d=H.fromDER(x)}catch(Pe){if(!(Pe instanceof Xs.Err))throw Pe;d=H.fromCompact(x)}else if(typeof x=="object"&&typeof x.r=="bigint"&&typeof x.s=="bigint"){const{r:Pe,s:pe}=x;d=new H(Pe,pe)}else throw new Error("PARSE");k=u.fromHex(_)}catch(Pe){if(Pe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(T&&d.hasHighS())return!1;B&&(m=t.hash(m));const{r:W,s:K}=d,re=Z(m),xe=c(K),be=a(re*xe),ge=a(W*xe),tt=u.BASE.multiplyAndAddUnsafe(k,be,ge)?.toAffine();return tt?a(tt.x)===W:!1}return{CURVE:t,getPublicKey:N,getSharedSecret:q,sign:g,verify:f,ProjectivePoint:u,Signature:H,utils:F}}class l1 extends ig{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,ax(t);const n=Ol(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?t.create().update(n).digest():n);for(let o=0;onew l1(e,t).update(r).digest();h1.create=(e,t)=>new l1(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function q3(e){return{hash:e,hmac:(t,...r)=>h1(e,t,ng(...r)),randomBytes:og}}function V3(e,t){const r=n=>z3({...e,...q3(n)});return Object.freeze({...r(t),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const d1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),p1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),W3=BigInt(1),yh=BigInt(2),g1=(e,t)=>(e+t/yh)/t;function K3(e){const t=d1,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,y=wr(l,r,t)*l%t,A=wr(y,r,t)*l%t,v=wr(A,yh,t)*u%t,R=wr(v,i,t)*v%t,O=wr(R,s,t)*R%t,P=wr(O,a,t)*O%t,H=wr(P,c,t)*P%t,F=wr(H,a,t)*O%t,N=wr(F,r,t)*l%t,$=wr(N,o,t)*R%t,q=wr($,n,t)*u%t,G=wr(q,yh,t);if(!wh.eql(wh.sqr(G),e))throw new Error("Cannot find square root");return G}const wh=mg(d1,void 0,void 0,{sqrt:K3}),mh=V3({a:BigInt(0),b:BigInt(7),Fp:wh,n:p1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=p1,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-W3*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=g1(s*e,t),c=g1(-n*e,t);let u=ir(e-a*r-c*i,t),l=ir(-a*n-c*s,t);const y=u>o,A=l>o;if(y&&(u=t-u),A&&(l=t-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:y,k1:u,k2neg:A,k2:l}}}},Zl);BigInt(0),mh.ProjectivePoint,pf.utils.randomPrivateKey;function y1(e){try{return pf.ExtendedPoint.fromHex(e),!0}catch{return!1}}const w1=(e,t)=>pf.sign(e,t.slice(0,32)),Z3=pf.verify,Uo=e=>ie.Buffer.isBuffer(e)?e:e instanceof Uint8Array?ie.Buffer.from(e.buffer,e.byteOffset,e.byteLength):ie.Buffer.from(e);class G3{constructor(t){Object.assign(this,t)}encode(){return ie.Buffer.from(Og(Tf,this))}static decode(t){return Mg(Tf,this,t)}static decodeUnchecked(t){return Tg(Tf,this,t)}}const Tf=new Map;var m1;const Y3=32,cs=32;function X3(e){return e._bn!==void 0}let b1=1;class et extends G3{constructor(t){if(super({}),this._bn=void 0,X3(t))this._bn=t._bn;else{if(typeof t=="string"){const r=Ar.decode(t);if(r.length!=cs)throw new Error("Invalid public key input");this._bn=new Ig(r)}else this._bn=new Ig(t);if(this._bn.byteLength()>cs)throw new Error("Invalid public key input")}}static unique(){const t=new et(b1);return b1+=1,new et(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Ar.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(ie.Buffer);if(t.length===cs)return t;const r=ie.Buffer.alloc(32);return t.copy(r,32-t.length),r}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,r,n){const i=ie.Buffer.concat([t.toBuffer(),ie.Buffer.from(r),n.toBuffer()]),s=Zl(i);return new et(s)}static createProgramAddressSync(t,r){let n=ie.Buffer.alloc(0);t.forEach(function(s){if(s.length>Y3)throw new TypeError("Max seed length exceeded");n=ie.Buffer.concat([n,Uo(s)])}),n=ie.Buffer.concat([n,r.toBuffer(),ie.Buffer.from("ProgramDerivedAddress")]);const i=Zl(n);if(y1(i))throw new Error("Invalid seeds, address must fall off the curve");return new et(i)}static async createProgramAddress(t,r){return this.createProgramAddressSync(t,r)}static findProgramAddressSync(t,r){let n=255,i;for(;n!=0;){try{const s=t.concat(ie.Buffer.from([n]));i=this.createProgramAddressSync(s,r)}catch(s){if(s instanceof TypeError)throw s;n--;continue}return[i,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,r){return this.findProgramAddressSync(t,r)}static isOnCurve(t){const r=new et(t);return y1(r.toBytes())}}m1=et,et.default=new m1("11111111111111111111111111111111"),Tf.set(et,{kind:"struct",fields:[["_bn","u256"]]}),new et("BPFLoader1111111111111111111111111111111111");const Fo=1280-40-8,bh=127,kf=64;class v1 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(v1.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class _1 extends Error{constructor(t,r){super(`Transaction was not confirmed in ${r.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(_1.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Va extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Va.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Cf{constructor(t,r){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=r}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const r of this.keySegments()){if(t255+1)throw new Error("Account index overflow encountered during compilation");const n=new Map;this.keySegments().flat().forEach((s,o)=>{n.set(s.toBase58(),o)});const i=s=>{const o=n.get(s.toBase58());if(o===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return o};return t.map(s=>({programIdIndex:i(s.programId),accountKeyIndexes:s.keys.map(o=>i(o.pubkey)),data:s.data}))}}const St=(e="publicKey")=>nr(32,e),J3=(e="signature")=>nr(64,e),Do=(e="string")=>{const t=Fe([qe("length"),qe("lengthPadding"),nr(Gs(qe(),-8),"chars")],e),r=t.decode.bind(t),n=t.encode.bind(t),i=t;return i.decode=(s,o)=>r(s,o).chars.toString(),i.encode=(s,o,a)=>{const c={chars:ie.Buffer.from(s,"utf8")};return n(c,o,a)},i.alloc=s=>qe().span+qe().span+ie.Buffer.from(s,"utf8").length,i},Q3=(e="authorized")=>Fe([St("staker"),St("withdrawer")],e),eA=(e="lockup")=>Fe([In("unixTimestamp"),In("epoch"),St("custodian")],e),tA=(e="voteInit")=>Fe([St("nodePubkey"),St("authorizedVoter"),St("authorizedWithdrawer"),Ut("commission")],e),rA=(e="voteAuthorizeWithSeedArgs")=>Fe([qe("voteAuthorizationType"),St("currentAuthorityDerivedKeyOwnerPubkey"),Do("currentAuthorityDerivedKeySeed"),St("newAuthorized")],e);function Rn(e){let t=0,r=0;for(;;){let n=e.shift();if(t|=(n&127)<>=7,r==0){e.push(n);break}else n|=128,e.push(n)}}function sr(e,t){if(!e)throw new Error(t||"Assertion failed")}class Lf{constructor(t,r){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=r}static compile(t,r){const n=new Map,i=o=>{const a=o.toBase58();let c=n.get(a);return c===void 0&&(c={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(a,c)),c},s=i(r);s.isSigner=!0,s.isWritable=!0;for(const o of t){i(o.programId).isInvoked=!0;for(const a of o.keys){const c=i(a.pubkey);c.isSigner||=a.isSigner,c.isWritable||=a.isWritable}}return new Lf(r,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];sr(t.length<=256,"Max static account keys length exceeded");const r=t.filter(([,c])=>c.isSigner&&c.isWritable),n=t.filter(([,c])=>c.isSigner&&!c.isWritable),i=t.filter(([,c])=>!c.isSigner&&c.isWritable),s=t.filter(([,c])=>!c.isSigner&&!c.isWritable),o={numRequiredSignatures:r.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:s.length};{sr(r.length>0,"Expected at least one writable signer key");const[c]=r[0];sr(c===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const a=[...r.map(([c])=>new et(c)),...n.map(([c])=>new et(c)),...i.map(([c])=>new et(c)),...s.map(([c])=>new et(c))];return[o,a]}extractTableLookup(t){const[r,n]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&o.isWritable),[i,s]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&!o.isWritable);if(!(r.length===0&&i.length===0))return[{accountKey:t.key,writableIndexes:r,readonlyIndexes:i},{writable:n,readonly:s}]}drainKeysFoundInLookupTable(t,r){const n=new Array,i=new Array;for(const[s,o]of this.keyMetaMap.entries())if(r(o)){const a=new et(s),c=t.findIndex(u=>u.equals(a));c>=0&&(sr(c<256,"Max lookup table index exceeded"),n.push(c),i.push(a),this.keyMetaMap.delete(s))}return[n,i]}}const E1="Reached end of buffer unexpectedly";function Ni(e){if(e.length===0)throw new Error(E1);return e.shift()}function kn(e,...t){const[r]=t;if(t.length===2?r+(t[1]??0)>e.length:r>=e.length)throw new Error(E1);return e.splice(...t)}class Pi{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(r=>new et(r)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(r=>this.indexToProgramIds.set(r.programIdIndex,this.accountKeys[r.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Ar.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Cf(this.staticAccountKeys)}static compile(t){const r=Lf.compile(t.instructions,t.payerKey),[n,i]=r.getMessageComponents(),o=new Cf(i).compileInstructions(t.instructions).map(a=>({programIdIndex:a.programIdIndex,accounts:a.accountKeyIndexes,data:Ar.encode(a.data)}));return new Pi({header:n,accountKeys:i,recentBlockhash:t.recentBlockhash,instructions:o})}isAccountSigner(t){return t=this.header.numRequiredSignatures){const n=t-r,s=this.accountKeys.length-r-this.header.numReadonlyUnsignedAccounts;return n!this.isProgramId(r))}serialize(){const t=this.accountKeys.length;let r=[];Tn(r,t);const n=this.instructions.map(y=>{const{accounts:A,programIdIndex:v}=y,R=Array.from(Ar.decode(y.data));let O=[];Tn(O,A.length);let P=[];return Tn(P,R.length),{programIdIndex:v,keyIndicesCount:ie.Buffer.from(O),keyIndices:A,dataLength:ie.Buffer.from(P),data:R}});let i=[];Tn(i,n.length);let s=ie.Buffer.alloc(Fo);ie.Buffer.from(i).copy(s);let o=i.length;n.forEach(y=>{const v=Fe([Ut("programIdIndex"),nr(y.keyIndicesCount.length,"keyIndicesCount"),en(Ut("keyIndex"),y.keyIndices.length,"keyIndices"),nr(y.dataLength.length,"dataLength"),en(Ut("userdatum"),y.data.length,"data")]).encode(y,s,o);o+=v}),s=s.slice(0,o);const a=Fe([nr(1,"numRequiredSignatures"),nr(1,"numReadonlySignedAccounts"),nr(1,"numReadonlyUnsignedAccounts"),nr(r.length,"keyCount"),en(St("key"),t,"keys"),St("recentBlockhash")]),c={numRequiredSignatures:ie.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:ie.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:ie.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:ie.Buffer.from(r),keys:this.accountKeys.map(y=>Uo(y.toBytes())),recentBlockhash:Ar.decode(this.recentBlockhash)};let u=ie.Buffer.alloc(2048);const l=a.encode(c,u);return s.copy(u,l),u.slice(0,l+s.length)}static from(t){let r=[...t];const n=Ni(r);if(n!==(n&bh))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=Ni(r),s=Ni(r),o=Rn(r);let a=[];for(let A=0;A0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new Cf(this.staticAccountKeys,r)}isAccountSigner(t){return t=n){const i=t-n,s=this.addressTableLookups.reduce((o,a)=>o+a.writableIndexes.length,0);return i=this.header.numRequiredSignatures){const i=t-r,o=n-r-this.header.numReadonlyUnsignedAccounts;return is.key.equals(n.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const s of n.writableIndexes)if(sl.toBytes()),recentBlockhash:Ar.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:r,addressTableLookupsLength:new Uint8Array(s),serializedAddressTableLookups:i},a);return a.slice(0,u)}serializeInstructions(){let t=0;const r=new Uint8Array(Fo);for(const n of this.compiledInstructions){const i=Array();Tn(i,n.accountKeyIndexes.length);const s=Array();Tn(s,n.data.length);const o=Fe([Ut("programIdIndex"),nr(i.length,"encodedAccountKeyIndexesLength"),en(Ut(),n.accountKeyIndexes.length,"accountKeyIndexes"),nr(s.length,"encodedDataLength"),nr(n.data.length,"data")]);t+=o.encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(s),data:n.data},r,t)}return r.slice(0,t)}serializeAddressTableLookups(){let t=0;const r=new Uint8Array(Fo);for(const n of this.addressTableLookups){const i=Array();Tn(i,n.writableIndexes.length);const s=Array();Tn(s,n.readonlyIndexes.length);const o=Fe([St("accountKey"),nr(i.length,"encodedWritableIndexesLength"),en(Ut(),n.writableIndexes.length,"writableIndexes"),nr(s.length,"encodedReadonlyIndexesLength"),en(Ut(),n.readonlyIndexes.length,"readonlyIndexes")]);t+=o.encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(s),readonlyIndexes:n.readonlyIndexes},r,t)}return r.slice(0,t)}static deserialize(t){let r=[...t];const n=Ni(r),i=n&bh;sr(n!==i,"Expected versioned message but received legacy message");const s=i;sr(s===0,`Expected versioned message with version 0 but found version ${s}`);const o={numRequiredSignatures:Ni(r),numReadonlySignedAccounts:Ni(r),numReadonlyUnsignedAccounts:Ni(r)},a=[],c=Rn(r);for(let R=0;R{const t=x1.deserializeMessageVersion(e);if(t==="legacy")return Pi.from(e);if(t===0)return Wa.deserialize(e);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let fs=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({});const nA=ie.Buffer.alloc(kf).fill(0);class S1{constructor(t){this.keys=void 0,this.programId=void 0,this.data=ie.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:r,isWritable:n})=>({pubkey:t.toJSON(),isSigner:r,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}}class us{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:r,nonceInfo:n}=t;this.minNonceContextSlot=r,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:r,lastValidBlockHeight:n}=t;this.recentBlockhash=r,this.lastValidBlockHeight=n}else{const{recentBlockhash:r,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=r}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(r=>{"instructions"in r?this.instructions=this.instructions.concat(r.instructions):"data"in r&&"programId"in r&&"keys"in r?this.instructions.push(r):this.instructions.push(new S1(r))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,r;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?r=[this.nonceInfo.nonceInstruction,...this.instructions]:r=this.instructions):(t=this.recentBlockhash,r=this.instructions),!t)throw new Error("Transaction recentBlockhash required");r.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let O=0;O{O.keys.forEach(H=>{s.push({...H})});const P=O.programId.toString();i.includes(P)||i.push(P)}),i.forEach(O=>{s.push({pubkey:new et(O),isSigner:!1,isWritable:!1})});const o=[];s.forEach(O=>{const P=O.pubkey.toString(),H=o.findIndex(F=>F.pubkey.toString()===P);H>-1?(o[H].isWritable=o[H].isWritable||O.isWritable,o[H].isSigner=o[H].isSigner||O.isSigner):o.push(O)}),o.sort(function(O,P){if(O.isSigner!==P.isSigner)return O.isSigner?-1:1;if(O.isWritable!==P.isWritable)return O.isWritable?-1:1;const H={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return O.pubkey.toBase58().localeCompare(P.pubkey.toBase58(),"en",H)});const a=o.findIndex(O=>O.pubkey.equals(n));if(a>-1){const[O]=o.splice(a,1);O.isSigner=!0,O.isWritable=!0,o.unshift(O)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const O of this.signatures){const P=o.findIndex(H=>H.pubkey.equals(O.publicKey));if(P>-1)o[P].isSigner||(o[P].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${O.publicKey.toString()}`)}let c=0,u=0,l=0;const y=[],A=[];o.forEach(({pubkey:O,isSigner:P,isWritable:H})=>{P?(y.push(O.toString()),c+=1,H||(u+=1)):(A.push(O.toString()),H||(l+=1))});const v=y.concat(A),R=r.map(O=>{const{data:P,programId:H}=O;return{programIdIndex:v.indexOf(H.toString()),accounts:O.keys.map(F=>v.indexOf(F.pubkey.toString())),data:Ar.encode(P)}});return R.forEach(O=>{sr(O.programIdIndex>=0),O.accounts.forEach(P=>sr(P>=0))}),new Pi({header:{numRequiredSignatures:c,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:l},accountKeys:v,recentBlockhash:t,instructions:R})}_compile(){const t=this.compileMessage(),r=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===r.length&&this.signatures.every((i,s)=>r[s].equals(i.publicKey))||(this.signatures=r.map(n=>({signature:null,publicKey:n}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const r=new Set;this.signatures=t.filter(n=>{const i=n.toString();return r.has(i)?!1:(r.add(i),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...t){if(t.length===0)throw new Error("No signers");const r=new Set,n=[];for(const s of t){const o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}this.signatures=n.map(s=>({signature:null,publicKey:s.publicKey}));const i=this._compile();this._partialSign(i,...n)}partialSign(...t){if(t.length===0)throw new Error("No signers");const r=new Set,n=[];for(const s of t){const o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}const i=this._compile();this._partialSign(i,...n)}_partialSign(t,...r){const n=t.serialize();r.forEach(i=>{const s=w1(n,i.secretKey);this._addSignature(i.publicKey,Uo(s))})}addSignature(t,r){this._compile(),this._addSignature(t,r)}_addSignature(t,r){sr(r.length===64);const n=this.signatures.findIndex(i=>t.equals(i.publicKey));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=ie.Buffer.from(r)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,r){const n={};for(const{signature:i,publicKey:s}of this.signatures)i===null?r&&(n.missing||=[]).push(s):Z3(i,t,s.toBytes())||(n.invalid||=[]).push(s);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:r,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),i=this.serializeMessage();if(n){const s=this._getMessageSignednessErrors(i,r);if(s){let o="Signature verification failed.";throw s.invalid&&(o+=` + */(function(e){const t=ef,r=Bl,n=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=a,e.SlowBuffer=F,e.INSPECT_MAX_BYTES=50;const i=2147483647;e.kMaxLength=i,a.TYPED_ARRAY_SUPPORT=s(),!a.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 s(){try{const C=new Uint8Array(1),w={foo:function(){return 42}};return Object.setPrototypeOf(w,Uint8Array.prototype),Object.setPrototypeOf(C,w),C.foo()===42}catch{return!1}}Object.defineProperty(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}});function o(C){if(C>i)throw new RangeError('The value "'+C+'" is invalid for option "size"');const w=new Uint8Array(C);return Object.setPrototypeOf(w,a.prototype),w}function a(C,w,b){if(typeof C=="number"){if(typeof w=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return y(C)}return c(C,w,b)}a.poolSize=8192;function c(C,w,b){if(typeof C=="string")return A(C,w);if(ArrayBuffer.isView(C))return R(C);if(C==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof C);if(Wt(C,ArrayBuffer)||C&&Wt(C.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Wt(C,SharedArrayBuffer)||C&&Wt(C.buffer,SharedArrayBuffer)))return O(C,w,b);if(typeof C=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const D=C.valueOf&&C.valueOf();if(D!=null&&D!==C)return a.from(D,w,b);const V=P(C);if(V)return V;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof C[Symbol.toPrimitive]=="function")return a.from(C[Symbol.toPrimitive]("string"),w,b);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof C)}a.from=function(C,w,b){return c(C,w,b)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array);function u(C){if(typeof C!="number")throw new TypeError('"size" argument must be of type number');if(C<0)throw new RangeError('The value "'+C+'" is invalid for option "size"')}function l(C,w,b){return u(C),C<=0?o(C):w!==void 0?typeof b=="string"?o(C).fill(w,b):o(C).fill(w):o(C)}a.alloc=function(C,w,b){return l(C,w,b)};function y(C){return u(C),o(C<0?0:H(C)|0)}a.allocUnsafe=function(C){return y(C)},a.allocUnsafeSlow=function(C){return y(C)};function A(C,w){if((typeof w!="string"||w==="")&&(w="utf8"),!a.isEncoding(w))throw new TypeError("Unknown encoding: "+w);const b=N(C,w)|0;let D=o(b);const V=D.write(C,w);return V!==b&&(D=D.slice(0,V)),D}function v(C){const w=C.length<0?0:H(C.length)|0,b=o(w);for(let D=0;D=i)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+i.toString(16)+" bytes");return C|0}function F(C){return+C!=C&&(C=0),a.alloc(+C)}a.isBuffer=function(w){return w!=null&&w._isBuffer===!0&&w!==a.prototype},a.compare=function(w,b){if(Wt(w,Uint8Array)&&(w=a.from(w,w.offset,w.byteLength)),Wt(b,Uint8Array)&&(b=a.from(b,b.offset,b.byteLength)),!a.isBuffer(w)||!a.isBuffer(b))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(w===b)return 0;let D=w.length,V=b.length;for(let X=0,ae=Math.min(D,V);XV.length?(a.isBuffer(ae)||(ae=a.from(ae)),ae.copy(V,X)):Uint8Array.prototype.set.call(V,ae,X);else if(a.isBuffer(ae))ae.copy(V,X);else throw new TypeError('"list" argument must be an Array of Buffers');X+=ae.length}return V};function N(C,w){if(a.isBuffer(C))return C.length;if(ArrayBuffer.isView(C)||Wt(C,ArrayBuffer))return C.byteLength;if(typeof C!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof C);const b=C.length,D=arguments.length>2&&arguments[2]===!0;if(!D&&b===0)return 0;let V=!1;for(;;)switch(w){case"ascii":case"latin1":case"binary":return b;case"utf8":case"utf-8":return He(C).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return b*2;case"hex":return b>>>1;case"base64":return ut(C).length;default:if(V)return D?-1:He(C).length;w=(""+w).toLowerCase(),V=!0}}a.byteLength=N;function $(C,w,b){let D=!1;if((w===void 0||w<0)&&(w=0),w>this.length||((b===void 0||b>this.length)&&(b=this.length),b<=0)||(b>>>=0,w>>>=0,b<=w))return"";for(C||(C="utf8");;)switch(C){case"hex":return x(this,w,b);case"utf8":case"utf-8":return f(this,w,b);case"ascii":return _(this,w,b);case"latin1":case"binary":return E(this,w,b);case"base64":return g(this,w,b);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,w,b);default:if(D)throw new TypeError("Unknown encoding: "+C);C=(C+"").toLowerCase(),D=!0}}a.prototype._isBuffer=!0;function q(C,w,b){const D=C[w];C[w]=C[b],C[b]=D}a.prototype.swap16=function(){const w=this.length;if(w%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let b=0;bb&&(w+=" ... "),""},n&&(a.prototype[n]=a.prototype.inspect),a.prototype.compare=function(w,b,D,V,X){if(Wt(w,Uint8Array)&&(w=a.from(w,w.offset,w.byteLength)),!a.isBuffer(w))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof w);if(b===void 0&&(b=0),D===void 0&&(D=w?w.length:0),V===void 0&&(V=0),X===void 0&&(X=this.length),b<0||D>w.length||V<0||X>this.length)throw new RangeError("out of range index");if(V>=X&&b>=D)return 0;if(V>=X)return-1;if(b>=D)return 1;if(b>>>=0,D>>>=0,V>>>=0,X>>>=0,this===w)return 0;let ae=X-V,Ze=D-b;const Ge=Math.min(ae,Ze),We=this.slice(V,X),jt=w.slice(b,D);for(let ze=0;ze2147483647?b=2147483647:b<-2147483648&&(b=-2147483648),b=+b,xt(b)&&(b=V?0:C.length-1),b<0&&(b=C.length+b),b>=C.length){if(V)return-1;b=C.length-1}else if(b<0)if(V)b=0;else return-1;if(typeof w=="string"&&(w=a.from(w,D)),a.isBuffer(w))return w.length===0?-1:Z(C,w,b,D,V);if(typeof w=="number")return w=w&255,typeof Uint8Array.prototype.indexOf=="function"?V?Uint8Array.prototype.indexOf.call(C,w,b):Uint8Array.prototype.lastIndexOf.call(C,w,b):Z(C,[w],b,D,V);throw new TypeError("val must be string, number or Buffer")}function Z(C,w,b,D,V){let X=1,ae=C.length,Ze=w.length;if(D!==void 0&&(D=String(D).toLowerCase(),D==="ucs2"||D==="ucs-2"||D==="utf16le"||D==="utf-16le")){if(C.length<2||w.length<2)return-1;X=2,ae/=2,Ze/=2,b/=2}function Ge(jt,ze){return X===1?jt[ze]:jt.readUInt16BE(ze*X)}let We;if(V){let jt=-1;for(We=b;Weae&&(b=ae-Ze),We=b;We>=0;We--){let jt=!0;for(let ze=0;zeV&&(D=V)):D=V;const X=w.length;D>X/2&&(D=X/2);let ae;for(ae=0;ae>>0,isFinite(D)?(D=D>>>0,V===void 0&&(V="utf8")):(V=D,D=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const X=this.length-b;if((D===void 0||D>X)&&(D=X),w.length>0&&(D<0||b<0)||b>this.length)throw new RangeError("Attempt to write outside buffer bounds");V||(V="utf8");let ae=!1;for(;;)switch(V){case"hex":return z(this,w,b,D);case"utf8":case"utf-8":return ee(this,w,b,D);case"ascii":case"latin1":case"binary":return se(this,w,b,D);case"base64":return Q(this,w,b,D);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,w,b,D);default:if(ae)throw new TypeError("Unknown encoding: "+V);V=(""+V).toLowerCase(),ae=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function g(C,w,b){return w===0&&b===C.length?t.fromByteArray(C):t.fromByteArray(C.slice(w,b))}function f(C,w,b){b=Math.min(C.length,b);const D=[];let V=w;for(;V239?4:X>223?3:X>191?2:1;if(V+Ze<=b){let Ge,We,jt,ze;switch(Ze){case 1:X<128&&(ae=X);break;case 2:Ge=C[V+1],(Ge&192)===128&&(ze=(X&31)<<6|Ge&63,ze>127&&(ae=ze));break;case 3:Ge=C[V+1],We=C[V+2],(Ge&192)===128&&(We&192)===128&&(ze=(X&15)<<12|(Ge&63)<<6|We&63,ze>2047&&(ze<55296||ze>57343)&&(ae=ze));break;case 4:Ge=C[V+1],We=C[V+2],jt=C[V+3],(Ge&192)===128&&(We&192)===128&&(jt&192)===128&&(ze=(X&15)<<18|(Ge&63)<<12|(We&63)<<6|jt&63,ze>65535&&ze<1114112&&(ae=ze))}}ae===null?(ae=65533,Ze=1):ae>65535&&(ae-=65536,D.push(ae>>>10&1023|55296),ae=56320|ae&1023),D.push(ae),V+=Ze}return m(D)}const h=4096;function m(C){const w=C.length;if(w<=h)return String.fromCharCode.apply(String,C);let b="",D=0;for(;DD)&&(b=D);let V="";for(let X=w;XD&&(w=D),b<0?(b+=D,b<0&&(b=0)):b>D&&(b=D),bb)throw new RangeError("Trying to access beyond buffer length")}a.prototype.readUintLE=a.prototype.readUIntLE=function(w,b,D){w=w>>>0,b=b>>>0,D||B(w,b,this.length);let V=this[w],X=1,ae=0;for(;++ae>>0,b=b>>>0,D||B(w,b,this.length);let V=this[w+--b],X=1;for(;b>0&&(X*=256);)V+=this[w+--b]*X;return V},a.prototype.readUint8=a.prototype.readUInt8=function(w,b){return w=w>>>0,b||B(w,1,this.length),this[w]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(w,b){return w=w>>>0,b||B(w,2,this.length),this[w]|this[w+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(w,b){return w=w>>>0,b||B(w,2,this.length),this[w]<<8|this[w+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(w,b){return w=w>>>0,b||B(w,4,this.length),(this[w]|this[w+1]<<8|this[w+2]<<16)+this[w+3]*16777216},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(w,b){return w=w>>>0,b||B(w,4,this.length),this[w]*16777216+(this[w+1]<<16|this[w+2]<<8|this[w+3])},a.prototype.readBigUInt64LE=Xt(function(w){w=w>>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=b+this[++w]*2**8+this[++w]*2**16+this[++w]*2**24,X=this[++w]+this[++w]*2**8+this[++w]*2**16+D*2**24;return BigInt(V)+(BigInt(X)<>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=b*2**24+this[++w]*2**16+this[++w]*2**8+this[++w],X=this[++w]*2**24+this[++w]*2**16+this[++w]*2**8+D;return(BigInt(V)<>>0,b=b>>>0,D||B(w,b,this.length);let V=this[w],X=1,ae=0;for(;++ae=X&&(V-=Math.pow(2,8*b)),V},a.prototype.readIntBE=function(w,b,D){w=w>>>0,b=b>>>0,D||B(w,b,this.length);let V=b,X=1,ae=this[w+--V];for(;V>0&&(X*=256);)ae+=this[w+--V]*X;return X*=128,ae>=X&&(ae-=Math.pow(2,8*b)),ae},a.prototype.readInt8=function(w,b){return w=w>>>0,b||B(w,1,this.length),this[w]&128?(255-this[w]+1)*-1:this[w]},a.prototype.readInt16LE=function(w,b){w=w>>>0,b||B(w,2,this.length);const D=this[w]|this[w+1]<<8;return D&32768?D|4294901760:D},a.prototype.readInt16BE=function(w,b){w=w>>>0,b||B(w,2,this.length);const D=this[w+1]|this[w]<<8;return D&32768?D|4294901760:D},a.prototype.readInt32LE=function(w,b){return w=w>>>0,b||B(w,4,this.length),this[w]|this[w+1]<<8|this[w+2]<<16|this[w+3]<<24},a.prototype.readInt32BE=function(w,b){return w=w>>>0,b||B(w,4,this.length),this[w]<<24|this[w+1]<<16|this[w+2]<<8|this[w+3]},a.prototype.readBigInt64LE=Xt(function(w){w=w>>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=this[w+4]+this[w+5]*2**8+this[w+6]*2**16+(D<<24);return(BigInt(V)<>>0,pe(w,"offset");const b=this[w],D=this[w+7];(b===void 0||D===void 0)&&we(w,this.length-8);const V=(b<<24)+this[++w]*2**16+this[++w]*2**8+this[++w];return(BigInt(V)<>>0,b||B(w,4,this.length),r.read(this,w,!0,23,4)},a.prototype.readFloatBE=function(w,b){return w=w>>>0,b||B(w,4,this.length),r.read(this,w,!1,23,4)},a.prototype.readDoubleLE=function(w,b){return w=w>>>0,b||B(w,8,this.length),r.read(this,w,!0,52,8)},a.prototype.readDoubleBE=function(w,b){return w=w>>>0,b||B(w,8,this.length),r.read(this,w,!1,52,8)};function d(C,w,b,D,V,X){if(!a.isBuffer(C))throw new TypeError('"buffer" argument must be a Buffer instance');if(w>V||wC.length)throw new RangeError("Index out of range")}a.prototype.writeUintLE=a.prototype.writeUIntLE=function(w,b,D,V){if(w=+w,b=b>>>0,D=D>>>0,!V){const Ze=Math.pow(2,8*D)-1;d(this,w,b,D,Ze,0)}let X=1,ae=0;for(this[b]=w&255;++ae>>0,D=D>>>0,!V){const Ze=Math.pow(2,8*D)-1;d(this,w,b,D,Ze,0)}let X=D-1,ae=1;for(this[b+X]=w&255;--X>=0&&(ae*=256);)this[b+X]=w/ae&255;return b+D},a.prototype.writeUint8=a.prototype.writeUInt8=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,1,255,0),this[b]=w&255,b+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,65535,0),this[b]=w&255,this[b+1]=w>>>8,b+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,65535,0),this[b]=w>>>8,this[b+1]=w&255,b+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,4294967295,0),this[b+3]=w>>>24,this[b+2]=w>>>16,this[b+1]=w>>>8,this[b]=w&255,b+4},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,4294967295,0),this[b]=w>>>24,this[b+1]=w>>>16,this[b+2]=w>>>8,this[b+3]=w&255,b+4};function k(C,w,b,D,V){Pe(w,D,V,C,b,7);let X=Number(w&BigInt(4294967295));C[b++]=X,X=X>>8,C[b++]=X,X=X>>8,C[b++]=X,X=X>>8,C[b++]=X;let ae=Number(w>>BigInt(32)&BigInt(4294967295));return C[b++]=ae,ae=ae>>8,C[b++]=ae,ae=ae>>8,C[b++]=ae,ae=ae>>8,C[b++]=ae,b}function W(C,w,b,D,V){Pe(w,D,V,C,b,7);let X=Number(w&BigInt(4294967295));C[b+7]=X,X=X>>8,C[b+6]=X,X=X>>8,C[b+5]=X,X=X>>8,C[b+4]=X;let ae=Number(w>>BigInt(32)&BigInt(4294967295));return C[b+3]=ae,ae=ae>>8,C[b+2]=ae,ae=ae>>8,C[b+1]=ae,ae=ae>>8,C[b]=ae,b+8}a.prototype.writeBigUInt64LE=Xt(function(w,b=0){return k(this,w,b,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=Xt(function(w,b=0){return W(this,w,b,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(w,b,D,V){if(w=+w,b=b>>>0,!V){const Ge=Math.pow(2,8*D-1);d(this,w,b,D,Ge-1,-Ge)}let X=0,ae=1,Ze=0;for(this[b]=w&255;++X>0)-Ze&255;return b+D},a.prototype.writeIntBE=function(w,b,D,V){if(w=+w,b=b>>>0,!V){const Ge=Math.pow(2,8*D-1);d(this,w,b,D,Ge-1,-Ge)}let X=D-1,ae=1,Ze=0;for(this[b+X]=w&255;--X>=0&&(ae*=256);)w<0&&Ze===0&&this[b+X+1]!==0&&(Ze=1),this[b+X]=(w/ae>>0)-Ze&255;return b+D},a.prototype.writeInt8=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,1,127,-128),w<0&&(w=255+w+1),this[b]=w&255,b+1},a.prototype.writeInt16LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,32767,-32768),this[b]=w&255,this[b+1]=w>>>8,b+2},a.prototype.writeInt16BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,2,32767,-32768),this[b]=w>>>8,this[b+1]=w&255,b+2},a.prototype.writeInt32LE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,2147483647,-2147483648),this[b]=w&255,this[b+1]=w>>>8,this[b+2]=w>>>16,this[b+3]=w>>>24,b+4},a.prototype.writeInt32BE=function(w,b,D){return w=+w,b=b>>>0,D||d(this,w,b,4,2147483647,-2147483648),w<0&&(w=4294967295+w+1),this[b]=w>>>24,this[b+1]=w>>>16,this[b+2]=w>>>8,this[b+3]=w&255,b+4},a.prototype.writeBigInt64LE=Xt(function(w,b=0){return k(this,w,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=Xt(function(w,b=0){return W(this,w,b,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function K(C,w,b,D,V,X){if(b+D>C.length)throw new RangeError("Index out of range");if(b<0)throw new RangeError("Index out of range")}function re(C,w,b,D,V){return w=+w,b=b>>>0,V||K(C,w,b,4),r.write(C,w,b,D,23,4),b+4}a.prototype.writeFloatLE=function(w,b,D){return re(this,w,b,!0,D)},a.prototype.writeFloatBE=function(w,b,D){return re(this,w,b,!1,D)};function xe(C,w,b,D,V){return w=+w,b=b>>>0,V||K(C,w,b,8),r.write(C,w,b,D,52,8),b+8}a.prototype.writeDoubleLE=function(w,b,D){return xe(this,w,b,!0,D)},a.prototype.writeDoubleBE=function(w,b,D){return xe(this,w,b,!1,D)},a.prototype.copy=function(w,b,D,V){if(!a.isBuffer(w))throw new TypeError("argument should be a Buffer");if(D||(D=0),!V&&V!==0&&(V=this.length),b>=w.length&&(b=w.length),b||(b=0),V>0&&V=this.length)throw new RangeError("Index out of range");if(V<0)throw new RangeError("sourceEnd out of bounds");V>this.length&&(V=this.length),w.length-b>>0,D=D===void 0?this.length:D>>>0,w||(w=0);let X;if(typeof w=="number")for(X=b;X2**32?V=tt(String(b)):typeof b=="bigint"&&(V=String(b),(b>BigInt(2)**BigInt(32)||b<-(BigInt(2)**BigInt(32)))&&(V=tt(V)),V+="n"),D+=` It must be ${w}. Received ${V}`,D},RangeError);function tt(C){let w="",b=C.length;const D=C[0]==="-"?1:0;for(;b>=D+4;b-=3)w=`_${C.slice(b-3,b)}${w}`;return`${C.slice(0,b)}${w}`}function Ue(C,w,b){pe(w,"offset"),(C[w]===void 0||C[w+b]===void 0)&&we(w,C.length-(b+1))}function Pe(C,w,b,D,V,X){if(C>b||C3?w===0||w===BigInt(0)?Ze=`>= 0${ae} and < 2${ae} ** ${(X+1)*8}${ae}`:Ze=`>= -(2${ae} ** ${(X+1)*8-1}${ae}) and < 2 ** ${(X+1)*8-1}${ae}`:Ze=`>= ${w}${ae} and <= ${b}${ae}`,new be.ERR_OUT_OF_RANGE("value",Ze,C)}Ue(D,V,X)}function pe(C,w){if(typeof C!="number")throw new be.ERR_INVALID_ARG_TYPE(w,"number",C)}function we(C,w,b){throw Math.floor(C)!==C?(pe(C,b),new be.ERR_OUT_OF_RANGE(b||"offset","an integer",C)):w<0?new be.ERR_BUFFER_OUT_OF_BOUNDS:new be.ERR_OUT_OF_RANGE(b||"offset",`>= ${b?1:0} and <= ${w}`,C)}const ke=/[^+/0-9A-Za-z-_]/g;function vt(C){if(C=C.split("=")[0],C=C.trim().replace(ke,""),C.length<2)return"";for(;C.length%4!==0;)C=C+"=";return C}function He(C,w){w=w||1/0;let b;const D=C.length;let V=null;const X=[];for(let ae=0;ae55295&&b<57344){if(!V){if(b>56319){(w-=3)>-1&&X.push(239,191,189);continue}else if(ae+1===D){(w-=3)>-1&&X.push(239,191,189);continue}V=b;continue}if(b<56320){(w-=3)>-1&&X.push(239,191,189),V=b;continue}b=(V-55296<<10|b-56320)+65536}else V&&(w-=3)>-1&&X.push(239,191,189);if(V=null,b<128){if((w-=1)<0)break;X.push(b)}else if(b<2048){if((w-=2)<0)break;X.push(b>>6|192,b&63|128)}else if(b<65536){if((w-=3)<0)break;X.push(b>>12|224,b>>6&63|128,b&63|128)}else if(b<1114112){if((w-=4)<0)break;X.push(b>>18|240,b>>12&63|128,b>>6&63|128,b&63|128)}else throw new Error("Invalid code point")}return X}function it(C){const w=[];for(let b=0;b>8,V=b%256,X.push(V),X.push(D);return X}function ut(C){return t.toByteArray(vt(C))}function pt(C,w,b,D){let V;for(V=0;V=w.length||V>=C.length);++V)w[V+b]=C[V];return V}function Wt(C,w){return C instanceof w||C!=null&&C.constructor!=null&&C.constructor.name!=null&&C.constructor.name===w.name}function xt(C){return C!==C}const At=function(){const C="0123456789abcdef",w=new Array(256);for(let b=0;b<16;++b){const D=b*16;for(let V=0;V<16;++V)w[D+V]=C[b]+C[V]}return w}();function Xt(C){return typeof BigInt>"u"?Tt:C}function Tt(){throw new Error("BigInt not supported")}})(ie);var Dn={exports:{}},Ao=typeof Reflect=="object"?Reflect:null,$p=Ao&&typeof Ao.apply=="function"?Ao.apply:function(t,r,n){return Function.prototype.apply.call(t,r,n)},tf;Ao&&typeof Ao.ownKeys=="function"?tf=Ao.ownKeys:Object.getOwnPropertySymbols?tf=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:tf=function(t){return Object.getOwnPropertyNames(t)};function LE(e){console&&console.warn&&console.warn(e)}var Op=Number.isNaN||function(t){return t!==t};function Zt(){Zt.init.call(this)}Dn.exports=Zt,Dn.exports.once=NE,Zt.EventEmitter=Zt,Zt.prototype._events=void 0,Zt.prototype._eventsCount=0,Zt.prototype._maxListeners=void 0;var Mp=10;function rf(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Zt,"defaultMaxListeners",{enumerable:!0,get:function(){return Mp},set:function(e){if(typeof e!="number"||e<0||Op(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Mp=e}}),Zt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Zt.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||Op(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Np(e){return e._maxListeners===void 0?Zt.defaultMaxListeners:e._maxListeners}Zt.prototype.getMaxListeners=function(){return Np(this)},Zt.prototype.emit=function(t){for(var r=[],n=1;n0&&(o=r[0]),o instanceof Error)throw o;var a=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var c=s[t];if(c===void 0)return!1;if(typeof c=="function")$p(c,this,r);else for(var u=c.length,l=Hp(c,u),n=0;n0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,LE(a)}return e}Zt.prototype.addListener=function(t,r){return Pp(this,t,r,!1)},Zt.prototype.on=Zt.prototype.addListener,Zt.prototype.prependListener=function(t,r){return Pp(this,t,r,!0)};function $E(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Up(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=$E.bind(n);return i.listener=r,n.wrapFn=i,i}Zt.prototype.once=function(t,r){return rf(r),this.on(t,Up(this,t,r)),this},Zt.prototype.prependOnceListener=function(t,r){return rf(r),this.prependListener(t,Up(this,t,r)),this},Zt.prototype.removeListener=function(t,r){var n,i,s,o,a;if(rf(r),i=this._events,i===void 0)return this;if(n=i[t],n===void 0)return this;if(n===r||n.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete i[t],i.removeListener&&this.emit("removeListener",t,n.listener||r));else if(typeof n!="function"){for(s=-1,o=n.length-1;o>=0;o--)if(n[o]===r||n[o].listener===r){a=n[o].listener,s=o;break}if(s<0)return this;s===0?n.shift():OE(n,s),n.length===1&&(i[t]=n[0]),i.removeListener!==void 0&&this.emit("removeListener",t,a||r)}return this},Zt.prototype.off=Zt.prototype.removeListener,Zt.prototype.removeAllListeners=function(t){var r,n,i;if(n=this._events,n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[t]),this;if(arguments.length===0){var s=Object.keys(n),o;for(i=0;i=0;i--)this.removeListener(t,r[i]);return this};function Fp(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?ME(i):Hp(i,i.length)}Zt.prototype.listeners=function(t){return Fp(this,t,!0)},Zt.prototype.rawListeners=function(t){return Fp(this,t,!1)},Zt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Dp.call(e,t)},Zt.prototype.listenerCount=Dp;function Dp(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Zt.prototype.eventNames=function(){return this._eventsCount>0?tf(this._events):[]};function Hp(e,t){for(var r=new Array(t),n=0;nt in e?UE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,zE=(e,t)=>{for(var r in t||(t={}))HE.call(t,r)&&qp(e,r,t[r]);if(zp)for(var r of zp(t))jE.call(t,r)&&qp(e,r,t[r]);return e},qE=(e,t)=>FE(e,DE(t));class VE extends nf{constructor(){super($a.CALLBACK),this.callback=new Map}async request(t,r){return new Promise((n,i)=>{const s=new Date().getTime()+Math.floor(Math.random()*1e3);this.callback.set(s.toString(),{reject:i,resolve:n}),super.request(qE(zE({},t),{id:s}),r)})}sendResponse(t,r){if(this.callback.has(t.toString())){const n=this.callback.get(t.toString());this.callback.delete(t.toString()),n?.resolve(r)}else console.error(`Unable to find callback for requestId: ${t}`)}sendError(t,r){if(this.callback.has(t.toString())){const n=this.callback.get(t.toString());this.callback.delete(t.toString()),n?.reject(r)}else console.error(`Unable to find callback for requestId: ${t}`)}}class WE extends nf{constructor(){super($a.PROMISES)}request(t,r){return super.request(t,r)}}class Il extends Dn.exports.EventEmitter{setAdapter(t){return this.adapter=t,this}async request(t){try{if(!this.adapter)throw new Error("No adapter set, maybe you forgot to register the provider?");const r=await this.adapter.request(t,this.getNetwork());return this.emit("onResponseReady",t,r),r}catch(r){throw r}}sendResponse(t,r){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==$a.CALLBACK)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendResponse(t,r)}sendError(t,r){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==$a.CALLBACK)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendError(t,r)}}class KE{constructor(t){const r=t.strategy===$a.CALLBACK?new VE:new WE;t.handler&&r.setHandler(t.handler),this.setAdapter(r)}setHandler(t){this.adapter.setHandler(t)}setAdapter(t){return this.adapter=t,this}registerProvider(t){return t.setAdapter(this.adapter),this}registerProviders(t){return t.forEach(r=>this.registerProvider(r)),this}sendResponse(t,r){this.adapter.getStrategy()==="CALLBACK"&&this.adapter.sendResponse(t,r)}sendError(t,r){this.adapter.getStrategy()==="CALLBACK"&&this.adapter.sendError(t,r)}}function Vp(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function ZE(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function sf(e,...t){if(!ZE(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function GE(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Vp(e.outputLen),Vp(e.blockLen)}function of(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function YE(e,t){sf(e);const r=t.outputLen;if(e.lengthnew DataView(e.buffer,e.byteOffset,e.byteLength),gi=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];function Wp(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function kl(e){return typeof e=="string"&&(e=Wp(e)),sf(e),e}function Kp(...e){let t=0;for(let n=0;ne().update(kl(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function Yp(e=32){if(Rl&&typeof Rl.getRandomValues=="function")return Rl.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function XE(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,a,n)}const JE=(e,t,r)=>e&t^~e&r,QE=(e,t,r)=>e&t^e&r^t&r;class Xp extends Zp{constructor(t,r,n,i){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Tl(this.buffer)}update(t){of(this);const{view:r,buffer:n,blockLen:i}=this;t=kl(t);const s=t.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let y=o;yl.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;y>Cl&af)}:{h:Number(e>>Cl&af)|0,l:Number(e&af)|0}}function ex(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0),rx=(e,t,r)=>e>>>r,nx=(e,t,r)=>e<<32-r|t>>>r,ix=(e,t,r)=>e>>>r|t<<32-r,sx=(e,t,r)=>e<<32-r|t>>>r,ox=(e,t,r)=>e<<64-r|t>>>r-32,ax=(e,t,r)=>e>>>r-32|t<<64-r,cx=(e,t)=>t,fx=(e,t)=>e,ux=(e,t,r)=>e<>>32-r,lx=(e,t,r)=>t<>>32-r,hx=(e,t,r)=>t<>>64-r,dx=(e,t,r)=>e<>>64-r;function px(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}const mt={fromBig:Jp,split:ex,toBig:tx,shrSH:rx,shrSL:nx,rotrSH:ix,rotrSL:sx,rotrBH:ox,rotrBL:ax,rotr32H:cx,rotr32L:fx,rotlSH:ux,rotlSL:lx,rotlBH:hx,rotlBL:dx,add:px,add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},[gx,yx]=(()=>mt.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),es=new Uint32Array(80),ts=new Uint32Array(80);class wx extends Xp{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:t,Al:r,Bh:n,Bl:i,Ch:s,Cl:o,Dh:a,Dl:c,Eh:u,El:l,Fh:y,Fl:A,Gh:v,Gl:R,Hh:O,Hl:P}=this;return[t,r,n,i,s,o,a,c,u,l,y,A,v,R,O,P]}set(t,r,n,i,s,o,a,c,u,l,y,A,v,R,O,P){this.Ah=t|0,this.Al=r|0,this.Bh=n|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=l|0,this.Fh=y|0,this.Fl=A|0,this.Gh=v|0,this.Gl=R|0,this.Hh=O|0,this.Hl=P|0}process(t,r){for(let N=0;N<16;N++,r+=4)es[N]=t.getUint32(r),ts[N]=t.getUint32(r+=4);for(let N=16;N<80;N++){const $=es[N-15]|0,q=ts[N-15]|0,G=mt.rotrSH($,q,1)^mt.rotrSH($,q,8)^mt.shrSH($,q,7),Z=mt.rotrSL($,q,1)^mt.rotrSL($,q,8)^mt.shrSL($,q,7),z=es[N-2]|0,ee=ts[N-2]|0,se=mt.rotrSH(z,ee,19)^mt.rotrBH(z,ee,61)^mt.shrSH(z,ee,6),Q=mt.rotrSL(z,ee,19)^mt.rotrBL(z,ee,61)^mt.shrSL(z,ee,6),I=mt.add4L(Z,Q,ts[N-7],ts[N-16]),g=mt.add4H(I,G,se,es[N-7],es[N-16]);es[N]=g|0,ts[N]=I|0}let{Ah:n,Al:i,Bh:s,Bl:o,Ch:a,Cl:c,Dh:u,Dl:l,Eh:y,El:A,Fh:v,Fl:R,Gh:O,Gl:P,Hh:H,Hl:F}=this;for(let N=0;N<80;N++){const $=mt.rotrSH(y,A,14)^mt.rotrSH(y,A,18)^mt.rotrBH(y,A,41),q=mt.rotrSL(y,A,14)^mt.rotrSL(y,A,18)^mt.rotrBL(y,A,41),G=y&v^~y&O,Z=A&R^~A&P,z=mt.add5L(F,q,Z,yx[N],ts[N]),ee=mt.add5H(z,H,$,G,gx[N],es[N]),se=z|0,Q=mt.rotrSH(n,i,28)^mt.rotrBH(n,i,34)^mt.rotrBH(n,i,39),I=mt.rotrSL(n,i,28)^mt.rotrBL(n,i,34)^mt.rotrBL(n,i,39),g=n&s^n&a^s&a,f=i&o^i&c^o&c;H=O|0,F=P|0,O=v|0,P=R|0,v=y|0,R=A|0,{h:y,l:A}=mt.add(u|0,l|0,ee|0,se|0),u=a|0,l=c|0,a=s|0,c=o|0,s=n|0,o=i|0;const h=mt.add3L(se,I,f);n=mt.add3H(h,ee,Q,g),i=h|0}({h:n,l:i}=mt.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:s,l:o}=mt.add(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l:c}=mt.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l}=mt.add(this.Dh|0,this.Dl|0,u|0,l|0),{h:y,l:A}=mt.add(this.Eh|0,this.El|0,y|0,A|0),{h:v,l:R}=mt.add(this.Fh|0,this.Fl|0,v|0,R|0),{h:O,l:P}=mt.add(this.Gh|0,this.Gl|0,O|0,P|0),{h:H,l:F}=mt.add(this.Hh|0,this.Hl|0,H|0,F|0),this.set(n,i,s,o,a,c,u,l,y,A,v,R,O,P,H,F)}roundClean(){es.fill(0),ts.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Qp=Gp(()=>new wx);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const eg=BigInt(0),cf=BigInt(1),mx=BigInt(2);function Ds(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Oa(e){if(!Ds(e))throw new Error("Uint8Array expected")}const bx=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Hs(e){Oa(e);let t="";for(let r=0;r=Ci._0&&e<=Ci._9)return e-Ci._0;if(e>=Ci._A&&e<=Ci._F)return e-(Ci._A-10);if(e>=Ci._a&&e<=Ci._f)return e-(Ci._a-10)}function Bo(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let i=0,s=0;ieg;e>>=cf,t+=1);return t}function Sx(e,t){return e>>BigInt(t)&cf}function Ax(e,t,r){return e|(r?cf:eg)<(mx<new Uint8Array(e),ng=e=>Uint8Array.from(e);function ig(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Ol(e),i=Ol(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Ol())=>{i=a(ng([0]),y),n=a(),y.length!==0&&(i=a(ng([1]),y),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const A=[];for(;y{o(),c(y);let v;for(;!(v=A(u()));)c();return o(),v}}const Bx={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ds(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function To(e,t,r={}){const n=(i,s,o)=>{const a=Bx[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(t))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return e}var Ix=Object.freeze({__proto__:null,isBytes:Ds,abytes:Oa,bytesToHex:Hs,numberToHexUnpadded:tg,hexToNumber:Ll,hexToBytes:Bo,bytesToNumberBE:js,bytesToNumberLE:Io,numberToBytesBE:Ro,numberToBytesLE:Ma,numberToVarBytesBE:vx,ensureBytes:Cr,concatBytes:zs,equalBytes:_x,utf8ToBytes:Ex,bitLen:xx,bitGet:Sx,bitSet:Ax,bitMask:$l,createHmacDrbg:ig,validateObject:To});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fr=BigInt(0),hr=BigInt(1),qs=BigInt(2),Rx=BigInt(3),Ml=BigInt(4),sg=BigInt(5),og=BigInt(8);BigInt(9),BigInt(16);function ir(e,t){const r=e%t;return r>=Fr?r:t+r}function Tx(e,t,r){if(r<=Fr||t 0");if(r===hr)return Fr;let n=hr;for(;t>Fr;)t&hr&&(n=n*e%r),e=e*e%r,t>>=hr;return n}function wr(e,t,r){let n=e;for(;t-- >Fr;)n*=n,n%=r;return n}function Nl(e,t){if(e===Fr||t<=Fr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=ir(e,t),n=t,i=Fr,s=hr;for(;r!==Fr;){const a=n/r,c=n%r,u=i-s*a;n=r,r=c,i=s,s=u}if(n!==hr)throw new Error("invert: does not exist");return ir(i,t)}function kx(e){const t=(e-hr)/qs;let r,n,i;for(r=e-hr,n=0;r%qs===Fr;r/=qs,n++);for(i=qs;i(ir(e,t)&hr)===hr,$x=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ox(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=$x.reduce((n,i)=>(n[i]="function",n),t);return To(e,r)}function Mx(e,t,r){if(r 0");if(r===Fr)return e.ONE;if(r===hr)return t;let n=e.ONE,i=t;for(;r>Fr;)r&hr&&(n=e.mul(n,i)),i=e.sqr(i),r>>=hr;return n}function Nx(e,t){const r=new Array(t.length),n=t.reduce((s,o,a)=>e.is0(o)?s:(r[a]=s,e.mul(s,o)),e.ONE),i=e.inv(n);return t.reduceRight((s,o,a)=>e.is0(o)?s:(r[a]=e.mul(s,r[a]),e.mul(s,o)),i),r}function ag(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function cg(e,t,r=!1,n={}){if(e<=Fr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=ag(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Cx(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:s,MASK:$l(i),ZERO:Fr,ONE:hr,create:c=>ir(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Fr<=c&&cc===Fr,isOdd:c=>(c&hr)===hr,neg:c=>ir(-c,e),eql:(c,u)=>c===u,sqr:c=>ir(c*c,e),add:(c,u)=>ir(c+u,e),sub:(c,u)=>ir(c-u,e),mul:(c,u)=>ir(c*u,e),pow:(c,u)=>Mx(a,c,u),div:(c,u)=>ir(c*Nl(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Nl(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>Nx(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?Ma(c,s):Ro(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?Io(c):js(c)}});return Object.freeze(a)}function Px(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}function fg(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function ug(e){const t=fg(e);return t+Math.ceil(t/2)}function Ux(e,t,r=!1){const n=e.length,i=fg(t),s=ug(t);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?js(e):Io(e),a=ir(o,t-hr)+hr;return r?Ma(a,i):Ro(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fx=BigInt(0),Pl=BigInt(1);function lg(e,t){const r=(i,s)=>{const o=s.negate();return i?o:s},n=i=>{const s=Math.ceil(t/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=e.ZERO,a=i;for(;s>Fx;)s&Pl&&(o=o.add(a)),a=a.double(),s>>=Pl;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=n(s),c=[];let u=i,l=u;for(let y=0;y>=v,P>c&&(P-=A,o+=Pl);const H=O,F=O+Math.abs(P)-1,N=R%2!==0,$=P<0;P===0?l=l.add(r(N,s[H])):u=u.add(r($,s[F]))}return{p:u,f:l}},wNAFCached(i,s,o,a){const c=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&s.set(i,a(u))),this.wNAF(c,u,o)}}}function Ul(e){return Ox(e.Fp),To(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ag(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ri=BigInt(0),An=BigInt(1),ff=BigInt(2),Dx=BigInt(8),Hx={zip215:!0};function jx(e){const t=Ul(e);return To(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Fl(e){const t=jx(e),{Fp:r,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=t,u=ff<{try{return{isValid:!0,value:r.sqrt(E*r.inv(x))}}catch{return{isValid:!1,value:ri}}}),A=t.adjustScalarBytes||(E=>E),v=t.domain||((E,x,T)=>{if(x.length||T)throw new Error("Contexts/pre-hash are not supported");return E}),R=E=>typeof E=="bigint"&&riR(E)&&R(x)&&EE===ri||O(E,u);function H(E,x){if(O(E,x))return E;throw new Error(`Expected valid scalar < ${x}, got ${typeof E} ${E}`)}function F(E){return E===ri?E:H(E,n)}const N=new Map;function $(E){if(!(E instanceof q))throw new Error("ExtendedPoint expected")}class q{constructor(x,T,B,d){if(this.ex=x,this.ey=T,this.ez=B,this.et=d,!P(x))throw new Error("x required");if(!P(T))throw new Error("y required");if(!P(B))throw new Error("z required");if(!P(d))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(x){if(x instanceof q)throw new Error("extended point not allowed");const{x:T,y:B}=x||{};if(!P(T)||!P(B))throw new Error("invalid affine point");return new q(T,B,An,l(T*B))}static normalizeZ(x){const T=r.invertBatch(x.map(B=>B.ez));return x.map((B,d)=>B.toAffine(T[d])).map(q.fromAffine)}_setWindowSize(x){this._WINDOW_SIZE=x,N.delete(this)}assertValidity(){const{a:x,d:T}=t;if(this.is0())throw new Error("bad point: ZERO");const{ex:B,ey:d,ez:k,et:W}=this,K=l(B*B),re=l(d*d),xe=l(k*k),be=l(xe*xe),ge=l(K*x),tt=l(xe*l(ge+re)),Ue=l(be+l(T*l(K*re)));if(tt!==Ue)throw new Error("bad point: equation left != right (1)");const Pe=l(B*d),pe=l(k*W);if(Pe!==pe)throw new Error("bad point: equation left != right (2)")}equals(x){$(x);const{ex:T,ey:B,ez:d}=this,{ex:k,ey:W,ez:K}=x,re=l(T*K),xe=l(k*d),be=l(B*K),ge=l(W*d);return re===xe&&be===ge}is0(){return this.equals(q.ZERO)}negate(){return new q(l(-this.ex),this.ey,this.ez,l(-this.et))}double(){const{a:x}=t,{ex:T,ey:B,ez:d}=this,k=l(T*T),W=l(B*B),K=l(ff*l(d*d)),re=l(x*k),xe=T+B,be=l(l(xe*xe)-k-W),ge=re+W,tt=ge-K,Ue=re-W,Pe=l(be*tt),pe=l(ge*Ue),we=l(be*Ue),ke=l(tt*ge);return new q(Pe,pe,ke,we)}add(x){$(x);const{a:T,d:B}=t,{ex:d,ey:k,ez:W,et:K}=this,{ex:re,ey:xe,ez:be,et:ge}=x;if(T===BigInt(-1)){const Wt=l((k-d)*(xe+re)),xt=l((k+d)*(xe-re)),At=l(xt-Wt);if(At===ri)return this.double();const Xt=l(W*ff*ge),Tt=l(K*ff*be),C=Tt+Xt,w=xt+Wt,b=Tt-Xt,D=l(C*At),V=l(w*b),X=l(C*b),ae=l(At*w);return new q(D,V,ae,X)}const tt=l(d*re),Ue=l(k*xe),Pe=l(K*B*ge),pe=l(W*be),we=l((d+k)*(re+xe)-tt-Ue),ke=pe-Pe,vt=pe+Pe,He=l(Ue-T*tt),it=l(we*ke),Ht=l(vt*He),ut=l(we*He),pt=l(ke*vt);return new q(it,Ht,pt,ut)}subtract(x){return this.add(x.negate())}wNAF(x){return z.wNAFCached(this,N,x,q.normalizeZ)}multiply(x){const{p:T,f:B}=this.wNAF(H(x,n));return q.normalizeZ([T,B])[0]}multiplyUnsafe(x){let T=F(x);return T===ri?Z:this.equals(Z)||T===An?this:this.equals(G)?this.wNAF(T).p:z.unsafeLadder(this,T)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return z.unsafeLadder(this,n).is0()}toAffine(x){const{ex:T,ey:B,ez:d}=this,k=this.is0();x==null&&(x=k?Dx:r.inv(d));const W=l(T*x),K=l(B*x),re=l(d*x);if(k)return{x:ri,y:An};if(re!==An)throw new Error("invZ was invalid");return{x:W,y:K}}clearCofactor(){const{h:x}=t;return x===An?this:this.multiplyUnsafe(x)}static fromHex(x,T=!1){const{d:B,a:d}=t,k=r.BYTES;x=Cr("pointHex",x,k);const W=x.slice(),K=x[k-1];W[k-1]=K&-129;const re=Io(W);re===ri||(T?H(re,u):H(re,r.ORDER));const xe=l(re*re),be=l(xe-An),ge=l(B*xe-d);let{isValid:tt,value:Ue}=y(be,ge);if(!tt)throw new Error("Point.fromHex: invalid y coordinate");const Pe=(Ue&An)===An,pe=(K&128)!==0;if(!T&&Ue===ri&&pe)throw new Error("Point.fromHex: x=0 and x_0=1");return pe!==Pe&&(Ue=l(-Ue)),q.fromAffine({x:Ue,y:re})}static fromPrivateKey(x){return Q(x).point}toRawBytes(){const{x,y:T}=this.toAffine(),B=Ma(T,r.BYTES);return B[B.length-1]|=x&An?128:0,B}toHex(){return Hs(this.toRawBytes())}}q.BASE=new q(t.Gx,t.Gy,An,l(t.Gx*t.Gy)),q.ZERO=new q(ri,An,An,ri);const{BASE:G,ZERO:Z}=q,z=lg(q,a*8);function ee(E){return ir(E,n)}function se(E){return ee(Io(E))}function Q(E){const x=a;E=Cr("private key",E,x);const T=Cr("hashed private key",s(E),2*x),B=A(T.slice(0,x)),d=T.slice(x,2*x),k=se(B),W=G.multiply(k),K=W.toRawBytes();return{head:B,prefix:d,scalar:k,point:W,pointBytes:K}}function I(E){return Q(E).pointBytes}function g(E=new Uint8Array,...x){const T=zs(...x);return se(s(v(T,Cr("context",E),!!i)))}function f(E,x,T={}){E=Cr("message",E),i&&(E=i(E));const{prefix:B,scalar:d,pointBytes:k}=Q(x),W=g(T.context,B,E),K=G.multiply(W).toRawBytes(),re=g(T.context,K,k,E),xe=ee(W+re*d);F(xe);const be=zs(K,Ma(xe,r.BYTES));return Cr("result",be,a*2)}const h=Hx;function m(E,x,T,B=h){const{context:d,zip215:k}=B,W=r.BYTES;E=Cr("signature",E,2*W),x=Cr("message",x),i&&(x=i(x));const K=Io(E.slice(W,2*W));let re,xe,be;try{re=q.fromHex(T,k),xe=q.fromHex(E.slice(0,W),k),be=G.multiplyUnsafe(K)}catch{return!1}if(!k&&re.isSmallOrder())return!1;const ge=g(d,xe.toRawBytes(),re.toRawBytes(),x);return xe.add(re.multiplyUnsafe(ge)).subtract(be).clearCofactor().equals(q.ZERO)}return G._setWindowSize(8),{CURVE:t,getPublicKey:I,sign:f,verify:m,ExtendedPoint:q,utils:{getExtendedPublicKey:Q,randomPrivateKey:()=>o(r.BYTES),precompute(E=8,x=q.BASE){return x._setWindowSize(E),x.multiply(BigInt(3)),x}}}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */BigInt(0),BigInt(1);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Dl=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),hg=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const zx=BigInt(1),Hl=BigInt(2),qx=BigInt(5),dg=BigInt(10),Vx=BigInt(20),Wx=BigInt(40),pg=BigInt(80);function Kx(e){const t=Dl,n=e*e%t*e%t,i=wr(n,Hl,t)*n%t,s=wr(i,zx,t)*e%t,o=wr(s,qx,t)*s%t,a=wr(o,dg,t)*o%t,c=wr(a,Vx,t)*a%t,u=wr(c,Wx,t)*c%t,l=wr(u,pg,t)*u%t,y=wr(l,pg,t)*u%t,A=wr(y,dg,t)*o%t;return{pow_p_5_8:wr(A,Hl,t)*e%t,b2:n}}function Zx(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function Gx(e,t){const r=Dl,n=ir(t*t*t,r),i=ir(n*n*t,r),s=Kx(e*i).pow_p_5_8;let o=ir(e*n*s,r);const a=ir(t*o*o,r),c=o,u=ir(o*hg,r),l=a===e,y=a===ir(-e,r),A=a===ir(-e*hg,r);return l&&(o=c),(y||A)&&(o=u),Lx(o,r)&&(o=ir(-o,r)),{isValid:l||y,value:o}}const Li=cg(Dl,void 0,!0),jl={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Li,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Qp,randomBytes:Yp,adjustScalarBytes:Zx,uvRatio:Gx},uf=Fl(jl);function gg(e,t,r){if(t.length>255)throw new Error("Context is too big");return Kp(Wp("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}({...jl},{...jl});const Yx=(Li.ORDER+BigInt(3))/BigInt(8);Li.pow(Hl,Yx),Li.sqrt(Li.neg(Li.ONE)),(Li.ORDER-BigInt(5))/BigInt(8),BigInt(486662),Px(Li,Li.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var zl={exports:{}},Xx={},Jx=Object.freeze({__proto__:null,default:Xx}),yg=Un(Jx);(function(e){(function(t,r){function n(g,f){if(!g)throw new Error(f||"Assertion failed")}function i(g,f){g.super_=f;var h=function(){};h.prototype=f.prototype,g.prototype=new h,g.prototype.constructor=g}function s(g,f,h){if(s.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((f==="le"||f==="be")&&(h=f,f=10),this._init(g||0,f||10,h||"be"))}typeof t=="object"?t.exports=s:r.BN=s,s.BN=s,s.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=yg.Buffer}catch{}s.isBN=function(f){return f instanceof s?!0:f!==null&&typeof f=="object"&&f.constructor.wordSize===s.wordSize&&Array.isArray(f.words)},s.max=function(f,h){return f.cmp(h)>0?f:h},s.min=function(f,h){return f.cmp(h)<0?f:h},s.prototype._init=function(f,h,m){if(typeof f=="number")return this._initNumber(f,h,m);if(typeof f=="object")return this._initArray(f,h,m);h==="hex"&&(h=16),n(h===(h|0)&&h>=2&&h<=36),f=f.toString().replace(/\s+/g,"");var _=0;f[0]==="-"&&(_++,this.negative=1),_=0;_-=3)x=f[_]|f[_-1]<<8|f[_-2]<<16,this.words[E]|=x<>>26-T&67108863,T+=24,T>=26&&(T-=26,E++);else if(m==="le")for(_=0,E=0;_>>26-T&67108863,T+=24,T>=26&&(T-=26,E++);return this._strip()};function a(g,f){var h=g.charCodeAt(f);if(h>=48&&h<=57)return h-48;if(h>=65&&h<=70)return h-55;if(h>=97&&h<=102)return h-87;n(!1,"Invalid character in "+g)}function c(g,f,h){var m=a(g,h);return h-1>=f&&(m|=a(g,h-1)<<4),m}s.prototype._parseHex=function(f,h,m){this.length=Math.ceil((f.length-h)/6),this.words=new Array(this.length);for(var _=0;_=h;_-=2)T=c(f,h,_)<=18?(E-=18,x+=1,this.words[x]|=T>>>26):E+=8;else{var B=f.length-h;for(_=B%2===0?h+1:h;_=18?(E-=18,x+=1,this.words[x]|=T>>>26):E+=8}this._strip()};function u(g,f,h,m){for(var _=0,E=0,x=Math.min(g.length,h),T=f;T=49?E=B-49+10:B>=17?E=B-17+10:E=B,n(B>=0&&E1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=y}catch{s.prototype.inspect=y}else s.prototype.inspect=y;function y(){return(this.red?""}var A=["","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"],v=[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],R=[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];s.prototype.toString=function(f,h){f=f||10,h=h|0||1;var m;if(f===16||f==="hex"){m="";for(var _=0,E=0,x=0;x>>24-_&16777215,_+=2,_>=26&&(_-=26,x--),E!==0||x!==this.length-1?m=A[6-B.length]+B+m:m=B+m}for(E!==0&&(m=E.toString(16)+m);m.length%h!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}if(f===(f|0)&&f>=2&&f<=36){var d=v[f],k=R[f];m="";var W=this.clone();for(W.negative=0;!W.isZero();){var K=W.modrn(k).toString(f);W=W.idivn(k),W.isZero()?m=K+m:m=A[d-K.length]+K+m}for(this.isZero()&&(m="0"+m);m.length%h!==0;)m="0"+m;return this.negative!==0&&(m="-"+m),m}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var f=this.words[0];return this.length===2?f+=this.words[1]*67108864:this.length===3&&this.words[2]===1?f+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-f:f},s.prototype.toJSON=function(){return this.toString(16,2)},o&&(s.prototype.toBuffer=function(f,h){return this.toArrayLike(o,f,h)}),s.prototype.toArray=function(f,h){return this.toArrayLike(Array,f,h)};var O=function(f,h){return f.allocUnsafe?f.allocUnsafe(h):new f(h)};s.prototype.toArrayLike=function(f,h,m){this._strip();var _=this.byteLength(),E=m||Math.max(1,_);n(_<=E,"byte array longer than desired length"),n(E>0,"Requested array length <= 0");var x=O(f,E),T=h==="le"?"LE":"BE";return this["_toArrayLike"+T](x,_),x},s.prototype._toArrayLikeLE=function(f,h){for(var m=0,_=0,E=0,x=0;E>8&255),m>16&255),x===6?(m>24&255),_=0,x=0):(_=T>>>24,x+=2)}if(m=0&&(f[m--]=T>>8&255),m>=0&&(f[m--]=T>>16&255),x===6?(m>=0&&(f[m--]=T>>24&255),_=0,x=0):(_=T>>>24,x+=2)}if(m>=0)for(f[m--]=_;m>=0;)f[m--]=0},Math.clz32?s.prototype._countBits=function(f){return 32-Math.clz32(f)}:s.prototype._countBits=function(f){var h=f,m=0;return h>=4096&&(m+=13,h>>>=13),h>=64&&(m+=7,h>>>=7),h>=8&&(m+=4,h>>>=4),h>=2&&(m+=2,h>>>=2),m+h},s.prototype._zeroBits=function(f){if(f===0)return 26;var h=f,m=0;return h&8191||(m+=13,h>>>=13),h&127||(m+=7,h>>>=7),h&15||(m+=4,h>>>=4),h&3||(m+=2,h>>>=2),h&1||m++,m},s.prototype.bitLength=function(){var f=this.words[this.length-1],h=this._countBits(f);return(this.length-1)*26+h};function P(g){for(var f=new Array(g.bitLength()),h=0;h>>_&1}return f}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var f=0,h=0;hf.length?this.clone().ior(f):f.clone().ior(this)},s.prototype.uor=function(f){return this.length>f.length?this.clone().iuor(f):f.clone().iuor(this)},s.prototype.iuand=function(f){var h;this.length>f.length?h=f:h=this;for(var m=0;mf.length?this.clone().iand(f):f.clone().iand(this)},s.prototype.uand=function(f){return this.length>f.length?this.clone().iuand(f):f.clone().iuand(this)},s.prototype.iuxor=function(f){var h,m;this.length>f.length?(h=this,m=f):(h=f,m=this);for(var _=0;_f.length?this.clone().ixor(f):f.clone().ixor(this)},s.prototype.uxor=function(f){return this.length>f.length?this.clone().iuxor(f):f.clone().iuxor(this)},s.prototype.inotn=function(f){n(typeof f=="number"&&f>=0);var h=Math.ceil(f/26)|0,m=f%26;this._expand(h),m>0&&h--;for(var _=0;_0&&(this.words[_]=~this.words[_]&67108863>>26-m),this._strip()},s.prototype.notn=function(f){return this.clone().inotn(f)},s.prototype.setn=function(f,h){n(typeof f=="number"&&f>=0);var m=f/26|0,_=f%26;return this._expand(m+1),h?this.words[m]=this.words[m]|1<<_:this.words[m]=this.words[m]&~(1<<_),this._strip()},s.prototype.iadd=function(f){var h;if(this.negative!==0&&f.negative===0)return this.negative=0,h=this.isub(f),this.negative^=1,this._normSign();if(this.negative===0&&f.negative!==0)return f.negative=0,h=this.isub(f),f.negative=1,h._normSign();var m,_;this.length>f.length?(m=this,_=f):(m=f,_=this);for(var E=0,x=0;x<_.length;x++)h=(m.words[x]|0)+(_.words[x]|0)+E,this.words[x]=h&67108863,E=h>>>26;for(;E!==0&&x>>26;if(this.length=m.length,E!==0)this.words[this.length]=E,this.length++;else if(m!==this)for(;xf.length?this.clone().iadd(f):f.clone().iadd(this)},s.prototype.isub=function(f){if(f.negative!==0){f.negative=0;var h=this.iadd(f);return f.negative=1,h._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(f),this.negative=1,this._normSign();var m=this.cmp(f);if(m===0)return this.negative=0,this.length=1,this.words[0]=0,this;var _,E;m>0?(_=this,E=f):(_=f,E=this);for(var x=0,T=0;T>26,this.words[T]=h&67108863;for(;x!==0&&T<_.length;T++)h=(_.words[T]|0)+x,x=h>>26,this.words[T]=h&67108863;if(x===0&&T<_.length&&_!==this)for(;T<_.length;T++)this.words[T]=_.words[T];return this.length=Math.max(this.length,T),_!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(f){return this.clone().isub(f)};function H(g,f,h){h.negative=f.negative^g.negative;var m=g.length+f.length|0;h.length=m,m=m-1|0;var _=g.words[0]|0,E=f.words[0]|0,x=_*E,T=x&67108863,B=x/67108864|0;h.words[0]=T;for(var d=1;d>>26,W=B&67108863,K=Math.min(d,f.length-1),re=Math.max(0,d-g.length+1);re<=K;re++){var xe=d-re|0;_=g.words[xe]|0,E=f.words[re]|0,x=_*E+W,k+=x/67108864|0,W=x&67108863}h.words[d]=W|0,B=k|0}return B!==0?h.words[d]=B|0:h.length--,h._strip()}var F=function(f,h,m){var _=f.words,E=h.words,x=m.words,T=0,B,d,k,W=_[0]|0,K=W&8191,re=W>>>13,xe=_[1]|0,be=xe&8191,ge=xe>>>13,tt=_[2]|0,Ue=tt&8191,Pe=tt>>>13,pe=_[3]|0,we=pe&8191,ke=pe>>>13,vt=_[4]|0,He=vt&8191,it=vt>>>13,Ht=_[5]|0,ut=Ht&8191,pt=Ht>>>13,Wt=_[6]|0,xt=Wt&8191,At=Wt>>>13,Xt=_[7]|0,Tt=Xt&8191,C=Xt>>>13,w=_[8]|0,b=w&8191,D=w>>>13,V=_[9]|0,X=V&8191,ae=V>>>13,Ze=E[0]|0,Ge=Ze&8191,We=Ze>>>13,jt=E[1]|0,ze=jt&8191,rr=jt>>>13,La=E[2]|0,yr=La&8191,vr=La>>>13,Sl=E[3]|0,zt=Sl&8191,Yt=Sl>>>13,Qi=E[4]|0,ur=Qi&8191,lr=Qi>>>13,Jc=E[5]|0,_r=Jc&8191,kt=Jc>>>13,Qc=E[6]|0,S=Qc&8191,L=Qc>>>13,M=E[7]|0,p=M&8191,U=M>>>13,J=E[8]|0,Y=J&8191,ue=J>>>13,_e=E[9]|0,Ae=_e&8191,Ee=_e>>>13;m.negative=f.negative^h.negative,m.length=19,B=Math.imul(K,Ge),d=Math.imul(K,We),d=d+Math.imul(re,Ge)|0,k=Math.imul(re,We);var Bt=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Bt>>>26)|0,Bt&=67108863,B=Math.imul(be,Ge),d=Math.imul(be,We),d=d+Math.imul(ge,Ge)|0,k=Math.imul(ge,We),B=B+Math.imul(K,ze)|0,d=d+Math.imul(K,rr)|0,d=d+Math.imul(re,ze)|0,k=k+Math.imul(re,rr)|0;var Le=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Le>>>26)|0,Le&=67108863,B=Math.imul(Ue,Ge),d=Math.imul(Ue,We),d=d+Math.imul(Pe,Ge)|0,k=Math.imul(Pe,We),B=B+Math.imul(be,ze)|0,d=d+Math.imul(be,rr)|0,d=d+Math.imul(ge,ze)|0,k=k+Math.imul(ge,rr)|0,B=B+Math.imul(K,yr)|0,d=d+Math.imul(K,vr)|0,d=d+Math.imul(re,yr)|0,k=k+Math.imul(re,vr)|0;var Ke=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,B=Math.imul(we,Ge),d=Math.imul(we,We),d=d+Math.imul(ke,Ge)|0,k=Math.imul(ke,We),B=B+Math.imul(Ue,ze)|0,d=d+Math.imul(Ue,rr)|0,d=d+Math.imul(Pe,ze)|0,k=k+Math.imul(Pe,rr)|0,B=B+Math.imul(be,yr)|0,d=d+Math.imul(be,vr)|0,d=d+Math.imul(ge,yr)|0,k=k+Math.imul(ge,vr)|0,B=B+Math.imul(K,zt)|0,d=d+Math.imul(K,Yt)|0,d=d+Math.imul(re,zt)|0,k=k+Math.imul(re,Yt)|0;var Ye=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,B=Math.imul(He,Ge),d=Math.imul(He,We),d=d+Math.imul(it,Ge)|0,k=Math.imul(it,We),B=B+Math.imul(we,ze)|0,d=d+Math.imul(we,rr)|0,d=d+Math.imul(ke,ze)|0,k=k+Math.imul(ke,rr)|0,B=B+Math.imul(Ue,yr)|0,d=d+Math.imul(Ue,vr)|0,d=d+Math.imul(Pe,yr)|0,k=k+Math.imul(Pe,vr)|0,B=B+Math.imul(be,zt)|0,d=d+Math.imul(be,Yt)|0,d=d+Math.imul(ge,zt)|0,k=k+Math.imul(ge,Yt)|0,B=B+Math.imul(K,ur)|0,d=d+Math.imul(K,lr)|0,d=d+Math.imul(re,ur)|0,k=k+Math.imul(re,lr)|0;var lt=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(lt>>>26)|0,lt&=67108863,B=Math.imul(ut,Ge),d=Math.imul(ut,We),d=d+Math.imul(pt,Ge)|0,k=Math.imul(pt,We),B=B+Math.imul(He,ze)|0,d=d+Math.imul(He,rr)|0,d=d+Math.imul(it,ze)|0,k=k+Math.imul(it,rr)|0,B=B+Math.imul(we,yr)|0,d=d+Math.imul(we,vr)|0,d=d+Math.imul(ke,yr)|0,k=k+Math.imul(ke,vr)|0,B=B+Math.imul(Ue,zt)|0,d=d+Math.imul(Ue,Yt)|0,d=d+Math.imul(Pe,zt)|0,k=k+Math.imul(Pe,Yt)|0,B=B+Math.imul(be,ur)|0,d=d+Math.imul(be,lr)|0,d=d+Math.imul(ge,ur)|0,k=k+Math.imul(ge,lr)|0,B=B+Math.imul(K,_r)|0,d=d+Math.imul(K,kt)|0,d=d+Math.imul(re,_r)|0,k=k+Math.imul(re,kt)|0;var ct=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(ct>>>26)|0,ct&=67108863,B=Math.imul(xt,Ge),d=Math.imul(xt,We),d=d+Math.imul(At,Ge)|0,k=Math.imul(At,We),B=B+Math.imul(ut,ze)|0,d=d+Math.imul(ut,rr)|0,d=d+Math.imul(pt,ze)|0,k=k+Math.imul(pt,rr)|0,B=B+Math.imul(He,yr)|0,d=d+Math.imul(He,vr)|0,d=d+Math.imul(it,yr)|0,k=k+Math.imul(it,vr)|0,B=B+Math.imul(we,zt)|0,d=d+Math.imul(we,Yt)|0,d=d+Math.imul(ke,zt)|0,k=k+Math.imul(ke,Yt)|0,B=B+Math.imul(Ue,ur)|0,d=d+Math.imul(Ue,lr)|0,d=d+Math.imul(Pe,ur)|0,k=k+Math.imul(Pe,lr)|0,B=B+Math.imul(be,_r)|0,d=d+Math.imul(be,kt)|0,d=d+Math.imul(ge,_r)|0,k=k+Math.imul(ge,kt)|0,B=B+Math.imul(K,S)|0,d=d+Math.imul(K,L)|0,d=d+Math.imul(re,S)|0,k=k+Math.imul(re,L)|0;var Xe=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,B=Math.imul(Tt,Ge),d=Math.imul(Tt,We),d=d+Math.imul(C,Ge)|0,k=Math.imul(C,We),B=B+Math.imul(xt,ze)|0,d=d+Math.imul(xt,rr)|0,d=d+Math.imul(At,ze)|0,k=k+Math.imul(At,rr)|0,B=B+Math.imul(ut,yr)|0,d=d+Math.imul(ut,vr)|0,d=d+Math.imul(pt,yr)|0,k=k+Math.imul(pt,vr)|0,B=B+Math.imul(He,zt)|0,d=d+Math.imul(He,Yt)|0,d=d+Math.imul(it,zt)|0,k=k+Math.imul(it,Yt)|0,B=B+Math.imul(we,ur)|0,d=d+Math.imul(we,lr)|0,d=d+Math.imul(ke,ur)|0,k=k+Math.imul(ke,lr)|0,B=B+Math.imul(Ue,_r)|0,d=d+Math.imul(Ue,kt)|0,d=d+Math.imul(Pe,_r)|0,k=k+Math.imul(Pe,kt)|0,B=B+Math.imul(be,S)|0,d=d+Math.imul(be,L)|0,d=d+Math.imul(ge,S)|0,k=k+Math.imul(ge,L)|0,B=B+Math.imul(K,p)|0,d=d+Math.imul(K,U)|0,d=d+Math.imul(re,p)|0,k=k+Math.imul(re,U)|0;var rt=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(rt>>>26)|0,rt&=67108863,B=Math.imul(b,Ge),d=Math.imul(b,We),d=d+Math.imul(D,Ge)|0,k=Math.imul(D,We),B=B+Math.imul(Tt,ze)|0,d=d+Math.imul(Tt,rr)|0,d=d+Math.imul(C,ze)|0,k=k+Math.imul(C,rr)|0,B=B+Math.imul(xt,yr)|0,d=d+Math.imul(xt,vr)|0,d=d+Math.imul(At,yr)|0,k=k+Math.imul(At,vr)|0,B=B+Math.imul(ut,zt)|0,d=d+Math.imul(ut,Yt)|0,d=d+Math.imul(pt,zt)|0,k=k+Math.imul(pt,Yt)|0,B=B+Math.imul(He,ur)|0,d=d+Math.imul(He,lr)|0,d=d+Math.imul(it,ur)|0,k=k+Math.imul(it,lr)|0,B=B+Math.imul(we,_r)|0,d=d+Math.imul(we,kt)|0,d=d+Math.imul(ke,_r)|0,k=k+Math.imul(ke,kt)|0,B=B+Math.imul(Ue,S)|0,d=d+Math.imul(Ue,L)|0,d=d+Math.imul(Pe,S)|0,k=k+Math.imul(Pe,L)|0,B=B+Math.imul(be,p)|0,d=d+Math.imul(be,U)|0,d=d+Math.imul(ge,p)|0,k=k+Math.imul(ge,U)|0,B=B+Math.imul(K,Y)|0,d=d+Math.imul(K,ue)|0,d=d+Math.imul(re,Y)|0,k=k+Math.imul(re,ue)|0;var Je=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Je>>>26)|0,Je&=67108863,B=Math.imul(X,Ge),d=Math.imul(X,We),d=d+Math.imul(ae,Ge)|0,k=Math.imul(ae,We),B=B+Math.imul(b,ze)|0,d=d+Math.imul(b,rr)|0,d=d+Math.imul(D,ze)|0,k=k+Math.imul(D,rr)|0,B=B+Math.imul(Tt,yr)|0,d=d+Math.imul(Tt,vr)|0,d=d+Math.imul(C,yr)|0,k=k+Math.imul(C,vr)|0,B=B+Math.imul(xt,zt)|0,d=d+Math.imul(xt,Yt)|0,d=d+Math.imul(At,zt)|0,k=k+Math.imul(At,Yt)|0,B=B+Math.imul(ut,ur)|0,d=d+Math.imul(ut,lr)|0,d=d+Math.imul(pt,ur)|0,k=k+Math.imul(pt,lr)|0,B=B+Math.imul(He,_r)|0,d=d+Math.imul(He,kt)|0,d=d+Math.imul(it,_r)|0,k=k+Math.imul(it,kt)|0,B=B+Math.imul(we,S)|0,d=d+Math.imul(we,L)|0,d=d+Math.imul(ke,S)|0,k=k+Math.imul(ke,L)|0,B=B+Math.imul(Ue,p)|0,d=d+Math.imul(Ue,U)|0,d=d+Math.imul(Pe,p)|0,k=k+Math.imul(Pe,U)|0,B=B+Math.imul(be,Y)|0,d=d+Math.imul(be,ue)|0,d=d+Math.imul(ge,Y)|0,k=k+Math.imul(ge,ue)|0,B=B+Math.imul(K,Ae)|0,d=d+Math.imul(K,Ee)|0,d=d+Math.imul(re,Ae)|0,k=k+Math.imul(re,Ee)|0;var $e=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+($e>>>26)|0,$e&=67108863,B=Math.imul(X,ze),d=Math.imul(X,rr),d=d+Math.imul(ae,ze)|0,k=Math.imul(ae,rr),B=B+Math.imul(b,yr)|0,d=d+Math.imul(b,vr)|0,d=d+Math.imul(D,yr)|0,k=k+Math.imul(D,vr)|0,B=B+Math.imul(Tt,zt)|0,d=d+Math.imul(Tt,Yt)|0,d=d+Math.imul(C,zt)|0,k=k+Math.imul(C,Yt)|0,B=B+Math.imul(xt,ur)|0,d=d+Math.imul(xt,lr)|0,d=d+Math.imul(At,ur)|0,k=k+Math.imul(At,lr)|0,B=B+Math.imul(ut,_r)|0,d=d+Math.imul(ut,kt)|0,d=d+Math.imul(pt,_r)|0,k=k+Math.imul(pt,kt)|0,B=B+Math.imul(He,S)|0,d=d+Math.imul(He,L)|0,d=d+Math.imul(it,S)|0,k=k+Math.imul(it,L)|0,B=B+Math.imul(we,p)|0,d=d+Math.imul(we,U)|0,d=d+Math.imul(ke,p)|0,k=k+Math.imul(ke,U)|0,B=B+Math.imul(Ue,Y)|0,d=d+Math.imul(Ue,ue)|0,d=d+Math.imul(Pe,Y)|0,k=k+Math.imul(Pe,ue)|0,B=B+Math.imul(be,Ae)|0,d=d+Math.imul(be,Ee)|0,d=d+Math.imul(ge,Ae)|0,k=k+Math.imul(ge,Ee)|0;var De=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(De>>>26)|0,De&=67108863,B=Math.imul(X,yr),d=Math.imul(X,vr),d=d+Math.imul(ae,yr)|0,k=Math.imul(ae,vr),B=B+Math.imul(b,zt)|0,d=d+Math.imul(b,Yt)|0,d=d+Math.imul(D,zt)|0,k=k+Math.imul(D,Yt)|0,B=B+Math.imul(Tt,ur)|0,d=d+Math.imul(Tt,lr)|0,d=d+Math.imul(C,ur)|0,k=k+Math.imul(C,lr)|0,B=B+Math.imul(xt,_r)|0,d=d+Math.imul(xt,kt)|0,d=d+Math.imul(At,_r)|0,k=k+Math.imul(At,kt)|0,B=B+Math.imul(ut,S)|0,d=d+Math.imul(ut,L)|0,d=d+Math.imul(pt,S)|0,k=k+Math.imul(pt,L)|0,B=B+Math.imul(He,p)|0,d=d+Math.imul(He,U)|0,d=d+Math.imul(it,p)|0,k=k+Math.imul(it,U)|0,B=B+Math.imul(we,Y)|0,d=d+Math.imul(we,ue)|0,d=d+Math.imul(ke,Y)|0,k=k+Math.imul(ke,ue)|0,B=B+Math.imul(Ue,Ae)|0,d=d+Math.imul(Ue,Ee)|0,d=d+Math.imul(Pe,Ae)|0,k=k+Math.imul(Pe,Ee)|0;var Re=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Re>>>26)|0,Re&=67108863,B=Math.imul(X,zt),d=Math.imul(X,Yt),d=d+Math.imul(ae,zt)|0,k=Math.imul(ae,Yt),B=B+Math.imul(b,ur)|0,d=d+Math.imul(b,lr)|0,d=d+Math.imul(D,ur)|0,k=k+Math.imul(D,lr)|0,B=B+Math.imul(Tt,_r)|0,d=d+Math.imul(Tt,kt)|0,d=d+Math.imul(C,_r)|0,k=k+Math.imul(C,kt)|0,B=B+Math.imul(xt,S)|0,d=d+Math.imul(xt,L)|0,d=d+Math.imul(At,S)|0,k=k+Math.imul(At,L)|0,B=B+Math.imul(ut,p)|0,d=d+Math.imul(ut,U)|0,d=d+Math.imul(pt,p)|0,k=k+Math.imul(pt,U)|0,B=B+Math.imul(He,Y)|0,d=d+Math.imul(He,ue)|0,d=d+Math.imul(it,Y)|0,k=k+Math.imul(it,ue)|0,B=B+Math.imul(we,Ae)|0,d=d+Math.imul(we,Ee)|0,d=d+Math.imul(ke,Ae)|0,k=k+Math.imul(ke,Ee)|0;var Me=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Me>>>26)|0,Me&=67108863,B=Math.imul(X,ur),d=Math.imul(X,lr),d=d+Math.imul(ae,ur)|0,k=Math.imul(ae,lr),B=B+Math.imul(b,_r)|0,d=d+Math.imul(b,kt)|0,d=d+Math.imul(D,_r)|0,k=k+Math.imul(D,kt)|0,B=B+Math.imul(Tt,S)|0,d=d+Math.imul(Tt,L)|0,d=d+Math.imul(C,S)|0,k=k+Math.imul(C,L)|0,B=B+Math.imul(xt,p)|0,d=d+Math.imul(xt,U)|0,d=d+Math.imul(At,p)|0,k=k+Math.imul(At,U)|0,B=B+Math.imul(ut,Y)|0,d=d+Math.imul(ut,ue)|0,d=d+Math.imul(pt,Y)|0,k=k+Math.imul(pt,ue)|0,B=B+Math.imul(He,Ae)|0,d=d+Math.imul(He,Ee)|0,d=d+Math.imul(it,Ae)|0,k=k+Math.imul(it,Ee)|0;var Ne=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,B=Math.imul(X,_r),d=Math.imul(X,kt),d=d+Math.imul(ae,_r)|0,k=Math.imul(ae,kt),B=B+Math.imul(b,S)|0,d=d+Math.imul(b,L)|0,d=d+Math.imul(D,S)|0,k=k+Math.imul(D,L)|0,B=B+Math.imul(Tt,p)|0,d=d+Math.imul(Tt,U)|0,d=d+Math.imul(C,p)|0,k=k+Math.imul(C,U)|0,B=B+Math.imul(xt,Y)|0,d=d+Math.imul(xt,ue)|0,d=d+Math.imul(At,Y)|0,k=k+Math.imul(At,ue)|0,B=B+Math.imul(ut,Ae)|0,d=d+Math.imul(ut,Ee)|0,d=d+Math.imul(pt,Ae)|0,k=k+Math.imul(pt,Ee)|0;var Ie=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,B=Math.imul(X,S),d=Math.imul(X,L),d=d+Math.imul(ae,S)|0,k=Math.imul(ae,L),B=B+Math.imul(b,p)|0,d=d+Math.imul(b,U)|0,d=d+Math.imul(D,p)|0,k=k+Math.imul(D,U)|0,B=B+Math.imul(Tt,Y)|0,d=d+Math.imul(Tt,ue)|0,d=d+Math.imul(C,Y)|0,k=k+Math.imul(C,ue)|0,B=B+Math.imul(xt,Ae)|0,d=d+Math.imul(xt,Ee)|0,d=d+Math.imul(At,Ae)|0,k=k+Math.imul(At,Ee)|0;var ce=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(ce>>>26)|0,ce&=67108863,B=Math.imul(X,p),d=Math.imul(X,U),d=d+Math.imul(ae,p)|0,k=Math.imul(ae,U),B=B+Math.imul(b,Y)|0,d=d+Math.imul(b,ue)|0,d=d+Math.imul(D,Y)|0,k=k+Math.imul(D,ue)|0,B=B+Math.imul(Tt,Ae)|0,d=d+Math.imul(Tt,Ee)|0,d=d+Math.imul(C,Ae)|0,k=k+Math.imul(C,Ee)|0;var fe=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(fe>>>26)|0,fe&=67108863,B=Math.imul(X,Y),d=Math.imul(X,ue),d=d+Math.imul(ae,Y)|0,k=Math.imul(ae,ue),B=B+Math.imul(b,Ae)|0,d=d+Math.imul(b,Ee)|0,d=d+Math.imul(D,Ae)|0,k=k+Math.imul(D,Ee)|0;var ye=(T+B|0)+((d&8191)<<13)|0;T=(k+(d>>>13)|0)+(ye>>>26)|0,ye&=67108863,B=Math.imul(X,Ae),d=Math.imul(X,Ee),d=d+Math.imul(ae,Ae)|0,k=Math.imul(ae,Ee);var he=(T+B|0)+((d&8191)<<13)|0;return T=(k+(d>>>13)|0)+(he>>>26)|0,he&=67108863,x[0]=Bt,x[1]=Le,x[2]=Ke,x[3]=Ye,x[4]=lt,x[5]=ct,x[6]=Xe,x[7]=rt,x[8]=Je,x[9]=$e,x[10]=De,x[11]=Re,x[12]=Me,x[13]=Ne,x[14]=Ie,x[15]=ce,x[16]=fe,x[17]=ye,x[18]=he,T!==0&&(x[19]=T,m.length++),m};Math.imul||(F=H);function N(g,f,h){h.negative=f.negative^g.negative,h.length=g.length+f.length;for(var m=0,_=0,E=0;E>>26)|0,_+=x>>>26,x&=67108863}h.words[E]=T,m=x,x=_}return m!==0?h.words[E]=m:h.length--,h._strip()}function $(g,f,h){return N(g,f,h)}s.prototype.mulTo=function(f,h){var m,_=this.length+f.length;return this.length===10&&f.length===10?m=F(this,f,h):_<63?m=H(this,f,h):_<1024?m=N(this,f,h):m=$(this,f,h),m},s.prototype.mul=function(f){var h=new s(null);return h.words=new Array(this.length+f.length),this.mulTo(f,h)},s.prototype.mulf=function(f){var h=new s(null);return h.words=new Array(this.length+f.length),$(this,f,h)},s.prototype.imul=function(f){return this.clone().mulTo(f,this)},s.prototype.imuln=function(f){var h=f<0;h&&(f=-f),n(typeof f=="number"),n(f<67108864);for(var m=0,_=0;_>=26,m+=E/67108864|0,m+=x>>>26,this.words[_]=x&67108863}return m!==0&&(this.words[_]=m,this.length++),h?this.ineg():this},s.prototype.muln=function(f){return this.clone().imuln(f)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(f){var h=P(f);if(h.length===0)return new s(1);for(var m=this,_=0;_=0);var h=f%26,m=(f-h)/26,_=67108863>>>26-h<<26-h,E;if(h!==0){var x=0;for(E=0;E>>26-h}x&&(this.words[E]=x,this.length++)}if(m!==0){for(E=this.length-1;E>=0;E--)this.words[E+m]=this.words[E];for(E=0;E=0);var _;h?_=(h-h%26)/26:_=0;var E=f%26,x=Math.min((f-E)/26,this.length),T=67108863^67108863>>>E<x)for(this.length-=x,d=0;d=0&&(k!==0||d>=_);d--){var W=this.words[d]|0;this.words[d]=k<<26-E|W>>>E,k=W&T}return B&&k!==0&&(B.words[B.length++]=k),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(f,h,m){return n(this.negative===0),this.iushrn(f,h,m)},s.prototype.shln=function(f){return this.clone().ishln(f)},s.prototype.ushln=function(f){return this.clone().iushln(f)},s.prototype.shrn=function(f){return this.clone().ishrn(f)},s.prototype.ushrn=function(f){return this.clone().iushrn(f)},s.prototype.testn=function(f){n(typeof f=="number"&&f>=0);var h=f%26,m=(f-h)/26,_=1<=0);var h=f%26,m=(f-h)/26;if(n(this.negative===0,"imaskn works only with positive numbers"),this.length<=m)return this;if(h!==0&&m++,this.length=Math.min(m,this.length),h!==0){var _=67108863^67108863>>>h<=67108864;h++)this.words[h]-=67108864,h===this.length-1?this.words[h+1]=1:this.words[h+1]++;return this.length=Math.max(this.length,h+1),this},s.prototype.isubn=function(f){if(n(typeof f=="number"),n(f<67108864),f<0)return this.iaddn(-f);if(this.negative!==0)return this.negative=0,this.iaddn(f),this.negative=1,this;if(this.words[0]-=f,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var h=0;h>26)-(B/67108864|0),this.words[E+m]=x&67108863}for(;E>26,this.words[E+m]=x&67108863;if(T===0)return this._strip();for(n(T===-1),T=0,E=0;E>26,this.words[E]=x&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(f,h){var m=this.length-f.length,_=this.clone(),E=f,x=E.words[E.length-1]|0,T=this._countBits(x);m=26-T,m!==0&&(E=E.ushln(m),_.iushln(m),x=E.words[E.length-1]|0);var B=_.length-E.length,d;if(h!=="mod"){d=new s(null),d.length=B+1,d.words=new Array(d.length);for(var k=0;k=0;K--){var re=(_.words[E.length+K]|0)*67108864+(_.words[E.length+K-1]|0);for(re=Math.min(re/x|0,67108863),_._ishlnsubmul(E,re,K);_.negative!==0;)re--,_.negative=0,_._ishlnsubmul(E,1,K),_.isZero()||(_.negative^=1);d&&(d.words[K]=re)}return d&&d._strip(),_._strip(),h!=="div"&&m!==0&&_.iushrn(m),{div:d||null,mod:_}},s.prototype.divmod=function(f,h,m){if(n(!f.isZero()),this.isZero())return{div:new s(0),mod:new s(0)};var _,E,x;return this.negative!==0&&f.negative===0?(x=this.neg().divmod(f,h),h!=="mod"&&(_=x.div.neg()),h!=="div"&&(E=x.mod.neg(),m&&E.negative!==0&&E.iadd(f)),{div:_,mod:E}):this.negative===0&&f.negative!==0?(x=this.divmod(f.neg(),h),h!=="mod"&&(_=x.div.neg()),{div:_,mod:x.mod}):this.negative&f.negative?(x=this.neg().divmod(f.neg(),h),h!=="div"&&(E=x.mod.neg(),m&&E.negative!==0&&E.isub(f)),{div:x.div,mod:E}):f.length>this.length||this.cmp(f)<0?{div:new s(0),mod:this}:f.length===1?h==="div"?{div:this.divn(f.words[0]),mod:null}:h==="mod"?{div:null,mod:new s(this.modrn(f.words[0]))}:{div:this.divn(f.words[0]),mod:new s(this.modrn(f.words[0]))}:this._wordDiv(f,h)},s.prototype.div=function(f){return this.divmod(f,"div",!1).div},s.prototype.mod=function(f){return this.divmod(f,"mod",!1).mod},s.prototype.umod=function(f){return this.divmod(f,"mod",!0).mod},s.prototype.divRound=function(f){var h=this.divmod(f);if(h.mod.isZero())return h.div;var m=h.div.negative!==0?h.mod.isub(f):h.mod,_=f.ushrn(1),E=f.andln(1),x=m.cmp(_);return x<0||E===1&&x===0?h.div:h.div.negative!==0?h.div.isubn(1):h.div.iaddn(1)},s.prototype.modrn=function(f){var h=f<0;h&&(f=-f),n(f<=67108863);for(var m=(1<<26)%f,_=0,E=this.length-1;E>=0;E--)_=(m*_+(this.words[E]|0))%f;return h?-_:_},s.prototype.modn=function(f){return this.modrn(f)},s.prototype.idivn=function(f){var h=f<0;h&&(f=-f),n(f<=67108863);for(var m=0,_=this.length-1;_>=0;_--){var E=(this.words[_]|0)+m*67108864;this.words[_]=E/f|0,m=E%f}return this._strip(),h?this.ineg():this},s.prototype.divn=function(f){return this.clone().idivn(f)},s.prototype.egcd=function(f){n(f.negative===0),n(!f.isZero());var h=this,m=f.clone();h.negative!==0?h=h.umod(f):h=h.clone();for(var _=new s(1),E=new s(0),x=new s(0),T=new s(1),B=0;h.isEven()&&m.isEven();)h.iushrn(1),m.iushrn(1),++B;for(var d=m.clone(),k=h.clone();!h.isZero();){for(var W=0,K=1;!(h.words[0]&K)&&W<26;++W,K<<=1);if(W>0)for(h.iushrn(W);W-- >0;)(_.isOdd()||E.isOdd())&&(_.iadd(d),E.isub(k)),_.iushrn(1),E.iushrn(1);for(var re=0,xe=1;!(m.words[0]&xe)&&re<26;++re,xe<<=1);if(re>0)for(m.iushrn(re);re-- >0;)(x.isOdd()||T.isOdd())&&(x.iadd(d),T.isub(k)),x.iushrn(1),T.iushrn(1);h.cmp(m)>=0?(h.isub(m),_.isub(x),E.isub(T)):(m.isub(h),x.isub(_),T.isub(E))}return{a:x,b:T,gcd:m.iushln(B)}},s.prototype._invmp=function(f){n(f.negative===0),n(!f.isZero());var h=this,m=f.clone();h.negative!==0?h=h.umod(f):h=h.clone();for(var _=new s(1),E=new s(0),x=m.clone();h.cmpn(1)>0&&m.cmpn(1)>0;){for(var T=0,B=1;!(h.words[0]&B)&&T<26;++T,B<<=1);if(T>0)for(h.iushrn(T);T-- >0;)_.isOdd()&&_.iadd(x),_.iushrn(1);for(var d=0,k=1;!(m.words[0]&k)&&d<26;++d,k<<=1);if(d>0)for(m.iushrn(d);d-- >0;)E.isOdd()&&E.iadd(x),E.iushrn(1);h.cmp(m)>=0?(h.isub(m),_.isub(E)):(m.isub(h),E.isub(_))}var W;return h.cmpn(1)===0?W=_:W=E,W.cmpn(0)<0&&W.iadd(f),W},s.prototype.gcd=function(f){if(this.isZero())return f.abs();if(f.isZero())return this.abs();var h=this.clone(),m=f.clone();h.negative=0,m.negative=0;for(var _=0;h.isEven()&&m.isEven();_++)h.iushrn(1),m.iushrn(1);do{for(;h.isEven();)h.iushrn(1);for(;m.isEven();)m.iushrn(1);var E=h.cmp(m);if(E<0){var x=h;h=m,m=x}else if(E===0||m.cmpn(1)===0)break;h.isub(m)}while(!0);return m.iushln(_)},s.prototype.invm=function(f){return this.egcd(f).a.umod(f)},s.prototype.isEven=function(){return(this.words[0]&1)===0},s.prototype.isOdd=function(){return(this.words[0]&1)===1},s.prototype.andln=function(f){return this.words[0]&f},s.prototype.bincn=function(f){n(typeof f=="number");var h=f%26,m=(f-h)/26,_=1<>>26,T&=67108863,this.words[x]=T}return E!==0&&(this.words[x]=E,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(f){var h=f<0;if(this.negative!==0&&!h)return-1;if(this.negative===0&&h)return 1;this._strip();var m;if(this.length>1)m=1;else{h&&(f=-f),n(f<=67108863,"Number is too big");var _=this.words[0]|0;m=_===f?0:_f.length)return 1;if(this.length=0;m--){var _=this.words[m]|0,E=f.words[m]|0;if(_!==E){_E&&(h=1);break}}return h},s.prototype.gtn=function(f){return this.cmpn(f)===1},s.prototype.gt=function(f){return this.cmp(f)===1},s.prototype.gten=function(f){return this.cmpn(f)>=0},s.prototype.gte=function(f){return this.cmp(f)>=0},s.prototype.ltn=function(f){return this.cmpn(f)===-1},s.prototype.lt=function(f){return this.cmp(f)===-1},s.prototype.lten=function(f){return this.cmpn(f)<=0},s.prototype.lte=function(f){return this.cmp(f)<=0},s.prototype.eqn=function(f){return this.cmpn(f)===0},s.prototype.eq=function(f){return this.cmp(f)===0},s.red=function(f){return new Q(f)},s.prototype.toRed=function(f){return n(!this.red,"Already a number in reduction context"),n(this.negative===0,"red works only with positives"),f.convertTo(this)._forceRed(f)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(f){return this.red=f,this},s.prototype.forceRed=function(f){return n(!this.red,"Already a number in reduction context"),this._forceRed(f)},s.prototype.redAdd=function(f){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,f)},s.prototype.redIAdd=function(f){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,f)},s.prototype.redSub=function(f){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,f)},s.prototype.redISub=function(f){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,f)},s.prototype.redShl=function(f){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,f)},s.prototype.redMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.mul(this,f)},s.prototype.redIMul=function(f){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,f),this.red.imul(this,f)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(f){return n(this.red&&!f.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,f)};var q={k256:null,p224:null,p192:null,p25519:null};function G(g,f){this.name=g,this.p=new s(f,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}G.prototype._tmp=function(){var f=new s(null);return f.words=new Array(Math.ceil(this.n/13)),f},G.prototype.ireduce=function(f){var h=f,m;do this.split(h,this.tmp),h=this.imulK(h),h=h.iadd(this.tmp),m=h.bitLength();while(m>this.n);var _=m0?h.isub(this.p):h.strip!==void 0?h.strip():h._strip(),h},G.prototype.split=function(f,h){f.iushrn(this.n,0,h)},G.prototype.imulK=function(f){return f.imul(this.k)};function Z(){G.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}i(Z,G),Z.prototype.split=function(f,h){for(var m=4194303,_=Math.min(f.length,9),E=0;E<_;E++)h.words[E]=f.words[E];if(h.length=_,f.length<=9){f.words[0]=0,f.length=1;return}var x=f.words[9];for(h.words[h.length++]=x&m,E=10;E>>22,x=T}x>>>=22,f.words[E-10]=x,x===0&&f.length>10?f.length-=10:f.length-=9},Z.prototype.imulK=function(f){f.words[f.length]=0,f.words[f.length+1]=0,f.length+=2;for(var h=0,m=0;m>>=26,f.words[m]=E,h=_}return h!==0&&(f.words[f.length++]=h),f},s._prime=function(f){if(q[f])return q[f];var h;if(f==="k256")h=new Z;else if(f==="p224")h=new z;else if(f==="p192")h=new ee;else if(f==="p25519")h=new se;else throw new Error("Unknown prime "+f);return q[f]=h,h};function Q(g){if(typeof g=="string"){var f=s._prime(g);this.m=f.p,this.prime=f}else n(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}Q.prototype._verify1=function(f){n(f.negative===0,"red works only with positives"),n(f.red,"red works only with red numbers")},Q.prototype._verify2=function(f,h){n((f.negative|h.negative)===0,"red works only with positives"),n(f.red&&f.red===h.red,"red works only with red numbers")},Q.prototype.imod=function(f){return this.prime?this.prime.ireduce(f)._forceRed(this):(l(f,f.umod(this.m)._forceRed(this)),f)},Q.prototype.neg=function(f){return f.isZero()?f.clone():this.m.sub(f)._forceRed(this)},Q.prototype.add=function(f,h){this._verify2(f,h);var m=f.add(h);return m.cmp(this.m)>=0&&m.isub(this.m),m._forceRed(this)},Q.prototype.iadd=function(f,h){this._verify2(f,h);var m=f.iadd(h);return m.cmp(this.m)>=0&&m.isub(this.m),m},Q.prototype.sub=function(f,h){this._verify2(f,h);var m=f.sub(h);return m.cmpn(0)<0&&m.iadd(this.m),m._forceRed(this)},Q.prototype.isub=function(f,h){this._verify2(f,h);var m=f.isub(h);return m.cmpn(0)<0&&m.iadd(this.m),m},Q.prototype.shl=function(f,h){return this._verify1(f),this.imod(f.ushln(h))},Q.prototype.imul=function(f,h){return this._verify2(f,h),this.imod(f.imul(h))},Q.prototype.mul=function(f,h){return this._verify2(f,h),this.imod(f.mul(h))},Q.prototype.isqr=function(f){return this.imul(f,f.clone())},Q.prototype.sqr=function(f){return this.mul(f,f)},Q.prototype.sqrt=function(f){if(f.isZero())return f.clone();var h=this.m.andln(3);if(n(h%2===1),h===3){var m=this.m.add(new s(1)).iushrn(2);return this.pow(f,m)}for(var _=this.m.subn(1),E=0;!_.isZero()&&_.andln(1)===0;)E++,_.iushrn(1);n(!_.isZero());var x=new s(1).toRed(this),T=x.redNeg(),B=this.m.subn(1).iushrn(1),d=this.m.bitLength();for(d=new s(2*d*d).toRed(this);this.pow(d,B).cmp(T)!==0;)d.redIAdd(T);for(var k=this.pow(d,_),W=this.pow(f,_.addn(1).iushrn(1)),K=this.pow(f,_),re=E;K.cmp(x)!==0;){for(var xe=K,be=0;xe.cmp(x)!==0;be++)xe=xe.redSqr();n(be=0;E--){for(var k=h.words[E],W=d-1;W>=0;W--){var K=k>>W&1;if(x!==_[0]&&(x=this.sqr(x)),K===0&&T===0){B=0;continue}T<<=1,T|=K,B++,!(B!==m&&(E!==0||W!==0))&&(x=this.mul(x,_[T]),B=0,T=0)}d=26}return x},Q.prototype.convertTo=function(f){var h=f.umod(this.m);return h===f?h.clone():h},Q.prototype.convertFrom=function(f){var h=f.clone();return h.red=null,h},s.mont=function(f){return new I(f)};function I(g){Q.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(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)}i(I,Q),I.prototype.convertTo=function(f){return this.imod(f.ushln(this.shift))},I.prototype.convertFrom=function(f){var h=this.imod(f.mul(this.rinv));return h.red=null,h},I.prototype.imul=function(f,h){if(f.isZero()||h.isZero())return f.words[0]=0,f.length=1,f;var m=f.imul(h),_=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=m.isub(_).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},I.prototype.mul=function(f,h){if(f.isZero()||h.isZero())return new s(0)._forceRed(this);var m=f.mul(h),_=m.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=m.isub(_).iushrn(this.shift),x=E;return E.cmp(this.m)>=0?x=E.isub(this.m):E.cmpn(0)<0&&(x=E.iadd(this.m)),x._forceRed(this)},I.prototype.invm=function(f){var h=this.imod(f._invmp(this.m).mul(this.r2));return h._forceRed(this)}})(e,ft)})(zl);var wg=zl.exports,lf={exports:{}};/*! safe-buffer. MIT License. Feross Aboukhadijeh */(function(e,t){var r=ie,n=r.Buffer;function i(o,a){for(var c in o)a[c]=o[c]}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=r:(i(r,t),t.Buffer=s);function s(o,a,c){return n(o,a,c)}s.prototype=Object.create(n.prototype),i(n,s),s.from=function(o,a,c){if(typeof o=="number")throw new TypeError("Argument must not be a number");return n(o,a,c)},s.alloc=function(o,a,c){if(typeof o!="number")throw new TypeError("Argument must be a number");var u=n(o);return a!==void 0?typeof c=="string"?u.fill(a,c):u.fill(a):u.fill(0),u},s.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return n(o)},s.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(o)}})(lf,lf.exports);var hf=lf.exports.Buffer;function Qx(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r>>0,N=new Uint8Array(F);P!==H;){for(var $=v[P],q=0,G=F-1;($!==0||q>>0,N[G]=$%o>>>0,$=$/o>>>0;if($!==0)throw new Error("Non-zero carry");O=q,P++}for(var Z=F-O;Z!==F&&N[Z]===0;)Z++;for(var z=a.repeat(R);Z>>0,F=new Uint8Array(H);v[R];){var N=t[v.charCodeAt(R)];if(N===255)return;for(var $=0,q=H-1;(N!==0||$>>0,F[q]=N%256>>>0,N=N/256>>>0;if(N!==0)throw new Error("Non-zero carry");P=$,R++}for(var G=H-P;G!==H&&F[G]===0;)G++;var Z=hf.allocUnsafe(O+(H-G));Z.fill(0,0,O);for(var z=O;G!==H;)Z[z++]=F[G++];return Z}function A(v){var R=y(v);if(R)return R;throw new Error("Non-base"+o+" character")}return{encode:l,decodeUnsafe:y,decode:A}}var eS=Qx,tS=eS,rS="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ar=tS(rS);const nS=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),rs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ns=new Uint32Array(64);class iS extends Xp{constructor(){super(64,32,8,!1),this.A=rs[0]|0,this.B=rs[1]|0,this.C=rs[2]|0,this.D=rs[3]|0,this.E=rs[4]|0,this.F=rs[5]|0,this.G=rs[6]|0,this.H=rs[7]|0}get(){const{A:t,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[t,r,n,i,s,o,a,c]}set(t,r,n,i,s,o,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,r){for(let y=0;y<16;y++,r+=4)ns[y]=t.getUint32(r,!1);for(let y=16;y<64;y++){const A=ns[y-15],v=ns[y-2],R=gi(A,7)^gi(A,18)^A>>>3,O=gi(v,17)^gi(v,19)^v>>>10;ns[y]=O+ns[y-7]+R+ns[y-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let y=0;y<64;y++){const A=gi(a,6)^gi(a,11)^gi(a,25),v=l+A+JE(a,c,u)+nS[y]+ns[y]|0,O=(gi(n,2)^gi(n,13)^gi(n,22))+QE(n,i,s)|0;l=u,u=c,c=a,a=o+v|0,o=s,s=i,i=n,n=v+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){ns.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const ql=Gp(()=>new iS);var Zr={};function $i(e,t,r){return t<=e&&e<=r}function df(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function sS(e){for(var t=String(e),r=t.length,n=0,i=[];n57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319)if(n===r-1)i.push(65533);else{var o=e.charCodeAt(n+1);if(56320<=o&&o<=57343){var a=s&1023,c=o&1023;i.push(65536+(a<<10)+c),n+=1}else i.push(65533)}n+=1}return i}function oS(e){for(var t="",r=0;r>10)+55296,(n&1023)+56320))}return t}var pf=-1;function Vl(e){this.tokens=[].slice.call(e)}Vl.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():pf},prepend:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(var t=e;t.length;)this.tokens.push(t.shift());else this.tokens.push(e)}};var ko=-1;function Wl(e,t){if(e)throw TypeError("Decoder error");return t||65533}var gf="utf-8";function yf(e,t){if(!(this instanceof yf))return new yf(e,t);if(e=e!==void 0?String(e).toLowerCase():gf,e!==gf)throw new Error("Encoding not supported. Only utf-8 is supported");t=df(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}yf.prototype={decode:function(t,r){var n;typeof t=="object"&&t instanceof ArrayBuffer?n=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):n=new Uint8Array(0),r=df(r),this._streaming||(this._decoder=new aS({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new Vl(n),s=[],o;!i.endOfStream()&&(o=this._decoder.handler(i,i.read()),o!==ko);)o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o));if(!this._streaming){do{if(o=this._decoder.handler(i,i.read()),o===ko)break;o!==null&&(Array.isArray(o)?s.push.apply(s,o):s.push(o))}while(!i.endOfStream());this._decoder=null}return s.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(s[0]===65279?(this._BOMseen=!0,s.shift()):this._BOMseen=!0),oS(s)}};function wf(e,t){if(!(this instanceof wf))return new wf(e,t);if(e=e!==void 0?String(e).toLowerCase():gf,e!==gf)throw new Error("Encoding not supported. Only utf-8 is supported");t=df(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}wf.prototype={encode:function(t,r){t=t?String(t):"",r=df(r),this._streaming||(this._encoder=new cS(this._options)),this._streaming=!!r.stream;for(var n=[],i=new Vl(sS(t)),s;!i.endOfStream()&&(s=this._encoder.handler(i,i.read()),s!==ko);)Array.isArray(s)?n.push.apply(n,s):n.push(s);if(!this._streaming){for(;s=this._encoder.handler(i,i.read()),s!==ko;)Array.isArray(s)?n.push.apply(n,s):n.push(s);this._encoder=null}return new Uint8Array(n)}};function aS(e){var t=e.fatal,r=0,n=0,i=0,s=128,o=191;this.handler=function(a,c){if(c===pf&&i!==0)return i=0,Wl(t);if(c===pf)return ko;if(i===0){if($i(c,0,127))return c;if($i(c,194,223))i=1,r=c-192;else if($i(c,224,239))c===224&&(s=160),c===237&&(o=159),i=2,r=c-224;else if($i(c,240,244))c===240&&(s=144),c===244&&(o=143),i=3,r=c-240;else return Wl(t);return r=r<<6*i,null}if(!$i(c,s,o))return r=i=n=0,s=128,o=191,a.prepend(c),Wl(t);if(s=128,o=191,n+=1,r+=c-128<<6*(i-n),n!==i)return null;var u=r;return r=i=n=0,u}}function cS(e){e.fatal,this.handler=function(t,r){if(r===pf)return ko;if($i(r,0,127))return r;var n,i;$i(r,128,2047)?(n=1,i=192):$i(r,2048,65535)?(n=2,i=224):$i(r,65536,1114111)&&(n=3,i=240);for(var s=[(r>>6*n)+i];n>0;){var o=r>>6*(n-1);s.push(128|o&63),n-=1}return s}}var fS=Object.freeze({__proto__:null,TextEncoder:wf,TextDecoder:yf}),uS=Un(fS),lS=ft&&ft.__createBinding||(Object.create?function(e,t,r,n){n===void 0&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){n===void 0&&(n=r),e[n]=t[r]}),hS=ft&&ft.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),yi=ft&&ft.__decorate||function(e,t,r,n){var i=arguments.length,s=i<3?t:n===null?n=Object.getOwnPropertyDescriptor(t,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")s=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(s=(i<3?o(s):i>3?o(t,r,s):o(t,r))||s);return i>3&&s&&Object.defineProperty(t,r,s),s},dS=ft&&ft.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var r in e)r!=="default"&&Object.hasOwnProperty.call(e,r)&&lS(t,e,r);return hS(t,e),t},mg=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zr,"__esModule",{value:!0});var bg=Zr.deserializeUnchecked=Ag=Zr.deserialize=Sg=Zr.serialize=Zr.BinaryReader=Zr.BinaryWriter=Zr.BorshError=Zr.baseDecode=Zr.baseEncode=void 0;const is=mg(zl.exports),vg=mg(Ar),pS=dS(uS),gS=typeof TextDecoder!="function"?pS.TextDecoder:TextDecoder,yS=new gS("utf-8",{fatal:!0});function wS(e){return typeof e=="string"&&(e=ie.Buffer.from(e,"utf8")),vg.default.encode(ie.Buffer.from(e))}Zr.baseEncode=wS;function mS(e){return ie.Buffer.from(vg.default.decode(e))}Zr.baseDecode=mS;const Kl=1024;class ln extends Error{constructor(t){super(t),this.fieldPath=[],this.originalMessage=t}addToFieldPath(t){this.fieldPath.splice(0,0,t),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Zr.BorshError=ln;class _g{constructor(){this.buf=ie.Buffer.alloc(Kl),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=ie.Buffer.concat([this.buf,ie.Buffer.alloc(Kl)]))}writeU8(t){this.maybeResize(),this.buf.writeUInt8(t,this.length),this.length+=1}writeU16(t){this.maybeResize(),this.buf.writeUInt16LE(t,this.length),this.length+=2}writeU32(t){this.maybeResize(),this.buf.writeUInt32LE(t,this.length),this.length+=4}writeU64(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new is.default(t).toArray("le",8)))}writeU128(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new is.default(t).toArray("le",16)))}writeU256(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new is.default(t).toArray("le",32)))}writeU512(t){this.maybeResize(),this.writeBuffer(ie.Buffer.from(new is.default(t).toArray("le",64)))}writeBuffer(t){this.buf=ie.Buffer.concat([ie.Buffer.from(this.buf.subarray(0,this.length)),t,ie.Buffer.alloc(Kl)]),this.length+=t.length}writeString(t){this.maybeResize();const r=ie.Buffer.from(t,"utf8");this.writeU32(r.length),this.writeBuffer(r)}writeFixedArray(t){this.writeBuffer(ie.Buffer.from(t))}writeArray(t,r){this.maybeResize(),this.writeU32(t.length);for(const n of t)this.maybeResize(),r(n)}toArray(){return this.buf.subarray(0,this.length)}}Zr.BinaryWriter=_g;function wi(e,t,r){const n=r.value;r.value=function(...i){try{return n.apply(this,i)}catch(s){if(s instanceof RangeError){const o=s.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(o)>=0)throw new ln("Reached the end of buffer when deserializing")}throw s}}}class Bn{constructor(t){this.buf=t,this.offset=0}readU8(){const t=this.buf.readUInt8(this.offset);return this.offset+=1,t}readU16(){const t=this.buf.readUInt16LE(this.offset);return this.offset+=2,t}readU32(){const t=this.buf.readUInt32LE(this.offset);return this.offset+=4,t}readU64(){const t=this.readBuffer(8);return new is.default(t,"le")}readU128(){const t=this.readBuffer(16);return new is.default(t,"le")}readU256(){const t=this.readBuffer(32);return new is.default(t,"le")}readU512(){const t=this.readBuffer(64);return new is.default(t,"le")}readBuffer(t){if(this.offset+t>this.buf.length)throw new ln(`Expected buffer length ${t} isn't within bounds`);const r=this.buf.slice(this.offset,this.offset+t);return this.offset+=t,r}readString(){const t=this.readU32(),r=this.readBuffer(t);try{return yS.decode(r)}catch(n){throw new ln(`Error decoding UTF-8 string: ${n}`)}}readFixedArray(t){return new Uint8Array(this.readBuffer(t))}readArray(t){const r=this.readU32(),n=Array();for(let i=0;i{Vs(e,t,s,n[0],i)});else if(n.kind!==void 0)switch(n.kind){case"option":{r==null?i.writeU8(0):(i.writeU8(1),Vs(e,t,r,n.type,i));break}case"map":{i.writeU32(r.size),r.forEach((s,o)=>{Vs(e,t,o,n.key,i),Vs(e,t,s,n.value,i)});break}default:throw new ln(`FieldType ${n} unrecognized`)}else xg(e,r,i)}catch(s){throw s instanceof ln&&s.addToFieldPath(t),s}}function xg(e,t,r){if(typeof t.borshSerialize=="function"){t.borshSerialize(r);return}const n=e.get(t.constructor);if(!n)throw new ln(`Class ${t.constructor.name} is missing in schema`);if(n.kind==="struct")n.fields.map(([i,s])=>{Vs(e,i,t[i],s,r)});else if(n.kind==="enum"){const i=t[n.field];for(let s=0;sWs(e,t,r[0],n))}if(r.kind==="option")return n.readU8()?Ws(e,t,r.type,n):void 0;if(r.kind==="map"){let i=new Map;const s=n.readU32();for(let o=0;o=n.values.length)throw new ln(`Enum index: ${i} is out of range`);const[s,o]=n.values[i],a=Ws(e,s,o,r);return new t({[s]:a})}throw new ln(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}function vS(e,t,r,n=Bn){const i=new n(r),s=Zl(e,t,i);if(i.offsetthis.span)throw new RangeError("indeterminate span");return this.span}replicate(t){const r=Object.create(this.constructor.prototype);return Object.assign(r,this),r.property=t,r}fromArray(t){}}ne.Layout=qt;function Yl(e,t){return t.property?e+"["+t.property+"]":e}ne.nameWithProperty=Yl;function ES(e,t){if(typeof e!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(e,"layout_"))throw new Error("Class is already bound to a layout");if(!(t&&t instanceof qt))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(t,"boundConstructor_"))throw new Error("layout is already bound to a constructor");e.layout_=t,t.boundConstructor_=e,t.makeDestinationObject=()=>new e,Object.defineProperty(e.prototype,"encode",{value(r,n){return t.encode(this,r,n)},writable:!0}),Object.defineProperty(e,"decode",{value(r,n){return t.decode(r,n)},writable:!0})}ne.bindConstructorLayout=ES;class wn extends qt{isCount(){throw new Error("ExternalLayout is abstract")}}ne.ExternalLayout=wn;class Bg extends wn{constructor(t=1,r){if(!Number.isInteger(t)||0>=t)throw new TypeError("elementSpan must be a (positive) integer");super(-1,r),this.elementSpan=t}isCount(){return!0}decode(t,r=0){Co(t);const n=t.length-r;return Math.floor(n/this.elementSpan)}encode(t,r,n){return 0}}ne.GreedyCount=Bg;class Xl extends wn{constructor(t,r=0,n){if(!(t instanceof qt))throw new TypeError("layout must be a Layout");if(!Number.isInteger(r))throw new TypeError("offset must be integer or undefined");super(t.span,n||t.property),this.layout=t,this.offset=r}isCount(){return this.layout instanceof Hn||this.layout instanceof ni}decode(t,r=0){return this.layout.decode(t,r+this.offset)}encode(t,r,n=0){return this.layout.encode(t,r,n+this.offset)}}ne.OffsetLayout=Xl;class Hn extends qt{constructor(t,r){if(super(t,r),6o+i.encode(a,r,n+o),0);return this.count instanceof wn&&this.count.encode(t.length,r,n),s}}ne.Sequence=Mg;class Ng extends qt{constructor(t,r,n){if(!(Array.isArray(t)&&t.reduce((s,o)=>s&&o instanceof qt,!0)))throw new TypeError("fields must be array of Layout instances");typeof r=="boolean"&&n===void 0&&(n=r,r=void 0);for(const s of t)if(0>s.span&&s.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=t.reduce((s,o)=>s+o.getSpan(),0)}catch{}super(i,r),this.fields=t,this.decodePrefixes=!!n}getSpan(t,r=0){if(0<=this.span)return this.span;let n=0;try{n=this.fields.reduce((i,s)=>{const o=s.getSpan(t,r);return r+=o,i+o},0)}catch{throw new RangeError("indeterminate span")}return n}decode(t,r=0){Co(t);const n=this.makeDestinationObject();for(const i of this.fields)if(i.property!==void 0&&(n[i.property]=i.decode(t,r)),r+=i.getSpan(t,r),this.decodePrefixes&&t.length===r)break;return n}encode(t,r,n=0){const i=n;let s=0,o=0;for(const a of this.fields){let c=a.span;if(o=0c&&(c=a.getSpan(r,n)))}s=n,n+=c}return s+o-i}fromArray(t){const r=this.makeDestinationObject();for(const n of this.fields)n.property!==void 0&&0n.span?r=-1:0<=r&&(r+=n.span)}}}ne.Structure=Ng;class Ql{constructor(t){this.property=t}decode(t,r){throw new Error("UnionDiscriminator is abstract")}encode(t,r,n){throw new Error("UnionDiscriminator is abstract")}}ne.UnionDiscriminator=Ql;class vf extends Ql{constructor(t,r){if(!(t instanceof wn&&t.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(r||t.property||"variant"),this.layout=t}decode(t,r){return this.layout.decode(t,r)}encode(t,r,n){return this.layout.encode(t,r,n)}}ne.UnionLayoutDiscriminator=vf;class eh extends qt{constructor(t,r,n){let i;if(t instanceof Hn||t instanceof ni)i=new vf(new Xl(t));else if(t instanceof wn&&t.isCount())i=new vf(t);else if(t instanceof Ql)i=t;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(r===void 0&&(r=null),!(r===null||r instanceof qt))throw new TypeError("defaultLayout must be null or a Layout");if(r!==null){if(0>r.span)throw new Error("defaultLayout must have constant span");r.property===void 0&&(r=r.replicate("content"))}let s=-1;r&&(s=r.span,0<=s&&(t instanceof Hn||t instanceof ni)&&(s+=i.layout.span)),super(s,n),this.discriminator=i,this.usesPrefixDiscriminator=t instanceof Hn||t instanceof ni,this.defaultLayout=r,this.registry={};let o=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(a){return o(a)},this.configGetSourceVariant=function(a){o=a.bind(this)}}getSpan(t,r=0){if(0<=this.span)return this.span;const n=this.getVariant(t,r);if(!n)throw new Error("unable to determine span for unrecognized variant");return n.getSpan(t,r)}defaultGetSourceVariant(t){if(Object.prototype.hasOwnProperty.call(t,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(t,this.defaultLayout.property))return;const r=this.registry[t[this.discriminator.property]];if(r&&(!r.layout||r.property&&Object.prototype.hasOwnProperty.call(t,r.property)))return r}else for(const r in this.registry){const n=this.registry[r];if(n.property&&Object.prototype.hasOwnProperty.call(t,n.property))return n}throw new Error("unable to infer src variant")}decode(t,r=0){let n;const i=this.discriminator,s=i.decode(t,r),o=this.registry[s];if(o===void 0){const a=this.defaultLayout;let c=0;this.usesPrefixDiscriminator&&(c=i.layout.span),n=this.makeDestinationObject(),n[i.property]=s,n[a.property]=a.decode(t,r+c)}else n=o.decode(t,r);return n}encode(t,r,n=0){const i=this.getSourceVariant(t);if(i===void 0){const s=this.discriminator,o=this.defaultLayout;let a=0;return this.usesPrefixDiscriminator&&(a=s.layout.span),s.encode(t[s.property],r,n),a+o.encode(t[o.property],r,n+a)}return i.encode(t,r,n)}addVariant(t,r,n){const i=new Pg(this,t,r,n);return this.registry[t]=i,i}getVariant(t,r=0){let n;return t instanceof Uint8Array?n=this.discriminator.decode(t,r):n=t,this.registry[n]}}ne.Union=eh;class Pg extends qt{constructor(t,r,n,i){if(!(t instanceof eh))throw new TypeError("union must be a Union");if(!Number.isInteger(r)||0>r)throw new TypeError("variant must be a (non-negative) integer");if(typeof n=="string"&&i===void 0&&(i=n,n=null),n){if(!(n instanceof qt))throw new TypeError("layout must be a Layout");if(t.defaultLayout!==null&&0<=n.span&&n.span>t.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof i!="string")throw new TypeError("variant must have a String property")}let s=t.span;0>t.span&&(s=n?n.span:0,0<=s&&t.usesPrefixDiscriminator&&(s+=t.discriminator.layout.span)),super(s,i),this.union=t,this.variant=r,this.layout=n||null}getSpan(t,r=0){if(0<=this.span)return this.span;let n=0;this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span);let i=0;return this.layout&&(i=this.layout.getSpan(t,r+n)),n+i}decode(t,r=0){const n=this.makeDestinationObject();if(this!==this.union.getVariant(t,r))throw new Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?n[this.property]=this.layout.decode(t,r+i):this.property?n[this.property]=!0:this.union.usesPrefixDiscriminator&&(n[this.union.discriminator.property]=this.variant),n}encode(t,r,n=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(t,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,r,n);let s=i;if(this.layout&&(this.layout.encode(t[this.property],r,n+i),s+=this.layout.getSpan(r,n+i),0<=this.union.span&&s>this.union.span))throw new Error("encoded variant overruns containing union");return s}fromArray(t){if(this.layout)return this.layout.fromArray(t)}}ne.VariantLayout=Pg;function $o(e){return 0>e&&(e+=4294967296),e}class th extends qt{constructor(t,r,n){if(!(t instanceof Hn||t instanceof ni))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof r=="string"&&n===void 0&&(n=r,r=!1),4=r)throw new TypeError("bits must be positive integer");const i=8*t.span,s=t.fields.reduce((o,a)=>o+a.bits,0);if(r+s>i)throw new Error("bits too long for span remainder ("+(i-s)+" of "+i+" remain)");this.container=t,this.bits=r,this.valueMask=(1<>>this.start}encode(t){if(typeof t!="number"||!Number.isInteger(t)||t!==$o(t&this.valueMask))throw new TypeError(Yl("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const r=this.container._packedGetValue(),n=$o(t<n&&(n=this.length.decode(t,r)),n}decode(t,r=0){let n=this.span;return 0>n&&(n=this.length.decode(t,r)),Nt(t).slice(r,r+n)}encode(t,r,n){let i=this.length;if(this.length instanceof wn&&(i=t.length),!(t instanceof Uint8Array&&i===t.length))throw new TypeError(Yl("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(n+i>r.length)throw new RangeError("encoding overruns Uint8Array");const s=Nt(t);return Nt(r).write(s.toString("hex"),n,i,"hex"),this.length instanceof wn&&this.length.encode(i,r,n),i}}ne.Blob=Fg;class Dg extends qt{constructor(t){super(-1,t)}getSpan(t,r=0){Co(t);let n=r;for(;nr.length)throw new RangeError("encoding overruns Buffer");const o=Nt(r);return i.copy(o,n),o[n+s]=0,s+1}}ne.CString=Dg;class Hg extends qt{constructor(t,r){if(typeof t=="string"&&r===void 0&&(r=t,t=void 0),t===void 0)t=-1;else if(!Number.isInteger(t))throw new TypeError("maxSpan must be an integer");super(-1,r),this.maxSpan=t}getSpan(t,r=0){return Co(t),t.length-r}decode(t,r=0){const n=this.getSpan(t,r);if(0<=this.maxSpan&&this.maxSpanr.length)throw new RangeError("encoding overruns Buffer");return i.copy(Nt(r),n),s}}ne.UTF8=Hg;class jg extends qt{constructor(t,r){super(0,r),this.value=t}decode(t,r){return this.value}encode(t,r,n){return 0}}ne.Constant=jg,ne.greedy=(e,t)=>new Bg(e,t);var Zs=ne.offset=(e,t,r)=>new Xl(e,t,r),Ut=ne.u8=e=>new Hn(1,e),jn=ne.u16=e=>new Hn(2,e);ne.u24=e=>new Hn(3,e);var qe=ne.u32=e=>new Hn(4,e);ne.u40=e=>new Hn(5,e),ne.u48=e=>new Hn(6,e);var Gr=ne.nu64=e=>new Ig(e);ne.u16be=e=>new ni(2,e),ne.u24be=e=>new ni(3,e),ne.u32be=e=>new ni(4,e),ne.u40be=e=>new ni(5,e),ne.u48be=e=>new ni(6,e),ne.nu64be=e=>new Rg(e),ne.s8=e=>new Ks(1,e),ne.s16=e=>new Ks(2,e),ne.s24=e=>new Ks(3,e),ne.s32=e=>new Ks(4,e),ne.s40=e=>new Ks(5,e),ne.s48=e=>new Ks(6,e);var In=ne.ns64=e=>new Tg(e);ne.s16be=e=>new Lo(2,e),ne.s24be=e=>new Lo(3,e),ne.s32be=e=>new Lo(4,e),ne.s40be=e=>new Lo(5,e),ne.s48be=e=>new Lo(6,e),ne.ns64be=e=>new kg(e),ne.f32=e=>new Cg(e),ne.f32be=e=>new Lg(e),ne.f64=e=>new $g(e),ne.f64be=e=>new Og(e);var Fe=ne.struct=(e,t,r)=>new Ng(e,t,r);ne.bits=(e,t,r)=>new th(e,t,r);var en=ne.seq=(e,t,r)=>new Mg(e,t,r);ne.union=(e,t,r)=>new eh(e,t,r),ne.unionLayoutDiscriminator=(e,t)=>new vf(e,t);var nr=ne.blob=(e,t)=>new Fg(e,t);ne.cstr=e=>new Dg(e),ne.utf8=(e,t)=>new Hg(e,t),ne.constant=(e,t)=>new jg(e,t);var Na={};Object.defineProperty(Na,"__esModule",{value:!0});function xS(e){{const t=ie.Buffer.from(e);t.reverse();const r=t.toString("hex");return r.length===0?BigInt(0):BigInt(`0x${r}`)}}var SS=Na.toBigIntLE=xS;function AS(e){{const t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}Na.toBigIntBE=AS;function BS(e,t){{const r=e.toString(16),n=ie.Buffer.from(r.padStart(t*2,"0").slice(0,t*2),"hex");return n.reverse(),n}}var IS=Na.toBufferLE=BS;function RS(e,t){{const r=e.toString(16);return ie.Buffer.from(r.padStart(t*2,"0").slice(0,t*2),"hex")}}Na.toBufferBE=RS;class TS extends TypeError{constructor(t,r){let n;const{message:i,...s}=t,{path:o}=t,a=o.length===0?i:"At path: "+o.join(".")+" -- "+i;super(a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>{var c;return(c=n)!=null?c:n=[t,...r()]}}}function kS(e){return ss(e)&&typeof e[Symbol.iterator]=="function"}function ss(e){return typeof e=="object"&&e!=null}function ii(e){return typeof e=="string"?JSON.stringify(e):""+e}function CS(e){const{done:t,value:r}=e.next();return t?void 0:r}function LS(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c="Expected a value of type `"+o+"`"+(a?" with refinement `"+a+"`":"")+", but received: `"+ii(n)+"`"}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*zg(e,t,r,n){kS(e)||(e=[e]);for(const i of e){const s=LS(i,t,r,n);s&&(yield s)}}function*nh(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&ss(t.schema)&&ss(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let c=!0;for(const u of t.validator(e,a))c=!1,yield[u,void 0];for(let[u,l,y]of t.entries(e,a)){const A=nh(l,y,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o});for(const v of A)v[0]?(c=!1,yield[v[0],void 0]):s&&(l=v[1],u===void 0?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):ss(e)&&(e[u]=l))}if(c)for(const u of t.refiner(e,a))c=!1,yield[u,void 0];c&&(yield[void 0,e])}class mi{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return zg(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return zg(l,u,this,c)}:this.refiner=()=>[]}assert(t){return $S(t,this)}create(t){return Be(t,this)}is(t){return qg(t,this)}mask(t){return OS(t,this)}validate(t,r={}){return Pa(t,this,r)}}function $S(e,t){const r=Pa(e,t);if(r[0])throw r[0]}function Be(e,t){const r=Pa(e,t,{coerce:!0});if(r[0])throw r[0];return r[1]}function OS(e,t){const r=Pa(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}function qg(e,t){return!Pa(e,t)[0]}function Pa(e,t,r={}){const n=nh(e,t,r),i=CS(n);return i[0]?[new TS(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function Gs(e,t){return new mi({type:e,schema:null,validator:t})}function MS(){return Gs("any",()=>!0)}function Ce(e){return new mi({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||"Expected an array value, but received: "+ii(t)}})}function bi(){return Gs("boolean",e=>typeof e=="boolean")}function ih(e){return Gs("instance",t=>t instanceof e||"Expected a `"+e.name+"` instance, but received: "+ii(t))}function dr(e){const t=ii(e),r=typeof e;return new mi({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||"Expected the literal `"+t+"`, but received: "+ii(n)}})}function NS(){return Gs("never",()=>!1)}function Te(e){return new mi({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function te(){return Gs("number",e=>typeof e=="number"&&!isNaN(e)||"Expected a number, but received: "+ii(e))}function Qe(e){return new mi({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Vg(e,t){return new mi({type:"record",schema:null,*entries(r){if(ss(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return ss(r)||"Expected an object, but received: "+ii(r)}})}function Se(){return Gs("string",e=>typeof e=="string"||"Expected a string, but received: "+ii(e))}function sh(e){const t=NS();return new mi({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new mi({type:"union",schema:null,validator(r,n){const i=[];for(const s of e){const[...o]=nh(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return["Expected the value to satisfy a union of `"+t+"`, but received: "+ii(r),...i]}})}function Ua(){return Gs("unknown",()=>!0)}function Fa(e,t,r){return new mi({...e,coercer:(n,i)=>qg(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}var _f,PS=new Uint8Array(16);function Wg(){if(!_f&&(_f=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!_f))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return _f(PS)}var US=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function Ef(e){return typeof e=="string"&&US.test(e)}for(var Yr=[],oh=0;oh<256;++oh)Yr.push((oh+256).toString(16).substr(1));function xf(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,r=(Yr[e[t+0]]+Yr[e[t+1]]+Yr[e[t+2]]+Yr[e[t+3]]+"-"+Yr[e[t+4]]+Yr[e[t+5]]+"-"+Yr[e[t+6]]+Yr[e[t+7]]+"-"+Yr[e[t+8]]+Yr[e[t+9]]+"-"+Yr[e[t+10]]+Yr[e[t+11]]+Yr[e[t+12]]+Yr[e[t+13]]+Yr[e[t+14]]+Yr[e[t+15]]).toLowerCase();if(!Ef(r))throw TypeError("Stringified UUID is invalid");return r}var Kg,ah,ch=0,fh=0;function FS(e,t,r){var n=t&&r||0,i=t||new Array(16);e=e||{};var s=e.node||Kg,o=e.clockseq!==void 0?e.clockseq:ah;if(s==null||o==null){var a=e.random||(e.rng||Wg)();s==null&&(s=Kg=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=ah=(a[6]<<8|a[7])&16383)}var c=e.msecs!==void 0?e.msecs:Date.now(),u=e.nsecs!==void 0?e.nsecs:fh+1,l=c-ch+(u-fh)/1e4;if(l<0&&e.clockseq===void 0&&(o=o+1&16383),(l<0||c>ch)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ch=c,fh=u,ah=o,c+=122192928e5;var y=((c&268435455)*1e4+u)%4294967296;i[n++]=y>>>24&255,i[n++]=y>>>16&255,i[n++]=y>>>8&255,i[n++]=y&255;var A=c/4294967296*1e4&268435455;i[n++]=A>>>8&255,i[n++]=A&255,i[n++]=A>>>24&15|16,i[n++]=A>>>16&255,i[n++]=o>>>8|128,i[n++]=o&255;for(var v=0;v<6;++v)i[n+v]=s[v];return t||xf(i)}function Zg(e){if(!Ef(e))throw TypeError("Invalid UUID");var t,r=new Uint8Array(16);return r[0]=(t=parseInt(e.slice(0,8),16))>>>24,r[1]=t>>>16&255,r[2]=t>>>8&255,r[3]=t&255,r[4]=(t=parseInt(e.slice(9,13),16))>>>8,r[5]=t&255,r[6]=(t=parseInt(e.slice(14,18),16))>>>8,r[7]=t&255,r[8]=(t=parseInt(e.slice(19,23),16))>>>8,r[9]=t&255,r[10]=(t=parseInt(e.slice(24,36),16))/1099511627776&255,r[11]=t/4294967296&255,r[12]=t>>>24&255,r[13]=t>>>16&255,r[14]=t>>>8&255,r[15]=t&255,r}function DS(e){e=unescape(encodeURIComponent(e));for(var t=[],r=0;r>5]>>>i%32&255,o=parseInt(n.charAt(s>>>4&15)+n.charAt(s&15),16);t.push(o)}return t}function Yg(e){return(e+64>>>9<<4)+14+1}function VS(e,t){e[t>>5]|=128<>5]|=(e[n/8]&255)<>16)+(t>>16)+(r>>16);return n<<16|r&65535}function KS(e,t){return e<>>32-t}function Sf(e,t,r,n,i,s){return os(KS(os(os(t,e),os(n,s)),i),r)}function tn(e,t,r,n,i,s,o){return Sf(t&r|~t&n,e,t,i,s,o)}function rn(e,t,r,n,i,s,o){return Sf(t&n|r&~n,e,t,i,s,o)}function nn(e,t,r,n,i,s,o){return Sf(t^r^n,e,t,i,s,o)}function sn(e,t,r,n,i,s,o){return Sf(r^(t|~n),e,t,i,s,o)}var ZS=Gg("v3",48,zS),GS=ZS;function YS(e,t,r){e=e||{};var n=e.random||(e.rng||Wg)();if(n[6]=n[6]&15|64,n[8]=n[8]&63|128,t){r=r||0;for(var i=0;i<16;++i)t[r+i]=n[i];return t}return xf(n)}function XS(e,t,r,n){switch(e){case 0:return t&r^~t&n;case 1:return t^r^n;case 2:return t&r^t&n^r&n;case 3:return t^r^n}}function uh(e,t){return e<>>32-t}function JS(e){var t=[1518500249,1859775393,2400959708,3395469782],r=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof e=="string"){var n=unescape(encodeURIComponent(e));e=[];for(var i=0;i>>0;N=F,F=H,H=uh(P,30)>>>0,P=O,O=G}r[0]=r[0]+O>>>0,r[1]=r[1]+P>>>0,r[2]=r[2]+H>>>0,r[3]=r[3]+F>>>0,r[4]=r[4]+N>>>0}return[r[0]>>24&255,r[0]>>16&255,r[0]>>8&255,r[0]&255,r[1]>>24&255,r[1]>>16&255,r[1]>>8&255,r[1]&255,r[2]>>24&255,r[2]>>16&255,r[2]>>8&255,r[2]&255,r[3]>>24&255,r[3]>>16&255,r[3]>>8&255,r[3]&255,r[4]>>24&255,r[4]>>16&255,r[4]>>8&255,r[4]&255]}var QS=Gg("v5",80,JS),e3=QS,t3="00000000-0000-0000-0000-000000000000";function r3(e){if(!Ef(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}var n3=Object.freeze({__proto__:null,v1:FS,v3:GS,v4:YS,v5:e3,NIL:t3,version:r3,validate:Ef,stringify:xf,parse:Zg}),Xg=Un(n3);const i3=Xg.v4;var s3=function(e,t,r,n){if(typeof e!="string")throw new TypeError(e+" must be a string");n=n||{};const i=typeof n.version=="number"?n.version:2;if(i!==1&&i!==2)throw new TypeError(i+" must be 1 or 2");const s={method:e};if(i===2&&(s.jsonrpc="2.0"),t){if(typeof t!="object"&&!Array.isArray(t))throw new TypeError(t+" must be an object, array or omitted");s.params=t}if(typeof r>"u"){const o=typeof n.generator=="function"?n.generator:function(){return i3()};s.id=o(s,n)}else i===2&&r===null?n.notificationIdNull&&(s.id=null):s.id=r;return s};const o3=Xg.v4,a3=s3,Da=function(e,t){if(!(this instanceof Da))return new Da(e,t);t||(t={}),this.options={reviver:typeof t.reviver<"u"?t.reviver:null,replacer:typeof t.replacer<"u"?t.replacer:null,generator:typeof t.generator<"u"?t.generator:function(){return o3()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=e};var c3=Da;Da.prototype.request=function(e,t,r,n){const i=this;let s=null;const o=Array.isArray(e)&&typeof t=="function";if(this.options.version===1&&o)throw new TypeError("JSON-RPC 1.0 does not support batching");if(o||!o&&e&&typeof e=="object"&&typeof t=="function")n=t,s=e;else{typeof r=="function"&&(n=r,r=void 0);const u=typeof n=="function";try{s=a3(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(l){if(u)return n(l);throw l}if(!u)return s}let c;try{c=JSON.stringify(s,this.options.replacer)}catch(u){return n(u)}return this.callServer(c,function(u,l){i._parseResponse(u,l,n)}),s},Da.prototype._parseResponse=function(e,t,r){if(e){r(e);return}if(!t)return r();let n;try{n=JSON.parse(t,this.options.reviver)}catch(i){return r(i)}if(r.length===3)if(Array.isArray(n)){const i=function(o){return typeof o.error<"u"},s=function(o){return!i(o)};return r(null,n.filter(i),n.filter(s))}else return r(null,n.error,n.result);r(null,n)};var Jg={},lh={exports:{}};(function(e){var t=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function i(c,u,l){this.fn=c,this.context=u,this.once=l||!1}function s(c,u,l,y,A){if(typeof l!="function")throw new TypeError("The listener must be a function");var v=new i(l,y||c,A),R=r?r+u:u;return c._events[R]?c._events[R].fn?c._events[R]=[c._events[R],v]:c._events[R].push(v):(c._events[R]=v,c._eventsCount++),c}function o(c,u){--c._eventsCount===0?c._events=new n:delete c._events[u]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],l,y;if(this._eventsCount===0)return u;for(y in l=this._events)t.call(l,y)&&u.push(r?y.slice(1):y);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(l)):u},a.prototype.listeners=function(u){var l=r?r+u:u,y=this._events[l];if(!y)return[];if(y.fn)return[y.fn];for(var A=0,v=y.length,R=new Array(v);A++this.rpc_id),u?this.dataPack=u:this.dataPack=new d3.DefaultDataPack,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(t,r,n,i){return!i&&typeof n=="object"&&(i=n,n=null),new Promise((s,o)=>{if(!this.ready)return o(new Error("socket not ready"));const a=this.generate_request_id(t,r),c={jsonrpc:"2.0",method:t,params:r||void 0,id:a};this.socket.send(this.dataPack.encode(c),i,u=>{if(u)return o(u);this.queue[a]={promise:[s,o]},n&&(this.queue[a].timeout=setTimeout(()=>{delete this.queue[a],o(new Error("reply timeout"))},n))})})}async login(t){const r=await this.call("rpc.login",t);if(!r)throw new Error("authentication failed");return r}async listMethods(){return await this.call("__listMethods")}notify(t,r){return new Promise((n,i)=>{if(!this.ready)return i(new Error("socket not ready"));const s={jsonrpc:"2.0",method:t,params:r};this.socket.send(this.dataPack.encode(s),o=>{if(o)return i(o);n()})})}async subscribe(t){typeof t=="string"&&(t=[t]);const r=await this.call("rpc.on",t);if(typeof t=="string"&&r[t]!=="ok")throw new Error("Failed subscribing to an event '"+t+"' with: "+r[t]);return r}async unsubscribe(t){typeof t=="string"&&(t=[t]);const r=await this.call("rpc.off",t);if(typeof t=="string"&&r[t]!=="ok")throw new Error("Failed unsubscribing from an event with: "+r);return r}close(t,r){this.socket.close(t||1e3,r)}setAutoReconnect(t){this.reconnect=t}setReconnectInterval(t){this.reconnect_interval=t}setMaxReconnects(t){this.max_reconnects=t}_connect(t,r){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(t,r),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:n})=>{n instanceof ArrayBuffer&&(n=ie.Buffer.from(n).toString());try{n=this.dataPack.decode(n)}catch{return}if(n.notification&&this.listeners(n.notification).length){if(!Object.keys(n.params).length)return this.emit(n.notification);const i=[n.notification];if(n.params.constructor===Object)i.push(n.params);else for(let s=0;s{this.emit.apply(this,i)})}if(!this.queue[n.id])return n.method?Promise.resolve().then(()=>{this.emit(n.method,n?.params)}):void 0;"error"in n=="result"in n&&this.queue[n.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[n.id].timeout&&clearTimeout(this.queue[n.id].timeout),n.error?this.queue[n.id].promise[1](n.error):this.queue[n.id].promise[0](n.result),delete this.queue[n.id]}),this.socket.addEventListener("error",n=>this.emit("error",n)),this.socket.addEventListener("close",({code:n,reason:i})=>{this.ready&&setTimeout(()=>this.emit("close",n,i),0),this.ready=!1,this.socket=void 0,n!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)&&(this.reconnect_timer_id=setTimeout(()=>this._connect(t,r),this.reconnect_interval)))})}}var g3=Jg.default=p3,Qg={};Object.defineProperty(Qg,"__esModule",{value:!0});const y3=lh.exports;class w3 extends y3.EventEmitter{socket;constructor(t,r,n){super(),this.socket=new window.WebSocket(t,n),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=i=>this.emit("message",i.data),this.socket.onerror=i=>this.emit("error",i),this.socket.onclose=i=>{this.emit("close",i.code,i.reason)}}send(t,r,n){const i=n||r;try{this.socket.send(t),i()}catch(s){i(s)}}close(t,r){this.socket.close(t,r)}addEventListener(t,r,n){this.socket.addEventListener(t,r,n)}}function m3(e,t){return new w3(e,t)}var b3=Qg.default=m3;const v3=[],_3=BigInt(0),Ha=BigInt(1),E3=BigInt(2),x3=BigInt(7),S3=BigInt(256),A3=BigInt(113);for(let e=0,t=Ha,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5];let i=_3;for(let s=0;s<7;s++)t=(t<>x3)*A3)%S3,t&E3&&(i^=Ha<<(Ha<Number.parseInt(u[0],16)&8?"00"+u:u,r=u=>{const l=u.toString(16);return l.length&1?`0${l}`:l},n=t(r(e.s)),i=t(r(e.r)),s=n.length/2,o=i.length/2,a=r(s),c=r(o);return`30${r(o+s+4)}02${c}${i}02${a}${n}`}},Oi=BigInt(0),zn=BigInt(1);BigInt(2);const e1=BigInt(3);BigInt(4);function T3(e){const t=B3(e),{Fp:r}=t,n=t.toBytes||((R,O,P)=>{const H=O.toAffine();return zs(Uint8Array.from([4]),r.toBytes(H.x),r.toBytes(H.y))}),i=t.fromBytes||(R=>{const O=R.subarray(1),P=r.fromBytes(O.subarray(0,r.BYTES)),H=r.fromBytes(O.subarray(r.BYTES,2*r.BYTES));return{x:P,y:H}});function s(R){const{a:O,b:P}=t,H=r.sqr(R),F=r.mul(H,R);return r.add(r.add(F,r.mul(R,O)),P)}if(!r.eql(r.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function o(R){return typeof R=="bigint"&&Oir.eql(N,r.ZERO);return F(P)&&F(H)?y.ZERO:new y(P,H,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(O){const P=r.invertBatch(O.map(H=>H.pz));return O.map((H,F)=>H.toAffine(P[F])).map(y.fromAffine)}static fromHex(O){const P=y.fromAffine(i(Cr("pointHex",O)));return P.assertValidity(),P}static fromPrivateKey(O){return y.BASE.multiply(c(O))}_setWindowSize(O){this._WINDOW_SIZE=O,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!r.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:O,y:P}=this.toAffine();if(!r.isValid(O)||!r.isValid(P))throw new Error("bad point: x or y not FE");const H=r.sqr(P),F=s(O);if(!r.eql(H,F))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:O}=this.toAffine();if(r.isOdd)return!r.isOdd(O);throw new Error("Field doesn't support isOdd")}equals(O){l(O);const{px:P,py:H,pz:F}=this,{px:N,py:$,pz:q}=O,G=r.eql(r.mul(P,q),r.mul(N,F)),Z=r.eql(r.mul(H,q),r.mul($,F));return G&&Z}negate(){return new y(this.px,r.neg(this.py),this.pz)}double(){const{a:O,b:P}=t,H=r.mul(P,e1),{px:F,py:N,pz:$}=this;let q=r.ZERO,G=r.ZERO,Z=r.ZERO,z=r.mul(F,F),ee=r.mul(N,N),se=r.mul($,$),Q=r.mul(F,N);return Q=r.add(Q,Q),Z=r.mul(F,$),Z=r.add(Z,Z),q=r.mul(O,Z),G=r.mul(H,se),G=r.add(q,G),q=r.sub(ee,G),G=r.add(ee,G),G=r.mul(q,G),q=r.mul(Q,q),Z=r.mul(H,Z),se=r.mul(O,se),Q=r.sub(z,se),Q=r.mul(O,Q),Q=r.add(Q,Z),Z=r.add(z,z),z=r.add(Z,z),z=r.add(z,se),z=r.mul(z,Q),G=r.add(G,z),se=r.mul(N,$),se=r.add(se,se),z=r.mul(se,Q),q=r.sub(q,z),Z=r.mul(se,ee),Z=r.add(Z,Z),Z=r.add(Z,Z),new y(q,G,Z)}add(O){l(O);const{px:P,py:H,pz:F}=this,{px:N,py:$,pz:q}=O;let G=r.ZERO,Z=r.ZERO,z=r.ZERO;const ee=t.a,se=r.mul(t.b,e1);let Q=r.mul(P,N),I=r.mul(H,$),g=r.mul(F,q),f=r.add(P,H),h=r.add(N,$);f=r.mul(f,h),h=r.add(Q,I),f=r.sub(f,h),h=r.add(P,F);let m=r.add(N,q);return h=r.mul(h,m),m=r.add(Q,g),h=r.sub(h,m),m=r.add(H,F),G=r.add($,q),m=r.mul(m,G),G=r.add(I,g),m=r.sub(m,G),z=r.mul(ee,h),G=r.mul(se,g),z=r.add(G,z),G=r.sub(I,z),z=r.add(I,z),Z=r.mul(G,z),I=r.add(Q,Q),I=r.add(I,Q),g=r.mul(ee,g),h=r.mul(se,h),I=r.add(I,g),g=r.sub(Q,g),g=r.mul(ee,g),h=r.add(h,g),Q=r.mul(I,h),Z=r.add(Z,Q),Q=r.mul(m,h),G=r.mul(f,G),G=r.sub(G,Q),Q=r.mul(f,I),z=r.mul(m,z),z=r.add(z,Q),new y(G,Z,z)}subtract(O){return this.add(O.negate())}is0(){return this.equals(y.ZERO)}wNAF(O){return v.wNAFCached(this,u,O,P=>{const H=r.invertBatch(P.map(F=>F.pz));return P.map((F,N)=>F.toAffine(H[N])).map(y.fromAffine)})}multiplyUnsafe(O){const P=y.ZERO;if(O===Oi)return P;if(a(O),O===zn)return this;const{endo:H}=t;if(!H)return v.unsafeLadder(this,O);let{k1neg:F,k1:N,k2neg:$,k2:q}=H.splitScalar(O),G=P,Z=P,z=this;for(;N>Oi||q>Oi;)N&zn&&(G=G.add(z)),q&zn&&(Z=Z.add(z)),z=z.double(),N>>=zn,q>>=zn;return F&&(G=G.negate()),$&&(Z=Z.negate()),Z=new y(r.mul(Z.px,H.beta),Z.py,Z.pz),G.add(Z)}multiply(O){a(O);let P=O,H,F;const{endo:N}=t;if(N){const{k1neg:$,k1:q,k2neg:G,k2:Z}=N.splitScalar(P);let{p:z,f:ee}=this.wNAF(q),{p:se,f:Q}=this.wNAF(Z);z=v.constTimeNegate($,z),se=v.constTimeNegate(G,se),se=new y(r.mul(se.px,N.beta),se.py,se.pz),H=z.add(se),F=ee.add(Q)}else{const{p:$,f:q}=this.wNAF(P);H=$,F=q}return y.normalizeZ([H,F])[0]}multiplyAndAddUnsafe(O,P,H){const F=y.BASE,N=(q,G)=>G===Oi||G===zn||!q.equals(F)?q.multiplyUnsafe(G):q.multiply(G),$=N(this,P).add(N(O,H));return $.is0()?void 0:$}toAffine(O){const{px:P,py:H,pz:F}=this,N=this.is0();O==null&&(O=N?r.ONE:r.inv(F));const $=r.mul(P,O),q=r.mul(H,O),G=r.mul(F,O);if(N)return{x:r.ZERO,y:r.ZERO};if(!r.eql(G,r.ONE))throw new Error("invZ was invalid");return{x:$,y:q}}isTorsionFree(){const{h:O,isTorsionFree:P}=t;if(O===zn)return!0;if(P)return P(y,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:O,clearCofactor:P}=t;return O===zn?this:P?P(y,this):this.multiplyUnsafe(t.h)}toRawBytes(O=!0){return this.assertValidity(),n(y,this,O)}toHex(O=!0){return Hs(this.toRawBytes(O))}}y.BASE=new y(t.Gx,t.Gy,r.ONE),y.ZERO=new y(r.ZERO,r.ONE,r.ZERO);const A=t.nBitLength,v=lg(y,t.endo?Math.ceil(A/2):A);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function k3(e){const t=Ul(e);return To(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function C3(e){const t=k3(e),{Fp:r,n}=t,i=r.BYTES+1,s=2*r.BYTES+1;function o(h){return OiHs(Ro(h,t.nByteLength));function R(h){const m=n>>zn;return h>m}function O(h){return R(h)?a(-h):h}const P=(h,m,_)=>js(h.slice(m,_));class H{constructor(m,_,E){this.r=m,this.s=_,this.recovery=E,this.assertValidity()}static fromCompact(m){const _=t.nByteLength;return m=Cr("compactSignature",m,_*2),new H(P(m,0,_),P(m,_,2*_))}static fromDER(m){const{r:_,s:E}=Ys.toSig(Cr("DER",m));return new H(_,E)}assertValidity(){if(!A(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!A(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(m){return new H(this.r,this.s,m)}recoverPublicKey(m){const{r:_,s:E,recovery:x}=this,T=Z(Cr("msgHash",m));if(x==null||![0,1,2,3].includes(x))throw new Error("recovery id invalid");const B=x===2||x===3?_+t.n:_;if(B>=r.ORDER)throw new Error("recovery id 2 or 3 invalid");const d=x&1?"03":"02",k=u.fromHex(d+v(B)),W=c(B),K=a(-T*W),re=a(E*W),xe=u.BASE.multiplyAndAddUnsafe(k,K,re);if(!xe)throw new Error("point at infinify");return xe.assertValidity(),xe}hasHighS(){return R(this.s)}normalizeS(){return this.hasHighS()?new H(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return Bo(this.toDERHex())}toDERHex(){return Ys.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Bo(this.toCompactHex())}toCompactHex(){return v(this.r)+v(this.s)}}const F={isValidPrivateKey(h){try{return l(h),!0}catch{return!1}},normPrivateKeyToScalar:l,randomPrivateKey:()=>{const h=ug(t.n);return Ux(t.randomBytes(h),t.n)},precompute(h=8,m=u.BASE){return m._setWindowSize(h),m.multiply(BigInt(3)),m}};function N(h,m=!0){return u.fromPrivateKey(h).toRawBytes(m)}function $(h){const m=Ds(h),_=typeof h=="string",E=(m||_)&&h.length;return m?E===i||E===s:_?E===2*i||E===2*s:h instanceof u}function q(h,m,_=!0){if($(h))throw new Error("first arg must be private key");if(!$(m))throw new Error("second arg must be public key");return u.fromHex(m).multiply(l(h)).toRawBytes(_)}const G=t.bits2int||function(h){const m=js(h),_=h.length*8-t.nBitLength;return _>0?m>>BigInt(_):m},Z=t.bits2int_modN||function(h){return a(G(h))},z=$l(t.nBitLength);function ee(h){if(typeof h!="bigint")throw new Error("bigint expected");if(!(Oi<=h&&hge in _))throw new Error("sign() legacy options not supported");const{hash:E,randomBytes:x}=t;let{lowS:T,prehash:B,extraEntropy:d}=_;T==null&&(T=!0),h=Cr("msgHash",h),B&&(h=Cr("prehashed msgHash",E(h)));const k=Z(h),W=l(m),K=[ee(W),ee(k)];if(d!=null&&d!==!1){const ge=d===!0?x(r.BYTES):d;K.push(Cr("extraEntropy",ge))}const re=zs(...K),xe=k;function be(ge){const tt=G(ge);if(!A(tt))return;const Ue=c(tt),Pe=u.BASE.multiply(tt).toAffine(),pe=a(Pe.x);if(pe===Oi)return;const we=a(Ue*a(xe+pe*W));if(we===Oi)return;let ke=(Pe.x===pe?0:2)|Number(Pe.y&zn),vt=we;return T&&R(we)&&(vt=O(we),ke^=1),new H(pe,vt,ke)}return{seed:re,k2sig:be}}const Q={lowS:t.lowS,prehash:!1},I={lowS:t.lowS,prehash:!1};function g(h,m,_=Q){const{seed:E,k2sig:x}=se(h,m,_),T=t;return ig(T.hash.outputLen,T.nByteLength,T.hmac)(E,x)}u.BASE._setWindowSize(8);function f(h,m,_,E=I){const x=h;if(m=Cr("msgHash",m),_=Cr("publicKey",_),"strict"in E)throw new Error("options.strict was renamed to lowS");const{lowS:T,prehash:B}=E;let d,k;try{if(typeof x=="string"||Ds(x))try{d=H.fromDER(x)}catch(Pe){if(!(Pe instanceof Ys.Err))throw Pe;d=H.fromCompact(x)}else if(typeof x=="object"&&typeof x.r=="bigint"&&typeof x.s=="bigint"){const{r:Pe,s:pe}=x;d=new H(Pe,pe)}else throw new Error("PARSE");k=u.fromHex(_)}catch(Pe){if(Pe.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(T&&d.hasHighS())return!1;B&&(m=t.hash(m));const{r:W,s:K}=d,re=Z(m),xe=c(K),be=a(re*xe),ge=a(W*xe),tt=u.BASE.multiplyAndAddUnsafe(k,be,ge)?.toAffine();return tt?a(tt.x)===W:!1}return{CURVE:t,getPublicKey:N,getSharedSecret:q,sign:g,verify:f,ProjectivePoint:u,Signature:H,utils:F}}class t1 extends Zp{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,GE(t);const n=kl(r);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(n.length>i?t.create().update(n).digest():n);for(let o=0;onew t1(e,t).update(r).digest();r1.create=(e,t)=>new t1(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function L3(e){return{hash:e,hmac:(t,...r)=>r1(e,t,Kp(...r)),randomBytes:Yp}}function $3(e,t){const r=n=>C3({...e,...L3(n)});return Object.freeze({...r(t),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const n1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),i1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),O3=BigInt(1),hh=BigInt(2),s1=(e,t)=>(e+t/hh)/t;function M3(e){const t=n1,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,y=wr(l,r,t)*l%t,A=wr(y,r,t)*l%t,v=wr(A,hh,t)*u%t,R=wr(v,i,t)*v%t,O=wr(R,s,t)*R%t,P=wr(O,a,t)*O%t,H=wr(P,c,t)*P%t,F=wr(H,a,t)*O%t,N=wr(F,r,t)*l%t,$=wr(N,o,t)*R%t,q=wr($,n,t)*u%t,G=wr(q,hh,t);if(!dh.eql(dh.sqr(G),e))throw new Error("Cannot find square root");return G}const dh=cg(n1,void 0,void 0,{sqrt:M3}),ph=$3({a:BigInt(0),b:BigInt(7),Fp:dh,n:i1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=i1,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-O3*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=s1(s*e,t),c=s1(-n*e,t);let u=ir(e-a*r-c*i,t),l=ir(-a*n-c*s,t);const y=u>o,A=l>o;if(y&&(u=t-u),A&&(l=t-l),u>o||l>o)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:y,k1:u,k2neg:A,k2:l}}}},ql);BigInt(0),ph.ProjectivePoint,uf.utils.randomPrivateKey;function o1(e){try{return uf.ExtendedPoint.fromHex(e),!0}catch{return!1}}const a1=(e,t)=>uf.sign(e,t.slice(0,32)),N3=uf.verify,Mo=e=>ie.Buffer.isBuffer(e)?e:e instanceof Uint8Array?ie.Buffer.from(e.buffer,e.byteOffset,e.byteLength):ie.Buffer.from(e);class P3{constructor(t){Object.assign(this,t)}encode(){return ie.Buffer.from(Sg(Af,this))}static decode(t){return Ag(Af,this,t)}static decodeUnchecked(t){return bg(Af,this,t)}}const Af=new Map;var c1;const U3=32,as=32;function F3(e){return e._bn!==void 0}let f1=1;class et extends P3{constructor(t){if(super({}),this._bn=void 0,F3(t))this._bn=t._bn;else{if(typeof t=="string"){const r=Ar.decode(t);if(r.length!=as)throw new Error("Invalid public key input");this._bn=new wg(r)}else this._bn=new wg(t);if(this._bn.byteLength()>as)throw new Error("Invalid public key input")}}static unique(){const t=new et(f1);return f1+=1,new et(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return Ar.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(ie.Buffer);if(t.length===as)return t;const r=ie.Buffer.alloc(32);return t.copy(r,32-t.length),r}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,r,n){const i=ie.Buffer.concat([t.toBuffer(),ie.Buffer.from(r),n.toBuffer()]),s=ql(i);return new et(s)}static createProgramAddressSync(t,r){let n=ie.Buffer.alloc(0);t.forEach(function(s){if(s.length>U3)throw new TypeError("Max seed length exceeded");n=ie.Buffer.concat([n,Mo(s)])}),n=ie.Buffer.concat([n,r.toBuffer(),ie.Buffer.from("ProgramDerivedAddress")]);const i=ql(n);if(o1(i))throw new Error("Invalid seeds, address must fall off the curve");return new et(i)}static async createProgramAddress(t,r){return this.createProgramAddressSync(t,r)}static findProgramAddressSync(t,r){let n=255,i;for(;n!=0;){try{const s=t.concat(ie.Buffer.from([n]));i=this.createProgramAddressSync(s,r)}catch(s){if(s instanceof TypeError)throw s;n--;continue}return[i,n]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,r){return this.findProgramAddressSync(t,r)}static isOnCurve(t){const r=new et(t);return o1(r.toBytes())}}c1=et,et.default=new c1("11111111111111111111111111111111"),Af.set(et,{kind:"struct",fields:[["_bn","u256"]]}),new et("BPFLoader1111111111111111111111111111111111");const No=1280-40-8,gh=127,Bf=64;class u1 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(u1.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class l1 extends Error{constructor(t,r){super(`Transaction was not confirmed in ${r.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(l1.prototype,"name",{value:"TransactionExpiredTimeoutError"});class ja extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(ja.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class If{constructor(t,r){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=r}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const r of this.keySegments()){if(t255+1)throw new Error("Account index overflow encountered during compilation");const n=new Map;this.keySegments().flat().forEach((s,o)=>{n.set(s.toBase58(),o)});const i=s=>{const o=n.get(s.toBase58());if(o===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return o};return t.map(s=>({programIdIndex:i(s.programId),accountKeyIndexes:s.keys.map(o=>i(o.pubkey)),data:s.data}))}}const St=(e="publicKey")=>nr(32,e),D3=(e="signature")=>nr(64,e),Po=(e="string")=>{const t=Fe([qe("length"),qe("lengthPadding"),nr(Zs(qe(),-8),"chars")],e),r=t.decode.bind(t),n=t.encode.bind(t),i=t;return i.decode=(s,o)=>r(s,o).chars.toString(),i.encode=(s,o,a)=>{const c={chars:ie.Buffer.from(s,"utf8")};return n(c,o,a)},i.alloc=s=>qe().span+qe().span+ie.Buffer.from(s,"utf8").length,i},H3=(e="authorized")=>Fe([St("staker"),St("withdrawer")],e),j3=(e="lockup")=>Fe([In("unixTimestamp"),In("epoch"),St("custodian")],e),z3=(e="voteInit")=>Fe([St("nodePubkey"),St("authorizedVoter"),St("authorizedWithdrawer"),Ut("commission")],e),q3=(e="voteAuthorizeWithSeedArgs")=>Fe([qe("voteAuthorizationType"),St("currentAuthorityDerivedKeyOwnerPubkey"),Po("currentAuthorityDerivedKeySeed"),St("newAuthorized")],e);function Rn(e){let t=0,r=0;for(;;){let n=e.shift();if(t|=(n&127)<>=7,r==0){e.push(n);break}else n|=128,e.push(n)}}function sr(e,t){if(!e)throw new Error(t||"Assertion failed")}class Rf{constructor(t,r){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=r}static compile(t,r){const n=new Map,i=o=>{const a=o.toBase58();let c=n.get(a);return c===void 0&&(c={isSigner:!1,isWritable:!1,isInvoked:!1},n.set(a,c)),c},s=i(r);s.isSigner=!0,s.isWritable=!0;for(const o of t){i(o.programId).isInvoked=!0;for(const a of o.keys){const c=i(a.pubkey);c.isSigner||=a.isSigner,c.isWritable||=a.isWritable}}return new Rf(r,n)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];sr(t.length<=256,"Max static account keys length exceeded");const r=t.filter(([,c])=>c.isSigner&&c.isWritable),n=t.filter(([,c])=>c.isSigner&&!c.isWritable),i=t.filter(([,c])=>!c.isSigner&&c.isWritable),s=t.filter(([,c])=>!c.isSigner&&!c.isWritable),o={numRequiredSignatures:r.length+n.length,numReadonlySignedAccounts:n.length,numReadonlyUnsignedAccounts:s.length};{sr(r.length>0,"Expected at least one writable signer key");const[c]=r[0];sr(c===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const a=[...r.map(([c])=>new et(c)),...n.map(([c])=>new et(c)),...i.map(([c])=>new et(c)),...s.map(([c])=>new et(c))];return[o,a]}extractTableLookup(t){const[r,n]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&o.isWritable),[i,s]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&!o.isWritable);if(!(r.length===0&&i.length===0))return[{accountKey:t.key,writableIndexes:r,readonlyIndexes:i},{writable:n,readonly:s}]}drainKeysFoundInLookupTable(t,r){const n=new Array,i=new Array;for(const[s,o]of this.keyMetaMap.entries())if(r(o)){const a=new et(s),c=t.findIndex(u=>u.equals(a));c>=0&&(sr(c<256,"Max lookup table index exceeded"),n.push(c),i.push(a),this.keyMetaMap.delete(s))}return[n,i]}}const h1="Reached end of buffer unexpectedly";function Mi(e){if(e.length===0)throw new Error(h1);return e.shift()}function kn(e,...t){const[r]=t;if(t.length===2?r+(t[1]??0)>e.length:r>=e.length)throw new Error(h1);return e.splice(...t)}class Ni{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(r=>new et(r)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(r=>this.indexToProgramIds.set(r.programIdIndex,this.accountKeys[r.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:Ar.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new If(this.staticAccountKeys)}static compile(t){const r=Rf.compile(t.instructions,t.payerKey),[n,i]=r.getMessageComponents(),o=new If(i).compileInstructions(t.instructions).map(a=>({programIdIndex:a.programIdIndex,accounts:a.accountKeyIndexes,data:Ar.encode(a.data)}));return new Ni({header:n,accountKeys:i,recentBlockhash:t.recentBlockhash,instructions:o})}isAccountSigner(t){return t=this.header.numRequiredSignatures){const n=t-r,s=this.accountKeys.length-r-this.header.numReadonlyUnsignedAccounts;return n!this.isProgramId(r))}serialize(){const t=this.accountKeys.length;let r=[];Tn(r,t);const n=this.instructions.map(y=>{const{accounts:A,programIdIndex:v}=y,R=Array.from(Ar.decode(y.data));let O=[];Tn(O,A.length);let P=[];return Tn(P,R.length),{programIdIndex:v,keyIndicesCount:ie.Buffer.from(O),keyIndices:A,dataLength:ie.Buffer.from(P),data:R}});let i=[];Tn(i,n.length);let s=ie.Buffer.alloc(No);ie.Buffer.from(i).copy(s);let o=i.length;n.forEach(y=>{const v=Fe([Ut("programIdIndex"),nr(y.keyIndicesCount.length,"keyIndicesCount"),en(Ut("keyIndex"),y.keyIndices.length,"keyIndices"),nr(y.dataLength.length,"dataLength"),en(Ut("userdatum"),y.data.length,"data")]).encode(y,s,o);o+=v}),s=s.slice(0,o);const a=Fe([nr(1,"numRequiredSignatures"),nr(1,"numReadonlySignedAccounts"),nr(1,"numReadonlyUnsignedAccounts"),nr(r.length,"keyCount"),en(St("key"),t,"keys"),St("recentBlockhash")]),c={numRequiredSignatures:ie.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:ie.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:ie.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:ie.Buffer.from(r),keys:this.accountKeys.map(y=>Mo(y.toBytes())),recentBlockhash:Ar.decode(this.recentBlockhash)};let u=ie.Buffer.alloc(2048);const l=a.encode(c,u);return s.copy(u,l),u.slice(0,l+s.length)}static from(t){let r=[...t];const n=Mi(r);if(n!==(n&gh))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const i=Mi(r),s=Mi(r),o=Rn(r);let a=[];for(let A=0;A0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new If(this.staticAccountKeys,r)}isAccountSigner(t){return t=n){const i=t-n,s=this.addressTableLookups.reduce((o,a)=>o+a.writableIndexes.length,0);return i=this.header.numRequiredSignatures){const i=t-r,o=n-r-this.header.numReadonlyUnsignedAccounts;return is.key.equals(n.accountKey));if(!i)throw new Error(`Failed to find address lookup table account for table key ${n.accountKey.toBase58()}`);for(const s of n.writableIndexes)if(sl.toBytes()),recentBlockhash:Ar.decode(this.recentBlockhash),instructionsLength:new Uint8Array(n),serializedInstructions:r,addressTableLookupsLength:new Uint8Array(s),serializedAddressTableLookups:i},a);return a.slice(0,u)}serializeInstructions(){let t=0;const r=new Uint8Array(No);for(const n of this.compiledInstructions){const i=Array();Tn(i,n.accountKeyIndexes.length);const s=Array();Tn(s,n.data.length);const o=Fe([Ut("programIdIndex"),nr(i.length,"encodedAccountKeyIndexesLength"),en(Ut(),n.accountKeyIndexes.length,"accountKeyIndexes"),nr(s.length,"encodedDataLength"),nr(n.data.length,"data")]);t+=o.encode({programIdIndex:n.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(i),accountKeyIndexes:n.accountKeyIndexes,encodedDataLength:new Uint8Array(s),data:n.data},r,t)}return r.slice(0,t)}serializeAddressTableLookups(){let t=0;const r=new Uint8Array(No);for(const n of this.addressTableLookups){const i=Array();Tn(i,n.writableIndexes.length);const s=Array();Tn(s,n.readonlyIndexes.length);const o=Fe([St("accountKey"),nr(i.length,"encodedWritableIndexesLength"),en(Ut(),n.writableIndexes.length,"writableIndexes"),nr(s.length,"encodedReadonlyIndexesLength"),en(Ut(),n.readonlyIndexes.length,"readonlyIndexes")]);t+=o.encode({accountKey:n.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(i),writableIndexes:n.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(s),readonlyIndexes:n.readonlyIndexes},r,t)}return r.slice(0,t)}static deserialize(t){let r=[...t];const n=Mi(r),i=n&gh;sr(n!==i,"Expected versioned message but received legacy message");const s=i;sr(s===0,`Expected versioned message with version 0 but found version ${s}`);const o={numRequiredSignatures:Mi(r),numReadonlySignedAccounts:Mi(r),numReadonlyUnsignedAccounts:Mi(r)},a=[],c=Rn(r);for(let R=0;R{const t=d1.deserializeMessageVersion(e);if(t==="legacy")return Ni.from(e);if(t===0)return za.deserialize(e);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let cs=function(e){return e[e.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",e[e.PROCESSED=1]="PROCESSED",e[e.TIMED_OUT=2]="TIMED_OUT",e[e.NONCE_INVALID=3]="NONCE_INVALID",e}({});const V3=ie.Buffer.alloc(Bf).fill(0);class p1{constructor(t){this.keys=void 0,this.programId=void 0,this.data=ie.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:r,isWritable:n})=>({pubkey:t.toJSON(),isSigner:r,isWritable:n})),programId:this.programId.toJSON(),data:[...this.data]}}}class fs{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:r,nonceInfo:n}=t;this.minNonceContextSlot=r,this.nonceInfo=n}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:r,lastValidBlockHeight:n}=t;this.recentBlockhash=r,this.lastValidBlockHeight=n}else{const{recentBlockhash:r,nonceInfo:n}=t;n&&(this.nonceInfo=n),this.recentBlockhash=r}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(r=>{"instructions"in r?this.instructions=this.instructions.concat(r.instructions):"data"in r&&"programId"in r&&"keys"in r?this.instructions.push(r):this.instructions.push(new p1(r))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,r;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?r=[this.nonceInfo.nonceInstruction,...this.instructions]:r=this.instructions):(t=this.recentBlockhash,r=this.instructions),!t)throw new Error("Transaction recentBlockhash required");r.length<1&&console.warn("No instructions provided");let n;if(this.feePayer)n=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)n=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let O=0;O{O.keys.forEach(H=>{s.push({...H})});const P=O.programId.toString();i.includes(P)||i.push(P)}),i.forEach(O=>{s.push({pubkey:new et(O),isSigner:!1,isWritable:!1})});const o=[];s.forEach(O=>{const P=O.pubkey.toString(),H=o.findIndex(F=>F.pubkey.toString()===P);H>-1?(o[H].isWritable=o[H].isWritable||O.isWritable,o[H].isSigner=o[H].isSigner||O.isSigner):o.push(O)}),o.sort(function(O,P){if(O.isSigner!==P.isSigner)return O.isSigner?-1:1;if(O.isWritable!==P.isWritable)return O.isWritable?-1:1;const H={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return O.pubkey.toBase58().localeCompare(P.pubkey.toBase58(),"en",H)});const a=o.findIndex(O=>O.pubkey.equals(n));if(a>-1){const[O]=o.splice(a,1);O.isSigner=!0,O.isWritable=!0,o.unshift(O)}else o.unshift({pubkey:n,isSigner:!0,isWritable:!0});for(const O of this.signatures){const P=o.findIndex(H=>H.pubkey.equals(O.publicKey));if(P>-1)o[P].isSigner||(o[P].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${O.publicKey.toString()}`)}let c=0,u=0,l=0;const y=[],A=[];o.forEach(({pubkey:O,isSigner:P,isWritable:H})=>{P?(y.push(O.toString()),c+=1,H||(u+=1)):(A.push(O.toString()),H||(l+=1))});const v=y.concat(A),R=r.map(O=>{const{data:P,programId:H}=O;return{programIdIndex:v.indexOf(H.toString()),accounts:O.keys.map(F=>v.indexOf(F.pubkey.toString())),data:Ar.encode(P)}});return R.forEach(O=>{sr(O.programIdIndex>=0),O.accounts.forEach(P=>sr(P>=0))}),new Ni({header:{numRequiredSignatures:c,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:l},accountKeys:v,recentBlockhash:t,instructions:R})}_compile(){const t=this.compileMessage(),r=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===r.length&&this.signatures.every((i,s)=>r[s].equals(i.publicKey))||(this.signatures=r.map(n=>({signature:null,publicKey:n}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const r=new Set;this.signatures=t.filter(n=>{const i=n.toString();return r.has(i)?!1:(r.add(i),!0)}).map(n=>({signature:null,publicKey:n}))}sign(...t){if(t.length===0)throw new Error("No signers");const r=new Set,n=[];for(const s of t){const o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}this.signatures=n.map(s=>({signature:null,publicKey:s.publicKey}));const i=this._compile();this._partialSign(i,...n)}partialSign(...t){if(t.length===0)throw new Error("No signers");const r=new Set,n=[];for(const s of t){const o=s.publicKey.toString();r.has(o)||(r.add(o),n.push(s))}const i=this._compile();this._partialSign(i,...n)}_partialSign(t,...r){const n=t.serialize();r.forEach(i=>{const s=a1(n,i.secretKey);this._addSignature(i.publicKey,Mo(s))})}addSignature(t,r){this._compile(),this._addSignature(t,r)}_addSignature(t,r){sr(r.length===64);const n=this.signatures.findIndex(i=>t.equals(i.publicKey));if(n<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[n].signature=ie.Buffer.from(r)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,r){const n={};for(const{signature:i,publicKey:s}of this.signatures)i===null?r&&(n.missing||=[]).push(s):N3(i,t,s.toBytes())||(n.invalid||=[]).push(s);return n.invalid||n.missing?n:void 0}serialize(t){const{requireAllSignatures:r,verifySignatures:n}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),i=this.serializeMessage();if(n){const s=this._getMessageSignednessErrors(i,r);if(s){let o="Signature verification failed.";throw s.invalid&&(o+=` Invalid signature for public key${s.invalid.length===1?"":"(s)"} [\`${s.invalid.map(a=>a.toBase58()).join("`, `")}\`].`),s.missing&&(o+=` -Missing signature for public key${s.missing.length===1?"":"(s)"} [\`${s.missing.map(a=>a.toBase58()).join("`, `")}\`].`),new Error(o)}}return this._serialize(i)}_serialize(t){const{signatures:r}=this,n=[];Tn(n,r.length);const i=n.length+r.length*64+t.length,s=ie.Buffer.alloc(i);return sr(r.length<256),ie.Buffer.from(n).copy(s,0),r.forEach(({signature:o},a)=>{o!==null&&(sr(o.length===64,"signature has invalid length"),ie.Buffer.from(o).copy(s,n.length+a*64))}),t.copy(s,n.length+r.length*64),sr(s.length<=Fo,`Transaction too large: ${s.length} > ${Fo}`),s}get keys(){return sr(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return sr(this.instructions.length===1),this.instructions[0].programId}get data(){return sr(this.instructions.length===1),this.instructions[0].data}static from(t){let r=[...t];const n=Rn(r);let i=[];for(let s=0;s0&&(n.feePayer=t.accountKeys[0]),r.forEach((i,s)=>{const o={signature:i==Ar.encode(nA)?null:Ar.decode(i),publicKey:t.accountKeys[s]};n.signatures.push(o)}),t.instructions.forEach(i=>{const s=i.accounts.map(o=>{const a=t.accountKeys[o];return{pubkey:a,isSigner:n.signatures.some(c=>c.publicKey.toString()===a.toString())||t.isAccountSigner(o),isWritable:t.isAccountWritable(o)}});n.instructions.push(new S1({keys:s,programId:t.accountKeys[i.programIdIndex],data:Ar.decode(i.data)}))}),n._message=t,n._json=n.toJSON(),n}}class Ka{get version(){return this.message.version}constructor(t,r){if(this.signatures=void 0,this.message=void 0,r!==void 0)sr(r.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=r;else{const n=[];for(let i=0;io.equals(i.publicKey));sr(s>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[s]=w1(r,i.secretKey)}}addSignature(t,r){sr(r.byteLength===64,"Signature must be 64 bytes long");const i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(s=>s.equals(t));sr(i>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[i]=r}}const iA=1e3/(160/64);new et("SysvarC1ock11111111111111111111111111111111"),new et("SysvarEpochSchedu1e111111111111111111111111"),new et("Sysvar1nstructions1111111111111111111111111"),new et("SysvarRecentB1ockHashes11111111111111111111"),new et("SysvarRent111111111111111111111111111111111"),new et("SysvarRewards111111111111111111111111111111"),new et("SysvarS1otHashes111111111111111111111111111"),new et("SysvarS1otHistory11111111111111111111111111"),new et("SysvarStakeHistory1111111111111111111111111");function Ho(e){return new Promise(t=>setTimeout(t,e))}const sA=Gr("lamportsPerSignature"),A1=Fe([qe("version"),qe("state"),St("authorizedPubkey"),St("nonce"),Fe([sA],"feeCalculator")]);A1.span;class vh{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const r=A1.decode(Uo(t),0);return new vh({authorizedPubkey:new et(r.authorizedPubkey),nonce:new et(r.nonce).toString(),feeCalculator:r.feeCalculator})}}const oA=e=>{const t=e.decode.bind(e),r=e.encode.bind(e);return{decode:t,encode:r}},jo=(e=>t=>{const r=nr(e,t),{encode:n,decode:i}=oA(r),s=r;return s.decode=(o,a)=>{const c=i(o,a);return NS(ie.Buffer.from(c))},s.encode=(o,a,c)=>{const u=FS(o,e);return n(u,a,c)},s})(8);Object.freeze({Create:{index:0,layout:Fe([qe("instruction"),In("lamports"),In("space"),St("programId")])},Assign:{index:1,layout:Fe([qe("instruction"),St("programId")])},Transfer:{index:2,layout:Fe([qe("instruction"),jo("lamports")])},CreateWithSeed:{index:3,layout:Fe([qe("instruction"),St("base"),Do("seed"),In("lamports"),In("space"),St("programId")])},AdvanceNonceAccount:{index:4,layout:Fe([qe("instruction")])},WithdrawNonceAccount:{index:5,layout:Fe([qe("instruction"),In("lamports")])},InitializeNonceAccount:{index:6,layout:Fe([qe("instruction"),St("authorized")])},AuthorizeNonceAccount:{index:7,layout:Fe([qe("instruction"),St("authorized")])},Allocate:{index:8,layout:Fe([qe("instruction"),In("space")])},AllocateWithSeed:{index:9,layout:Fe([qe("instruction"),St("base"),Do("seed"),In("space"),St("programId")])},AssignWithSeed:{index:10,layout:Fe([qe("instruction"),St("base"),Do("seed"),St("programId")])},TransferWithSeed:{index:11,layout:Fe([qe("instruction"),jo("lamports"),Do("seed"),St("programId")])},UpgradeNonceAccount:{index:12,layout:Fe([qe("instruction")])}}),new et("11111111111111111111111111111111"),new et("BPFLoader2111111111111111111111111111111111");function aA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var cA=Object.prototype.toString,fA=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};function Za(e,t){var r,n,i,s,o,a,c;if(e===!0)return"true";if(e===!1)return"false";switch(typeof e){case"object":if(e===null)return null;if(e.toJSON&&typeof e.toJSON=="function")return Za(e.toJSON(),t);if(c=cA.call(e),c==="[object Array]"){for(i="[",n=e.length-1,r=0;r-1&&(i+=Za(e[r],!0)),i+"]"}else if(c==="[object Object]"){for(s=fA(e).sort(),n=s.length,i="",r=0;r1;)e/=2,t++;return t}function lA(e){return e===0?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e+1)}class hA{constructor(t,r,n,i,s){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=r,this.warmup=n,this.firstNormalEpoch=i,this.firstNormalSlot=s}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t{const o=C3(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...r});return"socket"in o?this.underlyingSocket=o.socket:this.underlyingSocket=o,o};super(i,t,r,n),this.underlyingSocket=void 0}call(...t){const r=this.underlyingSocket?.readyState;return r===1?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}notify(...t){const r=this.underlyingSocket?.readyState;return r===1?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}}function gA(e,t){let r;try{r=e.layout.decode(t)}catch(n){throw new Error("invalid instruction; "+n)}if(r.typeIndex!==e.index)throw new Error(`invalid account data; account type mismatch ${r.typeIndex} != ${e.index}`);return r}const R1=56;class T1{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const r=gA(yA,t),n=t.length-R1;sr(n>=0,"lookup table is invalid"),sr(n%32===0,"lookup table is invalid");const i=n/32,{addresses:s}=Fe([en(St(),i,"addresses")]).decode(t.slice(R1));return{deactivationSlot:r.deactivationSlot,lastExtendedSlot:r.lastExtendedSlot,lastExtendedSlotStartIndex:r.lastExtendedStartIndex,authority:r.authority.length!==0?new et(r.authority[0]):void 0,addresses:s.map(o=>new et(o))}}}const yA={index:1,layout:Fe([qe("typeIndex"),jo("deactivationSlot"),Gr("lastExtendedSlot"),Ut("lastExtendedStartIndex"),Ut(),en(St(),Gs(Ut(),-1),"authority")])},wA=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function mA(e){const t=e.match(wA);if(t==null)throw TypeError(`Failed to validate endpoint URL \`${e}\``);const[r,n,i,s]=t,o=e.startsWith("https:")?"wss:":"ws:",a=i==null?null:parseInt(i.slice(1),10),c=a==null?"":`:${a+1}`;return`${o}//${n}${c}${s}`}const kr=ja(ch(et),Se(),e=>new et(e)),k1=fh([Se(),dr("base64")]),Eh=ja(ch(ie.Buffer),k1,e=>ie.Buffer.from(e[0],"base64")),bA=30*1e3;function vA(e){if(/^https?:/.test(e)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}function or(e){let t,r;if(typeof e=="string")t=e;else if(e){const{commitment:n,...i}=e;t=n,r=i}return{commitment:t,config:r}}function C1(e){return mn([me({jsonrpc:dr("2.0"),id:Se(),result:e}),me({jsonrpc:dr("2.0"),id:Se(),error:me({code:Ha(),message:Se(),data:Qe(KS())})})])}const _A=C1(Ha());function bt(e){return ja(C1(e),_A,t=>"error"in t?t:{...t,result:Be(t.result,e)})}function mr(e){return bt(me({context:me({slot:te()}),value:e}))}function $f(e){return me({context:me({slot:te()}),value:e})}function xh(e,t){return e===0?new Wa({header:t.header,staticAccountKeys:t.accountKeys.map(r=>new et(r)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(r=>({programIdIndex:r.programIdIndex,accountKeyIndexes:r.accounts,data:Ar.decode(r.data)})),addressTableLookups:t.addressTableLookups}):new Pi(t)}const EA=me({foundation:te(),foundationTerm:te(),initial:te(),taper:te(),terminal:te()}),xA=bt(Ce(Te(me({epoch:te(),effectiveSlot:te(),amount:te(),postBalance:te(),commission:Qe(Te(te()))})))),SA=Ce(me({slot:te(),prioritizationFee:te()})),AA=me({total:te(),validator:te(),foundation:te(),epoch:te()}),BA=me({epoch:te(),slotIndex:te(),slotsInEpoch:te(),absoluteSlot:te(),blockHeight:Qe(te()),transactionCount:Qe(te())}),IA=me({slotsPerEpoch:te(),leaderScheduleSlotOffset:te(),warmup:bi(),firstNormalEpoch:te(),firstNormalSlot:te()}),RA=t1(Se(),Ce(te())),Js=Te(mn([me({}),Se()])),TA=me({err:Js}),kA=dr("receivedSignature"),CA=me({"solana-core":Se(),"feature-set":Qe(te())}),L1=mr(me({err:Te(mn([me({}),Se()])),logs:Te(Ce(Se())),accounts:Qe(Te(Ce(Te(me({executable:bi(),owner:Se(),lamports:te(),data:Ce(Se()),rentEpoch:Qe(te())}))))),unitsConsumed:Qe(te()),returnData:Qe(Te(me({programId:Se(),data:fh([Se(),dr("base64")])})))})),LA=mr(me({byIdentity:t1(Se(),Ce(te())),range:me({firstSlot:te(),lastSlot:te()})}));function $A(e,t,r,n,i,s){const o=r||dA;let a;s!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments.");let c;return n&&(c=async(l,y)=>{const A=await new Promise((v,R)=>{try{n(l,y,(O,P)=>v([O,P]))}catch(O){R(O)}});return await o(...A)}),new v3(async(l,y)=>{const A={method:"POST",body:l,agent:a,headers:Object.assign({"Content-Type":"application/json"},t||{},O6)};try{let v=5,R,O=500;for(;c?R=await c(e,A):R=await o(e,A),!(R.status!==429||i===!0||(v-=1,v===0));)console.error(`Server responded with ${R.status} ${R.statusText}. Retrying after ${O}ms delay...`),await Ho(O),O*=2;const P=await R.text();R.ok?y(null,P):y(new Error(`${R.status} ${R.statusText}: ${P}`))}catch(v){v instanceof Error&&y(v)}},{})}function OA(e){return(t,r)=>new Promise((n,i)=>{e.request(t,r,(s,o)=>{if(s){i(s);return}n(o)})})}function MA(e){return t=>new Promise((r,n)=>{t.length===0&&r([]);const i=t.map(s=>e.request(s.methodName,s.args));e.request(i,(s,o)=>{if(s){n(s);return}r(o)})})}const NA=bt(EA),PA=bt(AA),UA=bt(SA),FA=bt(BA),DA=bt(IA),HA=bt(RA),jA=bt(te()),zA=mr(me({total:te(),circulating:te(),nonCirculating:te(),nonCirculatingAccounts:Ce(kr)})),Sh=me({amount:Se(),uiAmount:Te(te()),decimals:te(),uiAmountString:Qe(Se())}),qA=mr(Ce(me({address:kr,amount:Se(),uiAmount:Te(te()),decimals:te(),uiAmountString:Qe(Se())}))),VA=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:Eh,rentEpoch:te()})}))),Ah=me({program:Se(),parsed:Ha(),space:te()}),WA=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:Ah,rentEpoch:te()})}))),KA=mr(Ce(me({lamports:te(),address:kr}))),Ya=me({executable:bi(),owner:kr,lamports:te(),data:Eh,rentEpoch:te()}),ZA=me({pubkey:kr,account:Ya}),GA=ja(mn([ch(ie.Buffer),Ah]),mn([k1,Ah]),e=>Array.isArray(e)?Be(e,Eh):e),Bh=me({executable:bi(),owner:kr,lamports:te(),data:GA,rentEpoch:te()}),YA=me({pubkey:kr,account:Bh}),XA=me({state:mn([dr("active"),dr("inactive"),dr("activating"),dr("deactivating")]),active:te(),inactive:te()}),JA=bt(Ce(me({signature:Se(),slot:te(),err:Js,memo:Te(Se()),blockTime:Qe(Te(te()))}))),QA=bt(Ce(me({signature:Se(),slot:te(),err:Js,memo:Te(Se()),blockTime:Qe(Te(te()))}))),e6=me({subscription:te(),result:$f(Ya)}),t6=me({pubkey:kr,account:Ya}),r6=me({subscription:te(),result:$f(t6)}),n6=me({parent:te(),slot:te(),root:te()}),i6=me({subscription:te(),result:n6}),s6=mn([me({type:mn([dr("firstShredReceived"),dr("completed"),dr("optimisticConfirmation"),dr("root")]),slot:te(),timestamp:te()}),me({type:dr("createdBank"),parent:te(),slot:te(),timestamp:te()}),me({type:dr("frozen"),slot:te(),timestamp:te(),stats:me({numTransactionEntries:te(),numSuccessfulTransactions:te(),numFailedTransactions:te(),maxTransactionsPerEntry:te()})}),me({type:dr("dead"),slot:te(),timestamp:te(),err:Se()})]),o6=me({subscription:te(),result:s6}),a6=me({subscription:te(),result:$f(mn([TA,kA]))}),c6=me({subscription:te(),result:te()}),f6=me({pubkey:Se(),gossip:Te(Se()),tpu:Te(Se()),rpc:Te(Se()),version:Te(Se())}),$1=me({votePubkey:Se(),nodePubkey:Se(),activatedStake:te(),epochVoteAccount:bi(),epochCredits:Ce(fh([te(),te(),te()])),commission:te(),lastVote:te(),rootSlot:Te(te())}),u6=bt(me({current:Ce($1),delinquent:Ce($1)})),l6=mn([dr("processed"),dr("confirmed"),dr("finalized")]),h6=me({slot:te(),confirmations:Te(te()),err:Js,confirmationStatus:Qe(l6)}),d6=mr(Ce(Te(h6))),p6=bt(te()),O1=me({accountKey:kr,writableIndexes:Ce(te()),readonlyIndexes:Ce(te())}),Ih=me({signatures:Ce(Se()),message:me({accountKeys:Ce(Se()),header:me({numRequiredSignatures:te(),numReadonlySignedAccounts:te(),numReadonlyUnsignedAccounts:te()}),instructions:Ce(me({accounts:Ce(te()),data:Se(),programIdIndex:te()})),recentBlockhash:Se(),addressTableLookups:Qe(Ce(O1))})}),M1=me({pubkey:kr,signer:bi(),writable:bi(),source:Qe(mn([dr("transaction"),dr("lookupTable")]))}),N1=me({accountKeys:Ce(M1),signatures:Ce(Se())}),P1=me({parsed:Ha(),program:Se(),programId:kr}),U1=me({accounts:Ce(kr),data:Se(),programId:kr}),g6=mn([U1,P1]),y6=mn([me({parsed:Ha(),program:Se(),programId:Se()}),me({accounts:Ce(Se()),data:Se(),programId:Se()})]),F1=ja(g6,y6,e=>"accounts"in e?Be(e,U1):Be(e,P1)),D1=me({signatures:Ce(Se()),message:me({accountKeys:Ce(M1),instructions:Ce(F1),recentBlockhash:Se(),addressTableLookups:Qe(Te(Ce(O1)))})}),Of=me({accountIndex:te(),mint:Se(),owner:Qe(Se()),uiTokenAmount:Sh}),H1=me({writable:Ce(kr),readonly:Ce(kr)}),Mf=me({err:Js,fee:te(),innerInstructions:Qe(Te(Ce(me({index:te(),instructions:Ce(me({accounts:Ce(te()),data:Se(),programIdIndex:te()}))})))),preBalances:Ce(te()),postBalances:Ce(te()),logMessages:Qe(Te(Ce(Se()))),preTokenBalances:Qe(Te(Ce(Of))),postTokenBalances:Qe(Te(Ce(Of))),loadedAddresses:Qe(H1),computeUnitsConsumed:Qe(te())}),Rh=me({err:Js,fee:te(),innerInstructions:Qe(Te(Ce(me({index:te(),instructions:Ce(F1)})))),preBalances:Ce(te()),postBalances:Ce(te()),logMessages:Qe(Te(Ce(Se()))),preTokenBalances:Qe(Te(Ce(Of))),postTokenBalances:Qe(Te(Ce(Of))),loadedAddresses:Qe(H1),computeUnitsConsumed:Qe(te())}),zo=mn([dr(0),dr("legacy")]),Qs=me({pubkey:Se(),lamports:te(),postBalance:Te(te()),rewardType:Te(Se()),commission:Qe(Te(te()))}),w6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Ih,meta:Te(Mf),version:Qe(zo)})),rewards:Qe(Ce(Qs)),blockTime:Te(te()),blockHeight:Te(te())}))),m6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Qs)),blockTime:Te(te()),blockHeight:Te(te())}))),b6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:N1,meta:Te(Mf),version:Qe(zo)})),rewards:Qe(Ce(Qs)),blockTime:Te(te()),blockHeight:Te(te())}))),v6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:D1,meta:Te(Rh),version:Qe(zo)})),rewards:Qe(Ce(Qs)),blockTime:Te(te()),blockHeight:Te(te())}))),_6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:N1,meta:Te(Rh),version:Qe(zo)})),rewards:Qe(Ce(Qs)),blockTime:Te(te()),blockHeight:Te(te())}))),E6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Qs)),blockTime:Te(te()),blockHeight:Te(te())}))),x6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Ih,meta:Te(Mf)})),rewards:Qe(Ce(Qs)),blockTime:Te(te())}))),j1=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),signatures:Ce(Se()),blockTime:Te(te())}))),Th=bt(Te(me({slot:te(),meta:Te(Mf),blockTime:Qe(Te(te())),transaction:Ih,version:Qe(zo)}))),Nf=bt(Te(me({slot:te(),transaction:D1,meta:Te(Rh),blockTime:Qe(Te(te())),version:Qe(zo)}))),S6=mr(me({blockhash:Se(),feeCalculator:me({lamportsPerSignature:te()})})),A6=mr(me({blockhash:Se(),lastValidBlockHeight:te()})),B6=mr(bi()),I6=me({slot:te(),numTransactions:te(),numSlots:te(),samplePeriodSecs:te()}),R6=bt(Ce(I6)),T6=mr(Te(me({feeCalculator:me({lamportsPerSignature:te()})}))),k6=bt(Se()),C6=bt(Se()),L6=me({err:Js,logs:Ce(Se()),signature:Se()}),$6=me({result:$f(L6),subscription:te()}),O6={"solana-client":"js/0.0.0-development"};class M6{constructor(t,r){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const u={};return async l=>{const{commitment:y,config:A}=or(l),v=this._buildArgs([],y,void 0,A),R=B1(v);return u[R]=u[R]??(async()=>{try{const O=await this._rpcRequest("getBlockHeight",v),P=Be(O,bt(te()));if("error"in P)throw new je(P.error,"failed to get block height information");return P.result}finally{delete u[R]}})(),await u[R]}})();let n,i,s,o,a,c;r&&typeof r=="string"?this._commitment=r:r&&(this._commitment=r.commitment,this._confirmTransactionInitialTimeout=r.confirmTransactionInitialTimeout,n=r.wsEndpoint,i=r.httpHeaders,s=r.fetch,o=r.fetchMiddleware,a=r.disableRetryOnRateLimit,c=r.httpAgent),this._rpcEndpoint=vA(t),this._rpcWsEndpoint=n||mA(t),this._rpcClient=$A(t,i,s,o,a,c),this._rpcRequest=OA(this._rpcClient),this._rpcBatchRequest=MA(this._rpcClient),this._rpcWebSocket=new pA(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,void 0,i),o=await this._rpcRequest("getBalance",s),a=Be(o,mr(te()));if("error"in a)throw new je(a.error,`failed to get balance for ${t.toBase58()}`);return a.result}async getBalance(t,r){return await this.getBalanceAndContext(t,r).then(n=>n.value).catch(n=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+n)})}async getBlockTime(t){const r=await this._rpcRequest("getBlockTime",[t]),n=Be(r,bt(Te(te())));if("error"in n)throw new je(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),r=Be(t,bt(te()));if("error"in r)throw new je(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),r=Be(t,jA);if("error"in r)throw new je(r.error,"failed to get first available block");return r.result}async getSupply(t){let r={};typeof t=="string"?r={commitment:t}:t?r={...t,commitment:t&&t.commitment||this.commitment}:r={commitment:this.commitment};const n=await this._rpcRequest("getSupply",[r]),i=Be(n,zA);if("error"in i)throw new je(i.error,"failed to get supply");return i.result}async getTokenSupply(t,r){const n=this._buildArgs([t.toBase58()],r),i=await this._rpcRequest("getTokenSupply",n),s=Be(i,mr(Sh));if("error"in s)throw new je(s.error,"failed to get token supply");return s.result}async getTokenAccountBalance(t,r){const n=this._buildArgs([t.toBase58()],r),i=await this._rpcRequest("getTokenAccountBalance",n),s=Be(i,mr(Sh));if("error"in s)throw new je(s.error,"failed to get token account balance");return s.result}async getTokenAccountsByOwner(t,r,n){const{commitment:i,config:s}=or(n);let o=[t.toBase58()];"mint"in r?o.push({mint:r.mint.toBase58()}):o.push({programId:r.programId.toBase58()});const a=this._buildArgs(o,i,"base64",s),c=await this._rpcRequest("getTokenAccountsByOwner",a),u=Be(c,VA);if("error"in u)throw new je(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,r,n){let i=[t.toBase58()];"mint"in r?i.push({mint:r.mint.toBase58()}):i.push({programId:r.programId.toBase58()});const s=this._buildArgs(i,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",s),a=Be(o,WA);if("error"in a)throw new je(a.error,`failed to get token accounts owned by account ${t.toBase58()}`);return a.result}async getLargestAccounts(t){const r={...t,commitment:t&&t.commitment||this.commitment},n=r.filter||r.commitment?[r]:[],i=await this._rpcRequest("getLargestAccounts",n),s=Be(i,KA);if("error"in s)throw new je(s.error,"failed to get largest accounts");return s.result}async getTokenLargestAccounts(t,r){const n=this._buildArgs([t.toBase58()],r),i=await this._rpcRequest("getTokenLargestAccounts",n),s=Be(i,qA);if("error"in s)throw new je(s.error,"failed to get token largest accounts");return s.result}async getAccountInfoAndContext(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,"base64",i),o=await this._rpcRequest("getAccountInfo",s),a=Be(o,mr(Te(Ya)));if("error"in a)throw new je(a.error,`failed to get info about account ${t.toBase58()}`);return a.result}async getParsedAccountInfo(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getAccountInfo",s),a=Be(o,mr(Te(Bh)));if("error"in a)throw new je(a.error,`failed to get info about account ${t.toBase58()}`);return a.result}async getAccountInfo(t,r){try{return(await this.getAccountInfoAndContext(t,r)).value}catch(n){throw new Error("failed to get info about account "+t.toBase58()+": "+n)}}async getMultipleParsedAccounts(t,r){const{commitment:n,config:i}=or(r),s=t.map(u=>u.toBase58()),o=this._buildArgs([s],n,"jsonParsed",i),a=await this._rpcRequest("getMultipleAccounts",o),c=Be(a,mr(Ce(Te(Bh))));if("error"in c)throw new je(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfoAndContext(t,r){const{commitment:n,config:i}=or(r),s=t.map(u=>u.toBase58()),o=this._buildArgs([s],n,"base64",i),a=await this._rpcRequest("getMultipleAccounts",o),c=Be(a,mr(Ce(Te(Ya))));if("error"in c)throw new je(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfo(t,r){return(await this.getMultipleAccountsInfoAndContext(t,r)).value}async getStakeActivation(t,r,n){const{commitment:i,config:s}=or(r),o=this._buildArgs([t.toBase58()],i,void 0,{...s,epoch:n??s?.epoch}),a=await this._rpcRequest("getStakeActivation",o),c=Be(a,bt(XA));if("error"in c)throw new je(c.error,`failed to get Stake Activation ${t.toBase58()}`);return c.result}async getProgramAccounts(t,r){const{commitment:n,config:i}=or(r),{encoding:s,...o}=i||{},a=this._buildArgs([t.toBase58()],n,s||"base64",o),c=await this._rpcRequest("getProgramAccounts",a),u=Ce(ZA),l=o.withContext===!0?Be(c,mr(u)):Be(c,bt(u));if("error"in l)throw new je(l.error,`failed to get accounts owned by program ${t.toBase58()}`);return l.result}async getParsedProgramAccounts(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getProgramAccounts",s),a=Be(o,bt(Ce(YA)));if("error"in a)throw new je(a.error,`failed to get accounts owned by program ${t.toBase58()}`);return a.result}async confirmTransaction(t,r){let n;if(typeof t=="string")n=t;else{const s=t;if(s.abortSignal?.aborted)return Promise.reject(s.abortSignal.reason);n=s.signature}let i;try{i=Ar.decode(n)}catch{throw new Error("signature must be base58 encoded: "+n)}return sr(i.length===64,"signature has invalid length"),typeof t=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:r||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:r||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise((r,n)=>{t!=null&&(t.aborted?n(t.reason):t.addEventListener("abort",()=>{n(t.reason)}))})}getTransactionConfirmationPromise({commitment:t,signature:r}){let n,i,s=!1;const o=new Promise((c,u)=>{try{n=this.onSignature(r,(y,A)=>{n=void 0;const v={context:A,value:y};c({__type:fs.PROCESSED,response:v})},t);const l=new Promise(y=>{n==null?y():i=this._onSubscriptionStateChange(n,A=>{A==="subscribed"&&y()})});(async()=>{if(await l,s)return;const y=await this.getSignatureStatus(r);if(s||y==null)return;const{context:A,value:v}=y;if(v!=null)if(v?.err)u(v.err);else{switch(t){case"confirmed":case"single":case"singleGossip":{if(v.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(v.confirmationStatus==="processed"||v.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}s=!0,c({__type:fs.PROCESSED,response:{context:A,value:v}})}})()}catch(l){u(l)}});return{abortConfirmation:()=>{i&&(i(),i=void 0),n!=null&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:o}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:r,lastValidBlockHeight:n,signature:i}}){let s=!1;const o=new Promise(y=>{const A=async()=>{try{return await this.getBlockHeight(t)}catch{return-1}};(async()=>{let v=await A();if(!s){for(;v<=n;)if(await Ho(1e3),s||(v=await A(),s))return;y({__type:fs.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),u=this.getCancellationPromise(r);let l;try{const y=await Promise.race([u,c,o]);if(y.__type===fs.PROCESSED)l=y.response;else throw new v1(i)}finally{s=!0,a()}return l}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:r,minContextSlot:n,nonceAccountPubkey:i,nonceValue:s,signature:o}}){let a=!1;const c=new Promise(v=>{let R=s,O=null;const P=async()=>{try{const{context:H,value:F}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:n});return O=H.slot,F?.nonce}catch{return R}};(async()=>{if(R=await P(),!a)for(;;){if(s!==R){v({__type:fs.NONCE_INVALID,slotInWhichNonceDidAdvance:O});return}if(await Ho(2e3),a||(R=await P(),a))return}})()}),{abortConfirmation:u,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),y=this.getCancellationPromise(r);let A;try{const v=await Promise.race([y,l,c]);if(v.__type===fs.PROCESSED)A=v.response;else{let R;for(;;){const O=await this.getSignatureStatus(o);if(O==null)break;if(O.context.slot<(v.slotInWhichNonceDidAdvance??n)){await Ho(400);continue}R=O;break}if(R?.value){const O=t||"finalized",{confirmationStatus:P}=R.value;switch(O){case"processed":case"recent":if(P!=="processed"&&P!=="confirmed"&&P!=="finalized")throw new Va(o);break;case"confirmed":case"single":case"singleGossip":if(P!=="confirmed"&&P!=="finalized")throw new Va(o);break;case"finalized":case"max":case"root":if(P!=="finalized")throw new Va(o);break;default:(H=>{})(O)}A={context:R.context,value:{err:R.value.err}}}else throw new Va(o)}}finally{a=!0,u()}return A}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:r}){let n;const i=new Promise(c=>{let u=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{u=this._confirmTransactionInitialTimeout||3e4;break}}n=setTimeout(()=>c({__type:fs.TIMED_OUT,timeoutMs:u}),u)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:r});let a;try{const c=await Promise.race([o,i]);if(c.__type===fs.PROCESSED)a=c.response;else throw new _1(r,c.timeoutMs/1e3)}finally{clearTimeout(n),s()}return a}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),r=Be(t,bt(Ce(f6)));if("error"in r)throw new je(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(t){const r=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",r),i=Be(n,u6);if("error"in i)throw new je(i.error,"failed to get vote accounts");return i.result}async getSlot(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlot",i),o=Be(s,bt(te()));if("error"in o)throw new je(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlotLeader",i),o=Be(s,bt(Se()));if("error"in o)throw new je(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,r){const n=[t,r],i=await this._rpcRequest("getSlotLeaders",n),s=Be(i,bt(Ce(kr)));if("error"in s)throw new je(s.error,"failed to get slot leaders");return s.result}async getSignatureStatus(t,r){const{context:n,value:i}=await this.getSignatureStatuses([t],r);sr(i.length===1);const s=i[0];return{context:n,value:s}}async getSignatureStatuses(t,r){const n=[t];r&&n.push(r);const i=await this._rpcRequest("getSignatureStatuses",n),s=Be(i,d6);if("error"in s)throw new je(s.error,"failed to get signature status");return s.result}async getTransactionCount(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getTransactionCount",i),o=Be(s,bt(te()));if("error"in o)throw new je(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const r=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",r),i=Be(n,NA);if("error"in i)throw new je(i.error,"failed to get inflation");return i.result}async getInflationReward(t,r,n){const{commitment:i,config:s}=or(n),o=this._buildArgs([t.map(u=>u.toBase58())],i,void 0,{...s,epoch:r??s?.epoch}),a=await this._rpcRequest("getInflationReward",o),c=Be(a,xA);if("error"in c)throw new je(c.error,"failed to get inflation reward");return c.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),r=Be(t,PA);if("error"in r)throw new je(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getEpochInfo",i),o=Be(s,FA);if("error"in o)throw new je(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),r=Be(t,DA);if("error"in r)throw new je(r.error,"failed to get epoch schedule");const n=r.result;return new hA(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),r=Be(t,HA);if("error"in r)throw new je(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(t,r){const n=this._buildArgs([t],r),i=await this._rpcRequest("getMinimumBalanceForRentExemption",n),s=Be(i,p6);return"error"in s?(console.warn("Unable to fetch minimum balance for rent exemption"),0):s.result}async getRecentBlockhashAndContext(t){const r=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",r),i=Be(n,S6);if("error"in i)throw new je(i.error,"failed to get recent blockhash");return i.result}async getRecentPerformanceSamples(t){const r=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=Be(r,R6);if("error"in n)throw new je(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,r){const n=this._buildArgs([t],r),i=await this._rpcRequest("getFeeCalculatorForBlockhash",n),s=Be(i,T6);if("error"in s)throw new je(s.error,"failed to get fee calculator");const{context:o,value:a}=s.result;return{context:o,value:a!==null?a.feeCalculator:null}}async getFeeForMessage(t,r){const n=Uo(t.serialize()).toString("base64"),i=this._buildArgs([n],r),s=await this._rpcRequest("getFeeForMessage",i),o=Be(s,mr(Te(te())));if("error"in o)throw new je(o.error,"failed to get fee for message");if(o.result===null)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const r=t?.lockedWritableAccounts?.map(o=>o.toBase58()),n=r?.length?[r]:[],i=await this._rpcRequest("getRecentPrioritizationFees",n),s=Be(i,UA);if("error"in s)throw new je(s.error,"failed to get recent prioritization fees");return s.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhashAndContext(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getLatestBlockhash",i),o=Be(s,A6);if("error"in o)throw new je(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t],n,void 0,i),o=await this._rpcRequest("isBlockhashValid",s),a=Be(o,B6);if("error"in a)throw new je(a.error,"failed to determine if the blockhash `"+t+"`is valid");return a.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),r=Be(t,bt(CA));if("error"in r)throw new je(r.error,"failed to get version");return r.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),r=Be(t,bt(Se()));if("error"in r)throw new je(r.error,"failed to get genesis hash");return r.result}async getBlock(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,void 0,i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{const a=Be(o,b6);if("error"in a)throw a.error;return a.result}case"none":{const a=Be(o,m6);if("error"in a)throw a.error;return a.result}default:{const a=Be(o,w6);if("error"in a)throw a.error;const{result:c}=a;return c?{...c,transactions:c.transactions.map(({transaction:u,meta:l,version:y})=>({meta:l,transaction:{...u,message:xh(y,u.message)},version:y}))}:null}}}catch(a){throw new je(a,"failed to get confirmed block")}}async getParsedBlock(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{const a=Be(o,_6);if("error"in a)throw a.error;return a.result}case"none":{const a=Be(o,E6);if("error"in a)throw a.error;return a.result}default:{const a=Be(o,v6);if("error"in a)throw a.error;return a.result}}}catch(a){throw new je(a,"failed to get block")}}async getBlockProduction(t){let r,n;if(typeof t=="string")n=t;else if(t){const{commitment:a,...c}=t;n=a,r=c}const i=this._buildArgs([],n,"base64",r),s=await this._rpcRequest("getBlockProduction",i),o=Be(s,LA);if("error"in o)throw new je(o.error,"failed to get block production information");return o.result}async getTransaction(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,void 0,i),o=await this._rpcRequest("getTransaction",s),a=Be(o,Th);if("error"in a)throw new je(a.error,"failed to get transaction");const c=a.result;return c&&{...c,transaction:{...c.transaction,message:xh(c.version,c.transaction.message)}}}async getParsedTransaction(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",i),o=await this._rpcRequest("getTransaction",s),a=Be(o,Nf);if("error"in a)throw new je(a.error,"failed to get transaction");return a.result}async getParsedTransactions(t,r){const{commitment:n,config:i}=or(r),s=t.map(c=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([c],n,"jsonParsed",i)}));return(await this._rpcBatchRequest(s)).map(c=>{const u=Be(c,Nf);if("error"in u)throw new je(u.error,"failed to get transactions");return u.result})}async getTransactions(t,r){const{commitment:n,config:i}=or(r),s=t.map(c=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([c],n,void 0,i)}));return(await this._rpcBatchRequest(s)).map(c=>{const u=Be(c,Th);if("error"in u)throw new je(u.error,"failed to get transactions");const l=u.result;return l&&{...l,transaction:{...l.transaction,message:xh(l.version,l.transaction.message)}}})}async getConfirmedBlock(t,r){const n=this._buildArgsAtLeastConfirmed([t],r),i=await this._rpcRequest("getConfirmedBlock",n),s=Be(i,x6);if("error"in s)throw new je(s.error,"failed to get confirmed block");const o=s.result;if(!o)throw new Error("Confirmed block "+t+" not found");const a={...o,transactions:o.transactions.map(({transaction:c,meta:u})=>{const l=new Pi(c.message);return{meta:u,transaction:{...c,message:l}}})};return{...a,transactions:a.transactions.map(({transaction:c,meta:u})=>({meta:u,transaction:us.populate(c.message,c.signatures)}))}}async getBlocks(t,r,n){const i=this._buildArgsAtLeastConfirmed(r!==void 0?[t,r]:[t],n),s=await this._rpcRequest("getBlocks",i),o=Be(s,bt(Ce(te())));if("error"in o)throw new je(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,r){const n=this._buildArgsAtLeastConfirmed([t],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getBlock",n),s=Be(i,j1);if("error"in s)throw new je(s.error,"failed to get block");const o=s.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,r){const n=this._buildArgsAtLeastConfirmed([t],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getConfirmedBlock",n),s=Be(i,j1);if("error"in s)throw new je(s.error,"failed to get confirmed block");const o=s.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,r){const n=this._buildArgsAtLeastConfirmed([t],r),i=await this._rpcRequest("getConfirmedTransaction",n),s=Be(i,Th);if("error"in s)throw new je(s.error,"failed to get transaction");const o=s.result;if(!o)return o;const a=new Pi(o.transaction.message),c=o.transaction.signatures;return{...o,transaction:us.populate(a,c)}}async getParsedConfirmedTransaction(t,r){const n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed"),i=await this._rpcRequest("getConfirmedTransaction",n),s=Be(i,Nf);if("error"in s)throw new je(s.error,"failed to get confirmed transaction");return s.result}async getParsedConfirmedTransactions(t,r){const n=t.map(o=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([o],r,"jsonParsed")}));return(await this._rpcBatchRequest(n)).map(o=>{const a=Be(o,Nf);if("error"in a)throw new je(a.error,"failed to get confirmed transactions");return a.result})}async getConfirmedSignaturesForAddress(t,r,n){let i={},s=await this.getFirstAvailableBlock();for(;!("until"in i)&&(r--,!(r<=0||r0&&(i.until=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}let o=await this.getSlot("finalized");for(;!("before"in i)&&(n++,!(n>o));)try{const c=await this.getConfirmedBlockSignatures(n);c.signatures.length>0&&(i.before=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}return(await this.getConfirmedSignaturesForAddress2(t,i)).map(c=>c.signature)}async getConfirmedSignaturesForAddress2(t,r,n){const i=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,r),s=await this._rpcRequest("getConfirmedSignaturesForAddress2",i),o=Be(s,JA);if("error"in o)throw new je(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,r,n){const i=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,r),s=await this._rpcRequest("getSignaturesForAddress",i),o=Be(s,QA);if("error"in o)throw new je(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,r){const{context:n,value:i}=await this.getAccountInfoAndContext(t,r);let s=null;return i!==null&&(s=new T1({key:t,state:T1.deserialize(i.data)})),{context:n,value:s}}async getNonceAndContext(t,r){const{context:n,value:i}=await this.getAccountInfoAndContext(t,r);let s=null;return i!==null&&(s=vh.fromAccountData(i.data)),{context:n,value:s}}async getNonce(t,r){return await this.getNonceAndContext(t,r).then(n=>n.value).catch(n=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+n)})}async requestAirdrop(t,r){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),r]),i=Be(n,k6);if("error"in i)throw new je(i.error,`airdrop to ${t.toBase58()} failed`);return i.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Ho(100);const n=Date.now()-this._blockhashInfo.lastFetch>=bA;if(this._blockhashInfo.latestBlockhash!==null&&!n)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),r=this._blockhashInfo.latestBlockhash,n=r?r.blockhash:null;for(let i=0;i<50;i++){const s=await this.getLatestBlockhash("finalized");if(n!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await Ho(iA/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,"base64",n),s=await this._rpcRequest("getStakeMinimumDelegation",i),o=Be(s,mr(te()));if("error"in o)throw new je(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,r,n){if("message"in t){const O=t.serialize(),P=ie.Buffer.from(O).toString("base64");if(Array.isArray(r)||n!==void 0)throw new Error("Invalid arguments");const H=r||{};H.encoding="base64","commitment"in H||(H.commitment=this.commitment);const F=[P,H],N=await this._rpcRequest("simulateTransaction",F),$=Be(N,L1);if("error"in $)throw new Error("failed to simulate transaction: "+$.error.message);return $.result}let i;if(t instanceof us){let R=t;i=new us,i.feePayer=R.feePayer,i.instructions=t.instructions,i.nonceInfo=R.nonceInfo,i.signatures=R.signatures}else i=us.populate(t),i._message=i._json=void 0;if(r!==void 0&&!Array.isArray(r))throw new Error("Invalid arguments");const s=r;if(i.nonceInfo&&s)i.sign(...s);else{let R=this._disableBlockhashCaching;for(;;){const O=await this._blockhashWithExpiryBlockHeight(R);if(i.lastValidBlockHeight=O.lastValidBlockHeight,i.recentBlockhash=O.blockhash,!s)break;if(i.sign(...s),!i.signature)throw new Error("!signature");const P=i.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(P)&&!this._blockhashInfo.transactionSignatures.includes(P)){this._blockhashInfo.simulatedSignatures.push(P);break}else R=!0}}const o=i._compile(),a=o.serialize(),u=i._serialize(a).toString("base64"),l={encoding:"base64",commitment:this.commitment};if(n){const R=(Array.isArray(n)?n:o.nonProgramIds()).map(O=>O.toBase58());l.accounts={encoding:"base64",addresses:R}}s&&(l.sigVerify=!0);const y=[u,l],A=await this._rpcRequest("simulateTransaction",y),v=Be(A,L1);if("error"in v){let R;if("data"in v.error&&(R=v.error.data.logs,R&&Array.isArray(R))){const O=` - `,P=O+R.join(O);console.error(v.error.message,P)}throw new I1("failed to simulate transaction: "+v.error.message,R)}return v.result}async sendTransaction(t,r,n){if("version"in t){if(r&&Array.isArray(r))throw new Error("Invalid arguments");const o=t.serialize();return await this.sendRawTransaction(o,r)}if(r===void 0||!Array.isArray(r))throw new Error("Invalid arguments");const i=r;if(t.nonceInfo)t.sign(...i);else{let o=this._disableBlockhashCaching;for(;;){const a=await this._blockhashWithExpiryBlockHeight(o);if(t.lastValidBlockHeight=a.lastValidBlockHeight,t.recentBlockhash=a.blockhash,t.sign(...i),!t.signature)throw new Error("!signature");const c=t.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(c))o=!0;else{this._blockhashInfo.transactionSignatures.push(c);break}}}const s=t.serialize();return await this.sendRawTransaction(s,n)}async sendRawTransaction(t,r){const n=Uo(t).toString("base64");return await this.sendEncodedTransaction(n,r)}async sendEncodedTransaction(t,r){const n={encoding:"base64"},i=r&&r.skipPreflight,s=i===!0?"processed":r&&r.preflightCommitment||this.commitment;r&&r.maxRetries!=null&&(n.maxRetries=r.maxRetries),r&&r.minContextSlot!=null&&(n.minContextSlot=r.minContextSlot),i&&(n.skipPreflight=i),s&&(n.preflightCommitment=s);const o=[t,n],a=await this._rpcRequest("sendTransaction",o),c=Be(a,C6);if("error"in c){let u;throw"data"in c.error&&(u=c.error.data.logs),new I1("failed to send transaction: "+c.error.message,u)}return c.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){if(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),t===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([r,n])=>{this._setSubscription(r,{...n,state:"pending"})})}_setSubscription(t,r){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=r,n!==r.state){const i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach(s=>{try{s(r.state)}catch{}})}}_onSubscriptionStateChange(t,r){const n=this._subscriptionHashByClientSubscriptionId[t];if(n==null)return()=>{};const i=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return i.add(r),()=>{i.delete(r),i.size===0&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(n){n instanceof Error&&console.log(`Error when closing socket connection: ${n.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}const t=this._rpcWebSocketGeneration,r=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async n=>{const i=this._subscriptionsByHash[n];if(i!==void 0)switch(i.state){case"pending":case"unsubscribed":if(i.callbacks.size===0){delete this._subscriptionsByHash[n],i.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{const{args:s,method:o}=i;try{this._setSubscription(n,{...i,state:"subscribing"});const a=await this._rpcWebSocket.call(o,s);this._setSubscription(n,{...i,serverSubscriptionId:a,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[a]=i.callbacks,await this._updateSubscriptions()}catch(a){if(a instanceof Error&&console.error(`${o} error for argument`,s,a.message),!r())return;this._setSubscription(n,{...i,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":i.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:s,unsubscribeMethod:o}=i;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(n,{...i,state:"unsubscribing"}),this._setSubscription(n,{...i,state:"unsubscribing"});try{await this._rpcWebSocket.call(o,[s])}catch(a){if(a instanceof Error&&console.error(`${o} error:`,a.message),!r())return;this._setSubscription(n,{...i,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(n,{...i,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(t,r){const n=this._subscriptionCallbacksByServerSubscriptionId[t];n!==void 0&&n.forEach(i=>{try{i(...r)}catch(s){console.error(s)}})}_wsOnAccountNotification(t){const{result:r,subscription:n}=Be(t,e6);this._handleServerNotification(n,[r.value,r.context])}_makeSubscription(t,r){const n=this._nextClientSubscriptionId++,i=B1([t.method,r]),s=this._subscriptionsByHash[i];return s===void 0?this._subscriptionsByHash[i]={...t,args:r,callbacks:new Set([t.callback]),state:"pending"}:s.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const o=this._subscriptionsByHash[i];sr(o!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),o.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,r,n){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:r,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},i)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:r,subscription:n}=Be(t,r6);this._handleServerNotification(n,[{accountId:r.value.pubkey,accountInfo:r.value.account},r.context])}onProgramAccountChange(t,r,n,i){const s=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",i?{filters:i}:void 0);return this._makeSubscription({callback:r,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,r,n){const i=this._buildArgs([typeof t=="object"?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:r,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:r,subscription:n}=Be(t,$6);this._handleServerNotification(n,[r.value,r.context])}_wsOnSlotNotification(t){const{result:r,subscription:n}=Be(t,i6);this._handleServerNotification(n,[r])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:r,subscription:n}=Be(t,o6);this._handleServerNotification(n,[r])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,r){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${r}' events could not be found.`)}_buildArgs(t,r,n,i){const s=r||this._commitment;if(s||n||i){let o={};n&&(o.encoding=n),s&&(o.commitment=s),i&&(o=Object.assign(o,i)),t.push(o)}return t}_buildArgsAtLeastConfirmed(t,r,n,i){const s=r||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,r,n,i)}_wsOnSignatureNotification(t){const{result:r,subscription:n}=Be(t,a6);r.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,r.value==="receivedSignature"?[{type:"received"},r.context]:[{type:"status",result:r.value},r.context])}onSignature(t,r,n){const i=this._buildArgs([t],n||this._commitment||"finalized"),s=this._makeSubscription({callback:(o,a)=>{if(o.type==="status"){r(o.result,a);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return s}onSignatureWithOptions(t,r,n){const{commitment:i,...s}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],i,void 0,s),a=this._makeSubscription({callback:(c,u)=>{r(c,u);try{this.removeSignatureListener(a)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return a}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:r,subscription:n}=Be(t,c6);this._handleServerNotification(n,[r])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}Object.freeze({CreateLookupTable:{index:0,layout:Fe([qe("instruction"),jo("recentSlot"),Ut("bumpSeed")])},FreezeLookupTable:{index:1,layout:Fe([qe("instruction")])},ExtendLookupTable:{index:2,layout:Fe([qe("instruction"),jo(),en(St(),Gs(qe(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Fe([qe("instruction")])},CloseLookupTable:{index:4,layout:Fe([qe("instruction")])}}),new et("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:Fe([Ut("instruction"),qe("units"),qe("additionalFee")])},RequestHeapFrame:{index:1,layout:Fe([Ut("instruction"),qe("bytes")])},SetComputeUnitLimit:{index:2,layout:Fe([Ut("instruction"),qe("units")])},SetComputeUnitPrice:{index:3,layout:Fe([Ut("instruction"),jo("microLamports")])}}),new et("ComputeBudget111111111111111111111111111111"),Fe([Ut("numSignatures"),Ut("padding"),jn("signatureOffset"),jn("signatureInstructionIndex"),jn("publicKeyOffset"),jn("publicKeyInstructionIndex"),jn("messageDataOffset"),jn("messageDataSize"),jn("messageInstructionIndex")]),new et("Ed25519SigVerify111111111111111111111111111"),mh.utils.isValidPrivateKey,mh.getPublicKey,Fe([Ut("numSignatures"),jn("signatureOffset"),Ut("signatureInstructionIndex"),jn("ethAddressOffset"),Ut("ethAddressInstructionIndex"),jn("messageDataOffset"),jn("messageDataSize"),Ut("messageInstructionIndex"),nr(20,"ethAddress"),nr(64,"signature"),Ut("recoveryId")]),new et("KeccakSecp256k11111111111111111111111111111");var z1;new et("StakeConfig11111111111111111111111111111111");class q1{constructor(t,r,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=r,this.custodian=n}}z1=q1,q1.default=new z1(0,0,et.default),Object.freeze({Initialize:{index:0,layout:Fe([qe("instruction"),Q3(),eA()])},Authorize:{index:1,layout:Fe([qe("instruction"),St("newAuthorized"),qe("stakeAuthorizationType")])},Delegate:{index:2,layout:Fe([qe("instruction")])},Split:{index:3,layout:Fe([qe("instruction"),In("lamports")])},Withdraw:{index:4,layout:Fe([qe("instruction"),In("lamports")])},Deactivate:{index:5,layout:Fe([qe("instruction")])},Merge:{index:7,layout:Fe([qe("instruction")])},AuthorizeWithSeed:{index:8,layout:Fe([qe("instruction"),St("newAuthorized"),qe("stakeAuthorizationType"),Do("authoritySeed"),St("authorityOwner")])}}),Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),new et("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:Fe([qe("instruction"),tA()])},Authorize:{index:1,layout:Fe([qe("instruction"),St("newAuthorized"),qe("voteAuthorizationType")])},Withdraw:{index:3,layout:Fe([qe("instruction"),In("lamports")])},UpdateValidatorIdentity:{index:4,layout:Fe([qe("instruction")])},AuthorizeWithSeed:{index:10,layout:Fe([qe("instruction"),rA()])}}),Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),new et("Vote111111111111111111111111111111111111111"),new et("Va1idator1nfo111111111111111111111111111111"),me({name:Se(),website:Qe(Se()),details:Qe(Se()),keybaseUsername:Qe(Se())}),new et("Vote111111111111111111111111111111111111111"),Fe([St("nodePubkey"),St("authorizedWithdrawer"),Ut("commission"),Gr(),en(Fe([Gr("slot"),qe("confirmationCount")]),Gs(qe(),-8),"votes"),Ut("rootSlotValid"),Gr("rootSlot"),Gr(),en(Fe([Gr("epoch"),St("authorizedVoter")]),Gs(qe(),-8),"authorizedVoters"),Fe([en(Fe([St("authorizedPubkey"),Gr("epochOfLastAuthorizedSwitch"),Gr("targetEpoch")]),32,"buf"),Gr("idx"),Ut("isEmpty")],"priorVoters"),Gr(),en(Fe([Gr("epoch"),Gr("credits"),Gr("prevCredits")]),Gs(qe(),-8),"epochCredits"),Fe([Gr("slot"),Gr("timestamp")],"lastTimestamp")]);const V1="solana:signAndSendTransaction",N6="solana:signIn",W1="solana:signMessage",K1="solana:signTransaction",P6="standard:connect",U6="standard:disconnect",F6="standard:events";var Z1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},D6=(e,t,r)=>(Z1(e,t,"read from private field"),r?r.call(e):t.get(e)),H6=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},j6=(e,t,r,n)=>(Z1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Pf;function z6(e){const t=({register:r})=>r(e);try{window.dispatchEvent(new q6(t))}catch(r){console.error(`wallet-standard:register-wallet event could not be dispatched +Missing signature for public key${s.missing.length===1?"":"(s)"} [\`${s.missing.map(a=>a.toBase58()).join("`, `")}\`].`),new Error(o)}}return this._serialize(i)}_serialize(t){const{signatures:r}=this,n=[];Tn(n,r.length);const i=n.length+r.length*64+t.length,s=ie.Buffer.alloc(i);return sr(r.length<256),ie.Buffer.from(n).copy(s,0),r.forEach(({signature:o},a)=>{o!==null&&(sr(o.length===64,"signature has invalid length"),ie.Buffer.from(o).copy(s,n.length+a*64))}),t.copy(s,n.length+r.length*64),sr(s.length<=No,`Transaction too large: ${s.length} > ${No}`),s}get keys(){return sr(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return sr(this.instructions.length===1),this.instructions[0].programId}get data(){return sr(this.instructions.length===1),this.instructions[0].data}static from(t){let r=[...t];const n=Rn(r);let i=[];for(let s=0;s0&&(n.feePayer=t.accountKeys[0]),r.forEach((i,s)=>{const o={signature:i==Ar.encode(V3)?null:Ar.decode(i),publicKey:t.accountKeys[s]};n.signatures.push(o)}),t.instructions.forEach(i=>{const s=i.accounts.map(o=>{const a=t.accountKeys[o];return{pubkey:a,isSigner:n.signatures.some(c=>c.publicKey.toString()===a.toString())||t.isAccountSigner(o),isWritable:t.isAccountWritable(o)}});n.instructions.push(new p1({keys:s,programId:t.accountKeys[i.programIdIndex],data:Ar.decode(i.data)}))}),n._message=t,n._json=n.toJSON(),n}}class qa{get version(){return this.message.version}constructor(t,r){if(this.signatures=void 0,this.message=void 0,r!==void 0)sr(r.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=r;else{const n=[];for(let i=0;io.equals(i.publicKey));sr(s>=0,`Cannot sign with non signer key ${i.publicKey.toBase58()}`),this.signatures[s]=a1(r,i.secretKey)}}addSignature(t,r){sr(r.byteLength===64,"Signature must be 64 bytes long");const i=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(s=>s.equals(t));sr(i>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[i]=r}}const W3=1e3/(160/64);new et("SysvarC1ock11111111111111111111111111111111"),new et("SysvarEpochSchedu1e111111111111111111111111"),new et("Sysvar1nstructions1111111111111111111111111"),new et("SysvarRecentB1ockHashes11111111111111111111"),new et("SysvarRent111111111111111111111111111111111"),new et("SysvarRewards111111111111111111111111111111"),new et("SysvarS1otHashes111111111111111111111111111"),new et("SysvarS1otHistory11111111111111111111111111"),new et("SysvarStakeHistory1111111111111111111111111");function Uo(e){return new Promise(t=>setTimeout(t,e))}const K3=Gr("lamportsPerSignature"),g1=Fe([qe("version"),qe("state"),St("authorizedPubkey"),St("nonce"),Fe([K3],"feeCalculator")]);g1.span;class yh{constructor(t){this.authorizedPubkey=void 0,this.nonce=void 0,this.feeCalculator=void 0,this.authorizedPubkey=t.authorizedPubkey,this.nonce=t.nonce,this.feeCalculator=t.feeCalculator}static fromAccountData(t){const r=g1.decode(Mo(t),0);return new yh({authorizedPubkey:new et(r.authorizedPubkey),nonce:new et(r.nonce).toString(),feeCalculator:r.feeCalculator})}}const Z3=e=>{const t=e.decode.bind(e),r=e.encode.bind(e);return{decode:t,encode:r}},Fo=(e=>t=>{const r=nr(e,t),{encode:n,decode:i}=Z3(r),s=r;return s.decode=(o,a)=>{const c=i(o,a);return SS(ie.Buffer.from(c))},s.encode=(o,a,c)=>{const u=IS(o,e);return n(u,a,c)},s})(8);Object.freeze({Create:{index:0,layout:Fe([qe("instruction"),In("lamports"),In("space"),St("programId")])},Assign:{index:1,layout:Fe([qe("instruction"),St("programId")])},Transfer:{index:2,layout:Fe([qe("instruction"),Fo("lamports")])},CreateWithSeed:{index:3,layout:Fe([qe("instruction"),St("base"),Po("seed"),In("lamports"),In("space"),St("programId")])},AdvanceNonceAccount:{index:4,layout:Fe([qe("instruction")])},WithdrawNonceAccount:{index:5,layout:Fe([qe("instruction"),In("lamports")])},InitializeNonceAccount:{index:6,layout:Fe([qe("instruction"),St("authorized")])},AuthorizeNonceAccount:{index:7,layout:Fe([qe("instruction"),St("authorized")])},Allocate:{index:8,layout:Fe([qe("instruction"),In("space")])},AllocateWithSeed:{index:9,layout:Fe([qe("instruction"),St("base"),Po("seed"),In("space"),St("programId")])},AssignWithSeed:{index:10,layout:Fe([qe("instruction"),St("base"),Po("seed"),St("programId")])},TransferWithSeed:{index:11,layout:Fe([qe("instruction"),Fo("lamports"),Po("seed"),St("programId")])},UpgradeNonceAccount:{index:12,layout:Fe([qe("instruction")])}}),new et("11111111111111111111111111111111"),new et("BPFLoader2111111111111111111111111111111111");function G3(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Y3=Object.prototype.toString,X3=Object.keys||function(e){var t=[];for(var r in e)t.push(r);return t};function Va(e,t){var r,n,i,s,o,a,c;if(e===!0)return"true";if(e===!1)return"false";switch(typeof e){case"object":if(e===null)return null;if(e.toJSON&&typeof e.toJSON=="function")return Va(e.toJSON(),t);if(c=Y3.call(e),c==="[object Array]"){for(i="[",n=e.length-1,r=0;r-1&&(i+=Va(e[r],!0)),i+"]"}else if(c==="[object Object]"){for(s=X3(e).sort(),n=s.length,i="",r=0;r1;)e/=2,t++;return t}function Q3(e){return e===0?1:(e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e|=e>>32,e+1)}class eA{constructor(t,r,n,i,s){this.slotsPerEpoch=void 0,this.leaderScheduleSlotOffset=void 0,this.warmup=void 0,this.firstNormalEpoch=void 0,this.firstNormalSlot=void 0,this.slotsPerEpoch=t,this.leaderScheduleSlotOffset=r,this.warmup=n,this.firstNormalEpoch=i,this.firstNormalSlot=s}getEpoch(t){return this.getEpochAndSlotIndex(t)[0]}getEpochAndSlotIndex(t){if(t{const o=b3(s,{autoconnect:!0,max_reconnects:5,reconnect:!0,reconnect_interval:1e3,...r});return"socket"in o?this.underlyingSocket=o.socket:this.underlyingSocket=o,o};super(i,t,r,n),this.underlyingSocket=void 0}call(...t){const r=this.underlyingSocket?.readyState;return r===1?super.call(...t):Promise.reject(new Error("Tried to call a JSON-RPC method `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}notify(...t){const r=this.underlyingSocket?.readyState;return r===1?super.notify(...t):Promise.reject(new Error("Tried to send a JSON-RPC notification `"+t[0]+"` but the socket was not `CONNECTING` or `OPEN` (`readyState` was "+r+")"))}}function nA(e,t){let r;try{r=e.layout.decode(t)}catch(n){throw new Error("invalid instruction; "+n)}if(r.typeIndex!==e.index)throw new Error(`invalid account data; account type mismatch ${r.typeIndex} != ${e.index}`);return r}const m1=56;class b1{constructor(t){this.key=void 0,this.state=void 0,this.key=t.key,this.state=t.state}isActive(){const t=BigInt("0xffffffffffffffff");return this.state.deactivationSlot===t}static deserialize(t){const r=nA(iA,t),n=t.length-m1;sr(n>=0,"lookup table is invalid"),sr(n%32===0,"lookup table is invalid");const i=n/32,{addresses:s}=Fe([en(St(),i,"addresses")]).decode(t.slice(m1));return{deactivationSlot:r.deactivationSlot,lastExtendedSlot:r.lastExtendedSlot,lastExtendedSlotStartIndex:r.lastExtendedStartIndex,authority:r.authority.length!==0?new et(r.authority[0]):void 0,addresses:s.map(o=>new et(o))}}}const iA={index:1,layout:Fe([qe("typeIndex"),Fo("deactivationSlot"),Gr("lastExtendedSlot"),Ut("lastExtendedStartIndex"),Ut(),en(St(),Zs(Ut(),-1),"authority")])},sA=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function oA(e){const t=e.match(sA);if(t==null)throw TypeError(`Failed to validate endpoint URL \`${e}\``);const[r,n,i,s]=t,o=e.startsWith("https:")?"wss:":"ws:",a=i==null?null:parseInt(i.slice(1),10),c=a==null?"":`:${a+1}`;return`${o}//${n}${c}${s}`}const kr=Fa(ih(et),Se(),e=>new et(e)),v1=sh([Se(),dr("base64")]),mh=Fa(ih(ie.Buffer),v1,e=>ie.Buffer.from(e[0],"base64")),aA=30*1e3;function cA(e){if(/^https?:/.test(e)===!1)throw new TypeError("Endpoint URL must start with `http:` or `https:`.");return e}function or(e){let t,r;if(typeof e=="string")t=e;else if(e){const{commitment:n,...i}=e;t=n,r=i}return{commitment:t,config:r}}function _1(e){return mn([me({jsonrpc:dr("2.0"),id:Se(),result:e}),me({jsonrpc:dr("2.0"),id:Se(),error:me({code:Ua(),message:Se(),data:Qe(MS())})})])}const fA=_1(Ua());function bt(e){return Fa(_1(e),fA,t=>"error"in t?t:{...t,result:Be(t.result,e)})}function mr(e){return bt(me({context:me({slot:te()}),value:e}))}function Tf(e){return me({context:me({slot:te()}),value:e})}function bh(e,t){return e===0?new za({header:t.header,staticAccountKeys:t.accountKeys.map(r=>new et(r)),recentBlockhash:t.recentBlockhash,compiledInstructions:t.instructions.map(r=>({programIdIndex:r.programIdIndex,accountKeyIndexes:r.accounts,data:Ar.decode(r.data)})),addressTableLookups:t.addressTableLookups}):new Ni(t)}const uA=me({foundation:te(),foundationTerm:te(),initial:te(),taper:te(),terminal:te()}),lA=bt(Ce(Te(me({epoch:te(),effectiveSlot:te(),amount:te(),postBalance:te(),commission:Qe(Te(te()))})))),hA=Ce(me({slot:te(),prioritizationFee:te()})),dA=me({total:te(),validator:te(),foundation:te(),epoch:te()}),pA=me({epoch:te(),slotIndex:te(),slotsInEpoch:te(),absoluteSlot:te(),blockHeight:Qe(te()),transactionCount:Qe(te())}),gA=me({slotsPerEpoch:te(),leaderScheduleSlotOffset:te(),warmup:bi(),firstNormalEpoch:te(),firstNormalSlot:te()}),yA=Vg(Se(),Ce(te())),Xs=Te(mn([me({}),Se()])),wA=me({err:Xs}),mA=dr("receivedSignature"),bA=me({"solana-core":Se(),"feature-set":Qe(te())}),E1=mr(me({err:Te(mn([me({}),Se()])),logs:Te(Ce(Se())),accounts:Qe(Te(Ce(Te(me({executable:bi(),owner:Se(),lamports:te(),data:Ce(Se()),rentEpoch:Qe(te())}))))),unitsConsumed:Qe(te()),returnData:Qe(Te(me({programId:Se(),data:sh([Se(),dr("base64")])})))})),vA=mr(me({byIdentity:Vg(Se(),Ce(te())),range:me({firstSlot:te(),lastSlot:te()})}));function _A(e,t,r,n,i,s){const o=r||tA;let a;s!=null&&console.warn("You have supplied an `httpAgent` when creating a `Connection` in a browser environment.It has been ignored; `httpAgent` is only used in Node environments.");let c;return n&&(c=async(l,y)=>{const A=await new Promise((v,R)=>{try{n(l,y,(O,P)=>v([O,P]))}catch(O){R(O)}});return await o(...A)}),new c3(async(l,y)=>{const A={method:"POST",body:l,agent:a,headers:Object.assign({"Content-Type":"application/json"},t||{},E6)};try{let v=5,R,O=500;for(;c?R=await c(e,A):R=await o(e,A),!(R.status!==429||i===!0||(v-=1,v===0));)console.error(`Server responded with ${R.status} ${R.statusText}. Retrying after ${O}ms delay...`),await Uo(O),O*=2;const P=await R.text();R.ok?y(null,P):y(new Error(`${R.status} ${R.statusText}: ${P}`))}catch(v){v instanceof Error&&y(v)}},{})}function EA(e){return(t,r)=>new Promise((n,i)=>{e.request(t,r,(s,o)=>{if(s){i(s);return}n(o)})})}function xA(e){return t=>new Promise((r,n)=>{t.length===0&&r([]);const i=t.map(s=>e.request(s.methodName,s.args));e.request(i,(s,o)=>{if(s){n(s);return}r(o)})})}const SA=bt(uA),AA=bt(dA),BA=bt(hA),IA=bt(pA),RA=bt(gA),TA=bt(yA),kA=bt(te()),CA=mr(me({total:te(),circulating:te(),nonCirculating:te(),nonCirculatingAccounts:Ce(kr)})),vh=me({amount:Se(),uiAmount:Te(te()),decimals:te(),uiAmountString:Qe(Se())}),LA=mr(Ce(me({address:kr,amount:Se(),uiAmount:Te(te()),decimals:te(),uiAmountString:Qe(Se())}))),$A=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:mh,rentEpoch:te()})}))),_h=me({program:Se(),parsed:Ua(),space:te()}),OA=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:_h,rentEpoch:te()})}))),MA=mr(Ce(me({lamports:te(),address:kr}))),Ka=me({executable:bi(),owner:kr,lamports:te(),data:mh,rentEpoch:te()}),NA=me({pubkey:kr,account:Ka}),PA=Fa(mn([ih(ie.Buffer),_h]),mn([v1,_h]),e=>Array.isArray(e)?Be(e,mh):e),Eh=me({executable:bi(),owner:kr,lamports:te(),data:PA,rentEpoch:te()}),UA=me({pubkey:kr,account:Eh}),FA=me({state:mn([dr("active"),dr("inactive"),dr("activating"),dr("deactivating")]),active:te(),inactive:te()}),DA=bt(Ce(me({signature:Se(),slot:te(),err:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),HA=bt(Ce(me({signature:Se(),slot:te(),err:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),jA=me({subscription:te(),result:Tf(Ka)}),zA=me({pubkey:kr,account:Ka}),qA=me({subscription:te(),result:Tf(zA)}),VA=me({parent:te(),slot:te(),root:te()}),WA=me({subscription:te(),result:VA}),KA=mn([me({type:mn([dr("firstShredReceived"),dr("completed"),dr("optimisticConfirmation"),dr("root")]),slot:te(),timestamp:te()}),me({type:dr("createdBank"),parent:te(),slot:te(),timestamp:te()}),me({type:dr("frozen"),slot:te(),timestamp:te(),stats:me({numTransactionEntries:te(),numSuccessfulTransactions:te(),numFailedTransactions:te(),maxTransactionsPerEntry:te()})}),me({type:dr("dead"),slot:te(),timestamp:te(),err:Se()})]),ZA=me({subscription:te(),result:KA}),GA=me({subscription:te(),result:Tf(mn([wA,mA]))}),YA=me({subscription:te(),result:te()}),XA=me({pubkey:Se(),gossip:Te(Se()),tpu:Te(Se()),rpc:Te(Se()),version:Te(Se())}),x1=me({votePubkey:Se(),nodePubkey:Se(),activatedStake:te(),epochVoteAccount:bi(),epochCredits:Ce(sh([te(),te(),te()])),commission:te(),lastVote:te(),rootSlot:Te(te())}),JA=bt(me({current:Ce(x1),delinquent:Ce(x1)})),QA=mn([dr("processed"),dr("confirmed"),dr("finalized")]),e6=me({slot:te(),confirmations:Te(te()),err:Xs,confirmationStatus:Qe(QA)}),t6=mr(Ce(Te(e6))),r6=bt(te()),S1=me({accountKey:kr,writableIndexes:Ce(te()),readonlyIndexes:Ce(te())}),xh=me({signatures:Ce(Se()),message:me({accountKeys:Ce(Se()),header:me({numRequiredSignatures:te(),numReadonlySignedAccounts:te(),numReadonlyUnsignedAccounts:te()}),instructions:Ce(me({accounts:Ce(te()),data:Se(),programIdIndex:te()})),recentBlockhash:Se(),addressTableLookups:Qe(Ce(S1))})}),A1=me({pubkey:kr,signer:bi(),writable:bi(),source:Qe(mn([dr("transaction"),dr("lookupTable")]))}),B1=me({accountKeys:Ce(A1),signatures:Ce(Se())}),I1=me({parsed:Ua(),program:Se(),programId:kr}),R1=me({accounts:Ce(kr),data:Se(),programId:kr}),n6=mn([R1,I1]),i6=mn([me({parsed:Ua(),program:Se(),programId:Se()}),me({accounts:Ce(Se()),data:Se(),programId:Se()})]),T1=Fa(n6,i6,e=>"accounts"in e?Be(e,R1):Be(e,I1)),k1=me({signatures:Ce(Se()),message:me({accountKeys:Ce(A1),instructions:Ce(T1),recentBlockhash:Se(),addressTableLookups:Qe(Te(Ce(S1)))})}),kf=me({accountIndex:te(),mint:Se(),owner:Qe(Se()),uiTokenAmount:vh}),C1=me({writable:Ce(kr),readonly:Ce(kr)}),Cf=me({err:Xs,fee:te(),innerInstructions:Qe(Te(Ce(me({index:te(),instructions:Ce(me({accounts:Ce(te()),data:Se(),programIdIndex:te()}))})))),preBalances:Ce(te()),postBalances:Ce(te()),logMessages:Qe(Te(Ce(Se()))),preTokenBalances:Qe(Te(Ce(kf))),postTokenBalances:Qe(Te(Ce(kf))),loadedAddresses:Qe(C1),computeUnitsConsumed:Qe(te())}),Sh=me({err:Xs,fee:te(),innerInstructions:Qe(Te(Ce(me({index:te(),instructions:Ce(T1)})))),preBalances:Ce(te()),postBalances:Ce(te()),logMessages:Qe(Te(Ce(Se()))),preTokenBalances:Qe(Te(Ce(kf))),postTokenBalances:Qe(Te(Ce(kf))),loadedAddresses:Qe(C1),computeUnitsConsumed:Qe(te())}),Do=mn([dr(0),dr("legacy")]),Js=me({pubkey:Se(),lamports:te(),postBalance:Te(te()),rewardType:Te(Se()),commission:Qe(Te(te()))}),s6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:xh,meta:Te(Cf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),o6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),a6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:B1,meta:Te(Cf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),c6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:k1,meta:Te(Sh),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),f6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:B1,meta:Te(Sh),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),u6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),l6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:xh,meta:Te(Cf)})),rewards:Qe(Ce(Js)),blockTime:Te(te())}))),L1=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),signatures:Ce(Se()),blockTime:Te(te())}))),Ah=bt(Te(me({slot:te(),meta:Te(Cf),blockTime:Qe(Te(te())),transaction:xh,version:Qe(Do)}))),Lf=bt(Te(me({slot:te(),transaction:k1,meta:Te(Sh),blockTime:Qe(Te(te())),version:Qe(Do)}))),h6=mr(me({blockhash:Se(),feeCalculator:me({lamportsPerSignature:te()})})),d6=mr(me({blockhash:Se(),lastValidBlockHeight:te()})),p6=mr(bi()),g6=me({slot:te(),numTransactions:te(),numSlots:te(),samplePeriodSecs:te()}),y6=bt(Ce(g6)),w6=mr(Te(me({feeCalculator:me({lamportsPerSignature:te()})}))),m6=bt(Se()),b6=bt(Se()),v6=me({err:Xs,logs:Ce(Se()),signature:Se()}),_6=me({result:Tf(v6),subscription:te()}),E6={"solana-client":"js/0.0.0-development"};class x6{constructor(t,r){this._commitment=void 0,this._confirmTransactionInitialTimeout=void 0,this._rpcEndpoint=void 0,this._rpcWsEndpoint=void 0,this._rpcClient=void 0,this._rpcRequest=void 0,this._rpcBatchRequest=void 0,this._rpcWebSocket=void 0,this._rpcWebSocketConnected=!1,this._rpcWebSocketHeartbeat=null,this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketGeneration=0,this._disableBlockhashCaching=!1,this._pollingBlockhash=!1,this._blockhashInfo={latestBlockhash:null,lastFetch:0,transactionSignatures:[],simulatedSignatures:[]},this._nextClientSubscriptionId=0,this._subscriptionDisposeFunctionsByClientSubscriptionId={},this._subscriptionHashByClientSubscriptionId={},this._subscriptionStateChangeCallbacksByHash={},this._subscriptionCallbacksByServerSubscriptionId={},this._subscriptionsByHash={},this._subscriptionsAutoDisposedByRpc=new Set,this.getBlockHeight=(()=>{const u={};return async l=>{const{commitment:y,config:A}=or(l),v=this._buildArgs([],y,void 0,A),R=y1(v);return u[R]=u[R]??(async()=>{try{const O=await this._rpcRequest("getBlockHeight",v),P=Be(O,bt(te()));if("error"in P)throw new je(P.error,"failed to get block height information");return P.result}finally{delete u[R]}})(),await u[R]}})();let n,i,s,o,a,c;r&&typeof r=="string"?this._commitment=r:r&&(this._commitment=r.commitment,this._confirmTransactionInitialTimeout=r.confirmTransactionInitialTimeout,n=r.wsEndpoint,i=r.httpHeaders,s=r.fetch,o=r.fetchMiddleware,a=r.disableRetryOnRateLimit,c=r.httpAgent),this._rpcEndpoint=cA(t),this._rpcWsEndpoint=n||oA(t),this._rpcClient=_A(t,i,s,o,a,c),this._rpcRequest=EA(this._rpcClient),this._rpcBatchRequest=xA(this._rpcClient),this._rpcWebSocket=new rA(this._rpcWsEndpoint,{autoconnect:!1,max_reconnects:1/0}),this._rpcWebSocket.on("open",this._wsOnOpen.bind(this)),this._rpcWebSocket.on("error",this._wsOnError.bind(this)),this._rpcWebSocket.on("close",this._wsOnClose.bind(this)),this._rpcWebSocket.on("accountNotification",this._wsOnAccountNotification.bind(this)),this._rpcWebSocket.on("programNotification",this._wsOnProgramAccountNotification.bind(this)),this._rpcWebSocket.on("slotNotification",this._wsOnSlotNotification.bind(this)),this._rpcWebSocket.on("slotsUpdatesNotification",this._wsOnSlotUpdatesNotification.bind(this)),this._rpcWebSocket.on("signatureNotification",this._wsOnSignatureNotification.bind(this)),this._rpcWebSocket.on("rootNotification",this._wsOnRootNotification.bind(this)),this._rpcWebSocket.on("logsNotification",this._wsOnLogsNotification.bind(this))}get commitment(){return this._commitment}get rpcEndpoint(){return this._rpcEndpoint}async getBalanceAndContext(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,void 0,i),o=await this._rpcRequest("getBalance",s),a=Be(o,mr(te()));if("error"in a)throw new je(a.error,`failed to get balance for ${t.toBase58()}`);return a.result}async getBalance(t,r){return await this.getBalanceAndContext(t,r).then(n=>n.value).catch(n=>{throw new Error("failed to get balance of account "+t.toBase58()+": "+n)})}async getBlockTime(t){const r=await this._rpcRequest("getBlockTime",[t]),n=Be(r,bt(Te(te())));if("error"in n)throw new je(n.error,`failed to get block time for slot ${t}`);return n.result}async getMinimumLedgerSlot(){const t=await this._rpcRequest("minimumLedgerSlot",[]),r=Be(t,bt(te()));if("error"in r)throw new je(r.error,"failed to get minimum ledger slot");return r.result}async getFirstAvailableBlock(){const t=await this._rpcRequest("getFirstAvailableBlock",[]),r=Be(t,kA);if("error"in r)throw new je(r.error,"failed to get first available block");return r.result}async getSupply(t){let r={};typeof t=="string"?r={commitment:t}:t?r={...t,commitment:t&&t.commitment||this.commitment}:r={commitment:this.commitment};const n=await this._rpcRequest("getSupply",[r]),i=Be(n,CA);if("error"in i)throw new je(i.error,"failed to get supply");return i.result}async getTokenSupply(t,r){const n=this._buildArgs([t.toBase58()],r),i=await this._rpcRequest("getTokenSupply",n),s=Be(i,mr(vh));if("error"in s)throw new je(s.error,"failed to get token supply");return s.result}async getTokenAccountBalance(t,r){const n=this._buildArgs([t.toBase58()],r),i=await this._rpcRequest("getTokenAccountBalance",n),s=Be(i,mr(vh));if("error"in s)throw new je(s.error,"failed to get token account balance");return s.result}async getTokenAccountsByOwner(t,r,n){const{commitment:i,config:s}=or(n);let o=[t.toBase58()];"mint"in r?o.push({mint:r.mint.toBase58()}):o.push({programId:r.programId.toBase58()});const a=this._buildArgs(o,i,"base64",s),c=await this._rpcRequest("getTokenAccountsByOwner",a),u=Be(c,$A);if("error"in u)throw new je(u.error,`failed to get token accounts owned by account ${t.toBase58()}`);return u.result}async getParsedTokenAccountsByOwner(t,r,n){let i=[t.toBase58()];"mint"in r?i.push({mint:r.mint.toBase58()}):i.push({programId:r.programId.toBase58()});const s=this._buildArgs(i,n,"jsonParsed"),o=await this._rpcRequest("getTokenAccountsByOwner",s),a=Be(o,OA);if("error"in a)throw new je(a.error,`failed to get token accounts owned by account ${t.toBase58()}`);return a.result}async getLargestAccounts(t){const r={...t,commitment:t&&t.commitment||this.commitment},n=r.filter||r.commitment?[r]:[],i=await this._rpcRequest("getLargestAccounts",n),s=Be(i,MA);if("error"in s)throw new je(s.error,"failed to get largest accounts");return s.result}async getTokenLargestAccounts(t,r){const n=this._buildArgs([t.toBase58()],r),i=await this._rpcRequest("getTokenLargestAccounts",n),s=Be(i,LA);if("error"in s)throw new je(s.error,"failed to get token largest accounts");return s.result}async getAccountInfoAndContext(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,"base64",i),o=await this._rpcRequest("getAccountInfo",s),a=Be(o,mr(Te(Ka)));if("error"in a)throw new je(a.error,`failed to get info about account ${t.toBase58()}`);return a.result}async getParsedAccountInfo(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getAccountInfo",s),a=Be(o,mr(Te(Eh)));if("error"in a)throw new je(a.error,`failed to get info about account ${t.toBase58()}`);return a.result}async getAccountInfo(t,r){try{return(await this.getAccountInfoAndContext(t,r)).value}catch(n){throw new Error("failed to get info about account "+t.toBase58()+": "+n)}}async getMultipleParsedAccounts(t,r){const{commitment:n,config:i}=or(r),s=t.map(u=>u.toBase58()),o=this._buildArgs([s],n,"jsonParsed",i),a=await this._rpcRequest("getMultipleAccounts",o),c=Be(a,mr(Ce(Te(Eh))));if("error"in c)throw new je(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfoAndContext(t,r){const{commitment:n,config:i}=or(r),s=t.map(u=>u.toBase58()),o=this._buildArgs([s],n,"base64",i),a=await this._rpcRequest("getMultipleAccounts",o),c=Be(a,mr(Ce(Te(Ka))));if("error"in c)throw new je(c.error,`failed to get info for accounts ${s}`);return c.result}async getMultipleAccountsInfo(t,r){return(await this.getMultipleAccountsInfoAndContext(t,r)).value}async getStakeActivation(t,r,n){const{commitment:i,config:s}=or(r),o=this._buildArgs([t.toBase58()],i,void 0,{...s,epoch:n??s?.epoch}),a=await this._rpcRequest("getStakeActivation",o),c=Be(a,bt(FA));if("error"in c)throw new je(c.error,`failed to get Stake Activation ${t.toBase58()}`);return c.result}async getProgramAccounts(t,r){const{commitment:n,config:i}=or(r),{encoding:s,...o}=i||{},a=this._buildArgs([t.toBase58()],n,s||"base64",o),c=await this._rpcRequest("getProgramAccounts",a),u=Ce(NA),l=o.withContext===!0?Be(c,mr(u)):Be(c,bt(u));if("error"in l)throw new je(l.error,`failed to get accounts owned by program ${t.toBase58()}`);return l.result}async getParsedProgramAccounts(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t.toBase58()],n,"jsonParsed",i),o=await this._rpcRequest("getProgramAccounts",s),a=Be(o,bt(Ce(UA)));if("error"in a)throw new je(a.error,`failed to get accounts owned by program ${t.toBase58()}`);return a.result}async confirmTransaction(t,r){let n;if(typeof t=="string")n=t;else{const s=t;if(s.abortSignal?.aborted)return Promise.reject(s.abortSignal.reason);n=s.signature}let i;try{i=Ar.decode(n)}catch{throw new Error("signature must be base58 encoded: "+n)}return sr(i.length===64,"signature has invalid length"),typeof t=="string"?await this.confirmTransactionUsingLegacyTimeoutStrategy({commitment:r||this.commitment,signature:n}):"lastValidBlockHeight"in t?await this.confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:r||this.commitment,strategy:t}):await this.confirmTransactionUsingDurableNonceStrategy({commitment:r||this.commitment,strategy:t})}getCancellationPromise(t){return new Promise((r,n)=>{t!=null&&(t.aborted?n(t.reason):t.addEventListener("abort",()=>{n(t.reason)}))})}getTransactionConfirmationPromise({commitment:t,signature:r}){let n,i,s=!1;const o=new Promise((c,u)=>{try{n=this.onSignature(r,(y,A)=>{n=void 0;const v={context:A,value:y};c({__type:cs.PROCESSED,response:v})},t);const l=new Promise(y=>{n==null?y():i=this._onSubscriptionStateChange(n,A=>{A==="subscribed"&&y()})});(async()=>{if(await l,s)return;const y=await this.getSignatureStatus(r);if(s||y==null)return;const{context:A,value:v}=y;if(v!=null)if(v?.err)u(v.err);else{switch(t){case"confirmed":case"single":case"singleGossip":{if(v.confirmationStatus==="processed")return;break}case"finalized":case"max":case"root":{if(v.confirmationStatus==="processed"||v.confirmationStatus==="confirmed")return;break}case"processed":case"recent":}s=!0,c({__type:cs.PROCESSED,response:{context:A,value:v}})}})()}catch(l){u(l)}});return{abortConfirmation:()=>{i&&(i(),i=void 0),n!=null&&(this.removeSignatureListener(n),n=void 0)},confirmationPromise:o}}async confirmTransactionUsingBlockHeightExceedanceStrategy({commitment:t,strategy:{abortSignal:r,lastValidBlockHeight:n,signature:i}}){let s=!1;const o=new Promise(y=>{const A=async()=>{try{return await this.getBlockHeight(t)}catch{return-1}};(async()=>{let v=await A();if(!s){for(;v<=n;)if(await Uo(1e3),s||(v=await A(),s))return;y({__type:cs.BLOCKHEIGHT_EXCEEDED})}})()}),{abortConfirmation:a,confirmationPromise:c}=this.getTransactionConfirmationPromise({commitment:t,signature:i}),u=this.getCancellationPromise(r);let l;try{const y=await Promise.race([u,c,o]);if(y.__type===cs.PROCESSED)l=y.response;else throw new u1(i)}finally{s=!0,a()}return l}async confirmTransactionUsingDurableNonceStrategy({commitment:t,strategy:{abortSignal:r,minContextSlot:n,nonceAccountPubkey:i,nonceValue:s,signature:o}}){let a=!1;const c=new Promise(v=>{let R=s,O=null;const P=async()=>{try{const{context:H,value:F}=await this.getNonceAndContext(i,{commitment:t,minContextSlot:n});return O=H.slot,F?.nonce}catch{return R}};(async()=>{if(R=await P(),!a)for(;;){if(s!==R){v({__type:cs.NONCE_INVALID,slotInWhichNonceDidAdvance:O});return}if(await Uo(2e3),a||(R=await P(),a))return}})()}),{abortConfirmation:u,confirmationPromise:l}=this.getTransactionConfirmationPromise({commitment:t,signature:o}),y=this.getCancellationPromise(r);let A;try{const v=await Promise.race([y,l,c]);if(v.__type===cs.PROCESSED)A=v.response;else{let R;for(;;){const O=await this.getSignatureStatus(o);if(O==null)break;if(O.context.slot<(v.slotInWhichNonceDidAdvance??n)){await Uo(400);continue}R=O;break}if(R?.value){const O=t||"finalized",{confirmationStatus:P}=R.value;switch(O){case"processed":case"recent":if(P!=="processed"&&P!=="confirmed"&&P!=="finalized")throw new ja(o);break;case"confirmed":case"single":case"singleGossip":if(P!=="confirmed"&&P!=="finalized")throw new ja(o);break;case"finalized":case"max":case"root":if(P!=="finalized")throw new ja(o);break;default:(H=>{})(O)}A={context:R.context,value:{err:R.value.err}}}else throw new ja(o)}}finally{a=!0,u()}return A}async confirmTransactionUsingLegacyTimeoutStrategy({commitment:t,signature:r}){let n;const i=new Promise(c=>{let u=this._confirmTransactionInitialTimeout||6e4;switch(t){case"processed":case"recent":case"single":case"confirmed":case"singleGossip":{u=this._confirmTransactionInitialTimeout||3e4;break}}n=setTimeout(()=>c({__type:cs.TIMED_OUT,timeoutMs:u}),u)}),{abortConfirmation:s,confirmationPromise:o}=this.getTransactionConfirmationPromise({commitment:t,signature:r});let a;try{const c=await Promise.race([o,i]);if(c.__type===cs.PROCESSED)a=c.response;else throw new l1(r,c.timeoutMs/1e3)}finally{clearTimeout(n),s()}return a}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),r=Be(t,bt(Ce(XA)));if("error"in r)throw new je(r.error,"failed to get cluster nodes");return r.result}async getVoteAccounts(t){const r=this._buildArgs([],t),n=await this._rpcRequest("getVoteAccounts",r),i=Be(n,JA);if("error"in i)throw new je(i.error,"failed to get vote accounts");return i.result}async getSlot(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlot",i),o=Be(s,bt(te()));if("error"in o)throw new je(o.error,"failed to get slot");return o.result}async getSlotLeader(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getSlotLeader",i),o=Be(s,bt(Se()));if("error"in o)throw new je(o.error,"failed to get slot leader");return o.result}async getSlotLeaders(t,r){const n=[t,r],i=await this._rpcRequest("getSlotLeaders",n),s=Be(i,bt(Ce(kr)));if("error"in s)throw new je(s.error,"failed to get slot leaders");return s.result}async getSignatureStatus(t,r){const{context:n,value:i}=await this.getSignatureStatuses([t],r);sr(i.length===1);const s=i[0];return{context:n,value:s}}async getSignatureStatuses(t,r){const n=[t];r&&n.push(r);const i=await this._rpcRequest("getSignatureStatuses",n),s=Be(i,t6);if("error"in s)throw new je(s.error,"failed to get signature status");return s.result}async getTransactionCount(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getTransactionCount",i),o=Be(s,bt(te()));if("error"in o)throw new je(o.error,"failed to get transaction count");return o.result}async getTotalSupply(t){return(await this.getSupply({commitment:t,excludeNonCirculatingAccountsList:!0})).value.total}async getInflationGovernor(t){const r=this._buildArgs([],t),n=await this._rpcRequest("getInflationGovernor",r),i=Be(n,SA);if("error"in i)throw new je(i.error,"failed to get inflation");return i.result}async getInflationReward(t,r,n){const{commitment:i,config:s}=or(n),o=this._buildArgs([t.map(u=>u.toBase58())],i,void 0,{...s,epoch:r??s?.epoch}),a=await this._rpcRequest("getInflationReward",o),c=Be(a,lA);if("error"in c)throw new je(c.error,"failed to get inflation reward");return c.result}async getInflationRate(){const t=await this._rpcRequest("getInflationRate",[]),r=Be(t,AA);if("error"in r)throw new je(r.error,"failed to get inflation rate");return r.result}async getEpochInfo(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getEpochInfo",i),o=Be(s,IA);if("error"in o)throw new je(o.error,"failed to get epoch info");return o.result}async getEpochSchedule(){const t=await this._rpcRequest("getEpochSchedule",[]),r=Be(t,RA);if("error"in r)throw new je(r.error,"failed to get epoch schedule");const n=r.result;return new eA(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),r=Be(t,TA);if("error"in r)throw new je(r.error,"failed to get leader schedule");return r.result}async getMinimumBalanceForRentExemption(t,r){const n=this._buildArgs([t],r),i=await this._rpcRequest("getMinimumBalanceForRentExemption",n),s=Be(i,r6);return"error"in s?(console.warn("Unable to fetch minimum balance for rent exemption"),0):s.result}async getRecentBlockhashAndContext(t){const r=this._buildArgs([],t),n=await this._rpcRequest("getRecentBlockhash",r),i=Be(n,h6);if("error"in i)throw new je(i.error,"failed to get recent blockhash");return i.result}async getRecentPerformanceSamples(t){const r=await this._rpcRequest("getRecentPerformanceSamples",t?[t]:[]),n=Be(r,y6);if("error"in n)throw new je(n.error,"failed to get recent performance samples");return n.result}async getFeeCalculatorForBlockhash(t,r){const n=this._buildArgs([t],r),i=await this._rpcRequest("getFeeCalculatorForBlockhash",n),s=Be(i,w6);if("error"in s)throw new je(s.error,"failed to get fee calculator");const{context:o,value:a}=s.result;return{context:o,value:a!==null?a.feeCalculator:null}}async getFeeForMessage(t,r){const n=Mo(t.serialize()).toString("base64"),i=this._buildArgs([n],r),s=await this._rpcRequest("getFeeForMessage",i),o=Be(s,mr(Te(te())));if("error"in o)throw new je(o.error,"failed to get fee for message");if(o.result===null)throw new Error("invalid blockhash");return o.result}async getRecentPrioritizationFees(t){const r=t?.lockedWritableAccounts?.map(o=>o.toBase58()),n=r?.length?[r]:[],i=await this._rpcRequest("getRecentPrioritizationFees",n),s=Be(i,BA);if("error"in s)throw new je(s.error,"failed to get recent prioritization fees");return s.result}async getRecentBlockhash(t){try{return(await this.getRecentBlockhashAndContext(t)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhash(t){try{return(await this.getLatestBlockhashAndContext(t)).value}catch(r){throw new Error("failed to get recent blockhash: "+r)}}async getLatestBlockhashAndContext(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,void 0,n),s=await this._rpcRequest("getLatestBlockhash",i),o=Be(s,d6);if("error"in o)throw new je(o.error,"failed to get latest blockhash");return o.result}async isBlockhashValid(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgs([t],n,void 0,i),o=await this._rpcRequest("isBlockhashValid",s),a=Be(o,p6);if("error"in a)throw new je(a.error,"failed to determine if the blockhash `"+t+"`is valid");return a.result}async getVersion(){const t=await this._rpcRequest("getVersion",[]),r=Be(t,bt(bA));if("error"in r)throw new je(r.error,"failed to get version");return r.result}async getGenesisHash(){const t=await this._rpcRequest("getGenesisHash",[]),r=Be(t,bt(Se()));if("error"in r)throw new je(r.error,"failed to get genesis hash");return r.result}async getBlock(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,void 0,i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{const a=Be(o,a6);if("error"in a)throw a.error;return a.result}case"none":{const a=Be(o,o6);if("error"in a)throw a.error;return a.result}default:{const a=Be(o,s6);if("error"in a)throw a.error;const{result:c}=a;return c?{...c,transactions:c.transactions.map(({transaction:u,meta:l,version:y})=>({meta:l,transaction:{...u,message:bh(y,u.message)},version:y}))}:null}}}catch(a){throw new je(a,"failed to get confirmed block")}}async getParsedBlock(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",i),o=await this._rpcRequest("getBlock",s);try{switch(i?.transactionDetails){case"accounts":{const a=Be(o,f6);if("error"in a)throw a.error;return a.result}case"none":{const a=Be(o,u6);if("error"in a)throw a.error;return a.result}default:{const a=Be(o,c6);if("error"in a)throw a.error;return a.result}}}catch(a){throw new je(a,"failed to get block")}}async getBlockProduction(t){let r,n;if(typeof t=="string")n=t;else if(t){const{commitment:a,...c}=t;n=a,r=c}const i=this._buildArgs([],n,"base64",r),s=await this._rpcRequest("getBlockProduction",i),o=Be(s,vA);if("error"in o)throw new je(o.error,"failed to get block production information");return o.result}async getTransaction(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,void 0,i),o=await this._rpcRequest("getTransaction",s),a=Be(o,Ah);if("error"in a)throw new je(a.error,"failed to get transaction");const c=a.result;return c&&{...c,transaction:{...c.transaction,message:bh(c.version,c.transaction.message)}}}async getParsedTransaction(t,r){const{commitment:n,config:i}=or(r),s=this._buildArgsAtLeastConfirmed([t],n,"jsonParsed",i),o=await this._rpcRequest("getTransaction",s),a=Be(o,Lf);if("error"in a)throw new je(a.error,"failed to get transaction");return a.result}async getParsedTransactions(t,r){const{commitment:n,config:i}=or(r),s=t.map(c=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([c],n,"jsonParsed",i)}));return(await this._rpcBatchRequest(s)).map(c=>{const u=Be(c,Lf);if("error"in u)throw new je(u.error,"failed to get transactions");return u.result})}async getTransactions(t,r){const{commitment:n,config:i}=or(r),s=t.map(c=>({methodName:"getTransaction",args:this._buildArgsAtLeastConfirmed([c],n,void 0,i)}));return(await this._rpcBatchRequest(s)).map(c=>{const u=Be(c,Ah);if("error"in u)throw new je(u.error,"failed to get transactions");const l=u.result;return l&&{...l,transaction:{...l.transaction,message:bh(l.version,l.transaction.message)}}})}async getConfirmedBlock(t,r){const n=this._buildArgsAtLeastConfirmed([t],r),i=await this._rpcRequest("getConfirmedBlock",n),s=Be(i,l6);if("error"in s)throw new je(s.error,"failed to get confirmed block");const o=s.result;if(!o)throw new Error("Confirmed block "+t+" not found");const a={...o,transactions:o.transactions.map(({transaction:c,meta:u})=>{const l=new Ni(c.message);return{meta:u,transaction:{...c,message:l}}})};return{...a,transactions:a.transactions.map(({transaction:c,meta:u})=>({meta:u,transaction:fs.populate(c.message,c.signatures)}))}}async getBlocks(t,r,n){const i=this._buildArgsAtLeastConfirmed(r!==void 0?[t,r]:[t],n),s=await this._rpcRequest("getBlocks",i),o=Be(s,bt(Ce(te())));if("error"in o)throw new je(o.error,"failed to get blocks");return o.result}async getBlockSignatures(t,r){const n=this._buildArgsAtLeastConfirmed([t],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getBlock",n),s=Be(i,L1);if("error"in s)throw new je(s.error,"failed to get block");const o=s.result;if(!o)throw new Error("Block "+t+" not found");return o}async getConfirmedBlockSignatures(t,r){const n=this._buildArgsAtLeastConfirmed([t],r,void 0,{transactionDetails:"signatures",rewards:!1}),i=await this._rpcRequest("getConfirmedBlock",n),s=Be(i,L1);if("error"in s)throw new je(s.error,"failed to get confirmed block");const o=s.result;if(!o)throw new Error("Confirmed block "+t+" not found");return o}async getConfirmedTransaction(t,r){const n=this._buildArgsAtLeastConfirmed([t],r),i=await this._rpcRequest("getConfirmedTransaction",n),s=Be(i,Ah);if("error"in s)throw new je(s.error,"failed to get transaction");const o=s.result;if(!o)return o;const a=new Ni(o.transaction.message),c=o.transaction.signatures;return{...o,transaction:fs.populate(a,c)}}async getParsedConfirmedTransaction(t,r){const n=this._buildArgsAtLeastConfirmed([t],r,"jsonParsed"),i=await this._rpcRequest("getConfirmedTransaction",n),s=Be(i,Lf);if("error"in s)throw new je(s.error,"failed to get confirmed transaction");return s.result}async getParsedConfirmedTransactions(t,r){const n=t.map(o=>({methodName:"getConfirmedTransaction",args:this._buildArgsAtLeastConfirmed([o],r,"jsonParsed")}));return(await this._rpcBatchRequest(n)).map(o=>{const a=Be(o,Lf);if("error"in a)throw new je(a.error,"failed to get confirmed transactions");return a.result})}async getConfirmedSignaturesForAddress(t,r,n){let i={},s=await this.getFirstAvailableBlock();for(;!("until"in i)&&(r--,!(r<=0||r0&&(i.until=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}let o=await this.getSlot("finalized");for(;!("before"in i)&&(n++,!(n>o));)try{const c=await this.getConfirmedBlockSignatures(n);c.signatures.length>0&&(i.before=c.signatures[c.signatures.length-1].toString())}catch(c){if(c instanceof Error&&c.message.includes("skipped"))continue;throw c}return(await this.getConfirmedSignaturesForAddress2(t,i)).map(c=>c.signature)}async getConfirmedSignaturesForAddress2(t,r,n){const i=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,r),s=await this._rpcRequest("getConfirmedSignaturesForAddress2",i),o=Be(s,DA);if("error"in o)throw new je(o.error,"failed to get confirmed signatures for address");return o.result}async getSignaturesForAddress(t,r,n){const i=this._buildArgsAtLeastConfirmed([t.toBase58()],n,void 0,r),s=await this._rpcRequest("getSignaturesForAddress",i),o=Be(s,HA);if("error"in o)throw new je(o.error,"failed to get signatures for address");return o.result}async getAddressLookupTable(t,r){const{context:n,value:i}=await this.getAccountInfoAndContext(t,r);let s=null;return i!==null&&(s=new b1({key:t,state:b1.deserialize(i.data)})),{context:n,value:s}}async getNonceAndContext(t,r){const{context:n,value:i}=await this.getAccountInfoAndContext(t,r);let s=null;return i!==null&&(s=yh.fromAccountData(i.data)),{context:n,value:s}}async getNonce(t,r){return await this.getNonceAndContext(t,r).then(n=>n.value).catch(n=>{throw new Error("failed to get nonce for account "+t.toBase58()+": "+n)})}async requestAirdrop(t,r){const n=await this._rpcRequest("requestAirdrop",[t.toBase58(),r]),i=Be(n,m6);if("error"in i)throw new je(i.error,`airdrop to ${t.toBase58()} failed`);return i.result}async _blockhashWithExpiryBlockHeight(t){if(!t){for(;this._pollingBlockhash;)await Uo(100);const n=Date.now()-this._blockhashInfo.lastFetch>=aA;if(this._blockhashInfo.latestBlockhash!==null&&!n)return this._blockhashInfo.latestBlockhash}return await this._pollNewBlockhash()}async _pollNewBlockhash(){this._pollingBlockhash=!0;try{const t=Date.now(),r=this._blockhashInfo.latestBlockhash,n=r?r.blockhash:null;for(let i=0;i<50;i++){const s=await this.getLatestBlockhash("finalized");if(n!==s.blockhash)return this._blockhashInfo={latestBlockhash:s,lastFetch:Date.now(),transactionSignatures:[],simulatedSignatures:[]},s;await Uo(W3/2)}throw new Error(`Unable to obtain a new blockhash after ${Date.now()-t}ms`)}finally{this._pollingBlockhash=!1}}async getStakeMinimumDelegation(t){const{commitment:r,config:n}=or(t),i=this._buildArgs([],r,"base64",n),s=await this._rpcRequest("getStakeMinimumDelegation",i),o=Be(s,mr(te()));if("error"in o)throw new je(o.error,"failed to get stake minimum delegation");return o.result}async simulateTransaction(t,r,n){if("message"in t){const O=t.serialize(),P=ie.Buffer.from(O).toString("base64");if(Array.isArray(r)||n!==void 0)throw new Error("Invalid arguments");const H=r||{};H.encoding="base64","commitment"in H||(H.commitment=this.commitment);const F=[P,H],N=await this._rpcRequest("simulateTransaction",F),$=Be(N,E1);if("error"in $)throw new Error("failed to simulate transaction: "+$.error.message);return $.result}let i;if(t instanceof fs){let R=t;i=new fs,i.feePayer=R.feePayer,i.instructions=t.instructions,i.nonceInfo=R.nonceInfo,i.signatures=R.signatures}else i=fs.populate(t),i._message=i._json=void 0;if(r!==void 0&&!Array.isArray(r))throw new Error("Invalid arguments");const s=r;if(i.nonceInfo&&s)i.sign(...s);else{let R=this._disableBlockhashCaching;for(;;){const O=await this._blockhashWithExpiryBlockHeight(R);if(i.lastValidBlockHeight=O.lastValidBlockHeight,i.recentBlockhash=O.blockhash,!s)break;if(i.sign(...s),!i.signature)throw new Error("!signature");const P=i.signature.toString("base64");if(!this._blockhashInfo.simulatedSignatures.includes(P)&&!this._blockhashInfo.transactionSignatures.includes(P)){this._blockhashInfo.simulatedSignatures.push(P);break}else R=!0}}const o=i._compile(),a=o.serialize(),u=i._serialize(a).toString("base64"),l={encoding:"base64",commitment:this.commitment};if(n){const R=(Array.isArray(n)?n:o.nonProgramIds()).map(O=>O.toBase58());l.accounts={encoding:"base64",addresses:R}}s&&(l.sigVerify=!0);const y=[u,l],A=await this._rpcRequest("simulateTransaction",y),v=Be(A,E1);if("error"in v){let R;if("data"in v.error&&(R=v.error.data.logs,R&&Array.isArray(R))){const O=` + `,P=O+R.join(O);console.error(v.error.message,P)}throw new w1("failed to simulate transaction: "+v.error.message,R)}return v.result}async sendTransaction(t,r,n){if("version"in t){if(r&&Array.isArray(r))throw new Error("Invalid arguments");const o=t.serialize();return await this.sendRawTransaction(o,r)}if(r===void 0||!Array.isArray(r))throw new Error("Invalid arguments");const i=r;if(t.nonceInfo)t.sign(...i);else{let o=this._disableBlockhashCaching;for(;;){const a=await this._blockhashWithExpiryBlockHeight(o);if(t.lastValidBlockHeight=a.lastValidBlockHeight,t.recentBlockhash=a.blockhash,t.sign(...i),!t.signature)throw new Error("!signature");const c=t.signature.toString("base64");if(this._blockhashInfo.transactionSignatures.includes(c))o=!0;else{this._blockhashInfo.transactionSignatures.push(c);break}}}const s=t.serialize();return await this.sendRawTransaction(s,n)}async sendRawTransaction(t,r){const n=Mo(t).toString("base64");return await this.sendEncodedTransaction(n,r)}async sendEncodedTransaction(t,r){const n={encoding:"base64"},i=r&&r.skipPreflight,s=i===!0?"processed":r&&r.preflightCommitment||this.commitment;r&&r.maxRetries!=null&&(n.maxRetries=r.maxRetries),r&&r.minContextSlot!=null&&(n.minContextSlot=r.minContextSlot),i&&(n.skipPreflight=i),s&&(n.preflightCommitment=s);const o=[t,n],a=await this._rpcRequest("sendTransaction",o),c=Be(a,b6);if("error"in c){let u;throw"data"in c.error&&(u=c.error.data.logs),new w1("failed to send transaction: "+c.error.message,u)}return c.result}_wsOnOpen(){this._rpcWebSocketConnected=!0,this._rpcWebSocketHeartbeat=setInterval(()=>{(async()=>{try{await this._rpcWebSocket.notify("ping")}catch{}})()},5e3),this._updateSubscriptions()}_wsOnError(t){this._rpcWebSocketConnected=!1,console.error("ws error:",t.message)}_wsOnClose(t){if(this._rpcWebSocketConnected=!1,this._rpcWebSocketGeneration=(this._rpcWebSocketGeneration+1)%Number.MAX_SAFE_INTEGER,this._rpcWebSocketIdleTimeout&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null),this._rpcWebSocketHeartbeat&&(clearInterval(this._rpcWebSocketHeartbeat),this._rpcWebSocketHeartbeat=null),t===1e3){this._updateSubscriptions();return}this._subscriptionCallbacksByServerSubscriptionId={},Object.entries(this._subscriptionsByHash).forEach(([r,n])=>{this._setSubscription(r,{...n,state:"pending"})})}_setSubscription(t,r){const n=this._subscriptionsByHash[t]?.state;if(this._subscriptionsByHash[t]=r,n!==r.state){const i=this._subscriptionStateChangeCallbacksByHash[t];i&&i.forEach(s=>{try{s(r.state)}catch{}})}}_onSubscriptionStateChange(t,r){const n=this._subscriptionHashByClientSubscriptionId[t];if(n==null)return()=>{};const i=this._subscriptionStateChangeCallbacksByHash[n]||=new Set;return i.add(r),()=>{i.delete(r),i.size===0&&delete this._subscriptionStateChangeCallbacksByHash[n]}}async _updateSubscriptions(){if(Object.keys(this._subscriptionsByHash).length===0){this._rpcWebSocketConnected&&(this._rpcWebSocketConnected=!1,this._rpcWebSocketIdleTimeout=setTimeout(()=>{this._rpcWebSocketIdleTimeout=null;try{this._rpcWebSocket.close()}catch(n){n instanceof Error&&console.log(`Error when closing socket connection: ${n.message}`)}},500));return}if(this._rpcWebSocketIdleTimeout!==null&&(clearTimeout(this._rpcWebSocketIdleTimeout),this._rpcWebSocketIdleTimeout=null,this._rpcWebSocketConnected=!0),!this._rpcWebSocketConnected){this._rpcWebSocket.connect();return}const t=this._rpcWebSocketGeneration,r=()=>t===this._rpcWebSocketGeneration;await Promise.all(Object.keys(this._subscriptionsByHash).map(async n=>{const i=this._subscriptionsByHash[n];if(i!==void 0)switch(i.state){case"pending":case"unsubscribed":if(i.callbacks.size===0){delete this._subscriptionsByHash[n],i.state==="unsubscribed"&&delete this._subscriptionCallbacksByServerSubscriptionId[i.serverSubscriptionId],await this._updateSubscriptions();return}await(async()=>{const{args:s,method:o}=i;try{this._setSubscription(n,{...i,state:"subscribing"});const a=await this._rpcWebSocket.call(o,s);this._setSubscription(n,{...i,serverSubscriptionId:a,state:"subscribed"}),this._subscriptionCallbacksByServerSubscriptionId[a]=i.callbacks,await this._updateSubscriptions()}catch(a){if(a instanceof Error&&console.error(`${o} error for argument`,s,a.message),!r())return;this._setSubscription(n,{...i,state:"pending"}),await this._updateSubscriptions()}})();break;case"subscribed":i.callbacks.size===0&&await(async()=>{const{serverSubscriptionId:s,unsubscribeMethod:o}=i;if(this._subscriptionsAutoDisposedByRpc.has(s))this._subscriptionsAutoDisposedByRpc.delete(s);else{this._setSubscription(n,{...i,state:"unsubscribing"}),this._setSubscription(n,{...i,state:"unsubscribing"});try{await this._rpcWebSocket.call(o,[s])}catch(a){if(a instanceof Error&&console.error(`${o} error:`,a.message),!r())return;this._setSubscription(n,{...i,state:"subscribed"}),await this._updateSubscriptions();return}}this._setSubscription(n,{...i,state:"unsubscribed"}),await this._updateSubscriptions()})();break}}))}_handleServerNotification(t,r){const n=this._subscriptionCallbacksByServerSubscriptionId[t];n!==void 0&&n.forEach(i=>{try{i(...r)}catch(s){console.error(s)}})}_wsOnAccountNotification(t){const{result:r,subscription:n}=Be(t,jA);this._handleServerNotification(n,[r.value,r.context])}_makeSubscription(t,r){const n=this._nextClientSubscriptionId++,i=y1([t.method,r]),s=this._subscriptionsByHash[i];return s===void 0?this._subscriptionsByHash[i]={...t,args:r,callbacks:new Set([t.callback]),state:"pending"}:s.callbacks.add(t.callback),this._subscriptionHashByClientSubscriptionId[n]=i,this._subscriptionDisposeFunctionsByClientSubscriptionId[n]=async()=>{delete this._subscriptionDisposeFunctionsByClientSubscriptionId[n],delete this._subscriptionHashByClientSubscriptionId[n];const o=this._subscriptionsByHash[i];sr(o!==void 0,`Could not find a \`Subscription\` when tearing down client subscription #${n}`),o.callbacks.delete(t.callback),await this._updateSubscriptions()},this._updateSubscriptions(),n}onAccountChange(t,r,n){const i=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64");return this._makeSubscription({callback:r,method:"accountSubscribe",unsubscribeMethod:"accountUnsubscribe"},i)}async removeAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"account change")}_wsOnProgramAccountNotification(t){const{result:r,subscription:n}=Be(t,qA);this._handleServerNotification(n,[{accountId:r.value.pubkey,accountInfo:r.value.account},r.context])}onProgramAccountChange(t,r,n,i){const s=this._buildArgs([t.toBase58()],n||this._commitment||"finalized","base64",i?{filters:i}:void 0);return this._makeSubscription({callback:r,method:"programSubscribe",unsubscribeMethod:"programUnsubscribe"},s)}async removeProgramAccountChangeListener(t){await this._unsubscribeClientSubscription(t,"program account change")}onLogs(t,r,n){const i=this._buildArgs([typeof t=="object"?{mentions:[t.toString()]}:t],n||this._commitment||"finalized");return this._makeSubscription({callback:r,method:"logsSubscribe",unsubscribeMethod:"logsUnsubscribe"},i)}async removeOnLogsListener(t){await this._unsubscribeClientSubscription(t,"logs")}_wsOnLogsNotification(t){const{result:r,subscription:n}=Be(t,_6);this._handleServerNotification(n,[r.value,r.context])}_wsOnSlotNotification(t){const{result:r,subscription:n}=Be(t,WA);this._handleServerNotification(n,[r])}onSlotChange(t){return this._makeSubscription({callback:t,method:"slotSubscribe",unsubscribeMethod:"slotUnsubscribe"},[])}async removeSlotChangeListener(t){await this._unsubscribeClientSubscription(t,"slot change")}_wsOnSlotUpdatesNotification(t){const{result:r,subscription:n}=Be(t,ZA);this._handleServerNotification(n,[r])}onSlotUpdate(t){return this._makeSubscription({callback:t,method:"slotsUpdatesSubscribe",unsubscribeMethod:"slotsUpdatesUnsubscribe"},[])}async removeSlotUpdateListener(t){await this._unsubscribeClientSubscription(t,"slot update")}async _unsubscribeClientSubscription(t,r){const n=this._subscriptionDisposeFunctionsByClientSubscriptionId[t];n?await n():console.warn(`Ignored unsubscribe request because an active subscription with id \`${t}\` for '${r}' events could not be found.`)}_buildArgs(t,r,n,i){const s=r||this._commitment;if(s||n||i){let o={};n&&(o.encoding=n),s&&(o.commitment=s),i&&(o=Object.assign(o,i)),t.push(o)}return t}_buildArgsAtLeastConfirmed(t,r,n,i){const s=r||this._commitment;if(s&&!["confirmed","finalized"].includes(s))throw new Error("Using Connection with default commitment: `"+this._commitment+"`, but method requires at least `confirmed`");return this._buildArgs(t,r,n,i)}_wsOnSignatureNotification(t){const{result:r,subscription:n}=Be(t,GA);r.value!=="receivedSignature"&&this._subscriptionsAutoDisposedByRpc.add(n),this._handleServerNotification(n,r.value==="receivedSignature"?[{type:"received"},r.context]:[{type:"status",result:r.value},r.context])}onSignature(t,r,n){const i=this._buildArgs([t],n||this._commitment||"finalized"),s=this._makeSubscription({callback:(o,a)=>{if(o.type==="status"){r(o.result,a);try{this.removeSignatureListener(s)}catch{}}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},i);return s}onSignatureWithOptions(t,r,n){const{commitment:i,...s}={...n,commitment:n&&n.commitment||this._commitment||"finalized"},o=this._buildArgs([t],i,void 0,s),a=this._makeSubscription({callback:(c,u)=>{r(c,u);try{this.removeSignatureListener(a)}catch{}},method:"signatureSubscribe",unsubscribeMethod:"signatureUnsubscribe"},o);return a}async removeSignatureListener(t){await this._unsubscribeClientSubscription(t,"signature result")}_wsOnRootNotification(t){const{result:r,subscription:n}=Be(t,YA);this._handleServerNotification(n,[r])}onRootChange(t){return this._makeSubscription({callback:t,method:"rootSubscribe",unsubscribeMethod:"rootUnsubscribe"},[])}async removeRootChangeListener(t){await this._unsubscribeClientSubscription(t,"root change")}}Object.freeze({CreateLookupTable:{index:0,layout:Fe([qe("instruction"),Fo("recentSlot"),Ut("bumpSeed")])},FreezeLookupTable:{index:1,layout:Fe([qe("instruction")])},ExtendLookupTable:{index:2,layout:Fe([qe("instruction"),Fo(),en(St(),Zs(qe(),-8),"addresses")])},DeactivateLookupTable:{index:3,layout:Fe([qe("instruction")])},CloseLookupTable:{index:4,layout:Fe([qe("instruction")])}}),new et("AddressLookupTab1e1111111111111111111111111"),Object.freeze({RequestUnits:{index:0,layout:Fe([Ut("instruction"),qe("units"),qe("additionalFee")])},RequestHeapFrame:{index:1,layout:Fe([Ut("instruction"),qe("bytes")])},SetComputeUnitLimit:{index:2,layout:Fe([Ut("instruction"),qe("units")])},SetComputeUnitPrice:{index:3,layout:Fe([Ut("instruction"),Fo("microLamports")])}}),new et("ComputeBudget111111111111111111111111111111"),Fe([Ut("numSignatures"),Ut("padding"),jn("signatureOffset"),jn("signatureInstructionIndex"),jn("publicKeyOffset"),jn("publicKeyInstructionIndex"),jn("messageDataOffset"),jn("messageDataSize"),jn("messageInstructionIndex")]),new et("Ed25519SigVerify111111111111111111111111111"),ph.utils.isValidPrivateKey,ph.getPublicKey,Fe([Ut("numSignatures"),jn("signatureOffset"),Ut("signatureInstructionIndex"),jn("ethAddressOffset"),Ut("ethAddressInstructionIndex"),jn("messageDataOffset"),jn("messageDataSize"),Ut("messageInstructionIndex"),nr(20,"ethAddress"),nr(64,"signature"),Ut("recoveryId")]),new et("KeccakSecp256k11111111111111111111111111111");var $1;new et("StakeConfig11111111111111111111111111111111");class O1{constructor(t,r,n){this.unixTimestamp=void 0,this.epoch=void 0,this.custodian=void 0,this.unixTimestamp=t,this.epoch=r,this.custodian=n}}$1=O1,O1.default=new $1(0,0,et.default),Object.freeze({Initialize:{index:0,layout:Fe([qe("instruction"),H3(),j3()])},Authorize:{index:1,layout:Fe([qe("instruction"),St("newAuthorized"),qe("stakeAuthorizationType")])},Delegate:{index:2,layout:Fe([qe("instruction")])},Split:{index:3,layout:Fe([qe("instruction"),In("lamports")])},Withdraw:{index:4,layout:Fe([qe("instruction"),In("lamports")])},Deactivate:{index:5,layout:Fe([qe("instruction")])},Merge:{index:7,layout:Fe([qe("instruction")])},AuthorizeWithSeed:{index:8,layout:Fe([qe("instruction"),St("newAuthorized"),qe("stakeAuthorizationType"),Po("authoritySeed"),St("authorityOwner")])}}),Object.freeze({Staker:{index:0},Withdrawer:{index:1}}),new et("Stake11111111111111111111111111111111111111"),Object.freeze({InitializeAccount:{index:0,layout:Fe([qe("instruction"),z3()])},Authorize:{index:1,layout:Fe([qe("instruction"),St("newAuthorized"),qe("voteAuthorizationType")])},Withdraw:{index:3,layout:Fe([qe("instruction"),In("lamports")])},UpdateValidatorIdentity:{index:4,layout:Fe([qe("instruction")])},AuthorizeWithSeed:{index:10,layout:Fe([qe("instruction"),q3()])}}),Object.freeze({Voter:{index:0},Withdrawer:{index:1}}),new et("Vote111111111111111111111111111111111111111"),new et("Va1idator1nfo111111111111111111111111111111"),me({name:Se(),website:Qe(Se()),details:Qe(Se()),keybaseUsername:Qe(Se())}),new et("Vote111111111111111111111111111111111111111"),Fe([St("nodePubkey"),St("authorizedWithdrawer"),Ut("commission"),Gr(),en(Fe([Gr("slot"),qe("confirmationCount")]),Zs(qe(),-8),"votes"),Ut("rootSlotValid"),Gr("rootSlot"),Gr(),en(Fe([Gr("epoch"),St("authorizedVoter")]),Zs(qe(),-8),"authorizedVoters"),Fe([en(Fe([St("authorizedPubkey"),Gr("epochOfLastAuthorizedSwitch"),Gr("targetEpoch")]),32,"buf"),Gr("idx"),Ut("isEmpty")],"priorVoters"),Gr(),en(Fe([Gr("epoch"),Gr("credits"),Gr("prevCredits")]),Zs(qe(),-8),"epochCredits"),Fe([Gr("slot"),Gr("timestamp")],"lastTimestamp")]);const M1="solana:signAndSendTransaction",S6="solana:signIn",N1="solana:signMessage",P1="solana:signTransaction",A6="standard:connect",B6="standard:disconnect",I6="standard:events";var U1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},R6=(e,t,r)=>(U1(e,t,"read from private field"),r?r.call(e):t.get(e)),T6=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},k6=(e,t,r,n)=>(U1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),$f;function C6(e){const t=({register:r})=>r(e);try{window.dispatchEvent(new L6(t))}catch(r){console.error(`wallet-standard:register-wallet event could not be dispatched `,r)}try{window.addEventListener("wallet-standard:app-ready",({detail:r})=>t(r))}catch(r){console.error(`wallet-standard:app-ready event listener could not be added -`,r)}}class q6 extends Event{constructor(t){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),H6(this,Pf,void 0),j6(this,Pf,t)}get detail(){return D6(this,Pf)}get type(){return"wallet-standard:register-wallet"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}Pf=new WeakMap;function V6(e){z6(e.getInstanceWithAdapter())}const W6="solana:mainnet",kh=[W6];function Ch(e){return kh.includes(e)}function Uf(e){return"version"in e}var G1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},qo=(e,t,r)=>(G1(e,t,"read from private field"),r?r.call(e):t.get(e)),Vo=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Wo=(e,t,r,n)=>(G1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ff,Df,Hf,jf,zf,qf;const K6=kh,Z6=[V1,K1,W1],Y1=class{constructor({address:e,publicKey:t,label:r,icon:n}){Vo(this,Ff,void 0),Vo(this,Df,void 0),Vo(this,Hf,void 0),Vo(this,jf,void 0),Vo(this,zf,void 0),Vo(this,qf,void 0),new.target===Y1&&Object.freeze(this),Wo(this,Ff,e),Wo(this,Df,t),Wo(this,Hf,K6),Wo(this,jf,Z6),Wo(this,zf,r),Wo(this,qf,n)}get address(){return qo(this,Ff)}get publicKey(){return qo(this,Df).slice()}get chains(){return qo(this,Hf).slice()}get features(){return qo(this,jf).slice()}get label(){return qo(this,zf)}get icon(){return qo(this,qf)}};let G6=Y1;Ff=new WeakMap,Df=new WeakMap,Hf=new WeakMap,jf=new WeakMap,zf=new WeakMap,qf=new WeakMap;const Y6="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTgiIGhlaWdodD0iNjUiIHZpZXdCb3g9IjAgMCA1OCA2NSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgOS4zODk0OUwyOC44OTA3IDBWNjUuMDA0MkM4LjI1NDUgNTYuMzM2OSAwIDM5LjcyNDggMCAzMC4zMzUzVjkuMzg5NDlaIiBmaWxsPSIjMDUwMEZGIi8+CjxwYXRoIGQ9Ik01Ny43ODIyIDkuMzg5NDlMMjguODkxNSAwVjY1LjAwNDJDNDkuNTI3NyA1Ni4zMzY5IDU3Ljc4MjIgMzkuNzI0OCA1Ny43ODIyIDMwLjMzNTNWOS4zODk0OVoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8yMjAxXzY5NDIpIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMjIwMV82OTQyIiB4MT0iNTEuMzYxNSIgeTE9Ii00LjE1MjkzIiB4Mj0iMjkuNTM4NCIgeTI9IjY0LjUxNDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agb2Zmc2V0PSIwLjAyMTEyIiBzdG9wLWNvbG9yPSIjMDAwMEZGIi8+CjxzdG9wIG9mZnNldD0iMC4wNzYyNDIzIiBzdG9wLWNvbG9yPSIjMDA5NEZGIi8+CjxzdG9wIG9mZnNldD0iMC4xNjMwODkiIHN0b3AtY29sb3I9IiM0OEZGOTEiLz4KPHN0b3Agb2Zmc2V0PSIwLjQyMDA0OSIgc3RvcC1jb2xvcj0iIzAwOTRGRiIvPgo8c3RvcCBvZmZzZXQ9IjAuNjgyODg2IiBzdG9wLWNvbG9yPSIjMDAzOEZGIi8+CjxzdG9wIG9mZnNldD0iMC45MDI0NjUiIHN0b3AtY29sb3I9IiMwNTAwRkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K";function X6(e,t){return J6(e,t)}function J6(e,t){if(e===t)return!0;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{if(!t.has(e))throw TypeError("Cannot "+r)},nt=(e,t,r)=>(Lh(e,t,"read from private field"),r?r.call(e):t.get(e)),Dr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},$h=(e,t,r,n)=>(Lh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Oh=(e,t,r)=>(Lh(e,t,"access private method"),r),eo,Mh,Nh,Ph,on,hn,Uh,Vf,Fh,Dh,X1,Ko,Wf,Hh,jh,zh,Kf,qh,Zf,Vh;const Q6="trust:",J1=class{constructor(e){Dr(this,Vf),Dr(this,Dh),Dr(this,eo,{}),Dr(this,Mh,"1.0.0"),Dr(this,Nh,"Trust"),Dr(this,Ph,Y6),Dr(this,on,null),Dr(this,hn,void 0),Dr(this,Uh,(t,r)=>{var n;return(n=nt(this,eo)[t])!=null&&n.push(r)||(nt(this,eo)[t]=[r]),()=>Oh(this,Dh,X1).call(this,t,r)}),Dr(this,Ko,()=>{var t;const r=(t=nt(this,hn).publicKey)==null?void 0:t.toBase58();if(r){const n=nt(this,hn).publicKey.toBytes(),i=nt(this,on);(!i||i.address!==r||!X6(i.publicKey,n))&&($h(this,on,new G6({address:r,publicKey:n})),Oh(this,Vf,Fh).call(this,"change",{accounts:this.accounts}))}}),Dr(this,Wf,()=>{nt(this,on)&&($h(this,on,null),Oh(this,Vf,Fh).call(this,"change",{accounts:this.accounts}))}),Dr(this,Hh,()=>{nt(this,hn).publicKey?nt(this,Ko).call(this):nt(this,Wf).call(this)}),Dr(this,jh,async({silent:t}={})=>(nt(this,on)||await nt(this,hn).connect(t?{onlyIfTrusted:!0}:void 0),nt(this,Ko).call(this),{accounts:this.accounts})),Dr(this,zh,async()=>{await nt(this,hn).disconnect()}),Dr(this,Kf,async(...t)=>{if(!nt(this,on))throw new Error("not connected");const r=[];if(t.length===1){const{transaction:n,account:i,chain:s,options:o}=t[0],{minContextSlot:a,preflightCommitment:c,skipPreflight:u,maxRetries:l}=o||{};if(i!==nt(this,on))throw new Error("invalid account");if(!Ch(s))throw new Error("invalid chain");const{signature:y}=await nt(this,hn).signAndSendTransaction(Ka.deserialize(n),{preflightCommitment:c,minContextSlot:a,maxRetries:l,skipPreflight:u});r.push({signature:Ar.decode(y)})}else if(t.length>1)for(const n of t)r.push(...await nt(this,Kf).call(this,n));return r}),Dr(this,qh,async(...t)=>{if(!nt(this,on))throw new Error("not connected");const r=[];if(t.length===1){const{transaction:n,account:i,chain:s}=t[0];if(i!==nt(this,on))throw new Error("invalid account");if(s&&!Ch(s))throw new Error("invalid chain");const o=await nt(this,hn).signTransaction(Ka.deserialize(n)),a=Uf(o)?o.serialize():new Uint8Array(o.serialize({requireAllSignatures:!1,verifySignatures:!1}));r.push({signedTransaction:a})}else if(t.length>1){let n;for(const o of t){if(o.account!==nt(this,on))throw new Error("invalid account");if(o.chain){if(!Ch(o.chain))throw new Error("invalid chain");if(n){if(o.chain!==n)throw new Error("conflicting chain")}else n=o.chain}}const i=t.map(({transaction:o})=>Ka.deserialize(o)),s=await nt(this,hn).signAllTransactions(i);r.push(...s.map(o=>({signedTransaction:Uf(o)?o.serialize():new Uint8Array(o.serialize({requireAllSignatures:!1,verifySignatures:!1}))})))}return r}),Dr(this,Zf,async(...t)=>{if(!nt(this,on))throw new Error("not connected");const r=[];if(t.length===1){const{message:n,account:i}=t[0];if(i!==nt(this,on))throw new Error("invalid account");const{signature:s}=await nt(this,hn).signMessage(n);r.push({signedMessage:n,signature:s})}else if(t.length>1)for(const n of t)r.push(...await nt(this,Zf).call(this,n));return r}),Dr(this,Vh,async(...t)=>{const r=[];if(t.length>1)for(const n of t)r.push(await nt(this,hn).signIn(n));else return[await nt(this,hn).signIn(t[0])];return r}),new.target===J1&&Object.freeze(this),$h(this,hn,e),e.on("connect",nt(this,Ko),this),e.on("disconnect",nt(this,Wf),this),e.on("accountChanged",nt(this,Hh),this),nt(this,Ko).call(this)}get version(){return nt(this,Mh)}get name(){return nt(this,Nh)}get icon(){return nt(this,Ph)}get chains(){return kh.slice()}get features(){return{[P6]:{version:"1.0.0",connect:nt(this,jh)},[U6]:{version:"1.0.0",disconnect:nt(this,zh)},[F6]:{version:"1.0.0",on:nt(this,Uh)},[V1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:nt(this,Kf)},[K1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:nt(this,qh)},[W1]:{version:"1.0.0",signMessage:nt(this,Zf)},[N6]:{version:"1.0.0",signIn:nt(this,Vh)},[Q6]:{trust:nt(this,hn)}}}get accounts(){return nt(this,on)?[nt(this,on)]:[]}};let eB=J1;eo=new WeakMap,Mh=new WeakMap,Nh=new WeakMap,Ph=new WeakMap,on=new WeakMap,hn=new WeakMap,Uh=new WeakMap,Vf=new WeakSet,Fh=function(e,...t){var r;(r=nt(this,eo)[e])==null||r.forEach(n=>n.apply(null,t))},Dh=new WeakSet,X1=function(e,t){var r;nt(this,eo)[e]=(r=nt(this,eo)[e])==null?void 0:r.filter(n=>t!==n)},Ko=new WeakMap,Wf=new WeakMap,Hh=new WeakMap,jh=new WeakMap,zh=new WeakMap,Kf=new WeakMap,qh=new WeakMap,Zf=new WeakMap,Vh=new WeakMap;class tB{constructor(t,r=!1){this.useLegacySign=!1,this.provider=t,this.useLegacySign=r}async connect(t){const r=await this.provider.internalRequest({method:"requestAccounts",params:{options:t}});return this.provider.emit("connect"),{publicKey:new et(r[0])}}async signTransaction(t){if(this.useLegacySign)return await this.legacySign(t);const r=JSON.stringify(t);let n="legacy",i;Uf(t)?(n=t.version,i=ie.Buffer.from(t.message.serialize()).toString("base64")):i=ie.Buffer.from(t.serializeMessage()).toString("base64");const s=ie.Buffer.from(t.serialize({requireAllSignatures:!1,verifySignatures:!1})).toString("base64"),o=await this.provider.internalRequest({method:"signRawTransaction",params:{data:r,raw:s,rawMessage:i,version:n}});return this.provider.mapSignedTransaction(t,o)}async legacySign(t){const r=JSON.stringify(t),n=typeof t.version!="number"?"legacy":t.version,i=Ar.encode(n==="legacy"?t.serializeMessage():n===0?t.message.serialize():t.serialize());try{const s=await this.provider.internalRequest({method:"signRawTransaction",params:{data:r,raw:i,version:n}});return this.provider.mapSignedTransaction(t,s)}catch(s){console.log(`<== Error: ${s}`)}}async request(t,r){var n;switch(t.method){case"signTransaction":return this.signTransaction(t.params);case"connect":return this.connect((n=t?.params)==null?void 0:n.options)}return r()}}var Wh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Kh=(e,t,r)=>(Wh(e,t,"read from private field"),r?r.call(e):t.get(e)),Gf=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Zh=(e,t,r,n)=>(Wh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Yf=(e,t,r)=>(Wh(e,t,"access private method"),r),Xf,Jf,Qf,Zo,Xa;const eu=class extends Cl{constructor(e){super(),Gf(this,Zo),Gf(this,Xf,!1),Gf(this,Jf,!0),this.isTrust=!0,this.isTrustWallet=!0,Gf(this,Qf,!1),e&&(typeof e.enableAdapter<"u"&&Zh(this,Jf,e.enableAdapter),typeof e.cluster<"u"&&(this.connection=new M6(e.cluster,"confirmed")),typeof e.disableMobileAdapter<"u"&&Zh(this,Xf,e.disableMobileAdapter),typeof e.useLegacySign<"u"&&Zh(this,Qf,e.useLegacySign),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),Kh(this,Jf)&&V6(this),Kh(this,Xf)||(this.mobileAdapter=new tB(this,Kh(this,Qf)))}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}static messageToBuffer(e){let t=ie.Buffer.from([]);try{typeof e=="string"?t=ie.Buffer.from(e.replace("0x",""),"hex"):t=ie.Buffer.from(e)}catch(r){console.log(`messageToBuffer error: ${r}`)}return t}getInstanceWithAdapter(){return new eB(this)}async connect(e){const t=await Yf(this,Zo,Xa).call(this,{method:"connect",params:{options:e}});return this.publicKey=t.publicKey,t}disconnect(){return new Promise(e=>{this.publicKey=null,this.emit("disconnect"),e()})}async signAndSendTransaction(e,t){const r=await this.signTransaction(e);return{signature:await this.connection.sendRawTransaction(r.serialize(),t)}}signTransaction(e){return Yf(this,Zo,Xa).call(this,{method:"signTransaction",params:e})}signAllTransactions(e){return Promise.all(e.map(t=>this.signTransaction(t)))}async signRawTransactionMulti(e){return(await Yf(this,Zo,Xa).call(this,{method:"signRawTransactionMulti",params:{transactions:e.map(t=>{const r=JSON.stringify(t);let n="legacy",i;Uf(t)?(n=t.version,i=ie.Buffer.from(t.message.serialize()).toString("base64")):i=ie.Buffer.from(t.serializeMessage()).toString("base64");const s=ie.Buffer.from(t.serialize({requireAllSignatures:!1,verifySignatures:!1})).toString("base64");return{data:r,raw:s,rawMessage:i,version:n}})}})).map((t,r)=>this.mapSignedTransaction(e[r],t))}async signMessage(e){var t;const r=eu.bufferToHex(e),n=await Yf(this,Zo,Xa).call(this,{method:"signMessage",params:{data:r}});return{signature:ie.Buffer.from(eu.messageToBuffer(n).buffer),publicKey:(t=this.publicKey)==null?void 0:t.toBase58()}}signIn(e){throw new Error("Method not implemented.")}getNetwork(){return eu.NETWORK}mapSignedTransaction(e,t){return e.addSignature(this.publicKey,Ar.decode(t)),e}request(e){throw new Error("Not implemented")}internalRequest(e){return super.request(e)}};let Q1=eu;Xf=new WeakMap,Jf=new WeakMap,Qf=new WeakMap,Zo=new WeakSet,Xa=function(e){const t=()=>this.internalRequest(e);return this.mobileAdapter?this.mobileAdapter.request(e,t):t()},Q1.NETWORK="solana";var Go={},ls={},tu={},ru={},nu={},ey={},Yo={},iu={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.output=Hr.exists=Hr.hash=Hr.bytes=Hr.bool=Hr.number=void 0;function su(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}Hr.number=su;function ty(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}Hr.bool=ty;function rB(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Gh(e,...t){if(!rB(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}Hr.bytes=Gh;function ry(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");su(e.outputLen),su(e.blockLen)}Hr.hash=ry;function ny(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}Hr.exists=ny;function iy(e,t){Gh(e);const r=t.outputLen;if(e.lengthnew Uint8Array(z.buffer,z.byteOffset,z.byteLength);e.u8=r;const n=z=>new Uint32Array(z.buffer,z.byteOffset,Math.floor(z.byteLength/4));e.u32=n;function i(z){return z instanceof Uint8Array||z!=null&&typeof z=="object"&&z.constructor.name==="Uint8Array"}const s=z=>new DataView(z.buffer,z.byteOffset,z.byteLength);e.createView=s;const o=(z,ee)=>z<<32-ee|z>>>ee;if(e.rotr=o,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const a=Array.from({length:256},(z,ee)=>ee.toString(16).padStart(2,"0"));function c(z){if(!i(z))throw new Error("Uint8Array expected");let ee="";for(let se=0;se=u._0&&z<=u._9)return z-u._0;if(z>=u._A&&z<=u._F)return z-(u._A-10);if(z>=u._a&&z<=u._f)return z-(u._a-10)}function y(z){if(typeof z!="string")throw new Error("hex string expected, got "+typeof z);const ee=z.length,se=ee/2;if(ee%2)throw new Error("padded hex string expected, got unpadded hex of length "+ee);const Q=new Uint8Array(se);for(let I=0,g=0;I{};e.nextTick=A;async function v(z,ee,se){let Q=Date.now();for(let I=0;I=0&&gz().update(O(Q)).digest(),se=z();return ee.outputLen=se.outputLen,ee.blockLen=se.blockLen,ee.create=()=>z(),ee}e.wrapConstructor=$;function q(z){const ee=(Q,I)=>z(I).update(O(Q)).digest(),se=z({});return ee.outputLen=se.outputLen,ee.blockLen=se.blockLen,ee.create=Q=>z(Q),ee}e.wrapConstructorWithOpts=q;function G(z){const ee=(Q,I)=>z(I).update(O(Q)).digest(),se=z({});return ee.outputLen=se.outputLen,ee.blockLen=se.blockLen,ee.create=Q=>z(Q),ee}e.wrapXOFConstructorWithOpts=G;function Z(z=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(z));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=Z}(Ui),Object.defineProperty(iu,"__esModule",{value:!0}),iu.SHA2=void 0;const Yh=Hr,Ja=Ui;function iB(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,a,n)}class sB extends Ja.Hash{constructor(t,r,n,i){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,Ja.createView)(this.buffer)}update(t){(0,Yh.exists)(this);const{view:r,buffer:n,blockLen:i}=this;t=(0,Ja.toBytes)(t);const s=t.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let y=o;yl.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;ye&t^~e&r,cB=(e,t,r)=>e&t^e&r^t&r,fB=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),hs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ds=new Uint32Array(64);class sy extends oB.SHA2{constructor(){super(64,32,8,!1),this.A=hs[0]|0,this.B=hs[1]|0,this.C=hs[2]|0,this.D=hs[3]|0,this.E=hs[4]|0,this.F=hs[5]|0,this.G=hs[6]|0,this.H=hs[7]|0}get(){const{A:t,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[t,r,n,i,s,o,a,c]}set(t,r,n,i,s,o,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,r){for(let y=0;y<16;y++,r+=4)ds[y]=t.getUint32(r,!1);for(let y=16;y<64;y++){const A=ds[y-15],v=ds[y-2],R=(0,qn.rotr)(A,7)^(0,qn.rotr)(A,18)^A>>>3,O=(0,qn.rotr)(v,17)^(0,qn.rotr)(v,19)^v>>>10;ds[y]=O+ds[y-7]+R+ds[y-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let y=0;y<64;y++){const A=(0,qn.rotr)(a,6)^(0,qn.rotr)(a,11)^(0,qn.rotr)(a,25),v=l+A+aB(a,c,u)+fB[y]+ds[y]|0,O=((0,qn.rotr)(n,2)^(0,qn.rotr)(n,13)^(0,qn.rotr)(n,22))+cB(n,i,s)|0;l=u,u=c,c=a,a=o+v|0,o=s,s=i,i=n,n=v+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){ds.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class uB extends sy{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}Yo.sha256=(0,qn.wrapConstructor)(()=>new sy),Yo.sha224=(0,qn.wrapConstructor)(()=>new uB);var ht={},st={};Object.defineProperty(st,"__esModule",{value:!0}),st.validateObject=st.createHmacDrbg=st.bitMask=st.bitSet=st.bitGet=st.bitLen=st.utf8ToBytes=st.equalBytes=st.concatBytes=st.ensureBytes=st.numberToVarBytesBE=st.numberToBytesLE=st.numberToBytesBE=st.bytesToNumberLE=st.bytesToNumberBE=st.hexToBytes=st.hexToNumber=st.numberToHexUnpadded=st.bytesToHex=st.isBytes=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const oy=BigInt(0),au=BigInt(1),lB=BigInt(2);function Xo(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}st.isBytes=Xo;const hB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Xh(e){if(!Xo(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=Fi._0&&e<=Fi._9)return e-Fi._0;if(e>=Fi._A&&e<=Fi._F)return e-(Fi._A-10);if(e>=Fi._a&&e<=Fi._f)return e-(Fi._a-10)}function cu(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let i=0,s=0;ioy;e>>=au,t+=1);return t}st.bitLen=vB;function _B(e,t){return e>>BigInt(t)&au}st.bitGet=_B;const EB=(e,t,r)=>e|(r?au:oy)<(lB<new Uint8Array(e),ly=e=>Uint8Array.from(e);function SB(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Qh(e),i=Qh(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Qh())=>{i=a(ly([0]),y),n=a(),y.length!==0&&(i=a(ly([1]),y),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const A=[];for(;y{o(),c(y);let v;for(;!(v=A(u()));)c();return o(),v}}st.createHmacDrbg=SB;const AB={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Xo(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function BB(e,t,r={}){const n=(i,s,o)=>{const a=AB[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(t))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return e}st.validateObject=BB,Object.defineProperty(ht,"__esModule",{value:!0}),ht.mapHashToField=ht.getMinHashLength=ht.getFieldBytesLength=ht.hashToPrivateScalar=ht.FpSqrtEven=ht.FpSqrtOdd=ht.Field=ht.nLength=ht.FpIsSquare=ht.FpDiv=ht.FpInvertBatch=ht.FpPow=ht.validateField=ht.isNegativeLE=ht.FpSqrt=ht.tonelliShanks=ht.invert=ht.pow2=ht.pow=ht.mod=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Cn=st,jr=BigInt(0),Jt=BigInt(1),ps=BigInt(2),IB=BigInt(3),ed=BigInt(4),hy=BigInt(5),dy=BigInt(8);BigInt(9),BigInt(16);function Ln(e,t){const r=e%t;return r>=jr?r:t+r}ht.mod=Ln;function py(e,t,r){if(r<=jr||t 0");if(r===Jt)return jr;let n=Jt;for(;t>jr;)t&Jt&&(n=n*e%r),e=e*e%r,t>>=Jt;return n}ht.pow=py;function RB(e,t,r){let n=e;for(;t-- >jr;)n*=n,n%=r;return n}ht.pow2=RB;function fu(e,t){if(e===jr||t<=jr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Ln(e,t),n=t,i=jr,s=Jt;for(;r!==jr;){const a=n/r,c=n%r,u=i-s*a;n=r,r=c,i=s,s=u}if(n!==Jt)throw new Error("invert: does not exist");return Ln(i,t)}ht.invert=fu;function gy(e){const t=(e-Jt)/ps;let r,n,i;for(r=e-Jt,n=0;r%ps===jr;r/=ps,n++);for(i=ps;i(Ln(e,t)&Jt)===Jt;ht.isNegativeLE=TB;const kB=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function CB(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=kB.reduce((n,i)=>(n[i]="function",n),t);return(0,Cn.validateObject)(e,r)}ht.validateField=CB;function wy(e,t,r){if(r 0");if(r===jr)return e.ONE;if(r===Jt)return t;let n=e.ONE,i=t;for(;r>jr;)r&Jt&&(n=e.mul(n,i)),i=e.sqr(i),r>>=Jt;return n}ht.FpPow=wy;function my(e,t){const r=new Array(t.length),n=t.reduce((s,o,a)=>e.is0(o)?s:(r[a]=s,e.mul(s,o)),e.ONE),i=e.inv(n);return t.reduceRight((s,o,a)=>e.is0(o)?s:(r[a]=e.mul(s,r[a]),e.mul(s,o)),i),r}ht.FpInvertBatch=my;function LB(e,t,r){return e.mul(t,typeof r=="bigint"?fu(r,e.ORDER):e.inv(r))}ht.FpDiv=LB;function $B(e){const t=(e.ORDER-Jt)/ps;return r=>{const n=e.pow(r,t);return e.eql(n,e.ZERO)||e.eql(n,e.ONE)}}ht.FpIsSquare=$B;function td(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}ht.nLength=td;function OB(e,t,r=!1,n={}){if(e<=jr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=td(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=yy(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:s,MASK:(0,Cn.bitMask)(i),ZERO:jr,ONE:Jt,create:c=>Ln(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return jr<=c&&cc===jr,isOdd:c=>(c&Jt)===Jt,neg:c=>Ln(-c,e),eql:(c,u)=>c===u,sqr:c=>Ln(c*c,e),add:(c,u)=>Ln(c+u,e),sub:(c,u)=>Ln(c-u,e),mul:(c,u)=>Ln(c*u,e),pow:(c,u)=>wy(a,c,u),div:(c,u)=>Ln(c*fu(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>fu(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>my(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?(0,Cn.numberToBytesLE)(c,s):(0,Cn.numberToBytesBE)(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?(0,Cn.bytesToNumberLE)(c):(0,Cn.bytesToNumberBE)(c)}});return Object.freeze(a)}ht.Field=OB;function MB(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?r:e.neg(r)}ht.FpSqrtOdd=MB;function NB(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}ht.FpSqrtEven=NB;function PB(e,t,r=!1){e=(0,Cn.ensureBytes)("privateHash",e);const n=e.length,i=td(t).nByteLength+8;if(i<24||n1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${n}`);const s=r?(0,Cn.bytesToNumberLE)(e):(0,Cn.bytesToNumberBE)(e);return Ln(s,t-Jt)+Jt}ht.hashToPrivateScalar=PB;function rd(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}ht.getFieldBytesLength=rd;function by(e){const t=rd(e);return t+Math.ceil(t/2)}ht.getMinHashLength=by;function UB(e,t,r=!1){const n=e.length,i=rd(t),s=by(t);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?(0,Cn.bytesToNumberBE)(e):(0,Cn.bytesToNumberLE)(e),a=Ln(o,t-Jt)+Jt;return r?(0,Cn.numberToBytesLE)(a,i):(0,Cn.numberToBytesBE)(a,i)}ht.mapHashToField=UB;var nd={},Jo={};Object.defineProperty(Jo,"__esModule",{value:!0}),Jo.validateBasic=Jo.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const vy=ht,FB=st,DB=BigInt(0),id=BigInt(1);function HB(e,t){const r=(i,s)=>{const o=s.negate();return i?o:s},n=i=>{const s=Math.ceil(t/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=e.ZERO,a=i;for(;s>DB;)s&id&&(o=o.add(a)),a=a.double(),s>>=id;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=n(s),c=[];let u=i,l=u;for(let y=0;y>=v,P>c&&(P-=A,o+=id);const H=O,F=O+Math.abs(P)-1,N=R%2!==0,$=P<0;P===0?l=l.add(r(N,s[H])):u=u.add(r($,s[F]))}return{p:u,f:l}},wNAFCached(i,s,o,a){const c=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&s.set(i,a(u))),this.wNAF(c,u,o)}}}Jo.wNAF=HB;function jB(e){return(0,vy.validateField)(e.Fp),(0,FB.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,vy.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}Jo.validateBasic=jB,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapToCurveSimpleSWU=e.SWUFpSqrtRatio=e.weierstrass=e.weierstrassPoints=e.DER=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=ht,r=st,n=st,i=Jo;function s(F){const N=(0,i.validateBasic)(F);r.validateObject(N,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:$,Fp:q,a:G}=N;if($){if(!q.eql(G,q.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof $!="object"||typeof $.beta!="bigint"||typeof $.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...N})}const{bytesToNumberBE:o,hexToBytes:a}=r;e.DER={Err:class extends Error{constructor(N=""){super(N)}},_parseInt(F){const{Err:N}=e.DER;if(F.length<2||F[0]!==2)throw new N("Invalid signature integer tag");const $=F[1],q=F.subarray(2,$+2);if(!$||q.length!==$)throw new N("Invalid signature integer: wrong length");if(q[0]&128)throw new N("Invalid signature integer: negative");if(q[0]===0&&!(q[1]&128))throw new N("Invalid signature integer: unnecessary leading zero");return{d:o(q),l:F.subarray($+2)}},toSig(F){const{Err:N}=e.DER,$=typeof F=="string"?a(F):F;if(!r.isBytes($))throw new Error("ui8a expected");let q=$.length;if(q<2||$[0]!=48)throw new N("Invalid signature tag");if($[1]!==q-2)throw new N("Invalid signature: incorrect length");const{d:G,l:Z}=e.DER._parseInt($.subarray(2)),{d:z,l:ee}=e.DER._parseInt(Z);if(ee.length)throw new N("Invalid signature: left bytes after parsing");return{r:G,s:z}},hexFromSig(F){const N=Q=>Number.parseInt(Q[0],16)&8?"00"+Q:Q,$=Q=>{const I=Q.toString(16);return I.length&1?`0${I}`:I},q=N($(F.s)),G=N($(F.r)),Z=q.length/2,z=G.length/2,ee=$(Z),se=$(z);return`30${$(z+Z+4)}02${se}${G}02${ee}${q}`}};const c=BigInt(0),u=BigInt(1),l=BigInt(2),y=BigInt(3),A=BigInt(4);function v(F){const N=s(F),{Fp:$}=N,q=N.toBytes||((m,_,E)=>{const x=_.toAffine();return r.concatBytes(Uint8Array.from([4]),$.toBytes(x.x),$.toBytes(x.y))}),G=N.fromBytes||(m=>{const _=m.subarray(1),E=$.fromBytes(_.subarray(0,$.BYTES)),x=$.fromBytes(_.subarray($.BYTES,2*$.BYTES));return{x:E,y:x}});function Z(m){const{a:_,b:E}=N,x=$.sqr(m),T=$.mul(x,m);return $.add($.add(T,$.mul(m,_)),E)}if(!$.eql($.sqr(N.Gy),Z(N.Gx)))throw new Error("bad generator point: equation left != right");function z(m){return typeof m=="bigint"&&c$.eql(B,$.ZERO);return T(E)&&T(x)?g.ZERO:new g(E,x,$.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(_){const E=$.invertBatch(_.map(x=>x.pz));return _.map((x,T)=>x.toAffine(E[T])).map(g.fromAffine)}static fromHex(_){const E=g.fromAffine(G((0,n.ensureBytes)("pointHex",_)));return E.assertValidity(),E}static fromPrivateKey(_){return g.BASE.multiply(se(_))}_setWindowSize(_){this._WINDOW_SIZE=_,Q.delete(this)}assertValidity(){if(this.is0()){if(N.allowInfinityPoint&&!$.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:_,y:E}=this.toAffine();if(!$.isValid(_)||!$.isValid(E))throw new Error("bad point: x or y not FE");const x=$.sqr(E),T=Z(_);if(!$.eql(x,T))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:_}=this.toAffine();if($.isOdd)return!$.isOdd(_);throw new Error("Field doesn't support isOdd")}equals(_){I(_);const{px:E,py:x,pz:T}=this,{px:B,py:d,pz:k}=_,W=$.eql($.mul(E,k),$.mul(B,T)),K=$.eql($.mul(x,k),$.mul(d,T));return W&&K}negate(){return new g(this.px,$.neg(this.py),this.pz)}double(){const{a:_,b:E}=N,x=$.mul(E,y),{px:T,py:B,pz:d}=this;let k=$.ZERO,W=$.ZERO,K=$.ZERO,re=$.mul(T,T),xe=$.mul(B,B),be=$.mul(d,d),ge=$.mul(T,B);return ge=$.add(ge,ge),K=$.mul(T,d),K=$.add(K,K),k=$.mul(_,K),W=$.mul(x,be),W=$.add(k,W),k=$.sub(xe,W),W=$.add(xe,W),W=$.mul(k,W),k=$.mul(ge,k),K=$.mul(x,K),be=$.mul(_,be),ge=$.sub(re,be),ge=$.mul(_,ge),ge=$.add(ge,K),K=$.add(re,re),re=$.add(K,re),re=$.add(re,be),re=$.mul(re,ge),W=$.add(W,re),be=$.mul(B,d),be=$.add(be,be),re=$.mul(be,ge),k=$.sub(k,re),K=$.mul(be,xe),K=$.add(K,K),K=$.add(K,K),new g(k,W,K)}add(_){I(_);const{px:E,py:x,pz:T}=this,{px:B,py:d,pz:k}=_;let W=$.ZERO,K=$.ZERO,re=$.ZERO;const xe=N.a,be=$.mul(N.b,y);let ge=$.mul(E,B),tt=$.mul(x,d),Ue=$.mul(T,k),Pe=$.add(E,x),pe=$.add(B,d);Pe=$.mul(Pe,pe),pe=$.add(ge,tt),Pe=$.sub(Pe,pe),pe=$.add(E,T);let we=$.add(B,k);return pe=$.mul(pe,we),we=$.add(ge,Ue),pe=$.sub(pe,we),we=$.add(x,T),W=$.add(d,k),we=$.mul(we,W),W=$.add(tt,Ue),we=$.sub(we,W),re=$.mul(xe,pe),W=$.mul(be,Ue),re=$.add(W,re),W=$.sub(tt,re),re=$.add(tt,re),K=$.mul(W,re),tt=$.add(ge,ge),tt=$.add(tt,ge),Ue=$.mul(xe,Ue),pe=$.mul(be,pe),tt=$.add(tt,Ue),Ue=$.sub(ge,Ue),Ue=$.mul(xe,Ue),pe=$.add(pe,Ue),ge=$.mul(tt,pe),K=$.add(K,ge),ge=$.mul(we,pe),W=$.mul(Pe,W),W=$.sub(W,ge),ge=$.mul(Pe,tt),re=$.mul(we,re),re=$.add(re,ge),new g(W,K,re)}subtract(_){return this.add(_.negate())}is0(){return this.equals(g.ZERO)}wNAF(_){return h.wNAFCached(this,Q,_,E=>{const x=$.invertBatch(E.map(T=>T.pz));return E.map((T,B)=>T.toAffine(x[B])).map(g.fromAffine)})}multiplyUnsafe(_){const E=g.ZERO;if(_===c)return E;if(ee(_),_===u)return this;const{endo:x}=N;if(!x)return h.unsafeLadder(this,_);let{k1neg:T,k1:B,k2neg:d,k2:k}=x.splitScalar(_),W=E,K=E,re=this;for(;B>c||k>c;)B&u&&(W=W.add(re)),k&u&&(K=K.add(re)),re=re.double(),B>>=u,k>>=u;return T&&(W=W.negate()),d&&(K=K.negate()),K=new g($.mul(K.px,x.beta),K.py,K.pz),W.add(K)}multiply(_){ee(_);let E=_,x,T;const{endo:B}=N;if(B){const{k1neg:d,k1:k,k2neg:W,k2:K}=B.splitScalar(E);let{p:re,f:xe}=this.wNAF(k),{p:be,f:ge}=this.wNAF(K);re=h.constTimeNegate(d,re),be=h.constTimeNegate(W,be),be=new g($.mul(be.px,B.beta),be.py,be.pz),x=re.add(be),T=xe.add(ge)}else{const{p:d,f:k}=this.wNAF(E);x=d,T=k}return g.normalizeZ([x,T])[0]}multiplyAndAddUnsafe(_,E,x){const T=g.BASE,B=(k,W)=>W===c||W===u||!k.equals(T)?k.multiplyUnsafe(W):k.multiply(W),d=B(this,E).add(B(_,x));return d.is0()?void 0:d}toAffine(_){const{px:E,py:x,pz:T}=this,B=this.is0();_==null&&(_=B?$.ONE:$.inv(T));const d=$.mul(E,_),k=$.mul(x,_),W=$.mul(T,_);if(B)return{x:$.ZERO,y:$.ZERO};if(!$.eql(W,$.ONE))throw new Error("invZ was invalid");return{x:d,y:k}}isTorsionFree(){const{h:_,isTorsionFree:E}=N;if(_===u)return!0;if(E)return E(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:_,clearCofactor:E}=N;return _===u?this:E?E(g,this):this.multiplyUnsafe(N.h)}toRawBytes(_=!0){return this.assertValidity(),q(g,this,_)}toHex(_=!0){return r.bytesToHex(this.toRawBytes(_))}}g.BASE=new g(N.Gx,N.Gy,$.ONE),g.ZERO=new g($.ZERO,$.ONE,$.ZERO);const f=N.nBitLength,h=(0,i.wNAF)(g,N.endo?Math.ceil(f/2):f);return{CURVE:N,ProjectivePoint:g,normPrivateKeyToScalar:se,weierstrassEquation:Z,isWithinCurveOrder:z}}e.weierstrassPoints=v;function R(F){const N=(0,i.validateBasic)(F);return r.validateObject(N,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...N})}function O(F){const N=R(F),{Fp:$,n:q}=N,G=$.BYTES+1,Z=2*$.BYTES+1;function z(pe){return cr.bytesToHex(r.numberToBytesBE(pe,N.nByteLength));function m(pe){const we=q>>u;return pe>we}function _(pe){return m(pe)?ee(-pe):pe}const E=(pe,we,ke)=>r.bytesToNumberBE(pe.slice(we,ke));class x{constructor(we,ke,vt){this.r=we,this.s=ke,this.recovery=vt,this.assertValidity()}static fromCompact(we){const ke=N.nByteLength;return we=(0,n.ensureBytes)("compactSignature",we,ke*2),new x(E(we,0,ke),E(we,ke,2*ke))}static fromDER(we){const{r:ke,s:vt}=e.DER.toSig((0,n.ensureBytes)("DER",we));return new x(ke,vt)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(we){return new x(this.r,this.s,we)}recoverPublicKey(we){const{r:ke,s:vt,recovery:He}=this,it=K((0,n.ensureBytes)("msgHash",we));if(He==null||![0,1,2,3].includes(He))throw new Error("recovery id invalid");const Ht=He===2||He===3?ke+N.n:ke;if(Ht>=$.ORDER)throw new Error("recovery id 2 or 3 invalid");const ut=He&1?"03":"02",pt=Q.fromHex(ut+h(Ht)),Wt=se(Ht),xt=ee(-it*Wt),At=ee(vt*Wt),Xt=Q.BASE.multiplyAndAddUnsafe(pt,xt,At);if(!Xt)throw new Error("point at infinify");return Xt.assertValidity(),Xt}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,ee(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const T={isValidPrivateKey(pe){try{return I(pe),!0}catch{return!1}},normPrivateKeyToScalar:I,randomPrivateKey:()=>{const pe=t.getMinHashLength(N.n);return t.mapHashToField(N.randomBytes(pe),N.n)},precompute(pe=8,we=Q.BASE){return we._setWindowSize(pe),we.multiply(BigInt(3)),we}};function B(pe,we=!0){return Q.fromPrivateKey(pe).toRawBytes(we)}function d(pe){const we=r.isBytes(pe),ke=typeof pe=="string",vt=(we||ke)&&pe.length;return we?vt===G||vt===Z:ke?vt===2*G||vt===2*Z:pe instanceof Q}function k(pe,we,ke=!0){if(d(pe))throw new Error("first arg must be private key");if(!d(we))throw new Error("second arg must be public key");return Q.fromHex(we).multiply(I(pe)).toRawBytes(ke)}const W=N.bits2int||function(pe){const we=r.bytesToNumberBE(pe),ke=pe.length*8-N.nBitLength;return ke>0?we>>BigInt(ke):we},K=N.bits2int_modN||function(pe){return ee(W(pe))},re=r.bitMask(N.nBitLength);function xe(pe){if(typeof pe!="bigint")throw new Error("bigint expected");if(!(c<=pe&&peC in ke))throw new Error("sign() legacy options not supported");const{hash:vt,randomBytes:He}=N;let{lowS:it,prehash:Ht,extraEntropy:ut}=ke;it==null&&(it=!0),pe=(0,n.ensureBytes)("msgHash",pe),Ht&&(pe=(0,n.ensureBytes)("prehashed msgHash",vt(pe)));const pt=K(pe),Wt=I(we),xt=[xe(Wt),xe(pt)];if(ut!=null){const C=ut===!0?He($.BYTES):ut;xt.push((0,n.ensureBytes)("extraEntropy",C))}const At=r.concatBytes(...xt),Xt=pt;function Tt(C){const w=W(C);if(!f(w))return;const b=se(w),D=Q.BASE.multiply(w).toAffine(),V=ee(D.x);if(V===c)return;const X=ee(b*ee(Xt+V*Wt));if(X===c)return;let ae=(D.x===V?0:2)|Number(D.y&u),Ze=X;return it&&m(X)&&(Ze=_(X),ae^=1),new x(V,Ze,ae)}return{seed:At,k2sig:Tt}}const ge={lowS:N.lowS,prehash:!1},tt={lowS:N.lowS,prehash:!1};function Ue(pe,we,ke=ge){const{seed:vt,k2sig:He}=be(pe,we,ke),it=N;return r.createHmacDrbg(it.hash.outputLen,it.nByteLength,it.hmac)(vt,He)}Q.BASE._setWindowSize(8);function Pe(pe,we,ke,vt=tt){const He=pe;if(we=(0,n.ensureBytes)("msgHash",we),ke=(0,n.ensureBytes)("publicKey",ke),"strict"in vt)throw new Error("options.strict was renamed to lowS");const{lowS:it,prehash:Ht}=vt;let ut,pt;try{if(typeof He=="string"||r.isBytes(He))try{ut=x.fromDER(He)}catch(D){if(!(D instanceof e.DER.Err))throw D;ut=x.fromCompact(He)}else if(typeof He=="object"&&typeof He.r=="bigint"&&typeof He.s=="bigint"){const{r:D,s:V}=He;ut=new x(D,V)}else throw new Error("PARSE");pt=Q.fromHex(ke)}catch(D){if(D.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(it&&ut.hasHighS())return!1;Ht&&(we=N.hash(we));const{r:Wt,s:xt}=ut,At=K(we),Xt=se(xt),Tt=ee(At*Xt),C=ee(Wt*Xt),w=Q.BASE.multiplyAndAddUnsafe(pt,Tt,C)?.toAffine();return w?ee(w.x)===Wt:!1}return{CURVE:N,getPublicKey:B,getSharedSecret:k,sign:Ue,verify:Pe,ProjectivePoint:Q,Signature:x,utils:T}}e.weierstrass=O;function P(F,N){const $=F.ORDER;let q=c;for(let m=$-u;m%l===c;m/=l)q+=u;const G=q,Z=l<{let E=g,x=F.pow(_,Q),T=F.sqr(x);T=F.mul(T,_);let B=F.mul(m,T);B=F.pow(B,se),B=F.mul(B,x),x=F.mul(B,_),T=F.mul(B,m);let d=F.mul(T,x);B=F.pow(d,I);let k=F.eql(B,F.ONE);x=F.mul(T,f),B=F.mul(d,E),T=F.cmov(x,T,k),d=F.cmov(B,d,k);for(let W=G;W>u;W--){let K=W-l;K=l<{let T=F.sqr(x);const B=F.mul(E,x);T=F.mul(T,B);let d=F.pow(T,m);d=F.mul(d,B);const k=F.mul(d,_),W=F.mul(F.sqr(d),x),K=F.eql(W,E);let re=F.cmov(k,d,K);return{isValid:K,value:re}}}return h}e.SWUFpSqrtRatio=P;function H(F,N){if(t.validateField(F),!F.isValid(N.A)||!F.isValid(N.B)||!F.isValid(N.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const $=P(F,N.Z);if(!F.isOdd)throw new Error("Fp.isOdd is not implemented!");return q=>{let G,Z,z,ee,se,Q,I,g;G=F.sqr(q),G=F.mul(G,N.Z),Z=F.sqr(G),Z=F.add(Z,G),z=F.add(Z,F.ONE),z=F.mul(z,N.B),ee=F.cmov(N.Z,F.neg(Z),!F.eql(Z,F.ZERO)),ee=F.mul(ee,N.A),Z=F.sqr(z),Q=F.sqr(ee),se=F.mul(Q,N.A),Z=F.add(Z,se),Z=F.mul(Z,z),Q=F.mul(Q,ee),se=F.mul(Q,N.B),Z=F.add(Z,se),I=F.mul(G,z);const{isValid:f,value:h}=$(Z,Q);g=F.mul(G,q),g=F.mul(g,h),I=F.cmov(I,z,f),g=F.cmov(g,h,f);const m=F.isOdd(q)===F.isOdd(g);return g=F.cmov(F.neg(g),g,m),I=F.div(I,ee),{x:I,y:g}}}e.mapToCurveSimpleSWU=H}(nd);var Vn={};Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.createHasher=Vn.isogenyMap=Vn.hash_to_field=Vn.expand_message_xof=Vn.expand_message_xmd=void 0;const zB=ht,$n=st;function qB(e){if((0,$n.isBytes)(e))return e;if(typeof e=="string")return(0,$n.utf8ToBytes)(e);throw new Error("DST must be Uint8Array or string")}const VB=$n.bytesToNumberBE;function gs(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=e&255,e>>>=8;return new Uint8Array(r)}function WB(e,t){const r=new Uint8Array(e.length);for(let n=0;n255&&(t=n((0,$n.concatBytes)((0,$n.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:s}=n,o=Math.ceil(r/i);if(o>255)throw new Error("Invalid xmd length");const a=(0,$n.concatBytes)(t,gs(t.length,1)),c=gs(0,s),u=gs(r,2),l=new Array(o),y=n((0,$n.concatBytes)(c,e,u,gs(0,1),a));l[0]=n((0,$n.concatBytes)(y,gs(1,1),a));for(let v=1;v<=o;v++){const R=[WB(y,l[v-1]),gs(v+1,1),a];l[v]=n((0,$n.concatBytes)(...R))}return(0,$n.concatBytes)(...l).slice(0,r)}Vn.expand_message_xmd=_y;function Ey(e,t,r,n,i){if(Qa(e),Qa(t),sd(r),t.length>255){const s=Math.ceil(2*n/8);t=i.create({dkLen:s}).update((0,$n.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(e).update(gs(r,2)).update(t).update(gs(t.length,1)).digest()}Vn.expand_message_xof=Ey;function od(e,t,r){(0,$n.validateObject)(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:i,m:s,hash:o,expand:a,DST:c}=r;Qa(e),sd(t);const u=qB(c),l=n.toString(2).length,y=Math.ceil((l+i)/8),A=t*s*y;let v;if(a==="xmd")v=_y(e,u,A,o);else if(a==="xof")v=Ey(e,u,A,i,o);else if(a==="_internal_pass")v=e;else throw new Error('expand must be "xmd" or "xof"');const R=new Array(t);for(let O=0;OArray.from(n).reverse());return(n,i)=>{const[s,o,a,c]=r.map(u=>u.reduce((l,y)=>e.add(e.mul(l,n),y)));return n=e.div(s,o),i=e.mul(i,e.div(a,c)),{x:n,y:i}}}Vn.isogenyMap=KB;function ZB(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){const s=od(n,2,{...r,DST:r.DST,...i}),o=e.fromAffine(t(s[0])),a=e.fromAffine(t(s[1])),c=o.add(a).clearCofactor();return c.assertValidity(),c},encodeToCurve(n,i){const s=od(n,1,{...r,DST:r.encodeDST,...i}),o=e.fromAffine(t(s[0])).clearCofactor();return o.assertValidity(),o}}}Vn.createHasher=ZB;var Qo={},xy={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=Hr,r=Ui;class n extends r.Hash{constructor(o,a){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(o);const c=(0,r.toBytes)(a);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const u=this.blockLen,l=new Uint8Array(u);l.set(c.length>u?o.create().update(c).digest():c);for(let y=0;ynew n(s,o).update(a).digest();e.hmac=i,e.hmac.create=(s,o)=>new n(s,o)})(xy),Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.createCurve=Qo.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const GB=xy,Sy=Ui,YB=nd;function Ay(e){return{hash:e,hmac:(t,...r)=>(0,GB.hmac)(e,t,(0,Sy.concatBytes)(...r)),randomBytes:Sy.randomBytes}}Qo.getHash=Ay;function XB(e,t){const r=n=>(0,YB.weierstrass)({...e,...Ay(n)});return Object.freeze({...r(t),create:r})}Qo.createCurve=XB,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Yo,r=Ui,n=ht,i=nd,s=st,o=Vn,a=Qo,c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),u=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),y=BigInt(2),A=(x,T)=>(x+T/y)/T;function v(x){const T=c,B=BigInt(3),d=BigInt(6),k=BigInt(11),W=BigInt(22),K=BigInt(23),re=BigInt(44),xe=BigInt(88),be=x*x*x%T,ge=be*be*x%T,tt=(0,n.pow2)(ge,B,T)*ge%T,Ue=(0,n.pow2)(tt,B,T)*ge%T,Pe=(0,n.pow2)(Ue,y,T)*be%T,pe=(0,n.pow2)(Pe,k,T)*Pe%T,we=(0,n.pow2)(pe,W,T)*pe%T,ke=(0,n.pow2)(we,re,T)*we%T,vt=(0,n.pow2)(ke,xe,T)*ke%T,He=(0,n.pow2)(vt,re,T)*we%T,it=(0,n.pow2)(He,B,T)*ge%T,Ht=(0,n.pow2)(it,K,T)*pe%T,ut=(0,n.pow2)(Ht,d,T)*be%T,pt=(0,n.pow2)(ut,y,T);if(!R.eql(R.sqr(pt),x))throw new Error("Cannot find square root");return pt}const R=(0,n.Field)(c,void 0,void 0,{sqrt:v});e.secp256k1=(0,a.createCurve)({a:BigInt(0),b:BigInt(7),Fp:R,n:u,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:x=>{const T=u,B=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),d=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),k=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),W=B,K=BigInt("0x100000000000000000000000000000000"),re=A(W*x,T),xe=A(-d*x,T);let be=(0,n.mod)(x-re*B-xe*k,T),ge=(0,n.mod)(-re*d-xe*W,T);const tt=be>K,Ue=ge>K;if(tt&&(be=T-be),Ue&&(ge=T-ge),be>K||ge>K)throw new Error("splitScalar: Endomorphism failed, k="+x);return{k1neg:tt,k1:be,k2neg:Ue,k2:ge}}}},t.sha256);const O=BigInt(0),P=x=>typeof x=="bigint"&&Otypeof x=="bigint"&&Ok.charCodeAt(0)));B=(0,s.concatBytes)(d,d),F[x]=B}return(0,t.sha256)((0,s.concatBytes)(B,...T))}const $=x=>x.toRawBytes(!0).slice(1),q=x=>(0,s.numberToBytesBE)(x,32),G=x=>(0,n.mod)(x,c),Z=x=>(0,n.mod)(x,u),z=e.secp256k1.ProjectivePoint,ee=(x,T,B)=>z.BASE.multiplyAndAddUnsafe(x,T,B);function se(x){let T=e.secp256k1.utils.normPrivateKeyToScalar(x),B=z.fromPrivateKey(T);return{scalar:B.hasEvenY()?T:Z(-T),bytes:$(B)}}function Q(x){if(!P(x))throw new Error("bad x: need 0 < x < p");const T=G(x*x),B=G(T*x+BigInt(7));let d=v(B);d%y!==O&&(d=G(-d));const k=new z(x,d,l);return k.assertValidity(),k}function I(...x){return Z((0,s.bytesToNumberBE)(N("BIP0340/challenge",...x)))}function g(x){return se(x).bytes}function f(x,T,B=(0,r.randomBytes)(32)){const d=(0,s.ensureBytes)("message",x),{bytes:k,scalar:W}=se(T),K=(0,s.ensureBytes)("auxRand",B,32),re=q(W^(0,s.bytesToNumberBE)(N("BIP0340/aux",K))),xe=N("BIP0340/nonce",re,k,d),be=Z((0,s.bytesToNumberBE)(xe));if(be===O)throw new Error("sign failed: k is zero");const{bytes:ge,scalar:tt}=se(be),Ue=I(ge,k,d),Pe=new Uint8Array(64);if(Pe.set(ge,0),Pe.set(q(Z(tt+Ue*W)),32),!h(Pe,d,k))throw new Error("sign: Invalid signature produced");return Pe}function h(x,T,B){const d=(0,s.ensureBytes)("signature",x,64),k=(0,s.ensureBytes)("message",T),W=(0,s.ensureBytes)("publicKey",B,32);try{const K=Q((0,s.bytesToNumberBE)(W)),re=(0,s.bytesToNumberBE)(d.subarray(0,32));if(!P(re))return!1;const xe=(0,s.bytesToNumberBE)(d.subarray(32,64));if(!H(xe))return!1;const be=I(q(re),$(K),k),ge=ee(K,xe,Z(-be));return!(!ge||!ge.hasEvenY()||ge.toAffine().x!==re)}catch{return!1}}e.schnorr=(()=>({getPublicKey:g,sign:f,verify:h,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:Q,pointToBytes:$,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,taggedHash:N,mod:n.mod}}))();const m=(()=>(0,o.isogenyMap)(R,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(x=>x.map(T=>BigInt(T)))))(),_=(()=>(0,i.mapToCurveSimpleSWU)(R,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:R.create(BigInt("-11"))}))(),E=(()=>(0,o.createHasher)(e.secp256k1.ProjectivePoint,x=>{const{x:T,y:B}=_(R.create(x[0]));return m(T,B)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:R.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=(()=>E.hashToCurve)(),e.encodeToCurve=(()=>E.encodeToCurve)()}(ey),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=ey;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(nu),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=ie,r=nu;e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16}(ru);var uu={};Object.defineProperty(uu,"__esModule",{value:!0}),uu.GWEI_TO_WEI=void 0,uu.GWEI_TO_WEI=BigInt(1e9);var ad={},vi={};Object.defineProperty(vi,"__esModule",{value:!0}),vi.RLP=vi.utils=vi.decode=vi.encode=void 0;function cd(e){if(Array.isArray(e)){const r=[];let n=0;for(let i=0;ie.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function By(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return ky(Ty(e))}function Iy(e,t){if(e<56)return Uint8Array.from([e+t]);const r=ld(e),n=r.length/2,i=ld(t+55+n);return Uint8Array.from(lu(i+r))}function Ry(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);const r=$y(e),n=fd(r);if(t)return n;if(n.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return n.data}vi.decode=Ry;function fd(e){let t,r,n,i,s;const o=[],a=e[0];if(a<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(a<=183){if(t=a-127,a===128?n=Uint8Array.from([]):n=ea(e,1,t),t===2&&n[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:n,remainder:e.slice(t)}}else if(a<=191){if(r=a-182,e.length-1e.length)throw new Error("invalid RLP: total length is larger than the data");for(i=ea(e,r,c);i.length;)s=fd(i),o.push(s.data),i=s.remainder;return{data:o,remainder:e.slice(c)}}}const JB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ty(e){let t="";for(let r=0;rn+i.length,0),r=new Uint8Array(t);for(let n=0,i=0;n=2&&e[0]==="0"&&e[1]==="x"}function eI(e){return typeof e!="string"?e:Ly(e)?e.slice(2):e}function $y(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return Ly(e)?lu(QB(eI(e))):Cy(e);if(typeof e=="number"||typeof e=="bigint")return e?lu(ld(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}vi.utils={bytesToHex:Ty,concatBytes:ud,hexToBytes:lu,utf8ToBytes:Cy},vi.RLP={encode:cd,decode:Ry};var Wn={},Qt={},ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.add5L=ot.add5H=ot.add4H=ot.add4L=ot.add3H=ot.add3L=ot.add=ot.rotlBL=ot.rotlBH=ot.rotlSL=ot.rotlSH=ot.rotr32L=ot.rotr32H=ot.rotrBL=ot.rotrBH=ot.rotrSL=ot.rotrSH=ot.shrSL=ot.shrSH=ot.toBig=ot.split=ot.fromBig=void 0;const hu=BigInt(2**32-1),hd=BigInt(32);function dd(e,t=!1){return t?{h:Number(e&hu),l:Number(e>>hd&hu)}:{h:Number(e>>hd&hu)|0,l:Number(e&hu)|0}}ot.fromBig=dd;function Oy(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);ot.toBig=My;const Ny=(e,t,r)=>e>>>r;ot.shrSH=Ny;const Py=(e,t,r)=>e<<32-r|t>>>r;ot.shrSL=Py;const Uy=(e,t,r)=>e>>>r|t<<32-r;ot.rotrSH=Uy;const Fy=(e,t,r)=>e<<32-r|t>>>r;ot.rotrSL=Fy;const Dy=(e,t,r)=>e<<64-r|t>>>r-32;ot.rotrBH=Dy;const Hy=(e,t,r)=>e>>>r-32|t<<64-r;ot.rotrBL=Hy;const jy=(e,t)=>t;ot.rotr32H=jy;const zy=(e,t)=>e;ot.rotr32L=zy;const qy=(e,t,r)=>e<>>32-r;ot.rotlSH=qy;const Vy=(e,t,r)=>t<>>32-r;ot.rotlSL=Vy;const Wy=(e,t,r)=>t<>>64-r;ot.rotlBH=Wy;const Ky=(e,t,r)=>e<>>64-r;ot.rotlBL=Ky;function Zy(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}ot.add=Zy;const Gy=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);ot.add3L=Gy;const Yy=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;ot.add3H=Yy;const Xy=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);ot.add4L=Xy;const Jy=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;ot.add4H=Jy;const Qy=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ot.add5L=Qy;const ew=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;ot.add5H=ew;const tI={fromBig:dd,split:Oy,toBig:My,shrSH:Ny,shrSL:Py,rotrSH:Uy,rotrSL:Fy,rotrBH:Dy,rotrBL:Hy,rotr32H:jy,rotr32L:zy,rotlSH:qy,rotlSL:Vy,rotlBH:Wy,rotlBL:Ky,add:Zy,add3L:Gy,add3H:Yy,add4L:Xy,add4H:Jy,add5H:ew,add5L:Qy};ot.default=tI,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.shake256=Qt.shake128=Qt.keccak_512=Qt.keccak_384=Qt.keccak_256=Qt.keccak_224=Qt.sha3_512=Qt.sha3_384=Qt.sha3_256=Qt.sha3_224=Qt.Keccak=Qt.keccakP=void 0;const ta=Hr,ec=ot,tc=Ui,[tw,rw,nw]=[[],[],[]],rI=BigInt(0),rc=BigInt(1),nI=BigInt(2),iI=BigInt(7),sI=BigInt(256),oI=BigInt(113);for(let e=0,t=rc,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],tw.push(2*(5*n+r)),rw.push((e+1)*(e+2)/2%64);let i=rI;for(let s=0;s<7;s++)t=(t<>iI)*oI)%sI,t&nI&&(i^=rc<<(rc<r>32?(0,ec.rotlBH)(e,t,r):(0,ec.rotlSH)(e,t,r),sw=(e,t,r)=>r>32?(0,ec.rotlBL)(e,t,r):(0,ec.rotlSL)(e,t,r);function ow(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)r[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],y=iw(u,l,1)^r[a],A=sw(u,l,1)^r[a+1];for(let v=0;v<50;v+=10)e[o+v]^=y,e[o+v+1]^=A}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=rw[o],c=iw(i,s,a),u=sw(i,s,a),l=tw[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=aI[n],e[1]^=cI[n]}r.fill(0)}Qt.keccakP=ow;class nc extends tc.Hash{constructor(t,r,n,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,ta.number)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,tc.u32)(this.state)}keccak(){ow(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){(0,ta.exists)(this);const{blockLen:r,state:n}=this;t=(0,tc.toBytes)(t);const i=t.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,ta.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,ta.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new nc(r,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}Qt.Keccak=nc;const ys=(e,t,r)=>(0,tc.wrapConstructor)(()=>new nc(t,e,r));Qt.sha3_224=ys(6,144,224/8),Qt.sha3_256=ys(6,136,256/8),Qt.sha3_384=ys(6,104,384/8),Qt.sha3_512=ys(6,72,512/8),Qt.keccak_224=ys(1,144,224/8),Qt.keccak_256=ys(1,136,256/8),Qt.keccak_384=ys(1,104,384/8),Qt.keccak_512=ys(1,72,512/8);const aw=(e,t,r)=>(0,tc.wrapXOFConstructorWithOpts)((n={})=>new nc(t,e,n.dkLen===void 0?r:n.dkLen,!0));Qt.shake128=aw(31,168,128/8),Qt.shake256=aw(31,136,256/8);function pd(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var du={exports:{}};(function(e,t){var r=ft&&ft.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.wrapHash=t.equalsBytes=t.hexToBytes=t.bytesToUtf8=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0;const n=r(Hr),i=Ui,s=n.default.bool;t.assertBool=s;const o=n.default.bytes;t.assertBytes=o;var a=Ui;Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return a.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return a.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return a.utf8ToBytes}});function c(A){if(!(A instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof A}`);return new TextDecoder().decode(A)}t.bytesToUtf8=c;function u(A){const v=A.startsWith("0x")?A.substring(2):A;return(0,i.hexToBytes)(v)}t.hexToBytes=u;function l(A,v){if(A.length!==v.length)return!1;for(let R=0;R(n.default.bytes(v),A(v))}t.wrapHash=y,t.crypto=(()=>{const A=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,v=typeof pd=="function"&&pd.bind(e);return{node:v&&!A?v("crypto"):void 0,web:A}})()})(du,du.exports),Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.keccak512=Wn.keccak384=Wn.keccak256=Wn.keccak224=void 0;const ic=Qt,pu=du.exports;Wn.keccak224=(0,pu.wrapHash)(ic.keccak_224),Wn.keccak256=(()=>{const e=(0,pu.wrapHash)(ic.keccak_256);return e.create=ic.keccak_256.create,e})(),Wn.keccak384=(0,pu.wrapHash)(ic.keccak_384),Wn.keccak512=(0,pu.wrapHash)(ic.keccak_512);var to={},Kn={},er={};Object.defineProperty(er,"__esModule",{value:!0}),er.isHexString=er.getKeys=er.fromAscii=er.fromUtf8=er.toAscii=er.arrayContainsArray=er.getBinarySize=er.padToEven=er.stripHexPrefix=er.isHexPrefixed=void 0;function cw(e){if(typeof e!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof e}`);return e[0]==="0"&&e[1]==="x"}er.isHexPrefixed=cw;const fI=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return cw(e)?e.slice(2):e};er.stripHexPrefix=fI;function fw(e){let t=e;if(typeof t!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof t}`);return t.length%2&&(t=`0${t}`),t}er.padToEven=fw;function uI(e){if(typeof e!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof e}`);return ie.Buffer.byteLength(e,"utf8")}er.getBinarySize=uI;function lI(e,t,r){if(Array.isArray(e)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(Array.isArray(t)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[r===!0?"some":"every"](n=>e.indexOf(n)>=0)}er.arrayContainsArray=lI;function hI(e){let t="",r=0;const n=e.length;for(e.substring(0,2)==="0x"&&(r=2);r0&&e.length!==2+2*t)}er.isHexString=yI,Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.assertIsString=Kn.assertIsArray=Kn.assertIsBuffer=Kn.assertIsHexString=void 0;const wI=er,mI=function(e){if(!(0,wI.isHexString)(e)){const t=`This method only supports 0x-prefixed hex strings but input was: ${e}`;throw new Error(t)}};Kn.assertIsHexString=mI;const bI=function(e){if(!ie.Buffer.isBuffer(e)){const t=`This method only supports Buffer but input was: ${e}`;throw new Error(t)}};Kn.assertIsBuffer=bI;const vI=function(e){if(!Array.isArray(e)){const t=`This method only supports number arrays but input was: ${e}`;throw new Error(t)}};Kn.assertIsArray=vI;const _I=function(e){if(typeof e!="string"){const t=`This method only supports strings but input was: ${e}`;throw new Error(t)}};Kn.assertIsString=_I,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=Kn,r=er,n=function(f){if(!Number.isSafeInteger(f)||f<0)throw new Error(`Received an invalid integer type: ${f}`);return`0x${f.toString(16)}`};e.intToHex=n;const i=function(f){const h=(0,e.intToHex)(f);return ie.Buffer.from((0,r.padToEven)(h.slice(2)),"hex")};e.intToBuffer=i;const s=function(f){return ie.Buffer.allocUnsafe(f).fill(0)};e.zeros=s;const o=function(f,h,m){const _=(0,e.zeros)(h);return m?f.length0&&h.toString()==="0";)f=f.slice(1),h=f[0];return f},l=function(f){return(0,t.assertIsBuffer)(f),u(f)};e.unpadBuffer=l;const y=function(f){return(0,t.assertIsArray)(f),u(f)};e.unpadArray=y;const A=function(f){return(0,t.assertIsHexString)(f),f=(0,r.stripHexPrefix)(f),"0x"+u(f)};e.unpadHexString=A;const v=function(f){if(f==null)return ie.Buffer.allocUnsafe(0);if(ie.Buffer.isBuffer(f)||Array.isArray(f)||f instanceof Uint8Array)return ie.Buffer.from(f);if(typeof f=="string"){if(!(0,r.isHexString)(f))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${f}`);return ie.Buffer.from((0,r.padToEven)((0,r.stripHexPrefix)(f)),"hex")}if(typeof f=="number")return(0,e.intToBuffer)(f);if(typeof f=="bigint"){if(f0&&m[0]===0)throw new Error(`${h} cannot have leading zeroes, received: ${m.toString("hex")}`)};e.validateNoLeadingZeroes=z;function ee(f){return Array.isArray(f)?f.map(h=>ee(h)):ie.Buffer.from(f)}e.arrToBufArr=ee;function se(f){return Array.isArray(f)?f.map(h=>se(h)):Uint8Array.from(f??[])}e.bufArrToArr=se;const Q=f=>"0x"+f.toString(16);e.bigIntToHex=Q;function I(f){return(0,e.unpadBuffer)(P(f))}e.bigIntToUnpaddedBuffer=I;function g(f){return(0,e.unpadBuffer)((0,e.intToBuffer)(f))}e.intToUnpaddedBuffer=g}(to),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=vi,r=Wn,n=nu,i=du.exports,s=to,o=ru,a=Kn,c=er,u=BigInt(0);class l{constructor(g=u,f=u,h=o.KECCAK256_RLP,m=o.KECCAK256_NULL){this.nonce=g,this.balance=f,this.storageRoot=h,this.codeHash=m,this._validate()}static fromAccountData(g){const{nonce:f,balance:h,storageRoot:m,codeHash:_}=g;return new l(f!==void 0?(0,s.bufferToBigInt)((0,s.toBuffer)(f)):void 0,h!==void 0?(0,s.bufferToBigInt)((0,s.toBuffer)(h)):void 0,m!==void 0?(0,s.toBuffer)(m):void 0,_!==void 0?(0,s.toBuffer)(_):void 0)}static fromRlpSerializedAccount(g){const f=(0,s.arrToBufArr)(t.RLP.decode(Uint8Array.from(g)));if(!Array.isArray(f))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(f)}static fromValuesArray(g){const[f,h,m,_]=g;return new l((0,s.bufferToBigInt)(f),(0,s.bufferToBigInt)(h),m,_)}_validate(){if(this.nonce=8?E+=f[x].toUpperCase():E+=f[x];return E};e.toChecksumAddress=A;const v=function(I,g){return(0,e.isValidAddress)(I)&&(0,e.toChecksumAddress)(I,g)===I};e.isValidChecksumAddress=v;const R=function(I,g){return(0,a.assertIsBuffer)(I),(0,a.assertIsBuffer)(g),(0,s.bufferToBigInt)(g)===BigInt(0)?ie.Buffer.from((0,r.keccak256)(t.RLP.encode((0,s.bufArrToArr)([I,null])))).slice(-20):ie.Buffer.from((0,r.keccak256)(t.RLP.encode((0,s.bufArrToArr)([I,g])))).slice(-20)};e.generateAddress=R;const O=function(I,g,f){if((0,a.assertIsBuffer)(I),(0,a.assertIsBuffer)(g),(0,a.assertIsBuffer)(f),I.length!==20)throw new Error("Expected from to be of length 20");if(g.length!==32)throw new Error("Expected salt to be of length 32");const h=(0,r.keccak256)(ie.Buffer.concat([ie.Buffer.from("ff","hex"),I,g,(0,r.keccak256)(f)]));return(0,s.toBuffer)(h).slice(-20)};e.generateAddress2=O;const P=function(I){return n.secp256k1.utils.isValidPrivateKey(I)};e.isValidPrivate=P;const H=function(I,g=!1){if((0,a.assertIsBuffer)(I),I.length===64)try{return n.secp256k1.ProjectivePoint.fromHex(ie.Buffer.concat([ie.Buffer.from([4]),I])),!0}catch{return!1}if(!g)return!1;try{return n.secp256k1.ProjectivePoint.fromHex(I),!0}catch{return!1}};e.isValidPublic=H;const F=function(I,g=!1){if((0,a.assertIsBuffer)(I),g&&I.length!==64&&(I=ie.Buffer.from(n.secp256k1.ProjectivePoint.fromHex(I).toRawBytes(!1).slice(1))),I.length!==64)throw new Error("Expected pubKey to be of length 64");return ie.Buffer.from((0,r.keccak256)(I)).slice(-20)};e.pubToAddress=F,e.publicToAddress=e.pubToAddress;const N=function(I){return(0,a.assertIsBuffer)(I),ie.Buffer.from(n.secp256k1.ProjectivePoint.fromPrivateKey(I).toRawBytes(!1).slice(1))};e.privateToPublic=N;const $=function(I){return(0,e.publicToAddress)((0,e.privateToPublic)(I))};e.privateToAddress=$;const q=function(I){return(0,a.assertIsBuffer)(I),I.length!==64&&(I=ie.Buffer.from(n.secp256k1.ProjectivePoint.fromHex(I).toRawBytes(!1).slice(1))),I};e.importPublic=q;const G=function(){const g=(0,s.zeros)(20);return(0,s.bufferToHex)(g)};e.zeroAddress=G;const Z=function(I){try{(0,a.assertIsString)(I)}catch{return!1}return(0,e.zeroAddress)()===I};e.isZeroAddress=Z;function z(I){const[g,f,h,m]=I;return[g,f,(0,s.arrToBufArr)(h).length===0?o.KECCAK256_RLP:h,(0,s.arrToBufArr)(m).length===0?o.KECCAK256_NULL:m]}e.accountBodyFromSlim=z;const ee=new Uint8Array(0);function se(I){const[g,f,h,m]=I;return[g,f,(0,s.arrToBufArr)(h).equals(o.KECCAK256_RLP)?ee:h,(0,s.arrToBufArr)(m).equals(o.KECCAK256_NULL)?ee:m]}e.accountBodyToSlim=se;function Q(I,g=!0){const f=g?z(I):I;return(0,s.arrToBufArr)(t.RLP.encode(f))}e.accountBodyToRLP=Q}(ad);var sc={};Object.defineProperty(sc,"__esModule",{value:!0}),sc.Address=void 0;const oc=ad,gu=to;class Di{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new Di((0,gu.zeros)(20))}static fromString(t){if(!(0,oc.isValidAddress)(t))throw new Error("Invalid address");return new Di((0,gu.toBuffer)(t))}static fromPublicKey(t){if(!ie.Buffer.isBuffer(t))throw new Error("Public key should be Buffer");const r=(0,oc.pubToAddress)(t);return new Di(r)}static fromPrivateKey(t){if(!ie.Buffer.isBuffer(t))throw new Error("Private key should be Buffer");const r=(0,oc.privateToAddress)(t);return new Di(r)}static generate(t,r){if(typeof r!="bigint")throw new Error("Expected nonce to be a bigint");return new Di((0,oc.generateAddress)(t.buf,(0,gu.bigIntToBuffer)(r)))}static generate2(t,r,n){if(!ie.Buffer.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!ie.Buffer.isBuffer(n))throw new Error("Expected initCode to be a Buffer");return new Di((0,oc.generateAddress2)(t.buf,r,n))}equals(t){return this.buf.equals(t.buf)}isZero(){return this.equals(Di.zero())}isPrecompileOrSystemAddress(){const t=(0,gu.bufferToBigInt)(this.buf),r=BigInt(0),n=BigInt("0xffff");return t>=r&&t<=n}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return ie.Buffer.from(this.buf)}}sc.Address=Di;var yu={},gd={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=to,r=er;var n;(function(s){s[s.Number=0]="Number",s[s.BigInt=1]="BigInt",s[s.Buffer=2]="Buffer",s[s.PrefixedHexString=3]="PrefixedHexString"})(n=e.TypeOutput||(e.TypeOutput={}));function i(s,o){if(s===null)return null;if(s===void 0)return;if(typeof s=="string"&&!(0,r.isHexString)(s))throw new Error(`A string must be provided with a 0x-prefix, given: ${s}`);if(typeof s=="number"&&!Number.isSafeInteger(s))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const a=(0,t.toBuffer)(s);switch(o){case n.Buffer:return a;case n.BigInt:return(0,t.bufferToBigInt)(a);case n.Number:{const c=(0,t.bufferToBigInt)(a);if(c>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(c)}case n.PrefixedHexString:return(0,t.bufferToHex)(a);default:throw new Error("unknown outputType")}}e.toType=i})(gd),Object.defineProperty(yu,"__esModule",{value:!0}),yu.Withdrawal=void 0;const uw=sc,yd=to,br=gd;class ac{constructor(t,r,n,i){this.index=t,this.validatorIndex=r,this.address=n,this.amount=i}static fromWithdrawalData(t){const{index:r,validatorIndex:n,address:i,amount:s}=t,o=(0,br.toType)(r,br.TypeOutput.BigInt),a=(0,br.toType)(n,br.TypeOutput.BigInt),c=new uw.Address((0,br.toType)(i,br.TypeOutput.Buffer)),u=(0,br.toType)(s,br.TypeOutput.BigInt);return new ac(o,a,c,u)}static fromValuesArray(t){if(t.length!==4)throw Error(`Invalid withdrawalArray length expected=4 actual=${t.length}`);const[r,n,i,s]=t;return ac.fromWithdrawalData({index:r,validatorIndex:n,address:i,amount:s})}static toBufferArray(t){const{index:r,validatorIndex:n,address:i,amount:s}=t,o=(0,br.toType)(r,br.TypeOutput.BigInt)===BigInt(0)?ie.Buffer.alloc(0):(0,br.toType)(r,br.TypeOutput.Buffer),a=(0,br.toType)(n,br.TypeOutput.BigInt)===BigInt(0)?ie.Buffer.alloc(0):(0,br.toType)(n,br.TypeOutput.Buffer);let c;i instanceof uw.Address?c=i.buf:c=(0,br.toType)(i,br.TypeOutput.Buffer);const u=(0,br.toType)(s,br.TypeOutput.BigInt)===BigInt(0)?ie.Buffer.alloc(0):(0,br.toType)(s,br.TypeOutput.Buffer);return[o,a,c,u]}raw(){return ac.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,yd.bigIntToHex)(this.index),validatorIndex:(0,yd.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,yd.bigIntToHex)(this.amount)}}}yu.Withdrawal=ac;var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.hashPersonalMessage=an.isValidSignature=an.fromRpcSig=an.toCompactSig=an.toRpcSig=an.ecrecover=an.ecsign=void 0;const EI=Wn,lw=nu,bn=to,wd=ru,xI=Kn;function SI(e,t,r){const n=lw.secp256k1.sign(e,t),i=n.toCompactRawBytes(),s=ie.Buffer.from(i.slice(0,32)),o=ie.Buffer.from(i.slice(32,64)),a=r===void 0?BigInt(n.recovery+27):BigInt(n.recovery+35)+BigInt(r)*BigInt(2);return{r:s,s:o,v:a}}an.ecsign=SI;function wu(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function mu(e){return e===BigInt(0)||e===BigInt(1)}const AI=function(e,t,r,n,i){const s=ie.Buffer.concat([(0,bn.setLengthLeft)(r,32),(0,bn.setLengthLeft)(n,32)],64),o=wu(t,i);if(!mu(o))throw new Error("Invalid signature v value");const c=lw.secp256k1.Signature.fromCompact(s).addRecoveryBit(Number(o)).recoverPublicKey(e);return ie.Buffer.from(c.toRawBytes(!1).slice(1))};an.ecrecover=AI;const BI=function(e,t,r,n){const i=wu(e,n);if(!mu(i))throw new Error("Invalid signature v value");return(0,bn.bufferToHex)(ie.Buffer.concat([(0,bn.setLengthLeft)(t,32),(0,bn.setLengthLeft)(r,32),(0,bn.toBuffer)(e)]))};an.toRpcSig=BI;const II=function(e,t,r,n){const i=wu(e,n);if(!mu(i))throw new Error("Invalid signature v value");let s=r;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(s=ie.Buffer.from(r),s[0]|=128),(0,bn.bufferToHex)(ie.Buffer.concat([(0,bn.setLengthLeft)(t,32),(0,bn.setLengthLeft)(s,32)]))};an.toCompactSig=II;const RI=function(e){const t=(0,bn.toBuffer)(e);let r,n,i;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),i=(0,bn.bufferToBigInt)(t.slice(64));else if(t.length===64)r=t.slice(0,32),n=t.slice(32,64),i=BigInt((0,bn.bufferToInt)(t.slice(32,33))>>7),n[0]&=127;else throw new Error("Invalid signature length");return i<27&&(i=i+BigInt(27)),{v:i,r,s:n}};an.fromRpcSig=RI;const TI=function(e,t,r,n=!0,i){if(t.length!==32||r.length!==32||!mu(wu(e,i)))return!1;const s=(0,bn.bufferToBigInt)(t),o=(0,bn.bufferToBigInt)(r);return!(s===BigInt(0)||s>=wd.SECP256K1_ORDER||o===BigInt(0)||o>=wd.SECP256K1_ORDER||n&&o>=wd.SECP256K1_ORDER_DIV_2)};an.isValidSignature=TI;const kI=function(e){(0,xI.assertIsBuffer)(e);const t=ie.Buffer.from(`Ethereum Signed Message: -${e.length}`,"utf-8");return ie.Buffer.from((0,EI.keccak256)(ie.Buffer.concat([t,e])))};an.hashPersonalMessage=kI;var hw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;const t=o=>o.length>0&&o[o.length-1]===16;e.hasTerminator=t;const r=(o,a)=>{for(let c=0,u=0;u{let a=0;(0,e.hasTerminator)(o)&&(a=1,o=o.subarray(0,o.length-1));const c=new Uint8Array(o.length/2+1);return c[0]=a<<5,(o.length&1)===1&&(c[0]|=16,c[0]|=o[0],o=o.subarray(1)),(0,e.nibblesToBytes)(o,c.subarray(1)),c};e.nibblesToCompactBytes=n;const i=o=>{const a=o.length*2+1,c=new Uint8Array(a);for(let u=0;u{if(o.length===0)return o;let a=(0,e.bytesToNibbles)(o);a[0]<2&&(a=a.subarray(0,a.length-1));const c=2-(a[0]&1);return a.subarray(c)};e.compactBytesToNibbles=s})(hw);var bu={};Object.defineProperty(bu,"__esModule",{value:!0}),bu.AsyncEventEmitter=void 0;const CI=Dn.exports;async function LI(e,t,r){let n;for await(const i of t)try{i.length<2?i.call(e,r):await new Promise((s,o)=>{i.call(e,r,a=>{a?o(a):s()})})}catch(s){n=s}if(n)throw n}class $I extends CI.EventEmitter{emit(t,...r){let[n,i]=r;const s=this;let o=s._events[t]??[];return i===void 0&&typeof n=="function"&&(i=n,n=void 0),(t==="newListener"||t==="removeListener")&&(n={event:n,fn:i},i=void 0),o=Array.isArray(o)?o:[o],LI(s,o.slice(),n).then(i).catch(i),s.listenerCount(t)>0}once(t,r){const n=this;let i;if(typeof r!="function")throw new TypeError("listener must be a function");return r.length>=2?i=function(s,o){n.removeListener(t,i),r(s,o)}:i=function(s){n.removeListener(t,i),r(s,i)},n.on(t,i),n}first(t,r){let n=this._events[t]??[];if(typeof r!="function")throw new TypeError("listener must be a function");return Array.isArray(n)||(this._events[t]=n=[n]),n.unshift(r),this}before(t,r,n){return this.beforeOrAfter(t,r,n)}after(t,r,n){return this.beforeOrAfter(t,r,n,"after")}beforeOrAfter(t,r,n,i){let s=this._events[t]??[],o,a;const c=i==="after"?1:0;if(typeof n!="function")throw new TypeError("listener must be a function");if(typeof r!="function")throw new TypeError("target must be a function");for(Array.isArray(s)||(this._events[t]=s=[s]),a=s.length,o=s.length;o--;)if(s[o]===r){a=o+c;break}return s.splice(a,0,n),this}on(t,r){return super.on(t,r)}addListener(t,r){return super.addListener(t,r)}prependListener(t,r){return super.prependListener(t,r)}prependOnceListener(t,r){return super.prependOnceListener(t,r)}removeAllListeners(t){return super.removeAllListeners(t)}removeListener(t,r){return super.removeListener(t,r)}eventNames(){return super.eventNames()}listeners(t){return super.listeners(t)}listenerCount(t){return super.listenerCount(t)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(t){return super.setMaxListeners(t)}}bu.AsyncEventEmitter=$I;var vu={};Object.defineProperty(vu,"__esModule",{value:!0}),vu.Lock=void 0;class OI{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise(t=>this.promiseResolverQueue.push(t))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(this.permits===1&&this.promiseResolverQueue.length>0){this.permits-=1;const t=this.promiseResolverQueue.shift();t&&t(!0)}}}vu.Lock=OI;var ra={},ro={},pr=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},_i=[],Zn=[],MI=typeof Uint8Array<"u"?Uint8Array:Array,md=!1;function dw(){md=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t0)throw new Error("Invalid string. Length must be a multiple of 4");s=e[a-2]==="="?2:e[a-1]==="="?1:0,o=new MI(a*3/4-s),n=s>0?a-4:a;var c=0;for(t=0,r=0;t>16&255,o[c++]=i>>8&255,o[c++]=i&255;return s===2?(i=Zn[e.charCodeAt(t)]<<2|Zn[e.charCodeAt(t+1)]>>4,o[c++]=i&255):s===1&&(i=Zn[e.charCodeAt(t)]<<10|Zn[e.charCodeAt(t+1)]<<4|Zn[e.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=i&255),o}function PI(e){return _i[e>>18&63]+_i[e>>12&63]+_i[e>>6&63]+_i[e&63]}function UI(e,t,r){for(var n,i=[],s=t;sc?c:a+o));return n===1?(t=e[r-1],i+=_i[t>>2],i+=_i[t<<4&63],i+="=="):n===2&&(t=(e[r-2]<<8)+e[r-1],i+=_i[t>>10],i+=_i[t>>4&63],i+=_i[t<<2&63],i+="="),s.push(i),s.join("")}function _u(e,t,r,n,i){var s,o,a=i*8-n-1,c=(1<>1,l=-7,y=r?i-1:0,A=r?-1:1,v=e[t+y];for(y+=A,s=v&(1<<-l)-1,v>>=-l,l+=a;l>0;s=s*256+e[t+y],y+=A,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+e[t+y],y+=A,l-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(v?-1:1)*o*Math.pow(2,s-n)}function gw(e,t,r,n,i,s){var o,a,c,u=s*8-i-1,l=(1<>1,A=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,R=n?1:-1,O=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+y>=1?t+=A/c:t+=A*Math.pow(2,1-y),t*c>=2&&(o++,c/=2),o+y>=l?(a=0,o=l):o+y>=1?(a=(t*c-1)*Math.pow(2,i),o=o+y):(a=t*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;e[r+v]=a&255,v+=R,a/=256,i-=8);for(o=o<0;e[r+v]=o&255,v+=R,o/=256,u-=8);e[r+v-R]|=O*128}var FI={}.toString,yw=Array.isArray||function(e){return FI.call(e)=="[object Array]"};/*! +`,r)}}class L6 extends Event{constructor(t){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),T6(this,$f,void 0),k6(this,$f,t)}get detail(){return R6(this,$f)}get type(){return"wallet-standard:register-wallet"}preventDefault(){throw new Error("preventDefault cannot be called")}stopImmediatePropagation(){throw new Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw new Error("stopPropagation cannot be called")}}$f=new WeakMap;function $6(e){C6(e.getInstanceWithAdapter())}const O6="solana:mainnet",Bh=[O6];function Ih(e){return Bh.includes(e)}function Of(e){return"version"in e}var F1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ho=(e,t,r)=>(F1(e,t,"read from private field"),r?r.call(e):t.get(e)),jo=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},zo=(e,t,r,n)=>(F1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Mf,Nf,Pf,Uf,Ff,Df;const M6=Bh,N6=[M1,P1,N1],D1=class{constructor({address:e,publicKey:t,label:r,icon:n}){jo(this,Mf,void 0),jo(this,Nf,void 0),jo(this,Pf,void 0),jo(this,Uf,void 0),jo(this,Ff,void 0),jo(this,Df,void 0),new.target===D1&&Object.freeze(this),zo(this,Mf,e),zo(this,Nf,t),zo(this,Pf,M6),zo(this,Uf,N6),zo(this,Ff,r),zo(this,Df,n)}get address(){return Ho(this,Mf)}get publicKey(){return Ho(this,Nf).slice()}get chains(){return Ho(this,Pf).slice()}get features(){return Ho(this,Uf).slice()}get label(){return Ho(this,Ff)}get icon(){return Ho(this,Df)}};let P6=D1;Mf=new WeakMap,Nf=new WeakMap,Pf=new WeakMap,Uf=new WeakMap,Ff=new WeakMap,Df=new WeakMap;const U6="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTgiIGhlaWdodD0iNjUiIHZpZXdCb3g9IjAgMCA1OCA2NSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgOS4zODk0OUwyOC44OTA3IDBWNjUuMDA0MkM4LjI1NDUgNTYuMzM2OSAwIDM5LjcyNDggMCAzMC4zMzUzVjkuMzg5NDlaIiBmaWxsPSIjMDUwMEZGIi8+CjxwYXRoIGQ9Ik01Ny43ODIyIDkuMzg5NDlMMjguODkxNSAwVjY1LjAwNDJDNDkuNTI3NyA1Ni4zMzY5IDU3Ljc4MjIgMzkuNzI0OCA1Ny43ODIyIDMwLjMzNTNWOS4zODk0OVoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8yMjAxXzY5NDIpIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMjIwMV82OTQyIiB4MT0iNTEuMzYxNSIgeTE9Ii00LjE1MjkzIiB4Mj0iMjkuNTM4NCIgeTI9IjY0LjUxNDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agb2Zmc2V0PSIwLjAyMTEyIiBzdG9wLWNvbG9yPSIjMDAwMEZGIi8+CjxzdG9wIG9mZnNldD0iMC4wNzYyNDIzIiBzdG9wLWNvbG9yPSIjMDA5NEZGIi8+CjxzdG9wIG9mZnNldD0iMC4xNjMwODkiIHN0b3AtY29sb3I9IiM0OEZGOTEiLz4KPHN0b3Agb2Zmc2V0PSIwLjQyMDA0OSIgc3RvcC1jb2xvcj0iIzAwOTRGRiIvPgo8c3RvcCBvZmZzZXQ9IjAuNjgyODg2IiBzdG9wLWNvbG9yPSIjMDAzOEZGIi8+CjxzdG9wIG9mZnNldD0iMC45MDI0NjUiIHN0b3AtY29sb3I9IiMwNTAwRkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K";function F6(e,t){return D6(e,t)}function D6(e,t){if(e===t)return!0;const r=e.length;if(r!==t.length)return!1;for(let n=0;n{if(!t.has(e))throw TypeError("Cannot "+r)},nt=(e,t,r)=>(Rh(e,t,"read from private field"),r?r.call(e):t.get(e)),Dr=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Th=(e,t,r,n)=>(Rh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),kh=(e,t,r)=>(Rh(e,t,"access private method"),r),Qs,Ch,Lh,$h,on,hn,Oh,Hf,Mh,Nh,H1,qo,jf,Ph,Uh,Fh,zf,Dh,qf,Hh;const H6="trust:",j1=class{constructor(e){Dr(this,Hf),Dr(this,Nh),Dr(this,Qs,{}),Dr(this,Ch,"1.0.0"),Dr(this,Lh,"Trust"),Dr(this,$h,U6),Dr(this,on,null),Dr(this,hn,void 0),Dr(this,Oh,(t,r)=>{var n;return(n=nt(this,Qs)[t])!=null&&n.push(r)||(nt(this,Qs)[t]=[r]),()=>kh(this,Nh,H1).call(this,t,r)}),Dr(this,qo,()=>{var t;const r=(t=nt(this,hn).publicKey)==null?void 0:t.toBase58();if(r){const n=nt(this,hn).publicKey.toBytes(),i=nt(this,on);(!i||i.address!==r||!F6(i.publicKey,n))&&(Th(this,on,new P6({address:r,publicKey:n})),kh(this,Hf,Mh).call(this,"change",{accounts:this.accounts}))}}),Dr(this,jf,()=>{nt(this,on)&&(Th(this,on,null),kh(this,Hf,Mh).call(this,"change",{accounts:this.accounts}))}),Dr(this,Ph,()=>{nt(this,hn).publicKey?nt(this,qo).call(this):nt(this,jf).call(this)}),Dr(this,Uh,async({silent:t}={})=>(nt(this,on)||await nt(this,hn).connect(t?{onlyIfTrusted:!0}:void 0),nt(this,qo).call(this),{accounts:this.accounts})),Dr(this,Fh,async()=>{await nt(this,hn).disconnect()}),Dr(this,zf,async(...t)=>{if(!nt(this,on))throw new Error("not connected");const r=[];if(t.length===1){const{transaction:n,account:i,chain:s,options:o}=t[0],{minContextSlot:a,preflightCommitment:c,skipPreflight:u,maxRetries:l}=o||{};if(i!==nt(this,on))throw new Error("invalid account");if(!Ih(s))throw new Error("invalid chain");const{signature:y}=await nt(this,hn).signAndSendTransaction(qa.deserialize(n),{preflightCommitment:c,minContextSlot:a,maxRetries:l,skipPreflight:u});r.push({signature:Ar.decode(y)})}else if(t.length>1)for(const n of t)r.push(...await nt(this,zf).call(this,n));return r}),Dr(this,Dh,async(...t)=>{if(!nt(this,on))throw new Error("not connected");const r=[];if(t.length===1){const{transaction:n,account:i,chain:s}=t[0];if(i!==nt(this,on))throw new Error("invalid account");if(s&&!Ih(s))throw new Error("invalid chain");const o=await nt(this,hn).signTransaction(qa.deserialize(n)),a=Of(o)?o.serialize():new Uint8Array(o.serialize({requireAllSignatures:!1,verifySignatures:!1}));r.push({signedTransaction:a})}else if(t.length>1){let n;for(const o of t){if(o.account!==nt(this,on))throw new Error("invalid account");if(o.chain){if(!Ih(o.chain))throw new Error("invalid chain");if(n){if(o.chain!==n)throw new Error("conflicting chain")}else n=o.chain}}const i=t.map(({transaction:o})=>qa.deserialize(o)),s=await nt(this,hn).signAllTransactions(i);r.push(...s.map(o=>({signedTransaction:Of(o)?o.serialize():new Uint8Array(o.serialize({requireAllSignatures:!1,verifySignatures:!1}))})))}return r}),Dr(this,qf,async(...t)=>{if(!nt(this,on))throw new Error("not connected");const r=[];if(t.length===1){const{message:n,account:i}=t[0];if(i!==nt(this,on))throw new Error("invalid account");const{signature:s}=await nt(this,hn).signMessage(n);r.push({signedMessage:n,signature:s})}else if(t.length>1)for(const n of t)r.push(...await nt(this,qf).call(this,n));return r}),Dr(this,Hh,async(...t)=>{const r=[];if(t.length>1)for(const n of t)r.push(await nt(this,hn).signIn(n));else return[await nt(this,hn).signIn(t[0])];return r}),new.target===j1&&Object.freeze(this),Th(this,hn,e),e.on("connect",nt(this,qo),this),e.on("disconnect",nt(this,jf),this),e.on("accountChanged",nt(this,Ph),this),nt(this,qo).call(this)}get version(){return nt(this,Ch)}get name(){return nt(this,Lh)}get icon(){return nt(this,$h)}get chains(){return Bh.slice()}get features(){return{[A6]:{version:"1.0.0",connect:nt(this,Uh)},[B6]:{version:"1.0.0",disconnect:nt(this,Fh)},[I6]:{version:"1.0.0",on:nt(this,Oh)},[M1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:nt(this,zf)},[P1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:nt(this,Dh)},[N1]:{version:"1.0.0",signMessage:nt(this,qf)},[S6]:{version:"1.0.0",signIn:nt(this,Hh)},[H6]:{trust:nt(this,hn)}}}get accounts(){return nt(this,on)?[nt(this,on)]:[]}};let j6=j1;Qs=new WeakMap,Ch=new WeakMap,Lh=new WeakMap,$h=new WeakMap,on=new WeakMap,hn=new WeakMap,Oh=new WeakMap,Hf=new WeakSet,Mh=function(e,...t){var r;(r=nt(this,Qs)[e])==null||r.forEach(n=>n.apply(null,t))},Nh=new WeakSet,H1=function(e,t){var r;nt(this,Qs)[e]=(r=nt(this,Qs)[e])==null?void 0:r.filter(n=>t!==n)},qo=new WeakMap,jf=new WeakMap,Ph=new WeakMap,Uh=new WeakMap,Fh=new WeakMap,zf=new WeakMap,Dh=new WeakMap,qf=new WeakMap,Hh=new WeakMap;class z6{constructor(t,r=!1){this.useLegacySign=!1,this.provider=t,this.useLegacySign=r}async connect(t){const r=await this.provider.internalRequest({method:"requestAccounts",params:{options:t}});return this.provider.emit("connect"),{publicKey:new et(r[0])}}async signTransaction(t){if(this.useLegacySign)return await this.legacySign(t);const r=JSON.stringify(t);let n="legacy",i;Of(t)?(n=t.version,i=ie.Buffer.from(t.message.serialize()).toString("base64")):i=ie.Buffer.from(t.serializeMessage()).toString("base64");const s=ie.Buffer.from(t.serialize({requireAllSignatures:!1,verifySignatures:!1})).toString("base64"),o=await this.provider.internalRequest({method:"signRawTransaction",params:{data:r,raw:s,rawMessage:i,version:n}});return this.provider.mapSignedTransaction(t,o)}async legacySign(t){const r=JSON.stringify(t),n=typeof t.version!="number"?"legacy":t.version,i=Ar.encode(n==="legacy"?t.serializeMessage():n===0?t.message.serialize():t.serialize());try{const s=await this.provider.internalRequest({method:"signRawTransaction",params:{data:r,raw:i,version:n}});return this.provider.mapSignedTransaction(t,s)}catch(s){console.log(`<== Error: ${s}`)}}async request(t,r){var n;switch(t.method){case"signTransaction":return this.signTransaction(t.params);case"connect":return this.connect((n=t?.params)==null?void 0:n.options)}return r()}}var jh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},zh=(e,t,r)=>(jh(e,t,"read from private field"),r?r.call(e):t.get(e)),Vf=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},qh=(e,t,r,n)=>(jh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Wf=(e,t,r)=>(jh(e,t,"access private method"),r),Kf,Zf,Gf,Vo,Za;const Yf=class extends Il{constructor(e){super(),Vf(this,Vo),Vf(this,Kf,!1),Vf(this,Zf,!0),this.isTrust=!0,this.isTrustWallet=!0,Vf(this,Gf,!1),e&&(typeof e.enableAdapter<"u"&&qh(this,Zf,e.enableAdapter),typeof e.cluster<"u"&&(this.connection=new x6(e.cluster,"confirmed")),typeof e.disableMobileAdapter<"u"&&qh(this,Kf,e.disableMobileAdapter),typeof e.useLegacySign<"u"&&qh(this,Gf,e.useLegacySign),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),zh(this,Zf)&&$6(this),zh(this,Kf)||(this.mobileAdapter=new z6(this,zh(this,Gf)))}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}static messageToBuffer(e){let t=ie.Buffer.from([]);try{typeof e=="string"?t=ie.Buffer.from(e.replace("0x",""),"hex"):t=ie.Buffer.from(e)}catch(r){console.log(`messageToBuffer error: ${r}`)}return t}getInstanceWithAdapter(){return new j6(this)}async connect(e){const t=await Wf(this,Vo,Za).call(this,{method:"connect",params:{options:e}});return this.publicKey=t.publicKey,t}disconnect(){return new Promise(e=>{this.publicKey=null,this.emit("disconnect"),e()})}async signAndSendTransaction(e,t){const r=await this.signTransaction(e);return{signature:await this.connection.sendRawTransaction(r.serialize(),t)}}signTransaction(e){return Wf(this,Vo,Za).call(this,{method:"signTransaction",params:e})}signAllTransactions(e){return Promise.all(e.map(t=>this.signTransaction(t)))}async signRawTransactionMulti(e){return(await Wf(this,Vo,Za).call(this,{method:"signRawTransactionMulti",params:{transactions:e.map(t=>{const r=JSON.stringify(t);let n="legacy",i;Of(t)?(n=t.version,i=ie.Buffer.from(t.message.serialize()).toString("base64")):i=ie.Buffer.from(t.serializeMessage()).toString("base64");const s=ie.Buffer.from(t.serialize({requireAllSignatures:!1,verifySignatures:!1})).toString("base64");return{data:r,raw:s,rawMessage:i,version:n}})}})).map((t,r)=>this.mapSignedTransaction(e[r],t))}async signMessage(e){var t;const r=Yf.bufferToHex(e),n=await Wf(this,Vo,Za).call(this,{method:"signMessage",params:{data:r}});return{signature:ie.Buffer.from(Yf.messageToBuffer(n).buffer),publicKey:(t=this.publicKey)==null?void 0:t.toBase58()}}signIn(e){throw new Error("Method not implemented.")}getNetwork(){return Yf.NETWORK}mapSignedTransaction(e,t){return e.addSignature(this.publicKey,Ar.decode(t)),e}request(e){throw new Error("Not implemented")}internalRequest(e){return super.request(e)}};let z1=Yf;Kf=new WeakMap,Zf=new WeakMap,Gf=new WeakMap,Vo=new WeakSet,Za=function(e){const t=()=>this.internalRequest(e);return this.mobileAdapter?this.mobileAdapter.request(e,t):t()},z1.NETWORK="solana";var Wo={},us={},Xf={},Jf={},Qf={},q1={},Ko={},eu={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.output=Hr.exists=Hr.hash=Hr.bytes=Hr.bool=Hr.number=void 0;function tu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}Hr.number=tu;function V1(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}Hr.bool=V1;function q6(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Vh(e,...t){if(!q6(e))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}Hr.bytes=Vh;function W1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");tu(e.outputLen),tu(e.blockLen)}Hr.hash=W1;function K1(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}Hr.exists=K1;function Z1(e,t){Vh(e);const r=t.outputLen;if(e.lengthnew Uint8Array(z.buffer,z.byteOffset,z.byteLength);e.u8=r;const n=z=>new Uint32Array(z.buffer,z.byteOffset,Math.floor(z.byteLength/4));e.u32=n;function i(z){return z instanceof Uint8Array||z!=null&&typeof z=="object"&&z.constructor.name==="Uint8Array"}const s=z=>new DataView(z.buffer,z.byteOffset,z.byteLength);e.createView=s;const o=(z,ee)=>z<<32-ee|z>>>ee;if(e.rotr=o,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68,!e.isLE)throw new Error("Non little-endian hardware is not supported");const a=Array.from({length:256},(z,ee)=>ee.toString(16).padStart(2,"0"));function c(z){if(!i(z))throw new Error("Uint8Array expected");let ee="";for(let se=0;se=u._0&&z<=u._9)return z-u._0;if(z>=u._A&&z<=u._F)return z-(u._A-10);if(z>=u._a&&z<=u._f)return z-(u._a-10)}function y(z){if(typeof z!="string")throw new Error("hex string expected, got "+typeof z);const ee=z.length,se=ee/2;if(ee%2)throw new Error("padded hex string expected, got unpadded hex of length "+ee);const Q=new Uint8Array(se);for(let I=0,g=0;I{};e.nextTick=A;async function v(z,ee,se){let Q=Date.now();for(let I=0;I=0&&gz().update(O(Q)).digest(),se=z();return ee.outputLen=se.outputLen,ee.blockLen=se.blockLen,ee.create=()=>z(),ee}e.wrapConstructor=$;function q(z){const ee=(Q,I)=>z(I).update(O(Q)).digest(),se=z({});return ee.outputLen=se.outputLen,ee.blockLen=se.blockLen,ee.create=Q=>z(Q),ee}e.wrapConstructorWithOpts=q;function G(z){const ee=(Q,I)=>z(I).update(O(Q)).digest(),se=z({});return ee.outputLen=se.outputLen,ee.blockLen=se.blockLen,ee.create=Q=>z(Q),ee}e.wrapXOFConstructorWithOpts=G;function Z(z=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(z));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=Z}(Pi),Object.defineProperty(eu,"__esModule",{value:!0}),eu.SHA2=void 0;const Wh=Hr,Ga=Pi;function W6(e,t,r,n){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,r,n);const i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),c=n?4:0,u=n?0:4;e.setUint32(t+c,o,n),e.setUint32(t+u,a,n)}class K6 extends Ga.Hash{constructor(t,r,n,i){super(),this.blockLen=t,this.outputLen=r,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,Ga.createView)(this.buffer)}update(t){(0,Wh.exists)(this);const{view:r,buffer:n,blockLen:i}=this;t=(0,Ga.toBytes)(t);const s=t.length;for(let o=0;oi-o&&(this.process(n,0),o=0);for(let y=o;yl.length)throw new Error("_sha2: outputLen bigger than state");for(let y=0;ye&t^~e&r,Y6=(e,t,r)=>e&t^e&r^t&r,X6=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),ls=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),hs=new Uint32Array(64);class G1 extends Z6.SHA2{constructor(){super(64,32,8,!1),this.A=ls[0]|0,this.B=ls[1]|0,this.C=ls[2]|0,this.D=ls[3]|0,this.E=ls[4]|0,this.F=ls[5]|0,this.G=ls[6]|0,this.H=ls[7]|0}get(){const{A:t,B:r,C:n,D:i,E:s,F:o,G:a,H:c}=this;return[t,r,n,i,s,o,a,c]}set(t,r,n,i,s,o,a,c){this.A=t|0,this.B=r|0,this.C=n|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=c|0}process(t,r){for(let y=0;y<16;y++,r+=4)hs[y]=t.getUint32(r,!1);for(let y=16;y<64;y++){const A=hs[y-15],v=hs[y-2],R=(0,qn.rotr)(A,7)^(0,qn.rotr)(A,18)^A>>>3,O=(0,qn.rotr)(v,17)^(0,qn.rotr)(v,19)^v>>>10;hs[y]=O+hs[y-7]+R+hs[y-16]|0}let{A:n,B:i,C:s,D:o,E:a,F:c,G:u,H:l}=this;for(let y=0;y<64;y++){const A=(0,qn.rotr)(a,6)^(0,qn.rotr)(a,11)^(0,qn.rotr)(a,25),v=l+A+G6(a,c,u)+X6[y]+hs[y]|0,O=((0,qn.rotr)(n,2)^(0,qn.rotr)(n,13)^(0,qn.rotr)(n,22))+Y6(n,i,s)|0;l=u,u=c,c=a,a=o+v|0,o=s,s=i,i=n,n=v+O|0}n=n+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,l=l+this.H|0,this.set(n,i,s,o,a,c,u,l)}roundClean(){hs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class J6 extends G1{constructor(){super(),this.A=-1056596264,this.B=914150663,this.C=812702999,this.D=-150054599,this.E=-4191439,this.F=1750603025,this.G=1694076839,this.H=-1090891868,this.outputLen=28}}Ko.sha256=(0,qn.wrapConstructor)(()=>new G1),Ko.sha224=(0,qn.wrapConstructor)(()=>new J6);var ht={},st={};Object.defineProperty(st,"__esModule",{value:!0}),st.validateObject=st.createHmacDrbg=st.bitMask=st.bitSet=st.bitGet=st.bitLen=st.utf8ToBytes=st.equalBytes=st.concatBytes=st.ensureBytes=st.numberToVarBytesBE=st.numberToBytesLE=st.numberToBytesBE=st.bytesToNumberLE=st.bytesToNumberBE=st.hexToBytes=st.hexToNumber=st.numberToHexUnpadded=st.bytesToHex=st.isBytes=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Y1=BigInt(0),nu=BigInt(1),Q6=BigInt(2);function Zo(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}st.isBytes=Zo;const eB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Kh(e){if(!Zo(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r=Ui._0&&e<=Ui._9)return e-Ui._0;if(e>=Ui._A&&e<=Ui._F)return e-(Ui._A-10);if(e>=Ui._a&&e<=Ui._f)return e-(Ui._a-10)}function iu(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,r=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(r);for(let i=0,s=0;iY1;e>>=nu,t+=1);return t}st.bitLen=cB;function fB(e,t){return e>>BigInt(t)&nu}st.bitGet=fB;const uB=(e,t,r)=>e|(r?nu:Y1)<(Q6<new Uint8Array(e),ty=e=>Uint8Array.from(e);function hB(e,t,r){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof r!="function")throw new Error("hmacFn must be a function");let n=Gh(e),i=Gh(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Gh())=>{i=a(ty([0]),y),n=a(),y.length!==0&&(i=a(ty([1]),y),n=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let y=0;const A=[];for(;y{o(),c(y);let v;for(;!(v=A(u()));)c();return o(),v}}st.createHmacDrbg=hB;const dB={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Zo(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function pB(e,t,r={}){const n=(i,s,o)=>{const a=dB[s];if(typeof a!="function")throw new Error(`Invalid validator "${s}", expected function`);const c=e[i];if(!(o&&c===void 0)&&!a(c,e))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${s}`)};for(const[i,s]of Object.entries(t))n(i,s,!1);for(const[i,s]of Object.entries(r))n(i,s,!0);return e}st.validateObject=pB,Object.defineProperty(ht,"__esModule",{value:!0}),ht.mapHashToField=ht.getMinHashLength=ht.getFieldBytesLength=ht.hashToPrivateScalar=ht.FpSqrtEven=ht.FpSqrtOdd=ht.Field=ht.nLength=ht.FpIsSquare=ht.FpDiv=ht.FpInvertBatch=ht.FpPow=ht.validateField=ht.isNegativeLE=ht.FpSqrt=ht.tonelliShanks=ht.invert=ht.pow2=ht.pow=ht.mod=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Cn=st,jr=BigInt(0),Jt=BigInt(1),ds=BigInt(2),gB=BigInt(3),Yh=BigInt(4),ry=BigInt(5),ny=BigInt(8);BigInt(9),BigInt(16);function Ln(e,t){const r=e%t;return r>=jr?r:t+r}ht.mod=Ln;function iy(e,t,r){if(r<=jr||t 0");if(r===Jt)return jr;let n=Jt;for(;t>jr;)t&Jt&&(n=n*e%r),e=e*e%r,t>>=Jt;return n}ht.pow=iy;function yB(e,t,r){let n=e;for(;t-- >jr;)n*=n,n%=r;return n}ht.pow2=yB;function su(e,t){if(e===jr||t<=jr)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let r=Ln(e,t),n=t,i=jr,s=Jt;for(;r!==jr;){const a=n/r,c=n%r,u=i-s*a;n=r,r=c,i=s,s=u}if(n!==Jt)throw new Error("invert: does not exist");return Ln(i,t)}ht.invert=su;function sy(e){const t=(e-Jt)/ds;let r,n,i;for(r=e-Jt,n=0;r%ds===jr;r/=ds,n++);for(i=ds;i(Ln(e,t)&Jt)===Jt;ht.isNegativeLE=wB;const mB=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function bB(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=mB.reduce((n,i)=>(n[i]="function",n),t);return(0,Cn.validateObject)(e,r)}ht.validateField=bB;function ay(e,t,r){if(r 0");if(r===jr)return e.ONE;if(r===Jt)return t;let n=e.ONE,i=t;for(;r>jr;)r&Jt&&(n=e.mul(n,i)),i=e.sqr(i),r>>=Jt;return n}ht.FpPow=ay;function cy(e,t){const r=new Array(t.length),n=t.reduce((s,o,a)=>e.is0(o)?s:(r[a]=s,e.mul(s,o)),e.ONE),i=e.inv(n);return t.reduceRight((s,o,a)=>e.is0(o)?s:(r[a]=e.mul(s,r[a]),e.mul(s,o)),i),r}ht.FpInvertBatch=cy;function vB(e,t,r){return e.mul(t,typeof r=="bigint"?su(r,e.ORDER):e.inv(r))}ht.FpDiv=vB;function _B(e){const t=(e.ORDER-Jt)/ds;return r=>{const n=e.pow(r,t);return e.eql(n,e.ZERO)||e.eql(n,e.ONE)}}ht.FpIsSquare=_B;function Xh(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}ht.nLength=Xh;function EB(e,t,r=!1,n={}){if(e<=jr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=Xh(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=oy(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:s,MASK:(0,Cn.bitMask)(i),ZERO:jr,ONE:Jt,create:c=>Ln(c,e),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return jr<=c&&cc===jr,isOdd:c=>(c&Jt)===Jt,neg:c=>Ln(-c,e),eql:(c,u)=>c===u,sqr:c=>Ln(c*c,e),add:(c,u)=>Ln(c+u,e),sub:(c,u)=>Ln(c-u,e),mul:(c,u)=>Ln(c*u,e),pow:(c,u)=>ay(a,c,u),div:(c,u)=>Ln(c*su(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>su(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>cy(a,c),cmov:(c,u,l)=>l?u:c,toBytes:c=>r?(0,Cn.numberToBytesLE)(c,s):(0,Cn.numberToBytesBE)(c,s),fromBytes:c=>{if(c.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${c.length}`);return r?(0,Cn.bytesToNumberLE)(c):(0,Cn.bytesToNumberBE)(c)}});return Object.freeze(a)}ht.Field=EB;function xB(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?r:e.neg(r)}ht.FpSqrtOdd=xB;function SB(e,t){if(!e.isOdd)throw new Error("Field doesn't have isOdd");const r=e.sqrt(t);return e.isOdd(r)?e.neg(r):r}ht.FpSqrtEven=SB;function AB(e,t,r=!1){e=(0,Cn.ensureBytes)("privateHash",e);const n=e.length,i=Xh(t).nByteLength+8;if(i<24||n1024)throw new Error(`hashToPrivateScalar: expected ${i}-1024 bytes of input, got ${n}`);const s=r?(0,Cn.bytesToNumberLE)(e):(0,Cn.bytesToNumberBE)(e);return Ln(s,t-Jt)+Jt}ht.hashToPrivateScalar=AB;function Jh(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}ht.getFieldBytesLength=Jh;function fy(e){const t=Jh(e);return t+Math.ceil(t/2)}ht.getMinHashLength=fy;function BB(e,t,r=!1){const n=e.length,i=Jh(t),s=fy(t);if(n<16||n1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);const o=r?(0,Cn.bytesToNumberBE)(e):(0,Cn.bytesToNumberLE)(e),a=Ln(o,t-Jt)+Jt;return r?(0,Cn.numberToBytesLE)(a,i):(0,Cn.numberToBytesBE)(a,i)}ht.mapHashToField=BB;var Qh={},Go={};Object.defineProperty(Go,"__esModule",{value:!0}),Go.validateBasic=Go.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const uy=ht,IB=st,RB=BigInt(0),ed=BigInt(1);function TB(e,t){const r=(i,s)=>{const o=s.negate();return i?o:s},n=i=>{const s=Math.ceil(t/i)+1,o=2**(i-1);return{windows:s,windowSize:o}};return{constTimeNegate:r,unsafeLadder(i,s){let o=e.ZERO,a=i;for(;s>RB;)s&ed&&(o=o.add(a)),a=a.double(),s>>=ed;return o},precomputeWindow(i,s){const{windows:o,windowSize:a}=n(s),c=[];let u=i,l=u;for(let y=0;y>=v,P>c&&(P-=A,o+=ed);const H=O,F=O+Math.abs(P)-1,N=R%2!==0,$=P<0;P===0?l=l.add(r(N,s[H])):u=u.add(r($,s[F]))}return{p:u,f:l}},wNAFCached(i,s,o,a){const c=i._WINDOW_SIZE||1;let u=s.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&s.set(i,a(u))),this.wNAF(c,u,o)}}}Go.wNAF=TB;function kB(e){return(0,uy.validateField)(e.Fp),(0,IB.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,uy.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}Go.validateBasic=kB,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.mapToCurveSimpleSWU=e.SWUFpSqrtRatio=e.weierstrass=e.weierstrassPoints=e.DER=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=ht,r=st,n=st,i=Go;function s(F){const N=(0,i.validateBasic)(F);r.validateObject(N,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:$,Fp:q,a:G}=N;if($){if(!q.eql(G,q.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof $!="object"||typeof $.beta!="bigint"||typeof $.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...N})}const{bytesToNumberBE:o,hexToBytes:a}=r;e.DER={Err:class extends Error{constructor(N=""){super(N)}},_parseInt(F){const{Err:N}=e.DER;if(F.length<2||F[0]!==2)throw new N("Invalid signature integer tag");const $=F[1],q=F.subarray(2,$+2);if(!$||q.length!==$)throw new N("Invalid signature integer: wrong length");if(q[0]&128)throw new N("Invalid signature integer: negative");if(q[0]===0&&!(q[1]&128))throw new N("Invalid signature integer: unnecessary leading zero");return{d:o(q),l:F.subarray($+2)}},toSig(F){const{Err:N}=e.DER,$=typeof F=="string"?a(F):F;if(!r.isBytes($))throw new Error("ui8a expected");let q=$.length;if(q<2||$[0]!=48)throw new N("Invalid signature tag");if($[1]!==q-2)throw new N("Invalid signature: incorrect length");const{d:G,l:Z}=e.DER._parseInt($.subarray(2)),{d:z,l:ee}=e.DER._parseInt(Z);if(ee.length)throw new N("Invalid signature: left bytes after parsing");return{r:G,s:z}},hexFromSig(F){const N=Q=>Number.parseInt(Q[0],16)&8?"00"+Q:Q,$=Q=>{const I=Q.toString(16);return I.length&1?`0${I}`:I},q=N($(F.s)),G=N($(F.r)),Z=q.length/2,z=G.length/2,ee=$(Z),se=$(z);return`30${$(z+Z+4)}02${se}${G}02${ee}${q}`}};const c=BigInt(0),u=BigInt(1),l=BigInt(2),y=BigInt(3),A=BigInt(4);function v(F){const N=s(F),{Fp:$}=N,q=N.toBytes||((m,_,E)=>{const x=_.toAffine();return r.concatBytes(Uint8Array.from([4]),$.toBytes(x.x),$.toBytes(x.y))}),G=N.fromBytes||(m=>{const _=m.subarray(1),E=$.fromBytes(_.subarray(0,$.BYTES)),x=$.fromBytes(_.subarray($.BYTES,2*$.BYTES));return{x:E,y:x}});function Z(m){const{a:_,b:E}=N,x=$.sqr(m),T=$.mul(x,m);return $.add($.add(T,$.mul(m,_)),E)}if(!$.eql($.sqr(N.Gy),Z(N.Gx)))throw new Error("bad generator point: equation left != right");function z(m){return typeof m=="bigint"&&c$.eql(B,$.ZERO);return T(E)&&T(x)?g.ZERO:new g(E,x,$.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(_){const E=$.invertBatch(_.map(x=>x.pz));return _.map((x,T)=>x.toAffine(E[T])).map(g.fromAffine)}static fromHex(_){const E=g.fromAffine(G((0,n.ensureBytes)("pointHex",_)));return E.assertValidity(),E}static fromPrivateKey(_){return g.BASE.multiply(se(_))}_setWindowSize(_){this._WINDOW_SIZE=_,Q.delete(this)}assertValidity(){if(this.is0()){if(N.allowInfinityPoint&&!$.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:_,y:E}=this.toAffine();if(!$.isValid(_)||!$.isValid(E))throw new Error("bad point: x or y not FE");const x=$.sqr(E),T=Z(_);if(!$.eql(x,T))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:_}=this.toAffine();if($.isOdd)return!$.isOdd(_);throw new Error("Field doesn't support isOdd")}equals(_){I(_);const{px:E,py:x,pz:T}=this,{px:B,py:d,pz:k}=_,W=$.eql($.mul(E,k),$.mul(B,T)),K=$.eql($.mul(x,k),$.mul(d,T));return W&&K}negate(){return new g(this.px,$.neg(this.py),this.pz)}double(){const{a:_,b:E}=N,x=$.mul(E,y),{px:T,py:B,pz:d}=this;let k=$.ZERO,W=$.ZERO,K=$.ZERO,re=$.mul(T,T),xe=$.mul(B,B),be=$.mul(d,d),ge=$.mul(T,B);return ge=$.add(ge,ge),K=$.mul(T,d),K=$.add(K,K),k=$.mul(_,K),W=$.mul(x,be),W=$.add(k,W),k=$.sub(xe,W),W=$.add(xe,W),W=$.mul(k,W),k=$.mul(ge,k),K=$.mul(x,K),be=$.mul(_,be),ge=$.sub(re,be),ge=$.mul(_,ge),ge=$.add(ge,K),K=$.add(re,re),re=$.add(K,re),re=$.add(re,be),re=$.mul(re,ge),W=$.add(W,re),be=$.mul(B,d),be=$.add(be,be),re=$.mul(be,ge),k=$.sub(k,re),K=$.mul(be,xe),K=$.add(K,K),K=$.add(K,K),new g(k,W,K)}add(_){I(_);const{px:E,py:x,pz:T}=this,{px:B,py:d,pz:k}=_;let W=$.ZERO,K=$.ZERO,re=$.ZERO;const xe=N.a,be=$.mul(N.b,y);let ge=$.mul(E,B),tt=$.mul(x,d),Ue=$.mul(T,k),Pe=$.add(E,x),pe=$.add(B,d);Pe=$.mul(Pe,pe),pe=$.add(ge,tt),Pe=$.sub(Pe,pe),pe=$.add(E,T);let we=$.add(B,k);return pe=$.mul(pe,we),we=$.add(ge,Ue),pe=$.sub(pe,we),we=$.add(x,T),W=$.add(d,k),we=$.mul(we,W),W=$.add(tt,Ue),we=$.sub(we,W),re=$.mul(xe,pe),W=$.mul(be,Ue),re=$.add(W,re),W=$.sub(tt,re),re=$.add(tt,re),K=$.mul(W,re),tt=$.add(ge,ge),tt=$.add(tt,ge),Ue=$.mul(xe,Ue),pe=$.mul(be,pe),tt=$.add(tt,Ue),Ue=$.sub(ge,Ue),Ue=$.mul(xe,Ue),pe=$.add(pe,Ue),ge=$.mul(tt,pe),K=$.add(K,ge),ge=$.mul(we,pe),W=$.mul(Pe,W),W=$.sub(W,ge),ge=$.mul(Pe,tt),re=$.mul(we,re),re=$.add(re,ge),new g(W,K,re)}subtract(_){return this.add(_.negate())}is0(){return this.equals(g.ZERO)}wNAF(_){return h.wNAFCached(this,Q,_,E=>{const x=$.invertBatch(E.map(T=>T.pz));return E.map((T,B)=>T.toAffine(x[B])).map(g.fromAffine)})}multiplyUnsafe(_){const E=g.ZERO;if(_===c)return E;if(ee(_),_===u)return this;const{endo:x}=N;if(!x)return h.unsafeLadder(this,_);let{k1neg:T,k1:B,k2neg:d,k2:k}=x.splitScalar(_),W=E,K=E,re=this;for(;B>c||k>c;)B&u&&(W=W.add(re)),k&u&&(K=K.add(re)),re=re.double(),B>>=u,k>>=u;return T&&(W=W.negate()),d&&(K=K.negate()),K=new g($.mul(K.px,x.beta),K.py,K.pz),W.add(K)}multiply(_){ee(_);let E=_,x,T;const{endo:B}=N;if(B){const{k1neg:d,k1:k,k2neg:W,k2:K}=B.splitScalar(E);let{p:re,f:xe}=this.wNAF(k),{p:be,f:ge}=this.wNAF(K);re=h.constTimeNegate(d,re),be=h.constTimeNegate(W,be),be=new g($.mul(be.px,B.beta),be.py,be.pz),x=re.add(be),T=xe.add(ge)}else{const{p:d,f:k}=this.wNAF(E);x=d,T=k}return g.normalizeZ([x,T])[0]}multiplyAndAddUnsafe(_,E,x){const T=g.BASE,B=(k,W)=>W===c||W===u||!k.equals(T)?k.multiplyUnsafe(W):k.multiply(W),d=B(this,E).add(B(_,x));return d.is0()?void 0:d}toAffine(_){const{px:E,py:x,pz:T}=this,B=this.is0();_==null&&(_=B?$.ONE:$.inv(T));const d=$.mul(E,_),k=$.mul(x,_),W=$.mul(T,_);if(B)return{x:$.ZERO,y:$.ZERO};if(!$.eql(W,$.ONE))throw new Error("invZ was invalid");return{x:d,y:k}}isTorsionFree(){const{h:_,isTorsionFree:E}=N;if(_===u)return!0;if(E)return E(g,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:_,clearCofactor:E}=N;return _===u?this:E?E(g,this):this.multiplyUnsafe(N.h)}toRawBytes(_=!0){return this.assertValidity(),q(g,this,_)}toHex(_=!0){return r.bytesToHex(this.toRawBytes(_))}}g.BASE=new g(N.Gx,N.Gy,$.ONE),g.ZERO=new g($.ZERO,$.ONE,$.ZERO);const f=N.nBitLength,h=(0,i.wNAF)(g,N.endo?Math.ceil(f/2):f);return{CURVE:N,ProjectivePoint:g,normPrivateKeyToScalar:se,weierstrassEquation:Z,isWithinCurveOrder:z}}e.weierstrassPoints=v;function R(F){const N=(0,i.validateBasic)(F);return r.validateObject(N,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...N})}function O(F){const N=R(F),{Fp:$,n:q}=N,G=$.BYTES+1,Z=2*$.BYTES+1;function z(pe){return cr.bytesToHex(r.numberToBytesBE(pe,N.nByteLength));function m(pe){const we=q>>u;return pe>we}function _(pe){return m(pe)?ee(-pe):pe}const E=(pe,we,ke)=>r.bytesToNumberBE(pe.slice(we,ke));class x{constructor(we,ke,vt){this.r=we,this.s=ke,this.recovery=vt,this.assertValidity()}static fromCompact(we){const ke=N.nByteLength;return we=(0,n.ensureBytes)("compactSignature",we,ke*2),new x(E(we,0,ke),E(we,ke,2*ke))}static fromDER(we){const{r:ke,s:vt}=e.DER.toSig((0,n.ensureBytes)("DER",we));return new x(ke,vt)}assertValidity(){if(!f(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!f(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(we){return new x(this.r,this.s,we)}recoverPublicKey(we){const{r:ke,s:vt,recovery:He}=this,it=K((0,n.ensureBytes)("msgHash",we));if(He==null||![0,1,2,3].includes(He))throw new Error("recovery id invalid");const Ht=He===2||He===3?ke+N.n:ke;if(Ht>=$.ORDER)throw new Error("recovery id 2 or 3 invalid");const ut=He&1?"03":"02",pt=Q.fromHex(ut+h(Ht)),Wt=se(Ht),xt=ee(-it*Wt),At=ee(vt*Wt),Xt=Q.BASE.multiplyAndAddUnsafe(pt,xt,At);if(!Xt)throw new Error("point at infinify");return Xt.assertValidity(),Xt}hasHighS(){return m(this.s)}normalizeS(){return this.hasHighS()?new x(this.r,ee(-this.s),this.recovery):this}toDERRawBytes(){return r.hexToBytes(this.toDERHex())}toDERHex(){return e.DER.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return r.hexToBytes(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}const T={isValidPrivateKey(pe){try{return I(pe),!0}catch{return!1}},normPrivateKeyToScalar:I,randomPrivateKey:()=>{const pe=t.getMinHashLength(N.n);return t.mapHashToField(N.randomBytes(pe),N.n)},precompute(pe=8,we=Q.BASE){return we._setWindowSize(pe),we.multiply(BigInt(3)),we}};function B(pe,we=!0){return Q.fromPrivateKey(pe).toRawBytes(we)}function d(pe){const we=r.isBytes(pe),ke=typeof pe=="string",vt=(we||ke)&&pe.length;return we?vt===G||vt===Z:ke?vt===2*G||vt===2*Z:pe instanceof Q}function k(pe,we,ke=!0){if(d(pe))throw new Error("first arg must be private key");if(!d(we))throw new Error("second arg must be public key");return Q.fromHex(we).multiply(I(pe)).toRawBytes(ke)}const W=N.bits2int||function(pe){const we=r.bytesToNumberBE(pe),ke=pe.length*8-N.nBitLength;return ke>0?we>>BigInt(ke):we},K=N.bits2int_modN||function(pe){return ee(W(pe))},re=r.bitMask(N.nBitLength);function xe(pe){if(typeof pe!="bigint")throw new Error("bigint expected");if(!(c<=pe&&peC in ke))throw new Error("sign() legacy options not supported");const{hash:vt,randomBytes:He}=N;let{lowS:it,prehash:Ht,extraEntropy:ut}=ke;it==null&&(it=!0),pe=(0,n.ensureBytes)("msgHash",pe),Ht&&(pe=(0,n.ensureBytes)("prehashed msgHash",vt(pe)));const pt=K(pe),Wt=I(we),xt=[xe(Wt),xe(pt)];if(ut!=null){const C=ut===!0?He($.BYTES):ut;xt.push((0,n.ensureBytes)("extraEntropy",C))}const At=r.concatBytes(...xt),Xt=pt;function Tt(C){const w=W(C);if(!f(w))return;const b=se(w),D=Q.BASE.multiply(w).toAffine(),V=ee(D.x);if(V===c)return;const X=ee(b*ee(Xt+V*Wt));if(X===c)return;let ae=(D.x===V?0:2)|Number(D.y&u),Ze=X;return it&&m(X)&&(Ze=_(X),ae^=1),new x(V,Ze,ae)}return{seed:At,k2sig:Tt}}const ge={lowS:N.lowS,prehash:!1},tt={lowS:N.lowS,prehash:!1};function Ue(pe,we,ke=ge){const{seed:vt,k2sig:He}=be(pe,we,ke),it=N;return r.createHmacDrbg(it.hash.outputLen,it.nByteLength,it.hmac)(vt,He)}Q.BASE._setWindowSize(8);function Pe(pe,we,ke,vt=tt){const He=pe;if(we=(0,n.ensureBytes)("msgHash",we),ke=(0,n.ensureBytes)("publicKey",ke),"strict"in vt)throw new Error("options.strict was renamed to lowS");const{lowS:it,prehash:Ht}=vt;let ut,pt;try{if(typeof He=="string"||r.isBytes(He))try{ut=x.fromDER(He)}catch(D){if(!(D instanceof e.DER.Err))throw D;ut=x.fromCompact(He)}else if(typeof He=="object"&&typeof He.r=="bigint"&&typeof He.s=="bigint"){const{r:D,s:V}=He;ut=new x(D,V)}else throw new Error("PARSE");pt=Q.fromHex(ke)}catch(D){if(D.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(it&&ut.hasHighS())return!1;Ht&&(we=N.hash(we));const{r:Wt,s:xt}=ut,At=K(we),Xt=se(xt),Tt=ee(At*Xt),C=ee(Wt*Xt),w=Q.BASE.multiplyAndAddUnsafe(pt,Tt,C)?.toAffine();return w?ee(w.x)===Wt:!1}return{CURVE:N,getPublicKey:B,getSharedSecret:k,sign:Ue,verify:Pe,ProjectivePoint:Q,Signature:x,utils:T}}e.weierstrass=O;function P(F,N){const $=F.ORDER;let q=c;for(let m=$-u;m%l===c;m/=l)q+=u;const G=q,Z=l<{let E=g,x=F.pow(_,Q),T=F.sqr(x);T=F.mul(T,_);let B=F.mul(m,T);B=F.pow(B,se),B=F.mul(B,x),x=F.mul(B,_),T=F.mul(B,m);let d=F.mul(T,x);B=F.pow(d,I);let k=F.eql(B,F.ONE);x=F.mul(T,f),B=F.mul(d,E),T=F.cmov(x,T,k),d=F.cmov(B,d,k);for(let W=G;W>u;W--){let K=W-l;K=l<{let T=F.sqr(x);const B=F.mul(E,x);T=F.mul(T,B);let d=F.pow(T,m);d=F.mul(d,B);const k=F.mul(d,_),W=F.mul(F.sqr(d),x),K=F.eql(W,E);let re=F.cmov(k,d,K);return{isValid:K,value:re}}}return h}e.SWUFpSqrtRatio=P;function H(F,N){if(t.validateField(F),!F.isValid(N.A)||!F.isValid(N.B)||!F.isValid(N.Z))throw new Error("mapToCurveSimpleSWU: invalid opts");const $=P(F,N.Z);if(!F.isOdd)throw new Error("Fp.isOdd is not implemented!");return q=>{let G,Z,z,ee,se,Q,I,g;G=F.sqr(q),G=F.mul(G,N.Z),Z=F.sqr(G),Z=F.add(Z,G),z=F.add(Z,F.ONE),z=F.mul(z,N.B),ee=F.cmov(N.Z,F.neg(Z),!F.eql(Z,F.ZERO)),ee=F.mul(ee,N.A),Z=F.sqr(z),Q=F.sqr(ee),se=F.mul(Q,N.A),Z=F.add(Z,se),Z=F.mul(Z,z),Q=F.mul(Q,ee),se=F.mul(Q,N.B),Z=F.add(Z,se),I=F.mul(G,z);const{isValid:f,value:h}=$(Z,Q);g=F.mul(G,q),g=F.mul(g,h),I=F.cmov(I,z,f),g=F.cmov(g,h,f);const m=F.isOdd(q)===F.isOdd(g);return g=F.cmov(F.neg(g),g,m),I=F.div(I,ee),{x:I,y:g}}}e.mapToCurveSimpleSWU=H}(Qh);var Vn={};Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.createHasher=Vn.isogenyMap=Vn.hash_to_field=Vn.expand_message_xof=Vn.expand_message_xmd=void 0;const CB=ht,$n=st;function LB(e){if((0,$n.isBytes)(e))return e;if(typeof e=="string")return(0,$n.utf8ToBytes)(e);throw new Error("DST must be Uint8Array or string")}const $B=$n.bytesToNumberBE;function ps(e,t){if(e<0||e>=1<<8*t)throw new Error(`bad I2OSP call: value=${e} length=${t}`);const r=Array.from({length:t}).fill(0);for(let n=t-1;n>=0;n--)r[n]=e&255,e>>>=8;return new Uint8Array(r)}function OB(e,t){const r=new Uint8Array(e.length);for(let n=0;n255&&(t=n((0,$n.concatBytes)((0,$n.utf8ToBytes)("H2C-OVERSIZE-DST-"),t)));const{outputLen:i,blockLen:s}=n,o=Math.ceil(r/i);if(o>255)throw new Error("Invalid xmd length");const a=(0,$n.concatBytes)(t,ps(t.length,1)),c=ps(0,s),u=ps(r,2),l=new Array(o),y=n((0,$n.concatBytes)(c,e,u,ps(0,1),a));l[0]=n((0,$n.concatBytes)(y,ps(1,1),a));for(let v=1;v<=o;v++){const R=[OB(y,l[v-1]),ps(v+1,1),a];l[v]=n((0,$n.concatBytes)(...R))}return(0,$n.concatBytes)(...l).slice(0,r)}Vn.expand_message_xmd=ly;function hy(e,t,r,n,i){if(Ya(e),Ya(t),td(r),t.length>255){const s=Math.ceil(2*n/8);t=i.create({dkLen:s}).update((0,$n.utf8ToBytes)("H2C-OVERSIZE-DST-")).update(t).digest()}if(r>65535||t.length>255)throw new Error("expand_message_xof: invalid lenInBytes");return i.create({dkLen:r}).update(e).update(ps(r,2)).update(t).update(ps(t.length,1)).digest()}Vn.expand_message_xof=hy;function rd(e,t,r){(0,$n.validateObject)(r,{DST:"stringOrUint8Array",p:"bigint",m:"isSafeInteger",k:"isSafeInteger",hash:"hash"});const{p:n,k:i,m:s,hash:o,expand:a,DST:c}=r;Ya(e),td(t);const u=LB(c),l=n.toString(2).length,y=Math.ceil((l+i)/8),A=t*s*y;let v;if(a==="xmd")v=ly(e,u,A,o);else if(a==="xof")v=hy(e,u,A,i,o);else if(a==="_internal_pass")v=e;else throw new Error('expand must be "xmd" or "xof"');const R=new Array(t);for(let O=0;OArray.from(n).reverse());return(n,i)=>{const[s,o,a,c]=r.map(u=>u.reduce((l,y)=>e.add(e.mul(l,n),y)));return n=e.div(s,o),i=e.mul(i,e.div(a,c)),{x:n,y:i}}}Vn.isogenyMap=MB;function NB(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){const s=rd(n,2,{...r,DST:r.DST,...i}),o=e.fromAffine(t(s[0])),a=e.fromAffine(t(s[1])),c=o.add(a).clearCofactor();return c.assertValidity(),c},encodeToCurve(n,i){const s=rd(n,1,{...r,DST:r.encodeDST,...i}),o=e.fromAffine(t(s[0])).clearCofactor();return o.assertValidity(),o}}}Vn.createHasher=NB;var Yo={},dy={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=Hr,r=Pi;class n extends r.Hash{constructor(o,a){super(),this.finished=!1,this.destroyed=!1,(0,t.hash)(o);const c=(0,r.toBytes)(a);if(this.iHash=o.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const u=this.blockLen,l=new Uint8Array(u);l.set(c.length>u?o.create().update(c).digest():c);for(let y=0;ynew n(s,o).update(a).digest();e.hmac=i,e.hmac.create=(s,o)=>new n(s,o)})(dy),Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.createCurve=Yo.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const PB=dy,py=Pi,UB=Qh;function gy(e){return{hash:e,hmac:(t,...r)=>(0,PB.hmac)(e,t,(0,py.concatBytes)(...r)),randomBytes:py.randomBytes}}Yo.getHash=gy;function FB(e,t){const r=n=>(0,UB.weierstrass)({...e,...gy(n)});return Object.freeze({...r(t),create:r})}Yo.createCurve=FB,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.schnorr=e.secp256k1=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const t=Ko,r=Pi,n=ht,i=Qh,s=st,o=Vn,a=Yo,c=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),u=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),l=BigInt(1),y=BigInt(2),A=(x,T)=>(x+T/y)/T;function v(x){const T=c,B=BigInt(3),d=BigInt(6),k=BigInt(11),W=BigInt(22),K=BigInt(23),re=BigInt(44),xe=BigInt(88),be=x*x*x%T,ge=be*be*x%T,tt=(0,n.pow2)(ge,B,T)*ge%T,Ue=(0,n.pow2)(tt,B,T)*ge%T,Pe=(0,n.pow2)(Ue,y,T)*be%T,pe=(0,n.pow2)(Pe,k,T)*Pe%T,we=(0,n.pow2)(pe,W,T)*pe%T,ke=(0,n.pow2)(we,re,T)*we%T,vt=(0,n.pow2)(ke,xe,T)*ke%T,He=(0,n.pow2)(vt,re,T)*we%T,it=(0,n.pow2)(He,B,T)*ge%T,Ht=(0,n.pow2)(it,K,T)*pe%T,ut=(0,n.pow2)(Ht,d,T)*be%T,pt=(0,n.pow2)(ut,y,T);if(!R.eql(R.sqr(pt),x))throw new Error("Cannot find square root");return pt}const R=(0,n.Field)(c,void 0,void 0,{sqrt:v});e.secp256k1=(0,a.createCurve)({a:BigInt(0),b:BigInt(7),Fp:R,n:u,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:x=>{const T=u,B=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),d=-l*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),k=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),W=B,K=BigInt("0x100000000000000000000000000000000"),re=A(W*x,T),xe=A(-d*x,T);let be=(0,n.mod)(x-re*B-xe*k,T),ge=(0,n.mod)(-re*d-xe*W,T);const tt=be>K,Ue=ge>K;if(tt&&(be=T-be),Ue&&(ge=T-ge),be>K||ge>K)throw new Error("splitScalar: Endomorphism failed, k="+x);return{k1neg:tt,k1:be,k2neg:Ue,k2:ge}}}},t.sha256);const O=BigInt(0),P=x=>typeof x=="bigint"&&Otypeof x=="bigint"&&Ok.charCodeAt(0)));B=(0,s.concatBytes)(d,d),F[x]=B}return(0,t.sha256)((0,s.concatBytes)(B,...T))}const $=x=>x.toRawBytes(!0).slice(1),q=x=>(0,s.numberToBytesBE)(x,32),G=x=>(0,n.mod)(x,c),Z=x=>(0,n.mod)(x,u),z=e.secp256k1.ProjectivePoint,ee=(x,T,B)=>z.BASE.multiplyAndAddUnsafe(x,T,B);function se(x){let T=e.secp256k1.utils.normPrivateKeyToScalar(x),B=z.fromPrivateKey(T);return{scalar:B.hasEvenY()?T:Z(-T),bytes:$(B)}}function Q(x){if(!P(x))throw new Error("bad x: need 0 < x < p");const T=G(x*x),B=G(T*x+BigInt(7));let d=v(B);d%y!==O&&(d=G(-d));const k=new z(x,d,l);return k.assertValidity(),k}function I(...x){return Z((0,s.bytesToNumberBE)(N("BIP0340/challenge",...x)))}function g(x){return se(x).bytes}function f(x,T,B=(0,r.randomBytes)(32)){const d=(0,s.ensureBytes)("message",x),{bytes:k,scalar:W}=se(T),K=(0,s.ensureBytes)("auxRand",B,32),re=q(W^(0,s.bytesToNumberBE)(N("BIP0340/aux",K))),xe=N("BIP0340/nonce",re,k,d),be=Z((0,s.bytesToNumberBE)(xe));if(be===O)throw new Error("sign failed: k is zero");const{bytes:ge,scalar:tt}=se(be),Ue=I(ge,k,d),Pe=new Uint8Array(64);if(Pe.set(ge,0),Pe.set(q(Z(tt+Ue*W)),32),!h(Pe,d,k))throw new Error("sign: Invalid signature produced");return Pe}function h(x,T,B){const d=(0,s.ensureBytes)("signature",x,64),k=(0,s.ensureBytes)("message",T),W=(0,s.ensureBytes)("publicKey",B,32);try{const K=Q((0,s.bytesToNumberBE)(W)),re=(0,s.bytesToNumberBE)(d.subarray(0,32));if(!P(re))return!1;const xe=(0,s.bytesToNumberBE)(d.subarray(32,64));if(!H(xe))return!1;const be=I(q(re),$(K),k),ge=ee(K,xe,Z(-be));return!(!ge||!ge.hasEvenY()||ge.toAffine().x!==re)}catch{return!1}}e.schnorr=(()=>({getPublicKey:g,sign:f,verify:h,utils:{randomPrivateKey:e.secp256k1.utils.randomPrivateKey,lift_x:Q,pointToBytes:$,numberToBytesBE:s.numberToBytesBE,bytesToNumberBE:s.bytesToNumberBE,taggedHash:N,mod:n.mod}}))();const m=(()=>(0,o.isogenyMap)(R,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(x=>x.map(T=>BigInt(T)))))(),_=(()=>(0,i.mapToCurveSimpleSWU)(R,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:R.create(BigInt("-11"))}))(),E=(()=>(0,o.createHasher)(e.secp256k1.ProjectivePoint,x=>{const{x:T,y:B}=_(R.create(x[0]));return m(T,B)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:R.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))();e.hashToCurve=(()=>E.hashToCurve)(),e.encodeToCurve=(()=>E.encodeToCurve)()}(q1),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=q1;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(Qf),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.MAX_WITHDRAWALS_PER_PAYLOAD=e.RLP_EMPTY_STRING=e.KECCAK256_RLP=e.KECCAK256_RLP_S=e.KECCAK256_RLP_ARRAY=e.KECCAK256_RLP_ARRAY_S=e.KECCAK256_NULL=e.KECCAK256_NULL_S=e.TWO_POW256=e.SECP256K1_ORDER_DIV_2=e.SECP256K1_ORDER=e.MAX_INTEGER_BIGINT=e.MAX_INTEGER=e.MAX_UINT64=void 0;const t=ie,r=Qf;e.MAX_UINT64=BigInt("0xffffffffffffffff"),e.MAX_INTEGER=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),e.MAX_INTEGER_BIGINT=BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935"),e.SECP256K1_ORDER=r.secp256k1.CURVE.n,e.SECP256K1_ORDER_DIV_2=r.secp256k1.CURVE.n/BigInt(2),e.TWO_POW256=BigInt("0x10000000000000000000000000000000000000000000000000000000000000000"),e.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",e.KECCAK256_NULL=t.Buffer.from(e.KECCAK256_NULL_S,"hex"),e.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",e.KECCAK256_RLP_ARRAY=t.Buffer.from(e.KECCAK256_RLP_ARRAY_S,"hex"),e.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",e.KECCAK256_RLP=t.Buffer.from(e.KECCAK256_RLP_S,"hex"),e.RLP_EMPTY_STRING=t.Buffer.from([128]),e.MAX_WITHDRAWALS_PER_PAYLOAD=16}(Jf);var ou={};Object.defineProperty(ou,"__esModule",{value:!0}),ou.GWEI_TO_WEI=void 0,ou.GWEI_TO_WEI=BigInt(1e9);var nd={},vi={};Object.defineProperty(vi,"__esModule",{value:!0}),vi.RLP=vi.utils=vi.decode=vi.encode=void 0;function id(e){if(Array.isArray(e)){const r=[];let n=0;for(let i=0;ie.length)throw new Error("invalid RLP (safeSlice): end slice of Uint8Array out-of-bounds");return e.slice(t,r)}function yy(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return vy(by(e))}function wy(e,t){if(e<56)return Uint8Array.from([e+t]);const r=ad(e),n=r.length/2,i=ad(t+55+n);return Uint8Array.from(au(i+r))}function my(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);const r=xy(e),n=sd(r);if(t)return n;if(n.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return n.data}vi.decode=my;function sd(e){let t,r,n,i,s;const o=[],a=e[0];if(a<=127)return{data:e.slice(0,1),remainder:e.slice(1)};if(a<=183){if(t=a-127,a===128?n=Uint8Array.from([]):n=Xo(e,1,t),t===2&&n[0]<128)throw new Error("invalid RLP encoding: invalid prefix, single byte < 0x80 are not prefixed");return{data:n,remainder:e.slice(t)}}else if(a<=191){if(r=a-182,e.length-1e.length)throw new Error("invalid RLP: total length is larger than the data");for(i=Xo(e,r,c);i.length;)s=sd(i),o.push(s.data),i=s.remainder;return{data:o,remainder:e.slice(c)}}}const DB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function by(e){let t="";for(let r=0;rn+i.length,0),r=new Uint8Array(t);for(let n=0,i=0;n=2&&e[0]==="0"&&e[1]==="x"}function jB(e){return typeof e!="string"?e:Ey(e)?e.slice(2):e}function xy(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return Ey(e)?au(HB(jB(e))):_y(e);if(typeof e=="number"||typeof e=="bigint")return e?au(ad(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}vi.utils={bytesToHex:by,concatBytes:od,hexToBytes:au,utf8ToBytes:_y},vi.RLP={encode:id,decode:my};var Wn={},Qt={},ot={};Object.defineProperty(ot,"__esModule",{value:!0}),ot.add5L=ot.add5H=ot.add4H=ot.add4L=ot.add3H=ot.add3L=ot.add=ot.rotlBL=ot.rotlBH=ot.rotlSL=ot.rotlSH=ot.rotr32L=ot.rotr32H=ot.rotrBL=ot.rotrBH=ot.rotrSL=ot.rotrSH=ot.shrSL=ot.shrSH=ot.toBig=ot.split=ot.fromBig=void 0;const cu=BigInt(2**32-1),cd=BigInt(32);function fd(e,t=!1){return t?{h:Number(e&cu),l:Number(e>>cd&cu)}:{h:Number(e>>cd&cu)|0,l:Number(e&cu)|0}}ot.fromBig=fd;function Sy(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);ot.toBig=Ay;const By=(e,t,r)=>e>>>r;ot.shrSH=By;const Iy=(e,t,r)=>e<<32-r|t>>>r;ot.shrSL=Iy;const Ry=(e,t,r)=>e>>>r|t<<32-r;ot.rotrSH=Ry;const Ty=(e,t,r)=>e<<32-r|t>>>r;ot.rotrSL=Ty;const ky=(e,t,r)=>e<<64-r|t>>>r-32;ot.rotrBH=ky;const Cy=(e,t,r)=>e>>>r-32|t<<64-r;ot.rotrBL=Cy;const Ly=(e,t)=>t;ot.rotr32H=Ly;const $y=(e,t)=>e;ot.rotr32L=$y;const Oy=(e,t,r)=>e<>>32-r;ot.rotlSH=Oy;const My=(e,t,r)=>t<>>32-r;ot.rotlSL=My;const Ny=(e,t,r)=>t<>>64-r;ot.rotlBH=Ny;const Py=(e,t,r)=>e<>>64-r;ot.rotlBL=Py;function Uy(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}ot.add=Uy;const Fy=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);ot.add3L=Fy;const Dy=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;ot.add3H=Dy;const Hy=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);ot.add4L=Hy;const jy=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;ot.add4H=jy;const zy=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ot.add5L=zy;const qy=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;ot.add5H=qy;const zB={fromBig:fd,split:Sy,toBig:Ay,shrSH:By,shrSL:Iy,rotrSH:Ry,rotrSL:Ty,rotrBH:ky,rotrBL:Cy,rotr32H:Ly,rotr32L:$y,rotlSH:Oy,rotlSL:My,rotlBH:Ny,rotlBL:Py,add:Uy,add3L:Fy,add3H:Dy,add4L:Hy,add4H:jy,add5H:qy,add5L:zy};ot.default=zB,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.shake256=Qt.shake128=Qt.keccak_512=Qt.keccak_384=Qt.keccak_256=Qt.keccak_224=Qt.sha3_512=Qt.sha3_384=Qt.sha3_256=Qt.sha3_224=Qt.Keccak=Qt.keccakP=void 0;const Jo=Hr,Xa=ot,Ja=Pi,[Vy,Wy,Ky]=[[],[],[]],qB=BigInt(0),Qa=BigInt(1),VB=BigInt(2),WB=BigInt(7),KB=BigInt(256),ZB=BigInt(113);for(let e=0,t=Qa,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Vy.push(2*(5*n+r)),Wy.push((e+1)*(e+2)/2%64);let i=qB;for(let s=0;s<7;s++)t=(t<>WB)*ZB)%KB,t&VB&&(i^=Qa<<(Qa<r>32?(0,Xa.rotlBH)(e,t,r):(0,Xa.rotlSH)(e,t,r),Gy=(e,t,r)=>r>32?(0,Xa.rotlBL)(e,t,r):(0,Xa.rotlSL)(e,t,r);function Yy(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)r[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],y=Zy(u,l,1)^r[a],A=Gy(u,l,1)^r[a+1];for(let v=0;v<50;v+=10)e[o+v]^=y,e[o+v+1]^=A}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=Wy[o],c=Zy(i,s,a),u=Gy(i,s,a),l=Vy[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=GB[n],e[1]^=YB[n]}r.fill(0)}Qt.keccakP=Yy;class ec extends Ja.Hash{constructor(t,r,n,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Jo.number)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Ja.u32)(this.state)}keccak(){Yy(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){(0,Jo.exists)(this);const{blockLen:r,state:n}=this;t=(0,Ja.toBytes)(t);const i=t.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,Jo.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,Jo.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new ec(r,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}Qt.Keccak=ec;const gs=(e,t,r)=>(0,Ja.wrapConstructor)(()=>new ec(t,e,r));Qt.sha3_224=gs(6,144,224/8),Qt.sha3_256=gs(6,136,256/8),Qt.sha3_384=gs(6,104,384/8),Qt.sha3_512=gs(6,72,512/8),Qt.keccak_224=gs(1,144,224/8),Qt.keccak_256=gs(1,136,256/8),Qt.keccak_384=gs(1,104,384/8),Qt.keccak_512=gs(1,72,512/8);const Xy=(e,t,r)=>(0,Ja.wrapXOFConstructorWithOpts)((n={})=>new ec(t,e,n.dkLen===void 0?r:n.dkLen,!0));Qt.shake128=Xy(31,168,128/8),Qt.shake256=Xy(31,136,256/8);function ud(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var fu={exports:{}};(function(e,t){var r=ft&&ft.__importDefault||function(A){return A&&A.__esModule?A:{default:A}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.wrapHash=t.equalsBytes=t.hexToBytes=t.bytesToUtf8=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0;const n=r(Hr),i=Pi,s=n.default.bool;t.assertBool=s;const o=n.default.bytes;t.assertBytes=o;var a=Pi;Object.defineProperty(t,"bytesToHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"toHex",{enumerable:!0,get:function(){return a.bytesToHex}}),Object.defineProperty(t,"concatBytes",{enumerable:!0,get:function(){return a.concatBytes}}),Object.defineProperty(t,"createView",{enumerable:!0,get:function(){return a.createView}}),Object.defineProperty(t,"utf8ToBytes",{enumerable:!0,get:function(){return a.utf8ToBytes}});function c(A){if(!(A instanceof Uint8Array))throw new TypeError(`bytesToUtf8 expected Uint8Array, got ${typeof A}`);return new TextDecoder().decode(A)}t.bytesToUtf8=c;function u(A){const v=A.startsWith("0x")?A.substring(2):A;return(0,i.hexToBytes)(v)}t.hexToBytes=u;function l(A,v){if(A.length!==v.length)return!1;for(let R=0;R(n.default.bytes(v),A(v))}t.wrapHash=y,t.crypto=(()=>{const A=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,v=typeof ud=="function"&&ud.bind(e);return{node:v&&!A?v("crypto"):void 0,web:A}})()})(fu,fu.exports),Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.keccak512=Wn.keccak384=Wn.keccak256=Wn.keccak224=void 0;const tc=Qt,uu=fu.exports;Wn.keccak224=(0,uu.wrapHash)(tc.keccak_224),Wn.keccak256=(()=>{const e=(0,uu.wrapHash)(tc.keccak_256);return e.create=tc.keccak_256.create,e})(),Wn.keccak384=(0,uu.wrapHash)(tc.keccak_384),Wn.keccak512=(0,uu.wrapHash)(tc.keccak_512);var eo={},Kn={},er={};Object.defineProperty(er,"__esModule",{value:!0}),er.isHexString=er.getKeys=er.fromAscii=er.fromUtf8=er.toAscii=er.arrayContainsArray=er.getBinarySize=er.padToEven=er.stripHexPrefix=er.isHexPrefixed=void 0;function Jy(e){if(typeof e!="string")throw new Error(`[isHexPrefixed] input must be type 'string', received type ${typeof e}`);return e[0]==="0"&&e[1]==="x"}er.isHexPrefixed=Jy;const XB=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return Jy(e)?e.slice(2):e};er.stripHexPrefix=XB;function Qy(e){let t=e;if(typeof t!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof t}`);return t.length%2&&(t=`0${t}`),t}er.padToEven=Qy;function JB(e){if(typeof e!="string")throw new Error(`[getBinarySize] method requires input type 'string', received ${typeof e}`);return ie.Buffer.byteLength(e,"utf8")}er.getBinarySize=JB;function QB(e,t,r){if(Array.isArray(e)!==!0)throw new Error(`[arrayContainsArray] method requires input 'superset' to be an array, got type '${typeof e}'`);if(Array.isArray(t)!==!0)throw new Error(`[arrayContainsArray] method requires input 'subset' to be an array, got type '${typeof t}'`);return t[r===!0?"some":"every"](n=>e.indexOf(n)>=0)}er.arrayContainsArray=QB;function eI(e){let t="",r=0;const n=e.length;for(e.substring(0,2)==="0x"&&(r=2);r0&&e.length!==2+2*t)}er.isHexString=iI,Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.assertIsString=Kn.assertIsArray=Kn.assertIsBuffer=Kn.assertIsHexString=void 0;const sI=er,oI=function(e){if(!(0,sI.isHexString)(e)){const t=`This method only supports 0x-prefixed hex strings but input was: ${e}`;throw new Error(t)}};Kn.assertIsHexString=oI;const aI=function(e){if(!ie.Buffer.isBuffer(e)){const t=`This method only supports Buffer but input was: ${e}`;throw new Error(t)}};Kn.assertIsBuffer=aI;const cI=function(e){if(!Array.isArray(e)){const t=`This method only supports number arrays but input was: ${e}`;throw new Error(t)}};Kn.assertIsArray=cI;const fI=function(e){if(typeof e!="string"){const t=`This method only supports strings but input was: ${e}`;throw new Error(t)}};Kn.assertIsString=fI,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.intToUnpaddedBuffer=e.bigIntToUnpaddedBuffer=e.bigIntToHex=e.bufArrToArr=e.arrToBufArr=e.validateNoLeadingZeroes=e.baToJSON=e.toUtf8=e.short=e.addHexPrefix=e.toUnsigned=e.fromSigned=e.bufferToInt=e.bigIntToBuffer=e.bufferToBigInt=e.bufferToHex=e.toBuffer=e.unpadHexString=e.unpadArray=e.unpadBuffer=e.setLengthRight=e.setLengthLeft=e.zeros=e.intToBuffer=e.intToHex=void 0;const t=Kn,r=er,n=function(f){if(!Number.isSafeInteger(f)||f<0)throw new Error(`Received an invalid integer type: ${f}`);return`0x${f.toString(16)}`};e.intToHex=n;const i=function(f){const h=(0,e.intToHex)(f);return ie.Buffer.from((0,r.padToEven)(h.slice(2)),"hex")};e.intToBuffer=i;const s=function(f){return ie.Buffer.allocUnsafe(f).fill(0)};e.zeros=s;const o=function(f,h,m){const _=(0,e.zeros)(h);return m?f.length0&&h.toString()==="0";)f=f.slice(1),h=f[0];return f},l=function(f){return(0,t.assertIsBuffer)(f),u(f)};e.unpadBuffer=l;const y=function(f){return(0,t.assertIsArray)(f),u(f)};e.unpadArray=y;const A=function(f){return(0,t.assertIsHexString)(f),f=(0,r.stripHexPrefix)(f),"0x"+u(f)};e.unpadHexString=A;const v=function(f){if(f==null)return ie.Buffer.allocUnsafe(0);if(ie.Buffer.isBuffer(f)||Array.isArray(f)||f instanceof Uint8Array)return ie.Buffer.from(f);if(typeof f=="string"){if(!(0,r.isHexString)(f))throw new Error(`Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: ${f}`);return ie.Buffer.from((0,r.padToEven)((0,r.stripHexPrefix)(f)),"hex")}if(typeof f=="number")return(0,e.intToBuffer)(f);if(typeof f=="bigint"){if(f0&&m[0]===0)throw new Error(`${h} cannot have leading zeroes, received: ${m.toString("hex")}`)};e.validateNoLeadingZeroes=z;function ee(f){return Array.isArray(f)?f.map(h=>ee(h)):ie.Buffer.from(f)}e.arrToBufArr=ee;function se(f){return Array.isArray(f)?f.map(h=>se(h)):Uint8Array.from(f??[])}e.bufArrToArr=se;const Q=f=>"0x"+f.toString(16);e.bigIntToHex=Q;function I(f){return(0,e.unpadBuffer)(P(f))}e.bigIntToUnpaddedBuffer=I;function g(f){return(0,e.unpadBuffer)((0,e.intToBuffer)(f))}e.intToUnpaddedBuffer=g}(eo),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.accountBodyToRLP=e.accountBodyToSlim=e.accountBodyFromSlim=e.isZeroAddress=e.zeroAddress=e.importPublic=e.privateToAddress=e.privateToPublic=e.publicToAddress=e.pubToAddress=e.isValidPublic=e.isValidPrivate=e.generateAddress2=e.generateAddress=e.isValidChecksumAddress=e.toChecksumAddress=e.isValidAddress=e.Account=void 0;const t=vi,r=Wn,n=Qf,i=fu.exports,s=eo,o=Jf,a=Kn,c=er,u=BigInt(0);class l{constructor(g=u,f=u,h=o.KECCAK256_RLP,m=o.KECCAK256_NULL){this.nonce=g,this.balance=f,this.storageRoot=h,this.codeHash=m,this._validate()}static fromAccountData(g){const{nonce:f,balance:h,storageRoot:m,codeHash:_}=g;return new l(f!==void 0?(0,s.bufferToBigInt)((0,s.toBuffer)(f)):void 0,h!==void 0?(0,s.bufferToBigInt)((0,s.toBuffer)(h)):void 0,m!==void 0?(0,s.toBuffer)(m):void 0,_!==void 0?(0,s.toBuffer)(_):void 0)}static fromRlpSerializedAccount(g){const f=(0,s.arrToBufArr)(t.RLP.decode(Uint8Array.from(g)));if(!Array.isArray(f))throw new Error("Invalid serialized account input. Must be array");return this.fromValuesArray(f)}static fromValuesArray(g){const[f,h,m,_]=g;return new l((0,s.bufferToBigInt)(f),(0,s.bufferToBigInt)(h),m,_)}_validate(){if(this.nonce=8?E+=f[x].toUpperCase():E+=f[x];return E};e.toChecksumAddress=A;const v=function(I,g){return(0,e.isValidAddress)(I)&&(0,e.toChecksumAddress)(I,g)===I};e.isValidChecksumAddress=v;const R=function(I,g){return(0,a.assertIsBuffer)(I),(0,a.assertIsBuffer)(g),(0,s.bufferToBigInt)(g)===BigInt(0)?ie.Buffer.from((0,r.keccak256)(t.RLP.encode((0,s.bufArrToArr)([I,null])))).slice(-20):ie.Buffer.from((0,r.keccak256)(t.RLP.encode((0,s.bufArrToArr)([I,g])))).slice(-20)};e.generateAddress=R;const O=function(I,g,f){if((0,a.assertIsBuffer)(I),(0,a.assertIsBuffer)(g),(0,a.assertIsBuffer)(f),I.length!==20)throw new Error("Expected from to be of length 20");if(g.length!==32)throw new Error("Expected salt to be of length 32");const h=(0,r.keccak256)(ie.Buffer.concat([ie.Buffer.from("ff","hex"),I,g,(0,r.keccak256)(f)]));return(0,s.toBuffer)(h).slice(-20)};e.generateAddress2=O;const P=function(I){return n.secp256k1.utils.isValidPrivateKey(I)};e.isValidPrivate=P;const H=function(I,g=!1){if((0,a.assertIsBuffer)(I),I.length===64)try{return n.secp256k1.ProjectivePoint.fromHex(ie.Buffer.concat([ie.Buffer.from([4]),I])),!0}catch{return!1}if(!g)return!1;try{return n.secp256k1.ProjectivePoint.fromHex(I),!0}catch{return!1}};e.isValidPublic=H;const F=function(I,g=!1){if((0,a.assertIsBuffer)(I),g&&I.length!==64&&(I=ie.Buffer.from(n.secp256k1.ProjectivePoint.fromHex(I).toRawBytes(!1).slice(1))),I.length!==64)throw new Error("Expected pubKey to be of length 64");return ie.Buffer.from((0,r.keccak256)(I)).slice(-20)};e.pubToAddress=F,e.publicToAddress=e.pubToAddress;const N=function(I){return(0,a.assertIsBuffer)(I),ie.Buffer.from(n.secp256k1.ProjectivePoint.fromPrivateKey(I).toRawBytes(!1).slice(1))};e.privateToPublic=N;const $=function(I){return(0,e.publicToAddress)((0,e.privateToPublic)(I))};e.privateToAddress=$;const q=function(I){return(0,a.assertIsBuffer)(I),I.length!==64&&(I=ie.Buffer.from(n.secp256k1.ProjectivePoint.fromHex(I).toRawBytes(!1).slice(1))),I};e.importPublic=q;const G=function(){const g=(0,s.zeros)(20);return(0,s.bufferToHex)(g)};e.zeroAddress=G;const Z=function(I){try{(0,a.assertIsString)(I)}catch{return!1}return(0,e.zeroAddress)()===I};e.isZeroAddress=Z;function z(I){const[g,f,h,m]=I;return[g,f,(0,s.arrToBufArr)(h).length===0?o.KECCAK256_RLP:h,(0,s.arrToBufArr)(m).length===0?o.KECCAK256_NULL:m]}e.accountBodyFromSlim=z;const ee=new Uint8Array(0);function se(I){const[g,f,h,m]=I;return[g,f,(0,s.arrToBufArr)(h).equals(o.KECCAK256_RLP)?ee:h,(0,s.arrToBufArr)(m).equals(o.KECCAK256_NULL)?ee:m]}e.accountBodyToSlim=se;function Q(I,g=!0){const f=g?z(I):I;return(0,s.arrToBufArr)(t.RLP.encode(f))}e.accountBodyToRLP=Q}(nd);var rc={};Object.defineProperty(rc,"__esModule",{value:!0}),rc.Address=void 0;const nc=nd,lu=eo;class Fi{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new Fi((0,lu.zeros)(20))}static fromString(t){if(!(0,nc.isValidAddress)(t))throw new Error("Invalid address");return new Fi((0,lu.toBuffer)(t))}static fromPublicKey(t){if(!ie.Buffer.isBuffer(t))throw new Error("Public key should be Buffer");const r=(0,nc.pubToAddress)(t);return new Fi(r)}static fromPrivateKey(t){if(!ie.Buffer.isBuffer(t))throw new Error("Private key should be Buffer");const r=(0,nc.privateToAddress)(t);return new Fi(r)}static generate(t,r){if(typeof r!="bigint")throw new Error("Expected nonce to be a bigint");return new Fi((0,nc.generateAddress)(t.buf,(0,lu.bigIntToBuffer)(r)))}static generate2(t,r,n){if(!ie.Buffer.isBuffer(r))throw new Error("Expected salt to be a Buffer");if(!ie.Buffer.isBuffer(n))throw new Error("Expected initCode to be a Buffer");return new Fi((0,nc.generateAddress2)(t.buf,r,n))}equals(t){return this.buf.equals(t.buf)}isZero(){return this.equals(Fi.zero())}isPrecompileOrSystemAddress(){const t=(0,lu.bufferToBigInt)(this.buf),r=BigInt(0),n=BigInt("0xffff");return t>=r&&t<=n}toString(){return"0x"+this.buf.toString("hex")}toBuffer(){return ie.Buffer.from(this.buf)}}rc.Address=Fi;var hu={},ld={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.toType=e.TypeOutput=void 0;const t=eo,r=er;var n;(function(s){s[s.Number=0]="Number",s[s.BigInt=1]="BigInt",s[s.Buffer=2]="Buffer",s[s.PrefixedHexString=3]="PrefixedHexString"})(n=e.TypeOutput||(e.TypeOutput={}));function i(s,o){if(s===null)return null;if(s===void 0)return;if(typeof s=="string"&&!(0,r.isHexString)(s))throw new Error(`A string must be provided with a 0x-prefix, given: ${s}`);if(typeof s=="number"&&!Number.isSafeInteger(s))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative input type)");const a=(0,t.toBuffer)(s);switch(o){case n.Buffer:return a;case n.BigInt:return(0,t.bufferToBigInt)(a);case n.Number:{const c=(0,t.bufferToBigInt)(a);if(c>BigInt(Number.MAX_SAFE_INTEGER))throw new Error("The provided number is greater than MAX_SAFE_INTEGER (please use an alternative output type)");return Number(c)}case n.PrefixedHexString:return(0,t.bufferToHex)(a);default:throw new Error("unknown outputType")}}e.toType=i})(ld),Object.defineProperty(hu,"__esModule",{value:!0}),hu.Withdrawal=void 0;const ew=rc,hd=eo,br=ld;class ic{constructor(t,r,n,i){this.index=t,this.validatorIndex=r,this.address=n,this.amount=i}static fromWithdrawalData(t){const{index:r,validatorIndex:n,address:i,amount:s}=t,o=(0,br.toType)(r,br.TypeOutput.BigInt),a=(0,br.toType)(n,br.TypeOutput.BigInt),c=new ew.Address((0,br.toType)(i,br.TypeOutput.Buffer)),u=(0,br.toType)(s,br.TypeOutput.BigInt);return new ic(o,a,c,u)}static fromValuesArray(t){if(t.length!==4)throw Error(`Invalid withdrawalArray length expected=4 actual=${t.length}`);const[r,n,i,s]=t;return ic.fromWithdrawalData({index:r,validatorIndex:n,address:i,amount:s})}static toBufferArray(t){const{index:r,validatorIndex:n,address:i,amount:s}=t,o=(0,br.toType)(r,br.TypeOutput.BigInt)===BigInt(0)?ie.Buffer.alloc(0):(0,br.toType)(r,br.TypeOutput.Buffer),a=(0,br.toType)(n,br.TypeOutput.BigInt)===BigInt(0)?ie.Buffer.alloc(0):(0,br.toType)(n,br.TypeOutput.Buffer);let c;i instanceof ew.Address?c=i.buf:c=(0,br.toType)(i,br.TypeOutput.Buffer);const u=(0,br.toType)(s,br.TypeOutput.BigInt)===BigInt(0)?ie.Buffer.alloc(0):(0,br.toType)(s,br.TypeOutput.Buffer);return[o,a,c,u]}raw(){return ic.toBufferArray(this)}toValue(){return{index:this.index,validatorIndex:this.validatorIndex,address:this.address.buf,amount:this.amount}}toJSON(){return{index:(0,hd.bigIntToHex)(this.index),validatorIndex:(0,hd.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,hd.bigIntToHex)(this.amount)}}}hu.Withdrawal=ic;var an={};Object.defineProperty(an,"__esModule",{value:!0}),an.hashPersonalMessage=an.isValidSignature=an.fromRpcSig=an.toCompactSig=an.toRpcSig=an.ecrecover=an.ecsign=void 0;const uI=Wn,tw=Qf,bn=eo,dd=Jf,lI=Kn;function hI(e,t,r){const n=tw.secp256k1.sign(e,t),i=n.toCompactRawBytes(),s=ie.Buffer.from(i.slice(0,32)),o=ie.Buffer.from(i.slice(32,64)),a=r===void 0?BigInt(n.recovery+27):BigInt(n.recovery+35)+BigInt(r)*BigInt(2);return{r:s,s:o,v:a}}an.ecsign=hI;function du(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function pu(e){return e===BigInt(0)||e===BigInt(1)}const dI=function(e,t,r,n,i){const s=ie.Buffer.concat([(0,bn.setLengthLeft)(r,32),(0,bn.setLengthLeft)(n,32)],64),o=du(t,i);if(!pu(o))throw new Error("Invalid signature v value");const c=tw.secp256k1.Signature.fromCompact(s).addRecoveryBit(Number(o)).recoverPublicKey(e);return ie.Buffer.from(c.toRawBytes(!1).slice(1))};an.ecrecover=dI;const pI=function(e,t,r,n){const i=du(e,n);if(!pu(i))throw new Error("Invalid signature v value");return(0,bn.bufferToHex)(ie.Buffer.concat([(0,bn.setLengthLeft)(t,32),(0,bn.setLengthLeft)(r,32),(0,bn.toBuffer)(e)]))};an.toRpcSig=pI;const gI=function(e,t,r,n){const i=du(e,n);if(!pu(i))throw new Error("Invalid signature v value");let s=r;return(e>BigInt(28)&&e%BigInt(2)===BigInt(1)||e===BigInt(1)||e===BigInt(28))&&(s=ie.Buffer.from(r),s[0]|=128),(0,bn.bufferToHex)(ie.Buffer.concat([(0,bn.setLengthLeft)(t,32),(0,bn.setLengthLeft)(s,32)]))};an.toCompactSig=gI;const yI=function(e){const t=(0,bn.toBuffer)(e);let r,n,i;if(t.length>=65)r=t.slice(0,32),n=t.slice(32,64),i=(0,bn.bufferToBigInt)(t.slice(64));else if(t.length===64)r=t.slice(0,32),n=t.slice(32,64),i=BigInt((0,bn.bufferToInt)(t.slice(32,33))>>7),n[0]&=127;else throw new Error("Invalid signature length");return i<27&&(i=i+BigInt(27)),{v:i,r,s:n}};an.fromRpcSig=yI;const wI=function(e,t,r,n=!0,i){if(t.length!==32||r.length!==32||!pu(du(e,i)))return!1;const s=(0,bn.bufferToBigInt)(t),o=(0,bn.bufferToBigInt)(r);return!(s===BigInt(0)||s>=dd.SECP256K1_ORDER||o===BigInt(0)||o>=dd.SECP256K1_ORDER||n&&o>=dd.SECP256K1_ORDER_DIV_2)};an.isValidSignature=wI;const mI=function(e){(0,lI.assertIsBuffer)(e);const t=ie.Buffer.from(`Ethereum Signed Message: +${e.length}`,"utf-8");return ie.Buffer.from((0,uI.keccak256)(ie.Buffer.concat([t,e])))};an.hashPersonalMessage=mI;var rw={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.compactBytesToNibbles=e.bytesToNibbles=e.nibblesToCompactBytes=e.nibblesToBytes=e.hasTerminator=void 0;const t=o=>o.length>0&&o[o.length-1]===16;e.hasTerminator=t;const r=(o,a)=>{for(let c=0,u=0;u{let a=0;(0,e.hasTerminator)(o)&&(a=1,o=o.subarray(0,o.length-1));const c=new Uint8Array(o.length/2+1);return c[0]=a<<5,(o.length&1)===1&&(c[0]|=16,c[0]|=o[0],o=o.subarray(1)),(0,e.nibblesToBytes)(o,c.subarray(1)),c};e.nibblesToCompactBytes=n;const i=o=>{const a=o.length*2+1,c=new Uint8Array(a);for(let u=0;u{if(o.length===0)return o;let a=(0,e.bytesToNibbles)(o);a[0]<2&&(a=a.subarray(0,a.length-1));const c=2-(a[0]&1);return a.subarray(c)};e.compactBytesToNibbles=s})(rw);var gu={};Object.defineProperty(gu,"__esModule",{value:!0}),gu.AsyncEventEmitter=void 0;const bI=Dn.exports;async function vI(e,t,r){let n;for await(const i of t)try{i.length<2?i.call(e,r):await new Promise((s,o)=>{i.call(e,r,a=>{a?o(a):s()})})}catch(s){n=s}if(n)throw n}class _I extends bI.EventEmitter{emit(t,...r){let[n,i]=r;const s=this;let o=s._events[t]??[];return i===void 0&&typeof n=="function"&&(i=n,n=void 0),(t==="newListener"||t==="removeListener")&&(n={event:n,fn:i},i=void 0),o=Array.isArray(o)?o:[o],vI(s,o.slice(),n).then(i).catch(i),s.listenerCount(t)>0}once(t,r){const n=this;let i;if(typeof r!="function")throw new TypeError("listener must be a function");return r.length>=2?i=function(s,o){n.removeListener(t,i),r(s,o)}:i=function(s){n.removeListener(t,i),r(s,i)},n.on(t,i),n}first(t,r){let n=this._events[t]??[];if(typeof r!="function")throw new TypeError("listener must be a function");return Array.isArray(n)||(this._events[t]=n=[n]),n.unshift(r),this}before(t,r,n){return this.beforeOrAfter(t,r,n)}after(t,r,n){return this.beforeOrAfter(t,r,n,"after")}beforeOrAfter(t,r,n,i){let s=this._events[t]??[],o,a;const c=i==="after"?1:0;if(typeof n!="function")throw new TypeError("listener must be a function");if(typeof r!="function")throw new TypeError("target must be a function");for(Array.isArray(s)||(this._events[t]=s=[s]),a=s.length,o=s.length;o--;)if(s[o]===r){a=o+c;break}return s.splice(a,0,n),this}on(t,r){return super.on(t,r)}addListener(t,r){return super.addListener(t,r)}prependListener(t,r){return super.prependListener(t,r)}prependOnceListener(t,r){return super.prependOnceListener(t,r)}removeAllListeners(t){return super.removeAllListeners(t)}removeListener(t,r){return super.removeListener(t,r)}eventNames(){return super.eventNames()}listeners(t){return super.listeners(t)}listenerCount(t){return super.listenerCount(t)}getMaxListeners(){return super.getMaxListeners()}setMaxListeners(t){return super.setMaxListeners(t)}}gu.AsyncEventEmitter=_I;var yu={};Object.defineProperty(yu,"__esModule",{value:!0}),yu.Lock=void 0;class EI{constructor(){this.permits=1,this.promiseResolverQueue=[]}async acquire(){return this.permits>0?(this.permits-=1,Promise.resolve(!0)):new Promise(t=>this.promiseResolverQueue.push(t))}release(){if(this.permits+=1,this.permits>1&&this.promiseResolverQueue.length>0)console.warn("Lock.permits should never be > 0 when there is someone waiting.");else if(this.permits===1&&this.promiseResolverQueue.length>0){this.permits-=1;const t=this.promiseResolverQueue.shift();t&&t(!0)}}}yu.Lock=EI;var Qo={},to={},pr=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},_i=[],Zn=[],xI=typeof Uint8Array<"u"?Uint8Array:Array,pd=!1;function nw(){pd=!0;for(var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t=0,r=e.length;t0)throw new Error("Invalid string. Length must be a multiple of 4");s=e[a-2]==="="?2:e[a-1]==="="?1:0,o=new xI(a*3/4-s),n=s>0?a-4:a;var c=0;for(t=0,r=0;t>16&255,o[c++]=i>>8&255,o[c++]=i&255;return s===2?(i=Zn[e.charCodeAt(t)]<<2|Zn[e.charCodeAt(t+1)]>>4,o[c++]=i&255):s===1&&(i=Zn[e.charCodeAt(t)]<<10|Zn[e.charCodeAt(t+1)]<<4|Zn[e.charCodeAt(t+2)]>>2,o[c++]=i>>8&255,o[c++]=i&255),o}function AI(e){return _i[e>>18&63]+_i[e>>12&63]+_i[e>>6&63]+_i[e&63]}function BI(e,t,r){for(var n,i=[],s=t;sc?c:a+o));return n===1?(t=e[r-1],i+=_i[t>>2],i+=_i[t<<4&63],i+="=="):n===2&&(t=(e[r-2]<<8)+e[r-1],i+=_i[t>>10],i+=_i[t>>4&63],i+=_i[t<<2&63],i+="="),s.push(i),s.join("")}function wu(e,t,r,n,i){var s,o,a=i*8-n-1,c=(1<>1,l=-7,y=r?i-1:0,A=r?-1:1,v=e[t+y];for(y+=A,s=v&(1<<-l)-1,v>>=-l,l+=a;l>0;s=s*256+e[t+y],y+=A,l-=8);for(o=s&(1<<-l)-1,s>>=-l,l+=n;l>0;o=o*256+e[t+y],y+=A,l-=8);if(s===0)s=1-u;else{if(s===c)return o?NaN:(v?-1:1)*(1/0);o=o+Math.pow(2,n),s=s-u}return(v?-1:1)*o*Math.pow(2,s-n)}function sw(e,t,r,n,i,s){var o,a,c,u=s*8-i-1,l=(1<>1,A=i===23?Math.pow(2,-24)-Math.pow(2,-77):0,v=n?0:s-1,R=n?1:-1,O=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(a=isNaN(t)?1:0,o=l):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-o))<1&&(o--,c*=2),o+y>=1?t+=A/c:t+=A*Math.pow(2,1-y),t*c>=2&&(o++,c/=2),o+y>=l?(a=0,o=l):o+y>=1?(a=(t*c-1)*Math.pow(2,i),o=o+y):(a=t*Math.pow(2,y-1)*Math.pow(2,i),o=0));i>=8;e[r+v]=a&255,v+=R,a/=256,i-=8);for(o=o<0;e[r+v]=o&255,v+=R,o/=256,u-=8);e[r+v-R]|=O*128}var II={}.toString,ow=Array.isArray||function(e){return II.call(e)=="[object Array]"};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */var DI=50;le.TYPED_ARRAY_SUPPORT=pr.TYPED_ARRAY_SUPPORT!==void 0?pr.TYPED_ARRAY_SUPPORT:!0,Eu();function Eu(){return le.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Hi(e,t){if(Eu()=Eu())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Eu().toString(16)+" bytes");return e|0}le.isBuffer=u8;function Ei(e){return!!(e!=null&&e._isBuffer)}le.compare=function(t,r){if(!Ei(t)||!Ei(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,i=r.length,s=0,o=Math.min(n,i);s>>1;case"base64":return Rw(e).length;default:if(n)return Au(e).length;t=(""+t).toLowerCase(),n=!0}}le.byteLength=bw;function VI(e,t,r){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return t8(this,t,r);case"utf8":case"utf-8":return xw(this,t,r);case"ascii":return QI(this,t,r);case"latin1":case"binary":return e8(this,t,r);case"base64":return XI(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r8(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}le.prototype._isBuffer=!0;function no(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}le.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},le.prototype.compare=function(t,r,n,i,s){if(!Ei(t))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,a=n-r,c=Math.min(o,a),u=this.slice(i,s),l=t.slice(r,n),y=0;y2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=le.from(t,n)),Ei(t))return t.length===0?-1:_w(e,t,r,n,i);if(typeof t=="number")return t=t&255,le.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):_w(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function _w(e,t,r,n,i){var s=1,o=e.length,a=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;s=2,o/=2,a/=2,r/=2}function c(v,R){return s===1?v[R]:v.readUInt16BE(R*s)}var u;if(i){var l=-1;for(u=r;uo&&(r=o-a),u=r;u>=0;u--){for(var y=!0,A=0;Ai&&(n=i)):n=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;os)&&(n=s),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return WI(this,t,r,n);case"utf8":case"utf-8":return KI(this,t,r,n);case"ascii":return Ew(this,t,r,n);case"latin1":case"binary":return ZI(this,t,r,n);case"base64":return GI(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return YI(this,t,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},le.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function XI(e,t,r){return t===0&&r===e.length?pw(e):pw(e.slice(t,r))}function xw(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var c,u,l,y;switch(a){case 1:s<128&&(o=s);break;case 2:c=e[i+1],(c&192)===128&&(y=(s&31)<<6|c&63,y>127&&(o=y));break;case 3:c=e[i+1],u=e[i+2],(c&192)===128&&(u&192)===128&&(y=(s&15)<<12|(c&63)<<6|u&63,y>2047&&(y<55296||y>57343)&&(o=y));break;case 4:c=e[i+1],u=e[i+2],l=e[i+3],(c&192)===128&&(u&192)===128&&(l&192)===128&&(y=(s&15)<<18|(c&63)<<12|(u&63)<<6|l&63,y>65535&&y<1114112&&(o=y))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return JI(n)}var Sw=4096;function JI(e){var t=e.length;if(t<=Sw)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",s=t;sn&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}le.prototype.readUIntLE=function(t,r,n){t=t|0,r=r|0,n||zr(t,r,this.length);for(var i=this[t],s=1,o=0;++o0&&(s*=256);)i+=this[t+--r]*s;return i},le.prototype.readUInt8=function(t,r){return r||zr(t,1,this.length),this[t]},le.prototype.readUInt16LE=function(t,r){return r||zr(t,2,this.length),this[t]|this[t+1]<<8},le.prototype.readUInt16BE=function(t,r){return r||zr(t,2,this.length),this[t]<<8|this[t+1]},le.prototype.readUInt32LE=function(t,r){return r||zr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},le.prototype.readUInt32BE=function(t,r){return r||zr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},le.prototype.readIntLE=function(t,r,n){t=t|0,r=r|0,n||zr(t,r,this.length);for(var i=this[t],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i},le.prototype.readIntBE=function(t,r,n){t=t|0,r=r|0,n||zr(t,r,this.length);for(var i=r,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o},le.prototype.readInt8=function(t,r){return r||zr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},le.prototype.readInt16LE=function(t,r){r||zr(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},le.prototype.readInt16BE=function(t,r){r||zr(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},le.prototype.readInt32LE=function(t,r){return r||zr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},le.prototype.readInt32BE=function(t,r){return r||zr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},le.prototype.readFloatLE=function(t,r){return r||zr(t,4,this.length),_u(this,t,!0,23,4)},le.prototype.readFloatBE=function(t,r){return r||zr(t,4,this.length),_u(this,t,!1,23,4)},le.prototype.readDoubleLE=function(t,r){return r||zr(t,8,this.length),_u(this,t,!0,52,8)},le.prototype.readDoubleBE=function(t,r){return r||zr(t,8,this.length),_u(this,t,!1,52,8)};function vn(e,t,r,n,i,s){if(!Ei(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}le.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;vn(this,t,r,n,s,0)}var o=1,a=0;for(this[r]=t&255;++a=0&&(a*=256);)this[r+o]=t/a&255;return r+n},le.prototype.writeUInt8=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,1,255,0),le.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=t&255,r+1};function xu(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);i>>(n?i:1-i)*8}le.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8):xu(this,t,r,!0),r+2},le.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=t&255):xu(this,t,r,!1),r+2};function Su(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);i>>(n?i:3-i)*8&255}le.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255):Su(this,t,r,!0),r+4},le.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255):Su(this,t,r,!1),r+4},le.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r|0,!i){var s=Math.pow(2,8*n-1);vn(this,t,r,n,s-1,-s)}var o=0,a=1,c=0;for(this[r]=t&255;++o>0)-c&255;return r+n},le.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r|0,!i){var s=Math.pow(2,8*n-1);vn(this,t,r,n,s-1,-s)}var o=n-1,a=1,c=0;for(this[r+o]=t&255;--o>=0&&(a*=256);)t<0&&c===0&&this[r+o+1]!==0&&(c=1),this[r+o]=(t/a>>0)-c&255;return r+n},le.prototype.writeInt8=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,1,127,-128),le.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=t&255,r+1},le.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8):xu(this,t,r,!0),r+2},le.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=t&255):xu(this,t,r,!1),r+2},le.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,2147483647,-2147483648),le.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):Su(this,t,r,!0),r+4},le.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255):Su(this,t,r,!1),r+4};function Aw(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function Bw(e,t,r,n,i){return i||Aw(e,t,r,4),gw(e,t,r,n,23,4),r+4}le.prototype.writeFloatLE=function(t,r,n){return Bw(this,t,r,!0,n)},le.prototype.writeFloatBE=function(t,r,n){return Bw(this,t,r,!1,n)};function Iw(e,t,r,n,i){return i||Aw(e,t,r,8),gw(e,t,r,n,52,8),r+8}le.prototype.writeDoubleLE=function(t,r,n){return Iw(this,t,r,!0,n)},le.prototype.writeDoubleBE=function(t,r,n){return Iw(this,t,r,!1,n)},le.prototype.copy=function(t,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(s<1e3||!le.TYPED_ARRAY_SUPPORT)for(o=0;o>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var o;if(typeof t=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function a8(e){for(var t=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Rw(e){return NI(i8(e))}function Bu(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function f8(e){return e!==e}function u8(e){return e!=null&&(!!e._isBuffer||Tw(e)||l8(e))}function Tw(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function l8(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&Tw(e.slice(0,0))}function kw(){throw new Error("setTimeout has not been defined")}function Cw(){throw new Error("clearTimeout has not been defined")}var ws=kw,ms=Cw;typeof pr.setTimeout=="function"&&(ws=setTimeout),typeof pr.clearTimeout=="function"&&(ms=clearTimeout);function Lw(e){if(ws===setTimeout)return setTimeout(e,0);if((ws===kw||!ws)&&setTimeout)return ws=setTimeout,setTimeout(e,0);try{return ws(e,0)}catch{try{return ws.call(null,e,0)}catch{return ws.call(this,e,0)}}}function h8(e){if(ms===clearTimeout)return clearTimeout(e);if((ms===Cw||!ms)&&clearTimeout)return ms=clearTimeout,clearTimeout(e);try{return ms(e)}catch{try{return ms.call(null,e)}catch{return ms.call(this,e)}}}var ji=[],na=!1,io,Iu=-1;function d8(){!na||!io||(na=!1,io.length?ji=io.concat(ji):Iu=-1,ji.length&&$w())}function $w(){if(!na){var e=Lw(d8);na=!0;for(var t=ji.length;t;){for(io=ji,ji=[];++Iu1)for(var r=1;r=i)return a;switch(a){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return a}}),o=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Lu(t)?r.showHidden=t:t&&Md(r,t),Si(r.showHidden)&&(r.showHidden=!1),Si(r.depth)&&(r.depth=2),Si(r.colors)&&(r.colors=!1),Si(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=V8),Cu(r,e,r.depth)}xi.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},xi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function V8(e,t){var r=xi.styles[t];return r?"\x1B["+xi.colors[r][0]+"m"+e+"\x1B["+xi.colors[r][1]+"m":e}function W8(e,t){return e}function K8(e){var t={};return e.forEach(function(r,n){t[r]=!0}),t}function Cu(e,t,r){if(e.customInspect&&t&&hc(t.inspect)&&t.inspect!==xi&&!(t.constructor&&t.constructor.prototype===t)){var n=t.inspect(r,e);return bs(n)||(n=Cu(e,n,r)),n}var i=Z8(e,t);if(i)return i;var s=Object.keys(t),o=K8(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),lc(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Rd(t);if(s.length===0){if(hc(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(uc(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if($u(t))return e.stylize(Date.prototype.toString.call(t),"date");if(lc(t))return Rd(t)}var c="",u=!1,l=["{","}"];if(kd(t)&&(u=!0,l=["[","]"]),hc(t)){var y=t.name?": "+t.name:"";c=" [Function"+y+"]"}if(uc(t)&&(c=" "+RegExp.prototype.toString.call(t)),$u(t)&&(c=" "+Date.prototype.toUTCString.call(t)),lc(t)&&(c=" "+Rd(t)),s.length===0&&(!u||t.length==0))return l[0]+c+l[1];if(r<0)return uc(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var A;return u?A=G8(e,t,r,o,s):A=s.map(function(v){return Td(e,t,r,o,v,u)}),e.seen.pop(),Y8(A,c,l)}function Z8(e,t){if(Si(t))return e.stylize("undefined","undefined");if(bs(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(Ld(t))return e.stylize(""+t,"number");if(Lu(t))return e.stylize(""+t,"boolean");if(zi(t))return e.stylize("null","null")}function Rd(e){return"["+Error.prototype.toString.call(e)+"]"}function G8(e,t,r,n,i){for(var s=[],o=0,a=t.length;o=mu())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+mu().toString(16)+" bytes");return e|0}le.isBuffer=JI;function Ei(e){return!!(e!=null&&e._isBuffer)}le.compare=function(t,r){if(!Ei(t)||!Ei(r))throw new TypeError("Arguments must be Buffers");if(t===r)return 0;for(var n=t.length,i=r.length,s=0,o=Math.min(n,i);s>>1;case"base64":return mw(e).length;default:if(n)return _u(e).length;t=(""+t).toLowerCase(),n=!0}}le.byteLength=fw;function $I(e,t,r){var n=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,t>>>=0,r<=t))return"";for(e||(e="utf8");;)switch(e){case"hex":return zI(this,t,r);case"utf8":case"utf-8":return dw(this,t,r);case"ascii":return HI(this,t,r);case"latin1":case"binary":return jI(this,t,r);case"base64":return FI(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return qI(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}le.prototype._isBuffer=!0;function ro(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}le.prototype.swap16=function(){var t=this.length;if(t%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var r=0;r0&&(t=this.toString("hex",0,r).match(/.{2}/g).join(" "),this.length>r&&(t+=" ... ")),""},le.prototype.compare=function(t,r,n,i,s){if(!Ei(t))throw new TypeError("Argument must be a Buffer");if(r===void 0&&(r=0),n===void 0&&(n=t?t.length:0),i===void 0&&(i=0),s===void 0&&(s=this.length),r<0||n>t.length||i<0||s>this.length)throw new RangeError("out of range index");if(i>=s&&r>=n)return 0;if(i>=s)return-1;if(r>=n)return 1;if(r>>>=0,n>>>=0,i>>>=0,s>>>=0,this===t)return 0;for(var o=s-i,a=n-r,c=Math.min(o,a),u=this.slice(i,s),l=t.slice(r,n),y=0;y2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,isNaN(r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0)if(i)r=0;else return-1;if(typeof t=="string"&&(t=le.from(t,n)),Ei(t))return t.length===0?-1:lw(e,t,r,n,i);if(typeof t=="number")return t=t&255,le.TYPED_ARRAY_SUPPORT&&typeof Uint8Array.prototype.indexOf=="function"?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):lw(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function lw(e,t,r,n,i){var s=1,o=e.length,a=t.length;if(n!==void 0&&(n=String(n).toLowerCase(),n==="ucs2"||n==="ucs-2"||n==="utf16le"||n==="utf-16le")){if(e.length<2||t.length<2)return-1;s=2,o/=2,a/=2,r/=2}function c(v,R){return s===1?v[R]:v.readUInt16BE(R*s)}var u;if(i){var l=-1;for(u=r;uo&&(r=o-a),u=r;u>=0;u--){for(var y=!0,A=0;Ai&&(n=i)):n=i;var s=t.length;if(s%2!==0)throw new TypeError("Invalid hex string");n>s/2&&(n=s/2);for(var o=0;os)&&(n=s),t.length>0&&(n<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");i||(i="utf8");for(var o=!1;;)switch(i){case"hex":return OI(this,t,r,n);case"utf8":case"utf-8":return MI(this,t,r,n);case"ascii":return hw(this,t,r,n);case"latin1":case"binary":return NI(this,t,r,n);case"base64":return PI(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return UI(this,t,r,n);default:if(o)throw new TypeError("Unknown encoding: "+i);i=(""+i).toLowerCase(),o=!0}},le.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function FI(e,t,r){return t===0&&r===e.length?iw(e):iw(e.slice(t,r))}function dw(e,t,r){r=Math.min(e.length,r);for(var n=[],i=t;i239?4:s>223?3:s>191?2:1;if(i+a<=r){var c,u,l,y;switch(a){case 1:s<128&&(o=s);break;case 2:c=e[i+1],(c&192)===128&&(y=(s&31)<<6|c&63,y>127&&(o=y));break;case 3:c=e[i+1],u=e[i+2],(c&192)===128&&(u&192)===128&&(y=(s&15)<<12|(c&63)<<6|u&63,y>2047&&(y<55296||y>57343)&&(o=y));break;case 4:c=e[i+1],u=e[i+2],l=e[i+3],(c&192)===128&&(u&192)===128&&(l&192)===128&&(y=(s&15)<<18|(c&63)<<12|(u&63)<<6|l&63,y>65535&&y<1114112&&(o=y))}}o===null?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|o&1023),n.push(o),i+=a}return DI(n)}var pw=4096;function DI(e){var t=e.length;if(t<=pw)return String.fromCharCode.apply(String,e);for(var r="",n=0;nn)&&(r=n);for(var i="",s=t;sn&&(t=n),r<0?(r+=n,r<0&&(r=0)):r>n&&(r=n),rr)throw new RangeError("Trying to access beyond buffer length")}le.prototype.readUIntLE=function(t,r,n){t=t|0,r=r|0,n||zr(t,r,this.length);for(var i=this[t],s=1,o=0;++o0&&(s*=256);)i+=this[t+--r]*s;return i},le.prototype.readUInt8=function(t,r){return r||zr(t,1,this.length),this[t]},le.prototype.readUInt16LE=function(t,r){return r||zr(t,2,this.length),this[t]|this[t+1]<<8},le.prototype.readUInt16BE=function(t,r){return r||zr(t,2,this.length),this[t]<<8|this[t+1]},le.prototype.readUInt32LE=function(t,r){return r||zr(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+this[t+3]*16777216},le.prototype.readUInt32BE=function(t,r){return r||zr(t,4,this.length),this[t]*16777216+(this[t+1]<<16|this[t+2]<<8|this[t+3])},le.prototype.readIntLE=function(t,r,n){t=t|0,r=r|0,n||zr(t,r,this.length);for(var i=this[t],s=1,o=0;++o=s&&(i-=Math.pow(2,8*r)),i},le.prototype.readIntBE=function(t,r,n){t=t|0,r=r|0,n||zr(t,r,this.length);for(var i=r,s=1,o=this[t+--i];i>0&&(s*=256);)o+=this[t+--i]*s;return s*=128,o>=s&&(o-=Math.pow(2,8*r)),o},le.prototype.readInt8=function(t,r){return r||zr(t,1,this.length),this[t]&128?(255-this[t]+1)*-1:this[t]},le.prototype.readInt16LE=function(t,r){r||zr(t,2,this.length);var n=this[t]|this[t+1]<<8;return n&32768?n|4294901760:n},le.prototype.readInt16BE=function(t,r){r||zr(t,2,this.length);var n=this[t+1]|this[t]<<8;return n&32768?n|4294901760:n},le.prototype.readInt32LE=function(t,r){return r||zr(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},le.prototype.readInt32BE=function(t,r){return r||zr(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},le.prototype.readFloatLE=function(t,r){return r||zr(t,4,this.length),wu(this,t,!0,23,4)},le.prototype.readFloatBE=function(t,r){return r||zr(t,4,this.length),wu(this,t,!1,23,4)},le.prototype.readDoubleLE=function(t,r){return r||zr(t,8,this.length),wu(this,t,!0,52,8)},le.prototype.readDoubleBE=function(t,r){return r||zr(t,8,this.length),wu(this,t,!1,52,8)};function vn(e,t,r,n,i,s){if(!Ei(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||te.length)throw new RangeError("Index out of range")}le.prototype.writeUIntLE=function(t,r,n,i){if(t=+t,r=r|0,n=n|0,!i){var s=Math.pow(2,8*n)-1;vn(this,t,r,n,s,0)}var o=1,a=0;for(this[r]=t&255;++a=0&&(a*=256);)this[r+o]=t/a&255;return r+n},le.prototype.writeUInt8=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,1,255,0),le.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[r]=t&255,r+1};function bu(e,t,r,n){t<0&&(t=65535+t+1);for(var i=0,s=Math.min(e.length-r,2);i>>(n?i:1-i)*8}le.prototype.writeUInt16LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8):bu(this,t,r,!0),r+2},le.prototype.writeUInt16BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,65535,0),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=t&255):bu(this,t,r,!1),r+2};function vu(e,t,r,n){t<0&&(t=4294967295+t+1);for(var i=0,s=Math.min(e.length-r,4);i>>(n?i:3-i)*8&255}le.prototype.writeUInt32LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[r+3]=t>>>24,this[r+2]=t>>>16,this[r+1]=t>>>8,this[r]=t&255):vu(this,t,r,!0),r+4},le.prototype.writeUInt32BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,4294967295,0),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255):vu(this,t,r,!1),r+4},le.prototype.writeIntLE=function(t,r,n,i){if(t=+t,r=r|0,!i){var s=Math.pow(2,8*n-1);vn(this,t,r,n,s-1,-s)}var o=0,a=1,c=0;for(this[r]=t&255;++o>0)-c&255;return r+n},le.prototype.writeIntBE=function(t,r,n,i){if(t=+t,r=r|0,!i){var s=Math.pow(2,8*n-1);vn(this,t,r,n,s-1,-s)}var o=n-1,a=1,c=0;for(this[r+o]=t&255;--o>=0&&(a*=256);)t<0&&c===0&&this[r+o+1]!==0&&(c=1),this[r+o]=(t/a>>0)-c&255;return r+n},le.prototype.writeInt8=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,1,127,-128),le.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[r]=t&255,r+1},le.prototype.writeInt16LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8):bu(this,t,r,!0),r+2},le.prototype.writeInt16BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,2,32767,-32768),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>8,this[r+1]=t&255):bu(this,t,r,!1),r+2},le.prototype.writeInt32LE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,2147483647,-2147483648),le.TYPED_ARRAY_SUPPORT?(this[r]=t&255,this[r+1]=t>>>8,this[r+2]=t>>>16,this[r+3]=t>>>24):vu(this,t,r,!0),r+4},le.prototype.writeInt32BE=function(t,r,n){return t=+t,r=r|0,n||vn(this,t,r,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),le.TYPED_ARRAY_SUPPORT?(this[r]=t>>>24,this[r+1]=t>>>16,this[r+2]=t>>>8,this[r+3]=t&255):vu(this,t,r,!1),r+4};function gw(e,t,r,n,i,s){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function yw(e,t,r,n,i){return i||gw(e,t,r,4),sw(e,t,r,n,23,4),r+4}le.prototype.writeFloatLE=function(t,r,n){return yw(this,t,r,!0,n)},le.prototype.writeFloatBE=function(t,r,n){return yw(this,t,r,!1,n)};function ww(e,t,r,n,i){return i||gw(e,t,r,8),sw(e,t,r,n,52,8),r+8}le.prototype.writeDoubleLE=function(t,r,n){return ww(this,t,r,!0,n)},le.prototype.writeDoubleBE=function(t,r,n){return ww(this,t,r,!1,n)},le.prototype.copy=function(t,r,n,i){if(n||(n=0),!i&&i!==0&&(i=this.length),r>=t.length&&(r=t.length),r||(r=0),i>0&&i=this.length)throw new RangeError("sourceStart out of bounds");if(i<0)throw new RangeError("sourceEnd out of bounds");i>this.length&&(i=this.length),t.length-r=0;--o)t[o+r]=this[o+n];else if(s<1e3||!le.TYPED_ARRAY_SUPPORT)for(o=0;o>>0,n=n===void 0?this.length:n>>>0,t||(t=0);var o;if(typeof t=="number")for(o=r;o55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&s.push(239,191,189);continue}else if(o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function GI(e){for(var t=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function mw(e){return SI(WI(e))}function Eu(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function XI(e){return e!==e}function JI(e){return e!=null&&(!!e._isBuffer||bw(e)||QI(e))}function bw(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function QI(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&bw(e.slice(0,0))}function vw(){throw new Error("setTimeout has not been defined")}function _w(){throw new Error("clearTimeout has not been defined")}var ys=vw,ws=_w;typeof pr.setTimeout=="function"&&(ys=setTimeout),typeof pr.clearTimeout=="function"&&(ws=clearTimeout);function Ew(e){if(ys===setTimeout)return setTimeout(e,0);if((ys===vw||!ys)&&setTimeout)return ys=setTimeout,setTimeout(e,0);try{return ys(e,0)}catch{try{return ys.call(null,e,0)}catch{return ys.call(this,e,0)}}}function e8(e){if(ws===clearTimeout)return clearTimeout(e);if((ws===_w||!ws)&&clearTimeout)return ws=clearTimeout,clearTimeout(e);try{return ws(e)}catch{try{return ws.call(null,e)}catch{return ws.call(this,e)}}}var Hi=[],ea=!1,no,xu=-1;function t8(){!ea||!no||(ea=!1,no.length?Hi=no.concat(Hi):xu=-1,Hi.length&&xw())}function xw(){if(!ea){var e=Ew(t8);ea=!0;for(var t=Hi.length;t;){for(no=Hi,Hi=[];++xu1)for(var r=1;r=i)return a;switch(a){case"%s":return String(n[r++]);case"%d":return Number(n[r++]);case"%j":try{return JSON.stringify(n[r++])}catch{return"[Circular]"}default:return a}}),o=n[r];r=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),Ru(t)?r.showHidden=t:t&&Cd(r,t),Si(r.showHidden)&&(r.showHidden=!1),Si(r.depth)&&(r.depth=2),Si(r.colors)&&(r.colors=!1),Si(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=$8),Iu(r,e,r.depth)}xi.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},xi.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function $8(e,t){var r=xi.styles[t];return r?"\x1B["+xi.colors[r][0]+"m"+e+"\x1B["+xi.colors[r][1]+"m":e}function O8(e,t){return e}function M8(e){var t={};return e.forEach(function(r,n){t[r]=!0}),t}function Iu(e,t,r){if(e.customInspect&&t&&fc(t.inspect)&&t.inspect!==xi&&!(t.constructor&&t.constructor.prototype===t)){var n=t.inspect(r,e);return ms(n)||(n=Iu(e,n,r)),n}var i=N8(e,t);if(i)return i;var s=Object.keys(t),o=M8(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),cc(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Sd(t);if(s.length===0){if(fc(t)){var a=t.name?": "+t.name:"";return e.stylize("[Function"+a+"]","special")}if(ac(t))return e.stylize(RegExp.prototype.toString.call(t),"regexp");if(Tu(t))return e.stylize(Date.prototype.toString.call(t),"date");if(cc(t))return Sd(t)}var c="",u=!1,l=["{","}"];if(Bd(t)&&(u=!0,l=["[","]"]),fc(t)){var y=t.name?": "+t.name:"";c=" [Function"+y+"]"}if(ac(t)&&(c=" "+RegExp.prototype.toString.call(t)),Tu(t)&&(c=" "+Date.prototype.toUTCString.call(t)),cc(t)&&(c=" "+Sd(t)),s.length===0&&(!u||t.length==0))return l[0]+c+l[1];if(r<0)return ac(t)?e.stylize(RegExp.prototype.toString.call(t),"regexp"):e.stylize("[Object]","special");e.seen.push(t);var A;return u?A=P8(e,t,r,o,s):A=s.map(function(v){return Ad(e,t,r,o,v,u)}),e.seen.pop(),U8(A,c,l)}function N8(e,t){if(Si(t))return e.stylize("undefined","undefined");if(ms(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(Rd(t))return e.stylize(""+t,"number");if(Ru(t))return e.stylize(""+t,"boolean");if(ji(t))return e.stylize("null","null")}function Sd(e){return"["+Error.prototype.toString.call(e)+"]"}function P8(e,t,r,n,i){for(var s=[],o=0,a=t.length;o-1&&(s?a=a.split(` `).map(function(u){return" "+u}).join(` `).substr(2):a=` `+a.split(` `).map(function(u){return" "+u}).join(` -`))):a=e.stylize("[Circular]","special")),Si(o)){if(s&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function Y8(e,t,r){var n=e.reduce(function(i,s){return s.indexOf(` +`))):a=e.stylize("[Circular]","special")),Si(o)){if(s&&i.match(/^\d+$/))return a;o=JSON.stringify(""+i),o.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(o=o.substr(1,o.length-2),o=e.stylize(o,"name")):(o=o.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),o=e.stylize(o,"string"))}return o+": "+a}function U8(e,t,r){var n=e.reduce(function(i,s){return s.indexOf(` `)>=0,i+s.replace(/\u001b\[\d\d?m/g,"").length+1},0);return n>60?r[0]+(t===""?"":t+` `)+" "+e.join(`, - `)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function kd(e){return Array.isArray(e)}function Lu(e){return typeof e=="boolean"}function zi(e){return e===null}function Cd(e){return e==null}function Ld(e){return typeof e=="number"}function bs(e){return typeof e=="string"}function Pw(e){return typeof e=="symbol"}function Si(e){return e===void 0}function uc(e){return qi(e)&&$d(e)==="[object RegExp]"}function qi(e){return typeof e=="object"&&e!==null}function $u(e){return qi(e)&&$d(e)==="[object Date]"}function lc(e){return qi(e)&&($d(e)==="[object Error]"||e instanceof Error)}function hc(e){return typeof e=="function"}function Uw(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}function Fw(e){return le.isBuffer(e)}function $d(e){return Object.prototype.toString.call(e)}function Od(e){return e<10?"0"+e.toString(10):e.toString(10)}var X8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function J8(){var e=new Date,t=[Od(e.getHours()),Od(e.getMinutes()),Od(e.getSeconds())].join(":");return[e.getDate(),X8[e.getMonth()],t].join(" ")}function Dw(){console.log("%s - %s",J8(),Ru.apply(null,arguments))}function Md(e,t){if(!t||!qi(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function Hw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var ao=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Nd(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');if(ao&&e[ao]){var t=e[ao];if(typeof t!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,ao,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var r,n,i=new Promise(function(a,c){r=a,n=c}),s=[],o=0;o0?this.tail.next=t:this.head=t,this.tail=t,++this.length},co.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},co.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},co.prototype.clear=function(){this.head=this.tail=null,this.length=0},co.prototype.join=function(e){if(this.length===0)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},co.prototype.concat=function(e){if(this.length===0)return ie.Buffer.alloc(0);if(this.length===1)return this.head.data;for(var t=ie.Buffer.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var Pd=gf.exports.Buffer,zw=Pd.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function rR(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function nR(e){var t=rR(e);if(typeof t!="string"&&(Pd.isEncoding===zw||!zw(e)))throw new Error("Unknown encoding: "+e);return t||e}var qw=dc;function dc(e){this.encoding=nR(e);var t;switch(this.encoding){case"utf16le":this.text=fR,this.end=uR,t=4;break;case"utf8":this.fillLast=oR,t=4;break;case"base64":this.text=lR,this.end=hR,t=3;break;default:this.write=dR,this.end=pR;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Pd.allocUnsafe(t)}dc.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function iR(e,t,r){var n=t.length-1;if(n=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function sR(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function oR(e){var t=this.lastTotal-this.lastNeed,r=sR(this,e);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function aR(e,t){var r=iR(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function cR(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function fR(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function uR(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function lR(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function hR(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function dR(e){return e.toString(this.encoding)}function pR(e){return e&&e.length?this.write(e):""}ar.ReadableState=Vw;var Vt=Id("stream");qr(ar,Dn.exports);function gR(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function yR(e,t){return e.listeners(t).length}function Vw(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Gn&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16*1024;this.highWaterMark=r||r===0?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new co,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new qw(e.encoding),this.encoding=e.encoding)}function ar(e){if(!(this instanceof ar))return new ar(e);this._readableState=new Vw(e,this),this.readable=!0,e&&typeof e.read=="function"&&(this._read=e.read),Dn.exports.call(this)}ar.prototype.push=function(e,t){var r=this._readableState;return!r.objectMode&&typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=le.from(e,t),t="")),Ww(this,r,e,t,!1)},ar.prototype.unshift=function(e){var t=this._readableState;return Ww(this,t,e,"",!0)},ar.prototype.isPaused=function(){return this._readableState.flowing===!1};function Ww(e,t,r,n,i){var s=bR(t,r);if(s)e.emit("error",s);else if(r===null)t.reading=!1,vR(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{var c;t.decoder&&!i&&!n&&(r=t.decoder.write(r),c=!t.objectMode&&r.length===0),i||(t.reading=!1),c||(t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&Ou(e))),_R(e,t)}else i||(t.reading=!1);return wR(t)}function wR(e){return!e.ended&&(e.needReadable||e.length=Kw?e=Kw:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Zw(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=mR(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}ar.prototype.read=function(e){Vt("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Vt("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?Dd(this):Ou(this),null;if(e=Zw(e,t),e===0&&t.ended)return t.length===0&&Dd(this),null;var n=t.needReadable;Vt("need readable",n),(t.length===0||t.length-e0?i=Yw(e,t):i=null,i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Dd(this)),i!==null&&this.emit("data",i),i};function bR(e,t){var r=null;return!le.isBuffer(t)&&typeof t!="string"&&t!==null&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function vR(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,Ou(e)}}function Ou(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Vt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?On(Gw,e):Gw(e))}function Gw(e){Vt("emit readable"),e.emit("readable"),Fd(e)}function _R(e,t){t.readingMore||(t.readingMore=!0,On(ER,e,t))}function ER(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length1&&Xw(n.pipes,e)!==-1)&&!u&&(Vt("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,y=!0),r.pause())}function v(H){Vt("onerror",H),P(),e.removeListener("error",v),yR(e,"error")===0&&e.emit("error",H)}gR(e,"error",v);function R(){e.removeListener("finish",O),P()}e.once("close",R);function O(){Vt("onfinish"),e.removeListener("close",R),P()}e.once("finish",O);function P(){Vt("unpipe"),r.unpipe(e)}return e.emit("pipe",r),n.flowing||(Vt("pipe resume"),r.resume()),e};function xR(e){return function(){var t=e._readableState;Vt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&e.listeners("data").length&&(t.flowing=!0,Fd(e))}}ar.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=IR(e,t.buffer,t.decoder),r}function IR(e,t,r){var n;return es.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),e-=o,e===0){o===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));break}++n}return t.length-=n,i}function TR(e,t){var r=le.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var s=n.data,o=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,o),e-=o,e===0){o===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++i}return t.length-=i,r}function Dd(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,On(kR,t,e))}function kR(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function CR(e,t){for(var r=0,n=e.length;r-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function NR(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=ie.Buffer.from(t,r)),t}function PR(e,t,r,n,i){r=NR(t,r,n),ie.Buffer.isBuffer(r)&&(n="buffer");var s=t.objectMode?1:r.length;t.length+=s;var o=t.lengthe._pos){var n=r.substr(e._pos);if(e._charset==="x-user-defined"){for(var i=new le(n.length),s=0;se._pos&&(e.push(new le(new Uint8Array(o.result.slice(e._pos)))),e._pos=o.result.byteLength)},o.onload=function(){e.push(null)},o.readAsArrayBuffer(r);break}e._xhr.readyState===fo.DONE&&e._mode!=="ms-stream"&&e.push(null)};function KR(e){if(e instanceof Uint8Array){if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)return e.buffer;if(typeof e.buffer.slice=="function")return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(ie.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,n=0;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},Kd=gc-om,sa=Math.floor,Zd=String.fromCharCode;function am(e){throw new RangeError(iT[e])}function sT(e,t){const r=[];let n=e.length;for(;n--;)r[n]=t(e[n]);return r}function oT(e,t){const r=e.split("@");let n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(nT,".");const i=e.split("."),s=sT(i,t).join(".");return n+s}function aT(e){const t=[];let r=0;const n=e.length;for(;r=55296&&i<=56319&&r>1,e+=sa(e/t);e>Kd*Wd>>1;n+=gc)e=sa(e/Kd);return sa(n+(Kd+1)*e/(e+XR))},fT=function(e){const t=[];e=aT(e);const r=e.length;let n=eT,i=0,s=QR;for(const c of e)c<128&&t.push(Zd(c));const o=t.length;let a=o;for(o&&t.push(tT);a=n&&lsa((Vd-i)/u)&&am("overflow"),i+=(c-n)*u,n=c;for(const l of e)if(lVd&&am("overflow"),l===n){let y=i;for(let A=gc;;A+=gc){const v=A<=s?om:A>=s+Wd?Wd:A-s;if(y0&&a>o&&(a=o);for(var c=0;c=0?(y=u.substr(0,l),A=u.substr(l+1)):(y=u,A=""),v=decodeURIComponent(y),R=decodeURIComponent(A),lT(i,v)?fm(i[v])?i[v].push(R):i[v]=[i[v],R]:i[v]=R}return i}const hm=pr.URL,dm=pr.URLSearchParams;var pT={parse:uo,resolve:vm,resolveObject:_m,fileURLToPath:mm,format:bm,Url:Mn,URL:hm,URLSearchParams:dm};function Mn(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var gT=/^([a-z0-9.+-]+:)/i,yT=/:[0-9]*$/,wT=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,mT=["<",">",'"',"`"," ","\r",` -`," "],bT=["{","}","|","\\","^","`"].concat(mT),Gd=["'"].concat(bT),pm=["%","/","?",";","#"].concat(Gd),gm=["/","?","#"],vT=255,ym=/^[+a-z0-9A-Z_-]{0,63}$/,_T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ET={javascript:!0,"javascript:":!0},Yd={javascript:!0,"javascript:":!0},oa={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function uo(e,t,r){if(e&&qi(e)&&e instanceof Mn)return e;var n=new Mn;return n.parse(e,t,r),n}Mn.prototype.parse=function(e,t,r){return wm(this,e,t,r)};function wm(e,t,r,n){if(!bs(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),s=i!==-1&&i127?Z+="x":Z+=G[z];if(!Z.match(ym)){var se=q.slice(0,v),Q=q.slice(v+1),I=G.match(_T);I&&(se.push(I[1]),Q.unshift(I[2])),Q.length&&(c="/"+Q.join(".")+c),e.hostname=se.join(".");break}}}}e.hostname.length>vT?e.hostname="":e.hostname=e.hostname.toLowerCase(),$||(e.hostname=uT(e.hostname)),P=e.port?":"+e.port:"";var g=e.hostname||"";e.host=g+P,e.href+=e.host,$&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),c[0]!=="/"&&(c="/"+c))}if(!ET[y])for(v=0,O=Gd.length;v0?r.host.split("@"):!1,q&&(r.auth=q.shift(),r.host=r.hostname=q.shift())),r.search=e.search,r.query=e.query,(!zi(r.pathname)||!zi(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!N.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var G=N.slice(-1)[0],Z=(r.host||e.host||N.length>1)&&(G==="."||G==="..")||G==="",z=0,ee=N.length;ee>=0;ee--)G=N[ee],G==="."?N.splice(ee,1):G===".."?(N.splice(ee,1),z++):z&&(N.splice(ee,1),z--);if(!H&&!F)for(;z--;z)N.unshift("..");H&&N[0]!==""&&(!N[0]||N[0].charAt(0)!=="/")&&N.unshift(""),Z&&N.join("/").substr(-1)!=="/"&&N.push("");var se=N[0]===""||N[0]&&N[0].charAt(0)==="/";return $&&(r.hostname=r.host=se?"":N.length?N.shift():"",q=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1,q&&(r.auth=q.shift(),r.host=r.hostname=q.shift())),H=H||r.host&&N.length,H&&!se&&N.unshift(""),N.length?r.pathname=N.join("/"):(r.pathname=null,r.path=null),(!zi(r.pathname)||!zi(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},Mn.prototype.parseHost=function(){return Em(this)};function Em(e){var t=e.host,r=yT.exec(t);r&&(r=r[0],r!==":"&&(e.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(e.hostname=t)}var ST=Object.freeze({__proto__:null,parse:uo,resolve:vm,resolveObject:_m,fileURLToPath:mm,format:bm,URL:hm,URLSearchParams:dm,default:pT,Url:Mn});function Jd(e,t){typeof e=="string"&&(e=uo(e));var r=pr.location.protocol.search(/^https?:$/)===-1?"http:":"",n=e.protocol||r,i=e.hostname||e.host,s=e.port,o=e.path||"/";i&&i.indexOf(":")!==-1&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(s?":"+s:"")+o,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var a=new Xr(e);return t&&a.on("response",t),a}function xm(e,t){var r=Jd(e,t);return r.end(),r}function Qd(){}Qd.defaultMaxSockets=4;var Sm=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Am={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},AT={request:Jd,get:xm,Agent:Qd,METHODS:Sm,STATUS_CODES:Am},BT=Object.freeze({__proto__:null,request:Jd,get:xm,Agent:Qd,METHODS:Sm,STATUS_CODES:Am,default:AT}),IT=Un(BT);function e0(e,t){typeof e=="string"&&(e=uo(e));var r=pr.location.protocol.search(/^https?:$/)===-1?"http:":"",n=e.protocol||r,i=e.hostname||e.host,s=e.port,o=e.path||"/";i&&i.indexOf(":")!==-1&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(s?":"+s:"")+o,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var a=new Xr(e);return t&&a.on("response",t),a}function Bm(e,t){var r=e0(e,t);return r.end(),r}function t0(){}t0.defaultMaxSockets=4;var Im=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],Rm={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},RT={request:e0,get:Bm,Agent:t0,METHODS:Im,STATUS_CODES:Rm},TT=Object.freeze({__proto__:null,request:e0,get:Bm,Agent:t0,METHODS:Im,STATUS_CODES:Rm,default:RT}),kT=Un(TT),Tm={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function CT(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Wi(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var s=0;s=0;)e[t]=0}var OT=0,Lm=1,MT=2,NT=3,PT=258,r0=29,wc=256,mc=wc+1+r0,ca=30,n0=19,$m=2*mc+1,lo=15,i0=16,UT=7,s0=256,Om=16,Mm=17,Nm=18,o0=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Uu=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],FT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Pm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DT=512,Ki=new Array((mc+2)*2);aa(Ki);var bc=new Array(ca*2);aa(bc);var vc=new Array(DT);aa(vc);var _c=new Array(PT-NT+1);aa(_c);var a0=new Array(r0);aa(a0);var Fu=new Array(ca);aa(Fu);function c0(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var Um,Fm,Dm;function f0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Hm(e){return e<256?vc[e]:vc[256+(e>>>7)]}function Ec(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function En(e,t,r){e.bi_valid>i0-r?(e.bi_buf|=t<>i0-e.bi_valid,e.bi_valid+=r-i0):(e.bi_buf|=t<>>=1,r<<=1;while(--t>0);return r>>>1}function HT(e){e.bi_valid===16?(Ec(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function jT(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length,u,l,y,A,v,R,O=0;for(A=0;A<=lo;A++)e.bl_count[A]=0;for(r[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;u<$m;u++)l=e.heap[u],A=r[r[l*2+1]*2+1]+1,A>c&&(A=c,O++),r[l*2+1]=A,!(l>n)&&(e.bl_count[A]++,v=0,l>=a&&(v=o[l-a]),R=r[l*2],e.opt_len+=R*(A+v),s&&(e.static_len+=R*(i[l*2+1]+v)));if(O!==0){do{for(A=c-1;e.bl_count[A]===0;)A--;e.bl_count[A]--,e.bl_count[A+1]+=2,e.bl_count[c]--,O-=2}while(O>0);for(A=c;A!==0;A--)for(l=e.bl_count[A];l!==0;)y=e.heap[--u],!(y>n)&&(r[y*2+1]!==A&&(e.opt_len+=(A-r[y*2+1])*r[y*2],r[y*2+1]=A),l--)}}function zm(e,t,r){var n=new Array(lo+1),i=0,s,o;for(s=1;s<=lo;s++)n[s]=i=i+r[s-1]<<1;for(o=0;o<=t;o++){var a=e[o*2+1];a!==0&&(e[o*2]=jm(n[a]++,a))}}function zT(){var e,t,r,n,i,s=new Array(lo+1);for(r=0,n=0;n>=7;n8?Ec(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function qT(e,t,r,n){Vm(e),n&&(Ec(e,r),Ec(e,~r)),Wi(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Wm(e,t,r,n){var i=t*2,s=r*2;return e[i]>1;o>=1;o--)u0(e,r,o);u=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],u0(e,r,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,r[u*2]=r[o*2]+r[a*2],e.depth[u]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,r[o*2+1]=r[a*2+1]=u,e.heap[1]=u++,u0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],jT(e,t),zm(r,c,e.bl_count)}function Zm(e,t,r){var n,i=-1,s,o=t[0*2+1],a=0,c=7,u=4;for(o===0&&(c=138,u=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)s=o,o=t[(n+1)*2+1],!(++a=3&&e.bl_tree[Pm[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function WT(e,t,r,n){var i;for(En(e,t-257,5),En(e,r-1,5),En(e,n-4,4),i=0;i>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return km;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Cm;for(r=32;r0?(e.strm.data_type===$T&&(e.strm.data_type=KT(e)),l0(e,e.l_desc),l0(e,e.d_desc),o=VT(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=r+5,r+4<=i&&t!==-1?Xm(e,t,r,n):e.strategy===LT||s===i?(En(e,(Lm<<1)+(n?1:0),3),Km(e,Ki,bc)):(En(e,(MT<<1)+(n?1:0),3),WT(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Km(e,e.dyn_ltree,e.dyn_dtree)),qm(e),n&&Vm(e)}function vs(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(_c[r]+wc+1)*2]++,e.dyn_dtree[Hm(t)*2]++),e.last_lit===e.lit_bufsize-1}function h0(e,t,r,n){for(var i=e&65535|0,s=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0}function XT(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var JT=XT();function Vr(e,t,r,n){var i=JT,s=n+r;e^=-1;for(var o=n;o>>8^i[(e^t[o])&255];return e^-1}var ho=0,QT=1,e4=3,_s=4,Jm=5,Es=0,Qm=1,xs=-2,t4=-3,d0=-5,r4=-1,n4=1,Du=2,i4=3,s4=4,o4=2,p0=8,a4=9,c4=29,f4=256,g0=f4+1+c4,u4=30,l4=19,h4=2*g0+1,d4=15,Ft=3,Ss=258,si=Ss+Ft+1,p4=32,y0=42,w0=69,Hu=73,ju=91,zu=103,po=113,xc=666,$r=1,Sc=2,go=3,fa=4,g4=3;function As(e,t){return e.msg=Tm[t],t}function eb(e){return(e<<1)-(e>4?9:0)}function yo(e){for(var t=e.length;--t>=0;)e[t]=0}function Bs(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(Wi(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function Jr(e,t){YT(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,Bs(e.strm)}function Pt(e,t){e.pending_buf[e.pending++]=t}function Ac(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function y4(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,Wi(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=h0(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Vr(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function tb(e,t){var r=e.max_chain_length,n=e.strstart,i,s,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-si?e.strstart-(e.w_size-si):0,u=e.window,l=e.w_mask,y=e.prev,A=e.strstart+Ss,v=u[n+o-1],R=u[n+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do if(i=t,!(u[i+o]!==R||u[i+o-1]!==v||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&no){if(e.match_start=t,o=s,s>=a)break;v=u[n+o-1],R=u[n+o]}}while((t=y[t&l])>c&&--r!==0);return o<=e.lookahead?o:e.lookahead}function Bc(e){var t=e.w_size,r,n,i,s,o;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-si)){Wi(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);s+=t}if(e.strm.avail_in===0)break;if(n=y4(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=n,e.lookahead+e.insert>=Ft)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(Bc(e),e.lookahead===0&&t===ho)return $r;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Jr(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-si&&(Jr(e,!1),e.strm.avail_out===0))return $r}return e.insert=0,t===_s?(Jr(e,!0),e.strm.avail_out===0?go:fa):(e.strstart>e.block_start&&(Jr(e,!1),e.strm.avail_out===0),$r)}function m0(e,t){for(var r,n;;){if(e.lookahead=Ft&&(e.ins_h=(e.ins_h<=Ft)if(n=vs(e,e.strstart-e.match_start,e.match_length-Ft),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Ft){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=Ft&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=Ft-1)),e.prev_length>=Ft&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Ft,n=vs(e,e.strstart-1-e.prev_match,e.prev_length-Ft),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<=Ft&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){s=e.strstart+Ss;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Ft?(r=vs(e,1,e.match_length-Ft),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=vs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Jr(e,!1),e.strm.avail_out===0))return $r}return e.insert=0,t===_s?(Jr(e,!0),e.strm.avail_out===0?go:fa):e.last_lit&&(Jr(e,!1),e.strm.avail_out===0)?$r:Sc}function b4(e,t){for(var r;;){if(e.lookahead===0&&(Bc(e),e.lookahead===0)){if(t===ho)return $r;break}if(e.match_length=0,r=vs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Jr(e,!1),e.strm.avail_out===0))return $r}return e.insert=0,t===_s?(Jr(e,!0),e.strm.avail_out===0?go:fa):e.last_lit&&(Jr(e,!1),e.strm.avail_out===0)?$r:Sc}function Bi(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var la;la=[new Bi(0,0,0,0,w4),new Bi(4,4,8,4,m0),new Bi(4,5,16,8,m0),new Bi(4,6,32,32,m0),new Bi(4,4,16,16,ua),new Bi(8,16,32,32,ua),new Bi(8,16,128,128,ua),new Bi(8,32,128,256,ua),new Bi(32,128,258,1024,ua),new Bi(32,258,258,4096,ua)];function v4(e){e.window_size=2*e.w_size,yo(e.head),e.max_lazy_match=la[e.level].max_lazy,e.good_match=la[e.level].good_length,e.nice_match=la[e.level].nice_length,e.max_chain_length=la[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Ft-1,e.match_available=0,e.ins_h=0}function _4(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=p0,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Xn(h4*2),this.dyn_dtree=new Xn((2*u4+1)*2),this.bl_tree=new Xn((2*l4+1)*2),yo(this.dyn_ltree),yo(this.dyn_dtree),yo(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Xn(d4+1),this.heap=new Xn(2*g0+1),yo(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xn(2*g0+1),yo(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function E4(e){var t;return!e||!e.state?As(e,xs):(e.total_in=e.total_out=0,e.data_type=o4,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?y0:po,e.adler=t.wrap===2?0:1,t.last_flush=ho,ZT(t),Es)}function rb(e){var t=E4(e);return t===Es&&v4(e.state),t}function x4(e,t,r,n,i,s){if(!e)return xs;var o=1;if(t===r4&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>a4||r!==p0||n<8||n>15||t<0||t>9||s<0||s>s4)return As(e,xs);n===8&&(n=9);var a=new _4;return e.state=a,a.strm=e,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<Jm||t<0)return e?As(e,xs):xs;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===xc&&t!==_s)return As(e,e.avail_out===0?d0:xs);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===y0)if(n.wrap===2)e.adler=0,Pt(n,31),Pt(n,139),Pt(n,8),n.gzhead?(Pt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Pt(n,n.gzhead.time&255),Pt(n,n.gzhead.time>>8&255),Pt(n,n.gzhead.time>>16&255),Pt(n,n.gzhead.time>>24&255),Pt(n,n.level===9?2:n.strategy>=Du||n.level<2?4:0),Pt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Pt(n,n.gzhead.extra.length&255),Pt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=w0):(Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,n.level===9?2:n.strategy>=Du||n.level<2?4:0),Pt(n,g4),n.status=po);else{var o=p0+(n.w_bits-8<<4)<<8,a=-1;n.strategy>=Du||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,o|=a<<6,n.strstart!==0&&(o|=p4),o+=31-o%31,n.status=po,Ac(n,o),n.strstart!==0&&(Ac(n,e.adler>>>16),Ac(n,e.adler&65535)),e.adler=1}if(n.status===w0)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),Bs(e),i=n.pending,n.pending===n.pending_buf_size));)Pt(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Hu)}else n.status=Hu;if(n.status===Hu)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),Bs(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindexi&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.gzindex=0,n.status=ju)}else n.status=ju;if(n.status===ju)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),Bs(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindexi&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.status=zu)}else n.status=zu;if(n.status===zu&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&Bs(e),n.pending+2<=n.pending_buf_size&&(Pt(n,e.adler&255),Pt(n,e.adler>>8&255),e.adler=0,n.status=po)):n.status=po),n.pending!==0){if(Bs(e),e.avail_out===0)return n.last_flush=-1,Es}else if(e.avail_in===0&&eb(t)<=eb(r)&&t!==_s)return As(e,d0);if(n.status===xc&&e.avail_in!==0)return As(e,d0);if(e.avail_in!==0||n.lookahead!==0||t!==ho&&n.status!==xc){var c=n.strategy===Du?b4(n,t):n.strategy===i4?m4(n,t):la[n.level].func(n,t);if((c===go||c===fa)&&(n.status=xc),c===$r||c===go)return e.avail_out===0&&(n.last_flush=-1),Es;if(c===Sc&&(t===QT?GT(n):t!==Jm&&(Xm(n,0,0,!1),t===e4&&(yo(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),Bs(e),e.avail_out===0))return n.last_flush=-1,Es}return t!==_s?Es:n.wrap<=0?Qm:(n.wrap===2?(Pt(n,e.adler&255),Pt(n,e.adler>>8&255),Pt(n,e.adler>>16&255),Pt(n,e.adler>>24&255),Pt(n,e.total_in&255),Pt(n,e.total_in>>8&255),Pt(n,e.total_in>>16&255),Pt(n,e.total_in>>24&255)):(Ac(n,e.adler>>>16),Ac(n,e.adler&65535)),Bs(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?Es:Qm)}function A4(e){var t;return!e||!e.state?xs:(t=e.state.status,t!==y0&&t!==w0&&t!==Hu&&t!==ju&&t!==zu&&t!==po&&t!==xc?As(e,xs):(e.state=null,t===po?As(e,t4):Es))}var qu=30,B4=12;function I4(e,t){var r,n,i,s,o,a,c,u,l,y,A,v,R,O,P,H,F,N,$,q,G,Z,z,ee,se;r=e.state,n=e.next_in,ee=e.input,i=n+(e.avail_in-5),s=e.next_out,se=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),c=r.dmax,u=r.wsize,l=r.whave,y=r.wnext,A=r.window,v=r.hold,R=r.bits,O=r.lencode,P=r.distcode,H=(1<>>24,v>>>=$,R-=$,$=N>>>16&255,$===0)se[s++]=N&65535;else if($&16){q=N&65535,$&=15,$&&(R<$&&(v+=ee[n++]<>>=$,R-=$),R<15&&(v+=ee[n++]<>>24,v>>>=$,R-=$,$=N>>>16&255,$&16){if(G=N&65535,$&=15,R<$&&(v+=ee[n++]<c){e.msg="invalid distance too far back",r.mode=qu;break e}if(v>>>=$,R-=$,$=s-o,G>$){if($=G-$,$>l&&r.sane){e.msg="invalid distance too far back",r.mode=qu;break e}if(Z=0,z=A,y===0){if(Z+=u-$,$2;)se[s++]=z[Z++],se[s++]=z[Z++],se[s++]=z[Z++],q-=3;q&&(se[s++]=z[Z++],q>1&&(se[s++]=z[Z++]))}else{Z=s-G;do se[s++]=se[Z++],se[s++]=se[Z++],se[s++]=se[Z++],q-=3;while(q>2);q&&(se[s++]=se[Z++],q>1&&(se[s++]=se[Z++]))}}else if($&64){e.msg="invalid distance code",r.mode=qu;break e}else{N=P[(N&65535)+(v&(1<<$)-1)];continue r}break}}else if($&64)if($&32){r.mode=B4;break e}else{e.msg="invalid literal/length code",r.mode=qu;break e}else{N=O[(N&65535)+(v&(1<<$)-1)];continue t}break}}while(n>3,n-=q,R-=q<<3,v&=(1<=1&&Q[A]===0;A--);if(v>A&&(v=A),A===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,a.bits=1,0;for(y=1;y0&&(e===sb||A!==1))return-1;for(I[1]=0,u=1;unb||e===ob&&H>ib)return 1;for(;;){h=u-O,o[l]se?(m=g[f+o[l]],_=z[ee+o[l]]):(m=32+64,_=0),N=1<>O)+$]=h<<24|m<<16|_|0;while($!==0);for(N=1<>=1;if(N!==0?(F&=N-1,F+=N):F=0,l++,--Q[u]===0){if(u===A)break;u=t[r+o[l]]}if(u>v&&(F&G)!==q){for(O===0&&(O=v),Z+=y,R=u-O,P=1<nb||e===ob&&H>ib)return 1;q=F&G,i[q]=v<<24|R<<16|Z-s|0}}return F!==0&&(i[Z+F]=u-O<<24|64<<16|0),a.bits=v,0}var L4=0,ab=1,cb=2,fb=4,$4=5,Vu=6,Rc=0,O4=1,M4=2,Is=-2,N4=-3,P4=-4,U4=-5,ub=8,lb=1,hb=2,db=3,pb=4,gb=5,yb=6,wb=7,mb=8,bb=9,vb=10,_b=11,Zi=12,v0=13,Eb=14,_0=15,xb=16,Sb=17,Ab=18,Bb=19,Wu=20,Ku=21,Ib=22,Rb=23,Tb=24,kb=25,Cb=26,E0=27,Lb=28,$b=29,cr=30,F4=31,D4=32,H4=852,j4=592;function Ob(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function z4(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Xn(320),this.work=new Xn(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function q4(e){var t;return!e||!e.state?Is:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=lb,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Pu(H4),t.distcode=t.distdyn=new Pu(j4),t.sane=1,t.back=-1,Rc)}function Mb(e){var t;return!e||!e.state?Is:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,q4(e))}function V4(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Is:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Mb(e))}function W4(e,t){var r,n;return e?(n=new z4,e.state=n,n.window=null,r=V4(e,t),r!==Rc&&(e.state=null),r):Is}var Nb=!0,x0,S0;function K4(e){if(Nb){var t;for(x0=new Pu(512),S0=new Pu(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Ic(ab,e.lens,0,288,x0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Ic(cb,e.lens,0,32,S0,0,e.work,{bits:5}),Nb=!1}e.lencode=x0,e.lenbits=9,e.distcode=S0,e.distbits=5}function Z4(e,t,r,n){var i,s=e.state;return s.window===null&&(s.wsize=1<=s.wsize?(Wi(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),Wi(s.window,t,r-n,i,s.wnext),n-=i,n?(Wi(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=Vr(r.check,ee,2,0),u=0,l=0,r.mode=hb;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=cr;break}if((u&15)!==ub){e.msg="unknown compression method",r.mode=cr;break}if(u>>>=4,l-=4,Z=(u&15)+8,r.wbits===0)r.wbits=Z;else if(Z>r.wbits){e.msg="invalid window size",r.mode=cr;break}r.dmax=1<>8&1),r.flags&512&&(ee[0]=u&255,ee[1]=u>>>8&255,r.check=Vr(r.check,ee,2,0)),u=0,l=0,r.mode=db;case db:for(;l<32;){if(a===0)break e;a--,u+=n[s++]<>>8&255,ee[2]=u>>>16&255,ee[3]=u>>>24&255,r.check=Vr(r.check,ee,4,0)),u=0,l=0,r.mode=pb;case pb:for(;l<16;){if(a===0)break e;a--,u+=n[s++]<>8),r.flags&512&&(ee[0]=u&255,ee[1]=u>>>8&255,r.check=Vr(r.check,ee,2,0)),u=0,l=0,r.mode=gb;case gb:if(r.flags&1024){for(;l<16;){if(a===0)break e;a--,u+=n[s++]<>>8&255,r.check=Vr(r.check,ee,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=yb;case yb:if(r.flags&1024&&(v=r.length,v>a&&(v=a),v&&(r.head&&(Z=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Wi(r.head.extra,n,s,v,Z)),r.flags&512&&(r.check=Vr(r.check,n,v,s)),a-=v,s+=v,r.length-=v),r.length))break e;r.length=0,r.mode=wb;case wb:if(r.flags&2048){if(a===0)break e;v=0;do Z=n[s+v++],r.head&&Z&&r.length<65536&&(r.head.name+=String.fromCharCode(Z));while(Z&&v>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Zi;break;case vb:for(;l<32;){if(a===0)break e;a--,u+=n[s++]<>>=l&7,l-=l&7,r.mode=E0;break}for(;l<3;){if(a===0)break e;a--,u+=n[s++]<>>=1,l-=1,u&3){case 0:r.mode=Eb;break;case 1:if(K4(r),r.mode=Wu,t===Vu){u>>>=2,l-=2;break e}break;case 2:r.mode=Sb;break;case 3:e.msg="invalid block type",r.mode=cr}u>>>=2,l-=2;break;case Eb:for(u>>>=l&7,l-=l&7;l<32;){if(a===0)break e;a--,u+=n[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=cr;break}if(r.length=u&65535,u=0,l=0,r.mode=_0,t===Vu)break e;case _0:r.mode=xb;case xb:if(v=r.length,v){if(v>a&&(v=a),v>c&&(v=c),v===0)break e;Wi(i,n,s,v,o),a-=v,s+=v,c-=v,o+=v,r.length-=v;break}r.mode=Zi;break;case Sb:for(;l<14;){if(a===0)break e;a--,u+=n[s++]<>>=5,l-=5,r.ndist=(u&31)+1,u>>>=5,l-=5,r.ncode=(u&15)+4,u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=cr;break}r.have=0,r.mode=Ab;case Ab:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,se={bits:r.lenbits},z=Ic(L4,r.lens,0,19,r.lencode,0,r.work,se),r.lenbits=se.bits,z){e.msg="invalid code lengths set",r.mode=cr;break}r.have=0,r.mode=Bb;case Bb:for(;r.have>>24,F=P>>>16&255,N=P&65535,!(H<=l);){if(a===0)break e;a--,u+=n[s++]<>>=H,l-=H,r.lens[r.have++]=N;else{if(N===16){for(Q=H+2;l>>=H,l-=H,r.have===0){e.msg="invalid bit length repeat",r.mode=cr;break}Z=r.lens[r.have-1],v=3+(u&3),u>>>=2,l-=2}else if(N===17){for(Q=H+3;l>>=H,l-=H,Z=0,v=3+(u&7),u>>>=3,l-=3}else{for(Q=H+7;l>>=H,l-=H,Z=0,v=11+(u&127),u>>>=7,l-=7}if(r.have+v>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=cr;break}for(;v--;)r.lens[r.have++]=Z}}if(r.mode===cr)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=cr;break}if(r.lenbits=9,se={bits:r.lenbits},z=Ic(ab,r.lens,0,r.nlen,r.lencode,0,r.work,se),r.lenbits=se.bits,z){e.msg="invalid literal/lengths set",r.mode=cr;break}if(r.distbits=6,r.distcode=r.distdyn,se={bits:r.distbits},z=Ic(cb,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,se),r.distbits=se.bits,z){e.msg="invalid distances set",r.mode=cr;break}if(r.mode=Wu,t===Vu)break e;case Wu:r.mode=Ku;case Ku:if(a>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=s,e.avail_in=a,r.hold=u,r.bits=l,I4(e,A),o=e.next_out,i=e.output,c=e.avail_out,s=e.next_in,n=e.input,a=e.avail_in,u=r.hold,l=r.bits,r.mode===Zi&&(r.back=-1);break}for(r.back=0;P=r.lencode[u&(1<>>24,F=P>>>16&255,N=P&65535,!(H<=l);){if(a===0)break e;a--,u+=n[s++]<>$)],H=P>>>24,F=P>>>16&255,N=P&65535,!($+H<=l);){if(a===0)break e;a--,u+=n[s++]<>>=$,l-=$,r.back+=$}if(u>>>=H,l-=H,r.back+=H,r.length=N,F===0){r.mode=Cb;break}if(F&32){r.back=-1,r.mode=Zi;break}if(F&64){e.msg="invalid literal/length code",r.mode=cr;break}r.extra=F&15,r.mode=Ib;case Ib:if(r.extra){for(Q=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Rb;case Rb:for(;P=r.distcode[u&(1<>>24,F=P>>>16&255,N=P&65535,!(H<=l);){if(a===0)break e;a--,u+=n[s++]<>$)],H=P>>>24,F=P>>>16&255,N=P&65535,!($+H<=l);){if(a===0)break e;a--,u+=n[s++]<>>=$,l-=$,r.back+=$}if(u>>>=H,l-=H,r.back+=H,F&64){e.msg="invalid distance code",r.mode=cr;break}r.offset=N,r.extra=F&15,r.mode=Tb;case Tb:if(r.extra){for(Q=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=cr;break}r.mode=kb;case kb:if(c===0)break e;if(v=A-c,r.offset>v){if(v=r.offset-v,v>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=cr;break}v>r.wnext?(v-=r.wnext,R=r.wsize-v):R=r.wnext-v,v>r.length&&(v=r.length),O=r.window}else O=i,R=o-r.offset,v=r.length;v>c&&(v=c),c-=v,r.length-=v;do i[o++]=O[R++];while(--v);r.length===0&&(r.mode=Ku);break;case Cb:if(c===0)break e;i[o++]=r.length,c--,r.mode=Ku;break;case E0:if(r.wrap){for(;l<32;){if(a===0)break e;a--,u|=n[s++]<Cc)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}oi.prototype.init=function(e,t,r,n,i){this.windowBits=e,this.level=t,this.memLevel=r,this.strategy=n,(this.mode===Tc||this.mode===Gu)&&(this.windowBits+=16),this.mode===Cc&&(this.windowBits+=32),(this.mode===pa||this.mode===kc)&&(this.windowBits=-this.windowBits),this.strm=new CT;var s;switch(this.mode){case da:case Tc:case pa:s=x4(this.strm,this.level,Vb,this.windowBits,this.memLevel,this.strategy);break;case Zu:case Gu:case kc:case Cc:s=W4(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(s!==Yu){this._error(s);return}this.write_in_progress=!1,this.init_done=!0},oi.prototype.params=function(){throw new Error("deflateParams Not supported")},oi.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(this.mode===A0)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},oi.prototype.write=function(e,t,r,n,i,s,o){this._writeCheck(),this.write_in_progress=!0;var a=this;return _n.nextTick(function(){a.write_in_progress=!1;var c=a._write(e,t,r,n,i,s,o);a.callback(c[0],c[1]),a.pending_close&&a.close()}),this};function d5(e,t){for(var r=0;rOe.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsOe.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelOe.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelOe.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=Oe.Z_FILTERED&&e.strategy!=Oe.Z_HUFFMAN_ONLY&&e.strategy!=Oe.Z_RLE&&e.strategy!=Oe.Z_FIXED&&e.strategy!=Oe.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!le.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new Oe.Zlib(t);var r=this;this._hadError=!1,this._binding.onerror=function(s,o){r._binding=null,r._hadError=!0;var a=new Error(s);a.errno=o,a.code=ga[o],r.emit("error",a)};var n=Oe.Z_DEFAULT_COMPRESSION;typeof e.level=="number"&&(n=e.level);var i=Oe.Z_DEFAULT_STRATEGY;typeof e.strategy=="number"&&(i=e.strategy),this._binding.init(e.windowBits||Oe.Z_DEFAULT_WINDOWBITS,n,e.memLevel||Oe.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=new le(this._chunkSize),this._offset=0,this._closed=!1,this._level=n,this._strategy=i,this.once("end",this.close)}qr(fr,Yn),fr.prototype.params=function(e,t,r){if(eOe.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=Oe.Z_FILTERED&&t!=Oe.Z_HUFFMAN_ONLY&&t!=Oe.Z_RLE&&t!=Oe.Z_FIXED&&t!=Oe.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var n=this;this.flush(Oe.Z_SYNC_FLUSH,function(){n._binding.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())})}else _n.nextTick(r)},fr.prototype.reset=function(){return this._binding.reset()},fr.prototype._flush=function(e){this._transform(new le(0),"",e)},fr.prototype.flush=function(e,t){var r=this._writableState;if((typeof e=="function"||e===void 0&&!t)&&(t=e,e=Oe.Z_FULL_FLUSH),r.ended)t&&_n.nextTick(t);else if(r.ending)t&&this.once("end",t);else if(r.needDrain){var n=this;this.once("drain",function(){n.flush(t)})}else this._flushFlag=e,this.write(new le(0),"",t)},fr.prototype.close=function(e){if(e&&_n.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;_n.nextTick(function(){t.emit("close")})}},fr.prototype._transform=function(e,t,r){var n,i=this._writableState,s=i.ending||i.ended,o=s&&(!e||i.length===e.length);if(!e===null&&!le.isBuffer(e))return r(new Error("invalid input"));o?n=Oe.Z_FINISH:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||Oe.Z_NO_FLUSH)),this._processChunk(e,n,r)},fr.prototype._processChunk=function(e,t,r){var n=e&&e.length,i=this._chunkSize-this._offset,s=0,o=this,a=typeof r=="function";if(!a){var c=[],u=0,l;this.on("error",function(O){l=O});do var y=this._binding.writeSync(t,e,s,n,this._buffer,this._offset,i);while(!this._hadError&&R(y[0],y[1]));if(this._hadError)throw l;var A=le.concat(c,u);return this.close(),A}var v=this._binding.write(t,e,s,n,this._buffer,this._offset,i);v.buffer=e,v.callback=R;function R(O,P){if(!o._hadError){var H=i-P;if(p5(H>=0,"have should not go down"),H>0){var F=o._buffer.slice(o._offset,o._offset+H);o._offset+=H,a?o.push(F):(c.push(F),u+=F.length)}if((P===0||o._offset>=o._chunkSize)&&(i=o._chunkSize,o._offset=0,o._buffer=new le(o._chunkSize)),P===0){if(s+=n-O,n=O,!a)return!0;var N=o._binding.write(t,e,s,n,o._buffer,o._offset,o._chunkSize);N.callback=R,N.buffer=e;return}if(!a)return!1;r()}}},qr(Rs,fr),qr(Ts,fr),qr(ks,fr),qr(Cs,fr),qr(Ls,fr),qr($s,fr),qr(Os,fr);var g5={codes:ga,createDeflate:Kb,createInflate:Zb,createDeflateRaw:Gb,createInflateRaw:Yb,createGzip:Xb,createGunzip:Jb,createUnzip:Qb,deflate:ev,deflateSync:tv,gzip:rv,gzipSync:nv,deflateRaw:iv,deflateRawSync:sv,unzip:ov,unzipSync:av,inflate:cv,inflateSync:fv,gunzip:uv,gunzipSync:lv,inflateRaw:hv,inflateRawSync:dv,Deflate:Rs,Inflate:Ts,Gzip:ks,Gunzip:Cs,DeflateRaw:Ls,InflateRaw:$s,Unzip:Os,Zlib:fr},y5=Object.freeze({__proto__:null,codes:ga,createDeflate:Kb,createInflate:Zb,createDeflateRaw:Gb,createInflateRaw:Yb,createGzip:Xb,createGunzip:Jb,createUnzip:Qb,deflate:ev,deflateSync:tv,gzip:rv,gzipSync:nv,deflateRaw:iv,deflateRawSync:sv,unzip:ov,unzipSync:av,inflate:cv,inflateSync:fv,gunzip:uv,gunzipSync:lv,inflateRaw:hv,inflateRawSync:dv,Deflate:Rs,Inflate:Ts,Gzip:ks,Gunzip:Cs,DeflateRaw:Ls,InflateRaw:$s,Unzip:Os,Zlib:fr,default:g5}),w5=Un(y5),m5=Un(tR),b5=Un(ST);Object.defineProperty(ro,"__esModule",{value:!0}),ro.InvalidStatusCodeError=ro.InvalidCertError=void 0;const pv=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class I0 extends Error{constructor(t,r){super(t),this.fingerprint256=r}}ro.InvalidCertError=I0;class R0 extends Error{constructor(t){super(`Request Failed. Status Code: ${t}`),this.statusCode=t}}ro.InvalidStatusCodeError=R0;function gv(e,t){if(!t||t==="text"||t==="json")try{let r=new TextDecoder("utf8",{fatal:!0}).decode(e);if(t==="text")return r;try{return JSON.parse(r)}catch(n){if(t==="json")throw n;return r}}catch(r){if(t==="text"||t==="json")throw r}return e}let yv={};function T0(e,t){let r={...pv,...t};const n=IT,i=kT,s=w5,{promisify:o}=m5,{resolve:a}=b5,c=!!/^https/.test(e);let u={method:r.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const l=A=>A.replace(/:| /g,"").toLowerCase();if(r.keepAlive){const A={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},v=[c,c&&r.sslPinnedCertificates?.map(R=>l(R)).sort()].join();u.agent=yv[v]||(yv[v]=new(c?i:n).Agent(A))}r.type==="json"&&(u.headers["Content-Type"]="application/json"),r.data&&(r.method||(u.method="POST"),u.body=r.type==="json"?JSON.stringify(r.data):r.data),u.headers={...u.headers,...r.headers},r.sslAllowSelfSigned&&(u.rejectUnauthorized=!1);const y=async A=>{const v=A.statusCode;if(r.redirect&&300<=v&&v<400&&A.headers.location){if(r._redirectCount==10)throw new Error("Request failed. Too much redirects.");return r._redirectCount+=1,await T0(a(e,A.headers.location),r)}if(r.expectStatusCode&&v!==r.expectStatusCode)throw A.resume(),new R0(v);let R=[];for await(const F of A)R.push(F);let O=ie.Buffer.concat(R);const P=A.headers["content-encoding"];P==="br"&&(O=await o(s.brotliDecompress)(O)),(P==="gzip"||P==="deflate")&&(O=await o(s.unzip)(O));const H=gv(O,r.type);return r.full?{headers:A.headers,status:v,body:H}:H};return new Promise((A,v)=>{const R=async F=>{if(F&&F.code==="DEPTH_ZERO_SELF_SIGNED_CERT")try{await T0(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(N){N&&N.fingerprint256&&(F=new I0(`Self-signed SSL certificate: ${N.fingerprint256}`,N.fingerprint256))}v(F)},O=(c?i:n).request(e,u,F=>{F.on("error",R),(async()=>{try{A(await y(F))}catch(N){v(N)}})()});O.on("error",R);const P=r.sslPinnedCertificates?.map(F=>l(F)),H=F=>{const N=l(F.getPeerCertificate()?.fingerprint256||"");if(!(!N&&F.isSessionReused())&&!P.includes(N))return O.emit("error",new I0(`Invalid SSL certificate: ${N} Expected: ${P}`,N)),O.abort()};r.sslPinnedCertificates&&O.on("socket",F=>{F.listeners("secureConnect").map($=>($.name||"").replace("bound ","")).includes("mfetchSecureConnect")||F.on("secureConnect",H.bind(null,F))}),r.keepAlive&&O.setNoDelay(!0),u.body&&O.write(u.body),O.end()})}const v5=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(e=>e.toLowerCase())),_5=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map(e=>e.toLowerCase()));async function E5(e,t){let r={...pv,...t};const n=new Headers;r.type==="json"&&n.set("Content-Type","application/json");let i=new URL(e);if(i.username){const c=btoa(`${i.username}:${i.password}`);n.set("Authorization",`Basic ${c}`),i.username="",i.password=""}e=""+i;for(let c in r.headers){const u=c.toLowerCase();(v5.has(u)||r.cors&&!_5.has(u))&&n.set(c,r.headers[c])}let s={headers:n,redirect:r.redirect?"follow":"manual"};r.referrer||(s.referrerPolicy="no-referrer"),r.cors&&(s.mode="cors"),r.data&&(r.method||(s.method="POST"),s.body=r.type==="json"?JSON.stringify(r.data):r.data);const o=await fetch(e,s);if(r.expectStatusCode&&o.status!==r.expectStatusCode)throw new R0(o.status);const a=gv(new Uint8Array(await o.arrayBuffer()),r.type);return r.full?{headers:Object.fromEntries(o.headers.entries()),status:o.status,body:a}:a}const x5=!!(typeof process=="object"&&process.versions&&process.versions.node&&process.versions.v8);function S5(e,t){return(x5?T0:E5)(e,t)}ro.default=S5,Object.defineProperty(ra,"__esModule",{value:!0}),ra.getProvider=ra.fetchFromProvider=void 0;const A5=ro,B5=async(e,t)=>(await(0,A5.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;ra.fetchFromProvider=B5;const I5=e=>{if(typeof e=="string")return e;if(e?.connection?.url!==void 0)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")};ra.getProvider=I5,function(e){var t=ft&&ft.__createBinding||(Object.create?function(i,s,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(s,o);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,a,c)}:function(i,s,o,a){a===void 0&&(a=o),i[a]=s[o]}),r=ft&&ft.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(ru,e),r(uu,e),r(ad,e),r(sc,e),r(yu,e),r(an,e),r(to,e),r(gd,e),r(hw,e),r(bu,e);var n=er;Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return n.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return n.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return n.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return n.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return n.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return n.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return n.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return n.toAscii}}),r(vu,e),r(ra,e)}(tu);var Qr={},oe={},ya={},Rt={},Jn={},Ms={},dn={};Object.defineProperty(dn,"__esModule",{value:!0});function R5(e,t){return e??t()}function T5(e){return Array.isArray(e)&&e.length>0}function k5(e){return e==null}function C5(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}var L5=(e,t)=>Object.hasOwnProperty.call(e,t);function $5(e){return Object.getOwnPropertyNames(e)}var wv=(e=>(e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date",e))(wv||{}),mv=/"|\\|\n|\r|\t/gu;function O5(e){if(typeof e!="object"||e===null)return!1;try{let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch{return!1}}function bv(e){return e.charCodeAt(0)<=127}function M5(e){return e.split("").reduce((r,n)=>bv(n)?r+1:r+2,0)+R5(e.match(mv),()=>[]).length}function N5(e){return e.toString().length}dn.isNonEmptyArray=T5,dn.isNullOrUndefined=k5,dn.isObject=C5,dn.hasProperty=L5,dn.getKnownPropertyNames=$5,dn.JsonSize=wv,dn.ESCAPE_CHARACTERS_REGEXP=mv,dn.isPlainObject=O5,dn.isASCII=bv,dn.calculateStringSize=M5,dn.calculateNumberSize=N5;class k0 extends Error{constructor(t,{cause:r}={}){super(t),this.name=k0.name,r&&(this.cause=r),this.message=t}}var P5=Object.freeze({__proto__:null,ErrorWithCause:k0}),U5=Un(P5);const F5=(e,t)=>{if(!e||!t||!(e instanceof Error)||!(t.prototype instanceof Error)&&t!==Error)return;const r=new Set;let n=e;for(;n&&!r.has(n);){if(r.add(n),n instanceof t)return n;n=Ju(n)}},Ju=e=>{if(!(!e||typeof e!="object"||!("cause"in e)))if(typeof e.cause=="function"){const t=e.cause();return t instanceof Error?t:void 0}else return e.cause instanceof Error?e.cause:void 0},vv=(e,t)=>{if(!(e instanceof Error))return"";const r=e.stack||"";if(t.has(e))return r+` -causes have become circular...`;const n=Ju(e);return n?(t.add(e),r+` -caused by: `+vv(n,t)):r},D5=e=>vv(e,new Set),_v=(e,t,r)=>{if(!(e instanceof Error))return"";const n=r?"":e.message||"";if(t.has(e))return n+": ...";const i=Ju(e);if(i){t.add(e);const s="cause"in e&&typeof e.cause=="function";return n+(s?"":": ")+_v(i,t,s)}else return n};var H5=Object.freeze({__proto__:null,findCauseByReference:F5,getErrorCause:Ju,stackWithCauses:D5,messageWithCauses:e=>_v(e,new Set)}),j5=Un(H5);const{ErrorWithCause:z5}=U5,{findCauseByReference:q5,getErrorCause:V5,messageWithCauses:W5,stackWithCauses:K5}=j5;var Z5={ErrorWithCause:z5,findCauseByReference:q5,getErrorCause:V5,stackWithCauses:K5,messageWithCauses:W5};Object.defineProperty(Ms,"__esModule",{value:!0});var Ev=dn,G5=Z5;function Y5(e){return e instanceof Error||Ev.isObject.call(void 0,e)&&e.constructor.name==="Error"}function xv(e){return typeof e=="object"&&e!==null&&"code"in e}function Sv(e){return typeof e=="object"&&e!==null&&"message"in e}function X5(e){return typeof e=="object"&&e!==null&&"stack"in e}function J5(e){return Sv(e)&&typeof e.message=="string"?e.message:Ev.isNullOrUndefined.call(void 0,e)?"":String(e)}function Q5(e,t){if(Y5(e)){let r;return Error.length===2?r=new Error(t,{cause:e}):r=new G5.ErrorWithCause(t,{cause:e}),xv(e)&&(r.code=e.code),r}return t.length>0?new Error(`${String(e)}: ${t}`):new Error(String(e))}Ms.isErrorWithCode=xv,Ms.isErrorWithMessage=Sv,Ms.isErrorWithStack=X5,Ms.getErrorMessage=J5,Ms.wrapError=Q5;class Av extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function ek(e){return Qn(e)&&typeof e[Symbol.iterator]=="function"}function Qn(e){return typeof e=="object"&&e!=null}function Bv(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Or(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function tk(e){const{done:t,value:r}=e.next();return t?void 0:r}function rk(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${Or(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*C0(e,t,r,n){ek(e)||(e=[e]);for(const i of e){const s=rk(i,t,r,n);s&&(yield s)}}function*L0(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&Qn(t.schema)&&Qn(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let c="valid";for(const u of t.validator(e,a))u.explanation=r.message,c="not_valid",yield[u,void 0];for(let[u,l,y]of t.entries(e,a)){const A=L0(l,y,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const v of A)v[0]?(c=v[0].refinement!=null?"not_refined":"not_valid",yield[v[0],void 0]):s&&(l=v[1],u===void 0?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):Qn(e)&&(l!==void 0||u in e)&&(e[u]=l))}if(c!=="not_valid")for(const u of t.refiner(e,a))u.explanation=r.message,c="not_refined",yield[u,void 0];c==="valid"&&(yield[void 0,e])}class Br{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return C0(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return C0(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return Iv(t,this,r)}create(t,r){return Rv(t,this,r)}is(t){return $0(t,this)}mask(t,r){return Tv(t,this,r)}validate(t,r={}){return wa(t,this,r)}}function Iv(e,t,r){const n=wa(e,t,{message:r});if(n[0])throw n[0]}function Rv(e,t,r){const n=wa(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Tv(e,t,r){const n=wa(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function $0(e,t){return!wa(e,t)[0]}function wa(e,t,r={}){const n=L0(e,t,r),i=tk(n);return i[0]?[new Av(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function nk(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?$c(n):Lc(n)}function xn(e,t){return new Br({type:e,schema:null,validator:t})}function ik(e,t){return new Br({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function sk(e){return new Br({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function ok(e){let t;return new Br({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function ak(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return $c(n);default:return Lc(n)}}function ck(e){const t=e instanceof Br,r=t?{...e.schema}:{...e};for(const n in r)r[n]=kv(r[n]);return t&&e.type==="type"?$c(r):Lc(r)}function fk(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return $c(n);default:return Lc(n)}}function uk(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),xn(e,t)}function lk(){return xn("any",()=>!0)}function hk(e){return new Br({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Or(t)}`}})}function dk(){return xn("bigint",e=>typeof e=="bigint")}function pk(){return xn("boolean",e=>typeof e=="boolean")}function gk(){return xn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Or(e)}`)}function yk(e){const t={},r=e.map(n=>Or(n)).join();for(const n of e)t[n]=n;return new Br({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${Or(n)}`}})}function wk(){return xn("func",e=>typeof e=="function"||`Expected a function, but received: ${Or(e)}`)}function mk(e){return xn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Or(t)}`)}function bk(){return xn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Or(e)}`)}function vk(e){return new Br({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function _k(e){const t=Or(e),r=typeof e;return new Br({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${Or(n)}`}})}function Ek(e,t){return new Br({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Or(r)}`}})}function O0(){return xn("never",()=>!1)}function xk(e){return new Br({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function Sk(){return xn("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${Or(e)}`)}function Lc(e){const t=e?Object.keys(e):[],r=O0();return new Br({type:"object",schema:e||null,*entries(n){if(e&&Qn(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return Qn(n)||`Expected an object, but received: ${Or(n)}`},coercer(n){return Qn(n)?{...n}:n}})}function kv(e){return new Br({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function Ak(e,t){return new Br({type:"record",schema:null,*entries(r){if(Qn(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return Qn(r)||`Expected an object, but received: ${Or(r)}`}})}function Bk(){return xn("regexp",e=>e instanceof RegExp)}function Ik(e){return new Br({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${Or(t)}`}})}function Cv(){return xn("string",e=>typeof e=="string"||`Expected a string, but received: ${Or(e)}`)}function Rk(e){const t=O0();return new Br({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new Br({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=L0(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Or(r)}`,...i]}})}function Lv(){return xn("unknown",()=>!0)}function M0(e,t,r){return new Br({...e,coercer:(n,i)=>$0(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function kk(e,t,r={}){return M0(e,Lv(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&Bv(n)&&Bv(i)){const s={...n};let o=!1;for(const a in i)s[a]===void 0&&(s[a]=i[a],o=!0);if(o)return s}return n})}function Ck(e){return M0(e,Cv(),t=>t.trim())}function Lk(e){return bo(e,"empty",t=>{const r=$v(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function $v(e){return e instanceof Map||e instanceof Set?e.size:e.length}function $k(e,t,r={}){const{exclusive:n}=r;return bo(e,"max",i=>n?in?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function Mk(e){return bo(e,"nonempty",t=>$v(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function Nk(e,t){return bo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function Pk(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return bo(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:o}=s;return t<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}else{const{length:o}=s;return t<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}})}function bo(e,t,r){return new Br({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),o=C0(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var Uk=Object.freeze({__proto__:null,Struct:Br,StructError:Av,any:lk,array:hk,assert:Iv,assign:nk,bigint:dk,boolean:pk,coerce:M0,create:Rv,date:gk,defaulted:kk,define:xn,deprecated:ik,dynamic:sk,empty:Lk,enums:yk,func:wk,instance:mk,integer:bk,intersection:vk,is:$0,lazy:ok,literal:_k,map:Ek,mask:Tv,max:$k,min:Ok,never:O0,nonempty:Mk,nullable:xk,number:Sk,object:Lc,omit:ak,optional:kv,partial:ck,pattern:Nk,pick:fk,record:Ak,refine:bo,regexp:Bk,set:Ik,size:Pk,string:Cv,struct:uk,trimmed:Ck,tuple:Rk,type:$c,union:Tk,unknown:Lv,validate:wa}),Ns=Un(Uk);Object.defineProperty(Jn,"__esModule",{value:!0});function Fk(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var Dk=Ms,Hk=Ns;function jk(e){return typeof Fk([e,"optionalAccess",t=>t.prototype,"optionalAccess",t=>t.constructor,"optionalAccess",t=>t.name])=="string"}function zk(e){return Dk.getErrorMessage.call(void 0,e).replace(/\.$/u,"")}function Ov(e,t){return jk(e)?new e({message:t}):e({message:t})}var N0=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function qk(e,t="Assertion failed.",r=N0){if(!e)throw t instanceof Error?t:Ov(r,t)}function Vk(e,t,r="Assertion failed",n=N0){try{Hk.assert.call(void 0,e,t)}catch(i){throw Ov(n,`${r}: ${zk(i)}.`)}}function Wk(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Jn.AssertionError=N0,Jn.assert=qk,Jn.assertStruct=Vk,Jn.assertExhaustive=Wk;var tr={},Wr={};Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.output=Wr.exists=Wr.hash=Wr.bytes=Wr.bool=Wr.number=Wr.isBytes=void 0;function Qu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}Wr.number=Qu;function Mv(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}Wr.bool=Mv;function Nv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}Wr.isBytes=Nv;function P0(e,...t){if(!Nv(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}Wr.bytes=P0;function Pv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Qu(e.outputLen),Qu(e.blockLen)}Wr.hash=Pv;function Uv(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}Wr.exists=Uv;function Fv(e,t){P0(e);const r=t.outputLen;if(e.length>U0&el)}:{h:Number(e>>U0&el)|0,l:Number(e&el)|0}}at.fromBig=F0;function Dv(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);at.toBig=Hv;const jv=(e,t,r)=>e>>>r;at.shrSH=jv;const zv=(e,t,r)=>e<<32-r|t>>>r;at.shrSL=zv;const qv=(e,t,r)=>e>>>r|t<<32-r;at.rotrSH=qv;const Vv=(e,t,r)=>e<<32-r|t>>>r;at.rotrSL=Vv;const Wv=(e,t,r)=>e<<64-r|t>>>r-32;at.rotrBH=Wv;const Kv=(e,t,r)=>e>>>r-32|t<<64-r;at.rotrBL=Kv;const Zv=(e,t)=>t;at.rotr32H=Zv;const Gv=(e,t)=>e;at.rotr32L=Gv;const Yv=(e,t,r)=>e<>>32-r;at.rotlSH=Yv;const Xv=(e,t,r)=>t<>>32-r;at.rotlSL=Xv;const Jv=(e,t,r)=>t<>>64-r;at.rotlBH=Jv;const Qv=(e,t,r)=>e<>>64-r;at.rotlBL=Qv;function e_(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}at.add=e_;const t_=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);at.add3L=t_;const r_=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;at.add3H=r_;const n_=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);at.add4L=n_;const i_=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;at.add4H=i_;const s_=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);at.add5L=s_;const o_=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;at.add5H=o_;const Zk={fromBig:F0,split:Dv,toBig:Hv,shrSH:jv,shrSL:zv,rotrSH:qv,rotrSL:Vv,rotrBH:Wv,rotrBL:Kv,rotr32H:Zv,rotr32L:Gv,rotlSH:Yv,rotlSL:Xv,rotlBH:Jv,rotlBL:Qv,add:e_,add3L:t_,add3H:r_,add4L:n_,add4H:i_,add5H:o_,add5L:s_};at.default=Zk;var a_={},tl={};Object.defineProperty(tl,"__esModule",{value:!0}),tl.crypto=void 0,tl.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=tl,r=Wr;function n(I){return I instanceof Uint8Array||I!=null&&typeof I=="object"&&I.constructor.name==="Uint8Array"}e.isBytes=n;const i=I=>new Uint8Array(I.buffer,I.byteOffset,I.byteLength);e.u8=i;const s=I=>new Uint32Array(I.buffer,I.byteOffset,Math.floor(I.byteLength/4));e.u32=s;const o=I=>new DataView(I.buffer,I.byteOffset,I.byteLength);e.createView=o;const a=(I,g)=>I<<32-g|I>>>g;e.rotr=a;const c=(I,g)=>I<>>32-g>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=I=>I<<24&4278190080|I<<8&16711680|I>>>8&65280|I>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?I=>I:I=>(0,e.byteSwap)(I);function l(I){for(let g=0;gg.toString(16).padStart(2,"0"));function A(I){(0,r.bytes)(I);let g="";for(let f=0;f=v._0&&I<=v._9)return I-v._0;if(I>=v._A&&I<=v._F)return I-(v._A-10);if(I>=v._a&&I<=v._f)return I-(v._a-10)}function O(I){if(typeof I!="string")throw new Error("hex string expected, got "+typeof I);const g=I.length,f=g/2;if(g%2)throw new Error("padded hex string expected, got unpadded hex of length "+g);const h=new Uint8Array(f);for(let m=0,_=0;m{};e.nextTick=P;async function H(I,g,f){let h=Date.now();for(let m=0;m=0&&_I().update(N(h)).digest(),f=I();return g.outputLen=f.outputLen,g.blockLen=f.blockLen,g.create=()=>I(),g}e.wrapConstructor=z;function ee(I){const g=(h,m)=>I(m).update(N(h)).digest(),f=I({});return g.outputLen=f.outputLen,g.blockLen=f.blockLen,g.create=h=>I(h),g}e.wrapConstructorWithOpts=ee;function se(I){const g=(h,m)=>I(m).update(N(h)).digest(),f=I({});return g.outputLen=f.outputLen,g.blockLen=f.blockLen,g.create=h=>I(h),g}e.wrapXOFConstructorWithOpts=se;function Q(I=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(I));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=Q}(a_),Object.defineProperty(tr,"__esModule",{value:!0}),tr.shake256=tr.shake128=tr.keccak_512=tr.keccak_384=tr.keccak_256=tr.keccak_224=tr.sha3_512=tr.sha3_384=tr.sha3_256=tr.sha3_224=tr.Keccak=tr.keccakP=void 0;const ma=Wr,Oc=at,Gi=a_,c_=[],f_=[],u_=[],Gk=BigInt(0),Mc=BigInt(1),Yk=BigInt(2),Xk=BigInt(7),Jk=BigInt(256),Qk=BigInt(113);for(let e=0,t=Mc,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],c_.push(2*(5*n+r)),f_.push((e+1)*(e+2)/2%64);let i=Gk;for(let s=0;s<7;s++)t=(t<>Xk)*Qk)%Jk,t&Yk&&(i^=Mc<<(Mc<r>32?(0,Oc.rotlBH)(e,t,r):(0,Oc.rotlSH)(e,t,r),h_=(e,t,r)=>r>32?(0,Oc.rotlBL)(e,t,r):(0,Oc.rotlSL)(e,t,r);function d_(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)r[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],y=l_(u,l,1)^r[a],A=h_(u,l,1)^r[a+1];for(let v=0;v<50;v+=10)e[o+v]^=y,e[o+v+1]^=A}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=f_[o],c=l_(i,s,a),u=h_(i,s,a),l=c_[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=eC[n],e[1]^=tC[n]}r.fill(0)}tr.keccakP=d_;class Nc extends Gi.Hash{constructor(t,r,n,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,ma.number)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Gi.u32)(this.state)}keccak(){Gi.isLE||(0,Gi.byteSwap32)(this.state32),d_(this.state32,this.rounds),Gi.isLE||(0,Gi.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,ma.exists)(this);const{blockLen:r,state:n}=this;t=(0,Gi.toBytes)(t);const i=t.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,ma.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,ma.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Nc(r,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}tr.Keccak=Nc;const Ps=(e,t,r)=>(0,Gi.wrapConstructor)(()=>new Nc(t,e,r));tr.sha3_224=Ps(6,144,224/8),tr.sha3_256=Ps(6,136,256/8),tr.sha3_384=Ps(6,104,384/8),tr.sha3_512=Ps(6,72,512/8),tr.keccak_224=Ps(1,144,224/8),tr.keccak_256=Ps(1,136,256/8),tr.keccak_384=Ps(1,104,384/8),tr.keccak_512=Ps(1,72,512/8);const p_=(e,t,r)=>(0,Gi.wrapXOFConstructorWithOpts)((n={})=>new Nc(t,e,n.dkLen===void 0?r:n.dkLen,!0));tr.shake128=p_(31,168,128/8),tr.shake256=p_(31,136,256/8);var D0={};(function(e){/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.bytes=e.stringToBytes=e.str=e.bytesToString=e.hex=e.utf8=e.bech32m=e.bech32=e.base58check=e.createBase58check=e.base58xmr=e.base58xrp=e.base58flickr=e.base58=e.base64urlnopad=e.base64url=e.base64nopad=e.base64=e.base32crockford=e.base32hex=e.base32=e.base16=e.utils=e.assertNumber=void 0;function t(I){if(!Number.isSafeInteger(I))throw new Error(`Wrong integer: ${I}`)}e.assertNumber=t;function r(I){return I instanceof Uint8Array||I!=null&&typeof I=="object"&&I.constructor.name==="Uint8Array"}function n(...I){const g=_=>_,f=(_,E)=>x=>_(E(x)),h=I.map(_=>_.encode).reduceRight(f,g),m=I.map(_=>_.decode).reduce(f,g);return{encode:h,decode:m}}function i(I){return{encode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return g.map(f=>{if(t(f),f<0||f>=I.length)throw new Error(`Digit index outside alphabet: ${f} (alphabet: ${I.length})`);return I[f]})},decode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="string")throw new Error("alphabet.decode input should be array of strings");return g.map(f=>{if(typeof f!="string")throw new Error(`alphabet.decode: not string element=${f}`);const h=I.indexOf(f);if(h===-1)throw new Error(`Unknown letter: "${f}". Allowed: ${I}`);return h})}}}function s(I=""){if(typeof I!="string")throw new Error("join separator should be string");return{encode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="string")throw new Error("join.encode input should be array of strings");for(let f of g)if(typeof f!="string")throw new Error(`join.encode: non-string input=${f}`);return g.join(I)},decode:g=>{if(typeof g!="string")throw new Error("join.decode input should be string");return g.split(I)}}}function o(I,g="="){if(t(I),typeof g!="string")throw new Error("padding chr should be string");return{encode(f){if(!Array.isArray(f)||f.length&&typeof f[0]!="string")throw new Error("padding.encode input should be array of strings");for(let h of f)if(typeof h!="string")throw new Error(`padding.encode: non-string input=${h}`);for(;f.length*I%8;)f.push(g);return f},decode(f){if(!Array.isArray(f)||f.length&&typeof f[0]!="string")throw new Error("padding.encode input should be array of strings");for(let m of f)if(typeof m!="string")throw new Error(`padding.decode: non-string input=${m}`);let h=f.length;if(h*I%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;h>0&&f[h-1]===g;h--)if(!((h-1)*I%8))throw new Error("Invalid padding: string has too much padding");return f.slice(0,h)}}}function a(I){if(typeof I!="function")throw new Error("normalize fn should be function");return{encode:g=>g,decode:g=>I(g)}}function c(I,g,f){if(g<2)throw new Error(`convertRadix: wrong from=${g}, base cannot be less than 2`);if(f<2)throw new Error(`convertRadix: wrong to=${f}, base cannot be less than 2`);if(!Array.isArray(I))throw new Error("convertRadix: data should be array");if(!I.length)return[];let h=0;const m=[],_=Array.from(I);for(_.forEach(E=>{if(t(E),E<0||E>=g)throw new Error(`Wrong integer: ${E}`)});;){let E=0,x=!0;for(let T=h;T<_.length;T++){const B=_[T],d=g*E+B;if(!Number.isSafeInteger(d)||g*E/g!==E||d-B!==g*E)throw new Error("convertRadix: carry overflow");E=d%f;const k=Math.floor(d/f);if(_[T]=k,!Number.isSafeInteger(k)||k*f+E!==d)throw new Error("convertRadix: carry overflow");if(x)k?x=!1:h=T;else continue}if(m.push(E),x)break}for(let E=0;Eg?u(g,I%g):I,l=(I,g)=>I+(g-u(I,g));function y(I,g,f,h){if(!Array.isArray(I))throw new Error("convertRadix2: data should be array");if(g<=0||g>32)throw new Error(`convertRadix2: wrong from=${g}`);if(f<=0||f>32)throw new Error(`convertRadix2: wrong to=${f}`);if(l(g,f)>32)throw new Error(`convertRadix2: carry overflow from=${g} to=${f} carryBits=${l(g,f)}`);let m=0,_=0;const E=2**f-1,x=[];for(const T of I){if(t(T),T>=2**g)throw new Error(`convertRadix2: invalid data word=${T} from=${g}`);if(m=m<32)throw new Error(`convertRadix2: carry overflow pos=${_} from=${g}`);for(_+=g;_>=f;_-=f)x.push((m>>_-f&E)>>>0);m&=2**_-1}if(m=m<=g)throw new Error("Excess padding");if(!h&&m)throw new Error(`Non-zero padding: ${m}`);return h&&_>0&&x.push(m>>>0),x}function A(I){return t(I),{encode:g=>{if(!r(g))throw new Error("radix.encode input should be Uint8Array");return c(Array.from(g),2**8,I)},decode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(c(g,I,2**8))}}}function v(I,g=!1){if(t(I),I<=0||I>32)throw new Error("radix2: bits should be in (0..32]");if(l(8,I)>32||l(I,8)>32)throw new Error("radix2: carry overflow");return{encode:f=>{if(!r(f))throw new Error("radix2.encode input should be Uint8Array");return y(Array.from(f),8,I,!g)},decode:f=>{if(!Array.isArray(f)||f.length&&typeof f[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(y(f,I,8,g))}}}function R(I){if(typeof I!="function")throw new Error("unsafeWrapper fn should be function");return function(...g){try{return I.apply(null,g)}catch{}}}function O(I,g){if(t(I),typeof g!="function")throw new Error("checksum fn should be function");return{encode(f){if(!r(f))throw new Error("checksum.encode: input should be Uint8Array");const h=g(f).slice(0,I),m=new Uint8Array(f.length+I);return m.set(f),m.set(h,f.length),m},decode(f){if(!r(f))throw new Error("checksum.decode: input should be Uint8Array");const h=f.slice(0,-I),m=g(h).slice(0,I),_=f.slice(-I);for(let E=0;EI.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),e.base64=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),o(6),s("")),e.base64nopad=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),s("")),e.base64url=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),o(6),s("")),e.base64urlnopad=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),s(""));const P=I=>n(A(58),i(I),s(""));e.base58=P("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=P("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=P("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const H=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(I){let g="";for(let f=0;fn(O(4,g=>I(I(g))),e.base58);e.createBase58check=F,e.base58check=e.createBase58check;const N=n(i("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),s("")),$=[996825010,642813549,513874426,1027748829,705979059];function q(I){const g=I>>25;let f=(I&33554431)<<5;for(let h=0;h<$.length;h++)(g>>h&1)===1&&(f^=$[h]);return f}function G(I,g,f=1){const h=I.length;let m=1;for(let _=0;_126)throw new Error(`Invalid prefix (${I})`);m=q(m)^E>>5}m=q(m);for(let _=0;_W)throw new TypeError(`Length ${K} exceeds limit ${W}`);const re=d.toLowerCase(),xe=G(re,k,g);return`${re}1${N.encode(k)}${xe}`}function x(d,k=90){if(typeof d!="string")throw new Error(`bech32.decode input should be string, not ${typeof d}`);if(d.length<8||k!==!1&&d.length>k)throw new TypeError(`Wrong string length: ${d.length} (${d}). Expected (8..${k})`);const W=d.toLowerCase();if(d!==W&&d!==d.toUpperCase())throw new Error("String must be lowercase or uppercase");const K=W.lastIndexOf("1");if(K===0||K===-1)throw new Error('Letter "1" must be present between prefix and data only');const re=W.slice(0,K),xe=W.slice(K+1);if(xe.length<6)throw new Error("Data must be at least 6 characters long");const be=N.decode(xe).slice(0,-6),ge=G(re,be,g);if(!xe.endsWith(ge))throw new Error(`Invalid checksum in ${d}: expected "${ge}"`);return{prefix:re,words:be}}const T=R(x);function B(d){const{prefix:k,words:W}=x(d,!1);return{prefix:k,words:W,bytes:h(W)}}return{encode:E,decode:x,decodeToBytes:B,decodeUnsafe:T,fromWords:h,fromWordsUnsafe:_,toWords:m}}e.bech32=Z("bech32"),e.bech32m=Z("bech32m"),e.utf8={encode:I=>new TextDecoder().decode(I),decode:I=>new TextEncoder().encode(I)},e.hex=n(v(4),i("0123456789abcdef"),s(""),a(I=>{if(typeof I!="string"||I.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof I} with length ${I.length}`);return I.toLowerCase()}));const z={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},ee="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr",se=(I,g)=>{if(typeof I!="string"||!z.hasOwnProperty(I))throw new TypeError(ee);if(!r(g))throw new TypeError("bytesToString() expects Uint8Array");return z[I].encode(g)};e.bytesToString=se,e.str=e.bytesToString;const Q=(I,g)=>{if(!z.hasOwnProperty(I))throw new TypeError(ee);if(typeof g!="string")throw new TypeError("stringToBytes() expects string");return z[I].decode(g)};e.stringToBytes=Q,e.bytes=e.stringToBytes})(D0),Object.defineProperty(Rt,"__esModule",{value:!0});function rC(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var Kr=Jn,nC=tr,pn=Ns,g_=D0,y_=48,w_=58,m_=87;function iC(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}var sC=iC();function H0(e){return e instanceof Uint8Array}function vo(e){Kr.assert.call(void 0,H0(e),"Value must be a Uint8Array.")}function j0(e){if(vo(e),e.length===0)return"0x";const t=sC(),r=new Array(e.length);for(let n=0;ni.toLowerCase,"optionalCall",i=>i()])==="0x")return new Uint8Array;T_(e);const t=nl(e).toLowerCase(),r=t.length%2===0?t:`0${t}`,n=new Uint8Array(r.length/2);for(let i=0;i=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return rl(t)}function uC(e,t){Kr.assert.call(void 0,t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function lC(e,t){Kr.assert.call(void 0,typeof e=="bigint","Value must be a bigint."),Kr.assert.call(void 0,typeof t=="number","Byte length must be a number."),Kr.assert.call(void 0,t>0,"Byte length must be greater than 0."),Kr.assert.call(void 0,uC(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let i=0;i>=BigInt(8);return n.reverse()}function __(e){Kr.assert.call(void 0,typeof e=="number","Value must be a number."),Kr.assert.call(void 0,e>=0,"Value must be a non-negative number."),Kr.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return rl(t)}function E_(e){return Kr.assert.call(void 0,typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}function hC(e){return Kr.assert.call(void 0,typeof e=="string","Value must be a string."),g_.base64.decode(e)}function x_(e){if(typeof e=="bigint")return v_(e);if(typeof e=="number")return __(e);if(typeof e=="string")return e.startsWith("0x")?rl(e):E_(e);if(H0(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}function dC(e){const t=new Array(e.length);let r=0;for(let i=0;i{const s=r[i];return Kr.assert.call(void 0,pn.is.call(void 0,s,pn.string.call(void 0)),"Hash shorter than address."),parseInt(s,16)>7?n.toUpperCase():n}).join("")}`}function C_(e){return pn.is.call(void 0,e,z0)?k_(e)===e:!1}function L_(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function nl(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}Rt.HexStruct=S_,Rt.StrictHexStruct=A_,Rt.HexAddressStruct=B_,Rt.HexChecksumAddressStruct=z0,Rt.isHexString=I_,Rt.isStrictHexString=R_,Rt.assertIsHexString=T_,Rt.assertIsStrictHexString=gC,Rt.isValidHexAddress=yC,Rt.getChecksumAddress=k_,Rt.isValidChecksumAddress=C_,Rt.add0x=L_,Rt.remove0x=nl,Rt.isBytes=H0,Rt.assertIsBytes=vo,Rt.bytesToHex=j0,Rt.bytesToBigInt=b_,Rt.bytesToSignedBigInt=oC,Rt.bytesToNumber=aC,Rt.bytesToString=cC,Rt.bytesToBase64=fC,Rt.hexToBytes=rl,Rt.bigIntToBytes=v_,Rt.signedBigIntToBytes=lC,Rt.numberToBytes=__,Rt.stringToBytes=E_,Rt.base64ToBytes=hC,Rt.valueToBytes=x_,Rt.concatBytes=dC,Rt.createDataView=pC,Object.defineProperty(ya,"__esModule",{value:!0});var Pc=Rt,ba=Jn,wC=e=>(ba.assert.call(void 0,typeof e=="number","Value must be a number."),ba.assert.call(void 0,e>=0,"Value must be a non-negative number."),ba.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),Pc.add0x.call(void 0,e.toString(16))),mC=e=>(ba.assert.call(void 0,typeof e=="bigint","Value must be a bigint."),ba.assert.call(void 0,e>=0,"Value must be a non-negative bigint."),Pc.add0x.call(void 0,e.toString(16))),bC=e=>{Pc.assertIsHexString.call(void 0,e);const t=parseInt(e,16);return ba.assert.call(void 0,Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t},vC=e=>(Pc.assertIsHexString.call(void 0,e),BigInt(Pc.add0x.call(void 0,e)));ya.numberToHex=wC,ya.bigIntToHex=mC,ya.hexToNumber=bC,ya.hexToBigInt=vC;var q0={};Object.defineProperty(q0,"__esModule",{value:!0});function _C({suppressUnhandledRejection:e=!1}={}){let t,r;const n=new Promise((i,s)=>{t=i,r=s});return e&&n.catch(i=>{}),{promise:n,resolve:t,reject:r}}q0.createDeferredPromise=_C;var Uc={};Object.defineProperty(Uc,"__esModule",{value:!0});var $_=(e=>(e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year",e))($_||{}),EC=e=>Number.isInteger(e)&&e>=0,O_=(e,t)=>{if(!EC(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};function xC(e,t){return O_(e,"count"),e*t}function SC(e){return O_(e,"timestamp"),Date.now()-e}Uc.Duration=$_,Uc.inMilliseconds=xC,Uc.timeSince=SC;var ai={},_o={exports:{}};const AC="2.0.0",M_=256,BC=Number.MAX_SAFE_INTEGER||9007199254740991,IC=16,RC=M_-6;var il={MAX_LENGTH:M_,MAX_SAFE_COMPONENT_LENGTH:IC,MAX_SAFE_BUILD_LENGTH:RC,MAX_SAFE_INTEGER:BC,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:AC,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},sl=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=il,s=sl;t=e.exports={};const o=t.re=[],a=t.safeRe=[],c=t.src=[],u=t.t={};let l=0;const y="[a-zA-Z0-9-]",A=[["\\s",1],["\\d",i],[y,n]],v=O=>{for(const[P,H]of A)O=O.split(`${P}*`).join(`${P}{0,${H}}`).split(`${P}+`).join(`${P}{1,${H}}`);return O},R=(O,P,H)=>{const F=v(P),N=l++;s(O,N,P),u[O]=N,c[N]=P,o[N]=new RegExp(P,H?"g":void 0),a[N]=new RegExp(F,H?"g":void 0)};R("NUMERICIDENTIFIER","0|[1-9]\\d*"),R("NUMERICIDENTIFIERLOOSE","\\d+"),R("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${y}*`),R("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),R("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),R("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),R("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),R("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),R("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),R("BUILDIDENTIFIER",`${y}+`),R("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),R("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),R("FULL",`^${c[u.FULLPLAIN]}$`),R("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),R("LOOSE",`^${c[u.LOOSEPLAIN]}$`),R("GTLT","((?:<|>)?=?)"),R("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),R("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),R("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),R("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),R("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),R("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),R("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),R("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),R("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),R("COERCERTL",c[u.COERCE],!0),R("COERCERTLFULL",c[u.COERCEFULL],!0),R("LONETILDE","(?:~>?)"),R("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",R("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),R("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),R("LONECARET","(?:\\^)"),R("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",R("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),R("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),R("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),R("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),R("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",R("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),R("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),R("STAR","(<|>)?=?\\s*\\*"),R("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),R("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(_o,_o.exports);const TC=Object.freeze({loose:!0}),kC=Object.freeze({});var V0=e=>e?typeof e!="object"?TC:e:kC;const N_=/^[0-9]+$/,P_=(e,t)=>{const r=N_.test(e),n=N_.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eP_(t,e)};const ol=sl,{MAX_LENGTH:F_,MAX_SAFE_INTEGER:al}=il,{safeRe:D_,t:H_}=_o.exports,CC=V0,{compareIdentifiers:va}=U_;class ci{constructor(t,r){if(r=CC(r),t instanceof ci){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>F_)throw new TypeError(`version is longer than ${F_} characters`);ol("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?D_[H_.LOOSE]:D_[H_.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>al||this.major<0)throw new TypeError("Invalid major version");if(this.minor>al||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>al||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),va(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}var gn=ci;const j_=gn;var _a=(e,t,r=!1)=>{if(e instanceof j_)return e;try{return new j_(e,t)}catch(n){if(!r)return null;throw n}};const LC=_a;var $C=(e,t)=>{const r=LC(e,t);return r?r.version:null};const OC=_a;var MC=(e,t)=>{const r=OC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const z_=gn;var NC=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new z_(e instanceof z_?e.version:e,r).inc(t,n,i).version}catch{return null}};const q_=_a;var PC=(e,t)=>{const r=q_(e,null,!0),n=q_(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,o=s?r:n,a=s?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c)return!a.patch&&!a.minor?"major":o.patch?"patch":o.minor?"minor":"major";const l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};const UC=gn;var FC=(e,t)=>new UC(e,t).major;const DC=gn;var HC=(e,t)=>new DC(e,t).minor;const jC=gn;var zC=(e,t)=>new jC(e,t).patch;const qC=_a;var VC=(e,t)=>{const r=qC(e,t);return r&&r.prerelease.length?r.prerelease:null};const V_=gn;var fi=(e,t,r)=>new V_(e,r).compare(new V_(t,r));const WC=fi;var KC=(e,t,r)=>WC(t,e,r);const ZC=fi;var GC=(e,t)=>ZC(e,t,!0);const W_=gn;var W0=(e,t,r)=>{const n=new W_(e,r),i=new W_(t,r);return n.compare(i)||n.compareBuild(i)};const YC=W0;var XC=(e,t)=>e.sort((r,n)=>YC(r,n,t));const JC=W0;var QC=(e,t)=>e.sort((r,n)=>JC(n,r,t));const eL=fi;var cl=(e,t,r)=>eL(e,t,r)>0;const tL=fi;var K0=(e,t,r)=>tL(e,t,r)<0;const rL=fi;var K_=(e,t,r)=>rL(e,t,r)===0;const nL=fi;var Z_=(e,t,r)=>nL(e,t,r)!==0;const iL=fi;var Z0=(e,t,r)=>iL(e,t,r)>=0;const sL=fi;var G0=(e,t,r)=>sL(e,t,r)<=0;const oL=K_,aL=Z_,cL=cl,fL=Z0,uL=K0,lL=G0;var G_=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return oL(e,r,n);case"!=":return aL(e,r,n);case">":return cL(e,r,n);case">=":return fL(e,r,n);case"<":return uL(e,r,n);case"<=":return lL(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const hL=gn,dL=_a,{safeRe:fl,t:ul}=_o.exports;var pL=(e,t)=>{if(e instanceof hL)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?fl[ul.COERCEFULL]:fl[ul.COERCE]);else{const c=t.includePrerelease?fl[ul.COERCERTLFULL]:fl[ul.COERCERTL];let u;for(;(u=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return dL(`${n}.${i}.${s}${o}${a}`,t)};class gL{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var yL=gL,Y0,Y_;function ui(){if(Y_)return Y0;Y_=1;class e{constructor(f,h){if(h=n(h),f instanceof e)return f.loose===!!h.loose&&f.includePrerelease===!!h.includePrerelease?f:new e(f.raw,h);if(f instanceof i)return this.raw=f.value,this.set=[[f]],this.format(),this;if(this.options=h,this.loose=!!h.loose,this.includePrerelease=!!h.includePrerelease,this.raw=f.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(m=>this.parseRange(m.trim())).filter(m=>m.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const m=this.set[0];if(this.set=this.set.filter(_=>!R(_[0])),this.set.length===0)this.set=[m];else if(this.set.length>1){for(const _ of this.set)if(_.length===1&&O(_[0])){this.set=[_];break}}}this.format()}format(){return this.range=this.set.map(f=>f.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(f){const m=((this.options.includePrerelease&&A)|(this.options.loose&&v))+":"+f,_=r.get(m);if(_)return _;const E=this.options.loose,x=E?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];f=f.replace(x,Q(this.options.includePrerelease)),s("hyphen replace",f),f=f.replace(a[c.COMPARATORTRIM],u),s("comparator trim",f),f=f.replace(a[c.TILDETRIM],l),s("tilde trim",f),f=f.replace(a[c.CARETTRIM],y),s("caret trim",f);let T=f.split(" ").map(W=>H(W,this.options)).join(" ").split(/\s+/).map(W=>se(W,this.options));E&&(T=T.filter(W=>(s("loose invalid filter",W,this.options),!!W.match(a[c.COMPARATORLOOSE])))),s("range list",T);const B=new Map,d=T.map(W=>new i(W,this.options));for(const W of d){if(R(W))return[W];B.set(W.value,W)}B.size>1&&B.has("")&&B.delete("");const k=[...B.values()];return r.set(m,k),k}intersects(f,h){if(!(f instanceof e))throw new TypeError("a Range is required");return this.set.some(m=>P(m,h)&&f.set.some(_=>P(_,h)&&m.every(E=>_.every(x=>E.intersects(x,h)))))}test(f){if(!f)return!1;if(typeof f=="string")try{f=new o(f,this.options)}catch{return!1}for(let h=0;hg.value==="<0.0.0-0",O=g=>g.value==="",P=(g,f)=>{let h=!0;const m=g.slice();let _=m.pop();for(;h&&m.length;)h=m.every(E=>_.intersects(E,f)),_=m.pop();return h},H=(g,f)=>(s("comp",g,f),g=q(g,f),s("caret",g),g=N(g,f),s("tildes",g),g=Z(g,f),s("xrange",g),g=ee(g,f),s("stars",g),g),F=g=>!g||g.toLowerCase()==="x"||g==="*",N=(g,f)=>g.trim().split(/\s+/).map(h=>$(h,f)).join(" "),$=(g,f)=>{const h=f.loose?a[c.TILDELOOSE]:a[c.TILDE];return g.replace(h,(m,_,E,x,T)=>{s("tilde",g,m,_,E,x,T);let B;return F(_)?B="":F(E)?B=`>=${_}.0.0 <${+_+1}.0.0-0`:F(x)?B=`>=${_}.${E}.0 <${_}.${+E+1}.0-0`:T?(s("replaceTilde pr",T),B=`>=${_}.${E}.${x}-${T} <${_}.${+E+1}.0-0`):B=`>=${_}.${E}.${x} <${_}.${+E+1}.0-0`,s("tilde return",B),B})},q=(g,f)=>g.trim().split(/\s+/).map(h=>G(h,f)).join(" "),G=(g,f)=>{s("caret",g,f);const h=f.loose?a[c.CARETLOOSE]:a[c.CARET],m=f.includePrerelease?"-0":"";return g.replace(h,(_,E,x,T,B)=>{s("caret",g,_,E,x,T,B);let d;return F(E)?d="":F(x)?d=`>=${E}.0.0${m} <${+E+1}.0.0-0`:F(T)?E==="0"?d=`>=${E}.${x}.0${m} <${E}.${+x+1}.0-0`:d=`>=${E}.${x}.0${m} <${+E+1}.0.0-0`:B?(s("replaceCaret pr",B),E==="0"?x==="0"?d=`>=${E}.${x}.${T}-${B} <${E}.${x}.${+T+1}-0`:d=`>=${E}.${x}.${T}-${B} <${E}.${+x+1}.0-0`:d=`>=${E}.${x}.${T}-${B} <${+E+1}.0.0-0`):(s("no pr"),E==="0"?x==="0"?d=`>=${E}.${x}.${T}${m} <${E}.${x}.${+T+1}-0`:d=`>=${E}.${x}.${T}${m} <${E}.${+x+1}.0-0`:d=`>=${E}.${x}.${T} <${+E+1}.0.0-0`),s("caret return",d),d})},Z=(g,f)=>(s("replaceXRanges",g,f),g.split(/\s+/).map(h=>z(h,f)).join(" ")),z=(g,f)=>{g=g.trim();const h=f.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return g.replace(h,(m,_,E,x,T,B)=>{s("xRange",g,m,_,E,x,T,B);const d=F(E),k=d||F(x),W=k||F(T),K=W;return _==="="&&K&&(_=""),B=f.includePrerelease?"-0":"",d?_===">"||_==="<"?m="<0.0.0-0":m="*":_&&K?(k&&(x=0),T=0,_===">"?(_=">=",k?(E=+E+1,x=0,T=0):(x=+x+1,T=0)):_==="<="&&(_="<",k?E=+E+1:x=+x+1),_==="<"&&(B="-0"),m=`${_+E}.${x}.${T}${B}`):k?m=`>=${E}.0.0${B} <${+E+1}.0.0-0`:W&&(m=`>=${E}.${x}.0${B} <${E}.${+x+1}.0-0`),s("xRange return",m),m})},ee=(g,f)=>(s("replaceStars",g,f),g.trim().replace(a[c.STAR],"")),se=(g,f)=>(s("replaceGTE0",g,f),g.trim().replace(a[f.includePrerelease?c.GTE0PRE:c.GTE0],"")),Q=g=>(f,h,m,_,E,x,T,B,d,k,W,K)=>(F(m)?h="":F(_)?h=`>=${m}.0.0${g?"-0":""}`:F(E)?h=`>=${m}.${_}.0${g?"-0":""}`:x?h=`>=${h}`:h=`>=${h}${g?"-0":""}`,F(d)?B="":F(k)?B=`<${+d+1}.0.0-0`:F(W)?B=`<${d}.${+k+1}.0-0`:K?B=`<=${d}.${k}.${W}-${K}`:g?B=`<${d}.${k}.${+W+1}-0`:B=`<=${B}`,`${h} ${B}`.trim()),I=(g,f,h)=>{for(let m=0;m0){const _=g[m].semver;if(_.major===f.major&&_.minor===f.minor&&_.patch===f.patch)return!0}return!1}return!0};return Y0}var X0,X_;function ll(){if(X_)return X0;X_=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(l,y){if(y=r(y),l instanceof t){if(l.loose===!!y.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),o("comparator",l,y),this.options=y,this.loose=!!y.loose,this.parse(l),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(l){const y=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],A=l.match(y);if(!A)throw new TypeError(`Invalid comparator: ${l}`);this.operator=A[1]!==void 0?A[1]:"",this.operator==="="&&(this.operator=""),A[2]?this.semver=new a(A[2],this.options.loose):this.semver=e}toString(){return this.value}test(l){if(o("Comparator.test",l,this.options.loose),this.semver===e||l===e)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return s(l,this.operator,this.semver,this.options)}intersects(l,y){if(!(l instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,y).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,y).test(l.semver):(y=r(y),y.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!y.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||s(this.semver,"<",l.semver,y)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||s(this.semver,">",l.semver,y)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}X0=t;const r=V0,{safeRe:n,t:i}=_o.exports,s=G_,o=sl,a=gn,c=ui();return X0}const wL=ui();var hl=(e,t,r)=>{try{t=new wL(t,r)}catch{return!1}return t.test(e)};const mL=ui();var bL=(e,t)=>new mL(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));const vL=gn,_L=ui();var EL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new _L(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new vL(n,r))}),n};const xL=gn,SL=ui();var AL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new SL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new xL(n,r))}),n};const J0=gn,BL=ui(),J_=cl;var IL=(e,t)=>{e=new BL(e,t);let r=new J0("0.0.0");if(e.test(r)||(r=new J0("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const a=new J0(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||J_(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||J_(r,s))&&(r=s)}return r&&e.test(r)?r:null};const RL=ui();var TL=(e,t)=>{try{return new RL(e,t).range||"*"}catch{return null}};const kL=gn,Q_=ll(),{ANY:CL}=Q_,LL=ui(),$L=hl,e2=cl,t2=K0,OL=G0,ML=Z0;var Q0=(e,t,r,n)=>{e=new kL(e,n),t=new LL(t,n);let i,s,o,a,c;switch(r){case">":i=e2,s=OL,o=t2,a=">",c=">=";break;case"<":i=t2,s=ML,o=e2,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if($L(e,t,n))return!1;for(let u=0;u{v.semver===CL&&(v=new Q_(">=0.0.0")),y=y||v,A=A||v,i(v.semver,y.semver,n)?y=v:o(v.semver,A.semver,n)&&(A=v)}),y.operator===a||y.operator===c||(!A.operator||A.operator===a)&&s(e,A.semver))return!1;if(A.operator===c&&o(e,A.semver))return!1}return!0};const NL=Q0;var PL=(e,t,r)=>NL(e,t,">",r);const UL=Q0;var FL=(e,t,r)=>UL(e,t,"<",r);const r2=ui();var DL=(e,t,r)=>(e=new r2(e,r),t=new r2(t,r),e.intersects(t,r));const HL=hl,jL=fi;var zL=(e,t,r)=>{const n=[];let i=null,s=null;const o=e.sort((l,y)=>jL(l,y,r));for(const l of o)HL(l,t,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const a=[];for(const[l,y]of n)l===y?a.push(l):!y&&l===o[0]?a.push("*"):y?l===o[0]?a.push(`<=${y}`):a.push(`${l} - ${y}`):a.push(`>=${l}`);const c=a.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length{if(e===t)return!0;e=new n2(e,r),t=new n2(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const o=WL(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},VL=[new ep(">=0.0.0-0")],i2=[new ep(">=0.0.0")],WL=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===tp){if(t.length===1&&t[0].semver===tp)return!0;r.includePrerelease?e=VL:e=i2}if(t.length===1&&t[0].semver===tp){if(r.includePrerelease)return!0;t=i2}const n=new Set;let i,s;for(const v of e)v.operator===">"||v.operator===">="?i=s2(i,v,r):v.operator==="<"||v.operator==="<="?s=o2(s,v,r):n.add(v.semver);if(n.size>1)return null;let o;if(i&&s){if(o=rp(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const v of n){if(i&&!Fc(v,String(i),r)||s&&!Fc(v,String(s),r))return null;for(const R of t)if(!Fc(v,String(R),r))return!1;return!0}let a,c,u,l,y=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,A=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;y&&y.prerelease.length===1&&s.operator==="<"&&y.prerelease[0]===0&&(y=!1);for(const v of t){if(l=l||v.operator===">"||v.operator===">=",u=u||v.operator==="<"||v.operator==="<=",i){if(A&&v.semver.prerelease&&v.semver.prerelease.length&&v.semver.major===A.major&&v.semver.minor===A.minor&&v.semver.patch===A.patch&&(A=!1),v.operator===">"||v.operator===">="){if(a=s2(i,v,r),a===v&&a!==i)return!1}else if(i.operator===">="&&!Fc(i.semver,String(v),r))return!1}if(s){if(y&&v.semver.prerelease&&v.semver.prerelease.length&&v.semver.major===y.major&&v.semver.minor===y.minor&&v.semver.patch===y.patch&&(y=!1),v.operator==="<"||v.operator==="<="){if(c=o2(s,v,r),c===v&&c!==s)return!1}else if(s.operator==="<="&&!Fc(s.semver,String(v),r))return!1}if(!v.operator&&(s||i)&&o!==0)return!1}return!(i&&u&&!s&&o!==0||s&&l&&!i&&o!==0||A||y)},s2=(e,t,r)=>{if(!e)return t;const n=rp(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},o2=(e,t,r)=>{if(!e)return t;const n=rp(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var KL=qL;const np=_o.exports,a2=il,ZL=gn,c2=U_,GL=_a,YL=$C,XL=MC,JL=NC,QL=PC,e$=FC,t$=HC,r$=zC,n$=VC,i$=fi,s$=KC,o$=GC,a$=W0,c$=XC,f$=QC,u$=cl,l$=K0,h$=K_,d$=Z_,p$=Z0,g$=G0,y$=G_,w$=pL,m$=ll(),b$=ui();var v$={parse:GL,valid:YL,clean:XL,inc:JL,diff:QL,major:e$,minor:t$,patch:r$,prerelease:n$,compare:i$,rcompare:s$,compareLoose:o$,compareBuild:a$,sort:c$,rsort:f$,gt:u$,lt:l$,eq:h$,neq:d$,gte:p$,lte:g$,cmp:y$,coerce:w$,Comparator:m$,Range:b$,satisfies:hl,toComparators:bL,maxSatisfying:EL,minSatisfying:AL,minVersion:IL,validRange:TL,outside:Q0,gtr:PL,ltr:FL,intersects:DL,simplifyRange:zL,subset:KL,SemVer:ZL,re:np.re,src:np.src,tokens:np.t,SEMVER_SPEC_VERSION:a2.SEMVER_SPEC_VERSION,RELEASE_TYPES:a2.RELEASE_TYPES,compareIdentifiers:c2.compareIdentifiers,rcompareIdentifiers:c2.rcompareIdentifiers};Object.defineProperty(ai,"__esModule",{value:!0});var f2=Jn,Dc=v$,Ea=Ns,ip=Ea.refine.call(void 0,Ea.string.call(void 0),"Version",e=>Dc.valid.call(void 0,e)===null?`Expected SemVer version, got "${e}"`:!0),sp=Ea.refine.call(void 0,Ea.string.call(void 0),"Version range",e=>Dc.validRange.call(void 0,e)===null?`Expected SemVer range, got "${e}"`:!0);function _$(e){return Ea.is.call(void 0,e,ip)}function E$(e){return Ea.is.call(void 0,e,sp)}function x$(e){f2.assertStruct.call(void 0,e,ip)}function S$(e){f2.assertStruct.call(void 0,e,sp)}function A$(e,t){return Dc.gt.call(void 0,e,t)}function B$(e,t){return Dc.gtr.call(void 0,e,t)}function I$(e,t){return Dc.satisfies.call(void 0,e,t,{includePrerelease:!0})}ai.VersionStruct=ip,ai.VersionRangeStruct=sp,ai.isValidSemVerVersion=_$,ai.isValidSemVerRange=E$,ai.assertIsSemVerVersion=x$,ai.assertIsSemVerRange=S$,ai.gtVersion=A$,ai.gtRange=B$,ai.satisfiesVersionRange=I$;var It={};Object.defineProperty(It,"__esModule",{value:!0});var Yi=Jn,R$=dn,dt=Ns,xa=e=>dt.object.call(void 0,e);function u2({path:e,branch:t}){const r=e[e.length-1];return R$.hasProperty.call(void 0,t[t.length-2],r)}function Hc(e){return new dt.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!u2(r)||e.validator(t,r),refiner:(t,r)=>!u2(r)||e.refiner(t,r)})}var T$=()=>dt.define.call(void 0,"finite number",e=>dt.is.call(void 0,e,dt.number.call(void 0))&&Number.isFinite(e)),jc=dt.union.call(void 0,[dt.literal.call(void 0,null),dt.boolean.call(void 0),T$(),dt.string.call(void 0),dt.array.call(void 0,dt.lazy.call(void 0,()=>jc)),dt.record.call(void 0,dt.string.call(void 0),dt.lazy.call(void 0,()=>jc))]),Eo=dt.coerce.call(void 0,jc,dt.any.call(void 0),e=>(Yi.assertStruct.call(void 0,e,jc),JSON.parse(JSON.stringify(e,(t,r)=>{if(!(t==="__proto__"||t==="constructor"))return r}))));function k$(e){try{return l2(e),!0}catch{return!1}}function l2(e){return dt.create.call(void 0,e,Eo)}function C$(e){Yi.assertStruct.call(void 0,e,Eo,"Invalid JSON value");const t=JSON.stringify(e);return new TextEncoder().encode(t).byteLength}var h2="2.0",Sa=dt.literal.call(void 0,h2),zc=dt.nullable.call(void 0,dt.union.call(void 0,[dt.number.call(void 0),dt.string.call(void 0)])),qc=xa({code:dt.integer.call(void 0),message:dt.string.call(void 0),data:Hc(Eo),stack:Hc(dt.string.call(void 0))}),op=dt.union.call(void 0,[dt.record.call(void 0,dt.string.call(void 0),Eo),dt.array.call(void 0,Eo)]),ap=xa({id:zc,jsonrpc:Sa,method:dt.string.call(void 0),params:Hc(op)}),cp=xa({jsonrpc:Sa,method:dt.string.call(void 0),params:Hc(op)});function L$(e){return dt.is.call(void 0,e,cp)}function $$(e,t){Yi.assertStruct.call(void 0,e,cp,"Invalid JSON-RPC notification",t)}function O$(e){return dt.is.call(void 0,e,ap)}function M$(e,t){Yi.assertStruct.call(void 0,e,ap,"Invalid JSON-RPC request",t)}var fp=dt.object.call(void 0,{id:zc,jsonrpc:Sa,result:dt.optional.call(void 0,dt.unknown.call(void 0)),error:dt.optional.call(void 0,qc)}),dl=xa({id:zc,jsonrpc:Sa,result:Eo}),pl=xa({id:zc,jsonrpc:Sa,error:qc}),up=dt.union.call(void 0,[dl,pl]);function N$(e){return dt.is.call(void 0,e,fp)}function P$(e,t){Yi.assertStruct.call(void 0,e,fp,"Invalid pending JSON-RPC response",t)}function U$(e){return dt.is.call(void 0,e,up)}function F$(e,t){Yi.assertStruct.call(void 0,e,up,"Invalid JSON-RPC response",t)}function D$(e){return dt.is.call(void 0,e,dl)}function H$(e,t){Yi.assertStruct.call(void 0,e,dl,"Invalid JSON-RPC success response",t)}function j$(e){return dt.is.call(void 0,e,pl)}function z$(e,t){Yi.assertStruct.call(void 0,e,pl,"Invalid JSON-RPC failure response",t)}function q$(e){return dt.is.call(void 0,e,qc)}function V$(e,t){Yi.assertStruct.call(void 0,e,qc,"Invalid JSON-RPC error",t)}function W$(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return s=>!!(typeof s=="number"&&(r||Number.isInteger(s))||typeof s=="string"&&(t||s.length>0)||n&&s===null)}It.object=xa,It.exactOptional=Hc,It.UnsafeJsonStruct=jc,It.JsonStruct=Eo,It.isValidJson=k$,It.getSafeJson=l2,It.getJsonSize=C$,It.jsonrpc2=h2,It.JsonRpcVersionStruct=Sa,It.JsonRpcIdStruct=zc,It.JsonRpcErrorStruct=qc,It.JsonRpcParamsStruct=op,It.JsonRpcRequestStruct=ap,It.JsonRpcNotificationStruct=cp,It.isJsonRpcNotification=L$,It.assertIsJsonRpcNotification=$$,It.isJsonRpcRequest=O$,It.assertIsJsonRpcRequest=M$,It.PendingJsonRpcResponseStruct=fp,It.JsonRpcSuccessStruct=dl,It.JsonRpcFailureStruct=pl,It.JsonRpcResponseStruct=up,It.isPendingJsonRpcResponse=N$,It.assertIsPendingJsonRpcResponse=P$,It.isJsonRpcResponse=U$,It.assertIsJsonRpcResponse=F$,It.isJsonRpcSuccess=D$,It.assertIsJsonRpcSuccess=H$,It.isJsonRpcFailure=j$,It.assertIsJsonRpcFailure=z$,It.isJsonRpcError=q$,It.assertIsJsonRpcError=V$,It.getJsonRpcIdValidator=W$;var gl={},lp={exports:{}},hp,d2;function K$(){if(d2)return hp;d2=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;hp=function(l,y){y=y||{};var A=typeof l;if(A==="string"&&l.length>0)return o(l);if(A==="number"&&isFinite(l))return y.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(y){var A=parseFloat(y[1]),v=(y[2]||"ms").toLowerCase();switch(v){case"years":case"year":case"yrs":case"yr":case"y":return A*s;case"weeks":case"week":case"w":return A*i;case"days":case"day":case"d":return A*n;case"hours":case"hour":case"hrs":case"hr":case"h":return A*r;case"minutes":case"minute":case"mins":case"min":case"m":return A*t;case"seconds":case"second":case"secs":case"sec":case"s":return A*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function a(l){var y=Math.abs(l);return y>=n?Math.round(l/n)+"d":y>=r?Math.round(l/r)+"h":y>=t?Math.round(l/t)+"m":y>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var y=Math.abs(l);return y>=n?u(l,y,n,"day"):y>=r?u(l,y,r,"hour"):y>=t?u(l,y,t,"minute"):y>=e?u(l,y,e,"second"):l+" ms"}function u(l,y,A,v){var R=y>=A*1.5;return Math.round(l/A)+" "+v+(R?"s":"")}return hp}function Z$(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=K$(),r.destroy=u,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let y=0;for(let A=0;A{if(G==="%%")return"%";$++;const z=r.formatters[Z];if(typeof z=="function"){const ee=P[$];G=z.call(H,ee),P.splice($,1),$--}return G}),r.formatArgs.call(H,P),(H.log||r.log).apply(H,P)}return O.namespace=l,O.useColors=r.useColors(),O.color=r.selectColor(l),O.extend=n,O.destroy=r.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>A!==null?A:(v!==r.namespaces&&(v=r.namespaces,R=r.enabled(l)),R),set:P=>{A=P}}),typeof r.init=="function"&&r.init(O),O}function n(l,y){const A=r(this.namespace+(typeof y>"u"?":":y)+l);return A.log=this.log,A}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let y;const A=(typeof l=="string"?l:"").split(/[\s,]+/),v=A.length;for(y=0;y"-"+y)].join(",");return r.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let y,A;for(y=0,A=r.skips.length;y{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,y=0;c[0].replace(/%[a-zA-Z%]/g,A=>{A!=="%%"&&(l++,A==="%c"&&(y=l))}),c.splice(y,0,u)}t.log=console.debug||console.log||(()=>{});function i(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function o(){try{return localStorage}catch{}}e.exports=G$(t);const{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(lp,lp.exports),Object.defineProperty(gl,"__esModule",{value:!0});function Y$(e){return e&&e.__esModule?e:{default:e}}var X$=lp.exports,J$=Y$(X$),Q$=J$.default.call(void 0,"metamask");function eO(e){return Q$.extend(e)}function tO(e,t){return e.extend(t)}gl.createProjectLogger=eO,gl.createModuleLogger=tO;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});function p2(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var yn=Ns,dp=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,pp=/^[-a-z0-9]{3,8}$/u,gp=/^[-_a-zA-Z0-9]{1,32}$/u,yp=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,g2=/^[-.%a-zA-Z0-9]{1,128}$/u,y2=yn.pattern.call(void 0,yn.string.call(void 0),dp),w2=yn.pattern.call(void 0,yn.string.call(void 0),pp),m2=yn.pattern.call(void 0,yn.string.call(void 0),gp),b2=yn.pattern.call(void 0,yn.string.call(void 0),yp),v2=yn.pattern.call(void 0,yn.string.call(void 0),g2),_2=(e=>(e.Eip155="eip155",e))(_2||{});function rO(e){return yn.is.call(void 0,e,y2)}function E2(e){return yn.is.call(void 0,e,w2)}function x2(e){return yn.is.call(void 0,e,m2)}function nO(e){return yn.is.call(void 0,e,b2)}function iO(e){return yn.is.call(void 0,e,v2)}function sO(e){const t=dp.exec(e);if(!p2([t,"optionalAccess",r=>r.groups]))throw new Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}}function oO(e){const t=yp.exec(e);if(!p2([t,"optionalAccess",r=>r.groups]))throw new Error("Invalid CAIP account ID.");return{address:t.groups.accountAddress,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}}function aO(e,t){if(!E2(e))throw new Error(`Invalid "namespace", must match: ${pp.toString()}`);if(!x2(t))throw new Error(`Invalid "reference", must match: ${gp.toString()}`);return`${e}:${t}`}Ir.CAIP_CHAIN_ID_REGEX=dp,Ir.CAIP_NAMESPACE_REGEX=pp,Ir.CAIP_REFERENCE_REGEX=gp,Ir.CAIP_ACCOUNT_ID_REGEX=yp,Ir.CAIP_ACCOUNT_ADDRESS_REGEX=g2,Ir.CaipChainIdStruct=y2,Ir.CaipNamespaceStruct=w2,Ir.CaipReferenceStruct=m2,Ir.CaipAccountIdStruct=b2,Ir.CaipAccountAddressStruct=v2,Ir.KnownCaipNamespace=_2,Ir.isCaipChainId=rO,Ir.isCaipNamespace=E2,Ir.isCaipReference=x2,Ir.isCaipAccountId=nO,Ir.isCaipAccountAddress=iO,Ir.parseCaipChainId=sO,Ir.parseCaipAccountId=oO,Ir.toCaipChainId=aO;var wp={},yl={};Object.defineProperty(yl,"__esModule",{value:!0});function S2(e,t){return e??t()}var cO=Jn,fO=Ns,uO=(e,t={})=>{const r=S2(t.paddingRequired,()=>!1),n=S2(t.characterSet,()=>"base64");let i;n==="base64"?i=String.raw`[A-Za-z0-9+\/]`:(cO.assert.call(void 0,n==="base64url"),i=String.raw`[-_A-Za-z0-9]`);let s;return r?s=new RegExp(`^(?:${i}{4})*(?:${i}{3}=|${i}{2}==)?$`,"u"):s=new RegExp(`^(?:${i}{4})*(?:${i}{2,3}|${i}{3}=|${i}{2}==)?$`,"u"),fO.pattern.call(void 0,e,s)};yl.base64=uO,Object.defineProperty(wp,"__esModule",{value:!0});var lO=yl,A2=Ns,hO=A2.size.call(void 0,lO.base64.call(void 0,A2.string.call(void 0),{paddingRequired:!0}),44,44);wp.ChecksumStruct=hO;var Aa={};Object.defineProperty(Aa,"__esModule",{value:!0});var Ba=Rt,dO=Jn,gr=Ns,B2=gr.union.call(void 0,[gr.number.call(void 0),gr.bigint.call(void 0),gr.string.call(void 0),Ba.StrictHexStruct]),pO=gr.coerce.call(void 0,gr.number.call(void 0),B2,Number),gO=gr.coerce.call(void 0,gr.bigint.call(void 0),B2,BigInt);gr.union.call(void 0,[Ba.StrictHexStruct,gr.instance.call(void 0,Uint8Array)]);var yO=gr.coerce.call(void 0,gr.instance.call(void 0,Uint8Array),gr.union.call(void 0,[Ba.StrictHexStruct]),Ba.hexToBytes),wO=gr.coerce.call(void 0,Ba.StrictHexStruct,gr.instance.call(void 0,Uint8Array),Ba.bytesToHex);function mO(e){try{const t=gr.create.call(void 0,e,pO);return dO.assert.call(void 0,Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){throw t instanceof gr.StructError?new Error(`Expected a number-like value, got "${e}".`):t}}function bO(e){try{return gr.create.call(void 0,e,gO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}function vO(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return gr.create.call(void 0,e,yO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}function _O(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";try{return gr.create.call(void 0,e,wO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}Aa.createNumber=mO,Aa.createBigInt=bO,Aa.createBytes=vO,Aa.createHex=_O;var wl={},Vc={};Object.defineProperty(Vc,"__esModule",{value:!0});var I2=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},EO=(e,t,r)=>(I2(e,t,"read from private field"),r?r.call(e):t.get(e)),xO=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},SO=(e,t,r,n)=>(I2(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);Vc.__privateGet=EO,Vc.__privateAdd=xO,Vc.__privateSet=SO,Object.defineProperty(wl,"__esModule",{value:!0});var Mr=Vc,li,mp=class{constructor(e){Mr.__privateAdd.call(void 0,this,li,void 0),Mr.__privateSet.call(void 0,this,li,new Map(e)),Object.freeze(this)}get size(){return Mr.__privateGet.call(void 0,this,li).size}[Symbol.iterator](){return Mr.__privateGet.call(void 0,this,li)[Symbol.iterator]()}entries(){return Mr.__privateGet.call(void 0,this,li).entries()}forEach(e,t){return Mr.__privateGet.call(void 0,this,li).forEach((r,n,i)=>e.call(t,r,n,this))}get(e){return Mr.__privateGet.call(void 0,this,li).get(e)}has(e){return Mr.__privateGet.call(void 0,this,li).has(e)}keys(){return Mr.__privateGet.call(void 0,this,li).keys()}values(){return Mr.__privateGet.call(void 0,this,li).values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,t])=>`${String(e)} => ${String(t)}`).join(", ")} `:""}}`}};li=new WeakMap;var Ii,bp=class{constructor(e){Mr.__privateAdd.call(void 0,this,Ii,void 0),Mr.__privateSet.call(void 0,this,Ii,new Set(e)),Object.freeze(this)}get size(){return Mr.__privateGet.call(void 0,this,Ii).size}[Symbol.iterator](){return Mr.__privateGet.call(void 0,this,Ii)[Symbol.iterator]()}entries(){return Mr.__privateGet.call(void 0,this,Ii).entries()}forEach(e,t){return Mr.__privateGet.call(void 0,this,Ii).forEach((r,n,i)=>e.call(t,r,n,this))}has(e){return Mr.__privateGet.call(void 0,this,Ii).has(e)}keys(){return Mr.__privateGet.call(void 0,this,Ii).keys()}values(){return Mr.__privateGet.call(void 0,this,Ii).values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}};Ii=new WeakMap,Object.freeze(mp),Object.freeze(mp.prototype),Object.freeze(bp),Object.freeze(bp.prototype),wl.FrozenMap=mp,wl.FrozenSet=bp,Object.defineProperty(oe,"__esModule",{value:!0});var ml=ya,AO=q0,vp=Uc,Xi=ai,$t=It,R2=gl,Nr=Ir,BO=wp,IO=yl,bl=Aa,Dt=Rt,vl=Jn,Wc=Ms,hi=dn,T2=wl;oe.AssertionError=vl.AssertionError,oe.CAIP_ACCOUNT_ADDRESS_REGEX=Nr.CAIP_ACCOUNT_ADDRESS_REGEX,oe.CAIP_ACCOUNT_ID_REGEX=Nr.CAIP_ACCOUNT_ID_REGEX,oe.CAIP_CHAIN_ID_REGEX=Nr.CAIP_CHAIN_ID_REGEX,oe.CAIP_NAMESPACE_REGEX=Nr.CAIP_NAMESPACE_REGEX,oe.CAIP_REFERENCE_REGEX=Nr.CAIP_REFERENCE_REGEX,oe.CaipAccountAddressStruct=Nr.CaipAccountAddressStruct,oe.CaipAccountIdStruct=Nr.CaipAccountIdStruct,oe.CaipChainIdStruct=Nr.CaipChainIdStruct,oe.CaipNamespaceStruct=Nr.CaipNamespaceStruct,oe.CaipReferenceStruct=Nr.CaipReferenceStruct,oe.ChecksumStruct=BO.ChecksumStruct,oe.Duration=vp.Duration,oe.ESCAPE_CHARACTERS_REGEXP=hi.ESCAPE_CHARACTERS_REGEXP,oe.FrozenMap=T2.FrozenMap,oe.FrozenSet=T2.FrozenSet,oe.HexAddressStruct=Dt.HexAddressStruct,oe.HexChecksumAddressStruct=Dt.HexChecksumAddressStruct,oe.HexStruct=Dt.HexStruct,oe.JsonRpcErrorStruct=$t.JsonRpcErrorStruct,oe.JsonRpcFailureStruct=$t.JsonRpcFailureStruct,oe.JsonRpcIdStruct=$t.JsonRpcIdStruct,oe.JsonRpcNotificationStruct=$t.JsonRpcNotificationStruct,oe.JsonRpcParamsStruct=$t.JsonRpcParamsStruct,oe.JsonRpcRequestStruct=$t.JsonRpcRequestStruct,oe.JsonRpcResponseStruct=$t.JsonRpcResponseStruct,oe.JsonRpcSuccessStruct=$t.JsonRpcSuccessStruct,oe.JsonRpcVersionStruct=$t.JsonRpcVersionStruct,oe.JsonSize=hi.JsonSize,oe.JsonStruct=$t.JsonStruct,oe.KnownCaipNamespace=Nr.KnownCaipNamespace,oe.PendingJsonRpcResponseStruct=$t.PendingJsonRpcResponseStruct,oe.StrictHexStruct=Dt.StrictHexStruct,oe.UnsafeJsonStruct=$t.UnsafeJsonStruct,oe.VersionRangeStruct=Xi.VersionRangeStruct,oe.VersionStruct=Xi.VersionStruct,oe.add0x=Dt.add0x,oe.assert=vl.assert,oe.assertExhaustive=vl.assertExhaustive,oe.assertIsBytes=Dt.assertIsBytes,oe.assertIsHexString=Dt.assertIsHexString,oe.assertIsJsonRpcError=$t.assertIsJsonRpcError,oe.assertIsJsonRpcFailure=$t.assertIsJsonRpcFailure,oe.assertIsJsonRpcNotification=$t.assertIsJsonRpcNotification,oe.assertIsJsonRpcRequest=$t.assertIsJsonRpcRequest,oe.assertIsJsonRpcResponse=$t.assertIsJsonRpcResponse,oe.assertIsJsonRpcSuccess=$t.assertIsJsonRpcSuccess,oe.assertIsPendingJsonRpcResponse=$t.assertIsPendingJsonRpcResponse,oe.assertIsSemVerRange=Xi.assertIsSemVerRange,oe.assertIsSemVerVersion=Xi.assertIsSemVerVersion,oe.assertIsStrictHexString=Dt.assertIsStrictHexString,oe.assertStruct=vl.assertStruct,oe.base64=IO.base64,oe.base64ToBytes=Dt.base64ToBytes,oe.bigIntToBytes=Dt.bigIntToBytes,oe.bigIntToHex=ml.bigIntToHex,oe.bytesToBase64=Dt.bytesToBase64,oe.bytesToBigInt=Dt.bytesToBigInt,oe.bytesToHex=Dt.bytesToHex,oe.bytesToNumber=Dt.bytesToNumber,oe.bytesToSignedBigInt=Dt.bytesToSignedBigInt,oe.bytesToString=Dt.bytesToString,oe.calculateNumberSize=hi.calculateNumberSize,oe.calculateStringSize=hi.calculateStringSize,oe.concatBytes=Dt.concatBytes,oe.createBigInt=bl.createBigInt,oe.createBytes=bl.createBytes,oe.createDataView=Dt.createDataView,oe.createDeferredPromise=AO.createDeferredPromise,oe.createHex=bl.createHex,oe.createModuleLogger=R2.createModuleLogger,oe.createNumber=bl.createNumber,oe.createProjectLogger=R2.createProjectLogger,oe.exactOptional=$t.exactOptional,oe.getChecksumAddress=Dt.getChecksumAddress,oe.getErrorMessage=Wc.getErrorMessage,oe.getJsonRpcIdValidator=$t.getJsonRpcIdValidator,oe.getJsonSize=$t.getJsonSize,oe.getKnownPropertyNames=hi.getKnownPropertyNames,oe.getSafeJson=$t.getSafeJson,oe.gtRange=Xi.gtRange,oe.gtVersion=Xi.gtVersion,oe.hasProperty=hi.hasProperty,oe.hexToBigInt=ml.hexToBigInt,oe.hexToBytes=Dt.hexToBytes,oe.hexToNumber=ml.hexToNumber,oe.inMilliseconds=vp.inMilliseconds,oe.isASCII=hi.isASCII,oe.isBytes=Dt.isBytes,oe.isCaipAccountAddress=Nr.isCaipAccountAddress,oe.isCaipAccountId=Nr.isCaipAccountId,oe.isCaipChainId=Nr.isCaipChainId,oe.isCaipNamespace=Nr.isCaipNamespace,oe.isCaipReference=Nr.isCaipReference,oe.isErrorWithCode=Wc.isErrorWithCode,oe.isErrorWithMessage=Wc.isErrorWithMessage,oe.isErrorWithStack=Wc.isErrorWithStack,oe.isHexString=Dt.isHexString,oe.isJsonRpcError=$t.isJsonRpcError,oe.isJsonRpcFailure=$t.isJsonRpcFailure,oe.isJsonRpcNotification=$t.isJsonRpcNotification,oe.isJsonRpcRequest=$t.isJsonRpcRequest,oe.isJsonRpcResponse=$t.isJsonRpcResponse,oe.isJsonRpcSuccess=$t.isJsonRpcSuccess,oe.isNonEmptyArray=hi.isNonEmptyArray,oe.isNullOrUndefined=hi.isNullOrUndefined,oe.isObject=hi.isObject,oe.isPendingJsonRpcResponse=$t.isPendingJsonRpcResponse,oe.isPlainObject=hi.isPlainObject,oe.isStrictHexString=Dt.isStrictHexString,oe.isValidChecksumAddress=Dt.isValidChecksumAddress,oe.isValidHexAddress=Dt.isValidHexAddress,oe.isValidJson=$t.isValidJson,oe.isValidSemVerRange=Xi.isValidSemVerRange,oe.isValidSemVerVersion=Xi.isValidSemVerVersion,oe.jsonrpc2=$t.jsonrpc2,oe.numberToBytes=Dt.numberToBytes,oe.numberToHex=ml.numberToHex,oe.object=$t.object,oe.parseCaipAccountId=Nr.parseCaipAccountId,oe.parseCaipChainId=Nr.parseCaipChainId,oe.remove0x=Dt.remove0x,oe.satisfiesVersionRange=Xi.satisfiesVersionRange,oe.signedBigIntToBytes=Dt.signedBigIntToBytes,oe.stringToBytes=Dt.stringToBytes,oe.timeSince=vp.timeSince,oe.toCaipChainId=Nr.toCaipChainId,oe.valueToBytes=Dt.valueToBytes,oe.wrapError=Wc.wrapError,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.normalize=Qr.recoverPublicKey=Qr.concatSig=Qr.legacyToBuffer=Qr.isNullish=Qr.padWithZeroes=void 0;const Ji=tu,Ia=oe;function _p(e,t){if(e!==""&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(t<0)throw new Error(`Expected a non-negative integer target length. Received: ${t}`);return String.prototype.padStart.call(e,t,"0")}Qr.padWithZeroes=_p;function k2(e){return e==null}Qr.isNullish=k2;function RO(e){return typeof e=="string"&&!(0,Ji.isHexString)(e)?ie.Buffer.from(e):(0,Ji.toBuffer)(e)}Qr.legacyToBuffer=RO;function TO(e,t,r){const n=(0,Ji.fromSigned)(t),i=(0,Ji.fromSigned)(r),s=(0,Ji.bufferToInt)(e),o=_p((0,Ji.toUnsigned)(n).toString("hex"),64),a=_p((0,Ji.toUnsigned)(i).toString("hex"),64),c=(0,Ia.remove0x)((0,Ia.numberToHex)(s));return(0,Ia.add0x)(o.concat(a,c))}Qr.concatSig=TO;function kO(e,t){const r=(0,Ji.fromRpcSig)(t);return(0,Ji.ecrecover)(e,r.v,r.r,r.s)}Qr.recoverPublicKey=kO;function CO(e){if(!k2(e)){if(typeof e=="number"){if(e<0)return"0x";const t=(0,Ia.numberToBytes)(e);e=(0,Ia.bytesToHex)(t)}if(typeof e!="string"){let t="eth-sig-util.normalize() requires hex string or integer input.";throw t+=` received ${typeof e}: ${e}`,new Error(t)}return(0,Ia.add0x)(e.toLowerCase())}}Qr.normalize=CO,Object.defineProperty(ls,"__esModule",{value:!0}),ls.extractPublicKey=ls.recoverPersonalSignature=ls.personalSign=void 0;const Ra=tu,Ri=Qr;function LO({privateKey:e,data:t}){if((0,Ri.isNullish)(t))throw new Error("Missing data parameter");if((0,Ri.isNullish)(e))throw new Error("Missing privateKey parameter");const r=(0,Ri.legacyToBuffer)(t),n=(0,Ra.hashPersonalMessage)(r),i=(0,Ra.ecsign)(n,e);return(0,Ri.concatSig)((0,Ra.toBuffer)(i.v),i.r,i.s)}ls.personalSign=LO;function $O({data:e,signature:t}){if((0,Ri.isNullish)(e))throw new Error("Missing data parameter");if((0,Ri.isNullish)(t))throw new Error("Missing signature parameter");const r=C2(e,t),n=(0,Ra.publicToAddress)(r);return(0,Ra.bufferToHex)(n)}ls.recoverPersonalSignature=$O;function OO({data:e,signature:t}){if((0,Ri.isNullish)(e))throw new Error("Missing data parameter");if((0,Ri.isNullish)(t))throw new Error("Missing signature parameter");return`0x${C2(e,t).toString("hex")}`}ls.extractPublicKey=OO;function C2(e,t){const r=(0,Ra.hashPersonalMessage)((0,Ri.legacyToBuffer)(e));return(0,Ri.recoverPublicKey)(r,t)}var L2={},$2={},O2={},di={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ParserError=e.getErrorStack=e.getErrorMessage=void 0;const t=oe,r=s=>typeof s=="string"?s:s instanceof Error||(0,t.isObject)(s)&&(0,t.hasProperty)(s,"message")&&typeof s.message=="string"?s.message:"Unknown error.";e.getErrorMessage=r;const n=s=>{if(s instanceof Error)return s.stack};e.getErrorStack=n;class i extends Error{constructor(o,a){super(o),this.name="ParserError";const c=(0,e.getErrorStack)(a);c&&(this.stack=c)}}e.ParserError=i})(di);var Ep={},_l={};Object.defineProperty(_l,"__esModule",{value:!0}),_l.iterate=void 0;const M2=oe,MO=function*(e,t=32){for(let r=0;r{(0,M2.assert)(s>=0,"Cannot skip a negative number of bytes."),(0,M2.assert)(s%t===0,"Length must be a multiple of the size."),r+=s},i=e.subarray(r);yield{skip:n,value:i}}return{skip:()=>{},value:new Uint8Array}};_l.iterate=MO;var xp={},N2={},Us={},Fs={};Object.defineProperty(Fs,"__esModule",{value:!0}),Fs.padEnd=Fs.padStart=Fs.set=void 0;const Sp=oe,P2=32,NO=(e,t,r)=>(0,Sp.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);Fs.set=NO;const PO=(e,t=P2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Sp.concatBytes)([r,e])};Fs.padStart=PO;const UO=(e,t=P2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Sp.concatBytes)([e,r])};Fs.padEnd=UO,function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Fs,e)}(Us),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.address=e.getAddress=void 0;const t=oe,r=di,n=Us,i=s=>{const o=(0,t.createBytes)(s);return(0,t.assert)(o.length<=20,new r.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${o.length} bytes.`)),(0,n.padStart)(o,20)};e.getAddress=i,e.address={isDynamic:!1,isType:s=>s==="address",getByteLength(){return 32},encode({buffer:s,value:o,packed:a}){const c=(0,e.getAddress)(o);if(a)return(0,t.concatBytes)([s,c]);const u=(0,n.padStart)(c);return(0,t.concatBytes)([s,u])},decode({value:s}){return(0,t.add0x)((0,t.bytesToHex)(s.slice(12,32)))}}}(N2);var Ap={},El={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fixedBytes=e.getByteLength=void 0;const t=oe,r=di,n=Us,i=/^bytes([0-9]{1,2})$/u,s=o=>{const a=o.match(i)?.[1];(0,t.assert)(a,`Invalid byte length. Expected a number between 1 and 32, but received "${o}".`);const c=Number(a);return(0,t.assert)(c>0&&c<=32,new r.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${o}".`)),c};e.getByteLength=s,e.fixedBytes={isDynamic:!1,isType(o){return i.test(o)},getByteLength(){return 32},encode({type:o,buffer:a,value:c,packed:u}){const l=(0,e.getByteLength)(o),y=(0,t.createBytes)(c);return(0,t.assert)(y.length<=l,new r.ParserError(`Expected a value of length ${l}, but received a value of length ${y.length}.`)),u?(0,t.concatBytes)([a,(0,n.padEnd)(y,l)]):(0,t.concatBytes)([a,(0,n.padEnd)(y)])},decode({type:o,value:a}){const c=(0,e.getByteLength)(o);return a.slice(0,c)}}})(El);var Bp={},U2;function F2(){return U2||(U2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=oe,r=di,n=$p(),i=/^\((.+)\)$/u,s=a=>i.test(a),o=a=>{(0,t.assert)(a.startsWith("(")&&a.endsWith(")"),new r.ParserError(`Invalid tuple type. Expected tuple type, but received "${a}".`));const c=[];let u="",l=0;for(let y=1;y{const l=(0,n.getParser)(u);return(0,n.isDynamicParser)(l,u)})},isType(a){return s(a)},getByteLength(a){return(0,n.isDynamicParser)(this,a)?32:(0,e.getTupleElements)(a).reduce((u,l)=>u+(0,n.getParser)(l).getByteLength(l),0)},encode({type:a,buffer:c,value:u,packed:l,tight:y}){const A=(0,e.getTupleElements)(a);return(0,n.pack)({types:A,values:u,byteArray:c,packed:l,tight:y})},decode({type:a,value:c,skip:u}){const l=(0,e.getTupleElements)(a),y=this.getByteLength(a)-32;return u(y),(0,n.unpack)(l,c)}}}(Bp)),Bp}var D2;function FO(){return D2||(D2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.array=e.getTupleType=e.getArrayType=e.isArrayType=void 0;const t=oe,r=di,n=$p(),i=Us,s=El,o=F2(),a=/^(?.*)\[(?\d*?)\]$/u,c=y=>a.test(y);e.isArrayType=c;const u=y=>{const A=y.match(a);return(0,t.assert)(A?.groups?.type,new r.ParserError(`Invalid array type. Expected an array type, but received "${y}".`)),[A.groups.type,A.groups.length?parseInt(A.groups.length,10):void 0]};e.getArrayType=u;const l=(y,A)=>`(${new Array(A).fill(y).join(",")})`;e.getTupleType=l,e.array={isDynamic(y){const[A,v]=(0,e.getArrayType)(y);return v===void 0||(0,n.isDynamicParser)((0,n.getParser)(A),A)},isType(y){return(0,e.isArrayType)(y)},getByteLength(y){(0,t.assert)((0,e.isArrayType)(y),new r.ParserError(`Expected an array type, but received "${y}".`));const[A,v]=(0,e.getArrayType)(y);return!(0,n.isDynamicParser)(this,y)&&v!==void 0?o.tuple.getByteLength((0,e.getTupleType)(A,v)):32},encode({type:y,buffer:A,value:v,packed:R,tight:O}){const[P,H]=(0,e.getArrayType)(y);if((0,t.assert)(!R||!(0,e.isArrayType)(P),new r.ParserError("Cannot pack nested arrays.")),R&&(0,n.isDynamicParser)((0,n.getParser)(P),P))return(0,n.pack)({types:new Array(v.length).fill(P),values:v,byteArray:A,packed:R,arrayPacked:!0,tight:O});if(H)return(0,t.assert)(H===v.length,new r.ParserError(`Array length does not match type length. Expected a length of ${H}, but received ${v.length}.`)),o.tuple.encode({type:(0,e.getTupleType)(P,H),buffer:A,value:v,packed:s.fixedBytes.isType(P)&&O,tight:O});if(R)return(0,n.pack)({types:new Array(v.length).fill(P),values:v,byteArray:A,packed:s.fixedBytes.isType(P)&&O,arrayPacked:!0,tight:O});const F=(0,i.padStart)((0,t.numberToBytes)(v.length));return(0,n.pack)({types:new Array(v.length).fill(P),values:v,byteArray:(0,t.concatBytes)([A,F]),packed:R,tight:O})},decode({type:y,value:A,...v}){const[R,O]=(0,e.getArrayType)(y);if(O){const H=o.tuple.decode({type:(0,e.getTupleType)(R,O),value:A,...v});return(0,t.assert)(H.length===O,new r.ParserError(`Array length does not match type length. Expected a length of ${O}, but received ${H.length}.`)),H}const P=(0,t.bytesToNumber)(A.subarray(0,32));return(0,n.unpack)(new Array(P).fill(R),A.subarray(32))}}}(Ap)),Ap}var H2={};class j2 extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function DO(e){return ei(e)&&typeof e[Symbol.iterator]=="function"}function ei(e){return typeof e=="object"&&e!=null}function z2(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Pr(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function HO(e){const{done:t,value:r}=e.next();return t?void 0:r}function jO(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${Pr(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*Ip(e,t,r,n){DO(e)||(e=[e]);for(const i of e){const s=jO(i,t,r,n);s&&(yield s)}}function*Rp(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&ei(t.schema)&&ei(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let c="valid";for(const u of t.validator(e,a))u.explanation=r.message,c="not_valid",yield[u,void 0];for(let[u,l,y]of t.entries(e,a)){const A=Rp(l,y,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const v of A)v[0]?(c=v[0].refinement!=null?"not_refined":"not_valid",yield[v[0],void 0]):s&&(l=v[1],u===void 0?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):ei(e)&&(l!==void 0||u in e)&&(e[u]=l))}if(c!=="not_valid")for(const u of t.refiner(e,a))u.explanation=r.message,c="not_refined",yield[u,void 0];c==="valid"&&(yield[void 0,e])}class Rr{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return Ip(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return Ip(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return q2(t,this,r)}create(t,r){return V2(t,this,r)}is(t){return Tp(t,this)}mask(t,r){return W2(t,this,r)}validate(t,r={}){return Ta(t,this,r)}}function q2(e,t,r){const n=Ta(e,t,{message:r});if(n[0])throw n[0]}function V2(e,t,r){const n=Ta(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function W2(e,t,r){const n=Ta(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Tp(e,t){return!Ta(e,t)[0]}function Ta(e,t,r={}){const n=Rp(e,t,r),i=HO(n);return i[0]?[new j2(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function zO(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Zc(n):Kc(n)}function Sn(e,t){return new Rr({type:e,schema:null,validator:t})}function qO(e,t){return new Rr({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function VO(e){return new Rr({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function WO(e){let t;return new Rr({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function KO(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return Zc(n);default:return Kc(n)}}function ZO(e){const t=e instanceof Rr,r=t?{...e.schema}:{...e};for(const n in r)r[n]=K2(r[n]);return t&&e.type==="type"?Zc(r):Kc(r)}function GO(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return Zc(n);default:return Kc(n)}}function YO(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Sn(e,t)}function XO(){return Sn("any",()=>!0)}function JO(e){return new Rr({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Pr(t)}`}})}function QO(){return Sn("bigint",e=>typeof e=="bigint")}function eM(){return Sn("boolean",e=>typeof e=="boolean")}function tM(){return Sn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Pr(e)}`)}function rM(e){const t={},r=e.map(n=>Pr(n)).join();for(const n of e)t[n]=n;return new Rr({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${Pr(n)}`}})}function nM(){return Sn("func",e=>typeof e=="function"||`Expected a function, but received: ${Pr(e)}`)}function iM(e){return Sn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Pr(t)}`)}function sM(){return Sn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Pr(e)}`)}function oM(e){return new Rr({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function aM(e){const t=Pr(e),r=typeof e;return new Rr({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${Pr(n)}`}})}function cM(e,t){return new Rr({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Pr(r)}`}})}function kp(){return Sn("never",()=>!1)}function fM(e){return new Rr({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function uM(){return Sn("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${Pr(e)}`)}function Kc(e){const t=e?Object.keys(e):[],r=kp();return new Rr({type:"object",schema:e||null,*entries(n){if(e&&ei(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return ei(n)||`Expected an object, but received: ${Pr(n)}`},coercer(n){return ei(n)?{...n}:n}})}function K2(e){return new Rr({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function lM(e,t){return new Rr({type:"record",schema:null,*entries(r){if(ei(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return ei(r)||`Expected an object, but received: ${Pr(r)}`}})}function hM(){return Sn("regexp",e=>e instanceof RegExp)}function dM(e){return new Rr({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${Pr(t)}`}})}function Z2(){return Sn("string",e=>typeof e=="string"||`Expected a string, but received: ${Pr(e)}`)}function pM(e){const t=kp();return new Rr({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new Rr({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=Rp(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Pr(r)}`,...i]}})}function G2(){return Sn("unknown",()=>!0)}function Cp(e,t,r){return new Rr({...e,coercer:(n,i)=>Tp(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function yM(e,t,r={}){return Cp(e,G2(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&z2(n)&&z2(i)){const s={...n};let o=!1;for(const a in i)s[a]===void 0&&(s[a]=i[a],o=!0);if(o)return s}return n})}function wM(e){return Cp(e,Z2(),t=>t.trim())}function mM(e){return xo(e,"empty",t=>{const r=Y2(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function Y2(e){return e instanceof Map||e instanceof Set?e.size:e.length}function bM(e,t,r={}){const{exclusive:n}=r;return xo(e,"max",i=>n?in?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function _M(e){return xo(e,"nonempty",t=>Y2(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function EM(e,t){return xo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function xM(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return xo(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:o}=s;return t<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}else{const{length:o}=s;return t<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}})}function xo(e,t,r){return new Rr({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),o=Ip(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var SM=Object.freeze({__proto__:null,Struct:Rr,StructError:j2,any:XO,array:JO,assert:q2,assign:zO,bigint:QO,boolean:eM,coerce:Cp,create:V2,date:tM,defaulted:yM,define:Sn,deprecated:qO,dynamic:VO,empty:mM,enums:rM,func:nM,instance:iM,integer:sM,intersection:oM,is:Tp,lazy:WO,literal:aM,map:cM,mask:W2,max:bM,min:vM,never:kp,nonempty:_M,nullable:fM,number:uM,object:Kc,omit:KO,optional:K2,partial:ZO,pattern:EM,pick:GO,record:lM,refine:xo,regexp:hM,set:dM,size:xM,string:Z2,struct:YO,trimmed:wM,tuple:pM,type:Zc,union:gM,unknown:G2,validate:Ta}),X2=Un(SM),Lp={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.number=e.getBigInt=e.assertNumberLength=e.getLength=e.isSigned=void 0;const t=oe,r=di,n=Us,i=/^u?int(?[0-9]*)?$/u,s=u=>!u.startsWith("u");e.isSigned=s;const o=u=>{if(u==="int"||u==="uint")return 256;const l=u.match(i);(0,t.assert)(l?.groups?.length,new r.ParserError(`Invalid number type. Expected a number type, but received "${u}".`));const y=parseInt(l.groups.length,10);return(0,t.assert)(y>=8&&y<=256,new r.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${u}".`)),(0,t.assert)(y%8===0,new r.ParserError(`Invalid number length. Expected a multiple of 8, but received "${u}".`)),y};e.getLength=o;const a=(u,l)=>{const y=(0,e.getLength)(l),A=BigInt(2)**BigInt(y-((0,e.isSigned)(l)?1:0))-BigInt(1);if((0,e.isSigned)(l)){(0,t.assert)(u>=-(A+BigInt(1))&&u<=A,new r.ParserError(`Number "${u}" is out of range for type "${l}".`));return}(0,t.assert)(u<=A,new r.ParserError(`Number "${u}" is out of range for type "${l}".`))};e.assertNumberLength=a;const c=u=>{try{return(0,t.createBigInt)(u)}catch{throw new r.ParserError(`Invalid number. Expected a valid number value, but received "${u}".`)}};e.getBigInt=c,e.number={isDynamic:!1,isType(u){return i.test(u)},getByteLength(){return 32},encode({type:u,buffer:l,value:y,packed:A}){const v=(0,e.getBigInt)(y);if((0,e.assertNumberLength)(v,u),(0,e.isSigned)(u)){if(A){const R=(0,e.getLength)(u)/8;return(0,t.concatBytes)([l,(0,t.signedBigIntToBytes)(v,R)])}return(0,t.concatBytes)([l,(0,n.padStart)((0,t.signedBigIntToBytes)(v,32))])}if(A){const R=(0,e.getLength)(u)/8;return(0,t.concatBytes)([l,(0,n.padStart)((0,t.bigIntToBytes)(v),R)])}return(0,t.concatBytes)([l,(0,n.padStart)((0,t.bigIntToBytes)(v))])},decode({type:u,value:l}){const y=l.subarray(0,32);if((0,e.isSigned)(u)){const v=(0,t.bytesToSignedBigInt)(y);return(0,e.assertNumberLength)(v,u),v}const A=(0,t.bytesToBigInt)(y);return(0,e.assertNumberLength)(A,u),A}}})(Lp),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=oe,r=X2,n=di,i=Lp,s=(0,r.coerce)((0,r.boolean)(),(0,r.union)([(0,r.literal)("true"),(0,r.literal)("false")]),a=>a==="true"),o=a=>{try{return(0,r.create)(a,s)?BigInt(1):BigInt(0)}catch{throw new n.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${a}".`)}};e.getBooleanValue=o,e.bool={isDynamic:!1,isType:a=>a==="bool",getByteLength(){return 32},encode({buffer:a,value:c,packed:u,tight:l}){const y=(0,e.getBooleanValue)(c);return u?(0,t.concatBytes)([a,(0,t.bigIntToBytes)(y)]):i.number.encode({type:"uint256",buffer:a,value:y,packed:u,tight:l})},decode(a){return i.number.decode({...a,type:"uint256"})===BigInt(1)}}}(H2);var Gc={};Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.bytes=void 0;const Yc=oe,J2=Us;Gc.bytes={isDynamic:!0,isType:e=>e==="bytes",getByteLength(){return 32},encode({buffer:e,value:t,packed:r}){const n=(0,Yc.createBytes)(t);if(r)return(0,Yc.concatBytes)([e,n]);const i=Math.ceil(n.byteLength/32)*32;return(0,Yc.concatBytes)([e,(0,J2.padStart)((0,Yc.numberToBytes)(n.byteLength)),(0,J2.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,Yc.bytesToNumber)(t);return e.slice(32,32+r)}};var Q2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=oe,r=X2,n=di,i=El,s=(0,r.coerce)((0,r.object)({address:t.StrictHexStruct,selector:t.StrictHexStruct}),(0,r.union)([t.StrictHexStruct,(0,r.instance)(Uint8Array)]),a=>{const c=(0,t.createBytes)(a);return(0,t.assert)(c.length===24,new n.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${c.length} bytes.`)),{address:(0,t.bytesToHex)(c.subarray(0,20)),selector:(0,t.bytesToHex)(c.subarray(20,24))}}),o=a=>{const c=(0,r.create)(a,s);return(0,t.concatBytes)([(0,t.hexToBytes)(c.address),(0,t.hexToBytes)(c.selector)])};e.getFunction=o,e.fn={isDynamic:!1,isType:a=>a==="function",getByteLength(){return 32},encode({buffer:a,value:c,packed:u,tight:l}){const y=(0,e.getFunction)(c);return i.fixedBytes.encode({type:"bytes24",buffer:a,value:y,packed:u,tight:l})},decode({value:a}){return{address:(0,t.bytesToHex)(a.slice(0,20)),selector:(0,t.bytesToHex)(a.slice(20,24))}}}})(Q2);var eE={};Object.defineProperty(eE,"__esModule",{value:!0});var xl={};Object.defineProperty(xl,"__esModule",{value:!0}),xl.string=void 0;const tE=oe,rE=Gc;xl.string={isDynamic:!0,isType:e=>e==="string",getByteLength(){return 32},encode({buffer:e,value:t,packed:r,tight:n}){return rE.bytes.encode({type:"bytes",buffer:e,value:(0,tE.stringToBytes)(t),packed:r,tight:n})},decode(e){return(0,tE.bytesToString)(rE.bytes.decode(e))}};var nE;function iE(){return nE||(nE=1,function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(N2,e),r(FO(),e),r(H2,e),r(Gc,e),r(El,e),r(Q2,e),r(Lp,e),r(eE,e),r(xl,e),r(F2(),e)}(xp)),xp}var sE;function $p(){return sE||(sE=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=e.pack=e.isDynamicParser=e.getParser=void 0;const t=oe,r=di,n=_l,i=iE(),s=Us,o=l=>{const y={address:i.address,array:i.array,bool:i.bool,bytes:i.bytes,fixedBytes:i.fixedBytes,function:i.fn,number:i.number,string:i.string,tuple:i.tuple},A=y[l];if(A)return A;const v=Object.values(y).find(R=>R.isType(l));if(v)return v;throw new r.ParserError(`The type "${l}" is not supported.`)};e.getParser=o;const a=(l,y)=>{const{isDynamic:A}=l;return typeof A=="function"?A(y):A};e.isDynamicParser=a;const c=({types:l,values:y,packed:A=!1,tight:v=!1,arrayPacked:R=!1,byteArray:O=new Uint8Array})=>{(0,t.assert)(l.length===y.length,new r.ParserError(`The number of types (${l.length}) does not match the number of values (${y.length}).`));const{staticBuffer:P,dynamicBuffer:H,pointers:F}=l.reduce(({staticBuffer:q,dynamicBuffer:G,pointers:Z},z,ee)=>{const se=(0,e.getParser)(z),Q=y[ee];if(A||R||!(0,e.isDynamicParser)(se,z))return{staticBuffer:se.encode({buffer:q,value:Q,type:z,packed:A,tight:v}),dynamicBuffer:G,pointers:Z};const I=(0,t.concatBytes)([q,new Uint8Array(32)]),g=se.encode({buffer:G,value:Q,type:z,packed:A,tight:v});return{staticBuffer:I,dynamicBuffer:g,pointers:[...Z,{position:q.length,pointer:G.length}]}},{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,t.assert)(!A&&!R||H.length===0,new r.ParserError("Invalid pack state."));const N=P.length,$=F.reduce((q,{pointer:G,position:Z})=>{const z=(0,s.padStart)((0,t.numberToBytes)(N+G));return(0,s.set)(q,z,Z)},P);return(0,t.concatBytes)([O,$,H])};e.pack=c;const u=(l,y)=>{const A=(0,n.iterate)(y);return l.map(v=>{const{value:{value:R,skip:O},done:P}=A.next();(0,t.assert)(!P,new r.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${v}".`));const H=(0,e.getParser)(v);if((0,e.isDynamicParser)(H,v)){const N=(0,t.bytesToNumber)(R.subarray(0,32)),$=y.subarray(N);return H.decode({type:v,value:$,skip:O})}return H.decode({type:v,value:R,skip:O})})};e.unpack=u}(Ep)),Ep}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSingle=e.decode=e.encodePacked=e.encodeSingle=e.encode=void 0;const t=oe,r=di,n=$p(),i=(u,l,y,A)=>{try{return(0,n.pack)({types:u,values:l,packed:y,tight:A})}catch(v){throw v instanceof r.ParserError?new r.ParserError(`Unable to encode value: ${v.message}`,v):new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(v)}`,v)}};e.encode=i;const s=(u,l)=>(0,e.encode)([u],[l]);e.encodeSingle=s;const o=(u,l,y)=>(0,e.encode)(u,l,!0,y);e.encodePacked=o;const a=(u,l)=>{const y=(0,t.createBytes)(l);try{return(0,n.unpack)(u,y)}catch(A){throw A instanceof r.ParserError?new r.ParserError(`Unable to decode value: ${A.message}`,A):new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(A)}`,A)}};e.decode=a;const c=(u,l)=>{const y=(0,e.decode)([u],l);return(0,t.assert)(y.length===1,new r.ParserError("Decoded value array has unexpected length.")),y[0]};e.decodeSingle=c})(O2);var oE={},aE={};Object.defineProperty(aE,"__esModule",{value:!0}),function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(aE,e)}(oE),function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(O2,e),r(di,e),r(oE,e)}($2),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature=e.signTypedData=e.typedSignatureHash=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=e.SignTypedDataVersion=void 0;const t=tu,r=$2,n=iE(),i=Us,s=oe,o=Wn,a=Qr;var c;(function(I){I.V1="V1",I.V3="V3",I.V4="V4"})(c=e.SignTypedDataVersion||(e.SignTypedDataVersion={})),e.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]};function u(I,g){if(Object.keys(c).includes(I)){if(g&&!g.includes(I))throw new Error(`SignTypedDataVersion not allowed: '${I}'. Allowed versions are: ${g.join(", ")}`)}else throw new Error(`Invalid version: '${I}'`)}function l(I,g){(0,s.assert)(g!==null,`Unable to encode value: Invalid number. Expected a valid number value, but received "${g}".`);const f=BigInt(g),h=(0,n.getLength)(I),m=BigInt(2)**BigInt(h)-BigInt(1);return(0,s.assert)(f>=-m&&f<=m,`Unable to encode value: Number "${g}" is out of range for type "${I}".`),f}function y(I){let g=BigInt(0);for(let f=0;f=49?g+=h-BigInt(49)+BigInt(10):h>=17?g+=h-BigInt(17)+BigInt(10):g+=h}return(0,i.padStart)((0,s.bigIntToBytes)(g),20)}function A(I,g,f,h,m){if(u(m,[c.V3,c.V4]),I[f]!==void 0)return["bytes32",m===c.V4&&h==null?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,o.keccak256)(v(f,h,I,m)))];if(f==="function")throw new Error('Unsupported or invalid type: "function"');if(h===void 0)throw new Error(`missing value for field ${g} of type ${f}`);if(f==="address"){if(typeof h=="number")return["address",(0,i.padStart)((0,s.numberToBytes)(h),20)];if((0,s.isStrictHexString)(h))return["address",(0,s.add0x)(h)];if(typeof h=="string")return["address",y(h).subarray(0,20)]}if(f==="bool")return["bool",!!h];if(f==="bytes")return typeof h=="number"?h=(0,s.numberToBytes)(h):(0,s.isStrictHexString)(h)||h==="0x"?h=(0,s.hexToBytes)(h):typeof h=="string"&&(h=(0,s.stringToBytes)(h)),["bytes32",(0,t.arrToBufArr)((0,o.keccak256)(h))];if(f.startsWith("bytes")&&f!=="bytes"&&!f.includes("["))return typeof h=="number"?h<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,s.bigIntToBytes)(BigInt(h))]:(0,s.isStrictHexString)(h)?["bytes32",(0,s.hexToBytes)(h)]:["bytes32",h];if(f.startsWith("int")&&!f.includes("[")){const _=l(f,h);return _>=BigInt(0)?["uint256",_]:["int256",_]}if(f==="string")return typeof h=="number"?h=(0,s.numberToBytes)(h):h=(0,s.stringToBytes)(h??""),["bytes32",(0,t.arrToBufArr)((0,o.keccak256)(h))];if(f.endsWith("]")){if(m===c.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const _=f.slice(0,f.lastIndexOf("[")),E=h.map(x=>A(I,g,_,x,m));return["bytes32",(0,t.arrToBufArr)((0,o.keccak256)((0,r.encode)(E.map(([x])=>x),E.map(([,x])=>x))))]}return[f,h]}function v(I,g,f,h){u(h,[c.V3,c.V4]);const m=["bytes32"],_=[H(I,f)];for(const E of f[I]){if(h===c.V3&&g[E.name]===void 0)continue;const[x,T]=A(f,E.name,E.type,g[E.name],h);m.push(x),_.push(T)}return(0,t.arrToBufArr)((0,r.encode)(m,_))}function R(I,g){let f="";const h=O(I,g);h.delete(I);const m=[I,...Array.from(h).sort()];for(const _ of m){if(!g[_])throw new Error(`No type definition specified: ${_}`);f+=`${_}(${g[_].map(({name:x,type:T})=>`${T} ${x}`).join(",")})`}return f}function O(I,g,f=new Set){if(typeof I!="string")throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(I)}`);if([I]=I.match(/^\w*/u),f.has(I)||g[I]===void 0)return f;f.add(I);for(const m of g[I])O(m.type,g,f);return f}function P(I,g,f,h){u(h,[c.V3,c.V4]);const m=v(I,g,f,h),_=(0,o.keccak256)(m);return(0,t.arrToBufArr)(_)}function H(I,g){const f=(0,s.stringToBytes)(R(I,g));return(0,t.arrToBufArr)((0,o.keccak256)(f))}function F(I){const g={};for(const f in e.TYPED_MESSAGE_SCHEMA.properties)I[f]&&(g[f]=I[f]);return"types"in g&&(g.types=Object.assign({EIP712Domain:[]},g.types)),g}function N(I,g){u(g,[c.V3,c.V4]);const f=F(I),{domain:h}=f,m={EIP712Domain:f.types.EIP712Domain};return P("EIP712Domain",h,m,g)}function $(I,g){u(g,[c.V3,c.V4]);const f=F(I),h=[(0,s.hexToBytes)("1901")];return h.push(N(I,g)),f.primaryType!=="EIP712Domain"&&h.push(P(f.primaryType,f.message,f.types,g)),(0,t.arrToBufArr)((0,o.keccak256)((0,s.concatBytes)(h)))}e.TypedDataUtils={encodeData:v,encodeType:R,findTypeDependencies:O,hashStruct:P,hashType:H,sanitizeData:F,eip712Hash:$,eip712DomainHash:N};function q(I){const g=ee(I);return(0,s.bytesToHex)(g)}e.typedSignatureHash=q;function G(I,g){if((0,n.isArrayType)(I)&&Array.isArray(g)){const[f]=(0,n.getArrayType)(I);return g.map(h=>G(f,h))}if(I==="address"){if(typeof g=="number")return(0,i.padStart)((0,s.numberToBytes)(g),20);if((0,s.isStrictHexString)(g))return(0,i.padStart)((0,s.hexToBytes)(g).subarray(0,20),20);if(g instanceof Uint8Array)return(0,i.padStart)(g.subarray(0,20),20)}if(I==="bool")return!!g;if(I.startsWith("bytes")&&I!=="bytes"){const f=(0,n.getByteLength)(I);if(typeof g=="number")return g<0?new Uint8Array:(0,s.numberToBytes)(g).subarray(0,f);if((0,s.isStrictHexString)(g))return(0,s.hexToBytes)(g).subarray(0,f);if(g instanceof Uint8Array)return g.subarray(0,f)}if(I.startsWith("uint")&&typeof g=="number")return Math.abs(g);if(I.startsWith("int")&&typeof g=="number"){const f=(0,n.getLength)(I);return BigInt.asIntN(f,BigInt(g))}return g}function Z(I){return I.map(g=>typeof g=="number"?(0,i.padStart)((0,s.numberToBytes)(g),32):(0,s.isStrictHexString)(g)?(0,i.padStart)((0,s.hexToBytes)(g).subarray(0,32),32):g instanceof Uint8Array?(0,i.padStart)(g.subarray(0,32),32):g)}function z(I,g){return g.map(f=>{if(typeof f=="string"||typeof f=="number"||typeof f=="bigint"){const h=l(I,f);if(h>=BigInt(0))return(0,i.padStart)((0,s.bigIntToBytes)(h),32);const m=(0,n.getLength)(I),_=BigInt.asIntN(m,h);return(0,s.signedBigIntToBytes)(_,32)}return f})}function ee(I){const g=new Error("Expect argument to be non-empty array");if(typeof I!="object"||!("length"in I)||!I.length)throw g;const f=I.map(({name:E,type:x,value:T})=>{if(x==="address[]")return{name:E,type:"bytes32[]",value:Z(T)};if(x.startsWith("int")&&(0,n.isArrayType)(x)){const[B,d]=(0,n.getArrayType)(x);return{name:E,type:`bytes32[${d??""}]`,value:z(B,T)}}return{name:E,type:x,value:G(x,T)}}),h=f.map(E=>E.type!=="bytes"?E.value:(0,a.legacyToBuffer)(E.value)),m=f.map(E=>{if(E.type==="function")throw new Error('Unsupported or invalid type: "function"');return E.type}),_=I.map(E=>{if(!E.name)throw g;return`${E.type} ${E.name}`});return(0,t.arrToBufArr)((0,o.keccak256)((0,r.encodePacked)(["bytes32","bytes32"],[(0,o.keccak256)((0,r.encodePacked)(["string[]"],[_],!0)),(0,o.keccak256)((0,r.encodePacked)(m,h,!0))])))}function se({privateKey:I,data:g,version:f}){if(u(f),(0,a.isNullish)(g))throw new Error("Missing data parameter");if((0,a.isNullish)(I))throw new Error("Missing private key parameter");const h=f===c.V1?ee(g):e.TypedDataUtils.eip712Hash(g,f),m=(0,t.ecsign)(h,I);return(0,a.concatSig)((0,t.arrToBufArr)((0,s.bigIntToBytes)(m.v)),m.r,m.s)}e.signTypedData=se;function Q({data:I,signature:g,version:f}){if(u(f),(0,a.isNullish)(I))throw new Error("Missing data parameter");if((0,a.isNullish)(g))throw new Error("Missing signature parameter");const h=f===c.V1?ee(I):e.TypedDataUtils.eip712Hash(I,f),m=(0,a.recoverPublicKey)(h,g),_=(0,t.publicToAddress)(m);return(0,s.bytesToHex)(_)}e.recoverTypedSignature=Q}(L2);var ti={},cE={exports:{}};(function(e){(function(t){var r=function(S){var L,M=new Float64Array(16);if(S)for(L=0;L>24&255,S[L+1]=M>>16&255,S[L+2]=M>>8&255,S[L+3]=M&255,S[L+4]=p>>24&255,S[L+5]=p>>16&255,S[L+6]=p>>8&255,S[L+7]=p&255}function O(S,L,M,p,U){var J,Y=0;for(J=0;J>>8)-1}function P(S,L,M,p){return O(S,L,M,p,16)}function H(S,L,M,p){return O(S,L,M,p,32)}function F(S,L,M,p){for(var U=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,J=M[0]&255|(M[1]&255)<<8|(M[2]&255)<<16|(M[3]&255)<<24,Y=M[4]&255|(M[5]&255)<<8|(M[6]&255)<<16|(M[7]&255)<<24,ue=M[8]&255|(M[9]&255)<<8|(M[10]&255)<<16|(M[11]&255)<<24,_e=M[12]&255|(M[13]&255)<<8|(M[14]&255)<<16|(M[15]&255)<<24,Ae=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Ee=L[0]&255|(L[1]&255)<<8|(L[2]&255)<<16|(L[3]&255)<<24,Bt=L[4]&255|(L[5]&255)<<8|(L[6]&255)<<16|(L[7]&255)<<24,Le=L[8]&255|(L[9]&255)<<8|(L[10]&255)<<16|(L[11]&255)<<24,Ke=L[12]&255|(L[13]&255)<<8|(L[14]&255)<<16|(L[15]&255)<<24,Ye=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,lt=M[16]&255|(M[17]&255)<<8|(M[18]&255)<<16|(M[19]&255)<<24,ct=M[20]&255|(M[21]&255)<<8|(M[22]&255)<<16|(M[23]&255)<<24,Xe=M[24]&255|(M[25]&255)<<8|(M[26]&255)<<16|(M[27]&255)<<24,rt=M[28]&255|(M[29]&255)<<8|(M[30]&255)<<16|(M[31]&255)<<24,Je=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,$e=U,De=J,Re=Y,Me=ue,Ne=_e,Ie=Ae,ce=Ee,fe=Bt,ye=Le,he=Ke,de=Ye,ve=lt,Ve=ct,gt=Xe,wt=rt,yt=Je,j,Et=0;Et<20;Et+=2)j=$e+Ve|0,Ne^=j<<7|j>>>32-7,j=Ne+$e|0,ye^=j<<9|j>>>32-9,j=ye+Ne|0,Ve^=j<<13|j>>>32-13,j=Ve+ye|0,$e^=j<<18|j>>>32-18,j=Ie+De|0,he^=j<<7|j>>>32-7,j=he+Ie|0,gt^=j<<9|j>>>32-9,j=gt+he|0,De^=j<<13|j>>>32-13,j=De+gt|0,Ie^=j<<18|j>>>32-18,j=de+ce|0,wt^=j<<7|j>>>32-7,j=wt+de|0,Re^=j<<9|j>>>32-9,j=Re+wt|0,ce^=j<<13|j>>>32-13,j=ce+Re|0,de^=j<<18|j>>>32-18,j=yt+ve|0,Me^=j<<7|j>>>32-7,j=Me+yt|0,fe^=j<<9|j>>>32-9,j=fe+Me|0,ve^=j<<13|j>>>32-13,j=ve+fe|0,yt^=j<<18|j>>>32-18,j=$e+Me|0,De^=j<<7|j>>>32-7,j=De+$e|0,Re^=j<<9|j>>>32-9,j=Re+De|0,Me^=j<<13|j>>>32-13,j=Me+Re|0,$e^=j<<18|j>>>32-18,j=Ie+Ne|0,ce^=j<<7|j>>>32-7,j=ce+Ie|0,fe^=j<<9|j>>>32-9,j=fe+ce|0,Ne^=j<<13|j>>>32-13,j=Ne+fe|0,Ie^=j<<18|j>>>32-18,j=de+he|0,ve^=j<<7|j>>>32-7,j=ve+de|0,ye^=j<<9|j>>>32-9,j=ye+ve|0,he^=j<<13|j>>>32-13,j=he+ye|0,de^=j<<18|j>>>32-18,j=yt+wt|0,Ve^=j<<7|j>>>32-7,j=Ve+yt|0,gt^=j<<9|j>>>32-9,j=gt+Ve|0,wt^=j<<13|j>>>32-13,j=wt+gt|0,yt^=j<<18|j>>>32-18;$e=$e+U|0,De=De+J|0,Re=Re+Y|0,Me=Me+ue|0,Ne=Ne+_e|0,Ie=Ie+Ae|0,ce=ce+Ee|0,fe=fe+Bt|0,ye=ye+Le|0,he=he+Ke|0,de=de+Ye|0,ve=ve+lt|0,Ve=Ve+ct|0,gt=gt+Xe|0,wt=wt+rt|0,yt=yt+Je|0,S[0]=$e>>>0&255,S[1]=$e>>>8&255,S[2]=$e>>>16&255,S[3]=$e>>>24&255,S[4]=De>>>0&255,S[5]=De>>>8&255,S[6]=De>>>16&255,S[7]=De>>>24&255,S[8]=Re>>>0&255,S[9]=Re>>>8&255,S[10]=Re>>>16&255,S[11]=Re>>>24&255,S[12]=Me>>>0&255,S[13]=Me>>>8&255,S[14]=Me>>>16&255,S[15]=Me>>>24&255,S[16]=Ne>>>0&255,S[17]=Ne>>>8&255,S[18]=Ne>>>16&255,S[19]=Ne>>>24&255,S[20]=Ie>>>0&255,S[21]=Ie>>>8&255,S[22]=Ie>>>16&255,S[23]=Ie>>>24&255,S[24]=ce>>>0&255,S[25]=ce>>>8&255,S[26]=ce>>>16&255,S[27]=ce>>>24&255,S[28]=fe>>>0&255,S[29]=fe>>>8&255,S[30]=fe>>>16&255,S[31]=fe>>>24&255,S[32]=ye>>>0&255,S[33]=ye>>>8&255,S[34]=ye>>>16&255,S[35]=ye>>>24&255,S[36]=he>>>0&255,S[37]=he>>>8&255,S[38]=he>>>16&255,S[39]=he>>>24&255,S[40]=de>>>0&255,S[41]=de>>>8&255,S[42]=de>>>16&255,S[43]=de>>>24&255,S[44]=ve>>>0&255,S[45]=ve>>>8&255,S[46]=ve>>>16&255,S[47]=ve>>>24&255,S[48]=Ve>>>0&255,S[49]=Ve>>>8&255,S[50]=Ve>>>16&255,S[51]=Ve>>>24&255,S[52]=gt>>>0&255,S[53]=gt>>>8&255,S[54]=gt>>>16&255,S[55]=gt>>>24&255,S[56]=wt>>>0&255,S[57]=wt>>>8&255,S[58]=wt>>>16&255,S[59]=wt>>>24&255,S[60]=yt>>>0&255,S[61]=yt>>>8&255,S[62]=yt>>>16&255,S[63]=yt>>>24&255}function N(S,L,M,p){for(var U=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,J=M[0]&255|(M[1]&255)<<8|(M[2]&255)<<16|(M[3]&255)<<24,Y=M[4]&255|(M[5]&255)<<8|(M[6]&255)<<16|(M[7]&255)<<24,ue=M[8]&255|(M[9]&255)<<8|(M[10]&255)<<16|(M[11]&255)<<24,_e=M[12]&255|(M[13]&255)<<8|(M[14]&255)<<16|(M[15]&255)<<24,Ae=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Ee=L[0]&255|(L[1]&255)<<8|(L[2]&255)<<16|(L[3]&255)<<24,Bt=L[4]&255|(L[5]&255)<<8|(L[6]&255)<<16|(L[7]&255)<<24,Le=L[8]&255|(L[9]&255)<<8|(L[10]&255)<<16|(L[11]&255)<<24,Ke=L[12]&255|(L[13]&255)<<8|(L[14]&255)<<16|(L[15]&255)<<24,Ye=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,lt=M[16]&255|(M[17]&255)<<8|(M[18]&255)<<16|(M[19]&255)<<24,ct=M[20]&255|(M[21]&255)<<8|(M[22]&255)<<16|(M[23]&255)<<24,Xe=M[24]&255|(M[25]&255)<<8|(M[26]&255)<<16|(M[27]&255)<<24,rt=M[28]&255|(M[29]&255)<<8|(M[30]&255)<<16|(M[31]&255)<<24,Je=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,$e=U,De=J,Re=Y,Me=ue,Ne=_e,Ie=Ae,ce=Ee,fe=Bt,ye=Le,he=Ke,de=Ye,ve=lt,Ve=ct,gt=Xe,wt=rt,yt=Je,j,Et=0;Et<20;Et+=2)j=$e+Ve|0,Ne^=j<<7|j>>>32-7,j=Ne+$e|0,ye^=j<<9|j>>>32-9,j=ye+Ne|0,Ve^=j<<13|j>>>32-13,j=Ve+ye|0,$e^=j<<18|j>>>32-18,j=Ie+De|0,he^=j<<7|j>>>32-7,j=he+Ie|0,gt^=j<<9|j>>>32-9,j=gt+he|0,De^=j<<13|j>>>32-13,j=De+gt|0,Ie^=j<<18|j>>>32-18,j=de+ce|0,wt^=j<<7|j>>>32-7,j=wt+de|0,Re^=j<<9|j>>>32-9,j=Re+wt|0,ce^=j<<13|j>>>32-13,j=ce+Re|0,de^=j<<18|j>>>32-18,j=yt+ve|0,Me^=j<<7|j>>>32-7,j=Me+yt|0,fe^=j<<9|j>>>32-9,j=fe+Me|0,ve^=j<<13|j>>>32-13,j=ve+fe|0,yt^=j<<18|j>>>32-18,j=$e+Me|0,De^=j<<7|j>>>32-7,j=De+$e|0,Re^=j<<9|j>>>32-9,j=Re+De|0,Me^=j<<13|j>>>32-13,j=Me+Re|0,$e^=j<<18|j>>>32-18,j=Ie+Ne|0,ce^=j<<7|j>>>32-7,j=ce+Ie|0,fe^=j<<9|j>>>32-9,j=fe+ce|0,Ne^=j<<13|j>>>32-13,j=Ne+fe|0,Ie^=j<<18|j>>>32-18,j=de+he|0,ve^=j<<7|j>>>32-7,j=ve+de|0,ye^=j<<9|j>>>32-9,j=ye+ve|0,he^=j<<13|j>>>32-13,j=he+ye|0,de^=j<<18|j>>>32-18,j=yt+wt|0,Ve^=j<<7|j>>>32-7,j=Ve+yt|0,gt^=j<<9|j>>>32-9,j=gt+Ve|0,wt^=j<<13|j>>>32-13,j=wt+gt|0,yt^=j<<18|j>>>32-18;S[0]=$e>>>0&255,S[1]=$e>>>8&255,S[2]=$e>>>16&255,S[3]=$e>>>24&255,S[4]=Ie>>>0&255,S[5]=Ie>>>8&255,S[6]=Ie>>>16&255,S[7]=Ie>>>24&255,S[8]=de>>>0&255,S[9]=de>>>8&255,S[10]=de>>>16&255,S[11]=de>>>24&255,S[12]=yt>>>0&255,S[13]=yt>>>8&255,S[14]=yt>>>16&255,S[15]=yt>>>24&255,S[16]=ce>>>0&255,S[17]=ce>>>8&255,S[18]=ce>>>16&255,S[19]=ce>>>24&255,S[20]=fe>>>0&255,S[21]=fe>>>8&255,S[22]=fe>>>16&255,S[23]=fe>>>24&255,S[24]=ye>>>0&255,S[25]=ye>>>8&255,S[26]=ye>>>16&255,S[27]=ye>>>24&255,S[28]=he>>>0&255,S[29]=he>>>8&255,S[30]=he>>>16&255,S[31]=he>>>24&255}function $(S,L,M,p){F(S,L,M,p)}function q(S,L,M,p){N(S,L,M,p)}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Z(S,L,M,p,U,J,Y){var ue=new Uint8Array(16),_e=new Uint8Array(64),Ae,Ee;for(Ee=0;Ee<16;Ee++)ue[Ee]=0;for(Ee=0;Ee<8;Ee++)ue[Ee]=J[Ee];for(;U>=64;){for($(_e,ue,Y,G),Ee=0;Ee<64;Ee++)S[L+Ee]=M[p+Ee]^_e[Ee];for(Ae=1,Ee=8;Ee<16;Ee++)Ae=Ae+(ue[Ee]&255)|0,ue[Ee]=Ae&255,Ae>>>=8;U-=64,L+=64,p+=64}if(U>0)for($(_e,ue,Y,G),Ee=0;Ee=64;){for($(Y,J,U,G),_e=0;_e<64;_e++)S[L+_e]=Y[_e];for(ue=1,_e=8;_e<16;_e++)ue=ue+(J[_e]&255)|0,J[_e]=ue&255,ue>>>=8;M-=64,L+=64}if(M>0)for($(Y,J,U,G),_e=0;_e>>13|M<<3)&8191,p=S[4]&255|(S[5]&255)<<8,this.r[2]=(M>>>10|p<<6)&7939,U=S[6]&255|(S[7]&255)<<8,this.r[3]=(p>>>7|U<<9)&8191,J=S[8]&255|(S[9]&255)<<8,this.r[4]=(U>>>4|J<<12)&255,this.r[5]=J>>>1&8190,Y=S[10]&255|(S[11]&255)<<8,this.r[6]=(J>>>14|Y<<2)&8191,ue=S[12]&255|(S[13]&255)<<8,this.r[7]=(Y>>>11|ue<<5)&8065,_e=S[14]&255|(S[15]&255)<<8,this.r[8]=(ue>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=S[16]&255|(S[17]&255)<<8,this.pad[1]=S[18]&255|(S[19]&255)<<8,this.pad[2]=S[20]&255|(S[21]&255)<<8,this.pad[3]=S[22]&255|(S[23]&255)<<8,this.pad[4]=S[24]&255|(S[25]&255)<<8,this.pad[5]=S[26]&255|(S[27]&255)<<8,this.pad[6]=S[28]&255|(S[29]&255)<<8,this.pad[7]=S[30]&255|(S[31]&255)<<8};Q.prototype.blocks=function(S,L,M){for(var p=this.fin?0:2048,U,J,Y,ue,_e,Ae,Ee,Bt,Le,Ke,Ye,lt,ct,Xe,rt,Je,$e,De,Re,Me=this.h[0],Ne=this.h[1],Ie=this.h[2],ce=this.h[3],fe=this.h[4],ye=this.h[5],he=this.h[6],de=this.h[7],ve=this.h[8],Ve=this.h[9],gt=this.r[0],wt=this.r[1],yt=this.r[2],j=this.r[3],Et=this.r[4],Ot=this.r[5],Mt=this.r[6],_t=this.r[7],Ct=this.r[8],Lt=this.r[9];M>=16;)U=S[L+0]&255|(S[L+1]&255)<<8,Me+=U&8191,J=S[L+2]&255|(S[L+3]&255)<<8,Ne+=(U>>>13|J<<3)&8191,Y=S[L+4]&255|(S[L+5]&255)<<8,Ie+=(J>>>10|Y<<6)&8191,ue=S[L+6]&255|(S[L+7]&255)<<8,ce+=(Y>>>7|ue<<9)&8191,_e=S[L+8]&255|(S[L+9]&255)<<8,fe+=(ue>>>4|_e<<12)&8191,ye+=_e>>>1&8191,Ae=S[L+10]&255|(S[L+11]&255)<<8,he+=(_e>>>14|Ae<<2)&8191,Ee=S[L+12]&255|(S[L+13]&255)<<8,de+=(Ae>>>11|Ee<<5)&8191,Bt=S[L+14]&255|(S[L+15]&255)<<8,ve+=(Ee>>>8|Bt<<8)&8191,Ve+=Bt>>>5|p,Le=0,Ke=Le,Ke+=Me*gt,Ke+=Ne*(5*Lt),Ke+=Ie*(5*Ct),Ke+=ce*(5*_t),Ke+=fe*(5*Mt),Le=Ke>>>13,Ke&=8191,Ke+=ye*(5*Ot),Ke+=he*(5*Et),Ke+=de*(5*j),Ke+=ve*(5*yt),Ke+=Ve*(5*wt),Le+=Ke>>>13,Ke&=8191,Ye=Le,Ye+=Me*wt,Ye+=Ne*gt,Ye+=Ie*(5*Lt),Ye+=ce*(5*Ct),Ye+=fe*(5*_t),Le=Ye>>>13,Ye&=8191,Ye+=ye*(5*Mt),Ye+=he*(5*Ot),Ye+=de*(5*Et),Ye+=ve*(5*j),Ye+=Ve*(5*yt),Le+=Ye>>>13,Ye&=8191,lt=Le,lt+=Me*yt,lt+=Ne*wt,lt+=Ie*gt,lt+=ce*(5*Lt),lt+=fe*(5*Ct),Le=lt>>>13,lt&=8191,lt+=ye*(5*_t),lt+=he*(5*Mt),lt+=de*(5*Ot),lt+=ve*(5*Et),lt+=Ve*(5*j),Le+=lt>>>13,lt&=8191,ct=Le,ct+=Me*j,ct+=Ne*yt,ct+=Ie*wt,ct+=ce*gt,ct+=fe*(5*Lt),Le=ct>>>13,ct&=8191,ct+=ye*(5*Ct),ct+=he*(5*_t),ct+=de*(5*Mt),ct+=ve*(5*Ot),ct+=Ve*(5*Et),Le+=ct>>>13,ct&=8191,Xe=Le,Xe+=Me*Et,Xe+=Ne*j,Xe+=Ie*yt,Xe+=ce*wt,Xe+=fe*gt,Le=Xe>>>13,Xe&=8191,Xe+=ye*(5*Lt),Xe+=he*(5*Ct),Xe+=de*(5*_t),Xe+=ve*(5*Mt),Xe+=Ve*(5*Ot),Le+=Xe>>>13,Xe&=8191,rt=Le,rt+=Me*Ot,rt+=Ne*Et,rt+=Ie*j,rt+=ce*yt,rt+=fe*wt,Le=rt>>>13,rt&=8191,rt+=ye*gt,rt+=he*(5*Lt),rt+=de*(5*Ct),rt+=ve*(5*_t),rt+=Ve*(5*Mt),Le+=rt>>>13,rt&=8191,Je=Le,Je+=Me*Mt,Je+=Ne*Ot,Je+=Ie*Et,Je+=ce*j,Je+=fe*yt,Le=Je>>>13,Je&=8191,Je+=ye*wt,Je+=he*gt,Je+=de*(5*Lt),Je+=ve*(5*Ct),Je+=Ve*(5*_t),Le+=Je>>>13,Je&=8191,$e=Le,$e+=Me*_t,$e+=Ne*Mt,$e+=Ie*Ot,$e+=ce*Et,$e+=fe*j,Le=$e>>>13,$e&=8191,$e+=ye*yt,$e+=he*wt,$e+=de*gt,$e+=ve*(5*Lt),$e+=Ve*(5*Ct),Le+=$e>>>13,$e&=8191,De=Le,De+=Me*Ct,De+=Ne*_t,De+=Ie*Mt,De+=ce*Ot,De+=fe*Et,Le=De>>>13,De&=8191,De+=ye*j,De+=he*yt,De+=de*wt,De+=ve*gt,De+=Ve*(5*Lt),Le+=De>>>13,De&=8191,Re=Le,Re+=Me*Lt,Re+=Ne*Ct,Re+=Ie*_t,Re+=ce*Mt,Re+=fe*Ot,Le=Re>>>13,Re&=8191,Re+=ye*Et,Re+=he*j,Re+=de*yt,Re+=ve*wt,Re+=Ve*gt,Le+=Re>>>13,Re&=8191,Le=(Le<<2)+Le|0,Le=Le+Ke|0,Ke=Le&8191,Le=Le>>>13,Ye+=Le,Me=Ke,Ne=Ye,Ie=lt,ce=ct,fe=Xe,ye=rt,he=Je,de=$e,ve=De,Ve=Re,L+=16,M-=16;this.h[0]=Me,this.h[1]=Ne,this.h[2]=Ie,this.h[3]=ce,this.h[4]=fe,this.h[5]=ye,this.h[6]=he,this.h[7]=de,this.h[8]=ve,this.h[9]=Ve},Q.prototype.finish=function(S,L){var M=new Uint16Array(10),p,U,J,Y;if(this.leftover){for(Y=this.leftover,this.buffer[Y++]=1;Y<16;Y++)this.buffer[Y]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(p=this.h[1]>>>13,this.h[1]&=8191,Y=2;Y<10;Y++)this.h[Y]+=p,p=this.h[Y]>>>13,this.h[Y]&=8191;for(this.h[0]+=p*5,p=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=p,p=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=p,M[0]=this.h[0]+5,p=M[0]>>>13,M[0]&=8191,Y=1;Y<10;Y++)M[Y]=this.h[Y]+p,p=M[Y]>>>13,M[Y]&=8191;for(M[9]-=8192,U=(p^1)-1,Y=0;Y<10;Y++)M[Y]&=U;for(U=~U,Y=0;Y<10;Y++)this.h[Y]=this.h[Y]&U|M[Y];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,J=this.h[0]+this.pad[0],this.h[0]=J&65535,Y=1;Y<8;Y++)J=(this.h[Y]+this.pad[Y]|0)+(J>>>16)|0,this.h[Y]=J&65535;S[L+0]=this.h[0]>>>0&255,S[L+1]=this.h[0]>>>8&255,S[L+2]=this.h[1]>>>0&255,S[L+3]=this.h[1]>>>8&255,S[L+4]=this.h[2]>>>0&255,S[L+5]=this.h[2]>>>8&255,S[L+6]=this.h[3]>>>0&255,S[L+7]=this.h[3]>>>8&255,S[L+8]=this.h[4]>>>0&255,S[L+9]=this.h[4]>>>8&255,S[L+10]=this.h[5]>>>0&255,S[L+11]=this.h[5]>>>8&255,S[L+12]=this.h[6]>>>0&255,S[L+13]=this.h[6]>>>8&255,S[L+14]=this.h[7]>>>0&255,S[L+15]=this.h[7]>>>8&255},Q.prototype.update=function(S,L,M){var p,U;if(this.leftover){for(U=16-this.leftover,U>M&&(U=M),p=0;p=16&&(U=M-M%16,this.blocks(S,L,U),L+=U,M-=U),M){for(p=0;p>16&1),J[M-1]&=65535;J[15]=Y[15]-32767-(J[14]>>16&1),U=J[15]>>16&1,J[14]&=65535,E(Y,J,1-U)}for(M=0;M<16;M++)S[2*M]=Y[M]&255,S[2*M+1]=Y[M]>>8}function T(S,L){var M=new Uint8Array(32),p=new Uint8Array(32);return x(M,S),x(p,L),H(M,0,p,0)}function B(S){var L=new Uint8Array(32);return x(L,S),L[0]&1}function d(S,L){var M;for(M=0;M<16;M++)S[M]=L[2*M]+(L[2*M+1]<<8);S[15]&=32767}function k(S,L,M){for(var p=0;p<16;p++)S[p]=L[p]+M[p]}function W(S,L,M){for(var p=0;p<16;p++)S[p]=L[p]-M[p]}function K(S,L,M){var p,U,J=0,Y=0,ue=0,_e=0,Ae=0,Ee=0,Bt=0,Le=0,Ke=0,Ye=0,lt=0,ct=0,Xe=0,rt=0,Je=0,$e=0,De=0,Re=0,Me=0,Ne=0,Ie=0,ce=0,fe=0,ye=0,he=0,de=0,ve=0,Ve=0,gt=0,wt=0,yt=0,j=M[0],Et=M[1],Ot=M[2],Mt=M[3],_t=M[4],Ct=M[5],Lt=M[6],Tr=M[7],Kt=M[8],Er=M[9],xr=M[10],Sr=M[11],Ur=M[12],cn=M[13],fn=M[14],un=M[15];p=L[0],J+=p*j,Y+=p*Et,ue+=p*Ot,_e+=p*Mt,Ae+=p*_t,Ee+=p*Ct,Bt+=p*Lt,Le+=p*Tr,Ke+=p*Kt,Ye+=p*Er,lt+=p*xr,ct+=p*Sr,Xe+=p*Ur,rt+=p*cn,Je+=p*fn,$e+=p*un,p=L[1],Y+=p*j,ue+=p*Et,_e+=p*Ot,Ae+=p*Mt,Ee+=p*_t,Bt+=p*Ct,Le+=p*Lt,Ke+=p*Tr,Ye+=p*Kt,lt+=p*Er,ct+=p*xr,Xe+=p*Sr,rt+=p*Ur,Je+=p*cn,$e+=p*fn,De+=p*un,p=L[2],ue+=p*j,_e+=p*Et,Ae+=p*Ot,Ee+=p*Mt,Bt+=p*_t,Le+=p*Ct,Ke+=p*Lt,Ye+=p*Tr,lt+=p*Kt,ct+=p*Er,Xe+=p*xr,rt+=p*Sr,Je+=p*Ur,$e+=p*cn,De+=p*fn,Re+=p*un,p=L[3],_e+=p*j,Ae+=p*Et,Ee+=p*Ot,Bt+=p*Mt,Le+=p*_t,Ke+=p*Ct,Ye+=p*Lt,lt+=p*Tr,ct+=p*Kt,Xe+=p*Er,rt+=p*xr,Je+=p*Sr,$e+=p*Ur,De+=p*cn,Re+=p*fn,Me+=p*un,p=L[4],Ae+=p*j,Ee+=p*Et,Bt+=p*Ot,Le+=p*Mt,Ke+=p*_t,Ye+=p*Ct,lt+=p*Lt,ct+=p*Tr,Xe+=p*Kt,rt+=p*Er,Je+=p*xr,$e+=p*Sr,De+=p*Ur,Re+=p*cn,Me+=p*fn,Ne+=p*un,p=L[5],Ee+=p*j,Bt+=p*Et,Le+=p*Ot,Ke+=p*Mt,Ye+=p*_t,lt+=p*Ct,ct+=p*Lt,Xe+=p*Tr,rt+=p*Kt,Je+=p*Er,$e+=p*xr,De+=p*Sr,Re+=p*Ur,Me+=p*cn,Ne+=p*fn,Ie+=p*un,p=L[6],Bt+=p*j,Le+=p*Et,Ke+=p*Ot,Ye+=p*Mt,lt+=p*_t,ct+=p*Ct,Xe+=p*Lt,rt+=p*Tr,Je+=p*Kt,$e+=p*Er,De+=p*xr,Re+=p*Sr,Me+=p*Ur,Ne+=p*cn,Ie+=p*fn,ce+=p*un,p=L[7],Le+=p*j,Ke+=p*Et,Ye+=p*Ot,lt+=p*Mt,ct+=p*_t,Xe+=p*Ct,rt+=p*Lt,Je+=p*Tr,$e+=p*Kt,De+=p*Er,Re+=p*xr,Me+=p*Sr,Ne+=p*Ur,Ie+=p*cn,ce+=p*fn,fe+=p*un,p=L[8],Ke+=p*j,Ye+=p*Et,lt+=p*Ot,ct+=p*Mt,Xe+=p*_t,rt+=p*Ct,Je+=p*Lt,$e+=p*Tr,De+=p*Kt,Re+=p*Er,Me+=p*xr,Ne+=p*Sr,Ie+=p*Ur,ce+=p*cn,fe+=p*fn,ye+=p*un,p=L[9],Ye+=p*j,lt+=p*Et,ct+=p*Ot,Xe+=p*Mt,rt+=p*_t,Je+=p*Ct,$e+=p*Lt,De+=p*Tr,Re+=p*Kt,Me+=p*Er,Ne+=p*xr,Ie+=p*Sr,ce+=p*Ur,fe+=p*cn,ye+=p*fn,he+=p*un,p=L[10],lt+=p*j,ct+=p*Et,Xe+=p*Ot,rt+=p*Mt,Je+=p*_t,$e+=p*Ct,De+=p*Lt,Re+=p*Tr,Me+=p*Kt,Ne+=p*Er,Ie+=p*xr,ce+=p*Sr,fe+=p*Ur,ye+=p*cn,he+=p*fn,de+=p*un,p=L[11],ct+=p*j,Xe+=p*Et,rt+=p*Ot,Je+=p*Mt,$e+=p*_t,De+=p*Ct,Re+=p*Lt,Me+=p*Tr,Ne+=p*Kt,Ie+=p*Er,ce+=p*xr,fe+=p*Sr,ye+=p*Ur,he+=p*cn,de+=p*fn,ve+=p*un,p=L[12],Xe+=p*j,rt+=p*Et,Je+=p*Ot,$e+=p*Mt,De+=p*_t,Re+=p*Ct,Me+=p*Lt,Ne+=p*Tr,Ie+=p*Kt,ce+=p*Er,fe+=p*xr,ye+=p*Sr,he+=p*Ur,de+=p*cn,ve+=p*fn,Ve+=p*un,p=L[13],rt+=p*j,Je+=p*Et,$e+=p*Ot,De+=p*Mt,Re+=p*_t,Me+=p*Ct,Ne+=p*Lt,Ie+=p*Tr,ce+=p*Kt,fe+=p*Er,ye+=p*xr,he+=p*Sr,de+=p*Ur,ve+=p*cn,Ve+=p*fn,gt+=p*un,p=L[14],Je+=p*j,$e+=p*Et,De+=p*Ot,Re+=p*Mt,Me+=p*_t,Ne+=p*Ct,Ie+=p*Lt,ce+=p*Tr,fe+=p*Kt,ye+=p*Er,he+=p*xr,de+=p*Sr,ve+=p*Ur,Ve+=p*cn,gt+=p*fn,wt+=p*un,p=L[15],$e+=p*j,De+=p*Et,Re+=p*Ot,Me+=p*Mt,Ne+=p*_t,Ie+=p*Ct,ce+=p*Lt,fe+=p*Tr,ye+=p*Kt,he+=p*Er,de+=p*xr,ve+=p*Sr,Ve+=p*Ur,gt+=p*cn,wt+=p*fn,yt+=p*un,J+=38*De,Y+=38*Re,ue+=38*Me,_e+=38*Ne,Ae+=38*Ie,Ee+=38*ce,Bt+=38*fe,Le+=38*ye,Ke+=38*he,Ye+=38*de,lt+=38*ve,ct+=38*Ve,Xe+=38*gt,rt+=38*wt,Je+=38*yt,U=1,p=J+U+65535,U=Math.floor(p/65536),J=p-U*65536,p=Y+U+65535,U=Math.floor(p/65536),Y=p-U*65536,p=ue+U+65535,U=Math.floor(p/65536),ue=p-U*65536,p=_e+U+65535,U=Math.floor(p/65536),_e=p-U*65536,p=Ae+U+65535,U=Math.floor(p/65536),Ae=p-U*65536,p=Ee+U+65535,U=Math.floor(p/65536),Ee=p-U*65536,p=Bt+U+65535,U=Math.floor(p/65536),Bt=p-U*65536,p=Le+U+65535,U=Math.floor(p/65536),Le=p-U*65536,p=Ke+U+65535,U=Math.floor(p/65536),Ke=p-U*65536,p=Ye+U+65535,U=Math.floor(p/65536),Ye=p-U*65536,p=lt+U+65535,U=Math.floor(p/65536),lt=p-U*65536,p=ct+U+65535,U=Math.floor(p/65536),ct=p-U*65536,p=Xe+U+65535,U=Math.floor(p/65536),Xe=p-U*65536,p=rt+U+65535,U=Math.floor(p/65536),rt=p-U*65536,p=Je+U+65535,U=Math.floor(p/65536),Je=p-U*65536,p=$e+U+65535,U=Math.floor(p/65536),$e=p-U*65536,J+=U-1+37*(U-1),U=1,p=J+U+65535,U=Math.floor(p/65536),J=p-U*65536,p=Y+U+65535,U=Math.floor(p/65536),Y=p-U*65536,p=ue+U+65535,U=Math.floor(p/65536),ue=p-U*65536,p=_e+U+65535,U=Math.floor(p/65536),_e=p-U*65536,p=Ae+U+65535,U=Math.floor(p/65536),Ae=p-U*65536,p=Ee+U+65535,U=Math.floor(p/65536),Ee=p-U*65536,p=Bt+U+65535,U=Math.floor(p/65536),Bt=p-U*65536,p=Le+U+65535,U=Math.floor(p/65536),Le=p-U*65536,p=Ke+U+65535,U=Math.floor(p/65536),Ke=p-U*65536,p=Ye+U+65535,U=Math.floor(p/65536),Ye=p-U*65536,p=lt+U+65535,U=Math.floor(p/65536),lt=p-U*65536,p=ct+U+65535,U=Math.floor(p/65536),ct=p-U*65536,p=Xe+U+65535,U=Math.floor(p/65536),Xe=p-U*65536,p=rt+U+65535,U=Math.floor(p/65536),rt=p-U*65536,p=Je+U+65535,U=Math.floor(p/65536),Je=p-U*65536,p=$e+U+65535,U=Math.floor(p/65536),$e=p-U*65536,J+=U-1+37*(U-1),S[0]=J,S[1]=Y,S[2]=ue,S[3]=_e,S[4]=Ae,S[5]=Ee,S[6]=Bt,S[7]=Le,S[8]=Ke,S[9]=Ye,S[10]=lt,S[11]=ct,S[12]=Xe,S[13]=rt,S[14]=Je,S[15]=$e}function re(S,L){K(S,L,L)}function xe(S,L){var M=r(),p;for(p=0;p<16;p++)M[p]=L[p];for(p=253;p>=0;p--)re(M,M),p!==2&&p!==4&&K(M,M,L);for(p=0;p<16;p++)S[p]=M[p]}function be(S,L){var M=r(),p;for(p=0;p<16;p++)M[p]=L[p];for(p=250;p>=0;p--)re(M,M),p!==1&&K(M,M,L);for(p=0;p<16;p++)S[p]=M[p]}function ge(S,L,M){var p=new Uint8Array(32),U=new Float64Array(80),J,Y,ue=r(),_e=r(),Ae=r(),Ee=r(),Bt=r(),Le=r();for(Y=0;Y<31;Y++)p[Y]=L[Y];for(p[31]=L[31]&127|64,p[0]&=248,d(U,M),Y=0;Y<16;Y++)_e[Y]=U[Y],Ee[Y]=ue[Y]=Ae[Y]=0;for(ue[0]=Ee[0]=1,Y=254;Y>=0;--Y)J=p[Y>>>3]>>>(Y&7)&1,E(ue,_e,J),E(Ae,Ee,J),k(Bt,ue,Ae),W(ue,ue,Ae),k(Ae,_e,Ee),W(_e,_e,Ee),re(Ee,Bt),re(Le,ue),K(ue,Ae,ue),K(Ae,_e,Bt),k(Bt,ue,Ae),W(ue,ue,Ae),re(_e,ue),W(Ae,Ee,Le),K(ue,Ae,c),k(ue,ue,Ee),K(Ae,Ae,ue),K(ue,Ee,Le),K(Ee,_e,U),re(_e,Bt),E(ue,_e,J),E(Ae,Ee,J);for(Y=0;Y<16;Y++)U[Y+16]=ue[Y],U[Y+32]=Ae[Y],U[Y+48]=_e[Y],U[Y+64]=Ee[Y];var Ke=U.subarray(32),Ye=U.subarray(16);return xe(Ke,Ke),K(Ye,Ye,Ke),x(S,Ye),0}function tt(S,L){return ge(S,L,s)}function Ue(S,L){return n(L,32),tt(S,L)}function Pe(S,L,M){var p=new Uint8Array(32);return ge(p,M,L),q(S,i,p,G)}var pe=f,we=h;function ke(S,L,M,p,U,J){var Y=new Uint8Array(32);return Pe(Y,U,J),pe(S,L,M,p,Y)}function vt(S,L,M,p,U,J){var Y=new Uint8Array(32);return Pe(Y,U,J),we(S,L,M,p,Y)}var He=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function it(S,L,M,p){for(var U=new Int32Array(16),J=new Int32Array(16),Y,ue,_e,Ae,Ee,Bt,Le,Ke,Ye,lt,ct,Xe,rt,Je,$e,De,Re,Me,Ne,Ie,ce,fe,ye,he,de,ve,Ve=S[0],gt=S[1],wt=S[2],yt=S[3],j=S[4],Et=S[5],Ot=S[6],Mt=S[7],_t=L[0],Ct=L[1],Lt=L[2],Tr=L[3],Kt=L[4],Er=L[5],xr=L[6],Sr=L[7],Ur=0;p>=128;){for(Ne=0;Ne<16;Ne++)Ie=8*Ne+Ur,U[Ne]=M[Ie+0]<<24|M[Ie+1]<<16|M[Ie+2]<<8|M[Ie+3],J[Ne]=M[Ie+4]<<24|M[Ie+5]<<16|M[Ie+6]<<8|M[Ie+7];for(Ne=0;Ne<80;Ne++)if(Y=Ve,ue=gt,_e=wt,Ae=yt,Ee=j,Bt=Et,Le=Ot,Ke=Mt,Ye=_t,lt=Ct,ct=Lt,Xe=Tr,rt=Kt,Je=Er,$e=xr,De=Sr,ce=Mt,fe=Sr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=(j>>>14|Kt<<32-14)^(j>>>18|Kt<<32-18)^(Kt>>>41-32|j<<32-(41-32)),fe=(Kt>>>14|j<<32-14)^(Kt>>>18|j<<32-18)^(j>>>41-32|Kt<<32-(41-32)),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=j&Et^~j&Ot,fe=Kt&Er^~Kt&xr,ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=He[Ne*2],fe=He[Ne*2+1],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=U[Ne%16],fe=J[Ne%16],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,Re=de&65535|ve<<16,Me=ye&65535|he<<16,ce=Re,fe=Me,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=(Ve>>>28|_t<<32-28)^(_t>>>34-32|Ve<<32-(34-32))^(_t>>>39-32|Ve<<32-(39-32)),fe=(_t>>>28|Ve<<32-28)^(Ve>>>34-32|_t<<32-(34-32))^(Ve>>>39-32|_t<<32-(39-32)),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=Ve>^Ve&wt^gt&wt,fe=_t&Ct^_t&Lt^Ct&Lt,ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,Ke=de&65535|ve<<16,De=ye&65535|he<<16,ce=Ae,fe=Xe,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=Re,fe=Me,ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,Ae=de&65535|ve<<16,Xe=ye&65535|he<<16,gt=Y,wt=ue,yt=_e,j=Ae,Et=Ee,Ot=Bt,Mt=Le,Ve=Ke,Ct=Ye,Lt=lt,Tr=ct,Kt=Xe,Er=rt,xr=Je,Sr=$e,_t=De,Ne%16===15)for(Ie=0;Ie<16;Ie++)ce=U[Ie],fe=J[Ie],ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=U[(Ie+9)%16],fe=J[(Ie+9)%16],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,Re=U[(Ie+1)%16],Me=J[(Ie+1)%16],ce=(Re>>>1|Me<<32-1)^(Re>>>8|Me<<32-8)^Re>>>7,fe=(Me>>>1|Re<<32-1)^(Me>>>8|Re<<32-8)^(Me>>>7|Re<<32-7),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,Re=U[(Ie+14)%16],Me=J[(Ie+14)%16],ce=(Re>>>19|Me<<32-19)^(Me>>>61-32|Re<<32-(61-32))^Re>>>6,fe=(Me>>>19|Re<<32-19)^(Re>>>61-32|Me<<32-(61-32))^(Me>>>6|Re<<32-6),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,U[Ie]=de&65535|ve<<16,J[Ie]=ye&65535|he<<16;ce=Ve,fe=_t,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[0],fe=L[0],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[0]=Ve=de&65535|ve<<16,L[0]=_t=ye&65535|he<<16,ce=gt,fe=Ct,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[1],fe=L[1],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[1]=gt=de&65535|ve<<16,L[1]=Ct=ye&65535|he<<16,ce=wt,fe=Lt,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[2],fe=L[2],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[2]=wt=de&65535|ve<<16,L[2]=Lt=ye&65535|he<<16,ce=yt,fe=Tr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[3],fe=L[3],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[3]=yt=de&65535|ve<<16,L[3]=Tr=ye&65535|he<<16,ce=j,fe=Kt,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[4],fe=L[4],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[4]=j=de&65535|ve<<16,L[4]=Kt=ye&65535|he<<16,ce=Et,fe=Er,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[5],fe=L[5],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[5]=Et=de&65535|ve<<16,L[5]=Er=ye&65535|he<<16,ce=Ot,fe=xr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[6],fe=L[6],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[6]=Ot=de&65535|ve<<16,L[6]=xr=ye&65535|he<<16,ce=Mt,fe=Sr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[7],fe=L[7],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[7]=Mt=de&65535|ve<<16,L[7]=Sr=ye&65535|he<<16,Ur+=128,p-=128}return p}function Ht(S,L,M){var p=new Int32Array(8),U=new Int32Array(8),J=new Uint8Array(256),Y,ue=M;for(p[0]=1779033703,p[1]=3144134277,p[2]=1013904242,p[3]=2773480762,p[4]=1359893119,p[5]=2600822924,p[6]=528734635,p[7]=1541459225,U[0]=4089235720,U[1]=2227873595,U[2]=4271175723,U[3]=1595750129,U[4]=2917565137,U[5]=725511199,U[6]=4215389547,U[7]=327033209,it(p,U,L,M),M%=128,Y=0;Y=0;--U)p=M[U/8|0]>>(U&7)&1,pt(S,L,p),ut(L,S),ut(S,S),pt(S,L,p)}function At(S,L){var M=[r(),r(),r(),r()];m(M[0],y),m(M[1],A),m(M[2],a),K(M[3],y,A),xt(S,M,L)}function Xt(S,L,M){var p=new Uint8Array(64),U=[r(),r(),r(),r()],J;for(M||n(L,32),Ht(p,L,32),p[0]&=248,p[31]&=127,p[31]|=64,At(U,p),Wt(S,U),J=0;J<32;J++)L[J+32]=S[J];return 0}var Tt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function C(S,L){var M,p,U,J;for(p=63;p>=32;--p){for(M=0,U=p-32,J=p-12;U>4)*Tt[U],M=L[U]>>8,L[U]&=255;for(U=0;U<32;U++)L[U]-=M*Tt[U];for(p=0;p<32;p++)L[p+1]+=L[p]>>8,S[p]=L[p]&255}function w(S){var L=new Float64Array(64),M;for(M=0;M<64;M++)L[M]=S[M];for(M=0;M<64;M++)S[M]=0;C(S,L)}function b(S,L,M,p){var U=new Uint8Array(64),J=new Uint8Array(64),Y=new Uint8Array(64),ue,_e,Ae=new Float64Array(64),Ee=[r(),r(),r(),r()];Ht(U,p,32),U[0]&=248,U[31]&=127,U[31]|=64;var Bt=M+64;for(ue=0;ue>7&&W(S[0],o,S[0]),K(S[3],S[0],S[1]),0)}function V(S,L,M,p){var U,J=new Uint8Array(32),Y=new Uint8Array(64),ue=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(M<64||D(_e,p))return-1;for(U=0;U=0},t.sign.keyPair=function(){var S=new Uint8Array(Yt),L=new Uint8Array(es);return Xt(S,L),{publicKey:S,secretKey:L}},t.sign.keyPair.fromSecretKey=function(S){if(kt(S),S.length!==es)throw new Error("bad secret key size");for(var L=new Uint8Array(Yt),M=0;M0&&(c=n-a-i),s.padding="0".repeat(c);const u=JSON.stringify(s);return fE({publicKey:e,data:u,version:r})}ti.encryptSafely=RM;function uE({encryptedData:e,privateKey:t}){if((0,ki.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,ki.isNullish)(t))throw new Error("Missing privateKey parameter");switch(e.version){case"x25519-xsalsa20-poly1305":{const r=ie.Buffer.from(t,"hex"),n=So.box.keyPair.fromSecretKey(r).secretKey,i=Ti.base64.decode(e.nonce),s=Ti.base64.decode(e.ciphertext),o=Ti.base64.decode(e.ephemPublicKey),a=So.box.open(s,i,o,n);try{if(!a)throw new Error;const c=Ti.utf8.encode(a);if(!c)throw new Error;return c}catch(c){throw c&&typeof c.message=="string"&&c.message.length?new Error(`Decryption failed: ${c.message}`):new Error("Decryption failed.")}}default:throw new Error("Encryption type/version not supported.")}}ti.decrypt=uE;function TM({encryptedData:e,privateKey:t}){if((0,ki.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,ki.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(uE({encryptedData:e,privateKey:t})).data}ti.decryptSafely=TM;function kM(e){const t=ie.Buffer.from(e,"hex"),r=So.box.keyPair.fromSecretKey(t).publicKey;return Ti.base64.encode(r)}ti.getEncryptionPublicKey=kM,function(e){var t=ft&&ft.__createBinding||(Object.create?function(i,s,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(s,o);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,a,c)}:function(i,s,o,a){a===void 0&&(a=o),i[a]=s[o]}),r=ft&&ft.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(ls,e),r(L2,e),r(ti,e);var n=Qr;Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(Go);class lE extends Error{constructor(t,r){super(),this.code=t,this.message=r}toString(){return`${this.message} (${this.code})`}}var CM=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},LM=(e,t,r)=>(CM(e,t,"read from private field"),r?r.call(e):t.get(e)),$M=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Op;const ka=class{constructor(e){$M(this,Op,["eth_newFilter","eth_newBlockFilter","eth_newPendingTransactionFilter","eth_uninstallFilter","eth_subscribe"]),this.provider=e}static isUTF8(e){try{return new TextDecoder("utf8",{fatal:!0}).decode(e),!0}catch{return!1}}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}static messageToBuffer(e){let t=ie.Buffer.from([]);try{typeof e=="string"?t=ie.Buffer.from(e.replace("0x",""),"hex"):t=ie.Buffer.from(e)}catch(r){console.log(`messageToBuffer error: ${r}`)}return t}async request(e){if(LM(this,Op).includes(e.method))return Promise.reject(new lE(4200,`EthereumProvider does not support calling ${e.method}`));switch(e.method){case"wallet_requestPermissions":return this.provider.internalRequest({method:"wallet_requestPermissions",params:e.params});case"eth_requestAccounts":return this.provider.internalRequest({method:"requestAccounts",params:{}});case"eth_sign":return this.ethSign(e.params);case"personal_sign":return this.personalSign(e.params);case"personal_ecRecover":return this.personalECRecover(e.params);case"eth_signTypedData_v3":return this.ethSignTypedData(e.params,Go.SignTypedDataVersion.V3);case"eth_signTypedData_v4":return this.ethSignTypedData(e.params,Go.SignTypedDataVersion.V4);case"eth_signTypedData":return this.ethSignTypedData(e.params,Go.SignTypedDataVersion.V1);case"eth_sendTransaction":return this.provider.internalRequest({method:"signTransaction",params:e.params[0]});case"wallet_watchAsset":{const{options:t,type:r}=e.params,{address:n,symbol:i,decimals:s}=t;return this.provider.internalRequest({method:"watchAsset",params:{type:r,contract:n,symbol:i,decimals:s||0}})}case"wallet_addEthereumChain":return this.provider.internalRequest({method:"addEthereumChain",params:e.params[0]});case"wallet_switchEthereumChain":return this.provider.internalRequest({method:"switchEthereumChain",params:e.params[0]});default:return(await this.provider.getRPC().call({method:e.method,jsonrpc:"2.0",params:e.params})).result}}personalECRecover(e){return this.provider.internalRequest({method:"ecRecover",params:{signature:e[1],message:e[0]}})}async personalSign(e){const[t]=await this.provider.request({method:"eth_accounts"});if(!t)throw new Error("Unable to execute personal_sign");let[r,n]=e;typeof r=="string"&&t.toLowerCase()===r.toLowerCase()&&(r=e[1],n=e[0]);const i=ka.messageToBuffer(r);return this.provider.internalRequest({method:"signPersonalMessage",params:{data:i.length===0?ka.bufferToHex(r):r,address:n}})}ethSign(e){if(!e)throw new Error("Missing params");const[t,r]=e,n=ka.messageToBuffer(r),i=ka.bufferToHex(n);return this.provider.internalRequest({method:ka.isUTF8(n)?"signPersonalMessage":"signMessage",params:{data:i,address:t}})}async ethSignTypedData(e,t){const[r]=await this.provider.request({method:"eth_accounts"});if(!r)throw new Error("Unable to execute ethSignTypedData, address is not present");let[n,i]=e;typeof n=="string"&&r.toLowerCase()===n.toLowerCase()&&(n=e[1],i=e[0]);const s=typeof n=="string"?JSON.parse(n):n,{chainId:o}=s.domain||{};if(typeof o<"u"&&Number(o)!==Number(this.provider.getChainId()))throw new Error("Provided chainId does not match the currently active chain");const a=t!==Go.SignTypedDataVersion.V1?Go.TypedDataUtils.eip712Hash(s,t):"";return this.provider.internalRequest({method:"signTypedMessage",params:{data:"0x"+a.toString("hex"),raw:typeof n=="string"?n:JSON.stringify(n),address:i,version:t}})}};let OM=ka;Op=new WeakMap;var MM=Object.defineProperty,hE=Object.getOwnPropertySymbols,NM=Object.prototype.hasOwnProperty,PM=Object.prototype.propertyIsEnumerable,dE=(e,t,r)=>t in e?MM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,UM=(e,t)=>{for(var r in t||(t={}))NM.call(t,r)&&dE(e,r,t[r]);if(hE)for(var r of hE(t))PM.call(t,r)&&dE(e,r,t[r]);return e},pE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},FM=(e,t,r)=>(pE(e,t,"read from private field"),r?r.call(e):t.get(e)),DM=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},HM=(e,t,r,n)=>(pE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Sl;class gE{constructor(t){DM(this,Sl,void 0),HM(this,Sl,t)}async getBlockNumber(){return(await this.call({jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).result}async getBlockByNumber(t){return(await this.call({jsonrpc:"2.0",method:"eth_getBlockByNumber",params:[t,!1]})).result}getFilterLogs(t){return this.call({jsonrpc:"2.0",method:"eth_getLogs",params:[t]})}async call(t){const r=await(await fetch(FM(this,Sl),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(UM({id:new Date().getTime()+Math.floor(Math.random()*1e3)},t))})).json();if(!r.result&&r.error)throw new Error(r.error.message||"rpc error");return r}}Sl=new WeakMap;var yE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nn=(e,t,r)=>(yE(e,t,"read from private field"),r?r.call(e):t.get(e)),Ca=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Pn=(e,t,r,n)=>(yE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Qi,La,Al,Xc,Ds,$a;const wE=class extends Cl{constructor(e){super(),Ca(this,Qi,void 0),Ca(this,La,void 0),Ca(this,Al,!1),Ca(this,Xc,!1),Ca(this,Ds,void 0),Ca(this,$a,void 0),this.isTrust=!0,this.isTrustWallet=!0,this.request=this.request.bind(this),e&&(e.chainId&&Pn(this,Qi,e.chainId),(e.rpc||e.rpcUrl)&&Pn(this,La,e.rpc||e.rpcUrl),typeof e.overwriteMetamask<"u"&&Pn(this,Xc,e.overwriteMetamask),typeof e.disableMobileAdapter<"u"&&Pn(this,Al,e.disableMobileAdapter),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust),Pn(this,$a,new gE(Nn(this,La)))),Nn(this,Al)||(this.mobileAdapter=new OM(this)),super.on("onResponseReady",this.onResponseReady.bind(this)),this.connect()}connect(){this.emit("connect",{chainId:Nn(this,Qi)})}enable(){return this.request({method:"eth_requestAccounts"})}sendAsync(e,t){Array.isArray(e)?Promise.all(e.map(r=>this.request(r))).then(r=>t(null,r)).catch(r=>t(r,null)):this.request(e).then(r=>t(null,r)).catch(r=>t(r,null))}_send(e){const t={jsonrpc:"2.0",result:null};switch(e.method){case"eth_accounts":case"eth_coinbase":case"net_version":case"eth_chainId":t.result=this.handleStaticRequests({method:"eth_accounts"});break;default:throw new lE(4200,`Trust does not support calling ${e.method} synchronously without a callback. Please provide a callback parameter to call ${e.method} asynchronously.`)}return t}send(e,t){if(typeof e=="string"&&(!t||Array.isArray(t))){const r=this;return new Promise((n,i)=>{try{const s=r.request({method:e,params:t});s instanceof Promise?s.then(n).catch(i):n(s)}catch(s){i(s)}})}else if(e&&typeof e=="object"&&typeof t=="function")return this.request(e).then(t);return this._send(e)}internalRequest(e){return super.request(e)}request(e){const t=()=>this.internalRequest(e);if(this.mobileAdapter){const r=this.handleStaticRequests(e,()=>this.mobileAdapter.request(e));return r instanceof Promise?r:Promise.resolve(r)}return this.handleStaticRequests(e,t)}handleStaticRequests(e,t){switch(e.method){case"net_version":return Nn(this,Qi)?parseInt(Nn(this,Qi)):void 0;case"eth_chainId":return Nn(this,Qi);case"eth_accounts":case"eth_coinbase":return Nn(this,Ds)?[Nn(this,Ds)]:[]}if(t)return t()}onResponseReady(e,t){var r,n,i,s;if(t)switch(e.method){case"eth_requestAccounts":case"requestAccounts":Pn(this,Ds,t[0]);break;case"wallet_requestPermissions":Pn(this,Ds,(s=(i=(n=(r=t[0])==null?void 0:r.caveats)==null?void 0:n[0])==null?void 0:i.value)==null?void 0:s[0]);break}}getNetwork(){return wE.NETWORK}get connected(){return!0}get isMetaMask(){return Nn(this,Xc)}getChainId(){return Nn(this,Qi)}getNetworkVersion(){return this.handleStaticRequests({method:"net_version "})}setChainId(e){Pn(this,Qi,e)}setRPCUrl(e){Pn(this,La,e),Pn(this,$a,new gE(Nn(this,La)))}getRPC(){return Nn(this,$a)}setOverwriteMetamask(e){Pn(this,Xc,e)}getAddress(){return Nn(this,Ds)}setAddress(e){Pn(this,Ds,e)}setRPC(e){Pn(this,$a,e)}};let mE=wE;Qi=new WeakMap,La=new WeakMap,Al=new WeakMap,Xc=new WeakMap,Ds=new WeakMap,$a=new WeakMap,mE.NETWORK="ethereum";class jM{constructor(t){this.provider=t}async request(t,r){if(t.method==="getKey"){const i=await this.provider.internalRequest({method:"requestAccounts",params:t.params}),s=JSON.parse(i);return{algo:"secp256k1",address:s.address,bech32Address:s.address,pubKey:ie.Buffer.from(s.pubKey,"hex")}}const n={signAmino:"signTransaction",signDirect:"signTransaction",signArbitrary:"signMessage",sendTx:"sendTransaction"};return n[t.method]?this.provider.internalRequest({method:n[t.method],params:t.params}):r()}}var bE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},vE=(e,t,r)=>(bE(e,t,"read from private field"),r?r.call(e):t.get(e)),zM=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},qM=(e,t,r,n)=>(bE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Jc;const Qc=class extends Cl{constructor(e){super(),zM(this,Jc,!1),this.isKeplr=!0,this.isTrust=!0,this.isTrustWallet=!0,e&&(typeof e.disableMobileAdapter<"u"&&qM(this,Jc,e.disableMobileAdapter),typeof e.isKeplr<"u"&&(this.isKeplr=e.isKeplr),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),vE(this,Jc)||(this.mobileAdapter=new jM(this))}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}getNetwork(){return Qc.NETWORK}isMobileAdapterEnabled(){return!vE(this,Jc)}enable(e){return this.request({method:"enable",params:{chainIds:e}})}internalRequest(e){return super.request(e)}request(e){const t=()=>this.internalRequest(e);return this.mobileAdapter?this.mobileAdapter.request(e,t):t()}getKey(e){return this.request({method:"getKey",params:{chainId:e}})}async sendTx(e,t,r){const n=ie.Buffer.from(t).toString("base64"),i=await this.request({method:"sendTx",params:{raw:n,chainId:e,mode:r}});return ie.Buffer.from(i,"hex")}async signArbitrary(e,t,r){const n=ie.Buffer.from(r),i=Qc.bufferToHex(n);return await this.request({method:"signArbitrary",params:{chainId:e,data:i,signerAddress:t}})}async signAmino(e,t,r){const n=await this.request({method:"signAmino",params:{chainId:e,sign_doc:r}}),{signed:i,signature:s}=JSON.parse(n);return{signed:i,signature:s}}async signDirect(e,t,r){const n={bodyBytes:Qc.bufferToHex(r.bodyBytes),authInfoBytes:Qc.bufferToHex(r.authInfoBytes)},i=await this.request({method:"signDirect",params:{signerAddress:t,chainId:e,sign_doc:n}}),{signature:s}=JSON.parse(i);return{signed:r,signature:s}}experimentalSuggestChain(){}getOfflineSignerDirect(e){return{getAccounts:async()=>[await this.getKey(e)],signDirect:async(t,r)=>{if(e!==r.chainId)throw new Error("Unmatched chain id with the offline signer");if((await this.getKey(r.chainId)).address!==t)throw new Error("Unknown signer address");return await this.signDirect(e,t,r)}}}getOfflineSigner(e){return this.getOfflineSignerAmino(e)}getOfflineSignerAuto(e){return this.getOfflineSignerAmino(e)}getOfflineSignerAmino(e){return{getAccounts:async()=>{const t=await this.getKey(e);return[{address:t.bech32Address,algo:"secp256k1",pubkey:t.pubKey}]},sign:(t,r)=>this.signAmino(e,t,r),signAmino:(t,r)=>this.signAmino(e,t,r)}}};let _E=Qc;Jc=new WeakMap,_E.NETWORK="cosmos";var Mp={exports:{}},Oa=typeof Reflect=="object"?Reflect:null,EE=Oa&&typeof Oa.apply=="function"?Oa.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},Bl;Oa&&typeof Oa.ownKeys=="function"?Bl=Oa.ownKeys:Object.getOwnPropertySymbols?Bl=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Bl=function(e){return Object.getOwnPropertyNames(e)};function VM(e){console&&console.warn&&console.warn(e)}var xE=Number.isNaN||function(e){return e!==e};function Gt(){Gt.init.call(this)}Mp.exports=Gt,Mp.exports.once=GM,Gt.EventEmitter=Gt,Gt.prototype._events=void 0,Gt.prototype._eventsCount=0,Gt.prototype._maxListeners=void 0;var SE=10;function Il(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Gt,"defaultMaxListeners",{enumerable:!0,get:function(){return SE},set:function(e){if(typeof e!="number"||e<0||xE(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");SE=e}}),Gt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Gt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||xE(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function AE(e){return e._maxListeners===void 0?Gt.defaultMaxListeners:e._maxListeners}Gt.prototype.getMaxListeners=function(){return AE(this)},Gt.prototype.emit=function(e){for(var t=[],r=1;r0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(a===void 0)return!1;if(typeof a=="function")EE(a,this,t);else for(var c=a.length,u=kE(a,c),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,VM(a)}return e}Gt.prototype.addListener=function(e,t){return BE(this,e,t,!1)},Gt.prototype.on=Gt.prototype.addListener,Gt.prototype.prependListener=function(e,t){return BE(this,e,t,!0)};function WM(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function IE(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=WM.bind(n);return i.listener=r,n.wrapFn=i,i}Gt.prototype.once=function(e,t){return Il(t),this.on(e,IE(this,e,t)),this},Gt.prototype.prependOnceListener=function(e,t){return Il(t),this.prependListener(e,IE(this,e,t)),this},Gt.prototype.removeListener=function(e,t){var r,n,i,s,o;if(Il(t),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;i===0?r.shift():KM(r,i),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,o||t)}return this},Gt.prototype.off=Gt.prototype.removeListener,Gt.prototype.removeAllListeners=function(e){var t,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),s;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function RE(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?ZM(i):kE(i,i.length)}Gt.prototype.listeners=function(e){return RE(this,e,!0)},Gt.prototype.rawListeners=function(e){return RE(this,e,!1)},Gt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):TE.call(e,t)},Gt.prototype.listenerCount=TE;function TE(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Gt.prototype.eventNames=function(){return this._eventsCount>0?Bl(this._events):[]};function kE(e,t){for(var r=new Array(t),n=0;n"u"}function Tw(e){return le.isBuffer(e)}function Td(e){return Object.prototype.toString.call(e)}function kd(e){return e<10?"0"+e.toString(10):e.toString(10)}var F8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function D8(){var e=new Date,t=[kd(e.getHours()),kd(e.getMinutes()),kd(e.getSeconds())].join(":");return[e.getDate(),F8[e.getMonth()],t].join(" ")}function kw(){console.log("%s - %s",D8(),Su.apply(null,arguments))}function Cd(e,t){if(!t||!zi(t))return e;for(var r=Object.keys(t),n=r.length;n--;)e[r[n]]=t[r[n]];return e}function Cw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var oo=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function Ld(e){if(typeof e!="function")throw new TypeError('The "original" argument must be of type Function');if(oo&&e[oo]){var t=e[oo];if(typeof t!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(t,oo,{value:t,enumerable:!1,writable:!1,configurable:!0}),t}function t(){for(var r,n,i=new Promise(function(a,c){r=a,n=c}),s=[],o=0;o0?this.tail.next=t:this.head=t,this.tail=t,++this.length},ao.prototype.unshift=function(e){var t={data:e,next:this.head};this.length===0&&(this.tail=t),this.head=t,++this.length},ao.prototype.shift=function(){if(this.length!==0){var e=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,e}},ao.prototype.clear=function(){this.head=this.tail=null,this.length=0},ao.prototype.join=function(e){if(this.length===0)return"";for(var t=this.head,r=""+t.data;t=t.next;)r+=e+t.data;return r},ao.prototype.concat=function(e){if(this.length===0)return ie.Buffer.alloc(0);if(this.length===1)return this.head.data;for(var t=ie.Buffer.allocUnsafe(e>>>0),r=this.head,n=0;r;)r.data.copy(t,n),n+=r.data.length,r=r.next;return t};var $d=lf.exports.Buffer,$w=$d.isEncoding||function(e){switch(e=""+e,e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function q8(e){if(!e)return"utf8";for(var t;;)switch(e){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return e;default:if(t)return;e=(""+e).toLowerCase(),t=!0}}function V8(e){var t=q8(e);if(typeof t!="string"&&($d.isEncoding===$w||!$w(e)))throw new Error("Unknown encoding: "+e);return t||e}var Ow=uc;function uc(e){this.encoding=V8(e);var t;switch(this.encoding){case"utf16le":this.text=X8,this.end=J8,t=4;break;case"utf8":this.fillLast=Z8,t=4;break;case"base64":this.text=Q8,this.end=eR,t=3;break;default:this.write=tR,this.end=rR;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=$d.allocUnsafe(t)}uc.prototype.write=function(e){if(e.length===0)return"";var t,r;if(this.lastNeed){if(t=this.fillLast(e),t===void 0)return"";r=this.lastNeed,this.lastNeed=0}else r=0;return r>5===6?2:e>>4===14?3:e>>3===30?4:e>>6===2?-1:-2}function W8(e,t,r){var n=t.length-1;if(n=0?(i>0&&(e.lastNeed=i-1),i):--n=0?(i>0&&(e.lastNeed=i-2),i):--n=0?(i>0&&(i===2?i=0:e.lastNeed=i-3),i):0))}function K8(e,t,r){if((t[0]&192)!==128)return e.lastNeed=0,"\uFFFD";if(e.lastNeed>1&&t.length>1){if((t[1]&192)!==128)return e.lastNeed=1,"\uFFFD";if(e.lastNeed>2&&t.length>2&&(t[2]&192)!==128)return e.lastNeed=2,"\uFFFD"}}function Z8(e){var t=this.lastTotal-this.lastNeed,r=K8(this,e);if(r!==void 0)return r;if(this.lastNeed<=e.length)return e.copy(this.lastChar,t,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);e.copy(this.lastChar,t,0,e.length),this.lastNeed-=e.length}function G8(e,t){var r=W8(this,e,t);if(!this.lastNeed)return e.toString("utf8",t);this.lastTotal=r;var n=e.length-(r-this.lastNeed);return e.copy(this.lastChar,0,n),e.toString("utf8",t,n)}function Y8(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function X8(e,t){if((e.length-t)%2===0){var r=e.toString("utf16le",t);if(r){var n=r.charCodeAt(r.length-1);if(n>=55296&&n<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1],r.slice(0,-1)}return r}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=e[e.length-1],e.toString("utf16le",t,e.length-1)}function J8(e){var t=e&&e.length?this.write(e):"";if(this.lastNeed){var r=this.lastTotal-this.lastNeed;return t+this.lastChar.toString("utf16le",0,r)}return t}function Q8(e,t){var r=(e.length-t)%3;return r===0?e.toString("base64",t):(this.lastNeed=3-r,this.lastTotal=3,r===1?this.lastChar[0]=e[e.length-1]:(this.lastChar[0]=e[e.length-2],this.lastChar[1]=e[e.length-1]),e.toString("base64",t,e.length-r))}function eR(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function tR(e){return e.toString(this.encoding)}function rR(e){return e&&e.length?this.write(e):""}ar.ReadableState=Mw;var Vt=xd("stream");qr(ar,Dn.exports);function nR(e,t,r){if(typeof e.prependListener=="function")return e.prependListener(t,r);!e._events||!e._events[t]?e.on(t,r):Array.isArray(e._events[t])?e._events[t].unshift(r):e._events[t]=[r,e._events[t]]}function iR(e,t){return e.listeners(t).length}function Mw(e,t){e=e||{},this.objectMode=!!e.objectMode,t instanceof Gn&&(this.objectMode=this.objectMode||!!e.readableObjectMode);var r=e.highWaterMark,n=this.objectMode?16:16*1024;this.highWaterMark=r||r===0?r:n,this.highWaterMark=~~this.highWaterMark,this.buffer=new ao,this.length=0,this.pipes=null,this.pipesCount=0,this.flowing=null,this.ended=!1,this.endEmitted=!1,this.reading=!1,this.sync=!0,this.needReadable=!1,this.emittedReadable=!1,this.readableListening=!1,this.resumeScheduled=!1,this.defaultEncoding=e.defaultEncoding||"utf8",this.ranOut=!1,this.awaitDrain=0,this.readingMore=!1,this.decoder=null,this.encoding=null,e.encoding&&(this.decoder=new Ow(e.encoding),this.encoding=e.encoding)}function ar(e){if(!(this instanceof ar))return new ar(e);this._readableState=new Mw(e,this),this.readable=!0,e&&typeof e.read=="function"&&(this._read=e.read),Dn.exports.call(this)}ar.prototype.push=function(e,t){var r=this._readableState;return!r.objectMode&&typeof e=="string"&&(t=t||r.defaultEncoding,t!==r.encoding&&(e=le.from(e,t),t="")),Nw(this,r,e,t,!1)},ar.prototype.unshift=function(e){var t=this._readableState;return Nw(this,t,e,"",!0)},ar.prototype.isPaused=function(){return this._readableState.flowing===!1};function Nw(e,t,r,n,i){var s=aR(t,r);if(s)e.emit("error",s);else if(r===null)t.reading=!1,cR(e,t);else if(t.objectMode||r&&r.length>0)if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var a=new Error("stream.unshift() after end event");e.emit("error",a)}else{var c;t.decoder&&!i&&!n&&(r=t.decoder.write(r),c=!t.objectMode&&r.length===0),i||(t.reading=!1),c||(t.flowing&&t.length===0&&!t.sync?(e.emit("data",r),e.read(0)):(t.length+=t.objectMode?1:r.length,i?t.buffer.unshift(r):t.buffer.push(r),t.needReadable&&ku(e))),fR(e,t)}else i||(t.reading=!1);return sR(t)}function sR(e){return!e.ended&&(e.needReadable||e.length=Pw?e=Pw:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function Uw(e,t){return e<=0||t.length===0&&t.ended?0:t.objectMode?1:e!==e?t.flowing&&t.length?t.buffer.head.data.length:t.length:(e>t.highWaterMark&&(t.highWaterMark=oR(e)),e<=t.length?e:t.ended?t.length:(t.needReadable=!0,0))}ar.prototype.read=function(e){Vt("read",e),e=parseInt(e,10);var t=this._readableState,r=e;if(e!==0&&(t.emittedReadable=!1),e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended))return Vt("read: emitReadable",t.length,t.ended),t.length===0&&t.ended?Nd(this):ku(this),null;if(e=Uw(e,t),e===0&&t.ended)return t.length===0&&Nd(this),null;var n=t.needReadable;Vt("need readable",n),(t.length===0||t.length-e0?i=Dw(e,t):i=null,i===null?(t.needReadable=!0,e=0):t.length-=e,t.length===0&&(t.ended||(t.needReadable=!0),r!==e&&t.ended&&Nd(this)),i!==null&&this.emit("data",i),i};function aR(e,t){var r=null;return!le.isBuffer(t)&&typeof t!="string"&&t!==null&&t!==void 0&&!e.objectMode&&(r=new TypeError("Invalid non-string/buffer chunk")),r}function cR(e,t){if(!t.ended){if(t.decoder){var r=t.decoder.end();r&&r.length&&(t.buffer.push(r),t.length+=t.objectMode?1:r.length)}t.ended=!0,ku(e)}}function ku(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Vt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?On(Fw,e):Fw(e))}function Fw(e){Vt("emit readable"),e.emit("readable"),Md(e)}function fR(e,t){t.readingMore||(t.readingMore=!0,On(uR,e,t))}function uR(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length1&&Hw(n.pipes,e)!==-1)&&!u&&(Vt("false write response, pause",r._readableState.awaitDrain),r._readableState.awaitDrain++,y=!0),r.pause())}function v(H){Vt("onerror",H),P(),e.removeListener("error",v),iR(e,"error")===0&&e.emit("error",H)}nR(e,"error",v);function R(){e.removeListener("finish",O),P()}e.once("close",R);function O(){Vt("onfinish"),e.removeListener("close",R),P()}e.once("finish",O);function P(){Vt("unpipe"),r.unpipe(e)}return e.emit("pipe",r),n.flowing||(Vt("pipe resume"),r.resume()),e};function lR(e){return function(){var t=e._readableState;Vt("pipeOnDrain",t.awaitDrain),t.awaitDrain&&t.awaitDrain--,t.awaitDrain===0&&e.listeners("data").length&&(t.flowing=!0,Md(e))}}ar.prototype.unpipe=function(e){var t=this._readableState;if(t.pipesCount===0)return this;if(t.pipesCount===1)return e&&e!==t.pipes?this:(e||(e=t.pipes),t.pipes=null,t.pipesCount=0,t.flowing=!1,e&&e.emit("unpipe",this),this);if(!e){var r=t.pipes,n=t.pipesCount;t.pipes=null,t.pipesCount=0,t.flowing=!1;for(var i=0;i=t.length?(t.decoder?r=t.buffer.join(""):t.buffer.length===1?r=t.buffer.head.data:r=t.buffer.concat(t.length),t.buffer.clear()):r=gR(e,t.buffer,t.decoder),r}function gR(e,t,r){var n;return es.length?s.length:e;if(o===s.length?i+=s:i+=s.slice(0,e),e-=o,e===0){o===s.length?(++n,r.next?t.head=r.next:t.head=t.tail=null):(t.head=r,r.data=s.slice(o));break}++n}return t.length-=n,i}function wR(e,t){var r=le.allocUnsafe(e),n=t.head,i=1;for(n.data.copy(r),e-=n.data.length;n=n.next;){var s=n.data,o=e>s.length?s.length:e;if(s.copy(r,r.length-e,0,o),e-=o,e===0){o===s.length?(++i,n.next?t.head=n.next:t.head=t.tail=null):(t.head=n,n.data=s.slice(o));break}++i}return t.length-=i,r}function Nd(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,On(mR,t,e))}function mR(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function bR(e,t){for(var r=0,n=e.length;r-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function SR(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=ie.Buffer.from(t,r)),t}function AR(e,t,r,n,i){r=SR(t,r,n),ie.Buffer.isBuffer(r)&&(n="buffer");var s=t.objectMode?1:r.length;t.length+=s;var o=t.lengthe._pos){var n=r.substr(e._pos);if(e._charset==="x-user-defined"){for(var i=new le(n.length),s=0;se._pos&&(e.push(new le(new Uint8Array(o.result.slice(e._pos)))),e._pos=o.result.byteLength)},o.onload=function(){e.push(null)},o.readAsArrayBuffer(r);break}e._xhr.readyState===co.DONE&&e._mode!=="ms-stream"&&e.push(null)};function MR(e){if(e instanceof Uint8Array){if(e.byteOffset===0&&e.byteLength===e.buffer.byteLength)return e.buffer;if(typeof e.buffer.slice=="function")return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}if(ie.isBuffer(e)){for(var t=new Uint8Array(e.length),r=e.length,n=0;n= 0x80 (not a basic code point)","invalid-input":"Invalid input"},zd=hc-Yw,ra=Math.floor,qd=String.fromCharCode;function Xw(e){throw new RangeError(WR[e])}function KR(e,t){const r=[];let n=e.length;for(;n--;)r[n]=t(e[n]);return r}function ZR(e,t){const r=e.split("@");let n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(VR,".");const i=e.split("."),s=KR(i,t).join(".");return n+s}function GR(e){const t=[];let r=0;const n=e.length;for(;r=55296&&i<=56319&&r>1,e+=ra(e/t);e>zd*jd>>1;n+=hc)e=ra(e/zd);return ra(n+(zd+1)*e/(e+FR))},XR=function(e){const t=[];e=GR(e);const r=e.length;let n=jR,i=0,s=HR;for(const c of e)c<128&&t.push(qd(c));const o=t.length;let a=o;for(o&&t.push(zR);a=n&&lra((Hd-i)/u)&&Xw("overflow"),i+=(c-n)*u,n=c;for(const l of e)if(lHd&&Xw("overflow"),l===n){let y=i;for(let A=hc;;A+=hc){const v=A<=s?Yw:A>=s+jd?jd:A-s;if(y0&&a>o&&(a=o);for(var c=0;c=0?(y=u.substr(0,l),A=u.substr(l+1)):(y=u,A=""),v=decodeURIComponent(y),R=decodeURIComponent(A),QR(i,v)?Qw(i[v])?i[v].push(R):i[v]=[i[v],R]:i[v]=R}return i}const rm=pr.URL,nm=pr.URLSearchParams;var rT={parse:fo,resolve:um,resolveObject:lm,fileURLToPath:cm,format:fm,Url:Mn,URL:rm,URLSearchParams:nm};function Mn(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var nT=/^([a-z0-9.+-]+:)/i,iT=/:[0-9]*$/,sT=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,oT=["<",">",'"',"`"," ","\r",` +`," "],aT=["{","}","|","\\","^","`"].concat(oT),Vd=["'"].concat(aT),im=["%","/","?",";","#"].concat(Vd),sm=["/","?","#"],cT=255,om=/^[+a-z0-9A-Z_-]{0,63}$/,fT=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,uT={javascript:!0,"javascript:":!0},Wd={javascript:!0,"javascript:":!0},na={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function fo(e,t,r){if(e&&zi(e)&&e instanceof Mn)return e;var n=new Mn;return n.parse(e,t,r),n}Mn.prototype.parse=function(e,t,r){return am(this,e,t,r)};function am(e,t,r,n){if(!ms(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),s=i!==-1&&i127?Z+="x":Z+=G[z];if(!Z.match(om)){var se=q.slice(0,v),Q=q.slice(v+1),I=G.match(fT);I&&(se.push(I[1]),Q.unshift(I[2])),Q.length&&(c="/"+Q.join(".")+c),e.hostname=se.join(".");break}}}}e.hostname.length>cT?e.hostname="":e.hostname=e.hostname.toLowerCase(),$||(e.hostname=JR(e.hostname)),P=e.port?":"+e.port:"";var g=e.hostname||"";e.host=g+P,e.href+=e.host,$&&(e.hostname=e.hostname.substr(1,e.hostname.length-2),c[0]!=="/"&&(c="/"+c))}if(!uT[y])for(v=0,O=Vd.length;v0?r.host.split("@"):!1,q&&(r.auth=q.shift(),r.host=r.hostname=q.shift())),r.search=e.search,r.query=e.query,(!ji(r.pathname)||!ji(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r;if(!N.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var G=N.slice(-1)[0],Z=(r.host||e.host||N.length>1)&&(G==="."||G==="..")||G==="",z=0,ee=N.length;ee>=0;ee--)G=N[ee],G==="."?N.splice(ee,1):G===".."?(N.splice(ee,1),z++):z&&(N.splice(ee,1),z--);if(!H&&!F)for(;z--;z)N.unshift("..");H&&N[0]!==""&&(!N[0]||N[0].charAt(0)!=="/")&&N.unshift(""),Z&&N.join("/").substr(-1)!=="/"&&N.push("");var se=N[0]===""||N[0]&&N[0].charAt(0)==="/";return $&&(r.hostname=r.host=se?"":N.length?N.shift():"",q=r.host&&r.host.indexOf("@")>0?r.host.split("@"):!1,q&&(r.auth=q.shift(),r.host=r.hostname=q.shift())),H=H||r.host&&N.length,H&&!se&&N.unshift(""),N.length?r.pathname=N.join("/"):(r.pathname=null,r.path=null),(!ji(r.pathname)||!ji(r.search))&&(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},Mn.prototype.parseHost=function(){return hm(this)};function hm(e){var t=e.host,r=iT.exec(t);r&&(r=r[0],r!==":"&&(e.port=r.substr(1)),t=t.substr(0,t.length-r.length)),t&&(e.hostname=t)}var hT=Object.freeze({__proto__:null,parse:fo,resolve:um,resolveObject:lm,fileURLToPath:cm,format:fm,URL:rm,URLSearchParams:nm,default:rT,Url:Mn});function Zd(e,t){typeof e=="string"&&(e=fo(e));var r=pr.location.protocol.search(/^https?:$/)===-1?"http:":"",n=e.protocol||r,i=e.hostname||e.host,s=e.port,o=e.path||"/";i&&i.indexOf(":")!==-1&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(s?":"+s:"")+o,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var a=new Xr(e);return t&&a.on("response",t),a}function dm(e,t){var r=Zd(e,t);return r.end(),r}function Gd(){}Gd.defaultMaxSockets=4;var pm=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],gm={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},dT={request:Zd,get:dm,Agent:Gd,METHODS:pm,STATUS_CODES:gm},pT=Object.freeze({__proto__:null,request:Zd,get:dm,Agent:Gd,METHODS:pm,STATUS_CODES:gm,default:dT}),gT=Un(pT);function Yd(e,t){typeof e=="string"&&(e=fo(e));var r=pr.location.protocol.search(/^https?:$/)===-1?"http:":"",n=e.protocol||r,i=e.hostname||e.host,s=e.port,o=e.path||"/";i&&i.indexOf(":")!==-1&&(i="["+i+"]"),e.url=(i?n+"//"+i:"")+(s?":"+s:"")+o,e.method=(e.method||"GET").toUpperCase(),e.headers=e.headers||{};var a=new Xr(e);return t&&a.on("response",t),a}function ym(e,t){var r=Yd(e,t);return r.end(),r}function Xd(){}Xd.defaultMaxSockets=4;var wm=["CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REPORT","SEARCH","SUBSCRIBE","TRACE","UNLOCK","UNSUBSCRIBE"],mm={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"},yT={request:Yd,get:ym,Agent:Xd,METHODS:wm,STATUS_CODES:mm},wT=Object.freeze({__proto__:null,request:Yd,get:ym,Agent:Xd,METHODS:wm,STATUS_CODES:mm,default:yT}),mT=Un(wT),bm={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"};function bT(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}function Vi(e,t,r,n,i){if(t.subarray&&e.subarray){e.set(t.subarray(r,r+n),i);return}for(var s=0;s=0;)e[t]=0}var ET=0,Em=1,xT=2,ST=3,AT=258,Jd=29,pc=256,gc=pc+1+Jd,sa=30,Qd=19,xm=2*gc+1,uo=15,e0=16,BT=7,t0=256,Sm=16,Am=17,Bm=18,r0=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],Ou=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],IT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Im=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],RT=512,Wi=new Array((gc+2)*2);ia(Wi);var yc=new Array(sa*2);ia(yc);var wc=new Array(RT);ia(wc);var mc=new Array(AT-ST+1);ia(mc);var n0=new Array(Jd);ia(n0);var Mu=new Array(sa);ia(Mu);function i0(e,t,r,n,i){this.static_tree=e,this.extra_bits=t,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=e&&e.length}var Rm,Tm,km;function s0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Cm(e){return e<256?wc[e]:wc[256+(e>>>7)]}function bc(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function En(e,t,r){e.bi_valid>e0-r?(e.bi_buf|=t<>e0-e.bi_valid,e.bi_valid+=r-e0):(e.bi_buf|=t<>>=1,r<<=1;while(--t>0);return r>>>1}function TT(e){e.bi_valid===16?(bc(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function kT(e,t){var r=t.dyn_tree,n=t.max_code,i=t.stat_desc.static_tree,s=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,a=t.stat_desc.extra_base,c=t.stat_desc.max_length,u,l,y,A,v,R,O=0;for(A=0;A<=uo;A++)e.bl_count[A]=0;for(r[e.heap[e.heap_max]*2+1]=0,u=e.heap_max+1;uc&&(A=c,O++),r[l*2+1]=A,!(l>n)&&(e.bl_count[A]++,v=0,l>=a&&(v=o[l-a]),R=r[l*2],e.opt_len+=R*(A+v),s&&(e.static_len+=R*(i[l*2+1]+v)));if(O!==0){do{for(A=c-1;e.bl_count[A]===0;)A--;e.bl_count[A]--,e.bl_count[A+1]+=2,e.bl_count[c]--,O-=2}while(O>0);for(A=c;A!==0;A--)for(l=e.bl_count[A];l!==0;)y=e.heap[--u],!(y>n)&&(r[y*2+1]!==A&&(e.opt_len+=(A-r[y*2+1])*r[y*2],r[y*2+1]=A),l--)}}function $m(e,t,r){var n=new Array(uo+1),i=0,s,o;for(s=1;s<=uo;s++)n[s]=i=i+r[s-1]<<1;for(o=0;o<=t;o++){var a=e[o*2+1];a!==0&&(e[o*2]=Lm(n[a]++,a))}}function CT(){var e,t,r,n,i,s=new Array(uo+1);for(r=0,n=0;n>=7;n8?bc(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function LT(e,t,r,n){Mm(e),n&&(bc(e,r),bc(e,~r)),Vi(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Nm(e,t,r,n){var i=t*2,s=r*2;return e[i]>1;o>=1;o--)o0(e,r,o);u=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],o0(e,r,1),a=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=a,r[u*2]=r[o*2]+r[a*2],e.depth[u]=(e.depth[o]>=e.depth[a]?e.depth[o]:e.depth[a])+1,r[o*2+1]=r[a*2+1]=u,e.heap[1]=u++,o0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],kT(e,t),$m(r,c,e.bl_count)}function Um(e,t,r){var n,i=-1,s,o=t[0*2+1],a=0,c=7,u=4;for(o===0&&(c=138,u=3),t[(r+1)*2+1]=65535,n=0;n<=r;n++)s=o,o=t[(n+1)*2+1],!(++a=3&&e.bl_tree[Im[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function OT(e,t,r,n){var i;for(En(e,t-257,5),En(e,r-1,5),En(e,n-4,4),i=0;i>>=1)if(t&1&&e.dyn_ltree[r*2]!==0)return vm;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return _m;for(r=32;r0?(e.strm.data_type===_T&&(e.strm.data_type=MT(e)),a0(e,e.l_desc),a0(e,e.d_desc),o=$T(e),i=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=i&&(i=s)):i=s=r+5,r+4<=i&&t!==-1?Hm(e,t,r,n):e.strategy===vT||s===i?(En(e,(Em<<1)+(n?1:0),3),Pm(e,Wi,yc)):(En(e,(xT<<1)+(n?1:0),3),OT(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Pm(e,e.dyn_ltree,e.dyn_dtree)),Om(e),n&&Mm(e)}function bs(e,t,r){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=r&255,e.last_lit++,t===0?e.dyn_ltree[r*2]++:(e.matches++,t--,e.dyn_ltree[(mc[r]+pc+1)*2]++,e.dyn_dtree[Cm(t)*2]++),e.last_lit===e.lit_bufsize-1}function c0(e,t,r,n){for(var i=e&65535|0,s=e>>>16&65535|0,o=0;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+t[n++]|0,s=s+i|0;while(--o);i%=65521,s%=65521}return i|s<<16|0}function FT(){for(var e,t=[],r=0;r<256;r++){e=r;for(var n=0;n<8;n++)e=e&1?3988292384^e>>>1:e>>>1;t[r]=e}return t}var DT=FT();function Vr(e,t,r,n){var i=DT,s=n+r;e^=-1;for(var o=n;o>>8^i[(e^t[o])&255];return e^-1}var lo=0,HT=1,jT=3,vs=4,jm=5,_s=0,zm=1,Es=-2,zT=-3,f0=-5,qT=-1,VT=1,Nu=2,WT=3,KT=4,ZT=2,u0=8,GT=9,YT=29,XT=256,l0=XT+1+YT,JT=30,QT=19,e4=2*l0+1,t4=15,Ft=3,xs=258,si=xs+Ft+1,r4=32,h0=42,d0=69,Pu=73,Uu=91,Fu=103,ho=113,vc=666,$r=1,_c=2,po=3,oa=4,n4=3;function Ss(e,t){return e.msg=bm[t],t}function qm(e){return(e<<1)-(e>4?9:0)}function go(e){for(var t=e.length;--t>=0;)e[t]=0}function As(e){var t=e.state,r=t.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(Vi(e.output,t.pending_buf,t.pending_out,r,e.next_out),e.next_out+=r,t.pending_out+=r,e.total_out+=r,e.avail_out-=r,t.pending-=r,t.pending===0&&(t.pending_out=0))}function Jr(e,t){UT(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,As(e.strm)}function Pt(e,t){e.pending_buf[e.pending++]=t}function Ec(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function i4(e,t,r,n){var i=e.avail_in;return i>n&&(i=n),i===0?0:(e.avail_in-=i,Vi(t,e.input,e.next_in,i,r),e.state.wrap===1?e.adler=c0(e.adler,t,i,r):e.state.wrap===2&&(e.adler=Vr(e.adler,t,i,r)),e.next_in+=i,e.total_in+=i,i)}function Vm(e,t){var r=e.max_chain_length,n=e.strstart,i,s,o=e.prev_length,a=e.nice_match,c=e.strstart>e.w_size-si?e.strstart-(e.w_size-si):0,u=e.window,l=e.w_mask,y=e.prev,A=e.strstart+xs,v=u[n+o-1],R=u[n+o];e.prev_length>=e.good_match&&(r>>=2),a>e.lookahead&&(a=e.lookahead);do if(i=t,!(u[i+o]!==R||u[i+o-1]!==v||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&no){if(e.match_start=t,o=s,s>=a)break;v=u[n+o-1],R=u[n+o]}}while((t=y[t&l])>c&&--r!==0);return o<=e.lookahead?o:e.lookahead}function xc(e){var t=e.w_size,r,n,i,s,o;do{if(s=e.window_size-e.lookahead-e.strstart,e.strstart>=t+(t-si)){Vi(e.window,e.window,t,t,0),e.match_start-=t,e.strstart-=t,e.block_start-=t,n=e.hash_size,r=n;do i=e.head[--r],e.head[r]=i>=t?i-t:0;while(--n);n=t,r=n;do i=e.prev[--r],e.prev[r]=i>=t?i-t:0;while(--n);s+=t}if(e.strm.avail_in===0)break;if(n=i4(e.strm,e.window,e.strstart+e.lookahead,s),e.lookahead+=n,e.lookahead+e.insert>=Ft)for(o=e.strstart-e.insert,e.ins_h=e.window[o],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(r=e.pending_buf_size-5);;){if(e.lookahead<=1){if(xc(e),e.lookahead===0&&t===lo)return $r;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var n=e.block_start+r;if((e.strstart===0||e.strstart>=n)&&(e.lookahead=e.strstart-n,e.strstart=n,Jr(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-si&&(Jr(e,!1),e.strm.avail_out===0))return $r}return e.insert=0,t===vs?(Jr(e,!0),e.strm.avail_out===0?po:oa):(e.strstart>e.block_start&&(Jr(e,!1),e.strm.avail_out===0),$r)}function p0(e,t){for(var r,n;;){if(e.lookahead=Ft&&(e.ins_h=(e.ins_h<=Ft)if(n=bs(e,e.strstart-e.match_start,e.match_length-Ft),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=Ft){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=Ft&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=Ft-1)),e.prev_length>=Ft&&e.match_length<=e.prev_length){i=e.strstart+e.lookahead-Ft,n=bs(e,e.strstart-1-e.prev_match,e.prev_length-Ft),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=i&&(e.ins_h=(e.ins_h<=Ft&&e.strstart>0&&(i=e.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){s=e.strstart+xs;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&ie.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=Ft?(r=bs(e,1,e.match_length-Ft),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=bs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(Jr(e,!1),e.strm.avail_out===0))return $r}return e.insert=0,t===vs?(Jr(e,!0),e.strm.avail_out===0?po:oa):e.last_lit&&(Jr(e,!1),e.strm.avail_out===0)?$r:_c}function a4(e,t){for(var r;;){if(e.lookahead===0&&(xc(e),e.lookahead===0)){if(t===lo)return $r;break}if(e.match_length=0,r=bs(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(Jr(e,!1),e.strm.avail_out===0))return $r}return e.insert=0,t===vs?(Jr(e,!0),e.strm.avail_out===0?po:oa):e.last_lit&&(Jr(e,!1),e.strm.avail_out===0)?$r:_c}function Bi(e,t,r,n,i){this.good_length=e,this.max_lazy=t,this.nice_length=r,this.max_chain=n,this.func=i}var ca;ca=[new Bi(0,0,0,0,s4),new Bi(4,4,8,4,p0),new Bi(4,5,16,8,p0),new Bi(4,6,32,32,p0),new Bi(4,4,16,16,aa),new Bi(8,16,32,32,aa),new Bi(8,16,128,128,aa),new Bi(8,32,128,256,aa),new Bi(32,128,258,1024,aa),new Bi(32,258,258,4096,aa)];function c4(e){e.window_size=2*e.w_size,go(e.head),e.max_lazy_match=ca[e.level].max_lazy,e.good_match=ca[e.level].good_length,e.nice_match=ca[e.level].nice_length,e.max_chain_length=ca[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=Ft-1,e.match_available=0,e.ins_h=0}function f4(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=u0,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Xn(e4*2),this.dyn_dtree=new Xn((2*JT+1)*2),this.bl_tree=new Xn((2*QT+1)*2),go(this.dyn_ltree),go(this.dyn_dtree),go(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Xn(t4+1),this.heap=new Xn(2*l0+1),go(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xn(2*l0+1),go(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function u4(e){var t;return!e||!e.state?Ss(e,Es):(e.total_in=e.total_out=0,e.data_type=ZT,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?h0:ho,e.adler=t.wrap===2?0:1,t.last_flush=lo,NT(t),_s)}function Wm(e){var t=u4(e);return t===_s&&c4(e.state),t}function l4(e,t,r,n,i,s){if(!e)return Es;var o=1;if(t===qT&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>GT||r!==u0||n<8||n>15||t<0||t>9||s<0||s>KT)return Ss(e,Es);n===8&&(n=9);var a=new f4;return e.state=a,a.strm=e,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<jm||t<0)return e?Ss(e,Es):Es;if(n=e.state,!e.output||!e.input&&e.avail_in!==0||n.status===vc&&t!==vs)return Ss(e,e.avail_out===0?f0:Es);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===h0)if(n.wrap===2)e.adler=0,Pt(n,31),Pt(n,139),Pt(n,8),n.gzhead?(Pt(n,(n.gzhead.text?1:0)+(n.gzhead.hcrc?2:0)+(n.gzhead.extra?4:0)+(n.gzhead.name?8:0)+(n.gzhead.comment?16:0)),Pt(n,n.gzhead.time&255),Pt(n,n.gzhead.time>>8&255),Pt(n,n.gzhead.time>>16&255),Pt(n,n.gzhead.time>>24&255),Pt(n,n.level===9?2:n.strategy>=Nu||n.level<2?4:0),Pt(n,n.gzhead.os&255),n.gzhead.extra&&n.gzhead.extra.length&&(Pt(n,n.gzhead.extra.length&255),Pt(n,n.gzhead.extra.length>>8&255)),n.gzhead.hcrc&&(e.adler=Vr(e.adler,n.pending_buf,n.pending,0)),n.gzindex=0,n.status=d0):(Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,n.level===9?2:n.strategy>=Nu||n.level<2?4:0),Pt(n,n4),n.status=ho);else{var o=u0+(n.w_bits-8<<4)<<8,a=-1;n.strategy>=Nu||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,o|=a<<6,n.strstart!==0&&(o|=r4),o+=31-o%31,n.status=ho,Ec(n,o),n.strstart!==0&&(Ec(n,e.adler>>>16),Ec(n,e.adler&65535)),e.adler=1}if(n.status===d0)if(n.gzhead.extra){for(i=n.pending;n.gzindex<(n.gzhead.extra.length&65535)&&!(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),As(e),i=n.pending,n.pending===n.pending_buf_size));)Pt(n,n.gzhead.extra[n.gzindex]&255),n.gzindex++;n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),n.gzindex===n.gzhead.extra.length&&(n.gzindex=0,n.status=Pu)}else n.status=Pu;if(n.status===Pu)if(n.gzhead.name){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),As(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindexi&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.gzindex=0,n.status=Uu)}else n.status=Uu;if(n.status===Uu)if(n.gzhead.comment){i=n.pending;do{if(n.pending===n.pending_buf_size&&(n.gzhead.hcrc&&n.pending>i&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),As(e),i=n.pending,n.pending===n.pending_buf_size)){s=1;break}n.gzindexi&&(e.adler=Vr(e.adler,n.pending_buf,n.pending-i,i)),s===0&&(n.status=Fu)}else n.status=Fu;if(n.status===Fu&&(n.gzhead.hcrc?(n.pending+2>n.pending_buf_size&&As(e),n.pending+2<=n.pending_buf_size&&(Pt(n,e.adler&255),Pt(n,e.adler>>8&255),e.adler=0,n.status=ho)):n.status=ho),n.pending!==0){if(As(e),e.avail_out===0)return n.last_flush=-1,_s}else if(e.avail_in===0&&qm(t)<=qm(r)&&t!==vs)return Ss(e,f0);if(n.status===vc&&e.avail_in!==0)return Ss(e,f0);if(e.avail_in!==0||n.lookahead!==0||t!==lo&&n.status!==vc){var c=n.strategy===Nu?a4(n,t):n.strategy===WT?o4(n,t):ca[n.level].func(n,t);if((c===po||c===oa)&&(n.status=vc),c===$r||c===po)return e.avail_out===0&&(n.last_flush=-1),_s;if(c===_c&&(t===HT?PT(n):t!==jm&&(Hm(n,0,0,!1),t===jT&&(go(n.head),n.lookahead===0&&(n.strstart=0,n.block_start=0,n.insert=0))),As(e),e.avail_out===0))return n.last_flush=-1,_s}return t!==vs?_s:n.wrap<=0?zm:(n.wrap===2?(Pt(n,e.adler&255),Pt(n,e.adler>>8&255),Pt(n,e.adler>>16&255),Pt(n,e.adler>>24&255),Pt(n,e.total_in&255),Pt(n,e.total_in>>8&255),Pt(n,e.total_in>>16&255),Pt(n,e.total_in>>24&255)):(Ec(n,e.adler>>>16),Ec(n,e.adler&65535)),As(e),n.wrap>0&&(n.wrap=-n.wrap),n.pending!==0?_s:zm)}function d4(e){var t;return!e||!e.state?Es:(t=e.state.status,t!==h0&&t!==d0&&t!==Pu&&t!==Uu&&t!==Fu&&t!==ho&&t!==vc?Ss(e,Es):(e.state=null,t===ho?Ss(e,zT):_s))}var Du=30,p4=12;function g4(e,t){var r,n,i,s,o,a,c,u,l,y,A,v,R,O,P,H,F,N,$,q,G,Z,z,ee,se;r=e.state,n=e.next_in,ee=e.input,i=n+(e.avail_in-5),s=e.next_out,se=e.output,o=s-(t-e.avail_out),a=s+(e.avail_out-257),c=r.dmax,u=r.wsize,l=r.whave,y=r.wnext,A=r.window,v=r.hold,R=r.bits,O=r.lencode,P=r.distcode,H=(1<>>24,v>>>=$,R-=$,$=N>>>16&255,$===0)se[s++]=N&65535;else if($&16){q=N&65535,$&=15,$&&(R<$&&(v+=ee[n++]<>>=$,R-=$),R<15&&(v+=ee[n++]<>>24,v>>>=$,R-=$,$=N>>>16&255,$&16){if(G=N&65535,$&=15,R<$&&(v+=ee[n++]<c){e.msg="invalid distance too far back",r.mode=Du;break e}if(v>>>=$,R-=$,$=s-o,G>$){if($=G-$,$>l&&r.sane){e.msg="invalid distance too far back",r.mode=Du;break e}if(Z=0,z=A,y===0){if(Z+=u-$,$2;)se[s++]=z[Z++],se[s++]=z[Z++],se[s++]=z[Z++],q-=3;q&&(se[s++]=z[Z++],q>1&&(se[s++]=z[Z++]))}else{Z=s-G;do se[s++]=se[Z++],se[s++]=se[Z++],se[s++]=se[Z++],q-=3;while(q>2);q&&(se[s++]=se[Z++],q>1&&(se[s++]=se[Z++]))}}else if($&64){e.msg="invalid distance code",r.mode=Du;break e}else{N=P[(N&65535)+(v&(1<<$)-1)];continue r}break}}else if($&64)if($&32){r.mode=p4;break e}else{e.msg="invalid literal/length code",r.mode=Du;break e}else{N=O[(N&65535)+(v&(1<<$)-1)];continue t}break}}while(n>3,n-=q,R-=q<<3,v&=(1<=1&&Q[A]===0;A--);if(v>A&&(v=A),A===0)return i[s++]=1<<24|64<<16|0,i[s++]=1<<24|64<<16|0,a.bits=1,0;for(y=1;y0&&(e===Gm||A!==1))return-1;for(I[1]=0,u=1;uKm||e===Ym&&H>Zm)return 1;for(;;){h=u-O,o[l]se?(m=g[f+o[l]],_=z[ee+o[l]]):(m=32+64,_=0),N=1<>O)+$]=h<<24|m<<16|_|0;while($!==0);for(N=1<>=1;if(N!==0?(F&=N-1,F+=N):F=0,l++,--Q[u]===0){if(u===A)break;u=t[r+o[l]]}if(u>v&&(F&G)!==q){for(O===0&&(O=v),Z+=y,R=u-O,P=1<Km||e===Ym&&H>Zm)return 1;q=F&G,i[q]=v<<24|R<<16|Z-s|0}}return F!==0&&(i[Z+F]=u-O<<24|64<<16|0),a.bits=v,0}var v4=0,Xm=1,Jm=2,Qm=4,_4=5,Hu=6,Ac=0,E4=1,x4=2,Bs=-2,S4=-3,A4=-4,B4=-5,eb=8,tb=1,rb=2,nb=3,ib=4,sb=5,ob=6,ab=7,cb=8,fb=9,ub=10,lb=11,Ki=12,y0=13,hb=14,w0=15,db=16,pb=17,gb=18,yb=19,ju=20,zu=21,wb=22,mb=23,bb=24,vb=25,_b=26,m0=27,Eb=28,xb=29,cr=30,I4=31,R4=32,T4=852,k4=592;function Sb(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function C4(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Xn(320),this.work=new Xn(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function L4(e){var t;return!e||!e.state?Bs:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=tb,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new $u(T4),t.distcode=t.distdyn=new $u(k4),t.sane=1,t.back=-1,Ac)}function Ab(e){var t;return!e||!e.state?Bs:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,L4(e))}function $4(e,t){var r,n;return!e||!e.state||(n=e.state,t<0?(r=0,t=-t):(r=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?Bs:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,Ab(e))}function O4(e,t){var r,n;return e?(n=new C4,e.state=n,n.window=null,r=$4(e,t),r!==Ac&&(e.state=null),r):Bs}var Bb=!0,b0,v0;function M4(e){if(Bb){var t;for(b0=new $u(512),v0=new $u(32),t=0;t<144;)e.lens[t++]=8;for(;t<256;)e.lens[t++]=9;for(;t<280;)e.lens[t++]=7;for(;t<288;)e.lens[t++]=8;for(Sc(Xm,e.lens,0,288,b0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Sc(Jm,e.lens,0,32,v0,0,e.work,{bits:5}),Bb=!1}e.lencode=b0,e.lenbits=9,e.distcode=v0,e.distbits=5}function N4(e,t,r,n){var i,s=e.state;return s.window===null&&(s.wsize=1<=s.wsize?(Vi(s.window,t,r-s.wsize,s.wsize,0),s.wnext=0,s.whave=s.wsize):(i=s.wsize-s.wnext,i>n&&(i=n),Vi(s.window,t,r-n,i,s.wnext),n-=i,n?(Vi(s.window,t,r-n,n,0),s.wnext=n,s.whave=s.wsize):(s.wnext+=i,s.wnext===s.wsize&&(s.wnext=0),s.whave>>8&255,r.check=Vr(r.check,ee,2,0),u=0,l=0,r.mode=rb;break}if(r.flags=0,r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){e.msg="incorrect header check",r.mode=cr;break}if((u&15)!==eb){e.msg="unknown compression method",r.mode=cr;break}if(u>>>=4,l-=4,Z=(u&15)+8,r.wbits===0)r.wbits=Z;else if(Z>r.wbits){e.msg="invalid window size",r.mode=cr;break}r.dmax=1<>8&1),r.flags&512&&(ee[0]=u&255,ee[1]=u>>>8&255,r.check=Vr(r.check,ee,2,0)),u=0,l=0,r.mode=nb;case nb:for(;l<32;){if(a===0)break e;a--,u+=n[s++]<>>8&255,ee[2]=u>>>16&255,ee[3]=u>>>24&255,r.check=Vr(r.check,ee,4,0)),u=0,l=0,r.mode=ib;case ib:for(;l<16;){if(a===0)break e;a--,u+=n[s++]<>8),r.flags&512&&(ee[0]=u&255,ee[1]=u>>>8&255,r.check=Vr(r.check,ee,2,0)),u=0,l=0,r.mode=sb;case sb:if(r.flags&1024){for(;l<16;){if(a===0)break e;a--,u+=n[s++]<>>8&255,r.check=Vr(r.check,ee,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=ob;case ob:if(r.flags&1024&&(v=r.length,v>a&&(v=a),v&&(r.head&&(Z=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Array(r.head.extra_len)),Vi(r.head.extra,n,s,v,Z)),r.flags&512&&(r.check=Vr(r.check,n,v,s)),a-=v,s+=v,r.length-=v),r.length))break e;r.length=0,r.mode=ab;case ab:if(r.flags&2048){if(a===0)break e;v=0;do Z=n[s+v++],r.head&&Z&&r.length<65536&&(r.head.name+=String.fromCharCode(Z));while(Z&&v>9&1,r.head.done=!0),e.adler=r.check=0,r.mode=Ki;break;case ub:for(;l<32;){if(a===0)break e;a--,u+=n[s++]<>>=l&7,l-=l&7,r.mode=m0;break}for(;l<3;){if(a===0)break e;a--,u+=n[s++]<>>=1,l-=1,u&3){case 0:r.mode=hb;break;case 1:if(M4(r),r.mode=ju,t===Hu){u>>>=2,l-=2;break e}break;case 2:r.mode=pb;break;case 3:e.msg="invalid block type",r.mode=cr}u>>>=2,l-=2;break;case hb:for(u>>>=l&7,l-=l&7;l<32;){if(a===0)break e;a--,u+=n[s++]<>>16^65535)){e.msg="invalid stored block lengths",r.mode=cr;break}if(r.length=u&65535,u=0,l=0,r.mode=w0,t===Hu)break e;case w0:r.mode=db;case db:if(v=r.length,v){if(v>a&&(v=a),v>c&&(v=c),v===0)break e;Vi(i,n,s,v,o),a-=v,s+=v,c-=v,o+=v,r.length-=v;break}r.mode=Ki;break;case pb:for(;l<14;){if(a===0)break e;a--,u+=n[s++]<>>=5,l-=5,r.ndist=(u&31)+1,u>>>=5,l-=5,r.ncode=(u&15)+4,u>>>=4,l-=4,r.nlen>286||r.ndist>30){e.msg="too many length or distance symbols",r.mode=cr;break}r.have=0,r.mode=gb;case gb:for(;r.have>>=3,l-=3}for(;r.have<19;)r.lens[I[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,se={bits:r.lenbits},z=Sc(v4,r.lens,0,19,r.lencode,0,r.work,se),r.lenbits=se.bits,z){e.msg="invalid code lengths set",r.mode=cr;break}r.have=0,r.mode=yb;case yb:for(;r.have>>24,F=P>>>16&255,N=P&65535,!(H<=l);){if(a===0)break e;a--,u+=n[s++]<>>=H,l-=H,r.lens[r.have++]=N;else{if(N===16){for(Q=H+2;l>>=H,l-=H,r.have===0){e.msg="invalid bit length repeat",r.mode=cr;break}Z=r.lens[r.have-1],v=3+(u&3),u>>>=2,l-=2}else if(N===17){for(Q=H+3;l>>=H,l-=H,Z=0,v=3+(u&7),u>>>=3,l-=3}else{for(Q=H+7;l>>=H,l-=H,Z=0,v=11+(u&127),u>>>=7,l-=7}if(r.have+v>r.nlen+r.ndist){e.msg="invalid bit length repeat",r.mode=cr;break}for(;v--;)r.lens[r.have++]=Z}}if(r.mode===cr)break;if(r.lens[256]===0){e.msg="invalid code -- missing end-of-block",r.mode=cr;break}if(r.lenbits=9,se={bits:r.lenbits},z=Sc(Xm,r.lens,0,r.nlen,r.lencode,0,r.work,se),r.lenbits=se.bits,z){e.msg="invalid literal/lengths set",r.mode=cr;break}if(r.distbits=6,r.distcode=r.distdyn,se={bits:r.distbits},z=Sc(Jm,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,se),r.distbits=se.bits,z){e.msg="invalid distances set",r.mode=cr;break}if(r.mode=ju,t===Hu)break e;case ju:r.mode=zu;case zu:if(a>=6&&c>=258){e.next_out=o,e.avail_out=c,e.next_in=s,e.avail_in=a,r.hold=u,r.bits=l,g4(e,A),o=e.next_out,i=e.output,c=e.avail_out,s=e.next_in,n=e.input,a=e.avail_in,u=r.hold,l=r.bits,r.mode===Ki&&(r.back=-1);break}for(r.back=0;P=r.lencode[u&(1<>>24,F=P>>>16&255,N=P&65535,!(H<=l);){if(a===0)break e;a--,u+=n[s++]<>$)],H=P>>>24,F=P>>>16&255,N=P&65535,!($+H<=l);){if(a===0)break e;a--,u+=n[s++]<>>=$,l-=$,r.back+=$}if(u>>>=H,l-=H,r.back+=H,r.length=N,F===0){r.mode=_b;break}if(F&32){r.back=-1,r.mode=Ki;break}if(F&64){e.msg="invalid literal/length code",r.mode=cr;break}r.extra=F&15,r.mode=wb;case wb:if(r.extra){for(Q=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=mb;case mb:for(;P=r.distcode[u&(1<>>24,F=P>>>16&255,N=P&65535,!(H<=l);){if(a===0)break e;a--,u+=n[s++]<>$)],H=P>>>24,F=P>>>16&255,N=P&65535,!($+H<=l);){if(a===0)break e;a--,u+=n[s++]<>>=$,l-=$,r.back+=$}if(u>>>=H,l-=H,r.back+=H,F&64){e.msg="invalid distance code",r.mode=cr;break}r.offset=N,r.extra=F&15,r.mode=bb;case bb:if(r.extra){for(Q=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){e.msg="invalid distance too far back",r.mode=cr;break}r.mode=vb;case vb:if(c===0)break e;if(v=A-c,r.offset>v){if(v=r.offset-v,v>r.whave&&r.sane){e.msg="invalid distance too far back",r.mode=cr;break}v>r.wnext?(v-=r.wnext,R=r.wsize-v):R=r.wnext-v,v>r.length&&(v=r.length),O=r.window}else O=i,R=o-r.offset,v=r.length;v>c&&(v=c),c-=v,r.length-=v;do i[o++]=O[R++];while(--v);r.length===0&&(r.mode=zu);break;case _b:if(c===0)break e;i[o++]=r.length,c--,r.mode=zu;break;case m0:if(r.wrap){for(;l<32;){if(a===0)break e;a--,u|=n[s++]<Rc)throw new TypeError("Bad argument");this.mode=e,this.init_done=!1,this.write_in_progress=!1,this.pending_close=!1,this.windowBits=0,this.level=0,this.memLevel=0,this.strategy=0,this.dictionary=null}oi.prototype.init=function(e,t,r,n,i){this.windowBits=e,this.level=t,this.memLevel=r,this.strategy=n,(this.mode===Bc||this.mode===Vu)&&(this.windowBits+=16),this.mode===Rc&&(this.windowBits+=32),(this.mode===la||this.mode===Ic)&&(this.windowBits=-this.windowBits),this.strm=new bT;var s;switch(this.mode){case ua:case Bc:case la:s=l4(this.strm,this.level,Mb,this.windowBits,this.memLevel,this.strategy);break;case qu:case Vu:case Ic:case Rc:s=O4(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(s!==Wu){this._error(s);return}this.write_in_progress=!1,this.init_done=!0},oi.prototype.params=function(){throw new Error("deflateParams Not supported")},oi.prototype._writeCheck=function(){if(!this.init_done)throw new Error("write before init");if(this.mode===_0)throw new Error("already finalized");if(this.write_in_progress)throw new Error("write already in progress");if(this.pending_close)throw new Error("close is pending")},oi.prototype.write=function(e,t,r,n,i,s,o){this._writeCheck(),this.write_in_progress=!0;var a=this;return _n.nextTick(function(){a.write_in_progress=!1;var c=a._write(e,t,r,n,i,s,o);a.callback(c[0],c[1]),a.pending_close&&a.close()}),this};function t5(e,t){for(var r=0;rOe.Z_MAX_CHUNK))throw new Error("Invalid chunk size: "+e.chunkSize);if(e.windowBits&&(e.windowBitsOe.Z_MAX_WINDOWBITS))throw new Error("Invalid windowBits: "+e.windowBits);if(e.level&&(e.levelOe.Z_MAX_LEVEL))throw new Error("Invalid compression level: "+e.level);if(e.memLevel&&(e.memLevelOe.Z_MAX_MEMLEVEL))throw new Error("Invalid memLevel: "+e.memLevel);if(e.strategy&&e.strategy!=Oe.Z_FILTERED&&e.strategy!=Oe.Z_HUFFMAN_ONLY&&e.strategy!=Oe.Z_RLE&&e.strategy!=Oe.Z_FIXED&&e.strategy!=Oe.Z_DEFAULT_STRATEGY)throw new Error("Invalid strategy: "+e.strategy);if(e.dictionary&&!le.isBuffer(e.dictionary))throw new Error("Invalid dictionary: it should be a Buffer instance");this._binding=new Oe.Zlib(t);var r=this;this._hadError=!1,this._binding.onerror=function(s,o){r._binding=null,r._hadError=!0;var a=new Error(s);a.errno=o,a.code=ha[o],r.emit("error",a)};var n=Oe.Z_DEFAULT_COMPRESSION;typeof e.level=="number"&&(n=e.level);var i=Oe.Z_DEFAULT_STRATEGY;typeof e.strategy=="number"&&(i=e.strategy),this._binding.init(e.windowBits||Oe.Z_DEFAULT_WINDOWBITS,n,e.memLevel||Oe.Z_DEFAULT_MEMLEVEL,i,e.dictionary),this._buffer=new le(this._chunkSize),this._offset=0,this._closed=!1,this._level=n,this._strategy=i,this.once("end",this.close)}qr(fr,Yn),fr.prototype.params=function(e,t,r){if(eOe.Z_MAX_LEVEL)throw new RangeError("Invalid compression level: "+e);if(t!=Oe.Z_FILTERED&&t!=Oe.Z_HUFFMAN_ONLY&&t!=Oe.Z_RLE&&t!=Oe.Z_FIXED&&t!=Oe.Z_DEFAULT_STRATEGY)throw new TypeError("Invalid strategy: "+t);if(this._level!==e||this._strategy!==t){var n=this;this.flush(Oe.Z_SYNC_FLUSH,function(){n._binding.params(e,t),n._hadError||(n._level=e,n._strategy=t,r&&r())})}else _n.nextTick(r)},fr.prototype.reset=function(){return this._binding.reset()},fr.prototype._flush=function(e){this._transform(new le(0),"",e)},fr.prototype.flush=function(e,t){var r=this._writableState;if((typeof e=="function"||e===void 0&&!t)&&(t=e,e=Oe.Z_FULL_FLUSH),r.ended)t&&_n.nextTick(t);else if(r.ending)t&&this.once("end",t);else if(r.needDrain){var n=this;this.once("drain",function(){n.flush(t)})}else this._flushFlag=e,this.write(new le(0),"",t)},fr.prototype.close=function(e){if(e&&_n.nextTick(e),!this._closed){this._closed=!0,this._binding.close();var t=this;_n.nextTick(function(){t.emit("close")})}},fr.prototype._transform=function(e,t,r){var n,i=this._writableState,s=i.ending||i.ended,o=s&&(!e||i.length===e.length);if(!e===null&&!le.isBuffer(e))return r(new Error("invalid input"));o?n=Oe.Z_FINISH:(n=this._flushFlag,e.length>=i.length&&(this._flushFlag=this._opts.flush||Oe.Z_NO_FLUSH)),this._processChunk(e,n,r)},fr.prototype._processChunk=function(e,t,r){var n=e&&e.length,i=this._chunkSize-this._offset,s=0,o=this,a=typeof r=="function";if(!a){var c=[],u=0,l;this.on("error",function(O){l=O});do var y=this._binding.writeSync(t,e,s,n,this._buffer,this._offset,i);while(!this._hadError&&R(y[0],y[1]));if(this._hadError)throw l;var A=le.concat(c,u);return this.close(),A}var v=this._binding.write(t,e,s,n,this._buffer,this._offset,i);v.buffer=e,v.callback=R;function R(O,P){if(!o._hadError){var H=i-P;if(r5(H>=0,"have should not go down"),H>0){var F=o._buffer.slice(o._offset,o._offset+H);o._offset+=H,a?o.push(F):(c.push(F),u+=F.length)}if((P===0||o._offset>=o._chunkSize)&&(i=o._chunkSize,o._offset=0,o._buffer=new le(o._chunkSize)),P===0){if(s+=n-O,n=O,!a)return!0;var N=o._binding.write(t,e,s,n,o._buffer,o._offset,o._chunkSize);N.callback=R,N.buffer=e;return}if(!a)return!1;r()}}},qr(Is,fr),qr(Rs,fr),qr(Ts,fr),qr(ks,fr),qr(Cs,fr),qr(Ls,fr),qr($s,fr);var n5={codes:ha,createDeflate:Pb,createInflate:Ub,createDeflateRaw:Fb,createInflateRaw:Db,createGzip:Hb,createGunzip:jb,createUnzip:zb,deflate:qb,deflateSync:Vb,gzip:Wb,gzipSync:Kb,deflateRaw:Zb,deflateRawSync:Gb,unzip:Yb,unzipSync:Xb,inflate:Jb,inflateSync:Qb,gunzip:ev,gunzipSync:tv,inflateRaw:rv,inflateRawSync:nv,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr},i5=Object.freeze({__proto__:null,codes:ha,createDeflate:Pb,createInflate:Ub,createDeflateRaw:Fb,createInflateRaw:Db,createGzip:Hb,createGunzip:jb,createUnzip:zb,deflate:qb,deflateSync:Vb,gzip:Wb,gzipSync:Kb,deflateRaw:Zb,deflateRawSync:Gb,unzip:Yb,unzipSync:Xb,inflate:Jb,inflateSync:Qb,gunzip:ev,gunzipSync:tv,inflateRaw:rv,inflateRawSync:nv,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr,default:n5}),s5=Un(i5),o5=Un(z8),a5=Un(hT);Object.defineProperty(to,"__esModule",{value:!0}),to.InvalidStatusCodeError=to.InvalidCertError=void 0;const iv=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class x0 extends Error{constructor(t,r){super(t),this.fingerprint256=r}}to.InvalidCertError=x0;class S0 extends Error{constructor(t){super(`Request Failed. Status Code: ${t}`),this.statusCode=t}}to.InvalidStatusCodeError=S0;function sv(e,t){if(!t||t==="text"||t==="json")try{let r=new TextDecoder("utf8",{fatal:!0}).decode(e);if(t==="text")return r;try{return JSON.parse(r)}catch(n){if(t==="json")throw n;return r}}catch(r){if(t==="text"||t==="json")throw r}return e}let ov={};function A0(e,t){let r={...iv,...t};const n=gT,i=mT,s=s5,{promisify:o}=o5,{resolve:a}=a5,c=!!/^https/.test(e);let u={method:r.method||"GET",headers:{"Accept-Encoding":"gzip, deflate, br"}};const l=A=>A.replace(/:| /g,"").toLowerCase();if(r.keepAlive){const A={keepAlive:!0,keepAliveMsecs:3e4,maxFreeSockets:1024,maxCachedSessions:1024},v=[c,c&&r.sslPinnedCertificates?.map(R=>l(R)).sort()].join();u.agent=ov[v]||(ov[v]=new(c?i:n).Agent(A))}r.type==="json"&&(u.headers["Content-Type"]="application/json"),r.data&&(r.method||(u.method="POST"),u.body=r.type==="json"?JSON.stringify(r.data):r.data),u.headers={...u.headers,...r.headers},r.sslAllowSelfSigned&&(u.rejectUnauthorized=!1);const y=async A=>{const v=A.statusCode;if(r.redirect&&300<=v&&v<400&&A.headers.location){if(r._redirectCount==10)throw new Error("Request failed. Too much redirects.");return r._redirectCount+=1,await A0(a(e,A.headers.location),r)}if(r.expectStatusCode&&v!==r.expectStatusCode)throw A.resume(),new S0(v);let R=[];for await(const F of A)R.push(F);let O=ie.Buffer.concat(R);const P=A.headers["content-encoding"];P==="br"&&(O=await o(s.brotliDecompress)(O)),(P==="gzip"||P==="deflate")&&(O=await o(s.unzip)(O));const H=sv(O,r.type);return r.full?{headers:A.headers,status:v,body:H}:H};return new Promise((A,v)=>{const R=async F=>{if(F&&F.code==="DEPTH_ZERO_SELF_SIGNED_CERT")try{await A0(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(N){N&&N.fingerprint256&&(F=new x0(`Self-signed SSL certificate: ${N.fingerprint256}`,N.fingerprint256))}v(F)},O=(c?i:n).request(e,u,F=>{F.on("error",R),(async()=>{try{A(await y(F))}catch(N){v(N)}})()});O.on("error",R);const P=r.sslPinnedCertificates?.map(F=>l(F)),H=F=>{const N=l(F.getPeerCertificate()?.fingerprint256||"");if(!(!N&&F.isSessionReused())&&!P.includes(N))return O.emit("error",new x0(`Invalid SSL certificate: ${N} Expected: ${P}`,N)),O.abort()};r.sslPinnedCertificates&&O.on("socket",F=>{F.listeners("secureConnect").map($=>($.name||"").replace("bound ","")).includes("mfetchSecureConnect")||F.on("secureConnect",H.bind(null,F))}),r.keepAlive&&O.setNoDelay(!0),u.body&&O.write(u.body),O.end()})}const c5=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(e=>e.toLowerCase())),f5=new Set(["Accept-Charset","Accept-Encoding","Access-Control-Request-Headers","Access-Control-Request-Method","Connection","Content-Length","Cookie","Cookie2","Date","DNT","Expect","Host","Keep-Alive","Origin","Referer","TE","Trailer","Transfer-Encoding","Upgrade","Via"].map(e=>e.toLowerCase()));async function u5(e,t){let r={...iv,...t};const n=new Headers;r.type==="json"&&n.set("Content-Type","application/json");let i=new URL(e);if(i.username){const c=btoa(`${i.username}:${i.password}`);n.set("Authorization",`Basic ${c}`),i.username="",i.password=""}e=""+i;for(let c in r.headers){const u=c.toLowerCase();(c5.has(u)||r.cors&&!f5.has(u))&&n.set(c,r.headers[c])}let s={headers:n,redirect:r.redirect?"follow":"manual"};r.referrer||(s.referrerPolicy="no-referrer"),r.cors&&(s.mode="cors"),r.data&&(r.method||(s.method="POST"),s.body=r.type==="json"?JSON.stringify(r.data):r.data);const o=await fetch(e,s);if(r.expectStatusCode&&o.status!==r.expectStatusCode)throw new S0(o.status);const a=sv(new Uint8Array(await o.arrayBuffer()),r.type);return r.full?{headers:Object.fromEntries(o.headers.entries()),status:o.status,body:a}:a}const l5=!!(typeof process=="object"&&process.versions&&process.versions.node&&process.versions.v8);function h5(e,t){return(l5?A0:u5)(e,t)}to.default=h5,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.getProvider=Qo.fetchFromProvider=void 0;const d5=to,p5=async(e,t)=>(await(0,d5.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;Qo.fetchFromProvider=p5;const g5=e=>{if(typeof e=="string")return e;if(e?.connection?.url!==void 0)return e.connection.url;throw new Error("Must provide valid provider URL or Web3Provider")};Qo.getProvider=g5,function(e){var t=ft&&ft.__createBinding||(Object.create?function(i,s,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(s,o);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,a,c)}:function(i,s,o,a){a===void 0&&(a=o),i[a]=s[o]}),r=ft&&ft.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.toAscii=e.stripHexPrefix=e.padToEven=e.isHexString=e.isHexPrefixed=e.getKeys=e.getBinarySize=e.fromUtf8=e.fromAscii=e.arrayContainsArray=void 0,r(Jf,e),r(ou,e),r(nd,e),r(rc,e),r(hu,e),r(an,e),r(eo,e),r(ld,e),r(rw,e),r(gu,e);var n=er;Object.defineProperty(e,"arrayContainsArray",{enumerable:!0,get:function(){return n.arrayContainsArray}}),Object.defineProperty(e,"fromAscii",{enumerable:!0,get:function(){return n.fromAscii}}),Object.defineProperty(e,"fromUtf8",{enumerable:!0,get:function(){return n.fromUtf8}}),Object.defineProperty(e,"getBinarySize",{enumerable:!0,get:function(){return n.getBinarySize}}),Object.defineProperty(e,"getKeys",{enumerable:!0,get:function(){return n.getKeys}}),Object.defineProperty(e,"isHexPrefixed",{enumerable:!0,get:function(){return n.isHexPrefixed}}),Object.defineProperty(e,"isHexString",{enumerable:!0,get:function(){return n.isHexString}}),Object.defineProperty(e,"padToEven",{enumerable:!0,get:function(){return n.padToEven}}),Object.defineProperty(e,"stripHexPrefix",{enumerable:!0,get:function(){return n.stripHexPrefix}}),Object.defineProperty(e,"toAscii",{enumerable:!0,get:function(){return n.toAscii}}),r(yu,e),r(Qo,e)}(Xf);var Qr={},oe={},da={},Rt={},Jn={},Os={},dn={};Object.defineProperty(dn,"__esModule",{value:!0});function y5(e,t){return e??t()}function w5(e){return Array.isArray(e)&&e.length>0}function m5(e){return e==null}function b5(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}var v5=(e,t)=>Object.hasOwnProperty.call(e,t);function _5(e){return Object.getOwnPropertyNames(e)}var av=(e=>(e[e.Null=4]="Null",e[e.Comma=1]="Comma",e[e.Wrapper=1]="Wrapper",e[e.True=4]="True",e[e.False=5]="False",e[e.Quote=1]="Quote",e[e.Colon=1]="Colon",e[e.Date=24]="Date",e))(av||{}),cv=/"|\\|\n|\r|\t/gu;function E5(e){if(typeof e!="object"||e===null)return!1;try{let t=e;for(;Object.getPrototypeOf(t)!==null;)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}catch{return!1}}function fv(e){return e.charCodeAt(0)<=127}function x5(e){return e.split("").reduce((r,n)=>fv(n)?r+1:r+2,0)+y5(e.match(cv),()=>[]).length}function S5(e){return e.toString().length}dn.isNonEmptyArray=w5,dn.isNullOrUndefined=m5,dn.isObject=b5,dn.hasProperty=v5,dn.getKnownPropertyNames=_5,dn.JsonSize=av,dn.ESCAPE_CHARACTERS_REGEXP=cv,dn.isPlainObject=E5,dn.isASCII=fv,dn.calculateStringSize=x5,dn.calculateNumberSize=S5;class B0 extends Error{constructor(t,{cause:r}={}){super(t),this.name=B0.name,r&&(this.cause=r),this.message=t}}var A5=Object.freeze({__proto__:null,ErrorWithCause:B0}),B5=Un(A5);const I5=(e,t)=>{if(!e||!t||!(e instanceof Error)||!(t.prototype instanceof Error)&&t!==Error)return;const r=new Set;let n=e;for(;n&&!r.has(n);){if(r.add(n),n instanceof t)return n;n=Zu(n)}},Zu=e=>{if(!(!e||typeof e!="object"||!("cause"in e)))if(typeof e.cause=="function"){const t=e.cause();return t instanceof Error?t:void 0}else return e.cause instanceof Error?e.cause:void 0},uv=(e,t)=>{if(!(e instanceof Error))return"";const r=e.stack||"";if(t.has(e))return r+` +causes have become circular...`;const n=Zu(e);return n?(t.add(e),r+` +caused by: `+uv(n,t)):r},R5=e=>uv(e,new Set),lv=(e,t,r)=>{if(!(e instanceof Error))return"";const n=r?"":e.message||"";if(t.has(e))return n+": ...";const i=Zu(e);if(i){t.add(e);const s="cause"in e&&typeof e.cause=="function";return n+(s?"":": ")+lv(i,t,s)}else return n};var T5=Object.freeze({__proto__:null,findCauseByReference:I5,getErrorCause:Zu,stackWithCauses:R5,messageWithCauses:e=>lv(e,new Set)}),k5=Un(T5);const{ErrorWithCause:C5}=B5,{findCauseByReference:L5,getErrorCause:$5,messageWithCauses:O5,stackWithCauses:M5}=k5;var N5={ErrorWithCause:C5,findCauseByReference:L5,getErrorCause:$5,stackWithCauses:M5,messageWithCauses:O5};Object.defineProperty(Os,"__esModule",{value:!0});var hv=dn,P5=N5;function U5(e){return e instanceof Error||hv.isObject.call(void 0,e)&&e.constructor.name==="Error"}function dv(e){return typeof e=="object"&&e!==null&&"code"in e}function pv(e){return typeof e=="object"&&e!==null&&"message"in e}function F5(e){return typeof e=="object"&&e!==null&&"stack"in e}function D5(e){return pv(e)&&typeof e.message=="string"?e.message:hv.isNullOrUndefined.call(void 0,e)?"":String(e)}function H5(e,t){if(U5(e)){let r;return Error.length===2?r=new Error(t,{cause:e}):r=new P5.ErrorWithCause(t,{cause:e}),dv(e)&&(r.code=e.code),r}return t.length>0?new Error(`${String(e)}: ${t}`):new Error(String(e))}Os.isErrorWithCode=dv,Os.isErrorWithMessage=pv,Os.isErrorWithStack=F5,Os.getErrorMessage=D5,Os.wrapError=H5;class gv extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function j5(e){return Qn(e)&&typeof e[Symbol.iterator]=="function"}function Qn(e){return typeof e=="object"&&e!=null}function yv(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Or(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function z5(e){const{done:t,value:r}=e.next();return t?void 0:r}function q5(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${Or(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*I0(e,t,r,n){j5(e)||(e=[e]);for(const i of e){const s=q5(i,t,r,n);s&&(yield s)}}function*R0(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&Qn(t.schema)&&Qn(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let c="valid";for(const u of t.validator(e,a))u.explanation=r.message,c="not_valid",yield[u,void 0];for(let[u,l,y]of t.entries(e,a)){const A=R0(l,y,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const v of A)v[0]?(c=v[0].refinement!=null?"not_refined":"not_valid",yield[v[0],void 0]):s&&(l=v[1],u===void 0?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):Qn(e)&&(l!==void 0||u in e)&&(e[u]=l))}if(c!=="not_valid")for(const u of t.refiner(e,a))u.explanation=r.message,c="not_refined",yield[u,void 0];c==="valid"&&(yield[void 0,e])}class Br{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return I0(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return I0(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return wv(t,this,r)}create(t,r){return mv(t,this,r)}is(t){return T0(t,this)}mask(t,r){return bv(t,this,r)}validate(t,r={}){return pa(t,this,r)}}function wv(e,t,r){const n=pa(e,t,{message:r});if(n[0])throw n[0]}function mv(e,t,r){const n=pa(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function bv(e,t,r){const n=pa(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function T0(e,t){return!pa(e,t)[0]}function pa(e,t,r={}){const n=R0(e,t,r),i=z5(n);return i[0]?[new gv(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function V5(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?kc(n):Tc(n)}function xn(e,t){return new Br({type:e,schema:null,validator:t})}function W5(e,t){return new Br({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function K5(e){return new Br({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function Z5(e){let t;return new Br({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function G5(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return kc(n);default:return Tc(n)}}function Y5(e){const t=e instanceof Br,r=t?{...e.schema}:{...e};for(const n in r)r[n]=vv(r[n]);return t&&e.type==="type"?kc(r):Tc(r)}function X5(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return kc(n);default:return Tc(n)}}function J5(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),xn(e,t)}function Q5(){return xn("any",()=>!0)}function ek(e){return new Br({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Or(t)}`}})}function tk(){return xn("bigint",e=>typeof e=="bigint")}function rk(){return xn("boolean",e=>typeof e=="boolean")}function nk(){return xn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Or(e)}`)}function ik(e){const t={},r=e.map(n=>Or(n)).join();for(const n of e)t[n]=n;return new Br({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${Or(n)}`}})}function sk(){return xn("func",e=>typeof e=="function"||`Expected a function, but received: ${Or(e)}`)}function ok(e){return xn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Or(t)}`)}function ak(){return xn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Or(e)}`)}function ck(e){return new Br({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function fk(e){const t=Or(e),r=typeof e;return new Br({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${Or(n)}`}})}function uk(e,t){return new Br({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Or(r)}`}})}function k0(){return xn("never",()=>!1)}function lk(e){return new Br({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function hk(){return xn("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${Or(e)}`)}function Tc(e){const t=e?Object.keys(e):[],r=k0();return new Br({type:"object",schema:e||null,*entries(n){if(e&&Qn(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return Qn(n)||`Expected an object, but received: ${Or(n)}`},coercer(n){return Qn(n)?{...n}:n}})}function vv(e){return new Br({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function dk(e,t){return new Br({type:"record",schema:null,*entries(r){if(Qn(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return Qn(r)||`Expected an object, but received: ${Or(r)}`}})}function pk(){return xn("regexp",e=>e instanceof RegExp)}function gk(e){return new Br({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${Or(t)}`}})}function _v(){return xn("string",e=>typeof e=="string"||`Expected a string, but received: ${Or(e)}`)}function yk(e){const t=k0();return new Br({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new Br({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=R0(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Or(r)}`,...i]}})}function Ev(){return xn("unknown",()=>!0)}function C0(e,t,r){return new Br({...e,coercer:(n,i)=>T0(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function mk(e,t,r={}){return C0(e,Ev(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&yv(n)&&yv(i)){const s={...n};let o=!1;for(const a in i)s[a]===void 0&&(s[a]=i[a],o=!0);if(o)return s}return n})}function bk(e){return C0(e,_v(),t=>t.trim())}function vk(e){return mo(e,"empty",t=>{const r=xv(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function xv(e){return e instanceof Map||e instanceof Set?e.size:e.length}function _k(e,t,r={}){const{exclusive:n}=r;return mo(e,"max",i=>n?in?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function xk(e){return mo(e,"nonempty",t=>xv(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function Sk(e,t){return mo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function Ak(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return mo(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:o}=s;return t<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}else{const{length:o}=s;return t<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}})}function mo(e,t,r){return new Br({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),o=I0(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var Bk=Object.freeze({__proto__:null,Struct:Br,StructError:gv,any:Q5,array:ek,assert:wv,assign:V5,bigint:tk,boolean:rk,coerce:C0,create:mv,date:nk,defaulted:mk,define:xn,deprecated:W5,dynamic:K5,empty:vk,enums:ik,func:sk,instance:ok,integer:ak,intersection:ck,is:T0,lazy:Z5,literal:fk,map:uk,mask:bv,max:_k,min:Ek,never:k0,nonempty:xk,nullable:lk,number:hk,object:Tc,omit:G5,optional:vv,partial:Y5,pattern:Sk,pick:X5,record:dk,refine:mo,regexp:pk,set:gk,size:Ak,string:_v,struct:J5,trimmed:bk,tuple:yk,type:kc,union:wk,unknown:Ev,validate:pa}),Ms=Un(Bk);Object.defineProperty(Jn,"__esModule",{value:!0});function Ik(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var Rk=Os,Tk=Ms;function kk(e){return typeof Ik([e,"optionalAccess",t=>t.prototype,"optionalAccess",t=>t.constructor,"optionalAccess",t=>t.name])=="string"}function Ck(e){return Rk.getErrorMessage.call(void 0,e).replace(/\.$/u,"")}function Sv(e,t){return kk(e)?new e({message:t}):e({message:t})}var L0=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function Lk(e,t="Assertion failed.",r=L0){if(!e)throw t instanceof Error?t:Sv(r,t)}function $k(e,t,r="Assertion failed",n=L0){try{Tk.assert.call(void 0,e,t)}catch(i){throw Sv(n,`${r}: ${Ck(i)}.`)}}function Ok(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Jn.AssertionError=L0,Jn.assert=Lk,Jn.assertStruct=$k,Jn.assertExhaustive=Ok;var tr={},Wr={};Object.defineProperty(Wr,"__esModule",{value:!0}),Wr.output=Wr.exists=Wr.hash=Wr.bytes=Wr.bool=Wr.number=Wr.isBytes=void 0;function Gu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}Wr.number=Gu;function Av(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}Wr.bool=Av;function Bv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}Wr.isBytes=Bv;function $0(e,...t){if(!Bv(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}Wr.bytes=$0;function Iv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Gu(e.outputLen),Gu(e.blockLen)}Wr.hash=Iv;function Rv(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}Wr.exists=Rv;function Tv(e,t){$0(e);const r=t.outputLen;if(e.length>O0&Yu)}:{h:Number(e>>O0&Yu)|0,l:Number(e&Yu)|0}}at.fromBig=M0;function kv(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);at.toBig=Cv;const Lv=(e,t,r)=>e>>>r;at.shrSH=Lv;const $v=(e,t,r)=>e<<32-r|t>>>r;at.shrSL=$v;const Ov=(e,t,r)=>e>>>r|t<<32-r;at.rotrSH=Ov;const Mv=(e,t,r)=>e<<32-r|t>>>r;at.rotrSL=Mv;const Nv=(e,t,r)=>e<<64-r|t>>>r-32;at.rotrBH=Nv;const Pv=(e,t,r)=>e>>>r-32|t<<64-r;at.rotrBL=Pv;const Uv=(e,t)=>t;at.rotr32H=Uv;const Fv=(e,t)=>e;at.rotr32L=Fv;const Dv=(e,t,r)=>e<>>32-r;at.rotlSH=Dv;const Hv=(e,t,r)=>t<>>32-r;at.rotlSL=Hv;const jv=(e,t,r)=>t<>>64-r;at.rotlBH=jv;const zv=(e,t,r)=>e<>>64-r;at.rotlBL=zv;function qv(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}at.add=qv;const Vv=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);at.add3L=Vv;const Wv=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;at.add3H=Wv;const Kv=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);at.add4L=Kv;const Zv=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;at.add4H=Zv;const Gv=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);at.add5L=Gv;const Yv=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;at.add5H=Yv;const Nk={fromBig:M0,split:kv,toBig:Cv,shrSH:Lv,shrSL:$v,rotrSH:Ov,rotrSL:Mv,rotrBH:Nv,rotrBL:Pv,rotr32H:Uv,rotr32L:Fv,rotlSH:Dv,rotlSL:Hv,rotlBH:jv,rotlBL:zv,add:qv,add3L:Vv,add3H:Wv,add4L:Kv,add4H:Zv,add5H:Yv,add5L:Gv};at.default=Nk;var Xv={},Xu={};Object.defineProperty(Xu,"__esModule",{value:!0}),Xu.crypto=void 0,Xu.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0,function(e){/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.randomBytes=e.wrapXOFConstructorWithOpts=e.wrapConstructorWithOpts=e.wrapConstructor=e.checkOpts=e.Hash=e.concatBytes=e.toBytes=e.utf8ToBytes=e.asyncLoop=e.nextTick=e.hexToBytes=e.bytesToHex=e.byteSwap32=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=e.isBytes=void 0;const t=Xu,r=Wr;function n(I){return I instanceof Uint8Array||I!=null&&typeof I=="object"&&I.constructor.name==="Uint8Array"}e.isBytes=n;const i=I=>new Uint8Array(I.buffer,I.byteOffset,I.byteLength);e.u8=i;const s=I=>new Uint32Array(I.buffer,I.byteOffset,Math.floor(I.byteLength/4));e.u32=s;const o=I=>new DataView(I.buffer,I.byteOffset,I.byteLength);e.createView=o;const a=(I,g)=>I<<32-g|I>>>g;e.rotr=a;const c=(I,g)=>I<>>32-g>>>0;e.rotl=c,e.isLE=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;const u=I=>I<<24&4278190080|I<<8&16711680|I>>>8&65280|I>>>24&255;e.byteSwap=u,e.byteSwapIfBE=e.isLE?I=>I:I=>(0,e.byteSwap)(I);function l(I){for(let g=0;gg.toString(16).padStart(2,"0"));function A(I){(0,r.bytes)(I);let g="";for(let f=0;f=v._0&&I<=v._9)return I-v._0;if(I>=v._A&&I<=v._F)return I-(v._A-10);if(I>=v._a&&I<=v._f)return I-(v._a-10)}function O(I){if(typeof I!="string")throw new Error("hex string expected, got "+typeof I);const g=I.length,f=g/2;if(g%2)throw new Error("padded hex string expected, got unpadded hex of length "+g);const h=new Uint8Array(f);for(let m=0,_=0;m{};e.nextTick=P;async function H(I,g,f){let h=Date.now();for(let m=0;m=0&&_I().update(N(h)).digest(),f=I();return g.outputLen=f.outputLen,g.blockLen=f.blockLen,g.create=()=>I(),g}e.wrapConstructor=z;function ee(I){const g=(h,m)=>I(m).update(N(h)).digest(),f=I({});return g.outputLen=f.outputLen,g.blockLen=f.blockLen,g.create=h=>I(h),g}e.wrapConstructorWithOpts=ee;function se(I){const g=(h,m)=>I(m).update(N(h)).digest(),f=I({});return g.outputLen=f.outputLen,g.blockLen=f.blockLen,g.create=h=>I(h),g}e.wrapXOFConstructorWithOpts=se;function Q(I=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(I));throw new Error("crypto.getRandomValues must be defined")}e.randomBytes=Q}(Xv),Object.defineProperty(tr,"__esModule",{value:!0}),tr.shake256=tr.shake128=tr.keccak_512=tr.keccak_384=tr.keccak_256=tr.keccak_224=tr.sha3_512=tr.sha3_384=tr.sha3_256=tr.sha3_224=tr.Keccak=tr.keccakP=void 0;const ga=Wr,Cc=at,Zi=Xv,Jv=[],Qv=[],e_=[],Pk=BigInt(0),Lc=BigInt(1),Uk=BigInt(2),Fk=BigInt(7),Dk=BigInt(256),Hk=BigInt(113);for(let e=0,t=Lc,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Jv.push(2*(5*n+r)),Qv.push((e+1)*(e+2)/2%64);let i=Pk;for(let s=0;s<7;s++)t=(t<>Fk)*Hk)%Dk,t&Uk&&(i^=Lc<<(Lc<r>32?(0,Cc.rotlBH)(e,t,r):(0,Cc.rotlSH)(e,t,r),r_=(e,t,r)=>r>32?(0,Cc.rotlBL)(e,t,r):(0,Cc.rotlSL)(e,t,r);function n_(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)r[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,u=r[c],l=r[c+1],y=t_(u,l,1)^r[a],A=r_(u,l,1)^r[a+1];for(let v=0;v<50;v+=10)e[o+v]^=y,e[o+v+1]^=A}let i=e[2],s=e[3];for(let o=0;o<24;o++){const a=Qv[o],c=t_(i,s,a),u=r_(i,s,a),l=Jv[o];i=e[l],s=e[l+1],e[l]=c,e[l+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)r[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~r[(a+2)%10]&r[(a+4)%10]}e[0]^=jk[n],e[1]^=zk[n]}r.fill(0)}tr.keccakP=n_;class $c extends Zi.Hash{constructor(t,r,n,i=!1,s=24){if(super(),this.blockLen=t,this.suffix=r,this.outputLen=n,this.enableXOF=i,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,ga.number)(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Zi.u32)(this.state)}keccak(){Zi.isLE||(0,Zi.byteSwap32)(this.state32),n_(this.state32,this.rounds),Zi.isLE||(0,Zi.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(t){(0,ga.exists)(this);const{blockLen:r,state:n}=this;t=(0,Zi.toBytes)(t);const i=t.length;for(let s=0;s=n&&this.keccak();const o=Math.min(n-this.posOut,s-i);t.set(r.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return(0,ga.number)(t),this.xofInto(new Uint8Array(t))}digestInto(t){if((0,ga.output)(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new $c(r,n,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}tr.Keccak=$c;const Ns=(e,t,r)=>(0,Zi.wrapConstructor)(()=>new $c(t,e,r));tr.sha3_224=Ns(6,144,224/8),tr.sha3_256=Ns(6,136,256/8),tr.sha3_384=Ns(6,104,384/8),tr.sha3_512=Ns(6,72,512/8),tr.keccak_224=Ns(1,144,224/8),tr.keccak_256=Ns(1,136,256/8),tr.keccak_384=Ns(1,104,384/8),tr.keccak_512=Ns(1,72,512/8);const i_=(e,t,r)=>(0,Zi.wrapXOFConstructorWithOpts)((n={})=>new $c(t,e,n.dkLen===void 0?r:n.dkLen,!0));tr.shake128=i_(31,168,128/8),tr.shake256=i_(31,136,256/8);var N0={};(function(e){/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */Object.defineProperty(e,"__esModule",{value:!0}),e.bytes=e.stringToBytes=e.str=e.bytesToString=e.hex=e.utf8=e.bech32m=e.bech32=e.base58check=e.createBase58check=e.base58xmr=e.base58xrp=e.base58flickr=e.base58=e.base64urlnopad=e.base64url=e.base64nopad=e.base64=e.base32crockford=e.base32hex=e.base32=e.base16=e.utils=e.assertNumber=void 0;function t(I){if(!Number.isSafeInteger(I))throw new Error(`Wrong integer: ${I}`)}e.assertNumber=t;function r(I){return I instanceof Uint8Array||I!=null&&typeof I=="object"&&I.constructor.name==="Uint8Array"}function n(...I){const g=_=>_,f=(_,E)=>x=>_(E(x)),h=I.map(_=>_.encode).reduceRight(f,g),m=I.map(_=>_.decode).reduce(f,g);return{encode:h,decode:m}}function i(I){return{encode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return g.map(f=>{if(t(f),f<0||f>=I.length)throw new Error(`Digit index outside alphabet: ${f} (alphabet: ${I.length})`);return I[f]})},decode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="string")throw new Error("alphabet.decode input should be array of strings");return g.map(f=>{if(typeof f!="string")throw new Error(`alphabet.decode: not string element=${f}`);const h=I.indexOf(f);if(h===-1)throw new Error(`Unknown letter: "${f}". Allowed: ${I}`);return h})}}}function s(I=""){if(typeof I!="string")throw new Error("join separator should be string");return{encode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="string")throw new Error("join.encode input should be array of strings");for(let f of g)if(typeof f!="string")throw new Error(`join.encode: non-string input=${f}`);return g.join(I)},decode:g=>{if(typeof g!="string")throw new Error("join.decode input should be string");return g.split(I)}}}function o(I,g="="){if(t(I),typeof g!="string")throw new Error("padding chr should be string");return{encode(f){if(!Array.isArray(f)||f.length&&typeof f[0]!="string")throw new Error("padding.encode input should be array of strings");for(let h of f)if(typeof h!="string")throw new Error(`padding.encode: non-string input=${h}`);for(;f.length*I%8;)f.push(g);return f},decode(f){if(!Array.isArray(f)||f.length&&typeof f[0]!="string")throw new Error("padding.encode input should be array of strings");for(let m of f)if(typeof m!="string")throw new Error(`padding.decode: non-string input=${m}`);let h=f.length;if(h*I%8)throw new Error("Invalid padding: string should have whole number of bytes");for(;h>0&&f[h-1]===g;h--)if(!((h-1)*I%8))throw new Error("Invalid padding: string has too much padding");return f.slice(0,h)}}}function a(I){if(typeof I!="function")throw new Error("normalize fn should be function");return{encode:g=>g,decode:g=>I(g)}}function c(I,g,f){if(g<2)throw new Error(`convertRadix: wrong from=${g}, base cannot be less than 2`);if(f<2)throw new Error(`convertRadix: wrong to=${f}, base cannot be less than 2`);if(!Array.isArray(I))throw new Error("convertRadix: data should be array");if(!I.length)return[];let h=0;const m=[],_=Array.from(I);for(_.forEach(E=>{if(t(E),E<0||E>=g)throw new Error(`Wrong integer: ${E}`)});;){let E=0,x=!0;for(let T=h;T<_.length;T++){const B=_[T],d=g*E+B;if(!Number.isSafeInteger(d)||g*E/g!==E||d-B!==g*E)throw new Error("convertRadix: carry overflow");E=d%f;const k=Math.floor(d/f);if(_[T]=k,!Number.isSafeInteger(k)||k*f+E!==d)throw new Error("convertRadix: carry overflow");if(x)k?x=!1:h=T;else continue}if(m.push(E),x)break}for(let E=0;Eg?u(g,I%g):I,l=(I,g)=>I+(g-u(I,g));function y(I,g,f,h){if(!Array.isArray(I))throw new Error("convertRadix2: data should be array");if(g<=0||g>32)throw new Error(`convertRadix2: wrong from=${g}`);if(f<=0||f>32)throw new Error(`convertRadix2: wrong to=${f}`);if(l(g,f)>32)throw new Error(`convertRadix2: carry overflow from=${g} to=${f} carryBits=${l(g,f)}`);let m=0,_=0;const E=2**f-1,x=[];for(const T of I){if(t(T),T>=2**g)throw new Error(`convertRadix2: invalid data word=${T} from=${g}`);if(m=m<32)throw new Error(`convertRadix2: carry overflow pos=${_} from=${g}`);for(_+=g;_>=f;_-=f)x.push((m>>_-f&E)>>>0);m&=2**_-1}if(m=m<=g)throw new Error("Excess padding");if(!h&&m)throw new Error(`Non-zero padding: ${m}`);return h&&_>0&&x.push(m>>>0),x}function A(I){return t(I),{encode:g=>{if(!r(g))throw new Error("radix.encode input should be Uint8Array");return c(Array.from(g),2**8,I)},decode:g=>{if(!Array.isArray(g)||g.length&&typeof g[0]!="number")throw new Error("radix.decode input should be array of numbers");return Uint8Array.from(c(g,I,2**8))}}}function v(I,g=!1){if(t(I),I<=0||I>32)throw new Error("radix2: bits should be in (0..32]");if(l(8,I)>32||l(I,8)>32)throw new Error("radix2: carry overflow");return{encode:f=>{if(!r(f))throw new Error("radix2.encode input should be Uint8Array");return y(Array.from(f),8,I,!g)},decode:f=>{if(!Array.isArray(f)||f.length&&typeof f[0]!="number")throw new Error("radix2.decode input should be array of numbers");return Uint8Array.from(y(f,I,8,g))}}}function R(I){if(typeof I!="function")throw new Error("unsafeWrapper fn should be function");return function(...g){try{return I.apply(null,g)}catch{}}}function O(I,g){if(t(I),typeof g!="function")throw new Error("checksum fn should be function");return{encode(f){if(!r(f))throw new Error("checksum.encode: input should be Uint8Array");const h=g(f).slice(0,I),m=new Uint8Array(f.length+I);return m.set(f),m.set(h,f.length),m},decode(f){if(!r(f))throw new Error("checksum.decode: input should be Uint8Array");const h=f.slice(0,-I),m=g(h).slice(0,I),_=f.slice(-I);for(let E=0;EI.toUpperCase().replace(/O/g,"0").replace(/[IL]/g,"1"))),e.base64=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),o(6),s("")),e.base64nopad=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),s("")),e.base64url=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),o(6),s("")),e.base64urlnopad=n(v(6),i("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),s(""));const P=I=>n(A(58),i(I),s(""));e.base58=P("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"),e.base58flickr=P("123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"),e.base58xrp=P("rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz");const H=[0,2,3,5,6,7,9,10,11];e.base58xmr={encode(I){let g="";for(let f=0;fn(O(4,g=>I(I(g))),e.base58);e.createBase58check=F,e.base58check=e.createBase58check;const N=n(i("qpzry9x8gf2tvdw0s3jn54khce6mua7l"),s("")),$=[996825010,642813549,513874426,1027748829,705979059];function q(I){const g=I>>25;let f=(I&33554431)<<5;for(let h=0;h<$.length;h++)(g>>h&1)===1&&(f^=$[h]);return f}function G(I,g,f=1){const h=I.length;let m=1;for(let _=0;_126)throw new Error(`Invalid prefix (${I})`);m=q(m)^E>>5}m=q(m);for(let _=0;_W)throw new TypeError(`Length ${K} exceeds limit ${W}`);const re=d.toLowerCase(),xe=G(re,k,g);return`${re}1${N.encode(k)}${xe}`}function x(d,k=90){if(typeof d!="string")throw new Error(`bech32.decode input should be string, not ${typeof d}`);if(d.length<8||k!==!1&&d.length>k)throw new TypeError(`Wrong string length: ${d.length} (${d}). Expected (8..${k})`);const W=d.toLowerCase();if(d!==W&&d!==d.toUpperCase())throw new Error("String must be lowercase or uppercase");const K=W.lastIndexOf("1");if(K===0||K===-1)throw new Error('Letter "1" must be present between prefix and data only');const re=W.slice(0,K),xe=W.slice(K+1);if(xe.length<6)throw new Error("Data must be at least 6 characters long");const be=N.decode(xe).slice(0,-6),ge=G(re,be,g);if(!xe.endsWith(ge))throw new Error(`Invalid checksum in ${d}: expected "${ge}"`);return{prefix:re,words:be}}const T=R(x);function B(d){const{prefix:k,words:W}=x(d,!1);return{prefix:k,words:W,bytes:h(W)}}return{encode:E,decode:x,decodeToBytes:B,decodeUnsafe:T,fromWords:h,fromWordsUnsafe:_,toWords:m}}e.bech32=Z("bech32"),e.bech32m=Z("bech32m"),e.utf8={encode:I=>new TextDecoder().decode(I),decode:I=>new TextEncoder().encode(I)},e.hex=n(v(4),i("0123456789abcdef"),s(""),a(I=>{if(typeof I!="string"||I.length%2)throw new TypeError(`hex.decode: expected string, got ${typeof I} with length ${I.length}`);return I.toLowerCase()}));const z={utf8:e.utf8,hex:e.hex,base16:e.base16,base32:e.base32,base64:e.base64,base64url:e.base64url,base58:e.base58,base58xmr:e.base58xmr},ee="Invalid encoding type. Available types: utf8, hex, base16, base32, base64, base64url, base58, base58xmr",se=(I,g)=>{if(typeof I!="string"||!z.hasOwnProperty(I))throw new TypeError(ee);if(!r(g))throw new TypeError("bytesToString() expects Uint8Array");return z[I].encode(g)};e.bytesToString=se,e.str=e.bytesToString;const Q=(I,g)=>{if(!z.hasOwnProperty(I))throw new TypeError(ee);if(typeof g!="string")throw new TypeError("stringToBytes() expects string");return z[I].decode(g)};e.stringToBytes=Q,e.bytes=e.stringToBytes})(N0),Object.defineProperty(Rt,"__esModule",{value:!0});function qk(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var Kr=Jn,Vk=tr,pn=Ms,s_=N0,o_=48,a_=58,c_=87;function Wk(){const e=[];return()=>{if(e.length===0)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}var Kk=Wk();function P0(e){return e instanceof Uint8Array}function bo(e){Kr.assert.call(void 0,P0(e),"Value must be a Uint8Array.")}function U0(e){if(bo(e),e.length===0)return"0x";const t=Kk(),r=new Array(e.length);for(let n=0;ni.toLowerCase,"optionalCall",i=>i()])==="0x")return new Uint8Array;b_(e);const t=Qu(e).toLowerCase(),r=t.length%2===0?t:`0${t}`,n=new Uint8Array(r.length/2);for(let i=0;i=BigInt(0),"Value must be a non-negative bigint.");const t=e.toString(16);return Ju(t)}function Jk(e,t){Kr.assert.call(void 0,t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function Qk(e,t){Kr.assert.call(void 0,typeof e=="bigint","Value must be a bigint."),Kr.assert.call(void 0,typeof t=="number","Byte length must be a number."),Kr.assert.call(void 0,t>0,"Byte length must be greater than 0."),Kr.assert.call(void 0,Jk(e,t),"Byte length is too small to represent the given value.");let r=e;const n=new Uint8Array(t);for(let i=0;i>=BigInt(8);return n.reverse()}function l_(e){Kr.assert.call(void 0,typeof e=="number","Value must be a number."),Kr.assert.call(void 0,e>=0,"Value must be a non-negative number."),Kr.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");const t=e.toString(16);return Ju(t)}function h_(e){return Kr.assert.call(void 0,typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}function eC(e){return Kr.assert.call(void 0,typeof e=="string","Value must be a string."),s_.base64.decode(e)}function d_(e){if(typeof e=="bigint")return u_(e);if(typeof e=="number")return l_(e);if(typeof e=="string")return e.startsWith("0x")?Ju(e):h_(e);if(P0(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}function tC(e){const t=new Array(e.length);let r=0;for(let i=0;i{const s=r[i];return Kr.assert.call(void 0,pn.is.call(void 0,s,pn.string.call(void 0)),"Hash shorter than address."),parseInt(s,16)>7?n.toUpperCase():n}).join("")}`}function __(e){return pn.is.call(void 0,e,F0)?v_(e)===e:!1}function E_(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function Qu(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}Rt.HexStruct=p_,Rt.StrictHexStruct=g_,Rt.HexAddressStruct=y_,Rt.HexChecksumAddressStruct=F0,Rt.isHexString=w_,Rt.isStrictHexString=m_,Rt.assertIsHexString=b_,Rt.assertIsStrictHexString=nC,Rt.isValidHexAddress=iC,Rt.getChecksumAddress=v_,Rt.isValidChecksumAddress=__,Rt.add0x=E_,Rt.remove0x=Qu,Rt.isBytes=P0,Rt.assertIsBytes=bo,Rt.bytesToHex=U0,Rt.bytesToBigInt=f_,Rt.bytesToSignedBigInt=Zk,Rt.bytesToNumber=Gk,Rt.bytesToString=Yk,Rt.bytesToBase64=Xk,Rt.hexToBytes=Ju,Rt.bigIntToBytes=u_,Rt.signedBigIntToBytes=Qk,Rt.numberToBytes=l_,Rt.stringToBytes=h_,Rt.base64ToBytes=eC,Rt.valueToBytes=d_,Rt.concatBytes=tC,Rt.createDataView=rC,Object.defineProperty(da,"__esModule",{value:!0});var Oc=Rt,ya=Jn,sC=e=>(ya.assert.call(void 0,typeof e=="number","Value must be a number."),ya.assert.call(void 0,e>=0,"Value must be a non-negative number."),ya.assert.call(void 0,Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),Oc.add0x.call(void 0,e.toString(16))),oC=e=>(ya.assert.call(void 0,typeof e=="bigint","Value must be a bigint."),ya.assert.call(void 0,e>=0,"Value must be a non-negative bigint."),Oc.add0x.call(void 0,e.toString(16))),aC=e=>{Oc.assertIsHexString.call(void 0,e);const t=parseInt(e,16);return ya.assert.call(void 0,Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t},cC=e=>(Oc.assertIsHexString.call(void 0,e),BigInt(Oc.add0x.call(void 0,e)));da.numberToHex=sC,da.bigIntToHex=oC,da.hexToNumber=aC,da.hexToBigInt=cC;var D0={};Object.defineProperty(D0,"__esModule",{value:!0});function fC({suppressUnhandledRejection:e=!1}={}){let t,r;const n=new Promise((i,s)=>{t=i,r=s});return e&&n.catch(i=>{}),{promise:n,resolve:t,reject:r}}D0.createDeferredPromise=fC;var Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});var x_=(e=>(e[e.Millisecond=1]="Millisecond",e[e.Second=1e3]="Second",e[e.Minute=6e4]="Minute",e[e.Hour=36e5]="Hour",e[e.Day=864e5]="Day",e[e.Week=6048e5]="Week",e[e.Year=31536e6]="Year",e))(x_||{}),uC=e=>Number.isInteger(e)&&e>=0,S_=(e,t)=>{if(!uC(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};function lC(e,t){return S_(e,"count"),e*t}function hC(e){return S_(e,"timestamp"),Date.now()-e}Mc.Duration=x_,Mc.inMilliseconds=lC,Mc.timeSince=hC;var ai={},vo={exports:{}};const dC="2.0.0",A_=256,pC=Number.MAX_SAFE_INTEGER||9007199254740991,gC=16,yC=A_-6;var el={MAX_LENGTH:A_,MAX_SAFE_COMPONENT_LENGTH:gC,MAX_SAFE_BUILD_LENGTH:yC,MAX_SAFE_INTEGER:pC,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:dC,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},tl=typeof process=="object"&&process.env&&process.env.NODE_DEBUG&&/\bsemver\b/i.test(process.env.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:i}=el,s=tl;t=e.exports={};const o=t.re=[],a=t.safeRe=[],c=t.src=[],u=t.t={};let l=0;const y="[a-zA-Z0-9-]",A=[["\\s",1],["\\d",i],[y,n]],v=O=>{for(const[P,H]of A)O=O.split(`${P}*`).join(`${P}{0,${H}}`).split(`${P}+`).join(`${P}{1,${H}}`);return O},R=(O,P,H)=>{const F=v(P),N=l++;s(O,N,P),u[O]=N,c[N]=P,o[N]=new RegExp(P,H?"g":void 0),a[N]=new RegExp(F,H?"g":void 0)};R("NUMERICIDENTIFIER","0|[1-9]\\d*"),R("NUMERICIDENTIFIERLOOSE","\\d+"),R("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${y}*`),R("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),R("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),R("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),R("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),R("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),R("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),R("BUILDIDENTIFIER",`${y}+`),R("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),R("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),R("FULL",`^${c[u.FULLPLAIN]}$`),R("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),R("LOOSE",`^${c[u.LOOSEPLAIN]}$`),R("GTLT","((?:<|>)?=?)"),R("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),R("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),R("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),R("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),R("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),R("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),R("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),R("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),R("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?(?:${c[u.BUILD]})?(?:$|[^\\d])`),R("COERCERTL",c[u.COERCE],!0),R("COERCERTLFULL",c[u.COERCEFULL],!0),R("LONETILDE","(?:~>?)"),R("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",R("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),R("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),R("LONECARET","(?:\\^)"),R("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",R("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),R("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),R("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),R("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),R("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",R("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),R("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),R("STAR","(<|>)?=?\\s*\\*"),R("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),R("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(vo,vo.exports);const wC=Object.freeze({loose:!0}),mC=Object.freeze({});var H0=e=>e?typeof e!="object"?wC:e:mC;const B_=/^[0-9]+$/,I_=(e,t)=>{const r=B_.test(e),n=B_.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eI_(t,e)};const rl=tl,{MAX_LENGTH:T_,MAX_SAFE_INTEGER:nl}=el,{safeRe:k_,t:C_}=vo.exports,bC=H0,{compareIdentifiers:wa}=R_;class ci{constructor(t,r){if(r=bC(r),t instanceof ci){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>T_)throw new TypeError(`version is longer than ${T_} characters`);rl("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?k_[C_.LOOSE]:k_[C_.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>nl||this.major<0)throw new TypeError("Invalid major version");if(this.minor>nl||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>nl||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(i=>{if(/^[0-9]+$/.test(i)){const s=+i;if(s>=0&&s=0;)typeof this.prerelease[s]=="number"&&(this.prerelease[s]++,s=-2);if(s===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(i)}}if(r){let s=[r,i];n===!1&&(s=[r]),wa(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=s):this.prerelease=s}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}var gn=ci;const L_=gn;var ma=(e,t,r=!1)=>{if(e instanceof L_)return e;try{return new L_(e,t)}catch(n){if(!r)return null;throw n}};const vC=ma;var _C=(e,t)=>{const r=vC(e,t);return r?r.version:null};const EC=ma;var xC=(e,t)=>{const r=EC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const $_=gn;var SC=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new $_(e instanceof $_?e.version:e,r).inc(t,n,i).version}catch{return null}};const O_=ma;var AC=(e,t)=>{const r=O_(e,null,!0),n=O_(t,null,!0),i=r.compare(n);if(i===0)return null;const s=i>0,o=s?r:n,a=s?n:r,c=!!o.prerelease.length;if(!!a.prerelease.length&&!c)return!a.patch&&!a.minor?"major":o.patch?"patch":o.minor?"minor":"major";const l=c?"pre":"";return r.major!==n.major?l+"major":r.minor!==n.minor?l+"minor":r.patch!==n.patch?l+"patch":"prerelease"};const BC=gn;var IC=(e,t)=>new BC(e,t).major;const RC=gn;var TC=(e,t)=>new RC(e,t).minor;const kC=gn;var CC=(e,t)=>new kC(e,t).patch;const LC=ma;var $C=(e,t)=>{const r=LC(e,t);return r&&r.prerelease.length?r.prerelease:null};const M_=gn;var fi=(e,t,r)=>new M_(e,r).compare(new M_(t,r));const OC=fi;var MC=(e,t,r)=>OC(t,e,r);const NC=fi;var PC=(e,t)=>NC(e,t,!0);const N_=gn;var j0=(e,t,r)=>{const n=new N_(e,r),i=new N_(t,r);return n.compare(i)||n.compareBuild(i)};const UC=j0;var FC=(e,t)=>e.sort((r,n)=>UC(r,n,t));const DC=j0;var HC=(e,t)=>e.sort((r,n)=>DC(n,r,t));const jC=fi;var il=(e,t,r)=>jC(e,t,r)>0;const zC=fi;var z0=(e,t,r)=>zC(e,t,r)<0;const qC=fi;var P_=(e,t,r)=>qC(e,t,r)===0;const VC=fi;var U_=(e,t,r)=>VC(e,t,r)!==0;const WC=fi;var q0=(e,t,r)=>WC(e,t,r)>=0;const KC=fi;var V0=(e,t,r)=>KC(e,t,r)<=0;const ZC=P_,GC=U_,YC=il,XC=q0,JC=z0,QC=V0;var F_=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return ZC(e,r,n);case"!=":return GC(e,r,n);case">":return YC(e,r,n);case">=":return XC(e,r,n);case"<":return JC(e,r,n);case"<=":return QC(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const eL=gn,tL=ma,{safeRe:sl,t:ol}=vo.exports;var rL=(e,t)=>{if(e instanceof eL)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?sl[ol.COERCEFULL]:sl[ol.COERCE]);else{const c=t.includePrerelease?sl[ol.COERCERTLFULL]:sl[ol.COERCERTL];let u;for(;(u=c.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||u.index+u[0].length!==r.index+r[0].length)&&(r=u),c.lastIndex=u.index+u[1].length+u[2].length;c.lastIndex=-1}if(r===null)return null;const n=r[2],i=r[3]||"0",s=r[4]||"0",o=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return tL(`${n}.${i}.${s}${o}${a}`,t)};class nL{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const i=this.map.keys().next().value;this.delete(i)}this.map.set(t,r)}return this}}var iL=nL,W0,D_;function ui(){if(D_)return W0;D_=1;class e{constructor(f,h){if(h=n(h),f instanceof e)return f.loose===!!h.loose&&f.includePrerelease===!!h.includePrerelease?f:new e(f.raw,h);if(f instanceof i)return this.raw=f.value,this.set=[[f]],this.format(),this;if(this.options=h,this.loose=!!h.loose,this.includePrerelease=!!h.includePrerelease,this.raw=f.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(m=>this.parseRange(m.trim())).filter(m=>m.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const m=this.set[0];if(this.set=this.set.filter(_=>!R(_[0])),this.set.length===0)this.set=[m];else if(this.set.length>1){for(const _ of this.set)if(_.length===1&&O(_[0])){this.set=[_];break}}}this.format()}format(){return this.range=this.set.map(f=>f.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(f){const m=((this.options.includePrerelease&&A)|(this.options.loose&&v))+":"+f,_=r.get(m);if(_)return _;const E=this.options.loose,x=E?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];f=f.replace(x,Q(this.options.includePrerelease)),s("hyphen replace",f),f=f.replace(a[c.COMPARATORTRIM],u),s("comparator trim",f),f=f.replace(a[c.TILDETRIM],l),s("tilde trim",f),f=f.replace(a[c.CARETTRIM],y),s("caret trim",f);let T=f.split(" ").map(W=>H(W,this.options)).join(" ").split(/\s+/).map(W=>se(W,this.options));E&&(T=T.filter(W=>(s("loose invalid filter",W,this.options),!!W.match(a[c.COMPARATORLOOSE])))),s("range list",T);const B=new Map,d=T.map(W=>new i(W,this.options));for(const W of d){if(R(W))return[W];B.set(W.value,W)}B.size>1&&B.has("")&&B.delete("");const k=[...B.values()];return r.set(m,k),k}intersects(f,h){if(!(f instanceof e))throw new TypeError("a Range is required");return this.set.some(m=>P(m,h)&&f.set.some(_=>P(_,h)&&m.every(E=>_.every(x=>E.intersects(x,h)))))}test(f){if(!f)return!1;if(typeof f=="string")try{f=new o(f,this.options)}catch{return!1}for(let h=0;hg.value==="<0.0.0-0",O=g=>g.value==="",P=(g,f)=>{let h=!0;const m=g.slice();let _=m.pop();for(;h&&m.length;)h=m.every(E=>_.intersects(E,f)),_=m.pop();return h},H=(g,f)=>(s("comp",g,f),g=q(g,f),s("caret",g),g=N(g,f),s("tildes",g),g=Z(g,f),s("xrange",g),g=ee(g,f),s("stars",g),g),F=g=>!g||g.toLowerCase()==="x"||g==="*",N=(g,f)=>g.trim().split(/\s+/).map(h=>$(h,f)).join(" "),$=(g,f)=>{const h=f.loose?a[c.TILDELOOSE]:a[c.TILDE];return g.replace(h,(m,_,E,x,T)=>{s("tilde",g,m,_,E,x,T);let B;return F(_)?B="":F(E)?B=`>=${_}.0.0 <${+_+1}.0.0-0`:F(x)?B=`>=${_}.${E}.0 <${_}.${+E+1}.0-0`:T?(s("replaceTilde pr",T),B=`>=${_}.${E}.${x}-${T} <${_}.${+E+1}.0-0`):B=`>=${_}.${E}.${x} <${_}.${+E+1}.0-0`,s("tilde return",B),B})},q=(g,f)=>g.trim().split(/\s+/).map(h=>G(h,f)).join(" "),G=(g,f)=>{s("caret",g,f);const h=f.loose?a[c.CARETLOOSE]:a[c.CARET],m=f.includePrerelease?"-0":"";return g.replace(h,(_,E,x,T,B)=>{s("caret",g,_,E,x,T,B);let d;return F(E)?d="":F(x)?d=`>=${E}.0.0${m} <${+E+1}.0.0-0`:F(T)?E==="0"?d=`>=${E}.${x}.0${m} <${E}.${+x+1}.0-0`:d=`>=${E}.${x}.0${m} <${+E+1}.0.0-0`:B?(s("replaceCaret pr",B),E==="0"?x==="0"?d=`>=${E}.${x}.${T}-${B} <${E}.${x}.${+T+1}-0`:d=`>=${E}.${x}.${T}-${B} <${E}.${+x+1}.0-0`:d=`>=${E}.${x}.${T}-${B} <${+E+1}.0.0-0`):(s("no pr"),E==="0"?x==="0"?d=`>=${E}.${x}.${T}${m} <${E}.${x}.${+T+1}-0`:d=`>=${E}.${x}.${T}${m} <${E}.${+x+1}.0-0`:d=`>=${E}.${x}.${T} <${+E+1}.0.0-0`),s("caret return",d),d})},Z=(g,f)=>(s("replaceXRanges",g,f),g.split(/\s+/).map(h=>z(h,f)).join(" ")),z=(g,f)=>{g=g.trim();const h=f.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return g.replace(h,(m,_,E,x,T,B)=>{s("xRange",g,m,_,E,x,T,B);const d=F(E),k=d||F(x),W=k||F(T),K=W;return _==="="&&K&&(_=""),B=f.includePrerelease?"-0":"",d?_===">"||_==="<"?m="<0.0.0-0":m="*":_&&K?(k&&(x=0),T=0,_===">"?(_=">=",k?(E=+E+1,x=0,T=0):(x=+x+1,T=0)):_==="<="&&(_="<",k?E=+E+1:x=+x+1),_==="<"&&(B="-0"),m=`${_+E}.${x}.${T}${B}`):k?m=`>=${E}.0.0${B} <${+E+1}.0.0-0`:W&&(m=`>=${E}.${x}.0${B} <${E}.${+x+1}.0-0`),s("xRange return",m),m})},ee=(g,f)=>(s("replaceStars",g,f),g.trim().replace(a[c.STAR],"")),se=(g,f)=>(s("replaceGTE0",g,f),g.trim().replace(a[f.includePrerelease?c.GTE0PRE:c.GTE0],"")),Q=g=>(f,h,m,_,E,x,T,B,d,k,W,K)=>(F(m)?h="":F(_)?h=`>=${m}.0.0${g?"-0":""}`:F(E)?h=`>=${m}.${_}.0${g?"-0":""}`:x?h=`>=${h}`:h=`>=${h}${g?"-0":""}`,F(d)?B="":F(k)?B=`<${+d+1}.0.0-0`:F(W)?B=`<${d}.${+k+1}.0-0`:K?B=`<=${d}.${k}.${W}-${K}`:g?B=`<${d}.${k}.${+W+1}-0`:B=`<=${B}`,`${h} ${B}`.trim()),I=(g,f,h)=>{for(let m=0;m0){const _=g[m].semver;if(_.major===f.major&&_.minor===f.minor&&_.patch===f.patch)return!0}return!1}return!0};return W0}var K0,H_;function al(){if(H_)return K0;H_=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(l,y){if(y=r(y),l instanceof t){if(l.loose===!!y.loose)return l;l=l.value}l=l.trim().split(/\s+/).join(" "),o("comparator",l,y),this.options=y,this.loose=!!y.loose,this.parse(l),this.semver===e?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(l){const y=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],A=l.match(y);if(!A)throw new TypeError(`Invalid comparator: ${l}`);this.operator=A[1]!==void 0?A[1]:"",this.operator==="="&&(this.operator=""),A[2]?this.semver=new a(A[2],this.options.loose):this.semver=e}toString(){return this.value}test(l){if(o("Comparator.test",l,this.options.loose),this.semver===e||l===e)return!0;if(typeof l=="string")try{l=new a(l,this.options)}catch{return!1}return s(l,this.operator,this.semver,this.options)}intersects(l,y){if(!(l instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new c(l.value,y).test(this.value):l.operator===""?l.value===""?!0:new c(this.value,y).test(l.semver):(y=r(y),y.includePrerelease&&(this.value==="<0.0.0-0"||l.value==="<0.0.0-0")||!y.includePrerelease&&(this.value.startsWith("<0.0.0")||l.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&l.operator.startsWith(">")||this.operator.startsWith("<")&&l.operator.startsWith("<")||this.semver.version===l.semver.version&&this.operator.includes("=")&&l.operator.includes("=")||s(this.semver,"<",l.semver,y)&&this.operator.startsWith(">")&&l.operator.startsWith("<")||s(this.semver,">",l.semver,y)&&this.operator.startsWith("<")&&l.operator.startsWith(">")))}}K0=t;const r=H0,{safeRe:n,t:i}=vo.exports,s=F_,o=tl,a=gn,c=ui();return K0}const sL=ui();var cl=(e,t,r)=>{try{t=new sL(t,r)}catch{return!1}return t.test(e)};const oL=ui();var aL=(e,t)=>new oL(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));const cL=gn,fL=ui();var uL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new fL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new cL(n,r))}),n};const lL=gn,hL=ui();var dL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new hL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new lL(n,r))}),n};const Z0=gn,pL=ui(),j_=il;var gL=(e,t)=>{e=new pL(e,t);let r=new Z0("0.0.0");if(e.test(r)||(r=new Z0("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const a=new Z0(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||j_(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||j_(r,s))&&(r=s)}return r&&e.test(r)?r:null};const yL=ui();var wL=(e,t)=>{try{return new yL(e,t).range||"*"}catch{return null}};const mL=gn,z_=al(),{ANY:bL}=z_,vL=ui(),_L=cl,q_=il,V_=z0,EL=V0,xL=q0;var G0=(e,t,r,n)=>{e=new mL(e,n),t=new vL(t,n);let i,s,o,a,c;switch(r){case">":i=q_,s=EL,o=V_,a=">",c=">=";break;case"<":i=V_,s=xL,o=q_,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(_L(e,t,n))return!1;for(let u=0;u{v.semver===bL&&(v=new z_(">=0.0.0")),y=y||v,A=A||v,i(v.semver,y.semver,n)?y=v:o(v.semver,A.semver,n)&&(A=v)}),y.operator===a||y.operator===c||(!A.operator||A.operator===a)&&s(e,A.semver))return!1;if(A.operator===c&&o(e,A.semver))return!1}return!0};const SL=G0;var AL=(e,t,r)=>SL(e,t,">",r);const BL=G0;var IL=(e,t,r)=>BL(e,t,"<",r);const W_=ui();var RL=(e,t,r)=>(e=new W_(e,r),t=new W_(t,r),e.intersects(t,r));const TL=cl,kL=fi;var CL=(e,t,r)=>{const n=[];let i=null,s=null;const o=e.sort((l,y)=>kL(l,y,r));for(const l of o)TL(l,t,r)?(s=l,i||(i=l)):(s&&n.push([i,s]),s=null,i=null);i&&n.push([i,null]);const a=[];for(const[l,y]of n)l===y?a.push(l):!y&&l===o[0]?a.push("*"):y?l===o[0]?a.push(`<=${y}`):a.push(`${l} - ${y}`):a.push(`>=${l}`);const c=a.join(" || "),u=typeof t.raw=="string"?t.raw:String(t);return c.length{if(e===t)return!0;e=new K_(e,r),t=new K_(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const o=OL(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},$L=[new Y0(">=0.0.0-0")],Z_=[new Y0(">=0.0.0")],OL=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===X0){if(t.length===1&&t[0].semver===X0)return!0;r.includePrerelease?e=$L:e=Z_}if(t.length===1&&t[0].semver===X0){if(r.includePrerelease)return!0;t=Z_}const n=new Set;let i,s;for(const v of e)v.operator===">"||v.operator===">="?i=G_(i,v,r):v.operator==="<"||v.operator==="<="?s=Y_(s,v,r):n.add(v.semver);if(n.size>1)return null;let o;if(i&&s){if(o=J0(i.semver,s.semver,r),o>0)return null;if(o===0&&(i.operator!==">="||s.operator!=="<="))return null}for(const v of n){if(i&&!Nc(v,String(i),r)||s&&!Nc(v,String(s),r))return null;for(const R of t)if(!Nc(v,String(R),r))return!1;return!0}let a,c,u,l,y=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1,A=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1;y&&y.prerelease.length===1&&s.operator==="<"&&y.prerelease[0]===0&&(y=!1);for(const v of t){if(l=l||v.operator===">"||v.operator===">=",u=u||v.operator==="<"||v.operator==="<=",i){if(A&&v.semver.prerelease&&v.semver.prerelease.length&&v.semver.major===A.major&&v.semver.minor===A.minor&&v.semver.patch===A.patch&&(A=!1),v.operator===">"||v.operator===">="){if(a=G_(i,v,r),a===v&&a!==i)return!1}else if(i.operator===">="&&!Nc(i.semver,String(v),r))return!1}if(s){if(y&&v.semver.prerelease&&v.semver.prerelease.length&&v.semver.major===y.major&&v.semver.minor===y.minor&&v.semver.patch===y.patch&&(y=!1),v.operator==="<"||v.operator==="<="){if(c=Y_(s,v,r),c===v&&c!==s)return!1}else if(s.operator==="<="&&!Nc(s.semver,String(v),r))return!1}if(!v.operator&&(s||i)&&o!==0)return!1}return!(i&&u&&!s&&o!==0||s&&l&&!i&&o!==0||A||y)},G_=(e,t,r)=>{if(!e)return t;const n=J0(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},Y_=(e,t,r)=>{if(!e)return t;const n=J0(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var ML=LL;const Q0=vo.exports,X_=el,NL=gn,J_=R_,PL=ma,UL=_C,FL=xC,DL=SC,HL=AC,jL=IC,zL=TC,qL=CC,VL=$C,WL=fi,KL=MC,ZL=PC,GL=j0,YL=FC,XL=HC,JL=il,QL=z0,e$=P_,t$=U_,r$=q0,n$=V0,i$=F_,s$=rL,o$=al(),a$=ui();var c$={parse:PL,valid:UL,clean:FL,inc:DL,diff:HL,major:jL,minor:zL,patch:qL,prerelease:VL,compare:WL,rcompare:KL,compareLoose:ZL,compareBuild:GL,sort:YL,rsort:XL,gt:JL,lt:QL,eq:e$,neq:t$,gte:r$,lte:n$,cmp:i$,coerce:s$,Comparator:o$,Range:a$,satisfies:cl,toComparators:aL,maxSatisfying:uL,minSatisfying:dL,minVersion:gL,validRange:wL,outside:G0,gtr:AL,ltr:IL,intersects:RL,simplifyRange:CL,subset:ML,SemVer:NL,re:Q0.re,src:Q0.src,tokens:Q0.t,SEMVER_SPEC_VERSION:X_.SEMVER_SPEC_VERSION,RELEASE_TYPES:X_.RELEASE_TYPES,compareIdentifiers:J_.compareIdentifiers,rcompareIdentifiers:J_.rcompareIdentifiers};Object.defineProperty(ai,"__esModule",{value:!0});var Q_=Jn,Pc=c$,ba=Ms,ep=ba.refine.call(void 0,ba.string.call(void 0),"Version",e=>Pc.valid.call(void 0,e)===null?`Expected SemVer version, got "${e}"`:!0),tp=ba.refine.call(void 0,ba.string.call(void 0),"Version range",e=>Pc.validRange.call(void 0,e)===null?`Expected SemVer range, got "${e}"`:!0);function f$(e){return ba.is.call(void 0,e,ep)}function u$(e){return ba.is.call(void 0,e,tp)}function l$(e){Q_.assertStruct.call(void 0,e,ep)}function h$(e){Q_.assertStruct.call(void 0,e,tp)}function d$(e,t){return Pc.gt.call(void 0,e,t)}function p$(e,t){return Pc.gtr.call(void 0,e,t)}function g$(e,t){return Pc.satisfies.call(void 0,e,t,{includePrerelease:!0})}ai.VersionStruct=ep,ai.VersionRangeStruct=tp,ai.isValidSemVerVersion=f$,ai.isValidSemVerRange=u$,ai.assertIsSemVerVersion=l$,ai.assertIsSemVerRange=h$,ai.gtVersion=d$,ai.gtRange=p$,ai.satisfiesVersionRange=g$;var It={};Object.defineProperty(It,"__esModule",{value:!0});var Gi=Jn,y$=dn,dt=Ms,va=e=>dt.object.call(void 0,e);function e2({path:e,branch:t}){const r=e[e.length-1];return y$.hasProperty.call(void 0,t[t.length-2],r)}function Uc(e){return new dt.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!e2(r)||e.validator(t,r),refiner:(t,r)=>!e2(r)||e.refiner(t,r)})}var w$=()=>dt.define.call(void 0,"finite number",e=>dt.is.call(void 0,e,dt.number.call(void 0))&&Number.isFinite(e)),Fc=dt.union.call(void 0,[dt.literal.call(void 0,null),dt.boolean.call(void 0),w$(),dt.string.call(void 0),dt.array.call(void 0,dt.lazy.call(void 0,()=>Fc)),dt.record.call(void 0,dt.string.call(void 0),dt.lazy.call(void 0,()=>Fc))]),_o=dt.coerce.call(void 0,Fc,dt.any.call(void 0),e=>(Gi.assertStruct.call(void 0,e,Fc),JSON.parse(JSON.stringify(e,(t,r)=>{if(!(t==="__proto__"||t==="constructor"))return r}))));function m$(e){try{return t2(e),!0}catch{return!1}}function t2(e){return dt.create.call(void 0,e,_o)}function b$(e){Gi.assertStruct.call(void 0,e,_o,"Invalid JSON value");const t=JSON.stringify(e);return new TextEncoder().encode(t).byteLength}var r2="2.0",_a=dt.literal.call(void 0,r2),Dc=dt.nullable.call(void 0,dt.union.call(void 0,[dt.number.call(void 0),dt.string.call(void 0)])),Hc=va({code:dt.integer.call(void 0),message:dt.string.call(void 0),data:Uc(_o),stack:Uc(dt.string.call(void 0))}),rp=dt.union.call(void 0,[dt.record.call(void 0,dt.string.call(void 0),_o),dt.array.call(void 0,_o)]),np=va({id:Dc,jsonrpc:_a,method:dt.string.call(void 0),params:Uc(rp)}),ip=va({jsonrpc:_a,method:dt.string.call(void 0),params:Uc(rp)});function v$(e){return dt.is.call(void 0,e,ip)}function _$(e,t){Gi.assertStruct.call(void 0,e,ip,"Invalid JSON-RPC notification",t)}function E$(e){return dt.is.call(void 0,e,np)}function x$(e,t){Gi.assertStruct.call(void 0,e,np,"Invalid JSON-RPC request",t)}var sp=dt.object.call(void 0,{id:Dc,jsonrpc:_a,result:dt.optional.call(void 0,dt.unknown.call(void 0)),error:dt.optional.call(void 0,Hc)}),fl=va({id:Dc,jsonrpc:_a,result:_o}),ul=va({id:Dc,jsonrpc:_a,error:Hc}),op=dt.union.call(void 0,[fl,ul]);function S$(e){return dt.is.call(void 0,e,sp)}function A$(e,t){Gi.assertStruct.call(void 0,e,sp,"Invalid pending JSON-RPC response",t)}function B$(e){return dt.is.call(void 0,e,op)}function I$(e,t){Gi.assertStruct.call(void 0,e,op,"Invalid JSON-RPC response",t)}function R$(e){return dt.is.call(void 0,e,fl)}function T$(e,t){Gi.assertStruct.call(void 0,e,fl,"Invalid JSON-RPC success response",t)}function k$(e){return dt.is.call(void 0,e,ul)}function C$(e,t){Gi.assertStruct.call(void 0,e,ul,"Invalid JSON-RPC failure response",t)}function L$(e){return dt.is.call(void 0,e,Hc)}function $$(e,t){Gi.assertStruct.call(void 0,e,Hc,"Invalid JSON-RPC error",t)}function O$(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return s=>!!(typeof s=="number"&&(r||Number.isInteger(s))||typeof s=="string"&&(t||s.length>0)||n&&s===null)}It.object=va,It.exactOptional=Uc,It.UnsafeJsonStruct=Fc,It.JsonStruct=_o,It.isValidJson=m$,It.getSafeJson=t2,It.getJsonSize=b$,It.jsonrpc2=r2,It.JsonRpcVersionStruct=_a,It.JsonRpcIdStruct=Dc,It.JsonRpcErrorStruct=Hc,It.JsonRpcParamsStruct=rp,It.JsonRpcRequestStruct=np,It.JsonRpcNotificationStruct=ip,It.isJsonRpcNotification=v$,It.assertIsJsonRpcNotification=_$,It.isJsonRpcRequest=E$,It.assertIsJsonRpcRequest=x$,It.PendingJsonRpcResponseStruct=sp,It.JsonRpcSuccessStruct=fl,It.JsonRpcFailureStruct=ul,It.JsonRpcResponseStruct=op,It.isPendingJsonRpcResponse=S$,It.assertIsPendingJsonRpcResponse=A$,It.isJsonRpcResponse=B$,It.assertIsJsonRpcResponse=I$,It.isJsonRpcSuccess=R$,It.assertIsJsonRpcSuccess=T$,It.isJsonRpcFailure=k$,It.assertIsJsonRpcFailure=C$,It.isJsonRpcError=L$,It.assertIsJsonRpcError=$$,It.getJsonRpcIdValidator=O$;var ll={},ap={exports:{}},cp,n2;function M$(){if(n2)return cp;n2=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;cp=function(l,y){y=y||{};var A=typeof l;if(A==="string"&&l.length>0)return o(l);if(A==="number"&&isFinite(l))return y.long?c(l):a(l);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(l))};function o(l){if(l=String(l),!(l.length>100)){var y=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(l);if(y){var A=parseFloat(y[1]),v=(y[2]||"ms").toLowerCase();switch(v){case"years":case"year":case"yrs":case"yr":case"y":return A*s;case"weeks":case"week":case"w":return A*i;case"days":case"day":case"d":return A*n;case"hours":case"hour":case"hrs":case"hr":case"h":return A*r;case"minutes":case"minute":case"mins":case"min":case"m":return A*t;case"seconds":case"second":case"secs":case"sec":case"s":return A*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return A;default:return}}}}function a(l){var y=Math.abs(l);return y>=n?Math.round(l/n)+"d":y>=r?Math.round(l/r)+"h":y>=t?Math.round(l/t)+"m":y>=e?Math.round(l/e)+"s":l+"ms"}function c(l){var y=Math.abs(l);return y>=n?u(l,y,n,"day"):y>=r?u(l,y,r,"hour"):y>=t?u(l,y,t,"minute"):y>=e?u(l,y,e,"second"):l+" ms"}function u(l,y,A,v){var R=y>=A*1.5;return Math.round(l/A)+" "+v+(R?"s":"")}return cp}function N$(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=M$(),r.destroy=u,Object.keys(e).forEach(l=>{r[l]=e[l]}),r.names=[],r.skips=[],r.formatters={};function t(l){let y=0;for(let A=0;A{if(G==="%%")return"%";$++;const z=r.formatters[Z];if(typeof z=="function"){const ee=P[$];G=z.call(H,ee),P.splice($,1),$--}return G}),r.formatArgs.call(H,P),(H.log||r.log).apply(H,P)}return O.namespace=l,O.useColors=r.useColors(),O.color=r.selectColor(l),O.extend=n,O.destroy=r.destroy,Object.defineProperty(O,"enabled",{enumerable:!0,configurable:!1,get:()=>A!==null?A:(v!==r.namespaces&&(v=r.namespaces,R=r.enabled(l)),R),set:P=>{A=P}}),typeof r.init=="function"&&r.init(O),O}function n(l,y){const A=r(this.namespace+(typeof y>"u"?":":y)+l);return A.log=this.log,A}function i(l){r.save(l),r.namespaces=l,r.names=[],r.skips=[];let y;const A=(typeof l=="string"?l:"").split(/[\s,]+/),v=A.length;for(y=0;y"-"+y)].join(",");return r.enable(""),l}function o(l){if(l[l.length-1]==="*")return!0;let y,A;for(y=0,A=r.skips.length;y{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),t.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function r(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function n(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+e.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let l=0,y=0;c[0].replace(/%[a-zA-Z%]/g,A=>{A!=="%%"&&(l++,A==="%c"&&(y=l))}),c.splice(y,0,u)}t.log=console.debug||console.log||(()=>{});function i(c){try{c?t.storage.setItem("debug",c):t.storage.removeItem("debug")}catch{}}function s(){let c;try{c=t.storage.getItem("debug")}catch{}return!c&&typeof process<"u"&&"env"in process&&(c=process.env.DEBUG),c}function o(){try{return localStorage}catch{}}e.exports=P$(t);const{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(ap,ap.exports),Object.defineProperty(ll,"__esModule",{value:!0});function U$(e){return e&&e.__esModule?e:{default:e}}var F$=ap.exports,D$=U$(F$),H$=D$.default.call(void 0,"metamask");function j$(e){return H$.extend(e)}function z$(e,t){return e.extend(t)}ll.createProjectLogger=j$,ll.createModuleLogger=z$;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});function i2(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var yn=Ms,fp=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,up=/^[-a-z0-9]{3,8}$/u,lp=/^[-_a-zA-Z0-9]{1,32}$/u,hp=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,s2=/^[-.%a-zA-Z0-9]{1,128}$/u,o2=yn.pattern.call(void 0,yn.string.call(void 0),fp),a2=yn.pattern.call(void 0,yn.string.call(void 0),up),c2=yn.pattern.call(void 0,yn.string.call(void 0),lp),f2=yn.pattern.call(void 0,yn.string.call(void 0),hp),u2=yn.pattern.call(void 0,yn.string.call(void 0),s2),l2=(e=>(e.Eip155="eip155",e))(l2||{});function q$(e){return yn.is.call(void 0,e,o2)}function h2(e){return yn.is.call(void 0,e,a2)}function d2(e){return yn.is.call(void 0,e,c2)}function V$(e){return yn.is.call(void 0,e,f2)}function W$(e){return yn.is.call(void 0,e,u2)}function K$(e){const t=fp.exec(e);if(!i2([t,"optionalAccess",r=>r.groups]))throw new Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}}function Z$(e){const t=hp.exec(e);if(!i2([t,"optionalAccess",r=>r.groups]))throw new Error("Invalid CAIP account ID.");return{address:t.groups.accountAddress,chainId:t.groups.chainId,chain:{namespace:t.groups.namespace,reference:t.groups.reference}}}function G$(e,t){if(!h2(e))throw new Error(`Invalid "namespace", must match: ${up.toString()}`);if(!d2(t))throw new Error(`Invalid "reference", must match: ${lp.toString()}`);return`${e}:${t}`}Ir.CAIP_CHAIN_ID_REGEX=fp,Ir.CAIP_NAMESPACE_REGEX=up,Ir.CAIP_REFERENCE_REGEX=lp,Ir.CAIP_ACCOUNT_ID_REGEX=hp,Ir.CAIP_ACCOUNT_ADDRESS_REGEX=s2,Ir.CaipChainIdStruct=o2,Ir.CaipNamespaceStruct=a2,Ir.CaipReferenceStruct=c2,Ir.CaipAccountIdStruct=f2,Ir.CaipAccountAddressStruct=u2,Ir.KnownCaipNamespace=l2,Ir.isCaipChainId=q$,Ir.isCaipNamespace=h2,Ir.isCaipReference=d2,Ir.isCaipAccountId=V$,Ir.isCaipAccountAddress=W$,Ir.parseCaipChainId=K$,Ir.parseCaipAccountId=Z$,Ir.toCaipChainId=G$;var dp={},hl={};Object.defineProperty(hl,"__esModule",{value:!0});function p2(e,t){return e??t()}var Y$=Jn,X$=Ms,J$=(e,t={})=>{const r=p2(t.paddingRequired,()=>!1),n=p2(t.characterSet,()=>"base64");let i;n==="base64"?i=String.raw`[A-Za-z0-9+\/]`:(Y$.assert.call(void 0,n==="base64url"),i=String.raw`[-_A-Za-z0-9]`);let s;return r?s=new RegExp(`^(?:${i}{4})*(?:${i}{3}=|${i}{2}==)?$`,"u"):s=new RegExp(`^(?:${i}{4})*(?:${i}{2,3}|${i}{3}=|${i}{2}==)?$`,"u"),X$.pattern.call(void 0,e,s)};hl.base64=J$,Object.defineProperty(dp,"__esModule",{value:!0});var Q$=hl,g2=Ms,eO=g2.size.call(void 0,Q$.base64.call(void 0,g2.string.call(void 0),{paddingRequired:!0}),44,44);dp.ChecksumStruct=eO;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});var xa=Rt,tO=Jn,gr=Ms,y2=gr.union.call(void 0,[gr.number.call(void 0),gr.bigint.call(void 0),gr.string.call(void 0),xa.StrictHexStruct]),rO=gr.coerce.call(void 0,gr.number.call(void 0),y2,Number),nO=gr.coerce.call(void 0,gr.bigint.call(void 0),y2,BigInt);gr.union.call(void 0,[xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array)]);var iO=gr.coerce.call(void 0,gr.instance.call(void 0,Uint8Array),gr.union.call(void 0,[xa.StrictHexStruct]),xa.hexToBytes),sO=gr.coerce.call(void 0,xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array),xa.bytesToHex);function oO(e){try{const t=gr.create.call(void 0,e,rO);return tO.assert.call(void 0,Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){throw t instanceof gr.StructError?new Error(`Expected a number-like value, got "${e}".`):t}}function aO(e){try{return gr.create.call(void 0,e,nO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}function cO(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return gr.create.call(void 0,e,iO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}function fO(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";try{return gr.create.call(void 0,e,sO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}Ea.createNumber=oO,Ea.createBigInt=aO,Ea.createBytes=cO,Ea.createHex=fO;var dl={},jc={};Object.defineProperty(jc,"__esModule",{value:!0});var w2=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},uO=(e,t,r)=>(w2(e,t,"read from private field"),r?r.call(e):t.get(e)),lO=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},hO=(e,t,r,n)=>(w2(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);jc.__privateGet=uO,jc.__privateAdd=lO,jc.__privateSet=hO,Object.defineProperty(dl,"__esModule",{value:!0});var Mr=jc,li,pp=class{constructor(e){Mr.__privateAdd.call(void 0,this,li,void 0),Mr.__privateSet.call(void 0,this,li,new Map(e)),Object.freeze(this)}get size(){return Mr.__privateGet.call(void 0,this,li).size}[Symbol.iterator](){return Mr.__privateGet.call(void 0,this,li)[Symbol.iterator]()}entries(){return Mr.__privateGet.call(void 0,this,li).entries()}forEach(e,t){return Mr.__privateGet.call(void 0,this,li).forEach((r,n,i)=>e.call(t,r,n,this))}get(e){return Mr.__privateGet.call(void 0,this,li).get(e)}has(e){return Mr.__privateGet.call(void 0,this,li).has(e)}keys(){return Mr.__privateGet.call(void 0,this,li).keys()}values(){return Mr.__privateGet.call(void 0,this,li).values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,t])=>`${String(e)} => ${String(t)}`).join(", ")} `:""}}`}};li=new WeakMap;var Ii,gp=class{constructor(e){Mr.__privateAdd.call(void 0,this,Ii,void 0),Mr.__privateSet.call(void 0,this,Ii,new Set(e)),Object.freeze(this)}get size(){return Mr.__privateGet.call(void 0,this,Ii).size}[Symbol.iterator](){return Mr.__privateGet.call(void 0,this,Ii)[Symbol.iterator]()}entries(){return Mr.__privateGet.call(void 0,this,Ii).entries()}forEach(e,t){return Mr.__privateGet.call(void 0,this,Ii).forEach((r,n,i)=>e.call(t,r,n,this))}has(e){return Mr.__privateGet.call(void 0,this,Ii).has(e)}keys(){return Mr.__privateGet.call(void 0,this,Ii).keys()}values(){return Mr.__privateGet.call(void 0,this,Ii).values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}};Ii=new WeakMap,Object.freeze(pp),Object.freeze(pp.prototype),Object.freeze(gp),Object.freeze(gp.prototype),dl.FrozenMap=pp,dl.FrozenSet=gp,Object.defineProperty(oe,"__esModule",{value:!0});var pl=da,dO=D0,yp=Mc,Yi=ai,$t=It,m2=ll,Nr=Ir,pO=dp,gO=hl,gl=Ea,Dt=Rt,yl=Jn,zc=Os,hi=dn,b2=dl;oe.AssertionError=yl.AssertionError,oe.CAIP_ACCOUNT_ADDRESS_REGEX=Nr.CAIP_ACCOUNT_ADDRESS_REGEX,oe.CAIP_ACCOUNT_ID_REGEX=Nr.CAIP_ACCOUNT_ID_REGEX,oe.CAIP_CHAIN_ID_REGEX=Nr.CAIP_CHAIN_ID_REGEX,oe.CAIP_NAMESPACE_REGEX=Nr.CAIP_NAMESPACE_REGEX,oe.CAIP_REFERENCE_REGEX=Nr.CAIP_REFERENCE_REGEX,oe.CaipAccountAddressStruct=Nr.CaipAccountAddressStruct,oe.CaipAccountIdStruct=Nr.CaipAccountIdStruct,oe.CaipChainIdStruct=Nr.CaipChainIdStruct,oe.CaipNamespaceStruct=Nr.CaipNamespaceStruct,oe.CaipReferenceStruct=Nr.CaipReferenceStruct,oe.ChecksumStruct=pO.ChecksumStruct,oe.Duration=yp.Duration,oe.ESCAPE_CHARACTERS_REGEXP=hi.ESCAPE_CHARACTERS_REGEXP,oe.FrozenMap=b2.FrozenMap,oe.FrozenSet=b2.FrozenSet,oe.HexAddressStruct=Dt.HexAddressStruct,oe.HexChecksumAddressStruct=Dt.HexChecksumAddressStruct,oe.HexStruct=Dt.HexStruct,oe.JsonRpcErrorStruct=$t.JsonRpcErrorStruct,oe.JsonRpcFailureStruct=$t.JsonRpcFailureStruct,oe.JsonRpcIdStruct=$t.JsonRpcIdStruct,oe.JsonRpcNotificationStruct=$t.JsonRpcNotificationStruct,oe.JsonRpcParamsStruct=$t.JsonRpcParamsStruct,oe.JsonRpcRequestStruct=$t.JsonRpcRequestStruct,oe.JsonRpcResponseStruct=$t.JsonRpcResponseStruct,oe.JsonRpcSuccessStruct=$t.JsonRpcSuccessStruct,oe.JsonRpcVersionStruct=$t.JsonRpcVersionStruct,oe.JsonSize=hi.JsonSize,oe.JsonStruct=$t.JsonStruct,oe.KnownCaipNamespace=Nr.KnownCaipNamespace,oe.PendingJsonRpcResponseStruct=$t.PendingJsonRpcResponseStruct,oe.StrictHexStruct=Dt.StrictHexStruct,oe.UnsafeJsonStruct=$t.UnsafeJsonStruct,oe.VersionRangeStruct=Yi.VersionRangeStruct,oe.VersionStruct=Yi.VersionStruct,oe.add0x=Dt.add0x,oe.assert=yl.assert,oe.assertExhaustive=yl.assertExhaustive,oe.assertIsBytes=Dt.assertIsBytes,oe.assertIsHexString=Dt.assertIsHexString,oe.assertIsJsonRpcError=$t.assertIsJsonRpcError,oe.assertIsJsonRpcFailure=$t.assertIsJsonRpcFailure,oe.assertIsJsonRpcNotification=$t.assertIsJsonRpcNotification,oe.assertIsJsonRpcRequest=$t.assertIsJsonRpcRequest,oe.assertIsJsonRpcResponse=$t.assertIsJsonRpcResponse,oe.assertIsJsonRpcSuccess=$t.assertIsJsonRpcSuccess,oe.assertIsPendingJsonRpcResponse=$t.assertIsPendingJsonRpcResponse,oe.assertIsSemVerRange=Yi.assertIsSemVerRange,oe.assertIsSemVerVersion=Yi.assertIsSemVerVersion,oe.assertIsStrictHexString=Dt.assertIsStrictHexString,oe.assertStruct=yl.assertStruct,oe.base64=gO.base64,oe.base64ToBytes=Dt.base64ToBytes,oe.bigIntToBytes=Dt.bigIntToBytes,oe.bigIntToHex=pl.bigIntToHex,oe.bytesToBase64=Dt.bytesToBase64,oe.bytesToBigInt=Dt.bytesToBigInt,oe.bytesToHex=Dt.bytesToHex,oe.bytesToNumber=Dt.bytesToNumber,oe.bytesToSignedBigInt=Dt.bytesToSignedBigInt,oe.bytesToString=Dt.bytesToString,oe.calculateNumberSize=hi.calculateNumberSize,oe.calculateStringSize=hi.calculateStringSize,oe.concatBytes=Dt.concatBytes,oe.createBigInt=gl.createBigInt,oe.createBytes=gl.createBytes,oe.createDataView=Dt.createDataView,oe.createDeferredPromise=dO.createDeferredPromise,oe.createHex=gl.createHex,oe.createModuleLogger=m2.createModuleLogger,oe.createNumber=gl.createNumber,oe.createProjectLogger=m2.createProjectLogger,oe.exactOptional=$t.exactOptional,oe.getChecksumAddress=Dt.getChecksumAddress,oe.getErrorMessage=zc.getErrorMessage,oe.getJsonRpcIdValidator=$t.getJsonRpcIdValidator,oe.getJsonSize=$t.getJsonSize,oe.getKnownPropertyNames=hi.getKnownPropertyNames,oe.getSafeJson=$t.getSafeJson,oe.gtRange=Yi.gtRange,oe.gtVersion=Yi.gtVersion,oe.hasProperty=hi.hasProperty,oe.hexToBigInt=pl.hexToBigInt,oe.hexToBytes=Dt.hexToBytes,oe.hexToNumber=pl.hexToNumber,oe.inMilliseconds=yp.inMilliseconds,oe.isASCII=hi.isASCII,oe.isBytes=Dt.isBytes,oe.isCaipAccountAddress=Nr.isCaipAccountAddress,oe.isCaipAccountId=Nr.isCaipAccountId,oe.isCaipChainId=Nr.isCaipChainId,oe.isCaipNamespace=Nr.isCaipNamespace,oe.isCaipReference=Nr.isCaipReference,oe.isErrorWithCode=zc.isErrorWithCode,oe.isErrorWithMessage=zc.isErrorWithMessage,oe.isErrorWithStack=zc.isErrorWithStack,oe.isHexString=Dt.isHexString,oe.isJsonRpcError=$t.isJsonRpcError,oe.isJsonRpcFailure=$t.isJsonRpcFailure,oe.isJsonRpcNotification=$t.isJsonRpcNotification,oe.isJsonRpcRequest=$t.isJsonRpcRequest,oe.isJsonRpcResponse=$t.isJsonRpcResponse,oe.isJsonRpcSuccess=$t.isJsonRpcSuccess,oe.isNonEmptyArray=hi.isNonEmptyArray,oe.isNullOrUndefined=hi.isNullOrUndefined,oe.isObject=hi.isObject,oe.isPendingJsonRpcResponse=$t.isPendingJsonRpcResponse,oe.isPlainObject=hi.isPlainObject,oe.isStrictHexString=Dt.isStrictHexString,oe.isValidChecksumAddress=Dt.isValidChecksumAddress,oe.isValidHexAddress=Dt.isValidHexAddress,oe.isValidJson=$t.isValidJson,oe.isValidSemVerRange=Yi.isValidSemVerRange,oe.isValidSemVerVersion=Yi.isValidSemVerVersion,oe.jsonrpc2=$t.jsonrpc2,oe.numberToBytes=Dt.numberToBytes,oe.numberToHex=pl.numberToHex,oe.object=$t.object,oe.parseCaipAccountId=Nr.parseCaipAccountId,oe.parseCaipChainId=Nr.parseCaipChainId,oe.remove0x=Dt.remove0x,oe.satisfiesVersionRange=Yi.satisfiesVersionRange,oe.signedBigIntToBytes=Dt.signedBigIntToBytes,oe.stringToBytes=Dt.stringToBytes,oe.timeSince=yp.timeSince,oe.toCaipChainId=Nr.toCaipChainId,oe.valueToBytes=Dt.valueToBytes,oe.wrapError=zc.wrapError,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.normalize=Qr.recoverPublicKey=Qr.concatSig=Qr.legacyToBuffer=Qr.isNullish=Qr.padWithZeroes=void 0;const Xi=Xf,Sa=oe;function wp(e,t){if(e!==""&&!/^[a-f0-9]+$/iu.test(e))throw new Error(`Expected an unprefixed hex string. Received: ${e}`);if(t<0)throw new Error(`Expected a non-negative integer target length. Received: ${t}`);return String.prototype.padStart.call(e,t,"0")}Qr.padWithZeroes=wp;function v2(e){return e==null}Qr.isNullish=v2;function yO(e){return typeof e=="string"&&!(0,Xi.isHexString)(e)?ie.Buffer.from(e):(0,Xi.toBuffer)(e)}Qr.legacyToBuffer=yO;function wO(e,t,r){const n=(0,Xi.fromSigned)(t),i=(0,Xi.fromSigned)(r),s=(0,Xi.bufferToInt)(e),o=wp((0,Xi.toUnsigned)(n).toString("hex"),64),a=wp((0,Xi.toUnsigned)(i).toString("hex"),64),c=(0,Sa.remove0x)((0,Sa.numberToHex)(s));return(0,Sa.add0x)(o.concat(a,c))}Qr.concatSig=wO;function mO(e,t){const r=(0,Xi.fromRpcSig)(t);return(0,Xi.ecrecover)(e,r.v,r.r,r.s)}Qr.recoverPublicKey=mO;function bO(e){if(!v2(e)){if(typeof e=="number"){if(e<0)return"0x";const t=(0,Sa.numberToBytes)(e);e=(0,Sa.bytesToHex)(t)}if(typeof e!="string"){let t="eth-sig-util.normalize() requires hex string or integer input.";throw t+=` received ${typeof e}: ${e}`,new Error(t)}return(0,Sa.add0x)(e.toLowerCase())}}Qr.normalize=bO,Object.defineProperty(us,"__esModule",{value:!0}),us.extractPublicKey=us.recoverPersonalSignature=us.personalSign=void 0;const Aa=Xf,Ri=Qr;function vO({privateKey:e,data:t}){if((0,Ri.isNullish)(t))throw new Error("Missing data parameter");if((0,Ri.isNullish)(e))throw new Error("Missing privateKey parameter");const r=(0,Ri.legacyToBuffer)(t),n=(0,Aa.hashPersonalMessage)(r),i=(0,Aa.ecsign)(n,e);return(0,Ri.concatSig)((0,Aa.toBuffer)(i.v),i.r,i.s)}us.personalSign=vO;function _O({data:e,signature:t}){if((0,Ri.isNullish)(e))throw new Error("Missing data parameter");if((0,Ri.isNullish)(t))throw new Error("Missing signature parameter");const r=_2(e,t),n=(0,Aa.publicToAddress)(r);return(0,Aa.bufferToHex)(n)}us.recoverPersonalSignature=_O;function EO({data:e,signature:t}){if((0,Ri.isNullish)(e))throw new Error("Missing data parameter");if((0,Ri.isNullish)(t))throw new Error("Missing signature parameter");return`0x${_2(e,t).toString("hex")}`}us.extractPublicKey=EO;function _2(e,t){const r=(0,Aa.hashPersonalMessage)((0,Ri.legacyToBuffer)(e));return(0,Ri.recoverPublicKey)(r,t)}var E2={},x2={},S2={},di={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ParserError=e.getErrorStack=e.getErrorMessage=void 0;const t=oe,r=s=>typeof s=="string"?s:s instanceof Error||(0,t.isObject)(s)&&(0,t.hasProperty)(s,"message")&&typeof s.message=="string"?s.message:"Unknown error.";e.getErrorMessage=r;const n=s=>{if(s instanceof Error)return s.stack};e.getErrorStack=n;class i extends Error{constructor(o,a){super(o),this.name="ParserError";const c=(0,e.getErrorStack)(a);c&&(this.stack=c)}}e.ParserError=i})(di);var mp={},wl={};Object.defineProperty(wl,"__esModule",{value:!0}),wl.iterate=void 0;const A2=oe,xO=function*(e,t=32){for(let r=0;r{(0,A2.assert)(s>=0,"Cannot skip a negative number of bytes."),(0,A2.assert)(s%t===0,"Length must be a multiple of the size."),r+=s},i=e.subarray(r);yield{skip:n,value:i}}return{skip:()=>{},value:new Uint8Array}};wl.iterate=xO;var bp={},B2={},Ps={},Us={};Object.defineProperty(Us,"__esModule",{value:!0}),Us.padEnd=Us.padStart=Us.set=void 0;const vp=oe,I2=32,SO=(e,t,r)=>(0,vp.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);Us.set=SO;const AO=(e,t=I2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,vp.concatBytes)([r,e])};Us.padStart=AO;const BO=(e,t=I2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,vp.concatBytes)([e,r])};Us.padEnd=BO,function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(Us,e)}(Ps),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.address=e.getAddress=void 0;const t=oe,r=di,n=Ps,i=s=>{const o=(0,t.createBytes)(s);return(0,t.assert)(o.length<=20,new r.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${o.length} bytes.`)),(0,n.padStart)(o,20)};e.getAddress=i,e.address={isDynamic:!1,isType:s=>s==="address",getByteLength(){return 32},encode({buffer:s,value:o,packed:a}){const c=(0,e.getAddress)(o);if(a)return(0,t.concatBytes)([s,c]);const u=(0,n.padStart)(c);return(0,t.concatBytes)([s,u])},decode({value:s}){return(0,t.add0x)((0,t.bytesToHex)(s.slice(12,32)))}}}(B2);var _p={},ml={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fixedBytes=e.getByteLength=void 0;const t=oe,r=di,n=Ps,i=/^bytes([0-9]{1,2})$/u,s=o=>{const a=o.match(i)?.[1];(0,t.assert)(a,`Invalid byte length. Expected a number between 1 and 32, but received "${o}".`);const c=Number(a);return(0,t.assert)(c>0&&c<=32,new r.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${o}".`)),c};e.getByteLength=s,e.fixedBytes={isDynamic:!1,isType(o){return i.test(o)},getByteLength(){return 32},encode({type:o,buffer:a,value:c,packed:u}){const l=(0,e.getByteLength)(o),y=(0,t.createBytes)(c);return(0,t.assert)(y.length<=l,new r.ParserError(`Expected a value of length ${l}, but received a value of length ${y.length}.`)),u?(0,t.concatBytes)([a,(0,n.padEnd)(y,l)]):(0,t.concatBytes)([a,(0,n.padEnd)(y)])},decode({type:o,value:a}){const c=(0,e.getByteLength)(o);return a.slice(0,c)}}})(ml);var Ep={},R2;function T2(){return R2||(R2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=oe,r=di,n=Tp(),i=/^\((.+)\)$/u,s=a=>i.test(a),o=a=>{(0,t.assert)(a.startsWith("(")&&a.endsWith(")"),new r.ParserError(`Invalid tuple type. Expected tuple type, but received "${a}".`));const c=[];let u="",l=0;for(let y=1;y{const l=(0,n.getParser)(u);return(0,n.isDynamicParser)(l,u)})},isType(a){return s(a)},getByteLength(a){return(0,n.isDynamicParser)(this,a)?32:(0,e.getTupleElements)(a).reduce((u,l)=>u+(0,n.getParser)(l).getByteLength(l),0)},encode({type:a,buffer:c,value:u,packed:l,tight:y}){const A=(0,e.getTupleElements)(a);return(0,n.pack)({types:A,values:u,byteArray:c,packed:l,tight:y})},decode({type:a,value:c,skip:u}){const l=(0,e.getTupleElements)(a),y=this.getByteLength(a)-32;return u(y),(0,n.unpack)(l,c)}}}(Ep)),Ep}var k2;function IO(){return k2||(k2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.array=e.getTupleType=e.getArrayType=e.isArrayType=void 0;const t=oe,r=di,n=Tp(),i=Ps,s=ml,o=T2(),a=/^(?.*)\[(?\d*?)\]$/u,c=y=>a.test(y);e.isArrayType=c;const u=y=>{const A=y.match(a);return(0,t.assert)(A?.groups?.type,new r.ParserError(`Invalid array type. Expected an array type, but received "${y}".`)),[A.groups.type,A.groups.length?parseInt(A.groups.length,10):void 0]};e.getArrayType=u;const l=(y,A)=>`(${new Array(A).fill(y).join(",")})`;e.getTupleType=l,e.array={isDynamic(y){const[A,v]=(0,e.getArrayType)(y);return v===void 0||(0,n.isDynamicParser)((0,n.getParser)(A),A)},isType(y){return(0,e.isArrayType)(y)},getByteLength(y){(0,t.assert)((0,e.isArrayType)(y),new r.ParserError(`Expected an array type, but received "${y}".`));const[A,v]=(0,e.getArrayType)(y);return!(0,n.isDynamicParser)(this,y)&&v!==void 0?o.tuple.getByteLength((0,e.getTupleType)(A,v)):32},encode({type:y,buffer:A,value:v,packed:R,tight:O}){const[P,H]=(0,e.getArrayType)(y);if((0,t.assert)(!R||!(0,e.isArrayType)(P),new r.ParserError("Cannot pack nested arrays.")),R&&(0,n.isDynamicParser)((0,n.getParser)(P),P))return(0,n.pack)({types:new Array(v.length).fill(P),values:v,byteArray:A,packed:R,arrayPacked:!0,tight:O});if(H)return(0,t.assert)(H===v.length,new r.ParserError(`Array length does not match type length. Expected a length of ${H}, but received ${v.length}.`)),o.tuple.encode({type:(0,e.getTupleType)(P,H),buffer:A,value:v,packed:s.fixedBytes.isType(P)&&O,tight:O});if(R)return(0,n.pack)({types:new Array(v.length).fill(P),values:v,byteArray:A,packed:s.fixedBytes.isType(P)&&O,arrayPacked:!0,tight:O});const F=(0,i.padStart)((0,t.numberToBytes)(v.length));return(0,n.pack)({types:new Array(v.length).fill(P),values:v,byteArray:(0,t.concatBytes)([A,F]),packed:R,tight:O})},decode({type:y,value:A,...v}){const[R,O]=(0,e.getArrayType)(y);if(O){const H=o.tuple.decode({type:(0,e.getTupleType)(R,O),value:A,...v});return(0,t.assert)(H.length===O,new r.ParserError(`Array length does not match type length. Expected a length of ${O}, but received ${H.length}.`)),H}const P=(0,t.bytesToNumber)(A.subarray(0,32));return(0,n.unpack)(new Array(P).fill(R),A.subarray(32))}}}(_p)),_p}var C2={};class L2 extends TypeError{constructor(t,r){let n;const{message:i,explanation:s,...o}=t,{path:a}=t,c=a.length===0?i:`At path: ${a.join(".")} -- ${i}`;super(s??c),s!=null&&(this.cause=c),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[t,...r()])}}function RO(e){return ei(e)&&typeof e[Symbol.iterator]=="function"}function ei(e){return typeof e=="object"&&e!=null}function $2(e){if(Object.prototype.toString.call(e)!=="[object Object]")return!1;const t=Object.getPrototypeOf(e);return t===null||t===Object.prototype}function Pr(e){return typeof e=="symbol"?e.toString():typeof e=="string"?JSON.stringify(e):`${e}`}function TO(e){const{done:t,value:r}=e.next();return t?void 0:r}function kO(e,t,r,n){if(e===!0)return;e===!1?e={}:typeof e=="string"&&(e={message:e});const{path:i,branch:s}=t,{type:o}=r,{refinement:a,message:c=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${Pr(n)}\``}=e;return{value:n,type:o,refinement:a,key:i[i.length-1],path:i,branch:s,...e,message:c}}function*xp(e,t,r,n){RO(e)||(e=[e]);for(const i of e){const s=kO(i,t,r,n);s&&(yield s)}}function*Sp(e,t,r={}){const{path:n=[],branch:i=[e],coerce:s=!1,mask:o=!1}=r,a={path:n,branch:i};if(s&&(e=t.coercer(e,a),o&&t.type!=="type"&&ei(t.schema)&&ei(e)&&!Array.isArray(e)))for(const u in e)t.schema[u]===void 0&&delete e[u];let c="valid";for(const u of t.validator(e,a))u.explanation=r.message,c="not_valid",yield[u,void 0];for(let[u,l,y]of t.entries(e,a)){const A=Sp(l,y,{path:u===void 0?n:[...n,u],branch:u===void 0?i:[...i,l],coerce:s,mask:o,message:r.message});for(const v of A)v[0]?(c=v[0].refinement!=null?"not_refined":"not_valid",yield[v[0],void 0]):s&&(l=v[1],u===void 0?e=l:e instanceof Map?e.set(u,l):e instanceof Set?e.add(l):ei(e)&&(l!==void 0||u in e)&&(e[u]=l))}if(c!=="not_valid")for(const u of t.refiner(e,a))u.explanation=r.message,c="not_refined",yield[u,void 0];c==="valid"&&(yield[void 0,e])}class Rr{constructor(t){const{type:r,schema:n,validator:i,refiner:s,coercer:o=c=>c,entries:a=function*(){}}=t;this.type=r,this.schema=n,this.entries=a,this.coercer=o,i?this.validator=(c,u)=>{const l=i(c,u);return xp(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return xp(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return O2(t,this,r)}create(t,r){return M2(t,this,r)}is(t){return Ap(t,this)}mask(t,r){return N2(t,this,r)}validate(t,r={}){return Ba(t,this,r)}}function O2(e,t,r){const n=Ba(e,t,{message:r});if(n[0])throw n[0]}function M2(e,t,r){const n=Ba(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function N2(e,t,r){const n=Ba(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Ap(e,t){return!Ba(e,t)[0]}function Ba(e,t,r={}){const n=Sp(e,t,r),i=TO(n);return i[0]?[new L2(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function CO(...e){const t=e[0].type==="type",r=e.map(i=>i.schema),n=Object.assign({},...r);return t?Vc(n):qc(n)}function Sn(e,t){return new Rr({type:e,schema:null,validator:t})}function LO(e,t){return new Rr({...e,refiner:(r,n)=>r===void 0||e.refiner(r,n),validator(r,n){return r===void 0?!0:(t(r,n),e.validator(r,n))}})}function $O(e){return new Rr({type:"dynamic",schema:null,*entries(t,r){yield*e(t,r).entries(t,r)},validator(t,r){return e(t,r).validator(t,r)},coercer(t,r){return e(t,r).coercer(t,r)},refiner(t,r){return e(t,r).refiner(t,r)}})}function OO(e){let t;return new Rr({type:"lazy",schema:null,*entries(r,n){t??(t=e()),yield*t.entries(r,n)},validator(r,n){return t??(t=e()),t.validator(r,n)},coercer(r,n){return t??(t=e()),t.coercer(r,n)},refiner(r,n){return t??(t=e()),t.refiner(r,n)}})}function MO(e,t){const{schema:r}=e,n={...r};for(const i of t)delete n[i];switch(e.type){case"type":return Vc(n);default:return qc(n)}}function NO(e){const t=e instanceof Rr,r=t?{...e.schema}:{...e};for(const n in r)r[n]=P2(r[n]);return t&&e.type==="type"?Vc(r):qc(r)}function PO(e,t){const{schema:r}=e,n={};for(const i of t)n[i]=r[i];switch(e.type){case"type":return Vc(n);default:return qc(n)}}function UO(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Sn(e,t)}function FO(){return Sn("any",()=>!0)}function DO(e){return new Rr({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(const[r,n]of t.entries())yield[r,n,e]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Pr(t)}`}})}function HO(){return Sn("bigint",e=>typeof e=="bigint")}function jO(){return Sn("boolean",e=>typeof e=="boolean")}function zO(){return Sn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Pr(e)}`)}function qO(e){const t={},r=e.map(n=>Pr(n)).join();for(const n of e)t[n]=n;return new Rr({type:"enums",schema:t,validator(n){return e.includes(n)||`Expected one of \`${r}\`, but received: ${Pr(n)}`}})}function VO(){return Sn("func",e=>typeof e=="function"||`Expected a function, but received: ${Pr(e)}`)}function WO(e){return Sn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Pr(t)}`)}function KO(){return Sn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Pr(e)}`)}function ZO(e){return new Rr({type:"intersection",schema:null,*entries(t,r){for(const n of e)yield*n.entries(t,r)},*validator(t,r){for(const n of e)yield*n.validator(t,r)},*refiner(t,r){for(const n of e)yield*n.refiner(t,r)}})}function GO(e){const t=Pr(e),r=typeof e;return new Rr({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?e:null,validator(n){return n===e||`Expected the literal \`${t}\`, but received: ${Pr(n)}`}})}function YO(e,t){return new Rr({type:"map",schema:null,*entries(r){if(e&&t&&r instanceof Map)for(const[n,i]of r.entries())yield[n,n,e],yield[n,i,t]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${Pr(r)}`}})}function Bp(){return Sn("never",()=>!1)}function XO(e){return new Rr({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function JO(){return Sn("number",e=>typeof e=="number"&&!isNaN(e)||`Expected a number, but received: ${Pr(e)}`)}function qc(e){const t=e?Object.keys(e):[],r=Bp();return new Rr({type:"object",schema:e||null,*entries(n){if(e&&ei(n)){const i=new Set(Object.keys(n));for(const s of t)i.delete(s),yield[s,n[s],e[s]];for(const s of i)yield[s,n[s],r]}},validator(n){return ei(n)||`Expected an object, but received: ${Pr(n)}`},coercer(n){return ei(n)?{...n}:n}})}function P2(e){return new Rr({...e,validator:(t,r)=>t===void 0||e.validator(t,r),refiner:(t,r)=>t===void 0||e.refiner(t,r)})}function QO(e,t){return new Rr({type:"record",schema:null,*entries(r){if(ei(r))for(const n in r){const i=r[n];yield[n,n,e],yield[n,i,t]}},validator(r){return ei(r)||`Expected an object, but received: ${Pr(r)}`}})}function eM(){return Sn("regexp",e=>e instanceof RegExp)}function tM(e){return new Rr({type:"set",schema:null,*entries(t){if(e&&t instanceof Set)for(const r of t)yield[r,r,e]},coercer(t){return t instanceof Set?new Set(t):t},validator(t){return t instanceof Set||`Expected a \`Set\` object, but received: ${Pr(t)}`}})}function U2(){return Sn("string",e=>typeof e=="string"||`Expected a string, but received: ${Pr(e)}`)}function rM(e){const t=Bp();return new Rr({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(e.length,r.length);for(let i=0;ir.type).join(" | ");return new Rr({type:"union",schema:null,coercer(r){for(const n of e){const[i,s]=n.validate(r,{coerce:!0});if(!i)return s}return r},validator(r,n){const i=[];for(const s of e){const[...o]=Sp(r,s,n),[a]=o;if(a[0])for(const[c]of o)c&&i.push(c);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Pr(r)}`,...i]}})}function F2(){return Sn("unknown",()=>!0)}function Ip(e,t,r){return new Rr({...e,coercer:(n,i)=>Ap(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function iM(e,t,r={}){return Ip(e,F2(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&$2(n)&&$2(i)){const s={...n};let o=!1;for(const a in i)s[a]===void 0&&(s[a]=i[a],o=!0);if(o)return s}return n})}function sM(e){return Ip(e,U2(),t=>t.trim())}function oM(e){return Eo(e,"empty",t=>{const r=D2(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function D2(e){return e instanceof Map||e instanceof Set?e.size:e.length}function aM(e,t,r={}){const{exclusive:n}=r;return Eo(e,"max",i=>n?in?i>t:i>=t||`Expected a ${e.type} greater than ${n?"":"or equal to "}${t} but received \`${i}\``)}function fM(e){return Eo(e,"nonempty",t=>D2(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function uM(e,t){return Eo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function lM(e,t,r=t){const n=`Expected a ${e.type}`,i=t===r?`of \`${t}\``:`between \`${t}\` and \`${r}\``;return Eo(e,"size",s=>{if(typeof s=="number"||s instanceof Date)return t<=s&&s<=r||`${n} ${i} but received \`${s}\``;if(s instanceof Map||s instanceof Set){const{size:o}=s;return t<=o&&o<=r||`${n} with a size ${i} but received one with a size of \`${o}\``}else{const{length:o}=s;return t<=o&&o<=r||`${n} with a length ${i} but received one with a length of \`${o}\``}})}function Eo(e,t,r){return new Rr({...e,*refiner(n,i){yield*e.refiner(n,i);const s=r(n,i),o=xp(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var hM=Object.freeze({__proto__:null,Struct:Rr,StructError:L2,any:FO,array:DO,assert:O2,assign:CO,bigint:HO,boolean:jO,coerce:Ip,create:M2,date:zO,defaulted:iM,define:Sn,deprecated:LO,dynamic:$O,empty:oM,enums:qO,func:VO,instance:WO,integer:KO,intersection:ZO,is:Ap,lazy:OO,literal:GO,map:YO,mask:N2,max:aM,min:cM,never:Bp,nonempty:fM,nullable:XO,number:JO,object:qc,omit:MO,optional:P2,partial:NO,pattern:uM,pick:PO,record:QO,refine:Eo,regexp:eM,set:tM,size:lM,string:U2,struct:UO,trimmed:sM,tuple:rM,type:Vc,union:nM,unknown:F2,validate:Ba}),H2=Un(hM),Rp={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.number=e.getBigInt=e.assertNumberLength=e.getLength=e.isSigned=void 0;const t=oe,r=di,n=Ps,i=/^u?int(?[0-9]*)?$/u,s=u=>!u.startsWith("u");e.isSigned=s;const o=u=>{if(u==="int"||u==="uint")return 256;const l=u.match(i);(0,t.assert)(l?.groups?.length,new r.ParserError(`Invalid number type. Expected a number type, but received "${u}".`));const y=parseInt(l.groups.length,10);return(0,t.assert)(y>=8&&y<=256,new r.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${u}".`)),(0,t.assert)(y%8===0,new r.ParserError(`Invalid number length. Expected a multiple of 8, but received "${u}".`)),y};e.getLength=o;const a=(u,l)=>{const y=(0,e.getLength)(l),A=BigInt(2)**BigInt(y-((0,e.isSigned)(l)?1:0))-BigInt(1);if((0,e.isSigned)(l)){(0,t.assert)(u>=-(A+BigInt(1))&&u<=A,new r.ParserError(`Number "${u}" is out of range for type "${l}".`));return}(0,t.assert)(u<=A,new r.ParserError(`Number "${u}" is out of range for type "${l}".`))};e.assertNumberLength=a;const c=u=>{try{return(0,t.createBigInt)(u)}catch{throw new r.ParserError(`Invalid number. Expected a valid number value, but received "${u}".`)}};e.getBigInt=c,e.number={isDynamic:!1,isType(u){return i.test(u)},getByteLength(){return 32},encode({type:u,buffer:l,value:y,packed:A}){const v=(0,e.getBigInt)(y);if((0,e.assertNumberLength)(v,u),(0,e.isSigned)(u)){if(A){const R=(0,e.getLength)(u)/8;return(0,t.concatBytes)([l,(0,t.signedBigIntToBytes)(v,R)])}return(0,t.concatBytes)([l,(0,n.padStart)((0,t.signedBigIntToBytes)(v,32))])}if(A){const R=(0,e.getLength)(u)/8;return(0,t.concatBytes)([l,(0,n.padStart)((0,t.bigIntToBytes)(v),R)])}return(0,t.concatBytes)([l,(0,n.padStart)((0,t.bigIntToBytes)(v))])},decode({type:u,value:l}){const y=l.subarray(0,32);if((0,e.isSigned)(u)){const v=(0,t.bytesToSignedBigInt)(y);return(0,e.assertNumberLength)(v,u),v}const A=(0,t.bytesToBigInt)(y);return(0,e.assertNumberLength)(A,u),A}}})(Rp),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=oe,r=H2,n=di,i=Rp,s=(0,r.coerce)((0,r.boolean)(),(0,r.union)([(0,r.literal)("true"),(0,r.literal)("false")]),a=>a==="true"),o=a=>{try{return(0,r.create)(a,s)?BigInt(1):BigInt(0)}catch{throw new n.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${a}".`)}};e.getBooleanValue=o,e.bool={isDynamic:!1,isType:a=>a==="bool",getByteLength(){return 32},encode({buffer:a,value:c,packed:u,tight:l}){const y=(0,e.getBooleanValue)(c);return u?(0,t.concatBytes)([a,(0,t.bigIntToBytes)(y)]):i.number.encode({type:"uint256",buffer:a,value:y,packed:u,tight:l})},decode(a){return i.number.decode({...a,type:"uint256"})===BigInt(1)}}}(C2);var Wc={};Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.bytes=void 0;const Kc=oe,j2=Ps;Wc.bytes={isDynamic:!0,isType:e=>e==="bytes",getByteLength(){return 32},encode({buffer:e,value:t,packed:r}){const n=(0,Kc.createBytes)(t);if(r)return(0,Kc.concatBytes)([e,n]);const i=Math.ceil(n.byteLength/32)*32;return(0,Kc.concatBytes)([e,(0,j2.padStart)((0,Kc.numberToBytes)(n.byteLength)),(0,j2.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,Kc.bytesToNumber)(t);return e.slice(32,32+r)}};var z2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=oe,r=H2,n=di,i=ml,s=(0,r.coerce)((0,r.object)({address:t.StrictHexStruct,selector:t.StrictHexStruct}),(0,r.union)([t.StrictHexStruct,(0,r.instance)(Uint8Array)]),a=>{const c=(0,t.createBytes)(a);return(0,t.assert)(c.length===24,new n.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${c.length} bytes.`)),{address:(0,t.bytesToHex)(c.subarray(0,20)),selector:(0,t.bytesToHex)(c.subarray(20,24))}}),o=a=>{const c=(0,r.create)(a,s);return(0,t.concatBytes)([(0,t.hexToBytes)(c.address),(0,t.hexToBytes)(c.selector)])};e.getFunction=o,e.fn={isDynamic:!1,isType:a=>a==="function",getByteLength(){return 32},encode({buffer:a,value:c,packed:u,tight:l}){const y=(0,e.getFunction)(c);return i.fixedBytes.encode({type:"bytes24",buffer:a,value:y,packed:u,tight:l})},decode({value:a}){return{address:(0,t.bytesToHex)(a.slice(0,20)),selector:(0,t.bytesToHex)(a.slice(20,24))}}}})(z2);var q2={};Object.defineProperty(q2,"__esModule",{value:!0});var bl={};Object.defineProperty(bl,"__esModule",{value:!0}),bl.string=void 0;const V2=oe,W2=Wc;bl.string={isDynamic:!0,isType:e=>e==="string",getByteLength(){return 32},encode({buffer:e,value:t,packed:r,tight:n}){return W2.bytes.encode({type:"bytes",buffer:e,value:(0,V2.stringToBytes)(t),packed:r,tight:n})},decode(e){return(0,V2.bytesToString)(W2.bytes.decode(e))}};var K2;function Z2(){return K2||(K2=1,function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(B2,e),r(IO(),e),r(C2,e),r(Wc,e),r(ml,e),r(z2,e),r(Rp,e),r(q2,e),r(bl,e),r(T2(),e)}(bp)),bp}var G2;function Tp(){return G2||(G2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=e.pack=e.isDynamicParser=e.getParser=void 0;const t=oe,r=di,n=wl,i=Z2(),s=Ps,o=l=>{const y={address:i.address,array:i.array,bool:i.bool,bytes:i.bytes,fixedBytes:i.fixedBytes,function:i.fn,number:i.number,string:i.string,tuple:i.tuple},A=y[l];if(A)return A;const v=Object.values(y).find(R=>R.isType(l));if(v)return v;throw new r.ParserError(`The type "${l}" is not supported.`)};e.getParser=o;const a=(l,y)=>{const{isDynamic:A}=l;return typeof A=="function"?A(y):A};e.isDynamicParser=a;const c=({types:l,values:y,packed:A=!1,tight:v=!1,arrayPacked:R=!1,byteArray:O=new Uint8Array})=>{(0,t.assert)(l.length===y.length,new r.ParserError(`The number of types (${l.length}) does not match the number of values (${y.length}).`));const{staticBuffer:P,dynamicBuffer:H,pointers:F}=l.reduce(({staticBuffer:q,dynamicBuffer:G,pointers:Z},z,ee)=>{const se=(0,e.getParser)(z),Q=y[ee];if(A||R||!(0,e.isDynamicParser)(se,z))return{staticBuffer:se.encode({buffer:q,value:Q,type:z,packed:A,tight:v}),dynamicBuffer:G,pointers:Z};const I=(0,t.concatBytes)([q,new Uint8Array(32)]),g=se.encode({buffer:G,value:Q,type:z,packed:A,tight:v});return{staticBuffer:I,dynamicBuffer:g,pointers:[...Z,{position:q.length,pointer:G.length}]}},{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,t.assert)(!A&&!R||H.length===0,new r.ParserError("Invalid pack state."));const N=P.length,$=F.reduce((q,{pointer:G,position:Z})=>{const z=(0,s.padStart)((0,t.numberToBytes)(N+G));return(0,s.set)(q,z,Z)},P);return(0,t.concatBytes)([O,$,H])};e.pack=c;const u=(l,y)=>{const A=(0,n.iterate)(y);return l.map(v=>{const{value:{value:R,skip:O},done:P}=A.next();(0,t.assert)(!P,new r.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${v}".`));const H=(0,e.getParser)(v);if((0,e.isDynamicParser)(H,v)){const N=(0,t.bytesToNumber)(R.subarray(0,32)),$=y.subarray(N);return H.decode({type:v,value:$,skip:O})}return H.decode({type:v,value:R,skip:O})})};e.unpack=u}(mp)),mp}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSingle=e.decode=e.encodePacked=e.encodeSingle=e.encode=void 0;const t=oe,r=di,n=Tp(),i=(u,l,y,A)=>{try{return(0,n.pack)({types:u,values:l,packed:y,tight:A})}catch(v){throw v instanceof r.ParserError?new r.ParserError(`Unable to encode value: ${v.message}`,v):new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(v)}`,v)}};e.encode=i;const s=(u,l)=>(0,e.encode)([u],[l]);e.encodeSingle=s;const o=(u,l,y)=>(0,e.encode)(u,l,!0,y);e.encodePacked=o;const a=(u,l)=>{const y=(0,t.createBytes)(l);try{return(0,n.unpack)(u,y)}catch(A){throw A instanceof r.ParserError?new r.ParserError(`Unable to decode value: ${A.message}`,A):new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(A)}`,A)}};e.decode=a;const c=(u,l)=>{const y=(0,e.decode)([u],l);return(0,t.assert)(y.length===1,new r.ParserError("Decoded value array has unexpected length.")),y[0]};e.decodeSingle=c})(S2);var Y2={},X2={};Object.defineProperty(X2,"__esModule",{value:!0}),function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(X2,e)}(Y2),function(e){var t=ft&&ft.__createBinding||(Object.create?function(n,i,s,o){o===void 0&&(o=s);var a=Object.getOwnPropertyDescriptor(i,s);(!a||("get"in a?!i.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return i[s]}}),Object.defineProperty(n,o,a)}:function(n,i,s,o){o===void 0&&(o=s),n[o]=i[s]}),r=ft&&ft.__exportStar||function(n,i){for(var s in n)s!=="default"&&!Object.prototype.hasOwnProperty.call(i,s)&&t(i,n,s)};Object.defineProperty(e,"__esModule",{value:!0}),r(S2,e),r(di,e),r(Y2,e)}(x2),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.recoverTypedSignature=e.signTypedData=e.typedSignatureHash=e.TypedDataUtils=e.TYPED_MESSAGE_SCHEMA=e.SignTypedDataVersion=void 0;const t=Xf,r=x2,n=Z2(),i=Ps,s=oe,o=Wn,a=Qr;var c;(function(I){I.V1="V1",I.V3="V3",I.V4="V4"})(c=e.SignTypedDataVersion||(e.SignTypedDataVersion={})),e.TYPED_MESSAGE_SCHEMA={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]};function u(I,g){if(Object.keys(c).includes(I)){if(g&&!g.includes(I))throw new Error(`SignTypedDataVersion not allowed: '${I}'. Allowed versions are: ${g.join(", ")}`)}else throw new Error(`Invalid version: '${I}'`)}function l(I,g){(0,s.assert)(g!==null,`Unable to encode value: Invalid number. Expected a valid number value, but received "${g}".`);const f=BigInt(g),h=(0,n.getLength)(I),m=BigInt(2)**BigInt(h)-BigInt(1);return(0,s.assert)(f>=-m&&f<=m,`Unable to encode value: Number "${g}" is out of range for type "${I}".`),f}function y(I){let g=BigInt(0);for(let f=0;f=49?g+=h-BigInt(49)+BigInt(10):h>=17?g+=h-BigInt(17)+BigInt(10):g+=h}return(0,i.padStart)((0,s.bigIntToBytes)(g),20)}function A(I,g,f,h,m){if(u(m,[c.V3,c.V4]),I[f]!==void 0)return["bytes32",m===c.V4&&h==null?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,o.keccak256)(v(f,h,I,m)))];if(f==="function")throw new Error('Unsupported or invalid type: "function"');if(h===void 0)throw new Error(`missing value for field ${g} of type ${f}`);if(f==="address"){if(typeof h=="number")return["address",(0,i.padStart)((0,s.numberToBytes)(h),20)];if((0,s.isStrictHexString)(h))return["address",(0,s.add0x)(h)];if(typeof h=="string")return["address",y(h).subarray(0,20)]}if(f==="bool")return["bool",!!h];if(f==="bytes")return typeof h=="number"?h=(0,s.numberToBytes)(h):(0,s.isStrictHexString)(h)||h==="0x"?h=(0,s.hexToBytes)(h):typeof h=="string"&&(h=(0,s.stringToBytes)(h)),["bytes32",(0,t.arrToBufArr)((0,o.keccak256)(h))];if(f.startsWith("bytes")&&f!=="bytes"&&!f.includes("["))return typeof h=="number"?h<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,s.bigIntToBytes)(BigInt(h))]:(0,s.isStrictHexString)(h)?["bytes32",(0,s.hexToBytes)(h)]:["bytes32",h];if(f.startsWith("int")&&!f.includes("[")){const _=l(f,h);return _>=BigInt(0)?["uint256",_]:["int256",_]}if(f==="string")return typeof h=="number"?h=(0,s.numberToBytes)(h):h=(0,s.stringToBytes)(h??""),["bytes32",(0,t.arrToBufArr)((0,o.keccak256)(h))];if(f.endsWith("]")){if(m===c.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const _=f.slice(0,f.lastIndexOf("[")),E=h.map(x=>A(I,g,_,x,m));return["bytes32",(0,t.arrToBufArr)((0,o.keccak256)((0,r.encode)(E.map(([x])=>x),E.map(([,x])=>x))))]}return[f,h]}function v(I,g,f,h){u(h,[c.V3,c.V4]);const m=["bytes32"],_=[H(I,f)];for(const E of f[I]){if(h===c.V3&&g[E.name]===void 0)continue;const[x,T]=A(f,E.name,E.type,g[E.name],h);m.push(x),_.push(T)}return(0,t.arrToBufArr)((0,r.encode)(m,_))}function R(I,g){let f="";const h=O(I,g);h.delete(I);const m=[I,...Array.from(h).sort()];for(const _ of m){if(!g[_])throw new Error(`No type definition specified: ${_}`);f+=`${_}(${g[_].map(({name:x,type:T})=>`${T} ${x}`).join(",")})`}return f}function O(I,g,f=new Set){if(typeof I!="string")throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(I)}`);if([I]=I.match(/^\w*/u),f.has(I)||g[I]===void 0)return f;f.add(I);for(const m of g[I])O(m.type,g,f);return f}function P(I,g,f,h){u(h,[c.V3,c.V4]);const m=v(I,g,f,h),_=(0,o.keccak256)(m);return(0,t.arrToBufArr)(_)}function H(I,g){const f=(0,s.stringToBytes)(R(I,g));return(0,t.arrToBufArr)((0,o.keccak256)(f))}function F(I){const g={};for(const f in e.TYPED_MESSAGE_SCHEMA.properties)I[f]&&(g[f]=I[f]);return"types"in g&&(g.types=Object.assign({EIP712Domain:[]},g.types)),g}function N(I,g){u(g,[c.V3,c.V4]);const f=F(I),{domain:h}=f,m={EIP712Domain:f.types.EIP712Domain};return P("EIP712Domain",h,m,g)}function $(I,g){u(g,[c.V3,c.V4]);const f=F(I),h=[(0,s.hexToBytes)("1901")];return h.push(N(I,g)),f.primaryType!=="EIP712Domain"&&h.push(P(f.primaryType,f.message,f.types,g)),(0,t.arrToBufArr)((0,o.keccak256)((0,s.concatBytes)(h)))}e.TypedDataUtils={encodeData:v,encodeType:R,findTypeDependencies:O,hashStruct:P,hashType:H,sanitizeData:F,eip712Hash:$,eip712DomainHash:N};function q(I){const g=ee(I);return(0,s.bytesToHex)(g)}e.typedSignatureHash=q;function G(I,g){if((0,n.isArrayType)(I)&&Array.isArray(g)){const[f]=(0,n.getArrayType)(I);return g.map(h=>G(f,h))}if(I==="address"){if(typeof g=="number")return(0,i.padStart)((0,s.numberToBytes)(g),20);if((0,s.isStrictHexString)(g))return(0,i.padStart)((0,s.hexToBytes)(g).subarray(0,20),20);if(g instanceof Uint8Array)return(0,i.padStart)(g.subarray(0,20),20)}if(I==="bool")return!!g;if(I.startsWith("bytes")&&I!=="bytes"){const f=(0,n.getByteLength)(I);if(typeof g=="number")return g<0?new Uint8Array:(0,s.numberToBytes)(g).subarray(0,f);if((0,s.isStrictHexString)(g))return(0,s.hexToBytes)(g).subarray(0,f);if(g instanceof Uint8Array)return g.subarray(0,f)}if(I.startsWith("uint")&&typeof g=="number")return Math.abs(g);if(I.startsWith("int")&&typeof g=="number"){const f=(0,n.getLength)(I);return BigInt.asIntN(f,BigInt(g))}return g}function Z(I){return I.map(g=>typeof g=="number"?(0,i.padStart)((0,s.numberToBytes)(g),32):(0,s.isStrictHexString)(g)?(0,i.padStart)((0,s.hexToBytes)(g).subarray(0,32),32):g instanceof Uint8Array?(0,i.padStart)(g.subarray(0,32),32):g)}function z(I,g){return g.map(f=>{if(typeof f=="string"||typeof f=="number"||typeof f=="bigint"){const h=l(I,f);if(h>=BigInt(0))return(0,i.padStart)((0,s.bigIntToBytes)(h),32);const m=(0,n.getLength)(I),_=BigInt.asIntN(m,h);return(0,s.signedBigIntToBytes)(_,32)}return f})}function ee(I){const g=new Error("Expect argument to be non-empty array");if(typeof I!="object"||!("length"in I)||!I.length)throw g;const f=I.map(({name:E,type:x,value:T})=>{if(x==="address[]")return{name:E,type:"bytes32[]",value:Z(T)};if(x.startsWith("int")&&(0,n.isArrayType)(x)){const[B,d]=(0,n.getArrayType)(x);return{name:E,type:`bytes32[${d??""}]`,value:z(B,T)}}return{name:E,type:x,value:G(x,T)}}),h=f.map(E=>E.type!=="bytes"?E.value:(0,a.legacyToBuffer)(E.value)),m=f.map(E=>{if(E.type==="function")throw new Error('Unsupported or invalid type: "function"');return E.type}),_=I.map(E=>{if(!E.name)throw g;return`${E.type} ${E.name}`});return(0,t.arrToBufArr)((0,o.keccak256)((0,r.encodePacked)(["bytes32","bytes32"],[(0,o.keccak256)((0,r.encodePacked)(["string[]"],[_],!0)),(0,o.keccak256)((0,r.encodePacked)(m,h,!0))])))}function se({privateKey:I,data:g,version:f}){if(u(f),(0,a.isNullish)(g))throw new Error("Missing data parameter");if((0,a.isNullish)(I))throw new Error("Missing private key parameter");const h=f===c.V1?ee(g):e.TypedDataUtils.eip712Hash(g,f),m=(0,t.ecsign)(h,I);return(0,a.concatSig)((0,t.arrToBufArr)((0,s.bigIntToBytes)(m.v)),m.r,m.s)}e.signTypedData=se;function Q({data:I,signature:g,version:f}){if(u(f),(0,a.isNullish)(I))throw new Error("Missing data parameter");if((0,a.isNullish)(g))throw new Error("Missing signature parameter");const h=f===c.V1?ee(I):e.TypedDataUtils.eip712Hash(I,f),m=(0,a.recoverPublicKey)(h,g),_=(0,t.publicToAddress)(m);return(0,s.bytesToHex)(_)}e.recoverTypedSignature=Q}(E2);var ti={},J2={exports:{}};(function(e){(function(t){var r=function(S){var L,M=new Float64Array(16);if(S)for(L=0;L>24&255,S[L+1]=M>>16&255,S[L+2]=M>>8&255,S[L+3]=M&255,S[L+4]=p>>24&255,S[L+5]=p>>16&255,S[L+6]=p>>8&255,S[L+7]=p&255}function O(S,L,M,p,U){var J,Y=0;for(J=0;J>>8)-1}function P(S,L,M,p){return O(S,L,M,p,16)}function H(S,L,M,p){return O(S,L,M,p,32)}function F(S,L,M,p){for(var U=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,J=M[0]&255|(M[1]&255)<<8|(M[2]&255)<<16|(M[3]&255)<<24,Y=M[4]&255|(M[5]&255)<<8|(M[6]&255)<<16|(M[7]&255)<<24,ue=M[8]&255|(M[9]&255)<<8|(M[10]&255)<<16|(M[11]&255)<<24,_e=M[12]&255|(M[13]&255)<<8|(M[14]&255)<<16|(M[15]&255)<<24,Ae=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Ee=L[0]&255|(L[1]&255)<<8|(L[2]&255)<<16|(L[3]&255)<<24,Bt=L[4]&255|(L[5]&255)<<8|(L[6]&255)<<16|(L[7]&255)<<24,Le=L[8]&255|(L[9]&255)<<8|(L[10]&255)<<16|(L[11]&255)<<24,Ke=L[12]&255|(L[13]&255)<<8|(L[14]&255)<<16|(L[15]&255)<<24,Ye=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,lt=M[16]&255|(M[17]&255)<<8|(M[18]&255)<<16|(M[19]&255)<<24,ct=M[20]&255|(M[21]&255)<<8|(M[22]&255)<<16|(M[23]&255)<<24,Xe=M[24]&255|(M[25]&255)<<8|(M[26]&255)<<16|(M[27]&255)<<24,rt=M[28]&255|(M[29]&255)<<8|(M[30]&255)<<16|(M[31]&255)<<24,Je=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,$e=U,De=J,Re=Y,Me=ue,Ne=_e,Ie=Ae,ce=Ee,fe=Bt,ye=Le,he=Ke,de=Ye,ve=lt,Ve=ct,gt=Xe,wt=rt,yt=Je,j,Et=0;Et<20;Et+=2)j=$e+Ve|0,Ne^=j<<7|j>>>32-7,j=Ne+$e|0,ye^=j<<9|j>>>32-9,j=ye+Ne|0,Ve^=j<<13|j>>>32-13,j=Ve+ye|0,$e^=j<<18|j>>>32-18,j=Ie+De|0,he^=j<<7|j>>>32-7,j=he+Ie|0,gt^=j<<9|j>>>32-9,j=gt+he|0,De^=j<<13|j>>>32-13,j=De+gt|0,Ie^=j<<18|j>>>32-18,j=de+ce|0,wt^=j<<7|j>>>32-7,j=wt+de|0,Re^=j<<9|j>>>32-9,j=Re+wt|0,ce^=j<<13|j>>>32-13,j=ce+Re|0,de^=j<<18|j>>>32-18,j=yt+ve|0,Me^=j<<7|j>>>32-7,j=Me+yt|0,fe^=j<<9|j>>>32-9,j=fe+Me|0,ve^=j<<13|j>>>32-13,j=ve+fe|0,yt^=j<<18|j>>>32-18,j=$e+Me|0,De^=j<<7|j>>>32-7,j=De+$e|0,Re^=j<<9|j>>>32-9,j=Re+De|0,Me^=j<<13|j>>>32-13,j=Me+Re|0,$e^=j<<18|j>>>32-18,j=Ie+Ne|0,ce^=j<<7|j>>>32-7,j=ce+Ie|0,fe^=j<<9|j>>>32-9,j=fe+ce|0,Ne^=j<<13|j>>>32-13,j=Ne+fe|0,Ie^=j<<18|j>>>32-18,j=de+he|0,ve^=j<<7|j>>>32-7,j=ve+de|0,ye^=j<<9|j>>>32-9,j=ye+ve|0,he^=j<<13|j>>>32-13,j=he+ye|0,de^=j<<18|j>>>32-18,j=yt+wt|0,Ve^=j<<7|j>>>32-7,j=Ve+yt|0,gt^=j<<9|j>>>32-9,j=gt+Ve|0,wt^=j<<13|j>>>32-13,j=wt+gt|0,yt^=j<<18|j>>>32-18;$e=$e+U|0,De=De+J|0,Re=Re+Y|0,Me=Me+ue|0,Ne=Ne+_e|0,Ie=Ie+Ae|0,ce=ce+Ee|0,fe=fe+Bt|0,ye=ye+Le|0,he=he+Ke|0,de=de+Ye|0,ve=ve+lt|0,Ve=Ve+ct|0,gt=gt+Xe|0,wt=wt+rt|0,yt=yt+Je|0,S[0]=$e>>>0&255,S[1]=$e>>>8&255,S[2]=$e>>>16&255,S[3]=$e>>>24&255,S[4]=De>>>0&255,S[5]=De>>>8&255,S[6]=De>>>16&255,S[7]=De>>>24&255,S[8]=Re>>>0&255,S[9]=Re>>>8&255,S[10]=Re>>>16&255,S[11]=Re>>>24&255,S[12]=Me>>>0&255,S[13]=Me>>>8&255,S[14]=Me>>>16&255,S[15]=Me>>>24&255,S[16]=Ne>>>0&255,S[17]=Ne>>>8&255,S[18]=Ne>>>16&255,S[19]=Ne>>>24&255,S[20]=Ie>>>0&255,S[21]=Ie>>>8&255,S[22]=Ie>>>16&255,S[23]=Ie>>>24&255,S[24]=ce>>>0&255,S[25]=ce>>>8&255,S[26]=ce>>>16&255,S[27]=ce>>>24&255,S[28]=fe>>>0&255,S[29]=fe>>>8&255,S[30]=fe>>>16&255,S[31]=fe>>>24&255,S[32]=ye>>>0&255,S[33]=ye>>>8&255,S[34]=ye>>>16&255,S[35]=ye>>>24&255,S[36]=he>>>0&255,S[37]=he>>>8&255,S[38]=he>>>16&255,S[39]=he>>>24&255,S[40]=de>>>0&255,S[41]=de>>>8&255,S[42]=de>>>16&255,S[43]=de>>>24&255,S[44]=ve>>>0&255,S[45]=ve>>>8&255,S[46]=ve>>>16&255,S[47]=ve>>>24&255,S[48]=Ve>>>0&255,S[49]=Ve>>>8&255,S[50]=Ve>>>16&255,S[51]=Ve>>>24&255,S[52]=gt>>>0&255,S[53]=gt>>>8&255,S[54]=gt>>>16&255,S[55]=gt>>>24&255,S[56]=wt>>>0&255,S[57]=wt>>>8&255,S[58]=wt>>>16&255,S[59]=wt>>>24&255,S[60]=yt>>>0&255,S[61]=yt>>>8&255,S[62]=yt>>>16&255,S[63]=yt>>>24&255}function N(S,L,M,p){for(var U=p[0]&255|(p[1]&255)<<8|(p[2]&255)<<16|(p[3]&255)<<24,J=M[0]&255|(M[1]&255)<<8|(M[2]&255)<<16|(M[3]&255)<<24,Y=M[4]&255|(M[5]&255)<<8|(M[6]&255)<<16|(M[7]&255)<<24,ue=M[8]&255|(M[9]&255)<<8|(M[10]&255)<<16|(M[11]&255)<<24,_e=M[12]&255|(M[13]&255)<<8|(M[14]&255)<<16|(M[15]&255)<<24,Ae=p[4]&255|(p[5]&255)<<8|(p[6]&255)<<16|(p[7]&255)<<24,Ee=L[0]&255|(L[1]&255)<<8|(L[2]&255)<<16|(L[3]&255)<<24,Bt=L[4]&255|(L[5]&255)<<8|(L[6]&255)<<16|(L[7]&255)<<24,Le=L[8]&255|(L[9]&255)<<8|(L[10]&255)<<16|(L[11]&255)<<24,Ke=L[12]&255|(L[13]&255)<<8|(L[14]&255)<<16|(L[15]&255)<<24,Ye=p[8]&255|(p[9]&255)<<8|(p[10]&255)<<16|(p[11]&255)<<24,lt=M[16]&255|(M[17]&255)<<8|(M[18]&255)<<16|(M[19]&255)<<24,ct=M[20]&255|(M[21]&255)<<8|(M[22]&255)<<16|(M[23]&255)<<24,Xe=M[24]&255|(M[25]&255)<<8|(M[26]&255)<<16|(M[27]&255)<<24,rt=M[28]&255|(M[29]&255)<<8|(M[30]&255)<<16|(M[31]&255)<<24,Je=p[12]&255|(p[13]&255)<<8|(p[14]&255)<<16|(p[15]&255)<<24,$e=U,De=J,Re=Y,Me=ue,Ne=_e,Ie=Ae,ce=Ee,fe=Bt,ye=Le,he=Ke,de=Ye,ve=lt,Ve=ct,gt=Xe,wt=rt,yt=Je,j,Et=0;Et<20;Et+=2)j=$e+Ve|0,Ne^=j<<7|j>>>32-7,j=Ne+$e|0,ye^=j<<9|j>>>32-9,j=ye+Ne|0,Ve^=j<<13|j>>>32-13,j=Ve+ye|0,$e^=j<<18|j>>>32-18,j=Ie+De|0,he^=j<<7|j>>>32-7,j=he+Ie|0,gt^=j<<9|j>>>32-9,j=gt+he|0,De^=j<<13|j>>>32-13,j=De+gt|0,Ie^=j<<18|j>>>32-18,j=de+ce|0,wt^=j<<7|j>>>32-7,j=wt+de|0,Re^=j<<9|j>>>32-9,j=Re+wt|0,ce^=j<<13|j>>>32-13,j=ce+Re|0,de^=j<<18|j>>>32-18,j=yt+ve|0,Me^=j<<7|j>>>32-7,j=Me+yt|0,fe^=j<<9|j>>>32-9,j=fe+Me|0,ve^=j<<13|j>>>32-13,j=ve+fe|0,yt^=j<<18|j>>>32-18,j=$e+Me|0,De^=j<<7|j>>>32-7,j=De+$e|0,Re^=j<<9|j>>>32-9,j=Re+De|0,Me^=j<<13|j>>>32-13,j=Me+Re|0,$e^=j<<18|j>>>32-18,j=Ie+Ne|0,ce^=j<<7|j>>>32-7,j=ce+Ie|0,fe^=j<<9|j>>>32-9,j=fe+ce|0,Ne^=j<<13|j>>>32-13,j=Ne+fe|0,Ie^=j<<18|j>>>32-18,j=de+he|0,ve^=j<<7|j>>>32-7,j=ve+de|0,ye^=j<<9|j>>>32-9,j=ye+ve|0,he^=j<<13|j>>>32-13,j=he+ye|0,de^=j<<18|j>>>32-18,j=yt+wt|0,Ve^=j<<7|j>>>32-7,j=Ve+yt|0,gt^=j<<9|j>>>32-9,j=gt+Ve|0,wt^=j<<13|j>>>32-13,j=wt+gt|0,yt^=j<<18|j>>>32-18;S[0]=$e>>>0&255,S[1]=$e>>>8&255,S[2]=$e>>>16&255,S[3]=$e>>>24&255,S[4]=Ie>>>0&255,S[5]=Ie>>>8&255,S[6]=Ie>>>16&255,S[7]=Ie>>>24&255,S[8]=de>>>0&255,S[9]=de>>>8&255,S[10]=de>>>16&255,S[11]=de>>>24&255,S[12]=yt>>>0&255,S[13]=yt>>>8&255,S[14]=yt>>>16&255,S[15]=yt>>>24&255,S[16]=ce>>>0&255,S[17]=ce>>>8&255,S[18]=ce>>>16&255,S[19]=ce>>>24&255,S[20]=fe>>>0&255,S[21]=fe>>>8&255,S[22]=fe>>>16&255,S[23]=fe>>>24&255,S[24]=ye>>>0&255,S[25]=ye>>>8&255,S[26]=ye>>>16&255,S[27]=ye>>>24&255,S[28]=he>>>0&255,S[29]=he>>>8&255,S[30]=he>>>16&255,S[31]=he>>>24&255}function $(S,L,M,p){F(S,L,M,p)}function q(S,L,M,p){N(S,L,M,p)}var G=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function Z(S,L,M,p,U,J,Y){var ue=new Uint8Array(16),_e=new Uint8Array(64),Ae,Ee;for(Ee=0;Ee<16;Ee++)ue[Ee]=0;for(Ee=0;Ee<8;Ee++)ue[Ee]=J[Ee];for(;U>=64;){for($(_e,ue,Y,G),Ee=0;Ee<64;Ee++)S[L+Ee]=M[p+Ee]^_e[Ee];for(Ae=1,Ee=8;Ee<16;Ee++)Ae=Ae+(ue[Ee]&255)|0,ue[Ee]=Ae&255,Ae>>>=8;U-=64,L+=64,p+=64}if(U>0)for($(_e,ue,Y,G),Ee=0;Ee=64;){for($(Y,J,U,G),_e=0;_e<64;_e++)S[L+_e]=Y[_e];for(ue=1,_e=8;_e<16;_e++)ue=ue+(J[_e]&255)|0,J[_e]=ue&255,ue>>>=8;M-=64,L+=64}if(M>0)for($(Y,J,U,G),_e=0;_e>>13|M<<3)&8191,p=S[4]&255|(S[5]&255)<<8,this.r[2]=(M>>>10|p<<6)&7939,U=S[6]&255|(S[7]&255)<<8,this.r[3]=(p>>>7|U<<9)&8191,J=S[8]&255|(S[9]&255)<<8,this.r[4]=(U>>>4|J<<12)&255,this.r[5]=J>>>1&8190,Y=S[10]&255|(S[11]&255)<<8,this.r[6]=(J>>>14|Y<<2)&8191,ue=S[12]&255|(S[13]&255)<<8,this.r[7]=(Y>>>11|ue<<5)&8065,_e=S[14]&255|(S[15]&255)<<8,this.r[8]=(ue>>>8|_e<<8)&8191,this.r[9]=_e>>>5&127,this.pad[0]=S[16]&255|(S[17]&255)<<8,this.pad[1]=S[18]&255|(S[19]&255)<<8,this.pad[2]=S[20]&255|(S[21]&255)<<8,this.pad[3]=S[22]&255|(S[23]&255)<<8,this.pad[4]=S[24]&255|(S[25]&255)<<8,this.pad[5]=S[26]&255|(S[27]&255)<<8,this.pad[6]=S[28]&255|(S[29]&255)<<8,this.pad[7]=S[30]&255|(S[31]&255)<<8};Q.prototype.blocks=function(S,L,M){for(var p=this.fin?0:2048,U,J,Y,ue,_e,Ae,Ee,Bt,Le,Ke,Ye,lt,ct,Xe,rt,Je,$e,De,Re,Me=this.h[0],Ne=this.h[1],Ie=this.h[2],ce=this.h[3],fe=this.h[4],ye=this.h[5],he=this.h[6],de=this.h[7],ve=this.h[8],Ve=this.h[9],gt=this.r[0],wt=this.r[1],yt=this.r[2],j=this.r[3],Et=this.r[4],Ot=this.r[5],Mt=this.r[6],_t=this.r[7],Ct=this.r[8],Lt=this.r[9];M>=16;)U=S[L+0]&255|(S[L+1]&255)<<8,Me+=U&8191,J=S[L+2]&255|(S[L+3]&255)<<8,Ne+=(U>>>13|J<<3)&8191,Y=S[L+4]&255|(S[L+5]&255)<<8,Ie+=(J>>>10|Y<<6)&8191,ue=S[L+6]&255|(S[L+7]&255)<<8,ce+=(Y>>>7|ue<<9)&8191,_e=S[L+8]&255|(S[L+9]&255)<<8,fe+=(ue>>>4|_e<<12)&8191,ye+=_e>>>1&8191,Ae=S[L+10]&255|(S[L+11]&255)<<8,he+=(_e>>>14|Ae<<2)&8191,Ee=S[L+12]&255|(S[L+13]&255)<<8,de+=(Ae>>>11|Ee<<5)&8191,Bt=S[L+14]&255|(S[L+15]&255)<<8,ve+=(Ee>>>8|Bt<<8)&8191,Ve+=Bt>>>5|p,Le=0,Ke=Le,Ke+=Me*gt,Ke+=Ne*(5*Lt),Ke+=Ie*(5*Ct),Ke+=ce*(5*_t),Ke+=fe*(5*Mt),Le=Ke>>>13,Ke&=8191,Ke+=ye*(5*Ot),Ke+=he*(5*Et),Ke+=de*(5*j),Ke+=ve*(5*yt),Ke+=Ve*(5*wt),Le+=Ke>>>13,Ke&=8191,Ye=Le,Ye+=Me*wt,Ye+=Ne*gt,Ye+=Ie*(5*Lt),Ye+=ce*(5*Ct),Ye+=fe*(5*_t),Le=Ye>>>13,Ye&=8191,Ye+=ye*(5*Mt),Ye+=he*(5*Ot),Ye+=de*(5*Et),Ye+=ve*(5*j),Ye+=Ve*(5*yt),Le+=Ye>>>13,Ye&=8191,lt=Le,lt+=Me*yt,lt+=Ne*wt,lt+=Ie*gt,lt+=ce*(5*Lt),lt+=fe*(5*Ct),Le=lt>>>13,lt&=8191,lt+=ye*(5*_t),lt+=he*(5*Mt),lt+=de*(5*Ot),lt+=ve*(5*Et),lt+=Ve*(5*j),Le+=lt>>>13,lt&=8191,ct=Le,ct+=Me*j,ct+=Ne*yt,ct+=Ie*wt,ct+=ce*gt,ct+=fe*(5*Lt),Le=ct>>>13,ct&=8191,ct+=ye*(5*Ct),ct+=he*(5*_t),ct+=de*(5*Mt),ct+=ve*(5*Ot),ct+=Ve*(5*Et),Le+=ct>>>13,ct&=8191,Xe=Le,Xe+=Me*Et,Xe+=Ne*j,Xe+=Ie*yt,Xe+=ce*wt,Xe+=fe*gt,Le=Xe>>>13,Xe&=8191,Xe+=ye*(5*Lt),Xe+=he*(5*Ct),Xe+=de*(5*_t),Xe+=ve*(5*Mt),Xe+=Ve*(5*Ot),Le+=Xe>>>13,Xe&=8191,rt=Le,rt+=Me*Ot,rt+=Ne*Et,rt+=Ie*j,rt+=ce*yt,rt+=fe*wt,Le=rt>>>13,rt&=8191,rt+=ye*gt,rt+=he*(5*Lt),rt+=de*(5*Ct),rt+=ve*(5*_t),rt+=Ve*(5*Mt),Le+=rt>>>13,rt&=8191,Je=Le,Je+=Me*Mt,Je+=Ne*Ot,Je+=Ie*Et,Je+=ce*j,Je+=fe*yt,Le=Je>>>13,Je&=8191,Je+=ye*wt,Je+=he*gt,Je+=de*(5*Lt),Je+=ve*(5*Ct),Je+=Ve*(5*_t),Le+=Je>>>13,Je&=8191,$e=Le,$e+=Me*_t,$e+=Ne*Mt,$e+=Ie*Ot,$e+=ce*Et,$e+=fe*j,Le=$e>>>13,$e&=8191,$e+=ye*yt,$e+=he*wt,$e+=de*gt,$e+=ve*(5*Lt),$e+=Ve*(5*Ct),Le+=$e>>>13,$e&=8191,De=Le,De+=Me*Ct,De+=Ne*_t,De+=Ie*Mt,De+=ce*Ot,De+=fe*Et,Le=De>>>13,De&=8191,De+=ye*j,De+=he*yt,De+=de*wt,De+=ve*gt,De+=Ve*(5*Lt),Le+=De>>>13,De&=8191,Re=Le,Re+=Me*Lt,Re+=Ne*Ct,Re+=Ie*_t,Re+=ce*Mt,Re+=fe*Ot,Le=Re>>>13,Re&=8191,Re+=ye*Et,Re+=he*j,Re+=de*yt,Re+=ve*wt,Re+=Ve*gt,Le+=Re>>>13,Re&=8191,Le=(Le<<2)+Le|0,Le=Le+Ke|0,Ke=Le&8191,Le=Le>>>13,Ye+=Le,Me=Ke,Ne=Ye,Ie=lt,ce=ct,fe=Xe,ye=rt,he=Je,de=$e,ve=De,Ve=Re,L+=16,M-=16;this.h[0]=Me,this.h[1]=Ne,this.h[2]=Ie,this.h[3]=ce,this.h[4]=fe,this.h[5]=ye,this.h[6]=he,this.h[7]=de,this.h[8]=ve,this.h[9]=Ve},Q.prototype.finish=function(S,L){var M=new Uint16Array(10),p,U,J,Y;if(this.leftover){for(Y=this.leftover,this.buffer[Y++]=1;Y<16;Y++)this.buffer[Y]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(p=this.h[1]>>>13,this.h[1]&=8191,Y=2;Y<10;Y++)this.h[Y]+=p,p=this.h[Y]>>>13,this.h[Y]&=8191;for(this.h[0]+=p*5,p=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=p,p=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=p,M[0]=this.h[0]+5,p=M[0]>>>13,M[0]&=8191,Y=1;Y<10;Y++)M[Y]=this.h[Y]+p,p=M[Y]>>>13,M[Y]&=8191;for(M[9]-=8192,U=(p^1)-1,Y=0;Y<10;Y++)M[Y]&=U;for(U=~U,Y=0;Y<10;Y++)this.h[Y]=this.h[Y]&U|M[Y];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,J=this.h[0]+this.pad[0],this.h[0]=J&65535,Y=1;Y<8;Y++)J=(this.h[Y]+this.pad[Y]|0)+(J>>>16)|0,this.h[Y]=J&65535;S[L+0]=this.h[0]>>>0&255,S[L+1]=this.h[0]>>>8&255,S[L+2]=this.h[1]>>>0&255,S[L+3]=this.h[1]>>>8&255,S[L+4]=this.h[2]>>>0&255,S[L+5]=this.h[2]>>>8&255,S[L+6]=this.h[3]>>>0&255,S[L+7]=this.h[3]>>>8&255,S[L+8]=this.h[4]>>>0&255,S[L+9]=this.h[4]>>>8&255,S[L+10]=this.h[5]>>>0&255,S[L+11]=this.h[5]>>>8&255,S[L+12]=this.h[6]>>>0&255,S[L+13]=this.h[6]>>>8&255,S[L+14]=this.h[7]>>>0&255,S[L+15]=this.h[7]>>>8&255},Q.prototype.update=function(S,L,M){var p,U;if(this.leftover){for(U=16-this.leftover,U>M&&(U=M),p=0;p=16&&(U=M-M%16,this.blocks(S,L,U),L+=U,M-=U),M){for(p=0;p>16&1),J[M-1]&=65535;J[15]=Y[15]-32767-(J[14]>>16&1),U=J[15]>>16&1,J[14]&=65535,E(Y,J,1-U)}for(M=0;M<16;M++)S[2*M]=Y[M]&255,S[2*M+1]=Y[M]>>8}function T(S,L){var M=new Uint8Array(32),p=new Uint8Array(32);return x(M,S),x(p,L),H(M,0,p,0)}function B(S){var L=new Uint8Array(32);return x(L,S),L[0]&1}function d(S,L){var M;for(M=0;M<16;M++)S[M]=L[2*M]+(L[2*M+1]<<8);S[15]&=32767}function k(S,L,M){for(var p=0;p<16;p++)S[p]=L[p]+M[p]}function W(S,L,M){for(var p=0;p<16;p++)S[p]=L[p]-M[p]}function K(S,L,M){var p,U,J=0,Y=0,ue=0,_e=0,Ae=0,Ee=0,Bt=0,Le=0,Ke=0,Ye=0,lt=0,ct=0,Xe=0,rt=0,Je=0,$e=0,De=0,Re=0,Me=0,Ne=0,Ie=0,ce=0,fe=0,ye=0,he=0,de=0,ve=0,Ve=0,gt=0,wt=0,yt=0,j=M[0],Et=M[1],Ot=M[2],Mt=M[3],_t=M[4],Ct=M[5],Lt=M[6],Tr=M[7],Kt=M[8],Er=M[9],xr=M[10],Sr=M[11],Ur=M[12],cn=M[13],fn=M[14],un=M[15];p=L[0],J+=p*j,Y+=p*Et,ue+=p*Ot,_e+=p*Mt,Ae+=p*_t,Ee+=p*Ct,Bt+=p*Lt,Le+=p*Tr,Ke+=p*Kt,Ye+=p*Er,lt+=p*xr,ct+=p*Sr,Xe+=p*Ur,rt+=p*cn,Je+=p*fn,$e+=p*un,p=L[1],Y+=p*j,ue+=p*Et,_e+=p*Ot,Ae+=p*Mt,Ee+=p*_t,Bt+=p*Ct,Le+=p*Lt,Ke+=p*Tr,Ye+=p*Kt,lt+=p*Er,ct+=p*xr,Xe+=p*Sr,rt+=p*Ur,Je+=p*cn,$e+=p*fn,De+=p*un,p=L[2],ue+=p*j,_e+=p*Et,Ae+=p*Ot,Ee+=p*Mt,Bt+=p*_t,Le+=p*Ct,Ke+=p*Lt,Ye+=p*Tr,lt+=p*Kt,ct+=p*Er,Xe+=p*xr,rt+=p*Sr,Je+=p*Ur,$e+=p*cn,De+=p*fn,Re+=p*un,p=L[3],_e+=p*j,Ae+=p*Et,Ee+=p*Ot,Bt+=p*Mt,Le+=p*_t,Ke+=p*Ct,Ye+=p*Lt,lt+=p*Tr,ct+=p*Kt,Xe+=p*Er,rt+=p*xr,Je+=p*Sr,$e+=p*Ur,De+=p*cn,Re+=p*fn,Me+=p*un,p=L[4],Ae+=p*j,Ee+=p*Et,Bt+=p*Ot,Le+=p*Mt,Ke+=p*_t,Ye+=p*Ct,lt+=p*Lt,ct+=p*Tr,Xe+=p*Kt,rt+=p*Er,Je+=p*xr,$e+=p*Sr,De+=p*Ur,Re+=p*cn,Me+=p*fn,Ne+=p*un,p=L[5],Ee+=p*j,Bt+=p*Et,Le+=p*Ot,Ke+=p*Mt,Ye+=p*_t,lt+=p*Ct,ct+=p*Lt,Xe+=p*Tr,rt+=p*Kt,Je+=p*Er,$e+=p*xr,De+=p*Sr,Re+=p*Ur,Me+=p*cn,Ne+=p*fn,Ie+=p*un,p=L[6],Bt+=p*j,Le+=p*Et,Ke+=p*Ot,Ye+=p*Mt,lt+=p*_t,ct+=p*Ct,Xe+=p*Lt,rt+=p*Tr,Je+=p*Kt,$e+=p*Er,De+=p*xr,Re+=p*Sr,Me+=p*Ur,Ne+=p*cn,Ie+=p*fn,ce+=p*un,p=L[7],Le+=p*j,Ke+=p*Et,Ye+=p*Ot,lt+=p*Mt,ct+=p*_t,Xe+=p*Ct,rt+=p*Lt,Je+=p*Tr,$e+=p*Kt,De+=p*Er,Re+=p*xr,Me+=p*Sr,Ne+=p*Ur,Ie+=p*cn,ce+=p*fn,fe+=p*un,p=L[8],Ke+=p*j,Ye+=p*Et,lt+=p*Ot,ct+=p*Mt,Xe+=p*_t,rt+=p*Ct,Je+=p*Lt,$e+=p*Tr,De+=p*Kt,Re+=p*Er,Me+=p*xr,Ne+=p*Sr,Ie+=p*Ur,ce+=p*cn,fe+=p*fn,ye+=p*un,p=L[9],Ye+=p*j,lt+=p*Et,ct+=p*Ot,Xe+=p*Mt,rt+=p*_t,Je+=p*Ct,$e+=p*Lt,De+=p*Tr,Re+=p*Kt,Me+=p*Er,Ne+=p*xr,Ie+=p*Sr,ce+=p*Ur,fe+=p*cn,ye+=p*fn,he+=p*un,p=L[10],lt+=p*j,ct+=p*Et,Xe+=p*Ot,rt+=p*Mt,Je+=p*_t,$e+=p*Ct,De+=p*Lt,Re+=p*Tr,Me+=p*Kt,Ne+=p*Er,Ie+=p*xr,ce+=p*Sr,fe+=p*Ur,ye+=p*cn,he+=p*fn,de+=p*un,p=L[11],ct+=p*j,Xe+=p*Et,rt+=p*Ot,Je+=p*Mt,$e+=p*_t,De+=p*Ct,Re+=p*Lt,Me+=p*Tr,Ne+=p*Kt,Ie+=p*Er,ce+=p*xr,fe+=p*Sr,ye+=p*Ur,he+=p*cn,de+=p*fn,ve+=p*un,p=L[12],Xe+=p*j,rt+=p*Et,Je+=p*Ot,$e+=p*Mt,De+=p*_t,Re+=p*Ct,Me+=p*Lt,Ne+=p*Tr,Ie+=p*Kt,ce+=p*Er,fe+=p*xr,ye+=p*Sr,he+=p*Ur,de+=p*cn,ve+=p*fn,Ve+=p*un,p=L[13],rt+=p*j,Je+=p*Et,$e+=p*Ot,De+=p*Mt,Re+=p*_t,Me+=p*Ct,Ne+=p*Lt,Ie+=p*Tr,ce+=p*Kt,fe+=p*Er,ye+=p*xr,he+=p*Sr,de+=p*Ur,ve+=p*cn,Ve+=p*fn,gt+=p*un,p=L[14],Je+=p*j,$e+=p*Et,De+=p*Ot,Re+=p*Mt,Me+=p*_t,Ne+=p*Ct,Ie+=p*Lt,ce+=p*Tr,fe+=p*Kt,ye+=p*Er,he+=p*xr,de+=p*Sr,ve+=p*Ur,Ve+=p*cn,gt+=p*fn,wt+=p*un,p=L[15],$e+=p*j,De+=p*Et,Re+=p*Ot,Me+=p*Mt,Ne+=p*_t,Ie+=p*Ct,ce+=p*Lt,fe+=p*Tr,ye+=p*Kt,he+=p*Er,de+=p*xr,ve+=p*Sr,Ve+=p*Ur,gt+=p*cn,wt+=p*fn,yt+=p*un,J+=38*De,Y+=38*Re,ue+=38*Me,_e+=38*Ne,Ae+=38*Ie,Ee+=38*ce,Bt+=38*fe,Le+=38*ye,Ke+=38*he,Ye+=38*de,lt+=38*ve,ct+=38*Ve,Xe+=38*gt,rt+=38*wt,Je+=38*yt,U=1,p=J+U+65535,U=Math.floor(p/65536),J=p-U*65536,p=Y+U+65535,U=Math.floor(p/65536),Y=p-U*65536,p=ue+U+65535,U=Math.floor(p/65536),ue=p-U*65536,p=_e+U+65535,U=Math.floor(p/65536),_e=p-U*65536,p=Ae+U+65535,U=Math.floor(p/65536),Ae=p-U*65536,p=Ee+U+65535,U=Math.floor(p/65536),Ee=p-U*65536,p=Bt+U+65535,U=Math.floor(p/65536),Bt=p-U*65536,p=Le+U+65535,U=Math.floor(p/65536),Le=p-U*65536,p=Ke+U+65535,U=Math.floor(p/65536),Ke=p-U*65536,p=Ye+U+65535,U=Math.floor(p/65536),Ye=p-U*65536,p=lt+U+65535,U=Math.floor(p/65536),lt=p-U*65536,p=ct+U+65535,U=Math.floor(p/65536),ct=p-U*65536,p=Xe+U+65535,U=Math.floor(p/65536),Xe=p-U*65536,p=rt+U+65535,U=Math.floor(p/65536),rt=p-U*65536,p=Je+U+65535,U=Math.floor(p/65536),Je=p-U*65536,p=$e+U+65535,U=Math.floor(p/65536),$e=p-U*65536,J+=U-1+37*(U-1),U=1,p=J+U+65535,U=Math.floor(p/65536),J=p-U*65536,p=Y+U+65535,U=Math.floor(p/65536),Y=p-U*65536,p=ue+U+65535,U=Math.floor(p/65536),ue=p-U*65536,p=_e+U+65535,U=Math.floor(p/65536),_e=p-U*65536,p=Ae+U+65535,U=Math.floor(p/65536),Ae=p-U*65536,p=Ee+U+65535,U=Math.floor(p/65536),Ee=p-U*65536,p=Bt+U+65535,U=Math.floor(p/65536),Bt=p-U*65536,p=Le+U+65535,U=Math.floor(p/65536),Le=p-U*65536,p=Ke+U+65535,U=Math.floor(p/65536),Ke=p-U*65536,p=Ye+U+65535,U=Math.floor(p/65536),Ye=p-U*65536,p=lt+U+65535,U=Math.floor(p/65536),lt=p-U*65536,p=ct+U+65535,U=Math.floor(p/65536),ct=p-U*65536,p=Xe+U+65535,U=Math.floor(p/65536),Xe=p-U*65536,p=rt+U+65535,U=Math.floor(p/65536),rt=p-U*65536,p=Je+U+65535,U=Math.floor(p/65536),Je=p-U*65536,p=$e+U+65535,U=Math.floor(p/65536),$e=p-U*65536,J+=U-1+37*(U-1),S[0]=J,S[1]=Y,S[2]=ue,S[3]=_e,S[4]=Ae,S[5]=Ee,S[6]=Bt,S[7]=Le,S[8]=Ke,S[9]=Ye,S[10]=lt,S[11]=ct,S[12]=Xe,S[13]=rt,S[14]=Je,S[15]=$e}function re(S,L){K(S,L,L)}function xe(S,L){var M=r(),p;for(p=0;p<16;p++)M[p]=L[p];for(p=253;p>=0;p--)re(M,M),p!==2&&p!==4&&K(M,M,L);for(p=0;p<16;p++)S[p]=M[p]}function be(S,L){var M=r(),p;for(p=0;p<16;p++)M[p]=L[p];for(p=250;p>=0;p--)re(M,M),p!==1&&K(M,M,L);for(p=0;p<16;p++)S[p]=M[p]}function ge(S,L,M){var p=new Uint8Array(32),U=new Float64Array(80),J,Y,ue=r(),_e=r(),Ae=r(),Ee=r(),Bt=r(),Le=r();for(Y=0;Y<31;Y++)p[Y]=L[Y];for(p[31]=L[31]&127|64,p[0]&=248,d(U,M),Y=0;Y<16;Y++)_e[Y]=U[Y],Ee[Y]=ue[Y]=Ae[Y]=0;for(ue[0]=Ee[0]=1,Y=254;Y>=0;--Y)J=p[Y>>>3]>>>(Y&7)&1,E(ue,_e,J),E(Ae,Ee,J),k(Bt,ue,Ae),W(ue,ue,Ae),k(Ae,_e,Ee),W(_e,_e,Ee),re(Ee,Bt),re(Le,ue),K(ue,Ae,ue),K(Ae,_e,Bt),k(Bt,ue,Ae),W(ue,ue,Ae),re(_e,ue),W(Ae,Ee,Le),K(ue,Ae,c),k(ue,ue,Ee),K(Ae,Ae,ue),K(ue,Ee,Le),K(Ee,_e,U),re(_e,Bt),E(ue,_e,J),E(Ae,Ee,J);for(Y=0;Y<16;Y++)U[Y+16]=ue[Y],U[Y+32]=Ae[Y],U[Y+48]=_e[Y],U[Y+64]=Ee[Y];var Ke=U.subarray(32),Ye=U.subarray(16);return xe(Ke,Ke),K(Ye,Ye,Ke),x(S,Ye),0}function tt(S,L){return ge(S,L,s)}function Ue(S,L){return n(L,32),tt(S,L)}function Pe(S,L,M){var p=new Uint8Array(32);return ge(p,M,L),q(S,i,p,G)}var pe=f,we=h;function ke(S,L,M,p,U,J){var Y=new Uint8Array(32);return Pe(Y,U,J),pe(S,L,M,p,Y)}function vt(S,L,M,p,U,J){var Y=new Uint8Array(32);return Pe(Y,U,J),we(S,L,M,p,Y)}var He=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function it(S,L,M,p){for(var U=new Int32Array(16),J=new Int32Array(16),Y,ue,_e,Ae,Ee,Bt,Le,Ke,Ye,lt,ct,Xe,rt,Je,$e,De,Re,Me,Ne,Ie,ce,fe,ye,he,de,ve,Ve=S[0],gt=S[1],wt=S[2],yt=S[3],j=S[4],Et=S[5],Ot=S[6],Mt=S[7],_t=L[0],Ct=L[1],Lt=L[2],Tr=L[3],Kt=L[4],Er=L[5],xr=L[6],Sr=L[7],Ur=0;p>=128;){for(Ne=0;Ne<16;Ne++)Ie=8*Ne+Ur,U[Ne]=M[Ie+0]<<24|M[Ie+1]<<16|M[Ie+2]<<8|M[Ie+3],J[Ne]=M[Ie+4]<<24|M[Ie+5]<<16|M[Ie+6]<<8|M[Ie+7];for(Ne=0;Ne<80;Ne++)if(Y=Ve,ue=gt,_e=wt,Ae=yt,Ee=j,Bt=Et,Le=Ot,Ke=Mt,Ye=_t,lt=Ct,ct=Lt,Xe=Tr,rt=Kt,Je=Er,$e=xr,De=Sr,ce=Mt,fe=Sr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=(j>>>14|Kt<<32-14)^(j>>>18|Kt<<32-18)^(Kt>>>41-32|j<<32-(41-32)),fe=(Kt>>>14|j<<32-14)^(Kt>>>18|j<<32-18)^(j>>>41-32|Kt<<32-(41-32)),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=j&Et^~j&Ot,fe=Kt&Er^~Kt&xr,ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=He[Ne*2],fe=He[Ne*2+1],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=U[Ne%16],fe=J[Ne%16],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,Re=de&65535|ve<<16,Me=ye&65535|he<<16,ce=Re,fe=Me,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=(Ve>>>28|_t<<32-28)^(_t>>>34-32|Ve<<32-(34-32))^(_t>>>39-32|Ve<<32-(39-32)),fe=(_t>>>28|Ve<<32-28)^(Ve>>>34-32|_t<<32-(34-32))^(Ve>>>39-32|_t<<32-(39-32)),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,ce=Ve>^Ve&wt^gt&wt,fe=_t&Ct^_t&Lt^Ct&Lt,ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,Ke=de&65535|ve<<16,De=ye&65535|he<<16,ce=Ae,fe=Xe,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=Re,fe=Me,ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,Ae=de&65535|ve<<16,Xe=ye&65535|he<<16,gt=Y,wt=ue,yt=_e,j=Ae,Et=Ee,Ot=Bt,Mt=Le,Ve=Ke,Ct=Ye,Lt=lt,Tr=ct,Kt=Xe,Er=rt,xr=Je,Sr=$e,_t=De,Ne%16===15)for(Ie=0;Ie<16;Ie++)ce=U[Ie],fe=J[Ie],ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=U[(Ie+9)%16],fe=J[(Ie+9)%16],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,Re=U[(Ie+1)%16],Me=J[(Ie+1)%16],ce=(Re>>>1|Me<<32-1)^(Re>>>8|Me<<32-8)^Re>>>7,fe=(Me>>>1|Re<<32-1)^(Me>>>8|Re<<32-8)^(Me>>>7|Re<<32-7),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,Re=U[(Ie+14)%16],Me=J[(Ie+14)%16],ce=(Re>>>19|Me<<32-19)^(Me>>>61-32|Re<<32-(61-32))^Re>>>6,fe=(Me>>>19|Re<<32-19)^(Re>>>61-32|Me<<32-(61-32))^(Me>>>6|Re<<32-6),ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,U[Ie]=de&65535|ve<<16,J[Ie]=ye&65535|he<<16;ce=Ve,fe=_t,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[0],fe=L[0],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[0]=Ve=de&65535|ve<<16,L[0]=_t=ye&65535|he<<16,ce=gt,fe=Ct,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[1],fe=L[1],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[1]=gt=de&65535|ve<<16,L[1]=Ct=ye&65535|he<<16,ce=wt,fe=Lt,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[2],fe=L[2],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[2]=wt=de&65535|ve<<16,L[2]=Lt=ye&65535|he<<16,ce=yt,fe=Tr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[3],fe=L[3],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[3]=yt=de&65535|ve<<16,L[3]=Tr=ye&65535|he<<16,ce=j,fe=Kt,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[4],fe=L[4],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[4]=j=de&65535|ve<<16,L[4]=Kt=ye&65535|he<<16,ce=Et,fe=Er,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[5],fe=L[5],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[5]=Et=de&65535|ve<<16,L[5]=Er=ye&65535|he<<16,ce=Ot,fe=xr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[6],fe=L[6],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[6]=Ot=de&65535|ve<<16,L[6]=xr=ye&65535|he<<16,ce=Mt,fe=Sr,ye=fe&65535,he=fe>>>16,de=ce&65535,ve=ce>>>16,ce=S[7],fe=L[7],ye+=fe&65535,he+=fe>>>16,de+=ce&65535,ve+=ce>>>16,he+=ye>>>16,de+=he>>>16,ve+=de>>>16,S[7]=Mt=de&65535|ve<<16,L[7]=Sr=ye&65535|he<<16,Ur+=128,p-=128}return p}function Ht(S,L,M){var p=new Int32Array(8),U=new Int32Array(8),J=new Uint8Array(256),Y,ue=M;for(p[0]=1779033703,p[1]=3144134277,p[2]=1013904242,p[3]=2773480762,p[4]=1359893119,p[5]=2600822924,p[6]=528734635,p[7]=1541459225,U[0]=4089235720,U[1]=2227873595,U[2]=4271175723,U[3]=1595750129,U[4]=2917565137,U[5]=725511199,U[6]=4215389547,U[7]=327033209,it(p,U,L,M),M%=128,Y=0;Y=0;--U)p=M[U/8|0]>>(U&7)&1,pt(S,L,p),ut(L,S),ut(S,S),pt(S,L,p)}function At(S,L){var M=[r(),r(),r(),r()];m(M[0],y),m(M[1],A),m(M[2],a),K(M[3],y,A),xt(S,M,L)}function Xt(S,L,M){var p=new Uint8Array(64),U=[r(),r(),r(),r()],J;for(M||n(L,32),Ht(p,L,32),p[0]&=248,p[31]&=127,p[31]|=64,At(U,p),Wt(S,U),J=0;J<32;J++)L[J+32]=S[J];return 0}var Tt=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function C(S,L){var M,p,U,J;for(p=63;p>=32;--p){for(M=0,U=p-32,J=p-12;U>4)*Tt[U],M=L[U]>>8,L[U]&=255;for(U=0;U<32;U++)L[U]-=M*Tt[U];for(p=0;p<32;p++)L[p+1]+=L[p]>>8,S[p]=L[p]&255}function w(S){var L=new Float64Array(64),M;for(M=0;M<64;M++)L[M]=S[M];for(M=0;M<64;M++)S[M]=0;C(S,L)}function b(S,L,M,p){var U=new Uint8Array(64),J=new Uint8Array(64),Y=new Uint8Array(64),ue,_e,Ae=new Float64Array(64),Ee=[r(),r(),r(),r()];Ht(U,p,32),U[0]&=248,U[31]&=127,U[31]|=64;var Bt=M+64;for(ue=0;ue>7&&W(S[0],o,S[0]),K(S[3],S[0],S[1]),0)}function V(S,L,M,p){var U,J=new Uint8Array(32),Y=new Uint8Array(64),ue=[r(),r(),r(),r()],_e=[r(),r(),r(),r()];if(M<64||D(_e,p))return-1;for(U=0;U=0},t.sign.keyPair=function(){var S=new Uint8Array(Yt),L=new Uint8Array(Qi);return Xt(S,L),{publicKey:S,secretKey:L}},t.sign.keyPair.fromSecretKey=function(S){if(kt(S),S.length!==Qi)throw new Error("bad secret key size");for(var L=new Uint8Array(Yt),M=0;M0&&(c=n-a-i),s.padding="0".repeat(c);const u=JSON.stringify(s);return Q2({publicKey:e,data:u,version:r})}ti.encryptSafely=yM;function eE({encryptedData:e,privateKey:t}){if((0,ki.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,ki.isNullish)(t))throw new Error("Missing privateKey parameter");switch(e.version){case"x25519-xsalsa20-poly1305":{const r=ie.Buffer.from(t,"hex"),n=xo.box.keyPair.fromSecretKey(r).secretKey,i=Ti.base64.decode(e.nonce),s=Ti.base64.decode(e.ciphertext),o=Ti.base64.decode(e.ephemPublicKey),a=xo.box.open(s,i,o,n);try{if(!a)throw new Error;const c=Ti.utf8.encode(a);if(!c)throw new Error;return c}catch(c){throw c&&typeof c.message=="string"&&c.message.length?new Error(`Decryption failed: ${c.message}`):new Error("Decryption failed.")}}default:throw new Error("Encryption type/version not supported.")}}ti.decrypt=eE;function wM({encryptedData:e,privateKey:t}){if((0,ki.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,ki.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(eE({encryptedData:e,privateKey:t})).data}ti.decryptSafely=wM;function mM(e){const t=ie.Buffer.from(e,"hex"),r=xo.box.keyPair.fromSecretKey(t).publicKey;return Ti.base64.encode(r)}ti.getEncryptionPublicKey=mM,function(e){var t=ft&&ft.__createBinding||(Object.create?function(i,s,o,a){a===void 0&&(a=o);var c=Object.getOwnPropertyDescriptor(s,o);(!c||("get"in c?!s.__esModule:c.writable||c.configurable))&&(c={enumerable:!0,get:function(){return s[o]}}),Object.defineProperty(i,a,c)}:function(i,s,o,a){a===void 0&&(a=o),i[a]=s[o]}),r=ft&&ft.__exportStar||function(i,s){for(var o in i)o!=="default"&&!Object.prototype.hasOwnProperty.call(s,o)&&t(s,i,o)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(us,e),r(E2,e),r(ti,e);var n=Qr;Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(Wo);class tE extends Error{constructor(t,r){super(),this.code=t,this.message=r}toString(){return`${this.message} (${this.code})`}}var bM=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},vM=(e,t,r)=>(bM(e,t,"read from private field"),r?r.call(e):t.get(e)),_M=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},kp;const Ia=class{constructor(e){_M(this,kp,["eth_newFilter","eth_newBlockFilter","eth_newPendingTransactionFilter","eth_uninstallFilter","eth_subscribe"]),this.provider=e}static isUTF8(e){try{return new TextDecoder("utf8",{fatal:!0}).decode(e),!0}catch{return!1}}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}static messageToBuffer(e){let t=ie.Buffer.from([]);try{typeof e=="string"?t=ie.Buffer.from(e.replace("0x",""),"hex"):t=ie.Buffer.from(e)}catch(r){console.log(`messageToBuffer error: ${r}`)}return t}async request(e){if(vM(this,kp).includes(e.method))return Promise.reject(new tE(4200,`EthereumProvider does not support calling ${e.method}`));switch(e.method){case"wallet_requestPermissions":return this.provider.internalRequest({method:"wallet_requestPermissions",params:e.params});case"eth_requestAccounts":return this.provider.internalRequest({method:"requestAccounts",params:{}});case"eth_sign":return this.ethSign(e.params);case"personal_sign":return this.personalSign(e.params);case"personal_ecRecover":return this.personalECRecover(e.params);case"eth_signTypedData_v3":return this.ethSignTypedData(e.params,Wo.SignTypedDataVersion.V3);case"eth_signTypedData_v4":return this.ethSignTypedData(e.params,Wo.SignTypedDataVersion.V4);case"eth_signTypedData":return this.ethSignTypedData(e.params,Wo.SignTypedDataVersion.V1);case"eth_sendTransaction":return this.provider.internalRequest({method:"signTransaction",params:e.params[0]});case"wallet_watchAsset":{const{options:t,type:r}=e.params,{address:n,symbol:i,decimals:s}=t;return this.provider.internalRequest({method:"watchAsset",params:{type:r,contract:n,symbol:i,decimals:s||0}})}case"wallet_addEthereumChain":return this.provider.internalRequest({method:"addEthereumChain",params:e.params[0]});case"wallet_switchEthereumChain":return this.provider.internalRequest({method:"switchEthereumChain",params:e.params[0]});default:return(await this.provider.getRPC().call({method:e.method,jsonrpc:"2.0",params:e.params})).result}}personalECRecover(e){return this.provider.internalRequest({method:"ecRecover",params:{signature:e[1],message:e[0]}})}async personalSign(e){const[t]=await this.provider.request({method:"eth_accounts"});if(!t)throw new Error("Unable to execute personal_sign");let[r,n]=e;typeof r=="string"&&t.toLowerCase()===r.toLowerCase()&&(r=e[1],n=e[0]);const i=Ia.messageToBuffer(r);return this.provider.internalRequest({method:"signPersonalMessage",params:{data:i.length===0?Ia.bufferToHex(r):r,address:n}})}ethSign(e){if(!e)throw new Error("Missing params");const[t,r]=e,n=Ia.messageToBuffer(r),i=Ia.bufferToHex(n);return this.provider.internalRequest({method:Ia.isUTF8(n)?"signPersonalMessage":"signMessage",params:{data:i,address:t}})}async ethSignTypedData(e,t){const[r]=await this.provider.request({method:"eth_accounts"});if(!r)throw new Error("Unable to execute ethSignTypedData, address is not present");let[n,i]=e;typeof n=="string"&&r.toLowerCase()===n.toLowerCase()&&(n=e[1],i=e[0]);const s=typeof n=="string"?JSON.parse(n):n,{chainId:o}=s.domain||{};if(typeof o<"u"&&Number(o)!==Number(this.provider.getChainId()))throw new Error("Provided chainId does not match the currently active chain");const a=t!==Wo.SignTypedDataVersion.V1?Wo.TypedDataUtils.eip712Hash(s,t):"";return this.provider.internalRequest({method:"signTypedMessage",params:{data:"0x"+a.toString("hex"),raw:typeof n=="string"?n:JSON.stringify(n),address:i,version:t}})}};let EM=Ia;kp=new WeakMap;var xM=Object.defineProperty,rE=Object.getOwnPropertySymbols,SM=Object.prototype.hasOwnProperty,AM=Object.prototype.propertyIsEnumerable,nE=(e,t,r)=>t in e?xM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,BM=(e,t)=>{for(var r in t||(t={}))SM.call(t,r)&&nE(e,r,t[r]);if(rE)for(var r of rE(t))AM.call(t,r)&&nE(e,r,t[r]);return e},iE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},IM=(e,t,r)=>(iE(e,t,"read from private field"),r?r.call(e):t.get(e)),RM=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},TM=(e,t,r,n)=>(iE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),vl;class sE{constructor(t){RM(this,vl,void 0),TM(this,vl,t)}async getBlockNumber(){return(await this.call({jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).result}async getBlockByNumber(t){return(await this.call({jsonrpc:"2.0",method:"eth_getBlockByNumber",params:[t,!1]})).result}getFilterLogs(t){return this.call({jsonrpc:"2.0",method:"eth_getLogs",params:[t]})}async call(t){const r=await(await fetch(IM(this,vl),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(BM({id:new Date().getTime()+Math.floor(Math.random()*1e3)},t))})).json();if(!r.result&&r.error)throw new Error(r.error.message||"rpc error");return r}}vl=new WeakMap;var oE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nn=(e,t,r)=>(oE(e,t,"read from private field"),r?r.call(e):t.get(e)),Ra=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},Pn=(e,t,r,n)=>(oE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ji,Ta,_l,Zc,Fs,ka;const aE=class extends Il{constructor(e){super(),Ra(this,Ji,void 0),Ra(this,Ta,void 0),Ra(this,_l,!1),Ra(this,Zc,!1),Ra(this,Fs,void 0),Ra(this,ka,void 0),this.isTrust=!0,this.isTrustWallet=!0,this.request=this.request.bind(this),e&&(e.chainId&&Pn(this,Ji,e.chainId),(e.rpc||e.rpcUrl)&&Pn(this,Ta,e.rpc||e.rpcUrl),typeof e.overwriteMetamask<"u"&&Pn(this,Zc,e.overwriteMetamask),typeof e.disableMobileAdapter<"u"&&Pn(this,_l,e.disableMobileAdapter),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust),Pn(this,ka,new sE(Nn(this,Ta)))),Nn(this,_l)||(this.mobileAdapter=new EM(this)),super.on("onResponseReady",this.onResponseReady.bind(this)),this.connect()}connect(){this.emit("connect",{chainId:Nn(this,Ji)})}enable(){return this.request({method:"eth_requestAccounts"})}sendAsync(e,t){Array.isArray(e)?Promise.all(e.map(r=>this.request(r))).then(r=>t(null,r)).catch(r=>t(r,null)):this.request(e).then(r=>t(null,r)).catch(r=>t(r,null))}_send(e){const t={jsonrpc:"2.0",result:null};switch(e.method){case"eth_accounts":case"eth_coinbase":case"net_version":case"eth_chainId":t.result=this.handleStaticRequests({method:"eth_accounts"});break;default:throw new tE(4200,`Trust does not support calling ${e.method} synchronously without a callback. Please provide a callback parameter to call ${e.method} asynchronously.`)}return t}send(e,t){if(typeof e=="string"&&(!t||Array.isArray(t))){const r=this;return new Promise((n,i)=>{try{const s=r.request({method:e,params:t});s instanceof Promise?s.then(n).catch(i):n(s)}catch(s){i(s)}})}else if(e&&typeof e=="object"&&typeof t=="function")return this.request(e).then(t);return this._send(e)}internalRequest(e){return super.request(e)}request(e){const t=()=>this.internalRequest(e);if(this.mobileAdapter){const r=this.handleStaticRequests(e,()=>this.mobileAdapter.request(e));return r instanceof Promise?r:Promise.resolve(r)}return this.handleStaticRequests(e,t)}handleStaticRequests(e,t){switch(e.method){case"net_version":return Nn(this,Ji)?parseInt(Nn(this,Ji)):void 0;case"eth_chainId":return Nn(this,Ji);case"eth_accounts":case"eth_coinbase":return Nn(this,Fs)?[Nn(this,Fs)]:[]}if(t)return t()}onResponseReady(e,t){var r,n,i,s;if(t)switch(e.method){case"eth_requestAccounts":case"requestAccounts":Pn(this,Fs,t[0]);break;case"wallet_requestPermissions":Pn(this,Fs,(s=(i=(n=(r=t[0])==null?void 0:r.caveats)==null?void 0:n[0])==null?void 0:i.value)==null?void 0:s[0]);break}}getNetwork(){return aE.NETWORK}get connected(){return!0}get isMetaMask(){return Nn(this,Zc)}getChainId(){return Nn(this,Ji)}getNetworkVersion(){return this.handleStaticRequests({method:"net_version "})}setChainId(e){Pn(this,Ji,e)}setRPCUrl(e){Pn(this,Ta,e),Pn(this,ka,new sE(Nn(this,Ta)))}getRPC(){return Nn(this,ka)}setOverwriteMetamask(e){Pn(this,Zc,e)}getAddress(){return Nn(this,Fs)}setAddress(e){Pn(this,Fs,e)}setRPC(e){Pn(this,ka,e)}};let cE=aE;Ji=new WeakMap,Ta=new WeakMap,_l=new WeakMap,Zc=new WeakMap,Fs=new WeakMap,ka=new WeakMap,cE.NETWORK="ethereum";class kM{constructor(t){this.provider=t}async request(t,r){if(t.method==="getKey"){const i=await this.provider.internalRequest({method:"requestAccounts",params:t.params}),s=JSON.parse(i);return{algo:"secp256k1",address:s.address,bech32Address:s.address,pubKey:ie.Buffer.from(s.pubKey,"hex")}}const n={signAmino:"signTransaction",signDirect:"signTransaction",signArbitrary:"signMessage",sendTx:"sendTransaction"};return n[t.method]?this.provider.internalRequest({method:n[t.method],params:t.params}):r()}}var fE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},uE=(e,t,r)=>(fE(e,t,"read from private field"),r?r.call(e):t.get(e)),CM=(e,t,r)=>{if(t.has(e))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(e):t.set(e,r)},LM=(e,t,r,n)=>(fE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Gc;const Yc=class extends Il{constructor(e){super(),CM(this,Gc,!1),this.isKeplr=!0,this.isTrust=!0,this.isTrustWallet=!0,e&&(typeof e.disableMobileAdapter<"u"&&LM(this,Gc,e.disableMobileAdapter),typeof e.isKeplr<"u"&&(this.isKeplr=e.isKeplr),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),uE(this,Gc)||(this.mobileAdapter=new kM(this))}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}getNetwork(){return Yc.NETWORK}isMobileAdapterEnabled(){return!uE(this,Gc)}enable(e){return this.request({method:"enable",params:{chainIds:e}})}internalRequest(e){return super.request(e)}request(e){const t=()=>this.internalRequest(e);return this.mobileAdapter?this.mobileAdapter.request(e,t):t()}getKey(e){return this.request({method:"getKey",params:{chainId:e}})}async sendTx(e,t,r){const n=ie.Buffer.from(t).toString("base64"),i=await this.request({method:"sendTx",params:{raw:n,chainId:e,mode:r}});return ie.Buffer.from(i,"hex")}async signArbitrary(e,t,r){const n=ie.Buffer.from(r),i=Yc.bufferToHex(n);return await this.request({method:"signArbitrary",params:{chainId:e,data:i,signerAddress:t}})}async signAmino(e,t,r){const n=await this.request({method:"signAmino",params:{chainId:e,sign_doc:r}}),{signed:i,signature:s}=JSON.parse(n);return{signed:i,signature:s}}async signDirect(e,t,r){const n={bodyBytes:Yc.bufferToHex(r.bodyBytes),authInfoBytes:Yc.bufferToHex(r.authInfoBytes)},i=await this.request({method:"signDirect",params:{signerAddress:t,chainId:e,sign_doc:n}}),{signature:s}=JSON.parse(i);return{signed:r,signature:s}}experimentalSuggestChain(){}getOfflineSignerDirect(e){return{getAccounts:async()=>[await this.getKey(e)],signDirect:async(t,r)=>{if(e!==r.chainId)throw new Error("Unmatched chain id with the offline signer");if((await this.getKey(r.chainId)).address!==t)throw new Error("Unknown signer address");return await this.signDirect(e,t,r)}}}getOfflineSigner(e){return this.getOfflineSignerAmino(e)}getOfflineSignerAuto(e){return this.getOfflineSignerAmino(e)}getOfflineSignerAmino(e){return{getAccounts:async()=>{const t=await this.getKey(e);return[{address:t.bech32Address,algo:"secp256k1",pubkey:t.pubKey}]},sign:(t,r)=>this.signAmino(e,t,r),signAmino:(t,r)=>this.signAmino(e,t,r)}}};let lE=Yc;Gc=new WeakMap,lE.NETWORK="cosmos";var Cp={exports:{}},Ca=typeof Reflect=="object"?Reflect:null,hE=Ca&&typeof Ca.apply=="function"?Ca.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},El;Ca&&typeof Ca.ownKeys=="function"?El=Ca.ownKeys:Object.getOwnPropertySymbols?El=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:El=function(e){return Object.getOwnPropertyNames(e)};function $M(e){console&&console.warn&&console.warn(e)}var dE=Number.isNaN||function(e){return e!==e};function Gt(){Gt.init.call(this)}Cp.exports=Gt,Cp.exports.once=PM,Gt.EventEmitter=Gt,Gt.prototype._events=void 0,Gt.prototype._eventsCount=0,Gt.prototype._maxListeners=void 0;var pE=10;function xl(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(Gt,"defaultMaxListeners",{enumerable:!0,get:function(){return pE},set:function(e){if(typeof e!="number"||e<0||dE(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");pE=e}}),Gt.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},Gt.prototype.setMaxListeners=function(e){if(typeof e!="number"||e<0||dE(e))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this};function gE(e){return e._maxListeners===void 0?Gt.defaultMaxListeners:e._maxListeners}Gt.prototype.getMaxListeners=function(){return gE(this)},Gt.prototype.emit=function(e){for(var t=[],r=1;r0&&(s=t[0]),s instanceof Error)throw s;var o=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw o.context=s,o}var a=i[e];if(a===void 0)return!1;if(typeof a=="function")hE(a,this,t);else for(var c=a.length,u=vE(a,c),r=0;r0&&o.length>i&&!o.warned){o.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=o.length,$M(a)}return e}Gt.prototype.addListener=function(e,t){return yE(this,e,t,!1)},Gt.prototype.on=Gt.prototype.addListener,Gt.prototype.prependListener=function(e,t){return yE(this,e,t,!0)};function OM(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function wE(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=OM.bind(n);return i.listener=r,n.wrapFn=i,i}Gt.prototype.once=function(e,t){return xl(t),this.on(e,wE(this,e,t)),this},Gt.prototype.prependOnceListener=function(e,t){return xl(t),this.prependListener(e,wE(this,e,t)),this},Gt.prototype.removeListener=function(e,t){var r,n,i,s,o;if(xl(t),n=this._events,n===void 0)return this;if(r=n[e],r===void 0)return this;if(r===t||r.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if(typeof r!="function"){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;i===0?r.shift():MM(r,i),r.length===1&&(n[e]=r[0]),n.removeListener!==void 0&&this.emit("removeListener",e,o||t)}return this},Gt.prototype.off=Gt.prototype.removeListener,Gt.prototype.removeAllListeners=function(e){var t,r,n;if(r=this._events,r===void 0)return this;if(r.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):r[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete r[e]),this;if(arguments.length===0){var i=Object.keys(r),s;for(n=0;n=0;n--)this.removeListener(e,t[n]);return this};function mE(e,t,r){var n=e._events;if(n===void 0)return[];var i=n[t];return i===void 0?[]:typeof i=="function"?r?[i.listener||i]:[i]:r?NM(i):vE(i,i.length)}Gt.prototype.listeners=function(e){return mE(this,e,!0)},Gt.prototype.rawListeners=function(e){return mE(this,e,!1)},Gt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):bE.call(e,t)},Gt.prototype.listenerCount=bE;function bE(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}Gt.prototype.eventNames=function(){return this._eventsCount>0?El(this._events):[]};function vE(e,t){for(var r=new Array(t),n=0;n({address:r,application:i,chainId:this.chainId,fullMessage:n,message:e.message,nonce:e.nonce,prefix:t,signature:a}))}async signAndSubmitTransaction(e){const t=await this.signTransaction(e),r=await this.request({method:"sendTransaction",params:{tx:t}});return{hash:ef.messageToBuffer(r).toString()}}async signTransaction(e){const t=await this.request({method:"signTransaction",params:{data:e}});return JSON.parse(ef.messageToBuffer(t).toString())}};let $E=ef;$E.NETWORK="aptos";const JM=(e,t)=>new sx({strategy:e,handler:t}),QM=e=>new Q1(e),eN=e=>new _E(e),tN=e=>new mE(e),rN=e=>new $E(e);window.trustwallet={core:JM,solana:QM,cosmos:eN,ethereum:tN,aptos:rN}}); +nonce: `+e.nonce;const s=ie.Buffer.from(n),o=Xc.bufferToHex(s);return this.request({method:"signMessage",params:{data:o}}).then(a=>({address:r,application:i,chainId:this.chainId,fullMessage:n,message:e.message,nonce:e.nonce,prefix:t,signature:a}))}async signAndSubmitTransaction(e){const t=await this.signTransaction(e),r=await this.request({method:"sendTransaction",params:{tx:t}});return{hash:Xc.messageToBuffer(r).toString()}}async signTransaction(e){const t=await this.request({method:"signTransaction",params:{data:e}});return JSON.parse(Xc.messageToBuffer(t).toString())}};let xE=Xc;xE.NETWORK="aptos";const DM=(e,t)=>new KE({strategy:e,handler:t}),HM=e=>new z1(e),jM=e=>new lE(e),zM=e=>new cE(e),qM=e=>new xE(e);window.trustwallet={core:DM,solana:HM,cosmos:jM,ethereum:zM,aptos:qM}}); diff --git a/bun.lockb b/bun.lockb index 53a494d2..343fc0b9 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/packages/ios-web3-provider/index.ts b/packages/ios-web3-provider/index.ts index cbf91836..e7dc2fee 100644 --- a/packages/ios-web3-provider/index.ts +++ b/packages/ios-web3-provider/index.ts @@ -11,6 +11,9 @@ import { ICosmosProviderConfig } from '@trustwallet/web3-provider-cosmos/types/C import { IEthereumProviderConfig } from '@trustwallet/web3-provider-ethereum/types/EthereumProvider'; import { AptosProvider } from '@trustwallet/web3-provider-aptos'; import { IAptosProviderConfig } from '@trustwallet/web3-provider-aptos/types/AptosProvider'; +import { ITonProviderConfig } from '@trustwallet/web3-provider-ton/dist/types/types/TonProvider'; +import { ITonBridgeConfig } from '@trustwallet/web3-provider-ton/dist/types/types/TonBridge'; +import { TonBridge, TonProvider } from '@trustwallet/web3-provider-ton'; const core = (strategy: AdapterStrategyType, handler?: IHandler) => new Web3Provider({ strategy, handler }); @@ -24,10 +27,17 @@ const ethereum = (config: IEthereumProviderConfig) => const aptos = (config: IAptosProviderConfig) => new AptosProvider(config); +const ton = (config: ITonProviderConfig) => new TonProvider(config); + +const tonBridge = (config: ITonBridgeConfig, provider: TonProvider) => + new TonBridge(config, provider); + window.trustwallet = { core, solana, cosmos, ethereum, aptos, + ton, + tonBridge, }; diff --git a/packages/ios-web3-provider/package.json b/packages/ios-web3-provider/package.json index 1dd34da8..0f8859db 100644 --- a/packages/ios-web3-provider/package.json +++ b/packages/ios-web3-provider/package.json @@ -24,7 +24,8 @@ "@trustwallet/web3-provider-solana": "workspace:*", "@trustwallet/web3-provider-cosmos": "workspace:*", "@trustwallet/web3-provider-aptos": "workspace:*", + "@trustwallet/web3-provider-ton": "workspace:*", "rollup-plugin-polyfill-node": "0.13.0" }, - "devDependencies": { } + "devDependencies": {} } diff --git a/packages/ios-web3-provider/swift/ProviderNetwork.swift b/packages/ios-web3-provider/swift/ProviderNetwork.swift index 45980719..35743e66 100644 --- a/packages/ios-web3-provider/swift/ProviderNetwork.swift +++ b/packages/ios-web3-provider/swift/ProviderNetwork.swift @@ -9,4 +9,5 @@ public enum ProviderNetwork: String, Decodable { case solana case cosmos case aptos + case ton } diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index 140a9045..1eddee56 100644 --- a/packages/ios-web3-provider/swift/trust-min.js +++ b/packages/ios-web3-provider/swift/trust-min.js @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:9d9088349e0344cfbf5c0e80d1e0c31fa135648681d80ef8d9c9a7789d855c4a -size 675512 +oid sha256:249ab6d5f85cc57cd2822891439a7e72d1404eb1c8359543028311eeabb6b81d +size 674983 diff --git a/packages/ton/TonBridge.ts b/packages/ton/TonBridge.ts index 2d8788f0..aa7fb68d 100644 --- a/packages/ton/TonBridge.ts +++ b/packages/ton/TonBridge.ts @@ -7,6 +7,7 @@ import { ConnectItemReply, ConnectRequest, DeviceInfo, + ITonBridgeConfig, TonConnectBridge, TonConnectCallback, WalletEvent, @@ -39,14 +40,7 @@ export class TonBridge implements TonConnectBridge { private provider!: TonProvider; private callbacks: TonConnectCallback[] = []; - constructor( - config: { - isWalletBrowser: boolean; - walletInfo: WalletInfo; - deviceInfo: DeviceInfo; - }, - provider: TonProvider, - ) { + constructor(config: ITonBridgeConfig, provider: TonProvider) { if (config) { if (typeof config.isWalletBrowser !== 'undefined') { this.isWalletBrowser = config.isWalletBrowser; diff --git a/packages/ton/types/TonBridge.ts b/packages/ton/types/TonBridge.ts index b9776599..2134a609 100644 --- a/packages/ton/types/TonBridge.ts +++ b/packages/ton/types/TonBridge.ts @@ -122,6 +122,12 @@ export interface AppRequest { export type TonConnectCallback = (event: WalletEvent) => void; +export interface ITonBridgeConfig { + isWalletBrowser: boolean; + walletInfo: WalletInfo; + deviceInfo: DeviceInfo; +} + export interface TonConnectBridge { deviceInfo: DeviceInfo; walletInfo?: WalletInfo;