From a8e44da7e371e03e9e5c135b77a99b9e8377c4d7 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Tue, 17 Sep 2024 12:18:05 -0300 Subject: [PATCH 01/11] Adding ton to ios project --- .../swift/TrustWeb3Provider.swift | 44 ++++++++++++++++++- 1 file changed, 42 insertions(+), 2 deletions(-) diff --git a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift index 0a9f1e1c..aa9cb8d3 100644 --- a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift +++ b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift @@ -12,15 +12,20 @@ public struct TrustWeb3Provider { public let ethereum: EthereumConfig public let solana: SolanaConfig public let aptos: AptosConfig + public let ton: TonConfig + public let appVersion: String public init( ethereum: EthereumConfig, solana: SolanaConfig, - aptos: AptosConfig = AptosConfig(network: "Mainnet", chainId: "1") + aptos: AptosConfig = AptosConfig(network: "Mainnet", chainId: "1"), + appVersion: String ) { self.ethereum = ethereum self.solana = solana self.aptos = aptos + self.ton = ton + self.appVersion: String } public struct EthereumConfig: Equatable { @@ -43,6 +48,11 @@ public struct TrustWeb3Provider { } } + public struct TonConfig: Equatable { + public init() { + } + } + public struct AptosConfig: Equatable { public let network: String public let chainId: String @@ -113,13 +123,43 @@ public struct TrustWeb3Provider { const solana = trustwallet.solana(config.solana); const cosmos = trustwallet.cosmos(); const aptos = trustwallet.aptos(config.aptos); + const ton = trustwallet.ton(); + + const walletInfo = { + deviceInfo: { + platform: 'iphone', + + // TODO: Change to trust + appName: 'OpenMask', + appVersion: "\(config.appVersion)", + maxProtocolVersion: 2, + features: [ + 'SendTransaction', + { + name: 'SendTransaction', + maxMessages: 4, + }, + ], + }, + walletInfo: { + // TODO: Change to trust + name: 'OpenMask', + image: 'https://assets-cdn.trustwallet.com/dapps/trust.logo.png', + about_url: 'https://trustwallet.com/about-us', + }, + isWalletBrowser: true, + }; - core.registerProviders([ethereum, solana, cosmos, aptos].map(provider => { + const tonBridge = trustwallet.tonBridge(walletInfo, ton); + + core.registerProviders([ethereum, solana, cosmos, aptos, ton].map(provider => { provider.sendResponse = core.sendResponse.bind(core); provider.sendError = core.sendError.bind(core); return provider; })); + window.openmask = { tonconnect: tonBridge, provider: ton }; + // Custom methods ethereum.emitChainChanged = (chainId) => { ethereum.setChainId('0x' + parseInt(chainId || '1').toString(16)); From 399a31440ef1de4b853522433684814b9ecffd3a Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Tue, 17 Sep 2024 14:52:22 -0300 Subject: [PATCH 02/11] Adding updating ton build file --- android/lib/src/main/res/raw/trust_min.js | 26 +++++++++--------- bun.lockb | Bin 186640 -> 183784 bytes packages/android-web3-provider/index.ts | 10 +++++++ packages/android-web3-provider/package.json | 3 +- packages/ios-web3-provider/package.json | 1 - packages/ios-web3-provider/swift/trust-min.js | 4 +-- packages/ios-web3-provider/tsconfig.json | 8 +++++- packages/ton/MobileAdapter.ts | 4 --- packages/ton/package.json | 4 +-- 9 files changed, 35 insertions(+), 25 deletions(-) diff --git a/android/lib/src/main/res/raw/trust_min.js b/android/lib/src/main/res/raw/trust_min.js index dca48b8e..c5624a9d 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={},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};/*! +(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=UE,ef.toByteArray=DE,ef.fromByteArray=zE;for(var pi=[],Fn=[],NE=typeof Uint8Array<"u"?Uint8Array:Array,Il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",So=0,PE=Il.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 UE(e){var t=Pp(e),r=t[0],n=t[1];return(r+n)*3/4-n}function FE(e,t,r){return(t+r)*3/4-r}function DE(e){var t,r=Pp(e),n=r[0],i=r[1],s=new NE(FE(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 HE(e){return pi[e>>18&63]+pi[e>>12&63]+pi[e>>6&63]+pi[e&63]}function jE(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 Rl={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */Rl.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)},Rl.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=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+=` + */(function(e){const t=ef,r=Rl,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,Up=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 qE(e){console&&console.warn&&console.warn(e)}var Fp=Number.isNaN||function(t){return t!==t};function Zt(){Zt.init.call(this)}Dn.exports=Zt,Dn.exports.once=ZE,Zt.EventEmitter=Zt,Zt.prototype._events=void 0,Zt.prototype._eventsCount=0,Zt.prototype._maxListeners=void 0;var Dp=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 Dp},set:function(e){if(typeof e!="number"||e<0||Fp(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Dp=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||Fp(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 Hp(e){return e._maxListeners===void 0?Zt.defaultMaxListeners:e._maxListeners}Zt.prototype.getMaxListeners=function(){return Hp(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")Up(c,this,r);else for(var u=c.length,l=Wp(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,qE(a)}return e}Zt.prototype.addListener=function(t,r){return jp(this,t,r,!1)},Zt.prototype.on=Zt.prototype.addListener,Zt.prototype.prependListener=function(t,r){return jp(this,t,r,!0)};function VE(){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 zp(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=VE.bind(n);return i.listener=r,n.wrapFn=i,i}Zt.prototype.once=function(t,r){return rf(r),this.on(t,zp(this,t,r)),this},Zt.prototype.prependOnceListener=function(t,r){return rf(r),this.prependListener(t,zp(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():WE(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 qp(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?KE(i):Wp(i,i.length)}Zt.prototype.listeners=function(t){return qp(this,t,!0)},Zt.prototype.rawListeners=function(t){return qp(this,t,!1)},Zt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Vp.call(e,t)},Zt.prototype.listenerCount=Vp;function Vp(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 Wp(e,t){for(var r=new Array(t),n=0;nt in e?YE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tx=(e,t)=>{for(var r in t||(t={}))QE.call(t,r)&&Gp(e,r,t[r]);if(Zp)for(var r of Zp(t))ex.call(t,r)&&Gp(e,r,t[r]);return e},rx=(e,t)=>XE(e,JE(t));class nx 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(rx(tx({},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 ix extends nf{constructor(){super($a.PROMISES)}request(t,r){return super.request(t,r)}}class sf 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 sx{constructor(t){const r=t.strategy===$a.CALLBACK?new nx:new ix;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 Yp(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 of(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");Yp(e.outputLen),Yp(e.blockLen)}function af(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){of(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 Xp(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Cl(e){return typeof e=="string"&&(e=Xp(e)),of(e),e}function Jp(...e){let t=0;for(let n=0;ne().update(Cl(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function tg(e=32){if(Tl&&typeof Tl.getRandomValues=="function")return Tl.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 rg extends Qp{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=kl(this.buffer)}update(t){af(this);const{view:r,buffer:n,blockLen:i}=this;t=Cl(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>Ll&cf)}:{h:Number(e>>Ll&cf)|0,l:Number(e&cf)|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:ng,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))))(),es=new Uint32Array(80),ts=new Uint32Array(80);class Tx extends rg{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,Rx[N],ts[N]),ee=mt.add5H(z,H,$,G,Ix[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 ig=eg(()=>new Tx);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const sg=BigInt(0),ff=BigInt(1),kx=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 Cx=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;isg;e>>=ff,t+=1);return t}function Nx(e,t){return e>>BigInt(t)&ff}function Px(e,t,r){return e|(r?ff:sg)<(kx<new Uint8Array(e),cg=e=>Uint8Array.from(e);function fg(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=Ml(e),i=Ml(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Ml())=>{i=a(cg([0]),y),n=a(),y.length!==0&&(i=a(cg([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"||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=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:Ds,abytes:Oa,bytesToHex:Hs,numberToHexUnpadded:og,hexToNumber:$l,hexToBytes:Bo,bytesToNumberBE:js,bytesToNumberLE:Io,numberToBytesBE:Ro,numberToBytesLE:Ma,numberToVarBytesBE:Lx,ensureBytes:Cr,concatBytes:zs,equalBytes:$x,utf8ToBytes:Ox,bitLen:Mx,bitGet:Nx,bitSet:Px,bitMask:Ol,createHmacDrbg:fg,validateObject:To});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fr=BigInt(0),hr=BigInt(1),qs=BigInt(2),Dx=BigInt(3),Nl=BigInt(4),ug=BigInt(5),lg=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 Pl(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)/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,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 To(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 hg(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function dg(e,t,r=!1,n={}){if(e<=Fr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=hg(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:Ol(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*Pl(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Pl(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>Zx(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 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 pg(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 gg(e){const t=pg(e);return t+Math.ceil(t/2)}function Yx(e,t,r=!1){const n=e.length,i=pg(t),s=gg(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 Xx=BigInt(0),Ul=BigInt(1);function yg(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&Ul&&(o=o.add(a)),a=a.double(),s>>=Ul;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+=Ul);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 Fl(e){return Wx(e.Fp),To(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...hg(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),uf=BigInt(2),Jx=BigInt(8),Qx={zip215:!0};function eS(e){const t=Fl(e);return To(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Dl(e){const t=eS(e),{Fp:r,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=t,u=uf<{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(uf*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*uf*ge),Tt=l(K*uf*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=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=yg(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=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=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 Hl=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),wg=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const tS=BigInt(1),jl=BigInt(2),rS=BigInt(5),mg=BigInt(10),nS=BigInt(20),iS=BigInt(40),bg=BigInt(80);function sS(e){const t=Hl,n=e*e%t*e%t,i=wr(n,jl,t)*n%t,s=wr(i,tS,t)*e%t,o=wr(s,rS,t)*s%t,a=wr(o,mg,t)*o%t,c=wr(a,nS,t)*a%t,u=wr(c,iS,t)*c%t,l=wr(u,bg,t)*u%t,y=wr(l,bg,t)*u%t,A=wr(y,mg,t)*o%t;return{pow_p_5_8:wr(A,jl,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=Hl,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*wg,r),l=a===e,y=a===ir(-e,r),A=a===ir(-e*wg,r);return l&&(o=c),(y||A)&&(o=u),qx(o,r)&&(o=ir(-o,r)),{isValid:l||y,value:o}}const Li=dg(Hl,void 0,!0),zl={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Li,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ig,randomBytes:tg,adjustScalarBytes:oS,uvRatio:aS},lf=Dl(zl);function vg(e,t,r){if(t.length>255)throw new Error("Context is too big");return Jp(Xp("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}({...zl},{...zl});const cS=(Li.ORDER+BigInt(3))/BigInt(8);Li.pow(jl,cS),Li.sqrt(Li.neg(Li.ONE)),(Li.ORDER-BigInt(5))/BigInt(8),BigInt(486662),Gx(Li,Li.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var ql={exports:{}},fS={},uS=Object.freeze({__proto__:null,default:fS}),_g=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=_g.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,Bl=E[3]|0,zt=Bl&8191,Yt=Bl>>>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)})(ql);var Eg=ql.exports,hf={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)}})(hf,hf.exports);var df=hf.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=df.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]),rs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ns=new Uint32Array(64);class yS extends rg{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+ux(a,c,u)+gS[y]+ns[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(){ns.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Vl=eg(()=>new yS);var Zr={};function $i(e,t,r){return t<=e&&e<=r}function pf(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 gf=-1;function Wl(e){this.tokens=[].slice.call(e)}Wl.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():gf},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 Kl(e,t){if(e)throw TypeError("Decoder error");return t||65533}var yf="utf-8";function wf(e,t){if(!(this instanceof wf))return new wf(e,t);if(e=e!==void 0?String(e).toLowerCase():yf,e!==yf)throw new Error("Encoding not supported. Only utf-8 is supported");t=pf(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})}wf.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=pf(r),this._streaming||(this._decoder=new bS({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new Wl(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),mS(s)}};function mf(e,t){if(!(this instanceof mf))return new mf(e,t);if(e=e!==void 0?String(e).toLowerCase():yf,e!==yf)throw new Error("Encoding not supported. Only utf-8 is supported");t=pf(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}mf.prototype={encode:function(t,r){t=t?String(t):"",r=pf(r),this._streaming||(this._encoder=new vS(this._options)),this._streaming=!!r.stream;for(var n=[],i=new Wl(wS(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 bS(e){var t=e.fatal,r=0,n=0,i=0,s=128,o=191;this.handler=function(a,c){if(c===gf&&i!==0)return i=0,Kl(t);if(c===gf)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 Kl(t);return r=r<<6*i,null}if(!$i(c,s,o))return r=i=n=0,s=128,o=191,a.prepend(c),Kl(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===gf)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 _S=Object.freeze({__proto__:null,TextEncoder:mf,TextDecoder:wf}),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},xg=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zr,"__esModule",{value:!0});var Sg=Zr.deserializeUnchecked=kg=Zr.deserialize=Tg=Zr.serialize=Zr.BinaryReader=Zr.BinaryWriter=Zr.BorshError=Zr.baseDecode=Zr.baseEncode=void 0;const is=xg(ql.exports),Ag=xg(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")),Ag.default.encode(ie.Buffer.from(e))}Zr.baseEncode=TS;function kS(e){return ie.Buffer.from(Ag.default.decode(e))}Zr.baseDecode=kS;const Zl=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 Bg{constructor(){this.buf=ie.Buffer.alloc(Zl),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=ie.Buffer.concat([this.buf,ie.Buffer.alloc(Zl)]))}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(Zl)]),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=Bg;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 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{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 Rg(e,r,i)}catch(s){throw s instanceof ln&&s.addToFieldPath(t),s}}function Rg(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 LS(e,t,r,n=Bn){const i=new n(r),s=Gl(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 Xl(e,t){return t.property?e+"["+t.property+"]":e}ne.nameWithProperty=Xl;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 Cg 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=Cg;class Jl 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=Jl;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=Dg;class Hg 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=Hg;class eh{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=eh;class _f extends eh{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=_f;class th extends qt{constructor(t,r,n){let i;if(t instanceof Hn||t instanceof ni)i=new _f(new Jl(t));else if(t instanceof wn&&t.isCount())i=new _f(t);else if(t instanceof eh)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 jg(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=th;class jg extends qt{constructor(t,r,n,i){if(!(t instanceof th))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=jg;function $o(e){return 0>e&&(e+=4294967296),e}class rh 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(Xl("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(Xl("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=qg;class Vg 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=Vg;class Wg 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=Wg;class Kg 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=Kg,ne.greedy=(e,t)=>new Cg(e,t);var Zs=ne.offset=(e,t,r)=>new Jl(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 Lg(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 $g(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 Og(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 Mg(e),ne.f32=e=>new Ng(e),ne.f32be=e=>new Pg(e),ne.f64=e=>new Ug(e),ne.f64be=e=>new Fg(e);var Fe=ne.struct=(e,t,r)=>new Hg(e,t,r);ne.bits=(e,t,r)=>new rh(e,t,r);var en=ne.seq=(e,t,r)=>new Dg(e,t,r);ne.union=(e,t,r)=>new th(e,t,r),ne.unionLayoutDiscriminator=(e,t)=>new _f(e,t);var nr=ne.blob=(e,t)=>new qg(e,t);ne.cstr=e=>new Vg(e),ne.utf8=(e,t)=>new Wg(e,t),ne.constant=(e,t)=>new Kg(e,t);var Na={};Object.defineProperty(Na,"__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=Na.toBigIntLE=MS;function PS(e){{const t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}Na.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=Na.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")}}Na.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 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 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*Zg(e,t,r,n){jS(e)||(e=[e]);for(const i of e){const s=qS(i,t,r,n);s&&(yield s)}}function*ih(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=ih(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 VS(t,this)}create(t){return Be(t,this)}is(t){return Gg(t,this)}mask(t){return WS(t,this)}validate(t,r={}){return Pa(t,this,r)}}function VS(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 WS(e,t){const r=Pa(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}function Gg(e,t){return!Pa(e,t)[0]}function Pa(e,t,r={}){const n=ih(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 Gs(e,t){return new mi({type:e,schema:null,validator:t})}function KS(){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 sh(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 ZS(){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 Yg(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 oh(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]=ih(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)=>Gg(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}var Ef,GS=new Uint8Array(16);function Xg(){if(!Ef&&(Ef=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ef))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ef(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 xf(e){return typeof e=="string"&&YS.test(e)}for(var Yr=[],ah=0;ah<256;++ah)Yr.push((ah+256).toString(16).substr(1));function Sf(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(!xf(r))throw TypeError("Stringified UUID is invalid");return r}var Jg,ch,fh=0,uh=0;function XS(e,t,r){var n=t&&r||0,i=t||new Array(16);e=e||{};var s=e.node||Jg,o=e.clockseq!==void 0?e.clockseq:ch;if(s==null||o==null){var a=e.random||(e.rng||Xg)();s==null&&(s=Jg=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=ch=(a[6]<<8|a[7])&16383)}var c=e.msecs!==void 0?e.msecs:Date.now(),u=e.nsecs!==void 0?e.nsecs:uh+1,l=c-fh+(u-uh)/1e4;if(l<0&&e.clockseq===void 0&&(o=o+1&16383),(l<0||c>fh)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");fh=c,uh=u,ch=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||Sf(i)}function Qg(e){if(!xf(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 t1(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 Af(e,t,r,n,i,s){return os(s3(os(os(t,e),os(n,s)),i),r)}function tn(e,t,r,n,i,s,o){return Af(t&r|~t&n,e,t,i,s,o)}function rn(e,t,r,n,i,s,o){return Af(t&n|r&~n,e,t,i,s,o)}function nn(e,t,r,n,i,s,o){return Af(t^r^n,e,t,i,s,o)}function sn(e,t,r,n,i,s,o){return Af(r^(t|~n),e,t,i,s,o)}var o3=e1("v3",48,t3),a3=o3;function c3(e,t,r){e=e||{};var n=e.random||(e.rng||Xg)();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 Sf(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 lh(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=lh(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=e1("v5",80,u3),h3=l3,d3="00000000-0000-0000-0000-000000000000";function p3(e){if(!xf(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:xf,stringify:Sf,parse:Qg}),r1=Un(g3);const y3=r1.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=r1.v4,b3=w3,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 m3()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=e};var v3=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=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},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 n1={},hh={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=n1.default=B3,i1={};Object.defineProperty(i1,"__esModule",{value:!0});const R3=hh.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=i1.default=k3;const L3=[],$3=BigInt(0),Ha=BigInt(1),O3=BigInt(2),M3=BigInt(7),N3=BigInt(256),P3=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<>M3)*P3)%N3,t&O3&&(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 s1=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 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,s1),{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,s1);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=yg(y,t.endo?Math.ceil(A/2):A);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function j3(e){const t=Fl(e);return To(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 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=gg(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=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=Ol(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 fg(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 o1 extends Qp{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,ax(t);const n=Cl(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 o1(e,t).update(r).digest();a1.create=(e,t)=>new o1(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function q3(e){return{hash:e,hmac:(t,...r)=>a1(e,t,Jp(...r)),randomBytes:tg}}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 c1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),f1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),W3=BigInt(1),dh=BigInt(2),u1=(e,t)=>(e+t/dh)/t;function K3(e){const t=c1,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,dh,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,dh,t);if(!ph.eql(ph.sqr(G),e))throw new Error("Cannot find square root");return G}const ph=dg(c1,void 0,void 0,{sqrt:K3}),gh=V3({a:BigInt(0),b:BigInt(7),Fp:ph,n:f1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=f1,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-W3*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=u1(s*e,t),c=u1(-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}}}},Vl);BigInt(0),gh.ProjectivePoint,lf.utils.randomPrivateKey;function l1(e){try{return lf.ExtendedPoint.fromHex(e),!0}catch{return!1}}const h1=(e,t)=>lf.sign(e,t.slice(0,32)),Z3=lf.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 G3{constructor(t){Object.assign(this,t)}encode(){return ie.Buffer.from(Tg(Bf,this))}static decode(t){return kg(Bf,this,t)}static decodeUnchecked(t){return Sg(Bf,this,t)}}const Bf=new Map;var d1;const Y3=32,as=32;function X3(e){return e._bn!==void 0}let p1=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!=as)throw new Error("Invalid public key input");this._bn=new Eg(r)}else this._bn=new Eg(t);if(this._bn.byteLength()>as)throw new Error("Invalid public key input")}}static unique(){const t=new et(p1);return p1+=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=Vl(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,Mo(s)])}),n=ie.Buffer.concat([n,r.toBuffer(),ie.Buffer.from("ProgramDerivedAddress")]);const i=Vl(n);if(l1(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 l1(r.toBytes())}}d1=et,et.default=new d1("11111111111111111111111111111111"),Bf.set(et,{kind:"struct",fields:[["_bn","u256"]]}),new et("BPFLoader1111111111111111111111111111111111");const No=1280-40-8,yh=127,If=64;class g1 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(g1.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class y1 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(y1.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 Rf{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),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},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"),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 Tf{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 Tf(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 w1="Reached end of buffer unexpectedly";function Mi(e){if(e.length===0)throw new Error(w1);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(w1);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 Rf(this.staticAccountKeys)}static compile(t){const r=Tf.compile(t.instructions,t.payerKey),[n,i]=r.getMessageComponents(),o=new Rf(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&yh))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 Rf(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&yh;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=m1.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 nA=ie.Buffer.alloc(If).fill(0);class b1{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 b1(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=h1(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):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+=` 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<=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 +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(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 b1({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]=h1(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 Uo(e){return new Promise(t=>setTimeout(t,e))}const sA=Gr("lamportsPerSignature"),v1=Fe([qe("version"),qe("state"),St("authorizedPubkey"),St("nonce"),Fe([sA],"feeCalculator")]);v1.span;class wh{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=v1.decode(Mo(t),0);return new wh({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}},Fo=(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"),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 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 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=cA.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=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 x1=56;class S1{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-x1;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(x1));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"),Fo("deactivationSlot"),Gr("lastExtendedSlot"),Ut("lastExtendedStartIndex"),Ut(),en(St(),Zs(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=Fa(sh(et),Se(),e=>new et(e)),A1=oh([Se(),dr("base64")]),bh=Fa(sh(ie.Buffer),A1,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 B1(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(KS())})})])}const _A=B1(Ua());function bt(e){return Fa(B1(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 kf(e){return me({context:me({slot:te()}),value:e})}function vh(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 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=Yg(Se(),Ce(te())),Xs=Te(mn([me({}),Se()])),TA=me({err:Xs}),kA=dr("receivedSignature"),CA=me({"solana-core":Se(),"feature-set":Qe(te())}),I1=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:oh([Se(),dr("base64")])})))})),LA=mr(me({byIdentity:Yg(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 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 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)})),_h=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:bh,rentEpoch:te()})}))),Eh=me({program:Se(),parsed:Ua(),space:te()}),WA=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:Eh,rentEpoch:te()})}))),KA=mr(Ce(me({lamports:te(),address:kr}))),Ka=me({executable:bi(),owner:kr,lamports:te(),data:bh,rentEpoch:te()}),ZA=me({pubkey:kr,account:Ka}),GA=Fa(mn([sh(ie.Buffer),Eh]),mn([A1,Eh]),e=>Array.isArray(e)?Be(e,bh):e),xh=me({executable:bi(),owner:kr,lamports:te(),data:GA,rentEpoch:te()}),YA=me({pubkey:kr,account:xh}),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:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),QA=bt(Ce(me({signature:Se(),slot:te(),err:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),e6=me({subscription:te(),result:kf(Ka)}),t6=me({pubkey:kr,account:Ka}),r6=me({subscription:te(),result:kf(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:kf(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())}),R1=me({votePubkey:Se(),nodePubkey:Se(),activatedStake:te(),epochVoteAccount:bi(),epochCredits:Ce(oh([te(),te(),te()])),commission:te(),lastVote:te(),rootSlot:Te(te())}),u6=bt(me({current:Ce(R1),delinquent:Ce(R1)})),l6=mn([dr("processed"),dr("confirmed"),dr("finalized")]),h6=me({slot:te(),confirmations:Te(te()),err:Xs,confirmationStatus:Qe(l6)}),d6=mr(Ce(Te(h6))),p6=bt(te()),T1=me({accountKey:kr,writableIndexes:Ce(te()),readonlyIndexes:Ce(te())}),Sh=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(T1))})}),k1=me({pubkey:kr,signer:bi(),writable:bi(),source:Qe(mn([dr("transaction"),dr("lookupTable")]))}),C1=me({accountKeys:Ce(k1),signatures:Ce(Se())}),L1=me({parsed:Ua(),program:Se(),programId:kr}),$1=me({accounts:Ce(kr),data:Se(),programId:kr}),g6=mn([$1,L1]),y6=mn([me({parsed:Ua(),program:Se(),programId:Se()}),me({accounts:Ce(Se()),data:Se(),programId:Se()})]),O1=Fa(g6,y6,e=>"accounts"in e?Be(e,$1):Be(e,L1)),M1=me({signatures:Ce(Se()),message:me({accountKeys:Ce(k1),instructions:Ce(O1),recentBlockhash:Se(),addressTableLookups:Qe(Te(Ce(T1)))})}),Cf=me({accountIndex:te(),mint:Se(),owner:Qe(Se()),uiTokenAmount:_h}),N1=me({writable:Ce(kr),readonly:Ce(kr)}),Lf=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(Cf))),postTokenBalances:Qe(Te(Ce(Cf))),loadedAddresses:Qe(N1),computeUnitsConsumed:Qe(te())}),Ah=me({err:Xs,fee:te(),innerInstructions:Qe(Te(Ce(me({index:te(),instructions:Ce(O1)})))),preBalances:Ce(te()),postBalances:Ce(te()),logMessages:Qe(Te(Ce(Se()))),preTokenBalances:Qe(Te(Ce(Cf))),postTokenBalances:Qe(Te(Ce(Cf))),loadedAddresses:Qe(N1),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()))}),w6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Sh,meta:Te(Lf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),m6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),b6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:C1,meta:Te(Lf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),v6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:M1,meta:Te(Ah),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),_6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:C1,meta:Te(Ah),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),E6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),x6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Sh,meta:Te(Lf)})),rewards:Qe(Ce(Js)),blockTime:Te(te())}))),P1=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),signatures:Ce(Se()),blockTime:Te(te())}))),Bh=bt(Te(me({slot:te(),meta:Te(Lf),blockTime:Qe(Te(te())),transaction:Sh,version:Qe(Do)}))),$f=bt(Te(me({slot:te(),transaction:M1,meta:Te(Ah),blockTime:Qe(Te(te())),version:Qe(Do)}))),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:Xs,logs:Ce(Se()),signature:Se()}),$6=me({result:kf(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=_1(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(_h));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(_h));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(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(xh)));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(xh))));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(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: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 g1(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 y1(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=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,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:vh(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,Bh);if("error"in a)throw new je(a.error,"failed to get transaction");const c=a.result;return c&&{...c,transaction:{...c.transaction,message:vh(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,$f);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,$f);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,Bh);if("error"in u)throw new je(u.error,"failed to get transactions");const l=u.result;return l&&{...l,transaction:{...l.transaction,message:vh(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 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,P1);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,P1);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,Bh);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,$f);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,$f);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 S1({key:t,state:S1.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=wh.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 Uo(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 Uo(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,I1);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,I1);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 E1("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,C6);if("error"in c){let u;throw"data"in c.error&&(u=c.error.data.logs),new E1("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=_1([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"),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"),gh.utils.isValidPrivateKey,gh.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 U1;new et("StakeConfig11111111111111111111111111111111");class F1{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}}U1=F1,F1.default=new U1(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"),Po("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")]),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 D1="solana:signAndSendTransaction",N6="solana:signIn",H1="solana:signMessage",j1="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),Of;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 `,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 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]"};/*! +`,r)}}class q6 extends Event{constructor(t){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),H6(this,Of,void 0),j6(this,Of,t)}get detail(){return D6(this,Of)}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")}}Of=new WeakMap;function V6(e){z6(e.getInstanceWithAdapter())}const W6="solana:mainnet",Ih=[W6];function Rh(e){return Ih.includes(e)}function Mf(e){return"version"in e}var q1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ho=(e,t,r)=>(q1(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)=>(q1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Nf,Pf,Uf,Ff,Df,Hf;const K6=Ih,Z6=[D1,j1,H1],V1=class{constructor({address:e,publicKey:t,label:r,icon:n}){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),jo(this,Hf,void 0),new.target===V1&&Object.freeze(this),zo(this,Nf,e),zo(this,Pf,t),zo(this,Uf,K6),zo(this,Ff,Z6),zo(this,Df,r),zo(this,Hf,n)}get address(){return Ho(this,Nf)}get publicKey(){return Ho(this,Pf).slice()}get chains(){return Ho(this,Uf).slice()}get features(){return Ho(this,Ff).slice()}get label(){return Ho(this,Df)}get icon(){return Ho(this,Hf)}};let G6=V1;Nf=new WeakMap,Pf=new WeakMap,Uf=new WeakMap,Ff=new WeakMap,Df=new WeakMap,Hf=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)=>(Th(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)},kh=(e,t,r,n)=>(Th(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ch=(e,t,r)=>(Th(e,t,"access private method"),r),Qs,Lh,$h,Oh,on,hn,Mh,jf,Nh,Ph,W1,qo,zf,Uh,Fh,Dh,qf,Hh,Vf,jh;const Q6="trust:",K1=class{constructor(e){Dr(this,jf),Dr(this,Ph),Dr(this,Qs,{}),Dr(this,Lh,"1.0.0"),Dr(this,$h,"Trust"),Dr(this,Oh,Y6),Dr(this,on,null),Dr(this,hn,void 0),Dr(this,Mh,(t,r)=>{var n;return(n=nt(this,Qs)[t])!=null&&n.push(r)||(nt(this,Qs)[t]=[r]),()=>Ch(this,Ph,W1).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||!X6(i.publicKey,n))&&(kh(this,on,new G6({address:r,publicKey:n})),Ch(this,jf,Nh).call(this,"change",{accounts:this.accounts}))}}),Dr(this,zf,()=>{nt(this,on)&&(kh(this,on,null),Ch(this,jf,Nh).call(this,"change",{accounts:this.accounts}))}),Dr(this,Uh,()=>{nt(this,hn).publicKey?nt(this,qo).call(this):nt(this,zf).call(this)}),Dr(this,Fh,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,Dh,async()=>{await nt(this,hn).disconnect()}),Dr(this,qf,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(!Rh(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,qf).call(this,n));return r}),Dr(this,Hh,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&&!Rh(s))throw new Error("invalid chain");const o=await nt(this,hn).signTransaction(qa.deserialize(n)),a=Mf(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(!Rh(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:Mf(o)?o.serialize():new Uint8Array(o.serialize({requireAllSignatures:!1,verifySignatures:!1}))})))}return r}),Dr(this,Vf,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,Vf).call(this,n));return r}),Dr(this,jh,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===K1&&Object.freeze(this),kh(this,hn,e),e.on("connect",nt(this,qo),this),e.on("disconnect",nt(this,zf),this),e.on("accountChanged",nt(this,Uh),this),nt(this,qo).call(this)}get version(){return nt(this,Lh)}get name(){return nt(this,$h)}get icon(){return nt(this,Oh)}get chains(){return Ih.slice()}get features(){return{[P6]:{version:"1.0.0",connect:nt(this,Fh)},[U6]:{version:"1.0.0",disconnect:nt(this,Dh)},[F6]:{version:"1.0.0",on:nt(this,Mh)},[D1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:nt(this,qf)},[j1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:nt(this,Hh)},[H1]:{version:"1.0.0",signMessage:nt(this,Vf)},[N6]:{version:"1.0.0",signIn:nt(this,jh)},[Q6]:{trust:nt(this,hn)}}}get accounts(){return nt(this,on)?[nt(this,on)]:[]}};let eB=K1;Qs=new WeakMap,Lh=new WeakMap,$h=new WeakMap,Oh=new WeakMap,on=new WeakMap,hn=new WeakMap,Mh=new WeakMap,jf=new WeakSet,Nh=function(e,...t){var r;(r=nt(this,Qs)[e])==null||r.forEach(n=>n.apply(null,t))},Ph=new WeakSet,W1=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,zf=new WeakMap,Uh=new WeakMap,Fh=new WeakMap,Dh=new WeakMap,qf=new WeakMap,Hh=new WeakMap,Vf=new WeakMap,jh=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;Mf(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 zh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},qh=(e,t,r)=>(zh(e,t,"read from private field"),r?r.call(e):t.get(e)),Wf=(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)},Vh=(e,t,r,n)=>(zh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Kf=(e,t,r)=>(zh(e,t,"access private method"),r),Zf,Gf,Yf,Vo,Za;const Xf=class extends sf{constructor(e){super(),Wf(this,Vo),Wf(this,Zf,!1),Wf(this,Gf,!0),this.isTrust=!0,this.isTrustWallet=!0,Wf(this,Yf,!1),e&&(typeof e.enableAdapter<"u"&&Vh(this,Gf,e.enableAdapter),typeof e.cluster<"u"&&(this.connection=new M6(e.cluster,"confirmed")),typeof e.disableMobileAdapter<"u"&&Vh(this,Zf,e.disableMobileAdapter),typeof e.useLegacySign<"u"&&Vh(this,Yf,e.useLegacySign),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),qh(this,Gf)&&V6(this),qh(this,Zf)||(this.mobileAdapter=new tB(this,qh(this,Yf)))}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 Kf(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 Kf(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 Kf(this,Vo,Za).call(this,{method:"signRawTransactionMulti",params:{transactions:e.map(t=>{const r=JSON.stringify(t);let n="legacy",i;Mf(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=Xf.bufferToHex(e),n=await Kf(this,Vo,Za).call(this,{method:"signMessage",params:{data:r}});return{signature:ie.Buffer.from(Xf.messageToBuffer(n).buffer),publicKey:(t=this.publicKey)==null?void 0:t.toBase58()}}signIn(e){throw new Error("Method not implemented.")}getNetwork(){return Xf.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=Xf;Zf=new WeakMap,Gf=new WeakMap,Yf=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={},Jf={},Qf={},eu={},G1={},Ko={},tu={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.output=Hr.exists=Hr.hash=Hr.bytes=Hr.bool=Hr.number=void 0;function ru(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}Hr.number=ru;function Y1(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}Hr.bool=Y1;function rB(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Wh(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=Wh;function X1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ru(e.outputLen),ru(e.blockLen)}Hr.hash=X1;function J1(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=J1;function Q1(e,t){Wh(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(tu,"__esModule",{value:!0}),tu.SHA2=void 0;const Kh=Hr,Ga=Pi;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 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,Kh.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,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]),ls=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),hs=new Uint32Array(64);class ey extends oB.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+aB(a,c,u)+fB[y]+hs[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(){hs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class uB extends ey{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 ey),Ko.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 ty=BigInt(0),iu=BigInt(1),lB=BigInt(2);function Zo(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}st.isBytes=Zo;const hB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zh(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 su(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;ity;e>>=iu,t+=1);return t}st.bitLen=vB;function _B(e,t){return e>>BigInt(t)&iu}st.bitGet=_B;const EB=(e,t,r)=>e|(r?iu:ty)<(lB<new Uint8Array(e),oy=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=Yh(e),i=Yh(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Yh())=>{i=a(oy([0]),y),n=a(),y.length!==0&&(i=a(oy([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"||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 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),ds=BigInt(2),IB=BigInt(3),Xh=BigInt(4),ay=BigInt(5),cy=BigInt(8);BigInt(9),BigInt(16);function Ln(e,t){const r=e%t;return r>=jr?r:t+r}ht.mod=Ln;function fy(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=fy;function RB(e,t,r){let n=e;for(;t-- >jr;)n*=n,n%=r;return n}ht.pow2=RB;function ou(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=ou;function uy(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=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 hy(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=hy;function dy(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=dy;function LB(e,t,r){return e.mul(t,typeof r=="bigint"?ou(r,e.ORDER):e.inv(r))}ht.FpDiv=LB;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 Jh(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}ht.nLength=Jh;function OB(e,t,r=!1,n={}){if(e<=jr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=Jh(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=ly(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)=>hy(a,c,u),div:(c,u)=>Ln(c*ou(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>ou(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>dy(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=Jh(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 Qh(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=Qh;function py(e){const t=Qh(e);return t+Math.ceil(t/2)}ht.getMinHashLength=py;function UB(e,t,r=!1){const n=e.length,i=Qh(t),s=py(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 ed={},Go={};Object.defineProperty(Go,"__esModule",{value:!0}),Go.validateBasic=Go.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gy=ht,FB=st,DB=BigInt(0),td=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&td&&(o=o.add(a)),a=a.double(),s>>=td;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+=td);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=HB;function jB(e){return(0,gy.validateField)(e.Fp),(0,FB.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,gy.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}Go.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=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}(ed);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 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 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,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=[WB(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=yy;function wy(e,t,r,n,i){if(Ya(e),Ya(t),rd(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=wy;function nd(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),rd(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=yy(e,u,A,o);else if(a==="xof")v=wy(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=nd(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=nd(n,1,{...r,DST:r.encodeDST,...i}),o=e.fromAffine(t(s[0])).clearCofactor();return o.assertValidity(),o}}}Vn.createHasher=ZB;var Yo={},my={};(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)})(my),Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.createCurve=Yo.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const GB=my,by=Pi,YB=ed;function vy(e){return{hash:e,hmac:(t,...r)=>(0,GB.hmac)(e,t,(0,by.concatBytes)(...r)),randomBytes:by.randomBytes}}Yo.getHash=vy;function XB(e,t){const r=n=>(0,YB.weierstrass)({...e,...vy(n)});return Object.freeze({...r(t),create:r})}Yo.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=Ko,r=Pi,n=ht,i=ed,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)()}(G1),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=G1;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(eu),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=eu;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}(Qf);var au={};Object.defineProperty(au,"__esModule",{value:!0}),au.GWEI_TO_WEI=void 0,au.GWEI_TO_WEI=BigInt(1e9);var id={},vi={};Object.defineProperty(vi,"__esModule",{value:!0}),vi.RLP=vi.utils=vi.decode=vi.encode=void 0;function sd(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 _y(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return Ay(Sy(e))}function Ey(e,t){if(e<56)return Uint8Array.from([e+t]);const r=cd(e),n=r.length/2,i=cd(t+55+n);return Uint8Array.from(cu(i+r))}function xy(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);const r=Ry(e),n=od(r);if(t)return n;if(n.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return n.data}vi.decode=xy;function od(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=od(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 Sy(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:Iy(e)?e.slice(2):e}function Ry(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return Iy(e)?cu(QB(eI(e))):By(e);if(typeof e=="number"||typeof e=="bigint")return e?cu(cd(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}vi.utils={bytesToHex:Sy,concatBytes:ad,hexToBytes:cu,utf8ToBytes:By},vi.RLP={encode:sd,decode:xy};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 fu=BigInt(2**32-1),fd=BigInt(32);function ud(e,t=!1){return t?{h:Number(e&fu),l:Number(e>>fd&fu)}:{h:Number(e>>fd&fu)|0,l:Number(e&fu)|0}}ot.fromBig=ud;function Ty(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);ot.toBig=ky;const Cy=(e,t,r)=>e>>>r;ot.shrSH=Cy;const Ly=(e,t,r)=>e<<32-r|t>>>r;ot.shrSL=Ly;const $y=(e,t,r)=>e>>>r|t<<32-r;ot.rotrSH=$y;const Oy=(e,t,r)=>e<<32-r|t>>>r;ot.rotrSL=Oy;const My=(e,t,r)=>e<<64-r|t>>>r-32;ot.rotrBH=My;const Ny=(e,t,r)=>e>>>r-32|t<<64-r;ot.rotrBL=Ny;const Py=(e,t)=>t;ot.rotr32H=Py;const Uy=(e,t)=>e;ot.rotr32L=Uy;const Fy=(e,t,r)=>e<>>32-r;ot.rotlSH=Fy;const Dy=(e,t,r)=>t<>>32-r;ot.rotlSL=Dy;const Hy=(e,t,r)=>t<>>64-r;ot.rotlBH=Hy;const jy=(e,t,r)=>e<>>64-r;ot.rotlBL=jy;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 qy=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);ot.add3L=qy;const Vy=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;ot.add3H=Vy;const Wy=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);ot.add4L=Wy;const Ky=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;ot.add4H=Ky;const Zy=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ot.add5L=Zy;const Gy=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;ot.add5H=Gy;const tI={fromBig:ud,split:Ty,toBig:ky,shrSH:Cy,shrSL:Ly,rotrSH:$y,rotrSL:Oy,rotrBH:My,rotrBL:Ny,rotr32H:Py,rotr32L:Uy,rotlSH:Fy,rotlSL:Dy,rotlBH:Hy,rotlBL:jy,add:zy,add3L:qy,add3H:Vy,add4L:Wy,add4H:Ky,add5H:Gy,add5L:Zy};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 Jo=Hr,Xa=ot,Ja=Pi,[Yy,Xy,Jy]=[[],[],[]],rI=BigInt(0),Qa=BigInt(1),nI=BigInt(2),iI=BigInt(7),sI=BigInt(256),oI=BigInt(113);for(let e=0,t=Qa,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Yy.push(2*(5*n+r)),Xy.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^=Qa<<(Qa<r>32?(0,Xa.rotlBH)(e,t,r):(0,Xa.rotlSH)(e,t,r),ew=(e,t,r)=>r>32?(0,Xa.rotlBL)(e,t,r):(0,Xa.rotlSL)(e,t,r);function tw(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=Qy(u,l,1)^r[a],A=ew(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=Xy[o],c=Qy(i,s,a),u=ew(i,s,a),l=Yy[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=tw;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(){tw(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 rw=(e,t,r)=>(0,Ja.wrapXOFConstructorWithOpts)((n={})=>new ec(t,e,n.dkLen===void 0?r:n.dkLen,!0));Qt.shake128=rw(31,168,128/8),Qt.shake256=rw(31,136,256/8);function ld(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 uu={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 ld=="function"&&ld.bind(e);return{node:v&&!A?v("crypto"):void 0,web:A}})()})(uu,uu.exports),Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.keccak512=Wn.keccak384=Wn.keccak256=Wn.keccak224=void 0;const tc=Qt,lu=uu.exports;Wn.keccak224=(0,lu.wrapHash)(tc.keccak_224),Wn.keccak256=(()=>{const e=(0,lu.wrapHash)(tc.keccak_256);return e.create=tc.keccak_256.create,e})(),Wn.keccak384=(0,lu.wrapHash)(tc.keccak_384),Wn.keccak512=(0,lu.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 nw(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=nw;const fI=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return nw(e)?e.slice(2):e};er.stripHexPrefix=fI;function iw(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=iw;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}(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=eu,i=uu.exports,s=eo,o=Qf,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}(id);var rc={};Object.defineProperty(rc,"__esModule",{value:!0}),rc.Address=void 0;const nc=id,hu=eo;class Fi{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new Fi((0,hu.zeros)(20))}static fromString(t){if(!(0,nc.isValidAddress)(t))throw new Error("Invalid address");return new Fi((0,hu.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,hu.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,hu.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 du={},hd={};(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})(hd),Object.defineProperty(du,"__esModule",{value:!0}),du.Withdrawal=void 0;const sw=rc,dd=eo,br=hd;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 sw.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 sw.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,dd.bigIntToHex)(this.index),validatorIndex:(0,dd.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,dd.bigIntToHex)(this.amount)}}}du.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 EI=Wn,ow=eu,bn=eo,pd=Qf,xI=Kn;function SI(e,t,r){const n=ow.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 pu(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function gu(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=pu(t,i);if(!gu(o))throw new Error("Invalid signature v value");const c=ow.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=pu(e,n);if(!gu(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=pu(e,n);if(!gu(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||!gu(pu(e,i)))return!1;const s=(0,bn.bufferToBigInt)(t),o=(0,bn.bufferToBigInt)(r);return!(s===BigInt(0)||s>=pd.SECP256K1_ORDER||o===BigInt(0)||o>=pd.SECP256K1_ORDER||n&&o>=pd.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 aw={};(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})(aw);var yu={};Object.defineProperty(yu,"__esModule",{value:!0}),yu.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)}}yu.AsyncEventEmitter=$I;var wu={};Object.defineProperty(wu,"__esModule",{value:!0}),wu.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)}}}wu.Lock=OI;var Qo={},to={},pr=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},_i=[],Zn=[],MI=typeof Uint8Array<"u"?Uint8Array:Array,gd=!1;function cw(){gd=!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 mu(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 uw(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,lw=Array.isArray||function(e){return FI.call(e)=="[object Array]"};/*! * The buffer module from node.js, for the browser. * * @author Feross Aboukhadijeh * @license MIT - */var RI=50;le.TYPED_ARRAY_SUPPORT=pr.TYPED_ARRAY_SUPPORT!==void 0?pr.TYPED_ARRAY_SUPPORT:!0,mu();function mu(){return le.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Di(e,t){if(mu()=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=bu())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+bu().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 xw(e).length;default:if(n)return Eu(e).length;t=(""+t).toLowerCase(),n=!0}}le.byteLength=pw;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 mw(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 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:yw(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):yw(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function yw(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 ww(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?fw(e):fw(e.slice(t,r))}function mw(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 bw=4096;function JI(e){var t=e.length;if(t<=bw)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),mu(this,t,!0,23,4)},le.prototype.readFloatBE=function(t,r){return r||zr(t,4,this.length),mu(this,t,!1,23,4)},le.prototype.readDoubleLE=function(t,r){return r||zr(t,8,this.length),mu(this,t,!0,52,8)},le.prototype.readDoubleBE=function(t,r){return r||zr(t,8,this.length),mu(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 vu(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):vu(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):vu(this,t,r,!1),r+2};function _u(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):_u(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):_u(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):vu(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):vu(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):_u(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):_u(this,t,r,!1),r+4};function vw(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 _w(e,t,r,n,i){return i||vw(e,t,r,4),uw(e,t,r,n,23,4),r+4}le.prototype.writeFloatLE=function(t,r,n){return _w(this,t,r,!0,n)},le.prototype.writeFloatBE=function(t,r,n){return _w(this,t,r,!1,n)};function Ew(e,t,r,n,i){return i||vw(e,t,r,8),uw(e,t,r,n,52,8),r+8}le.prototype.writeDoubleLE=function(t,r,n){return Ew(this,t,r,!0,n)},le.prototype.writeDoubleBE=function(t,r,n){return Ew(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 xw(e){return NI(i8(e))}function xu(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||Sw(e)||l8(e))}function Sw(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"&&Sw(e.slice(0,0))}function Aw(){throw new Error("setTimeout has not been defined")}function Bw(){throw new Error("clearTimeout has not been defined")}var ys=Aw,ws=Bw;typeof pr.setTimeout=="function"&&(ys=setTimeout),typeof pr.clearTimeout=="function"&&(ws=clearTimeout);function Iw(e){if(ys===setTimeout)return setTimeout(e,0);if((ys===Aw||!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 h8(e){if(ws===clearTimeout)return clearTimeout(e);if((ws===Bw||!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,Su=-1;function d8(){!ea||!no||(ea=!1,no.length?Hi=no.concat(Hi):Su=-1,Hi.length&&Rw())}function Rw(){if(!ea){var e=Iw(d8);ea=!0;for(var t=Hi.length;t;){for(no=Hi,Hi=[];++Su1)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]),Tu(t)?r.showHidden=t:t&&Ld(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),Ru(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 Ru(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=Ru(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)),cc(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Ad(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(ku(t))return e.stylize(Date.prototype.toString.call(t),"date");if(cc(t))return Ad(t)}var c="",u=!1,l=["{","}"];if(Id(t)&&(u=!0,l=["[","]"]),fc(t)){var y=t.name?": "+t.name:"";c=" [Function"+y+"]"}if(ac(t)&&(c=" "+RegExp.prototype.toString.call(t)),ku(t)&&(c=" "+Date.prototype.toUTCString.call(t)),cc(t)&&(c=" "+Ad(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=G8(e,t,r,o,s):A=s.map(function(v){return Bd(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(ms(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(Td(t))return e.stylize(""+t,"number");if(Tu(t))return e.stylize(""+t,"boolean");if(ji(t))return e.stylize("null","null")}function Ad(e){return"["+Error.prototype.toString.call(e)+"]"}function G8(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 U8(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 Y8(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 Bd(e){return Array.isArray(e)}function Ru(e){return typeof e=="boolean"}function ji(e){return e===null}function Id(e){return e==null}function Rd(e){return typeof e=="number"}function ms(e){return typeof e=="string"}function Iw(e){return typeof e=="symbol"}function Si(e){return e===void 0}function ac(e){return zi(e)&&Td(e)==="[object RegExp]"}function zi(e){return typeof e=="object"&&e!==null}function Tu(e){return zi(e)&&Td(e)==="[object Date]"}function cc(e){return zi(e)&&(Td(e)==="[object Error]"||e instanceof Error)}function fc(e){return typeof e=="function"}function Rw(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"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"u"}function Ow(e){return le.isBuffer(e)}function kd(e){return Object.prototype.toString.call(e)}function Cd(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=[Cd(e.getHours()),Cd(e.getMinutes()),Cd(e.getSeconds())].join(":");return[e.getDate(),X8[e.getMonth()],t].join(" ")}function Mw(){console.log("%s - %s",J8(),Au.apply(null,arguments))}function Ld(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 Nw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var oo=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function $d(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 Od=hf.exports.Buffer,Uw=Od.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"&&(Od.isEncoding===Uw||!Uw(e)))throw new Error("Unknown encoding: "+e);return t||e}var Fw=uc;function uc(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=Od.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 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=Dw;var Vt=Sd("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 Dw(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 Fw(e.encoding),this.encoding=e.encoding)}function ar(e){if(!(this instanceof ar))return new ar(e);this._readableState=new Dw(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="")),Hw(this,r,e,t,!1)},ar.prototype.unshift=function(e){var t=this._readableState;return Hw(this,t,e,"",!0)},ar.prototype.isPaused=function(){return this._readableState.flowing===!1};function Hw(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&&Cu(e))),_R(e,t)}else i||(t.reading=!1);return wR(t)}function wR(e){return!e.ended&&(e.needReadable||e.length=jw?e=jw:(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?Pd(this):Cu(this),null;if(e=zw(e,t),e===0&&t.ended)return t.length===0&&Pd(this),null;var n=t.needReadable;Vt("need readable",n),(t.length===0||t.length-e0?i=Vw(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&&Pd(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,Cu(e)}}function Cu(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Vt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?On(qw,e):qw(e))}function qw(e){Vt("emit readable"),e.emit("readable"),Nd(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&&Ww(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,Nd(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 Pd(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===co.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"},qd=hc-tm,ra=Math.floor,Vd=String.fromCharCode;function rm(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+=ra(e/t);e>qd*zd>>1;n+=hc)e=ra(e/qd);return ra(n+(qd+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(Vd(c));const o=t.length;let a=o;for(o&&t.push(tT);a=n&&lra((jd-i)/u)&&rm("overflow"),i+=(c-n)*u,n=c;for(const l of e)if(ljd&&rm("overflow"),l===n){let y=i;for(let A=hc;;A+=hc){const v=A<=s?tm:A>=s+zd?zd: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)?im(i[v])?i[v].push(R):i[v]=[i[v],R]:i[v]=R}return i}const am=pr.URL,cm=pr.URLSearchParams;var pT={parse:fo,resolve:gm,resolveObject:ym,fileURLToPath:dm,format:pm,Url:Mn,URL:am,URLSearchParams:cm};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),Wd=["'"].concat(bT),fm=["%","/","?",";","#"].concat(Wd),um=["/","?","#"],vT=255,lm=/^[+a-z0-9A-Z_-]{0,63}$/,_T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ET={javascript:!0,"javascript:":!0},Kd={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 hm(this,e,t,r)};function hm(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(lm)){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=Wd.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 wm(this)};function wm(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:fo,resolve:gm,resolveObject:ym,fileURLToPath:dm,format:pm,URL:am,URLSearchParams:cm,default:pT,Url:Mn});function Gd(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 mm(e,t){var r=Gd(e,t);return r.end(),r}function Yd(){}Yd.defaultMaxSockets=4;var bm=["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"],vm={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:Gd,get:mm,Agent:Yd,METHODS:bm,STATUS_CODES:vm},BT=Object.freeze({__proto__:null,request:Gd,get:mm,Agent:Yd,METHODS:bm,STATUS_CODES:vm,default:AT}),IT=Un(BT);function Xd(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 _m(e,t){var r=Xd(e,t);return r.end(),r}function Jd(){}Jd.defaultMaxSockets=4;var Em=["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"],xm={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:Xd,get:_m,Agent:Jd,METHODS:Em,STATUS_CODES:xm},TT=Object.freeze({__proto__:null,request:Xd,get:_m,Agent:Jd,METHODS:Em,STATUS_CODES:xm,default:RT}),kT=Un(TT),Sm={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 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 OT=0,Im=1,MT=2,NT=3,PT=258,Qd=29,pc=256,gc=pc+1+Qd,sa=30,e0=19,Rm=2*gc+1,uo=15,t0=16,UT=7,r0=256,Tm=16,km=17,Cm=18,n0=[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],Mu=[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],Lm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DT=512,Wi=new Array((gc+2)*2);ia(Wi);var yc=new Array(sa*2);ia(yc);var wc=new Array(DT);ia(wc);var mc=new Array(PT-NT+1);ia(mc);var i0=new Array(Qd);ia(i0);var Nu=new Array(sa);ia(Nu);function s0(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 $m,Om,Mm;function o0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Nm(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>t0-r?(e.bi_buf|=t<>t0-e.bi_valid,e.bi_valid+=r-t0):(e.bi_buf|=t<>>=1,r<<=1;while(--t>0);return r>>>1}function HT(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 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<=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 Um(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]=Pm(n[a]++,a))}}function zT(){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 qT(e,t,r,n){Dm(e),n&&(bc(e,r),bc(e,~r)),Vi(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Hm(e,t,r,n){var i=t*2,s=r*2;return e[i]>1;o>=1;o--)a0(e,r,o);u=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],a0(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++,a0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],jT(e,t),Um(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[Lm[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 Am;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Bm;for(r=32;r0?(e.strm.data_type===$T&&(e.strm.data_type=KT(e)),c0(e,e.l_desc),c0(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?Wm(e,t,r,n):e.strategy===LT||s===i?(En(e,(Im<<1)+(n?1:0),3),jm(e,Wi,yc)):(En(e,(MT<<1)+(n?1:0),3),WT(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),jm(e,e.dyn_ltree,e.dyn_dtree)),Fm(e),n&&Dm(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[Nm(t)*2]++),e.last_lit===e.lit_bufsize-1}function f0(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 lo=0,QT=1,e4=3,vs=4,Km=5,_s=0,Zm=1,Es=-2,t4=-3,u0=-5,r4=-1,n4=1,Pu=2,i4=3,s4=4,o4=2,l0=8,a4=9,c4=29,f4=256,h0=f4+1+c4,u4=30,l4=19,h4=2*h0+1,d4=15,Ft=3,xs=258,si=xs+Ft+1,p4=32,d0=42,p0=69,Uu=73,Fu=91,Du=103,ho=113,vc=666,$r=1,_c=2,po=3,oa=4,g4=3;function Ss(e,t){return e.msg=Sm[t],t}function Gm(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){YT(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 y4(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=f0(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 Ym(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=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(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 g0(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 b4(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,w4),new Bi(4,4,8,4,g0),new Bi(4,5,16,8,g0),new Bi(4,6,32,32,g0),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 v4(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 _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=l0,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),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(d4+1),this.heap=new Xn(2*h0+1),go(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xn(2*h0+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 E4(e){var t;return!e||!e.state?Ss(e,Es):(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?d0:ho,e.adler=t.wrap===2?0:1,t.last_flush=lo,ZT(t),_s)}function Xm(e){var t=E4(e);return t===_s&&v4(e.state),t}function x4(e,t,r,n,i,s){if(!e)return Es;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!==l0||n<8||n>15||t<0||t>9||s<0||s>s4)return Ss(e,Es);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<Km||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?u0:Es);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===d0)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>=Pu||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=p0):(Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,n.level===9?2:n.strategy>=Pu||n.level<2?4:0),Pt(n,g4),n.status=ho);else{var o=l0+(n.w_bits-8<<4)<<8,a=-1;n.strategy>=Pu||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=ho,Ec(n,o),n.strstart!==0&&(Ec(n,e.adler>>>16),Ec(n,e.adler&65535)),e.adler=1}if(n.status===p0)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=Uu)}else n.status=Uu;if(n.status===Uu)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=Fu)}else n.status=Fu;if(n.status===Fu)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=Du)}else n.status=Du;if(n.status===Du&&(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&&Gm(t)<=Gm(r)&&t!==vs)return Ss(e,u0);if(n.status===vc&&e.avail_in!==0)return Ss(e,u0);if(e.avail_in!==0||n.lookahead!==0||t!==lo&&n.status!==vc){var c=n.strategy===Pu?b4(n,t):n.strategy===i4?m4(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===QT?GT(n):t!==Km&&(Wm(n,0,0,!1),t===e4&&(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 A4(e){var t;return!e||!e.state?Es:(t=e.state.status,t!==d0&&t!==p0&&t!==Uu&&t!==Fu&&t!==Du&&t!==ho&&t!==vc?Ss(e,Es):(e.state=null,t===ho?Ss(e,t4):_s))}var Hu=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=Hu;break e}if(v>>>=$,R-=$,$=s-o,G>$){if($=G-$,$>l&&r.sane){e.msg="invalid distance too far back",r.mode=Hu;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=Hu;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=Hu;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===eb||A!==1))return-1;for(I[1]=0,u=1;uJm||e===tb&&H>Qm)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<Jm||e===tb&&H>Qm)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,rb=1,nb=2,ib=4,$4=5,ju=6,Ac=0,O4=1,M4=2,Bs=-2,N4=-3,P4=-4,U4=-5,sb=8,ob=1,ab=2,cb=3,fb=4,ub=5,lb=6,hb=7,db=8,pb=9,gb=10,yb=11,Ki=12,w0=13,wb=14,m0=15,mb=16,bb=17,vb=18,_b=19,zu=20,qu=21,Eb=22,xb=23,Sb=24,Ab=25,Bb=26,b0=27,Ib=28,Rb=29,cr=30,F4=31,D4=32,H4=852,j4=592;function Tb(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?Bs:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=ob,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Ou(H4),t.distcode=t.distdyn=new Ou(j4),t.sane=1,t.back=-1,Ac)}function kb(e){var t;return!e||!e.state?Bs:(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))?Bs:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,kb(e))}function W4(e,t){var r,n;return e?(n=new z4,e.state=n,n.window=null,r=V4(e,t),r!==Ac&&(e.state=null),r):Bs}var Cb=!0,v0,_0;function K4(e){if(Cb){var t;for(v0=new Ou(512),_0=new Ou(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(rb,e.lens,0,288,v0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Sc(nb,e.lens,0,32,_0,0,e.work,{bits:5}),Cb=!1}e.lencode=v0,e.lenbits=9,e.distcode=_0,e.distbits=5}function Z4(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=ab;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)!==sb){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=cb;case cb: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=fb;case fb: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=ub;case ub: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=lb;case lb: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=hb;case hb: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 gb:for(;l<32;){if(a===0)break e;a--,u+=n[s++]<>>=l&7,l-=l&7,r.mode=b0;break}for(;l<3;){if(a===0)break e;a--,u+=n[s++]<>>=1,l-=1,u&3){case 0:r.mode=wb;break;case 1:if(K4(r),r.mode=zu,t===ju){u>>>=2,l-=2;break e}break;case 2:r.mode=bb;break;case 3:e.msg="invalid block type",r.mode=cr}u>>>=2,l-=2;break;case wb: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=m0,t===ju)break e;case m0:r.mode=mb;case mb: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 bb: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=vb;case vb: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(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=_b;case _b: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(rb,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(nb,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=zu,t===ju)break e;case zu:r.mode=qu;case qu: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===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=Bb;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=Eb;case Eb:if(r.extra){for(Q=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=xb;case xb: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=Sb;case Sb: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=Ab;case Ab: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=qu);break;case Bb:if(c===0)break e;i[o++]=r.length,c--,r.mode=qu;break;case b0: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===Wu)&&(this.windowBits+=16),this.mode===Rc&&(this.windowBits+=32),(this.mode===la||this.mode===Ic)&&(this.windowBits=-this.windowBits),this.strm=new CT;var s;switch(this.mode){case ua:case Bc:case la:s=x4(this.strm,this.level,Db,this.windowBits,this.memLevel,this.strategy);break;case Vu:case Wu:case Ic:case Rc:s=W4(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(s!==Ku){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===E0)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=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(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(Is,fr),qr(Rs,fr),qr(Ts,fr),qr(ks,fr),qr(Cs,fr),qr(Ls,fr),qr($s,fr);var g5={codes:ha,createDeflate:jb,createInflate:zb,createDeflateRaw:qb,createInflateRaw:Vb,createGzip:Wb,createGunzip:Kb,createUnzip:Zb,deflate:Gb,deflateSync:Yb,gzip:Xb,gzipSync:Jb,deflateRaw:Qb,deflateRawSync:ev,unzip:tv,unzipSync:rv,inflate:nv,inflateSync:iv,gunzip:sv,gunzipSync:ov,inflateRaw:av,inflateRawSync:cv,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr},y5=Object.freeze({__proto__:null,codes:ha,createDeflate:jb,createInflate:zb,createDeflateRaw:qb,createInflateRaw:Vb,createGzip:Wb,createGunzip:Kb,createUnzip:Zb,deflate:Gb,deflateSync:Yb,gzip:Xb,gzipSync:Jb,deflateRaw:Qb,deflateRawSync:ev,unzip:tv,unzipSync:rv,inflate:nv,inflateSync:iv,gunzip:sv,gunzipSync:ov,inflateRaw:av,inflateRawSync:cv,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr,default:g5}),w5=Un(y5),m5=Un(tR),b5=Un(ST);Object.defineProperty(to,"__esModule",{value:!0}),to.InvalidStatusCodeError=to.InvalidCertError=void 0;const fv=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class S0 extends Error{constructor(t,r){super(t),this.fingerprint256=r}}to.InvalidCertError=S0;class A0 extends Error{constructor(t){super(`Request Failed. Status Code: ${t}`),this.statusCode=t}}to.InvalidStatusCodeError=A0;function uv(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 lv={};function B0(e,t){let r={...fv,...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=lv[v]||(lv[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 B0(a(e,A.headers.location),r)}if(r.expectStatusCode&&v!==r.expectStatusCode)throw A.resume(),new A0(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=uv(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 B0(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(N){N&&N.fingerprint256&&(F=new S0(`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 S0(`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={...fv,...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 A0(o.status);const a=uv(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?B0:E5)(e,t)}to.default=S5,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.getProvider=Qo.fetchFromProvider=void 0;const A5=to,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;Qo.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")};Qo.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(Qf,e),r(au,e),r(id,e),r(rc,e),r(du,e),r(an,e),r(eo,e),r(hd,e),r(aw,e),r(yu,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(wu,e),r(Qo,e)}(Jf);var Qr={},oe={},da={},Rt={},Jn={},Os={},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 hv=(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))(hv||{}),dv=/"|\\|\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 pv(e){return e.charCodeAt(0)<=127}function M5(e){return e.split("").reduce((r,n)=>pv(n)?r+1:r+2,0)+R5(e.match(dv),()=>[]).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=hv,dn.ESCAPE_CHARACTERS_REGEXP=dv,dn.isPlainObject=O5,dn.isASCII=pv,dn.calculateStringSize=M5,dn.calculateNumberSize=N5;class I0 extends Error{constructor(t,{cause:r}={}){super(t),this.name=I0.name,r&&(this.cause=r),this.message=t}}var P5=Object.freeze({__proto__:null,ErrorWithCause:I0}),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=Gu(n)}},Gu=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},gv=(e,t)=>{if(!(e instanceof Error))return"";const r=e.stack||"";if(t.has(e))return r+` +causes have become circular...`;const n=Gu(e);return n?(t.add(e),r+` +caused by: `+gv(n,t)):r},D5=e=>gv(e,new Set),yv=(e,t,r)=>{if(!(e instanceof Error))return"";const n=r?"":e.message||"";if(t.has(e))return n+": ...";const i=Gu(e);if(i){t.add(e);const s="cause"in e&&typeof e.cause=="function";return n+(s?"":": ")+yv(i,t,s)}else return n};var H5=Object.freeze({__proto__:null,findCauseByReference:F5,getErrorCause:Gu,stackWithCauses:D5,messageWithCauses:e=>yv(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(Os,"__esModule",{value:!0});var wv=dn,G5=Z5;function Y5(e){return e instanceof Error||wv.isObject.call(void 0,e)&&e.constructor.name==="Error"}function mv(e){return typeof e=="object"&&e!==null&&"code"in e}function bv(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 bv(e)&&typeof e.message=="string"?e.message:wv.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}),mv(e)&&(r.code=e.code),r}return t.length>0?new Error(`${String(e)}: ${t}`):new Error(String(e))}Os.isErrorWithCode=mv,Os.isErrorWithMessage=bv,Os.isErrorWithStack=X5,Os.getErrorMessage=J5,Os.wrapError=Q5;class vv 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 _v(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*R0(e,t,r,n){ek(e)||(e=[e]);for(const i of e){const s=rk(i,t,r,n);s&&(yield s)}}function*T0(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=T0(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 R0(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return R0(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return Ev(t,this,r)}create(t,r){return xv(t,this,r)}is(t){return k0(t,this)}mask(t,r){return Sv(t,this,r)}validate(t,r={}){return pa(t,this,r)}}function Ev(e,t,r){const n=pa(e,t,{message:r});if(n[0])throw n[0]}function xv(e,t,r){const n=pa(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Sv(e,t,r){const n=pa(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function k0(e,t){return!pa(e,t)[0]}function pa(e,t,r={}){const n=T0(e,t,r),i=tk(n);return i[0]?[new vv(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?kc(n):Tc(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 kc(n);default:return Tc(n)}}function ck(e){const t=e instanceof Br,r=t?{...e.schema}:{...e};for(const n in r)r[n]=Av(r[n]);return t&&e.type==="type"?kc(r):Tc(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 kc(n);default:return Tc(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 C0(){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 Tc(e){const t=e?Object.keys(e):[],r=C0();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 Av(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 Bv(){return xn("string",e=>typeof e=="string"||`Expected a string, but received: ${Or(e)}`)}function Rk(e){const t=C0();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]=T0(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 Iv(){return xn("unknown",()=>!0)}function L0(e,t,r){return new Br({...e,coercer:(n,i)=>k0(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function kk(e,t,r={}){return L0(e,Iv(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&_v(n)&&_v(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 L0(e,Bv(),t=>t.trim())}function Lk(e){return mo(e,"empty",t=>{const r=Rv(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function Rv(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 Mk(e){return mo(e,"nonempty",t=>Rv(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function Nk(e,t){return mo(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 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=R0(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var Uk=Object.freeze({__proto__:null,Struct:Br,StructError:vv,any:lk,array:hk,assert:Ev,assign:nk,bigint:dk,boolean:pk,coerce:L0,create:xv,date:gk,defaulted:kk,define:xn,deprecated:ik,dynamic:sk,empty:Lk,enums:yk,func:wk,instance:mk,integer:bk,intersection:vk,is:k0,lazy:ok,literal:_k,map:Ek,mask:Sv,max:$k,min:Ok,never:C0,nonempty:Mk,nullable:xk,number:Sk,object:Tc,omit:ak,optional:Av,partial:ck,pattern:Nk,pick:fk,record:Ak,refine:mo,regexp:Bk,set:Ik,size:Pk,string:Bv,struct:uk,trimmed:Ck,tuple:Rk,type:kc,union:Tk,unknown:Iv,validate:pa}),Ms=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=Os,Hk=Ms;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 Tv(e,t){return jk(e)?new e({message:t}):e({message:t})}var $0=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function qk(e,t="Assertion failed.",r=$0){if(!e)throw t instanceof Error?t:Tv(r,t)}function Vk(e,t,r="Assertion failed",n=$0){try{Hk.assert.call(void 0,e,t)}catch(i){throw Tv(n,`${r}: ${zk(i)}.`)}}function Wk(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Jn.AssertionError=$0,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 Yu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}Wr.number=Yu;function kv(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}Wr.bool=kv;function Cv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}Wr.isBytes=Cv;function O0(e,...t){if(!Cv(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=O0;function Lv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yu(e.outputLen),Yu(e.blockLen)}Wr.hash=Lv;function $v(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=$v;function Ov(e,t){O0(e);const r=t.outputLen;if(e.length>M0&Xu)}:{h:Number(e>>M0&Xu)|0,l:Number(e&Xu)|0}}at.fromBig=N0;function Mv(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);at.toBig=Nv;const Pv=(e,t,r)=>e>>>r;at.shrSH=Pv;const Uv=(e,t,r)=>e<<32-r|t>>>r;at.shrSL=Uv;const Fv=(e,t,r)=>e>>>r|t<<32-r;at.rotrSH=Fv;const Dv=(e,t,r)=>e<<32-r|t>>>r;at.rotrSL=Dv;const Hv=(e,t,r)=>e<<64-r|t>>>r-32;at.rotrBH=Hv;const jv=(e,t,r)=>e>>>r-32|t<<64-r;at.rotrBL=jv;const zv=(e,t)=>t;at.rotr32H=zv;const qv=(e,t)=>e;at.rotr32L=qv;const Vv=(e,t,r)=>e<>>32-r;at.rotlSH=Vv;const Wv=(e,t,r)=>t<>>32-r;at.rotlSL=Wv;const Kv=(e,t,r)=>t<>>64-r;at.rotlBH=Kv;const Zv=(e,t,r)=>e<>>64-r;at.rotlBL=Zv;function Gv(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}at.add=Gv;const Yv=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);at.add3L=Yv;const Xv=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;at.add3H=Xv;const Jv=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);at.add4L=Jv;const Qv=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;at.add4H=Qv;const e_=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);at.add5L=e_;const t_=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;at.add5H=t_;const Zk={fromBig:N0,split:Mv,toBig:Nv,shrSH:Pv,shrSL:Uv,rotrSH:Fv,rotrSL:Dv,rotrBH:Hv,rotrBL:jv,rotr32H:zv,rotr32L:qv,rotlSH:Vv,rotlSL:Wv,rotlBH:Kv,rotlBL:Zv,add:Gv,add3L:Yv,add3H:Xv,add4L:Jv,add4H:Qv,add5H:t_,add5L:e_};at.default=Zk;var r_={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.crypto=void 0,Ju.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=Ju,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}(r_),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=r_,n_=[],i_=[],s_=[],Gk=BigInt(0),Lc=BigInt(1),Yk=BigInt(2),Xk=BigInt(7),Jk=BigInt(256),Qk=BigInt(113);for(let e=0,t=Lc,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],n_.push(2*(5*n+r)),i_.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^=Lc<<(Lc<r>32?(0,Cc.rotlBH)(e,t,r):(0,Cc.rotlSH)(e,t,r),a_=(e,t,r)=>r>32?(0,Cc.rotlBL)(e,t,r):(0,Cc.rotlSL)(e,t,r);function c_(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=o_(u,l,1)^r[a],A=a_(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=i_[o],c=o_(i,s,a),u=a_(i,s,a),l=n_[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=c_;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),c_(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 f_=(e,t,r)=>(0,Zi.wrapXOFConstructorWithOpts)((n={})=>new $c(t,e,n.dkLen===void 0?r:n.dkLen,!0));tr.shake128=f_(31,168,128/8),tr.shake256=f_(31,136,256/8);var P0={};(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})(P0),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=Ms,u_=P0,l_=48,h_=58,d_=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 U0(e){return e instanceof Uint8Array}function bo(e){Kr.assert.call(void 0,U0(e),"Value must be a Uint8Array.")}function F0(e){if(bo(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;S_(e);const t=el(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 Qu(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 y_(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 Qu(t)}function w_(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."),u_.base64.decode(e)}function m_(e){if(typeof e=="bigint")return g_(e);if(typeof e=="number")return y_(e);if(typeof e=="string")return e.startsWith("0x")?Qu(e):w_(e);if(U0(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 B_(e){return pn.is.call(void 0,e,D0)?A_(e)===e:!1}function I_(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function el(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}Rt.HexStruct=b_,Rt.StrictHexStruct=v_,Rt.HexAddressStruct=__,Rt.HexChecksumAddressStruct=D0,Rt.isHexString=E_,Rt.isStrictHexString=x_,Rt.assertIsHexString=S_,Rt.assertIsStrictHexString=gC,Rt.isValidHexAddress=yC,Rt.getChecksumAddress=A_,Rt.isValidChecksumAddress=B_,Rt.add0x=I_,Rt.remove0x=el,Rt.isBytes=U0,Rt.assertIsBytes=bo,Rt.bytesToHex=F0,Rt.bytesToBigInt=p_,Rt.bytesToSignedBigInt=oC,Rt.bytesToNumber=aC,Rt.bytesToString=cC,Rt.bytesToBase64=fC,Rt.hexToBytes=Qu,Rt.bigIntToBytes=g_,Rt.signedBigIntToBytes=lC,Rt.numberToBytes=y_,Rt.stringToBytes=w_,Rt.base64ToBytes=hC,Rt.valueToBytes=m_,Rt.concatBytes=dC,Rt.createDataView=pC,Object.defineProperty(da,"__esModule",{value:!0});var Oc=Rt,ya=Jn,wC=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))),mC=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))),bC=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},vC=e=>(Oc.assertIsHexString.call(void 0,e),BigInt(Oc.add0x.call(void 0,e)));da.numberToHex=wC,da.bigIntToHex=mC,da.hexToNumber=bC,da.hexToBigInt=vC;var H0={};Object.defineProperty(H0,"__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}}H0.createDeferredPromise=_C;var Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});var R_=(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))(R_||{}),EC=e=>Number.isInteger(e)&&e>=0,T_=(e,t)=>{if(!EC(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};function xC(e,t){return T_(e,"count"),e*t}function SC(e){return T_(e,"timestamp"),Date.now()-e}Mc.Duration=R_,Mc.inMilliseconds=xC,Mc.timeSince=SC;var ai={},vo={exports:{}};const AC="2.0.0",k_=256,BC=Number.MAX_SAFE_INTEGER||9007199254740991,IC=16,RC=k_-6;var tl={MAX_LENGTH:k_,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},rl=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}=tl,s=rl;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 TC=Object.freeze({loose:!0}),kC=Object.freeze({});var j0=e=>e?typeof e!="object"?TC:e:kC;const C_=/^[0-9]+$/,L_=(e,t)=>{const r=C_.test(e),n=C_.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eL_(t,e)};const nl=rl,{MAX_LENGTH:O_,MAX_SAFE_INTEGER:il}=tl,{safeRe:M_,t:N_}=vo.exports,CC=j0,{compareIdentifiers:wa}=$_;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>O_)throw new TypeError(`version is longer than ${O_} characters`);nl("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?M_[N_.LOOSE]:M_[N_.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>il||this.major<0)throw new TypeError("Invalid major version");if(this.minor>il||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>il||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 P_=gn;var ma=(e,t,r=!1)=>{if(e instanceof P_)return e;try{return new P_(e,t)}catch(n){if(!r)return null;throw n}};const LC=ma;var $C=(e,t)=>{const r=LC(e,t);return r?r.version:null};const OC=ma;var MC=(e,t)=>{const r=OC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const U_=gn;var NC=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new U_(e instanceof U_?e.version:e,r).inc(t,n,i).version}catch{return null}};const F_=ma;var PC=(e,t)=>{const r=F_(e,null,!0),n=F_(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=ma;var VC=(e,t)=>{const r=qC(e,t);return r&&r.prerelease.length?r.prerelease:null};const D_=gn;var fi=(e,t,r)=>new D_(e,r).compare(new D_(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 H_=gn;var z0=(e,t,r)=>{const n=new H_(e,r),i=new H_(t,r);return n.compare(i)||n.compareBuild(i)};const YC=z0;var XC=(e,t)=>e.sort((r,n)=>YC(r,n,t));const JC=z0;var QC=(e,t)=>e.sort((r,n)=>JC(n,r,t));const eL=fi;var sl=(e,t,r)=>eL(e,t,r)>0;const tL=fi;var q0=(e,t,r)=>tL(e,t,r)<0;const rL=fi;var j_=(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 V0=(e,t,r)=>iL(e,t,r)>=0;const sL=fi;var W0=(e,t,r)=>sL(e,t,r)<=0;const oL=j_,aL=z_,cL=sl,fL=V0,uL=q0,lL=W0;var q_=(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=ma,{safeRe:ol,t:al}=vo.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?ol[al.COERCEFULL]:ol[al.COERCE]);else{const c=t.includePrerelease?ol[al.COERCERTLFULL]:ol[al.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)},K0,V_;function gL(){if(V_)return K0;V_=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(r,n)}return this}}return K0=e,K0}var Z0,W_;function ui(){if(W_)return Z0;W_=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 Z0}var G0,K_;function cl(){if(K_)return G0;K_=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(">")))}}G0=t;const r=j0,{safeRe:n,t:i}=vo.exports,s=q_,o=rl,a=gn,c=ui();return G0}const yL=ui();var fl=(e,t,r)=>{try{t=new yL(t,r)}catch{return!1}return t.test(e)};const wL=ui();var mL=(e,t)=>new wL(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));const bL=gn,vL=ui();var _L=(e,t,r)=>{let n=null,i=null,s=null;try{s=new vL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new bL(n,r))}),n};const EL=gn,xL=ui();var SL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new xL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new EL(n,r))}),n};const Y0=gn,AL=ui(),Z_=sl;var BL=(e,t)=>{e=new AL(e,t);let r=new Y0("0.0.0");if(e.test(r)||(r=new Y0("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const a=new Y0(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Z_(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Z_(r,s))&&(r=s)}return r&&e.test(r)?r:null};const IL=ui();var RL=(e,t)=>{try{return new IL(e,t).range||"*"}catch{return null}};const TL=gn,G_=cl(),{ANY:kL}=G_,CL=ui(),LL=fl,Y_=sl,X_=q0,$L=W0,OL=V0;var X0=(e,t,r,n)=>{e=new TL(e,n),t=new CL(t,n);let i,s,o,a,c;switch(r){case">":i=Y_,s=$L,o=X_,a=">",c=">=";break;case"<":i=X_,s=OL,o=Y_,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(LL(e,t,n))return!1;for(let u=0;u{v.semver===kL&&(v=new G_(">=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 ML=X0;var NL=(e,t,r)=>ML(e,t,">",r);const PL=X0;var UL=(e,t,r)=>PL(e,t,"<",r);const J_=ui();var FL=(e,t,r)=>(e=new J_(e,r),t=new J_(t,r),e.intersects(t,r));const DL=fl,HL=fi;var jL=(e,t,r)=>{const n=[];let i=null,s=null;const o=e.sort((l,y)=>HL(l,y,r));for(const l of o)DL(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 Q_(e,r),t=new Q_(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const o=VL(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},qL=[new J0(">=0.0.0-0")],e2=[new J0(">=0.0.0")],VL=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Q0){if(t.length===1&&t[0].semver===Q0)return!0;r.includePrerelease?e=qL:e=e2}if(t.length===1&&t[0].semver===Q0){if(r.includePrerelease)return!0;t=e2}const n=new Set;let i,s;for(const v of e)v.operator===">"||v.operator===">="?i=t2(i,v,r):v.operator==="<"||v.operator==="<="?s=r2(s,v,r):n.add(v.semver);if(n.size>1)return null;let o;if(i&&s){if(o=ep(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=t2(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=r2(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)},t2=(e,t,r)=>{if(!e)return t;const n=ep(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},r2=(e,t,r)=>{if(!e)return t;const n=ep(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var WL=zL;const tp=vo.exports,n2=tl,KL=gn,i2=$_,ZL=ma,GL=$C,YL=MC,XL=NC,JL=PC,QL=FC,e$=HC,t$=zC,r$=VC,n$=fi,i$=KC,s$=GC,o$=z0,a$=XC,c$=QC,f$=sl,u$=q0,l$=j_,h$=z_,d$=V0,p$=W0,g$=q_,y$=pL,w$=cl(),m$=ui();var b$={parse:ZL,valid:GL,clean:YL,inc:XL,diff:JL,major:QL,minor:e$,patch:t$,prerelease:r$,compare:n$,rcompare:i$,compareLoose:s$,compareBuild:o$,sort:a$,rsort:c$,gt:f$,lt:u$,eq:l$,neq:h$,gte:d$,lte:p$,cmp:g$,coerce:y$,Comparator:w$,Range:m$,satisfies:fl,toComparators:mL,maxSatisfying:_L,minSatisfying:SL,minVersion:BL,validRange:RL,outside:X0,gtr:NL,ltr:UL,intersects:FL,simplifyRange:jL,subset:WL,SemVer:KL,re:tp.re,src:tp.src,tokens:tp.t,SEMVER_SPEC_VERSION:n2.SEMVER_SPEC_VERSION,RELEASE_TYPES:n2.RELEASE_TYPES,compareIdentifiers:i2.compareIdentifiers,rcompareIdentifiers:i2.rcompareIdentifiers};Object.defineProperty(ai,"__esModule",{value:!0});var s2=Jn,Pc=b$,ba=Ms,rp=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),np=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 v$(e){return ba.is.call(void 0,e,rp)}function _$(e){return ba.is.call(void 0,e,np)}function E$(e){s2.assertStruct.call(void 0,e,rp)}function x$(e){s2.assertStruct.call(void 0,e,np)}function S$(e,t){return Pc.gt.call(void 0,e,t)}function A$(e,t){return Pc.gtr.call(void 0,e,t)}function B$(e,t){return Pc.satisfies.call(void 0,e,t,{includePrerelease:!0})}ai.VersionStruct=rp,ai.VersionRangeStruct=np,ai.isValidSemVerVersion=v$,ai.isValidSemVerRange=_$,ai.assertIsSemVerVersion=E$,ai.assertIsSemVerRange=x$,ai.gtVersion=S$,ai.gtRange=A$,ai.satisfiesVersionRange=B$;var It={};Object.defineProperty(It,"__esModule",{value:!0});var Gi=Jn,I$=dn,dt=Ms,va=e=>dt.object.call(void 0,e);function o2({path:e,branch:t}){const r=e[e.length-1];return I$.hasProperty.call(void 0,t[t.length-2],r)}function Uc(e){return new dt.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!o2(r)||e.validator(t,r),refiner:(t,r)=>!o2(r)||e.refiner(t,r)})}var R$=()=>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),R$(),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 T$(e){try{return a2(e),!0}catch{return!1}}function a2(e){return dt.create.call(void 0,e,_o)}function k$(e){Gi.assertStruct.call(void 0,e,_o,"Invalid JSON value");const t=JSON.stringify(e);return new TextEncoder().encode(t).byteLength}var c2="2.0",_a=dt.literal.call(void 0,c2),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))}),ip=dt.union.call(void 0,[dt.record.call(void 0,dt.string.call(void 0),_o),dt.array.call(void 0,_o)]),sp=va({id:Dc,jsonrpc:_a,method:dt.string.call(void 0),params:Uc(ip)}),op=va({jsonrpc:_a,method:dt.string.call(void 0),params:Uc(ip)});function C$(e){return dt.is.call(void 0,e,op)}function L$(e,t){Gi.assertStruct.call(void 0,e,op,"Invalid JSON-RPC notification",t)}function $$(e){return dt.is.call(void 0,e,sp)}function O$(e,t){Gi.assertStruct.call(void 0,e,sp,"Invalid JSON-RPC request",t)}var ap=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)}),ul=va({id:Dc,jsonrpc:_a,result:_o}),ll=va({id:Dc,jsonrpc:_a,error:Hc}),cp=dt.union.call(void 0,[ul,ll]);function M$(e){return dt.is.call(void 0,e,ap)}function N$(e,t){Gi.assertStruct.call(void 0,e,ap,"Invalid pending JSON-RPC response",t)}function P$(e){return dt.is.call(void 0,e,cp)}function U$(e,t){Gi.assertStruct.call(void 0,e,cp,"Invalid JSON-RPC response",t)}function F$(e){return dt.is.call(void 0,e,ul)}function D$(e,t){Gi.assertStruct.call(void 0,e,ul,"Invalid JSON-RPC success response",t)}function H$(e){return dt.is.call(void 0,e,ll)}function j$(e,t){Gi.assertStruct.call(void 0,e,ll,"Invalid JSON-RPC failure response",t)}function z$(e){return dt.is.call(void 0,e,Hc)}function q$(e,t){Gi.assertStruct.call(void 0,e,Hc,"Invalid JSON-RPC error",t)}function V$(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=T$,It.getSafeJson=a2,It.getJsonSize=k$,It.jsonrpc2=c2,It.JsonRpcVersionStruct=_a,It.JsonRpcIdStruct=Dc,It.JsonRpcErrorStruct=Hc,It.JsonRpcParamsStruct=ip,It.JsonRpcRequestStruct=sp,It.JsonRpcNotificationStruct=op,It.isJsonRpcNotification=C$,It.assertIsJsonRpcNotification=L$,It.isJsonRpcRequest=$$,It.assertIsJsonRpcRequest=O$,It.PendingJsonRpcResponseStruct=ap,It.JsonRpcSuccessStruct=ul,It.JsonRpcFailureStruct=ll,It.JsonRpcResponseStruct=cp,It.isPendingJsonRpcResponse=M$,It.assertIsPendingJsonRpcResponse=N$,It.isJsonRpcResponse=P$,It.assertIsJsonRpcResponse=U$,It.isJsonRpcSuccess=F$,It.assertIsJsonRpcSuccess=D$,It.isJsonRpcFailure=H$,It.assertIsJsonRpcFailure=j$,It.isJsonRpcError=z$,It.assertIsJsonRpcError=q$,It.getJsonRpcIdValidator=V$;var hl={},fp={exports:{}},up,f2;function W$(){if(f2)return up;f2=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;up=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 up}function K$(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=W$(),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=Z$(t);const{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(fp,fp.exports),Object.defineProperty(hl,"__esModule",{value:!0});function G$(e){return e&&e.__esModule?e:{default:e}}var Y$=fp.exports,X$=G$(Y$),J$=X$.default.call(void 0,"metamask");function Q$(e){return J$.extend(e)}function eO(e,t){return e.extend(t)}hl.createProjectLogger=Q$,hl.createModuleLogger=eO;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});function u2(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var yn=Ms,lp=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,hp=/^[-a-z0-9]{3,8}$/u,dp=/^[-_a-zA-Z0-9]{1,32}$/u,pp=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,l2=/^[-.%a-zA-Z0-9]{1,128}$/u,h2=yn.pattern.call(void 0,yn.string.call(void 0),lp),d2=yn.pattern.call(void 0,yn.string.call(void 0),hp),p2=yn.pattern.call(void 0,yn.string.call(void 0),dp),g2=yn.pattern.call(void 0,yn.string.call(void 0),pp),y2=yn.pattern.call(void 0,yn.string.call(void 0),l2),w2=(e=>(e.Eip155="eip155",e))(w2||{});function tO(e){return yn.is.call(void 0,e,h2)}function m2(e){return yn.is.call(void 0,e,d2)}function b2(e){return yn.is.call(void 0,e,p2)}function rO(e){return yn.is.call(void 0,e,g2)}function nO(e){return yn.is.call(void 0,e,y2)}function iO(e){const t=lp.exec(e);if(!u2([t,"optionalAccess",r=>r.groups]))throw new Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}}function sO(e){const t=pp.exec(e);if(!u2([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 oO(e,t){if(!m2(e))throw new Error(`Invalid "namespace", must match: ${hp.toString()}`);if(!b2(t))throw new Error(`Invalid "reference", must match: ${dp.toString()}`);return`${e}:${t}`}Ir.CAIP_CHAIN_ID_REGEX=lp,Ir.CAIP_NAMESPACE_REGEX=hp,Ir.CAIP_REFERENCE_REGEX=dp,Ir.CAIP_ACCOUNT_ID_REGEX=pp,Ir.CAIP_ACCOUNT_ADDRESS_REGEX=l2,Ir.CaipChainIdStruct=h2,Ir.CaipNamespaceStruct=d2,Ir.CaipReferenceStruct=p2,Ir.CaipAccountIdStruct=g2,Ir.CaipAccountAddressStruct=y2,Ir.KnownCaipNamespace=w2,Ir.isCaipChainId=tO,Ir.isCaipNamespace=m2,Ir.isCaipReference=b2,Ir.isCaipAccountId=rO,Ir.isCaipAccountAddress=nO,Ir.parseCaipChainId=iO,Ir.parseCaipAccountId=sO,Ir.toCaipChainId=oO;var gp={},dl={};Object.defineProperty(dl,"__esModule",{value:!0});function v2(e,t){return e??t()}var aO=Jn,cO=Ms,fO=(e,t={})=>{const r=v2(t.paddingRequired,()=>!1),n=v2(t.characterSet,()=>"base64");let i;n==="base64"?i=String.raw`[A-Za-z0-9+\/]`:(aO.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"),cO.pattern.call(void 0,e,s)};dl.base64=fO,Object.defineProperty(gp,"__esModule",{value:!0});var uO=dl,_2=Ms,lO=_2.size.call(void 0,uO.base64.call(void 0,_2.string.call(void 0),{paddingRequired:!0}),44,44);gp.ChecksumStruct=lO;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});var xa=Rt,hO=Jn,gr=Ms,E2=gr.union.call(void 0,[gr.number.call(void 0),gr.bigint.call(void 0),gr.string.call(void 0),xa.StrictHexStruct]),dO=gr.coerce.call(void 0,gr.number.call(void 0),E2,Number),pO=gr.coerce.call(void 0,gr.bigint.call(void 0),E2,BigInt);gr.union.call(void 0,[xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array)]);var gO=gr.coerce.call(void 0,gr.instance.call(void 0,Uint8Array),gr.union.call(void 0,[xa.StrictHexStruct]),xa.hexToBytes),yO=gr.coerce.call(void 0,xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array),xa.bytesToHex);function wO(e){try{const t=gr.create.call(void 0,e,dO);return hO.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 mO(e){try{return gr.create.call(void 0,e,pO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}function bO(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return gr.create.call(void 0,e,gO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}function vO(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";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}}Ea.createNumber=wO,Ea.createBigInt=mO,Ea.createBytes=bO,Ea.createHex=vO;var pl={},jc={};Object.defineProperty(jc,"__esModule",{value:!0});var x2=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},_O=(e,t,r)=>(x2(e,t,"read from private field"),r?r.call(e):t.get(e)),EO=(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)},xO=(e,t,r,n)=>(x2(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);jc.__privateGet=_O,jc.__privateAdd=EO,jc.__privateSet=xO,Object.defineProperty(pl,"__esModule",{value:!0});var Mr=jc,li,yp=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,wp=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(yp),Object.freeze(yp.prototype),Object.freeze(wp),Object.freeze(wp.prototype),pl.FrozenMap=yp,pl.FrozenSet=wp,Object.defineProperty(oe,"__esModule",{value:!0});var gl=da,SO=H0,mp=Mc,Yi=ai,$t=It,S2=hl,Nr=Ir,AO=gp,BO=dl,yl=Ea,Dt=Rt,wl=Jn,zc=Os,hi=dn,A2=pl;oe.AssertionError=wl.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=AO.ChecksumStruct,oe.Duration=mp.Duration,oe.ESCAPE_CHARACTERS_REGEXP=hi.ESCAPE_CHARACTERS_REGEXP,oe.FrozenMap=A2.FrozenMap,oe.FrozenSet=A2.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=wl.assert,oe.assertExhaustive=wl.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=wl.assertStruct,oe.base64=BO.base64,oe.base64ToBytes=Dt.base64ToBytes,oe.bigIntToBytes=Dt.bigIntToBytes,oe.bigIntToHex=gl.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=yl.createBigInt,oe.createBytes=yl.createBytes,oe.createDataView=Dt.createDataView,oe.createDeferredPromise=SO.createDeferredPromise,oe.createHex=yl.createHex,oe.createModuleLogger=S2.createModuleLogger,oe.createNumber=yl.createNumber,oe.createProjectLogger=S2.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=gl.hexToBigInt,oe.hexToBytes=Dt.hexToBytes,oe.hexToNumber=gl.hexToNumber,oe.inMilliseconds=mp.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=gl.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=mp.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=Jf,Sa=oe;function bp(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=bp;function B2(e){return e==null}Qr.isNullish=B2;function IO(e){return typeof e=="string"&&!(0,Xi.isHexString)(e)?ie.Buffer.from(e):(0,Xi.toBuffer)(e)}Qr.legacyToBuffer=IO;function RO(e,t,r){const n=(0,Xi.fromSigned)(t),i=(0,Xi.fromSigned)(r),s=(0,Xi.bufferToInt)(e),o=bp((0,Xi.toUnsigned)(n).toString("hex"),64),a=bp((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=RO;function TO(e,t){const r=(0,Xi.fromRpcSig)(t);return(0,Xi.ecrecover)(e,r.v,r.r,r.s)}Qr.recoverPublicKey=TO;function kO(e){if(!B2(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=kO,Object.defineProperty(us,"__esModule",{value:!0}),us.extractPublicKey=us.recoverPersonalSignature=us.personalSign=void 0;const Aa=Jf,Ri=Qr;function CO({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=CO;function LO({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=I2(e,t),n=(0,Aa.publicToAddress)(r);return(0,Aa.bufferToHex)(n)}us.recoverPersonalSignature=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");return`0x${I2(e,t).toString("hex")}`}us.extractPublicKey=$O;function I2(e,t){const r=(0,Aa.hashPersonalMessage)((0,Ri.legacyToBuffer)(e));return(0,Ri.recoverPublicKey)(r,t)}var R2={},T2={},k2={},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 vp={},ml={};Object.defineProperty(ml,"__esModule",{value:!0}),ml.iterate=void 0;const C2=oe,OO=function*(e,t=32){for(let r=0;r{(0,C2.assert)(s>=0,"Cannot skip a negative number of bytes."),(0,C2.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}};ml.iterate=OO;var _p={},L2={},Ps={},Us={};Object.defineProperty(Us,"__esModule",{value:!0}),Us.padEnd=Us.padStart=Us.set=void 0;const Ep=oe,$2=32,MO=(e,t,r)=>(0,Ep.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);Us.set=MO;const NO=(e,t=$2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Ep.concatBytes)([r,e])};Us.padStart=NO;const PO=(e,t=$2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Ep.concatBytes)([e,r])};Us.padEnd=PO,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)))}}}(L2);var xp={},bl={};(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)}}})(bl);var Sp={},O2;function M2(){return O2||(O2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=oe,r=di,n=Cp(),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)}}}(Sp)),Sp}var N2;function UO(){return N2||(N2=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=Cp(),i=Ps,s=bl,o=M2(),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))}}}(xp)),xp}var P2={};class U2 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 FO(e){return ei(e)&&typeof e[Symbol.iterator]=="function"}function ei(e){return typeof e=="object"&&e!=null}function F2(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 DO(e){const{done:t,value:r}=e.next();return t?void 0:r}function HO(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*Ap(e,t,r,n){FO(e)||(e=[e]);for(const i of e){const s=HO(i,t,r,n);s&&(yield s)}}function*Bp(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=Bp(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 Ap(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return Ap(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return D2(t,this,r)}create(t,r){return H2(t,this,r)}is(t){return Ip(t,this)}mask(t,r){return j2(t,this,r)}validate(t,r={}){return Ba(t,this,r)}}function D2(e,t,r){const n=Ba(e,t,{message:r});if(n[0])throw n[0]}function H2(e,t,r){const n=Ba(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function j2(e,t,r){const n=Ba(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Ip(e,t){return!Ba(e,t)[0]}function Ba(e,t,r={}){const n=Bp(e,t,r),i=DO(n);return i[0]?[new U2(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function jO(...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 zO(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 qO(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 VO(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 WO(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 KO(e){const t=e instanceof Rr,r=t?{...e.schema}:{...e};for(const n in r)r[n]=z2(r[n]);return t&&e.type==="type"?Vc(r):qc(r)}function ZO(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 GO(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Sn(e,t)}function YO(){return Sn("any",()=>!0)}function XO(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 JO(){return Sn("bigint",e=>typeof e=="bigint")}function QO(){return Sn("boolean",e=>typeof e=="boolean")}function eM(){return Sn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Pr(e)}`)}function tM(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 rM(){return Sn("func",e=>typeof e=="function"||`Expected a function, but received: ${Pr(e)}`)}function nM(e){return Sn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Pr(t)}`)}function iM(){return Sn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Pr(e)}`)}function sM(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 oM(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 aM(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 Rp(){return Sn("never",()=>!1)}function cM(e){return new Rr({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function fM(){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=Rp();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 z2(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 uM(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 lM(){return Sn("regexp",e=>e instanceof RegExp)}function hM(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 q2(){return Sn("string",e=>typeof e=="string"||`Expected a string, but received: ${Pr(e)}`)}function dM(e){const t=Rp();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]=Bp(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 V2(){return Sn("unknown",()=>!0)}function Tp(e,t,r){return new Rr({...e,coercer:(n,i)=>Ip(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function gM(e,t,r={}){return Tp(e,V2(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&F2(n)&&F2(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 yM(e){return Tp(e,q2(),t=>t.trim())}function wM(e){return Eo(e,"empty",t=>{const r=W2(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function W2(e){return e instanceof Map||e instanceof Set?e.size:e.length}function mM(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 vM(e){return Eo(e,"nonempty",t=>W2(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function _M(e,t){return Eo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function EM(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=Ap(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var xM=Object.freeze({__proto__:null,Struct:Rr,StructError:U2,any:YO,array:XO,assert:D2,assign:jO,bigint:JO,boolean:QO,coerce:Tp,create:H2,date:eM,defaulted:gM,define:Sn,deprecated:zO,dynamic:qO,empty:wM,enums:tM,func:rM,instance:nM,integer:iM,intersection:sM,is:Ip,lazy:VO,literal:oM,map:aM,mask:j2,max:mM,min:bM,never:Rp,nonempty:vM,nullable:cM,number:fM,object:qc,omit:WO,optional:z2,partial:KO,pattern:_M,pick:ZO,record:uM,refine:Eo,regexp:lM,set:hM,size:EM,string:q2,struct:GO,trimmed:yM,tuple:dM,type:Vc,union:pM,unknown:V2,validate:Ba}),K2=Un(xM),kp={};(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}}})(kp),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=oe,r=K2,n=di,i=kp,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)}}}(P2);var Wc={};Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.bytes=void 0;const Kc=oe,Z2=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,Z2.padStart)((0,Kc.numberToBytes)(n.byteLength)),(0,Z2.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,Kc.bytesToNumber)(t);return e.slice(32,32+r)}};var G2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=oe,r=K2,n=di,i=bl,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))}}}})(G2);var Y2={};Object.defineProperty(Y2,"__esModule",{value:!0});var vl={};Object.defineProperty(vl,"__esModule",{value:!0}),vl.string=void 0;const X2=oe,J2=Wc;vl.string={isDynamic:!0,isType:e=>e==="string",getByteLength(){return 32},encode({buffer:e,value:t,packed:r,tight:n}){return J2.bytes.encode({type:"bytes",buffer:e,value:(0,X2.stringToBytes)(t),packed:r,tight:n})},decode(e){return(0,X2.bytesToString)(J2.bytes.decode(e))}};var Q2;function eE(){return Q2||(Q2=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(L2,e),r(UO(),e),r(P2,e),r(Wc,e),r(bl,e),r(G2,e),r(kp,e),r(Y2,e),r(vl,e),r(M2(),e)}(_p)),_p}var tE;function Cp(){return tE||(tE=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=ml,i=eE(),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}(vp)),vp}(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=Cp(),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})(k2);var rE={},nE={};Object.defineProperty(nE,"__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(nE,e)}(rE),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(k2,e),r(di,e),r(rE,e)}(T2),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=Jf,r=T2,n=eE(),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}(R2);var ti={},iE={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 sE({publicKey:e,data:u,version:r})}ti.encryptSafely=IM;function oE({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=oE;function RM({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(oE({encryptedData:e,privateKey:t})).data}ti.decryptSafely=RM;function TM(e){const t=ie.Buffer.from(e,"hex"),r=xo.box.keyPair.fromSecretKey(t).publicKey;return Ti.base64.encode(r)}ti.getEncryptionPublicKey=TM,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(R2,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 aE extends Error{constructor(t,r){super(),this.code=t,this.message=r}toString(){return`${this.message} (${this.code})`}}var kM=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},CM=(e,t,r)=>(kM(e,t,"read from private field"),r?r.call(e):t.get(e)),LM=(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)},Lp;const Ia=class{constructor(e){LM(this,Lp,["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(CM(this,Lp).includes(e.method))return Promise.reject(new aE(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,isEthSign:!0}})}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 $M=Ia;Lp=new WeakMap;var OM=Object.defineProperty,cE=Object.getOwnPropertySymbols,MM=Object.prototype.hasOwnProperty,NM=Object.prototype.propertyIsEnumerable,fE=(e,t,r)=>t in e?OM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,PM=(e,t)=>{for(var r in t||(t={}))MM.call(t,r)&&fE(e,r,t[r]);if(cE)for(var r of cE(t))NM.call(t,r)&&fE(e,r,t[r]);return e},uE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},UM=(e,t,r)=>(uE(e,t,"read from private field"),r?r.call(e):t.get(e)),FM=(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)},DM=(e,t,r,n)=>(uE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),_l;class lE{constructor(t){FM(this,_l,void 0),DM(this,_l,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(UM(this,_l),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(PM({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}}_l=new WeakMap;var hE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nn=(e,t,r)=>(hE(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)=>(hE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ji,Ta,El,Zc,Fs,ka;const dE=class extends sf{constructor(e){super(),Ra(this,Ji,void 0),Ra(this,Ta,void 0),Ra(this,El,!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,El,e.disableMobileAdapter),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust),Pn(this,ka,new lE(Nn(this,Ta)))),Nn(this,El)||(this.mobileAdapter=new $M(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 aE(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 dE.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 lE(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 pE=dE;Ji=new WeakMap,Ta=new WeakMap,El=new WeakMap,Zc=new WeakMap,Fs=new WeakMap,ka=new WeakMap,pE.NETWORK="ethereum";class HM{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 gE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},yE=(e,t,r)=>(gE(e,t,"read from private field"),r?r.call(e):t.get(e)),jM=(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)},zM=(e,t,r,n)=>(gE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Gc;const Yc=class extends sf{constructor(e){super(),jM(this,Gc,!1),this.isKeplr=!0,this.isTrust=!0,this.isTrustWallet=!0,e&&(typeof e.disableMobileAdapter<"u"&&zM(this,Gc,e.disableMobileAdapter),typeof e.isKeplr<"u"&&(this.isKeplr=e.isKeplr),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),yE(this,Gc)||(this.mobileAdapter=new HM(this))}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}getNetwork(){return Yc.NETWORK}isMobileAdapterEnabled(){return!yE(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 wE=Yc;Gc=new WeakMap,wE.NETWORK="cosmos";var $p={exports:{}},Ca=typeof Reflect=="object"?Reflect:null,mE=Ca&&typeof Ca.apply=="function"?Ca.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},xl;Ca&&typeof Ca.ownKeys=="function"?xl=Ca.ownKeys:Object.getOwnPropertySymbols?xl=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xl=function(e){return Object.getOwnPropertyNames(e)};function qM(e){console&&console.warn&&console.warn(e)}var bE=Number.isNaN||function(e){return e!==e};function Gt(){Gt.init.call(this)}$p.exports=Gt,$p.exports.once=ZM,Gt.EventEmitter=Gt,Gt.prototype._events=void 0,Gt.prototype._eventsCount=0,Gt.prototype._maxListeners=void 0;var vE=10;function Sl(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 vE},set:function(e){if(typeof e!="number"||e<0||bE(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");vE=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||bE(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 _E(e){return e._maxListeners===void 0?Gt.defaultMaxListeners:e._maxListeners}Gt.prototype.getMaxListeners=function(){return _E(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")mE(a,this,t);else for(var c=a.length,u=BE(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,qM(a)}return e}Gt.prototype.addListener=function(e,t){return EE(this,e,t,!1)},Gt.prototype.on=Gt.prototype.addListener,Gt.prototype.prependListener=function(e,t){return EE(this,e,t,!0)};function VM(){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 xE(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=VM.bind(n);return i.listener=r,n.wrapFn=i,i}Gt.prototype.once=function(e,t){return Sl(t),this.on(e,xE(this,e,t)),this},Gt.prototype.prependOnceListener=function(e,t){return Sl(t),this.prependListener(e,xE(this,e,t)),this},Gt.prototype.removeListener=function(e,t){var r,n,i,s,o;if(Sl(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():WM(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 SE(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?KM(i):BE(i,i.length)}Gt.prototype.listeners=function(e){return SE(this,e,!0)},Gt.prototype.rawListeners=function(e){return SE(this,e,!1)},Gt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):AE.call(e,t)},Gt.prototype.listenerCount=AE;function AE(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?xl(this._events):[]};function BE(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: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}}); +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 TE=Xc;TE.NETWORK="aptos";var XM=Object.defineProperty,JM=Object.defineProperties,QM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,CE=Object.prototype.propertyIsEnumerable,LE=(e,t,r)=>t in e?XM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Op=(e,t)=>{for(var r in t||(t={}))kE.call(t,r)&&LE(e,r,t[r]);if(Al)for(var r of Al(t))CE.call(t,r)&&LE(e,r,t[r]);return e},eN=(e,t)=>JM(e,QM(t)),tN=(e,t)=>{var r={};for(var n in e)kE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&CE.call(e,n)&&(r[n]=e[n]);return r};class Mp{constructor(t){this.provider=t}static mapToCamelCase(t){return Op(Op({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=tN(n,["state_init"]);return eN(Op({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const n=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(n)}case"tonConnect_reconnect":{const n=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(n)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":return this.provider.internalRequest("signTransaction",Mp.mapToCamelCase(r[0]));case"ton_requestAccounts":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i}]=JSON.parse(n);return[i]}case"ton_requestWallets":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i,publicKey:s}]=JSON.parse(n);return[{address:i,publicKey:s,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const $E=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Mp(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return $E.NETWORK}};let OE=$E;OE.NETWORK="ton";class Np extends Error{constructor(t,r){super(t),this.code=r}}const ME=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class rN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Np("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Np?this.emit(ME(r)):this.emit(ME(new Np((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const nN=(e,t)=>new sx({strategy:e,handler:t}),iN=e=>new Z1(e),sN=e=>new wE(e),oN=e=>new pE(e),aN=e=>new TE(e),cN=e=>new OE(e),fN=(e,t)=>new rN(e,t);window.trustwallet={core:nN,solana:iN,cosmos:sN,ethereum:oN,aptos:aN,ton:cN,tonBridge:fN}}); diff --git a/bun.lockb b/bun.lockb index 343fc0b916d7319d7d8507e08e5be01263f583d1..728e51a5c136e307c663bb991c6f3a808c67a69f 100755 GIT binary patch delta 31264 zcmeHwd3;S*+xFR84rhlT#zYcH#1KOwiO30&a|}Tef|wGsL`E`@0Z}BTmZ%ywT~rm- zfoiKd8LFtEZDOvuN=vJyRUJHS(c-(VJ&-{oe1t?w>37y03Mw>0aYLXFGez zn>DYkuDK+*^~tw>>$9%tyK5f73)U<Qq~Hw?vUw)IoWwd7R!1Ui^UbXFl2yL*B2T3KInB3pOZd0kGX6& z;$Jl67Dxs0Y3b<`gR%=PGm)+i^kPUQ2Z1+h=tLu%p0N$GHu!89)PjtGYylYosquwD znK}8Xmcz)E6>AH=Charx@(a=}7C%GJ$j(a(DxPSmhDgTWR#T+LrMC^OF05GX1t@~K zOh_-8%<4aYPV0=El%k^aG>Zf~RyVz{xF|cP(2`y_sW`o$#1ew4FkO1##Da8`db66v zQXl$e@N90%xcq`V zVRlA|Wm7}FiqjhDRr(N;WsQfV{aT}Dvml!?J){?8R}YKD8*(IcHn}e(?SnkE{L~uN z+)MotW;2se0m^tt*6=DM-N7D9f%`fjElkTALb43gZM!h)P)yln6x1AYwvV3AD;SkPp2*4s}7WtO9jo9XCNDi?R)gSP0y_C8)k!XmOWU{7i_gu@%btiF zN}$uar6Gp~>fI0rNmoa<*5j{0XBT_}y)ooxkZgt-|L+sov^VYMw$3dORfS9d7Xckepd=M*Q!=dcNO4qMXvQ69_Pa-HdRL82aKM z-9h8?OUC8r!4P^Kh+Igf&$jChHOK57N$-~Ck-CEm44Da8(^6_FyN&=oehG%0Fa_y_ z`8ku*Egqfqfm0ij{c3@%4TXf z>3bsL5DI3^O#>|g`rF{?N^hrL!E8vjw639R>nH|fr>^SH)mxSZchx(%2BJCAoFLsX0{O)bvI;IfsSo}O;+7;ZV+S5KFkUr?BZd}b%;9haIH zJif3L#11561yZqjW#?rUF7Bt#z0JCd%G&nVEAq5azyia5x*_unyMh6F#;f6KKjgOr zl8ZnPx(cgP*@Q%W&iD+}D`bN#WsP?uz_EM}225ZU@TS3=1>Hn^)jo6%)?M2HlIib5 z(nBpE>5)UQ=OS`^h;BCzlIaT}>p_ky7*`t9Al;+2g;8)rqrklUaT7pWMvXH2bV?!n+5>t6%s$i|R`6LYeQ(895)dcn6Knc-KE zv{%RJEuCk`v*78m2&8w1YzxV*J%b8*Ko;So2NO%1u^>3#kEZJxAAn>Hi!-zaSn@N{ zi^gHtMrEkwHT$)>g&?DIb8SG*@Zz<3Ue@wQ3-a`EJ&tHpPD`{1=$Br z)cO3p^rGzCbW3h_ZuU6rPtCy7EfZ6UvVtb0mzFd#2scP(V1cAxenp0C#|~70etrj? z$oN-`iY+SAm-UH|+}0BzeIY|3{UGZ?a-{x@C4=re3CZ{!kWC<;gY@F+G7kYy5I6;E z2de&tK{rTxCIXTjGcGHCLUvk8K|y*-8V)5B--UY_ztNC$r|BJ;l2?+Of*y%Mzu`<$ zmi3sPe>>>x*yhu9&oqYKuoQ$9L$f~QFC+CiGqtb?W#n4koS|p95t5$B%%7OXo-3cJ zd+0kzR_qESJ#*fWagZEQP0RH7>X0mW4`e;apHXN7$l=JhRNLdHX6K`kmVnuMi<&?( z!`+bDP(lX=rKMW7KT@ zF=YZqk;U>6blPu)WP`_+>z+x?7*rUIpm>XUjpb1M&A1pciRbp}cMZMeYgK?%#B&!Jl0(OqT$51Ha0pZ*(&+x2Zho9Bv)vVgu#C73U-&*HmlWaRiER=t!Khjks4wJer^R-Els^aUEE~|0) zyIEa;zu%}8zD^~`YO!=d4Xo-3U%Qm8#`!s=Pt*nY+eEFv-*{E=cS?_|arnDWU4XxT zs1^QBC9HaRE-{3&da! zA|*>4s8)b`8p8y8dYOxQBET-4QRA9Bt@SWu9O@DOC~1IN(cG!br4F0wsyl4%+tO*PhUJ2`!hf?AqIT`3*g(XBuxW`^XmkXs zfNC96<61ctSBy3$sYXtTg~m!kYi^fjs!E_!Ibd+IR`I*)0&tx%c6FB~BGqJQ9g)ga z%j0cm{j^e0MOm(+mbZ3DW7LY)PGuRUL{~)FRQK>m8x%Se4MQFcG5QCXsibtZqK#7# z;M#$c)ul5cZBSUz8mxxW24g%-i-M<=kq>V9vAIb-w!;&P!ePq+ly4rp`+dfVSF{i4PNJC%W0 zHNv%=m(Go}L1CdVZ*I5lhBiPw;uodV#ylFS@rf<%(s*@2d#AKZt-#+OR3*eIwNT?i zoXX>vhIE?5YDuTn3dDG+N~lvAj?J_iVl0{mS3?`3*`ZR>k7@-hMqe9M&qC8jD5|4;0!^><(%eW}6TJ=?7l98I-7^~yMPF!R z-Fg#RXD#nQOnN)`+Vng7KisKo1UC?z3ulznP>t*8w2t#eZ>es+QC6#u#WI>9p zCMTjPpQ>>YP9>nJ?$H`*B6>Ut8V8S}x`)`6rO@;qXMdc9#^G2~Wjp+^ld+HW{vQa9 z{Q_sAU!X9PYUXCpbw z#9@dfLvv_x98^z3qZ{@4b=I)dUFY6Rx5PkgX}9)=Hdu4S2848%Tt{fA#yN55jnzU= zAf$0hwdQ)c+5%;bhBiQR-y(#J34n#`A~bfZHXWq;suJzQaubKYZ>tNUowgrZ=r!az z8p3t7m8v+L%D9%MBj9iA8fcN~qV`eBRfIy39VWY=;E|>a<&rLyJ)tVYD^C8bcmyD%>>? z8kbCcPP}Nup~Emmzf>!FXp=9-DZQu0;qQ;?0{rcuR>U~10U;JkPxVMllr;;X-dbo2 zLUCH?_QTj{xKHOEM@Y9jf{>oJ9tNu(I|88uE$zmK+)oJg*SM}7%-BT;>A9RjNKfm7 zL9XYQijdB2Mo7=^HbQy|CnicCEx&Svbi0!X>2`h?HyWp8BScTaEAY`KXvo6w(M4z+ zZs_6|tgx8$)Zj5#PKMSUnyhvBc4%A^>Sznr4+wIeV)zEyr64t~uTy$VU4Xw^)C&Cl zMO6}Hi8RH*`}g2Tfj<6s!D#C}yWF3baIX z4gaD;#zJHJF--&QN+p7r@J#Ns%hd*{@fi-K^B}YIrC4B!p&2I7UVj+Jsd^n6hXM8% zf4enqFk9mmg54V-%tsWmw3%H#Fj#fXa>zA?sPS12C2EL1FVJboVL3EC2Tt2h4Gqr5 zP-ryt;X(k*0njkPFv^&24K((eUhxw{RoC$|<=#nZ`FMwN8tWG=aZVd-w>C^hYt%*K zqpSlE>ZFAhAk>W^+gXIzae4>sEmmy9%#2T71)-0X#Ev-GrQpDXWH?QR*lk77 zxWYc1M>|1aFd~|#GS^i7JYi9nVwmycBKDTv=WC#`A;<`E51_F&@EL}ubDW+nwgRlq z>&L0C0S@IVNKP8~432D_rj{2utP|2O$h8B-I|y+Zz{tRyx&ivZZNu zB_A4w7c*&Ymn|8p>tu)Glc^6s?JOb>%T&ujJ^@l6TPNDs<@YjG*C`Ignx(G;@II<( zhZd}7jT#kYsg*FfXOI|oIEhAPn+pe9Io{AvI^v#%#zBA;6FbEx4=ocj?260yhjAn9 zN@r-CANt}r85-ACXo%YaO&?!qk#gNghhssWU2Zc$EuZF4Moci*C7!|7KnqgcoKebU zgu=9pFh!L5IeNBmI=Zfhp`0V15czO6&P5oHd~ zauCd4ul50GtPIwo@<`i6-ByoU42?x-ck#+WXl#*Q{5@zKeptsbkD@14jVp%6IIU{R zJJ5{cT1UD-;T{yFgcg`9*a>8i3yljthKZkD*$wTH2W~@isEcNIu@&i)LpQn)ZTQ0^ z$;G%Ud#Jq&4U^EwuF+(CSMpGs3Jt4;5qApO!*tfLDZIH^G`EWj0=Rpb+r@^!K-1b9 zJk?@JX1oo7!6vPI3M~d2ZY;1Ghn48_N}HMT#1gf#heJM~3FQyO(NcGC*J-*2MMML+gwTur~IOlxC~tiyX3bj#|0Mp>&y}FOA4*xZSn{8aqJW zxVkP;TtL9jn0~e9s+B_{u&`T)%r&+z>#~QTV+iR!t2<9EU+jTGJCs3>>n_r# z#T;mMy&iDGPH0`A>2>_|Pg>X$596@evHNHjC3)-? z8js~)yZ)18gRr)1S5>KinPHTVfSw^1A?>1ML1mhzOV)Unq5qYn{Tw5n(h6WIS!}=( zfa#Y4ydFxnpApLpsX}t3t^#;fmCW!tfCa4sc&!7Ne!U@|H{=FLUX+Y~!H_RP@-k&9 z1I+McvbZRzZvt46EkI3RC%}u+3hXiD0Z0~b5a310_)03c{u^1U88E>yfCZlbcvY3; zPim|#S+Vm#HQ+Nteh$g2s$~2XfED}_;6+LPYbxx2J@9AA0tUrNXF|FQz~fX!%8RY^+0AI8^&q+ZLAZd7nl(o+o}>FUM?UsaOw zkSyxSHU5bRTACO(lni>|57!D`gRd%Cw!abI!icBjOyi>xk{a|}<5CWijz%mcgAs;a zRWi3ogRd${b;2LEpog^)#Cf@k{rKzs~&8@9IYzuG>=T1`b`;)qcI@rsW%>CS`xIIxBp%`&2decMp*} zLh2(QvWT4{q@ilyA8u;U?|q~rYRT_O>N#i^p&e6O|B)gZV!@H+?L$L z!D><;>4I=~k&?tl2}H3Ah>MID$ujg7R_LFLNmdxxs)0C7;3aH9s&mBZHae_ov9S|Msfv}2M^+0&k1#y)`4G~%&#K$C7)CZx6%Os|{ zgXq}+L`|`@0f@kQAbug?Cb~5QagM}`4MEfqKarSUAH^NVUYsVNzeI zzDR5g;#vdAZN(56G!&btuWX1EZXO^Si(wuhVjF>YpMwmf#@hUH3PBI4}@C)2)h^-03y~O#QP*V z38guR+az+EgNPD4NNj8d!lwm@Xp!9lL~;O#BP5){vn2>ya}YCHg6JkHNNgt&)Cxoo zQPK)TRtpdpN%R!013`GS1hFU(L~n7P#K$C}TZ4!b3tEGi+6u(?B>IR>Z9oJDf>_fA zM1r_Z;v9*Dwjlb8Rc%4cZw=xei9`|C4n$-d5U;fZF-Y7YagD^NAP_^urXUb2+k$Wl z29YF&1>;X_I}q=a7$%hVAa0Y$Z4Y9E*g;}r5D1?T5TitP2#Dlh5JyOi5uTwSZ0$kJ z2nCTMDoAW65flbuoG1wckre{sB8ha-x&sK0P!NkcfXEc*NqkHqIvhl{SP%|kY8Z&` zNlXx(I)Vu70Afu?5V_(yiE|_pB0%JeRS_WOhl99BVv>lngNW=1;x#*nLUD)0H4>vD zK@^Kkksww^fN<*sVu~2n2}Gq2ZQ4$RzD+VT1;io;h$qB(5Yl`R z>V#Mz7EqLn%M=Smr>+oBilr2b#C3|NM7M4bi^VF6CE_QFr6R67#4@p-LKSx?mW#w5 z5G%wcil>DX10lpPij`t3#VVongm^}zP^=a^AjHNVsGLtPRBnyP?gb(_2E-8(YlUZT z5VoEmX7mQJUR03SP9i84#0F6k3nHr*h>Ij%6s_Yxc=QIbC=SHS;yj6uNkqqk*d!Lj zgP0l%;(HRCMJEo}z&H?VFhQi(#B~zqNF?+Hu|=%v3u1mehl|+RI9RgzNAQ0MWe@I*=5jYq`&!Mn5B9;yXagM|LvQO1(14++)rPX*eumlVOoQ92V!rRuZ>K zG{m`vhm4WZ9P26E(70_|KV7O*O+DT;aG9@*V*W7CP;qgLG{>#3yZ%3gn?TmxmY5~= zmc`zD$!aSMDoM%Bu{^cygH)-pWNp-xIU)X-gj^&Ku{B+a@;86UrF#qg{~_~6x;Qfj zzqT{Ja3i={;_?`25Q{Z`YUA{_+ze@(WPLRVU*C%p`I48CUYJ^(os(t>+?J3fy(i1N zJ8kQiC5@JmOw`JgY}RYtP_~$qf%8VlRLMou&6i>f64__6zP02DvEpdH)KtC`yX|Ja zw3F>^z#LvJltSbsL$_Tjlpc4nw#_!O+MusOO-r^tH(jcymA37TQfa=tZR~96VBph5nA-@2^3MTs zEnNB6iri;Q{rpL5alh1*LeBCIz+wsfR9w0w#h30iKC9xFIJ``q6+ka(*9V3TzqsKS zsl3eZulWhS`7j5+!)EUM&WsO!Fnqv}{OVcz{si)%!Qr#AQvQEy?fTFld5iV|z`{N< zIDXB^BRj8;!7<1RpG24!zbt2v-)Ao{xI+fVrzy$}?y$k}t1wJB>X~rslk0_*ztZQ4PiFuqQTMiCjefTz_Ht! z0HurYhc&%o7_vLe57+tV0RHjk4lJhtX7UvX7VHC@Hn^`1JIq?kS%B9!hMh0M=K!WP zA3g9xcm;r~RC^AAh4=%C;e{JUhRwiT1z4%?4K4uT%K!_zX>iRE{uE$gKNuVq1j}$E zzaI@QnQp`7&DP>_?IId|D>Y$Hi&j^pxKet8-EjvA`4CZOAPV4PAFl&jfX4xT;u{S( zfUZC{pgX{s&=P0`1OlyrHb7gTHc$ts3%CRP{G1P={RI3B+(IR8U6FdqR!MaJQhL0! zGe|zQ_AT%oa0A#2>;v`#93vbP90QykoDCe19Bdp%95-z61%P9N{my}X95?}RK+gv_ zV>m+=0-P0#fVq;TnPnaVy@1|8ED#681ATzLK!WJ@mE=|Gg`f}69tZ(Kfet`85Ck*; z8Ul>~Prwx@L7k@o(}76r)cmvo9a3a4AYy(~aHUpfW zp8*$vGr)O(j}a^eRDe^3Q{yVY>A>NC8Q?(UJmwO*9oPZv1YQC*0xS98(rN_O0M7wS z08Z#yKnySom;pQnOarC>sX#iA0b~MMKsGP|$OT3NLx5yp7+?n)12fSOe%QvxX8BBR zK9EahJOXLJIAAO=1{eS&0)2sAKyTn1-~{jqa12-o@RO4-fXl!};1%FCU@yQ2ELH$~ z0ON6BHo(VutUz_(TU6=*A6z;Jd*c=YjRWbf6HJ2uuRT0x7@kAVuH5;z3#ryTi+ zhyeI75?3o%pe9fYs14Ks>H_X!%~kvW;*Y4`Pr%Q>E#P0kFTg86Kh)(*;49!F@B**~ z;6ovA1MdKQ&}1#J4p<5BiI*Z^GEf3Ifv!L|pa&2G^aOeXv3y{t83F-7bD#y#5@-#y z1=;~YKrqlA2m!)?4!~_x@D9KyQTTMq2H*u?HSjF34i)8dIema}Kn9QrWC7X0cwmBz z4L%2fT=Cj9IAbh=eA;OMkO*`J?xKu8fP27t5fYm@T zGGrt{<1x@Z9z0V-GY)4+M~tsv_G95O77tK#8piQh^|E~Q-D9^m2v z$5o80DfJH_IUUFy2RL`R0KNx24IBkN2G{^Lgbm{9f%Ba6ozsb7O4fmOWgFNQchsdW zfT3KfMY1uM0k-^e;0u5p_dhp)D_c!K0jdL5pc+7X9ycC9{0MNnqZc_pz5~7mt^@4i zuK_MbgsFeem5iE+|xo)zSaV^kUPEU31&b~)CWiRaV)h2ya2At4FPVFO#rTF+$6bK zGR%0BXPBHHz%r;e1u(L-4Vb@arj2~|3ui-fAOK*2EQDdoW&pVs04u@S(i!Lk1Olui z!`#u^0d0XcKx=@lrze5|?(S9MOSM|jAPfirLV-xY4nzPQ0S>NkNFEW$nPHRv_d<`t z<_N$F9RgUv=YjQr1BeD#u?y_~CPb0!x6!z*E2?;7MR1P!22r<^!vNEaZ~|tU{Riu7nf>!kNG`tO-dfYarRH>wvXJ zn7YYx2y(n~tiBI0Y)%w%JApTVHUP)&2H-{D1zZGtS_h(CLvY=L|Y zcoldZpdlrVnXo;;!gc{|f%gCw$ilV)K>!Qf0lWpg32X=61>OeU0k#3OVLGmrSRYFt z5{#$?>;^spDuD{%W8g#JAaDTK59|Xz0QLf02lqfS4ddw*v$CuxJ@Y(J)iZ~op8`(s zR{1yr#{g~(Bu@gL0GxDR09?0DL#J#7Sr0Jx$+HNb1GwLDpX6S69y$l)r;z_C-PoHj zup+^MDADg%spYn*ze+Z#aea(L^Y`FvQbcfQFqfT6V#aThr*ub%-=tYy)v%>wIF&iq zD(}8FcktUbDLlASa0l3Vhz_@<4qmNb;0}X*h3mGTb@n}JlSbQvLqm|&95L%QGTI6xmZ8y)8BAX#Svc;jST@Uzh9rBuk^igTq+5`IFC==U*t=+ON{4#h_+borKRF z$c6ejtJn!h7KTj7N8 zGJjya!NO0k3^{!8MdXia&@nM$5$&?Y2fri7VsTNHJ*AoAf(>GksPhL%A-=06dwQ9_ zmOkYC<+k;F`%Kg7sJS6PjH2C(V#*)LYKz!RZM!%Kt>Zp)WL-FX>W*LR*3NO8kqT*o zBQOII?^y z^i)|whcY9}VX@_&)WQ2U%BhK>h9(~Bms0obk5E(uEYO41YKr^!@NL&^(dRxYy+EYj zmlC|pUrNty-8A);<*EH;iQZy{A>zn=v~jbL;Ca0R+A3Y@XdmyCeIojU^)i1yeM0o| z`IAn5#?m_K<0VAQc_1ao_-65w2PpK^3Saou{4MH!?e{(JS-HOf%)|A;y>i7Mxr5hO z4170KK6O&_=&m*EL?WIZL~XXLSTB2`=U42KJ-p1HNT2IGYsgK+bQd`sb=m5IVrS#qZSePD>TUj3`mjAWt#k2LJ~t9zFVrSlBNt2wKjBjyb=oWoP@pCQGe|N$FkQyd+&yS zVY?=e++j5Jrienj{@lvH^aj4jGd&RQ^_NSHws7f=^fG^$ed)IS`?H&c&X*-DY}y*B zuVqGV(p~Yg4Xrb#xb94>dUX_#dN1gUpW*0P_|BrftDK21z#el&wO5E0u5yQt=I^_E zotYMrR1)6Kg$qh(a5#?At@H`+S+8Es;D9=((0;~X9JUnqn1j}ho+6|sy1KpSQxjB) zSltf2Tv}6hkDiV6O)%We-+q7Ym1W;GYWT@KSYhu>IoKfl8|uWl$C(}6`? z5l4`nm$kKCh1+)@%i5Q`9IM^UK%C!^sSx-&!Lzgt3~hk@<#J%`E`eBrE0Yw0t-&VP}iTnYtst@Rq6(&0hqs>z}f^be}Dd7j`YUFW-*^? zV<9xy1R_8%9T&2&fIQ zSR~b!d*XY_HMM1bd{Mlow(Qx_{2}^*j^k~;ecWGm!4e#b0oci6{#3ok-MgU!DqCb;ziH<9o3<98JhCu`?{IR?j|)i5C}Hi4-JdU$&`-ue=w2x&Dzs zv2d@8N-Pv@A-v3A`2XhVqMz40e|_(f-BvLM1|7{;0;o|p0>&?TX8t1s^Q8eFTwS`c ze&gQ1J&O5OyvC&FTLx_Ij<(yS<%b^`nC~Ho=zI9x^~>I#_9!M>xW~winxcQJV_{Oz zf+1sXJh;0gZ?5-TeR`6)!_y4fOhW)&w6q~NB(XI=ii3$lZ#94kMPmz8p?x_`96U;Z=@e<)2aUs z#9;OX+j)RnT@Rygpg2|!C7JIL*nhr%sC(^#W3cO>ADHwiOOe8-J_e2X!h?OK{VwN! z{@!RKKh0laV12obf6r*`i>HS#7%+co7?yAWsw6(>A=eM^aA;q6l$q}zaEz9Bo%+GX z4TKfMgw?vj)7UTCC}slPLvjtLSXUq0h~8o1SbfQ4T{ap=TRlYwFZh)M_YC7P}kEuJXlhqCsQ1ulJJf z`dP>6wRKNy&i2+g;fCug!0PT|dSev#UU%_yV>wK&>@H?Dh5mVW@fA~=?=XVaum^{Q2Y0kgj}dq$h)0C^oB9#^_IO{Yad)=S z1h~iiS^u&%vzrxt()~JOjCyU35l4|$-Vr0NdB|n*hcRNjC+c@0Mm*<gqiDpSzBrs)X7>~~JmtO-=4%$R3SWP4x6bBl>=j0- z<_j5)cWf|t*k}K$ff#P&m@hYaio7PMk0HJPJ&y)e@({adDSC@DP2fTEB@HjMxwNo2 zu5~=>!-FGQ|7xsoc;S@xUnk+tSbg3Wh)G`P;{CDWNiQ`1aIDx%c|KMIJ5a>ev7)v& zk7%Xi57=X^fq6_7%7%>sj+kE>) z&w|0eFC|A|hPOdWc@+*3yZzB7^Zgh93J!GpV?!DSj5+82z7K5!Mb~EV_TQ&9EzGxU zWPT8^V)BJk&5%29l~MCUiK3_(YG}T{W9jt4al7hw#=Wt2a>RJl+u$KLOcI~5H1oX| zotpHx|M9W69^;K;hcJ$duq0780IhD3ByO~XHo=Cb)7k4DMY4!&*qdYRTFp586Dhl%^m zF&F0y7a1+kH1mxf$5u^<&MLqA1S~mQ(D=2(#oPbE0*!}--10x>@!vGk+x+E!p9aS| zJT|ZAIj!{YaQN$^k>ba0I4*Kd87}iS-yg8$$s1iQdp<1CTBUhccdm#0%SdsfE4sma zcfG%uqB-vB-n4f>U=F`BWV`Tk3w`yG zQ_QzTEXlmIE9diW0s8!dw=6NE#gj^N?E{s4V?;aDT{iMC+aixm71P?F zZD&)(>yX}GrRry)L*HAIyS3ayZ}8p?-nf-2{-EW&aU!HG+GxIr<@pY0`mKHOjvbc9 zKpfdaq_xGMHebPVf8z^*(_U4+ePnSUT^wc}N7MD4uQdFbNx#>=K322nL_eKPf4ZIg zjDB0#L5|80$J@z$<-QrBX%IY+h7X~6C$@a(xsRUzY|3V1KSsJqh^dDd?+;eI5x=~_ ze#GEZ$rX1_hR8u$?`5#yjbLETk8!=*G|JG@;=U3e`eulA%zYOu*aK}RJs)-c^#)sE z!E*slpjQyXQ>z%gFh5|x;pGjaPr%d#^J9j%$+Xr?-QtjEq}T0p!OdBIa9AYH$@LM# z54$p_l*K5WYGrCM+Qfx7x&)(jdMg`>wZS+UzLF(&2cyGwWQlXZaQl%gQL8=HfwNhn zs6F(rv&6>sNOUV}+pq2A2uXfvya*1(*{O1Zcq0^sCnpGxF!|cUTpM>lt_yQTL7+lY#Y44R3+Hp(!a2V$6T{HFChULEZZ*@S7G069e?>gXIZN6A0@TW^Z z6gK{G8w_}N&Z#v~_=Uq4=BsGV^y~HVcZ)CcV<968^JO)MY}Z@H_p3aN81C2TgJu&& zUN}Ci(QZC*+?^s{G#K zGc3jZNV!SGzi+d3B}cR$ckM9q4Or{^dVlxEC6~pIVw^KXKW?z*2K?_Euepcxogt3H z&YSPy;k1p->Qw%2*Y<?ynd0%z za#%<69YHs?M6Yk~&JcdOXdD~Ow*<9F@LzYp`B{A}MmwD8_ov=hX6h5j$NOIC(pSFW zDs2?<-AvIe3O+PnAavS$?`MPFKJdaLi|S=!Vibl&(=z=|E}+5gHEYkF;7-Hh(T95w z!*$MM?PIGJZ5$kCq{R#>pDA`Dt@qzsoS!LvM*07KqVe82OJB=Mj*YLoVaZQlAWy@A z=2@q5mUxP1AH(J5*++cZ1!o@PtRreiqr+Wi>v@^4<25uf@uK@2~oSiGut*3VwA zm^UG)dBAKjIvRf20tza>tA-jm+NZwPM??3X`va@bNm#ofuC3*CJX`Z;x zwB{R;ygn{}EaYyp_hG?>3KPM6XVNnnB_~(a*}KU|i)MT|PxN)71I)KAJ-GFC`TSpc ze6Lw(Hzn4`MHwt2%=a_BT+z?I#`5%AkIFaS;MDh-^3Gky{yO7P?vam+qe$z8mp*A< zXq*-aTRd)eZwCwGwl-5pUF8nmf73XO9i#Y%6YK8|edYu+4{86?3FaXNc7y-*6QPIP zr(DeMhRzyWE_UId>}|f+aLKPPuG{HTjUNz%1>>X4FyjpAAva$rT)Sfl!9gOqyBuR( zXW>Wk>$}S{nm>sz2Ag7Rm~W1%S8(S2n2?+JToqf7HvLkc6y1BsZ33n|iRUd~X}&h{ zPoL^&`;_r<4L*B$1qocuk81)KiAz0jkRKf*&la_M$W5C6ePMO^Y!t4LXi_oQ z)cLQH$2QSRz96}b$Lk@tjf<6=cJW}aeNg*}ImMaTc|p{Iv=5KPp;NL$tUD#w7VGB7 z4a9}ha*QY*EqjZdr)9ToWpm{}3n(gw)dZrm$t8+laoIss30A0Z%ZFn zRJg5grR*k)@Nzj=^m-Fccx|0*+m>=z&a;UjZzC($)ADkBp08h1`WN&m9FWo@@{nHd z delta 32682 zcmeHw2UHbT7w*i+)jKE(iqa9pf*=S|E{NP~K@=413U+#t4l3BdE-JQBj~aVoO^g~7 zON_B4QLx7zHBn=YC7NRFzHd(vlHcTiZ@seCTPw5t?mqiF`<$~+pSgGB+JRg_FIqUe!OGtbJ-<8u(y0)ek>^S-2pnBE=Jsn?eCB&z zR+JBWjw`W7tQBNZenwhW0mscU<2ZBZlT>M`Q}j`)z8ShD;xm#)WKk|_)cAR-TnZ^7 zJ~1gN$15$L8-{dspvOas83?SXp%B&dO2)rKuMNI03~E98LNLAeY|DjGrV z--k}|$r*741xbnAL)ekKN%_MI(lYY7r2O3BNqI$_6I`KmN%=W>NhtLa?CL>Z1fHrJ zmyn&8h5Sx{r&{bqCgAN$c7w16k(d-eJOu`s`BW^&ZIP@58}T8Ul8W0e`3g3!lj|x~ zPL0d=fh&QGdQ&8oOI!c@&L zI6%?>NgjR+NzFk$7Ki3@L0XuW2#{2U)@&Ov>QGF{aTL@TGTTYXXCsCum6@NEIU*^K zGcG?rE-!@} zm7U1ZwGTBU2WMhfQ{#-x&PyDb7nd^uI`KtPu9;1-V>6}r%(Seu9ORG;oviDrvV*(Q z4S|r<)J>Wz@h6~D7o34^16dA9)zISqI*~Pd%`VqdZXUN1ZM0QGfz;nqTPPVN#uX%a zC1>S7;w2BAbMfnz9EWjPau1Sbz}Gm2hZ@+AV4!H1A!xDXOUy<~!7P?Dj>$Ef-kFQtLfvx^e4voHgp z*MWV1NJ`(=pfsp9W^eIIw^#)!4Ln4Zy&-FI#azib1gOQ2z>p?PUQ&K`#)u?N*IF4k zFM^c}9zfPcJf?H@NEB=eQ3_fOo_cmJBrUyl+b9lAQ~6P9y1zQuBoyi4bjhbEn3~MZ zs5p`XNj0)jb$PwSz-w!g%xg3)4lpSlSsT$*?o1?ihAg1gz~$La@plR&#pgm&gQn-_ zr^X>3c3xQClAOR(eG0Hw#KmV9)PqjrH?A-(J0Etr9h8A{3}Ko;!-uEQ1SsZ`MkHkw zz@h>MG&G0s9OnudpC5px#4L}?Px30{xQLEQ{LwIFrtN?vN7h49{jP>9@!vv{BU3sl z@}eroK$1fv$s1gX1H~MdjR*@w97aMim=vMN3P>7T1$q8~lpsB>D4!Zd%iva|Vpouw zmpwcsm5b@3w9skrG<3d!q4#Y37ymcx$pDCpGCo{+TKIYLr9=pnJ( z7MDDRAuR&=IT>jMsE2u?Qt&cJ%3u~GB?!gc3e~5jD#wE-$FCwitv+WVsRv6SZ6OPA zBN)#iKj^ed6s9QoWl#rdARFHr{c{4@oSu@&WS-KLRnUPTh1Fn09k`8Nb za(s3nm!4LTM*N&~siLN_cx?~0d$%nB^4L# zQ;8jF1{)!%T~ zM=S9?Rp~uO>BzXOqRcq-$U}@k%CGKNCI55Ksbh~rr0snfKFq=ak63;mtT~XFf6U$$v8zXP}3(u zQbq29r>=Z&ijq%8HVs~mTRc^9taK{cpA3sYkW5o$Ur1_^j*!#>{;Ir=jOs&ogibXQ zRl7gH*M&X>El6FN6E}<|2bT+-><2(nMYqmS3XV_C_o4x~bOsg~GQb8aFXY2#Dx*_N zxDuJTARa?N9z?-q%Anf@N$Iqmf6*+3*KQT$TZCh!8E?W>;}BNp^|^|J2vhrVSG zr_bM(w7EQ5-)LWjrS0&!8{KN0P001MY{A(F&EApsd6B=r?e~MWcU-#XtM)O=7q@GD z;LYl;uJgNyxg8dKJu+y^t2u|t7yseVsM?AiEB$Y7b8m2g-=?>9(QWf_((|?l&xhR~ ze|vOe<6z;7Ge7Hp*fn5=@N>O^<}BBiZ!48J>-i>9sk4bcE|ueRkt8-W@n@unh9=Qo zhZPtV(n&oU8u-3aIb!xoqKk>IAw}TRAeG`XUn1j?d~?=|-dK}5!%9zii6zjeHQ)>U`$8&jY7+kd zN4ZubP7J`frm~?mHt@rw(q<-ctI7#-4Q@-KyGd+@6+~%QE59H;lmH|$m$O|ZmAjjS zpKD9z&5e9lDWbVaEXM3=3j@7e#$jl>C?&A42OcMY)8CFAy3i^QW2^_I0qqW3QUgXL1s`| z%Nf^q;5Y;5+SKCI^Zq7r0l1#v%;b3_Nag+}U3W+HlT_v$qWcA*!4wilW2;l@i=y~L zQh9($v~*V5vxamEeH{jkMvW-VZD|n4K~wsgdgCi-GyrQ#R0)fQO7AK?Z-Pd>f}WyY zfkwGhldPH>_#INY!6d#^Ii;rpU0^RoxrK-Y2vHxSe2kedq0uOjR}!(NtCA1mFxEOk zGsUXPvwcgb5dy=6Be3se6EtjP?P?06U9MV zKILVCx0XsnO=9<^O72M4$e^1JEl9Fx86tj*kT3GX{KjI~Oe!^+#L{L;9%um9AW1Zt zgqO{v3Rk1p%Uu~9oHQ4+djT|ZSTE1lZp{@hO4>JXV>@FtijvbVKuAgPJwn}N&dX1W9fgpR%YK9u zJ9CU~CBJS6DcmB2l>BZYq@-wp8PY}0ZzMvB-9CgAI|~dLnG^dWMBRc`K^rZEhAh-J zs(?o044vD-AX;L!lZF<9WdgMJ(3GWl4K(~KsUt5_mk~r!G;W(2czdb5i-}K_#I7cO zsT6_F>r!b~ljs)Aas6OrL23Byk{D&uH%7lFgHy(8+Xzt)f_k5qP8kgRH&S_&Nvs*7 zIH?rf6&g7L3s-}F7Bm_=Y6dezJ%~sUO8s1s7u5k8hHDBmGRBa^qP+?lwrR|OAKqG7 zH4V~-YWdTeJ5h@0ZW8x`>xP64Xq*czjnecUMxod!RrE0GzQ%~d!ilwCXW}@F4cf~v z;=4nm;V0iMh>O%XWojRW<}Z~s3K3r-q%6s_?)jrWQMUw3S1nMOxW79nf|ddT0??T0}uZx0GPT}o2;pH;WS?>3O^{?E-?0ewJ4)t#jbiVPO0_Z9G4AF;i%@()T`oaG zb(BUG9K$8^en#P5xD?sXsPpJVGX?9VFu#*j0ls->$vnm=WOkM!AvScDrpFk?bLbN) zQcqiit~#=AFC8<42%RIO$XKH|3j{`ka(5U*`i(5nh)zLnGZCI@2RAGYbf4< zM%`~FSz%~2jZ*qeCs_pt@llfbAfq5fNs$oWL`l;jxM-I#7D(e&sMbxY7;F?nF|uhypkA>C-2`aS^3Xh~@=8Al-L+|Ps--~}22CCl`k4sP zFt04`3>fq)`HdS~w;nXhXnMpUL^D(FZ1F>An5yW>x#;CvRW-r2r&JMV6!LmX=J7^x zKWZ~nw#0}PTzg5=&S29mF ziZ>BQ6Bl*H{4-*iQ*xjUZIY^?eK8F7K~vWtSU!i=7U`6E+bKrrD8=#7F;Yd!IN@=O z6q$s6uy34n9pCW|L#q7Xn7V9Nyv!4376SUS!E*N$jpiy5c ztL|NB>du4F(j`fn-pDATZ0F-5A#H;RW+l_4kJ`Uut1q{sr?HKo1nd=G<=lqOYx+zgVY zI~pGg>NRNIO4gWM&gs(h;YM*?x< zt3-qNab;YrLA(Kt<^);?v%n=oSxccIE*2WKBl3hx5;V#ar4KU*XELP7LZhh5)RrH* z4jdcl{vS#(b$hIj^R&@*#tj?*>)c(PGwi+6ZQaMi7 za|AuTSd_HUBhX)?MPVeK{oZOrp<(VSNyL57F#lAoQK9z4jG}bopbeIyCbZEb(EF{C zPmwYUvG#fg>7n#|8+8F1)=f1xpHWqlO@bDNI6RTS@ypQ2ae0CY_M@f94n`qM7UJ5` zilx#tKdBm;4e3l{l)VNT8n+Z$kW|(zMBI;14=q2v=UAow@**-XUNnOqL8C}_4Iz^} zkzK|q%NaaqXwWA>!~IN&GDzB%h-M(Pim2 z9jS-FbXW4jdTcXMe!jqFGy$PjQrYkj@d!fHpC2ikl)$FEa{jrbrcKM%@Qf z(Jb<8JcEz{`D1;@mkTwgX=@L4XQw}D6Du_=1bd;WZ3*xBQnZWQaV82WwZaMjMR6W0 z04dZ)a(%@*)0Onty>QRg16o@p4y`p8S})ps#Ty9ufR~4tU_C>cKG!Jpn;})qHHu%% zP)focFwmfT4h`+lC`4#AQ<^@{D2$&eRm?Mr+h-~{i?l)uPi9Jy(wDm4WgIs|it-H+ zA0QNo0(8<`AA`_$mNb37QP?(1s+f;Eb9`@DeYR2qEEi~yuFyhcH|P4aoVOsX*qW2S zYUj)#ZGlDrMv;7xj+Rf+{Amx2@v?Nl9%=@ zXeixZptqu=UDOmLdC6&^O)wEyJY`3^L6Q|_tgK@Nk*{}3DQcmOZ#BgCRjo*poBdRs zB;^(h5Z@o*q)iKLiYe7#fLPqi$QMb{hsxTYCFK$iP<(z^c52%Cd^Rh1$btbp=GlFAv2pGM>hOP*Yi zs>(DOl*qB~mgLw3HJ+pnz&z&k0EVbsz#K@rs!GatENvYS$tRhKY4^XKe12utN09_=h)Gt+e5R&r$3ZRQ5 z#h25I4s;rYdWZf{P?tDv+y(05x?3HKM8{$_5`KZPj>LN&)XR3pNAmtg=-l&77ucs%C0D zNea5-qq?-|J!RmxRAWh!v%accRTA$9p1QR)B>5Vu+L5H7QPoM3eOpz3m!zn6ygKj^ zkTVQZ6TC}O!CeqfCS6q-rP`CEV6>`}tOI?Js*|LN6AwvLg32fG82A)U#0PnttVUFo z#HXt9>1upcSqt$a)c8VGj#BO3B`IpO8b8_*0Sb>%i9bnc__Bub$}kSGQyCWbQU~0a9)kCD#@Ws;4L8UK$87E z)vi*aeDe4)A}FI@A!!SF4N10d=tGrqkc{a1pO9oCsCFdDq3Wtmk{l9?RYHWM0?bue zQ{}5lim#>eBq>8nNE^szDqmGn0Uj#2$*NA0f>Tvls`4bM zC1*mCeVH0RTjh)AAwYe&RE<~;Nf${9uEYl=Tm?yeyq3tnkyOwIHJ&7;+o;M9Au0Z2 zNGflqq8D?!5ul4C8GH#z3HPczNz(VJdR0mMe(*F{zlJ1}L#ix?q*dS?k$)@E|Nmq_ zY1RLZ@sE;fbX_f|swBs5fhR|AtMMeMqCY_jH2&_Z5mhB6cmST(!QaRb@(DgD!{?9` z|AI(W68}ckNz(F0*MEDil;{8d#Rp5-iB9sT{Gj<)of=Mw`1iq5ZVLH1l0xa)^9cfS z_y7A~`R{|JJg@(Ku>5b&jsHGa(hBnLgJsnRN@@|(X_Nf-!BT05e;+JqRLBpSbVv5@ zgXO;umddU5zYmuGK3M+${a_h`^{naxC9QL$|8GB7ZhQ5KPe&=>Sr@7BsfASbtP6ic zy7;W0X{Ap?N z%YM=wXs@81W&4NnU0GRgz83ge#f<{{Uw@oYKK|FXeGPNIn*RD_n{MZx9&3~o86I6? z@+f@G)gL&p&c@gWZHDk|YBtR=UETLy>WK~s9SeTmSZmgRiS1EQo_k$~zSBETl~*sb zaRUaKoe8?dS+%-0)AG)Vq=fRDH#V}0k$Q`2vv+sfyEv}b((B#6+G;m&i(l>SbAQVl z6TfJ`<7e3k?p?iXCmpo)@|8kg*|6WN_^weGwM-$+Jb#)#YyPKGFVz{a(d_Gr+!Y~n z9_G3@cAn@dc+`7(u1;3!FRtOEbNkMYG5@O90QYV=`zI{DF?o!Q`I+b2C!c(O*D~qB zE8F7sKRrBbWnqyLb^TmUlTST<{-eb6c*l*O1g#7_Kij)=^#;{mr1xs((mR%Yk#}~9 zdF0t|YkkhITT^l?*6h$n`@;9$tx{?F*-5+1cK&?k+~h6=5%ICfkH(y_^nCbP&FeEy z-5D5l>g3&n1+lI*E_VH9?AeZXA9y#&j*NSuvmO09W!B)+)w;}hQn=#x+8g&t%U;_S z$C=Hzc4@tH{I#tVjc=qOOU^ePwIpYW*Y-WLFKlmT^Q7gbV>fnB?ES&P zwU6KTcfY#P?Q%= z)eV@I_W7(C=jUEMY`5vIT}slt4Yt3|yC3-Fm9P!Z>{bm9UsLGO@++~g6!pfo_;KmM zv~@2GMWzqu-tM{}>sX5!RzY`?1CpJNbA>DYTK_WDvbTBOxSc^Oha4T@RqygQWk;g? zJ{#-Sq2aQQUDkRZy;a4#AF6tnW6}lh@d_LJaA&8_pWS=F?-W0KIqc!U9b@$uat?VL zV;b-8z31!C?d^I`A80XTX9d7R*)vm-MC!e_Pu6rXM>DbwPb(a(6)--;Whm zgZeepd(4W5?rz3gu;Dz22W&qP7l>#gfcTl^3LvKGK%6DwF>|d3BB(lu$<;vo%1#k+ zhll_(5WlnWW*`>T0CAIuKbWr$L}xvS1v(JV*fk=a649|bh!<>bbr9=C5Wf@ginXf& zBE}rVni?S9u*XE`Yl7&b=er0z&sOXCzHBEkIuT4Yp7j*Lq}BrS88JGZ3FcsIEx;t1 zgQ>x@Pl!28O#Pb3SY&ZEk#S*d5ML8flUdaQ;a&&C@LC`&*nT1|5YfZ}L>-oE0b-gZ zh_ggkG1uB4f~@#jY*KB$D_@VDBI1q}ECTAlqCOj62gIVfAZ`+2!+b44bglHJrMc^AU4$l;mV#7v6F~F z)*#&225S(hHXtmh|C_Mb`XFp=LF^%-850|TI7~!l0}##GE+Pu;Ksece@MLK=Al&Ui z93#Su+1Y})V6S=Fl9dxN%>fo(cCheeMRp*996?+m!jCn#2XTjpGJ6mK>>?41oIr#+ zfH1I92N0c|K|CNLm<2n6cuK@FM-U^cLlM@ z8ALnwjEJ2?3~C6X1KZFLL~0`t7A_zG@n}9e*L=>}g195?fv2Gx`v2r4&H3i|-7(@?N)EGoiGZ0sZ=*5~h0da?j zvL+zt9}stlDDwd^oLwYhkspXqUl1c%sV|7m{vaL@QN)5<1zy5X37Yidlp|2)zNsCVvp)*)t+`5-}(M#6-3s07PmK2#Y`vlUZya z2-{!~dx)6IMEpNNej1A-QOb6an9i(%AZD;M5;NI;5@pOT7-AO7B{7?olbFL?TSLrc zMI`32QzRtTJOpAs8&6^ZyGUXo^KApcSSg7`>>7#1EI1Tm37bpeJ$4s@t#1qGqKt5E z8Cz@w5z`LDDdk~vUAXc$wMC>GDP+Ji1vkh%Qq;>#d(GJ8K7TXSlZ5W6> zM66?Cdk}|-$ZQW{1KUMJVMh>79YB1@(mH@}4+n9Kh)v8c48#Q@#)g5|%*u(F)(M1H zM-W?CQAZF#ok3h7VjF874&n|GW#J$`V;6~76agZ%6NnwGv=fNVksuxrv5N(F2Jw`L zWt~CnW_O8LPfK=G1c*IsaRi8%t{`3!v6n?eg3w2S&|xa``&kc~YdeYfjEI8_OE20Z z8bnf85MQ&cMA&u%Q9laAAr=<};xG|k6H(5rqCpgP2QfSv#1Xci2=^W!nsftkjOBI% zae;`lM4Vu*-9b$231V`05U1EFB7%B>2qWq_R`eJQ( zN(TOtReJscaJ86gf4-NTqxSc04(!-8l;6SY7JK1M5tf_AJBUg7@x#+H61n<2%HsLm zg79JRj#=^i$FjTKDKYyfh1cuOc7P9T>rmXPoIE0!u`Q{5m`b9Q6f!i|{uoS5B+E+U zorPPGJ7%TvpI4J}8Jfxa=vw2cNN$dra!q%9kj)ney0iF&Mb7(uB^&kcUX*9-IG)Ex z@(r}VT#=BGCjZ}ms;Fn~4(|fqUa-*q=)>Vr__3|Br4wa0cZ@0GCkaw_XZP)6_^;`s ztFUkk{}lpF%<*xi8a|v{LHQ!kkFUww{(#$1TraP&C+GM`t3&c#sq*79@rPKC^L)MH z!zxYRS~)8zxN?=Fp8{>k7MJ#F1^sesFEh$(7LLDj-u)PqEFQKN4W1)l75-r2+&2Ik|D;l{DUdg=(5Vus}Da?&bY3qTs?%p zSGn(1j(#+y7N(2(gM#&eMJjidel?{u^j6(smAno~L3%GE0|Bb#k19vqp}jVE0~~dc z9WWCh=jlxq{FA##dyPEJ@o`2a@2iQOpq~TidY~F&=E_gM zl=x?rYl!fCfG&Ci2LCu0z)Ed}UsTQ&+zo)n4ZR_Qe_SKrDqgLpKcvF_rjl+5)1xpI z_Pfe8MmS#0@QKQ~QxoAb`-wHZ&NpH)-|?M`sr}6`0_bHldS>qc(3?fufgJ$7^F%ME zbp*nJ&OihZ3A6%e^fv@t09T+9;081XEP&cT9l#Q(0np2kkATO(FC51lF7Xk9Eyt2C z@l%TF&B?pKPryB3FR&jt0MMYIK|p;@zsS=-qk%<(<|=RvpbAo-QyCgcc3}o0kiXl9oK`+)tx z0f63p+XAcv-UrsuJ8EkYSOm}vuL*PoN&$MGZz3=Opp_sU$ON*0Y#;~71@eL6Kr%q@ zLJkGufVMzuAO!FM8USNasc`_k)tw1s(HfV5KpKz$!~;Ws!9X{lJJ1E_2!sQ-fRn%} z;5aZHpch5%0C#~cz$d_AfZp|42GGkuvw-P9Ex-b(4bTd3lxlViI1ZcyXhp98HUb-f zNx*2J5GVptfixfiumRw|{LXtKWDlS#Kx-QKU=?~y3 z@CwxvZN`SsP9|Md7#si&z z&Oijv1?UPy0o{P^fCtOH%Gc}Ri=ZFi4+H>#fB^^sS_2^fmI#gq=%uJH0eY+IBjA1D z17HPA=+&@Zz%X|0D*m8qK7s|na9{*55-0?UfKfmy&<}_KVuAL60GI(fU?s8~3^@cC z3d8}lvL^sZzyP2>5C+r$^uQ{lNroIKU>MwnvJY@TbCy7k0BBpM*O{II*MUzFw+>hc zFkl#v0Tcj(fg!*gq*(*druhPCZUdhIM-aCZSOzQs#sH^ba|Sp|!;ZfGrNlP?`d0J` za1Hn#xC+qT^&PMT7>f)kjzG34(0yptz!mmH-nU$TgnAjc1Y85}4M{8SO@z+^gLhZuV91LQ2t44S%h&vOExDNNIu!X&92nmIoJOgh5poEKMBZ{~RP~~Y5UkB{qEG_@{5T=ZO0`3B|hEQ+a0f?i8iM9&b zGHC0t0%`*m04<1QuZOGwJVp37-~n(S_>~rbUl5>;_7U(9_*sRf{|@~Pu0J530M(I^ z4lo0%0Rq4QZy;U+uYl(O<@*fK@_C8y3xLYvVZRe{C(4)q1AqvEJSJ~zL27pcbrJRj zM>U`t(xRoc1Z6-iL1XqBq&uV+&+8q!lZ5by(9(FW#=0BtZ- zdvhQF@CQ@_Ii8%N_+Y>Q1OX<%2!sM{02-JfkhEzLr-e1XN}+O|XJB)hUh*f8Xx|_Y zY0p>>bOgcxa*PIKdq}E1wFvcZ2k7g7HNgA8Kp-3-+y0Q9fG$8R5Ce1vx&hHZ6c7Q> zP90f{kIpJV33>uOfPMgZ-W#%)8tx0(2cVHpQ*HplRM=o(5I}=;HRLiN9>@g}fr+q9 zfQ$o%0z&|@rHd{8iFYf0Ls^hY$;gaMW&tySG++#n3KRhaz-WN7&jGT53}6_L0;B_! zp6)1;07_43DUM_dxI^Jgfb6oU6DR{BM*&(Pr~aj0akw&>4`^fl^=^Fa?+dNbL|g5rN6TRGx{Azz|LWRv}Crg+G9#PFx49Rl}rfJdHRSois8J z0u5_N@EJgMB*~W2 z1p-vq0RR(Kz6+%Ssj!`ZKd=$Fio8CD+(q5E7lA#%Zr}^xOMr|hA+3$H9%?#CYv3#3 z7;q9e0UQU80!M%fpd2_190I-pXxaN3lG0E-wTkR4^*eb=O|t>0(lqkhGv9$b51a$e z0<;qlcM-S%(0rr0bq%-#ouoIUJ)muyR}lUlpsn#5ByF2NK+@O?yo$hem8AY9@?9BG zCWTM%f$Mn~YyFUKS`EP+Lmu)X&nEoLH{frv#Xs}og-1Mde8k)0+pK^`yk7v_Em~nv zAIM+1^Sr6+X+1yK;O*<1v_@~ z5pT~6>>elw7ZhrTG}oqGD%cubp%?hU{@#J!zF22j!^gZ`fcCfA8|Y%4qMas|3w*G* zALYquf7LxSI;Y5K@_{x;>f`N8aak-ANgcF51OMB1ZuM7f_|YUA$Z1!yRgd{7ehd5g zG4JP~{UQ5Vt3K)TYV3(VvJX@t?gR_{1%6**PJiGxtDIl>XyIWsw(l3-R(Ms7efJAb z-{D*Q%KP!QtQ~}d_NV==XMA_P&(W{fAS)E;?S~=DW|M(-7C_ds;HOdPJssq-0==;` z#IqlsqpV>It_XJgC}#B=lu2xbnb5!)t)U%W(C6Yc&$9o7=^<{?7Y3-ZYp0(@;s@9!H|% zEI&PjECOKx*B_ZLe8P9dPq|S~;PVKU@`R6a(9SK$Z0;PtaejO^fu|Ov{G8Z{Cul~Ure_fSSlKi5jdq5?)Edo~N4@{a zI+#?PiL!M!)y!NO+sL25$UkoRsPRPB_Chjecv^|g?(jxRL?H4 zP*(3kIM`l;uiI%->$HLGV+ir-OE=!}0o^+kNm` z`W?B`ukT3 z4(-h36_IkmZ!kK++6A*7&jhN~)90g855&yJ8g&Vb4Hn@^EJP>Rb+c(MKVFq2#vVMd zyv|CUzzbk-Bk}g+g+8b6Hy)L384E9i6ffJu!U7h)=8x}rgj<^lyf+wYFr(NoGx(+* z&hRRO-;&cP>^r$Lpq)T*X<~A?@51l)SH@s{K~e|Tmh$(v zB_D>T4aze$TUu#gU_Vga+8Gxfb>02=89%P7G|*1L$QZi%&AGX|FbK686*4b9^45;c zxV^C8msO@GyDJTrvp5*w_tMd1ryaYo|K{BF^=vx*QE7LcZH7UBc20-h%ILY1pMSK{ zKs(7JuYJfkt(dQfLVL3=5DwZg2JatPRJ0=f+cYfk zLEZtlzu|hbVi*KyM`VcEZNB-b$CBMJ2=Hzdh)qEIOV!$+jFyL~JOoFvW0bdc3P#wu zgNtwMwcRX_7kOySWxP3jSj`;Fg{T1SbdC4ZM+`4|J-`We*sN)J(aztPxFzX?M{u`Y zh(Q6g8|&CIa||^TJ4G4QW%o!ZF7r)T!VqL>d)_~2h5S)azCbrQ+7~!U`z7N|yEhpMR9@?M#rfmGY zgS~y&V?V*V*vGq70Gg#L$9tW^iuWT1cNetHYsZCXe^k8Kk~fC>cn2Vvr|N?C_sA&*so;Zl)`<2O z$?1MZzH#Gnk%m@P?QfO~yy`VK1u-IGw7+VuxQ*TO&$$i4A2_ef?(ggR_s(etn`nRj zTy6zle~hS#4y;9Op=+RaT!zVE>)y^8JDcNnUtQ$112s;4=K14gyEE@8X{puMhp~@q z3#}ZrQ%?RE{Cmi~p^xs#7IO0+4P#sC3%1OIk-h+SwbM z_6&J2w&MzHT^Rpx2hZl=%76(xu-EZYjpq|8V1>5f02`d}=_b9cx`5|6i#5nc$_VeSE z^L%g&Ps{#gO+O0_7Wj3M%7FUMV2kTMwoGy`Q)XCpU4F3_DOy@DSpo7vV}*W@(M(LS2m%A$%3h23rfsLUuRy zjWt?bJKv>b#Jw~9A_HG4LmrLJ+4f-8_0gvP*~Mz#b3=NvF&It%Fo4wYrux9H*T<3- z(~G^XkDBi6#b(-}hKGBxt__e24tAkm&r9Zx=^gP!z1GoaSM?_6r(UcC7J=GPF)hyT zJHrk0qK7do&{X&ToVfA=jhUMk&W=;sch$m=9uPV0fSKVH1D`srFEpnXP-0ShGe;YE z_Md6TkqOF$XWe1(jtL@LymNy5HSK@qu9dHyU=#U8n7-mgDc(oLXqMNo5#j7Ud8Qqf zbH24li*ZMdi(o-dF{sv+KFq}yt$eo+>rL`%IGaXteP8y4EmCTy-$d-W746aN+GM0u z*T7Gikd1Rh`oMt;orL;2R4rm4JNlNf6%^H$Ep!xYbf{0I;eT^+z+iUL34NuV;jzsA zhI#n-vXA6e^rvptDm!H`b9RPPYD+k32eA0P{?*}WO8X~DySGA$&4XD6Ssob7rZ~fG zr5SA5x6VSUw&*x&M-KgLnX~2dE<=YSxw=K}AHs65ECp&uz|2Yc{)>zs+PTrBk-ypC zw8LV2Qym>{ImfT6+(XTWvM*^#b05ksG(^!QLs=~s$nv4AtqbxzJ5*WTPt0ET+nJMJ z-bbm};b{Z7iWn;_4F{^-|DeA8i|ulCNBmkKe=I$<@P#Ertax{7CDF z7+O}&pa0-szmIC$A%+GPVm#y6Wuz6_#j(MzkWq2W5;8CzDe&D%iC4dV76TTv-is8t zTckmoff%|yGJ0IEcYpnJXW0*5+@^9`9%@|#^F%h!6?Ge*$i9Je)Xq*i@<12UuIb)D zq@?Few{!L zOGqou3o+E>nNufnHzGe>h!}MjZj;KEBW-#wSk!~X=}F6D*WYXNh|39Y7Ub>n8idV^R`|f=e_qD{|OL55d+!JBq6C&inHl zzW&t@7V3c-J5-lzMoQa z*_X>QkXAUF%cgju^6z}ImOZ+V%g%VBl0ynuqZY8#j>x>1`PF+dw|g8xp47zwn5zXW z=btU^6|gT`z+>%rD$l69*T-!+Q*MU)aJi*9?EtIKZr+Lc@%4wVD`Q#?XSKZ0p~{(8 zII8jE1;<9*J2k1&B4Idd3yVPQl&l|GM+f$P+#$QtLOVz6aO3aS?_66kt}^EH;cOPA z)lS}u{p6?8A$4|7uC&n3<{G_vS!7|qi+IY`e6}CKE+egA7{Q)+VFGD~f-ax3yTkfd zwb#lItn$rD&(RED(zg{jB;?S0cOFMo(ORaaf@fUYss2fY_M zb4^xd4W(8k8OQd~c57D5oP!|$yv^FO zXkWoTP&@yt)tl{3(YooMBYRqlF}bu8!eTNLgKpjSeXiCW&@MZvAK3G5NlzPoVr{96k_b%HhW!#&7fHg?CviOND% zbRymI{W*`Xq5x`jY{%+diKBMlSkG>^-F#Yqk4Fd1LTgyHLD?@1Pu_EBq=GSWN(X%m=*jKO+94F&HIzVa#s!t+pZ~&ea zRg!%afNuQHJ65?H(URKvXf|hK9=Ba~=nIsB(L>|s`V{su04=EU$#Pn$CG0esUHf>7<&&vOYL4W!k06w2P-M#GNA^ zV(bjqAyJcPsE&VMmNr-ZG7R3{g8uirw7;80=|Pyr@4g+xGbp!o23r|~&el$c8y`~R z!smf2=uwL9Hn2J$4rdQBJ^vw(;WJsIV5}UJd>!XqkTMFVDaU1G$0a7^e)W##82 zB^1ctn&lPc6l62s!Ge=Nj@*?sH3LQQk{|jgn@V%9oID(HS&%j&DW8p?!Eq9FBE7TNroZK&r(6hqP zLTmQ^7{QqpR|q57!VyAqwr{i$!=6+KmgYmxDLq{&~B@ sYTUH*G*%th*dxM^<~z?T37(#(1WnnTqe5Hrwinb~E-0429~FN69{^DwV*mgE diff --git a/packages/android-web3-provider/index.ts b/packages/android-web3-provider/index.ts index cbf91836..2181eb60 100644 --- a/packages/android-web3-provider/index.ts +++ b/packages/android-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 { TonBridge, TonProvider } from '@trustwallet/web3-provider-ton'; +import { ITonProviderConfig } from '@trustwallet/web3-provider-ton/types/TonProvider'; +import { ITonBridgeConfig } from '@trustwallet/web3-provider-ton/types/TonBridge'; 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/android-web3-provider/package.json b/packages/android-web3-provider/package.json index c0af332a..d8d900ee 100644 --- a/packages/android-web3-provider/package.json +++ b/packages/android-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/package.json b/packages/ios-web3-provider/package.json index 9418b66d..0f8859db 100644 --- a/packages/ios-web3-provider/package.json +++ b/packages/ios-web3-provider/package.json @@ -19,7 +19,6 @@ "dev": "bun build ./index.ts --outdir ./dist --watch" }, "dependencies": { - "ton": "^13.9.0", "@trustwallet/web3-provider-core": "workspace:*", "@trustwallet/web3-provider-ethereum": "workspace:*", "@trustwallet/web3-provider-solana": "workspace:*", diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index 1eddee56..a73ba59a 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:249ab6d5f85cc57cd2822891439a7e72d1404eb1c8359543028311eeabb6b81d -size 674983 +oid sha256:941a1d962a31c5ced8285d8cce96926b2312b4300395b526a2ccdcfb1ceeb96b +size 678319 diff --git a/packages/ios-web3-provider/tsconfig.json b/packages/ios-web3-provider/tsconfig.json index 5e8e402c..58131bc9 100644 --- a/packages/ios-web3-provider/tsconfig.json +++ b/packages/ios-web3-provider/tsconfig.json @@ -1,6 +1,12 @@ { "extends": "../../tsconfig.json", - "exclude": ["package.json", "rollup.config.js", "tsconfig.json", "tests", "./dist"], + "exclude": [ + "package.json", + "rollup.config.js", + "tsconfig.json", + "tests", + "./dist" + ], "compilerOptions": { "rootDir": "./", "outDir": "./dist/types", diff --git a/packages/ton/MobileAdapter.ts b/packages/ton/MobileAdapter.ts index 1fa94d29..be645fa1 100644 --- a/packages/ton/MobileAdapter.ts +++ b/packages/ton/MobileAdapter.ts @@ -1,5 +1,4 @@ import { TonProvider } from './TonProvider'; -import { Address } from 'ton'; interface ITransaction { valid_until: number; @@ -27,9 +26,6 @@ export class MobileAdapter { messages: (transaction?.messages || []).map( ({ state_init, ...message }) => ({ ...message, - address: Address.parse(message.address).toString({ - bounceable: false, - }), stateInit: state_init, }), ), diff --git a/packages/ton/package.json b/packages/ton/package.json index 78e34682..a7913c8e 100644 --- a/packages/ton/package.json +++ b/packages/ton/package.json @@ -18,9 +18,7 @@ "build:source": "bun build:clean; rollup --config ./rollup.config.js; bun run build:types", "dev": "bun build ./index.ts --outdir ./dist --watch" }, - "peerDependencies": { - "ton": "^13.9.0" - }, + "peerDependencies": {}, "dependencies": { "@trustwallet/web3-provider-core": "workspace:*" } From 3fbd3de2f852155ccc32db42e60efee7b4dad5e6 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Wed, 18 Sep 2024 10:49:06 -0300 Subject: [PATCH 03/11] Adding improvements --- packages/ios-web3-provider/swift/TrustWeb3Provider.swift | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift index aa9cb8d3..46e30aca 100644 --- a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift +++ b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift @@ -19,13 +19,14 @@ public struct TrustWeb3Provider { ethereum: EthereumConfig, solana: SolanaConfig, aptos: AptosConfig = AptosConfig(network: "Mainnet", chainId: "1"), + ton: TonConfig, appVersion: String ) { self.ethereum = ethereum self.solana = solana self.aptos = aptos self.ton = ton - self.appVersion: String + self.appVersion = appVersion } public struct EthereumConfig: Equatable { @@ -158,6 +159,7 @@ public struct TrustWeb3Provider { return provider; })); + // TODO: remove after updating to trust window.openmask = { tonconnect: tonBridge, provider: ton }; // Custom methods @@ -191,6 +193,7 @@ public struct TrustWeb3Provider { trustwallet.cosmos = cosmos; trustwallet.TrustCosmos = trustwallet.cosmos; trustwallet.aptos = aptos; + trustwallet.ton = ton; window.ethereum = trustwallet.ethereum; window.keplr = trustwallet.cosmos; From a2190bacc988de3c36e1c1654a05821e67927c5d Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Tue, 24 Sep 2024 10:55:42 -0300 Subject: [PATCH 04/11] Adding to ton window object --- packages/ios-web3-provider/swift/TrustWeb3Provider.swift | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift index 46e30aca..b910c580 100644 --- a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift +++ b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift @@ -198,6 +198,7 @@ public struct TrustWeb3Provider { window.ethereum = trustwallet.ethereum; window.keplr = trustwallet.cosmos; window.aptos = trustwallet.aptos; + window.ton = trustwallet.ton; const getDefaultCosmosProvider = (chainId) => { return trustwallet.cosmos.getOfflineSigner(chainId); From 22233f65e4b56fc0bf63ce426df3f77cb4588cf8 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Wed, 2 Oct 2024 14:02:45 -0300 Subject: [PATCH 05/11] Adding disconnect --- packages/ton/TonBridge.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/ton/TonBridge.ts b/packages/ton/TonBridge.ts index aa7fb68d..f03afd31 100644 --- a/packages/ton/TonBridge.ts +++ b/packages/ton/TonBridge.ts @@ -83,6 +83,15 @@ export class TonBridge implements TonConnectBridge { }); } + async disconnect() { + await this.provider.send('tonConnect_disconnect', {}); + + return this.emit({ + event: 'disconnect', + payload: {}, + }); + } + /** * Return and call callbacks * @param event From 6985496508d82ef429c13dfd80c73f36f3e65064 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Wed, 2 Oct 2024 14:13:07 -0300 Subject: [PATCH 06/11] Adding new packages --- android/lib/src/main/res/raw/trust_min.js | 24 +++++++++---------- packages/ios-web3-provider/swift/trust-min.js | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/android/lib/src/main/res/raw/trust_min.js b/android/lib/src/main/res/raw/trust_min.js index c5624a9d..f5bc8b86 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={},ef={};ef.byteLength=UE,ef.toByteArray=DE,ef.fromByteArray=zE;for(var pi=[],Fn=[],NE=typeof Uint8Array<"u"?Uint8Array:Array,Il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",So=0,PE=Il.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 UE(e){var t=Pp(e),r=t[0],n=t[1];return(r+n)*3/4-n}function FE(e,t,r){return(t+r)*3/4-r}function DE(e){var t,r=Pp(e),n=r[0],i=r[1],s=new NE(FE(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 HE(e){return pi[e>>18&63]+pi[e>>12&63]+pi[e>>6&63]+pi[e&63]}function jE(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 Rl={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */Rl.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)},Rl.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=NE,ef.toByteArray=UE,ef.fromByteArray=HE;for(var pi=[],Fn=[],OE=typeof Uint8Array<"u"?Uint8Array:Array,Il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",So=0,ME=Il.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 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 Rl={};/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh */Rl.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)},Rl.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=ef,r=Rl,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,Up=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 qE(e){console&&console.warn&&console.warn(e)}var Fp=Number.isNaN||function(t){return t!==t};function Zt(){Zt.init.call(this)}Dn.exports=Zt,Dn.exports.once=ZE,Zt.EventEmitter=Zt,Zt.prototype._events=void 0,Zt.prototype._eventsCount=0,Zt.prototype._maxListeners=void 0;var Dp=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 Dp},set:function(e){if(typeof e!="number"||e<0||Fp(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Dp=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||Fp(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 Hp(e){return e._maxListeners===void 0?Zt.defaultMaxListeners:e._maxListeners}Zt.prototype.getMaxListeners=function(){return Hp(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")Up(c,this,r);else for(var u=c.length,l=Wp(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,qE(a)}return e}Zt.prototype.addListener=function(t,r){return jp(this,t,r,!1)},Zt.prototype.on=Zt.prototype.addListener,Zt.prototype.prependListener=function(t,r){return jp(this,t,r,!0)};function VE(){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 zp(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=VE.bind(n);return i.listener=r,n.wrapFn=i,i}Zt.prototype.once=function(t,r){return rf(r),this.on(t,zp(this,t,r)),this},Zt.prototype.prependOnceListener=function(t,r){return rf(r),this.prependListener(t,zp(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():WE(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 qp(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?KE(i):Wp(i,i.length)}Zt.prototype.listeners=function(t){return qp(this,t,!0)},Zt.prototype.rawListeners=function(t){return qp(this,t,!1)},Zt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):Vp.call(e,t)},Zt.prototype.listenerCount=Vp;function Vp(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 Wp(e,t){for(var r=new Array(t),n=0;nt in e?YE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,tx=(e,t)=>{for(var r in t||(t={}))QE.call(t,r)&&Gp(e,r,t[r]);if(Zp)for(var r of Zp(t))ex.call(t,r)&&Gp(e,r,t[r]);return e},rx=(e,t)=>XE(e,JE(t));class nx 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(rx(tx({},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 ix extends nf{constructor(){super($a.PROMISES)}request(t,r){return super.request(t,r)}}class sf 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 sx{constructor(t){const r=t.strategy===$a.CALLBACK?new nx:new ix;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 Yp(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 of(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");Yp(e.outputLen),Yp(e.blockLen)}function af(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){of(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 Xp(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Cl(e){return typeof e=="string"&&(e=Xp(e)),of(e),e}function Jp(...e){let t=0;for(let n=0;ne().update(Cl(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function tg(e=32){if(Tl&&typeof Tl.getRandomValues=="function")return Tl.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 rg extends Qp{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=kl(this.buffer)}update(t){af(this);const{view:r,buffer:n,blockLen:i}=this;t=Cl(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>Ll&cf)}:{h:Number(e>>Ll&cf)|0,l:Number(e&cf)|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:ng,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))))(),es=new Uint32Array(80),ts=new Uint32Array(80);class Tx extends rg{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,Rx[N],ts[N]),ee=mt.add5H(z,H,$,G,Ix[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 ig=eg(()=>new Tx);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const sg=BigInt(0),ff=BigInt(1),kx=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 Cx=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;isg;e>>=ff,t+=1);return t}function Nx(e,t){return e>>BigInt(t)&ff}function Px(e,t,r){return e|(r?ff:sg)<(kx<new Uint8Array(e),cg=e=>Uint8Array.from(e);function fg(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=Ml(e),i=Ml(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Ml())=>{i=a(cg([0]),y),n=a(),y.length!==0&&(i=a(cg([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"||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=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:Ds,abytes:Oa,bytesToHex:Hs,numberToHexUnpadded:og,hexToNumber:$l,hexToBytes:Bo,bytesToNumberBE:js,bytesToNumberLE:Io,numberToBytesBE:Ro,numberToBytesLE:Ma,numberToVarBytesBE:Lx,ensureBytes:Cr,concatBytes:zs,equalBytes:$x,utf8ToBytes:Ox,bitLen:Mx,bitGet:Nx,bitSet:Px,bitMask:Ol,createHmacDrbg:fg,validateObject:To});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fr=BigInt(0),hr=BigInt(1),qs=BigInt(2),Dx=BigInt(3),Nl=BigInt(4),ug=BigInt(5),lg=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 Pl(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)/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,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 To(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 hg(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function dg(e,t,r=!1,n={}){if(e<=Fr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=hg(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:Ol(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*Pl(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Pl(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>Zx(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 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 pg(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 gg(e){const t=pg(e);return t+Math.ceil(t/2)}function Yx(e,t,r=!1){const n=e.length,i=pg(t),s=gg(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 Xx=BigInt(0),Ul=BigInt(1);function yg(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&Ul&&(o=o.add(a)),a=a.double(),s>>=Ul;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+=Ul);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 Fl(e){return Wx(e.Fp),To(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...hg(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),uf=BigInt(2),Jx=BigInt(8),Qx={zip215:!0};function eS(e){const t=Fl(e);return To(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Dl(e){const t=eS(e),{Fp:r,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=t,u=uf<{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(uf*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*uf*ge),Tt=l(K*uf*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=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=yg(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=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=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 Hl=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),wg=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const tS=BigInt(1),jl=BigInt(2),rS=BigInt(5),mg=BigInt(10),nS=BigInt(20),iS=BigInt(40),bg=BigInt(80);function sS(e){const t=Hl,n=e*e%t*e%t,i=wr(n,jl,t)*n%t,s=wr(i,tS,t)*e%t,o=wr(s,rS,t)*s%t,a=wr(o,mg,t)*o%t,c=wr(a,nS,t)*a%t,u=wr(c,iS,t)*c%t,l=wr(u,bg,t)*u%t,y=wr(l,bg,t)*u%t,A=wr(y,mg,t)*o%t;return{pow_p_5_8:wr(A,jl,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=Hl,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*wg,r),l=a===e,y=a===ir(-e,r),A=a===ir(-e*wg,r);return l&&(o=c),(y||A)&&(o=u),qx(o,r)&&(o=ir(-o,r)),{isValid:l||y,value:o}}const Li=dg(Hl,void 0,!0),zl={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Li,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ig,randomBytes:tg,adjustScalarBytes:oS,uvRatio:aS},lf=Dl(zl);function vg(e,t,r){if(t.length>255)throw new Error("Context is too big");return Jp(Xp("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}({...zl},{...zl});const cS=(Li.ORDER+BigInt(3))/BigInt(8);Li.pow(jl,cS),Li.sqrt(Li.neg(Li.ONE)),(Li.ORDER-BigInt(5))/BigInt(8),BigInt(486662),Gx(Li,Li.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var ql={exports:{}},fS={},uS=Object.freeze({__proto__:null,default:fS}),_g=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=_g.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,Bl=E[3]|0,zt=Bl&8191,Yt=Bl>>>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)})(ql);var Eg=ql.exports,hf={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)}})(hf,hf.exports);var df=hf.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=df.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]),rs=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ns=new Uint32Array(64);class yS extends rg{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+ux(a,c,u)+gS[y]+ns[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(){ns.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const Vl=eg(()=>new yS);var Zr={};function $i(e,t,r){return t<=e&&e<=r}function pf(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 gf=-1;function Wl(e){this.tokens=[].slice.call(e)}Wl.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():gf},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 Kl(e,t){if(e)throw TypeError("Decoder error");return t||65533}var yf="utf-8";function wf(e,t){if(!(this instanceof wf))return new wf(e,t);if(e=e!==void 0?String(e).toLowerCase():yf,e!==yf)throw new Error("Encoding not supported. Only utf-8 is supported");t=pf(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})}wf.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=pf(r),this._streaming||(this._decoder=new bS({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new Wl(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),mS(s)}};function mf(e,t){if(!(this instanceof mf))return new mf(e,t);if(e=e!==void 0?String(e).toLowerCase():yf,e!==yf)throw new Error("Encoding not supported. Only utf-8 is supported");t=pf(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}mf.prototype={encode:function(t,r){t=t?String(t):"",r=pf(r),this._streaming||(this._encoder=new vS(this._options)),this._streaming=!!r.stream;for(var n=[],i=new Wl(wS(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 bS(e){var t=e.fatal,r=0,n=0,i=0,s=128,o=191;this.handler=function(a,c){if(c===gf&&i!==0)return i=0,Kl(t);if(c===gf)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 Kl(t);return r=r<<6*i,null}if(!$i(c,s,o))return r=i=n=0,s=128,o=191,a.prepend(c),Kl(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===gf)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 _S=Object.freeze({__proto__:null,TextEncoder:mf,TextDecoder:wf}),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},xg=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zr,"__esModule",{value:!0});var Sg=Zr.deserializeUnchecked=kg=Zr.deserialize=Tg=Zr.serialize=Zr.BinaryReader=Zr.BinaryWriter=Zr.BorshError=Zr.baseDecode=Zr.baseEncode=void 0;const is=xg(ql.exports),Ag=xg(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")),Ag.default.encode(ie.Buffer.from(e))}Zr.baseEncode=TS;function kS(e){return ie.Buffer.from(Ag.default.decode(e))}Zr.baseDecode=kS;const Zl=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 Bg{constructor(){this.buf=ie.Buffer.alloc(Zl),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=ie.Buffer.concat([this.buf,ie.Buffer.alloc(Zl)]))}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(Zl)]),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=Bg;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 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{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 Rg(e,r,i)}catch(s){throw s instanceof ln&&s.addToFieldPath(t),s}}function Rg(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 LS(e,t,r,n=Bn){const i=new n(r),s=Gl(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 Xl(e,t){return t.property?e+"["+t.property+"]":e}ne.nameWithProperty=Xl;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 Cg 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=Cg;class Jl 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=Jl;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=Dg;class Hg 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=Hg;class eh{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=eh;class _f extends eh{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=_f;class th extends qt{constructor(t,r,n){let i;if(t instanceof Hn||t instanceof ni)i=new _f(new Jl(t));else if(t instanceof wn&&t.isCount())i=new _f(t);else if(t instanceof eh)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 jg(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=th;class jg extends qt{constructor(t,r,n,i){if(!(t instanceof th))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=jg;function $o(e){return 0>e&&(e+=4294967296),e}class rh 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(Xl("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(Xl("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=qg;class Vg 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=Vg;class Wg 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=Wg;class Kg 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=Kg,ne.greedy=(e,t)=>new Cg(e,t);var Zs=ne.offset=(e,t,r)=>new Jl(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 Lg(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 $g(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 Og(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 Mg(e),ne.f32=e=>new Ng(e),ne.f32be=e=>new Pg(e),ne.f64=e=>new Ug(e),ne.f64be=e=>new Fg(e);var Fe=ne.struct=(e,t,r)=>new Hg(e,t,r);ne.bits=(e,t,r)=>new rh(e,t,r);var en=ne.seq=(e,t,r)=>new Dg(e,t,r);ne.union=(e,t,r)=>new th(e,t,r),ne.unionLayoutDiscriminator=(e,t)=>new _f(e,t);var nr=ne.blob=(e,t)=>new qg(e,t);ne.cstr=e=>new Vg(e),ne.utf8=(e,t)=>new Wg(e,t),ne.constant=(e,t)=>new Kg(e,t);var Na={};Object.defineProperty(Na,"__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=Na.toBigIntLE=MS;function PS(e){{const t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}Na.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=Na.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")}}Na.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 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 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*Zg(e,t,r,n){jS(e)||(e=[e]);for(const i of e){const s=qS(i,t,r,n);s&&(yield s)}}function*ih(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=ih(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 VS(t,this)}create(t){return Be(t,this)}is(t){return Gg(t,this)}mask(t){return WS(t,this)}validate(t,r={}){return Pa(t,this,r)}}function VS(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 WS(e,t){const r=Pa(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}function Gg(e,t){return!Pa(e,t)[0]}function Pa(e,t,r={}){const n=ih(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 Gs(e,t){return new mi({type:e,schema:null,validator:t})}function KS(){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 sh(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 ZS(){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 Yg(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 oh(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]=ih(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)=>Gg(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}var Ef,GS=new Uint8Array(16);function Xg(){if(!Ef&&(Ef=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ef))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ef(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 xf(e){return typeof e=="string"&&YS.test(e)}for(var Yr=[],ah=0;ah<256;++ah)Yr.push((ah+256).toString(16).substr(1));function Sf(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(!xf(r))throw TypeError("Stringified UUID is invalid");return r}var Jg,ch,fh=0,uh=0;function XS(e,t,r){var n=t&&r||0,i=t||new Array(16);e=e||{};var s=e.node||Jg,o=e.clockseq!==void 0?e.clockseq:ch;if(s==null||o==null){var a=e.random||(e.rng||Xg)();s==null&&(s=Jg=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=ch=(a[6]<<8|a[7])&16383)}var c=e.msecs!==void 0?e.msecs:Date.now(),u=e.nsecs!==void 0?e.nsecs:uh+1,l=c-fh+(u-uh)/1e4;if(l<0&&e.clockseq===void 0&&(o=o+1&16383),(l<0||c>fh)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");fh=c,uh=u,ch=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||Sf(i)}function Qg(e){if(!xf(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 t1(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 Af(e,t,r,n,i,s){return os(s3(os(os(t,e),os(n,s)),i),r)}function tn(e,t,r,n,i,s,o){return Af(t&r|~t&n,e,t,i,s,o)}function rn(e,t,r,n,i,s,o){return Af(t&n|r&~n,e,t,i,s,o)}function nn(e,t,r,n,i,s,o){return Af(t^r^n,e,t,i,s,o)}function sn(e,t,r,n,i,s,o){return Af(r^(t|~n),e,t,i,s,o)}var o3=e1("v3",48,t3),a3=o3;function c3(e,t,r){e=e||{};var n=e.random||(e.rng||Xg)();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 Sf(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 lh(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=lh(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=e1("v5",80,u3),h3=l3,d3="00000000-0000-0000-0000-000000000000";function p3(e){if(!xf(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:xf,stringify:Sf,parse:Qg}),r1=Un(g3);const y3=r1.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=r1.v4,b3=w3,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 m3()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=e};var v3=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=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},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 n1={},hh={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=n1.default=B3,i1={};Object.defineProperty(i1,"__esModule",{value:!0});const R3=hh.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=i1.default=k3;const L3=[],$3=BigInt(0),Ha=BigInt(1),O3=BigInt(2),M3=BigInt(7),N3=BigInt(256),P3=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<>M3)*P3)%N3,t&O3&&(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 s1=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 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,s1),{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,s1);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=yg(y,t.endo?Math.ceil(A/2):A);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function j3(e){const t=Fl(e);return To(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 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=gg(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=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=Ol(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 fg(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 o1 extends Qp{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,ax(t);const n=Cl(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 o1(e,t).update(r).digest();a1.create=(e,t)=>new o1(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function q3(e){return{hash:e,hmac:(t,...r)=>a1(e,t,Jp(...r)),randomBytes:tg}}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 c1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),f1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),W3=BigInt(1),dh=BigInt(2),u1=(e,t)=>(e+t/dh)/t;function K3(e){const t=c1,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,dh,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,dh,t);if(!ph.eql(ph.sqr(G),e))throw new Error("Cannot find square root");return G}const ph=dg(c1,void 0,void 0,{sqrt:K3}),gh=V3({a:BigInt(0),b:BigInt(7),Fp:ph,n:f1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=f1,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-W3*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=u1(s*e,t),c=u1(-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}}}},Vl);BigInt(0),gh.ProjectivePoint,lf.utils.randomPrivateKey;function l1(e){try{return lf.ExtendedPoint.fromHex(e),!0}catch{return!1}}const h1=(e,t)=>lf.sign(e,t.slice(0,32)),Z3=lf.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 G3{constructor(t){Object.assign(this,t)}encode(){return ie.Buffer.from(Tg(Bf,this))}static decode(t){return kg(Bf,this,t)}static decodeUnchecked(t){return Sg(Bf,this,t)}}const Bf=new Map;var d1;const Y3=32,as=32;function X3(e){return e._bn!==void 0}let p1=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!=as)throw new Error("Invalid public key input");this._bn=new Eg(r)}else this._bn=new Eg(t);if(this._bn.byteLength()>as)throw new Error("Invalid public key input")}}static unique(){const t=new et(p1);return p1+=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=Vl(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,Mo(s)])}),n=ie.Buffer.concat([n,r.toBuffer(),ie.Buffer.from("ProgramDerivedAddress")]);const i=Vl(n);if(l1(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 l1(r.toBytes())}}d1=et,et.default=new d1("11111111111111111111111111111111"),Bf.set(et,{kind:"struct",fields:[["_bn","u256"]]}),new et("BPFLoader1111111111111111111111111111111111");const No=1280-40-8,yh=127,If=64;class g1 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(g1.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class y1 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(y1.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 Rf{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),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},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"),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 Tf{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 Tf(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 w1="Reached end of buffer unexpectedly";function Mi(e){if(e.length===0)throw new Error(w1);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(w1);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 Rf(this.staticAccountKeys)}static compile(t){const r=Tf.compile(t.instructions,t.payerKey),[n,i]=r.getMessageComponents(),o=new Rf(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&yh))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 Rf(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&yh;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=m1.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 nA=ie.Buffer.alloc(If).fill(0);class b1{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 b1(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=h1(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):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=Rl,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,Pp=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 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 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 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 rf(r),this.on(t,jp(this,t,r)),this},Zt.prototype.prependOnceListener=function(t,r){return rf(r),this.prependListener(t,jp(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():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?tf(this._events):[]};function Vp(e,t){for(var r=new Array(t),n=0;nt 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)&&Zp(e,r,t[r]);if(Kp)for(var r of Kp(t))JE.call(t,r)&&Zp(e,r,t[r]);return e},ex=(e,t)=>GE(e,YE(t));class tx 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(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 nf{constructor(){super($a.PROMISES)}request(t,r){return super.request(t,r)}}class sf 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 nx{constructor(t){const r=t.strategy===$a.CALLBACK?new tx:new rx;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 Gp(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function ix(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function of(e,...t){if(!ix(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 sx(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Gp(e.outputLen),Gp(e.blockLen)}function af(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 ox(e,t){of(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 Yp(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Cl(e){return typeof e=="string"&&(e=Yp(e)),of(e),e}function Xp(...e){let t=0;for(let n=0;ne().update(Cl(n)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function eg(e=32){if(Tl&&typeof Tl.getRandomValues=="function")return Tl.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function ax(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 cx=(e,t,r)=>e&t^~e&r,fx=(e,t,r)=>e&t^e&r^t&r;class tg extends Jp{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=kl(this.buffer)}update(t){af(this);const{view:r,buffer:n,blockLen:i}=this;t=Cl(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>Ll&cf)}:{h:Number(e>>Ll&cf)|0,l:Number(e&cf)|0}}function ux(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0),hx=(e,t,r)=>e>>>r,dx=(e,t,r)=>e<<32-r|t>>>r,px=(e,t,r)=>e>>>r|t<<32-r,gx=(e,t,r)=>e<<32-r|t>>>r,yx=(e,t,r)=>e<<64-r|t>>>r-32,wx=(e,t,r)=>e>>>r-32|t<<64-r,mx=(e,t)=>t,bx=(e,t)=>e,vx=(e,t,r)=>e<>>32-r,_x=(e,t,r)=>t<>>32-r,Ex=(e,t,r)=>t<>>64-r,xx=(e,t,r)=>e<>>64-r;function Sx(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:rg,split:ux,toBig:lx,shrSH:hx,shrSL:dx,rotrSH:px,rotrSL:gx,rotrBH:yx,rotrBL:wx,rotr32H:mx,rotr32L:bx,rotlSH:vx,rotlSL:_x,rotlBH:Ex,rotlBL:xx,add:Sx,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)},[Ax,Bx]=(()=>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 Ix extends tg{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,Bx[N],ts[N]),ee=mt.add5H(z,H,$,G,Ax[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 ng=Qp(()=>new Ix);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ig=BigInt(0),ff=BigInt(1),Rx=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 Tx=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;iig;e>>=ff,t+=1);return t}function Ox(e,t){return e>>BigInt(t)&ff}function Mx(e,t,r){return e|(r?ff:ig)<(Rx<new Uint8Array(e),ag=e=>Uint8Array.from(e);function cg(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=Ml(e),i=Ml(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Ml())=>{i=a(ag([0]),y),n=a(),y.length!==0&&(i=a(ag([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 Nx={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=Nx[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 Px=Object.freeze({__proto__:null,isBytes:Ds,abytes:Oa,bytesToHex:Hs,numberToHexUnpadded:sg,hexToNumber:$l,hexToBytes:Bo,bytesToNumberBE:js,bytesToNumberLE:Io,numberToBytesBE:Ro,numberToBytesLE:Ma,numberToVarBytesBE:kx,ensureBytes:Cr,concatBytes:zs,equalBytes:Cx,utf8ToBytes:Lx,bitLen:$x,bitGet:Ox,bitSet:Mx,bitMask:Ol,createHmacDrbg:cg,validateObject:To});/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Fr=BigInt(0),hr=BigInt(1),qs=BigInt(2),Ux=BigInt(3),Nl=BigInt(4),fg=BigInt(5),ug=BigInt(8);BigInt(9),BigInt(16);function ir(e,t){const r=e%t;return r>=Fr?r:t+r}function Fx(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 Pl(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 Dx(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,zx=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function qx(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=zx.reduce((n,i)=>(n[i]="function",n),t);return To(e,r)}function Vx(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 Wx(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 lg(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}function hg(e,t,r=!1,n={}){if(e<=Fr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=lg(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=Hx(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:s,MASK:Ol(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)=>Vx(a,c,u),div:(c,u)=>ir(c*Pl(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>Pl(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>Wx(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 Kx(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 dg(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 pg(e){const t=dg(e);return t+Math.ceil(t/2)}function Zx(e,t,r=!1){const n=e.length,i=dg(t),s=pg(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 Gx=BigInt(0),Ul=BigInt(1);function gg(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>Gx;)s&Ul&&(o=o.add(a)),a=a.double(),s>>=Ul;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+=Ul);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 Fl(e){return qx(e.Fp),To(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...lg(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),uf=BigInt(2),Yx=BigInt(8),Xx={zip215:!0};function Jx(e){const t=Fl(e);return To(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}function Dl(e){const t=Jx(e),{Fp:r,n,prehash:i,hash:s,randomBytes:o,nByteLength:a,h:c}=t,u=uf<{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(uf*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*uf*ge),Tt=l(K*uf*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?Yx: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=gg(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=Xx;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 Hl=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),yg=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const Qx=BigInt(1),jl=BigInt(2),eS=BigInt(5),wg=BigInt(10),tS=BigInt(20),rS=BigInt(40),mg=BigInt(80);function nS(e){const t=Hl,n=e*e%t*e%t,i=wr(n,jl,t)*n%t,s=wr(i,Qx,t)*e%t,o=wr(s,eS,t)*s%t,a=wr(o,wg,t)*o%t,c=wr(a,tS,t)*a%t,u=wr(c,rS,t)*c%t,l=wr(u,mg,t)*u%t,y=wr(l,mg,t)*u%t,A=wr(y,wg,t)*o%t;return{pow_p_5_8:wr(A,jl,t)*e%t,b2:n}}function iS(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function sS(e,t){const r=Hl,n=ir(t*t*t,r),i=ir(n*n*t,r),s=nS(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*yg,r),l=a===e,y=a===ir(-e,r),A=a===ir(-e*yg,r);return l&&(o=c),(y||A)&&(o=u),jx(o,r)&&(o=ir(-o,r)),{isValid:l||y,value:o}}const Li=hg(Hl,void 0,!0),zl={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Li,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ng,randomBytes:eg,adjustScalarBytes:iS,uvRatio:sS},lf=Dl(zl);function bg(e,t,r){if(t.length>255)throw new Error("Context is too big");return Xp(Yp("SigEd25519 no Ed25519 collisions"),new Uint8Array([r?1:0,t.length]),t,e)}({...zl},{...zl});const oS=(Li.ORDER+BigInt(3))/BigInt(8);Li.pow(jl,oS),Li.sqrt(Li.neg(Li.ONE)),(Li.ORDER-BigInt(5))/BigInt(8),BigInt(486662),Kx(Li,Li.neg(BigInt(486664))),BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var ql={exports:{}},aS={},cS=Object.freeze({__proto__:null,default:aS}),vg=Un(cS);(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=vg.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,Bl=E[3]|0,zt=Bl&8191,Yt=Bl>>>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)})(ql);var _g=ql.exports,hf={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)}})(hf,hf.exports);var df=hf.exports.Buffer;function fS(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=df.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 uS=fS,lS=uS,hS="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Ar=lS(hS);const dS=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 pS extends tg{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+cx(a,c,u)+dS[y]+ns[y]|0,O=(gi(n,2)^gi(n,13)^gi(n,22))+fx(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 Vl=Qp(()=>new pS);var Zr={};function $i(e,t,r){return t<=e&&e<=r}function pf(e){if(e===void 0)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function gS(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 yS(e){for(var t="",r=0;r>10)+55296,(n&1023)+56320))}return t}var gf=-1;function Wl(e){this.tokens=[].slice.call(e)}Wl.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():gf},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 Kl(e,t){if(e)throw TypeError("Decoder error");return t||65533}var yf="utf-8";function wf(e,t){if(!(this instanceof wf))return new wf(e,t);if(e=e!==void 0?String(e).toLowerCase():yf,e!==yf)throw new Error("Encoding not supported. Only utf-8 is supported");t=pf(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})}wf.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=pf(r),this._streaming||(this._decoder=new wS({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!r.stream;for(var i=new Wl(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),yS(s)}};function mf(e,t){if(!(this instanceof mf))return new mf(e,t);if(e=e!==void 0?String(e).toLowerCase():yf,e!==yf)throw new Error("Encoding not supported. Only utf-8 is supported");t=pf(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}mf.prototype={encode:function(t,r){t=t?String(t):"",r=pf(r),this._streaming||(this._encoder=new mS(this._options)),this._streaming=!!r.stream;for(var n=[],i=new Wl(gS(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 wS(e){var t=e.fatal,r=0,n=0,i=0,s=128,o=191;this.handler=function(a,c){if(c===gf&&i!==0)return i=0,Kl(t);if(c===gf)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 Kl(t);return r=r<<6*i,null}if(!$i(c,s,o))return r=i=n=0,s=128,o=191,a.prepend(c),Kl(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 mS(e){e.fatal,this.handler=function(t,r){if(r===gf)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 bS=Object.freeze({__proto__:null,TextEncoder:mf,TextDecoder:wf}),vS=Un(bS),_S=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]}),ES=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},xS=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)&&_S(t,e,r);return ES(t,e),t},Eg=ft&&ft.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(Zr,"__esModule",{value:!0});var xg=Zr.deserializeUnchecked=Tg=Zr.deserialize=Rg=Zr.serialize=Zr.BinaryReader=Zr.BinaryWriter=Zr.BorshError=Zr.baseDecode=Zr.baseEncode=void 0;const is=Eg(ql.exports),Sg=Eg(Ar),SS=xS(vS),AS=typeof TextDecoder!="function"?SS.TextDecoder:TextDecoder,BS=new AS("utf-8",{fatal:!0});function IS(e){return typeof e=="string"&&(e=ie.Buffer.from(e,"utf8")),Sg.default.encode(ie.Buffer.from(e))}Zr.baseEncode=IS;function RS(e){return ie.Buffer.from(Sg.default.decode(e))}Zr.baseDecode=RS;const Zl=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 Ag{constructor(){this.buf=ie.Buffer.alloc(Zl),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=ie.Buffer.concat([this.buf,ie.Buffer.alloc(Zl)]))}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(Zl)]),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=Ag;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 BS.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 Ig(e,r,i)}catch(s){throw s instanceof ln&&s.addToFieldPath(t),s}}function Ig(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 kS(e,t,r,n=Bn){const i=new n(r),s=Gl(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 Xl(e,t){return t.property?e+"["+t.property+"]":e}ne.nameWithProperty=Xl;function LS(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=LS;class wn extends qt{isCount(){throw new Error("ExternalLayout is abstract")}}ne.ExternalLayout=wn;class kg 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=kg;class Jl 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=Jl;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=Fg;class Dg 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=Dg;class eh{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=eh;class _f extends eh{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=_f;class th extends qt{constructor(t,r,n){let i;if(t instanceof Hn||t instanceof ni)i=new _f(new Jl(t));else if(t instanceof wn&&t.isCount())i=new _f(t);else if(t instanceof eh)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 Hg(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=th;class Hg extends qt{constructor(t,r,n,i){if(!(t instanceof th))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=Hg;function $o(e){return 0>e&&(e+=4294967296),e}class rh 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(Xl("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(Xl("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=zg;class qg 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=qg;class Vg 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=Vg;class Wg 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=Wg,ne.greedy=(e,t)=>new kg(e,t);var Zs=ne.offset=(e,t,r)=>new Jl(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 Cg(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 Lg(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 $g(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 Og(e),ne.f32=e=>new Mg(e),ne.f32be=e=>new Ng(e),ne.f64=e=>new Pg(e),ne.f64be=e=>new Ug(e);var Fe=ne.struct=(e,t,r)=>new Dg(e,t,r);ne.bits=(e,t,r)=>new rh(e,t,r);var en=ne.seq=(e,t,r)=>new Fg(e,t,r);ne.union=(e,t,r)=>new th(e,t,r),ne.unionLayoutDiscriminator=(e,t)=>new _f(e,t);var nr=ne.blob=(e,t)=>new zg(e,t);ne.cstr=e=>new qg(e),ne.utf8=(e,t)=>new Vg(e,t),ne.constant=(e,t)=>new Wg(e,t);var Na={};Object.defineProperty(Na,"__esModule",{value:!0});function $S(e){{const t=ie.Buffer.from(e);t.reverse();const r=t.toString("hex");return r.length===0?BigInt(0):BigInt(`0x${r}`)}}var OS=Na.toBigIntLE=$S;function MS(e){{const t=e.toString("hex");return t.length===0?BigInt(0):BigInt(`0x${t}`)}}Na.toBigIntBE=MS;function NS(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 PS=Na.toBufferLE=NS;function US(e,t){{const r=e.toString(16);return ie.Buffer.from(r.padStart(t*2,"0").slice(0,t*2),"hex")}}Na.toBufferBE=US;class FS 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 DS(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 HS(e){const{done:t,value:r}=e.next();return t?void 0:r}function jS(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*Kg(e,t,r,n){DS(e)||(e=[e]);for(const i of e){const s=jS(i,t,r,n);s&&(yield s)}}function*ih(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=ih(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 Kg(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return Kg(l,u,this,c)}:this.refiner=()=>[]}assert(t){return zS(t,this)}create(t){return Be(t,this)}is(t){return Zg(t,this)}mask(t){return qS(t,this)}validate(t,r={}){return Pa(t,this,r)}}function zS(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 qS(e,t){const r=Pa(e,t,{coerce:!0,mask:!0});if(r[0])throw r[0];return r[1]}function Zg(e,t){return!Pa(e,t)[0]}function Pa(e,t,r={}){const n=ih(e,t,r),i=HS(n);return i[0]?[new FS(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 VS(){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 sh(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 WS(){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 Gg(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 oh(e){const t=WS();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]=ih(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)=>Zg(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}var Ef,KS=new Uint8Array(16);function Yg(){if(!Ef&&(Ef=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Ef))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Ef(KS)}var ZS=/^(?:[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 xf(e){return typeof e=="string"&&ZS.test(e)}for(var Yr=[],ah=0;ah<256;++ah)Yr.push((ah+256).toString(16).substr(1));function Sf(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(!xf(r))throw TypeError("Stringified UUID is invalid");return r}var Xg,ch,fh=0,uh=0;function GS(e,t,r){var n=t&&r||0,i=t||new Array(16);e=e||{};var s=e.node||Xg,o=e.clockseq!==void 0?e.clockseq:ch;if(s==null||o==null){var a=e.random||(e.rng||Yg)();s==null&&(s=Xg=[a[0]|1,a[1],a[2],a[3],a[4],a[5]]),o==null&&(o=ch=(a[6]<<8|a[7])&16383)}var c=e.msecs!==void 0?e.msecs:Date.now(),u=e.nsecs!==void 0?e.nsecs:uh+1,l=c-fh+(u-uh)/1e4;if(l<0&&e.clockseq===void 0&&(o=o+1&16383),(l<0||c>fh)&&e.nsecs===void 0&&(u=0),u>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");fh=c,uh=u,ch=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||Sf(i)}function Jg(e){if(!xf(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 YS(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 e1(e){return(e+64>>>9<<4)+14+1}function t3(e,t){e[t>>5]|=128<>5]|=(e[n/8]&255)<>16)+(t>>16)+(r>>16);return n<<16|r&65535}function n3(e,t){return e<>>32-t}function Af(e,t,r,n,i,s){return os(n3(os(os(t,e),os(n,s)),i),r)}function tn(e,t,r,n,i,s,o){return Af(t&r|~t&n,e,t,i,s,o)}function rn(e,t,r,n,i,s,o){return Af(t&n|r&~n,e,t,i,s,o)}function nn(e,t,r,n,i,s,o){return Af(t^r^n,e,t,i,s,o)}function sn(e,t,r,n,i,s,o){return Af(r^(t|~n),e,t,i,s,o)}var i3=Qg("v3",48,QS),s3=i3;function o3(e,t,r){e=e||{};var n=e.random||(e.rng||Yg)();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 Sf(n)}function a3(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 lh(e,t){return e<>>32-t}function c3(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=lh(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 f3=Qg("v5",80,c3),u3=f3,l3="00000000-0000-0000-0000-000000000000";function h3(e){if(!xf(e))throw TypeError("Invalid UUID");return parseInt(e.substr(14,1),16)}var d3=Object.freeze({__proto__:null,v1:GS,v3:s3,v4:o3,v5:u3,NIL:l3,version:h3,validate:xf,stringify:Sf,parse:Jg}),t1=Un(d3);const p3=t1.v4;var g3=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 p3()};s.id=o(s,n)}else i===2&&r===null?n.notificationIdNull&&(s.id=null):s.id=r;return s};const y3=t1.v4,w3=g3,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 y3()},version:typeof t.version<"u"?t.version:2,notificationIdNull:typeof t.notificationIdNull=="boolean"?t.notificationIdNull:!1},this.callServer=e};var m3=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=w3(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 r1={},hh={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 x3.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 A3=r1.default=S3,n1={};Object.defineProperty(n1,"__esModule",{value:!0});const B3=hh.exports;class I3 extends B3.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 R3(e,t){return new I3(e,t)}var T3=n1.default=R3;const k3=[],C3=BigInt(0),Ha=BigInt(1),L3=BigInt(2),$3=BigInt(7),O3=BigInt(256),M3=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=C3;for(let s=0;s<7;s++)t=(t<>$3)*M3)%O3,t&L3&&(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 i1=BigInt(3);BigInt(4);function F3(e){const t=N3(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,i1),{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,i1);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=gg(y,t.endo?Math.ceil(A/2):A);return{CURVE:t,ProjectivePoint:y,normPrivateKeyToScalar:c,weierstrassEquation:s,isWithinCurveOrder:o}}function D3(e){const t=Fl(e);return To(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function H3(e){const t=D3(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=pg(t.n);return Zx(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=Ol(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 cg(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 s1 extends Jp{constructor(t,r){super(),this.finished=!1,this.destroyed=!1,sx(t);const n=Cl(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 s1(e,t).update(r).digest();o1.create=(e,t)=>new s1(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function j3(e){return{hash:e,hmac:(t,...r)=>o1(e,t,Xp(...r)),randomBytes:eg}}function z3(e,t){const r=n=>H3({...e,...j3(n)});return Object.freeze({...r(t),create:r})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const a1=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),c1=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),q3=BigInt(1),dh=BigInt(2),f1=(e,t)=>(e+t/dh)/t;function V3(e){const t=a1,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,dh,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,dh,t);if(!ph.eql(ph.sqr(G),e))throw new Error("Cannot find square root");return G}const ph=hg(a1,void 0,void 0,{sqrt:V3}),gh=z3({a:BigInt(0),b:BigInt(7),Fp:ph,n:c1,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=c1,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-q3*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=r,o=BigInt("0x100000000000000000000000000000000"),a=f1(s*e,t),c=f1(-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}}}},Vl);BigInt(0),gh.ProjectivePoint,lf.utils.randomPrivateKey;function u1(e){try{return lf.ExtendedPoint.fromHex(e),!0}catch{return!1}}const l1=(e,t)=>lf.sign(e,t.slice(0,32)),W3=lf.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 K3{constructor(t){Object.assign(this,t)}encode(){return ie.Buffer.from(Rg(Bf,this))}static decode(t){return Tg(Bf,this,t)}static decodeUnchecked(t){return xg(Bf,this,t)}}const Bf=new Map;var h1;const Z3=32,as=32;function G3(e){return e._bn!==void 0}let d1=1;class et extends K3{constructor(t){if(super({}),this._bn=void 0,G3(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 _g(r)}else this._bn=new _g(t);if(this._bn.byteLength()>as)throw new Error("Invalid public key input")}}static unique(){const t=new et(d1);return d1+=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=Vl(i);return new et(s)}static createProgramAddressSync(t,r){let n=ie.Buffer.alloc(0);t.forEach(function(s){if(s.length>Z3)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=Vl(n);if(u1(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 u1(r.toBytes())}}h1=et,et.default=new h1("11111111111111111111111111111111"),Bf.set(et,{kind:"struct",fields:[["_bn","u256"]]}),new et("BPFLoader1111111111111111111111111111111111");const No=1280-40-8,yh=127,If=64;class p1 extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(p1.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class g1 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(g1.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 Rf{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),Y3=(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},X3=(e="authorized")=>Fe([St("staker"),St("withdrawer")],e),J3=(e="lockup")=>Fe([In("unixTimestamp"),In("epoch"),St("custodian")],e),Q3=(e="voteInit")=>Fe([St("nodePubkey"),St("authorizedVoter"),St("authorizedWithdrawer"),Ut("commission")],e),eA=(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 Tf{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 Tf(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 y1="Reached end of buffer unexpectedly";function Mi(e){if(e.length===0)throw new Error(y1);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(y1);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 Rf(this.staticAccountKeys)}static compile(t){const r=Tf.compile(t.instructions,t.payerKey),[n,i]=r.getMessageComponents(),o=new Rf(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&yh))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 Rf(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&yh;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=w1.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 tA=ie.Buffer.alloc(If).fill(0);class m1{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 m1(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=l1(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):W3(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<=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(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 b1({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]=h1(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 Uo(e){return new Promise(t=>setTimeout(t,e))}const sA=Gr("lamportsPerSignature"),v1=Fe([qe("version"),qe("state"),St("authorizedPubkey"),St("nonce"),Fe([sA],"feeCalculator")]);v1.span;class wh{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=v1.decode(Mo(t),0);return new wh({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}},Fo=(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"),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 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 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=cA.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=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 x1=56;class S1{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-x1;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(x1));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"),Fo("deactivationSlot"),Gr("lastExtendedSlot"),Ut("lastExtendedStartIndex"),Ut(),en(St(),Zs(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=Fa(sh(et),Se(),e=>new et(e)),A1=oh([Se(),dr("base64")]),bh=Fa(sh(ie.Buffer),A1,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 B1(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(KS())})})])}const _A=B1(Ua());function bt(e){return Fa(B1(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 kf(e){return me({context:me({slot:te()}),value:e})}function vh(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 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=Yg(Se(),Ce(te())),Xs=Te(mn([me({}),Se()])),TA=me({err:Xs}),kA=dr("receivedSignature"),CA=me({"solana-core":Se(),"feature-set":Qe(te())}),I1=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:oh([Se(),dr("base64")])})))})),LA=mr(me({byIdentity:Yg(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 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 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)})),_h=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:bh,rentEpoch:te()})}))),Eh=me({program:Se(),parsed:Ua(),space:te()}),WA=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:Eh,rentEpoch:te()})}))),KA=mr(Ce(me({lamports:te(),address:kr}))),Ka=me({executable:bi(),owner:kr,lamports:te(),data:bh,rentEpoch:te()}),ZA=me({pubkey:kr,account:Ka}),GA=Fa(mn([sh(ie.Buffer),Eh]),mn([A1,Eh]),e=>Array.isArray(e)?Be(e,bh):e),xh=me({executable:bi(),owner:kr,lamports:te(),data:GA,rentEpoch:te()}),YA=me({pubkey:kr,account:xh}),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:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),QA=bt(Ce(me({signature:Se(),slot:te(),err:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),e6=me({subscription:te(),result:kf(Ka)}),t6=me({pubkey:kr,account:Ka}),r6=me({subscription:te(),result:kf(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:kf(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())}),R1=me({votePubkey:Se(),nodePubkey:Se(),activatedStake:te(),epochVoteAccount:bi(),epochCredits:Ce(oh([te(),te(),te()])),commission:te(),lastVote:te(),rootSlot:Te(te())}),u6=bt(me({current:Ce(R1),delinquent:Ce(R1)})),l6=mn([dr("processed"),dr("confirmed"),dr("finalized")]),h6=me({slot:te(),confirmations:Te(te()),err:Xs,confirmationStatus:Qe(l6)}),d6=mr(Ce(Te(h6))),p6=bt(te()),T1=me({accountKey:kr,writableIndexes:Ce(te()),readonlyIndexes:Ce(te())}),Sh=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(T1))})}),k1=me({pubkey:kr,signer:bi(),writable:bi(),source:Qe(mn([dr("transaction"),dr("lookupTable")]))}),C1=me({accountKeys:Ce(k1),signatures:Ce(Se())}),L1=me({parsed:Ua(),program:Se(),programId:kr}),$1=me({accounts:Ce(kr),data:Se(),programId:kr}),g6=mn([$1,L1]),y6=mn([me({parsed:Ua(),program:Se(),programId:Se()}),me({accounts:Ce(Se()),data:Se(),programId:Se()})]),O1=Fa(g6,y6,e=>"accounts"in e?Be(e,$1):Be(e,L1)),M1=me({signatures:Ce(Se()),message:me({accountKeys:Ce(k1),instructions:Ce(O1),recentBlockhash:Se(),addressTableLookups:Qe(Te(Ce(T1)))})}),Cf=me({accountIndex:te(),mint:Se(),owner:Qe(Se()),uiTokenAmount:_h}),N1=me({writable:Ce(kr),readonly:Ce(kr)}),Lf=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(Cf))),postTokenBalances:Qe(Te(Ce(Cf))),loadedAddresses:Qe(N1),computeUnitsConsumed:Qe(te())}),Ah=me({err:Xs,fee:te(),innerInstructions:Qe(Te(Ce(me({index:te(),instructions:Ce(O1)})))),preBalances:Ce(te()),postBalances:Ce(te()),logMessages:Qe(Te(Ce(Se()))),preTokenBalances:Qe(Te(Ce(Cf))),postTokenBalances:Qe(Te(Ce(Cf))),loadedAddresses:Qe(N1),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()))}),w6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Sh,meta:Te(Lf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),m6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),b6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:C1,meta:Te(Lf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),v6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:M1,meta:Te(Ah),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),_6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:C1,meta:Te(Ah),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),E6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),x6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Sh,meta:Te(Lf)})),rewards:Qe(Ce(Js)),blockTime:Te(te())}))),P1=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),signatures:Ce(Se()),blockTime:Te(te())}))),Bh=bt(Te(me({slot:te(),meta:Te(Lf),blockTime:Qe(Te(te())),transaction:Sh,version:Qe(Do)}))),$f=bt(Te(me({slot:te(),transaction:M1,meta:Te(Ah),blockTime:Qe(Te(te())),version:Qe(Do)}))),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:Xs,logs:Ce(Se()),signature:Se()}),$6=me({result:kf(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=_1(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(_h));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(_h));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(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(xh)));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(xh))));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(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: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 g1(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 y1(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=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,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:vh(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,Bh);if("error"in a)throw new je(a.error,"failed to get transaction");const c=a.result;return c&&{...c,transaction:{...c.transaction,message:vh(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,$f);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,$f);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,Bh);if("error"in u)throw new je(u.error,"failed to get transactions");const l=u.result;return l&&{...l,transaction:{...l.transaction,message:vh(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 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,P1);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,P1);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,Bh);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,$f);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,$f);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 S1({key:t,state:S1.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=wh.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 Uo(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 Uo(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,I1);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,I1);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 E1("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,C6);if("error"in c){let u;throw"data"in c.error&&(u=c.error.data.logs),new E1("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=_1([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"),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"),gh.utils.isValidPrivateKey,gh.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 U1;new et("StakeConfig11111111111111111111111111111111");class F1{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}}U1=F1,F1.default=new U1(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"),Po("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")]),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 D1="solana:signAndSendTransaction",N6="solana:signIn",H1="solana:signMessage",j1="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),Of;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(tA)?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 m1({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]=l1(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 rA=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 nA=Gr("lamportsPerSignature"),b1=Fe([qe("version"),qe("state"),St("authorizedPubkey"),St("nonce"),Fe([nA],"feeCalculator")]);b1.span;class wh{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=b1.decode(Mo(t),0);return new wh({authorizedPubkey:new et(r.authorizedPubkey),nonce:new et(r.nonce).toString(),feeCalculator:r.feeCalculator})}}const iA=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}=iA(r),s=r;return s.decode=(o,a)=>{const c=i(o,a);return OS(ie.Buffer.from(c))},s.encode=(o,a,c)=>{const u=PS(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 sA(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var oA=Object.prototype.toString,aA=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=oA.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=aA(e).sort(),n=s.length,i="",r=0;r1;)e/=2,t++;return t}function fA(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 uA{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=T3(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 dA(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 E1=56;class x1{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=dA(pA,t),n=t.length-E1;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(E1));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 pA={index:1,layout:Fe([qe("typeIndex"),Fo("deactivationSlot"),Gr("lastExtendedSlot"),Ut("lastExtendedStartIndex"),Ut(),en(St(),Zs(Ut(),-1),"authority")])},gA=/^[^:]+:\/\/([^:[]+|\[[^\]]+\])(:\d+)?(.*)/i;function yA(e){const t=e.match(gA);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(sh(et),Se(),e=>new et(e)),S1=oh([Se(),dr("base64")]),bh=Fa(sh(ie.Buffer),S1,e=>ie.Buffer.from(e[0],"base64")),wA=30*1e3;function mA(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 A1(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(VS())})})])}const bA=A1(Ua());function bt(e){return Fa(A1(e),bA,t=>"error"in t?t:{...t,result:Be(t.result,e)})}function mr(e){return bt(me({context:me({slot:te()}),value:e}))}function kf(e){return me({context:me({slot:te()}),value:e})}function vh(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 vA=me({foundation:te(),foundationTerm:te(),initial:te(),taper:te(),terminal:te()}),_A=bt(Ce(Te(me({epoch:te(),effectiveSlot:te(),amount:te(),postBalance:te(),commission:Qe(Te(te()))})))),EA=Ce(me({slot:te(),prioritizationFee:te()})),xA=me({total:te(),validator:te(),foundation:te(),epoch:te()}),SA=me({epoch:te(),slotIndex:te(),slotsInEpoch:te(),absoluteSlot:te(),blockHeight:Qe(te()),transactionCount:Qe(te())}),AA=me({slotsPerEpoch:te(),leaderScheduleSlotOffset:te(),warmup:bi(),firstNormalEpoch:te(),firstNormalSlot:te()}),BA=Gg(Se(),Ce(te())),Xs=Te(mn([me({}),Se()])),IA=me({err:Xs}),RA=dr("receivedSignature"),TA=me({"solana-core":Se(),"feature-set":Qe(te())}),B1=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:oh([Se(),dr("base64")])})))})),kA=mr(me({byIdentity:Gg(Se(),Ce(te())),range:me({firstSlot:te(),lastSlot:te()})}));function CA(e,t,r,n,i,s){const o=r||lA;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 m3(async(l,y)=>{const A={method:"POST",body:l,agent:a,headers:Object.assign({"Content-Type":"application/json"},t||{},L6)};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 LA(e){return(t,r)=>new Promise((n,i)=>{e.request(t,r,(s,o)=>{if(s){i(s);return}n(o)})})}function $A(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 OA=bt(vA),MA=bt(xA),NA=bt(EA),PA=bt(SA),UA=bt(AA),FA=bt(BA),DA=bt(te()),HA=mr(me({total:te(),circulating:te(),nonCirculating:te(),nonCirculatingAccounts:Ce(kr)})),_h=me({amount:Se(),uiAmount:Te(te()),decimals:te(),uiAmountString:Qe(Se())}),jA=mr(Ce(me({address:kr,amount:Se(),uiAmount:Te(te()),decimals:te(),uiAmountString:Qe(Se())}))),zA=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:bh,rentEpoch:te()})}))),Eh=me({program:Se(),parsed:Ua(),space:te()}),qA=mr(Ce(me({pubkey:kr,account:me({executable:bi(),owner:kr,lamports:te(),data:Eh,rentEpoch:te()})}))),VA=mr(Ce(me({lamports:te(),address:kr}))),Ka=me({executable:bi(),owner:kr,lamports:te(),data:bh,rentEpoch:te()}),WA=me({pubkey:kr,account:Ka}),KA=Fa(mn([sh(ie.Buffer),Eh]),mn([S1,Eh]),e=>Array.isArray(e)?Be(e,bh):e),xh=me({executable:bi(),owner:kr,lamports:te(),data:KA,rentEpoch:te()}),ZA=me({pubkey:kr,account:xh}),GA=me({state:mn([dr("active"),dr("inactive"),dr("activating"),dr("deactivating")]),active:te(),inactive:te()}),YA=bt(Ce(me({signature:Se(),slot:te(),err:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),XA=bt(Ce(me({signature:Se(),slot:te(),err:Xs,memo:Te(Se()),blockTime:Qe(Te(te()))}))),JA=me({subscription:te(),result:kf(Ka)}),QA=me({pubkey:kr,account:Ka}),e6=me({subscription:te(),result:kf(QA)}),t6=me({parent:te(),slot:te(),root:te()}),r6=me({subscription:te(),result:t6}),n6=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()})]),i6=me({subscription:te(),result:n6}),s6=me({subscription:te(),result:kf(mn([IA,RA]))}),o6=me({subscription:te(),result:te()}),a6=me({pubkey:Se(),gossip:Te(Se()),tpu:Te(Se()),rpc:Te(Se()),version:Te(Se())}),I1=me({votePubkey:Se(),nodePubkey:Se(),activatedStake:te(),epochVoteAccount:bi(),epochCredits:Ce(oh([te(),te(),te()])),commission:te(),lastVote:te(),rootSlot:Te(te())}),c6=bt(me({current:Ce(I1),delinquent:Ce(I1)})),f6=mn([dr("processed"),dr("confirmed"),dr("finalized")]),u6=me({slot:te(),confirmations:Te(te()),err:Xs,confirmationStatus:Qe(f6)}),l6=mr(Ce(Te(u6))),h6=bt(te()),R1=me({accountKey:kr,writableIndexes:Ce(te()),readonlyIndexes:Ce(te())}),Sh=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(R1))})}),T1=me({pubkey:kr,signer:bi(),writable:bi(),source:Qe(mn([dr("transaction"),dr("lookupTable")]))}),k1=me({accountKeys:Ce(T1),signatures:Ce(Se())}),C1=me({parsed:Ua(),program:Se(),programId:kr}),L1=me({accounts:Ce(kr),data:Se(),programId:kr}),d6=mn([L1,C1]),p6=mn([me({parsed:Ua(),program:Se(),programId:Se()}),me({accounts:Ce(Se()),data:Se(),programId:Se()})]),$1=Fa(d6,p6,e=>"accounts"in e?Be(e,L1):Be(e,C1)),O1=me({signatures:Ce(Se()),message:me({accountKeys:Ce(T1),instructions:Ce($1),recentBlockhash:Se(),addressTableLookups:Qe(Te(Ce(R1)))})}),Cf=me({accountIndex:te(),mint:Se(),owner:Qe(Se()),uiTokenAmount:_h}),M1=me({writable:Ce(kr),readonly:Ce(kr)}),Lf=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(Cf))),postTokenBalances:Qe(Te(Ce(Cf))),loadedAddresses:Qe(M1),computeUnitsConsumed:Qe(te())}),Ah=me({err:Xs,fee:te(),innerInstructions:Qe(Te(Ce(me({index:te(),instructions:Ce($1)})))),preBalances:Ce(te()),postBalances:Ce(te()),logMessages:Qe(Te(Ce(Se()))),preTokenBalances:Qe(Te(Ce(Cf))),postTokenBalances:Qe(Te(Ce(Cf))),loadedAddresses:Qe(M1),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()))}),g6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Sh,meta:Te(Lf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),y6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),w6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:k1,meta:Te(Lf),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),m6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:O1,meta:Te(Ah),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),b6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:k1,meta:Te(Ah),version:Qe(Do)})),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),v6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),rewards:Qe(Ce(Js)),blockTime:Te(te()),blockHeight:Te(te())}))),_6=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),transactions:Ce(me({transaction:Sh,meta:Te(Lf)})),rewards:Qe(Ce(Js)),blockTime:Te(te())}))),N1=bt(Te(me({blockhash:Se(),previousBlockhash:Se(),parentSlot:te(),signatures:Ce(Se()),blockTime:Te(te())}))),Bh=bt(Te(me({slot:te(),meta:Te(Lf),blockTime:Qe(Te(te())),transaction:Sh,version:Qe(Do)}))),$f=bt(Te(me({slot:te(),transaction:O1,meta:Te(Ah),blockTime:Qe(Te(te())),version:Qe(Do)}))),E6=mr(me({blockhash:Se(),feeCalculator:me({lamportsPerSignature:te()})})),x6=mr(me({blockhash:Se(),lastValidBlockHeight:te()})),S6=mr(bi()),A6=me({slot:te(),numTransactions:te(),numSlots:te(),samplePeriodSecs:te()}),B6=bt(Ce(A6)),I6=mr(Te(me({feeCalculator:me({lamportsPerSignature:te()})}))),R6=bt(Se()),T6=bt(Se()),k6=me({err:Xs,logs:Ce(Se()),signature:Se()}),C6=me({result:kf(k6),subscription:te()}),L6={"solana-client":"js/0.0.0-development"};class $6{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=v1(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=mA(t),this._rpcWsEndpoint=n||yA(t),this._rpcClient=CA(t,i,s,o,a,c),this._rpcRequest=LA(this._rpcClient),this._rpcBatchRequest=$A(this._rpcClient),this._rpcWebSocket=new hA(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,DA);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,HA);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(_h));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(_h));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,zA);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,qA);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,VA);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,jA);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(xh)));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(xh))));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(GA));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(WA),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(ZA)));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 p1(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 g1(r,c.timeoutMs/1e3)}finally{clearTimeout(n),s()}return a}async getClusterNodes(){const t=await this._rpcRequest("getClusterNodes",[]),r=Be(t,bt(Ce(a6)));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,c6);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,l6);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,OA);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,_A);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,MA);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,PA);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,UA);if("error"in r)throw new je(r.error,"failed to get epoch schedule");const n=r.result;return new uA(n.slotsPerEpoch,n.leaderScheduleSlotOffset,n.warmup,n.firstNormalEpoch,n.firstNormalSlot)}async getLeaderSchedule(){const t=await this._rpcRequest("getLeaderSchedule",[]),r=Be(t,FA);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,h6);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,E6);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,B6);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,I6);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,NA);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,x6);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,S6);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(TA));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,w6);if("error"in a)throw a.error;return a.result}case"none":{const a=Be(o,y6);if("error"in a)throw a.error;return a.result}default:{const a=Be(o,g6);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:vh(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,b6);if("error"in a)throw a.error;return a.result}case"none":{const a=Be(o,v6);if("error"in a)throw a.error;return a.result}default:{const a=Be(o,m6);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,kA);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,Bh);if("error"in a)throw new je(a.error,"failed to get transaction");const c=a.result;return c&&{...c,transaction:{...c.transaction,message:vh(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,$f);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,$f);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,Bh);if("error"in u)throw new je(u.error,"failed to get transactions");const l=u.result;return l&&{...l,transaction:{...l.transaction,message:vh(l.version,l.transaction.message)}}})}async getConfirmedBlock(t,r){const n=this._buildArgsAtLeastConfirmed([t],r),i=await this._rpcRequest("getConfirmedBlock",n),s=Be(i,_6);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,N1);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,N1);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,Bh);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,$f);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,$f);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,YA);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,XA);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 x1({key:t,state:x1.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=wh.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,R6);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>=wA;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(rA/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,B1);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,B1);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 _1("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,T6);if("error"in c){let u;throw"data"in c.error&&(u=c.error.data.logs),new _1("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=v1([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,e6);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,C6);this._handleServerNotification(n,[r.value,r.context])}_wsOnSlotNotification(t){const{result:r,subscription:n}=Be(t,r6);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,i6);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,s6);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,o6);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"),gh.utils.isValidPrivateKey,gh.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 P1;new et("StakeConfig11111111111111111111111111111111");class U1{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}}P1=U1,U1.default=new P1(0,0,et.default),Object.freeze({Initialize:{index:0,layout:Fe([qe("instruction"),X3(),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"),Q3()])},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"),eA()])}}),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 F1="solana:signAndSendTransaction",O6="solana:signIn",D1="solana:signMessage",H1="solana:signTransaction",M6="standard:connect",N6="standard:disconnect",P6="standard:events";var j1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},U6=(e,t,r)=>(j1(e,t,"read from private field"),r?r.call(e):t.get(e)),F6=(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)},D6=(e,t,r,n)=>(j1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Of;function H6(e){const t=({register:r})=>r(e);try{window.dispatchEvent(new j6(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,Of,void 0),j6(this,Of,t)}get detail(){return D6(this,Of)}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")}}Of=new WeakMap;function V6(e){z6(e.getInstanceWithAdapter())}const W6="solana:mainnet",Ih=[W6];function Rh(e){return Ih.includes(e)}function Mf(e){return"version"in e}var q1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ho=(e,t,r)=>(q1(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)=>(q1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Nf,Pf,Uf,Ff,Df,Hf;const K6=Ih,Z6=[D1,j1,H1],V1=class{constructor({address:e,publicKey:t,label:r,icon:n}){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),jo(this,Hf,void 0),new.target===V1&&Object.freeze(this),zo(this,Nf,e),zo(this,Pf,t),zo(this,Uf,K6),zo(this,Ff,Z6),zo(this,Df,r),zo(this,Hf,n)}get address(){return Ho(this,Nf)}get publicKey(){return Ho(this,Pf).slice()}get chains(){return Ho(this,Uf).slice()}get features(){return Ho(this,Ff).slice()}get label(){return Ho(this,Df)}get icon(){return Ho(this,Hf)}};let G6=V1;Nf=new WeakMap,Pf=new WeakMap,Uf=new WeakMap,Ff=new WeakMap,Df=new WeakMap,Hf=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)=>(Th(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)},kh=(e,t,r,n)=>(Th(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ch=(e,t,r)=>(Th(e,t,"access private method"),r),Qs,Lh,$h,Oh,on,hn,Mh,jf,Nh,Ph,W1,qo,zf,Uh,Fh,Dh,qf,Hh,Vf,jh;const Q6="trust:",K1=class{constructor(e){Dr(this,jf),Dr(this,Ph),Dr(this,Qs,{}),Dr(this,Lh,"1.0.0"),Dr(this,$h,"Trust"),Dr(this,Oh,Y6),Dr(this,on,null),Dr(this,hn,void 0),Dr(this,Mh,(t,r)=>{var n;return(n=nt(this,Qs)[t])!=null&&n.push(r)||(nt(this,Qs)[t]=[r]),()=>Ch(this,Ph,W1).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||!X6(i.publicKey,n))&&(kh(this,on,new G6({address:r,publicKey:n})),Ch(this,jf,Nh).call(this,"change",{accounts:this.accounts}))}}),Dr(this,zf,()=>{nt(this,on)&&(kh(this,on,null),Ch(this,jf,Nh).call(this,"change",{accounts:this.accounts}))}),Dr(this,Uh,()=>{nt(this,hn).publicKey?nt(this,qo).call(this):nt(this,zf).call(this)}),Dr(this,Fh,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,Dh,async()=>{await nt(this,hn).disconnect()}),Dr(this,qf,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(!Rh(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,qf).call(this,n));return r}),Dr(this,Hh,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&&!Rh(s))throw new Error("invalid chain");const o=await nt(this,hn).signTransaction(qa.deserialize(n)),a=Mf(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(!Rh(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:Mf(o)?o.serialize():new Uint8Array(o.serialize({requireAllSignatures:!1,verifySignatures:!1}))})))}return r}),Dr(this,Vf,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,Vf).call(this,n));return r}),Dr(this,jh,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===K1&&Object.freeze(this),kh(this,hn,e),e.on("connect",nt(this,qo),this),e.on("disconnect",nt(this,zf),this),e.on("accountChanged",nt(this,Uh),this),nt(this,qo).call(this)}get version(){return nt(this,Lh)}get name(){return nt(this,$h)}get icon(){return nt(this,Oh)}get chains(){return Ih.slice()}get features(){return{[P6]:{version:"1.0.0",connect:nt(this,Fh)},[U6]:{version:"1.0.0",disconnect:nt(this,Dh)},[F6]:{version:"1.0.0",on:nt(this,Mh)},[D1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:nt(this,qf)},[j1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:nt(this,Hh)},[H1]:{version:"1.0.0",signMessage:nt(this,Vf)},[N6]:{version:"1.0.0",signIn:nt(this,jh)},[Q6]:{trust:nt(this,hn)}}}get accounts(){return nt(this,on)?[nt(this,on)]:[]}};let eB=K1;Qs=new WeakMap,Lh=new WeakMap,$h=new WeakMap,Oh=new WeakMap,on=new WeakMap,hn=new WeakMap,Mh=new WeakMap,jf=new WeakSet,Nh=function(e,...t){var r;(r=nt(this,Qs)[e])==null||r.forEach(n=>n.apply(null,t))},Ph=new WeakSet,W1=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,zf=new WeakMap,Uh=new WeakMap,Fh=new WeakMap,Dh=new WeakMap,qf=new WeakMap,Hh=new WeakMap,Vf=new WeakMap,jh=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;Mf(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 zh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},qh=(e,t,r)=>(zh(e,t,"read from private field"),r?r.call(e):t.get(e)),Wf=(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)},Vh=(e,t,r,n)=>(zh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Kf=(e,t,r)=>(zh(e,t,"access private method"),r),Zf,Gf,Yf,Vo,Za;const Xf=class extends sf{constructor(e){super(),Wf(this,Vo),Wf(this,Zf,!1),Wf(this,Gf,!0),this.isTrust=!0,this.isTrustWallet=!0,Wf(this,Yf,!1),e&&(typeof e.enableAdapter<"u"&&Vh(this,Gf,e.enableAdapter),typeof e.cluster<"u"&&(this.connection=new M6(e.cluster,"confirmed")),typeof e.disableMobileAdapter<"u"&&Vh(this,Zf,e.disableMobileAdapter),typeof e.useLegacySign<"u"&&Vh(this,Yf,e.useLegacySign),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),qh(this,Gf)&&V6(this),qh(this,Zf)||(this.mobileAdapter=new tB(this,qh(this,Yf)))}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 Kf(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 Kf(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 Kf(this,Vo,Za).call(this,{method:"signRawTransactionMulti",params:{transactions:e.map(t=>{const r=JSON.stringify(t);let n="legacy",i;Mf(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=Xf.bufferToHex(e),n=await Kf(this,Vo,Za).call(this,{method:"signMessage",params:{data:r}});return{signature:ie.Buffer.from(Xf.messageToBuffer(n).buffer),publicKey:(t=this.publicKey)==null?void 0:t.toBase58()}}signIn(e){throw new Error("Method not implemented.")}getNetwork(){return Xf.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=Xf;Zf=new WeakMap,Gf=new WeakMap,Yf=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={},Jf={},Qf={},eu={},G1={},Ko={},tu={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.output=Hr.exists=Hr.hash=Hr.bytes=Hr.bool=Hr.number=void 0;function ru(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}Hr.number=ru;function Y1(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}Hr.bool=Y1;function rB(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Wh(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=Wh;function X1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ru(e.outputLen),ru(e.blockLen)}Hr.hash=X1;function J1(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=J1;function Q1(e,t){Wh(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(tu,"__esModule",{value:!0}),tu.SHA2=void 0;const Kh=Hr,Ga=Pi;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 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,Kh.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,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]),ls=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),hs=new Uint32Array(64);class ey extends oB.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+aB(a,c,u)+fB[y]+hs[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(){hs.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}class uB extends ey{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 ey),Ko.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 ty=BigInt(0),iu=BigInt(1),lB=BigInt(2);function Zo(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}st.isBytes=Zo;const hB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zh(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 su(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;ity;e>>=iu,t+=1);return t}st.bitLen=vB;function _B(e,t){return e>>BigInt(t)&iu}st.bitGet=_B;const EB=(e,t,r)=>e|(r?iu:ty)<(lB<new Uint8Array(e),oy=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=Yh(e),i=Yh(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Yh())=>{i=a(oy([0]),y),n=a(),y.length!==0&&(i=a(oy([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"||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 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),ds=BigInt(2),IB=BigInt(3),Xh=BigInt(4),ay=BigInt(5),cy=BigInt(8);BigInt(9),BigInt(16);function Ln(e,t){const r=e%t;return r>=jr?r:t+r}ht.mod=Ln;function fy(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=fy;function RB(e,t,r){let n=e;for(;t-- >jr;)n*=n,n%=r;return n}ht.pow2=RB;function ou(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=ou;function uy(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=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 hy(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=hy;function dy(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=dy;function LB(e,t,r){return e.mul(t,typeof r=="bigint"?ou(r,e.ORDER):e.inv(r))}ht.FpDiv=LB;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 Jh(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}ht.nLength=Jh;function OB(e,t,r=!1,n={}){if(e<=jr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=Jh(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=ly(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)=>hy(a,c,u),div:(c,u)=>Ln(c*ou(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>ou(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>dy(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=Jh(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 Qh(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=Qh;function py(e){const t=Qh(e);return t+Math.ceil(t/2)}ht.getMinHashLength=py;function UB(e,t,r=!1){const n=e.length,i=Qh(t),s=py(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 ed={},Go={};Object.defineProperty(Go,"__esModule",{value:!0}),Go.validateBasic=Go.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const gy=ht,FB=st,DB=BigInt(0),td=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&td&&(o=o.add(a)),a=a.double(),s>>=td;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+=td);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=HB;function jB(e){return(0,gy.validateField)(e.Fp),(0,FB.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,gy.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}Go.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=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}(ed);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 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 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,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=[WB(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=yy;function wy(e,t,r,n,i){if(Ya(e),Ya(t),rd(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=wy;function nd(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),rd(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=yy(e,u,A,o);else if(a==="xof")v=wy(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=nd(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=nd(n,1,{...r,DST:r.encodeDST,...i}),o=e.fromAffine(t(s[0])).clearCofactor();return o.assertValidity(),o}}}Vn.createHasher=ZB;var Yo={},my={};(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)})(my),Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.createCurve=Yo.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const GB=my,by=Pi,YB=ed;function vy(e){return{hash:e,hmac:(t,...r)=>(0,GB.hmac)(e,t,(0,by.concatBytes)(...r)),randomBytes:by.randomBytes}}Yo.getHash=vy;function XB(e,t){const r=n=>(0,YB.weierstrass)({...e,...vy(n)});return Object.freeze({...r(t),create:r})}Yo.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=Ko,r=Pi,n=ht,i=ed,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)()}(G1),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=G1;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(eu),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=eu;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}(Qf);var au={};Object.defineProperty(au,"__esModule",{value:!0}),au.GWEI_TO_WEI=void 0,au.GWEI_TO_WEI=BigInt(1e9);var id={},vi={};Object.defineProperty(vi,"__esModule",{value:!0}),vi.RLP=vi.utils=vi.decode=vi.encode=void 0;function sd(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 _y(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return Ay(Sy(e))}function Ey(e,t){if(e<56)return Uint8Array.from([e+t]);const r=cd(e),n=r.length/2,i=cd(t+55+n);return Uint8Array.from(cu(i+r))}function xy(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);const r=Ry(e),n=od(r);if(t)return n;if(n.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return n.data}vi.decode=xy;function od(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=od(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 Sy(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:Iy(e)?e.slice(2):e}function Ry(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return Iy(e)?cu(QB(eI(e))):By(e);if(typeof e=="number"||typeof e=="bigint")return e?cu(cd(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}vi.utils={bytesToHex:Sy,concatBytes:ad,hexToBytes:cu,utf8ToBytes:By},vi.RLP={encode:sd,decode:xy};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 fu=BigInt(2**32-1),fd=BigInt(32);function ud(e,t=!1){return t?{h:Number(e&fu),l:Number(e>>fd&fu)}:{h:Number(e>>fd&fu)|0,l:Number(e&fu)|0}}ot.fromBig=ud;function Ty(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);ot.toBig=ky;const Cy=(e,t,r)=>e>>>r;ot.shrSH=Cy;const Ly=(e,t,r)=>e<<32-r|t>>>r;ot.shrSL=Ly;const $y=(e,t,r)=>e>>>r|t<<32-r;ot.rotrSH=$y;const Oy=(e,t,r)=>e<<32-r|t>>>r;ot.rotrSL=Oy;const My=(e,t,r)=>e<<64-r|t>>>r-32;ot.rotrBH=My;const Ny=(e,t,r)=>e>>>r-32|t<<64-r;ot.rotrBL=Ny;const Py=(e,t)=>t;ot.rotr32H=Py;const Uy=(e,t)=>e;ot.rotr32L=Uy;const Fy=(e,t,r)=>e<>>32-r;ot.rotlSH=Fy;const Dy=(e,t,r)=>t<>>32-r;ot.rotlSL=Dy;const Hy=(e,t,r)=>t<>>64-r;ot.rotlBH=Hy;const jy=(e,t,r)=>e<>>64-r;ot.rotlBL=jy;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 qy=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);ot.add3L=qy;const Vy=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;ot.add3H=Vy;const Wy=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);ot.add4L=Wy;const Ky=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;ot.add4H=Ky;const Zy=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ot.add5L=Zy;const Gy=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;ot.add5H=Gy;const tI={fromBig:ud,split:Ty,toBig:ky,shrSH:Cy,shrSL:Ly,rotrSH:$y,rotrSL:Oy,rotrBH:My,rotrBL:Ny,rotr32H:Py,rotr32L:Uy,rotlSH:Fy,rotlSL:Dy,rotlBH:Hy,rotlBL:jy,add:zy,add3L:qy,add3H:Vy,add4L:Wy,add4H:Ky,add5H:Gy,add5L:Zy};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 Jo=Hr,Xa=ot,Ja=Pi,[Yy,Xy,Jy]=[[],[],[]],rI=BigInt(0),Qa=BigInt(1),nI=BigInt(2),iI=BigInt(7),sI=BigInt(256),oI=BigInt(113);for(let e=0,t=Qa,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Yy.push(2*(5*n+r)),Xy.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^=Qa<<(Qa<r>32?(0,Xa.rotlBH)(e,t,r):(0,Xa.rotlSH)(e,t,r),ew=(e,t,r)=>r>32?(0,Xa.rotlBL)(e,t,r):(0,Xa.rotlSL)(e,t,r);function tw(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=Qy(u,l,1)^r[a],A=ew(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=Xy[o],c=Qy(i,s,a),u=ew(i,s,a),l=Yy[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=tw;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(){tw(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 rw=(e,t,r)=>(0,Ja.wrapXOFConstructorWithOpts)((n={})=>new ec(t,e,n.dkLen===void 0?r:n.dkLen,!0));Qt.shake128=rw(31,168,128/8),Qt.shake256=rw(31,136,256/8);function ld(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 uu={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 ld=="function"&&ld.bind(e);return{node:v&&!A?v("crypto"):void 0,web:A}})()})(uu,uu.exports),Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.keccak512=Wn.keccak384=Wn.keccak256=Wn.keccak224=void 0;const tc=Qt,lu=uu.exports;Wn.keccak224=(0,lu.wrapHash)(tc.keccak_224),Wn.keccak256=(()=>{const e=(0,lu.wrapHash)(tc.keccak_256);return e.create=tc.keccak_256.create,e})(),Wn.keccak384=(0,lu.wrapHash)(tc.keccak_384),Wn.keccak512=(0,lu.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 nw(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=nw;const fI=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return nw(e)?e.slice(2):e};er.stripHexPrefix=fI;function iw(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=iw;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}(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=eu,i=uu.exports,s=eo,o=Qf,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}(id);var rc={};Object.defineProperty(rc,"__esModule",{value:!0}),rc.Address=void 0;const nc=id,hu=eo;class Fi{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new Fi((0,hu.zeros)(20))}static fromString(t){if(!(0,nc.isValidAddress)(t))throw new Error("Invalid address");return new Fi((0,hu.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,hu.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,hu.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 du={},hd={};(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})(hd),Object.defineProperty(du,"__esModule",{value:!0}),du.Withdrawal=void 0;const sw=rc,dd=eo,br=hd;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 sw.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 sw.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,dd.bigIntToHex)(this.index),validatorIndex:(0,dd.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,dd.bigIntToHex)(this.amount)}}}du.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 EI=Wn,ow=eu,bn=eo,pd=Qf,xI=Kn;function SI(e,t,r){const n=ow.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 pu(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function gu(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=pu(t,i);if(!gu(o))throw new Error("Invalid signature v value");const c=ow.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=pu(e,n);if(!gu(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=pu(e,n);if(!gu(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||!gu(pu(e,i)))return!1;const s=(0,bn.bufferToBigInt)(t),o=(0,bn.bufferToBigInt)(r);return!(s===BigInt(0)||s>=pd.SECP256K1_ORDER||o===BigInt(0)||o>=pd.SECP256K1_ORDER||n&&o>=pd.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 aw={};(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})(aw);var yu={};Object.defineProperty(yu,"__esModule",{value:!0}),yu.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)}}yu.AsyncEventEmitter=$I;var wu={};Object.defineProperty(wu,"__esModule",{value:!0}),wu.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)}}}wu.Lock=OI;var Qo={},to={},pr=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},_i=[],Zn=[],MI=typeof Uint8Array<"u"?Uint8Array:Array,gd=!1;function cw(){gd=!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 mu(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 uw(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,lw=Array.isArray||function(e){return FI.call(e)=="[object Array]"};/*! +`,r)}}class j6 extends Event{constructor(t){super("wallet-standard:register-wallet",{bubbles:!1,cancelable:!1,composed:!1}),F6(this,Of,void 0),D6(this,Of,t)}get detail(){return U6(this,Of)}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")}}Of=new WeakMap;function z6(e){H6(e.getInstanceWithAdapter())}const q6="solana:mainnet",Ih=[q6];function Rh(e){return Ih.includes(e)}function Mf(e){return"version"in e}var z1=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Ho=(e,t,r)=>(z1(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)=>(z1(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Nf,Pf,Uf,Ff,Df,Hf;const V6=Ih,W6=[F1,H1,D1],q1=class{constructor({address:e,publicKey:t,label:r,icon:n}){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),jo(this,Hf,void 0),new.target===q1&&Object.freeze(this),zo(this,Nf,e),zo(this,Pf,t),zo(this,Uf,V6),zo(this,Ff,W6),zo(this,Df,r),zo(this,Hf,n)}get address(){return Ho(this,Nf)}get publicKey(){return Ho(this,Pf).slice()}get chains(){return Ho(this,Uf).slice()}get features(){return Ho(this,Ff).slice()}get label(){return Ho(this,Df)}get icon(){return Ho(this,Hf)}};let K6=q1;Nf=new WeakMap,Pf=new WeakMap,Uf=new WeakMap,Ff=new WeakMap,Df=new WeakMap,Hf=new WeakMap;const Z6="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTgiIGhlaWdodD0iNjUiIHZpZXdCb3g9IjAgMCA1OCA2NSIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTAgOS4zODk0OUwyOC44OTA3IDBWNjUuMDA0MkM4LjI1NDUgNTYuMzM2OSAwIDM5LjcyNDggMCAzMC4zMzUzVjkuMzg5NDlaIiBmaWxsPSIjMDUwMEZGIi8+CjxwYXRoIGQ9Ik01Ny43ODIyIDkuMzg5NDlMMjguODkxNSAwVjY1LjAwNDJDNDkuNTI3NyA1Ni4zMzY5IDU3Ljc4MjIgMzkuNzI0OCA1Ny43ODIyIDMwLjMzNTNWOS4zODk0OVoiIGZpbGw9InVybCgjcGFpbnQwX2xpbmVhcl8yMjAxXzY5NDIpIi8+CjxkZWZzPgo8bGluZWFyR3JhZGllbnQgaWQ9InBhaW50MF9saW5lYXJfMjIwMV82OTQyIiB4MT0iNTEuMzYxNSIgeTE9Ii00LjE1MjkzIiB4Mj0iMjkuNTM4NCIgeTI9IjY0LjUxNDciIGdyYWRpZW50VW5pdHM9InVzZXJTcGFjZU9uVXNlIj4KPHN0b3Agb2Zmc2V0PSIwLjAyMTEyIiBzdG9wLWNvbG9yPSIjMDAwMEZGIi8+CjxzdG9wIG9mZnNldD0iMC4wNzYyNDIzIiBzdG9wLWNvbG9yPSIjMDA5NEZGIi8+CjxzdG9wIG9mZnNldD0iMC4xNjMwODkiIHN0b3AtY29sb3I9IiM0OEZGOTEiLz4KPHN0b3Agb2Zmc2V0PSIwLjQyMDA0OSIgc3RvcC1jb2xvcj0iIzAwOTRGRiIvPgo8c3RvcCBvZmZzZXQ9IjAuNjgyODg2IiBzdG9wLWNvbG9yPSIjMDAzOEZGIi8+CjxzdG9wIG9mZnNldD0iMC45MDI0NjUiIHN0b3AtY29sb3I9IiMwNTAwRkYiLz4KPC9saW5lYXJHcmFkaWVudD4KPC9kZWZzPgo8L3N2Zz4K";function G6(e,t){return Y6(e,t)}function Y6(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)=>(Th(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)},kh=(e,t,r,n)=>(Th(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ch=(e,t,r)=>(Th(e,t,"access private method"),r),Qs,Lh,$h,Oh,on,hn,Mh,jf,Nh,Ph,V1,qo,zf,Uh,Fh,Dh,qf,Hh,Vf,jh;const X6="trust:",W1=class{constructor(e){Dr(this,jf),Dr(this,Ph),Dr(this,Qs,{}),Dr(this,Lh,"1.0.0"),Dr(this,$h,"Trust"),Dr(this,Oh,Z6),Dr(this,on,null),Dr(this,hn,void 0),Dr(this,Mh,(t,r)=>{var n;return(n=nt(this,Qs)[t])!=null&&n.push(r)||(nt(this,Qs)[t]=[r]),()=>Ch(this,Ph,V1).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||!G6(i.publicKey,n))&&(kh(this,on,new K6({address:r,publicKey:n})),Ch(this,jf,Nh).call(this,"change",{accounts:this.accounts}))}}),Dr(this,zf,()=>{nt(this,on)&&(kh(this,on,null),Ch(this,jf,Nh).call(this,"change",{accounts:this.accounts}))}),Dr(this,Uh,()=>{nt(this,hn).publicKey?nt(this,qo).call(this):nt(this,zf).call(this)}),Dr(this,Fh,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,Dh,async()=>{await nt(this,hn).disconnect()}),Dr(this,qf,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(!Rh(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,qf).call(this,n));return r}),Dr(this,Hh,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&&!Rh(s))throw new Error("invalid chain");const o=await nt(this,hn).signTransaction(qa.deserialize(n)),a=Mf(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(!Rh(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:Mf(o)?o.serialize():new Uint8Array(o.serialize({requireAllSignatures:!1,verifySignatures:!1}))})))}return r}),Dr(this,Vf,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,Vf).call(this,n));return r}),Dr(this,jh,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===W1&&Object.freeze(this),kh(this,hn,e),e.on("connect",nt(this,qo),this),e.on("disconnect",nt(this,zf),this),e.on("accountChanged",nt(this,Uh),this),nt(this,qo).call(this)}get version(){return nt(this,Lh)}get name(){return nt(this,$h)}get icon(){return nt(this,Oh)}get chains(){return Ih.slice()}get features(){return{[M6]:{version:"1.0.0",connect:nt(this,Fh)},[N6]:{version:"1.0.0",disconnect:nt(this,Dh)},[P6]:{version:"1.0.0",on:nt(this,Mh)},[F1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:nt(this,qf)},[H1]:{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:nt(this,Hh)},[D1]:{version:"1.0.0",signMessage:nt(this,Vf)},[O6]:{version:"1.0.0",signIn:nt(this,jh)},[X6]:{trust:nt(this,hn)}}}get accounts(){return nt(this,on)?[nt(this,on)]:[]}};let J6=W1;Qs=new WeakMap,Lh=new WeakMap,$h=new WeakMap,Oh=new WeakMap,on=new WeakMap,hn=new WeakMap,Mh=new WeakMap,jf=new WeakSet,Nh=function(e,...t){var r;(r=nt(this,Qs)[e])==null||r.forEach(n=>n.apply(null,t))},Ph=new WeakSet,V1=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,zf=new WeakMap,Uh=new WeakMap,Fh=new WeakMap,Dh=new WeakMap,qf=new WeakMap,Hh=new WeakMap,Vf=new WeakMap,jh=new WeakMap;class Q6{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;Mf(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 zh=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},qh=(e,t,r)=>(zh(e,t,"read from private field"),r?r.call(e):t.get(e)),Wf=(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)},Vh=(e,t,r,n)=>(zh(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Kf=(e,t,r)=>(zh(e,t,"access private method"),r),Zf,Gf,Yf,Vo,Za;const Xf=class extends sf{constructor(e){super(),Wf(this,Vo),Wf(this,Zf,!1),Wf(this,Gf,!0),this.isTrust=!0,this.isTrustWallet=!0,Wf(this,Yf,!1),e&&(typeof e.enableAdapter<"u"&&Vh(this,Gf,e.enableAdapter),typeof e.cluster<"u"&&(this.connection=new $6(e.cluster,"confirmed")),typeof e.disableMobileAdapter<"u"&&Vh(this,Zf,e.disableMobileAdapter),typeof e.useLegacySign<"u"&&Vh(this,Yf,e.useLegacySign),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),qh(this,Gf)&&z6(this),qh(this,Zf)||(this.mobileAdapter=new Q6(this,qh(this,Yf)))}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 Kf(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 Kf(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 Kf(this,Vo,Za).call(this,{method:"signRawTransactionMulti",params:{transactions:e.map(t=>{const r=JSON.stringify(t);let n="legacy",i;Mf(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=Xf.bufferToHex(e),n=await Kf(this,Vo,Za).call(this,{method:"signMessage",params:{data:r}});return{signature:ie.Buffer.from(Xf.messageToBuffer(n).buffer),publicKey:(t=this.publicKey)==null?void 0:t.toBase58()}}signIn(e){throw new Error("Method not implemented.")}getNetwork(){return Xf.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 K1=Xf;Zf=new WeakMap,Gf=new WeakMap,Yf=new WeakMap,Vo=new WeakSet,Za=function(e){const t=()=>this.internalRequest(e);return this.mobileAdapter?this.mobileAdapter.request(e,t):t()},K1.NETWORK="solana";var Wo={},us={},Jf={},Qf={},eu={},Z1={},Ko={},tu={},Hr={};Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.output=Hr.exists=Hr.hash=Hr.bytes=Hr.bool=Hr.number=void 0;function ru(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}Hr.number=ru;function G1(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}Hr.bool=G1;function eB(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function Wh(e,...t){if(!eB(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=Wh;function Y1(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ru(e.outputLen),ru(e.blockLen)}Hr.hash=Y1;function X1(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=X1;function J1(e,t){Wh(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(tu,"__esModule",{value:!0}),tu.SHA2=void 0;const Kh=Hr,Ga=Pi;function rB(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 nB 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,Kh.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,oB=(e,t,r)=>e&t^e&r^t&r,aB=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 Q1 extends iB.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+sB(a,c,u)+aB[y]+hs[y]|0,O=((0,qn.rotr)(n,2)^(0,qn.rotr)(n,13)^(0,qn.rotr)(n,22))+oB(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 cB extends Q1{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 Q1),Ko.sha224=(0,qn.wrapConstructor)(()=>new cB);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 ey=BigInt(0),iu=BigInt(1),fB=BigInt(2);function Zo(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}st.isBytes=Zo;const uB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Zh(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 su(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;iey;e>>=iu,t+=1);return t}st.bitLen=mB;function bB(e,t){return e>>BigInt(t)&iu}st.bitGet=bB;const vB=(e,t,r)=>e|(r?iu:ey)<(fB<new Uint8Array(e),sy=e=>Uint8Array.from(e);function EB(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=Yh(e),i=Yh(e),s=0;const o=()=>{n.fill(1),i.fill(0),s=0},a=(...y)=>r(i,n,...y),c=(y=Yh())=>{i=a(sy([0]),y),n=a(),y.length!==0&&(i=a(sy([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=EB;const xB={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 SB(e,t,r={}){const n=(i,s,o)=>{const a=xB[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=SB,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),AB=BigInt(3),Xh=BigInt(4),oy=BigInt(5),ay=BigInt(8);BigInt(9),BigInt(16);function Ln(e,t){const r=e%t;return r>=jr?r:t+r}ht.mod=Ln;function cy(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=cy;function BB(e,t,r){let n=e;for(;t-- >jr;)n*=n,n%=r;return n}ht.pow2=BB;function ou(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=ou;function fy(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=IB;const RB=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function TB(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},r=RB.reduce((n,i)=>(n[i]="function",n),t);return(0,Cn.validateObject)(e,r)}ht.validateField=TB;function ly(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=ly;function hy(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=hy;function kB(e,t,r){return e.mul(t,typeof r=="bigint"?ou(r,e.ORDER):e.inv(r))}ht.FpDiv=kB;function CB(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=CB;function Jh(e,t){const r=t!==void 0?t:e.toString(2).length,n=Math.ceil(r/8);return{nBitLength:r,nByteLength:n}}ht.nLength=Jh;function LB(e,t,r=!1,n={}){if(e<=jr)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:s}=Jh(e,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");const o=uy(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)=>ly(a,c,u),div:(c,u)=>Ln(c*ou(u,e),e),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>ou(c,e),sqrt:n.sqrt||(c=>o(a,c)),invertBatch:c=>hy(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=LB;function $B(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=$B;function OB(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=OB;function MB(e,t,r=!1){e=(0,Cn.ensureBytes)("privateHash",e);const n=e.length,i=Jh(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=MB;function Qh(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=Qh;function dy(e){const t=Qh(e);return t+Math.ceil(t/2)}ht.getMinHashLength=dy;function NB(e,t,r=!1){const n=e.length,i=Qh(t),s=dy(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=NB;var ed={},Go={};Object.defineProperty(Go,"__esModule",{value:!0}),Go.validateBasic=Go.wNAF=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const py=ht,PB=st,UB=BigInt(0),td=BigInt(1);function FB(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>UB;)s&td&&(o=o.add(a)),a=a.double(),s>>=td;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+=td);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=FB;function DB(e){return(0,py.validateField)(e.Fp),(0,PB.validateObject)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,py.nLength)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}Go.validateBasic=DB,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}(ed);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 HB=ht,$n=st;function jB(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 zB=$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 qB(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=[qB(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=gy;function yy(e,t,r,n,i){if(Ya(e),Ya(t),rd(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=yy;function nd(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),rd(t);const u=jB(c),l=n.toString(2).length,y=Math.ceil((l+i)/8),A=t*s*y;let v;if(a==="xmd")v=gy(e,u,A,o);else if(a==="xof")v=yy(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=VB;function WB(e,t,r){if(typeof t!="function")throw new Error("mapToCurve() must be defined");return{hashToCurve(n,i){const s=nd(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=nd(n,1,{...r,DST:r.encodeDST,...i}),o=e.fromAffine(t(s[0])).clearCofactor();return o.assertValidity(),o}}}Vn.createHasher=WB;var Yo={},wy={};(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)})(wy),Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.createCurve=Yo.getHash=void 0;/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const KB=wy,my=Pi,ZB=ed;function by(e){return{hash:e,hmac:(t,...r)=>(0,KB.hmac)(e,t,(0,my.concatBytes)(...r)),randomBytes:my.randomBytes}}Yo.getHash=by;function GB(e,t){const r=n=>(0,ZB.weierstrass)({...e,...by(n)});return Object.freeze({...r(t),create:r})}Yo.createCurve=GB,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=ed,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)()}(Z1),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.secp256k1=void 0;var t=Z1;Object.defineProperty(e,"secp256k1",{enumerable:!0,get:function(){return t.secp256k1}})}(eu),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=eu;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}(Qf);var au={};Object.defineProperty(au,"__esModule",{value:!0}),au.GWEI_TO_WEI=void 0,au.GWEI_TO_WEI=BigInt(1e9);var id={},vi={};Object.defineProperty(vi,"__esModule",{value:!0}),vi.RLP=vi.utils=vi.decode=vi.encode=void 0;function sd(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 vy(e){if(e[0]===0)throw new Error("invalid RLP: extra zeros");return Sy(xy(e))}function _y(e,t){if(e<56)return Uint8Array.from([e+t]);const r=cd(e),n=r.length/2,i=cd(t+55+n);return Uint8Array.from(cu(i+r))}function Ey(e,t=!1){if(typeof e>"u"||e===null||e.length===0)return Uint8Array.from([]);const r=Iy(e),n=od(r);if(t)return n;if(n.remainder.length!==0)throw new Error("invalid RLP: remainder must be zero");return n.data}vi.decode=Ey;function od(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=od(i),o.push(s.data),i=s.remainder;return{data:o,remainder:e.slice(c)}}}const YB=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function xy(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:By(e)?e.slice(2):e}function Iy(e){if(e instanceof Uint8Array)return e;if(typeof e=="string")return By(e)?cu(XB(JB(e))):Ay(e);if(typeof e=="number"||typeof e=="bigint")return e?cu(cd(e)):Uint8Array.from([]);if(e==null)return Uint8Array.from([]);throw new Error("toBytes: received unsupported type "+typeof e)}vi.utils={bytesToHex:xy,concatBytes:ad,hexToBytes:cu,utf8ToBytes:Ay},vi.RLP={encode:sd,decode:Ey};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 fu=BigInt(2**32-1),fd=BigInt(32);function ud(e,t=!1){return t?{h:Number(e&fu),l:Number(e>>fd&fu)}:{h:Number(e>>fd&fu)|0,l:Number(e&fu)|0}}ot.fromBig=ud;function Ry(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);ot.toBig=Ty;const ky=(e,t,r)=>e>>>r;ot.shrSH=ky;const Cy=(e,t,r)=>e<<32-r|t>>>r;ot.shrSL=Cy;const Ly=(e,t,r)=>e>>>r|t<<32-r;ot.rotrSH=Ly;const $y=(e,t,r)=>e<<32-r|t>>>r;ot.rotrSL=$y;const Oy=(e,t,r)=>e<<64-r|t>>>r-32;ot.rotrBH=Oy;const My=(e,t,r)=>e>>>r-32|t<<64-r;ot.rotrBL=My;const Ny=(e,t)=>t;ot.rotr32H=Ny;const Py=(e,t)=>e;ot.rotr32L=Py;const Uy=(e,t,r)=>e<>>32-r;ot.rotlSH=Uy;const Fy=(e,t,r)=>t<>>32-r;ot.rotlSL=Fy;const Dy=(e,t,r)=>t<>>64-r;ot.rotlBH=Dy;const Hy=(e,t,r)=>e<>>64-r;ot.rotlBL=Hy;function jy(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}ot.add=jy;const zy=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);ot.add3L=zy;const qy=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;ot.add3H=qy;const Vy=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);ot.add4L=Vy;const Wy=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;ot.add4H=Wy;const Ky=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);ot.add5L=Ky;const Zy=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;ot.add5H=Zy;const QB={fromBig:ud,split:Ry,toBig:Ty,shrSH:ky,shrSL:Cy,rotrSH:Ly,rotrSL:$y,rotrBH:Oy,rotrBL:My,rotr32H:Ny,rotr32L:Py,rotlSH:Uy,rotlSL:Fy,rotlBH:Dy,rotlBL:Hy,add:jy,add3L:zy,add3H:qy,add4L:Vy,add4H:Wy,add5H:Zy,add5L:Ky};ot.default=QB,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,[Gy,Yy,Xy]=[[],[],[]],eI=BigInt(0),Qa=BigInt(1),tI=BigInt(2),rI=BigInt(7),nI=BigInt(256),iI=BigInt(113);for(let e=0,t=Qa,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],Gy.push(2*(5*n+r)),Yy.push((e+1)*(e+2)/2%64);let i=eI;for(let s=0;s<7;s++)t=(t<>rI)*iI)%nI,t&tI&&(i^=Qa<<(Qa<r>32?(0,Xa.rotlBH)(e,t,r):(0,Xa.rotlSH)(e,t,r),Qy=(e,t,r)=>r>32?(0,Xa.rotlBL)(e,t,r):(0,Xa.rotlSL)(e,t,r);function ew(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=Jy(u,l,1)^r[a],A=Qy(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=Yy[o],c=Jy(i,s,a),u=Qy(i,s,a),l=Gy[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]^=sI[n],e[1]^=oI[n]}r.fill(0)}Qt.keccakP=ew;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(){ew(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 tw=(e,t,r)=>(0,Ja.wrapXOFConstructorWithOpts)((n={})=>new ec(t,e,n.dkLen===void 0?r:n.dkLen,!0));Qt.shake128=tw(31,168,128/8),Qt.shake256=tw(31,136,256/8);function ld(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 uu={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 ld=="function"&&ld.bind(e);return{node:v&&!A?v("crypto"):void 0,web:A}})()})(uu,uu.exports),Object.defineProperty(Wn,"__esModule",{value:!0}),Wn.keccak512=Wn.keccak384=Wn.keccak256=Wn.keccak224=void 0;const tc=Qt,lu=uu.exports;Wn.keccak224=(0,lu.wrapHash)(tc.keccak_224),Wn.keccak256=(()=>{const e=(0,lu.wrapHash)(tc.keccak_256);return e.create=tc.keccak_256.create,e})(),Wn.keccak384=(0,lu.wrapHash)(tc.keccak_384),Wn.keccak512=(0,lu.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 rw(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=rw;const aI=e=>{if(typeof e!="string")throw new Error(`[stripHexPrefix] input must be type 'string', received ${typeof e}`);return rw(e)?e.slice(2):e};er.stripHexPrefix=aI;function nw(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=nw;function cI(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=cI;function fI(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=fI;function uI(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=pI,Object.defineProperty(Kn,"__esModule",{value:!0}),Kn.assertIsString=Kn.assertIsArray=Kn.assertIsBuffer=Kn.assertIsHexString=void 0;const gI=er,yI=function(e){if(!(0,gI.isHexString)(e)){const t=`This method only supports 0x-prefixed hex strings but input was: ${e}`;throw new Error(t)}};Kn.assertIsHexString=yI;const wI=function(e){if(!ie.Buffer.isBuffer(e)){const t=`This method only supports Buffer but input was: ${e}`;throw new Error(t)}};Kn.assertIsBuffer=wI;const mI=function(e){if(!Array.isArray(e)){const t=`This method only supports number arrays but input was: ${e}`;throw new Error(t)}};Kn.assertIsArray=mI;const bI=function(e){if(typeof e!="string"){const t=`This method only supports strings but input was: ${e}`;throw new Error(t)}};Kn.assertIsString=bI,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=eu,i=uu.exports,s=eo,o=Qf,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}(id);var rc={};Object.defineProperty(rc,"__esModule",{value:!0}),rc.Address=void 0;const nc=id,hu=eo;class Fi{constructor(t){if(t.length!==20)throw new Error("Invalid address length");this.buf=t}static zero(){return new Fi((0,hu.zeros)(20))}static fromString(t){if(!(0,nc.isValidAddress)(t))throw new Error("Invalid address");return new Fi((0,hu.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,hu.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,hu.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 du={},hd={};(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})(hd),Object.defineProperty(du,"__esModule",{value:!0}),du.Withdrawal=void 0;const iw=rc,dd=eo,br=hd;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 iw.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 iw.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,dd.bigIntToHex)(this.index),validatorIndex:(0,dd.bigIntToHex)(this.validatorIndex),address:"0x"+this.address.buf.toString("hex"),amount:(0,dd.bigIntToHex)(this.amount)}}}du.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 vI=Wn,sw=eu,bn=eo,pd=Qf,_I=Kn;function EI(e,t,r){const n=sw.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=EI;function pu(e,t){return e===BigInt(0)||e===BigInt(1)?e:t===void 0?e-BigInt(27):e-(t*BigInt(2)+BigInt(35))}function gu(e){return e===BigInt(0)||e===BigInt(1)}const xI=function(e,t,r,n,i){const s=ie.Buffer.concat([(0,bn.setLengthLeft)(r,32),(0,bn.setLengthLeft)(n,32)],64),o=pu(t,i);if(!gu(o))throw new Error("Invalid signature v value");const c=sw.secp256k1.Signature.fromCompact(s).addRecoveryBit(Number(o)).recoverPublicKey(e);return ie.Buffer.from(c.toRawBytes(!1).slice(1))};an.ecrecover=xI;const SI=function(e,t,r,n){const i=pu(e,n);if(!gu(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=SI;const AI=function(e,t,r,n){const i=pu(e,n);if(!gu(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=AI;const BI=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=BI;const II=function(e,t,r,n=!0,i){if(t.length!==32||r.length!==32||!gu(pu(e,i)))return!1;const s=(0,bn.bufferToBigInt)(t),o=(0,bn.bufferToBigInt)(r);return!(s===BigInt(0)||s>=pd.SECP256K1_ORDER||o===BigInt(0)||o>=pd.SECP256K1_ORDER||n&&o>=pd.SECP256K1_ORDER_DIV_2)};an.isValidSignature=II;const RI=function(e){(0,_I.assertIsBuffer)(e);const t=ie.Buffer.from(`Ethereum Signed Message: +${e.length}`,"utf-8");return ie.Buffer.from((0,vI.keccak256)(ie.Buffer.concat([t,e])))};an.hashPersonalMessage=RI;var ow={};(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})(ow);var yu={};Object.defineProperty(yu,"__esModule",{value:!0}),yu.AsyncEventEmitter=void 0;const TI=Dn.exports;async function kI(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 CI extends TI.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],kI(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)}}yu.AsyncEventEmitter=CI;var wu={};Object.defineProperty(wu,"__esModule",{value:!0}),wu.Lock=void 0;class LI{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)}}}wu.Lock=LI;var Qo={},to={},pr=typeof global<"u"?global:typeof self<"u"?self:typeof window<"u"?window:{},_i=[],Zn=[],$I=typeof Uint8Array<"u"?Uint8Array:Array,gd=!1;function aw(){gd=!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 $I(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 MI(e){return _i[e>>18&63]+_i[e>>12&63]+_i[e>>6&63]+_i[e&63]}function NI(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 mu(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 fw(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 PI={}.toString,uw=Array.isArray||function(e){return PI.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,bu();function bu(){return le.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function Di(e,t){if(bu()=bu())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+bu().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 xw(e).length;default:if(n)return Eu(e).length;t=(""+t).toLowerCase(),n=!0}}le.byteLength=pw;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 mw(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 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:yw(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):yw(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function yw(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 ww(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?fw(e):fw(e.slice(t,r))}function mw(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 bw=4096;function JI(e){var t=e.length;if(t<=bw)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),mu(this,t,!0,23,4)},le.prototype.readFloatBE=function(t,r){return r||zr(t,4,this.length),mu(this,t,!1,23,4)},le.prototype.readDoubleLE=function(t,r){return r||zr(t,8,this.length),mu(this,t,!0,52,8)},le.prototype.readDoubleBE=function(t,r){return r||zr(t,8,this.length),mu(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 vu(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):vu(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):vu(this,t,r,!1),r+2};function _u(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):_u(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):_u(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):vu(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):vu(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):_u(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):_u(this,t,r,!1),r+4};function vw(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 _w(e,t,r,n,i){return i||vw(e,t,r,4),uw(e,t,r,n,23,4),r+4}le.prototype.writeFloatLE=function(t,r,n){return _w(this,t,r,!0,n)},le.prototype.writeFloatBE=function(t,r,n){return _w(this,t,r,!1,n)};function Ew(e,t,r,n,i){return i||vw(e,t,r,8),uw(e,t,r,n,52,8),r+8}le.prototype.writeDoubleLE=function(t,r,n){return Ew(this,t,r,!0,n)},le.prototype.writeDoubleBE=function(t,r,n){return Ew(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 xw(e){return NI(i8(e))}function xu(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||Sw(e)||l8(e))}function Sw(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"&&Sw(e.slice(0,0))}function Aw(){throw new Error("setTimeout has not been defined")}function Bw(){throw new Error("clearTimeout has not been defined")}var ys=Aw,ws=Bw;typeof pr.setTimeout=="function"&&(ys=setTimeout),typeof pr.clearTimeout=="function"&&(ws=clearTimeout);function Iw(e){if(ys===setTimeout)return setTimeout(e,0);if((ys===Aw||!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 h8(e){if(ws===clearTimeout)return clearTimeout(e);if((ws===Bw||!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,Su=-1;function d8(){!ea||!no||(ea=!1,no.length?Hi=no.concat(Hi):Su=-1,Hi.length&&Rw())}function Rw(){if(!ea){var e=Iw(d8);ea=!0;for(var t=Hi.length;t;){for(no=Hi,Hi=[];++Su1)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]),Tu(t)?r.showHidden=t:t&&Ld(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),Ru(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 Ru(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=Ru(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)),cc(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Ad(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(ku(t))return e.stylize(Date.prototype.toString.call(t),"date");if(cc(t))return Ad(t)}var c="",u=!1,l=["{","}"];if(Id(t)&&(u=!0,l=["[","]"]),fc(t)){var y=t.name?": "+t.name:"";c=" [Function"+y+"]"}if(ac(t)&&(c=" "+RegExp.prototype.toString.call(t)),ku(t)&&(c=" "+Date.prototype.toUTCString.call(t)),cc(t)&&(c=" "+Ad(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=G8(e,t,r,o,s):A=s.map(function(v){return Bd(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(ms(t)){var r="'"+JSON.stringify(t).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return e.stylize(r,"string")}if(Td(t))return e.stylize(""+t,"number");if(Tu(t))return e.stylize(""+t,"boolean");if(ji(t))return e.stylize("null","null")}function Ad(e){return"["+Error.prototype.toString.call(e)+"]"}function G8(e,t,r,n,i){for(var s=[],o=0,a=t.length;o=bu())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+bu().toString(16)+" bytes");return e|0}le.isBuffer=c8;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 Ew(e).length;default:if(n)return Eu(e).length;t=(""+t).toLowerCase(),n=!0}}le.byteLength=dw;function zI(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 QI(this,t,r);case"utf8":case"utf-8":return ww(this,t,r);case"ascii":return XI(this,t,r);case"latin1":case"binary":return JI(this,t,r);case"base64":return GI(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return e8(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:gw(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):gw(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function gw(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 qI(this,t,r,n);case"utf8":case"utf-8":return VI(this,t,r,n);case"ascii":return yw(this,t,r,n);case"latin1":case"binary":return WI(this,t,r,n);case"base64":return KI(this,t,r,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ZI(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 GI(e,t,r){return t===0&&r===e.length?cw(e):cw(e.slice(t,r))}function ww(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 YI(n)}var mw=4096;function YI(e){var t=e.length;if(t<=mw)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),mu(this,t,!0,23,4)},le.prototype.readFloatBE=function(t,r){return r||zr(t,4,this.length),mu(this,t,!1,23,4)},le.prototype.readDoubleLE=function(t,r){return r||zr(t,8,this.length),mu(this,t,!0,52,8)},le.prototype.readDoubleBE=function(t,r){return r||zr(t,8,this.length),mu(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 vu(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):vu(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):vu(this,t,r,!1),r+2};function _u(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):_u(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):_u(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):vu(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):vu(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):_u(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):_u(this,t,r,!1),r+4};function bw(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 vw(e,t,r,n,i){return i||bw(e,t,r,4),fw(e,t,r,n,23,4),r+4}le.prototype.writeFloatLE=function(t,r,n){return vw(this,t,r,!0,n)},le.prototype.writeFloatBE=function(t,r,n){return vw(this,t,r,!1,n)};function _w(e,t,r,n,i){return i||bw(e,t,r,8),fw(e,t,r,n,52,8),r+8}le.prototype.writeDoubleLE=function(t,r,n){return _w(this,t,r,!0,n)},le.prototype.writeDoubleBE=function(t,r,n){return _w(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 s8(e){for(var t=[],r=0;r>8,i=r%256,s.push(i),s.push(n);return s}function Ew(e){return OI(r8(e))}function xu(e,t,r,n){for(var i=0;i=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function a8(e){return e!==e}function c8(e){return e!=null&&(!!e._isBuffer||xw(e)||f8(e))}function xw(e){return!!e.constructor&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}function f8(e){return typeof e.readFloatLE=="function"&&typeof e.slice=="function"&&xw(e.slice(0,0))}function Sw(){throw new Error("setTimeout has not been defined")}function Aw(){throw new Error("clearTimeout has not been defined")}var ys=Sw,ws=Aw;typeof pr.setTimeout=="function"&&(ys=setTimeout),typeof pr.clearTimeout=="function"&&(ws=clearTimeout);function Bw(e){if(ys===setTimeout)return setTimeout(e,0);if((ys===Sw||!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 u8(e){if(ws===clearTimeout)return clearTimeout(e);if((ws===Aw||!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,Su=-1;function l8(){!ea||!no||(ea=!1,no.length?Hi=no.concat(Hi):Su=-1,Hi.length&&Iw())}function Iw(){if(!ea){var e=Bw(l8);ea=!0;for(var t=Hi.length;t;){for(no=Hi,Hi=[];++Su1)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]),Tu(t)?r.showHidden=t:t&&Ld(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=z8),Ru(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 z8(e,t){var r=xi.styles[t];return r?"\x1B["+xi.colors[r][0]+"m"+e+"\x1B["+xi.colors[r][1]+"m":e}function q8(e,t){return e}function V8(e){var t={};return e.forEach(function(r,n){t[r]=!0}),t}function Ru(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=Ru(e,n,r)),n}var i=W8(e,t);if(i)return i;var s=Object.keys(t),o=V8(s);if(e.showHidden&&(s=Object.getOwnPropertyNames(t)),cc(t)&&(s.indexOf("message")>=0||s.indexOf("description")>=0))return Ad(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(ku(t))return e.stylize(Date.prototype.toString.call(t),"date");if(cc(t))return Ad(t)}var c="",u=!1,l=["{","}"];if(Id(t)&&(u=!0,l=["[","]"]),fc(t)){var y=t.name?": "+t.name:"";c=" [Function"+y+"]"}if(ac(t)&&(c=" "+RegExp.prototype.toString.call(t)),ku(t)&&(c=" "+Date.prototype.toUTCString.call(t)),cc(t)&&(c=" "+Ad(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=K8(e,t,r,o,s):A=s.map(function(v){return Bd(e,t,r,o,v,u)}),e.seen.pop(),Z8(A,c,l)}function W8(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(Td(t))return e.stylize(""+t,"number");if(Tu(t))return e.stylize(""+t,"boolean");if(ji(t))return e.stylize("null","null")}function Ad(e){return"["+Error.prototype.toString.call(e)+"]"}function K8(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 Z8(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 Id(e){return Array.isArray(e)}function Tu(e){return typeof e=="boolean"}function ji(e){return e===null}function Rd(e){return e==null}function Td(e){return typeof e=="number"}function ms(e){return typeof e=="string"}function Lw(e){return typeof e=="symbol"}function Si(e){return e===void 0}function ac(e){return zi(e)&&kd(e)==="[object RegExp]"}function zi(e){return typeof e=="object"&&e!==null}function ku(e){return zi(e)&&kd(e)==="[object Date]"}function cc(e){return zi(e)&&(kd(e)==="[object Error]"||e instanceof Error)}function fc(e){return typeof e=="function"}function $w(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}function Ow(e){return le.isBuffer(e)}function kd(e){return Object.prototype.toString.call(e)}function Cd(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=[Cd(e.getHours()),Cd(e.getMinutes()),Cd(e.getSeconds())].join(":");return[e.getDate(),X8[e.getMonth()],t].join(" ")}function Mw(){console.log("%s - %s",J8(),Au.apply(null,arguments))}function Ld(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 Nw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var oo=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function $d(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 Od=hf.exports.Buffer,Uw=Od.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"&&(Od.isEncoding===Uw||!Uw(e)))throw new Error("Unknown encoding: "+e);return t||e}var Fw=uc;function uc(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=Od.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 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=Dw;var Vt=Sd("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 Dw(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 Fw(e.encoding),this.encoding=e.encoding)}function ar(e){if(!(this instanceof ar))return new ar(e);this._readableState=new Dw(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="")),Hw(this,r,e,t,!1)},ar.prototype.unshift=function(e){var t=this._readableState;return Hw(this,t,e,"",!0)},ar.prototype.isPaused=function(){return this._readableState.flowing===!1};function Hw(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&&Cu(e))),_R(e,t)}else i||(t.reading=!1);return wR(t)}function wR(e){return!e.ended&&(e.needReadable||e.length=jw?e=jw:(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?Pd(this):Cu(this),null;if(e=zw(e,t),e===0&&t.ended)return t.length===0&&Pd(this),null;var n=t.needReadable;Vt("need readable",n),(t.length===0||t.length-e0?i=Vw(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&&Pd(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,Cu(e)}}function Cu(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Vt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?On(qw,e):qw(e))}function qw(e){Vt("emit readable"),e.emit("readable"),Nd(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&&Ww(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,Nd(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 Pd(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===co.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"},qd=hc-tm,ra=Math.floor,Vd=String.fromCharCode;function rm(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+=ra(e/t);e>qd*zd>>1;n+=hc)e=ra(e/qd);return ra(n+(qd+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(Vd(c));const o=t.length;let a=o;for(o&&t.push(tT);a=n&&lra((jd-i)/u)&&rm("overflow"),i+=(c-n)*u,n=c;for(const l of e)if(ljd&&rm("overflow"),l===n){let y=i;for(let A=hc;;A+=hc){const v=A<=s?tm:A>=s+zd?zd: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)?im(i[v])?i[v].push(R):i[v]=[i[v],R]:i[v]=R}return i}const am=pr.URL,cm=pr.URLSearchParams;var pT={parse:fo,resolve:gm,resolveObject:ym,fileURLToPath:dm,format:pm,Url:Mn,URL:am,URLSearchParams:cm};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),Wd=["'"].concat(bT),fm=["%","/","?",";","#"].concat(Wd),um=["/","?","#"],vT=255,lm=/^[+a-z0-9A-Z_-]{0,63}$/,_T=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,ET={javascript:!0,"javascript:":!0},Kd={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 hm(this,e,t,r)};function hm(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(lm)){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=Wd.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 wm(this)};function wm(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:fo,resolve:gm,resolveObject:ym,fileURLToPath:dm,format:pm,URL:am,URLSearchParams:cm,default:pT,Url:Mn});function Gd(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 mm(e,t){var r=Gd(e,t);return r.end(),r}function Yd(){}Yd.defaultMaxSockets=4;var bm=["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"],vm={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:Gd,get:mm,Agent:Yd,METHODS:bm,STATUS_CODES:vm},BT=Object.freeze({__proto__:null,request:Gd,get:mm,Agent:Yd,METHODS:bm,STATUS_CODES:vm,default:AT}),IT=Un(BT);function Xd(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 _m(e,t){var r=Xd(e,t);return r.end(),r}function Jd(){}Jd.defaultMaxSockets=4;var Em=["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"],xm={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:Xd,get:_m,Agent:Jd,METHODS:Em,STATUS_CODES:xm},TT=Object.freeze({__proto__:null,request:Xd,get:_m,Agent:Jd,METHODS:Em,STATUS_CODES:xm,default:RT}),kT=Un(TT),Sm={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 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 OT=0,Im=1,MT=2,NT=3,PT=258,Qd=29,pc=256,gc=pc+1+Qd,sa=30,e0=19,Rm=2*gc+1,uo=15,t0=16,UT=7,r0=256,Tm=16,km=17,Cm=18,n0=[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],Mu=[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],Lm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],DT=512,Wi=new Array((gc+2)*2);ia(Wi);var yc=new Array(sa*2);ia(yc);var wc=new Array(DT);ia(wc);var mc=new Array(PT-NT+1);ia(mc);var i0=new Array(Qd);ia(i0);var Nu=new Array(sa);ia(Nu);function s0(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 $m,Om,Mm;function o0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Nm(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>t0-r?(e.bi_buf|=t<>t0-e.bi_valid,e.bi_valid+=r-t0):(e.bi_buf|=t<>>=1,r<<=1;while(--t>0);return r>>>1}function HT(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 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<=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 Um(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]=Pm(n[a]++,a))}}function zT(){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 qT(e,t,r,n){Dm(e),n&&(bc(e,r),bc(e,~r)),Vi(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Hm(e,t,r,n){var i=t*2,s=r*2;return e[i]>1;o>=1;o--)a0(e,r,o);u=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],a0(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++,a0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],jT(e,t),Um(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[Lm[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 Am;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Bm;for(r=32;r0?(e.strm.data_type===$T&&(e.strm.data_type=KT(e)),c0(e,e.l_desc),c0(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?Wm(e,t,r,n):e.strategy===LT||s===i?(En(e,(Im<<1)+(n?1:0),3),jm(e,Wi,yc)):(En(e,(MT<<1)+(n?1:0),3),WT(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),jm(e,e.dyn_ltree,e.dyn_dtree)),Fm(e),n&&Dm(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[Nm(t)*2]++),e.last_lit===e.lit_bufsize-1}function f0(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 lo=0,QT=1,e4=3,vs=4,Km=5,_s=0,Zm=1,Es=-2,t4=-3,u0=-5,r4=-1,n4=1,Pu=2,i4=3,s4=4,o4=2,l0=8,a4=9,c4=29,f4=256,h0=f4+1+c4,u4=30,l4=19,h4=2*h0+1,d4=15,Ft=3,xs=258,si=xs+Ft+1,p4=32,d0=42,p0=69,Uu=73,Fu=91,Du=103,ho=113,vc=666,$r=1,_c=2,po=3,oa=4,g4=3;function Ss(e,t){return e.msg=Sm[t],t}function Gm(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){YT(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 y4(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=f0(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 Ym(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=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(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 g0(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 b4(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,w4),new Bi(4,4,8,4,g0),new Bi(4,5,16,8,g0),new Bi(4,6,32,32,g0),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 v4(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 _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=l0,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),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(d4+1),this.heap=new Xn(2*h0+1),go(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xn(2*h0+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 E4(e){var t;return!e||!e.state?Ss(e,Es):(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?d0:ho,e.adler=t.wrap===2?0:1,t.last_flush=lo,ZT(t),_s)}function Xm(e){var t=E4(e);return t===_s&&v4(e.state),t}function x4(e,t,r,n,i,s){if(!e)return Es;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!==l0||n<8||n>15||t<0||t>9||s<0||s>s4)return Ss(e,Es);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<Km||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?u0:Es);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===d0)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>=Pu||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=p0):(Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,n.level===9?2:n.strategy>=Pu||n.level<2?4:0),Pt(n,g4),n.status=ho);else{var o=l0+(n.w_bits-8<<4)<<8,a=-1;n.strategy>=Pu||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=ho,Ec(n,o),n.strstart!==0&&(Ec(n,e.adler>>>16),Ec(n,e.adler&65535)),e.adler=1}if(n.status===p0)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=Uu)}else n.status=Uu;if(n.status===Uu)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=Fu)}else n.status=Fu;if(n.status===Fu)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=Du)}else n.status=Du;if(n.status===Du&&(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&&Gm(t)<=Gm(r)&&t!==vs)return Ss(e,u0);if(n.status===vc&&e.avail_in!==0)return Ss(e,u0);if(e.avail_in!==0||n.lookahead!==0||t!==lo&&n.status!==vc){var c=n.strategy===Pu?b4(n,t):n.strategy===i4?m4(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===QT?GT(n):t!==Km&&(Wm(n,0,0,!1),t===e4&&(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 A4(e){var t;return!e||!e.state?Es:(t=e.state.status,t!==d0&&t!==p0&&t!==Uu&&t!==Fu&&t!==Du&&t!==ho&&t!==vc?Ss(e,Es):(e.state=null,t===ho?Ss(e,t4):_s))}var Hu=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=Hu;break e}if(v>>>=$,R-=$,$=s-o,G>$){if($=G-$,$>l&&r.sane){e.msg="invalid distance too far back",r.mode=Hu;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=Hu;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=Hu;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===eb||A!==1))return-1;for(I[1]=0,u=1;uJm||e===tb&&H>Qm)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<Jm||e===tb&&H>Qm)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,rb=1,nb=2,ib=4,$4=5,ju=6,Ac=0,O4=1,M4=2,Bs=-2,N4=-3,P4=-4,U4=-5,sb=8,ob=1,ab=2,cb=3,fb=4,ub=5,lb=6,hb=7,db=8,pb=9,gb=10,yb=11,Ki=12,w0=13,wb=14,m0=15,mb=16,bb=17,vb=18,_b=19,zu=20,qu=21,Eb=22,xb=23,Sb=24,Ab=25,Bb=26,b0=27,Ib=28,Rb=29,cr=30,F4=31,D4=32,H4=852,j4=592;function Tb(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?Bs:(t=e.state,e.total_in=e.total_out=t.total=0,e.msg="",t.wrap&&(e.adler=t.wrap&1),t.mode=ob,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Ou(H4),t.distcode=t.distdyn=new Ou(j4),t.sane=1,t.back=-1,Ac)}function kb(e){var t;return!e||!e.state?Bs:(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))?Bs:(n.window!==null&&n.wbits!==t&&(n.window=null),n.wrap=r,n.wbits=t,kb(e))}function W4(e,t){var r,n;return e?(n=new z4,e.state=n,n.window=null,r=V4(e,t),r!==Ac&&(e.state=null),r):Bs}var Cb=!0,v0,_0;function K4(e){if(Cb){var t;for(v0=new Ou(512),_0=new Ou(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(rb,e.lens,0,288,v0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Sc(nb,e.lens,0,32,_0,0,e.work,{bits:5}),Cb=!1}e.lencode=v0,e.lenbits=9,e.distcode=_0,e.distbits=5}function Z4(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=ab;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)!==sb){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=cb;case cb: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=fb;case fb: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=ub;case ub: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=lb;case lb: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=hb;case hb: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 gb:for(;l<32;){if(a===0)break e;a--,u+=n[s++]<>>=l&7,l-=l&7,r.mode=b0;break}for(;l<3;){if(a===0)break e;a--,u+=n[s++]<>>=1,l-=1,u&3){case 0:r.mode=wb;break;case 1:if(K4(r),r.mode=zu,t===ju){u>>>=2,l-=2;break e}break;case 2:r.mode=bb;break;case 3:e.msg="invalid block type",r.mode=cr}u>>>=2,l-=2;break;case wb: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=m0,t===ju)break e;case m0:r.mode=mb;case mb: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 bb: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=vb;case vb: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(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=_b;case _b: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(rb,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(nb,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=zu,t===ju)break e;case zu:r.mode=qu;case qu: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===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=Bb;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=Eb;case Eb:if(r.extra){for(Q=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=xb;case xb: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=Sb;case Sb: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=Ab;case Ab: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=qu);break;case Bb:if(c===0)break e;i[o++]=r.length,c--,r.mode=qu;break;case b0: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===Wu)&&(this.windowBits+=16),this.mode===Rc&&(this.windowBits+=32),(this.mode===la||this.mode===Ic)&&(this.windowBits=-this.windowBits),this.strm=new CT;var s;switch(this.mode){case ua:case Bc:case la:s=x4(this.strm,this.level,Db,this.windowBits,this.memLevel,this.strategy);break;case Vu:case Wu:case Ic:case Rc:s=W4(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(s!==Ku){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===E0)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=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(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(Is,fr),qr(Rs,fr),qr(Ts,fr),qr(ks,fr),qr(Cs,fr),qr(Ls,fr),qr($s,fr);var g5={codes:ha,createDeflate:jb,createInflate:zb,createDeflateRaw:qb,createInflateRaw:Vb,createGzip:Wb,createGunzip:Kb,createUnzip:Zb,deflate:Gb,deflateSync:Yb,gzip:Xb,gzipSync:Jb,deflateRaw:Qb,deflateRawSync:ev,unzip:tv,unzipSync:rv,inflate:nv,inflateSync:iv,gunzip:sv,gunzipSync:ov,inflateRaw:av,inflateRawSync:cv,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr},y5=Object.freeze({__proto__:null,codes:ha,createDeflate:jb,createInflate:zb,createDeflateRaw:qb,createInflateRaw:Vb,createGzip:Wb,createGunzip:Kb,createUnzip:Zb,deflate:Gb,deflateSync:Yb,gzip:Xb,gzipSync:Jb,deflateRaw:Qb,deflateRawSync:ev,unzip:tv,unzipSync:rv,inflate:nv,inflateSync:iv,gunzip:sv,gunzipSync:ov,inflateRaw:av,inflateRawSync:cv,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr,default:g5}),w5=Un(y5),m5=Un(tR),b5=Un(ST);Object.defineProperty(to,"__esModule",{value:!0}),to.InvalidStatusCodeError=to.InvalidCertError=void 0;const fv=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class S0 extends Error{constructor(t,r){super(t),this.fingerprint256=r}}to.InvalidCertError=S0;class A0 extends Error{constructor(t){super(`Request Failed. Status Code: ${t}`),this.statusCode=t}}to.InvalidStatusCodeError=A0;function uv(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 lv={};function B0(e,t){let r={...fv,...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=lv[v]||(lv[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 B0(a(e,A.headers.location),r)}if(r.expectStatusCode&&v!==r.expectStatusCode)throw A.resume(),new A0(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=uv(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 B0(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(N){N&&N.fingerprint256&&(F=new S0(`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 S0(`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={...fv,...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 A0(o.status);const a=uv(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?B0:E5)(e,t)}to.default=S5,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.getProvider=Qo.fetchFromProvider=void 0;const A5=to,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;Qo.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")};Qo.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(Qf,e),r(au,e),r(id,e),r(rc,e),r(du,e),r(an,e),r(eo,e),r(hd,e),r(aw,e),r(yu,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(wu,e),r(Qo,e)}(Jf);var Qr={},oe={},da={},Rt={},Jn={},Os={},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 hv=(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))(hv||{}),dv=/"|\\|\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 pv(e){return e.charCodeAt(0)<=127}function M5(e){return e.split("").reduce((r,n)=>pv(n)?r+1:r+2,0)+R5(e.match(dv),()=>[]).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=hv,dn.ESCAPE_CHARACTERS_REGEXP=dv,dn.isPlainObject=O5,dn.isASCII=pv,dn.calculateStringSize=M5,dn.calculateNumberSize=N5;class I0 extends Error{constructor(t,{cause:r}={}){super(t),this.name=I0.name,r&&(this.cause=r),this.message=t}}var P5=Object.freeze({__proto__:null,ErrorWithCause:I0}),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=Gu(n)}},Gu=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},gv=(e,t)=>{if(!(e instanceof Error))return"";const r=e.stack||"";if(t.has(e))return r+` + `)+" "+r[1]:r[0]+t+" "+e.join(", ")+" "+r[1]}function Id(e){return Array.isArray(e)}function Tu(e){return typeof e=="boolean"}function ji(e){return e===null}function Rd(e){return e==null}function Td(e){return typeof e=="number"}function ms(e){return typeof e=="string"}function Cw(e){return typeof e=="symbol"}function Si(e){return e===void 0}function ac(e){return zi(e)&&kd(e)==="[object RegExp]"}function zi(e){return typeof e=="object"&&e!==null}function ku(e){return zi(e)&&kd(e)==="[object Date]"}function cc(e){return zi(e)&&(kd(e)==="[object Error]"||e instanceof Error)}function fc(e){return typeof e=="function"}function Lw(e){return e===null||typeof e=="boolean"||typeof e=="number"||typeof e=="string"||typeof e=="symbol"||typeof e>"u"}function $w(e){return le.isBuffer(e)}function kd(e){return Object.prototype.toString.call(e)}function Cd(e){return e<10?"0"+e.toString(10):e.toString(10)}var G8=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function Y8(){var e=new Date,t=[Cd(e.getHours()),Cd(e.getMinutes()),Cd(e.getSeconds())].join(":");return[e.getDate(),G8[e.getMonth()],t].join(" ")}function Ow(){console.log("%s - %s",Y8(),Au.apply(null,arguments))}function Ld(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 Mw(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var oo=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;function $d(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 Od=hf.exports.Buffer,Pw=Od.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 eR(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 tR(e){var t=eR(e);if(typeof t!="string"&&(Od.isEncoding===Pw||!Pw(e)))throw new Error("Unknown encoding: "+e);return t||e}var Uw=uc;function uc(e){this.encoding=tR(e);var t;switch(this.encoding){case"utf16le":this.text=aR,this.end=cR,t=4;break;case"utf8":this.fillLast=iR,t=4;break;case"base64":this.text=fR,this.end=uR,t=3;break;default:this.write=lR,this.end=hR;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=Od.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 rR(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 nR(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 iR(e){var t=this.lastTotal-this.lastNeed,r=nR(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 sR(e,t){var r=rR(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 oR(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+"\uFFFD":t}function aR(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 cR(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 fR(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 uR(e){var t=e&&e.length?this.write(e):"";return this.lastNeed?t+this.lastChar.toString("base64",0,3-this.lastNeed):t}function lR(e){return e.toString(this.encoding)}function hR(e){return e&&e.length?this.write(e):""}ar.ReadableState=Fw;var Vt=Sd("stream");qr(ar,Dn.exports);function dR(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 pR(e,t){return e.listeners(t).length}function Fw(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 Uw(e.encoding),this.encoding=e.encoding)}function ar(e){if(!(this instanceof ar))return new ar(e);this._readableState=new Fw(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="")),Dw(this,r,e,t,!1)},ar.prototype.unshift=function(e){var t=this._readableState;return Dw(this,t,e,"",!0)},ar.prototype.isPaused=function(){return this._readableState.flowing===!1};function Dw(e,t,r,n,i){var s=wR(t,r);if(s)e.emit("error",s);else if(r===null)t.reading=!1,mR(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&&Cu(e))),bR(e,t)}else i||(t.reading=!1);return gR(t)}function gR(e){return!e.ended&&(e.needReadable||e.length=Hw?e=Hw:(e--,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e++),e}function jw(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=yR(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?Pd(this):Cu(this),null;if(e=jw(e,t),e===0&&t.ended)return t.length===0&&Pd(this),null;var n=t.needReadable;Vt("need readable",n),(t.length===0||t.length-e0?i=qw(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&&Pd(this)),i!==null&&this.emit("data",i),i};function wR(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 mR(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,Cu(e)}}function Cu(e){var t=e._readableState;t.needReadable=!1,t.emittedReadable||(Vt("emitReadable",t.flowing),t.emittedReadable=!0,t.sync?On(zw,e):zw(e))}function zw(e){Vt("emit readable"),e.emit("readable"),Nd(e)}function bR(e,t){t.readingMore||(t.readingMore=!0,On(vR,e,t))}function vR(e,t){for(var r=t.length;!t.reading&&!t.flowing&&!t.ended&&t.length1&&Vw(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),pR(e,"error")===0&&e.emit("error",H)}dR(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 _R(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,Nd(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=AR(e,t.buffer,t.decoder),r}function AR(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 IR(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 Pd(e){var t=e._readableState;if(t.length>0)throw new Error('"endReadable()" called on non-empty stream');t.endEmitted||(t.ended=!0,On(RR,t,e))}function RR(e,t){!e.endEmitted&&e.length===0&&(e.endEmitted=!0,t.readable=!1,t.emit("end"))}function TR(e,t){for(var r=0,n=e.length;r-1))throw new TypeError("Unknown encoding: "+t);return this._writableState.defaultEncoding=t,this};function OR(e,t,r){return!e.objectMode&&e.decodeStrings!==!1&&typeof t=="string"&&(t=ie.Buffer.from(t,r)),t}function MR(e,t,r,n,i){r=OR(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 VR(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"},qd=hc-em,ra=Math.floor,Vd=String.fromCharCode;function tm(e){throw new RangeError(rT[e])}function nT(e,t){const r=[];let n=e.length;for(;n--;)r[n]=t(e[n]);return r}function iT(e,t){const r=e.split("@");let n="";r.length>1&&(n=r[0]+"@",e=r[1]),e=e.replace(tT,".");const i=e.split("."),s=nT(i,t).join(".");return n+s}function sT(e){const t=[];let r=0;const n=e.length;for(;r=55296&&i<=56319&&r>1,e+=ra(e/t);e>qd*zd>>1;n+=hc)e=ra(e/qd);return ra(n+(qd+1)*e/(e+GR))},aT=function(e){const t=[];e=sT(e);const r=e.length;let n=JR,i=0,s=XR;for(const c of e)c<128&&t.push(Vd(c));const o=t.length;let a=o;for(o&&t.push(QR);a=n&&lra((jd-i)/u)&&tm("overflow"),i+=(c-n)*u,n=c;for(const l of e)if(ljd&&tm("overflow"),l===n){let y=i;for(let A=hc;;A+=hc){const v=A<=s?em:A>=s+zd?zd: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),fT(i,v)?nm(i[v])?i[v].push(R):i[v]=[i[v],R]:i[v]=R}return i}const om=pr.URL,am=pr.URLSearchParams;var hT={parse:fo,resolve:pm,resolveObject:gm,fileURLToPath:hm,format:dm,Url:Mn,URL:om,URLSearchParams:am};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 dT=/^([a-z0-9.+-]+:)/i,pT=/:[0-9]*$/,gT=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,yT=["<",">",'"',"`"," ","\r",` +`," "],wT=["{","}","|","\\","^","`"].concat(yT),Wd=["'"].concat(wT),cm=["%","/","?",";","#"].concat(Wd),fm=["/","?","#"],mT=255,um=/^[+a-z0-9A-Z_-]{0,63}$/,bT=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,vT={javascript:!0,"javascript:":!0},Kd={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 lm(this,e,t,r)};function lm(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(um)){var se=q.slice(0,v),Q=q.slice(v+1),I=G.match(bT);I&&(se.push(I[1]),Q.unshift(I[2])),Q.length&&(c="/"+Q.join(".")+c),e.hostname=se.join(".");break}}}}e.hostname.length>mT?e.hostname="":e.hostname=e.hostname.toLowerCase(),$||(e.hostname=cT(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(!vT[y])for(v=0,O=Wd.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 ym(this)};function ym(e){var t=e.host,r=pT.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 ET=Object.freeze({__proto__:null,parse:fo,resolve:pm,resolveObject:gm,fileURLToPath:hm,format:dm,URL:om,URLSearchParams:am,default:hT,Url:Mn});function Gd(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 wm(e,t){var r=Gd(e,t);return r.end(),r}function Yd(){}Yd.defaultMaxSockets=4;var mm=["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"],bm={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"},xT={request:Gd,get:wm,Agent:Yd,METHODS:mm,STATUS_CODES:bm},ST=Object.freeze({__proto__:null,request:Gd,get:wm,Agent:Yd,METHODS:mm,STATUS_CODES:bm,default:xT}),AT=Un(ST);function Xd(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 vm(e,t){var r=Xd(e,t);return r.end(),r}function Jd(){}Jd.defaultMaxSockets=4;var _m=["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"],Em={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"},BT={request:Xd,get:vm,Agent:Jd,METHODS:_m,STATUS_CODES:Em},IT=Object.freeze({__proto__:null,request:Xd,get:vm,Agent:Jd,METHODS:_m,STATUS_CODES:Em,default:BT}),RT=Un(IT),xm={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 TT(){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 LT=0,Bm=1,$T=2,OT=3,MT=258,Qd=29,pc=256,gc=pc+1+Qd,sa=30,e0=19,Im=2*gc+1,uo=15,t0=16,NT=7,r0=256,Rm=16,Tm=17,km=18,n0=[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],Mu=[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],PT=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],Cm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],UT=512,Wi=new Array((gc+2)*2);ia(Wi);var yc=new Array(sa*2);ia(yc);var wc=new Array(UT);ia(wc);var mc=new Array(MT-OT+1);ia(mc);var i0=new Array(Qd);ia(i0);var Nu=new Array(sa);ia(Nu);function s0(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 Lm,$m,Om;function o0(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function Mm(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>t0-r?(e.bi_buf|=t<>t0-e.bi_valid,e.bi_valid+=r-t0):(e.bi_buf|=t<>>=1,r<<=1;while(--t>0);return r>>>1}function FT(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 DT(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 Pm(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]=Nm(n[a]++,a))}}function HT(){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 jT(e,t,r,n){Fm(e),n&&(bc(e,r),bc(e,~r)),Vi(e.pending_buf,e.window,t,r,e.pending),e.pending+=r}function Dm(e,t,r,n){var i=t*2,s=r*2;return e[i]>1;o>=1;o--)a0(e,r,o);u=s;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],a0(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++,a0(e,r,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],DT(e,t),Pm(r,c,e.bl_count)}function jm(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[Cm[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function qT(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 Sm;if(e.dyn_ltree[9*2]!==0||e.dyn_ltree[10*2]!==0||e.dyn_ltree[13*2]!==0)return Am;for(r=32;r0?(e.strm.data_type===CT&&(e.strm.data_type=VT(e)),c0(e,e.l_desc),c0(e,e.d_desc),o=zT(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?Vm(e,t,r,n):e.strategy===kT||s===i?(En(e,(Bm<<1)+(n?1:0),3),Hm(e,Wi,yc)):(En(e,($T<<1)+(n?1:0),3),qT(e,e.l_desc.max_code+1,e.d_desc.max_code+1,o+1),Hm(e,e.dyn_ltree,e.dyn_dtree)),Um(e),n&&Fm(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[Mm(t)*2]++),e.last_lit===e.lit_bufsize-1}function f0(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 GT(){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 YT=GT();function Vr(e,t,r,n){var i=YT,s=n+r;e^=-1;for(var o=n;o>>8^i[(e^t[o])&255];return e^-1}var lo=0,XT=1,JT=3,vs=4,Wm=5,_s=0,Km=1,Es=-2,QT=-3,u0=-5,e4=-1,t4=1,Pu=2,r4=3,n4=4,i4=2,l0=8,s4=9,o4=29,a4=256,h0=a4+1+o4,c4=30,f4=19,u4=2*h0+1,l4=15,Ft=3,xs=258,si=xs+Ft+1,h4=32,d0=42,p0=69,Uu=73,Fu=91,Du=103,ho=113,vc=666,$r=1,_c=2,po=3,oa=4,d4=3;function Ss(e,t){return e.msg=xm[t],t}function Zm(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){ZT(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 p4(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=f0(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 Gm(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=p4(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 g0(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 w4(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,g4),new Bi(4,4,8,4,g0),new Bi(4,5,16,8,g0),new Bi(4,6,32,32,g0),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 m4(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 b4(){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=l0,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(u4*2),this.dyn_dtree=new Xn((2*c4+1)*2),this.bl_tree=new Xn((2*f4+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(l4+1),this.heap=new Xn(2*h0+1),go(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Xn(2*h0+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 v4(e){var t;return!e||!e.state?Ss(e,Es):(e.total_in=e.total_out=0,e.data_type=i4,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?d0:ho,e.adler=t.wrap===2?0:1,t.last_flush=lo,WT(t),_s)}function Ym(e){var t=v4(e);return t===_s&&m4(e.state),t}function _4(e,t,r,n,i,s){if(!e)return Es;var o=1;if(t===e4&&(t=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>s4||r!==l0||n<8||n>15||t<0||t>9||s<0||s>n4)return Ss(e,Es);n===8&&(n=9);var a=new b4;return e.state=a,a.strm=e,a.wrap=o,a.gzhead=null,a.w_bits=n,a.w_size=1<Wm||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?u0:Es);if(n.strm=e,r=n.last_flush,n.last_flush=t,n.status===d0)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>=Pu||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=p0):(Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,0),Pt(n,n.level===9?2:n.strategy>=Pu||n.level<2?4:0),Pt(n,d4),n.status=ho);else{var o=l0+(n.w_bits-8<<4)<<8,a=-1;n.strategy>=Pu||n.level<2?a=0:n.level<6?a=1:n.level===6?a=2:a=3,o|=a<<6,n.strstart!==0&&(o|=h4),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===p0)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=Uu)}else n.status=Uu;if(n.status===Uu)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=Fu)}else n.status=Fu;if(n.status===Fu)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=Du)}else n.status=Du;if(n.status===Du&&(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&&Zm(t)<=Zm(r)&&t!==vs)return Ss(e,u0);if(n.status===vc&&e.avail_in!==0)return Ss(e,u0);if(e.avail_in!==0||n.lookahead!==0||t!==lo&&n.status!==vc){var c=n.strategy===Pu?w4(n,t):n.strategy===r4?y4(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===XT?KT(n):t!==Wm&&(Vm(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?Km:(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:Km)}function x4(e){var t;return!e||!e.state?Es:(t=e.state.status,t!==d0&&t!==p0&&t!==Uu&&t!==Fu&&t!==Du&&t!==ho&&t!==vc?Ss(e,Es):(e.state=null,t===ho?Ss(e,QT):_s))}var Hu=30,S4=12;function A4(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=Hu;break e}if(v>>>=$,R-=$,$=s-o,G>$){if($=G-$,$>l&&r.sane){e.msg="invalid distance too far back",r.mode=Hu;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=Hu;break e}else{N=P[(N&65535)+(v&(1<<$)-1)];continue r}break}}else if($&64)if($&32){r.mode=S4;break e}else{e.msg="invalid literal/length code",r.mode=Hu;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===Qm||A!==1))return-1;for(I[1]=0,u=1;uXm||e===eb&&H>Jm)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<Xm||e===eb&&H>Jm)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 k4=0,tb=1,rb=2,nb=4,C4=5,ju=6,Ac=0,L4=1,$4=2,Bs=-2,O4=-3,M4=-4,N4=-5,ib=8,sb=1,ob=2,ab=3,cb=4,fb=5,ub=6,lb=7,hb=8,db=9,pb=10,gb=11,Ki=12,w0=13,yb=14,m0=15,wb=16,mb=17,bb=18,vb=19,zu=20,qu=21,_b=22,Eb=23,xb=24,Sb=25,Ab=26,b0=27,Bb=28,Ib=29,cr=30,P4=31,U4=32,F4=852,D4=592;function Rb(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function H4(){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 j4(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=sb,t.last=0,t.havedict=0,t.dmax=32768,t.head=null,t.hold=0,t.bits=0,t.lencode=t.lendyn=new Ou(F4),t.distcode=t.distdyn=new Ou(D4),t.sane=1,t.back=-1,Ac)}function Tb(e){var t;return!e||!e.state?Bs:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,j4(e))}function z4(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,Tb(e))}function q4(e,t){var r,n;return e?(n=new H4,e.state=n,n.window=null,r=z4(e,t),r!==Ac&&(e.state=null),r):Bs}var kb=!0,v0,_0;function V4(e){if(kb){var t;for(v0=new Ou(512),_0=new Ou(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(tb,e.lens,0,288,v0,0,e.work,{bits:9}),t=0;t<32;)e.lens[t++]=5;Sc(rb,e.lens,0,32,_0,0,e.work,{bits:5}),kb=!1}e.lencode=v0,e.lenbits=9,e.distcode=_0,e.distbits=5}function W4(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=ob;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)!==ib){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=ab;case ab: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=cb;case cb: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=fb;case fb: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=ub;case ub: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=lb;case lb: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 pb:for(;l<32;){if(a===0)break e;a--,u+=n[s++]<>>=l&7,l-=l&7,r.mode=b0;break}for(;l<3;){if(a===0)break e;a--,u+=n[s++]<>>=1,l-=1,u&3){case 0:r.mode=yb;break;case 1:if(V4(r),r.mode=zu,t===ju){u>>>=2,l-=2;break e}break;case 2:r.mode=mb;break;case 3:e.msg="invalid block type",r.mode=cr}u>>>=2,l-=2;break;case yb: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=m0,t===ju)break e;case m0:r.mode=wb;case wb: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 mb: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=bb;case bb: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(k4,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=vb;case vb: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(tb,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(rb,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=zu,t===ju)break e;case zu:r.mode=qu;case qu: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,A4(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=Ab;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=_b;case _b:if(r.extra){for(Q=r.extra;l>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=Eb;case Eb: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=xb;case xb: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=Sb;case Sb: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=qu);break;case Ab:if(c===0)break e;i[o++]=r.length,c--,r.mode=qu;break;case b0: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===Wu)&&(this.windowBits+=16),this.mode===Rc&&(this.windowBits+=32),(this.mode===la||this.mode===Ic)&&(this.windowBits=-this.windowBits),this.strm=new TT;var s;switch(this.mode){case ua:case Bc:case la:s=_4(this.strm,this.level,Fb,this.windowBits,this.memLevel,this.strategy);break;case Vu:case Wu:case Ic:case Rc:s=q4(this.strm,this.windowBits);break;default:throw new Error("Unknown mode "+this.mode)}if(s!==Ku){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===E0)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 l5(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(h5(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 d5={codes:ha,createDeflate:Hb,createInflate:jb,createDeflateRaw:zb,createInflateRaw:qb,createGzip:Vb,createGunzip:Wb,createUnzip:Kb,deflate:Zb,deflateSync:Gb,gzip:Yb,gzipSync:Xb,deflateRaw:Jb,deflateRawSync:Qb,unzip:ev,unzipSync:tv,inflate:rv,inflateSync:nv,gunzip:iv,gunzipSync:sv,inflateRaw:ov,inflateRawSync:av,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr},p5=Object.freeze({__proto__:null,codes:ha,createDeflate:Hb,createInflate:jb,createDeflateRaw:zb,createInflateRaw:qb,createGzip:Vb,createGunzip:Wb,createUnzip:Kb,deflate:Zb,deflateSync:Gb,gzip:Yb,gzipSync:Xb,deflateRaw:Jb,deflateRawSync:Qb,unzip:ev,unzipSync:tv,inflate:rv,inflateSync:nv,gunzip:iv,gunzipSync:sv,inflateRaw:ov,inflateRawSync:av,Deflate:Is,Inflate:Rs,Gzip:Ts,Gunzip:ks,DeflateRaw:Cs,InflateRaw:Ls,Unzip:$s,Zlib:fr,default:d5}),g5=Un(p5),y5=Un(Q8),w5=Un(ET);Object.defineProperty(to,"__esModule",{value:!0}),to.InvalidStatusCodeError=to.InvalidCertError=void 0;const cv=Object.freeze({redirect:!0,expectStatusCode:200,headers:{},full:!1,keepAlive:!0,cors:!1,referrer:!1,sslAllowSelfSigned:!1,_redirectCount:0});class S0 extends Error{constructor(t,r){super(t),this.fingerprint256=r}}to.InvalidCertError=S0;class A0 extends Error{constructor(t){super(`Request Failed. Status Code: ${t}`),this.statusCode=t}}to.InvalidStatusCodeError=A0;function fv(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 uv={};function B0(e,t){let r={...cv,...t};const n=AT,i=RT,s=g5,{promisify:o}=y5,{resolve:a}=w5,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=uv[v]||(uv[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 B0(a(e,A.headers.location),r)}if(r.expectStatusCode&&v!==r.expectStatusCode)throw A.resume(),new A0(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=fv(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 B0(e,{...r,sslAllowSelfSigned:!0,sslPinnedCertificates:[]})}catch(N){N&&N.fingerprint256&&(F=new S0(`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 S0(`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 m5=new Set(["Accept","Accept-Language","Content-Language","Content-Type"].map(e=>e.toLowerCase())),b5=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 v5(e,t){let r={...cv,...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();(m5.has(u)||r.cors&&!b5.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 A0(o.status);const a=fv(new Uint8Array(await o.arrayBuffer()),r.type);return r.full?{headers:Object.fromEntries(o.headers.entries()),status:o.status,body:a}:a}const _5=!!(typeof process=="object"&&process.versions&&process.versions.node&&process.versions.v8);function E5(e,t){return(_5?B0:v5)(e,t)}to.default=E5,Object.defineProperty(Qo,"__esModule",{value:!0}),Qo.getProvider=Qo.fetchFromProvider=void 0;const x5=to,S5=async(e,t)=>(await(0,x5.default)(e,{headers:{"content-type":"application/json"},type:"json",data:{method:t.method,params:t.params,jsonrpc:"2.0",id:1}})).result;Qo.fetchFromProvider=S5;const A5=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=A5,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(Qf,e),r(au,e),r(id,e),r(rc,e),r(du,e),r(an,e),r(eo,e),r(hd,e),r(ow,e),r(yu,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(wu,e),r(Qo,e)}(Jf);var Qr={},oe={},da={},Rt={},Jn={},Os={},dn={};Object.defineProperty(dn,"__esModule",{value:!0});function B5(e,t){return e??t()}function I5(e){return Array.isArray(e)&&e.length>0}function R5(e){return e==null}function T5(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}var k5=(e,t)=>Object.hasOwnProperty.call(e,t);function C5(e){return Object.getOwnPropertyNames(e)}var lv=(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))(lv||{}),hv=/"|\\|\n|\r|\t/gu;function L5(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 dv(e){return e.charCodeAt(0)<=127}function $5(e){return e.split("").reduce((r,n)=>dv(n)?r+1:r+2,0)+B5(e.match(hv),()=>[]).length}function O5(e){return e.toString().length}dn.isNonEmptyArray=I5,dn.isNullOrUndefined=R5,dn.isObject=T5,dn.hasProperty=k5,dn.getKnownPropertyNames=C5,dn.JsonSize=lv,dn.ESCAPE_CHARACTERS_REGEXP=hv,dn.isPlainObject=L5,dn.isASCII=dv,dn.calculateStringSize=$5,dn.calculateNumberSize=O5;class I0 extends Error{constructor(t,{cause:r}={}){super(t),this.name=I0.name,r&&(this.cause=r),this.message=t}}var M5=Object.freeze({__proto__:null,ErrorWithCause:I0}),N5=Un(M5);const P5=(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=Gu(n)}},Gu=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},pv=(e,t)=>{if(!(e instanceof Error))return"";const r=e.stack||"";if(t.has(e))return r+` causes have become circular...`;const n=Gu(e);return n?(t.add(e),r+` -caused by: `+gv(n,t)):r},D5=e=>gv(e,new Set),yv=(e,t,r)=>{if(!(e instanceof Error))return"";const n=r?"":e.message||"";if(t.has(e))return n+": ...";const i=Gu(e);if(i){t.add(e);const s="cause"in e&&typeof e.cause=="function";return n+(s?"":": ")+yv(i,t,s)}else return n};var H5=Object.freeze({__proto__:null,findCauseByReference:F5,getErrorCause:Gu,stackWithCauses:D5,messageWithCauses:e=>yv(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(Os,"__esModule",{value:!0});var wv=dn,G5=Z5;function Y5(e){return e instanceof Error||wv.isObject.call(void 0,e)&&e.constructor.name==="Error"}function mv(e){return typeof e=="object"&&e!==null&&"code"in e}function bv(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 bv(e)&&typeof e.message=="string"?e.message:wv.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}),mv(e)&&(r.code=e.code),r}return t.length>0?new Error(`${String(e)}: ${t}`):new Error(String(e))}Os.isErrorWithCode=mv,Os.isErrorWithMessage=bv,Os.isErrorWithStack=X5,Os.getErrorMessage=J5,Os.wrapError=Q5;class vv 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 _v(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*R0(e,t,r,n){ek(e)||(e=[e]);for(const i of e){const s=rk(i,t,r,n);s&&(yield s)}}function*T0(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=T0(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 R0(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return R0(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return Ev(t,this,r)}create(t,r){return xv(t,this,r)}is(t){return k0(t,this)}mask(t,r){return Sv(t,this,r)}validate(t,r={}){return pa(t,this,r)}}function Ev(e,t,r){const n=pa(e,t,{message:r});if(n[0])throw n[0]}function xv(e,t,r){const n=pa(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Sv(e,t,r){const n=pa(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function k0(e,t){return!pa(e,t)[0]}function pa(e,t,r={}){const n=T0(e,t,r),i=tk(n);return i[0]?[new vv(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?kc(n):Tc(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 kc(n);default:return Tc(n)}}function ck(e){const t=e instanceof Br,r=t?{...e.schema}:{...e};for(const n in r)r[n]=Av(r[n]);return t&&e.type==="type"?kc(r):Tc(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 kc(n);default:return Tc(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 C0(){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 Tc(e){const t=e?Object.keys(e):[],r=C0();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 Av(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 Bv(){return xn("string",e=>typeof e=="string"||`Expected a string, but received: ${Or(e)}`)}function Rk(e){const t=C0();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]=T0(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 Iv(){return xn("unknown",()=>!0)}function L0(e,t,r){return new Br({...e,coercer:(n,i)=>k0(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function kk(e,t,r={}){return L0(e,Iv(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&_v(n)&&_v(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 L0(e,Bv(),t=>t.trim())}function Lk(e){return mo(e,"empty",t=>{const r=Rv(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function Rv(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 Mk(e){return mo(e,"nonempty",t=>Rv(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function Nk(e,t){return mo(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 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=R0(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var Uk=Object.freeze({__proto__:null,Struct:Br,StructError:vv,any:lk,array:hk,assert:Ev,assign:nk,bigint:dk,boolean:pk,coerce:L0,create:xv,date:gk,defaulted:kk,define:xn,deprecated:ik,dynamic:sk,empty:Lk,enums:yk,func:wk,instance:mk,integer:bk,intersection:vk,is:k0,lazy:ok,literal:_k,map:Ek,mask:Sv,max:$k,min:Ok,never:C0,nonempty:Mk,nullable:xk,number:Sk,object:Tc,omit:ak,optional:Av,partial:ck,pattern:Nk,pick:fk,record:Ak,refine:mo,regexp:Bk,set:Ik,size:Pk,string:Bv,struct:uk,trimmed:Ck,tuple:Rk,type:kc,union:Tk,unknown:Iv,validate:pa}),Ms=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=Os,Hk=Ms;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 Tv(e,t){return jk(e)?new e({message:t}):e({message:t})}var $0=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function qk(e,t="Assertion failed.",r=$0){if(!e)throw t instanceof Error?t:Tv(r,t)}function Vk(e,t,r="Assertion failed",n=$0){try{Hk.assert.call(void 0,e,t)}catch(i){throw Tv(n,`${r}: ${zk(i)}.`)}}function Wk(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Jn.AssertionError=$0,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 Yu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}Wr.number=Yu;function kv(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}Wr.bool=kv;function Cv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}Wr.isBytes=Cv;function O0(e,...t){if(!Cv(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=O0;function Lv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yu(e.outputLen),Yu(e.blockLen)}Wr.hash=Lv;function $v(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=$v;function Ov(e,t){O0(e);const r=t.outputLen;if(e.length>M0&Xu)}:{h:Number(e>>M0&Xu)|0,l:Number(e&Xu)|0}}at.fromBig=N0;function Mv(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);at.toBig=Nv;const Pv=(e,t,r)=>e>>>r;at.shrSH=Pv;const Uv=(e,t,r)=>e<<32-r|t>>>r;at.shrSL=Uv;const Fv=(e,t,r)=>e>>>r|t<<32-r;at.rotrSH=Fv;const Dv=(e,t,r)=>e<<32-r|t>>>r;at.rotrSL=Dv;const Hv=(e,t,r)=>e<<64-r|t>>>r-32;at.rotrBH=Hv;const jv=(e,t,r)=>e>>>r-32|t<<64-r;at.rotrBL=jv;const zv=(e,t)=>t;at.rotr32H=zv;const qv=(e,t)=>e;at.rotr32L=qv;const Vv=(e,t,r)=>e<>>32-r;at.rotlSH=Vv;const Wv=(e,t,r)=>t<>>32-r;at.rotlSL=Wv;const Kv=(e,t,r)=>t<>>64-r;at.rotlBH=Kv;const Zv=(e,t,r)=>e<>>64-r;at.rotlBL=Zv;function Gv(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}at.add=Gv;const Yv=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);at.add3L=Yv;const Xv=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;at.add3H=Xv;const Jv=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);at.add4L=Jv;const Qv=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;at.add4H=Qv;const e_=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);at.add5L=e_;const t_=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;at.add5H=t_;const Zk={fromBig:N0,split:Mv,toBig:Nv,shrSH:Pv,shrSL:Uv,rotrSH:Fv,rotrSL:Dv,rotrBH:Hv,rotrBL:jv,rotr32H:zv,rotr32L:qv,rotlSH:Vv,rotlSL:Wv,rotlBH:Kv,rotlBL:Zv,add:Gv,add3L:Yv,add3H:Xv,add4L:Jv,add4H:Qv,add5H:t_,add5L:e_};at.default=Zk;var r_={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.crypto=void 0,Ju.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=Ju,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}(r_),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=r_,n_=[],i_=[],s_=[],Gk=BigInt(0),Lc=BigInt(1),Yk=BigInt(2),Xk=BigInt(7),Jk=BigInt(256),Qk=BigInt(113);for(let e=0,t=Lc,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],n_.push(2*(5*n+r)),i_.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^=Lc<<(Lc<r>32?(0,Cc.rotlBH)(e,t,r):(0,Cc.rotlSH)(e,t,r),a_=(e,t,r)=>r>32?(0,Cc.rotlBL)(e,t,r):(0,Cc.rotlSL)(e,t,r);function c_(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=o_(u,l,1)^r[a],A=a_(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=i_[o],c=o_(i,s,a),u=a_(i,s,a),l=n_[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=c_;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),c_(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 f_=(e,t,r)=>(0,Zi.wrapXOFConstructorWithOpts)((n={})=>new $c(t,e,n.dkLen===void 0?r:n.dkLen,!0));tr.shake128=f_(31,168,128/8),tr.shake256=f_(31,136,256/8);var P0={};(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})(P0),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=Ms,u_=P0,l_=48,h_=58,d_=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 U0(e){return e instanceof Uint8Array}function bo(e){Kr.assert.call(void 0,U0(e),"Value must be a Uint8Array.")}function F0(e){if(bo(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;S_(e);const t=el(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 Qu(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 y_(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 Qu(t)}function w_(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."),u_.base64.decode(e)}function m_(e){if(typeof e=="bigint")return g_(e);if(typeof e=="number")return y_(e);if(typeof e=="string")return e.startsWith("0x")?Qu(e):w_(e);if(U0(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 B_(e){return pn.is.call(void 0,e,D0)?A_(e)===e:!1}function I_(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function el(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}Rt.HexStruct=b_,Rt.StrictHexStruct=v_,Rt.HexAddressStruct=__,Rt.HexChecksumAddressStruct=D0,Rt.isHexString=E_,Rt.isStrictHexString=x_,Rt.assertIsHexString=S_,Rt.assertIsStrictHexString=gC,Rt.isValidHexAddress=yC,Rt.getChecksumAddress=A_,Rt.isValidChecksumAddress=B_,Rt.add0x=I_,Rt.remove0x=el,Rt.isBytes=U0,Rt.assertIsBytes=bo,Rt.bytesToHex=F0,Rt.bytesToBigInt=p_,Rt.bytesToSignedBigInt=oC,Rt.bytesToNumber=aC,Rt.bytesToString=cC,Rt.bytesToBase64=fC,Rt.hexToBytes=Qu,Rt.bigIntToBytes=g_,Rt.signedBigIntToBytes=lC,Rt.numberToBytes=y_,Rt.stringToBytes=w_,Rt.base64ToBytes=hC,Rt.valueToBytes=m_,Rt.concatBytes=dC,Rt.createDataView=pC,Object.defineProperty(da,"__esModule",{value:!0});var Oc=Rt,ya=Jn,wC=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))),mC=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))),bC=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},vC=e=>(Oc.assertIsHexString.call(void 0,e),BigInt(Oc.add0x.call(void 0,e)));da.numberToHex=wC,da.bigIntToHex=mC,da.hexToNumber=bC,da.hexToBigInt=vC;var H0={};Object.defineProperty(H0,"__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}}H0.createDeferredPromise=_C;var Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});var R_=(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))(R_||{}),EC=e=>Number.isInteger(e)&&e>=0,T_=(e,t)=>{if(!EC(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};function xC(e,t){return T_(e,"count"),e*t}function SC(e){return T_(e,"timestamp"),Date.now()-e}Mc.Duration=R_,Mc.inMilliseconds=xC,Mc.timeSince=SC;var ai={},vo={exports:{}};const AC="2.0.0",k_=256,BC=Number.MAX_SAFE_INTEGER||9007199254740991,IC=16,RC=k_-6;var tl={MAX_LENGTH:k_,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},rl=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}=tl,s=rl;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 TC=Object.freeze({loose:!0}),kC=Object.freeze({});var j0=e=>e?typeof e!="object"?TC:e:kC;const C_=/^[0-9]+$/,L_=(e,t)=>{const r=C_.test(e),n=C_.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eL_(t,e)};const nl=rl,{MAX_LENGTH:O_,MAX_SAFE_INTEGER:il}=tl,{safeRe:M_,t:N_}=vo.exports,CC=j0,{compareIdentifiers:wa}=$_;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>O_)throw new TypeError(`version is longer than ${O_} characters`);nl("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?M_[N_.LOOSE]:M_[N_.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>il||this.major<0)throw new TypeError("Invalid major version");if(this.minor>il||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>il||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 P_=gn;var ma=(e,t,r=!1)=>{if(e instanceof P_)return e;try{return new P_(e,t)}catch(n){if(!r)return null;throw n}};const LC=ma;var $C=(e,t)=>{const r=LC(e,t);return r?r.version:null};const OC=ma;var MC=(e,t)=>{const r=OC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const U_=gn;var NC=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new U_(e instanceof U_?e.version:e,r).inc(t,n,i).version}catch{return null}};const F_=ma;var PC=(e,t)=>{const r=F_(e,null,!0),n=F_(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=ma;var VC=(e,t)=>{const r=qC(e,t);return r&&r.prerelease.length?r.prerelease:null};const D_=gn;var fi=(e,t,r)=>new D_(e,r).compare(new D_(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 H_=gn;var z0=(e,t,r)=>{const n=new H_(e,r),i=new H_(t,r);return n.compare(i)||n.compareBuild(i)};const YC=z0;var XC=(e,t)=>e.sort((r,n)=>YC(r,n,t));const JC=z0;var QC=(e,t)=>e.sort((r,n)=>JC(n,r,t));const eL=fi;var sl=(e,t,r)=>eL(e,t,r)>0;const tL=fi;var q0=(e,t,r)=>tL(e,t,r)<0;const rL=fi;var j_=(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 V0=(e,t,r)=>iL(e,t,r)>=0;const sL=fi;var W0=(e,t,r)=>sL(e,t,r)<=0;const oL=j_,aL=z_,cL=sl,fL=V0,uL=q0,lL=W0;var q_=(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=ma,{safeRe:ol,t:al}=vo.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?ol[al.COERCEFULL]:ol[al.COERCE]);else{const c=t.includePrerelease?ol[al.COERCERTLFULL]:ol[al.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)},K0,V_;function gL(){if(V_)return K0;V_=1;class e{constructor(){this.max=1e3,this.map=new Map}get(r){const n=this.map.get(r);if(n!==void 0)return this.map.delete(r),this.map.set(r,n),n}delete(r){return this.map.delete(r)}set(r,n){if(!this.delete(r)&&n!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(r,n)}return this}}return K0=e,K0}var Z0,W_;function ui(){if(W_)return Z0;W_=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 Z0}var G0,K_;function cl(){if(K_)return G0;K_=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(">")))}}G0=t;const r=j0,{safeRe:n,t:i}=vo.exports,s=q_,o=rl,a=gn,c=ui();return G0}const yL=ui();var fl=(e,t,r)=>{try{t=new yL(t,r)}catch{return!1}return t.test(e)};const wL=ui();var mL=(e,t)=>new wL(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));const bL=gn,vL=ui();var _L=(e,t,r)=>{let n=null,i=null,s=null;try{s=new vL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new bL(n,r))}),n};const EL=gn,xL=ui();var SL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new xL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new EL(n,r))}),n};const Y0=gn,AL=ui(),Z_=sl;var BL=(e,t)=>{e=new AL(e,t);let r=new Y0("0.0.0");if(e.test(r)||(r=new Y0("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const a=new Y0(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||Z_(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||Z_(r,s))&&(r=s)}return r&&e.test(r)?r:null};const IL=ui();var RL=(e,t)=>{try{return new IL(e,t).range||"*"}catch{return null}};const TL=gn,G_=cl(),{ANY:kL}=G_,CL=ui(),LL=fl,Y_=sl,X_=q0,$L=W0,OL=V0;var X0=(e,t,r,n)=>{e=new TL(e,n),t=new CL(t,n);let i,s,o,a,c;switch(r){case">":i=Y_,s=$L,o=X_,a=">",c=">=";break;case"<":i=X_,s=OL,o=Y_,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(LL(e,t,n))return!1;for(let u=0;u{v.semver===kL&&(v=new G_(">=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 ML=X0;var NL=(e,t,r)=>ML(e,t,">",r);const PL=X0;var UL=(e,t,r)=>PL(e,t,"<",r);const J_=ui();var FL=(e,t,r)=>(e=new J_(e,r),t=new J_(t,r),e.intersects(t,r));const DL=fl,HL=fi;var jL=(e,t,r)=>{const n=[];let i=null,s=null;const o=e.sort((l,y)=>HL(l,y,r));for(const l of o)DL(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 Q_(e,r),t=new Q_(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const o=VL(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},qL=[new J0(">=0.0.0-0")],e2=[new J0(">=0.0.0")],VL=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Q0){if(t.length===1&&t[0].semver===Q0)return!0;r.includePrerelease?e=qL:e=e2}if(t.length===1&&t[0].semver===Q0){if(r.includePrerelease)return!0;t=e2}const n=new Set;let i,s;for(const v of e)v.operator===">"||v.operator===">="?i=t2(i,v,r):v.operator==="<"||v.operator==="<="?s=r2(s,v,r):n.add(v.semver);if(n.size>1)return null;let o;if(i&&s){if(o=ep(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=t2(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=r2(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)},t2=(e,t,r)=>{if(!e)return t;const n=ep(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},r2=(e,t,r)=>{if(!e)return t;const n=ep(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var WL=zL;const tp=vo.exports,n2=tl,KL=gn,i2=$_,ZL=ma,GL=$C,YL=MC,XL=NC,JL=PC,QL=FC,e$=HC,t$=zC,r$=VC,n$=fi,i$=KC,s$=GC,o$=z0,a$=XC,c$=QC,f$=sl,u$=q0,l$=j_,h$=z_,d$=V0,p$=W0,g$=q_,y$=pL,w$=cl(),m$=ui();var b$={parse:ZL,valid:GL,clean:YL,inc:XL,diff:JL,major:QL,minor:e$,patch:t$,prerelease:r$,compare:n$,rcompare:i$,compareLoose:s$,compareBuild:o$,sort:a$,rsort:c$,gt:f$,lt:u$,eq:l$,neq:h$,gte:d$,lte:p$,cmp:g$,coerce:y$,Comparator:w$,Range:m$,satisfies:fl,toComparators:mL,maxSatisfying:_L,minSatisfying:SL,minVersion:BL,validRange:RL,outside:X0,gtr:NL,ltr:UL,intersects:FL,simplifyRange:jL,subset:WL,SemVer:KL,re:tp.re,src:tp.src,tokens:tp.t,SEMVER_SPEC_VERSION:n2.SEMVER_SPEC_VERSION,RELEASE_TYPES:n2.RELEASE_TYPES,compareIdentifiers:i2.compareIdentifiers,rcompareIdentifiers:i2.rcompareIdentifiers};Object.defineProperty(ai,"__esModule",{value:!0});var s2=Jn,Pc=b$,ba=Ms,rp=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),np=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 v$(e){return ba.is.call(void 0,e,rp)}function _$(e){return ba.is.call(void 0,e,np)}function E$(e){s2.assertStruct.call(void 0,e,rp)}function x$(e){s2.assertStruct.call(void 0,e,np)}function S$(e,t){return Pc.gt.call(void 0,e,t)}function A$(e,t){return Pc.gtr.call(void 0,e,t)}function B$(e,t){return Pc.satisfies.call(void 0,e,t,{includePrerelease:!0})}ai.VersionStruct=rp,ai.VersionRangeStruct=np,ai.isValidSemVerVersion=v$,ai.isValidSemVerRange=_$,ai.assertIsSemVerVersion=E$,ai.assertIsSemVerRange=x$,ai.gtVersion=S$,ai.gtRange=A$,ai.satisfiesVersionRange=B$;var It={};Object.defineProperty(It,"__esModule",{value:!0});var Gi=Jn,I$=dn,dt=Ms,va=e=>dt.object.call(void 0,e);function o2({path:e,branch:t}){const r=e[e.length-1];return I$.hasProperty.call(void 0,t[t.length-2],r)}function Uc(e){return new dt.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!o2(r)||e.validator(t,r),refiner:(t,r)=>!o2(r)||e.refiner(t,r)})}var R$=()=>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),R$(),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 T$(e){try{return a2(e),!0}catch{return!1}}function a2(e){return dt.create.call(void 0,e,_o)}function k$(e){Gi.assertStruct.call(void 0,e,_o,"Invalid JSON value");const t=JSON.stringify(e);return new TextEncoder().encode(t).byteLength}var c2="2.0",_a=dt.literal.call(void 0,c2),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))}),ip=dt.union.call(void 0,[dt.record.call(void 0,dt.string.call(void 0),_o),dt.array.call(void 0,_o)]),sp=va({id:Dc,jsonrpc:_a,method:dt.string.call(void 0),params:Uc(ip)}),op=va({jsonrpc:_a,method:dt.string.call(void 0),params:Uc(ip)});function C$(e){return dt.is.call(void 0,e,op)}function L$(e,t){Gi.assertStruct.call(void 0,e,op,"Invalid JSON-RPC notification",t)}function $$(e){return dt.is.call(void 0,e,sp)}function O$(e,t){Gi.assertStruct.call(void 0,e,sp,"Invalid JSON-RPC request",t)}var ap=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)}),ul=va({id:Dc,jsonrpc:_a,result:_o}),ll=va({id:Dc,jsonrpc:_a,error:Hc}),cp=dt.union.call(void 0,[ul,ll]);function M$(e){return dt.is.call(void 0,e,ap)}function N$(e,t){Gi.assertStruct.call(void 0,e,ap,"Invalid pending JSON-RPC response",t)}function P$(e){return dt.is.call(void 0,e,cp)}function U$(e,t){Gi.assertStruct.call(void 0,e,cp,"Invalid JSON-RPC response",t)}function F$(e){return dt.is.call(void 0,e,ul)}function D$(e,t){Gi.assertStruct.call(void 0,e,ul,"Invalid JSON-RPC success response",t)}function H$(e){return dt.is.call(void 0,e,ll)}function j$(e,t){Gi.assertStruct.call(void 0,e,ll,"Invalid JSON-RPC failure response",t)}function z$(e){return dt.is.call(void 0,e,Hc)}function q$(e,t){Gi.assertStruct.call(void 0,e,Hc,"Invalid JSON-RPC error",t)}function V$(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=T$,It.getSafeJson=a2,It.getJsonSize=k$,It.jsonrpc2=c2,It.JsonRpcVersionStruct=_a,It.JsonRpcIdStruct=Dc,It.JsonRpcErrorStruct=Hc,It.JsonRpcParamsStruct=ip,It.JsonRpcRequestStruct=sp,It.JsonRpcNotificationStruct=op,It.isJsonRpcNotification=C$,It.assertIsJsonRpcNotification=L$,It.isJsonRpcRequest=$$,It.assertIsJsonRpcRequest=O$,It.PendingJsonRpcResponseStruct=ap,It.JsonRpcSuccessStruct=ul,It.JsonRpcFailureStruct=ll,It.JsonRpcResponseStruct=cp,It.isPendingJsonRpcResponse=M$,It.assertIsPendingJsonRpcResponse=N$,It.isJsonRpcResponse=P$,It.assertIsJsonRpcResponse=U$,It.isJsonRpcSuccess=F$,It.assertIsJsonRpcSuccess=D$,It.isJsonRpcFailure=H$,It.assertIsJsonRpcFailure=j$,It.isJsonRpcError=z$,It.assertIsJsonRpcError=q$,It.getJsonRpcIdValidator=V$;var hl={},fp={exports:{}},up,f2;function W$(){if(f2)return up;f2=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;up=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 up}function K$(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=W$(),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=Z$(t);const{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(fp,fp.exports),Object.defineProperty(hl,"__esModule",{value:!0});function G$(e){return e&&e.__esModule?e:{default:e}}var Y$=fp.exports,X$=G$(Y$),J$=X$.default.call(void 0,"metamask");function Q$(e){return J$.extend(e)}function eO(e,t){return e.extend(t)}hl.createProjectLogger=Q$,hl.createModuleLogger=eO;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});function u2(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var yn=Ms,lp=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,hp=/^[-a-z0-9]{3,8}$/u,dp=/^[-_a-zA-Z0-9]{1,32}$/u,pp=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,l2=/^[-.%a-zA-Z0-9]{1,128}$/u,h2=yn.pattern.call(void 0,yn.string.call(void 0),lp),d2=yn.pattern.call(void 0,yn.string.call(void 0),hp),p2=yn.pattern.call(void 0,yn.string.call(void 0),dp),g2=yn.pattern.call(void 0,yn.string.call(void 0),pp),y2=yn.pattern.call(void 0,yn.string.call(void 0),l2),w2=(e=>(e.Eip155="eip155",e))(w2||{});function tO(e){return yn.is.call(void 0,e,h2)}function m2(e){return yn.is.call(void 0,e,d2)}function b2(e){return yn.is.call(void 0,e,p2)}function rO(e){return yn.is.call(void 0,e,g2)}function nO(e){return yn.is.call(void 0,e,y2)}function iO(e){const t=lp.exec(e);if(!u2([t,"optionalAccess",r=>r.groups]))throw new Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}}function sO(e){const t=pp.exec(e);if(!u2([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 oO(e,t){if(!m2(e))throw new Error(`Invalid "namespace", must match: ${hp.toString()}`);if(!b2(t))throw new Error(`Invalid "reference", must match: ${dp.toString()}`);return`${e}:${t}`}Ir.CAIP_CHAIN_ID_REGEX=lp,Ir.CAIP_NAMESPACE_REGEX=hp,Ir.CAIP_REFERENCE_REGEX=dp,Ir.CAIP_ACCOUNT_ID_REGEX=pp,Ir.CAIP_ACCOUNT_ADDRESS_REGEX=l2,Ir.CaipChainIdStruct=h2,Ir.CaipNamespaceStruct=d2,Ir.CaipReferenceStruct=p2,Ir.CaipAccountIdStruct=g2,Ir.CaipAccountAddressStruct=y2,Ir.KnownCaipNamespace=w2,Ir.isCaipChainId=tO,Ir.isCaipNamespace=m2,Ir.isCaipReference=b2,Ir.isCaipAccountId=rO,Ir.isCaipAccountAddress=nO,Ir.parseCaipChainId=iO,Ir.parseCaipAccountId=sO,Ir.toCaipChainId=oO;var gp={},dl={};Object.defineProperty(dl,"__esModule",{value:!0});function v2(e,t){return e??t()}var aO=Jn,cO=Ms,fO=(e,t={})=>{const r=v2(t.paddingRequired,()=>!1),n=v2(t.characterSet,()=>"base64");let i;n==="base64"?i=String.raw`[A-Za-z0-9+\/]`:(aO.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"),cO.pattern.call(void 0,e,s)};dl.base64=fO,Object.defineProperty(gp,"__esModule",{value:!0});var uO=dl,_2=Ms,lO=_2.size.call(void 0,uO.base64.call(void 0,_2.string.call(void 0),{paddingRequired:!0}),44,44);gp.ChecksumStruct=lO;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});var xa=Rt,hO=Jn,gr=Ms,E2=gr.union.call(void 0,[gr.number.call(void 0),gr.bigint.call(void 0),gr.string.call(void 0),xa.StrictHexStruct]),dO=gr.coerce.call(void 0,gr.number.call(void 0),E2,Number),pO=gr.coerce.call(void 0,gr.bigint.call(void 0),E2,BigInt);gr.union.call(void 0,[xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array)]);var gO=gr.coerce.call(void 0,gr.instance.call(void 0,Uint8Array),gr.union.call(void 0,[xa.StrictHexStruct]),xa.hexToBytes),yO=gr.coerce.call(void 0,xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array),xa.bytesToHex);function wO(e){try{const t=gr.create.call(void 0,e,dO);return hO.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 mO(e){try{return gr.create.call(void 0,e,pO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}function bO(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return gr.create.call(void 0,e,gO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}function vO(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";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}}Ea.createNumber=wO,Ea.createBigInt=mO,Ea.createBytes=bO,Ea.createHex=vO;var pl={},jc={};Object.defineProperty(jc,"__esModule",{value:!0});var x2=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},_O=(e,t,r)=>(x2(e,t,"read from private field"),r?r.call(e):t.get(e)),EO=(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)},xO=(e,t,r,n)=>(x2(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);jc.__privateGet=_O,jc.__privateAdd=EO,jc.__privateSet=xO,Object.defineProperty(pl,"__esModule",{value:!0});var Mr=jc,li,yp=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,wp=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(yp),Object.freeze(yp.prototype),Object.freeze(wp),Object.freeze(wp.prototype),pl.FrozenMap=yp,pl.FrozenSet=wp,Object.defineProperty(oe,"__esModule",{value:!0});var gl=da,SO=H0,mp=Mc,Yi=ai,$t=It,S2=hl,Nr=Ir,AO=gp,BO=dl,yl=Ea,Dt=Rt,wl=Jn,zc=Os,hi=dn,A2=pl;oe.AssertionError=wl.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=AO.ChecksumStruct,oe.Duration=mp.Duration,oe.ESCAPE_CHARACTERS_REGEXP=hi.ESCAPE_CHARACTERS_REGEXP,oe.FrozenMap=A2.FrozenMap,oe.FrozenSet=A2.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=wl.assert,oe.assertExhaustive=wl.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=wl.assertStruct,oe.base64=BO.base64,oe.base64ToBytes=Dt.base64ToBytes,oe.bigIntToBytes=Dt.bigIntToBytes,oe.bigIntToHex=gl.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=yl.createBigInt,oe.createBytes=yl.createBytes,oe.createDataView=Dt.createDataView,oe.createDeferredPromise=SO.createDeferredPromise,oe.createHex=yl.createHex,oe.createModuleLogger=S2.createModuleLogger,oe.createNumber=yl.createNumber,oe.createProjectLogger=S2.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=gl.hexToBigInt,oe.hexToBytes=Dt.hexToBytes,oe.hexToNumber=gl.hexToNumber,oe.inMilliseconds=mp.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=gl.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=mp.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=Jf,Sa=oe;function bp(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=bp;function B2(e){return e==null}Qr.isNullish=B2;function IO(e){return typeof e=="string"&&!(0,Xi.isHexString)(e)?ie.Buffer.from(e):(0,Xi.toBuffer)(e)}Qr.legacyToBuffer=IO;function RO(e,t,r){const n=(0,Xi.fromSigned)(t),i=(0,Xi.fromSigned)(r),s=(0,Xi.bufferToInt)(e),o=bp((0,Xi.toUnsigned)(n).toString("hex"),64),a=bp((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=RO;function TO(e,t){const r=(0,Xi.fromRpcSig)(t);return(0,Xi.ecrecover)(e,r.v,r.r,r.s)}Qr.recoverPublicKey=TO;function kO(e){if(!B2(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=kO,Object.defineProperty(us,"__esModule",{value:!0}),us.extractPublicKey=us.recoverPersonalSignature=us.personalSign=void 0;const Aa=Jf,Ri=Qr;function CO({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=CO;function LO({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=I2(e,t),n=(0,Aa.publicToAddress)(r);return(0,Aa.bufferToHex)(n)}us.recoverPersonalSignature=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");return`0x${I2(e,t).toString("hex")}`}us.extractPublicKey=$O;function I2(e,t){const r=(0,Aa.hashPersonalMessage)((0,Ri.legacyToBuffer)(e));return(0,Ri.recoverPublicKey)(r,t)}var R2={},T2={},k2={},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 vp={},ml={};Object.defineProperty(ml,"__esModule",{value:!0}),ml.iterate=void 0;const C2=oe,OO=function*(e,t=32){for(let r=0;r{(0,C2.assert)(s>=0,"Cannot skip a negative number of bytes."),(0,C2.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}};ml.iterate=OO;var _p={},L2={},Ps={},Us={};Object.defineProperty(Us,"__esModule",{value:!0}),Us.padEnd=Us.padStart=Us.set=void 0;const Ep=oe,$2=32,MO=(e,t,r)=>(0,Ep.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);Us.set=MO;const NO=(e,t=$2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Ep.concatBytes)([r,e])};Us.padStart=NO;const PO=(e,t=$2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Ep.concatBytes)([e,r])};Us.padEnd=PO,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)))}}}(L2);var xp={},bl={};(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)}}})(bl);var Sp={},O2;function M2(){return O2||(O2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=oe,r=di,n=Cp(),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)}}}(Sp)),Sp}var N2;function UO(){return N2||(N2=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=Cp(),i=Ps,s=bl,o=M2(),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))}}}(xp)),xp}var P2={};class U2 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 FO(e){return ei(e)&&typeof e[Symbol.iterator]=="function"}function ei(e){return typeof e=="object"&&e!=null}function F2(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 DO(e){const{done:t,value:r}=e.next();return t?void 0:r}function HO(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*Ap(e,t,r,n){FO(e)||(e=[e]);for(const i of e){const s=HO(i,t,r,n);s&&(yield s)}}function*Bp(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=Bp(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 Ap(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return Ap(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return D2(t,this,r)}create(t,r){return H2(t,this,r)}is(t){return Ip(t,this)}mask(t,r){return j2(t,this,r)}validate(t,r={}){return Ba(t,this,r)}}function D2(e,t,r){const n=Ba(e,t,{message:r});if(n[0])throw n[0]}function H2(e,t,r){const n=Ba(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function j2(e,t,r){const n=Ba(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Ip(e,t){return!Ba(e,t)[0]}function Ba(e,t,r={}){const n=Bp(e,t,r),i=DO(n);return i[0]?[new U2(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function jO(...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 zO(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 qO(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 VO(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 WO(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 KO(e){const t=e instanceof Rr,r=t?{...e.schema}:{...e};for(const n in r)r[n]=z2(r[n]);return t&&e.type==="type"?Vc(r):qc(r)}function ZO(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 GO(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Sn(e,t)}function YO(){return Sn("any",()=>!0)}function XO(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 JO(){return Sn("bigint",e=>typeof e=="bigint")}function QO(){return Sn("boolean",e=>typeof e=="boolean")}function eM(){return Sn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Pr(e)}`)}function tM(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 rM(){return Sn("func",e=>typeof e=="function"||`Expected a function, but received: ${Pr(e)}`)}function nM(e){return Sn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Pr(t)}`)}function iM(){return Sn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Pr(e)}`)}function sM(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 oM(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 aM(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 Rp(){return Sn("never",()=>!1)}function cM(e){return new Rr({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function fM(){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=Rp();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 z2(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 uM(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 lM(){return Sn("regexp",e=>e instanceof RegExp)}function hM(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 q2(){return Sn("string",e=>typeof e=="string"||`Expected a string, but received: ${Pr(e)}`)}function dM(e){const t=Rp();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]=Bp(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 V2(){return Sn("unknown",()=>!0)}function Tp(e,t,r){return new Rr({...e,coercer:(n,i)=>Ip(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function gM(e,t,r={}){return Tp(e,V2(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&F2(n)&&F2(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 yM(e){return Tp(e,q2(),t=>t.trim())}function wM(e){return Eo(e,"empty",t=>{const r=W2(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function W2(e){return e instanceof Map||e instanceof Set?e.size:e.length}function mM(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 vM(e){return Eo(e,"nonempty",t=>W2(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function _M(e,t){return Eo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function EM(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=Ap(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var xM=Object.freeze({__proto__:null,Struct:Rr,StructError:U2,any:YO,array:XO,assert:D2,assign:jO,bigint:JO,boolean:QO,coerce:Tp,create:H2,date:eM,defaulted:gM,define:Sn,deprecated:zO,dynamic:qO,empty:wM,enums:tM,func:rM,instance:nM,integer:iM,intersection:sM,is:Ip,lazy:VO,literal:oM,map:aM,mask:j2,max:mM,min:bM,never:Rp,nonempty:vM,nullable:cM,number:fM,object:qc,omit:WO,optional:z2,partial:KO,pattern:_M,pick:ZO,record:uM,refine:Eo,regexp:lM,set:hM,size:EM,string:q2,struct:GO,trimmed:yM,tuple:dM,type:Vc,union:pM,unknown:V2,validate:Ba}),K2=Un(xM),kp={};(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}}})(kp),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=oe,r=K2,n=di,i=kp,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)}}}(P2);var Wc={};Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.bytes=void 0;const Kc=oe,Z2=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,Z2.padStart)((0,Kc.numberToBytes)(n.byteLength)),(0,Z2.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,Kc.bytesToNumber)(t);return e.slice(32,32+r)}};var G2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=oe,r=K2,n=di,i=bl,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))}}}})(G2);var Y2={};Object.defineProperty(Y2,"__esModule",{value:!0});var vl={};Object.defineProperty(vl,"__esModule",{value:!0}),vl.string=void 0;const X2=oe,J2=Wc;vl.string={isDynamic:!0,isType:e=>e==="string",getByteLength(){return 32},encode({buffer:e,value:t,packed:r,tight:n}){return J2.bytes.encode({type:"bytes",buffer:e,value:(0,X2.stringToBytes)(t),packed:r,tight:n})},decode(e){return(0,X2.bytesToString)(J2.bytes.decode(e))}};var Q2;function eE(){return Q2||(Q2=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(L2,e),r(UO(),e),r(P2,e),r(Wc,e),r(bl,e),r(G2,e),r(kp,e),r(Y2,e),r(vl,e),r(M2(),e)}(_p)),_p}var tE;function Cp(){return tE||(tE=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=ml,i=eE(),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}(vp)),vp}(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=Cp(),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})(k2);var rE={},nE={};Object.defineProperty(nE,"__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(nE,e)}(rE),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(k2,e),r(di,e),r(rE,e)}(T2),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=Jf,r=T2,n=eE(),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}(R2);var ti={},iE={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 sE({publicKey:e,data:u,version:r})}ti.encryptSafely=IM;function oE({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=oE;function RM({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(oE({encryptedData:e,privateKey:t})).data}ti.decryptSafely=RM;function TM(e){const t=ie.Buffer.from(e,"hex"),r=xo.box.keyPair.fromSecretKey(t).publicKey;return Ti.base64.encode(r)}ti.getEncryptionPublicKey=TM,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(R2,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 aE extends Error{constructor(t,r){super(),this.code=t,this.message=r}toString(){return`${this.message} (${this.code})`}}var kM=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},CM=(e,t,r)=>(kM(e,t,"read from private field"),r?r.call(e):t.get(e)),LM=(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)},Lp;const Ia=class{constructor(e){LM(this,Lp,["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(CM(this,Lp).includes(e.method))return Promise.reject(new aE(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,isEthSign:!0}})}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 $M=Ia;Lp=new WeakMap;var OM=Object.defineProperty,cE=Object.getOwnPropertySymbols,MM=Object.prototype.hasOwnProperty,NM=Object.prototype.propertyIsEnumerable,fE=(e,t,r)=>t in e?OM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,PM=(e,t)=>{for(var r in t||(t={}))MM.call(t,r)&&fE(e,r,t[r]);if(cE)for(var r of cE(t))NM.call(t,r)&&fE(e,r,t[r]);return e},uE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},UM=(e,t,r)=>(uE(e,t,"read from private field"),r?r.call(e):t.get(e)),FM=(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)},DM=(e,t,r,n)=>(uE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),_l;class lE{constructor(t){FM(this,_l,void 0),DM(this,_l,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(UM(this,_l),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(PM({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}}_l=new WeakMap;var hE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nn=(e,t,r)=>(hE(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)=>(hE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ji,Ta,El,Zc,Fs,ka;const dE=class extends sf{constructor(e){super(),Ra(this,Ji,void 0),Ra(this,Ta,void 0),Ra(this,El,!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,El,e.disableMobileAdapter),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust),Pn(this,ka,new lE(Nn(this,Ta)))),Nn(this,El)||(this.mobileAdapter=new $M(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 aE(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 dE.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 lE(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 pE=dE;Ji=new WeakMap,Ta=new WeakMap,El=new WeakMap,Zc=new WeakMap,Fs=new WeakMap,ka=new WeakMap,pE.NETWORK="ethereum";class HM{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 gE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},yE=(e,t,r)=>(gE(e,t,"read from private field"),r?r.call(e):t.get(e)),jM=(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)},zM=(e,t,r,n)=>(gE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Gc;const Yc=class extends sf{constructor(e){super(),jM(this,Gc,!1),this.isKeplr=!0,this.isTrust=!0,this.isTrustWallet=!0,e&&(typeof e.disableMobileAdapter<"u"&&zM(this,Gc,e.disableMobileAdapter),typeof e.isKeplr<"u"&&(this.isKeplr=e.isKeplr),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),yE(this,Gc)||(this.mobileAdapter=new HM(this))}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}getNetwork(){return Yc.NETWORK}isMobileAdapterEnabled(){return!yE(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 wE=Yc;Gc=new WeakMap,wE.NETWORK="cosmos";var $p={exports:{}},Ca=typeof Reflect=="object"?Reflect:null,mE=Ca&&typeof Ca.apply=="function"?Ca.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},xl;Ca&&typeof Ca.ownKeys=="function"?xl=Ca.ownKeys:Object.getOwnPropertySymbols?xl=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xl=function(e){return Object.getOwnPropertyNames(e)};function qM(e){console&&console.warn&&console.warn(e)}var bE=Number.isNaN||function(e){return e!==e};function Gt(){Gt.init.call(this)}$p.exports=Gt,$p.exports.once=ZM,Gt.EventEmitter=Gt,Gt.prototype._events=void 0,Gt.prototype._eventsCount=0,Gt.prototype._maxListeners=void 0;var vE=10;function Sl(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 vE},set:function(e){if(typeof e!="number"||e<0||bE(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");vE=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||bE(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 _E(e){return e._maxListeners===void 0?Gt.defaultMaxListeners:e._maxListeners}Gt.prototype.getMaxListeners=function(){return _E(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")mE(a,this,t);else for(var c=a.length,u=BE(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,qM(a)}return e}Gt.prototype.addListener=function(e,t){return EE(this,e,t,!1)},Gt.prototype.on=Gt.prototype.addListener,Gt.prototype.prependListener=function(e,t){return EE(this,e,t,!0)};function VM(){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 xE(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=VM.bind(n);return i.listener=r,n.wrapFn=i,i}Gt.prototype.once=function(e,t){return Sl(t),this.on(e,xE(this,e,t)),this},Gt.prototype.prependOnceListener=function(e,t){return Sl(t),this.prependListener(e,xE(this,e,t)),this},Gt.prototype.removeListener=function(e,t){var r,n,i,s,o;if(Sl(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():WM(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 SE(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?KM(i):BE(i,i.length)}Gt.prototype.listeners=function(e){return SE(this,e,!0)},Gt.prototype.rawListeners=function(e){return SE(this,e,!1)},Gt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):AE.call(e,t)},Gt.prototype.listenerCount=AE;function AE(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?xl(this._events):[]};function BE(e,t){for(var r=new Array(t),n=0;npv(e,new Set),gv=(e,t,r)=>{if(!(e instanceof Error))return"";const n=r?"":e.message||"";if(t.has(e))return n+": ...";const i=Gu(e);if(i){t.add(e);const s="cause"in e&&typeof e.cause=="function";return n+(s?"":": ")+gv(i,t,s)}else return n};var F5=Object.freeze({__proto__:null,findCauseByReference:P5,getErrorCause:Gu,stackWithCauses:U5,messageWithCauses:e=>gv(e,new Set)}),D5=Un(F5);const{ErrorWithCause:H5}=N5,{findCauseByReference:j5,getErrorCause:z5,messageWithCauses:q5,stackWithCauses:V5}=D5;var W5={ErrorWithCause:H5,findCauseByReference:j5,getErrorCause:z5,stackWithCauses:V5,messageWithCauses:q5};Object.defineProperty(Os,"__esModule",{value:!0});var yv=dn,K5=W5;function Z5(e){return e instanceof Error||yv.isObject.call(void 0,e)&&e.constructor.name==="Error"}function wv(e){return typeof e=="object"&&e!==null&&"code"in e}function mv(e){return typeof e=="object"&&e!==null&&"message"in e}function G5(e){return typeof e=="object"&&e!==null&&"stack"in e}function Y5(e){return mv(e)&&typeof e.message=="string"?e.message:yv.isNullOrUndefined.call(void 0,e)?"":String(e)}function X5(e,t){if(Z5(e)){let r;return Error.length===2?r=new Error(t,{cause:e}):r=new K5.ErrorWithCause(t,{cause:e}),wv(e)&&(r.code=e.code),r}return t.length>0?new Error(`${String(e)}: ${t}`):new Error(String(e))}Os.isErrorWithCode=wv,Os.isErrorWithMessage=mv,Os.isErrorWithStack=G5,Os.getErrorMessage=Y5,Os.wrapError=X5;class bv 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 vv(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 Q5(e){const{done:t,value:r}=e.next();return t?void 0:r}function ek(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*R0(e,t,r,n){J5(e)||(e=[e]);for(const i of e){const s=ek(i,t,r,n);s&&(yield s)}}function*T0(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=T0(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 R0(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return R0(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return _v(t,this,r)}create(t,r){return Ev(t,this,r)}is(t){return k0(t,this)}mask(t,r){return xv(t,this,r)}validate(t,r={}){return pa(t,this,r)}}function _v(e,t,r){const n=pa(e,t,{message:r});if(n[0])throw n[0]}function Ev(e,t,r){const n=pa(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function xv(e,t,r){const n=pa(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function k0(e,t){return!pa(e,t)[0]}function pa(e,t,r={}){const n=T0(e,t,r),i=Q5(n);return i[0]?[new bv(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function tk(...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 rk(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 nk(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 ik(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 sk(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 ok(e){const t=e instanceof Br,r=t?{...e.schema}:{...e};for(const n in r)r[n]=Sv(r[n]);return t&&e.type==="type"?kc(r):Tc(r)}function ak(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 ck(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),xn(e,t)}function fk(){return xn("any",()=>!0)}function uk(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 lk(){return xn("bigint",e=>typeof e=="bigint")}function hk(){return xn("boolean",e=>typeof e=="boolean")}function dk(){return xn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Or(e)}`)}function pk(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 gk(){return xn("func",e=>typeof e=="function"||`Expected a function, but received: ${Or(e)}`)}function yk(e){return xn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Or(t)}`)}function wk(){return xn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Or(e)}`)}function mk(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 bk(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 vk(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 C0(){return xn("never",()=>!1)}function _k(e){return new Br({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function Ek(){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=C0();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 Sv(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 xk(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 Sk(){return xn("regexp",e=>e instanceof RegExp)}function Ak(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 Av(){return xn("string",e=>typeof e=="string"||`Expected a string, but received: ${Or(e)}`)}function Bk(e){const t=C0();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]=T0(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 Bv(){return xn("unknown",()=>!0)}function L0(e,t,r){return new Br({...e,coercer:(n,i)=>k0(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function Rk(e,t,r={}){return L0(e,Bv(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&vv(n)&&vv(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 Tk(e){return L0(e,Av(),t=>t.trim())}function kk(e){return mo(e,"empty",t=>{const r=Iv(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function Iv(e){return e instanceof Map||e instanceof Set?e.size:e.length}function Ck(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 $k(e){return mo(e,"nonempty",t=>Iv(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function Ok(e,t){return mo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function Mk(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=R0(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var Nk=Object.freeze({__proto__:null,Struct:Br,StructError:bv,any:fk,array:uk,assert:_v,assign:tk,bigint:lk,boolean:hk,coerce:L0,create:Ev,date:dk,defaulted:Rk,define:xn,deprecated:rk,dynamic:nk,empty:kk,enums:pk,func:gk,instance:yk,integer:wk,intersection:mk,is:k0,lazy:ik,literal:bk,map:vk,mask:xv,max:Ck,min:Lk,never:C0,nonempty:$k,nullable:_k,number:Ek,object:Tc,omit:sk,optional:Sv,partial:ok,pattern:Ok,pick:ak,record:xk,refine:mo,regexp:Sk,set:Ak,size:Mk,string:Av,struct:ck,trimmed:Tk,tuple:Bk,type:kc,union:Ik,unknown:Bv,validate:pa}),Ms=Un(Nk);Object.defineProperty(Jn,"__esModule",{value:!0});function Pk(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var Uk=Os,Fk=Ms;function Dk(e){return typeof Pk([e,"optionalAccess",t=>t.prototype,"optionalAccess",t=>t.constructor,"optionalAccess",t=>t.name])=="string"}function Hk(e){return Uk.getErrorMessage.call(void 0,e).replace(/\.$/u,"")}function Rv(e,t){return Dk(e)?new e({message:t}):e({message:t})}var $0=class extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}};function jk(e,t="Assertion failed.",r=$0){if(!e)throw t instanceof Error?t:Rv(r,t)}function zk(e,t,r="Assertion failed",n=$0){try{Fk.assert.call(void 0,e,t)}catch(i){throw Rv(n,`${r}: ${Hk(i)}.`)}}function qk(e){throw new Error("Invalid branch reached. Should be detected during compilation.")}Jn.AssertionError=$0,Jn.assert=jk,Jn.assertStruct=zk,Jn.assertExhaustive=qk;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 Yu(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}Wr.number=Yu;function Tv(e){if(typeof e!="boolean")throw new Error(`boolean expected, not ${e}`)}Wr.bool=Tv;function kv(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}Wr.isBytes=kv;function O0(e,...t){if(!kv(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=O0;function Cv(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Yu(e.outputLen),Yu(e.blockLen)}Wr.hash=Cv;function Lv(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=Lv;function $v(e,t){O0(e);const r=t.outputLen;if(e.length>M0&Xu)}:{h:Number(e>>M0&Xu)|0,l:Number(e&Xu)|0}}at.fromBig=N0;function Ov(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);at.toBig=Mv;const Nv=(e,t,r)=>e>>>r;at.shrSH=Nv;const Pv=(e,t,r)=>e<<32-r|t>>>r;at.shrSL=Pv;const Uv=(e,t,r)=>e>>>r|t<<32-r;at.rotrSH=Uv;const Fv=(e,t,r)=>e<<32-r|t>>>r;at.rotrSL=Fv;const Dv=(e,t,r)=>e<<64-r|t>>>r-32;at.rotrBH=Dv;const Hv=(e,t,r)=>e>>>r-32|t<<64-r;at.rotrBL=Hv;const jv=(e,t)=>t;at.rotr32H=jv;const zv=(e,t)=>e;at.rotr32L=zv;const qv=(e,t,r)=>e<>>32-r;at.rotlSH=qv;const Vv=(e,t,r)=>t<>>32-r;at.rotlSL=Vv;const Wv=(e,t,r)=>t<>>64-r;at.rotlBH=Wv;const Kv=(e,t,r)=>e<>>64-r;at.rotlBL=Kv;function Zv(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:i|0}}at.add=Zv;const Gv=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);at.add3L=Gv;const Yv=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;at.add3H=Yv;const Xv=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);at.add4L=Xv;const Jv=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;at.add4H=Jv;const Qv=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);at.add5L=Qv;const e_=(e,t,r,n,i,s)=>t+r+n+i+s+(e/2**32|0)|0;at.add5H=e_;const Wk={fromBig:N0,split:Ov,toBig:Mv,shrSH:Nv,shrSL:Pv,rotrSH:Uv,rotrSL:Fv,rotrBH:Dv,rotrBL:Hv,rotr32H:jv,rotr32L:zv,rotlSH:qv,rotlSL:Vv,rotlBH:Wv,rotlBL:Kv,add:Zv,add3L:Gv,add3H:Yv,add4L:Xv,add4H:Jv,add5H:e_,add5L:Qv};at.default=Wk;var t_={},Ju={};Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.crypto=void 0,Ju.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=Ju,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}(t_),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=t_,r_=[],n_=[],i_=[],Kk=BigInt(0),Lc=BigInt(1),Zk=BigInt(2),Gk=BigInt(7),Yk=BigInt(256),Xk=BigInt(113);for(let e=0,t=Lc,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],r_.push(2*(5*n+r)),n_.push((e+1)*(e+2)/2%64);let i=Kk;for(let s=0;s<7;s++)t=(t<>Gk)*Xk)%Yk,t&Zk&&(i^=Lc<<(Lc<r>32?(0,Cc.rotlBH)(e,t,r):(0,Cc.rotlSH)(e,t,r),o_=(e,t,r)=>r>32?(0,Cc.rotlBL)(e,t,r):(0,Cc.rotlSL)(e,t,r);function a_(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=s_(u,l,1)^r[a],A=o_(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=n_[o],c=s_(i,s,a),u=o_(i,s,a),l=r_[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]^=Qk[n]}r.fill(0)}tr.keccakP=a_;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),a_(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 c_=(e,t,r)=>(0,Zi.wrapXOFConstructorWithOpts)((n={})=>new $c(t,e,n.dkLen===void 0?r:n.dkLen,!0));tr.shake128=c_(31,168,128/8),tr.shake256=c_(31,136,256/8);var P0={};(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})(P0),Object.defineProperty(Rt,"__esModule",{value:!0});function eC(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var Kr=Jn,tC=tr,pn=Ms,f_=P0,u_=48,l_=58,h_=87;function rC(){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 nC=rC();function U0(e){return e instanceof Uint8Array}function bo(e){Kr.assert.call(void 0,U0(e),"Value must be a Uint8Array.")}function F0(e){if(bo(e),e.length===0)return"0x";const t=nC(),r=new Array(e.length);for(let n=0;ni.toLowerCase,"optionalCall",i=>i()])==="0x")return new Uint8Array;x_(e);const t=el(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 Qu(t)}function cC(e,t){Kr.assert.call(void 0,t>0);const r=e>>BigInt(31);return!((~e&r)+(e&~r)>>BigInt(t*8+-1))}function fC(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,cC(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 g_(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 Qu(t)}function y_(e){return Kr.assert.call(void 0,typeof e=="string","Value must be a string."),new TextEncoder().encode(e)}function uC(e){return Kr.assert.call(void 0,typeof e=="string","Value must be a string."),f_.base64.decode(e)}function w_(e){if(typeof e=="bigint")return p_(e);if(typeof e=="number")return g_(e);if(typeof e=="string")return e.startsWith("0x")?Qu(e):y_(e);if(U0(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}function lC(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 A_(e){return pn.is.call(void 0,e,D0)?S_(e)===e:!1}function B_(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`}function el(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}Rt.HexStruct=m_,Rt.StrictHexStruct=b_,Rt.HexAddressStruct=v_,Rt.HexChecksumAddressStruct=D0,Rt.isHexString=__,Rt.isStrictHexString=E_,Rt.assertIsHexString=x_,Rt.assertIsStrictHexString=dC,Rt.isValidHexAddress=pC,Rt.getChecksumAddress=S_,Rt.isValidChecksumAddress=A_,Rt.add0x=B_,Rt.remove0x=el,Rt.isBytes=U0,Rt.assertIsBytes=bo,Rt.bytesToHex=F0,Rt.bytesToBigInt=d_,Rt.bytesToSignedBigInt=iC,Rt.bytesToNumber=sC,Rt.bytesToString=oC,Rt.bytesToBase64=aC,Rt.hexToBytes=Qu,Rt.bigIntToBytes=p_,Rt.signedBigIntToBytes=fC,Rt.numberToBytes=g_,Rt.stringToBytes=y_,Rt.base64ToBytes=uC,Rt.valueToBytes=w_,Rt.concatBytes=lC,Rt.createDataView=hC,Object.defineProperty(da,"__esModule",{value:!0});var Oc=Rt,ya=Jn,gC=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))),yC=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))),wC=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},mC=e=>(Oc.assertIsHexString.call(void 0,e),BigInt(Oc.add0x.call(void 0,e)));da.numberToHex=gC,da.bigIntToHex=yC,da.hexToNumber=wC,da.hexToBigInt=mC;var H0={};Object.defineProperty(H0,"__esModule",{value:!0});function bC({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}}H0.createDeferredPromise=bC;var Mc={};Object.defineProperty(Mc,"__esModule",{value:!0});var I_=(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))(I_||{}),vC=e=>Number.isInteger(e)&&e>=0,R_=(e,t)=>{if(!vC(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};function _C(e,t){return R_(e,"count"),e*t}function EC(e){return R_(e,"timestamp"),Date.now()-e}Mc.Duration=I_,Mc.inMilliseconds=_C,Mc.timeSince=EC;var ai={},vo={exports:{}};const xC="2.0.0",T_=256,SC=Number.MAX_SAFE_INTEGER||9007199254740991,AC=16,BC=T_-6;var tl={MAX_LENGTH:T_,MAX_SAFE_COMPONENT_LENGTH:AC,MAX_SAFE_BUILD_LENGTH:BC,MAX_SAFE_INTEGER:SC,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:xC,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},rl=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}=tl,s=rl;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 IC=Object.freeze({loose:!0}),RC=Object.freeze({});var j0=e=>e?typeof e!="object"?IC:e:RC;const k_=/^[0-9]+$/,C_=(e,t)=>{const r=k_.test(e),n=k_.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:eC_(t,e)};const nl=rl,{MAX_LENGTH:$_,MAX_SAFE_INTEGER:il}=tl,{safeRe:O_,t:M_}=vo.exports,TC=j0,{compareIdentifiers:wa}=L_;class ci{constructor(t,r){if(r=TC(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>$_)throw new TypeError(`version is longer than ${$_} characters`);nl("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?O_[M_.LOOSE]:O_[M_.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>il||this.major<0)throw new TypeError("Invalid major version");if(this.minor>il||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>il||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 N_=gn;var ma=(e,t,r=!1)=>{if(e instanceof N_)return e;try{return new N_(e,t)}catch(n){if(!r)return null;throw n}};const kC=ma;var CC=(e,t)=>{const r=kC(e,t);return r?r.version:null};const LC=ma;var $C=(e,t)=>{const r=LC(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const P_=gn;var OC=(e,t,r,n,i)=>{typeof r=="string"&&(i=n,n=r,r=void 0);try{return new P_(e instanceof P_?e.version:e,r).inc(t,n,i).version}catch{return null}};const U_=ma;var MC=(e,t)=>{const r=U_(e,null,!0),n=U_(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 NC=gn;var PC=(e,t)=>new NC(e,t).major;const UC=gn;var FC=(e,t)=>new UC(e,t).minor;const DC=gn;var HC=(e,t)=>new DC(e,t).patch;const jC=ma;var zC=(e,t)=>{const r=jC(e,t);return r&&r.prerelease.length?r.prerelease:null};const F_=gn;var fi=(e,t,r)=>new F_(e,r).compare(new F_(t,r));const qC=fi;var VC=(e,t,r)=>qC(t,e,r);const WC=fi;var KC=(e,t)=>WC(e,t,!0);const D_=gn;var z0=(e,t,r)=>{const n=new D_(e,r),i=new D_(t,r);return n.compare(i)||n.compareBuild(i)};const ZC=z0;var GC=(e,t)=>e.sort((r,n)=>ZC(r,n,t));const YC=z0;var XC=(e,t)=>e.sort((r,n)=>YC(n,r,t));const JC=fi;var sl=(e,t,r)=>JC(e,t,r)>0;const QC=fi;var q0=(e,t,r)=>QC(e,t,r)<0;const eL=fi;var H_=(e,t,r)=>eL(e,t,r)===0;const tL=fi;var j_=(e,t,r)=>tL(e,t,r)!==0;const rL=fi;var V0=(e,t,r)=>rL(e,t,r)>=0;const nL=fi;var W0=(e,t,r)=>nL(e,t,r)<=0;const iL=H_,sL=j_,oL=sl,aL=V0,cL=q0,fL=W0;var z_=(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 iL(e,r,n);case"!=":return sL(e,r,n);case">":return oL(e,r,n);case">=":return aL(e,r,n);case"<":return cL(e,r,n);case"<=":return fL(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const uL=gn,lL=ma,{safeRe:ol,t:al}=vo.exports;var hL=(e,t)=>{if(e instanceof uL)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?ol[al.COERCEFULL]:ol[al.COERCE]);else{const c=t.includePrerelease?ol[al.COERCERTLFULL]:ol[al.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 lL(`${n}.${i}.${s}${o}${a}`,t)};class dL{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 pL=dL,K0,q_;function ui(){if(q_)return K0;q_=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 K0}var Z0,V_;function cl(){if(V_)return Z0;V_=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(">")))}}Z0=t;const r=j0,{safeRe:n,t:i}=vo.exports,s=z_,o=rl,a=gn,c=ui();return Z0}const gL=ui();var fl=(e,t,r)=>{try{t=new gL(t,r)}catch{return!1}return t.test(e)};const yL=ui();var wL=(e,t)=>new yL(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));const mL=gn,bL=ui();var vL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new bL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===-1)&&(n=o,i=new mL(n,r))}),n};const _L=gn,EL=ui();var xL=(e,t,r)=>{let n=null,i=null,s=null;try{s=new EL(t,r)}catch{return null}return e.forEach(o=>{s.test(o)&&(!n||i.compare(o)===1)&&(n=o,i=new _L(n,r))}),n};const G0=gn,SL=ui(),W_=sl;var AL=(e,t)=>{e=new SL(e,t);let r=new G0("0.0.0");if(e.test(r)||(r=new G0("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n{const a=new G0(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!s||W_(a,s))&&(s=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),s&&(!r||W_(r,s))&&(r=s)}return r&&e.test(r)?r:null};const BL=ui();var IL=(e,t)=>{try{return new BL(e,t).range||"*"}catch{return null}};const RL=gn,K_=cl(),{ANY:TL}=K_,kL=ui(),CL=fl,Z_=sl,G_=q0,LL=W0,$L=V0;var Y0=(e,t,r,n)=>{e=new RL(e,n),t=new kL(t,n);let i,s,o,a,c;switch(r){case">":i=Z_,s=LL,o=G_,a=">",c=">=";break;case"<":i=G_,s=$L,o=Z_,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(CL(e,t,n))return!1;for(let u=0;u{v.semver===TL&&(v=new K_(">=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 OL=Y0;var ML=(e,t,r)=>OL(e,t,">",r);const NL=Y0;var PL=(e,t,r)=>NL(e,t,"<",r);const Y_=ui();var UL=(e,t,r)=>(e=new Y_(e,r),t=new Y_(t,r),e.intersects(t,r));const FL=fl,DL=fi;var HL=(e,t,r)=>{const n=[];let i=null,s=null;const o=e.sort((l,y)=>DL(l,y,r));for(const l of o)FL(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 X_(e,r),t=new X_(t,r);let n=!1;e:for(const i of e.set){for(const s of t.set){const o=qL(i,s,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},zL=[new X0(">=0.0.0-0")],J_=[new X0(">=0.0.0")],qL=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===J0){if(t.length===1&&t[0].semver===J0)return!0;r.includePrerelease?e=zL:e=J_}if(t.length===1&&t[0].semver===J0){if(r.includePrerelease)return!0;t=J_}const n=new Set;let i,s;for(const v of e)v.operator===">"||v.operator===">="?i=Q_(i,v,r):v.operator==="<"||v.operator==="<="?s=e2(s,v,r):n.add(v.semver);if(n.size>1)return null;let o;if(i&&s){if(o=Q0(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=Q_(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=e2(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)},Q_=(e,t,r)=>{if(!e)return t;const n=Q0(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},e2=(e,t,r)=>{if(!e)return t;const n=Q0(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var VL=jL;const ep=vo.exports,t2=tl,WL=gn,r2=L_,KL=ma,ZL=CC,GL=$C,YL=OC,XL=MC,JL=PC,QL=FC,e$=HC,t$=zC,r$=fi,n$=VC,i$=KC,s$=z0,o$=GC,a$=XC,c$=sl,f$=q0,u$=H_,l$=j_,h$=V0,d$=W0,p$=z_,g$=hL,y$=cl(),w$=ui();var m$={parse:KL,valid:ZL,clean:GL,inc:YL,diff:XL,major:JL,minor:QL,patch:e$,prerelease:t$,compare:r$,rcompare:n$,compareLoose:i$,compareBuild:s$,sort:o$,rsort:a$,gt:c$,lt:f$,eq:u$,neq:l$,gte:h$,lte:d$,cmp:p$,coerce:g$,Comparator:y$,Range:w$,satisfies:fl,toComparators:wL,maxSatisfying:vL,minSatisfying:xL,minVersion:AL,validRange:IL,outside:Y0,gtr:ML,ltr:PL,intersects:UL,simplifyRange:HL,subset:VL,SemVer:WL,re:ep.re,src:ep.src,tokens:ep.t,SEMVER_SPEC_VERSION:t2.SEMVER_SPEC_VERSION,RELEASE_TYPES:t2.RELEASE_TYPES,compareIdentifiers:r2.compareIdentifiers,rcompareIdentifiers:r2.rcompareIdentifiers};Object.defineProperty(ai,"__esModule",{value:!0});var n2=Jn,Pc=m$,ba=Ms,tp=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),rp=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 b$(e){return ba.is.call(void 0,e,tp)}function v$(e){return ba.is.call(void 0,e,rp)}function _$(e){n2.assertStruct.call(void 0,e,tp)}function E$(e){n2.assertStruct.call(void 0,e,rp)}function x$(e,t){return Pc.gt.call(void 0,e,t)}function S$(e,t){return Pc.gtr.call(void 0,e,t)}function A$(e,t){return Pc.satisfies.call(void 0,e,t,{includePrerelease:!0})}ai.VersionStruct=tp,ai.VersionRangeStruct=rp,ai.isValidSemVerVersion=b$,ai.isValidSemVerRange=v$,ai.assertIsSemVerVersion=_$,ai.assertIsSemVerRange=E$,ai.gtVersion=x$,ai.gtRange=S$,ai.satisfiesVersionRange=A$;var It={};Object.defineProperty(It,"__esModule",{value:!0});var Gi=Jn,B$=dn,dt=Ms,va=e=>dt.object.call(void 0,e);function i2({path:e,branch:t}){const r=e[e.length-1];return B$.hasProperty.call(void 0,t[t.length-2],r)}function Uc(e){return new dt.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!i2(r)||e.validator(t,r),refiner:(t,r)=>!i2(r)||e.refiner(t,r)})}var I$=()=>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),I$(),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 R$(e){try{return s2(e),!0}catch{return!1}}function s2(e){return dt.create.call(void 0,e,_o)}function T$(e){Gi.assertStruct.call(void 0,e,_o,"Invalid JSON value");const t=JSON.stringify(e);return new TextEncoder().encode(t).byteLength}var o2="2.0",_a=dt.literal.call(void 0,o2),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))}),np=dt.union.call(void 0,[dt.record.call(void 0,dt.string.call(void 0),_o),dt.array.call(void 0,_o)]),ip=va({id:Dc,jsonrpc:_a,method:dt.string.call(void 0),params:Uc(np)}),sp=va({jsonrpc:_a,method:dt.string.call(void 0),params:Uc(np)});function k$(e){return dt.is.call(void 0,e,sp)}function C$(e,t){Gi.assertStruct.call(void 0,e,sp,"Invalid JSON-RPC notification",t)}function L$(e){return dt.is.call(void 0,e,ip)}function $$(e,t){Gi.assertStruct.call(void 0,e,ip,"Invalid JSON-RPC request",t)}var op=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)}),ul=va({id:Dc,jsonrpc:_a,result:_o}),ll=va({id:Dc,jsonrpc:_a,error:Hc}),ap=dt.union.call(void 0,[ul,ll]);function O$(e){return dt.is.call(void 0,e,op)}function M$(e,t){Gi.assertStruct.call(void 0,e,op,"Invalid pending JSON-RPC response",t)}function N$(e){return dt.is.call(void 0,e,ap)}function P$(e,t){Gi.assertStruct.call(void 0,e,ap,"Invalid JSON-RPC response",t)}function U$(e){return dt.is.call(void 0,e,ul)}function F$(e,t){Gi.assertStruct.call(void 0,e,ul,"Invalid JSON-RPC success response",t)}function D$(e){return dt.is.call(void 0,e,ll)}function H$(e,t){Gi.assertStruct.call(void 0,e,ll,"Invalid JSON-RPC failure response",t)}function j$(e){return dt.is.call(void 0,e,Hc)}function z$(e,t){Gi.assertStruct.call(void 0,e,Hc,"Invalid JSON-RPC error",t)}function q$(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=R$,It.getSafeJson=s2,It.getJsonSize=T$,It.jsonrpc2=o2,It.JsonRpcVersionStruct=_a,It.JsonRpcIdStruct=Dc,It.JsonRpcErrorStruct=Hc,It.JsonRpcParamsStruct=np,It.JsonRpcRequestStruct=ip,It.JsonRpcNotificationStruct=sp,It.isJsonRpcNotification=k$,It.assertIsJsonRpcNotification=C$,It.isJsonRpcRequest=L$,It.assertIsJsonRpcRequest=$$,It.PendingJsonRpcResponseStruct=op,It.JsonRpcSuccessStruct=ul,It.JsonRpcFailureStruct=ll,It.JsonRpcResponseStruct=ap,It.isPendingJsonRpcResponse=O$,It.assertIsPendingJsonRpcResponse=M$,It.isJsonRpcResponse=N$,It.assertIsJsonRpcResponse=P$,It.isJsonRpcSuccess=U$,It.assertIsJsonRpcSuccess=F$,It.isJsonRpcFailure=D$,It.assertIsJsonRpcFailure=H$,It.isJsonRpcError=j$,It.assertIsJsonRpcError=z$,It.getJsonRpcIdValidator=q$;var hl={},cp={exports:{}},fp,a2;function V$(){if(a2)return fp;a2=1;var e=1e3,t=e*60,r=t*60,n=r*24,i=n*7,s=n*365.25;fp=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 fp}function W$(e){r.debug=r,r.default=r,r.coerce=c,r.disable=s,r.enable=i,r.enabled=o,r.humanize=V$(),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=K$(t);const{formatters:a}=e.exports;a.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(cp,cp.exports),Object.defineProperty(hl,"__esModule",{value:!0});function Z$(e){return e&&e.__esModule?e:{default:e}}var G$=cp.exports,Y$=Z$(G$),X$=Y$.default.call(void 0,"metamask");function J$(e){return X$.extend(e)}function Q$(e,t){return e.extend(t)}hl.createProjectLogger=J$,hl.createModuleLogger=Q$;var Ir={};Object.defineProperty(Ir,"__esModule",{value:!0});function c2(e){let t,r=e[0],n=1;for(;nr.call(t,...o)),t=void 0)}return r}var yn=Ms,up=/^(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,lp=/^[-a-z0-9]{3,8}$/u,hp=/^[-_a-zA-Z0-9]{1,32}$/u,dp=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,f2=/^[-.%a-zA-Z0-9]{1,128}$/u,u2=yn.pattern.call(void 0,yn.string.call(void 0),up),l2=yn.pattern.call(void 0,yn.string.call(void 0),lp),h2=yn.pattern.call(void 0,yn.string.call(void 0),hp),d2=yn.pattern.call(void 0,yn.string.call(void 0),dp),p2=yn.pattern.call(void 0,yn.string.call(void 0),f2),g2=(e=>(e.Eip155="eip155",e))(g2||{});function eO(e){return yn.is.call(void 0,e,u2)}function y2(e){return yn.is.call(void 0,e,l2)}function w2(e){return yn.is.call(void 0,e,h2)}function tO(e){return yn.is.call(void 0,e,d2)}function rO(e){return yn.is.call(void 0,e,p2)}function nO(e){const t=up.exec(e);if(!c2([t,"optionalAccess",r=>r.groups]))throw new Error("Invalid CAIP chain ID.");return{namespace:t.groups.namespace,reference:t.groups.reference}}function iO(e){const t=dp.exec(e);if(!c2([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 sO(e,t){if(!y2(e))throw new Error(`Invalid "namespace", must match: ${lp.toString()}`);if(!w2(t))throw new Error(`Invalid "reference", must match: ${hp.toString()}`);return`${e}:${t}`}Ir.CAIP_CHAIN_ID_REGEX=up,Ir.CAIP_NAMESPACE_REGEX=lp,Ir.CAIP_REFERENCE_REGEX=hp,Ir.CAIP_ACCOUNT_ID_REGEX=dp,Ir.CAIP_ACCOUNT_ADDRESS_REGEX=f2,Ir.CaipChainIdStruct=u2,Ir.CaipNamespaceStruct=l2,Ir.CaipReferenceStruct=h2,Ir.CaipAccountIdStruct=d2,Ir.CaipAccountAddressStruct=p2,Ir.KnownCaipNamespace=g2,Ir.isCaipChainId=eO,Ir.isCaipNamespace=y2,Ir.isCaipReference=w2,Ir.isCaipAccountId=tO,Ir.isCaipAccountAddress=rO,Ir.parseCaipChainId=nO,Ir.parseCaipAccountId=iO,Ir.toCaipChainId=sO;var pp={},dl={};Object.defineProperty(dl,"__esModule",{value:!0});function m2(e,t){return e??t()}var oO=Jn,aO=Ms,cO=(e,t={})=>{const r=m2(t.paddingRequired,()=>!1),n=m2(t.characterSet,()=>"base64");let i;n==="base64"?i=String.raw`[A-Za-z0-9+\/]`:(oO.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"),aO.pattern.call(void 0,e,s)};dl.base64=cO,Object.defineProperty(pp,"__esModule",{value:!0});var fO=dl,b2=Ms,uO=b2.size.call(void 0,fO.base64.call(void 0,b2.string.call(void 0),{paddingRequired:!0}),44,44);pp.ChecksumStruct=uO;var Ea={};Object.defineProperty(Ea,"__esModule",{value:!0});var xa=Rt,lO=Jn,gr=Ms,v2=gr.union.call(void 0,[gr.number.call(void 0),gr.bigint.call(void 0),gr.string.call(void 0),xa.StrictHexStruct]),hO=gr.coerce.call(void 0,gr.number.call(void 0),v2,Number),dO=gr.coerce.call(void 0,gr.bigint.call(void 0),v2,BigInt);gr.union.call(void 0,[xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array)]);var pO=gr.coerce.call(void 0,gr.instance.call(void 0,Uint8Array),gr.union.call(void 0,[xa.StrictHexStruct]),xa.hexToBytes),gO=gr.coerce.call(void 0,xa.StrictHexStruct,gr.instance.call(void 0,Uint8Array),xa.bytesToHex);function yO(e){try{const t=gr.create.call(void 0,e,hO);return lO.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 wO(e){try{return gr.create.call(void 0,e,dO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a number-like value, got "${String(t.value)}".`):t}}function mO(e){if(typeof e=="string"&&e.toLowerCase()==="0x")return new Uint8Array;try{return gr.create.call(void 0,e,pO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}function bO(e){if(e instanceof Uint8Array&&e.length===0||typeof e=="string"&&e.toLowerCase()==="0x")return"0x";try{return gr.create.call(void 0,e,gO)}catch(t){throw t instanceof gr.StructError?new Error(`Expected a bytes-like value, got "${String(t.value)}".`):t}}Ea.createNumber=yO,Ea.createBigInt=wO,Ea.createBytes=mO,Ea.createHex=bO;var pl={},jc={};Object.defineProperty(jc,"__esModule",{value:!0});var _2=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},vO=(e,t,r)=>(_2(e,t,"read from private field"),r?r.call(e):t.get(e)),_O=(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)},EO=(e,t,r,n)=>(_2(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);jc.__privateGet=vO,jc.__privateAdd=_O,jc.__privateSet=EO,Object.defineProperty(pl,"__esModule",{value:!0});var Mr=jc,li,gp=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,yp=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(gp),Object.freeze(gp.prototype),Object.freeze(yp),Object.freeze(yp.prototype),pl.FrozenMap=gp,pl.FrozenSet=yp,Object.defineProperty(oe,"__esModule",{value:!0});var gl=da,xO=H0,wp=Mc,Yi=ai,$t=It,E2=hl,Nr=Ir,SO=pp,AO=dl,yl=Ea,Dt=Rt,wl=Jn,zc=Os,hi=dn,x2=pl;oe.AssertionError=wl.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=SO.ChecksumStruct,oe.Duration=wp.Duration,oe.ESCAPE_CHARACTERS_REGEXP=hi.ESCAPE_CHARACTERS_REGEXP,oe.FrozenMap=x2.FrozenMap,oe.FrozenSet=x2.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=wl.assert,oe.assertExhaustive=wl.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=wl.assertStruct,oe.base64=AO.base64,oe.base64ToBytes=Dt.base64ToBytes,oe.bigIntToBytes=Dt.bigIntToBytes,oe.bigIntToHex=gl.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=yl.createBigInt,oe.createBytes=yl.createBytes,oe.createDataView=Dt.createDataView,oe.createDeferredPromise=xO.createDeferredPromise,oe.createHex=yl.createHex,oe.createModuleLogger=E2.createModuleLogger,oe.createNumber=yl.createNumber,oe.createProjectLogger=E2.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=gl.hexToBigInt,oe.hexToBytes=Dt.hexToBytes,oe.hexToNumber=gl.hexToNumber,oe.inMilliseconds=wp.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=gl.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=wp.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=Jf,Sa=oe;function mp(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=mp;function S2(e){return e==null}Qr.isNullish=S2;function BO(e){return typeof e=="string"&&!(0,Xi.isHexString)(e)?ie.Buffer.from(e):(0,Xi.toBuffer)(e)}Qr.legacyToBuffer=BO;function IO(e,t,r){const n=(0,Xi.fromSigned)(t),i=(0,Xi.fromSigned)(r),s=(0,Xi.bufferToInt)(e),o=mp((0,Xi.toUnsigned)(n).toString("hex"),64),a=mp((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=IO;function RO(e,t){const r=(0,Xi.fromRpcSig)(t);return(0,Xi.ecrecover)(e,r.v,r.r,r.s)}Qr.recoverPublicKey=RO;function TO(e){if(!S2(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=TO,Object.defineProperty(us,"__esModule",{value:!0}),us.extractPublicKey=us.recoverPersonalSignature=us.personalSign=void 0;const Aa=Jf,Ri=Qr;function kO({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=kO;function CO({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=A2(e,t),n=(0,Aa.publicToAddress)(r);return(0,Aa.bufferToHex)(n)}us.recoverPersonalSignature=CO;function LO({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${A2(e,t).toString("hex")}`}us.extractPublicKey=LO;function A2(e,t){const r=(0,Aa.hashPersonalMessage)((0,Ri.legacyToBuffer)(e));return(0,Ri.recoverPublicKey)(r,t)}var B2={},I2={},R2={},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 bp={},ml={};Object.defineProperty(ml,"__esModule",{value:!0}),ml.iterate=void 0;const T2=oe,$O=function*(e,t=32){for(let r=0;r{(0,T2.assert)(s>=0,"Cannot skip a negative number of bytes."),(0,T2.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}};ml.iterate=$O;var vp={},k2={},Ps={},Us={};Object.defineProperty(Us,"__esModule",{value:!0}),Us.padEnd=Us.padStart=Us.set=void 0;const _p=oe,C2=32,OO=(e,t,r)=>(0,_p.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);Us.set=OO;const MO=(e,t=C2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,_p.concatBytes)([r,e])};Us.padStart=MO;const NO=(e,t=C2)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,_p.concatBytes)([e,r])};Us.padEnd=NO,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)))}}}(k2);var Ep={},bl={};(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)}}})(bl);var xp={},L2;function $2(){return L2||(L2=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=oe,r=di,n=kp(),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)}}}(xp)),xp}var O2;function PO(){return O2||(O2=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=kp(),i=Ps,s=bl,o=$2(),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))}}}(Ep)),Ep}var M2={};class N2 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 UO(e){return ei(e)&&typeof e[Symbol.iterator]=="function"}function ei(e){return typeof e=="object"&&e!=null}function P2(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 FO(e){const{done:t,value:r}=e.next();return t?void 0:r}function DO(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*Sp(e,t,r,n){UO(e)||(e=[e]);for(const i of e){const s=DO(i,t,r,n);s&&(yield s)}}function*Ap(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=Ap(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 Sp(l,u,this,c)}:this.validator=()=>[],s?this.refiner=(c,u)=>{const l=s(c,u);return Sp(l,u,this,c)}:this.refiner=()=>[]}assert(t,r){return U2(t,this,r)}create(t,r){return F2(t,this,r)}is(t){return Bp(t,this)}mask(t,r){return D2(t,this,r)}validate(t,r={}){return Ba(t,this,r)}}function U2(e,t,r){const n=Ba(e,t,{message:r});if(n[0])throw n[0]}function F2(e,t,r){const n=Ba(e,t,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function D2(e,t,r){const n=Ba(e,t,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function Bp(e,t){return!Ba(e,t)[0]}function Ba(e,t,r={}){const n=Ap(e,t,r),i=FO(n);return i[0]?[new N2(i[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,i[1]]}function HO(...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 jO(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 zO(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 qO(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 VO(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 WO(e){const t=e instanceof Rr,r=t?{...e.schema}:{...e};for(const n in r)r[n]=H2(r[n]);return t&&e.type==="type"?Vc(r):qc(r)}function KO(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 ZO(e,t){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),Sn(e,t)}function GO(){return Sn("any",()=>!0)}function YO(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 XO(){return Sn("bigint",e=>typeof e=="bigint")}function JO(){return Sn("boolean",e=>typeof e=="boolean")}function QO(){return Sn("date",e=>e instanceof Date&&!isNaN(e.getTime())||`Expected a valid \`Date\` object, but received: ${Pr(e)}`)}function eM(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 tM(){return Sn("func",e=>typeof e=="function"||`Expected a function, but received: ${Pr(e)}`)}function rM(e){return Sn("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${Pr(t)}`)}function nM(){return Sn("integer",e=>typeof e=="number"&&!isNaN(e)&&Number.isInteger(e)||`Expected an integer, but received: ${Pr(e)}`)}function iM(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 sM(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 oM(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 Ip(){return Sn("never",()=>!1)}function aM(e){return new Rr({...e,validator:(t,r)=>t===null||e.validator(t,r),refiner:(t,r)=>t===null||e.refiner(t,r)})}function cM(){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=Ip();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 H2(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 fM(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 uM(){return Sn("regexp",e=>e instanceof RegExp)}function lM(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 j2(){return Sn("string",e=>typeof e=="string"||`Expected a string, but received: ${Pr(e)}`)}function hM(e){const t=Ip();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]=Ap(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 z2(){return Sn("unknown",()=>!0)}function Rp(e,t,r){return new Rr({...e,coercer:(n,i)=>Bp(n,t)?e.coercer(r(n,i),i):e.coercer(n,i)})}function pM(e,t,r={}){return Rp(e,z2(),n=>{const i=typeof t=="function"?t():t;if(n===void 0)return i;if(!r.strict&&P2(n)&&P2(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 gM(e){return Rp(e,j2(),t=>t.trim())}function yM(e){return Eo(e,"empty",t=>{const r=q2(t);return r===0||`Expected an empty ${e.type} but received one with a size of \`${r}\``})}function q2(e){return e instanceof Map||e instanceof Set?e.size:e.length}function wM(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 bM(e){return Eo(e,"nonempty",t=>q2(t)>0||`Expected a nonempty ${e.type} but received an empty one`)}function vM(e,t){return Eo(e,"pattern",r=>t.test(r)||`Expected a ${e.type} matching \`/${t.source}/\` but received "${r}"`)}function _M(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=Sp(s,i,e,n);for(const a of o)yield{...a,refinement:t}}})}var EM=Object.freeze({__proto__:null,Struct:Rr,StructError:N2,any:GO,array:YO,assert:U2,assign:HO,bigint:XO,boolean:JO,coerce:Rp,create:F2,date:QO,defaulted:pM,define:Sn,deprecated:jO,dynamic:zO,empty:yM,enums:eM,func:tM,instance:rM,integer:nM,intersection:iM,is:Bp,lazy:qO,literal:sM,map:oM,mask:D2,max:wM,min:mM,never:Ip,nonempty:bM,nullable:aM,number:cM,object:qc,omit:VO,optional:H2,partial:WO,pattern:vM,pick:KO,record:fM,refine:Eo,regexp:uM,set:lM,size:_M,string:j2,struct:ZO,trimmed:gM,tuple:hM,type:Vc,union:dM,unknown:z2,validate:Ba}),V2=Un(EM),Tp={};(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}}})(Tp),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=oe,r=V2,n=di,i=Tp,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)}}}(M2);var Wc={};Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.bytes=void 0;const Kc=oe,W2=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,W2.padStart)((0,Kc.numberToBytes)(n.byteLength)),(0,W2.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,Kc.bytesToNumber)(t);return e.slice(32,32+r)}};var K2={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=oe,r=V2,n=di,i=bl,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))}}}})(K2);var Z2={};Object.defineProperty(Z2,"__esModule",{value:!0});var vl={};Object.defineProperty(vl,"__esModule",{value:!0}),vl.string=void 0;const G2=oe,Y2=Wc;vl.string={isDynamic:!0,isType:e=>e==="string",getByteLength(){return 32},encode({buffer:e,value:t,packed:r,tight:n}){return Y2.bytes.encode({type:"bytes",buffer:e,value:(0,G2.stringToBytes)(t),packed:r,tight:n})},decode(e){return(0,G2.bytesToString)(Y2.bytes.decode(e))}};var X2;function J2(){return X2||(X2=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(k2,e),r(PO(),e),r(M2,e),r(Wc,e),r(bl,e),r(K2,e),r(Tp,e),r(Z2,e),r(vl,e),r($2(),e)}(vp)),vp}var Q2;function kp(){return Q2||(Q2=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=ml,i=J2(),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}(bp)),bp}(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=kp(),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})(R2);var eE={},tE={};Object.defineProperty(tE,"__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(tE,e)}(eE),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(R2,e),r(di,e),r(eE,e)}(I2),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=Jf,r=I2,n=J2(),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}(B2);var ti={},rE={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 nE({publicKey:e,data:u,version:r})}ti.encryptSafely=BM;function iE({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=iE;function IM({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(iE({encryptedData:e,privateKey:t})).data}ti.decryptSafely=IM;function RM(e){const t=ie.Buffer.from(e,"hex"),r=xo.box.keyPair.fromSecretKey(t).publicKey;return Ti.base64.encode(r)}ti.getEncryptionPublicKey=RM,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(B2,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 sE extends Error{constructor(t,r){super(),this.code=t,this.message=r}toString(){return`${this.message} (${this.code})`}}var TM=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},kM=(e,t,r)=>(TM(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)},Cp;const Ia=class{constructor(e){CM(this,Cp,["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(kM(this,Cp).includes(e.method))return Promise.reject(new sE(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,isEthSign:!0}})}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 LM=Ia;Cp=new WeakMap;var $M=Object.defineProperty,oE=Object.getOwnPropertySymbols,OM=Object.prototype.hasOwnProperty,MM=Object.prototype.propertyIsEnumerable,aE=(e,t,r)=>t in e?$M(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,NM=(e,t)=>{for(var r in t||(t={}))OM.call(t,r)&&aE(e,r,t[r]);if(oE)for(var r of oE(t))MM.call(t,r)&&aE(e,r,t[r]);return e},cE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},PM=(e,t,r)=>(cE(e,t,"read from private field"),r?r.call(e):t.get(e)),UM=(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)},FM=(e,t,r,n)=>(cE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),_l;class fE{constructor(t){UM(this,_l,void 0),FM(this,_l,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(PM(this,_l),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(NM({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}}_l=new WeakMap;var uE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},Nn=(e,t,r)=>(uE(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)=>(uE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Ji,Ta,El,Zc,Fs,ka;const lE=class extends sf{constructor(e){super(),Ra(this,Ji,void 0),Ra(this,Ta,void 0),Ra(this,El,!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,El,e.disableMobileAdapter),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust),Pn(this,ka,new fE(Nn(this,Ta)))),Nn(this,El)||(this.mobileAdapter=new LM(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 sE(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 lE.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 fE(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 hE=lE;Ji=new WeakMap,Ta=new WeakMap,El=new WeakMap,Zc=new WeakMap,Fs=new WeakMap,ka=new WeakMap,hE.NETWORK="ethereum";class DM{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 dE=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},pE=(e,t,r)=>(dE(e,t,"read from private field"),r?r.call(e):t.get(e)),HM=(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)},jM=(e,t,r,n)=>(dE(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r),Gc;const Yc=class extends sf{constructor(e){super(),HM(this,Gc,!1),this.isKeplr=!0,this.isTrust=!0,this.isTrustWallet=!0,e&&(typeof e.disableMobileAdapter<"u"&&jM(this,Gc,e.disableMobileAdapter),typeof e.isKeplr<"u"&&(this.isKeplr=e.isKeplr),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),pE(this,Gc)||(this.mobileAdapter=new DM(this))}static bufferToHex(e){return"0x"+ie.Buffer.from(e).toString("hex")}getNetwork(){return Yc.NETWORK}isMobileAdapterEnabled(){return!pE(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 gE=Yc;Gc=new WeakMap,gE.NETWORK="cosmos";var Lp={exports:{}},Ca=typeof Reflect=="object"?Reflect:null,yE=Ca&&typeof Ca.apply=="function"?Ca.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)},xl;Ca&&typeof Ca.ownKeys=="function"?xl=Ca.ownKeys:Object.getOwnPropertySymbols?xl=function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:xl=function(e){return Object.getOwnPropertyNames(e)};function zM(e){console&&console.warn&&console.warn(e)}var wE=Number.isNaN||function(e){return e!==e};function Gt(){Gt.init.call(this)}Lp.exports=Gt,Lp.exports.once=KM,Gt.EventEmitter=Gt,Gt.prototype._events=void 0,Gt.prototype._eventsCount=0,Gt.prototype._maxListeners=void 0;var mE=10;function Sl(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 mE},set:function(e){if(typeof e!="number"||e<0||wE(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");mE=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||wE(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 bE(e){return e._maxListeners===void 0?Gt.defaultMaxListeners:e._maxListeners}Gt.prototype.getMaxListeners=function(){return bE(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")yE(a,this,t);else for(var c=a.length,u=SE(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,zM(a)}return e}Gt.prototype.addListener=function(e,t){return vE(this,e,t,!1)},Gt.prototype.on=Gt.prototype.addListener,Gt.prototype.prependListener=function(e,t){return vE(this,e,t,!0)};function qM(){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 _E(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=qM.bind(n);return i.listener=r,n.wrapFn=i,i}Gt.prototype.once=function(e,t){return Sl(t),this.on(e,_E(this,e,t)),this},Gt.prototype.prependOnceListener=function(e,t){return Sl(t),this.prependListener(e,_E(this,e,t)),this},Gt.prototype.removeListener=function(e,t){var r,n,i,s,o;if(Sl(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():VM(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 EE(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?WM(i):SE(i,i.length)}Gt.prototype.listeners=function(e){return EE(this,e,!0)},Gt.prototype.rawListeners=function(e){return EE(this,e,!1)},Gt.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):xE.call(e,t)},Gt.prototype.listenerCount=xE;function xE(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?xl(this._events):[]};function SE(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: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 TE=Xc;TE.NETWORK="aptos";var XM=Object.defineProperty,JM=Object.defineProperties,QM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,kE=Object.prototype.hasOwnProperty,CE=Object.prototype.propertyIsEnumerable,LE=(e,t,r)=>t in e?XM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Op=(e,t)=>{for(var r in t||(t={}))kE.call(t,r)&&LE(e,r,t[r]);if(Al)for(var r of Al(t))CE.call(t,r)&&LE(e,r,t[r]);return e},eN=(e,t)=>JM(e,QM(t)),tN=(e,t)=>{var r={};for(var n in e)kE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&CE.call(e,n)&&(r[n]=e[n]);return r};class Mp{constructor(t){this.provider=t}static mapToCamelCase(t){return Op(Op({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=tN(n,["state_init"]);return eN(Op({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const n=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(n)}case"tonConnect_reconnect":{const n=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(n)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":return this.provider.internalRequest("signTransaction",Mp.mapToCamelCase(r[0]));case"ton_requestAccounts":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i}]=JSON.parse(n);return[i]}case"ton_requestWallets":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i,publicKey:s}]=JSON.parse(n);return[{address:i,publicKey:s,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const $E=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Mp(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return $E.NETWORK}};let OE=$E;OE.NETWORK="ton";class Np extends Error{constructor(t,r){super(t),this.code=r}}const ME=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class rN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Np("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Np?this.emit(ME(r)):this.emit(ME(new Np((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const nN=(e,t)=>new sx({strategy:e,handler:t}),iN=e=>new Z1(e),sN=e=>new wE(e),oN=e=>new pE(e),aN=e=>new TE(e),cN=e=>new OE(e),fN=(e,t)=>new rN(e,t);window.trustwallet={core:nN,solana:iN,cosmos:sN,ethereum:oN,aptos:aN,ton:cN,tonBridge:fN}}); +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 IE=Xc;IE.NETWORK="aptos";var YM=Object.defineProperty,XM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,kE=(e,t,r)=>t in e?YM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t)=>{for(var r in t||(t={}))RE.call(t,r)&&kE(e,r,t[r]);if(Al)for(var r of Al(t))TE.call(t,r)&&kE(e,r,t[r]);return e},QM=(e,t)=>XM(e,JM(t)),eN=(e,t)=>{var r={};for(var n in e)RE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&TE.call(e,n)&&(r[n]=e[n]);return r};class Op{constructor(t){this.provider=t}static mapToCamelCase(t){return $p($p({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=eN(n,["state_init"]);return QM($p({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const n=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(n)}case"tonConnect_reconnect":{const n=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(n)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":return this.provider.internalRequest("signTransaction",Op.mapToCamelCase(r[0]));case"ton_requestAccounts":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i}]=JSON.parse(n);return[i]}case"ton_requestWallets":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i,publicKey:s}]=JSON.parse(n);return[{address:i,publicKey:s,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const CE=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Op(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return CE.NETWORK}};let LE=CE;LE.NETWORK="ton";class Mp extends Error{constructor(t,r){super(t),this.code=r}}const $E=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class tN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Mp("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Mp?this.emit($E(r)):this.emit($E(new Mp((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const rN=(e,t)=>new nx({strategy:e,handler:t}),nN=e=>new K1(e),iN=e=>new gE(e),sN=e=>new hE(e),oN=e=>new IE(e),aN=e=>new LE(e),cN=(e,t)=>new tN(e,t);window.trustwallet={core:rN,solana:nN,cosmos:iN,ethereum:sN,aptos:oN,ton:aN,tonBridge:cN}}); diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index a73ba59a..b545d643 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:941a1d962a31c5ced8285d8cce96926b2312b4300395b526a2ccdcfb1ceeb96b -size 678319 +oid sha256:58f189f6634b02ebb1d55387934521d42742774800d88740d486e4de40ee2c65 +size 678256 From 15adcaebf74821239980def83dc9499bb0e5f7e2 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Fri, 4 Oct 2024 14:50:15 -0300 Subject: [PATCH 07/11] Parse seq & auto connect boolean --- android/lib/src/main/res/raw/trust_min.js | 2 +- packages/ios-web3-provider/swift/TrustWeb3Provider.swift | 7 +++++-- packages/ios-web3-provider/swift/trust-min.js | 4 ++-- packages/ton/MobileAdapter.ts | 4 +++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/android/lib/src/main/res/raw/trust_min.js b/android/lib/src/main/res/raw/trust_min.js index f5bc8b86..a5a4d5f5 100644 --- a/android/lib/src/main/res/raw/trust_min.js +++ b/android/lib/src/main/res/raw/trust_min.js @@ -31,4 +31,4 @@ address: `+r),e.application&&(n+=` application: `+i),e.chainId&&(n+=` chainId: `+this.chainId),n+=` message: `+e.message,n+=` -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 IE=Xc;IE.NETWORK="aptos";var YM=Object.defineProperty,XM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,kE=(e,t,r)=>t in e?YM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t)=>{for(var r in t||(t={}))RE.call(t,r)&&kE(e,r,t[r]);if(Al)for(var r of Al(t))TE.call(t,r)&&kE(e,r,t[r]);return e},QM=(e,t)=>XM(e,JM(t)),eN=(e,t)=>{var r={};for(var n in e)RE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&TE.call(e,n)&&(r[n]=e[n]);return r};class Op{constructor(t){this.provider=t}static mapToCamelCase(t){return $p($p({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=eN(n,["state_init"]);return QM($p({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const n=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(n)}case"tonConnect_reconnect":{const n=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(n)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":return this.provider.internalRequest("signTransaction",Op.mapToCamelCase(r[0]));case"ton_requestAccounts":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i}]=JSON.parse(n);return[i]}case"ton_requestWallets":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i,publicKey:s}]=JSON.parse(n);return[{address:i,publicKey:s,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const CE=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Op(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return CE.NETWORK}};let LE=CE;LE.NETWORK="ton";class Mp extends Error{constructor(t,r){super(t),this.code=r}}const $E=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class tN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Mp("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Mp?this.emit($E(r)):this.emit($E(new Mp((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const rN=(e,t)=>new nx({strategy:e,handler:t}),nN=e=>new K1(e),iN=e=>new gE(e),sN=e=>new hE(e),oN=e=>new IE(e),aN=e=>new LE(e),cN=(e,t)=>new tN(e,t);window.trustwallet={core:rN,solana:nN,cosmos:iN,ethereum:sN,aptos:oN,ton:aN,tonBridge:cN}}); +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 IE=Xc;IE.NETWORK="aptos";var YM=Object.defineProperty,XM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,kE=(e,t,r)=>t in e?YM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t)=>{for(var r in t||(t={}))RE.call(t,r)&&kE(e,r,t[r]);if(Al)for(var r of Al(t))TE.call(t,r)&&kE(e,r,t[r]);return e},QM=(e,t)=>XM(e,JM(t)),eN=(e,t)=>{var r={};for(var n in e)RE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&TE.call(e,n)&&(r[n]=e[n]);return r};class Op{constructor(t){this.provider=t}static mapToCamelCase(t){return $p($p({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=eN(n,["state_init"]);return QM($p({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const i=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(i)}case"tonConnect_reconnect":{const i=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(i)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":const n=await this.provider.internalRequest("signTransaction",Op.mapToCamelCase(r[0]));return parseInt(n,10);case"ton_requestAccounts":{const i=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:s}]=JSON.parse(i);return[s]}case"ton_requestWallets":{const i=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:s,publicKey:o}]=JSON.parse(i);return[{address:s,publicKey:o,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const CE=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Op(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return CE.NETWORK}};let LE=CE;LE.NETWORK="ton";class Mp extends Error{constructor(t,r){super(t),this.code=r}}const $E=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class tN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Mp("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Mp?this.emit($E(r)):this.emit($E(new Mp((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const rN=(e,t)=>new nx({strategy:e,handler:t}),nN=e=>new K1(e),iN=e=>new gE(e),sN=e=>new hE(e),oN=e=>new IE(e),aN=e=>new LE(e),cN=(e,t)=>new tN(e,t);window.trustwallet={core:rN,solana:nN,cosmos:iN,ethereum:sN,aptos:oN,ton:aN,tonBridge:cN}}); diff --git a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift index b910c580..e8185c2f 100644 --- a/packages/ios-web3-provider/swift/TrustWeb3Provider.swift +++ b/packages/ios-web3-provider/swift/TrustWeb3Provider.swift @@ -14,19 +14,22 @@ public struct TrustWeb3Provider { public let aptos: AptosConfig public let ton: TonConfig public let appVersion: String + public let autoConnect: Bool public init( ethereum: EthereumConfig, solana: SolanaConfig, aptos: AptosConfig = AptosConfig(network: "Mainnet", chainId: "1"), ton: TonConfig, - appVersion: String + appVersion: String, + autoConnect: Bool ) { self.ethereum = ethereum self.solana = solana self.aptos = aptos self.ton = ton self.appVersion = appVersion + self.autoConnect = autoConnect } public struct EthereumConfig: Equatable { @@ -148,7 +151,7 @@ public struct TrustWeb3Provider { image: 'https://assets-cdn.trustwallet.com/dapps/trust.logo.png', about_url: 'https://trustwallet.com/about-us', }, - isWalletBrowser: true, + isWalletBrowser: \(config.autoConnect), }; const tonBridge = trustwallet.tonBridge(walletInfo, ton); diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index b545d643..56a49fcf 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:58f189f6634b02ebb1d55387934521d42742774800d88740d486e4de40ee2c65 -size 678256 +oid sha256:71756f5c20853e933ff65250051a6da6740fb4f870678d2931b1efb3325c5d47 +size 678378 diff --git a/packages/ton/MobileAdapter.ts b/packages/ton/MobileAdapter.ts index be645fa1..ab4595f1 100644 --- a/packages/ton/MobileAdapter.ts +++ b/packages/ton/MobileAdapter.ts @@ -57,11 +57,13 @@ export class MobileAdapter { case 'ton_sendTransaction': case 'tonConnect_sendTransaction': - return this.provider.internalRequest( + const res = await this.provider.internalRequest( 'signTransaction', MobileAdapter.mapToCamelCase((params as object[])[0] as ITransaction), ); + return parseInt(res, 10) as T; + case 'ton_requestAccounts': { const res = await this.provider.internalRequest( 'requestAccounts', From 3c182f08fe23ce4d6b7f5d6cd21ebb88cac612f2 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Fri, 4 Oct 2024 17:30:45 -0300 Subject: [PATCH 08/11] Parse seq & auto connect boolean --- packages/ios-web3-provider/swift/trust-min.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index 56a49fcf..f987ab7a 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:71756f5c20853e933ff65250051a6da6740fb4f870678d2931b1efb3325c5d47 -size 678378 +oid sha256:c33a5fb09ea593ed3a5b5126671447dce7a21952274fdc83f285cdbd732870ae +size 678407 From 72bdaaf232608a756e2e206461d27ff048452319 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Fri, 4 Oct 2024 18:00:07 -0300 Subject: [PATCH 09/11] Accept nonce and hash --- packages/ton/MobileAdapter.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/ton/MobileAdapter.ts b/packages/ton/MobileAdapter.ts index ab4595f1..f4115d8e 100644 --- a/packages/ton/MobileAdapter.ts +++ b/packages/ton/MobileAdapter.ts @@ -62,7 +62,9 @@ export class MobileAdapter { MobileAdapter.mapToCamelCase((params as object[])[0] as ITransaction), ); - return parseInt(res, 10) as T; + const { nonce, hash } = JSON.parse(res); + + return method === 'ton_sendTransaction' ? nonce : hash; case 'ton_requestAccounts': { const res = await this.provider.internalRequest( From 47049ba77ef8fa25f6a2b45986b4b03b82b0853a Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Fri, 4 Oct 2024 18:02:13 -0300 Subject: [PATCH 10/11] Build new nonce support --- android/lib/src/main/res/raw/trust_min.js | 2 +- packages/ios-web3-provider/swift/trust-min.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/android/lib/src/main/res/raw/trust_min.js b/android/lib/src/main/res/raw/trust_min.js index a5a4d5f5..e970975b 100644 --- a/android/lib/src/main/res/raw/trust_min.js +++ b/android/lib/src/main/res/raw/trust_min.js @@ -31,4 +31,4 @@ address: `+r),e.application&&(n+=` application: `+i),e.chainId&&(n+=` chainId: `+this.chainId),n+=` message: `+e.message,n+=` -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 IE=Xc;IE.NETWORK="aptos";var YM=Object.defineProperty,XM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,kE=(e,t,r)=>t in e?YM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t)=>{for(var r in t||(t={}))RE.call(t,r)&&kE(e,r,t[r]);if(Al)for(var r of Al(t))TE.call(t,r)&&kE(e,r,t[r]);return e},QM=(e,t)=>XM(e,JM(t)),eN=(e,t)=>{var r={};for(var n in e)RE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&TE.call(e,n)&&(r[n]=e[n]);return r};class Op{constructor(t){this.provider=t}static mapToCamelCase(t){return $p($p({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=eN(n,["state_init"]);return QM($p({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const i=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(i)}case"tonConnect_reconnect":{const i=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(i)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":const n=await this.provider.internalRequest("signTransaction",Op.mapToCamelCase(r[0]));return parseInt(n,10);case"ton_requestAccounts":{const i=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:s}]=JSON.parse(i);return[s]}case"ton_requestWallets":{const i=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:s,publicKey:o}]=JSON.parse(i);return[{address:s,publicKey:o,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const CE=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Op(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return CE.NETWORK}};let LE=CE;LE.NETWORK="ton";class Mp extends Error{constructor(t,r){super(t),this.code=r}}const $E=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class tN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Mp("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Mp?this.emit($E(r)):this.emit($E(new Mp((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const rN=(e,t)=>new nx({strategy:e,handler:t}),nN=e=>new K1(e),iN=e=>new gE(e),sN=e=>new hE(e),oN=e=>new IE(e),aN=e=>new LE(e),cN=(e,t)=>new tN(e,t);window.trustwallet={core:rN,solana:nN,cosmos:iN,ethereum:sN,aptos:oN,ton:aN,tonBridge:cN}}); +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 IE=Xc;IE.NETWORK="aptos";var YM=Object.defineProperty,XM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,kE=(e,t,r)=>t in e?YM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t)=>{for(var r in t||(t={}))RE.call(t,r)&&kE(e,r,t[r]);if(Al)for(var r of Al(t))TE.call(t,r)&&kE(e,r,t[r]);return e},QM=(e,t)=>XM(e,JM(t)),eN=(e,t)=>{var r={};for(var n in e)RE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&TE.call(e,n)&&(r[n]=e[n]);return r};class Op{constructor(t){this.provider=t}static mapToCamelCase(t){return $p($p({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=eN(n,["state_init"]);return QM($p({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const o=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(o)}case"tonConnect_reconnect":{const o=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(o)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":const n=await this.provider.internalRequest("signTransaction",Op.mapToCamelCase(r[0])),{nonce:i,hash:s}=JSON.parse(n);return t==="ton_sendTransaction"?i:s;case"ton_requestAccounts":{const o=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:a}]=JSON.parse(o);return[a]}case"ton_requestWallets":{const o=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:a,publicKey:c}]=JSON.parse(o);return[{address:a,publicKey:c,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const CE=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Op(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return CE.NETWORK}};let LE=CE;LE.NETWORK="ton";class Mp extends Error{constructor(t,r){super(t),this.code=r}}const $E=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class tN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Mp("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Mp?this.emit($E(r)):this.emit($E(new Mp((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const rN=(e,t)=>new nx({strategy:e,handler:t}),nN=e=>new K1(e),iN=e=>new gE(e),sN=e=>new hE(e),oN=e=>new IE(e),aN=e=>new LE(e),cN=(e,t)=>new tN(e,t);window.trustwallet={core:rN,solana:nN,cosmos:iN,ethereum:sN,aptos:oN,ton:aN,tonBridge:cN}}); diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index f987ab7a..52f87abf 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:c33a5fb09ea593ed3a5b5126671447dce7a21952274fdc83f285cdbd732870ae -size 678407 +oid sha256:6c79dcf0c35185e2eb0c76af76c664661e291abf0b2c85285af15f01ec32ed10 +size 678453 From 00744db97ad6fad4562fa34614a6fd640ae57195 Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Fri, 4 Oct 2024 18:26:56 -0300 Subject: [PATCH 11/11] Wrapping boc --- android/lib/src/main/res/raw/trust_min.js | 2 +- packages/ios-web3-provider/swift/trust-min.js | 4 ++-- packages/ton/MobileAdapter.ts | 5 +++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/android/lib/src/main/res/raw/trust_min.js b/android/lib/src/main/res/raw/trust_min.js index e970975b..c50fb652 100644 --- a/android/lib/src/main/res/raw/trust_min.js +++ b/android/lib/src/main/res/raw/trust_min.js @@ -31,4 +31,4 @@ address: `+r),e.application&&(n+=` application: `+i),e.chainId&&(n+=` chainId: `+this.chainId),n+=` message: `+e.message,n+=` -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 IE=Xc;IE.NETWORK="aptos";var YM=Object.defineProperty,XM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,kE=(e,t,r)=>t in e?YM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t)=>{for(var r in t||(t={}))RE.call(t,r)&&kE(e,r,t[r]);if(Al)for(var r of Al(t))TE.call(t,r)&&kE(e,r,t[r]);return e},QM=(e,t)=>XM(e,JM(t)),eN=(e,t)=>{var r={};for(var n in e)RE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&TE.call(e,n)&&(r[n]=e[n]);return r};class Op{constructor(t){this.provider=t}static mapToCamelCase(t){return $p($p({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=eN(n,["state_init"]);return QM($p({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const o=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(o)}case"tonConnect_reconnect":{const o=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(o)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":const n=await this.provider.internalRequest("signTransaction",Op.mapToCamelCase(r[0])),{nonce:i,hash:s}=JSON.parse(n);return t==="ton_sendTransaction"?i:s;case"ton_requestAccounts":{const o=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:a}]=JSON.parse(o);return[a]}case"ton_requestWallets":{const o=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:a,publicKey:c}]=JSON.parse(o);return[{address:a,publicKey:c,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const CE=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Op(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return CE.NETWORK}};let LE=CE;LE.NETWORK="ton";class Mp extends Error{constructor(t,r){super(t),this.code=r}}const $E=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class tN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Mp("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Mp?this.emit($E(r)):this.emit($E(new Mp((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const rN=(e,t)=>new nx({strategy:e,handler:t}),nN=e=>new K1(e),iN=e=>new gE(e),sN=e=>new hE(e),oN=e=>new IE(e),aN=e=>new LE(e),cN=(e,t)=>new tN(e,t);window.trustwallet={core:rN,solana:nN,cosmos:iN,ethereum:sN,aptos:oN,ton:aN,tonBridge:cN}}); +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 IE=Xc;IE.NETWORK="aptos";var YM=Object.defineProperty,XM=Object.defineProperties,JM=Object.getOwnPropertyDescriptors,Al=Object.getOwnPropertySymbols,RE=Object.prototype.hasOwnProperty,TE=Object.prototype.propertyIsEnumerable,kE=(e,t,r)=>t in e?YM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,$p=(e,t)=>{for(var r in t||(t={}))RE.call(t,r)&&kE(e,r,t[r]);if(Al)for(var r of Al(t))TE.call(t,r)&&kE(e,r,t[r]);return e},QM=(e,t)=>XM(e,JM(t)),eN=(e,t)=>{var r={};for(var n in e)RE.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(e!=null&&Al)for(var n of Al(e))t.indexOf(n)<0&&TE.call(e,n)&&(r[n]=e[n]);return r};class Op{constructor(t){this.provider=t}static mapToCamelCase(t){return $p($p({},t),t!=null&&t.messages?{messages:(t?.messages||[]).map(r=>{var n=r,{state_init:i}=n,s=eN(n,["state_init"]);return QM($p({},s),{stateInit:i})})}:{})}async request(t,r){switch(t){case"tonConnect_connect":{const n=await this.provider.internalRequest("requestAccounts",r);return JSON.parse(n)}case"tonConnect_reconnect":{const n=await this.provider.internalRequest("tonConnect_reconnect",r);return JSON.parse(n)}case"ton_rawSign":return this.provider.internalRequest("signMessage",r);case"ton_sendTransaction":case"tonConnect_sendTransaction":{const n=await this.provider.internalRequest("signTransaction",Op.mapToCamelCase(r[0])),{nonce:i,hash:s}=JSON.parse(n);return t==="ton_sendTransaction"?i:{boc:s}}case"ton_requestAccounts":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i}]=JSON.parse(n);return[i]}case"ton_requestWallets":{const n=await this.provider.internalRequest("requestAccounts",r),[{nonBounceable:i,publicKey:s}]=JSON.parse(n);return[{address:i,publicKey:s,version:this.provider.version}]}default:return this.provider.internalRequest(t,r)}}}const CE=class extends sf{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),e!=null&&e.disableMobileAdapter||(this.mobileAdapter=new Op(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){const r=()=>this.internalRequest(e,t);return this.mobileAdapter?await this.mobileAdapter.request(e,t):await r()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return CE.NETWORK}};let LE=CE;LE.NETWORK="ton";class Mp extends Error{constructor(t,r){super(t),this.code=r}}const $E=e=>{var t;return{event:"connect_error",payload:{code:(t=e.code)!=null?t:0,message:e.message}}};class tN{constructor(t,r){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=n=>(this.callbacks.push(n),()=>{this.callbacks=this.callbacks.filter(i=>i!=n)}),t&&(typeof t.isWalletBrowser<"u"&&(this.isWalletBrowser=t.isWalletBrowser),t.walletInfo&&(this.walletInfo=t.walletInfo),t.deviceInfo&&(this.deviceInfo=t.deviceInfo)),this.provider=r}async connect(t,r){t>this.protocolVersion&&new Mp("Unsupported protocol version",1);const n=await this.provider.send("tonConnect_connect",r);return this.emit({event:"connect",payload:{items:n,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(t){return this.callbacks.forEach(r=>r(t)),t}async restoreConnection(){var t;try{const r=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}catch(r){return r instanceof Mp?this.emit($E(r)):this.emit($E(new Mp((t=r.message)!=null?t:"Unknown error")))}}async send(t){try{return{result:await this.provider.send(`tonConnect_${t.method}`,t.params.map(r=>JSON.parse(r))),id:t.id.toString()}}catch(r){return{error:r,id:String(t.id)}}}}const rN=(e,t)=>new nx({strategy:e,handler:t}),nN=e=>new K1(e),iN=e=>new gE(e),sN=e=>new hE(e),oN=e=>new IE(e),aN=e=>new LE(e),cN=(e,t)=>new tN(e,t);window.trustwallet={core:rN,solana:nN,cosmos:iN,ethereum:sN,aptos:oN,ton:aN,tonBridge:cN}}); diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index 52f87abf..2f327ff1 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:6c79dcf0c35185e2eb0c76af76c664661e291abf0b2c85285af15f01ec32ed10 -size 678453 +oid sha256:52c54021c483b1472313ceb680765b858a4fb0e60d5a028e3d036263dcafd8a0 +size 678460 diff --git a/packages/ton/MobileAdapter.ts b/packages/ton/MobileAdapter.ts index f4115d8e..ddcc37df 100644 --- a/packages/ton/MobileAdapter.ts +++ b/packages/ton/MobileAdapter.ts @@ -56,7 +56,7 @@ export class MobileAdapter { return this.provider.internalRequest('signMessage', params); case 'ton_sendTransaction': - case 'tonConnect_sendTransaction': + case 'tonConnect_sendTransaction': { const res = await this.provider.internalRequest( 'signTransaction', MobileAdapter.mapToCamelCase((params as object[])[0] as ITransaction), @@ -64,7 +64,8 @@ export class MobileAdapter { const { nonce, hash } = JSON.parse(res); - return method === 'ton_sendTransaction' ? nonce : hash; + return method === 'ton_sendTransaction' ? nonce : { boc: hash }; + } case 'ton_requestAccounts': { const res = await this.provider.internalRequest(