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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (141) hide show
  1. package/assets/{ConstantsUtil-ByjAYmvC.js → ConstantsUtil-BYRHWuZV.js} +1 -1
  2. package/assets/{ExchangeController-Bp8ztJrX.js → ExchangeController-N42lbf3C.js} +1 -1
  3. package/assets/{HelpersUtil-Dp4e1zvd.js → HelpersUtil-DFmhrbIH.js} +1 -1
  4. package/assets/{NetworkUtil-DqGcuBfF.js → NetworkUtil-DM5H1DOt.js} +1 -1
  5. package/assets/{SwapController-DUCq2f7d.js → SwapController-SgAc8zJM.js} +1 -1
  6. package/assets/{W3MFrameProviderSingleton-9eitOT0j.js → W3MFrameProviderSingleton-dGwr0u32.js} +3 -3
  7. package/assets/{basic-C7tUDecp.js → basic-CDUVa7W3.js} +1 -1
  8. package/assets/{biconomy-plHCR2Qq.js → biconomy-Dj37CYYZ.js} +1 -1
  9. package/assets/{browser-VYI7gorG.js → browser-h4rN6CV4.js} +1 -1
  10. package/assets/browser-ponyfill-LG9Rjmfj.js +1 -0
  11. package/assets/{ccip-Bldffu31.js → ccip-Cv_5kGJ0.js} +1 -1
  12. package/assets/{ccip-CrAifiNa.js → ccip-TlIoUAte.js} +1 -1
  13. package/assets/{chains-DTVDhUwv.js → chains-CsuV2rnE.js} +1 -1
  14. package/assets/{common-BEf2T7Hi.js → common-C9wbti_7.js} +1 -1
  15. package/assets/{controller-B8Iy-6V9.js → controller-DpEeOSLx.js} +2 -2
  16. package/assets/{core-XFvzSI58.js → core-BGvtiIgG.js} +4 -4
  17. package/assets/{custom-cPmISGcH.js → custom-BbQhcg55.js} +1 -1
  18. package/assets/{data-capture-DnvAEYWK.js → data-capture-C5UoNnMk.js} +1 -1
  19. package/assets/decimals-DA8L6Gte.js +1 -0
  20. package/assets/{decimals-8g2-fBFa.js → decimals-mBEEumco.js} +1 -1
  21. package/assets/{detectExtension-yvI5WWZb.js → detectExtension-oDT7CrDk.js} +1 -1
  22. package/assets/{email-C8DRQjTT.js → email-CUatRSQC.js} +1 -1
  23. package/assets/{embedded-wallet-BxgtT1uV.js → embedded-wallet-DZAeJhJN.js} +1 -1
  24. package/assets/{engine-BERe87yT.js → engine-AXDB-0h6.js} +1 -1
  25. package/assets/{estimate-l1-fee-BTeKvFv5.js → estimate-l1-fee-Bxwscz8f.js} +1 -1
  26. package/assets/eth_estimateGas-DFXalA2X.js +1 -0
  27. package/assets/{eth_getStorageAt-SbVMAQY-.js → eth_getStorageAt-Dr4zmiJF.js} +1 -1
  28. package/assets/{eth_getTransactionCount-qv0oO1Md.js → eth_getTransactionCount-cZacEETx.js} +1 -1
  29. package/assets/{ethereum-BP59xYBe.js → ethereum-CIBzGnJl.js} +1 -1
  30. package/assets/{extractIPFS-BOFlZk7U.js → extractIPFS-Czsz8-sO.js} +1 -1
  31. package/assets/{features-DVWd8_kC.js → features-fx-atM_l.js} +1 -1
  32. package/assets/{fetchTokenMetadata-BaJXN6RH.js → fetchTokenMetadata-uG4nb_Kh.js} +2 -2
  33. package/assets/{fortmatic-DARkeYTE.js → fortmatic-boxtmFta.js} +1 -1
  34. package/assets/get-ecosystem-wallet-info-BI2Fd0Vd.js +1 -0
  35. package/assets/{getBalance-D6wpo61w.js → getBalance-CC2S0qtL.js} +2 -2
  36. package/assets/{getInstalledModules-Dkj379ys.js → getInstalledModules-53n5UYt2.js} +1 -1
  37. package/assets/{getNFT-HMkoXD7L.js → getNFT-C3FPakLN.js} +2 -2
  38. package/assets/{getNFT-Drn4rxrk.js → getNFT-CnaK4j2q.js} +1 -1
  39. package/assets/{hashTypedData-CMDSWYgs.js → hashTypedData-C4JiqOxU.js} +1 -1
  40. package/assets/{hashTypedData-B5shS-rs.js → hashTypedData-D1Ievn97.js} +1 -1
  41. package/assets/{in-app-wallet-calls-l9-2W_Em.js → in-app-wallet-calls-khLeeKNu.js} +1 -1
  42. package/assets/{index-BIPd_vR5.js → index-0P32tQWj.js} +1 -1
  43. package/assets/{index-DIlwNfpB.js → index-1quVm3wk.js} +1 -1
  44. package/assets/{index-DbAu4Peg.js → index-B2PoGJRP.js} +3 -3
  45. package/assets/{index-BaGjqMte.js → index-B5w_jZpc.js} +2 -2
  46. package/assets/{index-CE5G6IEJ.js → index-B6j-Tckn.js} +1 -1
  47. package/assets/{index-CjiwjbqL.js → index-BCiKer83.js} +1 -1
  48. package/assets/{index-C8NSq3HK.js → index-BCqrDgyR.js} +1 -1
  49. package/assets/{index-BXAxcybX.js → index-BE5nQY53.js} +1 -1
  50. package/assets/{index-C51HwlD0.js → index-BF9Yx_yV.js} +1 -1
  51. package/assets/{index-CWGeCZBJ.js → index-BJCYEGPg.js} +1 -1
  52. package/assets/{index-Cy1X3n_C.js → index-BT0xQ-Xd.js} +1 -1
  53. package/assets/{index-0ShVRzxt.js → index-BVi4iI8y.js} +1 -1
  54. package/assets/{index-BDgZ3gDE.js → index-BVvMg9ZB.js} +1 -1
  55. package/assets/{index-DFE6t65x.js → index-BpxeqYFx.js} +1 -1
  56. package/assets/{index-B5ECjSS9.js → index-Bv6LvzLS.js} +1 -1
  57. package/assets/{index-i4VBSYqA.js → index-BvCGPTHO.js} +1 -1
  58. package/assets/index-Bzi38pjx.css +1 -0
  59. package/assets/{index-CH0zI801.js → index-C5oPclal.js} +1 -1
  60. package/assets/{index-D2ZBQG8w.js → index-C6-AvlPm.js} +1 -1
  61. package/assets/{index-CWnFK_-0.js → index-C9EMW8qD.js} +1 -1
  62. package/assets/{index-C-uqursN.js → index-C9vcJp9T.js} +1 -1
  63. package/assets/{index-DK-ZMNLh.js → index-CO3lXLzl.js} +1 -1
  64. package/assets/{index-DS2Lm9tG.js → index-CYBDya_s.js} +1 -1
  65. package/assets/{index-okvlQSs2.js → index-Coj3uG35.js} +1 -1
  66. package/assets/{index-Cu4ZjLNb.js → index-CqbvjyBi.js} +5 -5
  67. package/assets/{index-wds8TuUm.js → index-CwfOYq8B.js} +1 -1
  68. package/assets/{index-aoxVkzFE.js → index-Cz0JdeQb.js} +1 -1
  69. package/assets/{index-C5ciuua_.js → index-D-YuFp2i.js} +1 -1
  70. package/assets/{index-I68folnJ.js → index-D4NLrlUn.js} +1 -1
  71. package/assets/{index-B7Jt3b4d.js → index-D8PaxcsI.js} +1 -1
  72. package/assets/{index-r_1z0VI_.js → index-D9ey6cqT.js} +1 -1
  73. package/assets/{index-B-vyBZw9.js → index-DRYOQXZX.js} +1 -1
  74. package/assets/{index-DOnRCLNP.js → index-DT1PkdGa.js} +2 -2
  75. package/assets/{index-DWRq2SN_.js → index-DXCSroqX.js} +1 -1
  76. package/assets/{index-mZa0UiRt.js → index-DXs78xw9.js} +1 -1
  77. package/assets/{index-kXKMGszW.js → index-DZ0punK7.js} +1 -1
  78. package/assets/{index-B9U0GcYk.js → index-D_m5AL3D.js} +1 -1
  79. package/assets/{index-BxdNwV86.js → index-Dc148hav.js} +1 -1
  80. package/assets/{index-DP1DuCnR.js → index-DgDxBH9m.js} +1 -1
  81. package/assets/{index-DfWsAOhN.js → index-Dm7tCcMc.js} +3 -3
  82. package/assets/{index-D0LvjNIX.js → index-DmIGOG39.js} +1 -1
  83. package/assets/{index-JfVynEph.js → index-DmK5ktNw.js} +1 -1
  84. package/assets/{index-Cp7mdTuR.js → index-Eyans5--.js} +1 -1
  85. package/assets/{index-DPxCDCvr.js → index-KK8ZylE4.js} +1 -1
  86. package/assets/{index-DvJmANzU.js → index-TUD0QlWP.js} +1 -1
  87. package/assets/{index-TBthDmkl.js → index-ak5cSl-l.js} +1 -1
  88. package/assets/{index-8M7OkBFm.js → index-bVr8-SEv.js} +1 -1
  89. package/assets/{index-BlykZ8Gp.js → index-prLj8b2x.js} +1 -1
  90. package/assets/{index-BKL7nv1p.js → index-vajj2FBo.js} +1 -1
  91. package/assets/{index.es-YpI01v2I.js → index.es-C85F8NOj.js} +1 -1
  92. package/assets/{index.es-CkxUaFYS.js → index.es-DYgSAVrd.js} +1 -1
  93. package/assets/{index.es-cEGj7JU0.js → index.es-XXBqJXMm.js} +4 -4
  94. package/assets/{localBatchGatewayRequest-CNIOIq-Z.js → localBatchGatewayRequest-DbQn1s0J.js} +1 -1
  95. package/assets/{networks-DJ72puSk.js → networks-DMqekeph.js} +1 -1
  96. package/assets/{onramp--l5ZLxWE.js → onramp-qvbxoSMm.js} +1 -1
  97. package/assets/{openzeppelin-CqtRqxtF.js → openzeppelin-B6Und3LJ.js} +1 -1
  98. package/assets/{ownerOf-cWkgEtd8.js → ownerOf-CUoSe2c5.js} +1 -1
  99. package/assets/{parseEventLogs-D1xiFnCH.js → parseEventLogs-BxtEI7tW.js} +3 -3
  100. package/assets/{parseNft-DH5KlHPI.js → parseNft-DB_pGzOu.js} +2 -2
  101. package/assets/{parseSignature-HAlgOHnm.js → parseSignature-Csyua1uA.js} +3 -3
  102. package/assets/{parseSignature-BYhcrVdX.js → parseSignature-O0fAqZoB.js} +1 -1
  103. package/assets/{pay-with-exchange-CiXPJJ6-.js → pay-with-exchange-1MlV9x6H.js} +1 -1
  104. package/assets/{qr-overlay-CmFgwJBd.js → qr-overlay-DA6htUdY.js} +3 -3
  105. package/assets/{receive-t2TxUItI.js → receive-JnpfZY7d.js} +1 -1
  106. package/assets/{resolveImplementation-iG9WRRnW.js → resolveImplementation-B8d2Q-Ro.js} +1 -1
  107. package/assets/{rpc-sIdV4wiJ.js → rpc-DkFFCBh9.js} +1 -1
  108. package/assets/{secp256k1-Rk5k9i7o.js → secp256k1-BCPsQ5nJ.js} +1 -1
  109. package/assets/{secp256k1-Co_Jve4c.js → secp256k1-BZmrY8e3.js} +1 -1
  110. package/assets/{secp256k1-Bg2aUJRs.js → secp256k1-TIizaas9.js} +1 -1
  111. package/assets/{send-ByB5fOtm.js → send-DsnDja5n.js} +1 -1
  112. package/assets/{send-batch-transaction-D79MC_wr.js → send-batch-transaction-jNcvidMH.js} +1 -1
  113. package/assets/{send-eip712-transaction-CB6qLgks.js → send-eip712-transaction-DDJVOUpU.js} +2 -2
  114. package/assets/{send-gasless-transaction-Dt1qtUR8.js → send-gasless-transaction-DXjarWmh.js} +2 -2
  115. package/assets/{session-proposal-CY0k9Jnm.js → session-proposal-xJguSOgr.js} +1 -1
  116. package/assets/{session-request-B_2glC9e.js → session-request-BhD4eDPG.js} +2 -2
  117. package/assets/{sha256-Dy8KQE_5.js → sha256-CbjS9vFa.js} +1 -1
  118. package/assets/{signing-gNn6SJWz.js → signing-tKzVzr3v.js} +5 -5
  119. package/assets/{socials-Dx84-PrV.js → socials-CER945jA.js} +1 -1
  120. package/assets/{swaps-CK9Sfcew.js → swaps-Dy4hNTFm.js} +1 -1
  121. package/assets/{thirdweb-Bx5V_C1s.js → thirdweb-CNCkvOQU.js} +3 -3
  122. package/assets/{totalSupply-O-VFDoRO.js → totalSupply-BQvZy7Uc.js} +1 -1
  123. package/assets/{transactionReceipt-BqEjx5q-.js → transactionReceipt-DA1xo-2g.js} +1 -1
  124. package/assets/{transactions-BLOC2qYE.js → transactions-CwEfhngY.js} +1 -1
  125. package/assets/{utils-h8VUSGPW.js → utils-BUWGRgBa.js} +1 -1
  126. package/assets/{verifyHash-CNJ6t8Wp.js → verifyHash-CX9Livyx.js} +1 -1
  127. package/assets/{w3m-modal-nzPxg0Fr.js → w3m-modal-B1spewtI.js} +1 -1
  128. package/assets/{w3m-modal-CCQuGDus.js → w3m-modal-B6M729n4.js} +1 -1
  129. package/assets/{wait-for-tx-receipt-5pSBMNe2.js → wait-for-tx-receipt-BLruoSfj.js} +1 -1
  130. package/assets/{wallets-Bz03-Btm.js → wallets-vCTTbbau.js} +6 -6
  131. package/assets/{web-connector-CAOe_uvv.js → web-connector-h9SB5qXs.js} +3 -3
  132. package/assets/{writeContract-CCar3Ocq.js → writeContract-C9KDDivM.js} +1 -1
  133. package/assets/{zora-sepolia-D6mjhB5j.js → zora-sepolia-pCyxGzqm.js} +1 -1
  134. package/assets/{zoraTestnet-WLSFziQl.js → zoraTestnet-ChmlUfs6.js} +1 -1
  135. package/index.html +4 -4
  136. package/package.json +3 -3
  137. package/assets/browser-ponyfill-BmgQyNz0.js +0 -1
  138. package/assets/decimals-DR6jraOc.js +0 -1
  139. package/assets/eth_estimateGas-DKKwG-Ue.js +0 -1
  140. package/assets/get-ecosystem-wallet-info-Cvjz8DFX.js +0 -1
  141. package/assets/index-829Uxa3Y.css +0 -1
@@ -1,2 +1,2 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-Cy1X3n_C.js","assets/hooks.module-CpBu4GjP.js","assets/WebCryptoP256-BkRKBE89.js","assets/sha256-D33fGSQc.js","assets/sha2-D3ryOfi3.js","assets/hmac-BMnSt9Ou.js","assets/index-Cu4ZjLNb.js","assets/index-829Uxa3Y.css","assets/parseSignature-BYhcrVdX.js","assets/parseEventLogs-D1xiFnCH.js","assets/NetworkUtil-DqGcuBfF.js","assets/custom-cPmISGcH.js","assets/W3MFrameProviderSingleton-9eitOT0j.js","assets/index-DS2Lm9tG.js","assets/browser-ponyfill-BmgQyNz0.js","assets/localBatchGatewayRequest-CNIOIq-Z.js","assets/verifyHash-CNJ6t8Wp.js","assets/secp256k1-Bg2aUJRs.js","assets/hashTypedData-B5shS-rs.js","assets/writeContract-CCar3Ocq.js","assets/zoraTestnet-WLSFziQl.js","assets/index-nibyPLVP.js","assets/index-C8NSq3HK.js","assets/index-kXKMGszW.js","assets/index-H-Ckw-g_.js","assets/index-BXAxcybX.js","assets/native-Ca0o68QA.js","assets/index.es-cEGj7JU0.js","assets/index-B-vyBZw9.js","assets/index-CJdot1dH.js","assets/index.es-CkxUaFYS.js"])))=>i.map(i=>d[i]);
2
- import{_ as z}from"./index-Cu4ZjLNb.js";import{c as b,C as A,a as R,P as O}from"./index-DfWsAOhN.js";import{i as It}from"./index-DfWsAOhN.js";import{aI as C,aR as W,bg as Z}from"./parseEventLogs-D1xiFnCH.js";import{w as v,ae as j,a4 as k,X as f,t as E,ak as V,r as x}from"./NetworkUtil-DqGcuBfF.js";import{G,w as S,a as U}from"./W3MFrameProviderSingleton-9eitOT0j.js";import{a as B}from"./custom-cPmISGcH.js";import"./index-DS2Lm9tG.js";import"./browser-ponyfill-BmgQyNz0.js";import"./store-DOLZnwHk.js";import"./writeContract-CCar3Ocq.js";import"./sha256-D33fGSQc.js";import"./sha2-D3ryOfi3.js";function F(u,{body:g,onError:h,onResponse:M}){return u.request({body:g,onError:h,onResponse:M}),u}async function H(u,{body:g,timeout:h=1e4}){return u.requestAsync({body:g,timeout:h})}const T={http(u,g){return G(u).request(g)},webSocket:F,webSocketAsync:H};_.type="mock";function _(u){const g=new Map,h=u.features??{defaultConnected:!1};let M=h.defaultConnected,a;return b(o=>({id:"mock",name:"Mock Connector",type:_.type,async setup(){a=o.chains[0].id},async connect({chainId:t,withCapabilities:i}={}){if(h.connectError)throw typeof h.connectError=="boolean"?new f(new Error("Failed to connect.")):h.connectError;const c=await(await this.getProvider()).request({method:"eth_requestAccounts"});let e=await this.getChainId();return t&&e!==t&&(e=(await this.switchChain({chainId:t})).id),M=!0,{accounts:i?c.map(n=>({address:C(n),capabilities:{foo:{bar:n}}})):c.map(n=>C(n)),chainId:e}},async disconnect(){M=!1},async getAccounts(){if(!M)throw new R;return(await(await this.getProvider()).request({method:"eth_accounts"})).map(r=>C(r))},async getChainId(){const i=await(await this.getProvider()).request({method:"eth_chainId"});return k(i,"number")},async isAuthorized(){return!h.reconnect||!M?!1:!!(await this.getAccounts()).length},async switchChain({chainId:t}){const i=await this.getProvider(),r=o.chains.find(c=>c.id===t);if(!r)throw new v(new A);return await i.request({method:"wallet_switchEthereumChain",params:[{chainId:j(t)}]}),r},onAccountsChanged(t){t.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:t.map(i=>C(i))})},onChainChanged(t){const i=Number(t);o.emitter.emit("change",{chainId:i})},async onDisconnect(t){o.emitter.emit("disconnect"),M=!1},async getProvider({chainId:t}={}){const r=(o.chains.find(e=>e.id===t)??o.chains[0]).rpcUrls.default.http[0];return B({request:async({method:e,params:n})=>{if(e==="eth_chainId")return j(a);if(e==="eth_accounts"||e==="eth_requestAccounts")return u.accounts;if(e==="eth_signTypedData_v4"&&h.signTypedDataError)throw typeof h.signTypedDataError=="boolean"?new f(new Error("Failed to sign typed data.")):h.signTypedDataError;if(e==="wallet_switchEthereumChain"){if(h.switchChainError)throw typeof h.switchChainError=="boolean"?new f(new Error("Failed to switch chain.")):h.switchChainError;a=k(n[0].chainId,"number"),this.onChainChanged(a.toString());return}if(e==="wallet_watchAsset"){if(h.watchAssetError)throw typeof h.watchAssetError=="boolean"?new f(new Error("Failed to switch chain.")):h.watchAssetError;return M}if(e==="wallet_getCapabilities")return{"0x2105":{paymasterService:{supported:n[0]==="0x95132632579b073D12a6673e18Ab05777a6B86f8"},sessionKeys:{supported:!0}},"0x14A34":{paymasterService:{supported:n[0]==="0x95132632579b073D12a6673e18Ab05777a6B86f8"}}};if(e==="wallet_sendCalls"){const l=[],w=n[0].calls,p=n[0].from;for(const D of w){const{result:N,error:m}=await T.http(r,{body:{method:"eth_sendTransaction",params:[{...D,...typeof p<"u"?{from:p}:{}}]}});if(m)throw new E({body:{method:e,params:n},error:m,url:r});l.push(N)}const y=W(V(JSON.stringify(w)));return g.set(y,l),{id:y}}if(e==="wallet_getCallsStatus"){const l=g.get(n[0]);if(!l)return{atomic:!1,chainId:"0x1",id:n[0],status:100,receipts:[],version:"2.0.0"};const p=(await Promise.all(l.map(async y=>{const{result:D,error:N}=await T.http(r,{body:{method:"eth_getTransactionReceipt",params:[y],id:0}});if(N)throw new E({body:{method:e,params:n},error:N,url:r});return D?{blockHash:D.blockHash,blockNumber:D.blockNumber,gasUsed:D.gasUsed,logs:D.logs,status:D.status,transactionHash:D.transactionHash}:null}))).filter(y=>y!==null);return p.length===0?{atomic:!1,chainId:"0x1",id:n[0],status:100,receipts:[],version:"2.0.0"}:{atomic:!1,chainId:"0x1",id:n[0],status:200,receipts:p,version:"2.0.0"}}if(e==="wallet_showCallsStatus")return;if(e==="personal_sign"){if(h.signMessageError)throw typeof h.signMessageError=="boolean"?new f(new Error("Failed to sign message.")):h.signMessageError;e="eth_sign",n=[n[1],n[0]]}const s={method:e,params:n},{error:d,result:I}=await T.http(r,{body:s});if(d)throw new E({body:s,error:d,url:r});return I}})({retryCount:0})}}))}function J(u){const{chain:g}=u,h=g.rpcUrls.default.http[0];if(!u.transports)return[h];const M=u.transports?.[g.id]?.({chain:g});return(M?.value?.transports||[M]).map(({value:o})=>o?.url||h)}const K='data:image/svg+xml,<svg width="269" height="269" viewBox="0 0 269 269" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="269" height="269" fill="black"/><path d="M123.273 190.794H93.445L121.09 105.318H85.7334L93.445 80.2642H191.95L184.238 105.318H150.773L123.273 190.794Z" fill="white"/></svg>';function ut(u={}){const{dialog:g,host:h,icon:M=K,name:a,rdns:o,theme:t,...i}=u;return X({createAdapter(r){return r.dialog({dialog:g,host:h,icon:M,name:a,rdns:o,theme:t})},icon:M,id:o??"xyz.tempo",name:a??"Tempo Wallet",providerParameters:i,rdns:o??"xyz.tempo",type:"injected"})}function X(u){return b(g=>{const h=g.chains;let M,a,o,t,i;async function r(){return await z(()=>import("./core_false-CNabe580.js"),[]).catch(()=>{throw new Error('dependency "accounts" not found')})}async function c(){return M??=(async()=>{const e=await r();return e.Provider.create({...u.providerParameters,adapter:u.createAdapter(e),chains:g.chains,transports:g.transports})})(),await M}return{icon:u.icon,id:u.id,name:u.name,rdns:u.rdns,type:u.type,async connect(e={}){const{chainId:n,isReconnecting:s,withCapabilities:d}=e,I="capabilities"in e?e.capabilities:void 0;let l=[],w;s&&(l=await this.getAccounts().then(p=>p.map(y=>({address:y,capabilities:{}}))).catch(()=>[]));try{if(!l.length&&!s&&(l=(await(await c()).request({method:"wallet_connect",params:[{...n?{chainId:n}:{},...I?{capabilities:I}:{}}]})).accounts),w??=await this.getChainId(),!w)throw new A;const p=await c();return t&&(p.removeListener("connect",t),t=void 0),a||(a=this.onAccountsChanged.bind(this),p.on("accountsChanged",a)),o||(o=this.onChainChanged.bind(this),p.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),p.on("disconnect",i)),{accounts:d?l:l.map(y=>y.address),chainId:w}}catch(p){const y=p;throw y.code===f.code?new f(y):y}},async disconnect(){const e=await c();o&&(e.removeListener("chainChanged",o),o=void 0),i&&(e.removeListener("disconnect",i),i=void 0),t||(t=this.onConnect?.bind(this),t&&e.on("connect",t)),await e.request({method:"wallet_disconnect"})},async getAccounts(){return await(await c()).request({method:"eth_accounts"})},async getChainId(){const e=await c();return Number(await e.request({method:"eth_chainId"}))},async getClient({chainId:e}={}){const n=await c(),{address:s}=n.getAccount({accessKey:!1});return Object.assign(n.getClient({chainId:e}),{account:Z(s)})},async getProvider(){return await c()},async isAuthorized(){try{return!!(await S(()=>this.getAccounts())).length}catch{return!1}},onAccountsChanged(e){g.emitter.emit("change",{accounts:e})},onChainChanged(e){g.emitter.emit("change",{chainId:Number(e)})},async onConnect(e){const n=await this.getAccounts();if(n.length===0)return;const s=Number(e.chainId);g.emitter.emit("connect",{accounts:n,chainId:s});const d=await c();t&&(d.removeListener("connect",t),t=void 0),a||(a=this.onAccountsChanged.bind(this),d.on("accountsChanged",a)),o||(o=this.onChainChanged.bind(this),d.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),d.on("disconnect",i))},async onDisconnect(e){const n=await c();g.emitter.emit("disconnect"),o&&(n.removeListener("chainChanged",o),o=void 0),i&&(n.removeListener("disconnect",i),i=void 0),t||(t=this.onConnect?.bind(this),t&&n.on("connect",t))},async setup(){if(!t){const e=await c();t=this.onConnect?.bind(this),t&&e.on("connect",t)}},async switchChain({chainId:e}){const n=h.find(d=>d.id===e);if(!n)throw new v(new A);return await(await c()).request({method:"wallet_switchEthereumChain",params:[{chainId:j(e)}]}),n}}})}function Mt(u={}){let g,h,M,a;return b(o=>({id:"baseAccount",name:"Base Account",rdns:"app.base.account",type:"baseAccount",async connect({chainId:t,withCapabilities:i,...r}={}){try{const c=await this.getProvider(),e=t??o.chains[0]?.id;if(!e)throw new A;let{accounts:n,currentChainId:s}=await(async()=>{if(r.isReconnecting)return{accounts:(await c.request({method:"eth_accounts",params:[]})).map(w=>({address:C(w)})),currentChainId:await this.getChainId()};const d=await c.request({method:"wallet_connect",params:[{capabilities:"capabilities"in r&&r.capabilities?r.capabilities:{},chainIds:[j(e),...o.chains.filter(w=>w.id!==e).map(w=>j(w.id))]}]});return{accounts:(await c.request({method:"eth_accounts"})).map(w=>d.accounts.find(p=>p.address===w)??{address:w}).map(w=>({address:C(w.address),capabilities:w.capabilities??{}})),currentChainId:Number(d.chainIds[0])}})();return h||(h=this.onAccountsChanged.bind(this),c.on("accountsChanged",h)),M||(M=this.onChainChanged.bind(this),c.on("chainChanged",M)),a||(a=this.onDisconnect.bind(this),c.on("disconnect",a)),t&&s!==t&&(s=(await this.switchChain({chainId:t}).catch(I=>{if(I.code===f.code)throw I;return{id:s}}))?.id??s),{accounts:i?n:n.map(d=>d.address),chainId:s}}catch(c){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message)?new f(c):c}},async disconnect(){const t=await this.getProvider();h&&(t.removeListener("accountsChanged",h),h=void 0),M&&(t.removeListener("chainChanged",M),M=void 0),a&&(t.removeListener("disconnect",a),a=void 0),t.disconnect()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(i=>C(i))},async getChainId(){const i=await(await this.getProvider()).request({method:"eth_chainId"});return Number(i)},async getProvider(){if(!g){const t=typeof u.preference=="string"?{options:u.preference}:{...u.preference,options:u.preference?.options??"all"},{createBaseAccountSDK:i}=await(()=>{try{return z(()=>import("./index-Cy1X3n_C.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))}catch{throw new Error('dependency "@base-org/account" not found')}})();g=i({...u,appChainIds:o.chains.map(c=>c.id),preference:t}).getProvider()}return g},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:t,chainId:i}){const r=o.chains.find(e=>e.id===i);if(!r)throw new v(new A);const c=await this.getProvider();try{return await c.request({method:"wallet_switchEthereumChain",params:[{chainId:j(r.id)}]}),r}catch(e){if(e.code===4902)try{let n;t?.blockExplorerUrls?n=t.blockExplorerUrls:n=r.blockExplorers?.default.url?[r.blockExplorers?.default.url]:[];let s;t?.rpcUrls?.length?s=t.rpcUrls:s=[r.rpcUrls.default?.http[0]??""];const d={blockExplorerUrls:n,chainId:j(i),chainName:t?.chainName??r.name,iconUrls:t?.iconUrls,nativeCurrency:t?.nativeCurrency??r.nativeCurrency,rpcUrls:s};return await c.request({method:"wallet_addEthereumChain",params:[d]}),r}catch(n){throw new f(n)}throw new v(e)}},onAccountsChanged(t){t.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:t.map(i=>C(i))})},onChainChanged(t){const i=Number(t);o.emitter.emit("change",{chainId:i})},async onDisconnect(t){o.emitter.emit("disconnect");const i=await this.getProvider();h&&(i.removeListener("accountsChanged",h),h=void 0),M&&(i.removeListener("chainChanged",M),M=void 0),a&&(i.removeListener("disconnect",a),a=void 0)}}))}Y.type="coinbaseWallet";function Y(u={}){let g,h,M,a;return b(o=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:Y.type,async connect({chainId:t,withCapabilities:i,...r}={}){try{const c=await this.getProvider(),e=(await c.request({method:"eth_requestAccounts",params:"instantOnboarding"in r&&r.instantOnboarding?[{onboarding:"instant"}]:[]})).map(s=>C(s));h||(h=this.onAccountsChanged.bind(this),c.on("accountsChanged",h)),M||(M=this.onChainChanged.bind(this),c.on("chainChanged",M)),a||(a=this.onDisconnect.bind(this),c.on("disconnect",a));let n=await this.getChainId();return t&&n!==t&&(n=(await this.switchChain({chainId:t}).catch(d=>{if(d.code===f.code)throw d;return{id:n}}))?.id??n),{accounts:i?e.map(s=>({address:s,capabilities:{}})):e,chainId:n}}catch(c){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message)?new f(c):c}},async disconnect(){const t=await this.getProvider();h&&(t.removeListener("accountsChanged",h),h=void 0),M&&(t.removeListener("chainChanged",M),M=void 0),a&&(t.removeListener("disconnect",a),a=void 0),t.disconnect(),t.close?.()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(i=>C(i))},async getChainId(){const i=await(await this.getProvider()).request({method:"eth_chainId"});return Number(i)},async getProvider(){if(!g){const{createCoinbaseWalletSDK:t}=await(()=>{try{return z(()=>import("./index-C8NSq3HK.js").then(r=>r.i),__vite__mapDeps([22,6,7,1]))}catch{throw new Error('dependency "@coinbase/wallet-sdk" not found')}})();g=t({...u,appChainIds:o.chains.map(r=>r.id),preference:{options:"all",...u.preference??{}}}).getProvider()}return g},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:t,chainId:i}){const r=o.chains.find(e=>e.id===i);if(!r)throw new v(new A);const c=await this.getProvider();try{return await c.request({method:"wallet_switchEthereumChain",params:[{chainId:j(r.id)}]}),r}catch(e){if(e.code===4902)try{let n;t?.blockExplorerUrls?n=t.blockExplorerUrls:n=r.blockExplorers?.default.url?[r.blockExplorers?.default.url]:[];let s;t?.rpcUrls?.length?s=t.rpcUrls:s=[r.rpcUrls.default?.http[0]??""];const d={blockExplorerUrls:n,chainId:j(i),chainName:t?.chainName??r.name,iconUrls:t?.iconUrls,nativeCurrency:t?.nativeCurrency??r.nativeCurrency,rpcUrls:s};return await c.request({method:"wallet_addEthereumChain",params:[d]}),r}catch(n){throw new f(n)}throw new v(e)}},onAccountsChanged(t){t.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:t.map(i=>C(i))})},onChainChanged(t){const i=Number(t);o.emitter.emit("change",{chainId:i})},async onDisconnect(t){o.emitter.emit("disconnect");const i=await this.getProvider();h&&(i.removeListener("accountsChanged",h),h=void 0),M&&(i.removeListener("chainChanged",M),M=void 0),a&&(i.removeListener("disconnect",a),a=void 0)}}))}P.type="metaMask";function P(u={}){let g,h;return b(M=>({id:"metaMaskSDK",name:"MetaMask",rdns:["io.metamask","io.metamask.mobile"],type:P.type,async connect({chainId:a,isReconnecting:o,withCapabilities:t}={}){const i=await this.getInstance(),r=i.getProvider();let c=[];o&&(c=await this.getAccounts().catch(()=>[]));try{let e,n;if(!c?.length){const d=M.chains.map(I=>j(I.id));u.connectAndSign||u.connectWith?(u.connectAndSign?e=(await i.connectAndSign({chainIds:d,message:u.connectAndSign})).signature:u.connectWith&&(n=(await i.connectWith({chainIds:d,method:u.connectWith.method,params:u.connectWith.params})).result),c=await this.getAccounts()):c=(await i.connect({chainIds:d})).accounts.map(l=>C(l))}let s=await this.getChainId();return a&&s!==a&&(s=(await this.switchChain({chainId:a}).catch(I=>{if(I.code===f.code)throw I;return{id:s}}))?.id??s),e?r.emit("connectAndSign",{accounts:c,chainId:j(s),signResponse:e}):n&&r.emit("connectWith",{accounts:c,chainId:j(s),connectWithResponse:n}),{accounts:t?c.map(d=>({address:d,capabilities:{}})):c,chainId:s}}catch(e){const n=e;throw n.code===f.code?new f(n):n.code===x.code?new x(n):n}},async disconnect(){return(await this.getInstance()).disconnect()},async getAccounts(){const a=await this.getInstance();return a.accounts.length?a.accounts.map(i=>C(i)):(await a.getProvider().request({method:"eth_accounts"})).map(i=>C(i))},async getChainId(){const a=await this.getInstance();if(a.getChainId())return Number(a.getChainId());const t=await a.getProvider().request({method:"eth_chainId"});return Number(t)},async getProvider(){return(await this.getInstance()).getProvider()},async isAuthorized(){try{return!!(await S(async()=>U(async()=>{const t=await this.getAccounts();if(!t.length)throw new Error("try again");return t},{timeout:10}),{delay:11,retryCount:3})).length}catch{return!1}},async switchChain({addEthereumChainParameter:a,chainId:o}){const t=M.chains.find(({id:r})=>r===Number(o));if(!t)throw new v(new A);const i=j(o);try{return await(await this.getInstance()).switchChain({chainId:i,chainConfiguration:{blockExplorerUrls:a?.blockExplorerUrls?[...a.blockExplorerUrls]:t.blockExplorers?.default.url?[t.blockExplorers.default.url]:void 0,chainId:i,chainName:a?.chainName??t.name,iconUrls:a?.iconUrls,nativeCurrency:a?.nativeCurrency??t.nativeCurrency,rpcUrls:a?.rpcUrls?[...a.rpcUrls]:t.rpcUrls.default?.http?[...t.rpcUrls.default.http]:void 0}}),t}catch(r){const c=r;throw c.code===f.code?new f(c):new v(c)}},async onAccountsChanged(a){M.emitter.emit("change",{accounts:a.map(o=>C(o))})},onChainChanged(a){const o=Number(a);M.emitter.emit("change",{chainId:o})},async onConnect(a){const o=await this.getAccounts();if(o.length===0)return;const t=Number(a.chainId);M.emitter.emit("connect",{accounts:o,chainId:t})},async onDisconnect(a){a&&a.code===1013&&await this.getProvider()&&(await this.getAccounts()).length||M.emitter.emit("disconnect")},onDisplayUri(a){M.emitter.emit("message",{type:"display_uri",data:a})},async getInstance(){if(!g){if(!h){const{createEVMClient:a}=await(async()=>{try{return z(()=>import("./connectors_false-DqI1AxGN.js"),[])}catch{throw new Error('dependency "@metamask/connect-evm" not found')}})(),o=typeof window>"u"?{name:"wagmi"}:{name:window.location.hostname,url:window.location.href};h=a({...u,api:{supportedNetworks:Object.fromEntries(M.chains.map(t=>[j(t.id),t.rpcUrls.default?.http[0]??""]))},dapp:u.dapp??{...o,...u.dappMetadata},debug:u.debug??u.logging?.sdk,eventHandlers:{accountsChanged:this.onAccountsChanged.bind(this),chainChanged:this.onChainChanged.bind(this),connect:this.onConnect.bind(this),disconnect:this.onDisconnect.bind(this),displayUri:this.onDisplayUri.bind(this)},analytics:{integrationType:"wagmi"},ui:{...u.ui,...u.headless!=null&&{headless:u.headless}},...u.mobile&&{mobile:u.mobile}})}g=await h}return g}}))}function lt(u={}){const g=h=>typeof h.on=="function"&&typeof h.removeListener=="function";return b(h=>{const M=h.chains??u.chains??[],a=h.transports?h.transports:u.transports;let o,t,i,r,c;return{async connect({chainId:e=M[0].id,...n}={}){const s="isReconnecting"in n&&n.isReconnecting||!1,d="withCapabilities"in n&&n.withCapabilities||!1;let I=[],l;s&&([I,l]=await Promise.all([this.getAccounts().catch(()=>[]),this.getChainId().catch(()=>{})]),e&&l!==e&&(l=(await this.switchChain({chainId:e}).catch(y=>{if(y.code===f.code)throw y;return{id:l}}))?.id??l));const w=await this.getProvider();try{if(!I?.length&&!s){const{RpcSchema:p}=await(()=>{try{return z(()=>import("./connectors_false-B0bBwmCt.js"),[])}catch{throw new Error('dependency "porto" not found')}})(),{z:y}=await(()=>{try{return z(()=>import("./connectors_false-BCrRTJi8.js"),[])}catch{throw new Error('dependency "porto/internal" not found')}})(),D=await w.request({method:"wallet_connect",params:[{..."capabilities"in n?{capabilities:y.encode(p.wallet_connect.Capabilities,n.capabilities??{})}:{},chainIds:[j(e),...M.filter(N=>N.id!==e).map(N=>j(N.id))]}]});I=D.accounts,l=Number(D.chainIds[0])}if(!l)throw new A;return g(w)&&(r&&(w.removeListener("connect",r),r=void 0),t||(t=this.onAccountsChanged.bind(this),w.on("accountsChanged",t)),i||(i=this.onChainChanged.bind(this),w.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),w.on("disconnect",c))),{accounts:I.map(p=>typeof p=="object"?d?p:p.address:d?{address:p,capabilities:{}}:p),chainId:l}}catch(p){const y=p;throw y.code===f.code?new f(y):y}},async disconnect(){const e=await this.getProvider();g(e)&&(i&&(e.removeListener("chainChanged",i),i=void 0),c&&(e.removeListener("disconnect",c),c=void 0),r||(r=this.onConnect.bind(this),e.on("connect",r))),await e.request({method:"wallet_disconnect"})},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(s=>C(s))},async getChainId(){const n=await(await this.getProvider()).request({method:"eth_chainId"});return Number(n)},async getPortoInstance(){return o??=(async()=>{const{Porto:e}=await(()=>{try{return z(()=>import("./connectors_false-B0bBwmCt.js"),[])}catch{throw new Error('dependency "porto" not found')}})();return e.create({...u,announceProvider:!1,chains:M,transports:a})})(),await o},async getProvider(){return(await this.getPortoInstance()).provider},icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIyIiBoZWlnaHQ9IjQyMiIgdmlld0JveD0iMCAwIDQyMiA0MjIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI0MjIiIGhlaWdodD0iNDIyIiBmaWxsPSJibGFjayIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfMV8xNSkiPgo8cGF0aCBkPSJNODEgMjg2LjM2NkM4MSAyODAuODkzIDg1LjQ1MDUgMjc2LjQ1NSA5MC45NDA0IDI3Ni40NTVIMzI5LjUxMUMzMzUuMDAxIDI3Ni40NTUgMzM5LjQ1MiAyODAuODkzIDMzOS40NTIgMjg2LjM2NlYzMDYuMTg4QzMzOS40NTIgMzExLjY2MiAzMzUuMDAxIDMxNi4wOTkgMzI5LjUxMSAzMTYuMDk5SDkwLjk0MDRDODUuNDUwNSAzMTYuMDk5IDgxIDMxMS42NjIgODEgMzA2LjE4OFYyODYuMzY2WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC41Ii8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTAuOTQwNCAyMzQuODI4Qzg1LjQ1MDUgMjM0LjgyOCA4MSAyMzkuMjY2IDgxIDI0NC43MzlWMjcxLjUzMUM4My44NDMyIDI2OS42MzMgODcuMjYyMiAyNjguNTI2IDkwLjk0MDQgMjY4LjUyNkgzMjkuNTExQzMzMy4xODggMjY4LjUyNiAzMzYuNjA4IDI2OS42MzMgMzM5LjQ1MiAyNzEuNTMxVjI0NC43MzlDMzM5LjQ1MiAyMzkuMjY2IDMzNS4wMDEgMjM0LjgyOCAzMjkuNTExIDIzNC44MjhIOTAuOTQwNFpNMzM5LjQ1MiAyODYuMzY2QzMzOS40NTIgMjgwLjg5MyAzMzUuMDAxIDI3Ni40NTUgMzI5LjUxMSAyNzYuNDU1SDkwLjk0MDRDODUuNDUwNSAyNzYuNDU1IDgxIDI4MC44OTMgODEgMjg2LjM2NlYzMDYuMTlDODEgMzExLjY2NCA4NS40NTA1IDMxNi4xMDEgOTAuOTQwNCAzMTYuMTAxSDMyOS41MTFDMzM1LjAwMSAzMTYuMTAxIDMzOS40NTIgMzExLjY2NCAzMzkuNDUyIDMwNi4xOVYyODYuMzY2WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC41Ii8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTAuOTQwNCAxOTMuMjAxQzg1LjQ1MDUgMTkzLjIwMSA4MSAxOTcuNjM4IDgxIDIwMy4xMTJWMjI5LjkwM0M4My44NDMyIDIyOC4wMDYgODcuMjYyMiAyMjYuODk5IDkwLjk0MDQgMjI2Ljg5OUgzMjkuNTExQzMzMy4xODggMjI2Ljg5OSAzMzYuNjA4IDIyOC4wMDYgMzM5LjQ1MiAyMjkuOTAzVjIwMy4xMTJDMzM5LjQ1MiAxOTcuNjM4IDMzNS4wMDEgMTkzLjIwMSAzMjkuNTExIDE5My4yMDFIOTAuOTQwNFpNMzM5LjQ1MiAyNDQuNzM5QzMzOS40NTIgMjM5LjI2NSAzMzUuMDAxIDIzNC44MjggMzI5LjUxMSAyMzQuODI4SDkwLjk0MDRDODUuNDUwNSAyMzQuODI4IDgxIDIzOS4yNjUgODEgMjQ0LjczOVYyNzEuNTNDODEuMjE3NSAyNzEuMzg1IDgxLjQzODMgMjcxLjI0NSA4MS42NjI0IDI3MS4xMDlDODMuODMyNSAyNjkuNzk0IDg2LjMwNTQgMjY4LjkyNyA4OC45NTIzIDI2OC42MzVDODkuNjA1MSAyNjguNTYzIDkwLjI2ODQgMjY4LjUyNiA5MC45NDA0IDI2OC41MjZIMzI5LjUxMUMzMzAuMTgzIDI2OC41MjYgMzMwLjg0NiAyNjguNTYzIDMzMS40OTggMjY4LjYzNUMzMzQuNDE5IDI2OC45NTcgMzM3LjEyOCAyNjkuOTggMzM5LjQ1MiAyNzEuNTNWMjQ0LjczOVpNMzM5LjQ1MiAyODYuMzY2QzMzOS40NTIgMjgxLjAyMSAzMzUuMjA2IDI3Ni42NjMgMzI5Ljg5MyAyNzYuNDYyQzMyOS43NjcgMjc2LjQ1NyAzMjkuNjQgMjc2LjQ1NSAzMjkuNTExIDI3Ni40NTVIOTAuOTQwNEM4NS40NTA1IDI3Ni40NTUgODEgMjgwLjg5MyA4MSAyODYuMzY2VjMwNi4xODhDODEgMzExLjY2MiA4NS40NTA1IDMxNi4xMDEgOTAuOTQwNCAzMTYuMTAxSDMyOS41MTFDMzM1LjAwMSAzMTYuMTAxIDMzOS40NTIgMzExLjY2MiAzMzkuNDUyIDMwNi4xODhWMjg2LjM2NloiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNSIvPgo8cGF0aCBvcGFjaXR5PSIwLjMiIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTguMDE0NiAxMDRDODguNjE3NyAxMDQgODEgMTExLjU5NSA4MSAxMjAuOTY1VjE4OC4yNzZDODMuODQzMiAxODYuMzc5IDg3LjI2MjIgMTg1LjI3MiA5MC45NDA0IDE4NS4yNzJIMzI5LjUxMUMzMzMuMTg4IDE4NS4yNzIgMzM2LjYwOCAxODYuMzc5IDMzOS40NTIgMTg4LjI3NlYxMjAuOTY1QzMzOS40NTIgMTExLjU5NSAzMzEuODMzIDEwNCAzMjIuNDM3IDEwNEg5OC4wMTQ2Wk0zMzkuNDUyIDIwMy4xMTJDMzM5LjQ1MiAxOTcuNjM4IDMzNS4wMDEgMTkzLjIwMSAzMjkuNTExIDE5My4yMDFIOTAuOTQwNEM4NS40NTA1IDE5My4yMDEgODEgMTk3LjYzOCA4MSAyMDMuMTEyVjIyOS45MDNDODEuMjE3NSAyMjkuNzU4IDgxLjQzODMgMjI5LjYxOCA4MS42NjI0IDIyOS40ODJDODMuODMyNSAyMjguMTY3IDg2LjMwNTQgMjI3LjMgODguOTUyMyAyMjcuMDA4Qzg5LjYwNTEgMjI2LjkzNiA5MC4yNjg0IDIyNi44OTkgOTAuOTQwNCAyMjYuODk5SDMyOS41MTFDMzMwLjE4MyAyMjYuODk5IDMzMC44NDYgMjI2LjkzNiAzMzEuNDk4IDIyNy4wMDhDMzM0LjQxOSAyMjcuMzMgMzM3LjEyOCAyMjguMzUyIDMzOS40NTIgMjI5LjkwM1YyMDMuMTEyWk0zMzkuNDUyIDI0NC43MzlDMzM5LjQ1MiAyMzkuMzkzIDMzNS4yMDYgMjM1LjAzNiAzMjkuODkzIDIzNC44MzVDMzI5Ljc2NyAyMzQuODMgMzI5LjY0IDIzNC44MjggMzI5LjUxMSAyMzQuODI4SDkwLjk0MDRDODUuNDUwNSAyMzQuODI4IDgxIDIzOS4yNjUgODEgMjQ0LjczOVYyNzEuNTNMODEuMDcwNyAyNzEuNDgzQzgxLjI2NTMgMjcxLjM1NSA4MS40NjI1IDI3MS4yMyA4MS42NjI0IDI3MS4xMDlDODEuOTA4MyAyNzAuOTYgODIuMTU4MSAyNzAuODE3IDgyLjQxMTcgMjcwLjY3OUM4NC4zOTUzIDI2OS42MDUgODYuNjA1NCAyNjguODk0IDg4Ljk1MjMgMjY4LjYzNUM4OS4wMDUyIDI2OC42MjkgODkuMDU4IDI2OC42MjQgODkuMTExIDI2OC42MThDODkuNzEyNSAyNjguNTU3IDkwLjMyMjggMjY4LjUyNiA5MC45NDA0IDI2OC41MjZIMzI5LjUxMUMzMjkuNzM4IDI2OC41MjYgMzI5Ljk2NSAyNjguNTMgMzMwLjE5MiAyNjguNTM5QzMzMC42MzEgMjY4LjU1NSAzMzEuMDY3IDI2OC41ODcgMzMxLjQ5OCAyNjguNjM1QzMzNC40MTkgMjY4Ljk1NyAzMzcuMTI4IDI2OS45OCAzMzkuNDUyIDI3MS41M1YyNDQuNzM5Wk0zMzkuNDUyIDI4Ni4zNjZDMzM5LjQ1MiAyODEuMDIxIDMzNS4yMDYgMjc2LjY2MyAzMjkuODkzIDI3Ni40NjJMMzI5Ljg2NSAyNzYuNDYxQzMyOS43NDggMjc2LjQ1NyAzMjkuNjI5IDI3Ni40NTUgMzI5LjUxMSAyNzYuNDU1SDkwLjk0MDRDODUuNDUwNSAyNzYuNDU1IDgxIDI4MC44OTMgODEgMjg2LjM2NlYzMDYuMTg4QzgxIDMxMS42NjIgODUuNDUwNSAzMTYuMTAxIDkwLjk0MDQgMzE2LjEwMUgzMjkuNTExQzMzNS4wMDEgMzE2LjEwMSAzMzkuNDUyIDMxMS42NjIgMzM5LjQ1MiAzMDYuMTg4VjI4Ni4zNjZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNMjY5Ljg2OCAxMzEuNzUyQzI2OS44NjggMTI2LjI3OCAyNzQuMzE4IDEyMS44NCAyNzkuODA4IDEyMS44NEgzMTEuNjE4QzMxNy4xMDggMTIxLjg0IDMyMS41NTggMTI2LjI3OCAzMjEuNTU4IDEzMS43NTJWMTYxLjQ4NUMzMjEuNTU4IDE2Ni45NTkgMzE3LjEwOCAxNzEuMzk2IDMxMS42MTggMTcxLjM5NkgyNzkuODA4QzI3NC4zMTggMTcxLjM5NiAyNjkuODY4IDE2Ni45NTkgMjY5Ljg2OCAxNjEuNDg1VjEzMS43NTJaIiBmaWxsPSJ3aGl0ZSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzFfMTUiPgo8cmVjdCB3aWR0aD0iMjU5IiBoZWlnaHQ9IjIxMyIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDgxIDEwNCkiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K",id:"xyz.ithaca.porto",async isAuthorized(){try{return!!(await S(()=>this.getAccounts())).length}catch{return!1}},name:"Porto",async onAccountsChanged(e){h.emitter.emit("change",{accounts:e.map(n=>C(n))})},onChainChanged(e){const n=Number(e);h.emitter.emit("change",{chainId:n})},async onConnect(e){const n=await this.getAccounts();if(n.length===0)return;const s=Number(e.chainId);h.emitter.emit("connect",{accounts:n,chainId:s});const d=await this.getProvider();g(d)&&(r&&(d.removeListener("connect",r),r=void 0),t||(t=this.onAccountsChanged.bind(this),d.on("accountsChanged",t)),i||(i=this.onChainChanged.bind(this),d.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),d.on("disconnect",c)))},async onDisconnect(e){const n=await this.getProvider();h.emitter.emit("disconnect"),g(n)&&(i&&(n.removeListener("chainChanged",i),i=void 0),c&&(n.removeListener("disconnect",c),c=void 0),r||(r=this.onConnect.bind(this),n.on("connect",r)))},async setup(){if(!r){const e=await this.getProvider();if(!g(e))return;r=this.onConnect.bind(this),e.on("connect",r)}},async switchChain({chainId:e}){const n=M.find(d=>d.id===e);if(!n)throw new v(new A);return await(await this.getProvider()).request({method:"wallet_switchEthereumChain",params:[{chainId:j(e)}]}),n},type:"injected"}})}Q.type="safe";function Q(u={}){const{shimDisconnect:g=!1}=u;let h,M;return b(a=>({id:"safe",name:"Safe",type:Q.type,async connect({withCapabilities:o}={}){const t=await this.getProvider();if(!t)throw new O;const i=await this.getAccounts(),r=await this.getChainId();return M||(M=this.onDisconnect.bind(this),t.on("disconnect",M)),g&&await a.storage?.removeItem("safe.disconnected"),{accounts:o?i.map(c=>({address:c,capabilities:{}})):i,chainId:r}},async disconnect(){const o=await this.getProvider();if(!o)throw new O;M&&(o.removeListener("disconnect",M),M=void 0),g&&await a.storage?.setItem("safe.disconnected",!0)},async getAccounts(){const o=await this.getProvider();if(!o)throw new O;return(await o.request({method:"eth_accounts"})).map(C)},async getProvider(){if(typeof window<"u"&&window?.parent!==window){if(!h){const{default:t}=await(()=>{try{return z(()=>import("./index-kXKMGszW.js"),__vite__mapDeps([23,24,9,10,4,6,7,3,18]))}catch{throw new Error('dependency "@safe-global/safe-apps-sdk" not found')}})(),i=new t(u),r=await U(()=>i.safe.getInfo(),{timeout:u.unstable_getInfoTimeout??10});if(!r)throw new Error("Could not load Safe information");const c=await(async()=>{const e=await(()=>{try{return z(()=>import("./index-BXAxcybX.js").then(n=>n.i),__vite__mapDeps([25,6,7,24,26]))}catch{throw new Error('dependency "@safe-global/safe-apps-provider" not found')}})();return typeof e.SafeAppProvider!="function"&&typeof e.default.SafeAppProvider=="function"?e.default.SafeAppProvider:e.SafeAppProvider})();h=new c(r,i)}return h}},async getChainId(){const o=await this.getProvider();if(!o)throw new O;return Number(o.chainId)},async isAuthorized(){try{return g&&await a.storage?.getItem("safe.disconnected")?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){a.emitter.emit("disconnect")}}))}const gt="8.0.13";q.type="walletConnect";function q(u){const g=u.isNewChainsStale??!0;let h,M;const a="eip155";let o,t,i,r,c,e;return b(n=>({id:"walletConnect",name:"WalletConnect",type:q.type,async setup(){const s=await this.getProvider().catch(()=>null);s&&(i||(i=this.onConnect.bind(this),s.on("connect",i)),c||(c=this.onSessionDelete.bind(this),s.on("session_delete",c)))},async connect({chainId:s,withCapabilities:d,...I}={}){try{const l=await this.getProvider();if(!l)throw new O;r||(r=this.onDisplayUri,l.on("display_uri",r));let w=s;if(!w){const N=await n.storage?.getItem("state")??{};n.chains.some(L=>L.id===N.chainId)?w=N.chainId:w=n.chains[0]?.id}if(!w)throw new Error("No chains found on connector.");const p=await this.isChainsStale();if(l.session&&p&&await l.disconnect(),!l.session||p){const N=n.chains.filter(m=>m.id!==w).map(m=>m.id);await l.connect({optionalChains:[w,...N],..."pairingTopic"in I?{pairingTopic:I.pairingTopic}:{}}),this.setRequestedChainsIds(n.chains.map(m=>m.id))}const y=(await l.enable()).map(N=>C(N));let D=await this.getChainId();return s&&D!==s&&(D=(await this.switchChain({chainId:s}).catch(m=>{if(m.code===f.code&&m.cause?.message!=="Missing or invalid. request() method: wallet_addEthereumChain")throw m;return{id:D}}))?.id??D),r&&(l.removeListener("display_uri",r),r=void 0),i&&(l.removeListener("connect",i),i=void 0),o||(o=this.onAccountsChanged.bind(this),l.on("accountsChanged",o)),t||(t=this.onChainChanged.bind(this),l.on("chainChanged",t)),e||(e=this.onDisconnect.bind(this),l.on("disconnect",e)),c||(c=this.onSessionDelete.bind(this),l.on("session_delete",c)),{accounts:d?y.map(N=>({address:N,capabilities:{}})):y,chainId:D}}catch(l){throw/(user rejected|connection request reset)/i.test(l?.message)?new f(l):l}},async disconnect(){const s=await this.getProvider();try{await s?.disconnect()}catch(d){if(!/No matching key/i.test(d.message))throw d}finally{t&&(s?.removeListener("chainChanged",t),t=void 0),e&&(s?.removeListener("disconnect",e),e=void 0),i||(i=this.onConnect.bind(this),s?.on("connect",i)),o&&(s?.removeListener("accountsChanged",o),o=void 0),c&&(s?.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(d=>C(d))},async getProvider({chainId:s}={}){async function d(){const I=n.chains.map(w=>w.id);if(!I.length)return;const{EthereumProvider:l}=await(()=>{try{return z(()=>import("./index.es-cEGj7JU0.js").then(w=>w.n),__vite__mapDeps([27,6,7,28,13,21,29,30,14]))}catch{throw new Error('dependency "@walletconnect/ethereum-provider" not found')}})();return await l.init({...u,disableProviderPing:!0,optionalChains:I,projectId:u.projectId,rpcMap:Object.fromEntries(n.chains.map(w=>{const[p]=J({chain:w,transports:n.transports});return[w.id,p]})),showQrModal:u.showQrModal??!0})}return h||(M||(M=d()),h=await M,h?.events.setMaxListeners(Number.POSITIVE_INFINITY)),s&&await this.switchChain?.({chainId:s}),h},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[s,d]=await Promise.all([this.getAccounts(),this.getProvider()]);return s.length?await this.isChainsStale()&&d.session?(await d.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:s,chainId:d}){const I=await this.getProvider();if(!I)throw new O;const l=n.chains.find(p=>p.id===d);if(!l)throw new v(new A);let w=()=>{};try{await Promise.all([new Promise(y=>{w=D=>{D.chainId===d&&(n.emitter.off("change",w),y())},n.emitter.on("change",w)}),I.request({method:"wallet_switchEthereumChain",params:[{chainId:j(d)}]})]);const p=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...p,d]),l}catch(p){n.emitter.off("change",w);const y=p;if(/(user rejected)/i.test(y.message))throw new f(y);try{let D;s?.blockExplorerUrls?D=s.blockExplorerUrls:D=l.blockExplorers?.default.url?[l.blockExplorers?.default.url]:[];let N;s?.rpcUrls?.length?N=s.rpcUrls:N=[...l.rpcUrls.default.http];const m={blockExplorerUrls:D,chainId:j(d),chainName:s?.chainName??l.name,iconUrls:s?.iconUrls,nativeCurrency:s?.nativeCurrency??l.nativeCurrency,rpcUrls:N};await I.request({method:"wallet_addEthereumChain",params:[m]});const L=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...L,d]),l}catch(D){throw new f(D)}}},onAccountsChanged(s){s.length===0?this.onDisconnect():n.emitter.emit("change",{accounts:s.map(d=>C(d))})},onChainChanged(s){const d=Number(s);n.emitter.emit("change",{chainId:d})},async onConnect(s){const d=Number(s.chainId),I=await this.getAccounts();n.emitter.emit("connect",{accounts:I,chainId:d})},async onDisconnect(s){this.setRequestedChainsIds([]),n.emitter.emit("disconnect");const d=await this.getProvider();o&&(d.removeListener("accountsChanged",o),o=void 0),t&&(d.removeListener("chainChanged",t),t=void 0),e&&(d.removeListener("disconnect",e),e=void 0),c&&(d.removeListener("session_delete",c),c=void 0),i||(i=this.onConnect.bind(this),d.on("connect",i))},onDisplayUri(s){n.emitter.emit("message",{type:"display_uri",data:s})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return h?h.session?.namespaces[a]?.accounts?.map(d=>Number.parseInt(d.split(":")[1]||"",10))??[]:[]},async getRequestedChainsIds(){return await n.storage?.getItem(this.requestedChainsStorageKey)??[]},async isChainsStale(){if(!g)return!1;const s=n.chains.map(l=>l.id),d=this.getNamespaceChainsIds();if(d.length&&!d.some(l=>s.includes(l)))return!1;const I=await this.getRequestedChainsIds();return!s.every(l=>I.includes(l))},async setRequestedChainsIds(s){await n.storage?.setItem(this.requestedChainsStorageKey,s)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}}))}export{Mt as baseAccount,Y as coinbaseWallet,It as injected,P as metaMask,_ as mock,lt as porto,Q as safe,ut as tempoWallet,gt as version,q as walletConnect};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-BT0xQ-Xd.js","assets/hooks.module-CpBu4GjP.js","assets/WebCryptoP256-BkRKBE89.js","assets/sha256-D33fGSQc.js","assets/sha2-D3ryOfi3.js","assets/hmac-BMnSt9Ou.js","assets/index-CqbvjyBi.js","assets/index-Bzi38pjx.css","assets/parseSignature-O0fAqZoB.js","assets/parseEventLogs-BxtEI7tW.js","assets/NetworkUtil-DM5H1DOt.js","assets/custom-BbQhcg55.js","assets/W3MFrameProviderSingleton-dGwr0u32.js","assets/index-CYBDya_s.js","assets/browser-ponyfill-LG9Rjmfj.js","assets/localBatchGatewayRequest-DbQn1s0J.js","assets/verifyHash-CX9Livyx.js","assets/secp256k1-TIizaas9.js","assets/hashTypedData-D1Ievn97.js","assets/writeContract-C9KDDivM.js","assets/zoraTestnet-ChmlUfs6.js","assets/index-nibyPLVP.js","assets/index-BCqrDgyR.js","assets/index-DZ0punK7.js","assets/index-H-Ckw-g_.js","assets/index-BE5nQY53.js","assets/native-Ca0o68QA.js","assets/index.es-XXBqJXMm.js","assets/index-DRYOQXZX.js","assets/index-CJdot1dH.js","assets/index.es-DYgSAVrd.js"])))=>i.map(i=>d[i]);
2
+ import{_ as z}from"./index-CqbvjyBi.js";import{c as b,C as A,a as R,P as O}from"./index-Dm7tCcMc.js";import{i as It}from"./index-Dm7tCcMc.js";import{aI as C,aR as W,bg as Z}from"./parseEventLogs-BxtEI7tW.js";import{w as v,ae as j,a4 as k,X as f,t as E,ak as V,r as x}from"./NetworkUtil-DM5H1DOt.js";import{G,w as S,a as U}from"./W3MFrameProviderSingleton-dGwr0u32.js";import{a as B}from"./custom-BbQhcg55.js";import"./index-CYBDya_s.js";import"./browser-ponyfill-LG9Rjmfj.js";import"./store-DOLZnwHk.js";import"./writeContract-C9KDDivM.js";import"./sha256-D33fGSQc.js";import"./sha2-D3ryOfi3.js";function F(u,{body:g,onError:h,onResponse:M}){return u.request({body:g,onError:h,onResponse:M}),u}async function H(u,{body:g,timeout:h=1e4}){return u.requestAsync({body:g,timeout:h})}const T={http(u,g){return G(u).request(g)},webSocket:F,webSocketAsync:H};_.type="mock";function _(u){const g=new Map,h=u.features??{defaultConnected:!1};let M=h.defaultConnected,a;return b(o=>({id:"mock",name:"Mock Connector",type:_.type,async setup(){a=o.chains[0].id},async connect({chainId:t,withCapabilities:i}={}){if(h.connectError)throw typeof h.connectError=="boolean"?new f(new Error("Failed to connect.")):h.connectError;const c=await(await this.getProvider()).request({method:"eth_requestAccounts"});let e=await this.getChainId();return t&&e!==t&&(e=(await this.switchChain({chainId:t})).id),M=!0,{accounts:i?c.map(n=>({address:C(n),capabilities:{foo:{bar:n}}})):c.map(n=>C(n)),chainId:e}},async disconnect(){M=!1},async getAccounts(){if(!M)throw new R;return(await(await this.getProvider()).request({method:"eth_accounts"})).map(r=>C(r))},async getChainId(){const i=await(await this.getProvider()).request({method:"eth_chainId"});return k(i,"number")},async isAuthorized(){return!h.reconnect||!M?!1:!!(await this.getAccounts()).length},async switchChain({chainId:t}){const i=await this.getProvider(),r=o.chains.find(c=>c.id===t);if(!r)throw new v(new A);return await i.request({method:"wallet_switchEthereumChain",params:[{chainId:j(t)}]}),r},onAccountsChanged(t){t.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:t.map(i=>C(i))})},onChainChanged(t){const i=Number(t);o.emitter.emit("change",{chainId:i})},async onDisconnect(t){o.emitter.emit("disconnect"),M=!1},async getProvider({chainId:t}={}){const r=(o.chains.find(e=>e.id===t)??o.chains[0]).rpcUrls.default.http[0];return B({request:async({method:e,params:n})=>{if(e==="eth_chainId")return j(a);if(e==="eth_accounts"||e==="eth_requestAccounts")return u.accounts;if(e==="eth_signTypedData_v4"&&h.signTypedDataError)throw typeof h.signTypedDataError=="boolean"?new f(new Error("Failed to sign typed data.")):h.signTypedDataError;if(e==="wallet_switchEthereumChain"){if(h.switchChainError)throw typeof h.switchChainError=="boolean"?new f(new Error("Failed to switch chain.")):h.switchChainError;a=k(n[0].chainId,"number"),this.onChainChanged(a.toString());return}if(e==="wallet_watchAsset"){if(h.watchAssetError)throw typeof h.watchAssetError=="boolean"?new f(new Error("Failed to switch chain.")):h.watchAssetError;return M}if(e==="wallet_getCapabilities")return{"0x2105":{paymasterService:{supported:n[0]==="0x95132632579b073D12a6673e18Ab05777a6B86f8"},sessionKeys:{supported:!0}},"0x14A34":{paymasterService:{supported:n[0]==="0x95132632579b073D12a6673e18Ab05777a6B86f8"}}};if(e==="wallet_sendCalls"){const l=[],w=n[0].calls,p=n[0].from;for(const D of w){const{result:N,error:m}=await T.http(r,{body:{method:"eth_sendTransaction",params:[{...D,...typeof p<"u"?{from:p}:{}}]}});if(m)throw new E({body:{method:e,params:n},error:m,url:r});l.push(N)}const y=W(V(JSON.stringify(w)));return g.set(y,l),{id:y}}if(e==="wallet_getCallsStatus"){const l=g.get(n[0]);if(!l)return{atomic:!1,chainId:"0x1",id:n[0],status:100,receipts:[],version:"2.0.0"};const p=(await Promise.all(l.map(async y=>{const{result:D,error:N}=await T.http(r,{body:{method:"eth_getTransactionReceipt",params:[y],id:0}});if(N)throw new E({body:{method:e,params:n},error:N,url:r});return D?{blockHash:D.blockHash,blockNumber:D.blockNumber,gasUsed:D.gasUsed,logs:D.logs,status:D.status,transactionHash:D.transactionHash}:null}))).filter(y=>y!==null);return p.length===0?{atomic:!1,chainId:"0x1",id:n[0],status:100,receipts:[],version:"2.0.0"}:{atomic:!1,chainId:"0x1",id:n[0],status:200,receipts:p,version:"2.0.0"}}if(e==="wallet_showCallsStatus")return;if(e==="personal_sign"){if(h.signMessageError)throw typeof h.signMessageError=="boolean"?new f(new Error("Failed to sign message.")):h.signMessageError;e="eth_sign",n=[n[1],n[0]]}const s={method:e,params:n},{error:d,result:I}=await T.http(r,{body:s});if(d)throw new E({body:s,error:d,url:r});return I}})({retryCount:0})}}))}function J(u){const{chain:g}=u,h=g.rpcUrls.default.http[0];if(!u.transports)return[h];const M=u.transports?.[g.id]?.({chain:g});return(M?.value?.transports||[M]).map(({value:o})=>o?.url||h)}const K='data:image/svg+xml,<svg width="269" height="269" viewBox="0 0 269 269" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="269" height="269" fill="black"/><path d="M123.273 190.794H93.445L121.09 105.318H85.7334L93.445 80.2642H191.95L184.238 105.318H150.773L123.273 190.794Z" fill="white"/></svg>';function ut(u={}){const{dialog:g,host:h,icon:M=K,name:a,rdns:o,theme:t,...i}=u;return X({createAdapter(r){return r.dialog({dialog:g,host:h,icon:M,name:a,rdns:o,theme:t})},icon:M,id:o??"xyz.tempo",name:a??"Tempo Wallet",providerParameters:i,rdns:o??"xyz.tempo",type:"injected"})}function X(u){return b(g=>{const h=g.chains;let M,a,o,t,i;async function r(){return await z(()=>import("./core_false-CNabe580.js"),[]).catch(()=>{throw new Error('dependency "accounts" not found')})}async function c(){return M??=(async()=>{const e=await r();return e.Provider.create({...u.providerParameters,adapter:u.createAdapter(e),chains:g.chains,transports:g.transports})})(),await M}return{icon:u.icon,id:u.id,name:u.name,rdns:u.rdns,type:u.type,async connect(e={}){const{chainId:n,isReconnecting:s,withCapabilities:d}=e,I="capabilities"in e?e.capabilities:void 0;let l=[],w;s&&(l=await this.getAccounts().then(p=>p.map(y=>({address:y,capabilities:{}}))).catch(()=>[]));try{if(!l.length&&!s&&(l=(await(await c()).request({method:"wallet_connect",params:[{...n?{chainId:n}:{},...I?{capabilities:I}:{}}]})).accounts),w??=await this.getChainId(),!w)throw new A;const p=await c();return t&&(p.removeListener("connect",t),t=void 0),a||(a=this.onAccountsChanged.bind(this),p.on("accountsChanged",a)),o||(o=this.onChainChanged.bind(this),p.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),p.on("disconnect",i)),{accounts:d?l:l.map(y=>y.address),chainId:w}}catch(p){const y=p;throw y.code===f.code?new f(y):y}},async disconnect(){const e=await c();o&&(e.removeListener("chainChanged",o),o=void 0),i&&(e.removeListener("disconnect",i),i=void 0),t||(t=this.onConnect?.bind(this),t&&e.on("connect",t)),await e.request({method:"wallet_disconnect"})},async getAccounts(){return await(await c()).request({method:"eth_accounts"})},async getChainId(){const e=await c();return Number(await e.request({method:"eth_chainId"}))},async getClient({chainId:e}={}){const n=await c(),{address:s}=n.getAccount({accessKey:!1});return Object.assign(n.getClient({chainId:e}),{account:Z(s)})},async getProvider(){return await c()},async isAuthorized(){try{return!!(await S(()=>this.getAccounts())).length}catch{return!1}},onAccountsChanged(e){g.emitter.emit("change",{accounts:e})},onChainChanged(e){g.emitter.emit("change",{chainId:Number(e)})},async onConnect(e){const n=await this.getAccounts();if(n.length===0)return;const s=Number(e.chainId);g.emitter.emit("connect",{accounts:n,chainId:s});const d=await c();t&&(d.removeListener("connect",t),t=void 0),a||(a=this.onAccountsChanged.bind(this),d.on("accountsChanged",a)),o||(o=this.onChainChanged.bind(this),d.on("chainChanged",o)),i||(i=this.onDisconnect.bind(this),d.on("disconnect",i))},async onDisconnect(e){const n=await c();g.emitter.emit("disconnect"),o&&(n.removeListener("chainChanged",o),o=void 0),i&&(n.removeListener("disconnect",i),i=void 0),t||(t=this.onConnect?.bind(this),t&&n.on("connect",t))},async setup(){if(!t){const e=await c();t=this.onConnect?.bind(this),t&&e.on("connect",t)}},async switchChain({chainId:e}){const n=h.find(d=>d.id===e);if(!n)throw new v(new A);return await(await c()).request({method:"wallet_switchEthereumChain",params:[{chainId:j(e)}]}),n}}})}function Mt(u={}){let g,h,M,a;return b(o=>({id:"baseAccount",name:"Base Account",rdns:"app.base.account",type:"baseAccount",async connect({chainId:t,withCapabilities:i,...r}={}){try{const c=await this.getProvider(),e=t??o.chains[0]?.id;if(!e)throw new A;let{accounts:n,currentChainId:s}=await(async()=>{if(r.isReconnecting)return{accounts:(await c.request({method:"eth_accounts",params:[]})).map(w=>({address:C(w)})),currentChainId:await this.getChainId()};const d=await c.request({method:"wallet_connect",params:[{capabilities:"capabilities"in r&&r.capabilities?r.capabilities:{},chainIds:[j(e),...o.chains.filter(w=>w.id!==e).map(w=>j(w.id))]}]});return{accounts:(await c.request({method:"eth_accounts"})).map(w=>d.accounts.find(p=>p.address===w)??{address:w}).map(w=>({address:C(w.address),capabilities:w.capabilities??{}})),currentChainId:Number(d.chainIds[0])}})();return h||(h=this.onAccountsChanged.bind(this),c.on("accountsChanged",h)),M||(M=this.onChainChanged.bind(this),c.on("chainChanged",M)),a||(a=this.onDisconnect.bind(this),c.on("disconnect",a)),t&&s!==t&&(s=(await this.switchChain({chainId:t}).catch(I=>{if(I.code===f.code)throw I;return{id:s}}))?.id??s),{accounts:i?n:n.map(d=>d.address),chainId:s}}catch(c){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message)?new f(c):c}},async disconnect(){const t=await this.getProvider();h&&(t.removeListener("accountsChanged",h),h=void 0),M&&(t.removeListener("chainChanged",M),M=void 0),a&&(t.removeListener("disconnect",a),a=void 0),t.disconnect()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(i=>C(i))},async getChainId(){const i=await(await this.getProvider()).request({method:"eth_chainId"});return Number(i)},async getProvider(){if(!g){const t=typeof u.preference=="string"?{options:u.preference}:{...u.preference,options:u.preference?.options??"all"},{createBaseAccountSDK:i}=await(()=>{try{return z(()=>import("./index-BT0xQ-Xd.js"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]))}catch{throw new Error('dependency "@base-org/account" not found')}})();g=i({...u,appChainIds:o.chains.map(c=>c.id),preference:t}).getProvider()}return g},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:t,chainId:i}){const r=o.chains.find(e=>e.id===i);if(!r)throw new v(new A);const c=await this.getProvider();try{return await c.request({method:"wallet_switchEthereumChain",params:[{chainId:j(r.id)}]}),r}catch(e){if(e.code===4902)try{let n;t?.blockExplorerUrls?n=t.blockExplorerUrls:n=r.blockExplorers?.default.url?[r.blockExplorers?.default.url]:[];let s;t?.rpcUrls?.length?s=t.rpcUrls:s=[r.rpcUrls.default?.http[0]??""];const d={blockExplorerUrls:n,chainId:j(i),chainName:t?.chainName??r.name,iconUrls:t?.iconUrls,nativeCurrency:t?.nativeCurrency??r.nativeCurrency,rpcUrls:s};return await c.request({method:"wallet_addEthereumChain",params:[d]}),r}catch(n){throw new f(n)}throw new v(e)}},onAccountsChanged(t){t.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:t.map(i=>C(i))})},onChainChanged(t){const i=Number(t);o.emitter.emit("change",{chainId:i})},async onDisconnect(t){o.emitter.emit("disconnect");const i=await this.getProvider();h&&(i.removeListener("accountsChanged",h),h=void 0),M&&(i.removeListener("chainChanged",M),M=void 0),a&&(i.removeListener("disconnect",a),a=void 0)}}))}Y.type="coinbaseWallet";function Y(u={}){let g,h,M,a;return b(o=>({id:"coinbaseWalletSDK",name:"Coinbase Wallet",rdns:"com.coinbase.wallet",type:Y.type,async connect({chainId:t,withCapabilities:i,...r}={}){try{const c=await this.getProvider(),e=(await c.request({method:"eth_requestAccounts",params:"instantOnboarding"in r&&r.instantOnboarding?[{onboarding:"instant"}]:[]})).map(s=>C(s));h||(h=this.onAccountsChanged.bind(this),c.on("accountsChanged",h)),M||(M=this.onChainChanged.bind(this),c.on("chainChanged",M)),a||(a=this.onDisconnect.bind(this),c.on("disconnect",a));let n=await this.getChainId();return t&&n!==t&&(n=(await this.switchChain({chainId:t}).catch(d=>{if(d.code===f.code)throw d;return{id:n}}))?.id??n),{accounts:i?e.map(s=>({address:s,capabilities:{}})):e,chainId:n}}catch(c){throw/(user closed modal|accounts received is empty|user denied account|request rejected)/i.test(c.message)?new f(c):c}},async disconnect(){const t=await this.getProvider();h&&(t.removeListener("accountsChanged",h),h=void 0),M&&(t.removeListener("chainChanged",M),M=void 0),a&&(t.removeListener("disconnect",a),a=void 0),t.disconnect(),t.close?.()},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(i=>C(i))},async getChainId(){const i=await(await this.getProvider()).request({method:"eth_chainId"});return Number(i)},async getProvider(){if(!g){const{createCoinbaseWalletSDK:t}=await(()=>{try{return z(()=>import("./index-BCqrDgyR.js").then(r=>r.i),__vite__mapDeps([22,6,7,1]))}catch{throw new Error('dependency "@coinbase/wallet-sdk" not found')}})();g=t({...u,appChainIds:o.chains.map(r=>r.id),preference:{options:"all",...u.preference??{}}}).getProvider()}return g},async isAuthorized(){try{return!!(await this.getAccounts()).length}catch{return!1}},async switchChain({addEthereumChainParameter:t,chainId:i}){const r=o.chains.find(e=>e.id===i);if(!r)throw new v(new A);const c=await this.getProvider();try{return await c.request({method:"wallet_switchEthereumChain",params:[{chainId:j(r.id)}]}),r}catch(e){if(e.code===4902)try{let n;t?.blockExplorerUrls?n=t.blockExplorerUrls:n=r.blockExplorers?.default.url?[r.blockExplorers?.default.url]:[];let s;t?.rpcUrls?.length?s=t.rpcUrls:s=[r.rpcUrls.default?.http[0]??""];const d={blockExplorerUrls:n,chainId:j(i),chainName:t?.chainName??r.name,iconUrls:t?.iconUrls,nativeCurrency:t?.nativeCurrency??r.nativeCurrency,rpcUrls:s};return await c.request({method:"wallet_addEthereumChain",params:[d]}),r}catch(n){throw new f(n)}throw new v(e)}},onAccountsChanged(t){t.length===0?this.onDisconnect():o.emitter.emit("change",{accounts:t.map(i=>C(i))})},onChainChanged(t){const i=Number(t);o.emitter.emit("change",{chainId:i})},async onDisconnect(t){o.emitter.emit("disconnect");const i=await this.getProvider();h&&(i.removeListener("accountsChanged",h),h=void 0),M&&(i.removeListener("chainChanged",M),M=void 0),a&&(i.removeListener("disconnect",a),a=void 0)}}))}P.type="metaMask";function P(u={}){let g,h;return b(M=>({id:"metaMaskSDK",name:"MetaMask",rdns:["io.metamask","io.metamask.mobile"],type:P.type,async connect({chainId:a,isReconnecting:o,withCapabilities:t}={}){const i=await this.getInstance(),r=i.getProvider();let c=[];o&&(c=await this.getAccounts().catch(()=>[]));try{let e,n;if(!c?.length){const d=M.chains.map(I=>j(I.id));u.connectAndSign||u.connectWith?(u.connectAndSign?e=(await i.connectAndSign({chainIds:d,message:u.connectAndSign})).signature:u.connectWith&&(n=(await i.connectWith({chainIds:d,method:u.connectWith.method,params:u.connectWith.params})).result),c=await this.getAccounts()):c=(await i.connect({chainIds:d})).accounts.map(l=>C(l))}let s=await this.getChainId();return a&&s!==a&&(s=(await this.switchChain({chainId:a}).catch(I=>{if(I.code===f.code)throw I;return{id:s}}))?.id??s),e?r.emit("connectAndSign",{accounts:c,chainId:j(s),signResponse:e}):n&&r.emit("connectWith",{accounts:c,chainId:j(s),connectWithResponse:n}),{accounts:t?c.map(d=>({address:d,capabilities:{}})):c,chainId:s}}catch(e){const n=e;throw n.code===f.code?new f(n):n.code===x.code?new x(n):n}},async disconnect(){return(await this.getInstance()).disconnect()},async getAccounts(){const a=await this.getInstance();return a.accounts.length?a.accounts.map(i=>C(i)):(await a.getProvider().request({method:"eth_accounts"})).map(i=>C(i))},async getChainId(){const a=await this.getInstance();if(a.getChainId())return Number(a.getChainId());const t=await a.getProvider().request({method:"eth_chainId"});return Number(t)},async getProvider(){return(await this.getInstance()).getProvider()},async isAuthorized(){try{return!!(await S(async()=>U(async()=>{const t=await this.getAccounts();if(!t.length)throw new Error("try again");return t},{timeout:10}),{delay:11,retryCount:3})).length}catch{return!1}},async switchChain({addEthereumChainParameter:a,chainId:o}){const t=M.chains.find(({id:r})=>r===Number(o));if(!t)throw new v(new A);const i=j(o);try{return await(await this.getInstance()).switchChain({chainId:i,chainConfiguration:{blockExplorerUrls:a?.blockExplorerUrls?[...a.blockExplorerUrls]:t.blockExplorers?.default.url?[t.blockExplorers.default.url]:void 0,chainId:i,chainName:a?.chainName??t.name,iconUrls:a?.iconUrls,nativeCurrency:a?.nativeCurrency??t.nativeCurrency,rpcUrls:a?.rpcUrls?[...a.rpcUrls]:t.rpcUrls.default?.http?[...t.rpcUrls.default.http]:void 0}}),t}catch(r){const c=r;throw c.code===f.code?new f(c):new v(c)}},async onAccountsChanged(a){M.emitter.emit("change",{accounts:a.map(o=>C(o))})},onChainChanged(a){const o=Number(a);M.emitter.emit("change",{chainId:o})},async onConnect(a){const o=await this.getAccounts();if(o.length===0)return;const t=Number(a.chainId);M.emitter.emit("connect",{accounts:o,chainId:t})},async onDisconnect(a){a&&a.code===1013&&await this.getProvider()&&(await this.getAccounts()).length||M.emitter.emit("disconnect")},onDisplayUri(a){M.emitter.emit("message",{type:"display_uri",data:a})},async getInstance(){if(!g){if(!h){const{createEVMClient:a}=await(async()=>{try{return z(()=>import("./connectors_false-DqI1AxGN.js"),[])}catch{throw new Error('dependency "@metamask/connect-evm" not found')}})(),o=typeof window>"u"?{name:"wagmi"}:{name:window.location.hostname,url:window.location.href};h=a({...u,api:{supportedNetworks:Object.fromEntries(M.chains.map(t=>[j(t.id),t.rpcUrls.default?.http[0]??""]))},dapp:u.dapp??{...o,...u.dappMetadata},debug:u.debug??u.logging?.sdk,eventHandlers:{accountsChanged:this.onAccountsChanged.bind(this),chainChanged:this.onChainChanged.bind(this),connect:this.onConnect.bind(this),disconnect:this.onDisconnect.bind(this),displayUri:this.onDisplayUri.bind(this)},analytics:{integrationType:"wagmi"},ui:{...u.ui,...u.headless!=null&&{headless:u.headless}},...u.mobile&&{mobile:u.mobile}})}g=await h}return g}}))}function lt(u={}){const g=h=>typeof h.on=="function"&&typeof h.removeListener=="function";return b(h=>{const M=h.chains??u.chains??[],a=h.transports?h.transports:u.transports;let o,t,i,r,c;return{async connect({chainId:e=M[0].id,...n}={}){const s="isReconnecting"in n&&n.isReconnecting||!1,d="withCapabilities"in n&&n.withCapabilities||!1;let I=[],l;s&&([I,l]=await Promise.all([this.getAccounts().catch(()=>[]),this.getChainId().catch(()=>{})]),e&&l!==e&&(l=(await this.switchChain({chainId:e}).catch(y=>{if(y.code===f.code)throw y;return{id:l}}))?.id??l));const w=await this.getProvider();try{if(!I?.length&&!s){const{RpcSchema:p}=await(()=>{try{return z(()=>import("./connectors_false-B0bBwmCt.js"),[])}catch{throw new Error('dependency "porto" not found')}})(),{z:y}=await(()=>{try{return z(()=>import("./connectors_false-BCrRTJi8.js"),[])}catch{throw new Error('dependency "porto/internal" not found')}})(),D=await w.request({method:"wallet_connect",params:[{..."capabilities"in n?{capabilities:y.encode(p.wallet_connect.Capabilities,n.capabilities??{})}:{},chainIds:[j(e),...M.filter(N=>N.id!==e).map(N=>j(N.id))]}]});I=D.accounts,l=Number(D.chainIds[0])}if(!l)throw new A;return g(w)&&(r&&(w.removeListener("connect",r),r=void 0),t||(t=this.onAccountsChanged.bind(this),w.on("accountsChanged",t)),i||(i=this.onChainChanged.bind(this),w.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),w.on("disconnect",c))),{accounts:I.map(p=>typeof p=="object"?d?p:p.address:d?{address:p,capabilities:{}}:p),chainId:l}}catch(p){const y=p;throw y.code===f.code?new f(y):y}},async disconnect(){const e=await this.getProvider();g(e)&&(i&&(e.removeListener("chainChanged",i),i=void 0),c&&(e.removeListener("disconnect",c),c=void 0),r||(r=this.onConnect.bind(this),e.on("connect",r))),await e.request({method:"wallet_disconnect"})},async getAccounts(){return(await(await this.getProvider()).request({method:"eth_accounts"})).map(s=>C(s))},async getChainId(){const n=await(await this.getProvider()).request({method:"eth_chainId"});return Number(n)},async getPortoInstance(){return o??=(async()=>{const{Porto:e}=await(()=>{try{return z(()=>import("./connectors_false-B0bBwmCt.js"),[])}catch{throw new Error('dependency "porto" not found')}})();return e.create({...u,announceProvider:!1,chains:M,transports:a})})(),await o},async getProvider(){return(await this.getPortoInstance()).provider},icon:"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNDIyIiBoZWlnaHQ9IjQyMiIgdmlld0JveD0iMCAwIDQyMiA0MjIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+CjxyZWN0IHdpZHRoPSI0MjIiIGhlaWdodD0iNDIyIiBmaWxsPSJibGFjayIvPgo8ZyBjbGlwLXBhdGg9InVybCgjY2xpcDBfMV8xNSkiPgo8cGF0aCBkPSJNODEgMjg2LjM2NkM4MSAyODAuODkzIDg1LjQ1MDUgMjc2LjQ1NSA5MC45NDA0IDI3Ni40NTVIMzI5LjUxMUMzMzUuMDAxIDI3Ni40NTUgMzM5LjQ1MiAyODAuODkzIDMzOS40NTIgMjg2LjM2NlYzMDYuMTg4QzMzOS40NTIgMzExLjY2MiAzMzUuMDAxIDMxNi4wOTkgMzI5LjUxMSAzMTYuMDk5SDkwLjk0MDRDODUuNDUwNSAzMTYuMDk5IDgxIDMxMS42NjIgODEgMzA2LjE4OFYyODYuMzY2WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC41Ii8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTAuOTQwNCAyMzQuODI4Qzg1LjQ1MDUgMjM0LjgyOCA4MSAyMzkuMjY2IDgxIDI0NC43MzlWMjcxLjUzMUM4My44NDMyIDI2OS42MzMgODcuMjYyMiAyNjguNTI2IDkwLjk0MDQgMjY4LjUyNkgzMjkuNTExQzMzMy4xODggMjY4LjUyNiAzMzYuNjA4IDI2OS42MzMgMzM5LjQ1MiAyNzEuNTMxVjI0NC43MzlDMzM5LjQ1MiAyMzkuMjY2IDMzNS4wMDEgMjM0LjgyOCAzMjkuNTExIDIzNC44MjhIOTAuOTQwNFpNMzM5LjQ1MiAyODYuMzY2QzMzOS40NTIgMjgwLjg5MyAzMzUuMDAxIDI3Ni40NTUgMzI5LjUxMSAyNzYuNDU1SDkwLjk0MDRDODUuNDUwNSAyNzYuNDU1IDgxIDI4MC44OTMgODEgMjg2LjM2NlYzMDYuMTlDODEgMzExLjY2NCA4NS40NTA1IDMxNi4xMDEgOTAuOTQwNCAzMTYuMTAxSDMyOS41MTFDMzM1LjAwMSAzMTYuMTAxIDMzOS40NTIgMzExLjY2NCAzMzkuNDUyIDMwNi4xOVYyODYuMzY2WiIgZmlsbD0id2hpdGUiIGZpbGwtb3BhY2l0eT0iMC41Ii8+CjxwYXRoIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTAuOTQwNCAxOTMuMjAxQzg1LjQ1MDUgMTkzLjIwMSA4MSAxOTcuNjM4IDgxIDIwMy4xMTJWMjI5LjkwM0M4My44NDMyIDIyOC4wMDYgODcuMjYyMiAyMjYuODk5IDkwLjk0MDQgMjI2Ljg5OUgzMjkuNTExQzMzMy4xODggMjI2Ljg5OSAzMzYuNjA4IDIyOC4wMDYgMzM5LjQ1MiAyMjkuOTAzVjIwMy4xMTJDMzM5LjQ1MiAxOTcuNjM4IDMzNS4wMDEgMTkzLjIwMSAzMjkuNTExIDE5My4yMDFIOTAuOTQwNFpNMzM5LjQ1MiAyNDQuNzM5QzMzOS40NTIgMjM5LjI2NSAzMzUuMDAxIDIzNC44MjggMzI5LjUxMSAyMzQuODI4SDkwLjk0MDRDODUuNDUwNSAyMzQuODI4IDgxIDIzOS4yNjUgODEgMjQ0LjczOVYyNzEuNTNDODEuMjE3NSAyNzEuMzg1IDgxLjQzODMgMjcxLjI0NSA4MS42NjI0IDI3MS4xMDlDODMuODMyNSAyNjkuNzk0IDg2LjMwNTQgMjY4LjkyNyA4OC45NTIzIDI2OC42MzVDODkuNjA1MSAyNjguNTYzIDkwLjI2ODQgMjY4LjUyNiA5MC45NDA0IDI2OC41MjZIMzI5LjUxMUMzMzAuMTgzIDI2OC41MjYgMzMwLjg0NiAyNjguNTYzIDMzMS40OTggMjY4LjYzNUMzMzQuNDE5IDI2OC45NTcgMzM3LjEyOCAyNjkuOTggMzM5LjQ1MiAyNzEuNTNWMjQ0LjczOVpNMzM5LjQ1MiAyODYuMzY2QzMzOS40NTIgMjgxLjAyMSAzMzUuMjA2IDI3Ni42NjMgMzI5Ljg5MyAyNzYuNDYyQzMyOS43NjcgMjc2LjQ1NyAzMjkuNjQgMjc2LjQ1NSAzMjkuNTExIDI3Ni40NTVIOTAuOTQwNEM4NS40NTA1IDI3Ni40NTUgODEgMjgwLjg5MyA4MSAyODYuMzY2VjMwNi4xODhDODEgMzExLjY2MiA4NS40NTA1IDMxNi4xMDEgOTAuOTQwNCAzMTYuMTAxSDMyOS41MTFDMzM1LjAwMSAzMTYuMTAxIDMzOS40NTIgMzExLjY2MiAzMzkuNDUyIDMwNi4xODhWMjg2LjM2NloiIGZpbGw9IndoaXRlIiBmaWxsLW9wYWNpdHk9IjAuNSIvPgo8cGF0aCBvcGFjaXR5PSIwLjMiIGZpbGwtcnVsZT0iZXZlbm9kZCIgY2xpcC1ydWxlPSJldmVub2RkIiBkPSJNOTguMDE0NiAxMDRDODguNjE3NyAxMDQgODEgMTExLjU5NSA4MSAxMjAuOTY1VjE4OC4yNzZDODMuODQzMiAxODYuMzc5IDg3LjI2MjIgMTg1LjI3MiA5MC45NDA0IDE4NS4yNzJIMzI5LjUxMUMzMzMuMTg4IDE4NS4yNzIgMzM2LjYwOCAxODYuMzc5IDMzOS40NTIgMTg4LjI3NlYxMjAuOTY1QzMzOS40NTIgMTExLjU5NSAzMzEuODMzIDEwNCAzMjIuNDM3IDEwNEg5OC4wMTQ2Wk0zMzkuNDUyIDIwMy4xMTJDMzM5LjQ1MiAxOTcuNjM4IDMzNS4wMDEgMTkzLjIwMSAzMjkuNTExIDE5My4yMDFIOTAuOTQwNEM4NS40NTA1IDE5My4yMDEgODEgMTk3LjYzOCA4MSAyMDMuMTEyVjIyOS45MDNDODEuMjE3NSAyMjkuNzU4IDgxLjQzODMgMjI5LjYxOCA4MS42NjI0IDIyOS40ODJDODMuODMyNSAyMjguMTY3IDg2LjMwNTQgMjI3LjMgODguOTUyMyAyMjcuMDA4Qzg5LjYwNTEgMjI2LjkzNiA5MC4yNjg0IDIyNi44OTkgOTAuOTQwNCAyMjYuODk5SDMyOS41MTFDMzMwLjE4MyAyMjYuODk5IDMzMC44NDYgMjI2LjkzNiAzMzEuNDk4IDIyNy4wMDhDMzM0LjQxOSAyMjcuMzMgMzM3LjEyOCAyMjguMzUyIDMzOS40NTIgMjI5LjkwM1YyMDMuMTEyWk0zMzkuNDUyIDI0NC43MzlDMzM5LjQ1MiAyMzkuMzkzIDMzNS4yMDYgMjM1LjAzNiAzMjkuODkzIDIzNC44MzVDMzI5Ljc2NyAyMzQuODMgMzI5LjY0IDIzNC44MjggMzI5LjUxMSAyMzQuODI4SDkwLjk0MDRDODUuNDUwNSAyMzQuODI4IDgxIDIzOS4yNjUgODEgMjQ0LjczOVYyNzEuNTNMODEuMDcwNyAyNzEuNDgzQzgxLjI2NTMgMjcxLjM1NSA4MS40NjI1IDI3MS4yMyA4MS42NjI0IDI3MS4xMDlDODEuOTA4MyAyNzAuOTYgODIuMTU4MSAyNzAuODE3IDgyLjQxMTcgMjcwLjY3OUM4NC4zOTUzIDI2OS42MDUgODYuNjA1NCAyNjguODk0IDg4Ljk1MjMgMjY4LjYzNUM4OS4wMDUyIDI2OC42MjkgODkuMDU4IDI2OC42MjQgODkuMTExIDI2OC42MThDODkuNzEyNSAyNjguNTU3IDkwLjMyMjggMjY4LjUyNiA5MC45NDA0IDI2OC41MjZIMzI5LjUxMUMzMjkuNzM4IDI2OC41MjYgMzI5Ljk2NSAyNjguNTMgMzMwLjE5MiAyNjguNTM5QzMzMC42MzEgMjY4LjU1NSAzMzEuMDY3IDI2OC41ODcgMzMxLjQ5OCAyNjguNjM1QzMzNC40MTkgMjY4Ljk1NyAzMzcuMTI4IDI2OS45OCAzMzkuNDUyIDI3MS41M1YyNDQuNzM5Wk0zMzkuNDUyIDI4Ni4zNjZDMzM5LjQ1MiAyODEuMDIxIDMzNS4yMDYgMjc2LjY2MyAzMjkuODkzIDI3Ni40NjJMMzI5Ljg2NSAyNzYuNDYxQzMyOS43NDggMjc2LjQ1NyAzMjkuNjI5IDI3Ni40NTUgMzI5LjUxMSAyNzYuNDU1SDkwLjk0MDRDODUuNDUwNSAyNzYuNDU1IDgxIDI4MC44OTMgODEgMjg2LjM2NlYzMDYuMTg4QzgxIDMxMS42NjIgODUuNDUwNSAzMTYuMTAxIDkwLjk0MDQgMzE2LjEwMUgzMjkuNTExQzMzNS4wMDEgMzE2LjEwMSAzMzkuNDUyIDMxMS42NjIgMzM5LjQ1MiAzMDYuMTg4VjI4Ni4zNjZaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNMjY5Ljg2OCAxMzEuNzUyQzI2OS44NjggMTI2LjI3OCAyNzQuMzE4IDEyMS44NCAyNzkuODA4IDEyMS44NEgzMTEuNjE4QzMxNy4xMDggMTIxLjg0IDMyMS41NTggMTI2LjI3OCAzMjEuNTU4IDEzMS43NTJWMTYxLjQ4NUMzMjEuNTU4IDE2Ni45NTkgMzE3LjEwOCAxNzEuMzk2IDMxMS42MTggMTcxLjM5NkgyNzkuODA4QzI3NC4zMTggMTcxLjM5NiAyNjkuODY4IDE2Ni45NTkgMjY5Ljg2OCAxNjEuNDg1VjEzMS43NTJaIiBmaWxsPSJ3aGl0ZSIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzFfMTUiPgo8cmVjdCB3aWR0aD0iMjU5IiBoZWlnaHQ9IjIxMyIgZmlsbD0id2hpdGUiIHRyYW5zZm9ybT0idHJhbnNsYXRlKDgxIDEwNCkiLz4KPC9jbGlwUGF0aD4KPC9kZWZzPgo8L3N2Zz4K",id:"xyz.ithaca.porto",async isAuthorized(){try{return!!(await S(()=>this.getAccounts())).length}catch{return!1}},name:"Porto",async onAccountsChanged(e){h.emitter.emit("change",{accounts:e.map(n=>C(n))})},onChainChanged(e){const n=Number(e);h.emitter.emit("change",{chainId:n})},async onConnect(e){const n=await this.getAccounts();if(n.length===0)return;const s=Number(e.chainId);h.emitter.emit("connect",{accounts:n,chainId:s});const d=await this.getProvider();g(d)&&(r&&(d.removeListener("connect",r),r=void 0),t||(t=this.onAccountsChanged.bind(this),d.on("accountsChanged",t)),i||(i=this.onChainChanged.bind(this),d.on("chainChanged",i)),c||(c=this.onDisconnect.bind(this),d.on("disconnect",c)))},async onDisconnect(e){const n=await this.getProvider();h.emitter.emit("disconnect"),g(n)&&(i&&(n.removeListener("chainChanged",i),i=void 0),c&&(n.removeListener("disconnect",c),c=void 0),r||(r=this.onConnect.bind(this),n.on("connect",r)))},async setup(){if(!r){const e=await this.getProvider();if(!g(e))return;r=this.onConnect.bind(this),e.on("connect",r)}},async switchChain({chainId:e}){const n=M.find(d=>d.id===e);if(!n)throw new v(new A);return await(await this.getProvider()).request({method:"wallet_switchEthereumChain",params:[{chainId:j(e)}]}),n},type:"injected"}})}Q.type="safe";function Q(u={}){const{shimDisconnect:g=!1}=u;let h,M;return b(a=>({id:"safe",name:"Safe",type:Q.type,async connect({withCapabilities:o}={}){const t=await this.getProvider();if(!t)throw new O;const i=await this.getAccounts(),r=await this.getChainId();return M||(M=this.onDisconnect.bind(this),t.on("disconnect",M)),g&&await a.storage?.removeItem("safe.disconnected"),{accounts:o?i.map(c=>({address:c,capabilities:{}})):i,chainId:r}},async disconnect(){const o=await this.getProvider();if(!o)throw new O;M&&(o.removeListener("disconnect",M),M=void 0),g&&await a.storage?.setItem("safe.disconnected",!0)},async getAccounts(){const o=await this.getProvider();if(!o)throw new O;return(await o.request({method:"eth_accounts"})).map(C)},async getProvider(){if(typeof window<"u"&&window?.parent!==window){if(!h){const{default:t}=await(()=>{try{return z(()=>import("./index-DZ0punK7.js"),__vite__mapDeps([23,24,9,10,4,6,7,3,18]))}catch{throw new Error('dependency "@safe-global/safe-apps-sdk" not found')}})(),i=new t(u),r=await U(()=>i.safe.getInfo(),{timeout:u.unstable_getInfoTimeout??10});if(!r)throw new Error("Could not load Safe information");const c=await(async()=>{const e=await(()=>{try{return z(()=>import("./index-BE5nQY53.js").then(n=>n.i),__vite__mapDeps([25,6,7,24,26]))}catch{throw new Error('dependency "@safe-global/safe-apps-provider" not found')}})();return typeof e.SafeAppProvider!="function"&&typeof e.default.SafeAppProvider=="function"?e.default.SafeAppProvider:e.SafeAppProvider})();h=new c(r,i)}return h}},async getChainId(){const o=await this.getProvider();if(!o)throw new O;return Number(o.chainId)},async isAuthorized(){try{return g&&await a.storage?.getItem("safe.disconnected")?!1:!!(await this.getAccounts()).length}catch{return!1}},onAccountsChanged(){},onChainChanged(){},onDisconnect(){a.emitter.emit("disconnect")}}))}const gt="8.0.13";q.type="walletConnect";function q(u){const g=u.isNewChainsStale??!0;let h,M;const a="eip155";let o,t,i,r,c,e;return b(n=>({id:"walletConnect",name:"WalletConnect",type:q.type,async setup(){const s=await this.getProvider().catch(()=>null);s&&(i||(i=this.onConnect.bind(this),s.on("connect",i)),c||(c=this.onSessionDelete.bind(this),s.on("session_delete",c)))},async connect({chainId:s,withCapabilities:d,...I}={}){try{const l=await this.getProvider();if(!l)throw new O;r||(r=this.onDisplayUri,l.on("display_uri",r));let w=s;if(!w){const N=await n.storage?.getItem("state")??{};n.chains.some(L=>L.id===N.chainId)?w=N.chainId:w=n.chains[0]?.id}if(!w)throw new Error("No chains found on connector.");const p=await this.isChainsStale();if(l.session&&p&&await l.disconnect(),!l.session||p){const N=n.chains.filter(m=>m.id!==w).map(m=>m.id);await l.connect({optionalChains:[w,...N],..."pairingTopic"in I?{pairingTopic:I.pairingTopic}:{}}),this.setRequestedChainsIds(n.chains.map(m=>m.id))}const y=(await l.enable()).map(N=>C(N));let D=await this.getChainId();return s&&D!==s&&(D=(await this.switchChain({chainId:s}).catch(m=>{if(m.code===f.code&&m.cause?.message!=="Missing or invalid. request() method: wallet_addEthereumChain")throw m;return{id:D}}))?.id??D),r&&(l.removeListener("display_uri",r),r=void 0),i&&(l.removeListener("connect",i),i=void 0),o||(o=this.onAccountsChanged.bind(this),l.on("accountsChanged",o)),t||(t=this.onChainChanged.bind(this),l.on("chainChanged",t)),e||(e=this.onDisconnect.bind(this),l.on("disconnect",e)),c||(c=this.onSessionDelete.bind(this),l.on("session_delete",c)),{accounts:d?y.map(N=>({address:N,capabilities:{}})):y,chainId:D}}catch(l){throw/(user rejected|connection request reset)/i.test(l?.message)?new f(l):l}},async disconnect(){const s=await this.getProvider();try{await s?.disconnect()}catch(d){if(!/No matching key/i.test(d.message))throw d}finally{t&&(s?.removeListener("chainChanged",t),t=void 0),e&&(s?.removeListener("disconnect",e),e=void 0),i||(i=this.onConnect.bind(this),s?.on("connect",i)),o&&(s?.removeListener("accountsChanged",o),o=void 0),c&&(s?.removeListener("session_delete",c),c=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(d=>C(d))},async getProvider({chainId:s}={}){async function d(){const I=n.chains.map(w=>w.id);if(!I.length)return;const{EthereumProvider:l}=await(()=>{try{return z(()=>import("./index.es-XXBqJXMm.js").then(w=>w.n),__vite__mapDeps([27,6,7,28,13,21,29,30,14]))}catch{throw new Error('dependency "@walletconnect/ethereum-provider" not found')}})();return await l.init({...u,disableProviderPing:!0,optionalChains:I,projectId:u.projectId,rpcMap:Object.fromEntries(n.chains.map(w=>{const[p]=J({chain:w,transports:n.transports});return[w.id,p]})),showQrModal:u.showQrModal??!0})}return h||(M||(M=d()),h=await M,h?.events.setMaxListeners(Number.POSITIVE_INFINITY)),s&&await this.switchChain?.({chainId:s}),h},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[s,d]=await Promise.all([this.getAccounts(),this.getProvider()]);return s.length?await this.isChainsStale()&&d.session?(await d.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:s,chainId:d}){const I=await this.getProvider();if(!I)throw new O;const l=n.chains.find(p=>p.id===d);if(!l)throw new v(new A);let w=()=>{};try{await Promise.all([new Promise(y=>{w=D=>{D.chainId===d&&(n.emitter.off("change",w),y())},n.emitter.on("change",w)}),I.request({method:"wallet_switchEthereumChain",params:[{chainId:j(d)}]})]);const p=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...p,d]),l}catch(p){n.emitter.off("change",w);const y=p;if(/(user rejected)/i.test(y.message))throw new f(y);try{let D;s?.blockExplorerUrls?D=s.blockExplorerUrls:D=l.blockExplorers?.default.url?[l.blockExplorers?.default.url]:[];let N;s?.rpcUrls?.length?N=s.rpcUrls:N=[...l.rpcUrls.default.http];const m={blockExplorerUrls:D,chainId:j(d),chainName:s?.chainName??l.name,iconUrls:s?.iconUrls,nativeCurrency:s?.nativeCurrency??l.nativeCurrency,rpcUrls:N};await I.request({method:"wallet_addEthereumChain",params:[m]});const L=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...L,d]),l}catch(D){throw new f(D)}}},onAccountsChanged(s){s.length===0?this.onDisconnect():n.emitter.emit("change",{accounts:s.map(d=>C(d))})},onChainChanged(s){const d=Number(s);n.emitter.emit("change",{chainId:d})},async onConnect(s){const d=Number(s.chainId),I=await this.getAccounts();n.emitter.emit("connect",{accounts:I,chainId:d})},async onDisconnect(s){this.setRequestedChainsIds([]),n.emitter.emit("disconnect");const d=await this.getProvider();o&&(d.removeListener("accountsChanged",o),o=void 0),t&&(d.removeListener("chainChanged",t),t=void 0),e&&(d.removeListener("disconnect",e),e=void 0),c&&(d.removeListener("session_delete",c),c=void 0),i||(i=this.onConnect.bind(this),d.on("connect",i))},onDisplayUri(s){n.emitter.emit("message",{type:"display_uri",data:s})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return h?h.session?.namespaces[a]?.accounts?.map(d=>Number.parseInt(d.split(":")[1]||"",10))??[]:[]},async getRequestedChainsIds(){return await n.storage?.getItem(this.requestedChainsStorageKey)??[]},async isChainsStale(){if(!g)return!1;const s=n.chains.map(l=>l.id),d=this.getNamespaceChainsIds();if(d.length&&!d.some(l=>s.includes(l)))return!1;const I=await this.getRequestedChainsIds();return!s.every(l=>I.includes(l))},async setRequestedChainsIds(s){await n.storage?.setItem(this.requestedChainsStorageKey,s)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}}))}export{Mt as baseAccount,Y as coinbaseWallet,It as injected,P as metaMask,_ as mock,lt as porto,Q as safe,ut as tempoWallet,gt as version,q as walletConnect};
@@ -1,4 +1,4 @@
1
- import{i as p,b as m}from"./lit-element-Cn7T8F1W.js";import{n as i}from"./class-map-mFRv1nW8.js";import{c as f}from"./index-wds8TuUm.js";import"./index-i4VBSYqA.js";import{d as h,r as b,e as w}from"./index-DbAu4Peg.js";import{N as d}from"./W3MFrameProviderSingleton-9eitOT0j.js";const g=h`
1
+ import{i as p,b as m}from"./lit-element-Cn7T8F1W.js";import{n as i}from"./class-map-mFRv1nW8.js";import{c as f}from"./index-CwfOYq8B.js";import"./index-BvCGPTHO.js";import{d as h,r as b,e as w}from"./index-B2PoGJRP.js";import{N as d}from"./W3MFrameProviderSingleton-dGwr0u32.js";const g=h`
2
2
  :host {
3
3
  width: 100%;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{i as _,b as l,a as Se}from"./lit-element-Cn7T8F1W.js";import{n as b,r as h,a as ye}from"./class-map-mFRv1nW8.js";import{o as g}from"./if-defined-DsPifBxM.js";import{d as U,r as xe,e as Pe,v as Te}from"./index-DbAu4Peg.js";import{c as C,U as ve}from"./index-wds8TuUm.js";import"./index-DP1DuCnR.js";import"./index-C51HwlD0.js";import"./index-i4VBSYqA.js";import"./index-CjiwjbqL.js";import"./index-B9U0GcYk.js";import"./index-BIPd_vR5.js";import"./index-CE5G6IEJ.js";import{$ as ke,k as T,a0 as _e,a1 as w,b as O,a2 as Ce,a3 as N,O as ie,N as A,a4 as ue,C as m,q as P,E as W,S as R,n as $e,M as z,e as Re,i as Oe,p as Ue,o as S,R as M}from"./W3MFrameProviderSingleton-9eitOT0j.js";import{ap as I}from"./NetworkUtil-DqGcuBfF.js";import"./index-TBthDmkl.js";import{M as le}from"./MathUtil-BGCe3rZ3.js";const Le=U`
1
+ import{i as _,b as l,a as Se}from"./lit-element-Cn7T8F1W.js";import{n as b,r as h,a as ye}from"./class-map-mFRv1nW8.js";import{o as g}from"./if-defined-DsPifBxM.js";import{d as U,r as xe,e as Pe,v as Te}from"./index-B2PoGJRP.js";import{c as C,U as ve}from"./index-CwfOYq8B.js";import"./index-DgDxBH9m.js";import"./index-BF9Yx_yV.js";import"./index-BvCGPTHO.js";import"./index-BCiKer83.js";import"./index-D_m5AL3D.js";import"./index-0P32tQWj.js";import"./index-B6j-Tckn.js";import{$ as ke,k as T,a0 as _e,a1 as w,b as O,a2 as Ce,a3 as N,O as ie,N as A,a4 as ue,C as m,q as P,E as W,S as R,n as $e,M as z,e as Re,i as Oe,p as Ue,o as S,R as M}from"./W3MFrameProviderSingleton-dGwr0u32.js";import{ap as I}from"./NetworkUtil-DM5H1DOt.js";import"./index-ak5cSl-l.js";import{M as le}from"./MathUtil-BGCe3rZ3.js";const Le=U`
2
2
  :host {
3
3
  position: relative;
4
4
  }
@@ -1 +1 @@
1
- import{r as k}from"./index-H-Ckw-g_.js";import{az as w}from"./parseEventLogs-D1xiFnCH.js";import{c as I,e as q}from"./hashTypedData-B5shS-rs.js";import"./NetworkUtil-DqGcuBfF.js";import"./sha2-D3ryOfi3.js";import"./index-Cu4ZjLNb.js";import"./sha256-D33fGSQc.js";const v=()=>"9.1.0",C=t=>t.toString(16).padStart(2,"0"),R=t=>{const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e,C).join("")},E=()=>typeof window<"u"?R(10):new Date().getTime().toString(36);class g{}g.makeRequest=(t,e)=>({id:E(),method:t,params:e,env:{sdkVersion:v()}});g.makeResponse=(t,e,s)=>({id:t,success:!0,version:s,data:e});g.makeErrorResponse=(t,e,s)=>({id:t,success:!1,error:e,version:s});var r;(function(t){t.sendTransactions="sendTransactions",t.rpcCall="rpcCall",t.getChainInfo="getChainInfo",t.getSafeInfo="getSafeInfo",t.getTxBySafeTxHash="getTxBySafeTxHash",t.getSafeBalances="getSafeBalances",t.signMessage="signMessage",t.signTypedMessage="signTypedMessage",t.getEnvironmentInfo="getEnvironmentInfo",t.getOffChainSignature="getOffChainSignature",t.requestAddressBook="requestAddressBook",t.wallet_getPermissions="wallet_getPermissions",t.wallet_requestPermissions="wallet_requestPermissions"})(r||(r={}));var f;(function(t){t.requestAddressBook="requestAddressBook"})(f||(f={}));class H{constructor(e=null,s=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:a,data:n,source:i})=>{const o=!n,l=!this.isServer&&i===window.parent,u=typeof n.version<"u"&&parseInt(n.version.split(".")[0]),B=typeof u=="number"&&u>=1;let y=!0;return Array.isArray(this.allowedOrigins)&&(y=this.allowedOrigins.find(P=>P.test(a))!==void 0),!o&&l&&B&&y},this.logIncomingMessage=a=>{console.info(`Safe Apps SDK v1: A message was received from origin ${a.origin}. `,a.data)},this.onParentMessage=a=>{this.isValidMessage(a)&&(this.debugMode&&this.logIncomingMessage(a),this.handleIncomingMessage(a.data))},this.handleIncomingMessage=a=>{const{id:n}=a,i=this.callbacks.get(n);i&&(i(a),this.callbacks.delete(n))},this.send=(a,n)=>{const i=g.makeRequest(a,n);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((o,l)=>{this.callbacks.set(i.id,u=>{if(!u.success){l(new Error(u.error));return}o(u)})})},this.allowedOrigins=e,this.debugMode=s,this.isServer||window.addEventListener("message",this.onParentMessage)}}const S=t=>typeof t=="object"&&t!=null&&"domain"in t&&"types"in t&&"message"in t;var m=k();class A{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(r.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const s={message:e};return(await this.communicator.send(r.signMessage,s)).data}async signTypedMessage(e){if(!S(e))throw new Error("Invalid typed data");return(await this.communicator.send(r.signTypedMessage,{typedData:e})).data}async send({txs:e,params:s}){if(!e||!e.length)throw new Error("No transactions were passed");const a={txs:e,params:s};return(await this.communicator.send(r.sendTransactions,a)).data}}const c={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},h={defaultBlockParam:(t="latest")=>t,returnFullTxObjectParam:(t=!1)=>t,blockNumberToHex:t=>Number.isInteger(t)?`0x${t.toString(16)}`:t};class O{constructor(e){this.communicator=e,this.call=this.buildRequest({call:c.eth_call,formatters:[null,h.defaultBlockParam]}),this.getBalance=this.buildRequest({call:c.eth_getBalance,formatters:[null,h.defaultBlockParam]}),this.getCode=this.buildRequest({call:c.eth_getCode,formatters:[null,h.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:c.eth_getStorageAt,formatters:[null,h.blockNumberToHex,h.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:c.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:c.eth_getBlockByHash,formatters:[null,h.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:c.eth_getBlockByNumber,formatters:[h.blockNumberToHex,h.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:c.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:c.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:c.eth_getTransactionCount,formatters:[null,h.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:c.eth_gasPrice}),this.getEstimateGas=s=>this.buildRequest({call:c.eth_estimateGas})([s]),this.setSafeSettings=this.buildRequest({call:c.safe_setSettings})}buildRequest(e){const{call:s,formatters:a}=e;return async n=>{a&&Array.isArray(n)&&a.forEach((l,u)=>{l&&(n[u]=l(n[u]))});const i={call:s,params:n||[]};return(await this.communicator.send(r.rpcCall,i)).data}}}const x="0x1626ba7e",V="0x20c13b0b",p=4001;class d extends Error{constructor(e,s,a){super(e),this.code=s,this.data=a,Object.setPrototypeOf(this,d.prototype)}}class _{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(r.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new d("Permissions request is invalid",p);try{return(await this.communicator.send(r.wallet_requestPermissions,e)).data}catch{throw new d("Permissions rejected",p)}}isPermissionRequestValid(e){return e.every(s=>typeof s=="object"?Object.keys(s).every(a=>!!Object.values(f).includes(a)):!1)}}const b=(t,e)=>e.some(s=>s.parentCapability===t),M=()=>(t,e,s)=>{const a=s.value;return s.value=async function(){const n=new _(this.communicator);let i=await n.getPermissions();if(b(e,i)||(i=await n.requestPermissions([{[e]:{}}])),!b(e,i))throw new d("Permissions rejected",p);return a.apply(this)},s};var j=function(t,e,s,a){var n=arguments.length,i=n<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,s):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,s,a);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(n<3?o(i):n>3?o(e,s,i):o(e,s))||i);return n>3&&i&&Object.defineProperty(e,s,i),i};class T{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(r.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(r.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(r.getSafeBalances,{currency:e})).data}async check1271Signature(e,s="0x"){const a=await this.getInfo(),n=w({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,s]}),i={call:c.eth_call,params:[{to:a.safeAddress,data:n},"latest"]};try{return(await this.communicator.send(r.rpcCall,i)).data.slice(0,10).toLowerCase()===x}catch{return!1}}async check1271SignatureBytes(e,s="0x"){const a=await this.getInfo(),n=w({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,s]}),i={call:c.eth_call,params:[{to:a.safeAddress,data:n},"latest"]};try{return(await this.communicator.send(r.rpcCall,i)).data.slice(0,10).toLowerCase()===V}catch{return!1}}calculateMessageHash(e){return I(e)}calculateTypedMessageHash(e){const s=typeof e.domain.chainId=="object"?e.domain.chainId.toNumber():Number(e.domain.chainId);let a=e.primaryType;if(!a){const n=Object.values(e.types),i=Object.keys(e.types).filter(o=>n.every(l=>l.every(({type:u})=>u.replace("[","").replace("]","")!==o)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");a=i[0]}return q({message:e.message,domain:{...e.domain,chainId:s,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt},types:e.types,primaryType:a})}async getOffChainSignature(e){return(await this.communicator.send(r.getOffChainSignature,e)).data}async isMessageSigned(e,s="0x"){let a;if(typeof e=="string"&&(a=async()=>{const n=this.calculateMessageHash(e);return await this.isMessageHashSigned(n,s)}),S(e)&&(a=async()=>{const n=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(n,s)}),a)return await a();throw new Error("Invalid message type")}async isMessageHashSigned(e,s="0x"){const a=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const n of a)if(await n(e,s))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(r.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(r.requestAddressBook,void 0)).data}}j([M()],T.prototype,"requestAddressBook",null);class W{constructor(e={}){const{allowedDomains:s=null,debug:a=!1}=e;this.communicator=new H(s,a),this.eth=new O(this.communicator),this.txs=new A(this.communicator),this.safe=new T(this.communicator),this.wallet=new _(this.communicator)}}const $=m.Operation,z=m.TokenType,J=m.TransactionStatus,Q=m.TransferDirection;export{g as MessageFormatter,r as Methods,$ as Operation,c as RPC_CALLS,f as RestrictedMethods,z as TokenType,J as TransactionStatus,Q as TransferDirection,W as default,v as getSDKVersion,S as isObjectEIP712TypedData};
1
+ import{r as k}from"./index-H-Ckw-g_.js";import{az as w}from"./parseEventLogs-BxtEI7tW.js";import{c as I,e as q}from"./hashTypedData-D1Ievn97.js";import"./NetworkUtil-DM5H1DOt.js";import"./sha2-D3ryOfi3.js";import"./index-CqbvjyBi.js";import"./sha256-D33fGSQc.js";const v=()=>"9.1.0",C=t=>t.toString(16).padStart(2,"0"),R=t=>{const e=new Uint8Array(t/2);return window.crypto.getRandomValues(e),Array.from(e,C).join("")},E=()=>typeof window<"u"?R(10):new Date().getTime().toString(36);class g{}g.makeRequest=(t,e)=>({id:E(),method:t,params:e,env:{sdkVersion:v()}});g.makeResponse=(t,e,s)=>({id:t,success:!0,version:s,data:e});g.makeErrorResponse=(t,e,s)=>({id:t,success:!1,error:e,version:s});var r;(function(t){t.sendTransactions="sendTransactions",t.rpcCall="rpcCall",t.getChainInfo="getChainInfo",t.getSafeInfo="getSafeInfo",t.getTxBySafeTxHash="getTxBySafeTxHash",t.getSafeBalances="getSafeBalances",t.signMessage="signMessage",t.signTypedMessage="signTypedMessage",t.getEnvironmentInfo="getEnvironmentInfo",t.getOffChainSignature="getOffChainSignature",t.requestAddressBook="requestAddressBook",t.wallet_getPermissions="wallet_getPermissions",t.wallet_requestPermissions="wallet_requestPermissions"})(r||(r={}));var f;(function(t){t.requestAddressBook="requestAddressBook"})(f||(f={}));class H{constructor(e=null,s=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:a,data:n,source:i})=>{const o=!n,l=!this.isServer&&i===window.parent,u=typeof n.version<"u"&&parseInt(n.version.split(".")[0]),B=typeof u=="number"&&u>=1;let y=!0;return Array.isArray(this.allowedOrigins)&&(y=this.allowedOrigins.find(P=>P.test(a))!==void 0),!o&&l&&B&&y},this.logIncomingMessage=a=>{console.info(`Safe Apps SDK v1: A message was received from origin ${a.origin}. `,a.data)},this.onParentMessage=a=>{this.isValidMessage(a)&&(this.debugMode&&this.logIncomingMessage(a),this.handleIncomingMessage(a.data))},this.handleIncomingMessage=a=>{const{id:n}=a,i=this.callbacks.get(n);i&&(i(a),this.callbacks.delete(n))},this.send=(a,n)=>{const i=g.makeRequest(a,n);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((o,l)=>{this.callbacks.set(i.id,u=>{if(!u.success){l(new Error(u.error));return}o(u)})})},this.allowedOrigins=e,this.debugMode=s,this.isServer||window.addEventListener("message",this.onParentMessage)}}const S=t=>typeof t=="object"&&t!=null&&"domain"in t&&"types"in t&&"message"in t;var m=k();class A{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw new Error("Invalid safeTxHash");return(await this.communicator.send(r.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){const s={message:e};return(await this.communicator.send(r.signMessage,s)).data}async signTypedMessage(e){if(!S(e))throw new Error("Invalid typed data");return(await this.communicator.send(r.signTypedMessage,{typedData:e})).data}async send({txs:e,params:s}){if(!e||!e.length)throw new Error("No transactions were passed");const a={txs:e,params:s};return(await this.communicator.send(r.sendTransactions,a)).data}}const c={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},h={defaultBlockParam:(t="latest")=>t,returnFullTxObjectParam:(t=!1)=>t,blockNumberToHex:t=>Number.isInteger(t)?`0x${t.toString(16)}`:t};class O{constructor(e){this.communicator=e,this.call=this.buildRequest({call:c.eth_call,formatters:[null,h.defaultBlockParam]}),this.getBalance=this.buildRequest({call:c.eth_getBalance,formatters:[null,h.defaultBlockParam]}),this.getCode=this.buildRequest({call:c.eth_getCode,formatters:[null,h.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:c.eth_getStorageAt,formatters:[null,h.blockNumberToHex,h.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:c.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:c.eth_getBlockByHash,formatters:[null,h.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:c.eth_getBlockByNumber,formatters:[h.blockNumberToHex,h.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:c.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:c.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:c.eth_getTransactionCount,formatters:[null,h.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:c.eth_gasPrice}),this.getEstimateGas=s=>this.buildRequest({call:c.eth_estimateGas})([s]),this.setSafeSettings=this.buildRequest({call:c.safe_setSettings})}buildRequest(e){const{call:s,formatters:a}=e;return async n=>{a&&Array.isArray(n)&&a.forEach((l,u)=>{l&&(n[u]=l(n[u]))});const i={call:s,params:n||[]};return(await this.communicator.send(r.rpcCall,i)).data}}}const x="0x1626ba7e",V="0x20c13b0b",p=4001;class d extends Error{constructor(e,s,a){super(e),this.code=s,this.data=a,Object.setPrototypeOf(this,d.prototype)}}class _{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(r.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new d("Permissions request is invalid",p);try{return(await this.communicator.send(r.wallet_requestPermissions,e)).data}catch{throw new d("Permissions rejected",p)}}isPermissionRequestValid(e){return e.every(s=>typeof s=="object"?Object.keys(s).every(a=>!!Object.values(f).includes(a)):!1)}}const b=(t,e)=>e.some(s=>s.parentCapability===t),M=()=>(t,e,s)=>{const a=s.value;return s.value=async function(){const n=new _(this.communicator);let i=await n.getPermissions();if(b(e,i)||(i=await n.requestPermissions([{[e]:{}}])),!b(e,i))throw new d("Permissions rejected",p);return a.apply(this)},s};var j=function(t,e,s,a){var n=arguments.length,i=n<3?e:a===null?a=Object.getOwnPropertyDescriptor(e,s):a,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(t,e,s,a);else for(var l=t.length-1;l>=0;l--)(o=t[l])&&(i=(n<3?o(i):n>3?o(e,s,i):o(e,s))||i);return n>3&&i&&Object.defineProperty(e,s,i),i};class T{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(r.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(r.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e="usd"}={}){return(await this.communicator.send(r.getSafeBalances,{currency:e})).data}async check1271Signature(e,s="0x"){const a=await this.getInfo(),n=w({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,s]}),i={call:c.eth_call,params:[{to:a.safeAddress,data:n},"latest"]};try{return(await this.communicator.send(r.rpcCall,i)).data.slice(0,10).toLowerCase()===x}catch{return!1}}async check1271SignatureBytes(e,s="0x"){const a=await this.getInfo(),n=w({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[e,s]}),i={call:c.eth_call,params:[{to:a.safeAddress,data:n},"latest"]};try{return(await this.communicator.send(r.rpcCall,i)).data.slice(0,10).toLowerCase()===V}catch{return!1}}calculateMessageHash(e){return I(e)}calculateTypedMessageHash(e){const s=typeof e.domain.chainId=="object"?e.domain.chainId.toNumber():Number(e.domain.chainId);let a=e.primaryType;if(!a){const n=Object.values(e.types),i=Object.keys(e.types).filter(o=>n.every(l=>l.every(({type:u})=>u.replace("[","").replace("]","")!==o)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");a=i[0]}return q({message:e.message,domain:{...e.domain,chainId:s,verifyingContract:e.domain.verifyingContract,salt:e.domain.salt},types:e.types,primaryType:a})}async getOffChainSignature(e){return(await this.communicator.send(r.getOffChainSignature,e)).data}async isMessageSigned(e,s="0x"){let a;if(typeof e=="string"&&(a=async()=>{const n=this.calculateMessageHash(e);return await this.isMessageHashSigned(n,s)}),S(e)&&(a=async()=>{const n=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(n,s)}),a)return await a();throw new Error("Invalid message type")}async isMessageHashSigned(e,s="0x"){const a=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const n of a)if(await n(e,s))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(r.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(r.requestAddressBook,void 0)).data}}j([M()],T.prototype,"requestAddressBook",null);class W{constructor(e={}){const{allowedDomains:s=null,debug:a=!1}=e;this.communicator=new H(s,a),this.eth=new O(this.communicator),this.txs=new A(this.communicator),this.safe=new T(this.communicator),this.wallet=new _(this.communicator)}}const $=m.Operation,z=m.TokenType,J=m.TransactionStatus,Q=m.TransferDirection;export{g as MessageFormatter,r as Methods,$ as Operation,c as RPC_CALLS,f as RestrictedMethods,z as TokenType,J as TransactionStatus,Q as TransferDirection,W as default,v as getSDKVersion,S as isObjectEIP712TypedData};
@@ -1,4 +1,4 @@
1
- import{a as d,i as p,b as m}from"./lit-element-Cn7T8F1W.js";import{n as h}from"./class-map-mFRv1nW8.js";import{r as f,v as r}from"./index-DbAu4Peg.js";import{c as x}from"./index-wds8TuUm.js";const g=d`
1
+ import{a as d,i as p,b as m}from"./lit-element-Cn7T8F1W.js";import{n as h}from"./class-map-mFRv1nW8.js";import{r as f,v as r}from"./index-B2PoGJRP.js";import{c as x}from"./index-CwfOYq8B.js";const g=d`
2
2
  :host {
3
3
  display: flex;
4
4
  }
@@ -1,4 +1,4 @@
1
- import{i as h,b as v}from"./lit-element-Cn7T8F1W.js";import{n as d}from"./class-map-mFRv1nW8.js";import"./index-i4VBSYqA.js";import{d as m,r as f}from"./index-DbAu4Peg.js";import{c as u,U as p}from"./index-wds8TuUm.js";const g=m`
1
+ import{i as h,b as v}from"./lit-element-Cn7T8F1W.js";import{n as d}from"./class-map-mFRv1nW8.js";import"./index-BvCGPTHO.js";import{d as m,r as f}from"./index-B2PoGJRP.js";import{c as u,U as p}from"./index-CwfOYq8B.js";const g=m`
2
2
  :host {
3
3
  display: block;
4
4
  width: var(--local-width);
@@ -1,4 +1,4 @@
1
- import{i as b,b as c}from"./lit-element-Cn7T8F1W.js";import{n}from"./class-map-mFRv1nW8.js";import{c as p}from"./index-wds8TuUm.js";import"./index-B9U0GcYk.js";import{d as g,r as m,e as h}from"./index-DbAu4Peg.js";const v=g`
1
+ import{i as b,b as c}from"./lit-element-Cn7T8F1W.js";import{n}from"./class-map-mFRv1nW8.js";import{c as p}from"./index-CwfOYq8B.js";import"./index-D_m5AL3D.js";import{d as g,r as m,e as h}from"./index-B2PoGJRP.js";const v=g`
2
2
  :host {
3
3
  width: var(--local-width);
4
4
  }
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DOnRCLNP.js","assets/index-Cu4ZjLNb.js","assets/index-829Uxa3Y.css","assets/parseEventLogs-D1xiFnCH.js","assets/NetworkUtil-DqGcuBfF.js","assets/sha2-D3ryOfi3.js","assets/sha256-D33fGSQc.js","assets/W3MFrameProviderSingleton-9eitOT0j.js","assets/index-DS2Lm9tG.js","assets/browser-ponyfill-BmgQyNz0.js","assets/custom-cPmISGcH.js","assets/store-DOLZnwHk.js","assets/writeContract-CCar3Ocq.js"])))=>i.map(i=>d[i]);
2
- import{w as We,a as Le,l as ve,C as S,o as qe,a5 as ye,F as x,a6 as K,A as D,Z as De,t as F,O as $,a7 as $e,e as Fe,p as He,b as te,a8 as Be,a9 as J,aa as j,L as ze,a3 as X,ab as Q,Q as Ie,ac as Ve}from"./W3MFrameProviderSingleton-9eitOT0j.js";import{ak as Ge,an as Ke,aa as Je,w as B,ae as oe,X as _,r as ae,ap as E,ax as ge,a3 as Xe}from"./NetworkUtil-DqGcuBfF.js";import{bg as Te,aI as L,cg as Qe,bc as Ye,b7 as Ze,ah as et}from"./parseEventLogs-D1xiFnCH.js";import"./index-DS2Lm9tG.js";import{g as tt,_ as ke}from"./index-Cu4ZjLNb.js";import"./browser-ponyfill-BmgQyNz0.js";import{c as nt}from"./store-DOLZnwHk.js";import{c as Oe,a as it,g as rt,b as ot,d as st,e as ct,p as at}from"./custom-cPmISGcH.js";import{A as dt,s as ut,w as lt}from"./writeContract-CCar3Ocq.js";async function ht(o,{account:e=o.account,message:t}){if(!e)throw new dt({docsPath:"/docs/actions/wallet/signMessage"});const n=Te(e);if(n.signMessage)return n.signMessage({message:t});const i=typeof t=="string"?Ge(t):t.raw instanceof Uint8Array?Ke(t.raw):t.raw;return o.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}function R(o,e,t){const n=o[e.name];if(typeof n=="function")return n;const i=o[t];return typeof i=="function"?i:c=>e(o,c)}const ne="3.4.11",ft=()=>`@wagmi/core@${ne}`;var Re=function(o,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?o!==e||!n:!e.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(o):n?n.value:e.get(o)},se,Ue;class O extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return ft()}constructor(e,t={}){super(),se.add(this),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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=t.cause instanceof O?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof O&&t.cause.docsPath||t.docsPath;this.message=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${t.docsSlug?`#${t.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(`
3
- `),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=i,this.metaMessages=t.metaMessages,this.shortMessage=e}walk(e){return Re(this,se,"m",Ue).call(this,this,e)}}se=new WeakSet,Ue=function o(e,t){return t?.(e)?e:e.cause?Re(this,se,"m",o).call(this,e.cause,t):e};class z extends O{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class gt extends O{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class mt extends O{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class Ct extends O{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class pt extends O{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class wt extends O{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function de(o,e){let t;if(typeof e.connector=="function"?t=o._internal.connectors.setup(e.connector):t=e.connector,t.uid===o.state.current)throw new gt;try{o.setState(u=>({...u,status:"connecting"})),t.emitter.emit("message",{type:"connecting"});const{connector:n,...i}=e,c=await t.connect(i);return t.emitter.off("connect",o._internal.events.connect),t.emitter.on("change",o._internal.events.change),t.emitter.on("disconnect",o._internal.events.disconnect),await o.storage?.setItem("recentConnectorId",t.id),o.setState(u=>({...u,connections:new Map(u.connections).set(t.uid,{accounts:i.withCapabilities?c.accounts.map(d=>typeof d=="object"?d.address:d):c.accounts,chainId:c.chainId,connector:t}),current:t.uid,status:"connected"})),{accounts:i.withCapabilities?c.accounts.map(u=>typeof u=="object"?u:{address:u,capabilities:{}}):c.accounts,chainId:c.chainId}}catch(n){throw o.setState(i=>({...i,status:i.current?"connected":"disconnected"})),n}}async function G(o,e={}){const{assertChainId:t=!0}=e;let n;if(e.connector){const{connector:s}=e;if(o.state.status==="reconnecting"&&!s.getAccounts&&!s.getChainId)throw new wt({connector:s});const[l,h]=await Promise.all([s.getAccounts().catch(f=>{if(e.account===null)return[];throw f}),s.getChainId()]);n={accounts:l,chainId:h,connector:s}}else n=o.state.connections.get(o.state.current);if(!n)throw new mt;const i=e.chainId??n.chainId,c=await n.connector.getChainId();if(t&&c!==i)throw new pt({connectionChainId:i,connectorChainId:c});const u=n.connector;if(u.getClient)return u.getClient({chainId:i});const d=Te(e.account??n.accounts[0]);if(d&&(d.address=L(d.address)),e.account&&!n.accounts.some(s=>s.toLowerCase()===d.address.toLowerCase()))throw new Ct({address:d.address,connector:u});const a=o.chains.find(s=>s.id===i),r=await n.connector.getProvider({chainId:i});return Oe({account:d,chain:a,name:"Connector Client",transport:s=>it(r)({...s,retryCount:0})})}async function be(o,e={}){let t;if(e.connector)t=e.connector;else{const{connections:i,current:c}=o.state;t=i.get(c)?.connector}const n=o.state.connections;t&&(await t.disconnect(),t.emitter.off("change",o._internal.events.change),t.emitter.off("disconnect",o._internal.events.disconnect),t.emitter.on("connect",o._internal.events.connect),n.delete(t.uid)),o.setState(i=>{if(n.size===0)return{...i,connections:new Map,current:null,status:"disconnected"};const c=n.values().next().value;return{...i,connections:new Map(n),current:c.connector.uid}});{const i=o.state.current;if(!i)return;const c=o.state.connections.get(i)?.connector;if(!c)return;await o.storage?.setItem("recentConnectorId",c.id)}}async function vt(o,e){const{chainId:t,connector:n,...i}=e;let c;e.account?c=e.account:c=(await G(o,{account:e.account,assertChainId:!1,chainId:t,connector:n})).account;const u=o.getClient({chainId:t});return R(u,Qe,"estimateGas")({...i,account:c})}async function yt(o,e){const{address:t,blockNumber:n,blockTag:i,chainId:c}=e,u=o.getClient({chainId:c}),a=await R(u,rt,"getBalance")(n?{address:t,blockNumber:n}:{address:t,blockTag:i}),r=o.chains.find(s=>s.id===c)??u.chain;return{decimals:r.nativeCurrency.decimals,symbol:r.nativeCurrency.symbol,value:a}}function V(o,e){if(o===e)return!0;if(o&&e&&typeof o=="object"&&typeof e=="object"){if(o.constructor!==e.constructor)return!1;let t,n;if(Array.isArray(o)&&Array.isArray(e)){if(t=o.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!V(o[n],e[n]))return!1;return!0}if(typeof o.valueOf=="function"&&o.valueOf!==Object.prototype.valueOf)return o.valueOf()===e.valueOf();if(typeof o.toString=="function"&&o.toString!==Object.prototype.toString)return o.toString()===e.toString();const i=Object.keys(o);if(t=i.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!Object.hasOwn(e,i[n]))return!1;for(n=t;n--!==0;){const c=i[n];if(c&&!V(o[c],e[c]))return!1}return!0}return o!==o&&e!==e}function ie(o){const e=o.state.current,t=o.state.connections.get(e),n=t?.accounts,i=n?.[0],c=o.chains.find(d=>d.id===t?.chainId),u=o.state.status;switch(u){case"connected":return{address:i,addresses:n,chain:c,chainId:t?.chainId,connector:t?.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:u};case"reconnecting":return{address:i,addresses:n,chain:c,chainId:t?.chainId,connector:t?.connector,isConnected:!!i,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:u};case"connecting":return{address:i,addresses:n,chain:c,chainId:t?.chainId,connector:t?.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:u};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:u}}}let Y=[];function M(o){const e=[...o.state.connections.values()];return o.state.status==="reconnecting"||V(Y,e)?Y:(Y=e,e)}async function It(o,e){const{account:t,chainId:n,...i}=e;let c;t?c=t:c=(await G(o,{account:t,assertChainId:!1,chainId:n})).account;const u=o.getClient({chainId:n});return R(u,Ye,"prepareTransactionRequest")({...i,...c?{account:c}:{}})}let ue=!1;async function le(o,e={}){if(ue)return[];ue=!0,o.setState(r=>({...r,status:r.current?"reconnecting":"connecting"}));const t=[];if(e.connectors?.length)for(const r of e.connectors){let s;typeof r=="function"?s=o._internal.connectors.setup(r):s=r,t.push(s)}else t.push(...o.connectors);let n;try{n=await o.storage?.getItem("recentConnectorId")}catch{}const i={};for(const[,r]of o.state.connections)i[r.connector.id]=1;n&&(i[n]=0);const c=Object.keys(i).length>0?[...t].sort((r,s)=>(i[r.id]??10)-(i[s.id]??10)):t;let u=!1;const d=[],a=[];for(const r of c){const s=await r.getProvider().catch(()=>{});if(!s||a.some(f=>f===s)||!await r.isAuthorized())continue;const h=await r.connect({isReconnecting:!0}).catch(()=>null);h&&(r.emitter.off("connect",o._internal.events.connect),r.emitter.on("change",o._internal.events.change),r.emitter.on("disconnect",o._internal.events.disconnect),o.setState(f=>{const p=new Map(u?f.connections:new Map).set(r.uid,{accounts:h.accounts,chainId:h.chainId,connector:r});return{...f,current:u?f.current:r.uid,connections:p}}),d.push({accounts:h.accounts,chainId:h.chainId,connector:r}),a.push(s),u=!0)}return(o.state.status==="reconnecting"||o.state.status==="connecting")&&(u?o.setState(r=>({...r,status:"connected"})):o.setState(r=>({...r,connections:new Map,current:null,status:"disconnected"}))),ue=!1,d}async function bt(o,e){const{account:t,chainId:n,connector:i,...c}=e;let u;typeof t=="object"&&t?.type==="local"?u=o.getClient({chainId:n}):u=await G(o,{account:t??void 0,assertChainId:!1,chainId:n,connector:i});const d=!n||u.chain?.id===n?u.chain:{id:n};return await R(u,ut,"sendTransaction")({...c,...t?{account:t}:{},assertChainId:!!n,chain:d,gas:c.gas??void 0})}async function Et(o,e){const{account:t,connector:n,...i}=e;let c;return typeof t=="object"&&t.type==="local"?c=o.getClient():c=await G(o,{account:t,connector:n}),R(c,ht,"signMessage")({...i,...t?{account:t}:{}})}class W extends O{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class At extends O{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Ee(o,e){const{addEthereumChainParameter:t,chainId:n}=e,i=o.state.connections.get(e.connector?.uid??o.state.current);if(i){const u=i.connector;if(!u.switchChain)throw new At({connector:u});return await u.switchChain({addEthereumChainParameter:t,chainId:n})}const c=o.chains.find(u=>u.id===n);if(!c)throw new z;return o.setState(u=>({...u,chainId:n})),c}async function Nt(o,e){const{chainId:t,timeout:n=0,...i}=e,c=o.getClient({chainId:t}),d=await R(c,ot,"waitForTransactionReceipt")({...i,timeout:n});if(d.status==="reverted"){const a=R(c,st,"getTransaction"),{from:r,...s}=await a({hash:d.transactionHash}),h=await R(c,Ze,"call")({...s,account:r,data:s.input,gasPrice:s.type!=="eip1559"?s.gasPrice:void 0,maxFeePerGas:s.type==="eip1559"?s.maxFeePerGas:void 0,maxPriorityFeePerGas:s.type==="eip1559"?s.maxPriorityFeePerGas:void 0}),f=h?.data?Je(`0x${h.data.substring(138)}`):"unknown reason";throw new Error(f)}return{...d,chainId:c.chain.id}}function _t(o,e){const{onChange:t}=e;return o.subscribe(()=>ie(o),t,{equalityFn(n,i){const{connector:c,...u}=n,{connector:d,...a}=i;return V(u,a)&&c?.id===d?.id&&c?.uid===d?.uid}})}function St(o,e){const{onChange:t}=e;return o.subscribe(()=>M(o),t,{equalityFn:V})}function Pt(o,e){const{onChange:t}=e;return o._internal.connectors.subscribe((n,i)=>{t(Object.values(n),i)})}function Tt(o,e){const{syncConnectedChain:t=o._internal.syncConnectedChain,...n}=e;let i;const c=a=>{i&&i();const r=o.getClient({chainId:a});return i=R(r,ct,"watchPendingTransactions")(n),i},u=c(e.chainId);let d;return t&&!e.chainId&&(d=o.subscribe(({chainId:a})=>a,async a=>c(a))),()=>{u?.(),d?.()}}async function kt(o,e){const{account:t,chainId:n,connector:i,...c}=e;let u;typeof t=="object"&&t?.type==="local"?u=o.getClient({chainId:n}):u=await G(o,{account:t??void 0,assertChainId:!1,chainId:n,connector:i});const d=!n||u.chain?.id===n?u.chain:{id:n};return await R(u,lt,"writeContract")({...c,...t?{account:t}:{},assertChainId:!!n,chain:d})}function un(o){return o}ce.type="injected";function ce(o={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:t}=o;function n(){const a=o.target;if(typeof a=="function"){const r=a();if(r)return r}return typeof a=="object"?a:typeof a=="string"?{...Ot[a]??{id:a,name:`${a[0].toUpperCase()}${a.slice(1)}`,provider:`is${a[0].toUpperCase()}${a.slice(1)}`}}:{id:"injected",name:"Injected",provider(r){return r?.ethereum}}}let i,c,u,d;return a=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},type:ce.type,async setup(){const r=await this.getProvider();r?.on&&o.target&&(u||(u=this.onConnect.bind(this),r.on("connect",u)),i||(i=this.onAccountsChanged.bind(this),r.on("accountsChanged",i)))},async connect({chainId:r,isReconnecting:s,withCapabilities:l}={}){const h=await this.getProvider();if(!h)throw new W;let f=[];if(s)f=await this.getAccounts().catch(()=>[]);else if(e)try{f=(await h.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(C=>L(C)),f.length>0&&(f=await this.getAccounts())}catch(p){const C=p;if(C.code===_.code)throw new _(C);if(C.code===ae.code)throw C}try{!f?.length&&!s&&(f=(await h.request({method:"eth_requestAccounts"})).map(g=>L(g))),u&&(h.removeListener("connect",u),u=void 0),i||(i=this.onAccountsChanged.bind(this),h.on("accountsChanged",i)),c||(c=this.onChainChanged.bind(this),h.on("chainChanged",c)),d||(d=this.onDisconnect.bind(this),h.on("disconnect",d));let p=await this.getChainId();return r&&p!==r&&(p=(await this.switchChain({chainId:r}).catch(g=>{if(g.code===_.code)throw g;return{id:p}}))?.id??p),e&&await a.storage?.removeItem(`${this.id}.disconnected`),o.target||await a.storage?.setItem("injected.connected",!0),{accounts:l?f.map(C=>({address:C,capabilities:{}})):f,chainId:p}}catch(p){const C=p;throw C.code===_.code?new _(C):C.code===ae.code?new ae(C):C}},async disconnect(){const r=await this.getProvider();if(!r)throw new W;c&&(r.removeListener("chainChanged",c),c=void 0),d&&(r.removeListener("disconnect",d),d=void 0),u||(u=this.onConnect.bind(this),r.on("connect",u));try{await Le(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await a.storage?.setItem(`${this.id}.disconnected`,!0),o.target||await a.storage?.removeItem("injected.connected")},async getAccounts(){const r=await this.getProvider();if(!r)throw new W;return(await r.request({method:"eth_accounts"})).map(l=>L(l))},async getChainId(){const r=await this.getProvider();if(!r)throw new W;const s=await r.request({method:"eth_chainId"});return Number(s)},async getProvider(){if(typeof window>"u")return;let r;const s=n();return typeof s.provider=="function"?r=s.provider(window):typeof s.provider=="string"?r=re(window,s.provider):r=s.provider,r&&!r.removeListener&&("off"in r&&typeof r.off=="function"?r.removeListener=r.off:r.removeListener=()=>{}),r},async isAuthorized(){try{if(e&&await a.storage?.getItem(`${this.id}.disconnected`)||!o.target&&!await a.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(t!==void 0&&t!==!1){const h=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",h),!!await this.getProvider()),f=typeof t=="number"?t:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(C=>window.addEventListener("ethereum#initialized",()=>C(h()),{once:!0}))]:[],new Promise(C=>setTimeout(()=>C(h()),f))]))return!0}throw new W}return!!(await We(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:r,chainId:s}){const l=await this.getProvider();if(!l)throw new W;const h=a.chains.find(p=>p.id===s);if(!h)throw new B(new z);const f=new Promise(p=>{const C=(g=>{"chainId"in g&&g.chainId===s&&(a.emitter.off("change",C),p())});a.emitter.on("change",C)});try{return await Promise.all([l.request({method:"wallet_switchEthereumChain",params:[{chainId:oe(s)}]}).then(async()=>{await this.getChainId()===s&&a.emitter.emit("change",{chainId:s})}),f]),h}catch(p){const C=p;if(C.code===4902||C?.data?.originalError?.code===4902)try{const{default:g,...N}=h.blockExplorers??{};let b;r?.blockExplorerUrls?b=r.blockExplorerUrls:g&&(b=[g.url,...Object.values(N).map(m=>m.url)]);let y;r?.rpcUrls?.length?y=r.rpcUrls:y=[h.rpcUrls.default?.http[0]??""];const P={blockExplorerUrls:b,chainId:oe(s),chainName:r?.chainName??h.name,iconUrls:r?.iconUrls,nativeCurrency:r?.nativeCurrency??h.nativeCurrency,rpcUrls:y};return await Promise.all([l.request({method:"wallet_addEthereumChain",params:[P]}).then(async()=>{if(await this.getChainId()===s)a.emitter.emit("change",{chainId:s});else throw new _(new Error("User rejected switch after adding network."))}),f]),h}catch(g){throw new _(g)}throw C.code===_.code?new _(C):new B(C)}},async onAccountsChanged(r){if(r.length===0)this.onDisconnect();else if(a.emitter.listenerCount("connect")){const s=(await this.getChainId()).toString();this.onConnect({chainId:s}),e&&await a.storage?.removeItem(`${this.id}.disconnected`)}else a.emitter.emit("change",{accounts:r.map(s=>L(s))})},onChainChanged(r){const s=Number(r);a.emitter.emit("change",{chainId:s})},async onConnect(r){const s=await this.getAccounts();if(s.length===0)return;const l=Number(r.chainId);a.emitter.emit("connect",{accounts:s,chainId:l});const h=await this.getProvider();h&&(u&&(h.removeListener("connect",u),u=void 0),i||(i=this.onAccountsChanged.bind(this),h.on("accountsChanged",i)),c||(c=this.onChainChanged.bind(this),h.on("chainChanged",c)),d||(d=this.onDisconnect.bind(this),h.on("disconnect",d)))},async onDisconnect(r){const s=await this.getProvider();r&&r.code===1013&&s&&(await this.getAccounts()).length||(a.emitter.emit("disconnect"),s&&(c&&(s.removeListener("chainChanged",c),c=void 0),d&&(s.removeListener("disconnect",d),d=void 0),u||(u=this.onConnect.bind(this),s.on("connect",u))))}})}const Ot={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(o){return o?.coinbaseWalletExtension?o.coinbaseWalletExtension:re(o,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(o){return re(o,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const t=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of t)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(o){return o?.phantom?.ethereum?o.phantom?.ethereum:re(o,"isPhantom")}}};function re(o,e){function t(i){return typeof e=="function"?e(i):typeof e=="string"?i[e]:!0}const n=o.ethereum;if(n?.providers)return n.providers.find(i=>t(i));if(n&&t(n))return n}const Rt=o=>(e,t,n)=>{const i=n.subscribe;return n.subscribe=(u,d,a)=>{let r=u;if(d){const s=a?.equalityFn||Object.is;let l=u(n.getState());r=h=>{const f=u(h);if(!s(l,f)){const p=l;d(l=f,p)}},a?.fireImmediately&&d(l,l)}return i(r)},o(e,t,n)},Ut=Rt;function jt(o,e){let t;try{t=o()}catch{return}return{getItem:i=>{var c;const u=a=>a===null?null:JSON.parse(a,void 0),d=(c=t.getItem(i))!=null?c:null;return d instanceof Promise?d.then(u):u(d)},setItem:(i,c)=>t.setItem(i,JSON.stringify(c,void 0)),removeItem:i=>t.removeItem(i)}}const me=o=>e=>{try{const t=o(e);return t instanceof Promise?t:{then(n){return me(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return me(n)(t)}}}},Mt=(o,e)=>(t,n,i)=>{let c={storage:jt(()=>localStorage),partialize:C=>C,version:0,merge:(C,g)=>({...g,...C}),...e},u=!1;const d=new Set,a=new Set;let r=c.storage;if(!r)return o((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),t(...C)},n,i);const s=()=>{const C=c.partialize({...n()});return r.setItem(c.name,{state:C,version:c.version})},l=i.setState;i.setState=(C,g)=>{l(C,g),s()};const h=o((...C)=>{t(...C),s()},n,i);i.getInitialState=()=>h;let f;const p=()=>{var C,g;if(!r)return;u=!1,d.forEach(b=>{var y;return b((y=n())!=null?y:h)});const N=((g=c.onRehydrateStorage)==null?void 0:g.call(c,(C=n())!=null?C:h))||void 0;return me(r.getItem.bind(r))(c.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==c.version){if(c.migrate)return[!0,c.migrate(b.state,b.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var y;const[P,m]=b;if(f=c.merge(m,(y=n())!=null?y:h),t(f,!0),P)return s()}).then(()=>{N?.(f,void 0),f=n(),u=!0,a.forEach(b=>b(f))}).catch(b=>{N?.(void 0,b)})};return i.persist={setOptions:C=>{c={...c,...C},C.storage&&(r=C.storage)},clearStorage:()=>{r?.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>p(),hasHydrated:()=>u,onHydrate:C=>(d.add(C),()=>{d.delete(C)}),onFinishHydration:C=>(a.add(C),()=>{a.delete(C)})},c.skipHydration||p(),f||h},xt=Mt,Ae=o=>{let e;const t=new Set,n=(r,s)=>{const l=typeof r=="function"?r(e):r;if(!Object.is(l,e)){const h=e;e=s??(typeof l!="object"||l===null)?l:Object.assign({},e,l),t.forEach(f=>f(e,h))}},i=()=>e,d={setState:n,getState:i,getInitialState:()=>a,subscribe:r=>(t.add(r),()=>t.delete(r))},a=e=o(n,i,d);return d},he=o=>o?Ae(o):Ae;var fe={exports:{}},Ne;function Wt(){return Ne||(Ne=1,(function(o){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(a,r,s){this.fn=a,this.context=r,this.once=s||!1}function c(a,r,s,l,h){if(typeof s!="function")throw new TypeError("The listener must be a function");var f=new i(s,l||a,h),p=t?t+r:r;return a._events[p]?a._events[p].fn?a._events[p]=[a._events[p],f]:a._events[p].push(f):(a._events[p]=f,a._eventsCount++),a}function u(a,r){--a._eventsCount===0?a._events=new n:delete a._events[r]}function d(){this._events=new n,this._eventsCount=0}d.prototype.eventNames=function(){var r=[],s,l;if(this._eventsCount===0)return r;for(l in s=this._events)e.call(s,l)&&r.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(s)):r},d.prototype.listeners=function(r){var s=t?t+r:r,l=this._events[s];if(!l)return[];if(l.fn)return[l.fn];for(var h=0,f=l.length,p=new Array(f);h<f;h++)p[h]=l[h].fn;return p},d.prototype.listenerCount=function(r){var s=t?t+r:r,l=this._events[s];return l?l.fn?1:l.length:0},d.prototype.emit=function(r,s,l,h,f,p){var C=t?t+r:r;if(!this._events[C])return!1;var g=this._events[C],N=arguments.length,b,y;if(g.fn){switch(g.once&&this.removeListener(r,g.fn,void 0,!0),N){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,s),!0;case 3:return g.fn.call(g.context,s,l),!0;case 4:return g.fn.call(g.context,s,l,h),!0;case 5:return g.fn.call(g.context,s,l,h,f),!0;case 6:return g.fn.call(g.context,s,l,h,f,p),!0}for(y=1,b=new Array(N-1);y<N;y++)b[y-1]=arguments[y];g.fn.apply(g.context,b)}else{var P=g.length,m;for(y=0;y<P;y++)switch(g[y].once&&this.removeListener(r,g[y].fn,void 0,!0),N){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,s);break;case 3:g[y].fn.call(g[y].context,s,l);break;case 4:g[y].fn.call(g[y].context,s,l,h);break;default:if(!b)for(m=1,b=new Array(N-1);m<N;m++)b[m-1]=arguments[m];g[y].fn.apply(g[y].context,b)}}return!0},d.prototype.on=function(r,s,l){return c(this,r,s,l,!1)},d.prototype.once=function(r,s,l){return c(this,r,s,l,!0)},d.prototype.removeListener=function(r,s,l,h){var f=t?t+r:r;if(!this._events[f])return this;if(!s)return u(this,f),this;var p=this._events[f];if(p.fn)p.fn===s&&(!h||p.once)&&(!l||p.context===l)&&u(this,f);else{for(var C=0,g=[],N=p.length;C<N;C++)(p[C].fn!==s||h&&!p[C].once||l&&p[C].context!==l)&&g.push(p[C]);g.length?this._events[f]=g.length===1?g[0]:g:u(this,f)}return this},d.prototype.removeAllListeners=function(r){var s;return r?(s=t?t+r:r,this._events[s]&&u(this,s)):(this._events=new n,this._eventsCount=0),this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prefixed=t,d.EventEmitter=d,o.exports=d})(fe)),fe.exports}var Lt=Wt();const qt=tt(Lt);class Dt{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new qt})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){const n=t[0];this._emitter.emit(e,{uid:this.uid,...n})}listenerCount(e){return this._emitter.listenerCount(e)}}function $t(o){return new Dt(o)}function Ft(o,e){return JSON.parse(o,(t,n)=>{let i=n;return i?.__type==="bigint"&&(i=BigInt(i.value)),i?.__type==="Map"&&(i=new Map(i.value)),e?.(t,i)??i})}function _e(o,e){return o.slice(0,e).join(".")||"."}function Se(o,e){const{length:t}=o;for(let n=0;n<t;++n)if(o[n]===e)return n+1;return 0}function Ht(o,e){const t=typeof o=="function",n=typeof e=="function",i=[],c=[];return function(d,a){if(typeof a=="object")if(i.length){const r=Se(i,this);r===0?i[i.length]=this:(i.splice(r),c.splice(r)),c[c.length]=d;const s=Se(i,a);if(s!==0)return n?e.call(this,d,a,_e(c,s)):`[ref=${_e(c,s)}]`}else i[0]=a,c[0]=d;return t?o.call(this,d,a):a}}function Bt(o,e,t,n){return JSON.stringify(o,Ht((i,c)=>{let u=c;return typeof u=="bigint"&&(u={__type:"bigint",value:c.toString()}),u instanceof Map&&(u={__type:"Map",value:Array.from(c.entries())}),e?.(i,u)??u},n),t??void 0)}function zt(o){const{deserialize:e=Ft,key:t="wagmi",serialize:n=Bt,storage:i=je}=o;function c(u){return u instanceof Promise?u.then(d=>d).catch(()=>null):u}return{...i,key:t,async getItem(u,d){const a=i.getItem(`${t}.${u}`),r=await c(a);return r?e(r)??null:d??null},async setItem(u,d){const a=`${t}.${u}`;d===null?await c(i.removeItem(a)):await c(i.setItem(a,n(d)))},async removeItem(u){await c(i.removeItem(`${t}.${u}`))}}}const je={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function Vt(){const o=typeof window<"u"&&window.localStorage?window.localStorage:je;return{getItem(e){return o.getItem(e)},removeItem(e){o.removeItem(e)},setItem(e,t){try{o.setItem(e,t)}catch{}}}}const Ce=256;let Z=Ce,ee;function Gt(o=11){if(!ee||Z+o>Ce*2){ee="",Z=0;for(let e=0;e<Ce;e++)ee+=(256+Math.random()*256|0).toString(16).substring(1)}return ee.substring(Z,Z+++o)}function Kt(o){const{multiInjectedProviderDiscovery:e=!0,storage:t=zt({storage:Vt()}),syncConnectedChain:n=!0,ssr:i=!1,...c}=o,u=typeof window<"u"&&e?nt():void 0,d=he(()=>c.chains),a=he(()=>{const m=[],w=new Set;for(const v of c.connectors??[]){const A=r(v);if(m.push(A),!i&&A.rdns){const I=typeof A.rdns=="string"?[A.rdns]:A.rdns;for(const T of I)w.add(T)}}if(!i&&u){const v=u.getProviders();for(const A of v)w.has(A.info.rdns)||m.push(r(s(A)))}return m});function r(m){const w=$t(Gt()),v={...m({emitter:w,chains:d.getState(),storage:t,transports:c.transports}),emitter:w,uid:w.uid};return w.on("connect",y),v.setup?.(),v}function s(m){const{info:w}=m,v=m.provider;return ce({target:{...w,id:w.rdns,provider:v}})}const l=new Map;function h(m={}){const w=m.chainId??g.getState().chainId,v=d.getState().find(I=>I.id===w);if(m.chainId&&!v)throw new z;{const I=l.get(g.getState().chainId);if(I&&!v)return I;if(!v)throw new z}{const I=l.get(w);if(I)return I}let A;if(c.client)A=c.client({chain:v});else{const I=v.id,T=d.getState().map(k=>k.id),U={},we=Object.entries(c);for(const[k,q]of we)if(!(k==="chains"||k==="client"||k==="connectors"||k==="transports"))if(typeof q=="object")if(I in q)U[k]=q[I];else{if(T.some(xe=>xe in q))continue;U[k]=q}else U[k]=q;A=Oe({...U,chain:v,batch:U.batch??{multicall:!0},transport:k=>c.transports[I]({...k,connectors:a})})}return l.set(w,A),A}function f(){return{chainId:d.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let p;const C="0.0.0-canary-";ne.startsWith(C)?p=Number.parseInt(ne.replace(C,""),10):p=Number.parseInt(ne.split(".")[0]??"0",10);const g=he(Ut(t?xt(f,{migrate(m,w){if(w===p)return m;const v=f(),A=N(m,v.chainId);return{...v,chainId:A}},name:"store",partialize(m){return{connections:{__type:"Map",value:Array.from(m.connections.entries()).map(([w,v])=>{const{id:A,name:I,type:T,uid:U}=v.connector;return[w,{...v,connector:{id:A,name:I,type:T,uid:U}}]})},chainId:m.chainId,current:m.current}},merge(m,w){typeof m=="object"&&m&&"status"in m&&delete m.status;const v=N(m,w.chainId);return{...w,...m,chainId:v}},skipHydration:i,storage:t,version:p}):f));g.setState(f());function N(m,w){return m&&typeof m=="object"&&"chainId"in m&&typeof m.chainId=="number"&&d.getState().some(v=>v.id===m.chainId)?m.chainId:w}n&&g.subscribe(({connections:m,current:w})=>w?m.get(w)?.chainId:void 0,m=>{if(d.getState().some(v=>v.id===m))return g.setState(v=>({...v,chainId:m??v.chainId}))}),u?.subscribe(m=>{const w=new Set,v=new Set;for(const I of a.getState())if(w.add(I.id),I.rdns){const T=typeof I.rdns=="string"?[I.rdns]:I.rdns;for(const U of T)v.add(U)}const A=[];for(const I of m){if(v.has(I.info.rdns))continue;const T=r(s(I));w.has(T.id)||A.push(T)}t&&!g.persist.hasHydrated()||a.setState(I=>[...I,...A],!0)});function b(m){g.setState(w=>{const v=w.connections.get(m.uid);return v?{...w,connections:new Map(w.connections).set(m.uid,{accounts:m.accounts??v.accounts,chainId:m.chainId??v.chainId,connector:v.connector})}:w})}function y(m){g.getState().status==="connecting"||g.getState().status==="reconnecting"||g.setState(w=>{const v=a.getState().find(A=>A.uid===m.uid);return v?(v.emitter.listenerCount("connect")&&v.emitter.off("connect",b),v.emitter.listenerCount("change")||v.emitter.on("change",b),v.emitter.listenerCount("disconnect")||v.emitter.on("disconnect",P),{...w,connections:new Map(w.connections).set(m.uid,{accounts:m.accounts,chainId:m.chainId,connector:v}),current:m.uid,status:"connected"}):w})}function P(m){g.setState(w=>{const v=w.connections.get(m.uid);if(v){const I=v.connector;I.emitter.listenerCount("change")&&v.connector.emitter.off("change",b),I.emitter.listenerCount("disconnect")&&v.connector.emitter.off("disconnect",P),I.emitter.listenerCount("connect")||v.connector.emitter.on("connect",y)}if(w.connections.delete(m.uid),w.connections.size===0)return{...w,connections:new Map,current:null,status:"disconnected"};const A=w.connections.values().next().value;return{...w,connections:new Map(w.connections),current:A.connector.uid}})}return{get chains(){return d.getState()},get connectors(){return a.getState()},storage:t,getClient:h,get state(){return g.getState()},setState(m){let w;typeof m=="function"?w=m(g.getState()):w=m;const v=f();typeof w!="object"&&(w=v),Object.keys(v).some(I=>!(I in w))&&(w=v),g.setState(w,!0)},subscribe(m,w,v){return g.subscribe(m,w,v?{...v,fireImmediately:v.emitImmediately}:void 0)},_internal:{mipd:u,async revalidate(){const m=g.getState(),w=m.connections;let v=m.current;for(const[,A]of w){const I=A.connector;I.isAuthorized&&await I.isAuthorized()||(w.delete(I.uid),v===I.uid&&(v=null))}g.setState(A=>({...A,connections:w,current:v}))},store:g,ssr:!!i,syncConnectedChain:n,transports:c.transports,chains:{setState(m){const w=typeof m=="function"?m(d.getState()):m;if(w.length!==0)return d.setState(w,!0)},subscribe(m){return d.subscribe(m)}},connectors:{providerDetailToConnector:s,setup:r,setState(m){return a.setState(typeof m=="function"?m(a.getState()):m,!0)},subscribe(m){return a.subscribe(m)}},events:{change:b,connect:y,disconnect:P}}}}function Me(o){let e=[],t,n;function i(d){const a=S.getCaipNetworks(E.CHAIN.EVM);let r=Number(ge.parseEvmChainId(d));if(!a.some(s=>String(s.id)===String(d))){const s=S.getActiveCaipNetwork(E.CHAIN.EVM)?.id||a[0]?.id;s&&Number.isInteger(Number(s))&&(r=Number(s))}if(!r)throw new Error("ChainId not found in networks");return r}function c(){return t||(t=ye.getInstance({projectId:o.options.projectId,chainId:K()?.caipNetworkId,enableLogger:o.options.enableAuthLogger,onTimeout:d=>{d==="iframe_load_failed"?D.open(x.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):d==="iframe_request_timeout"?D.open(x.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):d==="unverified_domain"&&D.open(x.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},abortController:x.EmbeddedWalletAbortController,getActiveCaipNetwork:d=>K(d),getCaipNetworks:d=>S.getCaipNetworks(d)})),t}async function u(d={}){const a=c();let r=d.chainId;if(d.isReconnecting){const C=ge.parseEvmChainId(a.getLastUsedChainId()||""),g=o.chains?.[0].id;if(r=C||g,!r)throw new Error("ChainId not found in provider")}const s=ve("eip155"),{address:l,chainId:h,accounts:f}=await De.authConnectorAuthenticate({authConnector:a,chainId:r,preferredAccountType:s,socialUri:d.socialUri,chainNamespace:E.CHAIN.EVM});e=f?.map(C=>C.address)||[l];const p=i(h);return{accounts:e,account:l,chainId:p,chain:{id:p,unsupported:!1}}}return d=>({id:E.CONNECTOR_ID.AUTH,name:E.CONNECTOR_NAMES.AUTH,type:"AUTH",chain:E.CHAIN.EVM,async connect(a={}){if(n){const s=await n;return{accounts:a.withCapabilities?s.accounts.map(l=>({address:l,capabilities:{}})):s.accounts,chainId:s.chainId}}n||(n=new Promise(s=>{s(u(a))}));const r=await n;return n=void 0,{accounts:a.withCapabilities?r.accounts.map(s=>({address:s,capabilities:{}})):r.accounts,chainId:r.chainId}},async disconnect(){await(await this.getProvider()).disconnect()},getAccounts(){return e?.length?(d.emitter.emit("change",{accounts:e}),Promise.resolve(e)):Promise.resolve([])},async getProvider(){return this.provider||(this.provider=ye.getInstance({projectId:o.options.projectId,chainId:K()?.caipNetworkId,enableLogger:o.options.enableAuthLogger,abortController:x.EmbeddedWalletAbortController,onTimeout:a=>{a==="iframe_load_failed"?D.open(x.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):a==="iframe_request_timeout"?D.open(x.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):a==="unverified_domain"&&D.open(x.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:a=>K(a),getCaipNetworks:a=>S.getCaipNetworks(a)})),Promise.resolve(this.provider)},async getChainId(){const a=await this.getProvider(),{chainId:r}=await a.getChainId();return i(r)},async isAuthorized(){const r=S.state.activeChain===E.CHAIN.EVM;if(E.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(h=>qe.getConnectorId(h)===E.CONNECTOR_ID.AUTH)&&!r)return!1;const l=await this.getProvider();return Promise.resolve(l.getLoginEmailUsed())},async switchChain({chainId:a}){try{const r=d.chains.find(f=>f.id===a);if(!r)throw new B(new Error("chain not found on connector."));const s=await this.getProvider(),l=ve("eip155"),h=await s.connect({chainId:a,preferredAccountType:l});return e=h?.accounts?.map(f=>f.address)||[h.address],d.emitter.emit("change",{chainId:Number(a),accounts:e}),r}catch(r){throw r instanceof Error?new B(r):r}},onAccountsChanged(a){a.length===0?this.onDisconnect():d.emitter.emit("change",{accounts:a.map(L)})},onChainChanged(a){const r=Number(a);d.emitter.emit("change",{chainId:r})},async onDisconnect(a){await(await this.getProvider()).disconnect()}})}pe.type="walletConnect";function pe(o){const e=o.isNewChainsStale??!0;let t,n,i,c,u,d,a;return r=>({id:"walletConnect",name:"WalletConnect",type:pe.type,provider:o.universalProvider,async setup(){const s=await this.getProvider().catch(()=>null);s&&(c||(c=this.onConnect.bind(this),s.on("connect",c)),d||(d=this.onSessionDelete.bind(this),s.on("session_delete",d)))},async connect({...s}={}){try{const l=S.getCaipNetworks(),h=await this.getProvider();if(!h)throw new W;u||(u=this.onDisplayUri,h.on("display_uri",u));const f=await this.isChainsStale();h.session&&f&&await h.disconnect();const p=$.state.universalProviderConfigOverride;if(!h.session||f){const m=$e.createNamespaces(l,p);await h.connect({optionalNamespaces:m,..."pairingTopic"in s?{pairingTopic:s.pairingTopic}:{}}),this.setRequestedChainsIds(l.map(w=>Number(w.id)))}const C=await this.getAccounts(),g=await this.getChainId(),N=h.session?.namespaces?.eip155?.chains,b=N?.some(m=>Number(m.split(":")[1])===g);let y=1;b?y=g:N?.[0]&&(y=Number(N[0].split(":")[1])),u&&(h.removeListener("display_uri",u),u=void 0),c&&(h.removeListener("connect",c),c=void 0),n||(n=this.onAccountsChanged.bind(this),h.on("accountsChanged",n)),i||(i=this.onChainChanged.bind(this),h.on("chainChanged",i)),a||(a=this.onDisconnect.bind(this),h.on("disconnect",a)),d||(d=this.onSessionDelete.bind(this),h.on("session_delete",d));const P=p?.defaultChain;return h.setDefaultChain(P??`eip155:${y}`),{accounts:C,chainId:y}}catch(l){throw/(user rejected|connection request reset)/i.test(l?.message)?new _(l):l}},async disconnect(){const s=await this.getProvider();try{await s?.disconnect()}catch(l){if(!/No matching key/i.test(l.message))throw l}finally{i&&(s?.removeListener("chainChanged",i),i=void 0),a&&(s?.removeListener("disconnect",a),a=void 0),c||(c=this.onConnect.bind(this),s?.on("connect",c)),n&&(s?.removeListener("accountsChanged",n),n=void 0),d&&(s?.removeListener("session_delete",d),d=void 0),this.setRequestedChainsIds([])}},async getAccounts(){const s=await this.getProvider();if(!s?.session?.namespaces)return[];const h=s?.session?.namespaces[E.CHAIN.EVM]?.accounts?.map(C=>C.split(":")[2])??[],f=new Set;return h.filter(C=>{const g=C?.toLowerCase();return f.has(g)?!1:(f.add(g),!0)})},async getProvider({chainId:s}={}){t||(t=o.universalProvider,t?.events.setMaxListeners(Number.POSITIVE_INFINITY));const l=F.getActiveNamespace(),h=S.getActiveCaipNetwork()?.id;if(s&&h!==s&&l){const f=F.getStoredActiveCaipNetworkId(),C=(l?S.getCaipNetworks(l):[])?.find(g=>g.id===f);C&&C.chainNamespace===E.CHAIN.EVM&&await this.switchChain?.({chainId:Number(C.id)})}return t},async getChainId(){const s=S.getActiveCaipNetwork(E.CHAIN.EVM)?.id;if(s)return s;const h=(await this.getProvider()).session?.namespaces[E.CHAIN.EVM]?.chains?.[0];return S.getCaipNetworks().find(p=>p.id===h)?.id},async isAuthorized(){try{const[s,l]=await Promise.all([this.getAccounts(),this.getProvider()]);return s.length?await this.isChainsStale()&&l.session?(await l.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:s,chainId:l}){const h=await this.getProvider();if(!h)throw new W;const f=S.getCaipNetworks().find(p=>p.id===l);if(!f)throw new B(new z);try{await h.request({method:"wallet_switchEthereumChain",params:[{chainId:oe(l)}]}),f?.caipNetworkId&&h.setDefaultChain(f?.caipNetworkId),r.emitter.emit("change",{chainId:Number(l)});const p=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...p,l]),{...f,id:f.id}}catch(p){const C=p;if(/(?:user rejected)/iu.test(C.message))throw new _(C);try{let g;s?.blockExplorerUrls?g=s.blockExplorerUrls:g=f.blockExplorers?.default.url?[f.blockExplorers?.default.url]:[];const N=f.rpcUrls?.chainDefault?.http||[],b={blockExplorerUrls:g,chainId:oe(l),chainName:f.name,iconUrls:s?.iconUrls,nativeCurrency:f.nativeCurrency,rpcUrls:N};await h.request({method:"wallet_addEthereumChain",params:[b]});const y=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...y,l]),{...f,id:f.id}}catch(g){throw new _(g)}}},onAccountsChanged(s){s.length===0?this.onDisconnect():r.emitter.emit("change",{accounts:s.map(l=>L(l))})},onChainChanged(s){const l=Number(s);r.emitter.emit("change",{chainId:l})},onConnect(s){this.setRequestedChainsIds(S.getCaipNetworks().map(l=>Number(l.id)))},async onDisconnect(s){this.setRequestedChainsIds([]),r.emitter.emit("disconnect");const l=await this.getProvider();n&&(l.removeListener("accountsChanged",n),n=void 0),i&&(l.removeListener("chainChanged",i),i=void 0),a&&(l.removeListener("disconnect",a),a=void 0),d&&(l.removeListener("session_delete",d),d=void 0),c||(c=this.onConnect.bind(this),l.on("connect",c))},onDisplayUri(s){r.emitter.emit("message",{type:"display_uri",data:s})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return t?.session?.namespaces?t?.session?.namespaces[E.CHAIN.EVM]?.accounts?.map(h=>Number.parseInt(h.split(":")[1]??""))??[]:[]},async getRequestedChainsIds(){const s=await r.storage?.getItem(this.requestedChainsStorageKey)??[];return[...new Set(s)]},async isChainsStale(){if(!e)return!1;const s=r.chains.map(f=>f.id),l=this.getNamespaceChainsIds();if(l.length&&!l.some(f=>s.includes(f)))return!1;const h=await this.getRequestedChainsIds();return!s.every(f=>h.includes(Number(f)))},async setRequestedChainsIds(s){await r.storage?.setItem(this.requestedChainsStorageKey,s)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}const H=He({pendingTransactions:0}),Pe={state:H,subscribeKey(o,e){return Fe(H,o,e)},increase(o){H[o]+=1},decrease(o){H[o]-=1},reset(o){H[o]=0}};async function Jt(o){if(te.isSafeApp()){const{safe:e}=await ke(async()=>{const{safe:t}=await import("./index-DOnRCLNP.js");return{safe:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));if(e&&!o.some(t=>t.type==="safe"))return e()}return null}async function Xt(o){try{const{baseAccount:e}=await ke(async()=>{const{baseAccount:t}=await import("./index-DOnRCLNP.js");return{baseAccount:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));if(e&&!o.some(t=>t.id==="baseAccount"))return e()}catch(e){console.error("Failed to import Coinbase Wallet SDK:",e)}return null}const Qt={enable:!1,pollingInterval:3e4};class Yt extends Be{constructor(e){const t=J.extendCaipNetworks(e.networks,{projectId:e.projectId,customNetworkImageUrls:{},customRpcUrls:e.customRpcUrls});super(),this.balancePromises={},this.namespace=E.CHAIN.EVM,this.adapterType=E.ADAPTER_TYPES.WAGMI,this.projectId=e.projectId,this.pendingTransactionsFilter={...Qt,...e.pendingTransactionsFilter??{}},this.createConfig({...e,networks:t}),this.checkChainId()}construct(e){this.checkChainId(),this.setupWatchers()}async getAccounts(e){const t=this.getWagmiConnector(e.id);if(!t)return{accounts:[]};if(t.id===E.CONNECTOR_ID.AUTH){const u=await t.getProvider();if(!u?.user)return{accounts:[]};const{address:d,accounts:a,chainId:r}=u.user;return Promise.resolve({accounts:(a||[{address:d,type:"eoa"}]).map(s=>te.createAccount({caipAddress:`eip155:${r}:${s.address}`,type:s.type}))})}const{addresses:n,address:i,chainId:c}=ie(this.wagmiConfig);return Promise.resolve({accounts:c?[...new Set(n||[i])].map(u=>te.createAccount({caipAddress:`eip155:${c}:${u||""}`,type:"eoa"})):[]})}checkChainId(){const{chainId:e}=ie(this.wagmiConfig);e&&this.emit("switchNetwork",{chainId:e})}getWagmiConnector(e){return this.wagmiConfig.connectors.find(t=>t.id===e)}createConfig(e){this.wagmiChains=e.networks.filter(i=>i.chainNamespace===E.CHAIN.EVM);const t={},n=[...e.connectors??[]];this.wagmiChains.forEach(i=>{const c=e.transports?.[i.id],u=J.getCaipNetworkId(i);c?t[i.id]=J.extendWagmiTransports(i,e.projectId,c):t[i.id]=J.getViemTransport(i,e.projectId,e.customRpcUrls?.[u])}),this.wagmiConfig=Kt({...e,chains:this.wagmiChains,connectors:n,transports:t})}setupWatchPendingTransactions(){if(!this.pendingTransactionsFilter.enable||this.unwatchPendingTransactions)return;this.unwatchPendingTransactions=Tt(this.wagmiConfig,{pollingInterval:this.pendingTransactionsFilter.pollingInterval,onError:()=>{},onTransactions:()=>{this.emit("pendingTransactions"),Pe.increase("pendingTransactions")}});const e=Pe.subscribeKey("pendingTransactions",t=>{t>=E.LIMITS.PENDING_TRANSACTIONS&&(this.unwatchPendingTransactions?.(),e())})}setupWatchers(){St(this.wagmiConfig,{onChange:e=>{this.clearConnections(),this.addConnection(...e.map(t=>{const n=this.getCaipNetworks().find(c=>c.id===t.chainId),i=t.connector.id===E.CONNECTOR_ID.AUTH;return{accounts:t.accounts.map(c=>({address:this.toChecksummedAddress(c)})),caipNetwork:n,connectorId:t.connector.id,auth:i?{name:F.getConnectedSocialProvider(),username:F.getConnectedSocialUsername()}:void 0}}))}}),_t(this.wagmiConfig,{onChange:(e,t)=>{if(e.status==="disconnected"&&t.address&&this.emit("disconnect"),e?.chainId&&e?.chainId!==t?.chainId&&this.emit("switchNetwork",{chainId:e.chainId}),e.status==="connected"){const n=e.address!==t?.address,i=e.connector.id!==t.connector?.id,c=t.status!=="connected";(n||i||c)&&(this.setupWatchPendingTransactions(),this.handleAccountChanged({address:e.address,chainId:e.chainId,connector:e.connector}))}}})}async addThirdPartyConnectors(){const e=[],{enableCoinbase:t}=$.state||{};if(t!==!1){const i=await Xt(this.wagmiConfig.connectors);i&&e.push(i)}const n=await Jt(this.wagmiConfig.connectors);n&&e.push(n),await Promise.all(e.map(i=>{const c=this.configureInternalConnector(i);return this.addWagmiConnector(c)}))}addWagmiConnectors(){const e=[];$.state.enableInjected!==!1&&e.push(ce({shimDisconnect:!0}));const{features:t,remoteFeatures:n,projectId:i,enableAuthLogger:c}=$.state,u=n?.email??t?.email??!0,d=n?.socials??t?.socials,a=Array.isArray(d)&&d?.length>0;(u||a)&&e.push(Me({chains:this.wagmiChains,options:{projectId:i,enableAuthLogger:c}})),e.forEach(r=>{this.configureInternalConnector(r)})}configureInternalConnector(e){const t=this.wagmiConfig._internal.connectors.setup(e);return this.wagmiConfig._internal.connectors.setState(n=>[...n,t]),t}async handleAccountChanged({address:e,chainId:t,connector:n}){if(!this.namespace)throw new Error("WagmiAdapter:handleAccountChanged - namespace is required");const i=await n.getProvider().catch(()=>{});this.emit("accountChanged",{address:this.toChecksummedAddress(e),chainId:t,connector:{id:n.id,name:j.ConnectorNamesMap[n.id]??n.name,imageId:j.ConnectorImageIds[n.id],type:j.ConnectorTypesMap[n.type]??"EXTERNAL",info:n.id===E.CONNECTOR_ID.INJECTED?void 0:{rdns:n.id},provider:i,chain:this.namespace,chains:[]}})}async writeSolanaTransaction(){return Promise.resolve({hash:""})}async signMessage(e){try{return{signature:await Et(this.wagmiConfig,{message:e.message,account:e.address})}}catch{throw new Error("WagmiAdapter:signMessage - Sign message failed")}}async sendTransaction(e){const{chainId:t,address:n}=ie(this.wagmiConfig),i=this.wagmiChains?.find(d=>d.id===t),c={account:n,to:e.to,value:Number.isNaN(Number(e.value))?BigInt(0):BigInt(e.value),gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,data:e.data,chain:i,type:"legacy",parameters:["nonce"]};await It(this.wagmiConfig,c);const u=await bt(this.wagmiConfig,c);return await Nt(this.wagmiConfig,{hash:u,timeout:25e3}),{hash:u}}async writeContract(e){const{caipNetwork:t,...n}=e,i=Number(ge.caipNetworkIdToNumber(t.caipNetworkId)),c=this.wagmiChains?.find(d=>d.id===i);return{hash:await kt(this.wagmiConfig,{chain:c,address:n.tokenAddress,account:n.fromAddress,abi:n.abi,functionName:n.method,args:n.args,__mode:"prepared"})}}async estimateGas(e){try{return{gas:await vt(this.wagmiConfig,{account:e.address,to:e.to,data:e.data,type:"legacy"})}}catch{throw new Error("WagmiAdapter:estimateGas - error estimating gas")}}parseUnits(e){return at(e.value,e.decimals)}formatUnits(e){return Xe(e.value,e.decimals)}async addWagmiConnector(e){if(!this.namespace)throw new Error("WagmiAdapter:addWagmiConnector - namespace is required");const{enableEIP6963:t}=$.state||{};if(e.type===E.CONNECTOR_ID.INJECTED&&t===!1||e.id===E.CONNECTOR_ID.AUTH||e.id===E.CONNECTOR_ID.WALLET_CONNECT)return;let n;e.id!==E.CONNECTOR_ID.BASE_ACCOUNT&&(n=await e.getProvider().catch(()=>{}));const i=ze.state.connectorImages;this.addConnector({id:e.id,explorerId:j.ConnectorExplorerIds[e.id]??j.ConnectorExplorerIds[e.name],imageUrl:i?.[e.id]??e.icon,name:j.ConnectorNamesMap[e.id]??e.name,imageId:j.ConnectorImageIds[e.id],type:j.ConnectorTypesMap[e.type]??"EXTERNAL",info:e.id===E.CONNECTOR_ID.INJECTED?void 0:{rdns:e.id},provider:n,chain:this.namespace,chains:[]})}async syncConnectors(){Pt(this.wagmiConfig,{onChange:e=>{e.forEach(t=>this.addWagmiConnector(t))}}),this.addWagmiConnectors(),await Promise.all(this.wagmiConfig.connectors.map(e=>this.addWagmiConnector(e))),await this.addThirdPartyConnectors()}async syncConnections(){const e=this.connectors.filter(t=>{const{hasDisconnected:n,hasConnected:i}=X.getConnectorStorageInfo(t.id,this.namespace);return!n&&i}).map(t=>this.getWagmiConnector(t.id)).filter(Boolean);await le(this.wagmiConfig,{connectors:e})}async syncConnection(e){const{id:t,chainId:n}=e,c=M(this.wagmiConfig).find(r=>r.connector.id===t),d=await this.getWagmiConnector(t)?.getProvider();if(te.isSafeApp()&&t===E.CONNECTOR_ID.SAFE&&!c?.accounts.length){const r=this.getWagmiConnector("safe");if(r){const s=await de(this.wagmiConfig,{connector:r,chainId:Number(n)}),l=await r.getProvider();return{chainId:Number(n),address:this.toChecksummedAddress(s.accounts[0]),provider:l,type:c?.connector.type?.toUpperCase(),id:c?.connector.id}}}return{chainId:Number(c?.chainId),address:this.toChecksummedAddress(c?.accounts[0]),provider:d,type:c?.connector.type?.toUpperCase(),id:c?.connector.id}}async connectWalletConnect(e){try{const t=this.getWalletConnectConnector();await t.authenticate();const n=this.getWagmiConnector("walletConnect");if(!n)throw new Error("UniversalAdapter:connectWalletConnect - connector not found");const i=await de(this.wagmiConfig,{connector:n,chainId:e?Number(e):void 0});return i.chainId!==Number(e)&&await Ee(this.wagmiConfig,{chainId:i.chainId}),{clientId:await t.provider.client.core.crypto.getClientId()}}catch(t){throw t instanceof _?new Q(t):Ie.isUserRejectedRequestError(t)?new Q(t):t}}async connect(e){try{const{id:t,address:n,provider:i,type:c,info:u,chainId:d,socialUri:a}=e,r=this.getWagmiConnector(t);if(!r)throw new Error("connectionControllerClient:connectExternal - connector is undefined");i&&u&&r.id===E.CONNECTOR_ID.EIP6963&&r.setEip6963Wallet?.({provider:i,info:u});const s=this.wagmiConfig.state?.connections?.get(r.uid);if(s){await this.wagmiConfig.storage?.setItem("recentConnectorId",r.id);const f=[...s.accounts].sort((p,C)=>X.isLowerCaseMatch(p,n)?-1:X.isLowerCaseMatch(C,n)?1:0);return this.wagmiConfig?.setState(p=>({...p,connections:new Map(p.connections).set(r.uid,{accounts:f,chainId:s.chainId,connector:s.connector}),current:r.uid,status:"connected"})),{address:this.toChecksummedAddress(f[0]),chainId:s.chainId,provider:i,type:c,id:t}}const l=await de(this.wagmiConfig,{connector:r,chainId:d?Number(d):void 0,socialUri:a}),h=i??await r.getProvider();return{address:this.toChecksummedAddress(l.accounts[0]),chainId:l.chainId,provider:h,type:c,id:t}}catch(t){throw t instanceof _?new Q(t):Ie.isUserRejectedRequestError(t)?new Q(t):t}}get connections(){return Array.from(this.wagmiConfig.state.connections.values()).map(e=>({accounts:e.accounts.map(t=>({address:this.toChecksummedAddress(t)})),connectorId:e.connector.id}))}async reconnect(e){const{id:t}=e,n=this.getWagmiConnector(t);if(!n)throw new Error("connectionControllerClient:connectExternal - connector is undefined");await le(this.wagmiConfig,{connectors:[n]})}async getBalance(e){const t=e.address,n=this.getCaipNetworks().find(i=>i.id===e.chainId);if(!t)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(n&&this.wagmiConfig){const i=`${n.caipNetworkId}:${e.address}`,c=this.balancePromises[i];if(c)return c;const u=F.getNativeBalanceCacheForCaipAddress(i);return u?{balance:u.balance,symbol:u.symbol}:(this.balancePromises[i]=new Promise(async d=>{try{const a=Number(e.chainId),r=await yt(this.wagmiConfig,{address:e.address,chainId:a,token:e.tokens?.[n.caipNetworkId]?.address});F.updateNativeBalanceCache({caipAddress:i,balance:r.formatted,symbol:r.symbol,timestamp:Date.now()}),d({balance:r.formatted,symbol:r.symbol})}catch(a){console.warn("Appkit:WagmiAdapter:getBalance - Error getting balance",a),d({balance:"0.00",symbol:"ETH"})}}).finally(()=>{delete this.balancePromises[i]}),this.balancePromises[i]||{balance:"0.00",symbol:"ETH"})}return{balance:"",symbol:""}}getWalletConnectProvider(){return this.getWagmiConnector("walletConnect")?.provider}async disconnect(e){if(e.id){const t=this.getWagmiConnector(e.id),i=M(this.wagmiConfig).find(c=>X.isLowerCaseMatch(c.connector.id,e.id));return await be(this.wagmiConfig,{connector:t}),$.state.enableReconnect===!1&&this.deleteConnection(e.id),i?{connections:[{accounts:i.accounts.map(c=>({address:this.toChecksummedAddress(c)})),connectorId:i.connector.id}]}:{connections:[]}}return this.disconnectAll()}async disconnectAll(){const e=M(this.wagmiConfig),t=await Promise.allSettled(e.map(async n=>{const i=this.getWagmiConnector(n.connector.id);return i&&await be(this.wagmiConfig,{connector:i}),n}));return this.wagmiConfig.state.connections.clear(),{connections:t.filter(n=>n.status==="fulfilled").map(({value:n})=>({accounts:n.accounts.map(i=>({address:this.toChecksummedAddress(i)})),connectorId:n.connector.id}))}}async switchNetwork(e){const{caipNetwork:t}=e,n=this.wagmiConfig.chains.find(f=>f.id.toString()===t.id.toString());if(!n)throw new Error("connectionControllerClient:switchNetwork - wagmiChain is undefined");const{name:i,nativeCurrency:c,rpcUrls:u,blockExplorers:d,id:a}=n,r=t.rpcUrls?.chainDefault?.http?.[0]??u.default.http[0]??"",s=d?.default.url??t.blockExplorers?.default?.url??"",l=c??t.nativeCurrency,h=i??t.name;await Ee(this.wagmiConfig,{chainId:a,addEthereumChainParameter:{chainName:h,nativeCurrency:l,rpcUrls:[r],blockExplorerUrls:[s]}}),await super.switchNetwork(e)}async getCapabilities(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:getCapabilities - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:getCapabilities - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:getCapabilities - provider is undefined");return await c.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:grantPermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:grantPermissions - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:grantPermissions - provider is undefined");return c.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:revokePermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:revokePermissions - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:revokePermissions - provider is undefined");return c.request({method:"wallet_revokePermissions",params:e})}async walletGetAssets(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:walletGetAssets - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:walletGetAssets - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:walletGetAssets - provider is undefined");return c.request({method:"wallet_getAssets",params:[e]})}setAuthProvider(e){if(!this.namespace)throw new Error("WagmiAdapter:setAuthProvider - namespace is required");this.addConnector({id:E.CONNECTOR_ID.AUTH,type:"AUTH",name:E.CONNECTOR_NAMES.AUTH,provider:e,imageId:j.ConnectorImageIds[E.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}async setUniversalProvider(e){e.on("connect",()=>{const n=M(this.wagmiConfig),i=this.getWagmiConnector("walletConnect");if(i&&!n.find(c=>c.connector.id===i.id)){if(S.state.activeChain==="eip155")return;le(this.wagmiConfig,{connectors:[i]})}});const t=pe({universalProvider:e});return this.configureInternalConnector(t),this.addConnector(new Ve({provider:e,caipNetworks:this.getCaipNetworks(),namespace:"eip155"})),Promise.resolve()}toChecksummedAddress(e){return et(e.toLowerCase())}}const ln=Object.freeze(Object.defineProperty({__proto__:null,WagmiAdapter:Yt,authConnector:Me},Symbol.toStringTag,{value:"Module"}));export{z as C,W as P,mt as a,ln as b,un as c,ce as i};
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-DT1PkdGa.js","assets/index-CqbvjyBi.js","assets/index-Bzi38pjx.css","assets/parseEventLogs-BxtEI7tW.js","assets/NetworkUtil-DM5H1DOt.js","assets/sha2-D3ryOfi3.js","assets/sha256-D33fGSQc.js","assets/W3MFrameProviderSingleton-dGwr0u32.js","assets/index-CYBDya_s.js","assets/browser-ponyfill-LG9Rjmfj.js","assets/custom-BbQhcg55.js","assets/store-DOLZnwHk.js","assets/writeContract-C9KDDivM.js"])))=>i.map(i=>d[i]);
2
+ import{w as We,a as Le,l as ve,C as S,o as qe,a5 as ye,F as x,a6 as K,A as D,Z as De,t as F,O as $,a7 as $e,e as Fe,p as He,b as te,a8 as Be,a9 as J,aa as j,L as ze,a3 as X,ab as Q,Q as Ie,ac as Ve}from"./W3MFrameProviderSingleton-dGwr0u32.js";import{ak as Ge,an as Ke,aa as Je,w as B,ae as oe,X as _,r as ae,ap as E,ax as ge,a3 as Xe}from"./NetworkUtil-DM5H1DOt.js";import{bg as Te,aI as L,cg as Qe,bc as Ye,b7 as Ze,ah as et}from"./parseEventLogs-BxtEI7tW.js";import"./index-CYBDya_s.js";import{g as tt,_ as ke}from"./index-CqbvjyBi.js";import"./browser-ponyfill-LG9Rjmfj.js";import{c as nt}from"./store-DOLZnwHk.js";import{c as Oe,a as it,g as rt,b as ot,d as st,e as ct,p as at}from"./custom-BbQhcg55.js";import{A as dt,s as ut,w as lt}from"./writeContract-C9KDDivM.js";async function ht(o,{account:e=o.account,message:t}){if(!e)throw new dt({docsPath:"/docs/actions/wallet/signMessage"});const n=Te(e);if(n.signMessage)return n.signMessage({message:t});const i=typeof t=="string"?Ge(t):t.raw instanceof Uint8Array?Ke(t.raw):t.raw;return o.request({method:"personal_sign",params:[i,n.address]},{retryCount:0})}function R(o,e,t){const n=o[e.name];if(typeof n=="function")return n;const i=o[t];return typeof i=="function"?i:c=>e(o,c)}const ne="3.4.11",ft=()=>`@wagmi/core@${ne}`;var Re=function(o,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?o!==e||!n:!e.has(o))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(o):n?n.value:e.get(o)},se,Ue;class O extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return ft()}constructor(e,t={}){super(),se.add(this),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,"name",{enumerable:!0,configurable:!0,writable:!0,value:"WagmiCoreError"});const n=t.cause instanceof O?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof O&&t.cause.docsPath||t.docsPath;this.message=[e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: ${this.docsBaseUrl}${i}.html${t.docsSlug?`#${t.docsSlug}`:""}`]:[],...n?[`Details: ${n}`]:[],`Version: ${this.version}`].join(`
3
+ `),t.cause&&(this.cause=t.cause),this.details=n,this.docsPath=i,this.metaMessages=t.metaMessages,this.shortMessage=e}walk(e){return Re(this,se,"m",Ue).call(this,this,e)}}se=new WeakSet,Ue=function o(e,t){return t?.(e)?e:e.cause?Re(this,se,"m",o).call(this,e.cause,t):e};class z extends O{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}class gt extends O{constructor(){super("Connector already connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAlreadyConnectedError"})}}class mt extends O{constructor(){super("Connector not connected."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorNotConnectedError"})}}class Ct extends O{constructor({address:e,connector:t}){super(`Account "${e}" not found for connector "${t.name}".`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorAccountNotFoundError"})}}class pt extends O{constructor({connectionChainId:e,connectorChainId:t}){super(`The current chain of the connector (id: ${t}) does not match the connection's chain (id: ${e}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e}`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorChainMismatchError"})}}class wt extends O{constructor({connector:e}){super(`Connector "${e.name}" unavailable while reconnecting.`,{details:["During the reconnection step, the only connector methods guaranteed to be available are: `id`, `name`, `type`, `uid`.","All other methods are not guaranteed to be available until reconnection completes and connectors are fully restored.","This error commonly occurs for connectors that asynchronously inject after reconnection has already started."].join(" ")}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ConnectorUnavailableReconnectingError"})}}async function de(o,e){let t;if(typeof e.connector=="function"?t=o._internal.connectors.setup(e.connector):t=e.connector,t.uid===o.state.current)throw new gt;try{o.setState(u=>({...u,status:"connecting"})),t.emitter.emit("message",{type:"connecting"});const{connector:n,...i}=e,c=await t.connect(i);return t.emitter.off("connect",o._internal.events.connect),t.emitter.on("change",o._internal.events.change),t.emitter.on("disconnect",o._internal.events.disconnect),await o.storage?.setItem("recentConnectorId",t.id),o.setState(u=>({...u,connections:new Map(u.connections).set(t.uid,{accounts:i.withCapabilities?c.accounts.map(d=>typeof d=="object"?d.address:d):c.accounts,chainId:c.chainId,connector:t}),current:t.uid,status:"connected"})),{accounts:i.withCapabilities?c.accounts.map(u=>typeof u=="object"?u:{address:u,capabilities:{}}):c.accounts,chainId:c.chainId}}catch(n){throw o.setState(i=>({...i,status:i.current?"connected":"disconnected"})),n}}async function G(o,e={}){const{assertChainId:t=!0}=e;let n;if(e.connector){const{connector:s}=e;if(o.state.status==="reconnecting"&&!s.getAccounts&&!s.getChainId)throw new wt({connector:s});const[l,h]=await Promise.all([s.getAccounts().catch(f=>{if(e.account===null)return[];throw f}),s.getChainId()]);n={accounts:l,chainId:h,connector:s}}else n=o.state.connections.get(o.state.current);if(!n)throw new mt;const i=e.chainId??n.chainId,c=await n.connector.getChainId();if(t&&c!==i)throw new pt({connectionChainId:i,connectorChainId:c});const u=n.connector;if(u.getClient)return u.getClient({chainId:i});const d=Te(e.account??n.accounts[0]);if(d&&(d.address=L(d.address)),e.account&&!n.accounts.some(s=>s.toLowerCase()===d.address.toLowerCase()))throw new Ct({address:d.address,connector:u});const a=o.chains.find(s=>s.id===i),r=await n.connector.getProvider({chainId:i});return Oe({account:d,chain:a,name:"Connector Client",transport:s=>it(r)({...s,retryCount:0})})}async function be(o,e={}){let t;if(e.connector)t=e.connector;else{const{connections:i,current:c}=o.state;t=i.get(c)?.connector}const n=o.state.connections;t&&(await t.disconnect(),t.emitter.off("change",o._internal.events.change),t.emitter.off("disconnect",o._internal.events.disconnect),t.emitter.on("connect",o._internal.events.connect),n.delete(t.uid)),o.setState(i=>{if(n.size===0)return{...i,connections:new Map,current:null,status:"disconnected"};const c=n.values().next().value;return{...i,connections:new Map(n),current:c.connector.uid}});{const i=o.state.current;if(!i)return;const c=o.state.connections.get(i)?.connector;if(!c)return;await o.storage?.setItem("recentConnectorId",c.id)}}async function vt(o,e){const{chainId:t,connector:n,...i}=e;let c;e.account?c=e.account:c=(await G(o,{account:e.account,assertChainId:!1,chainId:t,connector:n})).account;const u=o.getClient({chainId:t});return R(u,Qe,"estimateGas")({...i,account:c})}async function yt(o,e){const{address:t,blockNumber:n,blockTag:i,chainId:c}=e,u=o.getClient({chainId:c}),a=await R(u,rt,"getBalance")(n?{address:t,blockNumber:n}:{address:t,blockTag:i}),r=o.chains.find(s=>s.id===c)??u.chain;return{decimals:r.nativeCurrency.decimals,symbol:r.nativeCurrency.symbol,value:a}}function V(o,e){if(o===e)return!0;if(o&&e&&typeof o=="object"&&typeof e=="object"){if(o.constructor!==e.constructor)return!1;let t,n;if(Array.isArray(o)&&Array.isArray(e)){if(t=o.length,t!==e.length)return!1;for(n=t;n--!==0;)if(!V(o[n],e[n]))return!1;return!0}if(typeof o.valueOf=="function"&&o.valueOf!==Object.prototype.valueOf)return o.valueOf()===e.valueOf();if(typeof o.toString=="function"&&o.toString!==Object.prototype.toString)return o.toString()===e.toString();const i=Object.keys(o);if(t=i.length,t!==Object.keys(e).length)return!1;for(n=t;n--!==0;)if(!Object.hasOwn(e,i[n]))return!1;for(n=t;n--!==0;){const c=i[n];if(c&&!V(o[c],e[c]))return!1}return!0}return o!==o&&e!==e}function ie(o){const e=o.state.current,t=o.state.connections.get(e),n=t?.accounts,i=n?.[0],c=o.chains.find(d=>d.id===t?.chainId),u=o.state.status;switch(u){case"connected":return{address:i,addresses:n,chain:c,chainId:t?.chainId,connector:t?.connector,isConnected:!0,isConnecting:!1,isDisconnected:!1,isReconnecting:!1,status:u};case"reconnecting":return{address:i,addresses:n,chain:c,chainId:t?.chainId,connector:t?.connector,isConnected:!!i,isConnecting:!1,isDisconnected:!1,isReconnecting:!0,status:u};case"connecting":return{address:i,addresses:n,chain:c,chainId:t?.chainId,connector:t?.connector,isConnected:!1,isConnecting:!0,isDisconnected:!1,isReconnecting:!1,status:u};case"disconnected":return{address:void 0,addresses:void 0,chain:void 0,chainId:void 0,connector:void 0,isConnected:!1,isConnecting:!1,isDisconnected:!0,isReconnecting:!1,status:u}}}let Y=[];function M(o){const e=[...o.state.connections.values()];return o.state.status==="reconnecting"||V(Y,e)?Y:(Y=e,e)}async function It(o,e){const{account:t,chainId:n,...i}=e;let c;t?c=t:c=(await G(o,{account:t,assertChainId:!1,chainId:n})).account;const u=o.getClient({chainId:n});return R(u,Ye,"prepareTransactionRequest")({...i,...c?{account:c}:{}})}let ue=!1;async function le(o,e={}){if(ue)return[];ue=!0,o.setState(r=>({...r,status:r.current?"reconnecting":"connecting"}));const t=[];if(e.connectors?.length)for(const r of e.connectors){let s;typeof r=="function"?s=o._internal.connectors.setup(r):s=r,t.push(s)}else t.push(...o.connectors);let n;try{n=await o.storage?.getItem("recentConnectorId")}catch{}const i={};for(const[,r]of o.state.connections)i[r.connector.id]=1;n&&(i[n]=0);const c=Object.keys(i).length>0?[...t].sort((r,s)=>(i[r.id]??10)-(i[s.id]??10)):t;let u=!1;const d=[],a=[];for(const r of c){const s=await r.getProvider().catch(()=>{});if(!s||a.some(f=>f===s)||!await r.isAuthorized())continue;const h=await r.connect({isReconnecting:!0}).catch(()=>null);h&&(r.emitter.off("connect",o._internal.events.connect),r.emitter.on("change",o._internal.events.change),r.emitter.on("disconnect",o._internal.events.disconnect),o.setState(f=>{const p=new Map(u?f.connections:new Map).set(r.uid,{accounts:h.accounts,chainId:h.chainId,connector:r});return{...f,current:u?f.current:r.uid,connections:p}}),d.push({accounts:h.accounts,chainId:h.chainId,connector:r}),a.push(s),u=!0)}return(o.state.status==="reconnecting"||o.state.status==="connecting")&&(u?o.setState(r=>({...r,status:"connected"})):o.setState(r=>({...r,connections:new Map,current:null,status:"disconnected"}))),ue=!1,d}async function bt(o,e){const{account:t,chainId:n,connector:i,...c}=e;let u;typeof t=="object"&&t?.type==="local"?u=o.getClient({chainId:n}):u=await G(o,{account:t??void 0,assertChainId:!1,chainId:n,connector:i});const d=!n||u.chain?.id===n?u.chain:{id:n};return await R(u,ut,"sendTransaction")({...c,...t?{account:t}:{},assertChainId:!!n,chain:d,gas:c.gas??void 0})}async function Et(o,e){const{account:t,connector:n,...i}=e;let c;return typeof t=="object"&&t.type==="local"?c=o.getClient():c=await G(o,{account:t,connector:n}),R(c,ht,"signMessage")({...i,...t?{account:t}:{}})}class W extends O{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}class At extends O{constructor({connector:e}){super(`"${e.name}" does not support programmatic chain switching.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SwitchChainNotSupportedError"})}}async function Ee(o,e){const{addEthereumChainParameter:t,chainId:n}=e,i=o.state.connections.get(e.connector?.uid??o.state.current);if(i){const u=i.connector;if(!u.switchChain)throw new At({connector:u});return await u.switchChain({addEthereumChainParameter:t,chainId:n})}const c=o.chains.find(u=>u.id===n);if(!c)throw new z;return o.setState(u=>({...u,chainId:n})),c}async function Nt(o,e){const{chainId:t,timeout:n=0,...i}=e,c=o.getClient({chainId:t}),d=await R(c,ot,"waitForTransactionReceipt")({...i,timeout:n});if(d.status==="reverted"){const a=R(c,st,"getTransaction"),{from:r,...s}=await a({hash:d.transactionHash}),h=await R(c,Ze,"call")({...s,account:r,data:s.input,gasPrice:s.type!=="eip1559"?s.gasPrice:void 0,maxFeePerGas:s.type==="eip1559"?s.maxFeePerGas:void 0,maxPriorityFeePerGas:s.type==="eip1559"?s.maxPriorityFeePerGas:void 0}),f=h?.data?Je(`0x${h.data.substring(138)}`):"unknown reason";throw new Error(f)}return{...d,chainId:c.chain.id}}function _t(o,e){const{onChange:t}=e;return o.subscribe(()=>ie(o),t,{equalityFn(n,i){const{connector:c,...u}=n,{connector:d,...a}=i;return V(u,a)&&c?.id===d?.id&&c?.uid===d?.uid}})}function St(o,e){const{onChange:t}=e;return o.subscribe(()=>M(o),t,{equalityFn:V})}function Pt(o,e){const{onChange:t}=e;return o._internal.connectors.subscribe((n,i)=>{t(Object.values(n),i)})}function Tt(o,e){const{syncConnectedChain:t=o._internal.syncConnectedChain,...n}=e;let i;const c=a=>{i&&i();const r=o.getClient({chainId:a});return i=R(r,ct,"watchPendingTransactions")(n),i},u=c(e.chainId);let d;return t&&!e.chainId&&(d=o.subscribe(({chainId:a})=>a,async a=>c(a))),()=>{u?.(),d?.()}}async function kt(o,e){const{account:t,chainId:n,connector:i,...c}=e;let u;typeof t=="object"&&t?.type==="local"?u=o.getClient({chainId:n}):u=await G(o,{account:t??void 0,assertChainId:!1,chainId:n,connector:i});const d=!n||u.chain?.id===n?u.chain:{id:n};return await R(u,lt,"writeContract")({...c,...t?{account:t}:{},assertChainId:!!n,chain:d})}function un(o){return o}ce.type="injected";function ce(o={}){const{shimDisconnect:e=!0,unstable_shimAsyncInject:t}=o;function n(){const a=o.target;if(typeof a=="function"){const r=a();if(r)return r}return typeof a=="object"?a:typeof a=="string"?{...Ot[a]??{id:a,name:`${a[0].toUpperCase()}${a.slice(1)}`,provider:`is${a[0].toUpperCase()}${a.slice(1)}`}}:{id:"injected",name:"Injected",provider(r){return r?.ethereum}}}let i,c,u,d;return a=>({get icon(){return n().icon},get id(){return n().id},get name(){return n().name},type:ce.type,async setup(){const r=await this.getProvider();r?.on&&o.target&&(u||(u=this.onConnect.bind(this),r.on("connect",u)),i||(i=this.onAccountsChanged.bind(this),r.on("accountsChanged",i)))},async connect({chainId:r,isReconnecting:s,withCapabilities:l}={}){const h=await this.getProvider();if(!h)throw new W;let f=[];if(s)f=await this.getAccounts().catch(()=>[]);else if(e)try{f=(await h.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(C=>L(C)),f.length>0&&(f=await this.getAccounts())}catch(p){const C=p;if(C.code===_.code)throw new _(C);if(C.code===ae.code)throw C}try{!f?.length&&!s&&(f=(await h.request({method:"eth_requestAccounts"})).map(g=>L(g))),u&&(h.removeListener("connect",u),u=void 0),i||(i=this.onAccountsChanged.bind(this),h.on("accountsChanged",i)),c||(c=this.onChainChanged.bind(this),h.on("chainChanged",c)),d||(d=this.onDisconnect.bind(this),h.on("disconnect",d));let p=await this.getChainId();return r&&p!==r&&(p=(await this.switchChain({chainId:r}).catch(g=>{if(g.code===_.code)throw g;return{id:p}}))?.id??p),e&&await a.storage?.removeItem(`${this.id}.disconnected`),o.target||await a.storage?.setItem("injected.connected",!0),{accounts:l?f.map(C=>({address:C,capabilities:{}})):f,chainId:p}}catch(p){const C=p;throw C.code===_.code?new _(C):C.code===ae.code?new ae(C):C}},async disconnect(){const r=await this.getProvider();if(!r)throw new W;c&&(r.removeListener("chainChanged",c),c=void 0),d&&(r.removeListener("disconnect",d),d=void 0),u||(u=this.onConnect.bind(this),r.on("connect",u));try{await Le(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}e&&await a.storage?.setItem(`${this.id}.disconnected`,!0),o.target||await a.storage?.removeItem("injected.connected")},async getAccounts(){const r=await this.getProvider();if(!r)throw new W;return(await r.request({method:"eth_accounts"})).map(l=>L(l))},async getChainId(){const r=await this.getProvider();if(!r)throw new W;const s=await r.request({method:"eth_chainId"});return Number(s)},async getProvider(){if(typeof window>"u")return;let r;const s=n();return typeof s.provider=="function"?r=s.provider(window):typeof s.provider=="string"?r=re(window,s.provider):r=s.provider,r&&!r.removeListener&&("off"in r&&typeof r.off=="function"?r.removeListener=r.off:r.removeListener=()=>{}),r},async isAuthorized(){try{if(e&&await a.storage?.getItem(`${this.id}.disconnected`)||!o.target&&!await a.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(t!==void 0&&t!==!1){const h=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",h),!!await this.getProvider()),f=typeof t=="number"?t:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(C=>window.addEventListener("ethereum#initialized",()=>C(h()),{once:!0}))]:[],new Promise(C=>setTimeout(()=>C(h()),f))]))return!0}throw new W}return!!(await We(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:r,chainId:s}){const l=await this.getProvider();if(!l)throw new W;const h=a.chains.find(p=>p.id===s);if(!h)throw new B(new z);const f=new Promise(p=>{const C=(g=>{"chainId"in g&&g.chainId===s&&(a.emitter.off("change",C),p())});a.emitter.on("change",C)});try{return await Promise.all([l.request({method:"wallet_switchEthereumChain",params:[{chainId:oe(s)}]}).then(async()=>{await this.getChainId()===s&&a.emitter.emit("change",{chainId:s})}),f]),h}catch(p){const C=p;if(C.code===4902||C?.data?.originalError?.code===4902)try{const{default:g,...N}=h.blockExplorers??{};let b;r?.blockExplorerUrls?b=r.blockExplorerUrls:g&&(b=[g.url,...Object.values(N).map(m=>m.url)]);let y;r?.rpcUrls?.length?y=r.rpcUrls:y=[h.rpcUrls.default?.http[0]??""];const P={blockExplorerUrls:b,chainId:oe(s),chainName:r?.chainName??h.name,iconUrls:r?.iconUrls,nativeCurrency:r?.nativeCurrency??h.nativeCurrency,rpcUrls:y};return await Promise.all([l.request({method:"wallet_addEthereumChain",params:[P]}).then(async()=>{if(await this.getChainId()===s)a.emitter.emit("change",{chainId:s});else throw new _(new Error("User rejected switch after adding network."))}),f]),h}catch(g){throw new _(g)}throw C.code===_.code?new _(C):new B(C)}},async onAccountsChanged(r){if(r.length===0)this.onDisconnect();else if(a.emitter.listenerCount("connect")){const s=(await this.getChainId()).toString();this.onConnect({chainId:s}),e&&await a.storage?.removeItem(`${this.id}.disconnected`)}else a.emitter.emit("change",{accounts:r.map(s=>L(s))})},onChainChanged(r){const s=Number(r);a.emitter.emit("change",{chainId:s})},async onConnect(r){const s=await this.getAccounts();if(s.length===0)return;const l=Number(r.chainId);a.emitter.emit("connect",{accounts:s,chainId:l});const h=await this.getProvider();h&&(u&&(h.removeListener("connect",u),u=void 0),i||(i=this.onAccountsChanged.bind(this),h.on("accountsChanged",i)),c||(c=this.onChainChanged.bind(this),h.on("chainChanged",c)),d||(d=this.onDisconnect.bind(this),h.on("disconnect",d)))},async onDisconnect(r){const s=await this.getProvider();r&&r.code===1013&&s&&(await this.getAccounts()).length||(a.emitter.emit("disconnect"),s&&(c&&(s.removeListener("chainChanged",c),c=void 0),d&&(s.removeListener("disconnect",d),d=void 0),u||(u=this.onConnect.bind(this),s.on("connect",u))))}})}const Ot={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(o){return o?.coinbaseWalletExtension?o.coinbaseWalletExtension:re(o,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(o){return re(o,e=>{if(!e.isMetaMask||e.isBraveWallet&&!e._events&&!e._state)return!1;const t=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const n of t)if(e[n])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(o){return o?.phantom?.ethereum?o.phantom?.ethereum:re(o,"isPhantom")}}};function re(o,e){function t(i){return typeof e=="function"?e(i):typeof e=="string"?i[e]:!0}const n=o.ethereum;if(n?.providers)return n.providers.find(i=>t(i));if(n&&t(n))return n}const Rt=o=>(e,t,n)=>{const i=n.subscribe;return n.subscribe=(u,d,a)=>{let r=u;if(d){const s=a?.equalityFn||Object.is;let l=u(n.getState());r=h=>{const f=u(h);if(!s(l,f)){const p=l;d(l=f,p)}},a?.fireImmediately&&d(l,l)}return i(r)},o(e,t,n)},Ut=Rt;function jt(o,e){let t;try{t=o()}catch{return}return{getItem:i=>{var c;const u=a=>a===null?null:JSON.parse(a,void 0),d=(c=t.getItem(i))!=null?c:null;return d instanceof Promise?d.then(u):u(d)},setItem:(i,c)=>t.setItem(i,JSON.stringify(c,void 0)),removeItem:i=>t.removeItem(i)}}const me=o=>e=>{try{const t=o(e);return t instanceof Promise?t:{then(n){return me(n)(t)},catch(n){return this}}}catch(t){return{then(n){return this},catch(n){return me(n)(t)}}}},Mt=(o,e)=>(t,n,i)=>{let c={storage:jt(()=>localStorage),partialize:C=>C,version:0,merge:(C,g)=>({...g,...C}),...e},u=!1;const d=new Set,a=new Set;let r=c.storage;if(!r)return o((...C)=>{console.warn(`[zustand persist middleware] Unable to update item '${c.name}', the given storage is currently unavailable.`),t(...C)},n,i);const s=()=>{const C=c.partialize({...n()});return r.setItem(c.name,{state:C,version:c.version})},l=i.setState;i.setState=(C,g)=>{l(C,g),s()};const h=o((...C)=>{t(...C),s()},n,i);i.getInitialState=()=>h;let f;const p=()=>{var C,g;if(!r)return;u=!1,d.forEach(b=>{var y;return b((y=n())!=null?y:h)});const N=((g=c.onRehydrateStorage)==null?void 0:g.call(c,(C=n())!=null?C:h))||void 0;return me(r.getItem.bind(r))(c.name).then(b=>{if(b)if(typeof b.version=="number"&&b.version!==c.version){if(c.migrate)return[!0,c.migrate(b.state,b.version)];console.error("State loaded from storage couldn't be migrated since no migrate function was provided")}else return[!1,b.state];return[!1,void 0]}).then(b=>{var y;const[P,m]=b;if(f=c.merge(m,(y=n())!=null?y:h),t(f,!0),P)return s()}).then(()=>{N?.(f,void 0),f=n(),u=!0,a.forEach(b=>b(f))}).catch(b=>{N?.(void 0,b)})};return i.persist={setOptions:C=>{c={...c,...C},C.storage&&(r=C.storage)},clearStorage:()=>{r?.removeItem(c.name)},getOptions:()=>c,rehydrate:()=>p(),hasHydrated:()=>u,onHydrate:C=>(d.add(C),()=>{d.delete(C)}),onFinishHydration:C=>(a.add(C),()=>{a.delete(C)})},c.skipHydration||p(),f||h},xt=Mt,Ae=o=>{let e;const t=new Set,n=(r,s)=>{const l=typeof r=="function"?r(e):r;if(!Object.is(l,e)){const h=e;e=s??(typeof l!="object"||l===null)?l:Object.assign({},e,l),t.forEach(f=>f(e,h))}},i=()=>e,d={setState:n,getState:i,getInitialState:()=>a,subscribe:r=>(t.add(r),()=>t.delete(r))},a=e=o(n,i,d);return d},he=o=>o?Ae(o):Ae;var fe={exports:{}},Ne;function Wt(){return Ne||(Ne=1,(function(o){var e=Object.prototype.hasOwnProperty,t="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(t=!1));function i(a,r,s){this.fn=a,this.context=r,this.once=s||!1}function c(a,r,s,l,h){if(typeof s!="function")throw new TypeError("The listener must be a function");var f=new i(s,l||a,h),p=t?t+r:r;return a._events[p]?a._events[p].fn?a._events[p]=[a._events[p],f]:a._events[p].push(f):(a._events[p]=f,a._eventsCount++),a}function u(a,r){--a._eventsCount===0?a._events=new n:delete a._events[r]}function d(){this._events=new n,this._eventsCount=0}d.prototype.eventNames=function(){var r=[],s,l;if(this._eventsCount===0)return r;for(l in s=this._events)e.call(s,l)&&r.push(t?l.slice(1):l);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(s)):r},d.prototype.listeners=function(r){var s=t?t+r:r,l=this._events[s];if(!l)return[];if(l.fn)return[l.fn];for(var h=0,f=l.length,p=new Array(f);h<f;h++)p[h]=l[h].fn;return p},d.prototype.listenerCount=function(r){var s=t?t+r:r,l=this._events[s];return l?l.fn?1:l.length:0},d.prototype.emit=function(r,s,l,h,f,p){var C=t?t+r:r;if(!this._events[C])return!1;var g=this._events[C],N=arguments.length,b,y;if(g.fn){switch(g.once&&this.removeListener(r,g.fn,void 0,!0),N){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,s),!0;case 3:return g.fn.call(g.context,s,l),!0;case 4:return g.fn.call(g.context,s,l,h),!0;case 5:return g.fn.call(g.context,s,l,h,f),!0;case 6:return g.fn.call(g.context,s,l,h,f,p),!0}for(y=1,b=new Array(N-1);y<N;y++)b[y-1]=arguments[y];g.fn.apply(g.context,b)}else{var P=g.length,m;for(y=0;y<P;y++)switch(g[y].once&&this.removeListener(r,g[y].fn,void 0,!0),N){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,s);break;case 3:g[y].fn.call(g[y].context,s,l);break;case 4:g[y].fn.call(g[y].context,s,l,h);break;default:if(!b)for(m=1,b=new Array(N-1);m<N;m++)b[m-1]=arguments[m];g[y].fn.apply(g[y].context,b)}}return!0},d.prototype.on=function(r,s,l){return c(this,r,s,l,!1)},d.prototype.once=function(r,s,l){return c(this,r,s,l,!0)},d.prototype.removeListener=function(r,s,l,h){var f=t?t+r:r;if(!this._events[f])return this;if(!s)return u(this,f),this;var p=this._events[f];if(p.fn)p.fn===s&&(!h||p.once)&&(!l||p.context===l)&&u(this,f);else{for(var C=0,g=[],N=p.length;C<N;C++)(p[C].fn!==s||h&&!p[C].once||l&&p[C].context!==l)&&g.push(p[C]);g.length?this._events[f]=g.length===1?g[0]:g:u(this,f)}return this},d.prototype.removeAllListeners=function(r){var s;return r?(s=t?t+r:r,this._events[s]&&u(this,s)):(this._events=new n,this._eventsCount=0),this},d.prototype.off=d.prototype.removeListener,d.prototype.addListener=d.prototype.on,d.prefixed=t,d.EventEmitter=d,o.exports=d})(fe)),fe.exports}var Lt=Wt();const qt=tt(Lt);class Dt{constructor(e){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:e}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new qt})}on(e,t){this._emitter.on(e,t)}once(e,t){this._emitter.once(e,t)}off(e,t){this._emitter.off(e,t)}emit(e,...t){const n=t[0];this._emitter.emit(e,{uid:this.uid,...n})}listenerCount(e){return this._emitter.listenerCount(e)}}function $t(o){return new Dt(o)}function Ft(o,e){return JSON.parse(o,(t,n)=>{let i=n;return i?.__type==="bigint"&&(i=BigInt(i.value)),i?.__type==="Map"&&(i=new Map(i.value)),e?.(t,i)??i})}function _e(o,e){return o.slice(0,e).join(".")||"."}function Se(o,e){const{length:t}=o;for(let n=0;n<t;++n)if(o[n]===e)return n+1;return 0}function Ht(o,e){const t=typeof o=="function",n=typeof e=="function",i=[],c=[];return function(d,a){if(typeof a=="object")if(i.length){const r=Se(i,this);r===0?i[i.length]=this:(i.splice(r),c.splice(r)),c[c.length]=d;const s=Se(i,a);if(s!==0)return n?e.call(this,d,a,_e(c,s)):`[ref=${_e(c,s)}]`}else i[0]=a,c[0]=d;return t?o.call(this,d,a):a}}function Bt(o,e,t,n){return JSON.stringify(o,Ht((i,c)=>{let u=c;return typeof u=="bigint"&&(u={__type:"bigint",value:c.toString()}),u instanceof Map&&(u={__type:"Map",value:Array.from(c.entries())}),e?.(i,u)??u},n),t??void 0)}function zt(o){const{deserialize:e=Ft,key:t="wagmi",serialize:n=Bt,storage:i=je}=o;function c(u){return u instanceof Promise?u.then(d=>d).catch(()=>null):u}return{...i,key:t,async getItem(u,d){const a=i.getItem(`${t}.${u}`),r=await c(a);return r?e(r)??null:d??null},async setItem(u,d){const a=`${t}.${u}`;d===null?await c(i.removeItem(a)):await c(i.setItem(a,n(d)))},async removeItem(u){await c(i.removeItem(`${t}.${u}`))}}}const je={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function Vt(){const o=typeof window<"u"&&window.localStorage?window.localStorage:je;return{getItem(e){return o.getItem(e)},removeItem(e){o.removeItem(e)},setItem(e,t){try{o.setItem(e,t)}catch{}}}}const Ce=256;let Z=Ce,ee;function Gt(o=11){if(!ee||Z+o>Ce*2){ee="",Z=0;for(let e=0;e<Ce;e++)ee+=(256+Math.random()*256|0).toString(16).substring(1)}return ee.substring(Z,Z+++o)}function Kt(o){const{multiInjectedProviderDiscovery:e=!0,storage:t=zt({storage:Vt()}),syncConnectedChain:n=!0,ssr:i=!1,...c}=o,u=typeof window<"u"&&e?nt():void 0,d=he(()=>c.chains),a=he(()=>{const m=[],w=new Set;for(const v of c.connectors??[]){const A=r(v);if(m.push(A),!i&&A.rdns){const I=typeof A.rdns=="string"?[A.rdns]:A.rdns;for(const T of I)w.add(T)}}if(!i&&u){const v=u.getProviders();for(const A of v)w.has(A.info.rdns)||m.push(r(s(A)))}return m});function r(m){const w=$t(Gt()),v={...m({emitter:w,chains:d.getState(),storage:t,transports:c.transports}),emitter:w,uid:w.uid};return w.on("connect",y),v.setup?.(),v}function s(m){const{info:w}=m,v=m.provider;return ce({target:{...w,id:w.rdns,provider:v}})}const l=new Map;function h(m={}){const w=m.chainId??g.getState().chainId,v=d.getState().find(I=>I.id===w);if(m.chainId&&!v)throw new z;{const I=l.get(g.getState().chainId);if(I&&!v)return I;if(!v)throw new z}{const I=l.get(w);if(I)return I}let A;if(c.client)A=c.client({chain:v});else{const I=v.id,T=d.getState().map(k=>k.id),U={},we=Object.entries(c);for(const[k,q]of we)if(!(k==="chains"||k==="client"||k==="connectors"||k==="transports"))if(typeof q=="object")if(I in q)U[k]=q[I];else{if(T.some(xe=>xe in q))continue;U[k]=q}else U[k]=q;A=Oe({...U,chain:v,batch:U.batch??{multicall:!0},transport:k=>c.transports[I]({...k,connectors:a})})}return l.set(w,A),A}function f(){return{chainId:d.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let p;const C="0.0.0-canary-";ne.startsWith(C)?p=Number.parseInt(ne.replace(C,""),10):p=Number.parseInt(ne.split(".")[0]??"0",10);const g=he(Ut(t?xt(f,{migrate(m,w){if(w===p)return m;const v=f(),A=N(m,v.chainId);return{...v,chainId:A}},name:"store",partialize(m){return{connections:{__type:"Map",value:Array.from(m.connections.entries()).map(([w,v])=>{const{id:A,name:I,type:T,uid:U}=v.connector;return[w,{...v,connector:{id:A,name:I,type:T,uid:U}}]})},chainId:m.chainId,current:m.current}},merge(m,w){typeof m=="object"&&m&&"status"in m&&delete m.status;const v=N(m,w.chainId);return{...w,...m,chainId:v}},skipHydration:i,storage:t,version:p}):f));g.setState(f());function N(m,w){return m&&typeof m=="object"&&"chainId"in m&&typeof m.chainId=="number"&&d.getState().some(v=>v.id===m.chainId)?m.chainId:w}n&&g.subscribe(({connections:m,current:w})=>w?m.get(w)?.chainId:void 0,m=>{if(d.getState().some(v=>v.id===m))return g.setState(v=>({...v,chainId:m??v.chainId}))}),u?.subscribe(m=>{const w=new Set,v=new Set;for(const I of a.getState())if(w.add(I.id),I.rdns){const T=typeof I.rdns=="string"?[I.rdns]:I.rdns;for(const U of T)v.add(U)}const A=[];for(const I of m){if(v.has(I.info.rdns))continue;const T=r(s(I));w.has(T.id)||A.push(T)}t&&!g.persist.hasHydrated()||a.setState(I=>[...I,...A],!0)});function b(m){g.setState(w=>{const v=w.connections.get(m.uid);return v?{...w,connections:new Map(w.connections).set(m.uid,{accounts:m.accounts??v.accounts,chainId:m.chainId??v.chainId,connector:v.connector})}:w})}function y(m){g.getState().status==="connecting"||g.getState().status==="reconnecting"||g.setState(w=>{const v=a.getState().find(A=>A.uid===m.uid);return v?(v.emitter.listenerCount("connect")&&v.emitter.off("connect",b),v.emitter.listenerCount("change")||v.emitter.on("change",b),v.emitter.listenerCount("disconnect")||v.emitter.on("disconnect",P),{...w,connections:new Map(w.connections).set(m.uid,{accounts:m.accounts,chainId:m.chainId,connector:v}),current:m.uid,status:"connected"}):w})}function P(m){g.setState(w=>{const v=w.connections.get(m.uid);if(v){const I=v.connector;I.emitter.listenerCount("change")&&v.connector.emitter.off("change",b),I.emitter.listenerCount("disconnect")&&v.connector.emitter.off("disconnect",P),I.emitter.listenerCount("connect")||v.connector.emitter.on("connect",y)}if(w.connections.delete(m.uid),w.connections.size===0)return{...w,connections:new Map,current:null,status:"disconnected"};const A=w.connections.values().next().value;return{...w,connections:new Map(w.connections),current:A.connector.uid}})}return{get chains(){return d.getState()},get connectors(){return a.getState()},storage:t,getClient:h,get state(){return g.getState()},setState(m){let w;typeof m=="function"?w=m(g.getState()):w=m;const v=f();typeof w!="object"&&(w=v),Object.keys(v).some(I=>!(I in w))&&(w=v),g.setState(w,!0)},subscribe(m,w,v){return g.subscribe(m,w,v?{...v,fireImmediately:v.emitImmediately}:void 0)},_internal:{mipd:u,async revalidate(){const m=g.getState(),w=m.connections;let v=m.current;for(const[,A]of w){const I=A.connector;I.isAuthorized&&await I.isAuthorized()||(w.delete(I.uid),v===I.uid&&(v=null))}g.setState(A=>({...A,connections:w,current:v}))},store:g,ssr:!!i,syncConnectedChain:n,transports:c.transports,chains:{setState(m){const w=typeof m=="function"?m(d.getState()):m;if(w.length!==0)return d.setState(w,!0)},subscribe(m){return d.subscribe(m)}},connectors:{providerDetailToConnector:s,setup:r,setState(m){return a.setState(typeof m=="function"?m(a.getState()):m,!0)},subscribe(m){return a.subscribe(m)}},events:{change:b,connect:y,disconnect:P}}}}function Me(o){let e=[],t,n;function i(d){const a=S.getCaipNetworks(E.CHAIN.EVM);let r=Number(ge.parseEvmChainId(d));if(!a.some(s=>String(s.id)===String(d))){const s=S.getActiveCaipNetwork(E.CHAIN.EVM)?.id||a[0]?.id;s&&Number.isInteger(Number(s))&&(r=Number(s))}if(!r)throw new Error("ChainId not found in networks");return r}function c(){return t||(t=ye.getInstance({projectId:o.options.projectId,chainId:K()?.caipNetworkId,enableLogger:o.options.enableAuthLogger,onTimeout:d=>{d==="iframe_load_failed"?D.open(x.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):d==="iframe_request_timeout"?D.open(x.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):d==="unverified_domain"&&D.open(x.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},abortController:x.EmbeddedWalletAbortController,getActiveCaipNetwork:d=>K(d),getCaipNetworks:d=>S.getCaipNetworks(d)})),t}async function u(d={}){const a=c();let r=d.chainId;if(d.isReconnecting){const C=ge.parseEvmChainId(a.getLastUsedChainId()||""),g=o.chains?.[0].id;if(r=C||g,!r)throw new Error("ChainId not found in provider")}const s=ve("eip155"),{address:l,chainId:h,accounts:f}=await De.authConnectorAuthenticate({authConnector:a,chainId:r,preferredAccountType:s,socialUri:d.socialUri,chainNamespace:E.CHAIN.EVM});e=f?.map(C=>C.address)||[l];const p=i(h);return{accounts:e,account:l,chainId:p,chain:{id:p,unsupported:!1}}}return d=>({id:E.CONNECTOR_ID.AUTH,name:E.CONNECTOR_NAMES.AUTH,type:"AUTH",chain:E.CHAIN.EVM,async connect(a={}){if(n){const s=await n;return{accounts:a.withCapabilities?s.accounts.map(l=>({address:l,capabilities:{}})):s.accounts,chainId:s.chainId}}n||(n=new Promise(s=>{s(u(a))}));const r=await n;return n=void 0,{accounts:a.withCapabilities?r.accounts.map(s=>({address:s,capabilities:{}})):r.accounts,chainId:r.chainId}},async disconnect(){await(await this.getProvider()).disconnect()},getAccounts(){return e?.length?(d.emitter.emit("change",{accounts:e}),Promise.resolve(e)):Promise.resolve([])},async getProvider(){return this.provider||(this.provider=ye.getInstance({projectId:o.options.projectId,chainId:K()?.caipNetworkId,enableLogger:o.options.enableAuthLogger,abortController:x.EmbeddedWalletAbortController,onTimeout:a=>{a==="iframe_load_failed"?D.open(x.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):a==="iframe_request_timeout"?D.open(x.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):a==="unverified_domain"&&D.open(x.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:a=>K(a),getCaipNetworks:a=>S.getCaipNetworks(a)})),Promise.resolve(this.provider)},async getChainId(){const a=await this.getProvider(),{chainId:r}=await a.getChainId();return i(r)},async isAuthorized(){const r=S.state.activeChain===E.CHAIN.EVM;if(E.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(h=>qe.getConnectorId(h)===E.CONNECTOR_ID.AUTH)&&!r)return!1;const l=await this.getProvider();return Promise.resolve(l.getLoginEmailUsed())},async switchChain({chainId:a}){try{const r=d.chains.find(f=>f.id===a);if(!r)throw new B(new Error("chain not found on connector."));const s=await this.getProvider(),l=ve("eip155"),h=await s.connect({chainId:a,preferredAccountType:l});return e=h?.accounts?.map(f=>f.address)||[h.address],d.emitter.emit("change",{chainId:Number(a),accounts:e}),r}catch(r){throw r instanceof Error?new B(r):r}},onAccountsChanged(a){a.length===0?this.onDisconnect():d.emitter.emit("change",{accounts:a.map(L)})},onChainChanged(a){const r=Number(a);d.emitter.emit("change",{chainId:r})},async onDisconnect(a){await(await this.getProvider()).disconnect()}})}pe.type="walletConnect";function pe(o){const e=o.isNewChainsStale??!0;let t,n,i,c,u,d,a;return r=>({id:"walletConnect",name:"WalletConnect",type:pe.type,provider:o.universalProvider,async setup(){const s=await this.getProvider().catch(()=>null);s&&(c||(c=this.onConnect.bind(this),s.on("connect",c)),d||(d=this.onSessionDelete.bind(this),s.on("session_delete",d)))},async connect({...s}={}){try{const l=S.getCaipNetworks(),h=await this.getProvider();if(!h)throw new W;u||(u=this.onDisplayUri,h.on("display_uri",u));const f=await this.isChainsStale();h.session&&f&&await h.disconnect();const p=$.state.universalProviderConfigOverride;if(!h.session||f){const m=$e.createNamespaces(l,p);await h.connect({optionalNamespaces:m,..."pairingTopic"in s?{pairingTopic:s.pairingTopic}:{}}),this.setRequestedChainsIds(l.map(w=>Number(w.id)))}const C=await this.getAccounts(),g=await this.getChainId(),N=h.session?.namespaces?.eip155?.chains,b=N?.some(m=>Number(m.split(":")[1])===g);let y=1;b?y=g:N?.[0]&&(y=Number(N[0].split(":")[1])),u&&(h.removeListener("display_uri",u),u=void 0),c&&(h.removeListener("connect",c),c=void 0),n||(n=this.onAccountsChanged.bind(this),h.on("accountsChanged",n)),i||(i=this.onChainChanged.bind(this),h.on("chainChanged",i)),a||(a=this.onDisconnect.bind(this),h.on("disconnect",a)),d||(d=this.onSessionDelete.bind(this),h.on("session_delete",d));const P=p?.defaultChain;return h.setDefaultChain(P??`eip155:${y}`),{accounts:C,chainId:y}}catch(l){throw/(user rejected|connection request reset)/i.test(l?.message)?new _(l):l}},async disconnect(){const s=await this.getProvider();try{await s?.disconnect()}catch(l){if(!/No matching key/i.test(l.message))throw l}finally{i&&(s?.removeListener("chainChanged",i),i=void 0),a&&(s?.removeListener("disconnect",a),a=void 0),c||(c=this.onConnect.bind(this),s?.on("connect",c)),n&&(s?.removeListener("accountsChanged",n),n=void 0),d&&(s?.removeListener("session_delete",d),d=void 0),this.setRequestedChainsIds([])}},async getAccounts(){const s=await this.getProvider();if(!s?.session?.namespaces)return[];const h=s?.session?.namespaces[E.CHAIN.EVM]?.accounts?.map(C=>C.split(":")[2])??[],f=new Set;return h.filter(C=>{const g=C?.toLowerCase();return f.has(g)?!1:(f.add(g),!0)})},async getProvider({chainId:s}={}){t||(t=o.universalProvider,t?.events.setMaxListeners(Number.POSITIVE_INFINITY));const l=F.getActiveNamespace(),h=S.getActiveCaipNetwork()?.id;if(s&&h!==s&&l){const f=F.getStoredActiveCaipNetworkId(),C=(l?S.getCaipNetworks(l):[])?.find(g=>g.id===f);C&&C.chainNamespace===E.CHAIN.EVM&&await this.switchChain?.({chainId:Number(C.id)})}return t},async getChainId(){const s=S.getActiveCaipNetwork(E.CHAIN.EVM)?.id;if(s)return s;const h=(await this.getProvider()).session?.namespaces[E.CHAIN.EVM]?.chains?.[0];return S.getCaipNetworks().find(p=>p.id===h)?.id},async isAuthorized(){try{const[s,l]=await Promise.all([this.getAccounts(),this.getProvider()]);return s.length?await this.isChainsStale()&&l.session?(await l.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:s,chainId:l}){const h=await this.getProvider();if(!h)throw new W;const f=S.getCaipNetworks().find(p=>p.id===l);if(!f)throw new B(new z);try{await h.request({method:"wallet_switchEthereumChain",params:[{chainId:oe(l)}]}),f?.caipNetworkId&&h.setDefaultChain(f?.caipNetworkId),r.emitter.emit("change",{chainId:Number(l)});const p=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...p,l]),{...f,id:f.id}}catch(p){const C=p;if(/(?:user rejected)/iu.test(C.message))throw new _(C);try{let g;s?.blockExplorerUrls?g=s.blockExplorerUrls:g=f.blockExplorers?.default.url?[f.blockExplorers?.default.url]:[];const N=f.rpcUrls?.chainDefault?.http||[],b={blockExplorerUrls:g,chainId:oe(l),chainName:f.name,iconUrls:s?.iconUrls,nativeCurrency:f.nativeCurrency,rpcUrls:N};await h.request({method:"wallet_addEthereumChain",params:[b]});const y=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...y,l]),{...f,id:f.id}}catch(g){throw new _(g)}}},onAccountsChanged(s){s.length===0?this.onDisconnect():r.emitter.emit("change",{accounts:s.map(l=>L(l))})},onChainChanged(s){const l=Number(s);r.emitter.emit("change",{chainId:l})},onConnect(s){this.setRequestedChainsIds(S.getCaipNetworks().map(l=>Number(l.id)))},async onDisconnect(s){this.setRequestedChainsIds([]),r.emitter.emit("disconnect");const l=await this.getProvider();n&&(l.removeListener("accountsChanged",n),n=void 0),i&&(l.removeListener("chainChanged",i),i=void 0),a&&(l.removeListener("disconnect",a),a=void 0),d&&(l.removeListener("session_delete",d),d=void 0),c||(c=this.onConnect.bind(this),l.on("connect",c))},onDisplayUri(s){r.emitter.emit("message",{type:"display_uri",data:s})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return t?.session?.namespaces?t?.session?.namespaces[E.CHAIN.EVM]?.accounts?.map(h=>Number.parseInt(h.split(":")[1]??""))??[]:[]},async getRequestedChainsIds(){const s=await r.storage?.getItem(this.requestedChainsStorageKey)??[];return[...new Set(s)]},async isChainsStale(){if(!e)return!1;const s=r.chains.map(f=>f.id),l=this.getNamespaceChainsIds();if(l.length&&!l.some(f=>s.includes(f)))return!1;const h=await this.getRequestedChainsIds();return!s.every(f=>h.includes(Number(f)))},async setRequestedChainsIds(s){await r.storage?.setItem(this.requestedChainsStorageKey,s)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}const H=He({pendingTransactions:0}),Pe={state:H,subscribeKey(o,e){return Fe(H,o,e)},increase(o){H[o]+=1},decrease(o){H[o]-=1},reset(o){H[o]=0}};async function Jt(o){if(te.isSafeApp()){const{safe:e}=await ke(async()=>{const{safe:t}=await import("./index-DT1PkdGa.js");return{safe:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));if(e&&!o.some(t=>t.type==="safe"))return e()}return null}async function Xt(o){try{const{baseAccount:e}=await ke(async()=>{const{baseAccount:t}=await import("./index-DT1PkdGa.js");return{baseAccount:t}},__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]));if(e&&!o.some(t=>t.id==="baseAccount"))return e()}catch(e){console.error("Failed to import Coinbase Wallet SDK:",e)}return null}const Qt={enable:!1,pollingInterval:3e4};class Yt extends Be{constructor(e){const t=J.extendCaipNetworks(e.networks,{projectId:e.projectId,customNetworkImageUrls:{},customRpcUrls:e.customRpcUrls});super(),this.balancePromises={},this.namespace=E.CHAIN.EVM,this.adapterType=E.ADAPTER_TYPES.WAGMI,this.projectId=e.projectId,this.pendingTransactionsFilter={...Qt,...e.pendingTransactionsFilter??{}},this.createConfig({...e,networks:t}),this.checkChainId()}construct(e){this.checkChainId(),this.setupWatchers()}async getAccounts(e){const t=this.getWagmiConnector(e.id);if(!t)return{accounts:[]};if(t.id===E.CONNECTOR_ID.AUTH){const u=await t.getProvider();if(!u?.user)return{accounts:[]};const{address:d,accounts:a,chainId:r}=u.user;return Promise.resolve({accounts:(a||[{address:d,type:"eoa"}]).map(s=>te.createAccount({caipAddress:`eip155:${r}:${s.address}`,type:s.type}))})}const{addresses:n,address:i,chainId:c}=ie(this.wagmiConfig);return Promise.resolve({accounts:c?[...new Set(n||[i])].map(u=>te.createAccount({caipAddress:`eip155:${c}:${u||""}`,type:"eoa"})):[]})}checkChainId(){const{chainId:e}=ie(this.wagmiConfig);e&&this.emit("switchNetwork",{chainId:e})}getWagmiConnector(e){return this.wagmiConfig.connectors.find(t=>t.id===e)}createConfig(e){this.wagmiChains=e.networks.filter(i=>i.chainNamespace===E.CHAIN.EVM);const t={},n=[...e.connectors??[]];this.wagmiChains.forEach(i=>{const c=e.transports?.[i.id],u=J.getCaipNetworkId(i);c?t[i.id]=J.extendWagmiTransports(i,e.projectId,c):t[i.id]=J.getViemTransport(i,e.projectId,e.customRpcUrls?.[u])}),this.wagmiConfig=Kt({...e,chains:this.wagmiChains,connectors:n,transports:t})}setupWatchPendingTransactions(){if(!this.pendingTransactionsFilter.enable||this.unwatchPendingTransactions)return;this.unwatchPendingTransactions=Tt(this.wagmiConfig,{pollingInterval:this.pendingTransactionsFilter.pollingInterval,onError:()=>{},onTransactions:()=>{this.emit("pendingTransactions"),Pe.increase("pendingTransactions")}});const e=Pe.subscribeKey("pendingTransactions",t=>{t>=E.LIMITS.PENDING_TRANSACTIONS&&(this.unwatchPendingTransactions?.(),e())})}setupWatchers(){St(this.wagmiConfig,{onChange:e=>{this.clearConnections(),this.addConnection(...e.map(t=>{const n=this.getCaipNetworks().find(c=>c.id===t.chainId),i=t.connector.id===E.CONNECTOR_ID.AUTH;return{accounts:t.accounts.map(c=>({address:this.toChecksummedAddress(c)})),caipNetwork:n,connectorId:t.connector.id,auth:i?{name:F.getConnectedSocialProvider(),username:F.getConnectedSocialUsername()}:void 0}}))}}),_t(this.wagmiConfig,{onChange:(e,t)=>{if(e.status==="disconnected"&&t.address&&this.emit("disconnect"),e?.chainId&&e?.chainId!==t?.chainId&&this.emit("switchNetwork",{chainId:e.chainId}),e.status==="connected"){const n=e.address!==t?.address,i=e.connector.id!==t.connector?.id,c=t.status!=="connected";(n||i||c)&&(this.setupWatchPendingTransactions(),this.handleAccountChanged({address:e.address,chainId:e.chainId,connector:e.connector}))}}})}async addThirdPartyConnectors(){const e=[],{enableCoinbase:t}=$.state||{};if(t!==!1){const i=await Xt(this.wagmiConfig.connectors);i&&e.push(i)}const n=await Jt(this.wagmiConfig.connectors);n&&e.push(n),await Promise.all(e.map(i=>{const c=this.configureInternalConnector(i);return this.addWagmiConnector(c)}))}addWagmiConnectors(){const e=[];$.state.enableInjected!==!1&&e.push(ce({shimDisconnect:!0}));const{features:t,remoteFeatures:n,projectId:i,enableAuthLogger:c}=$.state,u=n?.email??t?.email??!0,d=n?.socials??t?.socials,a=Array.isArray(d)&&d?.length>0;(u||a)&&e.push(Me({chains:this.wagmiChains,options:{projectId:i,enableAuthLogger:c}})),e.forEach(r=>{this.configureInternalConnector(r)})}configureInternalConnector(e){const t=this.wagmiConfig._internal.connectors.setup(e);return this.wagmiConfig._internal.connectors.setState(n=>[...n,t]),t}async handleAccountChanged({address:e,chainId:t,connector:n}){if(!this.namespace)throw new Error("WagmiAdapter:handleAccountChanged - namespace is required");const i=await n.getProvider().catch(()=>{});this.emit("accountChanged",{address:this.toChecksummedAddress(e),chainId:t,connector:{id:n.id,name:j.ConnectorNamesMap[n.id]??n.name,imageId:j.ConnectorImageIds[n.id],type:j.ConnectorTypesMap[n.type]??"EXTERNAL",info:n.id===E.CONNECTOR_ID.INJECTED?void 0:{rdns:n.id},provider:i,chain:this.namespace,chains:[]}})}async writeSolanaTransaction(){return Promise.resolve({hash:""})}async signMessage(e){try{return{signature:await Et(this.wagmiConfig,{message:e.message,account:e.address})}}catch{throw new Error("WagmiAdapter:signMessage - Sign message failed")}}async sendTransaction(e){const{chainId:t,address:n}=ie(this.wagmiConfig),i=this.wagmiChains?.find(d=>d.id===t),c={account:n,to:e.to,value:Number.isNaN(Number(e.value))?BigInt(0):BigInt(e.value),gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,data:e.data,chain:i,type:"legacy",parameters:["nonce"]};await It(this.wagmiConfig,c);const u=await bt(this.wagmiConfig,c);return await Nt(this.wagmiConfig,{hash:u,timeout:25e3}),{hash:u}}async writeContract(e){const{caipNetwork:t,...n}=e,i=Number(ge.caipNetworkIdToNumber(t.caipNetworkId)),c=this.wagmiChains?.find(d=>d.id===i);return{hash:await kt(this.wagmiConfig,{chain:c,address:n.tokenAddress,account:n.fromAddress,abi:n.abi,functionName:n.method,args:n.args,__mode:"prepared"})}}async estimateGas(e){try{return{gas:await vt(this.wagmiConfig,{account:e.address,to:e.to,data:e.data,type:"legacy"})}}catch{throw new Error("WagmiAdapter:estimateGas - error estimating gas")}}parseUnits(e){return at(e.value,e.decimals)}formatUnits(e){return Xe(e.value,e.decimals)}async addWagmiConnector(e){if(!this.namespace)throw new Error("WagmiAdapter:addWagmiConnector - namespace is required");const{enableEIP6963:t}=$.state||{};if(e.type===E.CONNECTOR_ID.INJECTED&&t===!1||e.id===E.CONNECTOR_ID.AUTH||e.id===E.CONNECTOR_ID.WALLET_CONNECT)return;let n;e.id!==E.CONNECTOR_ID.BASE_ACCOUNT&&(n=await e.getProvider().catch(()=>{}));const i=ze.state.connectorImages;this.addConnector({id:e.id,explorerId:j.ConnectorExplorerIds[e.id]??j.ConnectorExplorerIds[e.name],imageUrl:i?.[e.id]??e.icon,name:j.ConnectorNamesMap[e.id]??e.name,imageId:j.ConnectorImageIds[e.id],type:j.ConnectorTypesMap[e.type]??"EXTERNAL",info:e.id===E.CONNECTOR_ID.INJECTED?void 0:{rdns:e.id},provider:n,chain:this.namespace,chains:[]})}async syncConnectors(){Pt(this.wagmiConfig,{onChange:e=>{e.forEach(t=>this.addWagmiConnector(t))}}),this.addWagmiConnectors(),await Promise.all(this.wagmiConfig.connectors.map(e=>this.addWagmiConnector(e))),await this.addThirdPartyConnectors()}async syncConnections(){const e=this.connectors.filter(t=>{const{hasDisconnected:n,hasConnected:i}=X.getConnectorStorageInfo(t.id,this.namespace);return!n&&i}).map(t=>this.getWagmiConnector(t.id)).filter(Boolean);await le(this.wagmiConfig,{connectors:e})}async syncConnection(e){const{id:t,chainId:n}=e,c=M(this.wagmiConfig).find(r=>r.connector.id===t),d=await this.getWagmiConnector(t)?.getProvider();if(te.isSafeApp()&&t===E.CONNECTOR_ID.SAFE&&!c?.accounts.length){const r=this.getWagmiConnector("safe");if(r){const s=await de(this.wagmiConfig,{connector:r,chainId:Number(n)}),l=await r.getProvider();return{chainId:Number(n),address:this.toChecksummedAddress(s.accounts[0]),provider:l,type:c?.connector.type?.toUpperCase(),id:c?.connector.id}}}return{chainId:Number(c?.chainId),address:this.toChecksummedAddress(c?.accounts[0]),provider:d,type:c?.connector.type?.toUpperCase(),id:c?.connector.id}}async connectWalletConnect(e){try{const t=this.getWalletConnectConnector();await t.authenticate();const n=this.getWagmiConnector("walletConnect");if(!n)throw new Error("UniversalAdapter:connectWalletConnect - connector not found");const i=await de(this.wagmiConfig,{connector:n,chainId:e?Number(e):void 0});return i.chainId!==Number(e)&&await Ee(this.wagmiConfig,{chainId:i.chainId}),{clientId:await t.provider.client.core.crypto.getClientId()}}catch(t){throw t instanceof _?new Q(t):Ie.isUserRejectedRequestError(t)?new Q(t):t}}async connect(e){try{const{id:t,address:n,provider:i,type:c,info:u,chainId:d,socialUri:a}=e,r=this.getWagmiConnector(t);if(!r)throw new Error("connectionControllerClient:connectExternal - connector is undefined");i&&u&&r.id===E.CONNECTOR_ID.EIP6963&&r.setEip6963Wallet?.({provider:i,info:u});const s=this.wagmiConfig.state?.connections?.get(r.uid);if(s){await this.wagmiConfig.storage?.setItem("recentConnectorId",r.id);const f=[...s.accounts].sort((p,C)=>X.isLowerCaseMatch(p,n)?-1:X.isLowerCaseMatch(C,n)?1:0);return this.wagmiConfig?.setState(p=>({...p,connections:new Map(p.connections).set(r.uid,{accounts:f,chainId:s.chainId,connector:s.connector}),current:r.uid,status:"connected"})),{address:this.toChecksummedAddress(f[0]),chainId:s.chainId,provider:i,type:c,id:t}}const l=await de(this.wagmiConfig,{connector:r,chainId:d?Number(d):void 0,socialUri:a}),h=i??await r.getProvider();return{address:this.toChecksummedAddress(l.accounts[0]),chainId:l.chainId,provider:h,type:c,id:t}}catch(t){throw t instanceof _?new Q(t):Ie.isUserRejectedRequestError(t)?new Q(t):t}}get connections(){return Array.from(this.wagmiConfig.state.connections.values()).map(e=>({accounts:e.accounts.map(t=>({address:this.toChecksummedAddress(t)})),connectorId:e.connector.id}))}async reconnect(e){const{id:t}=e,n=this.getWagmiConnector(t);if(!n)throw new Error("connectionControllerClient:connectExternal - connector is undefined");await le(this.wagmiConfig,{connectors:[n]})}async getBalance(e){const t=e.address,n=this.getCaipNetworks().find(i=>i.id===e.chainId);if(!t)return Promise.resolve({balance:"0.00",symbol:"ETH"});if(n&&this.wagmiConfig){const i=`${n.caipNetworkId}:${e.address}`,c=this.balancePromises[i];if(c)return c;const u=F.getNativeBalanceCacheForCaipAddress(i);return u?{balance:u.balance,symbol:u.symbol}:(this.balancePromises[i]=new Promise(async d=>{try{const a=Number(e.chainId),r=await yt(this.wagmiConfig,{address:e.address,chainId:a,token:e.tokens?.[n.caipNetworkId]?.address});F.updateNativeBalanceCache({caipAddress:i,balance:r.formatted,symbol:r.symbol,timestamp:Date.now()}),d({balance:r.formatted,symbol:r.symbol})}catch(a){console.warn("Appkit:WagmiAdapter:getBalance - Error getting balance",a),d({balance:"0.00",symbol:"ETH"})}}).finally(()=>{delete this.balancePromises[i]}),this.balancePromises[i]||{balance:"0.00",symbol:"ETH"})}return{balance:"",symbol:""}}getWalletConnectProvider(){return this.getWagmiConnector("walletConnect")?.provider}async disconnect(e){if(e.id){const t=this.getWagmiConnector(e.id),i=M(this.wagmiConfig).find(c=>X.isLowerCaseMatch(c.connector.id,e.id));return await be(this.wagmiConfig,{connector:t}),$.state.enableReconnect===!1&&this.deleteConnection(e.id),i?{connections:[{accounts:i.accounts.map(c=>({address:this.toChecksummedAddress(c)})),connectorId:i.connector.id}]}:{connections:[]}}return this.disconnectAll()}async disconnectAll(){const e=M(this.wagmiConfig),t=await Promise.allSettled(e.map(async n=>{const i=this.getWagmiConnector(n.connector.id);return i&&await be(this.wagmiConfig,{connector:i}),n}));return this.wagmiConfig.state.connections.clear(),{connections:t.filter(n=>n.status==="fulfilled").map(({value:n})=>({accounts:n.accounts.map(i=>({address:this.toChecksummedAddress(i)})),connectorId:n.connector.id}))}}async switchNetwork(e){const{caipNetwork:t}=e,n=this.wagmiConfig.chains.find(f=>f.id.toString()===t.id.toString());if(!n)throw new Error("connectionControllerClient:switchNetwork - wagmiChain is undefined");const{name:i,nativeCurrency:c,rpcUrls:u,blockExplorers:d,id:a}=n,r=t.rpcUrls?.chainDefault?.http?.[0]??u.default.http[0]??"",s=d?.default.url??t.blockExplorers?.default?.url??"",l=c??t.nativeCurrency,h=i??t.name;await Ee(this.wagmiConfig,{chainId:a,addEthereumChainParameter:{chainName:h,nativeCurrency:l,rpcUrls:[r],blockExplorerUrls:[s]}}),await super.switchNetwork(e)}async getCapabilities(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:getCapabilities - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:getCapabilities - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:getCapabilities - provider is undefined");return await c.request({method:"wallet_getCapabilities",params:[e]})}async grantPermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:grantPermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:grantPermissions - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:grantPermissions - provider is undefined");return c.request({method:"wallet_grantPermissions",params:e})}async revokePermissions(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:revokePermissions - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:revokePermissions - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:revokePermissions - provider is undefined");return c.request({method:"wallet_revokePermissions",params:e})}async walletGetAssets(e){if(!this.wagmiConfig)throw new Error("connectionControllerClient:walletGetAssets - wagmiConfig is undefined");const n=M(this.wagmiConfig)[0],i=n?this.getWagmiConnector(n.connector.id):null;if(!i)throw new Error("connectionControllerClient:walletGetAssets - connector is undefined");const c=await i.getProvider();if(!c)throw new Error("connectionControllerClient:walletGetAssets - provider is undefined");return c.request({method:"wallet_getAssets",params:[e]})}setAuthProvider(e){if(!this.namespace)throw new Error("WagmiAdapter:setAuthProvider - namespace is required");this.addConnector({id:E.CONNECTOR_ID.AUTH,type:"AUTH",name:E.CONNECTOR_NAMES.AUTH,provider:e,imageId:j.ConnectorImageIds[E.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}async setUniversalProvider(e){e.on("connect",()=>{const n=M(this.wagmiConfig),i=this.getWagmiConnector("walletConnect");if(i&&!n.find(c=>c.connector.id===i.id)){if(S.state.activeChain==="eip155")return;le(this.wagmiConfig,{connectors:[i]})}});const t=pe({universalProvider:e});return this.configureInternalConnector(t),this.addConnector(new Ve({provider:e,caipNetworks:this.getCaipNetworks(),namespace:"eip155"})),Promise.resolve()}toChecksummedAddress(e){return et(e.toLowerCase())}}const ln=Object.freeze(Object.defineProperty({__proto__:null,WagmiAdapter:Yt,authConnector:Me},Symbol.toStringTag,{value:"Module"}));export{z as C,W as P,mt as a,ln as b,un as c,ce as i};