From 5ecb8d36380a7a338883ec973850a069b41920fe Mon Sep 17 00:00:00 2001 From: Yeferson Licet Date: Thu, 31 Oct 2024 11:56:39 -0300 Subject: [PATCH] chore: Adding mobile builds --- 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 3539ebb0..a8458f56 100644 --- a/android/lib/src/main/res/raw/trust_min.js +++ b/android/lib/src/main/res/raw/trust_min.js @@ -36,4 +36,4 @@ Object.defineProperty(e,"__esModule",{value:!0}),e.bytes=e.stringToBytes=e.str=e /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */ Object.defineProperty(e,"__esModule",{value:!0}),e.Hash=e.nextTick=e.byteSwapIfBE=e.byteSwap=e.isLE=e.rotl=e.rotr=e.createView=e.u32=e.u8=void 0,e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name},e.byteSwap32=function(t){for(let r=0;r=0&&te().update(a(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(a(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(a(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));if(t.crypto&&"function"==typeof t.crypto.randomBytes)return t.crypto.randomBytes(e);throw new Error("crypto.getRandomValues must be defined")};const t=W_,r=h_;e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);e.rotr=(e,t)=>e<<32-t|e>>>t;e.rotl=(e,t)=>e<>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t);const n=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));const i={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=i._0&&e<=i._9?e-i._0:e>=i._A&&e<=i._F?e-(i._A-10):e>=i._a&&e<=i._f?e-(i._a-10):void 0}function s(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function a(e){return"string"==typeof e&&(e=s(e)),(0,r.bytes)(e),e}e.nextTick=async()=>{};e.Hash=class{clone(){return this._cloneInto()}};const c={}.toString}(K_),Object.defineProperty(u_,"__esModule",{value:!0}),u_.shake256=u_.shake128=u_.keccak_512=u_.keccak_384=u_.keccak_256=u_.keccak_224=u_.sha3_512=u_.sha3_384=u_.sha3_256=u_.sha3_224=u_.Keccak=void 0,u_.keccakP=uE;const V_=h_,Z_=b_,G_=K_,J_=[],Y_=[],X_=[],Q_=BigInt(0),eE=BigInt(1),tE=BigInt(2),rE=BigInt(7),nE=BigInt(256),iE=BigInt(113);for(let e=0,t=eE,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],J_.push(2*(5*n+r)),Y_.push((e+1)*(e+2)/2%64);let i=Q_;for(let e=0;e<7;e++)t=(t<>rE)*iE)%nE,t&tE&&(i^=eE<<(eE<r>32?(0,Z_.rotlBH)(e,t,r):(0,Z_.rotlSH)(e,t,r),cE=(e,t,r)=>r>32?(0,Z_.rotlBL)(e,t,r):(0,Z_.rotlSL)(e,t,r);function uE(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=aE(o,s,1)^r[n],c=cE(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=Y_[r],o=aE(t,i,n),s=cE(t,i,n),a=J_[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=oE[n],e[1]^=sE[n]}r.fill(0)}class hE extends G_.Hash{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,V_.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,G_.u32)(this.state)}keccak(){G_.isLE||(0,G_.byteSwap32)(this.state32),uE(this.state32,this.rounds),G_.isLE||(0,G_.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(e){(0,V_.exists)(this);const{blockLen:t,state:r}=this,n=(e=(0,G_.toBytes)(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,V_.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,V_.output)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new hE(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}u_.Keccak=hE;const lE=(e,t,r)=>(0,G_.wrapConstructor)((()=>new hE(t,e,r)));u_.sha3_224=lE(6,144,28),u_.sha3_256=lE(6,136,32),u_.sha3_384=lE(6,104,48),u_.sha3_512=lE(6,72,64),u_.keccak_224=lE(1,144,28),u_.keccak_256=lE(1,136,32),u_.keccak_384=lE(1,104,48),u_.keccak_512=lE(1,72,64);const fE=(e,t,r)=>(0,G_.wrapXOFConstructorWithOpts)(((n={})=>new hE(t,e,void 0===n.dkLen?r:n.dkLen,!0)));var dE,pE;function gE(){return dE||(dE=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.remove0x=e.add0x=e.isValidChecksumAddress=e.getChecksumAddress=e.isValidHexAddress=e.assertIsStrictHexString=e.assertIsHexString=e.isStrictHexString=e.isHexString=e.HexChecksumAddressStruct=e.HexAddressStruct=e.StrictHexStruct=e.HexStruct=void 0;const t=nv,r=u_,n=rv,i=yE();function o(r){return(0,t.is)(r,e.HexStruct)}function s(r){return(0,t.is)(r,e.StrictHexStruct)}function a(o){(0,n.assert)((0,t.is)(o,e.HexChecksumAddressStruct),"Invalid hex address.");const s=u(o.toLowerCase()),a=u((0,i.bytesToHex)((0,r.keccak_256)(s)));return`0x${s.split("").map(((e,r)=>{const i=a[r];return(0,n.assert)((0,t.is)(i,(0,t.string)()),"Hash shorter than address."),parseInt(i,16)>7?e.toUpperCase():e})).join("")}`}function c(r){return!!(0,t.is)(r,e.HexChecksumAddressStruct)&&a(r)===r}function u(e){return e.startsWith("0x")||e.startsWith("0X")?e.substring(2):e}e.HexStruct=(0,t.pattern)((0,t.string)(),/^(?:0x)?[0-9a-f]+$/iu),e.StrictHexStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]+$/iu),e.HexAddressStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-f]{40}$/u),e.HexChecksumAddressStruct=(0,t.pattern)((0,t.string)(),/^0x[0-9a-fA-F]{40}$/u),e.isHexString=o,e.isStrictHexString=s,e.assertIsHexString=function(e){(0,n.assert)(o(e),"Value must be a hexadecimal string.")},e.assertIsStrictHexString=function(e){(0,n.assert)(s(e),'Value must be a hexadecimal string, starting with "0x".')},e.isValidHexAddress=function(r){return(0,t.is)(r,e.HexAddressStruct)||c(r)},e.getChecksumAddress=a,e.isValidChecksumAddress=c,e.add0x=function(e){return e.startsWith("0x")?e:e.startsWith("0X")?`0x${e.substring(2)}`:`0x${e}`},e.remove0x=u}(c_)),c_}function yE(){if(pE)return s_;pE=1,Object.defineProperty(s_,"__esModule",{value:!0}),s_.createDataView=s_.concatBytes=s_.valueToBytes=s_.base64ToBytes=s_.stringToBytes=s_.numberToBytes=s_.signedBigIntToBytes=s_.bigIntToBytes=s_.hexToBytes=s_.bytesToBase64=s_.bytesToString=s_.bytesToNumber=s_.bytesToSignedBigInt=s_.bytesToBigInt=s_.bytesToHex=s_.assertIsBytes=s_.isBytes=void 0;const e=a_,t=rv,r=gE();const n=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function i(e){return e instanceof Uint8Array}function o(e){(0,t.assert)(i(e),"Value must be a Uint8Array.")}function s(e){if(o(e),0===e.length)return"0x";const t=n(),i=new Array(e.length);for(let r=0;r=BigInt(0),"Value must be a non-negative bigint.");return c(e.toString(16))}function h(e){(0,t.assert)("number"==typeof e,"Value must be a number."),(0,t.assert)(e>=0,"Value must be a non-negative number."),(0,t.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return c(e.toString(16))}function l(e){return(0,t.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function f(e){if("bigint"==typeof e)return u(e);if("number"==typeof e)return h(e);if("string"==typeof e)return e.startsWith("0x")?c(e):l(e);if(i(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}return s_.isBytes=i,s_.assertIsBytes=o,s_.bytesToHex=s,s_.bytesToBigInt=a,s_.bytesToSignedBigInt=function(e){o(e);let t=BigInt(0);for(const r of e)t=(t<0,"Byte length must be greater than 0."),(0,t.assert)(function(e,r){(0,t.assert)(r>0);const n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*r-1))}(e,r),"Byte length is too small to represent the given value.");let n=e;const i=new Uint8Array(r);for(let e=0;e>=BigInt(8);return i.reverse()},s_.numberToBytes=h,s_.stringToBytes=l,s_.base64ToBytes=function(r){return(0,t.assert)("string"==typeof r,"Value must be a string."),e.base64.decode(r)},s_.valueToBytes=f,s_.concatBytes=function(e){const t=new Array(e.length);let r=0;for(let n=0;n[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})$/u,e.CAIP_NAMESPACE_REGEX=/^[-a-z0-9]{3,8}$/u,e.CAIP_REFERENCE_REGEX=/^[-_a-zA-Z0-9]{1,32}$/u,e.CAIP_ACCOUNT_ID_REGEX=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32})):(?[-.%a-zA-Z0-9]{1,128})$/u,e.CAIP_ACCOUNT_ADDRESS_REGEX=/^[-.%a-zA-Z0-9]{1,128}$/u,e.CAIP_ASSET_TYPE_REGEX=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32}))\/(?[-a-z0-9]{3,8}):(?[-.%a-zA-Z0-9]{1,128})$/u,e.CAIP_ASSET_ID_REGEX=/^(?(?[-a-z0-9]{3,8}):(?[-_a-zA-Z0-9]{1,32}))\/(?[-a-z0-9]{3,8}):(?[-.%a-zA-Z0-9]{1,128})\/(?[-.%a-zA-Z0-9]{1,78})$/u,e.CaipChainIdStruct=(0,t.pattern)((0,t.string)(),e.CAIP_CHAIN_ID_REGEX),e.CaipNamespaceStruct=(0,t.pattern)((0,t.string)(),e.CAIP_NAMESPACE_REGEX),e.CaipReferenceStruct=(0,t.pattern)((0,t.string)(),e.CAIP_REFERENCE_REGEX),e.CaipAccountIdStruct=(0,t.pattern)((0,t.string)(),e.CAIP_ACCOUNT_ID_REGEX),e.CaipAccountAddressStruct=(0,t.pattern)((0,t.string)(),e.CAIP_ACCOUNT_ADDRESS_REGEX),e.CaipAssetTypeStruct=(0,t.pattern)((0,t.string)(),e.CAIP_ASSET_TYPE_REGEX),e.CaipAssetIdStruct=(0,t.pattern)((0,t.string)(),e.CAIP_ASSET_ID_REGEX),(r=e.KnownCaipNamespace||(e.KnownCaipNamespace={})).Bip122="bip122",r.Eip155="eip155",r.Wallet="wallet",e.isCaipChainId=function(r){return(0,t.is)(r,e.CaipChainIdStruct)},e.isCaipNamespace=n,e.isCaipReference=i,e.isCaipAccountId=function(r){return(0,t.is)(r,e.CaipAccountIdStruct)},e.isCaipAccountAddress=function(r){return(0,t.is)(r,e.CaipAccountAddressStruct)},e.isCaipAssetType=function(r){return(0,t.is)(r,e.CaipAssetTypeStruct)},e.isCaipAssetId=function(r){return(0,t.is)(r,e.CaipAssetIdStruct)},e.parseCaipChainId=function(t){const r=e.CAIP_CHAIN_ID_REGEX.exec(t);if(!r?.groups)throw new Error("Invalid CAIP chain ID.");return{namespace:r.groups.namespace,reference:r.groups.reference}},e.parseCaipAccountId=function(t){const r=e.CAIP_ACCOUNT_ID_REGEX.exec(t);if(!r?.groups)throw new Error("Invalid CAIP account ID.");return{address:r.groups.accountAddress,chainId:r.groups.chainId,chain:{namespace:r.groups.namespace,reference:r.groups.reference}}},e.toCaipChainId=function(t,r){if(!n(t))throw new Error(`Invalid "namespace", must match: ${e.CAIP_NAMESPACE_REGEX.toString()}`);if(!i(r))throw new Error(`Invalid "reference", must match: ${e.CAIP_REFERENCE_REGEX.toString()}`);return`${t}:${r}`}}(mE);var wE={};Object.defineProperty(wE,"__esModule",{value:!0}),wE.ChecksumStruct=void 0;const bE=nv,vE=n_;wE.ChecksumStruct=(0,bE.size)((0,vE.base64)((0,bE.string)(),{paddingRequired:!0}),44,44);var _E={};Object.defineProperty(_E,"__esModule",{value:!0}),_E.createHex=_E.createBytes=_E.createBigInt=_E.createNumber=void 0;const EE=nv,SE=rv,AE=yE(),xE=gE(),kE=(0,EE.union)([(0,EE.number)(),(0,EE.bigint)(),(0,EE.string)(),xE.StrictHexStruct]),BE=(0,EE.coerce)((0,EE.number)(),kE,Number),IE=(0,EE.coerce)((0,EE.bigint)(),kE,BigInt);(0,EE.union)([xE.StrictHexStruct,(0,EE.instance)(Uint8Array)]);const TE=(0,EE.coerce)((0,EE.instance)(Uint8Array),(0,EE.union)([xE.StrictHexStruct]),AE.hexToBytes),RE=(0,EE.coerce)(xE.StrictHexStruct,(0,EE.instance)(Uint8Array),AE.bytesToHex);_E.createNumber=function(e){try{const t=(0,EE.create)(e,BE);return(0,SE.assert)(Number.isFinite(t),`Expected a number-like value, got "${e}".`),t}catch(t){if(t instanceof EE.StructError)throw new Error(`Expected a number-like value, got "${e}".`);throw t}},_E.createBigInt=function(e){try{return(0,EE.create)(e,IE)}catch(e){if(e instanceof EE.StructError)throw new Error(`Expected a number-like value, got "${String(e.value)}".`);throw e}},_E.createBytes=function(e){if("string"==typeof e&&"0x"===e.toLowerCase())return new Uint8Array;try{return(0,EE.create)(e,TE)}catch(e){if(e instanceof EE.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}},_E.createHex=function(e){if(e instanceof Uint8Array&&0===e.length||"string"==typeof e&&"0x"===e.toLowerCase())return"0x";try{return(0,EE.create)(e,RE)}catch(e){if(e instanceof EE.StructError)throw new Error(`Expected a bytes-like value, got "${String(e.value)}".`);throw e}};var OE,LE,ME={},CE=Cr&&Cr.__classPrivateFieldGet||function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},PE=Cr&&Cr.__classPrivateFieldSet||function(e,t,r,n,i){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!i)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};Object.defineProperty(ME,"__esModule",{value:!0}),ME.FrozenSet=ME.FrozenMap=void 0;class NE{get size(){return CE(this,OE,"f").size}[(OE=new WeakMap,Symbol.iterator)](){return CE(this,OE,"f")[Symbol.iterator]()}constructor(e){OE.set(this,void 0),PE(this,OE,new Map(e),"f"),Object.freeze(this)}entries(){return CE(this,OE,"f").entries()}forEach(e,t){return CE(this,OE,"f").forEach(((r,n,i)=>e.call(t,r,n,this)))}get(e){return CE(this,OE,"f").get(e)}has(e){return CE(this,OE,"f").has(e)}keys(){return CE(this,OE,"f").keys()}values(){return CE(this,OE,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map((([e,t])=>`${String(e)} => ${String(t)}`)).join(", ")} `:""}}`}}ME.FrozenMap=NE;class UE{get size(){return CE(this,LE,"f").size}[(LE=new WeakMap,Symbol.iterator)](){return CE(this,LE,"f")[Symbol.iterator]()}constructor(e){LE.set(this,void 0),PE(this,LE,new Set(e),"f"),Object.freeze(this)}entries(){return CE(this,LE,"f").entries()}forEach(e,t){return CE(this,LE,"f").forEach(((r,n,i)=>e.call(t,r,n,this)))}has(e){return CE(this,LE,"f").has(e)}keys(){return CE(this,LE,"f").keys()}values(){return CE(this,LE,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map((e=>String(e))).join(", ")} `:""}}`}}ME.FrozenSet=UE,Object.freeze(NE),Object.freeze(NE.prototype),Object.freeze(UE),Object.freeze(UE.prototype);var jE={};Object.defineProperty(jE,"__esModule",{value:!0});var $E={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getJsonRpcIdValidator=e.assertIsJsonRpcError=e.isJsonRpcError=e.assertIsJsonRpcFailure=e.isJsonRpcFailure=e.assertIsJsonRpcSuccess=e.isJsonRpcSuccess=e.assertIsJsonRpcResponse=e.isJsonRpcResponse=e.assertIsPendingJsonRpcResponse=e.isPendingJsonRpcResponse=e.JsonRpcResponseStruct=e.JsonRpcFailureStruct=e.JsonRpcSuccessStruct=e.PendingJsonRpcResponseStruct=e.assertIsJsonRpcRequest=e.isJsonRpcRequest=e.assertIsJsonRpcNotification=e.isJsonRpcNotification=e.JsonRpcNotificationStruct=e.JsonRpcRequestStruct=e.JsonRpcParamsStruct=e.JsonRpcErrorStruct=e.JsonRpcIdStruct=e.JsonRpcVersionStruct=e.jsonrpc2=e.getJsonSize=e.getSafeJson=e.isValidJson=e.JsonStruct=e.UnsafeJsonStruct=e.exactOptional=e.object=void 0;const t=nv,r=rv,n=Zv;function i({path:e,branch:t}){const r=e[e.length-1];return(0,n.hasProperty)(t[t.length-2],r)}function o(e){return new t.Struct({...e,type:`optional ${e.type}`,validator:(t,r)=>!i(r)||e.validator(t,r),refiner:(t,r)=>!i(r)||e.refiner(t,r)})}e.object=e=>(0,t.object)(e),e.exactOptional=o;function s(r){return(0,t.create)(r,e.JsonStruct)}e.UnsafeJsonStruct=(0,t.union)([(0,t.literal)(null),(0,t.boolean)(),(0,t.define)("finite number",(e=>(0,t.is)(e,(0,t.number)())&&Number.isFinite(e))),(0,t.string)(),(0,t.array)((0,t.lazy)((()=>e.UnsafeJsonStruct))),(0,t.record)((0,t.string)(),(0,t.lazy)((()=>e.UnsafeJsonStruct)))]),e.JsonStruct=(0,t.coerce)(e.UnsafeJsonStruct,(0,t.any)(),(t=>((0,r.assertStruct)(t,e.UnsafeJsonStruct),JSON.parse(JSON.stringify(t,((e,t)=>{if("__proto__"!==e&&"constructor"!==e)return t})))))),e.isValidJson=function(e){try{return s(e),!0}catch{return!1}},e.getSafeJson=s,e.getJsonSize=function(t){(0,r.assertStruct)(t,e.JsonStruct,"Invalid JSON value");const n=JSON.stringify(t);return(new TextEncoder).encode(n).byteLength},e.jsonrpc2="2.0",e.JsonRpcVersionStruct=(0,t.literal)(e.jsonrpc2),e.JsonRpcIdStruct=(0,t.nullable)((0,t.union)([(0,t.number)(),(0,t.string)()])),e.JsonRpcErrorStruct=(0,e.object)({code:(0,t.integer)(),message:(0,t.string)(),data:o(e.JsonStruct),stack:o((0,t.string)())}),e.JsonRpcParamsStruct=(0,t.union)([(0,t.record)((0,t.string)(),e.JsonStruct),(0,t.array)(e.JsonStruct)]),e.JsonRpcRequestStruct=(0,e.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:o(e.JsonRpcParamsStruct)}),e.JsonRpcNotificationStruct=(0,e.object)({jsonrpc:e.JsonRpcVersionStruct,method:(0,t.string)(),params:o(e.JsonRpcParamsStruct)}),e.isJsonRpcNotification=function(r){return(0,t.is)(r,e.JsonRpcNotificationStruct)},e.assertIsJsonRpcNotification=function(t,n){(0,r.assertStruct)(t,e.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",n)},e.isJsonRpcRequest=function(r){return(0,t.is)(r,e.JsonRpcRequestStruct)},e.assertIsJsonRpcRequest=function(t,n){(0,r.assertStruct)(t,e.JsonRpcRequestStruct,"Invalid JSON-RPC request",n)},e.PendingJsonRpcResponseStruct=(0,t.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:(0,t.optional)((0,t.unknown)()),error:(0,t.optional)(e.JsonRpcErrorStruct)}),e.JsonRpcSuccessStruct=(0,e.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,result:e.JsonStruct}),e.JsonRpcFailureStruct=(0,e.object)({id:e.JsonRpcIdStruct,jsonrpc:e.JsonRpcVersionStruct,error:e.JsonRpcErrorStruct}),e.JsonRpcResponseStruct=(0,t.union)([e.JsonRpcSuccessStruct,e.JsonRpcFailureStruct]),e.isPendingJsonRpcResponse=function(r){return(0,t.is)(r,e.PendingJsonRpcResponseStruct)},e.assertIsPendingJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",n)},e.isJsonRpcResponse=function(r){return(0,t.is)(r,e.JsonRpcResponseStruct)},e.assertIsJsonRpcResponse=function(t,n){(0,r.assertStruct)(t,e.JsonRpcResponseStruct,"Invalid JSON-RPC response",n)},e.isJsonRpcSuccess=function(r){return(0,t.is)(r,e.JsonRpcSuccessStruct)},e.assertIsJsonRpcSuccess=function(t,n){(0,r.assertStruct)(t,e.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",n)},e.isJsonRpcFailure=function(r){return(0,t.is)(r,e.JsonRpcFailureStruct)},e.assertIsJsonRpcFailure=function(t,n){(0,r.assertStruct)(t,e.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",n)},e.isJsonRpcError=function(r){return(0,t.is)(r,e.JsonRpcErrorStruct)},e.assertIsJsonRpcError=function(t,n){(0,r.assertStruct)(t,e.JsonRpcErrorStruct,"Invalid JSON-RPC error",n)},e.getJsonRpcIdValidator=function(e){const{permitEmptyString:t,permitFractions:r,permitNull:n}={permitEmptyString:!0,permitFractions:!1,permitNull:!0,...e};return e=>Boolean("number"==typeof e&&(r||Number.isInteger(e))||"string"==typeof e&&(t||e.length>0)||n&&null===e)}}($E);var HE={};Object.defineProperty(HE,"__esModule",{value:!0});var zE,DE,FE={},qE={exports:{}};function KE(){if(DE)return zE;DE=1;var e=1e3,t=60*e,r=60*t,n=24*r,i=7*n,o=365.25*n;function s(e,t,r,n){var i=t>=1.5*r;return Math.round(e/r)+" "+n+(i?"s":"")}return zE=function(a,c){c=c||{};var u=typeof a;if("string"===u&&a.length>0)return function(s){if((s=String(s)).length>100)return;var a=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(s);if(!a)return;var c=parseFloat(a[1]);switch((a[2]||"ms").toLowerCase()){case"years":case"year":case"yrs":case"yr":case"y":return c*o;case"weeks":case"week":case"w":return c*i;case"days":case"day":case"d":return c*n;case"hours":case"hour":case"hrs":case"hr":case"h":return c*r;case"minutes":case"minute":case"mins":case"min":case"m":return c*t;case"seconds":case"second":case"secs":case"sec":case"s":return c*e;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return c;default:return}}(a);if("number"===u&&isFinite(a))return c.long?function(i){var o=Math.abs(i);if(o>=n)return s(i,o,n,"day");if(o>=r)return s(i,o,r,"hour");if(o>=t)return s(i,o,t,"minute");if(o>=e)return s(i,o,e,"second");return i+" ms"}(a):function(i){var o=Math.abs(i);if(o>=n)return Math.round(i/n)+"d";if(o>=r)return Math.round(i/r)+"h";if(o>=t)return Math.round(i/t)+"m";if(o>=e)return Math.round(i/e)+"s";return i+"ms"}(a);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a))},zE}var WE=function(e){function t(e){let n,i,o,s=null;function a(...e){if(!a.enabled)return;const r=a,i=Number(new Date),o=i-(n||i);r.diff=o,r.prev=n,r.curr=i,n=i,e[0]=t.coerce(e[0]),"string"!=typeof e[0]&&e.unshift("%O");let s=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,((n,i)=>{if("%%"===n)return"%";s++;const o=t.formatters[i];if("function"==typeof o){const t=e[s];n=o.call(r,t),e.splice(s,1),s--}return n})),t.formatArgs.call(r,e);(r.log||t.log).apply(r,e)}return a.namespace=e,a.useColors=t.useColors(),a.color=t.selectColor(e),a.extend=r,a.destroy=t.destroy,Object.defineProperty(a,"enabled",{enumerable:!0,configurable:!1,get:()=>null!==s?s:(i!==t.namespaces&&(i=t.namespaces,o=t.enabled(e)),o),set:e=>{s=e}}),"function"==typeof t.init&&t.init(a),a}function r(e,r){const n=t(this.namespace+(void 0===r?":":r)+e);return n.log=this.log,n}function n(e){return e.toString().substring(2,e.toString().length-2).replace(/\.\*\?$/,"*")}return t.debug=t,t.default=t,t.coerce=function(e){if(e instanceof Error)return e.stack||e.message;return e},t.disable=function(){const e=[...t.names.map(n),...t.skips.map(n).map((e=>"-"+e))].join(",");return t.enable(""),e},t.enable=function(e){let r;t.save(e),t.namespaces=e,t.names=[],t.skips=[];const n=("string"==typeof e?e:"").split(/[\s,]+/),i=n.length;for(r=0;r{t[r]=e[r]})),t.names=[],t.skips=[],t.formatters={},t.selectColor=function(e){let r=0;for(let t=0;t{"%%"!==e&&(n++,"%c"===e&&(i=n))})),t.splice(i,0,r)},t.save=function(e){try{e?t.storage.setItem("debug",e):t.storage.removeItem("debug")}catch(e){}},t.load=function(){let e;try{e=t.storage.getItem("debug")}catch(e){}!e&&"undefined"!=typeof process&&"env"in process&&(e=process.env.DEBUG);return e},t.useColors=function(){if("undefined"!=typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs))return!0;if("undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return"undefined"!=typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!=typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!=typeof navigator&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||"undefined"!=typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)},t.storage=function(){try{return localStorage}catch(e){}}(),t.destroy=(()=>{let e=!1;return()=>{e||(e=!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"],t.log=console.debug||console.log||(()=>{}),e.exports=WE(t);const{formatters:r}=e.exports;r.j=function(e){try{return JSON.stringify(e)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}(qE,qE.exports);var VE=Cr&&Cr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(FE,"__esModule",{value:!0}),FE.createModuleLogger=FE.createProjectLogger=void 0;const ZE=(0,VE(qE.exports).default)("metamask");FE.createProjectLogger=function(e){return ZE.extend(e)},FE.createModuleLogger=function(e,t){return e.extend(t)};var GE={};Object.defineProperty(GE,"__esModule",{value:!0}),GE.hexToBigInt=GE.hexToNumber=GE.bigIntToHex=GE.numberToHex=void 0;const JE=rv,YE=gE();GE.numberToHex=e=>((0,JE.assert)("number"==typeof e,"Value must be a number."),(0,JE.assert)(e>=0,"Value must be a non-negative number."),(0,JE.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,YE.add0x)(e.toString(16)));GE.bigIntToHex=e=>((0,JE.assert)("bigint"==typeof e,"Value must be a bigint."),(0,JE.assert)(e>=0,"Value must be a non-negative bigint."),(0,YE.add0x)(e.toString(16)));GE.hexToNumber=e=>{(0,YE.assertIsHexString)(e);const t=parseInt(e,16);return(0,JE.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `hexToBigInt` instead."),t};GE.hexToBigInt=e=>((0,YE.assertIsHexString)(e),BigInt((0,YE.add0x)(e)));var XE={};Object.defineProperty(XE,"__esModule",{value:!0});var QE={};Object.defineProperty(QE,"__esModule",{value:!0}),QE.createDeferredPromise=void 0,QE.createDeferredPromise=function({suppressUnhandledRejection:e=!1}={}){let t,r;const n=new Promise(((e,n)=>{t=e,r=n}));return e&&n.catch((e=>{})),{promise:n,resolve:t,reject:r}};var eS={};!function(e){var t;Object.defineProperty(e,"__esModule",{value:!0}),e.timeSince=e.inMilliseconds=e.Duration=void 0,(t=e.Duration||(e.Duration={}))[t.Millisecond=1]="Millisecond",t[t.Second=1e3]="Second",t[t.Minute=6e4]="Minute",t[t.Hour=36e5]="Hour",t[t.Day=864e5]="Day",t[t.Week=6048e5]="Week",t[t.Year=31536e6]="Year";const r=(e,t)=>{if(!(e=>Number.isInteger(e)&&e>=0)(e))throw new Error(`"${t}" must be a non-negative integer. Received: "${e}".`)};e.inMilliseconds=function(e,t){return r(e,"count"),e*t},e.timeSince=function(e){return r(e,"timestamp"),Date.now()-e}}(eS);var tS={};Object.defineProperty(tS,"__esModule",{value:!0});var rS={},nS={exports:{}};var iS={MAX_LENGTH:256,MAX_SAFE_COMPONENT_LENGTH:16,MAX_SAFE_BUILD_LENGTH:250,MAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER||9007199254740991,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:"2.0.0",FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2};var oS="object"==typeof process&&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}=iS,o=oS,s=(t=e.exports={}).re=[],a=t.safeRe=[],c=t.src=[],u=t.t={};let h=0;const l="[a-zA-Z0-9-]",f=[["\\s",1],["\\d",i],[l,n]],d=(e,t,r)=>{const n=(e=>{for(const[t,r]of f)e=e.split(`${t}*`).join(`${t}{0,${r}}`).split(`${t}+`).join(`${t}{1,${r}}`);return e})(t),i=h++;o(e,i,t),u[e]=i,c[i]=t,s[i]=new RegExp(t,r?"g":void 0),a[i]=new RegExp(n,r?"g":void 0)};d("NUMERICIDENTIFIER","0|[1-9]\\d*"),d("NUMERICIDENTIFIERLOOSE","\\d+"),d("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${l}*`),d("MAINVERSION",`(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})\\.(${c[u.NUMERICIDENTIFIER]})`),d("MAINVERSIONLOOSE",`(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})\\.(${c[u.NUMERICIDENTIFIERLOOSE]})`),d("PRERELEASEIDENTIFIER",`(?:${c[u.NUMERICIDENTIFIER]}|${c[u.NONNUMERICIDENTIFIER]})`),d("PRERELEASEIDENTIFIERLOOSE",`(?:${c[u.NUMERICIDENTIFIERLOOSE]}|${c[u.NONNUMERICIDENTIFIER]})`),d("PRERELEASE",`(?:-(${c[u.PRERELEASEIDENTIFIER]}(?:\\.${c[u.PRERELEASEIDENTIFIER]})*))`),d("PRERELEASELOOSE",`(?:-?(${c[u.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${c[u.PRERELEASEIDENTIFIERLOOSE]})*))`),d("BUILDIDENTIFIER",`${l}+`),d("BUILD",`(?:\\+(${c[u.BUILDIDENTIFIER]}(?:\\.${c[u.BUILDIDENTIFIER]})*))`),d("FULLPLAIN",`v?${c[u.MAINVERSION]}${c[u.PRERELEASE]}?${c[u.BUILD]}?`),d("FULL",`^${c[u.FULLPLAIN]}$`),d("LOOSEPLAIN",`[v=\\s]*${c[u.MAINVERSIONLOOSE]}${c[u.PRERELEASELOOSE]}?${c[u.BUILD]}?`),d("LOOSE",`^${c[u.LOOSEPLAIN]}$`),d("GTLT","((?:<|>)?=?)"),d("XRANGEIDENTIFIERLOOSE",`${c[u.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),d("XRANGEIDENTIFIER",`${c[u.NUMERICIDENTIFIER]}|x|X|\\*`),d("XRANGEPLAIN",`[v=\\s]*(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:\\.(${c[u.XRANGEIDENTIFIER]})(?:${c[u.PRERELEASE]})?${c[u.BUILD]}?)?)?`),d("XRANGEPLAINLOOSE",`[v=\\s]*(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:\\.(${c[u.XRANGEIDENTIFIERLOOSE]})(?:${c[u.PRERELEASELOOSE]})?${c[u.BUILD]}?)?)?`),d("XRANGE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAIN]}$`),d("XRANGELOOSE",`^${c[u.GTLT]}\\s*${c[u.XRANGEPLAINLOOSE]}$`),d("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),d("COERCE",`${c[u.COERCEPLAIN]}(?:$|[^\\d])`),d("COERCEFULL",c[u.COERCEPLAIN]+`(?:${c[u.PRERELEASE]})?`+`(?:${c[u.BUILD]})?(?:$|[^\\d])`),d("COERCERTL",c[u.COERCE],!0),d("COERCERTLFULL",c[u.COERCEFULL],!0),d("LONETILDE","(?:~>?)"),d("TILDETRIM",`(\\s*)${c[u.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",d("TILDE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAIN]}$`),d("TILDELOOSE",`^${c[u.LONETILDE]}${c[u.XRANGEPLAINLOOSE]}$`),d("LONECARET","(?:\\^)"),d("CARETTRIM",`(\\s*)${c[u.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",d("CARET",`^${c[u.LONECARET]}${c[u.XRANGEPLAIN]}$`),d("CARETLOOSE",`^${c[u.LONECARET]}${c[u.XRANGEPLAINLOOSE]}$`),d("COMPARATORLOOSE",`^${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]})$|^$`),d("COMPARATOR",`^${c[u.GTLT]}\\s*(${c[u.FULLPLAIN]})$|^$`),d("COMPARATORTRIM",`(\\s*)${c[u.GTLT]}\\s*(${c[u.LOOSEPLAIN]}|${c[u.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",d("HYPHENRANGE",`^\\s*(${c[u.XRANGEPLAIN]})\\s+-\\s+(${c[u.XRANGEPLAIN]})\\s*$`),d("HYPHENRANGELOOSE",`^\\s*(${c[u.XRANGEPLAINLOOSE]})\\s+-\\s+(${c[u.XRANGEPLAINLOOSE]})\\s*$`),d("STAR","(<|>)?=?\\s*\\*"),d("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),d("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(nS,nS.exports);const sS=Object.freeze({loose:!0}),aS=Object.freeze({});var cS=e=>e?"object"!=typeof e?sS:e:aS;const uS=/^[0-9]+$/,hS=(e,t)=>{const r=uS.test(e),n=uS.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:ehS(t,e)};const fS=oS,{MAX_LENGTH:dS,MAX_SAFE_INTEGER:pS}=iS,{safeRe:gS,t:yS}=nS.exports,mS=cS,{compareIdentifiers:wS}=lS;class bS{constructor(e,t){if(t=mS(t),e instanceof bS){if(e.loose===!!t.loose&&e.includePrerelease===!!t.includePrerelease)return e;e=e.version}else if("string"!=typeof e)throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>dS)throw new TypeError(`version is longer than ${dS} characters`);fS("SemVer",e,t),this.options=t,this.loose=!!t.loose,this.includePrerelease=!!t.includePrerelease;const r=e.trim().match(t.loose?gS[yS.LOOSE]:gS[yS.FULL]);if(!r)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+r[1],this.minor=+r[2],this.patch=+r[3],this.major>pS||this.major<0)throw new TypeError("Invalid major version");if(this.minor>pS||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>pS||this.patch<0)throw new TypeError("Invalid patch version");r[4]?this.prerelease=r[4].split(".").map((e=>{if(/^[0-9]+$/.test(e)){const t=+e;if(t>=0&&t=0;)"number"==typeof this.prerelease[n]&&(this.prerelease[n]++,n=-2);if(-1===n){if(t===this.prerelease.join(".")&&!1===r)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(e)}}if(t){let n=[t,e];!1===r&&(n=[t]),0===wS(this.prerelease[0],t)?isNaN(this.prerelease[1])&&(this.prerelease=n):this.prerelease=n}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}var vS=bS;const _S=vS;var ES=(e,t,r=!1)=>{if(e instanceof _S)return e;try{return new _S(e,t)}catch(e){if(!r)return null;throw e}};const SS=ES;var AS=(e,t)=>{const r=SS(e,t);return r?r.version:null};const xS=ES;var kS=(e,t)=>{const r=xS(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};const BS=vS;var IS=(e,t,r,n,i)=>{"string"==typeof r&&(i=n,n=r,r=void 0);try{return new BS(e instanceof BS?e.version:e,r).inc(t,n,i).version}catch(e){return null}};const TS=ES;var RS=(e,t)=>{const r=TS(e,null,!0),n=TS(t,null,!0),i=r.compare(n);if(0===i)return null;const o=i>0,s=o?r:n,a=o?n:r,c=!!s.prerelease.length;if(!!a.prerelease.length&&!c)return a.patch||a.minor?s.patch?"patch":s.minor?"minor":"major":"major";const u=c?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};const OS=vS;var LS=(e,t)=>new OS(e,t).major;const MS=vS;var CS=(e,t)=>new MS(e,t).minor;const PS=vS;var NS=(e,t)=>new PS(e,t).patch;const US=ES;var jS=(e,t)=>{const r=US(e,t);return r&&r.prerelease.length?r.prerelease:null};const $S=vS;var HS=(e,t,r)=>new $S(e,r).compare(new $S(t,r));const zS=HS;var DS=(e,t,r)=>zS(t,e,r);const FS=HS;var qS=(e,t)=>FS(e,t,!0);const KS=vS;var WS=(e,t,r)=>{const n=new KS(e,r),i=new KS(t,r);return n.compare(i)||n.compareBuild(i)};const VS=WS;var ZS=(e,t)=>e.sort(((e,r)=>VS(e,r,t)));const GS=WS;var JS=(e,t)=>e.sort(((e,r)=>GS(r,e,t)));const YS=HS;var XS=(e,t,r)=>YS(e,t,r)>0;const QS=HS;var eA=(e,t,r)=>QS(e,t,r)<0;const tA=HS;var rA=(e,t,r)=>0===tA(e,t,r);const nA=HS;var iA=(e,t,r)=>0!==nA(e,t,r);const oA=HS;var sA=(e,t,r)=>oA(e,t,r)>=0;const aA=HS;var cA=(e,t,r)=>aA(e,t,r)<=0;const uA=rA,hA=iA,lA=XS,fA=sA,dA=eA,pA=cA;var gA=(e,t,r,n)=>{switch(t){case"===":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e===r;case"!==":return"object"==typeof e&&(e=e.version),"object"==typeof r&&(r=r.version),e!==r;case"":case"=":case"==":return uA(e,r,n);case"!=":return hA(e,r,n);case">":return lA(e,r,n);case">=":return fA(e,r,n);case"<":return dA(e,r,n);case"<=":return pA(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};const yA=vS,mA=ES,{safeRe:wA,t:bA}=nS.exports;var vA=(e,t)=>{if(e instanceof yA)return e;if("number"==typeof e&&(e=String(e)),"string"!=typeof e)return null;let r=null;if((t=t||{}).rtl){const n=t.includePrerelease?wA[bA.COERCERTLFULL]:wA[bA.COERCERTL];let i;for(;(i=n.exec(e))&&(!r||r.index+r[0].length!==e.length);)r&&i.index+i[0].length===r.index+r[0].length||(r=i),n.lastIndex=i.index+i[1].length+i[2].length;n.lastIndex=-1}else r=e.match(t.includePrerelease?wA[bA.COERCEFULL]:wA[bA.COERCE]);if(null===r)return null;const n=r[2],i=r[3]||"0",o=r[4]||"0",s=t.includePrerelease&&r[5]?`-${r[5]}`:"",a=t.includePrerelease&&r[6]?`+${r[6]}`:"";return mA(`${n}.${i}.${o}${s}${a}`,t)};var _A,EA,SA,AA,xA=class{constructor(){this.max=1e3,this.map=new Map}get(e){const t=this.map.get(e);return void 0===t?void 0:(this.map.delete(e),this.map.set(e,t),t)}delete(e){return this.map.delete(e)}set(e,t){if(!this.delete(e)&&void 0!==t){if(this.map.size>=this.max){const e=this.map.keys().next().value;this.delete(e)}this.map.set(e,t)}return this}};function kA(){if(EA)return _A;EA=1;const e=/\s+/g;class t{constructor(r,o){if(o=n(o),r instanceof t)return r.loose===!!o.loose&&r.includePrerelease===!!o.includePrerelease?r:new t(r.raw,o);if(r instanceof i)return this.raw=r.value,this.set=[[r]],this.formatted=void 0,this;if(this.options=o,this.loose=!!o.loose,this.includePrerelease=!!o.includePrerelease,this.raw=r.trim().replace(e," "),this.set=this.raw.split("||").map((e=>this.parseRange(e.trim()))).filter((e=>e.length)),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const e=this.set[0];if(this.set=this.set.filter((e=>!p(e[0]))),0===this.set.length)this.set=[e];else if(this.set.length>1)for(const e of this.set)if(1===e.length&&g(e[0])){this.set=[e];break}}this.formatted=void 0}get range(){if(void 0===this.formatted){this.formatted="";for(let e=0;e0&&(this.formatted+="||");const t=this.set[e];for(let e=0;e0&&(this.formatted+=" "),this.formatted+=t[e].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(e){const t=((this.options.includePrerelease&&f)|(this.options.loose&&d))+":"+e,n=r.get(t);if(n)return n;const s=this.options.loose,g=s?a[c.HYPHENRANGELOOSE]:a[c.HYPHENRANGE];e=e.replace(g,B(this.options.includePrerelease)),o("hyphen replace",e),e=e.replace(a[c.COMPARATORTRIM],u),o("comparator trim",e),e=e.replace(a[c.TILDETRIM],h),o("tilde trim",e),e=e.replace(a[c.CARETTRIM],l),o("caret trim",e);let y=e.split(" ").map((e=>m(e,this.options))).join(" ").split(/\s+/).map((e=>k(e,this.options)));s&&(y=y.filter((e=>(o("loose invalid filter",e,this.options),!!e.match(a[c.COMPARATORLOOSE]))))),o("range list",y);const w=new Map,b=y.map((e=>new i(e,this.options)));for(const e of b){if(p(e))return[e];w.set(e.value,e)}w.size>1&&w.has("")&&w.delete("");const v=[...w.values()];return r.set(t,v),v}intersects(e,r){if(!(e instanceof t))throw new TypeError("a Range is required");return this.set.some((t=>y(t,r)&&e.set.some((e=>y(e,r)&&t.every((t=>e.every((e=>t.intersects(e,r)))))))))}test(e){if(!e)return!1;if("string"==typeof e)try{e=new s(e,this.options)}catch(e){return!1}for(let t=0;t"<0.0.0-0"===e.value,g=e=>""===e.value,y=(e,t)=>{let r=!0;const n=e.slice();let i=n.pop();for(;r&&n.length;)r=n.every((e=>i.intersects(e,t))),i=n.pop();return r},m=(e,t)=>(o("comp",e,t),e=_(e,t),o("caret",e),e=b(e,t),o("tildes",e),e=S(e,t),o("xrange",e),e=x(e,t),o("stars",e),e),w=e=>!e||"x"===e.toLowerCase()||"*"===e,b=(e,t)=>e.trim().split(/\s+/).map((e=>v(e,t))).join(" "),v=(e,t)=>{const r=t.loose?a[c.TILDELOOSE]:a[c.TILDE];return e.replace(r,((t,r,n,i,s)=>{let a;return o("tilde",e,t,r,n,i,s),w(r)?a="":w(n)?a=`>=${r}.0.0 <${+r+1}.0.0-0`:w(i)?a=`>=${r}.${n}.0 <${r}.${+n+1}.0-0`:s?(o("replaceTilde pr",s),a=`>=${r}.${n}.${i}-${s} <${r}.${+n+1}.0-0`):a=`>=${r}.${n}.${i} <${r}.${+n+1}.0-0`,o("tilde return",a),a}))},_=(e,t)=>e.trim().split(/\s+/).map((e=>E(e,t))).join(" "),E=(e,t)=>{o("caret",e,t);const r=t.loose?a[c.CARETLOOSE]:a[c.CARET],n=t.includePrerelease?"-0":"";return e.replace(r,((t,r,i,s,a)=>{let c;return o("caret",e,t,r,i,s,a),w(r)?c="":w(i)?c=`>=${r}.0.0${n} <${+r+1}.0.0-0`:w(s)?c="0"===r?`>=${r}.${i}.0${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.0${n} <${+r+1}.0.0-0`:a?(o("replaceCaret pr",a),c="0"===r?"0"===i?`>=${r}.${i}.${s}-${a} <${r}.${i}.${+s+1}-0`:`>=${r}.${i}.${s}-${a} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${s}-${a} <${+r+1}.0.0-0`):(o("no pr"),c="0"===r?"0"===i?`>=${r}.${i}.${s}${n} <${r}.${i}.${+s+1}-0`:`>=${r}.${i}.${s}${n} <${r}.${+i+1}.0-0`:`>=${r}.${i}.${s} <${+r+1}.0.0-0`),o("caret return",c),c}))},S=(e,t)=>(o("replaceXRanges",e,t),e.split(/\s+/).map((e=>A(e,t))).join(" ")),A=(e,t)=>{e=e.trim();const r=t.loose?a[c.XRANGELOOSE]:a[c.XRANGE];return e.replace(r,((r,n,i,s,a,c)=>{o("xRange",e,r,n,i,s,a,c);const u=w(i),h=u||w(s),l=h||w(a),f=l;return"="===n&&f&&(n=""),c=t.includePrerelease?"-0":"",u?r=">"===n||"<"===n?"<0.0.0-0":"*":n&&f?(h&&(s=0),a=0,">"===n?(n=">=",h?(i=+i+1,s=0,a=0):(s=+s+1,a=0)):"<="===n&&(n="<",h?i=+i+1:s=+s+1),"<"===n&&(c="-0"),r=`${n+i}.${s}.${a}${c}`):h?r=`>=${i}.0.0${c} <${+i+1}.0.0-0`:l&&(r=`>=${i}.${s}.0${c} <${i}.${+s+1}.0-0`),o("xRange return",r),r}))},x=(e,t)=>(o("replaceStars",e,t),e.trim().replace(a[c.STAR],"")),k=(e,t)=>(o("replaceGTE0",e,t),e.trim().replace(a[t.includePrerelease?c.GTE0PRE:c.GTE0],"")),B=e=>(t,r,n,i,o,s,a,c,u,h,l,f)=>`${r=w(n)?"":w(i)?`>=${n}.0.0${e?"-0":""}`:w(o)?`>=${n}.${i}.0${e?"-0":""}`:s?`>=${r}`:`>=${r}${e?"-0":""}`} ${c=w(u)?"":w(h)?`<${+u+1}.0.0-0`:w(l)?`<${u}.${+h+1}.0-0`:f?`<=${u}.${h}.${l}-${f}`:e?`<${u}.${h}.${+l+1}-0`:`<=${c}`}`.trim(),I=(e,t,r)=>{for(let r=0;r0){const n=e[r].semver;if(n.major===t.major&&n.minor===t.minor&&n.patch===t.patch)return!0}return!1}return!0};return _A}function BA(){if(AA)return SA;AA=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(n,i){if(i=r(i),n instanceof t){if(n.loose===!!i.loose)return n;n=n.value}n=n.trim().split(/\s+/).join(" "),s("comparator",n,i),this.options=i,this.loose=!!i.loose,this.parse(n),this.semver===e?this.value="":this.value=this.operator+this.semver.version,s("comp",this)}parse(t){const r=this.options.loose?n[i.COMPARATORLOOSE]:n[i.COMPARATOR],o=t.match(r);if(!o)throw new TypeError(`Invalid comparator: ${t}`);this.operator=void 0!==o[1]?o[1]:"","="===this.operator&&(this.operator=""),o[2]?this.semver=new a(o[2],this.options.loose):this.semver=e}toString(){return this.value}test(t){if(s("Comparator.test",t,this.options.loose),this.semver===e||t===e)return!0;if("string"==typeof t)try{t=new a(t,this.options)}catch(e){return!1}return o(t,this.operator,this.semver,this.options)}intersects(e,n){if(!(e instanceof t))throw new TypeError("a Comparator is required");return""===this.operator?""===this.value||new c(e.value,n).test(this.value):""===e.operator?""===e.value||new c(this.value,n).test(e.semver):(!(n=r(n)).includePrerelease||"<0.0.0-0"!==this.value&&"<0.0.0-0"!==e.value)&&(!(!n.includePrerelease&&(this.value.startsWith("<0.0.0")||e.value.startsWith("<0.0.0")))&&(!(!this.operator.startsWith(">")||!e.operator.startsWith(">"))||(!(!this.operator.startsWith("<")||!e.operator.startsWith("<"))||(!(this.semver.version!==e.semver.version||!this.operator.includes("=")||!e.operator.includes("="))||(!!(o(this.semver,"<",e.semver,n)&&this.operator.startsWith(">")&&e.operator.startsWith("<"))||!!(o(this.semver,">",e.semver,n)&&this.operator.startsWith("<")&&e.operator.startsWith(">")))))))}}SA=t;const r=cS,{safeRe:n,t:i}=nS.exports,o=gA,s=oS,a=vS,c=kA();return SA}const IA=kA();var TA=(e,t,r)=>{try{t=new IA(t,r)}catch(e){return!1}return t.test(e)};const RA=kA();var OA=(e,t)=>new RA(e,t).set.map((e=>e.map((e=>e.value)).join(" ").trim().split(" ")));const LA=vS,MA=kA();var CA=(e,t,r)=>{let n=null,i=null,o=null;try{o=new MA(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&-1!==i.compare(e)||(n=e,i=new LA(n,r)))})),n};const PA=vS,NA=kA();var UA=(e,t,r)=>{let n=null,i=null,o=null;try{o=new NA(t,r)}catch(e){return null}return e.forEach((e=>{o.test(e)&&(n&&1!==i.compare(e)||(n=e,i=new PA(n,r)))})),n};const jA=vS,$A=kA(),HA=XS;var zA=(e,t)=>{e=new $A(e,t);let r=new jA("0.0.0");if(e.test(r))return r;if(r=new jA("0.0.0-0"),e.test(r))return r;r=null;for(let t=0;t{const t=new jA(e.semver.version);switch(e.operator){case">":0===t.prerelease.length?t.patch++:t.prerelease.push(0),t.raw=t.format();case"":case">=":i&&!HA(t,i)||(i=t);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${e.operator}`)}})),!i||r&&!HA(r,i)||(r=i)}return r&&e.test(r)?r:null};const DA=kA();var FA=(e,t)=>{try{return new DA(e,t).range||"*"}catch(e){return null}};const qA=vS,KA=BA(),{ANY:WA}=KA,VA=kA(),ZA=TA,GA=XS,JA=eA,YA=cA,XA=sA;var QA=(e,t,r,n)=>{let i,o,s,a,c;switch(e=new qA(e,n),t=new VA(t,n),r){case">":i=GA,o=YA,s=JA,a=">",c=">=";break;case"<":i=JA,o=XA,s=GA,a="<",c="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(ZA(e,t,n))return!1;for(let r=0;r{e.semver===WA&&(e=new KA(">=0.0.0")),h=h||e,l=l||e,i(e.semver,h.semver,n)?h=e:s(e.semver,l.semver,n)&&(l=e)})),h.operator===a||h.operator===c)return!1;if((!l.operator||l.operator===a)&&o(e,l.semver))return!1;if(l.operator===c&&s(e,l.semver))return!1}return!0};const ex=QA;var tx=(e,t,r)=>ex(e,t,">",r);const rx=QA;var nx=(e,t,r)=>rx(e,t,"<",r);const ix=kA();var ox=(e,t,r)=>(e=new ix(e,r),t=new ix(t,r),e.intersects(t,r));const sx=TA,ax=HS;const cx=kA(),ux=BA(),{ANY:hx}=ux,lx=TA,fx=HS,dx=[new ux(">=0.0.0-0")],px=[new ux(">=0.0.0")],gx=(e,t,r)=>{if(e===t)return!0;if(1===e.length&&e[0].semver===hx){if(1===t.length&&t[0].semver===hx)return!0;e=r.includePrerelease?dx:px}if(1===t.length&&t[0].semver===hx){if(r.includePrerelease)return!0;t=px}const n=new Set;let i,o,s,a,c,u,h;for(const t of e)">"===t.operator||">="===t.operator?i=yx(i,t,r):"<"===t.operator||"<="===t.operator?o=mx(o,t,r):n.add(t.semver);if(n.size>1)return null;if(i&&o){if(s=fx(i.semver,o.semver,r),s>0)return null;if(0===s&&(">="!==i.operator||"<="!==o.operator))return null}for(const e of n){if(i&&!lx(e,String(i),r))return null;if(o&&!lx(e,String(o),r))return null;for(const n of t)if(!lx(e,String(n),r))return!1;return!0}let l=!(!o||r.includePrerelease||!o.semver.prerelease.length)&&o.semver,f=!(!i||r.includePrerelease||!i.semver.prerelease.length)&&i.semver;l&&1===l.prerelease.length&&"<"===o.operator&&0===l.prerelease[0]&&(l=!1);for(const e of t){if(h=h||">"===e.operator||">="===e.operator,u=u||"<"===e.operator||"<="===e.operator,i)if(f&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===f.major&&e.semver.minor===f.minor&&e.semver.patch===f.patch&&(f=!1),">"===e.operator||">="===e.operator){if(a=yx(i,e,r),a===e&&a!==i)return!1}else if(">="===i.operator&&!lx(i.semver,String(e),r))return!1;if(o)if(l&&e.semver.prerelease&&e.semver.prerelease.length&&e.semver.major===l.major&&e.semver.minor===l.minor&&e.semver.patch===l.patch&&(l=!1),"<"===e.operator||"<="===e.operator){if(c=mx(o,e,r),c===e&&c!==o)return!1}else if("<="===o.operator&&!lx(o.semver,String(e),r))return!1;if(!e.operator&&(o||i)&&0!==s)return!1}return!(i&&u&&!o&&0!==s)&&(!(o&&h&&!i&&0!==s)&&(!f&&!l))},yx=(e,t,r)=>{if(!e)return t;const n=fx(e.semver,t.semver,r);return n>0?e:n<0||">"===t.operator&&">="===e.operator?t:e},mx=(e,t,r)=>{if(!e)return t;const n=fx(e.semver,t.semver,r);return n<0?e:n>0||"<"===t.operator&&"<="===e.operator?t:e};var wx=(e,t,r={})=>{if(e===t)return!0;e=new cx(e,r),t=new cx(t,r);let n=!1;e:for(const i of e.set){for(const e of t.set){const t=gx(i,e,r);if(n=n||null!==t,t)continue e}if(n)return!1}return!0};const bx=nS.exports,vx=iS,_x=vS,Ex=lS,Sx=(e,t,r)=>{const n=[];let i=null,o=null;const s=e.sort(((e,t)=>ax(e,t,r)));for(const e of s){sx(e,t,r)?(o=e,i||(i=e)):(o&&n.push([i,o]),o=null,i=null)}i&&n.push([i,null]);const a=[];for(const[e,t]of n)e===t?a.push(e):t||e!==s[0]?t?e===s[0]?a.push(`<=${t}`):a.push(`${e} - ${t}`):a.push(`>=${e}`):a.push("*");const c=a.join(" || "),u="string"==typeof t.raw?t.raw:String(t);return c.lengthnull!==(0,r.valid)(e)||`Expected SemVer version, got "${e}"`)),e.VersionRangeStruct=(0,t.refine)((0,t.string)(),"Version range",(e=>null!==(0,r.validRange)(e)||`Expected SemVer range, got "${e}"`)),e.isValidSemVerVersion=function(r){return(0,t.is)(r,e.VersionStruct)},e.isValidSemVerRange=function(r){return(0,t.is)(r,e.VersionRangeStruct)},e.assertIsSemVerVersion=function(t){(0,n.assertStruct)(t,e.VersionStruct)},e.assertIsSemVerRange=function(t){(0,n.assertStruct)(t,e.VersionRangeStruct)},e.gtVersion=function(e,t){return(0,r.gt)(e,t)},e.gtRange=function(e,t){return(0,r.gtr)(e,t)},e.satisfiesVersionRange=function(e,t){return(0,r.satisfies)(e,t,{includePrerelease:!0})}}(rS),function(e){var t=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Cr&&Cr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(rv,e),r(n_,e),r(yE(),e),r(mE,e),r(wE,e),r(_E,e),r(ME,e),r(jE,e),r(Cv,e),r(gE(),e),r($E,e),r(HE,e),r(FE,e),r(Zv,e),r(GE,e),r(XE,e),r(QE,e),r(eS,e),r(tS,e),r(rS,e)}(tv),Object.defineProperty(ev,"__esModule",{value:!0}),ev.normalize=ev.recoverPublicKey=ev.concatSig=ev.legacyToBuffer=ev.isNullish=ev.padWithZeroes=void 0;const xx=bh,kx=tv;function Bx(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")}function Ix(e){return null==e}ev.padWithZeroes=Bx,ev.isNullish=Ix,ev.legacyToBuffer=function(e){return"string"!=typeof e||(0,xx.isHexString)(e)?(0,xx.toBuffer)(e):C.from(e)},ev.concatSig=function(e,t,r){const n=(0,xx.fromSigned)(t),i=(0,xx.fromSigned)(r),o=(0,xx.bufferToInt)(e),s=Bx((0,xx.toUnsigned)(n).toString("hex"),64),a=Bx((0,xx.toUnsigned)(i).toString("hex"),64),c=(0,kx.remove0x)((0,kx.numberToHex)(o));return(0,kx.add0x)(s.concat(a,c))},ev.recoverPublicKey=function(e,t){const r=(0,xx.fromRpcSig)(t);return(0,xx.ecrecover)(e,r.v,r.r,r.s)},ev.normalize=function(e){if(!Ix(e)){if("number"==typeof e){if(e<0)return"0x";const t=(0,kx.numberToBytes)(e);e=(0,kx.bytesToHex)(t)}if("string"!=typeof e){let t="eth-sig-util.normalize() requires hex string or integer input.";throw t+=` received ${typeof e}: ${e}`,new Error(t)}return(0,kx.add0x)(e.toLowerCase())}},Object.defineProperty(wh,"__esModule",{value:!0}),wh.extractPublicKey=wh.recoverPersonalSignature=wh.personalSign=void 0;const Tx=bh,Rx=ev;function Ox(e,t){const r=(0,Tx.hashPersonalMessage)((0,Rx.legacyToBuffer)(e));return(0,Rx.recoverPublicKey)(r,t)}wh.personalSign=function({privateKey:e,data:t}){if((0,Rx.isNullish)(t))throw new Error("Missing data parameter");if((0,Rx.isNullish)(e))throw new Error("Missing privateKey parameter");const r=(0,Rx.legacyToBuffer)(t),n=(0,Tx.hashPersonalMessage)(r),i=(0,Tx.ecsign)(n,e);return(0,Rx.concatSig)((0,Tx.toBuffer)(i.v),i.r,i.s)},wh.recoverPersonalSignature=function({data:e,signature:t}){if((0,Rx.isNullish)(e))throw new Error("Missing data parameter");if((0,Rx.isNullish)(t))throw new Error("Missing signature parameter");const r=Ox(e,t),n=(0,Tx.publicToAddress)(r);return(0,Tx.bufferToHex)(n)},wh.extractPublicKey=function({data:e,signature:t}){if((0,Rx.isNullish)(e))throw new Error("Missing data parameter");if((0,Rx.isNullish)(t))throw new Error("Missing signature parameter");return`0x${Ox(e,t).toString("hex")}`};var Lx={},Mx={},Cx={},Px={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ParserError=e.getErrorStack=e.getErrorMessage=void 0;const t=tv;e.getErrorMessage=e=>"string"==typeof e?e:e instanceof Error||(0,t.isObject)(e)&&(0,t.hasProperty)(e,"message")&&"string"==typeof e.message?e.message:"Unknown error.";e.getErrorStack=e=>{if(e instanceof Error)return e.stack};class r extends Error{constructor(t,r){super(t),this.name="ParserError";const n=(0,e.getErrorStack)(r);n&&(this.stack=n)}}e.ParserError=r}(Px);var Nx={},Ux={};Object.defineProperty(Ux,"__esModule",{value:!0}),Ux.iterate=void 0;const jx=tv;Ux.iterate=function*(e,t=32){for(let r=0;r{(0,jx.assert)(e>=0,"Cannot skip a negative number of bytes."),(0,jx.assert)(e%t==0,"Length must be a multiple of the size."),r+=e},i=e.subarray(r);yield{skip:n,value:i}}return{skip:()=>{},value:new Uint8Array}};var $x={},Hx={},zx={},Dx={};Object.defineProperty(Dx,"__esModule",{value:!0}),Dx.padEnd=Dx.padStart=Dx.set=void 0;const Fx=tv;Dx.set=(e,t,r)=>(0,Fx.concatBytes)([e.subarray(0,r),t,e.subarray(r+t.length)]);Dx.padStart=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Fx.concatBytes)([r,e])};Dx.padEnd=(e,t=32)=>{const r=new Uint8Array(Math.max(t-e.length,0)).fill(0);return(0,Fx.concatBytes)([e,r])},function(e){var t=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Cr&&Cr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(Dx,e)}(zx),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.address=e.getAddress=void 0;const t=tv,r=Px,n=zx;e.getAddress=e=>{const i=(0,t.createBytes)(e);return(0,t.assert)(i.length<=20,new r.ParserError(`Invalid address value. Expected address to be 20 bytes long, but received ${i.length} bytes.`)),(0,n.padStart)(i,20)},e.address={isDynamic:!1,isType:e=>"address"===e,getByteLength:()=>32,encode({buffer:r,value:i,packed:o}){const s=(0,e.getAddress)(i);if(o)return(0,t.concatBytes)([r,s]);const a=(0,n.padStart)(s);return(0,t.concatBytes)([r,a])},decode:({value:e})=>(0,t.add0x)((0,t.bytesToHex)(e.slice(12,32)))}}(Hx);var qx={},Kx={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fixedBytes=e.getByteLength=void 0;const t=tv,r=Px,n=zx,i=/^bytes([0-9]{1,2})$/u;e.getByteLength=e=>{const n=e.match(i)?.[1];(0,t.assert)(n,`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`);const o=Number(n);return(0,t.assert)(o>0&&o<=32,new r.ParserError(`Invalid byte length. Expected a number between 1 and 32, but received "${e}".`)),o},e.fixedBytes={isDynamic:!1,isType:e=>i.test(e),getByteLength:()=>32,encode({type:i,buffer:o,value:s,packed:a}){const c=(0,e.getByteLength)(i),u=(0,t.createBytes)(s);return(0,t.assert)(u.length<=c,new r.ParserError(`Expected a value of length ${c}, but received a value of length ${u.length}.`)),(0,t.concatBytes)(a?[o,(0,n.padEnd)(u,c)]:[o,(0,n.padEnd)(u)])},decode({type:t,value:r}){const n=(0,e.getByteLength)(t);return r.slice(0,n)}}}(Kx);var Wx,Vx,Zx={};function Gx(){return Wx||(Wx=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.tuple=e.getTupleElements=void 0;const t=tv,r=Px,n=uk(),i=/^\((.+)\)$/u;e.getTupleElements=e=>{(0,t.assert)(e.startsWith("(")&&e.endsWith(")"),new r.ParserError(`Invalid tuple type. Expected tuple type, but received "${e}".`));const n=[];let i="",o=0;for(let t=1;t(0,e.getTupleElements)(t).some((e=>{const t=(0,n.getParser)(e);return(0,n.isDynamicParser)(t,e)})),isType:e=>(e=>i.test(e))(e),getByteLength(t){if((0,n.isDynamicParser)(this,t))return 32;return(0,e.getTupleElements)(t).reduce(((e,t)=>e+(0,n.getParser)(t).getByteLength(t)),0)},encode({type:t,buffer:r,value:i,packed:o,tight:s}){const a=(0,e.getTupleElements)(t);return(0,n.pack)({types:a,values:i,byteArray:r,packed:o,tight:s})},decode({type:t,value:r,skip:i}){const o=(0,e.getTupleElements)(t);return i(this.getByteLength(t)-32),(0,n.unpack)(o,r)}}}(Zx)),Zx}var Jx={},Yx={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.number=e.getBigInt=e.assertNumberLength=e.getLength=e.isSigned=void 0;const t=tv,r=Px,n=zx,i=/^u?int(?[0-9]*)?$/u;e.isSigned=e=>!e.startsWith("u");e.getLength=e=>{if("int"===e||"uint"===e)return 256;const n=e.match(i);(0,t.assert)(n?.groups?.length,new r.ParserError(`Invalid number type. Expected a number type, but received "${e}".`));const o=parseInt(n.groups.length,10);return(0,t.assert)(o>=8&&o<=256,new r.ParserError(`Invalid number length. Expected a number between 8 and 256, but received "${e}".`)),(0,t.assert)(o%8==0,new r.ParserError(`Invalid number length. Expected a multiple of 8, but received "${e}".`)),o};e.assertNumberLength=(n,i)=>{const o=(0,e.getLength)(i),s=BigInt(2)**BigInt(o-((0,e.isSigned)(i)?1:0))-BigInt(1);(0,e.isSigned)(i)?(0,t.assert)(n>=-(s+BigInt(1))&&n<=s,new r.ParserError(`Number "${n}" is out of range for type "${i}".`)):(0,t.assert)(n<=s,new r.ParserError(`Number "${n}" is out of range for type "${i}".`))};e.getBigInt=e=>{try{return(0,t.createBigInt)(e)}catch{throw new r.ParserError(`Invalid number. Expected a valid number value, but received "${e}".`)}},e.number={isDynamic:!1,isType:e=>i.test(e),getByteLength:()=>32,encode({type:r,buffer:i,value:o,packed:s}){const a=(0,e.getBigInt)(o);if((0,e.assertNumberLength)(a,r),(0,e.isSigned)(r)){if(s){const n=(0,e.getLength)(r)/8;return(0,t.concatBytes)([i,(0,t.signedBigIntToBytes)(a,n)])}return(0,t.concatBytes)([i,(0,n.padStart)((0,t.signedBigIntToBytes)(a,32))])}if(s){const o=(0,e.getLength)(r)/8;return(0,t.concatBytes)([i,(0,n.padStart)((0,t.bigIntToBytes)(a),o)])}return(0,t.concatBytes)([i,(0,n.padStart)((0,t.bigIntToBytes)(a))])},decode({type:r,value:n}){const i=n.subarray(0,32);if((0,e.isSigned)(r)){const n=(0,t.bytesToSignedBigInt)(i);return(0,e.assertNumberLength)(n,r),n}const o=(0,t.bytesToBigInt)(i);return(0,e.assertNumberLength)(o,r),o}}}(Yx),function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.bool=e.getBooleanValue=void 0;const t=nv,r=tv,n=Px,i=Yx,o=(0,t.coerce)((0,t.boolean)(),(0,t.union)([(0,t.literal)("true"),(0,t.literal)("false")]),(e=>"true"===e));e.getBooleanValue=e=>{try{return(0,t.create)(e,o)?BigInt(1):BigInt(0)}catch{throw new n.ParserError(`Invalid boolean value. Expected a boolean literal, or the string "true" or "false", but received "${e}".`)}},e.bool={isDynamic:!1,isType:e=>"bool"===e,getByteLength:()=>32,encode({buffer:t,value:n,packed:o,tight:s}){const a=(0,e.getBooleanValue)(n);return o?(0,r.concatBytes)([t,(0,r.bigIntToBytes)(a)]):i.number.encode({type:"uint256",buffer:t,value:a,packed:o,tight:s})},decode:e=>i.number.decode({...e,type:"uint256"})===BigInt(1)}}(Jx);var Xx={};Object.defineProperty(Xx,"__esModule",{value:!0}),Xx.bytes=void 0;const Qx=tv,ek=zx;Xx.bytes={isDynamic:!0,isType:e=>"bytes"===e,getByteLength:()=>32,encode({buffer:e,value:t,packed:r}){const n=(0,Qx.createBytes)(t);if(r)return(0,Qx.concatBytes)([e,n]);const i=32*Math.ceil(n.byteLength/32);return(0,Qx.concatBytes)([e,(0,ek.padStart)((0,Qx.numberToBytes)(n.byteLength)),(0,ek.padEnd)(n,i)])},decode({value:e}){const t=e.subarray(0,32),r=(0,Qx.bytesToNumber)(t);return e.slice(32,32+r)}};var tk={};!function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.fn=e.getFunction=void 0;const t=nv,r=tv,n=Px,i=Kx,o=(0,t.coerce)((0,t.object)({address:r.StrictHexStruct,selector:r.StrictHexStruct}),(0,t.union)([r.StrictHexStruct,(0,t.instance)(Uint8Array)]),(e=>{const t=(0,r.createBytes)(e);return(0,r.assert)(24===t.length,new n.ParserError(`Invalid Solidity function. Expected function to be 24 bytes long, but received ${t.length} bytes.`)),{address:(0,r.bytesToHex)(t.subarray(0,20)),selector:(0,r.bytesToHex)(t.subarray(20,24))}}));e.getFunction=e=>{const n=(0,t.create)(e,o);return(0,r.concatBytes)([(0,r.hexToBytes)(n.address),(0,r.hexToBytes)(n.selector)])},e.fn={isDynamic:!1,isType:e=>"function"===e,getByteLength:()=>32,encode({buffer:t,value:r,packed:n,tight:o}){const s=(0,e.getFunction)(r);return i.fixedBytes.encode({type:"bytes24",buffer:t,value:s,packed:n,tight:o})},decode:({value:e})=>({address:(0,r.bytesToHex)(e.slice(0,20)),selector:(0,r.bytesToHex)(e.slice(20,24))})}}(tk);var rk={};Object.defineProperty(rk,"__esModule",{value:!0});var nk={};Object.defineProperty(nk,"__esModule",{value:!0}),nk.string=void 0;const ik=tv,ok=Xx;var sk,ak;function ck(){return sk||(sk=1,function(e){var t=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Cr&&Cr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(Hx,e),r((Vx||(Vx=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.array=e.getTupleType=e.getArrayType=e.isArrayType=void 0;const t=tv,r=Px,n=uk(),i=zx,o=Kx,s=Gx(),a=/^(?.*)\[(?\d*?)\]$/u;e.isArrayType=e=>a.test(e),e.getArrayType=e=>{const n=e.match(a);return(0,t.assert)(n?.groups?.type,new r.ParserError(`Invalid array type. Expected an array type, but received "${e}".`)),[n.groups.type,n.groups.length?parseInt(n.groups.length,10):void 0]},e.getTupleType=(e,t)=>`(${new Array(t).fill(e).join(",")})`,e.array={isDynamic(t){const[r,i]=(0,e.getArrayType)(t);return void 0===i||(0,n.isDynamicParser)((0,n.getParser)(r),r)},isType:t=>(0,e.isArrayType)(t),getByteLength(i){(0,t.assert)((0,e.isArrayType)(i),new r.ParserError(`Expected an array type, but received "${i}".`));const[o,a]=(0,e.getArrayType)(i);return(0,n.isDynamicParser)(this,i)||void 0===a?32:s.tuple.getByteLength((0,e.getTupleType)(o,a))},encode({type:a,buffer:c,value:u,packed:h,tight:l}){const[f,d]=(0,e.getArrayType)(a);if((0,t.assert)(!h||!(0,e.isArrayType)(f),new r.ParserError("Cannot pack nested arrays.")),h&&(0,n.isDynamicParser)((0,n.getParser)(f),f))return(0,n.pack)({types:new Array(u.length).fill(f),values:u,byteArray:c,packed:h,arrayPacked:!0,tight:l});if(d)return(0,t.assert)(d===u.length,new r.ParserError(`Array length does not match type length. Expected a length of ${d}, but received ${u.length}.`)),s.tuple.encode({type:(0,e.getTupleType)(f,d),buffer:c,value:u,packed:o.fixedBytes.isType(f)&&l,tight:l});if(h)return(0,n.pack)({types:new Array(u.length).fill(f),values:u,byteArray:c,packed:o.fixedBytes.isType(f)&&l,arrayPacked:!0,tight:l});const p=(0,i.padStart)((0,t.numberToBytes)(u.length));return(0,n.pack)({types:new Array(u.length).fill(f),values:u,byteArray:(0,t.concatBytes)([c,p]),packed:h,tight:l})},decode({type:i,value:o,...a}){const[c,u]=(0,e.getArrayType)(i);if(u){const n=s.tuple.decode({type:(0,e.getTupleType)(c,u),value:o,...a});return(0,t.assert)(n.length===u,new r.ParserError(`Array length does not match type length. Expected a length of ${u}, but received ${n.length}.`)),n}const h=(0,t.bytesToNumber)(o.subarray(0,32));return(0,n.unpack)(new Array(h).fill(c),o.subarray(32))}}}(qx)),qx),e),r(Jx,e),r(Xx,e),r(Kx,e),r(tk,e),r(Yx,e),r(rk,e),r(nk,e),r(Gx(),e)}($x)),$x}function uk(){return ak||(ak=1,function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unpack=e.pack=e.isDynamicParser=e.getParser=void 0;const t=tv,r=Px,n=Ux,i=ck(),o=zx;e.getParser=e=>{const t={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},n=t[e];if(n)return n;const o=Object.values(t).find((t=>t.isType(e)));if(o)return o;throw new r.ParserError(`The type "${e}" is not supported.`)};e.isDynamicParser=(e,t)=>{const{isDynamic:r}=e;return"function"==typeof r?r(t):r};e.pack=({types:n,values:i,packed:s=!1,tight:a=!1,arrayPacked:c=!1,byteArray:u=new Uint8Array})=>{(0,t.assert)(n.length===i.length,new r.ParserError(`The number of types (${n.length}) does not match the number of values (${i.length}).`));const{staticBuffer:h,dynamicBuffer:l,pointers:f}=n.reduce((({staticBuffer:r,dynamicBuffer:n,pointers:o},u,h)=>{const l=(0,e.getParser)(u),f=i[h];if(s||c||!(0,e.isDynamicParser)(l,u))return{staticBuffer:l.encode({buffer:r,value:f,type:u,packed:s,tight:a}),dynamicBuffer:n,pointers:o};return{staticBuffer:(0,t.concatBytes)([r,new Uint8Array(32)]),dynamicBuffer:l.encode({buffer:n,value:f,type:u,packed:s,tight:a}),pointers:[...o,{position:r.length,pointer:n.length}]}}),{staticBuffer:new Uint8Array,dynamicBuffer:new Uint8Array,pointers:[]});(0,t.assert)(!s&&!c||0===l.length,new r.ParserError("Invalid pack state."));const d=h.length,p=f.reduce(((e,{pointer:r,position:n})=>{const i=(0,o.padStart)((0,t.numberToBytes)(d+r));return(0,o.set)(e,i,n)}),h);return(0,t.concatBytes)([u,p,l])};e.unpack=(i,o)=>{const s=(0,n.iterate)(o);return i.map((n=>{const{value:{value:i,skip:a},done:c}=s.next();(0,t.assert)(!c,new r.ParserError(`The encoded value is invalid for the provided types. Reached end of buffer while attempting to parse "${n}".`));const u=(0,e.getParser)(n);if((0,e.isDynamicParser)(u,n)){const e=(0,t.bytesToNumber)(i.subarray(0,32)),r=o.subarray(e);return u.decode({type:n,value:r,skip:a})}return u.decode({type:n,value:i,skip:a})}))}}(Nx)),Nx}nk.string={isDynamic:!0,isType:e=>"string"===e,getByteLength:()=>32,encode:({buffer:e,value:t,packed:r,tight:n})=>ok.bytes.encode({type:"bytes",buffer:e,value:(0,ik.stringToBytes)(t),packed:r,tight:n}),decode:e=>(0,ik.bytesToString)(ok.bytes.decode(e))},function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeSingle=e.decode=e.encodePacked=e.encodeSingle=e.encode=void 0;const t=tv,r=Px,n=uk();e.encode=(e,t,i,o)=>{try{return(0,n.pack)({types:e,values:t,packed:i,tight:o})}catch(e){if(e instanceof r.ParserError)throw new r.ParserError(`Unable to encode value: ${e.message}`,e);throw new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(e)}`,e)}};e.encodeSingle=(t,r)=>(0,e.encode)([t],[r]);e.encodePacked=(t,r,n)=>(0,e.encode)(t,r,!0,n);e.decode=(e,i)=>{const o=(0,t.createBytes)(i);try{return(0,n.unpack)(e,o)}catch(e){if(e instanceof r.ParserError)throw new r.ParserError(`Unable to decode value: ${e.message}`,e);throw new r.ParserError(`An unexpected error occurred: ${(0,r.getErrorMessage)(e)}`,e)}};e.decodeSingle=(n,i)=>{const o=(0,e.decode)([n],i);return(0,t.assert)(1===o.length,new r.ParserError("Decoded value array has unexpected length.")),o[0]}}(Cx);var hk={},lk={};Object.defineProperty(lk,"__esModule",{value:!0}),function(e){var t=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Cr&&Cr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(lk,e)}(hk),function(e){var t=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Cr&&Cr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),r(Cx,e),r(Px,e),r(hk,e)}(Mx);var fk={},dk={},pk={};function gk(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function yk(e){if("boolean"!=typeof e)throw new Error(`boolean expected, not ${e}`)}function mk(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}function wk(e,...t){if(!mk(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 bk(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");gk(e.outputLen),gk(e.blockLen)}function vk(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 _k(e,t){wk(e);const r=t.outputLen;if(e.length>xk&Ak)}:{h:0|Number(e>>xk&Ak),l:0|Number(e&Ak)}}function Bk(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;iBigInt(e>>>0)<>>0);Sk.toBig=Ik;const Tk=(e,t,r)=>e>>>r;Sk.shrSH=Tk;const Rk=(e,t,r)=>e<<32-r|t>>>r;Sk.shrSL=Rk;const Ok=(e,t,r)=>e>>>r|t<<32-r;Sk.rotrSH=Ok;const Lk=(e,t,r)=>e<<32-r|t>>>r;Sk.rotrSL=Lk;const Mk=(e,t,r)=>e<<64-r|t>>>r-32;Sk.rotrBH=Mk;const Ck=(e,t,r)=>e>>>r-32|t<<64-r;Sk.rotrBL=Ck;const Pk=(e,t)=>t;Sk.rotr32H=Pk;const Nk=(e,t)=>e;Sk.rotr32L=Nk;const Uk=(e,t,r)=>e<>>32-r;Sk.rotlSH=Uk;const jk=(e,t,r)=>t<>>32-r;Sk.rotlSL=jk;const $k=(e,t,r)=>t<>>64-r;Sk.rotlBH=$k;const Hk=(e,t,r)=>e<>>64-r;function zk(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}Sk.rotlBL=Hk,Sk.add=zk;const Dk=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0);Sk.add3L=Dk;const Fk=(e,t,r,n)=>t+r+n+(e/2**32|0)|0;Sk.add3H=Fk;const qk=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0);Sk.add4L=qk;const Kk=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0;Sk.add4H=Kk;const Wk=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0);Sk.add5L=Wk;const Vk=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0;Sk.add5H=Vk;const Zk={fromBig:kk,split:Bk,toBig:Ik,shrSH:Tk,shrSL:Rk,rotrSH:Ok,rotrSL:Lk,rotrBH:Mk,rotrBL:Ck,rotr32H:Pk,rotr32L:Nk,rotlSH:Uk,rotlSL:jk,rotlBH:$k,rotlBL:Hk,add:zk,add3L:Dk,add3H:Fk,add4L:qk,add4H:Kk,add5H:Vk,add5L:Wk};Sk.default=Zk;var Gk={},Jk={};Object.defineProperty(Jk,"__esModule",{value:!0}),Jk.crypto=void 0,Jk.crypto="object"==typeof globalThis&&"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=Jk,r=pk;e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name};e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);e.rotr=(e,t)=>e<<32-t|e>>>t;e.rotl=(e,t)=>e<>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let r=0;rt.toString(16).padStart(2,"0")));e.bytesToHex=function(e){(0,r.bytes)(e);let t="";for(let r=0;r=i&&e<=o?e-i:e>=s&&e<=a?e-(s-10):e>=c&&e<=u?e-(c-10):void 0}e.hexToBytes=function(e){if("string"!=typeof e)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 t=0,i=0;t{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o=0&&te().update(f(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}(Gk),Object.defineProperty(dk,"__esModule",{value:!0}),dk.shake256=dk.shake128=dk.keccak_512=dk.keccak_384=dk.keccak_256=dk.keccak_224=dk.sha3_512=dk.sha3_384=dk.sha3_256=dk.sha3_224=dk.Keccak=dk.keccakP=void 0;const Yk=pk,Xk=Sk,Qk=Gk,eB=[],tB=[],rB=[],nB=BigInt(0),iB=BigInt(1),oB=BigInt(2),sB=BigInt(7),aB=BigInt(256),cB=BigInt(113);for(let e=0,t=iB,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],eB.push(2*(5*n+r)),tB.push((e+1)*(e+2)/2%64);let i=nB;for(let e=0;e<7;e++)t=(t<>sB)*cB)%aB,t&oB&&(i^=iB<<(iB<r>32?(0,Xk.rotlBH)(e,t,r):(0,Xk.rotlSH)(e,t,r),fB=(e,t,r)=>r>32?(0,Xk.rotlBL)(e,t,r):(0,Xk.rotlSL)(e,t,r);function dB(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=lB(o,s,1)^r[n],c=fB(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=tB[r],o=lB(t,i,n),s=fB(t,i,n),a=eB[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=uB[n],e[1]^=hB[n]}r.fill(0)}dk.keccakP=dB;class pB extends Qk.Hash{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Yk.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Qk.u32)(this.state)}keccak(){Qk.isLE||(0,Qk.byteSwap32)(this.state32),dB(this.state32,this.rounds),Qk.isLE||(0,Qk.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(e){(0,Yk.exists)(this);const{blockLen:t,state:r}=this,n=(e=(0,Qk.toBytes)(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,Yk.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,Yk.output)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new pB(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}dk.Keccak=pB;const gB=(e,t,r)=>(0,Qk.wrapConstructor)((()=>new pB(t,e,r)));dk.sha3_224=gB(6,144,28),dk.sha3_256=gB(6,136,32),dk.sha3_384=gB(6,104,48),dk.sha3_512=gB(6,72,64),dk.keccak_224=gB(1,144,28),dk.keccak_256=gB(1,136,32),dk.keccak_384=gB(1,104,48),dk.keccak_512=gB(1,72,64);const yB=(e,t,r)=>(0,Qk.wrapXOFConstructorWithOpts)(((n={})=>new pB(t,e,void 0===n.dkLen?r:n.dkLen,!0)));dk.shake128=yB(31,168,16),dk.shake256=yB(31,136,32);var mB={exports:{}};!function(e,t){var r=Cr&&Cr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},t.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,i.hexToBytes)(t)},t.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r(n.default.bytes(t),e(t))};const n=r(pk),i=Gk,o=n.default.bool;t.assertBool=o;const s=n.default.bytes;t.assertBytes=s;var a=Gk;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}}),t.crypto=(()=>{const t="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,r=yd.bind(e);return{node:r&&!t?r("crypto"):void 0,web:t}})()}(mB,mB.exports),Object.defineProperty(fk,"__esModule",{value:!0}),fk.keccak512=fk.keccak384=fk.keccak256=fk.keccak224=void 0;const wB=dk,bB=mB.exports;fk.keccak224=(0,bB.wrapHash)(wB.keccak_224),fk.keccak256=(()=>{const e=(0,bB.wrapHash)(wB.keccak_256);return e.create=wB.keccak_256.create,e})(),fk.keccak384=(0,bB.wrapHash)(wB.keccak_384),fk.keccak512=(0,bB.wrapHash)(wB.keccak_512),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=bh,r=Mx,n=ck(),i=zx,o=tv,s=fk,a=ev;var c;function u(e,t){if(!Object.keys(c).includes(e))throw new Error(`Invalid version: '${e}'`);if(t&&!t.includes(e))throw new Error(`SignTypedDataVersion not allowed: '${e}'. Allowed versions are: ${t.join(", ")}`)}function h(e,t){(0,o.assert)(null!==t,`Unable to encode value: Invalid number. Expected a valid number value, but received "${t}".`);const r=BigInt(t),i=(0,n.getLength)(e),s=BigInt(2)**BigInt(i)-BigInt(1);return(0,o.assert)(r>=-s&&r<=s,`Unable to encode value: Number "${t}" is out of range for type "${e}".`),r}function l(e){let t=BigInt(0);for(let r=0;r=49?n-BigInt(49)+BigInt(10):n>=17?n-BigInt(17)+BigInt(10):n}return(0,i.padStart)((0,o.bigIntToBytes)(t),20)}function f(e,n,a,p,g){if(u(g,[c.V3,c.V4]),void 0!==e[a])return["bytes32",g===c.V4&&null==p?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,s.keccak256)(d(a,p,e,g)))];if("function"===a)throw new Error('Unsupported or invalid type: "function"');if(void 0===p)throw new Error(`missing value for field ${n} of type ${a}`);if("address"===a){if("number"==typeof p)return["address",(0,i.padStart)((0,o.numberToBytes)(p),20)];if((0,o.isStrictHexString)(p))return["address",(0,o.add0x)(p)];if("string"==typeof p)return["address",l(p).subarray(0,20)]}if("bool"===a)return["bool",Boolean(p)];if("bytes"===a)return"number"==typeof p?p=(0,o.numberToBytes)(p):(0,o.isStrictHexString)(p)||"0x"===p?p=(0,o.hexToBytes)(p):"string"==typeof p&&(p=(0,o.stringToBytes)(p)),["bytes32",(0,t.arrToBufArr)((0,s.keccak256)(p))];if(a.startsWith("bytes")&&"bytes"!==a&&!a.includes("["))return"number"==typeof p?p<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,o.bigIntToBytes)(BigInt(p))]:(0,o.isStrictHexString)(p)?["bytes32",(0,o.hexToBytes)(p)]:["bytes32",p];if(a.startsWith("int")&&!a.includes("[")){const e=h(a,p);return e>=BigInt(0)?["uint256",e]:["int256",e]}if("string"===a)return p="number"==typeof p?(0,o.numberToBytes)(p):(0,o.stringToBytes)(null!=p?p:""),["bytes32",(0,t.arrToBufArr)((0,s.keccak256)(p))];if(a.endsWith("]")){if(g===c.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const i=a.slice(0,a.lastIndexOf("[")),o=p.map((t=>f(e,n,i,t,g)));return["bytes32",(0,t.arrToBufArr)((0,s.keccak256)((0,r.encode)(o.map((([e])=>e)),o.map((([,e])=>e)))))]}return[a,p]}function d(e,n,i,o){u(o,[c.V3,c.V4]);const s=["bytes32"],a=[m(e,i)];for(const t of i[e]){if(o===c.V3&&void 0===n[t.name])continue;const[e,r]=f(i,t.name,t.type,n[t.name],o);s.push(e),a.push(r)}return(0,t.arrToBufArr)((0,r.encode)(s,a))}function p(e,t){let r="";const n=g(e,t);n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i){if(!t[e])throw new Error(`No type definition specified: ${e}`);r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return r}function g(e,t,r=new Set){if("string"!=typeof e)throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(e)}`);const n=e.match(/^\w*/u);if([e]=n,r.has(e)||void 0===t[e])return r;r.add(e);for(const n of t[e])g(n.type,t,r);return r}function y(e,r,n,i){u(i,[c.V3,c.V4]);const o=d(e,r,n,i),a=(0,s.keccak256)(o);return(0,t.arrToBufArr)(a)}function m(e,r){const n=(0,o.stringToBytes)(p(e,r));return(0,t.arrToBufArr)((0,s.keccak256)(n))}function w(t){const r={};for(const n in e.TYPED_MESSAGE_SCHEMA.properties)t[n]&&(r[n]=t[n]);return"types"in r&&(r.types=Object.assign({EIP712Domain:[]},r.types)),r}function b(e,t){u(t,[c.V3,c.V4]);const r=w(e),{domain:n}=r;return y("EIP712Domain",n,{EIP712Domain:r.types.EIP712Domain},t)}function v(e,t){if((0,n.isArrayType)(e)&&Array.isArray(t)){const[r]=(0,n.getArrayType)(e);return t.map((e=>v(r,e)))}if("address"===e){if("number"==typeof t)return(0,i.padStart)((0,o.numberToBytes)(t),20);if((0,o.isStrictHexString)(t))return(0,i.padStart)((0,o.hexToBytes)(t).subarray(0,20),20);if(t instanceof Uint8Array)return(0,i.padStart)(t.subarray(0,20),20)}if("bool"===e)return Boolean(t);if(e.startsWith("bytes")&&"bytes"!==e){const r=(0,n.getByteLength)(e);if("number"==typeof t)return t<0?new Uint8Array:(0,o.numberToBytes)(t).subarray(0,r);if((0,o.isStrictHexString)(t))return(0,o.hexToBytes)(t).subarray(0,r);if(t instanceof Uint8Array)return t.subarray(0,r)}if(e.startsWith("uint")&&"number"==typeof t)return Math.abs(t);if(e.startsWith("int")&&"number"==typeof t){const r=(0,n.getLength)(e);return BigInt.asIntN(r,BigInt(t))}return t}function _(e,t){return t.map((t=>{if("string"==typeof t||"number"==typeof t||"bigint"==typeof t){const r=h(e,t);if(r>=BigInt(0))return(0,i.padStart)((0,o.bigIntToBytes)(r),32);const s=(0,n.getLength)(e),a=BigInt.asIntN(s,r);return(0,o.signedBigIntToBytes)(a,32)}return t}))}function E(e){const c=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw c;const u=e.map((({name:e,type:t,value:r})=>{if("address[]"===t)return{name:e,type:"bytes32[]",value:(s=r,s.map((e=>"number"==typeof e?(0,i.padStart)((0,o.numberToBytes)(e),32):(0,o.isStrictHexString)(e)?(0,i.padStart)((0,o.hexToBytes)(e).subarray(0,32),32):e instanceof Uint8Array?(0,i.padStart)(e.subarray(0,32),32):e)))};var s;if(t.startsWith("int")&&(0,n.isArrayType)(t)){const[i,o]=(0,n.getArrayType)(t);return{name:e,type:`bytes32[${null!=o?o:""}]`,value:_(i,r)}}return{name:e,type:t,value:v(t,r)}})),h=u.map((e=>"bytes"!==e.type?e.value:(0,a.legacyToBuffer)(e.value))),l=u.map((e=>{if("function"===e.type)throw new Error('Unsupported or invalid type: "function"');return e.type})),f=e.map((e=>{if(!e.name)throw c;return`${e.type} ${e.name}`}));return(0,t.arrToBufArr)((0,s.keccak256)((0,r.encodePacked)(["bytes32","bytes32"],[(0,s.keccak256)((0,r.encodePacked)(["string[]"],[f],!0)),(0,s.keccak256)((0,r.encodePacked)(l,h,!0))])))}!function(e){e.V1="V1",e.V3="V3",e.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"]},e.TypedDataUtils={encodeData:d,encodeType:p,findTypeDependencies:g,hashStruct:y,hashType:m,sanitizeData:w,eip712Hash:function(e,r){u(r,[c.V3,c.V4]);const n=w(e),i=[(0,o.hexToBytes)("1901")];return i.push(b(e,r)),"EIP712Domain"!==n.primaryType&&i.push(y(n.primaryType,n.message,n.types,r)),(0,t.arrToBufArr)((0,s.keccak256)((0,o.concatBytes)(i)))},eip712DomainHash:b},e.typedSignatureHash=function(e){const t=E(e);return(0,o.bytesToHex)(t)},e.signTypedData=function({privateKey:r,data:n,version:i}){if(u(i),(0,a.isNullish)(n))throw new Error("Missing data parameter");if((0,a.isNullish)(r))throw new Error("Missing private key parameter");const s=i===c.V1?E(n):e.TypedDataUtils.eip712Hash(n,i),h=(0,t.ecsign)(s,r);return(0,a.concatSig)((0,t.arrToBufArr)((0,o.bigIntToBytes)(h.v)),h.r,h.s)},e.recoverTypedSignature=function({data:r,signature:n,version:i}){if(u(i),(0,a.isNullish)(r))throw new Error("Missing data parameter");if((0,a.isNullish)(n))throw new Error("Missing signature parameter");const s=i===c.V1?E(r):e.TypedDataUtils.eip712Hash(r,i),h=(0,a.recoverPublicKey)(s,n),l=(0,t.publicToAddress)(h);return(0,o.bytesToHex)(l)}}(Lx);var vB={},_B={exports:{}},EB=Pr(Object.freeze({__proto__:null,default:{}}));!function(e){!function(e){var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function p(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,r,n){return p(e,t,r,n,16)}function y(e,t,r,n){return p(e,t,r,n,32)}function m(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,E=s,S=a,A=c,x=u,k=h,B=l,I=f,T=d,R=p,O=g,L=y,M=m,C=w,P=b,N=v,U=0;U<20;U+=2)_^=(i=(M^=(i=(T^=(i=(x^=(i=_+M|0)<<7|i>>>25)+_|0)<<9|i>>>23)+x|0)<<13|i>>>19)+T|0)<<18|i>>>14,k^=(i=(E^=(i=(C^=(i=(R^=(i=k+E|0)<<7|i>>>25)+k|0)<<9|i>>>23)+R|0)<<13|i>>>19)+C|0)<<18|i>>>14,O^=(i=(B^=(i=(S^=(i=(P^=(i=O+B|0)<<7|i>>>25)+O|0)<<9|i>>>23)+P|0)<<13|i>>>19)+S|0)<<18|i>>>14,N^=(i=(L^=(i=(I^=(i=(A^=(i=N+L|0)<<7|i>>>25)+N|0)<<9|i>>>23)+A|0)<<13|i>>>19)+I|0)<<18|i>>>14,_^=(i=(A^=(i=(S^=(i=(E^=(i=_+A|0)<<7|i>>>25)+_|0)<<9|i>>>23)+E|0)<<13|i>>>19)+S|0)<<18|i>>>14,k^=(i=(x^=(i=(I^=(i=(B^=(i=k+x|0)<<7|i>>>25)+k|0)<<9|i>>>23)+B|0)<<13|i>>>19)+I|0)<<18|i>>>14,O^=(i=(R^=(i=(T^=(i=(L^=(i=O+R|0)<<7|i>>>25)+O|0)<<9|i>>>23)+L|0)<<13|i>>>19)+T|0)<<18|i>>>14,N^=(i=(P^=(i=(C^=(i=(M^=(i=N+P|0)<<7|i>>>25)+N|0)<<9|i>>>23)+M|0)<<13|i>>>19)+C|0)<<18|i>>>14;_=_+o|0,E=E+s|0,S=S+a|0,A=A+c|0,x=x+u|0,k=k+h|0,B=B+l|0,I=I+f|0,T=T+d|0,R=R+p|0,O=O+g|0,L=L+y|0,M=M+m|0,C=C+w|0,P=P+b|0,N=N+v|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=E>>>0&255,e[5]=E>>>8&255,e[6]=E>>>16&255,e[7]=E>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=A>>>0&255,e[13]=A>>>8&255,e[14]=A>>>16&255,e[15]=A>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=k>>>0&255,e[21]=k>>>8&255,e[22]=k>>>16&255,e[23]=k>>>24&255,e[24]=B>>>0&255,e[25]=B>>>8&255,e[26]=B>>>16&255,e[27]=B>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=R>>>0&255,e[37]=R>>>8&255,e[38]=R>>>16&255,e[39]=R>>>24&255,e[40]=O>>>0&255,e[41]=O>>>8&255,e[42]=O>>>16&255,e[43]=O>>>24&255,e[44]=L>>>0&255,e[45]=L>>>8&255,e[46]=L>>>16&255,e[47]=L>>>24&255,e[48]=M>>>0&255,e[49]=M>>>8&255,e[50]=M>>>16&255,e[51]=M>>>24&255,e[52]=C>>>0&255,e[53]=C>>>8&255,e[54]=C>>>16&255,e[55]=C>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}(e,t,r,n)}function w(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(m^=(i=(d^=(i=(u^=(i=o+m|0)<<7|i>>>25)+o|0)<<9|i>>>23)+u|0)<<13|i>>>19)+d|0)<<18|i>>>14,h^=(i=(s^=(i=(w^=(i=(p^=(i=h+s|0)<<7|i>>>25)+h|0)<<9|i>>>23)+p|0)<<13|i>>>19)+w|0)<<18|i>>>14,g^=(i=(l^=(i=(a^=(i=(b^=(i=g+l|0)<<7|i>>>25)+g|0)<<9|i>>>23)+b|0)<<13|i>>>19)+a|0)<<18|i>>>14,v^=(i=(y^=(i=(f^=(i=(c^=(i=v+y|0)<<7|i>>>25)+v|0)<<9|i>>>23)+c|0)<<13|i>>>19)+f|0)<<18|i>>>14,o^=(i=(c^=(i=(a^=(i=(s^=(i=o+c|0)<<7|i>>>25)+o|0)<<9|i>>>23)+s|0)<<13|i>>>19)+a|0)<<18|i>>>14,h^=(i=(u^=(i=(f^=(i=(l^=(i=h+u|0)<<7|i>>>25)+h|0)<<9|i>>>23)+l|0)<<13|i>>>19)+f|0)<<18|i>>>14,g^=(i=(p^=(i=(d^=(i=(y^=(i=g+p|0)<<7|i>>>25)+g|0)<<9|i>>>23)+y|0)<<13|i>>>19)+d|0)<<18|i>>>14,v^=(i=(b^=(i=(w^=(i=(m^=(i=v+b|0)<<7|i>>>25)+v|0)<<9|i>>>23)+m|0)<<13|i>>>19)+w|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=h>>>0&255,e[5]=h>>>8&255,e[6]=h>>>16&255,e[7]=h>>>24&255,e[8]=g>>>0&255,e[9]=g>>>8&255,e[10]=g>>>16&255,e[11]=g>>>24&255,e[12]=v>>>0&255,e[13]=v>>>8&255,e[14]=v>>>16&255,e[15]=v>>>24&255,e[16]=l>>>0&255,e[17]=l>>>8&255,e[18]=l>>>16&255,e[19]=l>>>24&255,e[20]=f>>>0&255,e[21]=f>>>8&255,e[22]=f>>>16&255,e[23]=f>>>24&255,e[24]=d>>>0&255,e[25]=d>>>8&255,e[26]=d>>>16&255,e[27]=d>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function v(e,t,r,n,i,o,s){var a,c,u=new Uint8Array(16),h=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=o[c];for(;i>=64;){for(m(h,u,s,b),c=0;c<64;c++)e[t+c]=r[n+c]^h[c];for(a=1,c=8;c<16;c++)a=a+(255&u[c])|0,u[c]=255&a,a>>>=8;i-=64,t+=64,n+=64}if(i>0)for(m(h,u,s,b),c=0;c=64;){for(m(c,a,i,b),s=0;s<64;s++)e[t+s]=c[s];for(o=1,s=8;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(m(c,a,i,b),s=0;s>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function x(e,t,r,n,i,o){var s=new A(o);return s.update(r,n,i),s.finish(e,t),0}function k(e,t,r,n,i,o){var s=new Uint8Array(16);return x(s,0,r,n,i,o),g(e,t,s,0)}function B(e,t,r,n,i){var o;if(r<32)return-1;for(S(e,0,t,0,r,n,i),x(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function I(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(E(s,0,32,n,i),0!==k(t,16,t,32,r-32,s))return-1;for(S(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function R(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function O(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function L(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(R(a),R(a),R(a),i=0;i<2;i++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,O(a,s,1-o)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function M(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return L(r,e),L(n,t),y(r,0,n,0)}function C(e){var t=new Uint8Array(32);return L(t,e),1&t[0]}function P(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function N(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function j(e,t,r){var n,i,o=0,s=0,a=0,c=0,u=0,h=0,l=0,f=0,d=0,p=0,g=0,y=0,m=0,w=0,b=0,v=0,_=0,E=0,S=0,A=0,x=0,k=0,B=0,I=0,T=0,R=0,O=0,L=0,M=0,C=0,P=0,N=r[0],U=r[1],j=r[2],$=r[3],H=r[4],z=r[5],D=r[6],F=r[7],q=r[8],K=r[9],W=r[10],V=r[11],Z=r[12],G=r[13],J=r[14],Y=r[15];o+=(n=t[0])*N,s+=n*U,a+=n*j,c+=n*$,u+=n*H,h+=n*z,l+=n*D,f+=n*F,d+=n*q,p+=n*K,g+=n*W,y+=n*V,m+=n*Z,w+=n*G,b+=n*J,v+=n*Y,s+=(n=t[1])*N,a+=n*U,c+=n*j,u+=n*$,h+=n*H,l+=n*z,f+=n*D,d+=n*F,p+=n*q,g+=n*K,y+=n*W,m+=n*V,w+=n*Z,b+=n*G,v+=n*J,_+=n*Y,a+=(n=t[2])*N,c+=n*U,u+=n*j,h+=n*$,l+=n*H,f+=n*z,d+=n*D,p+=n*F,g+=n*q,y+=n*K,m+=n*W,w+=n*V,b+=n*Z,v+=n*G,_+=n*J,E+=n*Y,c+=(n=t[3])*N,u+=n*U,h+=n*j,l+=n*$,f+=n*H,d+=n*z,p+=n*D,g+=n*F,y+=n*q,m+=n*K,w+=n*W,b+=n*V,v+=n*Z,_+=n*G,E+=n*J,S+=n*Y,u+=(n=t[4])*N,h+=n*U,l+=n*j,f+=n*$,d+=n*H,p+=n*z,g+=n*D,y+=n*F,m+=n*q,w+=n*K,b+=n*W,v+=n*V,_+=n*Z,E+=n*G,S+=n*J,A+=n*Y,h+=(n=t[5])*N,l+=n*U,f+=n*j,d+=n*$,p+=n*H,g+=n*z,y+=n*D,m+=n*F,w+=n*q,b+=n*K,v+=n*W,_+=n*V,E+=n*Z,S+=n*G,A+=n*J,x+=n*Y,l+=(n=t[6])*N,f+=n*U,d+=n*j,p+=n*$,g+=n*H,y+=n*z,m+=n*D,w+=n*F,b+=n*q,v+=n*K,_+=n*W,E+=n*V,S+=n*Z,A+=n*G,x+=n*J,k+=n*Y,f+=(n=t[7])*N,d+=n*U,p+=n*j,g+=n*$,y+=n*H,m+=n*z,w+=n*D,b+=n*F,v+=n*q,_+=n*K,E+=n*W,S+=n*V,A+=n*Z,x+=n*G,k+=n*J,B+=n*Y,d+=(n=t[8])*N,p+=n*U,g+=n*j,y+=n*$,m+=n*H,w+=n*z,b+=n*D,v+=n*F,_+=n*q,E+=n*K,S+=n*W,A+=n*V,x+=n*Z,k+=n*G,B+=n*J,I+=n*Y,p+=(n=t[9])*N,g+=n*U,y+=n*j,m+=n*$,w+=n*H,b+=n*z,v+=n*D,_+=n*F,E+=n*q,S+=n*K,A+=n*W,x+=n*V,k+=n*Z,B+=n*G,I+=n*J,T+=n*Y,g+=(n=t[10])*N,y+=n*U,m+=n*j,w+=n*$,b+=n*H,v+=n*z,_+=n*D,E+=n*F,S+=n*q,A+=n*K,x+=n*W,k+=n*V,B+=n*Z,I+=n*G,T+=n*J,R+=n*Y,y+=(n=t[11])*N,m+=n*U,w+=n*j,b+=n*$,v+=n*H,_+=n*z,E+=n*D,S+=n*F,A+=n*q,x+=n*K,k+=n*W,B+=n*V,I+=n*Z,T+=n*G,R+=n*J,O+=n*Y,m+=(n=t[12])*N,w+=n*U,b+=n*j,v+=n*$,_+=n*H,E+=n*z,S+=n*D,A+=n*F,x+=n*q,k+=n*K,B+=n*W,I+=n*V,T+=n*Z,R+=n*G,O+=n*J,L+=n*Y,w+=(n=t[13])*N,b+=n*U,v+=n*j,_+=n*$,E+=n*H,S+=n*z,A+=n*D,x+=n*F,k+=n*q,B+=n*K,I+=n*W,T+=n*V,R+=n*Z,O+=n*G,L+=n*J,M+=n*Y,b+=(n=t[14])*N,v+=n*U,_+=n*j,E+=n*$,S+=n*H,A+=n*z,x+=n*D,k+=n*F,B+=n*q,I+=n*K,T+=n*W,R+=n*V,O+=n*Z,L+=n*G,M+=n*J,C+=n*Y,v+=(n=t[15])*N,s+=38*(E+=n*j),a+=38*(S+=n*$),c+=38*(A+=n*H),u+=38*(x+=n*z),h+=38*(k+=n*D),l+=38*(B+=n*F),f+=38*(I+=n*q),d+=38*(T+=n*K),p+=38*(R+=n*W),g+=38*(O+=n*V),y+=38*(L+=n*Z),m+=38*(M+=n*G),w+=38*(C+=n*J),b+=38*(P+=n*Y),o=(n=(o+=38*(_+=n*U))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=h,e[6]=l,e[7]=f,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=m,e[13]=w,e[14]=b,e[15]=v}function $(e,t){j(e,t,t)}function H(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)$(i,i),2!==n&&4!==n&&j(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function z(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)$(i,i),1!==n&&j(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function D(e,r,n){var i,o,s=new Uint8Array(32),c=new Float64Array(80),u=t(),h=t(),l=t(),f=t(),d=t(),p=t();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,P(c,n),o=0;o<16;o++)h[o]=c[o],f[o]=u[o]=l[o]=0;for(u[0]=f[0]=1,o=254;o>=0;--o)O(u,h,i=s[o>>>3]>>>(7&o)&1),O(l,f,i),N(d,u,l),U(u,u,l),N(l,h,f),U(h,h,f),$(f,d),$(p,u),j(u,l,u),j(l,h,d),N(d,u,l),U(u,u,l),$(h,u),U(l,f,p),j(u,l,a),N(u,u,f),j(l,l,u),j(u,f,p),j(f,h,c),$(h,d),O(u,h,i),O(l,f,i);for(o=0;o<16;o++)c[o+16]=u[o],c[o+32]=l[o],c[o+48]=h[o],c[o+64]=f[o];var g=c.subarray(32),y=c.subarray(16);return H(g,g),j(y,y,g),L(e,y),0}function F(e,t){return D(e,t,i)}function q(e,t){return r(t,32),F(e,t)}function K(e,t,r){var i=new Uint8Array(32);return D(i,r,t),w(e,n,i,b)}A.prototype.blocks=function(e,t,r){for(var n,i,o,s,a,c,u,h,l,f,d,p,g,y,m,w,b,v,_,E=this.fin?0:2048,S=this.h[0],A=this.h[1],x=this.h[2],k=this.h[3],B=this.h[4],I=this.h[5],T=this.h[6],R=this.h[7],O=this.h[8],L=this.h[9],M=this.r[0],C=this.r[1],P=this.r[2],N=this.r[3],U=this.r[4],j=this.r[5],$=this.r[6],H=this.r[7],z=this.r[8],D=this.r[9];r>=16;)f=l=0,f+=(S+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*M,f+=(A+=8191&(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*D),f+=(x+=8191&(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*z),f+=(k+=8191&(o>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*H),l=(f+=(B+=8191&(s>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*$))>>>13,f&=8191,f+=(I+=a>>>1&8191)*(5*j),f+=(T+=8191&(a>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*U),f+=(R+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*N),f+=(O+=8191&(u>>>8|(h=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*P),d=l+=(f+=(L+=h>>>5|E)*(5*C))>>>13,d+=S*C,d+=A*M,d+=x*(5*D),d+=k*(5*z),l=(d+=B*(5*H))>>>13,d&=8191,d+=I*(5*$),d+=T*(5*j),d+=R*(5*U),d+=O*(5*N),l+=(d+=L*(5*P))>>>13,d&=8191,p=l,p+=S*P,p+=A*C,p+=x*M,p+=k*(5*D),l=(p+=B*(5*z))>>>13,p&=8191,p+=I*(5*H),p+=T*(5*$),p+=R*(5*j),p+=O*(5*U),g=l+=(p+=L*(5*N))>>>13,g+=S*N,g+=A*P,g+=x*C,g+=k*M,l=(g+=B*(5*D))>>>13,g&=8191,g+=I*(5*z),g+=T*(5*H),g+=R*(5*$),g+=O*(5*j),y=l+=(g+=L*(5*U))>>>13,y+=S*U,y+=A*N,y+=x*P,y+=k*C,l=(y+=B*M)>>>13,y&=8191,y+=I*(5*D),y+=T*(5*z),y+=R*(5*H),y+=O*(5*$),m=l+=(y+=L*(5*j))>>>13,m+=S*j,m+=A*U,m+=x*N,m+=k*P,l=(m+=B*C)>>>13,m&=8191,m+=I*M,m+=T*(5*D),m+=R*(5*z),m+=O*(5*H),w=l+=(m+=L*(5*$))>>>13,w+=S*$,w+=A*j,w+=x*U,w+=k*N,l=(w+=B*P)>>>13,w&=8191,w+=I*C,w+=T*M,w+=R*(5*D),w+=O*(5*z),b=l+=(w+=L*(5*H))>>>13,b+=S*H,b+=A*$,b+=x*j,b+=k*U,l=(b+=B*N)>>>13,b&=8191,b+=I*P,b+=T*C,b+=R*M,b+=O*(5*D),v=l+=(b+=L*(5*z))>>>13,v+=S*z,v+=A*H,v+=x*$,v+=k*j,l=(v+=B*U)>>>13,v&=8191,v+=I*N,v+=T*P,v+=R*C,v+=O*M,_=l+=(v+=L*(5*D))>>>13,_+=S*D,_+=A*z,_+=x*H,_+=k*$,l=(_+=B*j)>>>13,_&=8191,_+=I*U,_+=T*N,_+=R*P,_+=O*C,S=f=8191&(l=(l=((l+=(_+=L*M)>>>13)<<2)+l|0)+(f&=8191)|0),A=d+=l>>>=13,x=p&=8191,k=g&=8191,B=y&=8191,I=m&=8191,T=w&=8191,R=b&=8191,O=v&=8191,L=_&=8191,t+=16,r-=16;this.h[0]=S,this.h[1]=A,this.h[2]=x,this.h[3]=k,this.h[4]=B,this.h[5]=I,this.h[6]=T,this.h[7]=R,this.h[8]=O,this.h[9]=L},A.prototype.finish=function(e,t){var r,n,i,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|s[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(E=0;E<16;E++)S=8*E+G,R[E]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],O[E]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(E=0;E<80;E++)if(i=L,o=M,s=C,a=P,c=N,u=U,h=j,$,f=H,d=z,p=D,g=F,y=q,m=K,w=W,V,k=65535&(x=V),B=x>>>16,I=65535&(A=$),T=A>>>16,k+=65535&(x=(q>>>14|N<<18)^(q>>>18|N<<14)^(N>>>9|q<<23)),B+=x>>>16,I+=65535&(A=(N>>>14|q<<18)^(N>>>18|q<<14)^(q>>>9|N<<23)),T+=A>>>16,k+=65535&(x=q&K^~q&W),B+=x>>>16,I+=65535&(A=N&U^~N&j),T+=A>>>16,k+=65535&(x=Z[2*E+1]),B+=x>>>16,I+=65535&(A=Z[2*E]),T+=A>>>16,A=R[E%16],B+=(x=O[E%16])>>>16,I+=65535&A,T+=A>>>16,I+=(B+=(k+=65535&x)>>>16)>>>16,k=65535&(x=_=65535&k|B<<16),B=x>>>16,I=65535&(A=v=65535&I|(T+=I>>>16)<<16),T=A>>>16,k+=65535&(x=(H>>>28|L<<4)^(L>>>2|H<<30)^(L>>>7|H<<25)),B+=x>>>16,I+=65535&(A=(L>>>28|H<<4)^(H>>>2|L<<30)^(H>>>7|L<<25)),T+=A>>>16,B+=(x=H&z^H&D^z&D)>>>16,I+=65535&(A=L&M^L&C^M&C),T+=A>>>16,l=65535&(I+=(B+=(k+=65535&x)>>>16)>>>16)|(T+=I>>>16)<<16,b=65535&k|B<<16,k=65535&(x=g),B=x>>>16,I=65535&(A=a),T=A>>>16,B+=(x=_)>>>16,I+=65535&(A=v),T+=A>>>16,M=i,C=o,P=s,N=a=65535&(I+=(B+=(k+=65535&x)>>>16)>>>16)|(T+=I>>>16)<<16,U=c,j=u,$=h,L=l,z=f,D=d,F=p,q=g=65535&k|B<<16,K=y,W=m,V=w,H=b,E%16==15)for(S=0;S<16;S++)A=R[S],k=65535&(x=O[S]),B=x>>>16,I=65535&A,T=A>>>16,A=R[(S+9)%16],k+=65535&(x=O[(S+9)%16]),B+=x>>>16,I+=65535&A,T+=A>>>16,v=R[(S+1)%16],k+=65535&(x=((_=O[(S+1)%16])>>>1|v<<31)^(_>>>8|v<<24)^(_>>>7|v<<25)),B+=x>>>16,I+=65535&(A=(v>>>1|_<<31)^(v>>>8|_<<24)^v>>>7),T+=A>>>16,v=R[(S+14)%16],B+=(x=((_=O[(S+14)%16])>>>19|v<<13)^(v>>>29|_<<3)^(_>>>6|v<<26))>>>16,I+=65535&(A=(v>>>19|_<<13)^(_>>>29|v<<3)^v>>>6),T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,R[S]=65535&I|T<<16,O[S]=65535&k|B<<16;k=65535&(x=H),B=x>>>16,I=65535&(A=L),T=A>>>16,A=e[0],B+=(x=t[0])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[0]=L=65535&I|T<<16,t[0]=H=65535&k|B<<16,k=65535&(x=z),B=x>>>16,I=65535&(A=M),T=A>>>16,A=e[1],B+=(x=t[1])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[1]=M=65535&I|T<<16,t[1]=z=65535&k|B<<16,k=65535&(x=D),B=x>>>16,I=65535&(A=C),T=A>>>16,A=e[2],B+=(x=t[2])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[2]=C=65535&I|T<<16,t[2]=D=65535&k|B<<16,k=65535&(x=F),B=x>>>16,I=65535&(A=P),T=A>>>16,A=e[3],B+=(x=t[3])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[3]=P=65535&I|T<<16,t[3]=F=65535&k|B<<16,k=65535&(x=q),B=x>>>16,I=65535&(A=N),T=A>>>16,A=e[4],B+=(x=t[4])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[4]=N=65535&I|T<<16,t[4]=q=65535&k|B<<16,k=65535&(x=K),B=x>>>16,I=65535&(A=U),T=A>>>16,A=e[5],B+=(x=t[5])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[5]=U=65535&I|T<<16,t[5]=K=65535&k|B<<16,k=65535&(x=W),B=x>>>16,I=65535&(A=j),T=A>>>16,A=e[6],B+=(x=t[6])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[6]=j=65535&I|T<<16,t[6]=W=65535&k|B<<16,k=65535&(x=V),B=x>>>16,I=65535&(A=$),T=A>>>16,A=e[7],B+=(x=t[7])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[7]=$=65535&I|T<<16,t[7]=V=65535&k|B<<16,G+=128,n-=128}return n}function J(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,G(i,o,t,r),r%=128,n=0;n=0;--i)X(e,t,n=r[i/8|0]>>(7&i)&1),Y(t,e),Y(e,e),X(e,t,n)}function te(e,r){var n=[t(),t(),t(),t()];T(n[0],h),T(n[1],l),T(n[2],s),j(n[3],h,l),ee(e,n,r)}function re(e,n,i){var o,s=new Uint8Array(64),a=[t(),t(),t(),t()];for(i||r(n,32),J(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,te(a,s),Q(e,a),o=0;o<32;o++)n[o+32]=e[o];return 0}var ne=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 ie(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*ne[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ne[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function oe(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ie(e,r)}function se(e,r,n,i){var o,s,a=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),l=[t(),t(),t(),t()];J(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(o=0;o>7&&U(e[0],o,e[0]),j(e[3],e[0],e[1]),0)}(d,i))return-1;for(a=0;a=0},e.sign.keyPair=function(){var e=new Uint8Array(he),t=new Uint8Array(le);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(de(e),e.length!==le)throw new Error("bad secret key size");for(var t=new Uint8Array(he),r=0;r0&&(o=2048-i-16),n.padding="0".repeat(o),TB({publicKey:e,data:JSON.stringify(n),version:r})},vB.decrypt=RB,vB.decryptSafely=function({encryptedData:e,privateKey:t}){if((0,IB.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,IB.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(RB({encryptedData:e,privateKey:t})).data},vB.getEncryptionPublicKey=function(e){const t=C.from(e,"hex"),r=BB.box.keyPair.fromSecretKey(t).publicKey;return kB.base64.encode(r)},function(e){var t=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Cr&&Cr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(wh,e),r(Lx,e),r(vB,e);var n=ev;Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(mh);class OB extends Error{constructor(e,t){super(),this.code=e,this.message=t}toString(){return`${this.message} (${this.code})`}}var LB,MB=(e,t,r)=>(((e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)})(e,t,"read from private field"),r?r.call(e):t.get(e));const CB=class{constructor(e){((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)})(this,LB,["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"+C.from(e).toString("hex")}static messageToBuffer(e){let t=C.from([]);try{t="string"==typeof e?C.from(e.replace("0x",""),"hex"):C.from(e)}catch(e){console.log(`messageToBuffer error: ${e}`)}return t}async request(e){if(MB(this,LB).includes(e.method))return Promise.reject(new OB(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,mh.SignTypedDataVersion.V3);case"eth_signTypedData_v4":return this.ethSignTypedData(e.params,mh.SignTypedDataVersion.V4);case"eth_signTypedData":return this.ethSignTypedData(e.params,mh.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:o}=t;return this.provider.internalRequest({method:"watchAsset",params:{type:r,contract:n,symbol:i,decimals:o||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})}}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;"string"==typeof r&&t.toLowerCase()===r.toLowerCase()&&(r=e[1],n=e[0]);const i=CB.messageToBuffer(r);return this.provider.internalRequest({method:"signPersonalMessage",params:{data:0===i.length?CB.bufferToHex(r):r,address:n}})}ethSign(e){if(!e)throw new Error("Missing params");const[t,r]=e,n=CB.messageToBuffer(r),i=CB.bufferToHex(n);return this.provider.internalRequest({method:CB.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;"string"==typeof n&&r.toLowerCase()===n.toLowerCase()&&(n=e[1],i=e[0]);const o="string"==typeof n?JSON.parse(n):n,{chainId:s}=o.domain||{};if(typeof s<"u"&&Number(s)!==Number(this.provider.getChainId()))throw new Error("Provided chainId does not match the currently active chain");const a=t!==mh.SignTypedDataVersion.V1?mh.TypedDataUtils.eip712Hash(o,t):"";return this.provider.internalRequest({method:"signTypedMessage",params:{data:"0x"+a.toString("hex"),raw:"string"==typeof n?n:JSON.stringify(n),address:i,version:t}})}};let PB=CB;LB=new WeakMap;var NB,UB=Object.defineProperty,jB=Object.getOwnPropertySymbols,$B=Object.prototype.hasOwnProperty,HB=Object.prototype.propertyIsEnumerable,zB=(e,t,r)=>t in e?UB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,DB=(e,t)=>{for(var r in t||(t={}))$B.call(t,r)&&zB(e,r,t[r]);if(jB)for(var r of jB(t))HB.call(t,r)&&zB(e,r,t[r]);return e},FB=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};class qB{constructor(e){((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)})(this,NB,void 0),((e,t,r,n)=>{FB(e,t,"write to private field"),n?n.call(e,r):t.set(e,r)})(this,NB,e)}async getBlockNumber(){return(await this.call({jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).result}async getBlockByNumber(e){return(await this.call({jsonrpc:"2.0",method:"eth_getBlockByNumber",params:[e,!1]})).result}getFilterLogs(e){return this.call({jsonrpc:"2.0",method:"eth_getLogs",params:[e]})}async call(e){const t=await(await fetch(((e,t,r)=>(FB(e,t,"read from private field"),r?r.call(e):t.get(e)))(this,NB),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(DB({id:(new Date).getTime()+Math.floor(1e3*Math.random())},e))})).json();if(!t.result&&t.error)throw new Error(t.error.message||"rpc error");return t.result}}NB=new WeakMap;var KB,WB,VB,ZB,GB,JB,YB=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},XB=(e,t,r)=>(YB(e,t,"read from private field"),r?r.call(e):t.get(e)),QB=(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)},eI=(e,t,r,n)=>(YB(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const tI=class extends He{constructor(e){super(),QB(this,KB,void 0),QB(this,WB,void 0),QB(this,VB,!1),QB(this,ZB,!1),QB(this,GB,void 0),QB(this,JB,void 0),this.isTrust=!0,this.isTrustWallet=!0,this.request=this.request.bind(this),e&&(e.chainId&&eI(this,KB,e.chainId),(e.rpc||e.rpcUrl)&&eI(this,WB,e.rpc||e.rpcUrl),typeof e.overwriteMetamask<"u"&&eI(this,ZB,e.overwriteMetamask),typeof e.disableMobileAdapter<"u"&&eI(this,VB,e.disableMobileAdapter),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust),eI(this,JB,new qB(XB(this,WB)))),XB(this,VB)||(this.mobileAdapter=new PB(this)),super.on("onResponseReady",this.onResponseReady.bind(this)),this.connect()}connect(){this.emit("connect",{chainId:XB(this,KB)})}enable(){return this.request({method:"eth_requestAccounts"})}sendAsync(e,t){Array.isArray(e)?Promise.all(e.map((e=>this.request(e)))).then((e=>t(null,e))).catch((e=>t(e,null))):this.request(e).then((e=>t(null,e))).catch((e=>t(e,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 OB(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("string"==typeof e&&(!t||Array.isArray(t))){const r=this;return new Promise(((n,i)=>{try{const o=r.request({method:e,params:t});o instanceof Promise?o.then(n).catch(i):n(o)}catch(e){i(e)}}))}return e&&"object"==typeof e&&"function"==typeof t?this.request(e).then(t):this._send(e)}internalRequest(e){return super.request(e)}request(e){if(this.mobileAdapter){const t=this.handleStaticRequests(e,(()=>this.mobileAdapter.request(e)));return t instanceof Promise?t:Promise.resolve(t)}return this.handleStaticRequests(e,(()=>this.internalRequest(e)))}handleStaticRequests(e,t){switch(e.method){case"net_version":return XB(this,KB)?parseInt(XB(this,KB)):void 0;case"eth_chainId":return XB(this,KB);case"eth_accounts":case"eth_coinbase":return XB(this,GB)?[XB(this,GB)]:[]}if(t)return t()}onResponseReady(e,t){var r,n,i,o;if(t)switch(e.method){case"eth_requestAccounts":case"requestAccounts":eI(this,GB,t[0]);break;case"wallet_requestPermissions":eI(this,GB,null==(o=null==(i=null==(n=null==(r=t[0])?void 0:r.caveats)?void 0:n[0])?void 0:i.value)?void 0:o[0])}}getNetwork(){return tI.NETWORK}get connected(){return!0}get isMetaMask(){return XB(this,ZB)}getChainId(){return XB(this,KB)}getNetworkVersion(){return this.handleStaticRequests({method:"net_version "})}setChainId(e){eI(this,KB,e)}setRPCUrl(e){eI(this,WB,e),eI(this,JB,new qB(XB(this,WB)))}getRPC(){return XB(this,JB)}setOverwriteMetamask(e){eI(this,ZB,e)}getAddress(){return XB(this,GB)}setAddress(e){eI(this,GB,e)}setRPC(e){eI(this,JB,e)}};let rI=tI;KB=new WeakMap,WB=new WeakMap,VB=new WeakMap,ZB=new WeakMap,GB=new WeakMap,JB=new WeakMap,rI.NETWORK="ethereum";class nI{constructor(e){this.provider=e}async request(e,t){if("getKey"===e.method){const t=await this.provider.internalRequest({method:"requestAccounts",params:e.params}),r=JSON.parse(t);return{algo:"secp256k1",address:r.address,bech32Address:r.address,pubKey:C.from(r.pubKey,"hex")}}const r={signAmino:"signTransaction",signDirect:"signTransaction",signArbitrary:"signMessage",sendTx:"sendTransaction"};return r[e.method]?this.provider.internalRequest({method:r[e.method],params:e.params}):t()}}var iI,oI=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},sI=(e,t,r)=>(oI(e,t,"read from private field"),r?r.call(e):t.get(e));const aI=class extends He{constructor(e){super(),((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)})(this,iI,!1),this.isKeplr=!0,this.isTrust=!0,this.isTrustWallet=!0,e&&(typeof e.disableMobileAdapter<"u"&&((e,t,r,n)=>{oI(e,t,"write to private field"),n?n.call(e,r):t.set(e,r)})(this,iI,e.disableMobileAdapter),typeof e.isKeplr<"u"&&(this.isKeplr=e.isKeplr),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),sI(this,iI)||(this.mobileAdapter=new nI(this))}static bufferToHex(e){return"0x"+C.from(e).toString("hex")}getNetwork(){return aI.NETWORK}isMobileAdapterEnabled(){return!sI(this,iI)}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=C.from(t).toString("base64"),i=await this.request({method:"sendTx",params:{raw:n,chainId:e,mode:r}});return new Uint8Array(C.from(i,"hex"))}async signArbitrary(e,t,r){const n=C.from(r),i=aI.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:o}=JSON.parse(n);return{signed:i,signature:o}}async signDirect(e,t,r){const n={bodyBytes:aI.bufferToHex(r.bodyBytes),authInfoBytes:aI.bufferToHex(r.authInfoBytes)},i=await this.request({method:"signDirect",params:{signerAddress:t,chainId:e,sign_doc:n}}),{signature:o}=JSON.parse(i);return{signed:r,signature:o}}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 cI=aI;iI=new WeakMap,cI.NETWORK="cosmos";var uI,hI={exports:{}},lI="object"==typeof Reflect?Reflect:null,fI=lI&&"function"==typeof lI.apply?lI.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};uI=lI&&"function"==typeof lI.ownKeys?lI.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var dI=Number.isNaN||function(e){return e!=e};function pI(){pI.init.call(this)}hI.exports=pI,hI.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}AI(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&AI(e,"error",t,r)}(e,i,{once:!0})}))},pI.EventEmitter=pI,pI.prototype._events=void 0,pI.prototype._eventsCount=0,pI.prototype._maxListeners=void 0;var gI=10;function yI(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function mI(e){return void 0===e._maxListeners?pI.defaultMaxListeners:e._maxListeners}function wI(e,t,r,n){var i,o,s;if(yI(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=mI(e))>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function bI(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function vI(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=bI.bind(n);return i.listener=r,n.wrapFn=i,i}function _I(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)fI(a,this,t);else{var c=a.length,u=SI(a,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},pI.prototype.listeners=function(e){return _I(this,e,!0)},pI.prototype.rawListeners=function(e){return _I(this,e,!1)},pI.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):EI.call(e,t)},pI.prototype.listenerCount=EI,pI.prototype.eventNames=function(){return this._eventsCount>0?uI(this._events):[]};const xI="CALLBACK";class kI extends hI.exports.EventEmitter{setAdapter(e){return this.adapter=e,this}async request(e){try{if(!this.adapter)throw new Error("No adapter set, maybe you forgot to register the provider?");const t=await this.adapter.request(e,this.getNetwork());return this.emit("onResponseReady",e,t),t}catch(e){throw e}}sendResponse(e,t){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==xI)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendResponse(e,t)}sendError(e,t){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==xI)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendError(e,t)}}const BI=class extends kI{constructor(e){super(),this._isConnected=!1,this.chainId=null,this.address=null,e&&e.network&&(this._network=e.network,e.chainId&&(this.chainId=e.chainId))}static bufferToHex(e){return"0x"+C.from(e).toString("hex")}static messageToBuffer(e){let t=C.from([]);try{t="string"==typeof e?C.from(e.replace("0x",""),"hex"):C.from(e)}catch(e){console.log(`messageToBuffer error: ${e}`)}return t}setConfig(e){this._network=e.network,this.address=e.address,this.chainId=e.chainId}async connect(){const e=await this.account();return this._isConnected=!0,this.emit("connect"),e}disconnect(){this._isConnected=!1,this.emit("disconnect")}isConnected(){return this._isConnected}async account(){const e=await this.request({method:"requestAccounts",params:{}});return JSON.parse(e)}network(){return this._network}getNetwork(){return BI.NETWORK}async signMessage(e){const t="APTOS",r=(await this.account()).address;let n=t;const i=window.location.protocol+"//"+window.location.hostname;e.address&&(n+="\naddress: "+r),e.application&&(n+="\napplication: "+i),e.chainId&&(n+="\nchainId: "+this.chainId),n+="\nmessage: "+e.message,n+="\nnonce: "+e.nonce;const o=C.from(n),s=BI.bufferToHex(o);return this.request({method:"signMessage",params:{data:s}}).then((o=>({address:r,application:i,chainId:this.chainId,fullMessage:n,message:e.message,nonce:e.nonce,prefix:t,signature:o})))}async signAndSubmitTransaction(e){const t=await this.signTransaction(e),r=await this.request({method:"sendTransaction",params:{tx:t}});return{hash:BI.messageToBuffer(r).toString()}}async signTransaction(e){const t=await this.request({method:"signTransaction",params:{data:e}});return JSON.parse(BI.messageToBuffer(t).toString())}};let II=BI;II.NETWORK="aptos";var TI=Object.defineProperty,RI=Object.defineProperties,OI=Object.getOwnPropertyDescriptors,LI=Object.getOwnPropertySymbols,MI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,PI=(e,t,r)=>t in e?TI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,NI=(e,t)=>{for(var r in t||(t={}))MI.call(t,r)&&PI(e,r,t[r]);if(LI)for(var r of LI(t))CI.call(t,r)&&PI(e,r,t[r]);return e},UI=(e,t)=>{var r={};for(var n in e)MI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&LI)for(var n of LI(e))t.indexOf(n)<0&&CI.call(e,n)&&(r[n]=e[n]);return r};class jI{constructor(e){this.provider=e}static mapToCamelCase(e){return NI(NI({},e),null!=e&&e.messages?{messages:(e?.messages||[]).map((e=>{var t=e,{state_init:r}=t,n=UI(t,["state_init"]);return((e,t)=>RI(e,OI(t)))(NI({},n),{stateInit:r})}))}:{})}async request(e,t){switch(e){case"tonConnect_connect":{const e=await this.provider.internalRequest("requestAccounts",t);return JSON.parse(e).map((e=>"ton_addr"===e.name?UI(e,["nonBounceable"]):e))}case"tonConnect_reconnect":{const e=await this.provider.internalRequest("tonConnect_reconnect",t);return JSON.parse(e)}case"ton_rawSign":return this.provider.internalRequest("signMessage",t);case"ton_sendTransaction":case"tonConnect_sendTransaction":{const r=await this.provider.internalRequest("signTransaction",jI.mapToCamelCase(t[0])),{nonce:n,hash:i}=JSON.parse(r);return"ton_sendTransaction"===e?n:i}case"ton_requestAccounts":{const e=await this.provider.internalRequest("requestAccounts",t),[{nonBounceable:r}]=JSON.parse(e);return[r]}case"ton_requestWallets":{const e=await this.provider.internalRequest("requestAccounts",t),[{nonBounceable:r,publicKey:n}]=JSON.parse(e);return[{address:r,publicKey:n,version:this.provider.version}]}default:return this.provider.internalRequest(e,t)}}}const $I=class extends He{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),null!=e&&e.disableMobileAdapter||(this.mobileAdapter=new jI(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){return this.mobileAdapter?await this.mobileAdapter.request(e,t):await(()=>this.internalRequest(e,t))()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return $I.NETWORK}};let HI=$I;HI.NETWORK="ton";class zI extends Error{constructor(e,t){super(e),this.code=t}}const DI=e=>{var t;return{event:"connect_error",payload:{code:null!=(t=e.code)?t:0,message:e.message}}};class FI{constructor(e,t){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=e=>(this.callbacks.push(e),()=>{this.callbacks=this.callbacks.filter((t=>t!=e))}),e&&(typeof e.isWalletBrowser<"u"&&(this.isWalletBrowser=e.isWalletBrowser),e.walletInfo&&(this.walletInfo=e.walletInfo),e.deviceInfo&&(this.deviceInfo=e.deviceInfo)),this.provider=t}async connect(e,t){e>this.protocolVersion&&new zI("Unsupported protocol version",1);const r=await this.provider.send("tonConnect_connect",t);return"connect_error"===r?.event?this.emit(r):this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(e){return this.callbacks.forEach((t=>t(e))),e}async restoreConnection(){var e;try{const e=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:e,device:this.deviceInfo}})}catch(t){return t instanceof zI?this.emit(DI(t)):this.emit(DI(new zI(null!=(e=t.message)?e:"Unknown error")))}}async send(e){try{return{result:await this.provider.send(`tonConnect_${e.method}`,e.params.map((e=>JSON.parse(e)))),id:e.id.toString()}}catch(t){return{error:t,id:String(e.id)}}}}window.trustwallet={core:(e,t)=>new ze({strategy:e,handler:t}),solana:e=>new yh(e),cosmos:e=>new cI(e),ethereum:e=>new rI(e),aptos:e=>new II(e),ton:e=>new HI(e),tonBridge:(e,t)=>new FI(e,t),randomUUID:()=>y()}})); +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=Jk,r=pk;e.isBytes=function(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name};e.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);e.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));e.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);e.rotr=(e,t)=>e<<32-t|e>>>t;e.rotl=(e,t)=>e<>>32-t>>>0,e.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];e.byteSwap=e=>e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255,e.byteSwapIfBE=e.isLE?e=>e:t=>(0,e.byteSwap)(t),e.byteSwap32=function(t){for(let r=0;rt.toString(16).padStart(2,"0")));e.bytesToHex=function(e){(0,r.bytes)(e);let t="";for(let r=0;r=i&&e<=o?e-i:e>=s&&e<=a?e-(s-10):e>=c&&e<=u?e-(c-10):void 0}e.hexToBytes=function(e){if("string"!=typeof e)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 t=0,i=0;t{},e.asyncLoop=async function(t,r,n){let i=Date.now();for(let o=0;o=0&&te().update(f(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t},e.wrapConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.wrapXOFConstructorWithOpts=function(e){const t=(t,r)=>e(r).update(f(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t},e.randomBytes=function(e=32){if(t.crypto&&"function"==typeof t.crypto.getRandomValues)return t.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}(Gk),Object.defineProperty(dk,"__esModule",{value:!0}),dk.shake256=dk.shake128=dk.keccak_512=dk.keccak_384=dk.keccak_256=dk.keccak_224=dk.sha3_512=dk.sha3_384=dk.sha3_256=dk.sha3_224=dk.Keccak=dk.keccakP=void 0;const Yk=pk,Xk=Sk,Qk=Gk,eB=[],tB=[],rB=[],nB=BigInt(0),iB=BigInt(1),oB=BigInt(2),sB=BigInt(7),aB=BigInt(256),cB=BigInt(113);for(let e=0,t=iB,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],eB.push(2*(5*n+r)),tB.push((e+1)*(e+2)/2%64);let i=nB;for(let e=0;e<7;e++)t=(t<>sB)*cB)%aB,t&oB&&(i^=iB<<(iB<r>32?(0,Xk.rotlBH)(e,t,r):(0,Xk.rotlSH)(e,t,r),fB=(e,t,r)=>r>32?(0,Xk.rotlBL)(e,t,r):(0,Xk.rotlSL)(e,t,r);function dB(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],s=r[i+1],a=lB(o,s,1)^r[n],c=fB(o,s,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=tB[r],o=lB(t,i,n),s=fB(t,i,n),a=eB[r];t=e[a],i=e[a+1],e[a]=o,e[a+1]=s}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=uB[n],e[1]^=hB[n]}r.fill(0)}dk.keccakP=dB;class pB extends Qk.Hash{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,Yk.number)(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,Qk.u32)(this.state)}keccak(){Qk.isLE||(0,Qk.byteSwap32)(this.state32),dB(this.state32,this.rounds),Qk.isLE||(0,Qk.byteSwap32)(this.state32),this.posOut=0,this.pos=0}update(e){(0,Yk.exists)(this);const{blockLen:t,state:r}=this,n=(e=(0,Qk.toBytes)(e)).length;for(let i=0;i=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,Yk.number)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,Yk.output)(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){const{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:o}=this;return e||(e=new pB(t,r,n,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=o,e.destroyed=this.destroyed,e}}dk.Keccak=pB;const gB=(e,t,r)=>(0,Qk.wrapConstructor)((()=>new pB(t,e,r)));dk.sha3_224=gB(6,144,28),dk.sha3_256=gB(6,136,32),dk.sha3_384=gB(6,104,48),dk.sha3_512=gB(6,72,64),dk.keccak_224=gB(1,144,28),dk.keccak_256=gB(1,136,32),dk.keccak_384=gB(1,104,48),dk.keccak_512=gB(1,72,64);const yB=(e,t,r)=>(0,Qk.wrapXOFConstructorWithOpts)(((n={})=>new pB(t,e,void 0===n.dkLen?r:n.dkLen,!0)));dk.shake128=yB(31,168,16),dk.shake256=yB(31,136,32);var mB={exports:{}};!function(e,t){var r=Cr&&Cr.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.crypto=t.utf8ToBytes=t.createView=t.concatBytes=t.toHex=t.bytesToHex=t.assertBytes=t.assertBool=void 0,t.bytesToUtf8=function(e){if(!(e instanceof Uint8Array))throw new TypeError("bytesToUtf8 expected Uint8Array, got "+typeof e);return(new TextDecoder).decode(e)},t.hexToBytes=function(e){const t=e.startsWith("0x")?e.substring(2):e;return(0,i.hexToBytes)(t)},t.equalsBytes=function(e,t){if(e.length!==t.length)return!1;for(let r=0;r(n.default.bytes(t),e(t))};const n=r(pk),i=Gk,o=n.default.bool;t.assertBool=o;const s=n.default.bytes;t.assertBytes=s;var a=Gk;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}}),t.crypto=(()=>{const t="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,r=yd.bind(e);return{node:r&&!t?r("crypto"):void 0,web:t}})()}(mB,mB.exports),Object.defineProperty(fk,"__esModule",{value:!0}),fk.keccak512=fk.keccak384=fk.keccak256=fk.keccak224=void 0;const wB=dk,bB=mB.exports;fk.keccak224=(0,bB.wrapHash)(wB.keccak_224),fk.keccak256=(()=>{const e=(0,bB.wrapHash)(wB.keccak_256);return e.create=wB.keccak_256.create,e})(),fk.keccak384=(0,bB.wrapHash)(wB.keccak_384),fk.keccak512=(0,bB.wrapHash)(wB.keccak_512),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=bh,r=Mx,n=ck(),i=zx,o=tv,s=fk,a=ev;var c;function u(e,t){if(!Object.keys(c).includes(e))throw new Error(`Invalid version: '${e}'`);if(t&&!t.includes(e))throw new Error(`SignTypedDataVersion not allowed: '${e}'. Allowed versions are: ${t.join(", ")}`)}function h(e,t){(0,o.assert)(null!==t,`Unable to encode value: Invalid number. Expected a valid number value, but received "${t}".`);const r=BigInt(t),i=(0,n.getLength)(e),s=BigInt(2)**BigInt(i)-BigInt(1);return(0,o.assert)(r>=-s&&r<=s,`Unable to encode value: Number "${t}" is out of range for type "${e}".`),r}function l(e){let t=BigInt(0);for(let r=0;r=49?n-BigInt(49)+BigInt(10):n>=17?n-BigInt(17)+BigInt(10):n}return(0,i.padStart)((0,o.bigIntToBytes)(t),20)}function f(e,n,a,p,g){if(u(g,[c.V3,c.V4]),void 0!==e[a])return["bytes32",g===c.V4&&null==p?"0x0000000000000000000000000000000000000000000000000000000000000000":(0,t.arrToBufArr)((0,s.keccak256)(d(a,p,e,g)))];if("function"===a)throw new Error('Unsupported or invalid type: "function"');if(void 0===p)throw new Error(`missing value for field ${n} of type ${a}`);if("address"===a){if("number"==typeof p)return["address",(0,i.padStart)((0,o.numberToBytes)(p),20)];if((0,o.isStrictHexString)(p))return["address",(0,o.add0x)(p)];if("string"==typeof p)return["address",l(p).subarray(0,20)]}if("bool"===a)return["bool",Boolean(p)];if("bytes"===a)return"number"==typeof p?p=(0,o.numberToBytes)(p):(0,o.isStrictHexString)(p)||"0x"===p?p=(0,o.hexToBytes)(p):"string"==typeof p&&(p=(0,o.stringToBytes)(p)),["bytes32",(0,t.arrToBufArr)((0,s.keccak256)(p))];if(a.startsWith("bytes")&&"bytes"!==a&&!a.includes("["))return"number"==typeof p?p<0?["bytes32",new Uint8Array(32)]:["bytes32",(0,o.bigIntToBytes)(BigInt(p))]:(0,o.isStrictHexString)(p)?["bytes32",(0,o.hexToBytes)(p)]:["bytes32",p];if(a.startsWith("int")&&!a.includes("[")){const e=h(a,p);return e>=BigInt(0)?["uint256",e]:["int256",e]}if("string"===a)return p="number"==typeof p?(0,o.numberToBytes)(p):(0,o.stringToBytes)(null!=p?p:""),["bytes32",(0,t.arrToBufArr)((0,s.keccak256)(p))];if(a.endsWith("]")){if(g===c.V3)throw new Error("Arrays are unimplemented in encodeData; use V4 extension");const i=a.slice(0,a.lastIndexOf("[")),o=p.map((t=>f(e,n,i,t,g)));return["bytes32",(0,t.arrToBufArr)((0,s.keccak256)((0,r.encode)(o.map((([e])=>e)),o.map((([,e])=>e)))))]}return[a,p]}function d(e,n,i,o){u(o,[c.V3,c.V4]);const s=["bytes32"],a=[m(e,i)];for(const t of i[e]){if(o===c.V3&&void 0===n[t.name])continue;const[e,r]=f(i,t.name,t.type,n[t.name],o);s.push(e),a.push(r)}return(0,t.arrToBufArr)((0,r.encode)(s,a))}function p(e,t){let r="";const n=g(e,t);n.delete(e);const i=[e,...Array.from(n).sort()];for(const e of i){if(!t[e])throw new Error(`No type definition specified: ${e}`);r+=`${e}(${t[e].map((({name:e,type:t})=>`${t} ${e}`)).join(",")})`}return r}function g(e,t,r=new Set){if("string"!=typeof e)throw new Error(`Invalid findTypeDependencies input ${JSON.stringify(e)}`);const n=e.match(/^\w*/u);if([e]=n,r.has(e)||void 0===t[e])return r;r.add(e);for(const n of t[e])g(n.type,t,r);return r}function y(e,r,n,i){u(i,[c.V3,c.V4]);const o=d(e,r,n,i),a=(0,s.keccak256)(o);return(0,t.arrToBufArr)(a)}function m(e,r){const n=(0,o.stringToBytes)(p(e,r));return(0,t.arrToBufArr)((0,s.keccak256)(n))}function w(t){const r={};for(const n in e.TYPED_MESSAGE_SCHEMA.properties)t[n]&&(r[n]=t[n]);return"types"in r&&(r.types=Object.assign({EIP712Domain:[]},r.types)),r}function b(e,t){u(t,[c.V3,c.V4]);const r=w(e),{domain:n}=r;return y("EIP712Domain",n,{EIP712Domain:r.types.EIP712Domain},t)}function v(e,t){if((0,n.isArrayType)(e)&&Array.isArray(t)){const[r]=(0,n.getArrayType)(e);return t.map((e=>v(r,e)))}if("address"===e){if("number"==typeof t)return(0,i.padStart)((0,o.numberToBytes)(t),20);if((0,o.isStrictHexString)(t))return(0,i.padStart)((0,o.hexToBytes)(t).subarray(0,20),20);if(t instanceof Uint8Array)return(0,i.padStart)(t.subarray(0,20),20)}if("bool"===e)return Boolean(t);if(e.startsWith("bytes")&&"bytes"!==e){const r=(0,n.getByteLength)(e);if("number"==typeof t)return t<0?new Uint8Array:(0,o.numberToBytes)(t).subarray(0,r);if((0,o.isStrictHexString)(t))return(0,o.hexToBytes)(t).subarray(0,r);if(t instanceof Uint8Array)return t.subarray(0,r)}if(e.startsWith("uint")&&"number"==typeof t)return Math.abs(t);if(e.startsWith("int")&&"number"==typeof t){const r=(0,n.getLength)(e);return BigInt.asIntN(r,BigInt(t))}return t}function _(e,t){return t.map((t=>{if("string"==typeof t||"number"==typeof t||"bigint"==typeof t){const r=h(e,t);if(r>=BigInt(0))return(0,i.padStart)((0,o.bigIntToBytes)(r),32);const s=(0,n.getLength)(e),a=BigInt.asIntN(s,r);return(0,o.signedBigIntToBytes)(a,32)}return t}))}function E(e){const c=new Error("Expect argument to be non-empty array");if("object"!=typeof e||!("length"in e)||!e.length)throw c;const u=e.map((({name:e,type:t,value:r})=>{if("address[]"===t)return{name:e,type:"bytes32[]",value:(s=r,s.map((e=>"number"==typeof e?(0,i.padStart)((0,o.numberToBytes)(e),32):(0,o.isStrictHexString)(e)?(0,i.padStart)((0,o.hexToBytes)(e).subarray(0,32),32):e instanceof Uint8Array?(0,i.padStart)(e.subarray(0,32),32):e)))};var s;if(t.startsWith("int")&&(0,n.isArrayType)(t)){const[i,o]=(0,n.getArrayType)(t);return{name:e,type:`bytes32[${null!=o?o:""}]`,value:_(i,r)}}return{name:e,type:t,value:v(t,r)}})),h=u.map((e=>"bytes"!==e.type?e.value:(0,a.legacyToBuffer)(e.value))),l=u.map((e=>{if("function"===e.type)throw new Error('Unsupported or invalid type: "function"');return e.type})),f=e.map((e=>{if(!e.name)throw c;return`${e.type} ${e.name}`}));return(0,t.arrToBufArr)((0,s.keccak256)((0,r.encodePacked)(["bytes32","bytes32"],[(0,s.keccak256)((0,r.encodePacked)(["string[]"],[f],!0)),(0,s.keccak256)((0,r.encodePacked)(l,h,!0))])))}!function(e){e.V1="V1",e.V3="V3",e.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"]},e.TypedDataUtils={encodeData:d,encodeType:p,findTypeDependencies:g,hashStruct:y,hashType:m,sanitizeData:w,eip712Hash:function(e,r){u(r,[c.V3,c.V4]);const n=w(e),i=[(0,o.hexToBytes)("1901")];return i.push(b(e,r)),"EIP712Domain"!==n.primaryType&&i.push(y(n.primaryType,n.message,n.types,r)),(0,t.arrToBufArr)((0,s.keccak256)((0,o.concatBytes)(i)))},eip712DomainHash:b},e.typedSignatureHash=function(e){const t=E(e);return(0,o.bytesToHex)(t)},e.signTypedData=function({privateKey:r,data:n,version:i}){if(u(i),(0,a.isNullish)(n))throw new Error("Missing data parameter");if((0,a.isNullish)(r))throw new Error("Missing private key parameter");const s=i===c.V1?E(n):e.TypedDataUtils.eip712Hash(n,i),h=(0,t.ecsign)(s,r);return(0,a.concatSig)((0,t.arrToBufArr)((0,o.bigIntToBytes)(h.v)),h.r,h.s)},e.recoverTypedSignature=function({data:r,signature:n,version:i}){if(u(i),(0,a.isNullish)(r))throw new Error("Missing data parameter");if((0,a.isNullish)(n))throw new Error("Missing signature parameter");const s=i===c.V1?E(r):e.TypedDataUtils.eip712Hash(r,i),h=(0,a.recoverPublicKey)(s,n),l=(0,t.publicToAddress)(h);return(0,o.bytesToHex)(l)}}(Lx);var vB={},_B={exports:{}},EB=Pr(Object.freeze({__proto__:null,default:{}}));!function(e){!function(e){var t=function(e){var t,r=new Float64Array(16);if(e)for(t=0;t>24&255,e[t+1]=r>>16&255,e[t+2]=r>>8&255,e[t+3]=255&r,e[t+4]=n>>24&255,e[t+5]=n>>16&255,e[t+6]=n>>8&255,e[t+7]=255&n}function p(e,t,r,n,i){var o,s=0;for(o=0;o>>8)-1}function g(e,t,r,n){return p(e,t,r,n,16)}function y(e,t,r,n){return p(e,t,r,n,32)}function m(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=o,E=s,S=a,A=c,x=u,k=h,B=l,I=f,T=d,R=p,O=g,L=y,M=m,C=w,P=b,N=v,U=0;U<20;U+=2)_^=(i=(M^=(i=(T^=(i=(x^=(i=_+M|0)<<7|i>>>25)+_|0)<<9|i>>>23)+x|0)<<13|i>>>19)+T|0)<<18|i>>>14,k^=(i=(E^=(i=(C^=(i=(R^=(i=k+E|0)<<7|i>>>25)+k|0)<<9|i>>>23)+R|0)<<13|i>>>19)+C|0)<<18|i>>>14,O^=(i=(B^=(i=(S^=(i=(P^=(i=O+B|0)<<7|i>>>25)+O|0)<<9|i>>>23)+P|0)<<13|i>>>19)+S|0)<<18|i>>>14,N^=(i=(L^=(i=(I^=(i=(A^=(i=N+L|0)<<7|i>>>25)+N|0)<<9|i>>>23)+A|0)<<13|i>>>19)+I|0)<<18|i>>>14,_^=(i=(A^=(i=(S^=(i=(E^=(i=_+A|0)<<7|i>>>25)+_|0)<<9|i>>>23)+E|0)<<13|i>>>19)+S|0)<<18|i>>>14,k^=(i=(x^=(i=(I^=(i=(B^=(i=k+x|0)<<7|i>>>25)+k|0)<<9|i>>>23)+B|0)<<13|i>>>19)+I|0)<<18|i>>>14,O^=(i=(R^=(i=(T^=(i=(L^=(i=O+R|0)<<7|i>>>25)+O|0)<<9|i>>>23)+L|0)<<13|i>>>19)+T|0)<<18|i>>>14,N^=(i=(P^=(i=(C^=(i=(M^=(i=N+P|0)<<7|i>>>25)+N|0)<<9|i>>>23)+M|0)<<13|i>>>19)+C|0)<<18|i>>>14;_=_+o|0,E=E+s|0,S=S+a|0,A=A+c|0,x=x+u|0,k=k+h|0,B=B+l|0,I=I+f|0,T=T+d|0,R=R+p|0,O=O+g|0,L=L+y|0,M=M+m|0,C=C+w|0,P=P+b|0,N=N+v|0,e[0]=_>>>0&255,e[1]=_>>>8&255,e[2]=_>>>16&255,e[3]=_>>>24&255,e[4]=E>>>0&255,e[5]=E>>>8&255,e[6]=E>>>16&255,e[7]=E>>>24&255,e[8]=S>>>0&255,e[9]=S>>>8&255,e[10]=S>>>16&255,e[11]=S>>>24&255,e[12]=A>>>0&255,e[13]=A>>>8&255,e[14]=A>>>16&255,e[15]=A>>>24&255,e[16]=x>>>0&255,e[17]=x>>>8&255,e[18]=x>>>16&255,e[19]=x>>>24&255,e[20]=k>>>0&255,e[21]=k>>>8&255,e[22]=k>>>16&255,e[23]=k>>>24&255,e[24]=B>>>0&255,e[25]=B>>>8&255,e[26]=B>>>16&255,e[27]=B>>>24&255,e[28]=I>>>0&255,e[29]=I>>>8&255,e[30]=I>>>16&255,e[31]=I>>>24&255,e[32]=T>>>0&255,e[33]=T>>>8&255,e[34]=T>>>16&255,e[35]=T>>>24&255,e[36]=R>>>0&255,e[37]=R>>>8&255,e[38]=R>>>16&255,e[39]=R>>>24&255,e[40]=O>>>0&255,e[41]=O>>>8&255,e[42]=O>>>16&255,e[43]=O>>>24&255,e[44]=L>>>0&255,e[45]=L>>>8&255,e[46]=L>>>16&255,e[47]=L>>>24&255,e[48]=M>>>0&255,e[49]=M>>>8&255,e[50]=M>>>16&255,e[51]=M>>>24&255,e[52]=C>>>0&255,e[53]=C>>>8&255,e[54]=C>>>16&255,e[55]=C>>>24&255,e[56]=P>>>0&255,e[57]=P>>>8&255,e[58]=P>>>16&255,e[59]=P>>>24&255,e[60]=N>>>0&255,e[61]=N>>>8&255,e[62]=N>>>16&255,e[63]=N>>>24&255}(e,t,r,n)}function w(e,t,r,n){!function(e,t,r,n){for(var i,o=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,s=255&r[0]|(255&r[1])<<8|(255&r[2])<<16|(255&r[3])<<24,a=255&r[4]|(255&r[5])<<8|(255&r[6])<<16|(255&r[7])<<24,c=255&r[8]|(255&r[9])<<8|(255&r[10])<<16|(255&r[11])<<24,u=255&r[12]|(255&r[13])<<8|(255&r[14])<<16|(255&r[15])<<24,h=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,l=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,f=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,d=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,p=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,g=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,y=255&r[16]|(255&r[17])<<8|(255&r[18])<<16|(255&r[19])<<24,m=255&r[20]|(255&r[21])<<8|(255&r[22])<<16|(255&r[23])<<24,w=255&r[24]|(255&r[25])<<8|(255&r[26])<<16|(255&r[27])<<24,b=255&r[28]|(255&r[29])<<8|(255&r[30])<<16|(255&r[31])<<24,v=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,_=0;_<20;_+=2)o^=(i=(m^=(i=(d^=(i=(u^=(i=o+m|0)<<7|i>>>25)+o|0)<<9|i>>>23)+u|0)<<13|i>>>19)+d|0)<<18|i>>>14,h^=(i=(s^=(i=(w^=(i=(p^=(i=h+s|0)<<7|i>>>25)+h|0)<<9|i>>>23)+p|0)<<13|i>>>19)+w|0)<<18|i>>>14,g^=(i=(l^=(i=(a^=(i=(b^=(i=g+l|0)<<7|i>>>25)+g|0)<<9|i>>>23)+b|0)<<13|i>>>19)+a|0)<<18|i>>>14,v^=(i=(y^=(i=(f^=(i=(c^=(i=v+y|0)<<7|i>>>25)+v|0)<<9|i>>>23)+c|0)<<13|i>>>19)+f|0)<<18|i>>>14,o^=(i=(c^=(i=(a^=(i=(s^=(i=o+c|0)<<7|i>>>25)+o|0)<<9|i>>>23)+s|0)<<13|i>>>19)+a|0)<<18|i>>>14,h^=(i=(u^=(i=(f^=(i=(l^=(i=h+u|0)<<7|i>>>25)+h|0)<<9|i>>>23)+l|0)<<13|i>>>19)+f|0)<<18|i>>>14,g^=(i=(p^=(i=(d^=(i=(y^=(i=g+p|0)<<7|i>>>25)+g|0)<<9|i>>>23)+y|0)<<13|i>>>19)+d|0)<<18|i>>>14,v^=(i=(b^=(i=(w^=(i=(m^=(i=v+b|0)<<7|i>>>25)+v|0)<<9|i>>>23)+m|0)<<13|i>>>19)+w|0)<<18|i>>>14;e[0]=o>>>0&255,e[1]=o>>>8&255,e[2]=o>>>16&255,e[3]=o>>>24&255,e[4]=h>>>0&255,e[5]=h>>>8&255,e[6]=h>>>16&255,e[7]=h>>>24&255,e[8]=g>>>0&255,e[9]=g>>>8&255,e[10]=g>>>16&255,e[11]=g>>>24&255,e[12]=v>>>0&255,e[13]=v>>>8&255,e[14]=v>>>16&255,e[15]=v>>>24&255,e[16]=l>>>0&255,e[17]=l>>>8&255,e[18]=l>>>16&255,e[19]=l>>>24&255,e[20]=f>>>0&255,e[21]=f>>>8&255,e[22]=f>>>16&255,e[23]=f>>>24&255,e[24]=d>>>0&255,e[25]=d>>>8&255,e[26]=d>>>16&255,e[27]=d>>>24&255,e[28]=p>>>0&255,e[29]=p>>>8&255,e[30]=p>>>16&255,e[31]=p>>>24&255}(e,t,r,n)}var b=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function v(e,t,r,n,i,o,s){var a,c,u=new Uint8Array(16),h=new Uint8Array(64);for(c=0;c<16;c++)u[c]=0;for(c=0;c<8;c++)u[c]=o[c];for(;i>=64;){for(m(h,u,s,b),c=0;c<64;c++)e[t+c]=r[n+c]^h[c];for(a=1,c=8;c<16;c++)a=a+(255&u[c])|0,u[c]=255&a,a>>>=8;i-=64,t+=64,n+=64}if(i>0)for(m(h,u,s,b),c=0;c=64;){for(m(c,a,i,b),s=0;s<64;s++)e[t+s]=c[s];for(o=1,s=8;s<16;s++)o=o+(255&a[s])|0,a[s]=255&o,o>>>=8;r-=64,t+=64}if(r>0)for(m(c,a,i,b),s=0;s>>13|r<<3),n=255&e[4]|(255&e[5])<<8,this.r[2]=7939&(r>>>10|n<<6),i=255&e[6]|(255&e[7])<<8,this.r[3]=8191&(n>>>7|i<<9),o=255&e[8]|(255&e[9])<<8,this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,s=255&e[10]|(255&e[11])<<8,this.r[6]=8191&(o>>>14|s<<2),a=255&e[12]|(255&e[13])<<8,this.r[7]=8065&(s>>>11|a<<5),c=255&e[14]|(255&e[15])<<8,this.r[8]=8191&(a>>>8|c<<8),this.r[9]=c>>>5&127,this.pad[0]=255&e[16]|(255&e[17])<<8,this.pad[1]=255&e[18]|(255&e[19])<<8,this.pad[2]=255&e[20]|(255&e[21])<<8,this.pad[3]=255&e[22]|(255&e[23])<<8,this.pad[4]=255&e[24]|(255&e[25])<<8,this.pad[5]=255&e[26]|(255&e[27])<<8,this.pad[6]=255&e[28]|(255&e[29])<<8,this.pad[7]=255&e[30]|(255&e[31])<<8};function x(e,t,r,n,i,o){var s=new A(o);return s.update(r,n,i),s.finish(e,t),0}function k(e,t,r,n,i,o){var s=new Uint8Array(16);return x(s,0,r,n,i,o),g(e,t,s,0)}function B(e,t,r,n,i){var o;if(r<32)return-1;for(S(e,0,t,0,r,n,i),x(e,16,e,32,r-32,e),o=0;o<16;o++)e[o]=0;return 0}function I(e,t,r,n,i){var o,s=new Uint8Array(32);if(r<32)return-1;if(E(s,0,32,n,i),0!==k(t,16,t,32,r-32,s))return-1;for(S(e,0,t,0,r,n,i),o=0;o<32;o++)e[o]=0;return 0}function T(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function R(e){var t,r,n=1;for(t=0;t<16;t++)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function O(e,t,r){for(var n,i=~(r-1),o=0;o<16;o++)n=i&(e[o]^t[o]),e[o]^=n,t[o]^=n}function L(e,r){var n,i,o,s=t(),a=t();for(n=0;n<16;n++)a[n]=r[n];for(R(a),R(a),R(a),i=0;i<2;i++){for(s[0]=a[0]-65517,n=1;n<15;n++)s[n]=a[n]-65535-(s[n-1]>>16&1),s[n-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),o=s[15]>>16&1,s[14]&=65535,O(a,s,1-o)}for(n=0;n<16;n++)e[2*n]=255&a[n],e[2*n+1]=a[n]>>8}function M(e,t){var r=new Uint8Array(32),n=new Uint8Array(32);return L(r,e),L(n,t),y(r,0,n,0)}function C(e){var t=new Uint8Array(32);return L(t,e),1&t[0]}function P(e,t){var r;for(r=0;r<16;r++)e[r]=t[2*r]+(t[2*r+1]<<8);e[15]&=32767}function N(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]+r[n]}function U(e,t,r){for(var n=0;n<16;n++)e[n]=t[n]-r[n]}function j(e,t,r){var n,i,o=0,s=0,a=0,c=0,u=0,h=0,l=0,f=0,d=0,p=0,g=0,y=0,m=0,w=0,b=0,v=0,_=0,E=0,S=0,A=0,x=0,k=0,B=0,I=0,T=0,R=0,O=0,L=0,M=0,C=0,P=0,N=r[0],U=r[1],j=r[2],$=r[3],H=r[4],z=r[5],D=r[6],F=r[7],q=r[8],K=r[9],W=r[10],V=r[11],Z=r[12],G=r[13],J=r[14],Y=r[15];o+=(n=t[0])*N,s+=n*U,a+=n*j,c+=n*$,u+=n*H,h+=n*z,l+=n*D,f+=n*F,d+=n*q,p+=n*K,g+=n*W,y+=n*V,m+=n*Z,w+=n*G,b+=n*J,v+=n*Y,s+=(n=t[1])*N,a+=n*U,c+=n*j,u+=n*$,h+=n*H,l+=n*z,f+=n*D,d+=n*F,p+=n*q,g+=n*K,y+=n*W,m+=n*V,w+=n*Z,b+=n*G,v+=n*J,_+=n*Y,a+=(n=t[2])*N,c+=n*U,u+=n*j,h+=n*$,l+=n*H,f+=n*z,d+=n*D,p+=n*F,g+=n*q,y+=n*K,m+=n*W,w+=n*V,b+=n*Z,v+=n*G,_+=n*J,E+=n*Y,c+=(n=t[3])*N,u+=n*U,h+=n*j,l+=n*$,f+=n*H,d+=n*z,p+=n*D,g+=n*F,y+=n*q,m+=n*K,w+=n*W,b+=n*V,v+=n*Z,_+=n*G,E+=n*J,S+=n*Y,u+=(n=t[4])*N,h+=n*U,l+=n*j,f+=n*$,d+=n*H,p+=n*z,g+=n*D,y+=n*F,m+=n*q,w+=n*K,b+=n*W,v+=n*V,_+=n*Z,E+=n*G,S+=n*J,A+=n*Y,h+=(n=t[5])*N,l+=n*U,f+=n*j,d+=n*$,p+=n*H,g+=n*z,y+=n*D,m+=n*F,w+=n*q,b+=n*K,v+=n*W,_+=n*V,E+=n*Z,S+=n*G,A+=n*J,x+=n*Y,l+=(n=t[6])*N,f+=n*U,d+=n*j,p+=n*$,g+=n*H,y+=n*z,m+=n*D,w+=n*F,b+=n*q,v+=n*K,_+=n*W,E+=n*V,S+=n*Z,A+=n*G,x+=n*J,k+=n*Y,f+=(n=t[7])*N,d+=n*U,p+=n*j,g+=n*$,y+=n*H,m+=n*z,w+=n*D,b+=n*F,v+=n*q,_+=n*K,E+=n*W,S+=n*V,A+=n*Z,x+=n*G,k+=n*J,B+=n*Y,d+=(n=t[8])*N,p+=n*U,g+=n*j,y+=n*$,m+=n*H,w+=n*z,b+=n*D,v+=n*F,_+=n*q,E+=n*K,S+=n*W,A+=n*V,x+=n*Z,k+=n*G,B+=n*J,I+=n*Y,p+=(n=t[9])*N,g+=n*U,y+=n*j,m+=n*$,w+=n*H,b+=n*z,v+=n*D,_+=n*F,E+=n*q,S+=n*K,A+=n*W,x+=n*V,k+=n*Z,B+=n*G,I+=n*J,T+=n*Y,g+=(n=t[10])*N,y+=n*U,m+=n*j,w+=n*$,b+=n*H,v+=n*z,_+=n*D,E+=n*F,S+=n*q,A+=n*K,x+=n*W,k+=n*V,B+=n*Z,I+=n*G,T+=n*J,R+=n*Y,y+=(n=t[11])*N,m+=n*U,w+=n*j,b+=n*$,v+=n*H,_+=n*z,E+=n*D,S+=n*F,A+=n*q,x+=n*K,k+=n*W,B+=n*V,I+=n*Z,T+=n*G,R+=n*J,O+=n*Y,m+=(n=t[12])*N,w+=n*U,b+=n*j,v+=n*$,_+=n*H,E+=n*z,S+=n*D,A+=n*F,x+=n*q,k+=n*K,B+=n*W,I+=n*V,T+=n*Z,R+=n*G,O+=n*J,L+=n*Y,w+=(n=t[13])*N,b+=n*U,v+=n*j,_+=n*$,E+=n*H,S+=n*z,A+=n*D,x+=n*F,k+=n*q,B+=n*K,I+=n*W,T+=n*V,R+=n*Z,O+=n*G,L+=n*J,M+=n*Y,b+=(n=t[14])*N,v+=n*U,_+=n*j,E+=n*$,S+=n*H,A+=n*z,x+=n*D,k+=n*F,B+=n*q,I+=n*K,T+=n*W,R+=n*V,O+=n*Z,L+=n*G,M+=n*J,C+=n*Y,v+=(n=t[15])*N,s+=38*(E+=n*j),a+=38*(S+=n*$),c+=38*(A+=n*H),u+=38*(x+=n*z),h+=38*(k+=n*D),l+=38*(B+=n*F),f+=38*(I+=n*q),d+=38*(T+=n*K),p+=38*(R+=n*W),g+=38*(O+=n*V),y+=38*(L+=n*Z),m+=38*(M+=n*G),w+=38*(C+=n*J),b+=38*(P+=n*Y),o=(n=(o+=38*(_+=n*U))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=(o+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),s=(n=s+i+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),w=(n=w+i+65535)-65536*(i=Math.floor(n/65536)),b=(n=b+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),o+=i-1+37*(i-1),e[0]=o,e[1]=s,e[2]=a,e[3]=c,e[4]=u,e[5]=h,e[6]=l,e[7]=f,e[8]=d,e[9]=p,e[10]=g,e[11]=y,e[12]=m,e[13]=w,e[14]=b,e[15]=v}function $(e,t){j(e,t,t)}function H(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=253;n>=0;n--)$(i,i),2!==n&&4!==n&&j(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function z(e,r){var n,i=t();for(n=0;n<16;n++)i[n]=r[n];for(n=250;n>=0;n--)$(i,i),1!==n&&j(i,i,r);for(n=0;n<16;n++)e[n]=i[n]}function D(e,r,n){var i,o,s=new Uint8Array(32),c=new Float64Array(80),u=t(),h=t(),l=t(),f=t(),d=t(),p=t();for(o=0;o<31;o++)s[o]=r[o];for(s[31]=127&r[31]|64,s[0]&=248,P(c,n),o=0;o<16;o++)h[o]=c[o],f[o]=u[o]=l[o]=0;for(u[0]=f[0]=1,o=254;o>=0;--o)O(u,h,i=s[o>>>3]>>>(7&o)&1),O(l,f,i),N(d,u,l),U(u,u,l),N(l,h,f),U(h,h,f),$(f,d),$(p,u),j(u,l,u),j(l,h,d),N(d,u,l),U(u,u,l),$(h,u),U(l,f,p),j(u,l,a),N(u,u,f),j(l,l,u),j(u,f,p),j(f,h,c),$(h,d),O(u,h,i),O(l,f,i);for(o=0;o<16;o++)c[o+16]=u[o],c[o+32]=l[o],c[o+48]=h[o],c[o+64]=f[o];var g=c.subarray(32),y=c.subarray(16);return H(g,g),j(y,y,g),L(e,y),0}function F(e,t){return D(e,t,i)}function q(e,t){return r(t,32),F(e,t)}function K(e,t,r){var i=new Uint8Array(32);return D(i,r,t),w(e,n,i,b)}A.prototype.blocks=function(e,t,r){for(var n,i,o,s,a,c,u,h,l,f,d,p,g,y,m,w,b,v,_,E=this.fin?0:2048,S=this.h[0],A=this.h[1],x=this.h[2],k=this.h[3],B=this.h[4],I=this.h[5],T=this.h[6],R=this.h[7],O=this.h[8],L=this.h[9],M=this.r[0],C=this.r[1],P=this.r[2],N=this.r[3],U=this.r[4],j=this.r[5],$=this.r[6],H=this.r[7],z=this.r[8],D=this.r[9];r>=16;)f=l=0,f+=(S+=8191&(n=255&e[t+0]|(255&e[t+1])<<8))*M,f+=(A+=8191&(n>>>13|(i=255&e[t+2]|(255&e[t+3])<<8)<<3))*(5*D),f+=(x+=8191&(i>>>10|(o=255&e[t+4]|(255&e[t+5])<<8)<<6))*(5*z),f+=(k+=8191&(o>>>7|(s=255&e[t+6]|(255&e[t+7])<<8)<<9))*(5*H),l=(f+=(B+=8191&(s>>>4|(a=255&e[t+8]|(255&e[t+9])<<8)<<12))*(5*$))>>>13,f&=8191,f+=(I+=a>>>1&8191)*(5*j),f+=(T+=8191&(a>>>14|(c=255&e[t+10]|(255&e[t+11])<<8)<<2))*(5*U),f+=(R+=8191&(c>>>11|(u=255&e[t+12]|(255&e[t+13])<<8)<<5))*(5*N),f+=(O+=8191&(u>>>8|(h=255&e[t+14]|(255&e[t+15])<<8)<<8))*(5*P),d=l+=(f+=(L+=h>>>5|E)*(5*C))>>>13,d+=S*C,d+=A*M,d+=x*(5*D),d+=k*(5*z),l=(d+=B*(5*H))>>>13,d&=8191,d+=I*(5*$),d+=T*(5*j),d+=R*(5*U),d+=O*(5*N),l+=(d+=L*(5*P))>>>13,d&=8191,p=l,p+=S*P,p+=A*C,p+=x*M,p+=k*(5*D),l=(p+=B*(5*z))>>>13,p&=8191,p+=I*(5*H),p+=T*(5*$),p+=R*(5*j),p+=O*(5*U),g=l+=(p+=L*(5*N))>>>13,g+=S*N,g+=A*P,g+=x*C,g+=k*M,l=(g+=B*(5*D))>>>13,g&=8191,g+=I*(5*z),g+=T*(5*H),g+=R*(5*$),g+=O*(5*j),y=l+=(g+=L*(5*U))>>>13,y+=S*U,y+=A*N,y+=x*P,y+=k*C,l=(y+=B*M)>>>13,y&=8191,y+=I*(5*D),y+=T*(5*z),y+=R*(5*H),y+=O*(5*$),m=l+=(y+=L*(5*j))>>>13,m+=S*j,m+=A*U,m+=x*N,m+=k*P,l=(m+=B*C)>>>13,m&=8191,m+=I*M,m+=T*(5*D),m+=R*(5*z),m+=O*(5*H),w=l+=(m+=L*(5*$))>>>13,w+=S*$,w+=A*j,w+=x*U,w+=k*N,l=(w+=B*P)>>>13,w&=8191,w+=I*C,w+=T*M,w+=R*(5*D),w+=O*(5*z),b=l+=(w+=L*(5*H))>>>13,b+=S*H,b+=A*$,b+=x*j,b+=k*U,l=(b+=B*N)>>>13,b&=8191,b+=I*P,b+=T*C,b+=R*M,b+=O*(5*D),v=l+=(b+=L*(5*z))>>>13,v+=S*z,v+=A*H,v+=x*$,v+=k*j,l=(v+=B*U)>>>13,v&=8191,v+=I*N,v+=T*P,v+=R*C,v+=O*M,_=l+=(v+=L*(5*D))>>>13,_+=S*D,_+=A*z,_+=x*H,_+=k*$,l=(_+=B*j)>>>13,_&=8191,_+=I*U,_+=T*N,_+=R*P,_+=O*C,S=f=8191&(l=(l=((l+=(_+=L*M)>>>13)<<2)+l|0)+(f&=8191)|0),A=d+=l>>>=13,x=p&=8191,k=g&=8191,B=y&=8191,I=m&=8191,T=w&=8191,R=b&=8191,O=v&=8191,L=_&=8191,t+=16,r-=16;this.h[0]=S,this.h[1]=A,this.h[2]=x,this.h[3]=k,this.h[4]=B,this.h[5]=I,this.h[6]=T,this.h[7]=R,this.h[8]=O,this.h[9]=L},A.prototype.finish=function(e,t){var r,n,i,o,s=new Uint16Array(10);if(this.leftover){for(o=this.leftover,this.buffer[o++]=1;o<16;o++)this.buffer[o]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(r=this.h[1]>>>13,this.h[1]&=8191,o=2;o<10;o++)this.h[o]+=r,r=this.h[o]>>>13,this.h[o]&=8191;for(this.h[0]+=5*r,r=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=r,r=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=r,s[0]=this.h[0]+5,r=s[0]>>>13,s[0]&=8191,o=1;o<10;o++)s[o]=this.h[o]+r,r=s[o]>>>13,s[o]&=8191;for(s[9]-=8192,n=(1^r)-1,o=0;o<10;o++)s[o]&=n;for(n=~n,o=0;o<10;o++)this.h[o]=this.h[o]&n|s[o];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),i=this.h[0]+this.pad[0],this.h[0]=65535&i,o=1;o<8;o++)i=(this.h[o]+this.pad[o]|0)+(i>>>16)|0,this.h[o]=65535&i;e[t+0]=this.h[0]>>>0&255,e[t+1]=this.h[0]>>>8&255,e[t+2]=this.h[1]>>>0&255,e[t+3]=this.h[1]>>>8&255,e[t+4]=this.h[2]>>>0&255,e[t+5]=this.h[2]>>>8&255,e[t+6]=this.h[3]>>>0&255,e[t+7]=this.h[3]>>>8&255,e[t+8]=this.h[4]>>>0&255,e[t+9]=this.h[4]>>>8&255,e[t+10]=this.h[5]>>>0&255,e[t+11]=this.h[5]>>>8&255,e[t+12]=this.h[6]>>>0&255,e[t+13]=this.h[6]>>>8&255,e[t+14]=this.h[7]>>>0&255,e[t+15]=this.h[7]>>>8&255},A.prototype.update=function(e,t,r){var n,i;if(this.leftover){for((i=16-this.leftover)>r&&(i=r),n=0;n=16&&(i=r-r%16,this.blocks(e,t,i),t+=i,r-=i),r){for(n=0;n=128;){for(E=0;E<16;E++)S=8*E+G,R[E]=r[S+0]<<24|r[S+1]<<16|r[S+2]<<8|r[S+3],O[E]=r[S+4]<<24|r[S+5]<<16|r[S+6]<<8|r[S+7];for(E=0;E<80;E++)if(i=L,o=M,s=C,a=P,c=N,u=U,h=j,$,f=H,d=z,p=D,g=F,y=q,m=K,w=W,V,k=65535&(x=V),B=x>>>16,I=65535&(A=$),T=A>>>16,k+=65535&(x=(q>>>14|N<<18)^(q>>>18|N<<14)^(N>>>9|q<<23)),B+=x>>>16,I+=65535&(A=(N>>>14|q<<18)^(N>>>18|q<<14)^(q>>>9|N<<23)),T+=A>>>16,k+=65535&(x=q&K^~q&W),B+=x>>>16,I+=65535&(A=N&U^~N&j),T+=A>>>16,k+=65535&(x=Z[2*E+1]),B+=x>>>16,I+=65535&(A=Z[2*E]),T+=A>>>16,A=R[E%16],B+=(x=O[E%16])>>>16,I+=65535&A,T+=A>>>16,I+=(B+=(k+=65535&x)>>>16)>>>16,k=65535&(x=_=65535&k|B<<16),B=x>>>16,I=65535&(A=v=65535&I|(T+=I>>>16)<<16),T=A>>>16,k+=65535&(x=(H>>>28|L<<4)^(L>>>2|H<<30)^(L>>>7|H<<25)),B+=x>>>16,I+=65535&(A=(L>>>28|H<<4)^(H>>>2|L<<30)^(H>>>7|L<<25)),T+=A>>>16,B+=(x=H&z^H&D^z&D)>>>16,I+=65535&(A=L&M^L&C^M&C),T+=A>>>16,l=65535&(I+=(B+=(k+=65535&x)>>>16)>>>16)|(T+=I>>>16)<<16,b=65535&k|B<<16,k=65535&(x=g),B=x>>>16,I=65535&(A=a),T=A>>>16,B+=(x=_)>>>16,I+=65535&(A=v),T+=A>>>16,M=i,C=o,P=s,N=a=65535&(I+=(B+=(k+=65535&x)>>>16)>>>16)|(T+=I>>>16)<<16,U=c,j=u,$=h,L=l,z=f,D=d,F=p,q=g=65535&k|B<<16,K=y,W=m,V=w,H=b,E%16==15)for(S=0;S<16;S++)A=R[S],k=65535&(x=O[S]),B=x>>>16,I=65535&A,T=A>>>16,A=R[(S+9)%16],k+=65535&(x=O[(S+9)%16]),B+=x>>>16,I+=65535&A,T+=A>>>16,v=R[(S+1)%16],k+=65535&(x=((_=O[(S+1)%16])>>>1|v<<31)^(_>>>8|v<<24)^(_>>>7|v<<25)),B+=x>>>16,I+=65535&(A=(v>>>1|_<<31)^(v>>>8|_<<24)^v>>>7),T+=A>>>16,v=R[(S+14)%16],B+=(x=((_=O[(S+14)%16])>>>19|v<<13)^(v>>>29|_<<3)^(_>>>6|v<<26))>>>16,I+=65535&(A=(v>>>19|_<<13)^(_>>>29|v<<3)^v>>>6),T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,R[S]=65535&I|T<<16,O[S]=65535&k|B<<16;k=65535&(x=H),B=x>>>16,I=65535&(A=L),T=A>>>16,A=e[0],B+=(x=t[0])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[0]=L=65535&I|T<<16,t[0]=H=65535&k|B<<16,k=65535&(x=z),B=x>>>16,I=65535&(A=M),T=A>>>16,A=e[1],B+=(x=t[1])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[1]=M=65535&I|T<<16,t[1]=z=65535&k|B<<16,k=65535&(x=D),B=x>>>16,I=65535&(A=C),T=A>>>16,A=e[2],B+=(x=t[2])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[2]=C=65535&I|T<<16,t[2]=D=65535&k|B<<16,k=65535&(x=F),B=x>>>16,I=65535&(A=P),T=A>>>16,A=e[3],B+=(x=t[3])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[3]=P=65535&I|T<<16,t[3]=F=65535&k|B<<16,k=65535&(x=q),B=x>>>16,I=65535&(A=N),T=A>>>16,A=e[4],B+=(x=t[4])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[4]=N=65535&I|T<<16,t[4]=q=65535&k|B<<16,k=65535&(x=K),B=x>>>16,I=65535&(A=U),T=A>>>16,A=e[5],B+=(x=t[5])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[5]=U=65535&I|T<<16,t[5]=K=65535&k|B<<16,k=65535&(x=W),B=x>>>16,I=65535&(A=j),T=A>>>16,A=e[6],B+=(x=t[6])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[6]=j=65535&I|T<<16,t[6]=W=65535&k|B<<16,k=65535&(x=V),B=x>>>16,I=65535&(A=$),T=A>>>16,A=e[7],B+=(x=t[7])>>>16,I+=65535&A,T+=A>>>16,T+=(I+=(B+=(k+=65535&x)>>>16)>>>16)>>>16,e[7]=$=65535&I|T<<16,t[7]=V=65535&k|B<<16,G+=128,n-=128}return n}function J(e,t,r){var n,i=new Int32Array(8),o=new Int32Array(8),s=new Uint8Array(256),a=r;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,o[0]=4089235720,o[1]=2227873595,o[2]=4271175723,o[3]=1595750129,o[4]=2917565137,o[5]=725511199,o[6]=4215389547,o[7]=327033209,G(i,o,t,r),r%=128,n=0;n=0;--i)X(e,t,n=r[i/8|0]>>(7&i)&1),Y(t,e),Y(e,e),X(e,t,n)}function te(e,r){var n=[t(),t(),t(),t()];T(n[0],h),T(n[1],l),T(n[2],s),j(n[3],h,l),ee(e,n,r)}function re(e,n,i){var o,s=new Uint8Array(64),a=[t(),t(),t(),t()];for(i||r(n,32),J(s,n,32),s[0]&=248,s[31]&=127,s[31]|=64,te(a,s),Q(e,a),o=0;o<32;o++)n[o+32]=e[o];return 0}var ne=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 ie(e,t){var r,n,i,o;for(n=63;n>=32;--n){for(r=0,i=n-32,o=n-12;i>4)*ne[i],r=t[i]>>8,t[i]&=255;for(i=0;i<32;i++)t[i]-=r*ne[i];for(n=0;n<32;n++)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function oe(e){var t,r=new Float64Array(64);for(t=0;t<64;t++)r[t]=e[t];for(t=0;t<64;t++)e[t]=0;ie(e,r)}function se(e,r,n,i){var o,s,a=new Uint8Array(64),c=new Uint8Array(64),u=new Uint8Array(64),h=new Float64Array(64),l=[t(),t(),t(),t()];J(a,i,32),a[0]&=248,a[31]&=127,a[31]|=64;var f=n+64;for(o=0;o>7&&U(e[0],o,e[0]),j(e[3],e[0],e[1]),0)}(d,i))return-1;for(a=0;a=0},e.sign.keyPair=function(){var e=new Uint8Array(he),t=new Uint8Array(le);return re(e,t),{publicKey:e,secretKey:t}},e.sign.keyPair.fromSecretKey=function(e){if(de(e),e.length!==le)throw new Error("bad secret key size");for(var t=new Uint8Array(he),r=0;r0&&(o=2048-i-16),n.padding="0".repeat(o),TB({publicKey:e,data:JSON.stringify(n),version:r})},vB.decrypt=RB,vB.decryptSafely=function({encryptedData:e,privateKey:t}){if((0,IB.isNullish)(e))throw new Error("Missing encryptedData parameter");if((0,IB.isNullish)(t))throw new Error("Missing privateKey parameter");return JSON.parse(RB({encryptedData:e,privateKey:t})).data},vB.getEncryptionPublicKey=function(e){const t=C.from(e,"hex"),r=BB.box.keyPair.fromSecretKey(t).publicKey;return kB.base64.encode(r)},function(e){var t=Cr&&Cr.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var i=Object.getOwnPropertyDescriptor(t,r);i&&!("get"in i?!t.__esModule:i.writable||i.configurable)||(i={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,i)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),r=Cr&&Cr.__exportStar||function(e,r){for(var n in e)"default"===n||Object.prototype.hasOwnProperty.call(r,n)||t(r,e,n)};Object.defineProperty(e,"__esModule",{value:!0}),e.normalize=e.concatSig=void 0,r(wh,e),r(Lx,e),r(vB,e);var n=ev;Object.defineProperty(e,"concatSig",{enumerable:!0,get:function(){return n.concatSig}}),Object.defineProperty(e,"normalize",{enumerable:!0,get:function(){return n.normalize}})}(mh);class OB extends Error{constructor(e,t){super(),this.code=e,this.message=t}toString(){return`${this.message} (${this.code})`}}var LB,MB=(e,t,r)=>(((e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)})(e,t,"read from private field"),r?r.call(e):t.get(e));const CB=class{constructor(e){((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)})(this,LB,["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"+C.from(e).toString("hex")}static messageToBuffer(e){let t=C.from([]);try{t="string"==typeof e?C.from(e.replace("0x",""),"hex"):C.from(e)}catch(e){console.log(`messageToBuffer error: ${e}`)}return t}async request(e){if(MB(this,LB).includes(e.method))return Promise.reject(new OB(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,mh.SignTypedDataVersion.V3);case"eth_signTypedData_v4":return this.ethSignTypedData(e.params,mh.SignTypedDataVersion.V4);case"eth_signTypedData":return this.ethSignTypedData(e.params,mh.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:o}=t;return this.provider.internalRequest({method:"watchAsset",params:{type:r,contract:n,symbol:i,decimals:o||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})}}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;"string"==typeof r&&t.toLowerCase()===r.toLowerCase()&&(r=e[1],n=e[0]);const i=CB.messageToBuffer(r);return this.provider.internalRequest({method:"signPersonalMessage",params:{data:0===i.length?CB.bufferToHex(r):r,address:n}})}ethSign(e){if(!e)throw new Error("Missing params");const[t,r]=e,n=CB.messageToBuffer(r),i=CB.bufferToHex(n);return this.provider.internalRequest({method:CB.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;"string"==typeof n&&r.toLowerCase()===n.toLowerCase()&&(n=e[1],i=e[0]);const o="string"==typeof n?JSON.parse(n):n,{chainId:s}=o.domain||{};if(typeof s<"u"&&Number(s)!==Number(this.provider.getChainId()))throw new Error("Provided chainId does not match the currently active chain");const a=t!==mh.SignTypedDataVersion.V1?mh.TypedDataUtils.eip712Hash(o,t):"";return this.provider.internalRequest({method:"signTypedMessage",params:{data:"0x"+a.toString("hex"),raw:"string"==typeof n?n:JSON.stringify(n),address:i,version:t}})}};let PB=CB;LB=new WeakMap;var NB,UB=Object.defineProperty,jB=Object.getOwnPropertySymbols,$B=Object.prototype.hasOwnProperty,HB=Object.prototype.propertyIsEnumerable,zB=(e,t,r)=>t in e?UB(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,DB=(e,t)=>{for(var r in t||(t={}))$B.call(t,r)&&zB(e,r,t[r]);if(jB)for(var r of jB(t))HB.call(t,r)&&zB(e,r,t[r]);return e},FB=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)};class qB{constructor(e){((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)})(this,NB,void 0),((e,t,r,n)=>{FB(e,t,"write to private field"),n?n.call(e,r):t.set(e,r)})(this,NB,e)}async getBlockNumber(){return(await this.call({jsonrpc:"2.0",method:"eth_blockNumber",params:[]})).result}async getBlockByNumber(e){return(await this.call({jsonrpc:"2.0",method:"eth_getBlockByNumber",params:[e,!1]})).result}getFilterLogs(e){return this.call({jsonrpc:"2.0",method:"eth_getLogs",params:[e]})}async call(e){const t=await(await fetch(((e,t,r)=>(FB(e,t,"read from private field"),r?r.call(e):t.get(e)))(this,NB),{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(DB({id:(new Date).getTime()+Math.floor(1e3*Math.random())},e))})).json();if(!t.result&&t.error)throw new Error(t.error.message||"rpc error");return t.result}}NB=new WeakMap;var KB,WB,VB,ZB,GB,JB,YB=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},XB=(e,t,r)=>(YB(e,t,"read from private field"),r?r.call(e):t.get(e)),QB=(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)},eI=(e,t,r,n)=>(YB(e,t,"write to private field"),n?n.call(e,r):t.set(e,r),r);const tI=class extends He{constructor(e){super(),QB(this,KB,void 0),QB(this,WB,void 0),QB(this,VB,!1),QB(this,ZB,!1),QB(this,GB,void 0),QB(this,JB,void 0),this.isTrust=!0,this.isTrustWallet=!0,this.request=this.request.bind(this),e&&(e.chainId&&eI(this,KB,e.chainId),(e.rpc||e.rpcUrl)&&eI(this,WB,e.rpc||e.rpcUrl),typeof e.overwriteMetamask<"u"&&eI(this,ZB,e.overwriteMetamask),typeof e.disableMobileAdapter<"u"&&eI(this,VB,e.disableMobileAdapter),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust),eI(this,JB,new qB(XB(this,WB)))),XB(this,VB)||(this.mobileAdapter=new PB(this)),super.on("onResponseReady",this.onResponseReady.bind(this)),this.connect()}connect(){this.emit("connect",{chainId:XB(this,KB)})}enable(){return this.request({method:"eth_requestAccounts"})}sendAsync(e,t){Array.isArray(e)?Promise.all(e.map((e=>this.request(e)))).then((e=>t(null,e))).catch((e=>t(e,null))):this.request(e).then((e=>t(null,e))).catch((e=>t(e,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 OB(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("string"==typeof e&&(!t||Array.isArray(t))){const r=this;return new Promise(((n,i)=>{try{const o=r.request({method:e,params:t});o instanceof Promise?o.then(n).catch(i):n(o)}catch(e){i(e)}}))}return e&&"object"==typeof e&&"function"==typeof t?this.request(e).then(t):this._send(e)}internalRequest(e){return super.request(e)}request(e){if(this.mobileAdapter){const t=this.handleStaticRequests(e,(()=>this.mobileAdapter.request(e)));return t instanceof Promise?t:Promise.resolve(t)}return this.handleStaticRequests(e,(()=>this.internalRequest(e)))}handleStaticRequests(e,t){switch(e.method){case"net_version":return XB(this,KB)?parseInt(XB(this,KB)):void 0;case"eth_chainId":return XB(this,KB);case"eth_accounts":case"eth_coinbase":return XB(this,GB)?[XB(this,GB)]:[]}if(t)return t()}onResponseReady(e,t){var r,n,i,o;if(t)switch(e.method){case"eth_requestAccounts":case"requestAccounts":eI(this,GB,t[0]);break;case"wallet_requestPermissions":eI(this,GB,null==(o=null==(i=null==(n=null==(r=t[0])?void 0:r.caveats)?void 0:n[0])?void 0:i.value)?void 0:o[0])}}getNetwork(){return tI.NETWORK}get connected(){return!0}get isMetaMask(){return XB(this,ZB)}getChainId(){return XB(this,KB)}getNetworkVersion(){return this.handleStaticRequests({method:"net_version "})}setChainId(e){eI(this,KB,e)}setRPCUrl(e){eI(this,WB,e),eI(this,JB,new qB(XB(this,WB)))}getRPC(){return XB(this,JB)}setOverwriteMetamask(e){eI(this,ZB,e)}getAddress(){return XB(this,GB)}setAddress(e){eI(this,GB,e)}setRPC(e){eI(this,JB,e)}};let rI=tI;KB=new WeakMap,WB=new WeakMap,VB=new WeakMap,ZB=new WeakMap,GB=new WeakMap,JB=new WeakMap,rI.NETWORK="ethereum";class nI{constructor(e){this.provider=e}async request(e,t){if("getKey"===e.method){const t=await this.provider.internalRequest({method:"requestAccounts",params:e.params}),r=JSON.parse(t);return{algo:"secp256k1",address:r.address,bech32Address:r.address,pubKey:C.from(r.pubKey,"hex")}}const r={signAmino:"signTransaction",signDirect:"signTransaction",signArbitrary:"signMessage",sendTx:"sendTransaction"};return r[e.method]?this.provider.internalRequest({method:r[e.method],params:e.params}):t()}}var iI,oI=(e,t,r)=>{if(!t.has(e))throw TypeError("Cannot "+r)},sI=(e,t,r)=>(oI(e,t,"read from private field"),r?r.call(e):t.get(e));const aI=class extends He{constructor(e){super(),((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)})(this,iI,!1),this.isKeplr=!0,this.isTrust=!0,this.isTrustWallet=!0,e&&(typeof e.disableMobileAdapter<"u"&&((e,t,r,n)=>{oI(e,t,"write to private field"),n?n.call(e,r):t.set(e,r)})(this,iI,e.disableMobileAdapter),typeof e.isKeplr<"u"&&(this.isKeplr=e.isKeplr),typeof e.isTrust<"u"&&(this.isTrust=e.isTrust,this.isTrustWallet=e.isTrust)),sI(this,iI)||(this.mobileAdapter=new nI(this))}static bufferToHex(e){return"0x"+C.from(e).toString("hex")}getNetwork(){return aI.NETWORK}isMobileAdapterEnabled(){return!sI(this,iI)}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=C.from(t).toString("base64"),i=await this.request({method:"sendTx",params:{raw:n,chainId:e,mode:r}});return new Uint8Array(C.from(i,"hex"))}async signArbitrary(e,t,r){const n=C.from(r),i=aI.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:o}=JSON.parse(n);return{signed:i,signature:o}}async signDirect(e,t,r){const n={bodyBytes:aI.bufferToHex(r.bodyBytes),authInfoBytes:aI.bufferToHex(r.authInfoBytes)},i=await this.request({method:"signDirect",params:{signerAddress:t,chainId:e,sign_doc:n}}),{signature:o}=JSON.parse(i);return{signed:r,signature:o}}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 cI=aI;iI=new WeakMap,cI.NETWORK="cosmos";var uI,hI={exports:{}},lI="object"==typeof Reflect?Reflect:null,fI=lI&&"function"==typeof lI.apply?lI.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};uI=lI&&"function"==typeof lI.ownKeys?lI.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var dI=Number.isNaN||function(e){return e!=e};function pI(){pI.init.call(this)}hI.exports=pI,hI.exports.once=function(e,t){return new Promise((function(r,n){function i(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",i),r([].slice.call(arguments))}AI(e,t,o,{once:!0}),"error"!==t&&function(e,t,r){"function"==typeof e.on&&AI(e,"error",t,r)}(e,i,{once:!0})}))},pI.EventEmitter=pI,pI.prototype._events=void 0,pI.prototype._eventsCount=0,pI.prototype._maxListeners=void 0;var gI=10;function yI(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function mI(e){return void 0===e._maxListeners?pI.defaultMaxListeners:e._maxListeners}function wI(e,t,r,n){var i,o,s;if(yI(r),void 0===(o=e._events)?(o=e._events=Object.create(null),e._eventsCount=0):(void 0!==o.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),o=e._events),s=o[t]),void 0===s)s=o[t]=r,++e._eventsCount;else if("function"==typeof s?s=o[t]=n?[r,s]:[s,r]:n?s.unshift(r):s.push(r),(i=mI(e))>0&&s.length>i&&!s.warned){s.warned=!0;var a=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");a.name="MaxListenersExceededWarning",a.emitter=e,a.type=t,a.count=s.length,function(e){console&&console.warn&&console.warn(e)}(a)}return e}function bI(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function vI(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=bI.bind(n);return i.listener=r,n.wrapFn=i,i}function _I(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=new Array(e.length),r=0;r0&&(o=t[0]),o instanceof Error)throw o;var s=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw s.context=o,s}var a=i[e];if(void 0===a)return!1;if("function"==typeof a)fI(a,this,t);else{var c=a.length,u=SI(a,c);for(r=0;r=0;o--)if(r[o]===t||r[o].listener===t){s=r[o].listener,i=o;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1=0;n--)this.removeListener(e,t[n]);return this},pI.prototype.listeners=function(e){return _I(this,e,!0)},pI.prototype.rawListeners=function(e){return _I(this,e,!1)},pI.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):EI.call(e,t)},pI.prototype.listenerCount=EI,pI.prototype.eventNames=function(){return this._eventsCount>0?uI(this._events):[]};const xI="CALLBACK";class kI extends hI.exports.EventEmitter{setAdapter(e){return this.adapter=e,this}async request(e){try{if(!this.adapter)throw new Error("No adapter set, maybe you forgot to register the provider?");const t=await this.adapter.request(e,this.getNetwork());return this.emit("onResponseReady",e,t),t}catch(e){throw e}}sendResponse(e,t){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==xI)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendResponse(e,t)}sendError(e,t){if(!this.adapter)throw new Error("Adapter not found");if(this.adapter.getStrategy()!==xI)throw new Error("Trying to send callback request on promisified adapter");this.adapter.sendError(e,t)}}const BI=class extends kI{constructor(e){super(),this._isConnected=!1,this.chainId=null,this.address=null,e&&e.network&&(this._network=e.network,e.chainId&&(this.chainId=e.chainId))}static bufferToHex(e){return"0x"+C.from(e).toString("hex")}static messageToBuffer(e){let t=C.from([]);try{t="string"==typeof e?C.from(e.replace("0x",""),"hex"):C.from(e)}catch(e){console.log(`messageToBuffer error: ${e}`)}return t}setConfig(e){this._network=e.network,this.address=e.address,this.chainId=e.chainId}async connect(){const e=await this.account();return this._isConnected=!0,this.emit("connect"),e}disconnect(){this._isConnected=!1,this.emit("disconnect")}isConnected(){return this._isConnected}async account(){const e=await this.request({method:"requestAccounts",params:{}});return JSON.parse(e)}network(){return this._network}getNetwork(){return BI.NETWORK}async signMessage(e){const t="APTOS",r=(await this.account()).address;let n=t;const i=window.location.protocol+"//"+window.location.hostname;e.address&&(n+="\naddress: "+r),e.application&&(n+="\napplication: "+i),e.chainId&&(n+="\nchainId: "+this.chainId),n+="\nmessage: "+e.message,n+="\nnonce: "+e.nonce;const o=C.from(n),s=BI.bufferToHex(o);return this.request({method:"signMessage",params:{data:s}}).then((o=>({address:r,application:i,chainId:this.chainId,fullMessage:n,message:e.message,nonce:e.nonce,prefix:t,signature:o})))}async signAndSubmitTransaction(e){const t=await this.signTransaction(e),r=await this.request({method:"sendTransaction",params:{tx:t}});return{hash:BI.messageToBuffer(r).toString()}}async signTransaction(e){const t=await this.request({method:"signTransaction",params:{data:e}});return JSON.parse(BI.messageToBuffer(t).toString())}};let II=BI;II.NETWORK="aptos";var TI=Object.defineProperty,RI=Object.defineProperties,OI=Object.getOwnPropertyDescriptors,LI=Object.getOwnPropertySymbols,MI=Object.prototype.hasOwnProperty,CI=Object.prototype.propertyIsEnumerable,PI=(e,t,r)=>t in e?TI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,NI=(e,t)=>{for(var r in t||(t={}))MI.call(t,r)&&PI(e,r,t[r]);if(LI)for(var r of LI(t))CI.call(t,r)&&PI(e,r,t[r]);return e},UI=(e,t)=>{var r={};for(var n in e)MI.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&LI)for(var n of LI(e))t.indexOf(n)<0&&CI.call(e,n)&&(r[n]=e[n]);return r};class jI{constructor(e){this.provider=e}static mapToCamelCase(e){return NI(NI({},e),null!=e&&e.messages?{messages:(e?.messages||[]).map((e=>{var t=e,{state_init:r}=t,n=UI(t,["state_init"]);return((e,t)=>RI(e,OI(t)))(NI({},n),{stateInit:r})}))}:{})}async request(e,t){switch(e){case"tonConnect_connect":{const e=await this.provider.internalRequest("requestAccounts",t);return JSON.parse(e).map((e=>"ton_addr"===e.name?UI(e,["nonBounceable"]):e))}case"tonConnect_reconnect":{const e=await this.provider.internalRequest("tonConnect_reconnect",t);return JSON.parse(e)}case"ton_rawSign":return this.provider.internalRequest("signMessage",t);case"ton_sendTransaction":case"tonConnect_sendTransaction":{const r=await this.provider.internalRequest("signTransaction",jI.mapToCamelCase(t[0])),{nonce:n,hash:i}=JSON.parse(r);return"ton_sendTransaction"===e?n:i}case"ton_requestAccounts":{const e=await this.provider.internalRequest("requestAccounts",t),[{nonBounceable:r}]=JSON.parse(e);return[r]}case"ton_requestWallets":{const e=await this.provider.internalRequest("requestAccounts",t),[{nonBounceable:r,publicKey:n}]=JSON.parse(e);return[{address:r,publicKey:n,version:this.provider.version}]}default:return this.provider.internalRequest(e,t)}}}const $I=class extends He{constructor(e){super(),this.version="v4R2",e&&e.version&&(this.version=e.version),null!=e&&e.disableMobileAdapter||(this.mobileAdapter=new jI(this))}disconnect(){return this.send("tonConnect_disconnect",{})}isConnected(){return Promise.resolve(!0)}async send(e,t){return this.mobileAdapter?await this.mobileAdapter.request(e,t):await(()=>this.internalRequest(e,t))()}internalRequest(e,t){return super.request({method:e,params:t})}getNetwork(){return $I.NETWORK}};let HI=$I;HI.NETWORK="ton";class zI extends Error{constructor(e,t){super(e),this.code=t}}const DI=e=>{var t;return{event:"connect_error",payload:{code:null!=(t=e.code)?t:0,message:e.message}}};class FI{constructor(e,t){this.protocolVersion=2,this.isWalletBrowser=!0,this.callbacks=[],this.listen=e=>(this.callbacks.push(e),()=>{this.callbacks=this.callbacks.filter((t=>t!=e))}),e&&(typeof e.isWalletBrowser<"u"&&(this.isWalletBrowser=e.isWalletBrowser),e.walletInfo&&(this.walletInfo=e.walletInfo),e.deviceInfo&&(this.deviceInfo=e.deviceInfo)),this.provider=t}async connect(e,t){e>this.protocolVersion&&new zI("Unsupported protocol version",1);const r=await this.provider.send("tonConnect_connect",t);return"connect_error"===r?.event?this.emit(r):this.emit({event:"connect",payload:{items:r,device:this.deviceInfo}})}async disconnect(){return await this.provider.send("tonConnect_disconnect",{}),this.emit({event:"disconnect",payload:{}})}emit(e){return this.callbacks.forEach((t=>t(e))),e}async restoreConnection(){var e;try{const e=await this.provider.send("tonConnect_reconnect",[{name:"ton_addr"}]);return this.emit({event:"connect",payload:{items:e,device:this.deviceInfo}})}catch(t){return t instanceof zI?this.emit(DI(t)):this.emit(DI(new zI(null!=(e=t.message)?e:"Unknown error")))}}async send(e){try{return{result:await this.provider.send(`tonConnect_${e.method}`,e.params.map((e=>JSON.parse(e)))),id:e.id.toString()}}catch(t){return 4001===t?.code?{error:{message:"User Rejected the transaction",code:300},id:String(e.id)}:-32002===t?.code?{error:{message:"Bad request, a transaction is already pending",code:1},id:String(e.id)}:(t&&![0,1,100,300,400].includes(t.code)&&(t.code=0),{error:t,id:String(e.id)})}}}window.trustwallet={core:(e,t)=>new ze({strategy:e,handler:t}),solana:e=>new yh(e),cosmos:e=>new cI(e),ethereum:e=>new rI(e),aptos:e=>new II(e),ton:e=>new HI(e),tonBridge:(e,t)=>new FI(e,t),randomUUID:()=>y()}})); diff --git a/packages/ios-web3-provider/swift/trust-min.js b/packages/ios-web3-provider/swift/trust-min.js index bfa7640e..f25ecf2f 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:aeb4921f8c17631b5a15a3e24daa1d325f66890e40927791284e0e74ad0fcabd -size 683705 +oid sha256:23bbfda06906d6d3b9537ce5116b032c9a0ceddd880975e408272b9fe9ff606c +size 683983