@wormhole-foundation/wormhole-connect 1.1.2-beta.0-development → 1.1.2-beta.2-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.
Files changed (121) hide show
  1. package/dist/assets/{ccip-CE-u3hjx.js → ccip-ugcVXZ-r.js} +1 -1
  2. package/dist/assets/{evm-BLq4Ynos.js → evm-DQC4xykE.js} +4 -4
  3. package/dist/assets/{index-DMkMuW4J.js → index-B1SC-u2d.js} +1 -1
  4. package/dist/assets/{index-MMpK3g6r.js → index-ClGMzASA.js} +1 -1
  5. package/dist/assets/{index-DYAKGAkz.js → index-JHRLBcVB.js} +2 -2
  6. package/dist/assets/{index.es-Bc26J4DB.js → index.es-WG_H7rYm.js} +2 -2
  7. package/dist/main.js +48 -51
  8. package/dist/src/hooks/useGetTokenBalances.d.ts.map +1 -1
  9. package/dist/src/icons/Tokens/CELO.d.ts.map +1 -1
  10. package/dist/src/store/transferInput.d.ts +0 -1
  11. package/dist/src/store/transferInput.d.ts.map +1 -1
  12. package/dist/src/utils/amount.d.ts +4 -0
  13. package/dist/src/utils/amount.d.ts.map +1 -0
  14. package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  15. package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
  16. package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  17. package/dist/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
  18. package/lib/{algorand-B5akecmo.js → algorand-Bfhml9ow.js} +1 -1
  19. package/lib/{algorand-DhEHguU8.mjs → algorand-Cjxu_rGT.mjs} +3 -3
  20. package/lib/{aptos-CpbWqXlz.js → aptos-8LK4z3vn.js} +1 -1
  21. package/lib/{aptos-C44Jehb8.mjs → aptos-CCPjhoiH.mjs} +1 -1
  22. package/lib/{aptos-CCDRMaWb.mjs → aptos-DoD0ybSM.mjs} +3 -3
  23. package/lib/{aptos-CecS5KEb.js → aptos-kknI1DBa.js} +2 -2
  24. package/lib/{ccip-D1PJreY0.js → ccip-DFb-9M3G.js} +1 -1
  25. package/lib/{ccip-356EqlMD.mjs → ccip-DPB6Aeux.mjs} +1 -1
  26. package/lib/{cosmos-Cn2Wsc1e.js → cosmos-Bpf_4aPg.js} +1 -1
  27. package/lib/{cosmos-CqO6KI9l.mjs → cosmos-D8oxyfb-.mjs} +5 -5
  28. package/lib/{cosmwasm-BaxTB3uz.js → cosmwasm-B_Hk0_zg.js} +2 -2
  29. package/lib/{cosmwasm-CPLhyJUa.mjs → cosmwasm-C0n2vNoS.mjs} +6 -6
  30. package/lib/{events-DcVnNAVr.mjs → events-IweKXbqK.mjs} +1 -1
  31. package/lib/{events--5HQ-tqg.js → events-wwBkyeeC.js} +1 -1
  32. package/lib/{evm-CpluUYwM.js → evm-2R09kBJC.js} +1 -1
  33. package/lib/{evm-BJzw-uU0.mjs → evm-Bd2pCSsJ.mjs} +7 -7
  34. package/lib/{evm-18u1yu3s.mjs → evm-aPO4WIdi.mjs} +5 -5
  35. package/lib/{evm-hMhOEfQO.js → evm-fe0Am1O3.js} +4 -4
  36. package/lib/{index-CSxq_OT-.mjs → index--4VtoDDS.mjs} +4 -4
  37. package/lib/{index-BG8zY-OA.js → index-0GB3Vnvc.js} +1 -1
  38. package/lib/{index-9iOOmN3N.js → index-47xrPd7t.js} +1 -1
  39. package/lib/{index-CvjY28bX.mjs → index-56vFoolS.mjs} +1 -1
  40. package/lib/{index-COPDbEYS.js → index-B-m4JhhB.js} +6 -9
  41. package/lib/{index-C0BuB3OV.mjs → index-B18omPyI.mjs} +3 -3
  42. package/lib/{index-BjO12prV.mjs → index-BA62NbuM.mjs} +2 -2
  43. package/lib/{index-BEuF9TxN.js → index-BB5T29FD.js} +1 -1
  44. package/lib/{index-BTCXycYv.js → index-BDrktTYO.js} +1 -1
  45. package/lib/{index-CFhbh-Kj.js → index-BKRL-VZ-.js} +1 -1
  46. package/lib/{index-BwnJhXyB.mjs → index-BNvCSTJM.mjs} +2 -2
  47. package/lib/{index-BAzQP8qT.js → index-BWC_CLDn.js} +1 -1
  48. package/lib/{index-CEtHOyR8.mjs → index-Bf66m4uH.mjs} +2 -2
  49. package/lib/{index-DDg66HWP.js → index-Bm4h_tq9.js} +1 -1
  50. package/lib/{index-C51caWlO.js → index-Bw_OvbxM.js} +1 -1
  51. package/lib/{index-BQYIHhaJ.mjs → index-C4F1e3oi.mjs} +6 -6
  52. package/lib/{index-DJox32A6.mjs → index-C7YoUen_.mjs} +2 -2
  53. package/lib/{index-BgylOxM_.mjs → index-C9ML4MIb.mjs} +2 -2
  54. package/lib/{index-COwGTp3f.js → index-CCHGtHEs.js} +1 -1
  55. package/lib/{index-Ck1qa_qW.js → index-CDtHBUln.js} +1 -1
  56. package/lib/{index-CXHrbv72.mjs → index-CFvHFN54.mjs} +3 -3
  57. package/lib/{index-DSc8Fz4U.mjs → index-CHzy6dYb.mjs} +1 -1
  58. package/lib/{index-Dzv3ssXm.mjs → index-CJXTHi_P.mjs} +2 -2
  59. package/lib/{index-CjQXzo8p.mjs → index-CLOOv5Du.mjs} +3 -3
  60. package/lib/{index-CDvw534p.js → index-CLbtY-pt.js} +1 -1
  61. package/lib/{index-BW-v5019.mjs → index-CLwX1P1j.mjs} +3 -3
  62. package/lib/{index-D6tUolUd.js → index-CTVkfVib.js} +1 -1
  63. package/lib/{index-CVuuC71x.js → index-CgK6uLkd.js} +1 -1
  64. package/lib/{index-GUsAuwgF.js → index-Cz-8L-Qb.js} +1 -1
  65. package/lib/{index-Bg095l2M.mjs → index-D7M_-bS5.mjs} +2 -2
  66. package/lib/{index-CexKTLA-.mjs → index-DFhYR6id.mjs} +1 -1
  67. package/lib/{index-BUDCnG5D.mjs → index-DLDcbGAp.mjs} +2 -2
  68. package/lib/{index-BBserHK5.js → index-DNvjoXDi.js} +1 -1
  69. package/lib/{index-B25ySG_F.mjs → index-DOb7A68c.mjs} +4 -4
  70. package/lib/{index-BOD3FZpI.mjs → index-DQ8BRVa9.mjs} +2 -2
  71. package/lib/{index-uUzikh2-.js → index-DdPHRkXV.js} +1 -1
  72. package/lib/{index-BfK1GMNg.js → index-Dh_38iiq.js} +1 -1
  73. package/lib/{index-Bisn-QG_.js → index-DpzW5j0n.js} +1 -1
  74. package/lib/{index-BUlkHg7S.js → index-Du-JoS7B.js} +1 -1
  75. package/lib/{index-CS85YWnw.js → index-Mmq175PJ.js} +1 -1
  76. package/lib/{index-Cdz3m9zK.js → index-NyUOs86a.js} +1 -1
  77. package/lib/{index-BC8OEwi7.mjs → index-PezPPmQR.mjs} +66 -84
  78. package/lib/{index-0SReU4B0.mjs → index-TvJJirn8.mjs} +2 -2
  79. package/lib/{index-B3RPDMyF.mjs → index-eOaDp35h.mjs} +1 -1
  80. package/lib/{index-BZ0_iTvc.mjs → index-hgDL5OvS.mjs} +1 -1
  81. package/lib/{index-6E4lxCFK.js → index-xf8W0MMN.js} +1 -1
  82. package/lib/{index.es-ADRrRLZe.js → index.es-QOrf6vQ0.js} +2 -2
  83. package/lib/{index.es-DtN-n4tF.mjs → index.es-rchXXbeY.mjs} +5 -5
  84. package/lib/index.js +1 -1
  85. package/lib/index.mjs +1 -1
  86. package/lib/{keccak-DRlmJq7e.js → keccak-BdDlOEQS.js} +1 -1
  87. package/lib/{keccak-CUQI4Qmr.mjs → keccak-DKGShrRL.mjs} +1 -1
  88. package/lib/{libsodium-wrappers-CjL0uEYl.js → libsodium-wrappers-BadAASPQ.js} +1 -1
  89. package/lib/{libsodium-wrappers-CjurMXAA.mjs → libsodium-wrappers-C2r7sgV4.mjs} +1 -1
  90. package/lib/{pako.esm-BKtKGYce.mjs → pako.esm-BUTjWIY2.mjs} +2 -2
  91. package/lib/{pako.esm-B32OATTo.js → pako.esm-DAaoySH_.js} +1 -1
  92. package/lib/{pbkdf2-BddVwFYF.js → pbkdf2-DDUd1MIo.js} +1 -1
  93. package/lib/{pbkdf2-BQVU9yJ5.mjs → pbkdf2-DpLdYPlz.mjs} +1 -1
  94. package/lib/{sei-D1BMoXXx.mjs → sei-BJXcObS8.mjs} +3 -3
  95. package/lib/{sei-Mf2fbrtH.js → sei-C-M5R_lN.js} +1 -1
  96. package/lib/{signer-BzJfR0s9.mjs → signer-D72l6J0o.mjs} +1 -1
  97. package/lib/{signer-Bn45plah.js → signer-nQpU_826.js} +1 -1
  98. package/lib/{solana-XyyQsjkH.mjs → solana-B7ycHhCW.mjs} +5 -5
  99. package/lib/{solana-1zE7Ke5_.mjs → solana-Cwzan1t4.mjs} +4 -4
  100. package/lib/{solana-WevFA0nH.js → solana-D6OY2B-1.js} +1 -1
  101. package/lib/solana-DEJ3zHI-.js +1 -0
  102. package/lib/{solanaEmbed.esm-1oxYiyoQ.mjs → solanaEmbed.esm-D9U4HFlG.mjs} +3 -3
  103. package/lib/{solanaEmbed.esm-95hDJ3L3.js → solanaEmbed.esm-DPWnM67X.js} +1 -1
  104. package/lib/src/hooks/useGetTokenBalances.d.ts.map +1 -1
  105. package/lib/src/icons/Tokens/CELO.d.ts.map +1 -1
  106. package/lib/src/store/transferInput.d.ts +0 -1
  107. package/lib/src/store/transferInput.d.ts.map +1 -1
  108. package/lib/src/utils/amount.d.ts +4 -0
  109. package/lib/src/utils/amount.d.ts.map +1 -0
  110. package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
  111. package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
  112. package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
  113. package/lib/src/views/v2/Bridge/Routes/index.d.ts.map +1 -1
  114. package/lib/{sui-HQt5WjBV.js → sui-826u9KP_.js} +2 -2
  115. package/lib/{sui-DeYVi1EQ.mjs → sui-CV8X52Ot.mjs} +4 -4
  116. package/lib/{sui-DZX7xKra.js → sui-DUASPIkT.js} +1 -1
  117. package/lib/{sui-DfO-5iUS.mjs → sui-sBQX8Jtb.mjs} +1 -1
  118. package/lib/{unsignedTransaction-C9lNMe9C.js → unsignedTransaction-BXkK1pqs.js} +1 -1
  119. package/lib/{unsignedTransaction-CDYPDQhc.mjs → unsignedTransaction-DkG4Acpk.mjs} +2 -2
  120. package/package.json +1 -1
  121. package/lib/solana-D1ZjaIA3.js +0 -1
@@ -1 +1 @@
1
- "use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-CS85YWnw.js"),e=require("./index-COPDbEYS.js"),v=require("./algorand-B5akecmo.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
1
+ "use strict";var P=Object.defineProperty;var U=(k,o,t)=>o in k?P(k,o,{enumerable:!0,configurable:!0,writable:!0,value:t}):k[o]=t;var g=(k,o,t)=>U(k,typeof o!="symbol"?o+"":o,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./index-Mmq175PJ.js"),e=require("./index-B-m4JhhB.js"),v=require("./algorand-Bfhml9ow.js"),j=e.ABIMethod.fromSignature("portal_transfer(byte[])byte[]"),p=class p{constructor(o,t,r,s){g(this,"network");g(this,"chain");g(this,"connection");g(this,"contracts");g(this,"chainId");g(this,"coreBridge");g(this,"coreAppId");g(this,"coreAppAddress");g(this,"tokenBridgeAppId");g(this,"tokenBridgeAddress");if(this.network=o,this.chain=t,this.connection=r,this.contracts=s,this.chainId=e.toChainId(t),!s.coreBridge)throw new Error(`Core contract address for chain ${t} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=e.getApplicationAddress(i),this.coreBridge=new d.AlgorandWormholeCore(o,t,r,s),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${t} not found`);const a=BigInt(s.tokenBridge);this.tokenBridgeAppId=a,this.tokenBridgeAddress=e.getApplicationAddress(a)}static async fromRpc(o,t){const[r,s]=await v.AlgorandPlatform.chainFromRpc(o),i=t[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} != ${r}`);return new p(r,s,o,i.contracts)}async isWrappedAsset(o){const t=new e.AlgorandAddress(o).toInt();if(t===0)return!1;const r=await this.connection.getAssetByID(t).do(),i=e.Asset.from_obj_for_encoding(r).params.creator,a=await this.connection.accountInformation(i).exclude("all").do(),n=e.Account.from_obj_for_encoding(a);return(n==null?void 0:n.authAddr)===this.tokenBridgeAddress}async getOriginalAsset(o){const t=new e.AlgorandAddress(o).toInt(),r=await this.connection.getAssetByID(t).do(),s=e.Asset.from_obj_for_encoding(r),i=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,s.params.creator);if(i.length<94)throw new Error("Invalid local state data");const a=i.slice(92,94),n=e.toChain(e.bignum.decode(a)),A=new e.UniversalAddress(i.slice(60,92));return{chain:n,address:A}}async getTokenUniversalAddress(o){return new e.AlgorandAddress(o).toUniversalAddress()}async getTokenNativeAddress(o,t){return new e.AlgorandAddress(t).toNative()}async getWrappedAsset(o){if(e.isNative(o.address))throw new Error("native asset cannot be a wrapped asset");const t=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o),r=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,t.address());if(r.length<8)throw new Error("Invalid wrapped asset data");return e.toNative(this.chain,e.bignum.decode(r.slice(0,8)).toString())}async hasWrappedAsset(o){try{return await this.getWrappedAsset(o),!0}catch{}return!1}async getWrappedNative(){return e.toNative(this.chain,"0")}async isTransferCompleted(o){const t=d.StorageLogicSig.forMessageId(this.tokenBridgeAppId,{sequence:o.sequence,chain:o.emitterChain,emitter:o.emitterAddress});try{return await d.StorageLogicSig.checkBitsSet(this.connection,this.tokenBridgeAppId,t.address(),o.sequence)}catch{}return!1}async*createAttestation(o,t){if(!t)throw new Error("Payer required to create attestation");const r=new e.AlgorandAddress(t).toString(),s=new e.AlgorandAddress(o).toInt(),i=[],a=await this.connection.getTransactionParams().do(),n=d.StorageLogicSig.forEmitter(this.coreAppId,new e.AlgorandAddress(this.tokenBridgeAddress).toUint8Array()),{accounts:[A],txs:I}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.coreAppId,n,a);i.push(...I);let h="",c;if(s!==0){const u=await this.connection.getAssetByID(s).do(),b=e.Asset.from_obj_for_encoding(u),S=await this.connection.accountInformation(b.params.creator).do();if(c=e.Account.from_obj_for_encoding(S),c.authAddr===this.tokenBridgeAddress.toString())throw new Error("Cannot re-attest wormhole assets")}const B=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(s)),w=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,r,this.tokenBridgeAppId,B);h=w.accounts[0],i.push(...w.txs);const m=e.makeApplicationCallTxnFromObject({from:r,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:a});i.push({tx:m});const f=await this.coreBridge.getMessageFee();if(f>BigInt(0)){const u=e.makePaymentTxnWithSuggestedParamsFromObject({from:r,suggestedParams:a,to:this.tokenBridgeAddress,amount:f});i.push({tx:u})}let y=[A,h,this.coreAppAddress];c&&y.push(c.address);let l=e.makeApplicationCallTxnFromObject({appArgs:[p.attestToken,e.bignum.toBytes(s,8)],accounts:y,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[s],from:r,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:a});f>BigInt(0)?l.fee*=3:l.fee*=2,i.push({tx:l});for(const u of i)yield this.createUnsignedTx(u,"TokenBridge.createAttestation",!0)}async*submitAttestation(o,t,r){if(!t)throw new Error("Sender required to submit attestation");r||(r=await this.connection.getTransactionParams().do());const s=t.toString(),a=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,o.payload.token).address(),n=[],A=[],I=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,a);I.length>8&&A.push(new e.AlgorandAddress(I.slice(0,8)).toInt()),n.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:s,to:a,amount:1e5,suggestedParams:r})});let h=new Uint8Array(1);h[0]=1,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),h=new Uint8Array(1),h[0]=2,n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[p.noop,h],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n.push({tx:e.makeApplicationCallTxnFromObject({accounts:[],appArgs:[p.receiveAttest,e.serialize(o)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:A,from:s,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:r})}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*2;for(const c of n)yield this.createUnsignedTx(c,"TokenBridge.submitAttestation",!0)}async*transfer(o,t,r,s,i){const a=o.toString(),n=e.isNative(r)?0:new e.AlgorandAddress(r).toInt(),A=s,I=e.toChainId(t.chain),h=t.address.toUniversalAddress().toUint8Array(),c=await this.connection.getTransactionParams().do(),B=BigInt(0),w=d.StorageLogicSig.fromData({appId:this.coreAppId,appAddress:e.decodeAddress(this.coreAppAddress).publicKey,idx:BigInt(0),address:e.decodeAddress(this.tokenBridgeAddress).publicKey}),m=[],{accounts:[f],txs:y}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.coreAppId,w,c);m.push(...y);let l="",u,b=!1;if(n!==0){const x=await this.connection.getAssetByID(n).do();l=e.Asset.from_obj_for_encoding(x).params.creator;const C=await this.connection.accountInformation(l).do();u=e.Account.from_obj_for_encoding(C),b=u.authAddr===this.tokenBridgeAddress.toString()}const S=await this.coreBridge.getMessageFee();if(S>0&&m.push({tx:e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:this.tokenBridgeAddress,amount:S,suggestedParams:c})}),!b){const x=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,BigInt(n)),{accounts:[T],txs:C}=await d.AlgorandWormholeCore.maybeCreateStorageTx(this.connection,a,this.tokenBridgeAppId,x,c);l=T,C.push(...C)}if(n!==0&&!await p.isOptedInToAsset(this.connection,l,n)){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:1e5,suggestedParams:c});let T=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.optIn,e.bigIntToBytes(n,8)],foreignAssets:[n],accounts:[l],suggestedParams:c});T.fee*=2,m.unshift({tx:x},{tx:T})}const L=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:[p.noop],suggestedParams:c});m.push({tx:L});let N=[];if(n===0){const x=e.makePaymentTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,suggestedParams:c});m.push({tx:x}),N=[f,l,l]}else{const x=e.makeAssetTransferTxnWithSuggestedParamsFromObject({from:a,to:l,amount:A,assetIndex:n,suggestedParams:c});m.push({tx:x}),N=u!=null&&u.address?[f,l,u.address]:[f,l]}const W=[p.sendTransfer,e.bignum.toBytes(n,8),e.bignum.toBytes(A,8),h,e.bignum.toBytes(I,8),e.bignum.toBytes(B,8)];i&&W.push(i);const F=e.makeApplicationCallTxnFromObject({from:a,appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),onComplete:e.OnApplicationComplete.NoOpOC,appArgs:W,foreignApps:[e.safeBigIntToNumber(this.coreAppId)],foreignAssets:[n],accounts:N,suggestedParams:c});F.fee*=2,m.push({tx:F});for(const x of m)yield this.createUnsignedTx(x,"TokenBridge.transfer",!0)}async*redeem(o,t,r=!0,s){s||(s=await this.connection.getTransactionParams().do());const i=new e.AlgorandAddress(o).toString(),{accounts:a,txs:n}=await d.AlgorandWormholeCore.submitVAAHeader(this.connection,this.coreAppId,this.tokenBridgeAppId,t,i);let A,I="",h=[],c=0;if(t.payload.token.chain!==this.chain){A=d.StorageLogicSig.forWrappedAsset(this.tokenBridgeAppId,t.payload.token),I=A.address();const f=await d.StorageLogicSig.decodeLocalState(this.connection,this.tokenBridgeAppId,I);c=new e.AlgorandAddress(f.slice(0,8)).toInt()}else{const f=new e.AlgorandAddress(t.payload.token.address).toBigInt();A=d.StorageLogicSig.forNativeAsset(this.tokenBridgeAppId,f),I=A.address(),c=e.safeBigIntToNumber(f)}a.push(I);let B=0,w="";if(t.payloadName==="TransferWithPayload"?(B=new e.AlgorandAddress(t.payload.to.address).toInt(),w=e.getApplicationAddress(B)):w=new e.AlgorandAddress(t.payload.to.address.toUint8Array()).toString(),a.push(w),c!==0&&(h.push(c),!await p.isOptedInToAsset(this.connection,w,c))){if(i!=w)throw new Error("Cannot ASA optin for somebody else (asset "+c.toString()+")");n.unshift({tx:e.makeAssetTransferTxnWithSuggestedParamsFromObject({amount:0,assetIndex:c,from:i,suggestedParams:s,to:i})})}const m={accounts:a,appArgs:[p.completeTransfer,e.serialize(t)],appIndex:e.safeBigIntToNumber(this.tokenBridgeAppId),foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s};n.push({tx:e.makeApplicationCallTxnFromObject(m)}),n[n.length-1].tx.fee=n[n.length-1].tx.fee*(t.payloadName==="Transfer"&&t.payload.fee!==void 0&&t.payload.fee===0n?2:3),t.payloadName==="TransferWithPayload"&&(n[n.length-1].tx.appForeignApps=[B],n.push({tx:e.makeApplicationCallTxnFromObject({appArgs:[j.getSelector(),j.args[0].type.encode(e.serialize(t))],appIndex:B,foreignAssets:h,from:i,onComplete:e.OnApplicationComplete.NoOpOC,suggestedParams:s})}));for(const f of n)yield this.createUnsignedTx(f,"TokenBridge.redeem",!0)}static async isOptedInToAsset(o,t,r){var s;try{const i=await o.accountAssetInformation(t,r).do();return(((s=e.AccountAssetResponse.from_obj_for_encoding(i).assetHolding)==null?void 0:s.amount)??0)>0}catch{}return!1}createUnsignedTx(o,t,r=!0){return new d.AlgorandUnsignedTransaction(o,this.network,this.chain,t,r)}};g(p,"sendTransfer",e.bytes.encode("sendTransfer")),g(p,"attestToken",e.bytes.encode("attestToken")),g(p,"noop",e.bytes.encode("nop")),g(p,"optIn",e.bytes.encode("optin")),g(p,"completeTransfer",e.bytes.encode("completeTransfer")),g(p,"receiveAttest",e.bytes.encode("receiveAttest"));let O=p;e.registerProtocol(e._platform$4,"TokenBridge",O);exports.AlgorandTokenBridge=O;exports.TransferMethodSelector=j;
@@ -1,4 +1,4 @@
1
- "use strict";const Ye=require("./index-COPDbEYS.js");var Et={},Me={},x={},bt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,c){var d=f>>>16&65535,E=f&65535,y=c>>>16&65535,v=c&65535;return E*v+(d*v+E*y<<16>>>0)|0}e.mul=Math.imul||r;function n(f,c){return f+c|0}e.add=n;function a(f,c){return f-c|0}e.sub=a;function D(f,c){return f<<c|f>>>32-c}e.rotl=D;function l(f,c){return f<<32-c|f>>>c}e.rotr=l;function w(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}e.isInteger=Number.isInteger||w,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(f){return e.isInteger(f)&&f>=-e.MAX_SAFE_INTEGER&&f<=e.MAX_SAFE_INTEGER}})(bt);Object.defineProperty(x,"__esModule",{value:!0});var vt=bt;function It(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])<<16>>16}x.readInt16BE=It;function Rt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])>>>0}x.readUint16BE=Rt;function Pt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])<<16>>16}x.readInt16LE=Pt;function Ht(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])>>>0}x.readUint16LE=Ht;function wt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>8,r[n+1]=e>>>0,r}x.writeUint16BE=wt;x.writeInt16BE=wt;function yt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r}x.writeUint16LE=yt;x.writeInt16LE=yt;function qe(e,r){return r===void 0&&(r=0),e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]}x.readInt32BE=qe;function $e(e,r){return r===void 0&&(r=0),(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}x.readUint32BE=$e;function Ge(e,r){return r===void 0&&(r=0),e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]}x.readInt32LE=Ge;function Ve(e,r){return r===void 0&&(r=0),(e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r])>>>0}x.readUint32LE=Ve;function Ne(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>24,r[n+1]=e>>>16,r[n+2]=e>>>8,r[n+3]=e>>>0,r}x.writeUint32BE=Ne;x.writeInt32BE=Ne;function Te(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r[n+2]=e>>>16,r[n+3]=e>>>24,r}x.writeUint32LE=Te;x.writeInt32LE=Te;function Kt(e,r){r===void 0&&(r=0);var n=qe(e,r),a=qe(e,r+4);return n*4294967296+a-(a>>31)*4294967296}x.readInt64BE=Kt;function zt(e,r){r===void 0&&(r=0);var n=$e(e,r),a=$e(e,r+4);return n*4294967296+a}x.readUint64BE=zt;function Yt(e,r){r===void 0&&(r=0);var n=Ge(e,r),a=Ge(e,r+4);return a*4294967296+n-(n>>31)*4294967296}x.readInt64LE=Yt;function qt(e,r){r===void 0&&(r=0);var n=Ve(e,r),a=Ve(e,r+4);return a*4294967296+n}x.readUint64LE=qt;function gt(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Ne(e/4294967296>>>0,r,n),Ne(e>>>0,r,n+4),r}x.writeUint64BE=gt;x.writeInt64BE=gt;function St(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Te(e>>>0,r,n),Te(e/4294967296>>>0,r,n+4),r}x.writeUint64LE=St;x.writeInt64LE=St;function $t(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var a=0,D=1,l=e/8+n-1;l>=n;l--)a+=r[l]*D,D*=256;return a}x.readUintBE=$t;function Gt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var a=0,D=1,l=n;l<n+e/8;l++)a+=r[l]*D,D*=256;return a}x.readUintLE=Gt;function Vt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var D=1,l=e/8+a-1;l>=a;l--)n[l]=r/D&255,D*=256;return n}x.writeUintBE=Vt;function Wt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var D=1,l=a;l<a+e/8;l++)n[l]=r/D&255,D*=256;return n}x.writeUintLE=Wt;function Xt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r)}x.readFloat32BE=Xt;function Jt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r,!0)}x.readFloat32LE=Jt;function Qt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r)}x.readFloat64BE=Qt;function Zt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r,!0)}x.readFloat64LE=Zt;function kt(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e),r}x.writeFloat32BE=kt;function er(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e,!0),r}x.writeFloat32LE=er;function tr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e),r}x.writeFloat64BE=tr;function rr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e,!0),r}x.writeFloat64LE=rr;var de={};Object.defineProperty(de,"__esModule",{value:!0});function nr(e){for(var r=0;r<e.length;r++)e[r]=0;return e}de.wipe=nr;Object.defineProperty(Me,"__esModule",{value:!0});var _e=x,We=de,ir=20;function ar(e,r,n){for(var a=1634760805,D=857760878,l=2036477234,w=1797285236,f=n[3]<<24|n[2]<<16|n[1]<<8|n[0],c=n[7]<<24|n[6]<<16|n[5]<<8|n[4],d=n[11]<<24|n[10]<<16|n[9]<<8|n[8],E=n[15]<<24|n[14]<<16|n[13]<<8|n[12],y=n[19]<<24|n[18]<<16|n[17]<<8|n[16],v=n[23]<<24|n[22]<<16|n[21]<<8|n[20],b=n[27]<<24|n[26]<<16|n[25]<<8|n[24],g=n[31]<<24|n[30]<<16|n[29]<<8|n[28],A=r[3]<<24|r[2]<<16|r[1]<<8|r[0],p=r[7]<<24|r[6]<<16|r[5]<<8|r[4],O=r[11]<<24|r[10]<<16|r[9]<<8|r[8],o=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=a,u=D,s=l,h=w,t=f,i=c,S=d,C=E,F=y,L=v,j=b,B=g,T=A,M=p,m=O,N=o,G=0;G<ir;G+=2)_=_+t|0,T^=_,T=T>>>16|T<<16,F=F+T|0,t^=F,t=t>>>20|t<<12,u=u+i|0,M^=u,M=M>>>16|M<<16,L=L+M|0,i^=L,i=i>>>20|i<<12,s=s+S|0,m^=s,m=m>>>16|m<<16,j=j+m|0,S^=j,S=S>>>20|S<<12,h=h+C|0,N^=h,N=N>>>16|N<<16,B=B+N|0,C^=B,C=C>>>20|C<<12,s=s+S|0,m^=s,m=m>>>24|m<<8,j=j+m|0,S^=j,S=S>>>25|S<<7,h=h+C|0,N^=h,N=N>>>24|N<<8,B=B+N|0,C^=B,C=C>>>25|C<<7,u=u+i|0,M^=u,M=M>>>24|M<<8,L=L+M|0,i^=L,i=i>>>25|i<<7,_=_+t|0,T^=_,T=T>>>24|T<<8,F=F+T|0,t^=F,t=t>>>25|t<<7,_=_+i|0,N^=_,N=N>>>16|N<<16,j=j+N|0,i^=j,i=i>>>20|i<<12,u=u+S|0,T^=u,T=T>>>16|T<<16,B=B+T|0,S^=B,S=S>>>20|S<<12,s=s+C|0,M^=s,M=M>>>16|M<<16,F=F+M|0,C^=F,C=C>>>20|C<<12,h=h+t|0,m^=h,m=m>>>16|m<<16,L=L+m|0,t^=L,t=t>>>20|t<<12,s=s+C|0,M^=s,M=M>>>24|M<<8,F=F+M|0,C^=F,C=C>>>25|C<<7,h=h+t|0,m^=h,m=m>>>24|m<<8,L=L+m|0,t^=L,t=t>>>25|t<<7,u=u+S|0,T^=u,T=T>>>24|T<<8,B=B+T|0,S^=B,S=S>>>25|S<<7,_=_+i|0,N^=_,N=N>>>24|N<<8,j=j+N|0,i^=j,i=i>>>25|i<<7;_e.writeUint32LE(_+a|0,e,0),_e.writeUint32LE(u+D|0,e,4),_e.writeUint32LE(s+l|0,e,8),_e.writeUint32LE(h+w|0,e,12),_e.writeUint32LE(t+f|0,e,16),_e.writeUint32LE(i+c|0,e,20),_e.writeUint32LE(S+d|0,e,24),_e.writeUint32LE(C+E|0,e,28),_e.writeUint32LE(F+y|0,e,32),_e.writeUint32LE(L+v|0,e,36),_e.writeUint32LE(j+b|0,e,40),_e.writeUint32LE(B+g|0,e,44),_e.writeUint32LE(T+A|0,e,48),_e.writeUint32LE(M+p|0,e,52),_e.writeUint32LE(m+O|0,e,56),_e.writeUint32LE(N+o|0,e,60)}function mt(e,r,n,a,D){if(D===void 0&&(D=0),e.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(a.length<n.length)throw new Error("ChaCha: destination is shorter than source");var l,w;if(D===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=new Uint8Array(16),w=l.length-r.length,l.set(r,w)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");l=r,w=D}for(var f=new Uint8Array(64),c=0;c<n.length;c+=64){ar(f,l,e);for(var d=c;d<c+64&&d<n.length;d++)a[d]=n[d]^f[d-c];fr(l,0,w)}return We.wipe(f),D===0&&We.wipe(l),a}Me.streamXOR=mt;function ur(e,r,n,a){return a===void 0&&(a=0),We.wipe(n),mt(e,r,n,n,a)}Me.stream=ur;function fr(e,r,n){for(var a=1;n--;)a=a+(e[r]&255)|0,e[r]=a&255,a>>>=8,r++;if(a>0)throw new Error("ChaCha: counter overflow")}var Ct={},be={};Object.defineProperty(be,"__esModule",{value:!0});function hr(e,r,n){return~(e-1)&r|e-1&n}be.select=hr;function sr(e,r){return(e|0)-(r|0)-1>>>31&1}be.lessOrEqual=sr;function pt(e,r){if(e.length!==r.length)return 0;for(var n=0,a=0;a<e.length;a++)n|=e[a]^r[a];return 1&n-1>>>8}be.compare=pt;function or(e,r){return e.length===0||r.length===0?!1:pt(e,r)!==0}be.equal=or;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=be,n=de;e.DIGEST_LENGTH=16;var a=function(){function w(f){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=f[0]|f[1]<<8;this._r[0]=c&8191;var d=f[2]|f[3]<<8;this._r[1]=(c>>>13|d<<3)&8191;var E=f[4]|f[5]<<8;this._r[2]=(d>>>10|E<<6)&7939;var y=f[6]|f[7]<<8;this._r[3]=(E>>>7|y<<9)&8191;var v=f[8]|f[9]<<8;this._r[4]=(y>>>4|v<<12)&255,this._r[5]=v>>>1&8190;var b=f[10]|f[11]<<8;this._r[6]=(v>>>14|b<<2)&8191;var g=f[12]|f[13]<<8;this._r[7]=(b>>>11|g<<5)&8065;var A=f[14]|f[15]<<8;this._r[8]=(g>>>8|A<<8)&8191,this._r[9]=A>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return w.prototype._blocks=function(f,c,d){for(var E=this._fin?0:2048,y=this._h[0],v=this._h[1],b=this._h[2],g=this._h[3],A=this._h[4],p=this._h[5],O=this._h[6],o=this._h[7],_=this._h[8],u=this._h[9],s=this._r[0],h=this._r[1],t=this._r[2],i=this._r[3],S=this._r[4],C=this._r[5],F=this._r[6],L=this._r[7],j=this._r[8],B=this._r[9];d>=16;){var T=f[c+0]|f[c+1]<<8;y+=T&8191;var M=f[c+2]|f[c+3]<<8;v+=(T>>>13|M<<3)&8191;var m=f[c+4]|f[c+5]<<8;b+=(M>>>10|m<<6)&8191;var N=f[c+6]|f[c+7]<<8;g+=(m>>>7|N<<9)&8191;var G=f[c+8]|f[c+9]<<8;A+=(N>>>4|G<<12)&8191,p+=G>>>1&8191;var J=f[c+10]|f[c+11]<<8;O+=(G>>>14|J<<2)&8191;var X=f[c+12]|f[c+13]<<8;o+=(J>>>11|X<<5)&8191;var W=f[c+14]|f[c+15]<<8;_+=(X>>>8|W<<8)&8191,u+=W>>>5|E;var U=0,I=U;I+=y*s,I+=v*(5*B),I+=b*(5*j),I+=g*(5*L),I+=A*(5*F),U=I>>>13,I&=8191,I+=p*(5*C),I+=O*(5*S),I+=o*(5*i),I+=_*(5*t),I+=u*(5*h),U+=I>>>13,I&=8191;var R=U;R+=y*h,R+=v*s,R+=b*(5*B),R+=g*(5*j),R+=A*(5*L),U=R>>>13,R&=8191,R+=p*(5*F),R+=O*(5*C),R+=o*(5*S),R+=_*(5*i),R+=u*(5*t),U+=R>>>13,R&=8191;var P=U;P+=y*t,P+=v*h,P+=b*s,P+=g*(5*B),P+=A*(5*j),U=P>>>13,P&=8191,P+=p*(5*L),P+=O*(5*F),P+=o*(5*C),P+=_*(5*S),P+=u*(5*i),U+=P>>>13,P&=8191;var H=U;H+=y*i,H+=v*t,H+=b*h,H+=g*s,H+=A*(5*B),U=H>>>13,H&=8191,H+=p*(5*j),H+=O*(5*L),H+=o*(5*F),H+=_*(5*C),H+=u*(5*S),U+=H>>>13,H&=8191;var K=U;K+=y*S,K+=v*i,K+=b*t,K+=g*h,K+=A*s,U=K>>>13,K&=8191,K+=p*(5*B),K+=O*(5*j),K+=o*(5*L),K+=_*(5*F),K+=u*(5*C),U+=K>>>13,K&=8191;var z=U;z+=y*C,z+=v*S,z+=b*i,z+=g*t,z+=A*h,U=z>>>13,z&=8191,z+=p*s,z+=O*(5*B),z+=o*(5*j),z+=_*(5*L),z+=u*(5*F),U+=z>>>13,z&=8191;var Y=U;Y+=y*F,Y+=v*C,Y+=b*S,Y+=g*i,Y+=A*t,U=Y>>>13,Y&=8191,Y+=p*h,Y+=O*s,Y+=o*(5*B),Y+=_*(5*j),Y+=u*(5*L),U+=Y>>>13,Y&=8191;var q=U;q+=y*L,q+=v*F,q+=b*C,q+=g*S,q+=A*i,U=q>>>13,q&=8191,q+=p*t,q+=O*h,q+=o*s,q+=_*(5*B),q+=u*(5*j),U+=q>>>13,q&=8191;var $=U;$+=y*j,$+=v*L,$+=b*F,$+=g*C,$+=A*S,U=$>>>13,$&=8191,$+=p*i,$+=O*t,$+=o*h,$+=_*s,$+=u*(5*B),U+=$>>>13,$&=8191;var V=U;V+=y*B,V+=v*j,V+=b*L,V+=g*F,V+=A*C,U=V>>>13,V&=8191,V+=p*S,V+=O*i,V+=o*t,V+=_*h,V+=u*s,U+=V>>>13,V&=8191,U=(U<<2)+U|0,U=U+I|0,I=U&8191,U=U>>>13,R+=U,y=I,v=R,b=P,g=H,A=K,p=z,O=Y,o=q,_=$,u=V,c+=16,d-=16}this._h[0]=y,this._h[1]=v,this._h[2]=b,this._h[3]=g,this._h[4]=A,this._h[5]=p,this._h[6]=O,this._h[7]=o,this._h[8]=_,this._h[9]=u},w.prototype.finish=function(f,c){c===void 0&&(c=0);var d=new Uint16Array(10),E,y,v,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(E=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=E,E=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=E*5,E=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=E,E=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=E,d[0]=this._h[0]+5,E=d[0]>>>13,d[0]&=8191,b=1;b<10;b++)d[b]=this._h[b]+E,E=d[b]>>>13,d[b]&=8191;for(d[9]-=8192,y=(E^1)-1,b=0;b<10;b++)d[b]&=y;for(y=~y,b=0;b<10;b++)this._h[b]=this._h[b]&y|d[b];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,v=this._h[0]+this._pad[0],this._h[0]=v&65535,b=1;b<8;b++)v=(this._h[b]+this._pad[b]|0)+(v>>>16)|0,this._h[b]=v&65535;return f[c+0]=this._h[0]>>>0,f[c+1]=this._h[0]>>>8,f[c+2]=this._h[1]>>>0,f[c+3]=this._h[1]>>>8,f[c+4]=this._h[2]>>>0,f[c+5]=this._h[2]>>>8,f[c+6]=this._h[3]>>>0,f[c+7]=this._h[3]>>>8,f[c+8]=this._h[4]>>>0,f[c+9]=this._h[4]>>>8,f[c+10]=this._h[5]>>>0,f[c+11]=this._h[5]>>>8,f[c+12]=this._h[6]>>>0,f[c+13]=this._h[6]>>>8,f[c+14]=this._h[7]>>>0,f[c+15]=this._h[7]>>>8,this._finished=!0,this},w.prototype.update=function(f){var c=0,d=f.length,E;if(this._leftover){E=16-this._leftover,E>d&&(E=d);for(var y=0;y<E;y++)this._buffer[this._leftover+y]=f[c+y];if(d-=E,c+=E,this._leftover+=E,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(E=d-d%16,this._blocks(f,c,E),c+=E,d-=E),d){for(var y=0;y<d;y++)this._buffer[this._leftover+y]=f[c+y];this._leftover+=d}return this},w.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},w.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},w}();e.Poly1305=a;function D(w,f){var c=new a(w);c.update(f);var d=c.digest();return c.clean(),d}e.oneTimeAuth=D;function l(w,f){return w.length!==e.DIGEST_LENGTH||f.length!==e.DIGEST_LENGTH?!1:r.equal(w,f)}e.equal=l})(Ct);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=Me,n=Ct,a=de,D=x,l=be;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var w=new Uint8Array(16),f=function(){function c(d){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,d.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(d)}return c.prototype.seal=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=E.length+this.tagLength,p;if(v){if(v.length!==A)throw new Error("ChaCha20Poly1305: incorrect destination length");p=v}else p=new Uint8Array(A);return r.streamXOR(this._key,b,E,p,4),this._authenticate(p.subarray(p.length-this.tagLength,p.length),g,p.subarray(0,p.length-this.tagLength),y),a.wipe(b),p},c.prototype.open=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(E.length<this.tagLength)return null;var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=new Uint8Array(this.tagLength);if(this._authenticate(A,g,E.subarray(0,E.length-this.tagLength),y),!l.equal(A,E.subarray(E.length-this.tagLength,E.length)))return null;var p=E.length-this.tagLength,O;if(v){if(v.length!==p)throw new Error("ChaCha20Poly1305: incorrect destination length");O=v}else O=new Uint8Array(p);return r.streamXOR(this._key,b,E.subarray(0,E.length-this.tagLength),O,4),a.wipe(b),O},c.prototype.clean=function(){return a.wipe(this._key),this},c.prototype._authenticate=function(d,E,y,v){var b=new n.Poly1305(E);v&&(b.update(v),v.length%16>0&&b.update(w.subarray(v.length%16))),b.update(y),y.length%16>0&&b.update(w.subarray(y.length%16));var g=new Uint8Array(8);v&&D.writeUint64LE(v.length,g),b.update(g),D.writeUint64LE(y.length,g),b.update(g);for(var A=b.digest(),p=0;p<A.length;p++)d[p]=A[p];b.clean(),a.wipe(A),a.wipe(g)},c}();e.ChaCha20Poly1305=f})(Et);var At={},Ue={},ke={};Object.defineProperty(ke,"__esModule",{value:!0});function cr(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}ke.isSerializableHash=cr;Object.defineProperty(Ue,"__esModule",{value:!0});var Ee=ke,lr=be,Dr=de,Ut=function(){function e(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var a=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(a).clean():a.set(n);for(var D=0;D<a.length;D++)a[D]^=54;this._inner.update(a);for(var D=0;D<a.length;D++)a[D]^=106;this._outer.update(a),Ee.isSerializableHash(this._inner)&&Ee.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Dr.wipe(a)}return e.prototype.reset=function(){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ee.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ee.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(r){return this._inner.update(r),this},e.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},e.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},e.prototype.saveState=function(){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(r){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(r){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},e}();Ue.HMAC=Ut;function _r(e,r,n){var a=new Ut(e,r);a.update(n);var D=a.digest();return a.clean(),D}Ue.hmac=_r;Ue.equal=lr.equal;Object.defineProperty(At,"__esModule",{value:!0});var rt=Ue,nt=de,dr=function(){function e(r,n,a,D){a===void 0&&(a=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=D;var l=rt.hmac(this._hash,a,n);this._hmac=new rt.HMAC(r,l),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(r){for(var n=new Uint8Array(r),a=0;a<n.length;a++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[a]=this._buffer[this._bufpos++];return n},e.prototype.clean=function(){this._hmac.clean(),nt.wipe(this._buffer),nt.wipe(this._counter),this._bufpos=0},e}(),Er=At.HKDF=dr,et={},xe={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.BrowserRandomSource=void 0;const it=65536;class br{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let a=0;a<n.length;a+=it)this._crypto.getRandomValues(n.subarray(a,a+Math.min(n.length-a,it)));return n}}Le.BrowserRandomSource=br;var Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.NodeRandomSource=void 0;const vr=de;class wr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Ye.commonjsRequire<"u"){const r=Ye.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const a=new Uint8Array(r);for(let D=0;D<a.length;D++)a[D]=n[D];return(0,vr.wipe)(n),a}}Be.NodeRandomSource=wr;Object.defineProperty(xe,"__esModule",{value:!0});xe.SystemRandomSource=void 0;const yr=Le,gr=Be;class Sr{constructor(){if(this.isAvailable=!1,this.name="",this._source=new yr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new gr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}xe.SystemRandomSource=Sr;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const r=xe,n=x,a=de;e.defaultRandomSource=new r.SystemRandomSource;function D(d,E=e.defaultRandomSource){return E.randomBytes(d)}e.randomBytes=D;function l(d=e.defaultRandomSource){const E=D(4,d),y=(0,n.readUint32LE)(E);return(0,a.wipe)(E),y}e.randomUint32=l;const w="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(d,E=w,y=e.defaultRandomSource){if(E.length<2)throw new Error("randomString charset is too short");if(E.length>256)throw new Error("randomString charset is too long");let v="";const b=E.length,g=256-256%b;for(;d>0;){const A=D(Math.ceil(d*256/g),y);for(let p=0;p<A.length&&d>0;p++){const O=A[p];O<g&&(v+=E.charAt(O%b),d--)}(0,a.wipe)(A)}return v}e.randomString=f;function c(d,E=w,y=e.defaultRandomSource){const v=Math.ceil(d/(Math.log(E.length)/Math.LN2));return f(v,E,y)}e.randomStringForEntropy=c})(et);var Ot={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=x,n=de;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var a=function(){function f(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},f.prototype.update=function(c,d){if(d===void 0&&(d=c.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var E=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&d>0;)this._buffer[this._bufferLength++]=c[E++],d--;this._bufferLength===this.blockSize&&(l(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(E=l(this._temp,this._state,c,E,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=c[E++],d--;return this},f.prototype.finish=function(c){if(!this._finished){var d=this._bytesHashed,E=this._bufferLength,y=d/536870912|0,v=d<<3,b=d%64<56?64:128;this._buffer[E]=128;for(var g=E+1;g<b-8;g++)this._buffer[g]=0;r.writeUint32BE(y,this._buffer,b-8),r.writeUint32BE(v,this._buffer,b-4),l(this._temp,this._state,this._buffer,0,b),this._finished=!0}for(var g=0;g<this.digestLength/4;g++)r.writeUint32BE(this._state[g],c,g*4);return this},f.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(c){n.wipe(c.state),c.buffer&&n.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},f}();e.SHA256=a;var D=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function l(f,c,d,E,y){for(;y>=64;){for(var v=c[0],b=c[1],g=c[2],A=c[3],p=c[4],O=c[5],o=c[6],_=c[7],u=0;u<16;u++){var s=E+u*4;f[u]=r.readUint32BE(d,s)}for(var u=16;u<64;u++){var h=f[u-2],t=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=f[u-15];var i=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;f[u]=(t+f[u-7]|0)+(i+f[u-16]|0)}for(var u=0;u<64;u++){var t=(((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&O^~p&o)|0)+(_+(D[u]+f[u]|0)|0)|0,i=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&b^v&g^b&g)|0;_=o,o=O,O=p,p=A+t|0,A=g,g=b,b=v,v=t+i|0}c[0]+=v,c[1]+=b,c[2]+=g,c[3]+=A,c[4]+=p,c[5]+=O,c[6]+=o,c[7]+=_,E+=64,y-=64}return E}function w(f){var c=new a;c.update(f);var d=c.digest();return c.clean(),d}e.hash=w})(Ot);var Ft={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const r=et,n=de;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function a(u){const s=new Float64Array(16);if(u)for(let h=0;h<u.length;h++)s[h]=u[h];return s}const D=new Uint8Array(32);D[0]=9;const l=a([56129,1]);function w(u){let s=1;for(let h=0;h<16;h++){let t=u[h]+s+65535;s=Math.floor(t/65536),u[h]=t-s*65536}u[0]+=s-1+37*(s-1)}function f(u,s,h){const t=~(h-1);for(let i=0;i<16;i++){const S=t&(u[i]^s[i]);u[i]^=S,s[i]^=S}}function c(u,s){const h=a(),t=a();for(let i=0;i<16;i++)t[i]=s[i];w(t),w(t),w(t);for(let i=0;i<2;i++){h[0]=t[0]-65517;for(let C=1;C<15;C++)h[C]=t[C]-65535-(h[C-1]>>16&1),h[C-1]&=65535;h[15]=t[15]-32767-(h[14]>>16&1);const S=h[15]>>16&1;h[14]&=65535,f(t,h,1-S)}for(let i=0;i<16;i++)u[2*i]=t[i]&255,u[2*i+1]=t[i]>>8}function d(u,s){for(let h=0;h<16;h++)u[h]=s[2*h]+(s[2*h+1]<<8);u[15]&=32767}function E(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]+h[t]}function y(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]-h[t]}function v(u,s,h){let t,i,S=0,C=0,F=0,L=0,j=0,B=0,T=0,M=0,m=0,N=0,G=0,J=0,X=0,W=0,U=0,I=0,R=0,P=0,H=0,K=0,z=0,Y=0,q=0,$=0,V=0,ve=0,ge=0,me=0,Fe=0,Re=0,tt=0,Z=h[0],k=h[1],ee=h[2],te=h[3],re=h[4],ne=h[5],ie=h[6],ae=h[7],ue=h[8],fe=h[9],he=h[10],se=h[11],oe=h[12],ce=h[13],le=h[14],De=h[15];t=s[0],S+=t*Z,C+=t*k,F+=t*ee,L+=t*te,j+=t*re,B+=t*ne,T+=t*ie,M+=t*ae,m+=t*ue,N+=t*fe,G+=t*he,J+=t*se,X+=t*oe,W+=t*ce,U+=t*le,I+=t*De,t=s[1],C+=t*Z,F+=t*k,L+=t*ee,j+=t*te,B+=t*re,T+=t*ne,M+=t*ie,m+=t*ae,N+=t*ue,G+=t*fe,J+=t*he,X+=t*se,W+=t*oe,U+=t*ce,I+=t*le,R+=t*De,t=s[2],F+=t*Z,L+=t*k,j+=t*ee,B+=t*te,T+=t*re,M+=t*ne,m+=t*ie,N+=t*ae,G+=t*ue,J+=t*fe,X+=t*he,W+=t*se,U+=t*oe,I+=t*ce,R+=t*le,P+=t*De,t=s[3],L+=t*Z,j+=t*k,B+=t*ee,T+=t*te,M+=t*re,m+=t*ne,N+=t*ie,G+=t*ae,J+=t*ue,X+=t*fe,W+=t*he,U+=t*se,I+=t*oe,R+=t*ce,P+=t*le,H+=t*De,t=s[4],j+=t*Z,B+=t*k,T+=t*ee,M+=t*te,m+=t*re,N+=t*ne,G+=t*ie,J+=t*ae,X+=t*ue,W+=t*fe,U+=t*he,I+=t*se,R+=t*oe,P+=t*ce,H+=t*le,K+=t*De,t=s[5],B+=t*Z,T+=t*k,M+=t*ee,m+=t*te,N+=t*re,G+=t*ne,J+=t*ie,X+=t*ae,W+=t*ue,U+=t*fe,I+=t*he,R+=t*se,P+=t*oe,H+=t*ce,K+=t*le,z+=t*De,t=s[6],T+=t*Z,M+=t*k,m+=t*ee,N+=t*te,G+=t*re,J+=t*ne,X+=t*ie,W+=t*ae,U+=t*ue,I+=t*fe,R+=t*he,P+=t*se,H+=t*oe,K+=t*ce,z+=t*le,Y+=t*De,t=s[7],M+=t*Z,m+=t*k,N+=t*ee,G+=t*te,J+=t*re,X+=t*ne,W+=t*ie,U+=t*ae,I+=t*ue,R+=t*fe,P+=t*he,H+=t*se,K+=t*oe,z+=t*ce,Y+=t*le,q+=t*De,t=s[8],m+=t*Z,N+=t*k,G+=t*ee,J+=t*te,X+=t*re,W+=t*ne,U+=t*ie,I+=t*ae,R+=t*ue,P+=t*fe,H+=t*he,K+=t*se,z+=t*oe,Y+=t*ce,q+=t*le,$+=t*De,t=s[9],N+=t*Z,G+=t*k,J+=t*ee,X+=t*te,W+=t*re,U+=t*ne,I+=t*ie,R+=t*ae,P+=t*ue,H+=t*fe,K+=t*he,z+=t*se,Y+=t*oe,q+=t*ce,$+=t*le,V+=t*De,t=s[10],G+=t*Z,J+=t*k,X+=t*ee,W+=t*te,U+=t*re,I+=t*ne,R+=t*ie,P+=t*ae,H+=t*ue,K+=t*fe,z+=t*he,Y+=t*se,q+=t*oe,$+=t*ce,V+=t*le,ve+=t*De,t=s[11],J+=t*Z,X+=t*k,W+=t*ee,U+=t*te,I+=t*re,R+=t*ne,P+=t*ie,H+=t*ae,K+=t*ue,z+=t*fe,Y+=t*he,q+=t*se,$+=t*oe,V+=t*ce,ve+=t*le,ge+=t*De,t=s[12],X+=t*Z,W+=t*k,U+=t*ee,I+=t*te,R+=t*re,P+=t*ne,H+=t*ie,K+=t*ae,z+=t*ue,Y+=t*fe,q+=t*he,$+=t*se,V+=t*oe,ve+=t*ce,ge+=t*le,me+=t*De,t=s[13],W+=t*Z,U+=t*k,I+=t*ee,R+=t*te,P+=t*re,H+=t*ne,K+=t*ie,z+=t*ae,Y+=t*ue,q+=t*fe,$+=t*he,V+=t*se,ve+=t*oe,ge+=t*ce,me+=t*le,Fe+=t*De,t=s[14],U+=t*Z,I+=t*k,R+=t*ee,P+=t*te,H+=t*re,K+=t*ne,z+=t*ie,Y+=t*ae,q+=t*ue,$+=t*fe,V+=t*he,ve+=t*se,ge+=t*oe,me+=t*ce,Fe+=t*le,Re+=t*De,t=s[15],I+=t*Z,R+=t*k,P+=t*ee,H+=t*te,K+=t*re,z+=t*ne,Y+=t*ie,q+=t*ae,$+=t*ue,V+=t*fe,ve+=t*he,ge+=t*se,me+=t*oe,Fe+=t*ce,Re+=t*le,tt+=t*De,S+=38*R,C+=38*P,F+=38*H,L+=38*K,j+=38*z,B+=38*Y,T+=38*q,M+=38*$,m+=38*V,N+=38*ve,G+=38*ge,J+=38*me,X+=38*Fe,W+=38*Re,U+=38*tt,i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),u[0]=S,u[1]=C,u[2]=F,u[3]=L,u[4]=j,u[5]=B,u[6]=T,u[7]=M,u[8]=m,u[9]=N,u[10]=G,u[11]=J,u[12]=X,u[13]=W,u[14]=U,u[15]=I}function b(u,s){v(u,s,s)}function g(u,s){const h=a();for(let t=0;t<16;t++)h[t]=s[t];for(let t=253;t>=0;t--)b(h,h),t!==2&&t!==4&&v(h,h,s);for(let t=0;t<16;t++)u[t]=h[t]}function A(u,s){const h=new Uint8Array(32),t=new Float64Array(80),i=a(),S=a(),C=a(),F=a(),L=a(),j=a();for(let m=0;m<31;m++)h[m]=u[m];h[31]=u[31]&127|64,h[0]&=248,d(t,s);for(let m=0;m<16;m++)S[m]=t[m];i[0]=F[0]=1;for(let m=254;m>=0;--m){const N=h[m>>>3]>>>(m&7)&1;f(i,S,N),f(C,F,N),E(L,i,C),y(i,i,C),E(C,S,F),y(S,S,F),b(F,L),b(j,i),v(i,C,i),v(C,S,L),E(L,i,C),y(i,i,C),b(S,i),y(C,F,j),v(i,C,l),E(i,i,F),v(C,C,i),v(i,F,j),v(F,S,t),b(S,L),f(i,S,N),f(C,F,N)}for(let m=0;m<16;m++)t[m+16]=i[m],t[m+32]=C[m],t[m+48]=S[m],t[m+64]=F[m];const B=t.subarray(32),T=t.subarray(16);g(B,B),v(T,T,B);const M=new Uint8Array(32);return c(M,T),M}e.scalarMult=A;function p(u){return A(u,D)}e.scalarMultBase=p;function O(u){if(u.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const s=new Uint8Array(u);return{publicKey:p(s),secretKey:s}}e.generateKeyPairFromSeed=O;function o(u){const s=(0,r.randomBytes)(32,u),h=O(s);return(0,n.wipe)(s),h}e.generateKeyPair=o;function _(u,s,h=!1){if(u.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(s.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const t=A(u,s);if(h){let i=0;for(let S=0;S<t.length;S++)i|=t[S];if(i===0)throw new Error("X25519: invalid shared key")}return t}e.sharedKey=_})(Ft);function mr(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),a=0;a<n.length;a++)n[a]=255;for(var D=0;D<e.length;D++){var l=e.charAt(D),w=l.charCodeAt(0);if(n[w]!==255)throw new TypeError(l+" is ambiguous");n[w]=D}var f=e.length,c=e.charAt(0),d=Math.log(f)/Math.log(256),E=Math.log(256)/Math.log(f);function y(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var A=0,p=0,O=0,o=g.length;O!==o&&g[O]===0;)O++,A++;for(var _=(o-O)*E+1>>>0,u=new Uint8Array(_);O!==o;){for(var s=g[O],h=0,t=_-1;(s!==0||h<p)&&t!==-1;t--,h++)s+=256*u[t]>>>0,u[t]=s%f>>>0,s=s/f>>>0;if(s!==0)throw new Error("Non-zero carry");p=h,O++}for(var i=_-p;i!==_&&u[i]===0;)i++;for(var S=c.repeat(A);i<_;++i)S+=e.charAt(u[i]);return S}function v(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var A=0;if(g[A]!==" "){for(var p=0,O=0;g[A]===c;)p++,A++;for(var o=(g.length-A)*d+1>>>0,_=new Uint8Array(o);g[A];){var u=n[g.charCodeAt(A)];if(u===255)return;for(var s=0,h=o-1;(u!==0||s<O)&&h!==-1;h--,s++)u+=f*_[h]>>>0,_[h]=u%256>>>0,u=u/256>>>0;if(u!==0)throw new Error("Non-zero carry");O=s,A++}if(g[A]!==" "){for(var t=o-O;t!==o&&_[t]===0;)t++;for(var i=new Uint8Array(p+(o-t)),S=p;t!==o;)i[S++]=_[t++];return i}}}function b(g){var A=v(g);if(A)return A;throw new Error(`Non-${r} character`)}return{encode:y,decodeUnsafe:v,decode:b}}var Cr=mr,pr=Cr;const Ar=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Ur=e=>new TextEncoder().encode(e),Or=e=>new TextDecoder().decode(e);class Fr{constructor(r,n,a){this.name=r,this.prefix=n,this.baseEncode=a}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Nr{constructor(r,n,a){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=a}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Nt(this,r)}}class Tr{constructor(r){this.decoders=r}or(r){return Nt(this,r)}decode(r){const n=r[0],a=this.decoders[n];if(a)return a.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Nt=(e,r)=>new Tr({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}});class Mr{constructor(r,n,a,D){this.name=r,this.prefix=n,this.baseEncode=a,this.baseDecode=D,this.encoder=new Fr(r,n,a),this.decoder=new Nr(r,n,D)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const je=({name:e,prefix:r,encode:n,decode:a})=>new Mr(e,r,n,a),Oe=({prefix:e,name:r,alphabet:n})=>{const{encode:a,decode:D}=pr(n,r);return je({prefix:e,name:r,encode:a,decode:l=>Ar(D(l))})},xr=(e,r,n,a)=>{const D={};for(let E=0;E<r.length;++E)D[r[E]]=E;let l=e.length;for(;e[l-1]==="=";)--l;const w=new Uint8Array(l*n/8|0);let f=0,c=0,d=0;for(let E=0;E<l;++E){const y=D[e[E]];if(y===void 0)throw new SyntaxError(`Non-${a} character`);c=c<<n|y,f+=n,f>=8&&(f-=8,w[d++]=255&c>>f)}if(f>=n||255&c<<8-f)throw new SyntaxError("Unexpected end of data");return w},Lr=(e,r,n)=>{const a=r[r.length-1]==="=",D=(1<<n)-1;let l="",w=0,f=0;for(let c=0;c<e.length;++c)for(f=f<<8|e[c],w+=8;w>n;)w-=n,l+=r[D&f>>w];if(w&&(l+=r[D&f<<n-w]),a)for(;l.length*n&7;)l+="=";return l},Q=({name:e,prefix:r,bitsPerChar:n,alphabet:a})=>je({prefix:r,name:e,encode(D){return Lr(D,a,n)},decode(D){return xr(D,a,n,e)}}),Br=je({prefix:"\0",name:"identity",encode:e=>Or(e),decode:e=>Ur(e)}),jr=Object.freeze(Object.defineProperty({__proto__:null,identity:Br},Symbol.toStringTag,{value:"Module"})),Ir=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Rr=Object.freeze(Object.defineProperty({__proto__:null,base2:Ir},Symbol.toStringTag,{value:"Module"})),Pr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Hr=Object.freeze(Object.defineProperty({__proto__:null,base8:Pr},Symbol.toStringTag,{value:"Module"})),Kr=Oe({prefix:"9",name:"base10",alphabet:"0123456789"}),zr=Object.freeze(Object.defineProperty({__proto__:null,base10:Kr},Symbol.toStringTag,{value:"Module"})),Yr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),$r=Object.freeze(Object.defineProperty({__proto__:null,base16:Yr,base16upper:qr},Symbol.toStringTag,{value:"Module"})),Gr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Xr=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jr=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qr=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zr=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kr=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),en=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),tn=Object.freeze(Object.defineProperty({__proto__:null,base32:Gr,base32hex:Jr,base32hexpad:Zr,base32hexpadupper:kr,base32hexupper:Qr,base32pad:Wr,base32padupper:Xr,base32upper:Vr,base32z:en},Symbol.toStringTag,{value:"Module"})),rn=Oe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),nn=Oe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),an=Object.freeze(Object.defineProperty({__proto__:null,base36:rn,base36upper:nn},Symbol.toStringTag,{value:"Module"})),un=Oe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fn=Oe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),hn=Object.freeze(Object.defineProperty({__proto__:null,base58btc:un,base58flickr:fn},Symbol.toStringTag,{value:"Module"})),sn=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),on=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cn=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ln=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Dn=Object.freeze(Object.defineProperty({__proto__:null,base64:sn,base64pad:on,base64url:cn,base64urlpad:ln},Symbol.toStringTag,{value:"Module"})),Tt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),_n=Tt.reduce((e,r,n)=>(e[n]=r,e),[]),dn=Tt.reduce((e,r,n)=>(e[r.codePointAt(0)]=n,e),[]);function En(e){return e.reduce((r,n)=>(r+=_n[n],r),"")}function bn(e){const r=[];for(const n of e){const a=dn[n.codePointAt(0)];if(a===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(a)}return new Uint8Array(r)}const vn=je({prefix:"🚀",name:"base256emoji",encode:En,decode:bn}),wn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:vn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var Mt={};/*! *****************************************************************************
1
+ "use strict";const Ye=require("./index-B-m4JhhB.js");var Et={},Me={},x={},bt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});function r(f,c){var d=f>>>16&65535,E=f&65535,y=c>>>16&65535,v=c&65535;return E*v+(d*v+E*y<<16>>>0)|0}e.mul=Math.imul||r;function n(f,c){return f+c|0}e.add=n;function a(f,c){return f-c|0}e.sub=a;function D(f,c){return f<<c|f>>>32-c}e.rotl=D;function l(f,c){return f<<32-c|f>>>c}e.rotr=l;function w(f){return typeof f=="number"&&isFinite(f)&&Math.floor(f)===f}e.isInteger=Number.isInteger||w,e.MAX_SAFE_INTEGER=9007199254740991,e.isSafeInteger=function(f){return e.isInteger(f)&&f>=-e.MAX_SAFE_INTEGER&&f<=e.MAX_SAFE_INTEGER}})(bt);Object.defineProperty(x,"__esModule",{value:!0});var vt=bt;function It(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])<<16>>16}x.readInt16BE=It;function Rt(e,r){return r===void 0&&(r=0),(e[r+0]<<8|e[r+1])>>>0}x.readUint16BE=Rt;function Pt(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])<<16>>16}x.readInt16LE=Pt;function Ht(e,r){return r===void 0&&(r=0),(e[r+1]<<8|e[r])>>>0}x.readUint16LE=Ht;function wt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>8,r[n+1]=e>>>0,r}x.writeUint16BE=wt;x.writeInt16BE=wt;function yt(e,r,n){return r===void 0&&(r=new Uint8Array(2)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r}x.writeUint16LE=yt;x.writeInt16LE=yt;function qe(e,r){return r===void 0&&(r=0),e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]}x.readInt32BE=qe;function $e(e,r){return r===void 0&&(r=0),(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3])>>>0}x.readUint32BE=$e;function Ge(e,r){return r===void 0&&(r=0),e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r]}x.readInt32LE=Ge;function Ve(e,r){return r===void 0&&(r=0),(e[r+3]<<24|e[r+2]<<16|e[r+1]<<8|e[r])>>>0}x.readUint32LE=Ve;function Ne(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>24,r[n+1]=e>>>16,r[n+2]=e>>>8,r[n+3]=e>>>0,r}x.writeUint32BE=Ne;x.writeInt32BE=Ne;function Te(e,r,n){return r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0),r[n+0]=e>>>0,r[n+1]=e>>>8,r[n+2]=e>>>16,r[n+3]=e>>>24,r}x.writeUint32LE=Te;x.writeInt32LE=Te;function Kt(e,r){r===void 0&&(r=0);var n=qe(e,r),a=qe(e,r+4);return n*4294967296+a-(a>>31)*4294967296}x.readInt64BE=Kt;function zt(e,r){r===void 0&&(r=0);var n=$e(e,r),a=$e(e,r+4);return n*4294967296+a}x.readUint64BE=zt;function Yt(e,r){r===void 0&&(r=0);var n=Ge(e,r),a=Ge(e,r+4);return a*4294967296+n-(n>>31)*4294967296}x.readInt64LE=Yt;function qt(e,r){r===void 0&&(r=0);var n=Ve(e,r),a=Ve(e,r+4);return a*4294967296+n}x.readUint64LE=qt;function gt(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Ne(e/4294967296>>>0,r,n),Ne(e>>>0,r,n+4),r}x.writeUint64BE=gt;x.writeInt64BE=gt;function St(e,r,n){return r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0),Te(e>>>0,r,n),Te(e/4294967296>>>0,r,n+4),r}x.writeUint64LE=St;x.writeInt64LE=St;function $t(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintBE: array is too short for the given bitLength");for(var a=0,D=1,l=e/8+n-1;l>=n;l--)a+=r[l]*D,D*=256;return a}x.readUintBE=$t;function Gt(e,r,n){if(n===void 0&&(n=0),e%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(e/8>r.length-n)throw new Error("readUintLE: array is too short for the given bitLength");for(var a=0,D=1,l=n;l<n+e/8;l++)a+=r[l]*D,D*=256;return a}x.readUintLE=Gt;function Vt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintBE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintBE value must be an integer");for(var D=1,l=e/8+a-1;l>=a;l--)n[l]=r/D&255,D*=256;return n}x.writeUintBE=Vt;function Wt(e,r,n,a){if(n===void 0&&(n=new Uint8Array(e/8)),a===void 0&&(a=0),e%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!vt.isSafeInteger(r))throw new Error("writeUintLE value must be an integer");for(var D=1,l=a;l<a+e/8;l++)n[l]=r/D&255,D*=256;return n}x.writeUintLE=Wt;function Xt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r)}x.readFloat32BE=Xt;function Jt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat32(r,!0)}x.readFloat32LE=Jt;function Qt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r)}x.readFloat64BE=Qt;function Zt(e,r){r===void 0&&(r=0);var n=new DataView(e.buffer,e.byteOffset,e.byteLength);return n.getFloat64(r,!0)}x.readFloat64LE=Zt;function kt(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e),r}x.writeFloat32BE=kt;function er(e,r,n){r===void 0&&(r=new Uint8Array(4)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat32(n,e,!0),r}x.writeFloat32LE=er;function tr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e),r}x.writeFloat64BE=tr;function rr(e,r,n){r===void 0&&(r=new Uint8Array(8)),n===void 0&&(n=0);var a=new DataView(r.buffer,r.byteOffset,r.byteLength);return a.setFloat64(n,e,!0),r}x.writeFloat64LE=rr;var de={};Object.defineProperty(de,"__esModule",{value:!0});function nr(e){for(var r=0;r<e.length;r++)e[r]=0;return e}de.wipe=nr;Object.defineProperty(Me,"__esModule",{value:!0});var _e=x,We=de,ir=20;function ar(e,r,n){for(var a=1634760805,D=857760878,l=2036477234,w=1797285236,f=n[3]<<24|n[2]<<16|n[1]<<8|n[0],c=n[7]<<24|n[6]<<16|n[5]<<8|n[4],d=n[11]<<24|n[10]<<16|n[9]<<8|n[8],E=n[15]<<24|n[14]<<16|n[13]<<8|n[12],y=n[19]<<24|n[18]<<16|n[17]<<8|n[16],v=n[23]<<24|n[22]<<16|n[21]<<8|n[20],b=n[27]<<24|n[26]<<16|n[25]<<8|n[24],g=n[31]<<24|n[30]<<16|n[29]<<8|n[28],A=r[3]<<24|r[2]<<16|r[1]<<8|r[0],p=r[7]<<24|r[6]<<16|r[5]<<8|r[4],O=r[11]<<24|r[10]<<16|r[9]<<8|r[8],o=r[15]<<24|r[14]<<16|r[13]<<8|r[12],_=a,u=D,s=l,h=w,t=f,i=c,S=d,C=E,F=y,L=v,j=b,B=g,T=A,M=p,m=O,N=o,G=0;G<ir;G+=2)_=_+t|0,T^=_,T=T>>>16|T<<16,F=F+T|0,t^=F,t=t>>>20|t<<12,u=u+i|0,M^=u,M=M>>>16|M<<16,L=L+M|0,i^=L,i=i>>>20|i<<12,s=s+S|0,m^=s,m=m>>>16|m<<16,j=j+m|0,S^=j,S=S>>>20|S<<12,h=h+C|0,N^=h,N=N>>>16|N<<16,B=B+N|0,C^=B,C=C>>>20|C<<12,s=s+S|0,m^=s,m=m>>>24|m<<8,j=j+m|0,S^=j,S=S>>>25|S<<7,h=h+C|0,N^=h,N=N>>>24|N<<8,B=B+N|0,C^=B,C=C>>>25|C<<7,u=u+i|0,M^=u,M=M>>>24|M<<8,L=L+M|0,i^=L,i=i>>>25|i<<7,_=_+t|0,T^=_,T=T>>>24|T<<8,F=F+T|0,t^=F,t=t>>>25|t<<7,_=_+i|0,N^=_,N=N>>>16|N<<16,j=j+N|0,i^=j,i=i>>>20|i<<12,u=u+S|0,T^=u,T=T>>>16|T<<16,B=B+T|0,S^=B,S=S>>>20|S<<12,s=s+C|0,M^=s,M=M>>>16|M<<16,F=F+M|0,C^=F,C=C>>>20|C<<12,h=h+t|0,m^=h,m=m>>>16|m<<16,L=L+m|0,t^=L,t=t>>>20|t<<12,s=s+C|0,M^=s,M=M>>>24|M<<8,F=F+M|0,C^=F,C=C>>>25|C<<7,h=h+t|0,m^=h,m=m>>>24|m<<8,L=L+m|0,t^=L,t=t>>>25|t<<7,u=u+S|0,T^=u,T=T>>>24|T<<8,B=B+T|0,S^=B,S=S>>>25|S<<7,_=_+i|0,N^=_,N=N>>>24|N<<8,j=j+N|0,i^=j,i=i>>>25|i<<7;_e.writeUint32LE(_+a|0,e,0),_e.writeUint32LE(u+D|0,e,4),_e.writeUint32LE(s+l|0,e,8),_e.writeUint32LE(h+w|0,e,12),_e.writeUint32LE(t+f|0,e,16),_e.writeUint32LE(i+c|0,e,20),_e.writeUint32LE(S+d|0,e,24),_e.writeUint32LE(C+E|0,e,28),_e.writeUint32LE(F+y|0,e,32),_e.writeUint32LE(L+v|0,e,36),_e.writeUint32LE(j+b|0,e,40),_e.writeUint32LE(B+g|0,e,44),_e.writeUint32LE(T+A|0,e,48),_e.writeUint32LE(M+p|0,e,52),_e.writeUint32LE(m+O|0,e,56),_e.writeUint32LE(N+o|0,e,60)}function mt(e,r,n,a,D){if(D===void 0&&(D=0),e.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(a.length<n.length)throw new Error("ChaCha: destination is shorter than source");var l,w;if(D===0){if(r.length!==8&&r.length!==12)throw new Error("ChaCha nonce must be 8 or 12 bytes");l=new Uint8Array(16),w=l.length-r.length,l.set(r,w)}else{if(r.length!==16)throw new Error("ChaCha nonce with counter must be 16 bytes");l=r,w=D}for(var f=new Uint8Array(64),c=0;c<n.length;c+=64){ar(f,l,e);for(var d=c;d<c+64&&d<n.length;d++)a[d]=n[d]^f[d-c];fr(l,0,w)}return We.wipe(f),D===0&&We.wipe(l),a}Me.streamXOR=mt;function ur(e,r,n,a){return a===void 0&&(a=0),We.wipe(n),mt(e,r,n,n,a)}Me.stream=ur;function fr(e,r,n){for(var a=1;n--;)a=a+(e[r]&255)|0,e[r]=a&255,a>>>=8,r++;if(a>0)throw new Error("ChaCha: counter overflow")}var Ct={},be={};Object.defineProperty(be,"__esModule",{value:!0});function hr(e,r,n){return~(e-1)&r|e-1&n}be.select=hr;function sr(e,r){return(e|0)-(r|0)-1>>>31&1}be.lessOrEqual=sr;function pt(e,r){if(e.length!==r.length)return 0;for(var n=0,a=0;a<e.length;a++)n|=e[a]^r[a];return 1&n-1>>>8}be.compare=pt;function or(e,r){return e.length===0||r.length===0?!1:pt(e,r)!==0}be.equal=or;(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=be,n=de;e.DIGEST_LENGTH=16;var a=function(){function w(f){this.digestLength=e.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var c=f[0]|f[1]<<8;this._r[0]=c&8191;var d=f[2]|f[3]<<8;this._r[1]=(c>>>13|d<<3)&8191;var E=f[4]|f[5]<<8;this._r[2]=(d>>>10|E<<6)&7939;var y=f[6]|f[7]<<8;this._r[3]=(E>>>7|y<<9)&8191;var v=f[8]|f[9]<<8;this._r[4]=(y>>>4|v<<12)&255,this._r[5]=v>>>1&8190;var b=f[10]|f[11]<<8;this._r[6]=(v>>>14|b<<2)&8191;var g=f[12]|f[13]<<8;this._r[7]=(b>>>11|g<<5)&8065;var A=f[14]|f[15]<<8;this._r[8]=(g>>>8|A<<8)&8191,this._r[9]=A>>>5&127,this._pad[0]=f[16]|f[17]<<8,this._pad[1]=f[18]|f[19]<<8,this._pad[2]=f[20]|f[21]<<8,this._pad[3]=f[22]|f[23]<<8,this._pad[4]=f[24]|f[25]<<8,this._pad[5]=f[26]|f[27]<<8,this._pad[6]=f[28]|f[29]<<8,this._pad[7]=f[30]|f[31]<<8}return w.prototype._blocks=function(f,c,d){for(var E=this._fin?0:2048,y=this._h[0],v=this._h[1],b=this._h[2],g=this._h[3],A=this._h[4],p=this._h[5],O=this._h[6],o=this._h[7],_=this._h[8],u=this._h[9],s=this._r[0],h=this._r[1],t=this._r[2],i=this._r[3],S=this._r[4],C=this._r[5],F=this._r[6],L=this._r[7],j=this._r[8],B=this._r[9];d>=16;){var T=f[c+0]|f[c+1]<<8;y+=T&8191;var M=f[c+2]|f[c+3]<<8;v+=(T>>>13|M<<3)&8191;var m=f[c+4]|f[c+5]<<8;b+=(M>>>10|m<<6)&8191;var N=f[c+6]|f[c+7]<<8;g+=(m>>>7|N<<9)&8191;var G=f[c+8]|f[c+9]<<8;A+=(N>>>4|G<<12)&8191,p+=G>>>1&8191;var J=f[c+10]|f[c+11]<<8;O+=(G>>>14|J<<2)&8191;var X=f[c+12]|f[c+13]<<8;o+=(J>>>11|X<<5)&8191;var W=f[c+14]|f[c+15]<<8;_+=(X>>>8|W<<8)&8191,u+=W>>>5|E;var U=0,I=U;I+=y*s,I+=v*(5*B),I+=b*(5*j),I+=g*(5*L),I+=A*(5*F),U=I>>>13,I&=8191,I+=p*(5*C),I+=O*(5*S),I+=o*(5*i),I+=_*(5*t),I+=u*(5*h),U+=I>>>13,I&=8191;var R=U;R+=y*h,R+=v*s,R+=b*(5*B),R+=g*(5*j),R+=A*(5*L),U=R>>>13,R&=8191,R+=p*(5*F),R+=O*(5*C),R+=o*(5*S),R+=_*(5*i),R+=u*(5*t),U+=R>>>13,R&=8191;var P=U;P+=y*t,P+=v*h,P+=b*s,P+=g*(5*B),P+=A*(5*j),U=P>>>13,P&=8191,P+=p*(5*L),P+=O*(5*F),P+=o*(5*C),P+=_*(5*S),P+=u*(5*i),U+=P>>>13,P&=8191;var H=U;H+=y*i,H+=v*t,H+=b*h,H+=g*s,H+=A*(5*B),U=H>>>13,H&=8191,H+=p*(5*j),H+=O*(5*L),H+=o*(5*F),H+=_*(5*C),H+=u*(5*S),U+=H>>>13,H&=8191;var K=U;K+=y*S,K+=v*i,K+=b*t,K+=g*h,K+=A*s,U=K>>>13,K&=8191,K+=p*(5*B),K+=O*(5*j),K+=o*(5*L),K+=_*(5*F),K+=u*(5*C),U+=K>>>13,K&=8191;var z=U;z+=y*C,z+=v*S,z+=b*i,z+=g*t,z+=A*h,U=z>>>13,z&=8191,z+=p*s,z+=O*(5*B),z+=o*(5*j),z+=_*(5*L),z+=u*(5*F),U+=z>>>13,z&=8191;var Y=U;Y+=y*F,Y+=v*C,Y+=b*S,Y+=g*i,Y+=A*t,U=Y>>>13,Y&=8191,Y+=p*h,Y+=O*s,Y+=o*(5*B),Y+=_*(5*j),Y+=u*(5*L),U+=Y>>>13,Y&=8191;var q=U;q+=y*L,q+=v*F,q+=b*C,q+=g*S,q+=A*i,U=q>>>13,q&=8191,q+=p*t,q+=O*h,q+=o*s,q+=_*(5*B),q+=u*(5*j),U+=q>>>13,q&=8191;var $=U;$+=y*j,$+=v*L,$+=b*F,$+=g*C,$+=A*S,U=$>>>13,$&=8191,$+=p*i,$+=O*t,$+=o*h,$+=_*s,$+=u*(5*B),U+=$>>>13,$&=8191;var V=U;V+=y*B,V+=v*j,V+=b*L,V+=g*F,V+=A*C,U=V>>>13,V&=8191,V+=p*S,V+=O*i,V+=o*t,V+=_*h,V+=u*s,U+=V>>>13,V&=8191,U=(U<<2)+U|0,U=U+I|0,I=U&8191,U=U>>>13,R+=U,y=I,v=R,b=P,g=H,A=K,p=z,O=Y,o=q,_=$,u=V,c+=16,d-=16}this._h[0]=y,this._h[1]=v,this._h[2]=b,this._h[3]=g,this._h[4]=A,this._h[5]=p,this._h[6]=O,this._h[7]=o,this._h[8]=_,this._h[9]=u},w.prototype.finish=function(f,c){c===void 0&&(c=0);var d=new Uint16Array(10),E,y,v,b;if(this._leftover){for(b=this._leftover,this._buffer[b++]=1;b<16;b++)this._buffer[b]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(E=this._h[1]>>>13,this._h[1]&=8191,b=2;b<10;b++)this._h[b]+=E,E=this._h[b]>>>13,this._h[b]&=8191;for(this._h[0]+=E*5,E=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=E,E=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=E,d[0]=this._h[0]+5,E=d[0]>>>13,d[0]&=8191,b=1;b<10;b++)d[b]=this._h[b]+E,E=d[b]>>>13,d[b]&=8191;for(d[9]-=8192,y=(E^1)-1,b=0;b<10;b++)d[b]&=y;for(y=~y,b=0;b<10;b++)this._h[b]=this._h[b]&y|d[b];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,v=this._h[0]+this._pad[0],this._h[0]=v&65535,b=1;b<8;b++)v=(this._h[b]+this._pad[b]|0)+(v>>>16)|0,this._h[b]=v&65535;return f[c+0]=this._h[0]>>>0,f[c+1]=this._h[0]>>>8,f[c+2]=this._h[1]>>>0,f[c+3]=this._h[1]>>>8,f[c+4]=this._h[2]>>>0,f[c+5]=this._h[2]>>>8,f[c+6]=this._h[3]>>>0,f[c+7]=this._h[3]>>>8,f[c+8]=this._h[4]>>>0,f[c+9]=this._h[4]>>>8,f[c+10]=this._h[5]>>>0,f[c+11]=this._h[5]>>>8,f[c+12]=this._h[6]>>>0,f[c+13]=this._h[6]>>>8,f[c+14]=this._h[7]>>>0,f[c+15]=this._h[7]>>>8,this._finished=!0,this},w.prototype.update=function(f){var c=0,d=f.length,E;if(this._leftover){E=16-this._leftover,E>d&&(E=d);for(var y=0;y<E;y++)this._buffer[this._leftover+y]=f[c+y];if(d-=E,c+=E,this._leftover+=E,this._leftover<16)return this;this._blocks(this._buffer,0,16),this._leftover=0}if(d>=16&&(E=d-d%16,this._blocks(f,c,E),c+=E,d-=E),d){for(var y=0;y<d;y++)this._buffer[this._leftover+y]=f[c+y];this._leftover+=d}return this},w.prototype.digest=function(){if(this._finished)throw new Error("Poly1305 was finished");var f=new Uint8Array(16);return this.finish(f),f},w.prototype.clean=function(){return n.wipe(this._buffer),n.wipe(this._r),n.wipe(this._h),n.wipe(this._pad),this._leftover=0,this._fin=0,this._finished=!0,this},w}();e.Poly1305=a;function D(w,f){var c=new a(w);c.update(f);var d=c.digest();return c.clean(),d}e.oneTimeAuth=D;function l(w,f){return w.length!==e.DIGEST_LENGTH||f.length!==e.DIGEST_LENGTH?!1:r.equal(w,f)}e.equal=l})(Ct);(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=Me,n=Ct,a=de,D=x,l=be;e.KEY_LENGTH=32,e.NONCE_LENGTH=12,e.TAG_LENGTH=16;var w=new Uint8Array(16),f=function(){function c(d){if(this.nonceLength=e.NONCE_LENGTH,this.tagLength=e.TAG_LENGTH,d.length!==e.KEY_LENGTH)throw new Error("ChaCha20Poly1305 needs 32-byte key");this._key=new Uint8Array(d)}return c.prototype.seal=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=E.length+this.tagLength,p;if(v){if(v.length!==A)throw new Error("ChaCha20Poly1305: incorrect destination length");p=v}else p=new Uint8Array(A);return r.streamXOR(this._key,b,E,p,4),this._authenticate(p.subarray(p.length-this.tagLength,p.length),g,p.subarray(0,p.length-this.tagLength),y),a.wipe(b),p},c.prototype.open=function(d,E,y,v){if(d.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(E.length<this.tagLength)return null;var b=new Uint8Array(16);b.set(d,b.length-d.length);var g=new Uint8Array(32);r.stream(this._key,b,g,4);var A=new Uint8Array(this.tagLength);if(this._authenticate(A,g,E.subarray(0,E.length-this.tagLength),y),!l.equal(A,E.subarray(E.length-this.tagLength,E.length)))return null;var p=E.length-this.tagLength,O;if(v){if(v.length!==p)throw new Error("ChaCha20Poly1305: incorrect destination length");O=v}else O=new Uint8Array(p);return r.streamXOR(this._key,b,E.subarray(0,E.length-this.tagLength),O,4),a.wipe(b),O},c.prototype.clean=function(){return a.wipe(this._key),this},c.prototype._authenticate=function(d,E,y,v){var b=new n.Poly1305(E);v&&(b.update(v),v.length%16>0&&b.update(w.subarray(v.length%16))),b.update(y),y.length%16>0&&b.update(w.subarray(y.length%16));var g=new Uint8Array(8);v&&D.writeUint64LE(v.length,g),b.update(g),D.writeUint64LE(y.length,g),b.update(g);for(var A=b.digest(),p=0;p<A.length;p++)d[p]=A[p];b.clean(),a.wipe(A),a.wipe(g)},c}();e.ChaCha20Poly1305=f})(Et);var At={},Ue={},ke={};Object.defineProperty(ke,"__esModule",{value:!0});function cr(e){return typeof e.saveState<"u"&&typeof e.restoreState<"u"&&typeof e.cleanSavedState<"u"}ke.isSerializableHash=cr;Object.defineProperty(Ue,"__esModule",{value:!0});var Ee=ke,lr=be,Dr=de,Ut=function(){function e(r,n){this._finished=!1,this._inner=new r,this._outer=new r,this.blockSize=this._outer.blockSize,this.digestLength=this._outer.digestLength;var a=new Uint8Array(this.blockSize);n.length>this.blockSize?this._inner.update(n).finish(a).clean():a.set(n);for(var D=0;D<a.length;D++)a[D]^=54;this._inner.update(a);for(var D=0;D<a.length;D++)a[D]^=106;this._outer.update(a),Ee.isSerializableHash(this._inner)&&Ee.isSerializableHash(this._outer)&&(this._innerKeyedState=this._inner.saveState(),this._outerKeyedState=this._outer.saveState()),Dr.wipe(a)}return e.prototype.reset=function(){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't reset() because hash doesn't implement restoreState()");return this._inner.restoreState(this._innerKeyedState),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.clean=function(){Ee.isSerializableHash(this._inner)&&this._inner.cleanSavedState(this._innerKeyedState),Ee.isSerializableHash(this._outer)&&this._outer.cleanSavedState(this._outerKeyedState),this._inner.clean(),this._outer.clean()},e.prototype.update=function(r){return this._inner.update(r),this},e.prototype.finish=function(r){return this._finished?(this._outer.finish(r),this):(this._inner.finish(r),this._outer.update(r.subarray(0,this.digestLength)).finish(r),this._finished=!0,this)},e.prototype.digest=function(){var r=new Uint8Array(this.digestLength);return this.finish(r),r},e.prototype.saveState=function(){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't saveState() because hash doesn't implement it");return this._inner.saveState()},e.prototype.restoreState=function(r){if(!Ee.isSerializableHash(this._inner)||!Ee.isSerializableHash(this._outer))throw new Error("hmac: can't restoreState() because hash doesn't implement it");return this._inner.restoreState(r),this._outer.restoreState(this._outerKeyedState),this._finished=!1,this},e.prototype.cleanSavedState=function(r){if(!Ee.isSerializableHash(this._inner))throw new Error("hmac: can't cleanSavedState() because hash doesn't implement it");this._inner.cleanSavedState(r)},e}();Ue.HMAC=Ut;function _r(e,r,n){var a=new Ut(e,r);a.update(n);var D=a.digest();return a.clean(),D}Ue.hmac=_r;Ue.equal=lr.equal;Object.defineProperty(At,"__esModule",{value:!0});var rt=Ue,nt=de,dr=function(){function e(r,n,a,D){a===void 0&&(a=new Uint8Array(0)),this._counter=new Uint8Array(1),this._hash=r,this._info=D;var l=rt.hmac(this._hash,a,n);this._hmac=new rt.HMAC(r,l),this._buffer=new Uint8Array(this._hmac.digestLength),this._bufpos=this._buffer.length}return e.prototype._fillBuffer=function(){this._counter[0]++;var r=this._counter[0];if(r===0)throw new Error("hkdf: cannot expand more");this._hmac.reset(),r>1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},e.prototype.expand=function(r){for(var n=new Uint8Array(r),a=0;a<n.length;a++)this._bufpos===this._buffer.length&&this._fillBuffer(),n[a]=this._buffer[this._bufpos++];return n},e.prototype.clean=function(){this._hmac.clean(),nt.wipe(this._buffer),nt.wipe(this._counter),this._bufpos=0},e}(),Er=At.HKDF=dr,et={},xe={},Le={};Object.defineProperty(Le,"__esModule",{value:!0});Le.BrowserRandomSource=void 0;const it=65536;class br{constructor(){this.isAvailable=!1,this.isInstantiated=!1;const r=typeof self<"u"?self.crypto||self.msCrypto:null;r&&r.getRandomValues!==void 0&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Browser random byte generator is not available.");const n=new Uint8Array(r);for(let a=0;a<n.length;a+=it)this._crypto.getRandomValues(n.subarray(a,a+Math.min(n.length-a,it)));return n}}Le.BrowserRandomSource=br;var Be={};Object.defineProperty(Be,"__esModule",{value:!0});Be.NodeRandomSource=void 0;const vr=de;class wr{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof Ye.commonjsRequire<"u"){const r=Ye.requireCryptoBrowserify();r&&r.randomBytes&&(this._crypto=r,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(r){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let n=this._crypto.randomBytes(r);if(n.length!==r)throw new Error("NodeRandomSource: got fewer bytes than requested");const a=new Uint8Array(r);for(let D=0;D<a.length;D++)a[D]=n[D];return(0,vr.wipe)(n),a}}Be.NodeRandomSource=wr;Object.defineProperty(xe,"__esModule",{value:!0});xe.SystemRandomSource=void 0;const yr=Le,gr=Be;class Sr{constructor(){if(this.isAvailable=!1,this.name="",this._source=new yr.BrowserRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Browser";return}if(this._source=new gr.NodeRandomSource,this._source.isAvailable){this.isAvailable=!0,this.name="Node";return}}randomBytes(r){if(!this.isAvailable)throw new Error("System random byte generator is not available.");return this._source.randomBytes(r)}}xe.SystemRandomSource=Sr;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.randomStringForEntropy=e.randomString=e.randomUint32=e.randomBytes=e.defaultRandomSource=void 0;const r=xe,n=x,a=de;e.defaultRandomSource=new r.SystemRandomSource;function D(d,E=e.defaultRandomSource){return E.randomBytes(d)}e.randomBytes=D;function l(d=e.defaultRandomSource){const E=D(4,d),y=(0,n.readUint32LE)(E);return(0,a.wipe)(E),y}e.randomUint32=l;const w="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";function f(d,E=w,y=e.defaultRandomSource){if(E.length<2)throw new Error("randomString charset is too short");if(E.length>256)throw new Error("randomString charset is too long");let v="";const b=E.length,g=256-256%b;for(;d>0;){const A=D(Math.ceil(d*256/g),y);for(let p=0;p<A.length&&d>0;p++){const O=A[p];O<g&&(v+=E.charAt(O%b),d--)}(0,a.wipe)(A)}return v}e.randomString=f;function c(d,E=w,y=e.defaultRandomSource){const v=Math.ceil(d/(Math.log(E.length)/Math.LN2));return f(v,E,y)}e.randomStringForEntropy=c})(et);var Ot={};(function(e){Object.defineProperty(e,"__esModule",{value:!0});var r=x,n=de;e.DIGEST_LENGTH=32,e.BLOCK_SIZE=64;var a=function(){function f(){this.digestLength=e.DIGEST_LENGTH,this.blockSize=e.BLOCK_SIZE,this._state=new Int32Array(8),this._temp=new Int32Array(64),this._buffer=new Uint8Array(128),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return f.prototype._initState=function(){this._state[0]=1779033703,this._state[1]=3144134277,this._state[2]=1013904242,this._state[3]=2773480762,this._state[4]=1359893119,this._state[5]=2600822924,this._state[6]=528734635,this._state[7]=1541459225},f.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},f.prototype.clean=function(){n.wipe(this._buffer),n.wipe(this._temp),this.reset()},f.prototype.update=function(c,d){if(d===void 0&&(d=c.length),this._finished)throw new Error("SHA256: can't update because hash was finished.");var E=0;if(this._bytesHashed+=d,this._bufferLength>0){for(;this._bufferLength<this.blockSize&&d>0;)this._buffer[this._bufferLength++]=c[E++],d--;this._bufferLength===this.blockSize&&(l(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(d>=this.blockSize&&(E=l(this._temp,this._state,c,E,d),d%=this.blockSize);d>0;)this._buffer[this._bufferLength++]=c[E++],d--;return this},f.prototype.finish=function(c){if(!this._finished){var d=this._bytesHashed,E=this._bufferLength,y=d/536870912|0,v=d<<3,b=d%64<56?64:128;this._buffer[E]=128;for(var g=E+1;g<b-8;g++)this._buffer[g]=0;r.writeUint32BE(y,this._buffer,b-8),r.writeUint32BE(v,this._buffer,b-4),l(this._temp,this._state,this._buffer,0,b),this._finished=!0}for(var g=0;g<this.digestLength/4;g++)r.writeUint32BE(this._state[g],c,g*4);return this},f.prototype.digest=function(){var c=new Uint8Array(this.digestLength);return this.finish(c),c},f.prototype.saveState=function(){if(this._finished)throw new Error("SHA256: cannot save finished state");return{state:new Int32Array(this._state),buffer:this._bufferLength>0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},f.prototype.restoreState=function(c){return this._state.set(c.state),this._bufferLength=c.bufferLength,c.buffer&&this._buffer.set(c.buffer),this._bytesHashed=c.bytesHashed,this._finished=!1,this},f.prototype.cleanSavedState=function(c){n.wipe(c.state),c.buffer&&n.wipe(c.buffer),c.bufferLength=0,c.bytesHashed=0},f}();e.SHA256=a;var D=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function l(f,c,d,E,y){for(;y>=64;){for(var v=c[0],b=c[1],g=c[2],A=c[3],p=c[4],O=c[5],o=c[6],_=c[7],u=0;u<16;u++){var s=E+u*4;f[u]=r.readUint32BE(d,s)}for(var u=16;u<64;u++){var h=f[u-2],t=(h>>>17|h<<15)^(h>>>19|h<<13)^h>>>10;h=f[u-15];var i=(h>>>7|h<<25)^(h>>>18|h<<14)^h>>>3;f[u]=(t+f[u-7]|0)+(i+f[u-16]|0)}for(var u=0;u<64;u++){var t=(((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(p&O^~p&o)|0)+(_+(D[u]+f[u]|0)|0)|0,i=((v>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10))+(v&b^v&g^b&g)|0;_=o,o=O,O=p,p=A+t|0,A=g,g=b,b=v,v=t+i|0}c[0]+=v,c[1]+=b,c[2]+=g,c[3]+=A,c[4]+=p,c[5]+=O,c[6]+=o,c[7]+=_,E+=64,y-=64}return E}function w(f){var c=new a;c.update(f);var d=c.digest();return c.clean(),d}e.hash=w})(Ot);var Ft={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.sharedKey=e.generateKeyPair=e.generateKeyPairFromSeed=e.scalarMultBase=e.scalarMult=e.SHARED_KEY_LENGTH=e.SECRET_KEY_LENGTH=e.PUBLIC_KEY_LENGTH=void 0;const r=et,n=de;e.PUBLIC_KEY_LENGTH=32,e.SECRET_KEY_LENGTH=32,e.SHARED_KEY_LENGTH=32;function a(u){const s=new Float64Array(16);if(u)for(let h=0;h<u.length;h++)s[h]=u[h];return s}const D=new Uint8Array(32);D[0]=9;const l=a([56129,1]);function w(u){let s=1;for(let h=0;h<16;h++){let t=u[h]+s+65535;s=Math.floor(t/65536),u[h]=t-s*65536}u[0]+=s-1+37*(s-1)}function f(u,s,h){const t=~(h-1);for(let i=0;i<16;i++){const S=t&(u[i]^s[i]);u[i]^=S,s[i]^=S}}function c(u,s){const h=a(),t=a();for(let i=0;i<16;i++)t[i]=s[i];w(t),w(t),w(t);for(let i=0;i<2;i++){h[0]=t[0]-65517;for(let C=1;C<15;C++)h[C]=t[C]-65535-(h[C-1]>>16&1),h[C-1]&=65535;h[15]=t[15]-32767-(h[14]>>16&1);const S=h[15]>>16&1;h[14]&=65535,f(t,h,1-S)}for(let i=0;i<16;i++)u[2*i]=t[i]&255,u[2*i+1]=t[i]>>8}function d(u,s){for(let h=0;h<16;h++)u[h]=s[2*h]+(s[2*h+1]<<8);u[15]&=32767}function E(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]+h[t]}function y(u,s,h){for(let t=0;t<16;t++)u[t]=s[t]-h[t]}function v(u,s,h){let t,i,S=0,C=0,F=0,L=0,j=0,B=0,T=0,M=0,m=0,N=0,G=0,J=0,X=0,W=0,U=0,I=0,R=0,P=0,H=0,K=0,z=0,Y=0,q=0,$=0,V=0,ve=0,ge=0,me=0,Fe=0,Re=0,tt=0,Z=h[0],k=h[1],ee=h[2],te=h[3],re=h[4],ne=h[5],ie=h[6],ae=h[7],ue=h[8],fe=h[9],he=h[10],se=h[11],oe=h[12],ce=h[13],le=h[14],De=h[15];t=s[0],S+=t*Z,C+=t*k,F+=t*ee,L+=t*te,j+=t*re,B+=t*ne,T+=t*ie,M+=t*ae,m+=t*ue,N+=t*fe,G+=t*he,J+=t*se,X+=t*oe,W+=t*ce,U+=t*le,I+=t*De,t=s[1],C+=t*Z,F+=t*k,L+=t*ee,j+=t*te,B+=t*re,T+=t*ne,M+=t*ie,m+=t*ae,N+=t*ue,G+=t*fe,J+=t*he,X+=t*se,W+=t*oe,U+=t*ce,I+=t*le,R+=t*De,t=s[2],F+=t*Z,L+=t*k,j+=t*ee,B+=t*te,T+=t*re,M+=t*ne,m+=t*ie,N+=t*ae,G+=t*ue,J+=t*fe,X+=t*he,W+=t*se,U+=t*oe,I+=t*ce,R+=t*le,P+=t*De,t=s[3],L+=t*Z,j+=t*k,B+=t*ee,T+=t*te,M+=t*re,m+=t*ne,N+=t*ie,G+=t*ae,J+=t*ue,X+=t*fe,W+=t*he,U+=t*se,I+=t*oe,R+=t*ce,P+=t*le,H+=t*De,t=s[4],j+=t*Z,B+=t*k,T+=t*ee,M+=t*te,m+=t*re,N+=t*ne,G+=t*ie,J+=t*ae,X+=t*ue,W+=t*fe,U+=t*he,I+=t*se,R+=t*oe,P+=t*ce,H+=t*le,K+=t*De,t=s[5],B+=t*Z,T+=t*k,M+=t*ee,m+=t*te,N+=t*re,G+=t*ne,J+=t*ie,X+=t*ae,W+=t*ue,U+=t*fe,I+=t*he,R+=t*se,P+=t*oe,H+=t*ce,K+=t*le,z+=t*De,t=s[6],T+=t*Z,M+=t*k,m+=t*ee,N+=t*te,G+=t*re,J+=t*ne,X+=t*ie,W+=t*ae,U+=t*ue,I+=t*fe,R+=t*he,P+=t*se,H+=t*oe,K+=t*ce,z+=t*le,Y+=t*De,t=s[7],M+=t*Z,m+=t*k,N+=t*ee,G+=t*te,J+=t*re,X+=t*ne,W+=t*ie,U+=t*ae,I+=t*ue,R+=t*fe,P+=t*he,H+=t*se,K+=t*oe,z+=t*ce,Y+=t*le,q+=t*De,t=s[8],m+=t*Z,N+=t*k,G+=t*ee,J+=t*te,X+=t*re,W+=t*ne,U+=t*ie,I+=t*ae,R+=t*ue,P+=t*fe,H+=t*he,K+=t*se,z+=t*oe,Y+=t*ce,q+=t*le,$+=t*De,t=s[9],N+=t*Z,G+=t*k,J+=t*ee,X+=t*te,W+=t*re,U+=t*ne,I+=t*ie,R+=t*ae,P+=t*ue,H+=t*fe,K+=t*he,z+=t*se,Y+=t*oe,q+=t*ce,$+=t*le,V+=t*De,t=s[10],G+=t*Z,J+=t*k,X+=t*ee,W+=t*te,U+=t*re,I+=t*ne,R+=t*ie,P+=t*ae,H+=t*ue,K+=t*fe,z+=t*he,Y+=t*se,q+=t*oe,$+=t*ce,V+=t*le,ve+=t*De,t=s[11],J+=t*Z,X+=t*k,W+=t*ee,U+=t*te,I+=t*re,R+=t*ne,P+=t*ie,H+=t*ae,K+=t*ue,z+=t*fe,Y+=t*he,q+=t*se,$+=t*oe,V+=t*ce,ve+=t*le,ge+=t*De,t=s[12],X+=t*Z,W+=t*k,U+=t*ee,I+=t*te,R+=t*re,P+=t*ne,H+=t*ie,K+=t*ae,z+=t*ue,Y+=t*fe,q+=t*he,$+=t*se,V+=t*oe,ve+=t*ce,ge+=t*le,me+=t*De,t=s[13],W+=t*Z,U+=t*k,I+=t*ee,R+=t*te,P+=t*re,H+=t*ne,K+=t*ie,z+=t*ae,Y+=t*ue,q+=t*fe,$+=t*he,V+=t*se,ve+=t*oe,ge+=t*ce,me+=t*le,Fe+=t*De,t=s[14],U+=t*Z,I+=t*k,R+=t*ee,P+=t*te,H+=t*re,K+=t*ne,z+=t*ie,Y+=t*ae,q+=t*ue,$+=t*fe,V+=t*he,ve+=t*se,ge+=t*oe,me+=t*ce,Fe+=t*le,Re+=t*De,t=s[15],I+=t*Z,R+=t*k,P+=t*ee,H+=t*te,K+=t*re,z+=t*ne,Y+=t*ie,q+=t*ae,$+=t*ue,V+=t*fe,ve+=t*he,ge+=t*se,me+=t*oe,Fe+=t*ce,Re+=t*le,tt+=t*De,S+=38*R,C+=38*P,F+=38*H,L+=38*K,j+=38*z,B+=38*Y,T+=38*q,M+=38*$,m+=38*V,N+=38*ve,G+=38*ge,J+=38*me,X+=38*Fe,W+=38*Re,U+=38*tt,i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),i=1,t=S+i+65535,i=Math.floor(t/65536),S=t-i*65536,t=C+i+65535,i=Math.floor(t/65536),C=t-i*65536,t=F+i+65535,i=Math.floor(t/65536),F=t-i*65536,t=L+i+65535,i=Math.floor(t/65536),L=t-i*65536,t=j+i+65535,i=Math.floor(t/65536),j=t-i*65536,t=B+i+65535,i=Math.floor(t/65536),B=t-i*65536,t=T+i+65535,i=Math.floor(t/65536),T=t-i*65536,t=M+i+65535,i=Math.floor(t/65536),M=t-i*65536,t=m+i+65535,i=Math.floor(t/65536),m=t-i*65536,t=N+i+65535,i=Math.floor(t/65536),N=t-i*65536,t=G+i+65535,i=Math.floor(t/65536),G=t-i*65536,t=J+i+65535,i=Math.floor(t/65536),J=t-i*65536,t=X+i+65535,i=Math.floor(t/65536),X=t-i*65536,t=W+i+65535,i=Math.floor(t/65536),W=t-i*65536,t=U+i+65535,i=Math.floor(t/65536),U=t-i*65536,t=I+i+65535,i=Math.floor(t/65536),I=t-i*65536,S+=i-1+37*(i-1),u[0]=S,u[1]=C,u[2]=F,u[3]=L,u[4]=j,u[5]=B,u[6]=T,u[7]=M,u[8]=m,u[9]=N,u[10]=G,u[11]=J,u[12]=X,u[13]=W,u[14]=U,u[15]=I}function b(u,s){v(u,s,s)}function g(u,s){const h=a();for(let t=0;t<16;t++)h[t]=s[t];for(let t=253;t>=0;t--)b(h,h),t!==2&&t!==4&&v(h,h,s);for(let t=0;t<16;t++)u[t]=h[t]}function A(u,s){const h=new Uint8Array(32),t=new Float64Array(80),i=a(),S=a(),C=a(),F=a(),L=a(),j=a();for(let m=0;m<31;m++)h[m]=u[m];h[31]=u[31]&127|64,h[0]&=248,d(t,s);for(let m=0;m<16;m++)S[m]=t[m];i[0]=F[0]=1;for(let m=254;m>=0;--m){const N=h[m>>>3]>>>(m&7)&1;f(i,S,N),f(C,F,N),E(L,i,C),y(i,i,C),E(C,S,F),y(S,S,F),b(F,L),b(j,i),v(i,C,i),v(C,S,L),E(L,i,C),y(i,i,C),b(S,i),y(C,F,j),v(i,C,l),E(i,i,F),v(C,C,i),v(i,F,j),v(F,S,t),b(S,L),f(i,S,N),f(C,F,N)}for(let m=0;m<16;m++)t[m+16]=i[m],t[m+32]=C[m],t[m+48]=S[m],t[m+64]=F[m];const B=t.subarray(32),T=t.subarray(16);g(B,B),v(T,T,B);const M=new Uint8Array(32);return c(M,T),M}e.scalarMult=A;function p(u){return A(u,D)}e.scalarMultBase=p;function O(u){if(u.length!==e.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${e.SECRET_KEY_LENGTH} bytes`);const s=new Uint8Array(u);return{publicKey:p(s),secretKey:s}}e.generateKeyPairFromSeed=O;function o(u){const s=(0,r.randomBytes)(32,u),h=O(s);return(0,n.wipe)(s),h}e.generateKeyPair=o;function _(u,s,h=!1){if(u.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(s.length!==e.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const t=A(u,s);if(h){let i=0;for(let S=0;S<t.length;S++)i|=t[S];if(i===0)throw new Error("X25519: invalid shared key")}return t}e.sharedKey=_})(Ft);function mr(e,r){if(e.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),a=0;a<n.length;a++)n[a]=255;for(var D=0;D<e.length;D++){var l=e.charAt(D),w=l.charCodeAt(0);if(n[w]!==255)throw new TypeError(l+" is ambiguous");n[w]=D}var f=e.length,c=e.charAt(0),d=Math.log(f)/Math.log(256),E=Math.log(256)/Math.log(f);function y(g){if(g instanceof Uint8Array||(ArrayBuffer.isView(g)?g=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):Array.isArray(g)&&(g=Uint8Array.from(g))),!(g instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(g.length===0)return"";for(var A=0,p=0,O=0,o=g.length;O!==o&&g[O]===0;)O++,A++;for(var _=(o-O)*E+1>>>0,u=new Uint8Array(_);O!==o;){for(var s=g[O],h=0,t=_-1;(s!==0||h<p)&&t!==-1;t--,h++)s+=256*u[t]>>>0,u[t]=s%f>>>0,s=s/f>>>0;if(s!==0)throw new Error("Non-zero carry");p=h,O++}for(var i=_-p;i!==_&&u[i]===0;)i++;for(var S=c.repeat(A);i<_;++i)S+=e.charAt(u[i]);return S}function v(g){if(typeof g!="string")throw new TypeError("Expected String");if(g.length===0)return new Uint8Array;var A=0;if(g[A]!==" "){for(var p=0,O=0;g[A]===c;)p++,A++;for(var o=(g.length-A)*d+1>>>0,_=new Uint8Array(o);g[A];){var u=n[g.charCodeAt(A)];if(u===255)return;for(var s=0,h=o-1;(u!==0||s<O)&&h!==-1;h--,s++)u+=f*_[h]>>>0,_[h]=u%256>>>0,u=u/256>>>0;if(u!==0)throw new Error("Non-zero carry");O=s,A++}if(g[A]!==" "){for(var t=o-O;t!==o&&_[t]===0;)t++;for(var i=new Uint8Array(p+(o-t)),S=p;t!==o;)i[S++]=_[t++];return i}}}function b(g){var A=v(g);if(A)return A;throw new Error(`Non-${r} character`)}return{encode:y,decodeUnsafe:v,decode:b}}var Cr=mr,pr=Cr;const Ar=e=>{if(e instanceof Uint8Array&&e.constructor.name==="Uint8Array")return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw new Error("Unknown type, must be binary type")},Ur=e=>new TextEncoder().encode(e),Or=e=>new TextDecoder().decode(e);class Fr{constructor(r,n,a){this.name=r,this.prefix=n,this.baseEncode=a}encode(r){if(r instanceof Uint8Array)return`${this.prefix}${this.baseEncode(r)}`;throw Error("Unknown type, must be binary type")}}class Nr{constructor(r,n,a){if(this.name=r,this.prefix=n,n.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=n.codePointAt(0),this.baseDecode=a}decode(r){if(typeof r=="string"){if(r.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(r)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(r.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(r){return Nt(this,r)}}class Tr{constructor(r){this.decoders=r}or(r){return Nt(this,r)}decode(r){const n=r[0],a=this.decoders[n];if(a)return a.decode(r);throw RangeError(`Unable to decode multibase string ${JSON.stringify(r)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Nt=(e,r)=>new Tr({...e.decoders||{[e.prefix]:e},...r.decoders||{[r.prefix]:r}});class Mr{constructor(r,n,a,D){this.name=r,this.prefix=n,this.baseEncode=a,this.baseDecode=D,this.encoder=new Fr(r,n,a),this.decoder=new Nr(r,n,D)}encode(r){return this.encoder.encode(r)}decode(r){return this.decoder.decode(r)}}const je=({name:e,prefix:r,encode:n,decode:a})=>new Mr(e,r,n,a),Oe=({prefix:e,name:r,alphabet:n})=>{const{encode:a,decode:D}=pr(n,r);return je({prefix:e,name:r,encode:a,decode:l=>Ar(D(l))})},xr=(e,r,n,a)=>{const D={};for(let E=0;E<r.length;++E)D[r[E]]=E;let l=e.length;for(;e[l-1]==="=";)--l;const w=new Uint8Array(l*n/8|0);let f=0,c=0,d=0;for(let E=0;E<l;++E){const y=D[e[E]];if(y===void 0)throw new SyntaxError(`Non-${a} character`);c=c<<n|y,f+=n,f>=8&&(f-=8,w[d++]=255&c>>f)}if(f>=n||255&c<<8-f)throw new SyntaxError("Unexpected end of data");return w},Lr=(e,r,n)=>{const a=r[r.length-1]==="=",D=(1<<n)-1;let l="",w=0,f=0;for(let c=0;c<e.length;++c)for(f=f<<8|e[c],w+=8;w>n;)w-=n,l+=r[D&f>>w];if(w&&(l+=r[D&f<<n-w]),a)for(;l.length*n&7;)l+="=";return l},Q=({name:e,prefix:r,bitsPerChar:n,alphabet:a})=>je({prefix:r,name:e,encode(D){return Lr(D,a,n)},decode(D){return xr(D,a,n,e)}}),Br=je({prefix:"\0",name:"identity",encode:e=>Or(e),decode:e=>Ur(e)}),jr=Object.freeze(Object.defineProperty({__proto__:null,identity:Br},Symbol.toStringTag,{value:"Module"})),Ir=Q({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),Rr=Object.freeze(Object.defineProperty({__proto__:null,base2:Ir},Symbol.toStringTag,{value:"Module"})),Pr=Q({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),Hr=Object.freeze(Object.defineProperty({__proto__:null,base8:Pr},Symbol.toStringTag,{value:"Module"})),Kr=Oe({prefix:"9",name:"base10",alphabet:"0123456789"}),zr=Object.freeze(Object.defineProperty({__proto__:null,base10:Kr},Symbol.toStringTag,{value:"Module"})),Yr=Q({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qr=Q({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),$r=Object.freeze(Object.defineProperty({__proto__:null,base16:Yr,base16upper:qr},Symbol.toStringTag,{value:"Module"})),Gr=Q({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Vr=Q({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wr=Q({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Xr=Q({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Jr=Q({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Qr=Q({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Zr=Q({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),kr=Q({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),en=Q({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),tn=Object.freeze(Object.defineProperty({__proto__:null,base32:Gr,base32hex:Jr,base32hexpad:Zr,base32hexpadupper:kr,base32hexupper:Qr,base32pad:Wr,base32padupper:Xr,base32upper:Vr,base32z:en},Symbol.toStringTag,{value:"Module"})),rn=Oe({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),nn=Oe({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),an=Object.freeze(Object.defineProperty({__proto__:null,base36:rn,base36upper:nn},Symbol.toStringTag,{value:"Module"})),un=Oe({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),fn=Oe({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),hn=Object.freeze(Object.defineProperty({__proto__:null,base58btc:un,base58flickr:fn},Symbol.toStringTag,{value:"Module"})),sn=Q({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),on=Q({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cn=Q({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ln=Q({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),Dn=Object.freeze(Object.defineProperty({__proto__:null,base64:sn,base64pad:on,base64url:cn,base64urlpad:ln},Symbol.toStringTag,{value:"Module"})),Tt=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),_n=Tt.reduce((e,r,n)=>(e[n]=r,e),[]),dn=Tt.reduce((e,r,n)=>(e[r.codePointAt(0)]=n,e),[]);function En(e){return e.reduce((r,n)=>(r+=_n[n],r),"")}function bn(e){const r=[];for(const n of e){const a=dn[n.codePointAt(0)];if(a===void 0)throw new Error(`Non-base256emoji character: ${n}`);r.push(a)}return new Uint8Array(r)}const vn=je({prefix:"🚀",name:"base256emoji",encode:En,decode:bn}),wn=Object.freeze(Object.defineProperty({__proto__:null,base256emoji:vn},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;var Mt={};/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- "use strict";var D=Object.defineProperty;var q=(o,e,n)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n;var p=(o,e,n)=>q(o,typeof e!="symbol"?e+"":e,n);const t=require("./index-COPDbEYS.js"),H=require("./algorand-B5akecmo.js");class j{constructor(e,n,r,s,i=!1){p(this,"transaction");p(this,"network");p(this,"chain");p(this,"description");p(this,"parallelizable");this.transaction=e,this.network=n,this.chain=r,this.description=s,this.parallelizable=i}}const K=1002e3,O=15,U=127,L=8,R=U*L,V=U*O,N=L*V,m={_limit:127,encodingLength:o=>{let e=0;for(;o>=128;e++)o>>=7;return e+1},encode:(o,e,n)=>{if(typeof o=="bigint"&&(o=t.safeBigIntToNumber(o)),o<0)throw new RangeError("value must be unsigned");const r=m.encodingLength(o);if(e=e||new ArrayBuffer(r),n=n||0,e.byteLength<n+r)throw new RangeError("the buffer is too small to encode the number at the offset");const s=new Uint8Array(e,n);let i=0;for(;m._limit<o;)s[i++]=o&m._limit|128,o>>=7;return s[i]=Number(o),s},decode:(o,e=0)=>{let n=0,r=0,s;do{if(s=o[e+r],s===void 0)throw new RangeError("offset out of range");n+=(s&m._limit)<<r*7,r++}while(128<=s);return n}},u={forMessageId:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey,r=e.emitter.toUniversalAddress().toUint8Array(),s=t.bignum.toBytes(BigInt(t.toChainId(e.chain)),2),i=t.bytes.concat(s,r);return u.fromData({appId:o,appAddress:n,idx:e.sequence/BigInt(N),address:i})},forWrappedAsset:(o,e)=>{if(t.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(t.toChainId(e.chain)),address:e.address.toUniversalAddress().toUint8Array()})},forNativeAsset:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:e,address:t.bytes.encode("native")})},forGuardianSet:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(e),address:t.bytes.encode("guardian")})},forEmitter:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:0n,address:e})},_encode:o=>typeof o=="bigint"?[t.hex.encode(m.encode(o))]:[t.hex.encode(m.encode(o.length)),t.hex.encode(o)],fromData:o=>{const e=["0620010181",...u._encode(o.idx),"4880",...u._encode(o.address),"483110810612443119221244311881",...u._encode(o.appId),"1244312080",...u._encode(o.appAddress),"124431018100124431093203124431153203124422"],n=t.hex.decode(e.join(""));return new t.LogicSigAccount(n)},decodeLocalState:async(o,e,n)=>{let r;try{const a=await o.accountApplicationInformation(n,t.safeBigIntToNumber(e)).do();r=t.AccountApplicationResponse.from_obj_for_encoding(a).appLocalState}catch{return new Uint8Array}const s=t.b64.encode("meta");let i=new Map;for(const a of r.keyValue){if(a.key===s)continue;const g=t.b64.decode(a.key)[0],l=t.b64.decode(a.value.bytes);i.set(g,l)}const d=[];for(let a=0;a<O;a++)i.has(a)&&d.push(i.get(a));return t.bytes.concat(...d)},checkBitsSet:async(o,e,n,r)=>{let s=!1,i;const d=await o.accountInformation(n).do(),g=t.Account.from_obj_for_encoding(d).appsLocalState;if(g&&g.forEach(h=>{BigInt(h.id)===e&&(i=h.keyValue)}),(i==null?void 0:i.length)===0)return s;const l=BigInt(N),f=BigInt(8),y=r/l*l,b=t.safeBigIntToNumber(r-y),T=Math.floor(b/R),x=Math.floor((b-T*R)/8),B=t.b64.encode(t.bignum.toBytes(T,1));return i==null||i.forEach(h=>{if(h.key===B){const _=t.dist.Buffer.from(h.value.bytes,"base64"),w=1<<t.safeBigIntToNumber(r%f);s=(_[x]&w)!=0;return}}),s},storageAccountExists:async(o,e,n)=>{try{const r=await o.accountApplicationInformation(e,t.safeBigIntToNumber(n)).do();return Object.keys(r).length>0}catch{}return!1}},c=class c{constructor(e,n,r,s){p(this,"network");p(this,"chain");p(this,"connection");p(this,"contracts");p(this,"chainId");p(this,"coreAppId");p(this,"coreAppAddress");p(this,"tokenBridgeAppId");p(this,"tokenBridgeAppAddress");if(this.network=e,this.chain=n,this.connection=r,this.contracts=s,this.chainId=t.toChainId(n),!s.coreBridge)throw new Error(`Core contract address for chain ${n} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${n} not found`);const d=BigInt(s.tokenBridge);this.tokenBridgeAppId=d,this.tokenBridgeAppAddress=t.getApplicationAddress(d)}getGuardianSet(e){throw new Error("Method not implemented.")}async*verifyMessage(e,n,r){const s=new t.AlgorandAddress(e).toString(),i=await c.submitVAAHeader(this.connection,this.coreAppId,r??this.coreAppId,n,s);for(const d of i.txs)yield this.createUnsignedTx(d,"Core.verifyMessage")}static async fromRpc(e,n){const[r,s]=await H.AlgorandPlatform.chainFromRpc(e),i=n[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} !== ${r}`);return new c(r,s,e,i.contracts)}async*publishMessage(e,n){const r=new t.AlgorandAddress(e),s=r.toString(),i=await this.connection.getTransactionParams().do(),d=u.forEmitter(this.coreAppId,r.toUint8Array()),{accounts:a,txs:g}=await c.maybeCreateStorageTx(this.connection,s,this.coreAppId,d,i);for(const f of g)yield this.createUnsignedTx(f,"Core.publishMessage",!0);const l=t.makeApplicationCallTxnFromObject({from:s,appIndex:t.safeBigIntToNumber(this.coreAppId),appArgs:[c.publishMessage,n,t.bignum.toBytes(0n,8)],accounts:a,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:i});yield this.createUnsignedTx({tx:l},"Core.publishMessage",!0)}async getMessageFee(){var s;const e=await this.connection.getApplicationByID(t.safeBigIntToNumber(this.coreAppId)).do(),r=(s=t.Application.from_obj_for_encoding(e).params.globalState)==null?void 0:s.find(i=>i.key===c.feeKey);return r?BigInt(r.value.uint):0n}async getGuardianSetIndex(){throw new Error("Not implemented")}async parseTransaction(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r).map(s=>({chain:s.emitterChain,emitter:s.emitterAddress,sequence:s.sequence}))}async parseMessages(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r)}parseTx(e){const n=[];if(e.innerTxns&&e.innerTxns.length>0&&n.push(...e.innerTxns.flatMap(g=>this.parseTx(g))),BigInt(e.txn.txn.apid??0)!==this.coreAppId||!e.logs||e.logs.length===0)return n;const r=e.txn.txn.apaa??[];if(r.length!==3||!t.bytes.equals(new Uint8Array(r[0]),c.publishMessage))return n;const s=t.bignum.decode(e.logs[0]),i=new t.AlgorandAddress(e.txn.txn.snd).toUniversalAddress(),d=new Uint8Array(r[1]),a=t.bignum.decode(r[2]);return n.push(t.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:i,sequence:s,guardianSet:0,timestamp:0,consistencyLevel:0,nonce:Number(a),payload:d,signatures:[]})),n}static async maybeCreateStorageTx(e,n,r,s,i){const d=t.getApplicationAddress(r),a=s.address(),g=[];if(await u.storageAccountExists(e,a,r))return{accounts:[a],txs:g};i=i??await e.getTransactionParams().do();const l=t.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:a,amount:K,suggestedParams:i});l.fee=l.fee*2,g.push({tx:l});const f=t.makeApplicationOptInTxnFromObject({from:a,appIndex:t.safeBigIntToNumber(r),rekeyTo:d,suggestedParams:i});return f.fee=0,g.push({tx:f,signer:{address:s.address(),signTxn:y=>Promise.resolve(t.signLogicSigTransaction(y,s).blob)}}),{accounts:[a],txs:g}}static async submitVAAHeader(e,n,r,s,i,d){d=d??await e.getTransactionParams().do();let a=[];const g=u.forMessageId(r,{chain:s.emitterChain,sequence:s.sequence,emitter:s.emitterAddress}),{accounts:l,txs:f}=await c.maybeCreateStorageTx(e,i,r,g,d);a.push(...f);const y=u.forGuardianSet(n,s.guardianSet),{accounts:[b],txs:T}=await c.maybeCreateStorageTx(e,i,n,y,d);a.push(...T);let x=[...l,b];const B=await u.decodeLocalState(e,n,b),h=t.keccak_256(s.hash),_=s.signatures.length,w=Math.ceil(_/c.MAX_SIGS_PER_TXN),k=20,C=new t.LogicSigAccount(c.ALGO_VERIFY);for(let M=0;M<w;M++){const v=M*c.MAX_SIGS_PER_TXN,S=s.signatures.slice(v,v+c.MAX_SIGS_PER_TXN),F=S.length*k,G=new Uint8Array(F);for(let A=0;A<S.length;A++){const P=S[A],Y=B.slice(P.guardianIndex*k+1,(P.guardianIndex+1)*k+1);G.set(Y,A*20)}const X=t.makeApplicationCallTxnFromObject({appArgs:[c.verifySigs,t.bytes.concat(...S.map(A=>t.bytes.concat(new Uint8Array([A.guardianIndex]),A.signature.encode()))),G,h],accounts:x,appIndex:t.safeBigIntToNumber(n),from:c.ALGO_VERIFY_HASH,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});X.fee=0,a.push({tx:X,signer:{address:C.address(),signTxn:A=>Promise.resolve(t.signLogicSigTransaction(A,C).blob)}})}const E=t.makeApplicationCallTxnFromObject({appArgs:[c.verifyVaa,t.serialize(s)],accounts:x,appIndex:t.safeBigIntToNumber(n),from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});return E.fee=E.fee*(2+w),a.push({tx:E}),{accounts:x,txs:a}}createUnsignedTx(e,n,r=!0){return new j(e,this.network,this.chain,n,r)}};p(c,"MAX_SIGS_PER_TXN",6),p(c,"ALGO_VERIFY_HASH","EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A"),p(c,"ALGO_VERIFY",new Uint8Array([6,32,4,1,0,32,20,38,1,0,49,32,50,3,18,68,49,1,35,18,68,49,16,129,6,18,68,54,26,1,54,26,3,54,26,2,136,0,3,68,34,67,53,2,53,1,53,0,40,53,240,40,53,241,52,0,21,53,5,35,53,3,35,53,4,52,3,52,5,12,65,0,68,52,1,52,0,52,3,129,65,8,34,88,23,52,0,52,3,34,8,36,88,52,0,52,3,129,33,8,36,88,7,0,53,241,53,240,52,2,52,4,37,88,52,240,52,241,80,2,87,12,20,18,68,52,3,129,66,8,53,3,52,4,37,8,53,4,66,255,180,34,137])),p(c,"feeKey",t.b64.encode("MessageFee")),p(c,"verifyVaa",t.bytes.encode("verifyVAA")),p(c,"verifySigs",t.bytes.encode("verifySigs")),p(c,"publishMessage",t.bytes.encode("publishMessage"));let I=c;t.registerProtocol("Algorand","WormholeCore",I);const z=Object.freeze(Object.defineProperty({__proto__:null,AlgorandWormholeCore:I,BITS_PER_BYTE:L,BITS_PER_KEY:R,MAX_BITS:N,MAX_BYTES:V,MAX_BYTES_PER_KEY:U,MAX_KEYS:O,SEED_AMT:K,StorageLogicSig:u,varint:m},Symbol.toStringTag,{value:"Module"}));exports.AlgorandUnsignedTransaction=j;exports.AlgorandWormholeCore=I;exports.StorageLogicSig=u;exports.index=z;
1
+ "use strict";var D=Object.defineProperty;var q=(o,e,n)=>e in o?D(o,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):o[e]=n;var p=(o,e,n)=>q(o,typeof e!="symbol"?e+"":e,n);const t=require("./index-B-m4JhhB.js"),H=require("./algorand-Bfhml9ow.js");class j{constructor(e,n,r,s,i=!1){p(this,"transaction");p(this,"network");p(this,"chain");p(this,"description");p(this,"parallelizable");this.transaction=e,this.network=n,this.chain=r,this.description=s,this.parallelizable=i}}const K=1002e3,O=15,U=127,L=8,R=U*L,V=U*O,N=L*V,m={_limit:127,encodingLength:o=>{let e=0;for(;o>=128;e++)o>>=7;return e+1},encode:(o,e,n)=>{if(typeof o=="bigint"&&(o=t.safeBigIntToNumber(o)),o<0)throw new RangeError("value must be unsigned");const r=m.encodingLength(o);if(e=e||new ArrayBuffer(r),n=n||0,e.byteLength<n+r)throw new RangeError("the buffer is too small to encode the number at the offset");const s=new Uint8Array(e,n);let i=0;for(;m._limit<o;)s[i++]=o&m._limit|128,o>>=7;return s[i]=Number(o),s},decode:(o,e=0)=>{let n=0,r=0,s;do{if(s=o[e+r],s===void 0)throw new RangeError("offset out of range");n+=(s&m._limit)<<r*7,r++}while(128<=s);return n}},u={forMessageId:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey,r=e.emitter.toUniversalAddress().toUint8Array(),s=t.bignum.toBytes(BigInt(t.toChainId(e.chain)),2),i=t.bytes.concat(s,r);return u.fromData({appId:o,appAddress:n,idx:e.sequence/BigInt(N),address:i})},forWrappedAsset:(o,e)=>{if(t.isNative(e.address))throw new Error("native asset cannot be a wrapped asset");const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(t.toChainId(e.chain)),address:e.address.toUniversalAddress().toUint8Array()})},forNativeAsset:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:e,address:t.bytes.encode("native")})},forGuardianSet:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:BigInt(e),address:t.bytes.encode("guardian")})},forEmitter:(o,e)=>{const n=t.decodeAddress(t.getApplicationAddress(o)).publicKey;return u.fromData({appId:o,appAddress:n,idx:0n,address:e})},_encode:o=>typeof o=="bigint"?[t.hex.encode(m.encode(o))]:[t.hex.encode(m.encode(o.length)),t.hex.encode(o)],fromData:o=>{const e=["0620010181",...u._encode(o.idx),"4880",...u._encode(o.address),"483110810612443119221244311881",...u._encode(o.appId),"1244312080",...u._encode(o.appAddress),"124431018100124431093203124431153203124422"],n=t.hex.decode(e.join(""));return new t.LogicSigAccount(n)},decodeLocalState:async(o,e,n)=>{let r;try{const a=await o.accountApplicationInformation(n,t.safeBigIntToNumber(e)).do();r=t.AccountApplicationResponse.from_obj_for_encoding(a).appLocalState}catch{return new Uint8Array}const s=t.b64.encode("meta");let i=new Map;for(const a of r.keyValue){if(a.key===s)continue;const g=t.b64.decode(a.key)[0],l=t.b64.decode(a.value.bytes);i.set(g,l)}const d=[];for(let a=0;a<O;a++)i.has(a)&&d.push(i.get(a));return t.bytes.concat(...d)},checkBitsSet:async(o,e,n,r)=>{let s=!1,i;const d=await o.accountInformation(n).do(),g=t.Account.from_obj_for_encoding(d).appsLocalState;if(g&&g.forEach(h=>{BigInt(h.id)===e&&(i=h.keyValue)}),(i==null?void 0:i.length)===0)return s;const l=BigInt(N),f=BigInt(8),y=r/l*l,b=t.safeBigIntToNumber(r-y),T=Math.floor(b/R),x=Math.floor((b-T*R)/8),B=t.b64.encode(t.bignum.toBytes(T,1));return i==null||i.forEach(h=>{if(h.key===B){const _=t.dist.Buffer.from(h.value.bytes,"base64"),w=1<<t.safeBigIntToNumber(r%f);s=(_[x]&w)!=0;return}}),s},storageAccountExists:async(o,e,n)=>{try{const r=await o.accountApplicationInformation(e,t.safeBigIntToNumber(n)).do();return Object.keys(r).length>0}catch{}return!1}},c=class c{constructor(e,n,r,s){p(this,"network");p(this,"chain");p(this,"connection");p(this,"contracts");p(this,"chainId");p(this,"coreAppId");p(this,"coreAppAddress");p(this,"tokenBridgeAppId");p(this,"tokenBridgeAppAddress");if(this.network=e,this.chain=n,this.connection=r,this.contracts=s,this.chainId=t.toChainId(n),!s.coreBridge)throw new Error(`Core contract address for chain ${n} not found`);const i=BigInt(s.coreBridge);if(this.coreAppId=i,this.coreAppAddress=t.getApplicationAddress(i),!s.tokenBridge)throw new Error(`TokenBridge contract address for chain ${n} not found`);const d=BigInt(s.tokenBridge);this.tokenBridgeAppId=d,this.tokenBridgeAppAddress=t.getApplicationAddress(d)}getGuardianSet(e){throw new Error("Method not implemented.")}async*verifyMessage(e,n,r){const s=new t.AlgorandAddress(e).toString(),i=await c.submitVAAHeader(this.connection,this.coreAppId,r??this.coreAppId,n,s);for(const d of i.txs)yield this.createUnsignedTx(d,"Core.verifyMessage")}static async fromRpc(e,n){const[r,s]=await H.AlgorandPlatform.chainFromRpc(e),i=n[s];if(i.network!==r)throw new Error(`Network mismatch: ${i.network} !== ${r}`);return new c(r,s,e,i.contracts)}async*publishMessage(e,n){const r=new t.AlgorandAddress(e),s=r.toString(),i=await this.connection.getTransactionParams().do(),d=u.forEmitter(this.coreAppId,r.toUint8Array()),{accounts:a,txs:g}=await c.maybeCreateStorageTx(this.connection,s,this.coreAppId,d,i);for(const f of g)yield this.createUnsignedTx(f,"Core.publishMessage",!0);const l=t.makeApplicationCallTxnFromObject({from:s,appIndex:t.safeBigIntToNumber(this.coreAppId),appArgs:[c.publishMessage,n,t.bignum.toBytes(0n,8)],accounts:a,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:i});yield this.createUnsignedTx({tx:l},"Core.publishMessage",!0)}async getMessageFee(){var s;const e=await this.connection.getApplicationByID(t.safeBigIntToNumber(this.coreAppId)).do(),r=(s=t.Application.from_obj_for_encoding(e).params.globalState)==null?void 0:s.find(i=>i.key===c.feeKey);return r?BigInt(r.value.uint):0n}async getGuardianSetIndex(){throw new Error("Not implemented")}async parseTransaction(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r).map(s=>({chain:s.emitterChain,emitter:s.emitterAddress,sequence:s.sequence}))}async parseMessages(e){const n=await this.connection.pendingTransactionInformation(e).do(),r=t.PendingTransactionResponse.from_obj_for_encoding(n);return this.parseTx(r)}parseTx(e){const n=[];if(e.innerTxns&&e.innerTxns.length>0&&n.push(...e.innerTxns.flatMap(g=>this.parseTx(g))),BigInt(e.txn.txn.apid??0)!==this.coreAppId||!e.logs||e.logs.length===0)return n;const r=e.txn.txn.apaa??[];if(r.length!==3||!t.bytes.equals(new Uint8Array(r[0]),c.publishMessage))return n;const s=t.bignum.decode(e.logs[0]),i=new t.AlgorandAddress(e.txn.txn.snd).toUniversalAddress(),d=new Uint8Array(r[1]),a=t.bignum.decode(r[2]);return n.push(t.createVAA("Uint8Array",{emitterChain:this.chain,emitterAddress:i,sequence:s,guardianSet:0,timestamp:0,consistencyLevel:0,nonce:Number(a),payload:d,signatures:[]})),n}static async maybeCreateStorageTx(e,n,r,s,i){const d=t.getApplicationAddress(r),a=s.address(),g=[];if(await u.storageAccountExists(e,a,r))return{accounts:[a],txs:g};i=i??await e.getTransactionParams().do();const l=t.makePaymentTxnWithSuggestedParamsFromObject({from:n,to:a,amount:K,suggestedParams:i});l.fee=l.fee*2,g.push({tx:l});const f=t.makeApplicationOptInTxnFromObject({from:a,appIndex:t.safeBigIntToNumber(r),rekeyTo:d,suggestedParams:i});return f.fee=0,g.push({tx:f,signer:{address:s.address(),signTxn:y=>Promise.resolve(t.signLogicSigTransaction(y,s).blob)}}),{accounts:[a],txs:g}}static async submitVAAHeader(e,n,r,s,i,d){d=d??await e.getTransactionParams().do();let a=[];const g=u.forMessageId(r,{chain:s.emitterChain,sequence:s.sequence,emitter:s.emitterAddress}),{accounts:l,txs:f}=await c.maybeCreateStorageTx(e,i,r,g,d);a.push(...f);const y=u.forGuardianSet(n,s.guardianSet),{accounts:[b],txs:T}=await c.maybeCreateStorageTx(e,i,n,y,d);a.push(...T);let x=[...l,b];const B=await u.decodeLocalState(e,n,b),h=t.keccak_256(s.hash),_=s.signatures.length,w=Math.ceil(_/c.MAX_SIGS_PER_TXN),k=20,C=new t.LogicSigAccount(c.ALGO_VERIFY);for(let M=0;M<w;M++){const v=M*c.MAX_SIGS_PER_TXN,S=s.signatures.slice(v,v+c.MAX_SIGS_PER_TXN),F=S.length*k,G=new Uint8Array(F);for(let A=0;A<S.length;A++){const P=S[A],Y=B.slice(P.guardianIndex*k+1,(P.guardianIndex+1)*k+1);G.set(Y,A*20)}const X=t.makeApplicationCallTxnFromObject({appArgs:[c.verifySigs,t.bytes.concat(...S.map(A=>t.bytes.concat(new Uint8Array([A.guardianIndex]),A.signature.encode()))),G,h],accounts:x,appIndex:t.safeBigIntToNumber(n),from:c.ALGO_VERIFY_HASH,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});X.fee=0,a.push({tx:X,signer:{address:C.address(),signTxn:A=>Promise.resolve(t.signLogicSigTransaction(A,C).blob)}})}const E=t.makeApplicationCallTxnFromObject({appArgs:[c.verifyVaa,t.serialize(s)],accounts:x,appIndex:t.safeBigIntToNumber(n),from:i,onComplete:t.OnApplicationComplete.NoOpOC,suggestedParams:d});return E.fee=E.fee*(2+w),a.push({tx:E}),{accounts:x,txs:a}}createUnsignedTx(e,n,r=!0){return new j(e,this.network,this.chain,n,r)}};p(c,"MAX_SIGS_PER_TXN",6),p(c,"ALGO_VERIFY_HASH","EZATROXX2HISIRZDRGXW4LRQ46Z6IUJYYIHU3PJGP7P5IQDPKVX42N767A"),p(c,"ALGO_VERIFY",new Uint8Array([6,32,4,1,0,32,20,38,1,0,49,32,50,3,18,68,49,1,35,18,68,49,16,129,6,18,68,54,26,1,54,26,3,54,26,2,136,0,3,68,34,67,53,2,53,1,53,0,40,53,240,40,53,241,52,0,21,53,5,35,53,3,35,53,4,52,3,52,5,12,65,0,68,52,1,52,0,52,3,129,65,8,34,88,23,52,0,52,3,34,8,36,88,52,0,52,3,129,33,8,36,88,7,0,53,241,53,240,52,2,52,4,37,88,52,240,52,241,80,2,87,12,20,18,68,52,3,129,66,8,53,3,52,4,37,8,53,4,66,255,180,34,137])),p(c,"feeKey",t.b64.encode("MessageFee")),p(c,"verifyVaa",t.bytes.encode("verifyVAA")),p(c,"verifySigs",t.bytes.encode("verifySigs")),p(c,"publishMessage",t.bytes.encode("publishMessage"));let I=c;t.registerProtocol("Algorand","WormholeCore",I);const z=Object.freeze(Object.defineProperty({__proto__:null,AlgorandWormholeCore:I,BITS_PER_BYTE:L,BITS_PER_KEY:R,MAX_BITS:N,MAX_BYTES:V,MAX_BYTES_PER_KEY:U,MAX_KEYS:O,SEED_AMT:K,StorageLogicSig:u,varint:m},Symbol.toStringTag,{value:"Module"}));exports.AlgorandUnsignedTransaction=j;exports.AlgorandWormholeCore=I;exports.StorageLogicSig=u;exports.index=z;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("./index-COPDbEYS.js"),xu=require("./dijkstra-CtFxn7S9.js"),kt=require("./events--5HQ-tqg.js"),F=require("./index-BUlkHg7S.js"),T=require("./index-D6tUolUd.js");let Nu=class extends T.r{constructor(e){super(e),this.events=new kt.eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(T.formatJsonRpcRequest(e.method,e.params||[],e.id||T.getBigIntRpcId().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{T.isJsonRpcError(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),T.isJsonRpcResponse(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};var Cu=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},Ru=Cu,Bo={"text/plain":"Text","text/html":"Url",default:"Text"},Tu="Copy to clipboard: #{key}, Enter";function Pu(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function Ou(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=Ru(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(f){if(f.stopPropagation(),e.format)if(f.preventDefault(),typeof f.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=Bo[e.format]||Bo.default;window.clipboardData.setData(m,t)}else f.clipboardData.clearData(),f.clipboardData.setData(e.format,t);e.onCopy&&(f.preventDefault(),e.onCopy(f.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");h=!0}catch(f){r&&console.error("unable to copy using execCommand: ",f),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),i=Pu("message"in e?e.message:Tu),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var ku=Ou,Bu={}.toString,to=Array.isArray||function(t){return Bu.call(t)=="[object Array]"},Du=K.requireElliptic(),ro={},le={};Object.defineProperty(le,"__esModule",{value:!0});var kc=le.getLocalStorage=Vc=le.getLocalStorageOrThrow=Kc=le.getCrypto=jc=le.getCryptoOrThrow=zc=le.getLocation=$c=le.getLocationOrThrow=Uc=le.getNavigator=qc=le.getNavigatorOrThrow=Lc=le.getDocument=Fc=le.getDocumentOrThrow=Dc=le.getFromWindowOrThrow=Bc=le.getFromWindow=void 0;function Vr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var Bc=le.getFromWindow=Vr;function ui(t){const e=Vr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var Dc=le.getFromWindowOrThrow=ui;function Fu(){return ui("document")}var Fc=le.getDocumentOrThrow=Fu;function Lu(){return Vr("document")}var Lc=le.getDocument=Lu;function qu(){return ui("navigator")}var qc=le.getNavigatorOrThrow=qu;function Uu(){return Vr("navigator")}var Uc=le.getNavigator=Uu;function $u(){return ui("location")}var $c=le.getLocationOrThrow=$u;function zu(){return Vr("location")}var zc=le.getLocation=zu;function ju(){return ui("crypto")}var jc=le.getCryptoOrThrow=ju;function Ku(){return Vr("crypto")}var Kc=le.getCrypto=Ku;function Vu(){return ui("localStorage")}var Vc=le.getLocalStorageOrThrow=Vu;function Wu(){return Vr("localStorage")}kc=le.getLocalStorage=Wu;Object.defineProperty(ro,"__esModule",{value:!0});var Wc=ro.getWindowMetadata=void 0;const Do=le;function Hu(){let t,e;try{t=Do.getDocumentOrThrow(),e=Do.getLocationOrThrow()}catch{return null}function r(){const m=t.getElementsByTagName("link"),b=[];for(let v=0;v<m.length;v++){const E=m[v],x=E.getAttribute("rel");if(x&&x.toLowerCase().indexOf("icon")>-1){const S=E.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let N=e.protocol+"//"+e.host;if(S.indexOf("/")===0)N+=S;else{const R=e.pathname.split("/");R.pop();const O=R.join("/");N+=O+"/"+S}b.push(N)}else if(S.indexOf("//")===0){const N=e.protocol+S;b.push(N)}else b.push(S)}}return b}function i(...m){const b=t.getElementsByTagName("meta");for(let v=0;v<b.length;v++){const E=b[v],x=["itemprop","property","name"].map(S=>E.getAttribute(S)).filter(S=>S?m.includes(S):!1);if(x.length&&x){const S=E.getAttribute("content");if(S)return S}}return""}function n(){let m=i("name","og:site_name","og:title","twitter:title");return m||(m=t.title),m}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,u=r();return{description:a,url:h,icons:u,name:o}}Wc=ro.getWindowMetadata=Hu;var Ju=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},Qu=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),Gu=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=K.dist.process.platform}return t}(),Yu=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),Xu=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Zu=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),ed=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,td=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Fo=3,rd=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",ed]],Lo=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function id(t){return t?qo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Zu:typeof navigator<"u"?qo(navigator.userAgent):od()}function nd(t){return t!==""&&rd.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function qo(t){var e=nd(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new Xu;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<Fo&&(n=Ju(n,ad(Fo-n.length))):n=[];var s=n.join("."),o=sd(t),a=td.exec(t);return a&&a[1]?new Yu(r,s,o,a[1]):new Qu(r,s,o)}function sd(t){for(var e=0,r=Lo.length;e<r;e++){var i=Lo[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function od(){var t=typeof K.dist.process<"u"&&K.dist.process.version;return t?new Gu(K.dist.process.version.slice(1)):null}function ad(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function io(t){return id(t)}function Tn(){const t=io();return t&&t.os?t.os:void 0}function Hc(){const t=Tn();return t?t.toLowerCase().includes("android"):!1}function Jc(){const t=Tn();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function cd(){return Tn()?Hc()||Jc():!1}function Qc(){const t=io();return t&&t.name?t.name.toLowerCase()==="node":!1}function hd(){return!Qc()&&!!Gc()}const ld=Bc,ud=Dc,dd=Fc,fd=Lc,pd=qc,Gc=Uc,gd=$c,md=zc,yd=jc,vd=Kc,wd=Vc,Pn=kc;function _d(){return Wc()}function bd(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ad(t){return typeof t=="string"?t:JSON.stringify(t)}const Yc=bd,Xc=Ad;function Zc(t,e){const r=Xc(e),i=Pn();i&&i.setItem(t,r)}function Ed(t){let e=null,r=null;const i=Pn();return i&&(r=i.getItem(t)),e=r&&Yc(r),e}function Sd(t){const e=Pn();e&&e.removeItem(t)}const eh="WALLETCONNECT_DEEPLINK_CHOICE";function Id(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function Md(t){const e=t.href.split("?")[0];Zc(eh,Object.assign(Object.assign({},t),{href:e}))}function th(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function xd(t,e){let r=t;return e&&(r=e.map(i=>th(t,i)).filter(Boolean)),r}const rh="https://registry.walletconnect.com";function Nd(){return rh+"/api/v2/wallets"}function Cd(){return rh+"/api/v2/dapps"}function ih(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function Rd(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>ih(r,e))}const Td=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:io,detectOS:Tn,formatIOSMobile:Id,formatMobileRegistry:Rd,formatMobileRegistryEntry:ih,getClientMeta:_d,getCrypto:vd,getCryptoOrThrow:yd,getDappRegistryUrl:Cd,getDocument:fd,getDocumentOrThrow:dd,getFromWindow:ld,getFromWindowOrThrow:ud,getLocal:Ed,getLocalStorage:Pn,getLocalStorageOrThrow:wd,getLocation:md,getLocationOrThrow:gd,getMobileLinkRegistry:xd,getMobileRegistryEntry:th,getNavigator:Gc,getNavigatorOrThrow:pd,getWalletRegistryUrl:Nd,isAndroid:Hc,isBrowser:hd,isIOS:Jc,isMobile:cd,isNode:Qc,mobileLinkChoiceKey:eh,removeLocal:Sd,safeJsonParse:Yc,safeJsonStringify:Xc,saveMobileLinkInfo:Md,setLocal:Zc},Symbol.toStringTag,{value:"Module"})),Pd=K.getAugmentedNamespace(Td);var Wi={},Od=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},nh={},_r={},kd=to;function Bd(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}ne.TYPED_ARRAY_SUPPORT=Bd();var Uo=ne.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function ne(t,e,r){return!ne.TYPED_ARRAY_SUPPORT&&!(this instanceof ne)?new ne(t,e,r):typeof t=="number"?sh(this,t):zd(this,t,e,r)}ne.TYPED_ARRAY_SUPPORT&&(ne.prototype.__proto__=Uint8Array.prototype,ne.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ne[Symbol.species]===ne&&Object.defineProperty(ne,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function no(t){if(t>=Uo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Uo.toString(16)+" bytes");return t|0}function Dd(t){return t!==t}function ii(t,e){var r;return ne.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=ne.prototype):(r=t,r===null&&(r=new ne(e)),r.length=e),r}function sh(t,e){var r=ii(t,e<0?0:no(e)|0);if(!ne.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function Fd(t,e){var r=ah(e)|0,i=ii(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function ks(t,e){for(var r=e.length<0?0:no(e.length)|0,i=ii(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Ld(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),ne.TYPED_ARRAY_SUPPORT?n.__proto__=ne.prototype:n=ks(t,n),n}function qd(t,e){if(ne.isBuffer(e)){var r=no(e.length)|0,i=ii(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Dd(e.length)?ii(t,0):ks(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return ks(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function oh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ah(t){if(ne.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:oh(t).length}function Ud(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function $d(t,e,r,i){return Ud(oh(e,t.length-r),t,r,i)}function zd(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Ld(t,e,r,i):typeof e=="string"?Fd(t,e):qd(t,e)}ne.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return $d(this,e,r,i)};ne.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(ne.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=ne.prototype;else{var s=r-e;n=new ne(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};ne.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!ne.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};ne.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=ne.isBuffer(e)?e:new ne(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};ne.concat=function(e,r){if(!kd(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ii(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=sh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!ne.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};ne.byteLength=ah;ne.prototype._isBuffer=!0;ne.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};_r.alloc=function(t){var e=new ne(t);return e.fill(0),e};_r.from=function(t){return new ne(t)};var wt={},so,jd=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];wt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};wt.getSymbolTotalCodewords=function(e){return jd[e]};wt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};wt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');so=e};wt.isKanjiModeEnabled=function(){return typeof so<"u"};wt.toSJIS=function(e){return so(e)};var On={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(On);function ch(){this.buffer=[],this.length=0}ch.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Kd=ch,$o=_r;function Hi(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=$o.alloc(t*t),this.reservedBit=$o.alloc(t*t)}Hi.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};Hi.prototype.get=function(t,e){return this.data[t*this.size+e]};Hi.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hi.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Vd=Hi,hh={};(function(t){var e=wt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(hh);var lh={},Wd=wt.getSymbolSize,zo=7;lh.getPositions=function(e){var r=Wd(e);return[[0,0],[r-zo,0],[0,r-zo]]};var uh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,u=null,f=null,m=0;m<s;m++){a=h=0,u=f=null;for(var b=0;b<s;b++){var v=n.get(m,b);v===u?a++:(a>=5&&(o+=e.N1+(a-5)),u=v,a=1),v=n.get(b,m),v===f?h++:(h>=5&&(o+=e.N1+(h-5)),f=v,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var u=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,u=0;u<s;u++){a=h=0;for(var f=0;f<s;f++)a=a<<1&2047|n.get(u,f),f>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(f,u),f>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,u=0;u<o;u++){s(u),t.applyMask(u,n);var f=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),f<h&&(h=f,a=u)}return a}})(uh);var kn={},yr=On,rn=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],nn=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];kn.getBlocksCount=function(e,r){switch(r){case yr.L:return rn[(e-1)*4+0];case yr.M:return rn[(e-1)*4+1];case yr.Q:return rn[(e-1)*4+2];case yr.H:return rn[(e-1)*4+3];default:return}};kn.getTotalCodewordsCount=function(e,r){switch(r){case yr.L:return nn[(e-1)*4+0];case yr.M:return nn[(e-1)*4+1];case yr.Q:return nn[(e-1)*4+2];case yr.H:return nn[(e-1)*4+3];default:return}};var dh={},Bn={},fh=_r,Oi=fh.alloc(512),vn=fh.alloc(256);(function(){for(var e=1,r=0;r<255;r++)Oi[r]=e,vn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)Oi[r]=Oi[r-255]})();Bn.log=function(e){if(e<1)throw new Error("log("+e+")");return vn[e]};Bn.exp=function(e){return Oi[e]};Bn.mul=function(e,r){return e===0||r===0?0:Oi[vn[e]+vn[r]]};(function(t){var e=_r,r=Bn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var u=0;u<o.length&&o[u]===0;)u++;o=o.slice(u)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(dh);var jo=_r,ph=dh,Hd=K.bufferPolyfill.Buffer;function oo(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}oo.prototype.initialize=function(e){this.degree=e,this.genPoly=ph.generateECPolynomial(this.degree)};oo.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=jo.alloc(this.degree),i=Hd.concat([e,r],e.length+this.degree),n=ph.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=jo.alloc(this.degree);return n.copy(o,s),o}return n};var Jd=oo,gh={},br={},ao={};ao.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Ht={},mh="[0-9]+",Qd="[A-Z $%*+\\-./:]+",Ui="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ui=Ui.replace(/u/g,"\\u");var Gd="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ui+`)(?:.|[\r
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const K=require("./index-B-m4JhhB.js"),xu=require("./dijkstra-CtFxn7S9.js"),kt=require("./events-wwBkyeeC.js"),F=require("./index-Du-JoS7B.js"),T=require("./index-CTVkfVib.js");let Nu=class extends T.r{constructor(e){super(e),this.events=new kt.eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,r){this.events.on(e,r)}once(e,r){this.events.once(e,r)}off(e,r){this.events.off(e,r)}removeListener(e,r){this.events.removeListener(e,r)}async request(e,r){return this.requestStrict(T.formatJsonRpcRequest(e.method,e.params||[],e.id||T.getBigIntRpcId().toString()),r)}async requestStrict(e,r){return new Promise(async(i,n)=>{if(!this.connection.connected)try{await this.open()}catch(s){n(s)}this.events.on(`${e.id}`,s=>{T.isJsonRpcError(s)?n(s.error):i(s.result)});try{await this.connection.send(e,r)}catch(s){n(s)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),T.isJsonRpcResponse(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};var Cu=function(){var t=document.getSelection();if(!t.rangeCount)return function(){};for(var e=document.activeElement,r=[],i=0;i<t.rangeCount;i++)r.push(t.getRangeAt(i));switch(e.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":e.blur();break;default:e=null;break}return t.removeAllRanges(),function(){t.type==="Caret"&&t.removeAllRanges(),t.rangeCount||r.forEach(function(n){t.addRange(n)}),e&&e.focus()}},Ru=Cu,Bo={"text/plain":"Text","text/html":"Url",default:"Text"},Tu="Copy to clipboard: #{key}, Enter";function Pu(t){var e=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return t.replace(/#{\s*key\s*}/g,e)}function Ou(t,e){var r,i,n,s,o,a,h=!1;e||(e={}),r=e.debug||!1;try{n=Ru(),s=document.createRange(),o=document.getSelection(),a=document.createElement("span"),a.textContent=t,a.ariaHidden="true",a.style.all="unset",a.style.position="fixed",a.style.top=0,a.style.clip="rect(0, 0, 0, 0)",a.style.whiteSpace="pre",a.style.webkitUserSelect="text",a.style.MozUserSelect="text",a.style.msUserSelect="text",a.style.userSelect="text",a.addEventListener("copy",function(f){if(f.stopPropagation(),e.format)if(f.preventDefault(),typeof f.clipboardData>"u"){r&&console.warn("unable to use e.clipboardData"),r&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var m=Bo[e.format]||Bo.default;window.clipboardData.setData(m,t)}else f.clipboardData.clearData(),f.clipboardData.setData(e.format,t);e.onCopy&&(f.preventDefault(),e.onCopy(f.clipboardData))}),document.body.appendChild(a),s.selectNodeContents(a),o.addRange(s);var u=document.execCommand("copy");if(!u)throw new Error("copy command was unsuccessful");h=!0}catch(f){r&&console.error("unable to copy using execCommand: ",f),r&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(e.format||"text",t),e.onCopy&&e.onCopy(window.clipboardData),h=!0}catch(m){r&&console.error("unable to copy using clipboardData: ",m),r&&console.error("falling back to prompt"),i=Pu("message"in e?e.message:Tu),window.prompt(i,t)}}finally{o&&(typeof o.removeRange=="function"?o.removeRange(s):o.removeAllRanges()),a&&document.body.removeChild(a),n()}return h}var ku=Ou,Bu={}.toString,to=Array.isArray||function(t){return Bu.call(t)=="[object Array]"},Du=K.requireElliptic(),ro={},le={};Object.defineProperty(le,"__esModule",{value:!0});var kc=le.getLocalStorage=Vc=le.getLocalStorageOrThrow=Kc=le.getCrypto=jc=le.getCryptoOrThrow=zc=le.getLocation=$c=le.getLocationOrThrow=Uc=le.getNavigator=qc=le.getNavigatorOrThrow=Lc=le.getDocument=Fc=le.getDocumentOrThrow=Dc=le.getFromWindowOrThrow=Bc=le.getFromWindow=void 0;function Vr(t){let e;return typeof window<"u"&&typeof window[t]<"u"&&(e=window[t]),e}var Bc=le.getFromWindow=Vr;function ui(t){const e=Vr(t);if(!e)throw new Error(`${t} is not defined in Window`);return e}var Dc=le.getFromWindowOrThrow=ui;function Fu(){return ui("document")}var Fc=le.getDocumentOrThrow=Fu;function Lu(){return Vr("document")}var Lc=le.getDocument=Lu;function qu(){return ui("navigator")}var qc=le.getNavigatorOrThrow=qu;function Uu(){return Vr("navigator")}var Uc=le.getNavigator=Uu;function $u(){return ui("location")}var $c=le.getLocationOrThrow=$u;function zu(){return Vr("location")}var zc=le.getLocation=zu;function ju(){return ui("crypto")}var jc=le.getCryptoOrThrow=ju;function Ku(){return Vr("crypto")}var Kc=le.getCrypto=Ku;function Vu(){return ui("localStorage")}var Vc=le.getLocalStorageOrThrow=Vu;function Wu(){return Vr("localStorage")}kc=le.getLocalStorage=Wu;Object.defineProperty(ro,"__esModule",{value:!0});var Wc=ro.getWindowMetadata=void 0;const Do=le;function Hu(){let t,e;try{t=Do.getDocumentOrThrow(),e=Do.getLocationOrThrow()}catch{return null}function r(){const m=t.getElementsByTagName("link"),b=[];for(let v=0;v<m.length;v++){const E=m[v],x=E.getAttribute("rel");if(x&&x.toLowerCase().indexOf("icon")>-1){const S=E.getAttribute("href");if(S)if(S.toLowerCase().indexOf("https:")===-1&&S.toLowerCase().indexOf("http:")===-1&&S.indexOf("//")!==0){let N=e.protocol+"//"+e.host;if(S.indexOf("/")===0)N+=S;else{const R=e.pathname.split("/");R.pop();const O=R.join("/");N+=O+"/"+S}b.push(N)}else if(S.indexOf("//")===0){const N=e.protocol+S;b.push(N)}else b.push(S)}}return b}function i(...m){const b=t.getElementsByTagName("meta");for(let v=0;v<b.length;v++){const E=b[v],x=["itemprop","property","name"].map(S=>E.getAttribute(S)).filter(S=>S?m.includes(S):!1);if(x.length&&x){const S=E.getAttribute("content");if(S)return S}}return""}function n(){let m=i("name","og:site_name","og:title","twitter:title");return m||(m=t.title),m}function s(){return i("description","og:description","twitter:description","keywords")}const o=n(),a=s(),h=e.origin,u=r();return{description:a,url:h,icons:u,name:o}}Wc=ro.getWindowMetadata=Hu;var Ju=function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;for(var i=Array(t),n=0,e=0;e<r;e++)for(var s=arguments[e],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i},Qu=function(){function t(e,r,i){this.name=e,this.version=r,this.os=i,this.type="browser"}return t}(),Gu=function(){function t(e){this.version=e,this.type="node",this.name="node",this.os=K.dist.process.platform}return t}(),Yu=function(){function t(e,r,i,n){this.name=e,this.version=r,this.os=i,this.bot=n,this.type="bot-device"}return t}(),Xu=function(){function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return t}(),Zu=function(){function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return t}(),ed=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,td=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Fo=3,rd=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",ed]],Lo=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function id(t){return t?qo(t):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Zu:typeof navigator<"u"?qo(navigator.userAgent):od()}function nd(t){return t!==""&&rd.reduce(function(e,r){var i=r[0],n=r[1];if(e)return e;var s=n.exec(t);return!!s&&[i,s]},!1)}function qo(t){var e=nd(t);if(!e)return null;var r=e[0],i=e[1];if(r==="searchbot")return new Xu;var n=i[1]&&i[1].split(/[._]/).slice(0,3);n?n.length<Fo&&(n=Ju(n,ad(Fo-n.length))):n=[];var s=n.join("."),o=sd(t),a=td.exec(t);return a&&a[1]?new Yu(r,s,o,a[1]):new Qu(r,s,o)}function sd(t){for(var e=0,r=Lo.length;e<r;e++){var i=Lo[e],n=i[0],s=i[1],o=s.exec(t);if(o)return n}return null}function od(){var t=typeof K.dist.process<"u"&&K.dist.process.version;return t?new Gu(K.dist.process.version.slice(1)):null}function ad(t){for(var e=[],r=0;r<t;r++)e.push("0");return e}function io(t){return id(t)}function Tn(){const t=io();return t&&t.os?t.os:void 0}function Hc(){const t=Tn();return t?t.toLowerCase().includes("android"):!1}function Jc(){const t=Tn();return t?t.toLowerCase().includes("ios")||t.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function cd(){return Tn()?Hc()||Jc():!1}function Qc(){const t=io();return t&&t.name?t.name.toLowerCase()==="node":!1}function hd(){return!Qc()&&!!Gc()}const ld=Bc,ud=Dc,dd=Fc,fd=Lc,pd=qc,Gc=Uc,gd=$c,md=zc,yd=jc,vd=Kc,wd=Vc,Pn=kc;function _d(){return Wc()}function bd(t){if(typeof t!="string")throw new Error(`Cannot safe json parse value of type ${typeof t}`);try{return JSON.parse(t)}catch{return t}}function Ad(t){return typeof t=="string"?t:JSON.stringify(t)}const Yc=bd,Xc=Ad;function Zc(t,e){const r=Xc(e),i=Pn();i&&i.setItem(t,r)}function Ed(t){let e=null,r=null;const i=Pn();return i&&(r=i.getItem(t)),e=r&&Yc(r),e}function Sd(t){const e=Pn();e&&e.removeItem(t)}const eh="WALLETCONNECT_DEEPLINK_CHOICE";function Id(t,e){const r=encodeURIComponent(t);return e.universalLink?`${e.universalLink}/wc?uri=${r}`:e.deepLink?`${e.deepLink}${e.deepLink.endsWith(":")?"//":"/"}wc?uri=${r}`:""}function Md(t){const e=t.href.split("?")[0];Zc(eh,Object.assign(Object.assign({},t),{href:e}))}function th(t,e){return t.filter(r=>r.name.toLowerCase().includes(e.toLowerCase()))[0]}function xd(t,e){let r=t;return e&&(r=e.map(i=>th(t,i)).filter(Boolean)),r}const rh="https://registry.walletconnect.com";function Nd(){return rh+"/api/v2/wallets"}function Cd(){return rh+"/api/v2/dapps"}function ih(t,e="mobile"){var r;return{name:t.name||"",shortName:t.metadata.shortName||"",color:t.metadata.colors.primary||"",logo:(r=t.image_url.sm)!==null&&r!==void 0?r:"",universalLink:t[e].universal||"",deepLink:t[e].native||""}}function Rd(t,e="mobile"){return Object.values(t).filter(r=>!!r[e].universal||!!r[e].native).map(r=>ih(r,e))}const Td=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:io,detectOS:Tn,formatIOSMobile:Id,formatMobileRegistry:Rd,formatMobileRegistryEntry:ih,getClientMeta:_d,getCrypto:vd,getCryptoOrThrow:yd,getDappRegistryUrl:Cd,getDocument:fd,getDocumentOrThrow:dd,getFromWindow:ld,getFromWindowOrThrow:ud,getLocal:Ed,getLocalStorage:Pn,getLocalStorageOrThrow:wd,getLocation:md,getLocationOrThrow:gd,getMobileLinkRegistry:xd,getMobileRegistryEntry:th,getNavigator:Gc,getNavigatorOrThrow:pd,getWalletRegistryUrl:Nd,isAndroid:Hc,isBrowser:hd,isIOS:Jc,isMobile:cd,isNode:Qc,mobileLinkChoiceKey:eh,removeLocal:Sd,safeJsonParse:Yc,safeJsonStringify:Xc,saveMobileLinkInfo:Md,setLocal:Zc},Symbol.toStringTag,{value:"Module"})),Pd=K.getAugmentedNamespace(Td);var Wi={},Od=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},nh={},_r={},kd=to;function Bd(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},t.foo()===42}catch{return!1}}ne.TYPED_ARRAY_SUPPORT=Bd();var Uo=ne.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function ne(t,e,r){return!ne.TYPED_ARRAY_SUPPORT&&!(this instanceof ne)?new ne(t,e,r):typeof t=="number"?sh(this,t):zd(this,t,e,r)}ne.TYPED_ARRAY_SUPPORT&&(ne.prototype.__proto__=Uint8Array.prototype,ne.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&ne[Symbol.species]===ne&&Object.defineProperty(ne,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function no(t){if(t>=Uo)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Uo.toString(16)+" bytes");return t|0}function Dd(t){return t!==t}function ii(t,e){var r;return ne.TYPED_ARRAY_SUPPORT?(r=new Uint8Array(e),r.__proto__=ne.prototype):(r=t,r===null&&(r=new ne(e)),r.length=e),r}function sh(t,e){var r=ii(t,e<0?0:no(e)|0);if(!ne.TYPED_ARRAY_SUPPORT)for(var i=0;i<e;++i)r[i]=0;return r}function Fd(t,e){var r=ah(e)|0,i=ii(t,r),n=i.write(e);return n!==r&&(i=i.slice(0,n)),i}function ks(t,e){for(var r=e.length<0?0:no(e.length)|0,i=ii(t,r),n=0;n<r;n+=1)i[n]=e[n]&255;return i}function Ld(t,e,r,i){if(r<0||e.byteLength<r)throw new RangeError("'offset' is out of bounds");if(e.byteLength<r+(i||0))throw new RangeError("'length' is out of bounds");var n;return r===void 0&&i===void 0?n=new Uint8Array(e):i===void 0?n=new Uint8Array(e,r):n=new Uint8Array(e,r,i),ne.TYPED_ARRAY_SUPPORT?n.__proto__=ne.prototype:n=ks(t,n),n}function qd(t,e){if(ne.isBuffer(e)){var r=no(e.length)|0,i=ii(t,r);return i.length===0||e.copy(i,0,0,r),i}if(e){if(typeof ArrayBuffer<"u"&&e.buffer instanceof ArrayBuffer||"length"in e)return typeof e.length!="number"||Dd(e.length)?ii(t,0):ks(t,e);if(e.type==="Buffer"&&Array.isArray(e.data))return ks(t,e.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function oh(t,e){e=e||1/0;for(var r,i=t.length,n=null,s=[],o=0;o<i;++o){if(r=t.charCodeAt(o),r>55295&&r<57344){if(!n){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}else if(o+1===i){(e-=3)>-1&&s.push(239,191,189);continue}n=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),n=r;continue}r=(n-55296<<10|r-56320)+65536}else n&&(e-=3)>-1&&s.push(239,191,189);if(n=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,r&63|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<1114112){if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else throw new Error("Invalid code point")}return s}function ah(t){if(ne.isBuffer(t))return t.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;typeof t!="string"&&(t=""+t);var e=t.length;return e===0?0:oh(t).length}function Ud(t,e,r,i){for(var n=0;n<i&&!(n+r>=e.length||n>=t.length);++n)e[n+r]=t[n];return n}function $d(t,e,r,i){return Ud(oh(e,t.length-r),t,r,i)}function zd(t,e,r,i){if(typeof e=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&e instanceof ArrayBuffer?Ld(t,e,r,i):typeof e=="string"?Fd(t,e):qd(t,e)}ne.prototype.write=function(e,r,i){r===void 0?(i=this.length,r=0):i===void 0&&typeof r=="string"?(i=this.length,r=0):isFinite(r)&&(r=r|0,isFinite(i)?i=i|0:i=void 0);var n=this.length-r;if((i===void 0||i>n)&&(i=n),e.length>0&&(i<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");return $d(this,e,r,i)};ne.prototype.slice=function(e,r){var i=this.length;e=~~e,r=r===void 0?i:~~r,e<0?(e+=i,e<0&&(e=0)):e>i&&(e=i),r<0?(r+=i,r<0&&(r=0)):r>i&&(r=i),r<e&&(r=e);var n;if(ne.TYPED_ARRAY_SUPPORT)n=this.subarray(e,r),n.__proto__=ne.prototype;else{var s=r-e;n=new ne(s,void 0);for(var o=0;o<s;++o)n[o]=this[o+e]}return n};ne.prototype.copy=function(e,r,i,n){if(i||(i=0),!n&&n!==0&&(n=this.length),r>=e.length&&(r=e.length),r||(r=0),n>0&&n<i&&(n=i),n===i||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(i<0||i>=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-r<n-i&&(n=e.length-r+i);var s=n-i,o;if(this===e&&i<r&&r<n)for(o=s-1;o>=0;--o)e[o+r]=this[o+i];else if(s<1e3||!ne.TYPED_ARRAY_SUPPORT)for(o=0;o<s;++o)e[o+r]=this[o+i];else Uint8Array.prototype.set.call(e,this.subarray(i,i+s),r);return s};ne.prototype.fill=function(e,r,i){if(typeof e=="string"){if(typeof r=="string"?(r=0,i=this.length):typeof i=="string"&&(i=this.length),e.length===1){var n=e.charCodeAt(0);n<256&&(e=n)}}else typeof e=="number"&&(e=e&255);if(r<0||this.length<r||this.length<i)throw new RangeError("Out of range index");if(i<=r)return this;r=r>>>0,i=i===void 0?this.length:i>>>0,e||(e=0);var s;if(typeof e=="number")for(s=r;s<i;++s)this[s]=e;else{var o=ne.isBuffer(e)?e:new ne(e),a=o.length;for(s=0;s<i-r;++s)this[s+r]=o[s%a]}return this};ne.concat=function(e,r){if(!kd(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return ii(null,0);var i;if(r===void 0)for(r=0,i=0;i<e.length;++i)r+=e[i].length;var n=sh(null,r),s=0;for(i=0;i<e.length;++i){var o=e[i];if(!ne.isBuffer(o))throw new TypeError('"list" argument must be an Array of Buffers');o.copy(n,s),s+=o.length}return n};ne.byteLength=ah;ne.prototype._isBuffer=!0;ne.isBuffer=function(e){return!!(e!=null&&e._isBuffer)};_r.alloc=function(t){var e=new ne(t);return e.fill(0),e};_r.from=function(t){return new ne(t)};var wt={},so,jd=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];wt.getSymbolSize=function(e){if(!e)throw new Error('"version" cannot be null or undefined');if(e<1||e>40)throw new Error('"version" should be in range from 1 to 40');return e*4+17};wt.getSymbolTotalCodewords=function(e){return jd[e]};wt.getBCHDigit=function(t){for(var e=0;t!==0;)e++,t>>>=1;return e};wt.setToSJISFunction=function(e){if(typeof e!="function")throw new Error('"toSJISFunc" is not a valid function.');so=e};wt.isKanjiModeEnabled=function(){return typeof so<"u"};wt.toSJIS=function(e){return so(e)};var On={};(function(t){t.L={bit:1},t.M={bit:0},t.Q={bit:3},t.H={bit:2};function e(r){if(typeof r!="string")throw new Error("Param is not a string");var i=r.toLowerCase();switch(i){case"l":case"low":return t.L;case"m":case"medium":return t.M;case"q":case"quartile":return t.Q;case"h":case"high":return t.H;default:throw new Error("Unknown EC Level: "+r)}}t.isValid=function(i){return i&&typeof i.bit<"u"&&i.bit>=0&&i.bit<4},t.from=function(i,n){if(t.isValid(i))return i;try{return e(i)}catch{return n}}})(On);function ch(){this.buffer=[],this.length=0}ch.prototype={get:function(t){var e=Math.floor(t/8);return(this.buffer[e]>>>7-t%8&1)===1},put:function(t,e){for(var r=0;r<e;r++)this.putBit((t>>>e-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Kd=ch,$o=_r;function Hi(t){if(!t||t<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=t,this.data=$o.alloc(t*t),this.reservedBit=$o.alloc(t*t)}Hi.prototype.set=function(t,e,r,i){var n=t*this.size+e;this.data[n]=r,i&&(this.reservedBit[n]=!0)};Hi.prototype.get=function(t,e){return this.data[t*this.size+e]};Hi.prototype.xor=function(t,e,r){this.data[t*this.size+e]^=r};Hi.prototype.isReserved=function(t,e){return this.reservedBit[t*this.size+e]};var Vd=Hi,hh={};(function(t){var e=wt.getSymbolSize;t.getRowColCoords=function(i){if(i===1)return[];for(var n=Math.floor(i/7)+2,s=e(i),o=s===145?26:Math.ceil((s-13)/(2*n-2))*2,a=[s-7],h=1;h<n-1;h++)a[h]=a[h-1]-o;return a.push(6),a.reverse()},t.getPositions=function(i){for(var n=[],s=t.getRowColCoords(i),o=s.length,a=0;a<o;a++)for(var h=0;h<o;h++)a===0&&h===0||a===0&&h===o-1||a===o-1&&h===0||n.push([s[a],s[h]]);return n}})(hh);var lh={},Wd=wt.getSymbolSize,zo=7;lh.getPositions=function(e){var r=Wd(e);return[[0,0],[r-zo,0],[0,r-zo]]};var uh={};(function(t){t.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var e={N1:3,N2:3,N3:40,N4:10};t.isValid=function(n){return n!=null&&n!==""&&!isNaN(n)&&n>=0&&n<=7},t.from=function(n){return t.isValid(n)?parseInt(n,10):void 0},t.getPenaltyN1=function(n){for(var s=n.size,o=0,a=0,h=0,u=null,f=null,m=0;m<s;m++){a=h=0,u=f=null;for(var b=0;b<s;b++){var v=n.get(m,b);v===u?a++:(a>=5&&(o+=e.N1+(a-5)),u=v,a=1),v=n.get(b,m),v===f?h++:(h>=5&&(o+=e.N1+(h-5)),f=v,h=1)}a>=5&&(o+=e.N1+(a-5)),h>=5&&(o+=e.N1+(h-5))}return o},t.getPenaltyN2=function(n){for(var s=n.size,o=0,a=0;a<s-1;a++)for(var h=0;h<s-1;h++){var u=n.get(a,h)+n.get(a,h+1)+n.get(a+1,h)+n.get(a+1,h+1);(u===4||u===0)&&o++}return o*e.N2},t.getPenaltyN3=function(n){for(var s=n.size,o=0,a=0,h=0,u=0;u<s;u++){a=h=0;for(var f=0;f<s;f++)a=a<<1&2047|n.get(u,f),f>=10&&(a===1488||a===93)&&o++,h=h<<1&2047|n.get(f,u),f>=10&&(h===1488||h===93)&&o++}return o*e.N3},t.getPenaltyN4=function(n){for(var s=0,o=n.data.length,a=0;a<o;a++)s+=n.data[a];var h=Math.abs(Math.ceil(s*100/o/5)-10);return h*e.N4};function r(i,n,s){switch(i){case t.Patterns.PATTERN000:return(n+s)%2===0;case t.Patterns.PATTERN001:return n%2===0;case t.Patterns.PATTERN010:return s%3===0;case t.Patterns.PATTERN011:return(n+s)%3===0;case t.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(s/3))%2===0;case t.Patterns.PATTERN101:return n*s%2+n*s%3===0;case t.Patterns.PATTERN110:return(n*s%2+n*s%3)%2===0;case t.Patterns.PATTERN111:return(n*s%3+(n+s)%2)%2===0;default:throw new Error("bad maskPattern:"+i)}}t.applyMask=function(n,s){for(var o=s.size,a=0;a<o;a++)for(var h=0;h<o;h++)s.isReserved(h,a)||s.xor(h,a,r(n,h,a))},t.getBestMask=function(n,s){for(var o=Object.keys(t.Patterns).length,a=0,h=1/0,u=0;u<o;u++){s(u),t.applyMask(u,n);var f=t.getPenaltyN1(n)+t.getPenaltyN2(n)+t.getPenaltyN3(n)+t.getPenaltyN4(n);t.applyMask(u,n),f<h&&(h=f,a=u)}return a}})(uh);var kn={},yr=On,rn=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],nn=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];kn.getBlocksCount=function(e,r){switch(r){case yr.L:return rn[(e-1)*4+0];case yr.M:return rn[(e-1)*4+1];case yr.Q:return rn[(e-1)*4+2];case yr.H:return rn[(e-1)*4+3];default:return}};kn.getTotalCodewordsCount=function(e,r){switch(r){case yr.L:return nn[(e-1)*4+0];case yr.M:return nn[(e-1)*4+1];case yr.Q:return nn[(e-1)*4+2];case yr.H:return nn[(e-1)*4+3];default:return}};var dh={},Bn={},fh=_r,Oi=fh.alloc(512),vn=fh.alloc(256);(function(){for(var e=1,r=0;r<255;r++)Oi[r]=e,vn[e]=r,e<<=1,e&256&&(e^=285);for(r=255;r<512;r++)Oi[r]=Oi[r-255]})();Bn.log=function(e){if(e<1)throw new Error("log("+e+")");return vn[e]};Bn.exp=function(e){return Oi[e]};Bn.mul=function(e,r){return e===0||r===0?0:Oi[vn[e]+vn[r]]};(function(t){var e=_r,r=Bn;t.mul=function(n,s){for(var o=e.alloc(n.length+s.length-1),a=0;a<n.length;a++)for(var h=0;h<s.length;h++)o[a+h]^=r.mul(n[a],s[h]);return o},t.mod=function(n,s){for(var o=e.from(n);o.length-s.length>=0;){for(var a=o[0],h=0;h<s.length;h++)o[h]^=r.mul(s[h],a);for(var u=0;u<o.length&&o[u]===0;)u++;o=o.slice(u)}return o},t.generateECPolynomial=function(n){for(var s=e.from([1]),o=0;o<n;o++)s=t.mul(s,[1,r.exp(o)]);return s}})(dh);var jo=_r,ph=dh,Hd=K.bufferPolyfill.Buffer;function oo(t){this.genPoly=void 0,this.degree=t,this.degree&&this.initialize(this.degree)}oo.prototype.initialize=function(e){this.degree=e,this.genPoly=ph.generateECPolynomial(this.degree)};oo.prototype.encode=function(e){if(!this.genPoly)throw new Error("Encoder not initialized");var r=jo.alloc(this.degree),i=Hd.concat([e,r],e.length+this.degree),n=ph.mod(i,this.genPoly),s=this.degree-n.length;if(s>0){var o=jo.alloc(this.degree);return n.copy(o,s),o}return n};var Jd=oo,gh={},br={},ao={};ao.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40};var Ht={},mh="[0-9]+",Qd="[A-Z $%*+\\-./:]+",Ui="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ui=Ui.replace(/u/g,"\\u");var Gd="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ui+`)(?:.|[\r
2
2
  ]))+`;Ht.KANJI=new RegExp(Ui,"g");Ht.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");Ht.BYTE=new RegExp(Gd,"g");Ht.NUMERIC=new RegExp(mh,"g");Ht.ALPHANUMERIC=new RegExp(Qd,"g");var Yd=new RegExp("^"+Ui+"$"),Xd=new RegExp("^"+mh+"$"),Zd=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");Ht.testKanji=function(e){return Yd.test(e)};Ht.testNumeric=function(e){return Xd.test(e)};Ht.testAlphanumeric=function(e){return Zd.test(e)};(function(t){var e=ao,r=Ht;t.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},t.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},t.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},t.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},t.MIXED={bit:-1},t.getCharCountIndicator=function(s,o){if(!s.ccBits)throw new Error("Invalid mode: "+s);if(!e.isValid(o))throw new Error("Invalid version: "+o);return o>=1&&o<10?s.ccBits[0]:o<27?s.ccBits[1]:s.ccBits[2]},t.getBestModeForData=function(s){return r.testNumeric(s)?t.NUMERIC:r.testAlphanumeric(s)?t.ALPHANUMERIC:r.testKanji(s)?t.KANJI:t.BYTE},t.toString=function(s){if(s&&s.id)return s.id;throw new Error("Invalid mode")},t.isValid=function(s){return s&&s.bit&&s.ccBits};function i(n){if(typeof n!="string")throw new Error("Param is not a string");var s=n.toLowerCase();switch(s){case"numeric":return t.NUMERIC;case"alphanumeric":return t.ALPHANUMERIC;case"kanji":return t.KANJI;case"byte":return t.BYTE;default:throw new Error("Unknown mode: "+n)}}t.from=function(s,o){if(t.isValid(s))return s;try{return i(s)}catch{return o}}})(br);(function(t){var e=wt,r=kn,i=On,n=br,s=ao,o=to,a=7973,h=e.getBCHDigit(a);function u(v,E,x){for(var S=1;S<=40;S++)if(E<=t.getCapacity(S,x,v))return S}function f(v,E){return n.getCharCountIndicator(v,E)+4}function m(v,E){var x=0;return v.forEach(function(S){var N=f(S.mode,E);x+=N+S.getBitsLength()}),x}function b(v,E){for(var x=1;x<=40;x++){var S=m(v,x);if(S<=t.getCapacity(x,E,n.MIXED))return x}}t.from=function(E,x){return s.isValid(E)?parseInt(E,10):x},t.getCapacity=function(E,x,S){if(!s.isValid(E))throw new Error("Invalid QR Code version");typeof S>"u"&&(S=n.BYTE);var N=e.getSymbolTotalCodewords(E),R=r.getTotalCodewordsCount(E,x),O=(N-R)*8;if(S===n.MIXED)return O;var C=O-f(S,E);switch(S){case n.NUMERIC:return Math.floor(C/10*3);case n.ALPHANUMERIC:return Math.floor(C/11*2);case n.KANJI:return Math.floor(C/13);case n.BYTE:default:return Math.floor(C/8)}},t.getBestVersionForData=function(E,x){var S,N=i.from(x,i.M);if(o(E)){if(E.length>1)return b(E,N);if(E.length===0)return 1;S=E[0]}else S=E;return u(S.mode,S.getLength(),N)},t.getEncodedBits=function(E){if(!s.isValid(E)||E<7)throw new Error("Invalid QR Code version");for(var x=E<<12;e.getBCHDigit(x)-h>=0;)x^=a<<e.getBCHDigit(x)-h;return E<<12|x}})(gh);var yh={},Bs=wt,vh=1335,ef=21522,Ko=Bs.getBCHDigit(vh);yh.getEncodedBits=function(e,r){for(var i=e.bit<<3|r,n=i<<10;Bs.getBCHDigit(n)-Ko>=0;)n^=vh<<Bs.getBCHDigit(n)-Ko;return(i<<10|n)^ef};var wh={},tf=br;function ni(t){this.mode=tf.NUMERIC,this.data=t.toString()}ni.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)};ni.prototype.getLength=function(){return this.data.length};ni.prototype.getBitsLength=function(){return ni.getBitsLength(this.data.length)};ni.prototype.write=function(e){var r,i,n;for(r=0;r+3<=this.data.length;r+=3)i=this.data.substr(r,3),n=parseInt(i,10),e.put(n,10);var s=this.data.length-r;s>0&&(i=this.data.substr(r),n=parseInt(i,10),e.put(n,s*3+1))};var rf=ni,nf=br,ns=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function si(t){this.mode=nf.ALPHANUMERIC,this.data=t}si.getBitsLength=function(e){return 11*Math.floor(e/2)+6*(e%2)};si.prototype.getLength=function(){return this.data.length};si.prototype.getBitsLength=function(){return si.getBitsLength(this.data.length)};si.prototype.write=function(e){var r;for(r=0;r+2<=this.data.length;r+=2){var i=ns.indexOf(this.data[r])*45;i+=ns.indexOf(this.data[r+1]),e.put(i,11)}this.data.length%2&&e.put(ns.indexOf(this.data[r]),6)};var sf=si,of=_r,af=br;function oi(t){this.mode=af.BYTE,this.data=of.from(t)}oi.getBitsLength=function(e){return e*8};oi.prototype.getLength=function(){return this.data.length};oi.prototype.getBitsLength=function(){return oi.getBitsLength(this.data.length)};oi.prototype.write=function(t){for(var e=0,r=this.data.length;e<r;e++)t.put(this.data[e],8)};var cf=oi,hf=br,lf=wt;function ai(t){this.mode=hf.KANJI,this.data=t}ai.getBitsLength=function(e){return e*13};ai.prototype.getLength=function(){return this.data.length};ai.prototype.getBitsLength=function(){return ai.getBitsLength(this.data.length)};ai.prototype.write=function(t){var e;for(e=0;e<this.data.length;e++){var r=lf.toSJIS(this.data[e]);if(r>=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[e]+`
3
3
  Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),t.put(r,13)}};var uf=ai;(function(t){var e=br,r=rf,i=sf,n=cf,s=uf,o=Ht,a=wt,h=xu.dijkstraExports;function u(N){return unescape(encodeURIComponent(N)).length}function f(N,R,O){for(var C=[],D;(D=N.exec(O))!==null;)C.push({data:D[0],index:D.index,mode:R,length:D[0].length});return C}function m(N){var R=f(o.NUMERIC,e.NUMERIC,N),O=f(o.ALPHANUMERIC,e.ALPHANUMERIC,N),C,D;a.isKanjiModeEnabled()?(C=f(o.BYTE,e.BYTE,N),D=f(o.KANJI,e.KANJI,N)):(C=f(o.BYTE_KANJI,e.BYTE,N),D=[]);var L=R.concat(O,C,D);return L.sort(function($,U){return $.index-U.index}).map(function($){return{data:$.data,mode:$.mode,length:$.length}})}function b(N,R){switch(R){case e.NUMERIC:return r.getBitsLength(N);case e.ALPHANUMERIC:return i.getBitsLength(N);case e.KANJI:return s.getBitsLength(N);case e.BYTE:return n.getBitsLength(N)}}function v(N){return N.reduce(function(R,O){var C=R.length-1>=0?R[R.length-1]:null;return C&&C.mode===O.mode?(R[R.length-1].data+=O.data,R):(R.push(O),R)},[])}function E(N){for(var R=[],O=0;O<N.length;O++){var C=N[O];switch(C.mode){case e.NUMERIC:R.push([C,{data:C.data,mode:e.ALPHANUMERIC,length:C.length},{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.ALPHANUMERIC:R.push([C,{data:C.data,mode:e.BYTE,length:C.length}]);break;case e.KANJI:R.push([C,{data:C.data,mode:e.BYTE,length:u(C.data)}]);break;case e.BYTE:R.push([{data:C.data,mode:e.BYTE,length:u(C.data)}])}}return R}function x(N,R){for(var O={},C={start:{}},D=["start"],L=0;L<N.length;L++){for(var $=N[L],U=[],ee=0;ee<$.length;ee++){var oe=$[ee],te=""+L+ee;U.push(te),O[te]={node:oe,lastCount:0},C[te]={};for(var he=0;he<D.length;he++){var c=D[he];O[c]&&O[c].node.mode===oe.mode?(C[c][te]=b(O[c].lastCount+oe.length,oe.mode)-b(O[c].lastCount,oe.mode),O[c].lastCount+=oe.length):(O[c]&&(O[c].lastCount=oe.length),C[c][te]=b(oe.length,oe.mode)+4+e.getCharCountIndicator(oe.mode,R))}}D=U}for(he=0;he<D.length;he++)C[D[he]].end=0;return{map:C,table:O}}function S(N,R){var O,C=e.getBestModeForData(N);if(O=e.from(R,C),O!==e.BYTE&&O.bit<C.bit)throw new Error('"'+N+'" cannot be encoded with mode '+e.toString(O)+`.
4
4
  Suggested mode is: `+e.toString(C));switch(O===e.KANJI&&!a.isKanjiModeEnabled()&&(O=e.BYTE),O){case e.NUMERIC:return new r(N);case e.ALPHANUMERIC:return new i(N);case e.KANJI:return new s(N);case e.BYTE:return new n(N)}}t.fromArray=function(R){return R.reduce(function(O,C){return typeof C=="string"?O.push(S(C,null)):C.data&&O.push(S(C.data,C.mode)),O},[])},t.fromString=function(R,O){for(var C=m(R,a.isKanjiModeEnabled()),D=E(C),L=x(D,O),$=h.find_path(L.map,"start","end"),U=[],ee=1;ee<$.length-1;ee++)U.push(L.table[$[ee]].node);return t.fromArray(v(U))},t.rawSplit=function(R){return t.fromArray(m(R,a.isKanjiModeEnabled()))}})(wh);var Vo=_r,Dn=wt,ss=On,df=Kd,ff=Vd,pf=hh,gf=lh,Ds=uh,Fs=kn,mf=Jd,wn=gh,yf=yh,vf=br,os=wh,wf=to;function _f(t,e){for(var r=t.size,i=gf.getPositions(e),n=0;n<i.length;n++)for(var s=i[n][0],o=i[n][1],a=-1;a<=7;a++)if(!(s+a<=-1||r<=s+a))for(var h=-1;h<=7;h++)o+h<=-1||r<=o+h||(a>=0&&a<=6&&(h===0||h===6)||h>=0&&h<=6&&(a===0||a===6)||a>=2&&a<=4&&h>=2&&h<=4?t.set(s+a,o+h,!0,!0):t.set(s+a,o+h,!1,!0))}function bf(t){for(var e=t.size,r=8;r<e-8;r++){var i=r%2===0;t.set(r,6,i,!0),t.set(6,r,i,!0)}}function Af(t,e){for(var r=pf.getPositions(e),i=0;i<r.length;i++)for(var n=r[i][0],s=r[i][1],o=-2;o<=2;o++)for(var a=-2;a<=2;a++)o===-2||o===2||a===-2||a===2||o===0&&a===0?t.set(n+o,s+a,!0,!0):t.set(n+o,s+a,!1,!0)}function Ef(t,e){for(var r=t.size,i=wn.getEncodedBits(e),n,s,o,a=0;a<18;a++)n=Math.floor(a/3),s=a%3+r-8-3,o=(i>>a&1)===1,t.set(n,s,o,!0),t.set(s,n,o,!0)}function as(t,e,r){var i=t.size,n=yf.getEncodedBits(e,r),s,o;for(s=0;s<15;s++)o=(n>>s&1)===1,s<6?t.set(s,8,o,!0):s<8?t.set(s+1,8,o,!0):t.set(i-15+s,8,o,!0),s<8?t.set(8,i-s-1,o,!0):s<9?t.set(8,15-s-1+1,o,!0):t.set(8,15-s-1,o,!0);t.set(i-8,8,1,!0)}function Sf(t,e){for(var r=t.size,i=-1,n=r-1,s=7,o=0,a=r-1;a>0;a-=2)for(a===6&&a--;;){for(var h=0;h<2;h++)if(!t.isReserved(n,a-h)){var u=!1;o<e.length&&(u=(e[o]>>>s&1)===1),t.set(n,a-h,u),s--,s===-1&&(o++,s=7)}if(n+=i,n<0||r<=n){n-=i,i=-i;break}}}function If(t,e,r){var i=new df;r.forEach(function(u){i.put(u.mode.bit,4),i.put(u.getLength(),vf.getCharCountIndicator(u.mode,t)),u.write(i)});var n=Dn.getSymbolTotalCodewords(t),s=Fs.getTotalCodewordsCount(t,e),o=(n-s)*8;for(i.getLengthInBits()+4<=o&&i.put(0,4);i.getLengthInBits()%8!==0;)i.putBit(0);for(var a=(o-i.getLengthInBits())/8,h=0;h<a;h++)i.put(h%2?17:236,8);return Mf(i,t,e)}function Mf(t,e,r){for(var i=Dn.getSymbolTotalCodewords(e),n=Fs.getTotalCodewordsCount(e,r),s=i-n,o=Fs.getBlocksCount(e,r),a=i%o,h=o-a,u=Math.floor(i/o),f=Math.floor(s/o),m=f+1,b=u-f,v=new mf(b),E=0,x=new Array(o),S=new Array(o),N=0,R=Vo.from(t.buffer),O=0;O<o;O++){var C=O<h?f:m;x[O]=R.slice(E,E+C),S[O]=v.encode(x[O]),E+=C,N=Math.max(N,C)}var D=Vo.alloc(i),L=0,$,U;for($=0;$<N;$++)for(U=0;U<o;U++)$<x[U].length&&(D[L++]=x[U][$]);for($=0;$<b;$++)for(U=0;U<o;U++)D[L++]=S[U][$];return D}function xf(t,e,r,i){var n;if(wf(t))n=os.fromArray(t);else if(typeof t=="string"){var s=e;if(!s){var o=os.rawSplit(t);s=wn.getBestVersionForData(o,r)}n=os.fromString(t,s||40)}else throw new Error("Invalid data");var a=wn.getBestVersionForData(n,r);if(!a)throw new Error("The amount of data is too big to be stored in a QR Code");if(!e)e=a;else if(e<a)throw new Error(`