@dcl/explorer-website 2.6.1-25865517797.commit-b7a7cba → 2.7.0

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 (141) hide show
  1. package/assets/{ConstantsUtil-ByjAYmvC.js → ConstantsUtil-BYRHWuZV.js} +1 -1
  2. package/assets/{ExchangeController-Bp8ztJrX.js → ExchangeController-N42lbf3C.js} +1 -1
  3. package/assets/{HelpersUtil-Dp4e1zvd.js → HelpersUtil-DFmhrbIH.js} +1 -1
  4. package/assets/{NetworkUtil-DqGcuBfF.js → NetworkUtil-DM5H1DOt.js} +1 -1
  5. package/assets/{SwapController-DUCq2f7d.js → SwapController-SgAc8zJM.js} +1 -1
  6. package/assets/{W3MFrameProviderSingleton-9eitOT0j.js → W3MFrameProviderSingleton-dGwr0u32.js} +3 -3
  7. package/assets/{basic-C7tUDecp.js → basic-CDUVa7W3.js} +1 -1
  8. package/assets/{biconomy-plHCR2Qq.js → biconomy-Dj37CYYZ.js} +1 -1
  9. package/assets/{browser-VYI7gorG.js → browser-h4rN6CV4.js} +1 -1
  10. package/assets/browser-ponyfill-LG9Rjmfj.js +1 -0
  11. package/assets/{ccip-Bldffu31.js → ccip-Cv_5kGJ0.js} +1 -1
  12. package/assets/{ccip-CrAifiNa.js → ccip-TlIoUAte.js} +1 -1
  13. package/assets/{chains-DTVDhUwv.js → chains-CsuV2rnE.js} +1 -1
  14. package/assets/{common-BEf2T7Hi.js → common-C9wbti_7.js} +1 -1
  15. package/assets/{controller-B8Iy-6V9.js → controller-DpEeOSLx.js} +2 -2
  16. package/assets/{core-XFvzSI58.js → core-BGvtiIgG.js} +4 -4
  17. package/assets/{custom-cPmISGcH.js → custom-BbQhcg55.js} +1 -1
  18. package/assets/{data-capture-DnvAEYWK.js → data-capture-C5UoNnMk.js} +1 -1
  19. package/assets/decimals-DA8L6Gte.js +1 -0
  20. package/assets/{decimals-8g2-fBFa.js → decimals-mBEEumco.js} +1 -1
  21. package/assets/{detectExtension-yvI5WWZb.js → detectExtension-oDT7CrDk.js} +1 -1
  22. package/assets/{email-C8DRQjTT.js → email-CUatRSQC.js} +1 -1
  23. package/assets/{embedded-wallet-BxgtT1uV.js → embedded-wallet-DZAeJhJN.js} +1 -1
  24. package/assets/{engine-BERe87yT.js → engine-AXDB-0h6.js} +1 -1
  25. package/assets/{estimate-l1-fee-BTeKvFv5.js → estimate-l1-fee-Bxwscz8f.js} +1 -1
  26. package/assets/eth_estimateGas-DFXalA2X.js +1 -0
  27. package/assets/{eth_getStorageAt-SbVMAQY-.js → eth_getStorageAt-Dr4zmiJF.js} +1 -1
  28. package/assets/{eth_getTransactionCount-qv0oO1Md.js → eth_getTransactionCount-cZacEETx.js} +1 -1
  29. package/assets/{ethereum-BP59xYBe.js → ethereum-CIBzGnJl.js} +1 -1
  30. package/assets/{extractIPFS-BOFlZk7U.js → extractIPFS-Czsz8-sO.js} +1 -1
  31. package/assets/{features-DVWd8_kC.js → features-fx-atM_l.js} +1 -1
  32. package/assets/{fetchTokenMetadata-BaJXN6RH.js → fetchTokenMetadata-uG4nb_Kh.js} +2 -2
  33. package/assets/{fortmatic-DARkeYTE.js → fortmatic-boxtmFta.js} +1 -1
  34. package/assets/get-ecosystem-wallet-info-BI2Fd0Vd.js +1 -0
  35. package/assets/{getBalance-D6wpo61w.js → getBalance-CC2S0qtL.js} +2 -2
  36. package/assets/{getInstalledModules-Dkj379ys.js → getInstalledModules-53n5UYt2.js} +1 -1
  37. package/assets/{getNFT-HMkoXD7L.js → getNFT-C3FPakLN.js} +2 -2
  38. package/assets/{getNFT-Drn4rxrk.js → getNFT-CnaK4j2q.js} +1 -1
  39. package/assets/{hashTypedData-CMDSWYgs.js → hashTypedData-C4JiqOxU.js} +1 -1
  40. package/assets/{hashTypedData-B5shS-rs.js → hashTypedData-D1Ievn97.js} +1 -1
  41. package/assets/{in-app-wallet-calls-l9-2W_Em.js → in-app-wallet-calls-khLeeKNu.js} +1 -1
  42. package/assets/{index-BIPd_vR5.js → index-0P32tQWj.js} +1 -1
  43. package/assets/{index-DIlwNfpB.js → index-1quVm3wk.js} +1 -1
  44. package/assets/{index-DbAu4Peg.js → index-B2PoGJRP.js} +3 -3
  45. package/assets/{index-BaGjqMte.js → index-B5w_jZpc.js} +2 -2
  46. package/assets/{index-CE5G6IEJ.js → index-B6j-Tckn.js} +1 -1
  47. package/assets/{index-CjiwjbqL.js → index-BCiKer83.js} +1 -1
  48. package/assets/{index-C8NSq3HK.js → index-BCqrDgyR.js} +1 -1
  49. package/assets/{index-BXAxcybX.js → index-BE5nQY53.js} +1 -1
  50. package/assets/{index-C51HwlD0.js → index-BF9Yx_yV.js} +1 -1
  51. package/assets/{index-CWGeCZBJ.js → index-BJCYEGPg.js} +1 -1
  52. package/assets/{index-Cy1X3n_C.js → index-BT0xQ-Xd.js} +1 -1
  53. package/assets/{index-0ShVRzxt.js → index-BVi4iI8y.js} +1 -1
  54. package/assets/{index-BDgZ3gDE.js → index-BVvMg9ZB.js} +1 -1
  55. package/assets/{index-DFE6t65x.js → index-BpxeqYFx.js} +1 -1
  56. package/assets/{index-B5ECjSS9.js → index-Bv6LvzLS.js} +1 -1
  57. package/assets/{index-i4VBSYqA.js → index-BvCGPTHO.js} +1 -1
  58. package/assets/index-Bzi38pjx.css +1 -0
  59. package/assets/{index-CH0zI801.js → index-C5oPclal.js} +1 -1
  60. package/assets/{index-D2ZBQG8w.js → index-C6-AvlPm.js} +1 -1
  61. package/assets/{index-CWnFK_-0.js → index-C9EMW8qD.js} +1 -1
  62. package/assets/{index-C-uqursN.js → index-C9vcJp9T.js} +1 -1
  63. package/assets/{index-DK-ZMNLh.js → index-CO3lXLzl.js} +1 -1
  64. package/assets/{index-DS2Lm9tG.js → index-CYBDya_s.js} +1 -1
  65. package/assets/{index-okvlQSs2.js → index-Coj3uG35.js} +1 -1
  66. package/assets/{index-Cu4ZjLNb.js → index-CqbvjyBi.js} +5 -5
  67. package/assets/{index-wds8TuUm.js → index-CwfOYq8B.js} +1 -1
  68. package/assets/{index-aoxVkzFE.js → index-Cz0JdeQb.js} +1 -1
  69. package/assets/{index-C5ciuua_.js → index-D-YuFp2i.js} +1 -1
  70. package/assets/{index-I68folnJ.js → index-D4NLrlUn.js} +1 -1
  71. package/assets/{index-B7Jt3b4d.js → index-D8PaxcsI.js} +1 -1
  72. package/assets/{index-r_1z0VI_.js → index-D9ey6cqT.js} +1 -1
  73. package/assets/{index-B-vyBZw9.js → index-DRYOQXZX.js} +1 -1
  74. package/assets/{index-DOnRCLNP.js → index-DT1PkdGa.js} +2 -2
  75. package/assets/{index-DWRq2SN_.js → index-DXCSroqX.js} +1 -1
  76. package/assets/{index-mZa0UiRt.js → index-DXs78xw9.js} +1 -1
  77. package/assets/{index-kXKMGszW.js → index-DZ0punK7.js} +1 -1
  78. package/assets/{index-B9U0GcYk.js → index-D_m5AL3D.js} +1 -1
  79. package/assets/{index-BxdNwV86.js → index-Dc148hav.js} +1 -1
  80. package/assets/{index-DP1DuCnR.js → index-DgDxBH9m.js} +1 -1
  81. package/assets/{index-DfWsAOhN.js → index-Dm7tCcMc.js} +3 -3
  82. package/assets/{index-D0LvjNIX.js → index-DmIGOG39.js} +1 -1
  83. package/assets/{index-JfVynEph.js → index-DmK5ktNw.js} +1 -1
  84. package/assets/{index-Cp7mdTuR.js → index-Eyans5--.js} +1 -1
  85. package/assets/{index-DPxCDCvr.js → index-KK8ZylE4.js} +1 -1
  86. package/assets/{index-DvJmANzU.js → index-TUD0QlWP.js} +1 -1
  87. package/assets/{index-TBthDmkl.js → index-ak5cSl-l.js} +1 -1
  88. package/assets/{index-8M7OkBFm.js → index-bVr8-SEv.js} +1 -1
  89. package/assets/{index-BlykZ8Gp.js → index-prLj8b2x.js} +1 -1
  90. package/assets/{index-BKL7nv1p.js → index-vajj2FBo.js} +1 -1
  91. package/assets/{index.es-YpI01v2I.js → index.es-C85F8NOj.js} +1 -1
  92. package/assets/{index.es-CkxUaFYS.js → index.es-DYgSAVrd.js} +1 -1
  93. package/assets/{index.es-cEGj7JU0.js → index.es-XXBqJXMm.js} +4 -4
  94. package/assets/{localBatchGatewayRequest-CNIOIq-Z.js → localBatchGatewayRequest-DbQn1s0J.js} +1 -1
  95. package/assets/{networks-DJ72puSk.js → networks-DMqekeph.js} +1 -1
  96. package/assets/{onramp--l5ZLxWE.js → onramp-qvbxoSMm.js} +1 -1
  97. package/assets/{openzeppelin-CqtRqxtF.js → openzeppelin-B6Und3LJ.js} +1 -1
  98. package/assets/{ownerOf-cWkgEtd8.js → ownerOf-CUoSe2c5.js} +1 -1
  99. package/assets/{parseEventLogs-D1xiFnCH.js → parseEventLogs-BxtEI7tW.js} +3 -3
  100. package/assets/{parseNft-DH5KlHPI.js → parseNft-DB_pGzOu.js} +2 -2
  101. package/assets/{parseSignature-HAlgOHnm.js → parseSignature-Csyua1uA.js} +3 -3
  102. package/assets/{parseSignature-BYhcrVdX.js → parseSignature-O0fAqZoB.js} +1 -1
  103. package/assets/{pay-with-exchange-CiXPJJ6-.js → pay-with-exchange-1MlV9x6H.js} +1 -1
  104. package/assets/{qr-overlay-CmFgwJBd.js → qr-overlay-DA6htUdY.js} +3 -3
  105. package/assets/{receive-t2TxUItI.js → receive-JnpfZY7d.js} +1 -1
  106. package/assets/{resolveImplementation-iG9WRRnW.js → resolveImplementation-B8d2Q-Ro.js} +1 -1
  107. package/assets/{rpc-sIdV4wiJ.js → rpc-DkFFCBh9.js} +1 -1
  108. package/assets/{secp256k1-Rk5k9i7o.js → secp256k1-BCPsQ5nJ.js} +1 -1
  109. package/assets/{secp256k1-Co_Jve4c.js → secp256k1-BZmrY8e3.js} +1 -1
  110. package/assets/{secp256k1-Bg2aUJRs.js → secp256k1-TIizaas9.js} +1 -1
  111. package/assets/{send-ByB5fOtm.js → send-DsnDja5n.js} +1 -1
  112. package/assets/{send-batch-transaction-D79MC_wr.js → send-batch-transaction-jNcvidMH.js} +1 -1
  113. package/assets/{send-eip712-transaction-CB6qLgks.js → send-eip712-transaction-DDJVOUpU.js} +2 -2
  114. package/assets/{send-gasless-transaction-Dt1qtUR8.js → send-gasless-transaction-DXjarWmh.js} +2 -2
  115. package/assets/{session-proposal-CY0k9Jnm.js → session-proposal-xJguSOgr.js} +1 -1
  116. package/assets/{session-request-B_2glC9e.js → session-request-BhD4eDPG.js} +2 -2
  117. package/assets/{sha256-Dy8KQE_5.js → sha256-CbjS9vFa.js} +1 -1
  118. package/assets/{signing-gNn6SJWz.js → signing-tKzVzr3v.js} +5 -5
  119. package/assets/{socials-Dx84-PrV.js → socials-CER945jA.js} +1 -1
  120. package/assets/{swaps-CK9Sfcew.js → swaps-Dy4hNTFm.js} +1 -1
  121. package/assets/{thirdweb-Bx5V_C1s.js → thirdweb-CNCkvOQU.js} +3 -3
  122. package/assets/{totalSupply-O-VFDoRO.js → totalSupply-BQvZy7Uc.js} +1 -1
  123. package/assets/{transactionReceipt-BqEjx5q-.js → transactionReceipt-DA1xo-2g.js} +1 -1
  124. package/assets/{transactions-BLOC2qYE.js → transactions-CwEfhngY.js} +1 -1
  125. package/assets/{utils-h8VUSGPW.js → utils-BUWGRgBa.js} +1 -1
  126. package/assets/{verifyHash-CNJ6t8Wp.js → verifyHash-CX9Livyx.js} +1 -1
  127. package/assets/{w3m-modal-nzPxg0Fr.js → w3m-modal-B1spewtI.js} +1 -1
  128. package/assets/{w3m-modal-CCQuGDus.js → w3m-modal-B6M729n4.js} +1 -1
  129. package/assets/{wait-for-tx-receipt-5pSBMNe2.js → wait-for-tx-receipt-BLruoSfj.js} +1 -1
  130. package/assets/{wallets-Bz03-Btm.js → wallets-vCTTbbau.js} +6 -6
  131. package/assets/{web-connector-CAOe_uvv.js → web-connector-h9SB5qXs.js} +3 -3
  132. package/assets/{writeContract-CCar3Ocq.js → writeContract-C9KDDivM.js} +1 -1
  133. package/assets/{zora-sepolia-D6mjhB5j.js → zora-sepolia-pCyxGzqm.js} +1 -1
  134. package/assets/{zoraTestnet-WLSFziQl.js → zoraTestnet-ChmlUfs6.js} +1 -1
  135. package/index.html +4 -4
  136. package/package.json +3 -3
  137. package/assets/browser-ponyfill-BmgQyNz0.js +0 -1
  138. package/assets/decimals-DR6jraOc.js +0 -1
  139. package/assets/eth_estimateGas-DKKwG-Ue.js +0 -1
  140. package/assets/get-ecosystem-wallet-info-Cvjz8DFX.js +0 -1
  141. package/assets/index-829Uxa3Y.css +0 -1
@@ -1,7 +1,7 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-Cvjz8DFX.js","assets/signing-gNn6SJWz.js","assets/utils-h8VUSGPW.js","assets/index-Cu4ZjLNb.js","assets/index-829Uxa3Y.css","assets/store-DOLZnwHk.js","assets/hashTypedData-CMDSWYgs.js","assets/index-B-vyBZw9.js","assets/index-DS2Lm9tG.js","assets/index-nibyPLVP.js","assets/index-CJdot1dH.js","assets/index-r_1z0VI_.js","assets/ethereum-BP59xYBe.js","assets/index-BDgZ3gDE.js","assets/hooks.module-CpBu4GjP.js","assets/WebCryptoP256-BkRKBE89.js","assets/sha256-D33fGSQc.js","assets/sha2-D3ryOfi3.js","assets/hmac-BMnSt9Ou.js","assets/index-D2ZBQG8w.js","assets/parseSignature-HAlgOHnm.js","assets/transactionReceipt-BqEjx5q-.js","assets/rpc-sIdV4wiJ.js","assets/sha256-Dy8KQE_5.js","assets/index-DIlwNfpB.js","assets/web-connector-CAOe_uvv.js","assets/sleep-mAKpSMLY.js","assets/index-BaGjqMte.js","assets/send-eip712-transaction-CB6qLgks.js","assets/controller-B8Iy-6V9.js","assets/qr-overlay-CmFgwJBd.js","assets/getBalance-D6wpo61w.js","assets/decimals-8g2-fBFa.js","assets/secp256k1-Rk5k9i7o.js","assets/session-proposal-CY0k9Jnm.js","assets/session-request-B_2glC9e.js","assets/in-app-wallet-calls-l9-2W_Em.js","assets/wait-for-tx-receipt-5pSBMNe2.js","assets/send-batch-transaction-D79MC_wr.js","assets/eth_getTransactionCount-qv0oO1Md.js"])))=>i.map(i=>d[i]);
2
- import{u as ir,cg as ch,ch as lh,ci as uh,cj as Vc,ck as hh,g as Y,cl as dh,cm as nn,cn as Sc,h as De,a as ri,x as Ao,w as ph,n as Le,o as qn,j as ye,co as xc,cp as Cc,cq as $c,k as $s,l as ks,ai as _h,b as Us,ae as fh,C as mh,cr as kc,aM as yh,cs as wh,am as gh,an as Eh,ct as vh,m as nr,az as bh,b6 as Jr,v as Uc,cu as Ns,cv as Nc,aK as Ih,V as Bs,cw as Bc,b7 as Po,cx as Th,W as Ah,aB as Oo,aW as Ph,aa as Oh,cy as Ro,aw as Mc,ay as Rh,E as Lh,cz as Gt,ab as Dh,t as Vh,H as Sh,aU as xh,b2 as Ch,cA as $h}from"./signing-gNn6SJWz.js";import{f as kh,k as qc,l as ci,a as we,j as Ms,w as zc,e as rr,m as Uh,n as Nh,o as Bh,d as Mh,c as pn,p as qh}from"./utils-h8VUSGPW.js";import{b as jt,_ as a,g as zh,h as jh,B as te,e as li,N as jc}from"./index-Cu4ZjLNb.js";import{c as Kh}from"./store-DOLZnwHk.js";import{g as Fh,v as Wh,s as Hh,w as Gh,p as Jh}from"./hashTypedData-CMDSWYgs.js";import{l as vn,a as zn,s as rn,I as Ti,e as Yh,g as B,h as Ot,C as Zh,j as Yr,k as _n,m as Qh,c as Ut,r as Ai,o as Xh,n as ed,q as qs,t as zs,b as jn,P as Lo,Q as td,u as id,v as Qt,f as Kc,w as vt,x as pt,y as Lt}from"./index-B-vyBZw9.js";import{c as nd,a as rd,k as sd,d as od,s as ad,g as Do}from"./index-nibyPLVP.js";import{r as cd}from"./index-CJdot1dH.js";import{f as et,t as ze,c as Gi,a as ld,d as ud}from"./index-r_1z0VI_.js";import"./index-DS2Lm9tG.js";import{e as hd}from"./ethereum-BP59xYBe.js";function dd(i=32){return ir(pd(i))}function pd(i=32){return globalThis.crypto.getRandomValues(new Uint8Array(i))}function _d(i){const t=lh(i);return uh("0x19",Vc(`Ethereum Signed Message:
3
- `+hh(t)),t)}function fd(i){return ch(_d(i))}const yT="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",md="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",yd="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",sr="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",wd="0x0000000071727De22E5E9d8BAf0edAc6f37da032",gd=50000n,Ed=i=>vd(i||sr)==="v0.7"?yd:md,Fc=i=>{const t=kh().bundler;return t.startsWith("localhost:")?`http://${t}/v2?chain=${i.id}`:`https://${i.id}.${t}/v2`},vd=i=>{const t=Y(i);if(t===sr)return"v0.6";if(t===wd)return"v0.7";throw new Error("Unknown paymaster version")};async function Me(i){const{client:t,ecosystem:e,walletType:n,walletAddress:r,chainId:s}=i;return dh({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:r,walletType:n},ecosystem:e})}function js(i){const t=i.domain;return t?.chainId!==void 0&&nn(t.chainId)&&(i.domain={...i.domain,chainId:Sc(i.domain.chainId)}),i}const bd={"0x0":"reverted","0x1":"success"};function Ks(i){const[t,e]=(()=>{const n=i.status;return n>=100&&n<200?["pending",n]:n>=200&&n<300?["success",n]:n>=300&&n<700?["failure",n]:n==="CONFIRMED"?["success",200]:n==="PENDING"?["pending",100]:[void 0,n]})();return{...i,atomic:i.atomic,chainId:i.chainId?ri(i.chainId):void 0,receipts:i.receipts?.map(n=>({...n,blockNumber:De(n.blockNumber),gasUsed:De(n.gasUsed),status:bd[n.status]}))??[],status:t,statusCode:e,version:i.version}}function Fs(i,t){const e={};for(const[n,r]of Object.entries(i)){e[Number(n)]={};const s={};for(const[o,c]of Object.entries(r))s[o]=c;e[Number(n)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Ws(i,t){const e=i.calls[0];if(!e)throw new Error("No calls to send");const{calls:n,capabilities:r,version:s="2.0.0",chain:o=e.chain}=i,c=await Promise.all(n.map(async u=>{const{to:h,value:d}=u;if(h===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([Ao(h),ph(u),Ao(d)]);return p?{data:_,to:Y(p),value:typeof f=="bigint"||typeof f=="number"?Le(f):void 0}:{data:_,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:i.atomicRequired??!1,calls:c,capabilities:r,chainId:Le(o.id),from:Y(t.address),version:s}],chain:o}}function Hs(i){return Id(i).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Id(i,t,e="http"){const n=[];for(const r of i.rpc)e==="http"&&!r.startsWith("http")||e==="ws"&&!r.startsWith("ws")||(r.includes("${THIRDWEB_API_KEY}")?n.push(r.replace("${THIRDWEB_API_KEY}","")):r.includes("${")||n.push(r));if(n.length===0)throw new Error(`No RPC available for chainId "${i.chainId}" with mode ${e}`);return n}function ct(i){return typeof i=="number"?i:qn(i)?ri(i):typeof i=="bigint"?Number(i):Number.parseInt(i,10)}function Td(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Ad(){return typeof jt<"u"&&typeof jt.versions<"u"&&typeof jt.versions.node<"u"}function Wc(){return!Td()&&!Ad()}const _t="com.coinbase.wallet",At="org.base.account",Hc="io.metamask",Pd="me.rainbow",Od="io.zerion.wallet",Kn={async getItem(i){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(i)}catch{}return null},async removeItem(i){typeof window<"u"&&window.localStorage&&localStorage.removeItem(i)},async setItem(i,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(i,t)}catch{}}};function Gs(i){return i.startsWith("http://")||i.startsWith("https://")}function Gc(i,t){if(!Gs(i))return Jc(i,t);let e=i;e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function Jc(i,t){if(Gs(i))return Gc(i,t);let e=i;e.includes("://")||(e=i.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function Rd(i,t){return Gs(i)?Gc(i,t):Jc(i,t)}function Ld(){if(typeof navigator>"u")return!1;const i=qc(navigator.userAgent);return i?i.toLowerCase().includes("android"):!1}function Dd(){if(typeof navigator>"u")return!1;const i=qc(navigator.userAgent);return i?i.toLowerCase().includes("ios")||i.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Vd(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Sd(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function Vo(){return!!(Ld()||Dd()||Vd()&&Sd()||typeof window<"u"&&window.innerWidth<640)}function wr(i){if(window!==window.top)window.open(i);else if(i.startsWith("http")){const e=document.createElement("a");e.href=i,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=i}function Pi(i){return typeof i=="string"?i.startsWith("ecosystem."):i.id.startsWith("ecosystem.")}async function Yc(i,t){if(Pi(i)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:n}=await import("./get-ecosystem-wallet-info-Cvjz8DFX.js");return{getEcosystemWalletInfo:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));return t?e(i).then(n=>n.image_id):e(i)}switch(i){case"smart":return t?a(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):a(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):a(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):a(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):a(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):a(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):a(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):a(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):a(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):a(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):a(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):a(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):a(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):a(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):a(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):a(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):a(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):a(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):a(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):a(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):a(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):a(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):a(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):a(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):a(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):a(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):a(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):a(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):a(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):a(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):a(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):a(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):a(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):a(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):a(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):a(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):a(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):a(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):a(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):a(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):a(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):a(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):a(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):a(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):a(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):a(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):a(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):a(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):a(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):a(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):a(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):a(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):a(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):a(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):a(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):a(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):a(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):a(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):a(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):a(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):a(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):a(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):a(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):a(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):a(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):a(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):a(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):a(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):a(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):a(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):a(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):a(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):a(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):a(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):a(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):a(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):a(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):a(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):a(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):a(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):a(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):a(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):a(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):a(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):a(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):a(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):a(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):a(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):a(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):a(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):a(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):a(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):a(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):a(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):a(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):a(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):a(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):a(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):a(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):a(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):a(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):a(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):a(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):a(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):a(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):a(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):a(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):a(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):a(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):a(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):a(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):a(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):a(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):a(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):a(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):a(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):a(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):a(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):a(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):a(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):a(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):a(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):a(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):a(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):a(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):a(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):a(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):a(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):a(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):a(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):a(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):a(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):a(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):a(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):a(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):a(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):a(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):a(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):a(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):a(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):a(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):a(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):a(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):a(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):a(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):a(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):a(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):a(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):a(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):a(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):a(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):a(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):a(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):a(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):a(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):a(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):a(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):a(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):a(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):a(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):a(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):a(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):a(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):a(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):a(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):a(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):a(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):a(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):a(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):a(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):a(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):a(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):a(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):a(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):a(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):a(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):a(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):a(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):a(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):a(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):a(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):a(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):a(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):a(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):a(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):a(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):a(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):a(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):a(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):a(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):a(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):a(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):a(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):a(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):a(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):a(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):a(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):a(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):a(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):a(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):a(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):a(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):a(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):a(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):a(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):a(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):a(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):a(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):a(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):a(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):a(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):a(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):a(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):a(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):a(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):a(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):a(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):a(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):a(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):a(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):a(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):a(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):a(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):a(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):a(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):a(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):a(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):a(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):a(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):a(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):a(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):a(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):a(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):a(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):a(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):a(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):a(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):a(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):a(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):a(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):a(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):a(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):a(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):a(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):a(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):a(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):a(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):a(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):a(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):a(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):a(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):a(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):a(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):a(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):a(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):a(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):a(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):a(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):a(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):a(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):a(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):a(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):a(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):a(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):a(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):a(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):a(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):a(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):a(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):a(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):a(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):a(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):a(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):a(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):a(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):a(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):a(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):a(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):a(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):a(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):a(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):a(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):a(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):a(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):a(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):a(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):a(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):a(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):a(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):a(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):a(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):a(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):a(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):a(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):a(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):a(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):a(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):a(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):a(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):a(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):a(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):a(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):a(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):a(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):a(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):a(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):a(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):a(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):a(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):a(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):a(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):a(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):a(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):a(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):a(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):a(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):a(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):a(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):a(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):a(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):a(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):a(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):a(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):a(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):a(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):a(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):a(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):a(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):a(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):a(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):a(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):a(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):a(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):a(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):a(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):a(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):a(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):a(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):a(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):a(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):a(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):a(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):a(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):a(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):a(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):a(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):a(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):a(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):a(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):a(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):a(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):a(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):a(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):a(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):a(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):a(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):a(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):a(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):a(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):a(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):a(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):a(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):a(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):a(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):a(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):a(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):a(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):a(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):a(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):a(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):a(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):a(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):a(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):a(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):a(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):a(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):a(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):a(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):a(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):a(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):a(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):a(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):a(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):a(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):a(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):a(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):a(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):a(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):a(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):a(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):a(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):a(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):a(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):a(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):a(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):a(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):a(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):a(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):a(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):a(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):a(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):a(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):a(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):a(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):a(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):a(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):a(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):a(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):a(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):a(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):a(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):a(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):a(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):a(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):a(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):a(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):a(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):a(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):a(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):a(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):a(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):a(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):a(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):a(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):a(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):a(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):a(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):a(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):a(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):a(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):a(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):a(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):a(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):a(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):a(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):a(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):a(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):a(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):a(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):a(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):a(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):a(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):a(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):a(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):a(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):a(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):a(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):a(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):a(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):a(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):a(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):a(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):a(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):a(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):a(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):a(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):a(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):a(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):a(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):a(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):a(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):a(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):a(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):a(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):a(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):a(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):a(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):a(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):a(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):a(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):a(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):a(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):a(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):a(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):a(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):a(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):a(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):a(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):a(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):a(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):a(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):a(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):a(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):a(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):a(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):a(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):a(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):a(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):a(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):a(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):a(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):a(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):a(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):a(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):a(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):a(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):a(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):a(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):a(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):a(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):a(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):a(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${i} not found`)}}function xd(){const i=new Map;return{emit(t,e){const n=i.get(t);if(n)for(const r of n)r(e)},subscribe(t,e){return i.has(t)?i.get(t)?.add(e):i.set(t,new Set([e])),()=>{const n=i.get(t);n&&n.delete(e)}}}}function ui(){return xd()}function Cd(i){const{createOptions:t}=i,e=ui();let n,r;function s(){n=void 0,r=void 0}let o=async()=>{},c=async h=>{r=h};const l=e.subscribe("chainChanged",h=>{r=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{n=h}),{autoConnect:async h=>{const{autoConnectBaseAccountSDK:d}=await a(async()=>{const{autoConnectBaseAccountSDK:T}=await Promise.resolve().then(()=>xo);return{autoConnectBaseAccountSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:At}),n},connect:async h=>{const{connectBaseAccountSDK:d}=await a(async()=>{const{connectBaseAccountSDK:T}=await Promise.resolve().then(()=>xo);return{connectBaseAccountSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:At}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>t,id:At,subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}function Fn(){if(!Wc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:i,hostname:t,port:e}=window.location;let n=`${i}//${t}`;e&&e!=="80"&&e!=="443"&&(n+=`:${e}`);const r=`${n}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:r,name:window.document.title||"thirdweb powered dApp",url:n}}let gr,bn;async function Zc(i){if(gr){if(i&&bn){const s=bn.chains?.map(u=>u.id)||[],o=i.chains?.map(u=>u.id)||[],c=s.length===o.length&&s.every((u,h)=>u===o[h]),l=i.appMetadata?.name===bn.appMetadata?.name;(!c||!l)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return gr}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:s}=await import("./index-BDgZ3gDE.js");return{createBaseAccountSDK:s}},__vite__mapDeps([13,14,15,16,17,18,3,4,19,20,1,2,21,22,23,6,9])),e=Fn(),r=t({appName:i?.appMetadata?.name||e.name||"thirdweb powered dApp",appLogoUrl:i?.appMetadata?.logoUrl||e.logoUrl||null,appChainIds:i?.chains?.map(s=>s.id)||[]}).getProvider();return gr=r,bn=i,r}function Qc(i){return i.id===At}function So({provider:i,address:t,client:e}){const n={address:Y(t),async sendTransaction(r){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:r.accessList,data:r.data,from:Y(t),gas:r.gas?Le(r.gas):void 0,to:r.to,value:r.value?Le(r.value):void 0}]});return ks({chainId:r.chainId,client:e,contractAddress:r.to??void 0,gasPrice:r.gasPrice,transactionHash:s,walletAddress:Y(t),walletType:At}),{transactionHash:s}},async signMessage({message:r}){if(!n.address)throw new Error("Provider not setup");const s=typeof r=="string"?$s(r):r.raw instanceof Uint8Array?ir(r.raw):r.raw,o=await i.request({method:"personal_sign",params:[s,n.address]});if(!nn(o))throw new Error("Invalid signature returned");return o},async signTypedData(r){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(r),l={EIP712Domain:xc(s),...r.types};Cc({domain:s,message:o,primaryType:c,types:l});const u=$c({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!nn(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async r=>{try{const{callParams:s,chain:o}=await Ws(r,n),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:ye(s)}`):s}},async getCallsStatus(r){try{const s=await i.request({method:"wallet_getCallsStatus",params:[r.id]});return Ks(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(r){const s=r.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Y(n.address)]});return Fs(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${At} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Xc(i,t,e,n,r){const s=So({address:i,client:r,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(h){if(h[0]){const d=So({address:Y(h[0]),client:r,provider:e});n.emit("accountChanged",d),n.emit("accountsChanged",h)}else c()}function u(h){const d=we(ct(h));n.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>el(e,h)]}async function $d(i,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const r=Y(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=i.chain&&i.chain.id===o?i.chain:we(o);return o&&i?.chain&&o!==i?.chain.id&&(await el(e,i.chain),c=i.chain),Xc(r,c,e,t,i.client)}async function kd(i,t,e){const r=(await e.request({method:"eth_accounts"}))[0];if(!r)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=i.chain&&i.chain.id===o?i.chain:we(o);return Xc(r,c,e,t,i.client)}async function el(i,t){const e=await i.request({method:"eth_chainId"});if(we(ct(e))?.id===t.id)return;const r=Le(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(s){const o=await Ms(t);s?.code===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:o.explorers?.map(c=>c.url)||[],chainId:r,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:Hs(o)}]})}}const xo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:kd,connectBaseAccountSDK:$d,getBaseAccountWebProvider:Zc,isBaseAccountSDKWallet:Qc},Symbol.toStringTag,{value:"Module"}));function Ud(i){const{createOptions:t}=i,e=ui();let n,r;function s(){n=void 0,r=void 0}let o=async()=>{},c=async h=>{r=h};const l=e.subscribe("chainChanged",h=>{r=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{n=h}),{autoConnect:async h=>{const{autoConnectCoinbaseWalletSDK:d}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:T}=await Promise.resolve().then(()=>$o);return{autoConnectCoinbaseWalletSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:_t}),n},connect:async h=>{const{connectCoinbaseWalletSDK:d}=await a(async()=>{const{connectCoinbaseWalletSDK:T}=await Promise.resolve().then(()=>$o);return{connectCoinbaseWalletSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:_t}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>t,id:_t,onConnectRequested:async()=>{if(i.onConnectRequested){const h=await i.providerFactory();return i.onConnectRequested?.(h)}},subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}async function tl(i){await i?.communicator?.waitForPopupLoaded?.()}const Nd=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:tl},Symbol.toStringTag,{value:"Module"}));let Er;async function il(i){if(!Er){let t=(await a(()=>import("./index-DIlwNfpB.js"),__vite__mapDeps([24,3,4,1,2,14,19]))).default;typeof t!="function"&&typeof t.default=="function"&&(t=t.default);const n=new t({appChainIds:i?.chains?i.chains.map(r=>r.id):void 0,appLogoUrl:i?.appMetadata?.logoUrl||Fn().logoUrl,appName:i?.appMetadata?.name||Fn().name}).makeWeb3Provider(i?.walletConfig);return Er=n,n}return Er}function Co({provider:i,address:t,client:e}){const n={address:Y(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await tl(i)},async sendTransaction(r){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:r.accessList,data:r.data,from:Y(t),gas:r.gas?Le(r.gas):void 0,to:r.to,value:r.value?Le(r.value):void 0}]});return ks({chainId:r.chainId,client:e,contractAddress:r.to??void 0,gasPrice:r.gasPrice,transactionHash:s,walletAddress:Y(t),walletType:_t}),{transactionHash:s}},async signMessage({message:r}){if(!n.address)throw new Error("Provider not setup");const s=typeof r=="string"?$s(r):r.raw instanceof Uint8Array?ir(r.raw):r.raw,o=await i.request({method:"personal_sign",params:[s,n.address]});if(!nn(o))throw new Error("Invalid signature returned");return o},async signTypedData(r){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(r),l={EIP712Domain:xc(s),...r.types};Cc({domain:s,message:o,primaryType:c,types:l});const u=$c({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!nn(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async r=>{try{const{callParams:s,chain:o}=await Ws(r,n),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:ye(s)}`):s}},async getCallsStatus(r){try{const s=await i.request({method:"wallet_getCallsStatus",params:[r.id]});return Ks(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(r){try{return await i.request({method:"wallet_getCallsStatus",params:[r.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(r){const s=r.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Y(n.address)]});return Fs(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${_t} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function nl(i,t,e,n,r){const s=Co({address:i,client:r,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(h){if(h[0]){const d=Co({address:Y(h[0]),client:r,provider:e});n.emit("accountChanged",d),n.emit("accountsChanged",h)}else c()}function u(h){const d=we(ct(h));n.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>rl(e,h)]}async function Bd(i,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const r=Y(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=i.chain&&i.chain.id===o?i.chain:we(o);return o&&i?.chain&&o!==i?.chain.id&&(await rl(e,i.chain),c=i.chain),nl(r,c,e,t,i.client)}async function Md(i,t,e){const r=(await e.request({method:"eth_accounts"}))[0];if(!r)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=i.chain&&i.chain.id===o?i.chain:we(o);return nl(r,c,e,t,i.client)}async function rl(i,t){const e=await i.request({method:"eth_chainId"});if(we(ct(e))?.id===t.id)return;const r=Le(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(s){const o=await Ms(t);s?.code===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:o.explorers?.map(c=>c.url)||[],chainId:r,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:Hs(o)}]})}}const $o=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:Md,connectCoinbaseWalletSDK:Bd,getCoinbaseWebProvider:il},Symbol.toStringTag,{value:"Module"}));async function qd(i){return zc(async()=>{const e=await(await fetch(`${rr("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":i}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${i}, please check your ecosystem wallet configuration.`);return e.authOptions?.includes("siwe")&&(e.authOptions=e.authOptions.filter(n=>n!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${i}`,cacheTime:1e3*60*5})}const vr=new Map;async function Ki(i,t,e){const n=ye({clientId:i.clientId,ecosystem:e,partialSecretKey:i.secretKey?.slice(0,5)});if(vr.has(n))return vr.get(n);const r=await t(i);return vr.set(n,r),r}function sl(i){const{createOptions:t,connectorFactory:e,ecosystem:n}=i,r=n?n.id:"inApp",s=ui();let o=t,c,l,u,h,d=null;const p=async _=>{if(n){const f=await qd(n.id),m=f?.smartAccountOptions;if(m)if(f.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:T}=f.smartAccountOptions,O=_?.chain??(T?we(T):void 0);if(!O)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:O,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:E}=await Promise.resolve().then(()=>Hr);return{autoConnectInAppWallet:E}},void 0),m=await Ki(_.client,e,n);await p();const{account:y,chain:T,adminAccount:O}=await f(_,o,m);h=_.client,c=y,l=O,u=T;try{d=await m.storage.getAuthCookie()}catch(E){console.error("Failed to retrieve auth token:",E),d=null}return Me({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:r}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:E}=await Promise.resolve().then(()=>Hr);return{connectInAppWallet:E}},void 0),m=await Ki(_.client,e,n);await p();const{account:y,chain:T,adminAccount:O}=await f(_,o,m);h=_.client,c=y,l=O,u=T;try{d=await m.storage.getAuthCookie()}catch(E){console.error("Failed to retrieve auth token:",E),d=null}return Me({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:r}),c},disconnect:async()=>{if(h&&!(await(await Ki(h,e,n)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,d=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>d,getChain(){if(u)return u=ci(u.id)||u,u},getConfig:()=>o,id:r,subscribe:s.subscribe,switchChain:async _=>{if((o?.smartAccount||o?.executionMode?.mode==="EIP4337")&&h&&c){const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:E}=await Promise.resolve().then(()=>Hr);return{autoConnectInAppWallet:E}},void 0),m=await Ki(h,e,n);await p({chain:_});const{account:y,chain:T,adminAccount:O}=await f({chain:_,client:h},o,m);l=O,c=y,u=T}else u=_;s.emit("chainChanged",_)}}}function ol(...i){const[t,e]=i,n={id:t,partnerId:e?.partnerId};return sl({connectorFactory:async r=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-CAOe_uvv.js");return{InAppWebConnector:o}},__vite__mapDeps([25,3,4,2,1,26,5,6,7,8,9,10,11,12]));return new s({client:r,ecosystem:n,storage:e?.storage})},createOptions:{auth:{...e?.auth,options:[]},partnerId:n.partnerId},ecosystem:n})}function Zr(i){return sl({connectorFactory:async t=>{const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:n}=await import("./web-connector-CAOe_uvv.js");return{InAppWebConnector:n}},__vite__mapDeps([25,3,4,2,1,26,5,6,7,8,9,10,11,12]));return new e({client:t,passkeyDomain:i?.auth?.passkeyDomain,storage:i?.storage})},createOptions:i})}function Js(i){const t=ui();let e,n,r,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-BaGjqMte.js");return{connectSmartAccount:h}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12])),[l,u]=await c(o,i);return s=o,e=l,r=u,Me({chainId:r.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-BaGjqMte.js");return{connectSmartAccount:h}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12])),[l,u]=await c(o,i);return n=o.personalAccount,s=o,e=l,r=u,Me({chainId:r.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(async()=>{const{disconnectSmartAccount:c}=await import("./index-BaGjqMte.js");return{disconnectSmartAccount:c}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12]));await o(e)}e=void 0,n=void 0,r=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>i,id:"smart",subscribe:t.subscribe,switchChain:async o=>{if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await _h(o)){const d=Us({address:i.factoryAddress||Ed(i.overrides?.entrypointAddress),chain:o,client:s.client});if(!await fh(d))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-BaGjqMte.js");return{connectSmartAccount:d}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12])),[u,h]=await l({...s,chain:o},{...i,chain:o});e=u,r=h,t.emit("accountChanged",u),t.emit("chainChanged",h)}}}function ot(...i){const[t,e]=i;switch(!0){case t==="smart":return Js(e);case(t==="embedded"||t==="inApp"):return Zr(e);case Pi(t):return ol(...i);case t===_t:{const n=e;return Ud({createOptions:n,onConnectRequested:async r=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>Nd);return{showCoinbasePopup:o}},void 0);return s(r)},providerFactory:()=>il(n)})}case t===At:{const n=e;return Cd({createOptions:n,providerFactory:()=>Zc(n)})}default:{let c=function(){r=void 0,s=void 0};const n=ui();let r,s,o,l=async()=>{};const u=n.subscribe("disconnect",()=>{c(),o?.(),u()});n.subscribe("accountChanged",_=>{r=_});let h=async()=>{throw new Error("Not implemented yet")};const d=Vo()?_=>wr(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>Uo);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:R}=await Promise.resolve().then(()=>Bo);return{autoConnectEip1193Wallet:R}},void 0),[y,T,O,E]=await m({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qr(t)});return r=y,s=T,l=O,h=E,o=n.subscribe("chainChanged",R=>{s=R}),Me({chainId:s.id,client:_.client,walletAddress:r.address,walletType:t}),r}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:R}=await import("./controller-B8Iy-6V9.js");return{autoConnectWC:R}},__vite__mapDeps([29,3,4,1,2,22,6,5,7,8,9,10,11,12])),[y,T,O,E]=await m(_,n,p.id,Kn,d);return r=y,s=T,l=O,h=E,Me({chainId:s.id,client:_.client,walletAddress:r.address,walletType:t}),r}throw new Error("Failed to auto connect")},connect:async _=>{async function f(T){const{connectWC:O}=await a(async()=>{const{connectWC:R}=await import("./controller-B8Iy-6V9.js");return{connectWC:R}},__vite__mapDeps([29,3,4,1,2,22,6,5,7,8,9,10,11,12]));let E;try{const[R,I,g,L]=await O({...T,walletConnect:{...T.walletConnect,onDisplayUri:T.walletConnect?.onDisplayUri||(async D=>{if(typeof window<"u"&&typeof document<"u")if(Vo()){const w=await Yc(t),v=w.mobile.native||w.mobile.universal;wr(v?Rd(v,D).redirect:D);return}else try{const{createQROverlay:w}=await a(async()=>{const{createQROverlay:v}=await import("./qr-overlay-CmFgwJBd.js");return{createQROverlay:v}},__vite__mapDeps([30,3,4]));E&&E.destroy(),E=w(D,{theme:T.walletConnect?.qrModalOptions?.themeMode??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{T.walletConnect?.onCancel?.()}})}catch(w){console.error("Failed to create QR overlay:",w)}})}},n,p.id,Kn,d);return E&&(E.destroy(),E=void 0),r=R,s=I,l=g,h=L,Me({chainId:s.id,client:T.client,walletAddress:r.address,walletType:t}),r}catch(R){throw E&&(E.destroy(),E=void 0),R}}if(t==="walletConnect"){const{client:T,chain:O,...E}=_;return f({chain:O,client:T,walletConnect:{...E}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:T}=await Promise.resolve().then(()=>Uo);return{injectedProvider:T}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:T}=await a(async()=>{const{connectEip1193Wallet:g}=await Promise.resolve().then(()=>Bo);return{connectEip1193Wallet:g}},void 0),[O,E,R,I]=await T({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qr(t)});return r=O,s=E,l=R,h=I,o=n.subscribe("chainChanged",g=>{s=g}),Me({chainId:s.id,client:_.client,walletAddress:r.address,walletType:t}),r}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>r,getChain(){if(s)return s=ci(s.id)||s,s},getConfig:()=>i[1],id:t,subscribe:n.subscribe,switchChain:async _=>{try{await h(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function zd(){return ot("walletConnect")}const ko=Wc()?Kh():void 0;function Ys(i){return Zs().find(e=>e.info.rdns===i)?.provider}function al(){return Zs().map(e=>e.info.rdns).map(e=>ot(e))}function jd(){if(ko)return ko}function Zs(){const i=jd()?.getProviders()||[];for(const t of i)if(t.info.rdns==="io.metamask.mobile"){t.info.rdns=Hc;break}return i}const Uo=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Zs,getInstalledWallets:al,injectedProvider:Ys},Symbol.toStringTag,{value:"Module"}));function Qr(i){const t=Ys(i);if(!t)throw new Error(`No injected provider found for wallet: "${i}"`);return t}async function cl({id:i,provider:t,emitter:e,client:n,chain:r}){let s,c=0;for(;!s?.[0]&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(p){if(console.error(p),Kd(p)?.toLowerCase()?.includes("rejected"))throw p;await new Promise(_=>setTimeout(_,500))}c++}const l=s?.[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=Y(l),h=await t.request({method:"eth_chainId"}).then(ct).catch(p=>{throw new Error("Error reading chainId from provider",p)});let d=r&&r.id===h?r:we(h);try{r&&typeof r.id<"u"&&r.id!==h&&(await hl(t,r),d=r)}catch{console.warn(`Error switching to chain ${r?.id} - defaulting to wallet chain (${h})`)}return ul({address:u,chain:d,client:n,emitter:e,id:i,provider:t})}async function ll({id:i,provider:t,emitter:e,client:n,chain:r}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=Y(o),l=await t.request({method:"eth_chainId"}).then(ct),u=r&&r.id===l?r:we(l);return ul({address:c,chain:u,client:n,emitter:e,id:i,provider:t})}function No({provider:i,address:t,client:e,id:n}){const r={address:Y(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:Le(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?Le(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?Le(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?Le(s.gas):void 0,nonce:s.nonce?Le(s.nonce):void 0,to:s.to?Y(s.to):void 0,data:s.data,value:s.value?Le(s.value):void 0,authorizationList:s.authorizationList?wh(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await i.request({method:"eth_sendTransaction",params:c});return ks({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Y(t),walletType:n}),{transactionHash:l}}catch(l){throw gh(l)&&Eh({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Y(t)}),l}},async signMessage({message:s}){if(!r.address)throw new Error("Provider not setup");const o=typeof s=="string"?$s(s):s.raw instanceof Uint8Array?ir(s.raw):s.raw;return await i.request({method:"personal_sign",params:[o,Y(r.address)]})},async signAuthorization(s){const o=kc(s);let c;try{c=await i.request({method:"eth_sign",params:[Y(r.address),o]})}catch{c=await i.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=yh(c);return{...s,...l}},async signTypedData(s){if(!i||!r.address)throw new Error("Provider not setup");const o=js(s),{domain:c,message:l,primaryType:u}=o,h={EIP712Domain:Fh({domain:c}),...o.types};Wh({domain:c,message:l,primaryType:u,types:h});const d=Hh({domain:c??{},message:l,primaryType:u,types:h});return await i.request({method:"eth_signTypedData_v4",params:[Y(r.address),d]})},async watchAsset(s){return await i.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Ws(s,r),l=await i.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:mh(o)}`):o}},async getCallsStatus(s){try{const o=await i.request({method:"wallet_getCallsStatus",params:[s.id]});return Ks(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await i.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await i.request({method:"wallet_getCapabilities",params:[Y(r.address),o?[Le(o)]:void 0]});return Fs(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${n} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return r}async function ul({provider:i,address:t,chain:e,emitter:n,client:r,id:s}){const o=No({address:t,client:r,id:s,provider:i});async function c(){i.removeListener("accountsChanged",u),i.removeListener("chainChanged",h),i.removeListener("disconnect",l);try{await Gh(()=>i.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),n.emit("disconnect",void 0)}function u(d){if(d[0]){const p=No({address:Y(d[0]),client:r,id:s,provider:i});n.emit("accountChanged",p),n.emit("accountsChanged",d)}else l()}function h(d){const p=we(ct(d));n.emit("chainChanged",p)}return i.on&&(i.on("accountsChanged",u),i.on("chainChanged",h),i.on("disconnect",l)),[o,e,l,d=>hl(i,d)]}async function hl(i,t){const e=Le(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const n=await Ms(t);await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:n.explorers?.map(r=>r.url),chainId:e,chainName:n.name,nativeCurrency:n.nativeCurrency,rpcUrls:Hs(n)}]})}}function Kd(i){return i instanceof Error?i.message:typeof i=="string"?i:typeof i=="object"&&i!==null?JSON.stringify(i):String(i)}const Bo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:ll,connectEip1193Wallet:cl,getInjectedProvider:Qr},Symbol.toStringTag,{value:"Module"}));function Fd(i){const t=i.walletId??"adapter",e=ui();let n,r,s;const o=async p=>(s=typeof i.provider=="function"?await i.provider(p):i.provider,s),c=e.subscribe("chainChanged",p=>{r=p});function l(){n=void 0,r=void 0}let u=async()=>{};const h=e.subscribe("disconnect",()=>{l(),c(),h()});e.subscribe("accountChanged",p=>{n=p});let d=async p=>{await s?.request({method:"wallet_switchEthereumChain",params:[{chainId:vh(p.id)}]})};return{autoConnect:async p=>{const[_,f,m,y]=await ll({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:p.chain?.id})});return n=_,r=f,u=m,d=y,e.emit("onConnect",p),Me({client:p.client,walletAddress:n.address,walletType:t}),n},connect:async p=>{const[_,f,m,y]=await cl({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:p.chain?.id})});return n=_,r=f,u=m,d=y,e.emit("onConnect",p),Me({client:p.client,walletAddress:n.address,walletType:t}),n},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await d(p),e.emit("chainChanged",p)}}}function Wd(i){const{chain:t,client:e,wallet:n,connectOverride:r}=i,s=nr({chain:t,client:e});return{on:n.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return(await Uc({account:c,transaction:Jr({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return bh({account:c,transaction:Jr({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=n.getAccount();if(!c)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return c.signTypedData(l)}case"eth_accounts":{const c=n.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=n.getAccount();if(c)return[c.address];const l=r?await r(n):await n.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=qn(l)?ri(l):l,h=we(u);return n.switchChain(h)}case"wallet_getCapabilities":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],h=qn(u)?ri(u):Number(u);return c.getCapabilities(h?{chainId:h}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.sendCalls)throw new Error("Wallet does not support EIP-5792");return c.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await c.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const Hd=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:Fd,toProvider:Wd},Symbol.toStringTag,{value:"Module"}));function Gd(i){const t=ui();let e=i.chain;return{autoConnect:async()=>(t.emit("onConnect",i),i.adaptedAccount),connect:async()=>(t.emit("onConnect",i),i.adaptedAccount),disconnect:async()=>{await i.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return i.adaptedAccount},getChain(){return e=ci(e.id)||e,e},getConfig(){return i},id:"adapter",subscribe:t.subscribe,switchChain:async n=>{await i.switchChain(n),e=n,t.emit("chainChanged",n)}}}async function Jd(){return(await a(async()=>{const{default:i}=await import("./wallet-infos-BHI_w6r-.js");return{default:i}},[])).default}async function hi(i,t){return Ki(i,async e=>{const{InAppWebConnector:n}=await a(async()=>{const{InAppWebConnector:r}=await import("./web-connector-CAOe_uvv.js");return{InAppWebConnector:r}},__vite__mapDeps([25,3,4,2,1,26,5,6,7,8,9,10,11,12]));return new n({client:e,ecosystem:t})},t)}async function dl(i){const{client:t,ecosystem:e}=i,r=await(await hi(t,e)).getUser();if(r.status==="Logged In, Wallet Initialized")return r}async function Yd(i){const t=await dl(i);if(t&&"email"in t.authDetails)return t.authDetails.email}async function Zd(i){const t=await dl(i);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function Qd(i){return(await hi(i.client,i.ecosystem)).preAuthenticate(i)}async function Xd(i){return(await hi(i.client,i.ecosystem)).authenticate(i)}async function ep(i){const t=await hi(i.client,i.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(i.strategy,i.mode,i.redirectUrl)}async function tp(i){return await(await hi(i.client,i.ecosystem)).linkProfile(i)}async function ip(i){return await(await hi(i.client,i.ecosystem)).unlinkProfile(i.profileToUnlink,i.allowAccountDeletion)}async function np(i){return(await hi(i.client,i.ecosystem)).getProfiles()}function rp(i){if("privateKey"in i){const t=fd(typeof i.message=="object"?i.message.raw:Vc(i.message)),e=Ns({payload:t,privateKey:i.privateKey});return Nc(e)}if("account"in i){const{message:t,account:e}=i;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function sp(i){const{privateKey:t,...e}=i;typeof e.domain?.chainId=="string"&&(e.domain.chainId=Sc(e.domain.chainId));const n=Ih(e),r=Ns({payload:n,privateKey:t});return Nc(r)}function Xr(i){const{client:t}=i,e=`0x${i.privateKey.replace(/^0x/,"")}`,n=Bs(Bc.getPublicKey(e.slice(2),!1)),r=Jh(n);return{address:Y(r),sendTransaction:async o=>{const c=nr({chain:we(o.chainId),client:t}),l=Po({privateKey:e,transaction:o});return{transactionHash:await Ah(c,l)}},signAuthorization:async o=>{const c=Ns({payload:kc(o),privateKey:e});return Th(o,{signature:c})},signMessage:async({message:o})=>rp({message:o,privateKey:e}),signTransaction:async o=>Po({privateKey:e,transaction:o}),signTypedData:async o=>sp({...o,privateKey:e})}}async function op(i){const t=Bs(Bc.utils.randomPrivateKey());return Xr({client:i.client,privateKey:t})}async function ap(i){const{address:t,client:e,chain:n}=i,r=i.tokenAddress||(n.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(r&&Y(r)!==Y(Oo)){const{getBalance:h}=await a(async()=>{const{getBalance:d}=await import("./getBalance-D6wpo61w.js");return{getBalance:d}},__vite__mapDeps([31,1,2,3,4,32]));return h({address:t,contract:Us({address:r,chain:n,client:e})})}const s=nr({chain:n,client:e}),[o,c,l,u]=await Promise.all([Uh(n),Nh(n),Bh(n),Ph(s,{address:t})]);return{chainId:n.id,decimals:c,displayValue:Oh(u,c),name:l,symbol:o,tokenAddress:r??Oo,value:u}}function cp(i){return!i||typeof i.then!="function"?Promise.resolve(i):i}function me(i,...t){try{return cp(i(...t))}catch(e){return Promise.reject(e)}}function lp(i){const t=typeof i;return i===null||t!=="object"&&t!=="function"}function up(i){const t=Object.getPrototypeOf(i);return!t||t.isPrototypeOf(Object)}function xn(i){if(lp(i))return String(i);if(up(i)||Array.isArray(i))return JSON.stringify(i);if(typeof i.toJSON=="function")return xn(i.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const es="base64:";function hp(i){return typeof i=="string"?i:es+_p(i)}function dp(i){return typeof i!="string"||!i.startsWith(es)?i:pp(i.slice(es.length))}function pp(i){return globalThis.Buffer?Buffer.from(i,"base64"):Uint8Array.from(globalThis.atob(i),t=>t.codePointAt(0))}function _p(i){return globalThis.Buffer?Buffer.from(i).toString("base64"):globalThis.btoa(String.fromCodePoint(...i))}function $e(i){return i&&i.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function fp(...i){return $e(i.join(":"))}function In(i){return i=$e(i),i?i+":":""}function mp(i,t){if(t===void 0)return!0;let e=0,n=i.indexOf(":");for(;n>-1;)e++,n=i.indexOf(":",n+1);return e<=t}function yp(i,t){return t?i.startsWith(t)&&i[i.length-1]!=="$":i[i.length-1]!=="$"}const wp="memory",gp=()=>{const i=new Map;return{name:wp,getInstance:()=>i,hasItem(t){return i.has(t)},getItem(t){return i.get(t)??null},getItemRaw(t){return i.get(t)??null},setItem(t,e){i.set(t,e)},setItemRaw(t,e){i.set(t,e)},removeItem(t){i.delete(t)},getKeys(){return[...i.keys()]},clear(){i.clear()},dispose(){i.clear()}}};function Ep(i={}){const t={mounts:{"":i.driver||gp()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const h of t.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:t.mounts[h]};return{base:"",relativeKey:u,driver:t.mounts[""]}},n=(u,h)=>t.mountpoints.filter(d=>d.startsWith(u)||h&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),r=(u,h)=>{if(t.watching){h=$e(h);for(const d of t.watchListeners)d(u,h)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await Mo(t.mounts[u],r,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,h,d)=>{const p=new Map,_=f=>{let m=p.get(f.base);return m||(m={driver:f.driver,base:f.base,items:[]},p.set(f.base,m)),m};for(const f of u){const m=typeof f=="string",y=$e(m?f:f.key),T=m?void 0:f.value,O=m||!f.options?h:{...h,...f.options},E=e(y);_(E).items.push({key:y,value:T,relativeKey:E.relativeKey,options:O})}return Promise.all([...p.values()].map(f=>d(f))).then(f=>f.flat())},l={hasItem(u,h={}){u=$e(u);const{relativeKey:d,driver:p}=e(u);return me(p.hasItem,d,h)},getItem(u,h={}){u=$e(u);const{relativeKey:d,driver:p}=e(u);return me(p.getItem,d,h).then(_=>vn(_))},getItems(u,h={}){return c(u,h,d=>d.driver.getItems?me(d.driver.getItems,d.items.map(p=>({key:p.relativeKey,options:p.options})),h).then(p=>p.map(_=>({key:fp(d.base,_.key),value:vn(_.value)}))):Promise.all(d.items.map(p=>me(d.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:vn(_)})))))},getItemRaw(u,h={}){u=$e(u);const{relativeKey:d,driver:p}=e(u);return p.getItemRaw?me(p.getItemRaw,d,h):me(p.getItem,d,h).then(_=>dp(_))},async setItem(u,h,d={}){if(h===void 0)return l.removeItem(u);u=$e(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await me(_.setItem,p,xn(h),d),_.watch||r("update",u))},async setItems(u,h){await c(u,h,async d=>{if(d.driver.setItems)return me(d.driver.setItems,d.items.map(p=>({key:p.relativeKey,value:xn(p.value),options:p.options})),h);d.driver.setItem&&await Promise.all(d.items.map(p=>me(d.driver.setItem,p.relativeKey,xn(p.value),p.options)))})},async setItemRaw(u,h,d={}){if(h===void 0)return l.removeItem(u,d);u=$e(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await me(_.setItemRaw,p,h,d);else if(_.setItem)await me(_.setItem,p,hp(h),d);else return;_.watch||r("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=$e(u);const{relativeKey:d,driver:p}=e(u);p.removeItem&&(await me(p.removeItem,d,h),(h.removeMeta||h.removeMata)&&await me(p.removeItem,d+"$",h),p.watch||r("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=$e(u);const{relativeKey:d,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await me(p.getMeta,d,h)),!h.nativeOnly){const f=await me(p.getItem,d+"$",h).then(m=>vn(m));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(_,f))}return _},setMeta(u,h,d={}){return this.setItem(u+"$",h,d)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){u=In(u);const d=n(u,!0);let p=[];const _=[];let f=!0;for(const y of d){y.driver.flags?.maxDepth||(f=!1);const T=await me(y.driver.getKeys,y.relativeBase,h);for(const O of T){const E=y.mountpoint+$e(O);p.some(R=>E.startsWith(R))||_.push(E)}p=[y.mountpoint,...p.filter(O=>!O.startsWith(y.mountpoint))]}const m=h.maxDepth!==void 0&&!f;return _.filter(y=>(!m||mp(y,h.maxDepth))&&yp(y,u))},async clear(u,h={}){u=In(u),await Promise.all(n(u,!1).map(async d=>{if(d.driver.clear)return me(d.driver.clear,d.relativeBase,h);if(d.driver.removeItem){const p=await d.driver.getKeys(d.relativeBase||"",h);return Promise.all(p.map(_=>d.driver.removeItem(_,h)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>qo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(h=>h!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,h){if(u=In(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((d,p)=>p.length-d.length)),t.mounts[u]=h,t.watching&&Promise.resolve(Mo(h,r,u)).then(d=>{t.unwatch[u]=d}).catch(console.error),l},async unmount(u,h=!0){u=In(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&(t.unwatch[u]?.(),delete t.unwatch[u]),h&&await qo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(d=>d!==u),delete t.mounts[u])},getMount(u=""){u=$e(u)+":";const h=e(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=$e(u),n(u,h.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,h={})=>l.getKeys(u,h),get:(u,h={})=>l.getItem(u,h),set:(u,h,d={})=>l.setItem(u,h,d),has:(u,h={})=>l.hasItem(u,h),del:(u,h={})=>l.removeItem(u,h),remove:(u,h={})=>l.removeItem(u,h)};return l}function Mo(i,t,e){return i.watch?i.watch((n,r)=>t(n,e+r)):()=>{}}async function qo(i){typeof i.dispose=="function"&&await me(i.dispose)}const vp="idb-keyval";var bp=(i={})=>{const t=i.base&&i.base.length>0?`${i.base}:`:"",e=r=>t+r;let n;return i.dbName&&i.storeName&&(n=nd(i.dbName,i.storeName)),{name:vp,options:i,async hasItem(r){return!(typeof await Do(e(r),n)>"u")},async getItem(r){return await Do(e(r),n)??null},setItem(r,s){return ad(e(r),s,n)},removeItem(r){return od(e(r),n)},getKeys(){return sd(n)},clear(){return rd(n)}}};const Ip="WALLET_CONNECT_V2_INDEXED_DB",Tp="keyvaluestorage";let Ap=class{constructor(){this.indexedDb=Ep({driver:bp({dbName:Ip,storeName:Tp})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,rn(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Cn={exports:{}};(function(){let i;function t(){}i=t,i.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},i.prototype.setItem=function(e,n){this[e]=String(n)},i.prototype.removeItem=function(e){delete this[e]},i.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(n){e[n]=void 0,delete e[n]})},i.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},i.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof br<"u"&&br.localStorage?Cn.exports=br.localStorage:typeof window<"u"&&window.localStorage?Cn.exports=window.localStorage:Cn.exports=new t})();function Pp(i){var t;return[i[0],zn((t=i[1])!=null?t:"")]}let Op=class{constructor(){this.localStorage=Cn.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Pp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return zn(e)}async setItem(t,e){this.localStorage.setItem(t,rn(e))}async removeItem(t){this.localStorage.removeItem(t)}};const Rp="wc_storage_version",zo=1,Lp=async(i,t,e)=>{const n=Rp,r=await t.getItem(n);if(r&&r>=zo){e(t);return}const s=await i.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const c=s.shift();if(!c)continue;const l=c.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await i.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(n,zo),e(t),Dp(i,o)},Dp=async(i,t)=>{t.length&&t.forEach(async e=>{await i.removeItem(e)})};let Vp=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new Op;this.storage=t;try{const e=new Ap;Lp(t,e,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var Ir,jo;function Sp(){if(jo)return Ir;jo=1;const i=cd();Ir=r;const t=I().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function n(g,L){return Array.isArray(g)?g.filter(function(w){return w!=="!stdSerializers.err"}):g===!0?Object.keys(L):!1}function r(g){g=g||{},g.browser=g.browser||{};const L=g.browser.transmit;if(L&&typeof L.send!="function")throw Error("pino: transmit option must have a send function");const D=g.browser.write||t;g.browser.write&&(g.browser.asObject=!0);const w=g.serializers||{},v=n(g.browser.serialize,w);let b=g.browser.serialize;Array.isArray(g.browser.serialize)&&g.browser.serialize.indexOf("!stdSerializers.err")>-1&&(b=!1);const A=["error","fatal","warn","info","debug","trace"];typeof D=="function"&&(D.error=D.fatal=D.warn=D.info=D.debug=D.trace=D),g.enabled===!1&&(g.level="silent");const V=g.level||"info",P=Object.create(D);P.log||(P.log=y),Object.defineProperty(P,"levelVal",{get:$}),Object.defineProperty(P,"level",{get:k,set:M});const S={transmit:L,serialize:v,asObject:g.browser.asObject,levels:A,timestamp:_(g)};P.levels=r.levels,P.level=V,P.setMaxListeners=P.getMaxListeners=P.emit=P.addListener=P.on=P.prependListener=P.once=P.prependOnceListener=P.removeListener=P.removeAllListeners=P.listeners=P.listenerCount=P.eventNames=P.write=P.flush=y,P.serializers=w,P._serialize=v,P._stdErrSerialize=b,P.child=C,L&&(P._logEvent=d());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(U){if(U!=="silent"&&!this.levels.values[U])throw Error("unknown level "+U);this._level=U,s(S,P,"error","log"),s(S,P,"fatal","error"),s(S,P,"warn","error"),s(S,P,"info","log"),s(S,P,"debug","log"),s(S,P,"trace","log")}function C(U,z){if(!U)throw new Error("missing bindings for child Pino");z=z||{},v&&U.serializers&&(z.serializers=U.serializers);const j=z.serializers;if(v&&j){var K=Object.assign({},w,j),F=g.browser.serialize===!0?Object.keys(K):v;delete U.serializers,l([U],F,K,this._stdErrSerialize)}function W(H){this._childLevel=(H._childLevel|0)+1,this.error=u(H,U,"error"),this.fatal=u(H,U,"fatal"),this.warn=u(H,U,"warn"),this.info=u(H,U,"info"),this.debug=u(H,U,"debug"),this.trace=u(H,U,"trace"),K&&(this.serializers=K,this._serialize=F),L&&(this._logEvent=d([].concat(H._logEvent.bindings,U)))}return W.prototype=this,new W(this)}return P}r.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},r.stdSerializers=e,r.stdTimeFunctions=Object.assign({},{nullTime:T,epochTime:O,unixTime:E,isoTime:R});function s(g,L,D,w){const v=Object.getPrototypeOf(L);L[D]=L.levelVal>L.levels.values[D]?y:v[D]?v[D]:t[D]||t[w]||y,o(g,L,D)}function o(g,L,D){!g.transmit&&L[D]===y||(L[D]=(function(w){return function(){const b=g.timestamp(),A=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var P=0;P<A.length;P++)A[P]=arguments[P];if(g.serialize&&!g.asObject&&l(A,this._serialize,this.serializers,this._stdErrSerialize),g.asObject?w.call(V,c(this,D,A,b)):w.apply(V,A),g.transmit){const S=g.transmit.level||L.level,$=r.levels.values[S],k=r.levels.values[D];if(k<$)return;h(this,{ts:b,methodLevel:D,methodValue:k,transmitValue:r.levels.values[g.transmit.level||L.level],send:g.transmit.send,val:L.levelVal},A)}}})(L[D]))}function c(g,L,D,w){g._serialize&&l(D,g._serialize,g.serializers,g._stdErrSerialize);const v=D.slice();let b=v[0];const A={};w&&(A.time=w),A.level=r.levels.values[L];let V=(g._childLevel|0)+1;if(V<1&&(V=1),b!==null&&typeof b=="object"){for(;V--&&typeof v[0]=="object";)Object.assign(A,v.shift());b=v.length?i(v.shift(),v):void 0}else typeof b=="string"&&(b=i(v.shift(),v));return b!==void 0&&(A.msg=b),A}function l(g,L,D,w){for(const v in g)if(w&&g[v]instanceof Error)g[v]=r.stdSerializers.err(g[v]);else if(typeof g[v]=="object"&&!Array.isArray(g[v]))for(const b in g[v])L&&L.indexOf(b)>-1&&b in D&&(g[v][b]=D[b](g[v][b]))}function u(g,L,D){return function(){const w=new Array(1+arguments.length);w[0]=L;for(var v=1;v<w.length;v++)w[v]=arguments[v-1];return g[D].apply(this,w)}}function h(g,L,D){const w=L.send,v=L.ts,b=L.methodLevel,A=L.methodValue,V=L.val,P=g._logEvent.bindings;l(D,g._serialize||Object.keys(g.serializers),g.serializers,g._stdErrSerialize===void 0?!0:g._stdErrSerialize),g._logEvent.ts=v,g._logEvent.messages=D.filter(function(S){return P.indexOf(S)===-1}),g._logEvent.level.label=b,g._logEvent.level.value=A,w(b,g._logEvent,V),g._logEvent=d(P)}function d(g){return{ts:0,messages:[],bindings:g||[],level:{label:"",value:0}}}function p(g){const L={type:g.constructor.name,msg:g.message,stack:g.stack};for(const D in g)L[D]===void 0&&(L[D]=g[D]);return L}function _(g){return typeof g.timestamp=="function"?g.timestamp:g.timestamp===!1?T:O}function f(){return{}}function m(g){return g}function y(){}function T(){return!1}function O(){return Date.now()}function E(){return Math.round(Date.now()/1e3)}function R(){return new Date(Date.now()).toISOString()}function I(){function g(L){return typeof L<"u"&&L}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return g(self)||g(window)||g(this)||{}}}return Ir}var gi=Sp();const or=zh(gi),xp={level:"info"},fn="custom_context",Qs=1e3*1024;let Cp=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},Ko=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new Cp(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class pl{constructor(t,e=Qs){this.level=t??"error",this.levelValue=gi.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Ko(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===gi.levels.values.error?console.error(t):e===gi.levels.values.warn?console.warn(t):e===gi.levels.values.debug?console.debug(t):e===gi.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(rn({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new Ko(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(rn({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let $p=class{constructor(t,e=Qs){this.baseChunkLogger=new pl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},kp=class{constructor(t,e=Qs){this.baseChunkLogger=new pl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var Up=Object.defineProperty,Np=Object.defineProperties,Bp=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertySymbols,Mp=Object.prototype.hasOwnProperty,qp=Object.prototype.propertyIsEnumerable,Wo=(i,t,e)=>t in i?Up(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wn=(i,t)=>{for(var e in t||(t={}))Mp.call(t,e)&&Wo(i,e,t[e]);if(Fo)for(var e of Fo(t))qp.call(t,e)&&Wo(i,e,t[e]);return i},Hn=(i,t)=>Np(i,Bp(t));function Xs(i){return Hn(Wn({},i),{level:i?.level||xp.level})}function zp(i,t=fn){return i[t]||""}function jp(i,t,e=fn){return i[e]=t,i}function je(i,t=fn){let e="";return typeof i.bindings>"u"?e=zp(i,t):e=i.bindings().context||"",e}function Kp(i,t,e=fn){const n=je(i,e);return n.trim()?`${n}/${t}`:t}function xe(i,t,e=fn){const n=Kp(i,t,e),r=i.child({context:n});return jp(r,n,e)}function Fp(i){var t,e;const n=new $p((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:or(Hn(Wn({},i.opts),{level:"trace",browser:Hn(Wn({},(e=i.opts)==null?void 0:e.browser),{write:r=>n.write(r)})})),chunkLoggerController:n}}function Wp(i){var t;const e=new kp((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:or(Hn(Wn({},i.opts),{level:"trace"}),e),chunkLoggerController:e}}function Hp(i){return typeof i.loggerOverride<"u"&&typeof i.loggerOverride!="string"?{logger:i.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Fp(i):Wp(i)}var Gp=Object.defineProperty,Jp=(i,t,e)=>t in i?Gp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ho=(i,t,e)=>Jp(i,typeof t!="symbol"?t+"":t,e);class Yp extends Ti{constructor(t){super(),this.opts=t,Ho(this,"protocol","wc"),Ho(this,"version",2)}}var Zp=Object.defineProperty,Qp=(i,t,e)=>t in i?Zp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xp=(i,t,e)=>Qp(i,t+"",e);class e_ extends Ti{constructor(t,e){super(),this.core=t,this.logger=e,Xp(this,"records",new Map)}}class t_{constructor(t,e){this.logger=t,this.core=e}}class i_ extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}}let n_=class extends Ti{constructor(t){super()}},r_=class{constructor(t,e,n,r){this.core=t,this.logger=e,this.name=n}},s_=class extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}};class o_ extends Ti{constructor(t,e){super(),this.core=t,this.logger=e}}let a_=class{constructor(t,e,n){this.core=t,this.logger=e,this.store=n}},c_=class{constructor(t,e){this.projectId=t,this.logger=e}},l_=class{constructor(t,e,n){this.core=t,this.logger=e,this.telemetryEnabled=n}};var u_=Object.defineProperty,h_=(i,t,e)=>t in i?u_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Go=(i,t,e)=>h_(i,typeof t!="symbol"?t+"":t,e);let d_=class{constructor(t){this.opts=t,Go(this,"protocol","wc"),Go(this,"version",2)}},p_=class{constructor(t){this.client=t}};function sn(i,{strict:t=!0}={}){return!i||typeof i!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(i):i.startsWith("0x")}function ts(i){return sn(i,{strict:!1})?Math.ceil((i.length-2)/2):i.length}const _l="2.31.0";let Tr={getDocsUrl:({docsBaseUrl:i,docsPath:t="",docsSlug:e})=>t?`${i??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${_l}`};class si extends Error{constructor(t,e={}){const n=e.cause instanceof si?e.cause.details:e.cause?.message?e.cause.message:e.details,r=e.cause instanceof si&&e.cause.docsPath||e.docsPath,s=Tr.getDocsUrl?.({...e,docsPath:r}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...Tr.version?[`Version: ${Tr.version}`]:[]].join(`
4
- `);super(o,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=r,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=_l}walk(t){return fl(this,t)}}function fl(i,t){return t?.(i)?i:i&&typeof i=="object"&&"cause"in i&&i.cause!==void 0?fl(i.cause,t):t?null:i}class ml extends si{constructor({size:t,targetSize:e,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Oi(i,{dir:t,size:e=32}={}){return typeof i=="string"?__(i,{dir:t,size:e}):f_(i,{dir:t,size:e})}function __(i,{dir:t,size:e=32}={}){if(e===null)return i;const n=i.replace("0x","");if(n.length>e*2)throw new ml({size:Math.ceil(n.length/2),targetSize:e,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function f_(i,{dir:t,size:e=32}={}){if(e===null)return i;if(i.length>e)throw new ml({size:i.length,targetSize:e,type:"bytes"});const n=new Uint8Array(e);for(let r=0;r<e;r++){const s=t==="right";n[s?r:e-r-1]=i[s?r:i.length-r-1]}return n}class m_ extends si{constructor({max:t,min:e,signed:n,size:r,value:s}){super(`Number "${s}" is not in safe ${r?`${r*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class y_ extends si{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Ri(i,{size:t}){if(ts(i)>t)throw new y_({givenSize:ts(i),maxSize:t})}function is(i,t={}){const{signed:e}=t;t.size&&Ri(i,{size:t.size});const n=BigInt(i);if(!e)return n;const r=(i.length-2)/2,s=(1n<<BigInt(r)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(r*2,"f")}`)-1n}function w_(i,t={}){return Number(is(i,t))}const g_=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function ns(i,t={}){return typeof i=="number"||typeof i=="bigint"?wl(i,t):typeof i=="string"?b_(i,t):typeof i=="boolean"?E_(i,t):yl(i,t)}function E_(i,t={}){const e=`0x${Number(i)}`;return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}function yl(i,t={}){let e="";for(let r=0;r<i.length;r++)e+=g_[i[r]];const n=`0x${e}`;return typeof t.size=="number"?(Ri(n,{size:t.size}),Oi(n,{dir:"right",size:t.size})):n}function wl(i,t={}){const{signed:e,size:n}=t,r=BigInt(i);let s;n?e?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof i=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&r>s||r<o){const l=typeof i=="bigint"?"n":"";throw new m_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:n,value:`${i}${l}`})}const c=`0x${(e&&r<0?(1n<<BigInt(n*8))+BigInt(r):r).toString(16)}`;return n?Oi(c,{size:n}):c}const v_=new TextEncoder;function b_(i,t={}){const e=v_.encode(i);return yl(e,t)}const I_=new TextEncoder;function T_(i,t={}){return typeof i=="number"||typeof i=="bigint"?P_(i,t):typeof i=="boolean"?A_(i,t):sn(i)?gl(i,t):El(i,t)}function A_(i,t={}){const e=new Uint8Array(1);return e[0]=Number(i),typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}const gt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Jo(i){if(i>=gt.zero&&i<=gt.nine)return i-gt.zero;if(i>=gt.A&&i<=gt.F)return i-(gt.A-10);if(i>=gt.a&&i<=gt.f)return i-(gt.a-10)}function gl(i,t={}){let e=i;t.size&&(Ri(e,{size:t.size}),e=Oi(e,{dir:"right",size:t.size}));let n=e.slice(2);n.length%2&&(n=`0${n}`);const r=n.length/2,s=new Uint8Array(r);for(let o=0,c=0;o<r;o++){const l=Jo(n.charCodeAt(c++)),u=Jo(n.charCodeAt(c++));if(l===void 0||u===void 0)throw new si(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);s[o]=l*16+u}return s}function P_(i,t){const e=wl(i,t);return gl(e)}function El(i,t={}){const e=I_.encode(i);return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{dir:"right",size:t.size})):e}const Tn=BigInt(2**32-1),Yo=BigInt(32);function O_(i,t=!1){return t?{h:Number(i&Tn),l:Number(i>>Yo&Tn)}:{h:Number(i>>Yo&Tn)|0,l:Number(i&Tn)|0}}function R_(i,t=!1){const e=i.length;let n=new Uint32Array(e),r=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=O_(i[s],t);[n[s],r[s]]=[o,c]}return[n,r]}const L_=(i,t,e)=>i<<e|t>>>32-e,D_=(i,t,e)=>t<<e|i>>>32-e,V_=(i,t,e)=>t<<e-32|i>>>64-e,S_=(i,t,e)=>i<<e-32|t>>>64-e,pi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function x_(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Gn(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function on(i,...t){if(!x_(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function xT(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Gn(i.outputLen),Gn(i.blockLen)}function Zo(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function C_(i,t){on(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function $_(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function vl(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function CT(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function $T(i,t){return i<<32-t|i>>>t}const k_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function U_(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}function N_(i){for(let t=0;t<i.length;t++)i[t]=U_(i[t]);return i}const Qo=k_?i=>i:N_;function B_(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function bl(i){return typeof i=="string"&&(i=B_(i)),on(i),i}function kT(...i){let t=0;for(let n=0;n<i.length;n++){const r=i[n];on(r),t+=r.length}const e=new Uint8Array(t);for(let n=0,r=0;n<i.length;n++){const s=i[n];e.set(s,r),r+=s.length}return e}class M_{}function q_(i){const t=n=>i().update(bl(n)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function UT(i=32){if(pi&&typeof pi.getRandomValues=="function")return pi.getRandomValues(new Uint8Array(i));if(pi&&typeof pi.randomBytes=="function")return Uint8Array.from(pi.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const z_=BigInt(0),xi=BigInt(1),j_=BigInt(2),K_=BigInt(7),F_=BigInt(256),W_=BigInt(113),Il=[],Tl=[],Al=[];for(let i=0,t=xi,e=1,n=0;i<24;i++){[e,n]=[n,(2*e+3*n)%5],Il.push(2*(5*n+e)),Tl.push((i+1)*(i+2)/2%64);let r=z_;for(let s=0;s<7;s++)t=(t<<xi^(t>>K_)*W_)%F_,t&j_&&(r^=xi<<(xi<<BigInt(s))-xi);Al.push(r)}const Pl=R_(Al,!0),H_=Pl[0],G_=Pl[1],Xo=(i,t,e)=>e>32?V_(i,t,e):L_(i,t,e),ea=(i,t,e)=>e>32?S_(i,t,e):D_(i,t,e);function J_(i,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=Xo(u,h,1)^e[c],p=ea(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let r=i[2],s=i[3];for(let o=0;o<24;o++){const c=Tl[o],l=Xo(r,s,c),u=ea(r,s,c),h=Il[o];r=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=H_[n],i[1]^=G_[n]}vl(e)}class eo extends M_{constructor(t,e,n,r=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=s,Gn(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$_(this.state)}clone(){return this._cloneInto()}keccak(){Qo(this.state32),J_(this.state32,this.rounds),Qo(this.state32),this.posOut=0,this.pos=0}update(t){Zo(this),t=bl(t),on(t);const{blockLen:e,state:n}=this,r=t.length;for(let s=0;s<r;){const o=Math.min(e-this.pos,r-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,(e&128)!==0&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){Zo(this,!1),on(t),this.finish();const e=this.state,{blockLen:n}=this;for(let r=0,s=t.length;r<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Gn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(C_(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,vl(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:s,enableXOF:o}=this;return t||(t=new eo(e,n,r,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Y_=(i,t,e)=>q_(()=>new eo(t,i,e)),Z_=Y_(1,136,256/8);function Ol(i,t){const e=t||"hex",n=Z_(sn(i,{strict:!1})?T_(i):i);return e==="bytes"?n:ns(n)}class Q_ extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const Ar=new Q_(8192);function X_(i,t){if(Ar.has(`${i}.${t}`))return Ar.get(`${i}.${t}`);const e=i.substring(2).toLowerCase(),n=Ol(El(e),"bytes"),r=e.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&r[o]&&(r[o]=r[o].toUpperCase()),(n[o>>1]&15)>=8&&r[o+1]&&(r[o+1]=r[o+1].toUpperCase());const s=`0x${r.join("")}`;return Ar.set(`${i}.${t}`,s),s}function ef(i){const t=Ol(`0x${i.substring(4)}`).substring(26);return X_(`0x${t}`)}async function tf({hash:i,signature:t}){const e=sn(i)?i:ns(i),{secp256k1:n}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-Rk5k9i7o.js");return{secp256k1:o}},__vite__mapDeps([33,1,2,3,4,5,6,7,8,9,10,11,12]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:h,v:d,yParity:p}=t,_=Number(p??d),f=ta(_);return new n.Signature(is(u),is(h)).addRecoveryBit(f)}const o=sn(t)?t:ns(t);if(ts(o)!==65)throw new Error("invalid signature length");const c=w_(`0x${o.slice(130)}`),l=ta(c);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function ta(i){if(i===0||i===1)return i;if(i===27)return 0;if(i===28)return 1;throw new Error("Invalid yParityOrV value")}async function nf({hash:i,signature:t}){return ef(await tf({hash:i,signature:t}))}function rf(i){const t=i.length;let e=0,n=0;for(;n<t;){let r=i.charCodeAt(n++);if((r&4294967168)===0){e++;continue}else if((r&4294965248)===0)e+=2;else{if(r>=55296&&r<=56319&&n<t){const s=i.charCodeAt(n);(s&64512)===56320&&(++n,r=((r&1023)<<10)+(s&1023)+65536)}(r&4294901760)===0?e+=3:e+=4}}return e}function sf(i,t,e){const n=i.length;let r=e,s=0;for(;s<n;){let o=i.charCodeAt(s++);if((o&4294967168)===0){t[r++]=o;continue}else if((o&4294965248)===0)t[r++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<n){const c=i.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}(o&4294901760)===0?(t[r++]=o>>12&15|224,t[r++]=o>>6&63|128):(t[r++]=o>>18&7|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128)}t[r++]=o&63|128}}const of=new TextEncoder,af=50;function cf(i,t,e){of.encodeInto(i,t.subarray(e))}function lf(i,t,e){i.length>af?cf(i,t,e):sf(i,t,e)}const uf=4096;function Rl(i,t,e){let n=t;const r=n+e,s=[];let o="";for(;n<r;){const c=i[n++];if((c&128)===0)s.push(c);else if((c&224)===192){const l=i[n++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=i[n++]&63,u=i[n++]&63;s.push((c&31)<<12|l<<6|u)}else if((c&248)===240){const l=i[n++]&63,u=i[n++]&63,h=i[n++]&63;let d=(c&7)<<18|l<<12|u<<6|h;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(c);s.length>=uf&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const hf=new TextDecoder,df=200;function pf(i,t,e){const n=i.subarray(t,t+e);return hf.decode(n)}function _f(i,t,e){return e>df?pf(i,t,e):Rl(i,t,e)}class An{constructor(t,e){this.type=t,this.data=e}}class We extends Error{constructor(t){super(t);const e=Object.create(We.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:We.name})}}const Ci=4294967295;function ff(i,t,e){const n=e/4294967296,r=e;i.setUint32(t,n),i.setUint32(t+4,r)}function Ll(i,t,e){const n=Math.floor(e/4294967296),r=e;i.setUint32(t,n),i.setUint32(t+4,r)}function Dl(i,t){const e=i.getInt32(t),n=i.getUint32(t+4);return e*4294967296+n}function mf(i,t){const e=i.getUint32(t),n=i.getUint32(t+4);return e*4294967296+n}const yf=-1,wf=4294967296-1,gf=17179869184-1;function Ef({sec:i,nsec:t}){if(i>=0&&t>=0&&i<=gf)if(t===0&&i<=wf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,i),e}else{const e=i/4294967296,n=i&4294967295,r=new Uint8Array(8),s=new DataView(r.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,n),r}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Ll(n,4,i),e}}function vf(i){const t=i.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,r=Math.floor(n/1e9);return{sec:e+r,nsec:n-r*1e9}}function bf(i){if(i instanceof Date){const t=vf(i);return Ef(t)}else return null}function If(i){const t=new DataView(i.buffer,i.byteOffset,i.byteLength);switch(i.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),r=(e&3)*4294967296+n,s=e>>>2;return{sec:r,nsec:s}}case 12:{const e=Dl(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new We(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${i.length}`)}}function Tf(i){const t=If(i);return new Date(t.sec*1e3+t.nsec/1e6)}const Af={type:yf,encode:bf,decode:Tf};class Jn{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Af)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const r=-1-t;this.builtInEncoders[r]=e,this.builtInDecoders[r]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const r=this.builtInEncoders[n];if(r!=null){const s=r(t,e);if(s!=null){const o=-1-n;return new An(o,s)}}}for(let n=0;n<this.encoders.length;n++){const r=this.encoders[n];if(r!=null){const s=r(t,e);if(s!=null){const o=n;return new An(o,s)}}}return t instanceof An?t:null}decode(t,e,n){const r=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return r?r(t,e,n):new An(e,t)}}Jn.defaultCodec=new Jn;function Pf(i){return i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer}function rs(i){return i instanceof Uint8Array?i:ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Pf(i)?new Uint8Array(i):Uint8Array.from(i)}const Of=100,Rf=2048;class to{constructor(t){this.entered=!1,this.extensionCodec=t?.extensionCodec??Jn.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.maxDepth=t?.maxDepth??Of,this.initialBufferSize=t?.initialBufferSize??Rf,this.sortKeys=t?.sortKeys??!1,this.forceFloat32=t?.forceFloat32??!1,this.ignoreUndefined=t?.ignoreUndefined??!1,this.forceIntegerToFloat=t?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new to({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),n=new Uint8Array(e),r=new DataView(e);n.set(this.bytes),this.view=r,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const n=rf(t);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),lf(t,this.bytes,this.pos),this.pos+=n}encodeObject(t,e){const n=this.extensionCodec.tryToEncode(t,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const n=rs(t);this.writeU8a(n)}encodeArray(t,e){const n=t.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(const r of t)this.doEncode(r,e+1)}countWithoutUndefined(t,e){let n=0;for(const r of e)t[r]!==void 0&&n++;return n}encodeMap(t,e){const n=Object.keys(t);this.sortKeys&&n.sort();const r=this.ignoreUndefined?this.countWithoutUndefined(t,n):n.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else if(r<4294967296)this.writeU8(223),this.writeU32(r);else throw new Error(`Too large map object: ${r}`);for(const s of n){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const n=t.data(this.pos+6),r=n.length;if(r>=4294967296)throw new Error(`Too large extension object: ${r}`);this.writeU8(201),this.writeU32(r),this.writeI8(t.type),this.writeU8a(n);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),ff(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),Ll(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function Lf(i,t){return new to(t).encodeSharedRef(i)}function Pr(i){return`${i<0?"-":""}0x${Math.abs(i).toString(16).padStart(2,"0")}`}const Df=16,Vf=16;class Sf{constructor(t=Df,e=Vf){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const r=this.caches[n-1];e:for(const s of r){const o=s.bytes;for(let c=0;c<n;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const n=this.caches[t.length-1],r={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)}decode(t,e,n){const r=this.find(t,e,n);if(r!=null)return this.hit++,r;this.miss++;const s=Rl(t,e,n),o=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(o,s),s}}const ss="array",Ji="map_key",Vl="map_value",xf=i=>{if(typeof i=="string"||typeof i=="number")return i;throw new We("The type of key must be string or number but "+typeof i)};class Cf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=ss,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Ji,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===ss){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===Ji||t.type===Vl){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const $i=-1,io=new DataView(new ArrayBuffer(0)),$f=new Uint8Array(io.buffer);try{io.getInt8(0)}catch(i){if(!(i instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),kf=new Sf;class no{constructor(t){this.totalPos=0,this.pos=0,this.view=io,this.bytes=$f,this.headByte=$i,this.stack=new Cf,this.entered=!1,this.extensionCodec=t?.extensionCodec??Jn.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Ci,this.maxBinLength=t?.maxBinLength??Ci,this.maxArrayLength=t?.maxArrayLength??Ci,this.maxMapLength=t?.maxMapLength??Ci,this.maxExtLength=t?.maxExtLength??Ci,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:kf,this.mapKeyConverter=t?.mapKeyConverter??xf}clone(){return new no({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=$i,this.stack.reset()}setBuffer(t){const e=rs(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===$i&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=rs(t),r=new Uint8Array(e.length+n.length);r.set(e),r.set(n,e.length),this.setBuffer(r)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:r,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${Pr(r)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,r=-1;for await(const s of t){if(e&&r===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--r!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const r=t-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else e={}}else if(t<160){const r=t-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else e=[]}else{const r=t-160;e=this.decodeString(r,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const r=this.lookU8();e=this.decodeString(r,1)}else if(t===218){const r=this.lookU16();e=this.decodeString(r,2)}else if(t===219){const r=this.lookU32();e=this.decodeString(r,4)}else if(t===220){const r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else e=[]}else if(t===221){const r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else e=[]}else if(t===222){const r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else e={}}else if(t===223){const r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else e={}}else if(t===196){const r=this.lookU8();e=this.decodeBinary(r,1)}else if(t===197){const r=this.lookU16();e=this.decodeBinary(r,2)}else if(t===198){const r=this.lookU32();e=this.decodeBinary(r,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const r=this.lookU8();e=this.decodeExtension(r,1)}else if(t===200){const r=this.lookU16();e=this.decodeExtension(r,2)}else if(t===201){const r=this.lookU32();e=this.decodeExtension(r,4)}else throw new We(`Unrecognized type byte: ${Pr(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const r=n.top();if(r.type===ss)if(r.array[r.position]=e,r.position++,r.position===r.size)e=r.array,n.release(r);else continue e;else if(r.type===Ji){if(e==="__proto__")throw new We("The key __proto__ is not allowed");r.key=this.mapKeyConverter(e),r.type=Vl;continue e}else if(r.map[r.key]=e,r.readCount++,r.readCount===r.size)e=r.map,n.release(r);else{r.key=null,r.type=Ji;continue e}}return e}}readHeadByte(){return this.headByte===$i&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=$i}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new We(`Unrecognized array type byte: ${Pr(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new We(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new We(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new We(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let r;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?r=this.keyDecoder.decode(this.bytes,n,t):r=_f(this.bytes,n,t),this.pos+=e+t,r}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ji:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new We(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,r=this.bytes.subarray(n,n+t);return this.pos+=e+t,r}decodeExtension(t,e){if(t>this.maxExtLength)throw new We(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),r=this.decodeBinary(t,e+1);return this.extensionCodec.decode(r,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=mf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Dl(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Uf(i,t){return new no(t).decode(i)}var Nf={};const Bf=":";function $n(i){const[t,e]=i.split(Bf);return{namespace:t,reference:e}}function Sl(i,t){return i.includes(":")?[i]:t.chains||[]}var Mf=Object.defineProperty,qf=Object.defineProperties,zf=Object.getOwnPropertyDescriptors,na=Object.getOwnPropertySymbols,jf=Object.prototype.hasOwnProperty,Kf=Object.prototype.propertyIsEnumerable,os=(i,t,e)=>t in i?Mf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ra=(i,t)=>{for(var e in t||(t={}))jf.call(t,e)&&os(i,e,t[e]);if(na)for(var e of na(t))Kf.call(t,e)&&os(i,e,t[e]);return i},Ff=(i,t)=>qf(i,zf(t)),sa=(i,t,e)=>os(i,typeof t!="symbol"?t+"":t,e);const Wf="ReactNative",He={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Hf="js";function Yn(){return typeof jt<"u"&&typeof jt.versions<"u"&&typeof jt.versions.node<"u"}function Wt(){return!Ot.getDocument()&&!!Ot.getNavigator()&&navigator.product===Wf}function Gf(){return Wt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="android"}function Jf(){return Wt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="ios"}function Li(){return!Yn()&&!!Ot.getNavigator()&&!!Ot.getDocument()}function mn(){return Wt()?He.reactNative:Yn()?He.node:Li()?He.browser:He.unknown}function oa(){var i;try{return Wt()&&typeof globalThis<"u"&&typeof globalThis?.Application<"u"?(i=globalThis.Application)==null?void 0:i.applicationId:void 0}catch{return}}function Yf(i,t){const e=new URLSearchParams(i);for(const n of Object.keys(t).sort())if(t.hasOwnProperty(n)){const r=t[n];r!==void 0&&e.set(n,r)}return e.toString()}function Zf(i){var t,e;const n=xl();try{return i!=null&&i.url&&n.url&&new URL(i.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${i.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),i.url=n.url),(t=i?.icons)!=null&&t.length&&i.icons.length>0&&(i.icons=i.icons.filter(r=>r!=="")),Ff(ra(ra({},n),i),{url:i?.url||n.url,name:i?.name||n.name,description:i?.description||n.description,icons:(e=i?.icons)!=null&&e.length&&i.icons.length>0?i.icons:n.icons})}catch(r){return console.warn("Error populating app metadata",r),i||n}}function xl(){return Yh.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Qf(){if(mn()===He.reactNative&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"){const{OS:e,Version:n}=globalThis.Platform;return[e,n].join("-")}const i=jh();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Xf(){var i;const t=mn();return t===He.browser?[t,((i=Ot.getLocation())==null?void 0:i.host)||"unknown"].join(":"):t}function Cl(i,t,e){const n=Qf(),r=Xf();return[[i,t].join("-"),[Hf,e].join("-"),n,r].join("/")}function em({protocol:i,version:t,relayUrl:e,sdkVersion:n,auth:r,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),h=Cl(i,t,n),d={auth:r,ua:h,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=Yf(u[1]||"",d);return u[0]+"?"+p}function Xt(i,t){return i.filter(e=>t.includes(e)).length===i.length}function as(i){return Object.fromEntries(i.entries())}function cs(i){return new Map(Object.entries(i))}function Yt(i=B.FIVE_MINUTES,t){const e=B.toMiliseconds(i||B.FIVE_MINUTES);let n,r,s,o;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c),o=Promise.resolve(c))},reject:c=>{s&&r&&(clearTimeout(s),r(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),n=c,r=l})}}function ft(i,t,e){return new Promise(async(n,r)=>{const s=setTimeout(()=>r(new Error(e)),t);try{const o=await i;n(o)}catch(o){r(o)}clearTimeout(s)})}function $l(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${i}`)}function tm(i){return $l("topic",i)}function im(i){return $l("id",i)}function kl(i){const[t,e]=i.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function pe(i,t){return B.fromMiliseconds(Date.now()+B.toMiliseconds(i))}function Nt(i){return Date.now()>=B.toMiliseconds(i)}function X(i,t){return`${i}${t?`:${t}`:""}`}function ni(i=[],t=[]){return[...new Set([...i,...t])]}async function nm({id:i,topic:t,wcDeepLink:e}){var n;try{if(!e)return;const r=typeof e=="string"?JSON.parse(e):e,s=r?.href;if(typeof s!="string")return;const o=rm(s,i,t),c=mn();if(c===He.browser){if(!((n=Ot.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}sm(o)}else c===He.reactNative&&typeof globalThis?.Linking<"u"&&await globalThis.Linking.openURL(o)}catch(r){console.error(r)}}function rm(i,t,e){const n=`requestId=${t}&sessionTopic=${e}`;i.endsWith("/")&&(i=i.slice(0,-1));let r=`${i}`;if(i.startsWith("https://t.me")){const s=i.includes("?")?"&startapp=":"?startapp=";r=`${r}${s}${lm(n,!0)}`}else r=`${r}/wc?${n}`;return r}function sm(i){let t="_self";cm()?t="_top":(am()||i.startsWith("https://")||i.startsWith("http://"))&&(t="_blank"),window.open(i,t,"noreferrer noopener")}async function om(i,t){let e="";try{if(Li()&&(e=localStorage.getItem(t),e))return e;e=await i.getItem(t)}catch(n){console.error(n)}return e}function aa(i,t){if(!i.includes(t))return null;const e=i.split(/([&,?,=])/),n=e.indexOf(t);return e[n+2]}function ca(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}function ro(){return typeof jt<"u"&&Nf.IS_VITEST==="true"}function am(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function cm(){try{return window.self!==window.top}catch{return!1}}function lm(i,t=!1){const e=te.from(i).toString("base64");return t?e.replace(/[=]/g,""):e}function Ul(i){return te.from(i,"base64").toString("utf-8")}function um(i){return new Promise(t=>setTimeout(t,i))}let hm=class{constructor({limit:t}){sa(this,"limit"),sa(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const Pn=BigInt(2**32-1),la=BigInt(32);function Nl(i,t=!1){return t?{h:Number(i&Pn),l:Number(i>>la&Pn)}:{h:Number(i>>la&Pn)|0,l:Number(i&Pn)|0}}function Bl(i,t=!1){const e=i.length;let n=new Uint32Array(e),r=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=Nl(i[s],t);[n[s],r[s]]=[o,c]}return[n,r]}const ua=(i,t,e)=>i>>>e,ha=(i,t,e)=>i<<32-e|t>>>e,Bt=(i,t,e)=>i>>>e|t<<32-e,Mt=(i,t,e)=>i<<32-e|t>>>e,Fi=(i,t,e)=>i<<64-e|t>>>e-32,Wi=(i,t,e)=>i>>>e-32|t<<64-e,dm=(i,t)=>t,pm=(i,t)=>i,_m=(i,t,e)=>i<<e|t>>>32-e,fm=(i,t,e)=>t<<e|i>>>32-e,mm=(i,t,e)=>t<<e-32|i>>>64-e,ym=(i,t,e)=>i<<e-32|t>>>64-e;function st(i,t,e,n){const r=(t>>>0)+(n>>>0);return{h:i+e+(r/2**32|0)|0,l:r|0}}const so=(i,t,e)=>(i>>>0)+(t>>>0)+(e>>>0),oo=(i,t,e,n)=>t+e+n+(i/2**32|0)|0,wm=(i,t,e,n)=>(i>>>0)+(t>>>0)+(e>>>0)+(n>>>0),gm=(i,t,e,n,r)=>t+e+n+r+(i/2**32|0)|0,Em=(i,t,e,n,r)=>(i>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),vm=(i,t,e,n,r,s)=>t+e+n+r+s+(i/2**32|0)|0,_i=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function ao(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Rt(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function tt(i,...t){if(!ao(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function co(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Rt(i.outputLen),Rt(i.blockLen)}function Ft(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function lo(i,t){tt(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function an(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function it(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function Or(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function lt(i,t){return i<<32-t|i>>>t}const Ml=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ql(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}const bt=Ml?i=>i:i=>ql(i);function bm(i){for(let t=0;t<i.length;t++)i[t]=ql(i[t]);return i}const qt=Ml?i=>i:bm,zl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Im=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function cn(i){if(tt(i),zl)return i.toHex();let t="";for(let e=0;e<i.length;e++)t+=Im[i[e]];return t}const Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function da(i){if(i>=Et._0&&i<=Et._9)return i-Et._0;if(i>=Et.A&&i<=Et.F)return i-(Et.A-10);if(i>=Et.a&&i<=Et.f)return i-(Et.a-10)}function uo(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);if(zl)return Uint8Array.fromHex(i);const t=i.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(e);for(let r=0,s=0;r<e;r++,s+=2){const o=da(i.charCodeAt(s)),c=da(i.charCodeAt(s+1));if(o===void 0||c===void 0){const l=i[s]+i[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[r]=o*16+c}return n}function Tm(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function at(i){return typeof i=="string"&&(i=Tm(i)),tt(i),i}function ei(...i){let t=0;for(let n=0;n<i.length;n++){const r=i[n];tt(r),t+=r.length}const e=new Uint8Array(t);for(let n=0,r=0;n<i.length;n++){const s=i[n];e.set(s,r),r+=s.length}return e}class ar{}function yn(i){const t=n=>i().update(at(n)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function Am(i){const t=(n,r)=>i(r).update(at(n)).digest(),e=i({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>i(n),t}function Di(i=32){if(_i&&typeof _i.getRandomValues=="function")return _i.getRandomValues(new Uint8Array(i));if(_i&&typeof _i.randomBytes=="function")return Uint8Array.from(_i.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const Pm=BigInt(0),ki=BigInt(1),Om=BigInt(2),Rm=BigInt(7),Lm=BigInt(256),Dm=BigInt(113),jl=[],Kl=[],Fl=[];for(let i=0,t=ki,e=1,n=0;i<24;i++){[e,n]=[n,(2*e+3*n)%5],jl.push(2*(5*n+e)),Kl.push((i+1)*(i+2)/2%64);let r=Pm;for(let s=0;s<7;s++)t=(t<<ki^(t>>Rm)*Dm)%Lm,t&Om&&(r^=ki<<(ki<<BigInt(s))-ki);Fl.push(r)}const Wl=Bl(Fl,!0),Vm=Wl[0],Sm=Wl[1],pa=(i,t,e)=>e>32?mm(i,t,e):_m(i,t,e),_a=(i,t,e)=>e>32?ym(i,t,e):fm(i,t,e);function xm(i,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=pa(u,h,1)^e[c],p=_a(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let r=i[2],s=i[3];for(let o=0;o<24;o++){const c=Kl[o],l=pa(r,s,c),u=_a(r,s,c),h=jl[o];r=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=Vm[n],i[1]^=Sm[n]}it(e)}let Cm=class Hl extends ar{constructor(t,e,n,r=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=s,Rt(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=an(this.state)}clone(){return this._cloneInto()}keccak(){qt(this.state32),xm(this.state32,this.rounds),qt(this.state32),this.posOut=0,this.pos=0}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,state:n}=this,r=t.length;for(let s=0;s<r;){const o=Math.min(e-this.pos,r-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,(e&128)!==0&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){Ft(this,!1),tt(t),this.finish();const e=this.state,{blockLen:n}=this;for(let r=0,s=t.length;r<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Rt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(lo(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,it(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:s,enableXOF:o}=this;return t||(t=new Hl(e,n,r,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}};const $m=(i,t,e)=>yn(()=>new Cm(t,i,e)),km=$m(1,136,256/8);function Um(i,t,e,n){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,n);const r=BigInt(32),s=BigInt(4294967295),o=Number(e>>r&s),c=Number(e&s),l=n?4:0,u=n?0:4;i.setUint32(t+l,o,n),i.setUint32(t+u,c,n)}function Nm(i,t,e){return i&t^~i&e}function Bm(i,t,e){return i&t^i&e^t&e}let Gl=class extends ar{constructor(t,e,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(t),this.view=Or(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{view:e,buffer:n,blockLen:r}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(r-this.pos,s-o);if(c===r){const l=Or(t);for(;r<=s-o;o+=r)this.process(l,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ft(this),lo(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:s}=this;let{pos:o}=this;e[o++]=128,it(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let d=o;d<r;d++)e[d]=0;Um(n,r-8,BigInt(this.length*8),s),this.process(n,0);const c=Or(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)c.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=r,t.pos=c,r%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}};const Dt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Ae=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Mm=Uint32Array.from([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]),Vt=new Uint32Array(64);let qm=class extends Gl{constructor(t=32){super(64,t,8,!1),this.A=Dt[0]|0,this.B=Dt[1]|0,this.C=Dt[2]|0,this.D=Dt[3]|0,this.E=Dt[4]|0,this.F=Dt[5]|0,this.G=Dt[6]|0,this.H=Dt[7]|0}get(){const{A:t,B:e,C:n,D:r,E:s,F:o,G:c,H:l}=this;return[t,e,n,r,s,o,c,l]}set(t,e,n,r,s,o,c,l){this.A=t|0,this.B=e|0,this.C=n|0,this.D=r|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Vt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const p=Vt[d-15],_=Vt[d-2],f=lt(p,7)^lt(p,18)^p>>>3,m=lt(_,17)^lt(_,19)^_>>>10;Vt[d]=m+Vt[d-7]+f+Vt[d-16]|0}let{A:n,B:r,C:s,D:o,E:c,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const p=lt(c,6)^lt(c,11)^lt(c,25),_=h+p+Nm(c,l,u)+Mm[d]+Vt[d]|0,f=(lt(n,2)^lt(n,13)^lt(n,22))+Bm(n,r,s)|0;h=u,u=l,l=c,c=o+_|0,o=s,s=r,r=n,n=_+f|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(n,r,s,o,c,l,u,h)}roundClean(){it(Vt)}destroy(){this.set(0,0,0,0,0,0,0,0),it(this.buffer)}};const Jl=Bl(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(i=>BigInt(i))),zm=Jl[0],jm=Jl[1],St=new Uint32Array(80),xt=new Uint32Array(80);let ho=class extends Gl{constructor(t=64){super(128,t,16,!1),this.Ah=Ae[0]|0,this.Al=Ae[1]|0,this.Bh=Ae[2]|0,this.Bl=Ae[3]|0,this.Ch=Ae[4]|0,this.Cl=Ae[5]|0,this.Dh=Ae[6]|0,this.Dl=Ae[7]|0,this.Eh=Ae[8]|0,this.El=Ae[9]|0,this.Fh=Ae[10]|0,this.Fl=Ae[11]|0,this.Gh=Ae[12]|0,this.Gl=Ae[13]|0,this.Hh=Ae[14]|0,this.Hl=Ae[15]|0}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=h|0,this.Fh=d|0,this.Fl=p|0,this.Gh=_|0,this.Gl=f|0,this.Hh=m|0,this.Hl=y|0}process(t,e){for(let E=0;E<16;E++,e+=4)St[E]=t.getUint32(e),xt[E]=t.getUint32(e+=4);for(let E=16;E<80;E++){const R=St[E-15]|0,I=xt[E-15]|0,g=Bt(R,I,1)^Bt(R,I,8)^ua(R,I,7),L=Mt(R,I,1)^Mt(R,I,8)^ha(R,I,7),D=St[E-2]|0,w=xt[E-2]|0,v=Bt(D,w,19)^Fi(D,w,61)^ua(D,w,6),b=Mt(D,w,19)^Wi(D,w,61)^ha(D,w,6),A=wm(L,b,xt[E-7],xt[E-16]),V=gm(A,g,v,St[E-7],St[E-16]);St[E]=V|0,xt[E]=A|0}let{Ah:n,Al:r,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:h,Eh:d,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:T,Hl:O}=this;for(let E=0;E<80;E++){const R=Bt(d,p,14)^Bt(d,p,18)^Fi(d,p,41),I=Mt(d,p,14)^Mt(d,p,18)^Wi(d,p,41),g=d&_^~d&m,L=p&f^~p&y,D=Em(O,I,L,jm[E],xt[E]),w=vm(D,T,R,g,zm[E],St[E]),v=D|0,b=Bt(n,r,28)^Fi(n,r,34)^Fi(n,r,39),A=Mt(n,r,28)^Wi(n,r,34)^Wi(n,r,39),V=n&s^n&c^s&c,P=r&o^r&l^o&l;T=m|0,O=y|0,m=_|0,y=f|0,_=d|0,f=p|0,{h:d,l:p}=st(u|0,h|0,w|0,v|0),u=c|0,h=l|0,c=s|0,l=o|0,s=n|0,o=r|0;const S=so(v,A,P);n=oo(S,w,b,V),r=S|0}({h:n,l:r}=st(this.Ah|0,this.Al|0,n|0,r|0)),{h:s,l:o}=st(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=st(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:h}=st(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l:p}=st(this.Eh|0,this.El|0,d|0,p|0),{h:_,l:f}=st(this.Fh|0,this.Fl|0,_|0,f|0),{h:m,l:y}=st(this.Gh|0,this.Gl|0,m|0,y|0),{h:T,l:O}=st(this.Hh|0,this.Hl|0,T|0,O|0),this.set(n,r,s,o,c,l,u,h,d,p,_,f,m,y,T,O)}roundClean(){it(St,xt)}destroy(){it(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Km=class extends ho{constructor(){super(48),this.Ah=Te[0]|0,this.Al=Te[1]|0,this.Bh=Te[2]|0,this.Bl=Te[3]|0,this.Ch=Te[4]|0,this.Cl=Te[5]|0,this.Dh=Te[6]|0,this.Dl=Te[7]|0,this.Eh=Te[8]|0,this.El=Te[9]|0,this.Fh=Te[10]|0,this.Fl=Te[11]|0,this.Gh=Te[12]|0,this.Gl=Te[13]|0,this.Hh=Te[14]|0,this.Hl=Te[15]|0}};const Pe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Fm extends ho{constructor(){super(32),this.Ah=Pe[0]|0,this.Al=Pe[1]|0,this.Bh=Pe[2]|0,this.Bl=Pe[3]|0,this.Ch=Pe[4]|0,this.Cl=Pe[5]|0,this.Dh=Pe[6]|0,this.Dl=Pe[7]|0,this.Eh=Pe[8]|0,this.El=Pe[9]|0,this.Fh=Pe[10]|0,this.Fl=Pe[11]|0,this.Gh=Pe[12]|0,this.Gl=Pe[13]|0,this.Hh=Pe[14]|0,this.Hl=Pe[15]|0}}const cr=yn(()=>new qm),Wm=yn(()=>new ho),Hm=yn(()=>new Km),Gm=yn(()=>new Fm),Jm=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),de=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),q=new Uint32Array(32);function Ct(i,t,e,n,r,s){const o=r[s],c=r[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*n],m=q[2*n+1],y=so(l,h,o);u=oo(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:dm(m,f),Dl:pm(m)},{h:_,l:p}=st(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Bt(d,h,24),Bl:Mt(d,h,24)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*n]=f,q[2*n+1]=m}function $t(i,t,e,n,r,s){const o=r[s],c=r[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*n],m=q[2*n+1],y=so(l,h,o);u=oo(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:Bt(m,f,16),Dl:Mt(m,f,16)},{h:_,l:p}=st(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Fi(d,h,63),Bl:Wi(d,h,63)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*n]=f,q[2*n+1]=m}function Ym(i,t={},e,n,r){if(Rt(e),i<0||i>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==n)throw new Error("salt must be undefined or "+n);if(c!==void 0&&c.length!==r)throw new Error("personalization must be undefined or "+r)}class Zm extends ar{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Rt(t),Rt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=an(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,buffer:n,buffer32:r}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(qt(r),this.compress(r,0,!1),qt(r),this.pos=0);const u=Math.min(e-this.pos,s-l),h=o+l;if(u===e&&!(h%4)&&l+u<s){const d=new Uint32Array(c,h,Math.floor((s-l)/4));qt(d);for(let p=0;l+e<s;p+=r.length,l+=e)this.length+=e,this.compress(d,p,!1);qt(d);continue}n.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Ft(this),lo(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,it(this.buffer.subarray(e)),qt(n),this.compress(n,0,!0),qt(n);const r=an(t);this.get().forEach((s,o)=>r[o]=bt(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:r,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=r,t.length=n,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Qm extends Zm{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=de[0]|0,this.v0h=de[1]|0,this.v1l=de[2]|0,this.v1h=de[3]|0,this.v2l=de[4]|0,this.v2h=de[5]|0,this.v3l=de[6]|0,this.v3h=de[7]|0,this.v4l=de[8]|0,this.v4h=de[9]|0,this.v5l=de[10]|0,this.v5h=de[11]|0,this.v6l=de[12]|0,this.v6h=de[13]|0,this.v7l=de[14]|0,this.v7h=de[15]|0,Ym(e,t,64,16,16);let{key:n,personalization:r,salt:s}=t,o=0;if(n!==void 0&&(n=at(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=at(s);const c=an(s);this.v4l^=bt(c[0]),this.v4h^=bt(c[1]),this.v5l^=bt(c[2]),this.v5h^=bt(c[3])}if(r!==void 0){r=at(r);const c=an(r);this.v6l^=bt(c[0]),this.v6h^=bt(c[1]),this.v7l^=bt(c[2]),this.v7h^=bt(c[3])}if(n!==void 0){const c=new Uint8Array(this.blockLen);c.set(n),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:r,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:h,v5l:d,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=n|0,this.v1h=r|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=h|0,this.v5l=d|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,n){this.get().forEach((l,u)=>q[u]=l),q.set(de,16);let{h:r,l:s}=Nl(BigInt(this.length));q[24]=de[8]^s,q[25]=de[9]^r,n&&(q[28]=~q[28],q[29]=~q[29]);let o=0;const c=Jm;for(let l=0;l<12;l++)Ct(0,4,8,12,t,e+2*c[o++]),$t(0,4,8,12,t,e+2*c[o++]),Ct(1,5,9,13,t,e+2*c[o++]),$t(1,5,9,13,t,e+2*c[o++]),Ct(2,6,10,14,t,e+2*c[o++]),$t(2,6,10,14,t,e+2*c[o++]),Ct(3,7,11,15,t,e+2*c[o++]),$t(3,7,11,15,t,e+2*c[o++]),Ct(0,5,10,15,t,e+2*c[o++]),$t(0,5,10,15,t,e+2*c[o++]),Ct(1,6,11,12,t,e+2*c[o++]),$t(1,6,11,12,t,e+2*c[o++]),Ct(2,7,8,13,t,e+2*c[o++]),$t(2,7,8,13,t,e+2*c[o++]),Ct(3,4,9,14,t,e+2*c[o++]),$t(3,4,9,14,t,e+2*c[o++]);this.v0l^=q[0]^q[16],this.v0h^=q[1]^q[17],this.v1l^=q[2]^q[18],this.v1h^=q[3]^q[19],this.v2l^=q[4]^q[20],this.v2h^=q[5]^q[21],this.v3l^=q[6]^q[22],this.v3h^=q[7]^q[23],this.v4l^=q[8]^q[24],this.v4h^=q[9]^q[25],this.v5l^=q[10]^q[26],this.v5h^=q[11]^q[27],this.v6l^=q[12]^q[28],this.v6h^=q[13]^q[29],this.v7l^=q[14]^q[30],this.v7h^=q[15]^q[31],it(q)}destroy(){this.destroyed=!0,it(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Xm=Am(i=>new Qm(i)),ey="https://rpc.walletconnect.org/v1";function Yl(i){const t=`Ethereum Signed Message:
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-BI2Fd0Vd.js","assets/signing-tKzVzr3v.js","assets/utils-BUWGRgBa.js","assets/index-CqbvjyBi.js","assets/index-Bzi38pjx.css","assets/store-DOLZnwHk.js","assets/hashTypedData-C4JiqOxU.js","assets/index-DRYOQXZX.js","assets/index-CYBDya_s.js","assets/index-nibyPLVP.js","assets/index-CJdot1dH.js","assets/index-D9ey6cqT.js","assets/ethereum-CIBzGnJl.js","assets/index-BVvMg9ZB.js","assets/hooks.module-CpBu4GjP.js","assets/WebCryptoP256-BkRKBE89.js","assets/sha256-D33fGSQc.js","assets/sha2-D3ryOfi3.js","assets/hmac-BMnSt9Ou.js","assets/index-C6-AvlPm.js","assets/parseSignature-Csyua1uA.js","assets/transactionReceipt-DA1xo-2g.js","assets/rpc-DkFFCBh9.js","assets/sha256-CbjS9vFa.js","assets/index-1quVm3wk.js","assets/web-connector-h9SB5qXs.js","assets/sleep-mAKpSMLY.js","assets/index-B5w_jZpc.js","assets/send-eip712-transaction-DDJVOUpU.js","assets/controller-DpEeOSLx.js","assets/qr-overlay-DA6htUdY.js","assets/getBalance-CC2S0qtL.js","assets/decimals-mBEEumco.js","assets/secp256k1-BCPsQ5nJ.js","assets/session-proposal-xJguSOgr.js","assets/session-request-BhD4eDPG.js","assets/in-app-wallet-calls-khLeeKNu.js","assets/wait-for-tx-receipt-BLruoSfj.js","assets/send-batch-transaction-jNcvidMH.js","assets/eth_getTransactionCount-cZacEETx.js"])))=>i.map(i=>d[i]);
2
+ import{u as ir,cg as ch,ch as lh,ci as uh,cj as Vc,ck as hh,g as Y,cl as dh,cm as nn,cn as Sc,h as De,a as ri,x as Ao,w as ph,n as Le,o as qn,j as ye,co as xc,cp as Cc,cq as $c,k as $s,l as ks,ai as _h,b as Us,ae as fh,C as mh,cr as kc,aM as yh,cs as wh,am as gh,an as Eh,ct as vh,m as nr,az as bh,b6 as Jr,v as Uc,cu as Ns,cv as Nc,aK as Ih,V as Bs,cw as Bc,b7 as Po,cx as Th,W as Ah,aB as Oo,aW as Ph,aa as Oh,cy as Ro,aw as Mc,ay as Rh,E as Lh,cz as Gt,ab as Dh,t as Vh,H as Sh,aU as xh,b2 as Ch,cA as $h}from"./signing-tKzVzr3v.js";import{f as kh,k as qc,l as ci,a as we,j as Ms,w as zc,e as rr,m as Uh,n as Nh,o as Bh,d as Mh,c as pn,p as qh}from"./utils-BUWGRgBa.js";import{b as jt,_ as a,g as zh,h as jh,B as te,e as li,N as jc}from"./index-CqbvjyBi.js";import{c as Kh}from"./store-DOLZnwHk.js";import{g as Fh,v as Wh,s as Hh,w as Gh,p as Jh}from"./hashTypedData-C4JiqOxU.js";import{l as vn,a as zn,s as rn,I as Ti,e as Yh,g as B,h as Ot,C as Zh,j as Yr,k as _n,m as Qh,c as Ut,r as Ai,o as Xh,n as ed,q as qs,t as zs,b as jn,P as Lo,Q as td,u as id,v as Qt,f as Kc,w as vt,x as pt,y as Lt}from"./index-DRYOQXZX.js";import{c as nd,a as rd,k as sd,d as od,s as ad,g as Do}from"./index-nibyPLVP.js";import{r as cd}from"./index-CJdot1dH.js";import{f as et,t as ze,c as Gi,a as ld,d as ud}from"./index-D9ey6cqT.js";import"./index-CYBDya_s.js";import{e as hd}from"./ethereum-CIBzGnJl.js";function dd(i=32){return ir(pd(i))}function pd(i=32){return globalThis.crypto.getRandomValues(new Uint8Array(i))}function _d(i){const t=lh(i);return uh("0x19",Vc(`Ethereum Signed Message:
3
+ `+hh(t)),t)}function fd(i){return ch(_d(i))}const yT="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",md="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",yd="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",sr="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",wd="0x0000000071727De22E5E9d8BAf0edAc6f37da032",gd=50000n,Ed=i=>vd(i||sr)==="v0.7"?yd:md,Fc=i=>{const t=kh().bundler;return t.startsWith("localhost:")?`http://${t}/v2?chain=${i.id}`:`https://${i.id}.${t}/v2`},vd=i=>{const t=Y(i);if(t===sr)return"v0.6";if(t===wd)return"v0.7";throw new Error("Unknown paymaster version")};async function Me(i){const{client:t,ecosystem:e,walletType:n,walletAddress:r,chainId:s}=i;return dh({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:r,walletType:n},ecosystem:e})}function js(i){const t=i.domain;return t?.chainId!==void 0&&nn(t.chainId)&&(i.domain={...i.domain,chainId:Sc(i.domain.chainId)}),i}const bd={"0x0":"reverted","0x1":"success"};function Ks(i){const[t,e]=(()=>{const n=i.status;return n>=100&&n<200?["pending",n]:n>=200&&n<300?["success",n]:n>=300&&n<700?["failure",n]:n==="CONFIRMED"?["success",200]:n==="PENDING"?["pending",100]:[void 0,n]})();return{...i,atomic:i.atomic,chainId:i.chainId?ri(i.chainId):void 0,receipts:i.receipts?.map(n=>({...n,blockNumber:De(n.blockNumber),gasUsed:De(n.gasUsed),status:bd[n.status]}))??[],status:t,statusCode:e,version:i.version}}function Fs(i,t){const e={};for(const[n,r]of Object.entries(i)){e[Number(n)]={};const s={};for(const[o,c]of Object.entries(r))s[o]=c;e[Number(n)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Ws(i,t){const e=i.calls[0];if(!e)throw new Error("No calls to send");const{calls:n,capabilities:r,version:s="2.0.0",chain:o=e.chain}=i,c=await Promise.all(n.map(async u=>{const{to:h,value:d}=u;if(h===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[p,_,f]=await Promise.all([Ao(h),ph(u),Ao(d)]);return p?{data:_,to:Y(p),value:typeof f=="bigint"||typeof f=="number"?Le(f):void 0}:{data:_,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:i.atomicRequired??!1,calls:c,capabilities:r,chainId:Le(o.id),from:Y(t.address),version:s}],chain:o}}function Hs(i){return Id(i).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Id(i,t,e="http"){const n=[];for(const r of i.rpc)e==="http"&&!r.startsWith("http")||e==="ws"&&!r.startsWith("ws")||(r.includes("${THIRDWEB_API_KEY}")?n.push(r.replace("${THIRDWEB_API_KEY}","")):r.includes("${")||n.push(r));if(n.length===0)throw new Error(`No RPC available for chainId "${i.chainId}" with mode ${e}`);return n}function ct(i){return typeof i=="number"?i:qn(i)?ri(i):typeof i=="bigint"?Number(i):Number.parseInt(i,10)}function Td(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Ad(){return typeof jt<"u"&&typeof jt.versions<"u"&&typeof jt.versions.node<"u"}function Wc(){return!Td()&&!Ad()}const _t="com.coinbase.wallet",At="org.base.account",Hc="io.metamask",Pd="me.rainbow",Od="io.zerion.wallet",Kn={async getItem(i){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(i)}catch{}return null},async removeItem(i){typeof window<"u"&&window.localStorage&&localStorage.removeItem(i)},async setItem(i,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(i,t)}catch{}}};function Gs(i){return i.startsWith("http://")||i.startsWith("https://")}function Gc(i,t){if(!Gs(i))return Jc(i,t);let e=i;e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function Jc(i,t){if(Gs(i))return Gc(i,t);let e=i;e.includes("://")||(e=i.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const n=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${n}`}}function Rd(i,t){return Gs(i)?Gc(i,t):Jc(i,t)}function Ld(){if(typeof navigator>"u")return!1;const i=qc(navigator.userAgent);return i?i.toLowerCase().includes("android"):!1}function Dd(){if(typeof navigator>"u")return!1;const i=qc(navigator.userAgent);return i?i.toLowerCase().includes("ios")||i.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Vd(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Sd(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function Vo(){return!!(Ld()||Dd()||Vd()&&Sd()||typeof window<"u"&&window.innerWidth<640)}function wr(i){if(window!==window.top)window.open(i);else if(i.startsWith("http")){const e=document.createElement("a");e.href=i,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=i}function Pi(i){return typeof i=="string"?i.startsWith("ecosystem."):i.id.startsWith("ecosystem.")}async function Yc(i,t){if(Pi(i)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:n}=await import("./get-ecosystem-wallet-info-BI2Fd0Vd.js");return{getEcosystemWalletInfo:n}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));return t?e(i).then(n=>n.image_id):e(i)}switch(i){case"smart":return t?a(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):a(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?a(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):a(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?a(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):a(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?a(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):a(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?a(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):a(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?a(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):a(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?a(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):a(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?a(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):a(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?a(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):a(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?a(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):a(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?a(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):a(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?a(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):a(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?a(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):a(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?a(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):a(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?a(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):a(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?a(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):a(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?a(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):a(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?a(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):a(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?a(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):a(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?a(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):a(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?a(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):a(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?a(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):a(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?a(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):a(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?a(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):a(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?a(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):a(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?a(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):a(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?a(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):a(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?a(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):a(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?a(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):a(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?a(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):a(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?a(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):a(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?a(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):a(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?a(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):a(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?a(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):a(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?a(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):a(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?a(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):a(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?a(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):a(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?a(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):a(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?a(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):a(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?a(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):a(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?a(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):a(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?a(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):a(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?a(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):a(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?a(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):a(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?a(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):a(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?a(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):a(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?a(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):a(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?a(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):a(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?a(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):a(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?a(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):a(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?a(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):a(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?a(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):a(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?a(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):a(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?a(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):a(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?a(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):a(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?a(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):a(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?a(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):a(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?a(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):a(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?a(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):a(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?a(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):a(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?a(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):a(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?a(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):a(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?a(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):a(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?a(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):a(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?a(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):a(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?a(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):a(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?a(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):a(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?a(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):a(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?a(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):a(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?a(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):a(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?a(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):a(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?a(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):a(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?a(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):a(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?a(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):a(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?a(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):a(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?a(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):a(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?a(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):a(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?a(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):a(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?a(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):a(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?a(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):a(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?a(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):a(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?a(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):a(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?a(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):a(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?a(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):a(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?a(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):a(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?a(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):a(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?a(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):a(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?a(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):a(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?a(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):a(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?a(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):a(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?a(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):a(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?a(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):a(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?a(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):a(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?a(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):a(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?a(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):a(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?a(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):a(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?a(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):a(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?a(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):a(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?a(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):a(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?a(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):a(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?a(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):a(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?a(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):a(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?a(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):a(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?a(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):a(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?a(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):a(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?a(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):a(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?a(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):a(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?a(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):a(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?a(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):a(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?a(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):a(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?a(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):a(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?a(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):a(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?a(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):a(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?a(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):a(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?a(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):a(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?a(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):a(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?a(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):a(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?a(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):a(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?a(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):a(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?a(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):a(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?a(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):a(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?a(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):a(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?a(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):a(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?a(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):a(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?a(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):a(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?a(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):a(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?a(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):a(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?a(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):a(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?a(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):a(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?a(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):a(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?a(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):a(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?a(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):a(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?a(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):a(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?a(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):a(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?a(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):a(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?a(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):a(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?a(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):a(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?a(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):a(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?a(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):a(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?a(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):a(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?a(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):a(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?a(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):a(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?a(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):a(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?a(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):a(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?a(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):a(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?a(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):a(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?a(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):a(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?a(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):a(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?a(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):a(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?a(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):a(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?a(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):a(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?a(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):a(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?a(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):a(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?a(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):a(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?a(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):a(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?a(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):a(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?a(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):a(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?a(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):a(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?a(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):a(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?a(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):a(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?a(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):a(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?a(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):a(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?a(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):a(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?a(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):a(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?a(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):a(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?a(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):a(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?a(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):a(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?a(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):a(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?a(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):a(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?a(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):a(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?a(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):a(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?a(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):a(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?a(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):a(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?a(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):a(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?a(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):a(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?a(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):a(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?a(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):a(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?a(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):a(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?a(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):a(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?a(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):a(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?a(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):a(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?a(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):a(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?a(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):a(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?a(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):a(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?a(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):a(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?a(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):a(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?a(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):a(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?a(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):a(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?a(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):a(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?a(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):a(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?a(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):a(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?a(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):a(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?a(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):a(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?a(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):a(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?a(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):a(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?a(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):a(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?a(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):a(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?a(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):a(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?a(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):a(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?a(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):a(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?a(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):a(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?a(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):a(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?a(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):a(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?a(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):a(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?a(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):a(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?a(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):a(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?a(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):a(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?a(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):a(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?a(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):a(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?a(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):a(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?a(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):a(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?a(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):a(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?a(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):a(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?a(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):a(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?a(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):a(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?a(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):a(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?a(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):a(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?a(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):a(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?a(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):a(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?a(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):a(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?a(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):a(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?a(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):a(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?a(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):a(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?a(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):a(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?a(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):a(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?a(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):a(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?a(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):a(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?a(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):a(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?a(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):a(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?a(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):a(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?a(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):a(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?a(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):a(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?a(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):a(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?a(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):a(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?a(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):a(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?a(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):a(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?a(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):a(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?a(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):a(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?a(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):a(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?a(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):a(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?a(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):a(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?a(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):a(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?a(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):a(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?a(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):a(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?a(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):a(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?a(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):a(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?a(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):a(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?a(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):a(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?a(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):a(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?a(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):a(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?a(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):a(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?a(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):a(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?a(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):a(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?a(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):a(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?a(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):a(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?a(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):a(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?a(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):a(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?a(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):a(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?a(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):a(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?a(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):a(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?a(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):a(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?a(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):a(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?a(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):a(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?a(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):a(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?a(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):a(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?a(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):a(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?a(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):a(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?a(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):a(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?a(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):a(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?a(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):a(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?a(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):a(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?a(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):a(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?a(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):a(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?a(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):a(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?a(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):a(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?a(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):a(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?a(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):a(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?a(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):a(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?a(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):a(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?a(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):a(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?a(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):a(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?a(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):a(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?a(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):a(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?a(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):a(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?a(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):a(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?a(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):a(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?a(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):a(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?a(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):a(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?a(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):a(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?a(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):a(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?a(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):a(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?a(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):a(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?a(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):a(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?a(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):a(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?a(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):a(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?a(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):a(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?a(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):a(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?a(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):a(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?a(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):a(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?a(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):a(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?a(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):a(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?a(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):a(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?a(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):a(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?a(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):a(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?a(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):a(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?a(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):a(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?a(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):a(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?a(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):a(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?a(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):a(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?a(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):a(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?a(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):a(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?a(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):a(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?a(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):a(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?a(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):a(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?a(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):a(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?a(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):a(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?a(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):a(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?a(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):a(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?a(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):a(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?a(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):a(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?a(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):a(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?a(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):a(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?a(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):a(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?a(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):a(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?a(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):a(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?a(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):a(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?a(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):a(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?a(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):a(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?a(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):a(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?a(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):a(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?a(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):a(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?a(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):a(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?a(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):a(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?a(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):a(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?a(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):a(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?a(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):a(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?a(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):a(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?a(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):a(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?a(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):a(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?a(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):a(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?a(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):a(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?a(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):a(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?a(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):a(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?a(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):a(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?a(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):a(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?a(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):a(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?a(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):a(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?a(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):a(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?a(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):a(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?a(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):a(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?a(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):a(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?a(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):a(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?a(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):a(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?a(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):a(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?a(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):a(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?a(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):a(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?a(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):a(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?a(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):a(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?a(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):a(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?a(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):a(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?a(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):a(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?a(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):a(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?a(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):a(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?a(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):a(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?a(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):a(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?a(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):a(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?a(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):a(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?a(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):a(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?a(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):a(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?a(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):a(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?a(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):a(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?a(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):a(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?a(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):a(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?a(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):a(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?a(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):a(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?a(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):a(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?a(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):a(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?a(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):a(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?a(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):a(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?a(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):a(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?a(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):a(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?a(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):a(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?a(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):a(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?a(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):a(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?a(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):a(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?a(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):a(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?a(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):a(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?a(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):a(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?a(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):a(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?a(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):a(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?a(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):a(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?a(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):a(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?a(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):a(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?a(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):a(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?a(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):a(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?a(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):a(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?a(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):a(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?a(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):a(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?a(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):a(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?a(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):a(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?a(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):a(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?a(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):a(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?a(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):a(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?a(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):a(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?a(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):a(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?a(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):a(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?a(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):a(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?a(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):a(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?a(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):a(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?a(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):a(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?a(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):a(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?a(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):a(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?a(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):a(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?a(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):a(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?a(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):a(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?a(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):a(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?a(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):a(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?a(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):a(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?a(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):a(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?a(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):a(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?a(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):a(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?a(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):a(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?a(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):a(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?a(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):a(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?a(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):a(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?a(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):a(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?a(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):a(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?a(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):a(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?a(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):a(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?a(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):a(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?a(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):a(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?a(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):a(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?a(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):a(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?a(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):a(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?a(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):a(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?a(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):a(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?a(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):a(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?a(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):a(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?a(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):a(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?a(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):a(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?a(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):a(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?a(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):a(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?a(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):a(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?a(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):a(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?a(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):a(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?a(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):a(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?a(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):a(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?a(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):a(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?a(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):a(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?a(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):a(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?a(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):a(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?a(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):a(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?a(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):a(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?a(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):a(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?a(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):a(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?a(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):a(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?a(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):a(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?a(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):a(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?a(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):a(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?a(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):a(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?a(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):a(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?a(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):a(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?a(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):a(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?a(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):a(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?a(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):a(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?a(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):a(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?a(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):a(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?a(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):a(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?a(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):a(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?a(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):a(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?a(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):a(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?a(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):a(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?a(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):a(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?a(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):a(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?a(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):a(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?a(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):a(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?a(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):a(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?a(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):a(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?a(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):a(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?a(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):a(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?a(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):a(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?a(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):a(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?a(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):a(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?a(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):a(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?a(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):a(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?a(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):a(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?a(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):a(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?a(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):a(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?a(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):a(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?a(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):a(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?a(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):a(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?a(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):a(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?a(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):a(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?a(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):a(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?a(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):a(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?a(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):a(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?a(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):a(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?a(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):a(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?a(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):a(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?a(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):a(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?a(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):a(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${i} not found`)}}function xd(){const i=new Map;return{emit(t,e){const n=i.get(t);if(n)for(const r of n)r(e)},subscribe(t,e){return i.has(t)?i.get(t)?.add(e):i.set(t,new Set([e])),()=>{const n=i.get(t);n&&n.delete(e)}}}}function ui(){return xd()}function Cd(i){const{createOptions:t}=i,e=ui();let n,r;function s(){n=void 0,r=void 0}let o=async()=>{},c=async h=>{r=h};const l=e.subscribe("chainChanged",h=>{r=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{n=h}),{autoConnect:async h=>{const{autoConnectBaseAccountSDK:d}=await a(async()=>{const{autoConnectBaseAccountSDK:T}=await Promise.resolve().then(()=>xo);return{autoConnectBaseAccountSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:At}),n},connect:async h=>{const{connectBaseAccountSDK:d}=await a(async()=>{const{connectBaseAccountSDK:T}=await Promise.resolve().then(()=>xo);return{connectBaseAccountSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:At}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>t,id:At,subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}function Fn(){if(!Wc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:i,hostname:t,port:e}=window.location;let n=`${i}//${t}`;e&&e!=="80"&&e!=="443"&&(n+=`:${e}`);const r=`${n}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:r,name:window.document.title||"thirdweb powered dApp",url:n}}let gr,bn;async function Zc(i){if(gr){if(i&&bn){const s=bn.chains?.map(u=>u.id)||[],o=i.chains?.map(u=>u.id)||[],c=s.length===o.length&&s.every((u,h)=>u===o[h]),l=i.appMetadata?.name===bn.appMetadata?.name;(!c||!l)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return gr}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:s}=await import("./index-BVvMg9ZB.js");return{createBaseAccountSDK:s}},__vite__mapDeps([13,14,15,16,17,18,3,4,19,20,1,2,21,22,23,6,9])),e=Fn(),r=t({appName:i?.appMetadata?.name||e.name||"thirdweb powered dApp",appLogoUrl:i?.appMetadata?.logoUrl||e.logoUrl||null,appChainIds:i?.chains?.map(s=>s.id)||[]}).getProvider();return gr=r,bn=i,r}function Qc(i){return i.id===At}function So({provider:i,address:t,client:e}){const n={address:Y(t),async sendTransaction(r){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:r.accessList,data:r.data,from:Y(t),gas:r.gas?Le(r.gas):void 0,to:r.to,value:r.value?Le(r.value):void 0}]});return ks({chainId:r.chainId,client:e,contractAddress:r.to??void 0,gasPrice:r.gasPrice,transactionHash:s,walletAddress:Y(t),walletType:At}),{transactionHash:s}},async signMessage({message:r}){if(!n.address)throw new Error("Provider not setup");const s=typeof r=="string"?$s(r):r.raw instanceof Uint8Array?ir(r.raw):r.raw,o=await i.request({method:"personal_sign",params:[s,n.address]});if(!nn(o))throw new Error("Invalid signature returned");return o},async signTypedData(r){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(r),l={EIP712Domain:xc(s),...r.types};Cc({domain:s,message:o,primaryType:c,types:l});const u=$c({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!nn(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async r=>{try{const{callParams:s,chain:o}=await Ws(r,n),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:ye(s)}`):s}},async getCallsStatus(r){try{const s=await i.request({method:"wallet_getCallsStatus",params:[r.id]});return Ks(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${At} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(r){const s=r.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Y(n.address)]});return Fs(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${At} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function Xc(i,t,e,n,r){const s=So({address:i,client:r,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(h){if(h[0]){const d=So({address:Y(h[0]),client:r,provider:e});n.emit("accountChanged",d),n.emit("accountsChanged",h)}else c()}function u(h){const d=we(ct(h));n.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>el(e,h)]}async function $d(i,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const r=Y(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=i.chain&&i.chain.id===o?i.chain:we(o);return o&&i?.chain&&o!==i?.chain.id&&(await el(e,i.chain),c=i.chain),Xc(r,c,e,t,i.client)}async function kd(i,t,e){const r=(await e.request({method:"eth_accounts"}))[0];if(!r)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=i.chain&&i.chain.id===o?i.chain:we(o);return Xc(r,c,e,t,i.client)}async function el(i,t){const e=await i.request({method:"eth_chainId"});if(we(ct(e))?.id===t.id)return;const r=Le(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(s){const o=await Ms(t);s?.code===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:o.explorers?.map(c=>c.url)||[],chainId:r,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:Hs(o)}]})}}const xo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:kd,connectBaseAccountSDK:$d,getBaseAccountWebProvider:Zc,isBaseAccountSDKWallet:Qc},Symbol.toStringTag,{value:"Module"}));function Ud(i){const{createOptions:t}=i,e=ui();let n,r;function s(){n=void 0,r=void 0}let o=async()=>{},c=async h=>{r=h};const l=e.subscribe("chainChanged",h=>{r=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{n=h}),{autoConnect:async h=>{const{autoConnectCoinbaseWalletSDK:d}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:T}=await Promise.resolve().then(()=>$o);return{autoConnectCoinbaseWalletSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:_t}),n},connect:async h=>{const{connectCoinbaseWalletSDK:d}=await a(async()=>{const{connectCoinbaseWalletSDK:T}=await Promise.resolve().then(()=>$o);return{connectCoinbaseWalletSDK:T}},void 0),p=await i.providerFactory(),[_,f,m,y]=await d(h,e,p);return n=_,r=f,o=m,c=y,Me({chainId:r.id,client:h.client,walletAddress:n.address,walletType:_t}),n},disconnect:async()=>{s(),await o()},getAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>t,id:_t,onConnectRequested:async()=>{if(i.onConnectRequested){const h=await i.providerFactory();return i.onConnectRequested?.(h)}},subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}async function tl(i){await i?.communicator?.waitForPopupLoaded?.()}const Nd=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:tl},Symbol.toStringTag,{value:"Module"}));let Er;async function il(i){if(!Er){let t=(await a(()=>import("./index-1quVm3wk.js"),__vite__mapDeps([24,3,4,1,2,14,19]))).default;typeof t!="function"&&typeof t.default=="function"&&(t=t.default);const n=new t({appChainIds:i?.chains?i.chains.map(r=>r.id):void 0,appLogoUrl:i?.appMetadata?.logoUrl||Fn().logoUrl,appName:i?.appMetadata?.name||Fn().name}).makeWeb3Provider(i?.walletConfig);return Er=n,n}return Er}function Co({provider:i,address:t,client:e}){const n={address:Y(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await tl(i)},async sendTransaction(r){const s=await i.request({method:"eth_sendTransaction",params:[{accessList:r.accessList,data:r.data,from:Y(t),gas:r.gas?Le(r.gas):void 0,to:r.to,value:r.value?Le(r.value):void 0}]});return ks({chainId:r.chainId,client:e,contractAddress:r.to??void 0,gasPrice:r.gasPrice,transactionHash:s,walletAddress:Y(t),walletType:_t}),{transactionHash:s}},async signMessage({message:r}){if(!n.address)throw new Error("Provider not setup");const s=typeof r=="string"?$s(r):r.raw instanceof Uint8Array?ir(r.raw):r.raw,o=await i.request({method:"personal_sign",params:[s,n.address]});if(!nn(o))throw new Error("Invalid signature returned");return o},async signTypedData(r){if(!n.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=js(r),l={EIP712Domain:xc(s),...r.types};Cc({domain:s,message:o,primaryType:c,types:l});const u=$c({domain:s??{},message:o,primaryType:c,types:l}),h=await i.request({method:"eth_signTypedData_v4",params:[n.address,u]});if(!nn(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async r=>{try{const{callParams:s,chain:o}=await Ws(r,n),c=await i.request({method:"wallet_sendCalls",params:s});return c&&typeof c=="object"&&"id"in c?{chain:o,client:e,id:c.id}:{chain:o,client:e,id:c}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:ye(s)}`):s}},async getCallsStatus(r){try{const s=await i.request({method:"wallet_getCallsStatus",params:[r.id]});return Ks(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(r){try{return await i.request({method:"wallet_getCallsStatus",params:[r.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${_t} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(r){const s=r.chainId;try{const o=await i.request({method:"wallet_getCapabilities",params:[Y(n.address)]});return Fs(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${_t} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return n}function nl(i,t,e,n,r){const s=Co({address:i,client:r,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),n.emit("disconnect",void 0)}function l(h){if(h[0]){const d=Co({address:Y(h[0]),client:r,provider:e});n.emit("accountChanged",d),n.emit("accountsChanged",h)}else c()}function u(h){const d=we(ct(h));n.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>rl(e,h)]}async function Bd(i,t,e){const n=await e.request({method:"eth_requestAccounts"});if(!n[0])throw new Error("No accounts found");const r=Y(n[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=i.chain&&i.chain.id===o?i.chain:we(o);return o&&i?.chain&&o!==i?.chain.id&&(await rl(e,i.chain),c=i.chain),nl(r,c,e,t,i.client)}async function Md(i,t,e){const r=(await e.request({method:"eth_accounts"}))[0];if(!r)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=i.chain&&i.chain.id===o?i.chain:we(o);return nl(r,c,e,t,i.client)}async function rl(i,t){const e=await i.request({method:"eth_chainId"});if(we(ct(e))?.id===t.id)return;const r=Le(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:r}]})}catch(s){const o=await Ms(t);s?.code===4902&&await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:o.explorers?.map(c=>c.url)||[],chainId:r,chainName:o.name,nativeCurrency:o.nativeCurrency,rpcUrls:Hs(o)}]})}}const $o=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:Md,connectCoinbaseWalletSDK:Bd,getCoinbaseWebProvider:il},Symbol.toStringTag,{value:"Module"}));async function qd(i){return zc(async()=>{const e=await(await fetch(`${rr("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":i}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${i}, please check your ecosystem wallet configuration.`);return e.authOptions?.includes("siwe")&&(e.authOptions=e.authOptions.filter(n=>n!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${i}`,cacheTime:1e3*60*5})}const vr=new Map;async function Ki(i,t,e){const n=ye({clientId:i.clientId,ecosystem:e,partialSecretKey:i.secretKey?.slice(0,5)});if(vr.has(n))return vr.get(n);const r=await t(i);return vr.set(n,r),r}function sl(i){const{createOptions:t,connectorFactory:e,ecosystem:n}=i,r=n?n.id:"inApp",s=ui();let o=t,c,l,u,h,d=null;const p=async _=>{if(n){const f=await qd(n.id),m=f?.smartAccountOptions;if(m)if(f.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:T}=f.smartAccountOptions,O=_?.chain??(T?we(T):void 0);if(!O)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:O,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async _=>{const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:E}=await Promise.resolve().then(()=>Hr);return{autoConnectInAppWallet:E}},void 0),m=await Ki(_.client,e,n);await p();const{account:y,chain:T,adminAccount:O}=await f(_,o,m);h=_.client,c=y,l=O,u=T;try{d=await m.storage.getAuthCookie()}catch(E){console.error("Failed to retrieve auth token:",E),d=null}return Me({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:r}),c},connect:async _=>{const{connectInAppWallet:f}=await a(async()=>{const{connectInAppWallet:E}=await Promise.resolve().then(()=>Hr);return{connectInAppWallet:E}},void 0),m=await Ki(_.client,e,n);await p();const{account:y,chain:T,adminAccount:O}=await f(_,o,m);h=_.client,c=y,l=O,u=T;try{d=await m.storage.getAuthCookie()}catch(E){console.error("Failed to retrieve auth token:",E),d=null}return Me({chainId:u.id,client:_.client,ecosystem:n,walletAddress:c.address,walletType:r}),c},disconnect:async()=>{if(h&&!(await(await Ki(h,e,n)).logout()).success)throw new Error("Failed to logout");c=void 0,l=void 0,u=void 0,d=null,s.emit("disconnect",void 0)},getAccount:()=>c,getAdminAccount:()=>l,getAuthToken:()=>d,getChain(){if(u)return u=ci(u.id)||u,u},getConfig:()=>o,id:r,subscribe:s.subscribe,switchChain:async _=>{if((o?.smartAccount||o?.executionMode?.mode==="EIP4337")&&h&&c){const{autoConnectInAppWallet:f}=await a(async()=>{const{autoConnectInAppWallet:E}=await Promise.resolve().then(()=>Hr);return{autoConnectInAppWallet:E}},void 0),m=await Ki(h,e,n);await p({chain:_});const{account:y,chain:T,adminAccount:O}=await f({chain:_,client:h},o,m);l=O,c=y,u=T}else u=_;s.emit("chainChanged",_)}}}function ol(...i){const[t,e]=i,n={id:t,partnerId:e?.partnerId};return sl({connectorFactory:async r=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-h9SB5qXs.js");return{InAppWebConnector:o}},__vite__mapDeps([25,3,4,2,1,26,5,6,7,8,9,10,11,12]));return new s({client:r,ecosystem:n,storage:e?.storage})},createOptions:{auth:{...e?.auth,options:[]},partnerId:n.partnerId},ecosystem:n})}function Zr(i){return sl({connectorFactory:async t=>{const{InAppWebConnector:e}=await a(async()=>{const{InAppWebConnector:n}=await import("./web-connector-h9SB5qXs.js");return{InAppWebConnector:n}},__vite__mapDeps([25,3,4,2,1,26,5,6,7,8,9,10,11,12]));return new e({client:t,passkeyDomain:i?.auth?.passkeyDomain,storage:i?.storage})},createOptions:i})}function Js(i){const t=ui();let e,n,r,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-B5w_jZpc.js");return{connectSmartAccount:h}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12])),[l,u]=await c(o,i);return s=o,e=l,r=u,Me({chainId:r.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-B5w_jZpc.js");return{connectSmartAccount:h}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12])),[l,u]=await c(o,i);return n=o.personalAccount,s=o,e=l,r=u,Me({chainId:r.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await a(async()=>{const{disconnectSmartAccount:c}=await import("./index-B5w_jZpc.js");return{disconnectSmartAccount:c}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12]));await o(e)}e=void 0,n=void 0,r=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>i,id:"smart",subscribe:t.subscribe,switchChain:async o=>{if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await _h(o)){const d=Us({address:i.factoryAddress||Ed(i.overrides?.entrypointAddress),chain:o,client:s.client});if(!await fh(d))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:d}=await import("./index-B5w_jZpc.js");return{connectSmartAccount:d}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12])),[u,h]=await l({...s,chain:o},{...i,chain:o});e=u,r=h,t.emit("accountChanged",u),t.emit("chainChanged",h)}}}function ot(...i){const[t,e]=i;switch(!0){case t==="smart":return Js(e);case(t==="embedded"||t==="inApp"):return Zr(e);case Pi(t):return ol(...i);case t===_t:{const n=e;return Ud({createOptions:n,onConnectRequested:async r=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>Nd);return{showCoinbasePopup:o}},void 0);return s(r)},providerFactory:()=>il(n)})}case t===At:{const n=e;return Cd({createOptions:n,providerFactory:()=>Zc(n)})}default:{let c=function(){r=void 0,s=void 0};const n=ui();let r,s,o,l=async()=>{};const u=n.subscribe("disconnect",()=>{c(),o?.(),u()});n.subscribe("accountChanged",_=>{r=_});let h=async()=>{throw new Error("Not implemented yet")};const d=Vo()?_=>wr(_):void 0,p={autoConnect:async _=>{const{injectedProvider:f}=await a(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>Uo);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&f(t)){const{autoConnectEip1193Wallet:m}=await a(async()=>{const{autoConnectEip1193Wallet:R}=await Promise.resolve().then(()=>Bo);return{autoConnectEip1193Wallet:R}},void 0),[y,T,O,E]=await m({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qr(t)});return r=y,s=T,l=O,h=E,o=n.subscribe("chainChanged",R=>{s=R}),Me({chainId:s.id,client:_.client,walletAddress:r.address,walletType:t}),r}if(_&&"client"in _){const{autoConnectWC:m}=await a(async()=>{const{autoConnectWC:R}=await import("./controller-DpEeOSLx.js");return{autoConnectWC:R}},__vite__mapDeps([29,3,4,1,2,22,6,5,7,8,9,10,11,12])),[y,T,O,E]=await m(_,n,p.id,Kn,d);return r=y,s=T,l=O,h=E,Me({chainId:s.id,client:_.client,walletAddress:r.address,walletType:t}),r}throw new Error("Failed to auto connect")},connect:async _=>{async function f(T){const{connectWC:O}=await a(async()=>{const{connectWC:R}=await import("./controller-DpEeOSLx.js");return{connectWC:R}},__vite__mapDeps([29,3,4,1,2,22,6,5,7,8,9,10,11,12]));let E;try{const[R,I,g,L]=await O({...T,walletConnect:{...T.walletConnect,onDisplayUri:T.walletConnect?.onDisplayUri||(async D=>{if(typeof window<"u"&&typeof document<"u")if(Vo()){const w=await Yc(t),v=w.mobile.native||w.mobile.universal;wr(v?Rd(v,D).redirect:D);return}else try{const{createQROverlay:w}=await a(async()=>{const{createQROverlay:v}=await import("./qr-overlay-DA6htUdY.js");return{createQROverlay:v}},__vite__mapDeps([30,3,4]));E&&E.destroy(),E=w(D,{theme:T.walletConnect?.qrModalOptions?.themeMode??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{T.walletConnect?.onCancel?.()}})}catch(w){console.error("Failed to create QR overlay:",w)}})}},n,p.id,Kn,d);return E&&(E.destroy(),E=void 0),r=R,s=I,l=g,h=L,Me({chainId:s.id,client:T.client,walletAddress:r.address,walletType:t}),r}catch(R){throw E&&(E.destroy(),E=void 0),R}}if(t==="walletConnect"){const{client:T,chain:O,...E}=_;return f({chain:O,client:T,walletConnect:{...E}})}const m=_&&"walletConnect"in _,{injectedProvider:y}=await a(async()=>{const{injectedProvider:T}=await Promise.resolve().then(()=>Uo);return{injectedProvider:T}},void 0);if(y(t)&&!m){const{connectEip1193Wallet:T}=await a(async()=>{const{connectEip1193Wallet:g}=await Promise.resolve().then(()=>Bo);return{connectEip1193Wallet:g}},void 0),[O,E,R,I]=await T({chain:_.chain,client:_.client,emitter:n,id:t,provider:Qr(t)});return r=O,s=E,l=R,h=I,o=n.subscribe("chainChanged",g=>{s=g}),Me({chainId:s.id,client:_.client,walletAddress:r.address,walletType:t}),r}if(_&&"client"in _)return f(_);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>r,getChain(){if(s)return s=ci(s.id)||s,s},getConfig:()=>i[1],id:t,subscribe:n.subscribe,switchChain:async _=>{try{await h(_),s=_}catch(f){console.error("Error switching chain",f)}}};return p}}}function zd(){return ot("walletConnect")}const ko=Wc()?Kh():void 0;function Ys(i){return Zs().find(e=>e.info.rdns===i)?.provider}function al(){return Zs().map(e=>e.info.rdns).map(e=>ot(e))}function jd(){if(ko)return ko}function Zs(){const i=jd()?.getProviders()||[];for(const t of i)if(t.info.rdns==="io.metamask.mobile"){t.info.rdns=Hc;break}return i}const Uo=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Zs,getInstalledWallets:al,injectedProvider:Ys},Symbol.toStringTag,{value:"Module"}));function Qr(i){const t=Ys(i);if(!t)throw new Error(`No injected provider found for wallet: "${i}"`);return t}async function cl({id:i,provider:t,emitter:e,client:n,chain:r}){let s,c=0;for(;!s?.[0]&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(p){if(console.error(p),Kd(p)?.toLowerCase()?.includes("rejected"))throw p;await new Promise(_=>setTimeout(_,500))}c++}const l=s?.[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=Y(l),h=await t.request({method:"eth_chainId"}).then(ct).catch(p=>{throw new Error("Error reading chainId from provider",p)});let d=r&&r.id===h?r:we(h);try{r&&typeof r.id<"u"&&r.id!==h&&(await hl(t,r),d=r)}catch{console.warn(`Error switching to chain ${r?.id} - defaulting to wallet chain (${h})`)}return ul({address:u,chain:d,client:n,emitter:e,id:i,provider:t})}async function ll({id:i,provider:t,emitter:e,client:n,chain:r}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=Y(o),l=await t.request({method:"eth_chainId"}).then(ct),u=r&&r.id===l?r:we(l);return ul({address:c,chain:u,client:n,emitter:e,id:i,provider:t})}function No({provider:i,address:t,client:e,id:n}){const r={address:Y(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:Le(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?Le(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?Le(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?Le(s.gas):void 0,nonce:s.nonce?Le(s.nonce):void 0,to:s.to?Y(s.to):void 0,data:s.data,value:s.value?Le(s.value):void 0,authorizationList:s.authorizationList?wh(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await i.request({method:"eth_sendTransaction",params:c});return ks({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:Y(t),walletType:n}),{transactionHash:l}}catch(l){throw gh(l)&&Eh({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:Y(t)}),l}},async signMessage({message:s}){if(!r.address)throw new Error("Provider not setup");const o=typeof s=="string"?$s(s):s.raw instanceof Uint8Array?ir(s.raw):s.raw;return await i.request({method:"personal_sign",params:[o,Y(r.address)]})},async signAuthorization(s){const o=kc(s);let c;try{c=await i.request({method:"eth_sign",params:[Y(r.address),o]})}catch{c=await i.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=yh(c);return{...s,...l}},async signTypedData(s){if(!i||!r.address)throw new Error("Provider not setup");const o=js(s),{domain:c,message:l,primaryType:u}=o,h={EIP712Domain:Fh({domain:c}),...o.types};Wh({domain:c,message:l,primaryType:u,types:h});const d=Hh({domain:c??{},message:l,primaryType:u,types:h});return await i.request({method:"eth_signTypedData_v4",params:[Y(r.address),d]})},async watchAsset(s){return await i.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await Ws(s,r),l=await i.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:c,client:e,id:l.id}:{chain:c,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:mh(o)}`):o}},async getCallsStatus(s){try{const o=await i.request({method:"wallet_getCallsStatus",params:[s.id]});return Ks(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await i.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${n} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const c=await i.request({method:"wallet_getCapabilities",params:[Y(r.address),o?[Le(o)]:void 0]});return Fs(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${n} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return r}async function ul({provider:i,address:t,chain:e,emitter:n,client:r,id:s}){const o=No({address:t,client:r,id:s,provider:i});async function c(){i.removeListener("accountsChanged",u),i.removeListener("chainChanged",h),i.removeListener("disconnect",l);try{await Gh(()=>i.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),n.emit("disconnect",void 0)}function u(d){if(d[0]){const p=No({address:Y(d[0]),client:r,id:s,provider:i});n.emit("accountChanged",p),n.emit("accountsChanged",d)}else l()}function h(d){const p=we(ct(d));n.emit("chainChanged",p)}return i.on&&(i.on("accountsChanged",u),i.on("chainChanged",h),i.on("disconnect",l)),[o,e,l,d=>hl(i,d)]}async function hl(i,t){const e=Le(t.id);try{await i.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const n=await Ms(t);await i.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:n.explorers?.map(r=>r.url),chainId:e,chainName:n.name,nativeCurrency:n.nativeCurrency,rpcUrls:Hs(n)}]})}}function Kd(i){return i instanceof Error?i.message:typeof i=="string"?i:typeof i=="object"&&i!==null?JSON.stringify(i):String(i)}const Bo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:ll,connectEip1193Wallet:cl,getInjectedProvider:Qr},Symbol.toStringTag,{value:"Module"}));function Fd(i){const t=i.walletId??"adapter",e=ui();let n,r,s;const o=async p=>(s=typeof i.provider=="function"?await i.provider(p):i.provider,s),c=e.subscribe("chainChanged",p=>{r=p});function l(){n=void 0,r=void 0}let u=async()=>{};const h=e.subscribe("disconnect",()=>{l(),c(),h()});e.subscribe("accountChanged",p=>{n=p});let d=async p=>{await s?.request({method:"wallet_switchEthereumChain",params:[{chainId:vh(p.id)}]})};return{autoConnect:async p=>{const[_,f,m,y]=await ll({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:p.chain?.id})});return n=_,r=f,u=m,d=y,e.emit("onConnect",p),Me({client:p.client,walletAddress:n.address,walletType:t}),n},connect:async p=>{const[_,f,m,y]=await cl({chain:p.chain,client:p.client,emitter:e,id:t,provider:await o({chainId:p.chain?.id})});return n=_,r=f,u=m,d=y,e.emit("onConnect",p),Me({client:p.client,walletAddress:n.address,walletType:t}),n},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>n,getChain(){if(r)return r=ci(r.id)||r,r},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async p=>{await d(p),e.emit("chainChanged",p)}}}function Wd(i){const{chain:t,client:e,wallet:n,connectOverride:r}=i,s=nr({chain:t,client:e});return{on:n.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return(await Uc({account:c,transaction:Jr({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return bh({account:c,transaction:Jr({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=n.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=n.getAccount();if(!c)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return c.signTypedData(l)}case"eth_accounts":{const c=n.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=n.getAccount();if(c)return[c.address];const l=r?await r(n):await n.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=qn(l)?ri(l):l,h=we(u);return n.switchChain(h)}case"wallet_getCapabilities":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],h=qn(u)?ri(u):Number(u);return c.getCapabilities(h?{chainId:h}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.sendCalls)throw new Error("Wallet does not support EIP-5792");return c.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const c=n.getAccount();if(!c)throw new Error("Account not connected");if(!c.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await c.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const Hd=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:Fd,toProvider:Wd},Symbol.toStringTag,{value:"Module"}));function Gd(i){const t=ui();let e=i.chain;return{autoConnect:async()=>(t.emit("onConnect",i),i.adaptedAccount),connect:async()=>(t.emit("onConnect",i),i.adaptedAccount),disconnect:async()=>{await i.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return i.adaptedAccount},getChain(){return e=ci(e.id)||e,e},getConfig(){return i},id:"adapter",subscribe:t.subscribe,switchChain:async n=>{await i.switchChain(n),e=n,t.emit("chainChanged",n)}}}async function Jd(){return(await a(async()=>{const{default:i}=await import("./wallet-infos-BHI_w6r-.js");return{default:i}},[])).default}async function hi(i,t){return Ki(i,async e=>{const{InAppWebConnector:n}=await a(async()=>{const{InAppWebConnector:r}=await import("./web-connector-h9SB5qXs.js");return{InAppWebConnector:r}},__vite__mapDeps([25,3,4,2,1,26,5,6,7,8,9,10,11,12]));return new n({client:e,ecosystem:t})},t)}async function dl(i){const{client:t,ecosystem:e}=i,r=await(await hi(t,e)).getUser();if(r.status==="Logged In, Wallet Initialized")return r}async function Yd(i){const t=await dl(i);if(t&&"email"in t.authDetails)return t.authDetails.email}async function Zd(i){const t=await dl(i);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function Qd(i){return(await hi(i.client,i.ecosystem)).preAuthenticate(i)}async function Xd(i){return(await hi(i.client,i.ecosystem)).authenticate(i)}async function ep(i){const t=await hi(i.client,i.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(i.strategy,i.mode,i.redirectUrl)}async function tp(i){return await(await hi(i.client,i.ecosystem)).linkProfile(i)}async function ip(i){return await(await hi(i.client,i.ecosystem)).unlinkProfile(i.profileToUnlink,i.allowAccountDeletion)}async function np(i){return(await hi(i.client,i.ecosystem)).getProfiles()}function rp(i){if("privateKey"in i){const t=fd(typeof i.message=="object"?i.message.raw:Vc(i.message)),e=Ns({payload:t,privateKey:i.privateKey});return Nc(e)}if("account"in i){const{message:t,account:e}=i;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function sp(i){const{privateKey:t,...e}=i;typeof e.domain?.chainId=="string"&&(e.domain.chainId=Sc(e.domain.chainId));const n=Ih(e),r=Ns({payload:n,privateKey:t});return Nc(r)}function Xr(i){const{client:t}=i,e=`0x${i.privateKey.replace(/^0x/,"")}`,n=Bs(Bc.getPublicKey(e.slice(2),!1)),r=Jh(n);return{address:Y(r),sendTransaction:async o=>{const c=nr({chain:we(o.chainId),client:t}),l=Po({privateKey:e,transaction:o});return{transactionHash:await Ah(c,l)}},signAuthorization:async o=>{const c=Ns({payload:kc(o),privateKey:e});return Th(o,{signature:c})},signMessage:async({message:o})=>rp({message:o,privateKey:e}),signTransaction:async o=>Po({privateKey:e,transaction:o}),signTypedData:async o=>sp({...o,privateKey:e})}}async function op(i){const t=Bs(Bc.utils.randomPrivateKey());return Xr({client:i.client,privateKey:t})}async function ap(i){const{address:t,client:e,chain:n}=i,r=i.tokenAddress||(n.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(r&&Y(r)!==Y(Oo)){const{getBalance:h}=await a(async()=>{const{getBalance:d}=await import("./getBalance-CC2S0qtL.js");return{getBalance:d}},__vite__mapDeps([31,1,2,3,4,32]));return h({address:t,contract:Us({address:r,chain:n,client:e})})}const s=nr({chain:n,client:e}),[o,c,l,u]=await Promise.all([Uh(n),Nh(n),Bh(n),Ph(s,{address:t})]);return{chainId:n.id,decimals:c,displayValue:Oh(u,c),name:l,symbol:o,tokenAddress:r??Oo,value:u}}function cp(i){return!i||typeof i.then!="function"?Promise.resolve(i):i}function me(i,...t){try{return cp(i(...t))}catch(e){return Promise.reject(e)}}function lp(i){const t=typeof i;return i===null||t!=="object"&&t!=="function"}function up(i){const t=Object.getPrototypeOf(i);return!t||t.isPrototypeOf(Object)}function xn(i){if(lp(i))return String(i);if(up(i)||Array.isArray(i))return JSON.stringify(i);if(typeof i.toJSON=="function")return xn(i.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const es="base64:";function hp(i){return typeof i=="string"?i:es+_p(i)}function dp(i){return typeof i!="string"||!i.startsWith(es)?i:pp(i.slice(es.length))}function pp(i){return globalThis.Buffer?Buffer.from(i,"base64"):Uint8Array.from(globalThis.atob(i),t=>t.codePointAt(0))}function _p(i){return globalThis.Buffer?Buffer.from(i).toString("base64"):globalThis.btoa(String.fromCodePoint(...i))}function $e(i){return i&&i.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function fp(...i){return $e(i.join(":"))}function In(i){return i=$e(i),i?i+":":""}function mp(i,t){if(t===void 0)return!0;let e=0,n=i.indexOf(":");for(;n>-1;)e++,n=i.indexOf(":",n+1);return e<=t}function yp(i,t){return t?i.startsWith(t)&&i[i.length-1]!=="$":i[i.length-1]!=="$"}const wp="memory",gp=()=>{const i=new Map;return{name:wp,getInstance:()=>i,hasItem(t){return i.has(t)},getItem(t){return i.get(t)??null},getItemRaw(t){return i.get(t)??null},setItem(t,e){i.set(t,e)},setItemRaw(t,e){i.set(t,e)},removeItem(t){i.delete(t)},getKeys(){return[...i.keys()]},clear(){i.clear()},dispose(){i.clear()}}};function Ep(i={}){const t={mounts:{"":i.driver||gp()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const h of t.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:t.mounts[h]};return{base:"",relativeKey:u,driver:t.mounts[""]}},n=(u,h)=>t.mountpoints.filter(d=>d.startsWith(u)||h&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),r=(u,h)=>{if(t.watching){h=$e(h);for(const d of t.watchListeners)d(u,h)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await Mo(t.mounts[u],r,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},c=(u,h,d)=>{const p=new Map,_=f=>{let m=p.get(f.base);return m||(m={driver:f.driver,base:f.base,items:[]},p.set(f.base,m)),m};for(const f of u){const m=typeof f=="string",y=$e(m?f:f.key),T=m?void 0:f.value,O=m||!f.options?h:{...h,...f.options},E=e(y);_(E).items.push({key:y,value:T,relativeKey:E.relativeKey,options:O})}return Promise.all([...p.values()].map(f=>d(f))).then(f=>f.flat())},l={hasItem(u,h={}){u=$e(u);const{relativeKey:d,driver:p}=e(u);return me(p.hasItem,d,h)},getItem(u,h={}){u=$e(u);const{relativeKey:d,driver:p}=e(u);return me(p.getItem,d,h).then(_=>vn(_))},getItems(u,h={}){return c(u,h,d=>d.driver.getItems?me(d.driver.getItems,d.items.map(p=>({key:p.relativeKey,options:p.options})),h).then(p=>p.map(_=>({key:fp(d.base,_.key),value:vn(_.value)}))):Promise.all(d.items.map(p=>me(d.driver.getItem,p.relativeKey,p.options).then(_=>({key:p.key,value:vn(_)})))))},getItemRaw(u,h={}){u=$e(u);const{relativeKey:d,driver:p}=e(u);return p.getItemRaw?me(p.getItemRaw,d,h):me(p.getItem,d,h).then(_=>dp(_))},async setItem(u,h,d={}){if(h===void 0)return l.removeItem(u);u=$e(u);const{relativeKey:p,driver:_}=e(u);_.setItem&&(await me(_.setItem,p,xn(h),d),_.watch||r("update",u))},async setItems(u,h){await c(u,h,async d=>{if(d.driver.setItems)return me(d.driver.setItems,d.items.map(p=>({key:p.relativeKey,value:xn(p.value),options:p.options})),h);d.driver.setItem&&await Promise.all(d.items.map(p=>me(d.driver.setItem,p.relativeKey,xn(p.value),p.options)))})},async setItemRaw(u,h,d={}){if(h===void 0)return l.removeItem(u,d);u=$e(u);const{relativeKey:p,driver:_}=e(u);if(_.setItemRaw)await me(_.setItemRaw,p,h,d);else if(_.setItem)await me(_.setItem,p,hp(h),d);else return;_.watch||r("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=$e(u);const{relativeKey:d,driver:p}=e(u);p.removeItem&&(await me(p.removeItem,d,h),(h.removeMeta||h.removeMata)&&await me(p.removeItem,d+"$",h),p.watch||r("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=$e(u);const{relativeKey:d,driver:p}=e(u),_=Object.create(null);if(p.getMeta&&Object.assign(_,await me(p.getMeta,d,h)),!h.nativeOnly){const f=await me(p.getItem,d+"$",h).then(m=>vn(m));f&&typeof f=="object"&&(typeof f.atime=="string"&&(f.atime=new Date(f.atime)),typeof f.mtime=="string"&&(f.mtime=new Date(f.mtime)),Object.assign(_,f))}return _},setMeta(u,h,d={}){return this.setItem(u+"$",h,d)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){u=In(u);const d=n(u,!0);let p=[];const _=[];let f=!0;for(const y of d){y.driver.flags?.maxDepth||(f=!1);const T=await me(y.driver.getKeys,y.relativeBase,h);for(const O of T){const E=y.mountpoint+$e(O);p.some(R=>E.startsWith(R))||_.push(E)}p=[y.mountpoint,...p.filter(O=>!O.startsWith(y.mountpoint))]}const m=h.maxDepth!==void 0&&!f;return _.filter(y=>(!m||mp(y,h.maxDepth))&&yp(y,u))},async clear(u,h={}){u=In(u),await Promise.all(n(u,!1).map(async d=>{if(d.driver.clear)return me(d.driver.clear,d.relativeBase,h);if(d.driver.removeItem){const p=await d.driver.getKeys(d.relativeBase||"",h);return Promise.all(p.map(_=>d.driver.removeItem(_,h)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>qo(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(h=>h!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,h){if(u=In(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((d,p)=>p.length-d.length)),t.mounts[u]=h,t.watching&&Promise.resolve(Mo(h,r,u)).then(d=>{t.unwatch[u]=d}).catch(console.error),l},async unmount(u,h=!0){u=In(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&(t.unwatch[u]?.(),delete t.unwatch[u]),h&&await qo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(d=>d!==u),delete t.mounts[u])},getMount(u=""){u=$e(u)+":";const h=e(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=$e(u),n(u,h.parents).map(p=>({driver:p.driver,base:p.mountpoint}))},keys:(u,h={})=>l.getKeys(u,h),get:(u,h={})=>l.getItem(u,h),set:(u,h,d={})=>l.setItem(u,h,d),has:(u,h={})=>l.hasItem(u,h),del:(u,h={})=>l.removeItem(u,h),remove:(u,h={})=>l.removeItem(u,h)};return l}function Mo(i,t,e){return i.watch?i.watch((n,r)=>t(n,e+r)):()=>{}}async function qo(i){typeof i.dispose=="function"&&await me(i.dispose)}const vp="idb-keyval";var bp=(i={})=>{const t=i.base&&i.base.length>0?`${i.base}:`:"",e=r=>t+r;let n;return i.dbName&&i.storeName&&(n=nd(i.dbName,i.storeName)),{name:vp,options:i,async hasItem(r){return!(typeof await Do(e(r),n)>"u")},async getItem(r){return await Do(e(r),n)??null},setItem(r,s){return ad(e(r),s,n)},removeItem(r){return od(e(r),n)},getKeys(){return sd(n)},clear(){return rd(n)}}};const Ip="WALLET_CONNECT_V2_INDEXED_DB",Tp="keyvaluestorage";let Ap=class{constructor(){this.indexedDb=Ep({driver:bp({dbName:Ip,storeName:Tp})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,rn(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var br=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{},Cn={exports:{}};(function(){let i;function t(){}i=t,i.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},i.prototype.setItem=function(e,n){this[e]=String(n)},i.prototype.removeItem=function(e){delete this[e]},i.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(n){e[n]=void 0,delete e[n]})},i.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},i.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof br<"u"&&br.localStorage?Cn.exports=br.localStorage:typeof window<"u"&&window.localStorage?Cn.exports=window.localStorage:Cn.exports=new t})();function Pp(i){var t;return[i[0],zn((t=i[1])!=null?t:"")]}let Op=class{constructor(){this.localStorage=Cn.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Pp)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return zn(e)}async setItem(t,e){this.localStorage.setItem(t,rn(e))}async removeItem(t){this.localStorage.removeItem(t)}};const Rp="wc_storage_version",zo=1,Lp=async(i,t,e)=>{const n=Rp,r=await t.getItem(n);if(r&&r>=zo){e(t);return}const s=await i.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const c=s.shift();if(!c)continue;const l=c.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await i.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(n,zo),e(t),Dp(i,o)},Dp=async(i,t)=>{t.length&&t.forEach(async e=>{await i.removeItem(e)})};let Vp=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new Op;this.storage=t;try{const e=new Ap;Lp(t,e,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var Ir,jo;function Sp(){if(jo)return Ir;jo=1;const i=cd();Ir=r;const t=I().console||{},e={mapHttpRequest:f,mapHttpResponse:f,wrapRequestSerializer:m,wrapResponseSerializer:m,wrapErrorSerializer:m,req:f,res:f,err:p};function n(g,L){return Array.isArray(g)?g.filter(function(w){return w!=="!stdSerializers.err"}):g===!0?Object.keys(L):!1}function r(g){g=g||{},g.browser=g.browser||{};const L=g.browser.transmit;if(L&&typeof L.send!="function")throw Error("pino: transmit option must have a send function");const D=g.browser.write||t;g.browser.write&&(g.browser.asObject=!0);const w=g.serializers||{},v=n(g.browser.serialize,w);let b=g.browser.serialize;Array.isArray(g.browser.serialize)&&g.browser.serialize.indexOf("!stdSerializers.err")>-1&&(b=!1);const A=["error","fatal","warn","info","debug","trace"];typeof D=="function"&&(D.error=D.fatal=D.warn=D.info=D.debug=D.trace=D),g.enabled===!1&&(g.level="silent");const V=g.level||"info",P=Object.create(D);P.log||(P.log=y),Object.defineProperty(P,"levelVal",{get:$}),Object.defineProperty(P,"level",{get:k,set:M});const S={transmit:L,serialize:v,asObject:g.browser.asObject,levels:A,timestamp:_(g)};P.levels=r.levels,P.level=V,P.setMaxListeners=P.getMaxListeners=P.emit=P.addListener=P.on=P.prependListener=P.once=P.prependOnceListener=P.removeListener=P.removeAllListeners=P.listeners=P.listenerCount=P.eventNames=P.write=P.flush=y,P.serializers=w,P._serialize=v,P._stdErrSerialize=b,P.child=C,L&&(P._logEvent=d());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function M(U){if(U!=="silent"&&!this.levels.values[U])throw Error("unknown level "+U);this._level=U,s(S,P,"error","log"),s(S,P,"fatal","error"),s(S,P,"warn","error"),s(S,P,"info","log"),s(S,P,"debug","log"),s(S,P,"trace","log")}function C(U,z){if(!U)throw new Error("missing bindings for child Pino");z=z||{},v&&U.serializers&&(z.serializers=U.serializers);const j=z.serializers;if(v&&j){var K=Object.assign({},w,j),F=g.browser.serialize===!0?Object.keys(K):v;delete U.serializers,l([U],F,K,this._stdErrSerialize)}function W(H){this._childLevel=(H._childLevel|0)+1,this.error=u(H,U,"error"),this.fatal=u(H,U,"fatal"),this.warn=u(H,U,"warn"),this.info=u(H,U,"info"),this.debug=u(H,U,"debug"),this.trace=u(H,U,"trace"),K&&(this.serializers=K,this._serialize=F),L&&(this._logEvent=d([].concat(H._logEvent.bindings,U)))}return W.prototype=this,new W(this)}return P}r.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},r.stdSerializers=e,r.stdTimeFunctions=Object.assign({},{nullTime:T,epochTime:O,unixTime:E,isoTime:R});function s(g,L,D,w){const v=Object.getPrototypeOf(L);L[D]=L.levelVal>L.levels.values[D]?y:v[D]?v[D]:t[D]||t[w]||y,o(g,L,D)}function o(g,L,D){!g.transmit&&L[D]===y||(L[D]=(function(w){return function(){const b=g.timestamp(),A=new Array(arguments.length),V=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var P=0;P<A.length;P++)A[P]=arguments[P];if(g.serialize&&!g.asObject&&l(A,this._serialize,this.serializers,this._stdErrSerialize),g.asObject?w.call(V,c(this,D,A,b)):w.apply(V,A),g.transmit){const S=g.transmit.level||L.level,$=r.levels.values[S],k=r.levels.values[D];if(k<$)return;h(this,{ts:b,methodLevel:D,methodValue:k,transmitValue:r.levels.values[g.transmit.level||L.level],send:g.transmit.send,val:L.levelVal},A)}}})(L[D]))}function c(g,L,D,w){g._serialize&&l(D,g._serialize,g.serializers,g._stdErrSerialize);const v=D.slice();let b=v[0];const A={};w&&(A.time=w),A.level=r.levels.values[L];let V=(g._childLevel|0)+1;if(V<1&&(V=1),b!==null&&typeof b=="object"){for(;V--&&typeof v[0]=="object";)Object.assign(A,v.shift());b=v.length?i(v.shift(),v):void 0}else typeof b=="string"&&(b=i(v.shift(),v));return b!==void 0&&(A.msg=b),A}function l(g,L,D,w){for(const v in g)if(w&&g[v]instanceof Error)g[v]=r.stdSerializers.err(g[v]);else if(typeof g[v]=="object"&&!Array.isArray(g[v]))for(const b in g[v])L&&L.indexOf(b)>-1&&b in D&&(g[v][b]=D[b](g[v][b]))}function u(g,L,D){return function(){const w=new Array(1+arguments.length);w[0]=L;for(var v=1;v<w.length;v++)w[v]=arguments[v-1];return g[D].apply(this,w)}}function h(g,L,D){const w=L.send,v=L.ts,b=L.methodLevel,A=L.methodValue,V=L.val,P=g._logEvent.bindings;l(D,g._serialize||Object.keys(g.serializers),g.serializers,g._stdErrSerialize===void 0?!0:g._stdErrSerialize),g._logEvent.ts=v,g._logEvent.messages=D.filter(function(S){return P.indexOf(S)===-1}),g._logEvent.level.label=b,g._logEvent.level.value=A,w(b,g._logEvent,V),g._logEvent=d(P)}function d(g){return{ts:0,messages:[],bindings:g||[],level:{label:"",value:0}}}function p(g){const L={type:g.constructor.name,msg:g.message,stack:g.stack};for(const D in g)L[D]===void 0&&(L[D]=g[D]);return L}function _(g){return typeof g.timestamp=="function"?g.timestamp:g.timestamp===!1?T:O}function f(){return{}}function m(g){return g}function y(){}function T(){return!1}function O(){return Date.now()}function E(){return Math.round(Date.now()/1e3)}function R(){return new Date(Date.now()).toISOString()}function I(){function g(L){return typeof L<"u"&&L}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return g(self)||g(window)||g(this)||{}}}return Ir}var gi=Sp();const or=zh(gi),xp={level:"info"},fn="custom_context",Qs=1e3*1024;let Cp=class{constructor(t){this.nodeValue=t,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},Ko=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new Cp(t);if(e.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${t} with size ${e.size}`);for(;this.size+e.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=e),this.tail=e):(this.head=e,this.tail=e),this.lengthInNodes++,this.sizeInBytes+=e.size}shift(){if(!this.head)return;const t=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=t.size}toArray(){const t=[];let e=this.head;for(;e!==null;)t.push(e.value),e=e.next;return t}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let t=this.head;return{next:()=>{if(!t)return{done:!0,value:null};const e=t.value;return t=t.next,{done:!1,value:e}}}}};class pl{constructor(t,e=Qs){this.level=t??"error",this.levelValue=gi.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Ko(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===gi.levels.values.error?console.error(t):e===gi.levels.values.warn?console.warn(t):e===gi.levels.values.debug?console.debug(t):e===gi.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(rn({timestamp:new Date().toISOString(),log:t}));const e=typeof t=="string"?JSON.parse(t).level:t.level;e>=this.levelValue&&this.forwardToConsole(t,e)}getLogs(){return this.logs}clearLogs(){this.logs=new Ko(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(rn({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let $p=class{constructor(t,e=Qs){this.baseChunkLogger=new pl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}downloadLogsBlobInBrowser(t){const e=URL.createObjectURL(this.logsToBlob(t)),n=document.createElement("a");n.href=e,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(e)}},kp=class{constructor(t,e=Qs){this.baseChunkLogger=new pl(t,e)}write(t){this.baseChunkLogger.appendToLogs(t)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(t){return this.baseChunkLogger.logsToBlob(t)}};var Up=Object.defineProperty,Np=Object.defineProperties,Bp=Object.getOwnPropertyDescriptors,Fo=Object.getOwnPropertySymbols,Mp=Object.prototype.hasOwnProperty,qp=Object.prototype.propertyIsEnumerable,Wo=(i,t,e)=>t in i?Up(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Wn=(i,t)=>{for(var e in t||(t={}))Mp.call(t,e)&&Wo(i,e,t[e]);if(Fo)for(var e of Fo(t))qp.call(t,e)&&Wo(i,e,t[e]);return i},Hn=(i,t)=>Np(i,Bp(t));function Xs(i){return Hn(Wn({},i),{level:i?.level||xp.level})}function zp(i,t=fn){return i[t]||""}function jp(i,t,e=fn){return i[e]=t,i}function je(i,t=fn){let e="";return typeof i.bindings>"u"?e=zp(i,t):e=i.bindings().context||"",e}function Kp(i,t,e=fn){const n=je(i,e);return n.trim()?`${n}/${t}`:t}function xe(i,t,e=fn){const n=Kp(i,t,e),r=i.child({context:n});return jp(r,n,e)}function Fp(i){var t,e;const n=new $p((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:or(Hn(Wn({},i.opts),{level:"trace",browser:Hn(Wn({},(e=i.opts)==null?void 0:e.browser),{write:r=>n.write(r)})})),chunkLoggerController:n}}function Wp(i){var t;const e=new kp((t=i.opts)==null?void 0:t.level,i.maxSizeInBytes);return{logger:or(Hn(Wn({},i.opts),{level:"trace"}),e),chunkLoggerController:e}}function Hp(i){return typeof i.loggerOverride<"u"&&typeof i.loggerOverride!="string"?{logger:i.loggerOverride,chunkLoggerController:null}:typeof window<"u"?Fp(i):Wp(i)}var Gp=Object.defineProperty,Jp=(i,t,e)=>t in i?Gp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ho=(i,t,e)=>Jp(i,typeof t!="symbol"?t+"":t,e);class Yp extends Ti{constructor(t){super(),this.opts=t,Ho(this,"protocol","wc"),Ho(this,"version",2)}}var Zp=Object.defineProperty,Qp=(i,t,e)=>t in i?Zp(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Xp=(i,t,e)=>Qp(i,t+"",e);class e_ extends Ti{constructor(t,e){super(),this.core=t,this.logger=e,Xp(this,"records",new Map)}}class t_{constructor(t,e){this.logger=t,this.core=e}}class i_ extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}}let n_=class extends Ti{constructor(t){super()}},r_=class{constructor(t,e,n,r){this.core=t,this.logger=e,this.name=n}},s_=class extends Ti{constructor(t,e){super(),this.relayer=t,this.logger=e}};class o_ extends Ti{constructor(t,e){super(),this.core=t,this.logger=e}}let a_=class{constructor(t,e,n){this.core=t,this.logger=e,this.store=n}},c_=class{constructor(t,e){this.projectId=t,this.logger=e}},l_=class{constructor(t,e,n){this.core=t,this.logger=e,this.telemetryEnabled=n}};var u_=Object.defineProperty,h_=(i,t,e)=>t in i?u_(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Go=(i,t,e)=>h_(i,typeof t!="symbol"?t+"":t,e);let d_=class{constructor(t){this.opts=t,Go(this,"protocol","wc"),Go(this,"version",2)}},p_=class{constructor(t){this.client=t}};function sn(i,{strict:t=!0}={}){return!i||typeof i!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(i):i.startsWith("0x")}function ts(i){return sn(i,{strict:!1})?Math.ceil((i.length-2)/2):i.length}const _l="2.31.0";let Tr={getDocsUrl:({docsBaseUrl:i,docsPath:t="",docsSlug:e})=>t?`${i??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${_l}`};class si extends Error{constructor(t,e={}){const n=e.cause instanceof si?e.cause.details:e.cause?.message?e.cause.message:e.details,r=e.cause instanceof si&&e.cause.docsPath||e.docsPath,s=Tr.getDocsUrl?.({...e,docsPath:r}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...n?[`Details: ${n}`]:[],...Tr.version?[`Version: ${Tr.version}`]:[]].join(`
4
+ `);super(o,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=r,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=_l}walk(t){return fl(this,t)}}function fl(i,t){return t?.(i)?i:i&&typeof i=="object"&&"cause"in i&&i.cause!==void 0?fl(i.cause,t):t?null:i}class ml extends si{constructor({size:t,targetSize:e,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Oi(i,{dir:t,size:e=32}={}){return typeof i=="string"?__(i,{dir:t,size:e}):f_(i,{dir:t,size:e})}function __(i,{dir:t,size:e=32}={}){if(e===null)return i;const n=i.replace("0x","");if(n.length>e*2)throw new ml({size:Math.ceil(n.length/2),targetSize:e,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function f_(i,{dir:t,size:e=32}={}){if(e===null)return i;if(i.length>e)throw new ml({size:i.length,targetSize:e,type:"bytes"});const n=new Uint8Array(e);for(let r=0;r<e;r++){const s=t==="right";n[s?r:e-r-1]=i[s?r:i.length-r-1]}return n}class m_ extends si{constructor({max:t,min:e,signed:n,size:r,value:s}){super(`Number "${s}" is not in safe ${r?`${r*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class y_ extends si{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Ri(i,{size:t}){if(ts(i)>t)throw new y_({givenSize:ts(i),maxSize:t})}function is(i,t={}){const{signed:e}=t;t.size&&Ri(i,{size:t.size});const n=BigInt(i);if(!e)return n;const r=(i.length-2)/2,s=(1n<<BigInt(r)*8n-1n)-1n;return n<=s?n:n-BigInt(`0x${"f".padStart(r*2,"f")}`)-1n}function w_(i,t={}){return Number(is(i,t))}const g_=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function ns(i,t={}){return typeof i=="number"||typeof i=="bigint"?wl(i,t):typeof i=="string"?b_(i,t):typeof i=="boolean"?E_(i,t):yl(i,t)}function E_(i,t={}){const e=`0x${Number(i)}`;return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}function yl(i,t={}){let e="";for(let r=0;r<i.length;r++)e+=g_[i[r]];const n=`0x${e}`;return typeof t.size=="number"?(Ri(n,{size:t.size}),Oi(n,{dir:"right",size:t.size})):n}function wl(i,t={}){const{signed:e,size:n}=t,r=BigInt(i);let s;n?e?s=(1n<<BigInt(n)*8n-1n)-1n:s=2n**(BigInt(n)*8n)-1n:typeof i=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&r>s||r<o){const l=typeof i=="bigint"?"n":"";throw new m_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:n,value:`${i}${l}`})}const c=`0x${(e&&r<0?(1n<<BigInt(n*8))+BigInt(r):r).toString(16)}`;return n?Oi(c,{size:n}):c}const v_=new TextEncoder;function b_(i,t={}){const e=v_.encode(i);return yl(e,t)}const I_=new TextEncoder;function T_(i,t={}){return typeof i=="number"||typeof i=="bigint"?P_(i,t):typeof i=="boolean"?A_(i,t):sn(i)?gl(i,t):El(i,t)}function A_(i,t={}){const e=new Uint8Array(1);return e[0]=Number(i),typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{size:t.size})):e}const gt={zero:48,nine:57,A:65,F:70,a:97,f:102};function Jo(i){if(i>=gt.zero&&i<=gt.nine)return i-gt.zero;if(i>=gt.A&&i<=gt.F)return i-(gt.A-10);if(i>=gt.a&&i<=gt.f)return i-(gt.a-10)}function gl(i,t={}){let e=i;t.size&&(Ri(e,{size:t.size}),e=Oi(e,{dir:"right",size:t.size}));let n=e.slice(2);n.length%2&&(n=`0${n}`);const r=n.length/2,s=new Uint8Array(r);for(let o=0,c=0;o<r;o++){const l=Jo(n.charCodeAt(c++)),u=Jo(n.charCodeAt(c++));if(l===void 0||u===void 0)throw new si(`Invalid byte sequence ("${n[c-2]}${n[c-1]}" in "${n}").`);s[o]=l*16+u}return s}function P_(i,t){const e=wl(i,t);return gl(e)}function El(i,t={}){const e=I_.encode(i);return typeof t.size=="number"?(Ri(e,{size:t.size}),Oi(e,{dir:"right",size:t.size})):e}const Tn=BigInt(2**32-1),Yo=BigInt(32);function O_(i,t=!1){return t?{h:Number(i&Tn),l:Number(i>>Yo&Tn)}:{h:Number(i>>Yo&Tn)|0,l:Number(i&Tn)|0}}function R_(i,t=!1){const e=i.length;let n=new Uint32Array(e),r=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=O_(i[s],t);[n[s],r[s]]=[o,c]}return[n,r]}const L_=(i,t,e)=>i<<e|t>>>32-e,D_=(i,t,e)=>t<<e|i>>>32-e,V_=(i,t,e)=>t<<e-32|i>>>64-e,S_=(i,t,e)=>i<<e-32|t>>>64-e,pi=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function x_(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Gn(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function on(i,...t){if(!x_(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function xT(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Gn(i.outputLen),Gn(i.blockLen)}function Zo(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function C_(i,t){on(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function $_(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function vl(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function CT(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function $T(i,t){return i<<32-t|i>>>t}const k_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function U_(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}function N_(i){for(let t=0;t<i.length;t++)i[t]=U_(i[t]);return i}const Qo=k_?i=>i:N_;function B_(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function bl(i){return typeof i=="string"&&(i=B_(i)),on(i),i}function kT(...i){let t=0;for(let n=0;n<i.length;n++){const r=i[n];on(r),t+=r.length}const e=new Uint8Array(t);for(let n=0,r=0;n<i.length;n++){const s=i[n];e.set(s,r),r+=s.length}return e}class M_{}function q_(i){const t=n=>i().update(bl(n)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function UT(i=32){if(pi&&typeof pi.getRandomValues=="function")return pi.getRandomValues(new Uint8Array(i));if(pi&&typeof pi.randomBytes=="function")return Uint8Array.from(pi.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const z_=BigInt(0),xi=BigInt(1),j_=BigInt(2),K_=BigInt(7),F_=BigInt(256),W_=BigInt(113),Il=[],Tl=[],Al=[];for(let i=0,t=xi,e=1,n=0;i<24;i++){[e,n]=[n,(2*e+3*n)%5],Il.push(2*(5*n+e)),Tl.push((i+1)*(i+2)/2%64);let r=z_;for(let s=0;s<7;s++)t=(t<<xi^(t>>K_)*W_)%F_,t&j_&&(r^=xi<<(xi<<BigInt(s))-xi);Al.push(r)}const Pl=R_(Al,!0),H_=Pl[0],G_=Pl[1],Xo=(i,t,e)=>e>32?V_(i,t,e):L_(i,t,e),ea=(i,t,e)=>e>32?S_(i,t,e):D_(i,t,e);function J_(i,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=Xo(u,h,1)^e[c],p=ea(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let r=i[2],s=i[3];for(let o=0;o<24;o++){const c=Tl[o],l=Xo(r,s,c),u=ea(r,s,c),h=Il[o];r=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=H_[n],i[1]^=G_[n]}vl(e)}class eo extends M_{constructor(t,e,n,r=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=s,Gn(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$_(this.state)}clone(){return this._cloneInto()}keccak(){Qo(this.state32),J_(this.state32,this.rounds),Qo(this.state32),this.posOut=0,this.pos=0}update(t){Zo(this),t=bl(t),on(t);const{blockLen:e,state:n}=this,r=t.length;for(let s=0;s<r;){const o=Math.min(e-this.pos,r-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,(e&128)!==0&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){Zo(this,!1),on(t),this.finish();const e=this.state,{blockLen:n}=this;for(let r=0,s=t.length;r<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Gn(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(C_(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,vl(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:s,enableXOF:o}=this;return t||(t=new eo(e,n,r,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Y_=(i,t,e)=>q_(()=>new eo(t,i,e)),Z_=Y_(1,136,256/8);function Ol(i,t){const e=t||"hex",n=Z_(sn(i,{strict:!1})?T_(i):i);return e==="bytes"?n:ns(n)}class Q_ extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const Ar=new Q_(8192);function X_(i,t){if(Ar.has(`${i}.${t}`))return Ar.get(`${i}.${t}`);const e=i.substring(2).toLowerCase(),n=Ol(El(e),"bytes"),r=e.split("");for(let o=0;o<40;o+=2)n[o>>1]>>4>=8&&r[o]&&(r[o]=r[o].toUpperCase()),(n[o>>1]&15)>=8&&r[o+1]&&(r[o+1]=r[o+1].toUpperCase());const s=`0x${r.join("")}`;return Ar.set(`${i}.${t}`,s),s}function ef(i){const t=Ol(`0x${i.substring(4)}`).substring(26);return X_(`0x${t}`)}async function tf({hash:i,signature:t}){const e=sn(i)?i:ns(i),{secp256k1:n}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-BCPsQ5nJ.js");return{secp256k1:o}},__vite__mapDeps([33,1,2,3,4,5,6,7,8,9,10,11,12]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:h,v:d,yParity:p}=t,_=Number(p??d),f=ta(_);return new n.Signature(is(u),is(h)).addRecoveryBit(f)}const o=sn(t)?t:ns(t);if(ts(o)!==65)throw new Error("invalid signature length");const c=w_(`0x${o.slice(130)}`),l=ta(c);return n.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function ta(i){if(i===0||i===1)return i;if(i===27)return 0;if(i===28)return 1;throw new Error("Invalid yParityOrV value")}async function nf({hash:i,signature:t}){return ef(await tf({hash:i,signature:t}))}function rf(i){const t=i.length;let e=0,n=0;for(;n<t;){let r=i.charCodeAt(n++);if((r&4294967168)===0){e++;continue}else if((r&4294965248)===0)e+=2;else{if(r>=55296&&r<=56319&&n<t){const s=i.charCodeAt(n);(s&64512)===56320&&(++n,r=((r&1023)<<10)+(s&1023)+65536)}(r&4294901760)===0?e+=3:e+=4}}return e}function sf(i,t,e){const n=i.length;let r=e,s=0;for(;s<n;){let o=i.charCodeAt(s++);if((o&4294967168)===0){t[r++]=o;continue}else if((o&4294965248)===0)t[r++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<n){const c=i.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}(o&4294901760)===0?(t[r++]=o>>12&15|224,t[r++]=o>>6&63|128):(t[r++]=o>>18&7|240,t[r++]=o>>12&63|128,t[r++]=o>>6&63|128)}t[r++]=o&63|128}}const of=new TextEncoder,af=50;function cf(i,t,e){of.encodeInto(i,t.subarray(e))}function lf(i,t,e){i.length>af?cf(i,t,e):sf(i,t,e)}const uf=4096;function Rl(i,t,e){let n=t;const r=n+e,s=[];let o="";for(;n<r;){const c=i[n++];if((c&128)===0)s.push(c);else if((c&224)===192){const l=i[n++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=i[n++]&63,u=i[n++]&63;s.push((c&31)<<12|l<<6|u)}else if((c&248)===240){const l=i[n++]&63,u=i[n++]&63,h=i[n++]&63;let d=(c&7)<<18|l<<12|u<<6|h;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(c);s.length>=uf&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const hf=new TextDecoder,df=200;function pf(i,t,e){const n=i.subarray(t,t+e);return hf.decode(n)}function _f(i,t,e){return e>df?pf(i,t,e):Rl(i,t,e)}class An{constructor(t,e){this.type=t,this.data=e}}class We extends Error{constructor(t){super(t);const e=Object.create(We.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:We.name})}}const Ci=4294967295;function ff(i,t,e){const n=e/4294967296,r=e;i.setUint32(t,n),i.setUint32(t+4,r)}function Ll(i,t,e){const n=Math.floor(e/4294967296),r=e;i.setUint32(t,n),i.setUint32(t+4,r)}function Dl(i,t){const e=i.getInt32(t),n=i.getUint32(t+4);return e*4294967296+n}function mf(i,t){const e=i.getUint32(t),n=i.getUint32(t+4);return e*4294967296+n}const yf=-1,wf=4294967296-1,gf=17179869184-1;function Ef({sec:i,nsec:t}){if(i>=0&&t>=0&&i<=gf)if(t===0&&i<=wf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,i),e}else{const e=i/4294967296,n=i&4294967295,r=new Uint8Array(8),s=new DataView(r.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,n),r}else{const e=new Uint8Array(12),n=new DataView(e.buffer);return n.setUint32(0,t),Ll(n,4,i),e}}function vf(i){const t=i.getTime(),e=Math.floor(t/1e3),n=(t-e*1e3)*1e6,r=Math.floor(n/1e9);return{sec:e+r,nsec:n-r*1e9}}function bf(i){if(i instanceof Date){const t=vf(i);return Ef(t)}else return null}function If(i){const t=new DataView(i.buffer,i.byteOffset,i.byteLength);switch(i.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),n=t.getUint32(4),r=(e&3)*4294967296+n,s=e>>>2;return{sec:r,nsec:s}}case 12:{const e=Dl(t,4),n=t.getUint32(0);return{sec:e,nsec:n}}default:throw new We(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${i.length}`)}}function Tf(i){const t=If(i);return new Date(t.sec*1e3+t.nsec/1e6)}const Af={type:yf,encode:bf,decode:Tf};class Jn{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Af)}register({type:t,encode:e,decode:n}){if(t>=0)this.encoders[t]=e,this.decoders[t]=n;else{const r=-1-t;this.builtInEncoders[r]=e,this.builtInDecoders[r]=n}}tryToEncode(t,e){for(let n=0;n<this.builtInEncoders.length;n++){const r=this.builtInEncoders[n];if(r!=null){const s=r(t,e);if(s!=null){const o=-1-n;return new An(o,s)}}}for(let n=0;n<this.encoders.length;n++){const r=this.encoders[n];if(r!=null){const s=r(t,e);if(s!=null){const o=n;return new An(o,s)}}}return t instanceof An?t:null}decode(t,e,n){const r=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return r?r(t,e,n):new An(e,t)}}Jn.defaultCodec=new Jn;function Pf(i){return i instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&i instanceof SharedArrayBuffer}function rs(i){return i instanceof Uint8Array?i:ArrayBuffer.isView(i)?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):Pf(i)?new Uint8Array(i):Uint8Array.from(i)}const Of=100,Rf=2048;class to{constructor(t){this.entered=!1,this.extensionCodec=t?.extensionCodec??Jn.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.maxDepth=t?.maxDepth??Of,this.initialBufferSize=t?.initialBufferSize??Rf,this.sortKeys=t?.sortKeys??!1,this.forceFloat32=t?.forceFloat32??!1,this.ignoreUndefined=t?.ignoreUndefined??!1,this.forceIntegerToFloat=t?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new to({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),n=new Uint8Array(e),r=new DataView(e);n.set(this.bytes),this.view=r,this.bytes=n}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const n=rf(t);this.ensureBufferSizeToWrite(5+n),this.writeStringHeader(n),lf(t,this.bytes,this.pos),this.pos+=n}encodeObject(t,e){const n=this.extensionCodec.tryToEncode(t,this.context);if(n!=null)this.encodeExtension(n);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const n=rs(t);this.writeU8a(n)}encodeArray(t,e){const n=t.length;if(n<16)this.writeU8(144+n);else if(n<65536)this.writeU8(220),this.writeU16(n);else if(n<4294967296)this.writeU8(221),this.writeU32(n);else throw new Error(`Too large array: ${n}`);for(const r of t)this.doEncode(r,e+1)}countWithoutUndefined(t,e){let n=0;for(const r of e)t[r]!==void 0&&n++;return n}encodeMap(t,e){const n=Object.keys(t);this.sortKeys&&n.sort();const r=this.ignoreUndefined?this.countWithoutUndefined(t,n):n.length;if(r<16)this.writeU8(128+r);else if(r<65536)this.writeU8(222),this.writeU16(r);else if(r<4294967296)this.writeU8(223),this.writeU32(r);else throw new Error(`Too large map object: ${r}`);for(const s of n){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const n=t.data(this.pos+6),r=n.length;if(r>=4294967296)throw new Error(`Too large extension object: ${r}`);this.writeU8(201),this.writeU32(r),this.writeI8(t.type),this.writeU8a(n);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),ff(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),Ll(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function Lf(i,t){return new to(t).encodeSharedRef(i)}function Pr(i){return`${i<0?"-":""}0x${Math.abs(i).toString(16).padStart(2,"0")}`}const Df=16,Vf=16;class Sf{constructor(t=Df,e=Vf){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let n=0;n<this.maxKeyLength;n++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,n){const r=this.caches[n-1];e:for(const s of r){const o=s.bytes;for(let c=0;c<n;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const n=this.caches[t.length-1],r={bytes:t,str:e};n.length>=this.maxLengthPerKey?n[Math.random()*n.length|0]=r:n.push(r)}decode(t,e,n){const r=this.find(t,e,n);if(r!=null)return this.hit++,r;this.miss++;const s=Rl(t,e,n),o=Uint8Array.prototype.slice.call(t,e,e+n);return this.store(o,s),s}}const ss="array",Ji="map_key",Vl="map_value",xf=i=>{if(typeof i=="string"||typeof i=="number")return i;throw new We("The type of key must be string or number but "+typeof i)};class Cf{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=ss,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Ji,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===ss){const n=t;n.size=0,n.array=void 0,n.position=0,n.type=void 0}if(t.type===Ji||t.type===Vl){const n=t;n.size=0,n.map=void 0,n.readCount=0,n.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const $i=-1,io=new DataView(new ArrayBuffer(0)),$f=new Uint8Array(io.buffer);try{io.getInt8(0)}catch(i){if(!(i instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const ia=new RangeError("Insufficient data"),kf=new Sf;class no{constructor(t){this.totalPos=0,this.pos=0,this.view=io,this.bytes=$f,this.headByte=$i,this.stack=new Cf,this.entered=!1,this.extensionCodec=t?.extensionCodec??Jn.defaultCodec,this.context=t?.context,this.useBigInt64=t?.useBigInt64??!1,this.rawStrings=t?.rawStrings??!1,this.maxStrLength=t?.maxStrLength??Ci,this.maxBinLength=t?.maxBinLength??Ci,this.maxArrayLength=t?.maxArrayLength??Ci,this.maxMapLength=t?.maxMapLength??Ci,this.maxExtLength=t?.maxExtLength??Ci,this.keyDecoder=t?.keyDecoder!==void 0?t.keyDecoder:kf,this.mapKeyConverter=t?.mapKeyConverter??xf}clone(){return new no({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=$i,this.stack.reset()}setBuffer(t){const e=rs(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===$i&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),n=rs(t),r=new Uint8Array(e.length+n.length);r.set(e),r.set(n,e.length),this.setBuffer(r)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:n}=this;return new RangeError(`Extra ${e.byteLength-n} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,n;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{n=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return n}const{headByte:r,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${Pr(r)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let n=e,r=-1;for await(const s of t){if(e&&r===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),n&&(r=this.readArraySize(),n=!1,this.complete());try{for(;yield this.doDecodeSync(),--r!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const r=t-128;if(r!==0){this.pushMapState(r),this.complete();continue e}else e={}}else if(t<160){const r=t-144;if(r!==0){this.pushArrayState(r),this.complete();continue e}else e=[]}else{const r=t-160;e=this.decodeString(r,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const r=this.lookU8();e=this.decodeString(r,1)}else if(t===218){const r=this.lookU16();e=this.decodeString(r,2)}else if(t===219){const r=this.lookU32();e=this.decodeString(r,4)}else if(t===220){const r=this.readU16();if(r!==0){this.pushArrayState(r),this.complete();continue e}else e=[]}else if(t===221){const r=this.readU32();if(r!==0){this.pushArrayState(r),this.complete();continue e}else e=[]}else if(t===222){const r=this.readU16();if(r!==0){this.pushMapState(r),this.complete();continue e}else e={}}else if(t===223){const r=this.readU32();if(r!==0){this.pushMapState(r),this.complete();continue e}else e={}}else if(t===196){const r=this.lookU8();e=this.decodeBinary(r,1)}else if(t===197){const r=this.lookU16();e=this.decodeBinary(r,2)}else if(t===198){const r=this.lookU32();e=this.decodeBinary(r,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const r=this.lookU8();e=this.decodeExtension(r,1)}else if(t===200){const r=this.lookU16();e=this.decodeExtension(r,2)}else if(t===201){const r=this.lookU32();e=this.decodeExtension(r,4)}else throw new We(`Unrecognized type byte: ${Pr(t)}`);this.complete();const n=this.stack;for(;n.length>0;){const r=n.top();if(r.type===ss)if(r.array[r.position]=e,r.position++,r.position===r.size)e=r.array,n.release(r);else continue e;else if(r.type===Ji){if(e==="__proto__")throw new We("The key __proto__ is not allowed");r.key=this.mapKeyConverter(e),r.type=Vl;continue e}else if(r.map[r.key]=e,r.readCount++,r.readCount===r.size)e=r.map,n.release(r);else{r.key=null,r.type=Ji;continue e}}return e}}readHeadByte(){return this.headByte===$i&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=$i}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new We(`Unrecognized array type byte: ${Pr(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new We(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new We(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){if(t>this.maxStrLength)throw new We(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw ia;const n=this.pos+e;let r;return this.stateIsMapKey()&&this.keyDecoder?.canBeCached(t)?r=this.keyDecoder.decode(this.bytes,n,t):r=_f(this.bytes,n,t),this.pos+=e+t,r}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Ji:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new We(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw ia;const n=this.pos+e,r=this.bytes.subarray(n,n+t);return this.pos+=e+t,r}decodeExtension(t,e){if(t>this.maxExtLength)throw new We(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const n=this.view.getInt8(this.pos+e),r=this.decodeBinary(t,e+1);return this.extensionCodec.decode(r,n,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=mf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=Dl(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function Uf(i,t){return new no(t).decode(i)}var Nf={};const Bf=":";function $n(i){const[t,e]=i.split(Bf);return{namespace:t,reference:e}}function Sl(i,t){return i.includes(":")?[i]:t.chains||[]}var Mf=Object.defineProperty,qf=Object.defineProperties,zf=Object.getOwnPropertyDescriptors,na=Object.getOwnPropertySymbols,jf=Object.prototype.hasOwnProperty,Kf=Object.prototype.propertyIsEnumerable,os=(i,t,e)=>t in i?Mf(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ra=(i,t)=>{for(var e in t||(t={}))jf.call(t,e)&&os(i,e,t[e]);if(na)for(var e of na(t))Kf.call(t,e)&&os(i,e,t[e]);return i},Ff=(i,t)=>qf(i,zf(t)),sa=(i,t,e)=>os(i,typeof t!="symbol"?t+"":t,e);const Wf="ReactNative",He={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},Hf="js";function Yn(){return typeof jt<"u"&&typeof jt.versions<"u"&&typeof jt.versions.node<"u"}function Wt(){return!Ot.getDocument()&&!!Ot.getNavigator()&&navigator.product===Wf}function Gf(){return Wt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="android"}function Jf(){return Wt()&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"&&globalThis?.Platform.OS==="ios"}function Li(){return!Yn()&&!!Ot.getNavigator()&&!!Ot.getDocument()}function mn(){return Wt()?He.reactNative:Yn()?He.node:Li()?He.browser:He.unknown}function oa(){var i;try{return Wt()&&typeof globalThis<"u"&&typeof globalThis?.Application<"u"?(i=globalThis.Application)==null?void 0:i.applicationId:void 0}catch{return}}function Yf(i,t){const e=new URLSearchParams(i);for(const n of Object.keys(t).sort())if(t.hasOwnProperty(n)){const r=t[n];r!==void 0&&e.set(n,r)}return e.toString()}function Zf(i){var t,e;const n=xl();try{return i!=null&&i.url&&n.url&&new URL(i.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${i.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),i.url=n.url),(t=i?.icons)!=null&&t.length&&i.icons.length>0&&(i.icons=i.icons.filter(r=>r!=="")),Ff(ra(ra({},n),i),{url:i?.url||n.url,name:i?.name||n.name,description:i?.description||n.description,icons:(e=i?.icons)!=null&&e.length&&i.icons.length>0?i.icons:n.icons})}catch(r){return console.warn("Error populating app metadata",r),i||n}}function xl(){return Yh.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function Qf(){if(mn()===He.reactNative&&typeof globalThis<"u"&&typeof globalThis?.Platform<"u"){const{OS:e,Version:n}=globalThis.Platform;return[e,n].join("-")}const i=jh();if(i===null)return"unknown";const t=i.os?i.os.replace(" ","").toLowerCase():"unknown";return i.type==="browser"?[t,i.name,i.version].join("-"):[t,i.version].join("-")}function Xf(){var i;const t=mn();return t===He.browser?[t,((i=Ot.getLocation())==null?void 0:i.host)||"unknown"].join(":"):t}function Cl(i,t,e){const n=Qf(),r=Xf();return[[i,t].join("-"),[Hf,e].join("-"),n,r].join("/")}function em({protocol:i,version:t,relayUrl:e,sdkVersion:n,auth:r,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),h=Cl(i,t,n),d={auth:r,ua:h,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},p=Yf(u[1]||"",d);return u[0]+"?"+p}function Xt(i,t){return i.filter(e=>t.includes(e)).length===i.length}function as(i){return Object.fromEntries(i.entries())}function cs(i){return new Map(Object.entries(i))}function Yt(i=B.FIVE_MINUTES,t){const e=B.toMiliseconds(i||B.FIVE_MINUTES);let n,r,s,o;return{resolve:c=>{s&&n&&(clearTimeout(s),n(c),o=Promise.resolve(c))},reject:c=>{s&&r&&(clearTimeout(s),r(c))},done:()=>new Promise((c,l)=>{if(o)return c(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),n=c,r=l})}}function ft(i,t,e){return new Promise(async(n,r)=>{const s=setTimeout(()=>r(new Error(e)),t);try{const o=await i;n(o)}catch(o){r(o)}clearTimeout(s)})}function $l(i,t){if(typeof t=="string"&&t.startsWith(`${i}:`))return t;if(i.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(i.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${i}`)}function tm(i){return $l("topic",i)}function im(i){return $l("id",i)}function kl(i){const[t,e]=i.split(":"),n={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")n.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))n.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return n}function pe(i,t){return B.fromMiliseconds(Date.now()+B.toMiliseconds(i))}function Nt(i){return Date.now()>=B.toMiliseconds(i)}function X(i,t){return`${i}${t?`:${t}`:""}`}function ni(i=[],t=[]){return[...new Set([...i,...t])]}async function nm({id:i,topic:t,wcDeepLink:e}){var n;try{if(!e)return;const r=typeof e=="string"?JSON.parse(e):e,s=r?.href;if(typeof s!="string")return;const o=rm(s,i,t),c=mn();if(c===He.browser){if(!((n=Ot.getDocument())!=null&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}sm(o)}else c===He.reactNative&&typeof globalThis?.Linking<"u"&&await globalThis.Linking.openURL(o)}catch(r){console.error(r)}}function rm(i,t,e){const n=`requestId=${t}&sessionTopic=${e}`;i.endsWith("/")&&(i=i.slice(0,-1));let r=`${i}`;if(i.startsWith("https://t.me")){const s=i.includes("?")?"&startapp=":"?startapp=";r=`${r}${s}${lm(n,!0)}`}else r=`${r}/wc?${n}`;return r}function sm(i){let t="_self";cm()?t="_top":(am()||i.startsWith("https://")||i.startsWith("http://"))&&(t="_blank"),window.open(i,t,"noreferrer noopener")}async function om(i,t){let e="";try{if(Li()&&(e=localStorage.getItem(t),e))return e;e=await i.getItem(t)}catch(n){console.error(n)}return e}function aa(i,t){if(!i.includes(t))return null;const e=i.split(/([&,?,=])/),n=e.indexOf(t);return e[n+2]}function ca(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,i=>{const t=Math.random()*16|0;return(i==="x"?t:t&3|8).toString(16)})}function ro(){return typeof jt<"u"&&Nf.IS_VITEST==="true"}function am(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function cm(){try{return window.self!==window.top}catch{return!1}}function lm(i,t=!1){const e=te.from(i).toString("base64");return t?e.replace(/[=]/g,""):e}function Ul(i){return te.from(i,"base64").toString("utf-8")}function um(i){return new Promise(t=>setTimeout(t,i))}let hm=class{constructor({limit:t}){sa(this,"limit"),sa(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const Pn=BigInt(2**32-1),la=BigInt(32);function Nl(i,t=!1){return t?{h:Number(i&Pn),l:Number(i>>la&Pn)}:{h:Number(i>>la&Pn)|0,l:Number(i&Pn)|0}}function Bl(i,t=!1){const e=i.length;let n=new Uint32Array(e),r=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=Nl(i[s],t);[n[s],r[s]]=[o,c]}return[n,r]}const ua=(i,t,e)=>i>>>e,ha=(i,t,e)=>i<<32-e|t>>>e,Bt=(i,t,e)=>i>>>e|t<<32-e,Mt=(i,t,e)=>i<<32-e|t>>>e,Fi=(i,t,e)=>i<<64-e|t>>>e-32,Wi=(i,t,e)=>i>>>e-32|t<<64-e,dm=(i,t)=>t,pm=(i,t)=>i,_m=(i,t,e)=>i<<e|t>>>32-e,fm=(i,t,e)=>t<<e|i>>>32-e,mm=(i,t,e)=>t<<e-32|i>>>64-e,ym=(i,t,e)=>i<<e-32|t>>>64-e;function st(i,t,e,n){const r=(t>>>0)+(n>>>0);return{h:i+e+(r/2**32|0)|0,l:r|0}}const so=(i,t,e)=>(i>>>0)+(t>>>0)+(e>>>0),oo=(i,t,e,n)=>t+e+n+(i/2**32|0)|0,wm=(i,t,e,n)=>(i>>>0)+(t>>>0)+(e>>>0)+(n>>>0),gm=(i,t,e,n,r)=>t+e+n+r+(i/2**32|0)|0,Em=(i,t,e,n,r)=>(i>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),vm=(i,t,e,n,r,s)=>t+e+n+r+s+(i/2**32|0)|0,_i=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function ao(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function Rt(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function tt(i,...t){if(!ao(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function co(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Rt(i.outputLen),Rt(i.blockLen)}function Ft(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function lo(i,t){tt(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function an(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function it(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function Or(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}function lt(i,t){return i<<32-t|i>>>t}const Ml=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ql(i){return i<<24&4278190080|i<<8&16711680|i>>>8&65280|i>>>24&255}const bt=Ml?i=>i:i=>ql(i);function bm(i){for(let t=0;t<i.length;t++)i[t]=ql(i[t]);return i}const qt=Ml?i=>i:bm,zl=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Im=Array.from({length:256},(i,t)=>t.toString(16).padStart(2,"0"));function cn(i){if(tt(i),zl)return i.toHex();let t="";for(let e=0;e<i.length;e++)t+=Im[i[e]];return t}const Et={_0:48,_9:57,A:65,F:70,a:97,f:102};function da(i){if(i>=Et._0&&i<=Et._9)return i-Et._0;if(i>=Et.A&&i<=Et.F)return i-(Et.A-10);if(i>=Et.a&&i<=Et.f)return i-(Et.a-10)}function uo(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);if(zl)return Uint8Array.fromHex(i);const t=i.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const n=new Uint8Array(e);for(let r=0,s=0;r<e;r++,s+=2){const o=da(i.charCodeAt(s)),c=da(i.charCodeAt(s+1));if(o===void 0||c===void 0){const l=i[s]+i[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}n[r]=o*16+c}return n}function Tm(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function at(i){return typeof i=="string"&&(i=Tm(i)),tt(i),i}function ei(...i){let t=0;for(let n=0;n<i.length;n++){const r=i[n];tt(r),t+=r.length}const e=new Uint8Array(t);for(let n=0,r=0;n<i.length;n++){const s=i[n];e.set(s,r),r+=s.length}return e}class ar{}function yn(i){const t=n=>i().update(at(n)).digest(),e=i();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>i(),t}function Am(i){const t=(n,r)=>i(r).update(at(n)).digest(),e=i({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>i(n),t}function Di(i=32){if(_i&&typeof _i.getRandomValues=="function")return _i.getRandomValues(new Uint8Array(i));if(_i&&typeof _i.randomBytes=="function")return Uint8Array.from(_i.randomBytes(i));throw new Error("crypto.getRandomValues must be defined")}const Pm=BigInt(0),ki=BigInt(1),Om=BigInt(2),Rm=BigInt(7),Lm=BigInt(256),Dm=BigInt(113),jl=[],Kl=[],Fl=[];for(let i=0,t=ki,e=1,n=0;i<24;i++){[e,n]=[n,(2*e+3*n)%5],jl.push(2*(5*n+e)),Kl.push((i+1)*(i+2)/2%64);let r=Pm;for(let s=0;s<7;s++)t=(t<<ki^(t>>Rm)*Dm)%Lm,t&Om&&(r^=ki<<(ki<<BigInt(s))-ki);Fl.push(r)}const Wl=Bl(Fl,!0),Vm=Wl[0],Sm=Wl[1],pa=(i,t,e)=>e>32?mm(i,t,e):_m(i,t,e),_a=(i,t,e)=>e>32?ym(i,t,e):fm(i,t,e);function xm(i,t=24){const e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)e[o]=i[o]^i[o+10]^i[o+20]^i[o+30]^i[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=pa(u,h,1)^e[c],p=_a(u,h,1)^e[c+1];for(let _=0;_<50;_+=10)i[o+_]^=d,i[o+_+1]^=p}let r=i[2],s=i[3];for(let o=0;o<24;o++){const c=Kl[o],l=pa(r,s,c),u=_a(r,s,c),h=jl[o];r=i[h],s=i[h+1],i[h]=l,i[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=i[o+c];for(let c=0;c<10;c++)i[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}i[0]^=Vm[n],i[1]^=Sm[n]}it(e)}let Cm=class Hl extends ar{constructor(t,e,n,r=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=r,this.rounds=s,Rt(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=an(this.state)}clone(){return this._cloneInto()}keccak(){qt(this.state32),xm(this.state32,this.rounds),qt(this.state32),this.posOut=0,this.pos=0}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,state:n}=this,r=t.length;for(let s=0;s<r;){const o=Math.min(e-this.pos,r-s);for(let c=0;c<o;c++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:n,blockLen:r}=this;t[n]^=e,(e&128)!==0&&n===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){Ft(this,!1),tt(t),this.finish();const e=this.state,{blockLen:n}=this;for(let r=0,s=t.length;r<s;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,s-r);t.set(e.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Rt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(lo(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,it(this.state)}_cloneInto(t){const{blockLen:e,suffix:n,outputLen:r,rounds:s,enableXOF:o}=this;return t||(t=new Hl(e,n,r,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}};const $m=(i,t,e)=>yn(()=>new Cm(t,i,e)),km=$m(1,136,256/8);function Um(i,t,e,n){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,n);const r=BigInt(32),s=BigInt(4294967295),o=Number(e>>r&s),c=Number(e&s),l=n?4:0,u=n?0:4;i.setUint32(t+l,o,n),i.setUint32(t+u,c,n)}function Nm(i,t,e){return i&t^~i&e}function Bm(i,t,e){return i&t^i&e^t&e}let Gl=class extends ar{constructor(t,e,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(t),this.view=Or(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{view:e,buffer:n,blockLen:r}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(r-this.pos,s-o);if(c===r){const l=Or(t);for(;r<=s-o;o+=r)this.process(l,o);continue}n.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===r&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ft(this),lo(t,this),this.finished=!0;const{buffer:e,view:n,blockLen:r,isLE:s}=this;let{pos:o}=this;e[o++]=128,it(this.buffer.subarray(o)),this.padOffset>r-o&&(this.process(n,0),o=0);for(let d=o;d<r;d++)e[d]=0;Um(n,r-8,BigInt(this.length*8),s),this.process(n,0);const c=Or(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)c.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:n,length:r,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=r,t.pos=c,r%e&&t.buffer.set(n),t}clone(){return this._cloneInto()}};const Dt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Te=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Ae=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Mm=Uint32Array.from([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]),Vt=new Uint32Array(64);let qm=class extends Gl{constructor(t=32){super(64,t,8,!1),this.A=Dt[0]|0,this.B=Dt[1]|0,this.C=Dt[2]|0,this.D=Dt[3]|0,this.E=Dt[4]|0,this.F=Dt[5]|0,this.G=Dt[6]|0,this.H=Dt[7]|0}get(){const{A:t,B:e,C:n,D:r,E:s,F:o,G:c,H:l}=this;return[t,e,n,r,s,o,c,l]}set(t,e,n,r,s,o,c,l){this.A=t|0,this.B=e|0,this.C=n|0,this.D=r|0,this.E=s|0,this.F=o|0,this.G=c|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Vt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const p=Vt[d-15],_=Vt[d-2],f=lt(p,7)^lt(p,18)^p>>>3,m=lt(_,17)^lt(_,19)^_>>>10;Vt[d]=m+Vt[d-7]+f+Vt[d-16]|0}let{A:n,B:r,C:s,D:o,E:c,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const p=lt(c,6)^lt(c,11)^lt(c,25),_=h+p+Nm(c,l,u)+Mm[d]+Vt[d]|0,f=(lt(n,2)^lt(n,13)^lt(n,22))+Bm(n,r,s)|0;h=u,u=l,l=c,c=o+_|0,o=s,s=r,r=n,n=_+f|0}n=n+this.A|0,r=r+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,l=l+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(n,r,s,o,c,l,u,h)}roundClean(){it(Vt)}destroy(){this.set(0,0,0,0,0,0,0,0),it(this.buffer)}};const Jl=Bl(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(i=>BigInt(i))),zm=Jl[0],jm=Jl[1],St=new Uint32Array(80),xt=new Uint32Array(80);let ho=class extends Gl{constructor(t=64){super(128,t,16,!1),this.Ah=Ae[0]|0,this.Al=Ae[1]|0,this.Bh=Ae[2]|0,this.Bl=Ae[3]|0,this.Ch=Ae[4]|0,this.Cl=Ae[5]|0,this.Dh=Ae[6]|0,this.Dl=Ae[7]|0,this.Eh=Ae[8]|0,this.El=Ae[9]|0,this.Fh=Ae[10]|0,this.Fl=Ae[11]|0,this.Gh=Ae[12]|0,this.Gl=Ae[13]|0,this.Hh=Ae[14]|0,this.Hl=Ae[15]|0}get(){const{Ah:t,Al:e,Bh:n,Bl:r,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:p,Gh:_,Gl:f,Hh:m,Hl:y}=this;return[t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=r|0,this.Ch=s|0,this.Cl=o|0,this.Dh=c|0,this.Dl=l|0,this.Eh=u|0,this.El=h|0,this.Fh=d|0,this.Fl=p|0,this.Gh=_|0,this.Gl=f|0,this.Hh=m|0,this.Hl=y|0}process(t,e){for(let E=0;E<16;E++,e+=4)St[E]=t.getUint32(e),xt[E]=t.getUint32(e+=4);for(let E=16;E<80;E++){const R=St[E-15]|0,I=xt[E-15]|0,g=Bt(R,I,1)^Bt(R,I,8)^ua(R,I,7),L=Mt(R,I,1)^Mt(R,I,8)^ha(R,I,7),D=St[E-2]|0,w=xt[E-2]|0,v=Bt(D,w,19)^Fi(D,w,61)^ua(D,w,6),b=Mt(D,w,19)^Wi(D,w,61)^ha(D,w,6),A=wm(L,b,xt[E-7],xt[E-16]),V=gm(A,g,v,St[E-7],St[E-16]);St[E]=V|0,xt[E]=A|0}let{Ah:n,Al:r,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:h,Eh:d,El:p,Fh:_,Fl:f,Gh:m,Gl:y,Hh:T,Hl:O}=this;for(let E=0;E<80;E++){const R=Bt(d,p,14)^Bt(d,p,18)^Fi(d,p,41),I=Mt(d,p,14)^Mt(d,p,18)^Wi(d,p,41),g=d&_^~d&m,L=p&f^~p&y,D=Em(O,I,L,jm[E],xt[E]),w=vm(D,T,R,g,zm[E],St[E]),v=D|0,b=Bt(n,r,28)^Fi(n,r,34)^Fi(n,r,39),A=Mt(n,r,28)^Wi(n,r,34)^Wi(n,r,39),V=n&s^n&c^s&c,P=r&o^r&l^o&l;T=m|0,O=y|0,m=_|0,y=f|0,_=d|0,f=p|0,{h:d,l:p}=st(u|0,h|0,w|0,v|0),u=c|0,h=l|0,c=s|0,l=o|0,s=n|0,o=r|0;const S=so(v,A,P);n=oo(S,w,b,V),r=S|0}({h:n,l:r}=st(this.Ah|0,this.Al|0,n|0,r|0)),{h:s,l:o}=st(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=st(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:h}=st(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l:p}=st(this.Eh|0,this.El|0,d|0,p|0),{h:_,l:f}=st(this.Fh|0,this.Fl|0,_|0,f|0),{h:m,l:y}=st(this.Gh|0,this.Gl|0,m|0,y|0),{h:T,l:O}=st(this.Hh|0,this.Hl|0,T|0,O|0),this.set(n,r,s,o,c,l,u,h,d,p,_,f,m,y,T,O)}roundClean(){it(St,xt)}destroy(){it(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Km=class extends ho{constructor(){super(48),this.Ah=Te[0]|0,this.Al=Te[1]|0,this.Bh=Te[2]|0,this.Bl=Te[3]|0,this.Ch=Te[4]|0,this.Cl=Te[5]|0,this.Dh=Te[6]|0,this.Dl=Te[7]|0,this.Eh=Te[8]|0,this.El=Te[9]|0,this.Fh=Te[10]|0,this.Fl=Te[11]|0,this.Gh=Te[12]|0,this.Gl=Te[13]|0,this.Hh=Te[14]|0,this.Hl=Te[15]|0}};const Pe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Fm extends ho{constructor(){super(32),this.Ah=Pe[0]|0,this.Al=Pe[1]|0,this.Bh=Pe[2]|0,this.Bl=Pe[3]|0,this.Ch=Pe[4]|0,this.Cl=Pe[5]|0,this.Dh=Pe[6]|0,this.Dl=Pe[7]|0,this.Eh=Pe[8]|0,this.El=Pe[9]|0,this.Fh=Pe[10]|0,this.Fl=Pe[11]|0,this.Gh=Pe[12]|0,this.Gl=Pe[13]|0,this.Hh=Pe[14]|0,this.Hl=Pe[15]|0}}const cr=yn(()=>new qm),Wm=yn(()=>new ho),Hm=yn(()=>new Km),Gm=yn(()=>new Fm),Jm=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),de=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),q=new Uint32Array(32);function Ct(i,t,e,n,r,s){const o=r[s],c=r[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*n],m=q[2*n+1],y=so(l,h,o);u=oo(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:dm(m,f),Dl:pm(m)},{h:_,l:p}=st(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Bt(d,h,24),Bl:Mt(d,h,24)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*n]=f,q[2*n+1]=m}function $t(i,t,e,n,r,s){const o=r[s],c=r[s+1];let l=q[2*i],u=q[2*i+1],h=q[2*t],d=q[2*t+1],p=q[2*e],_=q[2*e+1],f=q[2*n],m=q[2*n+1],y=so(l,h,o);u=oo(y,u,d,c),l=y|0,{Dh:m,Dl:f}={Dh:m^u,Dl:f^l},{Dh:m,Dl:f}={Dh:Bt(m,f,16),Dl:Mt(m,f,16)},{h:_,l:p}=st(_,p,m,f),{Bh:d,Bl:h}={Bh:d^_,Bl:h^p},{Bh:d,Bl:h}={Bh:Fi(d,h,63),Bl:Wi(d,h,63)},q[2*i]=l,q[2*i+1]=u,q[2*t]=h,q[2*t+1]=d,q[2*e]=p,q[2*e+1]=_,q[2*n]=f,q[2*n+1]=m}function Ym(i,t={},e,n,r){if(Rt(e),i<0||i>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:c}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==n)throw new Error("salt must be undefined or "+n);if(c!==void 0&&c.length!==r)throw new Error("personalization must be undefined or "+r)}class Zm extends ar{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,Rt(t),Rt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=an(this.buffer)}update(t){Ft(this),t=at(t),tt(t);const{blockLen:e,buffer:n,buffer32:r}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(qt(r),this.compress(r,0,!1),qt(r),this.pos=0);const u=Math.min(e-this.pos,s-l),h=o+l;if(u===e&&!(h%4)&&l+u<s){const d=new Uint32Array(c,h,Math.floor((s-l)/4));qt(d);for(let p=0;l+e<s;p+=r.length,l+=e)this.length+=e,this.compress(d,p,!1);qt(d);continue}n.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Ft(this),lo(t,this);const{pos:e,buffer32:n}=this;this.finished=!0,it(this.buffer.subarray(e)),qt(n),this.compress(n,0,!0),qt(n);const r=an(t);this.get().forEach((s,o)=>r[o]=bt(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){const{buffer:e,length:n,finished:r,destroyed:s,outputLen:o,pos:c}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=r,t.length=n,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class Qm extends Zm{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=de[0]|0,this.v0h=de[1]|0,this.v1l=de[2]|0,this.v1h=de[3]|0,this.v2l=de[4]|0,this.v2h=de[5]|0,this.v3l=de[6]|0,this.v3h=de[7]|0,this.v4l=de[8]|0,this.v4h=de[9]|0,this.v5l=de[10]|0,this.v5h=de[11]|0,this.v6l=de[12]|0,this.v6h=de[13]|0,this.v7l=de[14]|0,this.v7h=de[15]|0,Ym(e,t,64,16,16);let{key:n,personalization:r,salt:s}=t,o=0;if(n!==void 0&&(n=at(n),o=n.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=at(s);const c=an(s);this.v4l^=bt(c[0]),this.v4h^=bt(c[1]),this.v5l^=bt(c[2]),this.v5h^=bt(c[3])}if(r!==void 0){r=at(r);const c=an(r);this.v6l^=bt(c[0]),this.v6h^=bt(c[1]),this.v7l^=bt(c[2]),this.v7h^=bt(c[3])}if(n!==void 0){const c=new Uint8Array(this.blockLen);c.set(n),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:n,v1h:r,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:h,v5l:d,v5h:p,v6l:_,v6h:f,v7l:m,v7h:y}=this;return[t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y]}set(t,e,n,r,s,o,c,l,u,h,d,p,_,f,m,y){this.v0l=t|0,this.v0h=e|0,this.v1l=n|0,this.v1h=r|0,this.v2l=s|0,this.v2h=o|0,this.v3l=c|0,this.v3h=l|0,this.v4l=u|0,this.v4h=h|0,this.v5l=d|0,this.v5h=p|0,this.v6l=_|0,this.v6h=f|0,this.v7l=m|0,this.v7h=y|0}compress(t,e,n){this.get().forEach((l,u)=>q[u]=l),q.set(de,16);let{h:r,l:s}=Nl(BigInt(this.length));q[24]=de[8]^s,q[25]=de[9]^r,n&&(q[28]=~q[28],q[29]=~q[29]);let o=0;const c=Jm;for(let l=0;l<12;l++)Ct(0,4,8,12,t,e+2*c[o++]),$t(0,4,8,12,t,e+2*c[o++]),Ct(1,5,9,13,t,e+2*c[o++]),$t(1,5,9,13,t,e+2*c[o++]),Ct(2,6,10,14,t,e+2*c[o++]),$t(2,6,10,14,t,e+2*c[o++]),Ct(3,7,11,15,t,e+2*c[o++]),$t(3,7,11,15,t,e+2*c[o++]),Ct(0,5,10,15,t,e+2*c[o++]),$t(0,5,10,15,t,e+2*c[o++]),Ct(1,6,11,12,t,e+2*c[o++]),$t(1,6,11,12,t,e+2*c[o++]),Ct(2,7,8,13,t,e+2*c[o++]),$t(2,7,8,13,t,e+2*c[o++]),Ct(3,4,9,14,t,e+2*c[o++]),$t(3,4,9,14,t,e+2*c[o++]);this.v0l^=q[0]^q[16],this.v0h^=q[1]^q[17],this.v1l^=q[2]^q[18],this.v1h^=q[3]^q[19],this.v2l^=q[4]^q[20],this.v2h^=q[5]^q[21],this.v3l^=q[6]^q[22],this.v3h^=q[7]^q[23],this.v4l^=q[8]^q[24],this.v4h^=q[9]^q[25],this.v5l^=q[10]^q[26],this.v5h^=q[11]^q[27],this.v6l^=q[12]^q[28],this.v6h^=q[13]^q[29],this.v7l^=q[14]^q[30],this.v7h^=q[15]^q[31],it(q)}destroy(){this.destroyed=!0,it(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Xm=Am(i=>new Qm(i)),ey="https://rpc.walletconnect.org/v1";function Yl(i){const t=`Ethereum Signed Message:
5
5
  ${i.length}`,e=new TextEncoder().encode(t+i);return"0x"+te.from(km(e)).toString("hex")}async function ty(i,t,e,n,r,s){switch(e.t){case"eip191":return await iy(i,t,e.s);case"eip1271":return await ny(i,t,e.s,n,r,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function iy(i,t,e){return(await nf({hash:Yl(t),signature:e})).toLowerCase()===i.toLowerCase()}async function ny(i,t,e,n,r,s){const o=$n(n);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",u=e.substring(2),h=(u.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:Yl(t)).substring(2),p=c+d+l+h+u,_=await fetch(`${s||ey}/?chainId=${n}&projectId=${r}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:ry(),jsonrpc:"2.0",method:"eth_call",params:[{to:i,data:p},"latest"]})}),{result:f}=await _.json();return f?f.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function ry(){return Date.now()+Math.floor(Math.random()*1e3)}function sy(i){const t=atob(i),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const n=e[0];if(n===0)throw new Error("No signatures found");const r=1+n*64;if(e.length<r)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=te.from(i,"base64").slice(1,65);return _n.encode(s)}function oy(i){const t=new Uint8Array(te.from(i,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),n=new Uint8Array(e.length+t.length);n.set(e),n.set(t,e.length);const r=Xm(n,{dkLen:32});return _n.encode(r)}function fa(i){const t=new Uint8Array(cr(ay(i)));return _n.encode(t)}function ay(i){if(i instanceof Uint8Array)return i;if(Array.isArray(i))return new Uint8Array(i);if(typeof i=="object"&&i!=null&&i.data)return new Uint8Array(Object.values(i.data));if(typeof i=="object"&&i)return new Uint8Array(Object.values(i));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function ma(i){const t=te.from(i,"base64"),e=Uf(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const n=Lf(e),r=te.from("TX"),s=te.concat([r,te.from(n)]),o=Gm(s);return ld.encode(o).replace(/=+$/,"")}function Rr(i){const t=[];let e=BigInt(i);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),te.from(t)}function cy(i){const t=te.from(i.signed.bodyBytes,"base64"),e=te.from(i.signed.authInfoBytes,"base64"),n=te.from(i.signature.signature,"base64"),r=[];r.push(te.from([10])),r.push(Rr(t.length)),r.push(t),r.push(te.from([18])),r.push(Rr(e.length)),r.push(e),r.push(te.from([26])),r.push(Rr(n.length)),r.push(n);const s=te.concat(r),o=cr(s);return te.from(o).toString("hex").toUpperCase()}var ly=Object.defineProperty,uy=Object.defineProperties,hy=Object.getOwnPropertyDescriptors,ya=Object.getOwnPropertySymbols,dy=Object.prototype.hasOwnProperty,py=Object.prototype.propertyIsEnumerable,wa=(i,t,e)=>t in i?ly(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,_y=(i,t)=>{for(var e in t||(t={}))dy.call(t,e)&&wa(i,e,t[e]);if(ya)for(var e of ya(t))py.call(t,e)&&wa(i,e,t[e]);return i},fy=(i,t)=>uy(i,hy(t));const my="did:pkh:",po=i=>i?.split(":"),yy=i=>{const t=i&&po(i);if(t)return i.includes(my)?t[3]:t[1]},ls=i=>{const t=i&&po(i);if(t)return t[2]+":"+t[3]},Zn=i=>{const t=i&&po(i);if(t)return t.pop()};async function ga(i){const{cacao:t,projectId:e}=i,{s:n,p:r}=t,s=Zl(r,r.iss),o=Zn(r.iss);return await ty(o,s,n,ls(r.iss),e)}const Zl=(i,t)=>{const e=`${i.domain} wants you to sign in with your Ethereum account:`,n=Zn(t);if(!i.aud&&!i.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let r=i.statement||void 0;const s=`URI: ${i.aud||i.uri}`,o=`Version: ${i.version}`,c=`Chain ID: ${yy(t)}`,l=`Nonce: ${i.nonce}`,u=`Issued At: ${i.iat}`,h=i.exp?`Expiration Time: ${i.exp}`:void 0,d=i.nbf?`Not Before: ${i.nbf}`:void 0,p=i.requestId?`Request ID: ${i.requestId}`:void 0,_=i.resources?`Resources:${i.resources.map(m=>`
6
6
  - ${m}`).join("")}`:void 0,f=kn(i.resources);if(f){const m=ln(f);r=Py(r,m)}return[e,n,"",r,"",s,o,c,l,u,h,d,p,_].filter(m=>m!=null).join(`
7
7
  `)};function wy(i){return te.from(JSON.stringify(i)).toString("base64")}function gy(i){return JSON.parse(te.from(i,"base64").toString("utf-8"))}function oi(i){if(!i)throw new Error("No recap provided, value is undefined");if(!i.att)throw new Error("No `att` property found");const t=Object.keys(i.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const n=i.att[e];if(Array.isArray(n))throw new Error(`Resource must be an object: ${e}`);if(typeof n!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(n).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(n).forEach(r=>{const s=n[r];if(!Array.isArray(s))throw new Error(`Ability limits ${r} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${r} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${r}) must be an array of objects, found: ${o}`)})})})}function Ey(i,t,e,n={}){return e?.sort((r,s)=>r.localeCompare(s)),{att:{[i]:vy(t,e,n)}}}function vy(i,t,e={}){t=t?.sort((r,s)=>r.localeCompare(s));const n=t.map(r=>({[`${i}/${r}`]:[e]}));return Object.assign({},...n)}function Ql(i){return oi(i),`urn:recap:${wy(i).replace(/=/g,"")}`}function ln(i){const t=gy(i.replace("urn:recap:",""));return oi(t),t}function by(i,t,e){const n=Ey(i,t,e);return Ql(n)}function Iy(i){return i&&i.includes("urn:recap:")}function Ty(i,t){const e=ln(i),n=ln(t),r=Ay(e,n);return Ql(r)}function Ay(i,t){oi(i),oi(t);const e=Object.keys(i.att).concat(Object.keys(t.att)).sort((r,s)=>r.localeCompare(s)),n={att:{}};return e.forEach(r=>{var s,o;Object.keys(((s=i.att)==null?void 0:s[r])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[r])||{})).sort((c,l)=>c.localeCompare(l)).forEach(c=>{var l,u;n.att[r]=fy(_y({},n.att[r]),{[c]:((l=i.att[r])==null?void 0:l[c])||((u=t.att[r])==null?void 0:u[c])})})}),n}function Py(i="",t){oi(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(i.includes(e))return i;const n=[];let r=0;Object.keys(t.att).forEach(c=>{const l=Object.keys(t.att[c]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));l.sort((d,p)=>d.action.localeCompare(p.action));const u={};l.forEach(d=>{u[d.ability]||(u[d.ability]=[]),u[d.ability].push(d.action)});const h=Object.keys(u).map(d=>(r++,`(${r}) '${d}': '${u[d].join("', '")}' for '${c}'.`));n.push(h.join(", ").replace(".,","."))});const s=n.join(" "),o=`${e}${s}`;return`${i?i+" ":""}${o}`}function Ea(i){var t;const e=ln(i);oi(e);const n=(t=e.att)==null?void 0:t.eip155;return n?Object.keys(n).map(r=>r.split("/")[1]):[]}function va(i){const t=ln(i);oi(t);const e=[];return Object.values(t.att).forEach(n=>{Object.values(n).forEach(r=>{var s;(s=r?.[0])!=null&&s.chains&&e.push(r[0].chains)})}),[...new Set(e.flat())]}function kn(i){if(!i)return;const t=i?.[i.length-1];return Iy(t)?t:void 0}function Xl(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function us(i){if(typeof i!="boolean")throw new Error(`boolean expected, not ${i}`)}function Lr(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function Ne(i,...t){if(!Xl(i))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(i.length))throw new Error("Uint8Array expected of length "+t+", got length="+i.length)}function ba(i,t=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(t&&i.finished)throw new Error("Hash#digest() has already been called")}function Oy(i,t){Ne(i);const e=t.outputLen;if(i.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Kt(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function vi(...i){for(let t=0;t<i.length;t++)i[t].fill(0)}function Ry(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}const Ly=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Dy(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function hs(i){if(typeof i=="string")i=Dy(i);else if(Xl(i))i=ds(i);else throw new Error("Uint8Array expected, got "+typeof i);return i}function Vy(i,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(i,t)}function Sy(i,t){if(i.length!==t.length)return!1;let e=0;for(let n=0;n<i.length;n++)e|=i[n]^t[n];return e===0}const xy=(i,t)=>{function e(n,...r){if(Ne(n),!Ly)throw new Error("Non little-endian hardware is not yet supported");if(i.nonceLength!==void 0){const u=r[0];if(!u)throw new Error("nonce / iv required");i.varSizeNonce?Ne(u):Ne(u,i.nonceLength)}const s=i.tagLength;s&&r[1]!==void 0&&Ne(r[1]);const o=t(n,...r),c=(u,h)=>{if(h!==void 0){if(u!==2)throw new Error("cipher output not supported");Ne(h)}};let l=!1;return{encrypt(u,h){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,Ne(u),c(o.encrypt.length,h),o.encrypt(u,h)},decrypt(u,h){if(Ne(u),s&&u.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return c(o.decrypt.length,h),o.decrypt(u,h)}}}return Object.assign(e,i),e};function Ia(i,t,e=!0){if(t===void 0)return new Uint8Array(i);if(t.length!==i)throw new Error("invalid output length, expected "+i+", got: "+t.length);if(e&&!$y(t))throw new Error("invalid output, must be aligned");return t}function Ta(i,t,e,n){if(typeof i.setBigUint64=="function")return i.setBigUint64(t,e,n);const r=BigInt(32),s=BigInt(4294967295),o=Number(e>>r&s),c=Number(e&s);i.setUint32(t+4,o,n),i.setUint32(t+0,c,n)}function Cy(i,t,e){us(e);const n=new Uint8Array(16),r=Ry(n);return Ta(r,0,BigInt(t),e),Ta(r,8,BigInt(i),e),n}function $y(i){return i.byteOffset%4===0}function ds(i){return Uint8Array.from(i)}const eu=i=>Uint8Array.from(i.split("").map(t=>t.charCodeAt(0))),ky=eu("expand 16-byte k"),Uy=eu("expand 32-byte k"),Ny=Kt(ky),By=Kt(Uy);function Z(i,t){return i<<t|i>>>32-t}function ps(i){return i.byteOffset%4===0}const On=64,My=16,tu=2**32-1,Aa=new Uint32Array;function qy(i,t,e,n,r,s,o,c){const l=r.length,u=new Uint8Array(On),h=Kt(u),d=ps(r)&&ps(s),p=d?Kt(r):Aa,_=d?Kt(s):Aa;for(let f=0;f<l;o++){if(i(t,e,n,h,o,c),o>=tu)throw new Error("arx: counter overflow");const m=Math.min(On,l-f);if(d&&m===On){const y=f/4;if(f%4!==0)throw new Error("arx: invalid block position");for(let T=0,O;T<My;T++)O=y+T,_[O]=p[O]^h[T];f+=On;continue}for(let y=0,T;y<m;y++)T=f+y,s[T]=r[T]^u[y];f+=m}}function zy(i,t){const{allowShortKeys:e,extendNonceFn:n,counterLength:r,counterRight:s,rounds:o}=Vy({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof i!="function")throw new Error("core must be a function");return Lr(r),Lr(o),us(s),us(e),(c,l,u,h,d=0)=>{Ne(c),Ne(l),Ne(u);const p=u.length;if(h===void 0&&(h=new Uint8Array(p)),Ne(h),Lr(d),d<0||d>=tu)throw new Error("arx: counter overflow");if(h.length<p)throw new Error(`arx: output (${h.length}) is shorter than data (${p})`);const _=[];let f=c.length,m,y;if(f===32)_.push(m=ds(c)),y=By;else if(f===16&&e)m=new Uint8Array(32),m.set(c),m.set(c,16),y=Ny,_.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${f}`);ps(l)||_.push(l=ds(l));const T=Kt(m);if(n){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");n(y,T,Kt(l.subarray(0,16)),T),l=l.subarray(16)}const O=16-r;if(O!==l.length)throw new Error(`arx: nonce must be ${O} or 16 bytes`);if(O!==12){const R=new Uint8Array(12);R.set(l,s?0:12-l.length),l=R,_.push(l)}const E=Kt(l);return qy(i,y,T,E,u,h,d,o),vi(..._),h}}const ge=(i,t)=>i[t++]&255|(i[t++]&255)<<8;class jy{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=hs(t),Ne(t,32);const e=ge(t,0),n=ge(t,2),r=ge(t,4),s=ge(t,6),o=ge(t,8),c=ge(t,10),l=ge(t,12),u=ge(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|n<<3)&8191,this.r[2]=(n>>>10|r<<6)&7939,this.r[3]=(r>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|c<<2)&8191,this.r[7]=(c>>>11|l<<5)&8065,this.r[8]=(l>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let h=0;h<8;h++)this.pad[h]=ge(t,16+2*h)}process(t,e,n=!1){const r=n?0:2048,{h:s,r:o}=this,c=o[0],l=o[1],u=o[2],h=o[3],d=o[4],p=o[5],_=o[6],f=o[7],m=o[8],y=o[9],T=ge(t,e+0),O=ge(t,e+2),E=ge(t,e+4),R=ge(t,e+6),I=ge(t,e+8),g=ge(t,e+10),L=ge(t,e+12),D=ge(t,e+14);let w=s[0]+(T&8191),v=s[1]+((T>>>13|O<<3)&8191),b=s[2]+((O>>>10|E<<6)&8191),A=s[3]+((E>>>7|R<<9)&8191),V=s[4]+((R>>>4|I<<12)&8191),P=s[5]+(I>>>1&8191),S=s[6]+((I>>>14|g<<2)&8191),$=s[7]+((g>>>11|L<<5)&8191),k=s[8]+((L>>>8|D<<8)&8191),M=s[9]+(D>>>5|r),C=0,U=C+w*c+v*(5*y)+b*(5*m)+A*(5*f)+V*(5*_);C=U>>>13,U&=8191,U+=P*(5*p)+S*(5*d)+$*(5*h)+k*(5*u)+M*(5*l),C+=U>>>13,U&=8191;let z=C+w*l+v*c+b*(5*y)+A*(5*m)+V*(5*f);C=z>>>13,z&=8191,z+=P*(5*_)+S*(5*p)+$*(5*d)+k*(5*h)+M*(5*u),C+=z>>>13,z&=8191;let j=C+w*u+v*l+b*c+A*(5*y)+V*(5*m);C=j>>>13,j&=8191,j+=P*(5*f)+S*(5*_)+$*(5*p)+k*(5*d)+M*(5*h),C+=j>>>13,j&=8191;let K=C+w*h+v*u+b*l+A*c+V*(5*y);C=K>>>13,K&=8191,K+=P*(5*m)+S*(5*f)+$*(5*_)+k*(5*p)+M*(5*d),C+=K>>>13,K&=8191;let F=C+w*d+v*h+b*u+A*l+V*c;C=F>>>13,F&=8191,F+=P*(5*y)+S*(5*m)+$*(5*f)+k*(5*_)+M*(5*p),C+=F>>>13,F&=8191;let W=C+w*p+v*d+b*h+A*u+V*l;C=W>>>13,W&=8191,W+=P*c+S*(5*y)+$*(5*m)+k*(5*f)+M*(5*_),C+=W>>>13,W&=8191;let H=C+w*_+v*p+b*d+A*h+V*u;C=H>>>13,H&=8191,H+=P*l+S*c+$*(5*y)+k*(5*m)+M*(5*f),C+=H>>>13,H&=8191;let le=C+w*f+v*_+b*p+A*d+V*h;C=le>>>13,le&=8191,le+=P*u+S*l+$*c+k*(5*y)+M*(5*m),C+=le>>>13,le&=8191;let ae=C+w*m+v*f+b*_+A*p+V*d;C=ae>>>13,ae&=8191,ae+=P*h+S*u+$*l+k*c+M*(5*y),C+=ae>>>13,ae&=8191;let se=C+w*y+v*m+b*f+A*_+V*p;C=se>>>13,se&=8191,se+=P*d+S*h+$*u+k*l+M*c,C+=se>>>13,se&=8191,C=(C<<2)+C|0,C=C+U|0,U=C&8191,C=C>>>13,z+=C,s[0]=U,s[1]=z,s[2]=j,s[3]=K,s[4]=F,s[5]=W,s[6]=H,s[7]=le,s[8]=ae,s[9]=se}finalize(){const{h:t,pad:e}=this,n=new Uint16Array(10);let r=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=r,r=t[c]>>>13,t[c]&=8191;t[0]+=r*5,r=t[0]>>>13,t[0]&=8191,t[1]+=r,r=t[1]>>>13,t[1]&=8191,t[2]+=r,n[0]=t[0]+5,r=n[0]>>>13,n[0]&=8191;for(let c=1;c<10;c++)n[c]=t[c]+r,r=n[c]>>>13,n[c]&=8191;n[9]-=8192;let s=(r^1)-1;for(let c=0;c<10;c++)n[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|n[c];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let c=1;c<8;c++)o=(t[c]+e[c]|0)+(o>>>16)|0,t[c]=o&65535;vi(n)}update(t){ba(this),t=hs(t),Ne(t);const{buffer:e,blockLen:n}=this,r=t.length;for(let s=0;s<r;){const o=Math.min(n-this.pos,r-s);if(o===n){for(;n<=r-s;s+=n)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){vi(this.h,this.r,this.buffer,this.pad)}digestInto(t){ba(this),Oy(t,this),this.finished=!0;const{buffer:e,h:n}=this;let{pos:r}=this;if(r){for(e[r++]=1;r<16;r++)e[r]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=n[o]>>>0,t[s++]=n[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const n=t.slice(0,e);return this.destroy(),n}}function Ky(i){const t=(n,r)=>i(r).update(hs(n)).digest(),e=i(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>i(n),t}const Fy=Ky(i=>new jy(i));function Wy(i,t,e,n,r,s=20){let o=i[0],c=i[1],l=i[2],u=i[3],h=t[0],d=t[1],p=t[2],_=t[3],f=t[4],m=t[5],y=t[6],T=t[7],O=r,E=e[0],R=e[1],I=e[2],g=o,L=c,D=l,w=u,v=h,b=d,A=p,V=_,P=f,S=m,$=y,k=T,M=O,C=E,U=R,z=I;for(let K=0;K<s;K+=2)g=g+v|0,M=Z(M^g,16),P=P+M|0,v=Z(v^P,12),g=g+v|0,M=Z(M^g,8),P=P+M|0,v=Z(v^P,7),L=L+b|0,C=Z(C^L,16),S=S+C|0,b=Z(b^S,12),L=L+b|0,C=Z(C^L,8),S=S+C|0,b=Z(b^S,7),D=D+A|0,U=Z(U^D,16),$=$+U|0,A=Z(A^$,12),D=D+A|0,U=Z(U^D,8),$=$+U|0,A=Z(A^$,7),w=w+V|0,z=Z(z^w,16),k=k+z|0,V=Z(V^k,12),w=w+V|0,z=Z(z^w,8),k=k+z|0,V=Z(V^k,7),g=g+b|0,z=Z(z^g,16),$=$+z|0,b=Z(b^$,12),g=g+b|0,z=Z(z^g,8),$=$+z|0,b=Z(b^$,7),L=L+A|0,M=Z(M^L,16),k=k+M|0,A=Z(A^k,12),L=L+A|0,M=Z(M^L,8),k=k+M|0,A=Z(A^k,7),D=D+V|0,C=Z(C^D,16),P=P+C|0,V=Z(V^P,12),D=D+V|0,C=Z(C^D,8),P=P+C|0,V=Z(V^P,7),w=w+v|0,U=Z(U^w,16),S=S+U|0,v=Z(v^S,12),w=w+v|0,U=Z(U^w,8),S=S+U|0,v=Z(v^S,7);let j=0;n[j++]=o+g|0,n[j++]=c+L|0,n[j++]=l+D|0,n[j++]=u+w|0,n[j++]=h+v|0,n[j++]=d+b|0,n[j++]=p+A|0,n[j++]=_+V|0,n[j++]=f+P|0,n[j++]=m+S|0,n[j++]=y+$|0,n[j++]=T+k|0,n[j++]=O+M|0,n[j++]=E+C|0,n[j++]=R+U|0,n[j++]=I+z|0}const Hy=zy(Wy,{counterRight:!1,counterLength:4,allowShortKeys:!1}),Gy=new Uint8Array(16),Pa=(i,t)=>{i.update(t);const e=t.length%16;e&&i.update(Gy.subarray(e))},Jy=new Uint8Array(32);function Oa(i,t,e,n,r){const s=i(t,e,Jy),o=Fy.create(s);r&&Pa(o,r),Pa(o,n);const c=Cy(n.length,r?r.length:0,!0);o.update(c);const l=o.digest();return vi(s,c),l}const Yy=i=>(t,e,n)=>({encrypt(r,s){const o=r.length;s=Ia(o+16,s,!1),s.set(r);const c=s.subarray(0,-16);i(t,e,c,c,1);const l=Oa(i,t,e,c,n);return s.set(l,o),vi(l),s},decrypt(r,s){s=Ia(r.length-16,s,!1);const o=r.subarray(0,-16),c=r.subarray(-16),l=Oa(i,t,e,o,n);if(!Sy(c,l))throw new Error("invalid tag");return s.set(r.subarray(0,-16)),i(t,e,s,s,1),vi(l),s}}),iu=xy({blockSize:64,nonceLength:12,tagLength:16},Yy(Hy));let nu=class extends ar{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,co(t);const n=at(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const r=this.blockLen,s=new Uint8Array(r);s.set(n.length>r?t.create().update(n).digest():n);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),it(s)}update(t){return Ft(this),this.iHash.update(t),this}digestInto(t){Ft(this),tt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:n,finished:r,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=r,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const lr=(i,t,e)=>new nu(i,t).update(e).digest();lr.create=(i,t)=>new nu(i,t);function Zy(i,t,e){return co(i),e===void 0&&(e=new Uint8Array(i.outputLen)),lr(i,at(e),at(t))}const Dr=Uint8Array.from([0]),Ra=Uint8Array.of();function Qy(i,t,e,n=32){co(i),Rt(n);const r=i.outputLen;if(n>255*r)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(n/r);e===void 0&&(e=Ra);const o=new Uint8Array(s*r),c=lr.create(i,t),l=c._cloneInto(),u=new Uint8Array(c.outputLen);for(let h=0;h<s;h++)Dr[0]=h+1,l.update(h===0?Ra:u).update(e).update(Dr).digestInto(u),o.set(u,r*h),c._cloneInto(l);return c.destroy(),l.destroy(),it(u,Dr),o.slice(0,n)}const Xy=(i,t,e,n,r)=>Qy(i,Zy(i,t,e),n,r),ur=cr,_o=BigInt(0),_s=BigInt(1);function Qn(i,t){if(typeof t!="boolean")throw new Error(i+" boolean expected, got "+t)}function Rn(i){const t=i.toString(16);return t.length&1?"0"+t:t}function ru(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return i===""?_o:BigInt("0x"+i)}function hr(i){return ru(cn(i))}function Xn(i){return tt(i),ru(cn(Uint8Array.from(i).reverse()))}function fo(i,t){return uo(i.toString(16).padStart(t*2,"0"))}function mo(i,t){return fo(i,t).reverse()}function Ue(i,t,e){let n;if(typeof t=="string")try{n=uo(t)}catch(s){throw new Error(i+" must be hex string or Uint8Array, cause: "+s)}else if(ao(t))n=Uint8Array.from(t);else throw new Error(i+" must be hex string or Uint8Array");const r=n.length;if(typeof e=="number"&&r!==e)throw new Error(i+" of length "+e+" expected, got "+r);return n}const Vr=i=>typeof i=="bigint"&&_o<=i;function ew(i,t,e){return Vr(i)&&Vr(t)&&Vr(e)&&t<=i&&i<e}function fs(i,t,e,n){if(!ew(t,e,n))throw new Error("expected valid "+i+": "+e+" <= n < "+n+", got "+t)}function tw(i){let t;for(t=0;i>_o;i>>=_s,t+=1);return t}const dr=i=>(_s<<BigInt(i))-_s;function iw(i,t,e){if(typeof i!="number"||i<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");const n=p=>new Uint8Array(p),r=p=>Uint8Array.of(p);let s=n(i),o=n(i),c=0;const l=()=>{s.fill(1),o.fill(0),c=0},u=(...p)=>e(o,s,...p),h=(p=n(0))=>{o=u(r(0),p),s=u(),p.length!==0&&(o=u(r(1),p),s=u())},d=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const _=[];for(;p<t;){s=u();const f=s.slice();_.push(f),p+=s.length}return ei(..._)};return(p,_)=>{l(),h(p);let f;for(;!(f=_(d()));)h();return l(),f}}function pr(i,t,e={}){if(!i||typeof i!="object")throw new Error("expected valid options object");function n(r,s,o){const c=i[r];if(o&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${r}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([r,s])=>n(r,s,!1)),Object.entries(e).forEach(([r,s])=>n(r,s,!0))}function La(i){const t=new WeakMap;return(e,...n)=>{const r=t.get(e);if(r!==void 0)return r;const s=i(e,...n);return t.set(e,s),s}}const qe=BigInt(0),Ve=BigInt(1),ti=BigInt(2),nw=BigInt(3),su=BigInt(4),ou=BigInt(5),au=BigInt(8);function Xe(i,t){const e=i%t;return e>=qe?e:t+e}function rt(i,t,e){let n=i;for(;t-- >qe;)n*=n,n%=e;return n}function Da(i,t){if(i===qe)throw new Error("invert: expected non-zero number");if(t<=qe)throw new Error("invert: expected positive modulus, got "+t);let e=Xe(i,t),n=t,r=qe,s=Ve;for(;e!==qe;){const o=n/e,c=n%e,l=r-s*o;n=e,e=c,r=s,s=l}if(n!==Ve)throw new Error("invert: does not exist");return Xe(r,t)}function cu(i,t){const e=(i.ORDER+Ve)/su,n=i.pow(t,e);if(!i.eql(i.sqr(n),t))throw new Error("Cannot find square root");return n}function rw(i,t){const e=(i.ORDER-ou)/au,n=i.mul(t,ti),r=i.pow(n,e),s=i.mul(t,r),o=i.mul(i.mul(s,ti),r),c=i.mul(s,i.sub(o,i.ONE));if(!i.eql(i.sqr(c),t))throw new Error("Cannot find square root");return c}function sw(i){if(i<BigInt(3))throw new Error("sqrt is not defined for small field");let t=i-Ve,e=0;for(;t%ti===qe;)t/=ti,e++;let n=ti;const r=Vi(i);for(;Va(r,n)===1;)if(n++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return cu;let s=r.pow(n,t);const o=(t+Ve)/ti;return function(c,l){if(c.is0(l))return l;if(Va(c,l)!==1)throw new Error("Cannot find square root");let u=e,h=c.mul(c.ONE,s),d=c.pow(l,t),p=c.pow(l,o);for(;!c.eql(d,c.ONE);){if(c.is0(d))return c.ZERO;let _=1,f=c.sqr(d);for(;!c.eql(f,c.ONE);)if(_++,f=c.sqr(f),_===u)throw new Error("Cannot find square root");const m=Ve<<BigInt(u-_-1),y=c.pow(h,m);u=_,h=c.sqr(y),d=c.mul(d,h),p=c.mul(p,y)}return p}}function ow(i){return i%su===nw?cu:i%au===ou?rw:sw(i)}const aw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function cw(i){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=aw.reduce((n,r)=>(n[r]="function",n),t);return pr(i,e),i}function lw(i,t,e){if(e<qe)throw new Error("invalid exponent, negatives unsupported");if(e===qe)return i.ONE;if(e===Ve)return t;let n=i.ONE,r=t;for(;e>qe;)e&Ve&&(n=i.mul(n,r)),r=i.sqr(r),e>>=Ve;return n}function lu(i,t,e=!1){const n=new Array(t.length).fill(e?i.ZERO:void 0),r=t.reduce((o,c,l)=>i.is0(c)?o:(n[l]=o,i.mul(o,c)),i.ONE),s=i.inv(r);return t.reduceRight((o,c,l)=>i.is0(c)?o:(n[l]=i.mul(o,n[l]),i.mul(o,c)),s),n}function Va(i,t){const e=(i.ORDER-Ve)/ti,n=i.pow(t,e),r=i.eql(n,i.ONE),s=i.eql(n,i.ZERO),o=i.eql(n,i.neg(i.ONE));if(!r&&!s&&!o)throw new Error("invalid Legendre symbol result");return r?1:s?0:-1}function uw(i,t){t!==void 0&&Rt(t);const e=t!==void 0?t:i.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Vi(i,t,e=!1,n={}){if(i<=qe)throw new Error("invalid field: expected ORDER > 0, got "+i);let r,s;if(typeof t=="object"&&t!=null){if(n.sqrt||e)throw new Error("cannot specify opts in two arguments");const h=t;h.BITS&&(r=h.BITS),h.sqrt&&(s=h.sqrt),typeof h.isLE=="boolean"&&(e=h.isLE)}else typeof t=="number"&&(r=t),n.sqrt&&(s=n.sqrt);const{nBitLength:o,nByteLength:c}=uw(i,r);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:i,isLE:e,BITS:o,BYTES:c,MASK:dr(o),ZERO:qe,ONE:Ve,create:h=>Xe(h,i),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return qe<=h&&h<i},is0:h=>h===qe,isValidNot0:h=>!u.is0(h)&&u.isValid(h),isOdd:h=>(h&Ve)===Ve,neg:h=>Xe(-h,i),eql:(h,d)=>h===d,sqr:h=>Xe(h*h,i),add:(h,d)=>Xe(h+d,i),sub:(h,d)=>Xe(h-d,i),mul:(h,d)=>Xe(h*d,i),pow:(h,d)=>lw(u,h,d),div:(h,d)=>Xe(h*Da(d,i),i),sqrN:h=>h*h,addN:(h,d)=>h+d,subN:(h,d)=>h-d,mulN:(h,d)=>h*d,inv:h=>Da(h,i),sqrt:s||(h=>(l||(l=ow(i)),l(u,h))),toBytes:h=>e?mo(h,c):fo(h,c),fromBytes:h=>{if(h.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+h.length);return e?Xn(h):hr(h)},invertBatch:h=>lu(u,h),cmov:(h,d,p)=>p?d:h});return Object.freeze(u)}function uu(i){if(typeof i!="bigint")throw new Error("field order must be bigint");const t=i.toString(2).length;return Math.ceil(t/8)}function hu(i){const t=uu(i);return t+Math.ceil(t/2)}function hw(i,t,e=!1){const n=i.length,r=uu(t),s=hu(t);if(n<16||n<s||n>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+n);const o=e?Xn(i):hr(i),c=Xe(o,t-Ve)+Ve;return e?mo(c,r):fo(c,r)}const bi=BigInt(0),ii=BigInt(1);function Yi(i,t){const e=t.negate();return i?e:t}function dw(i,t,e){const n=s=>s.pz,r=lu(i.Fp,e.map(n));return e.map((s,o)=>s.toAffine(r[o])).map(i.fromAffine)}function du(i,t){if(!Number.isSafeInteger(i)||i<=0||i>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+i)}function Sr(i,t){du(i,t);const e=Math.ceil(t/i)+1,n=2**(i-1),r=2**i,s=dr(i),o=BigInt(i);return{windows:e,windowSize:n,mask:s,maxNumber:r,shiftBy:o}}function Sa(i,t,e){const{windowSize:n,mask:r,maxNumber:s,shiftBy:o}=e;let c=Number(i&r),l=i>>o;c>n&&(c-=s,l+=ii);const u=t*n,h=u+Math.abs(c)-1,d=c===0,p=c<0,_=t%2!==0;return{nextN:l,offset:h,isZero:d,isNeg:p,isNegF:_,offsetF:u}}function pw(i,t){if(!Array.isArray(i))throw new Error("array expected");i.forEach((e,n)=>{if(!(e instanceof t))throw new Error("invalid point at index "+n)})}function _w(i,t){if(!Array.isArray(i))throw new Error("array of scalars expected");i.forEach((e,n)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+n)})}const xr=new WeakMap,pu=new WeakMap;function Cr(i){return pu.get(i)||1}function xa(i){if(i!==bi)throw new Error("invalid wNAF")}function fw(i,t){return{constTimeNegate:Yi,hasPrecomputes(e){return Cr(e)!==1},unsafeLadder(e,n,r=i.ZERO){let s=e;for(;n>bi;)n&ii&&(r=r.add(s)),s=s.double(),n>>=ii;return r},precomputeWindow(e,n){const{windows:r,windowSize:s}=Sr(n,t),o=[];let c=e,l=c;for(let u=0;u<r;u++){l=c,o.push(l);for(let h=1;h<s;h++)l=l.add(c),o.push(l);c=l.double()}return o},wNAF(e,n,r){let s=i.ZERO,o=i.BASE;const c=Sr(e,t);for(let l=0;l<c.windows;l++){const{nextN:u,offset:h,isZero:d,isNeg:p,isNegF:_,offsetF:f}=Sa(r,l,c);r=u,d?o=o.add(Yi(_,n[f])):s=s.add(Yi(p,n[h]))}return xa(r),{p:s,f:o}},wNAFUnsafe(e,n,r,s=i.ZERO){const o=Sr(e,t);for(let c=0;c<o.windows&&r!==bi;c++){const{nextN:l,offset:u,isZero:h,isNeg:d}=Sa(r,c,o);if(r=l,!h){const p=n[u];s=s.add(d?p.negate():p)}}return xa(r),s},getPrecomputes(e,n,r){let s=xr.get(n);return s||(s=this.precomputeWindow(n,e),e!==1&&(typeof r=="function"&&(s=r(s)),xr.set(n,s))),s},wNAFCached(e,n,r){const s=Cr(e);return this.wNAF(s,this.getPrecomputes(s,e,r),n)},wNAFCachedUnsafe(e,n,r,s){const o=Cr(e);return o===1?this.unsafeLadder(e,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,r),n,s)},setWindowSize(e,n){du(n,t),pu.set(e,n),xr.delete(e)}}}function mw(i,t,e,n){let r=t,s=i.ZERO,o=i.ZERO;for(;e>bi||n>bi;)e&ii&&(s=s.add(r)),n&ii&&(o=o.add(r)),r=r.double(),e>>=ii,n>>=ii;return{p1:s,p2:o}}function yw(i,t,e,n){pw(e,i),_w(n,t);const r=e.length,s=n.length;if(r!==s)throw new Error("arrays of points and scalars must have equal length");const o=i.ZERO,c=tw(BigInt(r));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const u=dr(l),h=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/l)*l;let p=o;for(let _=d;_>=0;_-=l){h.fill(o);for(let m=0;m<s;m++){const y=n[m],T=Number(y>>BigInt(_)&u);h[T]=h[T].add(e[m])}let f=o;for(let m=h.length-1,y=o;m>0;m--)y=y.add(h[m]),f=f.add(y);if(p=p.add(f),_!==0)for(let m=0;m<l;m++)p=p.double()}return p}function Ca(i,t){if(t){if(t.ORDER!==i)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return cw(t),t}else return Vi(i)}function ww(i,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${i} CURVE object`);for(const o of["p","n","h"]){const c=t[o];if(!(typeof c=="bigint"&&c>bi))throw new Error(`CURVE.${o} must be positive bigint`)}const n=Ca(t.p,e.Fp),r=Ca(t.n,e.Fn),s=["Gx","Gy","a","b"];for(const o of s)if(!n.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:n,Fn:r}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const Ui=BigInt(0),fi=BigInt(1),Ln=BigInt(2);function gw(i){return pr(i,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...i})}function Ew(i){const t=gw(i),{P:e,type:n,adjustScalarBytes:r,powPminus2:s,randomBytes:o}=t,c=n==="x25519";if(!c&&n!=="x448")throw new Error("invalid type");const l=o||Di,u=c?255:448,h=c?32:56,d=BigInt(c?9:5),p=BigInt(c?121665:39081),_=c?Ln**BigInt(254):Ln**BigInt(447),f=c?BigInt(8)*Ln**BigInt(251)-fi:BigInt(4)*Ln**BigInt(445)-fi,m=_+f+fi,y=w=>Xe(w,e),T=O(d);function O(w){return mo(y(w),h)}function E(w){const v=Ue("u coordinate",w,h);return c&&(v[31]&=127),y(Xn(v))}function R(w){return Xn(r(Ue("scalar",w,h)))}function I(w,v){const b=D(E(v),R(w));if(b===Ui)throw new Error("invalid private or public key received");return O(b)}function g(w){return I(w,T)}function L(w,v,b){const A=y(w*(v-b));return v=y(v-A),b=y(b+A),{x_2:v,x_3:b}}function D(w,v){fs("u",w,Ui,e),fs("scalar",v,_,m);const b=v,A=w;let V=fi,P=Ui,S=w,$=fi,k=Ui;for(let C=BigInt(u-1);C>=Ui;C--){const U=b>>C&fi;k^=U,{x_2:V,x_3:S}=L(k,V,S),{x_2:P,x_3:$}=L(k,P,$),k=U;const z=V+P,j=y(z*z),K=V-P,F=y(K*K),W=j-F,H=S+$,le=S-$,ae=y(le*z),se=y(H*K),Ge=ae+se,wt=ae-se;S=y(Ge*Ge),$=y(A*y(wt*wt)),V=y(j*F),P=y(W*(j+y(p*W)))}({x_2:V,x_3:S}=L(k,V,S)),{x_2:P,x_3:$}=L(k,P,$);const M=s(P);return y(V*M)}return{scalarMult:I,scalarMultBase:g,getSharedSecret:(w,v)=>I(w,v),getPublicKey:w=>g(w),utils:{randomPrivateKey:()=>l(h)},GuBytes:T.slice()}}BigInt(0);const vw=BigInt(1),$a=BigInt(2),bw=BigInt(3),Iw=BigInt(5);BigInt(8);const _u={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Tw(i){const t=BigInt(10),e=BigInt(20),n=BigInt(40),r=BigInt(80),s=_u.p,o=i*i%s*i%s,c=rt(o,$a,s)*o%s,l=rt(c,vw,s)*i%s,u=rt(l,Iw,s)*l%s,h=rt(u,t,s)*u%s,d=rt(h,e,s)*h%s,p=rt(d,n,s)*d%s,_=rt(p,r,s)*p%s,f=rt(_,r,s)*p%s,m=rt(f,t,s)*u%s;return{pow_p_5_8:rt(m,$a,s)*i%s,b2:o}}function Aw(i){return i[0]&=248,i[31]&=127,i[31]|=64,i}const ms=(()=>{const i=_u.p;return Ew({P:i,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:n}=Tw(t);return Xe(rt(e,bw,i)*n,i)},adjustScalarBytes:Aw})})();function ka(i){i.lowS!==void 0&&Qn("lowS",i.lowS),i.prehash!==void 0&&Qn("prehash",i.prehash)}class Pw extends Error{constructor(t=""){super(t)}}const Tt={Err:Pw,_tlv:{encode:(i,t)=>{const{Err:e}=Tt;if(i<0||i>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const n=t.length/2,r=Rn(n);if(r.length/2&128)throw new e("tlv.encode: long form length too big");const s=n>127?Rn(r.length/2|128):"";return Rn(i)+s+r+t},decode(i,t){const{Err:e}=Tt;let n=0;if(i<0||i>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[n++]!==i)throw new e("tlv.decode: wrong tlv");const r=t[n++],s=!!(r&128);let o=0;if(!s)o=r;else{const l=r&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const u=t.subarray(n,n+l);if(u.length!==l)throw new e("tlv.decode: length bytes not complete");if(u[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const h of u)o=o<<8|h;if(n+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(n,n+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(n+o)}}},_int:{encode(i){const{Err:t}=Tt;if(i<Zi)throw new t("integer: negative integers are not allowed");let e=Rn(i);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(i){const{Err:t}=Tt;if(i[0]&128)throw new t("invalid signature integer: negative");if(i[0]===0&&!(i[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return hr(i)}},toSig(i){const{Err:t,_int:e,_tlv:n}=Tt,r=Ue("signature",i),{v:s,l:o}=n.decode(48,r);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=n.decode(2,s),{v:u,l:h}=n.decode(2,l);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(c),s:e.decode(u)}},hexFromSig(i){const{_tlv:t,_int:e}=Tt,n=t.encode(2,e.encode(i.r)),r=t.encode(2,e.encode(i.s)),s=n+r;return t.encode(48,s)}},Zi=BigInt(0),Qi=BigInt(1),Ow=BigInt(2),Dn=BigInt(3),Rw=BigInt(4);function Lw(i,t,e){function n(r){const s=i.sqr(r),o=i.mul(s,r);return i.add(i.add(o,i.mul(r,t)),e)}return n}function fu(i,t,e){const{BYTES:n}=i;function r(s){let o;if(typeof s=="bigint")o=s;else{let c=Ue("private key",s);if(t){if(!t.includes(c.length*2))throw new Error("invalid private key");const l=new Uint8Array(n);l.set(c,l.length-c.length),c=l}try{o=i.fromBytes(c)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof s}`)}}if(e&&(o=i.create(o)),!i.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return r}function Dw(i,t={}){const{Fp:e,Fn:n}=ww("weierstrass",i,t),{h:r,n:s}=i;pr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(i.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function c(){if(!e.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(D,w,v){const{x:b,y:A}=w.toAffine(),V=e.toBytes(b);if(Qn("isCompressed",v),v){c();const P=!e.isOdd(A);return ei(mu(P),V)}else return ei(Uint8Array.of(4),V,e.toBytes(A))}function u(D){tt(D);const w=e.BYTES,v=w+1,b=2*w+1,A=D.length,V=D[0],P=D.subarray(1);if(A===v&&(V===2||V===3)){const S=e.fromBytes(P);if(!e.isValid(S))throw new Error("bad point: is not on curve, wrong x");const $=p(S);let k;try{k=e.sqrt($)}catch(C){const U=C instanceof Error?": "+C.message:"";throw new Error("bad point: is not on curve, sqrt error"+U)}c();const M=e.isOdd(k);return(V&1)===1!==M&&(k=e.neg(k)),{x:S,y:k}}else if(A===b&&V===4){const S=e.fromBytes(P.subarray(w*0,w*1)),$=e.fromBytes(P.subarray(w*1,w*2));if(!_(S,$))throw new Error("bad point: is not on curve");return{x:S,y:$}}else throw new Error(`bad point: got length ${A}, expected compressed=${v} or uncompressed=${b}`)}const h=t.toBytes||l,d=t.fromBytes||u,p=Lw(e,i.a,i.b);function _(D,w){const v=e.sqr(w),b=p(D);return e.eql(v,b)}if(!_(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const f=e.mul(e.pow(i.a,Dn),Rw),m=e.mul(e.sqr(i.b),BigInt(27));if(e.is0(e.add(f,m)))throw new Error("bad curve params: a or b");function y(D,w,v=!1){if(!e.isValid(w)||v&&e.is0(w))throw new Error(`bad point coordinate ${D}`);return w}function T(D){if(!(D instanceof I))throw new Error("ProjectivePoint expected")}const O=La((D,w)=>{const{px:v,py:b,pz:A}=D;if(e.eql(A,e.ONE))return{x:v,y:b};const V=D.is0();w==null&&(w=V?e.ONE:e.inv(A));const P=e.mul(v,w),S=e.mul(b,w),$=e.mul(A,w);if(V)return{x:e.ZERO,y:e.ZERO};if(!e.eql($,e.ONE))throw new Error("invZ was invalid");return{x:P,y:S}}),E=La(D=>{if(D.is0()){if(t.allowInfinityPoint&&!e.is0(D.py))return;throw new Error("bad point: ZERO")}const{x:w,y:v}=D.toAffine();if(!e.isValid(w)||!e.isValid(v))throw new Error("bad point: x or y not field elements");if(!_(w,v))throw new Error("bad point: equation left != right");if(!D.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function R(D,w,v,b,A){return v=new I(e.mul(v.px,D),v.py,v.pz),w=Yi(b,w),v=Yi(A,v),w.add(v)}class I{constructor(w,v,b){this.px=y("x",w),this.py=y("y",v,!0),this.pz=y("z",b),Object.freeze(this)}static fromAffine(w){const{x:v,y:b}=w||{};if(!w||!e.isValid(v)||!e.isValid(b))throw new Error("invalid affine point");if(w instanceof I)throw new Error("projective point not allowed");return e.is0(v)&&e.is0(b)?I.ZERO:new I(v,b,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(w){return dw(I,"pz",w)}static fromBytes(w){return tt(w),I.fromHex(w)}static fromHex(w){const v=I.fromAffine(d(Ue("pointHex",w)));return v.assertValidity(),v}static fromPrivateKey(w){const v=fu(n,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return I.BASE.multiply(v(w))}static msm(w,v){return yw(I,n,w,v)}precompute(w=8,v=!0){return L.setWindowSize(this,w),v||this.multiply(Dn),this}_setWindowSize(w){this.precompute(w)}assertValidity(){E(this)}hasEvenY(){const{y:w}=this.toAffine();if(!e.isOdd)throw new Error("Field doesn't support isOdd");return!e.isOdd(w)}equals(w){T(w);const{px:v,py:b,pz:A}=this,{px:V,py:P,pz:S}=w,$=e.eql(e.mul(v,S),e.mul(V,A)),k=e.eql(e.mul(b,S),e.mul(P,A));return $&&k}negate(){return new I(this.px,e.neg(this.py),this.pz)}double(){const{a:w,b:v}=i,b=e.mul(v,Dn),{px:A,py:V,pz:P}=this;let S=e.ZERO,$=e.ZERO,k=e.ZERO,M=e.mul(A,A),C=e.mul(V,V),U=e.mul(P,P),z=e.mul(A,V);return z=e.add(z,z),k=e.mul(A,P),k=e.add(k,k),S=e.mul(w,k),$=e.mul(b,U),$=e.add(S,$),S=e.sub(C,$),$=e.add(C,$),$=e.mul(S,$),S=e.mul(z,S),k=e.mul(b,k),U=e.mul(w,U),z=e.sub(M,U),z=e.mul(w,z),z=e.add(z,k),k=e.add(M,M),M=e.add(k,M),M=e.add(M,U),M=e.mul(M,z),$=e.add($,M),U=e.mul(V,P),U=e.add(U,U),M=e.mul(U,z),S=e.sub(S,M),k=e.mul(U,C),k=e.add(k,k),k=e.add(k,k),new I(S,$,k)}add(w){T(w);const{px:v,py:b,pz:A}=this,{px:V,py:P,pz:S}=w;let $=e.ZERO,k=e.ZERO,M=e.ZERO;const C=i.a,U=e.mul(i.b,Dn);let z=e.mul(v,V),j=e.mul(b,P),K=e.mul(A,S),F=e.add(v,b),W=e.add(V,P);F=e.mul(F,W),W=e.add(z,j),F=e.sub(F,W),W=e.add(v,A);let H=e.add(V,S);return W=e.mul(W,H),H=e.add(z,K),W=e.sub(W,H),H=e.add(b,A),$=e.add(P,S),H=e.mul(H,$),$=e.add(j,K),H=e.sub(H,$),M=e.mul(C,W),$=e.mul(U,K),M=e.add($,M),$=e.sub(j,M),M=e.add(j,M),k=e.mul($,M),j=e.add(z,z),j=e.add(j,z),K=e.mul(C,K),W=e.mul(U,W),j=e.add(j,K),K=e.sub(z,K),K=e.mul(C,K),W=e.add(W,K),z=e.mul(j,W),k=e.add(k,z),z=e.mul(H,W),$=e.mul(F,$),$=e.sub($,z),z=e.mul(F,j),M=e.mul(H,M),M=e.add(M,z),new I($,k,M)}subtract(w){return this.add(w.negate())}is0(){return this.equals(I.ZERO)}multiply(w){const{endo:v}=t;if(!n.isValidNot0(w))throw new Error("invalid scalar: out of range");let b,A;const V=P=>L.wNAFCached(this,P,I.normalizeZ);if(v){const{k1neg:P,k1:S,k2neg:$,k2:k}=v.splitScalar(w),{p:M,f:C}=V(S),{p:U,f:z}=V(k);A=C.add(z),b=R(v.beta,M,U,P,$)}else{const{p:P,f:S}=V(w);b=P,A=S}return I.normalizeZ([b,A])[0]}multiplyUnsafe(w){const{endo:v}=t,b=this;if(!n.isValid(w))throw new Error("invalid scalar: out of range");if(w===Zi||b.is0())return I.ZERO;if(w===Qi)return b;if(L.hasPrecomputes(this))return this.multiply(w);if(v){const{k1neg:A,k1:V,k2neg:P,k2:S}=v.splitScalar(w),{p1:$,p2:k}=mw(I,b,V,S);return R(v.beta,$,k,A,P)}else return L.wNAFCachedUnsafe(b,w)}multiplyAndAddUnsafe(w,v,b){const A=this.multiplyUnsafe(v).add(w.multiplyUnsafe(b));return A.is0()?void 0:A}toAffine(w){return O(this,w)}isTorsionFree(){const{isTorsionFree:w}=t;return r===Qi?!0:w?w(I,this):L.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:w}=t;return r===Qi?this:w?w(I,this):this.multiplyUnsafe(r)}toBytes(w=!0){return Qn("isCompressed",w),this.assertValidity(),h(I,this,w)}toRawBytes(w=!0){return this.toBytes(w)}toHex(w=!0){return cn(this.toBytes(w))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}I.BASE=new I(i.Gx,i.Gy,e.ONE),I.ZERO=new I(e.ZERO,e.ONE,e.ZERO),I.Fp=e,I.Fn=n;const g=n.BITS,L=fw(I,t.endo?Math.ceil(g/2):g);return I}function mu(i){return Uint8Array.of(i?2:3)}function Vw(i,t,e={}){pr(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const n=t.randomBytes||Di,r=t.hmac||((b,...A)=>lr(t.hash,b,ei(...A))),{Fp:s,Fn:o}=i,{ORDER:c,BITS:l}=o;function u(b){const A=c>>Qi;return b>A}function h(b){return u(b)?o.neg(b):b}function d(b,A){if(!o.isValidNot0(A))throw new Error(`invalid signature ${b}: out of range 1..CURVE.n`)}class p{constructor(A,V,P){d("r",A),d("s",V),this.r=A,this.s=V,P!=null&&(this.recovery=P),Object.freeze(this)}static fromCompact(A){const V=o.BYTES,P=Ue("compactSignature",A,V*2);return new p(o.fromBytes(P.subarray(0,V)),o.fromBytes(P.subarray(V,V*2)))}static fromDER(A){const{r:V,s:P}=Tt.toSig(Ue("DER",A));return new p(V,P)}assertValidity(){}addRecoveryBit(A){return new p(this.r,this.s,A)}recoverPublicKey(A){const V=s.ORDER,{r:P,s:S,recovery:$}=this;if($==null||![0,1,2,3].includes($))throw new Error("recovery id invalid");if(c*Ow<V&&$>1)throw new Error("recovery id is ambiguous for h>1 curve");const k=$===2||$===3?P+c:P;if(!s.isValid(k))throw new Error("recovery id 2 or 3 invalid");const M=s.toBytes(k),C=i.fromHex(ei(mu(($&1)===0),M)),U=o.inv(k),z=E(Ue("msgHash",A)),j=o.create(-z*U),K=o.create(S*U),F=i.BASE.multiplyUnsafe(j).add(C.multiplyUnsafe(K));if(F.is0())throw new Error("point at infinify");return F.assertValidity(),F}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new p(this.r,o.neg(this.s),this.recovery):this}toBytes(A){if(A==="compact")return ei(o.toBytes(this.r),o.toBytes(this.s));if(A==="der")return uo(Tt.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return cn(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return cn(this.toBytes("compact"))}}const _=fu(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),f={isValidPrivateKey(b){try{return _(b),!0}catch{return!1}},normPrivateKeyToScalar:_,randomPrivateKey:()=>{const b=c;return hw(n(hu(b)),b)},precompute(b=8,A=i.BASE){return A.precompute(b,!1)}};function m(b,A=!0){return i.fromPrivateKey(b).toBytes(A)}function y(b){if(typeof b=="bigint")return!1;if(b instanceof i)return!0;const A=Ue("key",b).length,V=s.BYTES,P=V+1,S=2*V+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===P))return A===P||A===S}function T(b,A,V=!0){if(y(b)===!0)throw new Error("first arg must be private key");if(y(A)===!1)throw new Error("second arg must be public key");return i.fromHex(A).multiply(_(b)).toBytes(V)}const O=t.bits2int||function(b){if(b.length>8192)throw new Error("input is too large");const A=hr(b),V=b.length*8-l;return V>0?A>>BigInt(V):A},E=t.bits2int_modN||function(b){return o.create(O(b))},R=dr(l);function I(b){return fs("num < 2^"+l,b,Zi,R),o.toBytes(b)}function g(b,A,V=L){if(["recovered","canonical"].some(F=>F in V))throw new Error("sign() legacy options not supported");const{hash:P}=t;let{lowS:S,prehash:$,extraEntropy:k}=V;S==null&&(S=!0),b=Ue("msgHash",b),ka(V),$&&(b=Ue("prehashed msgHash",P(b)));const M=E(b),C=_(A),U=[I(C),I(M)];if(k!=null&&k!==!1){const F=k===!0?n(s.BYTES):k;U.push(Ue("extraEntropy",F))}const z=ei(...U),j=M;function K(F){const W=O(F);if(!o.isValidNot0(W))return;const H=o.inv(W),le=i.BASE.multiply(W).toAffine(),ae=o.create(le.x);if(ae===Zi)return;const se=o.create(H*o.create(j+ae*C));if(se===Zi)return;let Ge=(le.x===ae?0:2)|Number(le.y&Qi),wt=se;return S&&u(se)&&(wt=h(se),Ge^=1),new p(ae,wt,Ge)}return{seed:z,k2sig:K}}const L={lowS:t.lowS,prehash:!1},D={lowS:t.lowS,prehash:!1};function w(b,A,V=L){const{seed:P,k2sig:S}=g(b,A,V);return iw(t.hash.outputLen,o.BYTES,r)(P,S)}i.BASE.precompute(8);function v(b,A,V,P=D){const S=b;A=Ue("msgHash",A),V=Ue("publicKey",V),ka(P);const{lowS:$,prehash:k,format:M}=P;if("strict"in P)throw new Error("options.strict was renamed to lowS");if(M!==void 0&&!["compact","der","js"].includes(M))throw new Error('format must be "compact", "der" or "js"');const C=typeof S=="string"||ao(S),U=!C&&!M&&typeof S=="object"&&S!==null&&typeof S.r=="bigint"&&typeof S.s=="bigint";if(!C&&!U)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let z,j;try{if(U)if(M===void 0||M==="js")z=new p(S.r,S.s);else throw new Error("invalid format");if(C){try{M!=="compact"&&(z=p.fromDER(S))}catch(Ge){if(!(Ge instanceof Tt.Err))throw Ge}!z&&M!=="der"&&(z=p.fromCompact(S))}j=i.fromHex(V)}catch{return!1}if(!z||$&&z.hasHighS())return!1;k&&(A=t.hash(A));const{r:K,s:F}=z,W=E(A),H=o.inv(F),le=o.create(W*H),ae=o.create(K*H),se=i.BASE.multiplyUnsafe(le).add(j.multiplyUnsafe(ae));return se.is0()?!1:o.create(se.x)===K}return Object.freeze({getPublicKey:m,getSharedSecret:T,sign:w,verify:v,utils:f,Point:i,Signature:p})}function Sw(i){const t={a:i.a,b:i.b,p:i.Fp.ORDER,n:i.n,h:i.h,Gx:i.Gx,Gy:i.Gy},e=i.Fp,n=Vi(t.n,i.nBitLength),r={Fp:e,Fn:n,allowedPrivateKeyLengths:i.allowedPrivateKeyLengths,allowInfinityPoint:i.allowInfinityPoint,endo:i.endo,wrapPrivateKey:i.wrapPrivateKey,isTorsionFree:i.isTorsionFree,clearCofactor:i.clearCofactor,fromBytes:i.fromBytes,toBytes:i.toBytes};return{CURVE:t,curveOpts:r}}function xw(i){const{CURVE:t,curveOpts:e}=Sw(i),n={hash:i.hash,hmac:i.hmac,randomBytes:i.randomBytes,lowS:i.lowS,bits2int:i.bits2int,bits2int_modN:i.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:n}}function Cw(i,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:i})}function $w(i){const{CURVE:t,curveOpts:e,ecdsaOpts:n}=xw(i),r=Dw(t,e),s=Vw(r,n,e);return Cw(i,s)}function ys(i,t){const e=n=>$w({...i,hash:n});return{...e(t),create:e}}const yu={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},wu={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},gu={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},kw=Vi(yu.p),Uw=Vi(wu.p),Nw=Vi(gu.p),Bw=ys({...yu,Fp:kw,lowS:!1},cr);ys({...wu,Fp:Uw,lowS:!1},Hm),ys({...gu,Fp:Nw,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Wm);const Mw=Bw,Eu="base10",Se="base16",Be="base64pad",zt="base64url",wn="utf8",vu=0,Pt=1,gn=2,qw=0,Ua=1,Xi=12,yo=32;function zw(){const i=ms.utils.randomPrivateKey(),t=ms.getPublicKey(i);return{privateKey:ze(i,Se),publicKey:ze(t,Se)}}function ws(){const i=Di(yo);return ze(i,Se)}function jw(i,t){const e=ms.getSharedSecret(et(i,Se),et(t,Se)),n=Xy(ur,e,void 0,void 0,yo);return ze(n,Se)}function Un(i){const t=ur(et(i,Se));return ze(t,Se)}function Qe(i){const t=ur(et(i,wn));return ze(t,Se)}function bu(i){return et(`${i}`,Eu)}function ai(i){return Number(ze(i,Eu))}function Iu(i){return i.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Tu(i){const t=i.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function Kw(i){const t=bu(typeof i.type<"u"?i.type:vu);if(ai(t)===Pt&&typeof i.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof i.senderPublicKey<"u"?et(i.senderPublicKey,Se):void 0,n=typeof i.iv<"u"?et(i.iv,Se):Di(Xi),r=et(i.symKey,Se),s=iu(r,n).encrypt(et(i.message,wn)),o=Au({type:t,sealed:s,iv:n,senderPublicKey:e});return i.encoding===zt?Iu(o):o}function Fw(i){const t=et(i.symKey,Se),{sealed:e,iv:n}=un({encoded:i.encoded,encoding:i.encoding}),r=iu(t,n).decrypt(e);if(r===null)throw new Error("Failed to decrypt");return ze(r,wn)}function Ww(i,t){const e=bu(gn),n=Di(Xi),r=et(i,wn),s=Au({type:e,sealed:r,iv:n});return t===zt?Iu(s):s}function Hw(i,t){const{sealed:e}=un({encoded:i,encoding:t});return ze(e,wn)}function Au(i){if(ai(i.type)===gn)return ze(Gi([i.type,i.sealed]),Be);if(ai(i.type)===Pt){if(typeof i.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return ze(Gi([i.type,i.senderPublicKey,i.iv,i.sealed]),Be)}return ze(Gi([i.type,i.iv,i.sealed]),Be)}function un(i){const t=(i.encoding||Be)===zt?Tu(i.encoded):i.encoded,e=et(t,Be),n=e.slice(qw,Ua),r=Ua;if(ai(n)===Pt){const l=r+yo,u=l+Xi,h=e.slice(r,l),d=e.slice(l,u),p=e.slice(u);return{type:n,sealed:p,iv:d,senderPublicKey:h}}if(ai(n)===gn){const l=e.slice(r),u=Di(Xi);return{type:n,sealed:l,iv:u}}const s=r+Xi,o=e.slice(r,s),c=e.slice(s);return{type:n,sealed:c,iv:o}}function Gw(i,t){const e=un({encoded:i,encoding:t?.encoding});return Pu({type:ai(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?ze(e.senderPublicKey,Se):void 0,receiverPublicKey:t?.receiverPublicKey})}function Pu(i){const t=i?.type||vu;if(t===Pt){if(typeof i?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof i?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:i?.senderPublicKey,receiverPublicKey:i?.receiverPublicKey}}function Na(i){return i.type===Pt&&typeof i.senderPublicKey=="string"&&typeof i.receiverPublicKey=="string"}function Ba(i){return i.type===gn}function Jw(i){const t=te.from(i.x,"base64"),e=te.from(i.y,"base64");return Gi([new Uint8Array([4]),t,e])}function Yw(i,t){const[e,n,r]=i.split("."),s=te.from(Tu(r),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),c=s.slice(32,64),l=`${e}.${n}`,u=ur(l),h=Jw(t);if(!Mw.verify(Gi([o,c]),u,h))throw new Error("Invalid signature");return Yr(i).payload}const Zw="irn";function er(i){return i?.relay||{protocol:Zw}}function Ei(i){const t=Zh[i];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${i}`);return t}function Qw(i,t="-"){const e={},n="relay"+t;return Object.keys(i).forEach(r=>{if(r.startsWith(n)){const s=r.replace(n,""),o=i[r];e[s]=o}}),e}function Ma(i){if(!i.includes("wc:")){const u=Ul(i);u!=null&&u.includes("wc:")&&(i=u)}i=i.includes("wc://")?i.replace("wc://",""):i,i=i.includes("wc:")?i.replace("wc:",""):i;const t=i.indexOf(":"),e=i.indexOf("?")!==-1?i.indexOf("?"):void 0,n=i.substring(0,t),r=i.substring(t+1,e).split("@"),s=typeof e<"u"?i.substring(e):"",o=new URLSearchParams(s),c={};o.forEach((u,h)=>{c[h]=u});const l=typeof c.methods=="string"?c.methods.split(","):void 0;return{protocol:n,topic:Xw(r[0]),version:parseInt(r[1],10),symKey:c.symKey,relay:Qw(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function Xw(i){return i.startsWith("//")?i.substring(2):i}function eg(i,t="-"){const e="relay",n={};return Object.keys(i).forEach(r=>{const s=r,o=e+t+s;i[s]&&(n[o]=i[s])}),n}function qa(i){const t=new URLSearchParams,e=eg(i.relay);Object.keys(e).sort().forEach(r=>{t.set(r,e[r])}),t.set("symKey",i.symKey),i.expiryTimestamp&&t.set("expiryTimestamp",i.expiryTimestamp.toString()),i.methods&&t.set("methods",i.methods.join(","));const n=t.toString();return`${i.protocol}:${i.topic}@${i.version}?${n}`}function Vn(i,t,e){return`${i}?wc_ev=${e}&topic=${t}`}var tg=Object.defineProperty,ig=Object.defineProperties,ng=Object.getOwnPropertyDescriptors,za=Object.getOwnPropertySymbols,rg=Object.prototype.hasOwnProperty,sg=Object.prototype.propertyIsEnumerable,ja=(i,t,e)=>t in i?tg(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,og=(i,t)=>{for(var e in t||(t={}))rg.call(t,e)&&ja(i,e,t[e]);if(za)for(var e of za(t))sg.call(t,e)&&ja(i,e,t[e]);return i},ag=(i,t)=>ig(i,ng(t));function Si(i){const t=[];return i.forEach(e=>{const[n,r]=e.split(":");t.push(`${n}:${r}`)}),t}function cg(i){const t=[];return Object.values(i).forEach(e=>{t.push(...Si(e.accounts))}),t}function lg(i,t){const e=[];return Object.values(i).forEach(n=>{Si(n.accounts).includes(t)&&e.push(...n.methods)}),e}function ug(i,t){const e=[];return Object.values(i).forEach(n=>{Si(n.accounts).includes(t)&&e.push(...n.events)}),e}function Ou(i){return i.includes(":")}function hg(i){return Ou(i)?i.split(":")[0]:i}function Ka(i){var t,e,n;const r={};if(!hn(i))return r;for(const[s,o]of Object.entries(i)){const c=Ou(s)?[s]:o.chains,l=o.methods||[],u=o.events||[],h=hg(s);r[h]=ag(og({},r[h]),{chains:ni(c,(t=r[h])==null?void 0:t.chains),methods:ni(l,(e=r[h])==null?void 0:e.methods),events:ni(u,(n=r[h])==null?void 0:n.events)})}return r}function dg(i){const t={};return i?.forEach(e=>{var n;const[r,s]=e.split(":");t[r]||(t[r]={accounts:[],chains:[],events:[],methods:[]}),t[r].accounts.push(e),(n=t[r].chains)==null||n.push(`${r}:${s}`)}),t}function Fa(i,t){t=t.map(n=>n.replace("did:pkh:",""));const e=dg(t);for(const[n,r]of Object.entries(e))r.methods?r.methods=ni(r.methods,i):r.methods=i,r.events=["chainChanged","accountsChanged"];return e}function pg(i,t){var e,n,r,s,o,c;const l=Ka(i),u=Ka(t),h={},d=Object.keys(l).concat(Object.keys(u));for(const p of d)h[p]={chains:ni((e=l[p])==null?void 0:e.chains,(n=u[p])==null?void 0:n.chains),methods:ni((r=l[p])==null?void 0:r.methods,(s=u[p])==null?void 0:s.methods),events:ni((o=l[p])==null?void 0:o.events,(c=u[p])==null?void 0:c.events)};return h}const _g={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},fg={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function N(i,t){const{message:e,code:n}=fg[i];return{message:t?`${e} ${t}`:e,code:n}}function oe(i,t){const{message:e,code:n}=_g[i];return{message:t?`${e} ${t}`:e,code:n}}function Ii(i,t){return!!Array.isArray(i)}function hn(i){return Object.getPrototypeOf(i)===Object.prototype&&Object.keys(i).length}function _e(i){return typeof i>"u"}function he(i,t){return t&&_e(i)?!0:typeof i=="string"&&!!i.trim().length}function wo(i,t){return t&&_e(i)?!0:typeof i=="number"&&!isNaN(i)}function mg(i,t){const{requiredNamespaces:e}=t,n=Object.keys(i.namespaces),r=Object.keys(e);let s=!0;return Xt(r,n)?(n.forEach(o=>{const{accounts:c,methods:l,events:u}=i.namespaces[o],h=Si(c),d=e[o];(!Xt(Sl(o,d),h)||!Xt(d.methods,l)||!Xt(d.events,u))&&(s=!1)}),s):!1}function tr(i){return he(i,!1)&&i.includes(":")?i.split(":").length===2:!1}function yg(i){if(he(i,!1)&&i.includes(":")){const t=i.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&tr(e)}}return!1}function wg(i){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(he(i,!1)){if(t(i))return!0;const e=Ul(i);return t(e)}}catch{}return!1}function gg(i){var t;return(t=i?.proposer)==null?void 0:t.publicKey}function Eg(i){return i?.topic}function vg(i,t){let e=null;return he(i?.publicKey,!1)||(e=N("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function Wa(i){let t=!0;return Ii(i)?i.length&&(t=i.every(e=>he(e,!1))):t=!1,t}function bg(i,t,e){let n=null;return Ii(t)&&t.length?t.forEach(r=>{n||tr(r)||(n=oe("UNSUPPORTED_CHAINS",`${e}, chain ${r} should be a string and conform to "namespace:chainId" format`))}):tr(i)||(n=oe("UNSUPPORTED_CHAINS",`${e}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),n}function Ig(i,t,e){let n=null;return Object.entries(i).forEach(([r,s])=>{if(n)return;const o=bg(r,Sl(r,s),`${t} ${e}`);o&&(n=o)}),n}function Tg(i,t){let e=null;return Ii(i)?i.forEach(n=>{e||yg(n)||(e=oe("UNSUPPORTED_ACCOUNTS",`${t}, account ${n} should be a string and conform to "namespace:chainId:address" format`))}):e=oe("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function Ag(i,t){let e=null;return Object.values(i).forEach(n=>{if(e)return;const r=Tg(n?.accounts,`${t} namespace`);r&&(e=r)}),e}function Pg(i,t){let e=null;return Wa(i?.methods)?Wa(i?.events)||(e=oe("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=oe("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function Ru(i,t){let e=null;return Object.values(i).forEach(n=>{if(e)return;const r=Pg(n,`${t}, namespace`);r&&(e=r)}),e}function Og(i,t,e){let n=null;if(i&&hn(i)){const r=Ru(i,t);r&&(n=r);const s=Ig(i,t,e);s&&(n=s)}else n=N("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return n}function $r(i,t){let e=null;if(i&&hn(i)){const n=Ru(i,t);n&&(e=n);const r=Ag(i,t);r&&(e=r)}else e=N("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function Lu(i){return he(i.protocol,!0)}function Rg(i,t){let e=!1;return i?i&&Ii(i)&&i.length&&i.forEach(n=>{e=Lu(n)}):e=!0,e}function Lg(i){return typeof i=="number"}function ke(i){return typeof i<"u"&&typeof i!==null}function Dg(i){return!(!i||typeof i!="object"||!i.code||!wo(i.code,!1)||!i.message||!he(i.message,!1))}function Vg(i){return!(_e(i)||!he(i.method,!1))}function Sg(i){return!(_e(i)||_e(i.result)&&_e(i.error)||!wo(i.id,!1)||!he(i.jsonrpc,!1))}function xg(i){return!(_e(i)||!he(i.name,!1))}function Ha(i,t){return!(!tr(t)||!cg(i).includes(t))}function Cg(i,t,e){return he(e,!1)?lg(i,t).includes(e):!1}function $g(i,t,e){return he(e,!1)?ug(i,t).includes(e):!1}function Ga(i,t,e){let n=null;const r=kg(i),s=Ug(t),o=Object.keys(r),c=Object.keys(s),l=Ja(Object.keys(i)),u=Ja(Object.keys(t)),h=l.filter(d=>!u.includes(d));return h.length&&(n=N("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
@@ -10,6 +10,6 @@ ${i.length}`,e=new TextEncoder().encode(t+i);return"0x"+te.from(km(e)).toString(
10
10
  Required: ${o.toString()}
11
11
  Approved: ${c.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||n)return;const p=Si(t[d].accounts);p.includes(d)||(n=N("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${d}
12
12
  Required: ${d}
13
- Approved: ${p.toString()}`))}),o.forEach(d=>{n||(Xt(r[d].methods,s[d].methods)?Xt(r[d].events,s[d].events)||(n=N("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):n=N("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function kg(i){const t={};return Object.keys(i).forEach(e=>{var n;e.includes(":")?t[e]=i[e]:(n=i[e].chains)==null||n.forEach(r=>{t[r]={methods:i[e].methods,events:i[e].events}})}),t}function Ja(i){return[...new Set(i.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Ug(i){const t={};return Object.keys(i).forEach(e=>{e.includes(":")?t[e]=i[e]:Si(i[e].accounts)?.forEach(r=>{t[r]={accounts:i[e].accounts.filter(s=>s.includes(`${r}:`)),methods:i[e].methods,events:i[e].events}})}),t}function Ng(i,t){return wo(i,!1)&&i<=t.max&&i>=t.min}function Ya(){const i=mn();return new Promise(t=>{switch(i){case He.browser:t(Bg());break;case He.reactNative:t(Mg());break;case He.node:t(qg());break;default:t(!0)}})}function Bg(){return Li()&&navigator?.onLine}async function Mg(){return Wt()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo?(await globalThis?.NetInfo.fetch())?.isConnected:!0}function qg(){return!0}function zg(i){switch(mn()){case He.browser:jg(i);break;case He.reactNative:Kg(i);break}}function jg(i){!Wt()&&Li()&&(window.addEventListener("online",()=>i(!0)),window.addEventListener("offline",()=>i(!1)))}function Kg(i){Wt()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&globalThis?.NetInfo.addEventListener(t=>i(t?.isConnected))}function Fg(){var i;return Li()&&Ot.getDocument()?((i=Ot.getDocument())==null?void 0:i.visibilityState)==="visible":!0}const kr={};class Ni{static get(t){return kr[t]}static set(t,e){kr[t]=e}static delete(t){delete kr[t]}}function Wg(i){const t=_n.decode(i);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Hg({publicKey:i,signature:t,payload:e}){var n;const r=gs(e.method),s=128|parseInt(((n=e.version)==null?void 0:n.toString())||"4"),o=Yg(e.address),c=e.era==="00"?new Uint8Array([0]):gs(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),h=BigInt(`0x${Jg(e.tip)}`),d=Qg(h),p=new Uint8Array([0,...i,o,...t,...c,...u,...d,...r]),_=Zg(p.length+1);return new Uint8Array([..._,s,...p])}function Gg(i){const t=gs(i),e=ud.blake2b(t,void 0,32);return"0x"+te.from(e).toString("hex")}function gs(i){return new Uint8Array(i.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function Jg(i){return i.startsWith("0x")?i.slice(2):i}function Yg(i){const t=_n.decode(i)[0];return t===42?0:t===60?2:1}function Zg(i){if(i<64)return new Uint8Array([i<<2]);if(i<16384){const t=i<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(i<1<<30){const t=i<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Qg(i){if(i<BigInt(1)<<BigInt(6))return new Uint8Array([Number(i<<BigInt(2))]);if(i<BigInt(1)<<BigInt(14)){const t=i<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(i<BigInt(1)<<BigInt(30)){const t=i<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Xg(i){const t=Uint8Array.from(te.from(i.signature,"hex")),e=Wg(i.transaction.address),n=Hg({publicKey:e,signature:t,payload:i.transaction}),r=te.from(n).toString("hex");return Gg(r)}var eE={};const Du="wc",Vu=2,Es="core",yt=`${Du}@2:${Es}:`,tE={logger:"error"},iE={database:":memory:"},nE="crypto",Za="client_ed25519_seed",rE=B.ONE_DAY,sE="keychain",oE="0.3",aE="messages",cE="0.3",lE=B.SIX_HOURS,uE="publisher",Su="irn",hE="error",xu="wss://relay.walletconnect.org",dE="relayer",ce={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},pE="_subscription",Je={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},_E=.1,vs="2.21.8",re={link_mode:"link_mode",relay:"relay"},Nn={inbound:"inbound",outbound:"outbound"},fE="0.3",mE="WALLETCONNECT_CLIENT_ID",Qa="WALLETCONNECT_LINK_MODE_APPS",Fe={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},yE="subscription",wE="0.3",gE="pairing",EE="0.3",Bi={wc_pairingDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:B.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:B.ONE_DAY,prompt:!1,tag:0},res:{ttl:B.ONE_DAY,prompt:!1,tag:0}}},Zt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},nt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},vE="history",bE="0.3",IE="expirer",Ze={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},TE="0.3",AE="verify-api",PE="https://verify.walletconnect.com",Cu="https://verify.walletconnect.org",en=Cu,OE=`${en}/v3`,RE=[PE,Cu],LE="echo",DE="https://echo.walletconnect.com",dt={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},It={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},kt={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},Mi={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Jt={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},qi={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},VE=.1,SE="event-client",xE=86400,CE="https://pulse.walletconnect.org/batch";function $E(i,t){if(i.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<i.length;r++){var s=i.charAt(r),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=r}var c=i.length,l=i.charAt(0),u=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var m=0,y=0,T=0,O=f.length;T!==O&&f[T]===0;)T++,m++;for(var E=(O-T)*h+1>>>0,R=new Uint8Array(E);T!==O;){for(var I=f[T],g=0,L=E-1;(I!==0||g<y)&&L!==-1;L--,g++)I+=256*R[L]>>>0,R[L]=I%c>>>0,I=I/c>>>0;if(I!==0)throw new Error("Non-zero carry");y=g,T++}for(var D=E-y;D!==E&&R[D]===0;)D++;for(var w=l.repeat(m);D<E;++D)w+=i.charAt(R[D]);return w}function p(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var m=0;if(f[m]!==" "){for(var y=0,T=0;f[m]===l;)y++,m++;for(var O=(f.length-m)*u+1>>>0,E=new Uint8Array(O);f[m];){var R=e[f.charCodeAt(m)];if(R===255)return;for(var I=0,g=O-1;(R!==0||I<T)&&g!==-1;g--,I++)R+=c*E[g]>>>0,E[g]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");T=I,m++}if(f[m]!==" "){for(var L=O-T;L!==O&&E[L]===0;)L++;for(var D=new Uint8Array(y+(O-L)),w=y;L!==O;)D[w++]=E[L++];return D}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:p,decode:_}}var kE=$E,UE=kE;const $u=i=>{if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")},NE=i=>new TextEncoder().encode(i),BE=i=>new TextDecoder().decode(i);class ME{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class qE{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return ku(this,t)}}class zE{constructor(t){this.decoders=t}or(t){return ku(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ku=(i,t)=>new zE({...i.decoders||{[i.prefix]:i},...t.decoders||{[t.prefix]:t}});class jE{constructor(t,e,n,r){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=r,this.encoder=new ME(t,e,n),this.decoder=new qE(t,e,r)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const _r=({name:i,prefix:t,encode:e,decode:n})=>new jE(i,t,e,n),En=({prefix:i,name:t,alphabet:e})=>{const{encode:n,decode:r}=UE(e,t);return _r({prefix:i,name:t,encode:n,decode:s=>$u(r(s))})},KE=(i,t,e,n)=>{const r={};for(let h=0;h<t.length;++h)r[t[h]]=h;let s=i.length;for(;i[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let h=0;h<s;++h){const d=r[i[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|d,c+=e,c>=8&&(c-=8,o[u++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},FE=(i,t,e)=>{const n=t[t.length-1]==="=",r=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<i.length;++l)for(c=c<<8|i[l],o+=8;o>e;)o-=e,s+=t[r&c>>o];if(o&&(s+=t[r&c<<e-o]),n)for(;s.length*e&7;)s+="=";return s},Ie=({name:i,prefix:t,bitsPerChar:e,alphabet:n})=>_r({prefix:t,name:i,encode(r){return FE(r,n,e)},decode(r){return KE(r,n,e,i)}}),WE=_r({prefix:"\0",name:"identity",encode:i=>BE(i),decode:i=>NE(i)});var HE=Object.freeze({__proto__:null,identity:WE});const GE=Ie({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var JE=Object.freeze({__proto__:null,base2:GE});const YE=Ie({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ZE=Object.freeze({__proto__:null,base8:YE});const QE=En({prefix:"9",name:"base10",alphabet:"0123456789"});var XE=Object.freeze({__proto__:null,base10:QE});const e0=Ie({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),t0=Ie({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var i0=Object.freeze({__proto__:null,base16:e0,base16upper:t0});const n0=Ie({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),r0=Ie({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),s0=Ie({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),o0=Ie({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),a0=Ie({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),c0=Ie({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l0=Ie({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),u0=Ie({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h0=Ie({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var d0=Object.freeze({__proto__:null,base32:n0,base32upper:r0,base32pad:s0,base32padupper:o0,base32hex:a0,base32hexupper:c0,base32hexpad:l0,base32hexpadupper:u0,base32z:h0});const p0=En({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_0=En({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var f0=Object.freeze({__proto__:null,base36:p0,base36upper:_0});const m0=En({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),y0=En({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var w0=Object.freeze({__proto__:null,base58btc:m0,base58flickr:y0});const g0=Ie({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),E0=Ie({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),v0=Ie({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b0=Ie({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var I0=Object.freeze({__proto__:null,base64:g0,base64pad:E0,base64url:v0,base64urlpad:b0});const Uu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),T0=Uu.reduce((i,t,e)=>(i[e]=t,i),[]),A0=Uu.reduce((i,t,e)=>(i[t.codePointAt(0)]=e,i),[]);function P0(i){return i.reduce((t,e)=>(t+=T0[e],t),"")}function O0(i){const t=[];for(const e of i){const n=A0[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const R0=_r({prefix:"🚀",name:"base256emoji",encode:P0,decode:O0});var L0=Object.freeze({__proto__:null,base256emoji:R0}),D0=Nu,Xa=128,V0=-128,S0=Math.pow(2,31);function Nu(i,t,e){t=t||[],e=e||0;for(var n=e;i>=S0;)t[e++]=i&255|Xa,i/=128;for(;i&V0;)t[e++]=i&255|Xa,i>>>=7;return t[e]=i|0,Nu.bytes=e-n+1,t}var x0=bs,C0=128,ec=127;function bs(i,n){var e=0,n=n||0,r=0,s=n,o,c=i.length;do{if(s>=c)throw bs.bytes=0,new RangeError("Could not decode varint");o=i[s++],e+=r<28?(o&ec)<<r:(o&ec)*Math.pow(2,r),r+=7}while(o>=C0);return bs.bytes=s-n,e}var $0=Math.pow(2,7),k0=Math.pow(2,14),U0=Math.pow(2,21),N0=Math.pow(2,28),B0=Math.pow(2,35),M0=Math.pow(2,42),q0=Math.pow(2,49),z0=Math.pow(2,56),j0=Math.pow(2,63),K0=function(i){return i<$0?1:i<k0?2:i<U0?3:i<N0?4:i<B0?5:i<M0?6:i<q0?7:i<z0?8:i<j0?9:10},F0={encode:D0,decode:x0,encodingLength:K0},Bu=F0;const tc=(i,t,e=0)=>(Bu.encode(i,t,e),t),ic=i=>Bu.encodingLength(i),Is=(i,t)=>{const e=t.byteLength,n=ic(i),r=n+ic(e),s=new Uint8Array(r+e);return tc(i,s,0),tc(e,s,n),s.set(t,r),new W0(i,e,t,s)};class W0{constructor(t,e,n,r){this.code=t,this.size=e,this.digest=n,this.bytes=r}}const Mu=({name:i,code:t,encode:e})=>new H0(i,t,e);class H0{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?Is(this.code,e):e.then(n=>Is(this.code,n))}else throw Error("Unknown type, must be binary type")}}const qu=i=>async t=>new Uint8Array(await crypto.subtle.digest(i,t)),G0=Mu({name:"sha2-256",code:18,encode:qu("SHA-256")}),J0=Mu({name:"sha2-512",code:19,encode:qu("SHA-512")});var Y0=Object.freeze({__proto__:null,sha256:G0,sha512:J0});const zu=0,Z0="identity",ju=$u,Q0=i=>Is(zu,ju(i)),X0={code:zu,name:Z0,encode:ju,digest:Q0};var ev=Object.freeze({__proto__:null,identity:X0});new TextEncoder,new TextDecoder;const nc={...HE,...JE,...ZE,...XE,...i0,...d0,...f0,...w0,...I0,...L0};({...Y0,...ev});function Ku(i){return globalThis.Buffer!=null?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):i}function tv(i=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ku(globalThis.Buffer.allocUnsafe(i)):new Uint8Array(i)}function Fu(i,t,e,n){return{name:i,prefix:t,encoder:{name:i,prefix:t,encode:e},decoder:{decode:n}}}const rc=Fu("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),Ur=Fu("ascii","a",i=>{let t="a";for(let e=0;e<i.length;e++)t+=String.fromCharCode(i[e]);return t},i=>{i=i.substring(1);const t=tv(i.length);for(let e=0;e<i.length;e++)t[e]=i.charCodeAt(e);return t}),iv={utf8:rc,"utf-8":rc,hex:nc.base16,latin1:Ur,ascii:Ur,binary:Ur,...nc};function nv(i,t="utf8"){const e=iv[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ku(globalThis.Buffer.from(i,"utf-8")):e.decoder.decode(`${e.prefix}${i}`)}var rv=Object.defineProperty,sv=(i,t,e)=>t in i?rv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ut=(i,t,e)=>sv(i,typeof t!="symbol"?t+"":t,e);class ov{constructor(t,e){this.core=t,this.logger=e,ut(this,"keychain",new Map),ut(this,"name",sE),ut(this,"version",oE),ut(this,"initialized",!1),ut(this,"storagePrefix",yt),ut(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),ut(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),ut(this,"set",async(n,r)=>{this.isInitialized(),this.keychain.set(n,r),await this.persist()}),ut(this,"get",n=>{this.isInitialized();const r=this.keychain.get(n);if(typeof r>"u"){const{message:s}=N("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return r}),ut(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=t,this.logger=xe(e,this.name)}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,as(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var av=Object.defineProperty,cv=(i,t,e)=>t in i?av(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ee=(i,t,e)=>cv(i,typeof t!="symbol"?t+"":t,e);class lv{constructor(t,e,n){this.core=t,this.logger=e,Ee(this,"name",nE),Ee(this,"keychain"),Ee(this,"randomSessionIdentifier",ws()),Ee(this,"initialized",!1),Ee(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Ee(this,"hasKeys",r=>(this.isInitialized(),this.keychain.has(r))),Ee(this,"getClientId",async()=>{this.isInitialized();const r=await this.getClientSeed(),s=Lo(r);return td(s.publicKey)}),Ee(this,"generateKeyPair",()=>{this.isInitialized();const r=zw();return this.setPrivateKey(r.publicKey,r.privateKey)}),Ee(this,"signJWT",async r=>{this.isInitialized();const s=await this.getClientSeed(),o=Lo(s),c=this.randomSessionIdentifier;return await id(c,r,rE,o)}),Ee(this,"generateSharedKey",(r,s,o)=>{this.isInitialized();const c=this.getPrivateKey(r),l=jw(c,s);return this.setSymKey(l,o)}),Ee(this,"setSymKey",async(r,s)=>{this.isInitialized();const o=s||Un(r);return await this.keychain.set(o,r),o}),Ee(this,"deleteKeyPair",async r=>{this.isInitialized(),await this.keychain.del(r)}),Ee(this,"deleteSymKey",async r=>{this.isInitialized(),await this.keychain.del(r)}),Ee(this,"encode",async(r,s,o)=>{this.isInitialized();const c=Pu(o),l=rn(s);if(Ba(c))return Ww(l,o?.encoding);if(Na(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;r=await this.generateSharedKey(p,_)}const u=this.getSymKey(r),{type:h,senderPublicKey:d}=c;return Kw({type:h,symKey:u,message:l,senderPublicKey:d,encoding:o?.encoding})}),Ee(this,"decode",async(r,s,o)=>{this.isInitialized();const c=Gw(s,o);if(Ba(c)){const l=Hw(s,o?.encoding);return zn(l)}if(Na(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;r=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(r),u=Fw({symKey:l,encoded:s,encoding:o?.encoding});return zn(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${r}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),Ee(this,"getPayloadType",(r,s=Be)=>{const o=un({encoded:r,encoding:s});return ai(o.type)}),Ee(this,"getPayloadSenderPublicKey",(r,s=Be)=>{const o=un({encoded:r,encoding:s});return o.senderPublicKey?ze(o.senderPublicKey,Se):void 0}),this.core=t,this.logger=xe(e,this.name),this.keychain=n||new ov(this.core,this.logger)}get context(){return je(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Za)}catch{t=ws(),await this.keychain.set(Za,t)}return nv(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uv=Object.defineProperty,hv=Object.defineProperties,dv=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,pv=Object.prototype.hasOwnProperty,_v=Object.prototype.propertyIsEnumerable,Ts=(i,t,e)=>t in i?uv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fv=(i,t)=>{for(var e in t||(t={}))pv.call(t,e)&&Ts(i,e,t[e]);if(sc)for(var e of sc(t))_v.call(t,e)&&Ts(i,e,t[e]);return i},mv=(i,t)=>hv(i,dv(t)),Ke=(i,t,e)=>Ts(i,typeof t!="symbol"?t+"":t,e);class yv extends t_{constructor(t,e){super(t,e),this.logger=t,this.core=e,Ke(this,"messages",new Map),Ke(this,"messagesWithoutClientAck",new Map),Ke(this,"name",aE),Ke(this,"version",cE),Ke(this,"initialized",!1),Ke(this,"storagePrefix",yt),Ke(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const r=await this.getRelayerMessagesWithoutClientAck();typeof r<"u"&&(this.messagesWithoutClientAck=r),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}}),Ke(this,"set",async(n,r,s)=>{this.isInitialized();const o=Qe(r);let c=this.messages.get(n);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=r,this.messages.set(n,c),s===Nn.inbound){const l=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,mv(fv({},l),{[o]:r}))}return await this.persist(),o}),Ke(this,"get",n=>{this.isInitialized();let r=this.messages.get(n);return typeof r>"u"&&(r={}),r}),Ke(this,"getWithoutAck",n=>{this.isInitialized();const r={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};r[s]=Object.values(o)}return r}),Ke(this,"has",(n,r)=>{this.isInitialized();const s=this.get(n),o=Qe(r);return typeof s[o]<"u"}),Ke(this,"ack",async(n,r)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=Qe(r);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),Ke(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=xe(t,this.name),this.core=e}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,as(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,as(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?cs(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var wv=Object.defineProperty,gv=Object.defineProperties,Ev=Object.getOwnPropertyDescriptors,oc=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,bv=Object.prototype.propertyIsEnumerable,As=(i,t,e)=>t in i?wv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mi=(i,t)=>{for(var e in t||(t={}))vv.call(t,e)&&As(i,e,t[e]);if(oc)for(var e of oc(t))bv.call(t,e)&&As(i,e,t[e]);return i},ac=(i,t)=>gv(i,Ev(t)),Ye=(i,t,e)=>As(i,typeof t!="symbol"?t+"":t,e);class Iv extends i_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ye(this,"events",new li.EventEmitter),Ye(this,"name",uE),Ye(this,"queue",new Map),Ye(this,"publishTimeout",B.toMiliseconds(B.ONE_MINUTE)),Ye(this,"initialPublishTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Ye(this,"needsTransportRestart",!1),Ye(this,"publish",async(n,r,s)=>{var o,c,l,u,h;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:r,opts:s}});const d=s?.ttl||lE,p=s?.prompt||!1,_=s?.tag||0,f=s?.id||Qt().toString(),m=Ei(er().protocol),y={id:f,method:s?.publishMethod||m.publish,params:mi({topic:n,message:r,ttl:d,prompt:p,tag:_,attestation:s?.attestation},s?.tvf&&{tvf:s.tvf})},T=`Failed to publish payload, please try again. id:${f} tag:${_}`;try{_e((o=y.params)==null?void 0:o.prompt)&&((c=y.params)==null||delete c.prompt),_e((l=y.params)==null?void 0:l.tag)&&((u=y.params)==null||delete u.tag);const O=new Promise(async E=>{const R=({id:g})=>{var L;((L=y.id)==null?void 0:L.toString())===g.toString()&&(this.removeRequestFromQueue(g),this.relayer.events.removeListener(ce.publish,R),E())};this.relayer.events.on(ce.publish,R);const I=ft(new Promise((g,L)=>{this.rpcPublish(y,s).then(g).catch(D=>{this.logger.warn(D,D?.message),L(D)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${_}`);try{await I,this.events.removeListener(ce.publish,R)}catch(g){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(g,g?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:n,message:r,opts:s}}),await ft(O,this.publishTimeout,T)}catch(O){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(O),(h=s?.internal)!=null&&h.throwOnFailedPublish)throw O}finally{this.queue.delete(f)}}),Ye(this,"publishCustom",async n=>{var r,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:n});const{payload:u,opts:h={}}=n,{attestation:d,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=B.FIVE_MINUTES}=h,T=h.id||Qt().toString(),O=Ei(er().protocol),E=_||O.publish,R={id:T,method:E,params:mi(ac(mi({},u),{ttl:y,prompt:f,tag:m,attestation:d}),p)},I=`Failed to publish custom payload, please try again. id:${T} tag:${m}`;try{_e((r=R.params)==null?void 0:r.prompt)&&((s=R.params)==null||delete s.prompt),_e((o=R.params)==null?void 0:o.tag)&&((c=R.params)==null||delete c.tag);const g=new Promise(async L=>{const D=({id:v})=>{var b;((b=R.id)==null?void 0:b.toString())===v.toString()&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(ce.publish,D),L())};this.relayer.events.on(ce.publish,D);const w=ft(new Promise((v,b)=>{this.rpcPublish(R,h).then(v).catch(A=>{this.logger.warn(A,A?.message),b(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${E} id:${T} tag:${m}`);try{await w,this.events.removeListener(ce.publish,D)}catch(v){this.queue.set(T,{request:R,opts:h,attempt:1}),this.logger.warn(v,v?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:T,payload:u,opts:h}}),await ft(g,this.publishTimeout,I)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(l=h?.internal)!=null&&l.throwOnFailedPublish)throw g}finally{this.queue.delete(T)}}),Ye(this,"on",(n,r)=>{this.events.on(n,r)}),Ye(this,"once",(n,r)=>{this.events.once(n,r)}),Ye(this,"off",(n,r)=>{this.events.off(n,r)}),Ye(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),this.relayer=t,this.logger=xe(e,this.name),this.registerEventListeners()}get context(){return je(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const n=await this.relayer.request(t);return this.relayer.events.emit(ce.publish,mi(mi({},t),e)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var n;const r=t.attempt+1;this.queue.set(e,ac(mi({},t),{attempt:r})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(n=t.request.params)==null?void 0:n.tag}, attempt: ${r}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ai.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ce.connection_stalled);return}this.checkQueue()}),this.relayer.on(ce.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var Tv=Object.defineProperty,Av=(i,t,e)=>t in i?Tv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yi=(i,t,e)=>Av(i,typeof t!="symbol"?t+"":t,e);class Pv{constructor(){yi(this,"map",new Map),yi(this,"set",(t,e)=>{const n=this.get(t);this.exists(t,e)||this.map.set(t,[...n,e])}),yi(this,"get",t=>this.map.get(t)||[]),yi(this,"exists",(t,e)=>this.get(t).includes(e)),yi(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const n=this.get(t);if(!this.exists(t,e))return;const r=n.filter(s=>s!==e);if(!r.length){this.map.delete(t);return}this.map.set(t,r)}),yi(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var Ov=Object.defineProperty,Rv=Object.defineProperties,Lv=Object.getOwnPropertyDescriptors,cc=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Vv=Object.prototype.propertyIsEnumerable,Ps=(i,t,e)=>t in i?Ov(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zi=(i,t)=>{for(var e in t||(t={}))Dv.call(t,e)&&Ps(i,e,t[e]);if(cc)for(var e of cc(t))Vv.call(t,e)&&Ps(i,e,t[e]);return i},Nr=(i,t)=>Rv(i,Lv(t)),ie=(i,t,e)=>Ps(i,typeof t!="symbol"?t+"":t,e);class Sv extends s_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ie(this,"subscriptions",new Map),ie(this,"topicMap",new Pv),ie(this,"events",new li.EventEmitter),ie(this,"name",yE),ie(this,"version",wE),ie(this,"pending",new Map),ie(this,"cached",[]),ie(this,"initialized",!1),ie(this,"storagePrefix",yt),ie(this,"subscribeTimeout",B.toMiliseconds(B.ONE_MINUTE)),ie(this,"initialSubscribeTimeout",B.toMiliseconds(B.ONE_SECOND*15)),ie(this,"clientId"),ie(this,"batchSubscribeTopicsLimit",500),ie(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),ie(this,"subscribe",async(n,r)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:r}});try{const o=er(r),c={topic:n,relay:o,transportType:r?.transportType};(s=r?.internal)!=null&&s.skipSubscribe||this.pending.set(n,c);const l=await this.rpcSubscribe(n,o,r);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:r}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),ie(this,"unsubscribe",async(n,r)=>{this.isInitialized(),typeof r?.id<"u"?await this.unsubscribeById(n,r.id,r):await this.unsubscribeByTopic(n,r)}),ie(this,"isSubscribed",n=>new Promise(r=>{r(this.topicMap.topics.includes(n))})),ie(this,"isKnownTopic",n=>new Promise(r=>{r(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),ie(this,"on",(n,r)=>{this.events.on(n,r)}),ie(this,"once",(n,r)=>{this.events.once(n,r)}),ie(this,"off",(n,r)=>{this.events.off(n,r)}),ie(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),ie(this,"start",async()=>{await this.onConnect()}),ie(this,"stop",async()=>{await this.onDisconnect()}),ie(this,"restart",async()=>{await this.restore(),await this.onRestart()}),ie(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(r=>{n.push(r)}),await this.batchSubscribe(n)}),ie(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Ai.pulse,async()=>{await this.checkPending()}),this.events.on(Fe.created,async n=>{const r=Fe.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:n}),await this.persist()}),this.events.on(Fe.deleted,async n=>{const r=Fe.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:n}),await this.persist()})}),this.relayer=t,this.logger=xe(e,this.name),this.clientId=""}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let n=!1;try{n=this.getSubscription(t).topic===e}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const n=this.topicMap.get(t);await Promise.all(n.map(async r=>await this.unsubscribeById(t,r,e)))}async unsubscribeById(t,e,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}});try{const r=er(n);await this.restartToComplete({topic:t,id:e,relay:r}),await this.rpcUnsubscribe(t,e,r);const s=oe("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}})}catch(r){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r),r}}async rpcSubscribe(t,e,n){var r,s;const o=await this.getSubscriptionId(t);if((r=n?.internal)!=null&&r.skipSubscribe)return o;(!n||n?.transportType===re.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:Ei(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=n?.internal)==null?void 0:s.throwOnFailedPublish;try{if(n?.transportType===re.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(d=>this.logger.warn(d))},B.toMiliseconds(B.ONE_SECOND)),o;const u=new Promise(async d=>{const p=_=>{_.topic===t&&(this.events.removeListener(Fe.created,p),d(_.id))};this.events.on(Fe.created,p);try{const _=await ft(new Promise((f,m)=>{this.relayer.request(c).catch(y=>{this.logger.warn(y,y?.message),m(y)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(Fe.created,p),d(_)}catch{}}),h=await ft(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!h&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return h?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ce.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,n={method:Ei(e.protocol).batchSubscribe,params:{topics:t.map(r=>r.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ft(new Promise(r=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(r)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(ce.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,n={method:Ei(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let r;try{r=await await ft(new Promise((s,o)=>{this.relayer.request(n).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(ce.connection_stalled)}return r}rpcUnsubscribe(t,e,n){const r={method:Ei(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(t,e){this.setSubscription(t,Nr(zi({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,zi({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,n){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,zi({},e)),this.topicMap.set(e.topic,t),this.events.emit(Fe.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(Fe.deleted,Nr(zi({},n),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Fe.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<e;n++){const r=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(r)}}this.events.emit(Fe.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var n;return e.topic===((n=this.subscriptions.get(e.id))==null?void 0:n.topic)})){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Nr(zi({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await um(B.toMiliseconds(B.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Qe(t+await this.getClientId())}}var xv=Object.defineProperty,lc=Object.getOwnPropertySymbols,Cv=Object.prototype.hasOwnProperty,$v=Object.prototype.propertyIsEnumerable,Os=(i,t,e)=>t in i?xv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,uc=(i,t)=>{for(var e in t||(t={}))Cv.call(t,e)&&Os(i,e,t[e]);if(lc)for(var e of lc(t))$v.call(t,e)&&Os(i,e,t[e]);return i},Q=(i,t,e)=>Os(i,typeof t!="symbol"?t+"":t,e);class kv extends n_{constructor(t){super(t),Q(this,"protocol","wc"),Q(this,"version",2),Q(this,"core"),Q(this,"logger"),Q(this,"events",new li.EventEmitter),Q(this,"provider"),Q(this,"messages"),Q(this,"subscriber"),Q(this,"publisher"),Q(this,"name",dE),Q(this,"transportExplicitlyClosed",!1),Q(this,"initialized",!1),Q(this,"connectionAttemptInProgress",!1),Q(this,"relayUrl"),Q(this,"projectId"),Q(this,"packageName"),Q(this,"bundleId"),Q(this,"hasExperiencedNetworkDisruption",!1),Q(this,"pingTimeout"),Q(this,"heartBeatTimeout",B.toMiliseconds(B.THIRTY_SECONDS+B.FIVE_SECONDS)),Q(this,"reconnectTimeout"),Q(this,"connectPromise"),Q(this,"reconnectInProgress",!1),Q(this,"requestsInFlight",[]),Q(this,"connectTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Q(this,"request",async e=>{var n,r;this.logger.debug("Publishing Request Payload");const s=e.id||Qt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(n=e.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((r=e.params)==null?void 0:r.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Q(this,"resetPingTimeout",()=>{Yn()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,n,r,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(r=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:r.terminate)==null||s.call(r)}catch(o){this.logger.warn(o,o?.message)}},this.heartBeatTimeout))}),Q(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Q(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(ce.connect)}),Q(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Q(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(ce.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Q(this,"registerProviderListeners",()=>{this.provider.on(Je.payload,this.onPayloadHandler),this.provider.on(Je.connect,this.onConnectHandler),this.provider.on(Je.disconnect,this.onDisconnectHandler),this.provider.on(Je.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?xe(t.logger,this.name):or(Xs({level:t.logger||hE})),this.messages=new yv(this.logger,t.core),this.subscriber=new Sv(this,this.logger),this.publisher=new Iv(this,this.logger),this.projectId=t?.projectId,this.relayUrl=t?.relayUrl||xu,Gf()?this.packageName=oa():Jf()&&(this.bundleId=oa()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t?.message))}get context(){return je(this.logger)}get connected(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,n){this.isInitialized(),await this.publisher.publish(t,e,n),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:re.relay},Nn.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var n,r,s;this.isInitialized(),(!(e!=null&&e.transportType)||e?.transportType==="relay")&&await this.toEstablishConnection();const o=typeof((n=e?.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(r=e?.internal)==null?void 0:r.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=h=>{h.topic===t&&(this.subscriber.off(Fe.created,u),l())};return await Promise.all([new Promise(h=>{l=h,this.subscriber.on(Fe.created,u)}),new Promise(async(h,d)=>{c=await this.subscriber.subscribe(t,uc({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&d(p)})||c,h()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await ft(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,n)=>{await this.connect(t).then(e).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ya())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if(t?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((n,r)=>n.publishedAt-r.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const n of e)try{await this.onMessageEvent(n)}catch(r){this.logger.warn(r,"Error while processing batch message event: "+r?.message)}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:n}=t;if(!e.sessionExists){const r=pe(B.FIVE_MINUTES),s={topic:n,expiry:r,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ce.message,t),await this.recordMessageEvent(t,Nn.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(n,r)=>{const s=()=>{r(new Error("Connection interrupted while trying to connect"))};this.provider.once(Je.disconnect,s),await ft(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{r(o)}).finally(()=>{this.provider.off(Je.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{r(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Je.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Je.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const r=n;this.logger.warn({},r.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(n=>setTimeout(n,B.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,n,r,s;if(Yn())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(r=(n=this.provider)==null?void 0:n.connection)==null?void 0:r.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Xh(new ed(em({sdkVersion:vs,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:n,message:r}=t;await this.messages.set(n,r,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:n}=t;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const r=this.messages.has(e,n);return r&&this.logger.warn(`Ignoring duplicate message: ${n}`),r}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),qs(t)){if(!t.method.endsWith(pE))return;const e=t.params,{topic:n,message:r,publishedAt:s,attestation:o}=e.data,c={topic:n,message:r,publishedAt:s,transportType:re.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(uc({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else zs(t)&&this.events.emit(ce.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Nn.inbound),this.events.emit(ce.message,t))}async acknowledgePayload(t){const e=jn(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Je.payload,this.onPayloadHandler),this.provider.off(Je.connect,this.onConnectHandler),this.provider.off(Je.disconnect,this.onDisconnectHandler),this.provider.off(Je.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ya();zg(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(n=>this.logger.error(n,n?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Ai.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Fg())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(ce.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},B.toMiliseconds(_E)))))}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function Uv(i,t){return i===t||Number.isNaN(i)&&Number.isNaN(t)}function hc(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function dc(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Nv="[object RegExp]",Bv="[object String]",Mv="[object Number]",qv="[object Boolean]",pc="[object Arguments]",zv="[object Symbol]",jv="[object Date]",Kv="[object Map]",Fv="[object Set]",Wv="[object Array]",Hv="[object Function]",Gv="[object ArrayBuffer]",Br="[object Object]",Jv="[object Error]",Yv="[object DataView]",Zv="[object Uint8Array]",Qv="[object Uint8ClampedArray]",Xv="[object Uint16Array]",eb="[object Uint32Array]",tb="[object BigUint64Array]",ib="[object Int8Array]",nb="[object Int16Array]",rb="[object Int32Array]",sb="[object BigInt64Array]",ob="[object Float32Array]",ab="[object Float64Array]";function cb(){}function _c(i){if(!i||typeof i!="object")return!1;const t=Object.getPrototypeOf(i);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(i)==="[object Object]":!1}function lb(i,t,e){return Hi(i,t,void 0,void 0,void 0,void 0,e)}function Hi(i,t,e,n,r,s,o){const c=o(i,t,e,n,r,s);if(c!==void 0)return c;if(typeof i==typeof t)switch(typeof i){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return i===t;case"number":return i===t||Object.is(i,t);case"function":return i===t;case"object":return tn(i,t,s,o)}return tn(i,t,s,o)}function tn(i,t,e,n){if(Object.is(i,t))return!0;let r=dc(i),s=dc(t);if(r===pc&&(r=Br),s===pc&&(s=Br),r!==s)return!1;switch(r){case Bv:return i.toString()===t.toString();case Mv:{const l=i.valueOf(),u=t.valueOf();return Uv(l,u)}case qv:case jv:case zv:return Object.is(i.valueOf(),t.valueOf());case Nv:return i.source===t.source&&i.flags===t.flags;case Hv:return i===t}e=e??new Map;const o=e.get(i),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(i,t),e.set(t,i);try{switch(r){case Kv:{if(i.size!==t.size)return!1;for(const[l,u]of i.entries())if(!t.has(l)||!Hi(u,t.get(l),l,i,t,e,n))return!1;return!0}case Fv:{if(i.size!==t.size)return!1;const l=Array.from(i.values()),u=Array.from(t.values());for(let h=0;h<l.length;h++){const d=l[h],p=u.findIndex(_=>Hi(d,_,void 0,i,t,e,n));if(p===-1)return!1;u.splice(p,1)}return!0}case Wv:case Zv:case Qv:case Xv:case eb:case tb:case ib:case nb:case rb:case sb:case ob:case ab:{if(typeof te<"u"&&te.isBuffer(i)!==te.isBuffer(t)||i.length!==t.length)return!1;for(let l=0;l<i.length;l++)if(!Hi(i[l],t[l],l,i,t,e,n))return!1;return!0}case Gv:return i.byteLength!==t.byteLength?!1:tn(new Uint8Array(i),new Uint8Array(t),e,n);case Yv:return i.byteLength!==t.byteLength||i.byteOffset!==t.byteOffset?!1:tn(new Uint8Array(i),new Uint8Array(t),e,n);case Jv:return i.name===t.name&&i.message===t.message;case Br:{if(!(tn(i.constructor,t.constructor,e,n)||_c(i)&&_c(t)))return!1;const l=[...Object.keys(i),...hc(i)],u=[...Object.keys(t),...hc(t)];if(l.length!==u.length)return!1;for(let h=0;h<l.length;h++){const d=l[h],p=i[d];if(!Object.hasOwn(t,d))return!1;const _=t[d];if(!Hi(p,_,d,i,t,e,n))return!1}return!0}default:return!1}}finally{e.delete(i),e.delete(t)}}function ub(i,t){return lb(i,t,cb)}var hb=Object.defineProperty,fc=Object.getOwnPropertySymbols,db=Object.prototype.hasOwnProperty,pb=Object.prototype.propertyIsEnumerable,Rs=(i,t,e)=>t in i?hb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mc=(i,t)=>{for(var e in t||(t={}))db.call(t,e)&&Rs(i,e,t[e]);if(fc)for(var e of fc(t))pb.call(t,e)&&Rs(i,e,t[e]);return i},Ce=(i,t,e)=>Rs(i,typeof t!="symbol"?t+"":t,e);class di extends r_{constructor(t,e,n,r=yt,s=void 0){super(t,e,n,r),this.core=t,this.logger=e,this.name=n,Ce(this,"map",new Map),Ce(this,"version",fE),Ce(this,"cached",[]),Ce(this,"initialized",!1),Ce(this,"getKey"),Ce(this,"storagePrefix",yt),Ce(this,"recentlyDeleted",[]),Ce(this,"recentlyDeletedLimit",200),Ce(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!_e(o)?this.map.set(this.getKey(o),o):gg(o)?this.map.set(o.id,o):Eg(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Ce(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),Ce(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Ce(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>ub(c[l],o[l]))):this.values)),Ce(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=mc(mc({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),Ce(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=xe(e,this.name),this.storagePrefix=r,this.getKey=s}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:r}=N("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var _b=Object.defineProperty,fb=(i,t,e)=>t in i?_b(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,G=(i,t,e)=>fb(i,typeof t!="symbol"?t+"":t,e);class mb{constructor(t,e){this.core=t,this.logger=e,G(this,"name",gE),G(this,"version",EE),G(this,"events",new jc),G(this,"pairings"),G(this,"initialized",!1),G(this,"storagePrefix",yt),G(this,"ignoredPayloadTypes",[Pt]),G(this,"registeredMethods",[]),G(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),G(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),G(this,"create",async n=>{this.isInitialized();const r=ws(),s=await this.core.crypto.setSymKey(r),o=pe(B.FIVE_MINUTES),c={protocol:Su},l={topic:s,expiry:o,relay:c,active:!1,methods:n?.methods},u=qa({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:r,relay:c,expiryTimestamp:o,methods:n?.methods});return this.events.emit(Zt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:n?.transportType,internal:n?.internal}),{topic:s,uri:u}}),G(this,"pair",async n=>{this.isInitialized();const r=this.core.eventClient.createEvent({properties:{topic:n?.uri,trace:[dt.pairing_started]}});this.isValidPair(n,r);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=Ma(n.uri);r.props.properties.topic=s,r.addTrace(dt.pairing_uri_validation_success),r.addTrace(dt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),r.addTrace(dt.existing_pairing),h.active)throw r.setError(It.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);r.addTrace(dt.pairing_not_expired)}const d=l||pe(B.FIVE_MINUTES),p={topic:s,relay:c,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,p),r.addTrace(dt.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Zt.create,p),r.addTrace(dt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),r.addTrace(dt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(It.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw r.setError(It.subscribe_pairing_topic_failure),_}return r.addTrace(dt.subscribe_pairing_topic_success),p}),G(this,"activate",async({topic:n})=>{this.isInitialized();const r=pe(B.FIVE_MINUTES);this.core.expirer.set(n,r),await this.pairings.update(n,{active:!0,expiry:r})}),G(this,"ping",async n=>{this.isInitialized(),await this.isValidPing(n),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:r}=n;if(this.pairings.keys.includes(r)){const s=await this.sendRequest(r,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Yt();this.events.once(X("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),G(this,"updateExpiry",async({topic:n,expiry:r})=>{this.isInitialized(),await this.pairings.update(n,{expiry:r})}),G(this,"updateMetadata",async({topic:n,metadata:r})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:r})}),G(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),G(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:r}=n;this.pairings.keys.includes(r)&&(await this.sendRequest(r,"wc_pairingDelete",oe("USER_DISCONNECTED")),await this.deletePairing(r))}),G(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:r,relay:s,expiry:o,methods:c}=n,l=this.core.crypto.keychain.get(r);return qa({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),G(this,"sendRequest",async(n,r,s)=>{const o=Ut(r,s),c=await this.core.crypto.encode(n,o),l=Bi[r].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,l),o.id}),G(this,"sendResult",async(n,r,s)=>{const o=jn(n,s),c=await this.core.crypto.encode(r,o),l=(await this.core.history.get(r,n)).request.method,u=Bi[l].res;await this.core.relayer.publish(r,c,u),await this.core.history.resolve(o)}),G(this,"sendError",async(n,r,s)=>{const o=Kc(n,s),c=await this.core.crypto.encode(r,o),l=(await this.core.history.get(r,n)).request.method,u=Bi[l]?Bi[l].res:Bi.unregistered_method.res;await this.core.relayer.publish(r,c,u),await this.core.history.resolve(o)}),G(this,"deletePairing",async(n,r)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,oe("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),r?Promise.resolve():this.core.expirer.del(n)])}),G(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(r=>Nt(r.expiry));await Promise.all(n.map(r=>this.deletePairing(r.topic)))}),G(this,"onRelayEventRequest",async n=>{const{topic:r,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(r,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(r,s);default:return await this.onUnknownRpcMethodRequest(r,s)}}),G(this,"onRelayEventResponse",async n=>{const{topic:r,payload:s}=n,o=(await this.core.history.get(r,s.id)).request.method;return o==="wc_pairingPing"?this.onPairingPingResponse(r,s):this.onUnknownRpcMethodResponse(o)}),G(this,"onPairingPingRequest",async(n,r)=>{const{id:s}=r;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Zt.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onPairingPingResponse",(n,r)=>{const{id:s}=r;setTimeout(()=>{vt(r)?this.events.emit(X("pairing_ping",s),{}):pt(r)&&this.events.emit(X("pairing_ping",s),{error:r.error})},500)}),G(this,"onPairingDeleteRequest",async(n,r)=>{const{id:s}=r;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Zt.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onUnknownRpcMethodRequest",async(n,r)=>{const{id:s,method:o}=r;try{if(this.registeredMethods.includes(o))return;const c=oe("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}}),G(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(oe("WC_METHOD_UNSUPPORTED",n))}),G(this,"isValidPair",(n,r)=>{var s;if(!ke(n)){const{message:c}=N("MISSING_OR_INVALID",`pair() params: ${n}`);throw r.setError(It.malformed_pairing_uri),new Error(c)}if(!wg(n.uri)){const{message:c}=N("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw r.setError(It.malformed_pairing_uri),new Error(c)}const o=Ma(n?.uri);if(!((s=o?.relay)!=null&&s.protocol)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#relay-protocol");throw r.setError(It.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#symKey");throw r.setError(It.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&B.toMiliseconds(o?.expiryTimestamp)<Date.now()){r.setError(It.pairing_expired);const{message:c}=N("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),G(this,"isValidPing",async n=>{if(!ke(n)){const{message:s}=N("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidPairingTopic(r)}),G(this,"isValidDisconnect",async n=>{if(!ke(n)){const{message:s}=N("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidPairingTopic(r)}),G(this,"isValidPairingTopic",async n=>{if(!he(n,!1)){const{message:r}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(r)}if(!this.pairings.keys.includes(n)){const{message:r}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(r)}if(Nt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:r}=N("EXPIRED",`pairing topic: ${n}`);throw new Error(r)}}),this.core=t,this.logger=xe(e,this.name),this.pairings=new di(this.core,this.logger,this.name,this.storagePrefix)}get context(){return je(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(ce.message,async t=>{const{topic:e,message:n,transportType:r}=t;if(this.pairings.keys.includes(e)&&r!==re.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(e,n);qs(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):zs(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Ze.expired,async t=>{const{topic:e}=kl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Zt.expire,{topic:e}))})}}var yb=Object.defineProperty,wb=(i,t,e)=>t in i?yb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ve=(i,t,e)=>wb(i,typeof t!="symbol"?t+"":t,e);class gb extends e_{constructor(t,e){super(t,e),this.core=t,this.logger=e,ve(this,"records",new Map),ve(this,"events",new li.EventEmitter),ve(this,"name",vE),ve(this,"version",bE),ve(this,"cached",[]),ve(this,"initialized",!1),ve(this,"storagePrefix",yt),ve(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),ve(this,"set",(n,r,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:r,chainId:s}),this.records.has(r.id))return;const o={id:r.id,topic:n,request:{method:r.method,params:r.params||null},chainId:s,expiry:pe(B.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),ve(this,"resolve",async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const r=await this.getRecord(n.id);typeof r.response>"u"&&(r.response=pt(n)?{error:n.error}:{result:n.result},this.records.set(r.id,r),this.persist(),this.events.emit(nt.updated,r))}),ve(this,"get",async(n,r)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:r}),await this.getRecord(r))),ve(this,"delete",(n,r)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:r}),this.values.forEach(s=>{if(s.topic===n){if(typeof r<"u"&&s.id!==r)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),ve(this,"exists",async(n,r)=>(this.isInitialized(),this.records.has(r)?(await this.getRecord(r)).topic===n:!1)),ve(this,"on",(n,r)=>{this.events.on(n,r)}),ve(this,"once",(n,r)=>{this.events.once(n,r)}),ve(this,"off",(n,r)=>{this.events.off(n,r)}),ve(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),this.logger=xe(e,this.name)}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const n={topic:e.topic,request:Ut(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(nt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(nt.created,t=>{const e=nt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.updated,t=>{const e=nt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.deleted,t=>{const e=nt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Ai.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{B.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(nt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Eb=Object.defineProperty,vb=(i,t,e)=>t in i?Eb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oe=(i,t,e)=>vb(i,typeof t!="symbol"?t+"":t,e);class bb extends o_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Oe(this,"expirations",new Map),Oe(this,"events",new li.EventEmitter),Oe(this,"name",IE),Oe(this,"version",TE),Oe(this,"cached",[]),Oe(this,"initialized",!1),Oe(this,"storagePrefix",yt),Oe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Oe(this,"has",n=>{try{const r=this.formatTarget(n);return typeof this.getExpiration(r)<"u"}catch{return!1}}),Oe(this,"set",(n,r)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:r};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ze.created,{target:s,expiration:o})}),Oe(this,"get",n=>{this.isInitialized();const r=this.formatTarget(n);return this.getExpiration(r)}),Oe(this,"del",n=>{if(this.isInitialized(),this.has(n)){const r=this.formatTarget(n),s=this.getExpiration(r);this.expirations.delete(r),this.events.emit(Ze.deleted,{target:r,expiration:s})}}),Oe(this,"on",(n,r)=>{this.events.on(n,r)}),Oe(this,"once",(n,r)=>{this.events.once(n,r)}),Oe(this,"off",(n,r)=>{this.events.off(n,r)}),Oe(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),this.logger=xe(e,this.name)}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return tm(t);if(typeof t=="number")return im(t);const{message:e}=N("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ze.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(n),new Error(n)}return e}checkExpiry(t,e){const{expiry:n}=e;B.toMiliseconds(n)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Ze.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Ai.pulse,()=>this.checkExpirations()),this.events.on(Ze.created,t=>{const e=Ze.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ze.expired,t=>{const e=Ze.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ze.deleted,t=>{const e=Ze.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Ib=Object.defineProperty,Tb=(i,t,e)=>t in i?Ib(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ue=(i,t,e)=>Tb(i,typeof t!="symbol"?t+"":t,e);class Ab extends a_{constructor(t,e,n){super(t,e,n),this.core=t,this.logger=e,this.store=n,ue(this,"name",AE),ue(this,"abortController"),ue(this,"isDevEnv"),ue(this,"verifyUrlV3",OE),ue(this,"storagePrefix",yt),ue(this,"version",Vu),ue(this,"publicKey"),ue(this,"fetchPromise"),ue(this,"init",async()=>{var r;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&B.toMiliseconds((r=this.publicKey)==null?void 0:r.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),ue(this,"register",async r=>{if(!Li()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=r,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Ot.getDocument(),h=this.startAbortTimer(B.ONE_SECOND*5),d=await new Promise((p,_)=>{const f=()=>{window.removeEventListener("message",y),u.body.removeChild(m),_("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",f,{signal:this.abortController.signal});const y=T=>{if(T.data&&typeof T.data=="string")try{const O=JSON.parse(T.data);if(O.type==="verify_attestation"){if(Yr(O.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(O.attestation===null?"":O.attestation)}}catch(O){this.logger.warn(O)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),ue(this,"resolve",async r=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=r;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Yr(s).payload.id!==c)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(r?.verifyUrl);return this.fetchAttestation(o,l)}),ue(this,"fetchAttestation",async(r,s)=>{this.logger.debug(`resolving attestation: ${r} from url: ${s}`);const o=this.startAbortTimer(B.ONE_SECOND*5),c=await fetch(`${s}/attestation/${r}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),ue(this,"getVerifyUrl",r=>{let s=r||en;return RE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${en}`),s=en),s}),ue(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const r=this.startAbortTimer(B.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(r),await s.json()}catch(r){this.logger.warn(r)}}),ue(this,"persistPublicKey",async r=>{this.logger.debug("persisting public key to local storage",r),await this.store.setItem(this.storeKey,r),this.publicKey=r}),ue(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),ue(this,"isValidJwtAttestation",async r=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(r,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(r,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),ue(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),ue(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const r=await this.fetchPromise;return this.fetchPromise=void 0,r}),ue(this,"validateAttestation",(r,s)=>{const o=Yw(r,s.publicKey),c={hasExpired:B.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=xe(e,this.name),this.abortController=new AbortController,this.isDevEnv=ro(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return je(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),B.toMiliseconds(t))}}var Pb=Object.defineProperty,Ob=(i,t,e)=>t in i?Pb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yc=(i,t,e)=>Ob(i,typeof t!="symbol"?t+"":t,e);class Rb extends c_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,yc(this,"context",LE),yc(this,"registerDeviceToken",async n=>{const{clientId:r,token:s,notificationType:o,enableEncrypted:c=!1}=n,l=`${DE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:r,type:o,token:s,always_raw:c})})}),this.logger=xe(e,this.context)}}var Lb=Object.defineProperty,wc=Object.getOwnPropertySymbols,Db=Object.prototype.hasOwnProperty,Vb=Object.prototype.propertyIsEnumerable,Ls=(i,t,e)=>t in i?Lb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ji=(i,t)=>{for(var e in t||(t={}))Db.call(t,e)&&Ls(i,e,t[e]);if(wc)for(var e of wc(t))Vb.call(t,e)&&Ls(i,e,t[e]);return i},fe=(i,t,e)=>Ls(i,typeof t!="symbol"?t+"":t,e);class Sb extends l_{constructor(t,e,n=!0){super(t,e,n),this.core=t,this.logger=e,fe(this,"context",SE),fe(this,"storagePrefix",yt),fe(this,"storageVersion",VE),fe(this,"events",new Map),fe(this,"shouldPersist",!1),fe(this,"init",async()=>{if(!ro())try{const r={eventId:ca(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Cl(this.core.relayer.protocol,this.core.relayer.version,vs)}}};await this.sendEvent([r])}catch(r){this.logger.warn(r)}}),fe(this,"createEvent",r=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=r,u=ca(),h=this.core.projectId||"",d=Date.now(),p=ji({eventId:u,timestamp:d,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:h,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),fe(this,"getEvent",r=>{const{eventId:s,topic:o}=r;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return ji(ji({},c),this.setMethods(c.eventId))}),fe(this,"deleteEvent",r=>{const{eventId:s}=r;this.events.delete(s),this.shouldPersist=!0}),fe(this,"setEventListeners",()=>{this.core.heartbeat.on(Ai.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(r=>{B.fromMiliseconds(Date.now())-B.fromMiliseconds(r.timestamp)>xE&&(this.events.delete(r.eventId),this.shouldPersist=!0)})})}),fe(this,"setMethods",r=>({addTrace:s=>this.addTrace(r,s),setError:s=>this.setError(r,s)})),fe(this,"addTrace",(r,s)=>{const o=this.events.get(r);o&&(o.props.properties.trace.push(s),this.events.set(r,o),this.shouldPersist=!0)}),fe(this,"setError",(r,s)=>{const o=this.events.get(r);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(r,o),this.shouldPersist=!0)}),fe(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),fe(this,"restore",async()=>{try{const r=await this.core.storage.getItem(this.storageKey)||[];if(!r.length)return;r.forEach(s=>{this.events.set(s.eventId,ji(ji({},s),this.setMethods(s.eventId)))})}catch(r){this.logger.warn(r)}}),fe(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const r=[];for(const[s,o]of this.events)o.props.type&&r.push(o);if(r.length!==0)try{if((await this.sendEvent(r)).ok)for(const s of r)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),fe(this,"sendEvent",async r=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${CE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${vs}${s}`,{method:"POST",body:JSON.stringify(r)})}),fe(this,"getAppDomain",()=>xl().url),this.logger=xe(e,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var xb=Object.defineProperty,gc=Object.getOwnPropertySymbols,Cb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable,Ds=(i,t,e)=>t in i?xb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ec=(i,t)=>{for(var e in t||(t={}))Cb.call(t,e)&&Ds(i,e,t[e]);if(gc)for(var e of gc(t))$b.call(t,e)&&Ds(i,e,t[e]);return i},ne=(i,t,e)=>Ds(i,typeof t!="symbol"?t+"":t,e);class go extends Yp{constructor(t){var e;super(t),ne(this,"protocol",Du),ne(this,"version",Vu),ne(this,"name",Es),ne(this,"relayUrl"),ne(this,"projectId"),ne(this,"customStoragePrefix"),ne(this,"events",new li.EventEmitter),ne(this,"logger"),ne(this,"heartbeat"),ne(this,"relayer"),ne(this,"crypto"),ne(this,"storage"),ne(this,"history"),ne(this,"expirer"),ne(this,"pairing"),ne(this,"verify"),ne(this,"echoClient"),ne(this,"linkModeSupportedApps"),ne(this,"eventClient"),ne(this,"initialized",!1),ne(this,"logChunkController"),ne(this,"on",(c,l)=>this.events.on(c,l)),ne(this,"once",(c,l)=>this.events.once(c,l)),ne(this,"off",(c,l)=>this.events.off(c,l)),ne(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ne(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const h={topic:c,message:l,publishedAt:Date.now(),transportType:re.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})});const n=this.getGlobalCore(t?.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t?.projectId,this.relayUrl=t?.relayUrl||xu,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const r=Xs({level:typeof t?.logger=="string"&&t.logger?t.logger:tE.logger,name:Es}),{logger:s,chunkLoggerController:o}=Hp({opts:r,maxSizeInBytes:t?.maxLogBlobSizeInBytes,loggerOverride:t?.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=xe(s,this.name),this.heartbeat=new Qh,this.crypto=new lv(this,this.logger,t?.keychain),this.history=new gb(this,this.logger),this.expirer=new bb(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new Vp(Ec(Ec({},iE),t?.storageOptions)),this.relayer=new kv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new mb(this,this.logger),this.verify=new Ab(this,this.logger,this.storage),this.echoClient=new Rb(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Sb(this,this.logger,t?.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new go(t);await e.initialize();const n=await e.crypto.getClientId();return await e.storage.setItem(mE,n),e}get context(){return je(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(Qa,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(Qa)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,n=`${e}_count`;return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[n]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[n]=t}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof jt<"u"&&eE.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const kb=go,Wu="wc",Hu=2,Gu="client",Eo=`${Wu}@${Hu}:${Gu}:`,Mr={name:Gu,logger:"error"},vc="WALLETCONNECT_DEEPLINK_CHOICE",Ub="proposal",bc="Proposal expired",Nb="session",wi=B.SEVEN_DAYS,Bb="engine",be={wc_sessionPropose:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1104},res:{ttl:B.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1106},res:{ttl:B.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1112},res:{ttl:B.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1114},res:{ttl:B.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:B.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:B.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1119}}},qr={min:B.FIVE_MINUTES,max:B.SEVEN_DAYS},ht={idle:"IDLE",active:"ACTIVE"},Mb={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},qb="request",zb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],jb="wc",Kb="auth",Fb="authKeys",Wb="pairingTopics",Hb="requests",fr=`${jb}@${1.5}:${Kb}:`,Bn=`${fr}:PUB_KEY`;var Gb=Object.defineProperty,Jb=Object.defineProperties,Yb=Object.getOwnPropertyDescriptors,Ic=Object.getOwnPropertySymbols,Zb=Object.prototype.hasOwnProperty,Qb=Object.prototype.propertyIsEnumerable,Vs=(i,t,e)=>t in i?Gb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t)=>{for(var e in t||(t={}))Zb.call(t,e)&&Vs(i,e,t[e]);if(Ic)for(var e of Ic(t))Qb.call(t,e)&&Vs(i,e,t[e]);return i},Re=(i,t)=>Jb(i,Yb(t)),x=(i,t,e)=>Vs(i,typeof t!="symbol"?t+"":t,e);class Xb extends p_{constructor(t){super(t),x(this,"name",Bb),x(this,"events",new jc),x(this,"initialized",!1),x(this,"requestQueue",{state:ht.idle,queue:[]}),x(this,"sessionRequestQueue",{state:ht.idle,queue:[]}),x(this,"emittedSessionRequests",new hm({limit:500})),x(this,"requestQueueDelay",B.ONE_SECOND),x(this,"expectedPairingMethodMap",new Map),x(this,"recentlyDeletedMap",new Map),x(this,"recentlyDeletedLimit",200),x(this,"relayMessageCache",[]),x(this,"pendingSessions",new Map),x(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(be)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay)))}),x(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Re(ee({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=pg(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:r,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=n;let h=r,d,p=!1;try{if(h){const g=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=g.active}}catch(g){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),g}if(!h||!p){const{topic:g,uri:L}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=g,d=L}if(!h){const{message:g}=N("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(g)}const _=await this.client.core.crypto.generateKeyPair(),f=be.wc_sessionPropose.req.ttl||B.FIVE_MINUTES,m=pe(f),y=Re(ee(ee({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Su}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:h},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Lt()}),T=X("session_connect",y.id),{reject:O,resolve:E,done:R}=Yt(f,bc),I=({id:g})=>{g===y.id&&(this.client.events.off("proposal_expire",I),this.pendingSessions.delete(y.id),this.events.emit(T,{error:{message:bc,code:0}}))};return this.client.events.on("proposal_expire",I),this.events.once(T,({error:g,session:L})=>{this.client.events.off("proposal_expire",I),g?O(g):L&&E(L)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:d,approval:R}}),x(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(n){throw this.client.logger.error("pair() failed"),n}}),x(this,"approve",async e=>{var n,r,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=e?.id)==null?void 0:n.toString(),trace:[kt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(Mi.no_internet_connection),w}try{await this.isValidProposalId(e?.id)}catch(w){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),o.setError(Mi.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Mi.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=e,_=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:m,requiredNamespaces:y,optionalNamespaces:T}=_;let O=(r=this.client.core.eventClient)==null?void 0:r.getEvent({topic:f});O||(O=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:kt.session_approve_started,properties:{topic:f,trace:[kt.session_approve_started,kt.session_namespaces_validation_success]}}));const E=await this.client.core.crypto.generateKeyPair(),R=m.publicKey,I=await this.client.core.crypto.generateSharedKey(E,R),g=ee(ee(ee({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:E,metadata:this.client.metadata},expiry:pe(wi)},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),L=re.relay;O.addTrace(kt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(I,{transportType:L,internal:{skipSubscribe:!0}})}catch(w){throw O.setError(Mi.subscribe_session_topic_failure),w}O.addTrace(kt.subscribe_session_topic_success);const D=Re(ee({},g),{topic:I,requiredNamespaces:y,optionalNamespaces:T,pairingTopic:f,acknowledged:!1,self:g.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:E,transportType:re.relay});await this.client.session.set(I,D),O.addTrace(kt.store_session);try{await this.sendApproveSession({sessionTopic:I,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:E},sessionSettleRequest:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),O.addTrace(kt.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(I,oe("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(I),w}return this.client.core.eventClient.deleteEvent({eventId:O.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:m.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(I,pe(wi)),{topic:I,acknowledged:()=>Promise.resolve(this.client.session.get(I))}}),x(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:r}=e;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&await this.sendError({id:n,topic:s,error:r,rpcOpts:be.wc_sessionPropose.reject}),await this.deleteProposal(n)}),x(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:n,namespaces:r}=e,{done:s,resolve:o,reject:c}=Yt(),l=Lt(),u=Qt().toString(),h=this.client.session.get(n).namespaces;return this.events.once(X("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(n,{namespaces:r}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(n,{namespaces:h}),c(d)}),{acknowledged:s}}),x(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:n}=e,r=Lt(),{done:s,resolve:o,reject:c}=Yt();return this.events.once(X("session_extend",r),({error:l})=>{l?c(l):o()}),await this.setExpiry(n,pe(wi)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),x(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:r,topic:s,expiry:o=be.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);c?.transportType===re.relay&&await this.confirmOnlineStateOrThrow();const l=Lt(),u=Qt().toString(),{done:h,resolve:d,reject:p}=Yt(o,"Request expired. Please try again.");this.events.once(X("session_request",l),({error:y,result:T})=>{y?p(y):d(T)});const _="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:{request:Re(ee({},r),{expiryTimestamp:pe(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:r,chainId:n,id:l}),await h();const m={request:Re(ee({},r),{expiryTimestamp:pe(o)}),chainId:n};return await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(T=>p(T)),this.client.events.emit("session_request_sent",{topic:s,request:r,chainId:n,id:l}),y()}),new Promise(async y=>{var T;if(!((T=c.sessionConfig)!=null&&T.disableDeepLink)){const O=await om(this.client.core.storage,vc);await nm({id:l,topic:s,wcDeepLink:O})}y()}),h()]).then(y=>y[2])}),x(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:n,response:r}=e,{id:s}=r,o=this.client.session.get(n);o.transportType===re.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);vt(r)?await this.sendResult({id:s,topic:n,result:r.result,throwOnFailedPublish:!0,appLink:c}):pt(r)&&await this.sendError({id:s,topic:n,error:r.error,appLink:c}),this.cleanupAfterResponse(e)}),x(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(r){throw this.client.logger.error("ping() -> isValidPing() failed"),r}const{topic:n}=e;if(this.client.session.keys.includes(n)){const r=Lt(),s=Qt().toString(),{done:o,resolve:c,reject:l}=Yt();this.events.once(X("session_ping",r),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:r,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:n}))}),x(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:n,event:r,chainId:s}=e,o=Qt().toString(),c=Lt();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:r,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),x(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:n}=e;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:oe("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:r}=N("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(r)}}),x(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(n=>mg(n,e)))),x(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),x(this,"authenticate",async(e,n)=>{var r;this.isInitialized(),this.isValidAuthenticate(e);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((r=this.client.metadata.redirect)==null?void 0:r.linkMode),o=s?re.link_mode:re.relay;o===re.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:h,nonce:d,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,T=[...e.resources||[]],{topic:O,uri:E}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:O,uri:E}});const R=await this.client.core.crypto.generateKeyPair(),I=Un(R);if(await Promise.all([this.client.auth.authKeys.set(Bn,{responseTopic:I,publicKey:R}),this.client.auth.pairingTopics.set(I,{topic:I,pairingTopic:O})]),await this.client.core.relayer.subscribe(I,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${O}`),m.length>0){const{namespace:C}=$n(c[0]);let U=by(C,"request",m);kn(T)&&(U=Ty(U,T.pop())),T.push(U)}const g=y&&y>be.wc_sessionAuthenticate.req.ttl?y:be.wc_sessionAuthenticate.req.ttl,L={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:_,nbf:f,resources:T},requester:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:pe(g)},D={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:D,relays:[{protocol:"irn"}],pairingTopic:O,proposer:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:pe(be.wc_sessionPropose.req.ttl),id:Lt()},{done:v,resolve:b,reject:A}=Yt(g,"Request expired"),V=Lt(),P=X("session_connect",w.id),S=X("session_request",V),$=async({error:C,session:U})=>{this.events.off(S,k),C?A(C):U&&b({session:U})},k=async C=>{var U,z,j;if(await this.deletePendingAuthRequest(V,{message:"fulfilled",code:0}),C.error){const se=oe("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===se.code?void 0:(this.events.off(P,$),A(C.error.message))}await this.deleteProposal(w.id),this.events.off(P,$);const{cacaos:K,responder:F}=C.result,W=[],H=[];for(const se of K){await ga({cacao:se,projectId:this.client.core.projectId})||(this.client.logger.error(se,"Signature verification failed"),A(oe("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Ge}=se,wt=kn(Ge.resources),To=[ls(Ge.iss)],oh=Zn(Ge.iss);if(wt){const yr=Ea(wt),ah=va(wt);W.push(...yr),To.push(...ah)}for(const yr of To)H.push(`${yr}:${oh}`)}const le=await this.client.core.crypto.generateSharedKey(R,F.publicKey);let ae;W.length>0&&(ae={topic:le,acknowledged:!0,self:{publicKey:R,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:pe(wi),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:O,namespaces:Fa([...new Set(W)],[...new Set(H)]),transportType:o},await this.client.core.relayer.subscribe(le,{transportType:o}),await this.client.session.set(le,ae),O&&await this.client.core.pairing.updateMetadata({topic:O,metadata:F.metadata}),ae=this.client.session.get(le)),(U=this.client.metadata.redirect)!=null&&U.linkMode&&(z=F.metadata.redirect)!=null&&z.linkMode&&(j=F.metadata.redirect)!=null&&j.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(le,{transportType:re.link_mode})),b({auths:K,session:ae})};this.events.once(P,$),this.events.once(S,k);let M;try{if(s){const C=Ut("wc_sessionAuthenticate",L,V);this.client.core.history.set(O,C);const U=await this.client.core.crypto.encode("",C,{type:gn,encoding:zt});M=Vn(n,O,U)}else await Promise.all([this.sendRequest({topic:O,method:"wc_sessionAuthenticate",params:L,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:O,method:"wc_sessionPropose",params:w,expiry:be.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(P,$),this.events.off(S,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Re(ee({},L),{verifyContext:{}}),pairingTopic:O,transportType:o}),{uri:M??E,response:v}}),x(this,"approveSessionAuthenticate",async e=>{const{id:n,auths:r}=e,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[Jt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(qi.no_internet_connection),y}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(qi.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const c=o.transportType||re.relay;c===re.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=Un(l),d={type:Pt,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of r){if(!await ga({cacao:y,projectId:this.client.core.projectId})){s.setError(qi.invalid_cacao);const I=oe("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:h,error:I,encodeOpts:d}),new Error(I.message)}s.addTrace(Jt.cacaos_verified);const{p:T}=y,O=kn(T.resources),E=[ls(T.iss)],R=Zn(T.iss);if(O){const I=Ea(O),g=va(O);p.push(...I),E.push(...g)}for(const I of E)_.push(`${I}:${R}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Jt.create_authenticated_session_topic);let m;if(p?.length>0){m={topic:f,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:pe(wi),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Fa([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Jt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(qi.subscribe_authenticated_session_topic_failure),y}s.addTrace(Jt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Jt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Jt.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:n,result:{cacaos:r,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(qi.authenticated_session_approve_publish_failure),y}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),x(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:n,reason:r}=e,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===re.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=Un(o),u={type:Pt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:l,error:r,encodeOpts:u,rpcOpts:be.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.deleteProposal(n)}),x(this,"formatAuthMessage",e=>{this.isInitialized();const{request:n,iss:r}=e;return Zl(n,r)}),x(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),x(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const n=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(r.length===0)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),x(this,"deleteSession",async e=>{var n;const{topic:r,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,oe("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),s||this.client.core.expirer.del(r),this.client.core.storage.removeItem(vc).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===r&&this.deletePendingSessionRequest(u.id,oe("USER_DISCONNECTED"))}),r===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=ht.idle),o&&this.client.events.emit("session_delete",{id:c,topic:r})}),x(this,"deleteProposal",async(e,n)=>{if(n)try{const r=this.client.proposal.get(e);this.client.core.eventClient.getEvent({topic:r.pairingTopic})?.setError(Mi.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,oe("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),x(this,"deletePendingSessionRequest",async(e,n,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,n),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),r&&(this.sessionRequestQueue.state=ht.idle,this.client.events.emit("session_request_expire",{id:e}))}),x(this,"deletePendingAuthRequest",async(e,n,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,n),r?Promise.resolve():this.client.core.expirer.del(e)])}),x(this,"setExpiry",async(e,n)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,n),await this.client.session.update(e,{expiry:n}))}),x(this,"setProposal",async(e,n)=>{this.client.core.expirer.set(e,pe(be.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,n)}),x(this,"setAuthRequest",async(e,n)=>{const{request:r,pairingTopic:s,transportType:o=re.relay}=n;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:s,verifyContext:r.verifyContext,transportType:o})}),x(this,"setPendingSessionRequest",async e=>{const{id:n,topic:r,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||pe(be.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:r,params:s,verifyContext:o})}),x(this,"sendRequest",async e=>{const{topic:n,method:r,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d,publishOpts:p={}}=e,_=Ut(r,s,l);let f;const m=!!h;try{const O=m?zt:Be;f=await this.client.core.crypto.encode(n,_,{encoding:O})}catch(O){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),O}let y;if(zb.includes(r)){const O=Qe(JSON.stringify(_)),E=Qe(f);y=await this.client.core.verify.register({id:E,decryptedId:O})}const T=ee(ee({},be[r].req),p);if(T.attestation=y,o&&(T.ttl=o),c&&(T.id=c),this.client.core.history.set(n,_),m){const O=Vn(h,n,f);await globalThis.Linking.openURL(O,this.client.name)}else T.tvf=Re(ee({},d),{correlationId:_.id}),u?(T.internal=Re(ee({},T.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,f,T)):this.client.core.relayer.publish(n,f,T).catch(O=>this.client.logger.error(O));return _.id}),x(this,"sendProposeSession",async e=>{const{proposal:n,publishOpts:r}=e,s=Ut("wc_sessionPropose",n,n.id);this.client.core.history.set(n.pairingTopic,s);const o=await this.client.core.crypto.encode(n.pairingTopic,s,{encoding:Be}),c=Qe(JSON.stringify(s)),l=Qe(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:n.pairingTopic,sessionProposal:o},opts:Re(ee({},r),{publishMethod:"wc_proposeSession",attestation:u})})}),x(this,"sendApproveSession",async e=>{const{sessionTopic:n,pairingProposalResponse:r,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=jn(s.id,r),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Be}),h=Ut("wc_sessionSettle",o,c?.id),d=await this.client.core.crypto.encode(n,h,{encoding:Be});this.client.core.history.set(n,h),await this.client.core.relayer.publishCustom({payload:{sessionTopic:n,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:Re(ee({},c),{publishMethod:"wc_approveSession"})})}),x(this,"sendResult",async e=>{const{id:n,topic:r,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=jn(n,s);let h;const d=l&&typeof globalThis?.Linking<"u";try{const f=d?zt:Be;h=await this.client.core.crypto.encode(r,u,Re(ee({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),f}let p,_;try{p=await this.client.core.history.get(r,n);const f=p.request;try{_=this.getTVFParams(n,f.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m?.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${n}) failed`),f}if(d){const f=Vn(l,r,h);await globalThis.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=be[f].res;m.tvf=Re(ee({},_),{correlationId:n}),o?(m.internal=Re(ee({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,h,m)):this.client.core.relayer.publish(r,h,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),x(this,"sendError",async e=>{const{id:n,topic:r,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Kc(n,s);let h;const d=l&&typeof globalThis?.Linking<"u";try{const _=d?zt:Be;h=await this.client.core.crypto.encode(r,u,Re(ee({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),_}let p;try{p=await this.client.core.history.get(r,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${r}, ${n}) failed`),_}if(d){const _=Vn(l,r,h);await globalThis.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||be[_].res;this.client.core.relayer.publish(r,h,f)}await this.client.core.history.resolve(u)}),x(this,"cleanup",async()=>{const e=[],n=[];this.client.session.getAll().forEach(r=>{let s=!1;Nt(r.expiry)&&(s=!0),this.client.core.crypto.keychain.has(r.topic)||(s=!0),s&&e.push(r.topic)}),this.client.proposal.getAll().forEach(r=>{Nt(r.expiryTimestamp)&&n.push(r.id)}),await Promise.all([...e.map(r=>this.deleteSession({topic:r})),...n.map(r=>this.deleteProposal(r))])}),x(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),x(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),x(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ht.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ht.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ht.idle}),x(this,"processRequest",async e=>{const{topic:n,payload:r,attestation:s,transportType:o,encryptedId:c}=e,l=r.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:r,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,r);case"wc_sessionPing":return await this.onSessionPingRequest(n,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:r,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:r,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),x(this,"onRelayEventResponse",async e=>{const{topic:n,payload:r,transportType:s}=e,o=(await this.client.core.history.get(n,r.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,r,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,r);case"wc_sessionExtend":return this.onSessionExtendResponse(n,r);case"wc_sessionPing":return this.onSessionPingResponse(n,r);case"wc_sessionRequest":return this.onSessionRequestResponse(n,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,r);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),x(this,"onRelayEventUnknownPayload",e=>{const{topic:n}=e,{message:r}=N("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)}),x(this,"shouldIgnorePairingRequest",e=>{const{topic:n,requestMethod:r}=e,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(r)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),x(this,"onSessionProposeRequest",async e=>{const{topic:n,payload:r,attestation:s,encryptedId:o}=e,{params:c,id:l}=r;try{const u=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(It.proposal_listener_not_found)),this.isValidConnect(ee({},r.params));const h=c.expiryTimestamp||pe(be.wc_sessionPropose.req.ttl),d=ee({id:l,pairingTopic:n,expiryTimestamp:h,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const p=await this.getVerifyContext({attestationId:s,hash:Qe(JSON.stringify(r)),encryptedId:o,metadata:d.proposer.metadata});u?.addTrace(dt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:p})}catch(u){await this.sendError({id:l,topic:n,error:u,rpcOpts:be.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),x(this,"onSessionProposeResponse",async(e,n,r)=>{const{id:s}=n;if(vt(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const h=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:h,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(h,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(pt(n)){await this.deleteProposal(s);const o=X("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),x(this,"onSessionSettleRequest",async(e,n)=>{const{id:r,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=n.params,_=[...this.pendingSessions.values()].find(y=>y.sessionTopic===e);if(!_)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(_.proposalId),m=Re(ee(ee(ee({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:_.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:_.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),{transportType:re.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:_.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(X("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:n.id,topic:e,result:!0})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionSettleResponse",async(e,n)=>{const{id:r}=n;vt(n)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(X("session_approve",r),{})):pt(n)&&(await this.client.session.delete(e,oe("USER_DISCONNECTED")),this.events.emit(X("session_approve",r),{error:n.error}))}),x(this,"onSessionUpdateRequest",async(e,n)=>{const{params:r,id:s}=n;try{const o=`${e}_session_update`,c=Ni.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:oe("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(ee({topic:e},r));try{Ni.set(o,s),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Ni.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:r})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"isRequestOutOfSync",(e,n)=>n.toString().slice(0,-3)<e.toString().slice(0,-3)),x(this,"onSessionUpdateResponse",(e,n)=>{const{id:r}=n,s=X("session_update",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(X("session_update",r),{}):pt(n)&&this.events.emit(X("session_update",r),{error:n.error})}),x(this,"onSessionExtendRequest",async(e,n)=>{const{id:r}=n;try{this.isValidExtend({topic:e}),await this.setExpiry(e,pe(wi)),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(s){await this.sendError({id:r,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionExtendResponse",(e,n)=>{const{id:r}=n,s=X("session_extend",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(X("session_extend",r),{}):pt(n)&&this.events.emit(X("session_extend",r),{error:n.error})}),x(this,"onSessionPingRequest",async(e,n)=>{const{id:r}=n;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(s){await this.sendError({id:r,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionPingResponse",(e,n)=>{const{id:r}=n,s=X("session_ping",r);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);vt(n)?this.events.emit(X("session_ping",r),{}):pt(n)&&this.events.emit(X("session_ping",r),{error:n.error})},500)}),x(this,"onSessionDeleteRequest",async(e,n)=>{const{id:r}=n;try{this.isValidDisconnect({topic:e,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(ce.publish,async()=>{s(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:oe("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),x(this,"onSessionRequest",async e=>{var n,r,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:h}=e,{id:d,params:p}=c;try{await this.isValidRequest(ee({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Qe(JSON.stringify(Ut("wc_sessionRequest",p,d))),encryptedId:u,metadata:_.peer.metadata,transportType:h}),m={id:d,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),h===re.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((r=_.peer.metadata.redirect)==null?void 0:r.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:d,topic:o,error:_}),this.client.logger.error(_)}}),x(this,"onSessionRequestResponse",(e,n)=>{const{id:r}=n,s=X("session_request",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(X("session_request",r),{result:n.result}):pt(n)&&this.events.emit(X("session_request",r),{error:n.error})}),x(this,"onSessionEventRequest",async(e,n)=>{const{id:r,params:s}=n;try{const o=`${e}_session_event_${s.event.name}`,c=Ni.get(o);if(c&&this.isRequestOutOfSync(c,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(ee({topic:e},s)),this.client.events.emit("session_event",{id:r,topic:e,params:s}),Ni.set(o,r)}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionAuthenticateResponse",(e,n)=>{const{id:r}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:n}),vt(n)?this.events.emit(X("session_request",r),{result:n.result}):pt(n)&&this.events.emit(X("session_request",r),{error:n.error})}),x(this,"onSessionAuthenticateRequest",async e=>{var n;const{topic:r,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:h,expiryTimestamp:d}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Qe(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:r,id:s.id,authPayload:h,verifyContext:p,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:_,pairingTopic:r,transportType:l}),l===re.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Pt,receiverPublicKey:h,senderPublicKey:d};await this.sendError({id:s.id,topic:r,error:u,encodeOpts:_,rpcOpts:be.wc_sessionAuthenticate.autoReject,appLink:p})}}),x(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),x(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ht.idle,this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay))}),x(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:n})=>{const r=this.client.core.history.pending;r.length>0&&r.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=X("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(X("session_request",s.request.id),{error:n})})}),x(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ht.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(n){this.client.logger.error(n)}}),x(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=ht.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),x(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const n=this.client.proposal.getAll().find(r=>r.pairingTopic===e.topic);n&&this.onSessionProposeRequest({topic:e.topic,payload:Ut("wc_sessionPropose",Re(ee({},n),{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties}),n.id),attestation:n.attestation,encryptedId:n.encryptedId})}),x(this,"isValidConnect",async e=>{if(!ke(e)){const{message:u}=N("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:r,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(_e(n)||await this.isValidPairingTopic(n),!Rg(l)){const{message:u}=N("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!_e(r)&&hn(r)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(r,"requiredNamespaces")}if(!_e(s)&&hn(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),_e(o)||this.validateSessionProps(o,"sessionProperties"),!_e(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(r||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(h=>u.includes(h.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),x(this,"validateNamespaces",(e,n)=>{const r=Og(e,"connect()",n);if(r)throw new Error(r.message)}),x(this,"isValidApprove",async e=>{if(!ke(e))throw new Error(N("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:n,namespaces:r,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),u=$r(r,"approve()");if(u)throw new Error(u.message);const h=Ga(l.requiredNamespaces,r,"approve()");if(h)throw new Error(h.message);if(!he(s,!0)){const{message:d}=N("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(_e(o)||this.validateSessionProps(o,"sessionProperties"),!_e(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(r));if(!Object.keys(c).every(p=>d.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),x(this,"isValidReject",async e=>{if(!ke(e)){const{message:s}=N("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:n,reason:r}=e;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!Dg(r)){const{message:s}=N("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(s)}}),x(this,"isValidSessionSettleRequest",e=>{if(!ke(e)){const{message:u}=N("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:n,controller:r,namespaces:s,expiry:o}=e;if(!Lu(n)){const{message:u}=N("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=vg(r,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=$r(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Nt(o)){const{message:u}=N("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),x(this,"isValidUpdate",async e=>{if(!ke(e)){const{message:l}=N("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:n,namespaces:r}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=$r(r,"update()");if(o)throw new Error(o.message);const c=Ga(s.requiredNamespaces,r,"update()");if(c)throw new Error(c.message)}),x(this,"isValidExtend",async e=>{if(!ke(e)){const{message:r}=N("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(r)}const{topic:n}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),x(this,"isValidRequest",async e=>{if(!ke(e)){const{message:l}=N("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:n,request:r,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Ha(c,s)){const{message:l}=N("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Vg(r)){const{message:l}=N("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(l)}if(!Cg(c,s,r.method)){const{message:l}=N("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(l)}if(o&&!Ng(o,qr)){const{message:l}=N("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${qr.min} and ${qr.max}`);throw new Error(l)}}),x(this,"isValidRespond",async e=>{var n;if(!ke(e)){const{message:o}=N("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:r,response:s}=e;try{await this.isValidSessionTopic(r)}catch(o){throw(n=e?.response)!=null&&n.id&&this.cleanupAfterResponse(e),o}if(!Sg(s)){const{message:o}=N("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),x(this,"isValidPing",async e=>{if(!ke(e)){const{message:r}=N("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(r)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidEmit",async e=>{if(!ke(e)){const{message:c}=N("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:n,event:r,chainId:s}=e;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Ha(o,s)){const{message:c}=N("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!xg(r)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(c)}if(!$g(o,s,r.name)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(c)}}),x(this,"isValidDisconnect",async e=>{if(!ke(e)){const{message:r}=N("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(r)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidAuthenticate",e=>{const{chains:n,uri:r,domain:s,nonce:o}=e;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!he(r,!1))throw new Error("uri is required parameter");if(!he(s,!1))throw new Error("domain is required parameter");if(!he(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(l=>$n(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=$n(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),x(this,"getVerifyContext",async e=>{const{attestationId:n,hash:r,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||en,validation:"UNKNOWN",origin:o.url||""}};try{if(c===re.link_mode){const h=this.getAppLinkIfEnabled(o,c);return l.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:n,hash:r,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),x(this,"validateSessionProps",(e,n)=>{Object.values(e).forEach((r,s)=>{if(r==null){const{message:o}=N("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${r} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),x(this,"getPendingAuthRequest",e=>{const n=this.client.auth.requests.get(e);return typeof n=="object"?n:void 0}),x(this,"addToRecentlyDeleted",(e,n)=>{if(this.recentlyDeletedMap.set(e,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let r=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(r++>=s)break;this.recentlyDeletedMap.delete(o)}}}),x(this,"checkRecentlyDeleted",e=>{const n=this.recentlyDeletedMap.get(e);if(n){const{message:r}=N("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${e}`);throw new Error(r)}}),x(this,"isLinkModeEnabled",(e,n)=>{var r,s,o,c,l,u,h,d,p;return!e||n!==re.link_mode?!1:((s=(r=this.client.metadata)==null?void 0:r.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((h=e?.redirect)==null?void 0:h.universal)!==void 0&&((d=e?.redirect)==null?void 0:d.universal)!==""&&((p=e?.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof globalThis?.Linking<"u"}),x(this,"getAppLinkIfEnabled",(e,n)=>{var r;return this.isLinkModeEnabled(e,n)?(r=e?.redirect)==null?void 0:r.universal:void 0}),x(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const n=aa(e,"topic")||"",r=decodeURIComponent(aa(e,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:re.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:r,sessionExists:s})}),x(this,"registerLinkModeListeners",async()=>{var e;if(ro()||Wt()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const n=globalThis?.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const r=await n.getInitialURL();r&&setTimeout(()=>{this.handleLinkModeMessage({url:r})},50)}}}),x(this,"getTVFParams",(e,n,r)=>{var s,o,c;if(!((s=n.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[n.request.method],chainId:n.chainId};try{const u=this.extractTxHashesFromResult(n.request,r);l.txHashes=u,l.contractAddresses=this.isValidContractData(n.request.params)?[(c=(o=n.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),x(this,"isValidContractData",e=>{var n;if(!e)return!1;try{const r=e?.data||((n=e?.[0])==null?void 0:n.data);if(!r.startsWith("0x"))return!1;const s=r.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),x(this,"extractTxHashesFromResult",(e,n)=>{var r;try{if(!n)return[];const s=e.method,o=Mb[s];if(s==="sui_signTransaction")return[oy(n.transactionBytes)];if(s==="near_signTransaction")return[fa(n)];if(s==="near_signTransactions")return n.map(l=>fa(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(r=n.tx_json)==null?void 0:r.hash];if(s==="polkadot_signTransaction")return[Xg({transaction:e.params.transactionPayload,signature:n.signature})];if(s==="algo_signTxn")return Ii(n)?n.map(l=>ma(l)):[ma(n)];if(s==="cosmos_signDirect")return[cy(n)];if(typeof n=="string")return[n];const c=n[o.key];if(Ii(c))return s==="solana_signAllTransactions"?c.map(l=>sy(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[n,r]of Object.entries(e))for(const s of r)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ce.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:n,attestation:r,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Bn)?this.client.auth.authKeys.get(Bn):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,n,{receiverPublicKey:o,encoding:s===re.link_mode?zt:Be});qs(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:r,transportType:s,encryptedId:Qe(n)})):zs(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,n)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Ze.expired,async t=>{const{topic:e,id:n}=kl(t.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,N("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,N("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Zt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Zt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!he(t,!1)){const{message:e}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Nt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=N("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!he(t,!1)){const{message:e}=N("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Nt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=N("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=N("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(he(t,!1)){const{message:e}=N("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=N("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!Lg(t)){const{message:e}=N("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Nt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=N("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class eI extends di{constructor(t,e){super(t,e,Ub,Eo),this.core=t,this.logger=e}}class tI extends di{constructor(t,e){super(t,e,Nb,Eo),this.core=t,this.logger=e}}class iI extends di{constructor(t,e){super(t,e,qb,Eo,n=>n.id),this.core=t,this.logger=e}}class nI extends di{constructor(t,e){super(t,e,Fb,fr,()=>Bn),this.core=t,this.logger=e}}class rI extends di{constructor(t,e){super(t,e,Wb,fr),this.core=t,this.logger=e}}class sI extends di{constructor(t,e){super(t,e,Hb,fr,n=>n.id),this.core=t,this.logger=e}}var oI=Object.defineProperty,aI=(i,t,e)=>t in i?oI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zr=(i,t,e)=>aI(i,typeof t!="symbol"?t+"":t,e);class cI{constructor(t,e){this.core=t,this.logger=e,zr(this,"authKeys"),zr(this,"pairingTopics"),zr(this,"requests"),this.authKeys=new nI(this.core,this.logger),this.pairingTopics=new rI(this.core,this.logger),this.requests=new sI(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var lI=Object.defineProperty,uI=(i,t,e)=>t in i?lI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,J=(i,t,e)=>uI(i,typeof t!="symbol"?t+"":t,e);class vo extends d_{constructor(t){super(t),J(this,"protocol",Wu),J(this,"version",Hu),J(this,"name",Mr.name),J(this,"metadata"),J(this,"core"),J(this,"logger"),J(this,"events",new li.EventEmitter),J(this,"engine"),J(this,"session"),J(this,"proposal"),J(this,"pendingRequest"),J(this,"auth"),J(this,"signConfig"),J(this,"on",(n,r)=>this.events.on(n,r)),J(this,"once",(n,r)=>this.events.once(n,r)),J(this,"off",(n,r)=>this.events.off(n,r)),J(this,"removeListener",(n,r)=>this.events.removeListener(n,r)),J(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),J(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"update",async n=>{try{return await this.engine.update(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"request",async n=>{try{return await this.engine.request(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"find",n=>{try{return this.engine.find(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),J(this,"authenticate",async(n,r)=>{try{return await this.engine.authenticate(n,r)}catch(s){throw this.logger.error(s.message),s}}),J(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(r){throw this.logger.error(r.message),r}}),this.name=t?.name||Mr.name,this.metadata=Zf(t?.metadata),this.signConfig=t?.signConfig;const e=typeof t?.logger<"u"&&typeof t?.logger!="string"?t.logger:or(Xs({level:t?.logger||Mr.logger}));this.core=t?.core||new kb(t),this.logger=xe(e,this.name),this.session=new tI(this.core,this.logger),this.proposal=new eI(this.core,this.logger),this.pendingRequest=new iI(this.core,this.logger),this.engine=new Xb(this),this.auth=new cI(this.core,this.logger)}static async init(t){const e=new vo(t);return await e.initialize(),e}get context(){return je(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const hI=vo,dI="08c4b07e3ad25f1a27c14a4e8cecb6f0",KT="eip155";async function pI(i){const{account:t,chainId:e,params:[n]}=i;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:n})).transactionHash}function mr(i,t){if(Ro(i.address)!==Ro(t))throw new Error(`Failed to validate account address (${i.address}), differs from ${t}`)}function FT(i){const t=i.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${i}, should have the format 'eip155:1'`);return e}async function _I(i){const{account:t,chainId:e,thirdwebClient:n,params:[r]}=i;r.from!==void 0&&mr(t,r.from);const s=Jr({chain:we(e),client:n,data:r.data,gas:r.gas?De(r.gas):void 0,gasPrice:r.gasPrice?De(r.gasPrice):void 0,to:r.to,value:r.value?De(r.value):void 0});return(await Uc({account:t,transaction:s})).transactionHash}async function Tc(i){const{account:t,params:e}=i;return mr(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function fI(i){const{account:t,params:[e]}=i;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&mr(t,e.from),t.signTransaction({data:e.data,gas:e.gas?De(e.gas):void 0,gasPrice:e.gasPrice?De(e.gasPrice):void 0,nonce:e.nonce?ri(e.nonce):void 0,to:e.to,value:e.value?De(e.value):void 0})}async function Ac(i){const{account:t,params:e}=i;return mr(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Ju(i){const{wallet:t,params:e}=i;return t.getChain()?.id===ri(e[0].chainId)||await t.switchChain(Mh(ri(e[0].chainId))),"0x1"}const WT=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Ju},Symbol.toStringTag,{value:"Module"})),HT="/sdk/2022-08-12/embedded-wallet",jr=i=>`thirdwebEwsWalletUserId-${i}`,mI="walletToken",Kr=i=>`${mI}-${i}`,Pc=i=>`passkey-credential-id-${i}`,yI="a",Fr=(i,t)=>`${yI}-${i}-${t}`,Oc=i=>`walletConnectSessions-${i}`,Rc=i=>`thirdweb_guest_session_id_${i}`,Lc=new Map;class bo{constructor({storage:t,clientId:e,ecosystem:n}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=wI(e,n?.id),this.ecosystem=n}async getItem(t){return this.storage?this.storage.getItem(t):Lc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Lc.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(Oc(this.key))}async saveWalletConnectSessions(t){await this.setItem(Oc(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Pc(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Pc(this.key))}async saveAuthCookie(t){await this.setItem(Kr(this.key),t)}async getAuthCookie(){return this.getItem(Kr(this.key))}async removeAuthCookie(){return this.removeItem(Kr(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Fr(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Fr(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Fr(this.key,t)):!1}async getWalletUserId(){return this.getItem(jr(this.key))}async saveWalletUserId(t){await this.setItem(jr(this.key),t)}async removeWalletUserId(){return this.removeItem(jr(this.key))}async getGuestSessionId(){return this.getItem(Rc(this.key))}async saveGuestSessionId(t){await this.setItem(Rc(this.key),t)}}const wI=(i,t)=>`${i}${t?`-${t}`:""}`;let mt;async function Yu(){if(!mt)return[];const i=await mt.getWalletConnectSessions();return JSON.parse(i??"[]")}function gI(i){mt||(mt=new bo({clientId:i.clientId,storage:null}))}async function GT(i){if(!mt)return;const t=await mt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(i),await mt.saveWalletConnectSessions(ye(e))}async function EI(i){if(!mt)return;const t=await mt.getWalletConnectSessions(),n=JSON.parse(t??"[]").filter(r=>r.topic!==i.topic);await mt.saveWalletConnectSessions(ye(n))}let Wr=new WeakMap;const vI={eth_sendRawTransaction:pI,eth_sendTransaction:_I,eth_sign:Tc,eth_signTransaction:fI,eth_signTypedData:Ac,eth_signTypedData_v4:Ac,personal_sign:Tc,wallet_addEthereumChain:i=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Ju};async function bI(i){const{wallet:t,requestHandlers:e,onConnect:n,onDisconnect:r,client:s}=i,o=i.chains&&i.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),i.chains.slice(0,10)):i.chains;if(Wr.has(s))return Wr.get(s);gI({clientId:i.client.clientId});const c=Fn(),l=await hI.init({metadata:{description:i.appMetadata?.description??c.description,icons:[i.appMetadata?.logoUrl??c.logoUrl],name:i.appMetadata?.name??c.name,url:i.appMetadata?.url??c.url},projectId:i.projectId??dI});l.on("session_proposal",async h=>{const{onSessionProposal:d}=await a(async()=>{const{onSessionProposal:p}=await import("./session-proposal-CY0k9Jnm.js");return{onSessionProposal:p}},__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,10,11,12]));await d({chains:o,event:h,onConnect:n,wallet:t,walletConnectClient:l}).catch(p=>{if(i.onError)i.onError(p);else throw p})}),l.on("session_request",async h=>{const{fulfillRequest:d}=await a(async()=>{const{fulfillRequest:p}=await import("./session-request-B_2glC9e.js");return{fulfillRequest:p}},__vite__mapDeps([35,3,4,1,2,5,6,7,8,9,10,11,12]));await d({event:h,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(p=>{if(i.onError)i.onError(p);else throw p})}),l.on("session_event",async h=>{}),l.on("session_ping",h=>{}),l.on("session_delete",async h=>{await Zu({session:{topic:h.topic},walletConnectClient:l}).catch(d=>{if(i.onError)i.onError(d);else throw d})});const u=l.disconnect;return l.disconnect=async h=>{const d=await u(h).catch(()=>{});return r&&AI({onDisconnect:r,topic:h.topic}),d},Wr.set(i.client,l),l}function II(i){const{uri:t,walletConnectClient:e}=i;e.core.pairing.pair({uri:t})}async function TI(){return Yu()}async function Zu(i){EI(i.session);try{await i.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:i.session.topic})}catch{}}async function AI(i){const{topic:t,onDisconnect:e}=i,n=await Yu();e(n.find(r=>r.topic===t)??{topic:t})}function PI(i){return[ot("inApp",{executionMode:i?.executionMode}),ot(Hc),ot(_t,{appMetadata:i?.appMetadata,chains:i?.chains}),ot(Pd),ot("io.rabby"),ot(Od),ot("com.okex.wallet")]}function OI(i,t){const e=new Set;let n=i();const r=()=>{for(const o of e)o()},s=o=>{n=o,r()};for(const o of t)o.subscribe(()=>{s(i())});return{getValue(){return n},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Sn(i,t,e=!0){e&&i();const n=t.map(r=>r.subscribe(()=>{i()}));return()=>{for(const r of n)r()}}const dn="tw:connected-wallet-params";async function JT(i,t,e){if(!LI(e))throw new Error("given params are not stringifiable");const n=await i.getItem(dn);let r;if(n){try{r=JSON.parse(n)}catch{r={}}r[t]=e}else r={[t]:e};i.setItem(dn,ye(r))}async function RI(i,t){const e=await i.getItem(dn);let n;if(e){try{n=JSON.parse(e)}catch{n={}}delete n[t],i.setItem(dn,ye(n))}}async function YT(i,t){const e=await i.getItem(dn);if(!e)return null;try{const n=JSON.parse(e);return n?.[t]?n[t]:null}catch{return null}}function LI(i){try{return ye(i),!0}catch{return!1}}function DI(i){let t;return()=>(t||(t=i()),t)}function VI(i={}){return Mc({filters:i,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function SI(i={}){return Mc({filters:i,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function xI(i){const{receipt:t}=i,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...i,actualGasCost:BigInt(i.actualGasCost),actualGasUsed:BigInt(i.actualGasUsed),nonce:BigInt(i.nonce),receipt:e,userOpHash:i.userOpHash}}const ZT=()=>{const i=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),r=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return i<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|n<<BigInt(64)|r<<BigInt(32)|s};function Qu(i){return Object.fromEntries(Object.entries(i).map(([t,e])=>[t,e==null||qn(e)?e:Bs(e)]))}async function QT(i){return Ht({...i,operation:"eth_sendUserOperation",params:[Qu(i.userOp),i.options.entrypointAddress??sr]})}async function XT(i,t){const e=await Ht({...i,operation:"eth_estimateUserOperationGas",params:[Qu(i.userOp),i.options.entrypointAddress??sr,t??{}]});return{callGasLimit:De(e.callGasLimit)+gd,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?De(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?De(e.paymasterVerificationGasLimit):void 0,preVerificationGas:De(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?De(e.verificationGas):void 0,verificationGasLimit:De(e.verificationGasLimit)}}async function eA(i){const t=await Ht({...i,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:De(t.maxFeePerGas),maxPriorityFeePerGas:De(t.maxPriorityFeePerGas)}}async function tA(i){const t=await CI(i);if(t){if(t.success===!1){const n=Rh({events:[VI(),SI()],logs:t.logs})[0]?.args?.revertReason;if(!n)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const r=Lh({data:n});throw new Error(`UserOp failed with reason: '${r.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function CI(i){const t=await Ht({operation:"eth_getUserOperationReceipt",options:i,params:[i.userOpHash]});if(t)return xI(t)}async function iA(i){const t=await Ht({operation:"zk_paymasterData",options:i.options,params:[i.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function $I(i){const t=await Ht({...i,operation:"tw_execute",params:[i.eoaAddress,i.wrappedCalls,i.signature,i.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${ye(t)}`);return{transactionId:t.queueId}}async function kI(i){return{transactionHash:(await Ht({...i,operation:"tw_getTransactionHash",params:[i.transactionId]})).transactionHash}}async function nA(i){return{transactionHash:(await Ht({operation:"zk_broadcastTransaction",options:i.options,params:[{...i.transaction,signedTransaction:i.signedTransaction}]})).transactionHash}}async function Ht(i){const{options:t,operation:e,params:n}=i,r=t.bundlerUrl??Fc(t.chain),o=await pn(t.client)(r,{useAuthToken:!0,body:ye({id:1,jsonrpc:"2.0",method:e,params:n}),headers:{"Content-Type":"application/json"},method:"POST"}),c=await o.json();if(!o.ok||c.error){let l=c.error||o.statusText;typeof l=="object"&&(l=ye(l));const u=c.code||"UNKNOWN";throw new Error(`${e} error: ${l}
13
+ Approved: ${p.toString()}`))}),o.forEach(d=>{n||(Xt(r[d].methods,s[d].methods)?Xt(r[d].events,s[d].events)||(n=N("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):n=N("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),n}function kg(i){const t={};return Object.keys(i).forEach(e=>{var n;e.includes(":")?t[e]=i[e]:(n=i[e].chains)==null||n.forEach(r=>{t[r]={methods:i[e].methods,events:i[e].events}})}),t}function Ja(i){return[...new Set(i.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Ug(i){const t={};return Object.keys(i).forEach(e=>{e.includes(":")?t[e]=i[e]:Si(i[e].accounts)?.forEach(r=>{t[r]={accounts:i[e].accounts.filter(s=>s.includes(`${r}:`)),methods:i[e].methods,events:i[e].events}})}),t}function Ng(i,t){return wo(i,!1)&&i<=t.max&&i>=t.min}function Ya(){const i=mn();return new Promise(t=>{switch(i){case He.browser:t(Bg());break;case He.reactNative:t(Mg());break;case He.node:t(qg());break;default:t(!0)}})}function Bg(){return Li()&&navigator?.onLine}async function Mg(){return Wt()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo?(await globalThis?.NetInfo.fetch())?.isConnected:!0}function qg(){return!0}function zg(i){switch(mn()){case He.browser:jg(i);break;case He.reactNative:Kg(i);break}}function jg(i){!Wt()&&Li()&&(window.addEventListener("online",()=>i(!0)),window.addEventListener("offline",()=>i(!1)))}function Kg(i){Wt()&&typeof globalThis<"u"&&globalThis!=null&&globalThis.NetInfo&&globalThis?.NetInfo.addEventListener(t=>i(t?.isConnected))}function Fg(){var i;return Li()&&Ot.getDocument()?((i=Ot.getDocument())==null?void 0:i.visibilityState)==="visible":!0}const kr={};class Ni{static get(t){return kr[t]}static set(t,e){kr[t]=e}static delete(t){delete kr[t]}}function Wg(i){const t=_n.decode(i);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function Hg({publicKey:i,signature:t,payload:e}){var n;const r=gs(e.method),s=128|parseInt(((n=e.version)==null?void 0:n.toString())||"4"),o=Yg(e.address),c=e.era==="00"?new Uint8Array([0]):gs(e.era);if(c.length!==1&&c.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),h=BigInt(`0x${Jg(e.tip)}`),d=Qg(h),p=new Uint8Array([0,...i,o,...t,...c,...u,...d,...r]),_=Zg(p.length+1);return new Uint8Array([..._,s,...p])}function Gg(i){const t=gs(i),e=ud.blake2b(t,void 0,32);return"0x"+te.from(e).toString("hex")}function gs(i){return new Uint8Array(i.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function Jg(i){return i.startsWith("0x")?i.slice(2):i}function Yg(i){const t=_n.decode(i)[0];return t===42?0:t===60?2:1}function Zg(i){if(i<64)return new Uint8Array([i<<2]);if(i<16384){const t=i<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(i<1<<30){const t=i<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Qg(i){if(i<BigInt(1)<<BigInt(6))return new Uint8Array([Number(i<<BigInt(2))]);if(i<BigInt(1)<<BigInt(14)){const t=i<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(i<BigInt(1)<<BigInt(30)){const t=i<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function Xg(i){const t=Uint8Array.from(te.from(i.signature,"hex")),e=Wg(i.transaction.address),n=Hg({publicKey:e,signature:t,payload:i.transaction}),r=te.from(n).toString("hex");return Gg(r)}var eE={};const Du="wc",Vu=2,Es="core",yt=`${Du}@2:${Es}:`,tE={logger:"error"},iE={database:":memory:"},nE="crypto",Za="client_ed25519_seed",rE=B.ONE_DAY,sE="keychain",oE="0.3",aE="messages",cE="0.3",lE=B.SIX_HOURS,uE="publisher",Su="irn",hE="error",xu="wss://relay.walletconnect.org",dE="relayer",ce={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},pE="_subscription",Je={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},_E=.1,vs="2.21.8",re={link_mode:"link_mode",relay:"relay"},Nn={inbound:"inbound",outbound:"outbound"},fE="0.3",mE="WALLETCONNECT_CLIENT_ID",Qa="WALLETCONNECT_LINK_MODE_APPS",Fe={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},yE="subscription",wE="0.3",gE="pairing",EE="0.3",Bi={wc_pairingDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:B.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:B.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:B.ONE_DAY,prompt:!1,tag:0},res:{ttl:B.ONE_DAY,prompt:!1,tag:0}}},Zt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},nt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},vE="history",bE="0.3",IE="expirer",Ze={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},TE="0.3",AE="verify-api",PE="https://verify.walletconnect.com",Cu="https://verify.walletconnect.org",en=Cu,OE=`${en}/v3`,RE=[PE,Cu],LE="echo",DE="https://echo.walletconnect.com",dt={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},It={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},kt={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},Mi={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},Jt={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},qi={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},VE=.1,SE="event-client",xE=86400,CE="https://pulse.walletconnect.org/batch";function $E(i,t){if(i.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),n=0;n<e.length;n++)e[n]=255;for(var r=0;r<i.length;r++){var s=i.charAt(r),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=r}var c=i.length,l=i.charAt(0),u=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(f){if(f instanceof Uint8Array||(ArrayBuffer.isView(f)?f=new Uint8Array(f.buffer,f.byteOffset,f.byteLength):Array.isArray(f)&&(f=Uint8Array.from(f))),!(f instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(f.length===0)return"";for(var m=0,y=0,T=0,O=f.length;T!==O&&f[T]===0;)T++,m++;for(var E=(O-T)*h+1>>>0,R=new Uint8Array(E);T!==O;){for(var I=f[T],g=0,L=E-1;(I!==0||g<y)&&L!==-1;L--,g++)I+=256*R[L]>>>0,R[L]=I%c>>>0,I=I/c>>>0;if(I!==0)throw new Error("Non-zero carry");y=g,T++}for(var D=E-y;D!==E&&R[D]===0;)D++;for(var w=l.repeat(m);D<E;++D)w+=i.charAt(R[D]);return w}function p(f){if(typeof f!="string")throw new TypeError("Expected String");if(f.length===0)return new Uint8Array;var m=0;if(f[m]!==" "){for(var y=0,T=0;f[m]===l;)y++,m++;for(var O=(f.length-m)*u+1>>>0,E=new Uint8Array(O);f[m];){var R=e[f.charCodeAt(m)];if(R===255)return;for(var I=0,g=O-1;(R!==0||I<T)&&g!==-1;g--,I++)R+=c*E[g]>>>0,E[g]=R%256>>>0,R=R/256>>>0;if(R!==0)throw new Error("Non-zero carry");T=I,m++}if(f[m]!==" "){for(var L=O-T;L!==O&&E[L]===0;)L++;for(var D=new Uint8Array(y+(O-L)),w=y;L!==O;)D[w++]=E[L++];return D}}}function _(f){var m=p(f);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:p,decode:_}}var kE=$E,UE=kE;const $u=i=>{if(i instanceof Uint8Array&&i.constructor.name==="Uint8Array")return i;if(i instanceof ArrayBuffer)return new Uint8Array(i);if(ArrayBuffer.isView(i))return new Uint8Array(i.buffer,i.byteOffset,i.byteLength);throw new Error("Unknown type, must be binary type")},NE=i=>new TextEncoder().encode(i),BE=i=>new TextDecoder().decode(i);class ME{constructor(t,e,n){this.name=t,this.prefix=e,this.baseEncode=n}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class qE{constructor(t,e,n){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=n}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return ku(this,t)}}class zE{constructor(t){this.decoders=t}or(t){return ku(this,t)}decode(t){const e=t[0],n=this.decoders[e];if(n)return n.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const ku=(i,t)=>new zE({...i.decoders||{[i.prefix]:i},...t.decoders||{[t.prefix]:t}});class jE{constructor(t,e,n,r){this.name=t,this.prefix=e,this.baseEncode=n,this.baseDecode=r,this.encoder=new ME(t,e,n),this.decoder=new qE(t,e,r)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const _r=({name:i,prefix:t,encode:e,decode:n})=>new jE(i,t,e,n),En=({prefix:i,name:t,alphabet:e})=>{const{encode:n,decode:r}=UE(e,t);return _r({prefix:i,name:t,encode:n,decode:s=>$u(r(s))})},KE=(i,t,e,n)=>{const r={};for(let h=0;h<t.length;++h)r[t[h]]=h;let s=i.length;for(;i[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let c=0,l=0,u=0;for(let h=0;h<s;++h){const d=r[i[h]];if(d===void 0)throw new SyntaxError(`Non-${n} character`);l=l<<e|d,c+=e,c>=8&&(c-=8,o[u++]=255&l>>c)}if(c>=e||255&l<<8-c)throw new SyntaxError("Unexpected end of data");return o},FE=(i,t,e)=>{const n=t[t.length-1]==="=",r=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<i.length;++l)for(c=c<<8|i[l],o+=8;o>e;)o-=e,s+=t[r&c>>o];if(o&&(s+=t[r&c<<e-o]),n)for(;s.length*e&7;)s+="=";return s},Ie=({name:i,prefix:t,bitsPerChar:e,alphabet:n})=>_r({prefix:t,name:i,encode(r){return FE(r,n,e)},decode(r){return KE(r,n,e,i)}}),WE=_r({prefix:"\0",name:"identity",encode:i=>BE(i),decode:i=>NE(i)});var HE=Object.freeze({__proto__:null,identity:WE});const GE=Ie({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var JE=Object.freeze({__proto__:null,base2:GE});const YE=Ie({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ZE=Object.freeze({__proto__:null,base8:YE});const QE=En({prefix:"9",name:"base10",alphabet:"0123456789"});var XE=Object.freeze({__proto__:null,base10:QE});const e0=Ie({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),t0=Ie({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var i0=Object.freeze({__proto__:null,base16:e0,base16upper:t0});const n0=Ie({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),r0=Ie({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),s0=Ie({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),o0=Ie({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),a0=Ie({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),c0=Ie({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),l0=Ie({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),u0=Ie({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),h0=Ie({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var d0=Object.freeze({__proto__:null,base32:n0,base32upper:r0,base32pad:s0,base32padupper:o0,base32hex:a0,base32hexupper:c0,base32hexpad:l0,base32hexpadupper:u0,base32z:h0});const p0=En({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),_0=En({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var f0=Object.freeze({__proto__:null,base36:p0,base36upper:_0});const m0=En({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),y0=En({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var w0=Object.freeze({__proto__:null,base58btc:m0,base58flickr:y0});const g0=Ie({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),E0=Ie({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),v0=Ie({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),b0=Ie({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var I0=Object.freeze({__proto__:null,base64:g0,base64pad:E0,base64url:v0,base64urlpad:b0});const Uu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),T0=Uu.reduce((i,t,e)=>(i[e]=t,i),[]),A0=Uu.reduce((i,t,e)=>(i[t.codePointAt(0)]=e,i),[]);function P0(i){return i.reduce((t,e)=>(t+=T0[e],t),"")}function O0(i){const t=[];for(const e of i){const n=A0[e.codePointAt(0)];if(n===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(n)}return new Uint8Array(t)}const R0=_r({prefix:"🚀",name:"base256emoji",encode:P0,decode:O0});var L0=Object.freeze({__proto__:null,base256emoji:R0}),D0=Nu,Xa=128,V0=-128,S0=Math.pow(2,31);function Nu(i,t,e){t=t||[],e=e||0;for(var n=e;i>=S0;)t[e++]=i&255|Xa,i/=128;for(;i&V0;)t[e++]=i&255|Xa,i>>>=7;return t[e]=i|0,Nu.bytes=e-n+1,t}var x0=bs,C0=128,ec=127;function bs(i,n){var e=0,n=n||0,r=0,s=n,o,c=i.length;do{if(s>=c)throw bs.bytes=0,new RangeError("Could not decode varint");o=i[s++],e+=r<28?(o&ec)<<r:(o&ec)*Math.pow(2,r),r+=7}while(o>=C0);return bs.bytes=s-n,e}var $0=Math.pow(2,7),k0=Math.pow(2,14),U0=Math.pow(2,21),N0=Math.pow(2,28),B0=Math.pow(2,35),M0=Math.pow(2,42),q0=Math.pow(2,49),z0=Math.pow(2,56),j0=Math.pow(2,63),K0=function(i){return i<$0?1:i<k0?2:i<U0?3:i<N0?4:i<B0?5:i<M0?6:i<q0?7:i<z0?8:i<j0?9:10},F0={encode:D0,decode:x0,encodingLength:K0},Bu=F0;const tc=(i,t,e=0)=>(Bu.encode(i,t,e),t),ic=i=>Bu.encodingLength(i),Is=(i,t)=>{const e=t.byteLength,n=ic(i),r=n+ic(e),s=new Uint8Array(r+e);return tc(i,s,0),tc(e,s,n),s.set(t,r),new W0(i,e,t,s)};class W0{constructor(t,e,n,r){this.code=t,this.size=e,this.digest=n,this.bytes=r}}const Mu=({name:i,code:t,encode:e})=>new H0(i,t,e);class H0{constructor(t,e,n){this.name=t,this.code=e,this.encode=n}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?Is(this.code,e):e.then(n=>Is(this.code,n))}else throw Error("Unknown type, must be binary type")}}const qu=i=>async t=>new Uint8Array(await crypto.subtle.digest(i,t)),G0=Mu({name:"sha2-256",code:18,encode:qu("SHA-256")}),J0=Mu({name:"sha2-512",code:19,encode:qu("SHA-512")});var Y0=Object.freeze({__proto__:null,sha256:G0,sha512:J0});const zu=0,Z0="identity",ju=$u,Q0=i=>Is(zu,ju(i)),X0={code:zu,name:Z0,encode:ju,digest:Q0};var ev=Object.freeze({__proto__:null,identity:X0});new TextEncoder,new TextDecoder;const nc={...HE,...JE,...ZE,...XE,...i0,...d0,...f0,...w0,...I0,...L0};({...Y0,...ev});function Ku(i){return globalThis.Buffer!=null?new Uint8Array(i.buffer,i.byteOffset,i.byteLength):i}function tv(i=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Ku(globalThis.Buffer.allocUnsafe(i)):new Uint8Array(i)}function Fu(i,t,e,n){return{name:i,prefix:t,encoder:{name:i,prefix:t,encode:e},decoder:{decode:n}}}const rc=Fu("utf8","u",i=>"u"+new TextDecoder("utf8").decode(i),i=>new TextEncoder().encode(i.substring(1))),Ur=Fu("ascii","a",i=>{let t="a";for(let e=0;e<i.length;e++)t+=String.fromCharCode(i[e]);return t},i=>{i=i.substring(1);const t=tv(i.length);for(let e=0;e<i.length;e++)t[e]=i.charCodeAt(e);return t}),iv={utf8:rc,"utf-8":rc,hex:nc.base16,latin1:Ur,ascii:Ur,binary:Ur,...nc};function nv(i,t="utf8"){const e=iv[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Ku(globalThis.Buffer.from(i,"utf-8")):e.decoder.decode(`${e.prefix}${i}`)}var rv=Object.defineProperty,sv=(i,t,e)=>t in i?rv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ut=(i,t,e)=>sv(i,typeof t!="symbol"?t+"":t,e);class ov{constructor(t,e){this.core=t,this.logger=e,ut(this,"keychain",new Map),ut(this,"name",sE),ut(this,"version",oE),ut(this,"initialized",!1),ut(this,"storagePrefix",yt),ut(this,"init",async()=>{if(!this.initialized){const n=await this.getKeyChain();typeof n<"u"&&(this.keychain=n),this.initialized=!0}}),ut(this,"has",n=>(this.isInitialized(),this.keychain.has(n))),ut(this,"set",async(n,r)=>{this.isInitialized(),this.keychain.set(n,r),await this.persist()}),ut(this,"get",n=>{this.isInitialized();const r=this.keychain.get(n);if(typeof r>"u"){const{message:s}=N("NO_MATCHING_KEY",`${this.name}: ${n}`);throw new Error(s)}return r}),ut(this,"del",async n=>{this.isInitialized(),this.keychain.delete(n),await this.persist()}),this.core=t,this.logger=xe(e,this.name)}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,as(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var av=Object.defineProperty,cv=(i,t,e)=>t in i?av(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ee=(i,t,e)=>cv(i,typeof t!="symbol"?t+"":t,e);class lv{constructor(t,e,n){this.core=t,this.logger=e,Ee(this,"name",nE),Ee(this,"keychain"),Ee(this,"randomSessionIdentifier",ws()),Ee(this,"initialized",!1),Ee(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Ee(this,"hasKeys",r=>(this.isInitialized(),this.keychain.has(r))),Ee(this,"getClientId",async()=>{this.isInitialized();const r=await this.getClientSeed(),s=Lo(r);return td(s.publicKey)}),Ee(this,"generateKeyPair",()=>{this.isInitialized();const r=zw();return this.setPrivateKey(r.publicKey,r.privateKey)}),Ee(this,"signJWT",async r=>{this.isInitialized();const s=await this.getClientSeed(),o=Lo(s),c=this.randomSessionIdentifier;return await id(c,r,rE,o)}),Ee(this,"generateSharedKey",(r,s,o)=>{this.isInitialized();const c=this.getPrivateKey(r),l=jw(c,s);return this.setSymKey(l,o)}),Ee(this,"setSymKey",async(r,s)=>{this.isInitialized();const o=s||Un(r);return await this.keychain.set(o,r),o}),Ee(this,"deleteKeyPair",async r=>{this.isInitialized(),await this.keychain.del(r)}),Ee(this,"deleteSymKey",async r=>{this.isInitialized(),await this.keychain.del(r)}),Ee(this,"encode",async(r,s,o)=>{this.isInitialized();const c=Pu(o),l=rn(s);if(Ba(c))return Ww(l,o?.encoding);if(Na(c)){const p=c.senderPublicKey,_=c.receiverPublicKey;r=await this.generateSharedKey(p,_)}const u=this.getSymKey(r),{type:h,senderPublicKey:d}=c;return Kw({type:h,symKey:u,message:l,senderPublicKey:d,encoding:o?.encoding})}),Ee(this,"decode",async(r,s,o)=>{this.isInitialized();const c=Gw(s,o);if(Ba(c)){const l=Hw(s,o?.encoding);return zn(l)}if(Na(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;r=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(r),u=Fw({symKey:l,encoded:s,encoding:o?.encoding});return zn(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${r}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),Ee(this,"getPayloadType",(r,s=Be)=>{const o=un({encoded:r,encoding:s});return ai(o.type)}),Ee(this,"getPayloadSenderPublicKey",(r,s=Be)=>{const o=un({encoded:r,encoding:s});return o.senderPublicKey?ze(o.senderPublicKey,Se):void 0}),this.core=t,this.logger=xe(e,this.name),this.keychain=n||new ov(this.core,this.logger)}get context(){return je(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(Za)}catch{t=ws(),await this.keychain.set(Za,t)}return nv(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var uv=Object.defineProperty,hv=Object.defineProperties,dv=Object.getOwnPropertyDescriptors,sc=Object.getOwnPropertySymbols,pv=Object.prototype.hasOwnProperty,_v=Object.prototype.propertyIsEnumerable,Ts=(i,t,e)=>t in i?uv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,fv=(i,t)=>{for(var e in t||(t={}))pv.call(t,e)&&Ts(i,e,t[e]);if(sc)for(var e of sc(t))_v.call(t,e)&&Ts(i,e,t[e]);return i},mv=(i,t)=>hv(i,dv(t)),Ke=(i,t,e)=>Ts(i,typeof t!="symbol"?t+"":t,e);class yv extends t_{constructor(t,e){super(t,e),this.logger=t,this.core=e,Ke(this,"messages",new Map),Ke(this,"messagesWithoutClientAck",new Map),Ke(this,"name",aE),Ke(this,"version",cE),Ke(this,"initialized",!1),Ke(this,"storagePrefix",yt),Ke(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const n=await this.getRelayerMessages();typeof n<"u"&&(this.messages=n);const r=await this.getRelayerMessagesWithoutClientAck();typeof r<"u"&&(this.messagesWithoutClientAck=r),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(n){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(n)}finally{this.initialized=!0}}}),Ke(this,"set",async(n,r,s)=>{this.isInitialized();const o=Qe(r);let c=this.messages.get(n);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=r,this.messages.set(n,c),s===Nn.inbound){const l=this.messagesWithoutClientAck.get(n)||{};this.messagesWithoutClientAck.set(n,mv(fv({},l),{[o]:r}))}return await this.persist(),o}),Ke(this,"get",n=>{this.isInitialized();let r=this.messages.get(n);return typeof r>"u"&&(r={}),r}),Ke(this,"getWithoutAck",n=>{this.isInitialized();const r={};for(const s of n){const o=this.messagesWithoutClientAck.get(s)||{};r[s]=Object.values(o)}return r}),Ke(this,"has",(n,r)=>{this.isInitialized();const s=this.get(n),o=Qe(r);return typeof s[o]<"u"}),Ke(this,"ack",async(n,r)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(n);if(typeof s>"u")return;const o=Qe(r);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(n):this.messagesWithoutClientAck.set(n,s),await this.persist()}),Ke(this,"del",async n=>{this.isInitialized(),this.messages.delete(n),this.messagesWithoutClientAck.delete(n),await this.persist()}),this.logger=xe(t,this.name),this.core=e}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,as(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,as(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?cs(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?cs(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var wv=Object.defineProperty,gv=Object.defineProperties,Ev=Object.getOwnPropertyDescriptors,oc=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,bv=Object.prototype.propertyIsEnumerable,As=(i,t,e)=>t in i?wv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mi=(i,t)=>{for(var e in t||(t={}))vv.call(t,e)&&As(i,e,t[e]);if(oc)for(var e of oc(t))bv.call(t,e)&&As(i,e,t[e]);return i},ac=(i,t)=>gv(i,Ev(t)),Ye=(i,t,e)=>As(i,typeof t!="symbol"?t+"":t,e);class Iv extends i_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ye(this,"events",new li.EventEmitter),Ye(this,"name",uE),Ye(this,"queue",new Map),Ye(this,"publishTimeout",B.toMiliseconds(B.ONE_MINUTE)),Ye(this,"initialPublishTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Ye(this,"needsTransportRestart",!1),Ye(this,"publish",async(n,r,s)=>{var o,c,l,u,h;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:n,message:r,opts:s}});const d=s?.ttl||lE,p=s?.prompt||!1,_=s?.tag||0,f=s?.id||Qt().toString(),m=Ei(er().protocol),y={id:f,method:s?.publishMethod||m.publish,params:mi({topic:n,message:r,ttl:d,prompt:p,tag:_,attestation:s?.attestation},s?.tvf&&{tvf:s.tvf})},T=`Failed to publish payload, please try again. id:${f} tag:${_}`;try{_e((o=y.params)==null?void 0:o.prompt)&&((c=y.params)==null||delete c.prompt),_e((l=y.params)==null?void 0:l.tag)&&((u=y.params)==null||delete u.tag);const O=new Promise(async E=>{const R=({id:g})=>{var L;((L=y.id)==null?void 0:L.toString())===g.toString()&&(this.removeRequestFromQueue(g),this.relayer.events.removeListener(ce.publish,R),E())};this.relayer.events.on(ce.publish,R);const I=ft(new Promise((g,L)=>{this.rpcPublish(y,s).then(g).catch(D=>{this.logger.warn(D,D?.message),L(D)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${_}`);try{await I,this.events.removeListener(ce.publish,R)}catch(g){this.queue.set(f,{request:y,opts:s,attempt:1}),this.logger.warn(g,g?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:n,message:r,opts:s}}),await ft(O,this.publishTimeout,T)}catch(O){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(O),(h=s?.internal)!=null&&h.throwOnFailedPublish)throw O}finally{this.queue.delete(f)}}),Ye(this,"publishCustom",async n=>{var r,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:n});const{payload:u,opts:h={}}=n,{attestation:d,tvf:p,publishMethod:_,prompt:f,tag:m,ttl:y=B.FIVE_MINUTES}=h,T=h.id||Qt().toString(),O=Ei(er().protocol),E=_||O.publish,R={id:T,method:E,params:mi(ac(mi({},u),{ttl:y,prompt:f,tag:m,attestation:d}),p)},I=`Failed to publish custom payload, please try again. id:${T} tag:${m}`;try{_e((r=R.params)==null?void 0:r.prompt)&&((s=R.params)==null||delete s.prompt),_e((o=R.params)==null?void 0:o.tag)&&((c=R.params)==null||delete c.tag);const g=new Promise(async L=>{const D=({id:v})=>{var b;((b=R.id)==null?void 0:b.toString())===v.toString()&&(this.removeRequestFromQueue(v),this.relayer.events.removeListener(ce.publish,D),L())};this.relayer.events.on(ce.publish,D);const w=ft(new Promise((v,b)=>{this.rpcPublish(R,h).then(v).catch(A=>{this.logger.warn(A,A?.message),b(A)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${E} id:${T} tag:${m}`);try{await w,this.events.removeListener(ce.publish,D)}catch(v){this.queue.set(T,{request:R,opts:h,attempt:1}),this.logger.warn(v,v?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:T,payload:u,opts:h}}),await ft(g,this.publishTimeout,I)}catch(g){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(g),(l=h?.internal)!=null&&l.throwOnFailedPublish)throw g}finally{this.queue.delete(T)}}),Ye(this,"on",(n,r)=>{this.events.on(n,r)}),Ye(this,"once",(n,r)=>{this.events.once(n,r)}),Ye(this,"off",(n,r)=>{this.events.off(n,r)}),Ye(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),this.relayer=t,this.logger=xe(e,this.name),this.registerEventListeners()}get context(){return je(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const n=await this.relayer.request(t);return this.relayer.events.emit(ce.publish,mi(mi({},t),e)),this.logger.debug("Successfully Published Payload"),n}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var n;const r=t.attempt+1;this.queue.set(e,ac(mi({},t),{attempt:r})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(n=t.request.params)==null?void 0:n.tag}, attempt: ${r}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ai.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ce.connection_stalled);return}this.checkQueue()}),this.relayer.on(ce.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var Tv=Object.defineProperty,Av=(i,t,e)=>t in i?Tv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yi=(i,t,e)=>Av(i,typeof t!="symbol"?t+"":t,e);class Pv{constructor(){yi(this,"map",new Map),yi(this,"set",(t,e)=>{const n=this.get(t);this.exists(t,e)||this.map.set(t,[...n,e])}),yi(this,"get",t=>this.map.get(t)||[]),yi(this,"exists",(t,e)=>this.get(t).includes(e)),yi(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const n=this.get(t);if(!this.exists(t,e))return;const r=n.filter(s=>s!==e);if(!r.length){this.map.delete(t);return}this.map.set(t,r)}),yi(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var Ov=Object.defineProperty,Rv=Object.defineProperties,Lv=Object.getOwnPropertyDescriptors,cc=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Vv=Object.prototype.propertyIsEnumerable,Ps=(i,t,e)=>t in i?Ov(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zi=(i,t)=>{for(var e in t||(t={}))Dv.call(t,e)&&Ps(i,e,t[e]);if(cc)for(var e of cc(t))Vv.call(t,e)&&Ps(i,e,t[e]);return i},Nr=(i,t)=>Rv(i,Lv(t)),ie=(i,t,e)=>Ps(i,typeof t!="symbol"?t+"":t,e);class Sv extends s_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ie(this,"subscriptions",new Map),ie(this,"topicMap",new Pv),ie(this,"events",new li.EventEmitter),ie(this,"name",yE),ie(this,"version",wE),ie(this,"pending",new Map),ie(this,"cached",[]),ie(this,"initialized",!1),ie(this,"storagePrefix",yt),ie(this,"subscribeTimeout",B.toMiliseconds(B.ONE_MINUTE)),ie(this,"initialSubscribeTimeout",B.toMiliseconds(B.ONE_SECOND*15)),ie(this,"clientId"),ie(this,"batchSubscribeTopicsLimit",500),ie(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),ie(this,"subscribe",async(n,r)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:r}});try{const o=er(r),c={topic:n,relay:o,transportType:r?.transportType};(s=r?.internal)!=null&&s.skipSubscribe||this.pending.set(n,c);const l=await this.rpcSubscribe(n,o,r);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:n,opts:r}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),ie(this,"unsubscribe",async(n,r)=>{this.isInitialized(),typeof r?.id<"u"?await this.unsubscribeById(n,r.id,r):await this.unsubscribeByTopic(n,r)}),ie(this,"isSubscribed",n=>new Promise(r=>{r(this.topicMap.topics.includes(n))})),ie(this,"isKnownTopic",n=>new Promise(r=>{r(this.topicMap.topics.includes(n)||this.pending.has(n)||this.cached.some(s=>s.topic===n))})),ie(this,"on",(n,r)=>{this.events.on(n,r)}),ie(this,"once",(n,r)=>{this.events.once(n,r)}),ie(this,"off",(n,r)=>{this.events.off(n,r)}),ie(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),ie(this,"start",async()=>{await this.onConnect()}),ie(this,"stop",async()=>{await this.onDisconnect()}),ie(this,"restart",async()=>{await this.restore(),await this.onRestart()}),ie(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const n=[];this.pending.forEach(r=>{n.push(r)}),await this.batchSubscribe(n)}),ie(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Ai.pulse,async()=>{await this.checkPending()}),this.events.on(Fe.created,async n=>{const r=Fe.created;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:n}),await this.persist()}),this.events.on(Fe.deleted,async n=>{const r=Fe.deleted;this.logger.info(`Emitting ${r}`),this.logger.debug({type:"event",event:r,data:n}),await this.persist()})}),this.relayer=t,this.logger=xe(e,this.name),this.clientId=""}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let n=!1;try{n=this.getSubscription(t).topic===e}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const n=this.topicMap.get(t);await Promise.all(n.map(async r=>await this.unsubscribeById(t,r,e)))}async unsubscribeById(t,e,n){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}});try{const r=er(n);await this.restartToComplete({topic:t,id:e,relay:r}),await this.rpcUnsubscribe(t,e,r);const s=oe("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:n}})}catch(r){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(r),r}}async rpcSubscribe(t,e,n){var r,s;const o=await this.getSubscriptionId(t);if((r=n?.internal)!=null&&r.skipSubscribe)return o;(!n||n?.transportType===re.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:Ei(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=n?.internal)==null?void 0:s.throwOnFailedPublish;try{if(n?.transportType===re.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(c).catch(d=>this.logger.warn(d))},B.toMiliseconds(B.ONE_SECOND)),o;const u=new Promise(async d=>{const p=_=>{_.topic===t&&(this.events.removeListener(Fe.created,p),d(_.id))};this.events.on(Fe.created,p);try{const _=await ft(new Promise((f,m)=>{this.relayer.request(c).catch(y=>{this.logger.warn(y,y?.message),m(y)}).then(f)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(Fe.created,p),d(_)}catch{}}),h=await ft(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!h&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return h?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ce.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,n={method:Ei(e.protocol).batchSubscribe,params:{topics:t.map(r=>r.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});try{await await ft(new Promise(r=>{this.relayer.request(n).catch(s=>this.logger.warn(s)).then(r)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(ce.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,n={method:Ei(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let r;try{r=await await ft(new Promise((s,o)=>{this.relayer.request(n).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(ce.connection_stalled)}return r}rpcUnsubscribe(t,e,n){const r={method:Ei(n.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r}),this.relayer.request(r)}onSubscribe(t,e){this.setSubscription(t,Nr(zi({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,zi({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,n){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,n),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,zi({},e)),this.topicMap.set(e.topic,t),this.events.emit(Fe.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const n=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(n.topic,t),this.events.emit(Fe.deleted,Nr(zi({},n),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Fe.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<e;n++){const r=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(r)}}this.events.emit(Fe.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var n;return e.topic===((n=this.subscriptions.get(e.id))==null?void 0:n.topic)})){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Nr(zi({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await um(B.toMiliseconds(B.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return Qe(t+await this.getClientId())}}var xv=Object.defineProperty,lc=Object.getOwnPropertySymbols,Cv=Object.prototype.hasOwnProperty,$v=Object.prototype.propertyIsEnumerable,Os=(i,t,e)=>t in i?xv(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,uc=(i,t)=>{for(var e in t||(t={}))Cv.call(t,e)&&Os(i,e,t[e]);if(lc)for(var e of lc(t))$v.call(t,e)&&Os(i,e,t[e]);return i},Q=(i,t,e)=>Os(i,typeof t!="symbol"?t+"":t,e);class kv extends n_{constructor(t){super(t),Q(this,"protocol","wc"),Q(this,"version",2),Q(this,"core"),Q(this,"logger"),Q(this,"events",new li.EventEmitter),Q(this,"provider"),Q(this,"messages"),Q(this,"subscriber"),Q(this,"publisher"),Q(this,"name",dE),Q(this,"transportExplicitlyClosed",!1),Q(this,"initialized",!1),Q(this,"connectionAttemptInProgress",!1),Q(this,"relayUrl"),Q(this,"projectId"),Q(this,"packageName"),Q(this,"bundleId"),Q(this,"hasExperiencedNetworkDisruption",!1),Q(this,"pingTimeout"),Q(this,"heartBeatTimeout",B.toMiliseconds(B.THIRTY_SECONDS+B.FIVE_SECONDS)),Q(this,"reconnectTimeout"),Q(this,"connectPromise"),Q(this,"reconnectInProgress",!1),Q(this,"requestsInFlight",[]),Q(this,"connectTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Q(this,"request",async e=>{var n,r;this.logger.debug("Publishing Request Payload");const s=e.id||Qt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(n=e.params)==null?void 0:n.topic},"relayer.request - publishing...");const o=`${s}:${((r=e.params)==null?void 0:r.tag)||""}`;this.requestsInFlight.push(o);const c=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),c}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),Q(this,"resetPingTimeout",()=>{Yn()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,n,r,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(r=(n=(e=this.provider)==null?void 0:e.connection)==null?void 0:n.socket)==null?void 0:r.terminate)==null||s.call(r)}catch(o){this.logger.warn(o,o?.message)}},this.heartBeatTimeout))}),Q(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Q(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(ce.connect)}),Q(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Q(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(ce.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Q(this,"registerProviderListeners",()=>{this.provider.on(Je.payload,this.onPayloadHandler),this.provider.on(Je.connect,this.onConnectHandler),this.provider.on(Je.disconnect,this.onDisconnectHandler),this.provider.on(Je.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?xe(t.logger,this.name):or(Xs({level:t.logger||hE})),this.messages=new yv(this.logger,t.core),this.subscriber=new Sv(this,this.logger),this.publisher=new Iv(this,this.logger),this.projectId=t?.projectId,this.relayUrl=t?.relayUrl||xu,Gf()?this.packageName=oa():Jf()&&(this.bundleId=oa()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t?.message))}get context(){return je(this.logger)}get connected(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===1||!1}get connecting(){var t,e,n;return((n=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:n.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,n){this.isInitialized(),await this.publisher.publish(t,e,n),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:re.relay},Nn.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var n,r,s;this.isInitialized(),(!(e!=null&&e.transportType)||e?.transportType==="relay")&&await this.toEstablishConnection();const o=typeof((n=e?.internal)==null?void 0:n.throwOnFailedPublish)>"u"?!0:(r=e?.internal)==null?void 0:r.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=h=>{h.topic===t&&(this.subscriber.off(Fe.created,u),l())};return await Promise.all([new Promise(h=>{l=h,this.subscriber.on(Fe.created,u)}),new Promise(async(h,d)=>{c=await this.subscriber.subscribe(t,uc({internal:{throwOnFailedPublish:o}},e)).catch(p=>{o&&d(p)})||c,h()})]),c}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await ft(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,n)=>{await this.connect(t).then(e).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await Ya())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if(t?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((n,r)=>n.publishedAt-r.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const n of e)try{await this.onMessageEvent(n)}catch(r){this.logger.warn(r,"Error while processing batch message event: "+r?.message)}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:n}=t;if(!e.sessionExists){const r=pe(B.FIVE_MINUTES),s={topic:n,expiry:r,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(n,s)}this.events.emit(ce.message,t),await this.recordMessageEvent(t,Nn.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(n,r)=>{const s=()=>{r(new Error("Connection interrupted while trying to connect"))};this.provider.once(Je.disconnect,s),await ft(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{r(o)}).finally(()=>{this.provider.off(Je.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{r(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(Je.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(Je.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,n()})}catch(n){await this.subscriber.stop();const r=n;this.logger.warn({},r.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(n=>setTimeout(n,B.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,n,r,s;if(Yn())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(r=(n=this.provider)==null?void 0:n.connection)==null?void 0:r.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Xh(new ed(em({sdkVersion:vs,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:n,message:r}=t;await this.messages.set(n,r,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:n}=t;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const r=this.messages.has(e,n);return r&&this.logger.warn(`Ignoring duplicate message: ${n}`),r}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),qs(t)){if(!t.method.endsWith(pE))return;const e=t.params,{topic:n,message:r,publishedAt:s,attestation:o}=e.data,c={topic:n,message:r,publishedAt:s,transportType:re.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(uc({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else zs(t)&&this.events.emit(ce.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Nn.inbound),this.events.emit(ce.message,t))}async acknowledgePayload(t){const e=jn(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(Je.payload,this.onPayloadHandler),this.provider.off(Je.connect,this.onConnectHandler),this.provider.off(Je.disconnect,this.onDisconnectHandler),this.provider.off(Je.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await Ya();zg(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(n=>this.logger.error(n,n?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Ai.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Fg())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(ce.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},B.toMiliseconds(_E)))))}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function Uv(i,t){return i===t||Number.isNaN(i)&&Number.isNaN(t)}function hc(i){return Object.getOwnPropertySymbols(i).filter(t=>Object.prototype.propertyIsEnumerable.call(i,t))}function dc(i){return i==null?i===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(i)}const Nv="[object RegExp]",Bv="[object String]",Mv="[object Number]",qv="[object Boolean]",pc="[object Arguments]",zv="[object Symbol]",jv="[object Date]",Kv="[object Map]",Fv="[object Set]",Wv="[object Array]",Hv="[object Function]",Gv="[object ArrayBuffer]",Br="[object Object]",Jv="[object Error]",Yv="[object DataView]",Zv="[object Uint8Array]",Qv="[object Uint8ClampedArray]",Xv="[object Uint16Array]",eb="[object Uint32Array]",tb="[object BigUint64Array]",ib="[object Int8Array]",nb="[object Int16Array]",rb="[object Int32Array]",sb="[object BigInt64Array]",ob="[object Float32Array]",ab="[object Float64Array]";function cb(){}function _c(i){if(!i||typeof i!="object")return!1;const t=Object.getPrototypeOf(i);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(i)==="[object Object]":!1}function lb(i,t,e){return Hi(i,t,void 0,void 0,void 0,void 0,e)}function Hi(i,t,e,n,r,s,o){const c=o(i,t,e,n,r,s);if(c!==void 0)return c;if(typeof i==typeof t)switch(typeof i){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return i===t;case"number":return i===t||Object.is(i,t);case"function":return i===t;case"object":return tn(i,t,s,o)}return tn(i,t,s,o)}function tn(i,t,e,n){if(Object.is(i,t))return!0;let r=dc(i),s=dc(t);if(r===pc&&(r=Br),s===pc&&(s=Br),r!==s)return!1;switch(r){case Bv:return i.toString()===t.toString();case Mv:{const l=i.valueOf(),u=t.valueOf();return Uv(l,u)}case qv:case jv:case zv:return Object.is(i.valueOf(),t.valueOf());case Nv:return i.source===t.source&&i.flags===t.flags;case Hv:return i===t}e=e??new Map;const o=e.get(i),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(i,t),e.set(t,i);try{switch(r){case Kv:{if(i.size!==t.size)return!1;for(const[l,u]of i.entries())if(!t.has(l)||!Hi(u,t.get(l),l,i,t,e,n))return!1;return!0}case Fv:{if(i.size!==t.size)return!1;const l=Array.from(i.values()),u=Array.from(t.values());for(let h=0;h<l.length;h++){const d=l[h],p=u.findIndex(_=>Hi(d,_,void 0,i,t,e,n));if(p===-1)return!1;u.splice(p,1)}return!0}case Wv:case Zv:case Qv:case Xv:case eb:case tb:case ib:case nb:case rb:case sb:case ob:case ab:{if(typeof te<"u"&&te.isBuffer(i)!==te.isBuffer(t)||i.length!==t.length)return!1;for(let l=0;l<i.length;l++)if(!Hi(i[l],t[l],l,i,t,e,n))return!1;return!0}case Gv:return i.byteLength!==t.byteLength?!1:tn(new Uint8Array(i),new Uint8Array(t),e,n);case Yv:return i.byteLength!==t.byteLength||i.byteOffset!==t.byteOffset?!1:tn(new Uint8Array(i),new Uint8Array(t),e,n);case Jv:return i.name===t.name&&i.message===t.message;case Br:{if(!(tn(i.constructor,t.constructor,e,n)||_c(i)&&_c(t)))return!1;const l=[...Object.keys(i),...hc(i)],u=[...Object.keys(t),...hc(t)];if(l.length!==u.length)return!1;for(let h=0;h<l.length;h++){const d=l[h],p=i[d];if(!Object.hasOwn(t,d))return!1;const _=t[d];if(!Hi(p,_,d,i,t,e,n))return!1}return!0}default:return!1}}finally{e.delete(i),e.delete(t)}}function ub(i,t){return lb(i,t,cb)}var hb=Object.defineProperty,fc=Object.getOwnPropertySymbols,db=Object.prototype.hasOwnProperty,pb=Object.prototype.propertyIsEnumerable,Rs=(i,t,e)=>t in i?hb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,mc=(i,t)=>{for(var e in t||(t={}))db.call(t,e)&&Rs(i,e,t[e]);if(fc)for(var e of fc(t))pb.call(t,e)&&Rs(i,e,t[e]);return i},Ce=(i,t,e)=>Rs(i,typeof t!="symbol"?t+"":t,e);class di extends r_{constructor(t,e,n,r=yt,s=void 0){super(t,e,n,r),this.core=t,this.logger=e,this.name=n,Ce(this,"map",new Map),Ce(this,"version",fE),Ce(this,"cached",[]),Ce(this,"initialized",!1),Ce(this,"getKey"),Ce(this,"storagePrefix",yt),Ce(this,"recentlyDeleted",[]),Ce(this,"recentlyDeletedLimit",200),Ce(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!_e(o)?this.map.set(this.getKey(o),o):gg(o)?this.map.set(o.id,o):Eg(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),Ce(this,"set",async(o,c)=>{this.isInitialized(),this.map.has(o)?await this.update(o,c):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:c}),this.map.set(o,c),await this.persist())}),Ce(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),Ce(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>ub(c[l],o[l]))):this.values)),Ce(this,"update",async(o,c)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:c});const l=mc(mc({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),Ce(this,"delete",async(o,c)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:c}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=xe(e,this.name),this.storagePrefix=r,this.getKey=s}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:r}=N("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var _b=Object.defineProperty,fb=(i,t,e)=>t in i?_b(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,G=(i,t,e)=>fb(i,typeof t!="symbol"?t+"":t,e);class mb{constructor(t,e){this.core=t,this.logger=e,G(this,"name",gE),G(this,"version",EE),G(this,"events",new jc),G(this,"pairings"),G(this,"initialized",!1),G(this,"storagePrefix",yt),G(this,"ignoredPayloadTypes",[Pt]),G(this,"registeredMethods",[]),G(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),G(this,"register",({methods:n})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...n])]}),G(this,"create",async n=>{this.isInitialized();const r=ws(),s=await this.core.crypto.setSymKey(r),o=pe(B.FIVE_MINUTES),c={protocol:Su},l={topic:s,expiry:o,relay:c,active:!1,methods:n?.methods},u=qa({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:r,relay:c,expiryTimestamp:o,methods:n?.methods});return this.events.emit(Zt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:n?.transportType,internal:n?.internal}),{topic:s,uri:u}}),G(this,"pair",async n=>{this.isInitialized();const r=this.core.eventClient.createEvent({properties:{topic:n?.uri,trace:[dt.pairing_started]}});this.isValidPair(n,r);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=Ma(n.uri);r.props.properties.topic=s,r.addTrace(dt.pairing_uri_validation_success),r.addTrace(dt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),r.addTrace(dt.existing_pairing),h.active)throw r.setError(It.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);r.addTrace(dt.pairing_not_expired)}const d=l||pe(B.FIVE_MINUTES),p={topic:s,relay:c,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,p),r.addTrace(dt.store_new_pairing),n.activatePairing&&await this.activate({topic:s}),this.events.emit(Zt.create,p),r.addTrace(dt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),r.addTrace(dt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(It.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(_){throw r.setError(It.subscribe_pairing_topic_failure),_}return r.addTrace(dt.subscribe_pairing_topic_success),p}),G(this,"activate",async({topic:n})=>{this.isInitialized();const r=pe(B.FIVE_MINUTES);this.core.expirer.set(n,r),await this.pairings.update(n,{active:!0,expiry:r})}),G(this,"ping",async n=>{this.isInitialized(),await this.isValidPing(n),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:r}=n;if(this.pairings.keys.includes(r)){const s=await this.sendRequest(r,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Yt();this.events.once(X("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),G(this,"updateExpiry",async({topic:n,expiry:r})=>{this.isInitialized(),await this.pairings.update(n,{expiry:r})}),G(this,"updateMetadata",async({topic:n,metadata:r})=>{this.isInitialized(),await this.pairings.update(n,{peerMetadata:r})}),G(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),G(this,"disconnect",async n=>{this.isInitialized(),await this.isValidDisconnect(n);const{topic:r}=n;this.pairings.keys.includes(r)&&(await this.sendRequest(r,"wc_pairingDelete",oe("USER_DISCONNECTED")),await this.deletePairing(r))}),G(this,"formatUriFromPairing",n=>{this.isInitialized();const{topic:r,relay:s,expiry:o,methods:c}=n,l=this.core.crypto.keychain.get(r);return qa({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),G(this,"sendRequest",async(n,r,s)=>{const o=Ut(r,s),c=await this.core.crypto.encode(n,o),l=Bi[r].req;return this.core.history.set(n,o),this.core.relayer.publish(n,c,l),o.id}),G(this,"sendResult",async(n,r,s)=>{const o=jn(n,s),c=await this.core.crypto.encode(r,o),l=(await this.core.history.get(r,n)).request.method,u=Bi[l].res;await this.core.relayer.publish(r,c,u),await this.core.history.resolve(o)}),G(this,"sendError",async(n,r,s)=>{const o=Kc(n,s),c=await this.core.crypto.encode(r,o),l=(await this.core.history.get(r,n)).request.method,u=Bi[l]?Bi[l].res:Bi.unregistered_method.res;await this.core.relayer.publish(r,c,u),await this.core.history.resolve(o)}),G(this,"deletePairing",async(n,r)=>{await this.core.relayer.unsubscribe(n),await Promise.all([this.pairings.delete(n,oe("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(n),r?Promise.resolve():this.core.expirer.del(n)])}),G(this,"cleanup",async()=>{const n=this.pairings.getAll().filter(r=>Nt(r.expiry));await Promise.all(n.map(r=>this.deletePairing(r.topic)))}),G(this,"onRelayEventRequest",async n=>{const{topic:r,payload:s}=n;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(r,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(r,s);default:return await this.onUnknownRpcMethodRequest(r,s)}}),G(this,"onRelayEventResponse",async n=>{const{topic:r,payload:s}=n,o=(await this.core.history.get(r,s.id)).request.method;return o==="wc_pairingPing"?this.onPairingPingResponse(r,s):this.onUnknownRpcMethodResponse(o)}),G(this,"onPairingPingRequest",async(n,r)=>{const{id:s}=r;try{this.isValidPing({topic:n}),await this.sendResult(s,n,!0),this.events.emit(Zt.ping,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onPairingPingResponse",(n,r)=>{const{id:s}=r;setTimeout(()=>{vt(r)?this.events.emit(X("pairing_ping",s),{}):pt(r)&&this.events.emit(X("pairing_ping",s),{error:r.error})},500)}),G(this,"onPairingDeleteRequest",async(n,r)=>{const{id:s}=r;try{this.isValidDisconnect({topic:n}),await this.deletePairing(n),this.events.emit(Zt.delete,{id:s,topic:n})}catch(o){await this.sendError(s,n,o),this.logger.error(o)}}),G(this,"onUnknownRpcMethodRequest",async(n,r)=>{const{id:s,method:o}=r;try{if(this.registeredMethods.includes(o))return;const c=oe("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,n,c),this.logger.error(c)}catch(c){await this.sendError(s,n,c),this.logger.error(c)}}),G(this,"onUnknownRpcMethodResponse",n=>{this.registeredMethods.includes(n)||this.logger.error(oe("WC_METHOD_UNSUPPORTED",n))}),G(this,"isValidPair",(n,r)=>{var s;if(!ke(n)){const{message:c}=N("MISSING_OR_INVALID",`pair() params: ${n}`);throw r.setError(It.malformed_pairing_uri),new Error(c)}if(!wg(n.uri)){const{message:c}=N("MISSING_OR_INVALID",`pair() uri: ${n.uri}`);throw r.setError(It.malformed_pairing_uri),new Error(c)}const o=Ma(n?.uri);if(!((s=o?.relay)!=null&&s.protocol)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#relay-protocol");throw r.setError(It.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=N("MISSING_OR_INVALID","pair() uri#symKey");throw r.setError(It.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&B.toMiliseconds(o?.expiryTimestamp)<Date.now()){r.setError(It.pairing_expired);const{message:c}=N("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),G(this,"isValidPing",async n=>{if(!ke(n)){const{message:s}=N("MISSING_OR_INVALID",`ping() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidPairingTopic(r)}),G(this,"isValidDisconnect",async n=>{if(!ke(n)){const{message:s}=N("MISSING_OR_INVALID",`disconnect() params: ${n}`);throw new Error(s)}const{topic:r}=n;await this.isValidPairingTopic(r)}),G(this,"isValidPairingTopic",async n=>{if(!he(n,!1)){const{message:r}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${n}`);throw new Error(r)}if(!this.pairings.keys.includes(n)){const{message:r}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${n}`);throw new Error(r)}if(Nt(this.pairings.get(n).expiry)){await this.deletePairing(n);const{message:r}=N("EXPIRED",`pairing topic: ${n}`);throw new Error(r)}}),this.core=t,this.logger=xe(e,this.name),this.pairings=new di(this.core,this.logger,this.name,this.storagePrefix)}get context(){return je(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(ce.message,async t=>{const{topic:e,message:n,transportType:r}=t;if(this.pairings.keys.includes(e)&&r!==re.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))try{const s=await this.core.crypto.decode(e,n);qs(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):zs(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,n)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Ze.expired,async t=>{const{topic:e}=kl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Zt.expire,{topic:e}))})}}var yb=Object.defineProperty,wb=(i,t,e)=>t in i?yb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ve=(i,t,e)=>wb(i,typeof t!="symbol"?t+"":t,e);class gb extends e_{constructor(t,e){super(t,e),this.core=t,this.logger=e,ve(this,"records",new Map),ve(this,"events",new li.EventEmitter),ve(this,"name",vE),ve(this,"version",bE),ve(this,"cached",[]),ve(this,"initialized",!1),ve(this,"storagePrefix",yt),ve(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.records.set(n.id,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),ve(this,"set",(n,r,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:n,request:r,chainId:s}),this.records.has(r.id))return;const o={id:r.id,topic:n,request:{method:r.method,params:r.params||null},chainId:s,expiry:pe(B.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(nt.created,o)}),ve(this,"resolve",async n=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:n}),!this.records.has(n.id))return;const r=await this.getRecord(n.id);typeof r.response>"u"&&(r.response=pt(n)?{error:n.error}:{result:n.result},this.records.set(r.id,r),this.persist(),this.events.emit(nt.updated,r))}),ve(this,"get",async(n,r)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:n,id:r}),await this.getRecord(r))),ve(this,"delete",(n,r)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:r}),this.values.forEach(s=>{if(s.topic===n){if(typeof r<"u"&&s.id!==r)return;this.records.delete(s.id),this.events.emit(nt.deleted,s)}}),this.persist()}),ve(this,"exists",async(n,r)=>(this.isInitialized(),this.records.has(r)?(await this.getRecord(r)).topic===n:!1)),ve(this,"on",(n,r)=>{this.events.on(n,r)}),ve(this,"once",(n,r)=>{this.events.once(n,r)}),ve(this,"off",(n,r)=>{this.events.off(n,r)}),ve(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),this.logger=xe(e,this.name)}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const n={topic:e.topic,request:Ut(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(n)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(n)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(nt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(nt.created,t=>{const e=nt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.updated,t=>{const e=nt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(nt.deleted,t=>{const e=nt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Ai.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{B.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(nt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Eb=Object.defineProperty,vb=(i,t,e)=>t in i?Eb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Oe=(i,t,e)=>vb(i,typeof t!="symbol"?t+"":t,e);class bb extends o_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Oe(this,"expirations",new Map),Oe(this,"events",new li.EventEmitter),Oe(this,"name",IE),Oe(this,"version",TE),Oe(this,"cached",[]),Oe(this,"initialized",!1),Oe(this,"storagePrefix",yt),Oe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(n=>this.expirations.set(n.target,n)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Oe(this,"has",n=>{try{const r=this.formatTarget(n);return typeof this.getExpiration(r)<"u"}catch{return!1}}),Oe(this,"set",(n,r)=>{this.isInitialized();const s=this.formatTarget(n),o={target:s,expiry:r};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Ze.created,{target:s,expiration:o})}),Oe(this,"get",n=>{this.isInitialized();const r=this.formatTarget(n);return this.getExpiration(r)}),Oe(this,"del",n=>{if(this.isInitialized(),this.has(n)){const r=this.formatTarget(n),s=this.getExpiration(r);this.expirations.delete(r),this.events.emit(Ze.deleted,{target:r,expiration:s})}}),Oe(this,"on",(n,r)=>{this.events.on(n,r)}),Oe(this,"once",(n,r)=>{this.events.once(n,r)}),Oe(this,"off",(n,r)=>{this.events.off(n,r)}),Oe(this,"removeListener",(n,r)=>{this.events.removeListener(n,r)}),this.logger=xe(e,this.name)}get context(){return je(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return tm(t);if(typeof t=="number")return im(t);const{message:e}=N("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(Ze.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:n}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(n),new Error(n)}return e}checkExpiry(t,e){const{expiry:n}=e;B.toMiliseconds(n)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Ze.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Ai.pulse,()=>this.checkExpirations()),this.events.on(Ze.created,t=>{const e=Ze.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ze.expired,t=>{const e=Ze.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Ze.deleted,t=>{const e=Ze.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Ib=Object.defineProperty,Tb=(i,t,e)=>t in i?Ib(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ue=(i,t,e)=>Tb(i,typeof t!="symbol"?t+"":t,e);class Ab extends a_{constructor(t,e,n){super(t,e,n),this.core=t,this.logger=e,this.store=n,ue(this,"name",AE),ue(this,"abortController"),ue(this,"isDevEnv"),ue(this,"verifyUrlV3",OE),ue(this,"storagePrefix",yt),ue(this,"version",Vu),ue(this,"publicKey"),ue(this,"fetchPromise"),ue(this,"init",async()=>{var r;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&B.toMiliseconds((r=this.publicKey)==null?void 0:r.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),ue(this,"register",async r=>{if(!Li()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=r,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${c}`;try{const u=Ot.getDocument(),h=this.startAbortTimer(B.ONE_SECOND*5),d=await new Promise((p,_)=>{const f=()=>{window.removeEventListener("message",y),u.body.removeChild(m),_("attestation aborted")};this.abortController.signal.addEventListener("abort",f);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",f,{signal:this.abortController.signal});const y=T=>{if(T.data&&typeof T.data=="string")try{const O=JSON.parse(T.data);if(O.type==="verify_attestation"){if(Yr(O.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",f),window.removeEventListener("message",y),p(O.attestation===null?"":O.attestation)}}catch(O){this.logger.warn(O)}};u.body.appendChild(m),window.addEventListener("message",y,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),ue(this,"resolve",async r=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=r;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Yr(s).payload.id!==c)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(r?.verifyUrl);return this.fetchAttestation(o,l)}),ue(this,"fetchAttestation",async(r,s)=>{this.logger.debug(`resolving attestation: ${r} from url: ${s}`);const o=this.startAbortTimer(B.ONE_SECOND*5),c=await fetch(`${s}/attestation/${r}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),ue(this,"getVerifyUrl",r=>{let s=r||en;return RE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${en}`),s=en),s}),ue(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const r=this.startAbortTimer(B.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(r),await s.json()}catch(r){this.logger.warn(r)}}),ue(this,"persistPublicKey",async r=>{this.logger.debug("persisting public key to local storage",r),await this.store.setItem(this.storeKey,r),this.publicKey=r}),ue(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),ue(this,"isValidJwtAttestation",async r=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(r,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(r,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),ue(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),ue(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const r=await this.fetchPromise;return this.fetchPromise=void 0,r}),ue(this,"validateAttestation",(r,s)=>{const o=Yw(r,s.publicKey),c={hasExpired:B.toMiliseconds(o.exp)<Date.now(),payload:o};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=xe(e,this.name),this.abortController=new AbortController,this.isDevEnv=ro(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return je(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),B.toMiliseconds(t))}}var Pb=Object.defineProperty,Ob=(i,t,e)=>t in i?Pb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,yc=(i,t,e)=>Ob(i,typeof t!="symbol"?t+"":t,e);class Rb extends c_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,yc(this,"context",LE),yc(this,"registerDeviceToken",async n=>{const{clientId:r,token:s,notificationType:o,enableEncrypted:c=!1}=n,l=`${DE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:r,type:o,token:s,always_raw:c})})}),this.logger=xe(e,this.context)}}var Lb=Object.defineProperty,wc=Object.getOwnPropertySymbols,Db=Object.prototype.hasOwnProperty,Vb=Object.prototype.propertyIsEnumerable,Ls=(i,t,e)=>t in i?Lb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ji=(i,t)=>{for(var e in t||(t={}))Db.call(t,e)&&Ls(i,e,t[e]);if(wc)for(var e of wc(t))Vb.call(t,e)&&Ls(i,e,t[e]);return i},fe=(i,t,e)=>Ls(i,typeof t!="symbol"?t+"":t,e);class Sb extends l_{constructor(t,e,n=!0){super(t,e,n),this.core=t,this.logger=e,fe(this,"context",SE),fe(this,"storagePrefix",yt),fe(this,"storageVersion",VE),fe(this,"events",new Map),fe(this,"shouldPersist",!1),fe(this,"init",async()=>{if(!ro())try{const r={eventId:ca(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Cl(this.core.relayer.protocol,this.core.relayer.version,vs)}}};await this.sendEvent([r])}catch(r){this.logger.warn(r)}}),fe(this,"createEvent",r=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=r,u=ca(),h=this.core.projectId||"",d=Date.now(),p=ji({eventId:u,timestamp:d,props:{event:s,type:o,properties:{topic:c,trace:l}},bundleId:h,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,p),this.shouldPersist=!0),p}),fe(this,"getEvent",r=>{const{eventId:s,topic:o}=r;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return ji(ji({},c),this.setMethods(c.eventId))}),fe(this,"deleteEvent",r=>{const{eventId:s}=r;this.events.delete(s),this.shouldPersist=!0}),fe(this,"setEventListeners",()=>{this.core.heartbeat.on(Ai.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(r=>{B.fromMiliseconds(Date.now())-B.fromMiliseconds(r.timestamp)>xE&&(this.events.delete(r.eventId),this.shouldPersist=!0)})})}),fe(this,"setMethods",r=>({addTrace:s=>this.addTrace(r,s),setError:s=>this.setError(r,s)})),fe(this,"addTrace",(r,s)=>{const o=this.events.get(r);o&&(o.props.properties.trace.push(s),this.events.set(r,o),this.shouldPersist=!0)}),fe(this,"setError",(r,s)=>{const o=this.events.get(r);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(r,o),this.shouldPersist=!0)}),fe(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),fe(this,"restore",async()=>{try{const r=await this.core.storage.getItem(this.storageKey)||[];if(!r.length)return;r.forEach(s=>{this.events.set(s.eventId,ji(ji({},s),this.setMethods(s.eventId)))})}catch(r){this.logger.warn(r)}}),fe(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const r=[];for(const[s,o]of this.events)o.props.type&&r.push(o);if(r.length!==0)try{if((await this.sendEvent(r)).ok)for(const s of r)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),fe(this,"sendEvent",async r=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${CE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${vs}${s}`,{method:"POST",body:JSON.stringify(r)})}),fe(this,"getAppDomain",()=>xl().url),this.logger=xe(e,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var xb=Object.defineProperty,gc=Object.getOwnPropertySymbols,Cb=Object.prototype.hasOwnProperty,$b=Object.prototype.propertyIsEnumerable,Ds=(i,t,e)=>t in i?xb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,Ec=(i,t)=>{for(var e in t||(t={}))Cb.call(t,e)&&Ds(i,e,t[e]);if(gc)for(var e of gc(t))$b.call(t,e)&&Ds(i,e,t[e]);return i},ne=(i,t,e)=>Ds(i,typeof t!="symbol"?t+"":t,e);class go extends Yp{constructor(t){var e;super(t),ne(this,"protocol",Du),ne(this,"version",Vu),ne(this,"name",Es),ne(this,"relayUrl"),ne(this,"projectId"),ne(this,"customStoragePrefix"),ne(this,"events",new li.EventEmitter),ne(this,"logger"),ne(this,"heartbeat"),ne(this,"relayer"),ne(this,"crypto"),ne(this,"storage"),ne(this,"history"),ne(this,"expirer"),ne(this,"pairing"),ne(this,"verify"),ne(this,"echoClient"),ne(this,"linkModeSupportedApps"),ne(this,"eventClient"),ne(this,"initialized",!1),ne(this,"logChunkController"),ne(this,"on",(c,l)=>this.events.on(c,l)),ne(this,"once",(c,l)=>this.events.once(c,l)),ne(this,"off",(c,l)=>this.events.off(c,l)),ne(this,"removeListener",(c,l)=>this.events.removeListener(c,l)),ne(this,"dispatchEnvelope",({topic:c,message:l,sessionExists:u})=>{if(!c||!l)return;const h={topic:c,message:l,publishedAt:Date.now(),transportType:re.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})});const n=this.getGlobalCore(t?.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t?.projectId,this.relayUrl=t?.relayUrl||xu,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const r=Xs({level:typeof t?.logger=="string"&&t.logger?t.logger:tE.logger,name:Es}),{logger:s,chunkLoggerController:o}=Hp({opts:r,maxSizeInBytes:t?.maxLogBlobSizeInBytes,loggerOverride:t?.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var c,l;(c=this.logChunkController)!=null&&c.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=xe(s,this.name),this.heartbeat=new Qh,this.crypto=new lv(this,this.logger,t?.keychain),this.history=new gb(this,this.logger),this.expirer=new bb(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new Vp(Ec(Ec({},iE),t?.storageOptions)),this.relayer=new kv({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new mb(this,this.logger),this.verify=new Ab(this,this.logger,this.storage),this.echoClient=new Rb(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Sb(this,this.logger,t?.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new go(t);await e.initialize();const n=await e.crypto.getClientId();return await e.storage.setItem(mE,n),e}get context(){return je(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(Qa,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(Qa)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,n=`${e}_count`;return globalThis[n]=(globalThis[n]||0)+1,globalThis[n]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[n]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[n]=t}catch(n){console.warn("Failed to set global WalletConnect core",n)}}isGlobalCoreDisabled(){try{return typeof jt<"u"&&eE.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const kb=go,Wu="wc",Hu=2,Gu="client",Eo=`${Wu}@${Hu}:${Gu}:`,Mr={name:Gu,logger:"error"},vc="WALLETCONNECT_DEEPLINK_CHOICE",Ub="proposal",bc="Proposal expired",Nb="session",wi=B.SEVEN_DAYS,Bb="engine",be={wc_sessionPropose:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1104},res:{ttl:B.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1106},res:{ttl:B.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:B.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1112},res:{ttl:B.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:B.ONE_DAY,prompt:!1,tag:1114},res:{ttl:B.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:B.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:B.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:B.FIVE_MINUTES,prompt:!1,tag:1119}}},qr={min:B.FIVE_MINUTES,max:B.SEVEN_DAYS},ht={idle:"IDLE",active:"ACTIVE"},Mb={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},qb="request",zb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],jb="wc",Kb="auth",Fb="authKeys",Wb="pairingTopics",Hb="requests",fr=`${jb}@${1.5}:${Kb}:`,Bn=`${fr}:PUB_KEY`;var Gb=Object.defineProperty,Jb=Object.defineProperties,Yb=Object.getOwnPropertyDescriptors,Ic=Object.getOwnPropertySymbols,Zb=Object.prototype.hasOwnProperty,Qb=Object.prototype.propertyIsEnumerable,Vs=(i,t,e)=>t in i?Gb(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,ee=(i,t)=>{for(var e in t||(t={}))Zb.call(t,e)&&Vs(i,e,t[e]);if(Ic)for(var e of Ic(t))Qb.call(t,e)&&Vs(i,e,t[e]);return i},Re=(i,t)=>Jb(i,Yb(t)),x=(i,t,e)=>Vs(i,typeof t!="symbol"?t+"":t,e);class Xb extends p_{constructor(t){super(t),x(this,"name",Bb),x(this,"events",new jc),x(this,"initialized",!1),x(this,"requestQueue",{state:ht.idle,queue:[]}),x(this,"sessionRequestQueue",{state:ht.idle,queue:[]}),x(this,"emittedSessionRequests",new hm({limit:500})),x(this,"requestQueueDelay",B.ONE_SECOND),x(this,"expectedPairingMethodMap",new Map),x(this,"recentlyDeletedMap",new Map),x(this,"recentlyDeletedLimit",200),x(this,"relayMessageCache",[]),x(this,"pendingSessions",new Map),x(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(be)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay)))}),x(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const n=Re(ee({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(n),n.optionalNamespaces=pg(n.requiredNamespaces,n.optionalNamespaces),n.requiredNamespaces={};const{pairingTopic:r,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=n;let h=r,d,p=!1;try{if(h){const g=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),p=g.active}}catch(g){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),g}if(!h||!p){const{topic:g,uri:L}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=g,d=L}if(!h){const{message:g}=N("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(g)}const _=await this.client.core.crypto.generateKeyPair(),f=be.wc_sessionPropose.req.ttl||B.FIVE_MINUTES,m=pe(f),y=Re(ee(ee({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Su}],proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:h},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Lt()}),T=X("session_connect",y.id),{reject:O,resolve:E,done:R}=Yt(f,bc),I=({id:g})=>{g===y.id&&(this.client.events.off("proposal_expire",I),this.pendingSessions.delete(y.id),this.events.emit(T,{error:{message:bc,code:0}}))};return this.client.events.on("proposal_expire",I),this.events.once(T,({error:g,session:L})=>{this.client.events.off("proposal_expire",I),g?O(g):L&&E(L)}),await this.sendProposeSession({proposal:y,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:y.id}}}),await this.setProposal(y.id,y),{uri:d,approval:R}}),x(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(n){throw this.client.logger.error("pair() failed"),n}}),x(this,"approve",async e=>{var n,r,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(n=e?.id)==null?void 0:n.toString(),trace:[kt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(w){throw o.setError(Mi.no_internet_connection),w}try{await this.isValidProposalId(e?.id)}catch(w){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),o.setError(Mi.proposal_not_found),w}try{await this.isValidApprove(e)}catch(w){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(Mi.session_approve_namespace_validation_failure),w}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=e,_=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:f,proposer:m,requiredNamespaces:y,optionalNamespaces:T}=_;let O=(r=this.client.core.eventClient)==null?void 0:r.getEvent({topic:f});O||(O=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:kt.session_approve_started,properties:{topic:f,trace:[kt.session_approve_started,kt.session_namespaces_validation_success]}}));const E=await this.client.core.crypto.generateKeyPair(),R=m.publicKey,I=await this.client.core.crypto.generateSharedKey(E,R),g=ee(ee(ee({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:E,metadata:this.client.metadata},expiry:pe(wi)},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),L=re.relay;O.addTrace(kt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(I,{transportType:L,internal:{skipSubscribe:!0}})}catch(w){throw O.setError(Mi.subscribe_session_topic_failure),w}O.addTrace(kt.subscribe_session_topic_success);const D=Re(ee({},g),{topic:I,requiredNamespaces:y,optionalNamespaces:T,pairingTopic:f,acknowledged:!1,self:g.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:E,transportType:re.relay});await this.client.session.set(I,D),O.addTrace(kt.store_session);try{await this.sendApproveSession({sessionTopic:I,proposal:_,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:E},sessionSettleRequest:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),O.addTrace(kt.session_approve_publish_success)}catch(w){throw this.client.logger.error(w),this.client.session.delete(I,oe("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(I),w}return this.client.core.eventClient.deleteEvent({eventId:O.eventId}),await this.client.core.pairing.updateMetadata({topic:f,metadata:m.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:f}),await this.setExpiry(I,pe(wi)),{topic:I,acknowledged:()=>Promise.resolve(this.client.session.get(I))}}),x(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:n,reason:r}=e;let s;try{s=this.client.proposal.get(n).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${n}) failed`),o}s&&await this.sendError({id:n,topic:s,error:r,rpcOpts:be.wc_sessionPropose.reject}),await this.deleteProposal(n)}),x(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:n,namespaces:r}=e,{done:s,resolve:o,reject:c}=Yt(),l=Lt(),u=Qt().toString(),h=this.client.session.get(n).namespaces;return this.events.once(X("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(n,{namespaces:r}),await this.sendRequest({topic:n,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(n,{namespaces:h}),c(d)}),{acknowledged:s}}),x(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:n}=e,r=Lt(),{done:s,resolve:o,reject:c}=Yt();return this.events.once(X("session_extend",r),({error:l})=>{l?c(l):o()}),await this.setExpiry(n,pe(wi)),this.sendRequest({topic:n,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),x(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(y){throw this.client.logger.error("request() -> isValidRequest() failed"),y}const{chainId:n,request:r,topic:s,expiry:o=be.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);c?.transportType===re.relay&&await this.confirmOnlineStateOrThrow();const l=Lt(),u=Qt().toString(),{done:h,resolve:d,reject:p}=Yt(o,"Request expired. Please try again.");this.events.once(X("session_request",l),({error:y,result:T})=>{y?p(y):d(T)});const _="wc_sessionRequest",f=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(f)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:{request:Re(ee({},r),{expiryTimestamp:pe(o)}),chainId:n},expiry:o,throwOnFailedPublish:!0,appLink:f}).catch(y=>p(y)),this.client.events.emit("session_request_sent",{topic:s,request:r,chainId:n,id:l}),await h();const m={request:Re(ee({},r),{expiryTimestamp:pe(o)}),chainId:n};return await Promise.all([new Promise(async y=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:_,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(T=>p(T)),this.client.events.emit("session_request_sent",{topic:s,request:r,chainId:n,id:l}),y()}),new Promise(async y=>{var T;if(!((T=c.sessionConfig)!=null&&T.disableDeepLink)){const O=await om(this.client.core.storage,vc);await nm({id:l,topic:s,wcDeepLink:O})}y()}),h()]).then(y=>y[2])}),x(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:n,response:r}=e,{id:s}=r,o=this.client.session.get(n);o.transportType===re.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);vt(r)?await this.sendResult({id:s,topic:n,result:r.result,throwOnFailedPublish:!0,appLink:c}):pt(r)&&await this.sendError({id:s,topic:n,error:r.error,appLink:c}),this.cleanupAfterResponse(e)}),x(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(r){throw this.client.logger.error("ping() -> isValidPing() failed"),r}const{topic:n}=e;if(this.client.session.keys.includes(n)){const r=Lt(),s=Qt().toString(),{done:o,resolve:c,reject:l}=Yt();this.events.once(X("session_ping",r),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:n,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:r,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(n)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:n}))}),x(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:n,event:r,chainId:s}=e,o=Qt().toString(),c=Lt();await this.sendRequest({topic:n,method:"wc_sessionEvent",params:{event:r,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),x(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:n}=e;if(this.client.session.keys.includes(n))await this.sendRequest({topic:n,method:"wc_sessionDelete",params:oe("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:n,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(n))await this.client.core.pairing.disconnect({topic:n});else{const{message:r}=N("MISMATCHED_TOPIC",`Session or pairing topic not found: ${n}`);throw new Error(r)}}),x(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(n=>mg(n,e)))),x(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),x(this,"authenticate",async(e,n)=>{var r;this.isInitialized(),this.isValidAuthenticate(e);const s=n&&this.client.core.linkModeSupportedApps.includes(n)&&((r=this.client.metadata.redirect)==null?void 0:r.linkMode),o=s?re.link_mode:re.relay;o===re.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:h,nonce:d,type:p,exp:_,nbf:f,methods:m=[],expiry:y}=e,T=[...e.resources||[]],{topic:O,uri:E}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:O,uri:E}});const R=await this.client.core.crypto.generateKeyPair(),I=Un(R);if(await Promise.all([this.client.auth.authKeys.set(Bn,{responseTopic:I,publicKey:R}),this.client.auth.pairingTopics.set(I,{topic:I,pairingTopic:O})]),await this.client.core.relayer.subscribe(I,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${O}`),m.length>0){const{namespace:C}=$n(c[0]);let U=by(C,"request",m);kn(T)&&(U=Ty(U,T.pop())),T.push(U)}const g=y&&y>be.wc_sessionAuthenticate.req.ttl?y:be.wc_sessionAuthenticate.req.ttl,L={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:_,nbf:f,resources:T},requester:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:pe(g)},D={eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},w={requiredNamespaces:{},optionalNamespaces:D,relays:[{protocol:"irn"}],pairingTopic:O,proposer:{publicKey:R,metadata:this.client.metadata},expiryTimestamp:pe(be.wc_sessionPropose.req.ttl),id:Lt()},{done:v,resolve:b,reject:A}=Yt(g,"Request expired"),V=Lt(),P=X("session_connect",w.id),S=X("session_request",V),$=async({error:C,session:U})=>{this.events.off(S,k),C?A(C):U&&b({session:U})},k=async C=>{var U,z,j;if(await this.deletePendingAuthRequest(V,{message:"fulfilled",code:0}),C.error){const se=oe("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===se.code?void 0:(this.events.off(P,$),A(C.error.message))}await this.deleteProposal(w.id),this.events.off(P,$);const{cacaos:K,responder:F}=C.result,W=[],H=[];for(const se of K){await ga({cacao:se,projectId:this.client.core.projectId})||(this.client.logger.error(se,"Signature verification failed"),A(oe("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Ge}=se,wt=kn(Ge.resources),To=[ls(Ge.iss)],oh=Zn(Ge.iss);if(wt){const yr=Ea(wt),ah=va(wt);W.push(...yr),To.push(...ah)}for(const yr of To)H.push(`${yr}:${oh}`)}const le=await this.client.core.crypto.generateSharedKey(R,F.publicKey);let ae;W.length>0&&(ae={topic:le,acknowledged:!0,self:{publicKey:R,metadata:this.client.metadata},peer:F,controller:F.publicKey,expiry:pe(wi),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:O,namespaces:Fa([...new Set(W)],[...new Set(H)]),transportType:o},await this.client.core.relayer.subscribe(le,{transportType:o}),await this.client.session.set(le,ae),O&&await this.client.core.pairing.updateMetadata({topic:O,metadata:F.metadata}),ae=this.client.session.get(le)),(U=this.client.metadata.redirect)!=null&&U.linkMode&&(z=F.metadata.redirect)!=null&&z.linkMode&&(j=F.metadata.redirect)!=null&&j.universal&&n&&(this.client.core.addLinkModeSupportedApp(F.metadata.redirect.universal),this.client.session.update(le,{transportType:re.link_mode})),b({auths:K,session:ae})};this.events.once(P,$),this.events.once(S,k);let M;try{if(s){const C=Ut("wc_sessionAuthenticate",L,V);this.client.core.history.set(O,C);const U=await this.client.core.crypto.encode("",C,{type:gn,encoding:zt});M=Vn(n,O,U)}else await Promise.all([this.sendRequest({topic:O,method:"wc_sessionAuthenticate",params:L,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:O,method:"wc_sessionPropose",params:w,expiry:be.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:w.id})])}catch(C){throw this.events.off(P,$),this.events.off(S,k),C}return await this.setProposal(w.id,w),await this.setAuthRequest(V,{request:Re(ee({},L),{verifyContext:{}}),pairingTopic:O,transportType:o}),{uri:M??E,response:v}}),x(this,"approveSessionAuthenticate",async e=>{const{id:n,auths:r}=e,s=this.client.core.eventClient.createEvent({properties:{topic:n.toString(),trace:[Jt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(y){throw s.setError(qi.no_internet_connection),y}const o=this.getPendingAuthRequest(n);if(!o)throw s.setError(qi.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${n}`);const c=o.transportType||re.relay;c===re.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=Un(l),d={type:Pt,receiverPublicKey:l,senderPublicKey:u},p=[],_=[];for(const y of r){if(!await ga({cacao:y,projectId:this.client.core.projectId})){s.setError(qi.invalid_cacao);const I=oe("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:n,topic:h,error:I,encodeOpts:d}),new Error(I.message)}s.addTrace(Jt.cacaos_verified);const{p:T}=y,O=kn(T.resources),E=[ls(T.iss)],R=Zn(T.iss);if(O){const I=Ea(O),g=va(O);p.push(...I),E.push(...g)}for(const I of E)_.push(`${I}:${R}`)}const f=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Jt.create_authenticated_session_topic);let m;if(p?.length>0){m={topic:f,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:pe(wi),authentication:r,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:Fa([...new Set(p)],[...new Set(_)]),transportType:c},s.addTrace(Jt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:c})}catch(y){throw s.setError(qi.subscribe_authenticated_session_topic_failure),y}s.addTrace(Jt.subscribe_authenticated_session_topic_success),await this.client.session.set(f,m),s.addTrace(Jt.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(Jt.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:n,result:{cacaos:r,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(y){throw s.setError(qi.authenticated_session_approve_publish_failure),y}return await this.client.auth.requests.delete(n,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),x(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:n,reason:r}=e,s=this.getPendingAuthRequest(n);if(!s)throw new Error(`Could not find pending auth request with id ${n}`);s.transportType===re.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=Un(o),u={type:Pt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:n,topic:l,error:r,encodeOpts:u,rpcOpts:be.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(n,{message:"rejected",code:0}),await this.deleteProposal(n)}),x(this,"formatAuthMessage",e=>{this.isInitialized();const{request:n,iss:r}=e;return Zl(n,r)}),x(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),x(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const n=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(s=>{var o,c;return((o=s.peerMetadata)==null?void 0:o.url)&&((c=s.peerMetadata)==null?void 0:c.url)===e.peer.metadata.url&&s.topic&&s.topic!==n.topic});if(r.length===0)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(n){this.client.logger.error(n)}}),x(this,"deleteSession",async e=>{var n;const{topic:r,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,oe("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),s||this.client.core.expirer.del(r),this.client.core.storage.removeItem(vc).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===r&&this.deletePendingSessionRequest(u.id,oe("USER_DISCONNECTED"))}),r===((n=this.sessionRequestQueue.queue[0])==null?void 0:n.topic)&&(this.sessionRequestQueue.state=ht.idle),o&&this.client.events.emit("session_delete",{id:c,topic:r})}),x(this,"deleteProposal",async(e,n)=>{if(n)try{const r=this.client.proposal.get(e);this.client.core.eventClient.getEvent({topic:r.pairingTopic})?.setError(Mi.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,oe("USER_DISCONNECTED")),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),x(this,"deletePendingSessionRequest",async(e,n,r=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,n),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),r&&(this.sessionRequestQueue.state=ht.idle,this.client.events.emit("session_request_expire",{id:e}))}),x(this,"deletePendingAuthRequest",async(e,n,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,n),r?Promise.resolve():this.client.core.expirer.del(e)])}),x(this,"setExpiry",async(e,n)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,n),await this.client.session.update(e,{expiry:n}))}),x(this,"setProposal",async(e,n)=>{this.client.core.expirer.set(e,pe(be.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,n)}),x(this,"setAuthRequest",async(e,n)=>{const{request:r,pairingTopic:s,transportType:o=re.relay}=n;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:s,verifyContext:r.verifyContext,transportType:o})}),x(this,"setPendingSessionRequest",async e=>{const{id:n,topic:r,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||pe(be.wc_sessionRequest.req.ttl);this.client.core.expirer.set(n,c),await this.client.pendingRequest.set(n,{id:n,topic:r,params:s,verifyContext:o})}),x(this,"sendRequest",async e=>{const{topic:n,method:r,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d,publishOpts:p={}}=e,_=Ut(r,s,l);let f;const m=!!h;try{const O=m?zt:Be;f=await this.client.core.crypto.encode(n,_,{encoding:O})}catch(O){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),O}let y;if(zb.includes(r)){const O=Qe(JSON.stringify(_)),E=Qe(f);y=await this.client.core.verify.register({id:E,decryptedId:O})}const T=ee(ee({},be[r].req),p);if(T.attestation=y,o&&(T.ttl=o),c&&(T.id=c),this.client.core.history.set(n,_),m){const O=Vn(h,n,f);await globalThis.Linking.openURL(O,this.client.name)}else T.tvf=Re(ee({},d),{correlationId:_.id}),u?(T.internal=Re(ee({},T.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,f,T)):this.client.core.relayer.publish(n,f,T).catch(O=>this.client.logger.error(O));return _.id}),x(this,"sendProposeSession",async e=>{const{proposal:n,publishOpts:r}=e,s=Ut("wc_sessionPropose",n,n.id);this.client.core.history.set(n.pairingTopic,s);const o=await this.client.core.crypto.encode(n.pairingTopic,s,{encoding:Be}),c=Qe(JSON.stringify(s)),l=Qe(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:n.pairingTopic,sessionProposal:o},opts:Re(ee({},r),{publishMethod:"wc_proposeSession",attestation:u})})}),x(this,"sendApproveSession",async e=>{const{sessionTopic:n,pairingProposalResponse:r,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=jn(s.id,r),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Be}),h=Ut("wc_sessionSettle",o,c?.id),d=await this.client.core.crypto.encode(n,h,{encoding:Be});this.client.core.history.set(n,h),await this.client.core.relayer.publishCustom({payload:{sessionTopic:n,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:Re(ee({},c),{publishMethod:"wc_approveSession"})})}),x(this,"sendResult",async e=>{const{id:n,topic:r,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=jn(n,s);let h;const d=l&&typeof globalThis?.Linking<"u";try{const f=d?zt:Be;h=await this.client.core.crypto.encode(r,u,Re(ee({},c||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${r} failed`),f}let p,_;try{p=await this.client.core.history.get(r,n);const f=p.request;try{_=this.getTVFParams(n,f.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m?.message}`)}}catch(f){throw this.client.logger.error(`sendResult() -> history.get(${r}, ${n}) failed`),f}if(d){const f=Vn(l,r,h);await globalThis.Linking.openURL(f,this.client.name)}else{const f=p.request.method,m=be[f].res;m.tvf=Re(ee({},_),{correlationId:n}),o?(m.internal=Re(ee({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,h,m)):this.client.core.relayer.publish(r,h,m).catch(y=>this.client.logger.error(y))}await this.client.core.history.resolve(u)}),x(this,"sendError",async e=>{const{id:n,topic:r,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Kc(n,s);let h;const d=l&&typeof globalThis?.Linking<"u";try{const _=d?zt:Be;h=await this.client.core.crypto.encode(r,u,Re(ee({},o||{}),{encoding:_}))}catch(_){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${r} failed`),_}let p;try{p=await this.client.core.history.get(r,n)}catch(_){throw this.client.logger.error(`sendError() -> history.get(${r}, ${n}) failed`),_}if(d){const _=Vn(l,r,h);await globalThis.Linking.openURL(_,this.client.name)}else{const _=p.request.method,f=c||be[_].res;this.client.core.relayer.publish(r,h,f)}await this.client.core.history.resolve(u)}),x(this,"cleanup",async()=>{const e=[],n=[];this.client.session.getAll().forEach(r=>{let s=!1;Nt(r.expiry)&&(s=!0),this.client.core.crypto.keychain.has(r.topic)||(s=!0),s&&e.push(r.topic)}),this.client.proposal.getAll().forEach(r=>{Nt(r.expiryTimestamp)&&n.push(r.id)}),await Promise.all([...e.map(r=>this.deleteSession({topic:r})),...n.map(r=>this.deleteProposal(r))])}),x(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),x(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),x(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===ht.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=ht.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(n){this.client.logger.warn(n)}}this.requestQueue.state=ht.idle}),x(this,"processRequest",async e=>{const{topic:n,payload:r,attestation:s,transportType:o,encryptedId:c}=e,l=r.method;if(!this.shouldIgnorePairingRequest({topic:n,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:n,payload:r,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(n,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(n,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(n,r);case"wc_sessionPing":return await this.onSessionPingRequest(n,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(n,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:n,payload:r,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(n,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:n,payload:r,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),x(this,"onRelayEventResponse",async e=>{const{topic:n,payload:r,transportType:s}=e,o=(await this.client.core.history.get(n,r.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(n,r,s);case"wc_sessionSettle":return this.onSessionSettleResponse(n,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(n,r);case"wc_sessionExtend":return this.onSessionExtendResponse(n,r);case"wc_sessionPing":return this.onSessionPingResponse(n,r);case"wc_sessionRequest":return this.onSessionRequestResponse(n,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(n,r);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),x(this,"onRelayEventUnknownPayload",e=>{const{topic:n}=e,{message:r}=N("MISSING_OR_INVALID",`Decoded payload on topic ${n} is not identifiable as a JSON-RPC request or a response.`);throw new Error(r)}),x(this,"shouldIgnorePairingRequest",e=>{const{topic:n,requestMethod:r}=e,s=this.expectedPairingMethodMap.get(n);return!s||s.includes(r)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),x(this,"onSessionProposeRequest",async e=>{const{topic:n,payload:r,attestation:s,encryptedId:o}=e,{params:c,id:l}=r;try{const u=this.client.core.eventClient.getEvent({topic:n});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u?.setError(It.proposal_listener_not_found)),this.isValidConnect(ee({},r.params));const h=c.expiryTimestamp||pe(be.wc_sessionPropose.req.ttl),d=ee({id:l,pairingTopic:n,expiryTimestamp:h,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const p=await this.getVerifyContext({attestationId:s,hash:Qe(JSON.stringify(r)),encryptedId:o,metadata:d.proposer.metadata});u?.addTrace(dt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:p})}catch(u){await this.sendError({id:l,topic:n,error:u,rpcOpts:be.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),x(this,"onSessionProposeResponse",async(e,n,r)=>{const{id:s}=n;if(vt(n)){const{result:o}=n;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const c=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:c});const l=c.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const h=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:h,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(h,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(pt(n)){await this.deleteProposal(s);const o=X("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:n.error})}}),x(this,"onSessionSettleRequest",async(e,n)=>{const{id:r,params:s}=n;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:p}=n.params,_=[...this.pendingSessions.values()].find(y=>y.sessionTopic===e);if(!_)return this.client.logger.error(`Pending session not found for topic ${e}`);const f=this.client.proposal.get(_.proposalId),m=Re(ee(ee(ee({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:_.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:c.publicKey,self:{publicKey:_.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},h&&{sessionProperties:h}),d&&{scopedProperties:d}),p&&{sessionConfig:p}),{transportType:re.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:_.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(X("session_connect",_.proposalId),{session:m}),this.pendingSessions.delete(_.proposalId),this.deleteProposal(_.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:n.id,topic:e,result:!0})}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionSettleResponse",async(e,n)=>{const{id:r}=n;vt(n)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(X("session_approve",r),{})):pt(n)&&(await this.client.session.delete(e,oe("USER_DISCONNECTED")),this.events.emit(X("session_approve",r),{error:n.error}))}),x(this,"onSessionUpdateRequest",async(e,n)=>{const{params:r,id:s}=n;try{const o=`${e}_session_update`,c=Ni.get(o);if(c&&this.isRequestOutOfSync(c,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:oe("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(ee({topic:e},r));try{Ni.set(o,s),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Ni.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:r})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"isRequestOutOfSync",(e,n)=>n.toString().slice(0,-3)<e.toString().slice(0,-3)),x(this,"onSessionUpdateResponse",(e,n)=>{const{id:r}=n,s=X("session_update",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(X("session_update",r),{}):pt(n)&&this.events.emit(X("session_update",r),{error:n.error})}),x(this,"onSessionExtendRequest",async(e,n)=>{const{id:r}=n;try{this.isValidExtend({topic:e}),await this.setExpiry(e,pe(wi)),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(s){await this.sendError({id:r,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionExtendResponse",(e,n)=>{const{id:r}=n,s=X("session_extend",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(X("session_extend",r),{}):pt(n)&&this.events.emit(X("session_extend",r),{error:n.error})}),x(this,"onSessionPingRequest",async(e,n)=>{const{id:r}=n;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(s){await this.sendError({id:r,topic:e,error:s}),this.client.logger.error(s)}}),x(this,"onSessionPingResponse",(e,n)=>{const{id:r}=n,s=X("session_ping",r);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);vt(n)?this.events.emit(X("session_ping",r),{}):pt(n)&&this.events.emit(X("session_ping",r),{error:n.error})},500)}),x(this,"onSessionDeleteRequest",async(e,n)=>{const{id:r}=n;try{this.isValidDisconnect({topic:e,reason:n.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(ce.publish,async()=>{s(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:oe("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),x(this,"onSessionRequest",async e=>{var n,r,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:h}=e,{id:d,params:p}=c;try{await this.isValidRequest(ee({topic:o},p));const _=this.client.session.get(o),f=await this.getVerifyContext({attestationId:l,hash:Qe(JSON.stringify(Ut("wc_sessionRequest",p,d))),encryptedId:u,metadata:_.peer.metadata,transportType:h}),m={id:d,topic:o,params:p,verifyContext:f};await this.setPendingSessionRequest(m),h===re.link_mode&&(n=_.peer.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp((r=_.peer.metadata.redirect)==null?void 0:r.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(_){await this.sendError({id:d,topic:o,error:_}),this.client.logger.error(_)}}),x(this,"onSessionRequestResponse",(e,n)=>{const{id:r}=n,s=X("session_request",r);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(n)?this.events.emit(X("session_request",r),{result:n.result}):pt(n)&&this.events.emit(X("session_request",r),{error:n.error})}),x(this,"onSessionEventRequest",async(e,n)=>{const{id:r,params:s}=n;try{const o=`${e}_session_event_${s.event.name}`,c=Ni.get(o);if(c&&this.isRequestOutOfSync(c,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(ee({topic:e},s)),this.client.events.emit("session_event",{id:r,topic:e,params:s}),Ni.set(o,r)}catch(o){await this.sendError({id:r,topic:e,error:o}),this.client.logger.error(o)}}),x(this,"onSessionAuthenticateResponse",(e,n)=>{const{id:r}=n;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:n}),vt(n)?this.events.emit(X("session_request",r),{result:n.result}):pt(n)&&this.events.emit(X("session_request",r),{error:n.error})}),x(this,"onSessionAuthenticateRequest",async e=>{var n;const{topic:r,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:h,expiryTimestamp:d}=s.params,p=await this.getVerifyContext({attestationId:o,hash:Qe(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),_={requester:u,pairingTopic:r,id:s.id,authPayload:h,verifyContext:p,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:_,pairingTopic:r,transportType:l}),l===re.link_mode&&(n=u.metadata.redirect)!=null&&n.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:s.params,id:s.id,verifyContext:p})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),p=this.getAppLinkIfEnabled(s.params.requester.metadata,l),_={type:Pt,receiverPublicKey:h,senderPublicKey:d};await this.sendError({id:s.id,topic:r,error:u,encodeOpts:_,rpcOpts:be.wc_sessionAuthenticate.autoReject,appLink:p})}}),x(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),x(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ht.idle,this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay))}),x(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:n})=>{const r=this.client.core.history.pending;r.length>0&&r.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=X("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(X("session_request",s.request.id),{error:n})})}),x(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===ht.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(n){this.client.logger.error(n)}}),x(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=ht.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),x(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const n=this.client.proposal.getAll().find(r=>r.pairingTopic===e.topic);n&&this.onSessionProposeRequest({topic:e.topic,payload:Ut("wc_sessionPropose",Re(ee({},n),{requiredNamespaces:n.requiredNamespaces,optionalNamespaces:n.optionalNamespaces,relays:n.relays,proposer:n.proposer,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties}),n.id),attestation:n.attestation,encryptedId:n.encryptedId})}),x(this,"isValidConnect",async e=>{if(!ke(e)){const{message:u}=N("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:n,requiredNamespaces:r,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(_e(n)||await this.isValidPairingTopic(n),!Rg(l)){const{message:u}=N("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!_e(r)&&hn(r)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(r,"requiredNamespaces")}if(!_e(s)&&hn(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),_e(o)||this.validateSessionProps(o,"sessionProperties"),!_e(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(r||{}).concat(Object.keys(s||{}));if(!Object.keys(c).every(h=>u.includes(h.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(c)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),x(this,"validateNamespaces",(e,n)=>{const r=Og(e,"connect()",n);if(r)throw new Error(r.message)}),x(this,"isValidApprove",async e=>{if(!ke(e))throw new Error(N("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:n,namespaces:r,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(n),await this.isValidProposalId(n);const l=this.client.proposal.get(n),u=$r(r,"approve()");if(u)throw new Error(u.message);const h=Ga(l.requiredNamespaces,r,"approve()");if(h)throw new Error(h.message);if(!he(s,!0)){const{message:d}=N("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(_e(o)||this.validateSessionProps(o,"sessionProperties"),!_e(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(r));if(!Object.keys(c).every(p=>d.has(p.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),x(this,"isValidReject",async e=>{if(!ke(e)){const{message:s}=N("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:n,reason:r}=e;if(this.checkRecentlyDeleted(n),await this.isValidProposalId(n),!Dg(r)){const{message:s}=N("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw new Error(s)}}),x(this,"isValidSessionSettleRequest",e=>{if(!ke(e)){const{message:u}=N("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:n,controller:r,namespaces:s,expiry:o}=e;if(!Lu(n)){const{message:u}=N("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=vg(r,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=$r(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Nt(o)){const{message:u}=N("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),x(this,"isValidUpdate",async e=>{if(!ke(e)){const{message:l}=N("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:n,namespaces:r}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const s=this.client.session.get(n),o=$r(r,"update()");if(o)throw new Error(o.message);const c=Ga(s.requiredNamespaces,r,"update()");if(c)throw new Error(c.message)}),x(this,"isValidExtend",async e=>{if(!ke(e)){const{message:r}=N("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(r)}const{topic:n}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n)}),x(this,"isValidRequest",async e=>{if(!ke(e)){const{message:l}=N("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:n,request:r,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(n),await this.isValidSessionTopic(n);const{namespaces:c}=this.client.session.get(n);if(!Ha(c,s)){const{message:l}=N("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Vg(r)){const{message:l}=N("MISSING_OR_INVALID",`request() ${JSON.stringify(r)}`);throw new Error(l)}if(!Cg(c,s,r.method)){const{message:l}=N("MISSING_OR_INVALID",`request() method: ${r.method}`);throw new Error(l)}if(o&&!Ng(o,qr)){const{message:l}=N("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${qr.min} and ${qr.max}`);throw new Error(l)}}),x(this,"isValidRespond",async e=>{var n;if(!ke(e)){const{message:o}=N("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:r,response:s}=e;try{await this.isValidSessionTopic(r)}catch(o){throw(n=e?.response)!=null&&n.id&&this.cleanupAfterResponse(e),o}if(!Sg(s)){const{message:o}=N("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),x(this,"isValidPing",async e=>{if(!ke(e)){const{message:r}=N("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(r)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidEmit",async e=>{if(!ke(e)){const{message:c}=N("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:n,event:r,chainId:s}=e;await this.isValidSessionTopic(n);const{namespaces:o}=this.client.session.get(n);if(!Ha(o,s)){const{message:c}=N("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!xg(r)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(c)}if(!$g(o,s,r.name)){const{message:c}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(r)}`);throw new Error(c)}}),x(this,"isValidDisconnect",async e=>{if(!ke(e)){const{message:r}=N("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(r)}const{topic:n}=e;await this.isValidSessionOrPairingTopic(n)}),x(this,"isValidAuthenticate",e=>{const{chains:n,uri:r,domain:s,nonce:o}=e;if(!Array.isArray(n)||n.length===0)throw new Error("chains is required and must be a non-empty array");if(!he(r,!1))throw new Error("uri is required parameter");if(!he(s,!1))throw new Error("domain is required parameter");if(!he(o,!1))throw new Error("nonce is required parameter");if([...new Set(n.map(l=>$n(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=$n(n[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),x(this,"getVerifyContext",async e=>{const{attestationId:n,hash:r,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||en,validation:"UNKNOWN",origin:o.url||""}};try{if(c===re.link_mode){const h=this.getAppLinkIfEnabled(o,c);return l.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:n,hash:r,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),x(this,"validateSessionProps",(e,n)=>{Object.values(e).forEach((r,s)=>{if(r==null){const{message:o}=N("MISSING_OR_INVALID",`${n} must contain an existing value for each key. Received: ${r} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),x(this,"getPendingAuthRequest",e=>{const n=this.client.auth.requests.get(e);return typeof n=="object"?n:void 0}),x(this,"addToRecentlyDeleted",(e,n)=>{if(this.recentlyDeletedMap.set(e,n),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let r=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(r++>=s)break;this.recentlyDeletedMap.delete(o)}}}),x(this,"checkRecentlyDeleted",e=>{const n=this.recentlyDeletedMap.get(e);if(n){const{message:r}=N("MISSING_OR_INVALID",`Record was recently deleted - ${n}: ${e}`);throw new Error(r)}}),x(this,"isLinkModeEnabled",(e,n)=>{var r,s,o,c,l,u,h,d,p;return!e||n!==re.link_mode?!1:((s=(r=this.client.metadata)==null?void 0:r.redirect)==null?void 0:s.linkMode)===!0&&((c=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:c.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((h=e?.redirect)==null?void 0:h.universal)!==void 0&&((d=e?.redirect)==null?void 0:d.universal)!==""&&((p=e?.redirect)==null?void 0:p.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof globalThis?.Linking<"u"}),x(this,"getAppLinkIfEnabled",(e,n)=>{var r;return this.isLinkModeEnabled(e,n)?(r=e?.redirect)==null?void 0:r.universal:void 0}),x(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const n=aa(e,"topic")||"",r=decodeURIComponent(aa(e,"wc_ev")||""),s=this.client.session.keys.includes(n);s&&this.client.session.update(n,{transportType:re.link_mode}),this.client.core.dispatchEnvelope({topic:n,message:r,sessionExists:s})}),x(this,"registerLinkModeListeners",async()=>{var e;if(ro()||Wt()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const n=globalThis?.Linking;if(typeof n<"u"){n.addEventListener("url",this.handleLinkModeMessage,this.client.name);const r=await n.getInitialURL();r&&setTimeout(()=>{this.handleLinkModeMessage({url:r})},50)}}}),x(this,"getTVFParams",(e,n,r)=>{var s,o,c;if(!((s=n.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[n.request.method],chainId:n.chainId};try{const u=this.extractTxHashesFromResult(n.request,r);l.txHashes=u,l.contractAddresses=this.isValidContractData(n.request.params)?[(c=(o=n.request.params)==null?void 0:o[0])==null?void 0:c.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),x(this,"isValidContractData",e=>{var n;if(!e)return!1;try{const r=e?.data||((n=e?.[0])==null?void 0:n.data);if(!r.startsWith("0x"))return!1;const s=r.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),x(this,"extractTxHashesFromResult",(e,n)=>{var r;try{if(!n)return[];const s=e.method,o=Mb[s];if(s==="sui_signTransaction")return[oy(n.transactionBytes)];if(s==="near_signTransaction")return[fa(n)];if(s==="near_signTransactions")return n.map(l=>fa(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(r=n.tx_json)==null?void 0:r.hash];if(s==="polkadot_signTransaction")return[Xg({transaction:e.params.transactionPayload,signature:n.signature})];if(s==="algo_signTxn")return Ii(n)?n.map(l=>ma(l)):[ma(n)];if(s==="cosmos_signDirect")return[cy(n)];if(typeof n=="string")return[n];const c=n[o.key];if(Ii(c))return s==="solana_signAllTransactions"?c.map(l=>sy(l)):c;if(typeof c=="string")return[c]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[n,r]of Object.entries(e))for(const s of r)try{await this.onProviderMessageEvent({topic:n,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${n}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ce.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:n,attestation:r,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(Bn)?this.client.auth.authKeys.get(Bn):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,n,{receiverPublicKey:o,encoding:s===re.link_mode?zt:Be});qs(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:r,transportType:s,encryptedId:Qe(n)})):zs(c)?(await this.client.core.history.resolve(c),await this.onRelayEventResponse({topic:e,payload:c,transportType:s}),this.client.core.history.delete(e,c.id)):await this.onRelayEventUnknownPayload({topic:e,payload:c,transportType:s}),await this.client.core.relayer.messages.ack(e,n)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Ze.expired,async t=>{const{topic:e,id:n}=kl(t.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,N("EXPIRED"),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,N("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):n&&(await this.deleteProposal(n,!0),this.client.events.emit("proposal_expire",{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Zt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Zt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!he(t,!1)){const{message:e}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Nt(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=N("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!he(t,!1)){const{message:e}=N("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Nt(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=N("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=N("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(he(t,!1)){const{message:e}=N("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=N("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!Lg(t)){const{message:e}=N("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Nt(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=N("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class eI extends di{constructor(t,e){super(t,e,Ub,Eo),this.core=t,this.logger=e}}class tI extends di{constructor(t,e){super(t,e,Nb,Eo),this.core=t,this.logger=e}}class iI extends di{constructor(t,e){super(t,e,qb,Eo,n=>n.id),this.core=t,this.logger=e}}class nI extends di{constructor(t,e){super(t,e,Fb,fr,()=>Bn),this.core=t,this.logger=e}}class rI extends di{constructor(t,e){super(t,e,Wb,fr),this.core=t,this.logger=e}}class sI extends di{constructor(t,e){super(t,e,Hb,fr,n=>n.id),this.core=t,this.logger=e}}var oI=Object.defineProperty,aI=(i,t,e)=>t in i?oI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,zr=(i,t,e)=>aI(i,typeof t!="symbol"?t+"":t,e);class cI{constructor(t,e){this.core=t,this.logger=e,zr(this,"authKeys"),zr(this,"pairingTopics"),zr(this,"requests"),this.authKeys=new nI(this.core,this.logger),this.pairingTopics=new rI(this.core,this.logger),this.requests=new sI(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var lI=Object.defineProperty,uI=(i,t,e)=>t in i?lI(i,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):i[t]=e,J=(i,t,e)=>uI(i,typeof t!="symbol"?t+"":t,e);class vo extends d_{constructor(t){super(t),J(this,"protocol",Wu),J(this,"version",Hu),J(this,"name",Mr.name),J(this,"metadata"),J(this,"core"),J(this,"logger"),J(this,"events",new li.EventEmitter),J(this,"engine"),J(this,"session"),J(this,"proposal"),J(this,"pendingRequest"),J(this,"auth"),J(this,"signConfig"),J(this,"on",(n,r)=>this.events.on(n,r)),J(this,"once",(n,r)=>this.events.once(n,r)),J(this,"off",(n,r)=>this.events.off(n,r)),J(this,"removeListener",(n,r)=>this.events.removeListener(n,r)),J(this,"removeAllListeners",n=>this.events.removeAllListeners(n)),J(this,"connect",async n=>{try{return await this.engine.connect(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"pair",async n=>{try{return await this.engine.pair(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"approve",async n=>{try{return await this.engine.approve(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"reject",async n=>{try{return await this.engine.reject(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"update",async n=>{try{return await this.engine.update(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"extend",async n=>{try{return await this.engine.extend(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"request",async n=>{try{return await this.engine.request(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"respond",async n=>{try{return await this.engine.respond(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"ping",async n=>{try{return await this.engine.ping(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"emit",async n=>{try{return await this.engine.emit(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"disconnect",async n=>{try{return await this.engine.disconnect(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"find",n=>{try{return this.engine.find(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(n){throw this.logger.error(n.message),n}}),J(this,"authenticate",async(n,r)=>{try{return await this.engine.authenticate(n,r)}catch(s){throw this.logger.error(s.message),s}}),J(this,"formatAuthMessage",n=>{try{return this.engine.formatAuthMessage(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"approveSessionAuthenticate",async n=>{try{return await this.engine.approveSessionAuthenticate(n)}catch(r){throw this.logger.error(r.message),r}}),J(this,"rejectSessionAuthenticate",async n=>{try{return await this.engine.rejectSessionAuthenticate(n)}catch(r){throw this.logger.error(r.message),r}}),this.name=t?.name||Mr.name,this.metadata=Zf(t?.metadata),this.signConfig=t?.signConfig;const e=typeof t?.logger<"u"&&typeof t?.logger!="string"?t.logger:or(Xs({level:t?.logger||Mr.logger}));this.core=t?.core||new kb(t),this.logger=xe(e,this.name),this.session=new tI(this.core,this.logger),this.proposal=new eI(this.core,this.logger),this.pendingRequest=new iI(this.core,this.logger),this.engine=new Xb(this),this.auth=new cI(this.core,this.logger)}static async init(t){const e=new vo(t);return await e.initialize(),e}get context(){return je(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const hI=vo,dI="08c4b07e3ad25f1a27c14a4e8cecb6f0",KT="eip155";async function pI(i){const{account:t,chainId:e,params:[n]}=i;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:n})).transactionHash}function mr(i,t){if(Ro(i.address)!==Ro(t))throw new Error(`Failed to validate account address (${i.address}), differs from ${t}`)}function FT(i){const t=i.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${i}, should have the format 'eip155:1'`);return e}async function _I(i){const{account:t,chainId:e,thirdwebClient:n,params:[r]}=i;r.from!==void 0&&mr(t,r.from);const s=Jr({chain:we(e),client:n,data:r.data,gas:r.gas?De(r.gas):void 0,gasPrice:r.gasPrice?De(r.gasPrice):void 0,to:r.to,value:r.value?De(r.value):void 0});return(await Uc({account:t,transaction:s})).transactionHash}async function Tc(i){const{account:t,params:e}=i;return mr(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function fI(i){const{account:t,params:[e]}=i;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&mr(t,e.from),t.signTransaction({data:e.data,gas:e.gas?De(e.gas):void 0,gasPrice:e.gasPrice?De(e.gasPrice):void 0,nonce:e.nonce?ri(e.nonce):void 0,to:e.to,value:e.value?De(e.value):void 0})}async function Ac(i){const{account:t,params:e}=i;return mr(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Ju(i){const{wallet:t,params:e}=i;return t.getChain()?.id===ri(e[0].chainId)||await t.switchChain(Mh(ri(e[0].chainId))),"0x1"}const WT=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Ju},Symbol.toStringTag,{value:"Module"})),HT="/sdk/2022-08-12/embedded-wallet",jr=i=>`thirdwebEwsWalletUserId-${i}`,mI="walletToken",Kr=i=>`${mI}-${i}`,Pc=i=>`passkey-credential-id-${i}`,yI="a",Fr=(i,t)=>`${yI}-${i}-${t}`,Oc=i=>`walletConnectSessions-${i}`,Rc=i=>`thirdweb_guest_session_id_${i}`,Lc=new Map;class bo{constructor({storage:t,clientId:e,ecosystem:n}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=wI(e,n?.id),this.ecosystem=n}async getItem(t){return this.storage?this.storage.getItem(t):Lc.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Lc.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(Oc(this.key))}async saveWalletConnectSessions(t){await this.setItem(Oc(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Pc(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Pc(this.key))}async saveAuthCookie(t){await this.setItem(Kr(this.key),t)}async getAuthCookie(){return this.getItem(Kr(this.key))}async removeAuthCookie(){return this.removeItem(Kr(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Fr(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Fr(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Fr(this.key,t)):!1}async getWalletUserId(){return this.getItem(jr(this.key))}async saveWalletUserId(t){await this.setItem(jr(this.key),t)}async removeWalletUserId(){return this.removeItem(jr(this.key))}async getGuestSessionId(){return this.getItem(Rc(this.key))}async saveGuestSessionId(t){await this.setItem(Rc(this.key),t)}}const wI=(i,t)=>`${i}${t?`-${t}`:""}`;let mt;async function Yu(){if(!mt)return[];const i=await mt.getWalletConnectSessions();return JSON.parse(i??"[]")}function gI(i){mt||(mt=new bo({clientId:i.clientId,storage:null}))}async function GT(i){if(!mt)return;const t=await mt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(i),await mt.saveWalletConnectSessions(ye(e))}async function EI(i){if(!mt)return;const t=await mt.getWalletConnectSessions(),n=JSON.parse(t??"[]").filter(r=>r.topic!==i.topic);await mt.saveWalletConnectSessions(ye(n))}let Wr=new WeakMap;const vI={eth_sendRawTransaction:pI,eth_sendTransaction:_I,eth_sign:Tc,eth_signTransaction:fI,eth_signTypedData:Ac,eth_signTypedData_v4:Ac,personal_sign:Tc,wallet_addEthereumChain:i=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Ju};async function bI(i){const{wallet:t,requestHandlers:e,onConnect:n,onDisconnect:r,client:s}=i,o=i.chains&&i.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),i.chains.slice(0,10)):i.chains;if(Wr.has(s))return Wr.get(s);gI({clientId:i.client.clientId});const c=Fn(),l=await hI.init({metadata:{description:i.appMetadata?.description??c.description,icons:[i.appMetadata?.logoUrl??c.logoUrl],name:i.appMetadata?.name??c.name,url:i.appMetadata?.url??c.url},projectId:i.projectId??dI});l.on("session_proposal",async h=>{const{onSessionProposal:d}=await a(async()=>{const{onSessionProposal:p}=await import("./session-proposal-xJguSOgr.js");return{onSessionProposal:p}},__vite__mapDeps([34,1,2,3,4,5,6,7,8,9,10,11,12]));await d({chains:o,event:h,onConnect:n,wallet:t,walletConnectClient:l}).catch(p=>{if(i.onError)i.onError(p);else throw p})}),l.on("session_request",async h=>{const{fulfillRequest:d}=await a(async()=>{const{fulfillRequest:p}=await import("./session-request-BhD4eDPG.js");return{fulfillRequest:p}},__vite__mapDeps([35,3,4,1,2,5,6,7,8,9,10,11,12]));await d({event:h,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(p=>{if(i.onError)i.onError(p);else throw p})}),l.on("session_event",async h=>{}),l.on("session_ping",h=>{}),l.on("session_delete",async h=>{await Zu({session:{topic:h.topic},walletConnectClient:l}).catch(d=>{if(i.onError)i.onError(d);else throw d})});const u=l.disconnect;return l.disconnect=async h=>{const d=await u(h).catch(()=>{});return r&&AI({onDisconnect:r,topic:h.topic}),d},Wr.set(i.client,l),l}function II(i){const{uri:t,walletConnectClient:e}=i;e.core.pairing.pair({uri:t})}async function TI(){return Yu()}async function Zu(i){EI(i.session);try{await i.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:i.session.topic})}catch{}}async function AI(i){const{topic:t,onDisconnect:e}=i,n=await Yu();e(n.find(r=>r.topic===t)??{topic:t})}function PI(i){return[ot("inApp",{executionMode:i?.executionMode}),ot(Hc),ot(_t,{appMetadata:i?.appMetadata,chains:i?.chains}),ot(Pd),ot("io.rabby"),ot(Od),ot("com.okex.wallet")]}function OI(i,t){const e=new Set;let n=i();const r=()=>{for(const o of e)o()},s=o=>{n=o,r()};for(const o of t)o.subscribe(()=>{s(i())});return{getValue(){return n},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Sn(i,t,e=!0){e&&i();const n=t.map(r=>r.subscribe(()=>{i()}));return()=>{for(const r of n)r()}}const dn="tw:connected-wallet-params";async function JT(i,t,e){if(!LI(e))throw new Error("given params are not stringifiable");const n=await i.getItem(dn);let r;if(n){try{r=JSON.parse(n)}catch{r={}}r[t]=e}else r={[t]:e};i.setItem(dn,ye(r))}async function RI(i,t){const e=await i.getItem(dn);let n;if(e){try{n=JSON.parse(e)}catch{n={}}delete n[t],i.setItem(dn,ye(n))}}async function YT(i,t){const e=await i.getItem(dn);if(!e)return null;try{const n=JSON.parse(e);return n?.[t]?n[t]:null}catch{return null}}function LI(i){try{return ye(i),!0}catch{return!1}}function DI(i){let t;return()=>(t||(t=i()),t)}function VI(i={}){return Mc({filters:i,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function SI(i={}){return Mc({filters:i,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function xI(i){const{receipt:t}=i,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...i,actualGasCost:BigInt(i.actualGasCost),actualGasUsed:BigInt(i.actualGasUsed),nonce:BigInt(i.nonce),receipt:e,userOpHash:i.userOpHash}}const ZT=()=>{const i=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),n=BigInt(Math.floor(Math.random()*4294967296)),r=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return i<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|n<<BigInt(64)|r<<BigInt(32)|s};function Qu(i){return Object.fromEntries(Object.entries(i).map(([t,e])=>[t,e==null||qn(e)?e:Bs(e)]))}async function QT(i){return Ht({...i,operation:"eth_sendUserOperation",params:[Qu(i.userOp),i.options.entrypointAddress??sr]})}async function XT(i,t){const e=await Ht({...i,operation:"eth_estimateUserOperationGas",params:[Qu(i.userOp),i.options.entrypointAddress??sr,t??{}]});return{callGasLimit:De(e.callGasLimit)+gd,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?De(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?De(e.paymasterVerificationGasLimit):void 0,preVerificationGas:De(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?De(e.verificationGas):void 0,verificationGasLimit:De(e.verificationGasLimit)}}async function eA(i){const t=await Ht({...i,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:De(t.maxFeePerGas),maxPriorityFeePerGas:De(t.maxPriorityFeePerGas)}}async function tA(i){const t=await CI(i);if(t){if(t.success===!1){const n=Rh({events:[VI(),SI()],logs:t.logs})[0]?.args?.revertReason;if(!n)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const r=Lh({data:n});throw new Error(`UserOp failed with reason: '${r.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function CI(i){const t=await Ht({operation:"eth_getUserOperationReceipt",options:i,params:[i.userOpHash]});if(t)return xI(t)}async function iA(i){const t=await Ht({operation:"zk_paymasterData",options:i.options,params:[i.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function $I(i){const t=await Ht({...i,operation:"tw_execute",params:[i.eoaAddress,i.wrappedCalls,i.signature,i.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${ye(t)}`);return{transactionId:t.queueId}}async function kI(i){return{transactionHash:(await Ht({...i,operation:"tw_getTransactionHash",params:[i.transactionId]})).transactionHash}}async function nA(i){return{transactionHash:(await Ht({operation:"zk_broadcastTransaction",options:i.options,params:[{...i.transaction,signedTransaction:i.signedTransaction}]})).transactionHash}}async function Ht(i){const{options:t,operation:e,params:n}=i,r=t.bundlerUrl??Fc(t.chain),o=await pn(t.client)(r,{useAuthToken:!0,body:ye({id:1,jsonrpc:"2.0",method:e,params:n}),headers:{"Content-Type":"application/json"},method:"POST"}),c=await o.json();if(!o.ok||c.error){let l=c.error||o.statusText;typeof l=="object"&&(l=ye(l));const u=c.code||"UNKNOWN";throw new Error(`${e} error: ${l}
14
14
  Status: ${o.status}
15
- Code: ${u}`)}return c.result}function Ss(i){if(!i)return!1;if(i.id==="smart")return!0;if(i.id==="inApp"||Pi(i)){const t=i.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t?.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Xu="thirdweb:connected-wallet-ids",Mn="thirdweb:active-wallet-id",xs="thirdweb:active-chain",Dc="thirdweb:last-used-wallet-id";function UI(i){const t=Gt(void 0),e=Gt(void 0),n=Gt(void 0),r=Gt("unknown"),s=Gt(new Map);Sn(()=>{qh([...s.getValue().values()])},[s]),Sn(()=>{const E=n.getValue();if(!E)return;const R=s.getValue().get(E.id);!R||R===E||n.setValue(R)},[s,n]);const o=Gt(new Map),c=Gt(!1),l=OI(()=>Array.from(o.getValue().values()),[o]),u=E=>{const R=o.getValue();if(R.has(E.id))return;const I=new Map(R);I.set(E.id,E),o.setValue(I)},h=E=>{const R=o.getValue(),I=new Map(R);I.delete(E.id),o.setValue(I)},d=E=>{RI(i,E.id),h(E),t.getValue()===E&&(i.removeItem(Mn),e.setValue(void 0),n.setValue(void 0),t.setValue(void 0),r.setValue("disconnected"))},p=E=>{d(E),E.disconnect()},_=async(E,R)=>{if(!E.getAccount())throw new Error("Cannot set a wallet without an account as active");const g=await(async()=>R?.accountAbstraction&&!Ss(E)?await NI(E,R.client,R.accountAbstraction,d):E)();return await i.setItem(Mn,E.id),await i.setItem(Dc,E.id),u(E),R?.setWalletAsActive!==!1&&m(g),E.subscribe("accountChanged",async()=>{const L=await _(E,R);R?.onConnect?.(L,l.getValue())}),g},f=async(E,R)=>{const I=await _(E,R);return R?.onConnect?.(I,l.getValue()),I},m=E=>{const R=E.getAccount();if(!R)throw new Error("Cannot set a wallet without an account as active");u(E),t.setValue(E),e.setValue(R),n.setValue(E.getChain()),r.setValue("connected");const I=v=>{e.setValue(v)},g=E.subscribe("accountChanged",I),L=E.subscribe("chainChanged",v=>n.setValue(v)),D=E.subscribe("disconnect",()=>{w()}),w=()=>{d(E),g(),L(),D()}},y=async E=>{m(E),E.id!=="smart"&&(await i.setItem(Mn,E.id),await i.setItem(Dc,E.id))};Sn(()=>{const E=n.getValue();E?i.setItem(xs,ye(E)):i.removeItem(xs)},[n],!1),Sn(async()=>{const R=l.getValue().map(I=>I?.id).filter(I=>!!I);i.setItem(Xu,ye(Array.from(new Set([...R]))))},[l],!1);const T=async E=>{const R=t.getValue();if(!R)throw new Error("No active wallet found");if(!R.switchChain)throw new Error("Wallet does not support switching chains");if(Ss(R)){const I=await Io(i);if(I){const g=l.getValue().find(L=>L.id===I);if(g){await g.switchChain(E),await R.switchChain(E),m(R);return}}await R.switchChain(E),m(R)}else await R.switchChain(E);n.setValue(R.getChain())};function O(E){const R=s.getValue();if(E.every(L=>{const D=R.get(L.id);return ye(D)===ye(L)}))return;const g=new Map(R);for(const L of E)g.set(L.id,L);s.setValue(g)}return{activeAccountStore:e,activeWalletChainStore:n,activeWalletConnectionStatusStore:r,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:O,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:h,setActiveWallet:y,switchActiveWalletChain:T}}async function eh(i){try{const t=await i.getItem(Xu);return t?JSON.parse(t):[]}catch{return[]}}async function Io(i){try{const t=await i.getItem(Mn);if(t)return t}catch{}return null}async function th(i){try{const t=await i.getItem(xs);if(t)return JSON.parse(t)}catch{}return null}const NI=async(i,t,e,n)=>{const r=i.getAccount();if(!r)throw new Error("Cannot set a wallet without an account as active");const s=Js(e);await s.connect({chain:e.chain,client:t,personalAccount:r});const o=i.subscribe("disconnect",()=>{c()}),c=()=>{o(),n(s)};return s};function ih(i,t){return new Promise((e,n)=>{const r=setTimeout(()=>{n(new Error(t.message))},t.ms);i.then(s=>{clearTimeout(r),e(s)},s=>{clearTimeout(r),n(s)})})}async function BI({client:i,ecosystem:t,tokenToLink:e,storage:n}){const r=pn(i,t),s=rr("inAppWallet"),o=await n.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const c={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await r(`${s}/api/2024-05-05/account/connect`,{body:ye({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const h=await l.json();throw new Error(h.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function rA({client:i,ecosystem:t,profileToUnlink:e,allowAccountDeletion:n=!1,storage:r}){const s=pn(i,t),o=rr("inAppWallet"),c=await r.getAuthCookie();if(!c)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${c}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:ye({allowAccountDeletion:n,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const d=await u.json();throw new Error(d.message||"Failed to unlink account.")}const{linkedAccounts:h}=await u.json();return h??[]}async function sA({client:i,ecosystem:t,storage:e}){const n=pn(i,t),r=rr("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},c=await n(`${r}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!c.ok){const u=await c.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await c.json();return l??[]}const nh=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],oA=[...nh,"guest","backend","email","phone","passkey","wallet"],MI="0x3f707e6b",qI=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],zI=[];function jI(i){const t=DI(async()=>"asyncParams"in i?await i.asyncParams():i);return Dh({contract:i.contract,method:[MI,qI,zI],params:async()=>[(await t()).calls],value:async()=>(await t()).overrides?.value,accessList:async()=>(await t()).overrides?.accessList,gas:async()=>(await t()).overrides?.gas,gasPrice:async()=>(await t()).overrides?.gasPrice,maxFeePerGas:async()=>(await t()).overrides?.maxFeePerGas,maxPriorityFeePerGas:async()=>(await t()).overrides?.maxPriorityFeePerGas,nonce:async()=>(await t()).overrides?.nonce,extraGas:async()=>(await t()).overrides?.extraGas,erc20Value:async()=>(await t()).overrides?.erc20Value,authorizationList:async()=>(await t()).overrides?.authorizationList})}async function KI(i){const{client:t,chain:e,bundlerUrl:n}=i,r=n??Fc(e),s=`delegation-contract:${r}`;return zc(async()=>{const c=await pn(t)(r,{useAuthToken:!0,body:ye({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!c.ok)throw new Error(`Failed to fetch delegation contract: ${c.status} ${c.statusText}`);const l=await c.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!l.result?.delegationContract)throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:1440*60*1e3})}const FI=i=>{const{client:t,adminAccount:e,sponsorGas:n}=i,r=async o=>{const c=o[0];if(!c)throw new Error("No transactions provided");const l=we(c.chainId),u=Us({address:e.address,chain:l,client:t,abi:JI});let h=c.authorizationList?.[0];const d=await KI({client:t,chain:l});if(h&&h.address?.toLowerCase()!==d.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${d} but got ${h.address}`);if(!h&&!await HI(u,d)){let m=c.nonce?BigInt(c.nonce):BigInt(await WI({client:t,address:e.address,chain:l}));m+=n?0n:1n;const y=await e.signAuthorization?.({address:Y(d),chainId:c.chainId,nonce:m});if(!y)throw new Error("Failed to sign authorization");h=y}if(n){const f={calls:o.map(O=>({data:O.data??"0x",target:Y(O.to??""),value:O.value??0n})),uid:dd()},m=await e.signTypedData({domain:{chainId:c.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:f,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),y=await $I({authorization:h,eoaAddress:Y(e.address),options:{chain:we(c.chainId),client:t},signature:m,wrappedCalls:f});return{transactionHash:await GI({options:{chain:we(c.chainId),client:t},transactionId:y.transactionId})}}const p=jI({calls:o.map(f=>({data:f.data??"0x",target:Y(f.to??""),value:f.value??0n})),contract:u,overrides:{authorizationList:h?[h]:void 0,value:o.reduce((f,m)=>f+(m.value??0n),0n)}}),_=await Vh({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>r(o),sendTransaction:async o=>r([o]),signMessage:({message:o,originalMessage:c,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:c}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:c}=await a(async()=>{const{inAppWalletSendCalls:p}=await import("./in-app-wallet-calls-l9-2W_Em.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([36,37,21,1,2,3,4,26,38,5,6,7,8,9,10,11,12])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,h=l.chain||o.chain,d=await c({account:s,calls:o.calls,chain:h});return{chain:h,client:u,id:d}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-l9-2W_Em.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([36,37,21,1,2,3,4,26,38,5,6,7,8,9,10,11,12]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-l9-2W_Em.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([36,37,21,1,2,3,4,26,38,5,6,7,8,9,10,11,12]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:n??!1}}})};return s};async function WI(i){const{client:t,address:e,chain:n}=i,r=nr({chain:n,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./eth_getTransactionCount-qv0oO1Md.js");return{eth_getTransactionCount:o}},__vite__mapDeps([39,1,2,3,4])).then(({eth_getTransactionCount:o})=>o(r,{address:Y(e),blockTag:"pending"}))}async function HI(i,t){const e=await Sh(i),n=e.length>0&&e.startsWith("0xef0100"),r=`0x${e.slice(8,48)}`;return n&&r.toLowerCase()===t.toLowerCase()}async function GI(i){const t=i.timeoutMs||3e5,e=i.intervalMs||1e3,n=Date.now()+t;for(;Date.now()<n;){const r=await kI({options:i.options,transactionId:i.transactionId});if(r.transactionHash)return r.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${i.options.chain.id} with transactionId: ${i.transactionId}`)}const JI=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function rh(i){return i.id==="inApp"||i.id==="embedded"}async function YI(i,t,e){if(t?.auth?.mode!=="popup"&&t?.auth?.mode!==void 0&&e.authenticateWithRedirect){const s=i.strategy;nh.includes(s)&&await e.authenticateWithRedirect(s,t?.auth?.mode,t?.auth?.redirectUrl)}const r=(await e.connect(i)).user.account;return sh({authAccount:r,client:i.client,createOptions:t,desiredChain:i.chain})}async function ZI(i,t,e){i.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(i.authResult);const n=await XI(e);if(!n)throw new Error("Failed to authenticate user.");const r=n.account;return sh({authAccount:r,client:i.client,createOptions:t,desiredChain:i.chain})}async function QI(i){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-BaGjqMte.js");return{connectSmartAccount:e}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12]));return t({chain:i.chain,client:i.client,personalAccount:i.authAccount},i.smartAccountOptions)}async function XI(i){const t=await i.getUser();if(t.status==="Logged In, Wallet Initialized")return t}async function sh(i){const{createOptions:t,authAccount:e,desiredChain:n,client:r}=i;let s,o;const c=t&&"executionMode"in t?t.executionMode:void 0;if(c&&(c.mode==="EIP4337"?s=c.smartAccount:c.mode==="EIP7702"&&(o=c)),t&&"smartAccount"in t&&t?.smartAccount&&(s=t.smartAccount),s){const[l,u]=await QI({authAccount:e,chain:n,client:r,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=n;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:FI({adminAccount:e,client:r,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:n||hd}}const Hr=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:ZI,connectInAppWallet:YI,isInAppWallet:rh},Symbol.toStringTag,{value:"Module"}));function eT(i){const t=n=>rh(n)||Pi(n),e=Ss(i.wallet)&&i.connectedWallets.some(n=>t(n)&&n.getAccount()?.address?.toLowerCase()===i.wallet.getAdminAccount?.()?.address?.toLowerCase());return t(i.wallet)||e}function tT(){if(typeof document>"u")return;const i=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let n=e;const r=e.indexOf("?");r!==-1&&(t=new URLSearchParams(e.substring(r)),n=e.substring(0,r));const s=i.get("walletId")??t?.get("walletId")??void 0,o=i.get("authResult")??t?.get("authResult")??void 0,c=i.get("authProvider")??t?.get("authProvider")??void 0,l=i.get("authCookie")??t?.get("authCookie")??void 0,u=i.get("authFlow")??t?.get("authFlow")??void 0;if((l||o)&&s){const h=(()=>{if(o)return i.delete("authResult"),t?.delete("authResult"),JSON.parse(decodeURIComponent(o))})();i.delete("walletId"),i.delete("authProvider"),i.delete("authCookie"),i.delete("authFlow"),t?.delete("walletId"),t?.delete("authProvider"),t?.delete("authCookie"),t?.delete("authFlow");const d=i.toString(),p=d?`?${d}`:"";let _=n;if(t){const f=t.toString();f&&(_=`${n}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:h,walletId:s}}}let Gr;const iT=async i=>{if(Gr&&!i.force&&await Gr)return!0;const t=nT(i);return Gr=t,t},nT=async({storage:i,props:t,createWalletFn:e,manager:n,connectOverride:r,setLastAuthProvider:s})=>{const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;n.isAutoConnecting.setValue(!0);let[h,d]=await Promise.all([eh(i),Io(i)]);const p=tT();if(p?.authFlow==="link"&&p.authResult)return await rT({client:t.client,connectOverride:r,createWalletFn:e,manager:n,onConnect:c,props:t,setLastAuthProvider:s,storage:i,timeout:l,urlToken:p,wallets:o});const _=o.find(I=>I.id===p?.walletId);if(p?.authCookie&&_&&await new bo({clientId:t.client.clientId,ecosystem:Pi(_)?{id:_.id,partnerId:_.getConfig()?.partnerId}:void 0,storage:i}).saveAuthCookie(p.authCookie),p?.walletId&&(d=p.walletId,h=h?.includes(p.walletId)?h:[p.walletId,...h||[]]),p?.authProvider&&await s?.(p.authProvider,i),!h)return u;const f=await th(i)||t.chain,m=h.map(I=>{const g=o.find(L=>L.id===I);return g||e(I)}),y=d&&(m.find(I=>I.id===d)||e(d));if(y){n.activeWalletConnectionStatusStore.setValue("connecting"),await ih(Cs({authResult:p?.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(I=>{console.warn(I.message),t.onTimeout&&t.onTimeout()});try{await(r?r(y):n.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(I){I instanceof Error&&console.warn("Error auto connecting wallet:",I.message),n.activeWalletConnectionStatusStore.setValue("disconnected")}}else n.activeWalletConnectionStatusStore.setValue("disconnected");const T=m.filter(I=>I.id!==d&&h.includes(I.id));for(const I of T)try{await Cs({authResult:p?.authResult,client:t.client,lastConnectedChain:f,wallet:I}),n.addConnectedWallet(I)}catch{}y&&eT({connectedWallets:y?[y,...T]:T,wallet:y})&&t.siweAuth?.requiresAuth&&!t.siweAuth?.isLoggedIn&&!t.siweAuth?.isLoggingIn&&await t.siweAuth?.doLogin().catch(I=>{console.warn("Error signing in with SIWE:",I.message)}),n.isAutoConnecting.setValue(!1);const E=n.activeWalletStore.getValue(),R=n.connectedWallets.getValue();if(E){u=!0;try{c?.(E,R)}catch(I){console.error("Error calling onConnect callback:",I)}}else n.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function rT(i){const{client:t,connectOverride:e,createWalletFn:n,manager:r,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:h,wallets:d}=i,[p,_]=await Promise.all([eh(l),Io(l)]),f=await th(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),r.isAutoConnecting.setValue(!1),!1;h.authProvider&&await c?.(h.authProvider,l);const m=d.find(R=>R.id===_)||n(_);r.activeWalletConnectionStatusStore.setValue("connecting");try{await ih(Cs({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):r.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(R){return console.warn("Failed to auto-connect for linking:",R),r.activeWalletConnectionStatusStore.setValue("disconnected"),r.isAutoConnecting.setValue(!1),!1}const y=Pi(m)?{id:m.id,partnerId:m.getConfig()?.partnerId}:void 0,T=new bo({clientId:t.clientId,ecosystem:y,storage:l});try{await BI({client:t,ecosystem:y,storage:T,tokenToLink:h.authResult.storedToken.cookieString})}catch(R){console.error("Failed to link profile after redirect:",R)}r.isAutoConnecting.setValue(!1);const O=r.activeWalletStore.getValue(),E=r.connectedWallets.getValue();if(O){try{s?.(O,E)}catch(R){console.error("Error calling onConnect callback:",R)}return!0}return!1}async function Cs(i){return i.wallet.autoConnect({authResult:i.authResult,chain:i.lastConnectedChain,client:i.client})}async function sT(i){const t=i.wallets||PI(i),e=UI(Kn);return await iT({createWalletFn:ot,manager:e,props:{...i,wallets:t},storage:Kn})}const aA=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:vI,EIP1193:Hd,authenticate:Xd,authenticateWithRedirect:ep,autoConnect:sT,createWallet:ot,createWalletAdapter:Gd,createWalletConnectClient:bI,createWalletConnectSession:II,deploySmartAccount:xh,disconnectWalletConnectSession:Zu,ecosystemWallet:ol,embeddedWallet:Zr,generateAccount:op,getActiveWalletConnectSessions:TI,getAllWalletsList:Jd,getInstalledWallets:al,getProfiles:np,getUser:Ch,getUserEmail:Yd,getUserPhoneNumber:Zd,getWalletBalance:ap,getWalletInfo:Yc,inAppWallet:Zr,injectedProvider:Ys,isBaseAccountSDKWallet:Qc,linkProfile:tp,preAuthenticate:Qd,privateKeyAccount:Xr,privateKeyToAccount:Xr,randomPrivateKey:$h,smartWallet:Js,unlinkProfile:ip,walletConnect:zd},Symbol.toStringTag,{value:"Module"}));export{XT as $,bl as A,or as B,on as C,dI as D,C_ as E,$n as F,vl as G,M_ as H,q_ as I,$T as J,oe as K,xT as L,Gn as M,KT as N,UT as O,Ou as P,kT as Q,DI as R,Fc as S,sr as T,Qu as U,hn as V,vd as W,tA as X,hg as Y,eA as Z,ZT as _,YT as a,yT as a0,wd as a1,Ed as a2,iA as a3,nA as a4,QT as a5,Ss as a6,oA as a7,bo as a8,Kn as a9,HT as aa,nh as ab,BI as ac,rA as ad,sA as ae,WT as af,aA as ag,Yc as b,Fn as c,GT as d,Zu as e,Rd as f,qd as g,Yu as h,FT as i,pI as j,_I as k,fI as l,Ac as m,ct as n,Tc as o,js as p,Xs as q,dd as r,JT as s,Ii as t,vo as u,ni as v,Nt as w,pe as x,CT as y,Zo as z};
15
+ Code: ${u}`)}return c.result}function Ss(i){if(!i)return!1;if(i.id==="smart")return!0;if(i.id==="inApp"||Pi(i)){const t=i.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t?.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Xu="thirdweb:connected-wallet-ids",Mn="thirdweb:active-wallet-id",xs="thirdweb:active-chain",Dc="thirdweb:last-used-wallet-id";function UI(i){const t=Gt(void 0),e=Gt(void 0),n=Gt(void 0),r=Gt("unknown"),s=Gt(new Map);Sn(()=>{qh([...s.getValue().values()])},[s]),Sn(()=>{const E=n.getValue();if(!E)return;const R=s.getValue().get(E.id);!R||R===E||n.setValue(R)},[s,n]);const o=Gt(new Map),c=Gt(!1),l=OI(()=>Array.from(o.getValue().values()),[o]),u=E=>{const R=o.getValue();if(R.has(E.id))return;const I=new Map(R);I.set(E.id,E),o.setValue(I)},h=E=>{const R=o.getValue(),I=new Map(R);I.delete(E.id),o.setValue(I)},d=E=>{RI(i,E.id),h(E),t.getValue()===E&&(i.removeItem(Mn),e.setValue(void 0),n.setValue(void 0),t.setValue(void 0),r.setValue("disconnected"))},p=E=>{d(E),E.disconnect()},_=async(E,R)=>{if(!E.getAccount())throw new Error("Cannot set a wallet without an account as active");const g=await(async()=>R?.accountAbstraction&&!Ss(E)?await NI(E,R.client,R.accountAbstraction,d):E)();return await i.setItem(Mn,E.id),await i.setItem(Dc,E.id),u(E),R?.setWalletAsActive!==!1&&m(g),E.subscribe("accountChanged",async()=>{const L=await _(E,R);R?.onConnect?.(L,l.getValue())}),g},f=async(E,R)=>{const I=await _(E,R);return R?.onConnect?.(I,l.getValue()),I},m=E=>{const R=E.getAccount();if(!R)throw new Error("Cannot set a wallet without an account as active");u(E),t.setValue(E),e.setValue(R),n.setValue(E.getChain()),r.setValue("connected");const I=v=>{e.setValue(v)},g=E.subscribe("accountChanged",I),L=E.subscribe("chainChanged",v=>n.setValue(v)),D=E.subscribe("disconnect",()=>{w()}),w=()=>{d(E),g(),L(),D()}},y=async E=>{m(E),E.id!=="smart"&&(await i.setItem(Mn,E.id),await i.setItem(Dc,E.id))};Sn(()=>{const E=n.getValue();E?i.setItem(xs,ye(E)):i.removeItem(xs)},[n],!1),Sn(async()=>{const R=l.getValue().map(I=>I?.id).filter(I=>!!I);i.setItem(Xu,ye(Array.from(new Set([...R]))))},[l],!1);const T=async E=>{const R=t.getValue();if(!R)throw new Error("No active wallet found");if(!R.switchChain)throw new Error("Wallet does not support switching chains");if(Ss(R)){const I=await Io(i);if(I){const g=l.getValue().find(L=>L.id===I);if(g){await g.switchChain(E),await R.switchChain(E),m(R);return}}await R.switchChain(E),m(R)}else await R.switchChain(E);n.setValue(R.getChain())};function O(E){const R=s.getValue();if(E.every(L=>{const D=R.get(L.id);return ye(D)===ye(L)}))return;const g=new Map(R);for(const L of E)g.set(L.id,L);s.setValue(g)}return{activeAccountStore:e,activeWalletChainStore:n,activeWalletConnectionStatusStore:r,activeWalletStore:t,addConnectedWallet:u,connect:f,connectedWallets:l,defineChains:O,disconnectWallet:p,handleConnection:_,isAutoConnecting:c,removeConnectedWallet:h,setActiveWallet:y,switchActiveWalletChain:T}}async function eh(i){try{const t=await i.getItem(Xu);return t?JSON.parse(t):[]}catch{return[]}}async function Io(i){try{const t=await i.getItem(Mn);if(t)return t}catch{}return null}async function th(i){try{const t=await i.getItem(xs);if(t)return JSON.parse(t)}catch{}return null}const NI=async(i,t,e,n)=>{const r=i.getAccount();if(!r)throw new Error("Cannot set a wallet without an account as active");const s=Js(e);await s.connect({chain:e.chain,client:t,personalAccount:r});const o=i.subscribe("disconnect",()=>{c()}),c=()=>{o(),n(s)};return s};function ih(i,t){return new Promise((e,n)=>{const r=setTimeout(()=>{n(new Error(t.message))},t.ms);i.then(s=>{clearTimeout(r),e(s)},s=>{clearTimeout(r),n(s)})})}async function BI({client:i,ecosystem:t,tokenToLink:e,storage:n}){const r=pn(i,t),s=rr("inAppWallet"),o=await n.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const c={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await r(`${s}/api/2024-05-05/account/connect`,{body:ye({accountAuthTokenToConnect:e}),headers:c,method:"POST"});if(!l.ok){const h=await l.json();throw new Error(h.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function rA({client:i,ecosystem:t,profileToUnlink:e,allowAccountDeletion:n=!1,storage:r}){const s=pn(i,t),o=rr("inAppWallet"),c=await r.getAuthCookie();if(!c)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${c}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:ye({allowAccountDeletion:n,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const d=await u.json();throw new Error(d.message||"Failed to unlink account.")}const{linkedAccounts:h}=await u.json();return h??[]}async function sA({client:i,ecosystem:t,storage:e}){const n=pn(i,t),r=rr("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},c=await n(`${r}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!c.ok){const u=await c.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await c.json();return l??[]}const nh=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],oA=[...nh,"guest","backend","email","phone","passkey","wallet"],MI="0x3f707e6b",qI=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],zI=[];function jI(i){const t=DI(async()=>"asyncParams"in i?await i.asyncParams():i);return Dh({contract:i.contract,method:[MI,qI,zI],params:async()=>[(await t()).calls],value:async()=>(await t()).overrides?.value,accessList:async()=>(await t()).overrides?.accessList,gas:async()=>(await t()).overrides?.gas,gasPrice:async()=>(await t()).overrides?.gasPrice,maxFeePerGas:async()=>(await t()).overrides?.maxFeePerGas,maxPriorityFeePerGas:async()=>(await t()).overrides?.maxPriorityFeePerGas,nonce:async()=>(await t()).overrides?.nonce,extraGas:async()=>(await t()).overrides?.extraGas,erc20Value:async()=>(await t()).overrides?.erc20Value,authorizationList:async()=>(await t()).overrides?.authorizationList})}async function KI(i){const{client:t,chain:e,bundlerUrl:n}=i,r=n??Fc(e),s=`delegation-contract:${r}`;return zc(async()=>{const c=await pn(t)(r,{useAuthToken:!0,body:ye({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!c.ok)throw new Error(`Failed to fetch delegation contract: ${c.status} ${c.statusText}`);const l=await c.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!l.result?.delegationContract)throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:1440*60*1e3})}const FI=i=>{const{client:t,adminAccount:e,sponsorGas:n}=i,r=async o=>{const c=o[0];if(!c)throw new Error("No transactions provided");const l=we(c.chainId),u=Us({address:e.address,chain:l,client:t,abi:JI});let h=c.authorizationList?.[0];const d=await KI({client:t,chain:l});if(h&&h.address?.toLowerCase()!==d.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${d} but got ${h.address}`);if(!h&&!await HI(u,d)){let m=c.nonce?BigInt(c.nonce):BigInt(await WI({client:t,address:e.address,chain:l}));m+=n?0n:1n;const y=await e.signAuthorization?.({address:Y(d),chainId:c.chainId,nonce:m});if(!y)throw new Error("Failed to sign authorization");h=y}if(n){const f={calls:o.map(O=>({data:O.data??"0x",target:Y(O.to??""),value:O.value??0n})),uid:dd()},m=await e.signTypedData({domain:{chainId:c.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:f,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),y=await $I({authorization:h,eoaAddress:Y(e.address),options:{chain:we(c.chainId),client:t},signature:m,wrappedCalls:f});return{transactionHash:await GI({options:{chain:we(c.chainId),client:t},transactionId:y.transactionId})}}const p=jI({calls:o.map(f=>({data:f.data??"0x",target:Y(f.to??""),value:f.value??0n})),contract:u,overrides:{authorizationList:h?[h]:void 0,value:o.reduce((f,m)=>f+(m.value??0n),0n)}}),_=await Vh({from:e.address,transaction:p});return e.sendTransaction(_)},s={address:e.address,sendBatchTransaction:async o=>r(o),sendTransaction:async o=>r([o]),signMessage:({message:o,originalMessage:c,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:c}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:c}=await a(async()=>{const{inAppWalletSendCalls:p}=await import("./in-app-wallet-calls-khLeeKNu.js");return{inAppWalletSendCalls:p}},__vite__mapDeps([36,37,21,1,2,3,4,26,38,5,6,7,8,9,10,11,12])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,h=l.chain||o.chain,d=await c({account:s,calls:o.calls,chain:h});return{chain:h,client:u,id:d}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:c}=await a(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-khLeeKNu.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([36,37,21,1,2,3,4,26,38,5,6,7,8,9,10,11,12]));return c(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:c}=await a(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-khLeeKNu.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([36,37,21,1,2,3,4,26,38,5,6,7,8,9,10,11,12]));return c(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:n??!1}}})};return s};async function WI(i){const{client:t,address:e,chain:n}=i,r=nr({chain:n,client:t});return await a(async()=>{const{eth_getTransactionCount:o}=await import("./eth_getTransactionCount-cZacEETx.js");return{eth_getTransactionCount:o}},__vite__mapDeps([39,1,2,3,4])).then(({eth_getTransactionCount:o})=>o(r,{address:Y(e),blockTag:"pending"}))}async function HI(i,t){const e=await Sh(i),n=e.length>0&&e.startsWith("0xef0100"),r=`0x${e.slice(8,48)}`;return n&&r.toLowerCase()===t.toLowerCase()}async function GI(i){const t=i.timeoutMs||3e5,e=i.intervalMs||1e3,n=Date.now()+t;for(;Date.now()<n;){const r=await kI({options:i.options,transactionId:i.transactionId});if(r.transactionHash)return r.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${i.options.chain.id} with transactionId: ${i.transactionId}`)}const JI=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function rh(i){return i.id==="inApp"||i.id==="embedded"}async function YI(i,t,e){if(t?.auth?.mode!=="popup"&&t?.auth?.mode!==void 0&&e.authenticateWithRedirect){const s=i.strategy;nh.includes(s)&&await e.authenticateWithRedirect(s,t?.auth?.mode,t?.auth?.redirectUrl)}const r=(await e.connect(i)).user.account;return sh({authAccount:r,client:i.client,createOptions:t,desiredChain:i.chain})}async function ZI(i,t,e){i.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(i.authResult);const n=await XI(e);if(!n)throw new Error("Failed to authenticate user.");const r=n.account;return sh({authAccount:r,client:i.client,createOptions:t,desiredChain:i.chain})}async function QI(i){const{connectSmartAccount:t}=await a(async()=>{const{connectSmartAccount:e}=await import("./index-B5w_jZpc.js");return{connectSmartAccount:e}},__vite__mapDeps([27,3,4,1,2,28,23,5,6,7,8,9,10,11,12]));return t({chain:i.chain,client:i.client,personalAccount:i.authAccount},i.smartAccountOptions)}async function XI(i){const t=await i.getUser();if(t.status==="Logged In, Wallet Initialized")return t}async function sh(i){const{createOptions:t,authAccount:e,desiredChain:n,client:r}=i;let s,o;const c=t&&"executionMode"in t?t.executionMode:void 0;if(c&&(c.mode==="EIP4337"?s=c.smartAccount:c.mode==="EIP7702"&&(o=c)),t&&"smartAccount"in t&&t?.smartAccount&&(s=t.smartAccount),s){const[l,u]=await QI({authAccount:e,chain:n,client:r,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=n;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:FI({adminAccount:e,client:r,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:n||hd}}const Hr=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:ZI,connectInAppWallet:YI,isInAppWallet:rh},Symbol.toStringTag,{value:"Module"}));function eT(i){const t=n=>rh(n)||Pi(n),e=Ss(i.wallet)&&i.connectedWallets.some(n=>t(n)&&n.getAccount()?.address?.toLowerCase()===i.wallet.getAdminAccount?.()?.address?.toLowerCase());return t(i.wallet)||e}function tT(){if(typeof document>"u")return;const i=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let n=e;const r=e.indexOf("?");r!==-1&&(t=new URLSearchParams(e.substring(r)),n=e.substring(0,r));const s=i.get("walletId")??t?.get("walletId")??void 0,o=i.get("authResult")??t?.get("authResult")??void 0,c=i.get("authProvider")??t?.get("authProvider")??void 0,l=i.get("authCookie")??t?.get("authCookie")??void 0,u=i.get("authFlow")??t?.get("authFlow")??void 0;if((l||o)&&s){const h=(()=>{if(o)return i.delete("authResult"),t?.delete("authResult"),JSON.parse(decodeURIComponent(o))})();i.delete("walletId"),i.delete("authProvider"),i.delete("authCookie"),i.delete("authFlow"),t?.delete("walletId"),t?.delete("authProvider"),t?.delete("authCookie"),t?.delete("authFlow");const d=i.toString(),p=d?`?${d}`:"";let _=n;if(t){const f=t.toString();f&&(_=`${n}?${f}`)}return window.history.pushState({},"",`${window.location.pathname}${p}${_}`),{authCookie:l,authFlow:u,authProvider:c,authResult:h,walletId:s}}}let Gr;const iT=async i=>{if(Gr&&!i.force&&await Gr)return!0;const t=nT(i);return Gr=t,t},nT=async({storage:i,props:t,createWalletFn:e,manager:n,connectOverride:r,setLastAuthProvider:s})=>{const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;n.isAutoConnecting.setValue(!0);let[h,d]=await Promise.all([eh(i),Io(i)]);const p=tT();if(p?.authFlow==="link"&&p.authResult)return await rT({client:t.client,connectOverride:r,createWalletFn:e,manager:n,onConnect:c,props:t,setLastAuthProvider:s,storage:i,timeout:l,urlToken:p,wallets:o});const _=o.find(I=>I.id===p?.walletId);if(p?.authCookie&&_&&await new bo({clientId:t.client.clientId,ecosystem:Pi(_)?{id:_.id,partnerId:_.getConfig()?.partnerId}:void 0,storage:i}).saveAuthCookie(p.authCookie),p?.walletId&&(d=p.walletId,h=h?.includes(p.walletId)?h:[p.walletId,...h||[]]),p?.authProvider&&await s?.(p.authProvider,i),!h)return u;const f=await th(i)||t.chain,m=h.map(I=>{const g=o.find(L=>L.id===I);return g||e(I)}),y=d&&(m.find(I=>I.id===d)||e(d));if(y){n.activeWalletConnectionStatusStore.setValue("connecting"),await ih(Cs({authResult:p?.authResult,client:t.client,lastConnectedChain:f,wallet:y}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(I=>{console.warn(I.message),t.onTimeout&&t.onTimeout()});try{await(r?r(y):n.connect(y,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(I){I instanceof Error&&console.warn("Error auto connecting wallet:",I.message),n.activeWalletConnectionStatusStore.setValue("disconnected")}}else n.activeWalletConnectionStatusStore.setValue("disconnected");const T=m.filter(I=>I.id!==d&&h.includes(I.id));for(const I of T)try{await Cs({authResult:p?.authResult,client:t.client,lastConnectedChain:f,wallet:I}),n.addConnectedWallet(I)}catch{}y&&eT({connectedWallets:y?[y,...T]:T,wallet:y})&&t.siweAuth?.requiresAuth&&!t.siweAuth?.isLoggedIn&&!t.siweAuth?.isLoggingIn&&await t.siweAuth?.doLogin().catch(I=>{console.warn("Error signing in with SIWE:",I.message)}),n.isAutoConnecting.setValue(!1);const E=n.activeWalletStore.getValue(),R=n.connectedWallets.getValue();if(E){u=!0;try{c?.(E,R)}catch(I){console.error("Error calling onConnect callback:",I)}}else n.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function rT(i){const{client:t,connectOverride:e,createWalletFn:n,manager:r,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:h,wallets:d}=i,[p,_]=await Promise.all([eh(l),Io(l)]),f=await th(l)||o.chain;if(!_||!p)return console.warn("No stored wallet found for linking flow"),r.isAutoConnecting.setValue(!1),!1;h.authProvider&&await c?.(h.authProvider,l);const m=d.find(R=>R.id===_)||n(_);r.activeWalletConnectionStatusStore.setValue("connecting");try{await ih(Cs({authResult:void 0,client:t,lastConnectedChain:f,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):r.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(R){return console.warn("Failed to auto-connect for linking:",R),r.activeWalletConnectionStatusStore.setValue("disconnected"),r.isAutoConnecting.setValue(!1),!1}const y=Pi(m)?{id:m.id,partnerId:m.getConfig()?.partnerId}:void 0,T=new bo({clientId:t.clientId,ecosystem:y,storage:l});try{await BI({client:t,ecosystem:y,storage:T,tokenToLink:h.authResult.storedToken.cookieString})}catch(R){console.error("Failed to link profile after redirect:",R)}r.isAutoConnecting.setValue(!1);const O=r.activeWalletStore.getValue(),E=r.connectedWallets.getValue();if(O){try{s?.(O,E)}catch(R){console.error("Error calling onConnect callback:",R)}return!0}return!1}async function Cs(i){return i.wallet.autoConnect({authResult:i.authResult,chain:i.lastConnectedChain,client:i.client})}async function sT(i){const t=i.wallets||PI(i),e=UI(Kn);return await iT({createWalletFn:ot,manager:e,props:{...i,wallets:t},storage:Kn})}const aA=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:vI,EIP1193:Hd,authenticate:Xd,authenticateWithRedirect:ep,autoConnect:sT,createWallet:ot,createWalletAdapter:Gd,createWalletConnectClient:bI,createWalletConnectSession:II,deploySmartAccount:xh,disconnectWalletConnectSession:Zu,ecosystemWallet:ol,embeddedWallet:Zr,generateAccount:op,getActiveWalletConnectSessions:TI,getAllWalletsList:Jd,getInstalledWallets:al,getProfiles:np,getUser:Ch,getUserEmail:Yd,getUserPhoneNumber:Zd,getWalletBalance:ap,getWalletInfo:Yc,inAppWallet:Zr,injectedProvider:Ys,isBaseAccountSDKWallet:Qc,linkProfile:tp,preAuthenticate:Qd,privateKeyAccount:Xr,privateKeyToAccount:Xr,randomPrivateKey:$h,smartWallet:Js,unlinkProfile:ip,walletConnect:zd},Symbol.toStringTag,{value:"Module"}));export{XT as $,bl as A,or as B,on as C,dI as D,C_ as E,$n as F,vl as G,M_ as H,q_ as I,$T as J,oe as K,xT as L,Gn as M,KT as N,UT as O,Ou as P,kT as Q,DI as R,Fc as S,sr as T,Qu as U,hn as V,vd as W,tA as X,hg as Y,eA as Z,ZT as _,YT as a,yT as a0,wd as a1,Ed as a2,iA as a3,nA as a4,QT as a5,Ss as a6,oA as a7,bo as a8,Kn as a9,HT as aa,nh as ab,BI as ac,rA as ad,sA as ae,WT as af,aA as ag,Yc as b,Fn as c,GT as d,Zu as e,Rd as f,qd as g,Yu as h,FT as i,pI as j,_I as k,fI as l,Ac as m,ct as n,Tc as o,js as p,Xs as q,dd as r,JT as s,Ii as t,vo as u,ni as v,Nt as w,pe as x,CT as y,Zo as z};