@wormhole-foundation/wormhole-connect 1.2.0-beta.0-development → 1.3.0-beta.0-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/aptos-DZ2rfUfg.js +3 -0
- package/dist/assets/{aptos-fvUGRJ4h.js → aptos-g3DaQf0b.js} +61 -61
- package/dist/assets/{ccip-DLVsVRZh.js → ccip-CTWg50DB.js} +1 -1
- package/dist/assets/{chunk-U2PRGW4O-BklU2g_V.js → chunk-U2PRGW4O-_uqZ791P.js} +1 -1
- package/dist/assets/evm-CUAh52pb.js +2 -0
- package/dist/assets/{evm-D7r3Ne49.js → evm-Dpe6bb4m.js} +4 -4
- package/dist/assets/index-B169l5cS.js +1 -0
- package/dist/assets/{index-BINzPDaS.js → index-B2zKde8M.js} +1 -1
- package/dist/assets/{index-BmcqXpQd.js → index-B85n1wgg.js} +1 -1
- package/dist/assets/{index-BOsp0gGs.js → index-BGPIDyz6.js} +1 -1
- package/dist/assets/index-BT5QH3hv.js +1 -0
- package/dist/assets/{index-5UpuI6jk.js → index-BbXYZkyr.js} +1 -1
- package/dist/assets/{index-C_VIzW7c.js → index-Bwgv1Ind.js} +1 -1
- package/dist/assets/{index-P4tasYP-.js → index-CFWDbus8.js} +1 -1
- package/dist/assets/{index-BKYhAEpg.js → index-CJV78alS.js} +1 -1
- package/dist/assets/{index-DAS-UCcB.js → index-Ck17eoCG.js} +1 -1
- package/dist/assets/{index-C0ho2skw.js → index-CpdwiPRU.js} +2 -2
- package/dist/assets/{index-C02sy3fv.js → index-DVtwRIfn.js} +1 -1
- package/dist/assets/{index-D3TIHxII.js → index-jE0RsYBN.js} +1 -1
- package/dist/assets/{index.es-wOiA40sy.js → index.es-CEXOl433.js} +2 -2
- package/dist/assets/{signer-BzqNQC8X.js → signer-D8BxqoWW.js} +1 -1
- package/dist/assets/{solana--aMZfCgL.js → solana-Cu2aa7vE.js} +1 -1
- package/dist/assets/solana-Ddk7It-E.js +2 -0
- package/dist/assets/{sui-C76oYlao.js → sui-BXAKH3nv.js} +3 -3
- package/dist/assets/unsignedTransaction-DsxtoHjl.js +1 -0
- package/dist/main.js +28 -28
- package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/hooks/useWalletCompatibility.d.ts +14 -0
- package/dist/src/hooks/useWalletCompatibility.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/wallet/aptos.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/lib/{aptos-BZuWMk3D.mjs → aptos-BADK10fB.mjs} +871 -870
- package/lib/{aptos-2J8A-FZO.mjs → aptos-CNLtQdwF.mjs} +59 -57
- package/lib/{aptos-DL1Hgg15.js → aptos-DeODB5kZ.js} +4 -4
- package/lib/aptos-DhXgHrnl.js +2 -0
- package/lib/{base64-Bit1A1if.js → base64-CEPDNsRw.js} +1 -1
- package/lib/{base64-BdSgqiJl.mjs → base64-w49IrkvT.mjs} +1 -1
- package/lib/{ccip-CMkUITDS.js → ccip-PRIyWWAN.js} +1 -1
- package/lib/{ccip-Cw8-T0j-.mjs → ccip-VK5volw3.mjs} +1 -1
- package/lib/{chunk-U2PRGW4O-CMIP41vB.mjs → chunk-U2PRGW4O-Ch5UM-YX.mjs} +6 -3
- package/lib/{chunk-U2PRGW4O-CuEEOygo.js → chunk-U2PRGW4O-D9odrfIU.js} +5 -5
- package/lib/{events-Bs7CEKn9.js → events-Bu0pqh5u.js} +1 -1
- package/lib/{events-CpDIhB3C.mjs → events-jOp8E97m.mjs} +1 -1
- package/lib/{evm-CK7UNFtq.js → evm-3jPN9QHX.js} +1 -1
- package/lib/{evm-DfX7cWQI.mjs → evm-B13HZSOG.mjs} +6 -6
- package/lib/{evm-1S_EvV1A.mjs → evm-CZgBqG6_.mjs} +7 -7
- package/lib/{evm-D5NO24dh.js → evm-Y4sMK_A1.js} +4 -4
- package/lib/index-1qQOAFE2.mjs +102 -0
- package/lib/{index-C6iaLaJq.mjs → index-BAhBSTHO.mjs} +18418 -18338
- package/lib/{index-wW7H3ciQ.mjs → index-BDForJp0.mjs} +2 -2
- package/lib/{index-CqSLXgKG.js → index-BFbkaHZM.js} +1 -1
- package/lib/{index-CqfWDHV0.mjs → index-BHdCskLu.mjs} +2 -2
- package/lib/{index-DKZeU-Xf.js → index-BRf1dmcD.js} +1 -1
- package/lib/{index-BPtbGGHy.mjs → index-BVuV_rfV.mjs} +3 -3
- package/lib/{index-CXWWVJUC.js → index-BX2v7vz2.js} +1 -1
- package/lib/{index-Q-iWWETw.mjs → index-BZknHaxy.mjs} +70 -70
- package/lib/{index-CwNerYWM.js → index-Brzu_xNS.js} +1 -1
- package/lib/{index-D_BTWvYp.mjs → index-BuWkXqNE.mjs} +2 -2
- package/lib/{index-BXPqhxjc.js → index-C2Rk8dJm.js} +1 -1
- package/lib/{index-C8__BuqK.mjs → index-CKnJa2J4.mjs} +1 -1
- package/lib/{index-DhxGcoTC.mjs → index-CdUjuPf9.mjs} +5 -5
- package/lib/{index-D5xkWCZ3.mjs → index-CkQ2SX_N.mjs} +48 -57
- package/lib/{index-o0AEhklr.mjs → index-CpOpT2eM.mjs} +2 -2
- package/lib/{index-hk3iRhUd.mjs → index-CtVdS94F.mjs} +4 -4
- package/lib/{index-8nlb2LGX.js → index-CzRLTmkg.js} +1 -1
- package/lib/{index-DbiW1-3L.mjs → index-D4DQMA-o.mjs} +1 -1
- package/lib/{index-hIJ0h_GZ.js → index-D5ta6SAe.js} +91 -91
- package/lib/{index-v3UQ6KEC.js → index-D9KxVP2I.js} +1 -1
- package/lib/index-DBmgmviv.js +1 -0
- package/lib/{index-S1YybQMR.js → index-DFS9XfYE.js} +1 -1
- package/lib/{index-7_XTrYay.js → index-DL5itoYd.js} +1 -1
- package/lib/index-DOqilxLu.js +1 -0
- package/lib/{index-C42d1PS9.js → index-DT5QhFiG.js} +1 -1
- package/lib/{index-CbJWXG7l.mjs → index-DcL6du1P.mjs} +2 -2
- package/lib/{index-7Jgokx3S.js → index-DfRhe8kL.js} +1 -1
- package/lib/{index-B96enquk.js → index-DjDJigyM.js} +1 -1
- package/lib/{index-BNn38QYa.mjs → index-DkNDirHr.mjs} +2 -2
- package/lib/{index-BfBNSTY8.js → index-Dr6Wkn1g.js} +1 -1
- package/lib/{index-D2Bw_LRJ.js → index-Dw4_1FXq.js} +1 -1
- package/lib/{index-Cqiy61ub.mjs → index-DzeE34W2.mjs} +1 -1
- package/lib/{index-TVlE0v9D.js → index-EVkJCI6W.js} +1 -1
- package/lib/{index-vWXFBAHR.js → index-OdUgDqqR.js} +1 -1
- package/lib/{index-B-ZKCWaX.js → index-dYeh9TN5.js} +1 -1
- package/lib/{index-BDbrAqgW.mjs → index-hnhyQbEN.mjs} +5 -5
- package/lib/{index-Bm1zXhFz.mjs → index-ieIOqnbv.mjs} +1 -1
- package/lib/{index-B-UHVwW1.mjs → index-v8vynoP2.mjs} +2 -2
- package/lib/{index-BzHjroj_.mjs → index-yIiSwVLU.mjs} +2 -2
- package/lib/{index.es-DN28d137.js → index.es-D9Co2OZW.js} +2 -2
- package/lib/{index.es-BnuWmVuS.mjs → index.es-jvUS3_-Z.mjs} +5 -5
- package/lib/index.js +1 -1
- package/lib/index.mjs +1 -1
- package/lib/{signer-YETmMcF8.js → signer-BvZ7J3Rl.js} +1 -1
- package/lib/{signer-D5i4Nnyi.mjs → signer-CsfCFMWy.mjs} +1 -1
- package/lib/solana-BD_xWaS3.js +1 -0
- package/lib/{solana-C7qBFXj3.js → solana-BfiZpxkP.js} +1 -1
- package/lib/solana-ChpC_WNg.mjs +16 -0
- package/lib/{solana-DtBRFbad.mjs → solana-Dh_0HpA8.mjs} +4 -4
- package/lib/{solanaEmbed.esm-BER_HE9G.js → solanaEmbed.esm-B3b-A7RS.js} +1 -1
- package/lib/{solanaEmbed.esm-Bb5iLp3o.mjs → solanaEmbed.esm-BCE4UL9u.mjs} +2 -2
- package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/hooks/useWalletCompatibility.d.ts +14 -0
- package/lib/src/hooks/useWalletCompatibility.d.ts.map +1 -0
- package/lib/src/utils/index.d.ts +1 -1
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/wallet/aptos.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/index.d.ts.map +1 -1
- package/lib/{sui-De3Fl_fo.js → sui-BhOuuPtT.js} +1 -1
- package/lib/{sui-1QFb30Ta.mjs → sui-Cc0SlN9d.mjs} +1 -1
- package/lib/{sui-DAyysPh2.mjs → sui-DmasAl1E.mjs} +5 -5
- package/lib/{sui-c1d9xieM.js → sui-RIp5yjOC.js} +2 -2
- package/lib/unsignedTransaction-BDOQhqcZ.mjs +16 -0
- package/lib/unsignedTransaction-C1YeEl4G.js +1 -0
- package/lib/{utf8-BxTDE5Vo.mjs → utf8-V9eCtEDc.mjs} +1 -1
- package/lib/{utf8-B-nUZvyF.js → utf8-lSE3VJ2A.js} +1 -1
- package/package.json +17 -17
- package/dist/assets/aptos-De-iCK2S.js +0 -3
- package/dist/assets/evm-BBq1KqPa.js +0 -2
- package/dist/assets/index-LPMvkG3A.js +0 -1
- package/dist/assets/solana-DTptRMWs.js +0 -2
- package/lib/aptos-DcCwQMe7.js +0 -2
- package/lib/index-Bq2G38s-.js +0 -1
- package/lib/solana-B9GQ_Umb.js +0 -1
- package/lib/solana-tevnHUxv.mjs +0 -16
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var h=Object.defineProperty;var m=(a,e,t)=>e in a?h(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var s=(a,e,t)=>m(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-
|
|
1
|
+
"use strict";var h=Object.defineProperty;var m=(a,e,t)=>e in a?h(a,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):a[e]=t;var s=(a,e,t)=>m(a,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./index-D5ta6SAe.js"),w=require("./aptos-DhXgHrnl.js");class c{constructor(e,t,r,o){s(this,"network");s(this,"chain");s(this,"connection");s(this,"contracts");s(this,"chainId");s(this,"coreBridge");this.network=e,this.chain=t,this.connection=r,this.contracts=o,this.chainId=i.toChainId(t);const n=o.coreBridge;if(!n)throw new Error(`CoreBridge contract Address for chain ${t} not found`);this.coreBridge=n}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,t){const[r,o]=await w.AptosPlatform.chainFromRpc(e),n=t[o];if(n.network!==r)throw new Error(`Network mismatch: ${n.network} !== ${r}`);return new c(r,o,e,n.contracts)}async*publishMessage(e,t){throw new Error("Method not implemented.")}async*verifyMessage(e,t){throw new Error("Not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(r=>({chain:r.emitterChain,emitter:r.emitterAddress,sequence:r.sequence}))}async parseMessages(e){const t=await this.connection.getTransactionByHash({transactionHash:e});if(t.type!=="user_transaction")throw new Error(`${e} is not a user_transaction`);const r=t.events.filter(o=>o.type.endsWith("WormholeMessage"));if(!r||r.length===0)throw new Error(`WormholeMessage not found for ${e}`);return r.map(o=>{const n=o.data,d=new i.UniversalAddress(BigInt(n.sender).toString(16).padStart(64,"0"));return i.createVAA("Uint8Array",{guardianSet:0,emitterChain:this.chain,emitterAddress:d,sequence:BigInt(n.sequence),timestamp:Number(n.timestamp),consistencyLevel:n.consistency_level,nonce:Number(n.nonce),signatures:[],payload:i.hex.decode(n.payload)})})}}i.registerProtocol("Aptos","WormholeCore",c);exports.AptosWormholeCore=c;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var l=Object.defineProperty;var y=(i,e,t)=>e in i?l(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var o=(i,e,t)=>y(i,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./index-D5ta6SAe.js"),g=require("./unsignedTransaction-C1YeEl4G.js"),f=require("./aptos-DhXgHrnl.js"),w=[{name:"tokenBridgeAddress",...s.universalAddressItem},{name:"chain",...s.chainItem()},{name:"domainSeparator",binary:"bytes",custom:s.bytes.encode(s.APTOS_SEPARATOR),omit:!0},{name:"tokenId",...s.universalAddressItem},{name:"domainSeparator",binary:"bytes",custom:new Uint8Array([255]),omit:!0}],T=i=>s.serialize$1(w,i);class d{constructor(e,t,n,r){o(this,"network");o(this,"chain");o(this,"connection");o(this,"contracts");o(this,"chainId");o(this,"tokenBridgeAddress");this.network=e,this.chain=t,this.connection=n,this.contracts=r,this.chainId=s.toChainId(t);const a=r.tokenBridge;if(!a)throw new Error(`TokenBridge contract Address for chain ${t} not found`);this.tokenBridgeAddress=a}static async fromRpc(e,t){const[n,r]=await f.AptosPlatform.chainFromRpc(e),a=t[r];if(a.network!==n)throw new Error("Network mismatch "+a.network+" !== "+n);return new d(n,r,e,a.contracts)}async isWrappedAsset(e){try{return await this.getOriginalAsset(e),!0}catch{return!1}}async getOriginalAsset(e){const t=e.toString().split(s.APTOS_SEPARATOR),n=await this.connection.getAccountResource({accountAddress:t[0],resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`});if(!n)throw s.ErrNotWrapped(e.toString());const r=s.toChain(parseInt(n.token_chain.number)),a=new s.UniversalAddress(n.token_address.external_address);return{chain:r,address:a}}async getTokenUniversalAddress(e){return new s.UniversalAddress(s.hex.encode(s.sha3_256(e.toString()),!0))}async getTokenNativeAddress(e,t){const n=e===this.chain?await this.getTypeFromExternalAddress(t.toString()):await this.getAssetFullyQualifiedType({chain:e,address:t});if(!n)throw new Error("Invalid asset address.");return new s.AptosAddress(n)}async hasWrappedAsset(e){try{return await this.getWrappedAsset(e),!0}catch{}return!1}async getWrappedAsset(e){if(s.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const t=await this.getAssetFullyQualifiedType(e);if(!t)throw new Error("Invalid asset address.");return await this.connection.getAccountResource({accountAddress:s.coalesceModuleAddress(t),resourceType:`${this.tokenBridgeAddress}::state::OriginInfo`}),s.toNative(this.chain,t)}async isTransferCompleted(e){const n=(await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`})).consumed_vaas.elems.handle;try{return await this.connection.getTableItem({handle:n,data:{key_type:"vector<u8>",value_type:"u8",key:`0x${s.dist.Buffer.from(s.keccak_256(e.hash)).toString("hex")}`}}),!0}catch{return!1}}async getWrappedNative(){return s.toNative(this.chain,s.APTOS_COIN)}async*createAttestation(e,t){const n={chain:this.chain,address:new s.AptosAddress(e)},r=await this.getAssetFullyQualifiedType(n);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::attest_token::attest_token_entry`,typeArguments:[r],functionArguments:[]},"Aptos.AttestToken")}async*submitAttestation(e,t){yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin_type`,typeArguments:[],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoinType");const n=await this.getAssetFullyQualifiedType(e.payload.token);if(!n)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::wrapped::create_wrapped_coin`,typeArguments:[n],functionArguments:[s.serialize(e)]},"Aptos.CreateWrappedCoin")}async*transfer(e,t,n,r,a){const p=0n,c=0n,h=s.isNative(n)?s.APTOS_COIN:n.toString(),u=t.address.toUniversalAddress().toUint8Array(),A=s.toChainId(t.chain);a?yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_with_payload_entry`,typeArguments:[h],functionArguments:[r,A,u,c,a]},"Aptos.TransferTokensWithPayload"):yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::transfer_tokens::transfer_tokens_entry`,typeArguments:[h],functionArguments:[r,A,u,p,c]},"Aptos.TransferTokens")}async*redeem(e,t,n=!0){const r=t.payload.token.chain===this.chain?await this.getTypeFromExternalAddress(t.payload.token.address.toString()):await this.getAssetFullyQualifiedType(t.payload.token);if(!r)throw new Error("Invalid asset address.");yield this.createUnsignedTx({function:`${this.tokenBridgeAddress}::complete_transfer::submit_vaa_and_register_entry`,typeArguments:[r],functionArguments:[s.serialize(t)]},"Aptos.CompleteTransfer")}async getAssetFullyQualifiedType(e){return e.chain===this.chain?s.isValidAptosType(e.address.toString())?e.address.toString():null:`${d.getForeignAssetAddress(this.chain,this.tokenBridgeAddress,e)}::coin::T`}async getTypeFromExternalAddress(e){try{const t=await this.connection.getAccountResource({accountAddress:this.tokenBridgeAddress,resourceType:`${this.tokenBridgeAddress}::state::State`}),{handle:n}=t.native_infos,r=await this.connection.getTableItem({handle:n,data:{key_type:`${this.tokenBridgeAddress}::token_hash::TokenHash`,value_type:"0x1::type_info::TypeInfo",key:{hash:e}}});return r?[r.account_address,String.fromCharCode(...s.hex.decode(r.module_name)),String.fromCharCode(...s.hex.decode(r.struct_name))].join(s.APTOS_SEPARATOR):null}catch{return null}}static getForeignAssetAddress(e,t,n){if(s.isNative(n.address))throw new Error("Invalid token address");const r=T({chain:n.chain,tokenBridgeAddress:new s.AptosAddress(t).toUniversalAddress(),tokenId:n.address.toUniversalAddress()});return s.hex.encode(s.sha3_256(r),!0)}createUnsignedTx(e,t,n=!1){return new g.AptosUnsignedTransaction(e,this.network,this.chain,t,n)}}s.registerProtocol("Aptos","TokenBridge",d);exports.AptosTokenBridge=d;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";const ct=require("./index-hIJ0h_GZ.js"),Dt=require("./index-vWXFBAHR.js");function Dr(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Br(t,r){r||(r=t.reduce((o,b)=>o+b.length,0));const n=Dr(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const wr={...Dt.identityBase,...Dt.base2,...Dt.base8,...Dt.base10,...Dt.base16,...Dt.base32,...Dt.base36,...Dt.base58,...Dt.base64,...Dt.base256emoji};function Kr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const vr=Kr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ye=Kr("ascii","a",t=>{let r="a";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r},t=>{t=t.substring(1);const r=Dr(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Ur={utf8:vr,"utf-8":vr,hex:wr.base16,latin1:Ye,ascii:Ye,binary:Ye,...wr};function he(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):n.decoder.decode(`${n.prefix}${t}`)}function Le(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}const kn={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},Xn=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,qn=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Yn=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Zn(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){Qn(t);return}return r}function Qn(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Be(t,r={}){if(typeof t!="string")return t;const n=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return n.slice(1,-1);if(n.length<=9){const c=n.toLowerCase();if(c==="true")return!0;if(c==="false")return!1;if(c==="undefined")return;if(c==="null")return null;if(c==="nan")return Number.NaN;if(c==="infinity")return Number.POSITIVE_INFINITY;if(c==="-infinity")return Number.NEGATIVE_INFINITY}if(!Yn.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Xn.test(t)||qn.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,Zn)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function ti(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tt(t,...r){try{return ti(t(...r))}catch(n){return Promise.reject(n)}}function ei(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function ri(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function He(t){if(ei(t))return String(t);if(ri(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return He(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const er="base64:";function ni(t){return typeof t=="string"?t:er+oi(t)}function ii(t){return typeof t!="string"||!t.startsWith(er)?t:si(t.slice(er.length))}function si(t){return globalThis.Buffer?ct.dist.Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),r=>r.codePointAt(0))}function oi(t){return globalThis.Buffer?ct.dist.Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ut(t){var r;return t&&((r=t.split("?")[0])==null?void 0:r.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function ai(...t){return Ut(t.join(":"))}function Ke(t){return t=Ut(t),t?t+":":""}const fi="memory",ci=()=>{const t=new Map;return{name:fi,getInstance:()=>t,hasItem(r){return t.has(r)},getItem(r){return t.get(r)??null},getItemRaw(r){return t.get(r)??null},setItem(r,n){t.set(r,n)},setItemRaw(r,n){t.set(r,n)},removeItem(r){t.delete(r)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function ui(t={}){const r={mounts:{"":t.driver||ci()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=s=>{for(const u of r.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:r.mounts[u]};return{base:"",relativeKey:s,driver:r.mounts[""]}},c=(s,u)=>r.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:r.mounts[y]})),o=(s,u)=>{if(r.watching){u=Ut(u);for(const y of r.watchListeners)y(s,u)}},b=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await Er(r.mounts[s],o,s)}},I=async()=>{if(r.watching){for(const s in r.unwatch)await r.unwatch[s]();r.unwatch={},r.watching=!1}},E=(s,u,y)=>{const v=new Map,w=x=>{let N=v.get(x.base);return N||(N={driver:x.driver,base:x.base,items:[]},v.set(x.base,N)),N};for(const x of s){const N=typeof x=="string",G=Ut(N?x:x.key),ut=N?void 0:x.value,M=N||!x.options?u:{...u,...x.options},Lt=n(G);w(Lt).items.push({key:G,value:ut,relativeKey:Lt.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.hasItem,y,u)},getItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.getItem,y,u).then(w=>Be(w))},getItems(s,u={}){return E(s,u,y=>y.driver.getItems?Tt(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:ai(y.base,w.key),value:Be(w.value)}))):Promise.all(y.items.map(v=>Tt(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:Be(w)})))))},getItemRaw(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Tt(v.getItemRaw,y,u):Tt(v.getItem,y,u).then(w=>ii(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Ut(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Tt(w.setItem,v,He(u),y),w.watch||o("update",s))},async setItems(s,u){await E(s,u,async y=>{if(y.driver.setItems)return Tt(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:He(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Tt(y.driver.setItem,v.relativeKey,He(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Ut(s);const{relativeKey:v,driver:w}=n(s);if(w.setItemRaw)await Tt(w.setItemRaw,v,u,y);else if(w.setItem)await Tt(w.setItem,v,ni(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s);v.removeItem&&(await Tt(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Tt(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Tt(v.getMeta,y,u)),!u.nativeOnly){const x=await Tt(v.getItem,y+"$",u).then(N=>Be(N));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=Ke(s);const y=c(s,!0);let v=[];const w=[];for(const x of y){const N=await Tt(x.driver.getKeys,x.relativeBase,u);for(const G of N){const ut=x.mountpoint+Ut(G);v.some(M=>ut.startsWith(M))||w.push(ut)}v=[x.mountpoint,...v.filter(G=>!G.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=Ke(s),await Promise.all(c(s,!1).map(async y=>{if(y.driver.clear)return Tt(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(s=>Ir(s)))},async watch(s){return await b(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await I()}},async unwatch(){r.watchListeners=[],await I()},mount(s,u){if(s=Ke(s),s&&r.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(r.mountpoints.push(s),r.mountpoints.sort((y,v)=>v.length-y.length)),r.mounts[s]=u,r.watching&&Promise.resolve(Er(u,o,s)).then(y=>{r.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){var y,v;s=Ke(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&((v=(y=r.unwatch)[s])==null||v.call(y),delete r.unwatch[s]),u&&await Ir(r.mounts[s]),r.mountpoints=r.mountpoints.filter(w=>w!==s),delete r.mounts[s])},getMount(s=""){s=Ut(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Ut(s),c(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function Er(t,r,n){return t.watch?t.watch((c,o)=>r(c,n+o)):()=>{}}async function Ir(t){typeof t.dispose=="function"&&await Tt(t.dispose)}function be(t){return new Promise((r,n)=>{t.oncomplete=t.onsuccess=()=>r(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Hr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=be(n);return(o,b)=>c.then(I=>b(I.transaction(r,o).objectStore(r)))}let Ze;function Ae(){return Ze||(Ze=Hr("keyval-store","keyval")),Ze}function Sr(t,r=Ae()){return r("readonly",n=>be(n.get(t)))}function li(t,r,n=Ae()){return n("readwrite",c=>(c.put(r,t),be(c.transaction)))}function di(t,r=Ae()){return r("readwrite",n=>(n.delete(t),be(n.transaction)))}function hi(t=Ae()){return t("readwrite",r=>(r.clear(),be(r.transaction)))}function bi(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},be(t.transaction)}function gi(t=Ae()){return t("readonly",r=>{if(r.getAllKeys)return be(r.getAllKeys());const n=[];return bi(r,c=>n.push(c.key)).then(()=>n)})}const yi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),_i=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Gr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return _i(t)}catch{return t}}function $r(t){return typeof t=="string"?t:yi(t)||""}const pi="idb-keyval";var mi=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Hr(t.dbName,t.storeName)),{name:pi,options:t,async hasItem(o){return!(typeof await Sr(n(o),c)>"u")},async getItem(o){return await Sr(n(o),c)??null},setItem(o,b){return li(n(o),b,c)},removeItem(o){return di(n(o),c)},getKeys(){return gi(c)},clear(){return hi(c)}}};const xi="WALLET_CONNECT_V2_INDEXED_DB",wi="keyvaluestorage";let vi=class{constructor(){this.indexedDb=ui({driver:mi({dbName:xi,storeName:wi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const n=await this.indexedDb.getItem(r);if(n!==null)return n}async setItem(r,n){await this.indexedDb.setItem(r,$r(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof ct.dist.global<"u"?ct.dist.global:typeof self<"u"?self:{},Ge={exports:{}};(function(){let t;function r(){}t=r,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,c){this[n]=String(c)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(c){n[c]=void 0,delete n[c]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qe<"u"&&Qe.localStorage?Ge.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?Ge.exports=window.localStorage:Ge.exports=new r})();function Ei(t){var r;return[t[0],Gr((r=t[1])!=null?r:"")]}class Ii{constructor(){this.localStorage=Ge.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ei)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return Gr(n)}async setItem(r,n){this.localStorage.setItem(r,$r(n))}async removeItem(r){this.localStorage.removeItem(r)}}const Si="wc_storage_version",Or=1,Oi=async(t,r,n)=>{const c=Si,o=await r.getItem(c);if(o&&o>=Or){n(r);return}const b=await t.getKeys();if(!b.length){n(r);return}const I=[];for(;b.length;){const E=b.shift();if(!E)continue;const g=E.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await t.getItem(E);await r.setItem(E,s),I.push(E)}}await r.setItem(c,Or),n(r),Ti(t,I)},Ti=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};class Li{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Ii;this.storage=r;try{const n=new vi;Oi(r,n,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,n){return await this.initialize(),this.storage.setItem(r,n)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),r())},20)})}}class Ai{}function Ri(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var ji=Pi;function Pi(t,r,n){var c=n&&n.stringify||Ri,o=1;if(typeof t=="object"&&t!==null){var b=r.length+o;if(b===1)return t;var I=new Array(b);I[0]=c(t);for(var E=1;E<b;E++)I[E]=c(r[E]);return I.join(" ")}if(typeof t!="string")return t;var g=r.length;if(g===0)return t;for(var s="",u=1-o,y=-1,v=t&&t.length||0,w=0;w<v;){if(t.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,t.charCodeAt(w+1)){case 100:case 102:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Number(r[u]),y=w+2,w++;break;case 105:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Math.floor(Number(r[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||r[u]===void 0)break;y<w&&(s+=t.slice(y,w));var x=typeof r[u];if(x==="string"){s+="'"+r[u]+"'",y=w+2,w++;break}if(x==="function"){s+=r[u].name||"<anonymous>",y=w+2,w++;break}s+=c(r[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=t.slice(y,w)),s+=String(r[u]),y=w+2,w++;break;case 37:y<w&&(s+=t.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?t:(y<v&&(s+=t.slice(y)),s)}const Tr=ji;var me=Qt;const Se=Gi().console||{},Ci={mapHttpRequest:Ue,mapHttpResponse:Ue,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:Ue,res:Ue,err:Bi};function Ni(t,r){return Array.isArray(t)?t.filter(function(c){return c!=="!stdSerializers.err"}):t===!0?Object.keys(r):!1}function Qt(t){t=t||{},t.browser=t.browser||{};const r=t.browser.transmit;if(r&&typeof r.send!="function")throw Error("pino: transmit option must have a send function");const n=t.browser.write||Se;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=Ni(t.browser.serialize,c);let b=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(b=!1);const I=["error","fatal","warn","info","debug","trace"];typeof n=="function"&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),t.enabled===!1&&(t.level="silent");const E=t.level||"info",g=Object.create(n);g.log||(g.log=Oe),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:r,serialize:o,asObject:t.browser.asObject,levels:I,timestamp:Ki(t)};g.levels=Qt.levels,g.level=E,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Oe,g.serializers=c,g._serialize=o,g._stdErrSerialize=b,g.child=w,r&&(g._logEvent=rr());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,_e(s,g,"error","log"),_e(s,g,"fatal","error"),_e(s,g,"warn","error"),_e(s,g,"info","log"),_e(s,g,"debug","log"),_e(s,g,"trace","log")}function w(x,N){if(!x)throw new Error("missing bindings for child Pino");N=N||{},o&&x.serializers&&(N.serializers=x.serializers);const G=N.serializers;if(o&&G){var ut=Object.assign({},c,G),M=t.browser.serialize===!0?Object.keys(ut):o;delete x.serializers,ke([x],M,ut,this._stdErrSerialize)}function Lt(gt){this._childLevel=(gt._childLevel|0)+1,this.error=pe(gt,x,"error"),this.fatal=pe(gt,x,"fatal"),this.warn=pe(gt,x,"warn"),this.info=pe(gt,x,"info"),this.debug=pe(gt,x,"debug"),this.trace=pe(gt,x,"trace"),ut&&(this.serializers=ut,this._serialize=M),r&&(this._logEvent=rr([].concat(gt._logEvent.bindings,x)))}return Lt.prototype=this,new Lt(this)}return g}Qt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qt.stdSerializers=Ci;Qt.stdTimeFunctions=Object.assign({},{nullTime:Fr,epochTime:Jr,unixTime:Ui,isoTime:Hi});function _e(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Se[n]||Se[c]||Oe,Mi(t,r,n)}function Mi(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const b=t.timestamp(),I=new Array(arguments.length),E=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Se?Se:this;for(var g=0;g<I.length;g++)I[g]=arguments[g];if(t.serialize&&!t.asObject&&ke(I,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(E,zi(this,n,I,b)):c.apply(E,I),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Di(this,{ts:b,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},I)}}}(r[n]))}function zi(t,r,n,c){t._serialize&&ke(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let b=o[0];const I={};c&&(I.time=c),I.level=Qt.levels.values[r];let E=(t._childLevel|0)+1;if(E<1&&(E=1),b!==null&&typeof b=="object"){for(;E--&&typeof o[0]=="object";)Object.assign(I,o.shift());b=o.length?Tr(o.shift(),o):void 0}else typeof b=="string"&&(b=Tr(o.shift(),o));return b!==void 0&&(I.msg=b),I}function ke(t,r,n,c){for(const o in t)if(c&&t[o]instanceof Error)t[o]=Qt.stdSerializers.err(t[o]);else if(typeof t[o]=="object"&&!Array.isArray(t[o]))for(const b in t[o])r&&r.indexOf(b)>-1&&b in n&&(t[o][b]=n[b](t[o][b]))}function pe(t,r,n){return function(){const c=new Array(1+arguments.length);c[0]=r;for(var o=1;o<c.length;o++)c[o]=arguments[o-1];return t[n].apply(this,c)}}function Di(t,r,n){const c=r.send,o=r.ts,b=r.methodLevel,I=r.methodValue,E=r.val,g=t._logEvent.bindings;ke(n,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(s){return g.indexOf(s)===-1}),t._logEvent.level.label=b,t._logEvent.level.value=I,c(b,t._logEvent,E),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Bi(t){const r={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)r[n]===void 0&&(r[n]=t[n]);return r}function Ki(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Fr:Jr}function Ue(){return{}}function tr(t){return t}function Oe(){}function Fr(){return!1}function Jr(){return Date.now()}function Ui(){return Math.round(Date.now()/1e3)}function Hi(){return new Date(Date.now()).toISOString()}function Gi(){function t(r){return typeof r<"u"&&r}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const or=ct.getDefaultExportFromCjs(me),$i=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Lr(t){return typeof t=="string"?t:$i(t)||""}const Fi={level:"info"},Re="custom_context",ar=1e3*1024;class Ji{constructor(r){this.nodeValue=r,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ar{constructor(r){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=r,this.sizeInBytes=0}append(r){const n=new Ji(r);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${r} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const r=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=r.size}toArray(){const r=[];let n=this.head;for(;n!==null;)r.push(n.value),n=n.next;return r}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let r=this.head;return{next:()=>{if(!r)return{done:!0,value:null};const n=r.value;return r=r.next,{done:!1,value:n}}}}}class Wr{constructor(r,n=ar){this.level=r??"error",this.levelValue=me.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(r,n){n===me.levels.values.error?console.error(r):n===me.levels.values.warn?console.warn(r):n===me.levels.values.debug?console.debug(r):n===me.levels.values.trace?console.trace(r):console.log(r)}appendToLogs(r){this.logs.append(Lr({timestamp:new Date().toISOString(),log:r}));const n=typeof r=="string"?JSON.parse(r).level:r.level;n>=this.levelValue&&this.forwardToConsole(r,n)}getLogs(){return this.logs}clearLogs(){this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(r){const n=this.getLogArray();return n.push(Lr({extraMetadata:r})),new Blob(n,{type:"application/json"})}}class Wi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}downloadLogsBlobInBrowser(r){const n=URL.createObjectURL(this.logsToBlob(r)),c=document.createElement("a");c.href=n,c.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(n)}}class Vi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}}var ki=Object.defineProperty,Xi=Object.defineProperties,qi=Object.getOwnPropertyDescriptors,Rr=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,jr=(t,r,n)=>r in t?ki(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,$e=(t,r)=>{for(var n in r||(r={}))Yi.call(r,n)&&jr(t,n,r[n]);if(Rr)for(var n of Rr(r))Zi.call(r,n)&&jr(t,n,r[n]);return t},Fe=(t,r)=>Xi(t,qi(r));function Qi(t){return Fe($e({},t),{level:(t==null?void 0:t.level)||Fi.level})}function ts(t,r=Re){return t[r]||""}function es(t,r,n=Re){return t[n]=r,t}function Vr(t,r=Re){let n="";return typeof t.bindings>"u"?n=ts(t,r):n=t.bindings().context||"",n}function rs(t,r,n=Re){const c=Vr(t,n);return c.trim()?`${c}/${r}`:r}function ns(t,r,n=Re){const c=rs(t,r,n),o=t.child({context:c});return es(o,c,n)}function is(t){var r,n;const c=new Wi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace",browser:Fe($e({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function ss(t){var r;const n=new Vi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function os(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?is(t):ss(t)}var fr={},kr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Dt.binary,n=Dt.wipe;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var c=function(){function E(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return E.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},E.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},E.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},E.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},E.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;r.writeUint32BE(y,this._buffer,w-8),r.writeUint32BE(v,this._buffer,w-4),b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)r.writeUint32BE(this._stateHi[x],g,x*8),r.writeUint32BE(this._stateLo[x],g,x*8+4);return this},E.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},E.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},E.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},E.prototype.cleanSavedState=function(g){n.wipe(g.stateHi),n.wipe(g.stateLo),g.buffer&&n.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},E}();t.SHA512=c;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function b(E,g,s,u,y,v,w){for(var x=s[0],N=s[1],G=s[2],ut=s[3],M=s[4],Lt=s[5],gt=s[6],Ct=s[7],$=u[0],C=u[1],Nt=u[2],te=u[3],yt=u[4],Wt=u[5],Ht=u[6],Xt=u[7],m,p,X,lt,A,S,O,L;w>=128;){for(var At=0;At<16;At++){var et=8*At+v;E[At]=r.readUint32BE(y,et),g[At]=r.readUint32BE(y,et+4)}for(var At=0;At<80;At++){var xe=x,z=N,ge=G,h=ut,d=M,l=Lt,e=gt,a=Ct,R=$,j=C,B=Nt,K=te,D=yt,U=Wt,Rt=Ht,dt=Xt;if(m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(M>>>14|yt<<18)^(M>>>18|yt<<14)^(yt>>>9|M<<23),p=(yt>>>14|M<<18)^(yt>>>18|M<<14)^(M>>>9|yt<<23),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=M&Lt^~M>,p=yt&Wt^~yt&Ht,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=o[At*2],p=o[At*2+1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=E[At%16],p=g[At%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,X=O&65535|L<<16,lt=A&65535|S<<16,m=X,p=lt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(x>>>28|$<<4)^($>>>2|x<<30)^($>>>7|x<<25),p=($>>>28|x<<4)^(x>>>2|$<<30)^(x>>>7|$<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&G^N&G,p=$&C^$&Nt^C&Nt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,a=O&65535|L<<16,dt=A&65535|S<<16,m=h,p=K,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=X,p=lt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,h=O&65535|L<<16,K=A&65535|S<<16,N=xe,G=z,ut=ge,M=h,Lt=d,gt=l,Ct=e,x=a,C=R,Nt=j,te=B,yt=K,Wt=D,Ht=U,Xt=Rt,$=dt,At%16===15)for(var et=0;et<16;et++)m=E[et],p=g[et],A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=E[(et+9)%16],p=g[(et+9)%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+1)%16],lt=g[(et+1)%16],m=(X>>>1|lt<<31)^(X>>>8|lt<<24)^X>>>7,p=(lt>>>1|X<<31)^(lt>>>8|X<<24)^(lt>>>7|X<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+14)%16],lt=g[(et+14)%16],m=(X>>>19|lt<<13)^(lt>>>29|X<<3)^X>>>6,p=(lt>>>19|X<<13)^(X>>>29|lt<<3)^(lt>>>6|X<<26),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,E[et]=O&65535|L<<16,g[et]=A&65535|S<<16}m=x,p=$,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[0],p=u[0],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=$=A&65535|S<<16,m=N,p=C,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[1],p=u[1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=C=A&65535|S<<16,m=G,p=Nt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[2],p=u[2],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[2]=G=O&65535|L<<16,u[2]=Nt=A&65535|S<<16,m=ut,p=te,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[3],p=u[3],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[3]=ut=O&65535|L<<16,u[3]=te=A&65535|S<<16,m=M,p=yt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[4],p=u[4],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=yt=A&65535|S<<16,m=Lt,p=Wt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[5],p=u[5],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[5]=Lt=O&65535|L<<16,u[5]=Wt=A&65535|S<<16,m=gt,p=Ht,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[6],p=u[6],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[6]=gt=O&65535|L<<16,u[6]=Ht=A&65535|S<<16,m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[7],p=u[7],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=Xt=A&65535|S<<16,v+=128,w-=128}return v}function I(E){var g=new c;g.update(E);var s=g.digest();return g.clean(),s}t.hash=I})(kr);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const r=Dt.random,n=kr,c=Dt.wipe;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(h){const d=new Float64Array(16);if(h)for(let l=0;l<h.length;l++)d[l]=h[l];return d}const b=new Uint8Array(32);b[0]=9;const I=o(),E=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(h,d){for(let l=0;l<16;l++)h[l]=d[l]|0}function x(h){let d=1;for(let l=0;l<16;l++){let e=h[l]+d+65535;d=Math.floor(e/65536),h[l]=e-d*65536}h[0]+=d-1+37*(d-1)}function N(h,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(h[a]^d[a]);h[a]^=R,d[a]^=R}}function G(h,d){const l=o(),e=o();for(let a=0;a<16;a++)e[a]=d[a];x(e),x(e),x(e);for(let a=0;a<2;a++){l[0]=e[0]-65517;for(let j=1;j<15;j++)l[j]=e[j]-65535-(l[j-1]>>16&1),l[j-1]&=65535;l[15]=e[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,N(e,l,1-R)}for(let a=0;a<16;a++)h[2*a]=e[a]&255,h[2*a+1]=e[a]>>8}function ut(h,d){let l=0;for(let e=0;e<32;e++)l|=h[e]^d[e];return(1&l-1>>>8)-1}function M(h,d){const l=new Uint8Array(32),e=new Uint8Array(32);return G(l,h),G(e,d),ut(l,e)}function Lt(h){const d=new Uint8Array(32);return G(d,h),d[0]&1}function gt(h,d){for(let l=0;l<16;l++)h[l]=d[2*l]+(d[2*l+1]<<8);h[15]&=32767}function Ct(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]+l[e]}function $(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]-l[e]}function C(h,d,l){let e,a,R=0,j=0,B=0,K=0,D=0,U=0,Rt=0,dt=0,jt=0,_t=0,ht=0,rt=0,tt=0,q=0,V=0,H=0,nt=0,pt=0,F=0,Mt=0,Bt=0,Gt=0,$t=0,Kt=0,qt=0,Zt=0,se=0,Ft=0,ce=0,we=0,je=0,it=l[0],Y=l[1],st=l[2],ot=l[3],at=l[4],Z=l[5],mt=l[6],xt=l[7],wt=l[8],vt=l[9],Et=l[10],bt=l[11],ft=l[12],W=l[13],It=l[14],St=l[15];e=d[0],R+=e*it,j+=e*Y,B+=e*st,K+=e*ot,D+=e*at,U+=e*Z,Rt+=e*mt,dt+=e*xt,jt+=e*wt,_t+=e*vt,ht+=e*Et,rt+=e*bt,tt+=e*ft,q+=e*W,V+=e*It,H+=e*St,e=d[1],j+=e*it,B+=e*Y,K+=e*st,D+=e*ot,U+=e*at,Rt+=e*Z,dt+=e*mt,jt+=e*xt,_t+=e*wt,ht+=e*vt,rt+=e*Et,tt+=e*bt,q+=e*ft,V+=e*W,H+=e*It,nt+=e*St,e=d[2],B+=e*it,K+=e*Y,D+=e*st,U+=e*ot,Rt+=e*at,dt+=e*Z,jt+=e*mt,_t+=e*xt,ht+=e*wt,rt+=e*vt,tt+=e*Et,q+=e*bt,V+=e*ft,H+=e*W,nt+=e*It,pt+=e*St,e=d[3],K+=e*it,D+=e*Y,U+=e*st,Rt+=e*ot,dt+=e*at,jt+=e*Z,_t+=e*mt,ht+=e*xt,rt+=e*wt,tt+=e*vt,q+=e*Et,V+=e*bt,H+=e*ft,nt+=e*W,pt+=e*It,F+=e*St,e=d[4],D+=e*it,U+=e*Y,Rt+=e*st,dt+=e*ot,jt+=e*at,_t+=e*Z,ht+=e*mt,rt+=e*xt,tt+=e*wt,q+=e*vt,V+=e*Et,H+=e*bt,nt+=e*ft,pt+=e*W,F+=e*It,Mt+=e*St,e=d[5],U+=e*it,Rt+=e*Y,dt+=e*st,jt+=e*ot,_t+=e*at,ht+=e*Z,rt+=e*mt,tt+=e*xt,q+=e*wt,V+=e*vt,H+=e*Et,nt+=e*bt,pt+=e*ft,F+=e*W,Mt+=e*It,Bt+=e*St,e=d[6],Rt+=e*it,dt+=e*Y,jt+=e*st,_t+=e*ot,ht+=e*at,rt+=e*Z,tt+=e*mt,q+=e*xt,V+=e*wt,H+=e*vt,nt+=e*Et,pt+=e*bt,F+=e*ft,Mt+=e*W,Bt+=e*It,Gt+=e*St,e=d[7],dt+=e*it,jt+=e*Y,_t+=e*st,ht+=e*ot,rt+=e*at,tt+=e*Z,q+=e*mt,V+=e*xt,H+=e*wt,nt+=e*vt,pt+=e*Et,F+=e*bt,Mt+=e*ft,Bt+=e*W,Gt+=e*It,$t+=e*St,e=d[8],jt+=e*it,_t+=e*Y,ht+=e*st,rt+=e*ot,tt+=e*at,q+=e*Z,V+=e*mt,H+=e*xt,nt+=e*wt,pt+=e*vt,F+=e*Et,Mt+=e*bt,Bt+=e*ft,Gt+=e*W,$t+=e*It,Kt+=e*St,e=d[9],_t+=e*it,ht+=e*Y,rt+=e*st,tt+=e*ot,q+=e*at,V+=e*Z,H+=e*mt,nt+=e*xt,pt+=e*wt,F+=e*vt,Mt+=e*Et,Bt+=e*bt,Gt+=e*ft,$t+=e*W,Kt+=e*It,qt+=e*St,e=d[10],ht+=e*it,rt+=e*Y,tt+=e*st,q+=e*ot,V+=e*at,H+=e*Z,nt+=e*mt,pt+=e*xt,F+=e*wt,Mt+=e*vt,Bt+=e*Et,Gt+=e*bt,$t+=e*ft,Kt+=e*W,qt+=e*It,Zt+=e*St,e=d[11],rt+=e*it,tt+=e*Y,q+=e*st,V+=e*ot,H+=e*at,nt+=e*Z,pt+=e*mt,F+=e*xt,Mt+=e*wt,Bt+=e*vt,Gt+=e*Et,$t+=e*bt,Kt+=e*ft,qt+=e*W,Zt+=e*It,se+=e*St,e=d[12],tt+=e*it,q+=e*Y,V+=e*st,H+=e*ot,nt+=e*at,pt+=e*Z,F+=e*mt,Mt+=e*xt,Bt+=e*wt,Gt+=e*vt,$t+=e*Et,Kt+=e*bt,qt+=e*ft,Zt+=e*W,se+=e*It,Ft+=e*St,e=d[13],q+=e*it,V+=e*Y,H+=e*st,nt+=e*ot,pt+=e*at,F+=e*Z,Mt+=e*mt,Bt+=e*xt,Gt+=e*wt,$t+=e*vt,Kt+=e*Et,qt+=e*bt,Zt+=e*ft,se+=e*W,Ft+=e*It,ce+=e*St,e=d[14],V+=e*it,H+=e*Y,nt+=e*st,pt+=e*ot,F+=e*at,Mt+=e*Z,Bt+=e*mt,Gt+=e*xt,$t+=e*wt,Kt+=e*vt,qt+=e*Et,Zt+=e*bt,se+=e*ft,Ft+=e*W,ce+=e*It,we+=e*St,e=d[15],H+=e*it,nt+=e*Y,pt+=e*st,F+=e*ot,Mt+=e*at,Bt+=e*Z,Gt+=e*mt,$t+=e*xt,Kt+=e*wt,qt+=e*vt,Zt+=e*Et,se+=e*bt,Ft+=e*ft,ce+=e*W,we+=e*It,je+=e*St,R+=38*nt,j+=38*pt,B+=38*F,K+=38*Mt,D+=38*Bt,U+=38*Gt,Rt+=38*$t,dt+=38*Kt,jt+=38*qt,_t+=38*Zt,ht+=38*se,rt+=38*Ft,tt+=38*ce,q+=38*we,V+=38*je,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),h[0]=R,h[1]=j,h[2]=B,h[3]=K,h[4]=D,h[5]=U,h[6]=Rt,h[7]=dt,h[8]=jt,h[9]=_t,h[10]=ht,h[11]=rt,h[12]=tt,h[13]=q,h[14]=V,h[15]=H}function Nt(h,d){C(h,d,d)}function te(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=253;e>=0;e--)Nt(l,l),e!==2&&e!==4&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function yt(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=250;e>=0;e--)Nt(l,l),e!==1&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function Wt(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o(),D=o(),U=o();$(l,h[1],h[0]),$(U,d[1],d[0]),C(l,l,U),Ct(e,h[0],h[1]),Ct(U,d[0],d[1]),C(e,e,U),C(a,h[3],d[3]),C(a,a,s),C(R,h[2],d[2]),Ct(R,R,R),$(j,e,l),$(B,R,a),Ct(K,R,a),Ct(D,e,l),C(h[0],j,B),C(h[1],D,K),C(h[2],K,B),C(h[3],j,D)}function Ht(h,d,l){for(let e=0;e<4;e++)N(h[e],d[e],l)}function Xt(h,d){const l=o(),e=o(),a=o();te(a,d[2]),C(l,d[0],a),C(e,d[1],a),G(h,e),h[31]^=Lt(l)<<7}function m(h,d,l){w(h[0],I),w(h[1],E),w(h[2],E),w(h[3],I);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;Ht(h,d,a),Wt(d,h),Wt(h,h),Ht(h,d,a)}}function p(h,d){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],E),C(l[3],u,y),m(h,l,d)}function X(h){if(h.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(h);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];p(e,d),Xt(l,e);const a=new Uint8Array(64);return a.set(h),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function lt(h){const d=(0,r.randomBytes)(32,h),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=lt;function A(h){if(h.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(h.subarray(32))}t.extractPublicKeyFromSecretKey=A;const S=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 O(h,d){let l,e,a,R;for(e=63;e>=32;--e){for(l=0,a=e-32,R=e-12;a<R;++a)d[a]+=l-16*d[e]*S[a-(e-32)],l=Math.floor((d[a]+128)/256),d[a]-=l*256;d[a]+=l,d[e]=0}for(l=0,a=0;a<32;a++)d[a]+=l-(d[31]>>4)*S[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*S[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,h[e]=d[e]&255}function L(h){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=h[l];for(let l=0;l<64;l++)h[l]=0;O(h,d)}function At(h,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(h.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const j=new n.SHA512;j.update(R.subarray(32)),j.update(d);const B=j.digest();j.clean(),L(B),p(e,B),Xt(R,e),j.reset(),j.update(R.subarray(0,32)),j.update(h.subarray(32)),j.update(d);const K=j.digest();L(K);for(let D=0;D<32;D++)l[D]=B[D];for(let D=0;D<32;D++)for(let U=0;U<32;U++)l[D+U]+=K[D]*a[U];return O(R.subarray(32),l),R}t.sign=At;function et(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o();return w(h[2],E),gt(h[1],d),Nt(a,h[1]),C(R,a,g),$(a,a,h[2]),Ct(R,h[2],R),Nt(j,R),Nt(B,j),C(K,B,j),C(l,K,a),C(l,l,R),yt(l,l),C(l,l,a),C(l,l,R),C(l,l,R),C(h[0],l,R),Nt(e,h[0]),C(e,e,R),M(e,a)&&C(h[0],h[0],v),Nt(e,h[0]),C(e,e,R),M(e,a)?-1:(Lt(h[0])===d[31]>>7&&$(h[0],I,h[0]),C(h[3],h[0],h[1]),0)}function xe(h,d,l){const e=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(et(R,h))return!1;const j=new n.SHA512;j.update(l.subarray(0,32)),j.update(h),j.update(d);const B=j.digest();return L(B),m(a,R,B),p(R,l.subarray(32)),Wt(a,R),Xt(e,a),!ut(l,e)}t.verify=xe;function z(h){let d=[o(),o(),o(),o()];if(et(d,h))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,E,a),$(e,E,a),te(e,e),C(l,l,e);let R=new Uint8Array(32);return G(R,l),R}t.convertPublicKeyToX25519=z;function ge(h){const d=(0,n.hash)(h.subarray(0,32));d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(d.subarray(0,32));return(0,c.wipe)(d),l}t.convertSecretKeyToX25519=ge})(fr);const as="EdDSA",fs="JWT",Je=".",Xe="base64url",Xr="utf8",qr="utf8",cs=":",us="did",ls="key",Pr="base58btc",ds="z",hs="K36",bs=32,gs=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),ys=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function _s(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ys(t)}catch{return t}}function ps(t){return typeof t=="string"?t:gs(t)||""}function Cr(t){return _s(Le(he(t,Xe),Xr))}function We(t){return Le(he(ps(t),Xr),Xe)}function Yr(t){const r=he(hs,Pr),n=ds+Le(Br([r,t]),Pr);return[us,ls,n].join(cs)}function ms(t){return Le(t,Xe)}function xs(t){return he(t,Xe)}function ws(t){return he([We(t.header),We(t.payload)].join(Je),qr)}function vs(t){return[We(t.header),We(t.payload),ms(t.signature)].join(Je)}function Es(t){const r=t.split(Je),n=Cr(r[0]),c=Cr(r[1]),o=xs(r[2]),b=he(r.slice(0,2).join(Je),qr);return{header:n,payload:c,signature:o,data:b}}function Is(t=Dt.random.randomBytes(bs)){return fr.generateKeyPairFromSeed(t)}async function Ss(t,r,n,c,o=Dt.cjs.fromMiliseconds(Date.now())){const b={alg:as,typ:fs},I=Yr(c.publicKey),E=o+n,g={iss:I,sub:t,aud:r,iat:o,exp:E},s=ws({header:b,payload:g}),u=fr.sign(c.secretKey,s);return vs({header:b,payload:g,signature:u})}const Os="PARSE_ERROR",Ts="INVALID_REQUEST",Ls="METHOD_NOT_FOUND",As="INVALID_PARAMS",Zr="INTERNAL_ERROR",cr="SERVER_ERROR",Rs=[-32700,-32600,-32601,-32602,-32603],Ie={[Os]:{code:-32700,message:"Parse error"},[Ts]:{code:-32600,message:"Invalid Request"},[Ls]:{code:-32601,message:"Method not found"},[As]:{code:-32602,message:"Invalid params"},[Zr]:{code:-32603,message:"Internal error"},[cr]:{code:-32e3,message:"Server error"}},Qr=cr;function js(t){return Rs.includes(t)}function Nr(t){return Object.keys(Ie).includes(t)?Ie[t]:Ie[Qr]}function Ps(t){const r=Object.values(Ie).find(n=>n.code===t);return r||Ie[Qr]}function Cs(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var tn={};/*! *****************************************************************************
|
|
1
|
+
"use strict";const ct=require("./index-D5ta6SAe.js"),Dt=require("./index-OdUgDqqR.js");function Dr(t=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(t):new Uint8Array(t)}function Br(t,r){r||(r=t.reduce((o,b)=>o+b.length,0));const n=Dr(r);let c=0;for(const o of t)n.set(o,c),c+=o.length;return n}const wr={...Dt.identityBase,...Dt.base2,...Dt.base8,...Dt.base10,...Dt.base16,...Dt.base32,...Dt.base36,...Dt.base58,...Dt.base64,...Dt.base256emoji};function Kr(t,r,n,c){return{name:t,prefix:r,encoder:{name:t,prefix:r,encode:n},decoder:{decode:c}}}const vr=Kr("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>new TextEncoder().encode(t.substring(1))),Ye=Kr("ascii","a",t=>{let r="a";for(let n=0;n<t.length;n++)r+=String.fromCharCode(t[n]);return r},t=>{t=t.substring(1);const r=Dr(t.length);for(let n=0;n<t.length;n++)r[n]=t.charCodeAt(n);return r}),Ur={utf8:vr,"utf-8":vr,hex:wr.base16,latin1:Ye,ascii:Ye,binary:Ye,...wr};function he(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t,"utf8"):n.decoder.decode(`${n.prefix}${t}`)}function Le(t,r="utf8"){const n=Ur[r];if(!n)throw new Error(`Unsupported encoding "${r}"`);return(r==="utf8"||r==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8"):n.encoder.encode(t).substring(1)}const kn={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}},Xn=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,qn=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,Yn=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function Zn(t,r){if(t==="__proto__"||t==="constructor"&&r&&typeof r=="object"&&"prototype"in r){Qn(t);return}return r}function Qn(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}function Be(t,r={}){if(typeof t!="string")return t;const n=t.trim();if(t[0]==='"'&&t.endsWith('"')&&!t.includes("\\"))return n.slice(1,-1);if(n.length<=9){const c=n.toLowerCase();if(c==="true")return!0;if(c==="false")return!1;if(c==="undefined")return;if(c==="null")return null;if(c==="nan")return Number.NaN;if(c==="infinity")return Number.POSITIVE_INFINITY;if(c==="-infinity")return Number.NEGATIVE_INFINITY}if(!Yn.test(t)){if(r.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(Xn.test(t)||qn.test(t)){if(r.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,Zn)}return JSON.parse(t)}catch(c){if(r.strict)throw c;return t}}function ti(t){return!t||typeof t.then!="function"?Promise.resolve(t):t}function Tt(t,...r){try{return ti(t(...r))}catch(n){return Promise.reject(n)}}function ei(t){const r=typeof t;return t===null||r!=="object"&&r!=="function"}function ri(t){const r=Object.getPrototypeOf(t);return!r||r.isPrototypeOf(Object)}function He(t){if(ei(t))return String(t);if(ri(t)||Array.isArray(t))return JSON.stringify(t);if(typeof t.toJSON=="function")return He(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const er="base64:";function ni(t){return typeof t=="string"?t:er+oi(t)}function ii(t){return typeof t!="string"||!t.startsWith(er)?t:si(t.slice(er.length))}function si(t){return globalThis.Buffer?ct.dist.Buffer.from(t,"base64"):Uint8Array.from(globalThis.atob(t),r=>r.codePointAt(0))}function oi(t){return globalThis.Buffer?ct.dist.Buffer.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}function Ut(t){var r;return t&&((r=t.split("?")[0])==null?void 0:r.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function ai(...t){return Ut(t.join(":"))}function Ke(t){return t=Ut(t),t?t+":":""}const fi="memory",ci=()=>{const t=new Map;return{name:fi,getInstance:()=>t,hasItem(r){return t.has(r)},getItem(r){return t.get(r)??null},getItemRaw(r){return t.get(r)??null},setItem(r,n){t.set(r,n)},setItemRaw(r,n){t.set(r,n)},removeItem(r){t.delete(r)},getKeys(){return[...t.keys()]},clear(){t.clear()},dispose(){t.clear()}}};function ui(t={}){const r={mounts:{"":t.driver||ci()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},n=s=>{for(const u of r.mountpoints)if(s.startsWith(u))return{base:u,relativeKey:s.slice(u.length),driver:r.mounts[u]};return{base:"",relativeKey:s,driver:r.mounts[""]}},c=(s,u)=>r.mountpoints.filter(y=>y.startsWith(s)||u&&s.startsWith(y)).map(y=>({relativeBase:s.length>y.length?s.slice(y.length):void 0,mountpoint:y,driver:r.mounts[y]})),o=(s,u)=>{if(r.watching){u=Ut(u);for(const y of r.watchListeners)y(s,u)}},b=async()=>{if(!r.watching){r.watching=!0;for(const s in r.mounts)r.unwatch[s]=await Er(r.mounts[s],o,s)}},I=async()=>{if(r.watching){for(const s in r.unwatch)await r.unwatch[s]();r.unwatch={},r.watching=!1}},E=(s,u,y)=>{const v=new Map,w=x=>{let N=v.get(x.base);return N||(N={driver:x.driver,base:x.base,items:[]},v.set(x.base,N)),N};for(const x of s){const N=typeof x=="string",G=Ut(N?x:x.key),ut=N?void 0:x.value,M=N||!x.options?u:{...u,...x.options},Lt=n(G);w(Lt).items.push({key:G,value:ut,relativeKey:Lt.relativeKey,options:M})}return Promise.all([...v.values()].map(x=>y(x))).then(x=>x.flat())},g={hasItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.hasItem,y,u)},getItem(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return Tt(v.getItem,y,u).then(w=>Be(w))},getItems(s,u={}){return E(s,u,y=>y.driver.getItems?Tt(y.driver.getItems,y.items.map(v=>({key:v.relativeKey,options:v.options})),u).then(v=>v.map(w=>({key:ai(y.base,w.key),value:Be(w.value)}))):Promise.all(y.items.map(v=>Tt(y.driver.getItem,v.relativeKey,v.options).then(w=>({key:v.key,value:Be(w)})))))},getItemRaw(s,u={}){s=Ut(s);const{relativeKey:y,driver:v}=n(s);return v.getItemRaw?Tt(v.getItemRaw,y,u):Tt(v.getItem,y,u).then(w=>ii(w))},async setItem(s,u,y={}){if(u===void 0)return g.removeItem(s);s=Ut(s);const{relativeKey:v,driver:w}=n(s);w.setItem&&(await Tt(w.setItem,v,He(u),y),w.watch||o("update",s))},async setItems(s,u){await E(s,u,async y=>{if(y.driver.setItems)return Tt(y.driver.setItems,y.items.map(v=>({key:v.relativeKey,value:He(v.value),options:v.options})),u);y.driver.setItem&&await Promise.all(y.items.map(v=>Tt(y.driver.setItem,v.relativeKey,He(v.value),v.options)))})},async setItemRaw(s,u,y={}){if(u===void 0)return g.removeItem(s,y);s=Ut(s);const{relativeKey:v,driver:w}=n(s);if(w.setItemRaw)await Tt(w.setItemRaw,v,u,y);else if(w.setItem)await Tt(w.setItem,v,ni(u),y);else return;w.watch||o("update",s)},async removeItem(s,u={}){typeof u=="boolean"&&(u={removeMeta:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s);v.removeItem&&(await Tt(v.removeItem,y,u),(u.removeMeta||u.removeMata)&&await Tt(v.removeItem,y+"$",u),v.watch||o("remove",s))},async getMeta(s,u={}){typeof u=="boolean"&&(u={nativeOnly:u}),s=Ut(s);const{relativeKey:y,driver:v}=n(s),w=Object.create(null);if(v.getMeta&&Object.assign(w,await Tt(v.getMeta,y,u)),!u.nativeOnly){const x=await Tt(v.getItem,y+"$",u).then(N=>Be(N));x&&typeof x=="object"&&(typeof x.atime=="string"&&(x.atime=new Date(x.atime)),typeof x.mtime=="string"&&(x.mtime=new Date(x.mtime)),Object.assign(w,x))}return w},setMeta(s,u,y={}){return this.setItem(s+"$",u,y)},removeMeta(s,u={}){return this.removeItem(s+"$",u)},async getKeys(s,u={}){s=Ke(s);const y=c(s,!0);let v=[];const w=[];for(const x of y){const N=await Tt(x.driver.getKeys,x.relativeBase,u);for(const G of N){const ut=x.mountpoint+Ut(G);v.some(M=>ut.startsWith(M))||w.push(ut)}v=[x.mountpoint,...v.filter(G=>!G.startsWith(x.mountpoint))]}return s?w.filter(x=>x.startsWith(s)&&x[x.length-1]!=="$"):w.filter(x=>x[x.length-1]!=="$")},async clear(s,u={}){s=Ke(s),await Promise.all(c(s,!1).map(async y=>{if(y.driver.clear)return Tt(y.driver.clear,y.relativeBase,u);if(y.driver.removeItem){const v=await y.driver.getKeys(y.relativeBase||"",u);return Promise.all(v.map(w=>y.driver.removeItem(w,u)))}}))},async dispose(){await Promise.all(Object.values(r.mounts).map(s=>Ir(s)))},async watch(s){return await b(),r.watchListeners.push(s),async()=>{r.watchListeners=r.watchListeners.filter(u=>u!==s),r.watchListeners.length===0&&await I()}},async unwatch(){r.watchListeners=[],await I()},mount(s,u){if(s=Ke(s),s&&r.mounts[s])throw new Error(`already mounted at ${s}`);return s&&(r.mountpoints.push(s),r.mountpoints.sort((y,v)=>v.length-y.length)),r.mounts[s]=u,r.watching&&Promise.resolve(Er(u,o,s)).then(y=>{r.unwatch[s]=y}).catch(console.error),g},async unmount(s,u=!0){var y,v;s=Ke(s),!(!s||!r.mounts[s])&&(r.watching&&s in r.unwatch&&((v=(y=r.unwatch)[s])==null||v.call(y),delete r.unwatch[s]),u&&await Ir(r.mounts[s]),r.mountpoints=r.mountpoints.filter(w=>w!==s),delete r.mounts[s])},getMount(s=""){s=Ut(s)+":";const u=n(s);return{driver:u.driver,base:u.base}},getMounts(s="",u={}){return s=Ut(s),c(s,u.parents).map(v=>({driver:v.driver,base:v.mountpoint}))},keys:(s,u={})=>g.getKeys(s,u),get:(s,u={})=>g.getItem(s,u),set:(s,u,y={})=>g.setItem(s,u,y),has:(s,u={})=>g.hasItem(s,u),del:(s,u={})=>g.removeItem(s,u),remove:(s,u={})=>g.removeItem(s,u)};return g}function Er(t,r,n){return t.watch?t.watch((c,o)=>r(c,n+o)):()=>{}}async function Ir(t){typeof t.dispose=="function"&&await Tt(t.dispose)}function be(t){return new Promise((r,n)=>{t.oncomplete=t.onsuccess=()=>r(t.result),t.onabort=t.onerror=()=>n(t.error)})}function Hr(t,r){const n=indexedDB.open(t);n.onupgradeneeded=()=>n.result.createObjectStore(r);const c=be(n);return(o,b)=>c.then(I=>b(I.transaction(r,o).objectStore(r)))}let Ze;function Ae(){return Ze||(Ze=Hr("keyval-store","keyval")),Ze}function Sr(t,r=Ae()){return r("readonly",n=>be(n.get(t)))}function li(t,r,n=Ae()){return n("readwrite",c=>(c.put(r,t),be(c.transaction)))}function di(t,r=Ae()){return r("readwrite",n=>(n.delete(t),be(n.transaction)))}function hi(t=Ae()){return t("readwrite",r=>(r.clear(),be(r.transaction)))}function bi(t,r){return t.openCursor().onsuccess=function(){this.result&&(r(this.result),this.result.continue())},be(t.transaction)}function gi(t=Ae()){return t("readonly",r=>{if(r.getAllKeys)return be(r.getAllKeys());const n=[];return bi(r,c=>n.push(c.key)).then(()=>n)})}const yi=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),_i=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function Gr(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return _i(t)}catch{return t}}function $r(t){return typeof t=="string"?t:yi(t)||""}const pi="idb-keyval";var mi=(t={})=>{const r=t.base&&t.base.length>0?`${t.base}:`:"",n=o=>r+o;let c;return t.dbName&&t.storeName&&(c=Hr(t.dbName,t.storeName)),{name:pi,options:t,async hasItem(o){return!(typeof await Sr(n(o),c)>"u")},async getItem(o){return await Sr(n(o),c)??null},setItem(o,b){return li(n(o),b,c)},removeItem(o){return di(n(o),c)},getKeys(){return gi(c)},clear(){return hi(c)}}};const xi="WALLET_CONNECT_V2_INDEXED_DB",wi="keyvaluestorage";let vi=class{constructor(){this.indexedDb=ui({driver:mi({dbName:xi,storeName:wi})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(r=>[r.key,r.value])}async getItem(r){const n=await this.indexedDb.getItem(r);if(n!==null)return n}async setItem(r,n){await this.indexedDb.setItem(r,$r(n))}async removeItem(r){await this.indexedDb.removeItem(r)}};var Qe=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof ct.dist.global<"u"?ct.dist.global:typeof self<"u"?self:{},Ge={exports:{}};(function(){let t;function r(){}t=r,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,c){this[n]=String(c)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(c){n[c]=void 0,delete n[c]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof Qe<"u"&&Qe.localStorage?Ge.exports=Qe.localStorage:typeof window<"u"&&window.localStorage?Ge.exports=window.localStorage:Ge.exports=new r})();function Ei(t){var r;return[t[0],Gr((r=t[1])!=null?r:"")]}class Ii{constructor(){this.localStorage=Ge.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Ei)}async getItem(r){const n=this.localStorage.getItem(r);if(n!==null)return Gr(n)}async setItem(r,n){this.localStorage.setItem(r,$r(n))}async removeItem(r){this.localStorage.removeItem(r)}}const Si="wc_storage_version",Or=1,Oi=async(t,r,n)=>{const c=Si,o=await r.getItem(c);if(o&&o>=Or){n(r);return}const b=await t.getKeys();if(!b.length){n(r);return}const I=[];for(;b.length;){const E=b.shift();if(!E)continue;const g=E.toLowerCase();if(g.includes("wc@")||g.includes("walletconnect")||g.includes("wc_")||g.includes("wallet_connect")){const s=await t.getItem(E);await r.setItem(E,s),I.push(E)}}await r.setItem(c,Or),n(r),Ti(t,I)},Ti=async(t,r)=>{r.length&&r.forEach(async n=>{await t.removeItem(n)})};class Li{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const r=new Ii;this.storage=r;try{const n=new vi;Oi(r,n,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(r){return await this.initialize(),this.storage.getItem(r)}async setItem(r,n){return await this.initialize(),this.storage.setItem(r,n)}async removeItem(r){return await this.initialize(),this.storage.removeItem(r)}async initialize(){this.initialized||await new Promise(r=>{const n=setInterval(()=>{this.initialized&&(clearInterval(n),r())},20)})}}class Ai{}function Ri(t){try{return JSON.stringify(t)}catch{return'"[Circular]"'}}var ji=Pi;function Pi(t,r,n){var c=n&&n.stringify||Ri,o=1;if(typeof t=="object"&&t!==null){var b=r.length+o;if(b===1)return t;var I=new Array(b);I[0]=c(t);for(var E=1;E<b;E++)I[E]=c(r[E]);return I.join(" ")}if(typeof t!="string")return t;var g=r.length;if(g===0)return t;for(var s="",u=1-o,y=-1,v=t&&t.length||0,w=0;w<v;){if(t.charCodeAt(w)===37&&w+1<v){switch(y=y>-1?y:0,t.charCodeAt(w+1)){case 100:case 102:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Number(r[u]),y=w+2,w++;break;case 105:if(u>=g||r[u]==null)break;y<w&&(s+=t.slice(y,w)),s+=Math.floor(Number(r[u])),y=w+2,w++;break;case 79:case 111:case 106:if(u>=g||r[u]===void 0)break;y<w&&(s+=t.slice(y,w));var x=typeof r[u];if(x==="string"){s+="'"+r[u]+"'",y=w+2,w++;break}if(x==="function"){s+=r[u].name||"<anonymous>",y=w+2,w++;break}s+=c(r[u]),y=w+2,w++;break;case 115:if(u>=g)break;y<w&&(s+=t.slice(y,w)),s+=String(r[u]),y=w+2,w++;break;case 37:y<w&&(s+=t.slice(y,w)),s+="%",y=w+2,w++,u--;break}++u}++w}return y===-1?t:(y<v&&(s+=t.slice(y)),s)}const Tr=ji;var me=Qt;const Se=Gi().console||{},Ci={mapHttpRequest:Ue,mapHttpResponse:Ue,wrapRequestSerializer:tr,wrapResponseSerializer:tr,wrapErrorSerializer:tr,req:Ue,res:Ue,err:Bi};function Ni(t,r){return Array.isArray(t)?t.filter(function(c){return c!=="!stdSerializers.err"}):t===!0?Object.keys(r):!1}function Qt(t){t=t||{},t.browser=t.browser||{};const r=t.browser.transmit;if(r&&typeof r.send!="function")throw Error("pino: transmit option must have a send function");const n=t.browser.write||Se;t.browser.write&&(t.browser.asObject=!0);const c=t.serializers||{},o=Ni(t.browser.serialize,c);let b=t.browser.serialize;Array.isArray(t.browser.serialize)&&t.browser.serialize.indexOf("!stdSerializers.err")>-1&&(b=!1);const I=["error","fatal","warn","info","debug","trace"];typeof n=="function"&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),t.enabled===!1&&(t.level="silent");const E=t.level||"info",g=Object.create(n);g.log||(g.log=Oe),Object.defineProperty(g,"levelVal",{get:u}),Object.defineProperty(g,"level",{get:y,set:v});const s={transmit:r,serialize:o,asObject:t.browser.asObject,levels:I,timestamp:Ki(t)};g.levels=Qt.levels,g.level=E,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=Oe,g.serializers=c,g._serialize=o,g._stdErrSerialize=b,g.child=w,r&&(g._logEvent=rr());function u(){return this.level==="silent"?1/0:this.levels.values[this.level]}function y(){return this._level}function v(x){if(x!=="silent"&&!this.levels.values[x])throw Error("unknown level "+x);this._level=x,_e(s,g,"error","log"),_e(s,g,"fatal","error"),_e(s,g,"warn","error"),_e(s,g,"info","log"),_e(s,g,"debug","log"),_e(s,g,"trace","log")}function w(x,N){if(!x)throw new Error("missing bindings for child Pino");N=N||{},o&&x.serializers&&(N.serializers=x.serializers);const G=N.serializers;if(o&&G){var ut=Object.assign({},c,G),M=t.browser.serialize===!0?Object.keys(ut):o;delete x.serializers,ke([x],M,ut,this._stdErrSerialize)}function Lt(gt){this._childLevel=(gt._childLevel|0)+1,this.error=pe(gt,x,"error"),this.fatal=pe(gt,x,"fatal"),this.warn=pe(gt,x,"warn"),this.info=pe(gt,x,"info"),this.debug=pe(gt,x,"debug"),this.trace=pe(gt,x,"trace"),ut&&(this.serializers=ut,this._serialize=M),r&&(this._logEvent=rr([].concat(gt._logEvent.bindings,x)))}return Lt.prototype=this,new Lt(this)}return g}Qt.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}};Qt.stdSerializers=Ci;Qt.stdTimeFunctions=Object.assign({},{nullTime:Fr,epochTime:Jr,unixTime:Ui,isoTime:Hi});function _e(t,r,n,c){const o=Object.getPrototypeOf(r);r[n]=r.levelVal>r.levels.values[n]?Oe:o[n]?o[n]:Se[n]||Se[c]||Oe,Mi(t,r,n)}function Mi(t,r,n){!t.transmit&&r[n]===Oe||(r[n]=function(c){return function(){const b=t.timestamp(),I=new Array(arguments.length),E=Object.getPrototypeOf&&Object.getPrototypeOf(this)===Se?Se:this;for(var g=0;g<I.length;g++)I[g]=arguments[g];if(t.serialize&&!t.asObject&&ke(I,this._serialize,this.serializers,this._stdErrSerialize),t.asObject?c.call(E,zi(this,n,I,b)):c.apply(E,I),t.transmit){const s=t.transmit.level||r.level,u=Qt.levels.values[s],y=Qt.levels.values[n];if(y<u)return;Di(this,{ts:b,methodLevel:n,methodValue:y,transmitLevel:s,transmitValue:Qt.levels.values[t.transmit.level||r.level],send:t.transmit.send,val:r.levelVal},I)}}}(r[n]))}function zi(t,r,n,c){t._serialize&&ke(n,t._serialize,t.serializers,t._stdErrSerialize);const o=n.slice();let b=o[0];const I={};c&&(I.time=c),I.level=Qt.levels.values[r];let E=(t._childLevel|0)+1;if(E<1&&(E=1),b!==null&&typeof b=="object"){for(;E--&&typeof o[0]=="object";)Object.assign(I,o.shift());b=o.length?Tr(o.shift(),o):void 0}else typeof b=="string"&&(b=Tr(o.shift(),o));return b!==void 0&&(I.msg=b),I}function ke(t,r,n,c){for(const o in t)if(c&&t[o]instanceof Error)t[o]=Qt.stdSerializers.err(t[o]);else if(typeof t[o]=="object"&&!Array.isArray(t[o]))for(const b in t[o])r&&r.indexOf(b)>-1&&b in n&&(t[o][b]=n[b](t[o][b]))}function pe(t,r,n){return function(){const c=new Array(1+arguments.length);c[0]=r;for(var o=1;o<c.length;o++)c[o]=arguments[o-1];return t[n].apply(this,c)}}function Di(t,r,n){const c=r.send,o=r.ts,b=r.methodLevel,I=r.methodValue,E=r.val,g=t._logEvent.bindings;ke(n,t._serialize||Object.keys(t.serializers),t.serializers,t._stdErrSerialize===void 0?!0:t._stdErrSerialize),t._logEvent.ts=o,t._logEvent.messages=n.filter(function(s){return g.indexOf(s)===-1}),t._logEvent.level.label=b,t._logEvent.level.value=I,c(b,t._logEvent,E),t._logEvent=rr(g)}function rr(t){return{ts:0,messages:[],bindings:t||[],level:{label:"",value:0}}}function Bi(t){const r={type:t.constructor.name,msg:t.message,stack:t.stack};for(const n in t)r[n]===void 0&&(r[n]=t[n]);return r}function Ki(t){return typeof t.timestamp=="function"?t.timestamp:t.timestamp===!1?Fr:Jr}function Ue(){return{}}function tr(t){return t}function Oe(){}function Fr(){return!1}function Jr(){return Date.now()}function Ui(){return Math.round(Date.now()/1e3)}function Hi(){return new Date(Date.now()).toISOString()}function Gi(){function t(r){return typeof r<"u"&&r}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return t(self)||t(window)||t(this)||{}}}const or=ct.getDefaultExportFromCjs(me),$i=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n);function Lr(t){return typeof t=="string"?t:$i(t)||""}const Fi={level:"info"},Re="custom_context",ar=1e3*1024;class Ji{constructor(r){this.nodeValue=r,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class Ar{constructor(r){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=r,this.sizeInBytes=0}append(r){const n=new Ji(r);if(n.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${r} with size ${n.size}`);for(;this.size+n.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=n),this.tail=n):(this.head=n,this.tail=n),this.lengthInNodes++,this.sizeInBytes+=n.size}shift(){if(!this.head)return;const r=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=r.size}toArray(){const r=[];let n=this.head;for(;n!==null;)r.push(n.value),n=n.next;return r}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let r=this.head;return{next:()=>{if(!r)return{done:!0,value:null};const n=r.value;return r=r.next,{done:!1,value:n}}}}}class Wr{constructor(r,n=ar){this.level=r??"error",this.levelValue=me.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=n,this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(r,n){n===me.levels.values.error?console.error(r):n===me.levels.values.warn?console.warn(r):n===me.levels.values.debug?console.debug(r):n===me.levels.values.trace?console.trace(r):console.log(r)}appendToLogs(r){this.logs.append(Lr({timestamp:new Date().toISOString(),log:r}));const n=typeof r=="string"?JSON.parse(r).level:r.level;n>=this.levelValue&&this.forwardToConsole(r,n)}getLogs(){return this.logs}clearLogs(){this.logs=new Ar(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(r){const n=this.getLogArray();return n.push(Lr({extraMetadata:r})),new Blob(n,{type:"application/json"})}}class Wi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}downloadLogsBlobInBrowser(r){const n=URL.createObjectURL(this.logsToBlob(r)),c=document.createElement("a");c.href=n,c.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(c),c.click(),document.body.removeChild(c),URL.revokeObjectURL(n)}}class Vi{constructor(r,n=ar){this.baseChunkLogger=new Wr(r,n)}write(r){this.baseChunkLogger.appendToLogs(r)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(r){return this.baseChunkLogger.logsToBlob(r)}}var ki=Object.defineProperty,Xi=Object.defineProperties,qi=Object.getOwnPropertyDescriptors,Rr=Object.getOwnPropertySymbols,Yi=Object.prototype.hasOwnProperty,Zi=Object.prototype.propertyIsEnumerable,jr=(t,r,n)=>r in t?ki(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n,$e=(t,r)=>{for(var n in r||(r={}))Yi.call(r,n)&&jr(t,n,r[n]);if(Rr)for(var n of Rr(r))Zi.call(r,n)&&jr(t,n,r[n]);return t},Fe=(t,r)=>Xi(t,qi(r));function Qi(t){return Fe($e({},t),{level:(t==null?void 0:t.level)||Fi.level})}function ts(t,r=Re){return t[r]||""}function es(t,r,n=Re){return t[n]=r,t}function Vr(t,r=Re){let n="";return typeof t.bindings>"u"?n=ts(t,r):n=t.bindings().context||"",n}function rs(t,r,n=Re){const c=Vr(t,n);return c.trim()?`${c}/${r}`:r}function ns(t,r,n=Re){const c=rs(t,r,n),o=t.child({context:c});return es(o,c,n)}function is(t){var r,n;const c=new Wi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace",browser:Fe($e({},(n=t.opts)==null?void 0:n.browser),{write:o=>c.write(o)})})),chunkLoggerController:c}}function ss(t){var r;const n=new Vi((r=t.opts)==null?void 0:r.level,t.maxSizeInBytes);return{logger:or(Fe($e({},t.opts),{level:"trace"}),n),chunkLoggerController:n}}function os(t){return typeof t.loggerOverride<"u"&&typeof t.loggerOverride!="string"?{logger:t.loggerOverride,chunkLoggerController:null}:typeof window<"u"?is(t):ss(t)}var fr={},kr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0});var r=Dt.binary,n=Dt.wipe;t.DIGEST_LENGTH=64,t.BLOCK_SIZE=128;var c=function(){function E(){this.digestLength=t.DIGEST_LENGTH,this.blockSize=t.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return E.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},E.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},E.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._tempHi),n.wipe(this._tempLo),this.reset()},E.prototype.update=function(g,s){if(s===void 0&&(s=g.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var u=0;if(this._bytesHashed+=s,this._bufferLength>0){for(;this._bufferLength<t.BLOCK_SIZE&&s>0;)this._buffer[this._bufferLength++]=g[u++],s--;this._bufferLength===this.blockSize&&(b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(s>=this.blockSize&&(u=b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,g,u,s),s%=this.blockSize);s>0;)this._buffer[this._bufferLength++]=g[u++],s--;return this},E.prototype.finish=function(g){if(!this._finished){var s=this._bytesHashed,u=this._bufferLength,y=s/536870912|0,v=s<<3,w=s%128<112?128:256;this._buffer[u]=128;for(var x=u+1;x<w-8;x++)this._buffer[x]=0;r.writeUint32BE(y,this._buffer,w-8),r.writeUint32BE(v,this._buffer,w-4),b(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,w),this._finished=!0}for(var x=0;x<this.digestLength/8;x++)r.writeUint32BE(this._stateHi[x],g,x*8),r.writeUint32BE(this._stateLo[x],g,x*8+4);return this},E.prototype.digest=function(){var g=new Uint8Array(this.digestLength);return this.finish(g),g},E.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{stateHi:new Int32Array(this._stateHi),stateLo:new Int32Array(this._stateLo),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},E.prototype.restoreState=function(g){return this._stateHi.set(g.stateHi),this._stateLo.set(g.stateLo),this._bufferLength=g.bufferLength,g.buffer&&this._buffer.set(g.buffer),this._bytesHashed=g.bytesHashed,this._finished=!1,this},E.prototype.cleanSavedState=function(g){n.wipe(g.stateHi),n.wipe(g.stateLo),g.buffer&&n.wipe(g.buffer),g.bufferLength=0,g.bytesHashed=0},E}();t.SHA512=c;var o=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function b(E,g,s,u,y,v,w){for(var x=s[0],N=s[1],G=s[2],ut=s[3],M=s[4],Lt=s[5],gt=s[6],Ct=s[7],$=u[0],C=u[1],Nt=u[2],te=u[3],yt=u[4],Wt=u[5],Ht=u[6],Xt=u[7],m,p,X,lt,A,S,O,L;w>=128;){for(var At=0;At<16;At++){var et=8*At+v;E[At]=r.readUint32BE(y,et),g[At]=r.readUint32BE(y,et+4)}for(var At=0;At<80;At++){var xe=x,z=N,ge=G,h=ut,d=M,l=Lt,e=gt,a=Ct,R=$,j=C,B=Nt,K=te,D=yt,U=Wt,Rt=Ht,dt=Xt;if(m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(M>>>14|yt<<18)^(M>>>18|yt<<14)^(yt>>>9|M<<23),p=(yt>>>14|M<<18)^(yt>>>18|M<<14)^(M>>>9|yt<<23),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=M&Lt^~M>,p=yt&Wt^~yt&Ht,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=o[At*2],p=o[At*2+1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=E[At%16],p=g[At%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,X=O&65535|L<<16,lt=A&65535|S<<16,m=X,p=lt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=(x>>>28|$<<4)^($>>>2|x<<30)^($>>>7|x<<25),p=($>>>28|x<<4)^(x>>>2|$<<30)^(x>>>7|$<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,m=x&N^x&G^N&G,p=$&C^$&Nt^C&Nt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,a=O&65535|L<<16,dt=A&65535|S<<16,m=h,p=K,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=X,p=lt,A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,h=O&65535|L<<16,K=A&65535|S<<16,N=xe,G=z,ut=ge,M=h,Lt=d,gt=l,Ct=e,x=a,C=R,Nt=j,te=B,yt=K,Wt=D,Ht=U,Xt=Rt,$=dt,At%16===15)for(var et=0;et<16;et++)m=E[et],p=g[et],A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=E[(et+9)%16],p=g[(et+9)%16],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+1)%16],lt=g[(et+1)%16],m=(X>>>1|lt<<31)^(X>>>8|lt<<24)^X>>>7,p=(lt>>>1|X<<31)^(lt>>>8|X<<24)^(lt>>>7|X<<25),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,X=E[(et+14)%16],lt=g[(et+14)%16],m=(X>>>19|lt<<13)^(lt>>>29|X<<3)^X>>>6,p=(lt>>>19|X<<13)^(X>>>29|lt<<3)^(lt>>>6|X<<26),A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,E[et]=O&65535|L<<16,g[et]=A&65535|S<<16}m=x,p=$,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[0],p=u[0],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[0]=x=O&65535|L<<16,u[0]=$=A&65535|S<<16,m=N,p=C,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[1],p=u[1],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[1]=N=O&65535|L<<16,u[1]=C=A&65535|S<<16,m=G,p=Nt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[2],p=u[2],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[2]=G=O&65535|L<<16,u[2]=Nt=A&65535|S<<16,m=ut,p=te,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[3],p=u[3],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[3]=ut=O&65535|L<<16,u[3]=te=A&65535|S<<16,m=M,p=yt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[4],p=u[4],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[4]=M=O&65535|L<<16,u[4]=yt=A&65535|S<<16,m=Lt,p=Wt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[5],p=u[5],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[5]=Lt=O&65535|L<<16,u[5]=Wt=A&65535|S<<16,m=gt,p=Ht,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[6],p=u[6],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[6]=gt=O&65535|L<<16,u[6]=Ht=A&65535|S<<16,m=Ct,p=Xt,A=p&65535,S=p>>>16,O=m&65535,L=m>>>16,m=s[7],p=u[7],A+=p&65535,S+=p>>>16,O+=m&65535,L+=m>>>16,S+=A>>>16,O+=S>>>16,L+=O>>>16,s[7]=Ct=O&65535|L<<16,u[7]=Xt=A&65535|S<<16,v+=128,w-=128}return v}function I(E){var g=new c;g.update(E);var s=g.digest();return g.clean(),s}t.hash=I})(kr);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.convertSecretKeyToX25519=t.convertPublicKeyToX25519=t.verify=t.sign=t.extractPublicKeyFromSecretKey=t.generateKeyPair=t.generateKeyPairFromSeed=t.SEED_LENGTH=t.SECRET_KEY_LENGTH=t.PUBLIC_KEY_LENGTH=t.SIGNATURE_LENGTH=void 0;const r=Dt.random,n=kr,c=Dt.wipe;t.SIGNATURE_LENGTH=64,t.PUBLIC_KEY_LENGTH=32,t.SECRET_KEY_LENGTH=64,t.SEED_LENGTH=32;function o(h){const d=new Float64Array(16);if(h)for(let l=0;l<h.length;l++)d[l]=h[l];return d}const b=new Uint8Array(32);b[0]=9;const I=o(),E=o([1]),g=o([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),s=o([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),u=o([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=o([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=o([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function w(h,d){for(let l=0;l<16;l++)h[l]=d[l]|0}function x(h){let d=1;for(let l=0;l<16;l++){let e=h[l]+d+65535;d=Math.floor(e/65536),h[l]=e-d*65536}h[0]+=d-1+37*(d-1)}function N(h,d,l){const e=~(l-1);for(let a=0;a<16;a++){const R=e&(h[a]^d[a]);h[a]^=R,d[a]^=R}}function G(h,d){const l=o(),e=o();for(let a=0;a<16;a++)e[a]=d[a];x(e),x(e),x(e);for(let a=0;a<2;a++){l[0]=e[0]-65517;for(let j=1;j<15;j++)l[j]=e[j]-65535-(l[j-1]>>16&1),l[j-1]&=65535;l[15]=e[15]-32767-(l[14]>>16&1);const R=l[15]>>16&1;l[14]&=65535,N(e,l,1-R)}for(let a=0;a<16;a++)h[2*a]=e[a]&255,h[2*a+1]=e[a]>>8}function ut(h,d){let l=0;for(let e=0;e<32;e++)l|=h[e]^d[e];return(1&l-1>>>8)-1}function M(h,d){const l=new Uint8Array(32),e=new Uint8Array(32);return G(l,h),G(e,d),ut(l,e)}function Lt(h){const d=new Uint8Array(32);return G(d,h),d[0]&1}function gt(h,d){for(let l=0;l<16;l++)h[l]=d[2*l]+(d[2*l+1]<<8);h[15]&=32767}function Ct(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]+l[e]}function $(h,d,l){for(let e=0;e<16;e++)h[e]=d[e]-l[e]}function C(h,d,l){let e,a,R=0,j=0,B=0,K=0,D=0,U=0,Rt=0,dt=0,jt=0,_t=0,ht=0,rt=0,tt=0,q=0,V=0,H=0,nt=0,pt=0,F=0,Mt=0,Bt=0,Gt=0,$t=0,Kt=0,qt=0,Zt=0,se=0,Ft=0,ce=0,we=0,je=0,it=l[0],Y=l[1],st=l[2],ot=l[3],at=l[4],Z=l[5],mt=l[6],xt=l[7],wt=l[8],vt=l[9],Et=l[10],bt=l[11],ft=l[12],W=l[13],It=l[14],St=l[15];e=d[0],R+=e*it,j+=e*Y,B+=e*st,K+=e*ot,D+=e*at,U+=e*Z,Rt+=e*mt,dt+=e*xt,jt+=e*wt,_t+=e*vt,ht+=e*Et,rt+=e*bt,tt+=e*ft,q+=e*W,V+=e*It,H+=e*St,e=d[1],j+=e*it,B+=e*Y,K+=e*st,D+=e*ot,U+=e*at,Rt+=e*Z,dt+=e*mt,jt+=e*xt,_t+=e*wt,ht+=e*vt,rt+=e*Et,tt+=e*bt,q+=e*ft,V+=e*W,H+=e*It,nt+=e*St,e=d[2],B+=e*it,K+=e*Y,D+=e*st,U+=e*ot,Rt+=e*at,dt+=e*Z,jt+=e*mt,_t+=e*xt,ht+=e*wt,rt+=e*vt,tt+=e*Et,q+=e*bt,V+=e*ft,H+=e*W,nt+=e*It,pt+=e*St,e=d[3],K+=e*it,D+=e*Y,U+=e*st,Rt+=e*ot,dt+=e*at,jt+=e*Z,_t+=e*mt,ht+=e*xt,rt+=e*wt,tt+=e*vt,q+=e*Et,V+=e*bt,H+=e*ft,nt+=e*W,pt+=e*It,F+=e*St,e=d[4],D+=e*it,U+=e*Y,Rt+=e*st,dt+=e*ot,jt+=e*at,_t+=e*Z,ht+=e*mt,rt+=e*xt,tt+=e*wt,q+=e*vt,V+=e*Et,H+=e*bt,nt+=e*ft,pt+=e*W,F+=e*It,Mt+=e*St,e=d[5],U+=e*it,Rt+=e*Y,dt+=e*st,jt+=e*ot,_t+=e*at,ht+=e*Z,rt+=e*mt,tt+=e*xt,q+=e*wt,V+=e*vt,H+=e*Et,nt+=e*bt,pt+=e*ft,F+=e*W,Mt+=e*It,Bt+=e*St,e=d[6],Rt+=e*it,dt+=e*Y,jt+=e*st,_t+=e*ot,ht+=e*at,rt+=e*Z,tt+=e*mt,q+=e*xt,V+=e*wt,H+=e*vt,nt+=e*Et,pt+=e*bt,F+=e*ft,Mt+=e*W,Bt+=e*It,Gt+=e*St,e=d[7],dt+=e*it,jt+=e*Y,_t+=e*st,ht+=e*ot,rt+=e*at,tt+=e*Z,q+=e*mt,V+=e*xt,H+=e*wt,nt+=e*vt,pt+=e*Et,F+=e*bt,Mt+=e*ft,Bt+=e*W,Gt+=e*It,$t+=e*St,e=d[8],jt+=e*it,_t+=e*Y,ht+=e*st,rt+=e*ot,tt+=e*at,q+=e*Z,V+=e*mt,H+=e*xt,nt+=e*wt,pt+=e*vt,F+=e*Et,Mt+=e*bt,Bt+=e*ft,Gt+=e*W,$t+=e*It,Kt+=e*St,e=d[9],_t+=e*it,ht+=e*Y,rt+=e*st,tt+=e*ot,q+=e*at,V+=e*Z,H+=e*mt,nt+=e*xt,pt+=e*wt,F+=e*vt,Mt+=e*Et,Bt+=e*bt,Gt+=e*ft,$t+=e*W,Kt+=e*It,qt+=e*St,e=d[10],ht+=e*it,rt+=e*Y,tt+=e*st,q+=e*ot,V+=e*at,H+=e*Z,nt+=e*mt,pt+=e*xt,F+=e*wt,Mt+=e*vt,Bt+=e*Et,Gt+=e*bt,$t+=e*ft,Kt+=e*W,qt+=e*It,Zt+=e*St,e=d[11],rt+=e*it,tt+=e*Y,q+=e*st,V+=e*ot,H+=e*at,nt+=e*Z,pt+=e*mt,F+=e*xt,Mt+=e*wt,Bt+=e*vt,Gt+=e*Et,$t+=e*bt,Kt+=e*ft,qt+=e*W,Zt+=e*It,se+=e*St,e=d[12],tt+=e*it,q+=e*Y,V+=e*st,H+=e*ot,nt+=e*at,pt+=e*Z,F+=e*mt,Mt+=e*xt,Bt+=e*wt,Gt+=e*vt,$t+=e*Et,Kt+=e*bt,qt+=e*ft,Zt+=e*W,se+=e*It,Ft+=e*St,e=d[13],q+=e*it,V+=e*Y,H+=e*st,nt+=e*ot,pt+=e*at,F+=e*Z,Mt+=e*mt,Bt+=e*xt,Gt+=e*wt,$t+=e*vt,Kt+=e*Et,qt+=e*bt,Zt+=e*ft,se+=e*W,Ft+=e*It,ce+=e*St,e=d[14],V+=e*it,H+=e*Y,nt+=e*st,pt+=e*ot,F+=e*at,Mt+=e*Z,Bt+=e*mt,Gt+=e*xt,$t+=e*wt,Kt+=e*vt,qt+=e*Et,Zt+=e*bt,se+=e*ft,Ft+=e*W,ce+=e*It,we+=e*St,e=d[15],H+=e*it,nt+=e*Y,pt+=e*st,F+=e*ot,Mt+=e*at,Bt+=e*Z,Gt+=e*mt,$t+=e*xt,Kt+=e*wt,qt+=e*vt,Zt+=e*Et,se+=e*bt,Ft+=e*ft,ce+=e*W,we+=e*It,je+=e*St,R+=38*nt,j+=38*pt,B+=38*F,K+=38*Mt,D+=38*Bt,U+=38*Gt,Rt+=38*$t,dt+=38*Kt,jt+=38*qt,_t+=38*Zt,ht+=38*se,rt+=38*Ft,tt+=38*ce,q+=38*we,V+=38*je,a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),a=1,e=R+a+65535,a=Math.floor(e/65536),R=e-a*65536,e=j+a+65535,a=Math.floor(e/65536),j=e-a*65536,e=B+a+65535,a=Math.floor(e/65536),B=e-a*65536,e=K+a+65535,a=Math.floor(e/65536),K=e-a*65536,e=D+a+65535,a=Math.floor(e/65536),D=e-a*65536,e=U+a+65535,a=Math.floor(e/65536),U=e-a*65536,e=Rt+a+65535,a=Math.floor(e/65536),Rt=e-a*65536,e=dt+a+65535,a=Math.floor(e/65536),dt=e-a*65536,e=jt+a+65535,a=Math.floor(e/65536),jt=e-a*65536,e=_t+a+65535,a=Math.floor(e/65536),_t=e-a*65536,e=ht+a+65535,a=Math.floor(e/65536),ht=e-a*65536,e=rt+a+65535,a=Math.floor(e/65536),rt=e-a*65536,e=tt+a+65535,a=Math.floor(e/65536),tt=e-a*65536,e=q+a+65535,a=Math.floor(e/65536),q=e-a*65536,e=V+a+65535,a=Math.floor(e/65536),V=e-a*65536,e=H+a+65535,a=Math.floor(e/65536),H=e-a*65536,R+=a-1+37*(a-1),h[0]=R,h[1]=j,h[2]=B,h[3]=K,h[4]=D,h[5]=U,h[6]=Rt,h[7]=dt,h[8]=jt,h[9]=_t,h[10]=ht,h[11]=rt,h[12]=tt,h[13]=q,h[14]=V,h[15]=H}function Nt(h,d){C(h,d,d)}function te(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=253;e>=0;e--)Nt(l,l),e!==2&&e!==4&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function yt(h,d){const l=o();let e;for(e=0;e<16;e++)l[e]=d[e];for(e=250;e>=0;e--)Nt(l,l),e!==1&&C(l,l,d);for(e=0;e<16;e++)h[e]=l[e]}function Wt(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o(),D=o(),U=o();$(l,h[1],h[0]),$(U,d[1],d[0]),C(l,l,U),Ct(e,h[0],h[1]),Ct(U,d[0],d[1]),C(e,e,U),C(a,h[3],d[3]),C(a,a,s),C(R,h[2],d[2]),Ct(R,R,R),$(j,e,l),$(B,R,a),Ct(K,R,a),Ct(D,e,l),C(h[0],j,B),C(h[1],D,K),C(h[2],K,B),C(h[3],j,D)}function Ht(h,d,l){for(let e=0;e<4;e++)N(h[e],d[e],l)}function Xt(h,d){const l=o(),e=o(),a=o();te(a,d[2]),C(l,d[0],a),C(e,d[1],a),G(h,e),h[31]^=Lt(l)<<7}function m(h,d,l){w(h[0],I),w(h[1],E),w(h[2],E),w(h[3],I);for(let e=255;e>=0;--e){const a=l[e/8|0]>>(e&7)&1;Ht(h,d,a),Wt(d,h),Wt(h,h),Ht(h,d,a)}}function p(h,d){const l=[o(),o(),o(),o()];w(l[0],u),w(l[1],y),w(l[2],E),C(l[3],u,y),m(h,l,d)}function X(h){if(h.length!==t.SEED_LENGTH)throw new Error(`ed25519: seed must be ${t.SEED_LENGTH} bytes`);const d=(0,n.hash)(h);d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(32),e=[o(),o(),o(),o()];p(e,d),Xt(l,e);const a=new Uint8Array(64);return a.set(h),a.set(l,32),{publicKey:l,secretKey:a}}t.generateKeyPairFromSeed=X;function lt(h){const d=(0,r.randomBytes)(32,h),l=X(d);return(0,c.wipe)(d),l}t.generateKeyPair=lt;function A(h){if(h.length!==t.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${t.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(h.subarray(32))}t.extractPublicKeyFromSecretKey=A;const S=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 O(h,d){let l,e,a,R;for(e=63;e>=32;--e){for(l=0,a=e-32,R=e-12;a<R;++a)d[a]+=l-16*d[e]*S[a-(e-32)],l=Math.floor((d[a]+128)/256),d[a]-=l*256;d[a]+=l,d[e]=0}for(l=0,a=0;a<32;a++)d[a]+=l-(d[31]>>4)*S[a],l=d[a]>>8,d[a]&=255;for(a=0;a<32;a++)d[a]-=l*S[a];for(e=0;e<32;e++)d[e+1]+=d[e]>>8,h[e]=d[e]&255}function L(h){const d=new Float64Array(64);for(let l=0;l<64;l++)d[l]=h[l];for(let l=0;l<64;l++)h[l]=0;O(h,d)}function At(h,d){const l=new Float64Array(64),e=[o(),o(),o(),o()],a=(0,n.hash)(h.subarray(0,32));a[0]&=248,a[31]&=127,a[31]|=64;const R=new Uint8Array(64);R.set(a.subarray(32),32);const j=new n.SHA512;j.update(R.subarray(32)),j.update(d);const B=j.digest();j.clean(),L(B),p(e,B),Xt(R,e),j.reset(),j.update(R.subarray(0,32)),j.update(h.subarray(32)),j.update(d);const K=j.digest();L(K);for(let D=0;D<32;D++)l[D]=B[D];for(let D=0;D<32;D++)for(let U=0;U<32;U++)l[D+U]+=K[D]*a[U];return O(R.subarray(32),l),R}t.sign=At;function et(h,d){const l=o(),e=o(),a=o(),R=o(),j=o(),B=o(),K=o();return w(h[2],E),gt(h[1],d),Nt(a,h[1]),C(R,a,g),$(a,a,h[2]),Ct(R,h[2],R),Nt(j,R),Nt(B,j),C(K,B,j),C(l,K,a),C(l,l,R),yt(l,l),C(l,l,a),C(l,l,R),C(l,l,R),C(h[0],l,R),Nt(e,h[0]),C(e,e,R),M(e,a)&&C(h[0],h[0],v),Nt(e,h[0]),C(e,e,R),M(e,a)?-1:(Lt(h[0])===d[31]>>7&&$(h[0],I,h[0]),C(h[3],h[0],h[1]),0)}function xe(h,d,l){const e=new Uint8Array(32),a=[o(),o(),o(),o()],R=[o(),o(),o(),o()];if(l.length!==t.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${t.SIGNATURE_LENGTH} bytes`);if(et(R,h))return!1;const j=new n.SHA512;j.update(l.subarray(0,32)),j.update(h),j.update(d);const B=j.digest();return L(B),m(a,R,B),p(R,l.subarray(32)),Wt(a,R),Xt(e,a),!ut(l,e)}t.verify=xe;function z(h){let d=[o(),o(),o(),o()];if(et(d,h))throw new Error("Ed25519: invalid public key");let l=o(),e=o(),a=d[1];Ct(l,E,a),$(e,E,a),te(e,e),C(l,l,e);let R=new Uint8Array(32);return G(R,l),R}t.convertPublicKeyToX25519=z;function ge(h){const d=(0,n.hash)(h.subarray(0,32));d[0]&=248,d[31]&=127,d[31]|=64;const l=new Uint8Array(d.subarray(0,32));return(0,c.wipe)(d),l}t.convertSecretKeyToX25519=ge})(fr);const as="EdDSA",fs="JWT",Je=".",Xe="base64url",Xr="utf8",qr="utf8",cs=":",us="did",ls="key",Pr="base58btc",ds="z",hs="K36",bs=32,gs=t=>JSON.stringify(t,(r,n)=>typeof n=="bigint"?n.toString()+"n":n),ys=t=>{const r=/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,n=t.replace(r,'$1"$2n"$3');return JSON.parse(n,(c,o)=>typeof o=="string"&&o.match(/^\d+n$/)?BigInt(o.substring(0,o.length-1)):o)};function _s(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return ys(t)}catch{return t}}function ps(t){return typeof t=="string"?t:gs(t)||""}function Cr(t){return _s(Le(he(t,Xe),Xr))}function We(t){return Le(he(ps(t),Xr),Xe)}function Yr(t){const r=he(hs,Pr),n=ds+Le(Br([r,t]),Pr);return[us,ls,n].join(cs)}function ms(t){return Le(t,Xe)}function xs(t){return he(t,Xe)}function ws(t){return he([We(t.header),We(t.payload)].join(Je),qr)}function vs(t){return[We(t.header),We(t.payload),ms(t.signature)].join(Je)}function Es(t){const r=t.split(Je),n=Cr(r[0]),c=Cr(r[1]),o=xs(r[2]),b=he(r.slice(0,2).join(Je),qr);return{header:n,payload:c,signature:o,data:b}}function Is(t=Dt.random.randomBytes(bs)){return fr.generateKeyPairFromSeed(t)}async function Ss(t,r,n,c,o=Dt.cjs.fromMiliseconds(Date.now())){const b={alg:as,typ:fs},I=Yr(c.publicKey),E=o+n,g={iss:I,sub:t,aud:r,iat:o,exp:E},s=ws({header:b,payload:g}),u=fr.sign(c.secretKey,s);return vs({header:b,payload:g,signature:u})}const Os="PARSE_ERROR",Ts="INVALID_REQUEST",Ls="METHOD_NOT_FOUND",As="INVALID_PARAMS",Zr="INTERNAL_ERROR",cr="SERVER_ERROR",Rs=[-32700,-32600,-32601,-32602,-32603],Ie={[Os]:{code:-32700,message:"Parse error"},[Ts]:{code:-32600,message:"Invalid Request"},[Ls]:{code:-32601,message:"Method not found"},[As]:{code:-32602,message:"Invalid params"},[Zr]:{code:-32603,message:"Internal error"},[cr]:{code:-32e3,message:"Server error"}},Qr=cr;function js(t){return Rs.includes(t)}function Nr(t){return Object.keys(Ie).includes(t)?Ie[t]:Ie[Qr]}function Ps(t){const r=Object.values(Ie).find(n=>n.code===t);return r||Ie[Qr]}function Cs(t,r,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${r}`):t}var tn={};/*! *****************************************************************************
|
|
2
2
|
Copyright (c) Microsoft Corporation.
|
|
3
3
|
|
|
4
4
|
Permission to use, copy, modify, and/or distribute this software for any
|