@wormhole-foundation/wormhole-connect 3.0.2-beta.0-development → 3.0.2-beta.1-development
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/assets/{basic-ChNCp6rI.js → basic-PUjrTVXb.js} +1 -1
- package/dist/assets/{evm-DSirgd5b.js → evm-CO5UWnAY.js} +2 -2
- package/dist/assets/{index-L-lC4rqb.js → index-1lzfHdT2.js} +1 -1
- package/dist/assets/{index-CHfaLf5J.js → index-DBVZDYF7.js} +1 -1
- package/dist/assets/index-DKlPX3ZI.js +1 -0
- package/dist/assets/{index-BtCrMDAu.js → index-Ddk7n7Ti.js} +1 -1
- package/dist/assets/{index-HhyysXFu.js → index-DyUmO4PR.js} +1 -1
- package/dist/assets/{index-BiwA3Bbq.js → index-MMzKxP1N.js} +1 -1
- package/dist/assets/{secp256k1-Cd7rIav0.js → secp256k1-0LtSM2L1.js} +1 -1
- package/dist/assets/{secp256k1-BQBOR8e3.js → secp256k1-DwTU3j1N.js} +1 -1
- package/dist/assets/{solana-DcwLWeKT.js → solana-DlGdMBSL.js} +4 -4
- package/dist/assets/{w3m-modal-DdptuLHe.js → w3m-modal-DD9Jgepz.js} +1 -1
- package/dist/main.js +72 -70
- package/dist/src/AppRouter.d.ts.map +1 -1
- package/dist/src/config/mainnet/tokens.d.ts.map +1 -1
- package/dist/src/config/testnet/tokens.d.ts.map +1 -1
- package/dist/src/config/tokens.d.ts +1 -1
- package/dist/src/config/tokens.d.ts.map +1 -1
- package/dist/src/exports/index.d.ts +2 -2
- package/dist/src/exports/index.d.ts.map +1 -1
- package/dist/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/dist/src/icons/Chains/PLUME.d.ts.map +1 -1
- package/dist/src/icons/PoweredBy.d.ts.map +1 -1
- package/dist/src/icons/Routing.d.ts +5 -0
- package/dist/src/icons/Routing.d.ts.map +1 -0
- package/dist/src/icons/Tokens/PLUME.d.ts.map +1 -1
- package/dist/src/store/transferInput.d.ts +1 -1
- package/dist/src/store/transferInput.d.ts.map +1 -1
- package/dist/src/utils/coingecko.d.ts.map +1 -1
- package/dist/src/utils/formatNumber.d.ts +23 -0
- package/dist/src/utils/formatNumber.d.ts.map +1 -0
- package/dist/src/utils/index.d.ts +3 -1
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/routes.d.ts +12 -0
- package/dist/src/utils/routes.d.ts.map +1 -0
- package/dist/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
- package/dist/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
- package/dist/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
- package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
- package/dist/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
- package/dist/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/dist/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
- package/dist/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/account-Br8E7RB6.js +1 -0
- package/lib/{account-BTK2b2Fv.mjs → account-CVa_3S2g.mjs} +1 -1
- package/lib/{address-8wLqn60W.mjs → address-BApwdEpr.mjs} +96 -96
- package/lib/address-BwQqFkyh.js +1 -0
- package/lib/address-C2pxq9b2.js +1 -0
- package/lib/{address-n0gAFMrZ.mjs → address-f6joE_ig.mjs} +12 -12
- package/lib/aptos-CMRGggVs.js +2 -0
- package/lib/{aptos-CK-j196x.js → aptos-CTKQNmlP.js} +1 -1
- package/lib/{aptos-B-DJQlwt.mjs → aptos-CfFbx7uf.mjs} +9 -9
- package/lib/{aptos-Bwcz9wZX.mjs → aptos-fozuppXh.mjs} +3 -3
- package/lib/{basic-DHWVLmCq.mjs → basic-BA2aRJJn.mjs} +2 -2
- package/lib/{basic-B5ZFelC_.js → basic-DUWaF2I0.js} +1 -1
- package/lib/{basic-E2M-9h1u.js → basic-DeiUayOA.js} +1 -1
- package/lib/{basic-Pour9Ggp.mjs → basic-DoC8u7J8.mjs} +2 -2
- package/lib/{blake2b-C5HyObld.mjs → blake2b-BGxWUAjG.mjs} +23 -23
- package/lib/blake2b-Fj1aPKgL.js +1 -0
- package/lib/{browser-ponyfill-jK8MKVVg.mjs → browser-ponyfill-D5AN8ZPp.mjs} +1 -1
- package/lib/browser-ponyfill-Dn6gsMYK.js +2 -0
- package/lib/{chain-Bm6u6eUF.mjs → chain-DAw2I5H8.mjs} +1 -1
- package/lib/chain-DnPXlO8g.js +1 -0
- package/lib/chunk-KJH4KKG6-BjF7YUcU.js +470 -0
- package/lib/{chunk-KJH4KKG6-DJsu-Y-X.mjs → chunk-KJH4KKG6-DmVjhXO7.mjs} +144 -144
- package/lib/{constants-Cf2YMjNo.js → constants-BtNs_2F4.js} +1 -1
- package/lib/{constants-B7AbX6qr.mjs → constants-Dcc2nVaW.mjs} +3 -3
- package/lib/contract-BEHYQLvJ.js +1 -0
- package/lib/{contract-llnN6ki0.mjs → contract-BkMAZomO.mjs} +123 -123
- package/lib/{core-CF5c7Vev.mjs → core-BHV42Qa0.mjs} +25 -26
- package/lib/core-CV23yxnG.js +889 -0
- package/lib/create-CHcGblj6.js +1 -0
- package/lib/{create-Dm87_0zG.mjs → create-CKLtL7hr.mjs} +1 -1
- package/lib/{evm-BYIGg8e4.mjs → evm-Bf7qbM19.mjs} +42 -42
- package/lib/{evm-B2hUWkt7.js → evm-ClWkquRx.js} +2 -2
- package/lib/{evm-fvvpk-li.mjs → evm-DhMoy8cH.mjs} +6 -6
- package/lib/{evm-DFNbMHoa.js → evm-tXmzU9Xp.js} +2 -2
- package/lib/executor.js +1 -1
- package/lib/executor.mjs +145 -138
- package/lib/hosted.js +1 -1
- package/lib/hosted.mjs +1 -1
- package/lib/{index-Cwo5AKUC.mjs → index-1rCCpdwd.mjs} +5 -5
- package/lib/{index-DBCa3k0j.mjs → index-3HvzWPL7.mjs} +9 -9
- package/lib/{index-MOwE6ses.mjs → index-B7ztYPhr.mjs} +21 -22
- package/lib/index-BM-0SeYB.js +1 -0
- package/lib/{index-DiQ8Ytrt.mjs → index-BTnpftLz.mjs} +1 -1
- package/lib/{index-BiCMaXJS.js → index-BWQMi6Rj.js} +1 -1
- package/lib/index-BbgKw2pu.js +1 -0
- package/lib/index-BblcpkoK.js +1 -0
- package/lib/index-Bfblsmud.js +1 -0
- package/lib/{index-C_0yAOSX.mjs → index-BfkFXEnG.mjs} +25082 -24072
- package/lib/{index-fi1sh8vr.mjs → index-BijBPDRn.mjs} +2 -2
- package/lib/index-BoquY9R2.js +337 -0
- package/lib/index-C2NtsO9Q.js +1 -0
- package/lib/{index-CNuk-XLX.mjs → index-C4JmrizV.mjs} +4 -4
- package/lib/index-C8TtXpOf.js +1 -0
- package/lib/index-CB8kOyIP.js +1 -0
- package/lib/index-CInVjUCW.js +1 -0
- package/lib/{index-BF11RebI.mjs → index-CLTklDbp.mjs} +1 -1
- package/lib/index-CQvgeH_r.js +1 -0
- package/lib/{index-DzYjoSJp.mjs → index-CUnOYRFQ.mjs} +23 -24
- package/lib/{index-DGh9LzN1.mjs → index-CWe_BTdo.mjs} +31 -31
- package/lib/{index-2Bz1Np4K.mjs → index-CZ91lJ9M.mjs} +5 -5
- package/lib/{index-Dgy1FO7C.js → index-CgyVnj6U.js} +1 -1
- package/lib/{index-BzJcFdt_.mjs → index-Clr2JjoJ.mjs} +44 -44
- package/lib/index-CnnCCv6Q.js +1 -0
- package/lib/{index-CJnRWlFf.mjs → index-CwxGLNEk.mjs} +48 -49
- package/lib/index-D7BLfz05.js +1 -0
- package/lib/index-DM7C-wvQ.js +3 -0
- package/lib/{index-DhIh3xiW.mjs → index-DNy_sNGr.mjs} +8 -8
- package/lib/{index-BZaRg0yd.mjs → index-DVcaDWmz.mjs} +1 -1
- package/lib/{index-CsAigASU.mjs → index-DWOP9OBp.mjs} +17 -17
- package/lib/{index-CTLz8Fz0.mjs → index-Dda5qc2t.mjs} +13 -14
- package/lib/{index-CLBXF_zH.mjs → index-DeaiBvpG.mjs} +16 -16
- package/lib/index-HOuGP-7b.js +1 -0
- package/lib/{index-Dt2uNp-N.mjs → index-KZve3tYJ.mjs} +4 -4
- package/lib/{index-CJDBidKv.mjs → index-SIyXqCAN.mjs} +41 -41
- package/lib/index-WhVYPMUr.js +1 -0
- package/lib/index-hmjT4xa7.js +1 -0
- package/lib/index-ledagFNU.js +1 -0
- package/lib/index-pbRVlgcN.js +1 -0
- package/lib/{index-BpQXUhR4.mjs → index-qK7AyMAk.mjs} +23 -27
- package/lib/index-ttZu99PZ.js +1 -0
- package/lib/{index.es-BqRBGIq6.mjs → index.es-BXRQf6Oi.mjs} +25 -26
- package/lib/index.es-BjGaOok5.js +11 -0
- package/lib/index.es-D6S74vhi.js +27 -0
- package/lib/{index.es-DgCZuUzB.mjs → index.es-cOw8juwf.mjs} +741 -737
- package/lib/index.js +1 -1
- package/lib/index.mjs +17 -16
- package/lib/mayan.js +3 -3
- package/lib/mayan.mjs +918 -891
- package/lib/mint-CL36R6ED.js +1 -0
- package/lib/{mint-Dc-VsiAn.mjs → mint-DunEG1jV.mjs} +32 -33
- package/lib/ntt.js +1 -1
- package/lib/ntt.mjs +2332 -2373
- package/lib/platform-7vCWzCny.js +1 -0
- package/lib/platform-BKhoO9So.js +1 -0
- package/lib/{platform-B95L0Vxv.mjs → platform-BN6LFtXE.mjs} +16 -16
- package/lib/{platform-DnP_1wGA.mjs → platform-BYLu9SzP.mjs} +4 -4
- package/lib/platform-Bbe26nx7.js +1 -0
- package/lib/{platform-DiG7WY9Z.mjs → platform-DCgWqmh1.mjs} +4 -4
- package/lib/{provider-jsonrpc-CRABh2gN.mjs → provider-jsonrpc-Bmgnrmpy.mjs} +155 -155
- package/lib/provider-jsonrpc-CbtP2Ffg.js +1 -0
- package/lib/{secp256k1-zHHDNAlH.mjs → secp256k1-BDQEvyHq.mjs} +1 -1
- package/lib/{secp256k1-obBDPYM-.mjs → secp256k1-C77Oh9AA.mjs} +1 -1
- package/lib/{secp256k1-2hq3Jk4g.mjs → secp256k1-CCn2vlXj.mjs} +1 -1
- package/lib/{secp256k1-B94G4gyy.js → secp256k1-CHAR40au.js} +1 -1
- package/lib/{secp256k1-DCcAh19h.js → secp256k1-D-DmPYcJ.js} +1 -1
- package/lib/{secp256k1-CjndBUS7.js → secp256k1-DYWDlveU.js} +1 -1
- package/lib/{signer-N_ccpPOz.mjs → signer-BIcn81N5.mjs} +18 -18
- package/lib/signer-H7atraks.js +1 -0
- package/lib/{solana-_Ha4YgiP.mjs → solana-B0QSg7B3.mjs} +30 -30
- package/lib/solana-Cs5VyB20.js +900 -0
- package/lib/solana-uvHG8JV5.js +1 -0
- package/lib/solana-zyfOlbhb.mjs +18 -0
- package/lib/{solanaEmbed.esm-DK5RIquB.mjs → solanaEmbed.esm-BqdznDuW.mjs} +623 -622
- package/lib/solanaEmbed.esm-D8vtESE6.js +10 -0
- package/lib/src/AppRouter.d.ts.map +1 -1
- package/lib/src/config/mainnet/tokens.d.ts.map +1 -1
- package/lib/src/config/testnet/tokens.d.ts.map +1 -1
- package/lib/src/config/tokens.d.ts +1 -1
- package/lib/src/config/tokens.d.ts.map +1 -1
- package/lib/src/exports/index.d.ts +2 -2
- package/lib/src/exports/index.d.ts.map +1 -1
- package/lib/src/hooks/useFetchQuotes.d.ts.map +1 -1
- package/lib/src/icons/Chains/PLUME.d.ts.map +1 -1
- package/lib/src/icons/PoweredBy.d.ts.map +1 -1
- package/lib/src/icons/Routing.d.ts +5 -0
- package/lib/src/icons/Routing.d.ts.map +1 -0
- package/lib/src/icons/Tokens/PLUME.d.ts.map +1 -1
- package/lib/src/store/transferInput.d.ts +1 -1
- package/lib/src/store/transferInput.d.ts.map +1 -1
- package/lib/src/utils/coingecko.d.ts.map +1 -1
- package/lib/src/utils/formatNumber.d.ts +23 -0
- package/lib/src/utils/formatNumber.d.ts.map +1 -0
- package/lib/src/utils/index.d.ts +3 -1
- package/lib/src/utils/index.d.ts.map +1 -1
- package/lib/src/utils/routes.d.ts +12 -0
- package/lib/src/utils/routes.d.ts.map +1 -0
- package/lib/src/views/v2/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v2/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v2/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AmountInput/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/TokenItem.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/AssetPicker/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/GasSlider/index.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/Eta.d.ts +6 -0
- package/lib/src/views/v3/Bridge/Routes/Eta.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RouteBadge.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts +7 -6
- package/lib/src/views/v3/Bridge/Routes/RoutesBottomSheet.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts +7 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesLink.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts +2 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesList.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts +4 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesLoader.d.ts.map +1 -0
- package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts +6 -5
- package/lib/src/views/v3/Bridge/Routes/RoutesModal.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts +1 -0
- package/lib/src/views/v3/Bridge/Routes/SingleRoute.d.ts.map +1 -1
- package/lib/src/views/v3/Bridge/Routes/index.d.ts.map +1 -1
- package/lib/src/views/v3/Redeem/TransactionDetails/index.d.ts.map +1 -1
- package/lib/{sui-CQcQ6w_P.mjs → sui-B38DyOqM.mjs} +44 -44
- package/lib/{sui-BplKFZQu.mjs → sui-BpfnZR4f.mjs} +3 -3
- package/lib/sui-CT9MWY38.js +1 -0
- package/lib/{sui-_hvmCvD8.js → sui-DXQAMRQJ.js} +1 -1
- package/lib/{tokens-DNv0ZNvU.js → tokens-CmINcwKk.js} +31 -31
- package/lib/{tokens-Dl4YwW18.mjs → tokens-YxAPPVy3.mjs} +1726 -1724
- package/lib/transfer-BQ72fByU.js +1 -0
- package/lib/transfer-bTW0j9yh.mjs +58 -0
- package/lib/units-Ckije3Qv.js +1 -0
- package/lib/{units-DPWUSE6J.mjs → units-CtyvuzxQ.mjs} +13 -13
- package/lib/unsignedTransaction-C6Qp42VS.js +1 -0
- package/lib/{unsignedTransaction-DwcUilyN.mjs → unsignedTransaction-CXB-QCUC.mjs} +18 -18
- package/lib/{w3m-modal-BJILsxDp.mjs → w3m-modal-B7LUHLWC.mjs} +2 -2
- package/lib/{w3m-modal-D4CpFxO2.mjs → w3m-modal-BOTzBqbc.mjs} +2 -2
- package/lib/{w3m-modal-CrfHWSrF.js → w3m-modal-BTb03-7B.js} +1 -1
- package/lib/{w3m-modal-CBG2MSPp.js → w3m-modal-xmdf4r6V.js} +1 -1
- package/lib/web3-COTIsLs8.js +22 -0
- package/lib/{address-B-XN4tFw.mjs → web3-DYVeiqSa.mjs} +6599 -6576
- package/package.json +32 -32
- package/dist/assets/index-BWPgrXHs.js +0 -1
- package/lib/account-cRt2xMoW.js +0 -1
- package/lib/address-BGujeWtN.js +0 -22
- package/lib/address-C7DIAk4M.js +0 -1
- package/lib/address-KNhRm6oe.js +0 -1
- package/lib/aptos-f5TqmvqV.js +0 -2
- package/lib/blake2b-B-MRXUPb.js +0 -1
- package/lib/browser-ponyfill-CE6vRkjp.js +0 -2
- package/lib/chain-Hsn22HAP.js +0 -1
- package/lib/chunk-KJH4KKG6-CoyI75Ig.js +0 -470
- package/lib/contract-D2fTrJgn.js +0 -1
- package/lib/core-v0G9f7LX.js +0 -889
- package/lib/create-DoZZ7ciL.js +0 -1
- package/lib/index-B8-KKWD-.js +0 -1
- package/lib/index-BHbvgOMD.js +0 -1
- package/lib/index-BHfUgvSV.js +0 -1
- package/lib/index-BTKC7Hou.js +0 -1
- package/lib/index-BWXglAWd.js +0 -1
- package/lib/index-Bpp8C4u8.js +0 -1
- package/lib/index-CF2fHBHJ.js +0 -3
- package/lib/index-CTPz98nv.js +0 -1
- package/lib/index-ClMoiji-.js +0 -1
- package/lib/index-ClsVcH6F.js +0 -1
- package/lib/index-CqOI6LVu.js +0 -1
- package/lib/index-DCz_4mcz.js +0 -1
- package/lib/index-DKksdvND.js +0 -335
- package/lib/index-DRv3ZpVL.js +0 -1
- package/lib/index-DYqo8IhM.js +0 -1
- package/lib/index-DZubce9o.js +0 -1
- package/lib/index-DprM_IpB.js +0 -1
- package/lib/index-DshEQYMA.js +0 -1
- package/lib/index-JrM783SN.js +0 -1
- package/lib/index.es-C6YhioMN.js +0 -27
- package/lib/index.es-D3Xxxr8I.js +0 -11
- package/lib/mint-DlXC3sGi.js +0 -1
- package/lib/platform-B1XoDKoN.js +0 -1
- package/lib/platform-COuZC5Zc.js +0 -1
- package/lib/platform-NG3efAb2.js +0 -1
- package/lib/provider-jsonrpc-pXNHQF7n.js +0 -1
- package/lib/signer-CCa6npZ3.js +0 -1
- package/lib/solana-BJ3aReZw.mjs +0 -18
- package/lib/solana-BwyVgP30.js +0 -1
- package/lib/solana-CanFuMgA.js +0 -900
- package/lib/solanaEmbed.esm-C--1F7Lx.js +0 -10
- package/lib/sui-Bs83Gy5Z.js +0 -1
- package/lib/units-BvcKDiAx.js +0 -1
- package/lib/unsignedTransaction-dN_5EJf5.js +0 -1
- package/lib/web3-Bu_6UejS.mjs +0 -67
- package/lib/web3-Doz_0RHD.js +0 -1
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const X=require("./address-BGujeWtN.js"),Tt=require("./index-DKksdvND.js");require("./index-BxM99sFL.js");var it={},ht={},_s=fn;fn.default=fn;fn.stable=Ss;fn.stableStringify=Ss;var Vn="[...]",ms="[Circular]",xt=[],vt=[];function Es(){return{depthLimit:Number.MAX_SAFE_INTEGER,edgesLimit:Number.MAX_SAFE_INTEGER}}function fn(e,t,n,r){typeof r>"u"&&(r=Es()),ni(e,"",0,[],void 0,0,r);var i;try{vt.length===0?i=JSON.stringify(e,t,n):i=JSON.stringify(e,vs(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;xt.length!==0;){var o=xt.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function kt(e,t,n,r){var i=Object.getOwnPropertyDescriptor(r,n);i.get!==void 0?i.configurable?(Object.defineProperty(r,n,{value:e}),xt.push([r,n,t,i])):vt.push([t,n,e]):(r[n]=e,xt.push([r,n,t]))}function ni(e,t,n,r,i,o,s){o+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<r.length;a++)if(r[a]===e){kt(ms,e,t,i);return}if(typeof s.depthLimit<"u"&&o>s.depthLimit){kt(Vn,e,t,i);return}if(typeof s.edgesLimit<"u"&&n+1>s.edgesLimit){kt(Vn,e,t,i);return}if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)ni(e[a],a,a,r,e,o,s);else{var f=Object.keys(e);for(a=0;a<f.length;a++){var u=f[a];ni(e[u],u,a,r,e,o,s)}}r.pop()}}function yl(e,t){return e<t?-1:e>t?1:0}function Ss(e,t,n,r){typeof r>"u"&&(r=Es());var i=ri(e,"",0,[],void 0,0,r)||e,o;try{vt.length===0?o=JSON.stringify(i,t,n):o=JSON.stringify(i,vs(t),n)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;xt.length!==0;){var s=xt.pop();s.length===4?Object.defineProperty(s[0],s[1],s[3]):s[0][s[1]]=s[2]}}return o}function ri(e,t,n,r,i,o,s){o+=1;var a;if(typeof e=="object"&&e!==null){for(a=0;a<r.length;a++)if(r[a]===e){kt(ms,e,t,i);return}try{if(typeof e.toJSON=="function")return}catch{return}if(typeof s.depthLimit<"u"&&o>s.depthLimit){kt(Vn,e,t,i);return}if(typeof s.edgesLimit<"u"&&n+1>s.edgesLimit){kt(Vn,e,t,i);return}if(r.push(e),Array.isArray(e))for(a=0;a<e.length;a++)ri(e[a],a,a,r,e,o,s);else{var f={},u=Object.keys(e).sort(yl);for(a=0;a<u.length;a++){var g=u[a];ri(e[g],g,a,r,e,o,s),f[g]=e[g]}if(typeof i<"u")xt.push([i,t,e]),i[t]=f;else return f}r.pop()}}function vs(e){return e=typeof e<"u"?e:function(t,n){return n},function(t,n){if(vt.length>0)for(var r=0;r<vt.length;r++){var i=vt[r];if(i[1]===t&&i[0]===n){n=i[2],vt.splice(r,1);break}}return e.call(this,t,n)}}const _l=X.getDefaultExportFromCjs(_s);Object.defineProperty(ht,"__esModule",{value:!0});ht.EthereumProviderError=ht.EthereumRpcError=void 0;const ml=_s;class As extends Error{constructor(t,n,r){if(!Number.isInteger(t))throw new Error('"code" must be an integer.');if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string.');super(n),this.code=t,r!==void 0&&(this.data=r)}serialize(){const t={code:this.code,message:this.message};return this.data!==void 0&&(t.data=this.data),this.stack&&(t.stack=this.stack),t}toString(){return ml.default(this.serialize(),vl,2)}}ht.EthereumRpcError=As;class El extends As{constructor(t,n,r){if(!Sl(t))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(t,n,r)}}ht.EthereumProviderError=El;function Sl(e){return Number.isInteger(e)&&e>=1e3&&e<=4999}function vl(e,t){if(t!=="[Circular]")return t}var Si={},gt={};Object.defineProperty(gt,"__esModule",{value:!0});gt.errorValues=gt.errorCodes=void 0;gt.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};gt.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.serializeError=e.isValidCode=e.getMessageFromCode=e.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const t=gt,n=ht,r=t.errorCodes.rpc.internal,i="Unspecified error message. This is a bug, please report it.",o={code:r,message:s(r)};e.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function s(v,S=i){if(Number.isInteger(v)){const R=v.toString();if(p(t.errorValues,R))return t.errorValues[R].message;if(u(v))return e.JSON_RPC_SERVER_ERROR_MESSAGE}return S}e.getMessageFromCode=s;function a(v){if(!Number.isInteger(v))return!1;const S=v.toString();return!!(t.errorValues[S]||u(v))}e.isValidCode=a;function f(v,{fallbackError:S=o,shouldIncludeStack:R=!1}={}){var h,w;if(!S||!Number.isInteger(S.code)||typeof S.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(v instanceof n.EthereumRpcError)return v.serialize();const y={};if(v&&typeof v=="object"&&!Array.isArray(v)&&p(v,"code")&&a(v.code)){const m=v;y.code=m.code,m.message&&typeof m.message=="string"?(y.message=m.message,p(m,"data")&&(y.data=m.data)):(y.message=s(y.code),y.data={originalError:g(v)})}else{y.code=S.code;const m=(h=v)===null||h===void 0?void 0:h.message;y.message=m&&typeof m=="string"?m:S.message,y.data={originalError:g(v)}}const x=(w=v)===null||w===void 0?void 0:w.stack;return R&&v&&x&&typeof x=="string"&&(y.stack=x),y}e.serializeError=f;function u(v){return v>=-32099&&v<=-32e3}function g(v){return v&&typeof v=="object"&&!Array.isArray(v)?Object.assign({},v):v}function p(v,S){return Object.prototype.hasOwnProperty.call(v,S)}})(Si);var er={};Object.defineProperty(er,"__esModule",{value:!0});er.ethErrors=void 0;const vi=ht,Rs=Si,Ie=gt;er.ethErrors={rpc:{parse:e=>Be(Ie.errorCodes.rpc.parse,e),invalidRequest:e=>Be(Ie.errorCodes.rpc.invalidRequest,e),invalidParams:e=>Be(Ie.errorCodes.rpc.invalidParams,e),methodNotFound:e=>Be(Ie.errorCodes.rpc.methodNotFound,e),internal:e=>Be(Ie.errorCodes.rpc.internal,e),server:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:t}=e;if(!Number.isInteger(t)||t>-32005||t<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return Be(t,e)},invalidInput:e=>Be(Ie.errorCodes.rpc.invalidInput,e),resourceNotFound:e=>Be(Ie.errorCodes.rpc.resourceNotFound,e),resourceUnavailable:e=>Be(Ie.errorCodes.rpc.resourceUnavailable,e),transactionRejected:e=>Be(Ie.errorCodes.rpc.transactionRejected,e),methodNotSupported:e=>Be(Ie.errorCodes.rpc.methodNotSupported,e),limitExceeded:e=>Be(Ie.errorCodes.rpc.limitExceeded,e)},provider:{userRejectedRequest:e=>rn(Ie.errorCodes.provider.userRejectedRequest,e),unauthorized:e=>rn(Ie.errorCodes.provider.unauthorized,e),unsupportedMethod:e=>rn(Ie.errorCodes.provider.unsupportedMethod,e),disconnected:e=>rn(Ie.errorCodes.provider.disconnected,e),chainDisconnected:e=>rn(Ie.errorCodes.provider.chainDisconnected,e),custom:e=>{if(!e||typeof e!="object"||Array.isArray(e))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:t,message:n,data:r}=e;if(!n||typeof n!="string")throw new Error('"message" must be a nonempty string');return new vi.EthereumProviderError(t,n,r)}}};function Be(e,t){const[n,r]=Is(t);return new vi.EthereumRpcError(e,n||Rs.getMessageFromCode(e),r)}function rn(e,t){const[n,r]=Is(t);return new vi.EthereumProviderError(e,n||Rs.getMessageFromCode(e),r)}function Is(e){if(e){if(typeof e=="string")return[e];if(typeof e=="object"&&!Array.isArray(e)){const{message:t,data:n}=e;if(t&&typeof t!="string")throw new Error("Must specify string message.");return[t||void 0,n]}}return[]}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getMessageFromCode=e.serializeError=e.EthereumProviderError=e.EthereumRpcError=e.ethErrors=e.errorCodes=void 0;const t=ht;Object.defineProperty(e,"EthereumRpcError",{enumerable:!0,get:function(){return t.EthereumRpcError}}),Object.defineProperty(e,"EthereumProviderError",{enumerable:!0,get:function(){return t.EthereumProviderError}});const n=Si;Object.defineProperty(e,"serializeError",{enumerable:!0,get:function(){return n.serializeError}}),Object.defineProperty(e,"getMessageFromCode",{enumerable:!0,get:function(){return n.getMessageFromCode}});const r=er;Object.defineProperty(e,"ethErrors",{enumerable:!0,get:function(){return r.ethErrors}});const i=gt;Object.defineProperty(e,"errorCodes",{enumerable:!0,get:function(){return i.errorCodes}})})(it);function dn(e){"@babel/helpers - typeof";return dn=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dn(e)}function Al(e,t){if(dn(e)!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(dn(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function Rl(e){var t=Al(e,"string");return dn(t)=="symbol"?t:t+""}function G(e,t,n){return(t=Rl(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function no(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(e,i).enumerable})),n.push.apply(n,r)}return n}function je(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?no(Object(n),!0).forEach(function(r){G(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):no(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}var Ts={exports:{}},Pr={exports:{}};let Il=class extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);let n="";for(let r=0;r<t.length;r++)n+=` ${t[r].stack}
|
|
2
|
-
`;super(n),this.name="AggregateError",this.errors=t}};var ge={AggregateError:Il,ArrayIsArray(e){return Array.isArray(e)},ArrayPrototypeIncludes(e,t){return e.includes(t)},ArrayPrototypeIndexOf(e,t){return e.indexOf(t)},ArrayPrototypeJoin(e,t){return e.join(t)},ArrayPrototypeMap(e,t){return e.map(t)},ArrayPrototypePop(e,t){return e.pop(t)},ArrayPrototypePush(e,t){return e.push(t)},ArrayPrototypeSlice(e,t,n){return e.slice(t,n)},Error,FunctionPrototypeCall(e,t,...n){return e.call(t,...n)},FunctionPrototypeSymbolHasInstance(e,t){return Function.prototype[Symbol.hasInstance].call(e,t)},MathFloor:Math.floor,Number,NumberIsInteger:Number.isInteger,NumberIsNaN:Number.isNaN,NumberMAX_SAFE_INTEGER:Number.MAX_SAFE_INTEGER,NumberMIN_SAFE_INTEGER:Number.MIN_SAFE_INTEGER,NumberParseInt:Number.parseInt,ObjectDefineProperties(e,t){return Object.defineProperties(e,t)},ObjectDefineProperty(e,t,n){return Object.defineProperty(e,t,n)},ObjectGetOwnPropertyDescriptor(e,t){return Object.getOwnPropertyDescriptor(e,t)},ObjectKeys(e){return Object.keys(e)},ObjectSetPrototypeOf(e,t){return Object.setPrototypeOf(e,t)},Promise,PromisePrototypeCatch(e,t){return e.catch(t)},PromisePrototypeThen(e,t,n){return e.then(t,n)},PromiseReject(e){return Promise.reject(e)},PromiseResolve(e){return Promise.resolve(e)},ReflectApply:Reflect.apply,RegExpPrototypeTest(e,t){return e.test(t)},SafeSet:Set,String,StringPrototypeSlice(e,t,n){return e.slice(t,n)},StringPrototypeToLowerCase(e){return e.toLowerCase()},StringPrototypeToUpperCase(e){return e.toUpperCase()},StringPrototypeTrim(e){return e.trim()},Symbol,SymbolFor:Symbol.for,SymbolAsyncIterator:Symbol.asyncIterator,SymbolHasInstance:Symbol.hasInstance,SymbolIterator:Symbol.iterator,SymbolDispose:Symbol.dispose||Symbol("Symbol.dispose"),SymbolAsyncDispose:Symbol.asyncDispose||Symbol("Symbol.asyncDispose"),TypedArrayPrototypeSet(e,t,n){return e.set(t,n)},Boolean,Uint8Array},xs={exports:{}},Os={format(e,...t){return e.replace(/%([sdifj])/g,function(...[n,r]){const i=t.shift();return r==="f"?i.toFixed(6):r==="j"?JSON.stringify(i):r==="s"&&typeof i=="object"?`${i.constructor!==Object?i.constructor.name:""} {}`.trim():i.toString()})},inspect(e){switch(typeof e){case"string":if(e.includes("'"))if(e.includes('"')){if(!e.includes("`")&&!e.includes("${"))return`\`${e}\``}else return`"${e}"`;return`'${e}'`;case"number":return isNaN(e)?"NaN":Object.is(e,-0)?String(e):e;case"bigint":return`${String(e)}n`;case"boolean":case"undefined":return String(e);case"object":return"{}"}}};const{format:Tl,inspect:Kn}=Os,{AggregateError:xl}=ge,Ol=globalThis.AggregateError||xl,Cl=Symbol("kIsNodeError"),Nl=["string","function","number","object","Function","Object","boolean","bigint","symbol"],Pl=/^([A-Z][a-z0-9]*)+$/,Ll="__node_internal_",tr={};function Rt(e,t){if(!e)throw new tr.ERR_INTERNAL_ASSERTION(t)}function ro(e){let t="",n=e.length;const r=e[0]==="-"?1:0;for(;n>=r+4;n-=3)t=`_${e.slice(n-3,n)}${t}`;return`${e.slice(0,n)}${t}`}function Ml(e,t,n){if(typeof t=="function")return Rt(t.length<=n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${t.length}).`),t(...n);const r=(t.match(/%[dfijoOs]/g)||[]).length;return Rt(r===n.length,`Code: ${e}; The provided arguments length (${n.length}) does not match the required ones (${r}).`),n.length===0?t:Tl(t,...n)}function Se(e,t,n){n||(n=Error);class r extends n{constructor(...o){super(Ml(e,t,o))}toString(){return`${this.name} [${e}]: ${this.message}`}}Object.defineProperties(r.prototype,{name:{value:n.name,writable:!0,enumerable:!1,configurable:!0},toString:{value(){return`${this.name} [${e}]: ${this.message}`},writable:!0,enumerable:!1,configurable:!0}}),r.prototype.code=e,r.prototype[Cl]=!0,tr[e]=r}function io(e){const t=Ll+e.name;return Object.defineProperty(e,"name",{value:t}),e}function Bl(e,t){if(e&&t&&e!==t){if(Array.isArray(t.errors))return t.errors.push(e),t;const n=new Ol([t,e],t.message);return n.code=t.code,n}return e||t}let Dl=class extends Error{constructor(t="The operation was aborted",n=void 0){if(n!==void 0&&typeof n!="object")throw new tr.ERR_INVALID_ARG_TYPE("options","Object",n);super(t,n),this.code="ABORT_ERR",this.name="AbortError"}};Se("ERR_ASSERTION","%s",Error);Se("ERR_INVALID_ARG_TYPE",(e,t,n)=>{Rt(typeof e=="string","'name' must be a string"),Array.isArray(t)||(t=[t]);let r="The ";e.endsWith(" argument")?r+=`${e} `:r+=`"${e}" ${e.includes(".")?"property":"argument"} `,r+="must be ";const i=[],o=[],s=[];for(const f of t)Rt(typeof f=="string","All expected entries have to be of type string"),Nl.includes(f)?i.push(f.toLowerCase()):Pl.test(f)?o.push(f):(Rt(f!=="object",'The value "object" should be written as "Object"'),s.push(f));if(o.length>0){const f=i.indexOf("object");f!==-1&&(i.splice(i,f,1),o.push("Object"))}if(i.length>0){switch(i.length){case 1:r+=`of type ${i[0]}`;break;case 2:r+=`one of type ${i[0]} or ${i[1]}`;break;default:{const f=i.pop();r+=`one of type ${i.join(", ")}, or ${f}`}}(o.length>0||s.length>0)&&(r+=" or ")}if(o.length>0){switch(o.length){case 1:r+=`an instance of ${o[0]}`;break;case 2:r+=`an instance of ${o[0]} or ${o[1]}`;break;default:{const f=o.pop();r+=`an instance of ${o.join(", ")}, or ${f}`}}s.length>0&&(r+=" or ")}switch(s.length){case 0:break;case 1:s[0].toLowerCase()!==s[0]&&(r+="an "),r+=`${s[0]}`;break;case 2:r+=`one of ${s[0]} or ${s[1]}`;break;default:{const f=s.pop();r+=`one of ${s.join(", ")}, or ${f}`}}if(n==null)r+=`. Received ${n}`;else if(typeof n=="function"&&n.name)r+=`. Received function ${n.name}`;else if(typeof n=="object"){var a;if((a=n.constructor)!==null&&a!==void 0&&a.name)r+=`. Received an instance of ${n.constructor.name}`;else{const f=Kn(n,{depth:-1});r+=`. Received ${f}`}}else{let f=Kn(n,{colors:!1});f.length>25&&(f=`${f.slice(0,25)}...`),r+=`. Received type ${typeof n} (${f})`}return r},TypeError);Se("ERR_INVALID_ARG_VALUE",(e,t,n="is invalid")=>{let r=Kn(t);return r.length>128&&(r=r.slice(0,128)+"..."),`The ${e.includes(".")?"property":"argument"} '${e}' ${n}. Received ${r}`},TypeError);Se("ERR_INVALID_RETURN_VALUE",(e,t,n)=>{var r;const i=n!=null&&(r=n.constructor)!==null&&r!==void 0&&r.name?`instance of ${n.constructor.name}`:`type ${typeof n}`;return`Expected ${e} to be returned from the "${t}" function but got ${i}.`},TypeError);Se("ERR_MISSING_ARGS",(...e)=>{Rt(e.length>0,"At least one arg needs to be specified");let t;const n=e.length;switch(e=(Array.isArray(e)?e:[e]).map(r=>`"${r}"`).join(" or "),n){case 1:t+=`The ${e[0]} argument`;break;case 2:t+=`The ${e[0]} and ${e[1]} arguments`;break;default:{const r=e.pop();t+=`The ${e.join(", ")}, and ${r} arguments`}break}return`${t} must be specified`},TypeError);Se("ERR_OUT_OF_RANGE",(e,t,n)=>{Rt(t,'Missing "range" argument');let r;if(Number.isInteger(n)&&Math.abs(n)>2**32)r=ro(String(n));else if(typeof n=="bigint"){r=String(n);const i=BigInt(2)**BigInt(32);(n>i||n<-i)&&(r=ro(r)),r+="n"}else r=Kn(n);return`The value of "${e}" is out of range. It must be ${t}. Received ${r}`},RangeError);Se("ERR_MULTIPLE_CALLBACK","Callback called multiple times",Error);Se("ERR_METHOD_NOT_IMPLEMENTED","The %s method is not implemented",Error);Se("ERR_STREAM_ALREADY_FINISHED","Cannot call %s after a stream was finished",Error);Se("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable",Error);Se("ERR_STREAM_DESTROYED","Cannot call %s after a stream was destroyed",Error);Se("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);Se("ERR_STREAM_PREMATURE_CLOSE","Premature close",Error);Se("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF",Error);Se("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event",Error);Se("ERR_STREAM_WRITE_AFTER_END","write after end",Error);Se("ERR_UNKNOWN_ENCODING","Unknown encoding: %s",TypeError);var Te={AbortError:Dl,aggregateTwoErrors:io(Bl),hideStackFrames:io,codes:tr},on={exports:{}},oo;function cn(){if(oo)return on.exports;oo=1;const{AbortController:e,AbortSignal:t}=typeof self<"u"?self:typeof window<"u"?window:void 0;return on.exports=e,on.exports.AbortSignal=t,on.exports.default=e,on.exports}(function(e){const t=X.requireBufferPolyfill(),{format:n,inspect:r}=Os,{codes:{ERR_INVALID_ARG_TYPE:i}}=Te,{kResistStopPropagation:o,AggregateError:s,SymbolDispose:a}=ge,f=globalThis.AbortSignal||cn().AbortSignal,u=globalThis.AbortController||cn().AbortController,g=Object.getPrototypeOf(async function(){}).constructor,p=globalThis.Blob||t.Blob,v=typeof p<"u"?function(w){return w instanceof p}:function(w){return!1},S=(h,w)=>{if(h!==void 0&&(h===null||typeof h!="object"||!("aborted"in h)))throw new i(w,"AbortSignal",h)},R=(h,w)=>{if(typeof h!="function")throw new i(w,"Function",h)};e.exports={AggregateError:s,kEmptyObject:Object.freeze({}),once(h){let w=!1;return function(...y){w||(w=!0,h.apply(this,y))}},createDeferredPromise:function(){let h,w;return{promise:new Promise((x,m)=>{h=x,w=m}),resolve:h,reject:w}},promisify(h){return new Promise((w,y)=>{h((x,...m)=>x?y(x):w(...m))})},debuglog(){return function(){}},format:n,inspect:r,types:{isAsyncFunction(h){return h instanceof g},isArrayBufferView(h){return ArrayBuffer.isView(h)}},isBlob:v,deprecate(h,w){return h},addAbortListener:Tt.eventsExports.addAbortListener||function(w,y){if(w===void 0)throw new i("signal","AbortSignal",w);S(w,"signal"),R(y,"listener");let x;return w.aborted?queueMicrotask(()=>y()):(w.addEventListener("abort",y,{__proto__:null,once:!0,[o]:!0}),x=()=>{w.removeEventListener("abort",y)}),{__proto__:null,[a](){var m;(m=x)===null||m===void 0||m()}}},AbortSignalAny:f.any||function(w){if(w.length===1)return w[0];const y=new u,x=()=>y.abort();return w.forEach(m=>{S(m,"signals"),m.addEventListener("abort",x,{once:!0})}),y.signal.addEventListener("abort",()=>{w.forEach(m=>m.removeEventListener("abort",x))},{once:!0}),y.signal}},e.exports.promisify.custom=Symbol.for("nodejs.util.promisify.custom")})(xs);var Pe=xs.exports,Ai={};const{ArrayIsArray:Cs,ArrayPrototypeIncludes:$l,ArrayPrototypeJoin:jl,ArrayPrototypeMap:kl,NumberIsInteger:Ri,NumberIsNaN:mh,NumberMAX_SAFE_INTEGER:Wl,NumberMIN_SAFE_INTEGER:Ul,NumberParseInt:Eh,ObjectPrototypeHasOwnProperty:Fl,RegExpPrototypeExec:Sh,String:ql,StringPrototypeToUpperCase:vh,StringPrototypeTrim:Ah}=ge,{hideStackFrames:ke,codes:{ERR_SOCKET_BAD_PORT:Rh,ERR_INVALID_ARG_TYPE:We,ERR_INVALID_ARG_VALUE:Ns,ERR_OUT_OF_RANGE:Ft,ERR_UNKNOWN_SIGNAL:Ih}}=Te,{normalizeEncoding:Th}=Pe,{isAsyncFunction:Hl,isArrayBufferView:zl}=Pe.types,Gl=ke((e,t,n=Ul,r=Wl)=>{if(typeof e!="number")throw new We(t,"number",e);if(!Ri(e))throw new Ft(t,"an integer",e);if(e<n||e>r)throw new Ft(t,`>= ${n} && <= ${r}`,e)});ke((e,t,n=-2147483648,r=2147483647)=>{if(typeof e!="number")throw new We(t,"number",e);if(!Ri(e))throw new Ft(t,"an integer",e);if(e<n||e>r)throw new Ft(t,`>= ${n} && <= ${r}`,e)});ke((e,t,n=!1)=>{if(typeof e!="number")throw new We(t,"number",e);if(!Ri(e))throw new Ft(t,"an integer",e);const r=n?1:0,i=4294967295;if(e<r||e>i)throw new Ft(t,`>= ${r} && <= ${i}`,e)});ke((e,t,n)=>{if(!$l(n,e)){const i="must be one of: "+jl(kl(n,o=>typeof o=="string"?`'${o}'`:ql(o)),", ");throw new Ns(t,e,i)}});function Vl(e,t){if(typeof e!="boolean")throw new We(t,"boolean",e)}function Lr(e,t,n){return e==null||!Fl(e,t)?n:e[t]}const Kl=ke((e,t,n=null)=>{const r=Lr(n,"allowArray",!1),i=Lr(n,"allowFunction",!1);if(!Lr(n,"nullable",!1)&&e===null||!r&&Cs(e)||typeof e!="object"&&(!i||typeof e!="function"))throw new We(t,"Object",e)});ke((e,t)=>{if(e!=null&&typeof e!="object"&&typeof e!="function")throw new We(t,"a dictionary",e)});ke((e,t,n=0)=>{if(!Cs(e))throw new We(t,"Array",e);if(e.length<n){const r=`must be longer than ${n}`;throw new Ns(t,e,r)}});ke((e,t="buffer")=>{if(!zl(e))throw new We(t,["Buffer","TypedArray","DataView"],e)});const Yl=ke((e,t)=>{if(e!==void 0&&(e===null||typeof e!="object"||!("aborted"in e)))throw new We(t,"AbortSignal",e)}),Zl=ke((e,t)=>{if(typeof e!="function")throw new We(t,"Function",e)});ke((e,t)=>{if(typeof e!="function"||Hl(e))throw new We(t,"Function",e)});ke((e,t)=>{if(e!==void 0)throw new We(t,"undefined",e)});var pn={validateBoolean:Vl,validateFunction:Zl,validateInteger:Gl,validateObject:Kl,validateAbortSignal:Yl},Ii={exports:{}};const{SymbolAsyncIterator:so,SymbolIterator:ao,SymbolFor:Nt}=ge,Ps=Nt("nodejs.stream.destroyed"),Jl=Nt("nodejs.stream.errored"),lo=Nt("nodejs.stream.readable"),uo=Nt("nodejs.stream.writable"),Xl=Nt("nodejs.stream.disturbed"),Ql=Nt("nodejs.webstream.isClosedPromise"),eu=Nt("nodejs.webstream.controllerErrorFunction");function Ti(e,t=!1){var n;return!!(e&&typeof e.pipe=="function"&&typeof e.on=="function"&&(!t||typeof e.pause=="function"&&typeof e.resume=="function")&&(!e._writableState||((n=e._readableState)===null||n===void 0?void 0:n.readable)!==!1)&&(!e._writableState||e._readableState))}function nr(e){var t;return!!(e&&typeof e.write=="function"&&typeof e.on=="function"&&(!e._readableState||((t=e._writableState)===null||t===void 0?void 0:t.writable)!==!1))}function tu(e){return!!(e&&typeof e.pipe=="function"&&e._readableState&&typeof e.on=="function"&&typeof e.write=="function")}function Ze(e){return e&&(e._readableState||e._writableState||typeof e.write=="function"&&typeof e.on=="function"||typeof e.pipe=="function"&&typeof e.on=="function")}function Ls(e){return!!(e&&!Ze(e)&&typeof e.pipeThrough=="function"&&typeof e.getReader=="function"&&typeof e.cancel=="function")}function Ms(e){return!!(e&&!Ze(e)&&typeof e.getWriter=="function"&&typeof e.abort=="function")}function Bs(e){return!!(e&&!Ze(e)&&typeof e.readable=="object"&&typeof e.writable=="object")}function nu(e){return Ls(e)||Ms(e)||Bs(e)}function ru(e,t){return e==null?!1:t===!0?typeof e[so]=="function":t===!1?typeof e[ao]=="function":typeof e[so]=="function"||typeof e[ao]=="function"}function rr(e){if(!Ze(e))return null;const t=e._writableState,n=e._readableState,r=t||n;return!!(e.destroyed||e[Ps]||r!=null&&r.destroyed)}function iu(e){if(!nr(e))return null;if(e.writableEnded===!0)return!0;const t=e._writableState;return t!=null&&t.errored?!1:typeof(t==null?void 0:t.ended)!="boolean"?null:t.ended}function ou(e,t){if(!nr(e))return null;if(e.writableFinished===!0)return!0;const n=e._writableState;return n!=null&&n.errored?!1:typeof(n==null?void 0:n.finished)!="boolean"?null:!!(n.finished||t===!1&&n.ended===!0&&n.length===0)}function Ds(e,t){if(!Ti(e))return null;const n=e._readableState;return n!=null&&n.errored?!1:typeof(n==null?void 0:n.endEmitted)!="boolean"?null:!!(n.endEmitted||t===!1&&n.ended===!0&&n.length===0)}function $s(e){return e&&e[lo]!=null?e[lo]:typeof(e==null?void 0:e.readable)!="boolean"?null:rr(e)?!1:Ti(e)&&e.readable&&!Ds(e)}function js(e){return e&&e[uo]!=null?e[uo]:typeof(e==null?void 0:e.writable)!="boolean"?null:rr(e)?!1:nr(e)&&e.writable&&!iu(e)}function su(e,t){return Ze(e)?rr(e)?!0:!((t==null?void 0:t.readable)!==!1&&$s(e)||(t==null?void 0:t.writable)!==!1&&js(e)):null}function au(e){var t,n;return Ze(e)?e.writableErrored?e.writableErrored:(t=(n=e._writableState)===null||n===void 0?void 0:n.errored)!==null&&t!==void 0?t:null:null}function lu(e){var t,n;return Ze(e)?e.readableErrored?e.readableErrored:(t=(n=e._readableState)===null||n===void 0?void 0:n.errored)!==null&&t!==void 0?t:null:null}function uu(e){if(!Ze(e))return null;if(typeof e.closed=="boolean")return e.closed;const t=e._writableState,n=e._readableState;return typeof(t==null?void 0:t.closed)=="boolean"||typeof(n==null?void 0:n.closed)=="boolean"?(t==null?void 0:t.closed)||(n==null?void 0:n.closed):typeof e._closed=="boolean"&&ks(e)?e._closed:null}function ks(e){return typeof e._closed=="boolean"&&typeof e._defaultKeepAlive=="boolean"&&typeof e._removedConnection=="boolean"&&typeof e._removedContLen=="boolean"}function fu(e){return typeof e._sent100=="boolean"&&ks(e)}function du(e){var t;return typeof e._consuming=="boolean"&&typeof e._dumped=="boolean"&&((t=e.req)===null||t===void 0?void 0:t.upgradeOrConnect)===void 0}function cu(e){if(!Ze(e))return null;const t=e._writableState,n=e._readableState,r=t||n;return!r&&fu(e)||!!(r&&r.autoDestroy&&r.emitClose&&r.closed===!1)}function hu(e){var t;return!!(e&&((t=e[Xl])!==null&&t!==void 0?t:e.readableDidRead||e.readableAborted))}function gu(e){var t,n,r,i,o,s,a,f,u,g;return!!(e&&((t=(n=(r=(i=(o=(s=e[Jl])!==null&&s!==void 0?s:e.readableErrored)!==null&&o!==void 0?o:e.writableErrored)!==null&&i!==void 0?i:(a=e._readableState)===null||a===void 0?void 0:a.errorEmitted)!==null&&r!==void 0?r:(f=e._writableState)===null||f===void 0?void 0:f.errorEmitted)!==null&&n!==void 0?n:(u=e._readableState)===null||u===void 0?void 0:u.errored)!==null&&t!==void 0?t:!((g=e._writableState)===null||g===void 0)&&g.errored))}var at={isDestroyed:rr,kIsDestroyed:Ps,isDisturbed:hu,isErrored:gu,isReadable:$s,kIsClosedPromise:Ql,kControllerErrorFunction:eu,isClosed:uu,isDuplexNodeStream:tu,isFinished:su,isIterable:ru,isReadableNodeStream:Ti,isReadableStream:Ls,isReadableFinished:Ds,isReadableErrored:lu,isNodeStream:Ze,isWebStream:nu,isWritable:js,isWritableNodeStream:nr,isWritableStream:Ms,isWritableFinished:ou,isWritableErrored:au,isServerRequest:du,willEmitClose:cu,isTransformStream:Bs};const dt=X.browserExports,{AbortError:Ws,codes:pu}=Te,{ERR_INVALID_ARG_TYPE:bu,ERR_STREAM_PREMATURE_CLOSE:fo}=pu,{kEmptyObject:ii,once:oi}=Pe,{validateAbortSignal:wu,validateFunction:yu,validateObject:_u,validateBoolean:mu}=pn,{Promise:Eu,PromisePrototypeThen:Su,SymbolDispose:Us}=ge,{isClosed:vu,isReadable:co,isReadableNodeStream:Mr,isReadableStream:Au,isReadableFinished:ho,isReadableErrored:go,isWritable:po,isWritableNodeStream:bo,isWritableStream:Ru,isWritableFinished:wo,isWritableErrored:yo,isNodeStream:Iu,willEmitClose:Tu,kIsClosedPromise:xu}=at;let Wt;function Ou(e){return e.setHeader&&typeof e.abort=="function"}const si=()=>{};function Fs(e,t,n){var r,i;if(arguments.length===2?(n=t,t=ii):t==null?t=ii:_u(t,"options"),yu(n,"callback"),wu(t.signal,"options.signal"),n=oi(n),Au(e)||Ru(e))return Cu(e,t,n);if(!Iu(e))throw new bu("stream",["ReadableStream","WritableStream","Stream"],e);const o=(r=t.readable)!==null&&r!==void 0?r:Mr(e),s=(i=t.writable)!==null&&i!==void 0?i:bo(e),a=e._writableState,f=e._readableState,u=()=>{e.writable||v()};let g=Tu(e)&&Mr(e)===o&&bo(e)===s,p=wo(e,!1);const v=()=>{p=!0,e.destroyed&&(g=!1),!(g&&(!e.readable||o))&&(!o||S)&&n.call(e)};let S=ho(e,!1);const R=()=>{S=!0,e.destroyed&&(g=!1),!(g&&(!e.writable||s))&&(!s||p)&&n.call(e)},h=P=>{n.call(e,P)};let w=vu(e);const y=()=>{w=!0;const P=yo(e)||go(e);if(P&&typeof P!="boolean")return n.call(e,P);if(o&&!S&&Mr(e,!0)&&!ho(e,!1))return n.call(e,new fo);if(s&&!p&&!wo(e,!1))return n.call(e,new fo);n.call(e)},x=()=>{w=!0;const P=yo(e)||go(e);if(P&&typeof P!="boolean")return n.call(e,P);n.call(e)},m=()=>{e.req.on("finish",v)};Ou(e)?(e.on("complete",v),g||e.on("abort",y),e.req?m():e.on("request",m)):s&&!a&&(e.on("end",u),e.on("close",u)),!g&&typeof e.aborted=="boolean"&&e.on("aborted",y),e.on("end",R),e.on("finish",v),t.error!==!1&&e.on("error",h),e.on("close",y),w?dt.nextTick(y):a!=null&&a.errorEmitted||f!=null&&f.errorEmitted?g||dt.nextTick(x):(!o&&(!g||co(e))&&(p||po(e)===!1)||!s&&(!g||po(e))&&(S||co(e)===!1)||f&&e.req&&e.aborted)&&dt.nextTick(x);const j=()=>{n=si,e.removeListener("aborted",y),e.removeListener("complete",v),e.removeListener("abort",y),e.removeListener("request",m),e.req&&e.req.removeListener("finish",v),e.removeListener("end",u),e.removeListener("close",u),e.removeListener("finish",v),e.removeListener("end",R),e.removeListener("error",h),e.removeListener("close",y)};if(t.signal&&!w){const P=()=>{const B=n;j(),B.call(e,new Ws(void 0,{cause:t.signal.reason}))};if(t.signal.aborted)dt.nextTick(P);else{Wt=Wt||Pe.addAbortListener;const B=Wt(t.signal,P),H=n;n=oi((...k)=>{B[Us](),H.apply(e,k)})}}return j}function Cu(e,t,n){let r=!1,i=si;if(t.signal)if(i=()=>{r=!0,n.call(e,new Ws(void 0,{cause:t.signal.reason}))},t.signal.aborted)dt.nextTick(i);else{Wt=Wt||Pe.addAbortListener;const s=Wt(t.signal,i),a=n;n=oi((...f)=>{s[Us](),a.apply(e,f)})}const o=(...s)=>{r||dt.nextTick(()=>n.apply(e,s))};return Su(e[xu].promise,o,o),si}function Nu(e,t){var n;let r=!1;return t===null&&(t=ii),(n=t)!==null&&n!==void 0&&n.cleanup&&(mu(t.cleanup,"cleanup"),r=t.cleanup),new Eu((i,o)=>{const s=Fs(e,t,a=>{r&&s(),a?o(a):i()})})}Ii.exports=Fs;Ii.exports.finished=Nu;var pt=Ii.exports;const Ke=X.browserExports,{aggregateTwoErrors:Pu,codes:{ERR_MULTIPLE_CALLBACK:Lu},AbortError:Mu}=Te,{Symbol:qs}=ge,{kIsDestroyed:Bu,isDestroyed:Du,isFinished:$u,isServerRequest:ju}=at,Hs=qs("kDestroy"),ai=qs("kConstruct");function zs(e,t,n){e&&(e.stack,t&&!t.errored&&(t.errored=e),n&&!n.errored&&(n.errored=e))}function ku(e,t){const n=this._readableState,r=this._writableState,i=r||n;return r!=null&&r.destroyed||n!=null&&n.destroyed?(typeof t=="function"&&t(),this):(zs(e,r,n),r&&(r.destroyed=!0),n&&(n.destroyed=!0),i.constructed?_o(this,e,t):this.once(Hs,function(o){_o(this,Pu(o,e),t)}),this)}function _o(e,t,n){let r=!1;function i(o){if(r)return;r=!0;const s=e._readableState,a=e._writableState;zs(o,a,s),a&&(a.closed=!0),s&&(s.closed=!0),typeof n=="function"&&n(o),o?Ke.nextTick(Wu,e,o):Ke.nextTick(Gs,e)}try{e._destroy(t||null,i)}catch(o){i(o)}}function Wu(e,t){li(e,t),Gs(e)}function Gs(e){const t=e._readableState,n=e._writableState;n&&(n.closeEmitted=!0),t&&(t.closeEmitted=!0),(n!=null&&n.emitClose||t!=null&&t.emitClose)&&e.emit("close")}function li(e,t){const n=e._readableState,r=e._writableState;r!=null&&r.errorEmitted||n!=null&&n.errorEmitted||(r&&(r.errorEmitted=!0),n&&(n.errorEmitted=!0),e.emit("error",t))}function Uu(){const e=this._readableState,t=this._writableState;e&&(e.constructed=!0,e.closed=!1,e.closeEmitted=!1,e.destroyed=!1,e.errored=null,e.errorEmitted=!1,e.reading=!1,e.ended=e.readable===!1,e.endEmitted=e.readable===!1),t&&(t.constructed=!0,t.destroyed=!1,t.closed=!1,t.closeEmitted=!1,t.errored=null,t.errorEmitted=!1,t.finalCalled=!1,t.prefinished=!1,t.ended=t.writable===!1,t.ending=t.writable===!1,t.finished=t.writable===!1)}function ui(e,t,n){const r=e._readableState,i=e._writableState;if(i!=null&&i.destroyed||r!=null&&r.destroyed)return this;r!=null&&r.autoDestroy||i!=null&&i.autoDestroy?e.destroy(t):t&&(t.stack,i&&!i.errored&&(i.errored=t),r&&!r.errored&&(r.errored=t),n?Ke.nextTick(li,e,t):li(e,t))}function Fu(e,t){if(typeof e._construct!="function")return;const n=e._readableState,r=e._writableState;n&&(n.constructed=!1),r&&(r.constructed=!1),e.once(ai,t),!(e.listenerCount(ai)>1)&&Ke.nextTick(qu,e)}function qu(e){let t=!1;function n(r){if(t){ui(e,r??new Lu);return}t=!0;const i=e._readableState,o=e._writableState,s=o||i;i&&(i.constructed=!0),o&&(o.constructed=!0),s.destroyed?e.emit(Hs,r):r?ui(e,r,!0):Ke.nextTick(Hu,e)}try{e._construct(r=>{Ke.nextTick(n,r)})}catch(r){Ke.nextTick(n,r)}}function Hu(e){e.emit(ai)}function mo(e){return(e==null?void 0:e.setHeader)&&typeof e.abort=="function"}function Vs(e){e.emit("close")}function zu(e,t){e.emit("error",t),Ke.nextTick(Vs,e)}function Gu(e,t){!e||Du(e)||(!t&&!$u(e)&&(t=new Mu),ju(e)?(e.socket=null,e.destroy(t)):mo(e)?e.abort():mo(e.req)?e.req.abort():typeof e.destroy=="function"?e.destroy(t):typeof e.close=="function"?e.close():t?Ke.nextTick(zu,e,t):Ke.nextTick(Vs,e),e.destroyed||(e[Bu]=!0))}var Vt={construct:Fu,destroyer:Gu,destroy:ku,undestroy:Uu,errorOrDestroy:ui};const{ArrayIsArray:Vu,ObjectSetPrototypeOf:Ks}=ge,{EventEmitter:ir}=Tt.eventsExports;function or(e){ir.call(this,e)}Ks(or.prototype,ir.prototype);Ks(or,ir);or.prototype.pipe=function(e,t){const n=this;function r(g){e.writable&&e.write(g)===!1&&n.pause&&n.pause()}n.on("data",r);function i(){n.readable&&n.resume&&n.resume()}e.on("drain",i),!e._isStdio&&(!t||t.end!==!1)&&(n.on("end",s),n.on("close",a));let o=!1;function s(){o||(o=!0,e.end())}function a(){o||(o=!0,typeof e.destroy=="function"&&e.destroy())}function f(g){u(),ir.listenerCount(this,"error")===0&&this.emit("error",g)}fi(n,"error",f),fi(e,"error",f);function u(){n.removeListener("data",r),e.removeListener("drain",i),n.removeListener("end",s),n.removeListener("close",a),n.removeListener("error",f),e.removeListener("error",f),n.removeListener("end",u),n.removeListener("close",u),e.removeListener("close",u)}return n.on("end",u),n.on("close",u),e.on("close",u),e.emit("pipe",n),e};function fi(e,t,n){if(typeof e.prependListener=="function")return e.prependListener(t,n);!e._events||!e._events[t]?e.on(t,n):Vu(e._events[t])?e._events[t].unshift(n):e._events[t]=[n,e._events[t]]}var xi={Stream:or,prependListener:fi},Ys={exports:{}};(function(e){const{SymbolDispose:t}=ge,{AbortError:n,codes:r}=Te,{isNodeStream:i,isWebStream:o,kControllerErrorFunction:s}=at,a=pt,{ERR_INVALID_ARG_TYPE:f}=r;let u;const g=(p,v)=>{if(typeof p!="object"||!("aborted"in p))throw new f(v,"AbortSignal",p)};e.exports.addAbortSignal=function(v,S){if(g(v,"signal"),!i(S)&&!o(S))throw new f("stream",["ReadableStream","WritableStream","Stream"],S);return e.exports.addAbortSignalNoValidate(v,S)},e.exports.addAbortSignalNoValidate=function(p,v){if(typeof p!="object"||!("aborted"in p))return v;const S=i(v)?()=>{v.destroy(new n(void 0,{cause:p.reason}))}:()=>{v[s](new n(void 0,{cause:p.reason}))};if(p.aborted)S();else{u=u||Pe.addAbortListener;const R=u(p,S);a(v,R[t])}return v}})(Ys);var sr=Ys.exports;const{StringPrototypeSlice:Eo,SymbolIterator:Ku,TypedArrayPrototypeSet:Dn,Uint8Array:Yu}=ge,{Buffer:Br}=X.requireBufferPolyfill(),{inspect:Zu}=Pe;var Ju=class{constructor(){this.head=null,this.tail=null,this.length=0}push(t){const n={data:t,next:null};this.length>0?this.tail.next=n:this.head=n,this.tail=n,++this.length}unshift(t){const n={data:t,next:this.head};this.length===0&&(this.tail=n),this.head=n,++this.length}shift(){if(this.length===0)return;const t=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,t}clear(){this.head=this.tail=null,this.length=0}join(t){if(this.length===0)return"";let n=this.head,r=""+n.data;for(;(n=n.next)!==null;)r+=t+n.data;return r}concat(t){if(this.length===0)return Br.alloc(0);const n=Br.allocUnsafe(t>>>0);let r=this.head,i=0;for(;r;)Dn(n,r.data,i),i+=r.data.length,r=r.next;return n}consume(t,n){const r=this.head.data;if(t<r.length){const i=r.slice(0,t);return this.head.data=r.slice(t),i}return t===r.length?this.shift():n?this._getString(t):this._getBuffer(t)}first(){return this.head.data}*[Ku](){for(let t=this.head;t;t=t.next)yield t.data}_getString(t){let n="",r=this.head,i=0;do{const o=r.data;if(t>o.length)n+=o,t-=o.length;else{t===o.length?(n+=o,++i,r.next?this.head=r.next:this.head=this.tail=null):(n+=Eo(o,0,t),this.head=r,r.data=Eo(o,t));break}++i}while((r=r.next)!==null);return this.length-=i,n}_getBuffer(t){const n=Br.allocUnsafe(t),r=t;let i=this.head,o=0;do{const s=i.data;if(t>s.length)Dn(n,s,r-t),t-=s.length;else{t===s.length?(Dn(n,s,r-t),++o,i.next?this.head=i.next:this.head=this.tail=null):(Dn(n,new Yu(s.buffer,s.byteOffset,t),r-t),this.head=i,i.data=s.slice(t));break}++o}while((i=i.next)!==null);return this.length-=o,n}[Symbol.for("nodejs.util.inspect.custom")](t,n){return Zu(this,{...n,depth:0,customInspect:!1})}};const{MathFloor:Xu,NumberIsInteger:Qu}=ge,{validateInteger:ef}=pn,{ERR_INVALID_ARG_VALUE:tf}=Te.codes;let Zs=16*1024,Js=16;function nf(e,t,n){return e.highWaterMark!=null?e.highWaterMark:t?e[n]:null}function Xs(e){return e?Js:Zs}function rf(e,t){ef(t,"value",0),e?Js=t:Zs=t}function of(e,t,n,r){const i=nf(t,r,n);if(i!=null){if(!Qu(i)||i<0){const o=r?`options.${n}`:"options.highWaterMark";throw new tf(o,i)}return Xu(i)}return Xs(e.objectMode)}var ar={getHighWaterMark:of,getDefaultHighWaterMark:Xs,setDefaultHighWaterMark:rf};const So=X.browserExports,{PromisePrototypeThen:sf,SymbolAsyncIterator:vo,SymbolIterator:Ao}=ge,{Buffer:af}=X.requireBufferPolyfill(),{ERR_INVALID_ARG_TYPE:lf,ERR_STREAM_NULL_VALUES:uf}=Te.codes;function ff(e,t,n){let r;if(typeof t=="string"||t instanceof af)return new e({objectMode:!0,...n,read(){this.push(t),this.push(null)}});let i;if(t&&t[vo])i=!0,r=t[vo]();else if(t&&t[Ao])i=!1,r=t[Ao]();else throw new lf("iterable",["Iterable"],t);const o=new e({objectMode:!0,highWaterMark:1,...n});let s=!1;o._read=function(){s||(s=!0,f())},o._destroy=function(u,g){sf(a(u),()=>So.nextTick(g,u),p=>So.nextTick(g,p||u))};async function a(u){const g=u!=null,p=typeof r.throw=="function";if(g&&p){const{value:v,done:S}=await r.throw(u);if(await v,S)return}if(typeof r.return=="function"){const{value:v}=await r.return();await v}}async function f(){for(;;){try{const{value:u,done:g}=i?await r.next():r.next();if(g)o.push(null);else{const p=u&&typeof u.then=="function"?await u:u;if(p===null)throw s=!1,new uf;if(o.push(p))continue;s=!1}}catch(u){o.destroy(u)}break}}return o}var Qs=ff,Dr,Ro;function lr(){if(Ro)return Dr;Ro=1;const e=X.browserExports,{ArrayPrototypeIndexOf:t,NumberIsInteger:n,NumberIsNaN:r,NumberParseInt:i,ObjectDefineProperties:o,ObjectKeys:s,ObjectSetPrototypeOf:a,Promise:f,SafeSet:u,SymbolAsyncDispose:g,SymbolAsyncIterator:p,Symbol:v}=ge;Dr=Y,Y.ReadableState=Le;const{EventEmitter:S}=Tt.eventsExports,{Stream:R,prependListener:h}=xi,{Buffer:w}=X.requireBufferPolyfill(),{addAbortSignal:y}=sr,x=pt;let m=Pe.debuglog("stream",l=>{m=l});const j=Ju,P=Vt,{getHighWaterMark:B,getDefaultHighWaterMark:H}=ar,{aggregateTwoErrors:k,codes:{ERR_INVALID_ARG_TYPE:Q,ERR_METHOD_NOT_IMPLEMENTED:Z,ERR_OUT_OF_RANGE:D,ERR_STREAM_PUSH_AFTER_EOF:$,ERR_STREAM_UNSHIFT_AFTER_END_EVENT:T},AbortError:te}=Te,{validateObject:I}=pn,C=v("kPaused"),{StringDecoder:F}=Tt.requireString_decoder(),K=Qs;a(Y.prototype,R.prototype),a(Y,R);const V=()=>{},{errorOrDestroy:ee}=P,J=1,ue=2,M=4,ne=8,pe=16,we=32,ye=64,ve=128,Ae=256,xe=512,Ue=1024,Re=2048,_=4096,E=8192,O=16384,W=32768,z=65536,se=1<<17,de=1<<18;function ie(l){return{enumerable:!1,get(){return(this.state&l)!==0},set(c){c?this.state|=l:this.state&=~l}}}o(Le.prototype,{objectMode:ie(J),ended:ie(ue),endEmitted:ie(M),reading:ie(ne),constructed:ie(pe),sync:ie(we),needReadable:ie(ye),emittedReadable:ie(ve),readableListening:ie(Ae),resumeScheduled:ie(xe),errorEmitted:ie(Ue),emitClose:ie(Re),autoDestroy:ie(_),destroyed:ie(E),closed:ie(O),closeEmitted:ie(W),multiAwaitDrain:ie(z),readingMore:ie(se),dataEmitted:ie(de)});function Le(l,c,N){typeof N!="boolean"&&(N=c instanceof ot()),this.state=Re|_|pe|we,l&&l.objectMode&&(this.state|=J),N&&l&&l.readableObjectMode&&(this.state|=J),this.highWaterMark=l?B(this,l,"readableHighWaterMark",N):H(!1),this.buffer=new j,this.length=0,this.pipes=[],this.flowing=null,this[C]=null,l&&l.emitClose===!1&&(this.state&=~Re),l&&l.autoDestroy===!1&&(this.state&=~_),this.errored=null,this.defaultEncoding=l&&l.defaultEncoding||"utf8",this.awaitDrainWriters=null,this.decoder=null,this.encoding=null,l&&l.encoding&&(this.decoder=new F(l.encoding),this.encoding=l.encoding)}function Y(l){if(!(this instanceof Y))return new Y(l);const c=this instanceof ot();this._readableState=new Le(l,this,c),l&&(typeof l.read=="function"&&(this._read=l.read),typeof l.destroy=="function"&&(this._destroy=l.destroy),typeof l.construct=="function"&&(this._construct=l.construct),l.signal&&!c&&y(l.signal,this)),R.call(this,l),P.construct(this,()=>{this._readableState.needReadable&&wt(this,this._readableState)})}Y.prototype.destroy=P.destroy,Y.prototype._undestroy=P.undestroy,Y.prototype._destroy=function(l,c){c(l)},Y.prototype[S.captureRejectionSymbol]=function(l){this.destroy(l)},Y.prototype[g]=function(){let l;return this.destroyed||(l=this.readableEnded?null:new te,this.destroy(l)),new f((c,N)=>x(this,L=>L&&L!==l?N(L):c(null)))},Y.prototype.push=function(l,c){return Ee(this,l,c,!1)},Y.prototype.unshift=function(l,c){return Ee(this,l,c,!0)};function Ee(l,c,N,L){m("readableAddChunk",c);const U=l._readableState;let _e;if(U.state&J||(typeof c=="string"?(N=N||U.defaultEncoding,U.encoding!==N&&(L&&U.encoding?c=w.from(c,N).toString(U.encoding):(c=w.from(c,N),N=""))):c instanceof w?N="":R._isUint8Array(c)?(c=R._uint8ArrayToBuffer(c),N=""):c!=null&&(_e=new Q("chunk",["string","Buffer","Uint8Array"],c))),_e)ee(l,_e);else if(c===null)U.state&=~ne,Bt(l,U);else if(U.state&J||c&&c.length>0)if(L)if(U.state&M)ee(l,new T);else{if(U.destroyed||U.errored)return!1;Mt(l,U,c,!0)}else if(U.ended)ee(l,new $);else{if(U.destroyed||U.errored)return!1;U.state&=~ne,U.decoder&&!N?(c=U.decoder.write(c),U.objectMode||c.length!==0?Mt(l,U,c,!1):wt(l,U)):Mt(l,U,c,!1)}else L||(U.state&=~ne,wt(l,U));return!U.ended&&(U.length<U.highWaterMark||U.length===0)}function Mt(l,c,N,L){c.flowing&&c.length===0&&!c.sync&&l.listenerCount("data")>0?(c.state&z?c.awaitDrainWriters.clear():c.awaitDrainWriters=null,c.dataEmitted=!0,l.emit("data",N)):(c.length+=c.objectMode?1:N.length,L?c.buffer.unshift(N):c.buffer.push(N),c.state&ye&&bt(l)),wt(l,c)}Y.prototype.isPaused=function(){const l=this._readableState;return l[C]===!0||l.flowing===!1},Y.prototype.setEncoding=function(l){const c=new F(l);this._readableState.decoder=c,this._readableState.encoding=this._readableState.decoder.encoding;const N=this._readableState.buffer;let L="";for(const U of N)L+=c.write(U);return N.clear(),L!==""&&N.push(L),this._readableState.length=L.length,this};const En=1073741824;function wr(l){if(l>En)throw new D("size","<= 1GiB",l);return l--,l|=l>>>1,l|=l>>>2,l|=l>>>4,l|=l>>>8,l|=l>>>16,l++,l}function Sn(l,c){return l<=0||c.length===0&&c.ended?0:c.state&J?1:r(l)?c.flowing&&c.length?c.buffer.first().length:c.length:l<=c.length?l:c.ended?c.length:0}Y.prototype.read=function(l){m("read",l),l===void 0?l=NaN:n(l)||(l=i(l,10));const c=this._readableState,N=l;if(l>c.highWaterMark&&(c.highWaterMark=wr(l)),l!==0&&(c.state&=~ve),l===0&&c.needReadable&&((c.highWaterMark!==0?c.length>=c.highWaterMark:c.length>0)||c.ended))return m("read: emitReadable",c.length,c.ended),c.length===0&&c.ended?Jt(this):bt(this),null;if(l=Sn(l,c),l===0&&c.ended)return c.length===0&&Jt(this),null;let L=(c.state&ye)!==0;if(m("need readable",L),(c.length===0||c.length-l<c.highWaterMark)&&(L=!0,m("length less than watermark",L)),c.ended||c.reading||c.destroyed||c.errored||!c.constructed)L=!1,m("reading, ended or constructing",L);else if(L){m("do read"),c.state|=ne|we,c.length===0&&(c.state|=ye);try{this._read(c.highWaterMark)}catch(_e){ee(this,_e)}c.state&=~we,c.reading||(l=Sn(N,c))}let U;return l>0?U=lt(l,c):U=null,U===null?(c.needReadable=c.length<=c.highWaterMark,l=0):(c.length-=l,c.multiAwaitDrain?c.awaitDrainWriters.clear():c.awaitDrainWriters=null),c.length===0&&(c.ended||(c.needReadable=!0),N!==l&&c.ended&&Jt(this)),U!==null&&!c.errorEmitted&&!c.closeEmitted&&(c.dataEmitted=!0,this.emit("data",U)),U};function Bt(l,c){if(m("onEofChunk"),!c.ended){if(c.decoder){const N=c.decoder.end();N&&N.length&&(c.buffer.push(N),c.length+=c.objectMode?1:N.length)}c.ended=!0,c.sync?bt(l):(c.needReadable=!1,c.emittedReadable=!0,Yt(l))}}function bt(l){const c=l._readableState;m("emitReadable",c.needReadable,c.emittedReadable),c.needReadable=!1,c.emittedReadable||(m("emitReadable",c.flowing),c.emittedReadable=!0,e.nextTick(Yt,l))}function Yt(l){const c=l._readableState;m("emitReadable_",c.destroyed,c.length,c.ended),!c.destroyed&&!c.errored&&(c.length||c.ended)&&(l.emit("readable"),c.emittedReadable=!1),c.needReadable=!c.flowing&&!c.ended&&c.length<=c.highWaterMark,Zt(l)}function wt(l,c){!c.readingMore&&c.constructed&&(c.readingMore=!0,e.nextTick(vn,l,c))}function vn(l,c){for(;!c.reading&&!c.ended&&(c.length<c.highWaterMark||c.flowing&&c.length===0);){const N=c.length;if(m("maybeReadMore read 0"),l.read(0),N===c.length)break}c.readingMore=!1}Y.prototype._read=function(l){throw new Z("_read()")},Y.prototype.pipe=function(l,c){const N=this,L=this._readableState;L.pipes.length===1&&(L.multiAwaitDrain||(L.multiAwaitDrain=!0,L.awaitDrainWriters=new u(L.awaitDrainWriters?[L.awaitDrainWriters]:[]))),L.pipes.push(l),m("pipe count=%d opts=%j",L.pipes.length,c);const _e=(!c||c.end!==!1)&&l!==e.stdout&&l!==e.stderr?xn:yt;L.endEmitted?e.nextTick(_e):N.once("end",_e),l.on("unpipe",Oe);function Oe(Qe,Fe){m("onunpipe"),Qe===N&&Fe&&Fe.hasUnpiped===!1&&(Fe.hasUnpiped=!0,Er())}function xn(){m("onend"),l.end()}let Ce,On=!1;function Er(){m("cleanup"),l.removeListener("close",ze),l.removeListener("finish",en),Ce&&l.removeListener("drain",Ce),l.removeListener("error",Qt),l.removeListener("unpipe",Oe),N.removeListener("end",xn),N.removeListener("end",yt),N.removeListener("data",Nn),On=!0,Ce&&L.awaitDrainWriters&&(!l._writableState||l._writableState.needDrain)&&Ce()}function Cn(){On||(L.pipes.length===1&&L.pipes[0]===l?(m("false write response, pause",0),L.awaitDrainWriters=l,L.multiAwaitDrain=!1):L.pipes.length>1&&L.pipes.includes(l)&&(m("false write response, pause",L.awaitDrainWriters.size),L.awaitDrainWriters.add(l)),N.pause()),Ce||(Ce=yr(N,l),l.on("drain",Ce))}N.on("data",Nn);function Nn(Qe){m("ondata");const Fe=l.write(Qe);m("dest.write",Fe),Fe===!1&&Cn()}function Qt(Qe){if(m("onerror",Qe),yt(),l.removeListener("error",Qt),l.listenerCount("error")===0){const Fe=l._writableState||l._readableState;Fe&&!Fe.errorEmitted?ee(l,Qe):l.emit("error",Qe)}}h(l,"error",Qt);function ze(){l.removeListener("finish",en),yt()}l.once("close",ze);function en(){m("onfinish"),l.removeListener("close",ze),yt()}l.once("finish",en);function yt(){m("unpipe"),N.unpipe(l)}return l.emit("pipe",N),l.writableNeedDrain===!0?Cn():L.flowing||(m("pipe resume"),N.resume()),l};function yr(l,c){return function(){const L=l._readableState;L.awaitDrainWriters===c?(m("pipeOnDrain",1),L.awaitDrainWriters=null):L.multiAwaitDrain&&(m("pipeOnDrain",L.awaitDrainWriters.size),L.awaitDrainWriters.delete(c)),(!L.awaitDrainWriters||L.awaitDrainWriters.size===0)&&l.listenerCount("data")&&l.resume()}}Y.prototype.unpipe=function(l){const c=this._readableState,N={hasUnpiped:!1};if(c.pipes.length===0)return this;if(!l){const U=c.pipes;c.pipes=[],this.pause();for(let _e=0;_e<U.length;_e++)U[_e].emit("unpipe",this,{hasUnpiped:!1});return this}const L=t(c.pipes,l);return L===-1?this:(c.pipes.splice(L,1),c.pipes.length===0&&this.pause(),l.emit("unpipe",this,N),this)},Y.prototype.on=function(l,c){const N=R.prototype.on.call(this,l,c),L=this._readableState;return l==="data"?(L.readableListening=this.listenerCount("readable")>0,L.flowing!==!1&&this.resume()):l==="readable"&&!L.endEmitted&&!L.readableListening&&(L.readableListening=L.needReadable=!0,L.flowing=!1,L.emittedReadable=!1,m("on readable",L.length,L.reading),L.length?bt(this):L.reading||e.nextTick(Je,this)),N},Y.prototype.addListener=Y.prototype.on,Y.prototype.removeListener=function(l,c){const N=R.prototype.removeListener.call(this,l,c);return l==="readable"&&e.nextTick(An,this),N},Y.prototype.off=Y.prototype.removeListener,Y.prototype.removeAllListeners=function(l){const c=R.prototype.removeAllListeners.apply(this,arguments);return(l==="readable"||l===void 0)&&e.nextTick(An,this),c};function An(l){const c=l._readableState;c.readableListening=l.listenerCount("readable")>0,c.resumeScheduled&&c[C]===!1?c.flowing=!0:l.listenerCount("data")>0?l.resume():c.readableListening||(c.flowing=null)}function Je(l){m("readable nexttick read 0"),l.read(0)}Y.prototype.resume=function(){const l=this._readableState;return l.flowing||(m("resume"),l.flowing=!l.readableListening,Dt(this,l)),l[C]=!1,this};function Dt(l,c){c.resumeScheduled||(c.resumeScheduled=!0,e.nextTick(_r,l,c))}function _r(l,c){m("resume",c.reading),c.reading||l.read(0),c.resumeScheduled=!1,l.emit("resume"),Zt(l),c.flowing&&!c.reading&&l.read(0)}Y.prototype.pause=function(){return m("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(m("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState[C]=!0,this};function Zt(l){const c=l._readableState;for(m("flow",c.flowing);c.flowing&&l.read()!==null;);}Y.prototype.wrap=function(l){let c=!1;l.on("data",L=>{!this.push(L)&&l.pause&&(c=!0,l.pause())}),l.on("end",()=>{this.push(null)}),l.on("error",L=>{ee(this,L)}),l.on("close",()=>{this.destroy()}),l.on("destroy",()=>{this.destroy()}),this._read=()=>{c&&l.resume&&(c=!1,l.resume())};const N=s(l);for(let L=1;L<N.length;L++){const U=N[L];this[U]===void 0&&typeof l[U]=="function"&&(this[U]=l[U].bind(l))}return this},Y.prototype[p]=function(){return Rn(this)},Y.prototype.iterator=function(l){return l!==void 0&&I(l,"options"),Rn(this,l)};function Rn(l,c){typeof l.read!="function"&&(l=Y.wrap(l,{objectMode:!0}));const N=In(l,c);return N.stream=l,N}async function*In(l,c){let N=V;function L(Oe){this===l?(N(),N=V):N=Oe}l.on("readable",L);let U;const _e=x(l,{writable:!1},Oe=>{U=Oe?k(U,Oe):null,N(),N=V});try{for(;;){const Oe=l.destroyed?null:l.read();if(Oe!==null)yield Oe;else{if(U)throw U;if(U===null)return;await new f(L)}}}catch(Oe){throw U=k(U,Oe),U}finally{(U||(c==null?void 0:c.destroyOnReturn)!==!1)&&(U===void 0||l._readableState.autoDestroy)?P.destroyer(l,null):(l.off("readable",L),_e())}}o(Y.prototype,{readable:{__proto__:null,get(){const l=this._readableState;return!!l&&l.readable!==!1&&!l.destroyed&&!l.errorEmitted&&!l.endEmitted},set(l){this._readableState&&(this._readableState.readable=!!l)}},readableDidRead:{__proto__:null,enumerable:!1,get:function(){return this._readableState.dataEmitted}},readableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._readableState.readable!==!1&&(this._readableState.destroyed||this._readableState.errored)&&!this._readableState.endEmitted)}},readableHighWaterMark:{__proto__:null,enumerable:!1,get:function(){return this._readableState.highWaterMark}},readableBuffer:{__proto__:null,enumerable:!1,get:function(){return this._readableState&&this._readableState.buffer}},readableFlowing:{__proto__:null,enumerable:!1,get:function(){return this._readableState.flowing},set:function(l){this._readableState&&(this._readableState.flowing=l)}},readableLength:{__proto__:null,enumerable:!1,get(){return this._readableState.length}},readableObjectMode:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.objectMode:!1}},readableEncoding:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.encoding:null}},errored:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.errored:null}},closed:{__proto__:null,get(){return this._readableState?this._readableState.closed:!1}},destroyed:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.destroyed:!1},set(l){this._readableState&&(this._readableState.destroyed=l)}},readableEnded:{__proto__:null,enumerable:!1,get(){return this._readableState?this._readableState.endEmitted:!1}}}),o(Le.prototype,{pipesCount:{__proto__:null,get(){return this.pipes.length}},paused:{__proto__:null,get(){return this[C]!==!1},set(l){this[C]=!!l}}}),Y._fromList=lt;function lt(l,c){if(c.length===0)return null;let N;return c.objectMode?N=c.buffer.shift():!l||l>=c.length?(c.decoder?N=c.buffer.join(""):c.buffer.length===1?N=c.buffer.first():N=c.buffer.concat(c.length),c.buffer.clear()):N=c.buffer.consume(l,c.decoder),N}function Jt(l){const c=l._readableState;m("endReadable",c.endEmitted),c.endEmitted||(c.ended=!0,e.nextTick(Xe,c,l))}function Xe(l,c){if(m("endReadableNT",l.endEmitted,l.length),!l.errored&&!l.closeEmitted&&!l.endEmitted&&l.length===0){if(l.endEmitted=!0,c.emit("end"),c.writable&&c.allowHalfOpen===!1)e.nextTick(mr,c);else if(l.autoDestroy){const N=c._writableState;(!N||N.autoDestroy&&(N.finished||N.writable===!1))&&c.destroy()}}}function mr(l){l.writable&&!l.writableEnded&&!l.destroyed&&l.end()}Y.from=function(l,c){return K(Y,l,c)};let Xt;function Tn(){return Xt===void 0&&(Xt={}),Xt}return Y.fromWeb=function(l,c){return Tn().newStreamReadableFromReadableStream(l,c)},Y.toWeb=function(l,c){return Tn().newReadableStreamFromStreamReadable(l,c)},Y.wrap=function(l,c){var N,L;return new Y({objectMode:(N=(L=l.readableObjectMode)!==null&&L!==void 0?L:l.objectMode)!==null&&N!==void 0?N:!0,...c,destroy(U,_e){P.destroyer(l,U),_e(U)}}).wrap(l)},Dr}var $r,Io;function Oi(){if(Io)return $r;Io=1;const e=X.browserExports,{ArrayPrototypeSlice:t,Error:n,FunctionPrototypeSymbolHasInstance:r,ObjectDefineProperty:i,ObjectDefineProperties:o,ObjectSetPrototypeOf:s,StringPrototypeToLowerCase:a,Symbol:f,SymbolHasInstance:u}=ge;$r=I,I.WritableState=T;const{EventEmitter:g}=Tt.eventsExports,p=xi.Stream,{Buffer:v}=X.requireBufferPolyfill(),S=Vt,{addAbortSignal:R}=sr,{getHighWaterMark:h,getDefaultHighWaterMark:w}=ar,{ERR_INVALID_ARG_TYPE:y,ERR_METHOD_NOT_IMPLEMENTED:x,ERR_MULTIPLE_CALLBACK:m,ERR_STREAM_CANNOT_PIPE:j,ERR_STREAM_DESTROYED:P,ERR_STREAM_ALREADY_FINISHED:B,ERR_STREAM_NULL_VALUES:H,ERR_STREAM_WRITE_AFTER_END:k,ERR_UNKNOWN_ENCODING:Q}=Te.codes,{errorOrDestroy:Z}=S;s(I.prototype,p.prototype),s(I,p);function D(){}const $=f("kOnFinished");function T(_,E,O){typeof O!="boolean"&&(O=E instanceof ot()),this.objectMode=!!(_&&_.objectMode),O&&(this.objectMode=this.objectMode||!!(_&&_.writableObjectMode)),this.highWaterMark=_?h(this,_,"writableHighWaterMark",O):w(!1),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;const W=!!(_&&_.decodeStrings===!1);this.decodeStrings=!W,this.defaultEncoding=_&&_.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=ee.bind(void 0,E),this.writecb=null,this.writelen=0,this.afterWriteTickInfo=null,te(this),this.pendingcb=0,this.constructed=!0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=!_||_.emitClose!==!1,this.autoDestroy=!_||_.autoDestroy!==!1,this.errored=null,this.closed=!1,this.closeEmitted=!1,this[$]=[]}function te(_){_.buffered=[],_.bufferedIndex=0,_.allBuffers=!0,_.allNoop=!0}T.prototype.getBuffer=function(){return t(this.buffered,this.bufferedIndex)},i(T.prototype,"bufferedRequestCount",{__proto__:null,get(){return this.buffered.length-this.bufferedIndex}});function I(_){const E=this instanceof ot();if(!E&&!r(I,this))return new I(_);this._writableState=new T(_,this,E),_&&(typeof _.write=="function"&&(this._write=_.write),typeof _.writev=="function"&&(this._writev=_.writev),typeof _.destroy=="function"&&(this._destroy=_.destroy),typeof _.final=="function"&&(this._final=_.final),typeof _.construct=="function"&&(this._construct=_.construct),_.signal&&R(_.signal,this)),p.call(this,_),S.construct(this,()=>{const O=this._writableState;O.writing||ne(this,O),ve(this,O)})}i(I,u,{__proto__:null,value:function(_){return r(this,_)?!0:this!==I?!1:_&&_._writableState instanceof T}}),I.prototype.pipe=function(){Z(this,new j)};function C(_,E,O,W){const z=_._writableState;if(typeof O=="function")W=O,O=z.defaultEncoding;else{if(!O)O=z.defaultEncoding;else if(O!=="buffer"&&!v.isEncoding(O))throw new Q(O);typeof W!="function"&&(W=D)}if(E===null)throw new H;if(!z.objectMode)if(typeof E=="string")z.decodeStrings!==!1&&(E=v.from(E,O),O="buffer");else if(E instanceof v)O="buffer";else if(p._isUint8Array(E))E=p._uint8ArrayToBuffer(E),O="buffer";else throw new y("chunk",["string","Buffer","Uint8Array"],E);let se;return z.ending?se=new k:z.destroyed&&(se=new P("write")),se?(e.nextTick(W,se),Z(_,se,!0),se):(z.pendingcb++,F(_,z,E,O,W))}I.prototype.write=function(_,E,O){return C(this,_,E,O)===!0},I.prototype.cork=function(){this._writableState.corked++},I.prototype.uncork=function(){const _=this._writableState;_.corked&&(_.corked--,_.writing||ne(this,_))},I.prototype.setDefaultEncoding=function(E){if(typeof E=="string"&&(E=a(E)),!v.isEncoding(E))throw new Q(E);return this._writableState.defaultEncoding=E,this};function F(_,E,O,W,z){const se=E.objectMode?1:O.length;E.length+=se;const de=E.length<E.highWaterMark;return de||(E.needDrain=!0),E.writing||E.corked||E.errored||!E.constructed?(E.buffered.push({chunk:O,encoding:W,callback:z}),E.allBuffers&&W!=="buffer"&&(E.allBuffers=!1),E.allNoop&&z!==D&&(E.allNoop=!1)):(E.writelen=se,E.writecb=z,E.writing=!0,E.sync=!0,_._write(O,W,E.onwrite),E.sync=!1),de&&!E.errored&&!E.destroyed}function K(_,E,O,W,z,se,de){E.writelen=W,E.writecb=de,E.writing=!0,E.sync=!0,E.destroyed?E.onwrite(new P("write")):O?_._writev(z,E.onwrite):_._write(z,se,E.onwrite),E.sync=!1}function V(_,E,O,W){--E.pendingcb,W(O),M(E),Z(_,O)}function ee(_,E){const O=_._writableState,W=O.sync,z=O.writecb;if(typeof z!="function"){Z(_,new m);return}O.writing=!1,O.writecb=null,O.length-=O.writelen,O.writelen=0,E?(E.stack,O.errored||(O.errored=E),_._readableState&&!_._readableState.errored&&(_._readableState.errored=E),W?e.nextTick(V,_,O,E,z):V(_,O,E,z)):(O.buffered.length>O.bufferedIndex&&ne(_,O),W?O.afterWriteTickInfo!==null&&O.afterWriteTickInfo.cb===z?O.afterWriteTickInfo.count++:(O.afterWriteTickInfo={count:1,cb:z,stream:_,state:O},e.nextTick(J,O.afterWriteTickInfo)):ue(_,O,1,z))}function J({stream:_,state:E,count:O,cb:W}){return E.afterWriteTickInfo=null,ue(_,E,O,W)}function ue(_,E,O,W){for(!E.ending&&!_.destroyed&&E.length===0&&E.needDrain&&(E.needDrain=!1,_.emit("drain"));O-- >0;)E.pendingcb--,W();E.destroyed&&M(E),ve(_,E)}function M(_){if(_.writing)return;for(let z=_.bufferedIndex;z<_.buffered.length;++z){var E;const{chunk:se,callback:de}=_.buffered[z],ie=_.objectMode?1:se.length;_.length-=ie,de((E=_.errored)!==null&&E!==void 0?E:new P("write"))}const O=_[$].splice(0);for(let z=0;z<O.length;z++){var W;O[z]((W=_.errored)!==null&&W!==void 0?W:new P("end"))}te(_)}function ne(_,E){if(E.corked||E.bufferProcessing||E.destroyed||!E.constructed)return;const{buffered:O,bufferedIndex:W,objectMode:z}=E,se=O.length-W;if(!se)return;let de=W;if(E.bufferProcessing=!0,se>1&&_._writev){E.pendingcb-=se-1;const ie=E.allNoop?D:Y=>{for(let Ee=de;Ee<O.length;++Ee)O[Ee].callback(Y)},Le=E.allNoop&&de===0?O:t(O,de);Le.allBuffers=E.allBuffers,K(_,E,!0,E.length,Le,"",ie),te(E)}else{do{const{chunk:ie,encoding:Le,callback:Y}=O[de];O[de++]=null;const Ee=z?1:ie.length;K(_,E,!1,Ee,ie,Le,Y)}while(de<O.length&&!E.writing);de===O.length?te(E):de>256?(O.splice(0,de),E.bufferedIndex=0):E.bufferedIndex=de}E.bufferProcessing=!1}I.prototype._write=function(_,E,O){if(this._writev)this._writev([{chunk:_,encoding:E}],O);else throw new x("_write()")},I.prototype._writev=null,I.prototype.end=function(_,E,O){const W=this._writableState;typeof _=="function"?(O=_,_=null,E=null):typeof E=="function"&&(O=E,E=null);let z;if(_!=null){const se=C(this,_,E);se instanceof n&&(z=se)}return W.corked&&(W.corked=1,this.uncork()),z||(!W.errored&&!W.ending?(W.ending=!0,ve(this,W,!0),W.ended=!0):W.finished?z=new B("end"):W.destroyed&&(z=new P("end"))),typeof O=="function"&&(z||W.finished?e.nextTick(O,z):W[$].push(O)),this};function pe(_){return _.ending&&!_.destroyed&&_.constructed&&_.length===0&&!_.errored&&_.buffered.length===0&&!_.finished&&!_.writing&&!_.errorEmitted&&!_.closeEmitted}function we(_,E){let O=!1;function W(z){if(O){Z(_,z??m());return}if(O=!0,E.pendingcb--,z){const se=E[$].splice(0);for(let de=0;de<se.length;de++)se[de](z);Z(_,z,E.sync)}else pe(E)&&(E.prefinished=!0,_.emit("prefinish"),E.pendingcb++,e.nextTick(Ae,_,E))}E.sync=!0,E.pendingcb++;try{_._final(W)}catch(z){W(z)}E.sync=!1}function ye(_,E){!E.prefinished&&!E.finalCalled&&(typeof _._final=="function"&&!E.destroyed?(E.finalCalled=!0,we(_,E)):(E.prefinished=!0,_.emit("prefinish")))}function ve(_,E,O){pe(E)&&(ye(_,E),E.pendingcb===0&&(O?(E.pendingcb++,e.nextTick((W,z)=>{pe(z)?Ae(W,z):z.pendingcb--},_,E)):pe(E)&&(E.pendingcb++,Ae(_,E))))}function Ae(_,E){E.pendingcb--,E.finished=!0;const O=E[$].splice(0);for(let W=0;W<O.length;W++)O[W]();if(_.emit("finish"),E.autoDestroy){const W=_._readableState;(!W||W.autoDestroy&&(W.endEmitted||W.readable===!1))&&_.destroy()}}o(I.prototype,{closed:{__proto__:null,get(){return this._writableState?this._writableState.closed:!1}},destroyed:{__proto__:null,get(){return this._writableState?this._writableState.destroyed:!1},set(_){this._writableState&&(this._writableState.destroyed=_)}},writable:{__proto__:null,get(){const _=this._writableState;return!!_&&_.writable!==!1&&!_.destroyed&&!_.errored&&!_.ending&&!_.ended},set(_){this._writableState&&(this._writableState.writable=!!_)}},writableFinished:{__proto__:null,get(){return this._writableState?this._writableState.finished:!1}},writableObjectMode:{__proto__:null,get(){return this._writableState?this._writableState.objectMode:!1}},writableBuffer:{__proto__:null,get(){return this._writableState&&this._writableState.getBuffer()}},writableEnded:{__proto__:null,get(){return this._writableState?this._writableState.ending:!1}},writableNeedDrain:{__proto__:null,get(){const _=this._writableState;return _?!_.destroyed&&!_.ending&&_.needDrain:!1}},writableHighWaterMark:{__proto__:null,get(){return this._writableState&&this._writableState.highWaterMark}},writableCorked:{__proto__:null,get(){return this._writableState?this._writableState.corked:0}},writableLength:{__proto__:null,get(){return this._writableState&&this._writableState.length}},errored:{__proto__:null,enumerable:!1,get(){return this._writableState?this._writableState.errored:null}},writableAborted:{__proto__:null,enumerable:!1,get:function(){return!!(this._writableState.writable!==!1&&(this._writableState.destroyed||this._writableState.errored)&&!this._writableState.finished)}}});const xe=S.destroy;I.prototype.destroy=function(_,E){const O=this._writableState;return!O.destroyed&&(O.bufferedIndex<O.buffered.length||O[$].length)&&e.nextTick(M,O),xe.call(this,_,E),this},I.prototype._undestroy=S.undestroy,I.prototype._destroy=function(_,E){E(_)},I.prototype[g.captureRejectionSymbol]=function(_){this.destroy(_)};let Ue;function Re(){return Ue===void 0&&(Ue={}),Ue}return I.fromWeb=function(_,E){return Re().newStreamWritableFromWritableStream(_,E)},I.toWeb=function(_){return Re().newWritableStreamFromStreamWritable(_)},$r}var jr,To;function df(){if(To)return jr;To=1;const e=X.browserExports,t=X.requireBufferPolyfill(),{isReadable:n,isWritable:r,isIterable:i,isNodeStream:o,isReadableNodeStream:s,isWritableNodeStream:a,isDuplexNodeStream:f,isReadableStream:u,isWritableStream:g}=at,p=pt,{AbortError:v,codes:{ERR_INVALID_ARG_TYPE:S,ERR_INVALID_RETURN_VALUE:R}}=Te,{destroyer:h}=Vt,w=ot(),y=lr(),x=Oi(),{createDeferredPromise:m}=Pe,j=Qs,P=globalThis.Blob||t.Blob,B=typeof P<"u"?function(T){return T instanceof P}:function(T){return!1},H=globalThis.AbortController||cn().AbortController,{FunctionPrototypeCall:k}=ge;class Q extends w{constructor(T){super(T),(T==null?void 0:T.readable)===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),(T==null?void 0:T.writable)===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)}}jr=function $(T,te){if(f(T))return T;if(s(T))return D({readable:T});if(a(T))return D({writable:T});if(o(T))return D({writable:!1,readable:!1});if(u(T))return D({readable:y.fromWeb(T)});if(g(T))return D({writable:x.fromWeb(T)});if(typeof T=="function"){const{value:C,write:F,final:K,destroy:V}=Z(T);if(i(C))return j(Q,C,{objectMode:!0,write:F,final:K,destroy:V});const ee=C==null?void 0:C.then;if(typeof ee=="function"){let J;const ue=k(ee,C,M=>{if(M!=null)throw new R("nully","body",M)},M=>{h(J,M)});return J=new Q({objectMode:!0,readable:!1,write:F,final(M){K(async()=>{try{await ue,e.nextTick(M,null)}catch(ne){e.nextTick(M,ne)}})},destroy:V})}throw new R("Iterable, AsyncIterable or AsyncFunction",te,C)}if(B(T))return $(T.arrayBuffer());if(i(T))return j(Q,T,{objectMode:!0,writable:!1});if(u(T==null?void 0:T.readable)&&g(T==null?void 0:T.writable))return Q.fromWeb(T);if(typeof(T==null?void 0:T.writable)=="object"||typeof(T==null?void 0:T.readable)=="object"){const C=T!=null&&T.readable?s(T==null?void 0:T.readable)?T==null?void 0:T.readable:$(T.readable):void 0,F=T!=null&&T.writable?a(T==null?void 0:T.writable)?T==null?void 0:T.writable:$(T.writable):void 0;return D({readable:C,writable:F})}const I=T==null?void 0:T.then;if(typeof I=="function"){let C;return k(I,T,F=>{F!=null&&C.push(F),C.push(null)},F=>{h(C,F)}),C=new Q({objectMode:!0,writable:!1,read(){}})}throw new S(te,["Blob","ReadableStream","WritableStream","Stream","Iterable","AsyncIterable","Function","{ readable, writable } pair","Promise"],T)};function Z($){let{promise:T,resolve:te}=m();const I=new H,C=I.signal;return{value:$(async function*(){for(;;){const K=T;T=null;const{chunk:V,done:ee,cb:J}=await K;if(e.nextTick(J),ee)return;if(C.aborted)throw new v(void 0,{cause:C.reason});({promise:T,resolve:te}=m()),yield V}}(),{signal:C}),write(K,V,ee){const J=te;te=null,J({chunk:K,done:!1,cb:ee})},final(K){const V=te;te=null,V({done:!0,cb:K})},destroy(K,V){I.abort(),V(K)}}}function D($){const T=$.readable&&typeof $.readable.read!="function"?y.wrap($.readable):$.readable,te=$.writable;let I=!!n(T),C=!!r(te),F,K,V,ee,J;function ue(M){const ne=ee;ee=null,ne?ne(M):M&&J.destroy(M)}return J=new Q({readableObjectMode:!!(T!=null&&T.readableObjectMode),writableObjectMode:!!(te!=null&&te.writableObjectMode),readable:I,writable:C}),C&&(p(te,M=>{C=!1,M&&h(T,M),ue(M)}),J._write=function(M,ne,pe){te.write(M,ne)?pe():F=pe},J._final=function(M){te.end(),K=M},te.on("drain",function(){if(F){const M=F;F=null,M()}}),te.on("finish",function(){if(K){const M=K;K=null,M()}})),I&&(p(T,M=>{I=!1,M&&h(T,M),ue(M)}),T.on("readable",function(){if(V){const M=V;V=null,M()}}),T.on("end",function(){J.push(null)}),J._read=function(){for(;;){const M=T.read();if(M===null){V=J._read;return}if(!J.push(M))return}}),J._destroy=function(M,ne){!M&&ee!==null&&(M=new v),V=null,F=null,K=null,ee===null?ne(M):(ee=ne,h(te,M),h(T,M))},J}return jr}var kr,xo;function ot(){if(xo)return kr;xo=1;const{ObjectDefineProperties:e,ObjectGetOwnPropertyDescriptor:t,ObjectKeys:n,ObjectSetPrototypeOf:r}=ge;kr=s;const i=lr(),o=Oi();r(s.prototype,i.prototype),r(s,i);{const g=n(o.prototype);for(let p=0;p<g.length;p++){const v=g[p];s.prototype[v]||(s.prototype[v]=o.prototype[v])}}function s(g){if(!(this instanceof s))return new s(g);i.call(this,g),o.call(this,g),g?(this.allowHalfOpen=g.allowHalfOpen!==!1,g.readable===!1&&(this._readableState.readable=!1,this._readableState.ended=!0,this._readableState.endEmitted=!0),g.writable===!1&&(this._writableState.writable=!1,this._writableState.ending=!0,this._writableState.ended=!0,this._writableState.finished=!0)):this.allowHalfOpen=!0}e(s.prototype,{writable:{__proto__:null,...t(o.prototype,"writable")},writableHighWaterMark:{__proto__:null,...t(o.prototype,"writableHighWaterMark")},writableObjectMode:{__proto__:null,...t(o.prototype,"writableObjectMode")},writableBuffer:{__proto__:null,...t(o.prototype,"writableBuffer")},writableLength:{__proto__:null,...t(o.prototype,"writableLength")},writableFinished:{__proto__:null,...t(o.prototype,"writableFinished")},writableCorked:{__proto__:null,...t(o.prototype,"writableCorked")},writableEnded:{__proto__:null,...t(o.prototype,"writableEnded")},writableNeedDrain:{__proto__:null,...t(o.prototype,"writableNeedDrain")},destroyed:{__proto__:null,get(){return this._readableState===void 0||this._writableState===void 0?!1:this._readableState.destroyed&&this._writableState.destroyed},set(g){this._readableState&&this._writableState&&(this._readableState.destroyed=g,this._writableState.destroyed=g)}}});let a;function f(){return a===void 0&&(a={}),a}s.fromWeb=function(g,p){return f().newStreamDuplexFromReadableWritablePair(g,p)},s.toWeb=function(g){return f().newReadableWritablePairFromDuplex(g)};let u;return s.from=function(g){return u||(u=df()),u(g,"body")},kr}const{ObjectSetPrototypeOf:ea,Symbol:cf}=ge;var ta=st;const{ERR_METHOD_NOT_IMPLEMENTED:hf}=Te.codes,Ci=ot(),{getHighWaterMark:gf}=ar;ea(st.prototype,Ci.prototype);ea(st,Ci);const ln=cf("kCallback");function st(e){if(!(this instanceof st))return new st(e);const t=e?gf(this,e,"readableHighWaterMark",!0):null;t===0&&(e={...e,highWaterMark:null,readableHighWaterMark:t,writableHighWaterMark:e.writableHighWaterMark||0}),Ci.call(this,e),this._readableState.sync=!1,this[ln]=null,e&&(typeof e.transform=="function"&&(this._transform=e.transform),typeof e.flush=="function"&&(this._flush=e.flush)),this.on("prefinish",pf)}function di(e){typeof this._flush=="function"&&!this.destroyed?this._flush((t,n)=>{if(t){e?e(t):this.destroy(t);return}n!=null&&this.push(n),this.push(null),e&&e()}):(this.push(null),e&&e())}function pf(){this._final!==di&&di.call(this)}st.prototype._final=di;st.prototype._transform=function(e,t,n){throw new hf("_transform()")};st.prototype._write=function(e,t,n){const r=this._readableState,i=this._writableState,o=r.length;this._transform(e,t,(s,a)=>{if(s){n(s);return}a!=null&&this.push(a),i.ended||o===r.length||r.length<r.highWaterMark?n():this[ln]=n})};st.prototype._read=function(){if(this[ln]){const e=this[ln];this[ln]=null,e()}};const{ObjectSetPrototypeOf:na}=ge;var ra=qt;const Ni=ta;na(qt.prototype,Ni.prototype);na(qt,Ni);function qt(e){if(!(this instanceof qt))return new qt(e);Ni.call(this,e)}qt.prototype._transform=function(e,t,n){n(null,e)};const an=X.browserExports,{ArrayIsArray:bf,Promise:wf,SymbolAsyncIterator:yf,SymbolDispose:_f}=ge,Yn=pt,{once:mf}=Pe,Ef=Vt,Oo=ot(),{aggregateTwoErrors:Sf,codes:{ERR_INVALID_ARG_TYPE:ci,ERR_INVALID_RETURN_VALUE:Wr,ERR_MISSING_ARGS:vf,ERR_STREAM_DESTROYED:Af,ERR_STREAM_PREMATURE_CLOSE:Rf},AbortError:If}=Te,{validateFunction:Tf,validateAbortSignal:xf}=pn,{isIterable:Et,isReadable:Ur,isReadableNodeStream:Hn,isNodeStream:Co,isTransformStream:$t,isWebStream:Of,isReadableStream:Fr,isReadableFinished:Cf}=at,Nf=globalThis.AbortController||cn().AbortController;let qr,Hr,zr;function No(e,t,n){let r=!1;e.on("close",()=>{r=!0});const i=Yn(e,{readable:t,writable:n},o=>{r=!o});return{destroy:o=>{r||(r=!0,Ef.destroyer(e,o||new Af("pipe")))},cleanup:i}}function Pf(e){return Tf(e[e.length-1],"streams[stream.length - 1]"),e.pop()}function Gr(e){if(Et(e))return e;if(Hn(e))return Lf(e);throw new ci("val",["Readable","Iterable","AsyncIterable"],e)}async function*Lf(e){Hr||(Hr=lr()),yield*Hr.prototype[yf].call(e)}async function $n(e,t,n,{end:r}){let i,o=null;const s=u=>{if(u&&(i=u),o){const g=o;o=null,g()}},a=()=>new wf((u,g)=>{i?g(i):o=()=>{i?g(i):u()}});t.on("drain",s);const f=Yn(t,{readable:!1},s);try{t.writableNeedDrain&&await a();for await(const u of e)t.write(u)||await a();r&&(t.end(),await a()),n()}catch(u){n(i!==u?Sf(i,u):u)}finally{f(),t.off("drain",s)}}async function Vr(e,t,n,{end:r}){$t(t)&&(t=t.writable);const i=t.getWriter();try{for await(const o of e)await i.ready,i.write(o).catch(()=>{});await i.ready,r&&await i.close(),n()}catch(o){try{await i.abort(o),n(o)}catch(s){n(s)}}}function Mf(...e){return ia(e,mf(Pf(e)))}function ia(e,t,n){if(e.length===1&&bf(e[0])&&(e=e[0]),e.length<2)throw new vf("streams");const r=new Nf,i=r.signal,o=n==null?void 0:n.signal,s=[];xf(o,"options.signal");function a(){R(new If)}zr=zr||Pe.addAbortListener;let f;o&&(f=zr(o,a));let u,g;const p=[];let v=0;function S(x){R(x,--v===0)}function R(x,m){var j;if(x&&(!u||u.code==="ERR_STREAM_PREMATURE_CLOSE")&&(u=x),!(!u&&!m)){for(;p.length;)p.shift()(u);(j=f)===null||j===void 0||j[_f](),r.abort(),m&&(u||s.forEach(P=>P()),an.nextTick(t,u,g))}}let h;for(let x=0;x<e.length;x++){const m=e[x],j=x<e.length-1,P=x>0,B=j||(n==null?void 0:n.end)!==!1,H=x===e.length-1;if(Co(m)){let k=function(Q){Q&&Q.name!=="AbortError"&&Q.code!=="ERR_STREAM_PREMATURE_CLOSE"&&S(Q)};if(B){const{destroy:Q,cleanup:Z}=No(m,j,P);p.push(Q),Ur(m)&&H&&s.push(Z)}m.on("error",k),Ur(m)&&H&&s.push(()=>{m.removeListener("error",k)})}if(x===0)if(typeof m=="function"){if(h=m({signal:i}),!Et(h))throw new Wr("Iterable, AsyncIterable or Stream","source",h)}else Et(m)||Hn(m)||$t(m)?h=m:h=Oo.from(m);else if(typeof m=="function"){if($t(h)){var w;h=Gr((w=h)===null||w===void 0?void 0:w.readable)}else h=Gr(h);if(h=m(h,{signal:i}),j){if(!Et(h,!0))throw new Wr("AsyncIterable",`transform[${x-1}]`,h)}else{var y;qr||(qr=ra);const k=new qr({objectMode:!0}),Q=(y=h)===null||y===void 0?void 0:y.then;if(typeof Q=="function")v++,Q.call(h,$=>{g=$,$!=null&&k.write($),B&&k.end(),an.nextTick(S)},$=>{k.destroy($),an.nextTick(S,$)});else if(Et(h,!0))v++,$n(h,k,S,{end:B});else if(Fr(h)||$t(h)){const $=h.readable||h;v++,$n($,k,S,{end:B})}else throw new Wr("AsyncIterable or Promise","destination",h);h=k;const{destroy:Z,cleanup:D}=No(h,!1,!0);p.push(Z),H&&s.push(D)}}else if(Co(m)){if(Hn(h)){v+=2;const k=Bf(h,m,S,{end:B});Ur(m)&&H&&s.push(k)}else if($t(h)||Fr(h)){const k=h.readable||h;v++,$n(k,m,S,{end:B})}else if(Et(h))v++,$n(h,m,S,{end:B});else throw new ci("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=m}else if(Of(m)){if(Hn(h))v++,Vr(Gr(h),m,S,{end:B});else if(Fr(h)||Et(h))v++,Vr(h,m,S,{end:B});else if($t(h))v++,Vr(h.readable,m,S,{end:B});else throw new ci("val",["Readable","Iterable","AsyncIterable","ReadableStream","TransformStream"],h);h=m}else h=Oo.from(m)}return(i!=null&&i.aborted||o!=null&&o.aborted)&&an.nextTick(a),h}function Bf(e,t,n,{end:r}){let i=!1;if(t.on("close",()=>{i||n(new Rf)}),e.pipe(t,{end:!1}),r){let o=function(){i=!0,t.end()};Cf(e)?an.nextTick(o):e.once("end",o)}else n();return Yn(e,{readable:!0,writable:!1},o=>{const s=e._readableState;o&&o.code==="ERR_STREAM_PREMATURE_CLOSE"&&s&&s.ended&&!s.errored&&!s.errorEmitted?e.once("end",n).once("error",n):n(o)}),Yn(t,{readable:!1,writable:!0},n)}var Pi={pipelineImpl:ia,pipeline:Mf};const{pipeline:Df}=Pi,jn=ot(),{destroyer:$f}=Vt,{isNodeStream:kn,isReadable:Po,isWritable:Lo,isWebStream:Kr,isTransformStream:mt,isWritableStream:Mo,isReadableStream:Bo}=at,{AbortError:jf,codes:{ERR_INVALID_ARG_VALUE:Do,ERR_MISSING_ARGS:kf}}=Te,Wf=pt;var oa=function(...t){if(t.length===0)throw new kf("streams");if(t.length===1)return jn.from(t[0]);const n=[...t];if(typeof t[0]=="function"&&(t[0]=jn.from(t[0])),typeof t[t.length-1]=="function"){const S=t.length-1;t[S]=jn.from(t[S])}for(let S=0;S<t.length;++S)if(!(!kn(t[S])&&!Kr(t[S]))){if(S<t.length-1&&!(Po(t[S])||Bo(t[S])||mt(t[S])))throw new Do(`streams[${S}]`,n[S],"must be readable");if(S>0&&!(Lo(t[S])||Mo(t[S])||mt(t[S])))throw new Do(`streams[${S}]`,n[S],"must be writable")}let r,i,o,s,a;function f(S){const R=s;s=null,R?R(S):S?a.destroy(S):!v&&!p&&a.destroy()}const u=t[0],g=Df(t,f),p=!!(Lo(u)||Mo(u)||mt(u)),v=!!(Po(g)||Bo(g)||mt(g));if(a=new jn({writableObjectMode:!!(u!=null&&u.writableObjectMode),readableObjectMode:!!(g!=null&&g.readableObjectMode),writable:p,readable:v}),p){if(kn(u))a._write=function(R,h,w){u.write(R,h)?w():r=w},a._final=function(R){u.end(),i=R},u.on("drain",function(){if(r){const R=r;r=null,R()}});else if(Kr(u)){const h=(mt(u)?u.writable:u).getWriter();a._write=async function(w,y,x){try{await h.ready,h.write(w).catch(()=>{}),x()}catch(m){x(m)}},a._final=async function(w){try{await h.ready,h.close().catch(()=>{}),i=w}catch(y){w(y)}}}const S=mt(g)?g.readable:g;Wf(S,()=>{if(i){const R=i;i=null,R()}})}if(v){if(kn(g))g.on("readable",function(){if(o){const S=o;o=null,S()}}),g.on("end",function(){a.push(null)}),a._read=function(){for(;;){const S=g.read();if(S===null){o=a._read;return}if(!a.push(S))return}};else if(Kr(g)){const R=(mt(g)?g.readable:g).getReader();a._read=async function(){for(;;)try{const{value:h,done:w}=await R.read();if(!a.push(h))return;if(w){a.push(null);return}}catch{return}}}}return a._destroy=function(S,R){!S&&s!==null&&(S=new jf),o=null,r=null,i=null,s===null?R(S):(s=R,kn(g)&&$f(g,S))},a};const Uf=globalThis.AbortController||cn().AbortController,{codes:{ERR_INVALID_ARG_VALUE:Ff,ERR_INVALID_ARG_TYPE:bn,ERR_MISSING_ARGS:qf,ERR_OUT_OF_RANGE:Hf},AbortError:Ye}=Te,{validateAbortSignal:Pt,validateInteger:$o,validateObject:Lt}=pn,zf=ge.Symbol("kWeak"),Gf=ge.Symbol("kResistStopPropagation"),{finished:Vf}=pt,Kf=oa,{addAbortSignalNoValidate:Yf}=sr,{isWritable:Zf,isNodeStream:Jf}=at,{deprecate:Xf}=Pe,{ArrayPrototypePush:Qf,Boolean:ed,MathFloor:jo,Number:td,NumberIsNaN:nd,Promise:ko,PromiseReject:Wo,PromiseResolve:rd,PromisePrototypeThen:Uo,Symbol:sa}=ge,Zn=sa("kEmpty"),Fo=sa("kEof");function id(e,t){if(t!=null&&Lt(t,"options"),(t==null?void 0:t.signal)!=null&&Pt(t.signal,"options.signal"),Jf(e)&&!Zf(e))throw new Ff("stream",e,"must be writable");const n=Kf(this,e);return t!=null&&t.signal&&Yf(t.signal,n),n}function ur(e,t){if(typeof e!="function")throw new bn("fn",["Function","AsyncFunction"],e);t!=null&&Lt(t,"options"),(t==null?void 0:t.signal)!=null&&Pt(t.signal,"options.signal");let n=1;(t==null?void 0:t.concurrency)!=null&&(n=jo(t.concurrency));let r=n-1;return(t==null?void 0:t.highWaterMark)!=null&&(r=jo(t.highWaterMark)),$o(n,"options.concurrency",1),$o(r,"options.highWaterMark",0),r+=n,(async function*(){const o=Pe.AbortSignalAny([t==null?void 0:t.signal].filter(ed)),s=this,a=[],f={signal:o};let u,g,p=!1,v=0;function S(){p=!0,R()}function R(){v-=1,h()}function h(){g&&!p&&v<n&&a.length<r&&(g(),g=null)}async function w(){try{for await(let y of s){if(p)return;if(o.aborted)throw new Ye;try{if(y=e(y,f),y===Zn)continue;y=rd(y)}catch(x){y=Wo(x)}v+=1,Uo(y,R,S),a.push(y),u&&(u(),u=null),!p&&(a.length>=r||v>=n)&&await new ko(x=>{g=x})}a.push(Fo)}catch(y){const x=Wo(y);Uo(x,R,S),a.push(x)}finally{p=!0,u&&(u(),u=null)}}w();try{for(;;){for(;a.length>0;){const y=await a[0];if(y===Fo)return;if(o.aborted)throw new Ye;y!==Zn&&(yield y),a.shift(),h()}await new ko(y=>{u=y})}}finally{p=!0,g&&(g(),g=null)}}).call(this)}function od(e=void 0){return e!=null&&Lt(e,"options"),(e==null?void 0:e.signal)!=null&&Pt(e.signal,"options.signal"),(async function*(){let n=0;for await(const i of this){var r;if(e!=null&&(r=e.signal)!==null&&r!==void 0&&r.aborted)throw new Ye({cause:e.signal.reason});yield[n++,i]}}).call(this)}async function aa(e,t=void 0){for await(const n of Li.call(this,e,t))return!0;return!1}async function sd(e,t=void 0){if(typeof e!="function")throw new bn("fn",["Function","AsyncFunction"],e);return!await aa.call(this,async(...n)=>!await e(...n),t)}async function ad(e,t){for await(const n of Li.call(this,e,t))return n}async function ld(e,t){if(typeof e!="function")throw new bn("fn",["Function","AsyncFunction"],e);async function n(r,i){return await e(r,i),Zn}for await(const r of ur.call(this,n,t));}function Li(e,t){if(typeof e!="function")throw new bn("fn",["Function","AsyncFunction"],e);async function n(r,i){return await e(r,i)?r:Zn}return ur.call(this,n,t)}class ud extends qf{constructor(){super("reduce"),this.message="Reduce of an empty stream requires an initial value"}}async function fd(e,t,n){var r;if(typeof e!="function")throw new bn("reducer",["Function","AsyncFunction"],e);n!=null&&Lt(n,"options"),(n==null?void 0:n.signal)!=null&&Pt(n.signal,"options.signal");let i=arguments.length>1;if(n!=null&&(r=n.signal)!==null&&r!==void 0&&r.aborted){const u=new Ye(void 0,{cause:n.signal.reason});throw this.once("error",()=>{}),await Vf(this.destroy(u)),u}const o=new Uf,s=o.signal;if(n!=null&&n.signal){const u={once:!0,[zf]:this,[Gf]:!0};n.signal.addEventListener("abort",()=>o.abort(),u)}let a=!1;try{for await(const u of this){var f;if(a=!0,n!=null&&(f=n.signal)!==null&&f!==void 0&&f.aborted)throw new Ye;i?t=await e(t,u,{signal:s}):(t=u,i=!0)}if(!a&&!i)throw new ud}finally{o.abort()}return t}async function dd(e){e!=null&&Lt(e,"options"),(e==null?void 0:e.signal)!=null&&Pt(e.signal,"options.signal");const t=[];for await(const r of this){var n;if(e!=null&&(n=e.signal)!==null&&n!==void 0&&n.aborted)throw new Ye(void 0,{cause:e.signal.reason});Qf(t,r)}return t}function cd(e,t){const n=ur.call(this,e,t);return(async function*(){for await(const i of n)yield*i}).call(this)}function la(e){if(e=td(e),nd(e))return 0;if(e<0)throw new Hf("number",">= 0",e);return e}function hd(e,t=void 0){return t!=null&&Lt(t,"options"),(t==null?void 0:t.signal)!=null&&Pt(t.signal,"options.signal"),e=la(e),(async function*(){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ye;for await(const o of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Ye;e--<=0&&(yield o)}}).call(this)}function gd(e,t=void 0){return t!=null&&Lt(t,"options"),(t==null?void 0:t.signal)!=null&&Pt(t.signal,"options.signal"),e=la(e),(async function*(){var r;if(t!=null&&(r=t.signal)!==null&&r!==void 0&&r.aborted)throw new Ye;for await(const o of this){var i;if(t!=null&&(i=t.signal)!==null&&i!==void 0&&i.aborted)throw new Ye;if(e-- >0&&(yield o),e<=0)return}}).call(this)}Ai.streamReturningOperators={asIndexedPairs:Xf(od,"readable.asIndexedPairs will be removed in a future version."),drop:hd,filter:Li,flatMap:cd,map:ur,take:gd,compose:id};Ai.promiseReturningOperators={every:sd,forEach:ld,reduce:fd,toArray:dd,some:aa,find:ad};var Yr,qo;function ua(){if(qo)return Yr;qo=1;const{ArrayPrototypePop:e,Promise:t}=ge,{isIterable:n,isNodeStream:r,isWebStream:i}=at,{pipelineImpl:o}=Pi,{finished:s}=pt;fa();function a(...f){return new t((u,g)=>{let p,v;const S=f[f.length-1];if(S&&typeof S=="object"&&!r(S)&&!n(S)&&!i(S)){const R=e(f);p=R.signal,v=R.end}o(f,(R,h)=>{R?g(R):u(h)},{signal:p,end:v})})}return Yr={finished:s,pipeline:a},Yr}var Ho;function fa(){if(Ho)return Pr.exports;Ho=1;const{Buffer:e}=X.requireBufferPolyfill(),{ObjectDefineProperty:t,ObjectKeys:n,ReflectApply:r}=ge,{promisify:{custom:i}}=Pe,{streamReturningOperators:o,promiseReturningOperators:s}=Ai,{codes:{ERR_ILLEGAL_CONSTRUCTOR:a}}=Te,f=oa,{setDefaultHighWaterMark:u,getDefaultHighWaterMark:g}=ar,{pipeline:p}=Pi,{destroyer:v}=Vt,S=pt,R=ua(),h=at,w=Pr.exports=xi.Stream;w.isDestroyed=h.isDestroyed,w.isDisturbed=h.isDisturbed,w.isErrored=h.isErrored,w.isReadable=h.isReadable,w.isWritable=h.isWritable,w.Readable=lr();for(const x of n(o)){let j=function(...P){if(new.target)throw a();return w.Readable.from(r(m,this,P))};const m=o[x];t(j,"name",{__proto__:null,value:m.name}),t(j,"length",{__proto__:null,value:m.length}),t(w.Readable.prototype,x,{__proto__:null,value:j,enumerable:!1,configurable:!0,writable:!0})}for(const x of n(s)){let j=function(...P){if(new.target)throw a();return r(m,this,P)};const m=s[x];t(j,"name",{__proto__:null,value:m.name}),t(j,"length",{__proto__:null,value:m.length}),t(w.Readable.prototype,x,{__proto__:null,value:j,enumerable:!1,configurable:!0,writable:!0})}w.Writable=Oi(),w.Duplex=ot(),w.Transform=ta,w.PassThrough=ra,w.pipeline=p;const{addAbortSignal:y}=sr;return w.addAbortSignal=y,w.finished=S,w.destroy=v,w.compose=f,w.setDefaultHighWaterMark=u,w.getDefaultHighWaterMark=g,t(w,"promises",{__proto__:null,configurable:!0,enumerable:!0,get(){return R}}),t(p,i,{__proto__:null,enumerable:!0,get(){return R.pipeline}}),t(S,i,{__proto__:null,enumerable:!0,get(){return R.finished}}),w.Stream=w,w._isUint8Array=function(m){return m instanceof Uint8Array},w._uint8ArrayToBuffer=function(m){return e.from(m.buffer,m.byteOffset,m.byteLength)},Pr.exports}(function(e){const t=fa(),n=ua(),r=t.Readable.destroy;e.exports=t.Readable,e.exports._uint8ArrayToBuffer=t._uint8ArrayToBuffer,e.exports._isUint8Array=t._isUint8Array,e.exports.isDisturbed=t.isDisturbed,e.exports.isErrored=t.isErrored,e.exports.isReadable=t.isReadable,e.exports.Readable=t.Readable,e.exports.Writable=t.Writable,e.exports.Duplex=t.Duplex,e.exports.Transform=t.Transform,e.exports.PassThrough=t.PassThrough,e.exports.addAbortSignal=t.addAbortSignal,e.exports.finished=t.finished,e.exports.destroy=t.destroy,e.exports.destroy=r,e.exports.pipeline=t.pipeline,e.exports.compose=t.compose,Object.defineProperty(t,"promises",{configurable:!0,enumerable:!0,get(){return n}}),e.exports.Stream=t.Stream,e.exports.default=e.exports})(Ts);var fr=Ts.exports,Mi={exports:{}},pd=da;function da(e,t){if(e&&t)return da(e)(t);if(typeof e!="function")throw new TypeError("need wrapper function");return Object.keys(e).forEach(function(r){n[r]=e[r]}),n;function n(){for(var r=new Array(arguments.length),i=0;i<r.length;i++)r[i]=arguments[i];var o=e.apply(this,r),s=r[r.length-1];return typeof o=="function"&&o!==s&&Object.keys(s).forEach(function(a){o[a]=s[a]}),o}}var ca=pd;Mi.exports=ca(zn);Mi.exports.strict=ca(ha);zn.proto=zn(function(){Object.defineProperty(Function.prototype,"once",{value:function(){return zn(this)},configurable:!0}),Object.defineProperty(Function.prototype,"onceStrict",{value:function(){return ha(this)},configurable:!0})});function zn(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function ha(e){var t=function(){if(t.called)throw new Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)},n=e.name||"Function wrapped with `once`";return t.onceError=n+" shouldn't be called more than once",t.called=!1,t}var Bi=Mi.exports;const bd=X.getDefaultExportFromCjs(Bi);var wd=Bi,yd=function(){},_d=X.commonjsGlobal.Bare?queueMicrotask:X.dist.process.nextTick.bind(X.dist.process),md=function(e){return e.setHeader&&typeof e.abort=="function"},Ed=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},ga=function(e,t,n){if(typeof t=="function")return ga(e,null,t);t||(t={}),n=wd(n||yd);var r=e._writableState,i=e._readableState,o=t.readable||t.readable!==!1&&e.readable,s=t.writable||t.writable!==!1&&e.writable,a=!1,f=function(){e.writable||u()},u=function(){s=!1,o||n.call(e)},g=function(){o=!1,s||n.call(e)},p=function(w){n.call(e,w?new Error("exited with error code: "+w):null)},v=function(w){n.call(e,w)},S=function(){_d(R)},R=function(){if(!a){if(o&&!(i&&i.ended&&!i.destroyed))return n.call(e,new Error("premature close"));if(s&&!(r&&r.ended&&!r.destroyed))return n.call(e,new Error("premature close"))}},h=function(){e.req.on("finish",u)};return md(e)?(e.on("complete",u),e.on("abort",S),e.req?h():e.on("request",h)):s&&!r&&(e.on("end",f),e.on("close",f)),Ed(e)&&e.on("exit",p),e.on("end",g),e.on("finish",u),t.error!==!1&&e.on("error",v),e.on("close",S),function(){a=!0,e.removeListener("complete",u),e.removeListener("abort",S),e.removeListener("request",h),e.req&&e.req.removeListener("finish",u),e.removeListener("end",f),e.removeListener("close",f),e.removeListener("finish",u),e.removeListener("exit",p),e.removeListener("end",g),e.removeListener("error",v),e.removeListener("close",S)}},pa=ga;const zo=X.getDefaultExportFromCjs(pa);var Sd=Bi,vd=pa,Gn;try{Gn=Tt.require$$2}catch{}var hn=function(){},Ad=typeof X.dist.process>"u"?!1:/^v?\.0/.test(X.dist.process.version),dr=function(e){return typeof e=="function"},Rd=function(e){return!Ad||!Gn?!1:(e instanceof(Gn.ReadStream||hn)||e instanceof(Gn.WriteStream||hn))&&dr(e.close)},Id=function(e){return e.setHeader&&dr(e.abort)},Td=function(e,t,n,r){r=Sd(r);var i=!1;e.on("close",function(){i=!0}),vd(e,{readable:t,writable:n},function(s){if(s)return r(s);i=!0,r()});var o=!1;return function(s){if(!i&&!o){if(o=!0,Rd(e))return e.close(hn);if(Id(e))return e.abort();if(dr(e.destroy))return e.destroy();r(s||new Error("stream was destroyed"))}}},Go=function(e){e()},xd=function(e,t){return e.pipe(t)},Od=function(){var e=Array.prototype.slice.call(arguments),t=dr(e[e.length-1]||hn)&&e.pop()||hn;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw new Error("pump requires two streams per minimum");var n,r=e.map(function(i,o){var s=o<e.length-1,a=o>0;return Td(i,s,a,function(f){n||(n=f),f&&r.forEach(Go),!s&&(r.forEach(Go),t(n))})});return e.reduce(xd)},Cd=Od;const Vo=X.getDefaultExportFromCjs(Cd);function Wn(){}const Ko="SYN",Zr="ACK",Yo="BRK";class Zo extends fr.Duplex{constructor(t){let{name:n,target:r,targetWindow:i=window,targetOrigin:o="*"}=t;if(super({objectMode:!0}),G(this,"_init",void 0),G(this,"_haveSyn",void 0),G(this,"_name",void 0),G(this,"_target",void 0),G(this,"_targetWindow",void 0),G(this,"_targetOrigin",void 0),G(this,"_onMessage",void 0),G(this,"_synIntervalId",void 0),!n||!r)throw new Error("Invalid input.");this._init=!1,this._haveSyn=!1,this._name=n,this._target=r,this._targetWindow=i,this._targetOrigin=o,this._onMessage=this.onMessage.bind(this),this._synIntervalId=null,window.addEventListener("message",this._onMessage,!1),this._handShake()}_break(){this.cork(),this._write(Yo,null,Wn),this._haveSyn=!1,this._init=!1}_handShake(){this._write(Ko,null,Wn),this.cork()}_onData(t){if(!this._init)t===Ko?(this._haveSyn=!0,this._write(Zr,null,Wn)):t===Zr&&(this._init=!0,this._haveSyn||this._write(Zr,null,Wn),this.uncork());else if(t===Yo)this._break();else try{this.push(t)}catch(n){this.emit("error",n)}}_postMessage(t){const n=this._targetOrigin;this._targetWindow.postMessage({target:this._target,data:t},n)}onMessage(t){const n=t.data;this._targetOrigin!=="*"&&t.origin!==this._targetOrigin||t.source!==this._targetWindow||typeof n!="object"||n.target!==this._name||!n.data||this._onData(n.data)}_read(){}_write(t,n,r){this._postMessage(t),r()}_destroy(){window.removeEventListener("message",this._onMessage,!1)}}const Nd={rpc:{internal:-32603}},Jo={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}},Xo=Nd.rpc.internal,Pd="Unspecified error message. This is a bug, please report it.";function ba(e){return Number.isInteger(e)}function Qo(e){return typeof e=="string"&&e.length>0}function es(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function wa(e){const t=e;return!(!t||!ba(t.code)||!Qo(t.message)||t.stack&&!Qo(t.stack))}function Ld(e){let t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pd;if(ba(e)){const n=e.toString();if(Object.hasOwn(Jo,n))return Jo[n].message}return t}const Md={code:Xo,message:Ld(Xo)};function hi(e){try{JSON.parse(JSON.stringify(e,(t,n)=>{if(t==="__proto__"||t==="constructor")throw new Error("Not valid json");if(typeof n=="function"||typeof n=="symbol")throw new Error("Not valid json");return n}),(t,n)=>{if(!(t==="__proto__"||t==="constructor"))return n})}catch{return!1}return!0}function ts(e){return Object.getOwnPropertyNames(e).reduce((t,n)=>{const r=e[n];return hi(r)&&(t[n]=r),t},{})}function Bd(e){return Array.isArray(e)?e.map(t=>hi(t)?t:es(t)?ts(t):null):es(e)?ts(e):hi(e)?e:null}function Dd(e,t){if(e&&typeof e=="object"&&"serialize"in e&&typeof e.serialize=="function")return e.serialize();if(wa(e))return e;const n=Bd(e);return je(je({},t),{},{data:{cause:n}})}function ns(e){let{fallbackError:t=Md,shouldIncludeStack:n=!0}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(!wa(t))throw new Error("Must provide fallback error with integer number code and string message.");const r=Dd(e,t);return n||delete r.stack,r}function rs(e,t,n){try{Reflect.apply(e,t,n)}catch(r){setTimeout(()=>{throw r})}}function $d(e){const t=e.length,n=new Array(t);for(let r=0;r<t;r+=1)n[r]=e[r];return n}class cr extends Tt.eventsExports.EventEmitter{emit(t){let n=t==="error";const r=this._events;if(r!==void 0)n=n&&r.error===void 0;else if(!n)return!1;for(var i=arguments.length,o=new Array(i>1?i-1:0),s=1;s<i;s++)o[s-1]=arguments[s];if(n){let f;if(o.length>0&&([f]=o),f instanceof Error)throw f;const u=new Error(`Unhandled error.${f?` (${f.message})`:""}`);throw u.context=f,u}const a=r[t];if(a===void 0)return!1;if(typeof a=="function")rs(a,this,o);else{const f=a.length,u=$d(a);for(let g=0;g<f;g+=1)rs(u[g],this,o)}return!0}}class sn extends Error{constructor(t){let{code:n,message:r,data:i}=t;if(!Number.isInteger(n))throw new Error("code must be an integer");if(!r||typeof r!="string")throw new Error("message must be string");super(r),G(this,"code",void 0),G(this,"data",void 0),this.code=n,i!==void 0&&(this.data=i)}toString(){return _l({code:this.code,message:this.message,data:this.data,stack:this.stack})}}const gi=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return(r,i)=>{r||i.error?t(r||i.error):!n||Array.isArray(i)?e(i):e(i.result)}};function jd(){const e={};function t(){return!1}const n=new cr;function r(f){const u=e[f.id];if(!u)throw new Error(`StreamMiddleware - Unknown response id "${f.id}"`);delete e[f.id],Object.assign(u.res,f),setTimeout(u.end)}function i(f){n.emit("notification",f)}function o(f,u,g){let p;try{!f.id?i(f):r(f)}catch(v){p=v}g(p)}const s=new fr.Duplex({objectMode:!0,read:t,write:o});return{events:n,middleware:(f,u,g,p)=>{s.push(f),e[f.id]={req:f,res:u,next:g,end:p}},stream:s}}function kd(){return(e,t,n,r)=>{const i=e.id,o=Math.random().toString(36).slice(2);e.id=o,t.id=o,n(s=>{e.id=i,t.id=i,s()})}}class tt extends cr{constructor(){super(),G(this,"_middleware",void 0),this._middleware=[]}static async _runAllMiddleware(t,n,r){const i=[];let o=null,s=!1;for(const a of r)if([o,s]=await tt._runMiddleware(t,n,a,i),s)break;return[o,s,i.reverse()]}static _runMiddleware(t,n,r,i){return new Promise(o=>{const s=f=>{const u=f||n.error;u&&(typeof u=="object"&&Object.keys(u).includes("stack")===!1&&(u.stack="Stack trace is not available."),n.error=ns(u,{shouldIncludeStack:!0,fallbackError:{message:(u==null?void 0:u.message)||(u==null?void 0:u.toString()),code:(u==null?void 0:u.code)||-32603,stack:(u==null?void 0:u.stack)||"Stack trace is not available.",data:(u==null?void 0:u.data)||(u==null?void 0:u.message)||(u==null?void 0:u.toString())}})),o([u,!0])},a=f=>{n.error?s(n.error):(f&&(typeof f!="function"&&s(new sn({code:-32603,message:"JRPCEngine: 'next' return handlers must be functions"})),i.push(f)),o([null,!1]))};try{r(t,n,a,s)}catch(f){s(f)}})}static async _runReturnHandlers(t){for(const n of t)await new Promise((r,i)=>{n(o=>o?i(o):r())})}static _checkForCompletion(t,n,r){if(!("result"in n)&&!("error"in n))throw new sn({code:-32603,message:"Response has no error or result for request"});if(!r)throw new sn({code:-32603,message:"Nothing ended request"})}push(t){this._middleware.push(t)}handle(t,n){if(n&&typeof n!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(t)?n?this._handleBatch(t,n):this._handleBatch(t):n?this._handle(t,n):this._promiseHandle(t)}asMiddleware(){return async(t,n,r,i)=>{try{const[o,s,a]=await tt._runAllMiddleware(t,n,this._middleware);return s?(await tt._runReturnHandlers(a),i(o)):r(async f=>{try{await tt._runReturnHandlers(a)}catch(u){return f(u)}return f()})}catch(o){return i(o)}}}async _handleBatch(t,n){try{const r=await Promise.all(t.map(this._promiseHandle.bind(this)));return n?n(null,r):r}catch(r){if(n)return n(r);throw r}}_promiseHandle(t){return new Promise((n,r)=>{this._handle(t,(i,o)=>{i&&o===void 0?r(i):n(o)}).catch(r)})}async _handle(t,n){if(!t||Array.isArray(t)||typeof t!="object"){const S=new sn({code:-32603,message:"request must be plain object"});return n(S,{id:void 0,jsonrpc:"2.0",error:S})}if(typeof t.method!="string"){const S=new sn({code:-32603,message:"method must be string"});return n(S,{id:t.id,jsonrpc:"2.0",error:S})}const r=je({},t),i={id:r.id,jsonrpc:r.jsonrpc};let o=null;try{await this._processRequest(r,i)}catch(S){o=S}if(o&&(delete i.result,!i.error)){var s,a,f,u,g,p,v;typeof o=="object"&&Object.keys(o).includes("stack")===!1&&(o.stack="Stack trace is not available."),i.error=ns(o,{shouldIncludeStack:!0,fallbackError:{message:((s=o)===null||s===void 0?void 0:s.message)||((a=o)===null||a===void 0?void 0:a.toString()),code:((f=o)===null||f===void 0?void 0:f.code)||-32603,stack:((u=o)===null||u===void 0?void 0:u.stack)||"Stack trace is not available.",data:((g=o)===null||g===void 0?void 0:g.data)||((p=o)===null||p===void 0?void 0:p.message)||((v=o)===null||v===void 0?void 0:v.toString())}})}return n(o,i)}async _processRequest(t,n){const[r,i,o]=await tt._runAllMiddleware(t,n,this._middleware);if(tt._checkForCompletion(t,n,i),await tt._runReturnHandlers(o),r)throw r}}class Wd extends fr.Duplex{constructor(t){let{parent:n,name:r}=t;super({objectMode:!0}),G(this,"_parent",void 0),G(this,"_name",void 0),this._parent=n,this._name=r}_read(){}_write(t,n,r){this._parent.push({name:this._name,data:t}),r()}}const is=Symbol("IGNORE_SUBSTREAM");class Ud extends fr.Duplex{constructor(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(je(je({},t),{},{objectMode:!0})),G(this,"_substreams",void 0),G(this,"getStream",void 0),this._substreams={}}createStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);const n=new Wd({parent:this,name:t});return this._substreams[t]=n,Fd(this,r=>n.destroy(r||void 0)),n}ignoreStream(t){if(!t)throw new Error("ObjectMultiplex - name must not be empty");if(this._substreams[t])throw new Error(`ObjectMultiplex - Substream for name "${t}" already exists`);this._substreams[t]=is}_read(){}_write(t,n,r){const{name:i,data:o}=t;if(!i)return window.console.warn(`ObjectMultiplex - malformed chunk without name "${t}"`),r();const s=this._substreams[i];return s?(s!==is&&s.push(o),r()):(window.console.warn(`ObjectMultiplex - orphaned data for stream "${i}"`),r())}}function Fd(e,t){const n=bd(t);zo(e,{readable:!1},n),zo(e,{writable:!1},n)}var Jn={exports:{}};Jn.exports;(function(e,t){var n=200,r="__lodash_hash_undefined__",i=800,o=16,s=9007199254740991,a="[object Arguments]",f="[object Array]",u="[object AsyncFunction]",g="[object Boolean]",p="[object Date]",v="[object Error]",S="[object Function]",R="[object GeneratorFunction]",h="[object Map]",w="[object Number]",y="[object Null]",x="[object Object]",m="[object Proxy]",j="[object RegExp]",P="[object Set]",B="[object String]",H="[object Undefined]",k="[object WeakMap]",Q="[object ArrayBuffer]",Z="[object DataView]",D="[object Float32Array]",$="[object Float64Array]",T="[object Int8Array]",te="[object Int16Array]",I="[object Int32Array]",C="[object Uint8Array]",F="[object Uint8ClampedArray]",K="[object Uint16Array]",V="[object Uint32Array]",ee=/[\\^$.*+?()[\]{}|]/g,J=/^\[object .+?Constructor\]$/,ue=/^(?:0|[1-9]\d*)$/,M={};M[D]=M[$]=M[T]=M[te]=M[I]=M[C]=M[F]=M[K]=M[V]=!0,M[a]=M[f]=M[Q]=M[g]=M[Z]=M[p]=M[v]=M[S]=M[h]=M[w]=M[x]=M[j]=M[P]=M[B]=M[k]=!1;var ne=typeof X.commonjsGlobal=="object"&&X.commonjsGlobal&&X.commonjsGlobal.Object===Object&&X.commonjsGlobal,pe=typeof self=="object"&&self&&self.Object===Object&&self,we=ne||pe||Function("return this")(),ye=t&&!t.nodeType&&t,ve=ye&&!0&&e&&!e.nodeType&&e,Ae=ve&&ve.exports===ye,xe=Ae&&ne.process,Ue=function(){try{var d=ve&&ve.require&&ve.require("util").types;return d||xe&&xe.binding&&xe.binding("util")}catch{}}(),Re=Ue&&Ue.isTypedArray;function _(d,b,A){switch(A.length){case 0:return d.call(b);case 1:return d.call(b,A[0]);case 2:return d.call(b,A[0],A[1]);case 3:return d.call(b,A[0],A[1],A[2])}return d.apply(b,A)}function E(d,b){for(var A=-1,q=Array(d);++A<d;)q[A]=b(A);return q}function O(d){return function(b){return d(b)}}function W(d,b){return d==null?void 0:d[b]}function z(d,b){return function(A){return d(b(A))}}var se=Array.prototype,de=Function.prototype,ie=Object.prototype,Le=we["__core-js_shared__"],Y=de.toString,Ee=ie.hasOwnProperty,Mt=function(){var d=/[^.]+$/.exec(Le&&Le.keys&&Le.keys.IE_PROTO||"");return d?"Symbol(src)_1."+d:""}(),En=ie.toString,wr=Y.call(Object),Sn=RegExp("^"+Y.call(Ee).replace(ee,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Bt=Ae?we.Buffer:void 0,bt=we.Symbol,Yt=we.Uint8Array;Bt&&Bt.allocUnsafe;var wt=z(Object.getPrototypeOf,Object),vn=Object.create,yr=ie.propertyIsEnumerable,An=se.splice,Je=bt?bt.toStringTag:void 0,Dt=function(){try{var d=Ar(Object,"defineProperty");return d({},"",{}),d}catch{}}(),_r=Bt?Bt.isBuffer:void 0,Zt=Math.max,Rn=Date.now,In=Ar(we,"Map"),lt=Ar(Object,"create"),Jt=function(){function d(){}return function(b){if(!_t(b))return{};if(vn)return vn(b);d.prototype=b;var A=new d;return d.prototype=void 0,A}}();function Xe(d){var b=-1,A=d==null?0:d.length;for(this.clear();++b<A;){var q=d[b];this.set(q[0],q[1])}}function mr(){this.__data__=lt?lt(null):{},this.size=0}function Xt(d){var b=this.has(d)&&delete this.__data__[d];return this.size-=b?1:0,b}function Tn(d){var b=this.__data__;if(lt){var A=b[d];return A===r?void 0:A}return Ee.call(b,d)?b[d]:void 0}function l(d){var b=this.__data__;return lt?b[d]!==void 0:Ee.call(b,d)}function c(d,b){var A=this.__data__;return this.size+=this.has(d)?0:1,A[d]=lt&&b===void 0?r:b,this}Xe.prototype.clear=mr,Xe.prototype.delete=Xt,Xe.prototype.get=Tn,Xe.prototype.has=l,Xe.prototype.set=c;function N(d){var b=-1,A=d==null?0:d.length;for(this.clear();++b<A;){var q=d[b];this.set(q[0],q[1])}}function L(){this.__data__=[],this.size=0}function U(d){var b=this.__data__,A=Pn(b,d);if(A<0)return!1;var q=b.length-1;return A==q?b.pop():An.call(b,A,1),--this.size,!0}function _e(d){var b=this.__data__,A=Pn(b,d);return A<0?void 0:b[A][1]}function Oe(d){return Pn(this.__data__,d)>-1}function xn(d,b){var A=this.__data__,q=Pn(A,d);return q<0?(++this.size,A.push([d,b])):A[q][1]=b,this}N.prototype.clear=L,N.prototype.delete=U,N.prototype.get=_e,N.prototype.has=Oe,N.prototype.set=xn;function Ce(d){var b=-1,A=d==null?0:d.length;for(this.clear();++b<A;){var q=d[b];this.set(q[0],q[1])}}function On(){this.size=0,this.__data__={hash:new Xe,map:new(In||N),string:new Xe}}function Er(d){var b=Mn(this,d).delete(d);return this.size-=b?1:0,b}function Cn(d){return Mn(this,d).get(d)}function Nn(d){return Mn(this,d).has(d)}function Qt(d,b){var A=Mn(this,d),q=A.size;return A.set(d,b),this.size+=A.size==q?0:1,this}Ce.prototype.clear=On,Ce.prototype.delete=Er,Ce.prototype.get=Cn,Ce.prototype.has=Nn,Ce.prototype.set=Qt;function ze(d){var b=this.__data__=new N(d);this.size=b.size}function en(){this.__data__=new N,this.size=0}function yt(d){var b=this.__data__,A=b.delete(d);return this.size=b.size,A}function Qe(d){return this.__data__.get(d)}function Fe(d){return this.__data__.has(d)}function ja(d,b){var A=this.__data__;if(A instanceof N){var q=A.__data__;if(!In||q.length<n-1)return q.push([d,b]),this.size=++A.size,this;A=this.__data__=new Ce(q)}return A.set(d,b),this.size=A.size,this}ze.prototype.clear=en,ze.prototype.delete=yt,ze.prototype.get=Qe,ze.prototype.has=Fe,ze.prototype.set=ja;function ka(d,b){var A=Tr(d),q=!A&&Ir(d),re=!A&&!q&&Zi(d),ae=!A&&!q&&!re&&Xi(d),ce=A||q||re||ae,oe=ce?E(d.length,String):[],he=oe.length;for(var qe in d)ce&&(qe=="length"||re&&(qe=="offset"||qe=="parent")||ae&&(qe=="buffer"||qe=="byteLength"||qe=="byteOffset")||Ki(qe,he))||oe.push(qe);return oe}function Sr(d,b,A){(A!==void 0&&!Bn(d[b],A)||A===void 0&&!(b in d))&&vr(d,b,A)}function Wa(d,b,A){var q=d[b];(!(Ee.call(d,b)&&Bn(q,A))||A===void 0&&!(b in d))&&vr(d,b,A)}function Pn(d,b){for(var A=d.length;A--;)if(Bn(d[A][0],b))return A;return-1}function vr(d,b,A){b=="__proto__"&&Dt?Dt(d,b,{configurable:!0,enumerable:!0,value:A,writable:!0}):d[b]=A}var Ua=el();function Ln(d){return d==null?d===void 0?H:y:Je&&Je in Object(d)?tl(d):al(d)}function Gi(d){return tn(d)&&Ln(d)==a}function Fa(d){if(!_t(d)||ol(d))return!1;var b=Or(d)?Sn:J;return b.test(dl(d))}function qa(d){return tn(d)&&Ji(d.length)&&!!M[Ln(d)]}function Ha(d){if(!_t(d))return sl(d);var b=Yi(d),A=[];for(var q in d)q=="constructor"&&(b||!Ee.call(d,q))||A.push(q);return A}function Vi(d,b,A,q,re){d!==b&&Ua(b,function(ae,ce){if(re||(re=new ze),_t(ae))za(d,b,ce,A,Vi,q,re);else{var oe=q?q(Rr(d,ce),ae,ce+"",d,b,re):void 0;oe===void 0&&(oe=ae),Sr(d,ce,oe)}},Qi)}function za(d,b,A,q,re,ae,ce){var oe=Rr(d,A),he=Rr(b,A),qe=ce.get(he);if(qe){Sr(d,A,qe);return}var Me=ae?ae(oe,he,A+"",d,b,ce):void 0,nn=Me===void 0;if(nn){var Cr=Tr(he),Nr=!Cr&&Zi(he),to=!Cr&&!Nr&&Xi(he);Me=he,Cr||Nr||to?Tr(oe)?Me=oe:cl(oe)?Me=Ja(oe):Nr?(nn=!1,Me=Ka(he)):to?(nn=!1,Me=Za(he)):Me=[]:hl(he)||Ir(he)?(Me=oe,Ir(oe)?Me=gl(oe):(!_t(oe)||Or(oe))&&(Me=nl(he))):nn=!1}nn&&(ce.set(he,Me),re(Me,he,q,ae,ce),ce.delete(he)),Sr(d,A,Me)}function Ga(d,b){return ul(ll(d,b,eo),d+"")}var Va=Dt?function(d,b){return Dt(d,"toString",{configurable:!0,enumerable:!1,value:bl(b),writable:!0})}:eo;function Ka(d,b){return d.slice()}function Ya(d){var b=new d.constructor(d.byteLength);return new Yt(b).set(new Yt(d)),b}function Za(d,b){var A=Ya(d.buffer);return new d.constructor(A,d.byteOffset,d.length)}function Ja(d,b){var A=-1,q=d.length;for(b||(b=Array(q));++A<q;)b[A]=d[A];return b}function Xa(d,b,A,q){var re=!A;A||(A={});for(var ae=-1,ce=b.length;++ae<ce;){var oe=b[ae],he=void 0;he===void 0&&(he=d[oe]),re?vr(A,oe,he):Wa(A,oe,he)}return A}function Qa(d){return Ga(function(b,A){var q=-1,re=A.length,ae=re>1?A[re-1]:void 0,ce=re>2?A[2]:void 0;for(ae=d.length>3&&typeof ae=="function"?(re--,ae):void 0,ce&&rl(A[0],A[1],ce)&&(ae=re<3?void 0:ae,re=1),b=Object(b);++q<re;){var oe=A[q];oe&&d(b,oe,q,ae)}return b})}function el(d){return function(b,A,q){for(var re=-1,ae=Object(b),ce=q(b),oe=ce.length;oe--;){var he=ce[++re];if(A(ae[he],he,ae)===!1)break}return b}}function Mn(d,b){var A=d.__data__;return il(b)?A[typeof b=="string"?"string":"hash"]:A.map}function Ar(d,b){var A=W(d,b);return Fa(A)?A:void 0}function tl(d){var b=Ee.call(d,Je),A=d[Je];try{d[Je]=void 0;var q=!0}catch{}var re=En.call(d);return q&&(b?d[Je]=A:delete d[Je]),re}function nl(d){return typeof d.constructor=="function"&&!Yi(d)?Jt(wt(d)):{}}function Ki(d,b){var A=typeof d;return b=b??s,!!b&&(A=="number"||A!="symbol"&&ue.test(d))&&d>-1&&d%1==0&&d<b}function rl(d,b,A){if(!_t(A))return!1;var q=typeof b;return(q=="number"?xr(A)&&Ki(b,A.length):q=="string"&&b in A)?Bn(A[b],d):!1}function il(d){var b=typeof d;return b=="string"||b=="number"||b=="symbol"||b=="boolean"?d!=="__proto__":d===null}function ol(d){return!!Mt&&Mt in d}function Yi(d){var b=d&&d.constructor,A=typeof b=="function"&&b.prototype||ie;return d===A}function sl(d){var b=[];if(d!=null)for(var A in Object(d))b.push(A);return b}function al(d){return En.call(d)}function ll(d,b,A){return b=Zt(b===void 0?d.length-1:b,0),function(){for(var q=arguments,re=-1,ae=Zt(q.length-b,0),ce=Array(ae);++re<ae;)ce[re]=q[b+re];re=-1;for(var oe=Array(b+1);++re<b;)oe[re]=q[re];return oe[b]=A(ce),_(d,this,oe)}}function Rr(d,b){if(!(b==="constructor"&&typeof d[b]=="function")&&b!="__proto__")return d[b]}var ul=fl(Va);function fl(d){var b=0,A=0;return function(){var q=Rn(),re=o-(q-A);if(A=q,re>0){if(++b>=i)return arguments[0]}else b=0;return d.apply(void 0,arguments)}}function dl(d){if(d!=null){try{return Y.call(d)}catch{}try{return d+""}catch{}}return""}function Bn(d,b){return d===b||d!==d&&b!==b}var Ir=Gi(function(){return arguments}())?Gi:function(d){return tn(d)&&Ee.call(d,"callee")&&!yr.call(d,"callee")},Tr=Array.isArray;function xr(d){return d!=null&&Ji(d.length)&&!Or(d)}function cl(d){return tn(d)&&xr(d)}var Zi=_r||wl;function Or(d){if(!_t(d))return!1;var b=Ln(d);return b==S||b==R||b==u||b==m}function Ji(d){return typeof d=="number"&&d>-1&&d%1==0&&d<=s}function _t(d){var b=typeof d;return d!=null&&(b=="object"||b=="function")}function tn(d){return d!=null&&typeof d=="object"}function hl(d){if(!tn(d)||Ln(d)!=x)return!1;var b=wt(d);if(b===null)return!0;var A=Ee.call(b,"constructor")&&b.constructor;return typeof A=="function"&&A instanceof A&&Y.call(A)==wr}var Xi=Re?O(Re):qa;function gl(d){return Xa(d,Qi(d))}function Qi(d){return xr(d)?ka(d):Ha(d)}var pl=Qa(function(d,b,A){Vi(d,b,A)});function bl(d){return function(){return d}}function eo(d){return d}function wl(){return!1}e.exports=pl})(Jn,Jn.exports);Jn.exports;var ya={exports:{}};(function(e){(function(t,n){e.exports?e.exports=n():t.log=n()})(X.commonjsGlobal,function(){var t=function(){},n="undefined",r=typeof window!==n&&typeof window.navigator!==n&&/Trident\/|MSIE /.test(window.navigator.userAgent),i=["trace","debug","info","warn","error"],o={},s=null;function a(h,w){var y=h[w];if(typeof y.bind=="function")return y.bind(h);try{return Function.prototype.bind.call(y,h)}catch{return function(){return Function.prototype.apply.apply(y,[h,arguments])}}}function f(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(h){return h==="debug"&&(h="log"),typeof console===n?!1:h==="trace"&&r?f:console[h]!==void 0?a(console,h):console.log!==void 0?a(console,"log"):t}function g(){for(var h=this.getLevel(),w=0;w<i.length;w++){var y=i[w];this[y]=w<h?t:this.methodFactory(y,h,this.name)}if(this.log=this.debug,typeof console===n&&h<this.levels.SILENT)return"No console available for logging"}function p(h){return function(){typeof console!==n&&(g.call(this),this[h].apply(this,arguments))}}function v(h,w,y){return u(h)||p.apply(this,arguments)}function S(h,w){var y=this,x,m,j,P="loglevel";typeof h=="string"?P+=":"+h:typeof h=="symbol"&&(P=void 0);function B(D){var $=(i[D]||"silent").toUpperCase();if(!(typeof window===n||!P)){try{window.localStorage[P]=$;return}catch{}try{window.document.cookie=encodeURIComponent(P)+"="+$+";"}catch{}}}function H(){var D;if(!(typeof window===n||!P)){try{D=window.localStorage[P]}catch{}if(typeof D===n)try{var $=window.document.cookie,T=encodeURIComponent(P),te=$.indexOf(T+"=");te!==-1&&(D=/^([^;]+)/.exec($.slice(te+T.length+1))[1])}catch{}return y.levels[D]===void 0&&(D=void 0),D}}function k(){if(!(typeof window===n||!P)){try{window.localStorage.removeItem(P)}catch{}try{window.document.cookie=encodeURIComponent(P)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function Q(D){var $=D;if(typeof $=="string"&&y.levels[$.toUpperCase()]!==void 0&&($=y.levels[$.toUpperCase()]),typeof $=="number"&&$>=0&&$<=y.levels.SILENT)return $;throw new TypeError("log.setLevel() called with invalid level: "+D)}y.name=h,y.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},y.methodFactory=w||v,y.getLevel=function(){return j??m??x},y.setLevel=function(D,$){return j=Q(D),$!==!1&&B(j),g.call(y)},y.setDefaultLevel=function(D){m=Q(D),H()||y.setLevel(D,!1)},y.resetLevel=function(){j=null,k(),g.call(y)},y.enableAll=function(D){y.setLevel(y.levels.TRACE,D)},y.disableAll=function(D){y.setLevel(y.levels.SILENT,D)},y.rebuild=function(){if(s!==y&&(x=Q(s.getLevel())),g.call(y),s===y)for(var D in o)o[D].rebuild()},x=Q(s?s.getLevel():"WARN");var Z=H();Z!=null&&(j=Q(Z)),g.call(y)}s=new S,s.getLogger=function(w){if(typeof w!="symbol"&&typeof w!="string"||w==="")throw new TypeError("You must supply a name when creating a logger.");var y=o[w];return y||(y=o[w]=new S(w,s.methodFactory)),y};var R=typeof window!==n?window.log:void 0;return s.noConflict=function(){return typeof window!==n&&window.log===s&&(window.log=R),s},s.getLoggers=function(){return o},s.default=s,s})})(ya);var _a=ya.exports;const Xn=X.getDefaultExportFromCjs(_a),qd=Xn.getLogger("http-helpers");qd.setLevel(_a.levels.INFO);function os(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`positive integer expected, not ${e}`)}function Hd(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function hr(e,...t){if(!Hd(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error(`Uint8Array expected of length ${t}, not of length=${e.length}`)}function zd(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");os(e.outputLen),os(e.blockLen)}function Qn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Gd(e,t){hr(e);const n=t.outputLen;if(e.length<n)throw new Error(`digestInto() expects output buffer of length at least ${n}`)}const Jr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Xr=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Ge=(e,t)=>e<<32-t|e>>>t;new Uint8Array(new Uint32Array([287454020]).buffer)[0];function Vd(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Di(e){return typeof e=="string"&&(e=Vd(e)),hr(e),e}function Kd(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];hr(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const o=e[r];n.set(o,i),i+=o.length}return n}class ma{clone(){return this._cloneInto()}}function Yd(e){const t=r=>e().update(Di(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Zd(e=32){if(Jr&&typeof Jr.getRandomValues=="function")return Jr.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}function Jd(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const i=BigInt(32),o=BigInt(4294967295),s=Number(n>>i&o),a=Number(n&o),f=r?4:0,u=r?0:4;e.setUint32(t+f,s,r),e.setUint32(t+u,a,r)}const Xd=(e,t,n)=>e&t^~e&n,Qd=(e,t,n)=>e&t^e&n^t&n;class ec extends ma{constructor(t,n,r,i){super(),this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Xr(this.buffer)}update(t){Qn(this);const{view:n,buffer:r,blockLen:i}=this;t=Di(t);const o=t.length;for(let s=0;s<o;){const a=Math.min(i-this.pos,o-s);if(a===i){const f=Xr(t);for(;i<=o-s;s+=i)this.process(f,s);continue}r.set(t.subarray(s,s+a),this.pos),this.pos+=a,s+=a,this.pos===i&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){Qn(this),Gd(t,this),this.finished=!0;const{buffer:n,view:r,blockLen:i,isLE:o}=this;let{pos:s}=this;n[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let p=s;p<i;p++)n[p]=0;Jd(r,i-8,BigInt(this.length*8),o),this.process(r,0);const a=Xr(t),f=this.outputLen;if(f%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const u=f/4,g=this.get();if(u>g.length)throw new Error("_sha2: outputLen bigger than state");for(let p=0;p<u;p++)a.setUint32(4*p,g[p],o)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:i,finished:o,destroyed:s,pos:a}=this;return t.length=i,t.pos=a,t.finished=o,t.destroyed=s,i%n&&t.buffer.set(r),t}}const tc=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]),ut=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ft=new Uint32Array(64);class nc extends ec{constructor(){super(64,32,8,!1),this.A=ut[0]|0,this.B=ut[1]|0,this.C=ut[2]|0,this.D=ut[3]|0,this.E=ut[4]|0,this.F=ut[5]|0,this.G=ut[6]|0,this.H=ut[7]|0}get(){const{A:t,B:n,C:r,D:i,E:o,F:s,G:a,H:f}=this;return[t,n,r,i,o,s,a,f]}set(t,n,r,i,o,s,a,f){this.A=t|0,this.B=n|0,this.C=r|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=f|0}process(t,n){for(let p=0;p<16;p++,n+=4)ft[p]=t.getUint32(n,!1);for(let p=16;p<64;p++){const v=ft[p-15],S=ft[p-2],R=Ge(v,7)^Ge(v,18)^v>>>3,h=Ge(S,17)^Ge(S,19)^S>>>10;ft[p]=h+ft[p-7]+R+ft[p-16]|0}let{A:r,B:i,C:o,D:s,E:a,F:f,G:u,H:g}=this;for(let p=0;p<64;p++){const v=Ge(a,6)^Ge(a,11)^Ge(a,25),S=g+v+Xd(a,f,u)+tc[p]+ft[p]|0,h=(Ge(r,2)^Ge(r,13)^Ge(r,22))+Qd(r,i,o)|0;g=u,u=f,f=a,a=s+S|0,s=o,o=i,i=r,r=S+h|0}r=r+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,f=f+this.F|0,u=u+this.G|0,g=g+this.H|0,this.set(r,i,o,s,a,f,u,g)}roundClean(){ft.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}const rc=Yd(()=>new nc);class Ea extends ma{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,zd(t);const r=Di(n);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,o=new Uint8Array(i);o.set(r.length>i?t.create().update(r).digest():r);for(let s=0;s<o.length;s++)o[s]^=54;this.iHash.update(o),this.oHash=t.create();for(let s=0;s<o.length;s++)o[s]^=106;this.oHash.update(o),o.fill(0)}update(t){return Qn(this),this.iHash.update(t),this}digestInto(t){Qn(this),hr(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:n,iHash:r,finished:i,destroyed:o,blockLen:s,outputLen:a}=this;return t=t,t.finished=i,t.destroyed=o,t.blockLen=s,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Sa=(e,t,n)=>new Ea(e,t).update(n).digest();Sa.create=(e,t)=>new Ea(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const va=BigInt(0),gr=BigInt(1),ic=BigInt(2);function Ot(e){return e instanceof Uint8Array||e!=null&&typeof e=="object"&&e.constructor.name==="Uint8Array"}function wn(e){if(!Ot(e))throw new Error("Uint8Array expected")}const oc=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ht(e){wn(e);let t="";for(let n=0;n<e.length;n++)t+=oc[e[n]];return t}function Aa(e){const t=e.toString(16);return t.length&1?`0${t}`:t}function $i(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return BigInt(e===""?"0":`0x${e}`)}const et={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function ss(e){if(e>=et._0&&e<=et._9)return e-et._0;if(e>=et._A&&e<=et._F)return e-(et._A-10);if(e>=et._a&&e<=et._f)return e-(et._a-10)}function zt(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let i=0,o=0;i<n;i++,o+=2){const s=ss(e.charCodeAt(o)),a=ss(e.charCodeAt(o+1));if(s===void 0||a===void 0){const f=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+f+'" at index '+o)}r[i]=s*16+a}return r}function It(e){return $i(Ht(e))}function ji(e){return wn(e),$i(Ht(Uint8Array.from(e).reverse()))}function Gt(e,t){return zt(e.toString(16).padStart(t*2,"0"))}function ki(e,t){return Gt(e,t).reverse()}function sc(e){return zt(Aa(e))}function He(e,t,n){let r;if(typeof t=="string")try{r=zt(t)}catch(o){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${o}`)}else if(Ot(t))r=Uint8Array.from(t);else throw new Error(`${e} must be hex string or Uint8Array`);const i=r.length;if(typeof n=="number"&&i!==n)throw new Error(`${e} expected ${n} bytes, got ${i}`);return r}function gn(...e){let t=0;for(let r=0;r<e.length;r++){const i=e[r];wn(i),t+=i.length}const n=new Uint8Array(t);for(let r=0,i=0;r<e.length;r++){const o=e[r];n.set(o,i),i+=o.length}return n}function ac(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function lc(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function uc(e){let t;for(t=0;e>va;e>>=gr,t+=1);return t}function fc(e,t){return e>>BigInt(t)&gr}function dc(e,t,n){return e|(n?gr:va)<<BigInt(t)}const Wi=e=>(ic<<BigInt(e-1))-gr,Qr=e=>new Uint8Array(e),as=e=>Uint8Array.from(e);function Ra(e,t,n){if(typeof e!="number"||e<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 n!="function")throw new Error("hmacFn must be a function");let r=Qr(e),i=Qr(e),o=0;const s=()=>{r.fill(1),i.fill(0),o=0},a=(...p)=>n(i,r,...p),f=(p=Qr())=>{i=a(as([0]),p),r=a(),p.length!==0&&(i=a(as([1]),p),r=a())},u=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let p=0;const v=[];for(;p<t;){r=a();const S=r.slice();v.push(S),p+=r.length}return gn(...v)};return(p,v)=>{s(),f(p);let S;for(;!(S=v(u()));)f();return s(),S}}const cc={bigint:e=>typeof e=="bigint",function:e=>typeof e=="function",boolean:e=>typeof e=="boolean",string:e=>typeof e=="string",stringOrUint8Array:e=>typeof e=="string"||Ot(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e=="function"&&Number.isSafeInteger(e.outputLen)};function yn(e,t,n={}){const r=(i,o,s)=>{const a=cc[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);const f=e[i];if(!(s&&f===void 0)&&!a(f,e))throw new Error(`Invalid param ${String(i)}=${f} (${typeof f}), expected ${o}`)};for(const[i,o]of Object.entries(t))r(i,o,!1);for(const[i,o]of Object.entries(n))r(i,o,!0);return e}const hc=Object.freeze(Object.defineProperty({__proto__:null,abytes:wn,bitGet:fc,bitLen:uc,bitMask:Wi,bitSet:dc,bytesToHex:Ht,bytesToNumberBE:It,bytesToNumberLE:ji,concatBytes:gn,createHmacDrbg:Ra,ensureBytes:He,equalBytes:ac,hexToBytes:zt,hexToNumber:$i,isBytes:Ot,numberToBytesBE:Gt,numberToBytesLE:ki,numberToHexUnpadded:Aa,numberToVarBytesBE:sc,utf8ToBytes:lc,validateObject:yn},Symbol.toStringTag,{value:"Module"}));/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const me=BigInt(0),be=BigInt(1),St=BigInt(2),gc=BigInt(3),pi=BigInt(4),ls=BigInt(5),us=BigInt(8);BigInt(9);BigInt(16);function Ne(e,t){const n=e%t;return n>=me?n:t+n}function pc(e,t,n){if(n<=me||t<me)throw new Error("Expected power/modulo > 0");if(n===be)return me;let r=be;for(;t>me;)t&be&&(r=r*e%n),e=e*e%n,t>>=be;return r}function De(e,t,n){let r=e;for(;t-- >me;)r*=r,r%=n;return r}function bi(e,t){if(e===me||t<=me)throw new Error(`invert: expected positive integers, got n=${e} mod=${t}`);let n=Ne(e,t),r=t,i=me,o=be;for(;n!==me;){const a=r/n,f=r%n,u=i-o*a;r=n,n=f,i=o,o=u}if(r!==be)throw new Error("invert: does not exist");return Ne(i,t)}function bc(e){const t=(e-be)/St;let n,r,i;for(n=e-be,r=0;n%St===me;n/=St,r++);for(i=St;i<e&&pc(i,t,e)!==e-be;i++);if(r===1){const s=(e+be)/pi;return function(f,u){const g=f.pow(u,s);if(!f.eql(f.sqr(g),u))throw new Error("Cannot find square root");return g}}const o=(n+be)/St;return function(a,f){if(a.pow(f,t)===a.neg(a.ONE))throw new Error("Cannot find square root");let u=r,g=a.pow(a.mul(a.ONE,i),n),p=a.pow(f,o),v=a.pow(f,n);for(;!a.eql(v,a.ONE);){if(a.eql(v,a.ZERO))return a.ZERO;let S=1;for(let h=a.sqr(v);S<u&&!a.eql(h,a.ONE);S++)h=a.sqr(h);const R=a.pow(g,be<<BigInt(u-S-1));g=a.sqr(R),p=a.mul(p,R),v=a.mul(v,g),u=S}return p}}function wc(e){if(e%pi===gc){const t=(e+be)/pi;return function(r,i){const o=r.pow(i,t);if(!r.eql(r.sqr(o),i))throw new Error("Cannot find square root");return o}}if(e%us===ls){const t=(e-ls)/us;return function(r,i){const o=r.mul(i,St),s=r.pow(o,t),a=r.mul(i,s),f=r.mul(r.mul(a,St),s),u=r.mul(a,r.sub(f,r.ONE));if(!r.eql(r.sqr(u),i))throw new Error("Cannot find square root");return u}}return bc(e)}const yc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function _c(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},n=yc.reduce((r,i)=>(r[i]="function",r),t);return yn(e,n)}function mc(e,t,n){if(n<me)throw new Error("Expected power > 0");if(n===me)return e.ONE;if(n===be)return t;let r=e.ONE,i=t;for(;n>me;)n&be&&(r=e.mul(r,i)),i=e.sqr(i),n>>=be;return r}function Ec(e,t){const n=new Array(t.length),r=t.reduce((o,s,a)=>e.is0(s)?o:(n[a]=o,e.mul(o,s)),e.ONE),i=e.inv(r);return t.reduceRight((o,s,a)=>e.is0(s)?o:(n[a]=e.mul(o,n[a]),e.mul(o,s)),i),n}function Ia(e,t){const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function Sc(e,t,n=!1,r={}){if(e<=me)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:i,nByteLength:o}=Ia(e,t);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=wc(e),a=Object.freeze({ORDER:e,BITS:i,BYTES:o,MASK:Wi(i),ZERO:me,ONE:be,create:f=>Ne(f,e),isValid:f=>{if(typeof f!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof f}`);return me<=f&&f<e},is0:f=>f===me,isOdd:f=>(f&be)===be,neg:f=>Ne(-f,e),eql:(f,u)=>f===u,sqr:f=>Ne(f*f,e),add:(f,u)=>Ne(f+u,e),sub:(f,u)=>Ne(f-u,e),mul:(f,u)=>Ne(f*u,e),pow:(f,u)=>mc(a,f,u),div:(f,u)=>Ne(f*bi(u,e),e),sqrN:f=>f*f,addN:(f,u)=>f+u,subN:(f,u)=>f-u,mulN:(f,u)=>f*u,inv:f=>bi(f,e),sqrt:r.sqrt||(f=>s(a,f)),invertBatch:f=>Ec(a,f),cmov:(f,u,g)=>g?u:f,toBytes:f=>n?ki(f,o):Gt(f,o),fromBytes:f=>{if(f.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${f.length}`);return n?ji(f):It(f)}});return Object.freeze(a)}function Ta(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function xa(e){const t=Ta(e);return t+Math.ceil(t/2)}function vc(e,t,n=!1){const r=e.length,i=Ta(t),o=xa(t);if(r<16||r<o||r>1024)throw new Error(`expected ${o}-1024 bytes of input, got ${r}`);const s=n?It(e):ji(e),a=Ne(s,t-be)+be;return n?ki(a,i):Gt(a,i)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ac=BigInt(0),ei=BigInt(1);function Rc(e,t){const n=(i,o)=>{const s=o.negate();return i?s:o},r=i=>{const o=Math.ceil(t/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:n,unsafeLadder(i,o){let s=e.ZERO,a=i;for(;o>Ac;)o&ei&&(s=s.add(a)),a=a.double(),o>>=ei;return s},precomputeWindow(i,o){const{windows:s,windowSize:a}=r(o),f=[];let u=i,g=u;for(let p=0;p<s;p++){g=u,f.push(g);for(let v=1;v<a;v++)g=g.add(u),f.push(g);u=g.double()}return f},wNAF(i,o,s){const{windows:a,windowSize:f}=r(i);let u=e.ZERO,g=e.BASE;const p=BigInt(2**i-1),v=2**i,S=BigInt(i);for(let R=0;R<a;R++){const h=R*f;let w=Number(s&p);s>>=S,w>f&&(w-=v,s+=ei);const y=h,x=h+Math.abs(w)-1,m=R%2!==0,j=w<0;w===0?g=g.add(n(m,o[y])):u=u.add(n(j,o[x]))}return{p:u,f:g}},wNAFCached(i,o,s,a){const f=i._WINDOW_SIZE||1;let u=o.get(i);return u||(u=this.precomputeWindow(i,f),f!==1&&o.set(i,a(u))),this.wNAF(f,u,s)}}}function Oa(e){return _c(e.Fp),yn(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ia(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ic(e){const t=Oa(e);yn(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});const{endo:n,Fp:r,a:i}=t;if(n){if(!r.eql(i,r.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof n!="object"||typeof n.beta!="bigint"||typeof n.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}const{bytesToNumberBE:Tc,hexToBytes:xc}=hc,At={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(e){const{Err:t}=At;if(e.length<2||e[0]!==2)throw new t("Invalid signature integer tag");const n=e[1],r=e.subarray(2,n+2);if(!n||r.length!==n)throw new t("Invalid signature integer: wrong length");if(r[0]&128)throw new t("Invalid signature integer: negative");if(r[0]===0&&!(r[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:Tc(r),l:e.subarray(n+2)}},toSig(e){const{Err:t}=At,n=typeof e=="string"?xc(e):e;wn(n);let r=n.length;if(r<2||n[0]!=48)throw new t("Invalid signature tag");if(n[1]!==r-2)throw new t("Invalid signature: incorrect length");const{d:i,l:o}=At._parseInt(n.subarray(2)),{d:s,l:a}=At._parseInt(o);if(a.length)throw new t("Invalid signature: left bytes after parsing");return{r:i,s}},hexFromSig(e){const t=u=>Number.parseInt(u[0],16)&8?"00"+u:u,n=u=>{const g=u.toString(16);return g.length&1?`0${g}`:g},r=t(n(e.s)),i=t(n(e.r)),o=r.length/2,s=i.length/2,a=n(o),f=n(s);return`30${n(s+o+4)}02${f}${i}02${a}${r}`}},nt=BigInt(0),$e=BigInt(1);BigInt(2);const fs=BigInt(3);BigInt(4);function Oc(e){const t=Ic(e),{Fp:n}=t,r=t.toBytes||((R,h,w)=>{const y=h.toAffine();return gn(Uint8Array.from([4]),n.toBytes(y.x),n.toBytes(y.y))}),i=t.fromBytes||(R=>{const h=R.subarray(1),w=n.fromBytes(h.subarray(0,n.BYTES)),y=n.fromBytes(h.subarray(n.BYTES,2*n.BYTES));return{x:w,y}});function o(R){const{a:h,b:w}=t,y=n.sqr(R),x=n.mul(y,R);return n.add(n.add(x,n.mul(R,h)),w)}if(!n.eql(n.sqr(t.Gy),o(t.Gx)))throw new Error("bad generator point: equation left != right");function s(R){return typeof R=="bigint"&&nt<R&&R<t.n}function a(R){if(!s(R))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function f(R){const{allowedPrivateKeyLengths:h,nByteLength:w,wrapPrivateKey:y,n:x}=t;if(h&&typeof R!="bigint"){if(Ot(R)&&(R=Ht(R)),typeof R!="string"||!h.includes(R.length))throw new Error("Invalid key");R=R.padStart(w*2,"0")}let m;try{m=typeof R=="bigint"?R:It(He("private key",R,w))}catch{throw new Error(`private key must be ${w} bytes, hex or bigint, not ${typeof R}`)}return y&&(m=Ne(m,x)),a(m),m}const u=new Map;function g(R){if(!(R instanceof p))throw new Error("ProjectivePoint expected")}class p{constructor(h,w,y){if(this.px=h,this.py=w,this.pz=y,h==null||!n.isValid(h))throw new Error("x required");if(w==null||!n.isValid(w))throw new Error("y required");if(y==null||!n.isValid(y))throw new Error("z required")}static fromAffine(h){const{x:w,y}=h||{};if(!h||!n.isValid(w)||!n.isValid(y))throw new Error("invalid affine point");if(h instanceof p)throw new Error("projective point not allowed");const x=m=>n.eql(m,n.ZERO);return x(w)&&x(y)?p.ZERO:new p(w,y,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(h){const w=n.invertBatch(h.map(y=>y.pz));return h.map((y,x)=>y.toAffine(w[x])).map(p.fromAffine)}static fromHex(h){const w=p.fromAffine(i(He("pointHex",h)));return w.assertValidity(),w}static fromPrivateKey(h){return p.BASE.multiply(f(h))}_setWindowSize(h){this._WINDOW_SIZE=h,u.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!n.is0(this.py))return;throw new Error("bad point: ZERO")}const{x:h,y:w}=this.toAffine();if(!n.isValid(h)||!n.isValid(w))throw new Error("bad point: x or y not FE");const y=n.sqr(w),x=o(h);if(!n.eql(y,x))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){const{y:h}=this.toAffine();if(n.isOdd)return!n.isOdd(h);throw new Error("Field doesn't support isOdd")}equals(h){g(h);const{px:w,py:y,pz:x}=this,{px:m,py:j,pz:P}=h,B=n.eql(n.mul(w,P),n.mul(m,x)),H=n.eql(n.mul(y,P),n.mul(j,x));return B&&H}negate(){return new p(this.px,n.neg(this.py),this.pz)}double(){const{a:h,b:w}=t,y=n.mul(w,fs),{px:x,py:m,pz:j}=this;let P=n.ZERO,B=n.ZERO,H=n.ZERO,k=n.mul(x,x),Q=n.mul(m,m),Z=n.mul(j,j),D=n.mul(x,m);return D=n.add(D,D),H=n.mul(x,j),H=n.add(H,H),P=n.mul(h,H),B=n.mul(y,Z),B=n.add(P,B),P=n.sub(Q,B),B=n.add(Q,B),B=n.mul(P,B),P=n.mul(D,P),H=n.mul(y,H),Z=n.mul(h,Z),D=n.sub(k,Z),D=n.mul(h,D),D=n.add(D,H),H=n.add(k,k),k=n.add(H,k),k=n.add(k,Z),k=n.mul(k,D),B=n.add(B,k),Z=n.mul(m,j),Z=n.add(Z,Z),k=n.mul(Z,D),P=n.sub(P,k),H=n.mul(Z,Q),H=n.add(H,H),H=n.add(H,H),new p(P,B,H)}add(h){g(h);const{px:w,py:y,pz:x}=this,{px:m,py:j,pz:P}=h;let B=n.ZERO,H=n.ZERO,k=n.ZERO;const Q=t.a,Z=n.mul(t.b,fs);let D=n.mul(w,m),$=n.mul(y,j),T=n.mul(x,P),te=n.add(w,y),I=n.add(m,j);te=n.mul(te,I),I=n.add(D,$),te=n.sub(te,I),I=n.add(w,x);let C=n.add(m,P);return I=n.mul(I,C),C=n.add(D,T),I=n.sub(I,C),C=n.add(y,x),B=n.add(j,P),C=n.mul(C,B),B=n.add($,T),C=n.sub(C,B),k=n.mul(Q,I),B=n.mul(Z,T),k=n.add(B,k),B=n.sub($,k),k=n.add($,k),H=n.mul(B,k),$=n.add(D,D),$=n.add($,D),T=n.mul(Q,T),I=n.mul(Z,I),$=n.add($,T),T=n.sub(D,T),T=n.mul(Q,T),I=n.add(I,T),D=n.mul($,I),H=n.add(H,D),D=n.mul(C,I),B=n.mul(te,B),B=n.sub(B,D),D=n.mul(te,$),k=n.mul(C,k),k=n.add(k,D),new p(B,H,k)}subtract(h){return this.add(h.negate())}is0(){return this.equals(p.ZERO)}wNAF(h){return S.wNAFCached(this,u,h,w=>{const y=n.invertBatch(w.map(x=>x.pz));return w.map((x,m)=>x.toAffine(y[m])).map(p.fromAffine)})}multiplyUnsafe(h){const w=p.ZERO;if(h===nt)return w;if(a(h),h===$e)return this;const{endo:y}=t;if(!y)return S.unsafeLadder(this,h);let{k1neg:x,k1:m,k2neg:j,k2:P}=y.splitScalar(h),B=w,H=w,k=this;for(;m>nt||P>nt;)m&$e&&(B=B.add(k)),P&$e&&(H=H.add(k)),k=k.double(),m>>=$e,P>>=$e;return x&&(B=B.negate()),j&&(H=H.negate()),H=new p(n.mul(H.px,y.beta),H.py,H.pz),B.add(H)}multiply(h){a(h);let w=h,y,x;const{endo:m}=t;if(m){const{k1neg:j,k1:P,k2neg:B,k2:H}=m.splitScalar(w);let{p:k,f:Q}=this.wNAF(P),{p:Z,f:D}=this.wNAF(H);k=S.constTimeNegate(j,k),Z=S.constTimeNegate(B,Z),Z=new p(n.mul(Z.px,m.beta),Z.py,Z.pz),y=k.add(Z),x=Q.add(D)}else{const{p:j,f:P}=this.wNAF(w);y=j,x=P}return p.normalizeZ([y,x])[0]}multiplyAndAddUnsafe(h,w,y){const x=p.BASE,m=(P,B)=>B===nt||B===$e||!P.equals(x)?P.multiplyUnsafe(B):P.multiply(B),j=m(this,w).add(m(h,y));return j.is0()?void 0:j}toAffine(h){const{px:w,py:y,pz:x}=this,m=this.is0();h==null&&(h=m?n.ONE:n.inv(x));const j=n.mul(w,h),P=n.mul(y,h),B=n.mul(x,h);if(m)return{x:n.ZERO,y:n.ZERO};if(!n.eql(B,n.ONE))throw new Error("invZ was invalid");return{x:j,y:P}}isTorsionFree(){const{h,isTorsionFree:w}=t;if(h===$e)return!0;if(w)return w(p,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h,clearCofactor:w}=t;return h===$e?this:w?w(p,this):this.multiplyUnsafe(t.h)}toRawBytes(h=!0){return this.assertValidity(),r(p,this,h)}toHex(h=!0){return Ht(this.toRawBytes(h))}}p.BASE=new p(t.Gx,t.Gy,n.ONE),p.ZERO=new p(n.ZERO,n.ONE,n.ZERO);const v=t.nBitLength,S=Rc(p,t.endo?Math.ceil(v/2):v);return{CURVE:t,ProjectivePoint:p,normPrivateKeyToScalar:f,weierstrassEquation:o,isWithinCurveOrder:s}}function Cc(e){const t=Oa(e);return yn(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Nc(e){const t=Cc(e),{Fp:n,n:r}=t,i=n.BYTES+1,o=2*n.BYTES+1;function s(I){return nt<I&&I<n.ORDER}function a(I){return Ne(I,r)}function f(I){return bi(I,r)}const{ProjectivePoint:u,normPrivateKeyToScalar:g,weierstrassEquation:p,isWithinCurveOrder:v}=Oc({...t,toBytes(I,C,F){const K=C.toAffine(),V=n.toBytes(K.x),ee=gn;return F?ee(Uint8Array.from([C.hasEvenY()?2:3]),V):ee(Uint8Array.from([4]),V,n.toBytes(K.y))},fromBytes(I){const C=I.length,F=I[0],K=I.subarray(1);if(C===i&&(F===2||F===3)){const V=It(K);if(!s(V))throw new Error("Point is not on curve");const ee=p(V);let J;try{J=n.sqrt(ee)}catch(ne){const pe=ne instanceof Error?": "+ne.message:"";throw new Error("Point is not on curve"+pe)}const ue=(J&$e)===$e;return(F&1)===1!==ue&&(J=n.neg(J)),{x:V,y:J}}else if(C===o&&F===4){const V=n.fromBytes(K.subarray(0,n.BYTES)),ee=n.fromBytes(K.subarray(n.BYTES,2*n.BYTES));return{x:V,y:ee}}else throw new Error(`Point of length ${C} was invalid. Expected ${i} compressed bytes or ${o} uncompressed bytes`)}}),S=I=>Ht(Gt(I,t.nByteLength));function R(I){const C=r>>$e;return I>C}function h(I){return R(I)?a(-I):I}const w=(I,C,F)=>It(I.slice(C,F));class y{constructor(C,F,K){this.r=C,this.s=F,this.recovery=K,this.assertValidity()}static fromCompact(C){const F=t.nByteLength;return C=He("compactSignature",C,F*2),new y(w(C,0,F),w(C,F,2*F))}static fromDER(C){const{r:F,s:K}=At.toSig(He("DER",C));return new y(F,K)}assertValidity(){if(!v(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!v(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(C){return new y(this.r,this.s,C)}recoverPublicKey(C){const{r:F,s:K,recovery:V}=this,ee=H(He("msgHash",C));if(V==null||![0,1,2,3].includes(V))throw new Error("recovery id invalid");const J=V===2||V===3?F+t.n:F;if(J>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const ue=V&1?"03":"02",M=u.fromHex(ue+S(J)),ne=f(J),pe=a(-ee*ne),we=a(K*ne),ye=u.BASE.multiplyAndAddUnsafe(M,pe,we);if(!ye)throw new Error("point at infinify");return ye.assertValidity(),ye}hasHighS(){return R(this.s)}normalizeS(){return this.hasHighS()?new y(this.r,a(-this.s),this.recovery):this}toDERRawBytes(){return zt(this.toDERHex())}toDERHex(){return At.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return zt(this.toCompactHex())}toCompactHex(){return S(this.r)+S(this.s)}}const x={isValidPrivateKey(I){try{return g(I),!0}catch{return!1}},normPrivateKeyToScalar:g,randomPrivateKey:()=>{const I=xa(t.n);return vc(t.randomBytes(I),t.n)},precompute(I=8,C=u.BASE){return C._setWindowSize(I),C.multiply(BigInt(3)),C}};function m(I,C=!0){return u.fromPrivateKey(I).toRawBytes(C)}function j(I){const C=Ot(I),F=typeof I=="string",K=(C||F)&&I.length;return C?K===i||K===o:F?K===2*i||K===2*o:I instanceof u}function P(I,C,F=!0){if(j(I))throw new Error("first arg must be private key");if(!j(C))throw new Error("second arg must be public key");return u.fromHex(C).multiply(g(I)).toRawBytes(F)}const B=t.bits2int||function(I){const C=It(I),F=I.length*8-t.nBitLength;return F>0?C>>BigInt(F):C},H=t.bits2int_modN||function(I){return a(B(I))},k=Wi(t.nBitLength);function Q(I){if(typeof I!="bigint")throw new Error("bigint expected");if(!(nt<=I&&I<k))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Gt(I,t.nByteLength)}function Z(I,C,F=D){if(["recovered","canonical"].some(Ae=>Ae in F))throw new Error("sign() legacy options not supported");const{hash:K,randomBytes:V}=t;let{lowS:ee,prehash:J,extraEntropy:ue}=F;ee==null&&(ee=!0),I=He("msgHash",I),J&&(I=He("prehashed msgHash",K(I)));const M=H(I),ne=g(C),pe=[Q(ne),Q(M)];if(ue!=null&&ue!==!1){const Ae=ue===!0?V(n.BYTES):ue;pe.push(He("extraEntropy",Ae))}const we=gn(...pe),ye=M;function ve(Ae){const xe=B(Ae);if(!v(xe))return;const Ue=f(xe),Re=u.BASE.multiply(xe).toAffine(),_=a(Re.x);if(_===nt)return;const E=a(Ue*a(ye+_*ne));if(E===nt)return;let O=(Re.x===_?0:2)|Number(Re.y&$e),W=E;return ee&&R(E)&&(W=h(E),O^=1),new y(_,W,O)}return{seed:we,k2sig:ve}}const D={lowS:t.lowS,prehash:!1},$={lowS:t.lowS,prehash:!1};function T(I,C,F=D){const{seed:K,k2sig:V}=Z(I,C,F),ee=t;return Ra(ee.hash.outputLen,ee.nByteLength,ee.hmac)(K,V)}u.BASE._setWindowSize(8);function te(I,C,F,K=$){var Re;const V=I;if(C=He("msgHash",C),F=He("publicKey",F),"strict"in K)throw new Error("options.strict was renamed to lowS");const{lowS:ee,prehash:J}=K;let ue,M;try{if(typeof V=="string"||Ot(V))try{ue=y.fromDER(V)}catch(_){if(!(_ instanceof At.Err))throw _;ue=y.fromCompact(V)}else if(typeof V=="object"&&typeof V.r=="bigint"&&typeof V.s=="bigint"){const{r:_,s:E}=V;ue=new y(_,E)}else throw new Error("PARSE");M=u.fromHex(F)}catch(_){if(_.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(ee&&ue.hasHighS())return!1;J&&(C=t.hash(C));const{r:ne,s:pe}=ue,we=H(C),ye=f(pe),ve=a(we*ye),Ae=a(ne*ye),xe=(Re=u.BASE.multiplyAndAddUnsafe(M,ve,Ae))==null?void 0:Re.toAffine();return xe?a(xe.x)===ne:!1}return{CURVE:t,getPublicKey:m,getSharedSecret:P,sign:T,verify:te,ProjectivePoint:u,Signature:y,utils:x}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Pc(e){return{hash:e,hmac:(t,...n)=>Sa(e,t,Kd(...n)),randomBytes:Zd}}function Lc(e,t){const n=r=>Nc({...e,...Pc(r)});return Object.freeze({...n(t),create:n})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Ca=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),ds=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Mc=BigInt(1),wi=BigInt(2),cs=(e,t)=>(e+t/wi)/t;function Bc(e){const t=Ca,n=BigInt(3),r=BigInt(6),i=BigInt(11),o=BigInt(22),s=BigInt(23),a=BigInt(44),f=BigInt(88),u=e*e*e%t,g=u*u*e%t,p=De(g,n,t)*g%t,v=De(p,n,t)*g%t,S=De(v,wi,t)*u%t,R=De(S,i,t)*S%t,h=De(R,o,t)*R%t,w=De(h,a,t)*h%t,y=De(w,f,t)*w%t,x=De(y,a,t)*h%t,m=De(x,n,t)*g%t,j=De(m,s,t)*R%t,P=De(j,r,t)*u%t,B=De(P,wi,t);if(!yi.eql(yi.sqr(B),e))throw new Error("Cannot find square root");return B}const yi=Sc(Ca,void 0,void 0,{sqrt:Bc}),Ui=Lc({a:BigInt(0),b:BigInt(7),Fp:yi,n:ds,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=ds,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Mc*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),o=n,s=BigInt("0x100000000000000000000000000000000"),a=cs(o*e,t),f=cs(-r*e,t);let u=Ne(e-a*n-f*i,t),g=Ne(-a*r-f*o,t);const p=u>s,v=g>s;if(p&&(u=t-u),v&&(g=t-g),u>s||g>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:p,k1:u,k2neg:v,k2:g}}}},rc);BigInt(0);Ui.ProjectivePoint;function Dc(e){let t=e;if(typeof t!="string")throw new Error(`[padToEven] value must be type 'string', received ${typeof t}`);return t.length%2&&(t=`0${t}`),t}BigInt(0);const _i={},mi={};for(let e=0;e<16;e++){const t=e,n=e*16,r=e.toString(16).toLowerCase();mi[r]=t,mi[r.toUpperCase()]=t,_i[r]=n,_i[r.toUpperCase()]=n}function $c(e){const t=e.length,n=new Uint8Array(t/2);for(let r=0;r<t;r+=2)n[r/2]=_i[e[r]]+mi[e[r+1]];return n}Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));for(let e=0;e<=256*256-1;e++)BigInt(e);const pr=e=>{if(typeof e!="string")throw new Error(`hex argument type ${typeof e} must be of type string`);if(!/^0x[0-9a-fA-F]*$/.test(e))throw new Error(`Input must be a 0x-prefixed hexadecimal string, got ${e}`);const t=e.slice(2);return $c(t.length%2===0?t:Dc(t))},jc=e=>{if(!Number.isSafeInteger(e)||e<0)throw new Error(`Received an invalid integer type: ${e}`);return`0x${e.toString(16)}`},_n=e=>{const t=jc(e);return pr(t)};BigInt("0xffffffffffffffff");BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");BigInt("115792089237316195423570985008687907853269984665640564039457584007913129639935");Ui.CURVE.n;Ui.CURVE.n/BigInt(2);BigInt("0x10000000000000000000000000000000000000000000000000000000000000000");const kc="0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470";pr(kc);const Wc="0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347";pr(Wc);const Uc="0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421";pr(Uc);Uint8Array.from([128]);BigInt(-1);BigInt(0);BigInt(1);BigInt(2);BigInt(3);BigInt(7);BigInt(8);BigInt(27);BigInt(28);BigInt(31);BigInt(32);BigInt(64);BigInt(128);BigInt(255);BigInt(256);BigInt(96);BigInt(100);BigInt(160);BigInt(224);BigInt(7922816251426434e13);BigInt(1461501637330903e33);BigInt(2695994666715064e52);BigInt(1e9);Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));var hs;(function(e){e.String="string",e.Bytes="view",e.Number="number"})(hs||(hs={}));var gs;(function(e){e.String="string",e.Bytes="view",e.JSON="json"})(gs||(gs={}));var ps;(function(e){e[e.Number=0]="Number",e[e.BigInt=1]="BigInt",e[e.Uint8Array=2]="Uint8Array",e[e.PrefixedHexString=3]="PrefixedHexString"})(ps||(ps={}));var bs;(function(e){e[e.Deposit=0]="Deposit",e[e.Withdrawal=1]="Withdrawal",e[e.Consolidation=2]="Consolidation"})(bs||(bs={}));var Ct;(function(e){e[e.Version=0]="Version",e[e.Balance=1]="Balance",e[e.Nonce=2]="Nonce",e[e.CodeHash=3]="CodeHash",e[e.CodeSize=4]="CodeSize"})(Ct||(Ct={}));_n(Ct.Version);_n(Ct.Balance);_n(Ct.Nonce);_n(Ct.CodeHash);_n(Ct.CodeSize);BigInt(256)**BigInt(31);var Fc={exports:{}},Fi={},qi={};Object.defineProperty(qi,"__esModule",{value:!0});function qc(e){var t=4,n=e.length,r=n%t;if(!r)return e;var i=n,o=t-r,s=n+o,a=X.dist.Buffer.alloc(s);for(a.write(e);o--;)a.write("=",i++);return a.toString()}qi.default=qc;Object.defineProperty(Fi,"__esModule",{value:!0});var Hc=qi;function Na(e,t){return t===void 0&&(t="utf8"),X.dist.Buffer.isBuffer(e)?Ei(e.toString("base64")):Ei(X.dist.Buffer.from(e,t).toString("base64"))}function zc(e,t){return t===void 0&&(t="utf8"),X.dist.Buffer.from(Hi(e),"base64").toString(t)}function Hi(e){return e=e.toString(),Hc.default(e).replace(/\-/g,"+").replace(/_/g,"/")}function Ei(e){return e.replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Gc(e){return X.dist.Buffer.from(Hi(e),"base64")}var Kt=Na;Kt.encode=Na;Kt.decode=zc;Kt.toBase64=Hi;Kt.fromBase64=Ei;Kt.toBuffer=Gc;Fi.default=Kt;(function(e){e.exports=Fi.default,e.exports.default=e.exports})(Fc);const fe={MAINNET:"mainnet",TESTNET:"testnet",CYAN:"cyan",AQUA:"aqua",CELESTE:"celeste"},ct={SAPPHIRE_DEVNET:"sapphire_devnet",SAPPHIRE_MAINNET:"sapphire_mainnet"};fe.MAINNET+"",fe.TESTNET+"",fe.CYAN+"",fe.AQUA+"",fe.CELESTE+"";fe.AQUA+"",ct.SAPPHIRE_MAINNET,fe.CELESTE+"",ct.SAPPHIRE_MAINNET,fe.CYAN+"",ct.SAPPHIRE_MAINNET,fe.MAINNET+"",ct.SAPPHIRE_MAINNET,fe.TESTNET+"",ct.SAPPHIRE_DEVNET;fe.MAINNET+"",fe.TESTNET+"",fe.CYAN+"",fe.AQUA+"",fe.CELESTE+"";ct.SAPPHIRE_MAINNET+"",ct.SAPPHIRE_DEVNET+"",fe.MAINNET+"",fe.TESTNET+"",fe.CYAN+"",fe.AQUA+"",fe.CELESTE+"";fe.MAINNET+"",fe.TESTNET+"",fe.CYAN+"",fe.AQUA+"",fe.CELESTE+"";function ws(e){let t=!1,n=0,r;try{r=window[e],t=!0,n=r.length;const i="__storage_test__";return r.setItem(i,i),r.removeItem(i),!0}catch(i){const o=i;return o&&(o.code===22||o.code===1014||o.name==="QuotaExceededError"||o.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&n!==0}}class Vc{constructor(){G(this,"store",new Map)}getItem(t){return this.store.get(t)||null}setItem(t,n){this.store.set(t,n)}removeItem(t){this.store.delete(t)}}class Kc{constructor(t,n){G(this,"storage",void 0),G(this,"_storeKey",void 0),this.storage=n,this._storeKey=t;try{n.getItem(t)||this.resetStore()}catch{}}static getInstance(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"local";if(!this.instanceMap.has(t)){let r;n==="local"&&ws("localStorage")?r=window.localStorage:n==="session"&&ws("sessionStorage")?r=window.sessionStorage:r=new Vc,this.instanceMap.set(t,new this(t,r))}return this.instanceMap.get(t)}toJSON(){return this.storage.getItem(this._storeKey)}resetStore(){const t=this.getStore();return this.storage.removeItem(this._storeKey),t}getStore(){return JSON.parse(this.storage.getItem(this._storeKey)||"{}")}get(t){return JSON.parse(this.storage.getItem(this._storeKey)||"{}")[t]}set(t,n){const r=JSON.parse(this.storage.getItem(this._storeKey)||"{}");r[t]=n,this.storage.setItem(this._storeKey,JSON.stringify(r))}}G(Kc,"instanceMap",new Map);je(je({},ct),fe);const Un={IFRAME_STATUS:"iframe_status",CLOSE_WINDOW:"close_window",USER_LOGGED_IN:"user_logged_in",USER_LOGGED_OUT:"user_logged_out"},rt={LOGOUT:"logout",WALLET_INSTANCE_ID:"wallet_instance_id",USER_INFO:"user_info",SET_PROVIDER:"set_provider",TOPUP:"topup",IFRAME_STATUS:"iframe_status",CLOSED_WINDOW:"closed_window",WINDOW_BLOCKED:"window_blocked",GET_PROVIDER_STATE:"get_provider_state",LOGIN_WITH_PRIVATE_KEY:"login_with_private_key",SHOW_WALLET_CONNECT:"show_wallet_connect",SHOW_CHECKOUT:"show_checkout",SHOW_WALLET_UI:"show_wallet_ui",LOGIN_WITH_SESSION_ID:"login_with_session_id"},Yc={GET_PROVIDER_STATE:"wallet_get_provider_state"},ti={ACCOUNTS_CHANGED:"wallet_accounts_changed",CHAIN_CHANGED:"wallet_chain_changed",UNLOCK_STATE_CHANGED:"wallet_unlock_state_changed"};function Zc(e){return function(n,r,i){i(o=>{r.error&&Xn.warn(`Error in RPC response:
|
|
3
|
-
`,r),!n.isTorusInternal&&(Xn.info(`RPC (${e.origin}):`,n,"->",r),o())})}}var Jc=function e(t,n){if(t===n)return!0;if(t&&n&&typeof t=="object"&&typeof n=="object"){if(t.constructor!==n.constructor)return!1;var r,i,o;if(Array.isArray(t)){if(r=t.length,r!=n.length)return!1;for(i=r;i--!==0;)if(!e(t[i],n[i]))return!1;return!0}if(t.constructor===RegExp)return t.source===n.source&&t.flags===n.flags;if(t.valueOf!==Object.prototype.valueOf)return t.valueOf()===n.valueOf();if(t.toString!==Object.prototype.toString)return t.toString()===n.toString();if(o=Object.keys(t),r=o.length,r!==Object.keys(n).length)return!1;for(i=r;i--!==0;)if(!Object.prototype.hasOwnProperty.call(n,o[i]))return!1;for(i=r;i--!==0;){var s=o[i];if(!e(t[s],n[s]))return!1}return!0}return t!==t&&n!==n};const Xc=X.getDefaultExportFromCjs(Jc);var Qc="2.1.0";function Pa(e){return e!==null&&typeof e=="object"&&typeof e.pipe=="function"}function eh(e){return Pa(e)&&e.writable!==!1&&typeof e._write=="function"&&typeof e._writableState=="object"}function th(e){return Pa(e)&&e.readable!==!1&&typeof e._read=="function"&&typeof e._readableState=="object"}function nh(e){return eh(e)&&th(e)}var Ve={errors:{disconnected:()=>"Torus: Lost connection to Torus.",permanentlyDisconnected:()=>"Torus: Disconnected from iframe. Page reload required.",unsupportedSync:e=>`Torus: The Torus Ethereum provider does not support synchronous methods like ${e} without a callback parameter.`,invalidDuplexStream:()=>"Must provide a Node.js-style duplex stream.",invalidOptions:e=>`Invalid options. Received: { maxEventListeners: ${e}}`,invalidRequestArgs:()=>"Expected a single, non-array, object argument.",invalidRequestMethod:()=>"'args.method' must be a non-empty string.",invalidRequestParams:()=>"'args.params' must be an object or array if provided.",invalidLoggerObject:()=>"'args.logger' must be an object if provided.",invalidLoggerMethod:e=>`'args.logger' must include required method '${e}'.`},info:{connected:e=>`Torus: Connected to chain with ID "${e}".`}};const La={PRODUCTION:"production"},jt={BOTTOM_LEFT:"bottom-left",TOP_LEFT:"top-left",BOTTOM_RIGHT:"bottom-right",TOP_RIGHT:"top-right"},rh={en:{embed:{continue:"Continue",actionRequired:"Authorization required",pendingAction:"Click continue to proceed with your request in a popup",cookiesRequired:"Cookies Required",enableCookies:"Please enable cookies in your browser preferences to access Torus",clickHere:"More Info"}},de:{embed:{continue:"Fortsetzen",actionRequired:"Autorisierung erforderlich",pendingAction:"Klicken Sie in einem Popup auf Weiter, um mit Ihrer Anfrage fortzufahren",cookiesRequired:"Cookies benötigt",enableCookies:"Bitte aktivieren Sie Cookies in Ihren Browsereinstellungen, um auf Torus zuzugreifen",clickHere:"Mehr Info"}},ja:{embed:{continue:"継続する",actionRequired:"認証が必要です",pendingAction:"続行をクリックして、ポップアップでリクエストを続行します",cookiesRequired:"必要なクッキー",enableCookies:"Torusにアクセスするには、ブラウザの設定でCookieを有効にしてください。",clickHere:"詳しくは"}},ko:{embed:{continue:"계속하다",actionRequired:"승인 필요",pendingAction:"팝업에서 요청을 진행하려면 계속을 클릭하십시오.",cookiesRequired:"쿠키 필요",enableCookies:"브라우저 환경 설정에서 쿠키를 활성화하여 Torus에 액세스하십시오.",clickHere:"더 많은 정보"}},zh:{embed:{continue:"继续",actionRequired:"需要授权",pendingAction:"单击继续以在弹出窗口中继续您的请求",cookiesRequired:"必填Cookie",enableCookies:"请在您的浏览器首选项中启用cookie以访问Torus。",clickHere:"更多信息"}}};var zi={translations:rh,localStorageKeyPrefix:"torus-"},le=Xn.getLogger("solana-embed");function ih(){return(e,t,n)=>{(typeof e.method!="string"||!e.method)&&(t.error=it.ethErrors.rpc.invalidRequest({message:"The request 'method' must be a non-empty string.",data:e})),n(r=>{const{error:i}=t;return i&&le.error(`Torus - RPC Error: ${i.message}`,i),r()})}}function oh(e,t,n){let r=`Torus: Lost connection to "${e}".`;t!=null&&t.stack&&(r+=`
|
|
4
|
-
${t.stack}`),le.warn(r),n&&n.listenerCount("error")>0&&n.emit("error",r)}const Fn=()=>Math.random().toString(36).slice(2),Ma=async e=>{let t,n;switch(e){case"testing":t="https://solana-testing.tor.us",n="debug";break;case"development":t="http://localhost:8080",n="debug";break;default:t="https://solana.tor.us",n="error";break}return{torusUrl:t,logLevel:n}},sh=()=>{let e=window.navigator.language||"en-US";const t=e.split("-");return e=Object.prototype.hasOwnProperty.call(zi.translations,t[0])?t[0]:"en",e},ah={height:660,width:375},lh={height:740,width:1315},uh={height:700,width:1200},Ba={height:600,width:400};function fh(e){let t;try{t=window[e];const n="__storage_test__";return t.setItem(n,n),t.removeItem(n),!0}catch(n){const r=n;return r&&(r.code===22||r.code===1014||r.name==="QuotaExceededError"||r.name==="NS_ERROR_DOM_QUOTA_REACHED")&&t&&t.length!==0}}function un(e){let{width:t,height:n}=e;const r=window.screenLeft!==void 0?window.screenLeft:window.screenX,i=window.screenTop!==void 0?window.screenTop:window.screenY,o=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:window.screen.width,s=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:window.screen.height,a=1,f=Math.abs((o-t)/2/a+r),u=Math.abs((s-n)/2/a+i);return`titlebar=0,toolbar=0,status=0,location=0,menubar=0,height=${n/a},width=${t/a},top=${u},left=${f}`}class Da extends cr{constructor(t,n){let{maxEventListeners:r=100,jsonRpcStreamName:i="provider"}=n;if(super(),G(this,"isTorus",void 0),G(this,"_rpcEngine",void 0),G(this,"jsonRpcConnectionEvents",void 0),G(this,"_state",void 0),!nh(t))throw new Error(Ve.errors.invalidDuplexStream());this.isTorus=!0,this.setMaxListeners(r),this._handleConnect=this._handleConnect.bind(this),this._handleDisconnect=this._handleDisconnect.bind(this),this._handleStreamDisconnect=this._handleStreamDisconnect.bind(this),this._rpcRequest=this._rpcRequest.bind(this),this._initializeState=this._initializeState.bind(this),this.request=this.request.bind(this),this.sendAsync=this.sendAsync.bind(this);const o=new Ud;Vo(t,o,t,this._handleStreamDisconnect.bind(this,"Torus")),o.ignoreStream("phishing");const s=jd();Vo(s.stream,o.createStream(i),s.stream,this._handleStreamDisconnect.bind(this,"Torus RpcProvider"));const a=new tt;a.push(kd()),a.push(ih()),a.push(Zc({origin:location.origin})),a.push(s.middleware),this._rpcEngine=a,this.jsonRpcConnectionEvents=s.events}async request(t){if(!t||typeof t!="object"||Array.isArray(t))throw it.ethErrors.rpc.invalidRequest({message:Ve.errors.invalidRequestArgs(),data:t});const{method:n,params:r}=t;if(typeof n!="string"||n.length===0)throw it.ethErrors.rpc.invalidRequest({message:Ve.errors.invalidRequestMethod(),data:t});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw it.ethErrors.rpc.invalidRequest({message:Ve.errors.invalidRequestParams(),data:t});return new Promise((i,o)=>{this._rpcRequest({method:n,params:r},gi(i,o))})}send(t,n){this._rpcRequest(t,n)}sendAsync(t){return new Promise((n,r)=>{this._rpcRequest(t,gi(n,r))})}_handleStreamDisconnect(t,n){oh(t,n,this),this._handleDisconnect(!1,n?n.message:void 0)}}const Ut=e=>{const t=window.document.createElement("template"),n=e.trim();return t.innerHTML=n,t.content.firstChild};function qn(e){return e.version===void 0}class $a extends cr{constructor(t){let{url:n,target:r,features:i,timeout:o=3e4}=t;super(),G(this,"url",void 0),G(this,"target",void 0),G(this,"features",void 0),G(this,"window",void 0),G(this,"windowTimer",void 0),G(this,"iClosedWindow",void 0),G(this,"timeout",void 0),this.url=n,this.target=r||"_blank",this.features=i||un(uh),this.window=void 0,this.windowTimer=void 0,this.iClosedWindow=!1,this.timeout=o,this._setupTimer()}_setupTimer(){this.windowTimer=Number(setInterval(()=>{this.window&&this.window.closed&&(clearInterval(this.windowTimer),setTimeout(()=>{this.iClosedWindow||this.emit("close"),this.iClosedWindow=!1,this.window=void 0},this.timeout)),this.window===void 0&&clearInterval(this.windowTimer)},500))}open(){var t;return this.window=window.open(this.url.href,this.target,this.features),(t=this.window)!=null&&t.focus&&this.window.focus(),Promise.resolve()}close(){this.iClosedWindow=!0,this.window&&this.window.close()}redirect(t){t?window.location.replace(this.url.href):window.location.href=this.url.href}}class br extends Da{constructor(t,n){let{maxEventListeners:r=100,jsonRpcStreamName:i="provider"}=n;super(t,{maxEventListeners:r,jsonRpcStreamName:i}),G(this,"embedTranslations",void 0),G(this,"torusUrl",void 0),G(this,"dappStorageKey",void 0),G(this,"windowRefs",void 0),G(this,"tryWindowHandle",void 0),G(this,"torusAlertContainer",void 0),G(this,"torusIframe",void 0),this._state=je({},br._defaultState),this.torusUrl="",this.dappStorageKey="";const o=zi.translations[sh()];this.embedTranslations=o.embed,this.windowRefs={},this.on("connect",()=>{this._state.isConnected=!0});const s=a=>{const{method:f,params:u}=a;if(f===Un.IFRAME_STATUS){const{isFullScreen:g,rid:p}=u;this._displayIframe({isFull:g,rid:p})}else if(f==="create_window"){const{windowId:g,url:p}=u;this._createPopupBlockAlert(g,p)}else if(f===Un.CLOSE_WINDOW)this._handleCloseWindow(u);else if(f===Un.USER_LOGGED_IN){const{currentLoginProvider:g}=u;this._state.isLoggedIn=!0,this._state.currentLoginProvider=g}else f===Un.USER_LOGGED_OUT&&(this._state.isLoggedIn=!1,this._state.currentLoginProvider=null,this._displayIframe())};this.jsonRpcConnectionEvents.on("notification",s)}get isLoggedIn(){return this._state.isLoggedIn}get isIFrameFullScreen(){return this._state.isIFrameFullScreen}isConnected(){return this._state.isConnected}async _initializeState(t){try{const{torusUrl:n,dappStorageKey:r,torusAlertContainer:i,torusIframe:o}=t;this.torusUrl=n,this.dappStorageKey=r,this.torusAlertContainer=i,this.torusIframe=o,this.torusIframe.addEventListener("load",()=>{this._state.isIFrameFullScreen||this._displayIframe()});const{currentLoginProvider:s,isLoggedIn:a}=await this.request({method:rt.GET_PROVIDER_STATE,params:[]});this._handleConnect(s,a)}catch(n){le.error("Torus: Failed to get initial state. Please report this bug.",n)}finally{le.info("initialized communication state"),this._state.initialized=!0,this.emit("_initialized")}}_handleWindow(t){let{url:n,target:r,features:i}=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const o=new URL(n||`${this.torusUrl}/redirect?windowId=${t}`);this.dappStorageKey&&(o.hash?o.hash+=`&dappStorageKey=${this.dappStorageKey}`:o.hash=`#dappStorageKey=${this.dappStorageKey}`);const s=new $a({url:o,target:r,features:i});if(s.open(),!s.window){this._createPopupBlockAlert(t,o.href);return}this.windowRefs[t]=s,this.request({method:"opened_window",params:{windowId:t}}),s.once("close",()=>{delete this.windowRefs[t],this.request({method:rt.CLOSED_WINDOW,params:{windowId:t}})})}_displayIframe(){let{isFull:t=!1,rid:n=""}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};const r={};if(t)r.display="block",r.width="100%",r.height="100%",r.top="0px",r.right="0px",r.left="0px",r.bottom="0px";else switch(r.display=this._state.torusWidgetVisibility?"block":"none",r.height="70px",r.width="70px",this._state.buttonPosition){case jt.TOP_LEFT:r.top="0px",r.left="0px",r.right="auto",r.bottom="auto";break;case jt.TOP_RIGHT:r.top="0px",r.right="0px",r.left="auto",r.bottom="auto";break;case jt.BOTTOM_RIGHT:r.bottom="0px",r.right="0px",r.top="auto",r.left="auto";break;case jt.BOTTOM_LEFT:default:r.bottom="0px",r.left="0px",r.top="auto",r.right="auto";break}Object.assign(this.torusIframe.style,r),this._state.isIFrameFullScreen=t,this.request({method:rt.IFRAME_STATUS,params:{isIFrameFullScreen:t,rid:n}})}hideTorusButton(){this._state.torusWidgetVisibility=!1,this._displayIframe()}showTorusButton(){this._state.torusWidgetVisibility=!0,this._displayIframe()}_rpcRequest(t,n){const r=n,i=t;Array.isArray(i)||i.jsonrpc||(i.jsonrpc="2.0"),this.tryWindowHandle(i,r)}_handleConnect(t,n){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{currentLoginProvider:t,isLoggedIn:n}),le.debug(Ve.info.connected(t)))}_handleDisconnect(t,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!t){this._state.isConnected=!1;let r;t?(r=new it.EthereumRpcError(1013,n||Ve.errors.disconnected()),le.debug(r)):(r=new it.EthereumRpcError(1011,n||Ve.errors.permanentlyDisconnected()),le.error(r),this._state.currentLoginProvider=null,this._state.isLoggedIn=!1,this._state.torusWidgetVisibility=!1,this._state.isIFrameFullScreen=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}_handleCloseWindow(t){const{windowId:n}=t;this.windowRefs[n]&&(this.windowRefs[n].close(),delete this.windowRefs[n])}async _createPopupBlockAlert(t,n){const r=this.getLogoUrl(),i=Ut(`<div id="torusAlert" class="torus-alert--v2"><div id="torusAlert__logo"><img src="${r}" /></div><div><h1 id="torusAlert__title">${this.embedTranslations.actionRequired}</h1><p id="torusAlert__desc">${this.embedTranslations.pendingAction}</p></div></div>`),o=Ut(`<div><a id="torusAlert__btn">${this.embedTranslations.continue}</a></div>`),s=Ut('<div id="torusAlert__btn-container"></div>');s.appendChild(o),i.appendChild(s);const a=()=>{o.addEventListener("click",()=>{this._handleWindow(t,{url:n,target:"_blank",features:un(Ba)}),i.remove(),this.torusAlertContainer.children.length===0&&(this.torusAlertContainer.style.display="none")})};(()=>{this.torusAlertContainer.appendChild(i)})(),a(),this.torusAlertContainer.style.display="block"}getLogoUrl(){return`${this.torusUrl}/images/torus_icon-blue.svg`}}G(br,"_defaultState",{buttonPosition:"bottom-left",currentLoginProvider:null,isIFrameFullScreen:!1,hasEmittedConnection:!1,torusWidgetVisibility:!1,initialized:!1,isLoggedIn:!1,isPermanentlyDisconnected:!1,isConnected:!1});class mn extends Da{constructor(t,n){let{maxEventListeners:r=100,jsonRpcStreamName:i="provider"}=n;super(t,{maxEventListeners:r,jsonRpcStreamName:i}),G(this,"chainId",void 0),G(this,"selectedAddress",void 0),G(this,"tryWindowHandle",void 0),this._state=je({},mn._defaultState),this.selectedAddress=null,this.chainId=null,this._handleAccountsChanged=this._handleAccountsChanged.bind(this),this._handleChainChanged=this._handleChainChanged.bind(this),this._handleUnlockStateChanged=this._handleUnlockStateChanged.bind(this),this.on("connect",()=>{this._state.isConnected=!0});const o=s=>{const{method:a,params:f}=s;a===ti.ACCOUNTS_CHANGED?this._handleAccountsChanged(f):a===ti.UNLOCK_STATE_CHANGED?this._handleUnlockStateChanged(f):a===ti.CHAIN_CHANGED&&this._handleChainChanged(f)};this.jsonRpcConnectionEvents.on("notification",o)}isConnected(){return this._state.isConnected}async _initializeState(){try{const{accounts:t,chainId:n,isUnlocked:r}=await this.request({method:Yc.GET_PROVIDER_STATE,params:[]});this.emit("connect",{chainId:n}),this._handleChainChanged({chainId:n}),this._handleUnlockStateChanged({accounts:t,isUnlocked:r}),this._handleAccountsChanged(t)}catch(t){le.error("Torus: Failed to get initial state. Please report this bug.",t)}finally{le.info("initialized provider state"),this._state.initialized=!0,this.emit("_initialized")}}_rpcRequest(t,n){let r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=n;const o=t;if(!Array.isArray(o)){if(o.jsonrpc||(o.jsonrpc="2.0"),o.method==="solana_accounts"||o.method==="solana_requestAccounts")i=(s,a)=>{this._handleAccountsChanged(a.result||[],o.method==="solana_accounts",r),n(s,a)};else if(o.method==="wallet_getProviderState"){this._rpcEngine.handle(t,i);return}}this.tryWindowHandle(o,i)}_handleConnect(t){this._state.isConnected||(this._state.isConnected=!0,this.emit("connect",{chainId:t}),le.debug(Ve.info.connected(t)))}_handleDisconnect(t,n){if(this._state.isConnected||!this._state.isPermanentlyDisconnected&&!t){this._state.isConnected=!1;let r;t?(r=new it.EthereumRpcError(1013,n||Ve.errors.disconnected()),le.debug(r)):(r=new it.EthereumRpcError(1011,n||Ve.errors.permanentlyDisconnected()),le.error(r),this.chainId=null,this._state.accounts=null,this.selectedAddress=null,this._state.isUnlocked=!1,this._state.isPermanentlyDisconnected=!0),this.emit("disconnect",r)}}_handleAccountsChanged(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=t;Array.isArray(i)||(le.error("Torus: Received non-array accounts parameter. Please report this bug.",i),i=[]);for(const o of t)if(typeof o!="string"){le.error("Torus: Received non-string account. Please report this bug.",t),i=[];break}Xc(this._state.accounts,i)||(n&&Array.isArray(this._state.accounts)&&this._state.accounts.length>0&&!r&&le.error('Torus: "solana_accounts" unexpectedly updated accounts. Please report this bug.',i),this._state.accounts=i,this.emit("accountsChanged",i)),this.selectedAddress!==i[0]&&(this.selectedAddress=i[0]||null)}_handleChainChanged(){let{chainId:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!t){le.error("Torus: Received invalid network parameters. Please report this bug.",{chainId:t});return}t==="loading"?this._handleDisconnect(!0):(this._handleConnect(t),t!==this.chainId&&(this.chainId=t,this._state.initialized&&this.emit("chainChanged",this.chainId)))}_handleUnlockStateChanged(){let{accounts:t,isUnlocked:n}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(typeof n!="boolean"){le.error("Torus: Received invalid isUnlocked parameter. Please report this bug.",{isUnlocked:n});return}n!==this._state.isUnlocked&&(this._state.isUnlocked=n,this._handleAccountsChanged(t||[]))}}G(mn,"_defaultState",{accounts:null,isConnected:!1,isUnlocked:!1,initialized:!1,isPermanentlyDisconnected:!1,hasEmittedConnection:!1});function ys(e){return new Promise((t,n)=>{try{const r=document.createElement("img");r.onload=()=>t(!0),r.onerror=()=>t(!1),r.src=e}catch(r){n(r)}})}const dh=e=>{const{document:t}=e,n=t.querySelector('head > meta[property="og:site_name"]');if(n)return n.content;const r=t.querySelector('head > meta[name="title"]');return r?r.content:t.title&&t.title.length>0?t.title:e.location.hostname};async function ch(e){try{const{document:t}=e;let n=t.querySelector('head > link[rel="shortcut icon"]');return n&&await ys(n.href)||(n=Array.from(t.querySelectorAll('head > link[rel="icon"]')).find(r=>!!r.href),n&&await ys(n.href))?n.href:""}catch{return""}}const hh=async()=>({name:dh(window),icon:await ch(window)}),gh=["send_transaction","sign_transaction","sign_all_transactions","sign_message","connect"],ph=[rt.SET_PROVIDER],bh=fh("localStorage");(async function(){try{if(typeof document>"u")return;const t=document.createElement("link"),{torusUrl:n}=await Ma("production");t.href=`${n}/frame`,t.crossOrigin="anonymous",t.type="text/html",t.rel="prefetch",t.relList&&t.relList.supports&&t.relList.supports("prefetch")&&document.head.appendChild(t)}catch(t){le.warn(t)}})();class wh{constructor(){let{modalZIndex:t=99999}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};G(this,"isInitialized",void 0),G(this,"torusAlert",void 0),G(this,"modalZIndex",void 0),G(this,"alertZIndex",void 0),G(this,"requestedLoginProvider",void 0),G(this,"provider",void 0),G(this,"communicationProvider",void 0),G(this,"dappStorageKey",void 0),G(this,"isTopupHidden",!1),G(this,"torusAlertContainer",void 0),G(this,"torusUrl",void 0),G(this,"torusIframe",void 0),G(this,"styleLink",void 0),this.torusUrl="",this.isInitialized=!1,this.requestedLoginProvider=null,this.modalZIndex=t,this.alertZIndex=t+1e3,this.dappStorageKey=""}get isLoggedIn(){return this.communicationProvider?this.communicationProvider.isLoggedIn:!1}async init(){let{buildEnv:t=La.PRODUCTION,enableLogging:n=!1,network:r,showTorusButton:i=!1,useLocalStorage:o=!1,buttonPosition:s=jt.BOTTOM_LEFT,apiKey:a="torus-default",extraParams:f={},whiteLabel:u}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(this.isInitialized)throw new Error("Already initialized");const{torusUrl:g,logLevel:p}=await Ma(t);le.enableAll(),le.info(g,"url loaded"),le.info(`Solana Embed Version :${Qc}`),this.torusUrl=g,le.setDefaultLevel(p),n?le.enableAll():le.disableAll();const v=this.handleDappStorageKey(o),S=new URL(g);S.pathname.endsWith("/")?S.pathname+="frame":S.pathname+="/frame";const R=new URLSearchParams;return v&&R.append("dappStorageKey",v),R.append("origin",window.location.origin),S.hash=R.toString(),this.torusIframe=Ut(`<iframe
|
|
5
|
-
id="torusIframe"
|
|
6
|
-
class="torusIframe"
|
|
7
|
-
src="${S.href}"
|
|
8
|
-
style="display: none; position: fixed; top: 0; right: 0; width: 100%;
|
|
9
|
-
height: 100%; border: none; border-radius: 0; z-index: ${this.modalZIndex.toString()}"
|
|
10
|
-
></iframe>`),this.torusAlertContainer=Ut(`<div id="torusAlertContainer" style="display:none; z-index: ${this.alertZIndex.toString()}"></div>`),this.styleLink=Ut(`<link href="${g}/css/widget.css" rel="stylesheet" type="text/css">`),new Promise((h,w)=>{try{this.torusIframe.addEventListener("load",async()=>{const y=await hh();this.torusIframe.contentWindow.postMessage({buttonPosition:s,apiKey:a,network:r,dappMetadata:y,extraParams:f,whiteLabel:u},S.origin),await this._setupWeb3({torusUrl:g}),i&&this.showTorusButton(),u!=null&&u.topupHide?this.isTopupHidden=u.topupHide:this.hideTorusButton(),this.isInitialized=!0,window.torus=this,h()}),window.document.head.appendChild(this.styleLink),window.document.body.appendChild(this.torusIframe),window.document.body.appendChild(this.torusAlertContainer)}catch(y){w(y)}})}async login(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!this.isInitialized)throw new Error("Call init() first");try{this.requestedLoginProvider=t.loginProvider||null,this.requestedLoginProvider||this.communicationProvider._displayIframe({isFull:!0});const n=await new Promise((r,i)=>{this.provider._rpcRequest({method:"solana_requestAccounts",params:[this.requestedLoginProvider,t.login_hint]},gi(r,i))});if(Array.isArray(n)&&n.length>0)return n;throw new Error("Login failed")}catch(n){throw le.error("login failed",n),n}finally{this.communicationProvider.isIFrameFullScreen&&this.communicationProvider._displayIframe()}}async loginWithPrivateKey(t){if(!this.isInitialized)throw new Error("Call init() first");const{privateKey:n,userInfo:r}=t,{success:i}=await this.communicationProvider.request({method:"login_with_private_key",params:{privateKey:n,userInfo:r}});if(!i)throw new Error("Login Failed")}async logout(){if(!this.communicationProvider.isLoggedIn)throw new Error("Not logged in");await this.communicationProvider.request({method:rt.LOGOUT,params:[]}),this.requestedLoginProvider=null}async cleanUp(){this.communicationProvider.isLoggedIn&&await this.logout(),this.clearInit()}clearInit(){function t(n){return n instanceof Element||n instanceof Document}t(this.styleLink)&&window.document.body.contains(this.styleLink)&&(this.styleLink.remove(),this.styleLink=void 0),t(this.torusIframe)&&window.document.body.contains(this.torusIframe)&&(this.torusIframe.remove(),this.torusIframe=void 0),t(this.torusAlertContainer)&&window.document.body.contains(this.torusAlertContainer)&&(this.torusAlert=void 0,this.torusAlertContainer.remove(),this.torusAlertContainer=void 0),this.isInitialized=!1}hideTorusButton(){this.communicationProvider.hideTorusButton()}showTorusButton(){this.communicationProvider.showTorusButton()}async setProvider(t){await this.communicationProvider.request({method:rt.SET_PROVIDER,params:je({},t)})}async showWallet(t){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};const r=await this.communicationProvider.request({method:rt.WALLET_INSTANCE_ID,params:[]}),i=t?`/${t}`:"",o=new URL(`${this.torusUrl}/wallet${i}`);o.searchParams.append("instanceId",r),Object.keys(n).forEach(a=>{o.searchParams.append(a,n[a])}),this.dappStorageKey&&(o.hash=`#dappStorageKey=${this.dappStorageKey}`),new $a({url:o,features:un(lh)}).open()}async getUserInfo(){return await this.communicationProvider.request({method:rt.USER_INFO,params:[]})}async initiateTopup(t,n){if(!this.isInitialized)throw new Error("Torus is not initialized");const r=Fn();return this.communicationProvider._handleWindow(r),await this.communicationProvider.request({method:rt.TOPUP,params:{provider:t,params:n,windowId:r}})}async getAccounts(){return await this.provider.request({method:"getAccounts",params:[]})}async sendTransaction(t){const n=qn(t),r=n?t.serialize({requireAllSignatures:!1}).toString("hex"):X.dist.Buffer.from(t.serialize()).toString("hex");return await this.provider.request({method:"send_transaction",params:{message:r,isLegacyTransaction:n}})}async signAndSendTransaction(t,n){const r=qn(t),i=r?t.serialize({requireAllSignatures:!1}).toString("hex"):X.dist.Buffer.from(t.serialize()).toString("hex");return{signature:await this.provider.request({method:"send_transaction",params:{message:i,options:n,isLegacyTransaction:r}})}}async signTransaction(t){const n=qn(t),r=n?t.serializeMessage().toString("hex"):X.dist.Buffer.from(t.message.serialize()).toString("hex"),i=await this.provider.request({method:"sign_transaction",params:{message:r,messageOnly:!0,isLegacyTransaction:n}}),o=JSON.parse(i),s={publicKey:new X.PublicKey(o.publicKey),signature:X.dist.Buffer.from(o.signature,"hex")};return t.addSignature(s.publicKey,s.signature),t}async signAllTransactions(t){let n;const r=t.map(s=>(n=qn(s),n?s.serializeMessage().toString("hex"):X.dist.Buffer.from(s.message.serialize()).toString("hex"))),o=(await this.provider.request({method:"sign_all_transactions",params:{message:r,messageOnly:!0,isLegacyTransaction:n}})).map(s=>{const a=JSON.parse(s);return{publicKey:new X.PublicKey(a.publicKey),signature:X.dist.Buffer.from(a.signature,"hex")}});return t.forEach((s,a)=>(s.addSignature(o[a].publicKey,o[a].signature),s)),t}async signMessage(t){return await this.provider.request({method:"sign_message",params:{data:t}})}async getGaslessPublicKey(){return await this.provider.request({method:"get_gasless_public_key",params:[]})}handleDappStorageKey(t){const n=`${zi.localStorageKeyPrefix}${window.location.hostname}`;let r="";if(bh&&t){const i=window.localStorage.getItem(n);if(i)r=i;else{const o=`torus-app-${Fn()}`;window.localStorage.setItem(n,o),r=o}}return this.dappStorageKey=r,r}async _setupWeb3(t){le.info("setupWeb3 running");const n=new Zo({name:"embed_torus",target:"iframe_torus",targetWindow:this.torusIframe.contentWindow}),r=new Zo({name:"embed_communication",target:"iframe_communication",targetWindow:this.torusIframe.contentWindow}),i=new mn(n,{}),o=new br(r,{});i.tryWindowHandle=(u,g)=>{const p=u;if(!Array.isArray(p)&&gh.includes(p.method)){if(!this.communicationProvider.isLoggedIn)throw new Error("User Not Logged In");const v=Fn();o._handleWindow(v,{target:"_blank",features:un(Ba)}),p.windowId=v}i._rpcEngine.handle(p,g)},o.tryWindowHandle=(u,g)=>{const p=u;if(!Array.isArray(p)&&ph.includes(p.method)){const v=Fn();o._handleWindow(v,{target:"_blank",features:un(ah)}),p.params.windowId=v}o._rpcEngine.handle(p,g)};const s=u=>{const g=i[u],p=this;i[u]=function(S,R){const{method:h,params:w=[]}=S;if(h==="solana_requestAccounts"){if(!R)return p.login({loginProvider:w[0]});p.login({loginProvider:w[0]}).then(y=>R(null,y)).catch(y=>R(y))}return g.apply(this,[S,R])}};s("request"),s("sendAsync"),s("send");const a=new Proxy(i,{deleteProperty:()=>!0}),f=new Proxy(o,{deleteProperty:()=>!0});this.provider=a,this.communicationProvider=f,await Promise.all([i._initializeState(),o._initializeState(je(je({},t),{},{dappStorageKey:this.dappStorageKey,torusAlertContainer:this.torusAlertContainer,torusIframe:this.torusIframe}))]),le.debug("Torus - injected provider")}}exports.BUTTON_POSITION=jt;exports.TORUS_BUILD_ENV=La;exports.TorusInPageProvider=mn;exports.default=wh;
|
package/lib/sui-Bs83Gy5Z.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var F=Object.defineProperty;var V=(r,e,t)=>e in r?F(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t;var m=(r,e,t)=>V(r,typeof e!="symbol"?e+"":e,t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("./platform-B1XoDKoN.js"),u=require("./address-BGujeWtN.js"),h=require("./address-C7DIAk4M.js"),_=require("./blake2b-B-MRXUPb.js"),$=require("./index-CTPz98nv.js");var E={};Object.defineProperty(E,"__esModule",{value:!0});E.bech32m=b=E.bech32=void 0;const K="qpzry9x8gf2tvdw0s3jn54khce6mua7l",L={};for(let r=0;r<K.length;r++){const e=K.charAt(r);L[e]=r}function S(r){const e=r>>25;return(r&33554431)<<5^-(e>>0&1)&996825010^-(e>>1&1)&642813549^-(e>>2&1)&513874426^-(e>>3&1)&1027748829^-(e>>4&1)&705979059}function D(r){let e=1;for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);if(n<33||n>126)return"Invalid prefix ("+r+")";e=S(e)^n>>5}e=S(e);for(let t=0;t<r.length;++t){const n=r.charCodeAt(t);e=S(e)^n&31}return e}function k(r,e,t,n){let i=0,o=0;const s=(1<<t)-1,c=[];for(let a=0;a<r.length;++a)for(i=i<<e|r[a],o+=e;o>=t;)o-=t,c.push(i>>o&s);if(n)o>0&&c.push(i<<t-o&s);else{if(o>=e)return"Excess padding";if(i<<t-o&s)return"Non-zero padding"}return c}function G(r){return k(r,8,5,!0)}function Z(r){const e=k(r,5,8,!1);if(Array.isArray(e))return e}function j(r){const e=k(r,5,8,!1);if(Array.isArray(e))return e;throw new Error(e)}function q(r){let e;r==="bech32"?e=1:e=734539939;function t(s,c,a){if(a=a||90,s.length+7+c.length>a)throw new TypeError("Exceeds length limit");s=s.toLowerCase();let f=D(s);if(typeof f=="string")throw new Error(f);let y=s+"1";for(let l=0;l<c.length;++l){const g=c[l];if(g>>5)throw new Error("Non 5-bit word");f=S(f)^g,y+=K.charAt(g)}for(let l=0;l<6;++l)f=S(f);f^=e;for(let l=0;l<6;++l){const g=f>>(5-l)*5&31;y+=K.charAt(g)}return y}function n(s,c){if(c=c||90,s.length<8)return s+" too short";if(s.length>c)return"Exceeds length limit";const a=s.toLowerCase(),f=s.toUpperCase();if(s!==a&&s!==f)return"Mixed-case string "+s;s=a;const y=s.lastIndexOf("1");if(y===-1)return"No separator character for "+s;if(y===0)return"Missing prefix for "+s;const l=s.slice(0,y),g=s.slice(y+1);if(g.length<6)return"Data too short";let w=D(l);if(typeof w=="string")return w;const I=[];for(let v=0;v<g.length;++v){const C=g.charAt(v),P=L[C];if(P===void 0)return"Unknown character "+C;w=S(w)^P,!(v+6>=g.length)&&I.push(P)}return w!==e?"Invalid checksum for "+s:{prefix:l,words:I}}function i(s,c){const a=n(s,c);if(typeof a=="object")return a}function o(s,c){const a=n(s,c);if(typeof a=="object")return a;throw new Error(a)}return{decodeUnsafe:i,decode:o,encode:t,toWords:G,fromWordsUnsafe:Z,fromWords:j}}var b=E.bech32=q("bech32");E.bech32m=q("bech32m");function M(r,e){return d.suiBcs.IntentMessage(d.suiBcs.fixedArray(e.length,d.suiBcs.u8())).serialize({intent:{scope:{[r]:!0},version:{V0:!0},appId:{Sui:!0}},value:e}).toBytes()}const B={ED25519:0,Secp256k1:1,Secp256r1:2,MultiSig:3,ZkLogin:5,Passkey:6},Y={ED25519:32,Secp256k1:33,Secp256r1:33},N={0:"ED25519",1:"Secp256k1",2:"Secp256r1",3:"MultiSig",5:"ZkLogin",6:"Passkey"};function W(r,e){if(r===e)return!0;if(r.length!==e.length)return!1;for(let t=0;t<r.length;t++)if(r[t]!==e[t])return!1;return!0}class X{equals(e){return W(this.toRawBytes(),e.toRawBytes())}toBase64(){return h.toBase64(this.toRawBytes())}toString(){throw new Error("`toString` is not implemented on public keys. Use `toBase64()` or `toRawBytes()` instead.")}toSuiPublicKey(){const e=this.toSuiBytes();return h.toBase64(e)}verifyWithIntent(e,t,n){const i=M(n,e),o=_.blake2b(i,{dkLen:32});return this.verify(o,t)}verifyPersonalMessage(e,t){return this.verifyWithIntent(d.suiBcs.vector(d.suiBcs.u8()).serialize(e).toBytes(),t,"PersonalMessage")}verifyTransaction(e,t){return this.verifyWithIntent(e,t,"TransactionData")}verifyAddress(e){return this.toSuiAddress()===e}toSuiBytes(){const e=this.toRawBytes(),t=new Uint8Array(e.length+1);return t.set([this.flag()]),t.set(e,1),t}toSuiAddress(){return h.normalizeSuiAddress(u.bytesToHex(_.blake2b(this.toSuiBytes(),{dkLen:32})).slice(0,h.SUI_ADDRESS_LENGTH*2))}}function J(r){const e=h.fromBase64(r),t=N[e[0]];switch(t){case"ED25519":case"Secp256k1":case"Secp256r1":const n=Y[t],i=e.slice(1,e.length-n),o=e.slice(1+i.length);return{serializedSignature:r,signatureScheme:t,signature:i,publicKey:o,bytes:e};default:throw new Error("Unsupported signature scheme")}}function Q({signature:r,signatureScheme:e,publicKey:t}){if(!t)throw new Error("`publicKey` is required");const n=t.toRawBytes(),i=new Uint8Array(1+r.length+n.length);return i.set([B[e]]),i.set(r,1),i.set(n,1+r.length),h.toBase64(i)}const A=32,H="suiprivkey";class ee{async signWithIntent(e,t){const n=M(t,e),i=_.blake2b(n,{dkLen:32});return{signature:Q({signature:await this.sign(i),signatureScheme:this.getKeyScheme(),publicKey:this.getPublicKey()}),bytes:h.toBase64(e)}}async signTransaction(e){return this.signWithIntent(e,"TransactionData")}async signPersonalMessage(e){const{signature:t}=await this.signWithIntent(d.bcs.vector(d.bcs.u8()).serialize(e).toBytes(),"PersonalMessage");return{bytes:h.toBase64(e),signature:t}}toSuiAddress(){return this.getPublicKey().toSuiAddress()}}class te extends ee{}function re(r){const{prefix:e,words:t}=b.decode(r);if(e!==H)throw new Error("invalid private key prefix");const n=new Uint8Array(b.fromWords(t)),i=n.slice(1);return{schema:N[n[0]],secretKey:i}}function ne(r,e){if(r.length!==A)throw new Error("Invalid bytes length");const t=B[e],n=new Uint8Array(r.length+1);return n.set([t]),n.set(r,1),b.encode(H,b.toWords(n))}function R(r){return!!new RegExp("^m\\/44'\\/784'\\/[0-9]+'\\/[0-9]+'\\/[0-9]+'+$").test(r)}function se(r){return $.mnemonicToSeedSync(r,"")}function ie(r){return h.toHex(se(r))}const oe="ed25519 seed",ce=2147483648,ae=new RegExp("^m(\\/[0-9]+')+$"),z=r=>r.replace("'",""),ue=r=>{const t=u.hmac.create(u.sha512,oe).update(h.fromHex(r)).digest(),n=t.slice(0,32),i=t.slice(32);return{key:n,chainCode:i}},le=({key:r,chainCode:e},t)=>{const n=new ArrayBuffer(4);new DataView(n).setUint32(0,t);const o=new Uint8Array(1+r.length+n.byteLength);o.set(new Uint8Array(1).fill(0)),o.set(r,1),o.set(new Uint8Array(n,0,n.byteLength),r.length+1);const s=u.hmac.create(u.sha512,e).update(o).digest(),c=s.slice(0,32),a=s.slice(32);return{key:c,chainCode:a}},de=r=>ae.test(r)?!r.split("/").slice(1).map(z).some(isNaN):!1,T=(r,e,t=ce)=>{if(!de(r))throw new Error("Invalid derivation path");const{key:n,chainCode:i}=ue(e);return r.split("/").slice(1).map(z).map(s=>parseInt(s,10)).reduce((s,c)=>le(s,c+t),{key:n,chainCode:i})},x=32;class O extends X{constructor(e){if(super(),typeof e=="string"?this.data=h.fromBase64(e):e instanceof Uint8Array?this.data=e:this.data=Uint8Array.from(e),this.data.length!==x)throw new Error(`Invalid public key input. Expected ${x} bytes, got ${this.data.length}`)}equals(e){return super.equals(e)}toRawBytes(){return this.data}flag(){return B.ED25519}async verify(e,t){let n;if(typeof t=="string"){const i=J(t);if(i.signatureScheme!=="ED25519")throw new Error("Invalid signature scheme");if(!W(this.toRawBytes(),i.publicKey))throw new Error("Signature does not match public key");n=i.signature}else n=t;return u.ed25519.verify(n,e,this.toRawBytes())}}O.SIZE=x;const U="m/44'/784'/0'/0'/0'";class p extends te{constructor(e){if(super(),e)this.keypair={publicKey:e.publicKey,secretKey:e.secretKey.slice(0,32)};else{const t=u.ed25519.utils.randomPrivateKey();this.keypair={publicKey:u.ed25519.getPublicKey(t),secretKey:t}}}getKeyScheme(){return"ED25519"}static generate(){const e=u.ed25519.utils.randomPrivateKey();return new p({publicKey:u.ed25519.getPublicKey(e),secretKey:e})}static fromSecretKey(e,t){if(typeof e=="string"){const o=re(e);if(o.schema!=="ED25519")throw new Error(`Expected a ED25519 keypair, got ${o.schema}`);return this.fromSecretKey(o.secretKey,t)}const n=e.length;if(n!==A)throw new Error(`Wrong secretKey size. Expected ${A} bytes, got ${n}.`);const i={publicKey:u.ed25519.getPublicKey(e),secretKey:e};if(!t||!t.skipValidation){const s=new TextEncoder().encode("sui validation"),c=u.ed25519.sign(s,e);if(!u.ed25519.verify(c,s,i.publicKey))throw new Error("provided secretKey is invalid")}return new p(i)}getPublicKey(){return new O(this.keypair.publicKey)}getSecretKey(){return ne(this.keypair.secretKey.slice(0,A),this.getKeyScheme())}async sign(e){return u.ed25519.sign(e,this.keypair.secretKey)}static deriveKeypair(e,t){if(t==null&&(t=U),!R(t))throw new Error("Invalid derivation path");const{key:n}=T(t,ie(e));return p.fromSecretKey(n)}static deriveKeypairFromSeed(e,t){if(t==null&&(t=U),!R(t))throw new Error("Invalid derivation path");const{key:n}=T(t,e);return p.fromSecretKey(n)}}async function he(r,e){const[,t]=await d.SuiPlatform.chainFromRpc(r);return new fe(t,r,p.deriveKeypair(e,"m/44'/784'/0'/0'/0'"))}class fe{constructor(e,t,n,i){m(this,"_chain");m(this,"_client");m(this,"_signer");m(this,"_debug");this._chain=e,this._client=t,this._signer=n,this._debug=i}chain(){return this._chain}address(){return this._signer.toSuiAddress()}async signAndSend(e){const t=[];for(const n of e){const{description:i,transaction:o}=n;this._debug&&console.log(`Signing ${i} for ${this.address()}`);try{const s=await this._client.signAndExecuteTransaction({transaction:o,signer:this._signer});t.push(s.digest)}catch(s){throw s}}return t}}const ge={Address:h.SuiAddress,Platform:d.SuiPlatform,getSigner:he,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-CqOI6LVu.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-Bpp8C4u8.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-ClMoiji-.js"))},getChain:(r,e,t)=>new d.SuiChain(e,new d.SuiPlatform(r,u.applyChainsConfigConfigOverrides(r,d._platform,{[e]:t})))};exports.default=ge;
|
package/lib/units-BvcKDiAx.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var k=Object.defineProperty;var _=s=>{throw TypeError(s)};var P=(s,t,e)=>t in s?k(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var y=(s,t,e)=>P(s,typeof t!="symbol"?t+"":t,e),E=(s,t,e)=>t.has(s)||_("Cannot "+e);var r=(s,t,e)=>(E(s,t,"read from private field"),e?e.call(s):t.get(s)),A=(s,t,e)=>t.has(s)?_("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),B=(s,t,e,i)=>(E(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e),l=(s,t,e)=>(E(s,t,"access private method"),e);const a=require("./address-BGujeWtN.js"),w=require("./contract-D2fTrJgn.js"),Z=BigInt(-1),g=BigInt(0),x=BigInt(1),j=BigInt(5),N={};let I="0000";for(;I.length<80;)I+=I;function p(s){let t=I;for(;t.length<s;)t+=t;return BigInt("1"+t.substring(0,s))}function F(s,t,e){const i=BigInt(t.width);if(t.signed){const n=x<<i-x;a.assert(e==null||s>=-n&&s<n,"overflow","NUMERIC_FAULT",{operation:e,fault:"overflow",value:s}),s>g?s=w.fromTwos(w.mask(s,i),i):s=-w.fromTwos(w.mask(-s,i),i)}else{const n=x<<i;a.assert(e==null||s>=0&&s<n,"overflow","NUMERIC_FAULT",{operation:e,fault:"overflow",value:s}),s=(s%n+n)%n&n-x}return s}function C(s){typeof s=="number"&&(s=`fixed128x${s}`);let t=!0,e=128,i=18;if(typeof s=="string"){if(s!=="fixed")if(s==="ufixed")t=!1;else{const h=s.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);a.assertArgument(h,"invalid fixed format","format",s),t=h[1]!=="u",e=parseInt(h[2]),i=parseInt(h[3])}}else if(s){const h=s,f=(d,S,q)=>h[d]==null?q:(a.assertArgument(typeof h[d]===S,"invalid fixed format ("+d+" not "+S+")","format."+d,h[d]),h[d]);t=f("signed","boolean",t),e=f("width","number",e),i=f("decimals","number",i)}a.assertArgument(e%8===0,"invalid FixedNumber width (not byte aligned)","format.width",e),a.assertArgument(i<=80,"invalid FixedNumber decimals (too large)","format.decimals",i);const n=(t?"":"u")+"fixed"+String(e)+"x"+String(i);return{signed:t,width:e,decimals:i,name:n}}function D(s,t){let e="";s<g&&(e="-",s*=Z);let i=s.toString();if(t===0)return e+i;for(;i.length<=t;)i=I+i;const n=i.length-t;for(i=i.substring(0,n)+"."+i.substring(n);i[0]==="0"&&i[1]!==".";)i=i.substring(1);for(;i[i.length-1]==="0"&&i[i.length-2]!==".";)i=i.substring(0,i.length-1);return e+i}var c,u,m,o,U,b,L,M,R,V;const v=class v{constructor(t,e,i){A(this,o);y(this,"format");A(this,c);A(this,u);A(this,m);y(this,"_value");a.assertPrivate(t,N,"FixedNumber"),B(this,u,e),B(this,c,i);const n=D(e,i.decimals);a.defineProperties(this,{format:i.name,_value:n}),B(this,m,p(i.decimals))}get signed(){return r(this,c).signed}get width(){return r(this,c).width}get decimals(){return r(this,c).decimals}get value(){return r(this,u)}addUnsafe(t){return l(this,o,L).call(this,t)}add(t){return l(this,o,L).call(this,t,"add")}subUnsafe(t){return l(this,o,M).call(this,t)}sub(t){return l(this,o,M).call(this,t,"sub")}mulUnsafe(t){return l(this,o,R).call(this,t)}mul(t){return l(this,o,R).call(this,t,"mul")}mulSignal(t){l(this,o,U).call(this,t);const e=r(this,u)*r(t,u);return a.assert(e%r(this,m)===g,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),l(this,o,b).call(this,e/r(this,m),"mulSignal")}divUnsafe(t){return l(this,o,V).call(this,t)}div(t){return l(this,o,V).call(this,t,"div")}divSignal(t){a.assert(r(t,u)!==g,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),l(this,o,U).call(this,t);const e=r(this,u)*r(this,m);return a.assert(e%r(t,u)===g,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),l(this,o,b).call(this,e/r(t,u),"divSignal")}cmp(t){let e=this.value,i=t.value;const n=this.decimals-t.decimals;return n>0?i*=p(n):n<0&&(e*=p(-n)),e<i?-1:e>i?1:0}eq(t){return this.cmp(t)===0}lt(t){return this.cmp(t)<0}lte(t){return this.cmp(t)<=0}gt(t){return this.cmp(t)>0}gte(t){return this.cmp(t)>=0}floor(){let t=r(this,u);return r(this,u)<g&&(t-=r(this,m)-x),t=r(this,u)/r(this,m)*r(this,m),l(this,o,b).call(this,t,"floor")}ceiling(){let t=r(this,u);return r(this,u)>g&&(t+=r(this,m)-x),t=r(this,u)/r(this,m)*r(this,m),l(this,o,b).call(this,t,"ceiling")}round(t){if(t==null&&(t=0),t>=this.decimals)return this;const e=this.decimals-t,i=j*p(e-1);let n=this.value+i;const h=p(e);return n=n/h*h,F(n,r(this,c),"round"),new v(N,n,r(this,c))}isZero(){return r(this,u)===g}isNegative(){return r(this,u)<g}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(t){return v.fromString(this.toString(),t)}static fromValue(t,e,i){const n=e==null?0:w.getNumber(e),h=C(i);let f=w.getBigInt(t,"value");const d=n-h.decimals;if(d>0){const S=p(d);a.assert(f%S===g,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:t}),f/=S}else d<0&&(f*=p(-d));return F(f,h,"fromValue"),new v(N,f,h)}static fromString(t,e){const i=t.match(/^(-?)([0-9]*)\.?([0-9]*)$/);a.assertArgument(i&&i[2].length+i[3].length>0,"invalid FixedNumber string value","value",t);const n=C(e);let h=i[2]||"0",f=i[3]||"";for(;f.length<n.decimals;)f+=I;a.assert(f.substring(n.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:t}),f=f.substring(0,n.decimals);const d=BigInt(i[1]+h+f);return F(d,n,"fromString"),new v(N,d,n)}static fromBytes(t,e){let i=w.toBigInt(a.getBytes(t,"value"));const n=C(e);return n.signed&&(i=w.fromTwos(i,n.width)),F(i,n,"fromBytes"),new v(N,i,n)}};c=new WeakMap,u=new WeakMap,m=new WeakMap,o=new WeakSet,U=function(t){a.assertArgument(this.format===t.format,"incompatible format; use fixedNumber.toFormat","other",t)},b=function(t,e){return t=F(t,r(this,c),e),new v(N,t,r(this,c))},L=function(t,e){return l(this,o,U).call(this,t),l(this,o,b).call(this,r(this,u)+r(t,u),e)},M=function(t,e){return l(this,o,U).call(this,t),l(this,o,b).call(this,r(this,u)-r(t,u),e)},R=function(t,e){return l(this,o,U).call(this,t),l(this,o,b).call(this,r(this,u)*r(t,u)/r(this,m),e)},V=function(t,e){return a.assert(r(t,u)!==g,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),l(this,o,U).call(this,t),l(this,o,b).call(this,r(this,u)*r(this,m)/r(t,u),e)};let T=v;const z=["wei","kwei","mwei","gwei","szabo","finney","ether"];function $(s,t){let e=18;if(typeof t=="string"){const i=z.indexOf(t);a.assertArgument(i>=0,"invalid unit","unit",t),e=3*i}else t!=null&&(e=w.getNumber(t,"unit"));return T.fromValue(s,e,{decimals:e,width:512}).toString()}function G(s,t){a.assertArgument(typeof s=="string","value must be a string","value",s);let e=18;if(typeof t=="string"){const i=z.indexOf(t);a.assertArgument(i>=0,"invalid unit","unit",t),e=3*i}else t!=null&&(e=w.getNumber(t,"unit"));return T.fromString(s,{decimals:e,width:512}).value}function H(s){return $(s,18)}exports.formatEther=H;exports.formatUnits=$;exports.parseUnits=G;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";var b=Object.defineProperty;var v=(c,t,n)=>t in c?b(c,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):c[t]=n;var m=(c,t,n)=>v(c,typeof t!="symbol"?t+"":t,n);const a=require("./address-BGujeWtN.js"),B=require("./chain-Hsn22HAP.js");class y extends B.ChainContext{async getTokenAccount(t,n){const{getAssociatedTokenAddress:e}=await Promise.resolve().then(()=>require("./index-DZubce9o.js")),i=new a.SolanaAddress(n).unwrap(),s=new a.SolanaAddress(t).unwrap(),r=await e(i,s);return{chain:this.chain,address:new a.SolanaAddress(r.toString())}}}const f=new a.PublicKey("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"),g=new a.PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb"),E=new a.PublicKey("ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL");new a.PublicKey("So11111111111111111111111111111111111111112");new a.PublicKey("9pan9bMn5HatX4EJdBwg9VgCa7Uz5HL8N1m5D3NdXejP");const u=class u extends a.PlatformContext{constructor(t,n){super(t,n??a.networkPlatformConfigs(t,u._platform))}getRpc(t,n={commitment:"confirmed",disableRetryOnRateLimit:!0}){if(t in this.config)return new a.Connection(this.config[t].rpc,n);throw new Error("No configuration available for chain: "+t)}getChain(t,n){if(t in this.config)return new y(t,this,n);throw new Error("No configuration available for chain: "+t)}static nativeTokenId(t,n){if(!u.isSupportedChain(n))throw new Error(`invalid chain: ${n}`);return a.Wormhole.chainAddress(n,a.SolanaZeroAddress)}static isNativeTokenId(t,n,e){return!this.isSupportedChain(n)||e.chain!==n?!1:this.nativeTokenId(t,n)==e}static isSupportedChain(t){return a.chainToPlatform(t)===u._platform}static async getDecimals(t,n,e,i){if(a.isNative(i))return a.nativeDecimals(u._platform);let s=await e.getParsedAccountInfo(new a.SolanaAddress(i).unwrap());if(!s||!s.value)throw new Error("could not fetch token details");const{decimals:r}=s.value.data.parsed.info;return r}static async getBalance(t,n,e,i,s){const r=new a.PublicKey(i);if(a.isNative(s))return BigInt(await e.getBalance(r));const l=await e.getTokenAccountsByOwner(r,{mint:new a.SolanaAddress(s).unwrap()}),o=l.value.length>0?l.value[0].pubkey:r,h=await e.getTokenAccountBalance(o);return BigInt(h.value.amount)}static async getBalances(t,n,e,i){const s=BigInt(await e.getBalance(new a.PublicKey(i))),r=(await Promise.all([f,g].map(o=>new a.PublicKey(o)).map(o=>e.getParsedTokenAccountsByOwner(new a.PublicKey(i),{programId:o})))).reduce((o,h)=>o.concat(h.value),[]),l={native:s};return r.forEach(o=>{var w,k,T,P,A;const h=(k=(w=o.account.data.parsed)==null?void 0:w.info)==null?void 0:k.mint,d=(A=(P=(T=o.account.data.parsed)==null?void 0:T.info)==null?void 0:P.tokenAmount)==null?void 0:A.amount;h&&d&&(l[h]=BigInt(d))}),l}static async sendWait(t,n,e,i){const s=await Promise.all(e.map(o=>this.sendTxWithRetry(n,o,i))),r=s.map(o=>o.signature),l=s.filter(o=>o.response.value.err).map(o=>o.response.value.err);if(l.length>0)throw new Error(`Failed to confirm transaction: ${l}`);return r}static async sendTxWithRetry(t,n,e={},i=5e3){const s=e.preflightCommitment??t.commitment,r=await t.sendRawTransaction(n,{...e,skipPreflight:!1,maxRetries:0,preflightCommitment:s}),{blockhash:l,lastValidBlockHeight:o}=await t.getLatestBlockhash(),h=t.confirmTransaction({signature:r,blockhash:l,lastValidBlockHeight:o},s);let d=null;for(;!d&&(d=await Promise.race([h,new Promise(w=>setTimeout(()=>{w(null)},i))]),!d);)await t.sendRawTransaction(n,{...e,skipPreflight:!0,maxRetries:0,preflightCommitment:s});return{signature:r,response:d}}static async latestBlock(t,n){return t.getLatestBlockhash(n??t.commitment)}static async getLatestBlock(t){return await t.getSlot()}static async getLatestFinalizedBlock(t){const{lastValidBlockHeight:n}=await this.latestBlock(t,"finalized");return n}static chainFromChainId(t){const n=a.platformNativeChainIdToNetworkChain(u._platform,t);if(!n)throw new Error(`No matching genesis hash to determine network and chain: ${t}`);const[e,i]=n;return[e,i]}static async chainFromRpc(t){try{const n=await t.getGenesisHash();return u.chainFromChainId(n)}catch(n){if(t.rpcEndpoint.includes("http://127")||t.rpcEndpoint.includes("http://localhost")||t.rpcEndpoint==="http://solana-devnet:8899")return["Devnet","Solana"];throw n}}static async getTokenProgramId(t,n){const e=await t.getAccountInfo(n);if(!e)throw new Error(`Mint account not found: ${n.toBase58()}`);const i=e.owner;if(!i)throw new Error(`Mint account has no owner: ${n.toBase58()}`);if(i.equals(f)||i.equals(g))return i;throw new Error(`Mint account has unsupported token program: ${n.toBase58()} (${i.toBase58()})`)}};m(u,"_platform",a._platform$1);let p=u;class C{constructor(t,n,e,i,s=!1){m(this,"transaction");m(this,"network");m(this,"chain");m(this,"description");m(this,"parallelizable");this.transaction=t,this.network=n,this.chain=e,this.description=i,this.parallelizable=s}}function R(c){return c.signatures!==void 0&&c.message!==void 0}exports.ASSOCIATED_TOKEN_PROGRAM_ID=E;exports.SolanaChain=y;exports.SolanaPlatform=p;exports.SolanaUnsignedTransaction=C;exports.TOKEN_2022_PROGRAM_ID=g;exports.TOKEN_PROGRAM_ID=f;exports.isVersionedTransaction=R;
|