@dcl/auth-site 4.21.1-30282291998.commit-7741200 → 4.21.1-30289583460.commit-46bdbdf

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 (127) hide show
  1. package/assets/{ConstantsUtil-B_1wG5vR.js → ConstantsUtil-Cw4CyveW.js} +1 -1
  2. package/assets/{ContentfulRichText-CVKevVe4.js → ContentfulRichText-BT96-A7w.js} +1 -1
  3. package/assets/{ExchangeController-DCZepsks.js → ExchangeController-BIE70uXJ.js} +1 -1
  4. package/assets/{HelpersUtil-D4gwnK8D.js → HelpersUtil-COH6r2kA.js} +1 -1
  5. package/assets/{LoginPage-huBKWGlx.js → LoginPage-fSUgfU4P.js} +1 -1
  6. package/assets/{NetworkUtil-CBP75VjE.js → NetworkUtil-BGKHKoaf.js} +1 -1
  7. package/assets/{SwapController-DbOnmtjm.js → SwapController-CYoV1KaM.js} +1 -1
  8. package/assets/{W3MFrameProviderSingleton-6cmMN1JV.js → W3MFrameProviderSingleton-BKmP_oxD.js} +3 -3
  9. package/assets/{biconomy-D1EXxA7F.js → biconomy-C7o8zrOF.js} +1 -1
  10. package/assets/{browser-wIrNP8-L.js → browser-jyTXFcNa.js} +1 -1
  11. package/assets/browser-ponyfill-DoK0rGNS.js +1 -0
  12. package/assets/{ccip-bk9Msknv.js → ccip-0sHJmZED.js} +1 -1
  13. package/assets/{ccip-DVeSiGJW.js → ccip-_D3P6GZf.js} +1 -1
  14. package/assets/{chains-YJh_kwoG.js → chains-DPTnBL64.js} +1 -1
  15. package/assets/{common-DAd2b35c.js → common-CHSeSCWT.js} +1 -1
  16. package/assets/controller-C64KTqP4.js +2 -0
  17. package/assets/{data-capture-B8eCUIcE.js → data-capture-Cx4b9vYS.js} +1 -1
  18. package/assets/{email-KCXiMYF3.js → email-BQdM1ASh.js} +1 -1
  19. package/assets/{embedded-wallet-B_wovPbN.js → embedded-wallet-CXUgkaij.js} +1 -1
  20. package/assets/{engine-osc-auGv.js → engine-DN05o7om.js} +1 -1
  21. package/assets/{estimate-l1-fee-D12BfRq0.js → estimate-l1-fee--u86zfdZ.js} +1 -1
  22. package/assets/{ethereum-CuwXPURS.js → ethereum-CJbf5HCu.js} +1 -1
  23. package/assets/extractIPFS-DJBAzpfR.js +1 -0
  24. package/assets/{features-cMphHD0m.js → features-BaQq55bG.js} +1 -1
  25. package/assets/{fetchTokenMetadata-CzzqUD_C.js → fetchTokenMetadata-C1ngO7HU.js} +1 -1
  26. package/assets/{fortmatic-BtfrNeKp.js → fortmatic-CM-36WpK.js} +1 -1
  27. package/assets/get-ecosystem-wallet-info-D3mZ828S.js +1 -0
  28. package/assets/getBalance-DMdDUfLy.js +1 -0
  29. package/assets/{getInstalledModules-B-RsE287.js → getInstalledModules-DOdq5s84.js} +1 -1
  30. package/assets/{getNFT-BqbjDGbh.js → getNFT-B8132wTr.js} +2 -2
  31. package/assets/{getNFT-ClUfSxlO.js → getNFT-Df4p3NnO.js} +1 -1
  32. package/assets/{if-defined-Dwq8XpDA.js → if-defined-Bl8a4ab-.js} +1 -1
  33. package/assets/in-app-DOg1gcN6.js +2 -0
  34. package/assets/{in-app-wallet-calls-CwwQ0VDY.js → in-app-wallet-calls-C3XXM2uK.js} +1 -1
  35. package/assets/{index-Cd2xcopx.js → index--khZ3g0E.js} +2 -2
  36. package/assets/{index-CdCvLGtn.js → index-456fp1SV.js} +1 -1
  37. package/assets/{index-BYtVMjMf.js → index-5JpvePdb.js} +1 -1
  38. package/assets/{index-Ccb5UGcf.js → index-B1wz7Owl.js} +1 -1
  39. package/assets/{index-h6jcLaB2.js → index-BCq7sn5F.js} +1 -1
  40. package/assets/{index-DSJjx9ay.js → index-BKdNzTPl.js} +3 -3
  41. package/assets/{index-BsZyT53i.js → index-BMLKyv2l.js} +4 -4
  42. package/assets/{index-C9_jeDSj.js → index-BX3tZejP.js} +1 -1
  43. package/assets/{index-D8Nn1xAf.js → index-BazvSf0U.js} +1 -1
  44. package/assets/{index-DfgJOosn.js → index-Bc52X0iQ.js} +1 -1
  45. package/assets/{index-DYa4iVZE.js → index-Bk62IJ7q.js} +1 -1
  46. package/assets/{index-BobruL3O.js → index-BtsxTU_X.js} +1 -1
  47. package/assets/{index-BruZTjHN.js → index-Bx5a0Vg2.js} +1 -1
  48. package/assets/{index-Ba0jOwXj.js → index-C8c8VNHR.js} +1 -1
  49. package/assets/{index-CXiI9rXS.js → index-CB0KMBUn.js} +1 -1
  50. package/assets/{index-BJ89t_bW.js → index-CBS6SUOD.js} +1 -1
  51. package/assets/{index-V_1m0BwN.js → index-CMn1rqzs.js} +1 -1
  52. package/assets/{index-DEq1ZWKa.js → index-CPSrsrPD.js} +1 -1
  53. package/assets/{index-uKJ0cyDb.js → index-CT312b_h.js} +1 -1
  54. package/assets/{index-BsreR9g6.js → index-CTYL6USa.js} +1 -1
  55. package/assets/{index-BU6y379O.js → index-CZmexbhB.js} +1 -1
  56. package/assets/{index-DBw0yfGw.js → index-CfMamdHz.js} +1 -1
  57. package/assets/{index-D5fxp13X.js → index-CjOKquSH.js} +1 -1
  58. package/assets/{index-DbZ3_lNw.js → index-Cuhzd-33.js} +1 -1
  59. package/assets/{index-C9iDQul-.css → index-CujiQKjN.css} +1 -1
  60. package/assets/{index-BF1p7C7k.js → index-CwCHLbKJ.js} +1 -1
  61. package/assets/{index-CoAewCyo.js → index-D2phLp5f.js} +1 -1
  62. package/assets/index-D3gAQcpU.js +2 -0
  63. package/assets/{index-FZIobYEj.js → index-D3ndDNzn.js} +1 -1
  64. package/assets/index-DAclPpwc.js +4 -0
  65. package/assets/{index-D_t2cwDH.js → index-DAoXeY-7.js} +1 -1
  66. package/assets/{index-B3SuCFE2.js → index-DDa27cxc.js} +1 -1
  67. package/assets/{index-CcViJ9mC.js → index-DK67hOZb.js} +1 -1
  68. package/assets/{index-K0isSq0K.js → index-DKNEknrt.js} +1 -1
  69. package/assets/{index-CDvT4Q_g.js → index-DLDBtSCZ.js} +1 -1
  70. package/assets/{index-9l0HFt0G.js → index-DPWHpwh1.js} +13 -13
  71. package/assets/{index-CSX8lAoJ.js → index-DYaEHsOY.js} +1 -1
  72. package/assets/{index-DPQoS-8z.js → index-Dhjx38e5.js} +1 -1
  73. package/assets/{index-G5i3_Lok.js → index-Di_Hl_iK.js} +1 -1
  74. package/assets/{index-IxWsvkDr.js → index-Dk7lZXfn.js} +1 -1
  75. package/assets/{index-BITcR_1M.js → index-DkXO_kZj.js} +1 -1
  76. package/assets/{index-rfFvOinV.js → index-Z08B4dd3.js} +1 -1
  77. package/assets/{index-BVcKuMWZ.js → index-ZGp_PUF2.js} +1 -1
  78. package/assets/{index-BD9BBG_e.js → index-aZ_z0i3j.js} +1 -1
  79. package/assets/{index-Bf_ty5ez.js → index-bW418N1D.js} +1 -1
  80. package/assets/{index-BqWHQlqc.js → index-n7PJcE82.js} +1 -1
  81. package/assets/{index-CrfS5O-x.js → index-r-swI_-s.js} +1 -1
  82. package/assets/{index-BYN2eN-f.js → index-tF1SLBXL.js} +1 -1
  83. package/assets/{index-BdHhENX2.js → index-wL64_peq.js} +1 -1
  84. package/assets/{index.es-CB-yvhhh.js → index.es-BOYbQise.js} +1 -1
  85. package/assets/index.es-DRRWBSJv.js +1 -0
  86. package/assets/linkAccount-C5bSjc1T.js +1 -0
  87. package/assets/{native-DjcSPn6B.js → native-CV5tv0TG.js} +1 -1
  88. package/assets/{networks-CwDBKQsQ.js → networks-C86eT1TG.js} +3 -3
  89. package/assets/{onramp-DCE_9jgB.js → onramp-BOODe8UW.js} +1 -1
  90. package/assets/{openzeppelin-DXl3mu84.js → openzeppelin-D68EAkgg.js} +1 -1
  91. package/assets/{ownerOf-DShKXZbk.js → ownerOf-CursHafI.js} +1 -1
  92. package/assets/{parseNft-BszEZh2L.js → parseNft-n7ZvU0Fd.js} +2 -2
  93. package/assets/{pay-with-exchange-BWZMELae.js → pay-with-exchange-WgJKv9uo.js} +1 -1
  94. package/assets/{qr-overlay-Def5vMYS.js → qr-overlay-D8U0fVP-.js} +3 -3
  95. package/assets/{receive-B4cKA7x5.js → receive-BqvjZCLR.js} +1 -1
  96. package/assets/{ref-jo_MQhC5.js → ref-kgQxGa5I.js} +1 -1
  97. package/assets/{resolveImplementation-uCCZnkqv.js → resolveImplementation-B4GM10am.js} +1 -1
  98. package/assets/secp256k1-CpwTLmAw.js +1 -0
  99. package/assets/{send-Cpin8S8F.js → send-BL378Uzh.js} +1 -1
  100. package/assets/{send-eip712-transaction-fuVr-0Wu.js → send-eip712-transaction-u41VUUSa.js} +1 -1
  101. package/assets/{send-gasless-transaction-U_MTNGJG.js → send-gasless-transaction-Bv-SeN6V.js} +2 -2
  102. package/assets/session-proposal-C8n_HnVT.js +1 -0
  103. package/assets/session-request-CObMtvdb.js +2 -0
  104. package/assets/{socials-DHfbWrjU.js → socials-D4dvlXCA.js} +1 -1
  105. package/assets/{swaps-DcK0ETDM.js → swaps-V4FJcglk.js} +1 -1
  106. package/assets/{thirdweb-CS6G_ZNe.js → thirdweb-129NE2Ul.js} +6 -6
  107. package/assets/{totalSupply-CrDdlqEX.js → totalSupply-DO_2zgMa.js} +1 -1
  108. package/assets/{transactions-vDZ5yeRz.js → transactions-Bmdan2s3.js} +1 -1
  109. package/assets/types-DC0Zmj1B.js +1 -0
  110. package/assets/{ui-Bc2xTSCT.js → ui-C5Ow-sF2.js} +5 -5
  111. package/assets/{vendor-DgCFzUFU.js → vendor-DTjic7dc.js} +1 -1
  112. package/assets/{w3m-modal-w4bBHHnI.js → w3m-modal-CfVCaJKp.js} +1 -1
  113. package/assets/wallets-B4VDiGHH.js +12 -0
  114. package/assets/{web-connector-B_ZD1CLE.js → web-connector-DNU9LISy.js} +3 -3
  115. package/index.html +5 -5
  116. package/package.json +3 -3
  117. package/assets/browser-ponyfill-CfapXlLj.js +0 -1
  118. package/assets/controller-BL5ery_A.js +0 -2
  119. package/assets/extractIPFS-JSayXYon.js +0 -1
  120. package/assets/get-ecosystem-wallet-info-Cm-kfk0m.js +0 -1
  121. package/assets/getBalance-CwsaSxen.js +0 -1
  122. package/assets/index-DmH4eVyc.js +0 -2
  123. package/assets/index.es-B3Gbdgyi.js +0 -1
  124. package/assets/secp256k1-CKK4gwjJ.js +0 -1
  125. package/assets/session-proposal-BCeFOzD0.js +0 -1
  126. package/assets/session-request-CSPRWfOh.js +0 -2
  127. package/assets/wallets-CUOtYiA7.js +0 -14
@@ -0,0 +1,12 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/get-ecosystem-wallet-info-D3mZ828S.js","assets/in-app-DOg1gcN6.js","assets/thirdweb-129NE2Ul.js","assets/index-CTYL6USa.js","assets/vanilla-BwPktXNc.js","assets/hooks.module-MHgUT2ti.js","assets/clsx.m-DHulAg21.js","assets/ui-C5Ow-sF2.js","assets/vendor-DTjic7dc.js","assets/index-nibyPLVP.js","assets/index-5JpvePdb.js","assets/web-connector-DNU9LISy.js","assets/linkAccount-C5bSjc1T.js","assets/types-DC0Zmj1B.js","assets/index-D3gAQcpU.js","assets/send-eip712-transaction-u41VUUSa.js","assets/index-DAclPpwc.js","assets/ethereum-CJbf5HCu.js","assets/store-CraP4F4Y.js","assets/index-DPWHpwh1.js","assets/index-CujiQKjN.css","assets/index-CMn1rqzs.js","assets/index-BX3tZejP.js","assets/controller-C64KTqP4.js","assets/qr-overlay-D8U0fVP-.js","assets/getBalance-DMdDUfLy.js","assets/secp256k1-CpwTLmAw.js","assets/session-proposal-C8n_HnVT.js","assets/session-request-CObMtvdb.js"])))=>i.map(i=>d[i]);
2
+ import{aP as nr,a7 as jt,Q as fo,R as Bu,n as Re,f as re,F as Nn,p as Kt,aQ as gc,_ as a,aR as vr,b as qe,aO as As,s as ot,aS as mc,aT as Ec,aU as yc,X as Ni,j as Ps,u as Ts,t as Os,ar as qu,x as vc,as as Mu,ag as zu,aV as ju,h as Ku,v as Fu,i as Hu,aW as bc,aX as Wu,aY as Gu,ax as Ju,ay as Yu,aZ as Qu,a_ as Zu,l as Rs,a$ as Xu,b0 as Un,au as Ic,b1 as eh,b2 as th,b3 as Ds,b4 as Ac,Y as rh,b5 as ih,N as Pc,b6 as Tc,b7 as nh,b8 as po,b9 as sh,P as oh,ba as wo,bb as ah,bc as ch,bd as lh,be as uh,ac as hh,g as dh,aH as _h,bf as go,d as fh,bg as Gt,bh as ph,bi as wh,bj as gh,bk as mh}from"./thirdweb-129NE2Ul.js";import{c as br,t as Ze,a as Eh,i as Bn,b as yh,d as vh,f as bh,h as Ih,j as Ah,l as Ph,p as Th,u as Oh}from"./in-app-DOg1gcN6.js";import{p as Ls,w as Ui,C as Vs,l as Rh}from"./linkAccount-C5bSjc1T.js";import{c as Dh}from"./store-CraP4F4Y.js";import{B as X,g as K}from"./ui-C5Ow-sF2.js";import{e as cr,N as Oc}from"./index-DPWHpwh1.js";import{d as gi,a as Bi,s as ti,I as Ir,e as Lh,g as Xe,t as Be,h as B,j as Ot,C as Vh,k as xh,l as Wr,m as qn,D as ui,n as Sh,q as Ch,c as Nt,r as Ar,o as $h,u as kh,v as xs,w as Ss,b as qi,P as mo,Q as Nh,x as Uh,y as Zt,f as Rc,z as vt,A as _t,B as Dt}from"./index-CMn1rqzs.js";import{c as Bh,a as qh,k as Mh,d as zh,s as jh,g as Eo}from"./index-nibyPLVP.js";import"./index-BX3tZejP.js";import{i as Kh}from"./index-DAclPpwc.js";const Fh={"0x0":"reverted","0x1":"success"};function Cs(r){var i;const[t,e]=(()=>{const n=r.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{...r,atomic:r.atomic,chainId:r.chainId?nr(r.chainId):void 0,receipts:((i=r.receipts)==null?void 0:i.map(n=>({...n,blockNumber:jt(n.blockNumber),gasUsed:jt(n.gasUsed),status:Fh[n.status]})))??[],status:t,statusCode:e,version:r.version}}function $s(r,t){const e={};for(const[i,n]of Object.entries(r)){e[Number(i)]={};const s={};for(const[o,c]of Object.entries(n))s[o]=c;e[Number(i)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function ks(r,t){const e=r.calls[0];if(!e)throw new Error("No calls to send");const{calls:i,capabilities:n,version:s="2.0.0",chain:o=e.chain}=r,c=await Promise.all(i.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[_,f,p]=await Promise.all([fo(h),Bu(u),fo(d)]);return _?{data:f,to:re(_),value:typeof p=="bigint"||typeof p=="number"?Re(p):void 0}:{data:f,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:r.atomicRequired??!1,calls:c,capabilities:n,chainId:Re(o.id),from:re(t.address),version:s}],chain:o}}function Ns(r){return Hh(r).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Hh(r,t,e="http"){const i=[];for(const n of r.rpc)e==="http"&&!n.startsWith("http")||e==="ws"&&!n.startsWith("ws")||(n.includes("${THIRDWEB_API_KEY}")?i.push(n.replace("${THIRDWEB_API_KEY}","")):n.includes("${")||i.push(n));if(i.length===0)throw new Error(`No RPC available for chainId "${r.chainId}" with mode ${e}`);return i}function ct(r){return typeof r=="number"?r:Nn(r)?nr(r):typeof r=="bigint"?Number(r):Number.parseInt(r,10)}function Wh(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function Gh(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Dc(){return!Wh()&&!Gh()}const ft="com.coinbase.wallet",Pt="org.base.account",Lc="io.metamask",Jh="me.rainbow",Yh="io.zerion.wallet";function Us(r){return r.startsWith("http://")||r.startsWith("https://")}function Vc(r,t){if(!Us(r))return xc(r,t);let e=r;e.endsWith("/")||(e=`${e}/`);const i=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${i}`}}function xc(r,t){if(Us(r))return Vc(r,t);let e=r;e.includes("://")||(e=r.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const i=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${i}`}}function Qh(r,t){return Us(r)?Vc(r,t):xc(r,t)}function Zh(){if(typeof navigator>"u")return!1;const r=gc(navigator.userAgent);return r?r.toLowerCase().includes("android"):!1}function Xh(){if(typeof navigator>"u")return!1;const r=gc(navigator.userAgent);return r?r.toLowerCase().includes("ios")||r.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function ed(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function td(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function yo(){return!!(Zh()||Xh()||ed()&&td()||typeof window<"u"&&window.innerWidth<640)}function hn(r){if(window!==window.top)window.open(r);else if(r.startsWith("http")){const e=document.createElement("a");e.href=r,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=r}function Pr(r){return typeof r=="string"?r.startsWith("ecosystem."):r.id.startsWith("ecosystem.")}async function Sc(r,t){if(Pr(r)){const{getEcosystemWalletInfo:e}=await a(async()=>{const{getEcosystemWalletInfo:i}=await import("./get-ecosystem-wallet-info-D3mZ828S.js");return{getEcosystemWalletInfo:i}},__vite__mapDeps([0,1,2]));return t?e(r).then(i=>i.image_id):e(r)}switch(r){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 ${r} not found`)}}function rd(r){const{createOptions:t}=r,e=br();let i,n;function s(){i=void 0,n=void 0}let o=async()=>{},c=async h=>{n=h};const l=e.subscribe("chainChanged",h=>{n=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{i=h}),{autoConnect:async h=>{const{autoConnectBaseAccountSDK:d}=await a(async()=>{const{autoConnectBaseAccountSDK:A}=await Promise.resolve().then(()=>bo);return{autoConnectBaseAccountSDK:A}},void 0),_=await r.providerFactory(),[f,p,w,g]=await d(h,e,_);return i=f,n=p,o=w,c=g,Ze({chainId:n.id,client:h.client,walletAddress:i.address,walletType:Pt}),i},connect:async h=>{const{connectBaseAccountSDK:d}=await a(async()=>{const{connectBaseAccountSDK:A}=await Promise.resolve().then(()=>bo);return{connectBaseAccountSDK:A}},void 0),_=await r.providerFactory(),[f,p,w,g]=await d(h,e,_);return i=f,n=p,o=w,c=g,Ze({chainId:n.id,client:h.client,walletAddress:i.address,walletType:Pt}),i},disconnect:async()=>{s(),await o()},getAccount:()=>i,getChain(){if(n)return n=vr(n.id)||n,n},getConfig:()=>t,id:Pt,subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}function Mi(){if(!Dc())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:r,hostname:t,port:e}=window.location;let i=`${r}//${t}`;e&&e!=="80"&&e!=="443"&&(i+=`:${e}`);const n=`${i}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:n,name:window.document.title||"thirdweb powered dApp",url:i}}let dn,mi;async function Cc(r){var s,o,c,l,u,h,d;if(dn){if(r&&mi){const _=((s=mi.chains)==null?void 0:s.map(g=>g.id))||[],f=((o=r.chains)==null?void 0:o.map(g=>g.id))||[],p=_.length===f.length&&_.every((g,A)=>g===f[A]),w=((c=r.appMetadata)==null?void 0:c.name)===((l=mi.appMetadata)==null?void 0:l.name);(!p||!w)&&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 dn}const{createBaseAccountSDK:t}=await a(async()=>{const{createBaseAccountSDK:_}=await import("./index-CTYL6USa.js");return{createBaseAccountSDK:_}},__vite__mapDeps([3,4,5,6,2,7,8,9])),e=Mi(),n=t({appName:((u=r==null?void 0:r.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((h=r==null?void 0:r.appMetadata)==null?void 0:h.logoUrl)||e.logoUrl||null,appChainIds:((d=r==null?void 0:r.chains)==null?void 0:d.map(_=>_.id))||[]}).getProvider();return dn=n,mi=r,n}function $c(r){return r.id===Pt}function vo({provider:r,address:t,client:e}){const i={address:re(t),async sendTransaction(n){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:re(t),gas:n.gas?Re(n.gas):void 0,to:n.to,value:n.value?Re(n.value):void 0}]});return Os({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:re(t),walletType:Pt}),{transactionHash:s}},async signMessage({message:n}){if(!i.address)throw new Error("Provider not setup");const s=typeof n=="string"?Ps(n):n.raw instanceof Uint8Array?Ts(n.raw):n.raw,o=await r.request({method:"personal_sign",params:[s,i.address]});if(!Ni(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!i.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ls(n),l={EIP712Domain:mc(s),...n.types};Ec({domain:s,message:o,primaryType:c,types:l});const u=yc({domain:s??{},message:o,primaryType:c,types:l}),h=await r.request({method:"eth_signTypedData_v4",params:[i.address,u]});if(!Ni(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async n=>{try{const{callParams:s,chain:o}=await ks(n,i),c=await r.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(`${Pt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:ot(s)}`):s}},async getCallsStatus(n){try{const s=await r.request({method:"wallet_getCallsStatus",params:[n.id]});return Cs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Pt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(n){const s=n.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[re(i.address)]});return $s(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${Pt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return i}function kc(r,t,e,i,n){const s=vo({address:r,client:n,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",c),await e.disconnect()}async function c(){o(),i.emit("disconnect",void 0)}function l(h){if(h[0]){const d=vo({address:re(h[0]),client:n,provider:e});i.emit("accountChanged",d),i.emit("accountsChanged",h)}else c()}function u(h){const d=qe(ct(h));i.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>Nc(e,h)]}async function id(r,t,e){const i=await e.request({method:"eth_requestAccounts"});if(!i[0])throw new Error("No accounts found");const n=re(i[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=r.chain&&r.chain.id===o?r.chain:qe(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Nc(e,r.chain),c=r.chain),kc(n,c,e,t,r.client)}async function nd(r,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=r.chain&&r.chain.id===o?r.chain:qe(o);return kc(n,c,e,t,r.client)}async function Nc(r,t){var s;const e=await r.request({method:"eth_chainId"}),i=qe(ct(e));if((i==null?void 0:i.id)===t.id)return;const n=Re(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await As(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Ns(c)}]})}}const bo=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:nd,connectBaseAccountSDK:id,getBaseAccountWebProvider:Cc,isBaseAccountSDKWallet:$c},Symbol.toStringTag,{value:"Module"}));function sd(r){const{createOptions:t}=r,e=br();let i,n;function s(){i=void 0,n=void 0}let o=async()=>{},c=async h=>{n=h};const l=e.subscribe("chainChanged",h=>{n=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{i=h}),{autoConnect:async h=>{const{autoConnectCoinbaseWalletSDK:d}=await a(async()=>{const{autoConnectCoinbaseWalletSDK:A}=await Promise.resolve().then(()=>Ao);return{autoConnectCoinbaseWalletSDK:A}},void 0),_=await r.providerFactory(),[f,p,w,g]=await d(h,e,_);return i=f,n=p,o=w,c=g,Ze({chainId:n.id,client:h.client,walletAddress:i.address,walletType:ft}),i},connect:async h=>{const{connectCoinbaseWalletSDK:d}=await a(async()=>{const{connectCoinbaseWalletSDK:A}=await Promise.resolve().then(()=>Ao);return{connectCoinbaseWalletSDK:A}},void 0),_=await r.providerFactory(),[f,p,w,g]=await d(h,e,_);return i=f,n=p,o=w,c=g,Ze({chainId:n.id,client:h.client,walletAddress:i.address,walletType:ft}),i},disconnect:async()=>{s(),await o()},getAccount:()=>i,getChain(){if(n)return n=vr(n.id)||n,n},getConfig:()=>t,id:ft,onConnectRequested:async()=>{var h;if(r.onConnectRequested){const d=await r.providerFactory();return(h=r.onConnectRequested)==null?void 0:h.call(r,d)}},subscribe:e.subscribe,switchChain:async h=>{await c(h)}}}async function Uc(r){var t,e;await((e=(t=r==null?void 0:r.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const od=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:Uc},Symbol.toStringTag,{value:"Module"}));let _n;async function Bc(r){var t,e;if(!_n){let i=(await a(()=>import("./index-5JpvePdb.js"),__vite__mapDeps([10,7,8,2,6,5]))).default;typeof i!="function"&&typeof i.default=="function"&&(i=i.default);const s=new i({appChainIds:r!=null&&r.chains?r.chains.map(o=>o.id):void 0,appLogoUrl:((t=r==null?void 0:r.appMetadata)==null?void 0:t.logoUrl)||Mi().logoUrl,appName:((e=r==null?void 0:r.appMetadata)==null?void 0:e.name)||Mi().name}).makeWeb3Provider(r==null?void 0:r.walletConfig);return _n=s,s}return _n}function Io({provider:r,address:t,client:e}){const i={address:re(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await Uc(r)},async sendTransaction(n){const s=await r.request({method:"eth_sendTransaction",params:[{accessList:n.accessList,data:n.data,from:re(t),gas:n.gas?Re(n.gas):void 0,to:n.to,value:n.value?Re(n.value):void 0}]});return Os({chainId:n.chainId,client:e,contractAddress:n.to??void 0,gasPrice:n.gasPrice,transactionHash:s,walletAddress:re(t),walletType:ft}),{transactionHash:s}},async signMessage({message:n}){if(!i.address)throw new Error("Provider not setup");const s=typeof n=="string"?Ps(n):n.raw instanceof Uint8Array?Ts(n.raw):n.raw,o=await r.request({method:"personal_sign",params:[s,i.address]});if(!Ni(o))throw new Error("Invalid signature returned");return o},async signTypedData(n){if(!i.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:c}=Ls(n),l={EIP712Domain:mc(s),...n.types};Ec({domain:s,message:o,primaryType:c,types:l});const u=yc({domain:s??{},message:o,primaryType:c,types:l}),h=await r.request({method:"eth_signTypedData_v4",params:[i.address,u]});if(!Ni(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async n=>{try{const{callParams:s,chain:o}=await ks(n,i),c=await r.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(`${ft} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:ot(s)}`):s}},async getCallsStatus(n){try{const s=await r.request({method:"wallet_getCallsStatus",params:[n.id]});return Cs(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(n){try{return await r.request({method:"wallet_getCallsStatus",params:[n.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${ft} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(n){const s=n.chainId;try{const o=await r.request({method:"wallet_getCapabilities",params:[re(i.address)]});return $s(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${ft} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return i}function qc(r,t,e,i,n){const s=Io({address:r,client:n,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",c),await e.disconnect()}async function c(){o(),i.emit("disconnect",void 0)}function l(h){if(h[0]){const d=Io({address:re(h[0]),client:n,provider:e});i.emit("accountChanged",d),i.emit("accountsChanged",h)}else c()}function u(h){const d=qe(ct(h));i.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",c),[s,t,c,h=>Mc(e,h)]}async function ad(r,t,e){const i=await e.request({method:"eth_requestAccounts"});if(!i[0])throw new Error("No accounts found");const n=re(i[0]),s=await e.request({method:"eth_chainId"}),o=ct(s);let c=r.chain&&r.chain.id===o?r.chain:qe(o);return o&&(r!=null&&r.chain)&&o!==(r==null?void 0:r.chain.id)&&(await Mc(e,r.chain),c=r.chain),qc(n,c,e,t,r.client)}async function cd(r,t,e){const n=(await e.request({method:"eth_accounts"}))[0];if(!n)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=ct(s),c=r.chain&&r.chain.id===o?r.chain:qe(o);return qc(n,c,e,t,r.client)}async function Mc(r,t){var s;const e=await r.request({method:"eth_chainId"}),i=qe(ct(e));if((i==null?void 0:i.id)===t.id)return;const n=Re(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})}catch(o){const c=await As(t);(o==null?void 0:o.code)===4902&&await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=c.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:n,chainName:c.name,nativeCurrency:c.nativeCurrency,rpcUrls:Ns(c)}]})}}const Ao=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:cd,connectCoinbaseWalletSDK:ad,getCoinbaseWebProvider:Bc},Symbol.toStringTag,{value:"Module"}));function zc(...r){const[t,e]=r,i={id:t,partnerId:e==null?void 0:e.partnerId};return Eh({connectorFactory:async n=>{const{InAppWebConnector:s}=await a(async()=>{const{InAppWebConnector:o}=await import("./web-connector-DNU9LISy.js");return{InAppWebConnector:o}},__vite__mapDeps([11,2,12,13]));return new s({client:n,ecosystem:i,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:i.partnerId},ecosystem:i})}function Bs(r){const t=br();let e,i,n,s;return{autoConnect:async o=>{const{connectSmartAccount:c}=await a(async()=>{const{connectSmartAccount:h}=await import("./index-D3gAQcpU.js");return{connectSmartAccount:h}},__vite__mapDeps([14,2,1,15,12,16,17,13,18,7,8,19,20,21,22,9])),[l,u]=await c(o,r);return s=o,e=l,n=u,Ze({chainId:n.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-D3gAQcpU.js");return{connectSmartAccount:h}},__vite__mapDeps([14,2,1,15,12,16,17,13,18,7,8,19,20,21,22,9])),[l,u]=await c(o,r);return i=o.personalAccount,s=o,e=l,n=u,Ze({chainId:n.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-D3gAQcpU.js");return{disconnectSmartAccount:c}},__vite__mapDeps([14,2,1,15,12,16,17,13,18,7,8,19,20,21,22,9]));await o(e)}e=void 0,i=void 0,n=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>i,getChain(){if(n)return n=vr(n.id)||n,n},getConfig:()=>r,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var d;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await qu(o)){const _=vc({address:r.factoryAddress||Mu((d=r.overrides)==null?void 0:d.entrypointAddress),chain:o,client:s.client});if(!await zu(_))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await a(async()=>{const{connectSmartAccount:_}=await import("./index-D3gAQcpU.js");return{connectSmartAccount:_}},__vite__mapDeps([14,2,1,15,12,16,17,13,18,7,8,19,20,21,22,9])),[u,h]=await l({...s,chain:o},{...r,chain:o});e=u,n=h,t.emit("accountChanged",u),t.emit("chainChanged",h)}}}function st(...r){const[t,e]=r;switch(!0){case t==="smart":return Bs(e);case(t==="embedded"||t==="inApp"):return Bn(e);case Pr(t):return zc(...r);case t===ft:{const i=e;return sd({createOptions:i,onConnectRequested:async n=>{const{showCoinbasePopup:s}=await a(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>od);return{showCoinbasePopup:o}},void 0);return s(n)},providerFactory:()=>Bc(i)})}case t===Pt:{const i=e;return rd({createOptions:i,providerFactory:()=>Cc(i)})}default:{let c=function(){n=void 0,s=void 0};const i=br();let n,s,o,l=async()=>{};const u=i.subscribe("disconnect",()=>{c(),o==null||o(),u()});i.subscribe("accountChanged",f=>{n=f});let h=async()=>{throw new Error("Not implemented yet")};const d=yo()?f=>hn(f):void 0,_={autoConnect:async f=>{const{injectedProvider:p}=await a(async()=>{const{injectedProvider:w}=await Promise.resolve().then(()=>To);return{injectedProvider:w}},void 0);if(t!=="walletConnect"&&p(t)){const{autoConnectEip1193Wallet:w}=await a(async()=>{const{autoConnectEip1193Wallet:O}=await Promise.resolve().then(()=>Ro);return{autoConnectEip1193Wallet:O}},void 0),[g,A,V,v]=await w({chain:f.chain,client:f.client,emitter:i,id:t,provider:Mn(t)});return n=g,s=A,l=V,h=v,o=i.subscribe("chainChanged",O=>{s=O}),Ze({chainId:s.id,client:f.client,walletAddress:n.address,walletType:t}),n}if(f&&"client"in f){const{autoConnectWC:w}=await a(async()=>{const{autoConnectWC:O}=await import("./controller-C64KTqP4.js");return{autoConnectWC:O}},__vite__mapDeps([23,2,12,1,18,7,8,19,20,21,22,9,16,17,13])),[g,A,V,v]=await w(f,i,_.id,Ui,d);return n=g,s=A,l=V,h=v,Ze({chainId:s.id,client:f.client,walletAddress:n.address,walletType:t}),n}throw new Error("Failed to auto connect")},connect:async f=>{async function p(A){var O;const{connectWC:V}=await a(async()=>{const{connectWC:P}=await import("./controller-C64KTqP4.js");return{connectWC:P}},__vite__mapDeps([23,2,12,1,18,7,8,19,20,21,22,9,16,17,13]));let v;try{const[P,E,D,R]=await V({...A,walletConnect:{...A.walletConnect,onDisplayUri:((O=A.walletConnect)==null?void 0:O.onDisplayUri)||(async m=>{var y,b;if(typeof window<"u"&&typeof document<"u")if(yo()){const I=await Sc(t),L=I.mobile.native||I.mobile.universal;hn(L?Qh(L,m).redirect:m);return}else try{const{createQROverlay:I}=await a(async()=>{const{createQROverlay:L}=await import("./qr-overlay-D8U0fVP-.js");return{createQROverlay:L}},__vite__mapDeps([24,2]));v&&v.destroy(),v=I(m,{theme:((b=(y=A.walletConnect)==null?void 0:y.qrModalOptions)==null?void 0:b.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var L,T;(T=(L=A.walletConnect)==null?void 0:L.onCancel)==null||T.call(L)}})}catch(I){console.error("Failed to create QR overlay:",I)}})}},i,_.id,Ui,d);return v&&(v.destroy(),v=void 0),n=P,s=E,l=D,h=R,Ze({chainId:s.id,client:A.client,walletAddress:n.address,walletType:t}),n}catch(P){throw v&&(v.destroy(),v=void 0),P}}if(t==="walletConnect"){const{client:A,chain:V,...v}=f;return p({chain:V,client:A,walletConnect:{...v}})}const w=f&&"walletConnect"in f,{injectedProvider:g}=await a(async()=>{const{injectedProvider:A}=await Promise.resolve().then(()=>To);return{injectedProvider:A}},void 0);if(g(t)&&!w){const{connectEip1193Wallet:A}=await a(async()=>{const{connectEip1193Wallet:E}=await Promise.resolve().then(()=>Ro);return{connectEip1193Wallet:E}},void 0),[V,v,O,P]=await A({chain:f.chain,client:f.client,emitter:i,id:t,provider:Mn(t)});return n=V,s=v,l=O,h=P,o=i.subscribe("chainChanged",E=>{s=E}),Ze({chainId:s.id,client:f.client,walletAddress:n.address,walletType:t}),n}if(f&&"client"in f)return p(f);throw new Error("Failed to connect")},disconnect:async()=>{c(),await l()},getAccount:()=>n,getChain(){if(s)return s=vr(s.id)||s,s},getConfig:()=>r[1],id:t,subscribe:i.subscribe,switchChain:async f=>{try{await h(f),s=f}catch(p){console.error("Error switching chain",p)}}};return _}}}function ld(){return st("walletConnect")}const Po=Dc()?Dh():void 0;function qs(r){const t=Ms().find(e=>e.info.rdns===r);return t==null?void 0:t.provider}function jc(){return Ms().map(e=>e.info.rdns).map(e=>st(e))}function ud(){if(Po)return Po}function Ms(){var t;const r=((t=ud())==null?void 0:t.getProviders())||[];for(const e of r)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=Lc;break}return r}const To=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:Ms,getInstalledWallets:jc,injectedProvider:qs},Symbol.toStringTag,{value:"Module"}));function Mn(r){const t=qs(r);if(!t)throw new Error(`No injected provider found for wallet: "${r}"`);return t}async function Kc({id:r,provider:t,emitter:e,client:i,chain:n}){var _,f;let s,c=0;for(;!(s!=null&&s[0])&&c<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(p){if(console.error(p),(f=(_=hd(p))==null?void 0:_.toLowerCase())!=null&&f.includes("rejected"))throw p;await new Promise(w=>setTimeout(w,500))}c++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=re(l),h=await t.request({method:"eth_chainId"}).then(ct).catch(p=>{throw new Error("Error reading chainId from provider",p)});let d=n&&n.id===h?n:qe(h);try{n&&typeof n.id<"u"&&n.id!==h&&(await Wc(t,n),d=n)}catch{console.warn(`Error switching to chain ${n==null?void 0:n.id} - defaulting to wallet chain (${h})`)}return Hc({address:u,chain:d,client:i,emitter:e,id:r,provider:t})}async function Fc({id:r,provider:t,emitter:e,client:i,chain:n}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const c=re(o),l=await t.request({method:"eth_chainId"}).then(ct),u=n&&n.id===l?n:qe(l);return Hc({address:c,chain:u,client:i,emitter:e,id:r,provider:t})}function Oo({provider:r,address:t,client:e,id:i}){const n={address:re(t),async sendTransaction(s){const c=[{...s.gasPrice?{gasPrice:Re(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?Re(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?Re(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?Re(s.gas):void 0,nonce:s.nonce?Re(s.nonce):void 0,to:s.to?re(s.to):void 0,data:s.data,value:s.value?Re(s.value):void 0,authorizationList:s.authorizationList?Gu(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await r.request({method:"eth_sendTransaction",params:c});return Os({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:re(t),walletType:i}),{transactionHash:l}}catch(l){throw Ju(l)&&Yu({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:re(t)}),l}},async signMessage({message:s}){if(!n.address)throw new Error("Provider not setup");const o=typeof s=="string"?Ps(s):s.raw instanceof Uint8Array?Ts(s.raw):s.raw;return await r.request({method:"personal_sign",params:[o,re(n.address)]})},async signAuthorization(s){const o=bc(s);let c;try{c=await r.request({method:"eth_sign",params:[re(n.address),o]})}catch{c=await r.request({method:"secp256k1_sign",params:[o]})}if(!c)throw new Error("Failed to sign authorization");const l=Wu(c);return{...s,...l}},async signTypedData(s){if(!r||!n.address)throw new Error("Provider not setup");const o=Ls(s),{domain:c,message:l,primaryType:u}=o,h={EIP712Domain:Ku({domain:c}),...o.types};Fu({domain:c,message:l,primaryType:u,types:h});const d=Hu({domain:c??{},message:l,primaryType:u,types:h});return await r.request({method:"eth_signTypedData_v4",params:[re(n.address),d]})},async watchAsset(s){return await r.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:c}=await ks(s,n),l=await r.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(`${i} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:ju(o)}`):o}},async getCallsStatus(s){try{const o=await r.request({method:"wallet_getCallsStatus",params:[s.id]});return Cs(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${i} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await r.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${i} 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 r.request({method:"wallet_getCapabilities",params:[re(n.address),o?[Re(o)]:void 0]});return $s(c,o)}catch(c){if(/unsupport|not support|not available/i.test(c.message))return{message:`${i} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw c}}};return n}async function Hc({provider:r,address:t,chain:e,emitter:i,client:n,id:s}){const o=Oo({address:t,client:n,id:s,provider:r});async function c(){r.removeListener("accountsChanged",u),r.removeListener("chainChanged",h),r.removeListener("disconnect",l);try{await Qu(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){c(),i.emit("disconnect",void 0)}function u(d){if(d[0]){const _=Oo({address:re(d[0]),client:n,id:s,provider:r});i.emit("accountChanged",_),i.emit("accountsChanged",d)}else l()}function h(d){const _=qe(ct(d));i.emit("chainChanged",_)}return r.on&&(r.on("accountsChanged",u),r.on("chainChanged",h),r.on("disconnect",l)),[o,e,l,d=>Wc(r,d)]}async function Wc(r,t){var i;const e=Re(t.id);try{await r.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const n=await As(t);await r.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(i=n.explorers)==null?void 0:i.map(s=>s.url),chainId:e,chainName:n.name,nativeCurrency:n.nativeCurrency,rpcUrls:Ns(n)}]})}}function hd(r){return r instanceof Error?r.message:typeof r=="string"?r:typeof r=="object"&&r!==null?JSON.stringify(r):String(r)}const Ro=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:Fc,connectEip1193Wallet:Kc,getInjectedProvider:Mn},Symbol.toStringTag,{value:"Module"}));function dd(r){const t=r.walletId??"adapter",e=br();let i,n,s;const o=async _=>(s=typeof r.provider=="function"?await r.provider(_):r.provider,s),c=e.subscribe("chainChanged",_=>{n=_});function l(){i=void 0,n=void 0}let u=async()=>{};const h=e.subscribe("disconnect",()=>{l(),c(),h()});e.subscribe("accountChanged",_=>{i=_});let d=async _=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Zu(_.id)}]}))};return{autoConnect:async _=>{var A;const[f,p,w,g]=await Fc({chain:_.chain,client:_.client,emitter:e,id:t,provider:await o({chainId:(A=_.chain)==null?void 0:A.id})});return i=f,n=p,u=w,d=g,e.emit("onConnect",_),Ze({client:_.client,walletAddress:i.address,walletType:t}),i},connect:async _=>{var A;const[f,p,w,g]=await Kc({chain:_.chain,client:_.client,emitter:e,id:t,provider:await o({chainId:(A=_.chain)==null?void 0:A.id})});return i=f,n=p,u=w,d=g,e.emit("onConnect",_),Ze({client:_.client,walletAddress:i.address,walletType:t}),i},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>i,getChain(){if(n)return n=vr(n.id)||n,n},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async _=>{await d(_),e.emit("chainChanged",_)}}}function _d(r){const{chain:t,client:e,wallet:i,connectOverride:n}=r,s=Rs({chain:t,client:e});return{on:i.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const c=i.getAccount();if(!c)throw new Error("Account not connected");return(await Ic({account:c,transaction:Un({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const c=i.getAccount();if(!c)throw new Error("Account not connected");return Xu({account:c,transaction:Un({...o.params[0],chain:t,client:e})})}case"personal_sign":{const c=i.getAccount();if(!c)throw new Error("Account not connected");return c.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const c=i.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=i.getAccount();return c?[c.address]:[]}case"eth_requestAccounts":{const c=i.getAccount();if(c)return[c.address];const l=n?await n(i):await i.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=Nn(l)?nr(l):l,h=qe(u);return i.switchChain(h)}case"wallet_getCapabilities":{const c=i.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=Nn(u)?nr(u):Number(u);return c.getCapabilities(h?{chainId:h}:{})}return c.getCapabilities({})}case"wallet_sendCalls":{const c=i.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=i.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 fd=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:dd,toProvider:_d},Symbol.toStringTag,{value:"Module"}));function pd(r){const t=br();let e=r.chain;return{autoConnect:async()=>(t.emit("onConnect",r),r.adaptedAccount),connect:async()=>(t.emit("onConnect",r),r.adaptedAccount),disconnect:async()=>{await r.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return r.adaptedAccount},getChain(){return e=vr(e.id)||e,e},getConfig(){return r},id:"adapter",subscribe:t.subscribe,switchChain:async i=>{await r.switchChain(i),e=i,t.emit("chainChanged",i)}}}async function wd(){return(await a(async()=>{const{default:r}=await import("./wallet-infos-BHI_w6r-.js");return{default:r}},[])).default}function gd(r){if("privateKey"in r){const t=eh(typeof r.message=="object"?r.message.raw:th(r.message)),e=Ds({payload:t,privateKey:r.privateKey});return Ac(e)}if("account"in r){const{message:t,account:e}=r;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function md(r){var s;const{privateKey:t,...e}=r;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=rh(e.domain.chainId));const i=ih(e),n=Ds({payload:i,privateKey:t});return Ac(n)}function zn(r){const{client:t}=r,e=`0x${r.privateKey.replace(/^0x/,"")}`,i=Pc(Tc.getPublicKey(e.slice(2),!1)),n=nh(i);return{address:re(n),sendTransaction:async o=>{const c=Rs({chain:qe(o.chainId),client:t}),l=po({privateKey:e,transaction:o});return{transactionHash:await oh(c,l)}},signAuthorization:async o=>{const c=Ds({payload:bc(o),privateKey:e});return sh(o,{signature:c})},signMessage:async({message:o})=>gd({message:o,privateKey:e}),signTransaction:async o=>po({privateKey:e,transaction:o}),signTypedData:async o=>md({...o,privateKey:e})}}async function Ed(r){const t=Pc(Tc.utils.randomPrivateKey());return zn({client:r.client,privateKey:t})}async function yd(r){const{address:t,client:e,chain:i}=r,n=r.tokenAddress||(i.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(n&&re(n)!==re(wo)){const{getBalance:h}=await a(async()=>{const{getBalance:d}=await import("./getBalance-DMdDUfLy.js");return{getBalance:d}},__vite__mapDeps([25,2]));return h({address:t,contract:vc({address:n,chain:i,client:e})})}const s=Rs({chain:i,client:e}),[o,c,l,u]=await Promise.all([ah(i),ch(i),lh(i),uh(s,{address:t})]);return{chainId:i.id,decimals:c,displayValue:hh(u,c),name:l,symbol:o,tokenAddress:n??wo,value:u}}function vd(r){return!r||typeof r.then!="function"?Promise.resolve(r):r}function ge(r,...t){try{return vd(r(...t))}catch(e){return Promise.reject(e)}}function bd(r){const t=typeof r;return r===null||t!=="object"&&t!=="function"}function Id(r){const t=Object.getPrototypeOf(r);return!t||t.isPrototypeOf(Object)}function Di(r){if(bd(r))return String(r);if(Id(r)||Array.isArray(r))return JSON.stringify(r);if(typeof r.toJSON=="function")return Di(r.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const jn="base64:";function Ad(r){return typeof r=="string"?r:jn+Od(r)}function Pd(r){return typeof r!="string"||!r.startsWith(jn)?r:Td(r.slice(jn.length))}function Td(r){return globalThis.Buffer?X.from(r,"base64"):Uint8Array.from(globalThis.atob(r),t=>t.codePointAt(0))}function Od(r){return globalThis.Buffer?X.from(r).toString("base64"):globalThis.btoa(String.fromCodePoint(...r))}function Se(r){var t;return r&&((t=r.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Rd(...r){return Se(r.join(":"))}function Ei(r){return r=Se(r),r?r+":":""}function Dd(r,t){if(t===void 0)return!0;let e=0,i=r.indexOf(":");for(;i>-1;)e++,i=r.indexOf(":",i+1);return e<=t}function Ld(r,t){return t?r.startsWith(t)&&r[r.length-1]!=="$":r[r.length-1]!=="$"}const Vd="memory",xd=()=>{const r=new Map;return{name:Vd,getInstance:()=>r,hasItem(t){return r.has(t)},getItem(t){return r.get(t)??null},getItemRaw(t){return r.get(t)??null},setItem(t,e){r.set(t,e)},setItemRaw(t,e){r.set(t,e)},removeItem(t){r.delete(t)},getKeys(){return[...r.keys()]},clear(){r.clear()},dispose(){r.clear()}}};function Sd(r={}){const t={mounts:{"":r.driver||xd()},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[""]}},i=(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]})),n=(u,h)=>{if(t.watching){h=Se(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 Do(t.mounts[u],n,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 _=new Map,f=p=>{let w=_.get(p.base);return w||(w={driver:p.driver,base:p.base,items:[]},_.set(p.base,w)),w};for(const p of u){const w=typeof p=="string",g=Se(w?p:p.key),A=w?void 0:p.value,V=w||!p.options?h:{...h,...p.options},v=e(g);f(v).items.push({key:g,value:A,relativeKey:v.relativeKey,options:V})}return Promise.all([..._.values()].map(p=>d(p))).then(p=>p.flat())},l={hasItem(u,h={}){u=Se(u);const{relativeKey:d,driver:_}=e(u);return ge(_.hasItem,d,h)},getItem(u,h={}){u=Se(u);const{relativeKey:d,driver:_}=e(u);return ge(_.getItem,d,h).then(f=>gi(f))},getItems(u,h={}){return c(u,h,d=>d.driver.getItems?ge(d.driver.getItems,d.items.map(_=>({key:_.relativeKey,options:_.options})),h).then(_=>_.map(f=>({key:Rd(d.base,f.key),value:gi(f.value)}))):Promise.all(d.items.map(_=>ge(d.driver.getItem,_.relativeKey,_.options).then(f=>({key:_.key,value:gi(f)})))))},getItemRaw(u,h={}){u=Se(u);const{relativeKey:d,driver:_}=e(u);return _.getItemRaw?ge(_.getItemRaw,d,h):ge(_.getItem,d,h).then(f=>Pd(f))},async setItem(u,h,d={}){if(h===void 0)return l.removeItem(u);u=Se(u);const{relativeKey:_,driver:f}=e(u);f.setItem&&(await ge(f.setItem,_,Di(h),d),f.watch||n("update",u))},async setItems(u,h){await c(u,h,async d=>{if(d.driver.setItems)return ge(d.driver.setItems,d.items.map(_=>({key:_.relativeKey,value:Di(_.value),options:_.options})),h);d.driver.setItem&&await Promise.all(d.items.map(_=>ge(d.driver.setItem,_.relativeKey,Di(_.value),_.options)))})},async setItemRaw(u,h,d={}){if(h===void 0)return l.removeItem(u,d);u=Se(u);const{relativeKey:_,driver:f}=e(u);if(f.setItemRaw)await ge(f.setItemRaw,_,h,d);else if(f.setItem)await ge(f.setItem,_,Ad(h),d);else return;f.watch||n("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=Se(u);const{relativeKey:d,driver:_}=e(u);_.removeItem&&(await ge(_.removeItem,d,h),(h.removeMeta||h.removeMata)&&await ge(_.removeItem,d+"$",h),_.watch||n("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=Se(u);const{relativeKey:d,driver:_}=e(u),f=Object.create(null);if(_.getMeta&&Object.assign(f,await ge(_.getMeta,d,h)),!h.nativeOnly){const p=await ge(_.getItem,d+"$",h).then(w=>gi(w));p&&typeof p=="object"&&(typeof p.atime=="string"&&(p.atime=new Date(p.atime)),typeof p.mtime=="string"&&(p.mtime=new Date(p.mtime)),Object.assign(f,p))}return f},setMeta(u,h,d={}){return this.setItem(u+"$",h,d)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){var g;u=Ei(u);const d=i(u,!0);let _=[];const f=[];let p=!0;for(const A of d){(g=A.driver.flags)!=null&&g.maxDepth||(p=!1);const V=await ge(A.driver.getKeys,A.relativeBase,h);for(const v of V){const O=A.mountpoint+Se(v);_.some(P=>O.startsWith(P))||f.push(O)}_=[A.mountpoint,..._.filter(v=>!v.startsWith(A.mountpoint))]}const w=h.maxDepth!==void 0&&!p;return f.filter(A=>(!w||Dd(A,h.maxDepth))&&Ld(A,u))},async clear(u,h={}){u=Ei(u),await Promise.all(i(u,!1).map(async d=>{if(d.driver.clear)return ge(d.driver.clear,d.relativeBase,h);if(d.driver.removeItem){const _=await d.driver.getKeys(d.relativeBase||"",h);return Promise.all(_.map(f=>d.driver.removeItem(f,h)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>Lo(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=Ei(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((d,_)=>_.length-d.length)),t.mounts[u]=h,t.watching&&Promise.resolve(Do(h,n,u)).then(d=>{t.unwatch[u]=d}).catch(console.error),l},async unmount(u,h=!0){var d,_;u=Ei(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((_=(d=t.unwatch)[u])==null||_.call(d),delete t.unwatch[u]),h&&await Lo(t.mounts[u]),t.mountpoints=t.mountpoints.filter(f=>f!==u),delete t.mounts[u])},getMount(u=""){u=Se(u)+":";const h=e(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=Se(u),i(u,h.parents).map(_=>({driver:_.driver,base:_.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 Do(r,t,e){return r.watch?r.watch((i,n)=>t(i,e+n)):()=>{}}async function Lo(r){typeof r.dispose=="function"&&await ge(r.dispose)}const Cd="idb-keyval";var $d=(r={})=>{const t=r.base&&r.base.length>0?`${r.base}:`:"",e=n=>t+n;let i;return r.dbName&&r.storeName&&(i=Bh(r.dbName,r.storeName)),{name:Cd,options:r,async hasItem(n){return!(typeof await Eo(e(n),i)>"u")},async getItem(n){return await Eo(e(n),i)??null},setItem(n,s){return jh(e(n),s,i)},removeItem(n){return zh(e(n),i)},getKeys(){return Mh(i)},clear(){return qh(i)}}};const kd="WALLET_CONNECT_V2_INDEXED_DB",Nd="keyvaluestorage";let Ud=class{constructor(){this.indexedDb=Sd({driver:$d({dbName:kd,storeName:Nd})})}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,ti(e))}async removeItem(t){await this.indexedDb.removeItem(t)}};var fn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof K<"u"?K:typeof self<"u"?self:{},Li={exports:{}};(function(){let r;function t(){}r=t,r.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},r.prototype.setItem=function(e,i){this[e]=String(i)},r.prototype.removeItem=function(e){delete this[e]},r.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(i){e[i]=void 0,delete e[i]})},r.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},r.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof fn<"u"&&fn.localStorage?Li.exports=fn.localStorage:typeof window<"u"&&window.localStorage?Li.exports=window.localStorage:Li.exports=new t})();function Bd(r){var t;return[r[0],Bi((t=r[1])!=null?t:"")]}let qd=class{constructor(){this.localStorage=Li.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(Bd)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return Bi(e)}async setItem(t,e){this.localStorage.setItem(t,ti(e))}async removeItem(t){this.localStorage.removeItem(t)}};const Md="wc_storage_version",Vo=1,zd=async(r,t,e)=>{const i=Md,n=await t.getItem(i);if(n&&n>=Vo){e(t);return}const s=await r.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 r.getItem(c);await t.setItem(c,u),o.push(c)}}await t.setItem(i,Vo),e(t),jd(r,o)},jd=async(r,t)=>{t.length&&t.forEach(async e=>{await r.removeItem(e)})};let Kd=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new qd;this.storage=t;try{const e=new Ud;zd(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 pn,xo;function Fd(){if(xo)return pn;xo=1;function r(e){try{return JSON.stringify(e)}catch{return'"[Circular]"'}}pn=t;function t(e,i,n){var s=n&&n.stringify||r,o=1;if(typeof e=="object"&&e!==null){var c=i.length+o;if(c===1)return e;var l=new Array(c);l[0]=s(e);for(var u=1;u<c;u++)l[u]=s(i[u]);return l.join(" ")}if(typeof e!="string")return e;var h=i.length;if(h===0)return e;for(var d="",_=1-o,f=-1,p=e&&e.length||0,w=0;w<p;){if(e.charCodeAt(w)===37&&w+1<p){switch(f=f>-1?f:0,e.charCodeAt(w+1)){case 100:case 102:if(_>=h||i[_]==null)break;f<w&&(d+=e.slice(f,w)),d+=Number(i[_]),f=w+2,w++;break;case 105:if(_>=h||i[_]==null)break;f<w&&(d+=e.slice(f,w)),d+=Math.floor(Number(i[_])),f=w+2,w++;break;case 79:case 111:case 106:if(_>=h||i[_]===void 0)break;f<w&&(d+=e.slice(f,w));var g=typeof i[_];if(g==="string"){d+="'"+i[_]+"'",f=w+2,w++;break}if(g==="function"){d+=i[_].name||"<anonymous>",f=w+2,w++;break}d+=s(i[_]),f=w+2,w++;break;case 115:if(_>=h)break;f<w&&(d+=e.slice(f,w)),d+=String(i[_]),f=w+2,w++;break;case 37:f<w&&(d+=e.slice(f,w)),d+="%",f=w+2,w++,_--;break}++_}++w}return f===-1?e:(f<p&&(d+=e.slice(f)),d)}return pn}var wn,So;function Hd(){if(So)return wn;So=1;const r=Fd();wn=n;const t=P().console||{},e={mapHttpRequest:p,mapHttpResponse:p,wrapRequestSerializer:w,wrapResponseSerializer:w,wrapErrorSerializer:w,req:p,res:p,err:_};function i(E,D){return Array.isArray(E)?E.filter(function(m){return m!=="!stdSerializers.err"}):E===!0?Object.keys(D):!1}function n(E){E=E||{},E.browser=E.browser||{};const D=E.browser.transmit;if(D&&typeof D.send!="function")throw Error("pino: transmit option must have a send function");const R=E.browser.write||t;E.browser.write&&(E.browser.asObject=!0);const m=E.serializers||{},y=i(E.browser.serialize,m);let b=E.browser.serialize;Array.isArray(E.browser.serialize)&&E.browser.serialize.indexOf("!stdSerializers.err")>-1&&(b=!1);const I=["error","fatal","warn","info","debug","trace"];typeof R=="function"&&(R.error=R.fatal=R.warn=R.info=R.debug=R.trace=R),E.enabled===!1&&(E.level="silent");const L=E.level||"info",T=Object.create(R);T.log||(T.log=g),Object.defineProperty(T,"levelVal",{get:$}),Object.defineProperty(T,"level",{get:k,set:q});const x={transmit:D,serialize:y,asObject:E.browser.asObject,levels:I,timestamp:f(E)};T.levels=n.levels,T.level=L,T.setMaxListeners=T.getMaxListeners=T.emit=T.addListener=T.on=T.prependListener=T.once=T.prependOnceListener=T.removeListener=T.removeAllListeners=T.listeners=T.listenerCount=T.eventNames=T.write=T.flush=g,T.serializers=m,T._serialize=y,T._stdErrSerialize=b,T.child=C,D&&(T._logEvent=d());function $(){return this.level==="silent"?1/0:this.levels.values[this.level]}function k(){return this._level}function q(N){if(N!=="silent"&&!this.levels.values[N])throw Error("unknown level "+N);this._level=N,s(x,T,"error","log"),s(x,T,"fatal","error"),s(x,T,"warn","error"),s(x,T,"info","log"),s(x,T,"debug","log"),s(x,T,"trace","log")}function C(N,z){if(!N)throw new Error("missing bindings for child Pino");z=z||{},y&&N.serializers&&(z.serializers=N.serializers);const j=z.serializers;if(y&&j){var F=Object.assign({},m,j),H=E.browser.serialize===!0?Object.keys(F):y;delete N.serializers,l([N],H,F,this._stdErrSerialize)}function W(G){this._childLevel=(G._childLevel|0)+1,this.error=u(G,N,"error"),this.fatal=u(G,N,"fatal"),this.warn=u(G,N,"warn"),this.info=u(G,N,"info"),this.debug=u(G,N,"debug"),this.trace=u(G,N,"trace"),F&&(this.serializers=F,this._serialize=H),D&&(this._logEvent=d([].concat(G._logEvent.bindings,N)))}return W.prototype=this,new W(this)}return T}n.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"}},n.stdSerializers=e,n.stdTimeFunctions=Object.assign({},{nullTime:A,epochTime:V,unixTime:v,isoTime:O});function s(E,D,R,m){const y=Object.getPrototypeOf(D);D[R]=D.levelVal>D.levels.values[R]?g:y[R]?y[R]:t[R]||t[m]||g,o(E,D,R)}function o(E,D,R){!E.transmit&&D[R]===g||(D[R]=function(m){return function(){const b=E.timestamp(),I=new Array(arguments.length),L=Object.getPrototypeOf&&Object.getPrototypeOf(this)===t?t:this;for(var T=0;T<I.length;T++)I[T]=arguments[T];if(E.serialize&&!E.asObject&&l(I,this._serialize,this.serializers,this._stdErrSerialize),E.asObject?m.call(L,c(this,R,I,b)):m.apply(L,I),E.transmit){const x=E.transmit.level||D.level,$=n.levels.values[x],k=n.levels.values[R];if(k<$)return;h(this,{ts:b,methodLevel:R,methodValue:k,transmitValue:n.levels.values[E.transmit.level||D.level],send:E.transmit.send,val:D.levelVal},I)}}}(D[R]))}function c(E,D,R,m){E._serialize&&l(R,E._serialize,E.serializers,E._stdErrSerialize);const y=R.slice();let b=y[0];const I={};m&&(I.time=m),I.level=n.levels.values[D];let L=(E._childLevel|0)+1;if(L<1&&(L=1),b!==null&&typeof b=="object"){for(;L--&&typeof y[0]=="object";)Object.assign(I,y.shift());b=y.length?r(y.shift(),y):void 0}else typeof b=="string"&&(b=r(y.shift(),y));return b!==void 0&&(I.msg=b),I}function l(E,D,R,m){for(const y in E)if(m&&E[y]instanceof Error)E[y]=n.stdSerializers.err(E[y]);else if(typeof E[y]=="object"&&!Array.isArray(E[y]))for(const b in E[y])D&&D.indexOf(b)>-1&&b in R&&(E[y][b]=R[b](E[y][b]))}function u(E,D,R){return function(){const m=new Array(1+arguments.length);m[0]=D;for(var y=1;y<m.length;y++)m[y]=arguments[y-1];return E[R].apply(this,m)}}function h(E,D,R){const m=D.send,y=D.ts,b=D.methodLevel,I=D.methodValue,L=D.val,T=E._logEvent.bindings;l(R,E._serialize||Object.keys(E.serializers),E.serializers,E._stdErrSerialize===void 0?!0:E._stdErrSerialize),E._logEvent.ts=y,E._logEvent.messages=R.filter(function(x){return T.indexOf(x)===-1}),E._logEvent.level.label=b,E._logEvent.level.value=I,m(b,E._logEvent,L),E._logEvent=d(T)}function d(E){return{ts:0,messages:[],bindings:E||[],level:{label:"",value:0}}}function _(E){const D={type:E.constructor.name,msg:E.message,stack:E.stack};for(const R in E)D[R]===void 0&&(D[R]=E[R]);return D}function f(E){return typeof E.timestamp=="function"?E.timestamp:E.timestamp===!1?A:V}function p(){return{}}function w(E){return E}function g(){}function A(){return!1}function V(){return Date.now()}function v(){return Math.round(Date.now()/1e3)}function O(){return new Date(Date.now()).toISOString()}function P(){function E(D){return typeof D<"u"&&D}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 E(self)||E(window)||E(this)||{}}}return wn}var wr=Hd();const Zi=dh(wr),Wd={level:"info"},hi="custom_context",zs=1e3*1024;let Gd=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}},Co=class{constructor(t){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=t,this.sizeInBytes=0}append(t){const e=new Gd(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 Gc{constructor(t,e=zs){this.level=t??"error",this.levelValue=wr.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=e,this.logs=new Co(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(t,e){e===wr.levels.values.error?console.error(t):e===wr.levels.values.warn?console.warn(t):e===wr.levels.values.debug?console.debug(t):e===wr.levels.values.trace?console.trace(t):console.log(t)}appendToLogs(t){this.logs.append(ti({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 Co(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(t){const e=this.getLogArray();return e.push(ti({extraMetadata:t})),new Blob(e,{type:"application/json"})}}let Jd=class{constructor(t,e=zs){this.baseChunkLogger=new Gc(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)),i=document.createElement("a");i.href=e,i.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(e)}},Yd=class{constructor(t,e=zs){this.baseChunkLogger=new Gc(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 Qd=Object.defineProperty,Zd=Object.defineProperties,Xd=Object.getOwnPropertyDescriptors,$o=Object.getOwnPropertySymbols,e_=Object.prototype.hasOwnProperty,t_=Object.prototype.propertyIsEnumerable,ko=(r,t,e)=>t in r?Qd(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zi=(r,t)=>{for(var e in t||(t={}))e_.call(t,e)&&ko(r,e,t[e]);if($o)for(var e of $o(t))t_.call(t,e)&&ko(r,e,t[e]);return r},ji=(r,t)=>Zd(r,Xd(t));function js(r){return ji(zi({},r),{level:(r==null?void 0:r.level)||Wd.level})}function r_(r,t=hi){return r[t]||""}function i_(r,t,e=hi){return r[e]=t,r}function Me(r,t=hi){let e="";return typeof r.bindings>"u"?e=r_(r,t):e=r.bindings().context||"",e}function n_(r,t,e=hi){const i=Me(r,e);return i.trim()?`${i}/${t}`:t}function Ve(r,t,e=hi){const i=n_(r,t,e),n=r.child({context:i});return i_(n,i,e)}function s_(r){var t,e;const i=new Jd((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:Zi(ji(zi({},r.opts),{level:"trace",browser:ji(zi({},(e=r.opts)==null?void 0:e.browser),{write:n=>i.write(n)})})),chunkLoggerController:i}}function o_(r){var t;const e=new Yd((t=r.opts)==null?void 0:t.level,r.maxSizeInBytes);return{logger:Zi(ji(zi({},r.opts),{level:"trace"}),e),chunkLoggerController:e}}function a_(r){return typeof r.loggerOverride<"u"&&typeof r.loggerOverride!="string"?{logger:r.loggerOverride,chunkLoggerController:null}:typeof window<"u"?s_(r):o_(r)}var c_=Object.defineProperty,l_=(r,t,e)=>t in r?c_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,No=(r,t,e)=>l_(r,typeof t!="symbol"?t+"":t,e);class u_ extends Ir{constructor(t){super(),this.opts=t,No(this,"protocol","wc"),No(this,"version",2)}}var h_=Object.defineProperty,d_=(r,t,e)=>t in r?h_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,__=(r,t,e)=>d_(r,t+"",e);class f_ extends Ir{constructor(t,e){super(),this.core=t,this.logger=e,__(this,"records",new Map)}}class p_{constructor(t,e){this.logger=t,this.core=e}}class w_ extends Ir{constructor(t,e){super(),this.relayer=t,this.logger=e}}let g_=class extends Ir{constructor(t){super()}},m_=class{constructor(t,e,i,n){this.core=t,this.logger=e,this.name=i}},E_=class extends Ir{constructor(t,e){super(),this.relayer=t,this.logger=e}};class y_ extends Ir{constructor(t,e){super(),this.core=t,this.logger=e}}let v_=class{constructor(t,e,i){this.core=t,this.logger=e,this.store=i}},b_=class{constructor(t,e){this.projectId=t,this.logger=e}},I_=class{constructor(t,e,i){this.core=t,this.logger=e,this.telemetryEnabled=i}};var A_=Object.defineProperty,P_=(r,t,e)=>t in r?A_(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Uo=(r,t,e)=>P_(r,typeof t!="symbol"?t+"":t,e);let T_=class{constructor(t){this.opts=t,Uo(this,"protocol","wc"),Uo(this,"version",2)}},O_=class{constructor(t){this.client=t}};function ri(r,{strict:t=!0}={}){return!r||typeof r!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(r):r.startsWith("0x")}function Kn(r){return ri(r,{strict:!1})?Math.ceil((r.length-2)/2):r.length}const Jc="2.31.0";let xr={getDocsUrl:({docsBaseUrl:r,docsPath:t="",docsSlug:e})=>t?`${r??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${Jc}`};class sr extends Error{constructor(t,e={}){var c;const i=(()=>{var l;return e.cause instanceof sr?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),n=e.cause instanceof sr&&e.cause.docsPath||e.docsPath,s=(c=xr.getDocsUrl)==null?void 0:c.call(xr,{...e,docsPath:n}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...i?[`Details: ${i}`]:[],...xr.version?[`Version: ${xr.version}`]:[]].join(`
3
+ `);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=i,this.docsPath=n,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=Jc}walk(t){return Yc(this,t)}}function Yc(r,t){return t!=null&&t(r)?r:r&&typeof r=="object"&&"cause"in r&&r.cause!==void 0?Yc(r.cause,t):t?null:r}class Qc extends sr{constructor({size:t,targetSize:e,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function Tr(r,{dir:t,size:e=32}={}){return typeof r=="string"?R_(r,{dir:t,size:e}):D_(r,{dir:t,size:e})}function R_(r,{dir:t,size:e=32}={}){if(e===null)return r;const i=r.replace("0x","");if(i.length>e*2)throw new Qc({size:Math.ceil(i.length/2),targetSize:e,type:"hex"});return`0x${i[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function D_(r,{dir:t,size:e=32}={}){if(e===null)return r;if(r.length>e)throw new Qc({size:r.length,targetSize:e,type:"bytes"});const i=new Uint8Array(e);for(let n=0;n<e;n++){const s=t==="right";i[s?n:e-n-1]=r[s?n:r.length-n-1]}return i}class L_ extends sr{constructor({max:t,min:e,signed:i,size:n,value:s}){super(`Number "${s}" is not in safe ${n?`${n*8}-bit ${i?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class V_ extends sr{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function Or(r,{size:t}){if(Kn(r)>t)throw new V_({givenSize:Kn(r),maxSize:t})}function Fn(r,t={}){const{signed:e}=t;t.size&&Or(r,{size:t.size});const i=BigInt(r);if(!e)return i;const n=(r.length-2)/2,s=(1n<<BigInt(n)*8n-1n)-1n;return i<=s?i:i-BigInt(`0x${"f".padStart(n*2,"f")}`)-1n}function x_(r,t={}){return Number(Fn(r,t))}const S_=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Hn(r,t={}){return typeof r=="number"||typeof r=="bigint"?Xc(r,t):typeof r=="string"?k_(r,t):typeof r=="boolean"?C_(r,t):Zc(r,t)}function C_(r,t={}){const e=`0x${Number(r)}`;return typeof t.size=="number"?(Or(e,{size:t.size}),Tr(e,{size:t.size})):e}function Zc(r,t={}){let e="";for(let n=0;n<r.length;n++)e+=S_[r[n]];const i=`0x${e}`;return typeof t.size=="number"?(Or(i,{size:t.size}),Tr(i,{dir:"right",size:t.size})):i}function Xc(r,t={}){const{signed:e,size:i}=t,n=BigInt(r);let s;i?e?s=(1n<<BigInt(i)*8n-1n)-1n:s=2n**(BigInt(i)*8n)-1n:typeof r=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&n>s||n<o){const l=typeof r=="bigint"?"n":"";throw new L_({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:i,value:`${r}${l}`})}const c=`0x${(e&&n<0?(1n<<BigInt(i*8))+BigInt(n):n).toString(16)}`;return i?Tr(c,{size:i}):c}const $_=new TextEncoder;function k_(r,t={}){const e=$_.encode(r);return Zc(e,t)}const N_=new TextEncoder;function U_(r,t={}){return typeof r=="number"||typeof r=="bigint"?q_(r,t):typeof r=="boolean"?B_(r,t):ri(r)?el(r,t):tl(r,t)}function B_(r,t={}){const e=new Uint8Array(1);return e[0]=Number(r),typeof t.size=="number"?(Or(e,{size:t.size}),Tr(e,{size:t.size})):e}const Et={zero:48,nine:57,A:65,F:70,a:97,f:102};function Bo(r){if(r>=Et.zero&&r<=Et.nine)return r-Et.zero;if(r>=Et.A&&r<=Et.F)return r-(Et.A-10);if(r>=Et.a&&r<=Et.f)return r-(Et.a-10)}function el(r,t={}){let e=r;t.size&&(Or(e,{size:t.size}),e=Tr(e,{dir:"right",size:t.size}));let i=e.slice(2);i.length%2&&(i=`0${i}`);const n=i.length/2,s=new Uint8Array(n);for(let o=0,c=0;o<n;o++){const l=Bo(i.charCodeAt(c++)),u=Bo(i.charCodeAt(c++));if(l===void 0||u===void 0)throw new sr(`Invalid byte sequence ("${i[c-2]}${i[c-1]}" in "${i}").`);s[o]=l*16+u}return s}function q_(r,t){const e=Xc(r,t);return el(e)}function tl(r,t={}){const e=N_.encode(r);return typeof t.size=="number"?(Or(e,{size:t.size}),Tr(e,{dir:"right",size:t.size})):e}const yi=BigInt(2**32-1),qo=BigInt(32);function M_(r,t=!1){return t?{h:Number(r&yi),l:Number(r>>qo&yi)}:{h:Number(r>>qo&yi)|0,l:Number(r&yi)|0}}function z_(r,t=!1){const e=r.length;let i=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=M_(r[s],t);[i[s],n[s]]=[o,c]}return[i,n]}const j_=(r,t,e)=>r<<e|t>>>32-e,K_=(r,t,e)=>t<<e|r>>>32-e,F_=(r,t,e)=>t<<e-32|r>>>64-e,H_=(r,t,e)=>r<<e-32|t>>>64-e,ur=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function W_(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Ki(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function ii(r,...t){if(!W_(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function yI(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Ki(r.outputLen),Ki(r.blockLen)}function Mo(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function G_(r,t){ii(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function J_(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function rl(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function vI(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function bI(r,t){return r<<32-t|r>>>t}const Y_=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Q_(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}function Z_(r){for(let t=0;t<r.length;t++)r[t]=Q_(r[t]);return r}const zo=Y_?r=>r:Z_;function X_(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function il(r){return typeof r=="string"&&(r=X_(r)),ii(r),r}function II(...r){let t=0;for(let i=0;i<r.length;i++){const n=r[i];ii(n),t+=n.length}const e=new Uint8Array(t);for(let i=0,n=0;i<r.length;i++){const s=r[i];e.set(s,n),n+=s.length}return e}class ef{}function tf(r){const t=i=>r().update(il(i)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function AI(r=32){if(ur&&typeof ur.getRandomValues=="function")return ur.getRandomValues(new Uint8Array(r));if(ur&&typeof ur.randomBytes=="function")return Uint8Array.from(ur.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const rf=BigInt(0),Sr=BigInt(1),nf=BigInt(2),sf=BigInt(7),of=BigInt(256),af=BigInt(113),nl=[],sl=[],ol=[];for(let r=0,t=Sr,e=1,i=0;r<24;r++){[e,i]=[i,(2*e+3*i)%5],nl.push(2*(5*i+e)),sl.push((r+1)*(r+2)/2%64);let n=rf;for(let s=0;s<7;s++)t=(t<<Sr^(t>>sf)*af)%of,t&nf&&(n^=Sr<<(Sr<<BigInt(s))-Sr);ol.push(n)}const al=z_(ol,!0),cf=al[0],lf=al[1],jo=(r,t,e)=>e>32?F_(r,t,e):j_(r,t,e),Ko=(r,t,e)=>e>32?H_(r,t,e):K_(r,t,e);function uf(r,t=24){const e=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[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=jo(u,h,1)^e[c],_=Ko(u,h,1)^e[c+1];for(let f=0;f<50;f+=10)r[o+f]^=d,r[o+f+1]^=_}let n=r[2],s=r[3];for(let o=0;o<24;o++){const c=sl[o],l=jo(n,s,c),u=Ko(n,s,c),h=nl[o];n=r[h],s=r[h+1],r[h]=l,r[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=cf[i],r[1]^=lf[i]}rl(e)}class Ks extends ef{constructor(t,e,i,n=!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=i,this.enableXOF=n,this.rounds=s,Ki(i),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=J_(this.state)}clone(){return this._cloneInto()}keccak(){zo(this.state32),uf(this.state32,this.rounds),zo(this.state32),this.posOut=0,this.pos=0}update(t){Mo(this),t=il(t),ii(t);const{blockLen:e,state:i}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)i[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:i,blockLen:n}=this;t[i]^=e,e&128&&i===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){Mo(this,!1),ii(t),this.finish();const e=this.state,{blockLen:i}=this;for(let n=0,s=t.length;n<s;){this.posOut>=i&&this.keccak();const o=Math.min(i-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=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 Ki(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(G_(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,rl(this.state)}_cloneInto(t){const{blockLen:e,suffix:i,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Ks(e,i,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=i,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}}const hf=(r,t,e)=>tf(()=>new Ks(t,r,e)),df=hf(1,136,256/8);function cl(r,t){const e=t||"hex",i=df(ri(r,{strict:!1})?U_(r):r);return e==="bytes"?i:Hn(i)}class _f 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 i=this.keys().next().value;i&&this.delete(i)}return this}}const gn=new _f(8192);function ff(r,t){if(gn.has(`${r}.${t}`))return gn.get(`${r}.${t}`);const e=r.substring(2).toLowerCase(),i=cl(tl(e),"bytes"),n=e.split("");for(let o=0;o<40;o+=2)i[o>>1]>>4>=8&&n[o]&&(n[o]=n[o].toUpperCase()),(i[o>>1]&15)>=8&&n[o+1]&&(n[o+1]=n[o+1].toUpperCase());const s=`0x${n.join("")}`;return gn.set(`${r}.${t}`,s),s}function pf(r){const t=cl(`0x${r.substring(4)}`).substring(26);return ff(`0x${t}`)}async function wf({hash:r,signature:t}){const e=ri(r)?r:Hn(r),{secp256k1:i}=await a(async()=>{const{secp256k1:o}=await import("./secp256k1-CpwTLmAw.js");return{secp256k1:o}},__vite__mapDeps([26,2,1,12,18,7,8,19,20,21,22,9,16,17,13]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:h,v:d,yParity:_}=t,f=Number(_??d),p=Fo(f);return new i.Signature(Fn(u),Fn(h)).addRecoveryBit(p)}const o=ri(t)?t:Hn(t);if(Kn(o)!==65)throw new Error("invalid signature length");const c=x_(`0x${o.slice(130)}`),l=Fo(c);return i.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function Fo(r){if(r===0||r===1)return r;if(r===27)return 0;if(r===28)return 1;throw new Error("Invalid yParityOrV value")}async function gf({hash:r,signature:t}){return pf(await wf({hash:r,signature:t}))}function mf(r){const t=r.length;let e=0,i=0;for(;i<t;){let n=r.charCodeAt(i++);if(n&4294967168)if(!(n&4294965248))e+=2;else{if(n>=55296&&n<=56319&&i<t){const s=r.charCodeAt(i);(s&64512)===56320&&(++i,n=((n&1023)<<10)+(s&1023)+65536)}n&4294901760?e+=4:e+=3}else{e++;continue}}return e}function Ef(r,t,e){const i=r.length;let n=e,s=0;for(;s<i;){let o=r.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))t[n++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<i){const c=r.charCodeAt(s);(c&64512)===56320&&(++s,o=((o&1023)<<10)+(c&1023)+65536)}o&4294901760?(t[n++]=o>>18&7|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128):(t[n++]=o>>12&15|224,t[n++]=o>>6&63|128)}else{t[n++]=o;continue}t[n++]=o&63|128}}const yf=new TextEncoder,vf=50;function bf(r,t,e){yf.encodeInto(r,t.subarray(e))}function If(r,t,e){r.length>vf?bf(r,t,e):Ef(r,t,e)}const Af=4096;function ll(r,t,e){let i=t;const n=i+e,s=[];let o="";for(;i<n;){const c=r[i++];if(!(c&128))s.push(c);else if((c&224)===192){const l=r[i++]&63;s.push((c&31)<<6|l)}else if((c&240)===224){const l=r[i++]&63,u=r[i++]&63;s.push((c&31)<<12|l<<6|u)}else if((c&248)===240){const l=r[i++]&63,u=r[i++]&63,h=r[i++]&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>=Af&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const Pf=new TextDecoder,Tf=200;function Of(r,t,e){const i=r.subarray(t,t+e);return Pf.decode(i)}function Rf(r,t,e){return e>Tf?Of(r,t,e):ll(r,t,e)}class vi{constructor(t,e){this.type=t,this.data=e}}class Ke extends Error{constructor(t){super(t);const e=Object.create(Ke.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:Ke.name})}}const Cr=4294967295;function Df(r,t,e){const i=e/4294967296,n=e;r.setUint32(t,i),r.setUint32(t+4,n)}function ul(r,t,e){const i=Math.floor(e/4294967296),n=e;r.setUint32(t,i),r.setUint32(t+4,n)}function hl(r,t){const e=r.getInt32(t),i=r.getUint32(t+4);return e*4294967296+i}function Lf(r,t){const e=r.getUint32(t),i=r.getUint32(t+4);return e*4294967296+i}const Vf=-1,xf=4294967296-1,Sf=17179869184-1;function Cf({sec:r,nsec:t}){if(r>=0&&t>=0&&r<=Sf)if(t===0&&r<=xf){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,r),e}else{const e=r/4294967296,i=r&4294967295,n=new Uint8Array(8),s=new DataView(n.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,i),n}else{const e=new Uint8Array(12),i=new DataView(e.buffer);return i.setUint32(0,t),ul(i,4,r),e}}function $f(r){const t=r.getTime(),e=Math.floor(t/1e3),i=(t-e*1e3)*1e6,n=Math.floor(i/1e9);return{sec:e+n,nsec:i-n*1e9}}function kf(r){if(r instanceof Date){const t=$f(r);return Cf(t)}else return null}function Nf(r){const t=new DataView(r.buffer,r.byteOffset,r.byteLength);switch(r.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),i=t.getUint32(4),n=(e&3)*4294967296+i,s=e>>>2;return{sec:n,nsec:s}}case 12:{const e=hl(t,4),i=t.getUint32(0);return{sec:e,nsec:i}}default:throw new Ke(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${r.length}`)}}function Uf(r){const t=Nf(r);return new Date(t.sec*1e3+t.nsec/1e6)}const Bf={type:Vf,encode:kf,decode:Uf};class Fi{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Bf)}register({type:t,encode:e,decode:i}){if(t>=0)this.encoders[t]=e,this.decoders[t]=i;else{const n=-1-t;this.builtInEncoders[n]=e,this.builtInDecoders[n]=i}}tryToEncode(t,e){for(let i=0;i<this.builtInEncoders.length;i++){const n=this.builtInEncoders[i];if(n!=null){const s=n(t,e);if(s!=null){const o=-1-i;return new vi(o,s)}}}for(let i=0;i<this.encoders.length;i++){const n=this.encoders[i];if(n!=null){const s=n(t,e);if(s!=null){const o=i;return new vi(o,s)}}}return t instanceof vi?t:null}decode(t,e,i){const n=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return n?n(t,e,i):new vi(e,t)}}Fi.defaultCodec=new Fi;function qf(r){return r instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&r instanceof SharedArrayBuffer}function Wn(r){return r instanceof Uint8Array?r:ArrayBuffer.isView(r)?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):qf(r)?new Uint8Array(r):Uint8Array.from(r)}const Mf=100,zf=2048;class Fs{constructor(t){this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Fi.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??Mf,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??zf,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new Fs({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),i=new Uint8Array(e),n=new DataView(e);i.set(this.bytes),this.view=n,this.bytes=i}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 i=mf(t);this.ensureBufferSizeToWrite(5+i),this.writeStringHeader(i),If(t,this.bytes,this.pos),this.pos+=i}encodeObject(t,e){const i=this.extensionCodec.tryToEncode(t,this.context);if(i!=null)this.encodeExtension(i);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 i=Wn(t);this.writeU8a(i)}encodeArray(t,e){const i=t.length;if(i<16)this.writeU8(144+i);else if(i<65536)this.writeU8(220),this.writeU16(i);else if(i<4294967296)this.writeU8(221),this.writeU32(i);else throw new Error(`Too large array: ${i}`);for(const n of t)this.doEncode(n,e+1)}countWithoutUndefined(t,e){let i=0;for(const n of e)t[n]!==void 0&&i++;return i}encodeMap(t,e){const i=Object.keys(t);this.sortKeys&&i.sort();const n=this.ignoreUndefined?this.countWithoutUndefined(t,i):i.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw new Error(`Too large map object: ${n}`);for(const s of i){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 i=t.data(this.pos+6),n=i.length;if(n>=4294967296)throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n),this.writeI8(t.type),this.writeU8a(i);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),Df(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),ul(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 jf(r,t){return new Fs(t).encodeSharedRef(r)}function mn(r){return`${r<0?"-":""}0x${Math.abs(r).toString(16).padStart(2,"0")}`}const Kf=16,Ff=16;class Hf{constructor(t=Kf,e=Ff){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let i=0;i<this.maxKeyLength;i++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,i){const n=this.caches[i-1];e:for(const s of n){const o=s.bytes;for(let c=0;c<i;c++)if(o[c]!==t[e+c])continue e;return s.str}return null}store(t,e){const i=this.caches[t.length-1],n={bytes:t,str:e};i.length>=this.maxLengthPerKey?i[Math.random()*i.length|0]=n:i.push(n)}decode(t,e,i){const n=this.find(t,e,i);if(n!=null)return this.hit++,n;this.miss++;const s=ll(t,e,i),o=Uint8Array.prototype.slice.call(t,e,e+i);return this.store(o,s),s}}const Gn="array",Gr="map_key",dl="map_value",Wf=r=>{if(typeof r=="string"||typeof r=="number")return r;throw new Ke("The type of key must be string or number but "+typeof r)};class Gf{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=Gn,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Gr,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===Gn){const i=t;i.size=0,i.array=void 0,i.position=0,i.type=void 0}if(t.type===Gr||t.type===dl){const i=t;i.size=0,i.map=void 0,i.readCount=0,i.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const $r=-1,Hs=new DataView(new ArrayBuffer(0)),Jf=new Uint8Array(Hs.buffer);try{Hs.getInt8(0)}catch(r){if(!(r 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 Ho=new RangeError("Insufficient data"),Yf=new Hf;class Ws{constructor(t){this.totalPos=0,this.pos=0,this.view=Hs,this.bytes=Jf,this.headByte=$r,this.stack=new Gf,this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Fi.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??Cr,this.maxBinLength=(t==null?void 0:t.maxBinLength)??Cr,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??Cr,this.maxMapLength=(t==null?void 0:t.maxMapLength)??Cr,this.maxExtLength=(t==null?void 0:t.maxExtLength)??Cr,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:Yf,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??Wf}clone(){return new Ws({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=$r,this.stack.reset()}setBuffer(t){const e=Wn(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===$r&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),i=Wn(t),n=new Uint8Array(e.length+i.length);n.set(e),n.set(i,e.length),this.setBuffer(n)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:i}=this;return new RangeError(`Extra ${e.byteLength-i} 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,i;for await(const c of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(c);try{i=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 i}const{headByte:n,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${mn(n)} 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 i=e,n=-1;for await(const s of t){if(e&&n===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),i&&(n=this.readArraySize(),i=!1,this.complete());try{for(;yield this.doDecodeSync(),--n!==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 n=t-128;if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t<160){const n=t-144;if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else{const n=t-160;e=this.decodeString(n,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 n=this.lookU8();e=this.decodeString(n,1)}else if(t===218){const n=this.lookU16();e=this.decodeString(n,2)}else if(t===219){const n=this.lookU32();e=this.decodeString(n,4)}else if(t===220){const n=this.readU16();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===221){const n=this.readU32();if(n!==0){this.pushArrayState(n),this.complete();continue e}else e=[]}else if(t===222){const n=this.readU16();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===223){const n=this.readU32();if(n!==0){this.pushMapState(n),this.complete();continue e}else e={}}else if(t===196){const n=this.lookU8();e=this.decodeBinary(n,1)}else if(t===197){const n=this.lookU16();e=this.decodeBinary(n,2)}else if(t===198){const n=this.lookU32();e=this.decodeBinary(n,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 n=this.lookU8();e=this.decodeExtension(n,1)}else if(t===200){const n=this.lookU16();e=this.decodeExtension(n,2)}else if(t===201){const n=this.lookU32();e=this.decodeExtension(n,4)}else throw new Ke(`Unrecognized type byte: ${mn(t)}`);this.complete();const i=this.stack;for(;i.length>0;){const n=i.top();if(n.type===Gn)if(n.array[n.position]=e,n.position++,n.position===n.size)e=n.array,i.release(n);else continue e;else if(n.type===Gr){if(e==="__proto__")throw new Ke("The key __proto__ is not allowed");n.key=this.mapKeyConverter(e),n.type=dl;continue e}else if(n.map[n.key]=e,n.readCount++,n.readCount===n.size)e=n.map,i.release(n);else{n.key=null,n.type=Gr;continue e}}return e}}readHeadByte(){return this.headByte===$r&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=$r}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 Ke(`Unrecognized array type byte: ${mn(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new Ke(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new Ke(`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){var s;if(t>this.maxStrLength)throw new Ke(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw Ho;const i=this.pos+e;let n;return this.stateIsMapKey()&&((s=this.keyDecoder)!=null&&s.canBeCached(t))?n=this.keyDecoder.decode(this.bytes,i,t):n=Rf(this.bytes,i,t),this.pos+=e+t,n}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Gr:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new Ke(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw Ho;const i=this.pos+e,n=this.bytes.subarray(i,i+t);return this.pos+=e+t,n}decodeExtension(t,e){if(t>this.maxExtLength)throw new Ke(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const i=this.view.getInt8(this.pos+e),n=this.decodeBinary(t,e+1);return this.extensionCodec.decode(n,i,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=Lf(this.view,this.pos);return this.pos+=8,t}readI64(){const t=hl(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 Qf(r,t){return new Ws(t).decode(r)}var Zf={};const Xf=":";function Vi(r){const[t,e]=r.split(Xf);return{namespace:t,reference:e}}function _l(r,t){return r.includes(":")?[r]:t.chains||[]}var ep=Object.defineProperty,tp=Object.defineProperties,rp=Object.getOwnPropertyDescriptors,Wo=Object.getOwnPropertySymbols,ip=Object.prototype.hasOwnProperty,np=Object.prototype.propertyIsEnumerable,Jn=(r,t,e)=>t in r?ep(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Go=(r,t)=>{for(var e in t||(t={}))ip.call(t,e)&&Jn(r,e,t[e]);if(Wo)for(var e of Wo(t))np.call(t,e)&&Jn(r,e,t[e]);return r},sp=(r,t)=>tp(r,rp(t)),Jo=(r,t,e)=>Jn(r,typeof t!="symbol"?t+"":t,e);const op="ReactNative",Fe={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},ap="js";function Hi(){return typeof Kt<"u"&&typeof Kt.versions<"u"&&typeof Kt.versions.node<"u"}function Wt(){return!Ot.getDocument()&&!!Ot.getNavigator()&&navigator.product===op}function cp(){return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="android"}function lp(){return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"&&(K==null?void 0:K.Platform.OS)==="ios"}function Rr(){return!Hi()&&!!Ot.getNavigator()&&!!Ot.getDocument()}function di(){return Wt()?Fe.reactNative:Hi()?Fe.node:Rr()?Fe.browser:Fe.unknown}function Yo(){var r;try{return Wt()&&typeof K<"u"&&typeof(K==null?void 0:K.Application)<"u"?(r=K.Application)==null?void 0:r.applicationId:void 0}catch{return}}function up(r,t){const e=new URLSearchParams(r);for(const i of Object.keys(t).sort())if(t.hasOwnProperty(i)){const n=t[i];n!==void 0&&e.set(i,n)}return e.toString()}function hp(r){var t,e;const i=fl();try{return r!=null&&r.url&&i.url&&new URL(r.url).host!==new URL(i.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${r.url} differs from the actual page url:${i.url}. This is probably unintended and can lead to issues.`),r.url=i.url),(t=r==null?void 0:r.icons)!=null&&t.length&&r.icons.length>0&&(r.icons=r.icons.filter(n=>n!=="")),sp(Go(Go({},i),r),{url:(r==null?void 0:r.url)||i.url,name:(r==null?void 0:r.name)||i.name,description:(r==null?void 0:r.description)||i.description,icons:(e=r==null?void 0:r.icons)!=null&&e.length&&r.icons.length>0?r.icons:i.icons})}catch(n){return console.warn("Error populating app metadata",n),r||i}}function fl(){return Lh.getWindowMetadata()||{name:"",description:"",url:"",icons:[""]}}function dp(){if(di()===Fe.reactNative&&typeof K<"u"&&typeof(K==null?void 0:K.Platform)<"u"){const{OS:e,Version:i}=K.Platform;return[e,i].join("-")}const r=xh();if(r===null)return"unknown";const t=r.os?r.os.replace(" ","").toLowerCase():"unknown";return r.type==="browser"?[t,r.name,r.version].join("-"):[t,r.version].join("-")}function _p(){var r;const t=di();return t===Fe.browser?[t,((r=Ot.getLocation())==null?void 0:r.host)||"unknown"].join(":"):t}function pl(r,t,e){const i=dp(),n=_p();return[[r,t].join("-"),[ap,e].join("-"),i,n].join("/")}function fp({protocol:r,version:t,relayUrl:e,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:c,packageName:l}){const u=e.split("?"),h=pl(r,t,i),d={auth:n,ua:h,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:c||void 0},_=up(u[1]||"",d);return u[0]+"?"+_}function Xt(r,t){return r.filter(e=>t.includes(e)).length===r.length}function Yn(r){return Object.fromEntries(r.entries())}function Qn(r){return new Map(Object.entries(r))}function Yt(r=B.FIVE_MINUTES,t){const e=B.toMiliseconds(r||B.FIVE_MINUTES);let i,n,s,o;return{resolve:c=>{s&&i&&(clearTimeout(s),i(c),o=Promise.resolve(c))},reject:c=>{s&&n&&(clearTimeout(s),n(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),i=c,n=l})}}function pt(r,t,e){return new Promise(async(i,n)=>{const s=setTimeout(()=>n(new Error(e)),t);try{const o=await r;i(o)}catch(o){n(o)}clearTimeout(s)})}function wl(r,t){if(typeof t=="string"&&t.startsWith(`${r}:`))return t;if(r.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(r.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: ${r}`)}function pp(r){return wl("topic",r)}function wp(r){return wl("id",r)}function gl(r){const[t,e]=r.split(":"),i={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")i.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))i.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return i}function fe(r,t){return B.fromMiliseconds(Date.now()+B.toMiliseconds(r))}function Ut(r){return Date.now()>=B.toMiliseconds(r)}function ee(r,t){return`${r}${t?`:${t}`:""}`}function ir(r=[],t=[]){return[...new Set([...r,...t])]}async function gp({id:r,topic:t,wcDeepLink:e}){var i;try{if(!e)return;const n=typeof e=="string"?JSON.parse(e):e,s=n==null?void 0:n.href;if(typeof s!="string")return;const o=mp(s,r,t),c=di();if(c===Fe.browser){if(!((i=Ot.getDocument())!=null&&i.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Ep(o)}else c===Fe.reactNative&&typeof(K==null?void 0:K.Linking)<"u"&&await K.Linking.openURL(o)}catch(n){console.error(n)}}function mp(r,t,e){const i=`requestId=${t}&sessionTopic=${e}`;r.endsWith("/")&&(r=r.slice(0,-1));let n=`${r}`;if(r.startsWith("https://t.me")){const s=r.includes("?")?"&startapp=":"?startapp=";n=`${n}${s}${Ip(i,!0)}`}else n=`${n}/wc?${i}`;return n}function Ep(r){let t="_self";bp()?t="_top":(vp()||r.startsWith("https://")||r.startsWith("http://"))&&(t="_blank"),window.open(r,t,"noreferrer noopener")}async function yp(r,t){let e="";try{if(Rr()&&(e=localStorage.getItem(t),e))return e;e=await r.getItem(t)}catch(i){console.error(i)}return e}function Qo(r,t){if(!r.includes(t))return null;const e=r.split(/([&,?,=])/),i=e.indexOf(t);return e[i+2]}function Zo(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,r=>{const t=Math.random()*16|0;return(r==="x"?t:t&3|8).toString(16)})}function Gs(){return typeof Kt<"u"&&Zf.IS_VITEST==="true"}function vp(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function bp(){try{return window.self!==window.top}catch{return!1}}function Ip(r,t=!1){const e=X.from(r).toString("base64");return t?e.replace(/[=]/g,""):e}function ml(r){return X.from(r,"base64").toString("utf-8")}function Ap(r){return new Promise(t=>setTimeout(t,r))}let Pp=class{constructor({limit:t}){Jo(this,"limit"),Jo(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 bi=BigInt(2**32-1),Xo=BigInt(32);function El(r,t=!1){return t?{h:Number(r&bi),l:Number(r>>Xo&bi)}:{h:Number(r>>Xo&bi)|0,l:Number(r&bi)|0}}function yl(r,t=!1){const e=r.length;let i=new Uint32Array(e),n=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:c}=El(r[s],t);[i[s],n[s]]=[o,c]}return[i,n]}const ea=(r,t,e)=>r>>>e,ta=(r,t,e)=>r<<32-e|t>>>e,Bt=(r,t,e)=>r>>>e|t<<32-e,qt=(r,t,e)=>r<<32-e|t>>>e,Kr=(r,t,e)=>r<<64-e|t>>>e-32,Fr=(r,t,e)=>r>>>e-32|t<<64-e,Tp=(r,t)=>t,Op=(r,t)=>r,Rp=(r,t,e)=>r<<e|t>>>32-e,Dp=(r,t,e)=>t<<e|r>>>32-e,Lp=(r,t,e)=>t<<e-32|r>>>64-e,Vp=(r,t,e)=>r<<e-32|t>>>64-e;function nt(r,t,e,i){const n=(t>>>0)+(i>>>0);return{h:r+e+(n/2**32|0)|0,l:n|0}}const Js=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),Ys=(r,t,e,i)=>t+e+i+(r/2**32|0)|0,xp=(r,t,e,i)=>(r>>>0)+(t>>>0)+(e>>>0)+(i>>>0),Sp=(r,t,e,i,n)=>t+e+i+n+(r/2**32|0)|0,Cp=(r,t,e,i,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(i>>>0)+(n>>>0),$p=(r,t,e,i,n,s)=>t+e+i+n+s+(r/2**32|0)|0,hr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Qs(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Rt(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function et(r,...t){if(!Qs(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function Zs(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Rt(r.outputLen),Rt(r.blockLen)}function Ht(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Xs(r,t){et(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function ni(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function tt(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function En(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}function lt(r,t){return r<<32-t|r>>>t}const vl=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function bl(r){return r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255}const bt=vl?r=>r:r=>bl(r);function kp(r){for(let t=0;t<r.length;t++)r[t]=bl(r[t]);return r}const Mt=vl?r=>r:kp,Il=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Np=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function si(r){if(et(r),Il)return r.toHex();let t="";for(let e=0;e<r.length;e++)t+=Np[r[e]];return t}const yt={_0:48,_9:57,A:65,F:70,a:97,f:102};function ra(r){if(r>=yt._0&&r<=yt._9)return r-yt._0;if(r>=yt.A&&r<=yt.F)return r-(yt.A-10);if(r>=yt.a&&r<=yt.f)return r-(yt.a-10)}function eo(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);if(Il)return Uint8Array.fromHex(r);const t=r.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const i=new Uint8Array(e);for(let n=0,s=0;n<e;n++,s+=2){const o=ra(r.charCodeAt(s)),c=ra(r.charCodeAt(s+1));if(o===void 0||c===void 0){const l=r[s]+r[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}i[n]=o*16+c}return i}function Up(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function at(r){return typeof r=="string"&&(r=Up(r)),et(r),r}function er(...r){let t=0;for(let i=0;i<r.length;i++){const n=r[i];et(n),t+=n.length}const e=new Uint8Array(t);for(let i=0,n=0;i<r.length;i++){const s=r[i];e.set(s,n),n+=s.length}return e}class Xi{}function _i(r){const t=i=>r().update(at(i)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Bp(r){const t=(i,n)=>r(n).update(at(i)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=i=>r(i),t}function Dr(r=32){if(hr&&typeof hr.getRandomValues=="function")return hr.getRandomValues(new Uint8Array(r));if(hr&&typeof hr.randomBytes=="function")return Uint8Array.from(hr.randomBytes(r));throw new Error("crypto.getRandomValues must be defined")}const qp=BigInt(0),kr=BigInt(1),Mp=BigInt(2),zp=BigInt(7),jp=BigInt(256),Kp=BigInt(113),Al=[],Pl=[],Tl=[];for(let r=0,t=kr,e=1,i=0;r<24;r++){[e,i]=[i,(2*e+3*i)%5],Al.push(2*(5*i+e)),Pl.push((r+1)*(r+2)/2%64);let n=qp;for(let s=0;s<7;s++)t=(t<<kr^(t>>zp)*Kp)%jp,t&Mp&&(n^=kr<<(kr<<BigInt(s))-kr);Tl.push(n)}const Ol=yl(Tl,!0),Fp=Ol[0],Hp=Ol[1],ia=(r,t,e)=>e>32?Lp(r,t,e):Rp(r,t,e),na=(r,t,e)=>e>32?Vp(r,t,e):Dp(r,t,e);function Wp(r,t=24){const e=new Uint32Array(10);for(let i=24-t;i<24;i++){for(let o=0;o<10;o++)e[o]=r[o]^r[o+10]^r[o+20]^r[o+30]^r[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=ia(u,h,1)^e[c],_=na(u,h,1)^e[c+1];for(let f=0;f<50;f+=10)r[o+f]^=d,r[o+f+1]^=_}let n=r[2],s=r[3];for(let o=0;o<24;o++){const c=Pl[o],l=ia(n,s,c),u=na(n,s,c),h=Al[o];n=r[h],s=r[h+1],r[h]=l,r[h+1]=u}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)e[c]=r[o+c];for(let c=0;c<10;c++)r[o+c]^=~e[(c+2)%10]&e[(c+4)%10]}r[0]^=Fp[i],r[1]^=Hp[i]}tt(e)}let Gp=class Rl extends Xi{constructor(t,e,i,n=!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=i,this.enableXOF=n,this.rounds=s,Rt(i),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=ni(this.state)}clone(){return this._cloneInto()}keccak(){Mt(this.state32),Wp(this.state32,this.rounds),Mt(this.state32),this.posOut=0,this.pos=0}update(t){Ht(this),t=at(t),et(t);const{blockLen:e,state:i}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(e-this.pos,n-s);for(let c=0;c<o;c++)i[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:i,blockLen:n}=this;t[i]^=e,e&128&&i===n-1&&this.keccak(),t[n-1]^=128,this.keccak()}writeInto(t){Ht(this,!1),et(t),this.finish();const e=this.state,{blockLen:i}=this;for(let n=0,s=t.length;n<s;){this.posOut>=i&&this.keccak();const o=Math.min(i-this.posOut,s-n);t.set(e.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=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(Xs(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,tt(this.state)}_cloneInto(t){const{blockLen:e,suffix:i,outputLen:n,rounds:s,enableXOF:o}=this;return t||(t=new Rl(e,i,n,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=i,t.outputLen=n,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Jp=(r,t,e)=>_i(()=>new Gp(t,r,e)),Yp=Jp(1,136,256/8);function Qp(r,t,e,i){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,i);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s),l=i?4:0,u=i?0:4;r.setUint32(t+l,o,i),r.setUint32(t+u,c,i)}function Zp(r,t,e){return r&t^~r&e}function Xp(r,t,e){return r&t^r&e^t&e}let Dl=class extends Xi{constructor(t,e,i,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=i,this.isLE=n,this.buffer=new Uint8Array(t),this.view=En(this.buffer)}update(t){Ht(this),t=at(t),et(t);const{view:e,buffer:i,blockLen:n}=this,s=t.length;for(let o=0;o<s;){const c=Math.min(n-this.pos,s-o);if(c===n){const l=En(t);for(;n<=s-o;o+=n)this.process(l,o);continue}i.set(t.subarray(o,o+c),this.pos),this.pos+=c,o+=c,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ht(this),Xs(t,this),this.finished=!0;const{buffer:e,view:i,blockLen:n,isLE:s}=this;let{pos:o}=this;e[o++]=128,tt(this.buffer.subarray(o)),this.padOffset>n-o&&(this.process(i,0),o=0);for(let d=o;d<n;d++)e[d]=0;Qp(i,n-8,BigInt(this.length*8),s),this.process(i,0);const c=En(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 i=t.slice(0,e);return this.destroy(),i}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:i,length:n,finished:s,destroyed:o,pos:c}=this;return t.destroyed=o,t.finished=s,t.length=n,t.pos=c,n%e&&t.buffer.set(i),t}clone(){return this._cloneInto()}};const Lt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ie=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]),ew=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 tw=class extends Dl{constructor(t=32){super(64,t,8,!1),this.A=Lt[0]|0,this.B=Lt[1]|0,this.C=Lt[2]|0,this.D=Lt[3]|0,this.E=Lt[4]|0,this.F=Lt[5]|0,this.G=Lt[6]|0,this.H=Lt[7]|0}get(){const{A:t,B:e,C:i,D:n,E:s,F:o,G:c,H:l}=this;return[t,e,i,n,s,o,c,l]}set(t,e,i,n,s,o,c,l){this.A=t|0,this.B=e|0,this.C=i|0,this.D=n|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 _=Vt[d-15],f=Vt[d-2],p=lt(_,7)^lt(_,18)^_>>>3,w=lt(f,17)^lt(f,19)^f>>>10;Vt[d]=w+Vt[d-7]+p+Vt[d-16]|0}let{A:i,B:n,C:s,D:o,E:c,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const _=lt(c,6)^lt(c,11)^lt(c,25),f=h+_+Zp(c,l,u)+ew[d]+Vt[d]|0,p=(lt(i,2)^lt(i,13)^lt(i,22))+Xp(i,n,s)|0;h=u,u=l,l=c,c=o+f|0,o=s,s=n,n=i,i=f+p|0}i=i+this.A|0,n=n+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(i,n,s,o,c,l,u,h)}roundClean(){tt(Vt)}destroy(){this.set(0,0,0,0,0,0,0,0),tt(this.buffer)}};const Ll=yl(["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(r=>BigInt(r))),rw=Ll[0],iw=Ll[1],xt=new Uint32Array(80),St=new Uint32Array(80);let to=class extends Dl{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:i,Bl:n,Ch:s,Cl:o,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:_,Gh:f,Gl:p,Hh:w,Hl:g}=this;return[t,e,i,n,s,o,c,l,u,h,d,_,f,p,w,g]}set(t,e,i,n,s,o,c,l,u,h,d,_,f,p,w,g){this.Ah=t|0,this.Al=e|0,this.Bh=i|0,this.Bl=n|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=_|0,this.Gh=f|0,this.Gl=p|0,this.Hh=w|0,this.Hl=g|0}process(t,e){for(let v=0;v<16;v++,e+=4)xt[v]=t.getUint32(e),St[v]=t.getUint32(e+=4);for(let v=16;v<80;v++){const O=xt[v-15]|0,P=St[v-15]|0,E=Bt(O,P,1)^Bt(O,P,8)^ea(O,P,7),D=qt(O,P,1)^qt(O,P,8)^ta(O,P,7),R=xt[v-2]|0,m=St[v-2]|0,y=Bt(R,m,19)^Kr(R,m,61)^ea(R,m,6),b=qt(R,m,19)^Fr(R,m,61)^ta(R,m,6),I=xp(D,b,St[v-7],St[v-16]),L=Sp(I,E,y,xt[v-7],xt[v-16]);xt[v]=L|0,St[v]=I|0}let{Ah:i,Al:n,Bh:s,Bl:o,Ch:c,Cl:l,Dh:u,Dl:h,Eh:d,El:_,Fh:f,Fl:p,Gh:w,Gl:g,Hh:A,Hl:V}=this;for(let v=0;v<80;v++){const O=Bt(d,_,14)^Bt(d,_,18)^Kr(d,_,41),P=qt(d,_,14)^qt(d,_,18)^Fr(d,_,41),E=d&f^~d&w,D=_&p^~_&g,R=Cp(V,P,D,iw[v],St[v]),m=$p(R,A,O,E,rw[v],xt[v]),y=R|0,b=Bt(i,n,28)^Kr(i,n,34)^Kr(i,n,39),I=qt(i,n,28)^Fr(i,n,34)^Fr(i,n,39),L=i&s^i&c^s&c,T=n&o^n&l^o&l;A=w|0,V=g|0,w=f|0,g=p|0,f=d|0,p=_|0,{h:d,l:_}=nt(u|0,h|0,m|0,y|0),u=c|0,h=l|0,c=s|0,l=o|0,s=i|0,o=n|0;const x=Js(y,I,T);i=Ys(x,m,b,L),n=x|0}({h:i,l:n}=nt(this.Ah|0,this.Al|0,i|0,n|0)),{h:s,l:o}=nt(this.Bh|0,this.Bl|0,s|0,o|0),{h:c,l}=nt(this.Ch|0,this.Cl|0,c|0,l|0),{h:u,l:h}=nt(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l:_}=nt(this.Eh|0,this.El|0,d|0,_|0),{h:f,l:p}=nt(this.Fh|0,this.Fl|0,f|0,p|0),{h:w,l:g}=nt(this.Gh|0,this.Gl|0,w|0,g|0),{h:A,l:V}=nt(this.Hh|0,this.Hl|0,A|0,V|0),this.set(i,n,s,o,c,l,u,h,d,_,f,p,w,g,A,V)}roundClean(){tt(xt,St)}destroy(){tt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},nw=class extends to{constructor(){super(48),this.Ah=Ie[0]|0,this.Al=Ie[1]|0,this.Bh=Ie[2]|0,this.Bl=Ie[3]|0,this.Ch=Ie[4]|0,this.Cl=Ie[5]|0,this.Dh=Ie[6]|0,this.Dl=Ie[7]|0,this.Eh=Ie[8]|0,this.El=Ie[9]|0,this.Fh=Ie[10]|0,this.Fl=Ie[11]|0,this.Gh=Ie[12]|0,this.Gl=Ie[13]|0,this.Hh=Ie[14]|0,this.Hl=Ie[15]|0}};const Pe=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class sw extends to{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 en=_i(()=>new tw),ow=_i(()=>new to),aw=_i(()=>new nw),cw=_i(()=>new sw),lw=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]),_e=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),M=new Uint32Array(32);function Ct(r,t,e,i,n,s){const o=n[s],c=n[s+1];let l=M[2*r],u=M[2*r+1],h=M[2*t],d=M[2*t+1],_=M[2*e],f=M[2*e+1],p=M[2*i],w=M[2*i+1],g=Js(l,h,o);u=Ys(g,u,d,c),l=g|0,{Dh:w,Dl:p}={Dh:w^u,Dl:p^l},{Dh:w,Dl:p}={Dh:Tp(w,p),Dl:Op(w)},{h:f,l:_}=nt(f,_,w,p),{Bh:d,Bl:h}={Bh:d^f,Bl:h^_},{Bh:d,Bl:h}={Bh:Bt(d,h,24),Bl:qt(d,h,24)},M[2*r]=l,M[2*r+1]=u,M[2*t]=h,M[2*t+1]=d,M[2*e]=_,M[2*e+1]=f,M[2*i]=p,M[2*i+1]=w}function $t(r,t,e,i,n,s){const o=n[s],c=n[s+1];let l=M[2*r],u=M[2*r+1],h=M[2*t],d=M[2*t+1],_=M[2*e],f=M[2*e+1],p=M[2*i],w=M[2*i+1],g=Js(l,h,o);u=Ys(g,u,d,c),l=g|0,{Dh:w,Dl:p}={Dh:w^u,Dl:p^l},{Dh:w,Dl:p}={Dh:Bt(w,p,16),Dl:qt(w,p,16)},{h:f,l:_}=nt(f,_,w,p),{Bh:d,Bl:h}={Bh:d^f,Bl:h^_},{Bh:d,Bl:h}={Bh:Kr(d,h,63),Bl:Fr(d,h,63)},M[2*r]=l,M[2*r+1]=u,M[2*t]=h,M[2*t+1]=d,M[2*e]=_,M[2*e+1]=f,M[2*i]=p,M[2*i+1]=w}function uw(r,t={},e,i,n){if(Rt(e),r<0||r>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!==i)throw new Error("salt must be undefined or "+i);if(c!==void 0&&c.length!==n)throw new Error("personalization must be undefined or "+n)}class hw extends Xi{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=ni(this.buffer)}update(t){Ht(this),t=at(t),et(t);const{blockLen:e,buffer:i,buffer32:n}=this,s=t.length,o=t.byteOffset,c=t.buffer;for(let l=0;l<s;){this.pos===e&&(Mt(n),this.compress(n,0,!1),Mt(n),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));Mt(d);for(let _=0;l+e<s;_+=n.length,l+=e)this.length+=e,this.compress(d,_,!1);Mt(d);continue}i.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){Ht(this),Xs(t,this);const{pos:e,buffer32:i}=this;this.finished=!0,tt(this.buffer.subarray(e)),Mt(i),this.compress(i,0,!0),Mt(i);const n=ni(t);this.get().forEach((s,o)=>n[o]=bt(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const i=t.slice(0,e);return this.destroy(),i}_cloneInto(t){const{buffer:e,length:i,finished:n,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=n,t.length=i,t.pos=c,t.outputLen=o,t}clone(){return this._cloneInto()}}class dw extends hw{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=_e[0]|0,this.v0h=_e[1]|0,this.v1l=_e[2]|0,this.v1h=_e[3]|0,this.v2l=_e[4]|0,this.v2h=_e[5]|0,this.v3l=_e[6]|0,this.v3h=_e[7]|0,this.v4l=_e[8]|0,this.v4h=_e[9]|0,this.v5l=_e[10]|0,this.v5h=_e[11]|0,this.v6l=_e[12]|0,this.v6h=_e[13]|0,this.v7l=_e[14]|0,this.v7h=_e[15]|0,uw(e,t,64,16,16);let{key:i,personalization:n,salt:s}=t,o=0;if(i!==void 0&&(i=at(i),o=i.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=at(s);const c=ni(s);this.v4l^=bt(c[0]),this.v4h^=bt(c[1]),this.v5l^=bt(c[2]),this.v5h^=bt(c[3])}if(n!==void 0){n=at(n);const c=ni(n);this.v6l^=bt(c[0]),this.v6h^=bt(c[1]),this.v7l^=bt(c[2]),this.v7h^=bt(c[3])}if(i!==void 0){const c=new Uint8Array(this.blockLen);c.set(i),this.update(c)}}get(){let{v0l:t,v0h:e,v1l:i,v1h:n,v2l:s,v2h:o,v3l:c,v3h:l,v4l:u,v4h:h,v5l:d,v5h:_,v6l:f,v6h:p,v7l:w,v7h:g}=this;return[t,e,i,n,s,o,c,l,u,h,d,_,f,p,w,g]}set(t,e,i,n,s,o,c,l,u,h,d,_,f,p,w,g){this.v0l=t|0,this.v0h=e|0,this.v1l=i|0,this.v1h=n|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=_|0,this.v6l=f|0,this.v6h=p|0,this.v7l=w|0,this.v7h=g|0}compress(t,e,i){this.get().forEach((l,u)=>M[u]=l),M.set(_e,16);let{h:n,l:s}=El(BigInt(this.length));M[24]=_e[8]^s,M[25]=_e[9]^n,i&&(M[28]=~M[28],M[29]=~M[29]);let o=0;const c=lw;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^=M[0]^M[16],this.v0h^=M[1]^M[17],this.v1l^=M[2]^M[18],this.v1h^=M[3]^M[19],this.v2l^=M[4]^M[20],this.v2h^=M[5]^M[21],this.v3l^=M[6]^M[22],this.v3h^=M[7]^M[23],this.v4l^=M[8]^M[24],this.v4h^=M[9]^M[25],this.v5l^=M[10]^M[26],this.v5h^=M[11]^M[27],this.v6l^=M[12]^M[28],this.v6h^=M[13]^M[29],this.v7l^=M[14]^M[30],this.v7h^=M[15]^M[31],tt(M)}destroy(){this.destroyed=!0,tt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const _w=Bp(r=>new dw(r)),fw="https://rpc.walletconnect.org/v1";function Vl(r){const t=`Ethereum Signed Message:
4
+ ${r.length}`,e=new TextEncoder().encode(t+r);return"0x"+X.from(Yp(e)).toString("hex")}async function pw(r,t,e,i,n,s){switch(e.t){case"eip191":return await ww(r,t,e.s);case"eip1271":return await gw(r,t,e.s,i,n,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function ww(r,t,e){return(await gf({hash:Vl(t),signature:e})).toLowerCase()===r.toLowerCase()}async function gw(r,t,e,i,n,s){const o=Vi(i);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{const c="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",u=e.substring(2),h=(u.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:Vl(t)).substring(2),_=c+d+l+h+u,f=await fetch(`${s||fw}/?chainId=${i}&projectId=${n}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:mw(),jsonrpc:"2.0",method:"eth_call",params:[{to:r,data:_},"latest"]})}),{result:p}=await f.json();return p?p.slice(0,c.length).toLowerCase()===c.toLowerCase():!1}catch(c){return console.error("isValidEip1271Signature: ",c),!1}}function mw(){return Date.now()+Math.floor(Math.random()*1e3)}function Ew(r){const t=atob(r),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const i=e[0];if(i===0)throw new Error("No signatures found");const n=1+i*64;if(e.length<n)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=X.from(r,"base64").slice(1,65);return ui.encode(s)}function yw(r){const t=new Uint8Array(X.from(r,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),i=new Uint8Array(e.length+t.length);i.set(e),i.set(t,e.length);const n=_w(i,{dkLen:32});return ui.encode(n)}function sa(r){const t=new Uint8Array(en(vw(r)));return ui.encode(t)}function vw(r){if(r instanceof Uint8Array)return r;if(Array.isArray(r))return new Uint8Array(r);if(typeof r=="object"&&r!=null&&r.data)return new Uint8Array(Object.values(r.data));if(typeof r=="object"&&r)return new Uint8Array(Object.values(r));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function oa(r){const t=X.from(r,"base64"),e=Qf(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const i=jf(e),n=X.from("TX"),s=X.concat([n,X.from(i)]),o=cw(s);return _h.encode(o).replace(/=+$/,"")}function yn(r){const t=[];let e=BigInt(r);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),X.from(t)}function bw(r){const t=X.from(r.signed.bodyBytes,"base64"),e=X.from(r.signed.authInfoBytes,"base64"),i=X.from(r.signature.signature,"base64"),n=[];n.push(X.from([10])),n.push(yn(t.length)),n.push(t),n.push(X.from([18])),n.push(yn(e.length)),n.push(e),n.push(X.from([26])),n.push(yn(i.length)),n.push(i);const s=X.concat(n),o=en(s);return X.from(o).toString("hex").toUpperCase()}var Iw=Object.defineProperty,Aw=Object.defineProperties,Pw=Object.getOwnPropertyDescriptors,aa=Object.getOwnPropertySymbols,Tw=Object.prototype.hasOwnProperty,Ow=Object.prototype.propertyIsEnumerable,ca=(r,t,e)=>t in r?Iw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Rw=(r,t)=>{for(var e in t||(t={}))Tw.call(t,e)&&ca(r,e,t[e]);if(aa)for(var e of aa(t))Ow.call(t,e)&&ca(r,e,t[e]);return r},Dw=(r,t)=>Aw(r,Pw(t));const Lw="did:pkh:",ro=r=>r==null?void 0:r.split(":"),Vw=r=>{const t=r&&ro(r);if(t)return r.includes(Lw)?t[3]:t[1]},Zn=r=>{const t=r&&ro(r);if(t)return t[2]+":"+t[3]},Wi=r=>{const t=r&&ro(r);if(t)return t.pop()};async function la(r){const{cacao:t,projectId:e}=r,{s:i,p:n}=t,s=xl(n,n.iss),o=Wi(n.iss);return await pw(o,s,i,Zn(n.iss),e)}const xl=(r,t)=>{const e=`${r.domain} wants you to sign in with your Ethereum account:`,i=Wi(t);if(!r.aud&&!r.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let n=r.statement||void 0;const s=`URI: ${r.aud||r.uri}`,o=`Version: ${r.version}`,c=`Chain ID: ${Vw(t)}`,l=`Nonce: ${r.nonce}`,u=`Issued At: ${r.iat}`,h=r.exp?`Expiration Time: ${r.exp}`:void 0,d=r.nbf?`Not Before: ${r.nbf}`:void 0,_=r.requestId?`Request ID: ${r.requestId}`:void 0,f=r.resources?`Resources:${r.resources.map(w=>`
5
+ - ${w}`).join("")}`:void 0,p=xi(r.resources);if(p){const w=oi(p);n=qw(n,w)}return[e,i,"",n,"",s,o,c,l,u,h,d,_,f].filter(w=>w!=null).join(`
6
+ `)};function xw(r){return X.from(JSON.stringify(r)).toString("base64")}function Sw(r){return JSON.parse(X.from(r,"base64").toString("utf-8"))}function or(r){if(!r)throw new Error("No recap provided, value is undefined");if(!r.att)throw new Error("No `att` property found");const t=Object.keys(r.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const i=r.att[e];if(Array.isArray(i))throw new Error(`Resource must be an object: ${e}`);if(typeof i!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(i).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(i).forEach(n=>{const s=i[n];if(!Array.isArray(s))throw new Error(`Ability limits ${n} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${n} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${n}) must be an array of objects, found: ${o}`)})})})}function Cw(r,t,e,i={}){return e==null||e.sort((n,s)=>n.localeCompare(s)),{att:{[r]:$w(t,e,i)}}}function $w(r,t,e={}){t=t==null?void 0:t.sort((n,s)=>n.localeCompare(s));const i=t.map(n=>({[`${r}/${n}`]:[e]}));return Object.assign({},...i)}function Sl(r){return or(r),`urn:recap:${xw(r).replace(/=/g,"")}`}function oi(r){const t=Sw(r.replace("urn:recap:",""));return or(t),t}function kw(r,t,e){const i=Cw(r,t,e);return Sl(i)}function Nw(r){return r&&r.includes("urn:recap:")}function Uw(r,t){const e=oi(r),i=oi(t),n=Bw(e,i);return Sl(n)}function Bw(r,t){or(r),or(t);const e=Object.keys(r.att).concat(Object.keys(t.att)).sort((n,s)=>n.localeCompare(s)),i={att:{}};return e.forEach(n=>{var s,o;Object.keys(((s=r.att)==null?void 0:s[n])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[n])||{})).sort((c,l)=>c.localeCompare(l)).forEach(c=>{var l,u;i.att[n]=Dw(Rw({},i.att[n]),{[c]:((l=r.att[n])==null?void 0:l[c])||((u=t.att[n])==null?void 0:u[c])})})}),i}function qw(r="",t){or(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(r.includes(e))return r;const i=[];let n=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,_)=>d.action.localeCompare(_.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=>(n++,`(${n}) '${d}': '${u[d].join("', '")}' for '${c}'.`));i.push(h.join(", ").replace(".,","."))});const s=i.join(" "),o=`${e}${s}`;return`${r?r+" ":""}${o}`}function ua(r){var t;const e=oi(r);or(e);const i=(t=e.att)==null?void 0:t.eip155;return i?Object.keys(i).map(n=>n.split("/")[1]):[]}function ha(r){const t=oi(r);or(t);const e=[];return Object.values(t.att).forEach(i=>{Object.values(i).forEach(n=>{var s;(s=n==null?void 0:n[0])!=null&&s.chains&&e.push(n[0].chains)})}),[...new Set(e.flat())]}function xi(r){if(!r)return;const t=r==null?void 0:r[r.length-1];return Nw(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function Cl(r){return r instanceof Uint8Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint8Array"}function Xn(r){if(typeof r!="boolean")throw new Error(`boolean expected, not ${r}`)}function vn(r){if(!Number.isSafeInteger(r)||r<0)throw new Error("positive integer expected, got "+r)}function ke(r,...t){if(!Cl(r))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(r.length))throw new Error("Uint8Array expected of length "+t+", got length="+r.length)}function da(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Mw(r,t){ke(r);const e=t.outputLen;if(r.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Ft(r){return new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4))}function mr(...r){for(let t=0;t<r.length;t++)r[t].fill(0)}function zw(r){return new DataView(r.buffer,r.byteOffset,r.byteLength)}const jw=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Kw(r){if(typeof r!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(r))}function es(r){if(typeof r=="string")r=Kw(r);else if(Cl(r))r=ts(r);else throw new Error("Uint8Array expected, got "+typeof r);return r}function Fw(r,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(r,t)}function Hw(r,t){if(r.length!==t.length)return!1;let e=0;for(let i=0;i<r.length;i++)e|=r[i]^t[i];return e===0}const Ww=(r,t)=>{function e(i,...n){if(ke(i),!jw)throw new Error("Non little-endian hardware is not yet supported");if(r.nonceLength!==void 0){const u=n[0];if(!u)throw new Error("nonce / iv required");r.varSizeNonce?ke(u):ke(u,r.nonceLength)}const s=r.tagLength;s&&n[1]!==void 0&&ke(n[1]);const o=t(i,...n),c=(u,h)=>{if(h!==void 0){if(u!==2)throw new Error("cipher output not supported");ke(h)}};let l=!1;return{encrypt(u,h){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,ke(u),c(o.encrypt.length,h),o.encrypt(u,h)},decrypt(u,h){if(ke(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,r),e};function _a(r,t,e=!0){if(t===void 0)return new Uint8Array(r);if(t.length!==r)throw new Error("invalid output length, expected "+r+", got: "+t.length);if(e&&!Jw(t))throw new Error("invalid output, must be aligned");return t}function fa(r,t,e,i){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,i);const n=BigInt(32),s=BigInt(4294967295),o=Number(e>>n&s),c=Number(e&s);r.setUint32(t+4,o,i),r.setUint32(t+0,c,i)}function Gw(r,t,e){Xn(e);const i=new Uint8Array(16),n=zw(i);return fa(n,0,BigInt(t),e),fa(n,8,BigInt(r),e),i}function Jw(r){return r.byteOffset%4===0}function ts(r){return Uint8Array.from(r)}const $l=r=>Uint8Array.from(r.split("").map(t=>t.charCodeAt(0))),Yw=$l("expand 16-byte k"),Qw=$l("expand 32-byte k"),Zw=Ft(Yw),Xw=Ft(Qw);function Q(r,t){return r<<t|r>>>32-t}function rs(r){return r.byteOffset%4===0}const Ii=64,eg=16,kl=2**32-1,pa=new Uint32Array;function tg(r,t,e,i,n,s,o,c){const l=n.length,u=new Uint8Array(Ii),h=Ft(u),d=rs(n)&&rs(s),_=d?Ft(n):pa,f=d?Ft(s):pa;for(let p=0;p<l;o++){if(r(t,e,i,h,o,c),o>=kl)throw new Error("arx: counter overflow");const w=Math.min(Ii,l-p);if(d&&w===Ii){const g=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let A=0,V;A<eg;A++)V=g+A,f[V]=_[V]^h[A];p+=Ii;continue}for(let g=0,A;g<w;g++)A=p+g,s[A]=n[A]^u[g];p+=w}}function rg(r,t){const{allowShortKeys:e,extendNonceFn:i,counterLength:n,counterRight:s,rounds:o}=Fw({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof r!="function")throw new Error("core must be a function");return vn(n),vn(o),Xn(s),Xn(e),(c,l,u,h,d=0)=>{ke(c),ke(l),ke(u);const _=u.length;if(h===void 0&&(h=new Uint8Array(_)),ke(h),vn(d),d<0||d>=kl)throw new Error("arx: counter overflow");if(h.length<_)throw new Error(`arx: output (${h.length}) is shorter than data (${_})`);const f=[];let p=c.length,w,g;if(p===32)f.push(w=ts(c)),g=Xw;else if(p===16&&e)w=new Uint8Array(32),w.set(c),w.set(c,16),g=Zw,f.push(w);else throw new Error(`arx: invalid 32-byte key, got length=${p}`);rs(l)||f.push(l=ts(l));const A=Ft(w);if(i){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");i(g,A,Ft(l.subarray(0,16)),A),l=l.subarray(16)}const V=16-n;if(V!==l.length)throw new Error(`arx: nonce must be ${V} or 16 bytes`);if(V!==12){const O=new Uint8Array(12);O.set(l,s?0:12-l.length),l=O,f.push(l)}const v=Ft(l);return tg(r,g,A,v,u,h,d,o),mr(...f),h}}const me=(r,t)=>r[t++]&255|(r[t++]&255)<<8;class ig{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=es(t),ke(t,32);const e=me(t,0),i=me(t,2),n=me(t,4),s=me(t,6),o=me(t,8),c=me(t,10),l=me(t,12),u=me(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|i<<3)&8191,this.r[2]=(i>>>10|n<<6)&7939,this.r[3]=(n>>>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]=me(t,16+2*h)}process(t,e,i=!1){const n=i?0:2048,{h:s,r:o}=this,c=o[0],l=o[1],u=o[2],h=o[3],d=o[4],_=o[5],f=o[6],p=o[7],w=o[8],g=o[9],A=me(t,e+0),V=me(t,e+2),v=me(t,e+4),O=me(t,e+6),P=me(t,e+8),E=me(t,e+10),D=me(t,e+12),R=me(t,e+14);let m=s[0]+(A&8191),y=s[1]+((A>>>13|V<<3)&8191),b=s[2]+((V>>>10|v<<6)&8191),I=s[3]+((v>>>7|O<<9)&8191),L=s[4]+((O>>>4|P<<12)&8191),T=s[5]+(P>>>1&8191),x=s[6]+((P>>>14|E<<2)&8191),$=s[7]+((E>>>11|D<<5)&8191),k=s[8]+((D>>>8|R<<8)&8191),q=s[9]+(R>>>5|n),C=0,N=C+m*c+y*(5*g)+b*(5*w)+I*(5*p)+L*(5*f);C=N>>>13,N&=8191,N+=T*(5*_)+x*(5*d)+$*(5*h)+k*(5*u)+q*(5*l),C+=N>>>13,N&=8191;let z=C+m*l+y*c+b*(5*g)+I*(5*w)+L*(5*p);C=z>>>13,z&=8191,z+=T*(5*f)+x*(5*_)+$*(5*d)+k*(5*h)+q*(5*u),C+=z>>>13,z&=8191;let j=C+m*u+y*l+b*c+I*(5*g)+L*(5*w);C=j>>>13,j&=8191,j+=T*(5*p)+x*(5*f)+$*(5*_)+k*(5*d)+q*(5*h),C+=j>>>13,j&=8191;let F=C+m*h+y*u+b*l+I*c+L*(5*g);C=F>>>13,F&=8191,F+=T*(5*w)+x*(5*p)+$*(5*f)+k*(5*_)+q*(5*d),C+=F>>>13,F&=8191;let H=C+m*d+y*h+b*u+I*l+L*c;C=H>>>13,H&=8191,H+=T*(5*g)+x*(5*w)+$*(5*p)+k*(5*f)+q*(5*_),C+=H>>>13,H&=8191;let W=C+m*_+y*d+b*h+I*u+L*l;C=W>>>13,W&=8191,W+=T*c+x*(5*g)+$*(5*w)+k*(5*p)+q*(5*f),C+=W>>>13,W&=8191;let G=C+m*f+y*_+b*d+I*h+L*u;C=G>>>13,G&=8191,G+=T*l+x*c+$*(5*g)+k*(5*w)+q*(5*p),C+=G>>>13,G&=8191;let ue=C+m*p+y*f+b*_+I*d+L*h;C=ue>>>13,ue&=8191,ue+=T*u+x*l+$*c+k*(5*g)+q*(5*w),C+=ue>>>13,ue&=8191;let ce=C+m*w+y*p+b*f+I*_+L*d;C=ce>>>13,ce&=8191,ce+=T*h+x*u+$*l+k*c+q*(5*g),C+=ce>>>13,ce&=8191;let oe=C+m*g+y*w+b*p+I*f+L*_;C=oe>>>13,oe&=8191,oe+=T*d+x*h+$*u+k*l+q*c,C+=oe>>>13,oe&=8191,C=(C<<2)+C|0,C=C+N|0,N=C&8191,C=C>>>13,z+=C,s[0]=N,s[1]=z,s[2]=j,s[3]=F,s[4]=H,s[5]=W,s[6]=G,s[7]=ue,s[8]=ce,s[9]=oe}finalize(){const{h:t,pad:e}=this,i=new Uint16Array(10);let n=t[1]>>>13;t[1]&=8191;for(let c=2;c<10;c++)t[c]+=n,n=t[c]>>>13,t[c]&=8191;t[0]+=n*5,n=t[0]>>>13,t[0]&=8191,t[1]+=n,n=t[1]>>>13,t[1]&=8191,t[2]+=n,i[0]=t[0]+5,n=i[0]>>>13,i[0]&=8191;for(let c=1;c<10;c++)i[c]=t[c]+n,n=i[c]>>>13,i[c]&=8191;i[9]-=8192;let s=(n^1)-1;for(let c=0;c<10;c++)i[c]&=s;s=~s;for(let c=0;c<10;c++)t[c]=t[c]&s|i[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;mr(i)}update(t){da(this),t=es(t),ke(t);const{buffer:e,blockLen:i}=this,n=t.length;for(let s=0;s<n;){const o=Math.min(i-this.pos,n-s);if(o===i){for(;i<=n-s;s+=i)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){mr(this.h,this.r,this.buffer,this.pad)}digestInto(t){da(this),Mw(t,this),this.finished=!0;const{buffer:e,h:i}=this;let{pos:n}=this;if(n){for(e[n++]=1;n<16;n++)e[n]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=i[o]>>>0,t[s++]=i[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const i=t.slice(0,e);return this.destroy(),i}}function ng(r){const t=(i,n)=>r(n).update(es(i)).digest(),e=r(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=i=>r(i),t}const sg=ng(r=>new ig(r));function og(r,t,e,i,n,s=20){let o=r[0],c=r[1],l=r[2],u=r[3],h=t[0],d=t[1],_=t[2],f=t[3],p=t[4],w=t[5],g=t[6],A=t[7],V=n,v=e[0],O=e[1],P=e[2],E=o,D=c,R=l,m=u,y=h,b=d,I=_,L=f,T=p,x=w,$=g,k=A,q=V,C=v,N=O,z=P;for(let F=0;F<s;F+=2)E=E+y|0,q=Q(q^E,16),T=T+q|0,y=Q(y^T,12),E=E+y|0,q=Q(q^E,8),T=T+q|0,y=Q(y^T,7),D=D+b|0,C=Q(C^D,16),x=x+C|0,b=Q(b^x,12),D=D+b|0,C=Q(C^D,8),x=x+C|0,b=Q(b^x,7),R=R+I|0,N=Q(N^R,16),$=$+N|0,I=Q(I^$,12),R=R+I|0,N=Q(N^R,8),$=$+N|0,I=Q(I^$,7),m=m+L|0,z=Q(z^m,16),k=k+z|0,L=Q(L^k,12),m=m+L|0,z=Q(z^m,8),k=k+z|0,L=Q(L^k,7),E=E+b|0,z=Q(z^E,16),$=$+z|0,b=Q(b^$,12),E=E+b|0,z=Q(z^E,8),$=$+z|0,b=Q(b^$,7),D=D+I|0,q=Q(q^D,16),k=k+q|0,I=Q(I^k,12),D=D+I|0,q=Q(q^D,8),k=k+q|0,I=Q(I^k,7),R=R+L|0,C=Q(C^R,16),T=T+C|0,L=Q(L^T,12),R=R+L|0,C=Q(C^R,8),T=T+C|0,L=Q(L^T,7),m=m+y|0,N=Q(N^m,16),x=x+N|0,y=Q(y^x,12),m=m+y|0,N=Q(N^m,8),x=x+N|0,y=Q(y^x,7);let j=0;i[j++]=o+E|0,i[j++]=c+D|0,i[j++]=l+R|0,i[j++]=u+m|0,i[j++]=h+y|0,i[j++]=d+b|0,i[j++]=_+I|0,i[j++]=f+L|0,i[j++]=p+T|0,i[j++]=w+x|0,i[j++]=g+$|0,i[j++]=A+k|0,i[j++]=V+q|0,i[j++]=v+C|0,i[j++]=O+N|0,i[j++]=P+z|0}const ag=rg(og,{counterRight:!1,counterLength:4,allowShortKeys:!1}),cg=new Uint8Array(16),wa=(r,t)=>{r.update(t);const e=t.length%16;e&&r.update(cg.subarray(e))},lg=new Uint8Array(32);function ga(r,t,e,i,n){const s=r(t,e,lg),o=sg.create(s);n&&wa(o,n),wa(o,i);const c=Gw(i.length,n?n.length:0,!0);o.update(c);const l=o.digest();return mr(s,c),l}const ug=r=>(t,e,i)=>({encrypt(n,s){const o=n.length;s=_a(o+16,s,!1),s.set(n);const c=s.subarray(0,-16);r(t,e,c,c,1);const l=ga(r,t,e,c,i);return s.set(l,o),mr(l),s},decrypt(n,s){s=_a(n.length-16,s,!1);const o=n.subarray(0,-16),c=n.subarray(-16),l=ga(r,t,e,o,i);if(!Hw(c,l))throw new Error("invalid tag");return s.set(n.subarray(0,-16)),r(t,e,s,s,1),mr(l),s}}),Nl=Ww({blockSize:64,nonceLength:12,tagLength:16},ug(ag));let Ul=class extends Xi{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Zs(t);const i=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 n=this.blockLen,s=new Uint8Array(n);s.set(i.length>n?t.create().update(i).digest():i);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),tt(s)}update(t){return Ht(this),this.iHash.update(t),this}digestInto(t){Ht(this),et(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:i,finished:n,destroyed:s,blockLen:o,outputLen:c}=this;return t=t,t.finished=n,t.destroyed=s,t.blockLen=o,t.outputLen=c,t.oHash=e._cloneInto(t.oHash),t.iHash=i._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const tn=(r,t,e)=>new Ul(r,t).update(e).digest();tn.create=(r,t)=>new Ul(r,t);function hg(r,t,e){return Zs(r),e===void 0&&(e=new Uint8Array(r.outputLen)),tn(r,at(e),at(t))}const bn=Uint8Array.from([0]),ma=Uint8Array.of();function dg(r,t,e,i=32){Zs(r),Rt(i);const n=r.outputLen;if(i>255*n)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(i/n);e===void 0&&(e=ma);const o=new Uint8Array(s*n),c=tn.create(r,t),l=c._cloneInto(),u=new Uint8Array(c.outputLen);for(let h=0;h<s;h++)bn[0]=h+1,l.update(h===0?ma:u).update(e).update(bn).digestInto(u),o.set(u,n*h),c._cloneInto(l);return c.destroy(),l.destroy(),tt(u,bn),o.slice(0,i)}const _g=(r,t,e,i,n)=>dg(r,hg(r,t,e),i,n),rn=en,io=BigInt(0),is=BigInt(1);function Gi(r,t){if(typeof t!="boolean")throw new Error(r+" boolean expected, got "+t)}function Ai(r){const t=r.toString(16);return t.length&1?"0"+t:t}function Bl(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return r===""?io:BigInt("0x"+r)}function nn(r){return Bl(si(r))}function Ji(r){return et(r),Bl(si(Uint8Array.from(r).reverse()))}function no(r,t){return eo(r.toString(16).padStart(t*2,"0"))}function so(r,t){return no(r,t).reverse()}function $e(r,t,e){let i;if(typeof t=="string")try{i=eo(t)}catch(s){throw new Error(r+" must be hex string or Uint8Array, cause: "+s)}else if(Qs(t))i=Uint8Array.from(t);else throw new Error(r+" must be hex string or Uint8Array");const n=i.length;if(typeof e=="number"&&n!==e)throw new Error(r+" of length "+e+" expected, got "+n);return i}const In=r=>typeof r=="bigint"&&io<=r;function fg(r,t,e){return In(r)&&In(t)&&In(e)&&t<=r&&r<e}function ns(r,t,e,i){if(!fg(t,e,i))throw new Error("expected valid "+r+": "+e+" <= n < "+i+", got "+t)}function pg(r){let t;for(t=0;r>io;r>>=is,t+=1);return t}const sn=r=>(is<<BigInt(r))-is;function wg(r,t,e){if(typeof r!="number"||r<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 i=_=>new Uint8Array(_),n=_=>Uint8Array.of(_);let s=i(r),o=i(r),c=0;const l=()=>{s.fill(1),o.fill(0),c=0},u=(..._)=>e(o,s,..._),h=(_=i(0))=>{o=u(n(0),_),s=u(),_.length!==0&&(o=u(n(1),_),s=u())},d=()=>{if(c++>=1e3)throw new Error("drbg: tried 1000 values");let _=0;const f=[];for(;_<t;){s=u();const p=s.slice();f.push(p),_+=s.length}return er(...f)};return(_,f)=>{l(),h(_);let p;for(;!(p=f(d()));)h();return l(),p}}function on(r,t,e={}){if(!r||typeof r!="object")throw new Error("expected valid options object");function i(n,s,o){const c=r[n];if(o&&c===void 0)return;const l=typeof c;if(l!==s||c===null)throw new Error(`param "${n}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([n,s])=>i(n,s,!1)),Object.entries(e).forEach(([n,s])=>i(n,s,!0))}function Ea(r){const t=new WeakMap;return(e,...i)=>{const n=t.get(e);if(n!==void 0)return n;const s=r(e,...i);return t.set(e,s),s}}const Ue=BigInt(0),De=BigInt(1),tr=BigInt(2),gg=BigInt(3),ql=BigInt(4),Ml=BigInt(5),zl=BigInt(8);function Qe(r,t){const e=r%t;return e>=Ue?e:t+e}function it(r,t,e){let i=r;for(;t-- >Ue;)i*=i,i%=e;return i}function ya(r,t){if(r===Ue)throw new Error("invert: expected non-zero number");if(t<=Ue)throw new Error("invert: expected positive modulus, got "+t);let e=Qe(r,t),i=t,n=Ue,s=De;for(;e!==Ue;){const o=i/e,c=i%e,l=n-s*o;i=e,e=c,n=s,s=l}if(i!==De)throw new Error("invert: does not exist");return Qe(n,t)}function jl(r,t){const e=(r.ORDER+De)/ql,i=r.pow(t,e);if(!r.eql(r.sqr(i),t))throw new Error("Cannot find square root");return i}function mg(r,t){const e=(r.ORDER-Ml)/zl,i=r.mul(t,tr),n=r.pow(i,e),s=r.mul(t,n),o=r.mul(r.mul(s,tr),n),c=r.mul(s,r.sub(o,r.ONE));if(!r.eql(r.sqr(c),t))throw new Error("Cannot find square root");return c}function Eg(r){if(r<BigInt(3))throw new Error("sqrt is not defined for small field");let t=r-De,e=0;for(;t%tr===Ue;)t/=tr,e++;let i=tr;const n=Lr(r);for(;va(n,i)===1;)if(i++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return jl;let s=n.pow(i,t);const o=(t+De)/tr;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),_=c.pow(l,o);for(;!c.eql(d,c.ONE);){if(c.is0(d))return c.ZERO;let f=1,p=c.sqr(d);for(;!c.eql(p,c.ONE);)if(f++,p=c.sqr(p),f===u)throw new Error("Cannot find square root");const w=De<<BigInt(u-f-1),g=c.pow(h,w);u=f,h=c.sqr(g),d=c.mul(d,h),_=c.mul(_,g)}return _}}function yg(r){return r%ql===gg?jl:r%zl===Ml?mg:Eg(r)}const vg=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function bg(r){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=vg.reduce((i,n)=>(i[n]="function",i),t);return on(r,e),r}function Ig(r,t,e){if(e<Ue)throw new Error("invalid exponent, negatives unsupported");if(e===Ue)return r.ONE;if(e===De)return t;let i=r.ONE,n=t;for(;e>Ue;)e&De&&(i=r.mul(i,n)),n=r.sqr(n),e>>=De;return i}function Kl(r,t,e=!1){const i=new Array(t.length).fill(e?r.ZERO:void 0),n=t.reduce((o,c,l)=>r.is0(c)?o:(i[l]=o,r.mul(o,c)),r.ONE),s=r.inv(n);return t.reduceRight((o,c,l)=>r.is0(c)?o:(i[l]=r.mul(o,i[l]),r.mul(o,c)),s),i}function va(r,t){const e=(r.ORDER-De)/tr,i=r.pow(t,e),n=r.eql(i,r.ONE),s=r.eql(i,r.ZERO),o=r.eql(i,r.neg(r.ONE));if(!n&&!s&&!o)throw new Error("invalid Legendre symbol result");return n?1:s?0:-1}function Ag(r,t){t!==void 0&&Rt(t);const e=t!==void 0?t:r.toString(2).length,i=Math.ceil(e/8);return{nBitLength:e,nByteLength:i}}function Lr(r,t,e=!1,i={}){if(r<=Ue)throw new Error("invalid field: expected ORDER > 0, got "+r);let n,s;if(typeof t=="object"&&t!=null){if(i.sqrt||e)throw new Error("cannot specify opts in two arguments");const h=t;h.BITS&&(n=h.BITS),h.sqrt&&(s=h.sqrt),typeof h.isLE=="boolean"&&(e=h.isLE)}else typeof t=="number"&&(n=t),i.sqrt&&(s=i.sqrt);const{nBitLength:o,nByteLength:c}=Ag(r,n);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:r,isLE:e,BITS:o,BYTES:c,MASK:sn(o),ZERO:Ue,ONE:De,create:h=>Qe(h,r),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return Ue<=h&&h<r},is0:h=>h===Ue,isValidNot0:h=>!u.is0(h)&&u.isValid(h),isOdd:h=>(h&De)===De,neg:h=>Qe(-h,r),eql:(h,d)=>h===d,sqr:h=>Qe(h*h,r),add:(h,d)=>Qe(h+d,r),sub:(h,d)=>Qe(h-d,r),mul:(h,d)=>Qe(h*d,r),pow:(h,d)=>Ig(u,h,d),div:(h,d)=>Qe(h*ya(d,r),r),sqrN:h=>h*h,addN:(h,d)=>h+d,subN:(h,d)=>h-d,mulN:(h,d)=>h*d,inv:h=>ya(h,r),sqrt:s||(h=>(l||(l=yg(r)),l(u,h))),toBytes:h=>e?so(h,c):no(h,c),fromBytes:h=>{if(h.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+h.length);return e?Ji(h):nn(h)},invertBatch:h=>Kl(u,h),cmov:(h,d,_)=>_?d:h});return Object.freeze(u)}function Fl(r){if(typeof r!="bigint")throw new Error("field order must be bigint");const t=r.toString(2).length;return Math.ceil(t/8)}function Hl(r){const t=Fl(r);return t+Math.ceil(t/2)}function Pg(r,t,e=!1){const i=r.length,n=Fl(t),s=Hl(t);if(i<16||i<s||i>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+i);const o=e?Ji(r):nn(r),c=Qe(o,t-De)+De;return e?so(c,n):no(c,n)}const Er=BigInt(0),rr=BigInt(1);function Jr(r,t){const e=t.negate();return r?e:t}function Tg(r,t,e){const i=s=>s.pz,n=Kl(r.Fp,e.map(i));return e.map((s,o)=>s.toAffine(n[o])).map(r.fromAffine)}function Wl(r,t){if(!Number.isSafeInteger(r)||r<=0||r>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+r)}function An(r,t){Wl(r,t);const e=Math.ceil(t/r)+1,i=2**(r-1),n=2**r,s=sn(r),o=BigInt(r);return{windows:e,windowSize:i,mask:s,maxNumber:n,shiftBy:o}}function ba(r,t,e){const{windowSize:i,mask:n,maxNumber:s,shiftBy:o}=e;let c=Number(r&n),l=r>>o;c>i&&(c-=s,l+=rr);const u=t*i,h=u+Math.abs(c)-1,d=c===0,_=c<0,f=t%2!==0;return{nextN:l,offset:h,isZero:d,isNeg:_,isNegF:f,offsetF:u}}function Og(r,t){if(!Array.isArray(r))throw new Error("array expected");r.forEach((e,i)=>{if(!(e instanceof t))throw new Error("invalid point at index "+i)})}function Rg(r,t){if(!Array.isArray(r))throw new Error("array of scalars expected");r.forEach((e,i)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+i)})}const Pn=new WeakMap,Gl=new WeakMap;function Tn(r){return Gl.get(r)||1}function Ia(r){if(r!==Er)throw new Error("invalid wNAF")}function Dg(r,t){return{constTimeNegate:Jr,hasPrecomputes(e){return Tn(e)!==1},unsafeLadder(e,i,n=r.ZERO){let s=e;for(;i>Er;)i&rr&&(n=n.add(s)),s=s.double(),i>>=rr;return n},precomputeWindow(e,i){const{windows:n,windowSize:s}=An(i,t),o=[];let c=e,l=c;for(let u=0;u<n;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,i,n){let s=r.ZERO,o=r.BASE;const c=An(e,t);for(let l=0;l<c.windows;l++){const{nextN:u,offset:h,isZero:d,isNeg:_,isNegF:f,offsetF:p}=ba(n,l,c);n=u,d?o=o.add(Jr(f,i[p])):s=s.add(Jr(_,i[h]))}return Ia(n),{p:s,f:o}},wNAFUnsafe(e,i,n,s=r.ZERO){const o=An(e,t);for(let c=0;c<o.windows&&n!==Er;c++){const{nextN:l,offset:u,isZero:h,isNeg:d}=ba(n,c,o);if(n=l,!h){const _=i[u];s=s.add(d?_.negate():_)}}return Ia(n),s},getPrecomputes(e,i,n){let s=Pn.get(i);return s||(s=this.precomputeWindow(i,e),e!==1&&(typeof n=="function"&&(s=n(s)),Pn.set(i,s))),s},wNAFCached(e,i,n){const s=Tn(e);return this.wNAF(s,this.getPrecomputes(s,e,n),i)},wNAFCachedUnsafe(e,i,n,s){const o=Tn(e);return o===1?this.unsafeLadder(e,i,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,n),i,s)},setWindowSize(e,i){Wl(i,t),Gl.set(e,i),Pn.delete(e)}}}function Lg(r,t,e,i){let n=t,s=r.ZERO,o=r.ZERO;for(;e>Er||i>Er;)e&rr&&(s=s.add(n)),i&rr&&(o=o.add(n)),n=n.double(),e>>=rr,i>>=rr;return{p1:s,p2:o}}function Vg(r,t,e,i){Og(e,r),Rg(i,t);const n=e.length,s=i.length;if(n!==s)throw new Error("arrays of points and scalars must have equal length");const o=r.ZERO,c=pg(BigInt(n));let l=1;c>12?l=c-3:c>4?l=c-2:c>0&&(l=2);const u=sn(l),h=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/l)*l;let _=o;for(let f=d;f>=0;f-=l){h.fill(o);for(let w=0;w<s;w++){const g=i[w],A=Number(g>>BigInt(f)&u);h[A]=h[A].add(e[w])}let p=o;for(let w=h.length-1,g=o;w>0;w--)g=g.add(h[w]),p=p.add(g);if(_=_.add(p),f!==0)for(let w=0;w<l;w++)_=_.double()}return _}function Aa(r,t){if(t){if(t.ORDER!==r)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return bg(t),t}else return Lr(r)}function xg(r,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${r} CURVE object`);for(const o of["p","n","h"]){const c=t[o];if(!(typeof c=="bigint"&&c>Er))throw new Error(`CURVE.${o} must be positive bigint`)}const i=Aa(t.p,e.Fp),n=Aa(t.n,e.Fn),s=["Gx","Gy","a","b"];for(const o of s)if(!i.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:i,Fn:n}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const Nr=BigInt(0),dr=BigInt(1),Pi=BigInt(2);function Sg(r){return on(r,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...r})}function Cg(r){const t=Sg(r),{P:e,type:i,adjustScalarBytes:n,powPminus2:s,randomBytes:o}=t,c=i==="x25519";if(!c&&i!=="x448")throw new Error("invalid type");const l=o||Dr,u=c?255:448,h=c?32:56,d=BigInt(c?9:5),_=BigInt(c?121665:39081),f=c?Pi**BigInt(254):Pi**BigInt(447),p=c?BigInt(8)*Pi**BigInt(251)-dr:BigInt(4)*Pi**BigInt(445)-dr,w=f+p+dr,g=m=>Qe(m,e),A=V(d);function V(m){return so(g(m),h)}function v(m){const y=$e("u coordinate",m,h);return c&&(y[31]&=127),g(Ji(y))}function O(m){return Ji(n($e("scalar",m,h)))}function P(m,y){const b=R(v(y),O(m));if(b===Nr)throw new Error("invalid private or public key received");return V(b)}function E(m){return P(m,A)}function D(m,y,b){const I=g(m*(y-b));return y=g(y-I),b=g(b+I),{x_2:y,x_3:b}}function R(m,y){ns("u",m,Nr,e),ns("scalar",y,f,w);const b=y,I=m;let L=dr,T=Nr,x=m,$=dr,k=Nr;for(let C=BigInt(u-1);C>=Nr;C--){const N=b>>C&dr;k^=N,{x_2:L,x_3:x}=D(k,L,x),{x_2:T,x_3:$}=D(k,T,$),k=N;const z=L+T,j=g(z*z),F=L-T,H=g(F*F),W=j-H,G=x+$,ue=x-$,ce=g(ue*z),oe=g(G*F),He=ce+oe,mt=ce-oe;x=g(He*He),$=g(I*g(mt*mt)),L=g(j*H),T=g(W*(j+g(_*W)))}({x_2:L,x_3:x}=D(k,L,x)),{x_2:T,x_3:$}=D(k,T,$);const q=s(T);return g(L*q)}return{scalarMult:P,scalarMultBase:E,getSharedSecret:(m,y)=>P(m,y),getPublicKey:m=>E(m),utils:{randomPrivateKey:()=>l(h)},GuBytes:A.slice()}}BigInt(0);const $g=BigInt(1),Pa=BigInt(2),kg=BigInt(3),Ng=BigInt(5);BigInt(8);const Jl={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Ug(r){const t=BigInt(10),e=BigInt(20),i=BigInt(40),n=BigInt(80),s=Jl.p,o=r*r%s*r%s,c=it(o,Pa,s)*o%s,l=it(c,$g,s)*r%s,u=it(l,Ng,s)*l%s,h=it(u,t,s)*u%s,d=it(h,e,s)*h%s,_=it(d,i,s)*d%s,f=it(_,n,s)*_%s,p=it(f,n,s)*_%s,w=it(p,t,s)*u%s;return{pow_p_5_8:it(w,Pa,s)*r%s,b2:o}}function Bg(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}const ss=(()=>{const r=Jl.p;return Cg({P:r,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:i}=Ug(t);return Qe(it(e,kg,r)*i,r)},adjustScalarBytes:Bg})})();function Ta(r){r.lowS!==void 0&&Gi("lowS",r.lowS),r.prehash!==void 0&&Gi("prehash",r.prehash)}class qg extends Error{constructor(t=""){super(t)}}const At={Err:qg,_tlv:{encode:(r,t)=>{const{Err:e}=At;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const i=t.length/2,n=Ai(i);if(n.length/2&128)throw new e("tlv.encode: long form length too big");const s=i>127?Ai(n.length/2|128):"";return Ai(r)+s+n+t},decode(r,t){const{Err:e}=At;let i=0;if(r<0||r>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[i++]!==r)throw new e("tlv.decode: wrong tlv");const n=t[i++],s=!!(n&128);let o=0;if(!s)o=n;else{const l=n&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(i,i+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(i+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const c=t.subarray(i,i+o);if(c.length!==o)throw new e("tlv.decode: wrong value length");return{v:c,l:t.subarray(i+o)}}},_int:{encode(r){const{Err:t}=At;if(r<Yr)throw new t("integer: negative integers are not allowed");let e=Ai(r);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(r){const{Err:t}=At;if(r[0]&128)throw new t("invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return nn(r)}},toSig(r){const{Err:t,_int:e,_tlv:i}=At,n=$e("signature",r),{v:s,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:c,l}=i.decode(2,s),{v:u,l:h}=i.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(r){const{_tlv:t,_int:e}=At,i=t.encode(2,e.encode(r.r)),n=t.encode(2,e.encode(r.s)),s=i+n;return t.encode(48,s)}},Yr=BigInt(0),Qr=BigInt(1),Mg=BigInt(2),Ti=BigInt(3),zg=BigInt(4);function jg(r,t,e){function i(n){const s=r.sqr(n),o=r.mul(s,n);return r.add(r.add(o,r.mul(n,t)),e)}return i}function Yl(r,t,e){const{BYTES:i}=r;function n(s){let o;if(typeof s=="bigint")o=s;else{let c=$e("private key",s);if(t){if(!t.includes(c.length*2))throw new Error("invalid private key");const l=new Uint8Array(i);l.set(c,l.length-c.length),c=l}try{o=r.fromBytes(c)}catch{throw new Error(`invalid private key: expected ui8a of size ${i}, got ${typeof s}`)}}if(e&&(o=r.create(o)),!r.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return n}function Kg(r,t={}){const{Fp:e,Fn:i}=xg("weierstrass",r,t),{h:n,n:s}=r;on(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(r.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(R,m,y){const{x:b,y:I}=m.toAffine(),L=e.toBytes(b);if(Gi("isCompressed",y),y){c();const T=!e.isOdd(I);return er(Ql(T),L)}else return er(Uint8Array.of(4),L,e.toBytes(I))}function u(R){et(R);const m=e.BYTES,y=m+1,b=2*m+1,I=R.length,L=R[0],T=R.subarray(1);if(I===y&&(L===2||L===3)){const x=e.fromBytes(T);if(!e.isValid(x))throw new Error("bad point: is not on curve, wrong x");const $=_(x);let k;try{k=e.sqrt($)}catch(C){const N=C instanceof Error?": "+C.message:"";throw new Error("bad point: is not on curve, sqrt error"+N)}c();const q=e.isOdd(k);return(L&1)===1!==q&&(k=e.neg(k)),{x,y:k}}else if(I===b&&L===4){const x=e.fromBytes(T.subarray(m*0,m*1)),$=e.fromBytes(T.subarray(m*1,m*2));if(!f(x,$))throw new Error("bad point: is not on curve");return{x,y:$}}else throw new Error(`bad point: got length ${I}, expected compressed=${y} or uncompressed=${b}`)}const h=t.toBytes||l,d=t.fromBytes||u,_=jg(e,r.a,r.b);function f(R,m){const y=e.sqr(m),b=_(R);return e.eql(y,b)}if(!f(r.Gx,r.Gy))throw new Error("bad curve params: generator point");const p=e.mul(e.pow(r.a,Ti),zg),w=e.mul(e.sqr(r.b),BigInt(27));if(e.is0(e.add(p,w)))throw new Error("bad curve params: a or b");function g(R,m,y=!1){if(!e.isValid(m)||y&&e.is0(m))throw new Error(`bad point coordinate ${R}`);return m}function A(R){if(!(R instanceof P))throw new Error("ProjectivePoint expected")}const V=Ea((R,m)=>{const{px:y,py:b,pz:I}=R;if(e.eql(I,e.ONE))return{x:y,y:b};const L=R.is0();m==null&&(m=L?e.ONE:e.inv(I));const T=e.mul(y,m),x=e.mul(b,m),$=e.mul(I,m);if(L)return{x:e.ZERO,y:e.ZERO};if(!e.eql($,e.ONE))throw new Error("invZ was invalid");return{x:T,y:x}}),v=Ea(R=>{if(R.is0()){if(t.allowInfinityPoint&&!e.is0(R.py))return;throw new Error("bad point: ZERO")}const{x:m,y}=R.toAffine();if(!e.isValid(m)||!e.isValid(y))throw new Error("bad point: x or y not field elements");if(!f(m,y))throw new Error("bad point: equation left != right");if(!R.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function O(R,m,y,b,I){return y=new P(e.mul(y.px,R),y.py,y.pz),m=Jr(b,m),y=Jr(I,y),m.add(y)}class P{constructor(m,y,b){this.px=g("x",m),this.py=g("y",y,!0),this.pz=g("z",b),Object.freeze(this)}static fromAffine(m){const{x:y,y:b}=m||{};if(!m||!e.isValid(y)||!e.isValid(b))throw new Error("invalid affine point");if(m instanceof P)throw new Error("projective point not allowed");return e.is0(y)&&e.is0(b)?P.ZERO:new P(y,b,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(m){return Tg(P,"pz",m)}static fromBytes(m){return et(m),P.fromHex(m)}static fromHex(m){const y=P.fromAffine(d($e("pointHex",m)));return y.assertValidity(),y}static fromPrivateKey(m){const y=Yl(i,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return P.BASE.multiply(y(m))}static msm(m,y){return Vg(P,i,m,y)}precompute(m=8,y=!0){return D.setWindowSize(this,m),y||this.multiply(Ti),this}_setWindowSize(m){this.precompute(m)}assertValidity(){v(this)}hasEvenY(){const{y:m}=this.toAffine();if(!e.isOdd)throw new Error("Field doesn't support isOdd");return!e.isOdd(m)}equals(m){A(m);const{px:y,py:b,pz:I}=this,{px:L,py:T,pz:x}=m,$=e.eql(e.mul(y,x),e.mul(L,I)),k=e.eql(e.mul(b,x),e.mul(T,I));return $&&k}negate(){return new P(this.px,e.neg(this.py),this.pz)}double(){const{a:m,b:y}=r,b=e.mul(y,Ti),{px:I,py:L,pz:T}=this;let x=e.ZERO,$=e.ZERO,k=e.ZERO,q=e.mul(I,I),C=e.mul(L,L),N=e.mul(T,T),z=e.mul(I,L);return z=e.add(z,z),k=e.mul(I,T),k=e.add(k,k),x=e.mul(m,k),$=e.mul(b,N),$=e.add(x,$),x=e.sub(C,$),$=e.add(C,$),$=e.mul(x,$),x=e.mul(z,x),k=e.mul(b,k),N=e.mul(m,N),z=e.sub(q,N),z=e.mul(m,z),z=e.add(z,k),k=e.add(q,q),q=e.add(k,q),q=e.add(q,N),q=e.mul(q,z),$=e.add($,q),N=e.mul(L,T),N=e.add(N,N),q=e.mul(N,z),x=e.sub(x,q),k=e.mul(N,C),k=e.add(k,k),k=e.add(k,k),new P(x,$,k)}add(m){A(m);const{px:y,py:b,pz:I}=this,{px:L,py:T,pz:x}=m;let $=e.ZERO,k=e.ZERO,q=e.ZERO;const C=r.a,N=e.mul(r.b,Ti);let z=e.mul(y,L),j=e.mul(b,T),F=e.mul(I,x),H=e.add(y,b),W=e.add(L,T);H=e.mul(H,W),W=e.add(z,j),H=e.sub(H,W),W=e.add(y,I);let G=e.add(L,x);return W=e.mul(W,G),G=e.add(z,F),W=e.sub(W,G),G=e.add(b,I),$=e.add(T,x),G=e.mul(G,$),$=e.add(j,F),G=e.sub(G,$),q=e.mul(C,W),$=e.mul(N,F),q=e.add($,q),$=e.sub(j,q),q=e.add(j,q),k=e.mul($,q),j=e.add(z,z),j=e.add(j,z),F=e.mul(C,F),W=e.mul(N,W),j=e.add(j,F),F=e.sub(z,F),F=e.mul(C,F),W=e.add(W,F),z=e.mul(j,W),k=e.add(k,z),z=e.mul(G,W),$=e.mul(H,$),$=e.sub($,z),z=e.mul(H,j),q=e.mul(G,q),q=e.add(q,z),new P($,k,q)}subtract(m){return this.add(m.negate())}is0(){return this.equals(P.ZERO)}multiply(m){const{endo:y}=t;if(!i.isValidNot0(m))throw new Error("invalid scalar: out of range");let b,I;const L=T=>D.wNAFCached(this,T,P.normalizeZ);if(y){const{k1neg:T,k1:x,k2neg:$,k2:k}=y.splitScalar(m),{p:q,f:C}=L(x),{p:N,f:z}=L(k);I=C.add(z),b=O(y.beta,q,N,T,$)}else{const{p:T,f:x}=L(m);b=T,I=x}return P.normalizeZ([b,I])[0]}multiplyUnsafe(m){const{endo:y}=t,b=this;if(!i.isValid(m))throw new Error("invalid scalar: out of range");if(m===Yr||b.is0())return P.ZERO;if(m===Qr)return b;if(D.hasPrecomputes(this))return this.multiply(m);if(y){const{k1neg:I,k1:L,k2neg:T,k2:x}=y.splitScalar(m),{p1:$,p2:k}=Lg(P,b,L,x);return O(y.beta,$,k,I,T)}else return D.wNAFCachedUnsafe(b,m)}multiplyAndAddUnsafe(m,y,b){const I=this.multiplyUnsafe(y).add(m.multiplyUnsafe(b));return I.is0()?void 0:I}toAffine(m){return V(this,m)}isTorsionFree(){const{isTorsionFree:m}=t;return n===Qr?!0:m?m(P,this):D.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:m}=t;return n===Qr?this:m?m(P,this):this.multiplyUnsafe(n)}toBytes(m=!0){return Gi("isCompressed",m),this.assertValidity(),h(P,this,m)}toRawBytes(m=!0){return this.toBytes(m)}toHex(m=!0){return si(this.toBytes(m))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}P.BASE=new P(r.Gx,r.Gy,e.ONE),P.ZERO=new P(e.ZERO,e.ONE,e.ZERO),P.Fp=e,P.Fn=i;const E=i.BITS,D=Dg(P,t.endo?Math.ceil(E/2):E);return P}function Ql(r){return Uint8Array.of(r?2:3)}function Fg(r,t,e={}){on(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const i=t.randomBytes||Dr,n=t.hmac||((b,...I)=>tn(t.hash,b,er(...I))),{Fp:s,Fn:o}=r,{ORDER:c,BITS:l}=o;function u(b){const I=c>>Qr;return b>I}function h(b){return u(b)?o.neg(b):b}function d(b,I){if(!o.isValidNot0(I))throw new Error(`invalid signature ${b}: out of range 1..CURVE.n`)}class _{constructor(I,L,T){d("r",I),d("s",L),this.r=I,this.s=L,T!=null&&(this.recovery=T),Object.freeze(this)}static fromCompact(I){const L=o.BYTES,T=$e("compactSignature",I,L*2);return new _(o.fromBytes(T.subarray(0,L)),o.fromBytes(T.subarray(L,L*2)))}static fromDER(I){const{r:L,s:T}=At.toSig($e("DER",I));return new _(L,T)}assertValidity(){}addRecoveryBit(I){return new _(this.r,this.s,I)}recoverPublicKey(I){const L=s.ORDER,{r:T,s:x,recovery:$}=this;if($==null||![0,1,2,3].includes($))throw new Error("recovery id invalid");if(c*Mg<L&&$>1)throw new Error("recovery id is ambiguous for h>1 curve");const k=$===2||$===3?T+c:T;if(!s.isValid(k))throw new Error("recovery id 2 or 3 invalid");const q=s.toBytes(k),C=r.fromHex(er(Ql(($&1)===0),q)),N=o.inv(k),z=v($e("msgHash",I)),j=o.create(-z*N),F=o.create(x*N),H=r.BASE.multiplyUnsafe(j).add(C.multiplyUnsafe(F));if(H.is0())throw new Error("point at infinify");return H.assertValidity(),H}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,o.neg(this.s),this.recovery):this}toBytes(I){if(I==="compact")return er(o.toBytes(this.r),o.toBytes(this.s));if(I==="der")return eo(At.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return si(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return si(this.toBytes("compact"))}}const f=Yl(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),p={isValidPrivateKey(b){try{return f(b),!0}catch{return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{const b=c;return Pg(i(Hl(b)),b)},precompute(b=8,I=r.BASE){return I.precompute(b,!1)}};function w(b,I=!0){return r.fromPrivateKey(b).toBytes(I)}function g(b){if(typeof b=="bigint")return!1;if(b instanceof r)return!0;const I=$e("key",b).length,L=s.BYTES,T=L+1,x=2*L+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===T))return I===T||I===x}function A(b,I,L=!0){if(g(b)===!0)throw new Error("first arg must be private key");if(g(I)===!1)throw new Error("second arg must be public key");return r.fromHex(I).multiply(f(b)).toBytes(L)}const V=t.bits2int||function(b){if(b.length>8192)throw new Error("input is too large");const I=nn(b),L=b.length*8-l;return L>0?I>>BigInt(L):I},v=t.bits2int_modN||function(b){return o.create(V(b))},O=sn(l);function P(b){return ns("num < 2^"+l,b,Yr,O),o.toBytes(b)}function E(b,I,L=D){if(["recovered","canonical"].some(H=>H in L))throw new Error("sign() legacy options not supported");const{hash:T}=t;let{lowS:x,prehash:$,extraEntropy:k}=L;x==null&&(x=!0),b=$e("msgHash",b),Ta(L),$&&(b=$e("prehashed msgHash",T(b)));const q=v(b),C=f(I),N=[P(C),P(q)];if(k!=null&&k!==!1){const H=k===!0?i(s.BYTES):k;N.push($e("extraEntropy",H))}const z=er(...N),j=q;function F(H){const W=V(H);if(!o.isValidNot0(W))return;const G=o.inv(W),ue=r.BASE.multiply(W).toAffine(),ce=o.create(ue.x);if(ce===Yr)return;const oe=o.create(G*o.create(j+ce*C));if(oe===Yr)return;let He=(ue.x===ce?0:2)|Number(ue.y&Qr),mt=oe;return x&&u(oe)&&(mt=h(oe),He^=1),new _(ce,mt,He)}return{seed:z,k2sig:F}}const D={lowS:t.lowS,prehash:!1},R={lowS:t.lowS,prehash:!1};function m(b,I,L=D){const{seed:T,k2sig:x}=E(b,I,L);return wg(t.hash.outputLen,o.BYTES,n)(T,x)}r.BASE.precompute(8);function y(b,I,L,T=R){const x=b;I=$e("msgHash",I),L=$e("publicKey",L),Ta(T);const{lowS:$,prehash:k,format:q}=T;if("strict"in T)throw new Error("options.strict was renamed to lowS");if(q!==void 0&&!["compact","der","js"].includes(q))throw new Error('format must be "compact", "der" or "js"');const C=typeof x=="string"||Qs(x),N=!C&&!q&&typeof x=="object"&&x!==null&&typeof x.r=="bigint"&&typeof x.s=="bigint";if(!C&&!N)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let z,j;try{if(N)if(q===void 0||q==="js")z=new _(x.r,x.s);else throw new Error("invalid format");if(C){try{q!=="compact"&&(z=_.fromDER(x))}catch(He){if(!(He instanceof At.Err))throw He}!z&&q!=="der"&&(z=_.fromCompact(x))}j=r.fromHex(L)}catch{return!1}if(!z||$&&z.hasHighS())return!1;k&&(I=t.hash(I));const{r:F,s:H}=z,W=v(I),G=o.inv(H),ue=o.create(W*G),ce=o.create(F*G),oe=r.BASE.multiplyUnsafe(ue).add(j.multiplyUnsafe(ce));return oe.is0()?!1:o.create(oe.x)===F}return Object.freeze({getPublicKey:w,getSharedSecret:A,sign:m,verify:y,utils:p,Point:r,Signature:_})}function Hg(r){const t={a:r.a,b:r.b,p:r.Fp.ORDER,n:r.n,h:r.h,Gx:r.Gx,Gy:r.Gy},e=r.Fp,i=Lr(t.n,r.nBitLength),n={Fp:e,Fn:i,allowedPrivateKeyLengths:r.allowedPrivateKeyLengths,allowInfinityPoint:r.allowInfinityPoint,endo:r.endo,wrapPrivateKey:r.wrapPrivateKey,isTorsionFree:r.isTorsionFree,clearCofactor:r.clearCofactor,fromBytes:r.fromBytes,toBytes:r.toBytes};return{CURVE:t,curveOpts:n}}function Wg(r){const{CURVE:t,curveOpts:e}=Hg(r),i={hash:r.hash,hmac:r.hmac,randomBytes:r.randomBytes,lowS:r.lowS,bits2int:r.bits2int,bits2int_modN:r.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:i}}function Gg(r,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:r})}function Jg(r){const{CURVE:t,curveOpts:e,ecdsaOpts:i}=Wg(r),n=Kg(t,e),s=Fg(n,i,e);return Gg(r,s)}function os(r,t){const e=i=>Jg({...r,hash:i});return{...e(t),create:e}}const Zl={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},Xl={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},eu={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},Yg=Lr(Zl.p),Qg=Lr(Xl.p),Zg=Lr(eu.p),Xg=os({...Zl,Fp:Yg,lowS:!1},en);os({...Xl,Fp:Qg,lowS:!1},aw),os({...eu,Fp:Zg,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},ow);const em=Xg,tu="base10",Le="base16",Ne="base64pad",zt="base64url",fi="utf8",ru=0,Tt=1,pi=2,tm=0,Oa=1,Zr=12,oo=32;function rm(){const r=ss.utils.randomPrivateKey(),t=ss.getPublicKey(r);return{privateKey:Be(r,Le),publicKey:Be(t,Le)}}function as(){const r=Dr(oo);return Be(r,Le)}function im(r,t){const e=ss.getSharedSecret(Xe(r,Le),Xe(t,Le)),i=_g(rn,e,void 0,void 0,oo);return Be(i,Le)}function Si(r){const t=rn(Xe(r,Le));return Be(t,Le)}function Ye(r){const t=rn(Xe(r,fi));return Be(t,Le)}function iu(r){return Xe(`${r}`,tu)}function ar(r){return Number(Be(r,tu))}function nu(r){return r.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function su(r){const t=r.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function nm(r){const t=iu(typeof r.type<"u"?r.type:ru);if(ar(t)===Tt&&typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof r.senderPublicKey<"u"?Xe(r.senderPublicKey,Le):void 0,i=typeof r.iv<"u"?Xe(r.iv,Le):Dr(Zr),n=Xe(r.symKey,Le),s=Nl(n,i).encrypt(Xe(r.message,fi)),o=ou({type:t,sealed:s,iv:i,senderPublicKey:e});return r.encoding===zt?nu(o):o}function sm(r){const t=Xe(r.symKey,Le),{sealed:e,iv:i}=ai({encoded:r.encoded,encoding:r.encoding}),n=Nl(t,i).decrypt(e);if(n===null)throw new Error("Failed to decrypt");return Be(n,fi)}function om(r,t){const e=iu(pi),i=Dr(Zr),n=Xe(r,fi),s=ou({type:e,sealed:n,iv:i});return t===zt?nu(s):s}function am(r,t){const{sealed:e}=ai({encoded:r,encoding:t});return Be(e,fi)}function ou(r){if(ar(r.type)===pi)return Be(Wr([r.type,r.sealed]),Ne);if(ar(r.type)===Tt){if(typeof r.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Be(Wr([r.type,r.senderPublicKey,r.iv,r.sealed]),Ne)}return Be(Wr([r.type,r.iv,r.sealed]),Ne)}function ai(r){const t=(r.encoding||Ne)===zt?su(r.encoded):r.encoded,e=Xe(t,Ne),i=e.slice(tm,Oa),n=Oa;if(ar(i)===Tt){const l=n+oo,u=l+Zr,h=e.slice(n,l),d=e.slice(l,u),_=e.slice(u);return{type:i,sealed:_,iv:d,senderPublicKey:h}}if(ar(i)===pi){const l=e.slice(n),u=Dr(Zr);return{type:i,sealed:l,iv:u}}const s=n+Zr,o=e.slice(n,s),c=e.slice(s);return{type:i,sealed:c,iv:o}}function cm(r,t){const e=ai({encoded:r,encoding:t==null?void 0:t.encoding});return au({type:ar(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?Be(e.senderPublicKey,Le):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function au(r){const t=(r==null?void 0:r.type)||ru;if(t===Tt){if(typeof(r==null?void 0:r.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(r==null?void 0:r.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:r==null?void 0:r.senderPublicKey,receiverPublicKey:r==null?void 0:r.receiverPublicKey}}function Ra(r){return r.type===Tt&&typeof r.senderPublicKey=="string"&&typeof r.receiverPublicKey=="string"}function Da(r){return r.type===pi}function lm(r){const t=X.from(r.x,"base64"),e=X.from(r.y,"base64");return Wr([new Uint8Array([4]),t,e])}function um(r,t){const[e,i,n]=r.split("."),s=X.from(su(n),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),c=s.slice(32,64),l=`${e}.${i}`,u=rn(l),h=lm(t);if(!em.verify(Wr([o,c]),u,h))throw new Error("Invalid signature");return qn(r).payload}const hm="irn";function Yi(r){return(r==null?void 0:r.relay)||{protocol:hm}}function gr(r){const t=Vh[r];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${r}`);return t}function dm(r,t="-"){const e={},i="relay"+t;return Object.keys(r).forEach(n=>{if(n.startsWith(i)){const s=n.replace(i,""),o=r[n];e[s]=o}}),e}function La(r){if(!r.includes("wc:")){const u=ml(r);u!=null&&u.includes("wc:")&&(r=u)}r=r.includes("wc://")?r.replace("wc://",""):r,r=r.includes("wc:")?r.replace("wc:",""):r;const t=r.indexOf(":"),e=r.indexOf("?")!==-1?r.indexOf("?"):void 0,i=r.substring(0,t),n=r.substring(t+1,e).split("@"),s=typeof e<"u"?r.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:i,topic:_m(n[0]),version:parseInt(n[1],10),symKey:c.symKey,relay:dm(c),methods:l,expiryTimestamp:c.expiryTimestamp?parseInt(c.expiryTimestamp,10):void 0}}function _m(r){return r.startsWith("//")?r.substring(2):r}function fm(r,t="-"){const e="relay",i={};return Object.keys(r).forEach(n=>{const s=n,o=e+t+s;r[s]&&(i[o]=r[s])}),i}function Va(r){const t=new URLSearchParams,e=fm(r.relay);Object.keys(e).sort().forEach(n=>{t.set(n,e[n])}),t.set("symKey",r.symKey),r.expiryTimestamp&&t.set("expiryTimestamp",r.expiryTimestamp.toString()),r.methods&&t.set("methods",r.methods.join(","));const i=t.toString();return`${r.protocol}:${r.topic}@${r.version}?${i}`}function Oi(r,t,e){return`${r}?wc_ev=${e}&topic=${t}`}var pm=Object.defineProperty,wm=Object.defineProperties,gm=Object.getOwnPropertyDescriptors,xa=Object.getOwnPropertySymbols,mm=Object.prototype.hasOwnProperty,Em=Object.prototype.propertyIsEnumerable,Sa=(r,t,e)=>t in r?pm(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ym=(r,t)=>{for(var e in t||(t={}))mm.call(t,e)&&Sa(r,e,t[e]);if(xa)for(var e of xa(t))Em.call(t,e)&&Sa(r,e,t[e]);return r},vm=(r,t)=>wm(r,gm(t));function Vr(r){const t=[];return r.forEach(e=>{const[i,n]=e.split(":");t.push(`${i}:${n}`)}),t}function bm(r){const t=[];return Object.values(r).forEach(e=>{t.push(...Vr(e.accounts))}),t}function Im(r,t){const e=[];return Object.values(r).forEach(i=>{Vr(i.accounts).includes(t)&&e.push(...i.methods)}),e}function Am(r,t){const e=[];return Object.values(r).forEach(i=>{Vr(i.accounts).includes(t)&&e.push(...i.events)}),e}function cu(r){return r.includes(":")}function Pm(r){return cu(r)?r.split(":")[0]:r}function Ca(r){var t,e,i;const n={};if(!ci(r))return n;for(const[s,o]of Object.entries(r)){const c=cu(s)?[s]:o.chains,l=o.methods||[],u=o.events||[],h=Pm(s);n[h]=vm(ym({},n[h]),{chains:ir(c,(t=n[h])==null?void 0:t.chains),methods:ir(l,(e=n[h])==null?void 0:e.methods),events:ir(u,(i=n[h])==null?void 0:i.events)})}return n}function Tm(r){const t={};return r==null||r.forEach(e=>{var i;const[n,s]=e.split(":");t[n]||(t[n]={accounts:[],chains:[],events:[],methods:[]}),t[n].accounts.push(e),(i=t[n].chains)==null||i.push(`${n}:${s}`)}),t}function $a(r,t){t=t.map(i=>i.replace("did:pkh:",""));const e=Tm(t);for(const[i,n]of Object.entries(e))n.methods?n.methods=ir(n.methods,r):n.methods=r,n.events=["chainChanged","accountsChanged"];return e}function Om(r,t){var e,i,n,s,o,c;const l=Ca(r),u=Ca(t),h={},d=Object.keys(l).concat(Object.keys(u));for(const _ of d)h[_]={chains:ir((e=l[_])==null?void 0:e.chains,(i=u[_])==null?void 0:i.chains),methods:ir((n=l[_])==null?void 0:n.methods,(s=u[_])==null?void 0:s.methods),events:ir((o=l[_])==null?void 0:o.events,(c=u[_])==null?void 0:c.events)};return h}const Rm={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}},Dm={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 U(r,t){const{message:e,code:i}=Dm[r];return{message:t?`${e} ${t}`:e,code:i}}function ae(r,t){const{message:e,code:i}=Rm[r];return{message:t?`${e} ${t}`:e,code:i}}function yr(r,t){return Array.isArray(r)?typeof t<"u"&&r.length?r.every(t):!0:!1}function ci(r){return Object.getPrototypeOf(r)===Object.prototype&&Object.keys(r).length}function pe(r){return typeof r>"u"}function de(r,t){return t&&pe(r)?!0:typeof r=="string"&&!!r.trim().length}function ao(r,t){return t&&pe(r)?!0:typeof r=="number"&&!isNaN(r)}function Lm(r,t){const{requiredNamespaces:e}=t,i=Object.keys(r.namespaces),n=Object.keys(e);let s=!0;return Xt(n,i)?(i.forEach(o=>{const{accounts:c,methods:l,events:u}=r.namespaces[o],h=Vr(c),d=e[o];(!Xt(_l(o,d),h)||!Xt(d.methods,l)||!Xt(d.events,u))&&(s=!1)}),s):!1}function Qi(r){return de(r,!1)&&r.includes(":")?r.split(":").length===2:!1}function Vm(r){if(de(r,!1)&&r.includes(":")){const t=r.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&Qi(e)}}return!1}function xm(r){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(de(r,!1)){if(t(r))return!0;const e=ml(r);return t(e)}}catch{}return!1}function Sm(r){var t;return(t=r==null?void 0:r.proposer)==null?void 0:t.publicKey}function Cm(r){return r==null?void 0:r.topic}function $m(r,t){let e=null;return de(r==null?void 0:r.publicKey,!1)||(e=U("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function ka(r){let t=!0;return yr(r)?r.length&&(t=r.every(e=>de(e,!1))):t=!1,t}function km(r,t,e){let i=null;return yr(t)&&t.length?t.forEach(n=>{i||Qi(n)||(i=ae("UNSUPPORTED_CHAINS",`${e}, chain ${n} should be a string and conform to "namespace:chainId" format`))}):Qi(r)||(i=ae("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"] }`)),i}function Nm(r,t,e){let i=null;return Object.entries(r).forEach(([n,s])=>{if(i)return;const o=km(n,_l(n,s),`${t} ${e}`);o&&(i=o)}),i}function Um(r,t){let e=null;return yr(r)?r.forEach(i=>{e||Vm(i)||(e=ae("UNSUPPORTED_ACCOUNTS",`${t}, account ${i} should be a string and conform to "namespace:chainId:address" format`))}):e=ae("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function Bm(r,t){let e=null;return Object.values(r).forEach(i=>{if(e)return;const n=Um(i==null?void 0:i.accounts,`${t} namespace`);n&&(e=n)}),e}function qm(r,t){let e=null;return ka(r==null?void 0:r.methods)?ka(r==null?void 0:r.events)||(e=ae("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=ae("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function lu(r,t){let e=null;return Object.values(r).forEach(i=>{if(e)return;const n=qm(i,`${t}, namespace`);n&&(e=n)}),e}function Mm(r,t,e){let i=null;if(r&&ci(r)){const n=lu(r,t);n&&(i=n);const s=Nm(r,t,e);s&&(i=s)}else i=U("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return i}function On(r,t){let e=null;if(r&&ci(r)){const i=lu(r,t);i&&(e=i);const n=Bm(r,t);n&&(e=n)}else e=U("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function uu(r){return de(r.protocol,!0)}function zm(r,t){let e=!1;return r?r&&yr(r)&&r.length&&r.forEach(i=>{e=uu(i)}):e=!0,e}function jm(r){return typeof r=="number"}function Ce(r){return typeof r<"u"&&typeof r!==null}function Km(r){return!(!r||typeof r!="object"||!r.code||!ao(r.code,!1)||!r.message||!de(r.message,!1))}function Fm(r){return!(pe(r)||!de(r.method,!1))}function Hm(r){return!(pe(r)||pe(r.result)&&pe(r.error)||!ao(r.id,!1)||!de(r.jsonrpc,!1))}function Wm(r){return!(pe(r)||!de(r.name,!1))}function Na(r,t){return!(!Qi(t)||!bm(r).includes(t))}function Gm(r,t,e){return de(e,!1)?Im(r,t).includes(e):!1}function Jm(r,t,e){return de(e,!1)?Am(r,t).includes(e):!1}function Ua(r,t,e){let i=null;const n=Ym(r),s=Qm(t),o=Object.keys(n),c=Object.keys(s),l=Ba(Object.keys(r)),u=Ba(Object.keys(t)),h=l.filter(d=>!u.includes(d));return h.length&&(i=U("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
7
+ Required: ${h.toString()}
8
+ Received: ${Object.keys(t).toString()}`)),Xt(o,c)||(i=U("NON_CONFORMING_NAMESPACES",`${e} namespaces chains don't satisfy required namespaces.
9
+ Required: ${o.toString()}
10
+ Approved: ${c.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||i)return;const _=Vr(t[d].accounts);_.includes(d)||(i=U("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${d}
11
+ Required: ${d}
12
+ Approved: ${_.toString()}`))}),o.forEach(d=>{i||(Xt(n[d].methods,s[d].methods)?Xt(n[d].events,s[d].events)||(i=U("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):i=U("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),i}function Ym(r){const t={};return Object.keys(r).forEach(e=>{var i;e.includes(":")?t[e]=r[e]:(i=r[e].chains)==null||i.forEach(n=>{t[n]={methods:r[e].methods,events:r[e].events}})}),t}function Ba(r){return[...new Set(r.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Qm(r){const t={};return Object.keys(r).forEach(e=>{if(e.includes(":"))t[e]=r[e];else{const i=Vr(r[e].accounts);i==null||i.forEach(n=>{t[n]={accounts:r[e].accounts.filter(s=>s.includes(`${n}:`)),methods:r[e].methods,events:r[e].events}})}}),t}function Zm(r,t){return ao(r,!1)&&r<=t.max&&r>=t.min}function qa(){const r=di();return new Promise(t=>{switch(r){case Fe.browser:t(Xm());break;case Fe.reactNative:t(eE());break;case Fe.node:t(tE());break;default:t(!0)}})}function Xm(){return Rr()&&(navigator==null?void 0:navigator.onLine)}async function eE(){if(Wt()&&typeof K<"u"&&K!=null&&K.NetInfo){const r=await(K==null?void 0:K.NetInfo.fetch());return r==null?void 0:r.isConnected}return!0}function tE(){return!0}function rE(r){switch(di()){case Fe.browser:iE(r);break;case Fe.reactNative:nE(r);break}}function iE(r){!Wt()&&Rr()&&(window.addEventListener("online",()=>r(!0)),window.addEventListener("offline",()=>r(!1)))}function nE(r){var t;Wt()&&typeof K<"u"&&K!=null&&K.NetInfo&&((t=K)==null||t.NetInfo.addEventListener(e=>r(e==null?void 0:e.isConnected)))}function sE(){var r;return Rr()&&Ot.getDocument()?((r=Ot.getDocument())==null?void 0:r.visibilityState)==="visible":!0}const Rn={};class Ur{static get(t){return Rn[t]}static set(t,e){Rn[t]=e}static delete(t){delete Rn[t]}}function oE(r){const t=ui.decode(r);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function aE({publicKey:r,signature:t,payload:e}){var i;const n=cs(e.method),s=128|parseInt(((i=e.version)==null?void 0:i.toString())||"4"),o=uE(e.address),c=e.era==="00"?new Uint8Array([0]):cs(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${lE(e.tip)}`),d=dE(h),_=new Uint8Array([0,...r,o,...t,...c,...u,...d,...n]),f=hE(_.length+1);return new Uint8Array([...f,s,..._])}function cE(r){const t=cs(r),e=Sh.blake2b(t,void 0,32);return"0x"+X.from(e).toString("hex")}function cs(r){return new Uint8Array(r.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function lE(r){return r.startsWith("0x")?r.slice(2):r}function uE(r){const t=ui.decode(r)[0];return t===42?0:t===60?2:1}function hE(r){if(r<64)return new Uint8Array([r<<2]);if(r<16384){const t=r<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(r<1<<30){const t=r<<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 dE(r){if(r<BigInt(1)<<BigInt(6))return new Uint8Array([Number(r<<BigInt(2))]);if(r<BigInt(1)<<BigInt(14)){const t=r<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(r<BigInt(1)<<BigInt(30)){const t=r<<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 _E(r){const t=Uint8Array.from(X.from(r.signature,"hex")),e=oE(r.transaction.address),i=aE({publicKey:e,signature:t,payload:r.transaction}),n=X.from(i).toString("hex");return cE(n)}var fE={};const hu="wc",du=2,ls="core",gt=`${hu}@2:${ls}:`,pE={logger:"error"},wE={database:":memory:"},gE="crypto",Ma="client_ed25519_seed",mE=B.ONE_DAY,EE="keychain",yE="0.3",vE="messages",bE="0.3",IE=B.SIX_HOURS,AE="publisher",_u="irn",PE="error",fu="wss://relay.walletconnect.org",TE="relayer",le={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"},OE="_subscription",We={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},RE=.1,us="2.21.8",se={link_mode:"link_mode",relay:"relay"},Ci={inbound:"inbound",outbound:"outbound"},DE="0.3",LE="WALLETCONNECT_CLIENT_ID",za="WALLETCONNECT_LINK_MODE_APPS",je={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},VE="subscription",xE="0.3",SE="pairing",CE="0.3",Br={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}}},Qt={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},rt={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},$E="history",kE="0.3",NE="expirer",Je={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},UE="0.3",BE="verify-api",qE="https://verify.walletconnect.com",pu="https://verify.walletconnect.org",Xr=pu,ME=`${Xr}/v3`,zE=[qE,pu],jE="echo",KE="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"},qr={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"},Mr={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"},FE=.1,HE="event-client",WE=86400,GE="https://pulse.walletconnect.org/batch";function JE(r,t){if(r.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),i=0;i<e.length;i++)e[i]=255;for(var n=0;n<r.length;n++){var s=r.charAt(n),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=n}var c=r.length,l=r.charAt(0),u=Math.log(c)/Math.log(256),h=Math.log(256)/Math.log(c);function d(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(p.length===0)return"";for(var w=0,g=0,A=0,V=p.length;A!==V&&p[A]===0;)A++,w++;for(var v=(V-A)*h+1>>>0,O=new Uint8Array(v);A!==V;){for(var P=p[A],E=0,D=v-1;(P!==0||E<g)&&D!==-1;D--,E++)P+=256*O[D]>>>0,O[D]=P%c>>>0,P=P/c>>>0;if(P!==0)throw new Error("Non-zero carry");g=E,A++}for(var R=v-g;R!==v&&O[R]===0;)R++;for(var m=l.repeat(w);R<v;++R)m+=r.charAt(O[R]);return m}function _(p){if(typeof p!="string")throw new TypeError("Expected String");if(p.length===0)return new Uint8Array;var w=0;if(p[w]!==" "){for(var g=0,A=0;p[w]===l;)g++,w++;for(var V=(p.length-w)*u+1>>>0,v=new Uint8Array(V);p[w];){var O=e[p.charCodeAt(w)];if(O===255)return;for(var P=0,E=V-1;(O!==0||P<A)&&E!==-1;E--,P++)O+=c*v[E]>>>0,v[E]=O%256>>>0,O=O/256>>>0;if(O!==0)throw new Error("Non-zero carry");A=P,w++}if(p[w]!==" "){for(var D=V-A;D!==V&&v[D]===0;)D++;for(var R=new Uint8Array(g+(V-D)),m=g;D!==V;)R[m++]=v[D++];return R}}}function f(p){var w=_(p);if(w)return w;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:_,decode:f}}var YE=JE,QE=YE;const wu=r=>{if(r instanceof Uint8Array&&r.constructor.name==="Uint8Array")return r;if(r instanceof ArrayBuffer)return new Uint8Array(r);if(ArrayBuffer.isView(r))return new Uint8Array(r.buffer,r.byteOffset,r.byteLength);throw new Error("Unknown type, must be binary type")},ZE=r=>new TextEncoder().encode(r),XE=r=>new TextDecoder().decode(r);class ey{constructor(t,e,i){this.name=t,this.prefix=e,this.baseEncode=i}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class ty{constructor(t,e,i){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=i}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 gu(this,t)}}class ry{constructor(t){this.decoders=t}or(t){return gu(this,t)}decode(t){const e=t[0],i=this.decoders[e];if(i)return i.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const gu=(r,t)=>new ry({...r.decoders||{[r.prefix]:r},...t.decoders||{[t.prefix]:t}});class iy{constructor(t,e,i,n){this.name=t,this.prefix=e,this.baseEncode=i,this.baseDecode=n,this.encoder=new ey(t,e,i),this.decoder=new ty(t,e,n)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const an=({name:r,prefix:t,encode:e,decode:i})=>new iy(r,t,e,i),wi=({prefix:r,name:t,alphabet:e})=>{const{encode:i,decode:n}=QE(e,t);return an({prefix:r,name:t,encode:i,decode:s=>wu(n(s))})},ny=(r,t,e,i)=>{const n={};for(let h=0;h<t.length;++h)n[t[h]]=h;let s=r.length;for(;r[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=n[r[h]];if(d===void 0)throw new SyntaxError(`Non-${i} 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},sy=(r,t,e)=>{const i=t[t.length-1]==="=",n=(1<<e)-1;let s="",o=0,c=0;for(let l=0;l<r.length;++l)for(c=c<<8|r[l],o+=8;o>e;)o-=e,s+=t[n&c>>o];if(o&&(s+=t[n&c<<e-o]),i)for(;s.length*e&7;)s+="=";return s},be=({name:r,prefix:t,bitsPerChar:e,alphabet:i})=>an({prefix:t,name:r,encode(n){return sy(n,i,e)},decode(n){return ny(n,i,e,r)}}),oy=an({prefix:"\0",name:"identity",encode:r=>XE(r),decode:r=>ZE(r)});var ay=Object.freeze({__proto__:null,identity:oy});const cy=be({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ly=Object.freeze({__proto__:null,base2:cy});const uy=be({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var hy=Object.freeze({__proto__:null,base8:uy});const dy=wi({prefix:"9",name:"base10",alphabet:"0123456789"});var _y=Object.freeze({__proto__:null,base10:dy});const fy=be({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),py=be({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var wy=Object.freeze({__proto__:null,base16:fy,base16upper:py});const gy=be({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),my=be({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Ey=be({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),yy=be({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),vy=be({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),by=be({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Iy=be({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Ay=be({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Py=be({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ty=Object.freeze({__proto__:null,base32:gy,base32upper:my,base32pad:Ey,base32padupper:yy,base32hex:vy,base32hexupper:by,base32hexpad:Iy,base32hexpadupper:Ay,base32z:Py});const Oy=wi({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ry=wi({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Dy=Object.freeze({__proto__:null,base36:Oy,base36upper:Ry});const Ly=wi({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),Vy=wi({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var xy=Object.freeze({__proto__:null,base58btc:Ly,base58flickr:Vy});const Sy=be({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Cy=be({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),$y=be({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ky=be({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ny=Object.freeze({__proto__:null,base64:Sy,base64pad:Cy,base64url:$y,base64urlpad:ky});const mu=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Uy=mu.reduce((r,t,e)=>(r[e]=t,r),[]),By=mu.reduce((r,t,e)=>(r[t.codePointAt(0)]=e,r),[]);function qy(r){return r.reduce((t,e)=>(t+=Uy[e],t),"")}function My(r){const t=[];for(const e of r){const i=By[e.codePointAt(0)];if(i===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(i)}return new Uint8Array(t)}const zy=an({prefix:"🚀",name:"base256emoji",encode:qy,decode:My});var jy=Object.freeze({__proto__:null,base256emoji:zy}),Ky=Eu,ja=128,Fy=-128,Hy=Math.pow(2,31);function Eu(r,t,e){t=t||[],e=e||0;for(var i=e;r>=Hy;)t[e++]=r&255|ja,r/=128;for(;r&Fy;)t[e++]=r&255|ja,r>>>=7;return t[e]=r|0,Eu.bytes=e-i+1,t}var Wy=hs,Gy=128,Ka=127;function hs(r,i){var e=0,i=i||0,n=0,s=i,o,c=r.length;do{if(s>=c)throw hs.bytes=0,new RangeError("Could not decode varint");o=r[s++],e+=n<28?(o&Ka)<<n:(o&Ka)*Math.pow(2,n),n+=7}while(o>=Gy);return hs.bytes=s-i,e}var Jy=Math.pow(2,7),Yy=Math.pow(2,14),Qy=Math.pow(2,21),Zy=Math.pow(2,28),Xy=Math.pow(2,35),e0=Math.pow(2,42),t0=Math.pow(2,49),r0=Math.pow(2,56),i0=Math.pow(2,63),n0=function(r){return r<Jy?1:r<Yy?2:r<Qy?3:r<Zy?4:r<Xy?5:r<e0?6:r<t0?7:r<r0?8:r<i0?9:10},s0={encode:Ky,decode:Wy,encodingLength:n0},yu=s0;const Fa=(r,t,e=0)=>(yu.encode(r,t,e),t),Ha=r=>yu.encodingLength(r),ds=(r,t)=>{const e=t.byteLength,i=Ha(r),n=i+Ha(e),s=new Uint8Array(n+e);return Fa(r,s,0),Fa(e,s,i),s.set(t,n),new o0(r,e,t,s)};class o0{constructor(t,e,i,n){this.code=t,this.size=e,this.digest=i,this.bytes=n}}const vu=({name:r,code:t,encode:e})=>new a0(r,t,e);class a0{constructor(t,e,i){this.name=t,this.code=e,this.encode=i}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?ds(this.code,e):e.then(i=>ds(this.code,i))}else throw Error("Unknown type, must be binary type")}}const bu=r=>async t=>new Uint8Array(await crypto.subtle.digest(r,t)),c0=vu({name:"sha2-256",code:18,encode:bu("SHA-256")}),l0=vu({name:"sha2-512",code:19,encode:bu("SHA-512")});var u0=Object.freeze({__proto__:null,sha256:c0,sha512:l0});const Iu=0,h0="identity",Au=wu,d0=r=>ds(Iu,Au(r)),_0={code:Iu,name:h0,encode:Au,digest:d0};var f0=Object.freeze({__proto__:null,identity:_0});new TextEncoder,new TextDecoder;const Wa={...ay,...ly,...hy,..._y,...wy,...Ty,...Dy,...xy,...Ny,...jy};({...u0,...f0});function Pu(r){return globalThis.Buffer!=null?new Uint8Array(r.buffer,r.byteOffset,r.byteLength):r}function p0(r=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Pu(globalThis.Buffer.allocUnsafe(r)):new Uint8Array(r)}function Tu(r,t,e,i){return{name:r,prefix:t,encoder:{name:r,prefix:t,encode:e},decoder:{decode:i}}}const Ga=Tu("utf8","u",r=>"u"+new TextDecoder("utf8").decode(r),r=>new TextEncoder().encode(r.substring(1))),Dn=Tu("ascii","a",r=>{let t="a";for(let e=0;e<r.length;e++)t+=String.fromCharCode(r[e]);return t},r=>{r=r.substring(1);const t=p0(r.length);for(let e=0;e<r.length;e++)t[e]=r.charCodeAt(e);return t}),w0={utf8:Ga,"utf-8":Ga,hex:Wa.base16,latin1:Dn,ascii:Dn,binary:Dn,...Wa};function g0(r,t="utf8"){const e=w0[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Pu(globalThis.Buffer.from(r,"utf-8")):e.decoder.decode(`${e.prefix}${r}`)}var m0=Object.defineProperty,E0=(r,t,e)=>t in r?m0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ut=(r,t,e)=>E0(r,typeof t!="symbol"?t+"":t,e);class y0{constructor(t,e){this.core=t,this.logger=e,ut(this,"keychain",new Map),ut(this,"name",EE),ut(this,"version",yE),ut(this,"initialized",!1),ut(this,"storagePrefix",gt),ut(this,"init",async()=>{if(!this.initialized){const i=await this.getKeyChain();typeof i<"u"&&(this.keychain=i),this.initialized=!0}}),ut(this,"has",i=>(this.isInitialized(),this.keychain.has(i))),ut(this,"set",async(i,n)=>{this.isInitialized(),this.keychain.set(i,n),await this.persist()}),ut(this,"get",i=>{this.isInitialized();const n=this.keychain.get(i);if(typeof n>"u"){const{message:s}=U("NO_MATCHING_KEY",`${this.name}: ${i}`);throw new Error(s)}return n}),ut(this,"del",async i=>{this.isInitialized(),this.keychain.delete(i),await this.persist()}),this.core=t,this.logger=Ve(e,this.name)}get context(){return Me(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,Yn(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Qn(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var v0=Object.defineProperty,b0=(r,t,e)=>t in r?v0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ee=(r,t,e)=>b0(r,typeof t!="symbol"?t+"":t,e);class I0{constructor(t,e,i){this.core=t,this.logger=e,Ee(this,"name",gE),Ee(this,"keychain"),Ee(this,"randomSessionIdentifier",as()),Ee(this,"initialized",!1),Ee(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Ee(this,"hasKeys",n=>(this.isInitialized(),this.keychain.has(n))),Ee(this,"getClientId",async()=>{this.isInitialized();const n=await this.getClientSeed(),s=mo(n);return Nh(s.publicKey)}),Ee(this,"generateKeyPair",()=>{this.isInitialized();const n=rm();return this.setPrivateKey(n.publicKey,n.privateKey)}),Ee(this,"signJWT",async n=>{this.isInitialized();const s=await this.getClientSeed(),o=mo(s),c=this.randomSessionIdentifier;return await Uh(c,n,mE,o)}),Ee(this,"generateSharedKey",(n,s,o)=>{this.isInitialized();const c=this.getPrivateKey(n),l=im(c,s);return this.setSymKey(l,o)}),Ee(this,"setSymKey",async(n,s)=>{this.isInitialized();const o=s||Si(n);return await this.keychain.set(o,n),o}),Ee(this,"deleteKeyPair",async n=>{this.isInitialized(),await this.keychain.del(n)}),Ee(this,"deleteSymKey",async n=>{this.isInitialized(),await this.keychain.del(n)}),Ee(this,"encode",async(n,s,o)=>{this.isInitialized();const c=au(o),l=ti(s);if(Da(c))return om(l,o==null?void 0:o.encoding);if(Ra(c)){const _=c.senderPublicKey,f=c.receiverPublicKey;n=await this.generateSharedKey(_,f)}const u=this.getSymKey(n),{type:h,senderPublicKey:d}=c;return nm({type:h,symKey:u,message:l,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),Ee(this,"decode",async(n,s,o)=>{this.isInitialized();const c=cm(s,o);if(Da(c)){const l=am(s,o==null?void 0:o.encoding);return Bi(l)}if(Ra(c)){const l=c.receiverPublicKey,u=c.senderPublicKey;n=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(n),u=sm({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return Bi(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${n}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),Ee(this,"getPayloadType",(n,s=Ne)=>{const o=ai({encoded:n,encoding:s});return ar(o.type)}),Ee(this,"getPayloadSenderPublicKey",(n,s=Ne)=>{const o=ai({encoded:n,encoding:s});return o.senderPublicKey?Be(o.senderPublicKey,Le):void 0}),this.core=t,this.logger=Ve(e,this.name),this.keychain=i||new y0(this.core,this.logger)}get context(){return Me(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(Ma)}catch{t=as(),await this.keychain.set(Ma,t)}return g0(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var A0=Object.defineProperty,P0=Object.defineProperties,T0=Object.getOwnPropertyDescriptors,Ja=Object.getOwnPropertySymbols,O0=Object.prototype.hasOwnProperty,R0=Object.prototype.propertyIsEnumerable,_s=(r,t,e)=>t in r?A0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,D0=(r,t)=>{for(var e in t||(t={}))O0.call(t,e)&&_s(r,e,t[e]);if(Ja)for(var e of Ja(t))R0.call(t,e)&&_s(r,e,t[e]);return r},L0=(r,t)=>P0(r,T0(t)),ze=(r,t,e)=>_s(r,typeof t!="symbol"?t+"":t,e);class V0 extends p_{constructor(t,e){super(t,e),this.logger=t,this.core=e,ze(this,"messages",new Map),ze(this,"messagesWithoutClientAck",new Map),ze(this,"name",vE),ze(this,"version",bE),ze(this,"initialized",!1),ze(this,"storagePrefix",gt),ze(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const i=await this.getRelayerMessages();typeof i<"u"&&(this.messages=i);const n=await this.getRelayerMessagesWithoutClientAck();typeof n<"u"&&(this.messagesWithoutClientAck=n),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(i){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(i)}finally{this.initialized=!0}}}),ze(this,"set",async(i,n,s)=>{this.isInitialized();const o=Ye(n);let c=this.messages.get(i);if(typeof c>"u"&&(c={}),typeof c[o]<"u")return o;if(c[o]=n,this.messages.set(i,c),s===Ci.inbound){const l=this.messagesWithoutClientAck.get(i)||{};this.messagesWithoutClientAck.set(i,L0(D0({},l),{[o]:n}))}return await this.persist(),o}),ze(this,"get",i=>{this.isInitialized();let n=this.messages.get(i);return typeof n>"u"&&(n={}),n}),ze(this,"getWithoutAck",i=>{this.isInitialized();const n={};for(const s of i){const o=this.messagesWithoutClientAck.get(s)||{};n[s]=Object.values(o)}return n}),ze(this,"has",(i,n)=>{this.isInitialized();const s=this.get(i),o=Ye(n);return typeof s[o]<"u"}),ze(this,"ack",async(i,n)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(i);if(typeof s>"u")return;const o=Ye(n);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(i):this.messagesWithoutClientAck.set(i,s),await this.persist()}),ze(this,"del",async i=>{this.isInitialized(),this.messages.delete(i),this.messagesWithoutClientAck.delete(i),await this.persist()}),this.logger=Ve(t,this.name),this.core=e}get context(){return Me(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,Yn(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,Yn(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?Qn(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?Qn(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var x0=Object.defineProperty,S0=Object.defineProperties,C0=Object.getOwnPropertyDescriptors,Ya=Object.getOwnPropertySymbols,$0=Object.prototype.hasOwnProperty,k0=Object.prototype.propertyIsEnumerable,fs=(r,t,e)=>t in r?x0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_r=(r,t)=>{for(var e in t||(t={}))$0.call(t,e)&&fs(r,e,t[e]);if(Ya)for(var e of Ya(t))k0.call(t,e)&&fs(r,e,t[e]);return r},Qa=(r,t)=>S0(r,C0(t)),Ge=(r,t,e)=>fs(r,typeof t!="symbol"?t+"":t,e);class N0 extends w_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,Ge(this,"events",new cr.EventEmitter),Ge(this,"name",AE),Ge(this,"queue",new Map),Ge(this,"publishTimeout",B.toMiliseconds(B.ONE_MINUTE)),Ge(this,"initialPublishTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Ge(this,"needsTransportRestart",!1),Ge(this,"publish",async(i,n,s)=>{var o,c,l,u,h;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:i,message:n,opts:s}});const d=(s==null?void 0:s.ttl)||IE,_=(s==null?void 0:s.prompt)||!1,f=(s==null?void 0:s.tag)||0,p=(s==null?void 0:s.id)||Zt().toString(),w=gr(Yi().protocol),g={id:p,method:(s==null?void 0:s.publishMethod)||w.publish,params:_r({topic:i,message:n,ttl:d,prompt:_,tag:f,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},A=`Failed to publish payload, please try again. id:${p} tag:${f}`;try{pe((o=g.params)==null?void 0:o.prompt)&&((c=g.params)==null||delete c.prompt),pe((l=g.params)==null?void 0:l.tag)&&((u=g.params)==null||delete u.tag);const V=new Promise(async v=>{const O=({id:E})=>{var D;((D=g.id)==null?void 0:D.toString())===E.toString()&&(this.removeRequestFromQueue(E),this.relayer.events.removeListener(le.publish,O),v())};this.relayer.events.on(le.publish,O);const P=pt(new Promise((E,D)=>{this.rpcPublish(g,s).then(E).catch(R=>{this.logger.warn(R,R==null?void 0:R.message),D(R)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${p} tag:${f}`);try{await P,this.events.removeListener(le.publish,O)}catch(E){this.queue.set(p,{request:g,opts:s,attempt:1}),this.logger.warn(E,E==null?void 0:E.message)}});this.logger.trace({type:"method",method:"publish",params:{id:p,topic:i,message:n,opts:s}}),await pt(V,this.publishTimeout,A)}catch(V){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(V),(h=s==null?void 0:s.internal)!=null&&h.throwOnFailedPublish)throw V}finally{this.queue.delete(p)}}),Ge(this,"publishCustom",async i=>{var n,s,o,c,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:i});const{payload:u,opts:h={}}=i,{attestation:d,tvf:_,publishMethod:f,prompt:p,tag:w,ttl:g=B.FIVE_MINUTES}=h,A=h.id||Zt().toString(),V=gr(Yi().protocol),v=f||V.publish,O={id:A,method:v,params:_r(Qa(_r({},u),{ttl:g,prompt:p,tag:w,attestation:d}),_)},P=`Failed to publish custom payload, please try again. id:${A} tag:${w}`;try{pe((n=O.params)==null?void 0:n.prompt)&&((s=O.params)==null||delete s.prompt),pe((o=O.params)==null?void 0:o.tag)&&((c=O.params)==null||delete c.tag);const E=new Promise(async D=>{const R=({id:y})=>{var b;((b=O.id)==null?void 0:b.toString())===y.toString()&&(this.removeRequestFromQueue(y),this.relayer.events.removeListener(le.publish,R),D())};this.relayer.events.on(le.publish,R);const m=pt(new Promise((y,b)=>{this.rpcPublish(O,h).then(y).catch(I=>{this.logger.warn(I,I==null?void 0:I.message),b(I)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${v} id:${A} tag:${w}`);try{await m,this.events.removeListener(le.publish,R)}catch(y){this.queue.set(A,{request:O,opts:h,attempt:1}),this.logger.warn(y,y==null?void 0:y.message)}});this.logger.trace({type:"method",method:"publish",params:{id:A,payload:u,opts:h}}),await pt(E,this.publishTimeout,P)}catch(E){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(E),(l=h==null?void 0:h.internal)!=null&&l.throwOnFailedPublish)throw E}finally{this.queue.delete(A)}}),Ge(this,"on",(i,n)=>{this.events.on(i,n)}),Ge(this,"once",(i,n)=>{this.events.once(i,n)}),Ge(this,"off",(i,n)=>{this.events.off(i,n)}),Ge(this,"removeListener",(i,n)=>{this.events.removeListener(i,n)}),this.relayer=t,this.logger=Ve(e,this.name),this.registerEventListeners()}get context(){return Me(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const i=await this.relayer.request(t);return this.relayer.events.emit(le.publish,_r(_r({},t),e)),this.logger.debug("Successfully Published Payload"),i}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var i;const n=t.attempt+1;this.queue.set(e,Qa(_r({},t),{attempt:n})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(i=t.request.params)==null?void 0:i.tag}, attempt: ${n}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Ar.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(le.connection_stalled);return}this.checkQueue()}),this.relayer.on(le.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var U0=Object.defineProperty,B0=(r,t,e)=>t in r?U0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fr=(r,t,e)=>B0(r,typeof t!="symbol"?t+"":t,e);class q0{constructor(){fr(this,"map",new Map),fr(this,"set",(t,e)=>{const i=this.get(t);this.exists(t,e)||this.map.set(t,[...i,e])}),fr(this,"get",t=>this.map.get(t)||[]),fr(this,"exists",(t,e)=>this.get(t).includes(e)),fr(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const i=this.get(t);if(!this.exists(t,e))return;const n=i.filter(s=>s!==e);if(!n.length){this.map.delete(t);return}this.map.set(t,n)}),fr(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var M0=Object.defineProperty,z0=Object.defineProperties,j0=Object.getOwnPropertyDescriptors,Za=Object.getOwnPropertySymbols,K0=Object.prototype.hasOwnProperty,F0=Object.prototype.propertyIsEnumerable,ps=(r,t,e)=>t in r?M0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zr=(r,t)=>{for(var e in t||(t={}))K0.call(t,e)&&ps(r,e,t[e]);if(Za)for(var e of Za(t))F0.call(t,e)&&ps(r,e,t[e]);return r},Ln=(r,t)=>z0(r,j0(t)),ie=(r,t,e)=>ps(r,typeof t!="symbol"?t+"":t,e);class H0 extends E_{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ie(this,"subscriptions",new Map),ie(this,"topicMap",new q0),ie(this,"events",new cr.EventEmitter),ie(this,"name",VE),ie(this,"version",xE),ie(this,"pending",new Map),ie(this,"cached",[]),ie(this,"initialized",!1),ie(this,"storagePrefix",gt),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(i,n)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}});try{const o=Yi(n),c={topic:i,relay:o,transportType:n==null?void 0:n.transportType};(s=n==null?void 0:n.internal)!=null&&s.skipSubscribe||this.pending.set(i,c);const l=await this.rpcSubscribe(i,o,n);return typeof l=="string"&&(this.onSubscribe(l,c),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:n}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),ie(this,"unsubscribe",async(i,n)=>{this.isInitialized(),typeof(n==null?void 0:n.id)<"u"?await this.unsubscribeById(i,n.id,n):await this.unsubscribeByTopic(i,n)}),ie(this,"isSubscribed",i=>new Promise(n=>{n(this.topicMap.topics.includes(i))})),ie(this,"isKnownTopic",i=>new Promise(n=>{n(this.topicMap.topics.includes(i)||this.pending.has(i)||this.cached.some(s=>s.topic===i))})),ie(this,"on",(i,n)=>{this.events.on(i,n)}),ie(this,"once",(i,n)=>{this.events.once(i,n)}),ie(this,"off",(i,n)=>{this.events.off(i,n)}),ie(this,"removeListener",(i,n)=>{this.events.removeListener(i,n)}),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 i=[];this.pending.forEach(n=>{i.push(n)}),await this.batchSubscribe(i)}),ie(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Ar.pulse,async()=>{await this.checkPending()}),this.events.on(je.created,async i=>{const n=je.created;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()}),this.events.on(je.deleted,async i=>{const n=je.deleted;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:i}),await this.persist()})}),this.relayer=t,this.logger=Ve(e,this.name),this.clientId=""}get context(){return Me(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 i=!1;try{i=this.getSubscription(t).topic===e}catch{}return i}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 i=this.topicMap.get(t);await Promise.all(i.map(async n=>await this.unsubscribeById(t,n,e)))}async unsubscribeById(t,e,i){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:i}});try{const n=Yi(i);await this.restartToComplete({topic:t,id:e,relay:n}),await this.rpcUnsubscribe(t,e,n);const s=ae("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:i}})}catch(n){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(n),n}}async rpcSubscribe(t,e,i){var n,s;const o=await this.getSubscriptionId(t);if((n=i==null?void 0:i.internal)!=null&&n.skipSubscribe)return o;(!i||(i==null?void 0:i.transportType)===se.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const c={method:gr(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:c});const l=(s=i==null?void 0:i.internal)==null?void 0:s.throwOnFailedPublish;try{if((i==null?void 0:i.transportType)===se.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 _=f=>{f.topic===t&&(this.events.removeListener(je.created,_),d(f.id))};this.events.on(je.created,_);try{const f=await pt(new Promise((p,w)=>{this.relayer.request(c).catch(g=>{this.logger.warn(g,g==null?void 0:g.message),w(g)}).then(p)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(je.created,_),d(f)}catch{}}),h=await pt(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(le.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,i={method:gr(e.protocol).batchSubscribe,params:{topics:t.map(n=>n.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});try{await await pt(new Promise(n=>{this.relayer.request(i).catch(s=>this.logger.warn(s)).then(n)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,i={method:gr(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i});let n;try{n=await await pt(new Promise((s,o)=>{this.relayer.request(i).catch(c=>{this.logger.warn(c),o(c)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(le.connection_stalled)}return n}rpcUnsubscribe(t,e,i){const n={method:gr(i.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(t,e){this.setSubscription(t,Ln(zr({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,zr({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,i){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,i),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,zr({},e)),this.topicMap.set(e.topic,t),this.events.emit(je.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:i}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(i)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const i=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(i.topic,t),this.events.emit(je.deleted,Ln(zr({},i),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(je.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let i=0;i<e;i++){const n=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(n)}}this.events.emit(je.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var i;return e.topic===((i=this.subscriptions.get(e.id))==null?void 0:i.topic)})){const{message:e}=U("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=>Ln(zr({},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 Ap(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}=U("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 Ye(t+await this.getClientId())}}var W0=Object.defineProperty,Xa=Object.getOwnPropertySymbols,G0=Object.prototype.hasOwnProperty,J0=Object.prototype.propertyIsEnumerable,ws=(r,t,e)=>t in r?W0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ec=(r,t)=>{for(var e in t||(t={}))G0.call(t,e)&&ws(r,e,t[e]);if(Xa)for(var e of Xa(t))J0.call(t,e)&&ws(r,e,t[e]);return r},Z=(r,t,e)=>ws(r,typeof t!="symbol"?t+"":t,e);class Y0 extends g_{constructor(t){super(t),Z(this,"protocol","wc"),Z(this,"version",2),Z(this,"core"),Z(this,"logger"),Z(this,"events",new cr.EventEmitter),Z(this,"provider"),Z(this,"messages"),Z(this,"subscriber"),Z(this,"publisher"),Z(this,"name",TE),Z(this,"transportExplicitlyClosed",!1),Z(this,"initialized",!1),Z(this,"connectionAttemptInProgress",!1),Z(this,"relayUrl"),Z(this,"projectId"),Z(this,"packageName"),Z(this,"bundleId"),Z(this,"hasExperiencedNetworkDisruption",!1),Z(this,"pingTimeout"),Z(this,"heartBeatTimeout",B.toMiliseconds(B.THIRTY_SECONDS+B.FIVE_SECONDS)),Z(this,"reconnectTimeout"),Z(this,"connectPromise"),Z(this,"reconnectInProgress",!1),Z(this,"requestsInFlight",[]),Z(this,"connectTimeout",B.toMiliseconds(B.ONE_SECOND*15)),Z(this,"request",async e=>{var i,n;this.logger.debug("Publishing Request Payload");const s=e.id||Zt().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(i=e.params)==null?void 0:i.topic},"relayer.request - publishing...");const o=`${s}:${((n=e.params)==null?void 0:n.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}}),Z(this,"resetPingTimeout",()=>{Hi()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,i,n,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(n=(i=(e=this.provider)==null?void 0:e.connection)==null?void 0:i.socket)==null?void 0:n.terminate)==null||s.call(n)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),Z(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Z(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(le.connect)}),Z(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),Z(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(le.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),Z(this,"registerProviderListeners",()=>{this.provider.on(We.payload,this.onPayloadHandler),this.provider.on(We.connect,this.onConnectHandler),this.provider.on(We.disconnect,this.onDisconnectHandler),this.provider.on(We.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?Ve(t.logger,this.name):Zi(js({level:t.logger||PE})),this.messages=new V0(this.logger,t.core),this.subscriber=new H0(this,this.logger),this.publisher=new N0(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||fu,cp()?this.packageName=Yo():lp()&&(this.bundleId=Yo()),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==null?void 0:t.message))}get context(){return Me(this.logger)}get connected(){var t,e,i;return((i=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:i.readyState)===1||!1}get connecting(){var t,e,i;return((i=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:i.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,i){this.isInitialized(),await this.publisher.publish(t,e,i),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:se.relay},Ci.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var i,n,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((i=e==null?void 0:e.internal)==null?void 0:i.throwOnFailedPublish)>"u"?!0:(n=e==null?void 0:e.internal)==null?void 0:n.throwOnFailedPublish;let c=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=h=>{h.topic===t&&(this.subscriber.off(je.created,u),l())};return await Promise.all([new Promise(h=>{l=h,this.subscriber.on(je.created,u)}),new Promise(async(h,d)=>{c=await this.subscriber.subscribe(t,ec({internal:{throwOnFailedPublish:o}},e)).catch(_=>{o&&d(_)})||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 pt(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,i)=>{await this.connect(t).then(e).catch(i).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 qa())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((i,n)=>i.publishedAt-n.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const i of e)try{await this.onMessageEvent(i)}catch(n){this.logger.warn(n,"Error while processing batch message event: "+(n==null?void 0:n.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:i}=t;if(!e.sessionExists){const n=fe(B.FIVE_MINUTES),s={topic:i,expiry:n,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(i,s)}this.events.emit(le.message,t),await this.recordMessageEvent(t,Ci.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(i,n)=>{const s=()=>{n(new Error("Connection interrupted while trying to connect"))};this.provider.once(We.disconnect,s),await pt(new Promise((o,c)=>{this.provider.connect().then(o).catch(c)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{n(o)}).finally(()=>{this.provider.off(We.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,c)=>{const l=()=>{n(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(We.disconnect,l),await this.subscriber.start().then(o).catch(c).finally(()=>{this.provider.off(We.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,i()})}catch(i){await this.subscriber.stop();const n=i;this.logger.warn({},n.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(i=>setTimeout(i,B.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,i,n,s;if(Hi())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(n=(i=this.provider)==null?void 0:i.connection)==null?void 0:n.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new $h(new kh(fp({sdkVersion:us,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:i,message:n}=t;await this.messages.set(i,n,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:i}=t;if(!i||i.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${i}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const n=this.messages.has(e,i);return n&&this.logger.warn(`Ignoring duplicate message: ${i}`),n}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),xs(t)){if(!t.method.endsWith(OE))return;const e=t.params,{topic:i,message:n,publishedAt:s,attestation:o}=e.data,c={topic:i,message:n,publishedAt:s,transportType:se.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(ec({type:"event",event:e.id},c)),this.events.emit(e.id,c),await this.acknowledgePayload(t),await this.onMessageEvent(c)}else Ss(t)&&this.events.emit(le.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Ci.inbound),this.events.emit(le.message,t))}async acknowledgePayload(t){const e=qi(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(We.payload,this.onPayloadHandler),this.provider.off(We.connect,this.onConnectHandler),this.provider.off(We.disconnect,this.onDisconnectHandler),this.provider.off(We.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await qa();rE(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(i=>this.logger.error(i,i==null?void 0:i.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Ar.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&sE())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(le.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==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},B.toMiliseconds(RE)))))}isInitialized(){if(!this.initialized){const{message:t}=U("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 Q0(r,t){return r===t||Number.isNaN(r)&&Number.isNaN(t)}function tc(r){return Object.getOwnPropertySymbols(r).filter(t=>Object.prototype.propertyIsEnumerable.call(r,t))}function rc(r){return r==null?r===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(r)}const Z0="[object RegExp]",X0="[object String]",ev="[object Number]",tv="[object Boolean]",ic="[object Arguments]",rv="[object Symbol]",iv="[object Date]",nv="[object Map]",sv="[object Set]",ov="[object Array]",av="[object Function]",cv="[object ArrayBuffer]",Vn="[object Object]",lv="[object Error]",uv="[object DataView]",hv="[object Uint8Array]",dv="[object Uint8ClampedArray]",_v="[object Uint16Array]",fv="[object Uint32Array]",pv="[object BigUint64Array]",wv="[object Int8Array]",gv="[object Int16Array]",mv="[object Int32Array]",Ev="[object BigInt64Array]",yv="[object Float32Array]",vv="[object Float64Array]";function bv(){}function nc(r){if(!r||typeof r!="object")return!1;const t=Object.getPrototypeOf(r);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(r)==="[object Object]":!1}function Iv(r,t,e){return Hr(r,t,void 0,void 0,void 0,void 0,e)}function Hr(r,t,e,i,n,s,o){const c=o(r,t,e,i,n,s);if(c!==void 0)return c;if(typeof r==typeof t)switch(typeof r){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return r===t;case"number":return r===t||Object.is(r,t);case"function":return r===t;case"object":return ei(r,t,s,o)}return ei(r,t,s,o)}function ei(r,t,e,i){if(Object.is(r,t))return!0;let n=rc(r),s=rc(t);if(n===ic&&(n=Vn),s===ic&&(s=Vn),n!==s)return!1;switch(n){case X0:return r.toString()===t.toString();case ev:{const l=r.valueOf(),u=t.valueOf();return Q0(l,u)}case tv:case iv:case rv:return Object.is(r.valueOf(),t.valueOf());case Z0:return r.source===t.source&&r.flags===t.flags;case av:return r===t}e=e??new Map;const o=e.get(r),c=e.get(t);if(o!=null&&c!=null)return o===t;e.set(r,t),e.set(t,r);try{switch(n){case nv:{if(r.size!==t.size)return!1;for(const[l,u]of r.entries())if(!t.has(l)||!Hr(u,t.get(l),l,r,t,e,i))return!1;return!0}case sv:{if(r.size!==t.size)return!1;const l=Array.from(r.values()),u=Array.from(t.values());for(let h=0;h<l.length;h++){const d=l[h],_=u.findIndex(f=>Hr(d,f,void 0,r,t,e,i));if(_===-1)return!1;u.splice(_,1)}return!0}case ov:case hv:case dv:case _v:case fv:case pv:case wv:case gv:case mv:case Ev:case yv:case vv:{if(typeof X<"u"&&X.isBuffer(r)!==X.isBuffer(t)||r.length!==t.length)return!1;for(let l=0;l<r.length;l++)if(!Hr(r[l],t[l],l,r,t,e,i))return!1;return!0}case cv:return r.byteLength!==t.byteLength?!1:ei(new Uint8Array(r),new Uint8Array(t),e,i);case uv:return r.byteLength!==t.byteLength||r.byteOffset!==t.byteOffset?!1:ei(new Uint8Array(r),new Uint8Array(t),e,i);case lv:return r.name===t.name&&r.message===t.message;case Vn:{if(!(ei(r.constructor,t.constructor,e,i)||nc(r)&&nc(t)))return!1;const l=[...Object.keys(r),...tc(r)],u=[...Object.keys(t),...tc(t)];if(l.length!==u.length)return!1;for(let h=0;h<l.length;h++){const d=l[h],_=r[d];if(!Object.hasOwn(t,d))return!1;const f=t[d];if(!Hr(_,f,d,r,t,e,i))return!1}return!0}default:return!1}}finally{e.delete(r),e.delete(t)}}function Av(r,t){return Iv(r,t,bv)}var Pv=Object.defineProperty,sc=Object.getOwnPropertySymbols,Tv=Object.prototype.hasOwnProperty,Ov=Object.prototype.propertyIsEnumerable,gs=(r,t,e)=>t in r?Pv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,oc=(r,t)=>{for(var e in t||(t={}))Tv.call(t,e)&&gs(r,e,t[e]);if(sc)for(var e of sc(t))Ov.call(t,e)&&gs(r,e,t[e]);return r},xe=(r,t,e)=>gs(r,typeof t!="symbol"?t+"":t,e);class lr extends m_{constructor(t,e,i,n=gt,s=void 0){super(t,e,i,n),this.core=t,this.logger=e,this.name=i,xe(this,"map",new Map),xe(this,"version",DE),xe(this,"cached",[]),xe(this,"initialized",!1),xe(this,"getKey"),xe(this,"storagePrefix",gt),xe(this,"recentlyDeleted",[]),xe(this,"recentlyDeletedLimit",200),xe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!pe(o)?this.map.set(this.getKey(o),o):Sm(o)?this.map.set(o.id,o):Cm(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),xe(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())}),xe(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),xe(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(c=>Object.keys(o).every(l=>Av(c[l],o[l]))):this.values)),xe(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=oc(oc({},this.getData(o)),c);this.map.set(o,l),await this.persist()}),xe(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=Ve(e,this.name),this.storagePrefix=n,this.getKey=s}get context(){return Me(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:n}=U("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(n),new Error(n)}const{message:i}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}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}=U("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}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Rv=Object.defineProperty,Dv=(r,t,e)=>t in r?Rv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,J=(r,t,e)=>Dv(r,typeof t!="symbol"?t+"":t,e);class Lv{constructor(t,e){this.core=t,this.logger=e,J(this,"name",SE),J(this,"version",CE),J(this,"events",new Oc),J(this,"pairings"),J(this,"initialized",!1),J(this,"storagePrefix",gt),J(this,"ignoredPayloadTypes",[Tt]),J(this,"registeredMethods",[]),J(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),J(this,"register",({methods:i})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...i])]}),J(this,"create",async i=>{this.isInitialized();const n=as(),s=await this.core.crypto.setSymKey(n),o=fe(B.FIVE_MINUTES),c={protocol:_u},l={topic:s,expiry:o,relay:c,active:!1,methods:i==null?void 0:i.methods},u=Va({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:n,relay:c,expiryTimestamp:o,methods:i==null?void 0:i.methods});return this.events.emit(Qt.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:i==null?void 0:i.transportType,internal:i==null?void 0:i.internal}),{topic:s,uri:u}}),J(this,"pair",async i=>{this.isInitialized();const n=this.core.eventClient.createEvent({properties:{topic:i==null?void 0:i.uri,trace:[dt.pairing_started]}});this.isValidPair(i,n);const{topic:s,symKey:o,relay:c,expiryTimestamp:l,methods:u}=La(i.uri);n.props.properties.topic=s,n.addTrace(dt.pairing_uri_validation_success),n.addTrace(dt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),n.addTrace(dt.existing_pairing),h.active)throw n.setError(It.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);n.addTrace(dt.pairing_not_expired)}const d=l||fe(B.FIVE_MINUTES),_={topic:s,relay:c,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,_),n.addTrace(dt.store_new_pairing),i.activatePairing&&await this.activate({topic:s}),this.events.emit(Qt.create,_),n.addTrace(dt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),n.addTrace(dt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{n.setError(It.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:c})}catch(f){throw n.setError(It.subscribe_pairing_topic_failure),f}return n.addTrace(dt.subscribe_pairing_topic_success),_}),J(this,"activate",async({topic:i})=>{this.isInitialized();const n=fe(B.FIVE_MINUTES);this.core.expirer.set(i,n),await this.pairings.update(i,{active:!0,expiry:n})}),J(this,"ping",async i=>{this.isInitialized(),await this.isValidPing(i),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:n}=i;if(this.pairings.keys.includes(n)){const s=await this.sendRequest(n,"wc_pairingPing",{}),{done:o,resolve:c,reject:l}=Yt();this.events.once(ee("pairing_ping",s),({error:u})=>{u?l(u):c()}),await o()}}),J(this,"updateExpiry",async({topic:i,expiry:n})=>{this.isInitialized(),await this.pairings.update(i,{expiry:n})}),J(this,"updateMetadata",async({topic:i,metadata:n})=>{this.isInitialized(),await this.pairings.update(i,{peerMetadata:n})}),J(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),J(this,"disconnect",async i=>{this.isInitialized(),await this.isValidDisconnect(i);const{topic:n}=i;this.pairings.keys.includes(n)&&(await this.sendRequest(n,"wc_pairingDelete",ae("USER_DISCONNECTED")),await this.deletePairing(n))}),J(this,"formatUriFromPairing",i=>{this.isInitialized();const{topic:n,relay:s,expiry:o,methods:c}=i,l=this.core.crypto.keychain.get(n);return Va({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:l,relay:s,expiryTimestamp:o,methods:c})}),J(this,"sendRequest",async(i,n,s)=>{const o=Nt(n,s),c=await this.core.crypto.encode(i,o),l=Br[n].req;return this.core.history.set(i,o),this.core.relayer.publish(i,c,l),o.id}),J(this,"sendResult",async(i,n,s)=>{const o=qi(i,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,i)).request.method,u=Br[l].res;await this.core.relayer.publish(n,c,u),await this.core.history.resolve(o)}),J(this,"sendError",async(i,n,s)=>{const o=Rc(i,s),c=await this.core.crypto.encode(n,o),l=(await this.core.history.get(n,i)).request.method,u=Br[l]?Br[l].res:Br.unregistered_method.res;await this.core.relayer.publish(n,c,u),await this.core.history.resolve(o)}),J(this,"deletePairing",async(i,n)=>{await this.core.relayer.unsubscribe(i),await Promise.all([this.pairings.delete(i,ae("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(i),n?Promise.resolve():this.core.expirer.del(i)])}),J(this,"cleanup",async()=>{const i=this.pairings.getAll().filter(n=>Ut(n.expiry));await Promise.all(i.map(n=>this.deletePairing(n.topic)))}),J(this,"onRelayEventRequest",async i=>{const{topic:n,payload:s}=i;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(n,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(n,s);default:return await this.onUnknownRpcMethodRequest(n,s)}}),J(this,"onRelayEventResponse",async i=>{const{topic:n,payload:s}=i,o=(await this.core.history.get(n,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(n,s);default:return this.onUnknownRpcMethodResponse(o)}}),J(this,"onPairingPingRequest",async(i,n)=>{const{id:s}=n;try{this.isValidPing({topic:i}),await this.sendResult(s,i,!0),this.events.emit(Qt.ping,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}}),J(this,"onPairingPingResponse",(i,n)=>{const{id:s}=n;setTimeout(()=>{vt(n)?this.events.emit(ee("pairing_ping",s),{}):_t(n)&&this.events.emit(ee("pairing_ping",s),{error:n.error})},500)}),J(this,"onPairingDeleteRequest",async(i,n)=>{const{id:s}=n;try{this.isValidDisconnect({topic:i}),await this.deletePairing(i),this.events.emit(Qt.delete,{id:s,topic:i})}catch(o){await this.sendError(s,i,o),this.logger.error(o)}}),J(this,"onUnknownRpcMethodRequest",async(i,n)=>{const{id:s,method:o}=n;try{if(this.registeredMethods.includes(o))return;const c=ae("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,i,c),this.logger.error(c)}catch(c){await this.sendError(s,i,c),this.logger.error(c)}}),J(this,"onUnknownRpcMethodResponse",i=>{this.registeredMethods.includes(i)||this.logger.error(ae("WC_METHOD_UNSUPPORTED",i))}),J(this,"isValidPair",(i,n)=>{var s;if(!Ce(i)){const{message:c}=U("MISSING_OR_INVALID",`pair() params: ${i}`);throw n.setError(It.malformed_pairing_uri),new Error(c)}if(!xm(i.uri)){const{message:c}=U("MISSING_OR_INVALID",`pair() uri: ${i.uri}`);throw n.setError(It.malformed_pairing_uri),new Error(c)}const o=La(i==null?void 0:i.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#relay-protocol");throw n.setError(It.malformed_pairing_uri),new Error(c)}if(!(o!=null&&o.symKey)){const{message:c}=U("MISSING_OR_INVALID","pair() uri#symKey");throw n.setError(It.malformed_pairing_uri),new Error(c)}if(o!=null&&o.expiryTimestamp&&B.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){n.setError(It.pairing_expired);const{message:c}=U("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}),J(this,"isValidPing",async i=>{if(!Ce(i)){const{message:s}=U("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)}),J(this,"isValidDisconnect",async i=>{if(!Ce(i)){const{message:s}=U("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(s)}const{topic:n}=i;await this.isValidPairingTopic(n)}),J(this,"isValidPairingTopic",async i=>{if(!de(i,!1)){const{message:n}=U("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(n)}if(!this.pairings.keys.includes(i)){const{message:n}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(n)}if(Ut(this.pairings.get(i).expiry)){await this.deletePairing(i);const{message:n}=U("EXPIRED",`pairing topic: ${i}`);throw new Error(n)}}),this.core=t,this.logger=Ve(e,this.name),this.pairings=new lr(this.core,this.logger,this.name,this.storagePrefix)}get context(){return Me(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(le.message,async t=>{const{topic:e,message:i,transportType:n}=t;if(this.pairings.keys.includes(e)&&n!==se.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(i)))try{const s=await this.core.crypto.decode(e,i);xs(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):Ss(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,i)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(Je.expired,async t=>{const{topic:e}=gl(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(Qt.expire,{topic:e}))})}}var Vv=Object.defineProperty,xv=(r,t,e)=>t in r?Vv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ye=(r,t,e)=>xv(r,typeof t!="symbol"?t+"":t,e);class Sv extends f_{constructor(t,e){super(t,e),this.core=t,this.logger=e,ye(this,"records",new Map),ye(this,"events",new cr.EventEmitter),ye(this,"name",$E),ye(this,"version",kE),ye(this,"cached",[]),ye(this,"initialized",!1),ye(this,"storagePrefix",gt),ye(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.records.set(i.id,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),ye(this,"set",(i,n,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:i,request:n,chainId:s}),this.records.has(n.id))return;const o={id:n.id,topic:i,request:{method:n.method,params:n.params||null},chainId:s,expiry:fe(B.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(rt.created,o)}),ye(this,"resolve",async i=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:i}),!this.records.has(i.id))return;const n=await this.getRecord(i.id);typeof n.response>"u"&&(n.response=_t(i)?{error:i.error}:{result:i.result},this.records.set(n.id,n),this.persist(),this.events.emit(rt.updated,n))}),ye(this,"get",async(i,n)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:i,id:n}),await this.getRecord(n))),ye(this,"delete",(i,n)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:n}),this.values.forEach(s=>{if(s.topic===i){if(typeof n<"u"&&s.id!==n)return;this.records.delete(s.id),this.events.emit(rt.deleted,s)}}),this.persist()}),ye(this,"exists",async(i,n)=>(this.isInitialized(),this.records.has(n)?(await this.getRecord(n)).topic===i:!1)),ye(this,"on",(i,n)=>{this.events.on(i,n)}),ye(this,"once",(i,n)=>{this.events.once(i,n)}),ye(this,"off",(i,n)=>{this.events.off(i,n)}),ye(this,"removeListener",(i,n)=>{this.events.removeListener(i,n)}),this.logger=Ve(e,this.name)}get context(){return Me(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 i={topic:e.topic,request:Nt(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(i)}),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:i}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(i)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(rt.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=U("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(rt.created,t=>{const e=rt.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(rt.updated,t=>{const e=rt.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(rt.deleted,t=>{const e=rt.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Ar.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(rt.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Cv=Object.defineProperty,$v=(r,t,e)=>t in r?Cv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Te=(r,t,e)=>$v(r,typeof t!="symbol"?t+"":t,e);class kv extends y_{constructor(t,e){super(t,e),this.core=t,this.logger=e,Te(this,"expirations",new Map),Te(this,"events",new cr.EventEmitter),Te(this,"name",NE),Te(this,"version",UE),Te(this,"cached",[]),Te(this,"initialized",!1),Te(this,"storagePrefix",gt),Te(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(i=>this.expirations.set(i.target,i)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Te(this,"has",i=>{try{const n=this.formatTarget(i);return typeof this.getExpiration(n)<"u"}catch{return!1}}),Te(this,"set",(i,n)=>{this.isInitialized();const s=this.formatTarget(i),o={target:s,expiry:n};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(Je.created,{target:s,expiration:o})}),Te(this,"get",i=>{this.isInitialized();const n=this.formatTarget(i);return this.getExpiration(n)}),Te(this,"del",i=>{if(this.isInitialized(),this.has(i)){const n=this.formatTarget(i),s=this.getExpiration(n);this.expirations.delete(n),this.events.emit(Je.deleted,{target:n,expiration:s})}}),Te(this,"on",(i,n)=>{this.events.on(i,n)}),Te(this,"once",(i,n)=>{this.events.once(i,n)}),Te(this,"off",(i,n)=>{this.events.off(i,n)}),Te(this,"removeListener",(i,n)=>{this.events.removeListener(i,n)}),this.logger=Ve(e,this.name)}get context(){return Me(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 pp(t);if(typeof t=="number")return wp(t);const{message:e}=U("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(Je.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=U("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:i}=U("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(i),new Error(i)}return e}checkExpiry(t,e){const{expiry:i}=e;B.toMiliseconds(i)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(Je.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Ar.pulse,()=>this.checkExpirations()),this.events.on(Je.created,t=>{const e=Je.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Je.expired,t=>{const e=Je.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(Je.deleted,t=>{const e=Je.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}}var Nv=Object.defineProperty,Uv=(r,t,e)=>t in r?Nv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,he=(r,t,e)=>Uv(r,typeof t!="symbol"?t+"":t,e);class Bv extends v_{constructor(t,e,i){super(t,e,i),this.core=t,this.logger=e,this.store=i,he(this,"name",BE),he(this,"abortController"),he(this,"isDevEnv"),he(this,"verifyUrlV3",ME),he(this,"storagePrefix",gt),he(this,"version",du),he(this,"publicKey"),he(this,"fetchPromise"),he(this,"init",async()=>{var n;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&B.toMiliseconds((n=this.publicKey)==null?void 0:n.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),he(this,"register",async n=>{if(!Rr()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:c}=n,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((_,f)=>{const p=()=>{window.removeEventListener("message",g),u.body.removeChild(w),f("attestation aborted")};this.abortController.signal.addEventListener("abort",p);const w=u.createElement("iframe");w.src=l,w.style.display="none",w.addEventListener("error",p,{signal:this.abortController.signal});const g=A=>{if(A.data&&typeof A.data=="string")try{const V=JSON.parse(A.data);if(V.type==="verify_attestation"){if(qn(V.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(w),this.abortController.signal.removeEventListener("abort",p),window.removeEventListener("message",g),_(V.attestation===null?"":V.attestation)}}catch(V){this.logger.warn(V)}};u.body.appendChild(w),window.addEventListener("message",g,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),he(this,"resolve",async n=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:c}=n;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(qn(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(n==null?void 0:n.verifyUrl);return this.fetchAttestation(o,l)}),he(this,"fetchAttestation",async(n,s)=>{this.logger.debug(`resolving attestation: ${n} from url: ${s}`);const o=this.startAbortTimer(B.ONE_SECOND*5),c=await fetch(`${s}/attestation/${n}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),c.status===200?await c.json():void 0}),he(this,"getVerifyUrl",n=>{let s=n||Xr;return zE.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${Xr}`),s=Xr),s}),he(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const n=this.startAbortTimer(B.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(n),await s.json()}catch(n){this.logger.warn(n)}}),he(this,"persistPublicKey",async n=>{this.logger.debug("persisting public key to local storage",n),await this.store.setItem(this.storeKey,n),this.publicKey=n}),he(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),he(this,"isValidJwtAttestation",async n=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(n,s)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(n,o)}catch(c){this.logger.error(c),this.logger.warn("error validating attestation")}}),he(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),he(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 n=await this.fetchPromise;return this.fetchPromise=void 0,n}),he(this,"validateAttestation",(n,s)=>{const o=um(n,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=Ve(e,this.name),this.abortController=new AbortController,this.isDevEnv=Gs(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return Me(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),B.toMiliseconds(t))}}var qv=Object.defineProperty,Mv=(r,t,e)=>t in r?qv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ac=(r,t,e)=>Mv(r,typeof t!="symbol"?t+"":t,e);class zv extends b_{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,ac(this,"context",jE),ac(this,"registerDeviceToken",async i=>{const{clientId:n,token:s,notificationType:o,enableEncrypted:c=!1}=i,l=`${KE}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:n,type:o,token:s,always_raw:c})})}),this.logger=Ve(e,this.context)}}var jv=Object.defineProperty,cc=Object.getOwnPropertySymbols,Kv=Object.prototype.hasOwnProperty,Fv=Object.prototype.propertyIsEnumerable,ms=(r,t,e)=>t in r?jv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jr=(r,t)=>{for(var e in t||(t={}))Kv.call(t,e)&&ms(r,e,t[e]);if(cc)for(var e of cc(t))Fv.call(t,e)&&ms(r,e,t[e]);return r},we=(r,t,e)=>ms(r,typeof t!="symbol"?t+"":t,e);class Hv extends I_{constructor(t,e,i=!0){super(t,e,i),this.core=t,this.logger=e,we(this,"context",HE),we(this,"storagePrefix",gt),we(this,"storageVersion",FE),we(this,"events",new Map),we(this,"shouldPersist",!1),we(this,"init",async()=>{if(!Gs())try{const n={eventId:Zo(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:pl(this.core.relayer.protocol,this.core.relayer.version,us)}}};await this.sendEvent([n])}catch(n){this.logger.warn(n)}}),we(this,"createEvent",n=>{const{event:s="ERROR",type:o="",properties:{topic:c,trace:l}}=n,u=Zo(),h=this.core.projectId||"",d=Date.now(),_=jr({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,_),this.shouldPersist=!0),_}),we(this,"getEvent",n=>{const{eventId:s,topic:o}=n;if(s)return this.events.get(s);const c=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(c)return jr(jr({},c),this.setMethods(c.eventId))}),we(this,"deleteEvent",n=>{const{eventId:s}=n;this.events.delete(s),this.shouldPersist=!0}),we(this,"setEventListeners",()=>{this.core.heartbeat.on(Ar.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(n=>{B.fromMiliseconds(Date.now())-B.fromMiliseconds(n.timestamp)>WE&&(this.events.delete(n.eventId),this.shouldPersist=!0)})})}),we(this,"setMethods",n=>({addTrace:s=>this.addTrace(n,s),setError:s=>this.setError(n,s)})),we(this,"addTrace",(n,s)=>{const o=this.events.get(n);o&&(o.props.properties.trace.push(s),this.events.set(n,o),this.shouldPersist=!0)}),we(this,"setError",(n,s)=>{const o=this.events.get(n);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(n,o),this.shouldPersist=!0)}),we(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),we(this,"restore",async()=>{try{const n=await this.core.storage.getItem(this.storageKey)||[];if(!n.length)return;n.forEach(s=>{this.events.set(s.eventId,jr(jr({},s),this.setMethods(s.eventId)))})}catch(n){this.logger.warn(n)}}),we(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const n=[];for(const[s,o]of this.events)o.props.type&&n.push(o);if(n.length!==0)try{if((await this.sendEvent(n)).ok)for(const s of n)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),we(this,"sendEvent",async n=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${GE}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${us}${s}`,{method:"POST",body:JSON.stringify(n)})}),we(this,"getAppDomain",()=>fl().url),this.logger=Ve(e,this.context),this.telemetryEnabled=i,i?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var Wv=Object.defineProperty,lc=Object.getOwnPropertySymbols,Gv=Object.prototype.hasOwnProperty,Jv=Object.prototype.propertyIsEnumerable,Es=(r,t,e)=>t in r?Wv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uc=(r,t)=>{for(var e in t||(t={}))Gv.call(t,e)&&Es(r,e,t[e]);if(lc)for(var e of lc(t))Jv.call(t,e)&&Es(r,e,t[e]);return r},ne=(r,t,e)=>Es(r,typeof t!="symbol"?t+"":t,e);class co extends u_{constructor(t){var e;super(t),ne(this,"protocol",hu),ne(this,"version",du),ne(this,"name",ls),ne(this,"relayUrl"),ne(this,"projectId"),ne(this,"customStoragePrefix"),ne(this,"events",new cr.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:se.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})});const i=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(i)try{return this.customStoragePrefix=i.customStoragePrefix,this.logger=i.logger,this.heartbeat=i.heartbeat,this.crypto=i.crypto,this.history=i.history,this.expirer=i.expirer,this.storage=i.storage,this.relayer=i.relayer,this.pairing=i.pairing,this.verify=i.verify,this.echoClient=i.echoClient,this.linkModeSupportedApps=i.linkModeSupportedApps,this.eventClient=i.eventClient,this.initialized=i.initialized,this.logChunkController=i.logChunkController,i}catch(c){console.warn("Failed to copy global core",c)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||fu,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const n=js({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:pE.logger,name:ls}),{logger:s,chunkLoggerController:o}=a_({opts:n,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0: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=Ve(s,this.name),this.heartbeat=new Ch,this.crypto=new I0(this,this.logger,t==null?void 0:t.keychain),this.history=new Sv(this,this.logger),this.expirer=new kv(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new Kd(uc(uc({},wE),t==null?void 0:t.storageOptions)),this.relayer=new Y0({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Lv(this,this.logger),this.verify=new Bv(this,this.logger,this.storage),this.echoClient=new zv(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new Hv(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new co(t);await e.initialize();const i=await e.crypto.getClientId();return await e.storage.setItem(LE,i),e}get context(){return Me(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(za,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(za)||[],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}`,i=`${e}_count`;return globalThis[i]=(globalThis[i]||0)+1,globalThis[i]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[i]} 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 i=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[i]=t}catch(i){console.warn("Failed to set global WalletConnect core",i)}}isGlobalCoreDisabled(){try{return typeof Kt<"u"&&fE.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const Yv=co,Ou="wc",Ru=2,Du="client",lo=`${Ou}@${Ru}:${Du}:`,xn={name:Du,logger:"error"},hc="WALLETCONNECT_DEEPLINK_CHOICE",Qv="proposal",dc="Proposal expired",Zv="session",pr=B.SEVEN_DAYS,Xv="engine",ve={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}}},Sn={min:B.FIVE_MINUTES,max:B.SEVEN_DAYS},ht={idle:"IDLE",active:"ACTIVE"},eb={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:""}},tb="request",rb=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],ib="wc",nb="auth",sb="authKeys",ob="pairingTopics",ab="requests",cn=`${ib}@${1.5}:${nb}:`,$i=`${cn}:PUB_KEY`;var cb=Object.defineProperty,lb=Object.defineProperties,ub=Object.getOwnPropertyDescriptors,_c=Object.getOwnPropertySymbols,hb=Object.prototype.hasOwnProperty,db=Object.prototype.propertyIsEnumerable,ys=(r,t,e)=>t in r?cb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,te=(r,t)=>{for(var e in t||(t={}))hb.call(t,e)&&ys(r,e,t[e]);if(_c)for(var e of _c(t))db.call(t,e)&&ys(r,e,t[e]);return r},Oe=(r,t)=>lb(r,ub(t)),S=(r,t,e)=>ys(r,typeof t!="symbol"?t+"":t,e);class _b extends O_{constructor(t){super(t),S(this,"name",Xv),S(this,"events",new Oc),S(this,"initialized",!1),S(this,"requestQueue",{state:ht.idle,queue:[]}),S(this,"sessionRequestQueue",{state:ht.idle,queue:[]}),S(this,"emittedSessionRequests",new Pp({limit:500})),S(this,"requestQueueDelay",B.ONE_SECOND),S(this,"expectedPairingMethodMap",new Map),S(this,"recentlyDeletedMap",new Map),S(this,"recentlyDeletedLimit",200),S(this,"relayMessageCache",[]),S(this,"pendingSessions",new Map),S(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(ve)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay)))}),S(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const i=Oe(te({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(i),i.optionalNamespaces=Om(i.requiredNamespaces,i.optionalNamespaces),i.requiredNamespaces={};const{pairingTopic:n,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:c,scopedProperties:l,relays:u}=i;let h=n,d,_=!1;try{if(h){const E=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."),_=E.active}}catch(E){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),E}if(!h||!_){const{topic:E,uri:D}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=E,d=D}if(!h){const{message:E}=U("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(E)}const f=await this.client.core.crypto.generateKeyPair(),p=ve.wc_sessionPropose.req.ttl||B.FIVE_MINUTES,w=fe(p),g=Oe(te(te({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:_u}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:w,pairingTopic:h},c&&{sessionProperties:c}),l&&{scopedProperties:l}),{id:Dt()}),A=ee("session_connect",g.id),{reject:V,resolve:v,done:O}=Yt(p,dc),P=({id:E})=>{E===g.id&&(this.client.events.off("proposal_expire",P),this.pendingSessions.delete(g.id),this.events.emit(A,{error:{message:dc,code:0}}))};return this.client.events.on("proposal_expire",P),this.events.once(A,({error:E,session:D})=>{this.client.events.off("proposal_expire",P),E?V(E):D&&v(D)}),await this.sendProposeSession({proposal:g,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:g.id}}}),await this.setProposal(g.id,g),{uri:d,approval:O}}),S(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(i){throw this.client.logger.error("pair() failed"),i}}),S(this,"approve",async e=>{var i,n,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(i=e==null?void 0:e.id)==null?void 0:i.toString(),trace:[kt.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(m){throw o.setError(qr.no_internet_connection),m}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(m){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(qr.proposal_not_found),m}try{await this.isValidApprove(e)}catch(m){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(qr.session_approve_namespace_validation_failure),m}const{id:c,relayProtocol:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:_}=e,f=this.client.proposal.get(c);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:p,proposer:w,requiredNamespaces:g,optionalNamespaces:A}=f;let V=(n=this.client.core.eventClient)==null?void 0:n.getEvent({topic:p});V||(V=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:kt.session_approve_started,properties:{topic:p,trace:[kt.session_approve_started,kt.session_namespaces_validation_success]}}));const v=await this.client.core.crypto.generateKeyPair(),O=w.publicKey,P=await this.client.core.crypto.generateSharedKey(v,O),E=te(te(te({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:v,metadata:this.client.metadata},expiry:fe(pr)},h&&{sessionProperties:h}),d&&{scopedProperties:d}),_&&{sessionConfig:_}),D=se.relay;V.addTrace(kt.subscribing_session_topic);try{await this.client.core.relayer.subscribe(P,{transportType:D,internal:{skipSubscribe:!0}})}catch(m){throw V.setError(qr.subscribe_session_topic_failure),m}V.addTrace(kt.subscribe_session_topic_success);const R=Oe(te({},E),{topic:P,requiredNamespaces:g,optionalNamespaces:A,pairingTopic:p,acknowledged:!1,self:E.controller,peer:{publicKey:w.publicKey,metadata:w.metadata},controller:v,transportType:se.relay});await this.client.session.set(P,R),V.addTrace(kt.store_session);try{await this.sendApproveSession({sessionTopic:P,proposal:f,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:v},sessionSettleRequest:E,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:c}}}),V.addTrace(kt.session_approve_publish_success)}catch(m){throw this.client.logger.error(m),this.client.session.delete(P,ae("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(P),m}return this.client.core.eventClient.deleteEvent({eventId:V.eventId}),await this.client.core.pairing.updateMetadata({topic:p,metadata:w.metadata}),await this.deleteProposal(c),await this.client.core.pairing.activate({topic:p}),await this.setExpiry(P,fe(pr)),{topic:P,acknowledged:()=>Promise.resolve(this.client.session.get(P))}}),S(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:i,reason:n}=e;let s;try{s=this.client.proposal.get(i).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${i}) failed`),o}s&&await this.sendError({id:i,topic:s,error:n,rpcOpts:ve.wc_sessionPropose.reject}),await this.deleteProposal(i)}),S(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:i,namespaces:n}=e,{done:s,resolve:o,reject:c}=Yt(),l=Dt(),u=Zt().toString(),h=this.client.session.get(i).namespaces;return this.events.once(ee("session_update",l),({error:d})=>{d?c(d):o()}),await this.client.session.update(i,{namespaces:n}),await this.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(i,{namespaces:h}),c(d)}),{acknowledged:s}}),S(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:i}=e,n=Dt(),{done:s,resolve:o,reject:c}=Yt();return this.events.once(ee("session_extend",n),({error:l})=>{l?c(l):o()}),await this.setExpiry(i,fe(pr)),this.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(l=>{c(l)}),{acknowledged:s}}),S(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(g){throw this.client.logger.error("request() -> isValidRequest() failed"),g}const{chainId:i,request:n,topic:s,expiry:o=ve.wc_sessionRequest.req.ttl}=e,c=this.client.session.get(s);(c==null?void 0:c.transportType)===se.relay&&await this.confirmOnlineStateOrThrow();const l=Dt(),u=Zt().toString(),{done:h,resolve:d,reject:_}=Yt(o,"Request expired. Please try again.");this.events.once(ee("session_request",l),({error:g,result:A})=>{g?_(g):d(A)});const f="wc_sessionRequest",p=this.getAppLinkIfEnabled(c.peer.metadata,c.transportType);if(p)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:f,params:{request:Oe(te({},n),{expiryTimestamp:fe(o)}),chainId:i},expiry:o,throwOnFailedPublish:!0,appLink:p}).catch(g=>_(g)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:l}),await h();const w={request:Oe(te({},n),{expiryTimestamp:fe(o)}),chainId:i};return await Promise.all([new Promise(async g=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:f,params:w,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,w)}).catch(A=>_(A)),this.client.events.emit("session_request_sent",{topic:s,request:n,chainId:i,id:l}),g()}),new Promise(async g=>{var A;if(!((A=c.sessionConfig)!=null&&A.disableDeepLink)){const V=await yp(this.client.core.storage,hc);await gp({id:l,topic:s,wcDeepLink:V})}g()}),h()]).then(g=>g[2])}),S(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:i,response:n}=e,{id:s}=n,o=this.client.session.get(i);o.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const c=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);vt(n)?await this.sendResult({id:s,topic:i,result:n.result,throwOnFailedPublish:!0,appLink:c}):_t(n)&&await this.sendError({id:s,topic:i,error:n.error,appLink:c}),this.cleanupAfterResponse(e)}),S(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(n){throw this.client.logger.error("ping() -> isValidPing() failed"),n}const{topic:i}=e;if(this.client.session.keys.includes(i)){const n=Dt(),s=Zt().toString(),{done:o,resolve:c,reject:l}=Yt();this.events.once(ee("session_ping",n),({error:u})=>{u?l(u):c()}),await Promise.all([this.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:n,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(i)&&(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:i}))}),S(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:i,event:n,chainId:s}=e,o=Zt().toString(),c=Dt();await this.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:n,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:c})}),S(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:i}=e;if(this.client.session.keys.includes(i))await this.sendRequest({topic:i,method:"wc_sessionDelete",params:ae("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:i,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(i))await this.client.core.pairing.disconnect({topic:i});else{const{message:n}=U("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(n)}}),S(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(i=>Lm(i,e)))),S(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),S(this,"authenticate",async(e,i)=>{var n;this.isInitialized(),this.isValidAuthenticate(e);const s=i&&this.client.core.linkModeSupportedApps.includes(i)&&((n=this.client.metadata.redirect)==null?void 0:n.linkMode),o=s?se.link_mode:se.relay;o===se.relay&&await this.confirmOnlineStateOrThrow();const{chains:c,statement:l="",uri:u,domain:h,nonce:d,type:_,exp:f,nbf:p,methods:w=[],expiry:g}=e,A=[...e.resources||[]],{topic:V,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:V,uri:v}});const O=await this.client.core.crypto.generateKeyPair(),P=Si(O);if(await Promise.all([this.client.auth.authKeys.set($i,{responseTopic:P,publicKey:O}),this.client.auth.pairingTopics.set(P,{topic:P,pairingTopic:V})]),await this.client.core.relayer.subscribe(P,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${V}`),w.length>0){const{namespace:C}=Vi(c[0]);let N=kw(C,"request",w);xi(A)&&(N=Uw(N,A.pop())),A.push(N)}const E=g&&g>ve.wc_sessionAuthenticate.req.ttl?g:ve.wc_sessionAuthenticate.req.ttl,D={authPayload:{type:_??"caip122",chains:c,statement:l,aud:u,domain:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:f,nbf:p,resources:A},requester:{publicKey:O,metadata:this.client.metadata},expiryTimestamp:fe(E)},R={eip155:{chains:c,methods:[...new Set(["personal_sign",...w])],events:["chainChanged","accountsChanged"]}},m={requiredNamespaces:{},optionalNamespaces:R,relays:[{protocol:"irn"}],pairingTopic:V,proposer:{publicKey:O,metadata:this.client.metadata},expiryTimestamp:fe(ve.wc_sessionPropose.req.ttl),id:Dt()},{done:y,resolve:b,reject:I}=Yt(E,"Request expired"),L=Dt(),T=ee("session_connect",m.id),x=ee("session_request",L),$=async({error:C,session:N})=>{this.events.off(x,k),C?I(C):N&&b({session:N})},k=async C=>{var N,z,j;if(await this.deletePendingAuthRequest(L,{message:"fulfilled",code:0}),C.error){const oe=ae("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return C.error.code===oe.code?void 0:(this.events.off(T,$),I(C.error.message))}await this.deleteProposal(m.id),this.events.off(T,$);const{cacaos:F,responder:H}=C.result,W=[],G=[];for(const oe of F){await la({cacao:oe,projectId:this.client.core.projectId})||(this.client.logger.error(oe,"Signature verification failed"),I(ae("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:He}=oe,mt=xi(He.resources),_o=[Zn(He.iss)],Nu=Wi(He.iss);if(mt){const un=ua(mt),Uu=ha(mt);W.push(...un),_o.push(...Uu)}for(const un of _o)G.push(`${un}:${Nu}`)}const ue=await this.client.core.crypto.generateSharedKey(O,H.publicKey);let ce;W.length>0&&(ce={topic:ue,acknowledged:!0,self:{publicKey:O,metadata:this.client.metadata},peer:H,controller:H.publicKey,expiry:fe(pr),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:V,namespaces:$a([...new Set(W)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ue,{transportType:o}),await this.client.session.set(ue,ce),V&&await this.client.core.pairing.updateMetadata({topic:V,metadata:H.metadata}),ce=this.client.session.get(ue)),(N=this.client.metadata.redirect)!=null&&N.linkMode&&(z=H.metadata.redirect)!=null&&z.linkMode&&(j=H.metadata.redirect)!=null&&j.universal&&i&&(this.client.core.addLinkModeSupportedApp(H.metadata.redirect.universal),this.client.session.update(ue,{transportType:se.link_mode})),b({auths:F,session:ce})};this.events.once(T,$),this.events.once(x,k);let q;try{if(s){const C=Nt("wc_sessionAuthenticate",D,L);this.client.core.history.set(V,C);const N=await this.client.core.crypto.encode("",C,{type:pi,encoding:zt});q=Oi(i,V,N)}else await Promise.all([this.sendRequest({topic:V,method:"wc_sessionAuthenticate",params:D,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:L}),this.sendRequest({topic:V,method:"wc_sessionPropose",params:m,expiry:ve.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:m.id})])}catch(C){throw this.events.off(T,$),this.events.off(x,k),C}return await this.setProposal(m.id,m),await this.setAuthRequest(L,{request:Oe(te({},D),{verifyContext:{}}),pairingTopic:V,transportType:o}),{uri:q??v,response:y}}),S(this,"approveSessionAuthenticate",async e=>{const{id:i,auths:n}=e,s=this.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:[Jt.authenticated_session_approve_started]}});try{this.isInitialized()}catch(g){throw s.setError(Mr.no_internet_connection),g}const o=this.getPendingAuthRequest(i);if(!o)throw s.setError(Mr.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${i}`);const c=o.transportType||se.relay;c===se.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=Si(l),d={type:Tt,receiverPublicKey:l,senderPublicKey:u},_=[],f=[];for(const g of n){if(!await la({cacao:g,projectId:this.client.core.projectId})){s.setError(Mr.invalid_cacao);const P=ae("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:i,topic:h,error:P,encodeOpts:d}),new Error(P.message)}s.addTrace(Jt.cacaos_verified);const{p:A}=g,V=xi(A.resources),v=[Zn(A.iss)],O=Wi(A.iss);if(V){const P=ua(V),E=ha(V);_.push(...P),v.push(...E)}for(const P of v)f.push(`${P}:${O}`)}const p=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(Jt.create_authenticated_session_topic);let w;if((_==null?void 0:_.length)>0){w={topic:p,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:fe(pr),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:$a([...new Set(_)],[...new Set(f)]),transportType:c},s.addTrace(Jt.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(p,{transportType:c})}catch(g){throw s.setError(Mr.subscribe_authenticated_session_topic_failure),g}s.addTrace(Jt.subscribe_authenticated_session_topic_success),await this.client.session.set(p,w),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:i,result:{cacaos:n,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,c)})}catch(g){throw s.setError(Mr.authenticated_session_approve_publish_failure),g}return await this.client.auth.requests.delete(i,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:w}}),S(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:i,reason:n}=e,s=this.getPendingAuthRequest(i);if(!s)throw new Error(`Could not find pending auth request with id ${i}`);s.transportType===se.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=Si(o),u={type:Tt,receiverPublicKey:o,senderPublicKey:c};await this.sendError({id:i,topic:l,error:n,encodeOpts:u,rpcOpts:ve.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(i,{message:"rejected",code:0}),await this.deleteProposal(i)}),S(this,"formatAuthMessage",e=>{this.isInitialized();const{request:i,iss:n}=e;return xl(i,n)}),S(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)}),S(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const i=this.client.core.pairing.pairings.get(e.pairingTopic),n=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!==i.topic});if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(i){this.client.logger.error(i)}}),S(this,"deleteSession",async e=>{var i;const{topic:n,expirerHasDeleted:s=!1,emitEvent:o=!0,id:c=0}=e,{self:l}=this.client.session.get(n);await this.client.core.relayer.unsubscribe(n),await this.client.session.delete(n,ae("USER_DISCONNECTED")),this.addToRecentlyDeleted(n,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(n)&&await this.client.core.crypto.deleteSymKey(n),s||this.client.core.expirer.del(n),this.client.core.storage.removeItem(hc).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===n&&this.deletePendingSessionRequest(u.id,ae("USER_DISCONNECTED"))}),n===((i=this.sessionRequestQueue.queue[0])==null?void 0:i.topic)&&(this.sessionRequestQueue.state=ht.idle),o&&this.client.events.emit("session_delete",{id:c,topic:n})}),S(this,"deleteProposal",async(e,i)=>{if(i)try{const n=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:n.pairingTopic});s==null||s.setError(qr.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,ae("USER_DISCONNECTED")),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),S(this,"deletePendingSessionRequest",async(e,i,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,i),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),n&&(this.sessionRequestQueue.state=ht.idle,this.client.events.emit("session_request_expire",{id:e}))}),S(this,"deletePendingAuthRequest",async(e,i,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,i),n?Promise.resolve():this.client.core.expirer.del(e)])}),S(this,"setExpiry",async(e,i)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,i),await this.client.session.update(e,{expiry:i}))}),S(this,"setProposal",async(e,i)=>{this.client.core.expirer.set(e,fe(ve.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,i)}),S(this,"setAuthRequest",async(e,i)=>{const{request:n,pairingTopic:s,transportType:o=se.relay}=i;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:s,verifyContext:n.verifyContext,transportType:o})}),S(this,"setPendingSessionRequest",async e=>{const{id:i,topic:n,params:s,verifyContext:o}=e,c=s.request.expiryTimestamp||fe(ve.wc_sessionRequest.req.ttl);this.client.core.expirer.set(i,c),await this.client.pendingRequest.set(i,{id:i,topic:n,params:s,verifyContext:o})}),S(this,"sendRequest",async e=>{const{topic:i,method:n,params:s,expiry:o,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d,publishOpts:_={}}=e,f=Nt(n,s,l);let p;const w=!!h;try{const V=w?zt:Ne;p=await this.client.core.crypto.encode(i,f,{encoding:V})}catch(V){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),V}let g;if(rb.includes(n)){const V=Ye(JSON.stringify(f)),v=Ye(p);g=await this.client.core.verify.register({id:v,decryptedId:V})}const A=te(te({},ve[n].req),_);if(A.attestation=g,o&&(A.ttl=o),c&&(A.id=c),this.client.core.history.set(i,f),w){const V=Oi(h,i,p);await K.Linking.openURL(V,this.client.name)}else A.tvf=Oe(te({},d),{correlationId:f.id}),u?(A.internal=Oe(te({},A.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,p,A)):this.client.core.relayer.publish(i,p,A).catch(V=>this.client.logger.error(V));return f.id}),S(this,"sendProposeSession",async e=>{const{proposal:i,publishOpts:n}=e,s=Nt("wc_sessionPropose",i,i.id);this.client.core.history.set(i.pairingTopic,s);const o=await this.client.core.crypto.encode(i.pairingTopic,s,{encoding:Ne}),c=Ye(JSON.stringify(s)),l=Ye(o),u=await this.client.core.verify.register({id:l,decryptedId:c});await this.client.core.relayer.publishCustom({payload:{pairingTopic:i.pairingTopic,sessionProposal:o},opts:Oe(te({},n),{publishMethod:"wc_proposeSession",attestation:u})})}),S(this,"sendApproveSession",async e=>{const{sessionTopic:i,pairingProposalResponse:n,proposal:s,sessionSettleRequest:o,publishOpts:c}=e,l=qi(s.id,n),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Ne}),h=Nt("wc_sessionSettle",o,c==null?void 0:c.id),d=await this.client.core.crypto.encode(i,h,{encoding:Ne});this.client.core.history.set(i,h),await this.client.core.relayer.publishCustom({payload:{sessionTopic:i,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:Oe(te({},c),{publishMethod:"wc_approveSession"})})}),S(this,"sendResult",async e=>{const{id:i,topic:n,result:s,throwOnFailedPublish:o,encodeOpts:c,appLink:l}=e,u=qi(i,s);let h;const d=l&&typeof(K==null?void 0:K.Linking)<"u";try{const p=d?zt:Ne;h=await this.client.core.crypto.encode(n,u,Oe(te({},c||{}),{encoding:p}))}catch(p){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),p}let _,f;try{_=await this.client.core.history.get(n,i);const p=_.request;try{f=this.getTVFParams(i,p.params,s)}catch(w){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${w==null?void 0:w.message}`)}}catch(p){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${i}) failed`),p}if(d){const p=Oi(l,n,h);await K.Linking.openURL(p,this.client.name)}else{const p=_.request.method,w=ve[p].res;w.tvf=Oe(te({},f),{correlationId:i}),o?(w.internal=Oe(te({},w.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,h,w)):this.client.core.relayer.publish(n,h,w).catch(g=>this.client.logger.error(g))}await this.client.core.history.resolve(u)}),S(this,"sendError",async e=>{const{id:i,topic:n,error:s,encodeOpts:o,rpcOpts:c,appLink:l}=e,u=Rc(i,s);let h;const d=l&&typeof(K==null?void 0:K.Linking)<"u";try{const f=d?zt:Ne;h=await this.client.core.crypto.encode(n,u,Oe(te({},o||{}),{encoding:f}))}catch(f){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),f}let _;try{_=await this.client.core.history.get(n,i)}catch(f){throw this.client.logger.error(`sendError() -> history.get(${n}, ${i}) failed`),f}if(d){const f=Oi(l,n,h);await K.Linking.openURL(f,this.client.name)}else{const f=_.request.method,p=c||ve[f].res;this.client.core.relayer.publish(n,h,p)}await this.client.core.history.resolve(u)}),S(this,"cleanup",async()=>{const e=[],i=[];this.client.session.getAll().forEach(n=>{let s=!1;Ut(n.expiry)&&(s=!0),this.client.core.crypto.keychain.has(n.topic)||(s=!0),s&&e.push(n.topic)}),this.client.proposal.getAll().forEach(n=>{Ut(n.expiryTimestamp)&&i.push(n.id)}),await Promise.all([...e.map(n=>this.deleteSession({topic:n})),...i.map(n=>this.deleteProposal(n))])}),S(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),S(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),S(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(i){this.client.logger.warn(i)}}this.requestQueue.state=ht.idle}),S(this,"processRequest",async e=>{const{topic:i,payload:n,attestation:s,transportType:o,encryptedId:c}=e,l=n.method;if(!this.shouldIgnorePairingRequest({topic:i,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:i,payload:n,attestation:s,encryptedId:c});case"wc_sessionSettle":return await this.onSessionSettleRequest(i,n);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(i,n);case"wc_sessionExtend":return await this.onSessionExtendRequest(i,n);case"wc_sessionPing":return await this.onSessionPingRequest(i,n);case"wc_sessionDelete":return await this.onSessionDeleteRequest(i,n);case"wc_sessionRequest":return await this.onSessionRequest({topic:i,payload:n,attestation:s,encryptedId:c,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(i,n);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:i,payload:n,attestation:s,encryptedId:c,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),S(this,"onRelayEventResponse",async e=>{const{topic:i,payload:n,transportType:s}=e,o=(await this.client.core.history.get(i,n.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(i,n,s);case"wc_sessionSettle":return this.onSessionSettleResponse(i,n);case"wc_sessionUpdate":return this.onSessionUpdateResponse(i,n);case"wc_sessionExtend":return this.onSessionExtendResponse(i,n);case"wc_sessionPing":return this.onSessionPingResponse(i,n);case"wc_sessionRequest":return this.onSessionRequestResponse(i,n);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(i,n);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),S(this,"onRelayEventUnknownPayload",e=>{const{topic:i}=e,{message:n}=U("MISSING_OR_INVALID",`Decoded payload on topic ${i} is not identifiable as a JSON-RPC request or a response.`);throw new Error(n)}),S(this,"shouldIgnorePairingRequest",e=>{const{topic:i,requestMethod:n}=e,s=this.expectedPairingMethodMap.get(i);return!s||s.includes(n)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),S(this,"onSessionProposeRequest",async e=>{const{topic:i,payload:n,attestation:s,encryptedId:o}=e,{params:c,id:l}=n;try{const u=this.client.core.eventClient.getEvent({topic:i});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u==null||u.setError(It.proposal_listener_not_found)),this.isValidConnect(te({},n.params));const h=c.expiryTimestamp||fe(ve.wc_sessionPropose.req.ttl),d=te({id:l,pairingTopic:i,expiryTimestamp:h,attestation:s,encryptedId:o},c);await this.setProposal(l,d);const _=await this.getVerifyContext({attestationId:s,hash:Ye(JSON.stringify(n)),encryptedId:o,metadata:d.proposer.metadata});u==null||u.addTrace(dt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:_})}catch(u){await this.sendError({id:l,topic:i,error:u,rpcOpts:ve.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),S(this,"onSessionProposeResponse",async(e,i,n)=>{const{id:s}=i;if(vt(i)){const{result:o}=i;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:n});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(_t(i)){await this.deleteProposal(s);const o=ee("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:i.error})}}),S(this,"onSessionSettleRequest",async(e,i)=>{const{id:n,params:s}=i;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:c,expiry:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:_}=i.params,f=[...this.pendingSessions.values()].find(g=>g.sessionTopic===e);if(!f)return this.client.logger.error(`Pending session not found for topic ${e}`);const p=this.client.proposal.get(f.proposalId),w=Oe(te(te(te({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:f.pairingTopic,requiredNamespaces:p.requiredNamespaces,optionalNamespaces:p.optionalNamespaces,controller:c.publicKey,self:{publicKey:f.publicKey,metadata:this.client.metadata},peer:{publicKey:c.publicKey,metadata:c.metadata}},h&&{sessionProperties:h}),d&&{scopedProperties:d}),_&&{sessionConfig:_}),{transportType:se.relay});await this.client.session.set(w.topic,w),await this.setExpiry(w.topic,w.expiry),await this.client.core.pairing.updateMetadata({topic:f.pairingTopic,metadata:w.peer.metadata}),this.client.events.emit("session_connect",{session:w}),this.events.emit(ee("session_connect",f.proposalId),{session:w}),this.pendingSessions.delete(f.proposalId),this.deleteProposal(f.proposalId,!1),this.cleanupDuplicatePairings(w),await this.sendResult({id:i.id,topic:e,result:!0})}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"onSessionSettleResponse",async(e,i)=>{const{id:n}=i;vt(i)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(ee("session_approve",n),{})):_t(i)&&(await this.client.session.delete(e,ae("USER_DISCONNECTED")),this.events.emit(ee("session_approve",n),{error:i.error}))}),S(this,"onSessionUpdateRequest",async(e,i)=>{const{params:n,id:s}=i;try{const o=`${e}_session_update`,c=Ur.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:ae("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(te({topic:e},n));try{Ur.set(o,s),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw Ur.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:n})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"isRequestOutOfSync",(e,i)=>i.toString().slice(0,-3)<e.toString().slice(0,-3)),S(this,"onSessionUpdateResponse",(e,i)=>{const{id:n}=i,s=ee("session_update",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(i)?this.events.emit(ee("session_update",n),{}):_t(i)&&this.events.emit(ee("session_update",n),{error:i.error})}),S(this,"onSessionExtendRequest",async(e,i)=>{const{id:n}=i;try{this.isValidExtend({topic:e}),await this.setExpiry(e,fe(pr)),await this.sendResult({id:n,topic:e,result:!0}),this.client.events.emit("session_extend",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),S(this,"onSessionExtendResponse",(e,i)=>{const{id:n}=i,s=ee("session_extend",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(i)?this.events.emit(ee("session_extend",n),{}):_t(i)&&this.events.emit(ee("session_extend",n),{error:i.error})}),S(this,"onSessionPingRequest",async(e,i)=>{const{id:n}=i;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:n,topic:e})}catch(s){await this.sendError({id:n,topic:e,error:s}),this.client.logger.error(s)}}),S(this,"onSessionPingResponse",(e,i)=>{const{id:n}=i,s=ee("session_ping",n);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);vt(i)?this.events.emit(ee("session_ping",n),{}):_t(i)&&this.events.emit(ee("session_ping",n),{error:i.error})},500)}),S(this,"onSessionDeleteRequest",async(e,i)=>{const{id:n}=i;try{this.isValidDisconnect({topic:e,reason:i.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(le.publish,async()=>{s(await this.deleteSession({topic:e,id:n}))})}),this.sendResult({id:n,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:ae("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),S(this,"onSessionRequest",async e=>{var i,n,s;const{topic:o,payload:c,attestation:l,encryptedId:u,transportType:h}=e,{id:d,params:_}=c;try{await this.isValidRequest(te({topic:o},_));const f=this.client.session.get(o),p=await this.getVerifyContext({attestationId:l,hash:Ye(JSON.stringify(Nt("wc_sessionRequest",_,d))),encryptedId:u,metadata:f.peer.metadata,transportType:h}),w={id:d,topic:o,params:_,verifyContext:p};await this.setPendingSessionRequest(w),h===se.link_mode&&(i=f.peer.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp((n=f.peer.metadata.redirect)==null?void 0:n.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(w):(this.addSessionRequestToSessionRequestQueue(w),this.processSessionRequestQueue())}catch(f){await this.sendError({id:d,topic:o,error:f}),this.client.logger.error(f)}}),S(this,"onSessionRequestResponse",(e,i)=>{const{id:n}=i,s=ee("session_request",n);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);vt(i)?this.events.emit(ee("session_request",n),{result:i.result}):_t(i)&&this.events.emit(ee("session_request",n),{error:i.error})}),S(this,"onSessionEventRequest",async(e,i)=>{const{id:n,params:s}=i;try{const o=`${e}_session_event_${s.event.name}`,c=Ur.get(o);if(c&&this.isRequestOutOfSync(c,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(te({topic:e},s)),this.client.events.emit("session_event",{id:n,topic:e,params:s}),Ur.set(o,n)}catch(o){await this.sendError({id:n,topic:e,error:o}),this.client.logger.error(o)}}),S(this,"onSessionAuthenticateResponse",(e,i)=>{const{id:n}=i;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:i}),vt(i)?this.events.emit(ee("session_request",n),{result:i.result}):_t(i)&&this.events.emit(ee("session_request",n),{error:i.error})}),S(this,"onSessionAuthenticateRequest",async e=>{var i;const{topic:n,payload:s,attestation:o,encryptedId:c,transportType:l}=e;try{const{requester:u,authPayload:h,expiryTimestamp:d}=s.params,_=await this.getVerifyContext({attestationId:o,hash:Ye(JSON.stringify(s)),encryptedId:c,metadata:u.metadata,transportType:l}),f={requester:u,pairingTopic:n,id:s.id,authPayload:h,verifyContext:_,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:f,pairingTopic:n,transportType:l}),l===se.link_mode&&(i=u.metadata.redirect)!=null&&i.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:n,params:s.params,id:s.id,verifyContext:_})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),_=this.getAppLinkIfEnabled(s.params.requester.metadata,l),f={type:Tt,receiverPublicKey:h,senderPublicKey:d};await this.sendError({id:s.id,topic:n,error:u,encodeOpts:f,rpcOpts:ve.wc_sessionAuthenticate.autoReject,appLink:_})}}),S(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),S(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=ht.idle,this.processSessionRequestQueue()},B.toMiliseconds(this.requestQueueDelay))}),S(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:i})=>{const n=this.client.core.history.pending;n.length>0&&n.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,c=ee("session_request",o);if(this.events.listenerCount(c)===0)throw new Error(`emitting ${c} without any listeners`);this.events.emit(ee("session_request",s.request.id),{error:i})})}),S(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(i){this.client.logger.error(i)}}),S(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)}),S(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const i=this.client.proposal.getAll().find(n=>n.pairingTopic===e.topic);i&&this.onSessionProposeRequest({topic:e.topic,payload:Nt("wc_sessionPropose",Oe(te({},i),{requiredNamespaces:i.requiredNamespaces,optionalNamespaces:i.optionalNamespaces,relays:i.relays,proposer:i.proposer,sessionProperties:i.sessionProperties,scopedProperties:i.scopedProperties}),i.id),attestation:i.attestation,encryptedId:i.encryptedId})}),S(this,"isValidConnect",async e=>{if(!Ce(e)){const{message:u}=U("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:i,requiredNamespaces:n,optionalNamespaces:s,sessionProperties:o,scopedProperties:c,relays:l}=e;if(pe(i)||await this.isValidPairingTopic(i),!zm(l)){const{message:u}=U("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!pe(n)&&ci(n)!==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(n,"requiredNamespaces")}if(!pe(s)&&ci(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),pe(o)||this.validateSessionProps(o,"sessionProperties"),!pe(c)){this.validateSessionProps(c,"scopedProperties");const u=Object.keys(n||{}).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)}`)}}),S(this,"validateNamespaces",(e,i)=>{const n=Mm(e,"connect()",i);if(n)throw new Error(n.message)}),S(this,"isValidApprove",async e=>{if(!Ce(e))throw new Error(U("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:i,namespaces:n,relayProtocol:s,sessionProperties:o,scopedProperties:c}=e;this.checkRecentlyDeleted(i),await this.isValidProposalId(i);const l=this.client.proposal.get(i),u=On(n,"approve()");if(u)throw new Error(u.message);const h=Ua(l.requiredNamespaces,n,"approve()");if(h)throw new Error(h.message);if(!de(s,!0)){const{message:d}=U("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(pe(o)||this.validateSessionProps(o,"sessionProperties"),!pe(c)){this.validateSessionProps(c,"scopedProperties");const d=new Set(Object.keys(n));if(!Object.keys(c).every(_=>d.has(_.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(c)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),S(this,"isValidReject",async e=>{if(!Ce(e)){const{message:s}=U("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:i,reason:n}=e;if(this.checkRecentlyDeleted(i),await this.isValidProposalId(i),!Km(n)){const{message:s}=U("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(n)}`);throw new Error(s)}}),S(this,"isValidSessionSettleRequest",e=>{if(!Ce(e)){const{message:u}=U("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:i,controller:n,namespaces:s,expiry:o}=e;if(!uu(i)){const{message:u}=U("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const c=$m(n,"onSessionSettleRequest()");if(c)throw new Error(c.message);const l=On(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(Ut(o)){const{message:u}=U("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),S(this,"isValidUpdate",async e=>{if(!Ce(e)){const{message:l}=U("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:i,namespaces:n}=e;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const s=this.client.session.get(i),o=On(n,"update()");if(o)throw new Error(o.message);const c=Ua(s.requiredNamespaces,n,"update()");if(c)throw new Error(c.message)}),S(this,"isValidExtend",async e=>{if(!Ce(e)){const{message:n}=U("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(n)}const{topic:i}=e;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i)}),S(this,"isValidRequest",async e=>{if(!Ce(e)){const{message:l}=U("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:i,request:n,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(i),await this.isValidSessionTopic(i);const{namespaces:c}=this.client.session.get(i);if(!Na(c,s)){const{message:l}=U("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!Fm(n)){const{message:l}=U("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw new Error(l)}if(!Gm(c,s,n.method)){const{message:l}=U("MISSING_OR_INVALID",`request() method: ${n.method}`);throw new Error(l)}if(o&&!Zm(o,Sn)){const{message:l}=U("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${Sn.min} and ${Sn.max}`);throw new Error(l)}}),S(this,"isValidRespond",async e=>{var i;if(!Ce(e)){const{message:o}=U("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:n,response:s}=e;try{await this.isValidSessionTopic(n)}catch(o){throw(i=e==null?void 0:e.response)!=null&&i.id&&this.cleanupAfterResponse(e),o}if(!Hm(s)){const{message:o}=U("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),S(this,"isValidPing",async e=>{if(!Ce(e)){const{message:n}=U("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(n)}const{topic:i}=e;await this.isValidSessionOrPairingTopic(i)}),S(this,"isValidEmit",async e=>{if(!Ce(e)){const{message:c}=U("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(c)}const{topic:i,event:n,chainId:s}=e;await this.isValidSessionTopic(i);const{namespaces:o}=this.client.session.get(i);if(!Na(o,s)){const{message:c}=U("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(c)}if(!Wm(n)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}if(!Jm(o,s,n.name)){const{message:c}=U("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw new Error(c)}}),S(this,"isValidDisconnect",async e=>{if(!Ce(e)){const{message:n}=U("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(n)}const{topic:i}=e;await this.isValidSessionOrPairingTopic(i)}),S(this,"isValidAuthenticate",e=>{const{chains:i,uri:n,domain:s,nonce:o}=e;if(!Array.isArray(i)||i.length===0)throw new Error("chains is required and must be a non-empty array");if(!de(n,!1))throw new Error("uri is required parameter");if(!de(s,!1))throw new Error("domain is required parameter");if(!de(o,!1))throw new Error("nonce is required parameter");if([...new Set(i.map(l=>Vi(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=Vi(i[0]);if(c!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),S(this,"getVerifyContext",async e=>{const{attestationId:i,hash:n,encryptedId:s,metadata:o,transportType:c}=e,l={verified:{verifyUrl:o.verifyUrl||Xr,validation:"UNKNOWN",origin:o.url||""}};try{if(c===se.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:i,hash:n,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}),S(this,"validateSessionProps",(e,i)=>{Object.values(e).forEach((n,s)=>{if(n==null){const{message:o}=U("MISSING_OR_INVALID",`${i} must contain an existing value for each key. Received: ${n} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),S(this,"getPendingAuthRequest",e=>{const i=this.client.auth.requests.get(e);return typeof i=="object"?i:void 0}),S(this,"addToRecentlyDeleted",(e,i)=>{if(this.recentlyDeletedMap.set(e,i),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let n=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(n++>=s)break;this.recentlyDeletedMap.delete(o)}}}),S(this,"checkRecentlyDeleted",e=>{const i=this.recentlyDeletedMap.get(e);if(i){const{message:n}=U("MISSING_OR_INVALID",`Record was recently deleted - ${i}: ${e}`);throw new Error(n)}}),S(this,"isLinkModeEnabled",(e,i)=>{var n,s,o,c,l,u,h,d,_;return!e||i!==se.link_mode?!1:((s=(n=this.client.metadata)==null?void 0:n.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==null?void 0:e.redirect)==null?void 0:h.universal)!==void 0&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==""&&((_=e==null?void 0:e.redirect)==null?void 0:_.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(K==null?void 0:K.Linking)<"u"}),S(this,"getAppLinkIfEnabled",(e,i)=>{var n;return this.isLinkModeEnabled(e,i)?(n=e==null?void 0:e.redirect)==null?void 0:n.universal:void 0}),S(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const i=Qo(e,"topic")||"",n=decodeURIComponent(Qo(e,"wc_ev")||""),s=this.client.session.keys.includes(i);s&&this.client.session.update(i,{transportType:se.link_mode}),this.client.core.dispatchEnvelope({topic:i,message:n,sessionExists:s})}),S(this,"registerLinkModeListeners",async()=>{var e;if(Gs()||Wt()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const i=K==null?void 0:K.Linking;if(typeof i<"u"){i.addEventListener("url",this.handleLinkModeMessage,this.client.name);const n=await i.getInitialURL();n&&setTimeout(()=>{this.handleLinkModeMessage({url:n})},50)}}}),S(this,"getTVFParams",(e,i,n)=>{var s,o,c;if(!((s=i.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[i.request.method],chainId:i.chainId};try{const u=this.extractTxHashesFromResult(i.request,n);l.txHashes=u,l.contractAddresses=this.isValidContractData(i.request.params)?[(c=(o=i.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}),S(this,"isValidContractData",e=>{var i;if(!e)return!1;try{const n=(e==null?void 0:e.data)||((i=e==null?void 0:e[0])==null?void 0:i.data);if(!n.startsWith("0x"))return!1;const s=n.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),S(this,"extractTxHashesFromResult",(e,i)=>{var n;try{if(!i)return[];const s=e.method,o=eb[s];if(s==="sui_signTransaction")return[yw(i.transactionBytes)];if(s==="near_signTransaction")return[sa(i)];if(s==="near_signTransactions")return i.map(l=>sa(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(n=i.tx_json)==null?void 0:n.hash];if(s==="polkadot_signTransaction")return[_E({transaction:e.params.transactionPayload,signature:i.signature})];if(s==="algo_signTxn")return yr(i)?i.map(l=>oa(l)):[oa(i)];if(s==="cosmos_signDirect")return[bw(i)];if(typeof i=="string")return[i];const c=i[o.key];if(yr(c))return s==="solana_signAllTransactions"?c.map(l=>Ew(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[i,n]of Object.entries(e))for(const s of n)try{await this.onProviderMessageEvent({topic:i,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${i}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=U("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(le.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:i,attestation:n,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes($i)?this.client.auth.authKeys.get($i):{publicKey:void 0};try{const c=await this.client.core.crypto.decode(e,i,{receiverPublicKey:o,encoding:s===se.link_mode?zt:Ne});xs(c)?(this.client.core.history.set(e,c),await this.onRelayEventRequest({topic:e,payload:c,attestation:n,transportType:s,encryptedId:Ye(i)})):Ss(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,i)}catch(c){this.client.logger.error(c)}}registerExpirerEvents(){this.client.core.expirer.on(Je.expired,async t=>{const{topic:e,id:i}=gl(t.target);if(i&&this.client.pendingRequest.keys.includes(i))return await this.deletePendingSessionRequest(i,U("EXPIRED"),!0);if(i&&this.client.auth.requests.keys.includes(i))return await this.deletePendingAuthRequest(i,U("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):i&&(await this.deleteProposal(i,!0),this.client.events.emit("proposal_expire",{id:i}))})}registerPairingEvents(){this.client.core.pairing.events.on(Qt.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(Qt.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!de(t,!1)){const{message:e}=U("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}=U("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=U("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!de(t,!1)){const{message:e}=U("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}=U("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=U("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=U("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(de(t,!1)){const{message:e}=U("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=U("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!jm(t)){const{message:e}=U("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=U("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(Ut(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=U("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class fb extends lr{constructor(t,e){super(t,e,Qv,lo),this.core=t,this.logger=e}}class pb extends lr{constructor(t,e){super(t,e,Zv,lo),this.core=t,this.logger=e}}class wb extends lr{constructor(t,e){super(t,e,tb,lo,i=>i.id),this.core=t,this.logger=e}}class gb extends lr{constructor(t,e){super(t,e,sb,cn,()=>$i),this.core=t,this.logger=e}}class mb extends lr{constructor(t,e){super(t,e,ob,cn),this.core=t,this.logger=e}}class Eb extends lr{constructor(t,e){super(t,e,ab,cn,i=>i.id),this.core=t,this.logger=e}}var yb=Object.defineProperty,vb=(r,t,e)=>t in r?yb(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cn=(r,t,e)=>vb(r,typeof t!="symbol"?t+"":t,e);class bb{constructor(t,e){this.core=t,this.logger=e,Cn(this,"authKeys"),Cn(this,"pairingTopics"),Cn(this,"requests"),this.authKeys=new gb(this.core,this.logger),this.pairingTopics=new mb(this.core,this.logger),this.requests=new Eb(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var Ib=Object.defineProperty,Ab=(r,t,e)=>t in r?Ib(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Y=(r,t,e)=>Ab(r,typeof t!="symbol"?t+"":t,e);class uo extends T_{constructor(t){super(t),Y(this,"protocol",Ou),Y(this,"version",Ru),Y(this,"name",xn.name),Y(this,"metadata"),Y(this,"core"),Y(this,"logger"),Y(this,"events",new cr.EventEmitter),Y(this,"engine"),Y(this,"session"),Y(this,"proposal"),Y(this,"pendingRequest"),Y(this,"auth"),Y(this,"signConfig"),Y(this,"on",(i,n)=>this.events.on(i,n)),Y(this,"once",(i,n)=>this.events.once(i,n)),Y(this,"off",(i,n)=>this.events.off(i,n)),Y(this,"removeListener",(i,n)=>this.events.removeListener(i,n)),Y(this,"removeAllListeners",i=>this.events.removeAllListeners(i)),Y(this,"connect",async i=>{try{return await this.engine.connect(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"pair",async i=>{try{return await this.engine.pair(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"approve",async i=>{try{return await this.engine.approve(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"reject",async i=>{try{return await this.engine.reject(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"update",async i=>{try{return await this.engine.update(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"extend",async i=>{try{return await this.engine.extend(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"request",async i=>{try{return await this.engine.request(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"respond",async i=>{try{return await this.engine.respond(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"ping",async i=>{try{return await this.engine.ping(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"emit",async i=>{try{return await this.engine.emit(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"disconnect",async i=>{try{return await this.engine.disconnect(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"find",i=>{try{return this.engine.find(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(i){throw this.logger.error(i.message),i}}),Y(this,"authenticate",async(i,n)=>{try{return await this.engine.authenticate(i,n)}catch(s){throw this.logger.error(s.message),s}}),Y(this,"formatAuthMessage",i=>{try{return this.engine.formatAuthMessage(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"approveSessionAuthenticate",async i=>{try{return await this.engine.approveSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}}),Y(this,"rejectSessionAuthenticate",async i=>{try{return await this.engine.rejectSessionAuthenticate(i)}catch(n){throw this.logger.error(n.message),n}}),this.name=(t==null?void 0:t.name)||xn.name,this.metadata=hp(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:Zi(js({level:(t==null?void 0:t.logger)||xn.logger}));this.core=(t==null?void 0:t.core)||new Yv(t),this.logger=Ve(e,this.name),this.session=new pb(this.core,this.logger),this.proposal=new fb(this.core,this.logger),this.pendingRequest=new wb(this.core,this.logger),this.engine=new _b(this),this.auth=new bb(this.core,this.logger)}static async init(t){const e=new uo(t);return await e.initialize(),e}get context(){return Me(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 Pb=uo,Tb="08c4b07e3ad25f1a27c14a4e8cecb6f0",VI="eip155";async function Ob(r){const{account:t,chainId:e,params:[i]}=r;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:i})).transactionHash}function ln(r,t){if(go(r.address)!==go(t))throw new Error(`Failed to validate account address (${r.address}), differs from ${t}`)}function xI(r){const t=r.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${r}, should have the format 'eip155:1'`);return e}async function Rb(r){const{account:t,chainId:e,thirdwebClient:i,params:[n]}=r;n.from!==void 0&&ln(t,n.from);const s=Un({chain:qe(e),client:i,data:n.data,gas:n.gas?jt(n.gas):void 0,gasPrice:n.gasPrice?jt(n.gasPrice):void 0,to:n.to,value:n.value?jt(n.value):void 0});return(await Ic({account:t,transaction:s})).transactionHash}async function fc(r){const{account:t,params:e}=r;return ln(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function Db(r){const{account:t,params:[e]}=r;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&ln(t,e.from),t.signTransaction({data:e.data,gas:e.gas?jt(e.gas):void 0,gasPrice:e.gasPrice?jt(e.gasPrice):void 0,nonce:e.nonce?nr(e.nonce):void 0,to:e.to,value:e.value?jt(e.value):void 0})}async function pc(r){const{account:t,params:e}=r;return ln(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Lu(r){var i;const{wallet:t,params:e}=r;return((i=t.getChain())==null?void 0:i.id)===nr(e[0].chainId)||await t.switchChain(fh(nr(e[0].chainId))),"0x1"}const SI=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Lu},Symbol.toStringTag,{value:"Module"}));let wt;async function Vu(){if(!wt)return[];const r=await wt.getWalletConnectSessions();return JSON.parse(r??"[]")}function Lb(r){wt||(wt=new Vs({clientId:r.clientId,storage:null}))}async function CI(r){if(!wt)return;const t=await wt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(r),await wt.saveWalletConnectSessions(ot(e))}async function Vb(r){if(!wt)return;const t=await wt.getWalletConnectSessions(),i=JSON.parse(t??"[]").filter(n=>n.topic!==r.topic);await wt.saveWalletConnectSessions(ot(i))}let $n=new WeakMap;const xb={eth_sendRawTransaction:Ob,eth_sendTransaction:Rb,eth_sign:fc,eth_signTransaction:Db,eth_signTypedData:pc,eth_signTypedData_v4:pc,personal_sign:fc,wallet_addEthereumChain:r=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Lu};async function Sb(r){var h,d,_,f;const{wallet:t,requestHandlers:e,onConnect:i,onDisconnect:n,client:s}=r,o=r.chains&&r.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),r.chains.slice(0,10)):r.chains;if($n.has(s))return $n.get(s);Lb({clientId:r.client.clientId});const c=Mi(),l=await Pb.init({metadata:{description:((h=r.appMetadata)==null?void 0:h.description)??c.description,icons:[((d=r.appMetadata)==null?void 0:d.logoUrl)??c.logoUrl],name:((_=r.appMetadata)==null?void 0:_.name)??c.name,url:((f=r.appMetadata)==null?void 0:f.url)??c.url},projectId:r.projectId??Tb});l.on("session_proposal",async p=>{const{onSessionProposal:w}=await a(async()=>{const{onSessionProposal:g}=await import("./session-proposal-C8n_HnVT.js");return{onSessionProposal:g}},__vite__mapDeps([27,2,1,12,18,7,8,19,20,21,22,9,16,17,13]));await w({chains:o,event:p,onConnect:i,wallet:t,walletConnectClient:l}).catch(g=>{if(r.onError)r.onError(g);else throw g})}),l.on("session_request",async p=>{const{fulfillRequest:w}=await a(async()=>{const{fulfillRequest:g}=await import("./session-request-CObMtvdb.js");return{fulfillRequest:g}},__vite__mapDeps([28,2,1,12,18,7,8,19,20,21,22,9,16,17,13]));await w({event:p,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(g=>{if(r.onError)r.onError(g);else throw g})}),l.on("session_event",async p=>{}),l.on("session_ping",p=>{}),l.on("session_delete",async p=>{await xu({session:{topic:p.topic},walletConnectClient:l}).catch(w=>{if(r.onError)r.onError(w);else throw w})});const u=l.disconnect;return l.disconnect=async p=>{const w=await u(p).catch(()=>{});return n&&kb({onDisconnect:n,topic:p.topic}),w},$n.set(r.client,l),l}function Cb(r){const{uri:t,walletConnectClient:e}=r;e.core.pairing.pair({uri:t})}async function $b(){return Vu()}async function xu(r){Vb(r.session);try{await r.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:r.session.topic})}catch{}}async function kb(r){const{topic:t,onDisconnect:e}=r,i=await Vu();e(i.find(n=>n.topic===t)??{topic:t})}function Nb(r){return[st("inApp",{executionMode:r==null?void 0:r.executionMode}),st(Lc),st(ft,{appMetadata:r==null?void 0:r.appMetadata,chains:r==null?void 0:r.chains}),st(Jh),st("io.rabby"),st(Yh),st("com.okex.wallet")]}function Ub(r,t){const e=new Set;let i=r();const n=()=>{for(const o of e)o()},s=o=>{i=o,n()};for(const o of t)o.subscribe(()=>{s(r())});return{getValue(){return i},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function Ri(r,t,e=!0){e&&r();const i=t.map(n=>n.subscribe(()=>{r()}));return()=>{for(const n of i)n()}}const li="tw:connected-wallet-params";async function $I(r,t,e){if(!qb(e))throw new Error("given params are not stringifiable");const i=await r.getItem(li);let n;if(i){try{n=JSON.parse(i)}catch{n={}}n[t]=e}else n={[t]:e};r.setItem(li,ot(n))}async function Bb(r,t){const e=await r.getItem(li);let i;if(e){try{i=JSON.parse(e)}catch{i={}}delete i[t],r.setItem(li,ot(i))}}async function kI(r,t){const e=await r.getItem(li);if(!e)return null;try{const i=JSON.parse(e);return i!=null&&i[t]?i[t]:null}catch{return null}}function qb(r){try{return ot(r),!0}catch{return!1}}function vs(r){if(!r)return!1;if(r.id==="smart")return!0;if(r.id==="inApp"||Pr(r)){const t=r.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Su="thirdweb:connected-wallet-ids",ki="thirdweb:active-wallet-id",bs="thirdweb:active-chain",wc="thirdweb:last-used-wallet-id";function Mb(r){const t=Gt(void 0),e=Gt(void 0),i=Gt(void 0),n=Gt("unknown"),s=Gt(new Map);Ri(()=>{ph([...s.getValue().values()])},[s]),Ri(()=>{const v=i.getValue();if(!v)return;const O=s.getValue().get(v.id);!O||O===v||i.setValue(O)},[s,i]);const o=Gt(new Map),c=Gt(!1),l=Ub(()=>Array.from(o.getValue().values()),[o]),u=v=>{const O=o.getValue();if(O.has(v.id))return;const P=new Map(O);P.set(v.id,v),o.setValue(P)},h=v=>{const O=o.getValue(),P=new Map(O);P.delete(v.id),o.setValue(P)},d=v=>{Bb(r,v.id),h(v),t.getValue()===v&&(r.removeItem(ki),e.setValue(void 0),i.setValue(void 0),t.setValue(void 0),n.setValue("disconnected"))},_=v=>{d(v),v.disconnect()},f=async(v,O)=>{if(!v.getAccount())throw new Error("Cannot set a wallet without an account as active");const E=await(async()=>O!=null&&O.accountAbstraction&&!vs(v)?await zb(v,O.client,O.accountAbstraction,d):v)();return await r.setItem(ki,v.id),await r.setItem(wc,v.id),u(v),(O==null?void 0:O.setWalletAsActive)!==!1&&w(E),v.subscribe("accountChanged",async()=>{var R;const D=await f(v,O);(R=O==null?void 0:O.onConnect)==null||R.call(O,D,l.getValue())}),E},p=async(v,O)=>{var E;const P=await f(v,O);return(E=O==null?void 0:O.onConnect)==null||E.call(O,P,l.getValue()),P},w=v=>{const O=v.getAccount();if(!O)throw new Error("Cannot set a wallet without an account as active");u(v),t.setValue(v),e.setValue(O),i.setValue(v.getChain()),n.setValue("connected");const P=y=>{e.setValue(y)},E=v.subscribe("accountChanged",P),D=v.subscribe("chainChanged",y=>i.setValue(y)),R=v.subscribe("disconnect",()=>{m()}),m=()=>{d(v),E(),D(),R()}},g=async v=>{w(v),v.id!=="smart"&&(await r.setItem(ki,v.id),await r.setItem(wc,v.id))};Ri(()=>{const v=i.getValue();v?r.setItem(bs,ot(v)):r.removeItem(bs)},[i],!1),Ri(async()=>{const O=l.getValue().map(P=>P==null?void 0:P.id).filter(P=>!!P);r.setItem(Su,ot(Array.from(new Set([...O]))))},[l],!1);const A=async v=>{const O=t.getValue();if(!O)throw new Error("No active wallet found");if(!O.switchChain)throw new Error("Wallet does not support switching chains");if(vs(O)){const P=await ho(r);if(P){const E=l.getValue().find(D=>D.id===P);if(E){await E.switchChain(v),await O.switchChain(v),w(O);return}}await O.switchChain(v),w(O)}else await O.switchChain(v);i.setValue(O.getChain())};function V(v){const O=s.getValue();if(v.every(D=>{const R=O.get(D.id);return ot(R)===ot(D)}))return;const E=new Map(O);for(const D of v)E.set(D.id,D);s.setValue(E)}return{activeAccountStore:e,activeWalletChainStore:i,activeWalletConnectionStatusStore:n,activeWalletStore:t,addConnectedWallet:u,connect:p,connectedWallets:l,defineChains:V,disconnectWallet:_,handleConnection:f,isAutoConnecting:c,removeConnectedWallet:h,setActiveWallet:g,switchActiveWalletChain:A}}async function Cu(r){try{const t=await r.getItem(Su);return t?JSON.parse(t):[]}catch{return[]}}async function ho(r){try{const t=await r.getItem(ki);if(t)return t}catch{}return null}async function $u(r){try{const t=await r.getItem(bs);if(t)return JSON.parse(t)}catch{}return null}const zb=async(r,t,e,i)=>{const n=r.getAccount();if(!n)throw new Error("Cannot set a wallet without an account as active");const s=Bs(e);await s.connect({chain:e.chain,client:t,personalAccount:n});const o=r.subscribe("disconnect",()=>{c()}),c=()=>{o(),i(s)};return s};function ku(r,t){return new Promise((e,i)=>{const n=setTimeout(()=>{i(new Error(t.message))},t.ms);r.then(s=>{clearTimeout(n),e(s)},s=>{clearTimeout(n),i(s)})})}function jb(r){const t=i=>Kh(i)||Pr(i),e=vs(r.wallet)&&r.connectedWallets.some(i=>{var n,s,o,c,l,u;return t(i)&&((s=(n=i.getAccount())==null?void 0:n.address)==null?void 0:s.toLowerCase())===((u=(l=(c=(o=r.wallet).getAdminAccount)==null?void 0:c.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(r.wallet)||e}function Kb(){if(typeof document>"u")return;const r=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let i=e;const n=e.indexOf("?");n!==-1&&(t=new URLSearchParams(e.substring(n)),i=e.substring(0,n));const s=r.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=r.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,c=r.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=r.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=r.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const h=(()=>{if(o)return r.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();r.delete("walletId"),r.delete("authProvider"),r.delete("authCookie"),r.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const d=r.toString(),_=d?`?${d}`:"";let f=i;if(t){const p=t.toString();p&&(f=`${i}?${p}`)}return window.history.pushState({},"",`${window.location.pathname}${_}${f}`),{authCookie:l,authFlow:u,authProvider:c,authResult:h,walletId:s}}}let kn;const Fb=async r=>{if(kn&&!r.force&&await kn)return!0;const t=Hb(r);return kn=t,t},Hb=async({storage:r,props:t,createWalletFn:e,manager:i,connectOverride:n,setLastAuthProvider:s})=>{var P,E,D,R,m;const{wallets:o,onConnect:c}=t,l=t.timeout??15e3;let u=!1;i.isAutoConnecting.setValue(!0);let[h,d]=await Promise.all([Cu(r),ho(r)]);const _=Kb();if((_==null?void 0:_.authFlow)==="link"&&_.authResult)return await Wb({client:t.client,connectOverride:n,createWalletFn:e,manager:i,onConnect:c,props:t,setLastAuthProvider:s,storage:r,timeout:l,urlToken:_,wallets:o});const f=o.find(y=>y.id===(_==null?void 0:_.walletId));if(_!=null&&_.authCookie&&f&&await new Vs({clientId:t.client.clientId,ecosystem:Pr(f)?{id:f.id,partnerId:(P=f.getConfig())==null?void 0:P.partnerId}:void 0,storage:r}).saveAuthCookie(_.authCookie),_!=null&&_.walletId&&(d=_.walletId,h=h!=null&&h.includes(_.walletId)?h:[_.walletId,...h||[]]),_!=null&&_.authProvider&&await(s==null?void 0:s(_.authProvider,r)),!h)return u;const p=await $u(r)||t.chain,w=h.map(y=>{const b=o.find(I=>I.id===y);return b||e(y)}),g=d&&(w.find(y=>y.id===d)||e(d));if(g){i.activeWalletConnectionStatusStore.setValue("connecting"),await ku(Is({authResult:_==null?void 0:_.authResult,client:t.client,lastConnectedChain:p,wallet:g}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(y=>{console.warn(y.message),t.onTimeout&&t.onTimeout()});try{await(n?n(g):i.connect(g,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(y){y instanceof Error&&console.warn("Error auto connecting wallet:",y.message),i.activeWalletConnectionStatusStore.setValue("disconnected")}}else i.activeWalletConnectionStatusStore.setValue("disconnected");const A=w.filter(y=>y.id!==d&&h.includes(y.id));for(const y of A)try{await Is({authResult:_==null?void 0:_.authResult,client:t.client,lastConnectedChain:p,wallet:y}),i.addConnectedWallet(y)}catch{}g&&jb({connectedWallets:g?[g,...A]:A,wallet:g})&&((E=t.siweAuth)!=null&&E.requiresAuth)&&!((D=t.siweAuth)!=null&&D.isLoggedIn)&&!((R=t.siweAuth)!=null&&R.isLoggingIn)&&await((m=t.siweAuth)==null?void 0:m.doLogin().catch(y=>{console.warn("Error signing in with SIWE:",y.message)})),i.isAutoConnecting.setValue(!1);const v=i.activeWalletStore.getValue(),O=i.connectedWallets.getValue();if(v){u=!0;try{c==null||c(v,O)}catch(y){console.error("Error calling onConnect callback:",y)}}else i.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function Wb(r){var O;const{client:t,connectOverride:e,createWalletFn:i,manager:n,onConnect:s,props:o,setLastAuthProvider:c,storage:l,timeout:u,urlToken:h,wallets:d}=r,[_,f]=await Promise.all([Cu(l),ho(l)]),p=await $u(l)||o.chain;if(!f||!_)return console.warn("No stored wallet found for linking flow"),n.isAutoConnecting.setValue(!1),!1;h.authProvider&&await(c==null?void 0:c(h.authProvider,l));const w=d.find(P=>P.id===f)||i(f);n.activeWalletConnectionStatusStore.setValue("connecting");try{await ku(Is({authResult:void 0,client:t,lastConnectedChain:p,wallet:w}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(w):n.connect(w,{accountAbstraction:o.accountAbstraction,client:t}))}catch(P){return console.warn("Failed to auto-connect for linking:",P),n.activeWalletConnectionStatusStore.setValue("disconnected"),n.isAutoConnecting.setValue(!1),!1}const g=Pr(w)?{id:w.id,partnerId:(O=w.getConfig())==null?void 0:O.partnerId}:void 0,A=new Vs({clientId:t.clientId,ecosystem:g,storage:l});try{await Rh({client:t,ecosystem:g,storage:A,tokenToLink:h.authResult.storedToken.cookieString})}catch(P){console.error("Failed to link profile after redirect:",P)}n.isAutoConnecting.setValue(!1);const V=n.activeWalletStore.getValue(),v=n.connectedWallets.getValue();if(V){try{s==null||s(V,v)}catch(P){console.error("Error calling onConnect callback:",P)}return!0}return!1}async function Is(r){return r.wallet.autoConnect({authResult:r.authResult,chain:r.lastConnectedChain,client:r.client})}async function Gb(r){const t=r.wallets||Nb(r),e=Mb(Ui);return await Fb({createWalletFn:st,manager:e,props:{...r,wallets:t},storage:Ui})}const NI=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:xb,EIP1193:fd,authenticate:yh,authenticateWithRedirect:vh,autoConnect:Gb,createWallet:st,createWalletAdapter:pd,createWalletConnectClient:Sb,createWalletConnectSession:Cb,deploySmartAccount:mh,disconnectWalletConnectSession:xu,ecosystemWallet:zc,embeddedWallet:Bn,generateAccount:Ed,getActiveWalletConnectSessions:$b,getAllWalletsList:wd,getInstalledWallets:jc,getProfiles:bh,getUser:gh,getUserEmail:Ih,getUserPhoneNumber:Ah,getWalletBalance:yd,getWalletInfo:Sc,inAppWallet:Bn,injectedProvider:qs,isBaseAccountSDKWallet:$c,linkProfile:Ph,preAuthenticate:Th,privateKeyAccount:zn,privateKeyToAccount:zn,randomPrivateKey:wh,smartWallet:Bs,unlinkProfile:Oh,walletConnect:ld},Symbol.toStringTag,{value:"Module"}));export{rl as A,Zi as B,tf as C,Tb as D,bI as E,Vi as F,yI as G,ef as H,Ki as I,AI as J,ae as K,II as L,vs as M,VI as N,SI as O,cu as P,NI as Q,ci as V,Pm as Y,Sc as a,Mi as b,CI as c,xu as d,Vu as e,Qh as f,kI as g,Ob as h,Rb as i,Db as j,pc as k,fc as l,js as m,ct as n,yr as o,xI as p,uo as q,ir as r,$I as s,Ut as t,fe as u,vI as v,Mo as w,il as x,ii as y,G_ as z};