@dcl/blog-site 0.2.2 → 0.2.3-23948667956.commit-cfe47f9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/QueryClientProvider-mZKMZTwe.js +2 -0
- package/assets/RoobertPRO-Bold-DDyOqNrI.woff2 +0 -0
- package/assets/SignInRedirect-CXUOqOjy.js +11 -0
- package/assets/X-3yocgepi.js +15 -0
- package/assets/___vite-browser-external_commonjs-proxy-BqV5D26a.js +1 -0
- package/assets/__federation_expose_App-CMGDAIUH.js +1 -0
- package/assets/__federation_fn_import-C51lglKS.js +1 -0
- package/assets/__federation_shared_@dcl/hooks-Dm9PRmKy.js +535 -0
- package/assets/__federation_shared_@dcl/schemas-CVwtHlVJ.js +1 -0
- package/assets/__federation_shared_@emotion/react-AmEOkpjC.js +1 -0
- package/assets/__federation_shared_@emotion/styled-aZ9bk9Xh.js +1 -0
- package/assets/__federation_shared_@reduxjs/toolkit-DIZvwqf7.js +1 -0
- package/assets/__federation_shared_decentraland-ui2-KxrbFOTA.js +358 -0
- package/assets/__federation_shared_react-B3tlNTLg.js +1 -0
- package/assets/__federation_shared_react-dom-CCS4dT_K.js +1 -0
- package/assets/__federation_shared_react-redux-Ckcz2edF.js +13 -0
- package/assets/__federation_shared_react-router-dom-jUWpDOjR.js +49 -0
- package/assets/__federation_shared_viem-Cdp7wK0V.js +2 -0
- package/assets/__federation_shared_wagmi-CHWRoybR.js +17 -0
- package/assets/__vite-optional-peer-dep_lottie-react_decentraland-ui2-BIHI7g3E.js +1 -0
- package/assets/_commonjsHelpers-C4iS2aBk.js +1 -0
- package/assets/{add-Dnkf3E3Q.js → add-DHMb_tRw.js} +2 -2
- package/assets/all-wallets-Bo3QRxXL.js +6 -0
- package/assets/{app-store-C9FH4_zP.js → app-store-BHwDXU8D.js} +2 -2
- package/assets/{apple-Dm5w1W69.js → apple-BFX-plRw.js} +2 -2
- package/assets/arrow-bottom-Djx9NXV2.js +8 -0
- package/assets/{arrow-bottom-circle-Bgw9yiHN.js → arrow-bottom-circle-DcJnW2eo.js} +2 -2
- package/assets/arrow-left-BS_dJGSP.js +8 -0
- package/assets/arrow-right-B-mwy0Iu.js +8 -0
- package/assets/arrow-top-Di1bbZG1.js +8 -0
- package/assets/auto-track-pkMvCaah.js +1 -0
- package/assets/{bank-qNUWniDB.js → bank-B9SMq-ix.js} +2 -2
- package/assets/{basic-DJvhbg9L.js → basic-DijYF-IW.js} +124 -124
- package/assets/biconomy-CCw3vtwR.js +1 -0
- package/assets/{browser-Du0KKb8R.js → browser-CdKdszu-.js} +2 -2
- package/assets/{card-BpDAuOwe.js → card-CQu4Eu8c.js} +2 -2
- package/assets/ccip-AgQ5AD9v.js +1 -0
- package/assets/chains-D88UzVoE.js +1 -0
- package/assets/{checkmark-srdyV91l.js → checkmark-D2vezo75.js} +2 -2
- package/assets/{checkmark-bold-BYtPga6u.js → checkmark-bold-DriAapzP.js} +2 -2
- package/assets/chevron-bottom-CcFEOVdH.js +8 -0
- package/assets/chevron-left-BXS-ybhL.js +8 -0
- package/assets/chevron-right-TvO5COya.js +8 -0
- package/assets/chevron-top-D84SgxMg.js +8 -0
- package/assets/{chrome-store-D-UYtj15.js → chrome-store-rpsfVQln.js} +2 -2
- package/assets/{clock-BGyfn2Ix.js → clock-BMJ2gt7b.js} +2 -2
- package/assets/close-kAWkeKAP.js +8 -0
- package/assets/{coinPlaceholder-o1yCmFLN.js → coinPlaceholder-Dz8MKewa.js} +2 -2
- package/assets/common-D37S_OFt.js +1 -0
- package/assets/{compass-BrX88OdU.js → compass-BednEqu-.js} +2 -2
- package/assets/controller-D0Gc4Hsp.js +2 -0
- package/assets/{copy-CGKLgPMf.js → copy-D7rBk-hZ.js} +2 -2
- package/assets/core-Bn8Mr-tS.js +907 -0
- package/assets/create-submenu-Bu20F8-Z.webp +0 -0
- package/assets/createBundlerClient-DhRCLsYO.js +4 -0
- package/assets/createClient-C9QPJaZu.js +1 -0
- package/assets/cursor-C8UG2IDe.js +3 -0
- package/assets/{cursor-transparent--gaS-5ET.js → cursor-transparent-CyP0H3C5.js} +2 -2
- package/assets/decimals-B7Pm5rZk.js +1 -0
- package/assets/decimals-DedKFk8m.js +1 -0
- package/assets/defineChain-7I0Ce1VT.js +1 -0
- package/assets/{desktop-D3dzP-FX.js → desktop-LBcRpcZE.js} +2 -2
- package/assets/detectExtension-C2uVeK-n.js +1 -0
- package/assets/{disconnect-CsHX0nla.js → disconnect-DEBEe-yK.js} +2 -2
- package/assets/{discord-TnXCJHRv.js → discord-BlVFKMf0.js} +2 -2
- package/assets/emotion-react.browser.esm-BzYQLDSp.js +8 -0
- package/assets/emotion-use-insertion-effect-with-fallbacks.browser.esm-TsHx33zg.js +1 -0
- package/assets/encode-DvvW4ZKt.js +2 -0
- package/assets/engine-CD7SeAap.js +1 -0
- package/assets/estimate-gas-CeHGaIbG.js +3 -0
- package/assets/estimate-l1-fee-ClMO5l7U.js +1 -0
- package/assets/eth_estimateGas-C2ENZ_HR.js +1 -0
- package/assets/eth_getStorageAt-BHgF2qz5.js +1 -0
- package/assets/eth_getTransactionCount-DWnnw2mX.js +1 -0
- package/assets/ethereum-dN7ENYl_.js +1 -0
- package/assets/{etherscan-BNOTAlpJ.js → etherscan-C_pqcV9R.js} +2 -2
- package/assets/events-B5inrCVE.js +1 -0
- package/assets/{exclamation-triangle-3cTnBFEz.js → exclamation-triangle-R9Xq3IaG.js} +2 -2
- package/assets/explore-submenu-BFVuYMi9.webp +0 -0
- package/assets/{extension-C7i3kBcJ.js → extension-DkA_7Cbg.js} +2 -2
- package/assets/external-link-BPOw_fuW.js +8 -0
- package/assets/extractIPFS-B4LGER25.js +1 -0
- package/assets/{facebook-BtRXxuTh.js → facebook-CMZk_t1A.js} +2 -2
- package/assets/{farcaster-DuvCkOsj.js → farcaster-CveILPqa.js} +2 -2
- package/assets/fee-data-BKBGP5kG.js +1 -0
- package/assets/fetchTokenMetadata-BLDHgO8L.js +2 -0
- package/assets/{filters-q4uY0GXA.js → filters-BspTrZpX.js} +2 -2
- package/assets/get-ecosystem-wallet-info-D3PrM5FE.js +1 -0
- package/assets/getBalance-D7nzATjL.js +2 -0
- package/assets/getInstalledModules-Ck_Gj8FO.js +1 -0
- package/assets/getNFT-BcCS23O_.js +1 -0
- package/assets/getNFT-DXdMP0Q5.js +2 -0
- package/assets/{github-DdvkoPeB.js → github-DoFHEMIF.js} +2 -2
- package/assets/{google-d4Ql9qix.js → google-NTQi9GVe.js} +2 -2
- package/assets/governance-submenu-VTIKvCIL.webp +0 -0
- package/assets/{help-circle-BY_Weu8t.js → help-circle-DV0uNPdn.js} +2 -2
- package/assets/hex-B0Rx0hII.js +2 -0
- package/assets/{id-BJNb6vOI.js → id-UAVc1FOO.js} +1 -1
- package/assets/{image-DIsXNsXJ.js → image-BeHBzCPG.js} +2 -2
- package/assets/in-app-wallet-calls-CvFtsXP9.js +1 -0
- package/assets/index-B2OCb4Ez.js +1 -0
- package/assets/index-B65z14KI.js +4 -0
- package/assets/index-BAhlRyDG.js +1 -0
- package/assets/{index-DOqN8xaU.js → index-BTtTX-5z.js} +1 -1
- package/assets/index-BjzJcZq6.js +1 -0
- package/assets/index-BjzJcZq6__bundled.js +24 -0
- package/assets/index-BozJS3za.js +12 -0
- package/assets/index-C05H8NDX.js +1 -0
- package/assets/index-C1IoT2if.js +3 -0
- package/assets/index-C2hdqzGT.js +2 -0
- package/assets/index-CgMDPZul.js +13 -0
- package/assets/index-CjuQOkbh.js +2 -0
- package/assets/index-CpR9p5nk.js +1 -0
- package/assets/index-D1lXZVQu.js +45 -0
- package/assets/index-D6ZAha0r.js +395 -0
- package/assets/{index-X-a697cI.js → index-DJ7GgcJ9.js} +2 -2
- package/assets/index-DajuSfcu.js +2 -0
- package/assets/index-DeklogZX.js +1 -0
- package/assets/index-DmAaXUNv.js +1 -0
- package/assets/index-Dy0yjznp.js +1 -0
- package/assets/index-Dy0yjznp__bundled.js +9 -0
- package/assets/index-HvoTJwGm.js +1 -0
- package/assets/index-MYKNZAUu.js +8 -0
- package/assets/index-Tsk25L8E.js +1 -0
- package/assets/index.es-C8Kfv-K1.js +11 -0
- package/assets/index.es-CAXGMBEH.js +1 -0
- package/assets/index.es-D3pP9hN4.js +27 -0
- package/assets/index.es-D5YKsq2-.js +2 -0
- package/assets/index.umd-DK712HHb.js +1 -0
- package/assets/{info-BvPgRaaJ.js → info-CzcA85TO.js} +2 -2
- package/assets/{info-circle-sWcom9RD.js → info-circle-D3Mr3R9u.js} +2 -2
- package/assets/is-plan-event-enabled-DeNtQvA5.js +1 -0
- package/assets/json-BHzNJmTy.js +1 -0
- package/assets/jsx-runtime-DncYoG30.js +1 -0
- package/assets/jsx-runtime-DncYoG30__bundled.js +9 -0
- package/assets/learn-submenu-sfxVP5Db.webp +0 -0
- package/assets/{lightbulb-HJchniSu.js → lightbulb-B2FZtM_8.js} +2 -2
- package/assets/localBatchGatewayRequest-BIEAG3VG.js +1 -0
- package/assets/{mail-DlRijJmV.js → mail-CkhGbows.js} +2 -2
- package/assets/marketplace-submenu-CixWTv8_.webp +0 -0
- package/assets/{mobile-CoiDw6cg.js → mobile-1H3FtqAS.js} +2 -2
- package/assets/{more-LUiRL6x4.js → more-CZiQi624.js} +2 -2
- package/assets/{network-placeholder-Cj3jgVfo.js → network-placeholder-DA2bm2rC.js} +2 -2
- package/assets/{nftPlaceholder-LkhQmGFs.js → nftPlaceholder-C9t5Ydxp.js} +2 -2
- package/assets/off-D8z0OQ3M.js +8 -0
- package/assets/op-gas-fee-reducer-CfxMcvXl.js +1 -0
- package/assets/openzeppelin-ZKz6sLW9.js +1 -0
- package/assets/ownerOf-D1aXOt9Q.js +1 -0
- package/assets/parseNft-LjEwmOst.js +2 -0
- package/assets/passkeys-CTJ4NPfL.js +1 -0
- package/assets/{play-store-DBit2AoS.js → play-store-_X5LrPwx.js} +2 -2
- package/assets/{plus-CZe-WgSN.js → plus-JriDhMxt.js} +2 -2
- package/assets/preload-helper-BorDCKdG.js +1 -0
- package/assets/publicKeyToAddress-CxEKPAKT.js +1 -0
- package/assets/{qr-code-BhW7ZXY-.js → qr-code-DaB080BF.js} +2 -2
- package/assets/{qr-overlay-DsRPQv6v.js → qr-overlay-CGnFhcTk.js} +1 -1
- package/assets/{recycle-horizontal-DBnWoDRV.js → recycle-horizontal-CGeFmMrT.js} +2 -2
- package/assets/redux-BNDF-Lt-.js +1 -0
- package/assets/{refresh-qvocxvcf.js → refresh-Dgvxxw5C.js} +2 -2
- package/assets/remoteEntry.js +1 -0
- package/assets/{reown-logo-C-45v-AJ.js → reown-logo-CBX48aN9.js} +2 -2
- package/assets/resolveImplementation-Cb2bL1tx.js +1 -0
- package/assets/rich-text-react-renderer.es5-D_tE7AHo.js +2 -0
- package/assets/rpc-ti0b0r_u.js +3 -0
- package/assets/search-DamXBOxM.js +8 -0
- package/assets/secp256k1-UEF-yOzn.js +1 -0
- package/assets/{send-DI2x4DfJ.js → send-BLpUSx_G.js} +2 -2
- package/assets/send-batch-transaction-DnH876GL.js +1 -0
- package/assets/send-eip712-transaction-D_FU-Avh.js +2 -0
- package/assets/send-gasless-transaction-MP1Q_mLW.js +2 -0
- package/assets/serializeTransaction-mtsVBaO6.js +1 -0
- package/assets/session-proposal-CM3P7DaL.js +1 -0
- package/assets/session-request-Dqw67u3p.js +2 -0
- package/assets/sha256-DYtpy1Qz.js +1 -0
- package/assets/signing-BFeVjjPi.js +5 -0
- package/assets/store-DOLZnwHk.js +1 -0
- package/assets/{swapHorizontal-eTjjU7d8.js → swapHorizontal-Br-MZ1tO.js} +2 -2
- package/assets/{swapHorizontalBold-B86nJTAP.js → swapHorizontalBold-CkUNbZ1G.js} +2 -2
- package/assets/{swapHorizontalMedium-CNT7ELrN.js → swapHorizontalMedium-D3qEQNb5.js} +2 -2
- package/assets/{swapHorizontalRoundedBold-R_inXmIh.js → swapHorizontalRoundedBold-CzzBPCtt.js} +2 -2
- package/assets/{swapVertical-DBChOUj8.js → swapVertical-Mrn3zm_W.js} +2 -2
- package/assets/{telegram-DjYbgHgS.js → telegram-ZTLC9FiA.js} +2 -2
- package/assets/thirdweb-CHfVLLbM.js +1 -0
- package/assets/thirdweb-D5ezTmuN.js +27 -0
- package/assets/{three-dots-VoULPGrI.js → three-dots-DYl4uQjm.js} +2 -2
- package/assets/totalSupply-B5jHW8gx.js +1 -0
- package/assets/tslib.es6-DbvBTznf.js +1 -0
- package/assets/{twitch-ETBgqGHE.js → twitch-DPLkA98Q.js} +2 -2
- package/assets/{twitterIcon-N584dzfh.js → twitterIcon-BEY_UAyG.js} +2 -2
- package/assets/uid-D00jCazq.js +44 -0
- package/assets/{uint8-array-CjVHUazS.js → uint8-array-DZKEMhA1.js} +1 -1
- package/assets/utils-C7urdXtO.js +2 -0
- package/assets/utils-CozXUO91.js +1 -0
- package/assets/{verify-Dp4bztGk.js → verify-DuPdiufm.js} +2 -2
- package/assets/{verify-filled-B7WhO3Kn.js → verify-filled-CdqEW5AP.js} +2 -2
- package/assets/{w3m-modal-BmEHfmEu.js → w3m-modal-BLzhBUlF.js} +34 -34
- package/assets/wait-for-tx-receipt-B-o5aPQ8.js +1 -0
- package/assets/{wallet-tXSvlbUa.js → wallet-CZw1g3L8.js} +2 -2
- package/assets/{wallet-placeholder-B2e9Wl_u.js → wallet-placeholder-OAkoJuru.js} +2 -2
- package/assets/{walletconnect-D70wSjLs.js → walletconnect-BJ3w7-IU.js} +4 -4
- package/assets/wallets-Q5RcRyG6.js +16 -0
- package/assets/{warning-circle-CsTkZ4Rl.js → warning-circle-DpDeOZKv.js} +2 -2
- package/assets/web-connector-CB7tpRui.js +9 -0
- package/assets/webSocket-dQW3n9NM.js +3 -0
- package/assets/withCache-DYumIHzL.js +1 -0
- package/assets/{x-DwOCQuex.js → x-liJqLZUi.js} +2 -2
- package/assets/zora-sepolia-DNJ2DQat.js +1 -0
- package/index.html +17 -3
- package/package.json +3 -3
- package/assets/RoobertPRO-Bold-BLoSpx-h.otf +0 -0
- package/assets/all-wallets-C5N9p7Oh.js +0 -6
- package/assets/arrow-bottom-CXaxVEeb.js +0 -8
- package/assets/arrow-left-pgI3hg3C.js +0 -8
- package/assets/arrow-right-CyKp2yFa.js +0 -8
- package/assets/arrow-top-B2waxVPx.js +0 -8
- package/assets/auto-track-BvFI9h3i.js +0 -1
- package/assets/biconomy-DZsFbmF0.js +0 -1
- package/assets/ccip-CpLmER95.js +0 -1
- package/assets/chains-BJ1WS73W.js +0 -1
- package/assets/chevron-bottom-C2aa3E9i.js +0 -8
- package/assets/chevron-left-jGoftk_A.js +0 -8
- package/assets/chevron-right-Dt6SfcNy.js +0 -8
- package/assets/chevron-top-CBCgyIVe.js +0 -8
- package/assets/close-BQpWkcd5.js +0 -8
- package/assets/common-B5-2TPMC.js +0 -1
- package/assets/controller-BW9fJMCh.js +0 -2
- package/assets/core-f4taWsy5.js +0 -908
- package/assets/create-submenu-DEFVbrc5.png +0 -0
- package/assets/createBundlerClient-r1Kofl9Y.js +0 -8
- package/assets/cursor-l_ly71I2.js +0 -3
- package/assets/decimals-BB5yEnWu.js +0 -1
- package/assets/decimals-D7yTLBH-.js +0 -1
- package/assets/detectExtension-BOyq5ueD.js +0 -1
- package/assets/engine-COatTZhI.js +0 -1
- package/assets/estimate-l1-fee-gm3XrWSf.js +0 -1
- package/assets/eth_estimateGas-A6ba-Fl3.js +0 -1
- package/assets/eth_getStorageAt-DiqyV3Wq.js +0 -1
- package/assets/eth_getTransactionCount-CF50onAO.js +0 -1
- package/assets/ethereum-Bb-GI0c-.js +0 -1
- package/assets/events-CjOrSHaz.js +0 -1
- package/assets/explore-submenu-KVl6Dc-h.png +0 -0
- package/assets/external-link-C6RRSRES.js +0 -8
- package/assets/extractIPFS-BchHnCEN.js +0 -1
- package/assets/fetchTokenMetadata-ClRC5ORW.js +0 -2
- package/assets/get-ecosystem-wallet-info-C2CJ_2OU.js +0 -1
- package/assets/getBalance-DGuxWuYL.js +0 -1
- package/assets/getInstalledModules-A3tAP18V.js +0 -1
- package/assets/getNFT-C7cllYFm.js +0 -1
- package/assets/getNFT-CQKD7QHk.js +0 -2
- package/assets/governance-submenu-CXxLX9nT.png +0 -0
- package/assets/hashTypedData-7WNMs5EV.js +0 -1
- package/assets/in-app-wallet-calls-CIRR0eJZ.js +0 -1
- package/assets/index-B1P0UjN9.js +0 -1
- package/assets/index-BNdVKnva.js +0 -2
- package/assets/index-BtvcwkC4.js +0 -1
- package/assets/index-C3CMrfih.js +0 -1
- package/assets/index-C8ynIJrk.js +0 -395
- package/assets/index-Ca6sys5l.js +0 -3
- package/assets/index-CvqvWWYJ.js +0 -2
- package/assets/index-CxA55UWl.js +0 -1
- package/assets/index-D-W42D03.js +0 -12
- package/assets/index-DC9TKWAz.js +0 -23
- package/assets/index-DFfsl0Io.js +0 -4
- package/assets/index-DN2JqH-l.js +0 -895
- package/assets/index-DfqIHbWG.js +0 -2
- package/assets/index-pQ6ZXw4u.js +0 -13
- package/assets/index-qMD90g0X.js +0 -1
- package/assets/index.es-B2O4h03u.js +0 -12
- package/assets/index.es-BEAksKXY.js +0 -2
- package/assets/index.es-Dxxm_SKC.js +0 -1
- package/assets/index.es-MXG0VeeZ.js +0 -27
- package/assets/index.umd-DvfMpbcY.js +0 -1
- package/assets/is-plan-event-enabled-DS1Agtkw.js +0 -1
- package/assets/learn-submenu-Xs1jOwfy.png +0 -0
- package/assets/localBatchGatewayRequest-CHeIulW5.js +0 -1
- package/assets/marketplace-submenu-CjxTqNhj.png +0 -0
- package/assets/off-BCDn43Xl.js +0 -8
- package/assets/openzeppelin-_xpy9vRo.js +0 -1
- package/assets/ownerOf-ClSM4brX.js +0 -1
- package/assets/parseNft-BmEusGKu.js +0 -2
- package/assets/passkeys-CqFedyqV.js +0 -1
- package/assets/resolveImplementation-BssH7H5b.js +0 -1
- package/assets/rpc-DMtarHL0.js +0 -3
- package/assets/search-CAzZVrZw.js +0 -8
- package/assets/secp256k1-C_4ya0Qz.js +0 -1
- package/assets/secp256k1-CnKxz2gu.js +0 -1
- package/assets/secp256k1-oGq0B4P7.js +0 -1
- package/assets/send-batch-transaction-DfUNUZ4Z.js +0 -1
- package/assets/send-eip712-transaction-Ro5QmOlW.js +0 -2
- package/assets/send-gasless-transaction-B-Uu5KdW.js +0 -2
- package/assets/session-proposal-CRjqbz7W.js +0 -1
- package/assets/session-request-BI3BlMfs.js +0 -2
- package/assets/sha256-ChRob2fv.js +0 -1
- package/assets/signing-B1K_Jdsm.js +0 -30
- package/assets/thirdweb-0Fl_ECmE.js +0 -27
- package/assets/thirdweb-DZ2vK6IO.js +0 -1
- package/assets/totalSupply-ClM38QOc.js +0 -1
- package/assets/utils-B3vUvlNq.js +0 -1
- package/assets/wait-for-tx-receipt-pc2BJc62.js +0 -1
- package/assets/wallets-Dj6CY1yi.js +0 -17
- package/assets/web-connector-CiZO9RvI.js +0 -9
- package/assets/zora-sepolia-CZ4Tf1UH.js +0 -1
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const __vite__fileDeps=["assets/get-ecosystem-wallet-info-C2CJ_2OU.js","assets/signing-B1K_Jdsm.js","assets/utils-B3vUvlNq.js","assets/index-DN2JqH-l.js","assets/hashTypedData-7WNMs5EV.js","assets/events-CjOrSHaz.js","assets/index.es-MXG0VeeZ.js","assets/index-nibyPLVP.js","assets/ethereum-Bb-GI0c-.js","assets/index-pQ6ZXw4u.js","assets/createBundlerClient-r1Kofl9Y.js","assets/localBatchGatewayRequest-CHeIulW5.js","assets/hooks.module-Cpp96UEK.js","assets/index-Ca6sys5l.js","assets/index-6E4L_h32.js","assets/web-connector-CiZO9RvI.js","assets/sleep-mAKpSMLY.js","assets/index-BNdVKnva.js","assets/send-eip712-transaction-Ro5QmOlW.js","assets/sha256-ChRob2fv.js","assets/controller-BW9fJMCh.js","assets/rpc-DMtarHL0.js","assets/qr-overlay-DsRPQv6v.js","assets/getBalance-DGuxWuYL.js","assets/decimals-BB5yEnWu.js","assets/secp256k1-CnKxz2gu.js","assets/session-proposal-CRjqbz7W.js","assets/session-request-BI3BlMfs.js","assets/in-app-wallet-calls-CIRR0eJZ.js","assets/wait-for-tx-receipt-pc2BJc62.js","assets/send-batch-transaction-DfUNUZ4Z.js","assets/eth_getTransactionCount-CF50onAO.js"],__vite__mapDeps=i=>i.map(i=>__vite__fileDeps[i]);
|
|
2
|
-
import{u as zi,au as af,av as cf,aw as lf,ax as Ql,ay as uf,m as J,az as hf,aA as Sr,aB as Xl,ac as Be,af as Rn,k as Ca,l as df,p as ke,a as Ii,s as Ee,aC as eu,aD as tu,aE as nu,aq as ko,aF as Bo,aG as ff,n as No,aH as pf,f as _f,aI as ru,S as wf,aJ as mf,aK as yf,aL as gf,aM as Ef,v as ji,B as vf,al as js,an as iu,aN as Mo,aO as su,Q as bf,g as qo,ap as $a,aP as If,a6 as Af,N as Ua,a2 as Tf,J as Pf,aQ as ka,y as ou,A as Of,aR as Rf,aS as wn,ak as Lf,j as Df,aT as xf,a0 as Vf,ab as Sf,aU as Cf}from"./signing-B1K_Jdsm.js";import{c as $f,e as au,f as Vn,b as be,h as zo,w as cu,g as Ki,j as Uf,k as kf,l as Bf,d as Nf,a as Fr,m as Mf}from"./utils-B3vUvlNq.js";import{g as c,J as qf}from"./index-DN2JqH-l.js";import{g as zf,v as jf,s as Kf,w as Ff,p as Hf}from"./hashTypedData-7WNMs5EV.js";import{e as Sn,k as lu}from"./events-CjOrSHaz.js";import{h as Qr,i as Ai,j as jo,I as Jn,b as Ba,g as Wf,c as q,a as Hn,C as Gf,d as uu,e as Zf,f as Yf,s as Ks,k as Ko,A as Jf,E as ze,l as Qf,y as rt,m as sn,r as Qn,B as hu,o as Xf,n as ep,p as Fo,q as Ho,t as Ti,P as Na,Q as tp,u as np,v as vn,w as du,x as $t,z as Pt,D as Ft}from"./index.es-MXG0VeeZ.js";import{c as rp,a as ip,k as sp,d as op,s as ap,g as Ma}from"./index-nibyPLVP.js";import{e as cp}from"./ethereum-Bb-GI0c-.js";function lp(n=32){return zi(up(n))}function up(n=32){return globalThis.crypto.getRandomValues(new Uint8Array(n))}function hp(n){const t=cf(n);return lf("0x19",Ql(`Ethereum Signed Message:
|
|
3
|
-
`+uf(t)),t)}function dp(n){return af(hp(n))}const nP="0xfffffffffffffffffffffffffffffff0000000000000000000000000000000007aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1c",fp="0x85e23b94e7F5E9cC1fF78BCe78cfb15B81f0DF00",pp="0x4be0ddfebca9a5a4a617dee4dece99e7c862dceb",Fi="0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",_p="0x0000000071727De22E5E9d8BAf0edAc6f37da032",wp=50000n,mp=n=>yp(n||Fi)==="v0.7"?pp:fp,fu=n=>{const t=$f().bundler;return t.startsWith("localhost:")?`http://${t}/v2?chain=${n.id}`:`https://${n.id}.${t}/v2`},yp=n=>{const t=J(n);if(t===Fi)return"v0.6";if(t===_p)return"v0.7";throw new Error("Unknown paymaster version")};async function Ye(n){const{client:t,ecosystem:e,walletType:r,walletAddress:i,chainId:s}=n;return hf({client:t,data:{action:"connect",chainId:s,source:"connectWallet",walletAddress:i,walletType:r},ecosystem:e})}function Wo(n){const t=n.domain;return(t==null?void 0:t.chainId)!==void 0&&Sr(t.chainId)&&(n.domain={...n.domain,chainId:Xl(n.domain.chainId)}),n}const gp={"0x0":"reverted","0x1":"success"};function Go(n){var r;const[t,e]=(()=>{const i=n.status;return i>=100&&i<200?["pending",i]:i>=200&&i<300?["success",i]:i>=300&&i<700?["failure",i]:i==="CONFIRMED"?["success",200]:i==="PENDING"?["pending",100]:[void 0,i]})();return{...n,atomic:n.atomic,chainId:n.chainId?Rn(n.chainId):void 0,receipts:((r=n.receipts)==null?void 0:r.map(i=>({...i,blockNumber:Be(i.blockNumber),gasUsed:Be(i.gasUsed),status:gp[i.status]})))??[],status:t,statusCode:e,version:n.version}}function Zo(n,t){const e={};for(const[r,i]of Object.entries(n)){e[Number(r)]={};const s={};for(const[o,a]of Object.entries(i))s[o]=a;e[Number(r)]=s}return typeof t=="number"?{[t]:e[t]}:e}async function Yo(n,t){const e=n.calls[0];if(!e)throw new Error("No calls to send");const{calls:r,capabilities:i,version:s="2.0.0",chain:o=e.chain}=n,a=await Promise.all(r.map(async u=>{const{to:h,value:d}=u;if(h===void 0&&u.data===void 0)throw new Error("Cannot send call, `to` or `data` must be provided.");const[f,p,w]=await Promise.all([Ca(h),df(u),Ca(d)]);return f?{data:p,to:J(f),value:typeof w=="bigint"||typeof w=="number"?ke(w):void 0}:{data:p,to:void 0,value:void 0}}));return{callParams:[{atomicRequired:n.atomicRequired??!1,calls:a,capabilities:i,chainId:ke(o.id),from:J(t.address),version:s}],chain:o}}function Jo(n){return Ep(n).map(t=>{try{const e=new URL(t);return e.hostname.endsWith(".thirdweb.com")&&(e.pathname="",e.search=""),e.toString()}catch{return t}})}function Ep(n,t,e="http"){const r=[];for(const i of n.rpc)e==="http"&&!i.startsWith("http")||e==="ws"&&!i.startsWith("ws")||(i.includes("${THIRDWEB_API_KEY}")?r.push(i.replace("${THIRDWEB_API_KEY}","")):i.includes("${")||r.push(i));if(r.length===0)throw new Error(`No RPC available for chainId "${n.chainId}" with mode ${e}`);return r}function gt(n){return typeof n=="number"?n:Ii(n)?Rn(n):typeof n=="bigint"?Number(n):Number.parseInt(n,10)}function vp(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}function bp(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function pu(){return!vp()&&!bp()}const Ot="com.coinbase.wallet",qt="org.base.account",_u="io.metamask",Ip="me.rainbow",Ap="io.zerion.wallet",Pi={async getItem(n){try{if(typeof window<"u"&&window.localStorage)return localStorage.getItem(n)}catch{}return null},async removeItem(n){typeof window<"u"&&window.localStorage&&localStorage.removeItem(n)},async setItem(n,t){try{typeof window<"u"&&window.localStorage&&localStorage.setItem(n,t)}catch{}}};function Qo(n){return n.startsWith("http://")||n.startsWith("https://")}function wu(n,t){if(!Qo(n))return mu(n,t);let e=n;e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function mu(n,t){if(Qo(n))return wu(n,t);let e=n;e.includes("://")||(e=n.replaceAll("/","").replaceAll(":",""),e=`${e}://`),e.endsWith("/")||(e=`${e}/`);const r=encodeURIComponent(t);return{href:e,redirect:`${e}wc?uri=${r}`}}function Tp(n,t){return Qo(n)?wu(n,t):mu(n,t)}function Pp(){if(typeof navigator>"u")return!1;const n=au(navigator.userAgent);return n?n.toLowerCase().includes("android"):!1}function Op(){if(typeof navigator>"u")return!1;const n=au(navigator.userAgent);return n?n.toLowerCase().includes("ios")||n.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function Rp(){return typeof window>"u"||typeof navigator>"u"?!1:"ontouchstart"in window||navigator.maxTouchPoints>0||navigator.msMaxTouchPoints>0}function Lp(){return typeof window>"u"?!1:"orientation"in window||"onorientationchange"in window}function qa(){return!!(Pp()||Op()||Rp()&&Lp()||typeof window<"u"&&window.innerWidth<640)}function ss(n){if(window!==window.top)window.open(n);else if(n.startsWith("http")){const e=document.createElement("a");e.href=n,e.target="_blank",e.rel="noreferrer noopener",e.click()}else window.location.href=n}function Xn(n){return typeof n=="string"?n.startsWith("ecosystem."):n.id.startsWith("ecosystem.")}async function yu(n,t){if(Xn(n)){const{getEcosystemWalletInfo:e}=await c(async()=>{const{getEcosystemWalletInfo:r}=await import("./get-ecosystem-wallet-info-C2CJ_2OU.js");return{getEcosystemWalletInfo:r}},__vite__mapDeps([0,1,2,3,4,5,6,7,8]));return t?e(n).then(r=>r.image_id):e(n)}switch(n){case"smart":return t?c(()=>import("./image-BnYtBA0B.js"),[]).then(e=>e.default):c(()=>import("./index-BuSavAVK.js"),[]).then(e=>e.wallet);case"inApp":return t?c(()=>import("./image-YhquT9-B.js"),[]).then(e=>e.default):c(()=>import("./index-B6yqoFuC.js"),[]).then(e=>e.wallet);case"walletConnect":return t?c(()=>import("./image-B3sWXgWp.js"),[]).then(e=>e.default):c(()=>import("./index-B21BIk0D.js"),[]).then(e=>e.wallet);case"embedded":return t?c(()=>import("./image-CE6B5igp.js"),[]).then(e=>e.default):c(()=>import("./index-CZfaBXw3.js"),[]).then(e=>e.wallet);case"adapter":return t?c(()=>import("./image-CaoCxndE.js"),[]).then(e=>e.default):c(()=>import("./index-DkPRLpmE.js"),[]).then(e=>e.wallet);case"io.1inch.wallet":return t?c(()=>import("./image-DcM8byf5.js"),[]).then(e=>e.default):c(()=>import("./index-B8SH8PS4.js"),[]).then(e=>e.wallet);case"com.binance.wallet":return t?c(()=>import("./image-B6woX8-F.js"),[]).then(e=>e.default):c(()=>import("./index-D1Wt1Kx7.js"),[]).then(e=>e.wallet);case"com.ledger":return t?c(()=>import("./image-CGobRsqC.js"),[]).then(e=>e.default):c(()=>import("./index-C63hJ0G0.js"),[]).then(e=>e.wallet);case"com.bitpay":return t?c(()=>import("./image-oGFA7lCe.js"),[]).then(e=>e.default):c(()=>import("./index-Bl6ScMn3.js"),[]).then(e=>e.wallet);case"com.bestwallet":return t?c(()=>import("./image-YzdSnFCd.js"),[]).then(e=>e.default):c(()=>import("./index-C_fnrq8t.js"),[]).then(e=>e.wallet);case"io.metamask":return t?c(()=>import("./image-rAE1A9js.js"),[]).then(e=>e.default):c(()=>import("./index-DaZnaClT.js"),[]).then(e=>e.wallet);case"com.trustwallet.app":return t?c(()=>import("./image-DhOOZChF.js"),[]).then(e=>e.default):c(()=>import("./index-9552Tb-C.js"),[]).then(e=>e.wallet);case"com.fireblocks":return t?c(()=>import("./image-C_rXI8lY.js"),[]).then(e=>e.default):c(()=>import("./index-fm1oF4Rd.js"),[]).then(e=>e.wallet);case"com.bitget.web3":return t?c(()=>import("./image-Cyu_SKNX.js"),[]).then(e=>e.default):c(()=>import("./index-7Xw6Dozy.js"),[]).then(e=>e.wallet);case"pro.tokenpocket":return t?c(()=>import("./image--EMjkbyZ.js"),[]).then(e=>e.default):c(()=>import("./index-C6d9DLRH.js"),[]).then(e=>e.wallet);case"com.safepal":return t?c(()=>import("./image-CPrfOTN2.js"),[]).then(e=>e.default):c(()=>import("./index-BKoDPf_i.js"),[]).then(e=>e.wallet);case"org.uniswap":return t?c(()=>import("./image-DzLDqqsm.js"),[]).then(e=>e.default):c(()=>import("./index-j8mIFeCA.js"),[]).then(e=>e.wallet);case"io.zerion.wallet":return t?c(()=>import("./image-CXpsLPxr.js"),[]).then(e=>e.default):c(()=>import("./index-CAYpPiIA.js"),[]).then(e=>e.wallet);case"com.elrond.maiar.wallet":return t?c(()=>import("./image-Zh059TUR.js"),[]).then(e=>e.default):c(()=>import("./index-CN99OAiz.js"),[]).then(e=>e.wallet);case"com.crypto.wallet":return t?c(()=>import("./image-BbeMBRJP.js"),[]).then(e=>e.default):c(()=>import("./index-DoeeKGAI.js"),[]).then(e=>e.wallet);case"com.bitcoin":return t?c(()=>import("./image-CIhcwJo_.js"),[]).then(e=>e.default):c(()=>import("./index-COFjg0BY.js"),[]).then(e=>e.wallet);case"com.bifrostwallet":return t?c(()=>import("./image-BJbq9ykO.js"),[]).then(e=>e.default):c(()=>import("./index-Cw9NGSPc.js"),[]).then(e=>e.wallet);case"jp.co.rakuten-wallet":return t?c(()=>import("./image-CkSdZpFq.js"),[]).then(e=>e.default):c(()=>import("./index-CU6dgzkA.js"),[]).then(e=>e.wallet);case"com.bybit":return t?c(()=>import("./image-CVPmP4Bl.js"),[]).then(e=>e.default):c(()=>import("./index-m0YDsCpu.js"),[]).then(e=>e.wallet);case"com.blockchain.login":return t?c(()=>import("./image-BvEJhPGs.js"),[]).then(e=>e.default):c(()=>import("./index-C8VMxu1Z.js"),[]).then(e=>e.wallet);case"io.trezor":return t?c(()=>import("./image-BQXnGJhx.js"),[]).then(e=>e.default):c(()=>import("./index-CDqfDzT6.js"),[]).then(e=>e.wallet);case"im.token":return t?c(()=>import("./image-ChDeiuh7.js"),[]).then(e=>e.default):c(()=>import("./index-iJWzlNVI.js"),[]).then(e=>e.wallet);case"global.safe":return t?c(()=>import("./image-B6ncW7rJ.js"),[]).then(e=>e.default):c(()=>import("./index-HPp1Id1p.js"),[]).then(e=>e.wallet);case"xyz.ctrl":return t?c(()=>import("./image-DsOpF0U0.js"),[]).then(e=>e.default):c(()=>import("./index-CW6lKp1A.js"),[]).then(e=>e.wallet);case"co.arculus":return t?c(()=>import("./image-CYFfk7g3.js"),[]).then(e=>e.default):c(()=>import("./index-s6ugJH3L.js"),[]).then(e=>e.wallet);case"com.roninchain.wallet":return t?c(()=>import("./image-BMgLTkFN.js"),[]).then(e=>e.default):c(()=>import("./index-caEr82M6.js"),[]).then(e=>e.wallet);case"com.okex.wallet":return t?c(()=>import("./image-Ck2fht2U.js"),[]).then(e=>e.default):c(()=>import("./index-CbEIEIEo.js"),[]).then(e=>e.wallet);case"com.wemixplay":return t?c(()=>import("./image-Dfhapk7_.js"),[]).then(e=>e.default):c(()=>import("./index-C8AQSvJD.js"),[]).then(e=>e.wallet);case"com.tangem":return t?c(()=>import("./image-xMsS8TDb.js"),[]).then(e=>e.default):c(()=>import("./index-CKXDw-uc.js"),[]).then(e=>e.wallet);case"com.exodus":return t?c(()=>import("./image-BULUy74S.js"),[]).then(e=>e.default):c(()=>import("./index-DszThTMl.js"),[]).then(e=>e.wallet);case"com.hashpack.wallet":return t?c(()=>import("./image-BFzDP99B.js"),[]).then(e=>e.default):c(()=>import("./index-wBbkQCZY.js"),[]).then(e=>e.wallet);case"id.co.pintu":return t?c(()=>import("./image-CsH_NRy-.js"),[]).then(e=>e.default):c(()=>import("./index-DHDm_YtM.js"),[]).then(e=>e.wallet);case"network.blackfort":return t?c(()=>import("./image-CTLwieHz.js"),[]).then(e=>e.default):c(()=>import("./index-DZRVQyzq.js"),[]).then(e=>e.wallet);case"com.wigwam.wallet":return t?c(()=>import("./image-xaEWk6k8.js"),[]).then(e=>e.default):c(()=>import("./index-BA0Hn6eE.js"),[]).then(e=>e.wallet);case"app.backpack":return t?c(()=>import("./image-YbQrvLSP.js"),[]).then(e=>e.default):c(()=>import("./index-B8BWAl26.js"),[]).then(e=>e.wallet);case"app.subwallet":return t?c(()=>import("./image-BdqmMP8T.js"),[]).then(e=>e.default):c(()=>import("./index-7C_yDnI4.js"),[]).then(e=>e.wallet);case"cc.avacus":return t?c(()=>import("./image-uGs9mRWl.js"),[]).then(e=>e.default):c(()=>import("./index-BFZxo6Jc.js"),[]).then(e=>e.wallet);case"me.rainbow":return t?c(()=>import("./image-DSGxNIm1.js"),[]).then(e=>e.default):c(()=>import("./index-3d3uK5Ax.js"),[]).then(e=>e.wallet);case"so.onekey.app.wallet":return t?c(()=>import("./image-CwaGmiHI.js"),[]).then(e=>e.default):c(()=>import("./index-CUEmD5dS.js"),[]).then(e=>e.wallet);case"me.haha":return t?c(()=>import("./image-Npe5Xkhl.js"),[]).then(e=>e.default):c(()=>import("./index-B7GQyWAF.js"),[]).then(e=>e.wallet);case"com.bee":return t?c(()=>import("./image-Sy6X7CtO.js"),[]).then(e=>e.default):c(()=>import("./index-CQ3aQg5G.js"),[]).then(e=>e.wallet);case"ag.jup":return t?c(()=>import("./image-BuqgjEJD.js"),[]).then(e=>e.default):c(()=>import("./index-D30RfPa1.js"),[]).then(e=>e.wallet);case"app.keplr":return t?c(()=>import("./image-DpeCw-px.js"),[]).then(e=>e.default):c(()=>import("./index-BnsE1W-S.js"),[]).then(e=>e.wallet);case"org.hot-labs":return t?c(()=>import("./image-DFf3lDA_.js"),[]).then(e=>e.default):c(()=>import("./index-DDwu-IMz.js"),[]).then(e=>e.wallet);case"com.dcentwallet":return t?c(()=>import("./image-CUPOo6zK.js"),[]).then(e=>e.default):c(()=>import("./index-Bm92iZMY.js"),[]).then(e=>e.wallet);case"com.kraken":return t?c(()=>import("./image-BP17CoHz.js"),[]).then(e=>e.default):c(()=>import("./index-BFGXqrJS.js"),[]).then(e=>e.wallet);case"com.kucoin":return t?c(()=>import("./image-JIl7mHMQ.js"),[]).then(e=>e.default):c(()=>import("./index-DRVDpxj6.js"),[]).then(e=>e.wallet);case"io.magiceden.wallet":return t?c(()=>import("./image-B7QIFAir.js"),[]).then(e=>e.default):c(()=>import("./index-DMTU8hfu.js"),[]).then(e=>e.wallet);case"com.tomi":return t?c(()=>import("./image-COwCE3RO.js"),[]).then(e=>e.default):c(()=>import("./index-C7njqxXR.js"),[]).then(e=>e.wallet);case"io.ibvm":return t?c(()=>import("./image-CVBI4BwD.js"),[]).then(e=>e.default):c(()=>import("./index-HzSvsrak.js"),[]).then(e=>e.wallet);case"com.mewwallet":return t?c(()=>import("./image-Dx4ya6_y.js"),[]).then(e=>e.default):c(()=>import("./index-DEzKWTBJ.js"),[]).then(e=>e.wallet);case"com.socios.app":return t?c(()=>import("./image-COKP1J8V.js"),[]).then(e=>e.default):c(()=>import("./index-D06ftJGd.js"),[]).then(e=>e.wallet);case"xyz.argent":return t?c(()=>import("./image-5mReG_-1.js"),[]).then(e=>e.default):c(()=>import("./index-CQPZVLgk.js"),[]).then(e=>e.wallet);case"org.thorwallet":return t?c(()=>import("./image-Dmp2jTO0.js"),[]).then(e=>e.default):c(()=>import("./index-NO3dCFlG.js"),[]).then(e=>e.wallet);case"io.internetmoney":return t?c(()=>import("./image-D4PYvYqY.js"),[]).then(e=>e.default):c(()=>import("./index-BZwq4W5O.js"),[]).then(e=>e.wallet);case"org.mathwallet":return t?c(()=>import("./image-mMy4SSmg.js"),[]).then(e=>e.default):c(()=>import("./index-lGNYNhMi.js"),[]).then(e=>e.wallet);case"io.cypherhq":return t?c(()=>import("./image-B14TCFf5.js"),[]).then(e=>e.default):c(()=>import("./index-yURkkC3L.js"),[]).then(e=>e.wallet);case"io.novawallet":return t?c(()=>import("./image-DDso8kuB.js"),[]).then(e=>e.default):c(()=>import("./index-C91aPf2g.js"),[]).then(e=>e.wallet);case"io.yowallet":return t?c(()=>import("./image-Bx8buncY.js"),[]).then(e=>e.default):c(()=>import("./index-B062fuzr.js"),[]).then(e=>e.wallet);case"com.flowfoundation.wallet":return t?c(()=>import("./image-Da2xkAVi.js"),[]).then(e=>e.default):c(()=>import("./index-CBVJzm96.js"),[]).then(e=>e.wallet);case"app.kabila":return t?c(()=>import("./image-B-l20wIO.js"),[]).then(e=>e.default):c(()=>import("./index-cTRIo3rN.js"),[]).then(e=>e.wallet);case"com.opera":return t?c(()=>import("./image-sDrIF89f.js"),[]).then(e=>e.default):c(()=>import("./index-lIOVfT2m.js"),[]).then(e=>e.wallet);case"com.valoraapp":return t?c(()=>import("./image-5QXPaavh.js"),[]).then(e=>e.default):c(()=>import("./index-C6baQHax.js"),[]).then(e=>e.wallet);case"com.robinhood.wallet":return t?c(()=>import("./image-DBehogZh.js"),[]).then(e=>e.default):c(()=>import("./index-bzH6W7xo.js"),[]).then(e=>e.wallet);case"com.chain":return t?c(()=>import("./image-qsAyF5Oj.js"),[]).then(e=>e.default):c(()=>import("./index-npRlG_V2.js"),[]).then(e=>e.wallet);case"io.huddln":return t?c(()=>import("./image-CQm90J-d.js"),[]).then(e=>e.default):c(()=>import("./index-DILut-jL.js"),[]).then(e=>e.wallet);case"app.core.extension":return t?c(()=>import("./image-De2xpum1.js"),[]).then(e=>e.default):c(()=>import("./index-BtfbjCVr.js"),[]).then(e=>e.wallet);case"world.freedom":return t?c(()=>import("./image-COnY36UD.js"),[]).then(e=>e.default):c(()=>import("./index-BZUSQkq9.js"),[]).then(e=>e.wallet);case"money.unstoppable":return t?c(()=>import("./image-Bvw8wNRu.js"),[]).then(e=>e.default):c(()=>import("./index-CW8D5Pv5.js"),[]).then(e=>e.wallet);case"pk.modular":return t?c(()=>import("./image-CaHdVXd1.js"),[]).then(e=>e.default):c(()=>import("./index-1CA6ps09.js"),[]).then(e=>e.wallet);case"app.wombat":return t?c(()=>import("./image-ExeF69qZ.js"),[]).then(e=>e.default):c(()=>import("./index-D9Jrno_D.js"),[]).then(e=>e.wallet);case"com.klipwallet":return t?c(()=>import("./image-8vXf4Xjy.js"),[]).then(e=>e.default):c(()=>import("./index-CcNQ53IV.js"),[]).then(e=>e.wallet);case"com.gemwallet":return t?c(()=>import("./image-M7TV7WaH.js"),[]).then(e=>e.default):c(()=>import("./index-BtZsXMJj.js"),[]).then(e=>e.wallet);case"com.sabay.wallet":return t?c(()=>import("./image-CsNgSbbt.js"),[]).then(e=>e.default):c(()=>import("./index-BVAmxcaa.js"),[]).then(e=>e.wallet);case"com.zengo":return t?c(()=>import("./image-DNtaIeSw.js"),[]).then(e=>e.default):c(()=>import("./index-DDk7D3eE.js"),[]).then(e=>e.wallet);case"xyz.joeywallet":return t?c(()=>import("./image-CTsHGgDx.js"),[]).then(e=>e.default):c(()=>import("./index-Im6F3t68.js"),[]).then(e=>e.wallet);case"io.tokoin":return t?c(()=>import("./image-DQzzFCs2.js"),[]).then(e=>e.default):c(()=>import("./index-Bwjy4Jw7.js"),[]).then(e=>e.wallet);case"io.alpha-u.wallet.web":return t?c(()=>import("./image-DLiMUWBI.js"),[]).then(e=>e.default):c(()=>import("./index-DFt1vT8N.js"),[]).then(e=>e.wallet);case"network.cvl":return t?c(()=>import("./image-CtZg2vKX.js"),[]).then(e=>e.default):c(()=>import("./index-D2vPh3Mc.js"),[]).then(e=>e.wallet);case"io.leapwallet":return t?c(()=>import("./image-DHnnMCFG.js"),[]).then(e=>e.default):c(()=>import("./index-BdkJrfxl.js"),[]).then(e=>e.wallet);case"io.xenea":return t?c(()=>import("./image-B5ZxW0VG.js"),[]).then(e=>e.default):c(()=>import("./index-C8mAROh2.js"),[]).then(e=>e.wallet);case"com.oasys-wallet":return t?c(()=>import("./image-W7SfqKZe.js"),[]).then(e=>e.default):c(()=>import("./index-gQ8zpnGO.js"),[]).then(e=>e.wallet);case"com.bitso":return t?c(()=>import("./image-LfonVSeq.js"),[]).then(e=>e.default):c(()=>import("./index-YcqLCtWD.js"),[]).then(e=>e.wallet);case"io.enjin":return t?c(()=>import("./image-BnXzDKuV.js"),[]).then(e=>e.default):c(()=>import("./index-Jmrm9oUu.js"),[]).then(e=>e.wallet);case"com.coldwallet":return t?c(()=>import("./image-CVrpZdwi.js"),[]).then(e=>e.default):c(()=>import("./index-CkqupmC6.js"),[]).then(e=>e.wallet);case"org.creditcoin.app":return t?c(()=>import("./image-CzL8n4ZU.js"),[]).then(e=>e.default):c(()=>import("./index-B94SpzOt.js"),[]).then(e=>e.wallet);case"app.everspace":return t?c(()=>import("./image-ripXpF5P.js"),[]).then(e=>e.default):c(()=>import("./index-COlGaDkw.js"),[]).then(e=>e.wallet);case"app.zeal":return t?c(()=>import("./image-hO8Jv2oh.js"),[]).then(e=>e.default):c(()=>import("./index-B6n-vVE0.js"),[]).then(e=>e.wallet);case"app.whitewallet":return t?c(()=>import("./image-D7wXb0Un.js"),[]).then(e=>e.default):c(()=>import("./index-SCBLsVUL.js"),[]).then(e=>e.wallet);case"ai.purewallet":return t?c(()=>import("./image-K1HoU8Qi.js"),[]).then(e=>e.default):c(()=>import("./index-DZ2hd5eC.js"),[]).then(e=>e.wallet);case"com.fastex.wallet":return t?c(()=>import("./image-lBIlUHFP.js"),[]).then(e=>e.default):c(()=>import("./index-CMzQk3O6.js"),[]).then(e=>e.wallet);case"io.kriptomat":return t?c(()=>import("./image-6ouyxZRt.js"),[]).then(e=>e.default):c(()=>import("./index-wk2CJ7i5.js"),[]).then(e=>e.wallet);case"com.ullapay":return t?c(()=>import("./image-Bn2sAgXJ.js"),[]).then(e=>e.default):c(()=>import("./index-D_d6gemZ.js"),[]).then(e=>e.wallet);case"io.atomicwallet":return t?c(()=>import("./image-D55LvXjp.js"),[]).then(e=>e.default):c(()=>import("./index-DEV4egrN.js"),[]).then(e=>e.wallet);case"com.pionewallet":return t?c(()=>import("./image-B_0Cqkss.js"),[]).then(e=>e.default):c(()=>import("./index-BogX5ITG.js"),[]).then(e=>e.wallet);case"io.oxalus":return t?c(()=>import("./image-DTa4RXUa.js"),[]).then(e=>e.default):c(()=>import("./index-CuQBw1y6.js"),[]).then(e=>e.wallet);case"xyz.uniultra.wallet":return t?c(()=>import("./image-BSLjXnNe.js"),[]).then(e=>e.default):c(()=>import("./index-CJYo3Znz.js"),[]).then(e=>e.wallet);case"xyz.frontier.wallet":return t?c(()=>import("./image-Bdtwdp85.js"),[]).then(e=>e.default):c(()=>import("./index--YTVamH2.js"),[]).then(e=>e.wallet);case"com.coolbitx.cwsapp":return t?c(()=>import("./image-DWR067hG.js"),[]).then(e=>e.default):c(()=>import("./index-tkvX3w1X.js"),[]).then(e=>e.wallet);case"org.gooddollar":return t?c(()=>import("./image-y3eCNAT6.js"),[]).then(e=>e.default):c(()=>import("./index-C7N44kNF.js"),[]).then(e=>e.wallet);case"com.cakewallet":return t?c(()=>import("./image-BqQffU2u.js"),[]).then(e=>e.default):c(()=>import("./index-DPCPDLBT.js"),[]).then(e=>e.wallet);case"com.ellipal":return t?c(()=>import("./image-vuuCn07N.js"),[]).then(e=>e.default):c(()=>import("./index-jTpsrMvb.js"),[]).then(e=>e.wallet);case"app.krystal":return t?c(()=>import("./image-C2QANSRr.js"),[]).then(e=>e.default):c(()=>import("./index-B7dAHFam.js"),[]).then(e=>e.wallet);case"com.monarchwallet":return t?c(()=>import("./image-BNA4BP9T.js"),[]).then(e=>e.default):c(()=>import("./index-C7WD5W_Z.js"),[]).then(e=>e.wallet);case"com.burritowallet":return t?c(()=>import("./image-BI-5Z38o.js"),[]).then(e=>e.default):c(()=>import("./index-DpRqa1iX.js"),[]).then(e=>e.wallet);case"co.family.wallet":return t?c(()=>import("./image-CECsJh3H.js"),[]).then(e=>e.default):c(()=>import("./index-DrzmRQ9S.js"),[]).then(e=>e.wallet);case"com.mtpelerin":return t?c(()=>import("./image-BDOqiI6p.js"),[]).then(e=>e.default):c(()=>import("./index-bQArImNA.js"),[]).then(e=>e.wallet);case"app.keyring":return t?c(()=>import("./image-BH6pi8gb.js"),[]).then(e=>e.default):c(()=>import("./index-DLGneTkB.js"),[]).then(e=>e.wallet);case"cc.localtrade.lab":return t?c(()=>import("./image-DRqNpoe6.js"),[]).then(e=>e.default):c(()=>import("./index-D-qw7id5.js"),[]).then(e=>e.wallet);case"tech.okto":return t?c(()=>import("./image-uk4MysVY.js"),[]).then(e=>e.default):c(()=>import("./index-C5ZfEOey.js"),[]).then(e=>e.wallet);case"com.xcapit":return t?c(()=>import("./image-BjFjHCOg.js"),[]).then(e=>e.default):c(()=>import("./index-DbAxetvE.js"),[]).then(e=>e.wallet);case"com.gayawallet":return t?c(()=>import("./image-DC9Wj56E.js"),[]).then(e=>e.default):c(()=>import("./index-D4VnhuTS.js"),[]).then(e=>e.wallet);case"app.nightly":return t?c(()=>import("./image-Bv8VGwx8.js"),[]).then(e=>e.default):c(()=>import("./index-uM5GtqSd.js"),[]).then(e=>e.wallet);case"com.coin98":return t?c(()=>import("./image-Co9P7WAh.js"),[]).then(e=>e.default):c(()=>import("./index-CxBkKx5Q.js"),[]).then(e=>e.wallet);case"xyz.coca":return t?c(()=>import("./image-DaxrbegS.js"),[]).then(e=>e.default):c(()=>import("./index-CAfHv9Ye.js"),[]).then(e=>e.wallet);case"app.linen":return t?c(()=>import("./image-CljvD_on.js"),[]).then(e=>e.default):c(()=>import("./index-DTPO88lj.js"),[]).then(e=>e.wallet);case"dev.auroracloud":return t?c(()=>import("./image-BbwfB3J_.js"),[]).then(e=>e.default):c(()=>import("./index-DqYjD_64.js"),[]).then(e=>e.wallet);case"com.coinomi":return t?c(()=>import("./image-CyezMyAx.js"),[]).then(e=>e.default):c(()=>import("./index-B-oXIR8J.js"),[]).then(e=>e.wallet);case"my.mone":return t?c(()=>import("./image-B7h27Vsd.js"),[]).then(e=>e.default):c(()=>import("./index-3jJtZlGN.js"),[]).then(e=>e.wallet);case"org.alephium":return t?c(()=>import("./image-DDUR5y02.js"),[]).then(e=>e.default):c(()=>import("./index-CRTSSeuy.js"),[]).then(e=>e.wallet);case"com.alicebob":return t?c(()=>import("./image-BKjOwOZU.js"),[]).then(e=>e.default):c(()=>import("./index-DYiL0IsZ.js"),[]).then(e=>e.wallet);case"io.koalawallet":return t?c(()=>import("./image-CTAbQz5j.js"),[]).then(e=>e.default):c(()=>import("./index-DPXkoJXK.js"),[]).then(e=>e.wallet);case"com.veworld":return t?c(()=>import("./image-DKBlkqWK.js"),[]).then(e=>e.default):c(()=>import("./index-DV2Q2KhC.js"),[]).then(e=>e.wallet);case"com.withpaper":return t?c(()=>import("./image-DbBiNCFK.js"),[]).then(e=>e.default):c(()=>import("./index-CExunyqd.js"),[]).then(e=>e.wallet);case"io.noone":return t?c(()=>import("./image-CwDXHpUj.js"),[]).then(e=>e.default):c(()=>import("./index-BEFk-36A.js"),[]).then(e=>e.wallet);case"network.haqq":return t?c(()=>import("./image-BaRuJqy0.js"),[]).then(e=>e.default):c(()=>import("./index--t3K2suC.js"),[]).then(e=>e.wallet);case"io.ricewallet":return t?c(()=>import("./image-CmVMIVLM.js"),[]).then(e=>e.default):c(()=>import("./index-C_j7AjFr.js"),[]).then(e=>e.wallet);case"me.iopay":return t?c(()=>import("./image-CMJsc-Ir.js"),[]).then(e=>e.default):c(()=>import("./index-bsKYZmcs.js"),[]).then(e=>e.wallet);case"app.walletnow":return t?c(()=>import("./image-CmkiYZaU.js"),[]).then(e=>e.default):c(()=>import("./index-C_C9JdoE.js"),[]).then(e=>e.wallet);case"io.okse":return t?c(()=>import("./image-CZ9z1ucT.js"),[]).then(e=>e.default):c(()=>import("./index-_a8zNWKv.js"),[]).then(e=>e.wallet);case"network.over":return t?c(()=>import("./image-Cq54pcgl.js"),[]).then(e=>e.default):c(()=>import("./index-BDifUsn3.js"),[]).then(e=>e.wallet);case"com.aktionariat":return t?c(()=>import("./image-Cc6jyxLi.js"),[]).then(e=>e.default):c(()=>import("./index-Pw2thZ4h.js"),[]).then(e=>e.wallet);case"com.paybolt":return t?c(()=>import("./image-cwzgrAkh.js"),[]).then(e=>e.default):c(()=>import("./index-BxqRct_I.js"),[]).then(e=>e.wallet);case"com.plasma-wallet":return t?c(()=>import("./image-BVO9IT_6.js"),[]).then(e=>e.default):c(()=>import("./index-fiGpKN6W.js"),[]).then(e=>e.wallet);case"org.bytebank":return t?c(()=>import("./image-BP2Ox9Qn.js"),[]).then(e=>e.default):c(()=>import("./index-S5s6rAc3.js"),[]).then(e=>e.wallet);case"io.ethermail":return t?c(()=>import("./image-Duck5tqn.js"),[]).then(e=>e.default):c(()=>import("./index-BoCHG1VO.js"),[]).then(e=>e.wallet);case"com.optowallet":return t?c(()=>import("./image-W-Y_Nm-s.js"),[]).then(e=>e.default):c(()=>import("./index-BP-yDgcx.js"),[]).then(e=>e.wallet);case"finance.openwallet":return t?c(()=>import("./image-M_AWRaKs.js"),[]).then(e=>e.default):c(()=>import("./index-Cv59xn6_.js"),[]).then(e=>e.wallet);case"xyz.sequence":return t?c(()=>import("./image-o3pjQDbu.js"),[]).then(e=>e.default):c(()=>import("./index-D7Gl-ZGb.js"),[]).then(e=>e.wallet);case"com.foxwallet":return t?c(()=>import("./image-DcX8AUYd.js"),[]).then(e=>e.default):c(()=>import("./index-BARF52iT.js"),[]).then(e=>e.wallet);case"app.hbwallet":return t?c(()=>import("./image-BlogSp8o.js"),[]).then(e=>e.default):c(()=>import("./index-CW58bOV7.js"),[]).then(e=>e.wallet);case"it.airgap":return t?c(()=>import("./image-5CGX_QL3.js"),[]).then(e=>e.default):c(()=>import("./index-YDG1R00C.js"),[]).then(e=>e.wallet);case"com.holdstation":return t?c(()=>import("./image-BcNLqzB4.js"),[]).then(e=>e.default):c(()=>import("./index-9Ml23qSY.js"),[]).then(e=>e.wallet);case"io.universaleverything":return t?c(()=>import("./image-D3z3GjMO.js"),[]).then(e=>e.default):c(()=>import("./index-qmNRbp6W.js"),[]).then(e=>e.wallet);case"com.abra":return t?c(()=>import("./image-CCgX-pcz.js"),[]).then(e=>e.default):c(()=>import("./index-_36_A-pH.js"),[]).then(e=>e.wallet);case"org.thepulsewallet":return t?c(()=>import("./image-BxfO9qDl.js"),[]).then(e=>e.default):c(()=>import("./index-DgNvhZ_M.js"),[]).then(e=>e.wallet);case"com.premanft":return t?c(()=>import("./image-pKZ5ApxC.js"),[]).then(e=>e.default):c(()=>import("./index-CbGJyo5C.js"),[]).then(e=>e.wallet);case"xyz.timelesswallet":return t?c(()=>import("./image-DUs_WIFe.js"),[]).then(e=>e.default):c(()=>import("./index-WXvxLSve.js"),[]).then(e=>e.wallet);case"org.bitizen":return t?c(()=>import("./image-TQ3Nh_VF.js"),[]).then(e=>e.default):c(()=>import("./index-Db_DlPJs.js"),[]).then(e=>e.wallet);case"app.ultimate":return t?c(()=>import("./image-ClyvBbEv.js"),[]).then(e=>e.default):c(()=>import("./index-D2Z8_AUU.js"),[]).then(e=>e.wallet);case"io.compasswallet":return t?c(()=>import("./image-D6x5dtDG.js"),[]).then(e=>e.default):c(()=>import("./index-2qmxPQhP.js"),[]).then(e=>e.wallet);case"app.fizzwallet":return t?c(()=>import("./image-E3PT44xu.js"),[]).then(e=>e.default):c(()=>import("./index-DAYuEFQ-.js"),[]).then(e=>e.wallet);case"com.xovawallet":return t?c(()=>import("./image-B02ECgsY.js"),[]).then(e=>e.default):c(()=>import("./index-Bap5Lkty.js"),[]).then(e=>e.wallet);case"app.nicegram":return t?c(()=>import("./image-DH5ootHk.js"),[]).then(e=>e.default):c(()=>import("./index-BEXV42kp.js"),[]).then(e=>e.wallet);case"io.zelcore":return t?c(()=>import("./image-CLUlwzEU.js"),[]).then(e=>e.default):c(()=>import("./index-BLO6pY9b.js"),[]).then(e=>e.wallet);case"app.freighter":return t?c(()=>import("./image-BanazMP9.js"),[]).then(e=>e.default):c(()=>import("./index-CcdGs50g.js"),[]).then(e=>e.wallet);case"app.stickey":return t?c(()=>import("./image-_t2-K1ZP.js"),[]).then(e=>e.default):c(()=>import("./index-Cu2rQjR7.js"),[]).then(e=>e.wallet);case"app.coinstats":return t?c(()=>import("./image-BlZLdRma.js"),[]).then(e=>e.default):c(()=>import("./index-j8xu_BhO.js"),[]).then(e=>e.wallet);case"io.harti":return t?c(()=>import("./image-Xfz-LkLu.js"),[]).then(e=>e.default):c(()=>import("./index-DPhI9JUn.js"),[]).then(e=>e.wallet);case"io.dttd":return t?c(()=>import("./image-pEGSGt6h.js"),[]).then(e=>e.default):c(()=>import("./index-CXYI0OjH.js"),[]).then(e=>e.wallet);case"com.tellaw":return t?c(()=>import("./image-sm-_D7TO.js"),[]).then(e=>e.default):c(()=>import("./index-Ddqy22qU.js"),[]).then(e=>e.wallet);case"io.klever":return t?c(()=>import("./image-BBFbQZtc.js"),[]).then(e=>e.default):c(()=>import("./index-BJAcAgB9.js"),[]).then(e=>e.wallet);case"com.unstoppabledomains":return t?c(()=>import("./image-EUVXQieb.js"),[]).then(e=>e.default):c(()=>import("./index-B1XrJIPH.js"),[]).then(e=>e.wallet);case"is.callback":return t?c(()=>import("./image-Mf3UQvEC.js"),[]).then(e=>e.default):c(()=>import("./index-DTtDhdi2.js"),[]).then(e=>e.wallet);case"ai.pundi":return t?c(()=>import("./image-9BTuaiXb.js"),[]).then(e=>e.default):c(()=>import("./index-Ca7jbqnT.js"),[]).then(e=>e.wallet);case"io.summonersarena":return t?c(()=>import("./image-3-p5LJAk.js"),[]).then(e=>e.default):c(()=>import("./index-ovz39Egy.js"),[]).then(e=>e.wallet);case"io.fizen":return t?c(()=>import("./image-CZLdphQJ.js"),[]).then(e=>e.default):c(()=>import("./index-WwjGYjHa.js"),[]).then(e=>e.wallet);case"fi.pillar":return t?c(()=>import("./image-CVAbhfmI.js"),[]).then(e=>e.default):c(()=>import("./index-BFJUkm8C.js"),[]).then(e=>e.wallet);case"world.ixo":return t?c(()=>import("./image-CsTNl20e.js"),[]).then(e=>e.default):c(()=>import("./index-C-A1j44m.js"),[]).then(e=>e.wallet);case"org.thetatoken":return t?c(()=>import("./image-BstOz2Sd.js"),[]).then(e=>e.default):c(()=>import("./index-BlU4B6pe.js"),[]).then(e=>e.wallet);case"net.gateweb3":return t?c(()=>import("./image-CypdirPa.js"),[]).then(e=>e.default):c(()=>import("./index-BkM7PWkU.js"),[]).then(e=>e.wallet);case"app.ammer":return t?c(()=>import("./image-BfGkQCHU.js"),[]).then(e=>e.default):c(()=>import("./index-C0HCn7GN.js"),[]).then(e=>e.wallet);case"us.binance":return t?c(()=>import("./image-DgkgLcDL.js"),[]).then(e=>e.default):c(()=>import("./index-BuhGQjsZ.js"),[]).then(e=>e.wallet);case"io.yusetoken":return t?c(()=>import("./image-CSAN5rKt.js"),[]).then(e=>e.default):c(()=>import("./index-DQ8_v09O.js"),[]).then(e=>e.wallet);case"co.muza":return t?c(()=>import("./image-CRsMfPT0.js"),[]).then(e=>e.default):c(()=>import("./index-5IpGHzAv.js"),[]).then(e=>e.wallet);case"io.hyperpay":return t?c(()=>import("./image-D8scG8aP.js"),[]).then(e=>e.default):c(()=>import("./index-BXZiXU-9.js"),[]).then(e=>e.wallet);case"io.cosmostation":return t?c(()=>import("./image-BYUgGshq.js"),[]).then(e=>e.default):c(()=>import("./index-RiIluuCN.js"),[]).then(e=>e.wallet);case"app.ryipay":return t?c(()=>import("./image-oKct0i27.js"),[]).then(e=>e.default):c(()=>import("./index-CdvxolxE.js"),[]).then(e=>e.wallet);case"io.wallet3":return t?c(()=>import("./image-DJLc6AlW.js"),[]).then(e=>e.default):c(()=>import("./index-C_5dy4gh.js"),[]).then(e=>e.wallet);case"org.dota168":return t?c(()=>import("./image-D3VAu6BC.js"),[]).then(e=>e.default):c(()=>import("./index-BP76iXI2.js"),[]).then(e=>e.wallet);case"com.bitpie":return t?c(()=>import("./image-BUsH-M52.js"),[]).then(e=>e.default):c(()=>import("./index-BKN05ia6.js"),[]).then(e=>e.wallet);case"com.coininn":return t?c(()=>import("./image-B_AAvjJY.js"),[]).then(e=>e.default):c(()=>import("./index-l2eJJ7mG.js"),[]).then(e=>e.wallet);case"me.easy":return t?c(()=>import("./image-BjKXKIhU.js"),[]).then(e=>e.default):c(()=>import("./index-4WvPsM5O.js"),[]).then(e=>e.wallet);case"io.shido":return t?c(()=>import("./image-BGZ2pFmO.js"),[]).then(e=>e.default):c(()=>import("./index-SaOy8OjI.js"),[]).then(e=>e.wallet);case"com.neonwallet":return t?c(()=>import("./image-D2051qUc.js"),[]).then(e=>e.default):c(()=>import("./index-CUJUgO36.js"),[]).then(e=>e.wallet);case"com.secuxtech":return t?c(()=>import("./image-DHHZDLK-.js"),[]).then(e=>e.default):c(()=>import("./index-D1G_5OyD.js"),[]).then(e=>e.wallet);case"com.unitywallet":return t?c(()=>import("./image-BqmT5urK.js"),[]).then(e=>e.default):c(()=>import("./index-BqxSKkSq.js"),[]).then(e=>e.wallet);case"io.miraiapp":return t?c(()=>import("./image-Bi1elmSL.js"),[]).then(e=>e.default):c(()=>import("./index-D0rQT1_1.js"),[]).then(e=>e.wallet);case"com.beexo":return t?c(()=>import("./image-MGwelZJS.js"),[]).then(e=>e.default):c(()=>import("./index-Bbv-4GNB.js"),[]).then(e=>e.wallet);case"social.halo":return t?c(()=>import("./image-CbnSXqJS.js"),[]).then(e=>e.default):c(()=>import("./index-KpPak-wu.js"),[]).then(e=>e.wallet);case"com.gemspocket":return t?c(()=>import("./image-DpGIEKrK.js"),[]).then(e=>e.default):c(()=>import("./index-RpXAvNRL.js"),[]).then(e=>e.wallet);case"app.status":return t?c(()=>import("./image-9509MPsE.js"),[]).then(e=>e.default):c(()=>import("./index-DLMSD3H_.js"),[]).then(e=>e.wallet);case"com.midoin":return t?c(()=>import("./image-BocNs9ze.js"),[]).then(e=>e.default):c(()=>import("./index-CrBWjlui.js"),[]).then(e=>e.wallet);case"id.competence":return t?c(()=>import("./image-CaqftHzf.js"),[]).then(e=>e.default):c(()=>import("./index-CGMXxK_x.js"),[]).then(e=>e.wallet);case"com.safemoon":return t?c(()=>import("./image-BcfiUDv-.js"),[]).then(e=>e.default):c(()=>import("./index-BgECKCj8.js"),[]).then(e=>e.wallet);case"llc.besc":return t?c(()=>import("./image-DLwHWQ4l.js"),[]).then(e=>e.default):c(()=>import("./index-CbMeskkV.js"),[]).then(e=>e.wallet);case"baby.smart":return t?c(()=>import("./image-VxDqDj0T.js"),[]).then(e=>e.default):c(()=>import("./index-BmKJ1abQ.js"),[]).then(e=>e.wallet);case"app.onto":return t?c(()=>import("./image-BCXqBewH.js"),[]).then(e=>e.default):c(()=>import("./index-BPFXH4g9.js"),[]).then(e=>e.wallet);case"com.ivirse":return t?c(()=>import("./image-8DkN4eFx.js"),[]).then(e=>e.default):c(()=>import("./index-CqWFxNbG.js"),[]).then(e=>e.wallet);case"one.mixin.messenger":return t?c(()=>import("./image-DecSbpNG.js"),[]).then(e=>e.default):c(()=>import("./index-PjYIiHEb.js"),[]).then(e=>e.wallet);case"cash.abpay":return t?c(()=>import("./image-Bb4ZLG-2.js"),[]).then(e=>e.default):c(()=>import("./index-BrvgJVgh.js"),[]).then(e=>e.wallet);case"ch.dssecurity":return t?c(()=>import("./image-ddsU9gPS.js"),[]).then(e=>e.default):c(()=>import("./index-DDdoZFD-.js"),[]).then(e=>e.wallet);case"com.concordium.wallet":return t?c(()=>import("./image-W5rUOVDT.js"),[]).then(e=>e.default):c(()=>import("./index-B5BAsv-B.js"),[]).then(e=>e.wallet);case"io.zkape":return t?c(()=>import("./image-Bm-o9RF3.js"),[]).then(e=>e.default):c(()=>import("./index-yLatYZZK.js"),[]).then(e=>e.wallet);case"com.paliwallet":return t?c(()=>import("./image-DqH_Lyo9.js"),[]).then(e=>e.default):c(()=>import("./index-C93NlSEw.js"),[]).then(e=>e.wallet);case"io.pitaka":return t?c(()=>import("./image-Bo8CHmCG.js"),[]).then(e=>e.default):c(()=>import("./index-DeQey0SH.js"),[]).then(e=>e.wallet);case"com.saitamatoken":return t?c(()=>import("./image-AlOoIjkb.js"),[]).then(e=>e.default):c(()=>import("./index-CNkg8_tm.js"),[]).then(e=>e.wallet);case"org.mugambo":return t?c(()=>import("./image-vXNBwFvw.js"),[]).then(e=>e.default):c(()=>import("./index-CqJjpCD5.js"),[]).then(e=>e.wallet);case"fi.stablez":return t?c(()=>import("./image-CruMo9Ar.js"),[]).then(e=>e.default):c(()=>import("./index-Wz7obrZB.js"),[]).then(e=>e.wallet);case"io.legacynetwork":return t?c(()=>import("./image-Dgb3Vdrr.js"),[]).then(e=>e.default):c(()=>import("./index-DLHjxUiX.js"),[]).then(e=>e.wallet);case"com.meld.app":return t?c(()=>import("./image-DrobCWF2.js"),[]).then(e=>e.default):c(()=>import("./index-BqLb859N.js"),[]).then(e=>e.wallet);case"io.bladewallet":return t?c(()=>import("./image-nqueMEws.js"),[]).then(e=>e.default):c(()=>import("./index-C0I75rp3.js"),[]).then(e=>e.wallet);case"com.authentrend":return t?c(()=>import("./image-CmzmxiTz.js"),[]).then(e=>e.default):c(()=>import("./index-0qRtNAQn.js"),[]).then(e=>e.wallet);case"com.webauth":return t?c(()=>import("./image-EyKsXf_1.js"),[]).then(e=>e.default):c(()=>import("./index-BXnDDK-y.js"),[]).then(e=>e.wallet);case"xyz.tucop":return t?c(()=>import("./image-8r04P3UP.js"),[]).then(e=>e.default):c(()=>import("./index-Bbznecif.js"),[]).then(e=>e.wallet);case"pro.fintoken":return t?c(()=>import("./image-BBez6ov1.js"),[]).then(e=>e.default):c(()=>import("./index-CP3DQPwx.js"),[]).then(e=>e.wallet);case"io.nash":return t?c(()=>import("./image--fcqsYch.js"),[]).then(e=>e.default):c(()=>import("./index-Bx9srovK.js"),[]).then(e=>e.wallet);case"vc.uincubator.api":return t?c(()=>import("./image-CyLv-qKv.js"),[]).then(e=>e.default):c(()=>import("./index-B5AZ3O3C.js"),[]).then(e=>e.wallet);case"io.unagi.unawallet":return t?c(()=>import("./image-C6ewnpHo.js"),[]).then(e=>e.default):c(()=>import("./index-CD7cY8HX.js"),[]).then(e=>e.wallet);case"io.nonbank":return t?c(()=>import("./image-TA_PkYBz.js"),[]).then(e=>e.default):c(()=>import("./index-DSWhMtMn.js"),[]).then(e=>e.wallet);case"io.armana.portal":return t?c(()=>import("./image-CI3i53ES.js"),[]).then(e=>e.default):c(()=>import("./index-DuTQzi4Z.js"),[]).then(e=>e.wallet);case"com.x9wallet":return t?c(()=>import("./image-BnT6IaIq.js"),[]).then(e=>e.default):c(()=>import("./index-K7y9yqJI.js"),[]).then(e=>e.wallet);case"io.kigo":return t?c(()=>import("./image-D9i7y0RW.js"),[]).then(e=>e.default):c(()=>import("./index-BIFgx20V.js"),[]).then(e=>e.wallet);case"com.alphawallet":return t?c(()=>import("./image-xJO47ptb.js"),[]).then(e=>e.default):c(()=>import("./index-B78E3fcT.js"),[]).then(e=>e.wallet);case"com.getcogni":return t?c(()=>import("./image-CwsKp0mM.js"),[]).then(e=>e.default):c(()=>import("./index-BNlDhEDg.js"),[]).then(e=>e.wallet);case"app.sinum":return t?c(()=>import("./image-DTy0DgOV.js"),[]).then(e=>e.default):c(()=>import("./index-D5GVUjIM.js"),[]).then(e=>e.wallet);case"finance.soulswap.app":return t?c(()=>import("./image-BI8lK7Gl.js"),[]).then(e=>e.default):c(()=>import("./index-CB_NguTF.js"),[]).then(e=>e.wallet);case"io.loopring.wallet":return t?c(()=>import("./image-BdLvgjKp.js"),[]).then(e=>e.default):c(()=>import("./index-DpoJvg5R.js"),[]).then(e=>e.wallet);case"com.shapeshift":return t?c(()=>import("./image-T2oAotCg.js"),[]).then(e=>e.default):c(()=>import("./index-CdMxme0L.js"),[]).then(e=>e.wallet);case"io.trinity-tech":return t?c(()=>import("./image-bHVCC2t9.js"),[]).then(e=>e.default):c(()=>import("./index-JNZoio_2.js"),[]).then(e=>e.wallet);case"money.keychain":return t?c(()=>import("./image-CHotlokX.js"),[]).then(e=>e.default):c(()=>import("./index-C2CZkwuV.js"),[]).then(e=>e.wallet);case"com.superhero.cordova":return t?c(()=>import("./image-CsmwtAjX.js"),[]).then(e=>e.default):c(()=>import("./index-C5X26G0P.js"),[]).then(e=>e.wallet);case"com.bettatrade":return t?c(()=>import("./image-B4MULACL.js"),[]).then(e=>e.default):c(()=>import("./index-qNIXx6_B.js"),[]).then(e=>e.wallet);case"online.puzzle":return t?c(()=>import("./image-C4hEqt6v.js"),[]).then(e=>e.default):c(()=>import("./index-D2-ySoTs.js"),[]).then(e=>e.wallet);case"gg.indi":return t?c(()=>import("./image-DdicXBNF.js"),[]).then(e=>e.default):c(()=>import("./index-BTkNDmCP.js"),[]).then(e=>e.wallet);case"io.tradestrike":return t?c(()=>import("./image-Bsv1aEQB.js"),[]).then(e=>e.default):c(()=>import("./index-CLtv9-lU.js"),[]).then(e=>e.wallet);case"xyz.echooo":return t?c(()=>import("./image-C7H4CQ65.js"),[]).then(e=>e.default):c(()=>import("./index-B-UTLjBc.js"),[]).then(e=>e.wallet);case"com.kryptogo":return t?c(()=>import("./image-D3ALeCj7.js"),[]).then(e=>e.default):c(()=>import("./index-BtBx3hi1.js"),[]).then(e=>e.wallet);case"io.trustasset":return t?c(()=>import("./image-BfmBx3-B.js"),[]).then(e=>e.default):c(()=>import("./index-MECmwSvw.js"),[]).then(e=>e.wallet);case"app.utorg":return t?c(()=>import("./image-CyF2UJbG.js"),[]).then(e=>e.default):c(()=>import("./index-DK-e_E51.js"),[]).then(e=>e.wallet);case"app.dfinnwallet":return t?c(()=>import("./image-DGLcwgsS.js"),[]).then(e=>e.default):c(()=>import("./index-DR-ujXcj.js"),[]).then(e=>e.wallet);case"org.rezor":return t?c(()=>import("./image-D_0i3ZH4.js"),[]).then(e=>e.default):c(()=>import("./index-DlKNOIdN.js"),[]).then(e=>e.wallet);case"io.legionnetwork":return t?c(()=>import("./image-BszqTwo7.js"),[]).then(e=>e.default):c(()=>import("./index-DMyHg26L.js"),[]).then(e=>e.wallet);case"cc.maxwallet":return t?c(()=>import("./image-CxvWjDXv.js"),[]).then(e=>e.default):c(()=>import("./index-Dy45c3qF.js"),[]).then(e=>e.wallet);case"com.ripio":return t?c(()=>import("./image-DZpGtN5l.js"),[]).then(e=>e.default):c(()=>import("./index-BoC-cn90.js"),[]).then(e=>e.wallet);case"com.fxwallet":return t?c(()=>import("./image-Bkj-ZRbS.js"),[]).then(e=>e.default):c(()=>import("./index-D8dYcFAn.js"),[]).then(e=>e.wallet);case"inc.tomo":return t?c(()=>import("./image-rw28GAIu.js"),[]).then(e=>e.default):c(()=>import("./index-Bh8eOJMM.js"),[]).then(e=>e.wallet);case"me.komet.app":return t?c(()=>import("./image-29vwsAfI.js"),[]).then(e=>e.default):c(()=>import("./index-CapnWgEl.js"),[]).then(e=>e.wallet);case"io.guardiianwallet":return t?c(()=>import("./image-DIDeRhKH.js"),[]).then(e=>e.default):c(()=>import("./index-CWTqaiN6.js"),[]).then(e=>e.wallet);case"io.hacken.hai":return t?c(()=>import("./image-Fq457JJn.js"),[]).then(e=>e.default):c(()=>import("./index-BH1-nK1j.js"),[]).then(e=>e.wallet);case"com.zypto":return t?c(()=>import("./image-D9OC6Qfy.js"),[]).then(e=>e.default):c(()=>import("./index-5U2ZJeh5.js"),[]).then(e=>e.wallet);case"io.nabox":return t?c(()=>import("./image-CJb0NNxX.js"),[]).then(e=>e.default):c(()=>import("./index-Cl87iGjg.js"),[]).then(e=>e.wallet);case"com.tastycrypto":return t?c(()=>import("./image-IpgDqPq2.js"),[]).then(e=>e.default):c(()=>import("./index-CXgqt45P.js"),[]).then(e=>e.wallet);case"com.ballet":return t?c(()=>import("./image-DNyYhMNV.js"),[]).then(e=>e.default):c(()=>import("./index-DhFHq_nZ.js"),[]).then(e=>e.wallet);case"io.talken":return t?c(()=>import("./image-DjXN5hvv.js"),[]).then(e=>e.default):c(()=>import("./index-CuJtvtqs.js"),[]).then(e=>e.wallet);case"io.wallacy":return t?c(()=>import("./image-CdGvq_lV.js"),[]).then(e=>e.default):c(()=>import("./index-DcUozftP.js"),[]).then(e=>e.wallet);case"network.mrhb":return t?c(()=>import("./image-CaBQfcNB.js"),[]).then(e=>e.default):c(()=>import("./index-BpspMk9l.js"),[]).then(e=>e.wallet);case"io.pockie":return t?c(()=>import("./image-D13kcv8b.js"),[]).then(e=>e.default):c(()=>import("./index-Bd7BhrCK.js"),[]).then(e=>e.wallet);case"me.astrox":return t?c(()=>import("./image-BGSprUxs.js"),[]).then(e=>e.default):c(()=>import("./index-BM9GzZ_o.js"),[]).then(e=>e.wallet);case"com.thirdweb":return t?c(()=>import("./image--O11VYbP.js"),[]).then(e=>e.default):c(()=>import("./index-VZmM-6RJ.js"),[]).then(e=>e.wallet);case"com.poolsmobility.wallet":return t?c(()=>import("./image-CUFBkGzy.js"),[]).then(e=>e.default):c(()=>import("./index-DMyDV-OH.js"),[]).then(e=>e.wallet);case"xyz.roam.wallet":return t?c(()=>import("./image-BBk5bBxJ.js"),[]).then(e=>e.default):c(()=>import("./index-DACt8hFb.js"),[]).then(e=>e.wallet);case"app.gamic":return t?c(()=>import("./image-CbmAI5Wi.js"),[]).then(e=>e.default):c(()=>import("./index-D09WfuKj.js"),[]).then(e=>e.wallet);case"app.m1nty":return t?c(()=>import("./image-8Zz6I0OH.js"),[]).then(e=>e.default):c(()=>import("./index-CU6cpe0O.js"),[]).then(e=>e.wallet);case"network.trustkeys":return t?c(()=>import("./image-BJAlBW3-.js"),[]).then(e=>e.default):c(()=>import("./index-BSA2BPZ9.js"),[]).then(e=>e.wallet);case"com.caesiumlab":return t?c(()=>import("./image-DLtkWmCC.js"),[]).then(e=>e.default):c(()=>import("./index-CZNdz8B6.js"),[]).then(e=>e.wallet);case"app.catecoin":return t?c(()=>import("./image-BIIaxSfC.js"),[]).then(e=>e.default):c(()=>import("./index-DNynPGua.js"),[]).then(e=>e.wallet);case"com.hootark":return t?c(()=>import("./image-BQTKy54v.js"),[]).then(e=>e.default):c(()=>import("./index-DhlaSoR4.js"),[]).then(e=>e.wallet);case"com.crossmint":return t?c(()=>import("./image-DrH3Wn2w.js"),[]).then(e=>e.default):c(()=>import("./index-Czf-i91G.js"),[]).then(e=>e.wallet);case"com.coincircle":return t?c(()=>import("./image-DOcz3CQ4.js"),[]).then(e=>e.default):c(()=>import("./index-Crs9jVrm.js"),[]).then(e=>e.wallet);case"io.bharatbox":return t?c(()=>import("./image-D1eN-vq9.js"),[]).then(e=>e.default):c(()=>import("./index-CdYRC4Ux.js"),[]).then(e=>e.wallet);case"nl.greenhood.wallet":return t?c(()=>import("./image-Cyy1KupU.js"),[]).then(e=>e.default):c(()=>import("./index-BPgl8Hhp.js"),[]).then(e=>e.wallet);case"co.swopme":return t?c(()=>import("./image-B6SAWLjq.js"),[]).then(e=>e.default):c(()=>import("./index-DMAP8qTI.js"),[]).then(e=>e.wallet);case"com.kresus":return t?c(()=>import("./image-DesBMjvP.js"),[]).then(e=>e.default):c(()=>import("./index-oEcArN4B.js"),[]).then(e=>e.wallet);case"com.dolletwallet":return t?c(()=>import("./image-fjbgiffe.js"),[]).then(e=>e.default):c(()=>import("./index-CCIAeA2T.js"),[]).then(e=>e.wallet);case"net.shinobi-wallet":return t?c(()=>import("./image-WbOd8jAJ.js"),[]).then(e=>e.default):c(()=>import("./index-CZmLnawh.js"),[]).then(e=>e.wallet);case"com.azcoiner":return t?c(()=>import("./image-BQcTbEVl.js"),[]).then(e=>e.default):c(()=>import("./index-t6B_NULY.js"),[]).then(e=>e.wallet);case"com.passwallet.app":return t?c(()=>import("./image-DJYKaoNi.js"),[]).then(e=>e.default):c(()=>import("./index-Ct6AYfZ-.js"),[]).then(e=>e.wallet);case"app.qubic.wallet":return t?c(()=>import("./image-BBZFtk5k.js"),[]).then(e=>e.default):c(()=>import("./index-DoKwRUhz.js"),[]).then(e=>e.wallet);case"com.coinex.wallet":return t?c(()=>import("./image-CfglWSsQ.js"),[]).then(e=>e.default):c(()=>import("./index-DMEV07wA.js"),[]).then(e=>e.wallet);case"app.xverse":return t?c(()=>import("./image-DETlLb_v.js"),[]).then(e=>e.default):c(()=>import("./index-DAlw00ee.js"),[]).then(e=>e.wallet);case"com.flash-wallet":return t?c(()=>import("./image-BzGwleUn.js"),[]).then(e=>e.default):c(()=>import("./index-7BdGIDy3.js"),[]).then(e=>e.wallet);case"com.vgxfoundation":return t?c(()=>import("./image-C6NJnfCW.js"),[]).then(e=>e.default):c(()=>import("./index-CsAX4sL-.js"),[]).then(e=>e.wallet);case"org.arianee":return t?c(()=>import("./image-B6VmDbM6.js"),[]).then(e=>e.default):c(()=>import("./index-Cx8lAzRu.js"),[]).then(e=>e.wallet);case"io.myabcwallet":return t?c(()=>import("./image-jv6wUF7a.js"),[]).then(e=>e.default):c(()=>import("./index-3an-fsOm.js"),[]).then(e=>e.wallet);case"io.owallet":return t?c(()=>import("./image-DGhNZ1rS.js"),[]).then(e=>e.default):c(()=>import("./index-D2_d10WC.js"),[]).then(e=>e.wallet);case"io.zelus":return t?c(()=>import("./image-1epPqHV4.js"),[]).then(e=>e.default):c(()=>import("./index-hUldZ-v8.js"),[]).then(e=>e.wallet);case"net.myrenegade":return t?c(()=>import("./image-SJHuomz2.js"),[]).then(e=>e.default):c(()=>import("./index-C5gBqe1B.js"),[]).then(e=>e.wallet);case"io.clingon":return t?c(()=>import("./image-2s8lIjLJ.js"),[]).then(e=>e.default):c(()=>import("./index-Dk8LF9Yk.js"),[]).then(e=>e.wallet);case"com.icewal":return t?c(()=>import("./image-rdvu9IOp.js"),[]).then(e=>e.default):c(()=>import("./index-Cd5Dye5X.js"),[]).then(e=>e.wallet);case"io.streakk":return t?c(()=>import("./image-CcPbeTXv.js"),[]).then(e=>e.default):c(()=>import("./index-CrGDBMbK.js"),[]).then(e=>e.wallet);case"com.dokwallet":return t?c(()=>import("./image-BRPzDWpX.js"),[]).then(e=>e.default):c(()=>import("./index-xEbiF_Me.js"),[]).then(e=>e.wallet);case"finance.porta":return t?c(()=>import("./image-BNvlqRxs.js"),[]).then(e=>e.default):c(()=>import("./index-DSL1LhIu.js"),[]).then(e=>e.wallet);case"io.prettygood.x":return t?c(()=>import("./image-BhmKXBqm.js"),[]).then(e=>e.default):c(()=>import("./index-DfafaK4Q.js"),[]).then(e=>e.wallet);case"io.earthwallet":return t?c(()=>import("./image-BOJcifnx.js"),[]).then(e=>e.default):c(()=>import("./index-BmwlJTQ-.js"),[]).then(e=>e.wallet);case"net.spatium.wallet":return t?c(()=>import("./image-CmrOpLf4.js"),[]).then(e=>e.default):c(()=>import("./index-Fd858RJQ.js"),[]).then(e=>e.wallet);case"live.superex":return t?c(()=>import("./image-ByHnaba8.js"),[]).then(e=>e.default):c(()=>import("./index-DqVvpGRi.js"),[]).then(e=>e.wallet);case"com.adftechnology":return t?c(()=>import("./image-C6LRjQzh.js"),[]).then(e=>e.default):c(()=>import("./index-C-b1qpM9.js"),[]).then(e=>e.wallet);case"com.bscecowallet":return t?c(()=>import("./image-8u03hBEl.js"),[]).then(e=>e.default):c(()=>import("./index-Dn2svNQz.js"),[]).then(e=>e.wallet);case"io.wallypto":return t?c(()=>import("./image-CRU88082.js"),[]).then(e=>e.default):c(()=>import("./index-j06jujv2.js"),[]).then(e=>e.wallet);case"com.reown":return t?c(()=>import("./image-D3tLM-DF.js"),[]).then(e=>e.default):c(()=>import("./index-DibwKtF2.js"),[]).then(e=>e.wallet);case"finance.voltage":return t?c(()=>import("./image-ZVoqlWXW.js"),[]).then(e=>e.default):c(()=>import("./index-XRQW1mUN.js"),[]).then(e=>e.wallet);case"com.walletconnect":return t?c(()=>import("./image-BAS5CqSz.js"),[]).then(e=>e.default):c(()=>import("./index-B-BftUxa.js"),[]).then(e=>e.wallet);case"io.passpay":return t?c(()=>import("./image-Ci0UFTFy.js"),[]).then(e=>e.default):c(()=>import("./index-CP_9UNXA.js"),[]).then(e=>e.wallet);case"technology.obvious":return t?c(()=>import("./image-ZLtraAGN.js"),[]).then(e=>e.default):c(()=>import("./index-BzNpkHfI.js"),[]).then(e=>e.wallet);case"io.plutope":return t?c(()=>import("./image-Bz03or90.js"),[]).then(e=>e.default):c(()=>import("./index-CszQa87W.js"),[]).then(e=>e.wallet);case"io.buzz-up":return t?c(()=>import("./image-BsQYdoXP.js"),[]).then(e=>e.default):c(()=>import("./index-BoJGVmma.js"),[]).then(e=>e.wallet);case"co.xellar":return t?c(()=>import("./image-D2QL-j27.js"),[]).then(e=>e.default):c(()=>import("./index-cdlur5jM.js"),[]).then(e=>e.wallet);case"com.kaxaa":return t?c(()=>import("./image-DPzEe6a_.js"),[]).then(e=>e.default):c(()=>import("./index-DFSGuScS.js"),[]).then(e=>e.wallet);case"org.shefi":return t?c(()=>import("./image-DwUGDFj5.js"),[]).then(e=>e.default):c(()=>import("./index-Dtavj5eK.js"),[]).then(e=>e.wallet);case"xyz.orion":return t?c(()=>import("./image-CCDmsN6r.js"),[]).then(e=>e.default):c(()=>import("./index-Ba2OoCBH.js"),[]).then(e=>e.wallet);case"world.dosi.vault":return t?c(()=>import("./image-Cy0vmJls.js"),[]).then(e=>e.default):c(()=>import("./index-eujSyrnd.js"),[]).then(e=>e.wallet);case"network.gridlock":return t?c(()=>import("./image-CxyHP7w7.js"),[]).then(e=>e.default):c(()=>import("./index-Ce98wt2N.js"),[]).then(e=>e.wallet);case"finance.plena":return t?c(()=>import("./image-Cwg1QVuh.js"),[]).then(e=>e.default):c(()=>import("./index-BG1ZQeCA.js"),[]).then(e=>e.wallet);case"cc.dropp":return t?c(()=>import("./image-CAIffJi4.js"),[]).then(e=>e.default):c(()=>import("./index-HFnaQWCU.js"),[]).then(e=>e.wallet);case"io.scramberry":return t?c(()=>import("./image-D8ARN-Gu.js"),[]).then(e=>e.default):c(()=>import("./index-BIcsFldg.js"),[]).then(e=>e.wallet);case"xyz.bonuz":return t?c(()=>import("./image-HcidEyjv.js"),[]).then(e=>e.default):c(()=>import("./index-BZhX-e71.js"),[]).then(e=>e.wallet);case"com.bmawallet":return t?c(()=>import("./image-kZBIIBVa.js"),[]).then(e=>e.default):c(()=>import("./index-BM8c6qO-.js"),[]).then(e=>e.wallet);case"co.lifedefi":return t?c(()=>import("./image-DRpXk5be.js"),[]).then(e=>e.default):c(()=>import("./index-otRo5H2H.js"),[]).then(e=>e.wallet);case"com.get-verso":return t?c(()=>import("./image-CgzMLfDa.js"),[]).then(e=>e.default):c(()=>import("./index-DAEFTu29.js"),[]).then(e=>e.wallet);case"io.blocto":return t?c(()=>import("./image-FnAIuX7S.js"),[]).then(e=>e.default):c(()=>import("./index-ZITrt5Fi.js"),[]).then(e=>e.wallet);case"com.pandoshi":return t?c(()=>import("./image-PWpnYSKI.js"),[]).then(e=>e.default):c(()=>import("./index-BmXd0pys.js"),[]).then(e=>e.wallet);case"io.getclave":return t?c(()=>import("./image-rvsWf8U_.js"),[]).then(e=>e.default):c(()=>import("./index--rITGawC.js"),[]).then(e=>e.wallet);case"technology.jambo":return t?c(()=>import("./image-Bx8ULApC.js"),[]).then(e=>e.default):c(()=>import("./index-C2KnoZm4.js"),[]).then(e=>e.wallet);case"app.edge":return t?c(()=>import("./image-1-dOu4Yt.js"),[]).then(e=>e.default):c(()=>import("./index-stFagoJS.js"),[]).then(e=>e.wallet);case"io.banksocial":return t?c(()=>import("./image-OrIz0o8m.js"),[]).then(e=>e.default):c(()=>import("./index-Ia3LffGn.js"),[]).then(e=>e.wallet);case"io.konio":return t?c(()=>import("./image-C2Wl7RAy.js"),[]).then(e=>e.default):c(()=>import("./index-B-kI7R4f.js"),[]).then(e=>e.wallet);case"com.qubetics":return t?c(()=>import("./image-DLvMDcgw.js"),[]).then(e=>e.default):c(()=>import("./index-C_j5E1ow.js"),[]).then(e=>e.wallet);case"app.imem":return t?c(()=>import("./image-Atwyf6cQ.js"),[]).then(e=>e.default):c(()=>import("./index-KXLAu1y1.js"),[]).then(e=>e.wallet);case"com.purechain":return t?c(()=>import("./image-DgU8tR58.js"),[]).then(e=>e.default):c(()=>import("./index-G-h-xM0C.js"),[]).then(e=>e.wallet);case"io.ethos":return t?c(()=>import("./image-DmNOl1OW.js"),[]).then(e=>e.default):c(()=>import("./index-DmLPMpkA.js"),[]).then(e=>e.wallet);case"io.didwallet":return t?c(()=>import("./image-CzKmxeZp.js"),[]).then(e=>e.default):c(()=>import("./index-QGSP4PI8.js"),[]).then(e=>e.wallet);case"com.dextrade":return t?c(()=>import("./image-B_ozWfd0.js"),[]).then(e=>e.default):c(()=>import("./index-CdOxXIip.js"),[]).then(e=>e.wallet);case"org.kelp":return t?c(()=>import("./image-CcKS-8-S.js"),[]).then(e=>e.default):c(()=>import("./index-DUBZIaC-.js"),[]).then(e=>e.wallet);case"xyz.nestwallet":return t?c(()=>import("./image-Bq1UxveY.js"),[]).then(e=>e.default):c(()=>import("./index-uKvrIGe-.js"),[]).then(e=>e.wallet);case"com.cryptnox":return t?c(()=>import("./image-UFnS_pK0.js"),[]).then(e=>e.default):c(()=>import("./index-ComRbnem.js"),[]).then(e=>e.wallet);case"land.liker":return t?c(()=>import("./image-C_JPqQZj.js"),[]).then(e=>e.default):c(()=>import("./index-CId5PD0X.js"),[]).then(e=>e.wallet);case"io.hippowallet":return t?c(()=>import("./image-BdJA4XzW.js"),[]).then(e=>e.default):c(()=>import("./index-BTzbgIH6.js"),[]).then(e=>e.wallet);case"io.certhis":return t?c(()=>import("./image-bSOL4gQb.js"),[]).then(e=>e.default):c(()=>import("./index-BxtNhRvf.js"),[]).then(e=>e.wallet);case"io.safecryptowallet":return t?c(()=>import("./image-DFF2Z6Pk.js"),[]).then(e=>e.default):c(()=>import("./index-CWdL5XwO.js"),[]).then(e=>e.wallet);case"com.saify":return t?c(()=>import("./image-DOwBqPVS.js"),[]).then(e=>e.default):c(()=>import("./index-De1eZyIJ.js"),[]).then(e=>e.wallet);case"com.tiduswallet":return t?c(()=>import("./image-DzJAqGfB.js"),[]).then(e=>e.default):c(()=>import("./index-BMPGw_D6.js"),[]).then(e=>e.wallet);case"io.uptn.dapp-web":return t?c(()=>import("./image-C4ELurjg.js"),[]).then(e=>e.default):c(()=>import("./index-jsmqr-24.js"),[]).then(e=>e.wallet);case"com.it.onewallet":return t?c(()=>import("./image-CWCOKSln.js"),[]).then(e=>e.default):c(()=>import("./index-DHNwai-Z.js"),[]).then(e=>e.wallet);case"com.rktechworks":return t?c(()=>import("./image-BhECDi_9.js"),[]).then(e=>e.default):c(()=>import("./index-D6xvjdG0.js"),[]).then(e=>e.wallet);case"com.revelator.wallet":return t?c(()=>import("./image-nW5JvdXC.js"),[]).then(e=>e.default):c(()=>import("./index-CNl69Nv0.js"),[]).then(e=>e.wallet);case"com.sinohope":return t?c(()=>import("./image-D7P0qSfx.js"),[]).then(e=>e.default):c(()=>import("./index-DKzyJcIY.js"),[]).then(e=>e.wallet);case"network.dgg":return t?c(()=>import("./image-DrraBYJZ.js"),[]).then(e=>e.default):c(()=>import("./index-DnUUaSfF.js"),[]).then(e=>e.wallet);case"io.up":return t?c(()=>import("./image-DbpOM2LD.js"),[]).then(e=>e.default):c(()=>import("./index-BuWGQyCe.js"),[]).then(e=>e.wallet);case"com.lif3":return t?c(()=>import("./image-DC2DOoz2.js"),[]).then(e=>e.default):c(()=>import("./index-BKkJhanY.js"),[]).then(e=>e.wallet);case"io.bimwallet":return t?c(()=>import("./image-BKSQyIc5.js"),[]).then(e=>e.default):c(()=>import("./index-3DerMn1X.js"),[]).then(e=>e.wallet);case"pub.dg":return t?c(()=>import("./image-C4KoLZ1v.js"),[]).then(e=>e.default):c(()=>import("./index-D6d2Y6jv.js"),[]).then(e=>e.wallet);case"com.wemix":return t?c(()=>import("./image-CawBnBIo.js"),[]).then(e=>e.default):c(()=>import("./index-18L0wZ74.js"),[]).then(e=>e.wallet);case"com.pierwallet":return t?c(()=>import("./image-DA8Sg5HZ.js"),[]).then(e=>e.default):c(()=>import("./index-mJTgSazQ.js"),[]).then(e=>e.wallet);case"net.stasis":return t?c(()=>import("./image-CyE6Mi3e.js"),[]).then(e=>e.default):c(()=>import("./index-CJ8I9s4o.js"),[]).then(e=>e.wallet);case"com.peakdefi":return t?c(()=>import("./image-DUcJQ0b3.js"),[]).then(e=>e.default):c(()=>import("./index-DEMIRENu.js"),[]).then(e=>e.wallet);case"com.3swallet":return t?c(()=>import("./image-CD3he1Tj.js"),[]).then(e=>e.default):c(()=>import("./index-DVGcX2HE.js"),[]).then(e=>e.wallet);case"com.example.subdomain":return t?c(()=>import("./image-Cs2bevZt.js"),[]).then(e=>e.default):c(()=>import("./index-CJt068xh.js"),[]).then(e=>e.wallet);case"com.reown.appkit-lab":return t?c(()=>import("./image-CnDG0aor.js"),[]).then(e=>e.default):c(()=>import("./index-BzfyCotn.js"),[]).then(e=>e.wallet);case"com.opz":return t?c(()=>import("./image-D1qvgd7h.js"),[]).then(e=>e.default):c(()=>import("./index-CMGByxdA.js"),[]).then(e=>e.wallet);case"ai.spotonchain.platform":return t?c(()=>import("./image-C6QSWUy4.js"),[]).then(e=>e.default):c(()=>import("./index-Ba7PpD6d.js"),[]).then(e=>e.wallet);case"org.dailychain.wallet":return t?c(()=>import("./image-BJ_lqI1X.js"),[]).then(e=>e.default):c(()=>import("./index-DQa9pNJd.js"),[]).then(e=>e.wallet);case"app.omni":return t?c(()=>import("./image-CqLwuE__.js"),[]).then(e=>e.default):c(()=>import("./index-D_7wDcMK.js"),[]).then(e=>e.wallet);case"id.plumaa":return t?c(()=>import("./image-BvJKCSpY.js"),[]).then(e=>e.default):c(()=>import("./index-D45a0k-1.js"),[]).then(e=>e.wallet);case"io.ttmwallet":return t?c(()=>import("./image-Chg2WzE1.js"),[]).then(e=>e.default):c(()=>import("./index-CLikIjn_.js"),[]).then(e=>e.wallet);case"io.kgen":return t?c(()=>import("./image-DFYGQEwh.js"),[]).then(e=>e.default):c(()=>import("./index-BQWXi0by.js"),[]).then(e=>e.wallet);case"com.nufinetes":return t?c(()=>import("./image-CpFHTO_m.js"),[]).then(e=>e.default):c(()=>import("./index-B8De2hoC.js"),[]).then(e=>e.wallet);case"com.squirrelwallet":return t?c(()=>import("./image-bHJO6btW.js"),[]).then(e=>e.default):c(()=>import("./index-DyaPXLoO.js"),[]).then(e=>e.wallet);case"eu.trusteeglobal":return t?c(()=>import("./image-cDoShVvl.js"),[]).then(e=>e.default):c(()=>import("./index-B51294pb.js"),[]).then(e=>e.wallet);case"com.daffione":return t?c(()=>import("./image-Dtc98pdf.js"),[]).then(e=>e.default):c(()=>import("./index-BIXqJF5y.js"),[]).then(e=>e.wallet);case"com.saakuru.app":return t?c(()=>import("./image-TQLBEOIW.js"),[]).then(e=>e.default):c(()=>import("./index-CjVYDT09.js"),[]).then(e=>e.wallet);case"io.r0ar":return t?c(()=>import("./image-4bx5chOJ.js"),[]).then(e=>e.default):c(()=>import("./index-CfCXSq_b.js"),[]).then(e=>e.wallet);case"com.nodle":return t?c(()=>import("./image-tiHbZ1Vk.js"),[]).then(e=>e.default):c(()=>import("./index-BwL47YsA.js"),[]).then(e=>e.wallet);case"app.tofee":return t?c(()=>import("./image-DpHbdMp9.js"),[]).then(e=>e.default):c(()=>import("./index-Bk-uZV0j.js"),[]).then(e=>e.wallet);case"io.pltwallet":return t?c(()=>import("./image-BIDqxk8w.js"),[]).then(e=>e.default):c(()=>import("./index-eiEAIzdd.js"),[]).then(e=>e.wallet);case"org.talkapp":return t?c(()=>import("./image-BkKo9DtA.js"),[]).then(e=>e.default):c(()=>import("./index-BGGk2Hck.js"),[]).then(e=>e.wallet);case"io.ready":return t?c(()=>import("./image-BwjeUYie.js"),[]).then(e=>e.default):c(()=>import("./index-BQwDdmmS.js"),[]).then(e=>e.wallet);case"app.w3wallet":return t?c(()=>import("./image-Covp72ND.js"),[]).then(e=>e.default):c(()=>import("./index-Cb41eDDJ.js"),[]).then(e=>e.wallet);case"pro.ds.app":return t?c(()=>import("./image-Bktw-NJ-.js"),[]).then(e=>e.default):c(()=>import("./index-b5ABnFKj.js"),[]).then(e=>e.wallet);case"com.reown.docs":return t?c(()=>import("./image-V4qYiUxw.js"),[]).then(e=>e.default):c(()=>import("./index-DsgD7D-8.js"),[]).then(e=>e.wallet);case"com.apollox":return t?c(()=>import("./image-ss2LFlQu.js"),[]).then(e=>e.default):c(()=>import("./index-BLMjeGJ-.js"),[]).then(e=>e.wallet);case"com.ipmb":return t?c(()=>import("./image-CirJIT7l.js"),[]).then(e=>e.default):c(()=>import("./index-DP0utIbV.js"),[]).then(e=>e.wallet);case"com.payperless":return t?c(()=>import("./image-q4XfUN6v.js"),[]).then(e=>e.default):c(()=>import("./index-szNElS1a.js"),[]).then(e=>e.wallet);case"com.obliowallet":return t?c(()=>import("./image-BGxqJH7c.js"),[]).then(e=>e.default):c(()=>import("./index-JuvDLDuk.js"),[]).then(e=>e.wallet);case"app.keeper-wallet":return t?c(()=>import("./image-Dpgf4dcg.js"),[]).then(e=>e.default):c(()=>import("./index-DlfGjmz4.js"),[]).then(e=>e.wallet);case"io.paraswap":return t?c(()=>import("./image-CQKjvlto.js"),[]).then(e=>e.default):c(()=>import("./index-DjLE3t9q.js"),[]).then(e=>e.wallet);case"org.ecoinwallet":return t?c(()=>import("./image-C3Va51zP.js"),[]).then(e=>e.default):c(()=>import("./index-DFZNHq44.js"),[]).then(e=>e.wallet);case"fi.dropmate":return t?c(()=>import("./image-5xiz28Wo.js"),[]).then(e=>e.default):c(()=>import("./index-p0ATWoVh.js"),[]).then(e=>e.wallet);case"com.cryptokara":return t?c(()=>import("./image-Dqbrewdt.js"),[]).then(e=>e.default):c(()=>import("./index-Cfzzcvgo.js"),[]).then(e=>e.wallet);case"co.cyber.wallet":return t?c(()=>import("./image-BvkSxpXq.js"),[]).then(e=>e.default):c(()=>import("./index-e_qeQmc1.js"),[]).then(e=>e.wallet);case"com.kriptonio":return t?c(()=>import("./image-D_cIj1db.js"),[]).then(e=>e.default):c(()=>import("./index-Dxm6Y7eO.js"),[]).then(e=>e.wallet);case"digital.minerva":return t?c(()=>import("./image-D5wxf47e.js"),[]).then(e=>e.default):c(()=>import("./index-HnCuhDYJ.js"),[]).then(e=>e.wallet);case"com.mpcvault.broswerplugin":return t?c(()=>import("./image-BN4ovMrn.js"),[]).then(e=>e.default):c(()=>import("./index-BXY5tnuK.js"),[]).then(e=>e.wallet);case"com.liberawallet":return t?c(()=>import("./image-DyrMImIL.js"),[]).then(e=>e.default):c(()=>import("./index-Dqyfi4dm.js"),[]).then(e=>e.wallet);case"io.helixid":return t?c(()=>import("./image-Dkp4M1ik.js"),[]).then(e=>e.default):c(()=>import("./index-RJhc6LnM.js"),[]).then(e=>e.wallet);case"com.broearn":return t?c(()=>import("./image-JyGUnQ_N.js"),[]).then(e=>e.default):c(()=>import("./index-WsH2ZGfO.js"),[]).then(e=>e.wallet);case"io.altme":return t?c(()=>import("./image-MQbcgW7z.js"),[]).then(e=>e.default):c(()=>import("./index-CpMkh5pZ.js"),[]).then(e=>e.wallet);case"app.herewallet":return t?c(()=>import("./image-gnC_p3Da.js"),[]).then(e=>e.default):c(()=>import("./index-CecEswCv.js"),[]).then(e=>e.wallet);case"com.coinsdo":return t?c(()=>import("./image-DrHhCSDD.js"),[]).then(e=>e.default):c(()=>import("./index-DJYG2Vtc.js"),[]).then(e=>e.wallet);case"trade.flooz.wallet":return t?c(()=>import("./image-DaaIjpQJ.js"),[]).then(e=>e.default):c(()=>import("./index-C6EDKfcJ.js"),[]).then(e=>e.wallet);case"com.tapwallet":return t?c(()=>import("./image-BxeDPEwg.js"),[]).then(e=>e.default):c(()=>import("./index-BwCUvEoQ.js"),[]).then(e=>e.wallet);case"fun.tobi":return t?c(()=>import("./image-DmhgJWq-.js"),[]).then(e=>e.default):c(()=>import("./index-C1adBKyv.js"),[]).then(e=>e.wallet);case"com.bitnovo":return t?c(()=>import("./image-BTZyVpoA.js"),[]).then(e=>e.default):c(()=>import("./index-CaZIFXyW.js"),[]).then(e=>e.wallet);case"io.xucre":return t?c(()=>import("./image-DZ-B-aVa.js"),[]).then(e=>e.default):c(()=>import("./index-BBDAdmKp.js"),[]).then(e=>e.wallet);case"app.girin":return t?c(()=>import("./image-CkQb0YUH.js"),[]).then(e=>e.default):c(()=>import("./index-CpJZxSfI.js"),[]).then(e=>e.wallet);case"finance.panaroma":return t?c(()=>import("./image-Z9k3mhsb.js"),[]).then(e=>e.default):c(()=>import("./index-BIeLm-x3.js"),[]).then(e=>e.wallet);case"app.clot":return t?c(()=>import("./image-DZplWZyD.js"),[]).then(e=>e.default):c(()=>import("./index-BVQeUBdj.js"),[]).then(e=>e.wallet);case"io.transi":return t?c(()=>import("./image-Dc5zhKf6.js"),[]).then(e=>e.default):c(()=>import("./index-DDggnqr4.js"),[]).then(e=>e.wallet);case"world.qoin":return t?c(()=>import("./image-BPAkEl8k.js"),[]).then(e=>e.default):c(()=>import("./index-C9taR4Do.js"),[]).then(e=>e.wallet);case"com.greengloryglobal":return t?c(()=>import("./image-lOdcUtWG.js"),[]).then(e=>e.default):c(()=>import("./index-C-OT0KJG.js"),[]).then(e=>e.wallet);case"com.amazewallet":return t?c(()=>import("./image-2wmDBIB6.js"),[]).then(e=>e.default):c(()=>import("./index-DvXpQOkv.js"),[]).then(e=>e.wallet);case"zone.bitverse":return t?c(()=>import("./image-C6aZzydG.js"),[]).then(e=>e.default):c(()=>import("./index-CN6XdMAo.js"),[]).then(e=>e.wallet);case"social.gm2":return t?c(()=>import("./image-BqtrMo-7.js"),[]).then(e=>e.default):c(()=>import("./index-Coq7--sH.js"),[]).then(e=>e.wallet);case"io.ozonewallet":return t?c(()=>import("./image-BtnrRGhZ.js"),[]).then(e=>e.default):c(()=>import("./index-DFc7lZHb.js"),[]).then(e=>e.wallet);case"io.ukiss":return t?c(()=>import("./image-DFYwzuHA.js"),[]).then(e=>e.default):c(()=>import("./index-CE9n_StB.js"),[]).then(e=>e.wallet);case"finance.islamicoin":return t?c(()=>import("./image-CWG4tRzZ.js"),[]).then(e=>e.default):c(()=>import("./index-pcLdliEp.js"),[]).then(e=>e.wallet);case"io.copiosa":return t?c(()=>import("./image-DuQoo_kR.js"),[]).then(e=>e.default):c(()=>import("./index-CWmGdvBR.js"),[]).then(e=>e.wallet);case"world.fncy":return t?c(()=>import("./image-B5M2ftPa.js"),[]).then(e=>e.default):c(()=>import("./index-Ba45jQBJ.js"),[]).then(e=>e.wallet);case"io.moonstake":return t?c(()=>import("./image-zsArRLIF.js"),[]).then(e=>e.default):c(()=>import("./index-C7HuhgLE.js"),[]).then(e=>e.wallet);case"com.trusteeglobal":return t?c(()=>import("./image-iR_slvRo.js"),[]).then(e=>e.default):c(()=>import("./index-CNLH4wrU.js"),[]).then(e=>e.wallet);case"net.spatium":return t?c(()=>import("./image-DBFrM6tr.js"),[]).then(e=>e.default):c(()=>import("./index-BJBC3bLU.js"),[]).then(e=>e.wallet);case"co.filwallet":return t?c(()=>import("./image-Do8rO3zE.js"),[]).then(e=>e.default):c(()=>import("./index-D7FslwZl.js"),[]).then(e=>e.wallet);case"money.snowball":return t?c(()=>import("./image-3Q7PfsJG.js"),[]).then(e=>e.default):c(()=>import("./index-yOwMLl2f.js"),[]).then(e=>e.wallet);case"com.ennowallet":return t?c(()=>import("./image-Ccx8wDSE.js"),[]).then(e=>e.default):c(()=>import("./index-BRIQuVzg.js"),[]).then(e=>e.wallet);case"io.safematrix":return t?c(()=>import("./image-BX4sAPzh.js"),[]).then(e=>e.default):c(()=>import("./index-Yk_iQY25.js"),[]).then(e=>e.wallet);case"pro.assure":return t?c(()=>import("./image-DMTT8AeN.js"),[]).then(e=>e.default):c(()=>import("./index-BfYVYwh5.js"),[]).then(e=>e.wallet);case"com.neftipedia":return t?c(()=>import("./image-vrSaD0K9.js"),[]).then(e=>e.default):c(()=>import("./index-BHZDuU0I.js"),[]).then(e=>e.wallet);case"io.goldbit":return t?c(()=>import("./image-CtiFcEL8.js"),[]).then(e=>e.default):c(()=>import("./index-DFrKYv4g.js"),[]).then(e=>e.wallet);case"com.coingrig":return t?c(()=>import("./image-NsVKBwxZ.js"),[]).then(e=>e.default):c(()=>import("./index-DcyXtFTG.js"),[]).then(e=>e.wallet);case"io.xfun":return t?c(()=>import("./image-CPMDxql6.js"),[]).then(e=>e.default):c(()=>import("./index-B05algAv.js"),[]).then(e=>e.wallet);case"com.antiersolutions":return t?c(()=>import("./image-BMh4HSr7.js"),[]).then(e=>e.default):c(()=>import("./index-DufOfQ90.js"),[]).then(e=>e.wallet);case"com.itoken":return t?c(()=>import("./image-BwBO8BTi.js"),[]).then(e=>e.default):c(()=>import("./index-BftqI1FU.js"),[]).then(e=>e.wallet);case"com.cardstack":return t?c(()=>import("./image-D7Sd6W8U.js"),[]).then(e=>e.default):c(()=>import("./index-BiHhxeDt.js"),[]).then(e=>e.wallet);case"io.slavi":return t?c(()=>import("./image-BQUnnXTb.js"),[]).then(e=>e.default):c(()=>import("./index-Kt6GlPCW.js"),[]).then(e=>e.wallet);case"tech.defiantapp":return t?c(()=>import("./image-D4-YMi52.js"),[]).then(e=>e.default):c(()=>import("./index-DPic1oJg.js"),[]).then(e=>e.wallet);case"com.dexari":return t?c(()=>import("./image-BoANtDMS.js"),[]).then(e=>e.default):c(()=>import("./index-DPFoWmV6.js"),[]).then(e=>e.wallet);case"io.cfcx":return t?c(()=>import("./image-139plIjh.js"),[]).then(e=>e.default):c(()=>import("./index-Cws1zSAX.js"),[]).then(e=>e.wallet);case"com.socjsc":return t?c(()=>import("./image-Crp2YP47.js"),[]).then(e=>e.default):c(()=>import("./index-C_XOoDbk.js"),[]).then(e=>e.wallet);case"com.tokenb":return t?c(()=>import("./image-8LnJ1bNt.js"),[]).then(e=>e.default):c(()=>import("./index-DcwbqEHj.js"),[]).then(e=>e.wallet);case"org.onyx":return t?c(()=>import("./image-DKcWaLtu.js"),[]).then(e=>e.default):c(()=>import("./index-C5NL4PoV.js"),[]).then(e=>e.wallet);case"io.gk8":return t?c(()=>import("./image-ZwibGfzR.js"),[]).then(e=>e.default):c(()=>import("./index-CLxj2t1J.js"),[]).then(e=>e.wallet);case"com.anchorage":return t?c(()=>import("./image-OT0Fb2Nb.js"),[]).then(e=>e.default):c(()=>import("./index-aoLVKFG1.js"),[]).then(e=>e.wallet);case"com.hashport.wallet":return t?c(()=>import("./image-DooF_Vfs.js"),[]).then(e=>e.default):c(()=>import("./index-DICTy0sa.js"),[]).then(e=>e.wallet);case"io.billionwallet":return t?c(()=>import("./image-DDBzbPSl.js"),[]).then(e=>e.default):c(()=>import("./index-CmCRou09.js"),[]).then(e=>e.wallet);case"com.dlicom":return t?c(()=>import("./image-lXBTHYnD.js"),[]).then(e=>e.default):c(()=>import("./index-l8DhIVZW.js"),[]).then(e=>e.wallet);case"com.tychiwallet":return t?c(()=>import("./image-pcyfaNhf.js"),[]).then(e=>e.default):c(()=>import("./index-B3vR_dtk.js"),[]).then(e=>e.wallet);case"at.swe":return t?c(()=>import("./image-C8_9fy1e.js"),[]).then(e=>e.default):c(()=>import("./index-ficai7Ce.js"),[]).then(e=>e.wallet);case"network.wali":return t?c(()=>import("./image-CSyxcTwp.js"),[]).then(e=>e.default):c(()=>import("./index-Dzkop1Gk.js"),[]).then(e=>e.wallet);case"io.diamante":return t?c(()=>import("./image-Dh9w9A8z.js"),[]).then(e=>e.default):c(()=>import("./index-C1a5oPtZ.js"),[]).then(e=>e.wallet);case"ai.interlinklabs":return t?c(()=>import("./image-Dz82Zyfj.js"),[]).then(e=>e.default):c(()=>import("./index-BTqXeJHf.js"),[]).then(e=>e.wallet);case"com.walllet":return t?c(()=>import("./image-VFWT6oS6.js"),[]).then(e=>e.default):c(()=>import("./index-DPgWRg9-.js"),[]).then(e=>e.wallet);case"org.lunascape":return t?c(()=>import("./image-D4nkyGrg.js"),[]).then(e=>e.default):c(()=>import("./index-4Nmn8ium.js"),[]).then(e=>e.wallet);case"com.nvxowallet":return t?c(()=>import("./image-BoS2kgXC.js"),[]).then(e=>e.default):c(()=>import("./index-CRRdY0XA.js"),[]).then(e=>e.wallet);case"today.paywithcrypto.wallet":return t?c(()=>import("./image-CsUCYFyx.js"),[]).then(e=>e.default):c(()=>import("./index-CFUSXkKo.js"),[]).then(e=>e.wallet);case"ai.iluminary":return t?c(()=>import("./image-CEuSmI3b.js"),[]).then(e=>e.default):c(()=>import("./index-D1j-SvoJ.js"),[]).then(e=>e.wallet);case"io.reactwallet":return t?c(()=>import("./image-B3lDLhwe.js"),[]).then(e=>e.default):c(()=>import("./index-CTs1t6rA.js"),[]).then(e=>e.wallet);case"com.rewardywallet":return t?c(()=>import("./image-DVyDRAAO.js"),[]).then(e=>e.default):c(()=>import("./index-cF_6KJvb.js"),[]).then(e=>e.wallet);case"io.walletv":return t?c(()=>import("./image-CTBdimeM.js"),[]).then(e=>e.default):c(()=>import("./index-He5kaR9n.js"),[]).then(e=>e.wallet);case"app.outlawgames":return t?c(()=>import("./image-BPqXYngz.js"),[]).then(e=>e.default):c(()=>import("./index-D2hPph8l.js"),[]).then(e=>e.wallet);case"io.ironwallet":return t?c(()=>import("./image-BKNtkg6s.js"),[]).then(e=>e.default):c(()=>import("./index-B1-qcL-p.js"),[]).then(e=>e.wallet);case"com.mecowallet":return t?c(()=>import("./image-m7IlStdm.js"),[]).then(e=>e.default):c(()=>import("./index-BdgyG9Qa.js"),[]).then(e=>e.wallet);case"com.onlybulls":return t?c(()=>import("./image-qLUwfjzV.js"),[]).then(e=>e.default):c(()=>import("./index-DPPIbXj8.js"),[]).then(e=>e.wallet);case"me.qiewallet":return t?c(()=>import("./image-BHJFFIIN.js"),[]).then(e=>e.default):c(()=>import("./index-D6zAueb_.js"),[]).then(e=>e.wallet);case"fund.lflabs":return t?c(()=>import("./image-dO78_uyn.js"),[]).then(e=>e.default):c(()=>import("./index-BBkeSt5m.js"),[]).then(e=>e.wallet);case"io.walletverse":return t?c(()=>import("./image-DUk3AUBd.js"),[]).then(e=>e.default):c(()=>import("./index-CfO_m3oL.js"),[]).then(e=>e.wallet);case"com.berasig":return t?c(()=>import("./image-CisWvLpc.js"),[]).then(e=>e.default):c(()=>import("./index-Cg1E5HxJ.js"),[]).then(e=>e.wallet);case"app.phantom":return t?c(()=>import("./image-6levnvAC.js"),[]).then(e=>e.default):c(()=>import("./index-IBUgXgOa.js"),[]).then(e=>e.wallet);case"com.coinbase.wallet":return t?c(()=>import("./image-C6EsuPXB.js"),[]).then(e=>e.default):c(()=>import("./index-BILUwmJ9.js"),[]).then(e=>e.wallet);case"io.rabby":return t?c(()=>import("./image-CZ2qSHpt.js"),[]).then(e=>e.default):c(()=>import("./index-Bprjmfje.js"),[]).then(e=>e.wallet);case"com.brave.wallet":return t?c(()=>import("./image-9Jtg22X3.js"),[]).then(e=>e.default):c(()=>import("./index-DKbx-y78.js"),[]).then(e=>e.wallet);case"fi.nu":return t?c(()=>import("./image-BAl5qyeX.js"),[]).then(e=>e.default):c(()=>import("./index-BXi61TZ5.js"),[]).then(e=>e.wallet);case"pro.hinkal.walletconnect":return t?c(()=>import("./image-d8n8A6si.js"),[]).then(e=>e.default):c(()=>import("./index-CujrNB-Q.js"),[]).then(e=>e.wallet);case"com.moongate.one":return t?c(()=>import("./image-DZc2BYzk.js"),[]).then(e=>e.default):c(()=>import("./index-B2WV7sR7.js"),[]).then(e=>e.wallet);case"tech.levain":return t?c(()=>import("./image-DcIu3U38.js"),[]).then(e=>e.default):c(()=>import("./index-CEpc_g8h.js"),[]).then(e=>e.wallet);case"com.enkrypt":return t?c(()=>import("./image-DvpdMMzF.js"),[]).then(e=>e.default):c(()=>import("./index-Cc4uopde.js"),[]).then(e=>e.wallet);case"com.scramble":return t?c(()=>import("./image-DT5Fvf2s.js"),[]).then(e=>e.default):c(()=>import("./index-D4Sgj1mL.js"),[]).then(e=>e.wallet);case"io.finoa":return t?c(()=>import("./image-D_i0o0Nv.js"),[]).then(e=>e.default):c(()=>import("./index-DFghxfjK.js"),[]).then(e=>e.wallet);case"com.blazpay.wallet":return t?c(()=>import("./image-CgHABHdL.js"),[]).then(e=>e.default):c(()=>import("./index-B_OXuBhF.js"),[]).then(e=>e.wallet);case"io.getjoin.prd":return t?c(()=>import("./image-CmWdSXJI.js"),[]).then(e=>e.default):c(()=>import("./index-QvBzJwgv.js"),[]).then(e=>e.wallet);case"xyz.talisman":return t?c(()=>import("./image-VlTaWJmy.js"),[]).then(e=>e.default):c(()=>import("./index-BgbYZOnC.js"),[]).then(e=>e.wallet);case"eu.flashsoft.clear-wallet":return t?c(()=>import("./image-gxCVLutB.js"),[]).then(e=>e.default):c(()=>import("./index-BBiL2lyk.js"),[]).then(e=>e.wallet);case"app.berasig":return t?c(()=>import("./image-BjTMD2k8.js"),[]).then(e=>e.default):c(()=>import("./index-DkcP2fCc.js"),[]).then(e=>e.wallet);case"com.wallet.reown":return t?c(()=>import("./image-CC2_AL18.js"),[]).then(e=>e.default):c(()=>import("./index-BEx6ckei.js"),[]).then(e=>e.wallet);case"io.runonflux.sspwallet":return t?c(()=>import("./image-DfzpWAED.js"),[]).then(e=>e.default):c(()=>import("./index-CrUcAJK0.js"),[]).then(e=>e.wallet);case"com.blanqlabs.wallet":return t?c(()=>import("./image-wR942Jk6.js"),[]).then(e=>e.default):c(()=>import("./index-DBst6Hla.js"),[]).then(e=>e.wallet);case"io.hero.wallet":return t?c(()=>import("./image-BbH7e9pw.js"),[]).then(e=>e.default):c(()=>import("./index-BBANTdk4.js"),[]).then(e=>e.wallet);case"network.verified.custody":return t?c(()=>import("./image-DpjDzWCs.js"),[]).then(e=>e.default):c(()=>import("./index-CyhgnW_d.js"),[]).then(e=>e.wallet);case"console.utila.io":return t?c(()=>import("./image-C7tHBnQp.js"),[]).then(e=>e.default):c(()=>import("./index-BrOCsLbf.js"),[]).then(e=>e.wallet);case"com.micet.wallet":return t?c(()=>import("./image-On2ij4Ix.js"),[]).then(e=>e.default):c(()=>import("./index-JAAqCLcG.js"),[]).then(e=>e.wallet);case"world.dolphinode.chain":return t?c(()=>import("./image-BXzPnbc4.js"),[]).then(e=>e.default):c(()=>import("./index-CiwBOkla.js"),[]).then(e=>e.wallet);case"com.lootrush":return t?c(()=>import("./image-t4jvKgpV.js"),[]).then(e=>e.default):c(()=>import("./index-BLsnOBhg.js"),[]).then(e=>e.wallet);case"xyz.dawnwallet":return t?c(()=>import("./image-bpacFMFT.js"),[]).then(e=>e.default):c(()=>import("./index-BqK7Phb6.js"),[]).then(e=>e.wallet);case"xyz.abs":return t?c(()=>import("./image-DFo7XMVJ.js"),[]).then(e=>e.default):c(()=>import("./index-8Ff6vDUD.js"),[]).then(e=>e.wallet);case"sh.frame":return t?c(()=>import("./image-C1w2WpL5.js"),[]).then(e=>e.default):c(()=>import("./index-cAvSYrmF.js"),[]).then(e=>e.wallet);case"io.useglyph":return t?c(()=>import("./image-C46yxCl4.js"),[]).then(e=>e.default):c(()=>import("./index-DE_8irSD.js"),[]).then(e=>e.wallet);case"org.base.account":return t?c(()=>import("./image-Ds78yECl.js"),[]).then(e=>e.default):c(()=>import("./index-kNZGxYSe.js"),[]).then(e=>e.wallet);default:throw new Error(`Wallet with id ${n} not found`)}}function Dp(){const n=new Map;return{emit(t,e){const r=n.get(t);if(r)for(const i of r)i(e)},subscribe(t,e){var r;return n.has(t)?(r=n.get(t))==null||r.add(e):n.set(t,new Set([e])),()=>{const i=n.get(t);i&&i.delete(e)}}}}function Cn(){return Dp()}function xp(n){const{createOptions:t}=n,e=Cn();let r,i;function s(){r=void 0,i=void 0}let o=async()=>{},a=async h=>{i=h};const l=e.subscribe("chainChanged",h=>{i=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectBaseAccountSDK:d}=await c(async()=>{const{autoConnectBaseAccountSDK:g}=await Promise.resolve().then(()=>ja);return{autoConnectBaseAccountSDK:g}},void 0),f=await n.providerFactory(),[p,w,m,_]=await d(h,e,f);return r=p,i=w,o=m,a=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:qt}),r},connect:async h=>{const{connectBaseAccountSDK:d}=await c(async()=>{const{connectBaseAccountSDK:g}=await Promise.resolve().then(()=>ja);return{connectBaseAccountSDK:g}},void 0),f=await n.providerFactory(),[p,w,m,_]=await d(h,e,f);return r=p,i=w,o=m,a=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:qt}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(i)return i=Vn(i.id)||i,i},getConfig:()=>t,id:qt,subscribe:e.subscribe,switchChain:async h=>{await a(h)}}}function Oi(){if(!pu())return{description:"thirdweb powered dApp",logoUrl:"https://thirdweb.com/favicon.ico",name:"thirdweb powered dApp",url:"https://thirdweb.com"};const{protocol:n,hostname:t,port:e}=window.location;let r=`${n}//${t}`;e&&e!=="80"&&e!=="443"&&(r+=`:${e}`);const i=`${r}/favicon.ico`;return{description:window.document.title||"thirdweb powered dApp",logoUrl:i,name:window.document.title||"thirdweb powered dApp",url:r}}let os,Xr;async function gu(n){var s,o,a,l,u,h,d;if(os){if(n&&Xr){const f=((s=Xr.chains)==null?void 0:s.map(_=>_.id))||[],p=((o=n.chains)==null?void 0:o.map(_=>_.id))||[],w=f.length===p.length&&f.every((_,g)=>_===p[g]),m=((a=n.appMetadata)==null?void 0:a.name)===((l=Xr.appMetadata)==null?void 0:l.name);(!w||!m)&&console.warn("[Base Account SDK] Provider already initialized with different options. The Base Account SDK uses a singleton provider - subsequent configurations are ignored. Create only one Base Account wallet instance per application.")}return os}const{createBaseAccountSDK:t}=await c(async()=>{const{createBaseAccountSDK:f}=await import("./index-pQ6ZXw4u.js");return{createBaseAccountSDK:f}},__vite__mapDeps([9,10,3,11,12,7])),e=Oi(),i=t({appName:((u=n==null?void 0:n.appMetadata)==null?void 0:u.name)||e.name||"thirdweb powered dApp",appLogoUrl:((h=n==null?void 0:n.appMetadata)==null?void 0:h.logoUrl)||e.logoUrl||null,appChainIds:((d=n==null?void 0:n.chains)==null?void 0:d.map(f=>f.id))||[]}).getProvider();return os=i,Xr=n,i}function Eu(n){return n.id===qt}function za({provider:n,address:t,client:e}){const r={address:J(t),async sendTransaction(i){const s=await n.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:J(t),gas:i.gas?ke(i.gas):void 0,to:i.to,value:i.value?ke(i.value):void 0}]});return Bo({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:J(t),walletType:qt}),{transactionHash:s}},async signMessage({message:i}){if(!r.address)throw new Error("Provider not setup");const s=typeof i=="string"?ko(i):i.raw instanceof Uint8Array?zi(i.raw):i.raw,o=await n.request({method:"personal_sign",params:[s,r.address]});if(!Sr(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:a}=Wo(i),l={EIP712Domain:eu(s),...i.types};tu({domain:s,message:o,primaryType:a,types:l});const u=nu({domain:s??{},message:o,primaryType:a,types:l}),h=await n.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!Sr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Yo(i,r),a=await n.request({method:"wallet_sendCalls",params:s});return a&&typeof a=="object"&&"id"in a?{chain:o,client:e,id:a.id}:{chain:o,client:e,id:a}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${qt} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:Ee(s)}`):s}},async getCallsStatus(i){try{const s=await n.request({method:"wallet_getCallsStatus",params:[i.id]});return Go(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${qt} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await n.request({method:"wallet_getCapabilities",params:[J(r.address)]});return Zo(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${qt} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function vu(n,t,e,r,i){const s=za({address:n,client:i,provider:e});async function o(){e.off("accountsChanged",l),e.off("chainChanged",u),e.off("disconnect",a),await e.disconnect()}async function a(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=za({address:J(h[0]),client:i,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else a()}function u(h){const d=be(gt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",a),[s,t,a,h=>bu(e,h)]}async function Vp(n,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const i=J(r[0]),s=await e.request({method:"eth_chainId"}),o=gt(s);let a=n.chain&&n.chain.id===o?n.chain:be(o);return o&&(n!=null&&n.chain)&&o!==(n==null?void 0:n.chain.id)&&(await bu(e,n.chain),a=n.chain),vu(i,a,e,t,n.client)}async function Sp(n,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=gt(s),a=n.chain&&n.chain.id===o?n.chain:be(o);return vu(i,a,e,t,n.client)}async function bu(n,t){var s;const e=await n.request({method:"eth_chainId"}),r=be(gt(e));if((r==null?void 0:r.id)===t.id)return;const i=ke(t.id);try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const a=await zo(t);(o==null?void 0:o.code)===4902&&await n.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=a.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:a.name,nativeCurrency:a.nativeCurrency,rpcUrls:Jo(a)}]})}}const ja=Object.freeze(Object.defineProperty({__proto__:null,autoConnectBaseAccountSDK:Sp,connectBaseAccountSDK:Vp,getBaseAccountWebProvider:gu,isBaseAccountSDKWallet:Eu},Symbol.toStringTag,{value:"Module"}));function Cp(n){const{createOptions:t}=n,e=Cn();let r,i;function s(){r=void 0,i=void 0}let o=async()=>{},a=async h=>{i=h};const l=e.subscribe("chainChanged",h=>{i=h}),u=e.subscribe("disconnect",()=>{s(),l(),u()});return e.subscribe("accountChanged",h=>{r=h}),{autoConnect:async h=>{const{autoConnectCoinbaseWalletSDK:d}=await c(async()=>{const{autoConnectCoinbaseWalletSDK:g}=await Promise.resolve().then(()=>Fa);return{autoConnectCoinbaseWalletSDK:g}},void 0),f=await n.providerFactory(),[p,w,m,_]=await d(h,e,f);return r=p,i=w,o=m,a=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:Ot}),r},connect:async h=>{const{connectCoinbaseWalletSDK:d}=await c(async()=>{const{connectCoinbaseWalletSDK:g}=await Promise.resolve().then(()=>Fa);return{connectCoinbaseWalletSDK:g}},void 0),f=await n.providerFactory(),[p,w,m,_]=await d(h,e,f);return r=p,i=w,o=m,a=_,Ye({chainId:i.id,client:h.client,walletAddress:r.address,walletType:Ot}),r},disconnect:async()=>{s(),await o()},getAccount:()=>r,getChain(){if(i)return i=Vn(i.id)||i,i},getConfig:()=>t,id:Ot,onConnectRequested:async()=>{var h;if(n.onConnectRequested){const d=await n.providerFactory();return(h=n.onConnectRequested)==null?void 0:h.call(n,d)}},subscribe:e.subscribe,switchChain:async h=>{await a(h)}}}async function Iu(n){var t,e;await((e=(t=n==null?void 0:n.communicator)==null?void 0:t.waitForPopupLoaded)==null?void 0:e.call(t))}const $p=Object.freeze(Object.defineProperty({__proto__:null,showCoinbasePopup:Iu},Symbol.toStringTag,{value:"Module"}));let as;async function Au(n){var t,e;if(!as){let r=(await c(()=>import("./index-Ca6sys5l.js"),__vite__mapDeps([13,3,12,14]))).default;typeof r!="function"&&typeof r.default=="function"&&(r=r.default);const s=new r({appChainIds:n!=null&&n.chains?n.chains.map(o=>o.id):void 0,appLogoUrl:((t=n==null?void 0:n.appMetadata)==null?void 0:t.logoUrl)||Oi().logoUrl,appName:((e=n==null?void 0:n.appMetadata)==null?void 0:e.name)||Oi().name}).makeWeb3Provider(n==null?void 0:n.walletConfig);return as=s,s}return as}function Ka({provider:n,address:t,client:e}){const r={address:J(t),onTransactionRequested:async()=>{window.localStorage&&window.localStorage.getItem("-CBWSDK:SignerConfigurator:SignerType")==="scw"&&await Iu(n)},async sendTransaction(i){const s=await n.request({method:"eth_sendTransaction",params:[{accessList:i.accessList,data:i.data,from:J(t),gas:i.gas?ke(i.gas):void 0,to:i.to,value:i.value?ke(i.value):void 0}]});return Bo({chainId:i.chainId,client:e,contractAddress:i.to??void 0,gasPrice:i.gasPrice,transactionHash:s,walletAddress:J(t),walletType:Ot}),{transactionHash:s}},async signMessage({message:i}){if(!r.address)throw new Error("Provider not setup");const s=typeof i=="string"?ko(i):i.raw instanceof Uint8Array?zi(i.raw):i.raw,o=await n.request({method:"personal_sign",params:[s,r.address]});if(!Sr(o))throw new Error("Invalid signature returned");return o},async signTypedData(i){if(!r.address)throw new Error("Provider not setup");const{domain:s,message:o,primaryType:a}=Wo(i),l={EIP712Domain:eu(s),...i.types};tu({domain:s,message:o,primaryType:a,types:l});const u=nu({domain:s??{},message:o,primaryType:a,types:l}),h=await n.request({method:"eth_signTypedData_v4",params:[r.address,u]});if(!Sr(h))throw new Error("Invalid signed payload returned");return h},sendCalls:async i=>{try{const{callParams:s,chain:o}=await Yo(i,r),a=await n.request({method:"wallet_sendCalls",params:s});return a&&typeof a=="object"&&"id"in a?{chain:o,client:e,id:a.id}:{chain:o,client:e,id:a}}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Ot} errored calling wallet_sendCalls, with error: ${s instanceof Error?s.message:Ee(s)}`):s}},async getCallsStatus(i){try{const s=await n.request({method:"wallet_getCallsStatus",params:[i.id]});return Go(s)}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Ot} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCallsStatusRaw(i){try{return await n.request({method:"wallet_getCallsStatus",params:[i.id]})}catch(s){throw/unsupport|not support/i.test(s.message)?new Error(`${Ot} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):s}},async getCapabilities(i){const s=i.chainId;try{const o=await n.request({method:"wallet_getCapabilities",params:[J(r.address)]});return Zo(o,s)}catch(o){if(/unsupport|not support|not available/i.test(o.message))return{message:`${Ot} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw o}}};return r}function Tu(n,t,e,r,i){const s=Ka({address:n,client:i,provider:e});async function o(){e.removeListener("accountsChanged",l),e.removeListener("chainChanged",u),e.removeListener("disconnect",a),await e.disconnect()}async function a(){o(),r.emit("disconnect",void 0)}function l(h){if(h[0]){const d=Ka({address:J(h[0]),client:i,provider:e});r.emit("accountChanged",d),r.emit("accountsChanged",h)}else a()}function u(h){const d=be(gt(h));r.emit("chainChanged",d)}return e.on("accountsChanged",l),e.on("chainChanged",u),e.on("disconnect",a),[s,t,a,h=>Pu(e,h)]}async function Up(n,t,e){const r=await e.request({method:"eth_requestAccounts"});if(!r[0])throw new Error("No accounts found");const i=J(r[0]),s=await e.request({method:"eth_chainId"}),o=gt(s);let a=n.chain&&n.chain.id===o?n.chain:be(o);return o&&(n!=null&&n.chain)&&o!==(n==null?void 0:n.chain.id)&&(await Pu(e,n.chain),a=n.chain),Tu(i,a,e,t,n.client)}async function kp(n,t,e){const i=(await e.request({method:"eth_accounts"}))[0];if(!i)throw new Error("No accounts found");const s=await e.request({method:"eth_chainId"}),o=gt(s),a=n.chain&&n.chain.id===o?n.chain:be(o);return Tu(i,a,e,t,n.client)}async function Pu(n,t){var s;const e=await n.request({method:"eth_chainId"}),r=be(gt(e));if((r==null?void 0:r.id)===t.id)return;const i=ke(t.id);try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:i}]})}catch(o){const a=await zo(t);(o==null?void 0:o.code)===4902&&await n.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:((s=a.explorers)==null?void 0:s.map(l=>l.url))||[],chainId:i,chainName:a.name,nativeCurrency:a.nativeCurrency,rpcUrls:Jo(a)}]})}}const Fa=Object.freeze(Object.defineProperty({__proto__:null,autoConnectCoinbaseWalletSDK:kp,connectCoinbaseWalletSDK:Up,getCoinbaseWebProvider:Au},Symbol.toStringTag,{value:"Module"}));async function Bp(n){return cu(async()=>{var r;const e=await(await fetch(`${Ki("inAppWallet")}/api/2024-05-05/ecosystem-wallet`,{headers:{"x-ecosystem-id":n}})).json();if(!e||e.code==="UNAUTHORIZED")throw new Error(e.message||`Could not find ecosystem wallet with id ${n}, please check your ecosystem wallet configuration.`);return(r=e.authOptions)!=null&&r.includes("siwe")&&(e.authOptions=e.authOptions.filter(i=>i!=="siwe"),e.authOptions.push("wallet")),e},{cacheKey:`ecosystem-wallet-options-${n}`,cacheTime:1e3*60*5})}const cs=new Map;async function Er(n,t,e){var s;const r=Ee({clientId:n.clientId,ecosystem:e,partialSecretKey:(s=n.secretKey)==null?void 0:s.slice(0,5)});if(cs.has(r))return cs.get(r);const i=await t(n);return cs.set(r,i),i}function Ou(n){const{createOptions:t,connectorFactory:e,ecosystem:r}=n,i=r?r.id:"inApp",s=Cn();let o=t,a,l,u,h,d=null;const f=async p=>{if(r){const w=await Bp(r.id),m=w==null?void 0:w.smartAccountOptions;if(m)if(w.smartAccountOptions.executionMode==="EIP7702")o={...o,executionMode:{mode:"EIP7702",sponsorGas:m.sponsorGas}};else{const{defaultChainId:g}=w.smartAccountOptions,v=(p==null?void 0:p.chain)??(g?be(g):void 0);if(!v)throw new Error("A chain must be provided either via 'chain' in connect options or 'defaultChainId' in ecosystem configuration. Please pass it via connect() or update the ecosystem configuration.");o={...o,smartAccount:{chain:v,factoryAddress:m.accountFactoryAddress,sponsorGas:m.sponsorGas}}}}};return{autoConnect:async p=>{const{autoConnectInAppWallet:w}=await c(async()=>{const{autoConnectInAppWallet:y}=await Promise.resolve().then(()=>qs);return{autoConnectInAppWallet:y}},void 0),m=await Er(p.client,e,r);await f();const{account:_,chain:g,adminAccount:v}=await w(p,o,m);h=p.client,a=_,l=v,u=g;try{d=await m.storage.getAuthCookie()}catch(y){console.error("Failed to retrieve auth token:",y),d=null}return Ye({chainId:u.id,client:p.client,ecosystem:r,walletAddress:a.address,walletType:i}),a},connect:async p=>{const{connectInAppWallet:w}=await c(async()=>{const{connectInAppWallet:y}=await Promise.resolve().then(()=>qs);return{connectInAppWallet:y}},void 0),m=await Er(p.client,e,r);await f();const{account:_,chain:g,adminAccount:v}=await w(p,o,m);h=p.client,a=_,l=v,u=g;try{d=await m.storage.getAuthCookie()}catch(y){console.error("Failed to retrieve auth token:",y),d=null}return Ye({chainId:u.id,client:p.client,ecosystem:r,walletAddress:a.address,walletType:i}),a},disconnect:async()=>{if(h&&!(await(await Er(h,e,r)).logout()).success)throw new Error("Failed to logout");a=void 0,l=void 0,u=void 0,d=null,s.emit("disconnect",void 0)},getAccount:()=>a,getAdminAccount:()=>l,getAuthToken:()=>d,getChain(){if(u)return u=Vn(u.id)||u,u},getConfig:()=>o,id:i,subscribe:s.subscribe,switchChain:async p=>{var w;if((o!=null&&o.smartAccount||((w=o==null?void 0:o.executionMode)==null?void 0:w.mode)==="EIP4337")&&h&&a){const{autoConnectInAppWallet:m}=await c(async()=>{const{autoConnectInAppWallet:b}=await Promise.resolve().then(()=>qs);return{autoConnectInAppWallet:b}},void 0),_=await Er(h,e,r);await f({chain:p});const{account:g,chain:v,adminAccount:y}=await m({chain:p,client:h},o,_);l=y,a=g,u=v}else u=p;s.emit("chainChanged",p)}}}function Ru(...n){const[t,e]=n,r={id:t,partnerId:e==null?void 0:e.partnerId};return Ou({connectorFactory:async i=>{const{InAppWebConnector:s}=await c(async()=>{const{InAppWebConnector:o}=await import("./web-connector-CiZO9RvI.js");return{InAppWebConnector:o}},__vite__mapDeps([15,3,2,1,16,4,5,6,7,8]));return new s({client:i,ecosystem:r,storage:e==null?void 0:e.storage})},createOptions:{auth:{...e==null?void 0:e.auth,options:[]},partnerId:r.partnerId},ecosystem:r})}function Fs(n){return Ou({connectorFactory:async t=>{var r;const{InAppWebConnector:e}=await c(async()=>{const{InAppWebConnector:i}=await import("./web-connector-CiZO9RvI.js");return{InAppWebConnector:i}},__vite__mapDeps([15,3,2,1,16,4,5,6,7,8]));return new e({client:t,passkeyDomain:(r=n==null?void 0:n.auth)==null?void 0:r.passkeyDomain,storage:n==null?void 0:n.storage})},createOptions:n})}function Xo(n){const t=Cn();let e,r,i,s;return{autoConnect:async o=>{const{connectSmartAccount:a}=await c(async()=>{const{connectSmartAccount:h}=await import("./index-BNdVKnva.js");return{connectSmartAccount:h}},__vite__mapDeps([17,3,1,2,18,19,4,5,6,7,8])),[l,u]=await a(o,n);return s=o,e=l,i=u,Ye({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),e},connect:async o=>{const{connectSmartAccount:a}=await c(async()=>{const{connectSmartAccount:h}=await import("./index-BNdVKnva.js");return{connectSmartAccount:h}},__vite__mapDeps([17,3,1,2,18,19,4,5,6,7,8])),[l,u]=await a(o,n);return r=o.personalAccount,s=o,e=l,i=u,Ye({chainId:i.id,client:o.client,walletAddress:e.address,walletType:"smart"}),t.emit("accountChanged",e),e},disconnect:async()=>{if(e){const{disconnectSmartAccount:o}=await c(async()=>{const{disconnectSmartAccount:a}=await import("./index-BNdVKnva.js");return{disconnectSmartAccount:a}},__vite__mapDeps([17,3,1,2,18,19,4,5,6,7,8]));await o(e)}e=void 0,r=void 0,i=void 0,t.emit("disconnect",void 0)},getAccount:()=>e,getAdminAccount:()=>r,getChain(){if(i)return i=Vn(i.id)||i,i},getConfig:()=>n,id:"smart",subscribe:t.subscribe,switchChain:async o=>{var d;if(!s)throw new Error("Cannot switch chain without a previous connection");if(!await ff(o)){const f=No({address:n.factoryAddress||mp((d=n.overrides)==null?void 0:d.entrypointAddress),chain:o,client:s.client});if(!await pf(f))throw new Error(`Factory contract not deployed on chain: ${o.id}`)}const{connectSmartAccount:l}=await c(async()=>{const{connectSmartAccount:f}=await import("./index-BNdVKnva.js");return{connectSmartAccount:f}},__vite__mapDeps([17,3,1,2,18,19,4,5,6,7,8])),[u,h]=await l({...s,chain:o},{...n,chain:o});e=u,i=h,t.emit("accountChanged",u),t.emit("chainChanged",h)}}}function mt(...n){const[t,e]=n;switch(!0){case t==="smart":return Xo(e);case(t==="embedded"||t==="inApp"):return Fs(e);case Xn(t):return Ru(...n);case t===Ot:{const r=e;return Cp({createOptions:r,onConnectRequested:async i=>{const{showCoinbasePopup:s}=await c(async()=>{const{showCoinbasePopup:o}=await Promise.resolve().then(()=>$p);return{showCoinbasePopup:o}},void 0);return s(i)},providerFactory:()=>Au(r)})}case t===qt:{const r=e;return xp({createOptions:r,providerFactory:()=>gu(r)})}default:{let a=function(){i=void 0,s=void 0};const r=Cn();let i,s,o,l=async()=>{};const u=r.subscribe("disconnect",()=>{a(),o==null||o(),u()});r.subscribe("accountChanged",p=>{i=p});let h=async()=>{throw new Error("Not implemented yet")};const d=qa()?p=>ss(p):void 0,f={autoConnect:async p=>{const{injectedProvider:w}=await c(async()=>{const{injectedProvider:m}=await Promise.resolve().then(()=>Wa);return{injectedProvider:m}},void 0);if(t!=="walletConnect"&&w(t)){const{autoConnectEip1193Wallet:m}=await c(async()=>{const{autoConnectEip1193Wallet:b}=await Promise.resolve().then(()=>Za);return{autoConnectEip1193Wallet:b}},void 0),[_,g,v,y]=await m({chain:p.chain,client:p.client,emitter:r,id:t,provider:Hs(t)});return i=_,s=g,l=v,h=y,o=r.subscribe("chainChanged",b=>{s=b}),Ye({chainId:s.id,client:p.client,walletAddress:i.address,walletType:t}),i}if(p&&"client"in p){const{autoConnectWC:m}=await c(async()=>{const{autoConnectWC:b}=await import("./controller-BW9fJMCh.js");return{autoConnectWC:b}},__vite__mapDeps([20,3,1,2,21,4,5,6,7,8])),[_,g,v,y]=await m(p,r,f.id,Pi,d);return i=_,s=g,l=v,h=y,Ye({chainId:s.id,client:p.client,walletAddress:i.address,walletType:t}),i}throw new Error("Failed to auto connect")},connect:async p=>{async function w(g){var b;const{connectWC:v}=await c(async()=>{const{connectWC:I}=await import("./controller-BW9fJMCh.js");return{connectWC:I}},__vite__mapDeps([20,3,1,2,21,4,5,6,7,8]));let y;try{const[I,D,S,x]=await v({...g,walletConnect:{...g.walletConnect,onDisplayUri:((b=g.walletConnect)==null?void 0:b.onDisplayUri)||(async E=>{var A,T;if(typeof window<"u"&&typeof document<"u")if(qa()){const P=await yu(t),V=P.mobile.native||P.mobile.universal;ss(V?Tp(V,E).redirect:E);return}else try{const{createQROverlay:P}=await c(async()=>{const{createQROverlay:V}=await import("./qr-overlay-DsRPQv6v.js");return{createQROverlay:V}},__vite__mapDeps([22,3]));y&&y.destroy(),y=P(E,{theme:((T=(A=g.walletConnect)==null?void 0:A.qrModalOptions)==null?void 0:T.themeMode)??"dark",qrSize:280,showCloseButton:!0,onCancel:()=>{var V,O;(O=(V=g.walletConnect)==null?void 0:V.onCancel)==null||O.call(V)}})}catch(P){console.error("Failed to create QR overlay:",P)}})}},r,f.id,Pi,d);return y&&(y.destroy(),y=void 0),i=I,s=D,l=S,h=x,Ye({chainId:s.id,client:g.client,walletAddress:i.address,walletType:t}),i}catch(I){throw y&&(y.destroy(),y=void 0),I}}if(t==="walletConnect"){const{client:g,chain:v,...y}=p;return w({chain:v,client:g,walletConnect:{...y}})}const m=p&&"walletConnect"in p,{injectedProvider:_}=await c(async()=>{const{injectedProvider:g}=await Promise.resolve().then(()=>Wa);return{injectedProvider:g}},void 0);if(_(t)&&!m){const{connectEip1193Wallet:g}=await c(async()=>{const{connectEip1193Wallet:D}=await Promise.resolve().then(()=>Za);return{connectEip1193Wallet:D}},void 0),[v,y,b,I]=await g({chain:p.chain,client:p.client,emitter:r,id:t,provider:Hs(t)});return i=v,s=y,l=b,h=I,o=r.subscribe("chainChanged",D=>{s=D}),Ye({chainId:s.id,client:p.client,walletAddress:i.address,walletType:t}),i}if(p&&"client"in p)return w(p);throw new Error("Failed to connect")},disconnect:async()=>{a(),await l()},getAccount:()=>i,getChain(){if(s)return s=Vn(s.id)||s,s},getConfig:()=>n[1],id:t,subscribe:r.subscribe,switchChain:async p=>{try{await h(p),s=p}catch(w){console.error("Error switching chain",w)}}};return f}}}function Np(){return mt("walletConnect")}const Ha=pu()?qf():void 0;function ea(n){const t=ta().find(e=>e.info.rdns===n);return t==null?void 0:t.provider}function Lu(){return ta().map(e=>e.info.rdns).map(e=>mt(e))}function Mp(){if(Ha)return Ha}function ta(){var t;const n=((t=Mp())==null?void 0:t.getProviders())||[];for(const e of n)if(e.info.rdns==="io.metamask.mobile"){e.info.rdns=_u;break}return n}const Wa=Object.freeze(Object.defineProperty({__proto__:null,getInstalledWalletProviders:ta,getInstalledWallets:Lu,injectedProvider:ea},Symbol.toStringTag,{value:"Module"}));function Hs(n){const t=ea(n);if(!t)throw new Error(`No injected provider found for wallet: "${n}"`);return t}async function Du({id:n,provider:t,emitter:e,client:r,chain:i}){var f,p;let s,a=0;for(;!(s!=null&&s[0])&&a<3;){try{s=await t.request({method:"eth_requestAccounts"})}catch(w){if(console.error(w),(p=(f=qp(w))==null?void 0:f.toLowerCase())!=null&&p.includes("rejected"))throw w;await new Promise(m=>setTimeout(m,500))}a++}const l=s==null?void 0:s[0];if(!l)throw new Error("Failed to connect to wallet, no accounts available");const u=J(l),h=await t.request({method:"eth_chainId"}).then(gt).catch(w=>{throw new Error("Error reading chainId from provider",w)});let d=i&&i.id===h?i:be(h);try{i&&typeof i.id<"u"&&i.id!==h&&(await Su(t,i),d=i)}catch{console.warn(`Error switching to chain ${i==null?void 0:i.id} - defaulting to wallet chain (${h})`)}return Vu({address:u,chain:d,client:r,emitter:e,id:n,provider:t})}async function xu({id:n,provider:t,emitter:e,client:r,chain:i}){const o=(await t.request({method:"eth_accounts"}))[0];if(!o)throw new Error("Failed to connect to wallet, no accounts available");const a=J(o),l=await t.request({method:"eth_chainId"}).then(gt),u=i&&i.id===l?i:be(l);return Vu({address:a,chain:u,client:r,emitter:e,id:n,provider:t})}function Ga({provider:n,address:t,client:e,id:r}){const i={address:J(t),async sendTransaction(s){const a=[{...s.gasPrice?{gasPrice:ke(s.gasPrice)}:{maxFeePerGas:s.maxFeePerGas?ke(s.maxFeePerGas):void 0,maxPriorityFeePerGas:s.maxPriorityFeePerGas?ke(s.maxPriorityFeePerGas):void 0},from:this.address,gas:s.gas?ke(s.gas):void 0,nonce:s.nonce?ke(s.nonce):void 0,to:s.to?J(s.to):void 0,data:s.data,value:s.value?ke(s.value):void 0,authorizationList:s.authorizationList?mf(s.authorizationList):void 0,accessList:s.accessList,...s.eip712}];try{const l=await n.request({method:"eth_sendTransaction",params:a});return Bo({chainId:s.chainId,client:e,contractAddress:s.to??void 0,gasPrice:s.gasPrice,transactionHash:l,walletAddress:J(t),walletType:r}),{transactionHash:l}}catch(l){throw yf(l)&&gf({chainId:s.chainId,client:e,contractAddress:s.to||void 0,error:l,transactionValue:s.value,walletAddress:J(t)}),l}},async signMessage({message:s}){if(!i.address)throw new Error("Provider not setup");const o=typeof s=="string"?ko(s):s.raw instanceof Uint8Array?zi(s.raw):s.raw;return await n.request({method:"personal_sign",params:[o,J(i.address)]})},async signAuthorization(s){const o=ru(s);let a;try{a=await n.request({method:"eth_sign",params:[J(i.address),o]})}catch{a=await n.request({method:"secp256k1_sign",params:[o]})}if(!a)throw new Error("Failed to sign authorization");const l=wf(a);return{...s,...l}},async signTypedData(s){if(!n||!i.address)throw new Error("Provider not setup");const o=Wo(s),{domain:a,message:l,primaryType:u}=o,h={EIP712Domain:zf({domain:a}),...o.types};jf({domain:a,message:l,primaryType:u,types:h});const d=Kf({domain:a??{},message:l,primaryType:u,types:h});return await n.request({method:"eth_signTypedData_v4",params:[J(i.address),d]})},async watchAsset(s){return await n.request({method:"wallet_watchAsset",params:s},{retryCount:0})},async sendCalls(s){try{const{callParams:o,chain:a}=await Yo(s,i),l=await n.request({method:"wallet_sendCalls",params:o});return l&&typeof l=="object"&&"id"in l?{chain:a,client:e,id:l.id}:{chain:a,client:e,id:l}}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} errored calling wallet_sendCalls, with error: ${o instanceof Error?o.message:_f(o)}`):o}},async getCallsStatus(s){try{const o=await n.request({method:"wallet_getCallsStatus",params:[s.id]});return Go(o)}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCallsStatusRaw(s){try{return await n.request({method:"wallet_getCallsStatus",params:[s.id]})}catch(o){throw/unsupport|not support/i.test(o.message)?new Error(`${r} does not support wallet_getCallsStatus, reach out to them directly to request EIP-5792 support.`):o}},async getCapabilities(s){const o=s.chainId;try{const a=await n.request({method:"wallet_getCapabilities",params:[J(i.address),o?[ke(o)]:void 0]});return Zo(a,o)}catch(a){if(/unsupport|not support|not available/i.test(a.message))return{message:`${r} does not support wallet_getCapabilities, reach out to them directly to request EIP-5792 support.`};throw a}}};return i}async function Vu({provider:n,address:t,chain:e,emitter:r,client:i,id:s}){const o=Ga({address:t,client:i,id:s,provider:n});async function a(){n.removeListener("accountsChanged",u),n.removeListener("chainChanged",h),n.removeListener("disconnect",l);try{await Ff(()=>n.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}}async function l(){a(),r.emit("disconnect",void 0)}function u(d){if(d[0]){const f=Ga({address:J(d[0]),client:i,id:s,provider:n});r.emit("accountChanged",f),r.emit("accountsChanged",d)}else l()}function h(d){const f=be(gt(d));r.emit("chainChanged",f)}return n.on&&(n.on("accountsChanged",u),n.on("chainChanged",h),n.on("disconnect",l)),[o,e,l,d=>Su(n,d)]}async function Su(n,t){var r;const e=ke(t.id);try{await n.request({method:"wallet_switchEthereumChain",params:[{chainId:e}]})}catch{const i=await zo(t);await n.request({method:"wallet_addEthereumChain",params:[{blockExplorerUrls:(r=i.explorers)==null?void 0:r.map(s=>s.url),chainId:e,chainName:i.name,nativeCurrency:i.nativeCurrency,rpcUrls:Jo(i)}]})}}function qp(n){return n instanceof Error?n.message:typeof n=="string"?n:typeof n=="object"&&n!==null?JSON.stringify(n):String(n)}const Za=Object.freeze(Object.defineProperty({__proto__:null,autoConnectEip1193Wallet:xu,connectEip1193Wallet:Du,getInjectedProvider:Hs},Symbol.toStringTag,{value:"Module"}));function zp(n){const t=n.walletId??"adapter",e=Cn();let r,i,s;const o=async f=>(s=typeof n.provider=="function"?await n.provider(f):n.provider,s),a=e.subscribe("chainChanged",f=>{i=f});function l(){r=void 0,i=void 0}let u=async()=>{};const h=e.subscribe("disconnect",()=>{l(),a(),h()});e.subscribe("accountChanged",f=>{r=f});let d=async f=>{await(s==null?void 0:s.request({method:"wallet_switchEthereumChain",params:[{chainId:Ef(f.id)}]}))};return{autoConnect:async f=>{var g;const[p,w,m,_]=await xu({chain:f.chain,client:f.client,emitter:e,id:t,provider:await o({chainId:(g=f.chain)==null?void 0:g.id})});return r=p,i=w,u=m,d=_,e.emit("onConnect",f),Ye({client:f.client,walletAddress:r.address,walletType:t}),r},connect:async f=>{var g;const[p,w,m,_]=await Du({chain:f.chain,client:f.client,emitter:e,id:t,provider:await o({chainId:(g=f.chain)==null?void 0:g.id})});return r=p,i=w,u=m,d=_,e.emit("onConnect",f),Ye({client:f.client,walletAddress:r.address,walletType:t}),r},disconnect:async()=>{l(),await u(),e.emit("disconnect",void 0)},getAccount:()=>r,getChain(){if(i)return i=Vn(i.id)||i,i},getConfig:()=>{},id:t,subscribe:e.subscribe,switchChain:async f=>{await d(f),e.emit("chainChanged",f)}}}function jp(n){const{chain:t,client:e,wallet:r,connectOverride:i}=n,s=ji({chain:t,client:e});return{on:r.subscribe,removeListener:()=>{},request:async o=>{switch(o.method){case"eth_sendTransaction":{const a=r.getAccount();if(!a)throw new Error("Account not connected");return(await iu({account:a,transaction:js({...o.params[0],chain:t,client:e})})).transactionHash}case"eth_estimateGas":{const a=r.getAccount();if(!a)throw new Error("Account not connected");return vf({account:a,transaction:js({...o.params[0],chain:t,client:e})})}case"personal_sign":{const a=r.getAccount();if(!a)throw new Error("Account not connected");return a.signMessage({message:{raw:o.params[0]}})}case"eth_signTypedData_v4":{const a=r.getAccount();if(!a)throw new Error("Account not connected");const l=JSON.parse(o.params[1]);return a.signTypedData(l)}case"eth_accounts":{const a=r.getAccount();return a?[a.address]:[]}case"eth_requestAccounts":{const a=r.getAccount();if(a)return[a.address];const l=i?await i(r):await r.connect({client:e}).catch(u=>(console.error("Error connecting wallet",u),null));if(!l)throw new Error("Unable to connect wallet - try passing a connectOverride function");return[l.address]}case"wallet_switchEthereumChain":case"wallet_addEthereumChain":{const l=o.params[0].chainId;if(!l)throw new Error("Chain ID is required");const u=Ii(l)?Rn(l):l,h=be(u);return r.switchChain(h)}case"wallet_getCapabilities":{const a=r.getAccount();if(!a)throw new Error("Account not connected");if(!a.getCapabilities)throw new Error("Wallet does not support EIP-5792");const l=o.params[1];if(l&&Array.isArray(l)){const u=l[0],h=Ii(u)?Rn(u):Number(u);return a.getCapabilities(h?{chainId:h}:{})}return a.getCapabilities({})}case"wallet_sendCalls":{const a=r.getAccount();if(!a)throw new Error("Account not connected");if(!a.sendCalls)throw new Error("Wallet does not support EIP-5792");return a.sendCalls({...o.params[0],chain:t})}case"wallet_getCallsStatus":{const a=r.getAccount();if(!a)throw new Error("Account not connected");if(!a.getCallsStatusRaw)throw new Error("Wallet does not support EIP-5792");return await a.getCallsStatusRaw({id:o.params[0],chain:t,client:e})}default:return s(o)}}}}const Kp=Object.freeze(Object.defineProperty({__proto__:null,fromProvider:zp,toProvider:jp},Symbol.toStringTag,{value:"Module"}));function Fp(n){const t=Cn();let e=n.chain;return{autoConnect:async()=>(t.emit("onConnect",n),n.adaptedAccount),connect:async()=>(t.emit("onConnect",n),n.adaptedAccount),disconnect:async()=>{await n.onDisconnect(),t.emit("disconnect",void 0)},getAccount(){return n.adaptedAccount},getChain(){return e=Vn(e.id)||e,e},getConfig(){return n},id:"adapter",subscribe:t.subscribe,switchChain:async r=>{await n.switchChain(r),e=r,t.emit("chainChanged",r)}}}async function Hp(){return(await c(async()=>{const{default:n}=await import("./wallet-infos-BHI_w6r-.js");return{default:n}},[])).default}async function $n(n,t){return Er(n,async e=>{const{InAppWebConnector:r}=await c(async()=>{const{InAppWebConnector:i}=await import("./web-connector-CiZO9RvI.js");return{InAppWebConnector:i}},__vite__mapDeps([15,3,2,1,16,4,5,6,7,8]));return new r({client:e,ecosystem:t})},t)}async function Cu(n){const{client:t,ecosystem:e}=n,i=await(await $n(t,e)).getUser();switch(i.status){case"Logged In, Wallet Initialized":return i}}async function Wp(n){const t=await Cu(n);if(t&&"email"in t.authDetails)return t.authDetails.email}async function Gp(n){const t=await Cu(n);if(t&&"phoneNumber"in t.authDetails)return t.authDetails.phoneNumber}async function Zp(n){return(await $n(n.client,n.ecosystem)).preAuthenticate(n)}async function Yp(n){return(await $n(n.client,n.ecosystem)).authenticate(n)}async function Jp(n){const t=await $n(n.client,n.ecosystem);if(!t.authenticateWithRedirect)throw new Error("authenticateWithRedirect is not supported on this platform");return t.authenticateWithRedirect(n.strategy,n.mode,n.redirectUrl)}async function Qp(n){return await(await $n(n.client,n.ecosystem)).linkProfile(n)}async function Xp(n){return await(await $n(n.client,n.ecosystem)).unlinkProfile(n.profileToUnlink,n.allowAccountDeletion)}async function e_(n){return(await $n(n.client,n.ecosystem)).getProfiles()}function Ya(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function t_(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Hi(n,...t){if(!t_(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function n_(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");Ya(n.outputLen),Ya(n.blockLen)}function Ri(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function r_(n,t){Hi(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}const kn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ls(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function vt(n,t){return n<<32-t|n>>>t}typeof Uint8Array.from([]).toHex=="function"&&Uint8Array.fromHex;function i_(n){if(typeof n!="string")throw new Error("utf8ToBytes expected string, got "+typeof n);return new Uint8Array(new TextEncoder().encode(n))}function na(n){return typeof n=="string"&&(n=i_(n)),Hi(n),n}function s_(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];Hi(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}let $u=class{clone(){return this._cloneInto()}};function o_(n){const t=r=>n().update(na(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function a_(n=32){if(kn&&typeof kn.getRandomValues=="function")return kn.getRandomValues(new Uint8Array(n));if(kn&&typeof kn.randomBytes=="function")return Uint8Array.from(kn.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function c_(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),a=Number(e&s),l=r?4:0,u=r?0:4;n.setUint32(t+l,o,r),n.setUint32(t+u,a,r)}function l_(n,t,e){return n&t^~n&e}function u_(n,t,e){return n&t^n&e^t&e}class h_ extends $u{constructor(t,e,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=ls(this.buffer)}update(t){Ri(this);const{view:e,buffer:r,blockLen:i}=this;t=na(t);const s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=ls(t);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Ri(this),r_(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)e[d]=0;c_(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=ls(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return t.length=i,t.pos=a,t.finished=s,t.destroyed=o,i%e&&t.buffer.set(r),t}}const d_=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ht=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Wt=new Uint32Array(64);class f_ extends h_{constructor(t=32){super(64,t,8,!1),this.A=Ht[0]|0,this.B=Ht[1]|0,this.C=Ht[2]|0,this.D=Ht[3]|0,this.E=Ht[4]|0,this.F=Ht[5]|0,this.G=Ht[6]|0,this.H=Ht[7]|0}get(){const{A:t,B:e,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[t,e,r,i,s,o,a,l]}set(t,e,r,i,s,o,a,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Wt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const f=Wt[d-15],p=Wt[d-2],w=vt(f,7)^vt(f,18)^f>>>3,m=vt(p,17)^vt(p,19)^p>>>10;Wt[d]=m+Wt[d-7]+w+Wt[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const f=vt(a,6)^vt(a,11)^vt(a,25),p=h+f+l_(a,l,u)+d_[d]+Wt[d]|0,m=(vt(r,2)^vt(r,13)^vt(r,22))+u_(r,i,s)|0;h=u,u=l,l=a,a=o+p|0,o=s,s=i,i=r,r=p+m|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,s,o,a,l,u,h)}roundClean(){Wt.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const p_=o_(()=>new f_);class Uu extends $u{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,n_(t);const r=na(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),s.fill(0)}update(t){return Ri(this),this.iHash.update(t),this}digestInto(t){Ri(this),Hi(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:i,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const ku=(n,t,e)=>new Uu(n,t).update(e).digest();ku.create=(n,t)=>new Uu(n,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ra=BigInt(0),Ws=BigInt(1);function Wn(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function ia(n){if(!Wn(n))throw new Error("Uint8Array expected")}function Cr(n,t){if(typeof t!="boolean")throw new Error(n+" boolean expected, got "+t)}function ei(n){const t=n.toString(16);return t.length&1?"0"+t:t}function Bu(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?ra:BigInt("0x"+n)}const Nu=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",__=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function $r(n){if(ia(n),Nu)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=__[n[e]];return t}const Vt={_0:48,_9:57,A:65,F:70,a:97,f:102};function Ja(n){if(n>=Vt._0&&n<=Vt._9)return n-Vt._0;if(n>=Vt.A&&n<=Vt.F)return n-(Vt.A-10);if(n>=Vt.a&&n<=Vt.f)return n-(Vt.a-10)}function Li(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(Nu)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=Ja(n.charCodeAt(s)),a=Ja(n.charCodeAt(s+1));if(o===void 0||a===void 0){const l=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[i]=o*16+a}return r}function Pn(n){return Bu($r(n))}function Mu(n){return ia(n),Bu($r(Uint8Array.from(n).reverse()))}function Ur(n,t){return Li(n.toString(16).padStart(t*2,"0"))}function qu(n,t){return Ur(n,t).reverse()}function wt(n,t,e){let r;if(typeof t=="string")try{r=Li(t)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(Wn(t))r=Uint8Array.from(t);else throw new Error(n+" must be hex string or Uint8Array");const i=r.length;if(typeof e=="number"&&i!==e)throw new Error(n+" of length "+e+" expected, got "+i);return r}function Di(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];ia(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}const us=n=>typeof n=="bigint"&&ra<=n;function sa(n,t,e){return us(n)&&us(t)&&us(e)&&t<=n&&n<e}function Fn(n,t,e,r){if(!sa(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function w_(n){let t;for(t=0;n>ra;n>>=Ws,t+=1);return t}const Wi=n=>(Ws<<BigInt(n))-Ws,hs=n=>new Uint8Array(n),Qa=n=>Uint8Array.from(n);function m_(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let r=hs(n),i=hs(n),s=0;const o=()=>{r.fill(1),i.fill(0),s=0},a=(...d)=>e(i,r,...d),l=(d=hs(0))=>{i=a(Qa([0]),d),r=a(),d.length!==0&&(i=a(Qa([1]),d),r=a())},u=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let d=0;const f=[];for(;d<t;){r=a();const p=r.slice();f.push(p),d+=r.length}return Di(...f)};return(d,f)=>{o(),l(d);let p;for(;!(p=f(u()));)l();return o(),p}}const y_={bigint:n=>typeof n=="bigint",function:n=>typeof n=="function",boolean:n=>typeof n=="boolean",string:n=>typeof n=="string",stringOrUint8Array:n=>typeof n=="string"||Wn(n),isSafeInteger:n=>Number.isSafeInteger(n),array:n=>Array.isArray(n),field:(n,t)=>t.Fp.isValid(n),hash:n=>typeof n=="function"&&Number.isSafeInteger(n.outputLen)};function Gi(n,t,e={}){const r=(i,s,o)=>{const a=y_[s];if(typeof a!="function")throw new Error("invalid validator function");const l=n[i];if(!(o&&l===void 0)&&!a(l,n))throw new Error("param "+String(i)+" is invalid. Expected "+s+", got "+l)};for(const[i,s]of Object.entries(t))r(i,s,!1);for(const[i,s]of Object.entries(e))r(i,s,!0);return n}function Xa(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(i!==void 0)return i;const s=n(e,...r);return t.set(e,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const ve=BigInt(0),he=BigInt(1),gn=BigInt(2),g_=BigInt(3),Gs=BigInt(4),ec=BigInt(5),tc=BigInt(8);function We(n,t){const e=n%t;return e>=ve?e:t+e}function E_(n,t,e){if(t<ve)throw new Error("invalid exponent, negatives unsupported");if(e<=ve)throw new Error("invalid modulus");if(e===he)return ve;let r=he;for(;t>ve;)t&he&&(r=r*n%e),n=n*n%e,t>>=he;return r}function it(n,t,e){let r=n;for(;t-- >ve;)r*=r,r%=e;return r}function Zs(n,t){if(n===ve)throw new Error("invert: expected non-zero number");if(t<=ve)throw new Error("invert: expected positive modulus, got "+t);let e=We(n,t),r=t,i=ve,s=he;for(;e!==ve;){const a=r/e,l=r%e,u=i-s*a;r=e,e=l,i=s,s=u}if(r!==he)throw new Error("invert: does not exist");return We(i,t)}function v_(n){const t=(n-he)/gn;let e,r,i;for(e=n-he,r=0;e%gn===ve;e/=gn,r++);for(i=gn;i<n&&E_(i,t,n)!==n-he;i++)if(i>1e3)throw new Error("Cannot find square root: likely non-prime P");if(r===1){const o=(n+he)/Gs;return function(l,u){const h=l.pow(u,o);if(!l.eql(l.sqr(h),u))throw new Error("Cannot find square root");return h}}const s=(e+he)/gn;return function(a,l){if(a.pow(l,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,h=a.pow(a.mul(a.ONE,i),e),d=a.pow(l,s),f=a.pow(l,e);for(;!a.eql(f,a.ONE);){if(a.eql(f,a.ZERO))return a.ZERO;let p=1;for(let m=a.sqr(f);p<u&&!a.eql(m,a.ONE);p++)m=a.sqr(m);const w=a.pow(h,he<<BigInt(u-p-1));h=a.sqr(w),d=a.mul(d,w),f=a.mul(f,h),u=p}return d}}function b_(n){if(n%Gs===g_){const t=(n+he)/Gs;return function(r,i){const s=r.pow(i,t);if(!r.eql(r.sqr(s),i))throw new Error("Cannot find square root");return s}}if(n%tc===ec){const t=(n-ec)/tc;return function(r,i){const s=r.mul(i,gn),o=r.pow(s,t),a=r.mul(i,o),l=r.mul(r.mul(a,gn),o),u=r.mul(a,r.sub(l,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return v_(n)}const I_=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function A_(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=I_.reduce((r,i)=>(r[i]="function",r),t);return Gi(n,e)}function T_(n,t,e){if(e<ve)throw new Error("invalid exponent, negatives unsupported");if(e===ve)return n.ONE;if(e===he)return t;let r=n.ONE,i=t;for(;e>ve;)e&he&&(r=n.mul(r,i)),i=n.sqr(i),e>>=he;return r}function P_(n,t){const e=new Array(t.length),r=t.reduce((s,o,a)=>n.is0(o)?s:(e[a]=s,n.mul(s,o)),n.ONE),i=n.inv(r);return t.reduceRight((s,o,a)=>n.is0(o)?s:(e[a]=n.mul(s,e[a]),n.mul(s,o)),i),e}function zu(n,t){const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function ju(n,t,e=!1,r={}){if(n<=ve)throw new Error("invalid field: expected ORDER > 0, got "+n);const{nBitLength:i,nByteLength:s}=zu(n,t);if(s>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:n,isLE:e,BITS:i,BYTES:s,MASK:Wi(i),ZERO:ve,ONE:he,create:l=>We(l,n),isValid:l=>{if(typeof l!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof l);return ve<=l&&l<n},is0:l=>l===ve,isOdd:l=>(l&he)===he,neg:l=>We(-l,n),eql:(l,u)=>l===u,sqr:l=>We(l*l,n),add:(l,u)=>We(l+u,n),sub:(l,u)=>We(l-u,n),mul:(l,u)=>We(l*u,n),pow:(l,u)=>T_(a,l,u),div:(l,u)=>We(l*Zs(u,n),n),sqrN:l=>l*l,addN:(l,u)=>l+u,subN:(l,u)=>l-u,mulN:(l,u)=>l*u,inv:l=>Zs(l,n),sqrt:r.sqrt||(l=>(o||(o=b_(n)),o(a,l))),invertBatch:l=>P_(a,l),cmov:(l,u,h)=>h?u:l,toBytes:l=>e?qu(l,s):Ur(l,s),fromBytes:l=>{if(l.length!==s)throw new Error("Field.fromBytes: expected "+s+" bytes, got "+l.length);return e?Mu(l):Pn(l)}});return Object.freeze(a)}function Ku(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Fu(n){const t=Ku(n);return t+Math.ceil(t/2)}function O_(n,t,e=!1){const r=n.length,i=Ku(t),s=Fu(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=e?Mu(n):Pn(n),a=We(o,t-he)+he;return e?qu(a,i):Ur(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const nc=BigInt(0),Ys=BigInt(1);function ds(n,t){const e=t.negate();return n?e:t}function Hu(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function fs(n,t){Hu(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=Wi(n),o=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function rc(n,t,e){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=e;let a=Number(n&i),l=n>>o;a>r&&(a-=s,l+=Ys);const u=t*r,h=u+Math.abs(a)-1,d=a===0,f=a<0,p=t%2!==0;return{nextN:l,offset:h,isZero:d,isNeg:f,isNegF:p,offsetF:u}}function R_(n,t){if(!Array.isArray(n))throw new Error("array expected");n.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function L_(n,t){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const ps=new WeakMap,Wu=new WeakMap;function _s(n){return Wu.get(n)||1}function D_(n,t){return{constTimeNegate:ds,hasPrecomputes(e){return _s(e)!==1},unsafeLadder(e,r,i=n.ZERO){let s=e;for(;r>nc;)r&Ys&&(i=i.add(s)),s=s.double(),r>>=Ys;return i},precomputeWindow(e,r){const{windows:i,windowSize:s}=fs(r,t),o=[];let a=e,l=a;for(let u=0;u<i;u++){l=a,o.push(l);for(let h=1;h<s;h++)l=l.add(a),o.push(l);a=l.double()}return o},wNAF(e,r,i){let s=n.ZERO,o=n.BASE;const a=fs(e,t);for(let l=0;l<a.windows;l++){const{nextN:u,offset:h,isZero:d,isNeg:f,isNegF:p,offsetF:w}=rc(i,l,a);i=u,d?o=o.add(ds(p,r[w])):s=s.add(ds(f,r[h]))}return{p:s,f:o}},wNAFUnsafe(e,r,i,s=n.ZERO){const o=fs(e,t);for(let a=0;a<o.windows&&i!==nc;a++){const{nextN:l,offset:u,isZero:h,isNeg:d}=rc(i,a,o);if(i=l,!h){const f=r[u];s=s.add(d?f.negate():f)}}return s},getPrecomputes(e,r,i){let s=ps.get(r);return s||(s=this.precomputeWindow(r,e),e!==1&&ps.set(r,i(s))),s},wNAFCached(e,r,i){const s=_s(e);return this.wNAF(s,this.getPrecomputes(s,e,i),r)},wNAFCachedUnsafe(e,r,i,s){const o=_s(e);return o===1?this.unsafeLadder(e,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,i),r,s)},setWindowSize(e,r){Hu(r,t),Wu.set(e,r),ps.delete(e)}}}function x_(n,t,e,r){if(R_(e,n),L_(r,t),e.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const i=n.ZERO,s=w_(BigInt(e.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=Wi(o),l=new Array(Number(a)+1).fill(i),u=Math.floor((t.BITS-1)/o)*o;let h=i;for(let d=u;d>=0;d-=o){l.fill(i);for(let p=0;p<r.length;p++){const w=r[p],m=Number(w>>BigInt(d)&a);l[m]=l[m].add(e[p])}let f=i;for(let p=l.length-1,w=i;p>0;p--)w=w.add(l[p]),f=f.add(w);if(h=h.add(f),d!==0)for(let p=0;p<o;p++)h=h.double()}return h}function Gu(n){return A_(n.Fp),Gi(n,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...zu(n.n,n.nBitLength),...n,p:n.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ic(n){n.lowS!==void 0&&Cr("lowS",n.lowS),n.prehash!==void 0&&Cr("prehash",n.prehash)}function V_(n){const t=Gu(n);Gi(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:e,Fp:r,a:i}=t;if(e){if(!r.eql(i,r.ZERO))throw new Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}class S_ extends Error{constructor(t=""){super(t)}}const Bt={Err:S_,_tlv:{encode:(n,t)=>{const{Err:e}=Bt;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=ei(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?ei(i.length/2|128):"";return ei(n)+s+i+t},decode(n,t){const{Err:e}=Bt;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const l=i&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+l);if(u.length!==l)throw new e("tlv.decode: length bytes not complete");if(u[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const h of u)o=o<<8|h;if(r+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(n){const{Err:t}=Bt;if(n<Mt)throw new t("integer: negative integers are not allowed");let e=ei(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Bt;if(n[0]&128)throw new t("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Pn(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Bt,i=wt("signature",n),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l}=r.decode(2,s),{v:u,l:h}=r.decode(2,l);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(u)}},hexFromSig(n){const{_tlv:t,_int:e}=Bt,r=t.encode(2,e.encode(n.r)),i=t.encode(2,e.encode(n.s)),s=r+i;return t.encode(48,s)}},Mt=BigInt(0),ge=BigInt(1);BigInt(2);const sc=BigInt(3);BigInt(4);function C_(n){const t=V_(n),{Fp:e}=t,r=ju(t.n,t.nBitLength),i=t.toBytes||((m,_,g)=>{const v=_.toAffine();return Di(Uint8Array.from([4]),e.toBytes(v.x),e.toBytes(v.y))}),s=t.fromBytes||(m=>{const _=m.subarray(1),g=e.fromBytes(_.subarray(0,e.BYTES)),v=e.fromBytes(_.subarray(e.BYTES,2*e.BYTES));return{x:g,y:v}});function o(m){const{a:_,b:g}=t,v=e.sqr(m),y=e.mul(v,m);return e.add(e.add(y,e.mul(m,_)),g)}if(!e.eql(e.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function a(m){return sa(m,ge,t.n)}function l(m){const{allowedPrivateKeyLengths:_,nByteLength:g,wrapPrivateKey:v,n:y}=t;if(_&&typeof m!="bigint"){if(Wn(m)&&(m=$r(m)),typeof m!="string"||!_.includes(m.length))throw new Error("invalid private key");m=m.padStart(g*2,"0")}let b;try{b=typeof m=="bigint"?m:Pn(wt("private key",m,g))}catch{throw new Error("invalid private key, expected hex or "+g+" bytes, got "+typeof m)}return v&&(b=We(b,y)),Fn("private key",b,ge,y),b}function u(m){if(!(m instanceof f))throw new Error("ProjectivePoint expected")}const h=Xa((m,_)=>{const{px:g,py:v,pz:y}=m;if(e.eql(y,e.ONE))return{x:g,y:v};const b=m.is0();_==null&&(_=b?e.ONE:e.inv(y));const I=e.mul(g,_),D=e.mul(v,_),S=e.mul(y,_);if(b)return{x:e.ZERO,y:e.ZERO};if(!e.eql(S,e.ONE))throw new Error("invZ was invalid");return{x:I,y:D}}),d=Xa(m=>{if(m.is0()){if(t.allowInfinityPoint&&!e.is0(m.py))return;throw new Error("bad point: ZERO")}const{x:_,y:g}=m.toAffine();if(!e.isValid(_)||!e.isValid(g))throw new Error("bad point: x or y not FE");const v=e.sqr(g),y=o(_);if(!e.eql(v,y))throw new Error("bad point: equation left != right");if(!m.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class f{constructor(_,g,v){if(_==null||!e.isValid(_))throw new Error("x required");if(g==null||!e.isValid(g))throw new Error("y required");if(v==null||!e.isValid(v))throw new Error("z required");this.px=_,this.py=g,this.pz=v,Object.freeze(this)}static fromAffine(_){const{x:g,y:v}=_||{};if(!_||!e.isValid(g)||!e.isValid(v))throw new Error("invalid affine point");if(_ instanceof f)throw new Error("projective point not allowed");const y=b=>e.eql(b,e.ZERO);return y(g)&&y(v)?f.ZERO:new f(g,v,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(_){const g=e.invertBatch(_.map(v=>v.pz));return _.map((v,y)=>v.toAffine(g[y])).map(f.fromAffine)}static fromHex(_){const g=f.fromAffine(s(wt("pointHex",_)));return g.assertValidity(),g}static fromPrivateKey(_){return f.BASE.multiply(l(_))}static msm(_,g){return x_(f,r,_,g)}_setWindowSize(_){w.setWindowSize(this,_)}assertValidity(){d(this)}hasEvenY(){const{y:_}=this.toAffine();if(e.isOdd)return!e.isOdd(_);throw new Error("Field doesn't support isOdd")}equals(_){u(_);const{px:g,py:v,pz:y}=this,{px:b,py:I,pz:D}=_,S=e.eql(e.mul(g,D),e.mul(b,y)),x=e.eql(e.mul(v,D),e.mul(I,y));return S&&x}negate(){return new f(this.px,e.neg(this.py),this.pz)}double(){const{a:_,b:g}=t,v=e.mul(g,sc),{px:y,py:b,pz:I}=this;let D=e.ZERO,S=e.ZERO,x=e.ZERO,E=e.mul(y,y),A=e.mul(b,b),T=e.mul(I,I),P=e.mul(y,b);return P=e.add(P,P),x=e.mul(y,I),x=e.add(x,x),D=e.mul(_,x),S=e.mul(v,T),S=e.add(D,S),D=e.sub(A,S),S=e.add(A,S),S=e.mul(D,S),D=e.mul(P,D),x=e.mul(v,x),T=e.mul(_,T),P=e.sub(E,T),P=e.mul(_,P),P=e.add(P,x),x=e.add(E,E),E=e.add(x,E),E=e.add(E,T),E=e.mul(E,P),S=e.add(S,E),T=e.mul(b,I),T=e.add(T,T),E=e.mul(T,P),D=e.sub(D,E),x=e.mul(T,A),x=e.add(x,x),x=e.add(x,x),new f(D,S,x)}add(_){u(_);const{px:g,py:v,pz:y}=this,{px:b,py:I,pz:D}=_;let S=e.ZERO,x=e.ZERO,E=e.ZERO;const A=t.a,T=e.mul(t.b,sc);let P=e.mul(g,b),V=e.mul(v,I),O=e.mul(y,D),R=e.add(g,v),L=e.add(b,I);R=e.mul(R,L),L=e.add(P,V),R=e.sub(R,L),L=e.add(g,y);let C=e.add(b,D);return L=e.mul(L,C),C=e.add(P,O),L=e.sub(L,C),C=e.add(v,y),S=e.add(I,D),C=e.mul(C,S),S=e.add(V,O),C=e.sub(C,S),E=e.mul(A,L),S=e.mul(T,O),E=e.add(S,E),S=e.sub(V,E),E=e.add(V,E),x=e.mul(S,E),V=e.add(P,P),V=e.add(V,P),O=e.mul(A,O),L=e.mul(T,L),V=e.add(V,O),O=e.sub(P,O),O=e.mul(A,O),L=e.add(L,O),P=e.mul(V,L),x=e.add(x,P),P=e.mul(C,L),S=e.mul(R,S),S=e.sub(S,P),P=e.mul(R,V),E=e.mul(C,E),E=e.add(E,P),new f(S,x,E)}subtract(_){return this.add(_.negate())}is0(){return this.equals(f.ZERO)}wNAF(_){return w.wNAFCached(this,_,f.normalizeZ)}multiplyUnsafe(_){const{endo:g,n:v}=t;Fn("scalar",_,Mt,v);const y=f.ZERO;if(_===Mt)return y;if(this.is0()||_===ge)return this;if(!g||w.hasPrecomputes(this))return w.wNAFCachedUnsafe(this,_,f.normalizeZ);let{k1neg:b,k1:I,k2neg:D,k2:S}=g.splitScalar(_),x=y,E=y,A=this;for(;I>Mt||S>Mt;)I&ge&&(x=x.add(A)),S&ge&&(E=E.add(A)),A=A.double(),I>>=ge,S>>=ge;return b&&(x=x.negate()),D&&(E=E.negate()),E=new f(e.mul(E.px,g.beta),E.py,E.pz),x.add(E)}multiply(_){const{endo:g,n:v}=t;Fn("scalar",_,ge,v);let y,b;if(g){const{k1neg:I,k1:D,k2neg:S,k2:x}=g.splitScalar(_);let{p:E,f:A}=this.wNAF(D),{p:T,f:P}=this.wNAF(x);E=w.constTimeNegate(I,E),T=w.constTimeNegate(S,T),T=new f(e.mul(T.px,g.beta),T.py,T.pz),y=E.add(T),b=A.add(P)}else{const{p:I,f:D}=this.wNAF(_);y=I,b=D}return f.normalizeZ([y,b])[0]}multiplyAndAddUnsafe(_,g,v){const y=f.BASE,b=(D,S)=>S===Mt||S===ge||!D.equals(y)?D.multiplyUnsafe(S):D.multiply(S),I=b(this,g).add(b(_,v));return I.is0()?void 0:I}toAffine(_){return h(this,_)}isTorsionFree(){const{h:_,isTorsionFree:g}=t;if(_===ge)return!0;if(g)return g(f,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:_,clearCofactor:g}=t;return _===ge?this:g?g(f,this):this.multiplyUnsafe(t.h)}toRawBytes(_=!0){return Cr("isCompressed",_),this.assertValidity(),i(f,this,_)}toHex(_=!0){return Cr("isCompressed",_),$r(this.toRawBytes(_))}}f.BASE=new f(t.Gx,t.Gy,e.ONE),f.ZERO=new f(e.ZERO,e.ONE,e.ZERO);const p=t.nBitLength,w=D_(f,t.endo?Math.ceil(p/2):p);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:l,weierstrassEquation:o,isWithinCurveOrder:a}}function $_(n){const t=Gu(n);return Gi(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function U_(n){const t=$_(n),{Fp:e,n:r}=t,i=e.BYTES+1,s=2*e.BYTES+1;function o(O){return We(O,r)}function a(O){return Zs(O,r)}const{ProjectivePoint:l,normPrivateKeyToScalar:u,weierstrassEquation:h,isWithinCurveOrder:d}=C_({...t,toBytes(O,R,L){const C=R.toAffine(),U=e.toBytes(C.x),$=Di;return Cr("isCompressed",L),L?$(Uint8Array.from([R.hasEvenY()?2:3]),U):$(Uint8Array.from([4]),U,e.toBytes(C.y))},fromBytes(O){const R=O.length,L=O[0],C=O.subarray(1);if(R===i&&(L===2||L===3)){const U=Pn(C);if(!sa(U,ge,e.ORDER))throw new Error("Point is not on curve");const $=h(U);let M;try{M=e.sqrt($)}catch(F){const K=F instanceof Error?": "+F.message:"";throw new Error("Point is not on curve"+K)}const B=(M&ge)===ge;return(L&1)===1!==B&&(M=e.neg(M)),{x:U,y:M}}else if(R===s&&L===4){const U=e.fromBytes(C.subarray(0,e.BYTES)),$=e.fromBytes(C.subarray(e.BYTES,2*e.BYTES));return{x:U,y:$}}else{const U=i,$=s;throw new Error("invalid Point, expected length of "+U+", or uncompressed "+$+", got "+R)}}}),f=O=>$r(Ur(O,t.nByteLength));function p(O){const R=r>>ge;return O>R}function w(O){return p(O)?o(-O):O}const m=(O,R,L)=>Pn(O.slice(R,L));class _{constructor(R,L,C){Fn("r",R,ge,r),Fn("s",L,ge,r),this.r=R,this.s=L,C!=null&&(this.recovery=C),Object.freeze(this)}static fromCompact(R){const L=t.nByteLength;return R=wt("compactSignature",R,L*2),new _(m(R,0,L),m(R,L,2*L))}static fromDER(R){const{r:L,s:C}=Bt.toSig(wt("DER",R));return new _(L,C)}assertValidity(){}addRecoveryBit(R){return new _(this.r,this.s,R)}recoverPublicKey(R){const{r:L,s:C,recovery:U}=this,$=D(wt("msgHash",R));if(U==null||![0,1,2,3].includes(U))throw new Error("recovery id invalid");const M=U===2||U===3?L+t.n:L;if(M>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");const B=U&1?"03":"02",j=l.fromHex(B+f(M)),F=a(M),K=o(-$*F),H=o(C*F),G=l.BASE.multiplyAndAddUnsafe(j,K,H);if(!G)throw new Error("point at infinify");return G.assertValidity(),G}hasHighS(){return p(this.s)}normalizeS(){return this.hasHighS()?new _(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return Li(this.toDERHex())}toDERHex(){return Bt.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Li(this.toCompactHex())}toCompactHex(){return f(this.r)+f(this.s)}}const g={isValidPrivateKey(O){try{return u(O),!0}catch{return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{const O=Fu(t.n);return O_(t.randomBytes(O),t.n)},precompute(O=8,R=l.BASE){return R._setWindowSize(O),R.multiply(BigInt(3)),R}};function v(O,R=!0){return l.fromPrivateKey(O).toRawBytes(R)}function y(O){const R=Wn(O),L=typeof O=="string",C=(R||L)&&O.length;return R?C===i||C===s:L?C===2*i||C===2*s:O instanceof l}function b(O,R,L=!0){if(y(O))throw new Error("first arg must be private key");if(!y(R))throw new Error("second arg must be public key");return l.fromHex(R).multiply(u(O)).toRawBytes(L)}const I=t.bits2int||function(O){if(O.length>8192)throw new Error("input is too large");const R=Pn(O),L=O.length*8-t.nBitLength;return L>0?R>>BigInt(L):R},D=t.bits2int_modN||function(O){return o(I(O))},S=Wi(t.nBitLength);function x(O){return Fn("num < 2^"+t.nBitLength,O,Mt,S),Ur(O,t.nByteLength)}function E(O,R,L=A){if(["recovered","canonical"].some(re=>re in L))throw new Error("sign() legacy options not supported");const{hash:C,randomBytes:U}=t;let{lowS:$,prehash:M,extraEntropy:B}=L;$==null&&($=!0),O=wt("msgHash",O),ic(L),M&&(O=wt("prehashed msgHash",C(O)));const j=D(O),F=u(R),K=[x(F),x(j)];if(B!=null&&B!==!1){const re=B===!0?U(e.BYTES):B;K.push(wt("extraEntropy",re))}const H=Di(...K),G=j;function ce(re){const te=I(re);if(!d(te))return;const Le=a(te),Ne=l.BASE.multiply(te).toAffine(),Et=o(Ne.x);if(Et===Mt)return;const _n=o(Le*o(G+Et*F));if(_n===Mt)return;let xt=(Ne.x===Et?0:2)|Number(Ne.y&ge),Kt=_n;return $&&p(_n)&&(Kt=w(_n),xt^=1),new _(Et,Kt,xt)}return{seed:H,k2sig:ce}}const A={lowS:t.lowS,prehash:!1},T={lowS:t.lowS,prehash:!1};function P(O,R,L=A){const{seed:C,k2sig:U}=E(O,R,L),$=t;return m_($.hash.outputLen,$.nByteLength,$.hmac)(C,U)}l.BASE._setWindowSize(8);function V(O,R,L,C=T){var xt;const U=O;R=wt("msgHash",R),L=wt("publicKey",L);const{lowS:$,prehash:M,format:B}=C;if(ic(C),"strict"in C)throw new Error("options.strict was renamed to lowS");if(B!==void 0&&B!=="compact"&&B!=="der")throw new Error("format must be compact or der");const j=typeof U=="string"||Wn(U),F=!j&&!B&&typeof U=="object"&&U!==null&&typeof U.r=="bigint"&&typeof U.s=="bigint";if(!j&&!F)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let K,H;try{if(F&&(K=new _(U.r,U.s)),j){try{B!=="compact"&&(K=_.fromDER(U))}catch(Kt){if(!(Kt instanceof Bt.Err))throw Kt}!K&&B!=="der"&&(K=_.fromCompact(U))}H=l.fromHex(L)}catch{return!1}if(!K||$&&K.hasHighS())return!1;M&&(R=t.hash(R));const{r:G,s:ce}=K,re=D(R),te=a(ce),Le=o(re*te),Ne=o(G*te),Et=(xt=l.BASE.multiplyAndAddUnsafe(H,Le,Ne))==null?void 0:xt.toAffine();return Et?o(Et.x)===G:!1}return{CURVE:t,getPublicKey:v,getSharedSecret:b,sign:P,verify:V,ProjectivePoint:l,Signature:_,utils:g}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function k_(n){return{hash:n,hmac:(t,...e)=>ku(n,t,s_(...e)),randomBytes:a_}}function B_(n,t){const e=r=>U_({...n,...k_(r)});return{...e(t),create:e}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Zu=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),oc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),N_=BigInt(1),Js=BigInt(2),ac=(n,t)=>(n+t/Js)/t;function M_(n){const t=Zu,e=BigInt(3),r=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),u=n*n*n%t,h=u*u*n%t,d=it(h,e,t)*h%t,f=it(d,e,t)*h%t,p=it(f,Js,t)*u%t,w=it(p,i,t)*p%t,m=it(w,s,t)*w%t,_=it(m,a,t)*m%t,g=it(_,l,t)*_%t,v=it(g,a,t)*m%t,y=it(v,e,t)*h%t,b=it(y,o,t)*w%t,I=it(b,r,t)*u%t,D=it(I,Js,t);if(!Qs.eql(Qs.sqr(D),n))throw new Error("Cannot find square root");return D}const Qs=ju(Zu,void 0,void 0,{sqrt:M_}),oa=B_({a:BigInt(0),b:BigInt(7),Fp:Qs,n:oc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:n=>{const t=oc,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-N_*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,o=BigInt("0x100000000000000000000000000000000"),a=ac(s*n,t),l=ac(-r*n,t);let u=We(n-a*e-l*i,t),h=We(-a*r-l*s,t);const d=u>o,f=h>o;if(d&&(u=t-u),f&&(h=t-h),u>o||h>o)throw new Error("splitScalar: Endomorphism failed, k="+n);return{k1neg:d,k1:u,k2neg:f,k2:h}}}},p_);BigInt(0);oa.ProjectivePoint;function q_(n){if("privateKey"in n){const t=dp(typeof n.message=="object"?n.message.raw:Ql(n.message)),e=Mo({payload:t,privateKey:n.privateKey});return su(e)}if("account"in n){const{message:t,account:e}=n;return e.signMessage({message:t})}throw new Error("Either privateKey or account is required")}function z_(n){var s;const{privateKey:t,...e}=n;typeof((s=e.domain)==null?void 0:s.chainId)=="string"&&(e.domain.chainId=Xl(e.domain.chainId));const r=bf(e),i=Mo({payload:r,privateKey:t});return su(i)}function Xs(n){const{client:t}=n,e=`0x${n.privateKey.replace(/^0x/,"")}`,r=qo(oa.getPublicKey(e.slice(2),!1)),i=Hf(r);return{address:J(i),sendTransaction:async o=>{const a=ji({chain:be(o.chainId),client:t}),l=$a({privateKey:e,transaction:o});return{transactionHash:await Af(a,l)}},signAuthorization:async o=>{const a=Mo({payload:ru(o),privateKey:e});return If(o,{signature:a})},signMessage:async({message:o})=>q_({message:o,privateKey:e}),signTransaction:async o=>$a({privateKey:e,transaction:o}),signTypedData:async o=>z_({...o,privateKey:e})}}async function j_(n){const t=qo(oa.utils.randomPrivateKey());return Xs({client:n.client,privateKey:t})}async function K_(n){const{address:t,client:e,chain:r}=n,i=n.tokenAddress||(r.id===42429?"0x20c0000000000000000000000000000000000000":void 0);if(i&&J(i)!==J(Ua)){const{getBalance:h}=await c(async()=>{const{getBalance:d}=await import("./getBalance-DGuxWuYL.js");return{getBalance:d}},__vite__mapDeps([23,1,2,3,24]));return h({address:t,contract:No({address:i,chain:r,client:e})})}const s=ji({chain:r,client:e}),[o,a,l,u]=await Promise.all([Uf(r),kf(r),Bf(r),Tf(s,{address:t})]);return{chainId:r.id,decimals:a,displayValue:Pf(u,a),name:l,symbol:o,tokenAddress:i??Ua,value:u}}function F_(n){return!n||typeof n.then!="function"?Promise.resolve(n):n}function ye(n,...t){try{return F_(n(...t))}catch(e){return Promise.reject(e)}}function H_(n){const t=typeof n;return n===null||t!=="object"&&t!=="function"}function W_(n){const t=Object.getPrototypeOf(n);return!t||t.isPrototypeOf(Object)}function pi(n){if(H_(n))return String(n);if(W_(n)||Array.isArray(n))return JSON.stringify(n);if(typeof n.toJSON=="function")return pi(n.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const eo="base64:";function G_(n){return typeof n=="string"?n:eo+J_(n)}function Z_(n){return typeof n!="string"||!n.startsWith(eo)?n:Y_(n.slice(eo.length))}function Y_(n){return globalThis.Buffer?Buffer.from(n,"base64"):Uint8Array.from(globalThis.atob(n),t=>t.codePointAt(0))}function J_(n){return globalThis.Buffer?Buffer.from(n).toString("base64"):globalThis.btoa(String.fromCodePoint(...n))}function Ke(n){var t;return n&&((t=n.split("?")[0])==null?void 0:t.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""))||""}function Q_(...n){return Ke(n.join(":"))}function ti(n){return n=Ke(n),n?n+":":""}function X_(n,t){if(t===void 0)return!0;let e=0,r=n.indexOf(":");for(;r>-1;)e++,r=n.indexOf(":",r+1);return e<=t}function ew(n,t){return t?n.startsWith(t)&&n[n.length-1]!=="$":n[n.length-1]!=="$"}const tw="memory",nw=()=>{const n=new Map;return{name:tw,getInstance:()=>n,hasItem(t){return n.has(t)},getItem(t){return n.get(t)??null},getItemRaw(t){return n.get(t)??null},setItem(t,e){n.set(t,e)},setItemRaw(t,e){n.set(t,e)},removeItem(t){n.delete(t)},getKeys(){return[...n.keys()]},clear(){n.clear()},dispose(){n.clear()}}};function rw(n={}){const t={mounts:{"":n.driver||nw()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},e=u=>{for(const h of t.mountpoints)if(u.startsWith(h))return{base:h,relativeKey:u.slice(h.length),driver:t.mounts[h]};return{base:"",relativeKey:u,driver:t.mounts[""]}},r=(u,h)=>t.mountpoints.filter(d=>d.startsWith(u)||h&&u.startsWith(d)).map(d=>({relativeBase:u.length>d.length?u.slice(d.length):void 0,mountpoint:d,driver:t.mounts[d]})),i=(u,h)=>{if(t.watching){h=Ke(h);for(const d of t.watchListeners)d(u,h)}},s=async()=>{if(!t.watching){t.watching=!0;for(const u in t.mounts)t.unwatch[u]=await cc(t.mounts[u],i,u)}},o=async()=>{if(t.watching){for(const u in t.unwatch)await t.unwatch[u]();t.unwatch={},t.watching=!1}},a=(u,h,d)=>{const f=new Map,p=w=>{let m=f.get(w.base);return m||(m={driver:w.driver,base:w.base,items:[]},f.set(w.base,m)),m};for(const w of u){const m=typeof w=="string",_=Ke(m?w:w.key),g=m?void 0:w.value,v=m||!w.options?h:{...h,...w.options},y=e(_);p(y).items.push({key:_,value:g,relativeKey:y.relativeKey,options:v})}return Promise.all([...f.values()].map(w=>d(w))).then(w=>w.flat())},l={hasItem(u,h={}){u=Ke(u);const{relativeKey:d,driver:f}=e(u);return ye(f.hasItem,d,h)},getItem(u,h={}){u=Ke(u);const{relativeKey:d,driver:f}=e(u);return ye(f.getItem,d,h).then(p=>Qr(p))},getItems(u,h={}){return a(u,h,d=>d.driver.getItems?ye(d.driver.getItems,d.items.map(f=>({key:f.relativeKey,options:f.options})),h).then(f=>f.map(p=>({key:Q_(d.base,p.key),value:Qr(p.value)}))):Promise.all(d.items.map(f=>ye(d.driver.getItem,f.relativeKey,f.options).then(p=>({key:f.key,value:Qr(p)})))))},getItemRaw(u,h={}){u=Ke(u);const{relativeKey:d,driver:f}=e(u);return f.getItemRaw?ye(f.getItemRaw,d,h):ye(f.getItem,d,h).then(p=>Z_(p))},async setItem(u,h,d={}){if(h===void 0)return l.removeItem(u);u=Ke(u);const{relativeKey:f,driver:p}=e(u);p.setItem&&(await ye(p.setItem,f,pi(h),d),p.watch||i("update",u))},async setItems(u,h){await a(u,h,async d=>{if(d.driver.setItems)return ye(d.driver.setItems,d.items.map(f=>({key:f.relativeKey,value:pi(f.value),options:f.options})),h);d.driver.setItem&&await Promise.all(d.items.map(f=>ye(d.driver.setItem,f.relativeKey,pi(f.value),f.options)))})},async setItemRaw(u,h,d={}){if(h===void 0)return l.removeItem(u,d);u=Ke(u);const{relativeKey:f,driver:p}=e(u);if(p.setItemRaw)await ye(p.setItemRaw,f,h,d);else if(p.setItem)await ye(p.setItem,f,G_(h),d);else return;p.watch||i("update",u)},async removeItem(u,h={}){typeof h=="boolean"&&(h={removeMeta:h}),u=Ke(u);const{relativeKey:d,driver:f}=e(u);f.removeItem&&(await ye(f.removeItem,d,h),(h.removeMeta||h.removeMata)&&await ye(f.removeItem,d+"$",h),f.watch||i("remove",u))},async getMeta(u,h={}){typeof h=="boolean"&&(h={nativeOnly:h}),u=Ke(u);const{relativeKey:d,driver:f}=e(u),p=Object.create(null);if(f.getMeta&&Object.assign(p,await ye(f.getMeta,d,h)),!h.nativeOnly){const w=await ye(f.getItem,d+"$",h).then(m=>Qr(m));w&&typeof w=="object"&&(typeof w.atime=="string"&&(w.atime=new Date(w.atime)),typeof w.mtime=="string"&&(w.mtime=new Date(w.mtime)),Object.assign(p,w))}return p},setMeta(u,h,d={}){return this.setItem(u+"$",h,d)},removeMeta(u,h={}){return this.removeItem(u+"$",h)},async getKeys(u,h={}){var _;u=ti(u);const d=r(u,!0);let f=[];const p=[];let w=!0;for(const g of d){(_=g.driver.flags)!=null&&_.maxDepth||(w=!1);const v=await ye(g.driver.getKeys,g.relativeBase,h);for(const y of v){const b=g.mountpoint+Ke(y);f.some(I=>b.startsWith(I))||p.push(b)}f=[g.mountpoint,...f.filter(y=>!y.startsWith(g.mountpoint))]}const m=h.maxDepth!==void 0&&!w;return p.filter(g=>(!m||X_(g,h.maxDepth))&&ew(g,u))},async clear(u,h={}){u=ti(u),await Promise.all(r(u,!1).map(async d=>{if(d.driver.clear)return ye(d.driver.clear,d.relativeBase,h);if(d.driver.removeItem){const f=await d.driver.getKeys(d.relativeBase||"",h);return Promise.all(f.map(p=>d.driver.removeItem(p,h)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(u=>lc(u)))},async watch(u){return await s(),t.watchListeners.push(u),async()=>{t.watchListeners=t.watchListeners.filter(h=>h!==u),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(u,h){if(u=ti(u),u&&t.mounts[u])throw new Error(`already mounted at ${u}`);return u&&(t.mountpoints.push(u),t.mountpoints.sort((d,f)=>f.length-d.length)),t.mounts[u]=h,t.watching&&Promise.resolve(cc(h,i,u)).then(d=>{t.unwatch[u]=d}).catch(console.error),l},async unmount(u,h=!0){var d,f;u=ti(u),!(!u||!t.mounts[u])&&(t.watching&&u in t.unwatch&&((f=(d=t.unwatch)[u])==null||f.call(d),delete t.unwatch[u]),h&&await lc(t.mounts[u]),t.mountpoints=t.mountpoints.filter(p=>p!==u),delete t.mounts[u])},getMount(u=""){u=Ke(u)+":";const h=e(u);return{driver:h.driver,base:h.base}},getMounts(u="",h={}){return u=Ke(u),r(u,h.parents).map(f=>({driver:f.driver,base:f.mountpoint}))},keys:(u,h={})=>l.getKeys(u,h),get:(u,h={})=>l.getItem(u,h),set:(u,h,d={})=>l.setItem(u,h,d),has:(u,h={})=>l.hasItem(u,h),del:(u,h={})=>l.removeItem(u,h),remove:(u,h={})=>l.removeItem(u,h)};return l}function cc(n,t,e){return n.watch?n.watch((r,i)=>t(r,e+i)):()=>{}}async function lc(n){typeof n.dispose=="function"&&await ye(n.dispose)}const iw="idb-keyval";var sw=(n={})=>{const t=n.base&&n.base.length>0?`${n.base}:`:"",e=i=>t+i;let r;return n.dbName&&n.storeName&&(r=rp(n.dbName,n.storeName)),{name:iw,options:n,async hasItem(i){return!(typeof await Ma(e(i),r)>"u")},async getItem(i){return await Ma(e(i),r)??null},setItem(i,s){return ap(e(i),s,r)},removeItem(i){return op(e(i),r)},getKeys(){return sp(r)},clear(){return ip(r)}}};const ow="WALLET_CONNECT_V2_INDEXED_DB",aw="keyvaluestorage";class cw{constructor(){this.indexedDb=rw({driver:sw({dbName:ow,storeName:aw})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(t=>[t.key,t.value])}async getItem(t){const e=await this.indexedDb.getItem(t);if(e!==null)return e}async setItem(t,e){await this.indexedDb.setItem(t,jo(e))}async removeItem(t){await this.indexedDb.removeItem(t)}}var ws=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},_i={exports:{}};(function(){let n;function t(){}n=t,n.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},n.prototype.setItem=function(e,r){this[e]=String(r)},n.prototype.removeItem=function(e){delete this[e]},n.prototype.clear=function(){const e=this;Object.keys(e).forEach(function(r){e[r]=void 0,delete e[r]})},n.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},n.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof ws<"u"&&ws.localStorage?_i.exports=ws.localStorage:typeof window<"u"&&window.localStorage?_i.exports=window.localStorage:_i.exports=new t})();function lw(n){var t;return[n[0],Ai((t=n[1])!=null?t:"")]}let uw=class{constructor(){this.localStorage=_i.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(lw)}async getItem(t){const e=this.localStorage.getItem(t);if(e!==null)return Ai(e)}async setItem(t,e){this.localStorage.setItem(t,jo(e))}async removeItem(t){this.localStorage.removeItem(t)}};const hw="wc_storage_version",uc=1,dw=async(n,t,e)=>{const r=hw,i=await t.getItem(r);if(i&&i>=uc){e(t);return}const s=await n.getKeys();if(!s.length){e(t);return}const o=[];for(;s.length;){const a=s.shift();if(!a)continue;const l=a.toLowerCase();if(l.includes("wc@")||l.includes("walletconnect")||l.includes("wc_")||l.includes("wallet_connect")){const u=await n.getItem(a);await t.setItem(a,u),o.push(a)}}await t.setItem(r,uc),e(t),fw(n,o)},fw=async(n,t)=>{t.length&&t.forEach(async e=>{await n.removeItem(e)})};let pw=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};const t=new uw;this.storage=t;try{const e=new cw;dw(t,e,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(t){return await this.initialize(),this.storage.getItem(t)}async setItem(t,e){return await this.initialize(),this.storage.setItem(t,e)}async removeItem(t){return await this.initialize(),this.storage.removeItem(t)}async initialize(){this.initialized||await new Promise(t=>{const e=setInterval(()=>{this.initialized&&(clearInterval(e),t())},20)})}};var _w=Object.defineProperty,ww=(n,t,e)=>t in n?_w(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,hc=(n,t,e)=>ww(n,typeof t!="symbol"?t+"":t,e);class mw extends Jn{constructor(t){super(),this.opts=t,hc(this,"protocol","wc"),hc(this,"version",2)}}var yw=Object.defineProperty,gw=(n,t,e)=>t in n?yw(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Ew=(n,t,e)=>gw(n,t+"",e);class vw extends Jn{constructor(t,e){super(),this.core=t,this.logger=e,Ew(this,"records",new Map)}}class bw{constructor(t,e){this.logger=t,this.core=e}}let Iw=class extends Jn{constructor(t,e){super(),this.relayer=t,this.logger=e}},Aw=class extends Jn{constructor(t){super()}},Tw=class{constructor(t,e,r,i){this.core=t,this.logger=e,this.name=r}},Pw=class extends Jn{constructor(t,e){super(),this.relayer=t,this.logger=e}};class Ow extends Jn{constructor(t,e){super(),this.core=t,this.logger=e}}let Rw=class{constructor(t,e,r){this.core=t,this.logger=e,this.store=r}},Lw=class{constructor(t,e){this.projectId=t,this.logger=e}},Dw=class{constructor(t,e,r){this.core=t,this.logger=e,this.telemetryEnabled=r}};var xw=Object.defineProperty,Vw=(n,t,e)=>t in n?xw(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,dc=(n,t,e)=>Vw(n,typeof t!="symbol"?t+"":t,e);let Sw=class{constructor(t){this.opts=t,dc(this,"protocol","wc"),dc(this,"version",2)}},Cw=class{constructor(t){this.client=t}};function kr(n,{strict:t=!0}={}){return!n||typeof n!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(n):n.startsWith("0x")}function to(n){return kr(n,{strict:!1})?Math.ceil((n.length-2)/2):n.length}const Yu="2.31.0";let or={getDocsUrl:({docsBaseUrl:n,docsPath:t="",docsSlug:e})=>t?`${n??"https://viem.sh"}${t}${e?`#${e}`:""}`:void 0,version:`viem@${Yu}`};class Ln extends Error{constructor(t,e={}){var a;const r=(()=>{var l;return e.cause instanceof Ln?e.cause.details:(l=e.cause)!=null&&l.message?e.cause.message:e.details})(),i=e.cause instanceof Ln&&e.cause.docsPath||e.docsPath,s=(a=or.getDocsUrl)==null?void 0:a.call(or,{...e,docsPath:i}),o=[t||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...s?[`Docs: ${s}`]:[],...r?[`Details: ${r}`]:[],...or.version?[`Version: ${or.version}`]:[]].join(`
|
|
4
|
-
`);super(o,e.cause?{cause:e.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=i,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=t,this.version=Yu}walk(t){return Ju(this,t)}}function Ju(n,t){return t!=null&&t(n)?n:n&&typeof n=="object"&&"cause"in n&&n.cause!==void 0?Ju(n.cause,t):t?null:n}class Qu extends Ln{constructor({size:t,targetSize:e,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${t}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function er(n,{dir:t,size:e=32}={}){return typeof n=="string"?$w(n,{dir:t,size:e}):Uw(n,{dir:t,size:e})}function $w(n,{dir:t,size:e=32}={}){if(e===null)return n;const r=n.replace("0x","");if(r.length>e*2)throw new Qu({size:Math.ceil(r.length/2),targetSize:e,type:"hex"});return`0x${r[t==="right"?"padEnd":"padStart"](e*2,"0")}`}function Uw(n,{dir:t,size:e=32}={}){if(e===null)return n;if(n.length>e)throw new Qu({size:n.length,targetSize:e,type:"bytes"});const r=new Uint8Array(e);for(let i=0;i<e;i++){const s=t==="right";r[s?i:e-i-1]=n[s?i:n.length-i-1]}return r}class kw extends Ln{constructor({max:t,min:e,signed:r,size:i,value:s}){super(`Number "${s}" is not in safe ${i?`${i*8}-bit ${r?"signed":"unsigned"} `:""}integer range ${t?`(${e} to ${t})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class Bw extends Ln{constructor({givenSize:t,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function tr(n,{size:t}){if(to(n)>t)throw new Bw({givenSize:to(n),maxSize:t})}function no(n,t={}){const{signed:e}=t;t.size&&tr(n,{size:t.size});const r=BigInt(n);if(!e)return r;const i=(n.length-2)/2,s=(1n<<BigInt(i)*8n-1n)-1n;return r<=s?r:r-BigInt(`0x${"f".padStart(i*2,"f")}`)-1n}function Nw(n,t={}){return Number(no(n,t))}const Mw=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function ro(n,t={}){return typeof n=="number"||typeof n=="bigint"?eh(n,t):typeof n=="string"?jw(n,t):typeof n=="boolean"?qw(n,t):Xu(n,t)}function qw(n,t={}){const e=`0x${Number(n)}`;return typeof t.size=="number"?(tr(e,{size:t.size}),er(e,{size:t.size})):e}function Xu(n,t={}){let e="";for(let i=0;i<n.length;i++)e+=Mw[n[i]];const r=`0x${e}`;return typeof t.size=="number"?(tr(r,{size:t.size}),er(r,{dir:"right",size:t.size})):r}function eh(n,t={}){const{signed:e,size:r}=t,i=BigInt(n);let s;r?e?s=(1n<<BigInt(r)*8n-1n)-1n:s=2n**(BigInt(r)*8n)-1n:typeof n=="number"&&(s=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof s=="bigint"&&e?-s-1n:0;if(s&&i>s||i<o){const l=typeof n=="bigint"?"n":"";throw new kw({max:s?`${s}${l}`:void 0,min:`${o}${l}`,signed:e,size:r,value:`${n}${l}`})}const a=`0x${(e&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?er(a,{size:r}):a}const zw=new TextEncoder;function jw(n,t={}){const e=zw.encode(n);return Xu(e,t)}const Kw=new TextEncoder;function Fw(n,t={}){return typeof n=="number"||typeof n=="bigint"?Ww(n,t):typeof n=="boolean"?Hw(n,t):kr(n)?th(n,t):nh(n,t)}function Hw(n,t={}){const e=new Uint8Array(1);return e[0]=Number(n),typeof t.size=="number"?(tr(e,{size:t.size}),er(e,{size:t.size})):e}const St={zero:48,nine:57,A:65,F:70,a:97,f:102};function fc(n){if(n>=St.zero&&n<=St.nine)return n-St.zero;if(n>=St.A&&n<=St.F)return n-(St.A-10);if(n>=St.a&&n<=St.f)return n-(St.a-10)}function th(n,t={}){let e=n;t.size&&(tr(e,{size:t.size}),e=er(e,{dir:"right",size:t.size}));let r=e.slice(2);r.length%2&&(r=`0${r}`);const i=r.length/2,s=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const l=fc(r.charCodeAt(a++)),u=fc(r.charCodeAt(a++));if(l===void 0||u===void 0)throw new Ln(`Invalid byte sequence ("${r[a-2]}${r[a-1]}" in "${r}").`);s[o]=l*16+u}return s}function Ww(n,t){const e=eh(n,t);return th(e)}function nh(n,t={}){const e=Kw.encode(n);return typeof t.size=="number"?(tr(e,{size:t.size}),er(e,{dir:"right",size:t.size})):e}const ni=BigInt(2**32-1),pc=BigInt(32);function Gw(n,t=!1){return t?{h:Number(n&ni),l:Number(n>>pc&ni)}:{h:Number(n>>pc&ni)|0,l:Number(n&ni)|0}}function Zw(n,t=!1){const e=n.length;let r=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:a}=Gw(n[s],t);[r[s],i[s]]=[o,a]}return[r,i]}const Yw=(n,t,e)=>n<<e|t>>>32-e,Jw=(n,t,e)=>t<<e|n>>>32-e,Qw=(n,t,e)=>t<<e-32|n>>>64-e,Xw=(n,t,e)=>n<<e-32|t>>>64-e,Bn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function em(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function xi(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function Br(n,...t){if(!em(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function _P(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");xi(n.outputLen),xi(n.blockLen)}function _c(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function tm(n,t){Br(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function nm(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function rh(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function wP(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function mP(n,t){return n<<32-t|n>>>t}const rm=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function im(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}function sm(n){for(let t=0;t<n.length;t++)n[t]=im(n[t]);return n}const wc=rm?n=>n:sm;function om(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function ih(n){return typeof n=="string"&&(n=om(n)),Br(n),n}function yP(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];Br(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}class am{}function cm(n){const t=r=>n().update(ih(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function gP(n=32){if(Bn&&typeof Bn.getRandomValues=="function")return Bn.getRandomValues(new Uint8Array(n));if(Bn&&typeof Bn.randomBytes=="function")return Uint8Array.from(Bn.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}const lm=BigInt(0),ar=BigInt(1),um=BigInt(2),hm=BigInt(7),dm=BigInt(256),fm=BigInt(113),sh=[],oh=[],ah=[];for(let n=0,t=ar,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],sh.push(2*(5*r+e)),oh.push((n+1)*(n+2)/2%64);let i=lm;for(let s=0;s<7;s++)t=(t<<ar^(t>>hm)*fm)%dm,t&um&&(i^=ar<<(ar<<BigInt(s))-ar);ah.push(i)}const ch=Zw(ah,!0),pm=ch[0],_m=ch[1],mc=(n,t,e)=>e>32?Qw(n,t,e):Yw(n,t,e),yc=(n,t,e)=>e>32?Xw(n,t,e):Jw(n,t,e);function wm(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=mc(u,h,1)^e[a],f=yc(u,h,1)^e[a+1];for(let p=0;p<50;p+=10)n[o+p]^=d,n[o+p+1]^=f}let i=n[2],s=n[3];for(let o=0;o<24;o++){const a=oh[o],l=mc(i,s,a),u=yc(i,s,a),h=sh[o];i=n[h],s=n[h+1],n[h]=l,n[h+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)e[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~e[(a+2)%10]&e[(a+4)%10]}n[0]^=pm[r],n[1]^=_m[r]}rh(e)}class aa extends am{constructor(t,e,r,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=s,xi(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=nm(this.state)}clone(){return this._cloneInto()}keccak(){wc(this.state32),wm(this.state32,this.rounds),wc(this.state32),this.posOut=0,this.pos=0}update(t){_c(this),t=ih(t),Br(t);const{blockLen:e,state:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let a=0;a<o;a++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:i}=this;t[r]^=e,e&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){_c(this,!1),Br(t),this.finish();const e=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return xi(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(tm(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,rh(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new aa(e,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const mm=(n,t,e)=>cm(()=>new aa(t,n,e)),ym=mm(1,136,256/8);function lh(n,t){const e=t||"hex",r=ym(kr(n,{strict:!1})?Fw(n):n);return e==="bytes"?r:ro(r)}class gm extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const e=super.get(t);return super.has(t)&&e!==void 0&&(this.delete(t),super.set(t,e)),e}set(t,e){if(super.set(t,e),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const ms=new gm(8192);function Em(n,t){if(ms.has(`${n}.${t}`))return ms.get(`${n}.${t}`);const e=n.substring(2).toLowerCase(),r=lh(nh(e),"bytes"),i=e.split("");for(let o=0;o<40;o+=2)r[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(r[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const s=`0x${i.join("")}`;return ms.set(`${n}.${t}`,s),s}function vm(n){const t=lh(`0x${n.substring(4)}`).substring(26);return Em(`0x${t}`)}async function bm({hash:n,signature:t}){const e=kr(n)?n:ro(n),{secp256k1:r}=await c(async()=>{const{secp256k1:o}=await import("./secp256k1-CnKxz2gu.js");return{secp256k1:o}},__vite__mapDeps([25,1,2,3,4,5,6,7,8]));return`0x${(()=>{if(typeof t=="object"&&"r"in t&&"s"in t){const{r:u,s:h,v:d,yParity:f}=t,p=Number(f??d),w=gc(p);return new r.Signature(no(u),no(h)).addRecoveryBit(w)}const o=kr(t)?t:ro(t);if(to(o)!==65)throw new Error("invalid signature length");const a=Nw(`0x${o.slice(130)}`),l=gc(a);return r.Signature.fromCompact(o.substring(2,130)).addRecoveryBit(l)})().recoverPublicKey(e.substring(2)).toHex(!1)}`}function gc(n){if(n===0||n===1)return n;if(n===27)return 0;if(n===28)return 1;throw new Error("Invalid yParityOrV value")}async function Im({hash:n,signature:t}){return vm(await bm({hash:n,signature:t}))}function Am(n){if(n.length>=255)throw new TypeError("Alphabet too long");const t=new Uint8Array(256);for(let u=0;u<t.length;u++)t[u]=255;for(let u=0;u<n.length;u++){const h=n.charAt(u),d=h.charCodeAt(0);if(t[d]!==255)throw new TypeError(h+" is ambiguous");t[d]=u}const e=n.length,r=n.charAt(0),i=Math.log(e)/Math.log(256),s=Math.log(256)/Math.log(e);function o(u){if(u instanceof Uint8Array||(ArrayBuffer.isView(u)?u=new Uint8Array(u.buffer,u.byteOffset,u.byteLength):Array.isArray(u)&&(u=Uint8Array.from(u))),!(u instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(u.length===0)return"";let h=0,d=0,f=0;const p=u.length;for(;f!==p&&u[f]===0;)f++,h++;const w=(p-f)*s+1>>>0,m=new Uint8Array(w);for(;f!==p;){let v=u[f],y=0;for(let b=w-1;(v!==0||y<d)&&b!==-1;b--,y++)v+=256*m[b]>>>0,m[b]=v%e>>>0,v=v/e>>>0;if(v!==0)throw new Error("Non-zero carry");d=y,f++}let _=w-d;for(;_!==w&&m[_]===0;)_++;let g=r.repeat(h);for(;_<w;++_)g+=n.charAt(m[_]);return g}function a(u){if(typeof u!="string")throw new TypeError("Expected String");if(u.length===0)return new Uint8Array;let h=0,d=0,f=0;for(;u[h]===r;)d++,h++;const p=(u.length-h)*i+1>>>0,w=new Uint8Array(p);for(;h<u.length;){const v=u.charCodeAt(h);if(v>255)return;let y=t[v];if(y===255)return;let b=0;for(let I=p-1;(y!==0||b<f)&&I!==-1;I--,b++)y+=e*w[I]>>>0,w[I]=y%256>>>0,y=y/256>>>0;if(y!==0)throw new Error("Non-zero carry");f=b,h++}let m=p-f;for(;m!==p&&w[m]===0;)m++;const _=new Uint8Array(d+(p-m));let g=d;for(;m!==p;)_[g++]=w[m++];return _}function l(u){const h=a(u);if(h)return h;throw new Error("Non-base"+e+" character")}return{encode:o,decodeUnsafe:a,decode:l}}var Tm="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";const Hr=Am(Tm);function Pm(n){const t=n.length;let e=0,r=0;for(;r<t;){let i=n.charCodeAt(r++);if(i&4294967168)if(!(i&4294965248))e+=2;else{if(i>=55296&&i<=56319&&r<t){const s=n.charCodeAt(r);(s&64512)===56320&&(++r,i=((i&1023)<<10)+(s&1023)+65536)}i&4294901760?e+=4:e+=3}else{e++;continue}}return e}function Om(n,t,e){const r=n.length;let i=e,s=0;for(;s<r;){let o=n.charCodeAt(s++);if(o&4294967168)if(!(o&4294965248))t[i++]=o>>6&31|192;else{if(o>=55296&&o<=56319&&s<r){const a=n.charCodeAt(s);(a&64512)===56320&&(++s,o=((o&1023)<<10)+(a&1023)+65536)}o&4294901760?(t[i++]=o>>18&7|240,t[i++]=o>>12&63|128,t[i++]=o>>6&63|128):(t[i++]=o>>12&15|224,t[i++]=o>>6&63|128)}else{t[i++]=o;continue}t[i++]=o&63|128}}const Rm=new TextEncoder,Lm=50;function Dm(n,t,e){Rm.encodeInto(n,t.subarray(e))}function xm(n,t,e){n.length>Lm?Dm(n,t,e):Om(n,t,e)}const Vm=4096;function uh(n,t,e){let r=t;const i=r+e,s=[];let o="";for(;r<i;){const a=n[r++];if(!(a&128))s.push(a);else if((a&224)===192){const l=n[r++]&63;s.push((a&31)<<6|l)}else if((a&240)===224){const l=n[r++]&63,u=n[r++]&63;s.push((a&31)<<12|l<<6|u)}else if((a&248)===240){const l=n[r++]&63,u=n[r++]&63,h=n[r++]&63;let d=(a&7)<<18|l<<12|u<<6|h;d>65535&&(d-=65536,s.push(d>>>10&1023|55296),d=56320|d&1023),s.push(d)}else s.push(a);s.length>=Vm&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}const Sm=new TextDecoder,Cm=200;function $m(n,t,e){const r=n.subarray(t,t+e);return Sm.decode(r)}function Um(n,t,e){return e>Cm?$m(n,t,e):uh(n,t,e)}class ri{constructor(t,e){this.type=t,this.data=e}}class tt extends Error{constructor(t){super(t);const e=Object.create(tt.prototype);Object.setPrototypeOf(this,e),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:tt.name})}}const cr=4294967295;function km(n,t,e){const r=e/4294967296,i=e;n.setUint32(t,r),n.setUint32(t+4,i)}function hh(n,t,e){const r=Math.floor(e/4294967296),i=e;n.setUint32(t,r),n.setUint32(t+4,i)}function dh(n,t){const e=n.getInt32(t),r=n.getUint32(t+4);return e*4294967296+r}function Bm(n,t){const e=n.getUint32(t),r=n.getUint32(t+4);return e*4294967296+r}const Nm=-1,Mm=4294967296-1,qm=17179869184-1;function zm({sec:n,nsec:t}){if(n>=0&&t>=0&&n<=qm)if(t===0&&n<=Mm){const e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,n),e}else{const e=n/4294967296,r=n&4294967295,i=new Uint8Array(8),s=new DataView(i.buffer);return s.setUint32(0,t<<2|e&3),s.setUint32(4,r),i}else{const e=new Uint8Array(12),r=new DataView(e.buffer);return r.setUint32(0,t),hh(r,4,n),e}}function jm(n){const t=n.getTime(),e=Math.floor(t/1e3),r=(t-e*1e3)*1e6,i=Math.floor(r/1e9);return{sec:e+i,nsec:r-i*1e9}}function Km(n){if(n instanceof Date){const t=jm(n);return zm(t)}else return null}function Fm(n){const t=new DataView(n.buffer,n.byteOffset,n.byteLength);switch(n.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{const e=t.getUint32(0),r=t.getUint32(4),i=(e&3)*4294967296+r,s=e>>>2;return{sec:i,nsec:s}}case 12:{const e=dh(t,4),r=t.getUint32(0);return{sec:e,nsec:r}}default:throw new tt(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${n.length}`)}}function Hm(n){const t=Fm(n);return new Date(t.sec*1e3+t.nsec/1e6)}const Wm={type:Nm,encode:Km,decode:Hm};class Vi{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(Wm)}register({type:t,encode:e,decode:r}){if(t>=0)this.encoders[t]=e,this.decoders[t]=r;else{const i=-1-t;this.builtInEncoders[i]=e,this.builtInDecoders[i]=r}}tryToEncode(t,e){for(let r=0;r<this.builtInEncoders.length;r++){const i=this.builtInEncoders[r];if(i!=null){const s=i(t,e);if(s!=null){const o=-1-r;return new ri(o,s)}}}for(let r=0;r<this.encoders.length;r++){const i=this.encoders[r];if(i!=null){const s=i(t,e);if(s!=null){const o=r;return new ri(o,s)}}}return t instanceof ri?t:null}decode(t,e,r){const i=e<0?this.builtInDecoders[-1-e]:this.decoders[e];return i?i(t,e,r):new ri(e,t)}}Vi.defaultCodec=new Vi;function Gm(n){return n instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer}function io(n){return n instanceof Uint8Array?n:ArrayBuffer.isView(n)?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):Gm(n)?new Uint8Array(n):Uint8Array.from(n)}const Zm=100,Ym=2048;class ca{constructor(t){this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Vi.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.maxDepth=(t==null?void 0:t.maxDepth)??Zm,this.initialBufferSize=(t==null?void 0:t.initialBufferSize)??Ym,this.sortKeys=(t==null?void 0:t.sortKeys)??!1,this.forceFloat32=(t==null?void 0:t.forceFloat32)??!1,this.ignoreUndefined=(t==null?void 0:t.ignoreUndefined)??!1,this.forceIntegerToFloat=(t==null?void 0:t.forceIntegerToFloat)??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new ca({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(t){if(this.entered)return this.clone().encodeSharedRef(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(t){if(this.entered)return this.clone().encode(t);try{return this.entered=!0,this.reinitializeState(),this.doEncode(t,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(t,e){if(e>this.maxDepth)throw new Error(`Too deep objects in depth ${e}`);t==null?this.encodeNil():typeof t=="boolean"?this.encodeBoolean(t):typeof t=="number"?this.forceIntegerToFloat?this.encodeNumberAsFloat(t):this.encodeNumber(t):typeof t=="string"?this.encodeString(t):this.useBigInt64&&typeof t=="bigint"?this.encodeBigInt64(t):this.encodeObject(t,e)}ensureBufferSizeToWrite(t){const e=this.pos+t;this.view.byteLength<e&&this.resizeBuffer(e*2)}resizeBuffer(t){const e=new ArrayBuffer(t),r=new Uint8Array(e),i=new DataView(e);r.set(this.bytes),this.view=i,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(t){t===!1?this.writeU8(194):this.writeU8(195)}encodeNumber(t){!this.forceIntegerToFloat&&Number.isSafeInteger(t)?t>=0?t<128?this.writeU8(t):t<256?(this.writeU8(204),this.writeU8(t)):t<65536?(this.writeU8(205),this.writeU16(t)):t<4294967296?(this.writeU8(206),this.writeU32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(207),this.writeU64(t)):t>=-32?this.writeU8(224|t+32):t>=-128?(this.writeU8(208),this.writeI8(t)):t>=-32768?(this.writeU8(209),this.writeI16(t)):t>=-2147483648?(this.writeU8(210),this.writeI32(t)):this.useBigInt64?this.encodeNumberAsFloat(t):(this.writeU8(211),this.writeI64(t)):this.encodeNumberAsFloat(t)}encodeNumberAsFloat(t){this.forceFloat32?(this.writeU8(202),this.writeF32(t)):(this.writeU8(203),this.writeF64(t))}encodeBigInt64(t){t>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(t)):(this.writeU8(211),this.writeBigInt64(t))}writeStringHeader(t){if(t<32)this.writeU8(160+t);else if(t<256)this.writeU8(217),this.writeU8(t);else if(t<65536)this.writeU8(218),this.writeU16(t);else if(t<4294967296)this.writeU8(219),this.writeU32(t);else throw new Error(`Too long string: ${t} bytes in UTF-8`)}encodeString(t){const r=Pm(t);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),xm(t,this.bytes,this.pos),this.pos+=r}encodeObject(t,e){const r=this.extensionCodec.tryToEncode(t,this.context);if(r!=null)this.encodeExtension(r);else if(Array.isArray(t))this.encodeArray(t,e);else if(ArrayBuffer.isView(t))this.encodeBinary(t);else if(typeof t=="object")this.encodeMap(t,e);else throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(t)}`)}encodeBinary(t){const e=t.byteLength;if(e<256)this.writeU8(196),this.writeU8(e);else if(e<65536)this.writeU8(197),this.writeU16(e);else if(e<4294967296)this.writeU8(198),this.writeU32(e);else throw new Error(`Too large binary: ${e}`);const r=io(t);this.writeU8a(r)}encodeArray(t,e){const r=t.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw new Error(`Too large array: ${r}`);for(const i of t)this.doEncode(i,e+1)}countWithoutUndefined(t,e){let r=0;for(const i of e)t[i]!==void 0&&r++;return r}encodeMap(t,e){const r=Object.keys(t);this.sortKeys&&r.sort();const i=this.ignoreUndefined?this.countWithoutUndefined(t,r):r.length;if(i<16)this.writeU8(128+i);else if(i<65536)this.writeU8(222),this.writeU16(i);else if(i<4294967296)this.writeU8(223),this.writeU32(i);else throw new Error(`Too large map object: ${i}`);for(const s of r){const o=t[s];this.ignoreUndefined&&o===void 0||(this.encodeString(s),this.doEncode(o,e+1))}}encodeExtension(t){if(typeof t.data=="function"){const r=t.data(this.pos+6),i=r.length;if(i>=4294967296)throw new Error(`Too large extension object: ${i}`);this.writeU8(201),this.writeU32(i),this.writeI8(t.type),this.writeU8a(r);return}const e=t.data.length;if(e===1)this.writeU8(212);else if(e===2)this.writeU8(213);else if(e===4)this.writeU8(214);else if(e===8)this.writeU8(215);else if(e===16)this.writeU8(216);else if(e<256)this.writeU8(199),this.writeU8(e);else if(e<65536)this.writeU8(200),this.writeU16(e);else if(e<4294967296)this.writeU8(201),this.writeU32(e);else throw new Error(`Too large extension object: ${e}`);this.writeI8(t.type),this.writeU8a(t.data)}writeU8(t){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,t),this.pos++}writeU8a(t){const e=t.length;this.ensureBufferSizeToWrite(e),this.bytes.set(t,this.pos),this.pos+=e}writeI8(t){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,t),this.pos++}writeU16(t){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,t),this.pos+=2}writeI16(t){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,t),this.pos+=2}writeU32(t){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,t),this.pos+=4}writeI32(t){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,t),this.pos+=4}writeF32(t){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,t),this.pos+=4}writeF64(t){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,t),this.pos+=8}writeU64(t){this.ensureBufferSizeToWrite(8),km(this.view,this.pos,t),this.pos+=8}writeI64(t){this.ensureBufferSizeToWrite(8),hh(this.view,this.pos,t),this.pos+=8}writeBigUint64(t){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,t),this.pos+=8}writeBigInt64(t){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,t),this.pos+=8}}function Jm(n,t){return new ca(t).encodeSharedRef(n)}function ys(n){return`${n<0?"-":""}0x${Math.abs(n).toString(16).padStart(2,"0")}`}const Qm=16,Xm=16;class ey{constructor(t=Qm,e=Xm){this.hit=0,this.miss=0,this.maxKeyLength=t,this.maxLengthPerKey=e,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(t){return t>0&&t<=this.maxKeyLength}find(t,e,r){const i=this.caches[r-1];e:for(const s of i){const o=s.bytes;for(let a=0;a<r;a++)if(o[a]!==t[e+a])continue e;return s.str}return null}store(t,e){const r=this.caches[t.length-1],i={bytes:t,str:e};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=i:r.push(i)}decode(t,e,r){const i=this.find(t,e,r);if(i!=null)return this.hit++,i;this.miss++;const s=uh(t,e,r),o=Uint8Array.prototype.slice.call(t,e,e+r);return this.store(o,s),s}}const so="array",Tr="map_key",fh="map_value",ty=n=>{if(typeof n=="string"||typeof n=="number")return n;throw new tt("The type of key must be string or number but "+typeof n)};class ny{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(t){const e=this.getUninitializedStateFromPool();e.type=so,e.position=0,e.size=t,e.array=new Array(t)}pushMapState(t){const e=this.getUninitializedStateFromPool();e.type=Tr,e.readCount=0,e.size=t,e.map={}}getUninitializedStateFromPool(){if(this.stackHeadPosition++,this.stackHeadPosition===this.stack.length){const t={type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null};this.stack.push(t)}return this.stack[this.stackHeadPosition]}release(t){if(this.stack[this.stackHeadPosition]!==t)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(t.type===so){const r=t;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(t.type===Tr||t.type===fh){const r=t;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const lr=-1,la=new DataView(new ArrayBuffer(0)),ry=new Uint8Array(la.buffer);try{la.getInt8(0)}catch(n){if(!(n instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}const Ec=new RangeError("Insufficient data"),iy=new ey;class ua{constructor(t){this.totalPos=0,this.pos=0,this.view=la,this.bytes=ry,this.headByte=lr,this.stack=new ny,this.entered=!1,this.extensionCodec=(t==null?void 0:t.extensionCodec)??Vi.defaultCodec,this.context=t==null?void 0:t.context,this.useBigInt64=(t==null?void 0:t.useBigInt64)??!1,this.rawStrings=(t==null?void 0:t.rawStrings)??!1,this.maxStrLength=(t==null?void 0:t.maxStrLength)??cr,this.maxBinLength=(t==null?void 0:t.maxBinLength)??cr,this.maxArrayLength=(t==null?void 0:t.maxArrayLength)??cr,this.maxMapLength=(t==null?void 0:t.maxMapLength)??cr,this.maxExtLength=(t==null?void 0:t.maxExtLength)??cr,this.keyDecoder=(t==null?void 0:t.keyDecoder)!==void 0?t.keyDecoder:iy,this.mapKeyConverter=(t==null?void 0:t.mapKeyConverter)??ty}clone(){return new ua({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=lr,this.stack.reset()}setBuffer(t){const e=io(t);this.bytes=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.pos=0}appendBuffer(t){if(this.headByte===lr&&!this.hasRemaining(1))this.setBuffer(t);else{const e=this.bytes.subarray(this.pos),r=io(t),i=new Uint8Array(e.length+r.length);i.set(e),i.set(r,e.length),this.setBuffer(i)}}hasRemaining(t){return this.view.byteLength-this.pos>=t}createExtraByteError(t){const{view:e,pos:r}=this;return new RangeError(`Extra ${e.byteLength-r} of ${e.byteLength} byte(s) found at buffer[${t}]`)}decode(t){if(this.entered)return this.clone().decode(t);try{this.entered=!0,this.reinitializeState(),this.setBuffer(t);const e=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return e}finally{this.entered=!1}}*decodeMulti(t){if(this.entered){yield*this.clone().decodeMulti(t);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(t);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(t){if(this.entered)return this.clone().decodeAsync(t);try{this.entered=!0;let e=!1,r;for await(const a of t){if(e)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(a);try{r=this.doDecodeSync(),e=!0}catch(l){if(!(l instanceof RangeError))throw l}this.totalPos+=this.pos}if(e){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return r}const{headByte:i,pos:s,totalPos:o}=this;throw new RangeError(`Insufficient data in parsing ${ys(i)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(t){return this.decodeMultiAsync(t,!0)}decodeStream(t){return this.decodeMultiAsync(t,!1)}async*decodeMultiAsync(t,e){if(this.entered){yield*this.clone().decodeMultiAsync(t,e);return}try{this.entered=!0;let r=e,i=-1;for await(const s of t){if(e&&i===0)throw this.createExtraByteError(this.totalPos);this.appendBuffer(s),r&&(i=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),--i!==0;);}catch(o){if(!(o instanceof RangeError))throw o}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){e:for(;;){const t=this.readHeadByte();let e;if(t>=224)e=t-256;else if(t<192)if(t<128)e=t;else if(t<144){const i=t-128;if(i!==0){this.pushMapState(i),this.complete();continue e}else e={}}else if(t<160){const i=t-144;if(i!==0){this.pushArrayState(i),this.complete();continue e}else e=[]}else{const i=t-160;e=this.decodeString(i,0)}else if(t===192)e=null;else if(t===194)e=!1;else if(t===195)e=!0;else if(t===202)e=this.readF32();else if(t===203)e=this.readF64();else if(t===204)e=this.readU8();else if(t===205)e=this.readU16();else if(t===206)e=this.readU32();else if(t===207)this.useBigInt64?e=this.readU64AsBigInt():e=this.readU64();else if(t===208)e=this.readI8();else if(t===209)e=this.readI16();else if(t===210)e=this.readI32();else if(t===211)this.useBigInt64?e=this.readI64AsBigInt():e=this.readI64();else if(t===217){const i=this.lookU8();e=this.decodeString(i,1)}else if(t===218){const i=this.lookU16();e=this.decodeString(i,2)}else if(t===219){const i=this.lookU32();e=this.decodeString(i,4)}else if(t===220){const i=this.readU16();if(i!==0){this.pushArrayState(i),this.complete();continue e}else e=[]}else if(t===221){const i=this.readU32();if(i!==0){this.pushArrayState(i),this.complete();continue e}else e=[]}else if(t===222){const i=this.readU16();if(i!==0){this.pushMapState(i),this.complete();continue e}else e={}}else if(t===223){const i=this.readU32();if(i!==0){this.pushMapState(i),this.complete();continue e}else e={}}else if(t===196){const i=this.lookU8();e=this.decodeBinary(i,1)}else if(t===197){const i=this.lookU16();e=this.decodeBinary(i,2)}else if(t===198){const i=this.lookU32();e=this.decodeBinary(i,4)}else if(t===212)e=this.decodeExtension(1,0);else if(t===213)e=this.decodeExtension(2,0);else if(t===214)e=this.decodeExtension(4,0);else if(t===215)e=this.decodeExtension(8,0);else if(t===216)e=this.decodeExtension(16,0);else if(t===199){const i=this.lookU8();e=this.decodeExtension(i,1)}else if(t===200){const i=this.lookU16();e=this.decodeExtension(i,2)}else if(t===201){const i=this.lookU32();e=this.decodeExtension(i,4)}else throw new tt(`Unrecognized type byte: ${ys(t)}`);this.complete();const r=this.stack;for(;r.length>0;){const i=r.top();if(i.type===so)if(i.array[i.position]=e,i.position++,i.position===i.size)e=i.array,r.release(i);else continue e;else if(i.type===Tr){if(e==="__proto__")throw new tt("The key __proto__ is not allowed");i.key=this.mapKeyConverter(e),i.type=fh;continue e}else if(i.map[i.key]=e,i.readCount++,i.readCount===i.size)e=i.map,r.release(i);else{i.key=null,i.type=Tr;continue e}}return e}}readHeadByte(){return this.headByte===lr&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=lr}readArraySize(){const t=this.readHeadByte();switch(t){case 220:return this.readU16();case 221:return this.readU32();default:{if(t<160)return t-144;throw new tt(`Unrecognized array type byte: ${ys(t)}`)}}}pushMapState(t){if(t>this.maxMapLength)throw new tt(`Max length exceeded: map length (${t}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(t)}pushArrayState(t){if(t>this.maxArrayLength)throw new tt(`Max length exceeded: array length (${t}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(t)}decodeString(t,e){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(t,e):this.decodeBinary(t,e)}decodeUtf8String(t,e){var s;if(t>this.maxStrLength)throw new tt(`Max length exceeded: UTF-8 byte length (${t}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+e+t)throw Ec;const r=this.pos+e;let i;return this.stateIsMapKey()&&((s=this.keyDecoder)!=null&&s.canBeCached(t))?i=this.keyDecoder.decode(this.bytes,r,t):i=Um(this.bytes,r,t),this.pos+=e+t,i}stateIsMapKey(){return this.stack.length>0?this.stack.top().type===Tr:!1}decodeBinary(t,e){if(t>this.maxBinLength)throw new tt(`Max length exceeded: bin length (${t}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(t+e))throw Ec;const r=this.pos+e,i=this.bytes.subarray(r,r+t);return this.pos+=e+t,i}decodeExtension(t,e){if(t>this.maxExtLength)throw new tt(`Max length exceeded: ext length (${t}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+e),i=this.decodeBinary(t,e+1);return this.extensionCodec.decode(i,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const t=this.view.getUint8(this.pos);return this.pos++,t}readI8(){const t=this.view.getInt8(this.pos);return this.pos++,t}readU16(){const t=this.view.getUint16(this.pos);return this.pos+=2,t}readI16(){const t=this.view.getInt16(this.pos);return this.pos+=2,t}readU32(){const t=this.view.getUint32(this.pos);return this.pos+=4,t}readI32(){const t=this.view.getInt32(this.pos);return this.pos+=4,t}readU64(){const t=Bm(this.view,this.pos);return this.pos+=8,t}readI64(){const t=dh(this.view,this.pos);return this.pos+=8,t}readU64AsBigInt(){const t=this.view.getBigUint64(this.pos);return this.pos+=8,t}readI64AsBigInt(){const t=this.view.getBigInt64(this.pos);return this.pos+=8,t}readF32(){const t=this.view.getFloat32(this.pos);return this.pos+=4,t}readF64(){const t=this.view.getFloat64(this.pos);return this.pos+=8,t}}function sy(n,t){return new ua(t).decode(n)}/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function oy(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function ph(n,t){return Array.isArray(t)?t.length===0?!0:n?t.every(e=>typeof e=="string"):t.every(e=>Number.isSafeInteger(e)):!1}function Si(n,t){if(typeof t!="string")throw new Error(`${n}: string expected`);return!0}function ha(n){if(!Number.isSafeInteger(n))throw new Error(`invalid integer: ${n}`)}function oo(n){if(!Array.isArray(n))throw new Error("array expected")}function Ci(n,t){if(!ph(!0,t))throw new Error(`${n}: array of strings expected`)}function ay(n,t){if(!ph(!1,t))throw new Error(`${n}: array of numbers expected`)}function cy(...n){const t=s=>s,e=(s,o)=>a=>s(o(a)),r=n.map(s=>s.encode).reduceRight(e,t),i=n.map(s=>s.decode).reduce(e,t);return{encode:r,decode:i}}function ly(n){const t=typeof n=="string"?n.split(""):n,e=t.length;Ci("alphabet",t);const r=new Map(t.map((i,s)=>[i,s]));return{encode:i=>(oo(i),i.map(s=>{if(!Number.isSafeInteger(s)||s<0||s>=e)throw new Error(`alphabet.encode: digit index outside alphabet "${s}". Allowed: ${n}`);return t[s]})),decode:i=>(oo(i),i.map(s=>{Si("alphabet.decode",s);const o=r.get(s);if(o===void 0)throw new Error(`Unknown letter: "${s}". Allowed: ${n}`);return o}))}}function uy(n=""){return Si("join",n),{encode:t=>(Ci("join.decode",t),t.join(n)),decode:t=>(Si("join.decode",t),t.split(n))}}function hy(n,t="="){return ha(n),Si("padding",t),{encode(e){for(Ci("padding.encode",e);e.length*n%8;)e.push(t);return e},decode(e){Ci("padding.decode",e);let r=e.length;if(r*n%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&e[r-1]===t;r--)if((r-1)*n%8===0)throw new Error("padding: invalid, string has too much padding");return e.slice(0,r)}}}const _h=(n,t)=>t===0?n:_h(t,n%t),$i=(n,t)=>n+(t-_h(n,t)),gs=(()=>{let n=[];for(let t=0;t<40;t++)n.push(2**t);return n})();function vc(n,t,e,r){if(oo(n),t<=0||t>32)throw new Error(`convertRadix2: wrong from=${t}`);if(e<=0||e>32)throw new Error(`convertRadix2: wrong to=${e}`);if($i(t,e)>32)throw new Error(`convertRadix2: carry overflow from=${t} to=${e} carryBits=${$i(t,e)}`);let i=0,s=0;const o=gs[t],a=gs[e]-1,l=[];for(const u of n){if(ha(u),u>=o)throw new Error(`convertRadix2: invalid data word=${u} from=${t}`);if(i=i<<t|u,s+t>32)throw new Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=e;s-=e)l.push((i>>s-e&a)>>>0);const h=gs[s];if(h===void 0)throw new Error("invalid carry");i&=h-1}if(i=i<<e-s&a,!r&&s>=t)throw new Error("Excess padding");if(!r&&i>0)throw new Error(`Non-zero padding: ${i}`);return r&&s>0&&l.push(i>>>0),l}function dy(n,t=!1){if(ha(n),n<=0||n>32)throw new Error("radix2: bits should be in (0..32]");if($i(8,n)>32||$i(n,8)>32)throw new Error("radix2: carry overflow");return{encode:e=>{if(!oy(e))throw new Error("radix2.encode input should be Uint8Array");return vc(Array.from(e),8,n,!t)},decode:e=>(ay("radix2.decode",e),Uint8Array.from(vc(e,n,8,t)))}}const fy=cy(dy(5),ly("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),hy(5),uy(""));function da(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function wh(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?da(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function Pr(n,t){t||(t=n.reduce((i,s)=>i+s.length,0));const e=wh(t);let r=0;for(const i of n)e.set(i,r),r+=i.length;return da(e)}function mh(n,t,e,r){return{name:n,prefix:t,encoder:{name:n,prefix:t,encode:e},decoder:{decode:r}}}const bc=mh("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),Es=mh("ascii","a",n=>{let t="a";for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return t},n=>{n=n.substring(1);const t=wh(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return t}),yh={utf8:bc,"utf-8":bc,hex:Ba.base16,latin1:Es,ascii:Es,binary:Es,...Ba};function ut(n,t="utf8"){const e=yh[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?da(globalThis.Buffer.from(n,"utf-8")):e.decoder.decode(`${e.prefix}${n}`)}function Qe(n,t="utf8"){const e=yh[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("utf8"):e.encoder.encode(n).substring(1)}const py="Input must be an string, Buffer or Uint8Array";function _y(n){let t;if(n instanceof Uint8Array)t=n;else if(typeof n=="string")t=new TextEncoder().encode(n);else throw new Error(py);return t}function wy(n){return Array.prototype.map.call(n,function(t){return(t<16?"0":"")+t.toString(16)}).join("")}function ii(n){return(4294967296+n).toString(16).substring(1)}function my(n,t,e){let r=`
|
|
5
|
-
`+n+" = ";for(let i=0;i<t.length;i+=2){if(e===32)r+=ii(t[i]).toUpperCase(),r+=" ",r+=ii(t[i+1]).toUpperCase();else if(e===64)r+=ii(t[i+1]).toUpperCase(),r+=ii(t[i]).toUpperCase();else throw new Error("Invalid size "+e);i%6===4?r+=`
|
|
6
|
-
`+new Array(n.length+4).join(" "):i<t.length-2&&(r+=" ")}console.log(r)}function yy(n,t,e){let r=new Date().getTime();const i=new Uint8Array(t);for(let o=0;o<t;o++)i[o]=o%256;const s=new Date().getTime();console.log("Generated random input in "+(s-r)+"ms"),r=s;for(let o=0;o<e;o++){const a=n(i),l=new Date().getTime(),u=l-r;r=l,console.log("Hashed in "+u+"ms: "+a.substring(0,20)+"..."),console.log(Math.round(t/(1<<20)/(u/1e3)*100)/100+" MB PER SECOND")}}var gh={normalizeInput:_y,toHex:wy,debugPrint:my,testSpeed:yy};const wi=gh;function si(n,t,e){const r=n[t]+n[e];let i=n[t+1]+n[e+1];r>=4294967296&&i++,n[t]=r,n[t+1]=i}function Ic(n,t,e,r){let i=n[t]+e;e<0&&(i+=4294967296);let s=n[t+1]+r;i>=4294967296&&s++,n[t]=i,n[t+1]=s}function Eh(n,t){return n[t]^n[t+1]<<8^n[t+2]<<16^n[t+3]<<24}function Gt(n,t,e,r,i,s){const o=vr[i],a=vr[i+1],l=vr[s],u=vr[s+1];si(W,n,t),Ic(W,n,o,a);let h=W[r]^W[n],d=W[r+1]^W[n+1];W[r]=d,W[r+1]=h,si(W,e,r),h=W[t]^W[e],d=W[t+1]^W[e+1],W[t]=h>>>24^d<<8,W[t+1]=d>>>24^h<<8,si(W,n,t),Ic(W,n,l,u),h=W[r]^W[n],d=W[r+1]^W[n+1],W[r]=h>>>16^d<<16,W[r+1]=d>>>16^h<<16,si(W,e,r),h=W[t]^W[e],d=W[t+1]^W[e+1],W[t]=d>>>31^h<<1,W[t+1]=h>>>31^d<<1}const vh=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),gy=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3],De=new Uint8Array(gy.map(function(n){return n*2})),W=new Uint32Array(32),vr=new Uint32Array(32);function bh(n,t){let e=0;for(e=0;e<16;e++)W[e]=n.h[e],W[e+16]=vh[e];for(W[24]=W[24]^n.t,W[25]=W[25]^n.t/4294967296,t&&(W[28]=~W[28],W[29]=~W[29]),e=0;e<32;e++)vr[e]=Eh(n.b,4*e);for(e=0;e<12;e++)Gt(0,8,16,24,De[e*16+0],De[e*16+1]),Gt(2,10,18,26,De[e*16+2],De[e*16+3]),Gt(4,12,20,28,De[e*16+4],De[e*16+5]),Gt(6,14,22,30,De[e*16+6],De[e*16+7]),Gt(0,10,20,30,De[e*16+8],De[e*16+9]),Gt(2,12,22,24,De[e*16+10],De[e*16+11]),Gt(4,14,16,26,De[e*16+12],De[e*16+13]),Gt(6,8,18,28,De[e*16+14],De[e*16+15]);for(e=0;e<16;e++)n.h[e]=n.h[e]^W[e]^W[e+16]}const Zt=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function Ih(n,t,e,r){if(n===0||n>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(e&&e.length!==16)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(r&&r.length!==16)throw new Error("Illegal personal, expected Uint8Array with length is 16");const i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:n};Zt.fill(0),Zt[0]=n,t&&(Zt[1]=t.length),Zt[2]=1,Zt[3]=1,e&&Zt.set(e,32),r&&Zt.set(r,48);for(let s=0;s<16;s++)i.h[s]=vh[s]^Eh(Zt,s*4);return t&&(fa(i,t),i.c=128),i}function fa(n,t){for(let e=0;e<t.length;e++)n.c===128&&(n.t+=n.c,bh(n,!1),n.c=0),n.b[n.c++]=t[e]}function Ah(n){for(n.t+=n.c;n.c<128;)n.b[n.c++]=0;bh(n,!0);const t=new Uint8Array(n.outlen);for(let e=0;e<n.outlen;e++)t[e]=n.h[e>>2]>>8*(e&3);return t}function Th(n,t,e,r,i){e=e||64,n=wi.normalizeInput(n),r&&(r=wi.normalizeInput(r)),i&&(i=wi.normalizeInput(i));const s=Ih(e,t,r,i);return fa(s,n),Ah(s)}function Ey(n,t,e,r,i){const s=Th(n,t,e,r,i);return wi.toHex(s)}var vy={blake2b:Th,blake2bHex:Ey,blake2bInit:Ih,blake2bUpdate:fa,blake2bFinal:Ah};const Ph=gh;function by(n,t){return n[t]^n[t+1]<<8^n[t+2]<<16^n[t+3]<<24}function Yt(n,t,e,r,i,s){ee[n]=ee[n]+ee[t]+i,ee[r]=oi(ee[r]^ee[n],16),ee[e]=ee[e]+ee[r],ee[t]=oi(ee[t]^ee[e],12),ee[n]=ee[n]+ee[t]+s,ee[r]=oi(ee[r]^ee[n],8),ee[e]=ee[e]+ee[r],ee[t]=oi(ee[t]^ee[e],7)}function oi(n,t){return n>>>t^n<<32-t}const Oh=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),xe=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),ee=new Uint32Array(16),Ie=new Uint32Array(16);function Rh(n,t){let e=0;for(e=0;e<8;e++)ee[e]=n.h[e],ee[e+8]=Oh[e];for(ee[12]^=n.t,ee[13]^=n.t/4294967296,t&&(ee[14]=~ee[14]),e=0;e<16;e++)Ie[e]=by(n.b,4*e);for(e=0;e<10;e++)Yt(0,4,8,12,Ie[xe[e*16+0]],Ie[xe[e*16+1]]),Yt(1,5,9,13,Ie[xe[e*16+2]],Ie[xe[e*16+3]]),Yt(2,6,10,14,Ie[xe[e*16+4]],Ie[xe[e*16+5]]),Yt(3,7,11,15,Ie[xe[e*16+6]],Ie[xe[e*16+7]]),Yt(0,5,10,15,Ie[xe[e*16+8]],Ie[xe[e*16+9]]),Yt(1,6,11,12,Ie[xe[e*16+10]],Ie[xe[e*16+11]]),Yt(2,7,8,13,Ie[xe[e*16+12]],Ie[xe[e*16+13]]),Yt(3,4,9,14,Ie[xe[e*16+14]],Ie[xe[e*16+15]]);for(e=0;e<8;e++)n.h[e]^=ee[e]^ee[e+8]}function Lh(n,t){if(!(n>0&&n<=32))throw new Error("Incorrect output length, should be in [1, 32]");const e=t?t.length:0;if(t&&!(e>0&&e<=32))throw new Error("Incorrect key length, should be in [1, 32]");const r={h:new Uint32Array(Oh),b:new Uint8Array(64),c:0,t:0,outlen:n};return r.h[0]^=16842752^e<<8^n,e>0&&(pa(r,t),r.c=64),r}function pa(n,t){for(let e=0;e<t.length;e++)n.c===64&&(n.t+=n.c,Rh(n,!1),n.c=0),n.b[n.c++]=t[e]}function Dh(n){for(n.t+=n.c;n.c<64;)n.b[n.c++]=0;Rh(n,!0);const t=new Uint8Array(n.outlen);for(let e=0;e<n.outlen;e++)t[e]=n.h[e>>2]>>8*(e&3)&255;return t}function xh(n,t,e){e=e||32,n=Ph.normalizeInput(n);const r=Lh(e,t);return pa(r,n),Dh(r)}function Iy(n,t,e){const r=xh(n,t,e);return Ph.toHex(r)}var Ay={blake2s:xh,blake2sHex:Iy,blake2sInit:Lh,blake2sUpdate:pa,blake2sFinal:Dh};const ur=vy,hr=Ay;var Ty={blake2b:ur.blake2b,blake2bHex:ur.blake2bHex,blake2bInit:ur.blake2bInit,blake2bUpdate:ur.blake2bUpdate,blake2bFinal:ur.blake2bFinal,blake2s:hr.blake2s,blake2sHex:hr.blake2sHex,blake2sInit:hr.blake2sInit,blake2sUpdate:hr.blake2sUpdate,blake2sFinal:hr.blake2sFinal},Py={};const Oy=":";function mi(n){const[t,e]=n.split(Oy);return{namespace:t,reference:e}}function Vh(n,t){return n.includes(":")?[n]:t.chains||[]}var Ry=Object.defineProperty,Ly=Object.defineProperties,Dy=Object.getOwnPropertyDescriptors,Ac=Object.getOwnPropertySymbols,xy=Object.prototype.hasOwnProperty,Vy=Object.prototype.propertyIsEnumerable,ao=(n,t,e)=>t in n?Ry(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Tc=(n,t)=>{for(var e in t||(t={}))xy.call(t,e)&&ao(n,e,t[e]);if(Ac)for(var e of Ac(t))Vy.call(t,e)&&ao(n,e,t[e]);return n},Sy=(n,t)=>Ly(n,Dy(t)),Pc=(n,t,e)=>ao(n,typeof t!="symbol"?t+"":t,e);const Cy="ReactNative",nt={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},$y="js";function Ui(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function fn(){return!Hn()&&!!uu()&&navigator.product===Cy}function Uy(){return fn()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="android"}function ky(){return fn()&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"&&(global==null?void 0:global.Platform.OS)==="ios"}function nr(){return!Ui()&&!!uu()&&!!Hn()}function Wr(){return fn()?nt.reactNative:Ui()?nt.node:nr()?nt.browser:nt.unknown}function Oc(){var n;try{return fn()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(n=global.Application)==null?void 0:n.applicationId:void 0}catch{return}}function By(n,t){const e=new URLSearchParams(n);for(const r of Object.keys(t).sort())if(t.hasOwnProperty(r)){const i=t[r];i!==void 0&&e.set(r,i)}return e.toString()}function Ny(n){var t,e;const r=Sh();try{return n!=null&&n.url&&r.url&&new URL(n.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${n.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),n.url=r.url),(t=n==null?void 0:n.icons)!=null&&t.length&&n.icons.length>0&&(n.icons=n.icons.filter(i=>i!=="")),Sy(Tc(Tc({},r),n),{url:(n==null?void 0:n.url)||r.url,name:(n==null?void 0:n.name)||r.name,description:(n==null?void 0:n.description)||r.description,icons:(e=n==null?void 0:n.icons)!=null&&e.length&&n.icons.length>0?n.icons:r.icons})}catch(i){return console.warn("Error populating app metadata",i),n||r}}function Sh(){return Wf()||{name:"",description:"",url:"",icons:[""]}}function My(){if(Wr()===nt.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:e,Version:r}=global.Platform;return[e,r].join("-")}const n=Zf();if(n===null)return"unknown";const t=n.os?n.os.replace(" ","").toLowerCase():"unknown";return n.type==="browser"?[t,n.name,n.version].join("-"):[t,n.version].join("-")}function qy(){var n;const t=Wr();return t===nt.browser?[t,((n=Yf())==null?void 0:n.host)||"unknown"].join(":"):t}function Ch(n,t,e){const r=My(),i=qy();return[[n,t].join("-"),[$y,e].join("-"),r,i].join("/")}function zy({protocol:n,version:t,relayUrl:e,sdkVersion:r,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:l}){const u=e.split("?"),h=Ch(n,t,r),d={auth:i,ua:h,projectId:s,useOnCloseEvent:o,packageName:l||void 0,bundleId:a||void 0},f=By(u[1]||"",d);return u[0]+"?"+f}function bn(n,t){return n.filter(e=>t.includes(e)).length===n.length}function co(n){return Object.fromEntries(n.entries())}function lo(n){return new Map(Object.entries(n))}function yn(n=q.FIVE_MINUTES,t){const e=q.toMiliseconds(n||q.FIVE_MINUTES);let r,i,s,o;return{resolve:a=>{s&&r&&(clearTimeout(s),r(a),o=Promise.resolve(a))},reject:a=>{s&&i&&(clearTimeout(s),i(a))},done:()=>new Promise((a,l)=>{if(o)return a(o);s=setTimeout(()=>{const u=new Error(t);o=Promise.reject(u),l(u)},e),r=a,i=l})}}function Rt(n,t,e){return new Promise(async(r,i)=>{const s=setTimeout(()=>i(new Error(e)),t);try{const o=await n;r(o)}catch(o){i(o)}clearTimeout(s)})}function $h(n,t){if(typeof t=="string"&&t.startsWith(`${n}:`))return t;if(n.toLowerCase()==="topic"){if(typeof t!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}else if(n.toLowerCase()==="id"){if(typeof t!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw new Error(`Unknown expirer target type: ${n}`)}function jy(n){return $h("topic",n)}function Ky(n){return $h("id",n)}function Uh(n){const[t,e]=n.split(":"),r={id:void 0,topic:void 0};if(t==="topic"&&typeof e=="string")r.topic=e;else if(t==="id"&&Number.isInteger(Number(e)))r.id=Number(e);else throw new Error(`Invalid target, expected id:number or topic:string, got ${t}:${e}`);return r}function _e(n,t){return q.fromMiliseconds(Date.now()+q.toMiliseconds(n))}function on(n){return Date.now()>=q.toMiliseconds(n)}function ne(n,t){return`${n}${t?`:${t}`:""}`}function On(n=[],t=[]){return[...new Set([...n,...t])]}async function Fy({id:n,topic:t,wcDeepLink:e}){var r;try{if(!e)return;const i=typeof e=="string"?JSON.parse(e):e,s=i==null?void 0:i.href;if(typeof s!="string")return;const o=Hy(s,n,t),a=Wr();if(a===nt.browser){if(!((r=Hn())!=null&&r.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}Wy(o)}else a===nt.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(o)}catch(i){console.error(i)}}function Hy(n,t,e){const r=`requestId=${t}&sessionTopic=${e}`;n.endsWith("/")&&(n=n.slice(0,-1));let i=`${n}`;if(n.startsWith("https://t.me")){const s=n.includes("?")?"&startapp=":"?startapp=";i=`${i}${s}${Jy(r,!0)}`}else i=`${i}/wc?${r}`;return i}function Wy(n){let t="_self";Yy()?t="_top":(Zy()||n.startsWith("https://")||n.startsWith("http://"))&&(t="_blank"),window.open(n,t,"noreferrer noopener")}async function Gy(n,t){let e="";try{if(nr()&&(e=localStorage.getItem(t),e))return e;e=await n.getItem(t)}catch(r){console.error(r)}return e}function Rc(n,t){if(!n.includes(t))return null;const e=n.split(/([&,?,=])/),r=e.indexOf(t);return e[r+2]}function Lc(){return typeof crypto<"u"&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,n=>{const t=Math.random()*16|0;return(n==="x"?t:t&3|8).toString(16)})}function _a(){return typeof process<"u"&&Py.IS_VITEST==="true"}function Zy(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function Yy(){try{return window.self!==window.top}catch{return!1}}function Jy(n,t=!1){const e=Buffer.from(n).toString("base64");return t?e.replace(/[=]/g,""):e}function kh(n){return Buffer.from(n,"base64").toString("utf-8")}function Qy(n){return new Promise(t=>setTimeout(t,n))}let Xy=class{constructor({limit:t}){Pc(this,"limit"),Pc(this,"set"),this.limit=t,this.set=new Set}add(t){if(!this.set.has(t)){if(this.set.size>=this.limit){const e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(t)}}has(t){return this.set.has(t)}};const ai=BigInt(2**32-1),Dc=BigInt(32);function Bh(n,t=!1){return t?{h:Number(n&ai),l:Number(n>>Dc&ai)}:{h:Number(n>>Dc&ai)|0,l:Number(n&ai)|0}}function Nh(n,t=!1){const e=n.length;let r=new Uint32Array(e),i=new Uint32Array(e);for(let s=0;s<e;s++){const{h:o,l:a}=Bh(n[s],t);[r[s],i[s]]=[o,a]}return[r,i]}const xc=(n,t,e)=>n>>>e,Vc=(n,t,e)=>n<<32-e|t>>>e,an=(n,t,e)=>n>>>e|t<<32-e,cn=(n,t,e)=>n<<32-e|t>>>e,br=(n,t,e)=>n<<64-e|t>>>e-32,Ir=(n,t,e)=>n>>>e-32|t<<64-e,eg=(n,t)=>t,tg=(n,t)=>n,ng=(n,t,e)=>n<<e|t>>>32-e,rg=(n,t,e)=>t<<e|n>>>32-e,ig=(n,t,e)=>t<<e-32|n>>>64-e,sg=(n,t,e)=>n<<e-32|t>>>64-e;function _t(n,t,e,r){const i=(t>>>0)+(r>>>0);return{h:n+e+(i/2**32|0)|0,l:i|0}}const wa=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),ma=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,og=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),ag=(n,t,e,r,i)=>t+e+r+i+(n/2**32|0)|0,cg=(n,t,e,r,i)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(i>>>0),lg=(n,t,e,r,i,s)=>t+e+r+i+s+(n/2**32|0)|0,Nn=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function ya(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function jt(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function ht(n,...t){if(!ya(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function ga(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");jt(n.outputLen),jt(n.blockLen)}function dn(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function Ea(n,t){ht(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Nr(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function dt(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function vs(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function bt(n,t){return n<<32-t|n>>>t}const Mh=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function qh(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}const Ut=Mh?n=>n:n=>qh(n);function ug(n){for(let t=0;t<n.length;t++)n[t]=qh(n[t]);return n}const ln=Mh?n=>n:ug,zh=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",hg=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function Mr(n){if(ht(n),zh)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=hg[n[e]];return t}const Ct={_0:48,_9:57,A:65,F:70,a:97,f:102};function Sc(n){if(n>=Ct._0&&n<=Ct._9)return n-Ct._0;if(n>=Ct.A&&n<=Ct.F)return n-(Ct.A-10);if(n>=Ct.a&&n<=Ct.f)return n-(Ct.a-10)}function va(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(zh)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let i=0,s=0;i<e;i++,s+=2){const o=Sc(n.charCodeAt(s)),a=Sc(n.charCodeAt(s+1));if(o===void 0||a===void 0){const l=n[s]+n[s+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+s)}r[i]=o*16+a}return r}function dg(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function yt(n){return typeof n=="string"&&(n=dg(n)),ht(n),n}function In(...n){let t=0;for(let r=0;r<n.length;r++){const i=n[r];ht(i),t+=i.length}const e=new Uint8Array(t);for(let r=0,i=0;r<n.length;r++){const s=n[r];e.set(s,i),i+=s.length}return e}class Zi{}function Gr(n){const t=r=>n().update(yt(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function fg(n){const t=(r,i)=>n(i).update(yt(r)).digest(),e=n({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}function rr(n=32){if(Nn&&typeof Nn.getRandomValues=="function")return Nn.getRandomValues(new Uint8Array(n));if(Nn&&typeof Nn.randomBytes=="function")return Uint8Array.from(Nn.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}const pg=BigInt(0),dr=BigInt(1),_g=BigInt(2),wg=BigInt(7),mg=BigInt(256),yg=BigInt(113),jh=[],Kh=[],Fh=[];for(let n=0,t=dr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],jh.push(2*(5*r+e)),Kh.push((n+1)*(n+2)/2%64);let i=pg;for(let s=0;s<7;s++)t=(t<<dr^(t>>wg)*yg)%mg,t&_g&&(i^=dr<<(dr<<BigInt(s))-dr);Fh.push(i)}const Hh=Nh(Fh,!0),gg=Hh[0],Eg=Hh[1],Cc=(n,t,e)=>e>32?ig(n,t,e):ng(n,t,e),$c=(n,t,e)=>e>32?sg(n,t,e):rg(n,t,e);function vg(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,l=(o+2)%10,u=e[l],h=e[l+1],d=Cc(u,h,1)^e[a],f=$c(u,h,1)^e[a+1];for(let p=0;p<50;p+=10)n[o+p]^=d,n[o+p+1]^=f}let i=n[2],s=n[3];for(let o=0;o<24;o++){const a=Kh[o],l=Cc(i,s,a),u=$c(i,s,a),h=jh[o];i=n[h],s=n[h+1],n[h]=l,n[h+1]=u}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)e[a]=n[o+a];for(let a=0;a<10;a++)n[o+a]^=~e[(a+2)%10]&e[(a+4)%10]}n[0]^=gg[r],n[1]^=Eg[r]}dt(e)}let bg=class Wh extends Zi{constructor(t,e,r,i=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=i,this.rounds=s,jt(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Nr(this.state)}clone(){return this._cloneInto()}keccak(){ln(this.state32),vg(this.state32,this.rounds),ln(this.state32),this.posOut=0,this.pos=0}update(t){dn(this),t=yt(t),ht(t);const{blockLen:e,state:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(e-this.pos,i-s);for(let a=0;a<o;a++)r[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:i}=this;t[r]^=e,e&128&&r===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){dn(this,!1),ht(t),this.finish();const e=this.state,{blockLen:r}=this;for(let i=0,s=t.length;i<s;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,s-i);t.set(e.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return jt(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ea(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,dt(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:i,rounds:s,enableXOF:o}=this;return t||(t=new Wh(e,r,i,o,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}};const Ig=(n,t,e)=>Gr(()=>new bg(t,n,e)),Ag=Ig(1,136,256/8);function Tg(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),a=Number(e&s),l=r?4:0,u=r?0:4;n.setUint32(t+l,o,r),n.setUint32(t+u,a,r)}function Pg(n,t,e){return n&t^~n&e}function Og(n,t,e){return n&t^n&e^t&e}let Gh=class extends Zi{constructor(t,e,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(t),this.view=vs(this.buffer)}update(t){dn(this),t=yt(t),ht(t);const{view:e,buffer:r,blockLen:i}=this,s=t.length;for(let o=0;o<s;){const a=Math.min(i-this.pos,s-o);if(a===i){const l=vs(t);for(;i<=s-o;o+=i)this.process(l,o);continue}r.set(t.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){dn(this),Ea(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:i,isLE:s}=this;let{pos:o}=this;e[o++]=128,dt(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let d=o;d<i;d++)e[d]=0;Tg(r,i-8,BigInt(this.length*8),s),this.process(r,0);const a=vs(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=l/4,h=this.get();if(u>h.length)throw new Error("_sha2: outputLen bigger than state");for(let d=0;d<u;d++)a.setUint32(4*d,h[d],s)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:i,finished:s,destroyed:o,pos:a}=this;return t.destroyed=o,t.finished=s,t.length=i,t.pos=a,i%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}};const Jt=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ve=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),Se=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Rg=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Qt=new Uint32Array(64);let Lg=class extends Gh{constructor(t=32){super(64,t,8,!1),this.A=Jt[0]|0,this.B=Jt[1]|0,this.C=Jt[2]|0,this.D=Jt[3]|0,this.E=Jt[4]|0,this.F=Jt[5]|0,this.G=Jt[6]|0,this.H=Jt[7]|0}get(){const{A:t,B:e,C:r,D:i,E:s,F:o,G:a,H:l}=this;return[t,e,r,i,s,o,a,l]}set(t,e,r,i,s,o,a,l){this.A=t|0,this.B=e|0,this.C=r|0,this.D=i|0,this.E=s|0,this.F=o|0,this.G=a|0,this.H=l|0}process(t,e){for(let d=0;d<16;d++,e+=4)Qt[d]=t.getUint32(e,!1);for(let d=16;d<64;d++){const f=Qt[d-15],p=Qt[d-2],w=bt(f,7)^bt(f,18)^f>>>3,m=bt(p,17)^bt(p,19)^p>>>10;Qt[d]=m+Qt[d-7]+w+Qt[d-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:u,H:h}=this;for(let d=0;d<64;d++){const f=bt(a,6)^bt(a,11)^bt(a,25),p=h+f+Pg(a,l,u)+Rg[d]+Qt[d]|0,w=(bt(r,2)^bt(r,13)^bt(r,22))+Og(r,i,s)|0;h=u,u=l,l=a,a=o+p|0,o=s,s=i,i=r,r=p+w|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,u=u+this.G|0,h=h+this.H|0,this.set(r,i,s,o,a,l,u,h)}roundClean(){dt(Qt)}destroy(){this.set(0,0,0,0,0,0,0,0),dt(this.buffer)}};const Zh=Nh(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),Dg=Zh[0],xg=Zh[1],Xt=new Uint32Array(80),en=new Uint32Array(80);let ba=class extends Gh{constructor(t=64){super(128,t,16,!1),this.Ah=Se[0]|0,this.Al=Se[1]|0,this.Bh=Se[2]|0,this.Bl=Se[3]|0,this.Ch=Se[4]|0,this.Cl=Se[5]|0,this.Dh=Se[6]|0,this.Dl=Se[7]|0,this.Eh=Se[8]|0,this.El=Se[9]|0,this.Fh=Se[10]|0,this.Fl=Se[11]|0,this.Gh=Se[12]|0,this.Gl=Se[13]|0,this.Hh=Se[14]|0,this.Hl=Se[15]|0}get(){const{Ah:t,Al:e,Bh:r,Bl:i,Ch:s,Cl:o,Dh:a,Dl:l,Eh:u,El:h,Fh:d,Fl:f,Gh:p,Gl:w,Hh:m,Hl:_}=this;return[t,e,r,i,s,o,a,l,u,h,d,f,p,w,m,_]}set(t,e,r,i,s,o,a,l,u,h,d,f,p,w,m,_){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=i|0,this.Ch=s|0,this.Cl=o|0,this.Dh=a|0,this.Dl=l|0,this.Eh=u|0,this.El=h|0,this.Fh=d|0,this.Fl=f|0,this.Gh=p|0,this.Gl=w|0,this.Hh=m|0,this.Hl=_|0}process(t,e){for(let y=0;y<16;y++,e+=4)Xt[y]=t.getUint32(e),en[y]=t.getUint32(e+=4);for(let y=16;y<80;y++){const b=Xt[y-15]|0,I=en[y-15]|0,D=an(b,I,1)^an(b,I,8)^xc(b,I,7),S=cn(b,I,1)^cn(b,I,8)^Vc(b,I,7),x=Xt[y-2]|0,E=en[y-2]|0,A=an(x,E,19)^br(x,E,61)^xc(x,E,6),T=cn(x,E,19)^Ir(x,E,61)^Vc(x,E,6),P=og(S,T,en[y-7],en[y-16]),V=ag(P,D,A,Xt[y-7],Xt[y-16]);Xt[y]=V|0,en[y]=P|0}let{Ah:r,Al:i,Bh:s,Bl:o,Ch:a,Cl:l,Dh:u,Dl:h,Eh:d,El:f,Fh:p,Fl:w,Gh:m,Gl:_,Hh:g,Hl:v}=this;for(let y=0;y<80;y++){const b=an(d,f,14)^an(d,f,18)^br(d,f,41),I=cn(d,f,14)^cn(d,f,18)^Ir(d,f,41),D=d&p^~d&m,S=f&w^~f&_,x=cg(v,I,S,xg[y],en[y]),E=lg(x,g,b,D,Dg[y],Xt[y]),A=x|0,T=an(r,i,28)^br(r,i,34)^br(r,i,39),P=cn(r,i,28)^Ir(r,i,34)^Ir(r,i,39),V=r&s^r&a^s&a,O=i&o^i&l^o&l;g=m|0,v=_|0,m=p|0,_=w|0,p=d|0,w=f|0,{h:d,l:f}=_t(u|0,h|0,E|0,A|0),u=a|0,h=l|0,a=s|0,l=o|0,s=r|0,o=i|0;const R=wa(A,P,O);r=ma(R,E,T,V),i=R|0}({h:r,l:i}=_t(this.Ah|0,this.Al|0,r|0,i|0)),{h:s,l:o}=_t(this.Bh|0,this.Bl|0,s|0,o|0),{h:a,l}=_t(this.Ch|0,this.Cl|0,a|0,l|0),{h:u,l:h}=_t(this.Dh|0,this.Dl|0,u|0,h|0),{h:d,l:f}=_t(this.Eh|0,this.El|0,d|0,f|0),{h:p,l:w}=_t(this.Fh|0,this.Fl|0,p|0,w|0),{h:m,l:_}=_t(this.Gh|0,this.Gl|0,m|0,_|0),{h:g,l:v}=_t(this.Hh|0,this.Hl|0,g|0,v|0),this.set(r,i,s,o,a,l,u,h,d,f,p,w,m,_,g,v)}roundClean(){dt(Xt,en)}destroy(){dt(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Vg=class extends ba{constructor(){super(48),this.Ah=Ve[0]|0,this.Al=Ve[1]|0,this.Bh=Ve[2]|0,this.Bl=Ve[3]|0,this.Ch=Ve[4]|0,this.Cl=Ve[5]|0,this.Dh=Ve[6]|0,this.Dl=Ve[7]|0,this.Eh=Ve[8]|0,this.El=Ve[9]|0,this.Fh=Ve[10]|0,this.Fl=Ve[11]|0,this.Gh=Ve[12]|0,this.Gl=Ve[13]|0,this.Hh=Ve[14]|0,this.Hl=Ve[15]|0}};const Ce=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class Sg extends ba{constructor(){super(32),this.Ah=Ce[0]|0,this.Al=Ce[1]|0,this.Bh=Ce[2]|0,this.Bl=Ce[3]|0,this.Ch=Ce[4]|0,this.Cl=Ce[5]|0,this.Dh=Ce[6]|0,this.Dl=Ce[7]|0,this.Eh=Ce[8]|0,this.El=Ce[9]|0,this.Fh=Ce[10]|0,this.Fl=Ce[11]|0,this.Gh=Ce[12]|0,this.Gl=Ce[13]|0,this.Hh=Ce[14]|0,this.Hl=Ce[15]|0}}const Yi=Gr(()=>new Lg),Cg=Gr(()=>new ba),$g=Gr(()=>new Vg),Ug=Gr(()=>new Sg),kg=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),pe=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),z=new Uint32Array(32);function tn(n,t,e,r,i,s){const o=i[s],a=i[s+1];let l=z[2*n],u=z[2*n+1],h=z[2*t],d=z[2*t+1],f=z[2*e],p=z[2*e+1],w=z[2*r],m=z[2*r+1],_=wa(l,h,o);u=ma(_,u,d,a),l=_|0,{Dh:m,Dl:w}={Dh:m^u,Dl:w^l},{Dh:m,Dl:w}={Dh:eg(m,w),Dl:tg(m)},{h:p,l:f}=_t(p,f,m,w),{Bh:d,Bl:h}={Bh:d^p,Bl:h^f},{Bh:d,Bl:h}={Bh:an(d,h,24),Bl:cn(d,h,24)},z[2*n]=l,z[2*n+1]=u,z[2*t]=h,z[2*t+1]=d,z[2*e]=f,z[2*e+1]=p,z[2*r]=w,z[2*r+1]=m}function nn(n,t,e,r,i,s){const o=i[s],a=i[s+1];let l=z[2*n],u=z[2*n+1],h=z[2*t],d=z[2*t+1],f=z[2*e],p=z[2*e+1],w=z[2*r],m=z[2*r+1],_=wa(l,h,o);u=ma(_,u,d,a),l=_|0,{Dh:m,Dl:w}={Dh:m^u,Dl:w^l},{Dh:m,Dl:w}={Dh:an(m,w,16),Dl:cn(m,w,16)},{h:p,l:f}=_t(p,f,m,w),{Bh:d,Bl:h}={Bh:d^p,Bl:h^f},{Bh:d,Bl:h}={Bh:br(d,h,63),Bl:Ir(d,h,63)},z[2*n]=l,z[2*n+1]=u,z[2*t]=h,z[2*t+1]=d,z[2*e]=f,z[2*e+1]=p,z[2*r]=w,z[2*r+1]=m}function Bg(n,t={},e,r,i){if(jt(e),n<0||n>e)throw new Error("outputLen bigger than keyLen");const{key:s,salt:o,personalization:a}=t;if(s!==void 0&&(s.length<1||s.length>e))throw new Error("key length must be undefined or 1.."+e);if(o!==void 0&&o.length!==r)throw new Error("salt must be undefined or "+r);if(a!==void 0&&a.length!==i)throw new Error("personalization must be undefined or "+i)}class Ng extends Zi{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,jt(t),jt(e),this.blockLen=t,this.outputLen=e,this.buffer=new Uint8Array(t),this.buffer32=Nr(this.buffer)}update(t){dn(this),t=yt(t),ht(t);const{blockLen:e,buffer:r,buffer32:i}=this,s=t.length,o=t.byteOffset,a=t.buffer;for(let l=0;l<s;){this.pos===e&&(ln(i),this.compress(i,0,!1),ln(i),this.pos=0);const u=Math.min(e-this.pos,s-l),h=o+l;if(u===e&&!(h%4)&&l+u<s){const d=new Uint32Array(a,h,Math.floor((s-l)/4));ln(d);for(let f=0;l+e<s;f+=i.length,l+=e)this.length+=e,this.compress(d,f,!1);ln(d);continue}r.set(t.subarray(l,l+u),this.pos),this.pos+=u,this.length+=u,l+=u}return this}digestInto(t){dn(this),Ea(t,this);const{pos:e,buffer32:r}=this;this.finished=!0,dt(this.buffer.subarray(e)),ln(r),this.compress(r,0,!0),ln(r);const i=Nr(t);this.get().forEach((s,o)=>i[o]=Ut(s))}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){const{buffer:e,length:r,finished:i,destroyed:s,outputLen:o,pos:a}=this;return t||(t=new this.constructor({dkLen:o})),t.set(...this.get()),t.buffer.set(e),t.destroyed=s,t.finished=i,t.length=r,t.pos=a,t.outputLen=o,t}clone(){return this._cloneInto()}}class Mg extends Ng{constructor(t={}){const e=t.dkLen===void 0?64:t.dkLen;super(128,e),this.v0l=pe[0]|0,this.v0h=pe[1]|0,this.v1l=pe[2]|0,this.v1h=pe[3]|0,this.v2l=pe[4]|0,this.v2h=pe[5]|0,this.v3l=pe[6]|0,this.v3h=pe[7]|0,this.v4l=pe[8]|0,this.v4h=pe[9]|0,this.v5l=pe[10]|0,this.v5h=pe[11]|0,this.v6l=pe[12]|0,this.v6h=pe[13]|0,this.v7l=pe[14]|0,this.v7h=pe[15]|0,Bg(e,t,64,16,16);let{key:r,personalization:i,salt:s}=t,o=0;if(r!==void 0&&(r=yt(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,s!==void 0){s=yt(s);const a=Nr(s);this.v4l^=Ut(a[0]),this.v4h^=Ut(a[1]),this.v5l^=Ut(a[2]),this.v5h^=Ut(a[3])}if(i!==void 0){i=yt(i);const a=Nr(i);this.v6l^=Ut(a[0]),this.v6h^=Ut(a[1]),this.v7l^=Ut(a[2]),this.v7h^=Ut(a[3])}if(r!==void 0){const a=new Uint8Array(this.blockLen);a.set(r),this.update(a)}}get(){let{v0l:t,v0h:e,v1l:r,v1h:i,v2l:s,v2h:o,v3l:a,v3h:l,v4l:u,v4h:h,v5l:d,v5h:f,v6l:p,v6h:w,v7l:m,v7h:_}=this;return[t,e,r,i,s,o,a,l,u,h,d,f,p,w,m,_]}set(t,e,r,i,s,o,a,l,u,h,d,f,p,w,m,_){this.v0l=t|0,this.v0h=e|0,this.v1l=r|0,this.v1h=i|0,this.v2l=s|0,this.v2h=o|0,this.v3l=a|0,this.v3h=l|0,this.v4l=u|0,this.v4h=h|0,this.v5l=d|0,this.v5h=f|0,this.v6l=p|0,this.v6h=w|0,this.v7l=m|0,this.v7h=_|0}compress(t,e,r){this.get().forEach((l,u)=>z[u]=l),z.set(pe,16);let{h:i,l:s}=Bh(BigInt(this.length));z[24]=pe[8]^s,z[25]=pe[9]^i,r&&(z[28]=~z[28],z[29]=~z[29]);let o=0;const a=kg;for(let l=0;l<12;l++)tn(0,4,8,12,t,e+2*a[o++]),nn(0,4,8,12,t,e+2*a[o++]),tn(1,5,9,13,t,e+2*a[o++]),nn(1,5,9,13,t,e+2*a[o++]),tn(2,6,10,14,t,e+2*a[o++]),nn(2,6,10,14,t,e+2*a[o++]),tn(3,7,11,15,t,e+2*a[o++]),nn(3,7,11,15,t,e+2*a[o++]),tn(0,5,10,15,t,e+2*a[o++]),nn(0,5,10,15,t,e+2*a[o++]),tn(1,6,11,12,t,e+2*a[o++]),nn(1,6,11,12,t,e+2*a[o++]),tn(2,7,8,13,t,e+2*a[o++]),nn(2,7,8,13,t,e+2*a[o++]),tn(3,4,9,14,t,e+2*a[o++]),nn(3,4,9,14,t,e+2*a[o++]);this.v0l^=z[0]^z[16],this.v0h^=z[1]^z[17],this.v1l^=z[2]^z[18],this.v1h^=z[3]^z[19],this.v2l^=z[4]^z[20],this.v2h^=z[5]^z[21],this.v3l^=z[6]^z[22],this.v3h^=z[7]^z[23],this.v4l^=z[8]^z[24],this.v4h^=z[9]^z[25],this.v5l^=z[10]^z[26],this.v5h^=z[11]^z[27],this.v6l^=z[12]^z[28],this.v6h^=z[13]^z[29],this.v7l^=z[14]^z[30],this.v7h^=z[15]^z[31],dt(z)}destroy(){this.destroyed=!0,dt(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const qg=fg(n=>new Mg(n)),zg="https://rpc.walletconnect.org/v1";function Yh(n){const t=`Ethereum Signed Message:
|
|
7
|
-
${n.length}`,e=new TextEncoder().encode(t+n);return"0x"+Buffer.from(Ag(e)).toString("hex")}async function jg(n,t,e,r,i,s){switch(e.t){case"eip191":return await Kg(n,t,e.s);case"eip1271":return await Fg(n,t,e.s,r,i,s);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${e.t}`)}}async function Kg(n,t,e){return(await Im({hash:Yh(t),signature:e})).toLowerCase()===n.toLowerCase()}async function Fg(n,t,e,r,i,s){const o=mi(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",l="0000000000000000000000000000000000000000000000000000000000000040",u=e.substring(2),h=(u.length/2).toString(16).padStart(64,"0"),d=(t.startsWith("0x")?t:Yh(t)).substring(2),f=a+d+l+h+u,p=await fetch(`${s||zg}/?chainId=${r}&projectId=${i}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Hg(),jsonrpc:"2.0",method:"eth_call",params:[{to:n,data:f},"latest"]})}),{result:w}=await p.json();return w?w.slice(0,a.length).toLowerCase()===a.toLowerCase():!1}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}function Hg(){return Date.now()+Math.floor(Math.random()*1e3)}function Wg(n){const t=atob(n),e=new Uint8Array(t.length);for(let o=0;o<t.length;o++)e[o]=t.charCodeAt(o);const r=e[0];if(r===0)throw new Error("No signatures found");const i=1+r*64;if(e.length<i)throw new Error("Transaction data too short for claimed signature count");if(e.length<100)throw new Error("Transaction too short");const s=Buffer.from(n,"base64").slice(1,65);return Hr.encode(s)}function Gg(n){const t=new Uint8Array(Buffer.from(n,"base64")),e=Array.from("TransactionData::").map(s=>s.charCodeAt(0)),r=new Uint8Array(e.length+t.length);r.set(e),r.set(t,e.length);const i=qg(r,{dkLen:32});return Hr.encode(i)}function Uc(n){const t=new Uint8Array(Yi(Zg(n)));return Hr.encode(t)}function Zg(n){if(n instanceof Uint8Array)return n;if(Array.isArray(n))return new Uint8Array(n);if(typeof n=="object"&&n!=null&&n.data)return new Uint8Array(Object.values(n.data));if(typeof n=="object"&&n)return new Uint8Array(Object.values(n));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}function kc(n){const t=Buffer.from(n,"base64"),e=sy(t).txn;if(!e)throw new Error("Invalid signed transaction: missing 'txn' field");const r=Jm(e),i=Buffer.from("TX"),s=Buffer.concat([i,Buffer.from(r)]),o=Ug(s);return fy.encode(o).replace(/=+$/,"")}function bs(n){const t=[];let e=BigInt(n);for(;e>=BigInt(128);)t.push(Number(e&BigInt(127)|BigInt(128))),e>>=BigInt(7);return t.push(Number(e)),Buffer.from(t)}function Yg(n){const t=Buffer.from(n.signed.bodyBytes,"base64"),e=Buffer.from(n.signed.authInfoBytes,"base64"),r=Buffer.from(n.signature.signature,"base64"),i=[];i.push(Buffer.from([10])),i.push(bs(t.length)),i.push(t),i.push(Buffer.from([18])),i.push(bs(e.length)),i.push(e),i.push(Buffer.from([26])),i.push(bs(r.length)),i.push(r);const s=Buffer.concat(i),o=Yi(s);return Buffer.from(o).toString("hex").toUpperCase()}var Jg=Object.defineProperty,Qg=Object.defineProperties,Xg=Object.getOwnPropertyDescriptors,Bc=Object.getOwnPropertySymbols,e0=Object.prototype.hasOwnProperty,t0=Object.prototype.propertyIsEnumerable,Nc=(n,t,e)=>t in n?Jg(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,n0=(n,t)=>{for(var e in t||(t={}))e0.call(t,e)&&Nc(n,e,t[e]);if(Bc)for(var e of Bc(t))t0.call(t,e)&&Nc(n,e,t[e]);return n},r0=(n,t)=>Qg(n,Xg(t));const i0="did:pkh:",Ia=n=>n==null?void 0:n.split(":"),s0=n=>{const t=n&&Ia(n);if(t)return n.includes(i0)?t[3]:t[1]},uo=n=>{const t=n&&Ia(n);if(t)return t[2]+":"+t[3]},ki=n=>{const t=n&&Ia(n);if(t)return t.pop()};async function Mc(n){const{cacao:t,projectId:e}=n,{s:r,p:i}=t,s=Jh(i,i.iss),o=ki(i.iss);return await jg(o,s,r,uo(i.iss),e)}const Jh=(n,t)=>{const e=`${n.domain} wants you to sign in with your Ethereum account:`,r=ki(t);if(!n.aud&&!n.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=n.statement||void 0;const s=`URI: ${n.aud||n.uri}`,o=`Version: ${n.version}`,a=`Chain ID: ${s0(t)}`,l=`Nonce: ${n.nonce}`,u=`Issued At: ${n.iat}`,h=n.exp?`Expiration Time: ${n.exp}`:void 0,d=n.nbf?`Not Before: ${n.nbf}`:void 0,f=n.requestId?`Request ID: ${n.requestId}`:void 0,p=n.resources?`Resources:${n.resources.map(m=>`
|
|
8
|
-
- ${m}`).join("")}`:void 0,w=yi(n.resources);if(w){const m=qr(w);i=p0(i,m)}return[e,r,"",i,"",s,o,a,l,u,h,d,f,p].filter(m=>m!=null).join(`
|
|
9
|
-
`)};function o0(n){return Buffer.from(JSON.stringify(n)).toString("base64")}function a0(n){return JSON.parse(Buffer.from(n,"base64").toString("utf-8"))}function Dn(n){if(!n)throw new Error("No recap provided, value is undefined");if(!n.att)throw new Error("No `att` property found");const t=Object.keys(n.att);if(!(t!=null&&t.length))throw new Error("No resources found in `att` property");t.forEach(e=>{const r=n.att[e];if(Array.isArray(r))throw new Error(`Resource must be an object: ${e}`);if(typeof r!="object")throw new Error(`Resource must be an object: ${e}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${e}`);Object.keys(r).forEach(i=>{const s=r[i];if(!Array.isArray(s))throw new Error(`Ability limits ${i} must be an array of objects, found: ${s}`);if(!s.length)throw new Error(`Value of ${i} is empty array, must be an array with objects`);s.forEach(o=>{if(typeof o!="object")throw new Error(`Ability limits (${i}) must be an array of objects, found: ${o}`)})})})}function c0(n,t,e,r={}){return e==null||e.sort((i,s)=>i.localeCompare(s)),{att:{[n]:l0(t,e,r)}}}function l0(n,t,e={}){t=t==null?void 0:t.sort((i,s)=>i.localeCompare(s));const r=t.map(i=>({[`${n}/${i}`]:[e]}));return Object.assign({},...r)}function Qh(n){return Dn(n),`urn:recap:${o0(n).replace(/=/g,"")}`}function qr(n){const t=a0(n.replace("urn:recap:",""));return Dn(t),t}function u0(n,t,e){const r=c0(n,t,e);return Qh(r)}function h0(n){return n&&n.includes("urn:recap:")}function d0(n,t){const e=qr(n),r=qr(t),i=f0(e,r);return Qh(i)}function f0(n,t){Dn(n),Dn(t);const e=Object.keys(n.att).concat(Object.keys(t.att)).sort((i,s)=>i.localeCompare(s)),r={att:{}};return e.forEach(i=>{var s,o;Object.keys(((s=n.att)==null?void 0:s[i])||{}).concat(Object.keys(((o=t.att)==null?void 0:o[i])||{})).sort((a,l)=>a.localeCompare(l)).forEach(a=>{var l,u;r.att[i]=r0(n0({},r.att[i]),{[a]:((l=n.att[i])==null?void 0:l[a])||((u=t.att[i])==null?void 0:u[a])})})}),r}function p0(n="",t){Dn(t);const e="I further authorize the stated URI to perform the following actions on my behalf: ";if(n.includes(e))return n;const r=[];let i=0;Object.keys(t.att).forEach(a=>{const l=Object.keys(t.att[a]).map(d=>({ability:d.split("/")[0],action:d.split("/")[1]}));l.sort((d,f)=>d.action.localeCompare(f.action));const u={};l.forEach(d=>{u[d.ability]||(u[d.ability]=[]),u[d.ability].push(d.action)});const h=Object.keys(u).map(d=>(i++,`(${i}) '${d}': '${u[d].join("', '")}' for '${a}'.`));r.push(h.join(", ").replace(".,","."))});const s=r.join(" "),o=`${e}${s}`;return`${n?n+" ":""}${o}`}function qc(n){var t;const e=qr(n);Dn(e);const r=(t=e.att)==null?void 0:t.eip155;return r?Object.keys(r).map(i=>i.split("/")[1]):[]}function zc(n){const t=qr(n);Dn(t);const e=[];return Object.values(t.att).forEach(r=>{Object.values(r).forEach(i=>{var s;(s=i==null?void 0:i[0])!=null&&s.chains&&e.push(i[0].chains)})}),[...new Set(e.flat())]}function yi(n){if(!n)return;const t=n==null?void 0:n[n.length-1];return h0(t)?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function Xh(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function ho(n){if(typeof n!="boolean")throw new Error(`boolean expected, not ${n}`)}function Is(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function Ge(n,...t){if(!Xh(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function jc(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function _0(n,t){Ge(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function hn(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function Gn(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function w0(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}const m0=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function y0(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function fo(n){if(typeof n=="string")n=y0(n);else if(Xh(n))n=po(n);else throw new Error("Uint8Array expected, got "+typeof n);return n}function g0(n,t){if(t==null||typeof t!="object")throw new Error("options must be defined");return Object.assign(n,t)}function E0(n,t){if(n.length!==t.length)return!1;let e=0;for(let r=0;r<n.length;r++)e|=n[r]^t[r];return e===0}const v0=(n,t)=>{function e(r,...i){if(Ge(r),!m0)throw new Error("Non little-endian hardware is not yet supported");if(n.nonceLength!==void 0){const u=i[0];if(!u)throw new Error("nonce / iv required");n.varSizeNonce?Ge(u):Ge(u,n.nonceLength)}const s=n.tagLength;s&&i[1]!==void 0&&Ge(i[1]);const o=t(r,...i),a=(u,h)=>{if(h!==void 0){if(u!==2)throw new Error("cipher output not supported");Ge(h)}};let l=!1;return{encrypt(u,h){if(l)throw new Error("cannot encrypt() twice with same key + nonce");return l=!0,Ge(u),a(o.encrypt.length,h),o.encrypt(u,h)},decrypt(u,h){if(Ge(u),s&&u.length<s)throw new Error("invalid ciphertext length: smaller than tagLength="+s);return a(o.decrypt.length,h),o.decrypt(u,h)}}}return Object.assign(e,n),e};function Kc(n,t,e=!0){if(t===void 0)return new Uint8Array(n);if(t.length!==n)throw new Error("invalid output length, expected "+n+", got: "+t.length);if(e&&!I0(t))throw new Error("invalid output, must be aligned");return t}function Fc(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const i=BigInt(32),s=BigInt(4294967295),o=Number(e>>i&s),a=Number(e&s);n.setUint32(t+4,o,r),n.setUint32(t+0,a,r)}function b0(n,t,e){ho(e);const r=new Uint8Array(16),i=w0(r);return Fc(i,0,BigInt(t),e),Fc(i,8,BigInt(n),e),r}function I0(n){return n.byteOffset%4===0}function po(n){return Uint8Array.from(n)}const ed=n=>Uint8Array.from(n.split("").map(t=>t.charCodeAt(0))),A0=ed("expand 16-byte k"),T0=ed("expand 32-byte k"),P0=hn(A0),O0=hn(T0);function Q(n,t){return n<<t|n>>>32-t}function _o(n){return n.byteOffset%4===0}const ci=64,R0=16,td=2**32-1,Hc=new Uint32Array;function L0(n,t,e,r,i,s,o,a){const l=i.length,u=new Uint8Array(ci),h=hn(u),d=_o(i)&&_o(s),f=d?hn(i):Hc,p=d?hn(s):Hc;for(let w=0;w<l;o++){if(n(t,e,r,h,o,a),o>=td)throw new Error("arx: counter overflow");const m=Math.min(ci,l-w);if(d&&m===ci){const _=w/4;if(w%4!==0)throw new Error("arx: invalid block position");for(let g=0,v;g<R0;g++)v=_+g,p[v]=f[v]^h[g];w+=ci;continue}for(let _=0,g;_<m;_++)g=w+_,s[g]=i[g]^u[_];w+=m}}function D0(n,t){const{allowShortKeys:e,extendNonceFn:r,counterLength:i,counterRight:s,rounds:o}=g0({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof n!="function")throw new Error("core must be a function");return Is(i),Is(o),ho(s),ho(e),(a,l,u,h,d=0)=>{Ge(a),Ge(l),Ge(u);const f=u.length;if(h===void 0&&(h=new Uint8Array(f)),Ge(h),Is(d),d<0||d>=td)throw new Error("arx: counter overflow");if(h.length<f)throw new Error(`arx: output (${h.length}) is shorter than data (${f})`);const p=[];let w=a.length,m,_;if(w===32)p.push(m=po(a)),_=O0;else if(w===16&&e)m=new Uint8Array(32),m.set(a),m.set(a,16),_=P0,p.push(m);else throw new Error(`arx: invalid 32-byte key, got length=${w}`);_o(l)||p.push(l=po(l));const g=hn(m);if(r){if(l.length!==24)throw new Error("arx: extended nonce must be 24 bytes");r(_,g,hn(l.subarray(0,16)),g),l=l.subarray(16)}const v=16-i;if(v!==l.length)throw new Error(`arx: nonce must be ${v} or 16 bytes`);if(v!==12){const b=new Uint8Array(12);b.set(l,s?0:12-l.length),l=b,p.push(l)}const y=hn(l);return L0(n,_,g,y,u,h,d,o),Gn(...p),h}}const Ae=(n,t)=>n[t++]&255|(n[t++]&255)<<8;class x0{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=fo(t),Ge(t,32);const e=Ae(t,0),r=Ae(t,2),i=Ae(t,4),s=Ae(t,6),o=Ae(t,8),a=Ae(t,10),l=Ae(t,12),u=Ae(t,14);this.r[0]=e&8191,this.r[1]=(e>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|s<<9)&8191,this.r[4]=(s>>>4|o<<12)&255,this.r[5]=o>>>1&8190,this.r[6]=(o>>>14|a<<2)&8191,this.r[7]=(a>>>11|l<<5)&8065,this.r[8]=(l>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let h=0;h<8;h++)this.pad[h]=Ae(t,16+2*h)}process(t,e,r=!1){const i=r?0:2048,{h:s,r:o}=this,a=o[0],l=o[1],u=o[2],h=o[3],d=o[4],f=o[5],p=o[6],w=o[7],m=o[8],_=o[9],g=Ae(t,e+0),v=Ae(t,e+2),y=Ae(t,e+4),b=Ae(t,e+6),I=Ae(t,e+8),D=Ae(t,e+10),S=Ae(t,e+12),x=Ae(t,e+14);let E=s[0]+(g&8191),A=s[1]+((g>>>13|v<<3)&8191),T=s[2]+((v>>>10|y<<6)&8191),P=s[3]+((y>>>7|b<<9)&8191),V=s[4]+((b>>>4|I<<12)&8191),O=s[5]+(I>>>1&8191),R=s[6]+((I>>>14|D<<2)&8191),L=s[7]+((D>>>11|S<<5)&8191),C=s[8]+((S>>>8|x<<8)&8191),U=s[9]+(x>>>5|i),$=0,M=$+E*a+A*(5*_)+T*(5*m)+P*(5*w)+V*(5*p);$=M>>>13,M&=8191,M+=O*(5*f)+R*(5*d)+L*(5*h)+C*(5*u)+U*(5*l),$+=M>>>13,M&=8191;let B=$+E*l+A*a+T*(5*_)+P*(5*m)+V*(5*w);$=B>>>13,B&=8191,B+=O*(5*p)+R*(5*f)+L*(5*d)+C*(5*h)+U*(5*u),$+=B>>>13,B&=8191;let j=$+E*u+A*l+T*a+P*(5*_)+V*(5*m);$=j>>>13,j&=8191,j+=O*(5*w)+R*(5*p)+L*(5*f)+C*(5*d)+U*(5*h),$+=j>>>13,j&=8191;let F=$+E*h+A*u+T*l+P*a+V*(5*_);$=F>>>13,F&=8191,F+=O*(5*m)+R*(5*w)+L*(5*p)+C*(5*f)+U*(5*d),$+=F>>>13,F&=8191;let K=$+E*d+A*h+T*u+P*l+V*a;$=K>>>13,K&=8191,K+=O*(5*_)+R*(5*m)+L*(5*w)+C*(5*p)+U*(5*f),$+=K>>>13,K&=8191;let H=$+E*f+A*d+T*h+P*u+V*l;$=H>>>13,H&=8191,H+=O*a+R*(5*_)+L*(5*m)+C*(5*w)+U*(5*p),$+=H>>>13,H&=8191;let G=$+E*p+A*f+T*d+P*h+V*u;$=G>>>13,G&=8191,G+=O*l+R*a+L*(5*_)+C*(5*m)+U*(5*w),$+=G>>>13,G&=8191;let ce=$+E*w+A*p+T*f+P*d+V*h;$=ce>>>13,ce&=8191,ce+=O*u+R*l+L*a+C*(5*_)+U*(5*m),$+=ce>>>13,ce&=8191;let re=$+E*m+A*w+T*p+P*f+V*d;$=re>>>13,re&=8191,re+=O*h+R*u+L*l+C*a+U*(5*_),$+=re>>>13,re&=8191;let te=$+E*_+A*m+T*w+P*p+V*f;$=te>>>13,te&=8191,te+=O*d+R*h+L*u+C*l+U*a,$+=te>>>13,te&=8191,$=($<<2)+$|0,$=$+M|0,M=$&8191,$=$>>>13,B+=$,s[0]=M,s[1]=B,s[2]=j,s[3]=F,s[4]=K,s[5]=H,s[6]=G,s[7]=ce,s[8]=re,s[9]=te}finalize(){const{h:t,pad:e}=this,r=new Uint16Array(10);let i=t[1]>>>13;t[1]&=8191;for(let a=2;a<10;a++)t[a]+=i,i=t[a]>>>13,t[a]&=8191;t[0]+=i*5,i=t[0]>>>13,t[0]&=8191,t[1]+=i,i=t[1]>>>13,t[1]&=8191,t[2]+=i,r[0]=t[0]+5,i=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=t[a]+i,i=r[a]>>>13,r[a]&=8191;r[9]-=8192;let s=(i^1)-1;for(let a=0;a<10;a++)r[a]&=s;s=~s;for(let a=0;a<10;a++)t[a]=t[a]&s|r[a];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let o=t[0]+e[0];t[0]=o&65535;for(let a=1;a<8;a++)o=(t[a]+e[a]|0)+(o>>>16)|0,t[a]=o&65535;Gn(r)}update(t){jc(this),t=fo(t),Ge(t);const{buffer:e,blockLen:r}=this,i=t.length;for(let s=0;s<i;){const o=Math.min(r-this.pos,i-s);if(o===r){for(;r<=i-s;s+=r)this.process(t,s);continue}e.set(t.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===r&&(this.process(e,0,!1),this.pos=0)}return this}destroy(){Gn(this.h,this.r,this.buffer,this.pad)}digestInto(t){jc(this),_0(t,this),this.finished=!0;const{buffer:e,h:r}=this;let{pos:i}=this;if(i){for(e[i++]=1;i<16;i++)e[i]=0;this.process(e,0,!0)}this.finalize();let s=0;for(let o=0;o<8;o++)t[s++]=r[o]>>>0,t[s++]=r[o]>>>8;return t}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}}function V0(n){const t=(r,i)=>n(i).update(fo(r)).digest(),e=n(new Uint8Array(32));return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=r=>n(r),t}const S0=V0(n=>new x0(n));function C0(n,t,e,r,i,s=20){let o=n[0],a=n[1],l=n[2],u=n[3],h=t[0],d=t[1],f=t[2],p=t[3],w=t[4],m=t[5],_=t[6],g=t[7],v=i,y=e[0],b=e[1],I=e[2],D=o,S=a,x=l,E=u,A=h,T=d,P=f,V=p,O=w,R=m,L=_,C=g,U=v,$=y,M=b,B=I;for(let F=0;F<s;F+=2)D=D+A|0,U=Q(U^D,16),O=O+U|0,A=Q(A^O,12),D=D+A|0,U=Q(U^D,8),O=O+U|0,A=Q(A^O,7),S=S+T|0,$=Q($^S,16),R=R+$|0,T=Q(T^R,12),S=S+T|0,$=Q($^S,8),R=R+$|0,T=Q(T^R,7),x=x+P|0,M=Q(M^x,16),L=L+M|0,P=Q(P^L,12),x=x+P|0,M=Q(M^x,8),L=L+M|0,P=Q(P^L,7),E=E+V|0,B=Q(B^E,16),C=C+B|0,V=Q(V^C,12),E=E+V|0,B=Q(B^E,8),C=C+B|0,V=Q(V^C,7),D=D+T|0,B=Q(B^D,16),L=L+B|0,T=Q(T^L,12),D=D+T|0,B=Q(B^D,8),L=L+B|0,T=Q(T^L,7),S=S+P|0,U=Q(U^S,16),C=C+U|0,P=Q(P^C,12),S=S+P|0,U=Q(U^S,8),C=C+U|0,P=Q(P^C,7),x=x+V|0,$=Q($^x,16),O=O+$|0,V=Q(V^O,12),x=x+V|0,$=Q($^x,8),O=O+$|0,V=Q(V^O,7),E=E+A|0,M=Q(M^E,16),R=R+M|0,A=Q(A^R,12),E=E+A|0,M=Q(M^E,8),R=R+M|0,A=Q(A^R,7);let j=0;r[j++]=o+D|0,r[j++]=a+S|0,r[j++]=l+x|0,r[j++]=u+E|0,r[j++]=h+A|0,r[j++]=d+T|0,r[j++]=f+P|0,r[j++]=p+V|0,r[j++]=w+O|0,r[j++]=m+R|0,r[j++]=_+L|0,r[j++]=g+C|0,r[j++]=v+U|0,r[j++]=y+$|0,r[j++]=b+M|0,r[j++]=I+B|0}const $0=D0(C0,{counterRight:!1,counterLength:4,allowShortKeys:!1}),U0=new Uint8Array(16),Wc=(n,t)=>{n.update(t);const e=t.length%16;e&&n.update(U0.subarray(e))},k0=new Uint8Array(32);function Gc(n,t,e,r,i){const s=n(t,e,k0),o=S0.create(s);i&&Wc(o,i),Wc(o,r);const a=b0(r.length,i?i.length:0,!0);o.update(a);const l=o.digest();return Gn(s,a),l}const B0=n=>(t,e,r)=>({encrypt(i,s){const o=i.length;s=Kc(o+16,s,!1),s.set(i);const a=s.subarray(0,-16);n(t,e,a,a,1);const l=Gc(n,t,e,a,r);return s.set(l,o),Gn(l),s},decrypt(i,s){s=Kc(i.length-16,s,!1);const o=i.subarray(0,-16),a=i.subarray(-16),l=Gc(n,t,e,o,r);if(!E0(a,l))throw new Error("invalid tag");return s.set(i.subarray(0,-16)),n(t,e,s,s,1),Gn(l),s}}),nd=v0({blockSize:64,nonceLength:12,tagLength:16},B0($0));let rd=class extends Zi{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ga(t);const r=yt(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?t.create().update(r).digest():r);for(let o=0;o<s.length;o++)s[o]^=54;this.iHash.update(s),this.oHash=t.create();for(let o=0;o<s.length;o++)s[o]^=106;this.oHash.update(s),dt(s)}update(t){return dn(this),this.iHash.update(t),this}digestInto(t){dn(this),ht(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:i,destroyed:s,blockLen:o,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=s,t.blockLen=o,t.outputLen=a,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Ji=(n,t,e)=>new rd(n,t).update(e).digest();Ji.create=(n,t)=>new rd(n,t);function N0(n,t,e){return ga(n),e===void 0&&(e=new Uint8Array(n.outputLen)),Ji(n,yt(e),yt(t))}const As=Uint8Array.from([0]),Zc=Uint8Array.of();function M0(n,t,e,r=32){ga(n),jt(r);const i=n.outputLen;if(r>255*i)throw new Error("Length should be <= 255*HashLen");const s=Math.ceil(r/i);e===void 0&&(e=Zc);const o=new Uint8Array(s*i),a=Ji.create(n,t),l=a._cloneInto(),u=new Uint8Array(a.outputLen);for(let h=0;h<s;h++)As[0]=h+1,l.update(h===0?Zc:u).update(e).update(As).digestInto(u),o.set(u,i*h),a._cloneInto(l);return a.destroy(),l.destroy(),dt(u,As),o.slice(0,r)}const q0=(n,t,e,r,i)=>M0(n,N0(n,t,e),r,i),Qi=Yi,Aa=BigInt(0),wo=BigInt(1);function Bi(n,t){if(typeof t!="boolean")throw new Error(n+" boolean expected, got "+t)}function li(n){const t=n.toString(16);return t.length&1?"0"+t:t}function id(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Aa:BigInt("0x"+n)}function Xi(n){return id(Mr(n))}function Ni(n){return ht(n),id(Mr(Uint8Array.from(n).reverse()))}function Ta(n,t){return va(n.toString(16).padStart(t*2,"0"))}function Pa(n,t){return Ta(n,t).reverse()}function He(n,t,e){let r;if(typeof t=="string")try{r=va(t)}catch(s){throw new Error(n+" must be hex string or Uint8Array, cause: "+s)}else if(ya(t))r=Uint8Array.from(t);else throw new Error(n+" must be hex string or Uint8Array");const i=r.length;if(typeof e=="number"&&i!==e)throw new Error(n+" of length "+e+" expected, got "+i);return r}const Ts=n=>typeof n=="bigint"&&Aa<=n;function z0(n,t,e){return Ts(n)&&Ts(t)&&Ts(e)&&t<=n&&n<e}function mo(n,t,e,r){if(!z0(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function j0(n){let t;for(t=0;n>Aa;n>>=wo,t+=1);return t}const es=n=>(wo<<BigInt(n))-wo;function K0(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");const r=f=>new Uint8Array(f),i=f=>Uint8Array.of(f);let s=r(n),o=r(n),a=0;const l=()=>{s.fill(1),o.fill(0),a=0},u=(...f)=>e(o,s,...f),h=(f=r(0))=>{o=u(i(0),f),s=u(),f.length!==0&&(o=u(i(1),f),s=u())},d=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let f=0;const p=[];for(;f<t;){s=u();const w=s.slice();p.push(w),f+=s.length}return In(...p)};return(f,p)=>{l(),h(f);let w;for(;!(w=p(d()));)h();return l(),w}}function ts(n,t,e={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(i,s,o){const a=n[i];if(o&&a===void 0)return;const l=typeof a;if(l!==s||a===null)throw new Error(`param "${i}" is invalid: expected ${s}, got ${l}`)}Object.entries(t).forEach(([i,s])=>r(i,s,!1)),Object.entries(e).forEach(([i,s])=>r(i,s,!0))}function Yc(n){const t=new WeakMap;return(e,...r)=>{const i=t.get(e);if(i!==void 0)return i;const s=n(e,...r);return t.set(e,s),s}}const Je=BigInt(0),Me=BigInt(1),An=BigInt(2),F0=BigInt(3),sd=BigInt(4),od=BigInt(5),ad=BigInt(8);function lt(n,t){const e=n%t;return e>=Je?e:t+e}function pt(n,t,e){let r=n;for(;t-- >Je;)r*=r,r%=e;return r}function Jc(n,t){if(n===Je)throw new Error("invert: expected non-zero number");if(t<=Je)throw new Error("invert: expected positive modulus, got "+t);let e=lt(n,t),r=t,i=Je,s=Me;for(;e!==Je;){const o=r/e,a=r%e,l=i-s*o;r=e,e=a,i=s,s=l}if(r!==Me)throw new Error("invert: does not exist");return lt(i,t)}function cd(n,t){const e=(n.ORDER+Me)/sd,r=n.pow(t,e);if(!n.eql(n.sqr(r),t))throw new Error("Cannot find square root");return r}function H0(n,t){const e=(n.ORDER-od)/ad,r=n.mul(t,An),i=n.pow(r,e),s=n.mul(t,i),o=n.mul(n.mul(s,An),i),a=n.mul(s,n.sub(o,n.ONE));if(!n.eql(n.sqr(a),t))throw new Error("Cannot find square root");return a}function W0(n){if(n<BigInt(3))throw new Error("sqrt is not defined for small field");let t=n-Me,e=0;for(;t%An===Je;)t/=An,e++;let r=An;const i=ir(n);for(;Qc(i,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return cd;let s=i.pow(r,t);const o=(t+Me)/An;return function(a,l){if(a.is0(l))return l;if(Qc(a,l)!==1)throw new Error("Cannot find square root");let u=e,h=a.mul(a.ONE,s),d=a.pow(l,t),f=a.pow(l,o);for(;!a.eql(d,a.ONE);){if(a.is0(d))return a.ZERO;let p=1,w=a.sqr(d);for(;!a.eql(w,a.ONE);)if(p++,w=a.sqr(w),p===u)throw new Error("Cannot find square root");const m=Me<<BigInt(u-p-1),_=a.pow(h,m);u=p,h=a.sqr(_),d=a.mul(d,h),f=a.mul(f,_)}return f}}function G0(n){return n%sd===F0?cd:n%ad===od?H0:W0(n)}const Z0=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Y0(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=Z0.reduce((r,i)=>(r[i]="function",r),t);return ts(n,e),n}function J0(n,t,e){if(e<Je)throw new Error("invalid exponent, negatives unsupported");if(e===Je)return n.ONE;if(e===Me)return t;let r=n.ONE,i=t;for(;e>Je;)e&Me&&(r=n.mul(r,i)),i=n.sqr(i),e>>=Me;return r}function ld(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),i=t.reduce((o,a,l)=>n.is0(a)?o:(r[l]=o,n.mul(o,a)),n.ONE),s=n.inv(i);return t.reduceRight((o,a,l)=>n.is0(a)?o:(r[l]=n.mul(o,r[l]),n.mul(o,a)),s),r}function Qc(n,t){const e=(n.ORDER-Me)/An,r=n.pow(t,e),i=n.eql(r,n.ONE),s=n.eql(r,n.ZERO),o=n.eql(r,n.neg(n.ONE));if(!i&&!s&&!o)throw new Error("invalid Legendre symbol result");return i?1:s?0:-1}function Q0(n,t){t!==void 0&&jt(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function ir(n,t,e=!1,r={}){if(n<=Je)throw new Error("invalid field: expected ORDER > 0, got "+n);let i,s;if(typeof t=="object"&&t!=null){if(r.sqrt||e)throw new Error("cannot specify opts in two arguments");const h=t;h.BITS&&(i=h.BITS),h.sqrt&&(s=h.sqrt),typeof h.isLE=="boolean"&&(e=h.isLE)}else typeof t=="number"&&(i=t),r.sqrt&&(s=r.sqrt);const{nBitLength:o,nByteLength:a}=Q0(n,i);if(a>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let l;const u=Object.freeze({ORDER:n,isLE:e,BITS:o,BYTES:a,MASK:es(o),ZERO:Je,ONE:Me,create:h=>lt(h,n),isValid:h=>{if(typeof h!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof h);return Je<=h&&h<n},is0:h=>h===Je,isValidNot0:h=>!u.is0(h)&&u.isValid(h),isOdd:h=>(h&Me)===Me,neg:h=>lt(-h,n),eql:(h,d)=>h===d,sqr:h=>lt(h*h,n),add:(h,d)=>lt(h+d,n),sub:(h,d)=>lt(h-d,n),mul:(h,d)=>lt(h*d,n),pow:(h,d)=>J0(u,h,d),div:(h,d)=>lt(h*Jc(d,n),n),sqrN:h=>h*h,addN:(h,d)=>h+d,subN:(h,d)=>h-d,mulN:(h,d)=>h*d,inv:h=>Jc(h,n),sqrt:s||(h=>(l||(l=G0(n)),l(u,h))),toBytes:h=>e?Pa(h,a):Ta(h,a),fromBytes:h=>{if(h.length!==a)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+h.length);return e?Ni(h):Xi(h)},invertBatch:h=>ld(u,h),cmov:(h,d,f)=>f?d:h});return Object.freeze(u)}function ud(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function hd(n){const t=ud(n);return t+Math.ceil(t/2)}function X0(n,t,e=!1){const r=n.length,i=ud(t),s=hd(t);if(r<16||r<s||r>1024)throw new Error("expected "+s+"-1024 bytes of input, got "+r);const o=e?Ni(n):Xi(n),a=lt(o,t-Me)+Me;return e?Pa(a,i):Ta(a,i)}const Zn=BigInt(0),Tn=BigInt(1);function Or(n,t){const e=t.negate();return n?e:t}function eE(n,t,e){const r=s=>s.pz,i=ld(n.Fp,e.map(r));return e.map((s,o)=>s.toAffine(i[o])).map(n.fromAffine)}function dd(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Ps(n,t){dd(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),i=2**n,s=es(n),o=BigInt(n);return{windows:e,windowSize:r,mask:s,maxNumber:i,shiftBy:o}}function Xc(n,t,e){const{windowSize:r,mask:i,maxNumber:s,shiftBy:o}=e;let a=Number(n&i),l=n>>o;a>r&&(a-=s,l+=Tn);const u=t*r,h=u+Math.abs(a)-1,d=a===0,f=a<0,p=t%2!==0;return{nextN:l,offset:h,isZero:d,isNeg:f,isNegF:p,offsetF:u}}function tE(n,t){if(!Array.isArray(n))throw new Error("array expected");n.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function nE(n,t){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const Os=new WeakMap,fd=new WeakMap;function Rs(n){return fd.get(n)||1}function el(n){if(n!==Zn)throw new Error("invalid wNAF")}function rE(n,t){return{constTimeNegate:Or,hasPrecomputes(e){return Rs(e)!==1},unsafeLadder(e,r,i=n.ZERO){let s=e;for(;r>Zn;)r&Tn&&(i=i.add(s)),s=s.double(),r>>=Tn;return i},precomputeWindow(e,r){const{windows:i,windowSize:s}=Ps(r,t),o=[];let a=e,l=a;for(let u=0;u<i;u++){l=a,o.push(l);for(let h=1;h<s;h++)l=l.add(a),o.push(l);a=l.double()}return o},wNAF(e,r,i){let s=n.ZERO,o=n.BASE;const a=Ps(e,t);for(let l=0;l<a.windows;l++){const{nextN:u,offset:h,isZero:d,isNeg:f,isNegF:p,offsetF:w}=Xc(i,l,a);i=u,d?o=o.add(Or(p,r[w])):s=s.add(Or(f,r[h]))}return el(i),{p:s,f:o}},wNAFUnsafe(e,r,i,s=n.ZERO){const o=Ps(e,t);for(let a=0;a<o.windows&&i!==Zn;a++){const{nextN:l,offset:u,isZero:h,isNeg:d}=Xc(i,a,o);if(i=l,!h){const f=r[u];s=s.add(d?f.negate():f)}}return el(i),s},getPrecomputes(e,r,i){let s=Os.get(r);return s||(s=this.precomputeWindow(r,e),e!==1&&(typeof i=="function"&&(s=i(s)),Os.set(r,s))),s},wNAFCached(e,r,i){const s=Rs(e);return this.wNAF(s,this.getPrecomputes(s,e,i),r)},wNAFCachedUnsafe(e,r,i,s){const o=Rs(e);return o===1?this.unsafeLadder(e,r,s):this.wNAFUnsafe(o,this.getPrecomputes(o,e,i),r,s)},setWindowSize(e,r){dd(r,t),fd.set(e,r),Os.delete(e)}}}function iE(n,t,e,r){let i=t,s=n.ZERO,o=n.ZERO;for(;e>Zn||r>Zn;)e&Tn&&(s=s.add(i)),r&Tn&&(o=o.add(i)),i=i.double(),e>>=Tn,r>>=Tn;return{p1:s,p2:o}}function sE(n,t,e,r){tE(e,n),nE(r,t);const i=e.length,s=r.length;if(i!==s)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,a=j0(BigInt(i));let l=1;a>12?l=a-3:a>4?l=a-2:a>0&&(l=2);const u=es(l),h=new Array(Number(u)+1).fill(o),d=Math.floor((t.BITS-1)/l)*l;let f=o;for(let p=d;p>=0;p-=l){h.fill(o);for(let m=0;m<s;m++){const _=r[m],g=Number(_>>BigInt(p)&u);h[g]=h[g].add(e[m])}let w=o;for(let m=h.length-1,_=o;m>0;m--)_=_.add(h[m]),w=w.add(_);if(f=f.add(w),p!==0)for(let m=0;m<l;m++)f=f.double()}return f}function tl(n,t){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Y0(t),t}else return ir(n)}function oE(n,t,e={}){if(!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const o of["p","n","h"]){const a=t[o];if(!(typeof a=="bigint"&&a>Zn))throw new Error(`CURVE.${o} must be positive bigint`)}const r=tl(t.p,e.Fp),i=tl(t.n,e.Fn),s=["Gx","Gy","a","b"];for(const o of s)if(!r.isValid(t[o]))throw new Error(`CURVE.${o} must be valid field element of CURVE.Fp`);return{Fp:r,Fn:i}}BigInt(0),BigInt(1),BigInt(2),BigInt(8);const fr=BigInt(0),Mn=BigInt(1),ui=BigInt(2);function aE(n){return ts(n,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...n})}function cE(n){const t=aE(n),{P:e,type:r,adjustScalarBytes:i,powPminus2:s,randomBytes:o}=t,a=r==="x25519";if(!a&&r!=="x448")throw new Error("invalid type");const l=o||rr,u=a?255:448,h=a?32:56,d=BigInt(a?9:5),f=BigInt(a?121665:39081),p=a?ui**BigInt(254):ui**BigInt(447),w=a?BigInt(8)*ui**BigInt(251)-Mn:BigInt(4)*ui**BigInt(445)-Mn,m=p+w+Mn,_=E=>lt(E,e),g=v(d);function v(E){return Pa(_(E),h)}function y(E){const A=He("u coordinate",E,h);return a&&(A[31]&=127),_(Ni(A))}function b(E){return Ni(i(He("scalar",E,h)))}function I(E,A){const T=x(y(A),b(E));if(T===fr)throw new Error("invalid private or public key received");return v(T)}function D(E){return I(E,g)}function S(E,A,T){const P=_(E*(A-T));return A=_(A-P),T=_(T+P),{x_2:A,x_3:T}}function x(E,A){mo("u",E,fr,e),mo("scalar",A,p,m);const T=A,P=E;let V=Mn,O=fr,R=E,L=Mn,C=fr;for(let $=BigInt(u-1);$>=fr;$--){const M=T>>$&Mn;C^=M,{x_2:V,x_3:R}=S(C,V,R),{x_2:O,x_3:L}=S(C,O,L),C=M;const B=V+O,j=_(B*B),F=V-O,K=_(F*F),H=j-K,G=R+L,ce=R-L,re=_(ce*B),te=_(G*F),Le=re+te,Ne=re-te;R=_(Le*Le),L=_(P*_(Ne*Ne)),V=_(j*K),O=_(H*(j+_(f*H)))}({x_2:V,x_3:R}=S(C,V,R)),{x_2:O,x_3:L}=S(C,O,L);const U=s(O);return _(V*U)}return{scalarMult:I,scalarMultBase:D,getSharedSecret:(E,A)=>I(E,A),getPublicKey:E=>D(E),utils:{randomPrivateKey:()=>l(h)},GuBytes:g.slice()}}BigInt(0);const lE=BigInt(1),nl=BigInt(2),uE=BigInt(3),hE=BigInt(5);BigInt(8);const pd={p:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function dE(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),i=BigInt(80),s=pd.p,o=n*n%s*n%s,a=pt(o,nl,s)*o%s,l=pt(a,lE,s)*n%s,u=pt(l,hE,s)*l%s,h=pt(u,t,s)*u%s,d=pt(h,e,s)*h%s,f=pt(d,r,s)*d%s,p=pt(f,i,s)*f%s,w=pt(p,i,s)*f%s,m=pt(w,t,s)*u%s;return{pow_p_5_8:pt(m,nl,s)*n%s,b2:o}}function fE(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const yo=(()=>{const n=pd.p;return cE({P:n,type:"x25519",powPminus2:t=>{const{pow_p_5_8:e,b2:r}=dE(t);return lt(pt(e,uE,n)*r,n)},adjustScalarBytes:fE})})();function rl(n){n.lowS!==void 0&&Bi("lowS",n.lowS),n.prehash!==void 0&&Bi("prehash",n.prehash)}class pE extends Error{constructor(t=""){super(t)}}const Nt={Err:pE,_tlv:{encode:(n,t)=>{const{Err:e}=Nt;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,i=li(r);if(i.length/2&128)throw new e("tlv.encode: long form length too big");const s=r>127?li(i.length/2|128):"";return li(n)+s+i+t},decode(n,t){const{Err:e}=Nt;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const i=t[r++],s=!!(i&128);let o=0;if(!s)o=i;else{const l=i&127;if(!l)throw new e("tlv.decode(long): indefinite length not supported");if(l>4)throw new e("tlv.decode(long): byte length is too big");const u=t.subarray(r,r+l);if(u.length!==l)throw new e("tlv.decode: length bytes not complete");if(u[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const h of u)o=o<<8|h;if(r+=l,o<128)throw new e("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+o);if(a.length!==o)throw new e("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+o)}}},_int:{encode(n){const{Err:t}=Nt;if(n<Rr)throw new t("integer: negative integers are not allowed");let e=li(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Nt;if(n[0]&128)throw new t("invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return Xi(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Nt,i=He("signature",n),{v:s,l:o}=r.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l}=r.decode(2,s),{v:u,l:h}=r.decode(2,l);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(a),s:e.decode(u)}},hexFromSig(n){const{_tlv:t,_int:e}=Nt,r=t.encode(2,e.encode(n.r)),i=t.encode(2,e.encode(n.s)),s=r+i;return t.encode(48,s)}},Rr=BigInt(0),Lr=BigInt(1),_E=BigInt(2),hi=BigInt(3),wE=BigInt(4);function mE(n,t,e){function r(i){const s=n.sqr(i),o=n.mul(s,i);return n.add(n.add(o,n.mul(i,t)),e)}return r}function _d(n,t,e){const{BYTES:r}=n;function i(s){let o;if(typeof s=="bigint")o=s;else{let a=He("private key",s);if(t){if(!t.includes(a.length*2))throw new Error("invalid private key");const l=new Uint8Array(r);l.set(a,l.length-a.length),a=l}try{o=n.fromBytes(a)}catch{throw new Error(`invalid private key: expected ui8a of size ${r}, got ${typeof s}`)}}if(e&&(o=n.create(o)),!n.isValidNot0(o))throw new Error("invalid private key: out of range [1..N-1]");return o}return i}function yE(n,t={}){const{Fp:e,Fn:r}=oE("weierstrass",n,t),{h:i,n:s}=n;ts(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:o}=t;if(o&&(!e.is0(n.a)||typeof o.beta!="bigint"||typeof o.splitScalar!="function"))throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function');function a(){if(!e.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(x,E,A){const{x:T,y:P}=E.toAffine(),V=e.toBytes(T);if(Bi("isCompressed",A),A){a();const O=!e.isOdd(P);return In(wd(O),V)}else return In(Uint8Array.of(4),V,e.toBytes(P))}function u(x){ht(x);const E=e.BYTES,A=E+1,T=2*E+1,P=x.length,V=x[0],O=x.subarray(1);if(P===A&&(V===2||V===3)){const R=e.fromBytes(O);if(!e.isValid(R))throw new Error("bad point: is not on curve, wrong x");const L=f(R);let C;try{C=e.sqrt(L)}catch($){const M=$ instanceof Error?": "+$.message:"";throw new Error("bad point: is not on curve, sqrt error"+M)}a();const U=e.isOdd(C);return(V&1)===1!==U&&(C=e.neg(C)),{x:R,y:C}}else if(P===T&&V===4){const R=e.fromBytes(O.subarray(E*0,E*1)),L=e.fromBytes(O.subarray(E*1,E*2));if(!p(R,L))throw new Error("bad point: is not on curve");return{x:R,y:L}}else throw new Error(`bad point: got length ${P}, expected compressed=${A} or uncompressed=${T}`)}const h=t.toBytes||l,d=t.fromBytes||u,f=mE(e,n.a,n.b);function p(x,E){const A=e.sqr(E),T=f(x);return e.eql(A,T)}if(!p(n.Gx,n.Gy))throw new Error("bad curve params: generator point");const w=e.mul(e.pow(n.a,hi),wE),m=e.mul(e.sqr(n.b),BigInt(27));if(e.is0(e.add(w,m)))throw new Error("bad curve params: a or b");function _(x,E,A=!1){if(!e.isValid(E)||A&&e.is0(E))throw new Error(`bad point coordinate ${x}`);return E}function g(x){if(!(x instanceof I))throw new Error("ProjectivePoint expected")}const v=Yc((x,E)=>{const{px:A,py:T,pz:P}=x;if(e.eql(P,e.ONE))return{x:A,y:T};const V=x.is0();E==null&&(E=V?e.ONE:e.inv(P));const O=e.mul(A,E),R=e.mul(T,E),L=e.mul(P,E);if(V)return{x:e.ZERO,y:e.ZERO};if(!e.eql(L,e.ONE))throw new Error("invZ was invalid");return{x:O,y:R}}),y=Yc(x=>{if(x.is0()){if(t.allowInfinityPoint&&!e.is0(x.py))return;throw new Error("bad point: ZERO")}const{x:E,y:A}=x.toAffine();if(!e.isValid(E)||!e.isValid(A))throw new Error("bad point: x or y not field elements");if(!p(E,A))throw new Error("bad point: equation left != right");if(!x.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function b(x,E,A,T,P){return A=new I(e.mul(A.px,x),A.py,A.pz),E=Or(T,E),A=Or(P,A),E.add(A)}class I{constructor(E,A,T){this.px=_("x",E),this.py=_("y",A,!0),this.pz=_("z",T),Object.freeze(this)}static fromAffine(E){const{x:A,y:T}=E||{};if(!E||!e.isValid(A)||!e.isValid(T))throw new Error("invalid affine point");if(E instanceof I)throw new Error("projective point not allowed");return e.is0(A)&&e.is0(T)?I.ZERO:new I(A,T,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){return eE(I,"pz",E)}static fromBytes(E){return ht(E),I.fromHex(E)}static fromHex(E){const A=I.fromAffine(d(He("pointHex",E)));return A.assertValidity(),A}static fromPrivateKey(E){const A=_d(r,t.allowedPrivateKeyLengths,t.wrapPrivateKey);return I.BASE.multiply(A(E))}static msm(E,A){return sE(I,r,E,A)}precompute(E=8,A=!0){return S.setWindowSize(this,E),A||this.multiply(hi),this}_setWindowSize(E){this.precompute(E)}assertValidity(){y(this)}hasEvenY(){const{y:E}=this.toAffine();if(!e.isOdd)throw new Error("Field doesn't support isOdd");return!e.isOdd(E)}equals(E){g(E);const{px:A,py:T,pz:P}=this,{px:V,py:O,pz:R}=E,L=e.eql(e.mul(A,R),e.mul(V,P)),C=e.eql(e.mul(T,R),e.mul(O,P));return L&&C}negate(){return new I(this.px,e.neg(this.py),this.pz)}double(){const{a:E,b:A}=n,T=e.mul(A,hi),{px:P,py:V,pz:O}=this;let R=e.ZERO,L=e.ZERO,C=e.ZERO,U=e.mul(P,P),$=e.mul(V,V),M=e.mul(O,O),B=e.mul(P,V);return B=e.add(B,B),C=e.mul(P,O),C=e.add(C,C),R=e.mul(E,C),L=e.mul(T,M),L=e.add(R,L),R=e.sub($,L),L=e.add($,L),L=e.mul(R,L),R=e.mul(B,R),C=e.mul(T,C),M=e.mul(E,M),B=e.sub(U,M),B=e.mul(E,B),B=e.add(B,C),C=e.add(U,U),U=e.add(C,U),U=e.add(U,M),U=e.mul(U,B),L=e.add(L,U),M=e.mul(V,O),M=e.add(M,M),U=e.mul(M,B),R=e.sub(R,U),C=e.mul(M,$),C=e.add(C,C),C=e.add(C,C),new I(R,L,C)}add(E){g(E);const{px:A,py:T,pz:P}=this,{px:V,py:O,pz:R}=E;let L=e.ZERO,C=e.ZERO,U=e.ZERO;const $=n.a,M=e.mul(n.b,hi);let B=e.mul(A,V),j=e.mul(T,O),F=e.mul(P,R),K=e.add(A,T),H=e.add(V,O);K=e.mul(K,H),H=e.add(B,j),K=e.sub(K,H),H=e.add(A,P);let G=e.add(V,R);return H=e.mul(H,G),G=e.add(B,F),H=e.sub(H,G),G=e.add(T,P),L=e.add(O,R),G=e.mul(G,L),L=e.add(j,F),G=e.sub(G,L),U=e.mul($,H),L=e.mul(M,F),U=e.add(L,U),L=e.sub(j,U),U=e.add(j,U),C=e.mul(L,U),j=e.add(B,B),j=e.add(j,B),F=e.mul($,F),H=e.mul(M,H),j=e.add(j,F),F=e.sub(B,F),F=e.mul($,F),H=e.add(H,F),B=e.mul(j,H),C=e.add(C,B),B=e.mul(G,H),L=e.mul(K,L),L=e.sub(L,B),B=e.mul(K,j),U=e.mul(G,U),U=e.add(U,B),new I(L,C,U)}subtract(E){return this.add(E.negate())}is0(){return this.equals(I.ZERO)}multiply(E){const{endo:A}=t;if(!r.isValidNot0(E))throw new Error("invalid scalar: out of range");let T,P;const V=O=>S.wNAFCached(this,O,I.normalizeZ);if(A){const{k1neg:O,k1:R,k2neg:L,k2:C}=A.splitScalar(E),{p:U,f:$}=V(R),{p:M,f:B}=V(C);P=$.add(B),T=b(A.beta,U,M,O,L)}else{const{p:O,f:R}=V(E);T=O,P=R}return I.normalizeZ([T,P])[0]}multiplyUnsafe(E){const{endo:A}=t,T=this;if(!r.isValid(E))throw new Error("invalid scalar: out of range");if(E===Rr||T.is0())return I.ZERO;if(E===Lr)return T;if(S.hasPrecomputes(this))return this.multiply(E);if(A){const{k1neg:P,k1:V,k2neg:O,k2:R}=A.splitScalar(E),{p1:L,p2:C}=iE(I,T,V,R);return b(A.beta,L,C,P,O)}else return S.wNAFCachedUnsafe(T,E)}multiplyAndAddUnsafe(E,A,T){const P=this.multiplyUnsafe(A).add(E.multiplyUnsafe(T));return P.is0()?void 0:P}toAffine(E){return v(this,E)}isTorsionFree(){const{isTorsionFree:E}=t;return i===Lr?!0:E?E(I,this):S.wNAFCachedUnsafe(this,s).is0()}clearCofactor(){const{clearCofactor:E}=t;return i===Lr?this:E?E(I,this):this.multiplyUnsafe(i)}toBytes(E=!0){return Bi("isCompressed",E),this.assertValidity(),h(I,this,E)}toRawBytes(E=!0){return this.toBytes(E)}toHex(E=!0){return Mr(this.toBytes(E))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}}I.BASE=new I(n.Gx,n.Gy,e.ONE),I.ZERO=new I(e.ZERO,e.ONE,e.ZERO),I.Fp=e,I.Fn=r;const D=r.BITS,S=rE(I,t.endo?Math.ceil(D/2):D);return I}function wd(n){return Uint8Array.of(n?2:3)}function gE(n,t,e={}){ts(t,{hash:"function"},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=t.randomBytes||rr,i=t.hmac||((T,...P)=>Ji(t.hash,T,In(...P))),{Fp:s,Fn:o}=n,{ORDER:a,BITS:l}=o;function u(T){const P=a>>Lr;return T>P}function h(T){return u(T)?o.neg(T):T}function d(T,P){if(!o.isValidNot0(P))throw new Error(`invalid signature ${T}: out of range 1..CURVE.n`)}class f{constructor(P,V,O){d("r",P),d("s",V),this.r=P,this.s=V,O!=null&&(this.recovery=O),Object.freeze(this)}static fromCompact(P){const V=o.BYTES,O=He("compactSignature",P,V*2);return new f(o.fromBytes(O.subarray(0,V)),o.fromBytes(O.subarray(V,V*2)))}static fromDER(P){const{r:V,s:O}=Nt.toSig(He("DER",P));return new f(V,O)}assertValidity(){}addRecoveryBit(P){return new f(this.r,this.s,P)}recoverPublicKey(P){const V=s.ORDER,{r:O,s:R,recovery:L}=this;if(L==null||![0,1,2,3].includes(L))throw new Error("recovery id invalid");if(a*_E<V&&L>1)throw new Error("recovery id is ambiguous for h>1 curve");const C=L===2||L===3?O+a:O;if(!s.isValid(C))throw new Error("recovery id 2 or 3 invalid");const U=s.toBytes(C),$=n.fromHex(In(wd((L&1)===0),U)),M=o.inv(C),B=y(He("msgHash",P)),j=o.create(-B*M),F=o.create(R*M),K=n.BASE.multiplyUnsafe(j).add($.multiplyUnsafe(F));if(K.is0())throw new Error("point at infinify");return K.assertValidity(),K}hasHighS(){return u(this.s)}normalizeS(){return this.hasHighS()?new f(this.r,o.neg(this.s),this.recovery):this}toBytes(P){if(P==="compact")return In(o.toBytes(this.r),o.toBytes(this.s));if(P==="der")return va(Nt.hexFromSig(this));throw new Error("invalid format")}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Mr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Mr(this.toBytes("compact"))}}const p=_d(o,e.allowedPrivateKeyLengths,e.wrapPrivateKey),w={isValidPrivateKey(T){try{return p(T),!0}catch{return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{const T=a;return X0(r(hd(T)),T)},precompute(T=8,P=n.BASE){return P.precompute(T,!1)}};function m(T,P=!0){return n.fromPrivateKey(T).toBytes(P)}function _(T){if(typeof T=="bigint")return!1;if(T instanceof n)return!0;const P=He("key",T).length,V=s.BYTES,O=V+1,R=2*V+1;if(!(e.allowedPrivateKeyLengths||o.BYTES===O))return P===O||P===R}function g(T,P,V=!0){if(_(T)===!0)throw new Error("first arg must be private key");if(_(P)===!1)throw new Error("second arg must be public key");return n.fromHex(P).multiply(p(T)).toBytes(V)}const v=t.bits2int||function(T){if(T.length>8192)throw new Error("input is too large");const P=Xi(T),V=T.length*8-l;return V>0?P>>BigInt(V):P},y=t.bits2int_modN||function(T){return o.create(v(T))},b=es(l);function I(T){return mo("num < 2^"+l,T,Rr,b),o.toBytes(T)}function D(T,P,V=S){if(["recovered","canonical"].some(K=>K in V))throw new Error("sign() legacy options not supported");const{hash:O}=t;let{lowS:R,prehash:L,extraEntropy:C}=V;R==null&&(R=!0),T=He("msgHash",T),rl(V),L&&(T=He("prehashed msgHash",O(T)));const U=y(T),$=p(P),M=[I($),I(U)];if(C!=null&&C!==!1){const K=C===!0?r(s.BYTES):C;M.push(He("extraEntropy",K))}const B=In(...M),j=U;function F(K){const H=v(K);if(!o.isValidNot0(H))return;const G=o.inv(H),ce=n.BASE.multiply(H).toAffine(),re=o.create(ce.x);if(re===Rr)return;const te=o.create(G*o.create(j+re*$));if(te===Rr)return;let Le=(ce.x===re?0:2)|Number(ce.y&Lr),Ne=te;return R&&u(te)&&(Ne=h(te),Le^=1),new f(re,Ne,Le)}return{seed:B,k2sig:F}}const S={lowS:t.lowS,prehash:!1},x={lowS:t.lowS,prehash:!1};function E(T,P,V=S){const{seed:O,k2sig:R}=D(T,P,V);return K0(t.hash.outputLen,o.BYTES,i)(O,R)}n.BASE.precompute(8);function A(T,P,V,O=x){const R=T;P=He("msgHash",P),V=He("publicKey",V),rl(O);const{lowS:L,prehash:C,format:U}=O;if("strict"in O)throw new Error("options.strict was renamed to lowS");if(U!==void 0&&!["compact","der","js"].includes(U))throw new Error('format must be "compact", "der" or "js"');const $=typeof R=="string"||ya(R),M=!$&&!U&&typeof R=="object"&&R!==null&&typeof R.r=="bigint"&&typeof R.s=="bigint";if(!$&&!M)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let B,j;try{if(M)if(U===void 0||U==="js")B=new f(R.r,R.s);else throw new Error("invalid format");if($){try{U!=="compact"&&(B=f.fromDER(R))}catch(Le){if(!(Le instanceof Nt.Err))throw Le}!B&&U!=="der"&&(B=f.fromCompact(R))}j=n.fromHex(V)}catch{return!1}if(!B||L&&B.hasHighS())return!1;C&&(P=t.hash(P));const{r:F,s:K}=B,H=y(P),G=o.inv(K),ce=o.create(H*G),re=o.create(F*G),te=n.BASE.multiplyUnsafe(ce).add(j.multiplyUnsafe(re));return te.is0()?!1:o.create(te.x)===F}return Object.freeze({getPublicKey:m,getSharedSecret:g,sign:E,verify:A,utils:w,Point:n,Signature:f})}function EE(n){const t={a:n.a,b:n.b,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e=n.Fp,r=ir(t.n,n.nBitLength),i={Fp:e,Fn:r,allowedPrivateKeyLengths:n.allowedPrivateKeyLengths,allowInfinityPoint:n.allowInfinityPoint,endo:n.endo,wrapPrivateKey:n.wrapPrivateKey,isTorsionFree:n.isTorsionFree,clearCofactor:n.clearCofactor,fromBytes:n.fromBytes,toBytes:n.toBytes};return{CURVE:t,curveOpts:i}}function vE(n){const{CURVE:t,curveOpts:e}=EE(n),r={hash:n.hash,hmac:n.hmac,randomBytes:n.randomBytes,lowS:n.lowS,bits2int:n.bits2int,bits2int_modN:n.bits2int_modN};return{CURVE:t,curveOpts:e,ecdsaOpts:r}}function bE(n,t){return Object.assign({},t,{ProjectivePoint:t.Point,CURVE:n})}function IE(n){const{CURVE:t,curveOpts:e,ecdsaOpts:r}=vE(n),i=yE(t,e),s=gE(i,r,e);return bE(n,s)}function go(n,t){const e=r=>IE({...n,hash:r});return{...e(t),create:e}}const md={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},yd={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},gd={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},AE=ir(md.p),TE=ir(yd.p),PE=ir(gd.p),OE=go({...md,Fp:AE,lowS:!1},Yi);go({...yd,Fp:TE,lowS:!1},$g),go({...gd,Fp:PE,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},Cg);const RE=OE,Ed="base10",qe="base16",Ze="base64pad",un="base64url",Zr="utf8",vd=0,zt=1,Yr=2,LE=0,il=1,Dr=12,Oa=32;function DE(){const n=yo.utils.randomPrivateKey(),t=yo.getPublicKey(n);return{privateKey:Qe(n,qe),publicKey:Qe(t,qe)}}function Eo(){const n=rr(Oa);return Qe(n,qe)}function xE(n,t){const e=yo.getSharedSecret(ut(n,qe),ut(t,qe)),r=q0(Qi,e,void 0,void 0,Oa);return Qe(r,qe)}function gi(n){const t=Qi(ut(n,qe));return Qe(t,qe)}function ct(n){const t=Qi(ut(n,Zr));return Qe(t,qe)}function bd(n){return ut(`${n}`,Ed)}function xn(n){return Number(Qe(n,Ed))}function Id(n){return n.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function Ad(n){const t=n.replace(/-/g,"+").replace(/_/g,"/"),e=(4-t.length%4)%4;return t+"=".repeat(e)}function VE(n){const t=bd(typeof n.type<"u"?n.type:vd);if(xn(t)===zt&&typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const e=typeof n.senderPublicKey<"u"?ut(n.senderPublicKey,qe):void 0,r=typeof n.iv<"u"?ut(n.iv,qe):rr(Dr),i=ut(n.symKey,qe),s=nd(i,r).encrypt(ut(n.message,Zr)),o=Td({type:t,sealed:s,iv:r,senderPublicKey:e});return n.encoding===un?Id(o):o}function SE(n){const t=ut(n.symKey,qe),{sealed:e,iv:r}=zr({encoded:n.encoded,encoding:n.encoding}),i=nd(t,r).decrypt(e);if(i===null)throw new Error("Failed to decrypt");return Qe(i,Zr)}function CE(n,t){const e=bd(Yr),r=rr(Dr),i=ut(n,Zr),s=Td({type:e,sealed:i,iv:r});return t===un?Id(s):s}function $E(n,t){const{sealed:e}=zr({encoded:n,encoding:t});return Qe(e,Zr)}function Td(n){if(xn(n.type)===Yr)return Qe(Pr([n.type,n.sealed]),Ze);if(xn(n.type)===zt){if(typeof n.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return Qe(Pr([n.type,n.senderPublicKey,n.iv,n.sealed]),Ze)}return Qe(Pr([n.type,n.iv,n.sealed]),Ze)}function zr(n){const t=(n.encoding||Ze)===un?Ad(n.encoded):n.encoded,e=ut(t,Ze),r=e.slice(LE,il),i=il;if(xn(r)===zt){const l=i+Oa,u=l+Dr,h=e.slice(i,l),d=e.slice(l,u),f=e.slice(u);return{type:r,sealed:f,iv:d,senderPublicKey:h}}if(xn(r)===Yr){const l=e.slice(i),u=rr(Dr);return{type:r,sealed:l,iv:u}}const s=i+Dr,o=e.slice(i,s),a=e.slice(s);return{type:r,sealed:a,iv:o}}function UE(n,t){const e=zr({encoded:n,encoding:t==null?void 0:t.encoding});return Pd({type:xn(e.type),senderPublicKey:typeof e.senderPublicKey<"u"?Qe(e.senderPublicKey,qe):void 0,receiverPublicKey:t==null?void 0:t.receiverPublicKey})}function Pd(n){const t=(n==null?void 0:n.type)||vd;if(t===zt){if(typeof(n==null?void 0:n.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(n==null?void 0:n.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:t,senderPublicKey:n==null?void 0:n.senderPublicKey,receiverPublicKey:n==null?void 0:n.receiverPublicKey}}function sl(n){return n.type===zt&&typeof n.senderPublicKey=="string"&&typeof n.receiverPublicKey=="string"}function ol(n){return n.type===Yr}function kE(n){const t=Buffer.from(n.x,"base64"),e=Buffer.from(n.y,"base64");return Pr([new Uint8Array([4]),t,e])}function BE(n,t){const[e,r,i]=n.split("."),s=Buffer.from(Ad(i),"base64");if(s.length!==64)throw new Error("Invalid signature length");const o=s.slice(0,32),a=s.slice(32,64),l=`${e}.${r}`,u=Qi(l),h=kE(t);if(!RE.verify(Pr([o,a]),u,h))throw new Error("Invalid signature");return Ks(n).payload}const NE="irn";function Mi(n){return(n==null?void 0:n.relay)||{protocol:NE}}function Kn(n){const t=Gf[n];if(typeof t>"u")throw new Error(`Relay Protocol not supported: ${n}`);return t}function ME(n,t="-"){const e={},r="relay"+t;return Object.keys(n).forEach(i=>{if(i.startsWith(r)){const s=i.replace(r,""),o=n[i];e[s]=o}}),e}function al(n){if(!n.includes("wc:")){const u=kh(n);u!=null&&u.includes("wc:")&&(n=u)}n=n.includes("wc://")?n.replace("wc://",""):n,n=n.includes("wc:")?n.replace("wc:",""):n;const t=n.indexOf(":"),e=n.indexOf("?")!==-1?n.indexOf("?"):void 0,r=n.substring(0,t),i=n.substring(t+1,e).split("@"),s=typeof e<"u"?n.substring(e):"",o=new URLSearchParams(s),a={};o.forEach((u,h)=>{a[h]=u});const l=typeof a.methods=="string"?a.methods.split(","):void 0;return{protocol:r,topic:qE(i[0]),version:parseInt(i[1],10),symKey:a.symKey,relay:ME(a),methods:l,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function qE(n){return n.startsWith("//")?n.substring(2):n}function zE(n,t="-"){const e="relay",r={};return Object.keys(n).forEach(i=>{const s=i,o=e+t+s;n[s]&&(r[o]=n[s])}),r}function cl(n){const t=new URLSearchParams,e=zE(n.relay);Object.keys(e).sort().forEach(i=>{t.set(i,e[i])}),t.set("symKey",n.symKey),n.expiryTimestamp&&t.set("expiryTimestamp",n.expiryTimestamp.toString()),n.methods&&t.set("methods",n.methods.join(","));const r=t.toString();return`${n.protocol}:${n.topic}@${n.version}?${r}`}function di(n,t,e){return`${n}?wc_ev=${e}&topic=${t}`}var jE=Object.defineProperty,KE=Object.defineProperties,FE=Object.getOwnPropertyDescriptors,ll=Object.getOwnPropertySymbols,HE=Object.prototype.hasOwnProperty,WE=Object.prototype.propertyIsEnumerable,ul=(n,t,e)=>t in n?jE(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,GE=(n,t)=>{for(var e in t||(t={}))HE.call(t,e)&&ul(n,e,t[e]);if(ll)for(var e of ll(t))WE.call(t,e)&&ul(n,e,t[e]);return n},ZE=(n,t)=>KE(n,FE(t));function sr(n){const t=[];return n.forEach(e=>{const[r,i]=e.split(":");t.push(`${r}:${i}`)}),t}function YE(n){const t=[];return Object.values(n).forEach(e=>{t.push(...sr(e.accounts))}),t}function JE(n,t){const e=[];return Object.values(n).forEach(r=>{sr(r.accounts).includes(t)&&e.push(...r.methods)}),e}function QE(n,t){const e=[];return Object.values(n).forEach(r=>{sr(r.accounts).includes(t)&&e.push(...r.events)}),e}function Od(n){return n.includes(":")}function XE(n){return Od(n)?n.split(":")[0]:n}function hl(n){var t,e,r;const i={};if(!jr(n))return i;for(const[s,o]of Object.entries(n)){const a=Od(s)?[s]:o.chains,l=o.methods||[],u=o.events||[],h=XE(s);i[h]=ZE(GE({},i[h]),{chains:On(a,(t=i[h])==null?void 0:t.chains),methods:On(l,(e=i[h])==null?void 0:e.methods),events:On(u,(r=i[h])==null?void 0:r.events)})}return i}function ev(n){const t={};return n==null||n.forEach(e=>{var r;const[i,s]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),(r=t[i].chains)==null||r.push(`${i}:${s}`)}),t}function dl(n,t){t=t.map(r=>r.replace("did:pkh:",""));const e=ev(t);for(const[r,i]of Object.entries(e))i.methods?i.methods=On(i.methods,n):i.methods=n,i.events=["chainChanged","accountsChanged"];return e}function tv(n,t){var e,r,i,s,o,a;const l=hl(n),u=hl(t),h={},d=Object.keys(l).concat(Object.keys(u));for(const f of d)h[f]={chains:On((e=l[f])==null?void 0:e.chains,(r=u[f])==null?void 0:r.chains),methods:On((i=l[f])==null?void 0:i.methods,(s=u[f])==null?void 0:s.methods),events:On((o=l[f])==null?void 0:o.events,(a=u[f])==null?void 0:a.events)};return h}const nv={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},rv={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function N(n,t){const{message:e,code:r}=rv[n];return{message:t?`${e} ${t}`:e,code:r}}function le(n,t){const{message:e,code:r}=nv[n];return{message:t?`${e} ${t}`:e,code:r}}function Yn(n,t){return!!Array.isArray(n)}function jr(n){return Object.getPrototypeOf(n)===Object.prototype&&Object.keys(n).length}function we(n){return typeof n>"u"}function fe(n,t){return t&&we(n)?!0:typeof n=="string"&&!!n.trim().length}function Ra(n,t){return t&&we(n)?!0:typeof n=="number"&&!isNaN(n)}function iv(n,t){const{requiredNamespaces:e}=t,r=Object.keys(n.namespaces),i=Object.keys(e);let s=!0;return bn(i,r)?(r.forEach(o=>{const{accounts:a,methods:l,events:u}=n.namespaces[o],h=sr(a),d=e[o];(!bn(Vh(o,d),h)||!bn(d.methods,l)||!bn(d.events,u))&&(s=!1)}),s):!1}function qi(n){return fe(n,!1)&&n.includes(":")?n.split(":").length===2:!1}function sv(n){if(fe(n,!1)&&n.includes(":")){const t=n.split(":");if(t.length===3){const e=t[0]+":"+t[1];return!!t[2]&&qi(e)}}return!1}function ov(n){function t(e){try{return typeof new URL(e)<"u"}catch{return!1}}try{if(fe(n,!1)){if(t(n))return!0;const e=kh(n);return t(e)}}catch{}return!1}function av(n){var t;return(t=n==null?void 0:n.proposer)==null?void 0:t.publicKey}function cv(n){return n==null?void 0:n.topic}function lv(n,t){let e=null;return fe(n==null?void 0:n.publicKey,!1)||(e=N("MISSING_OR_INVALID",`${t} controller public key should be a string`)),e}function fl(n){let t=!0;return Yn(n)?n.length&&(t=n.every(e=>fe(e,!1))):t=!1,t}function uv(n,t,e){let r=null;return Yn(t)&&t.length?t.forEach(i=>{r||qi(i)||(r=le("UNSUPPORTED_CHAINS",`${e}, chain ${i} should be a string and conform to "namespace:chainId" format`))}):qi(n)||(r=le("UNSUPPORTED_CHAINS",`${e}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function hv(n,t,e){let r=null;return Object.entries(n).forEach(([i,s])=>{if(r)return;const o=uv(i,Vh(i,s),`${t} ${e}`);o&&(r=o)}),r}function dv(n,t){let e=null;return Yn(n)?n.forEach(r=>{e||sv(r)||(e=le("UNSUPPORTED_ACCOUNTS",`${t}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):e=le("UNSUPPORTED_ACCOUNTS",`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),e}function fv(n,t){let e=null;return Object.values(n).forEach(r=>{if(e)return;const i=dv(r==null?void 0:r.accounts,`${t} namespace`);i&&(e=i)}),e}function pv(n,t){let e=null;return fl(n==null?void 0:n.methods)?fl(n==null?void 0:n.events)||(e=le("UNSUPPORTED_EVENTS",`${t}, events should be an array of strings or empty array for no events`)):e=le("UNSUPPORTED_METHODS",`${t}, methods should be an array of strings or empty array for no methods`),e}function Rd(n,t){let e=null;return Object.values(n).forEach(r=>{if(e)return;const i=pv(r,`${t}, namespace`);i&&(e=i)}),e}function _v(n,t,e){let r=null;if(n&&jr(n)){const i=Rd(n,t);i&&(r=i);const s=hv(n,t,e);s&&(r=s)}else r=N("MISSING_OR_INVALID",`${t}, ${e} should be an object with data`);return r}function Ls(n,t){let e=null;if(n&&jr(n)){const r=Rd(n,t);r&&(e=r);const i=fv(n,t);i&&(e=i)}else e=N("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return e}function Ld(n){return fe(n.protocol,!0)}function wv(n,t){let e=!1;return n?n&&Yn(n)&&n.length&&n.forEach(r=>{e=Ld(r)}):e=!0,e}function mv(n){return typeof n=="number"}function Fe(n){return typeof n<"u"&&typeof n!==null}function yv(n){return!(!n||typeof n!="object"||!n.code||!Ra(n.code,!1)||!n.message||!fe(n.message,!1))}function gv(n){return!(we(n)||!fe(n.method,!1))}function Ev(n){return!(we(n)||we(n.result)&&we(n.error)||!Ra(n.id,!1)||!fe(n.jsonrpc,!1))}function vv(n){return!(we(n)||!fe(n.name,!1))}function pl(n,t){return!(!qi(t)||!YE(n).includes(t))}function bv(n,t,e){return fe(e,!1)?JE(n,t).includes(e):!1}function Iv(n,t,e){return fe(e,!1)?QE(n,t).includes(e):!1}function _l(n,t,e){let r=null;const i=Av(n),s=Tv(t),o=Object.keys(i),a=Object.keys(s),l=wl(Object.keys(n)),u=wl(Object.keys(t)),h=l.filter(d=>!u.includes(d));return h.length&&(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces keys don't satisfy requiredNamespaces.
|
|
10
|
-
Required: ${h.toString()}
|
|
11
|
-
Received: ${Object.keys(t).toString()}`)),bn(o,a)||(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces chains don't satisfy required namespaces.
|
|
12
|
-
Required: ${o.toString()}
|
|
13
|
-
Approved: ${a.toString()}`)),Object.keys(t).forEach(d=>{if(!d.includes(":")||r)return;const f=sr(t[d].accounts);f.includes(d)||(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces accounts don't satisfy namespace accounts for ${d}
|
|
14
|
-
Required: ${d}
|
|
15
|
-
Approved: ${f.toString()}`))}),o.forEach(d=>{r||(bn(i[d].methods,s[d].methods)?bn(i[d].events,s[d].events)||(r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces events don't satisfy namespace events for ${d}`)):r=N("NON_CONFORMING_NAMESPACES",`${e} namespaces methods don't satisfy namespace methods for ${d}`))}),r}function Av(n){const t={};return Object.keys(n).forEach(e=>{var r;e.includes(":")?t[e]=n[e]:(r=n[e].chains)==null||r.forEach(i=>{t[i]={methods:n[e].methods,events:n[e].events}})}),t}function wl(n){return[...new Set(n.map(t=>t.includes(":")?t.split(":")[0]:t))]}function Tv(n){const t={};return Object.keys(n).forEach(e=>{if(e.includes(":"))t[e]=n[e];else{const r=sr(n[e].accounts);r==null||r.forEach(i=>{t[i]={accounts:n[e].accounts.filter(s=>s.includes(`${i}:`)),methods:n[e].methods,events:n[e].events}})}}),t}function Pv(n,t){return Ra(n,!1)&&n<=t.max&&n>=t.min}function ml(){const n=Wr();return new Promise(t=>{switch(n){case nt.browser:t(Ov());break;case nt.reactNative:t(Rv());break;case nt.node:t(Lv());break;default:t(!0)}})}function Ov(){return nr()&&(navigator==null?void 0:navigator.onLine)}async function Rv(){if(fn()&&typeof global<"u"&&global!=null&&global.NetInfo){const n=await(global==null?void 0:global.NetInfo.fetch());return n==null?void 0:n.isConnected}return!0}function Lv(){return!0}function Dv(n){switch(Wr()){case nt.browser:xv(n);break;case nt.reactNative:Vv(n);break}}function xv(n){!fn()&&nr()&&(window.addEventListener("online",()=>n(!0)),window.addEventListener("offline",()=>n(!1)))}function Vv(n){fn()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(t=>n(t==null?void 0:t.isConnected)))}function Sv(){var n;return nr()&&Hn()?((n=Hn())==null?void 0:n.visibilityState)==="visible":!0}const Ds={};class pr{static get(t){return Ds[t]}static set(t,e){Ds[t]=e}static delete(t){delete Ds[t]}}function Cv(n){const t=Hr.decode(n);if(t.length<33)throw new Error("Too short to contain a public key");return t.slice(1,33)}function $v({publicKey:n,signature:t,payload:e}){var r;const i=vo(e.method),s=128|parseInt(((r=e.version)==null?void 0:r.toString())||"4"),o=Bv(e.address),a=e.era==="00"?new Uint8Array([0]):vo(e.era);if(a.length!==1&&a.length!==2)throw new Error("Invalid era length");const l=parseInt(e.nonce,16),u=new Uint8Array([l&255,l>>8&255]),h=BigInt(`0x${kv(e.tip)}`),d=Mv(h),f=new Uint8Array([0,...n,o,...t,...a,...u,...d,...i]),p=Nv(f.length+1);return new Uint8Array([...p,s,...f])}function Uv(n){const t=vo(n),e=Ty.blake2b(t,void 0,32);return"0x"+Buffer.from(e).toString("hex")}function vo(n){return new Uint8Array(n.replace(/^0x/,"").match(/.{1,2}/g).map(t=>parseInt(t,16)))}function kv(n){return n.startsWith("0x")?n.slice(2):n}function Bv(n){const t=Hr.decode(n)[0];return t===42?0:t===60?2:1}function Nv(n){if(n<64)return new Uint8Array([n<<2]);if(n<16384){const t=n<<2|1;return new Uint8Array([t&255,t>>8&255])}else if(n<1<<30){const t=n<<2|2;return new Uint8Array([t&255,t>>8&255,t>>16&255,t>>24&255])}else throw new Error("Compact encoding > 2^30 not supported")}function Mv(n){if(n<BigInt(1)<<BigInt(6))return new Uint8Array([Number(n<<BigInt(2))]);if(n<BigInt(1)<<BigInt(14)){const t=n<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}else if(n<BigInt(1)<<BigInt(30)){const t=n<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}else throw new Error("BigInt compact encoding not supported > 2^30")}function qv(n){const t=Uint8Array.from(Buffer.from(n.signature,"hex")),e=Cv(n.transaction.address),r=$v({publicKey:e,signature:t,payload:n.transaction}),i=Buffer.from(r).toString("hex");return Uv(i)}var zv={};const Dd="wc",xd=2,bo="core",Dt=`${Dd}@2:${bo}:`,jv={logger:"error"},Kv={database:":memory:"},Fv="crypto",yl="client_ed25519_seed",Hv=q.ONE_DAY,Wv="keychain",Gv="0.3",Zv="messages",Yv="0.3",Jv=q.SIX_HOURS,Qv="publisher",Vd="irn",Xv="error",Sd="wss://relay.walletconnect.org",eb="relayer",ue={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",transport_closed:"relayer_transport_closed",publish:"relayer_publish"},tb="_subscription",st={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},nb=.1,Io="2.21.8",ae={link_mode:"link_mode",relay:"relay"},Ei={inbound:"inbound",outbound:"outbound"},rb="0.3",ib="WALLETCONNECT_CLIENT_ID",gl="WALLETCONNECT_LINK_MODE_APPS",et={created:"subscription_created",deleted:"subscription_deleted",expired:"subscription_expired",disabled:"subscription_disabled",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},sb="subscription",ob="0.3",ab="pairing",cb="0.3",_r={wc_pairingDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:q.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:q.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:q.ONE_DAY,prompt:!1,tag:0},res:{ttl:q.ONE_DAY,prompt:!1,tag:0}}},En={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},ft={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},lb="history",ub="0.3",hb="expirer",at={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},db="0.3",fb="verify-api",pb="https://verify.walletconnect.com",Cd="https://verify.walletconnect.org",xr=Cd,_b=`${xr}/v3`,wb=[pb,Cd],mb="echo",yb="https://echo.walletconnect.com",Tt={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal",subscribing_to_pairing_topic:"subscribing_to_pairing_topic"},kt={no_wss_connection:"no_wss_connection",no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_expired:"proposal_expired",proposal_listener_not_found:"proposal_listener_not_found"},rn={session_approve_started:"session_approve_started",proposal_not_expired:"proposal_not_expired",session_namespaces_validation_success:"session_namespaces_validation_success",create_session_topic:"create_session_topic",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},wr={no_internet_connection:"no_internet_connection",no_wss_connection:"no_wss_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},mn={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"},mr={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"},gb=.1,Eb="event-client",vb=86400,bb="https://pulse.walletconnect.org/batch";function Ib(n,t){if(n.length>=255)throw new TypeError("Alphabet too long");for(var e=new Uint8Array(256),r=0;r<e.length;r++)e[r]=255;for(var i=0;i<n.length;i++){var s=n.charAt(i),o=s.charCodeAt(0);if(e[o]!==255)throw new TypeError(s+" is ambiguous");e[o]=i}var a=n.length,l=n.charAt(0),u=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function d(w){if(w instanceof Uint8Array||(ArrayBuffer.isView(w)?w=new Uint8Array(w.buffer,w.byteOffset,w.byteLength):Array.isArray(w)&&(w=Uint8Array.from(w))),!(w instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(w.length===0)return"";for(var m=0,_=0,g=0,v=w.length;g!==v&&w[g]===0;)g++,m++;for(var y=(v-g)*h+1>>>0,b=new Uint8Array(y);g!==v;){for(var I=w[g],D=0,S=y-1;(I!==0||D<_)&&S!==-1;S--,D++)I+=256*b[S]>>>0,b[S]=I%a>>>0,I=I/a>>>0;if(I!==0)throw new Error("Non-zero carry");_=D,g++}for(var x=y-_;x!==y&&b[x]===0;)x++;for(var E=l.repeat(m);x<y;++x)E+=n.charAt(b[x]);return E}function f(w){if(typeof w!="string")throw new TypeError("Expected String");if(w.length===0)return new Uint8Array;var m=0;if(w[m]!==" "){for(var _=0,g=0;w[m]===l;)_++,m++;for(var v=(w.length-m)*u+1>>>0,y=new Uint8Array(v);w[m];){var b=e[w.charCodeAt(m)];if(b===255)return;for(var I=0,D=v-1;(b!==0||I<g)&&D!==-1;D--,I++)b+=a*y[D]>>>0,y[D]=b%256>>>0,b=b/256>>>0;if(b!==0)throw new Error("Non-zero carry");g=I,m++}if(w[m]!==" "){for(var S=v-g;S!==v&&y[S]===0;)S++;for(var x=new Uint8Array(_+(v-S)),E=_;S!==v;)x[E++]=y[S++];return x}}}function p(w){var m=f(w);if(m)return m;throw new Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:f,decode:p}}var Ab=Ib,Tb=Ab;const $d=n=>{if(n instanceof Uint8Array&&n.constructor.name==="Uint8Array")return n;if(n instanceof ArrayBuffer)return new Uint8Array(n);if(ArrayBuffer.isView(n))return new Uint8Array(n.buffer,n.byteOffset,n.byteLength);throw new Error("Unknown type, must be binary type")},Pb=n=>new TextEncoder().encode(n),Ob=n=>new TextDecoder().decode(n);class Rb{constructor(t,e,r){this.name=t,this.prefix=e,this.baseEncode=r}encode(t){if(t instanceof Uint8Array)return`${this.prefix}${this.baseEncode(t)}`;throw Error("Unknown type, must be binary type")}}class Lb{constructor(t,e,r){if(this.name=t,this.prefix=e,e.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=e.codePointAt(0),this.baseDecode=r}decode(t){if(typeof t=="string"){if(t.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(t)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(t.slice(this.prefix.length))}else throw Error("Can only multibase decode strings")}or(t){return Ud(this,t)}}class Db{constructor(t){this.decoders=t}or(t){return Ud(this,t)}decode(t){const e=t[0],r=this.decoders[e];if(r)return r.decode(t);throw RangeError(`Unable to decode multibase string ${JSON.stringify(t)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const Ud=(n,t)=>new Db({...n.decoders||{[n.prefix]:n},...t.decoders||{[t.prefix]:t}});class xb{constructor(t,e,r,i){this.name=t,this.prefix=e,this.baseEncode=r,this.baseDecode=i,this.encoder=new Rb(t,e,r),this.decoder=new Lb(t,e,i)}encode(t){return this.encoder.encode(t)}decode(t){return this.decoder.decode(t)}}const ns=({name:n,prefix:t,encode:e,decode:r})=>new xb(n,t,e,r),Jr=({prefix:n,name:t,alphabet:e})=>{const{encode:r,decode:i}=Tb(e,t);return ns({prefix:n,name:t,encode:r,decode:s=>$d(i(s))})},Vb=(n,t,e,r)=>{const i={};for(let h=0;h<t.length;++h)i[t[h]]=h;let s=n.length;for(;n[s-1]==="=";)--s;const o=new Uint8Array(s*e/8|0);let a=0,l=0,u=0;for(let h=0;h<s;++h){const d=i[n[h]];if(d===void 0)throw new SyntaxError(`Non-${r} character`);l=l<<e|d,a+=e,a>=8&&(a-=8,o[u++]=255&l>>a)}if(a>=e||255&l<<8-a)throw new SyntaxError("Unexpected end of data");return o},Sb=(n,t,e)=>{const r=t[t.length-1]==="=",i=(1<<e)-1;let s="",o=0,a=0;for(let l=0;l<n.length;++l)for(a=a<<8|n[l],o+=8;o>e;)o-=e,s+=t[i&a>>o];if(o&&(s+=t[i&a<<e-o]),r)for(;s.length*e&7;)s+="=";return s},Re=({name:n,prefix:t,bitsPerChar:e,alphabet:r})=>ns({prefix:t,name:n,encode(i){return Sb(i,r,e)},decode(i){return Vb(i,r,e,n)}}),Cb=ns({prefix:"\0",name:"identity",encode:n=>Ob(n),decode:n=>Pb(n)});var $b=Object.freeze({__proto__:null,identity:Cb});const Ub=Re({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var kb=Object.freeze({__proto__:null,base2:Ub});const Bb=Re({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var Nb=Object.freeze({__proto__:null,base8:Bb});const Mb=Jr({prefix:"9",name:"base10",alphabet:"0123456789"});var qb=Object.freeze({__proto__:null,base10:Mb});const zb=Re({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),jb=Re({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Kb=Object.freeze({__proto__:null,base16:zb,base16upper:jb});const Fb=Re({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),Hb=Re({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),Wb=Re({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),Gb=Re({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Zb=Re({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),Yb=Re({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),Jb=Re({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Qb=Re({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Xb=Re({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var eI=Object.freeze({__proto__:null,base32:Fb,base32upper:Hb,base32pad:Wb,base32padupper:Gb,base32hex:Zb,base32hexupper:Yb,base32hexpad:Jb,base32hexpadupper:Qb,base32z:Xb});const tI=Jr({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),nI=Jr({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var rI=Object.freeze({__proto__:null,base36:tI,base36upper:nI});const iI=Jr({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),sI=Jr({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var oI=Object.freeze({__proto__:null,base58btc:iI,base58flickr:sI});const aI=Re({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),cI=Re({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),lI=Re({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),uI=Re({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var hI=Object.freeze({__proto__:null,base64:aI,base64pad:cI,base64url:lI,base64urlpad:uI});const kd=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),dI=kd.reduce((n,t,e)=>(n[e]=t,n),[]),fI=kd.reduce((n,t,e)=>(n[t.codePointAt(0)]=e,n),[]);function pI(n){return n.reduce((t,e)=>(t+=dI[e],t),"")}function _I(n){const t=[];for(const e of n){const r=fI[e.codePointAt(0)];if(r===void 0)throw new Error(`Non-base256emoji character: ${e}`);t.push(r)}return new Uint8Array(t)}const wI=ns({prefix:"🚀",name:"base256emoji",encode:pI,decode:_I});var mI=Object.freeze({__proto__:null,base256emoji:wI}),yI=Bd,El=128,gI=-128,EI=Math.pow(2,31);function Bd(n,t,e){t=t||[],e=e||0;for(var r=e;n>=EI;)t[e++]=n&255|El,n/=128;for(;n&gI;)t[e++]=n&255|El,n>>>=7;return t[e]=n|0,Bd.bytes=e-r+1,t}var vI=Ao,bI=128,vl=127;function Ao(n,r){var e=0,r=r||0,i=0,s=r,o,a=n.length;do{if(s>=a)throw Ao.bytes=0,new RangeError("Could not decode varint");o=n[s++],e+=i<28?(o&vl)<<i:(o&vl)*Math.pow(2,i),i+=7}while(o>=bI);return Ao.bytes=s-r,e}var II=Math.pow(2,7),AI=Math.pow(2,14),TI=Math.pow(2,21),PI=Math.pow(2,28),OI=Math.pow(2,35),RI=Math.pow(2,42),LI=Math.pow(2,49),DI=Math.pow(2,56),xI=Math.pow(2,63),VI=function(n){return n<II?1:n<AI?2:n<TI?3:n<PI?4:n<OI?5:n<RI?6:n<LI?7:n<DI?8:n<xI?9:10},SI={encode:yI,decode:vI,encodingLength:VI},Nd=SI;const bl=(n,t,e=0)=>(Nd.encode(n,t,e),t),Il=n=>Nd.encodingLength(n),To=(n,t)=>{const e=t.byteLength,r=Il(n),i=r+Il(e),s=new Uint8Array(i+e);return bl(n,s,0),bl(e,s,r),s.set(t,i),new CI(n,e,t,s)};class CI{constructor(t,e,r,i){this.code=t,this.size=e,this.digest=r,this.bytes=i}}const Md=({name:n,code:t,encode:e})=>new $I(n,t,e);class $I{constructor(t,e,r){this.name=t,this.code=e,this.encode=r}digest(t){if(t instanceof Uint8Array){const e=this.encode(t);return e instanceof Uint8Array?To(this.code,e):e.then(r=>To(this.code,r))}else throw Error("Unknown type, must be binary type")}}const qd=n=>async t=>new Uint8Array(await crypto.subtle.digest(n,t)),UI=Md({name:"sha2-256",code:18,encode:qd("SHA-256")}),kI=Md({name:"sha2-512",code:19,encode:qd("SHA-512")});var BI=Object.freeze({__proto__:null,sha256:UI,sha512:kI});const zd=0,NI="identity",jd=$d,MI=n=>To(zd,jd(n)),qI={code:zd,name:NI,encode:jd,digest:MI};var zI=Object.freeze({__proto__:null,identity:qI});new TextEncoder,new TextDecoder;const Al={...$b,...kb,...Nb,...qb,...Kb,...eI,...rI,...oI,...hI,...mI};({...BI,...zI});function Kd(n){return globalThis.Buffer!=null?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):n}function jI(n=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Kd(globalThis.Buffer.allocUnsafe(n)):new Uint8Array(n)}function Fd(n,t,e,r){return{name:n,prefix:t,encoder:{name:n,prefix:t,encode:e},decoder:{decode:r}}}const Tl=Fd("utf8","u",n=>"u"+new TextDecoder("utf8").decode(n),n=>new TextEncoder().encode(n.substring(1))),xs=Fd("ascii","a",n=>{let t="a";for(let e=0;e<n.length;e++)t+=String.fromCharCode(n[e]);return t},n=>{n=n.substring(1);const t=jI(n.length);for(let e=0;e<n.length;e++)t[e]=n.charCodeAt(e);return t}),KI={utf8:Tl,"utf-8":Tl,hex:Al.base16,latin1:xs,ascii:xs,binary:xs,...Al};function FI(n,t="utf8"){const e=KI[t];if(!e)throw new Error(`Unsupported encoding "${t}"`);return(t==="utf8"||t==="utf-8")&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Kd(globalThis.Buffer.from(n,"utf-8")):e.decoder.decode(`${e.prefix}${n}`)}var HI=Object.defineProperty,WI=(n,t,e)=>t in n?HI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,It=(n,t,e)=>WI(n,typeof t!="symbol"?t+"":t,e);class GI{constructor(t,e){this.core=t,this.logger=e,It(this,"keychain",new Map),It(this,"name",Wv),It(this,"version",Gv),It(this,"initialized",!1),It(this,"storagePrefix",Dt),It(this,"init",async()=>{if(!this.initialized){const r=await this.getKeyChain();typeof r<"u"&&(this.keychain=r),this.initialized=!0}}),It(this,"has",r=>(this.isInitialized(),this.keychain.has(r))),It(this,"set",async(r,i)=>{this.isInitialized(),this.keychain.set(r,i),await this.persist()}),It(this,"get",r=>{this.isInitialized();const i=this.keychain.get(r);if(typeof i>"u"){const{message:s}=N("NO_MATCHING_KEY",`${this.name}: ${r}`);throw new Error(s)}return i}),It(this,"del",async r=>{this.isInitialized(),this.keychain.delete(r),await this.persist()}),this.core=t,this.logger=ze(e,this.name)}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(t){await this.core.storage.setItem(this.storageKey,co(t))}async getKeyChain(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?lo(t):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var ZI=Object.defineProperty,YI=(n,t,e)=>t in n?ZI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Te=(n,t,e)=>YI(n,typeof t!="symbol"?t+"":t,e);class JI{constructor(t,e,r){this.core=t,this.logger=e,Te(this,"name",Fv),Te(this,"keychain"),Te(this,"randomSessionIdentifier",Eo()),Te(this,"initialized",!1),Te(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),Te(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),Te(this,"getClientId",async()=>{this.isInitialized();const i=await this.getClientSeed(),s=Na(i);return tp(s.publicKey)}),Te(this,"generateKeyPair",()=>{this.isInitialized();const i=DE();return this.setPrivateKey(i.publicKey,i.privateKey)}),Te(this,"signJWT",async i=>{this.isInitialized();const s=await this.getClientSeed(),o=Na(s),a=this.randomSessionIdentifier;return await np(a,i,Hv,o)}),Te(this,"generateSharedKey",(i,s,o)=>{this.isInitialized();const a=this.getPrivateKey(i),l=xE(a,s);return this.setSymKey(l,o)}),Te(this,"setSymKey",async(i,s)=>{this.isInitialized();const o=s||gi(i);return await this.keychain.set(o,i),o}),Te(this,"deleteKeyPair",async i=>{this.isInitialized(),await this.keychain.del(i)}),Te(this,"deleteSymKey",async i=>{this.isInitialized(),await this.keychain.del(i)}),Te(this,"encode",async(i,s,o)=>{this.isInitialized();const a=Pd(o),l=jo(s);if(ol(a))return CE(l,o==null?void 0:o.encoding);if(sl(a)){const f=a.senderPublicKey,p=a.receiverPublicKey;i=await this.generateSharedKey(f,p)}const u=this.getSymKey(i),{type:h,senderPublicKey:d}=a;return VE({type:h,symKey:u,message:l,senderPublicKey:d,encoding:o==null?void 0:o.encoding})}),Te(this,"decode",async(i,s,o)=>{this.isInitialized();const a=UE(s,o);if(ol(a)){const l=$E(s,o==null?void 0:o.encoding);return Ai(l)}if(sl(a)){const l=a.receiverPublicKey,u=a.senderPublicKey;i=await this.generateSharedKey(l,u)}try{const l=this.getSymKey(i),u=SE({symKey:l,encoded:s,encoding:o==null?void 0:o.encoding});return Ai(u)}catch(l){this.logger.error(`Failed to decode message from topic: '${i}', clientId: '${await this.getClientId()}'`),this.logger.error(l)}}),Te(this,"getPayloadType",(i,s=Ze)=>{const o=zr({encoded:i,encoding:s});return xn(o.type)}),Te(this,"getPayloadSenderPublicKey",(i,s=Ze)=>{const o=zr({encoded:i,encoding:s});return o.senderPublicKey?Qe(o.senderPublicKey,qe):void 0}),this.core=t,this.logger=ze(e,this.name),this.keychain=r||new GI(this.core,this.logger)}get context(){return rt(this.logger)}async setPrivateKey(t,e){return await this.keychain.set(t,e),t}getPrivateKey(t){return this.keychain.get(t)}async getClientSeed(){let t="";try{t=this.keychain.get(yl)}catch{t=Eo(),await this.keychain.set(yl,t)}return FI(t,"base16")}getSymKey(t){return this.keychain.get(t)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var QI=Object.defineProperty,XI=Object.defineProperties,e1=Object.getOwnPropertyDescriptors,Pl=Object.getOwnPropertySymbols,t1=Object.prototype.hasOwnProperty,n1=Object.prototype.propertyIsEnumerable,Po=(n,t,e)=>t in n?QI(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,r1=(n,t)=>{for(var e in t||(t={}))t1.call(t,e)&&Po(n,e,t[e]);if(Pl)for(var e of Pl(t))n1.call(t,e)&&Po(n,e,t[e]);return n},i1=(n,t)=>XI(n,e1(t)),Xe=(n,t,e)=>Po(n,typeof t!="symbol"?t+"":t,e);class s1 extends bw{constructor(t,e){super(t,e),this.logger=t,this.core=e,Xe(this,"messages",new Map),Xe(this,"messagesWithoutClientAck",new Map),Xe(this,"name",Zv),Xe(this,"version",Yv),Xe(this,"initialized",!1),Xe(this,"storagePrefix",Dt),Xe(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const r=await this.getRelayerMessages();typeof r<"u"&&(this.messages=r);const i=await this.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(this.messagesWithoutClientAck=i),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(r){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(r)}finally{this.initialized=!0}}}),Xe(this,"set",async(r,i,s)=>{this.isInitialized();const o=ct(i);let a=this.messages.get(r);if(typeof a>"u"&&(a={}),typeof a[o]<"u")return o;if(a[o]=i,this.messages.set(r,a),s===Ei.inbound){const l=this.messagesWithoutClientAck.get(r)||{};this.messagesWithoutClientAck.set(r,i1(r1({},l),{[o]:i}))}return await this.persist(),o}),Xe(this,"get",r=>{this.isInitialized();let i=this.messages.get(r);return typeof i>"u"&&(i={}),i}),Xe(this,"getWithoutAck",r=>{this.isInitialized();const i={};for(const s of r){const o=this.messagesWithoutClientAck.get(s)||{};i[s]=Object.values(o)}return i}),Xe(this,"has",(r,i)=>{this.isInitialized();const s=this.get(r),o=ct(i);return typeof s[o]<"u"}),Xe(this,"ack",async(r,i)=>{this.isInitialized();const s=this.messagesWithoutClientAck.get(r);if(typeof s>"u")return;const o=ct(i);delete s[o],Object.keys(s).length===0?this.messagesWithoutClientAck.delete(r):this.messagesWithoutClientAck.set(r,s),await this.persist()}),Xe(this,"del",async r=>{this.isInitialized(),this.messages.delete(r),this.messagesWithoutClientAck.delete(r),await this.persist()}),this.logger=ze(t,this.name),this.core=e}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(t){await this.core.storage.setItem(this.storageKey,co(t))}async setRelayerMessagesWithoutClientAck(t){await this.core.storage.setItem(this.storageKeyWithoutClientAck,co(t))}async getRelayerMessages(){const t=await this.core.storage.getItem(this.storageKey);return typeof t<"u"?lo(t):void 0}async getRelayerMessagesWithoutClientAck(){const t=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return typeof t<"u"?lo(t):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var o1=Object.defineProperty,a1=Object.defineProperties,c1=Object.getOwnPropertyDescriptors,Ol=Object.getOwnPropertySymbols,l1=Object.prototype.hasOwnProperty,u1=Object.prototype.propertyIsEnumerable,Oo=(n,t,e)=>t in n?o1(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,qn=(n,t)=>{for(var e in t||(t={}))l1.call(t,e)&&Oo(n,e,t[e]);if(Ol)for(var e of Ol(t))u1.call(t,e)&&Oo(n,e,t[e]);return n},Rl=(n,t)=>a1(n,c1(t)),ot=(n,t,e)=>Oo(n,typeof t!="symbol"?t+"":t,e);class h1 extends Iw{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,ot(this,"events",new Sn.EventEmitter),ot(this,"name",Qv),ot(this,"queue",new Map),ot(this,"publishTimeout",q.toMiliseconds(q.ONE_MINUTE)),ot(this,"initialPublishTimeout",q.toMiliseconds(q.ONE_SECOND*15)),ot(this,"needsTransportRestart",!1),ot(this,"publish",async(r,i,s)=>{var o,a,l,u,h;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:r,message:i,opts:s}});const d=(s==null?void 0:s.ttl)||Jv,f=(s==null?void 0:s.prompt)||!1,p=(s==null?void 0:s.tag)||0,w=(s==null?void 0:s.id)||vn().toString(),m=Kn(Mi().protocol),_={id:w,method:(s==null?void 0:s.publishMethod)||m.publish,params:qn({topic:r,message:i,ttl:d,prompt:f,tag:p,attestation:s==null?void 0:s.attestation},(s==null?void 0:s.tvf)&&{tvf:s.tvf})},g=`Failed to publish payload, please try again. id:${w} tag:${p}`;try{we((o=_.params)==null?void 0:o.prompt)&&((a=_.params)==null||delete a.prompt),we((l=_.params)==null?void 0:l.tag)&&((u=_.params)==null||delete u.tag);const v=new Promise(async y=>{const b=({id:D})=>{var S;((S=_.id)==null?void 0:S.toString())===D.toString()&&(this.removeRequestFromQueue(D),this.relayer.events.removeListener(ue.publish,b),y())};this.relayer.events.on(ue.publish,b);const I=Rt(new Promise((D,S)=>{this.rpcPublish(_,s).then(D).catch(x=>{this.logger.warn(x,x==null?void 0:x.message),S(x)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${w} tag:${p}`);try{await I,this.events.removeListener(ue.publish,b)}catch(D){this.queue.set(w,{request:_,opts:s,attempt:1}),this.logger.warn(D,D==null?void 0:D.message)}});this.logger.trace({type:"method",method:"publish",params:{id:w,topic:r,message:i,opts:s}}),await Rt(v,this.publishTimeout,g)}catch(v){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(v),(h=s==null?void 0:s.internal)!=null&&h.throwOnFailedPublish)throw v}finally{this.queue.delete(w)}}),ot(this,"publishCustom",async r=>{var i,s,o,a,l;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:r});const{payload:u,opts:h={}}=r,{attestation:d,tvf:f,publishMethod:p,prompt:w,tag:m,ttl:_=q.FIVE_MINUTES}=h,g=h.id||vn().toString(),v=Kn(Mi().protocol),y=p||v.publish,b={id:g,method:y,params:qn(Rl(qn({},u),{ttl:_,prompt:w,tag:m,attestation:d}),f)},I=`Failed to publish custom payload, please try again. id:${g} tag:${m}`;try{we((i=b.params)==null?void 0:i.prompt)&&((s=b.params)==null||delete s.prompt),we((o=b.params)==null?void 0:o.tag)&&((a=b.params)==null||delete a.tag);const D=new Promise(async S=>{const x=({id:A})=>{var T;((T=b.id)==null?void 0:T.toString())===A.toString()&&(this.removeRequestFromQueue(A),this.relayer.events.removeListener(ue.publish,x),S())};this.relayer.events.on(ue.publish,x);const E=Rt(new Promise((A,T)=>{this.rpcPublish(b,h).then(A).catch(P=>{this.logger.warn(P,P==null?void 0:P.message),T(P)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${y} id:${g} tag:${m}`);try{await E,this.events.removeListener(ue.publish,x)}catch(A){this.queue.set(g,{request:b,opts:h,attempt:1}),this.logger.warn(A,A==null?void 0:A.message)}});this.logger.trace({type:"method",method:"publish",params:{id:g,payload:u,opts:h}}),await Rt(D,this.publishTimeout,I)}catch(D){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(D),(l=h==null?void 0:h.internal)!=null&&l.throwOnFailedPublish)throw D}finally{this.queue.delete(g)}}),ot(this,"on",(r,i)=>{this.events.on(r,i)}),ot(this,"once",(r,i)=>{this.events.once(r,i)}),ot(this,"off",(r,i)=>{this.events.off(r,i)}),ot(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),this.relayer=t,this.logger=ze(e,this.name),this.registerEventListeners()}get context(){return rt(this.logger)}async rpcPublish(t,e){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:t});const r=await this.relayer.request(t);return this.relayer.events.emit(ue.publish,qn(qn({},t),e)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(t){this.queue.delete(t)}checkQueue(){this.queue.forEach(async(t,e)=>{var r;const i=t.attempt+1;this.queue.set(e,Rl(qn({},t),{attempt:i})),this.logger.warn({},`Publisher: queue->publishing: ${t.request.id}, tag: ${(r=t.request.params)==null?void 0:r.tag}, attempt: ${i}`),await this.rpcPublish(t.request,t.opts),this.logger.warn({},`Publisher: queue->published: ${t.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(Qn.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(ue.connection_stalled);return}this.checkQueue()}),this.relayer.on(ue.message_ack,t=>{this.removeRequestFromQueue(t.id.toString())})}}var d1=Object.defineProperty,f1=(n,t,e)=>t in n?d1(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,zn=(n,t,e)=>f1(n,typeof t!="symbol"?t+"":t,e);class p1{constructor(){zn(this,"map",new Map),zn(this,"set",(t,e)=>{const r=this.get(t);this.exists(t,e)||this.map.set(t,[...r,e])}),zn(this,"get",t=>this.map.get(t)||[]),zn(this,"exists",(t,e)=>this.get(t).includes(e)),zn(this,"delete",(t,e)=>{if(typeof e>"u"){this.map.delete(t);return}if(!this.map.has(t))return;const r=this.get(t);if(!this.exists(t,e))return;const i=r.filter(s=>s!==e);if(!i.length){this.map.delete(t);return}this.map.set(t,i)}),zn(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var _1=Object.defineProperty,w1=Object.defineProperties,m1=Object.getOwnPropertyDescriptors,Ll=Object.getOwnPropertySymbols,y1=Object.prototype.hasOwnProperty,g1=Object.prototype.propertyIsEnumerable,Ro=(n,t,e)=>t in n?_1(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,yr=(n,t)=>{for(var e in t||(t={}))y1.call(t,e)&&Ro(n,e,t[e]);if(Ll)for(var e of Ll(t))g1.call(t,e)&&Ro(n,e,t[e]);return n},Vs=(n,t)=>w1(n,m1(t)),se=(n,t,e)=>Ro(n,typeof t!="symbol"?t+"":t,e);class E1 extends Pw{constructor(t,e){super(t,e),this.relayer=t,this.logger=e,se(this,"subscriptions",new Map),se(this,"topicMap",new p1),se(this,"events",new Sn.EventEmitter),se(this,"name",sb),se(this,"version",ob),se(this,"pending",new Map),se(this,"cached",[]),se(this,"initialized",!1),se(this,"storagePrefix",Dt),se(this,"subscribeTimeout",q.toMiliseconds(q.ONE_MINUTE)),se(this,"initialSubscribeTimeout",q.toMiliseconds(q.ONE_SECOND*15)),se(this,"clientId"),se(this,"batchSubscribeTopicsLimit",500),se(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),se(this,"subscribe",async(r,i)=>{var s;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:i}});try{const o=Mi(i),a={topic:r,relay:o,transportType:i==null?void 0:i.transportType};(s=i==null?void 0:i.internal)!=null&&s.skipSubscribe||this.pending.set(r,a);const l=await this.rpcSubscribe(r,o,i);return typeof l=="string"&&(this.onSubscribe(l,a),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:r,opts:i}})),l}catch(o){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(o),o}}),se(this,"unsubscribe",async(r,i)=>{this.isInitialized(),typeof(i==null?void 0:i.id)<"u"?await this.unsubscribeById(r,i.id,i):await this.unsubscribeByTopic(r,i)}),se(this,"isSubscribed",r=>new Promise(i=>{i(this.topicMap.topics.includes(r))})),se(this,"isKnownTopic",r=>new Promise(i=>{i(this.topicMap.topics.includes(r)||this.pending.has(r)||this.cached.some(s=>s.topic===r))})),se(this,"on",(r,i)=>{this.events.on(r,i)}),se(this,"once",(r,i)=>{this.events.once(r,i)}),se(this,"off",(r,i)=>{this.events.off(r,i)}),se(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),se(this,"start",async()=>{await this.onConnect()}),se(this,"stop",async()=>{await this.onDisconnect()}),se(this,"restart",async()=>{await this.restore(),await this.onRestart()}),se(this,"checkPending",async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;const r=[];this.pending.forEach(i=>{r.push(i)}),await this.batchSubscribe(r)}),se(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(Qn.pulse,async()=>{await this.checkPending()}),this.events.on(et.created,async r=>{const i=et.created;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()}),this.events.on(et.deleted,async r=>{const i=et.deleted;this.logger.info(`Emitting ${i}`),this.logger.debug({type:"event",event:i,data:r}),await this.persist()})}),this.relayer=t,this.logger=ze(e,this.name),this.clientId=""}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(t,e){let r=!1;try{r=this.getSubscription(t).topic===e}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(t,e){const r=this.topicMap.get(t);await Promise.all(r.map(async i=>await this.unsubscribeById(t,i,e)))}async unsubscribeById(t,e,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}});try{const i=Mi(r);await this.restartToComplete({topic:t,id:e,relay:i}),await this.rpcUnsubscribe(t,e,i);const s=le("USER_DISCONNECTED",`${this.name}, ${t}`);await this.onUnsubscribe(t,e,s),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:t,id:e,opts:r}})}catch(i){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(i),i}}async rpcSubscribe(t,e,r){var i,s;const o=await this.getSubscriptionId(t);if((i=r==null?void 0:r.internal)!=null&&i.skipSubscribe)return o;(!r||(r==null?void 0:r.transportType)===ae.relay)&&await this.restartToComplete({topic:t,id:t,relay:e});const a={method:Kn(e.protocol).subscribe,params:{topic:t}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:a});const l=(s=r==null?void 0:r.internal)==null?void 0:s.throwOnFailedPublish;try{if((r==null?void 0:r.transportType)===ae.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(a).catch(d=>this.logger.warn(d))},q.toMiliseconds(q.ONE_SECOND)),o;const u=new Promise(async d=>{const f=p=>{p.topic===t&&(this.events.removeListener(et.created,f),d(p.id))};this.events.on(et.created,f);try{const p=await Rt(new Promise((w,m)=>{this.relayer.request(a).catch(_=>{this.logger.warn(_,_==null?void 0:_.message),m(_)}).then(w)}),this.initialSubscribeTimeout,`Subscribing to ${t} failed, please try again`);this.events.removeListener(et.created,f),d(p)}catch{}}),h=await Rt(u,this.subscribeTimeout,`Subscribing to ${t} failed, please try again`);if(!h&&l)throw new Error(`Subscribing to ${t} failed, please try again`);return h?o:null}catch(u){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(ue.connection_stalled),l)throw u}return null}async rpcBatchSubscribe(t){if(!t.length)return;const e=t[0].relay,r={method:Kn(e.protocol).batchSubscribe,params:{topics:t.map(i=>i.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{await await Rt(new Promise(i=>{this.relayer.request(r).catch(s=>this.logger.warn(s)).then(i)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(ue.connection_stalled)}}async rpcBatchFetchMessages(t){if(!t.length)return;const e=t[0].relay,r={method:Kn(e.protocol).batchFetchMessages,params:{topics:t.map(s=>s.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});let i;try{i=await await Rt(new Promise((s,o)=>{this.relayer.request(r).catch(a=>{this.logger.warn(a),o(a)}).then(s)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(ue.connection_stalled)}return i}rpcUnsubscribe(t,e,r){const i={method:Kn(r.protocol).unsubscribe,params:{topic:t,id:e}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(t,e){this.setSubscription(t,Vs(yr({},e),{id:t})),this.pending.delete(e.topic)}onBatchSubscribe(t){t.length&&t.forEach(e=>{this.setSubscription(e.id,yr({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(t,e,r){this.events.removeAllListeners(e),this.hasSubscription(e,t)&&this.deleteSubscription(e,r),await this.relayer.messages.del(t)}async setRelayerSubscriptions(t){await this.relayer.core.storage.setItem(this.storageKey,t)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(t,e){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:t,subscription:e}),this.addSubscription(t,e)}addSubscription(t,e){this.subscriptions.set(t,yr({},e)),this.topicMap.set(e.topic,t),this.events.emit(et.created,e)}getSubscription(t){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:t});const e=this.subscriptions.get(t);if(!e){const{message:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}deleteSubscription(t,e){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:t,reason:e});const r=this.getSubscription(t);this.subscriptions.delete(t),this.topicMap.delete(r.topic,t),this.events.emit(et.deleted,Vs(yr({},r),{reason:e}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(et.sync)}async onRestart(){if(this.cached.length){const t=[...this.cached],e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<e;r++){const i=t.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(i)}}this.events.emit(et.resubscribed)}async restore(){try{const t=await this.getRelayerSubscriptions();if(typeof t>"u"||!t.length)return;if(this.subscriptions.size&&!t.every(e=>{var r;return e.topic===((r=this.subscriptions.get(e.id))==null?void 0:r.topic)})){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(t){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(t)}}async batchSubscribe(t){t.length&&(await this.rpcBatchSubscribe(t),this.onBatchSubscribe(await Promise.all(t.map(async e=>Vs(yr({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(t){if(!t.length)return;this.logger.trace(`Fetching batch messages for ${t.length} subscriptions`);const e=await this.rpcBatchFetchMessages(t);e&&e.messages&&(await Qy(q.toMiliseconds(q.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(e.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async restartToComplete(t){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(t),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(t){return ct(t+await this.getClientId())}}var v1=Object.defineProperty,Dl=Object.getOwnPropertySymbols,b1=Object.prototype.hasOwnProperty,I1=Object.prototype.propertyIsEnumerable,Lo=(n,t,e)=>t in n?v1(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,xl=(n,t)=>{for(var e in t||(t={}))b1.call(t,e)&&Lo(n,e,t[e]);if(Dl)for(var e of Dl(t))I1.call(t,e)&&Lo(n,e,t[e]);return n},X=(n,t,e)=>Lo(n,typeof t!="symbol"?t+"":t,e);class A1 extends Aw{constructor(t){super(t),X(this,"protocol","wc"),X(this,"version",2),X(this,"core"),X(this,"logger"),X(this,"events",new Sn.EventEmitter),X(this,"provider"),X(this,"messages"),X(this,"subscriber"),X(this,"publisher"),X(this,"name",eb),X(this,"transportExplicitlyClosed",!1),X(this,"initialized",!1),X(this,"connectionAttemptInProgress",!1),X(this,"relayUrl"),X(this,"projectId"),X(this,"packageName"),X(this,"bundleId"),X(this,"hasExperiencedNetworkDisruption",!1),X(this,"pingTimeout"),X(this,"heartBeatTimeout",q.toMiliseconds(q.THIRTY_SECONDS+q.FIVE_SECONDS)),X(this,"reconnectTimeout"),X(this,"connectPromise"),X(this,"reconnectInProgress",!1),X(this,"requestsInFlight",[]),X(this,"connectTimeout",q.toMiliseconds(q.ONE_SECOND*15)),X(this,"request",async e=>{var r,i;this.logger.debug("Publishing Request Payload");const s=e.id||vn().toString();await this.toEstablishConnection();try{this.logger.trace({id:s,method:e.method,topic:(r=e.params)==null?void 0:r.topic},"relayer.request - publishing...");const o=`${s}:${((i=e.params)==null?void 0:i.tag)||""}`;this.requestsInFlight.push(o);const a=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(l=>l!==o),a}catch(o){throw this.logger.debug(`Failed to Publish Request: ${s}`),o}}),X(this,"resetPingTimeout",()=>{Ui()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,r,i,s;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),(s=(i=(r=(e=this.provider)==null?void 0:e.connection)==null?void 0:r.socket)==null?void 0:i.terminate)==null||s.call(i)}catch(o){this.logger.warn(o,o==null?void 0:o.message)}},this.heartBeatTimeout))}),X(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),X(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected 🛜"),this.startPingTimeout(),this.events.emit(ue.connect)}),X(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected 🛑"),this.requestsInFlight=[],this.onProviderDisconnect()}),X(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(ue.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),X(this,"registerProviderListeners",()=>{this.provider.on(st.payload,this.onPayloadHandler),this.provider.on(st.connect,this.onConnectHandler),this.provider.on(st.disconnect,this.onDisconnectHandler),this.provider.on(st.error,this.onProviderErrorHandler)}),this.core=t.core,this.logger=typeof t.logger<"u"&&typeof t.logger!="string"?ze(t.logger,this.name):hu(Ko({level:t.logger||Xv})),this.messages=new s1(this.logger,t.core),this.subscriber=new E1(this,this.logger),this.publisher=new h1(this,this.logger),this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Sd,Uy()?this.packageName=Oc():ky()&&(this.bundleId=Oc()),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(t=>this.logger.warn(t,t==null?void 0:t.message))}get context(){return rt(this.logger)}get connected(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===1||!1}get connecting(){var t,e,r;return((r=(e=(t=this.provider)==null?void 0:t.connection)==null?void 0:e.socket)==null?void 0:r.readyState)===0||this.connectPromise!==void 0||!1}async publish(t,e,r){this.isInitialized(),await this.publisher.publish(t,e,r),await this.recordMessageEvent({topic:t,message:e,publishedAt:Date.now(),transportType:ae.relay},Ei.outbound)}async publishCustom(t){this.isInitialized(),await this.publisher.publishCustom(t)}async subscribe(t,e){var r,i,s;this.isInitialized(),(!(e!=null&&e.transportType)||(e==null?void 0:e.transportType)==="relay")&&await this.toEstablishConnection();const o=typeof((r=e==null?void 0:e.internal)==null?void 0:r.throwOnFailedPublish)>"u"?!0:(i=e==null?void 0:e.internal)==null?void 0:i.throwOnFailedPublish;let a=((s=this.subscriber.topicMap.get(t))==null?void 0:s[0])||"",l;const u=h=>{h.topic===t&&(this.subscriber.off(et.created,u),l())};return await Promise.all([new Promise(h=>{l=h,this.subscriber.on(et.created,u)}),new Promise(async(h,d)=>{a=await this.subscriber.subscribe(t,xl({internal:{throwOnFailedPublish:o}},e)).catch(f=>{o&&d(f)})||a,h()})]),a}async unsubscribe(t,e){this.isInitialized(),await this.subscriber.unsubscribe(t,e)}on(t,e){this.events.on(t,e)}once(t,e){this.events.once(t,e)}off(t,e){this.events.off(t,e)}removeListener(t,e){this.events.removeListener(t,e)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await Rt(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(t){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(e,r)=>{await this.connect(t).then(e).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(t){this.logger.debug({},"Restarting transport..."),!this.connectionAttemptInProgress&&(this.relayUrl=t||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await ml())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(t){if((t==null?void 0:t.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const e=t.sort((r,i)=>r.publishedAt-i.publishedAt);this.logger.debug(`Batch of ${e.length} message events sorted`);for(const r of e)try{await this.onMessageEvent(r)}catch(i){this.logger.warn(i,"Error while processing batch message event: "+(i==null?void 0:i.message))}this.logger.trace(`Batch of ${e.length} message events processed`)}async onLinkMessageEvent(t,e){const{topic:r}=t;if(!e.sessionExists){const i=_e(q.FIVE_MINUTES),s={topic:r,expiry:i,relay:{protocol:"irn"},active:!1};await this.core.pairing.pairings.set(r,s)}this.events.emit(ue.message,t),await this.recordMessageEvent(t,Ei.inbound)}async connect(t){await this.confirmOnlineStateOrThrow(),t&&t!==this.relayUrl&&(this.relayUrl=t,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let e=1;for(;e<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${e}...`),await this.createProvider(),await new Promise(async(r,i)=>{const s=()=>{i(new Error("Connection interrupted while trying to connect"))};this.provider.once(st.disconnect,s),await Rt(new Promise((o,a)=>{this.provider.connect().then(o).catch(a)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(o=>{i(o)}).finally(()=>{this.provider.off(st.disconnect,s),clearTimeout(this.reconnectTimeout)}),await new Promise(async(o,a)=>{const l=()=>{i(new Error("Connection interrupted while trying to subscribe"))};this.provider.once(st.disconnect,l),await this.subscriber.start().then(o).catch(a).finally(()=>{this.provider.off(st.disconnect,l)})}),this.hasExperiencedNetworkDisruption=!1,r()})}catch(r){await this.subscriber.stop();const i=r;this.logger.warn({},i.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${e}`);break}await new Promise(r=>setTimeout(r,q.toMiliseconds(e*1))),e++}}startPingTimeout(){var t,e,r,i,s;if(Ui())try{(e=(t=this.provider)==null?void 0:t.connection)!=null&&e.socket&&((s=(i=(r=this.provider)==null?void 0:r.connection)==null?void 0:i.socket)==null||s.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o==null?void 0:o.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const t=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Xf(new ep(zy({sdkVersion:Io,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:t,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(t,e){const{topic:r,message:i}=t;await this.messages.set(r,i,e)}async shouldIgnoreMessageEvent(t){const{topic:e,message:r}=t;if(!r||r.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(e))return this.logger.warn(`Ignoring message for unknown topic ${e}`),!0;const i=this.messages.has(e,r);return i&&this.logger.warn(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(t){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:t}),Fo(t)){if(!t.method.endsWith(tb))return;const e=t.params,{topic:r,message:i,publishedAt:s,attestation:o}=e.data,a={topic:r,message:i,publishedAt:s,transportType:ae.relay,attestation:o};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(xl({type:"event",event:e.id},a)),this.events.emit(e.id,a),await this.acknowledgePayload(t),await this.onMessageEvent(a)}else Ho(t)&&this.events.emit(ue.message_ack,t)}async onMessageEvent(t){await this.shouldIgnoreMessageEvent(t)||(await this.recordMessageEvent(t,Ei.inbound),this.events.emit(ue.message,t))}async acknowledgePayload(t){const e=Ti(t.id,!0);await this.provider.connection.send(e)}unregisterProviderListeners(){this.provider.off(st.payload,this.onPayloadHandler),this.provider.off(st.connect,this.onConnectHandler),this.provider.off(st.disconnect,this.onDisconnectHandler),this.provider.off(st.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let t=await ml();Dv(async e=>{t!==e&&(t=e,e?await this.transportOpen().catch(r=>this.logger.error(r,r==null?void 0:r.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(Qn.pulse,async()=>{if(!this.transportExplicitlyClosed&&!this.connected&&Sv())try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e==null?void 0:e.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(ue.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(t=>this.logger.error(t,t==null?void 0:t.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},q.toMiliseconds(nb)))))}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function T1(n,t){return n===t||Number.isNaN(n)&&Number.isNaN(t)}function Vl(n){return Object.getOwnPropertySymbols(n).filter(t=>Object.prototype.propertyIsEnumerable.call(n,t))}function Sl(n){return n==null?n===void 0?"[object Undefined]":"[object Null]":Object.prototype.toString.call(n)}const P1="[object RegExp]",O1="[object String]",R1="[object Number]",L1="[object Boolean]",Cl="[object Arguments]",D1="[object Symbol]",x1="[object Date]",V1="[object Map]",S1="[object Set]",C1="[object Array]",$1="[object Function]",U1="[object ArrayBuffer]",Ss="[object Object]",k1="[object Error]",B1="[object DataView]",N1="[object Uint8Array]",M1="[object Uint8ClampedArray]",q1="[object Uint16Array]",z1="[object Uint32Array]",j1="[object BigUint64Array]",K1="[object Int8Array]",F1="[object Int16Array]",H1="[object Int32Array]",W1="[object BigInt64Array]",G1="[object Float32Array]",Z1="[object Float64Array]";function Y1(){}function $l(n){if(!n||typeof n!="object")return!1;const t=Object.getPrototypeOf(n);return t===null||t===Object.prototype||Object.getPrototypeOf(t)===null?Object.prototype.toString.call(n)==="[object Object]":!1}function J1(n,t,e){return Ar(n,t,void 0,void 0,void 0,void 0,e)}function Ar(n,t,e,r,i,s,o){const a=o(n,t,e,r,i,s);if(a!==void 0)return a;if(typeof n==typeof t)switch(typeof n){case"bigint":case"string":case"boolean":case"symbol":case"undefined":return n===t;case"number":return n===t||Object.is(n,t);case"function":return n===t;case"object":return Vr(n,t,s,o)}return Vr(n,t,s,o)}function Vr(n,t,e,r){if(Object.is(n,t))return!0;let i=Sl(n),s=Sl(t);if(i===Cl&&(i=Ss),s===Cl&&(s=Ss),i!==s)return!1;switch(i){case O1:return n.toString()===t.toString();case R1:{const l=n.valueOf(),u=t.valueOf();return T1(l,u)}case L1:case x1:case D1:return Object.is(n.valueOf(),t.valueOf());case P1:return n.source===t.source&&n.flags===t.flags;case $1:return n===t}e=e??new Map;const o=e.get(n),a=e.get(t);if(o!=null&&a!=null)return o===t;e.set(n,t),e.set(t,n);try{switch(i){case V1:{if(n.size!==t.size)return!1;for(const[l,u]of n.entries())if(!t.has(l)||!Ar(u,t.get(l),l,n,t,e,r))return!1;return!0}case S1:{if(n.size!==t.size)return!1;const l=Array.from(n.values()),u=Array.from(t.values());for(let h=0;h<l.length;h++){const d=l[h],f=u.findIndex(p=>Ar(d,p,void 0,n,t,e,r));if(f===-1)return!1;u.splice(f,1)}return!0}case C1:case N1:case M1:case q1:case z1:case j1:case K1:case F1:case H1:case W1:case G1:case Z1:{if(typeof Buffer<"u"&&Buffer.isBuffer(n)!==Buffer.isBuffer(t)||n.length!==t.length)return!1;for(let l=0;l<n.length;l++)if(!Ar(n[l],t[l],l,n,t,e,r))return!1;return!0}case U1:return n.byteLength!==t.byteLength?!1:Vr(new Uint8Array(n),new Uint8Array(t),e,r);case B1:return n.byteLength!==t.byteLength||n.byteOffset!==t.byteOffset?!1:Vr(new Uint8Array(n),new Uint8Array(t),e,r);case k1:return n.name===t.name&&n.message===t.message;case Ss:{if(!(Vr(n.constructor,t.constructor,e,r)||$l(n)&&$l(t)))return!1;const l=[...Object.keys(n),...Vl(n)],u=[...Object.keys(t),...Vl(t)];if(l.length!==u.length)return!1;for(let h=0;h<l.length;h++){const d=l[h],f=n[d];if(!Object.hasOwn(t,d))return!1;const p=t[d];if(!Ar(f,p,d,n,t,e,r))return!1}return!0}default:return!1}}finally{e.delete(n),e.delete(t)}}function Q1(n,t){return J1(n,t,Y1)}var X1=Object.defineProperty,Ul=Object.getOwnPropertySymbols,eA=Object.prototype.hasOwnProperty,tA=Object.prototype.propertyIsEnumerable,Do=(n,t,e)=>t in n?X1(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,kl=(n,t)=>{for(var e in t||(t={}))eA.call(t,e)&&Do(n,e,t[e]);if(Ul)for(var e of Ul(t))tA.call(t,e)&&Do(n,e,t[e]);return n},je=(n,t,e)=>Do(n,typeof t!="symbol"?t+"":t,e);class Un extends Tw{constructor(t,e,r,i=Dt,s=void 0){super(t,e,r,i),this.core=t,this.logger=e,this.name=r,je(this,"map",new Map),je(this,"version",rb),je(this,"cached",[]),je(this,"initialized",!1),je(this,"getKey"),je(this,"storagePrefix",Dt),je(this,"recentlyDeleted",[]),je(this,"recentlyDeletedLimit",200),je(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(o=>{this.getKey&&o!==null&&!we(o)?this.map.set(this.getKey(o),o):av(o)?this.map.set(o.id,o):cv(o)&&this.map.set(o.topic,o)}),this.cached=[],this.initialized=!0)}),je(this,"set",async(o,a)=>{this.isInitialized(),this.map.has(o)?await this.update(o,a):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:o,value:a}),this.map.set(o,a),await this.persist())}),je(this,"get",o=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:o}),this.getData(o))),je(this,"getAll",o=>(this.isInitialized(),o?this.values.filter(a=>Object.keys(o).every(l=>Q1(a[l],o[l]))):this.values)),je(this,"update",async(o,a)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:o,update:a});const l=kl(kl({},this.getData(o)),a);this.map.set(o,l),await this.persist()}),je(this,"delete",async(o,a)=>{this.isInitialized(),this.map.has(o)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:o,reason:a}),this.map.delete(o),this.addToRecentlyDeleted(o),await this.persist())}),this.logger=ze(e,this.name),this.storagePrefix=i,this.getKey=s}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(t){this.recentlyDeleted.push(t),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(t){await this.core.storage.setItem(this.storageKey,t)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(t){const e=this.map.get(t);if(!e){if(this.recentlyDeleted.includes(t)){const{message:i}=N("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${t}`);throw this.logger.error(i),new Error(i)}const{message:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.error(r),new Error(r)}return e}async persist(){await this.setDataStore(this.values)}async restore(){try{const t=await this.getDataStore();if(typeof t>"u"||!t.length)return;if(this.map.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(t){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var nA=Object.defineProperty,rA=(n,t,e)=>t in n?nA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Z=(n,t,e)=>rA(n,typeof t!="symbol"?t+"":t,e);class iA{constructor(t,e){this.core=t,this.logger=e,Z(this,"name",ab),Z(this,"version",cb),Z(this,"events",new lu),Z(this,"pairings"),Z(this,"initialized",!1),Z(this,"storagePrefix",Dt),Z(this,"ignoredPayloadTypes",[zt]),Z(this,"registeredMethods",[]),Z(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),Z(this,"register",({methods:r})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...r])]}),Z(this,"create",async r=>{this.isInitialized();const i=Eo(),s=await this.core.crypto.setSymKey(i),o=_e(q.FIVE_MINUTES),a={protocol:Vd},l={topic:s,expiry:o,relay:a,active:!1,methods:r==null?void 0:r.methods},u=cl({protocol:this.core.protocol,version:this.core.version,topic:s,symKey:i,relay:a,expiryTimestamp:o,methods:r==null?void 0:r.methods});return this.events.emit(En.create,l),this.core.expirer.set(s,o),await this.pairings.set(s,l),await this.core.relayer.subscribe(s,{transportType:r==null?void 0:r.transportType,internal:r==null?void 0:r.internal}),{topic:s,uri:u}}),Z(this,"pair",async r=>{this.isInitialized();const i=this.core.eventClient.createEvent({properties:{topic:r==null?void 0:r.uri,trace:[Tt.pairing_started]}});this.isValidPair(r,i);const{topic:s,symKey:o,relay:a,expiryTimestamp:l,methods:u}=al(r.uri);i.props.properties.topic=s,i.addTrace(Tt.pairing_uri_validation_success),i.addTrace(Tt.pairing_uri_not_expired);let h;if(this.pairings.keys.includes(s)){if(h=this.pairings.get(s),i.addTrace(Tt.existing_pairing),h.active)throw i.setError(kt.active_pairing_already_exists),new Error(`Pairing already exists: ${s}. Please try again with a new connection URI.`);i.addTrace(Tt.pairing_not_expired)}const d=l||_e(q.FIVE_MINUTES),f={topic:s,relay:a,expiry:d,active:!1,methods:u};this.core.expirer.set(s,d),await this.pairings.set(s,f),i.addTrace(Tt.store_new_pairing),r.activatePairing&&await this.activate({topic:s}),this.events.emit(En.create,f),i.addTrace(Tt.emit_inactive_pairing),this.core.crypto.keychain.has(s)||await this.core.crypto.setSymKey(o,s),i.addTrace(Tt.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{i.setError(kt.no_internet_connection)}try{await this.core.relayer.subscribe(s,{relay:a})}catch(p){throw i.setError(kt.subscribe_pairing_topic_failure),p}return i.addTrace(Tt.subscribe_pairing_topic_success),f}),Z(this,"activate",async({topic:r})=>{this.isInitialized();const i=_e(q.FIVE_MINUTES);this.core.expirer.set(r,i),await this.pairings.update(r,{active:!0,expiry:i})}),Z(this,"ping",async r=>{this.isInitialized(),await this.isValidPing(r),this.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:i}=r;if(this.pairings.keys.includes(i)){const s=await this.sendRequest(i,"wc_pairingPing",{}),{done:o,resolve:a,reject:l}=yn();this.events.once(ne("pairing_ping",s),({error:u})=>{u?l(u):a()}),await o()}}),Z(this,"updateExpiry",async({topic:r,expiry:i})=>{this.isInitialized(),await this.pairings.update(r,{expiry:i})}),Z(this,"updateMetadata",async({topic:r,metadata:i})=>{this.isInitialized(),await this.pairings.update(r,{peerMetadata:i})}),Z(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),Z(this,"disconnect",async r=>{this.isInitialized(),await this.isValidDisconnect(r);const{topic:i}=r;this.pairings.keys.includes(i)&&(await this.sendRequest(i,"wc_pairingDelete",le("USER_DISCONNECTED")),await this.deletePairing(i))}),Z(this,"formatUriFromPairing",r=>{this.isInitialized();const{topic:i,relay:s,expiry:o,methods:a}=r,l=this.core.crypto.keychain.get(i);return cl({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:l,relay:s,expiryTimestamp:o,methods:a})}),Z(this,"sendRequest",async(r,i,s)=>{const o=sn(i,s),a=await this.core.crypto.encode(r,o),l=_r[i].req;return this.core.history.set(r,o),this.core.relayer.publish(r,a,l),o.id}),Z(this,"sendResult",async(r,i,s)=>{const o=Ti(r,s),a=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,r)).request.method,u=_r[l].res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)}),Z(this,"sendError",async(r,i,s)=>{const o=du(r,s),a=await this.core.crypto.encode(i,o),l=(await this.core.history.get(i,r)).request.method,u=_r[l]?_r[l].res:_r.unregistered_method.res;await this.core.relayer.publish(i,a,u),await this.core.history.resolve(o)}),Z(this,"deletePairing",async(r,i)=>{await this.core.relayer.unsubscribe(r),await Promise.all([this.pairings.delete(r,le("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(r),i?Promise.resolve():this.core.expirer.del(r)])}),Z(this,"cleanup",async()=>{const r=this.pairings.getAll().filter(i=>on(i.expiry));await Promise.all(r.map(i=>this.deletePairing(i.topic)))}),Z(this,"onRelayEventRequest",async r=>{const{topic:i,payload:s}=r;switch(s.method){case"wc_pairingPing":return await this.onPairingPingRequest(i,s);case"wc_pairingDelete":return await this.onPairingDeleteRequest(i,s);default:return await this.onUnknownRpcMethodRequest(i,s)}}),Z(this,"onRelayEventResponse",async r=>{const{topic:i,payload:s}=r,o=(await this.core.history.get(i,s.id)).request.method;switch(o){case"wc_pairingPing":return this.onPairingPingResponse(i,s);default:return this.onUnknownRpcMethodResponse(o)}}),Z(this,"onPairingPingRequest",async(r,i)=>{const{id:s}=i;try{this.isValidPing({topic:r}),await this.sendResult(s,r,!0),this.events.emit(En.ping,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),Z(this,"onPairingPingResponse",(r,i)=>{const{id:s}=i;setTimeout(()=>{$t(i)?this.events.emit(ne("pairing_ping",s),{}):Pt(i)&&this.events.emit(ne("pairing_ping",s),{error:i.error})},500)}),Z(this,"onPairingDeleteRequest",async(r,i)=>{const{id:s}=i;try{this.isValidDisconnect({topic:r}),await this.deletePairing(r),this.events.emit(En.delete,{id:s,topic:r})}catch(o){await this.sendError(s,r,o),this.logger.error(o)}}),Z(this,"onUnknownRpcMethodRequest",async(r,i)=>{const{id:s,method:o}=i;try{if(this.registeredMethods.includes(o))return;const a=le("WC_METHOD_UNSUPPORTED",o);await this.sendError(s,r,a),this.logger.error(a)}catch(a){await this.sendError(s,r,a),this.logger.error(a)}}),Z(this,"onUnknownRpcMethodResponse",r=>{this.registeredMethods.includes(r)||this.logger.error(le("WC_METHOD_UNSUPPORTED",r))}),Z(this,"isValidPair",(r,i)=>{var s;if(!Fe(r)){const{message:a}=N("MISSING_OR_INVALID",`pair() params: ${r}`);throw i.setError(kt.malformed_pairing_uri),new Error(a)}if(!ov(r.uri)){const{message:a}=N("MISSING_OR_INVALID",`pair() uri: ${r.uri}`);throw i.setError(kt.malformed_pairing_uri),new Error(a)}const o=al(r==null?void 0:r.uri);if(!((s=o==null?void 0:o.relay)!=null&&s.protocol)){const{message:a}=N("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError(kt.malformed_pairing_uri),new Error(a)}if(!(o!=null&&o.symKey)){const{message:a}=N("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError(kt.malformed_pairing_uri),new Error(a)}if(o!=null&&o.expiryTimestamp&&q.toMiliseconds(o==null?void 0:o.expiryTimestamp)<Date.now()){i.setError(kt.pairing_expired);const{message:a}=N("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(a)}}),Z(this,"isValidPing",async r=>{if(!Fe(r)){const{message:s}=N("MISSING_OR_INVALID",`ping() params: ${r}`);throw new Error(s)}const{topic:i}=r;await this.isValidPairingTopic(i)}),Z(this,"isValidDisconnect",async r=>{if(!Fe(r)){const{message:s}=N("MISSING_OR_INVALID",`disconnect() params: ${r}`);throw new Error(s)}const{topic:i}=r;await this.isValidPairingTopic(i)}),Z(this,"isValidPairingTopic",async r=>{if(!fe(r,!1)){const{message:i}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${r}`);throw new Error(i)}if(!this.pairings.keys.includes(r)){const{message:i}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${r}`);throw new Error(i)}if(on(this.pairings.get(r).expiry)){await this.deletePairing(r);const{message:i}=N("EXPIRED",`pairing topic: ${r}`);throw new Error(i)}}),this.core=t,this.logger=ze(e,this.name),this.pairings=new Un(this.core,this.logger,this.name,this.storagePrefix)}get context(){return rt(this.logger)}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}registerRelayerEvents(){this.core.relayer.on(ue.message,async t=>{const{topic:e,message:r,transportType:i}=t;if(this.pairings.keys.includes(e)&&i!==ae.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{const s=await this.core.crypto.decode(e,r);Fo(s)?(this.core.history.set(e,s),await this.onRelayEventRequest({topic:e,payload:s})):Ho(s)&&(await this.core.history.resolve(s),await this.onRelayEventResponse({topic:e,payload:s}),this.core.history.delete(e,s.id)),await this.core.relayer.messages.ack(e,r)}catch(s){this.logger.error(s)}})}registerExpirerEvents(){this.core.expirer.on(at.expired,async t=>{const{topic:e}=Uh(t.target);e&&this.pairings.keys.includes(e)&&(await this.deletePairing(e,!0),this.events.emit(En.expire,{topic:e}))})}}var sA=Object.defineProperty,oA=(n,t,e)=>t in n?sA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Pe=(n,t,e)=>oA(n,typeof t!="symbol"?t+"":t,e);class aA extends vw{constructor(t,e){super(t,e),this.core=t,this.logger=e,Pe(this,"records",new Map),Pe(this,"events",new Sn.EventEmitter),Pe(this,"name",lb),Pe(this,"version",ub),Pe(this,"cached",[]),Pe(this,"initialized",!1),Pe(this,"storagePrefix",Dt),Pe(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.records.set(r.id,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),Pe(this,"set",(r,i,s)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:r,request:i,chainId:s}),this.records.has(i.id))return;const o={id:i.id,topic:r,request:{method:i.method,params:i.params||null},chainId:s,expiry:_e(q.THIRTY_DAYS)};this.records.set(o.id,o),this.persist(),this.events.emit(ft.created,o)}),Pe(this,"resolve",async r=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:r}),!this.records.has(r.id))return;const i=await this.getRecord(r.id);typeof i.response>"u"&&(i.response=Pt(r)?{error:r.error}:{result:r.result},this.records.set(i.id,i),this.persist(),this.events.emit(ft.updated,i))}),Pe(this,"get",async(r,i)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:r,id:i}),await this.getRecord(i))),Pe(this,"delete",(r,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}),this.values.forEach(s=>{if(s.topic===r){if(typeof i<"u"&&s.id!==i)return;this.records.delete(s.id),this.events.emit(ft.deleted,s)}}),this.persist()}),Pe(this,"exists",async(r,i)=>(this.isInitialized(),this.records.has(i)?(await this.getRecord(i)).topic===r:!1)),Pe(this,"on",(r,i)=>{this.events.on(r,i)}),Pe(this,"once",(r,i)=>{this.events.once(r,i)}),Pe(this,"off",(r,i)=>{this.events.off(r,i)}),Pe(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),this.logger=ze(e,this.name)}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){const t=[];return this.values.forEach(e=>{if(typeof e.response<"u")return;const r={topic:e.topic,request:sn(e.request.method,e.request.params,e.id),chainId:e.chainId};return t.push(r)}),t}async setJsonRpcRecords(t){await this.core.storage.setItem(this.storageKey,t)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(t){this.isInitialized();const e=this.records.get(t);if(!e){const{message:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw new Error(r)}return e}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(ft.sync)}async restore(){try{const t=await this.getJsonRpcRecords();if(typeof t>"u"||!t.length)return;if(this.records.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(t){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(t)}}registerEventListeners(){this.events.on(ft.created,t=>{const e=ft.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(ft.updated,t=>{const e=ft.updated;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.events.on(ft.deleted,t=>{const e=ft.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,record:t})}),this.core.heartbeat.on(Qn.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let t=!1;this.records.forEach(e=>{q.toMiliseconds(e.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${e.id}`),this.records.delete(e.id),this.events.emit(ft.deleted,e,!1),t=!0)}),t&&this.persist()}catch(t){this.logger.warn(t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var cA=Object.defineProperty,lA=(n,t,e)=>t in n?cA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,$e=(n,t,e)=>lA(n,typeof t!="symbol"?t+"":t,e);class uA extends Ow{constructor(t,e){super(t,e),this.core=t,this.logger=e,$e(this,"expirations",new Map),$e(this,"events",new Sn.EventEmitter),$e(this,"name",hb),$e(this,"version",db),$e(this,"cached",[]),$e(this,"initialized",!1),$e(this,"storagePrefix",Dt),$e(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(r=>this.expirations.set(r.target,r)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),$e(this,"has",r=>{try{const i=this.formatTarget(r);return typeof this.getExpiration(i)<"u"}catch{return!1}}),$e(this,"set",(r,i)=>{this.isInitialized();const s=this.formatTarget(r),o={target:s,expiry:i};this.expirations.set(s,o),this.checkExpiry(s,o),this.events.emit(at.created,{target:s,expiration:o})}),$e(this,"get",r=>{this.isInitialized();const i=this.formatTarget(r);return this.getExpiration(i)}),$e(this,"del",r=>{if(this.isInitialized(),this.has(r)){const i=this.formatTarget(r),s=this.getExpiration(i);this.expirations.delete(i),this.events.emit(at.deleted,{target:i,expiration:s})}}),$e(this,"on",(r,i)=>{this.events.on(r,i)}),$e(this,"once",(r,i)=>{this.events.once(r,i)}),$e(this,"off",(r,i)=>{this.events.off(r,i)}),$e(this,"removeListener",(r,i)=>{this.events.removeListener(r,i)}),this.logger=ze(e,this.name)}get context(){return rt(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(t){if(typeof t=="string")return jy(t);if(typeof t=="number")return Ky(t);const{message:e}=N("UNKNOWN_TYPE",`Target type: ${typeof t}`);throw new Error(e)}async setExpirations(t){await this.core.storage.setItem(this.storageKey,t)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(at.sync)}async restore(){try{const t=await this.getExpirations();if(typeof t>"u"||!t.length)return;if(this.expirations.size){const{message:e}=N("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),new Error(e)}this.cached=t,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(t){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(t)}}getExpiration(t){const e=this.expirations.get(t);if(!e){const{message:r}=N("NO_MATCHING_KEY",`${this.name}: ${t}`);throw this.logger.warn(r),new Error(r)}return e}checkExpiry(t,e){const{expiry:r}=e;q.toMiliseconds(r)-Date.now()<=0&&this.expire(t,e)}expire(t,e){this.expirations.delete(t),this.events.emit(at.expired,{target:t,expiration:e})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((t,e)=>this.checkExpiry(e,t))}registerEventListeners(){this.core.heartbeat.on(Qn.pulse,()=>this.checkExpirations()),this.events.on(at.created,t=>{const e=at.created;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(at.expired,t=>{const e=at.expired;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()}),this.events.on(at.deleted,t=>{const e=at.deleted;this.logger.info(`Emitting ${e}`),this.logger.debug({type:"event",event:e,data:t}),this.persist()})}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}}var hA=Object.defineProperty,dA=(n,t,e)=>t in n?hA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,de=(n,t,e)=>dA(n,typeof t!="symbol"?t+"":t,e);class fA extends Rw{constructor(t,e,r){super(t,e,r),this.core=t,this.logger=e,this.store=r,de(this,"name",fb),de(this,"abortController"),de(this,"isDevEnv"),de(this,"verifyUrlV3",_b),de(this,"storagePrefix",Dt),de(this,"version",xd),de(this,"publicKey"),de(this,"fetchPromise"),de(this,"init",async()=>{var i;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&q.toMiliseconds((i=this.publicKey)==null?void 0:i.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),de(this,"register",async i=>{if(!nr()||this.isDevEnv)return;const s=window.location.origin,{id:o,decryptedId:a}=i,l=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${s}&id=${o}&decryptedId=${a}`;try{const u=Hn(),h=this.startAbortTimer(q.ONE_SECOND*5),d=await new Promise((f,p)=>{const w=()=>{window.removeEventListener("message",_),u.body.removeChild(m),p("attestation aborted")};this.abortController.signal.addEventListener("abort",w);const m=u.createElement("iframe");m.src=l,m.style.display="none",m.addEventListener("error",w,{signal:this.abortController.signal});const _=g=>{if(g.data&&typeof g.data=="string")try{const v=JSON.parse(g.data);if(v.type==="verify_attestation"){if(Ks(v.attestation).payload.id!==o)return;clearInterval(h),u.body.removeChild(m),this.abortController.signal.removeEventListener("abort",w),window.removeEventListener("message",_),f(v.attestation===null?"":v.attestation)}}catch(v){this.logger.warn(v)}};u.body.appendChild(m),window.addEventListener("message",_,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",d),d}catch(u){this.logger.warn(u)}return""}),de(this,"resolve",async i=>{if(this.isDevEnv)return"";const{attestationId:s,hash:o,encryptedId:a}=i;if(s===""){this.logger.debug("resolve: attestationId is empty, skipping");return}if(s){if(Ks(s).payload.id!==a)return;const u=await this.isValidJwtAttestation(s);if(u){if(!u.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return u}}if(!o)return;const l=this.getVerifyUrl(i==null?void 0:i.verifyUrl);return this.fetchAttestation(o,l)}),de(this,"fetchAttestation",async(i,s)=>{this.logger.debug(`resolving attestation: ${i} from url: ${s}`);const o=this.startAbortTimer(q.ONE_SECOND*5),a=await fetch(`${s}/attestation/${i}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(o),a.status===200?await a.json():void 0}),de(this,"getVerifyUrl",i=>{let s=i||xr;return wb.includes(s)||(this.logger.info(`verify url: ${s}, not included in trusted list, assigning default: ${xr}`),s=xr),s}),de(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);const i=this.startAbortTimer(q.FIVE_SECONDS),s=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(i),await s.json()}catch(i){this.logger.warn(i)}}),de(this,"persistPublicKey",async i=>{this.logger.debug("persisting public key to local storage",i),await this.store.setItem(this.storeKey,i),this.publicKey=i}),de(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),de(this,"isValidJwtAttestation",async i=>{const s=await this.getPublicKey();try{if(s)return this.validateAttestation(i,s)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}const o=await this.fetchAndPersistPublicKey();try{if(o)return this.validateAttestation(i,o)}catch(a){this.logger.error(a),this.logger.warn("error validating attestation")}}),de(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),de(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async s=>{const o=await this.fetchPublicKey();o&&(await this.persistPublicKey(o),s(o))});const i=await this.fetchPromise;return this.fetchPromise=void 0,i}),de(this,"validateAttestation",(i,s)=>{const o=BE(i,s.publicKey),a={hasExpired:q.toMiliseconds(o.exp)<Date.now(),payload:o};if(a.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:a.payload.origin,isScam:a.payload.isScam,isVerified:a.payload.isVerified}}),this.logger=ze(e,this.name),this.abortController=new AbortController,this.isDevEnv=_a(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return rt(this.logger)}startAbortTimer(t){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),q.toMiliseconds(t))}}var pA=Object.defineProperty,_A=(n,t,e)=>t in n?pA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Bl=(n,t,e)=>_A(n,typeof t!="symbol"?t+"":t,e);class wA extends Lw{constructor(t,e){super(t,e),this.projectId=t,this.logger=e,Bl(this,"context",mb),Bl(this,"registerDeviceToken",async r=>{const{clientId:i,token:s,notificationType:o,enableEncrypted:a=!1}=r,l=`${yb}/${this.projectId}/clients`;await fetch(l,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:i,type:o,token:s,always_raw:a})})}),this.logger=ze(e,this.context)}}var mA=Object.defineProperty,Nl=Object.getOwnPropertySymbols,yA=Object.prototype.hasOwnProperty,gA=Object.prototype.propertyIsEnumerable,xo=(n,t,e)=>t in n?mA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,gr=(n,t)=>{for(var e in t||(t={}))yA.call(t,e)&&xo(n,e,t[e]);if(Nl)for(var e of Nl(t))gA.call(t,e)&&xo(n,e,t[e]);return n},me=(n,t,e)=>xo(n,typeof t!="symbol"?t+"":t,e);class EA extends Dw{constructor(t,e,r=!0){super(t,e,r),this.core=t,this.logger=e,me(this,"context",Eb),me(this,"storagePrefix",Dt),me(this,"storageVersion",gb),me(this,"events",new Map),me(this,"shouldPersist",!1),me(this,"init",async()=>{if(!_a())try{const i={eventId:Lc(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:Ch(this.core.relayer.protocol,this.core.relayer.version,Io)}}};await this.sendEvent([i])}catch(i){this.logger.warn(i)}}),me(this,"createEvent",i=>{const{event:s="ERROR",type:o="",properties:{topic:a,trace:l}}=i,u=Lc(),h=this.core.projectId||"",d=Date.now(),f=gr({eventId:u,timestamp:d,props:{event:s,type:o,properties:{topic:a,trace:l}},bundleId:h,domain:this.getAppDomain()},this.setMethods(u));return this.telemetryEnabled&&(this.events.set(u,f),this.shouldPersist=!0),f}),me(this,"getEvent",i=>{const{eventId:s,topic:o}=i;if(s)return this.events.get(s);const a=Array.from(this.events.values()).find(l=>l.props.properties.topic===o);if(a)return gr(gr({},a),this.setMethods(a.eventId))}),me(this,"deleteEvent",i=>{const{eventId:s}=i;this.events.delete(s),this.shouldPersist=!0}),me(this,"setEventListeners",()=>{this.core.heartbeat.on(Qn.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(i=>{q.fromMiliseconds(Date.now())-q.fromMiliseconds(i.timestamp)>vb&&(this.events.delete(i.eventId),this.shouldPersist=!0)})})}),me(this,"setMethods",i=>({addTrace:s=>this.addTrace(i,s),setError:s=>this.setError(i,s)})),me(this,"addTrace",(i,s)=>{const o=this.events.get(i);o&&(o.props.properties.trace.push(s),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"setError",(i,s)=>{const o=this.events.get(i);o&&(o.props.type=s,o.timestamp=Date.now(),this.events.set(i,o),this.shouldPersist=!0)}),me(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),me(this,"restore",async()=>{try{const i=await this.core.storage.getItem(this.storageKey)||[];if(!i.length)return;i.forEach(s=>{this.events.set(s.eventId,gr(gr({},s),this.setMethods(s.eventId)))})}catch(i){this.logger.warn(i)}}),me(this,"submit",async()=>{if(!this.telemetryEnabled||this.events.size===0)return;const i=[];for(const[s,o]of this.events)o.props.type&&i.push(o);if(i.length!==0)try{if((await this.sendEvent(i)).ok)for(const s of i)this.events.delete(s.eventId),this.shouldPersist=!0}catch(s){this.logger.warn(s)}}),me(this,"sendEvent",async i=>{const s=this.getAppDomain()?"":"&sp=desktop";return await fetch(`${bb}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Io}${s}`,{method:"POST",body:JSON.stringify(i)})}),me(this,"getAppDomain",()=>Sh().url),this.logger=ze(e,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var vA=Object.defineProperty,Ml=Object.getOwnPropertySymbols,bA=Object.prototype.hasOwnProperty,IA=Object.prototype.propertyIsEnumerable,Vo=(n,t,e)=>t in n?vA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ql=(n,t)=>{for(var e in t||(t={}))bA.call(t,e)&&Vo(n,e,t[e]);if(Ml)for(var e of Ml(t))IA.call(t,e)&&Vo(n,e,t[e]);return n},oe=(n,t,e)=>Vo(n,typeof t!="symbol"?t+"":t,e);class La extends mw{constructor(t){var e;super(t),oe(this,"protocol",Dd),oe(this,"version",xd),oe(this,"name",bo),oe(this,"relayUrl"),oe(this,"projectId"),oe(this,"customStoragePrefix"),oe(this,"events",new Sn.EventEmitter),oe(this,"logger"),oe(this,"heartbeat"),oe(this,"relayer"),oe(this,"crypto"),oe(this,"storage"),oe(this,"history"),oe(this,"expirer"),oe(this,"pairing"),oe(this,"verify"),oe(this,"echoClient"),oe(this,"linkModeSupportedApps"),oe(this,"eventClient"),oe(this,"initialized",!1),oe(this,"logChunkController"),oe(this,"on",(a,l)=>this.events.on(a,l)),oe(this,"once",(a,l)=>this.events.once(a,l)),oe(this,"off",(a,l)=>this.events.off(a,l)),oe(this,"removeListener",(a,l)=>this.events.removeListener(a,l)),oe(this,"dispatchEnvelope",({topic:a,message:l,sessionExists:u})=>{if(!a||!l)return;const h={topic:a,message:l,publishedAt:Date.now(),transportType:ae.link_mode};this.relayer.onLinkMessageEvent(h,{sessionExists:u})});const r=this.getGlobalCore(t==null?void 0:t.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(a){console.warn("Failed to copy global core",a)}this.projectId=t==null?void 0:t.projectId,this.relayUrl=(t==null?void 0:t.relayUrl)||Sd,this.customStoragePrefix=t!=null&&t.customStoragePrefix?`:${t.customStoragePrefix}`:"";const i=Ko({level:typeof(t==null?void 0:t.logger)=="string"&&t.logger?t.logger:jv.logger,name:bo}),{logger:s,chunkLoggerController:o}=Jf({opts:i,maxSizeInBytes:t==null?void 0:t.maxLogBlobSizeInBytes,loggerOverride:t==null?void 0:t.logger});this.logChunkController=o,(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var a,l;(a=this.logChunkController)!=null&&a.downloadLogsBlobInBrowser&&((l=this.logChunkController)==null||l.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ze(s,this.name),this.heartbeat=new Qf,this.crypto=new JI(this,this.logger,t==null?void 0:t.keychain),this.history=new aA(this,this.logger),this.expirer=new uA(this,this.logger),this.storage=t!=null&&t.storage?t.storage:new pw(ql(ql({},Kv),t==null?void 0:t.storageOptions)),this.relayer=new A1({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new iA(this,this.logger),this.verify=new fA(this,this.logger,this.storage),this.echoClient=new wA(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new EA(this,this.logger,t==null?void 0:t.telemetryEnabled),this.setGlobalCore(this)}static async init(t){const e=new La(t);await e.initialize();const r=await e.crypto.getClientId();return await e.storage.setItem(ib,r),e}get context(){return rt(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var t;return(t=this.logChunkController)==null?void 0:t.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(t){this.linkModeSupportedApps.includes(t)||(this.linkModeSupportedApps.push(t),await this.storage.setItem(gl,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(gl)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(t){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,t),this.logger.error(t.message),t}}getGlobalCore(t=""){try{if(this.isGlobalCoreDisabled())return;const e=`_walletConnectCore_${t}`,r=`${e}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[e]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(t){var e;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${((e=t.opts)==null?void 0:e.customStoragePrefix)||""}`;globalThis[r]=t}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&zv.DISABLE_GLOBAL_CORE==="true"}catch{return!0}}}const AA=La,Hd="wc",Wd=2,Gd="client",Da=`${Hd}@${Wd}:${Gd}:`,Cs={name:Gd,logger:"error"},zl="WALLETCONNECT_DEEPLINK_CHOICE",TA="proposal",jl="Proposal expired",PA="session",jn=q.SEVEN_DAYS,OA="engine",Oe={wc_sessionPropose:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1104},res:{ttl:q.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1106},res:{ttl:q.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:q.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1112},res:{ttl:q.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:q.ONE_DAY,prompt:!1,tag:1114},res:{ttl:q.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:q.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:q.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:q.FIVE_MINUTES,prompt:!1,tag:1119}}},$s={min:q.FIVE_MINUTES,max:q.SEVEN_DAYS},At={idle:"IDLE",active:"ACTIVE"},RA={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},LA="request",DA=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],xA="wc",VA="auth",SA="authKeys",CA="pairingTopics",$A="requests",rs=`${xA}@${1.5}:${VA}:`,vi=`${rs}:PUB_KEY`;var UA=Object.defineProperty,kA=Object.defineProperties,BA=Object.getOwnPropertyDescriptors,Kl=Object.getOwnPropertySymbols,NA=Object.prototype.hasOwnProperty,MA=Object.prototype.propertyIsEnumerable,So=(n,t,e)=>t in n?UA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,ie=(n,t)=>{for(var e in t||(t={}))NA.call(t,e)&&So(n,e,t[e]);if(Kl)for(var e of Kl(t))MA.call(t,e)&&So(n,e,t[e]);return n},Ue=(n,t)=>kA(n,BA(t)),k=(n,t,e)=>So(n,typeof t!="symbol"?t+"":t,e);class qA extends Cw{constructor(t){super(t),k(this,"name",OA),k(this,"events",new lu),k(this,"initialized",!1),k(this,"requestQueue",{state:At.idle,queue:[]}),k(this,"sessionRequestQueue",{state:At.idle,queue:[]}),k(this,"emittedSessionRequests",new Xy({limit:500})),k(this,"requestQueueDelay",q.ONE_SECOND),k(this,"expectedPairingMethodMap",new Map),k(this,"recentlyDeletedMap",new Map),k(this,"recentlyDeletedLimit",200),k(this,"relayMessageCache",[]),k(this,"pendingSessions",new Map),k(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(Oe)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay)))}),k(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();const r=Ue(ie({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(r),r.optionalNamespaces=tv(r.requiredNamespaces,r.optionalNamespaces),r.requiredNamespaces={};const{pairingTopic:i,requiredNamespaces:s,optionalNamespaces:o,sessionProperties:a,scopedProperties:l,relays:u}=r;let h=i,d,f=!1;try{if(h){const D=this.client.core.pairing.pairings.get(h);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),f=D.active}}catch(D){throw this.client.logger.error(`connect() -> pairing.get(${h}) failed`),D}if(!h||!f){const{topic:D,uri:S}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});h=D,d=S}if(!h){const{message:D}=N("NO_MATCHING_KEY",`connect() pairing topic: ${h}`);throw new Error(D)}const p=await this.client.core.crypto.generateKeyPair(),w=Oe.wc_sessionPropose.req.ttl||q.FIVE_MINUTES,m=_e(w),_=Ue(ie(ie({requiredNamespaces:s,optionalNamespaces:o,relays:u??[{protocol:Vd}],proposer:{publicKey:p,metadata:this.client.metadata},expiryTimestamp:m,pairingTopic:h},a&&{sessionProperties:a}),l&&{scopedProperties:l}),{id:Ft()}),g=ne("session_connect",_.id),{reject:v,resolve:y,done:b}=yn(w,jl),I=({id:D})=>{D===_.id&&(this.client.events.off("proposal_expire",I),this.pendingSessions.delete(_.id),this.events.emit(g,{error:{message:jl,code:0}}))};return this.client.events.on("proposal_expire",I),this.events.once(g,({error:D,session:S})=>{this.client.events.off("proposal_expire",I),D?v(D):S&&y(S)}),await this.sendProposeSession({proposal:_,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:_.id}}}),await this.setProposal(_.id,_),{uri:d,approval:b}}),k(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(r){throw this.client.logger.error("pair() failed"),r}}),k(this,"approve",async e=>{var r,i,s;const o=this.client.core.eventClient.createEvent({properties:{topic:(r=e==null?void 0:e.id)==null?void 0:r.toString(),trace:[rn.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(E){throw o.setError(wr.no_internet_connection),E}try{await this.isValidProposalId(e==null?void 0:e.id)}catch(E){throw this.client.logger.error(`approve() -> proposal.get(${e==null?void 0:e.id}) failed`),o.setError(wr.proposal_not_found),E}try{await this.isValidApprove(e)}catch(E){throw this.client.logger.error("approve() -> isValidApprove() failed"),o.setError(wr.session_approve_namespace_validation_failure),E}const{id:a,relayProtocol:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:f}=e,p=this.client.proposal.get(a);this.client.core.eventClient.deleteEvent({eventId:o.eventId});const{pairingTopic:w,proposer:m,requiredNamespaces:_,optionalNamespaces:g}=p;let v=(i=this.client.core.eventClient)==null?void 0:i.getEvent({topic:w});v||(v=(s=this.client.core.eventClient)==null?void 0:s.createEvent({type:rn.session_approve_started,properties:{topic:w,trace:[rn.session_approve_started,rn.session_namespaces_validation_success]}}));const y=await this.client.core.crypto.generateKeyPair(),b=m.publicKey,I=await this.client.core.crypto.generateSharedKey(y,b),D=ie(ie(ie({relay:{protocol:l??"irn"},namespaces:u,controller:{publicKey:y,metadata:this.client.metadata},expiry:_e(jn)},h&&{sessionProperties:h}),d&&{scopedProperties:d}),f&&{sessionConfig:f}),S=ae.relay;v.addTrace(rn.subscribing_session_topic);try{await this.client.core.relayer.subscribe(I,{transportType:S,internal:{skipSubscribe:!0}})}catch(E){throw v.setError(wr.subscribe_session_topic_failure),E}v.addTrace(rn.subscribe_session_topic_success);const x=Ue(ie({},D),{topic:I,requiredNamespaces:_,optionalNamespaces:g,pairingTopic:w,acknowledged:!1,self:D.controller,peer:{publicKey:m.publicKey,metadata:m.metadata},controller:y,transportType:ae.relay});await this.client.session.set(I,x),v.addTrace(rn.store_session);try{await this.sendApproveSession({sessionTopic:I,proposal:p,pairingProposalResponse:{relay:{protocol:l??"irn"},responderPublicKey:y},sessionSettleRequest:D,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:a}}}),v.addTrace(rn.session_approve_publish_success)}catch(E){throw this.client.logger.error(E),this.client.session.delete(I,le("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(I),E}return this.client.core.eventClient.deleteEvent({eventId:v.eventId}),await this.client.core.pairing.updateMetadata({topic:w,metadata:m.metadata}),await this.deleteProposal(a),await this.client.core.pairing.activate({topic:w}),await this.setExpiry(I,_e(jn)),{topic:I,acknowledged:()=>Promise.resolve(this.client.session.get(I))}}),k(this,"reject",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(o){throw this.client.logger.error("reject() -> isValidReject() failed"),o}const{id:r,reason:i}=e;let s;try{s=this.client.proposal.get(r).pairingTopic}catch(o){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),o}s&&await this.sendError({id:r,topic:s,error:i,rpcOpts:Oe.wc_sessionPropose.reject}),await this.deleteProposal(r)}),k(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(d){throw this.client.logger.error("update() -> isValidUpdate() failed"),d}const{topic:r,namespaces:i}=e,{done:s,resolve:o,reject:a}=yn(),l=Ft(),u=vn().toString(),h=this.client.session.get(r).namespaces;return this.events.once(ne("session_update",l),({error:d})=>{d?a(d):o()}),await this.client.session.update(r,{namespaces:i}),await this.sendRequest({topic:r,method:"wc_sessionUpdate",params:{namespaces:i},throwOnFailedPublish:!0,clientRpcId:l,relayRpcId:u}).catch(d=>{this.client.logger.error(d),this.client.session.update(r,{namespaces:h}),a(d)}),{acknowledged:s}}),k(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(l){throw this.client.logger.error("extend() -> isValidExtend() failed"),l}const{topic:r}=e,i=Ft(),{done:s,resolve:o,reject:a}=yn();return this.events.once(ne("session_extend",i),({error:l})=>{l?a(l):o()}),await this.setExpiry(r,_e(jn)),this.sendRequest({topic:r,method:"wc_sessionExtend",params:{},clientRpcId:i,throwOnFailedPublish:!0}).catch(l=>{a(l)}),{acknowledged:s}}),k(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(_){throw this.client.logger.error("request() -> isValidRequest() failed"),_}const{chainId:r,request:i,topic:s,expiry:o=Oe.wc_sessionRequest.req.ttl}=e,a=this.client.session.get(s);(a==null?void 0:a.transportType)===ae.relay&&await this.confirmOnlineStateOrThrow();const l=Ft(),u=vn().toString(),{done:h,resolve:d,reject:f}=yn(o,"Request expired. Please try again.");this.events.once(ne("session_request",l),({error:_,result:g})=>{_?f(_):d(g)});const p="wc_sessionRequest",w=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(w)return await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:p,params:{request:Ue(ie({},i),{expiryTimestamp:_e(o)}),chainId:r},expiry:o,throwOnFailedPublish:!0,appLink:w}).catch(_=>f(_)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:r,id:l}),await h();const m={request:Ue(ie({},i),{expiryTimestamp:_e(o)}),chainId:r};return await Promise.all([new Promise(async _=>{await this.sendRequest({clientRpcId:l,relayRpcId:u,topic:s,method:p,params:m,expiry:o,throwOnFailedPublish:!0,tvf:this.getTVFParams(l,m)}).catch(g=>f(g)),this.client.events.emit("session_request_sent",{topic:s,request:i,chainId:r,id:l}),_()}),new Promise(async _=>{var g;if(!((g=a.sessionConfig)!=null&&g.disableDeepLink)){const v=await Gy(this.client.core.storage,zl);await Fy({id:l,topic:s,wcDeepLink:v})}_()}),h()]).then(_=>_[2])}),k(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);const{topic:r,response:i}=e,{id:s}=i,o=this.client.session.get(r);o.transportType===ae.relay&&await this.confirmOnlineStateOrThrow();const a=this.getAppLinkIfEnabled(o.peer.metadata,o.transportType);$t(i)?await this.sendResult({id:s,topic:r,result:i.result,throwOnFailedPublish:!0,appLink:a}):Pt(i)&&await this.sendError({id:s,topic:r,error:i.error,appLink:a}),this.cleanupAfterResponse(e)}),k(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(i){throw this.client.logger.error("ping() -> isValidPing() failed"),i}const{topic:r}=e;if(this.client.session.keys.includes(r)){const i=Ft(),s=vn().toString(),{done:o,resolve:a,reject:l}=yn();this.events.once(ne("session_ping",i),({error:u})=>{u?l(u):a()}),await Promise.all([this.sendRequest({topic:r,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:i,relayRpcId:s}),o()])}else this.client.core.pairing.pairings.keys.includes(r)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:r}))}),k(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);const{topic:r,event:i,chainId:s}=e,o=vn().toString(),a=Ft();await this.sendRequest({topic:r,method:"wc_sessionEvent",params:{event:i,chainId:s},throwOnFailedPublish:!0,relayRpcId:o,clientRpcId:a})}),k(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);const{topic:r}=e;if(this.client.session.keys.includes(r))await this.sendRequest({topic:r,method:"wc_sessionDelete",params:le("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:r,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(r))await this.client.core.pairing.disconnect({topic:r});else{const{message:i}=N("MISMATCHED_TOPIC",`Session or pairing topic not found: ${r}`);throw new Error(i)}}),k(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(r=>iv(r,e)))),k(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),k(this,"authenticate",async(e,r)=>{var i;this.isInitialized(),this.isValidAuthenticate(e);const s=r&&this.client.core.linkModeSupportedApps.includes(r)&&((i=this.client.metadata.redirect)==null?void 0:i.linkMode),o=s?ae.link_mode:ae.relay;o===ae.relay&&await this.confirmOnlineStateOrThrow();const{chains:a,statement:l="",uri:u,domain:h,nonce:d,type:f,exp:p,nbf:w,methods:m=[],expiry:_}=e,g=[...e.resources||[]],{topic:v,uri:y}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:o});this.client.logger.info({message:"Generated new pairing",pairing:{topic:v,uri:y}});const b=await this.client.core.crypto.generateKeyPair(),I=gi(b);if(await Promise.all([this.client.auth.authKeys.set(vi,{responseTopic:I,publicKey:b}),this.client.auth.pairingTopics.set(I,{topic:I,pairingTopic:v})]),await this.client.core.relayer.subscribe(I,{transportType:o}),this.client.logger.info(`sending request to new pairing topic: ${v}`),m.length>0){const{namespace:$}=mi(a[0]);let M=u0($,"request",m);yi(g)&&(M=d0(M,g.pop())),g.push(M)}const D=_&&_>Oe.wc_sessionAuthenticate.req.ttl?_:Oe.wc_sessionAuthenticate.req.ttl,S={authPayload:{type:f??"caip122",chains:a,statement:l,aud:u,domain:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:p,nbf:w,resources:g},requester:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:_e(D)},x={eip155:{chains:a,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},E={requiredNamespaces:{},optionalNamespaces:x,relays:[{protocol:"irn"}],pairingTopic:v,proposer:{publicKey:b,metadata:this.client.metadata},expiryTimestamp:_e(Oe.wc_sessionPropose.req.ttl),id:Ft()},{done:A,resolve:T,reject:P}=yn(D,"Request expired"),V=Ft(),O=ne("session_connect",E.id),R=ne("session_request",V),L=async({error:$,session:M})=>{this.events.off(R,C),$?P($):M&&T({session:M})},C=async $=>{var M,B,j;if(await this.deletePendingAuthRequest(V,{message:"fulfilled",code:0}),$.error){const te=le("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return $.error.code===te.code?void 0:(this.events.off(O,L),P($.error.message))}await this.deleteProposal(E.id),this.events.off(O,L);const{cacaos:F,responder:K}=$.result,H=[],G=[];for(const te of F){await Mc({cacao:te,projectId:this.client.core.projectId})||(this.client.logger.error(te,"Signature verification failed"),P(le("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Le}=te,Ne=yi(Le.resources),Et=[uo(Le.iss)],_n=ki(Le.iss);if(Ne){const xt=qc(Ne),Kt=zc(Ne);H.push(...xt),Et.push(...Kt)}for(const xt of Et)G.push(`${xt}:${_n}`)}const ce=await this.client.core.crypto.generateSharedKey(b,K.publicKey);let re;H.length>0&&(re={topic:ce,acknowledged:!0,self:{publicKey:b,metadata:this.client.metadata},peer:K,controller:K.publicKey,expiry:_e(jn),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:v,namespaces:dl([...new Set(H)],[...new Set(G)]),transportType:o},await this.client.core.relayer.subscribe(ce,{transportType:o}),await this.client.session.set(ce,re),v&&await this.client.core.pairing.updateMetadata({topic:v,metadata:K.metadata}),re=this.client.session.get(ce)),(M=this.client.metadata.redirect)!=null&&M.linkMode&&(B=K.metadata.redirect)!=null&&B.linkMode&&(j=K.metadata.redirect)!=null&&j.universal&&r&&(this.client.core.addLinkModeSupportedApp(K.metadata.redirect.universal),this.client.session.update(ce,{transportType:ae.link_mode})),T({auths:F,session:re})};this.events.once(O,L),this.events.once(R,C);let U;try{if(s){const $=sn("wc_sessionAuthenticate",S,V);this.client.core.history.set(v,$);const M=await this.client.core.crypto.encode("",$,{type:Yr,encoding:un});U=di(r,v,M)}else await Promise.all([this.sendRequest({topic:v,method:"wc_sessionAuthenticate",params:S,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:V}),this.sendRequest({topic:v,method:"wc_sessionPropose",params:E,expiry:Oe.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:E.id})])}catch($){throw this.events.off(O,L),this.events.off(R,C),$}return await this.setProposal(E.id,E),await this.setAuthRequest(V,{request:Ue(ie({},S),{verifyContext:{}}),pairingTopic:v,transportType:o}),{uri:U??y,response:A}}),k(this,"approveSessionAuthenticate",async e=>{const{id:r,auths:i}=e,s=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[mn.authenticated_session_approve_started]}});try{this.isInitialized()}catch(_){throw s.setError(mr.no_internet_connection),_}const o=this.getPendingAuthRequest(r);if(!o)throw s.setError(mr.authenticated_session_pending_request_not_found),new Error(`Could not find pending auth request with id ${r}`);const a=o.transportType||ae.relay;a===ae.relay&&await this.confirmOnlineStateOrThrow();const l=o.requester.publicKey,u=await this.client.core.crypto.generateKeyPair(),h=gi(l),d={type:zt,receiverPublicKey:l,senderPublicKey:u},f=[],p=[];for(const _ of i){if(!await Mc({cacao:_,projectId:this.client.core.projectId})){s.setError(mr.invalid_cacao);const I=le("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:r,topic:h,error:I,encodeOpts:d}),new Error(I.message)}s.addTrace(mn.cacaos_verified);const{p:g}=_,v=yi(g.resources),y=[uo(g.iss)],b=ki(g.iss);if(v){const I=qc(v),D=zc(v);f.push(...I),y.push(...D)}for(const I of y)p.push(`${I}:${b}`)}const w=await this.client.core.crypto.generateSharedKey(u,l);s.addTrace(mn.create_authenticated_session_topic);let m;if((f==null?void 0:f.length)>0){m={topic:w,acknowledged:!0,self:{publicKey:u,metadata:this.client.metadata},peer:{publicKey:l,metadata:o.requester.metadata},controller:l,expiry:_e(jn),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:o.pairingTopic,namespaces:dl([...new Set(f)],[...new Set(p)]),transportType:a},s.addTrace(mn.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(w,{transportType:a})}catch(_){throw s.setError(mr.subscribe_authenticated_session_topic_failure),_}s.addTrace(mn.subscribe_authenticated_session_topic_success),await this.client.session.set(w,m),s.addTrace(mn.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:o.pairingTopic,metadata:o.requester.metadata})}s.addTrace(mn.publishing_authenticated_session_approve);try{await this.sendResult({topic:h,id:r,result:{cacaos:i,responder:{publicKey:u,metadata:this.client.metadata}},encodeOpts:d,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(o.requester.metadata,a)})}catch(_){throw s.setError(mr.authenticated_session_approve_publish_failure),_}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:o.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:s.eventId}),{session:m}}),k(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();const{id:r,reason:i}=e,s=this.getPendingAuthRequest(r);if(!s)throw new Error(`Could not find pending auth request with id ${r}`);s.transportType===ae.relay&&await this.confirmOnlineStateOrThrow();const o=s.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),l=gi(o),u={type:zt,receiverPublicKey:o,senderPublicKey:a};await this.sendError({id:r,topic:l,error:i,encodeOpts:u,rpcOpts:Oe.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(s.requester.metadata,s.transportType)}),await this.client.auth.requests.delete(r,{message:"rejected",code:0}),await this.deleteProposal(r)}),k(this,"formatAuthMessage",e=>{this.isInitialized();const{request:r,iss:i}=e;return Jh(r,i)}),k(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{const e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),k(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{const r=this.client.core.pairing.pairings.get(e.pairingTopic),i=this.client.core.pairing.pairings.getAll().filter(s=>{var o,a;return((o=s.peerMetadata)==null?void 0:o.url)&&((a=s.peerMetadata)==null?void 0:a.url)===e.peer.metadata.url&&s.topic&&s.topic!==r.topic});if(i.length===0)return;this.client.logger.info(`Cleaning up ${i.length} duplicate pairing(s)`),await Promise.all(i.map(s=>this.client.core.pairing.disconnect({topic:s.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(r){this.client.logger.error(r)}}),k(this,"deleteSession",async e=>{var r;const{topic:i,expirerHasDeleted:s=!1,emitEvent:o=!0,id:a=0}=e,{self:l}=this.client.session.get(i);await this.client.core.relayer.unsubscribe(i),await this.client.session.delete(i,le("USER_DISCONNECTED")),this.addToRecentlyDeleted(i,"session"),this.client.core.crypto.keychain.has(l.publicKey)&&await this.client.core.crypto.deleteKeyPair(l.publicKey),this.client.core.crypto.keychain.has(i)&&await this.client.core.crypto.deleteSymKey(i),s||this.client.core.expirer.del(i),this.client.core.storage.removeItem(zl).catch(u=>this.client.logger.warn(u)),this.getPendingSessionRequests().forEach(u=>{u.topic===i&&this.deletePendingSessionRequest(u.id,le("USER_DISCONNECTED"))}),i===((r=this.sessionRequestQueue.queue[0])==null?void 0:r.topic)&&(this.sessionRequestQueue.state=At.idle),o&&this.client.events.emit("session_delete",{id:a,topic:i})}),k(this,"deleteProposal",async(e,r)=>{if(r)try{const i=this.client.proposal.get(e),s=this.client.core.eventClient.getEvent({topic:i.pairingTopic});s==null||s.setError(wr.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,le("USER_DISCONNECTED")),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),k(this,"deletePendingSessionRequest",async(e,r,i=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,r),i?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(s=>s.id!==e),i&&(this.sessionRequestQueue.state=At.idle,this.client.events.emit("session_request_expire",{id:e}))}),k(this,"deletePendingAuthRequest",async(e,r,i=!1)=>{await Promise.all([this.client.auth.requests.delete(e,r),i?Promise.resolve():this.client.core.expirer.del(e)])}),k(this,"setExpiry",async(e,r)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,r),await this.client.session.update(e,{expiry:r}))}),k(this,"setProposal",async(e,r)=>{this.client.core.expirer.set(e,_e(Oe.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,r)}),k(this,"setAuthRequest",async(e,r)=>{const{request:i,pairingTopic:s,transportType:o=ae.relay}=r;this.client.core.expirer.set(e,i.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:i.authPayload,requester:i.requester,expiryTimestamp:i.expiryTimestamp,id:e,pairingTopic:s,verifyContext:i.verifyContext,transportType:o})}),k(this,"setPendingSessionRequest",async e=>{const{id:r,topic:i,params:s,verifyContext:o}=e,a=s.request.expiryTimestamp||_e(Oe.wc_sessionRequest.req.ttl);this.client.core.expirer.set(r,a),await this.client.pendingRequest.set(r,{id:r,topic:i,params:s,verifyContext:o})}),k(this,"sendRequest",async e=>{const{topic:r,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d,publishOpts:f={}}=e,p=sn(i,s,l);let w;const m=!!h;try{const v=m?un:Ze;w=await this.client.core.crypto.encode(r,p,{encoding:v})}catch(v){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${r} failed`),v}let _;if(DA.includes(i)){const v=ct(JSON.stringify(p)),y=ct(w);_=await this.client.core.verify.register({id:y,decryptedId:v})}const g=ie(ie({},Oe[i].req),f);if(g.attestation=_,o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(r,p),m){const v=di(h,r,w);await global.Linking.openURL(v,this.client.name)}else g.tvf=Ue(ie({},d),{correlationId:p.id}),u?(g.internal=Ue(ie({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(r,w,g)):this.client.core.relayer.publish(r,w,g).catch(v=>this.client.logger.error(v));return p.id}),k(this,"sendProposeSession",async e=>{const{proposal:r,publishOpts:i}=e,s=sn("wc_sessionPropose",r,r.id);this.client.core.history.set(r.pairingTopic,s);const o=await this.client.core.crypto.encode(r.pairingTopic,s,{encoding:Ze}),a=ct(JSON.stringify(s)),l=ct(o),u=await this.client.core.verify.register({id:l,decryptedId:a});await this.client.core.relayer.publishCustom({payload:{pairingTopic:r.pairingTopic,sessionProposal:o},opts:Ue(ie({},i),{publishMethod:"wc_proposeSession",attestation:u})})}),k(this,"sendApproveSession",async e=>{const{sessionTopic:r,pairingProposalResponse:i,proposal:s,sessionSettleRequest:o,publishOpts:a}=e,l=Ti(s.id,i),u=await this.client.core.crypto.encode(s.pairingTopic,l,{encoding:Ze}),h=sn("wc_sessionSettle",o,a==null?void 0:a.id),d=await this.client.core.crypto.encode(r,h,{encoding:Ze});this.client.core.history.set(r,h),await this.client.core.relayer.publishCustom({payload:{sessionTopic:r,pairingTopic:s.pairingTopic,sessionProposalResponse:u,sessionSettlementRequest:d},opts:Ue(ie({},a),{publishMethod:"wc_approveSession"})})}),k(this,"sendResult",async e=>{const{id:r,topic:i,result:s,throwOnFailedPublish:o,encodeOpts:a,appLink:l}=e,u=Ti(r,s);let h;const d=l&&typeof(global==null?void 0:global.Linking)<"u";try{const w=d?un:Ze;h=await this.client.core.crypto.encode(i,u,Ue(ie({},a||{}),{encoding:w}))}catch(w){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${i} failed`),w}let f,p;try{f=await this.client.core.history.get(i,r);const w=f.request;try{p=this.getTVFParams(r,w.params,s)}catch(m){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${m==null?void 0:m.message}`)}}catch(w){throw this.client.logger.error(`sendResult() -> history.get(${i}, ${r}) failed`),w}if(d){const w=di(l,i,h);await global.Linking.openURL(w,this.client.name)}else{const w=f.request.method,m=Oe[w].res;m.tvf=Ue(ie({},p),{correlationId:r}),o?(m.internal=Ue(ie({},m.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(i,h,m)):this.client.core.relayer.publish(i,h,m).catch(_=>this.client.logger.error(_))}await this.client.core.history.resolve(u)}),k(this,"sendError",async e=>{const{id:r,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:l}=e,u=du(r,s);let h;const d=l&&typeof(global==null?void 0:global.Linking)<"u";try{const p=d?un:Ze;h=await this.client.core.crypto.encode(i,u,Ue(ie({},o||{}),{encoding:p}))}catch(p){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),p}let f;try{f=await this.client.core.history.get(i,r)}catch(p){throw this.client.logger.error(`sendError() -> history.get(${i}, ${r}) failed`),p}if(d){const p=di(l,i,h);await global.Linking.openURL(p,this.client.name)}else{const p=f.request.method,w=a||Oe[p].res;this.client.core.relayer.publish(i,h,w)}await this.client.core.history.resolve(u)}),k(this,"cleanup",async()=>{const e=[],r=[];this.client.session.getAll().forEach(i=>{let s=!1;on(i.expiry)&&(s=!0),this.client.core.crypto.keychain.has(i.topic)||(s=!0),s&&e.push(i.topic)}),this.client.proposal.getAll().forEach(i=>{on(i.expiryTimestamp)&&r.push(i.id)}),await Promise.all([...e.map(i=>this.deleteSession({topic:i})),...r.map(i=>this.deleteProposal(i))])}),k(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),k(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),k(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===At.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=At.active;const e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(r){this.client.logger.warn(r)}}this.requestQueue.state=At.idle}),k(this,"processRequest",async e=>{const{topic:r,payload:i,attestation:s,transportType:o,encryptedId:a}=e,l=i.method;if(!this.shouldIgnorePairingRequest({topic:r,requestMethod:l}))switch(l){case"wc_sessionPropose":return await this.onSessionProposeRequest({topic:r,payload:i,attestation:s,encryptedId:a});case"wc_sessionSettle":return await this.onSessionSettleRequest(r,i);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(r,i);case"wc_sessionExtend":return await this.onSessionExtendRequest(r,i);case"wc_sessionPing":return await this.onSessionPingRequest(r,i);case"wc_sessionDelete":return await this.onSessionDeleteRequest(r,i);case"wc_sessionRequest":return await this.onSessionRequest({topic:r,payload:i,attestation:s,encryptedId:a,transportType:o});case"wc_sessionEvent":return await this.onSessionEventRequest(r,i);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:r,payload:i,attestation:s,encryptedId:a,transportType:o});default:return this.client.logger.info(`Unsupported request method ${l}`)}}),k(this,"onRelayEventResponse",async e=>{const{topic:r,payload:i,transportType:s}=e,o=(await this.client.core.history.get(r,i.id)).request.method;switch(o){case"wc_sessionPropose":return this.onSessionProposeResponse(r,i,s);case"wc_sessionSettle":return this.onSessionSettleResponse(r,i);case"wc_sessionUpdate":return this.onSessionUpdateResponse(r,i);case"wc_sessionExtend":return this.onSessionExtendResponse(r,i);case"wc_sessionPing":return this.onSessionPingResponse(r,i);case"wc_sessionRequest":return this.onSessionRequestResponse(r,i);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(r,i);default:return this.client.logger.info(`Unsupported response method ${o}`)}}),k(this,"onRelayEventUnknownPayload",e=>{const{topic:r}=e,{message:i}=N("MISSING_OR_INVALID",`Decoded payload on topic ${r} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),k(this,"shouldIgnorePairingRequest",e=>{const{topic:r,requestMethod:i}=e,s=this.expectedPairingMethodMap.get(r);return!s||s.includes(i)?!1:!!(s.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),k(this,"onSessionProposeRequest",async e=>{const{topic:r,payload:i,attestation:s,encryptedId:o}=e,{params:a,id:l}=i;try{const u=this.client.core.eventClient.getEvent({topic:r});this.client.events.listenerCount("session_proposal")===0&&(console.warn("No listener for session_proposal event"),u==null||u.setError(kt.proposal_listener_not_found)),this.isValidConnect(ie({},i.params));const h=a.expiryTimestamp||_e(Oe.wc_sessionPropose.req.ttl),d=ie({id:l,pairingTopic:r,expiryTimestamp:h,attestation:s,encryptedId:o},a);await this.setProposal(l,d);const f=await this.getVerifyContext({attestationId:s,hash:ct(JSON.stringify(i)),encryptedId:o,metadata:d.proposer.metadata});u==null||u.addTrace(Tt.emit_session_proposal),this.client.events.emit("session_proposal",{id:l,params:d,verifyContext:f})}catch(u){await this.sendError({id:l,topic:r,error:u,rpcOpts:Oe.wc_sessionPropose.autoReject}),this.client.logger.error(u)}}),k(this,"onSessionProposeResponse",async(e,r,i)=>{const{id:s}=r;if($t(r)){const{result:o}=r;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:o});const a=this.client.proposal.get(s);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:a});const l=a.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:l});const u=o.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:u});const h=await this.client.core.crypto.generateSharedKey(l,u);this.pendingSessions.set(s,{sessionTopic:h,pairingTopic:e,proposalId:s,publicKey:l});const d=await this.client.core.relayer.subscribe(h,{transportType:i});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:d}),await this.client.core.pairing.activate({topic:e})}else if(Pt(r)){await this.deleteProposal(s);const o=ne("session_connect",s);if(this.events.listenerCount(o)===0)throw new Error(`emitting ${o} without any listeners, 954`);this.events.emit(o,{error:r.error})}}),k(this,"onSessionSettleRequest",async(e,r)=>{const{id:i,params:s}=r;try{this.isValidSessionSettleRequest(s);const{relay:o,controller:a,expiry:l,namespaces:u,sessionProperties:h,scopedProperties:d,sessionConfig:f}=r.params,p=[...this.pendingSessions.values()].find(_=>_.sessionTopic===e);if(!p)return this.client.logger.error(`Pending session not found for topic ${e}`);const w=this.client.proposal.get(p.proposalId),m=Ue(ie(ie(ie({topic:e,relay:o,expiry:l,namespaces:u,acknowledged:!0,pairingTopic:p.pairingTopic,requiredNamespaces:w.requiredNamespaces,optionalNamespaces:w.optionalNamespaces,controller:a.publicKey,self:{publicKey:p.publicKey,metadata:this.client.metadata},peer:{publicKey:a.publicKey,metadata:a.metadata}},h&&{sessionProperties:h}),d&&{scopedProperties:d}),f&&{sessionConfig:f}),{transportType:ae.relay});await this.client.session.set(m.topic,m),await this.setExpiry(m.topic,m.expiry),await this.client.core.pairing.updateMetadata({topic:p.pairingTopic,metadata:m.peer.metadata}),this.client.events.emit("session_connect",{session:m}),this.events.emit(ne("session_connect",p.proposalId),{session:m}),this.pendingSessions.delete(p.proposalId),this.deleteProposal(p.proposalId,!1),this.cleanupDuplicatePairings(m),await this.sendResult({id:r.id,topic:e,result:!0})}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),k(this,"onSessionSettleResponse",async(e,r)=>{const{id:i}=r;$t(r)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(ne("session_approve",i),{})):Pt(r)&&(await this.client.session.delete(e,le("USER_DISCONNECTED")),this.events.emit(ne("session_approve",i),{error:r.error}))}),k(this,"onSessionUpdateRequest",async(e,r)=>{const{params:i,id:s}=r;try{const o=`${e}_session_update`,a=pr.get(o);if(a&&this.isRequestOutOfSync(a,s)){this.client.logger.warn(`Discarding out of sync request - ${s}`),this.sendError({id:s,topic:e,error:le("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(ie({topic:e},i));try{pr.set(o,s),await this.client.session.update(e,{namespaces:i.namespaces}),await this.sendResult({id:s,topic:e,result:!0})}catch(l){throw pr.delete(o),l}this.client.events.emit("session_update",{id:s,topic:e,params:i})}catch(o){await this.sendError({id:s,topic:e,error:o}),this.client.logger.error(o)}}),k(this,"isRequestOutOfSync",(e,r)=>r.toString().slice(0,-3)<e.toString().slice(0,-3)),k(this,"onSessionUpdateResponse",(e,r)=>{const{id:i}=r,s=ne("session_update",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);$t(r)?this.events.emit(ne("session_update",i),{}):Pt(r)&&this.events.emit(ne("session_update",i),{error:r.error})}),k(this,"onSessionExtendRequest",async(e,r)=>{const{id:i}=r;try{this.isValidExtend({topic:e}),await this.setExpiry(e,_e(jn)),await this.sendResult({id:i,topic:e,result:!0}),this.client.events.emit("session_extend",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),k(this,"onSessionExtendResponse",(e,r)=>{const{id:i}=r,s=ne("session_extend",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);$t(r)?this.events.emit(ne("session_extend",i),{}):Pt(r)&&this.events.emit(ne("session_extend",i),{error:r.error})}),k(this,"onSessionPingRequest",async(e,r)=>{const{id:i}=r;try{this.isValidPing({topic:e}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:i,topic:e})}catch(s){await this.sendError({id:i,topic:e,error:s}),this.client.logger.error(s)}}),k(this,"onSessionPingResponse",(e,r)=>{const{id:i}=r,s=ne("session_ping",i);setTimeout(()=>{if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners 2176`);$t(r)?this.events.emit(ne("session_ping",i),{}):Pt(r)&&this.events.emit(ne("session_ping",i),{error:r.error})},500)}),k(this,"onSessionDeleteRequest",async(e,r)=>{const{id:i}=r;try{this.isValidDisconnect({topic:e,reason:r.params}),await Promise.all([new Promise(s=>{this.client.core.relayer.once(ue.publish,async()=>{s(await this.deleteSession({topic:e,id:i}))})}),this.sendResult({id:i,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:le("USER_DISCONNECTED")})]).catch(s=>this.client.logger.error(s))}catch(s){this.client.logger.error(s)}}),k(this,"onSessionRequest",async e=>{var r,i,s;const{topic:o,payload:a,attestation:l,encryptedId:u,transportType:h}=e,{id:d,params:f}=a;try{await this.isValidRequest(ie({topic:o},f));const p=this.client.session.get(o),w=await this.getVerifyContext({attestationId:l,hash:ct(JSON.stringify(sn("wc_sessionRequest",f,d))),encryptedId:u,metadata:p.peer.metadata,transportType:h}),m={id:d,topic:o,params:f,verifyContext:w};await this.setPendingSessionRequest(m),h===ae.link_mode&&(r=p.peer.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp((i=p.peer.metadata.redirect)==null?void 0:i.universal),(s=this.client.signConfig)!=null&&s.disableRequestQueue?this.emitSessionRequest(m):(this.addSessionRequestToSessionRequestQueue(m),this.processSessionRequestQueue())}catch(p){await this.sendError({id:d,topic:o,error:p}),this.client.logger.error(p)}}),k(this,"onSessionRequestResponse",(e,r)=>{const{id:i}=r,s=ne("session_request",i);if(this.events.listenerCount(s)===0)throw new Error(`emitting ${s} without any listeners`);$t(r)?this.events.emit(ne("session_request",i),{result:r.result}):Pt(r)&&this.events.emit(ne("session_request",i),{error:r.error})}),k(this,"onSessionEventRequest",async(e,r)=>{const{id:i,params:s}=r;try{const o=`${e}_session_event_${s.event.name}`,a=pr.get(o);if(a&&this.isRequestOutOfSync(a,i)){this.client.logger.info(`Discarding out of sync request - ${i}`);return}this.isValidEmit(ie({topic:e},s)),this.client.events.emit("session_event",{id:i,topic:e,params:s}),pr.set(o,i)}catch(o){await this.sendError({id:i,topic:e,error:o}),this.client.logger.error(o)}}),k(this,"onSessionAuthenticateResponse",(e,r)=>{const{id:i}=r;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:r}),$t(r)?this.events.emit(ne("session_request",i),{result:r.result}):Pt(r)&&this.events.emit(ne("session_request",i),{error:r.error})}),k(this,"onSessionAuthenticateRequest",async e=>{var r;const{topic:i,payload:s,attestation:o,encryptedId:a,transportType:l}=e;try{const{requester:u,authPayload:h,expiryTimestamp:d}=s.params,f=await this.getVerifyContext({attestationId:o,hash:ct(JSON.stringify(s)),encryptedId:a,metadata:u.metadata,transportType:l}),p={requester:u,pairingTopic:i,id:s.id,authPayload:h,verifyContext:f,expiryTimestamp:d};await this.setAuthRequest(s.id,{request:p,pairingTopic:i,transportType:l}),l===ae.link_mode&&(r=u.metadata.redirect)!=null&&r.universal&&this.client.core.addLinkModeSupportedApp(u.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:i,params:s.params,id:s.id,verifyContext:f})}catch(u){this.client.logger.error(u);const h=s.params.requester.publicKey,d=await this.client.core.crypto.generateKeyPair(),f=this.getAppLinkIfEnabled(s.params.requester.metadata,l),p={type:zt,receiverPublicKey:h,senderPublicKey:d};await this.sendError({id:s.id,topic:i,error:u,encodeOpts:p,rpcOpts:Oe.wc_sessionAuthenticate.autoReject,appLink:f})}}),k(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),k(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=At.idle,this.processSessionRequestQueue()},q.toMiliseconds(this.requestQueueDelay))}),k(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:r})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(s=>s.topic===e&&s.request.method==="wc_sessionRequest").forEach(s=>{const o=s.request.id,a=ne("session_request",o);if(this.events.listenerCount(a)===0)throw new Error(`emitting ${a} without any listeners`);this.events.emit(ne("session_request",s.request.id),{error:r})})}),k(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===At.active){this.client.logger.info("session request queue is already active.");return}const e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(r){this.client.logger.error(r)}}),k(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=At.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),k(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;const r=this.client.proposal.getAll().find(i=>i.pairingTopic===e.topic);r&&this.onSessionProposeRequest({topic:e.topic,payload:sn("wc_sessionPropose",Ue(ie({},r),{requiredNamespaces:r.requiredNamespaces,optionalNamespaces:r.optionalNamespaces,relays:r.relays,proposer:r.proposer,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}),r.id),attestation:r.attestation,encryptedId:r.encryptedId})}),k(this,"isValidConnect",async e=>{if(!Fe(e)){const{message:u}=N("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw new Error(u)}const{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:s,sessionProperties:o,scopedProperties:a,relays:l}=e;if(we(r)||await this.isValidPairingTopic(r),!wv(l)){const{message:u}=N("MISSING_OR_INVALID",`connect() relays: ${l}`);throw new Error(u)}if(!we(i)&&jr(i)!==0){const u="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(u):this.client.logger.warn(u),this.validateNamespaces(i,"requiredNamespaces")}if(!we(s)&&jr(s)!==0&&this.validateNamespaces(s,"optionalNamespaces"),we(o)||this.validateSessionProps(o,"sessionProperties"),!we(a)){this.validateSessionProps(a,"scopedProperties");const u=Object.keys(i||{}).concat(Object.keys(s||{}));if(!Object.keys(a).every(h=>u.includes(h.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(a)}, required/optional namespaces: ${JSON.stringify(u)}`)}}),k(this,"validateNamespaces",(e,r)=>{const i=_v(e,"connect()",r);if(i)throw new Error(i.message)}),k(this,"isValidApprove",async e=>{if(!Fe(e))throw new Error(N("MISSING_OR_INVALID",`approve() params: ${e}`).message);const{id:r,namespaces:i,relayProtocol:s,sessionProperties:o,scopedProperties:a}=e;this.checkRecentlyDeleted(r),await this.isValidProposalId(r);const l=this.client.proposal.get(r),u=Ls(i,"approve()");if(u)throw new Error(u.message);const h=_l(l.requiredNamespaces,i,"approve()");if(h)throw new Error(h.message);if(!fe(s,!0)){const{message:d}=N("MISSING_OR_INVALID",`approve() relayProtocol: ${s}`);throw new Error(d)}if(we(o)||this.validateSessionProps(o,"sessionProperties"),!we(a)){this.validateSessionProps(a,"scopedProperties");const d=new Set(Object.keys(i));if(!Object.keys(a).every(f=>d.has(f.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(a)}, approved namespaces: ${Array.from(d).join(", ")}`)}}),k(this,"isValidReject",async e=>{if(!Fe(e)){const{message:s}=N("MISSING_OR_INVALID",`reject() params: ${e}`);throw new Error(s)}const{id:r,reason:i}=e;if(this.checkRecentlyDeleted(r),await this.isValidProposalId(r),!yv(i)){const{message:s}=N("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(i)}`);throw new Error(s)}}),k(this,"isValidSessionSettleRequest",e=>{if(!Fe(e)){const{message:u}=N("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw new Error(u)}const{relay:r,controller:i,namespaces:s,expiry:o}=e;if(!Ld(r)){const{message:u}=N("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(u)}const a=lv(i,"onSessionSettleRequest()");if(a)throw new Error(a.message);const l=Ls(s,"onSessionSettleRequest()");if(l)throw new Error(l.message);if(on(o)){const{message:u}=N("EXPIRED","onSessionSettleRequest()");throw new Error(u)}}),k(this,"isValidUpdate",async e=>{if(!Fe(e)){const{message:l}=N("MISSING_OR_INVALID",`update() params: ${e}`);throw new Error(l)}const{topic:r,namespaces:i}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const s=this.client.session.get(r),o=Ls(i,"update()");if(o)throw new Error(o.message);const a=_l(s.requiredNamespaces,i,"update()");if(a)throw new Error(a.message)}),k(this,"isValidExtend",async e=>{if(!Fe(e)){const{message:i}=N("MISSING_OR_INVALID",`extend() params: ${e}`);throw new Error(i)}const{topic:r}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r)}),k(this,"isValidRequest",async e=>{if(!Fe(e)){const{message:l}=N("MISSING_OR_INVALID",`request() params: ${e}`);throw new Error(l)}const{topic:r,request:i,chainId:s,expiry:o}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);const{namespaces:a}=this.client.session.get(r);if(!pl(a,s)){const{message:l}=N("MISSING_OR_INVALID",`request() chainId: ${s}`);throw new Error(l)}if(!gv(i)){const{message:l}=N("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw new Error(l)}if(!bv(a,s,i.method)){const{message:l}=N("MISSING_OR_INVALID",`request() method: ${i.method}`);throw new Error(l)}if(o&&!Pv(o,$s)){const{message:l}=N("MISSING_OR_INVALID",`request() expiry: ${o}. Expiry must be a number (in seconds) between ${$s.min} and ${$s.max}`);throw new Error(l)}}),k(this,"isValidRespond",async e=>{var r;if(!Fe(e)){const{message:o}=N("MISSING_OR_INVALID",`respond() params: ${e}`);throw new Error(o)}const{topic:i,response:s}=e;try{await this.isValidSessionTopic(i)}catch(o){throw(r=e==null?void 0:e.response)!=null&&r.id&&this.cleanupAfterResponse(e),o}if(!Ev(s)){const{message:o}=N("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(s)}`);throw new Error(o)}}),k(this,"isValidPing",async e=>{if(!Fe(e)){const{message:i}=N("MISSING_OR_INVALID",`ping() params: ${e}`);throw new Error(i)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),k(this,"isValidEmit",async e=>{if(!Fe(e)){const{message:a}=N("MISSING_OR_INVALID",`emit() params: ${e}`);throw new Error(a)}const{topic:r,event:i,chainId:s}=e;await this.isValidSessionTopic(r);const{namespaces:o}=this.client.session.get(r);if(!pl(o,s)){const{message:a}=N("MISSING_OR_INVALID",`emit() chainId: ${s}`);throw new Error(a)}if(!vv(i)){const{message:a}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}if(!Iv(o,s,i.name)){const{message:a}=N("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw new Error(a)}}),k(this,"isValidDisconnect",async e=>{if(!Fe(e)){const{message:i}=N("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw new Error(i)}const{topic:r}=e;await this.isValidSessionOrPairingTopic(r)}),k(this,"isValidAuthenticate",e=>{const{chains:r,uri:i,domain:s,nonce:o}=e;if(!Array.isArray(r)||r.length===0)throw new Error("chains is required and must be a non-empty array");if(!fe(i,!1))throw new Error("uri is required parameter");if(!fe(s,!1))throw new Error("domain is required parameter");if(!fe(o,!1))throw new Error("nonce is required parameter");if([...new Set(r.map(l=>mi(l).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:a}=mi(r[0]);if(a!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),k(this,"getVerifyContext",async e=>{const{attestationId:r,hash:i,encryptedId:s,metadata:o,transportType:a}=e,l={verified:{verifyUrl:o.verifyUrl||xr,validation:"UNKNOWN",origin:o.url||""}};try{if(a===ae.link_mode){const h=this.getAppLinkIfEnabled(o,a);return l.verified.validation=h&&new URL(h).origin===new URL(o.url).origin?"VALID":"INVALID",l}const u=await this.client.core.verify.resolve({attestationId:r,hash:i,encryptedId:s,verifyUrl:o.verifyUrl});u&&(l.verified.origin=u.origin,l.verified.isScam=u.isScam,l.verified.validation=u.origin===new URL(o.url).origin?"VALID":"INVALID")}catch(u){this.client.logger.warn(u)}return this.client.logger.debug(`Verify context: ${JSON.stringify(l)}`),l}),k(this,"validateSessionProps",(e,r)=>{Object.values(e).forEach((i,s)=>{if(i==null){const{message:o}=N("MISSING_OR_INVALID",`${r} must contain an existing value for each key. Received: ${i} for key ${Object.keys(e)[s]}`);throw new Error(o)}})}),k(this,"getPendingAuthRequest",e=>{const r=this.client.auth.requests.get(e);return typeof r=="object"?r:void 0}),k(this,"addToRecentlyDeleted",(e,r)=>{if(this.recentlyDeletedMap.set(e,r),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const s=this.recentlyDeletedLimit/2;for(const o of this.recentlyDeletedMap.keys()){if(i++>=s)break;this.recentlyDeletedMap.delete(o)}}}),k(this,"checkRecentlyDeleted",e=>{const r=this.recentlyDeletedMap.get(e);if(r){const{message:i}=N("MISSING_OR_INVALID",`Record was recently deleted - ${r}: ${e}`);throw new Error(i)}}),k(this,"isLinkModeEnabled",(e,r)=>{var i,s,o,a,l,u,h,d,f;return!e||r!==ae.link_mode?!1:((s=(i=this.client.metadata)==null?void 0:i.redirect)==null?void 0:s.linkMode)===!0&&((a=(o=this.client.metadata)==null?void 0:o.redirect)==null?void 0:a.universal)!==void 0&&((u=(l=this.client.metadata)==null?void 0:l.redirect)==null?void 0:u.universal)!==""&&((h=e==null?void 0:e.redirect)==null?void 0:h.universal)!==void 0&&((d=e==null?void 0:e.redirect)==null?void 0:d.universal)!==""&&((f=e==null?void 0:e.redirect)==null?void 0:f.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(global==null?void 0:global.Linking)<"u"}),k(this,"getAppLinkIfEnabled",(e,r)=>{var i;return this.isLinkModeEnabled(e,r)?(i=e==null?void 0:e.redirect)==null?void 0:i.universal:void 0}),k(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;const r=Rc(e,"topic")||"",i=decodeURIComponent(Rc(e,"wc_ev")||""),s=this.client.session.keys.includes(r);s&&this.client.session.update(r,{transportType:ae.link_mode}),this.client.core.dispatchEnvelope({topic:r,message:i,sessionExists:s})}),k(this,"registerLinkModeListeners",async()=>{var e;if(_a()||fn()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){const r=global==null?void 0:global.Linking;if(typeof r<"u"){r.addEventListener("url",this.handleLinkModeMessage,this.client.name);const i=await r.getInitialURL();i&&setTimeout(()=>{this.handleLinkModeMessage({url:i})},50)}}}),k(this,"getTVFParams",(e,r,i)=>{var s,o,a;if(!((s=r.request)!=null&&s.method))return{};const l={correlationId:e,rpcMethods:[r.request.method],chainId:r.chainId};try{const u=this.extractTxHashesFromResult(r.request,i);l.txHashes=u,l.contractAddresses=this.isValidContractData(r.request.params)?[(a=(o=r.request.params)==null?void 0:o[0])==null?void 0:a.to]:[]}catch(u){this.client.logger.warn("Error getting TVF params",u)}return l}),k(this,"isValidContractData",e=>{var r;if(!e)return!1;try{const i=(e==null?void 0:e.data)||((r=e==null?void 0:e[0])==null?void 0:r.data);if(!i.startsWith("0x"))return!1;const s=i.slice(2);return/^[0-9a-fA-F]*$/.test(s)?s.length%2===0:!1}catch{}return!1}),k(this,"extractTxHashesFromResult",(e,r)=>{var i;try{if(!r)return[];const s=e.method,o=RA[s];if(s==="sui_signTransaction")return[Gg(r.transactionBytes)];if(s==="near_signTransaction")return[Uc(r)];if(s==="near_signTransactions")return r.map(l=>Uc(l));if(s==="xrpl_signTransactionFor"||s==="xrpl_signTransaction")return[(i=r.tx_json)==null?void 0:i.hash];if(s==="polkadot_signTransaction")return[qv({transaction:e.params.transactionPayload,signature:r.signature})];if(s==="algo_signTxn")return Yn(r)?r.map(l=>kc(l)):[kc(r)];if(s==="cosmos_signDirect")return[Yg(r)];if(typeof r=="string")return[r];const a=r[o.key];if(Yn(a))return s==="solana_signAllTransactions"?a.map(l=>Wg(l)):a;if(typeof a=="string")return[a]}catch(s){this.client.logger.warn("Error extracting tx hashes from result",s)}return[]})}async processPendingMessageEvents(){try{const t=this.client.session.keys,e=this.client.core.relayer.messages.getWithoutAck(t);for(const[r,i]of Object.entries(e))for(const s of i)try{await this.onProviderMessageEvent({topic:r,message:s,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${r}, message: ${s}`)}}catch(t){this.client.logger.warn("processPendingMessageEvents failed",t)}}isInitialized(){if(!this.initialized){const{message:t}=N("NOT_INITIALIZED",this.name);throw new Error(t)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(ue.message,t=>{this.onProviderMessageEvent(t)})}async onRelayMessage(t){const{topic:e,message:r,attestation:i,transportType:s}=t,{publicKey:o}=this.client.auth.authKeys.keys.includes(vi)?this.client.auth.authKeys.get(vi):{publicKey:void 0};try{const a=await this.client.core.crypto.decode(e,r,{receiverPublicKey:o,encoding:s===ae.link_mode?un:Ze});Fo(a)?(this.client.core.history.set(e,a),await this.onRelayEventRequest({topic:e,payload:a,attestation:i,transportType:s,encryptedId:ct(r)})):Ho(a)?(await this.client.core.history.resolve(a),await this.onRelayEventResponse({topic:e,payload:a,transportType:s}),this.client.core.history.delete(e,a.id)):await this.onRelayEventUnknownPayload({topic:e,payload:a,transportType:s}),await this.client.core.relayer.messages.ack(e,r)}catch(a){this.client.logger.error(a)}}registerExpirerEvents(){this.client.core.expirer.on(at.expired,async t=>{const{topic:e,id:r}=Uh(t.target);if(r&&this.client.pendingRequest.keys.includes(r))return await this.deletePendingSessionRequest(r,N("EXPIRED"),!0);if(r&&this.client.auth.requests.keys.includes(r))return await this.deletePendingAuthRequest(r,N("EXPIRED"),!0);e?this.client.session.keys.includes(e)&&(await this.deleteSession({topic:e,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:e})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r}))})}registerPairingEvents(){this.client.core.pairing.events.on(En.create,t=>this.onPairingCreated(t)),this.client.core.pairing.events.on(En.delete,t=>{this.addToRecentlyDeleted(t.topic,"pairing")})}isValidPairingTopic(t){if(!fe(t,!1)){const{message:e}=N("MISSING_OR_INVALID",`pairing topic should be a string: ${t}`);throw new Error(e)}if(!this.client.core.pairing.pairings.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`pairing topic doesn't exist: ${t}`);throw new Error(e)}if(on(this.client.core.pairing.pairings.get(t).expiry)){const{message:e}=N("EXPIRED",`pairing topic: ${t}`);throw new Error(e)}}async isValidSessionTopic(t){if(!fe(t,!1)){const{message:e}=N("MISSING_OR_INVALID",`session topic should be a string: ${t}`);throw new Error(e)}if(this.checkRecentlyDeleted(t),!this.client.session.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`session topic doesn't exist: ${t}`);throw new Error(e)}if(on(this.client.session.get(t).expiry)){await this.deleteSession({topic:t});const{message:e}=N("EXPIRED",`session topic: ${t}`);throw new Error(e)}if(!this.client.core.crypto.keychain.has(t)){const{message:e}=N("MISSING_OR_INVALID",`session topic does not exist in keychain: ${t}`);throw await this.deleteSession({topic:t}),new Error(e)}}async isValidSessionOrPairingTopic(t){if(this.checkRecentlyDeleted(t),this.client.session.keys.includes(t))await this.isValidSessionTopic(t);else if(this.client.core.pairing.pairings.keys.includes(t))this.isValidPairingTopic(t);else if(fe(t,!1)){const{message:e}=N("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${t}`);throw new Error(e)}else{const{message:e}=N("MISSING_OR_INVALID",`session or pairing topic should be a string: ${t}`);throw new Error(e)}}async isValidProposalId(t){if(!mv(t)){const{message:e}=N("MISSING_OR_INVALID",`proposal id should be a number: ${t}`);throw new Error(e)}if(!this.client.proposal.keys.includes(t)){const{message:e}=N("NO_MATCHING_KEY",`proposal id doesn't exist: ${t}`);throw new Error(e)}if(on(this.client.proposal.get(t).expiryTimestamp)){await this.deleteProposal(t);const{message:e}=N("EXPIRED",`proposal id: ${t}`);throw new Error(e)}}}class zA extends Un{constructor(t,e){super(t,e,TA,Da),this.core=t,this.logger=e}}class jA extends Un{constructor(t,e){super(t,e,PA,Da),this.core=t,this.logger=e}}class KA extends Un{constructor(t,e){super(t,e,LA,Da,r=>r.id),this.core=t,this.logger=e}}class FA extends Un{constructor(t,e){super(t,e,SA,rs,()=>vi),this.core=t,this.logger=e}}class HA extends Un{constructor(t,e){super(t,e,CA,rs),this.core=t,this.logger=e}}class WA extends Un{constructor(t,e){super(t,e,$A,rs,r=>r.id),this.core=t,this.logger=e}}var GA=Object.defineProperty,ZA=(n,t,e)=>t in n?GA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Us=(n,t,e)=>ZA(n,typeof t!="symbol"?t+"":t,e);class YA{constructor(t,e){this.core=t,this.logger=e,Us(this,"authKeys"),Us(this,"pairingTopics"),Us(this,"requests"),this.authKeys=new FA(this.core,this.logger),this.pairingTopics=new HA(this.core,this.logger),this.requests=new WA(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var JA=Object.defineProperty,QA=(n,t,e)=>t in n?JA(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e,Y=(n,t,e)=>QA(n,typeof t!="symbol"?t+"":t,e);class xa extends Sw{constructor(t){super(t),Y(this,"protocol",Hd),Y(this,"version",Wd),Y(this,"name",Cs.name),Y(this,"metadata"),Y(this,"core"),Y(this,"logger"),Y(this,"events",new Sn.EventEmitter),Y(this,"engine"),Y(this,"session"),Y(this,"proposal"),Y(this,"pendingRequest"),Y(this,"auth"),Y(this,"signConfig"),Y(this,"on",(r,i)=>this.events.on(r,i)),Y(this,"once",(r,i)=>this.events.once(r,i)),Y(this,"off",(r,i)=>this.events.off(r,i)),Y(this,"removeListener",(r,i)=>this.events.removeListener(r,i)),Y(this,"removeAllListeners",r=>this.events.removeAllListeners(r)),Y(this,"connect",async r=>{try{return await this.engine.connect(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"pair",async r=>{try{return await this.engine.pair(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"approve",async r=>{try{return await this.engine.approve(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"reject",async r=>{try{return await this.engine.reject(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"update",async r=>{try{return await this.engine.update(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"extend",async r=>{try{return await this.engine.extend(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"request",async r=>{try{return await this.engine.request(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"respond",async r=>{try{return await this.engine.respond(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"ping",async r=>{try{return await this.engine.ping(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"emit",async r=>{try{return await this.engine.emit(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"disconnect",async r=>{try{return await this.engine.disconnect(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"find",r=>{try{return this.engine.find(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(r){throw this.logger.error(r.message),r}}),Y(this,"authenticate",async(r,i)=>{try{return await this.engine.authenticate(r,i)}catch(s){throw this.logger.error(s.message),s}}),Y(this,"formatAuthMessage",r=>{try{return this.engine.formatAuthMessage(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"approveSessionAuthenticate",async r=>{try{return await this.engine.approveSessionAuthenticate(r)}catch(i){throw this.logger.error(i.message),i}}),Y(this,"rejectSessionAuthenticate",async r=>{try{return await this.engine.rejectSessionAuthenticate(r)}catch(i){throw this.logger.error(i.message),i}}),this.name=(t==null?void 0:t.name)||Cs.name,this.metadata=Ny(t==null?void 0:t.metadata),this.signConfig=t==null?void 0:t.signConfig;const e=typeof(t==null?void 0:t.logger)<"u"&&typeof(t==null?void 0:t.logger)!="string"?t.logger:hu(Ko({level:(t==null?void 0:t.logger)||Cs.logger}));this.core=(t==null?void 0:t.core)||new AA(t),this.logger=ze(e,this.name),this.session=new jA(this.core,this.logger),this.proposal=new zA(this.core,this.logger),this.pendingRequest=new KA(this.core,this.logger),this.engine=new qA(this),this.auth=new YA(this.core,this.logger)}static async init(t){const e=new xa(t);return await e.initialize(),e}get context(){return rt(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(t){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(t.message),t}}}const XA=xa,eT="08c4b07e3ad25f1a27c14a4e8cecb6f0",PP="eip155";async function tT(n){const{account:t,chainId:e,params:[r]}=n;if(!t.sendRawTransaction)throw new Error("The current account does not support sending raw transactions");return(await t.sendRawTransaction({chainId:e,rawTransaction:r})).transactionHash}function is(n,t){if(ka(n.address)!==ka(t))throw new Error(`Failed to validate account address (${n.address}), differs from ${t}`)}function OP(n){const t=n.split(":"),e=Number.parseInt(t[1]??"0");if(t.length!==2||t[0]!=="eip155"||e===0||!e)throw new Error(`Invalid chainId ${n}, should have the format 'eip155:1'`);return e}async function nT(n){const{account:t,chainId:e,thirdwebClient:r,params:[i]}=n;i.from!==void 0&&is(t,i.from);const s=js({chain:be(e),client:r,data:i.data,gas:i.gas?Be(i.gas):void 0,gasPrice:i.gasPrice?Be(i.gasPrice):void 0,to:i.to,value:i.value?Be(i.value):void 0});return(await iu({account:t,transaction:s})).transactionHash}async function Fl(n){const{account:t,params:e}=n;return is(t,e[1]),t.signMessage({message:{raw:e[0]}})}async function rT(n){const{account:t,params:[e]}=n;if(!t.signTransaction)throw new Error("The current account does not support signing transactions");return e.from!==void 0&&is(t,e.from),t.signTransaction({data:e.data,gas:e.gas?Be(e.gas):void 0,gasPrice:e.gasPrice?Be(e.gasPrice):void 0,nonce:e.nonce?Rn(e.nonce):void 0,to:e.to,value:e.value?Be(e.value):void 0})}async function Hl(n){const{account:t,params:e}=n;return is(t,e[0]),t.signTypedData(typeof e[1]=="string"?JSON.parse(e[1]):e[1])}async function Zd(n){var r;const{wallet:t,params:e}=n;return((r=t.getChain())==null?void 0:r.id)===Rn(e[0].chainId)||await t.switchChain(Nf(Rn(e[0].chainId))),"0x1"}const RP=Object.freeze(Object.defineProperty({__proto__:null,handleSwitchChain:Zd},Symbol.toStringTag,{value:"Module"})),LP="/sdk/2022-08-12/embedded-wallet",ks=n=>`thirdwebEwsWalletUserId-${n}`,iT="walletToken",Bs=n=>`${iT}-${n}`,Wl=n=>`passkey-credential-id-${n}`,sT="a",Ns=(n,t)=>`${sT}-${n}-${t}`,Gl=n=>`walletConnectSessions-${n}`,Zl=n=>`thirdweb_guest_session_id_${n}`,Yl=new Map;class Va{constructor({storage:t,clientId:e,ecosystem:r}){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"storage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"ecosystem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.storage=t,this.key=oT(e,r==null?void 0:r.id),this.ecosystem=r}async getItem(t){return this.storage?this.storage.getItem(t):Yl.get(t)??null}async setItem(t,e){if(this.storage)return this.storage.setItem(t,e);Yl.set(t,e)}async removeItem(t){const e=await this.getItem(t);return this.storage&&e?(this.storage.removeItem(t),!0):!1}async getWalletConnectSessions(){return this.getItem(Gl(this.key))}async saveWalletConnectSessions(t){await this.setItem(Gl(this.key),t)}async savePasskeyCredentialId(t){await this.setItem(Wl(this.key),t)}async getPasskeyCredentialId(){return this.getItem(Wl(this.key))}async saveAuthCookie(t){await this.setItem(Bs(this.key),t)}async getAuthCookie(){return this.getItem(Bs(this.key))}async removeAuthCookie(){return this.removeItem(Bs(this.key))}async saveDeviceShare(t,e){await this.saveWalletUserId(e),await this.setItem(Ns(this.key,e),t)}async getDeviceShare(){const t=await this.getWalletUserId();return t?this.getItem(Ns(this.key,t)):null}async removeDeviceShare(){const t=await this.getWalletUserId();return t?this.removeItem(Ns(this.key,t)):!1}async getWalletUserId(){return this.getItem(ks(this.key))}async saveWalletUserId(t){await this.setItem(ks(this.key),t)}async removeWalletUserId(){return this.removeItem(ks(this.key))}async getGuestSessionId(){return this.getItem(Zl(this.key))}async saveGuestSessionId(t){await this.setItem(Zl(this.key),t)}}const oT=(n,t)=>`${n}${t?`-${t}`:""}`;let Lt;async function Yd(){if(!Lt)return[];const n=await Lt.getWalletConnectSessions();return JSON.parse(n??"[]")}function aT(n){Lt||(Lt=new Va({clientId:n.clientId,storage:null}))}async function DP(n){if(!Lt)return;const t=await Lt.getWalletConnectSessions(),e=JSON.parse(t??"[]");e.push(n),await Lt.saveWalletConnectSessions(Ee(e))}async function cT(n){if(!Lt)return;const t=await Lt.getWalletConnectSessions(),r=JSON.parse(t??"[]").filter(i=>i.topic!==n.topic);await Lt.saveWalletConnectSessions(Ee(r))}let Ms=new WeakMap;const lT={eth_sendRawTransaction:tT,eth_sendTransaction:nT,eth_sign:Fl,eth_signTransaction:rT,eth_signTypedData:Hl,eth_signTypedData_v4:Hl,personal_sign:Fl,wallet_addEthereumChain:n=>{throw new Error("Unsupported request method: wallet_addEthereumChain")},wallet_switchEthereumChain:Zd};async function uT(n){var h,d,f,p;const{wallet:t,requestHandlers:e,onConnect:r,onDisconnect:i,client:s}=n,o=n.chains&&n.chains.length>10?(console.warn("WalletConnect: Can specify no more than 10 chains, truncating to the first 10 provided chains..."),n.chains.slice(0,10)):n.chains;if(Ms.has(s))return Ms.get(s);aT({clientId:n.client.clientId});const a=Oi(),l=await XA.init({metadata:{description:((h=n.appMetadata)==null?void 0:h.description)??a.description,icons:[((d=n.appMetadata)==null?void 0:d.logoUrl)??a.logoUrl],name:((f=n.appMetadata)==null?void 0:f.name)??a.name,url:((p=n.appMetadata)==null?void 0:p.url)??a.url},projectId:n.projectId??eT});l.on("session_proposal",async w=>{const{onSessionProposal:m}=await c(async()=>{const{onSessionProposal:_}=await import("./session-proposal-CRjqbz7W.js");return{onSessionProposal:_}},__vite__mapDeps([26,1,2,3,4,5,6,7,8]));await m({chains:o,event:w,onConnect:r,wallet:t,walletConnectClient:l}).catch(_=>{if(n.onError)n.onError(_);else throw _})}),l.on("session_request",async w=>{const{fulfillRequest:m}=await c(async()=>{const{fulfillRequest:_}=await import("./session-request-BI3BlMfs.js");return{fulfillRequest:_}},__vite__mapDeps([27,3,1,2,4,5,6,7,8]));await m({event:w,handlers:e,thirdwebClient:s,wallet:t,walletConnectClient:l}).catch(_=>{if(n.onError)n.onError(_);else throw _})}),l.on("session_event",async w=>{}),l.on("session_ping",w=>{}),l.on("session_delete",async w=>{await Jd({session:{topic:w.topic},walletConnectClient:l}).catch(m=>{if(n.onError)n.onError(m);else throw m})});const u=l.disconnect;return l.disconnect=async w=>{const m=await u(w).catch(()=>{});return i&&fT({onDisconnect:i,topic:w.topic}),m},Ms.set(n.client,l),l}function hT(n){const{uri:t,walletConnectClient:e}=n;e.core.pairing.pair({uri:t})}async function dT(){return Yd()}async function Jd(n){cT(n.session);try{await n.walletConnectClient.disconnect({reason:{code:6e3,message:"Disconnected"},topic:n.session.topic})}catch{}}async function fT(n){const{topic:t,onDisconnect:e}=n,r=await Yd();e(r.find(i=>i.topic===t)??{topic:t})}function pT(n){return[mt("inApp",{executionMode:n==null?void 0:n.executionMode}),mt(_u),mt(Ot,{appMetadata:n==null?void 0:n.appMetadata,chains:n==null?void 0:n.chains}),mt(Ip),mt("io.rabby"),mt(Ap),mt("com.okex.wallet")]}function _T(n,t){const e=new Set;let r=n();const i=()=>{for(const o of e)o()},s=o=>{r=o,i()};for(const o of t)o.subscribe(()=>{s(n())});return{getValue(){return r},subscribe(o){return e.add(o),()=>{e.delete(o)}}}}function fi(n,t,e=!0){e&&n();const r=t.map(i=>i.subscribe(()=>{n()}));return()=>{for(const i of r)i()}}const Kr="tw:connected-wallet-params";async function xP(n,t,e){if(!mT(e))throw new Error("given params are not stringifiable");const r=await n.getItem(Kr);let i;if(r){try{i=JSON.parse(r)}catch{i={}}i[t]=e}else i={[t]:e};n.setItem(Kr,Ee(i))}async function wT(n,t){const e=await n.getItem(Kr);let r;if(e){try{r=JSON.parse(e)}catch{r={}}delete r[t],n.setItem(Kr,Ee(r))}}async function VP(n,t){const e=await n.getItem(Kr);if(!e)return null;try{const r=JSON.parse(e);return r!=null&&r[t]?r[t]:null}catch{return null}}function mT(n){try{return Ee(n),!0}catch{return!1}}function yT(n){let t;return()=>(t||(t=n()),t)}function gT(n={}){return ou({filters:n,signature:"event UserOperationRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function ET(n={}){return ou({filters:n,signature:"event PostOpRevertReason(bytes32 indexed userOpHash, address indexed sender, uint256 nonce, bytes revertReason)"})}function vT(n){const{receipt:t}=n,e={...t,blockNumber:t.blockNumber?BigInt(t.blockNumber):null,contractAddress:t.contractAddress?t.contractAddress:null,cumulativeGasUsed:t.cumulativeGasUsed?BigInt(t.cumulativeGasUsed):null,effectiveGasPrice:t.effectiveGasPrice?BigInt(t.effectiveGasPrice):null,gasUsed:t.gasUsed?BigInt(t.gasUsed):null,logs:t.logs,status:t.status,to:t.to?t.to:null,transactionHash:t.transactionHash,transactionIndex:t.transactionIndex,type:t.type};return t.blobGasPrice&&(e.blobGasPrice=BigInt(t.blobGasPrice)),t.blobGasUsed&&(e.blobGasUsed=BigInt(t.blobGasUsed)),{...n,actualGasCost:BigInt(n.actualGasCost),actualGasUsed:BigInt(n.actualGasUsed),nonce:BigInt(n.nonce),receipt:e,userOpHash:n.userOpHash}}const SP=()=>{const n=BigInt(Math.floor(Math.random()*4294967296)),t=BigInt(Math.floor(Math.random()*4294967296)),e=BigInt(Math.floor(Math.random()*4294967296)),r=BigInt(Math.floor(Math.random()*4294967296)),i=BigInt(Math.floor(Math.random()*4294967296)),s=BigInt(Math.floor(Math.random()*4294967296));return n<<BigInt(160)|t<<BigInt(128)|e<<BigInt(96)|r<<BigInt(64)|i<<BigInt(32)|s};function Qd(n){return Object.fromEntries(Object.entries(n).map(([t,e])=>[t,e==null||Ii(e)?e:qo(e)]))}async function CP(n){return pn({...n,operation:"eth_sendUserOperation",params:[Qd(n.userOp),n.options.entrypointAddress??Fi]})}async function $P(n,t){const e=await pn({...n,operation:"eth_estimateUserOperationGas",params:[Qd(n.userOp),n.options.entrypointAddress??Fi,t??{}]});return{callGasLimit:Be(e.callGasLimit)+wp,paymasterPostOpGasLimit:e.paymasterPostOpGasLimit!==void 0?Be(e.paymasterPostOpGasLimit):void 0,paymasterVerificationGasLimit:e.paymasterVerificationGasLimit!==void 0?Be(e.paymasterVerificationGasLimit):void 0,preVerificationGas:Be(e.preVerificationGas),verificationGas:e.verificationGas!==void 0?Be(e.verificationGas):void 0,verificationGasLimit:Be(e.verificationGasLimit)}}async function UP(n){const t=await pn({...n,operation:"thirdweb_getUserOperationGasPrice",params:[]});return{maxFeePerGas:Be(t.maxFeePerGas),maxPriorityFeePerGas:Be(t.maxPriorityFeePerGas)}}async function kP(n){var e,r;const t=await bT(n);if(t){if(t.success===!1){const s=(r=(e=Of({events:[gT(),ET()],logs:t.logs})[0])==null?void 0:e.args)==null?void 0:r.revertReason;if(!s)throw new Error(`UserOp failed at txHash: ${t.receipt.transactionHash}`);const o=Rf({data:s});throw new Error(`UserOp failed with reason: '${o.args.join(",")}' at txHash: ${t.receipt.transactionHash}`)}return t.receipt}}async function bT(n){const t=await pn({operation:"eth_getUserOperationReceipt",options:n,params:[n.userOpHash]});if(t)return vT(t)}async function BP(n){const t=await pn({operation:"zk_paymasterData",options:n.options,params:[n.transaction]});return{paymaster:t.paymaster,paymasterInput:t.paymasterInput}}async function IT(n){const t=await pn({...n,operation:"tw_execute",params:[n.eoaAddress,n.wrappedCalls,n.signature,n.authorization]});if(!t.queueId)throw new Error(`Error executing 7702 transaction: ${Ee(t)}`);return{transactionId:t.queueId}}async function AT(n){return{transactionHash:(await pn({...n,operation:"tw_getTransactionHash",params:[n.transactionId]})).transactionHash}}async function NP(n){return{transactionHash:(await pn({operation:"zk_broadcastTransaction",options:n.options,params:[{...n.transaction,signedTransaction:n.signedTransaction}]})).transactionHash}}async function pn(n){const{options:t,operation:e,params:r}=n,i=t.bundlerUrl??fu(t.chain),o=await Fr(t.client)(i,{useAuthToken:!0,body:Ee({id:1,jsonrpc:"2.0",method:e,params:r}),headers:{"Content-Type":"application/json"},method:"POST"}),a=await o.json();if(!o.ok||a.error){let l=a.error||o.statusText;typeof l=="object"&&(l=Ee(l));const u=a.code||"UNKNOWN";throw new Error(`${e} error: ${l}
|
|
16
|
-
Status: ${o.status}
|
|
17
|
-
Code: ${u}`)}return a.result}function Co(n){if(!n)return!1;if(n.id==="smart")return!0;if(n.id==="inApp"||Xn(n)){const t=n.getConfig();if(t&&"smartAccount"in t&&t.smartAccount)return!0;if(t!=null&&t.executionMode){const e=t.executionMode;return e.mode==="EIP4337"||e.mode==="EIP7702"}}return!1}const Xd="thirdweb:connected-wallet-ids",bi="thirdweb:active-wallet-id",$o="thirdweb:active-chain",Jl="thirdweb:last-used-wallet-id";function TT(n){const t=wn(void 0),e=wn(void 0),r=wn(void 0),i=wn("unknown"),s=wn(new Map);fi(()=>{Mf([...s.getValue().values()])},[s]),fi(()=>{const y=r.getValue();if(!y)return;const b=s.getValue().get(y.id);!b||b===y||r.setValue(b)},[s,r]);const o=wn(new Map),a=wn(!1),l=_T(()=>Array.from(o.getValue().values()),[o]),u=y=>{const b=o.getValue();if(b.has(y.id))return;const I=new Map(b);I.set(y.id,y),o.setValue(I)},h=y=>{const b=o.getValue(),I=new Map(b);I.delete(y.id),o.setValue(I)},d=y=>{wT(n,y.id),h(y),t.getValue()===y&&(n.removeItem(bi),e.setValue(void 0),r.setValue(void 0),t.setValue(void 0),i.setValue("disconnected"))},f=y=>{d(y),y.disconnect()},p=async(y,b)=>{if(!y.getAccount())throw new Error("Cannot set a wallet without an account as active");const D=await(async()=>b!=null&&b.accountAbstraction&&!Co(y)?await PT(y,b.client,b.accountAbstraction,d):y)();return await n.setItem(bi,y.id),await n.setItem(Jl,y.id),u(y),(b==null?void 0:b.setWalletAsActive)!==!1&&m(D),y.subscribe("accountChanged",async()=>{var x;const S=await p(y,b);(x=b==null?void 0:b.onConnect)==null||x.call(b,S,l.getValue())}),D},w=async(y,b)=>{var D;const I=await p(y,b);return(D=b==null?void 0:b.onConnect)==null||D.call(b,I,l.getValue()),I},m=y=>{const b=y.getAccount();if(!b)throw new Error("Cannot set a wallet without an account as active");u(y),t.setValue(y),e.setValue(b),r.setValue(y.getChain()),i.setValue("connected");const I=A=>{e.setValue(A)},D=y.subscribe("accountChanged",I),S=y.subscribe("chainChanged",A=>r.setValue(A)),x=y.subscribe("disconnect",()=>{E()}),E=()=>{d(y),D(),S(),x()}},_=async y=>{m(y),y.id!=="smart"&&(await n.setItem(bi,y.id),await n.setItem(Jl,y.id))};fi(()=>{const y=r.getValue();y?n.setItem($o,Ee(y)):n.removeItem($o)},[r],!1),fi(async()=>{const b=l.getValue().map(I=>I==null?void 0:I.id).filter(I=>!!I);n.setItem(Xd,Ee(Array.from(new Set([...b]))))},[l],!1);const g=async y=>{const b=t.getValue();if(!b)throw new Error("No active wallet found");if(!b.switchChain)throw new Error("Wallet does not support switching chains");if(Co(b)){const I=await Sa(n);if(I){const D=l.getValue().find(S=>S.id===I);if(D){await D.switchChain(y),await b.switchChain(y),m(b);return}}await b.switchChain(y),m(b)}else await b.switchChain(y);r.setValue(b.getChain())};function v(y){const b=s.getValue();if(y.every(S=>{const x=b.get(S.id);return Ee(x)===Ee(S)}))return;const D=new Map(b);for(const S of y)D.set(S.id,S);s.setValue(D)}return{activeAccountStore:e,activeWalletChainStore:r,activeWalletConnectionStatusStore:i,activeWalletStore:t,addConnectedWallet:u,connect:w,connectedWallets:l,defineChains:v,disconnectWallet:f,handleConnection:p,isAutoConnecting:a,removeConnectedWallet:h,setActiveWallet:_,switchActiveWalletChain:g}}async function ef(n){try{const t=await n.getItem(Xd);return t?JSON.parse(t):[]}catch{return[]}}async function Sa(n){try{const t=await n.getItem(bi);if(t)return t}catch{}return null}async function tf(n){try{const t=await n.getItem($o);if(t)return JSON.parse(t)}catch{}return null}const PT=async(n,t,e,r)=>{const i=n.getAccount();if(!i)throw new Error("Cannot set a wallet without an account as active");const s=Xo(e);await s.connect({chain:e.chain,client:t,personalAccount:i});const o=n.subscribe("disconnect",()=>{a()}),a=()=>{o(),r(s)};return s};function nf(n,t){return new Promise((e,r)=>{const i=setTimeout(()=>{r(new Error(t.message))},t.ms);n.then(s=>{clearTimeout(i),e(s)},s=>{clearTimeout(i),r(s)})})}async function OT({client:n,ecosystem:t,tokenToLink:e,storage:r}){const i=Fr(n,t),s=Ki("inAppWallet"),o=await r.getAuthCookie();if(!o)throw new Error("Failed to link account, no user logged in");const a={Authorization:`Bearer iaw-auth-token:${o}`,"Content-Type":"application/json"},l=await i(`${s}/api/2024-05-05/account/connect`,{body:Ee({accountAuthTokenToConnect:e}),headers:a,method:"POST"});if(!l.ok){const h=await l.json();throw new Error(h.message||"Failed to link account.")}const{linkedAccounts:u}=await l.json();return u??[]}async function MP({client:n,ecosystem:t,profileToUnlink:e,allowAccountDeletion:r=!1,storage:i}){const s=Fr(n,t),o=Ki("inAppWallet"),a=await i.getAuthCookie();if(!a)throw new Error("Failed to unlink account, no user logged in");const l={Authorization:`Bearer iaw-auth-token:${a}`,"Content-Type":"application/json"},u=await s(`${o}/api/2024-05-05/account/disconnect`,{body:Ee({allowAccountDeletion:r,details:e.details,type:e.type}),headers:l,method:"POST"});if(!u.ok){const d=await u.json();throw new Error(d.message||"Failed to unlink account.")}const{linkedAccounts:h}=await u.json();return h??[]}async function qP({client:n,ecosystem:t,storage:e}){const r=Fr(n,t),i=Ki("inAppWallet"),s=await e.getAuthCookie();if(!s)throw new Error("Failed to get linked accounts, no user logged in");const o={Authorization:`Bearer iaw-auth-token:${s}`,"Content-Type":"application/json"},a=await r(`${i}/api/2024-05-05/accounts`,{headers:o,method:"GET"});if(!a.ok){const u=await a.json();throw new Error(u.message||"Failed to get linked accounts.")}const{linkedAccounts:l}=await a.json();return l??[]}const rf=["google","apple","facebook","discord","line","x","tiktok","epic","coinbase","farcaster","telegram","github","twitch","steam"],zP=[...rf,"guest","backend","email","phone","passkey","wallet"],RT="0x3f707e6b",LT=[{type:"tuple[]",name:"calls",components:[{type:"address",name:"target"},{type:"uint256",name:"value"},{type:"bytes",name:"data"}]}],DT=[];function xT(n){const t=yT(async()=>"asyncParams"in n?await n.asyncParams():n);return Lf({contract:n.contract,method:[RT,LT,DT],params:async()=>[(await t()).calls],value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.value},accessList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.accessList},gas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gas},gasPrice:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.gasPrice},maxFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxFeePerGas},maxPriorityFeePerGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.maxPriorityFeePerGas},nonce:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.nonce},extraGas:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.extraGas},erc20Value:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.erc20Value},authorizationList:async()=>{var e;return(e=(await t()).overrides)==null?void 0:e.authorizationList}})}async function VT(n){const{client:t,chain:e,bundlerUrl:r}=n,i=r??fu(e),s=`delegation-contract:${i}`;return cu(async()=>{var u;const a=await Fr(t)(i,{useAuthToken:!0,body:Ee({id:1,jsonrpc:"2.0",method:"tw_getDelegationContract",params:[]}),headers:{"Content-Type":"application/json"},method:"POST"});if(!a.ok)throw new Error(`Failed to fetch delegation contract: ${a.status} ${a.statusText}`);const l=await a.json();if(l.error)throw new Error(`Delegation contract RPC error: ${JSON.stringify(l.error)}`);if(!((u=l.result)!=null&&u.delegationContract))throw new Error("Invalid response: missing delegationContract in result");return l.result.delegationContract},{cacheKey:s,cacheTime:24*60*60*1e3})}const ST=n=>{const{client:t,adminAccount:e,sponsorGas:r}=n,i=async o=>{var w,m,_;const a=o[0];if(!a)throw new Error("No transactions provided");const l=be(a.chainId),u=No({address:e.address,chain:l,client:t,abi:kT});let h=(w=a.authorizationList)==null?void 0:w[0];const d=await VT({client:t,chain:l});if(h&&((m=h.address)==null?void 0:m.toLowerCase())!==d.toLowerCase())throw new Error(`Authorization address does not match expected delegation contract address. Expected ${d} but got ${h.address}`);if(!h&&!await $T(u,d)){let v=a.nonce?BigInt(a.nonce):BigInt(await CT({client:t,address:e.address,chain:l}));v+=r?0n:1n;const y=await((_=e.signAuthorization)==null?void 0:_.call(e,{address:J(d),chainId:a.chainId,nonce:v}));if(!y)throw new Error("Failed to sign authorization");h=y}if(r){const g={calls:o.map(I=>({data:I.data??"0x",target:J(I.to??""),value:I.value??0n})),uid:lp()},v=await e.signTypedData({domain:{chainId:a.chainId,name:"MinimalAccount",verifyingContract:u.address,version:"1"},message:g,primaryType:"WrappedCalls",types:{Call:[{name:"target",type:"address"},{name:"value",type:"uint256"},{name:"data",type:"bytes"}],WrappedCalls:[{name:"calls",type:"Call[]"},{name:"uid",type:"bytes32"}]}}),y=await IT({authorization:h,eoaAddress:J(e.address),options:{chain:be(a.chainId),client:t},signature:v,wrappedCalls:g});return{transactionHash:await UT({options:{chain:be(a.chainId),client:t},transactionId:y.transactionId})}}const f=xT({calls:o.map(g=>({data:g.data??"0x",target:J(g.to??""),value:g.value??0n})),contract:u,overrides:{authorizationList:h?[h]:void 0,value:o.reduce((g,v)=>g+(v.value??0n),0n)}}),p=await Df({from:e.address,transaction:f});return e.sendTransaction(p)},s={address:e.address,sendBatchTransaction:async o=>i(o),sendTransaction:async o=>i([o]),signMessage:({message:o,originalMessage:a,chainId:l})=>e.signMessage({chainId:l,message:o,originalMessage:a}),signTypedData:o=>e.signTypedData(o),sendCalls:async o=>{const{inAppWalletSendCalls:a}=await c(async()=>{const{inAppWalletSendCalls:f}=await import("./in-app-wallet-calls-CIRR0eJZ.js");return{inAppWalletSendCalls:f}},__vite__mapDeps([28,29,1,2,3,16,30,4,5,6,7,8])),l=o.calls[0];if(!l)throw new Error("No calls to send");const u=l.client,h=l.chain||o.chain,d=await a({account:s,calls:o.calls,chain:h});return{chain:h,client:u,id:d}},getCallsStatus:async o=>{const{inAppWalletGetCallsStatus:a}=await c(async()=>{const{inAppWalletGetCallsStatus:l}=await import("./in-app-wallet-calls-CIRR0eJZ.js");return{inAppWalletGetCallsStatus:l}},__vite__mapDeps([28,29,1,2,3,16,30,4,5,6,7,8]));return a(o)},getCallsStatusRaw:async o=>{const{inAppWalletGetCallsStatusRaw:a}=await c(async()=>{const{inAppWalletGetCallsStatusRaw:l}=await import("./in-app-wallet-calls-CIRR0eJZ.js");return{inAppWalletGetCallsStatusRaw:l}},__vite__mapDeps([28,29,1,2,3,16,30,4,5,6,7,8]));return a(o)},getCapabilities:async o=>({[o.chainId??1]:{atomic:{status:"supported"},paymasterService:{supported:r??!1}}})};return s};async function CT(n){const{client:t,address:e,chain:r}=n,i=ji({chain:r,client:t});return await c(async()=>{const{eth_getTransactionCount:o}=await import("./eth_getTransactionCount-CF50onAO.js");return{eth_getTransactionCount:o}},__vite__mapDeps([31,1,2,3])).then(({eth_getTransactionCount:o})=>o(i,{address:J(e),blockTag:"pending"}))}async function $T(n,t){const e=await xf(n),r=e.length>0&&e.startsWith("0xef0100"),i=`0x${e.slice(8,48)}`;return r&&i.toLowerCase()===t.toLowerCase()}async function UT(n){const t=n.timeoutMs||3e5,e=n.intervalMs||1e3,r=Date.now()+t;for(;Date.now()<r;){const i=await AT({options:n.options,transactionId:n.transactionId});if(i.transactionHash)return i.transactionHash;await new Promise(s=>setTimeout(s,e))}throw new Error(`Timeout waiting for transaction to be mined on chain ${n.options.chain.id} with transactionId: ${n.transactionId}`)}const kT=[{type:"receive",stateMutability:"payable"},{type:"function",name:"createSessionWithSig",inputs:[{name:"sessionSpec",type:"tuple",internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"nonpayable"},{type:"function",name:"eip712Domain",inputs:[],outputs:[{name:"fields",type:"bytes1",internalType:"bytes1"},{name:"name",type:"string",internalType:"string"},{name:"version",type:"string",internalType:"string"},{name:"chainId",type:"uint256",internalType:"uint256"},{name:"verifyingContract",type:"address",internalType:"address"},{name:"salt",type:"bytes32",internalType:"bytes32"},{name:"extensions",type:"uint256[]",internalType:"uint256[]"}],stateMutability:"view"},{type:"function",name:"execute",inputs:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]}],outputs:[],stateMutability:"payable"},{type:"function",name:"executeWithSig",inputs:[{name:"wrappedCalls",type:"tuple",internalType:"struct WrappedCalls",components:[{name:"calls",type:"tuple[]",internalType:"struct Call[]",components:[{name:"target",type:"address",internalType:"address"},{name:"value",type:"uint256",internalType:"uint256"},{name:"data",type:"bytes",internalType:"bytes"}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]},{name:"signature",type:"bytes",internalType:"bytes"}],outputs:[],stateMutability:"payable"},{type:"function",name:"getCallPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]}],stateMutability:"view"},{type:"function",name:"getSessionExpirationForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"uint256",internalType:"uint256"}],stateMutability:"view"},{type:"function",name:"getSessionStateForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple",internalType:"struct SessionLib.SessionState",components:[{name:"transferValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callValue",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]},{name:"callParams",type:"tuple[]",internalType:"struct SessionLib.LimitState[]",components:[{name:"remaining",type:"uint256",internalType:"uint256"},{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"index",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"getTransferPoliciesForSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}],stateMutability:"view"},{type:"function",name:"isWildcardSigner",inputs:[{name:"signer",type:"address",internalType:"address"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"function",name:"onERC1155BatchReceived",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"uint256[]",internalType:"uint256[]"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC1155Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"onERC721Received",inputs:[{name:"",type:"address",internalType:"address"},{name:"",type:"address",internalType:"address"},{name:"",type:"uint256",internalType:"uint256"},{name:"",type:"bytes",internalType:"bytes"}],outputs:[{name:"",type:"bytes4",internalType:"bytes4"}],stateMutability:"nonpayable"},{type:"function",name:"supportsInterface",inputs:[{name:"interfaceId",type:"bytes4",internalType:"bytes4"}],outputs:[{name:"",type:"bool",internalType:"bool"}],stateMutability:"view"},{type:"event",name:"Executed",inputs:[{name:"to",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"},{name:"data",type:"bytes",indexed:!1,internalType:"bytes"}],anonymous:!1},{type:"event",name:"SessionCreated",inputs:[{name:"signer",type:"address",indexed:!0,internalType:"address"},{name:"sessionSpec",type:"tuple",indexed:!1,internalType:"struct SessionLib.SessionSpec",components:[{name:"signer",type:"address",internalType:"address"},{name:"isWildcard",type:"bool",internalType:"bool"},{name:"expiresAt",type:"uint256",internalType:"uint256"},{name:"callPolicies",type:"tuple[]",internalType:"struct SessionLib.CallSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]},{name:"constraints",type:"tuple[]",internalType:"struct SessionLib.Constraint[]",components:[{name:"condition",type:"uint8",internalType:"enum SessionLib.Condition"},{name:"index",type:"uint64",internalType:"uint64"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"limit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]}]},{name:"transferPolicies",type:"tuple[]",internalType:"struct SessionLib.TransferSpec[]",components:[{name:"target",type:"address",internalType:"address"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"},{name:"valueLimit",type:"tuple",internalType:"struct SessionLib.UsageLimit",components:[{name:"limitType",type:"uint8",internalType:"enum SessionLib.LimitType"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint256",internalType:"uint256"}]}]},{name:"uid",type:"bytes32",internalType:"bytes32"}]}],anonymous:!1},{type:"event",name:"ValueReceived",inputs:[{name:"from",type:"address",indexed:!0,internalType:"address"},{name:"value",type:"uint256",indexed:!1,internalType:"uint256"}],anonymous:!1},{type:"error",name:"AllowanceExceeded",inputs:[{name:"allowanceUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"},{name:"period",type:"uint64",internalType:"uint64"}]},{type:"error",name:"CallPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"},{name:"selector",type:"bytes4",internalType:"bytes4"}]},{type:"error",name:"CallReverted",inputs:[]},{type:"error",name:"ConditionFailed",inputs:[{name:"param",type:"bytes32",internalType:"bytes32"},{name:"refValue",type:"bytes32",internalType:"bytes32"},{name:"condition",type:"uint8",internalType:"uint8"}]},{type:"error",name:"InvalidDataLength",inputs:[{name:"actualLength",type:"uint256",internalType:"uint256"},{name:"expectedLength",type:"uint256",internalType:"uint256"}]},{type:"error",name:"InvalidSignature",inputs:[{name:"msgSender",type:"address",internalType:"address"},{name:"thisAddress",type:"address",internalType:"address"}]},{type:"error",name:"LifetimeUsageExceeded",inputs:[{name:"lifetimeUsage",type:"uint256",internalType:"uint256"},{name:"limit",type:"uint256",internalType:"uint256"}]},{type:"error",name:"MaxValueExceeded",inputs:[{name:"value",type:"uint256",internalType:"uint256"},{name:"maxValuePerUse",type:"uint256",internalType:"uint256"}]},{type:"error",name:"NoCallsToExecute",inputs:[]},{type:"error",name:"SessionExpired",inputs:[]},{type:"error",name:"SessionExpiresTooSoon",inputs:[]},{type:"error",name:"SessionZeroSigner",inputs:[]},{type:"error",name:"TransferPolicyViolated",inputs:[{name:"target",type:"address",internalType:"address"}]},{type:"error",name:"UIDAlreadyProcessed",inputs:[]}];function sf(n){return n.id==="inApp"||n.id==="embedded"}async function BT(n,t,e){var s,o,a,l;if(((s=t==null?void 0:t.auth)==null?void 0:s.mode)!=="popup"&&((o=t==null?void 0:t.auth)==null?void 0:o.mode)!==void 0&&e.authenticateWithRedirect){const u=n.strategy;rf.includes(u)&&await e.authenticateWithRedirect(u,(a=t==null?void 0:t.auth)==null?void 0:a.mode,(l=t==null?void 0:t.auth)==null?void 0:l.redirectUrl)}const i=(await e.connect(n)).user.account;return of({authAccount:i,client:n.client,createOptions:t,desiredChain:n.chain})}async function NT(n,t,e){n.authResult&&e.loginWithAuthToken&&await e.loginWithAuthToken(n.authResult);const r=await qT(e);if(!r)throw new Error("Failed to authenticate user.");const i=r.account;return of({authAccount:i,client:n.client,createOptions:t,desiredChain:n.chain})}async function MT(n){const{connectSmartAccount:t}=await c(async()=>{const{connectSmartAccount:e}=await import("./index-BNdVKnva.js");return{connectSmartAccount:e}},__vite__mapDeps([17,3,1,2,18,19,4,5,6,7,8]));return t({chain:n.chain,client:n.client,personalAccount:n.authAccount},n.smartAccountOptions)}async function qT(n){const t=await n.getUser();switch(t.status){case"Logged In, Wallet Initialized":return t}}async function of(n){const{createOptions:t,authAccount:e,desiredChain:r,client:i}=n;let s,o;const a=t&&"executionMode"in t?t.executionMode:void 0;if(a&&(a.mode==="EIP4337"?s=a.smartAccount:a.mode==="EIP7702"&&(o=a)),t&&"smartAccount"in t&&(t!=null&&t.smartAccount)&&(s=t.smartAccount),s){const[l,u]=await MT({authAccount:e,chain:r,client:i,smartAccountOptions:s});return{account:l,adminAccount:e,chain:u}}if(o){const l=r;if(!l)throw new Error("Chain is required for EIP-7702 execution, pass a chain when connecting the inAppWallet.");return{account:ST({adminAccount:e,client:i,sponsorGas:o.sponsorGas}),adminAccount:e,chain:l}}return{account:e,chain:r||cp}}const qs=Object.freeze(Object.defineProperty({__proto__:null,autoConnectInAppWallet:NT,connectInAppWallet:BT,isInAppWallet:sf},Symbol.toStringTag,{value:"Module"}));function zT(n){const t=r=>sf(r)||Xn(r),e=Co(n.wallet)&&n.connectedWallets.some(r=>{var i,s,o,a,l,u;return t(r)&&((s=(i=r.getAccount())==null?void 0:i.address)==null?void 0:s.toLowerCase())===((u=(l=(a=(o=n.wallet).getAdminAccount)==null?void 0:a.call(o))==null?void 0:l.address)==null?void 0:u.toLowerCase())});return t(n.wallet)||e}function jT(){if(typeof document>"u")return;const n=new URLSearchParams(window.location.search);let t;const e=window.location.hash||"";let r=e;const i=e.indexOf("?");i!==-1&&(t=new URLSearchParams(e.substring(i)),r=e.substring(0,i));const s=n.get("walletId")??(t==null?void 0:t.get("walletId"))??void 0,o=n.get("authResult")??(t==null?void 0:t.get("authResult"))??void 0,a=n.get("authProvider")??(t==null?void 0:t.get("authProvider"))??void 0,l=n.get("authCookie")??(t==null?void 0:t.get("authCookie"))??void 0,u=n.get("authFlow")??(t==null?void 0:t.get("authFlow"))??void 0;if((l||o)&&s){const h=(()=>{if(o)return n.delete("authResult"),t==null||t.delete("authResult"),JSON.parse(decodeURIComponent(o))})();n.delete("walletId"),n.delete("authProvider"),n.delete("authCookie"),n.delete("authFlow"),t==null||t.delete("walletId"),t==null||t.delete("authProvider"),t==null||t.delete("authCookie"),t==null||t.delete("authFlow");const d=n.toString(),f=d?`?${d}`:"";let p=r;if(t){const w=t.toString();w&&(p=`${r}?${w}`)}return window.history.pushState({},"",`${window.location.pathname}${f}${p}`),{authCookie:l,authFlow:u,authProvider:a,authResult:h,walletId:s}}}let zs;const KT=async n=>{if(zs&&!n.force&&await zs)return!0;const t=FT(n);return zs=t,t},FT=async({storage:n,props:t,createWalletFn:e,manager:r,connectOverride:i,setLastAuthProvider:s})=>{var I,D,S,x,E;const{wallets:o,onConnect:a}=t,l=t.timeout??15e3;let u=!1;r.isAutoConnecting.setValue(!0);let[h,d]=await Promise.all([ef(n),Sa(n)]);const f=jT();if((f==null?void 0:f.authFlow)==="link"&&f.authResult)return await HT({client:t.client,connectOverride:i,createWalletFn:e,manager:r,onConnect:a,props:t,setLastAuthProvider:s,storage:n,timeout:l,urlToken:f,wallets:o});const p=o.find(A=>A.id===(f==null?void 0:f.walletId));if(f!=null&&f.authCookie&&p&&await new Va({clientId:t.client.clientId,ecosystem:Xn(p)?{id:p.id,partnerId:(I=p.getConfig())==null?void 0:I.partnerId}:void 0,storage:n}).saveAuthCookie(f.authCookie),f!=null&&f.walletId&&(d=f.walletId,h=h!=null&&h.includes(f.walletId)?h:[f.walletId,...h||[]]),f!=null&&f.authProvider&&await(s==null?void 0:s(f.authProvider,n)),!h)return u;const w=await tf(n)||t.chain,m=h.map(A=>{const T=o.find(P=>P.id===A);return T||e(A)}),_=d&&(m.find(A=>A.id===d)||e(d));if(_){r.activeWalletConnectionStatusStore.setValue("connecting"),await nf(Uo({authResult:f==null?void 0:f.authResult,client:t.client,lastConnectedChain:w,wallet:_}),{message:`AutoConnect timeout: ${l}ms limit exceeded.`,ms:l}).catch(A=>{console.warn(A.message),t.onTimeout&&t.onTimeout()});try{await(i?i(_):r.connect(_,{accountAbstraction:t.accountAbstraction,client:t.client}))}catch(A){A instanceof Error&&console.warn("Error auto connecting wallet:",A.message),r.activeWalletConnectionStatusStore.setValue("disconnected")}}else r.activeWalletConnectionStatusStore.setValue("disconnected");const g=m.filter(A=>A.id!==d&&h.includes(A.id));for(const A of g)try{await Uo({authResult:f==null?void 0:f.authResult,client:t.client,lastConnectedChain:w,wallet:A}),r.addConnectedWallet(A)}catch{}_&&zT({connectedWallets:_?[_,...g]:g,wallet:_})&&((D=t.siweAuth)!=null&&D.requiresAuth)&&!((S=t.siweAuth)!=null&&S.isLoggedIn)&&!((x=t.siweAuth)!=null&&x.isLoggingIn)&&await((E=t.siweAuth)==null?void 0:E.doLogin().catch(A=>{console.warn("Error signing in with SIWE:",A.message)})),r.isAutoConnecting.setValue(!1);const y=r.activeWalletStore.getValue(),b=r.connectedWallets.getValue();if(y){u=!0;try{a==null||a(y,b)}catch(A){console.error("Error calling onConnect callback:",A)}}else r.activeWalletConnectionStatusStore.setValue("disconnected");return u};async function HT(n){var b;const{client:t,connectOverride:e,createWalletFn:r,manager:i,onConnect:s,props:o,setLastAuthProvider:a,storage:l,timeout:u,urlToken:h,wallets:d}=n,[f,p]=await Promise.all([ef(l),Sa(l)]),w=await tf(l)||o.chain;if(!p||!f)return console.warn("No stored wallet found for linking flow"),i.isAutoConnecting.setValue(!1),!1;h.authProvider&&await(a==null?void 0:a(h.authProvider,l));const m=d.find(I=>I.id===p)||r(p);i.activeWalletConnectionStatusStore.setValue("connecting");try{await nf(Uo({authResult:void 0,client:t,lastConnectedChain:w,wallet:m}),{message:`AutoConnect timeout: ${u}ms limit exceeded.`,ms:u}),await(e?e(m):i.connect(m,{accountAbstraction:o.accountAbstraction,client:t}))}catch(I){return console.warn("Failed to auto-connect for linking:",I),i.activeWalletConnectionStatusStore.setValue("disconnected"),i.isAutoConnecting.setValue(!1),!1}const _=Xn(m)?{id:m.id,partnerId:(b=m.getConfig())==null?void 0:b.partnerId}:void 0,g=new Va({clientId:t.clientId,ecosystem:_,storage:l});try{await OT({client:t,ecosystem:_,storage:g,tokenToLink:h.authResult.storedToken.cookieString})}catch(I){console.error("Failed to link profile after redirect:",I)}i.isAutoConnecting.setValue(!1);const v=i.activeWalletStore.getValue(),y=i.connectedWallets.getValue();if(v){try{s==null||s(v,y)}catch(I){console.error("Error calling onConnect callback:",I)}return!0}return!1}async function Uo(n){return n.wallet.autoConnect({authResult:n.authResult,chain:n.lastConnectedChain,client:n.client})}async function WT(n){const t=n.wallets||pT(n),e=TT(Pi);return await KT({createWalletFn:mt,manager:e,props:{...n,wallets:t},storage:Pi})}const jP=Object.freeze(Object.defineProperty({__proto__:null,DefaultWalletConnectRequestHandlers:lT,EIP1193:Kp,authenticate:Yp,authenticateWithRedirect:Jp,autoConnect:WT,createWallet:mt,createWalletAdapter:Fp,createWalletConnectClient:uT,createWalletConnectSession:hT,deploySmartAccount:Vf,disconnectWalletConnectSession:Jd,ecosystemWallet:Ru,embeddedWallet:Fs,generateAccount:j_,getActiveWalletConnectSessions:dT,getAllWalletsList:Hp,getInstalledWallets:Lu,getProfiles:e_,getUser:Sf,getUserEmail:Wp,getUserPhoneNumber:Gp,getWalletBalance:K_,getWalletInfo:yu,inAppWallet:Fs,injectedProvider:ea,isBaseAccountSDKWallet:Eu,linkProfile:Qp,preAuthenticate:Zp,privateKeyAccount:Xs,privateKeyToAccount:Xs,randomPrivateKey:Cf,smartWallet:Xo,unlinkProfile:Xp,walletConnect:Np},Symbol.toStringTag,{value:"Module"}));export{_P as $,BP as A,NP as B,Va as C,eT as D,Fi as E,CP as F,Co as G,DP as H,LP as I,Jd as J,Yd as K,OP as L,tT as M,PP as N,nT as O,rT as P,Hl as Q,Fl as R,am as S,wP as T,_c as U,ih as V,Br as W,tm as X,rh as Y,cm as Z,mP as _,VP as a,xi as a0,gP as a1,yP as a2,le as a3,Yn as a4,xa as a5,XE as a6,Od as a7,mi as a8,jr as a9,On as aa,on as ab,_e as ac,RP as ad,jP as ae,yu as b,Oi as c,zP as d,rf as e,Tp as f,Bp as g,qP as h,fu as i,Qd as j,yp as k,OT as l,kP as m,gt as n,yT as o,Wo as p,UP as q,lp as r,xP as s,SP as t,MP as u,$P as v,Pi as w,nP as x,_p as y,mp as z};
|