@aptos-labs/ts-sdk 0.0.6 → 0.0.8
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 +26 -5
- package/dist/browser/index.d.ts +1097 -519
- package/dist/browser/index.global.js +49 -28
- package/dist/browser/index.global.js.map +1 -1
- package/dist/common/index.d.ts +1097 -519
- package/dist/common/index.js +48 -27
- package/dist/common/index.js.map +1 -1
- package/dist/esm/api/account.d.mts +72 -47
- package/dist/esm/api/account.mjs +1 -1
- package/dist/esm/api/ans.d.mts +214 -18
- package/dist/esm/api/ans.mjs +1 -1
- package/dist/esm/api/aptos.d.mts +9 -0
- package/dist/esm/api/aptos.mjs +1 -1
- package/dist/esm/api/aptosConfig.d.mts +2 -2
- package/dist/esm/api/aptosConfig.mjs +1 -1
- package/dist/esm/api/coin.d.mts +6 -5
- package/dist/esm/api/coin.mjs +1 -1
- package/dist/esm/api/digitalAsset.d.mts +24 -21
- package/dist/esm/api/digitalAsset.mjs +1 -1
- package/dist/esm/api/event.d.mts +12 -14
- package/dist/esm/api/event.mjs +1 -1
- package/dist/esm/api/faucet.d.mts +4 -4
- package/dist/esm/api/faucet.mjs +1 -1
- package/dist/esm/api/fungibleAsset.d.mts +71 -30
- package/dist/esm/api/fungibleAsset.mjs +1 -1
- package/dist/esm/api/general.d.mts +12 -5
- package/dist/esm/api/general.mjs +1 -1
- package/dist/esm/api/index.d.mts +5 -0
- package/dist/esm/api/index.mjs +1 -1
- package/dist/esm/api/staking.d.mts +13 -9
- package/dist/esm/api/staking.mjs +1 -1
- package/dist/esm/api/transaction.d.mts +36 -2
- package/dist/esm/api/transaction.mjs +1 -1
- package/dist/esm/api/transactionSubmission/build.d.mts +54 -0
- package/dist/esm/api/transactionSubmission/build.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.d.mts +51 -0
- package/dist/esm/api/transactionSubmission/sign.mjs +2 -0
- package/dist/esm/api/transactionSubmission/sign.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/simulate.d.mts +54 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs +2 -0
- package/dist/esm/api/transactionSubmission/simulate.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission/submit.d.mts +52 -0
- package/dist/esm/api/transactionSubmission/submit.mjs +2 -0
- package/dist/esm/api/transactionSubmission/submit.mjs.map +1 -0
- package/dist/esm/api/transactionSubmission.d.mts +25 -54
- package/dist/esm/api/transactionSubmission.mjs +1 -1
- package/dist/esm/api/utils.d.mts +21 -0
- package/dist/esm/api/utils.mjs +2 -0
- package/dist/esm/api/utils.mjs.map +1 -0
- package/dist/esm/bcs/deserializer.d.mts +4 -4
- package/dist/esm/bcs/deserializer.mjs +1 -1
- package/dist/esm/bcs/index.mjs +1 -1
- package/dist/esm/bcs/serializable/entryFunctionBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/fixedBytes.mjs +1 -1
- package/dist/esm/bcs/serializable/movePrimitives.mjs +1 -1
- package/dist/esm/bcs/serializable/moveStructs.mjs +1 -1
- package/dist/esm/bcs/serializer.d.mts +4 -4
- package/dist/esm/bcs/serializer.mjs +1 -1
- package/dist/esm/{chunk-UAAI3NCA.mjs → chunk-2SAKPC5Q.mjs} +2 -2
- package/dist/esm/chunk-2YQXX64E.mjs +2 -0
- package/dist/esm/chunk-2YQXX64E.mjs.map +1 -0
- package/dist/esm/chunk-3F5WV6US.mjs +2 -0
- package/dist/esm/chunk-3F5WV6US.mjs.map +1 -0
- package/dist/esm/{chunk-ARVSIDVB.mjs → chunk-3RMXGSHK.mjs} +2 -2
- package/dist/esm/chunk-3RMXGSHK.mjs.map +1 -0
- package/dist/esm/{chunk-4ADA5BE7.mjs → chunk-53DS6NBQ.mjs} +2 -2
- package/dist/esm/chunk-5CUNY7X2.mjs +2 -0
- package/dist/esm/chunk-5CUNY7X2.mjs.map +1 -0
- package/dist/esm/{chunk-QWVR4RCV.mjs → chunk-5OPOJ43H.mjs} +2 -2
- package/dist/esm/{chunk-V45RFKH7.mjs → chunk-5UY5OKXR.mjs} +2 -2
- package/dist/esm/chunk-5UY5OKXR.mjs.map +1 -0
- package/dist/esm/chunk-5ZVCSKFX.mjs +2 -0
- package/dist/esm/chunk-5ZVCSKFX.mjs.map +1 -0
- package/dist/esm/{chunk-HVADSXTB.mjs → chunk-73VWOS4Z.mjs} +2 -2
- package/dist/esm/chunk-ALFESCPU.mjs +2 -0
- package/dist/esm/chunk-ALFESCPU.mjs.map +1 -0
- package/dist/esm/chunk-APSQ4M23.mjs +2 -0
- package/dist/esm/chunk-APSQ4M23.mjs.map +1 -0
- package/dist/esm/{chunk-U25N2VWA.mjs → chunk-AZUWHKN5.mjs} +2 -2
- package/dist/esm/{chunk-WX43AJTD.mjs → chunk-BQSE5HHW.mjs} +45 -24
- package/dist/esm/chunk-BQSE5HHW.mjs.map +1 -0
- package/dist/esm/chunk-CCXMVVXD.mjs +2 -0
- package/dist/esm/chunk-CCXMVVXD.mjs.map +1 -0
- package/dist/esm/{chunk-JZNLZMUC.mjs → chunk-CJPCOS4R.mjs} +2 -2
- package/dist/esm/{chunk-S36IYY6K.mjs → chunk-CL5B2QNS.mjs} +2 -2
- package/dist/esm/chunk-CLJLQXFQ.mjs +2 -0
- package/dist/esm/chunk-CLJLQXFQ.mjs.map +1 -0
- package/dist/esm/{chunk-EWTHPMEE.mjs → chunk-CU2DINU4.mjs} +2 -2
- package/dist/esm/chunk-EFRFDFS4.mjs +2 -0
- package/dist/esm/chunk-EFRFDFS4.mjs.map +1 -0
- package/dist/esm/chunk-EOC4UI5B.mjs +2 -0
- package/dist/esm/{chunk-KC64ESLO.mjs.map → chunk-EOC4UI5B.mjs.map} +1 -1
- package/dist/esm/{chunk-HA6JD5R6.mjs → chunk-F6K26WV5.mjs} +2 -2
- package/dist/esm/{chunk-HA6JD5R6.mjs.map → chunk-F6K26WV5.mjs.map} +1 -1
- package/dist/esm/chunk-F7EWDYTE.mjs +2 -0
- package/dist/esm/chunk-F7EWDYTE.mjs.map +1 -0
- package/dist/esm/{chunk-44MGBJ73.mjs → chunk-FZ56IS3E.mjs} +2 -2
- package/dist/esm/chunk-G36AY4R7.mjs +2 -0
- package/dist/esm/chunk-G36AY4R7.mjs.map +1 -0
- package/dist/esm/chunk-GEZSEAL5.mjs +2 -0
- package/dist/esm/chunk-GEZSEAL5.mjs.map +1 -0
- package/dist/esm/chunk-GIZLK7M7.mjs +2 -0
- package/dist/esm/chunk-GIZLK7M7.mjs.map +1 -0
- package/dist/esm/chunk-GMG4VR3K.mjs +2 -0
- package/dist/esm/chunk-GMG4VR3K.mjs.map +1 -0
- package/dist/esm/{chunk-U6SZNNVL.mjs → chunk-GXPGRCSW.mjs} +2 -2
- package/dist/esm/{chunk-U6SZNNVL.mjs.map → chunk-GXPGRCSW.mjs.map} +1 -1
- package/dist/esm/{chunk-GEFQFRL3.mjs → chunk-HC5VMNXA.mjs} +2 -2
- package/dist/esm/chunk-HTI5LEST.mjs +2 -0
- package/dist/esm/chunk-HTI5LEST.mjs.map +1 -0
- package/dist/esm/chunk-IELTCGLP.mjs +2 -0
- package/dist/esm/chunk-IELTCGLP.mjs.map +1 -0
- package/dist/esm/chunk-IHYTP2EW.mjs +1 -0
- package/dist/esm/chunk-IHYTP2EW.mjs.map +1 -0
- package/dist/esm/chunk-JI2BBZ2W.mjs +2 -0
- package/dist/esm/{chunk-3JVGSFHP.mjs.map → chunk-JI2BBZ2W.mjs.map} +1 -1
- package/dist/esm/chunk-KKER5KL4.mjs +2 -0
- package/dist/esm/chunk-KKER5KL4.mjs.map +1 -0
- package/dist/esm/chunk-KNMWDGP4.mjs +2 -0
- package/dist/esm/chunk-KNMWDGP4.mjs.map +1 -0
- package/dist/esm/{chunk-YYRDFZE6.mjs → chunk-KZSJ5MFF.mjs} +2 -2
- package/dist/esm/{chunk-YYRDFZE6.mjs.map → chunk-KZSJ5MFF.mjs.map} +1 -1
- package/dist/esm/chunk-MWAMLQ25.mjs +2 -0
- package/dist/esm/chunk-MWAMLQ25.mjs.map +1 -0
- package/dist/esm/chunk-NL72WE3E.mjs +2 -0
- package/dist/esm/{chunk-TIH6ARYP.mjs.map → chunk-NL72WE3E.mjs.map} +1 -1
- package/dist/esm/chunk-NZSGGL25.mjs +2 -0
- package/dist/esm/chunk-NZSGGL25.mjs.map +1 -0
- package/dist/esm/chunk-OBOOY2QD.mjs +2 -0
- package/dist/esm/chunk-OBOOY2QD.mjs.map +1 -0
- package/dist/esm/chunk-OT2UDMUU.mjs +2 -0
- package/dist/esm/chunk-OT2UDMUU.mjs.map +1 -0
- package/dist/esm/chunk-OZZDXS26.mjs +2 -0
- package/dist/esm/chunk-OZZDXS26.mjs.map +1 -0
- package/dist/esm/chunk-P5747ZYC.mjs +2 -0
- package/dist/esm/chunk-P5747ZYC.mjs.map +1 -0
- package/dist/esm/{chunk-BPYLPPEQ.mjs → chunk-PL2VA73L.mjs} +2 -2
- package/dist/esm/chunk-PXTMLJKO.mjs +2 -0
- package/dist/esm/{chunk-JDS7K2WI.mjs → chunk-QCBIJCU4.mjs} +2 -2
- package/dist/esm/chunk-QEXAMHPU.mjs +2 -0
- package/dist/esm/chunk-QEXAMHPU.mjs.map +1 -0
- package/dist/esm/{chunk-KQXRH5FK.mjs → chunk-QNTV5NMH.mjs} +2 -2
- package/dist/esm/{chunk-EQ5BEDJ7.mjs → chunk-RCM3K5JL.mjs} +2 -2
- package/dist/esm/chunk-RLG3WOTH.mjs +2 -0
- package/dist/esm/chunk-RLG3WOTH.mjs.map +1 -0
- package/dist/esm/chunk-SDPICQ5B.mjs +2 -0
- package/dist/esm/{chunk-FYIFBLHU.mjs.map → chunk-SDPICQ5B.mjs.map} +1 -1
- package/dist/esm/chunk-SGTFMSOG.mjs +2 -0
- package/dist/esm/chunk-SGTFMSOG.mjs.map +1 -0
- package/dist/esm/chunk-SO6EE5DX.mjs +2 -0
- package/dist/esm/chunk-SO6EE5DX.mjs.map +1 -0
- package/dist/esm/chunk-SRGPSANH.mjs +2 -0
- package/dist/esm/chunk-SRGPSANH.mjs.map +1 -0
- package/dist/esm/{chunk-UPLWWSB4.mjs → chunk-SSJQOXEP.mjs} +2 -2
- package/dist/esm/chunk-TZ623H2V.mjs +2 -0
- package/dist/esm/chunk-TZ623H2V.mjs.map +1 -0
- package/dist/esm/chunk-U6Z4FNB7.mjs +2 -0
- package/dist/esm/chunk-U6Z4FNB7.mjs.map +1 -0
- package/dist/esm/{chunk-GTC7WHMV.mjs → chunk-UDMADMVO.mjs} +1 -1
- package/dist/esm/{chunk-GTC7WHMV.mjs.map → chunk-UDMADMVO.mjs.map} +1 -1
- package/dist/esm/chunk-UIVJXLRM.mjs +1 -0
- package/dist/esm/chunk-UIVJXLRM.mjs.map +1 -0
- package/dist/esm/chunk-UKSA4H2O.mjs +2 -0
- package/dist/esm/chunk-UKSA4H2O.mjs.map +1 -0
- package/dist/esm/chunk-UW6HQ643.mjs +2 -0
- package/dist/esm/chunk-UW6HQ643.mjs.map +1 -0
- package/dist/esm/chunk-UWXDXOFK.mjs +2 -0
- package/dist/esm/chunk-UWXDXOFK.mjs.map +1 -0
- package/dist/esm/chunk-VQ7LYNMD.mjs +2 -0
- package/dist/esm/chunk-VQ7LYNMD.mjs.map +1 -0
- package/dist/esm/{chunk-U3LO2FSJ.mjs → chunk-WTGGCH34.mjs} +2 -2
- package/dist/esm/{chunk-X32O46IB.mjs → chunk-XITLXPBK.mjs} +2 -2
- package/dist/esm/chunk-XMUUI6HG.mjs +2 -0
- package/dist/esm/{chunk-R3KWVOFG.mjs.map → chunk-XMUUI6HG.mjs.map} +1 -1
- package/dist/esm/chunk-XX2Z26FH.mjs +2 -0
- package/dist/esm/chunk-XX2Z26FH.mjs.map +1 -0
- package/dist/esm/chunk-Y6PVFMBS.mjs +2 -0
- package/dist/esm/chunk-Y6PVFMBS.mjs.map +1 -0
- package/dist/esm/{chunk-VWVEDCBM.mjs → chunk-YN6UIVFB.mjs} +2 -2
- package/dist/esm/chunk-ZFK7QD3B.mjs +2 -0
- package/dist/esm/chunk-ZFK7QD3B.mjs.map +1 -0
- package/dist/esm/chunk-ZJUDDSWN.mjs +2 -0
- package/dist/esm/chunk-ZJUDDSWN.mjs.map +1 -0
- package/dist/esm/client/core.mjs +1 -1
- package/dist/esm/client/get.d.mts +1 -1
- package/dist/esm/client/get.mjs +1 -1
- package/dist/esm/client/index.mjs +1 -1
- package/dist/esm/client/post.mjs +1 -1
- package/dist/esm/core/account.mjs +1 -1
- package/dist/esm/core/accountAddress.d.mts +9 -9
- package/dist/esm/core/accountAddress.mjs +1 -1
- package/dist/esm/core/authenticationKey.mjs +1 -1
- package/dist/esm/core/crypto/anyPublicKey.d.mts +5 -0
- package/dist/esm/core/crypto/anyPublicKey.mjs +1 -1
- package/dist/esm/core/crypto/anySignature.mjs +1 -1
- package/dist/esm/core/crypto/asymmetricCrypto.mjs +1 -1
- package/dist/esm/core/crypto/ed25519.d.mts +3 -0
- package/dist/esm/core/crypto/ed25519.mjs +1 -1
- package/dist/esm/core/crypto/index.d.mts +2 -2
- package/dist/esm/core/crypto/index.mjs +1 -1
- package/dist/esm/core/crypto/multiEd25519.mjs +1 -1
- package/dist/esm/core/crypto/multiKey.d.mts +2 -0
- package/dist/esm/core/crypto/multiKey.mjs +1 -1
- package/dist/esm/core/crypto/secp256k1.d.mts +3 -0
- package/dist/esm/core/crypto/secp256k1.mjs +1 -1
- package/dist/esm/core/hex.mjs +1 -1
- package/dist/esm/core/index.d.mts +2 -2
- package/dist/esm/core/index.mjs +1 -1
- package/dist/esm/index.d.mts +17 -10
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/internal/account.d.mts +20 -33
- package/dist/esm/internal/account.mjs +1 -1
- package/dist/esm/internal/ans.d.mts +78 -14
- package/dist/esm/internal/ans.mjs +1 -1
- package/dist/esm/internal/coin.d.mts +6 -5
- package/dist/esm/internal/coin.mjs +1 -1
- package/dist/esm/internal/digitalAsset.d.mts +12 -21
- package/dist/esm/internal/digitalAsset.mjs +1 -1
- package/dist/esm/internal/event.d.mts +5 -12
- package/dist/esm/internal/event.mjs +1 -1
- package/dist/esm/internal/faucet.d.mts +2 -2
- package/dist/esm/internal/faucet.mjs +1 -1
- package/dist/esm/internal/fungibleAsset.d.mts +40 -22
- package/dist/esm/internal/fungibleAsset.mjs +1 -1
- package/dist/esm/internal/general.d.mts +9 -5
- package/dist/esm/internal/general.mjs +1 -1
- package/dist/esm/internal/staking.d.mts +4 -6
- package/dist/esm/internal/staking.mjs +1 -1
- package/dist/esm/internal/transaction.d.mts +12 -4
- package/dist/esm/internal/transaction.mjs +1 -1
- package/dist/esm/internal/transactionSubmission.d.mts +29 -41
- package/dist/esm/internal/transactionSubmission.mjs +1 -1
- package/dist/esm/transactions/authenticator/account.d.mts +5 -0
- package/dist/esm/transactions/authenticator/account.mjs +1 -1
- package/dist/esm/transactions/authenticator/index.d.mts +1 -0
- package/dist/esm/transactions/authenticator/index.mjs +1 -1
- package/dist/esm/transactions/authenticator/transaction.d.mts +1 -0
- package/dist/esm/transactions/authenticator/transaction.mjs +1 -1
- package/dist/esm/transactions/index.d.mts +5 -4
- package/dist/esm/transactions/index.mjs +1 -1
- package/dist/esm/transactions/instances/chainId.mjs +1 -1
- package/dist/esm/transactions/instances/identifier.mjs +1 -1
- package/dist/esm/transactions/instances/index.d.mts +1 -0
- package/dist/esm/transactions/instances/index.mjs +1 -1
- package/dist/esm/transactions/instances/moduleId.mjs +1 -1
- package/dist/esm/transactions/instances/rawTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/rotationProofChallenge.mjs +1 -1
- package/dist/esm/transactions/instances/signedTransaction.d.mts +1 -0
- package/dist/esm/transactions/instances/signedTransaction.mjs +1 -1
- package/dist/esm/transactions/instances/transactionPayload.mjs +1 -1
- package/dist/esm/transactions/management/accountSequenceNumber.d.mts +89 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs +2 -0
- package/dist/esm/transactions/management/accountSequenceNumber.mjs.map +1 -0
- package/dist/esm/transactions/management/asyncQueue.d.mts +58 -0
- package/dist/esm/transactions/management/asyncQueue.mjs +2 -0
- package/dist/esm/transactions/management/asyncQueue.mjs.map +1 -0
- package/dist/esm/transactions/management/index.d.mts +36 -0
- package/dist/esm/transactions/management/index.mjs +2 -0
- package/dist/esm/transactions/management/index.mjs.map +1 -0
- package/dist/esm/transactions/management/transactionWorker.d.mts +135 -0
- package/dist/esm/transactions/management/transactionWorker.mjs +2 -0
- package/dist/esm/transactions/management/transactionWorker.mjs.map +1 -0
- package/dist/esm/transactions/transactionBuilder/helpers.d.mts +3 -1
- package/dist/esm/transactions/transactionBuilder/helpers.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/index.d.mts +4 -3
- package/dist/esm/transactions/transactionBuilder/index.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.d.mts +3 -1
- package/dist/esm/transactions/transactionBuilder/remoteAbi.mjs +1 -1
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.d.mts +6 -8
- package/dist/esm/transactions/transactionBuilder/transactionBuilder.mjs +1 -1
- package/dist/esm/transactions/typeTag/index.mjs +1 -1
- package/dist/esm/transactions/typeTag/parser.mjs +1 -1
- package/dist/esm/transactions/types.d.mts +18 -43
- package/dist/esm/types/generated/operations.d.mts +30 -4
- package/dist/esm/types/generated/queries.d.mts +8 -5
- package/dist/esm/types/generated/queries.mjs +1 -1
- package/dist/esm/types/index.d.mts +27 -9
- package/dist/esm/types/index.mjs +1 -1
- package/dist/esm/types/indexer.d.mts +3 -2
- package/dist/esm/utils/const.d.mts +18 -1
- package/dist/esm/utils/const.mjs +1 -1
- package/dist/esm/utils/index.d.mts +1 -1
- package/dist/esm/utils/index.mjs +1 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/src/api/account.ts +150 -53
- package/src/api/ans.ts +252 -16
- package/src/api/aptos.ts +20 -0
- package/src/api/aptosConfig.ts +2 -2
- package/src/api/coin.ts +4 -8
- package/src/api/digitalAsset.ts +75 -25
- package/src/api/event.ts +28 -17
- package/src/api/faucet.ts +12 -9
- package/src/api/fungibleAsset.ts +76 -35
- package/src/api/general.ts +19 -3
- package/src/api/staking.ts +30 -11
- package/src/api/transaction.ts +16 -1
- package/src/api/transactionSubmission/build.ts +42 -0
- package/src/api/transactionSubmission/sign.ts +44 -0
- package/src/api/transactionSubmission/simulate.ts +56 -0
- package/src/api/transactionSubmission/submit.ts +53 -0
- package/src/api/transactionSubmission.ts +31 -128
- package/src/api/utils.ts +37 -0
- package/src/bcs/deserializer.ts +4 -4
- package/src/bcs/serializer.ts +4 -4
- package/src/client/core.ts +6 -4
- package/src/client/get.ts +7 -6
- package/src/core/accountAddress.ts +20 -22
- package/src/core/crypto/anyPublicKey.ts +12 -0
- package/src/core/crypto/ed25519.ts +13 -0
- package/src/core/crypto/index.ts +2 -0
- package/src/core/crypto/secp256k1.ts +12 -0
- package/src/core/hex.ts +5 -7
- package/src/index.ts +1 -0
- package/src/internal/account.ts +56 -50
- package/src/internal/ans.ts +423 -24
- package/src/internal/coin.ts +6 -8
- package/src/internal/digitalAsset.ts +15 -25
- package/src/internal/event.ts +7 -14
- package/src/internal/faucet.ts +10 -6
- package/src/internal/fungibleAsset.ts +36 -18
- package/src/internal/general.ts +30 -3
- package/src/internal/queries/ansTokenFragment.graphql +9 -0
- package/src/internal/queries/getNames.graphql +11 -0
- package/src/internal/queries/getNumberOfDelegatorsQuery.graphql +5 -5
- package/src/internal/queries/getProcessorStatus.graphql +2 -2
- package/src/internal/staking.ts +12 -14
- package/src/internal/transaction.ts +23 -26
- package/src/internal/transactionSubmission.ts +63 -25
- package/src/transactions/authenticator/account.ts +16 -0
- package/src/transactions/instances/moduleId.ts +1 -1
- package/src/transactions/management/accountSequenceNumber.ts +186 -0
- package/src/transactions/management/asyncQueue.ts +107 -0
- package/src/transactions/management/index.ts +2 -0
- package/src/transactions/management/transactionWorker.ts +275 -0
- package/src/transactions/transactionBuilder/helpers.ts +28 -1
- package/src/transactions/transactionBuilder/remoteAbi.ts +35 -28
- package/src/transactions/transactionBuilder/transactionBuilder.ts +46 -67
- package/src/transactions/typeTag/parser.ts +1 -1
- package/src/transactions/types.ts +16 -47
- package/src/types/generated/operations.ts +33 -2
- package/src/types/generated/queries.ts +38 -4
- package/src/types/index.ts +67 -11
- package/src/types/indexer.ts +3 -0
- package/src/utils/const.ts +18 -0
- package/src/version.ts +1 -1
- package/dist/esm/chunk-2W744GUN.mjs +0 -2
- package/dist/esm/chunk-2W744GUN.mjs.map +0 -1
- package/dist/esm/chunk-3JVGSFHP.mjs +0 -2
- package/dist/esm/chunk-4RVIA63I.mjs +0 -2
- package/dist/esm/chunk-4RVIA63I.mjs.map +0 -1
- package/dist/esm/chunk-62SCW5NH.mjs +0 -2
- package/dist/esm/chunk-62SCW5NH.mjs.map +0 -1
- package/dist/esm/chunk-7MNEEVXY.mjs +0 -2
- package/dist/esm/chunk-7MNEEVXY.mjs.map +0 -1
- package/dist/esm/chunk-AAIBCWZY.mjs +0 -2
- package/dist/esm/chunk-AAIBCWZY.mjs.map +0 -1
- package/dist/esm/chunk-ARVSIDVB.mjs.map +0 -1
- package/dist/esm/chunk-BFSEVKNA.mjs +0 -2
- package/dist/esm/chunk-BFSEVKNA.mjs.map +0 -1
- package/dist/esm/chunk-BP5ZO7NK.mjs +0 -2
- package/dist/esm/chunk-BP5ZO7NK.mjs.map +0 -1
- package/dist/esm/chunk-BV4OOU5Y.mjs +0 -2
- package/dist/esm/chunk-BV4OOU5Y.mjs.map +0 -1
- package/dist/esm/chunk-BWMNPUTK.mjs +0 -2
- package/dist/esm/chunk-BWMNPUTK.mjs.map +0 -1
- package/dist/esm/chunk-EFIYW4WK.mjs +0 -2
- package/dist/esm/chunk-EGOYLZBU.mjs +0 -2
- package/dist/esm/chunk-EGOYLZBU.mjs.map +0 -1
- package/dist/esm/chunk-EYXHVA6W.mjs +0 -2
- package/dist/esm/chunk-EYXHVA6W.mjs.map +0 -1
- package/dist/esm/chunk-FYIFBLHU.mjs +0 -2
- package/dist/esm/chunk-IG5CHHSI.mjs +0 -2
- package/dist/esm/chunk-IG5CHHSI.mjs.map +0 -1
- package/dist/esm/chunk-IXMB2GOK.mjs +0 -2
- package/dist/esm/chunk-IXMB2GOK.mjs.map +0 -1
- package/dist/esm/chunk-J5ZFOJN2.mjs +0 -2
- package/dist/esm/chunk-J5ZFOJN2.mjs.map +0 -1
- package/dist/esm/chunk-KC64ESLO.mjs +0 -2
- package/dist/esm/chunk-NGCFPQ22.mjs +0 -2
- package/dist/esm/chunk-NGCFPQ22.mjs.map +0 -1
- package/dist/esm/chunk-NTD3H2S4.mjs +0 -2
- package/dist/esm/chunk-NTD3H2S4.mjs.map +0 -1
- package/dist/esm/chunk-NYFVEKF6.mjs +0 -2
- package/dist/esm/chunk-NYFVEKF6.mjs.map +0 -1
- package/dist/esm/chunk-NZIJV4O2.mjs +0 -2
- package/dist/esm/chunk-NZIJV4O2.mjs.map +0 -1
- package/dist/esm/chunk-P32MY5YF.mjs +0 -2
- package/dist/esm/chunk-P32MY5YF.mjs.map +0 -1
- package/dist/esm/chunk-Q6N6QACD.mjs +0 -2
- package/dist/esm/chunk-Q6N6QACD.mjs.map +0 -1
- package/dist/esm/chunk-R26XML3D.mjs +0 -2
- package/dist/esm/chunk-R26XML3D.mjs.map +0 -1
- package/dist/esm/chunk-R3KWVOFG.mjs +0 -2
- package/dist/esm/chunk-RYETO74W.mjs +0 -2
- package/dist/esm/chunk-RYETO74W.mjs.map +0 -1
- package/dist/esm/chunk-TCTZCPQ6.mjs +0 -1
- package/dist/esm/chunk-TIH6ARYP.mjs +0 -2
- package/dist/esm/chunk-TQD4IGUM.mjs +0 -2
- package/dist/esm/chunk-TQD4IGUM.mjs.map +0 -1
- package/dist/esm/chunk-UNQNACJT.mjs +0 -2
- package/dist/esm/chunk-UNQNACJT.mjs.map +0 -1
- package/dist/esm/chunk-V45RFKH7.mjs.map +0 -1
- package/dist/esm/chunk-VMQWW5UT.mjs +0 -2
- package/dist/esm/chunk-VMQWW5UT.mjs.map +0 -1
- package/dist/esm/chunk-VOYW2TZW.mjs +0 -2
- package/dist/esm/chunk-VOYW2TZW.mjs.map +0 -1
- package/dist/esm/chunk-VYAVLUPJ.mjs +0 -2
- package/dist/esm/chunk-VYAVLUPJ.mjs.map +0 -1
- package/dist/esm/chunk-WKY5ENCK.mjs +0 -2
- package/dist/esm/chunk-WKY5ENCK.mjs.map +0 -1
- package/dist/esm/chunk-WX43AJTD.mjs.map +0 -1
- package/dist/esm/chunk-Y5DJPHJT.mjs +0 -2
- package/dist/esm/chunk-Y5DJPHJT.mjs.map +0 -1
- package/dist/esm/chunk-Y7VR7X5W.mjs +0 -2
- package/dist/esm/chunk-Y7VR7X5W.mjs.map +0 -1
- package/dist/esm/chunk-Z2UDRTHA.mjs +0 -2
- package/dist/esm/chunk-Z2UDRTHA.mjs.map +0 -1
- /package/dist/esm/{chunk-TCTZCPQ6.mjs.map → api/transactionSubmission/build.mjs.map} +0 -0
- /package/dist/esm/{chunk-UAAI3NCA.mjs.map → chunk-2SAKPC5Q.mjs.map} +0 -0
- /package/dist/esm/{chunk-4ADA5BE7.mjs.map → chunk-53DS6NBQ.mjs.map} +0 -0
- /package/dist/esm/{chunk-QWVR4RCV.mjs.map → chunk-5OPOJ43H.mjs.map} +0 -0
- /package/dist/esm/{chunk-HVADSXTB.mjs.map → chunk-73VWOS4Z.mjs.map} +0 -0
- /package/dist/esm/{chunk-U25N2VWA.mjs.map → chunk-AZUWHKN5.mjs.map} +0 -0
- /package/dist/esm/{chunk-JZNLZMUC.mjs.map → chunk-CJPCOS4R.mjs.map} +0 -0
- /package/dist/esm/{chunk-S36IYY6K.mjs.map → chunk-CL5B2QNS.mjs.map} +0 -0
- /package/dist/esm/{chunk-EWTHPMEE.mjs.map → chunk-CU2DINU4.mjs.map} +0 -0
- /package/dist/esm/{chunk-44MGBJ73.mjs.map → chunk-FZ56IS3E.mjs.map} +0 -0
- /package/dist/esm/{chunk-GEFQFRL3.mjs.map → chunk-HC5VMNXA.mjs.map} +0 -0
- /package/dist/esm/{chunk-BPYLPPEQ.mjs.map → chunk-PL2VA73L.mjs.map} +0 -0
- /package/dist/esm/{chunk-EFIYW4WK.mjs.map → chunk-PXTMLJKO.mjs.map} +0 -0
- /package/dist/esm/{chunk-JDS7K2WI.mjs.map → chunk-QCBIJCU4.mjs.map} +0 -0
- /package/dist/esm/{chunk-KQXRH5FK.mjs.map → chunk-QNTV5NMH.mjs.map} +0 -0
- /package/dist/esm/{chunk-EQ5BEDJ7.mjs.map → chunk-RCM3K5JL.mjs.map} +0 -0
- /package/dist/esm/{chunk-UPLWWSB4.mjs.map → chunk-SSJQOXEP.mjs.map} +0 -0
- /package/dist/esm/{chunk-U3LO2FSJ.mjs.map → chunk-WTGGCH34.mjs.map} +0 -0
- /package/dist/esm/{chunk-X32O46IB.mjs.map → chunk-XITLXPBK.mjs.map} +0 -0
- /package/dist/esm/{chunk-VWVEDCBM.mjs.map → chunk-YN6UIVFB.mjs.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";var aptosSDK=(()=>{var Fd=Object.create;var Zn=Object.defineProperty;var Za=Object.getOwnPropertyDescriptor;var Kd=Object.getOwnPropertyNames;var Hd=Object.getPrototypeOf,$d=Object.prototype.hasOwnProperty;var Ja=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var we=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),ec=(r,t)=>{for(var e in t)Zn(r,e,{get:t[e],enumerable:!0})},tc=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Kd(t))!$d.call(r,o)&&o!==e&&Zn(r,o,{get:()=>t[o],enumerable:!(n=Za(t,o))||n.enumerable});return r};var rc=(r,t,e)=>(e=r!=null?Fd(Hd(r)):{},tc(t||!r||!r.__esModule?Zn(e,"default",{value:r,enumerable:!0}):e,r)),Vd=r=>tc(Zn({},"__esModule",{value:!0}),r),wr=(r,t,e,n)=>{for(var o=n>1?void 0:n?Za(t,e):t,s=r.length-1,c;s>=0;s--)(c=r[s])&&(o=(n?c(t,e,o):c(o))||o);return n&&o&&Zn(t,e,o),o};var Ec=we(()=>{"use strict"});var Sc=we((oy,ri)=>{"use strict";(function(r){"use strict";var t=function(a){var d,f=new Float64Array(16);if(a)for(d=0;d<a.length;d++)f[d]=a[d];return f},e=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),c=t([1]),u=t([56129,1]),p=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),x=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),_=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function T(a,d,f,i){a[d]=f>>24&255,a[d+1]=f>>16&255,a[d+2]=f>>8&255,a[d+3]=f&255,a[d+4]=i>>24&255,a[d+5]=i>>16&255,a[d+6]=i>>8&255,a[d+7]=i&255}function N(a,d,f,i,l){var m,A=0;for(m=0;m<l;m++)A|=a[d+m]^f[i+m];return(1&A-1>>>8)-1}function E(a,d,f,i){return N(a,d,f,i,16)}function R(a,d,f,i){return N(a,d,f,i,32)}function P(a,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,A=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,S=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,B=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,Te=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,G=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,W=m,q=A,H=S,$=B,M=V,b=D,w=Te,C=G,v=te,U=re,I=ue,Y=ce,fe=ne,le=ie,de=oe,g,he=0;he<20;he+=2)g=F+Y|0,$^=g<<7|g>>>32-7,g=$+F|0,C^=g<<9|g>>>32-9,g=C+$|0,Y^=g<<13|g>>>32-13,g=Y+C|0,F^=g<<18|g>>>32-18,g=M+W|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,W^=g<<13|g>>>32-13,g=W+fe|0,M^=g<<18|g>>>32-18,g=U+b|0,le^=g<<7|g>>>32-7,g=le+U|0,q^=g<<9|g>>>32-9,g=q+le|0,b^=g<<13|g>>>32-13,g=b+q|0,U^=g<<18|g>>>32-18,g=de+I|0,H^=g<<7|g>>>32-7,g=H+de|0,w^=g<<9|g>>>32-9,g=w+H|0,I^=g<<13|g>>>32-13,g=I+w|0,de^=g<<18|g>>>32-18,g=F+H|0,W^=g<<7|g>>>32-7,g=W+F|0,q^=g<<9|g>>>32-9,g=q+W|0,H^=g<<13|g>>>32-13,g=H+q|0,F^=g<<18|g>>>32-18,g=M+$|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,$^=g<<13|g>>>32-13,g=$+w|0,M^=g<<18|g>>>32-18,g=U+v|0,I^=g<<7|g>>>32-7,g=I+U|0,C^=g<<9|g>>>32-9,g=C+I|0,v^=g<<13|g>>>32-13,g=v+C|0,U^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;F=F+l|0,W=W+m|0,q=q+A|0,H=H+S|0,$=$+B|0,M=M+V|0,b=b+D|0,w=w+Te|0,C=C+G|0,v=v+te|0,U=U+re|0,I=I+ue|0,Y=Y+ce|0,fe=fe+ne|0,le=le+ie|0,de=de+oe|0,a[0]=F>>>0&255,a[1]=F>>>8&255,a[2]=F>>>16&255,a[3]=F>>>24&255,a[4]=W>>>0&255,a[5]=W>>>8&255,a[6]=W>>>16&255,a[7]=W>>>24&255,a[8]=q>>>0&255,a[9]=q>>>8&255,a[10]=q>>>16&255,a[11]=q>>>24&255,a[12]=H>>>0&255,a[13]=H>>>8&255,a[14]=H>>>16&255,a[15]=H>>>24&255,a[16]=$>>>0&255,a[17]=$>>>8&255,a[18]=$>>>16&255,a[19]=$>>>24&255,a[20]=M>>>0&255,a[21]=M>>>8&255,a[22]=M>>>16&255,a[23]=M>>>24&255,a[24]=b>>>0&255,a[25]=b>>>8&255,a[26]=b>>>16&255,a[27]=b>>>24&255,a[28]=w>>>0&255,a[29]=w>>>8&255,a[30]=w>>>16&255,a[31]=w>>>24&255,a[32]=C>>>0&255,a[33]=C>>>8&255,a[34]=C>>>16&255,a[35]=C>>>24&255,a[36]=v>>>0&255,a[37]=v>>>8&255,a[38]=v>>>16&255,a[39]=v>>>24&255,a[40]=U>>>0&255,a[41]=U>>>8&255,a[42]=U>>>16&255,a[43]=U>>>24&255,a[44]=I>>>0&255,a[45]=I>>>8&255,a[46]=I>>>16&255,a[47]=I>>>24&255,a[48]=Y>>>0&255,a[49]=Y>>>8&255,a[50]=Y>>>16&255,a[51]=Y>>>24&255,a[52]=fe>>>0&255,a[53]=fe>>>8&255,a[54]=fe>>>16&255,a[55]=fe>>>24&255,a[56]=le>>>0&255,a[57]=le>>>8&255,a[58]=le>>>16&255,a[59]=le>>>24&255,a[60]=de>>>0&255,a[61]=de>>>8&255,a[62]=de>>>16&255,a[63]=de>>>24&255}function Q(a,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,A=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,S=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,B=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,V=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,D=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,Te=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,G=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,W=m,q=A,H=S,$=B,M=V,b=D,w=Te,C=G,v=te,U=re,I=ue,Y=ce,fe=ne,le=ie,de=oe,g,he=0;he<20;he+=2)g=F+Y|0,$^=g<<7|g>>>32-7,g=$+F|0,C^=g<<9|g>>>32-9,g=C+$|0,Y^=g<<13|g>>>32-13,g=Y+C|0,F^=g<<18|g>>>32-18,g=M+W|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,W^=g<<13|g>>>32-13,g=W+fe|0,M^=g<<18|g>>>32-18,g=U+b|0,le^=g<<7|g>>>32-7,g=le+U|0,q^=g<<9|g>>>32-9,g=q+le|0,b^=g<<13|g>>>32-13,g=b+q|0,U^=g<<18|g>>>32-18,g=de+I|0,H^=g<<7|g>>>32-7,g=H+de|0,w^=g<<9|g>>>32-9,g=w+H|0,I^=g<<13|g>>>32-13,g=I+w|0,de^=g<<18|g>>>32-18,g=F+H|0,W^=g<<7|g>>>32-7,g=W+F|0,q^=g<<9|g>>>32-9,g=q+W|0,H^=g<<13|g>>>32-13,g=H+q|0,F^=g<<18|g>>>32-18,g=M+$|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,$^=g<<13|g>>>32-13,g=$+w|0,M^=g<<18|g>>>32-18,g=U+v|0,I^=g<<7|g>>>32-7,g=I+U|0,C^=g<<9|g>>>32-9,g=C+I|0,v^=g<<13|g>>>32-13,g=v+C|0,U^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;a[0]=F>>>0&255,a[1]=F>>>8&255,a[2]=F>>>16&255,a[3]=F>>>24&255,a[4]=M>>>0&255,a[5]=M>>>8&255,a[6]=M>>>16&255,a[7]=M>>>24&255,a[8]=U>>>0&255,a[9]=U>>>8&255,a[10]=U>>>16&255,a[11]=U>>>24&255,a[12]=de>>>0&255,a[13]=de>>>8&255,a[14]=de>>>16&255,a[15]=de>>>24&255,a[16]=b>>>0&255,a[17]=b>>>8&255,a[18]=b>>>16&255,a[19]=b>>>24&255,a[20]=w>>>0&255,a[21]=w>>>8&255,a[22]=w>>>16&255,a[23]=w>>>24&255,a[24]=C>>>0&255,a[25]=C>>>8&255,a[26]=C>>>16&255,a[27]=C>>>24&255,a[28]=v>>>0&255,a[29]=v>>>8&255,a[30]=v>>>16&255,a[31]=v>>>24&255}function z(a,d,f,i){P(a,d,f,i)}function ee(a,d,f,i){Q(a,d,f,i)}var L=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function j(a,d,f,i,l,m,A){var S=new Uint8Array(16),B=new Uint8Array(64),V,D;for(D=0;D<16;D++)S[D]=0;for(D=0;D<8;D++)S[D]=m[D];for(;l>=64;){for(z(B,S,A,L),D=0;D<64;D++)a[d+D]=f[i+D]^B[D];for(V=1,D=8;D<16;D++)V=V+(S[D]&255)|0,S[D]=V&255,V>>>=8;l-=64,d+=64,i+=64}if(l>0)for(z(B,S,A,L),D=0;D<l;D++)a[d+D]=f[i+D]^B[D];return 0}function J(a,d,f,i,l){var m=new Uint8Array(16),A=new Uint8Array(64),S,B;for(B=0;B<16;B++)m[B]=0;for(B=0;B<8;B++)m[B]=i[B];for(;f>=64;){for(z(A,m,l,L),B=0;B<64;B++)a[d+B]=A[B];for(S=1,B=8;B<16;B++)S=S+(m[B]&255)|0,m[B]=S&255,S>>>=8;f-=64,d+=64}if(f>0)for(z(A,m,l,L),B=0;B<f;B++)a[d+B]=A[B];return 0}function X(a,d,f,i,l){var m=new Uint8Array(32);ee(m,i,l,L);for(var A=new Uint8Array(8),S=0;S<8;S++)A[S]=i[S+16];return J(a,d,f,A,m)}function Re(a,d,f,i,l,m,A){var S=new Uint8Array(32);ee(S,m,A,L);for(var B=new Uint8Array(8),V=0;V<8;V++)B[V]=m[V+16];return j(a,d,f,i,l,B,S)}var xe=function(a){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var d,f,i,l,m,A,S,B;d=a[0]&255|(a[1]&255)<<8,this.r[0]=d&8191,f=a[2]&255|(a[3]&255)<<8,this.r[1]=(d>>>13|f<<3)&8191,i=a[4]&255|(a[5]&255)<<8,this.r[2]=(f>>>10|i<<6)&7939,l=a[6]&255|(a[7]&255)<<8,this.r[3]=(i>>>7|l<<9)&8191,m=a[8]&255|(a[9]&255)<<8,this.r[4]=(l>>>4|m<<12)&255,this.r[5]=m>>>1&8190,A=a[10]&255|(a[11]&255)<<8,this.r[6]=(m>>>14|A<<2)&8191,S=a[12]&255|(a[13]&255)<<8,this.r[7]=(A>>>11|S<<5)&8065,B=a[14]&255|(a[15]&255)<<8,this.r[8]=(S>>>8|B<<8)&8191,this.r[9]=B>>>5&127,this.pad[0]=a[16]&255|(a[17]&255)<<8,this.pad[1]=a[18]&255|(a[19]&255)<<8,this.pad[2]=a[20]&255|(a[21]&255)<<8,this.pad[3]=a[22]&255|(a[23]&255)<<8,this.pad[4]=a[24]&255|(a[25]&255)<<8,this.pad[5]=a[26]&255|(a[27]&255)<<8,this.pad[6]=a[28]&255|(a[29]&255)<<8,this.pad[7]=a[30]&255|(a[31]&255)<<8};xe.prototype.blocks=function(a,d,f){for(var i=this.fin?0:2048,l,m,A,S,B,V,D,Te,G,te,re,ue,ce,ne,ie,oe,F,W,q,H=this.h[0],$=this.h[1],M=this.h[2],b=this.h[3],w=this.h[4],C=this.h[5],v=this.h[6],U=this.h[7],I=this.h[8],Y=this.h[9],fe=this.r[0],le=this.r[1],de=this.r[2],g=this.r[3],he=this.r[4],ve=this.r[5],_e=this.r[6],ge=this.r[7],Ae=this.r[8],be=this.r[9];f>=16;)l=a[d+0]&255|(a[d+1]&255)<<8,H+=l&8191,m=a[d+2]&255|(a[d+3]&255)<<8,$+=(l>>>13|m<<3)&8191,A=a[d+4]&255|(a[d+5]&255)<<8,M+=(m>>>10|A<<6)&8191,S=a[d+6]&255|(a[d+7]&255)<<8,b+=(A>>>7|S<<9)&8191,B=a[d+8]&255|(a[d+9]&255)<<8,w+=(S>>>4|B<<12)&8191,C+=B>>>1&8191,V=a[d+10]&255|(a[d+11]&255)<<8,v+=(B>>>14|V<<2)&8191,D=a[d+12]&255|(a[d+13]&255)<<8,U+=(V>>>11|D<<5)&8191,Te=a[d+14]&255|(a[d+15]&255)<<8,I+=(D>>>8|Te<<8)&8191,Y+=Te>>>5|i,G=0,te=G,te+=H*fe,te+=$*(5*be),te+=M*(5*Ae),te+=b*(5*ge),te+=w*(5*_e),G=te>>>13,te&=8191,te+=C*(5*ve),te+=v*(5*he),te+=U*(5*g),te+=I*(5*de),te+=Y*(5*le),G+=te>>>13,te&=8191,re=G,re+=H*le,re+=$*fe,re+=M*(5*be),re+=b*(5*Ae),re+=w*(5*ge),G=re>>>13,re&=8191,re+=C*(5*_e),re+=v*(5*ve),re+=U*(5*he),re+=I*(5*g),re+=Y*(5*de),G+=re>>>13,re&=8191,ue=G,ue+=H*de,ue+=$*le,ue+=M*fe,ue+=b*(5*be),ue+=w*(5*Ae),G=ue>>>13,ue&=8191,ue+=C*(5*ge),ue+=v*(5*_e),ue+=U*(5*ve),ue+=I*(5*he),ue+=Y*(5*g),G+=ue>>>13,ue&=8191,ce=G,ce+=H*g,ce+=$*de,ce+=M*le,ce+=b*fe,ce+=w*(5*be),G=ce>>>13,ce&=8191,ce+=C*(5*Ae),ce+=v*(5*ge),ce+=U*(5*_e),ce+=I*(5*ve),ce+=Y*(5*he),G+=ce>>>13,ce&=8191,ne=G,ne+=H*he,ne+=$*g,ne+=M*de,ne+=b*le,ne+=w*fe,G=ne>>>13,ne&=8191,ne+=C*(5*be),ne+=v*(5*Ae),ne+=U*(5*ge),ne+=I*(5*_e),ne+=Y*(5*ve),G+=ne>>>13,ne&=8191,ie=G,ie+=H*ve,ie+=$*he,ie+=M*g,ie+=b*de,ie+=w*le,G=ie>>>13,ie&=8191,ie+=C*fe,ie+=v*(5*be),ie+=U*(5*Ae),ie+=I*(5*ge),ie+=Y*(5*_e),G+=ie>>>13,ie&=8191,oe=G,oe+=H*_e,oe+=$*ve,oe+=M*he,oe+=b*g,oe+=w*de,G=oe>>>13,oe&=8191,oe+=C*le,oe+=v*fe,oe+=U*(5*be),oe+=I*(5*Ae),oe+=Y*(5*ge),G+=oe>>>13,oe&=8191,F=G,F+=H*ge,F+=$*_e,F+=M*ve,F+=b*he,F+=w*g,G=F>>>13,F&=8191,F+=C*de,F+=v*le,F+=U*fe,F+=I*(5*be),F+=Y*(5*Ae),G+=F>>>13,F&=8191,W=G,W+=H*Ae,W+=$*ge,W+=M*_e,W+=b*ve,W+=w*he,G=W>>>13,W&=8191,W+=C*g,W+=v*de,W+=U*le,W+=I*fe,W+=Y*(5*be),G+=W>>>13,W&=8191,q=G,q+=H*be,q+=$*Ae,q+=M*ge,q+=b*_e,q+=w*ve,G=q>>>13,q&=8191,q+=C*he,q+=v*g,q+=U*de,q+=I*le,q+=Y*fe,G+=q>>>13,q&=8191,G=(G<<2)+G|0,G=G+te|0,te=G&8191,G=G>>>13,re+=G,H=te,$=re,M=ue,b=ce,w=ne,C=ie,v=oe,U=F,I=W,Y=q,d+=16,f-=16;this.h[0]=H,this.h[1]=$,this.h[2]=M,this.h[3]=b,this.h[4]=w,this.h[5]=C,this.h[6]=v,this.h[7]=U,this.h[8]=I,this.h[9]=Y},xe.prototype.finish=function(a,d){var f=new Uint16Array(10),i,l,m,A;if(this.leftover){for(A=this.leftover,this.buffer[A++]=1;A<16;A++)this.buffer[A]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,A=2;A<10;A++)this.h[A]+=i,i=this.h[A]>>>13,this.h[A]&=8191;for(this.h[0]+=i*5,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,f[0]=this.h[0]+5,i=f[0]>>>13,f[0]&=8191,A=1;A<10;A++)f[A]=this.h[A]+i,i=f[A]>>>13,f[A]&=8191;for(f[9]-=8192,l=(i^1)-1,A=0;A<10;A++)f[A]&=l;for(l=~l,A=0;A<10;A++)this.h[A]=this.h[A]&l|f[A];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,m=this.h[0]+this.pad[0],this.h[0]=m&65535,A=1;A<8;A++)m=(this.h[A]+this.pad[A]|0)+(m>>>16)|0,this.h[A]=m&65535;a[d+0]=this.h[0]>>>0&255,a[d+1]=this.h[0]>>>8&255,a[d+2]=this.h[1]>>>0&255,a[d+3]=this.h[1]>>>8&255,a[d+4]=this.h[2]>>>0&255,a[d+5]=this.h[2]>>>8&255,a[d+6]=this.h[3]>>>0&255,a[d+7]=this.h[3]>>>8&255,a[d+8]=this.h[4]>>>0&255,a[d+9]=this.h[4]>>>8&255,a[d+10]=this.h[5]>>>0&255,a[d+11]=this.h[5]>>>8&255,a[d+12]=this.h[6]>>>0&255,a[d+13]=this.h[6]>>>8&255,a[d+14]=this.h[7]>>>0&255,a[d+15]=this.h[7]>>>8&255},xe.prototype.update=function(a,d,f){var i,l;if(this.leftover){for(l=16-this.leftover,l>f&&(l=f),i=0;i<l;i++)this.buffer[this.leftover+i]=a[d+i];if(f-=l,d+=l,this.leftover+=l,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(l=f-f%16,this.blocks(a,d,l),d+=l,f-=l),f){for(i=0;i<f;i++)this.buffer[this.leftover+i]=a[d+i];this.leftover+=f}};function ye(a,d,f,i,l,m){var A=new xe(m);return A.update(f,i,l),A.finish(a,d),0}function Ve(a,d,f,i,l,m){var A=new Uint8Array(16);return ye(A,0,f,i,l,m),E(a,d,A,0)}function Qe(a,d,f,i,l){var m;if(f<32)return-1;for(Re(a,0,d,0,f,i,l),ye(a,16,a,32,f-32,a),m=0;m<16;m++)a[m]=0;return 0}function dt(a,d,f,i,l){var m,A=new Uint8Array(32);if(f<32||(X(A,0,32,i,l),Ve(d,16,d,32,f-32,A)!==0))return-1;for(Re(a,0,d,0,f,i,l),m=0;m<32;m++)a[m]=0;return 0}function O(a,d){var f;for(f=0;f<16;f++)a[f]=d[f]|0}function K(a){var d,f,i=1;for(d=0;d<16;d++)f=a[d]+i+65535,i=Math.floor(f/65536),a[d]=f-i*65536;a[0]+=i-1+37*(i-1)}function se(a,d,f){for(var i,l=~(f-1),m=0;m<16;m++)i=l&(a[m]^d[m]),a[m]^=i,d[m]^=i}function Ee(a,d){var f,i,l,m=t(),A=t();for(f=0;f<16;f++)A[f]=d[f];for(K(A),K(A),K(A),i=0;i<2;i++){for(m[0]=A[0]-65517,f=1;f<15;f++)m[f]=A[f]-65535-(m[f-1]>>16&1),m[f-1]&=65535;m[15]=A[15]-32767-(m[14]>>16&1),l=m[15]>>16&1,m[14]&=65535,se(A,m,1-l)}for(f=0;f<16;f++)a[2*f]=A[f]&255,a[2*f+1]=A[f]>>8}function Se(a,d){var f=new Uint8Array(32),i=new Uint8Array(32);return Ee(f,a),Ee(i,d),R(f,0,i,0)}function je(a){var d=new Uint8Array(32);return Ee(d,a),d[0]&1}function ot(a,d){var f;for(f=0;f<16;f++)a[f]=d[2*f]+(d[2*f+1]<<8);a[15]&=32767}function ke(a,d,f){for(var i=0;i<16;i++)a[i]=d[i]+f[i]}function Xe(a,d,f){for(var i=0;i<16;i++)a[i]=d[i]-f[i]}function ae(a,d,f){var i,l,m=0,A=0,S=0,B=0,V=0,D=0,Te=0,G=0,te=0,re=0,ue=0,ce=0,ne=0,ie=0,oe=0,F=0,W=0,q=0,H=0,$=0,M=0,b=0,w=0,C=0,v=0,U=0,I=0,Y=0,fe=0,le=0,de=0,g=f[0],he=f[1],ve=f[2],_e=f[3],ge=f[4],Ae=f[5],be=f[6],We=f[7],Ue=f[8],Me=f[9],De=f[10],qe=f[11],Je=f[12],st=f[13],at=f[14],ct=f[15];i=d[0],m+=i*g,A+=i*he,S+=i*ve,B+=i*_e,V+=i*ge,D+=i*Ae,Te+=i*be,G+=i*We,te+=i*Ue,re+=i*Me,ue+=i*De,ce+=i*qe,ne+=i*Je,ie+=i*st,oe+=i*at,F+=i*ct,i=d[1],A+=i*g,S+=i*he,B+=i*ve,V+=i*_e,D+=i*ge,Te+=i*Ae,G+=i*be,te+=i*We,re+=i*Ue,ue+=i*Me,ce+=i*De,ne+=i*qe,ie+=i*Je,oe+=i*st,F+=i*at,W+=i*ct,i=d[2],S+=i*g,B+=i*he,V+=i*ve,D+=i*_e,Te+=i*ge,G+=i*Ae,te+=i*be,re+=i*We,ue+=i*Ue,ce+=i*Me,ne+=i*De,ie+=i*qe,oe+=i*Je,F+=i*st,W+=i*at,q+=i*ct,i=d[3],B+=i*g,V+=i*he,D+=i*ve,Te+=i*_e,G+=i*ge,te+=i*Ae,re+=i*be,ue+=i*We,ce+=i*Ue,ne+=i*Me,ie+=i*De,oe+=i*qe,F+=i*Je,W+=i*st,q+=i*at,H+=i*ct,i=d[4],V+=i*g,D+=i*he,Te+=i*ve,G+=i*_e,te+=i*ge,re+=i*Ae,ue+=i*be,ce+=i*We,ne+=i*Ue,ie+=i*Me,oe+=i*De,F+=i*qe,W+=i*Je,q+=i*st,H+=i*at,$+=i*ct,i=d[5],D+=i*g,Te+=i*he,G+=i*ve,te+=i*_e,re+=i*ge,ue+=i*Ae,ce+=i*be,ne+=i*We,ie+=i*Ue,oe+=i*Me,F+=i*De,W+=i*qe,q+=i*Je,H+=i*st,$+=i*at,M+=i*ct,i=d[6],Te+=i*g,G+=i*he,te+=i*ve,re+=i*_e,ue+=i*ge,ce+=i*Ae,ne+=i*be,ie+=i*We,oe+=i*Ue,F+=i*Me,W+=i*De,q+=i*qe,H+=i*Je,$+=i*st,M+=i*at,b+=i*ct,i=d[7],G+=i*g,te+=i*he,re+=i*ve,ue+=i*_e,ce+=i*ge,ne+=i*Ae,ie+=i*be,oe+=i*We,F+=i*Ue,W+=i*Me,q+=i*De,H+=i*qe,$+=i*Je,M+=i*st,b+=i*at,w+=i*ct,i=d[8],te+=i*g,re+=i*he,ue+=i*ve,ce+=i*_e,ne+=i*ge,ie+=i*Ae,oe+=i*be,F+=i*We,W+=i*Ue,q+=i*Me,H+=i*De,$+=i*qe,M+=i*Je,b+=i*st,w+=i*at,C+=i*ct,i=d[9],re+=i*g,ue+=i*he,ce+=i*ve,ne+=i*_e,ie+=i*ge,oe+=i*Ae,F+=i*be,W+=i*We,q+=i*Ue,H+=i*Me,$+=i*De,M+=i*qe,b+=i*Je,w+=i*st,C+=i*at,v+=i*ct,i=d[10],ue+=i*g,ce+=i*he,ne+=i*ve,ie+=i*_e,oe+=i*ge,F+=i*Ae,W+=i*be,q+=i*We,H+=i*Ue,$+=i*Me,M+=i*De,b+=i*qe,w+=i*Je,C+=i*st,v+=i*at,U+=i*ct,i=d[11],ce+=i*g,ne+=i*he,ie+=i*ve,oe+=i*_e,F+=i*ge,W+=i*Ae,q+=i*be,H+=i*We,$+=i*Ue,M+=i*Me,b+=i*De,w+=i*qe,C+=i*Je,v+=i*st,U+=i*at,I+=i*ct,i=d[12],ne+=i*g,ie+=i*he,oe+=i*ve,F+=i*_e,W+=i*ge,q+=i*Ae,H+=i*be,$+=i*We,M+=i*Ue,b+=i*Me,w+=i*De,C+=i*qe,v+=i*Je,U+=i*st,I+=i*at,Y+=i*ct,i=d[13],ie+=i*g,oe+=i*he,F+=i*ve,W+=i*_e,q+=i*ge,H+=i*Ae,$+=i*be,M+=i*We,b+=i*Ue,w+=i*Me,C+=i*De,v+=i*qe,U+=i*Je,I+=i*st,Y+=i*at,fe+=i*ct,i=d[14],oe+=i*g,F+=i*he,W+=i*ve,q+=i*_e,H+=i*ge,$+=i*Ae,M+=i*be,b+=i*We,w+=i*Ue,C+=i*Me,v+=i*De,U+=i*qe,I+=i*Je,Y+=i*st,fe+=i*at,le+=i*ct,i=d[15],F+=i*g,W+=i*he,q+=i*ve,H+=i*_e,$+=i*ge,M+=i*Ae,b+=i*be,w+=i*We,C+=i*Ue,v+=i*Me,U+=i*De,I+=i*qe,Y+=i*Je,fe+=i*st,le+=i*at,de+=i*ct,m+=38*W,A+=38*q,S+=38*H,B+=38*$,V+=38*M,D+=38*b,Te+=38*w,G+=38*C,te+=38*v,re+=38*U,ue+=38*I,ce+=38*Y,ne+=38*fe,ie+=38*le,oe+=38*de,l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=A+l+65535,l=Math.floor(i/65536),A=i-l*65536,i=S+l+65535,l=Math.floor(i/65536),S=i-l*65536,i=B+l+65535,l=Math.floor(i/65536),B=i-l*65536,i=V+l+65535,l=Math.floor(i/65536),V=i-l*65536,i=D+l+65535,l=Math.floor(i/65536),D=i-l*65536,i=Te+l+65535,l=Math.floor(i/65536),Te=i-l*65536,i=G+l+65535,l=Math.floor(i/65536),G=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=A+l+65535,l=Math.floor(i/65536),A=i-l*65536,i=S+l+65535,l=Math.floor(i/65536),S=i-l*65536,i=B+l+65535,l=Math.floor(i/65536),B=i-l*65536,i=V+l+65535,l=Math.floor(i/65536),V=i-l*65536,i=D+l+65535,l=Math.floor(i/65536),D=i-l*65536,i=Te+l+65535,l=Math.floor(i/65536),Te=i-l*65536,i=G+l+65535,l=Math.floor(i/65536),G=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),a[0]=m,a[1]=A,a[2]=S,a[3]=B,a[4]=V,a[5]=D,a[6]=Te,a[7]=G,a[8]=te,a[9]=re,a[10]=ue,a[11]=ce,a[12]=ne,a[13]=ie,a[14]=oe,a[15]=F}function Ze(a,d){ae(a,d,d)}function xr(a,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=253;i>=0;i--)Ze(f,f),i!==2&&i!==4&&ae(f,f,d);for(i=0;i<16;i++)a[i]=f[i]}function Rt(a,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=250;i>=0;i--)Ze(f,f),i!==1&&ae(f,f,d);for(i=0;i<16;i++)a[i]=f[i]}function Ar(a,d,f){var i=new Uint8Array(32),l=new Float64Array(80),m,A,S=t(),B=t(),V=t(),D=t(),Te=t(),G=t();for(A=0;A<31;A++)i[A]=d[A];for(i[31]=d[31]&127|64,i[0]&=248,ot(l,f),A=0;A<16;A++)B[A]=l[A],D[A]=S[A]=V[A]=0;for(S[0]=D[0]=1,A=254;A>=0;--A)m=i[A>>>3]>>>(A&7)&1,se(S,B,m),se(V,D,m),ke(Te,S,V),Xe(S,S,V),ke(V,B,D),Xe(B,B,D),Ze(D,Te),Ze(G,S),ae(S,V,S),ae(V,B,Te),ke(Te,S,V),Xe(S,S,V),Ze(B,S),Xe(V,D,G),ae(S,V,u),ke(S,S,D),ae(V,V,S),ae(S,D,G),ae(D,B,l),Ze(B,Te),se(S,B,m),se(V,D,m);for(A=0;A<16;A++)l[A+16]=S[A],l[A+32]=V[A],l[A+48]=B[A],l[A+64]=D[A];var te=l.subarray(32),re=l.subarray(16);return xr(te,te),ae(re,re,te),Ee(a,re),0}function vt(a,d){return Ar(a,d,o)}function Zt(a,d){return e(d,32),vt(a,d)}function Nr(a,d,f){var i=new Uint8Array(32);return Ar(i,f,d),ee(a,n,i,L)}var mt=Qe,br=dt;function En(a,d,f,i,l,m){var A=new Uint8Array(32);return Nr(A,l,m),mt(a,d,f,i,A)}function No(a,d,f,i,l,m){var A=new Uint8Array(32);return Nr(A,l,m),br(a,d,f,i,A)}var Qn=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function Va(a,d,f,i){for(var l=new Int32Array(16),m=new Int32Array(16),A,S,B,V,D,Te,G,te,re,ue,ce,ne,ie,oe,F,W,q,H,$,M,b,w,C,v,U,I,Y=a[0],fe=a[1],le=a[2],de=a[3],g=a[4],he=a[5],ve=a[6],_e=a[7],ge=d[0],Ae=d[1],be=d[2],We=d[3],Ue=d[4],Me=d[5],De=d[6],qe=d[7],Je=0;i>=128;){for($=0;$<16;$++)M=8*$+Je,l[$]=f[M+0]<<24|f[M+1]<<16|f[M+2]<<8|f[M+3],m[$]=f[M+4]<<24|f[M+5]<<16|f[M+6]<<8|f[M+7];for($=0;$<80;$++)if(A=Y,S=fe,B=le,V=de,D=g,Te=he,G=ve,te=_e,re=ge,ue=Ae,ce=be,ne=We,ie=Ue,oe=Me,F=De,W=qe,b=_e,w=qe,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=(g>>>14|Ue<<32-14)^(g>>>18|Ue<<32-18)^(Ue>>>41-32|g<<32-(41-32)),w=(Ue>>>14|g<<32-14)^(Ue>>>18|g<<32-18)^(g>>>41-32|Ue<<32-(41-32)),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=g&he^~g&ve,w=Ue&Me^~Ue&De,C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=Qn[$*2],w=Qn[$*2+1],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=l[$%16],w=m[$%16],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,q=U&65535|I<<16,H=C&65535|v<<16,b=q,w=H,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=(Y>>>28|ge<<32-28)^(ge>>>34-32|Y<<32-(34-32))^(ge>>>39-32|Y<<32-(39-32)),w=(ge>>>28|Y<<32-28)^(Y>>>34-32|ge<<32-(34-32))^(Y>>>39-32|ge<<32-(39-32)),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,b=Y&fe^Y&le^fe&le,w=ge&Ae^ge&be^Ae&be,C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,te=U&65535|I<<16,W=C&65535|v<<16,b=V,w=ne,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=q,w=H,C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,V=U&65535|I<<16,ne=C&65535|v<<16,fe=A,le=S,de=B,g=V,he=D,ve=Te,_e=G,Y=te,Ae=re,be=ue,We=ce,Ue=ne,Me=ie,De=oe,qe=F,ge=W,$%16===15)for(M=0;M<16;M++)b=l[M],w=m[M],C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=l[(M+9)%16],w=m[(M+9)%16],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,q=l[(M+1)%16],H=m[(M+1)%16],b=(q>>>1|H<<32-1)^(q>>>8|H<<32-8)^q>>>7,w=(H>>>1|q<<32-1)^(H>>>8|q<<32-8)^(H>>>7|q<<32-7),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,q=l[(M+14)%16],H=m[(M+14)%16],b=(q>>>19|H<<32-19)^(H>>>61-32|q<<32-(61-32))^q>>>6,w=(H>>>19|q<<32-19)^(q>>>61-32|H<<32-(61-32))^(H>>>6|q<<32-6),C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,l[M]=U&65535|I<<16,m[M]=C&65535|v<<16;b=Y,w=ge,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[0],w=d[0],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[0]=Y=U&65535|I<<16,d[0]=ge=C&65535|v<<16,b=fe,w=Ae,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[1],w=d[1],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[1]=fe=U&65535|I<<16,d[1]=Ae=C&65535|v<<16,b=le,w=be,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[2],w=d[2],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[2]=le=U&65535|I<<16,d[2]=be=C&65535|v<<16,b=de,w=We,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[3],w=d[3],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[3]=de=U&65535|I<<16,d[3]=We=C&65535|v<<16,b=g,w=Ue,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[4],w=d[4],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[4]=g=U&65535|I<<16,d[4]=Ue=C&65535|v<<16,b=he,w=Me,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[5],w=d[5],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[5]=he=U&65535|I<<16,d[5]=Me=C&65535|v<<16,b=ve,w=De,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[6],w=d[6],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[6]=ve=U&65535|I<<16,d[6]=De=C&65535|v<<16,b=_e,w=qe,C=w&65535,v=w>>>16,U=b&65535,I=b>>>16,b=a[7],w=d[7],C+=w&65535,v+=w>>>16,U+=b&65535,I+=b>>>16,v+=C>>>16,U+=v>>>16,I+=U>>>16,a[7]=_e=U&65535|I<<16,d[7]=qe=C&65535|v<<16,Je+=128,i-=128}return i}function Mr(a,d,f){var i=new Int32Array(8),l=new Int32Array(8),m=new Uint8Array(256),A,S=f;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,l[0]=4089235720,l[1]=2227873595,l[2]=4271175723,l[3]=1595750129,l[4]=2917565137,l[5]=725511199,l[6]=4215389547,l[7]=327033209,Va(i,l,d,f),f%=128,A=0;A<f;A++)m[A]=d[S-f+A];for(m[f]=128,f=256-128*(f<112?1:0),m[f-9]=0,T(m,f-8,S/536870912|0,S<<3),Va(i,l,m,f),A=0;A<8;A++)T(a,8*A,i[A],l[A]);return 0}function Mo(a,d){var f=t(),i=t(),l=t(),m=t(),A=t(),S=t(),B=t(),V=t(),D=t();Xe(f,a[1],a[0]),Xe(D,d[1],d[0]),ae(f,f,D),ke(i,a[0],a[1]),ke(D,d[0],d[1]),ae(i,i,D),ae(l,a[3],d[3]),ae(l,l,h),ae(m,a[2],d[2]),ke(m,m,m),Xe(A,i,f),Xe(S,m,l),ke(B,m,l),ke(V,i,f),ae(a[0],A,S),ae(a[1],V,B),ae(a[2],B,S),ae(a[3],A,V)}function Qa(a,d,f){var i;for(i=0;i<4;i++)se(a[i],d[i],f)}function ji(a,d){var f=t(),i=t(),l=t();xr(l,d[2]),ae(f,d[0],l),ae(i,d[1],l),Ee(a,i),a[31]^=je(f)<<7}function Wi(a,d,f){var i,l;for(O(a[0],s),O(a[1],c),O(a[2],c),O(a[3],s),l=255;l>=0;--l)i=f[l/8|0]>>(l&7)&1,Qa(a,d,i),Mo(d,a),Mo(a,a),Qa(a,d,i)}function Do(a,d){var f=[t(),t(),t(),t()];O(f[0],y),O(f[1],x),O(f[2],c),ae(f[3],y,x),Wi(a,f,d)}function Yi(a,d,f){var i=new Uint8Array(64),l=[t(),t(),t(),t()],m;for(f||e(d,32),Mr(i,d,32),i[0]&=248,i[31]&=127,i[31]|=64,Do(l,i),ji(a,l),m=0;m<32;m++)d[m+32]=a[m];return 0}var qo=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Xi(a,d){var f,i,l,m;for(i=63;i>=32;--i){for(f=0,l=i-32,m=i-12;l<m;++l)d[l]+=f-16*d[i]*qo[l-(i-32)],f=Math.floor((d[l]+128)/256),d[l]-=f*256;d[l]+=f,d[i]=0}for(f=0,l=0;l<32;l++)d[l]+=f-(d[31]>>4)*qo[l],f=d[l]>>8,d[l]&=255;for(l=0;l<32;l++)d[l]-=f*qo[l];for(i=0;i<32;i++)d[i+1]+=d[i]>>8,a[i]=d[i]&255}function Zi(a){var d=new Float64Array(64),f;for(f=0;f<64;f++)d[f]=a[f];for(f=0;f<64;f++)a[f]=0;Xi(a,d)}function ja(a,d,f,i){var l=new Uint8Array(64),m=new Uint8Array(64),A=new Uint8Array(64),S,B,V=new Float64Array(64),D=[t(),t(),t(),t()];Mr(l,i,32),l[0]&=248,l[31]&=127,l[31]|=64;var Te=f+64;for(S=0;S<f;S++)a[64+S]=d[S];for(S=0;S<32;S++)a[32+S]=l[32+S];for(Mr(A,a.subarray(32),f+32),Zi(A),Do(D,A),ji(a,D),S=32;S<64;S++)a[S]=i[S];for(Mr(m,a,f+64),Zi(m),S=0;S<64;S++)V[S]=0;for(S=0;S<32;S++)V[S]=A[S];for(S=0;S<32;S++)for(B=0;B<32;B++)V[S+B]+=m[S]*l[B];return Xi(a.subarray(32),V),Te}function Dd(a,d){var f=t(),i=t(),l=t(),m=t(),A=t(),S=t(),B=t();return O(a[2],c),ot(a[1],d),Ze(l,a[1]),ae(m,l,p),Xe(l,l,a[2]),ke(m,a[2],m),Ze(A,m),Ze(S,A),ae(B,S,A),ae(f,B,l),ae(f,f,m),Rt(f,f),ae(f,f,l),ae(f,f,m),ae(f,f,m),ae(a[0],f,m),Ze(i,a[0]),ae(i,i,m),Se(i,l)&&ae(a[0],a[0],_),Ze(i,a[0]),ae(i,i,m),Se(i,l)?-1:(je(a[0])===d[31]>>7&&Xe(a[0],s,a[0]),ae(a[3],a[0],a[1]),0)}function Ji(a,d,f,i){var l,m=new Uint8Array(32),A=new Uint8Array(64),S=[t(),t(),t(),t()],B=[t(),t(),t(),t()];if(f<64||Dd(B,i))return-1;for(l=0;l<f;l++)a[l]=d[l];for(l=0;l<32;l++)a[l+32]=i[l];if(Mr(A,a,f),Zi(A),Wi(S,B,A),Do(B,d.subarray(32)),Mo(S,B),ji(m,S),f-=64,R(d,0,m,0)){for(l=0;l<f;l++)a[l]=0;return-1}for(l=0;l<f;l++)a[l]=d[l+64];return f}var es=32,Go=24,jn=32,Sn=16,Wn=32,Lo=32,Yn=32,Xn=32,ts=32,Wa=Go,qd=jn,Gd=Sn,Jt=64,Dr=32,Un=64,rs=32,ns=64;r.lowlevel={crypto_core_hsalsa20:ee,crypto_stream_xor:Re,crypto_stream:X,crypto_stream_salsa20_xor:j,crypto_stream_salsa20:J,crypto_onetimeauth:ye,crypto_onetimeauth_verify:Ve,crypto_verify_16:E,crypto_verify_32:R,crypto_secretbox:Qe,crypto_secretbox_open:dt,crypto_scalarmult:Ar,crypto_scalarmult_base:vt,crypto_box_beforenm:Nr,crypto_box_afternm:mt,crypto_box:En,crypto_box_open:No,crypto_box_keypair:Zt,crypto_hash:Mr,crypto_sign:ja,crypto_sign_keypair:Yi,crypto_sign_open:Ji,crypto_secretbox_KEYBYTES:es,crypto_secretbox_NONCEBYTES:Go,crypto_secretbox_ZEROBYTES:jn,crypto_secretbox_BOXZEROBYTES:Sn,crypto_scalarmult_BYTES:Wn,crypto_scalarmult_SCALARBYTES:Lo,crypto_box_PUBLICKEYBYTES:Yn,crypto_box_SECRETKEYBYTES:Xn,crypto_box_BEFORENMBYTES:ts,crypto_box_NONCEBYTES:Wa,crypto_box_ZEROBYTES:qd,crypto_box_BOXZEROBYTES:Gd,crypto_sign_BYTES:Jt,crypto_sign_PUBLICKEYBYTES:Dr,crypto_sign_SECRETKEYBYTES:Un,crypto_sign_SEEDBYTES:rs,crypto_hash_BYTES:ns,gf:t,D:p,L:qo,pack25519:Ee,unpack25519:ot,M:ae,A:ke,S:Ze,Z:Xe,pow2523:Rt,add:Mo,set25519:O,modL:Xi,scalarmult:Wi,scalarbase:Do};function Ya(a,d){if(a.length!==es)throw new Error("bad key size");if(d.length!==Go)throw new Error("bad nonce size")}function Ld(a,d){if(a.length!==Yn)throw new Error("bad public key size");if(d.length!==Xn)throw new Error("bad secret key size")}function xt(){for(var a=0;a<arguments.length;a++)if(!(arguments[a]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Xa(a){for(var d=0;d<a.length;d++)a[d]=0}r.randomBytes=function(a){var d=new Uint8Array(a);return e(d,a),d},r.secretbox=function(a,d,f){xt(a,d,f),Ya(f,d);for(var i=new Uint8Array(jn+a.length),l=new Uint8Array(i.length),m=0;m<a.length;m++)i[m+jn]=a[m];return Qe(l,i,i.length,d,f),l.subarray(Sn)},r.secretbox.open=function(a,d,f){xt(a,d,f),Ya(f,d);for(var i=new Uint8Array(Sn+a.length),l=new Uint8Array(i.length),m=0;m<a.length;m++)i[m+Sn]=a[m];return i.length<32||dt(l,i,i.length,d,f)!==0?null:l.subarray(jn)},r.secretbox.keyLength=es,r.secretbox.nonceLength=Go,r.secretbox.overheadLength=Sn,r.scalarMult=function(a,d){if(xt(a,d),a.length!==Lo)throw new Error("bad n size");if(d.length!==Wn)throw new Error("bad p size");var f=new Uint8Array(Wn);return Ar(f,a,d),f},r.scalarMult.base=function(a){if(xt(a),a.length!==Lo)throw new Error("bad n size");var d=new Uint8Array(Wn);return vt(d,a),d},r.scalarMult.scalarLength=Lo,r.scalarMult.groupElementLength=Wn,r.box=function(a,d,f,i){var l=r.box.before(f,i);return r.secretbox(a,d,l)},r.box.before=function(a,d){xt(a,d),Ld(a,d);var f=new Uint8Array(ts);return Nr(f,a,d),f},r.box.after=r.secretbox,r.box.open=function(a,d,f,i){var l=r.box.before(f,i);return r.secretbox.open(a,d,l)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var a=new Uint8Array(Yn),d=new Uint8Array(Xn);return Zt(a,d),{publicKey:a,secretKey:d}},r.box.keyPair.fromSecretKey=function(a){if(xt(a),a.length!==Xn)throw new Error("bad secret key size");var d=new Uint8Array(Yn);return vt(d,a),{publicKey:d,secretKey:new Uint8Array(a)}},r.box.publicKeyLength=Yn,r.box.secretKeyLength=Xn,r.box.sharedKeyLength=ts,r.box.nonceLength=Wa,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(a,d){if(xt(a,d),d.length!==Un)throw new Error("bad secret key size");var f=new Uint8Array(Jt+a.length);return ja(f,a,a.length,d),f},r.sign.open=function(a,d){if(xt(a,d),d.length!==Dr)throw new Error("bad public key size");var f=new Uint8Array(a.length),i=Ji(f,a,a.length,d);if(i<0)return null;for(var l=new Uint8Array(i),m=0;m<l.length;m++)l[m]=f[m];return l},r.sign.detached=function(a,d){for(var f=r.sign(a,d),i=new Uint8Array(Jt),l=0;l<i.length;l++)i[l]=f[l];return i},r.sign.detached.verify=function(a,d,f){if(xt(a,d,f),d.length!==Jt)throw new Error("bad signature size");if(f.length!==Dr)throw new Error("bad public key size");var i=new Uint8Array(Jt+a.length),l=new Uint8Array(Jt+a.length),m;for(m=0;m<Jt;m++)i[m]=d[m];for(m=0;m<a.length;m++)i[m+Jt]=a[m];return Ji(l,i,i.length,f)>=0},r.sign.keyPair=function(){var a=new Uint8Array(Dr),d=new Uint8Array(Un);return Yi(a,d),{publicKey:a,secretKey:d}},r.sign.keyPair.fromSecretKey=function(a){if(xt(a),a.length!==Un)throw new Error("bad secret key size");for(var d=new Uint8Array(Dr),f=0;f<d.length;f++)d[f]=a[32+f];return{publicKey:d,secretKey:new Uint8Array(a)}},r.sign.keyPair.fromSeed=function(a){if(xt(a),a.length!==rs)throw new Error("bad seed size");for(var d=new Uint8Array(Dr),f=new Uint8Array(Un),i=0;i<32;i++)f[i]=a[i];return Yi(d,f,!0),{publicKey:d,secretKey:f}},r.sign.publicKeyLength=Dr,r.sign.secretKeyLength=Un,r.sign.seedLength=rs,r.sign.signatureLength=Jt,r.hash=function(a){xt(a);var d=new Uint8Array(ns);return Mr(d,a,a.length),d},r.hash.hashLength=ns,r.verify=function(a,d){return xt(a,d),a.length===0||d.length===0||a.length!==d.length?!1:N(a,0,d,0,a.length)===0},r.setPRNG=function(a){e=a},function(){var a=typeof self<"u"?self.crypto||self.msCrypto:null;if(a&&a.getRandomValues){var d=65536;r.setPRNG(function(f,i){var l,m=new Uint8Array(i);for(l=0;l<i;l+=d)a.getRandomValues(m.subarray(l,l+Math.min(i-l,d)));for(l=0;l<i;l++)f[l]=m[l];Xa(m)})}else typeof Ja<"u"&&(a=Ec(),a&&a.randomBytes&&r.setPRNG(function(f,i){var l,m=a.randomBytes(i);for(l=0;l<i;l++)f[l]=m[l];Xa(m)}))}()})(typeof ri<"u"&&ri.exports?ri.exports:self.nacl=self.nacl||{})});var sa=we((Ox,Mu)=>{"use strict";Mu.exports=function(t,e){return function(){for(var o=new Array(arguments.length),s=0;s<o.length;s++)o[s]=arguments[s];return t.apply(e,o)}}});var rt=we((zx,Gu)=>{"use strict";var Sp=sa(),ca=Object.prototype.toString,ua=function(r){return function(t){var e=ca.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())}}(Object.create(null));function sn(r){return r=r.toLowerCase(),function(e){return ua(e)===r}}function fa(r){return Array.isArray(r)}function vi(r){return typeof r>"u"}function Up(r){return r!==null&&!vi(r)&&r.constructor!==null&&!vi(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var Du=sn("ArrayBuffer");function Cp(r){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&Du(r.buffer),t}function Ip(r){return typeof r=="string"}function Bp(r){return typeof r=="number"}function qu(r){return r!==null&&typeof r=="object"}function Ti(r){if(ua(r)!=="object")return!1;var t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}var Rp=sn("Date"),Pp=sn("File"),kp=sn("Blob"),Op=sn("FileList");function da(r){return ca.call(r)==="[object Function]"}function zp(r){return qu(r)&&da(r.pipe)}function Np(r){var t="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||ca.call(r)===t||da(r.toString)&&r.toString()===t)}var Mp=sn("URLSearchParams");function Dp(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function qp(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function la(r,t){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),fa(r))for(var e=0,n=r.length;e<n;e++)t.call(null,r[e],e,r);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&t.call(null,r[o],o,r)}function aa(){var r={};function t(o,s){Ti(r[s])&&Ti(o)?r[s]=aa(r[s],o):Ti(o)?r[s]=aa({},o):fa(o)?r[s]=o.slice():r[s]=o}for(var e=0,n=arguments.length;e<n;e++)la(arguments[e],t);return r}function Gp(r,t,e){return la(t,function(o,s){e&&typeof o=="function"?r[s]=Sp(o,e):r[s]=o}),r}function Lp(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function Fp(r,t,e,n){r.prototype=Object.create(t.prototype,n),r.prototype.constructor=r,e&&Object.assign(r.prototype,e)}function Kp(r,t,e){var n,o,s,c={};t=t||{};do{for(n=Object.getOwnPropertyNames(r),o=n.length;o-- >0;)s=n[o],c[s]||(t[s]=r[s],c[s]=!0);r=Object.getPrototypeOf(r)}while(r&&(!e||e(r,t))&&r!==Object.prototype);return t}function Hp(r,t,e){r=String(r),(e===void 0||e>r.length)&&(e=r.length),e-=t.length;var n=r.indexOf(t,e);return n!==-1&&n===e}function $p(r){if(!r)return null;var t=r.length;if(vi(t))return null;for(var e=new Array(t);t-- >0;)e[t]=r[t];return e}var Vp=function(r){return function(t){return r&&t instanceof r}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));Gu.exports={isArray:fa,isArrayBuffer:Du,isBuffer:Up,isFormData:Np,isArrayBufferView:Cp,isString:Ip,isNumber:Bp,isObject:qu,isPlainObject:Ti,isUndefined:vi,isDate:Rp,isFile:Pp,isBlob:kp,isFunction:da,isStream:zp,isURLSearchParams:Mp,isStandardBrowserEnv:qp,forEach:la,merge:aa,extend:Gp,trim:Dp,stripBOM:Lp,inherits:Fp,toFlatObject:Kp,kindOf:ua,kindOfTest:sn,endsWith:Hp,toArray:$p,isTypedArray:Vp,isFileList:Op}});var pa=we((Nx,Fu)=>{"use strict";var kn=rt();function Lu(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}Fu.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if(kn.isURLSearchParams(e))o=e.toString();else{var s=[];kn.forEach(e,function(p,h){p===null||typeof p>"u"||(kn.isArray(p)?h=h+"[]":p=[p],kn.forEach(p,function(x){kn.isDate(x)?x=x.toISOString():kn.isObject(x)&&(x=JSON.stringify(x)),s.push(Lu(h)+"="+Lu(x))}))}),o=s.join("&")}if(o){var c=t.indexOf("#");c!==-1&&(t=t.slice(0,c)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}});var Hu=we((Mx,Ku)=>{"use strict";var Qp=rt();function _i(){this.handlers=[]}_i.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};_i.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};_i.prototype.forEach=function(t){Qp.forEach(this.handlers,function(n){n!==null&&t(n)})};Ku.exports=_i});var Vu=we((Dx,$u)=>{"use strict";var jp=rt();$u.exports=function(t,e){jp.forEach(t,function(o,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=o,delete t[s])})}});var an=we((qx,Yu)=>{"use strict";var Qu=rt();function On(r,t,e,n,o){Error.call(this),this.message=r,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),o&&(this.response=o)}Qu.inherits(On,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var ju=On.prototype,Wu={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(r){Wu[r]={value:r}});Object.defineProperties(On,Wu);Object.defineProperty(ju,"isAxiosError",{value:!0});On.from=function(r,t,e,n,o,s){var c=Object.create(ju);return Qu.toFlatObject(r,c,function(p){return p!==Error.prototype}),On.call(c,r.message,t,e,n,o),c.name=r.name,s&&Object.assign(c,s),c};Yu.exports=On});var ga=we((Gx,Xu)=>{"use strict";Xu.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var ha=we((Lx,Zu)=>{"use strict";var Lt=rt();function Wp(r,t){t=t||new FormData;var e=[];function n(s){return s===null?"":Lt.isDate(s)?s.toISOString():Lt.isArrayBuffer(s)||Lt.isTypedArray(s)?typeof Blob=="function"?new Blob([s]):Buffer.from(s):s}function o(s,c){if(Lt.isPlainObject(s)||Lt.isArray(s)){if(e.indexOf(s)!==-1)throw Error("Circular reference detected in "+c);e.push(s),Lt.forEach(s,function(p,h){if(!Lt.isUndefined(p)){var y=c?c+"."+h:h,x;if(p&&!c&&typeof p=="object"){if(Lt.endsWith(h,"{}"))p=JSON.stringify(p);else if(Lt.endsWith(h,"[]")&&(x=Lt.toArray(p))){x.forEach(function(_){!Lt.isUndefined(_)&&t.append(y,n(_))});return}}o(p,y)}}),e.pop()}else t.append(c,n(s))}return o(r),t}Zu.exports=Wp});var ef=we((Fx,Ju)=>{"use strict";var ya=an();Ju.exports=function(t,e,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?t(n):e(new ya("Request failed with status code "+n.status,[ya.ERR_BAD_REQUEST,ya.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var rf=we((Kx,tf)=>{"use strict";var Ei=rt();tf.exports=Ei.isStandardBrowserEnv()?function(){return{write:function(e,n,o,s,c,u){var p=[];p.push(e+"="+encodeURIComponent(n)),Ei.isNumber(o)&&p.push("expires="+new Date(o).toGMTString()),Ei.isString(s)&&p.push("path="+s),Ei.isString(c)&&p.push("domain="+c),u===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(e){var n=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var of=we((Hx,nf)=>{"use strict";nf.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}});var af=we(($x,sf)=>{"use strict";sf.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}});var ma=we((Vx,cf)=>{"use strict";var Yp=of(),Xp=af();cf.exports=function(t,e){return t&&!Yp(e)?Xp(t,e):e}});var ff=we((Qx,uf)=>{"use strict";var xa=rt(),Zp=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];uf.exports=function(t){var e={},n,o,s;return t&&xa.forEach(t.split(`
|
|
2
|
-
`),function(u){if(s=u.indexOf(":"),n=xa.trim(u.substr(0,s)).toLowerCase(),o=xa.trim(u.substr(s+1)),n){if(e[n]&&Zp.indexOf(n)>=0)return;n==="set-cookie"?e[n]=(e[n]?e[n]:[]).concat([o]):e[n]=e[n]?e[n]+", "+o:o}}),e}});var pf=we((jx,lf)=>{"use strict";var df=rt();lf.exports=df.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),n;function o(s){var c=s;return t&&(e.setAttribute("href",c),c=e.href),e.setAttribute("href",c),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=o(window.location.href),function(c){var u=df.isString(c)?o(c):c;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var po=we((Wx,hf)=>{"use strict";var Aa=an(),Jp=rt();function gf(r){Aa.call(this,r??"canceled",Aa.ERR_CANCELED),this.name="CanceledError"}Jp.inherits(gf,Aa,{__CANCEL__:!0});hf.exports=gf});var mf=we((Yx,yf)=>{"use strict";yf.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}});var ba=we((Xx,xf)=>{"use strict";var go=rt(),eg=ef(),tg=rf(),rg=pa(),ng=ma(),og=ff(),ig=pf(),sg=ga(),lr=an(),ag=po(),cg=mf();xf.exports=function(t){return new Promise(function(n,o){var s=t.data,c=t.headers,u=t.responseType,p;function h(){t.cancelToken&&t.cancelToken.unsubscribe(p),t.signal&&t.signal.removeEventListener("abort",p)}go.isFormData(s)&&go.isStandardBrowserEnv()&&delete c["Content-Type"];var y=new XMLHttpRequest;if(t.auth){var x=t.auth.username||"",_=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";c.Authorization="Basic "+btoa(x+":"+_)}var T=ng(t.baseURL,t.url);y.open(t.method.toUpperCase(),rg(T,t.params,t.paramsSerializer),!0),y.timeout=t.timeout;function N(){if(y){var P="getAllResponseHeaders"in y?og(y.getAllResponseHeaders()):null,Q=!u||u==="text"||u==="json"?y.responseText:y.response,z={data:Q,status:y.status,statusText:y.statusText,headers:P,config:t,request:y};eg(function(L){n(L),h()},function(L){o(L),h()},z),y=null}}if("onloadend"in y?y.onloadend=N:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(N)},y.onabort=function(){y&&(o(new lr("Request aborted",lr.ECONNABORTED,t,y)),y=null)},y.onerror=function(){o(new lr("Network Error",lr.ERR_NETWORK,t,y,y)),y=null},y.ontimeout=function(){var Q=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",z=t.transitional||sg;t.timeoutErrorMessage&&(Q=t.timeoutErrorMessage),o(new lr(Q,z.clarifyTimeoutError?lr.ETIMEDOUT:lr.ECONNABORTED,t,y)),y=null},go.isStandardBrowserEnv()){var E=(t.withCredentials||ig(T))&&t.xsrfCookieName?tg.read(t.xsrfCookieName):void 0;E&&(c[t.xsrfHeaderName]=E)}"setRequestHeader"in y&&go.forEach(c,function(Q,z){typeof s>"u"&&z.toLowerCase()==="content-type"?delete c[z]:y.setRequestHeader(z,Q)}),go.isUndefined(t.withCredentials)||(y.withCredentials=!!t.withCredentials),u&&u!=="json"&&(y.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&y.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&y.upload&&y.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(p=function(P){y&&(o(!P||P&&P.type?new ag:P),y.abort(),y=null)},t.cancelToken&&t.cancelToken.subscribe(p),t.signal&&(t.signal.aborted?p():t.signal.addEventListener("abort",p))),s||(s=null);var R=cg(T);if(R&&["http","https","file"].indexOf(R)===-1){o(new lr("Unsupported protocol "+R+":",lr.ERR_BAD_REQUEST,t));return}y.send(s)})}});var bf=we((Zx,Af)=>{"use strict";Af.exports=null});var Ui=we((Jx,_f)=>{"use strict";var nt=rt(),wf=Vu(),Tf=an(),ug=ga(),fg=ha(),dg={"Content-Type":"application/x-www-form-urlencoded"};function vf(r,t){!nt.isUndefined(r)&&nt.isUndefined(r["Content-Type"])&&(r["Content-Type"]=t)}function lg(){var r;return typeof XMLHttpRequest<"u"?r=ba():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=ba()),r}function pg(r,t,e){if(nt.isString(r))try{return(t||JSON.parse)(r),nt.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(r)}var Si={transitional:ug,adapter:lg(),transformRequest:[function(t,e){if(wf(e,"Accept"),wf(e,"Content-Type"),nt.isFormData(t)||nt.isArrayBuffer(t)||nt.isBuffer(t)||nt.isStream(t)||nt.isFile(t)||nt.isBlob(t))return t;if(nt.isArrayBufferView(t))return t.buffer;if(nt.isURLSearchParams(t))return vf(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n=nt.isObject(t),o=e&&e["Content-Type"],s;if((s=nt.isFileList(t))||n&&o==="multipart/form-data"){var c=this.env&&this.env.FormData;return fg(s?{"files[]":t}:t,c&&new c)}else if(n||o==="application/json")return vf(e,"application/json"),pg(t);return t}],transformResponse:[function(t){var e=this.transitional||Si.transitional,n=e&&e.silentJSONParsing,o=e&&e.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||o&&nt.isString(t)&&t.length)try{return JSON.parse(t)}catch(c){if(s)throw c.name==="SyntaxError"?Tf.from(c,Tf.ERR_BAD_RESPONSE,this,null,this.response):c}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:bf()},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};nt.forEach(["delete","get","head"],function(t){Si.headers[t]={}});nt.forEach(["post","put","patch"],function(t){Si.headers[t]=nt.merge(dg)});_f.exports=Si});var Sf=we((eA,Ef)=>{"use strict";var gg=rt(),hg=Ui();Ef.exports=function(t,e,n){var o=this||hg;return gg.forEach(n,function(c){t=c.call(o,t,e)}),t}});var wa=we((tA,Uf)=>{"use strict";Uf.exports=function(t){return!!(t&&t.__CANCEL__)}});var Bf=we((rA,If)=>{"use strict";var Cf=rt(),Ta=Sf(),yg=wa(),mg=Ui(),xg=po();function va(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new xg}If.exports=function(t){va(t),t.headers=t.headers||{},t.data=Ta.call(t,t.data,t.headers,t.transformRequest),t.headers=Cf.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),Cf.forEach(["delete","get","head","post","put","patch","common"],function(o){delete t.headers[o]});var e=t.adapter||mg.adapter;return e(t).then(function(o){return va(t),o.data=Ta.call(t,o.data,o.headers,t.transformResponse),o},function(o){return yg(o)||(va(t),o&&o.response&&(o.response.data=Ta.call(t,o.response.data,o.response.headers,t.transformResponse))),Promise.reject(o)})}});var _a=we((nA,Rf)=>{"use strict";var Tt=rt();Rf.exports=function(t,e){e=e||{};var n={};function o(y,x){return Tt.isPlainObject(y)&&Tt.isPlainObject(x)?Tt.merge(y,x):Tt.isPlainObject(x)?Tt.merge({},x):Tt.isArray(x)?x.slice():x}function s(y){if(Tt.isUndefined(e[y])){if(!Tt.isUndefined(t[y]))return o(void 0,t[y])}else return o(t[y],e[y])}function c(y){if(!Tt.isUndefined(e[y]))return o(void 0,e[y])}function u(y){if(Tt.isUndefined(e[y])){if(!Tt.isUndefined(t[y]))return o(void 0,t[y])}else return o(void 0,e[y])}function p(y){if(y in e)return o(t[y],e[y]);if(y in t)return o(void 0,t[y])}var h={url:c,method:c,data:c,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:p};return Tt.forEach(Object.keys(t).concat(Object.keys(e)),function(x){var _=h[x]||s,T=_(x);Tt.isUndefined(T)&&_!==p||(n[x]=T)}),n}});var Ea=we((oA,Pf)=>{"use strict";Pf.exports={version:"0.27.2"}});var zf=we((iA,Of)=>{"use strict";var Ag=Ea().version,kr=an(),Sa={};["object","boolean","number","function","string","symbol"].forEach(function(r,t){Sa[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});var kf={};Sa.transitional=function(t,e,n){function o(s,c){return"[Axios v"+Ag+"] Transitional option '"+s+"'"+c+(n?". "+n:"")}return function(s,c,u){if(t===!1)throw new kr(o(c," has been removed"+(e?" in "+e:"")),kr.ERR_DEPRECATED);return e&&!kf[c]&&(kf[c]=!0,console.warn(o(c," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,c,u):!0}};function bg(r,t,e){if(typeof r!="object")throw new kr("options must be an object",kr.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),o=n.length;o-- >0;){var s=n[o],c=t[s];if(c){var u=r[s],p=u===void 0||c(u,s,r);if(p!==!0)throw new kr("option "+s+" must be "+p,kr.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new kr("Unknown option "+s,kr.ERR_BAD_OPTION)}}Of.exports={assertOptions:bg,validators:Sa}});var Lf=we((sA,Gf)=>{"use strict";var Df=rt(),wg=pa(),Nf=Hu(),Mf=Bf(),Ci=_a(),Tg=ma(),qf=zf(),zn=qf.validators;function Nn(r){this.defaults=r,this.interceptors={request:new Nf,response:new Nf}}Nn.prototype.request=function(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Ci(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;n!==void 0&&qf.assertOptions(n,{silentJSONParsing:zn.transitional(zn.boolean),forcedJSONParsing:zn.transitional(zn.boolean),clarifyTimeoutError:zn.transitional(zn.boolean)},!1);var o=[],s=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(e)===!1||(s=s&&T.synchronous,o.unshift(T.fulfilled,T.rejected))});var c=[];this.interceptors.response.forEach(function(T){c.push(T.fulfilled,T.rejected)});var u;if(!s){var p=[Mf,void 0];for(Array.prototype.unshift.apply(p,o),p=p.concat(c),u=Promise.resolve(e);p.length;)u=u.then(p.shift(),p.shift());return u}for(var h=e;o.length;){var y=o.shift(),x=o.shift();try{h=y(h)}catch(_){x(_);break}}try{u=Mf(h)}catch(_){return Promise.reject(_)}for(;c.length;)u=u.then(c.shift(),c.shift());return u};Nn.prototype.getUri=function(t){t=Ci(this.defaults,t);var e=Tg(t.baseURL,t.url);return wg(e,t.params,t.paramsSerializer)};Df.forEach(["delete","get","head","options"],function(t){Nn.prototype[t]=function(e,n){return this.request(Ci(n||{},{method:t,url:e,data:(n||{}).data}))}});Df.forEach(["post","put","patch"],function(t){function e(n){return function(s,c,u){return this.request(Ci(u||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:c}))}}Nn.prototype[t]=e(),Nn.prototype[t+"Form"]=e(!0)});Gf.exports=Nn});var Kf=we((aA,Ff)=>{"use strict";var vg=po();function Mn(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(o){t=o});var e=this;this.promise.then(function(n){if(e._listeners){var o,s=e._listeners.length;for(o=0;o<s;o++)e._listeners[o](n);e._listeners=null}}),this.promise.then=function(n){var o,s=new Promise(function(c){e.subscribe(c),o=c}).then(n);return s.cancel=function(){e.unsubscribe(o)},s},r(function(o){e.reason||(e.reason=new vg(o),t(e.reason))})}Mn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Mn.prototype.subscribe=function(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]};Mn.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}};Mn.source=function(){var t,e=new Mn(function(o){t=o});return{token:e,cancel:t}};Ff.exports=Mn});var $f=we((cA,Hf)=>{"use strict";Hf.exports=function(t){return function(n){return t.apply(null,n)}}});var Qf=we((uA,Vf)=>{"use strict";var _g=rt();Vf.exports=function(t){return _g.isObject(t)&&t.isAxiosError===!0}});var Yf=we((fA,Ua)=>{"use strict";var jf=rt(),Eg=sa(),Ii=Lf(),Sg=_a(),Ug=Ui();function Wf(r){var t=new Ii(r),e=Eg(Ii.prototype.request,t);return jf.extend(e,Ii.prototype,t),jf.extend(e,t),e.create=function(o){return Wf(Sg(r,o))},e}var gt=Wf(Ug);gt.Axios=Ii;gt.CanceledError=po();gt.CancelToken=Kf();gt.isCancel=wa();gt.VERSION=Ea().version;gt.toFormData=ha();gt.AxiosError=an();gt.Cancel=gt.CanceledError;gt.all=function(t){return Promise.all(t)};gt.spread=$f();gt.isAxiosError=Qf();Ua.exports=gt;Ua.exports.default=gt});var Zf=we((dA,Xf)=>{"use strict";Xf.exports=Yf()});var Hg={};ec(Hg,{APTOS_BIP44_REGEX:()=>Oc,APTOS_COIN:()=>xs,APTOS_HARDENED_REGEX:()=>kc,Account:()=>dr,AccountAddress:()=>k,AccountAuthenticator:()=>ht,AccountAuthenticatorEd25519:()=>gr,AccountAuthenticatorMultiEd25519:()=>ki,AccountAuthenticatorMultiKey:()=>Dn,AccountAuthenticatorSingleKey:()=>Wt,AccountAuthenticatorVariant:()=>cs,AddressInvalidReason:()=>mc,AnyPublicKeyVariant:()=>us,AnySignatureVariant:()=>fs,Aptos:()=>yt,AptosApiError:()=>Vt,AptosApiType:()=>to,AptosConfig:()=>ho,AuthenticationKey:()=>Gt,Bool:()=>Ge,CKDPriv:()=>zs,ChainId:()=>ln,DEFAULT_MAX_GAS_AMOUNT:()=>ys,DEFAULT_NETWORK:()=>hs,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>ms,DEFAULT_TXN_TIMEOUT_SEC:()=>ro,DeriveScheme:()=>ac,Deserializer:()=>io,Ed25519PrivateKey:()=>or,Ed25519PublicKey:()=>Pe,Ed25519Signature:()=>Ke,EntryFunction:()=>vn,EntryFunctionBytes:()=>so,FeePayerRawTransaction:()=>mr,FixedBytes:()=>Er,HARDENED_OFFSET:()=>Ps,Hex:()=>me,HexInvalidReason:()=>hc,Identifier:()=>Ne,KeyType:()=>zc,MimeType:()=>Fo,ModuleId:()=>qn,MoveAbility:()=>ic,MoveFunctionVisibility:()=>oc,MoveOption:()=>Nt,MoveString:()=>Fe,MoveVector:()=>Be,MultiAgentRawTransaction:()=>yr,MultiEd25519PublicKey:()=>Dt,MultiEd25519Signature:()=>Yr,MultiKey:()=>nn,MultiSig:()=>Hn,MultisigTransactionPayload:()=>$n,Network:()=>eo,NetworkToChainId:()=>Ho,NetworkToFaucetAPI:()=>gs,NetworkToIndexerAPI:()=>Ko,NetworkToNetworkName:()=>Qd,NetworkToNodeAPI:()=>ps,ParsingError:()=>ft,PrivateKey:()=>Vr,PublicKey:()=>At,RAW_TRANSACTION_SALT:()=>As,RAW_TRANSACTION_WITH_DATA_SALT:()=>$o,RawTransaction:()=>Ft,RawTransactionWithData:()=>Ao,RoleType:()=>sc,RotationProofChallenge:()=>yo,Script:()=>Kn,ScriptTransactionArgumentVariants:()=>Cn,Secp256k1PrivateKey:()=>cr,Secp256k1PublicKey:()=>qt,Secp256k1Signature:()=>ur,Serializable:()=>Z,Serializer:()=>Ot,Signature:()=>Mt,SignedTransaction:()=>Kt,SigningScheme:()=>In,SigningSchemeInput:()=>ls,StructTag:()=>Xt,TransactionAuthenticator:()=>Yt,TransactionAuthenticatorEd25519:()=>cn,TransactionAuthenticatorFeePayer:()=>fn,TransactionAuthenticatorMultiAgent:()=>un,TransactionAuthenticatorMultiEd25519:()=>Oi,TransactionAuthenticatorSingleSender:()=>dn,TransactionAuthenticatorVariant:()=>as,TransactionPayload:()=>zr,TransactionPayloadEntryFunction:()=>Ln,TransactionPayloadMultisig:()=>Fn,TransactionPayloadScript:()=>Gn,TransactionPayloadVariants:()=>is,TransactionResponseType:()=>ds,TransactionVariants:()=>ss,TypeTag:()=>$e,TypeTagAddress:()=>bn,TypeTagBool:()=>pn,TypeTagGeneric:()=>wn,TypeTagParserError:()=>Oe,TypeTagParserErrorType:()=>ad,TypeTagReference:()=>xo,TypeTagSigner:()=>Or,TypeTagStruct:()=>hr,TypeTagU128:()=>xn,TypeTagU16:()=>hn,TypeTagU256:()=>An,TypeTagU32:()=>yn,TypeTagU64:()=>mn,TypeTagU8:()=>gn,TypeTagVariants:()=>os,TypeTagVector:()=>Tn,U128:()=>St,U16:()=>_t,U256:()=>Ut,U32:()=>Et,U64:()=>Le,U8:()=>it,aptosCoinStructTag:()=>Ig,aptosRequest:()=>Jn,buildTransaction:()=>Eo,convertArgument:()=>Na,deriveKey:()=>ii,deriveTransactionType:()=>Ga,deserializeFromScriptArgument:()=>od,ensureBoolean:()=>Xo,fetchEntryFunctionAbi:()=>za,findFirstNonSignerArg:()=>ka,generateMultiSignersSignedTransaction:()=>dd,generateRawTransaction:()=>fd,generateSignedTransaction:()=>qa,generateSignedTransactionForSimulation:()=>Ma,generateTransactionPayload:()=>_o,generateTransactionPayloadWithABI:()=>cd,get:()=>fc,getAptosFullNode:()=>lt,getAuthenticatorForSimulation:()=>vo,getFunctionParts:()=>$i,getSigningMessage:()=>ld,isBcsAddress:()=>To,isBcsBool:()=>Ni,isBcsFixedBytes:()=>Pa,isBcsString:()=>Mi,isBcsU128:()=>Fi,isBcsU16:()=>qi,isBcsU256:()=>Ki,isBcsU32:()=>Gi,isBcsU64:()=>Li,isBcsU8:()=>Di,isBool:()=>Ba,isLargeNumber:()=>wo,isNull:()=>Ra,isNumber:()=>bo,isScriptDataInput:()=>Hi,isString:()=>_n,isValidBIP44Path:()=>ks,isValidHardenedPath:()=>Os,mnemonicToSeed:()=>co,objectStructTag:()=>Pg,optionStructTag:()=>Rg,outOfRangeErrorMessage:()=>yc,paginateWithCursor:()=>qr,parseTypeTag:()=>Vn,post:()=>Vo,postAptosFaucet:()=>ws,postAptosFullNode:()=>Gr,postAptosIndexer:()=>bs,request:()=>uc,sign:()=>Da,splitPath:()=>Ns,standardizeTypeTags:()=>Oa,stringStructTag:()=>Bg,throwTypeMismatch:()=>ze,validateNumberInRange:()=>tr});var Vt=class extends Error{constructor(e,n,o){super(o);this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=e}};var nc="0.0.4";var Fo=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(Fo||{}),os=(T=>(T[T.Bool=0]="Bool",T[T.U8=1]="U8",T[T.U64=2]="U64",T[T.U128=3]="U128",T[T.Address=4]="Address",T[T.Signer=5]="Signer",T[T.Vector=6]="Vector",T[T.Struct=7]="Struct",T[T.U16=8]="U16",T[T.U32=9]="U32",T[T.U256=10]="U256",T[T.Reference=254]="Reference",T[T.Generic=255]="Generic",T))(os||{}),Cn=(h=>(h[h.U8=0]="U8",h[h.U64=1]="U64",h[h.U128=2]="U128",h[h.Address=3]="Address",h[h.U8Vector=4]="U8Vector",h[h.Bool=5]="Bool",h[h.U16=6]="U16",h[h.U32=7]="U32",h[h.U256=8]="U256",h))(Cn||{}),is=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(is||{}),ss=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(ss||{}),as=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(as||{}),cs=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(cs||{}),us=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(us||{}),fs=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(fs||{}),ds=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(ds||{}),oc=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(oc||{}),ic=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(ic||{}),sc=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(sc||{}),In=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(In||{}),ls=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(ls||{}),ac=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(ac||{});var cc={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function uc(r,t){let{url:e,method:n,body:o,contentType:s,params:c,overrides:u}=r,p={...u?.HEADERS,"x-aptos-client":`aptos-ts-sdk/${nc}`,"content-type":s??"application/json"};return u?.AUTH_TOKEN&&e.includes("faucet")&&(p.Authorization=`Bearer ${u?.AUTH_TOKEN}`),t.provider({url:e,method:n,body:o,params:c,headers:p,overrides:u})}async function Jn(r,t){let{url:e,path:n}=r,o=`${e}/${n??""}`,s=await uc({...r,url:o},t.client),c={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let p=c.data;if(p.errors)throw new Vt(r,c,p.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);c.data=p.data}if(c.status>=200&&c.status<300)return c;let u;throw"message"in s.data&&"error_code"in s.data?u=JSON.stringify(s.data):c.status in cc?u=cc[c.status]:u=`Unhandled Error ${s.status} : ${s.statusText}`,new Vt(r,c,u)}var Ko={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},ps={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},gs={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},eo=(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(eo||{}),Ho={mainnet:1,testnet:2},Qd={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var to=(n=>(n[n.FULLNODE=0]="FULLNODE",n[n.INDEXER=1]="INDEXER",n[n.FAUCET=2]="FAUCET",n))(to||{}),hs="devnet",ys=2e5,ms=20,ro=20,xs="0x1::aptos_coin::AptosCoin",As="APTOS::RawTransaction",$o="APTOS::RawTransactionWithData";async function fc(r){let{aptosConfig:t,overrides:e,params:n,contentType:o,acceptType:s,path:c,originMethod:u,type:p}=r,h=t.getRequestUrl(p);return Jn({url:h,method:"GET",originMethod:u,path:c,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:n,overrides:{...t.clientConfig,...e}},t)}async function lt(r){return fc({...r,type:0})}async function qr(r){let t=[],e,n=r.params;for(;;){n.start=e;let o=await lt({aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function Vo(r){let{type:t,originMethod:e,path:n,body:o,acceptType:s,contentType:c,params:u,aptosConfig:p,overrides:h}=r,y=p.getRequestUrl(t);return Jn({url:y,method:"POST",originMethod:e,path:n,body:o,contentType:c?.valueOf(),acceptType:s?.valueOf(),params:u,overrides:{...p.clientConfig,...h}},p)}async function Gr(r){return Vo({...r,type:0})}async function bs(r){return Vo({...r,type:1})}async function ws(r){return Vo({...r,type:2})}var Qo=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Ts=r=>r instanceof Uint8Array;var dc=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Qt=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),Pt=(r,t)=>r<<32-t|r>>>t,jd=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!jd)throw new Error("Non little-endian hardware is not supported");var Wd=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Lr(r){if(!Ts(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Wd[r[e]];return t}function Bn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),c=Number.parseInt(s,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[n]=c}return e}function vs(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function kt(r){if(typeof r=="string"&&(r=vs(r)),!Ts(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Fr(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!Ts(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}var Tr=class{clone(){return this._cloneInto()}},Yd={}.toString;function lc(r,t){if(t!==void 0&&Yd.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(r,t)}function vr(r){let t=n=>r().update(kt(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function pc(r){let t=(n,o)=>r(o).update(kt(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function gc(r=32){if(Qo&&typeof Qo.getRandomValues=="function")return Qo.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var jo=2**8-1,Wo=2**16-1,er=2**32-1,Kr=BigInt(2)**BigInt(64)-BigInt(1),no=BigInt(2)**BigInt(128)-BigInt(1),Yo=BigInt(2)**BigInt(256)-BigInt(1);var ft=class extends Error{constructor(e,n){super(e);this.invalidReason=n}};var hc=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(hc||{}),me=class r{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Lr(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new ft("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new ft("Hex string must be an even number of hex characters.","invalid_length");try{return new r(Bn(e))}catch(n){let o=n;throw new ft(`Hex string contains invalid hex characters: ${o.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new r(t):r.fromString(t)}static isValid(t){try{return r.fromString(t),{valid:!0}}catch(e){let n=e;return{valid:!1,invalidReason:n.invalidReason,invalidReasonMessage:n.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};var Z=class{bcsToBytes(){let t=new Ot;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return me.fromHexInput(t)}},Ot=class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,n){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,n,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){Xo(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(er),n=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(n))}serializeU128(t){let e=BigInt(t)&Kr,n=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(n)}serializeU256(t){let e=BigInt(t)&no,n=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(n)}serializeU32AsUleb128(t){let e=t,n=[];for(;e>>>7;)n.push(e&127|128),e>>>=7;n.push(e),this.appendToBuffer(new Uint8Array(n))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}};wr([Hr(0,jo)],Ot.prototype,"serializeU8",1),wr([Hr(0,Wo)],Ot.prototype,"serializeU16",1),wr([Hr(0,er)],Ot.prototype,"serializeU32",1),wr([Hr(BigInt(0),Kr)],Ot.prototype,"serializeU64",1),wr([Hr(BigInt(0),no)],Ot.prototype,"serializeU128",1),wr([Hr(BigInt(0),Yo)],Ot.prototype,"serializeU256",1),wr([Hr(0,er)],Ot.prototype,"serializeU32AsUleb128",1);function Xo(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var yc=(r,t,e)=>`${r} is out of range: [${t}, ${e}]`;function tr(r,t,e){let n=BigInt(r);if(n>BigInt(e)||n<BigInt(t))throw new Error(yc(r,t,e))}function Hr(r,t){return(e,n,o)=>{let s=o.value;return o.value=function(u){return tr(u,r,t),s.apply(this,[u])},o}}var mc=(u=>(u.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",u.INVALID_HEX_CHARS="invalid_hex_chars",u.TOO_SHORT="too_short",u.TOO_LONG="too_long",u.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",u.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",u.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",u))(mc||{}),Ie=class Ie extends Z{constructor(e){super();if(e.length!==Ie.LENGTH)throw new ft("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=Lr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Lr(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let n=e.deserializeFixedBytes(Ie.LENGTH);return new Ie(n)}static fromString(e){if(!e.startsWith("0x"))throw new ft("Hex string must start with a leading 0x.","leading_zero_x_required");let n=Ie.fromStringRelaxed(e);if(e.length!==Ie.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(e.length!==3)throw new ft(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new ft(`The given hex string ${n} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return n}static fromStringRelaxed(e){let n=e;if(e.startsWith("0x")&&(n=e.slice(2)),n.length===0)throw new ft("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new ft("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=Bn(n.padStart(64,"0"))}catch(s){let c=s;throw new ft(`Hex characters are invalid: ${c.message}`,"invalid_hex_chars")}return new Ie(o)}static fromRelaxed(e){return e instanceof Ie?e:e instanceof Uint8Array?new Ie(e):Ie.fromStringRelaxed(e)}static from(e){return e instanceof Ie?e:e instanceof Uint8Array?new Ie(e):Ie.fromString(e)}static isValid(e){try{return e.relaxed?Ie.fromRelaxed(e.input):Ie.from(e.input),{valid:!0}}catch(n){let o=n;return{valid:!1,invalidReason:o.invalidReason,invalidReasonMessage:o.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((n,o)=>n===e.data[o])}};Ie.LENGTH=32,Ie.LONG_STRING_LENGTH=64,Ie.ZERO=Ie.from("0x0"),Ie.ONE=Ie.from("0x1"),Ie.TWO=Ie.from("0x2"),Ie.THREE=Ie.from("0x3"),Ie.FOUR=Ie.from("0x4");var k=Ie;function rr(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function zt(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function Zo(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");rr(r.outputLen),rr(r.blockLen)}function nr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Jo(r,t){zt(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var ei=BigInt(4294967295),_s=BigInt(32);function xc(r,t=!1){return t?{h:Number(r&ei),l:Number(r>>_s&ei)}:{h:Number(r>>_s&ei)|0,l:Number(r&ei)|0}}function Es(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:c}=xc(r[o],t);[e[o],n[o]]=[s,c]}return[e,n]}var Xd=(r,t)=>BigInt(r>>>0)<<_s|BigInt(t>>>0),Zd=(r,t,e)=>r>>>e,Jd=(r,t,e)=>r<<32-e|t>>>e,el=(r,t,e)=>r>>>e|t<<32-e,tl=(r,t,e)=>r<<32-e|t>>>e,rl=(r,t,e)=>r<<64-e|t>>>e-32,nl=(r,t,e)=>r>>>e-32|t<<64-e,ol=(r,t)=>t,il=(r,t)=>r,Ss=(r,t,e)=>r<<e|t>>>32-e,Us=(r,t,e)=>t<<e|r>>>32-e,Cs=(r,t,e)=>t<<e-32|r>>>64-e,Is=(r,t,e)=>r<<e-32|t>>>64-e;function sl(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var al=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),cl=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,ul=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),fl=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,dl=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),ll=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var pl={fromBig:xc,split:Es,toBig:Xd,shrSH:Zd,shrSL:Jd,rotrSH:el,rotrSL:tl,rotrBH:rl,rotrBL:nl,rotr32H:ol,rotr32L:il,rotlSH:Ss,rotlSL:Us,rotlBH:Cs,rotlBL:Is,add:sl,add3L:al,add3H:cl,add4L:ul,add4H:fl,add5H:ll,add5L:dl},pe=pl;var[wc,Tc,vc]=[[],[],[]],gl=BigInt(0),oo=BigInt(1),hl=BigInt(2),yl=BigInt(7),ml=BigInt(256),xl=BigInt(113);for(let r=0,t=oo,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],wc.push(2*(5*n+e)),Tc.push((r+1)*(r+2)/2%64);let o=gl;for(let s=0;s<7;s++)t=(t<<oo^(t>>yl)*xl)%ml,t&hl&&(o^=oo<<(oo<<BigInt(s))-oo);vc.push(o)}var[Al,bl]=Es(vc,!0),Ac=(r,t,e)=>e>32?Cs(r,t,e):Ss(r,t,e),bc=(r,t,e)=>e>32?Is(r,t,e):Us(r,t,e);function wl(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let c=0;c<10;c++)e[c]=r[c]^r[c+10]^r[c+20]^r[c+30]^r[c+40];for(let c=0;c<10;c+=2){let u=(c+8)%10,p=(c+2)%10,h=e[p],y=e[p+1],x=Ac(h,y,1)^e[u],_=bc(h,y,1)^e[u+1];for(let T=0;T<50;T+=10)r[c+T]^=x,r[c+T+1]^=_}let o=r[2],s=r[3];for(let c=0;c<24;c++){let u=Tc[c],p=Ac(o,s,u),h=bc(o,s,u),y=wc[c];o=r[y],s=r[y+1],r[y]=p,r[y+1]=h}for(let c=0;c<50;c+=10){for(let u=0;u<10;u++)e[u]=r[c+u];for(let u=0;u<10;u++)r[c+u]^=~e[(u+2)%10]&e[(u+4)%10]}r[0]^=Al[n],r[1]^=bl[n]}e.fill(0)}var ti=class r extends Tr{constructor(t,e,n,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,rr(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=dc(this.state)}keccak(){wl(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){nr(this);let{blockLen:e,state:n}=this;t=kt(t);let o=t.length;for(let s=0;s<o;){let c=Math.min(e-this.pos,o-s);for(let u=0;u<c;u++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:n,blockLen:o}=this;t[n]^=e,e&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){nr(this,!1),zt(t),this.finish();let e=this.state,{blockLen:n}=this;for(let o=0,s=t.length;o<s;){this.posOut>=n&&this.keccak();let c=Math.min(n-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+c),o),this.posOut+=c,o+=c}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return rr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Jo(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:n,outputLen:o,rounds:s,enableXOF:c}=this;return t||(t=new r(e,n,o,c,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=o,t.enableXOF=c,t.destroyed=this.destroyed,t}},_r=(r,t,e)=>vr(()=>new ti(t,r,e)),Vh=_r(6,144,224/8),$r=_r(6,136,256/8),Qh=_r(6,104,384/8),jh=_r(6,72,512/8),Wh=_r(1,144,224/8),Yh=_r(1,136,256/8),Xh=_r(1,104,384/8),Zh=_r(1,72,512/8),_c=(r,t,e)=>pc((n={})=>new ti(t,r,n.dkLen===void 0?e:n.dkLen,!0)),Jh=_c(31,168,128/8),ey=_c(31,136,256/8);var uo=rc(Sc());var io=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<er;){let n=this.deserializeU8();if(t|=BigInt(n&127)<<BigInt(e),!(n&128))break;e+=7}if(t>er)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),n=new Array;for(let o=0;o<e;o+=1)n.push(this.deserialize(t));return n}};var Er=class r extends Z{constructor(e){super();this.value=me.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,n){let o=e.deserializeFixedBytes(n);return new r(o)}};var so=class r extends Z{constructor(e){super();this.value=new Er(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,n){let o=Er.deserialize(e,n);return new r(o.value)}};var Ge=class r extends Z{constructor(e){super();Xo(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new r(e.deserializeBool())}},it=class r extends Z{constructor(e){super();tr(e,0,jo),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new r(e.deserializeU8())}},_t=class r extends Z{constructor(e){super();tr(e,0,Wo),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new r(e.deserializeU16())}},Et=class r extends Z{constructor(e){super();tr(e,0,er),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new r(e.deserializeU32())}},Le=class r extends Z{constructor(e){super();tr(e,BigInt(0),Kr),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new r(e.deserializeU64())}},St=class r extends Z{constructor(e){super();tr(e,BigInt(0),no),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new r(e.deserializeU128())}},Ut=class r extends Z{constructor(e){super();tr(e,BigInt(0),Yo),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new r(e.deserializeU256())}};var Be=class r extends Z{constructor(e){super();this.values=e}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){if(!(this.values[0]instanceof it)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let n;if(Array.isArray(e)&&typeof e[0]=="number")n=e;else if(typeof e=="string"){let o=me.fromHexInput(e);n=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)n=Array.from(e);else throw new Error("Invalid input type");return new r(n.map(o=>new it(o)))}static U16(e){return new r(e.map(n=>new _t(n)))}static U32(e){return new r(e.map(n=>new Et(n)))}static U64(e){return new r(e.map(n=>new Le(n)))}static U128(e){return new r(e.map(n=>new St(n)))}static U256(e){return new r(e.map(n=>new Ut(n)))}static Bool(e){return new r(e.map(n=>new Ge(n)))}static MoveString(e){return new r(e.map(n=>new Fe(n)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,n){let o=e.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1)s.push(n.deserialize(e));return new r(s)}},Fe=class r extends Z{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){let n=this.bcsToBytes().slice(1);Be.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new r(e.deserializeStr())}},Nt=class r extends Z{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new Be([e]):this.vec=new Be([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new r(e!=null?new it(e):void 0)}static U16(e){return new r(e!=null?new _t(e):void 0)}static U32(e){return new r(e!=null?new Et(e):void 0)}static U64(e){return new r(e!=null?new Le(e):void 0)}static U128(e){return new r(e!=null?new St(e):void 0)}static U256(e){return new r(e!=null?new Ut(e):void 0)}static Bool(e){return new r(e!=null?new Ge(e):void 0)}static MoveString(e){return new r(e!=null?new Fe(e):void 0)}static deserialize(e,n){let o=Be.deserialize(e,n);return new r(o.values[0])}};var At=class extends Z{},Vr=class extends Z{},Mt=class extends Z{};var ni=class extends Tr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,Zo(t);let n=kt(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let c=0;c<s.length;c++)s[c]^=54;this.iHash.update(s),this.oHash=t.create();for(let c=0;c<s.length;c++)s[c]^=106;this.oHash.update(s),s.fill(0)}update(t){return nr(this),this.iHash.update(t),this}digestInto(t){nr(this),zt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:s,blockLen:c,outputLen:u}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=c,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},jt=(r,t,e)=>new ni(r,t).update(e).digest();jt.create=(r,t)=>new ni(r,t);function Tl(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),c=Number(e>>o&s),u=Number(e&s),p=n?4:0,h=n?0:4;r.setUint32(t+p,c,n),r.setUint32(t+h,u,n)}var Sr=class extends Tr{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=Qt(this.buffer)}update(t){nr(this);let{view:e,buffer:n,blockLen:o}=this;t=kt(t);let s=t.length;for(let c=0;c<s;){let u=Math.min(o-this.pos,s-c);if(u===o){let p=Qt(t);for(;o<=s-c;c+=o)this.process(p,c);continue}n.set(t.subarray(c,c+u),this.pos),this.pos+=u,c+=u,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){nr(this),Jo(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:c}=this;e[c++]=128,this.buffer.subarray(c).fill(0),this.padOffset>o-c&&(this.process(n,0),c=0);for(let x=c;x<o;x++)e[x]=0;Tl(n,o-8,BigInt(this.length*8),s),this.process(n,0);let u=Qt(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=p/4,y=this.get();if(h>y.length)throw new Error("_sha2: outputLen bigger than state");for(let x=0;x<h;x++)u.setUint32(4*x,y[x],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:c,pos:u}=this;return t.length=o,t.pos=u,t.finished=s,t.destroyed=c,o%e&&t.buffer.set(n),t}};var[vl,_l]=(()=>pe.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),Ur=new Uint32Array(80),Cr=new Uint32Array(80),Bs=class extends Sr{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:c,Dh:u,Dl:p,Eh:h,El:y,Fh:x,Fl:_,Gh:T,Gl:N,Hh:E,Hl:R}=this;return[t,e,n,o,s,c,u,p,h,y,x,_,T,N,E,R]}set(t,e,n,o,s,c,u,p,h,y,x,_,T,N,E,R){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=c|0,this.Dh=u|0,this.Dl=p|0,this.Eh=h|0,this.El=y|0,this.Fh=x|0,this.Fl=_|0,this.Gh=T|0,this.Gl=N|0,this.Hh=E|0,this.Hl=R|0}process(t,e){for(let z=0;z<16;z++,e+=4)Ur[z]=t.getUint32(e),Cr[z]=t.getUint32(e+=4);for(let z=16;z<80;z++){let ee=Ur[z-15]|0,L=Cr[z-15]|0,j=pe.rotrSH(ee,L,1)^pe.rotrSH(ee,L,8)^pe.shrSH(ee,L,7),J=pe.rotrSL(ee,L,1)^pe.rotrSL(ee,L,8)^pe.shrSL(ee,L,7),X=Ur[z-2]|0,Re=Cr[z-2]|0,xe=pe.rotrSH(X,Re,19)^pe.rotrBH(X,Re,61)^pe.shrSH(X,Re,6),ye=pe.rotrSL(X,Re,19)^pe.rotrBL(X,Re,61)^pe.shrSL(X,Re,6),Ve=pe.add4L(J,ye,Cr[z-7],Cr[z-16]),Qe=pe.add4H(Ve,j,xe,Ur[z-7],Ur[z-16]);Ur[z]=Qe|0,Cr[z]=Ve|0}let{Ah:n,Al:o,Bh:s,Bl:c,Ch:u,Cl:p,Dh:h,Dl:y,Eh:x,El:_,Fh:T,Fl:N,Gh:E,Gl:R,Hh:P,Hl:Q}=this;for(let z=0;z<80;z++){let ee=pe.rotrSH(x,_,14)^pe.rotrSH(x,_,18)^pe.rotrBH(x,_,41),L=pe.rotrSL(x,_,14)^pe.rotrSL(x,_,18)^pe.rotrBL(x,_,41),j=x&T^~x&E,J=_&N^~_&R,X=pe.add5L(Q,L,J,_l[z],Cr[z]),Re=pe.add5H(X,P,ee,j,vl[z],Ur[z]),xe=X|0,ye=pe.rotrSH(n,o,28)^pe.rotrBH(n,o,34)^pe.rotrBH(n,o,39),Ve=pe.rotrSL(n,o,28)^pe.rotrBL(n,o,34)^pe.rotrBL(n,o,39),Qe=n&s^n&u^s&u,dt=o&c^o&p^c&p;P=E|0,Q=R|0,E=T|0,R=N|0,T=x|0,N=_|0,{h:x,l:_}=pe.add(h|0,y|0,Re|0,xe|0),h=u|0,y=p|0,u=s|0,p=c|0,s=n|0,c=o|0;let O=pe.add3L(xe,Ve,dt);n=pe.add3H(O,Re,ye,Qe),o=O|0}({h:n,l:o}=pe.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:c}=pe.add(this.Bh|0,this.Bl|0,s|0,c|0),{h:u,l:p}=pe.add(this.Ch|0,this.Cl|0,u|0,p|0),{h,l:y}=pe.add(this.Dh|0,this.Dl|0,h|0,y|0),{h:x,l:_}=pe.add(this.Eh|0,this.El|0,x|0,_|0),{h:T,l:N}=pe.add(this.Fh|0,this.Fl|0,T|0,N|0),{h:E,l:R}=pe.add(this.Gh|0,this.Gl|0,E|0,R|0),{h:P,l:Q}=pe.add(this.Hh|0,this.Hl|0,P|0,Q|0),this.set(n,o,s,c,u,p,h,y,x,_,T,N,E,R,P,Q)}roundClean(){Ur.fill(0),Cr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var Qr=vr(()=>new Bs);function El(r,t,e,n){Zo(r);let o=lc({dkLen:32,asyncTick:10},n),{c:s,dkLen:c,asyncTick:u}=o;if(rr(s),rr(c),rr(u),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let p=kt(t),h=kt(e),y=new Uint8Array(c),x=jt.create(r,p),_=x._cloneInto().update(h);return{c:s,dkLen:c,asyncTick:u,DK:y,PRF:x,PRFSalt:_}}function Sl(r,t,e,n,o){return r.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),e}function Uc(r,t,e,n){let{c:o,dkLen:s,DK:c,PRF:u,PRFSalt:p}=El(r,t,e,n),h,y=new Uint8Array(4),x=Qt(y),_=new Uint8Array(u.outputLen);for(let T=1,N=0;N<s;T++,N+=u.outputLen){let E=c.subarray(N,N+u.outputLen);x.setInt32(0,T,!1),(h=p._cloneInto(h)).update(y).digestInto(_),E.set(_.subarray(0,E.length));for(let R=1;R<o;R++){u._cloneInto(h).update(_).digestInto(_);for(let P=0;P<E.length;P++)E[P]^=_[P]}}return Sl(u,p,c,h,_)}var Ul=(r,t,e)=>r&t^~r&e,Cl=(r,t,e)=>r&t^r&e^t&e,Il=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]),Ir=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Br=new Uint32Array(64),Rs=class extends Sr{constructor(){super(64,32,8,!1),this.A=Ir[0]|0,this.B=Ir[1]|0,this.C=Ir[2]|0,this.D=Ir[3]|0,this.E=Ir[4]|0,this.F=Ir[5]|0,this.G=Ir[6]|0,this.H=Ir[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:c,G:u,H:p}=this;return[t,e,n,o,s,c,u,p]}set(t,e,n,o,s,c,u,p){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=c|0,this.G=u|0,this.H=p|0}process(t,e){for(let x=0;x<16;x++,e+=4)Br[x]=t.getUint32(e,!1);for(let x=16;x<64;x++){let _=Br[x-15],T=Br[x-2],N=Pt(_,7)^Pt(_,18)^_>>>3,E=Pt(T,17)^Pt(T,19)^T>>>10;Br[x]=E+Br[x-7]+N+Br[x-16]|0}let{A:n,B:o,C:s,D:c,E:u,F:p,G:h,H:y}=this;for(let x=0;x<64;x++){let _=Pt(u,6)^Pt(u,11)^Pt(u,25),T=y+_+Ul(u,p,h)+Il[x]+Br[x]|0,E=(Pt(n,2)^Pt(n,13)^Pt(n,22))+Cl(n,o,s)|0;y=h,h=p,p=u,u=c+T|0,c=s,s=o,o=n,n=T+E|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,c=c+this.D|0,u=u+this.E|0,p=p+this.F|0,h=h+this.G|0,y=y+this.H|0,this.set(n,o,s,c,u,p,h,y)}roundClean(){Br.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var ao=vr(()=>new Rs);function oi(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}function Ic(...r){let t=(o,s)=>c=>o(s(c)),e=Array.from(r).reverse().reduce((o,s)=>o?t(o,s.encode):s.encode,void 0),n=r.reduce((o,s)=>o?t(o,s.decode):s.decode,void 0);return{encode:e,decode:n}}function Bl(r){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(e=>{if(e<0||e>=r.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${r.length})`);return r[e]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(e=>{if(typeof e!="string")throw new Error(`alphabet.decode: not string element=${e}`);let n=r.indexOf(e);if(n===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${r}`);return n})}}}function Rl(r=""){if(typeof r!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let e of t)if(typeof e!="string")throw new Error(`join.encode: non-string input=${e}`);return t.join(r)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(r)}}}function Cc(r,t,e){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: wrong to=${e}, base cannot be less than 2`);if(!Array.isArray(r))throw new Error("convertRadix: data should be array");if(!r.length)return[];let n=0,o=[],s=Array.from(r);for(s.forEach(c=>{if(c<0||c>=t)throw new Error(`Wrong integer: ${c}`)});;){let c=0,u=!0;for(let p=n;p<s.length;p++){let h=s[p],y=t*c+h;if(!Number.isSafeInteger(y)||t*c/t!==c||y-h!==t*c)throw new Error("convertRadix: carry overflow");c=y%e;let x=Math.floor(y/e);if(s[p]=x,!Number.isSafeInteger(x)||x*e+c!==y)throw new Error("convertRadix: carry overflow");if(u)x?u=!1:n=p;else continue}if(o.push(c),u)break}for(let c=0;c<r.length-1&&r[c]===0;c++)o.push(0);return o.reverse()}function Pl(r){return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return Cc(Array.from(t),2**8,r)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(Cc(t,r,2**8))}}}function kl(r,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=t(e).slice(0,r),o=new Uint8Array(e.length+r);return o.set(e),o.set(n,e.length),o},decode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=e.slice(0,-r),o=t(n).slice(0,r),s=e.slice(-r);for(let c=0;c<r;c++)if(o[c]!==s[c])throw new Error("Invalid checksum");return n}}}var Ol=r=>Ic(Pl(58),Bl(r),Rl("")),zl=Ol("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var Bc=r=>Ic(kl(4,t=>r(r(t))),zl);function Rc(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function Nl(r){let t=Rc(r),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var Ml=r=>Rc(`mnemonic${r}`);function Pc(r,t=""){return Uc(Qr,Nl(r).nfkd,Ml(t),{c:2048,dkLen:64})}var kc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,Oc=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,zc=(t=>(t.ED25519="ed25519 seed",t))(zc||{}),Ps=2147483648;function ks(r){return Oc.test(r)}function Os(r){return kc.test(r)}var ii=(r,t)=>{let e=jt.create(Qr,r).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},zs=({key:r,chainCode:t},e)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,e);let o=new Uint8Array(n),s=new Uint8Array([0]),c=new Uint8Array([...s,...r,...o]);return ii(t,c)},ql=r=>r.replace("'",""),Ns=r=>r.split("/").slice(1).map(ql),co=r=>{let t=r.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return Pc(t)};var jr=class jr extends At{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==jr.LENGTH)throw new Error(`PublicKey length should be ${jr.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),c=o.toUint8Array();return uo.default.sign.detached.verify(s,c,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new jr(n)}static load(e){let n=e.deserializeBytes();return new jr(n)}};jr.LENGTH=32;var Pe=jr,pt=class pt extends Vr{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==pt.LENGTH)throw new Error(`PrivateKey length should be ${pt.LENGTH}`);this.signingKeyPair=uo.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,pt.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,pt.LENGTH)}toString(){return me.fromHexInput(this.toUint8Array()).toString()}sign(e){let n=me.fromHexInput(e),o=uo.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new Ke(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new pt(n)}static generate(){let e=uo.default.sign.keyPair();return new pt(e.secretKey.slice(0,pt.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new Pe(e)}static fromDerivationPath(e,n){if(!Os(e))throw new Error(`Invalid derivation path ${e}`);return pt.fromDerivationPathInner(e,co(n))}static fromDerivationPathInner(e,n,o=Ps){let{key:s,chainCode:c}=ii(pt.SLIP_0010_SEED,n),u=Ns(e).map(h=>parseInt(h,10)),{key:p}=u.reduce((h,y)=>zs(h,y+o),{key:s,chainCode:c});return new pt(p)}};pt.LENGTH=32,pt.SLIP_0010_SEED="ed25519 seed";var or=pt,Wr=class Wr extends Mt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==Wr.LENGTH)throw new Error(`Signature length should be ${Wr.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Wr(n)}static load(e){let n=e.deserializeBytes();return new Wr(n)}};Wr.LENGTH=64;var Ke=Wr;var Ct=class Ct extends At{constructor(e){super();let{publicKeys:n,threshold:o}=e;if(n.length>Ct.MAX_KEYS||n.length<Ct.MIN_KEYS)throw new Error(`Must have between ${Ct.MIN_KEYS} and ${Ct.MAX_KEYS} public keys, inclusive`);if(o<Ct.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${Ct.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*Pe.LENGTH+1);return this.publicKeys.forEach((n,o)=>{e.set(n.toUint8Array(),o*Pe.LENGTH)}),e[this.publicKeys.length*Pe.LENGTH]=this.threshold,e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n[n.length-1],s=[];for(let c=0;c<n.length-1;c+=Pe.LENGTH){let u=c;s.push(new Pe(n.subarray(u,u+Pe.LENGTH)))}return new Ct({publicKeys:s,threshold:o})}};Ct.MAX_KEYS=32,Ct.MIN_KEYS=2,Ct.MIN_THRESHOLD=1;var Dt=Ct,It=class It extends Mt{constructor(e){super();let{signatures:n,bitmap:o}=e;if(o.length!==It.BITMAP_LEN)throw new Error(`"bitmap" length should be ${It.BITMAP_LEN}`);if(n.length>It.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${It.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*Ke.LENGTH+It.BITMAP_LEN);return this.signatures.forEach((n,o)=>{e.set(n.toUint8Array(),o*Ke.LENGTH)}),e.set(this.bitmap,this.signatures.length*Ke.LENGTH),e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),c=new Set;return n.forEach(u=>{if(u>=It.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${It.MAX_SIGNATURES_SUPPORTED-1}.`);if(c.has(u))throw new Error("Duplicate bits detected.");c.add(u);let p=Math.floor(u/8),h=s[p];h|=o>>u%8,s[p]=h}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n.subarray(n.length-4),s=[];for(let c=0;c<n.length-o.length;c+=Ke.LENGTH){let u=c;s.push(new Ke(n.subarray(u,u+Ke.LENGTH)))}return new It({signatures:s,bitmap:o})}};It.MAX_SIGNATURES_SUPPORTED=32,It.BITMAP_LEN=4;var Yr=It;var Gs={};ec(Gs,{bitGet:()=>Vl,bitLen:()=>$l,bitMask:()=>fo,bitSet:()=>Ql,bytesToHex:()=>Xr,bytesToNumberBE:()=>ir,bytesToNumberLE:()=>ci,concatBytes:()=>Rn,createHmacDrbg:()=>qs,ensureBytes:()=>bt,equalBytes:()=>Kl,hexToBytes:()=>Zr,hexToNumber:()=>Ds,numberToBytesBE:()=>Rr,numberToBytesLE:()=>ui,numberToHexUnpadded:()=>Dc,numberToVarBytesBE:()=>Fl,utf8ToBytes:()=>Hl,validateObject:()=>Pr});var Mc=BigInt(0),si=BigInt(1),Gl=BigInt(2),ai=r=>r instanceof Uint8Array,Ll=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Xr(r){if(!ai(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Ll[r[e]];return t}function Dc(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function Ds(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function Zr(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),c=Number.parseInt(s,16);if(Number.isNaN(c)||c<0)throw new Error("Invalid byte sequence");e[n]=c}return e}function ir(r){return Ds(Xr(r))}function ci(r){if(!ai(r))throw new Error("Uint8Array expected");return Ds(Xr(Uint8Array.from(r).reverse()))}function Rr(r,t){return Zr(r.toString(16).padStart(t*2,"0"))}function ui(r,t){return Rr(r,t).reverse()}function Fl(r){return Zr(Dc(r))}function bt(r,t,e){let n;if(typeof t=="string")try{n=Zr(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(ai(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function Rn(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!ai(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}function Kl(r,t){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}function Hl(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function $l(r){let t;for(t=0;r>Mc;r>>=si,t+=1);return t}function Vl(r,t){return r>>BigInt(t)&si}var Ql=(r,t,e)=>r|(e?si:Mc)<<BigInt(t),fo=r=>(Gl<<BigInt(r-1))-si,Ms=r=>new Uint8Array(r),Nc=r=>Uint8Array.from(r);function qs(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=Ms(r),o=Ms(r),s=0,c=()=>{n.fill(1),o.fill(0),s=0},u=(...x)=>e(o,n,...x),p=(x=Ms())=>{o=u(Nc([0]),x),n=u(),x.length!==0&&(o=u(Nc([1]),x),n=u())},h=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let x=0,_=[];for(;x<t;){n=u();let T=n.slice();_.push(T),x+=n.length}return Rn(..._)};return(x,_)=>{c(),p(x);let T;for(;!(T=_(h()));)p();return c(),T}}var jl={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Pr(r,t,e={}){let n=(o,s,c)=>{let u=jl[s];if(typeof u!="function")throw new Error(`Invalid validator "${s}", expected function`);let p=r[o];if(!(c&&p===void 0)&&!u(p,r))throw new Error(`Invalid param ${String(o)}=${p} (${typeof p}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var et=BigInt(0),He=BigInt(1),Jr=BigInt(2),Wl=BigInt(3),Ls=BigInt(4),qc=BigInt(5),Gc=BigInt(8),Yl=BigInt(9),Xl=BigInt(16);function tt(r,t){let e=r%t;return e>=et?e:t+e}function Zl(r,t,e){if(e<=et||t<et)throw new Error("Expected power/modulo > 0");if(e===He)return et;let n=He;for(;t>et;)t&He&&(n=n*r%e),r=r*r%e,t>>=He;return n}function wt(r,t,e){let n=r;for(;t-- >et;)n*=n,n%=e;return n}function fi(r,t){if(r===et||t<=et)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=tt(r,t),n=t,o=et,s=He,c=He,u=et;for(;e!==et;){let h=n/e,y=n%e,x=o-c*h,_=s-u*h;n=e,e=y,o=c,s=u,c=x,u=_}if(n!==He)throw new Error("invert: does not exist");return tt(o,t)}function Jl(r){let t=(r-He)/Jr,e,n,o;for(e=r-He,n=0;e%Jr===et;e/=Jr,n++);for(o=Jr;o<r&&Zl(o,t,r)!==r-He;o++);if(n===1){let c=(r+He)/Ls;return function(p,h){let y=p.pow(h,c);if(!p.eql(p.sqr(y),h))throw new Error("Cannot find square root");return y}}let s=(e+He)/Jr;return function(u,p){if(u.pow(p,t)===u.neg(u.ONE))throw new Error("Cannot find square root");let h=n,y=u.pow(u.mul(u.ONE,o),e),x=u.pow(p,s),_=u.pow(p,e);for(;!u.eql(_,u.ONE);){if(u.eql(_,u.ZERO))return u.ZERO;let T=1;for(let E=u.sqr(_);T<h&&!u.eql(E,u.ONE);T++)E=u.sqr(E);let N=u.pow(y,He<<BigInt(h-T-1));y=u.sqr(N),x=u.mul(x,N),_=u.mul(_,y),h=T}return x}}function ep(r){if(r%Ls===Wl){let t=(r+He)/Ls;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%Gc===qc){let t=(r-qc)/Gc;return function(n,o){let s=n.mul(o,Jr),c=n.pow(s,t),u=n.mul(o,c),p=n.mul(n.mul(u,Jr),c),h=n.mul(u,n.sub(p,n.ONE));if(!n.eql(n.sqr(h),o))throw new Error("Cannot find square root");return h}}return r%Xl,Jl(r)}var tp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Fs(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=tp.reduce((n,o)=>(n[o]="function",n),t);return Pr(r,e)}function rp(r,t,e){if(e<et)throw new Error("Expected power > 0");if(e===et)return r.ONE;if(e===He)return t;let n=r.ONE,o=t;for(;e>et;)e&He&&(n=r.mul(n,o)),o=r.sqr(o),e>>=He;return n}function np(r,t){let e=new Array(t.length),n=t.reduce((s,c,u)=>r.is0(c)?s:(e[u]=s,r.mul(s,c)),r.ONE),o=r.inv(n);return t.reduceRight((s,c,u)=>r.is0(c)?s:(e[u]=r.mul(s,e[u]),r.mul(s,c)),o),e}function Ks(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function Lc(r,t,e=!1,n={}){if(r<=et)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=Ks(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let c=ep(r),u=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:fo(o),ZERO:et,ONE:He,create:p=>tt(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof p}`);return et<=p&&p<r},is0:p=>p===et,isOdd:p=>(p&He)===He,neg:p=>tt(-p,r),eql:(p,h)=>p===h,sqr:p=>tt(p*p,r),add:(p,h)=>tt(p+h,r),sub:(p,h)=>tt(p-h,r),mul:(p,h)=>tt(p*h,r),pow:(p,h)=>rp(u,p,h),div:(p,h)=>tt(p*fi(h,r),r),sqrN:p=>p*p,addN:(p,h)=>p+h,subN:(p,h)=>p-h,mulN:(p,h)=>p*h,inv:p=>fi(p,r),sqrt:n.sqrt||(p=>c(u,p)),invertBatch:p=>np(u,p),cmov:(p,h,y)=>y?h:p,toBytes:p=>e?ui(p,s):Rr(p,s),fromBytes:p=>{if(p.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${p.length}`);return e?ci(p):ir(p)}});return Object.freeze(u)}function Fc(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function Hs(r){let t=Fc(r);return t+Math.ceil(t/2)}function Kc(r,t,e=!1){let n=r.length,o=Fc(t),s=Hs(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let c=e?ir(r):ci(r),u=tt(c,t-He)+He;return e?ui(u,o):Rr(u,o)}var ip=BigInt(0),$s=BigInt(1);function Hc(r,t){let e=(o,s)=>{let c=s.negate();return o?c:s},n=o=>{let s=Math.ceil(t/o)+1,c=2**(o-1);return{windows:s,windowSize:c}};return{constTimeNegate:e,unsafeLadder(o,s){let c=r.ZERO,u=o;for(;s>ip;)s&$s&&(c=c.add(u)),u=u.double(),s>>=$s;return c},precomputeWindow(o,s){let{windows:c,windowSize:u}=n(s),p=[],h=o,y=h;for(let x=0;x<c;x++){y=h,p.push(y);for(let _=1;_<u;_++)y=y.add(h),p.push(y);h=y.double()}return p},wNAF(o,s,c){let{windows:u,windowSize:p}=n(o),h=r.ZERO,y=r.BASE,x=BigInt(2**o-1),_=2**o,T=BigInt(o);for(let N=0;N<u;N++){let E=N*p,R=Number(c&x);c>>=T,R>p&&(R-=_,c+=$s);let P=E,Q=E+Math.abs(R)-1,z=N%2!==0,ee=R<0;R===0?y=y.add(e(z,s[P])):h=h.add(e(ee,s[Q]))}return{p:h,f:y}},wNAFCached(o,s,c,u){let p=o._WINDOW_SIZE||1,h=s.get(o);return h||(h=this.precomputeWindow(o,p),p!==1&&s.set(o,u(h))),this.wNAF(p,h,c)}}}function Vs(r){return Fs(r.Fp),Pr(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ks(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function sp(r){let t=Vs(r);Pr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:ap,hexToBytes:cp}=Gs,en={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(r){let{Err:t}=en;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");let e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:ap(n),l:r.subarray(e+2)}},toSig(r){let{Err:t}=en,e=typeof r=="string"?cp(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=en._parseInt(e.subarray(2)),{d:c,l:u}=en._parseInt(s);if(u.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:c}},hexFromSig(r){let t=h=>Number.parseInt(h[0],16)&8?"00"+h:h,e=h=>{let y=h.toString(16);return y.length&1?`0${y}`:y},n=t(e(r.s)),o=t(e(r.r)),s=n.length/2,c=o.length/2,u=e(s),p=e(c);return`30${e(c+s+4)}02${p}${o}02${u}${n}`}},sr=BigInt(0),Bt=BigInt(1),Im=BigInt(2),$c=BigInt(3),Bm=BigInt(4);function up(r){let t=sp(r),{Fp:e}=t,n=t.toBytes||((N,E,R)=>{let P=E.toAffine();return Rn(Uint8Array.from([4]),e.toBytes(P.x),e.toBytes(P.y))}),o=t.fromBytes||(N=>{let E=N.subarray(1),R=e.fromBytes(E.subarray(0,e.BYTES)),P=e.fromBytes(E.subarray(e.BYTES,2*e.BYTES));return{x:R,y:P}});function s(N){let{a:E,b:R}=t,P=e.sqr(N),Q=e.mul(P,N);return e.add(e.add(Q,e.mul(N,E)),R)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function c(N){return typeof N=="bigint"&&sr<N&&N<t.n}function u(N){if(!c(N))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function p(N){let{allowedPrivateKeyLengths:E,nByteLength:R,wrapPrivateKey:P,n:Q}=t;if(E&&typeof N!="bigint"){if(N instanceof Uint8Array&&(N=Xr(N)),typeof N!="string"||!E.includes(N.length))throw new Error("Invalid key");N=N.padStart(R*2,"0")}let z;try{z=typeof N=="bigint"?N:ir(bt("private key",N,R))}catch{throw new Error(`private key must be ${R} bytes, hex or bigint, not ${typeof N}`)}return P&&(z=tt(z,Q)),u(z),z}let h=new Map;function y(N){if(!(N instanceof x))throw new Error("ProjectivePoint expected")}class x{constructor(E,R,P){if(this.px=E,this.py=R,this.pz=P,E==null||!e.isValid(E))throw new Error("x required");if(R==null||!e.isValid(R))throw new Error("y required");if(P==null||!e.isValid(P))throw new Error("z required")}static fromAffine(E){let{x:R,y:P}=E||{};if(!E||!e.isValid(R)||!e.isValid(P))throw new Error("invalid affine point");if(E instanceof x)throw new Error("projective point not allowed");let Q=z=>e.eql(z,e.ZERO);return Q(R)&&Q(P)?x.ZERO:new x(R,P,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(E){let R=e.invertBatch(E.map(P=>P.pz));return E.map((P,Q)=>P.toAffine(R[Q])).map(x.fromAffine)}static fromHex(E){let R=x.fromAffine(o(bt("pointHex",E)));return R.assertValidity(),R}static fromPrivateKey(E){return x.BASE.multiply(p(E))}_setWindowSize(E){this._WINDOW_SIZE=E,h.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:E,y:R}=this.toAffine();if(!e.isValid(E)||!e.isValid(R))throw new Error("bad point: x or y not FE");let P=e.sqr(R),Q=s(E);if(!e.eql(P,Q))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:E}=this.toAffine();if(e.isOdd)return!e.isOdd(E);throw new Error("Field doesn't support isOdd")}equals(E){y(E);let{px:R,py:P,pz:Q}=this,{px:z,py:ee,pz:L}=E,j=e.eql(e.mul(R,L),e.mul(z,Q)),J=e.eql(e.mul(P,L),e.mul(ee,Q));return j&&J}negate(){return new x(this.px,e.neg(this.py),this.pz)}double(){let{a:E,b:R}=t,P=e.mul(R,$c),{px:Q,py:z,pz:ee}=this,L=e.ZERO,j=e.ZERO,J=e.ZERO,X=e.mul(Q,Q),Re=e.mul(z,z),xe=e.mul(ee,ee),ye=e.mul(Q,z);return ye=e.add(ye,ye),J=e.mul(Q,ee),J=e.add(J,J),L=e.mul(E,J),j=e.mul(P,xe),j=e.add(L,j),L=e.sub(Re,j),j=e.add(Re,j),j=e.mul(L,j),L=e.mul(ye,L),J=e.mul(P,J),xe=e.mul(E,xe),ye=e.sub(X,xe),ye=e.mul(E,ye),ye=e.add(ye,J),J=e.add(X,X),X=e.add(J,X),X=e.add(X,xe),X=e.mul(X,ye),j=e.add(j,X),xe=e.mul(z,ee),xe=e.add(xe,xe),X=e.mul(xe,ye),L=e.sub(L,X),J=e.mul(xe,Re),J=e.add(J,J),J=e.add(J,J),new x(L,j,J)}add(E){y(E);let{px:R,py:P,pz:Q}=this,{px:z,py:ee,pz:L}=E,j=e.ZERO,J=e.ZERO,X=e.ZERO,Re=t.a,xe=e.mul(t.b,$c),ye=e.mul(R,z),Ve=e.mul(P,ee),Qe=e.mul(Q,L),dt=e.add(R,P),O=e.add(z,ee);dt=e.mul(dt,O),O=e.add(ye,Ve),dt=e.sub(dt,O),O=e.add(R,Q);let K=e.add(z,L);return O=e.mul(O,K),K=e.add(ye,Qe),O=e.sub(O,K),K=e.add(P,Q),j=e.add(ee,L),K=e.mul(K,j),j=e.add(Ve,Qe),K=e.sub(K,j),X=e.mul(Re,O),j=e.mul(xe,Qe),X=e.add(j,X),j=e.sub(Ve,X),X=e.add(Ve,X),J=e.mul(j,X),Ve=e.add(ye,ye),Ve=e.add(Ve,ye),Qe=e.mul(Re,Qe),O=e.mul(xe,O),Ve=e.add(Ve,Qe),Qe=e.sub(ye,Qe),Qe=e.mul(Re,Qe),O=e.add(O,Qe),ye=e.mul(Ve,O),J=e.add(J,ye),ye=e.mul(K,O),j=e.mul(dt,j),j=e.sub(j,ye),ye=e.mul(dt,Ve),X=e.mul(K,X),X=e.add(X,ye),new x(j,J,X)}subtract(E){return this.add(E.negate())}is0(){return this.equals(x.ZERO)}wNAF(E){return T.wNAFCached(this,h,E,R=>{let P=e.invertBatch(R.map(Q=>Q.pz));return R.map((Q,z)=>Q.toAffine(P[z])).map(x.fromAffine)})}multiplyUnsafe(E){let R=x.ZERO;if(E===sr)return R;if(u(E),E===Bt)return this;let{endo:P}=t;if(!P)return T.unsafeLadder(this,E);let{k1neg:Q,k1:z,k2neg:ee,k2:L}=P.splitScalar(E),j=R,J=R,X=this;for(;z>sr||L>sr;)z&Bt&&(j=j.add(X)),L&Bt&&(J=J.add(X)),X=X.double(),z>>=Bt,L>>=Bt;return Q&&(j=j.negate()),ee&&(J=J.negate()),J=new x(e.mul(J.px,P.beta),J.py,J.pz),j.add(J)}multiply(E){u(E);let R=E,P,Q,{endo:z}=t;if(z){let{k1neg:ee,k1:L,k2neg:j,k2:J}=z.splitScalar(R),{p:X,f:Re}=this.wNAF(L),{p:xe,f:ye}=this.wNAF(J);X=T.constTimeNegate(ee,X),xe=T.constTimeNegate(j,xe),xe=new x(e.mul(xe.px,z.beta),xe.py,xe.pz),P=X.add(xe),Q=Re.add(ye)}else{let{p:ee,f:L}=this.wNAF(R);P=ee,Q=L}return x.normalizeZ([P,Q])[0]}multiplyAndAddUnsafe(E,R,P){let Q=x.BASE,z=(L,j)=>j===sr||j===Bt||!L.equals(Q)?L.multiplyUnsafe(j):L.multiply(j),ee=z(this,R).add(z(E,P));return ee.is0()?void 0:ee}toAffine(E){let{px:R,py:P,pz:Q}=this,z=this.is0();E==null&&(E=z?e.ONE:e.inv(Q));let ee=e.mul(R,E),L=e.mul(P,E),j=e.mul(Q,E);if(z)return{x:e.ZERO,y:e.ZERO};if(!e.eql(j,e.ONE))throw new Error("invZ was invalid");return{x:ee,y:L}}isTorsionFree(){let{h:E,isTorsionFree:R}=t;if(E===Bt)return!0;if(R)return R(x,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:E,clearCofactor:R}=t;return E===Bt?this:R?R(x,this):this.multiplyUnsafe(t.h)}toRawBytes(E=!0){return this.assertValidity(),n(x,this,E)}toHex(E=!0){return Xr(this.toRawBytes(E))}}x.BASE=new x(t.Gx,t.Gy,e.ONE),x.ZERO=new x(e.ZERO,e.ONE,e.ZERO);let _=t.nBitLength,T=Hc(x,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:x,normPrivateKeyToScalar:p,weierstrassEquation:s,isWithinCurveOrder:c}}function fp(r){let t=Vs(r);return Pr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function Vc(r){let t=fp(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function c(O){return sr<O&&O<e.ORDER}function u(O){return tt(O,n)}function p(O){return fi(O,n)}let{ProjectivePoint:h,normPrivateKeyToScalar:y,weierstrassEquation:x,isWithinCurveOrder:_}=up({...t,toBytes(O,K,se){let Ee=K.toAffine(),Se=e.toBytes(Ee.x),je=Rn;return se?je(Uint8Array.from([K.hasEvenY()?2:3]),Se):je(Uint8Array.from([4]),Se,e.toBytes(Ee.y))},fromBytes(O){let K=O.length,se=O[0],Ee=O.subarray(1);if(K===o&&(se===2||se===3)){let Se=ir(Ee);if(!c(Se))throw new Error("Point is not on curve");let je=x(Se),ot=e.sqrt(je),ke=(ot&Bt)===Bt;return(se&1)===1!==ke&&(ot=e.neg(ot)),{x:Se,y:ot}}else if(K===s&&se===4){let Se=e.fromBytes(Ee.subarray(0,e.BYTES)),je=e.fromBytes(Ee.subarray(e.BYTES,2*e.BYTES));return{x:Se,y:je}}else throw new Error(`Point of length ${K} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),T=O=>Xr(Rr(O,t.nByteLength));function N(O){let K=n>>Bt;return O>K}function E(O){return N(O)?u(-O):O}let R=(O,K,se)=>ir(O.slice(K,se));class P{constructor(K,se,Ee){this.r=K,this.s=se,this.recovery=Ee,this.assertValidity()}static fromCompact(K){let se=t.nByteLength;return K=bt("compactSignature",K,se*2),new P(R(K,0,se),R(K,se,2*se))}static fromDER(K){let{r:se,s:Ee}=en.toSig(bt("DER",K));return new P(se,Ee)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(K){return new P(this.r,this.s,K)}recoverPublicKey(K){let{r:se,s:Ee,recovery:Se}=this,je=J(bt("msgHash",K));if(Se==null||![0,1,2,3].includes(Se))throw new Error("recovery id invalid");let ot=Se===2||Se===3?se+t.n:se;if(ot>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let ke=Se&1?"03":"02",Xe=h.fromHex(ke+T(ot)),ae=p(ot),Ze=u(-je*ae),xr=u(Ee*ae),Rt=h.BASE.multiplyAndAddUnsafe(Xe,Ze,xr);if(!Rt)throw new Error("point at infinify");return Rt.assertValidity(),Rt}hasHighS(){return N(this.s)}normalizeS(){return this.hasHighS()?new P(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return Zr(this.toDERHex())}toDERHex(){return en.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return Zr(this.toCompactHex())}toCompactHex(){return T(this.r)+T(this.s)}}let Q={isValidPrivateKey(O){try{return y(O),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let O=Hs(t.n);return Kc(t.randomBytes(O),t.n)},precompute(O=8,K=h.BASE){return K._setWindowSize(O),K.multiply(BigInt(3)),K}};function z(O,K=!0){return h.fromPrivateKey(O).toRawBytes(K)}function ee(O){let K=O instanceof Uint8Array,se=typeof O=="string",Ee=(K||se)&&O.length;return K?Ee===o||Ee===s:se?Ee===2*o||Ee===2*s:O instanceof h}function L(O,K,se=!0){if(ee(O))throw new Error("first arg must be private key");if(!ee(K))throw new Error("second arg must be public key");return h.fromHex(K).multiply(y(O)).toRawBytes(se)}let j=t.bits2int||function(O){let K=ir(O),se=O.length*8-t.nBitLength;return se>0?K>>BigInt(se):K},J=t.bits2int_modN||function(O){return u(j(O))},X=fo(t.nBitLength);function Re(O){if(typeof O!="bigint")throw new Error("bigint expected");if(!(sr<=O&&O<X))throw new Error(`bigint expected < 2^${t.nBitLength}`);return Rr(O,t.nByteLength)}function xe(O,K,se=ye){if(["recovered","canonical"].some(vt=>vt in se))throw new Error("sign() legacy options not supported");let{hash:Ee,randomBytes:Se}=t,{lowS:je,prehash:ot,extraEntropy:ke}=se;je==null&&(je=!0),O=bt("msgHash",O),ot&&(O=bt("prehashed msgHash",Ee(O)));let Xe=J(O),ae=y(K),Ze=[Re(ae),Re(Xe)];if(ke!=null){let vt=ke===!0?Se(e.BYTES):ke;Ze.push(bt("extraEntropy",vt))}let xr=Rn(...Ze),Rt=Xe;function Ar(vt){let Zt=j(vt);if(!_(Zt))return;let Nr=p(Zt),mt=h.BASE.multiply(Zt).toAffine(),br=u(mt.x);if(br===sr)return;let En=u(Nr*u(Rt+br*ae));if(En===sr)return;let No=(mt.x===br?0:2)|Number(mt.y&Bt),Qn=En;return je&&N(En)&&(Qn=E(En),No^=1),new P(br,Qn,No)}return{seed:xr,k2sig:Ar}}let ye={lowS:t.lowS,prehash:!1},Ve={lowS:t.lowS,prehash:!1};function Qe(O,K,se=ye){let{seed:Ee,k2sig:Se}=xe(O,K,se),je=t;return qs(je.hash.outputLen,je.nByteLength,je.hmac)(Ee,Se)}h.BASE._setWindowSize(8);function dt(O,K,se,Ee=Ve){let Se=O;if(K=bt("msgHash",K),se=bt("publicKey",se),"strict"in Ee)throw new Error("options.strict was renamed to lowS");let{lowS:je,prehash:ot}=Ee,ke,Xe;try{if(typeof Se=="string"||Se instanceof Uint8Array)try{ke=P.fromDER(Se)}catch(mt){if(!(mt instanceof en.Err))throw mt;ke=P.fromCompact(Se)}else if(typeof Se=="object"&&typeof Se.r=="bigint"&&typeof Se.s=="bigint"){let{r:mt,s:br}=Se;ke=new P(mt,br)}else throw new Error("PARSE");Xe=h.fromHex(se)}catch(mt){if(mt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(je&&ke.hasHighS())return!1;ot&&(K=t.hash(K));let{r:ae,s:Ze}=ke,xr=J(K),Rt=p(Ze),Ar=u(xr*Rt),vt=u(ae*Rt),Zt=h.BASE.multiplyAndAddUnsafe(Xe,Ar,vt)?.toAffine();return Zt?u(Zt.x)===ae:!1}return{CURVE:t,getPublicKey:z,getSharedSecret:L,sign:Qe,verify:dt,ProjectivePoint:h,Signature:P,utils:Q}}function dp(r){return{hash:r,hmac:(t,...e)=>jt(r,t,Fr(...e)),randomBytes:gc}}function Qc(r,t){let e=n=>Vc({...r,...dp(n)});return Object.freeze({...e(t),create:e})}var Yc=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),jc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),lp=BigInt(1),Qs=BigInt(2),Wc=(r,t)=>(r+t/Qs)/t;function pp(r){let t=Yc,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),c=BigInt(23),u=BigInt(44),p=BigInt(88),h=r*r*r%t,y=h*h*r%t,x=wt(y,e,t)*y%t,_=wt(x,e,t)*y%t,T=wt(_,Qs,t)*h%t,N=wt(T,o,t)*T%t,E=wt(N,s,t)*N%t,R=wt(E,u,t)*E%t,P=wt(R,p,t)*R%t,Q=wt(P,u,t)*E%t,z=wt(Q,e,t)*y%t,ee=wt(z,c,t)*N%t,L=wt(ee,n,t)*h%t,j=wt(L,Qs,t);if(!js.eql(js.sqr(j),r))throw new Error("Cannot find square root");return j}var js=Lc(Yc,void 0,void 0,{sqrt:pp}),ut=Qc({a:BigInt(0),b:BigInt(7),Fp:js,n:jc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=jc,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-lp*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,c=BigInt("0x100000000000000000000000000000000"),u=Wc(s*r,t),p=Wc(-n*r,t),h=tt(r-u*e-p*o,t),y=tt(-u*n-p*s,t),x=h>c,_=y>c;if(x&&(h=t-h),_&&(y=t-y),h>c||y>c)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:x,k1:h,k2neg:_,k2:y}}}},ao),qm=BigInt(0);var Gm=ut.ProjectivePoint;var gp=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Zc=Uint8Array.from({length:16},(r,t)=>t),hp=Zc.map(r=>(9*r+5)%16),Ys=[Zc],Xs=[hp];for(let r=0;r<4;r++)for(let t of[Ys,Xs])t.push(t[r].map(e=>gp[e]));var Jc=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(r=>new Uint8Array(r)),yp=Ys.map((r,t)=>r.map(e=>Jc[t][e])),mp=Xs.map((r,t)=>r.map(e=>Jc[t][e])),xp=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),Ap=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),di=(r,t)=>r<<t|r>>>32-t;function Xc(r,t,e,n){return r===0?t^e^n:r===1?t&e|~t&n:r===2?(t|~e)^n:r===3?t&n|e&~n:t^(e|~n)}var li=new Uint32Array(16),Ws=class extends Sr{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:e,h2:n,h3:o,h4:s}=this;return[t,e,n,o,s]}set(t,e,n,o,s){this.h0=t|0,this.h1=e|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let T=0;T<16;T++,e+=4)li[T]=t.getUint32(e,!0);let n=this.h0|0,o=n,s=this.h1|0,c=s,u=this.h2|0,p=u,h=this.h3|0,y=h,x=this.h4|0,_=x;for(let T=0;T<5;T++){let N=4-T,E=xp[T],R=Ap[T],P=Ys[T],Q=Xs[T],z=yp[T],ee=mp[T];for(let L=0;L<16;L++){let j=di(n+Xc(T,s,u,h)+li[P[L]]+E,z[L])+x|0;n=x,x=h,h=di(u,10)|0,u=s,s=j}for(let L=0;L<16;L++){let j=di(o+Xc(N,c,p,y)+li[Q[L]]+R,ee[L])+_|0;o=_,_=y,y=di(p,10)|0,p=c,c=j}}this.set(this.h1+u+y|0,this.h2+h+_|0,this.h3+x+o|0,this.h4+n+c|0,this.h0+s+p|0)}roundClean(){li.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},eu=vr(()=>new Ws);var pi=ut.ProjectivePoint,Zs=Bc(ao);function tu(r){return BigInt(`0x${Lr(r)}`)}function bp(r){return Bn(r.toString(16).padStart(64,"0"))}var wp=vs("Bitcoin seed"),Js={private:76066276,public:76067358},ea=2147483648,Tp=r=>eu(ao(r)),vp=r=>Qt(r).getUint32(0,!1),gi=r=>{if(!Number.isSafeInteger(r)||r<0||r>2**32-1)throw new Error(`Invalid number=${r}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return Qt(t).setUint32(0,r,!1),t},hi=class r{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return vp(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){let t=this.privateKey;if(!t)throw new Error("No private key");return Zs.encode(this.serialize(this.versions.private,Fr(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return Zs.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=Js){if(zt(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);let n=jt(Qr,wp,t);return new r({versions:e,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(t,e=Js){let n=Zs.decode(t),o=Qt(n),s=o.getUint32(0,!1),c={versions:e,depth:n[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:n.slice(13,45)},u=n.slice(45),p=u[0]===0;if(s!==e[p?"private":"public"])throw new Error("Version mismatch");return p?new r({...c,privateKey:u.slice(1)}):new r({...c,publicKey:u})}static fromJSON(t){return r.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||Js,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!ut.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:tu(t.privateKey),this.privKeyBytes=bp(this.privKey),this.pubKey=ut.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=pi.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=Tp(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;let e=t.replace(/^[mM]'?\//,"").split("/"),n=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),c=s&&s[1];if(!s||s.length!==3||typeof c!="string")throw new Error(`Invalid child index: ${o}`);let u=+c;if(!Number.isSafeInteger(u)||u>=ea)throw new Error("Invalid index");s[2]==="'"&&(u+=ea),n=n.deriveChild(u)}return n}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=gi(t);if(t>=ea){let u=this.privateKey;if(!u)throw new Error("Could not derive hardened child key");e=Fr(new Uint8Array([0]),u,e)}else e=Fr(this.pubKey,e);let n=jt(Qr,this.chainCode,e),o=tu(n.slice(0,32)),s=n.slice(32);if(!ut.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let c={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let u=tt(this.privKey+o,ut.CURVE.n);if(!ut.utils.isValidPrivateKey(u))throw new Error("The tweak was out of range or the resulted private key is invalid");c.privateKey=u}else{let u=pi.fromHex(this.pubKey).add(pi.fromPrivateKey(o));if(u.equals(pi.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");c.publicKey=u.toRawBytes(!0)}return new r(c)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return zt(t,32),ut.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(zt(t,32),zt(e,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=ut.Signature.fromCompact(e)}catch{return!1}return ut.verify(n,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,e){if(!this.chainCode)throw new Error("No chainCode set");return zt(e,33),Fr(gi(t),new Uint8Array([this.depth]),gi(this.parentFingerprint),gi(this.index),this.chainCode,e)}};var tn=class tn extends At{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==tn.LENGTH)throw new Error(`PublicKey length should be ${tn.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),c=$r(s),u=o.toUint8Array();return ut.verify(u,c,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new tn(n)}static load(e){let n=e.deserializeBytes();return new tn(n)}};tn.LENGTH=65;var qt=tn,ar=class ar extends Vr{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==ar.LENGTH)throw new Error(`PrivateKey length should be ${ar.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let n=me.fromHexInput(e),o=$r(n.toUint8Array()),s=ut.sign(o,this.key.toUint8Array());return new ur(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new ar(n)}static generate(){let e=ut.utils.randomPrivateKey();return new ar(e)}publicKey(){let e=ut.getPublicKey(this.key.toUint8Array(),!1);return new qt(e)}static fromDerivationPath(e,n){if(!ks(e))throw new Error(`Invalid derivation path ${e}`);return ar.fromDerivationPathInner(e,co(n))}static fromDerivationPathInner(e,n){let{privateKey:o}=hi.fromMasterSeed(n).derive(e);if(o===null)throw new Error("Invalid key");return new ar(o)}};ar.LENGTH=32;var cr=ar,rn=class rn extends Mt{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==rn.LENGTH)throw new Error(`Signature length should be ${rn.LENGTH}, recieved ${n.toUint8Array().length}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new rn(n)}static load(e){let n=e.deserializeBytes();return new rn(n)}};rn.LENGTH=64;var ur=rn;var Ye=class r extends At{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:n,signature:o}=e;return this.publicKey.verifySignature({message:n,signature:o})}serialize(e){if(this.publicKey instanceof Pe)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof qt)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Pe.load(e));case 1:return new r(qt.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${n}`)}}};var nn=class r extends At{constructor(e){super();let{publicKeys:n,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(n.length<o)throw new Error(`Provided ${n.length} public keys is smaller than the ${o} required signatures`);let s=[];n.forEach(c=>{c instanceof Ye?s.push(c):s.push(new Ye(c))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),c=new Set;return n.forEach((u,p)=>{if(p+1>this.publicKeys.length)throw new Error(`Signature index ${p+1} is out of public keys range, ${this.publicKeys.length}.`);if(c.has(u))throw new Error(`Duplicate bit ${u} detected.`);c.add(u);let h=Math.floor(u/8),y=s[h];y|=o>>u%8,s[h]=y}),s}toString(){return me.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let n=e.deserializeVector(Ye),o=e.deserializeU8();return new r({publicKeys:n,signaturesRequired:o})}};var fr=class fr extends Z{constructor(e){super();let{data:n}=e,o=me.fromHexInput(n);if(o.toUint8Array().length!==fr.LENGTH)throw new Error(`Authentication Key length should be ${fr.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeFixedBytes(fr.LENGTH);return new fr({data:n})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:n,scheme:o}=e,s;switch(o){case 3:case 2:{let p=n.bcsToBytes();s=new Uint8Array([...p,o]);break}case 0:case 1:{let p=n.toUint8Array(),h=me.fromHexInput(p).toUint8Array();s=new Uint8Array([...h,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let c=$r.create();c.update(s);let u=c.digest();return new fr({data:u})}static fromPublicKey(e){let{publicKey:n}=e,o;if(n instanceof Pe)o=0 .valueOf();else if(n instanceof Dt)o=1 .valueOf();else if(n instanceof Ye)o=2 .valueOf();else if(n instanceof nn)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return fr.fromPublicKeyAndScheme({publicKey:n,scheme:o})}derivedAddress(){return new k(this.data.toUint8Array())}};fr.LENGTH=32;var Gt=fr;var dr=class r{constructor(t){let{privateKey:e,address:n,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof Pe)s?this.signingScheme=0:(this.publicKey=new Ye(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof Dt)this.signingScheme=1;else if(this.publicKey instanceof qt)this.publicKey=new Ye(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=n}static generate(t){let e=t?.legacy??!0,n,o;switch(t?.scheme){case 2:n=cr.generate(),o=new Ye(n.publicKey());break;default:n=or.generate(),e===!1?o=new Ye(n.publicKey()):o=n.publicKey()}let c=Gt.fromPublicKey({publicKey:o}).derivedAddress();return new r({privateKey:n,address:c,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:n}=t,o=n??!0,s;if(e instanceof cr)s=new Ye(e.publicKey());else if(e instanceof or)o?s=e.publicKey():s=new Ye(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let u=Gt.fromPublicKey({publicKey:s}).derivedAddress();return new r({privateKey:e,address:u,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:n,legacy:o}=t;return new r({privateKey:e,address:n,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:n,scheme:o,legacy:s}=t,c;switch(o){case 2:c=cr.fromDerivationPath(e,n);break;case 0:c=or.fromDerivationPath(e,n);break;default:throw new Error(`Unsupported scheme ${o}`)}return r.fromPrivateKey({privateKey:c,legacy:s})}static authKey(t){let{publicKey:e}=t;return Gt.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:n}=t,o=me.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var _p=`
|
|
1
|
+
"use strict";var aptosSDK=(()=>{var Sl=Object.create;var fo=Object.defineProperty;var Ec=Object.getOwnPropertyDescriptor;var El=Object.getOwnPropertyNames;var Cl=Object.getPrototypeOf,Ul=Object.prototype.hasOwnProperty;var Cc=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(t,e)=>(typeof require<"u"?require:t)[e]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Te=(r,t)=>()=>(t||r((t={exports:{}}).exports,t),t.exports),Uc=(r,t)=>{for(var e in t)fo(r,e,{get:t[e],enumerable:!0})},Ic=(r,t,e,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of El(t))!Ul.call(r,o)&&o!==e&&fo(r,o,{get:()=>t[o],enumerable:!(n=Ec(t,o))||n.enumerable});return r};var Pc=(r,t,e)=>(e=r!=null?Sl(Cl(r)):{},Ic(t||!r||!r.__esModule?fo(e,"default",{value:r,enumerable:!0}):e,r)),Il=r=>Ic(fo({},"__esModule",{value:!0}),r),mt=(r,t,e,n)=>{for(var o=n>1?void 0:n?Ec(t,e):t,s=r.length-1,a;s>=0;s--)(a=r[s])&&(o=(n?a(t,e,o):a(o))||o);return n&&o&&fo(t,e,o),o};var Zc=Te(()=>{"use strict"});var Jc=Te((Zy,wi)=>{"use strict";(function(r){"use strict";var t=function(c){var d,f=new Float64Array(16);if(c)for(d=0;d<c.length;d++)f[d]=c[d];return f},e=function(){throw new Error("no PRNG")},n=new Uint8Array(16),o=new Uint8Array(32);o[0]=9;var s=t(),a=t([1]),u=t([56129,1]),p=t([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),h=t([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),y=t([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),A=t([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),_=t([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function T(c,d,f,i){c[d]=f>>24&255,c[d+1]=f>>16&255,c[d+2]=f>>8&255,c[d+3]=f&255,c[d+4]=i>>24&255,c[d+5]=i>>16&255,c[d+6]=i>>8&255,c[d+7]=i&255}function z(c,d,f,i,l){var m,x=0;for(m=0;m<l;m++)x|=c[d+m]^f[i+m];return(1&x-1>>>8)-1}function S(c,d,f,i){return z(c,d,f,i,16)}function P(c,d,f,i){return z(c,d,f,i,32)}function B(c,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,x=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,E=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,R=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Q=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,q=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,_e=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,G=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,j=m,D=x,$=E,V=R,M=Q,b=q,w=_e,U=G,v=te,C=re,I=ue,Y=ce,fe=ne,le=ie,de=oe,g,he=0;he<20;he+=2)g=F+Y|0,V^=g<<7|g>>>32-7,g=V+F|0,U^=g<<9|g>>>32-9,g=U+V|0,Y^=g<<13|g>>>32-13,g=Y+U|0,F^=g<<18|g>>>32-18,g=M+j|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,j^=g<<13|g>>>32-13,g=j+fe|0,M^=g<<18|g>>>32-18,g=C+b|0,le^=g<<7|g>>>32-7,g=le+C|0,D^=g<<9|g>>>32-9,g=D+le|0,b^=g<<13|g>>>32-13,g=b+D|0,C^=g<<18|g>>>32-18,g=de+I|0,$^=g<<7|g>>>32-7,g=$+de|0,w^=g<<9|g>>>32-9,g=w+$|0,I^=g<<13|g>>>32-13,g=I+w|0,de^=g<<18|g>>>32-18,g=F+$|0,j^=g<<7|g>>>32-7,g=j+F|0,D^=g<<9|g>>>32-9,g=D+j|0,$^=g<<13|g>>>32-13,g=$+D|0,F^=g<<18|g>>>32-18,g=M+V|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,V^=g<<13|g>>>32-13,g=V+w|0,M^=g<<18|g>>>32-18,g=C+v|0,I^=g<<7|g>>>32-7,g=I+C|0,U^=g<<9|g>>>32-9,g=U+I|0,v^=g<<13|g>>>32-13,g=v+U|0,C^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;F=F+l|0,j=j+m|0,D=D+x|0,$=$+E|0,V=V+R|0,M=M+Q|0,b=b+q|0,w=w+_e|0,U=U+G|0,v=v+te|0,C=C+re|0,I=I+ue|0,Y=Y+ce|0,fe=fe+ne|0,le=le+ie|0,de=de+oe|0,c[0]=F>>>0&255,c[1]=F>>>8&255,c[2]=F>>>16&255,c[3]=F>>>24&255,c[4]=j>>>0&255,c[5]=j>>>8&255,c[6]=j>>>16&255,c[7]=j>>>24&255,c[8]=D>>>0&255,c[9]=D>>>8&255,c[10]=D>>>16&255,c[11]=D>>>24&255,c[12]=$>>>0&255,c[13]=$>>>8&255,c[14]=$>>>16&255,c[15]=$>>>24&255,c[16]=V>>>0&255,c[17]=V>>>8&255,c[18]=V>>>16&255,c[19]=V>>>24&255,c[20]=M>>>0&255,c[21]=M>>>8&255,c[22]=M>>>16&255,c[23]=M>>>24&255,c[24]=b>>>0&255,c[25]=b>>>8&255,c[26]=b>>>16&255,c[27]=b>>>24&255,c[28]=w>>>0&255,c[29]=w>>>8&255,c[30]=w>>>16&255,c[31]=w>>>24&255,c[32]=U>>>0&255,c[33]=U>>>8&255,c[34]=U>>>16&255,c[35]=U>>>24&255,c[36]=v>>>0&255,c[37]=v>>>8&255,c[38]=v>>>16&255,c[39]=v>>>24&255,c[40]=C>>>0&255,c[41]=C>>>8&255,c[42]=C>>>16&255,c[43]=C>>>24&255,c[44]=I>>>0&255,c[45]=I>>>8&255,c[46]=I>>>16&255,c[47]=I>>>24&255,c[48]=Y>>>0&255,c[49]=Y>>>8&255,c[50]=Y>>>16&255,c[51]=Y>>>24&255,c[52]=fe>>>0&255,c[53]=fe>>>8&255,c[54]=fe>>>16&255,c[55]=fe>>>24&255,c[56]=le>>>0&255,c[57]=le>>>8&255,c[58]=le>>>16&255,c[59]=le>>>24&255,c[60]=de>>>0&255,c[61]=de>>>8&255,c[62]=de>>>16&255,c[63]=de>>>24&255}function H(c,d,f,i){for(var l=i[0]&255|(i[1]&255)<<8|(i[2]&255)<<16|(i[3]&255)<<24,m=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,x=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,E=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,R=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,Q=i[4]&255|(i[5]&255)<<8|(i[6]&255)<<16|(i[7]&255)<<24,q=d[0]&255|(d[1]&255)<<8|(d[2]&255)<<16|(d[3]&255)<<24,_e=d[4]&255|(d[5]&255)<<8|(d[6]&255)<<16|(d[7]&255)<<24,G=d[8]&255|(d[9]&255)<<8|(d[10]&255)<<16|(d[11]&255)<<24,te=d[12]&255|(d[13]&255)<<8|(d[14]&255)<<16|(d[15]&255)<<24,re=i[8]&255|(i[9]&255)<<8|(i[10]&255)<<16|(i[11]&255)<<24,ue=f[16]&255|(f[17]&255)<<8|(f[18]&255)<<16|(f[19]&255)<<24,ce=f[20]&255|(f[21]&255)<<8|(f[22]&255)<<16|(f[23]&255)<<24,ne=f[24]&255|(f[25]&255)<<8|(f[26]&255)<<16|(f[27]&255)<<24,ie=f[28]&255|(f[29]&255)<<8|(f[30]&255)<<16|(f[31]&255)<<24,oe=i[12]&255|(i[13]&255)<<8|(i[14]&255)<<16|(i[15]&255)<<24,F=l,j=m,D=x,$=E,V=R,M=Q,b=q,w=_e,U=G,v=te,C=re,I=ue,Y=ce,fe=ne,le=ie,de=oe,g,he=0;he<20;he+=2)g=F+Y|0,V^=g<<7|g>>>32-7,g=V+F|0,U^=g<<9|g>>>32-9,g=U+V|0,Y^=g<<13|g>>>32-13,g=Y+U|0,F^=g<<18|g>>>32-18,g=M+j|0,v^=g<<7|g>>>32-7,g=v+M|0,fe^=g<<9|g>>>32-9,g=fe+v|0,j^=g<<13|g>>>32-13,g=j+fe|0,M^=g<<18|g>>>32-18,g=C+b|0,le^=g<<7|g>>>32-7,g=le+C|0,D^=g<<9|g>>>32-9,g=D+le|0,b^=g<<13|g>>>32-13,g=b+D|0,C^=g<<18|g>>>32-18,g=de+I|0,$^=g<<7|g>>>32-7,g=$+de|0,w^=g<<9|g>>>32-9,g=w+$|0,I^=g<<13|g>>>32-13,g=I+w|0,de^=g<<18|g>>>32-18,g=F+$|0,j^=g<<7|g>>>32-7,g=j+F|0,D^=g<<9|g>>>32-9,g=D+j|0,$^=g<<13|g>>>32-13,g=$+D|0,F^=g<<18|g>>>32-18,g=M+V|0,b^=g<<7|g>>>32-7,g=b+M|0,w^=g<<9|g>>>32-9,g=w+b|0,V^=g<<13|g>>>32-13,g=V+w|0,M^=g<<18|g>>>32-18,g=C+v|0,I^=g<<7|g>>>32-7,g=I+C|0,U^=g<<9|g>>>32-9,g=U+I|0,v^=g<<13|g>>>32-13,g=v+U|0,C^=g<<18|g>>>32-18,g=de+le|0,Y^=g<<7|g>>>32-7,g=Y+de|0,fe^=g<<9|g>>>32-9,g=fe+Y|0,le^=g<<13|g>>>32-13,g=le+fe|0,de^=g<<18|g>>>32-18;c[0]=F>>>0&255,c[1]=F>>>8&255,c[2]=F>>>16&255,c[3]=F>>>24&255,c[4]=M>>>0&255,c[5]=M>>>8&255,c[6]=M>>>16&255,c[7]=M>>>24&255,c[8]=C>>>0&255,c[9]=C>>>8&255,c[10]=C>>>16&255,c[11]=C>>>24&255,c[12]=de>>>0&255,c[13]=de>>>8&255,c[14]=de>>>16&255,c[15]=de>>>24&255,c[16]=b>>>0&255,c[17]=b>>>8&255,c[18]=b>>>16&255,c[19]=b>>>24&255,c[20]=w>>>0&255,c[21]=w>>>8&255,c[22]=w>>>16&255,c[23]=w>>>24&255,c[24]=U>>>0&255,c[25]=U>>>8&255,c[26]=U>>>16&255,c[27]=U>>>24&255,c[28]=v>>>0&255,c[29]=v>>>8&255,c[30]=v>>>16&255,c[31]=v>>>24&255}function k(c,d,f,i){B(c,d,f,i)}function ee(c,d,f,i){H(c,d,f,i)}var L=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function W(c,d,f,i,l,m,x){var E=new Uint8Array(16),R=new Uint8Array(64),Q,q;for(q=0;q<16;q++)E[q]=0;for(q=0;q<8;q++)E[q]=m[q];for(;l>=64;){for(k(R,E,x,L),q=0;q<64;q++)c[d+q]=f[i+q]^R[q];for(Q=1,q=8;q<16;q++)Q=Q+(E[q]&255)|0,E[q]=Q&255,Q>>>=8;l-=64,d+=64,i+=64}if(l>0)for(k(R,E,x,L),q=0;q<l;q++)c[d+q]=f[i+q]^R[q];return 0}function J(c,d,f,i,l){var m=new Uint8Array(16),x=new Uint8Array(64),E,R;for(R=0;R<16;R++)m[R]=0;for(R=0;R<8;R++)m[R]=i[R];for(;f>=64;){for(k(x,m,l,L),R=0;R<64;R++)c[d+R]=x[R];for(E=1,R=8;R<16;R++)E=E+(m[R]&255)|0,m[R]=E&255,E>>>=8;f-=64,d+=64}if(f>0)for(k(x,m,l,L),R=0;R<f;R++)c[d+R]=x[R];return 0}function X(c,d,f,i,l){var m=new Uint8Array(32);ee(m,i,l,L);for(var x=new Uint8Array(8),E=0;E<8;E++)x[E]=i[E+16];return J(c,d,f,x,m)}function Oe(c,d,f,i,l,m,x){var E=new Uint8Array(32);ee(E,m,x,L);for(var R=new Uint8Array(8),Q=0;Q<8;Q++)R[Q]=m[Q+16];return W(c,d,f,i,l,R,E)}var xe=function(c){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var d,f,i,l,m,x,E,R;d=c[0]&255|(c[1]&255)<<8,this.r[0]=d&8191,f=c[2]&255|(c[3]&255)<<8,this.r[1]=(d>>>13|f<<3)&8191,i=c[4]&255|(c[5]&255)<<8,this.r[2]=(f>>>10|i<<6)&7939,l=c[6]&255|(c[7]&255)<<8,this.r[3]=(i>>>7|l<<9)&8191,m=c[8]&255|(c[9]&255)<<8,this.r[4]=(l>>>4|m<<12)&255,this.r[5]=m>>>1&8190,x=c[10]&255|(c[11]&255)<<8,this.r[6]=(m>>>14|x<<2)&8191,E=c[12]&255|(c[13]&255)<<8,this.r[7]=(x>>>11|E<<5)&8065,R=c[14]&255|(c[15]&255)<<8,this.r[8]=(E>>>8|R<<8)&8191,this.r[9]=R>>>5&127,this.pad[0]=c[16]&255|(c[17]&255)<<8,this.pad[1]=c[18]&255|(c[19]&255)<<8,this.pad[2]=c[20]&255|(c[21]&255)<<8,this.pad[3]=c[22]&255|(c[23]&255)<<8,this.pad[4]=c[24]&255|(c[25]&255)<<8,this.pad[5]=c[26]&255|(c[27]&255)<<8,this.pad[6]=c[28]&255|(c[29]&255)<<8,this.pad[7]=c[30]&255|(c[31]&255)<<8};xe.prototype.blocks=function(c,d,f){for(var i=this.fin?0:2048,l,m,x,E,R,Q,q,_e,G,te,re,ue,ce,ne,ie,oe,F,j,D,$=this.h[0],V=this.h[1],M=this.h[2],b=this.h[3],w=this.h[4],U=this.h[5],v=this.h[6],C=this.h[7],I=this.h[8],Y=this.h[9],fe=this.r[0],le=this.r[1],de=this.r[2],g=this.r[3],he=this.r[4],ve=this.r[5],Se=this.r[6],ge=this.r[7],be=this.r[8],we=this.r[9];f>=16;)l=c[d+0]&255|(c[d+1]&255)<<8,$+=l&8191,m=c[d+2]&255|(c[d+3]&255)<<8,V+=(l>>>13|m<<3)&8191,x=c[d+4]&255|(c[d+5]&255)<<8,M+=(m>>>10|x<<6)&8191,E=c[d+6]&255|(c[d+7]&255)<<8,b+=(x>>>7|E<<9)&8191,R=c[d+8]&255|(c[d+9]&255)<<8,w+=(E>>>4|R<<12)&8191,U+=R>>>1&8191,Q=c[d+10]&255|(c[d+11]&255)<<8,v+=(R>>>14|Q<<2)&8191,q=c[d+12]&255|(c[d+13]&255)<<8,C+=(Q>>>11|q<<5)&8191,_e=c[d+14]&255|(c[d+15]&255)<<8,I+=(q>>>8|_e<<8)&8191,Y+=_e>>>5|i,G=0,te=G,te+=$*fe,te+=V*(5*we),te+=M*(5*be),te+=b*(5*ge),te+=w*(5*Se),G=te>>>13,te&=8191,te+=U*(5*ve),te+=v*(5*he),te+=C*(5*g),te+=I*(5*de),te+=Y*(5*le),G+=te>>>13,te&=8191,re=G,re+=$*le,re+=V*fe,re+=M*(5*we),re+=b*(5*be),re+=w*(5*ge),G=re>>>13,re&=8191,re+=U*(5*Se),re+=v*(5*ve),re+=C*(5*he),re+=I*(5*g),re+=Y*(5*de),G+=re>>>13,re&=8191,ue=G,ue+=$*de,ue+=V*le,ue+=M*fe,ue+=b*(5*we),ue+=w*(5*be),G=ue>>>13,ue&=8191,ue+=U*(5*ge),ue+=v*(5*Se),ue+=C*(5*ve),ue+=I*(5*he),ue+=Y*(5*g),G+=ue>>>13,ue&=8191,ce=G,ce+=$*g,ce+=V*de,ce+=M*le,ce+=b*fe,ce+=w*(5*we),G=ce>>>13,ce&=8191,ce+=U*(5*be),ce+=v*(5*ge),ce+=C*(5*Se),ce+=I*(5*ve),ce+=Y*(5*he),G+=ce>>>13,ce&=8191,ne=G,ne+=$*he,ne+=V*g,ne+=M*de,ne+=b*le,ne+=w*fe,G=ne>>>13,ne&=8191,ne+=U*(5*we),ne+=v*(5*be),ne+=C*(5*ge),ne+=I*(5*Se),ne+=Y*(5*ve),G+=ne>>>13,ne&=8191,ie=G,ie+=$*ve,ie+=V*he,ie+=M*g,ie+=b*de,ie+=w*le,G=ie>>>13,ie&=8191,ie+=U*fe,ie+=v*(5*we),ie+=C*(5*be),ie+=I*(5*ge),ie+=Y*(5*Se),G+=ie>>>13,ie&=8191,oe=G,oe+=$*Se,oe+=V*ve,oe+=M*he,oe+=b*g,oe+=w*de,G=oe>>>13,oe&=8191,oe+=U*le,oe+=v*fe,oe+=C*(5*we),oe+=I*(5*be),oe+=Y*(5*ge),G+=oe>>>13,oe&=8191,F=G,F+=$*ge,F+=V*Se,F+=M*ve,F+=b*he,F+=w*g,G=F>>>13,F&=8191,F+=U*de,F+=v*le,F+=C*fe,F+=I*(5*we),F+=Y*(5*be),G+=F>>>13,F&=8191,j=G,j+=$*be,j+=V*ge,j+=M*Se,j+=b*ve,j+=w*he,G=j>>>13,j&=8191,j+=U*g,j+=v*de,j+=C*le,j+=I*fe,j+=Y*(5*we),G+=j>>>13,j&=8191,D=G,D+=$*we,D+=V*be,D+=M*ge,D+=b*Se,D+=w*ve,G=D>>>13,D&=8191,D+=U*he,D+=v*g,D+=C*de,D+=I*le,D+=Y*fe,G+=D>>>13,D&=8191,G=(G<<2)+G|0,G=G+te|0,te=G&8191,G=G>>>13,re+=G,$=te,V=re,M=ue,b=ce,w=ne,U=ie,v=oe,C=F,I=j,Y=D,d+=16,f-=16;this.h[0]=$,this.h[1]=V,this.h[2]=M,this.h[3]=b,this.h[4]=w,this.h[5]=U,this.h[6]=v,this.h[7]=C,this.h[8]=I,this.h[9]=Y},xe.prototype.finish=function(c,d){var f=new Uint16Array(10),i,l,m,x;if(this.leftover){for(x=this.leftover,this.buffer[x++]=1;x<16;x++)this.buffer[x]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(i=this.h[1]>>>13,this.h[1]&=8191,x=2;x<10;x++)this.h[x]+=i,i=this.h[x]>>>13,this.h[x]&=8191;for(this.h[0]+=i*5,i=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=i,i=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=i,f[0]=this.h[0]+5,i=f[0]>>>13,f[0]&=8191,x=1;x<10;x++)f[x]=this.h[x]+i,i=f[x]>>>13,f[x]&=8191;for(f[9]-=8192,l=(i^1)-1,x=0;x<10;x++)f[x]&=l;for(l=~l,x=0;x<10;x++)this.h[x]=this.h[x]&l|f[x];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,m=this.h[0]+this.pad[0],this.h[0]=m&65535,x=1;x<8;x++)m=(this.h[x]+this.pad[x]|0)+(m>>>16)|0,this.h[x]=m&65535;c[d+0]=this.h[0]>>>0&255,c[d+1]=this.h[0]>>>8&255,c[d+2]=this.h[1]>>>0&255,c[d+3]=this.h[1]>>>8&255,c[d+4]=this.h[2]>>>0&255,c[d+5]=this.h[2]>>>8&255,c[d+6]=this.h[3]>>>0&255,c[d+7]=this.h[3]>>>8&255,c[d+8]=this.h[4]>>>0&255,c[d+9]=this.h[4]>>>8&255,c[d+10]=this.h[5]>>>0&255,c[d+11]=this.h[5]>>>8&255,c[d+12]=this.h[6]>>>0&255,c[d+13]=this.h[6]>>>8&255,c[d+14]=this.h[7]>>>0&255,c[d+15]=this.h[7]>>>8&255},xe.prototype.update=function(c,d,f){var i,l;if(this.leftover){for(l=16-this.leftover,l>f&&(l=f),i=0;i<l;i++)this.buffer[this.leftover+i]=c[d+i];if(f-=l,d+=l,this.leftover+=l,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(f>=16&&(l=f-f%16,this.blocks(c,d,l),d+=l,f-=l),f){for(i=0;i<f;i++)this.buffer[this.leftover+i]=c[d+i];this.leftover+=f}};function ye(c,d,f,i,l,m){var x=new xe(m);return x.update(f,i,l),x.finish(c,d),0}function Ve(c,d,f,i,l,m){var x=new Uint8Array(16);return ye(x,0,f,i,l,m),S(c,d,x,0)}function Qe(c,d,f,i,l){var m;if(f<32)return-1;for(Oe(c,0,d,0,f,i,l),ye(c,16,c,32,f-32,c),m=0;m<16;m++)c[m]=0;return 0}function yt(c,d,f,i,l){var m,x=new Uint8Array(32);if(f<32||(X(x,0,32,i,l),Ve(d,16,d,32,f-32,x)!==0))return-1;for(Oe(c,0,d,0,f,i,l),m=0;m<32;m++)c[m]=0;return 0}function O(c,d){var f;for(f=0;f<16;f++)c[f]=d[f]|0}function K(c){var d,f,i=1;for(d=0;d<16;d++)f=c[d]+i+65535,i=Math.floor(f/65536),c[d]=f-i*65536;c[0]+=i-1+37*(i-1)}function se(c,d,f){for(var i,l=~(f-1),m=0;m<16;m++)i=l&(c[m]^d[m]),c[m]^=i,d[m]^=i}function Ee(c,d){var f,i,l,m=t(),x=t();for(f=0;f<16;f++)x[f]=d[f];for(K(x),K(x),K(x),i=0;i<2;i++){for(m[0]=x[0]-65517,f=1;f<15;f++)m[f]=x[f]-65535-(m[f-1]>>16&1),m[f-1]&=65535;m[15]=x[15]-32767-(m[14]>>16&1),l=m[15]>>16&1,m[14]&=65535,se(x,m,1-l)}for(f=0;f<16;f++)c[2*f]=x[f]&255,c[2*f+1]=x[f]>>8}function Ue(c,d){var f=new Uint8Array(32),i=new Uint8Array(32);return Ee(f,c),Ee(i,d),P(f,0,i,0)}function We(c){var d=new Uint8Array(32);return Ee(d,c),d[0]&1}function at(c,d){var f;for(f=0;f<16;f++)c[f]=d[2*f]+(d[2*f+1]<<8);c[15]&=32767}function Ne(c,d,f){for(var i=0;i<16;i++)c[i]=d[i]+f[i]}function Xe(c,d,f){for(var i=0;i<16;i++)c[i]=d[i]-f[i]}function ae(c,d,f){var i,l,m=0,x=0,E=0,R=0,Q=0,q=0,_e=0,G=0,te=0,re=0,ue=0,ce=0,ne=0,ie=0,oe=0,F=0,j=0,D=0,$=0,V=0,M=0,b=0,w=0,U=0,v=0,C=0,I=0,Y=0,fe=0,le=0,de=0,g=f[0],he=f[1],ve=f[2],Se=f[3],ge=f[4],be=f[5],we=f[6],je=f[7],Pe=f[8],De=f[9],Ge=f[10],Le=f[11],et=f[12],ut=f[13],ft=f[14],dt=f[15];i=d[0],m+=i*g,x+=i*he,E+=i*ve,R+=i*Se,Q+=i*ge,q+=i*be,_e+=i*we,G+=i*je,te+=i*Pe,re+=i*De,ue+=i*Ge,ce+=i*Le,ne+=i*et,ie+=i*ut,oe+=i*ft,F+=i*dt,i=d[1],x+=i*g,E+=i*he,R+=i*ve,Q+=i*Se,q+=i*ge,_e+=i*be,G+=i*we,te+=i*je,re+=i*Pe,ue+=i*De,ce+=i*Ge,ne+=i*Le,ie+=i*et,oe+=i*ut,F+=i*ft,j+=i*dt,i=d[2],E+=i*g,R+=i*he,Q+=i*ve,q+=i*Se,_e+=i*ge,G+=i*be,te+=i*we,re+=i*je,ue+=i*Pe,ce+=i*De,ne+=i*Ge,ie+=i*Le,oe+=i*et,F+=i*ut,j+=i*ft,D+=i*dt,i=d[3],R+=i*g,Q+=i*he,q+=i*ve,_e+=i*Se,G+=i*ge,te+=i*be,re+=i*we,ue+=i*je,ce+=i*Pe,ne+=i*De,ie+=i*Ge,oe+=i*Le,F+=i*et,j+=i*ut,D+=i*ft,$+=i*dt,i=d[4],Q+=i*g,q+=i*he,_e+=i*ve,G+=i*Se,te+=i*ge,re+=i*be,ue+=i*we,ce+=i*je,ne+=i*Pe,ie+=i*De,oe+=i*Ge,F+=i*Le,j+=i*et,D+=i*ut,$+=i*ft,V+=i*dt,i=d[5],q+=i*g,_e+=i*he,G+=i*ve,te+=i*Se,re+=i*ge,ue+=i*be,ce+=i*we,ne+=i*je,ie+=i*Pe,oe+=i*De,F+=i*Ge,j+=i*Le,D+=i*et,$+=i*ut,V+=i*ft,M+=i*dt,i=d[6],_e+=i*g,G+=i*he,te+=i*ve,re+=i*Se,ue+=i*ge,ce+=i*be,ne+=i*we,ie+=i*je,oe+=i*Pe,F+=i*De,j+=i*Ge,D+=i*Le,$+=i*et,V+=i*ut,M+=i*ft,b+=i*dt,i=d[7],G+=i*g,te+=i*he,re+=i*ve,ue+=i*Se,ce+=i*ge,ne+=i*be,ie+=i*we,oe+=i*je,F+=i*Pe,j+=i*De,D+=i*Ge,$+=i*Le,V+=i*et,M+=i*ut,b+=i*ft,w+=i*dt,i=d[8],te+=i*g,re+=i*he,ue+=i*ve,ce+=i*Se,ne+=i*ge,ie+=i*be,oe+=i*we,F+=i*je,j+=i*Pe,D+=i*De,$+=i*Ge,V+=i*Le,M+=i*et,b+=i*ut,w+=i*ft,U+=i*dt,i=d[9],re+=i*g,ue+=i*he,ce+=i*ve,ne+=i*Se,ie+=i*ge,oe+=i*be,F+=i*we,j+=i*je,D+=i*Pe,$+=i*De,V+=i*Ge,M+=i*Le,b+=i*et,w+=i*ut,U+=i*ft,v+=i*dt,i=d[10],ue+=i*g,ce+=i*he,ne+=i*ve,ie+=i*Se,oe+=i*ge,F+=i*be,j+=i*we,D+=i*je,$+=i*Pe,V+=i*De,M+=i*Ge,b+=i*Le,w+=i*et,U+=i*ut,v+=i*ft,C+=i*dt,i=d[11],ce+=i*g,ne+=i*he,ie+=i*ve,oe+=i*Se,F+=i*ge,j+=i*be,D+=i*we,$+=i*je,V+=i*Pe,M+=i*De,b+=i*Ge,w+=i*Le,U+=i*et,v+=i*ut,C+=i*ft,I+=i*dt,i=d[12],ne+=i*g,ie+=i*he,oe+=i*ve,F+=i*Se,j+=i*ge,D+=i*be,$+=i*we,V+=i*je,M+=i*Pe,b+=i*De,w+=i*Ge,U+=i*Le,v+=i*et,C+=i*ut,I+=i*ft,Y+=i*dt,i=d[13],ie+=i*g,oe+=i*he,F+=i*ve,j+=i*Se,D+=i*ge,$+=i*be,V+=i*we,M+=i*je,b+=i*Pe,w+=i*De,U+=i*Ge,v+=i*Le,C+=i*et,I+=i*ut,Y+=i*ft,fe+=i*dt,i=d[14],oe+=i*g,F+=i*he,j+=i*ve,D+=i*Se,$+=i*ge,V+=i*be,M+=i*we,b+=i*je,w+=i*Pe,U+=i*De,v+=i*Ge,C+=i*Le,I+=i*et,Y+=i*ut,fe+=i*ft,le+=i*dt,i=d[15],F+=i*g,j+=i*he,D+=i*ve,$+=i*Se,V+=i*ge,M+=i*be,b+=i*we,w+=i*je,U+=i*Pe,v+=i*De,C+=i*Ge,I+=i*Le,Y+=i*et,fe+=i*ut,le+=i*ft,de+=i*dt,m+=38*j,x+=38*D,E+=38*$,R+=38*V,Q+=38*M,q+=38*b,_e+=38*w,G+=38*U,te+=38*v,re+=38*C,ue+=38*I,ce+=38*Y,ne+=38*fe,ie+=38*le,oe+=38*de,l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=x+l+65535,l=Math.floor(i/65536),x=i-l*65536,i=E+l+65535,l=Math.floor(i/65536),E=i-l*65536,i=R+l+65535,l=Math.floor(i/65536),R=i-l*65536,i=Q+l+65535,l=Math.floor(i/65536),Q=i-l*65536,i=q+l+65535,l=Math.floor(i/65536),q=i-l*65536,i=_e+l+65535,l=Math.floor(i/65536),_e=i-l*65536,i=G+l+65535,l=Math.floor(i/65536),G=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),l=1,i=m+l+65535,l=Math.floor(i/65536),m=i-l*65536,i=x+l+65535,l=Math.floor(i/65536),x=i-l*65536,i=E+l+65535,l=Math.floor(i/65536),E=i-l*65536,i=R+l+65535,l=Math.floor(i/65536),R=i-l*65536,i=Q+l+65535,l=Math.floor(i/65536),Q=i-l*65536,i=q+l+65535,l=Math.floor(i/65536),q=i-l*65536,i=_e+l+65535,l=Math.floor(i/65536),_e=i-l*65536,i=G+l+65535,l=Math.floor(i/65536),G=i-l*65536,i=te+l+65535,l=Math.floor(i/65536),te=i-l*65536,i=re+l+65535,l=Math.floor(i/65536),re=i-l*65536,i=ue+l+65535,l=Math.floor(i/65536),ue=i-l*65536,i=ce+l+65535,l=Math.floor(i/65536),ce=i-l*65536,i=ne+l+65535,l=Math.floor(i/65536),ne=i-l*65536,i=ie+l+65535,l=Math.floor(i/65536),ie=i-l*65536,i=oe+l+65535,l=Math.floor(i/65536),oe=i-l*65536,i=F+l+65535,l=Math.floor(i/65536),F=i-l*65536,m+=l-1+37*(l-1),c[0]=m,c[1]=x,c[2]=E,c[3]=R,c[4]=Q,c[5]=q,c[6]=_e,c[7]=G,c[8]=te,c[9]=re,c[10]=ue,c[11]=ce,c[12]=ne,c[13]=ie,c[14]=oe,c[15]=F}function Je(c,d){ae(c,d,d)}function Tr(c,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=253;i>=0;i--)Je(f,f),i!==2&&i!==4&&ae(f,f,d);for(i=0;i<16;i++)c[i]=f[i]}function Mt(c,d){var f=t(),i;for(i=0;i<16;i++)f[i]=d[i];for(i=250;i>=0;i--)Je(f,f),i!==1&&ae(f,f,d);for(i=0;i<16;i++)c[i]=f[i]}function _r(c,d,f){var i=new Uint8Array(32),l=new Float64Array(80),m,x,E=t(),R=t(),Q=t(),q=t(),_e=t(),G=t();for(x=0;x<31;x++)i[x]=d[x];for(i[31]=d[31]&127|64,i[0]&=248,at(l,f),x=0;x<16;x++)R[x]=l[x],q[x]=E[x]=Q[x]=0;for(E[0]=q[0]=1,x=254;x>=0;--x)m=i[x>>>3]>>>(x&7)&1,se(E,R,m),se(Q,q,m),Ne(_e,E,Q),Xe(E,E,Q),Ne(Q,R,q),Xe(R,R,q),Je(q,_e),Je(G,E),ae(E,Q,E),ae(Q,R,_e),Ne(_e,E,Q),Xe(E,E,Q),Je(R,E),Xe(Q,q,G),ae(E,Q,u),Ne(E,E,q),ae(Q,Q,E),ae(E,q,G),ae(q,R,l),Je(R,_e),se(E,R,m),se(Q,q,m);for(x=0;x<16;x++)l[x+16]=E[x],l[x+32]=Q[x],l[x+48]=R[x],l[x+64]=q[x];var te=l.subarray(32),re=l.subarray(16);return Tr(te,te),ae(re,re,te),Ee(c,re),0}function Ct(c,d){return _r(c,d,o)}function ir(c,d){return e(d,32),Ct(c,d)}function Vr(c,d,f){var i=new Uint8Array(32);return _r(i,f,d),ee(c,n,i,L)}var bt=Qe,vr=yt;function Nn(c,d,f,i,l,m){var x=new Uint8Array(32);return Vr(x,l,m),bt(c,d,f,i,x)}function ei(c,d,f,i,l,m){var x=new Uint8Array(32);return Vr(x,l,m),vr(c,d,f,i,x)}var io=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function bc(c,d,f,i){for(var l=new Int32Array(16),m=new Int32Array(16),x,E,R,Q,q,_e,G,te,re,ue,ce,ne,ie,oe,F,j,D,$,V,M,b,w,U,v,C,I,Y=c[0],fe=c[1],le=c[2],de=c[3],g=c[4],he=c[5],ve=c[6],Se=c[7],ge=d[0],be=d[1],we=d[2],je=d[3],Pe=d[4],De=d[5],Ge=d[6],Le=d[7],et=0;i>=128;){for(V=0;V<16;V++)M=8*V+et,l[V]=f[M+0]<<24|f[M+1]<<16|f[M+2]<<8|f[M+3],m[V]=f[M+4]<<24|f[M+5]<<16|f[M+6]<<8|f[M+7];for(V=0;V<80;V++)if(x=Y,E=fe,R=le,Q=de,q=g,_e=he,G=ve,te=Se,re=ge,ue=be,ce=we,ne=je,ie=Pe,oe=De,F=Ge,j=Le,b=Se,w=Le,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=(g>>>14|Pe<<32-14)^(g>>>18|Pe<<32-18)^(Pe>>>41-32|g<<32-(41-32)),w=(Pe>>>14|g<<32-14)^(Pe>>>18|g<<32-18)^(g>>>41-32|Pe<<32-(41-32)),U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,b=g&he^~g&ve,w=Pe&De^~Pe&Ge,U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,b=io[V*2],w=io[V*2+1],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,b=l[V%16],w=m[V%16],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,D=C&65535|I<<16,$=U&65535|v<<16,b=D,w=$,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=(Y>>>28|ge<<32-28)^(ge>>>34-32|Y<<32-(34-32))^(ge>>>39-32|Y<<32-(39-32)),w=(ge>>>28|Y<<32-28)^(Y>>>34-32|ge<<32-(34-32))^(Y>>>39-32|ge<<32-(39-32)),U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,b=Y&fe^Y&le^fe&le,w=ge&be^ge&we^be&we,U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,te=C&65535|I<<16,j=U&65535|v<<16,b=Q,w=ne,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=D,w=$,U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,Q=C&65535|I<<16,ne=U&65535|v<<16,fe=x,le=E,de=R,g=Q,he=q,ve=_e,Se=G,Y=te,be=re,we=ue,je=ce,Pe=ne,De=ie,Ge=oe,Le=F,ge=j,V%16===15)for(M=0;M<16;M++)b=l[M],w=m[M],U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=l[(M+9)%16],w=m[(M+9)%16],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,D=l[(M+1)%16],$=m[(M+1)%16],b=(D>>>1|$<<32-1)^(D>>>8|$<<32-8)^D>>>7,w=($>>>1|D<<32-1)^($>>>8|D<<32-8)^($>>>7|D<<32-7),U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,D=l[(M+14)%16],$=m[(M+14)%16],b=(D>>>19|$<<32-19)^($>>>61-32|D<<32-(61-32))^D>>>6,w=($>>>19|D<<32-19)^(D>>>61-32|$<<32-(61-32))^($>>>6|D<<32-6),U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,l[M]=C&65535|I<<16,m[M]=U&65535|v<<16;b=Y,w=ge,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[0],w=d[0],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[0]=Y=C&65535|I<<16,d[0]=ge=U&65535|v<<16,b=fe,w=be,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[1],w=d[1],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[1]=fe=C&65535|I<<16,d[1]=be=U&65535|v<<16,b=le,w=we,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[2],w=d[2],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[2]=le=C&65535|I<<16,d[2]=we=U&65535|v<<16,b=de,w=je,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[3],w=d[3],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[3]=de=C&65535|I<<16,d[3]=je=U&65535|v<<16,b=g,w=Pe,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[4],w=d[4],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[4]=g=C&65535|I<<16,d[4]=Pe=U&65535|v<<16,b=he,w=De,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[5],w=d[5],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[5]=he=C&65535|I<<16,d[5]=De=U&65535|v<<16,b=ve,w=Ge,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[6],w=d[6],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[6]=ve=C&65535|I<<16,d[6]=Ge=U&65535|v<<16,b=Se,w=Le,U=w&65535,v=w>>>16,C=b&65535,I=b>>>16,b=c[7],w=d[7],U+=w&65535,v+=w>>>16,C+=b&65535,I+=b>>>16,v+=U>>>16,C+=v>>>16,I+=C>>>16,c[7]=Se=C&65535|I<<16,d[7]=Le=U&65535|v<<16,et+=128,i-=128}return i}function Qr(c,d,f){var i=new Int32Array(8),l=new Int32Array(8),m=new Uint8Array(256),x,E=f;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,l[0]=4089235720,l[1]=2227873595,l[2]=4271175723,l[3]=1595750129,l[4]=2917565137,l[5]=725511199,l[6]=4215389547,l[7]=327033209,bc(i,l,d,f),f%=128,x=0;x<f;x++)m[x]=d[E-f+x];for(m[f]=128,f=256-128*(f<112?1:0),m[f-9]=0,T(m,f-8,E/536870912|0,E<<3),bc(i,l,m,f),x=0;x<8;x++)T(c,8*x,i[x],l[x]);return 0}function ti(c,d){var f=t(),i=t(),l=t(),m=t(),x=t(),E=t(),R=t(),Q=t(),q=t();Xe(f,c[1],c[0]),Xe(q,d[1],d[0]),ae(f,f,q),Ne(i,c[0],c[1]),Ne(q,d[0],d[1]),ae(i,i,q),ae(l,c[3],d[3]),ae(l,l,h),ae(m,c[2],d[2]),Ne(m,m,m),Xe(x,i,f),Xe(E,m,l),Ne(R,m,l),Ne(Q,i,f),ae(c[0],x,E),ae(c[1],Q,R),ae(c[2],R,E),ae(c[3],x,Q)}function wc(c,d,f){var i;for(i=0;i<4;i++)se(c[i],d[i],f)}function xs(c,d){var f=t(),i=t(),l=t();Tr(l,d[2]),ae(f,d[0],l),ae(i,d[1],l),Ee(c,i),c[31]^=We(f)<<7}function bs(c,d,f){var i,l;for(O(c[0],s),O(c[1],a),O(c[2],a),O(c[3],s),l=255;l>=0;--l)i=f[l/8|0]>>(l&7)&1,wc(c,d,i),ti(d,c),ti(c,c),wc(c,d,i)}function ri(c,d){var f=[t(),t(),t(),t()];O(f[0],y),O(f[1],A),O(f[2],a),ae(f[3],y,A),bs(c,f,d)}function ws(c,d,f){var i=new Uint8Array(64),l=[t(),t(),t(),t()],m;for(f||e(d,32),Qr(i,d,32),i[0]&=248,i[31]&=127,i[31]|=64,ri(l,i),xs(c,l),m=0;m<32;m++)d[m+32]=c[m];return 0}var ni=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function Ts(c,d){var f,i,l,m;for(i=63;i>=32;--i){for(f=0,l=i-32,m=i-12;l<m;++l)d[l]+=f-16*d[i]*ni[l-(i-32)],f=Math.floor((d[l]+128)/256),d[l]-=f*256;d[l]+=f,d[i]=0}for(f=0,l=0;l<32;l++)d[l]+=f-(d[31]>>4)*ni[l],f=d[l]>>8,d[l]&=255;for(l=0;l<32;l++)d[l]-=f*ni[l];for(i=0;i<32;i++)d[i+1]+=d[i]>>8,c[i]=d[i]&255}function _s(c){var d=new Float64Array(64),f;for(f=0;f<64;f++)d[f]=c[f];for(f=0;f<64;f++)c[f]=0;Ts(c,d)}function Tc(c,d,f,i){var l=new Uint8Array(64),m=new Uint8Array(64),x=new Uint8Array(64),E,R,Q=new Float64Array(64),q=[t(),t(),t(),t()];Qr(l,i,32),l[0]&=248,l[31]&=127,l[31]|=64;var _e=f+64;for(E=0;E<f;E++)c[64+E]=d[E];for(E=0;E<32;E++)c[32+E]=l[32+E];for(Qr(x,c.subarray(32),f+32),_s(x),ri(q,x),xs(c,q),E=32;E<64;E++)c[E]=i[E];for(Qr(m,c,f+64),_s(m),E=0;E<64;E++)Q[E]=0;for(E=0;E<32;E++)Q[E]=x[E];for(E=0;E<32;E++)for(R=0;R<32;R++)Q[E+R]+=m[E]*l[R];return Ts(c.subarray(32),Q),_e}function wl(c,d){var f=t(),i=t(),l=t(),m=t(),x=t(),E=t(),R=t();return O(c[2],a),at(c[1],d),Je(l,c[1]),ae(m,l,p),Xe(l,l,c[2]),Ne(m,c[2],m),Je(x,m),Je(E,x),ae(R,E,x),ae(f,R,l),ae(f,f,m),Mt(f,f),ae(f,f,l),ae(f,f,m),ae(f,f,m),ae(c[0],f,m),Je(i,c[0]),ae(i,i,m),Ue(i,l)&&ae(c[0],c[0],_),Je(i,c[0]),ae(i,i,m),Ue(i,l)?-1:(We(c[0])===d[31]>>7&&Xe(c[0],s,c[0]),ae(c[3],c[0],c[1]),0)}function vs(c,d,f,i){var l,m=new Uint8Array(32),x=new Uint8Array(64),E=[t(),t(),t(),t()],R=[t(),t(),t(),t()];if(f<64||wl(R,i))return-1;for(l=0;l<f;l++)c[l]=d[l];for(l=0;l<32;l++)c[l+32]=i[l];if(Qr(x,c,f),_s(x),bs(E,R,x),ri(R,d.subarray(32)),ti(E,R),xs(m,E),f-=64,P(d,0,m,0)){for(l=0;l<f;l++)c[l]=0;return-1}for(l=0;l<f;l++)c[l]=d[l+64];return f}var Ss=32,oi=24,so=32,kn=16,ao=32,ii=32,co=32,uo=32,Es=32,_c=oi,Tl=so,_l=kn,sr=64,Wr=32,zn=64,Cs=32,Us=64;r.lowlevel={crypto_core_hsalsa20:ee,crypto_stream_xor:Oe,crypto_stream:X,crypto_stream_salsa20_xor:W,crypto_stream_salsa20:J,crypto_onetimeauth:ye,crypto_onetimeauth_verify:Ve,crypto_verify_16:S,crypto_verify_32:P,crypto_secretbox:Qe,crypto_secretbox_open:yt,crypto_scalarmult:_r,crypto_scalarmult_base:Ct,crypto_box_beforenm:Vr,crypto_box_afternm:bt,crypto_box:Nn,crypto_box_open:ei,crypto_box_keypair:ir,crypto_hash:Qr,crypto_sign:Tc,crypto_sign_keypair:ws,crypto_sign_open:vs,crypto_secretbox_KEYBYTES:Ss,crypto_secretbox_NONCEBYTES:oi,crypto_secretbox_ZEROBYTES:so,crypto_secretbox_BOXZEROBYTES:kn,crypto_scalarmult_BYTES:ao,crypto_scalarmult_SCALARBYTES:ii,crypto_box_PUBLICKEYBYTES:co,crypto_box_SECRETKEYBYTES:uo,crypto_box_BEFORENMBYTES:Es,crypto_box_NONCEBYTES:_c,crypto_box_ZEROBYTES:Tl,crypto_box_BOXZEROBYTES:_l,crypto_sign_BYTES:sr,crypto_sign_PUBLICKEYBYTES:Wr,crypto_sign_SECRETKEYBYTES:zn,crypto_sign_SEEDBYTES:Cs,crypto_hash_BYTES:Us,gf:t,D:p,L:ni,pack25519:Ee,unpack25519:at,M:ae,A:Ne,S:Je,Z:Xe,pow2523:Mt,add:ti,set25519:O,modL:Ts,scalarmult:bs,scalarbase:ri};function vc(c,d){if(c.length!==Ss)throw new Error("bad key size");if(d.length!==oi)throw new Error("bad nonce size")}function vl(c,d){if(c.length!==co)throw new Error("bad public key size");if(d.length!==uo)throw new Error("bad secret key size")}function wt(){for(var c=0;c<arguments.length;c++)if(!(arguments[c]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function Sc(c){for(var d=0;d<c.length;d++)c[d]=0}r.randomBytes=function(c){var d=new Uint8Array(c);return e(d,c),d},r.secretbox=function(c,d,f){wt(c,d,f),vc(f,d);for(var i=new Uint8Array(so+c.length),l=new Uint8Array(i.length),m=0;m<c.length;m++)i[m+so]=c[m];return Qe(l,i,i.length,d,f),l.subarray(kn)},r.secretbox.open=function(c,d,f){wt(c,d,f),vc(f,d);for(var i=new Uint8Array(kn+c.length),l=new Uint8Array(i.length),m=0;m<c.length;m++)i[m+kn]=c[m];return i.length<32||yt(l,i,i.length,d,f)!==0?null:l.subarray(so)},r.secretbox.keyLength=Ss,r.secretbox.nonceLength=oi,r.secretbox.overheadLength=kn,r.scalarMult=function(c,d){if(wt(c,d),c.length!==ii)throw new Error("bad n size");if(d.length!==ao)throw new Error("bad p size");var f=new Uint8Array(ao);return _r(f,c,d),f},r.scalarMult.base=function(c){if(wt(c),c.length!==ii)throw new Error("bad n size");var d=new Uint8Array(ao);return Ct(d,c),d},r.scalarMult.scalarLength=ii,r.scalarMult.groupElementLength=ao,r.box=function(c,d,f,i){var l=r.box.before(f,i);return r.secretbox(c,d,l)},r.box.before=function(c,d){wt(c,d),vl(c,d);var f=new Uint8Array(Es);return Vr(f,c,d),f},r.box.after=r.secretbox,r.box.open=function(c,d,f,i){var l=r.box.before(f,i);return r.secretbox.open(c,d,l)},r.box.open.after=r.secretbox.open,r.box.keyPair=function(){var c=new Uint8Array(co),d=new Uint8Array(uo);return ir(c,d),{publicKey:c,secretKey:d}},r.box.keyPair.fromSecretKey=function(c){if(wt(c),c.length!==uo)throw new Error("bad secret key size");var d=new Uint8Array(co);return Ct(d,c),{publicKey:d,secretKey:new Uint8Array(c)}},r.box.publicKeyLength=co,r.box.secretKeyLength=uo,r.box.sharedKeyLength=Es,r.box.nonceLength=_c,r.box.overheadLength=r.secretbox.overheadLength,r.sign=function(c,d){if(wt(c,d),d.length!==zn)throw new Error("bad secret key size");var f=new Uint8Array(sr+c.length);return Tc(f,c,c.length,d),f},r.sign.open=function(c,d){if(wt(c,d),d.length!==Wr)throw new Error("bad public key size");var f=new Uint8Array(c.length),i=vs(f,c,c.length,d);if(i<0)return null;for(var l=new Uint8Array(i),m=0;m<l.length;m++)l[m]=f[m];return l},r.sign.detached=function(c,d){for(var f=r.sign(c,d),i=new Uint8Array(sr),l=0;l<i.length;l++)i[l]=f[l];return i},r.sign.detached.verify=function(c,d,f){if(wt(c,d,f),d.length!==sr)throw new Error("bad signature size");if(f.length!==Wr)throw new Error("bad public key size");var i=new Uint8Array(sr+c.length),l=new Uint8Array(sr+c.length),m;for(m=0;m<sr;m++)i[m]=d[m];for(m=0;m<c.length;m++)i[m+sr]=c[m];return vs(l,i,i.length,f)>=0},r.sign.keyPair=function(){var c=new Uint8Array(Wr),d=new Uint8Array(zn);return ws(c,d),{publicKey:c,secretKey:d}},r.sign.keyPair.fromSecretKey=function(c){if(wt(c),c.length!==zn)throw new Error("bad secret key size");for(var d=new Uint8Array(Wr),f=0;f<d.length;f++)d[f]=c[32+f];return{publicKey:d,secretKey:new Uint8Array(c)}},r.sign.keyPair.fromSeed=function(c){if(wt(c),c.length!==Cs)throw new Error("bad seed size");for(var d=new Uint8Array(Wr),f=new Uint8Array(zn),i=0;i<32;i++)f[i]=c[i];return ws(d,f,!0),{publicKey:d,secretKey:f}},r.sign.publicKeyLength=Wr,r.sign.secretKeyLength=zn,r.sign.seedLength=Cs,r.sign.signatureLength=sr,r.hash=function(c){wt(c);var d=new Uint8Array(Us);return Qr(d,c,c.length),d},r.hash.hashLength=Us,r.verify=function(c,d){return wt(c,d),c.length===0||d.length===0||c.length!==d.length?!1:z(c,0,d,0,c.length)===0},r.setPRNG=function(c){e=c},function(){var c=typeof self<"u"?self.crypto||self.msCrypto:null;if(c&&c.getRandomValues){var d=65536;r.setPRNG(function(f,i){var l,m=new Uint8Array(i);for(l=0;l<i;l+=d)c.getRandomValues(m.subarray(l,l+Math.min(i-l,d)));for(l=0;l<i;l++)f[l]=m[l];Sc(m)})}else typeof Cc<"u"&&(c=Zc(),c&&c.randomBytes&&r.setPRNG(function(f,i){var l,m=c.randomBytes(i);for(l=0;l<i;l++)f[l]=m[l];Sc(m)}))}()})(typeof wi<"u"&&wi.exports?wi.exports:self.nacl=self.nacl||{})});var ka=Te((Xx,lf)=>{"use strict";lf.exports=function(t,e){return function(){for(var o=new Array(arguments.length),s=0;s<o.length;s++)o[s]=arguments[s];return t.apply(e,o)}}});var ot=Te((Zx,hf)=>{"use strict";var bg=ka(),Ma=Object.prototype.toString,qa=function(r){return function(t){var e=Ma.call(t);return r[e]||(r[e]=e.slice(8,-1).toLowerCase())}}(Object.create(null));function ln(r){return r=r.toLowerCase(),function(e){return qa(e)===r}}function Da(r){return Array.isArray(r)}function Vi(r){return typeof r>"u"}function wg(r){return r!==null&&!Vi(r)&&r.constructor!==null&&!Vi(r.constructor)&&typeof r.constructor.isBuffer=="function"&&r.constructor.isBuffer(r)}var pf=ln("ArrayBuffer");function Tg(r){var t;return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?t=ArrayBuffer.isView(r):t=r&&r.buffer&&pf(r.buffer),t}function _g(r){return typeof r=="string"}function vg(r){return typeof r=="number"}function gf(r){return r!==null&&typeof r=="object"}function Hi(r){if(qa(r)!=="object")return!1;var t=Object.getPrototypeOf(r);return t===null||t===Object.prototype}var Sg=ln("Date"),Eg=ln("File"),Cg=ln("Blob"),Ug=ln("FileList");function Ga(r){return Ma.call(r)==="[object Function]"}function Ig(r){return gf(r)&&Ga(r.pipe)}function Pg(r){var t="[object FormData]";return r&&(typeof FormData=="function"&&r instanceof FormData||Ma.call(r)===t||Ga(r.toString)&&r.toString()===t)}var Rg=ln("URLSearchParams");function Bg(r){return r.trim?r.trim():r.replace(/^\s+|\s+$/g,"")}function Og(){return typeof navigator<"u"&&(navigator.product==="ReactNative"||navigator.product==="NativeScript"||navigator.product==="NS")?!1:typeof window<"u"&&typeof document<"u"}function La(r,t){if(!(r===null||typeof r>"u"))if(typeof r!="object"&&(r=[r]),Da(r))for(var e=0,n=r.length;e<n;e++)t.call(null,r[e],e,r);else for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&t.call(null,r[o],o,r)}function za(){var r={};function t(o,s){Hi(r[s])&&Hi(o)?r[s]=za(r[s],o):Hi(o)?r[s]=za({},o):Da(o)?r[s]=o.slice():r[s]=o}for(var e=0,n=arguments.length;e<n;e++)La(arguments[e],t);return r}function Ng(r,t,e){return La(t,function(o,s){e&&typeof o=="function"?r[s]=bg(o,e):r[s]=o}),r}function kg(r){return r.charCodeAt(0)===65279&&(r=r.slice(1)),r}function zg(r,t,e,n){r.prototype=Object.create(t.prototype,n),r.prototype.constructor=r,e&&Object.assign(r.prototype,e)}function Mg(r,t,e){var n,o,s,a={};t=t||{};do{for(n=Object.getOwnPropertyNames(r),o=n.length;o-- >0;)s=n[o],a[s]||(t[s]=r[s],a[s]=!0);r=Object.getPrototypeOf(r)}while(r&&(!e||e(r,t))&&r!==Object.prototype);return t}function qg(r,t,e){r=String(r),(e===void 0||e>r.length)&&(e=r.length),e-=t.length;var n=r.indexOf(t,e);return n!==-1&&n===e}function Dg(r){if(!r)return null;var t=r.length;if(Vi(t))return null;for(var e=new Array(t);t-- >0;)e[t]=r[t];return e}var Gg=function(r){return function(t){return r&&t instanceof r}}(typeof Uint8Array<"u"&&Object.getPrototypeOf(Uint8Array));hf.exports={isArray:Da,isArrayBuffer:pf,isBuffer:wg,isFormData:Pg,isArrayBufferView:Tg,isString:_g,isNumber:vg,isObject:gf,isPlainObject:Hi,isUndefined:Vi,isDate:Sg,isFile:Eg,isBlob:Cg,isFunction:Ga,isStream:Ig,isURLSearchParams:Rg,isStandardBrowserEnv:Og,forEach:La,merge:za,extend:Ng,trim:Bg,stripBOM:kg,inherits:zg,toFlatObject:Mg,kindOf:qa,kindOfTest:ln,endsWith:qg,toArray:Dg,isTypedArray:Gg,isFileList:Ug}});var Fa=Te((Jx,mf)=>{"use strict";var $n=ot();function yf(r){return encodeURIComponent(r).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}mf.exports=function(t,e,n){if(!e)return t;var o;if(n)o=n(e);else if($n.isURLSearchParams(e))o=e.toString();else{var s=[];$n.forEach(e,function(p,h){p===null||typeof p>"u"||($n.isArray(p)?h=h+"[]":p=[p],$n.forEach(p,function(A){$n.isDate(A)?A=A.toISOString():$n.isObject(A)&&(A=JSON.stringify(A)),s.push(yf(h)+"="+yf(A))}))}),o=s.join("&")}if(o){var a=t.indexOf("#");a!==-1&&(t=t.slice(0,a)),t+=(t.indexOf("?")===-1?"?":"&")+o}return t}});var xf=Te((eb,Af)=>{"use strict";var Lg=ot();function Qi(){this.handlers=[]}Qi.prototype.use=function(t,e,n){return this.handlers.push({fulfilled:t,rejected:e,synchronous:n?n.synchronous:!1,runWhen:n?n.runWhen:null}),this.handlers.length-1};Qi.prototype.eject=function(t){this.handlers[t]&&(this.handlers[t]=null)};Qi.prototype.forEach=function(t){Lg.forEach(this.handlers,function(n){n!==null&&t(n)})};Af.exports=Qi});var wf=Te((tb,bf)=>{"use strict";var Fg=ot();bf.exports=function(t,e){Fg.forEach(t,function(o,s){s!==e&&s.toUpperCase()===e.toUpperCase()&&(t[e]=o,delete t[s])})}});var pn=Te((rb,Sf)=>{"use strict";var Tf=ot();function Hn(r,t,e,n,o){Error.call(this),this.message=r,this.name="AxiosError",t&&(this.code=t),e&&(this.config=e),n&&(this.request=n),o&&(this.response=o)}Tf.inherits(Hn,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:this.config,code:this.code,status:this.response&&this.response.status?this.response.status:null}}});var _f=Hn.prototype,vf={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED"].forEach(function(r){vf[r]={value:r}});Object.defineProperties(Hn,vf);Object.defineProperty(_f,"isAxiosError",{value:!0});Hn.from=function(r,t,e,n,o,s){var a=Object.create(_f);return Tf.toFlatObject(r,a,function(p){return p!==Error.prototype}),Hn.call(a,r.message,t,e,n,o),a.name=r.name,s&&Object.assign(a,s),a};Sf.exports=Hn});var Ka=Te((nb,Ef)=>{"use strict";Ef.exports={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1}});var $a=Te((ob,Cf)=>{"use strict";var Ht=ot();function Kg(r,t){t=t||new FormData;var e=[];function n(s){return s===null?"":Ht.isDate(s)?s.toISOString():Ht.isArrayBuffer(s)||Ht.isTypedArray(s)?typeof Blob=="function"?new Blob([s]):Buffer.from(s):s}function o(s,a){if(Ht.isPlainObject(s)||Ht.isArray(s)){if(e.indexOf(s)!==-1)throw Error("Circular reference detected in "+a);e.push(s),Ht.forEach(s,function(p,h){if(!Ht.isUndefined(p)){var y=a?a+"."+h:h,A;if(p&&!a&&typeof p=="object"){if(Ht.endsWith(h,"{}"))p=JSON.stringify(p);else if(Ht.endsWith(h,"[]")&&(A=Ht.toArray(p))){A.forEach(function(_){!Ht.isUndefined(_)&&t.append(y,n(_))});return}}o(p,y)}}),e.pop()}else t.append(a,n(s))}return o(r),t}Cf.exports=Kg});var If=Te((ib,Uf)=>{"use strict";var Ha=pn();Uf.exports=function(t,e,n){var o=n.config.validateStatus;!n.status||!o||o(n.status)?t(n):e(new Ha("Request failed with status code "+n.status,[Ha.ERR_BAD_REQUEST,Ha.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}});var Rf=Te((sb,Pf)=>{"use strict";var Wi=ot();Pf.exports=Wi.isStandardBrowserEnv()?function(){return{write:function(e,n,o,s,a,u){var p=[];p.push(e+"="+encodeURIComponent(n)),Wi.isNumber(o)&&p.push("expires="+new Date(o).toGMTString()),Wi.isString(s)&&p.push("path="+s),Wi.isString(a)&&p.push("domain="+a),u===!0&&p.push("secure"),document.cookie=p.join("; ")},read:function(e){var n=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return n?decodeURIComponent(n[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}}():function(){return{write:function(){},read:function(){return null},remove:function(){}}}()});var Of=Te((ab,Bf)=>{"use strict";Bf.exports=function(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}});var kf=Te((cb,Nf)=>{"use strict";Nf.exports=function(t,e){return e?t.replace(/\/+$/,"")+"/"+e.replace(/^\/+/,""):t}});var Va=Te((ub,zf)=>{"use strict";var $g=Of(),Hg=kf();zf.exports=function(t,e){return t&&!$g(e)?Hg(t,e):e}});var qf=Te((fb,Mf)=>{"use strict";var Qa=ot(),Vg=["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"];Mf.exports=function(t){var e={},n,o,s;return t&&Qa.forEach(t.split(`
|
|
2
|
+
`),function(u){if(s=u.indexOf(":"),n=Qa.trim(u.substr(0,s)).toLowerCase(),o=Qa.trim(u.substr(s+1)),n){if(e[n]&&Vg.indexOf(n)>=0)return;n==="set-cookie"?e[n]=(e[n]?e[n]:[]).concat([o]):e[n]=e[n]?e[n]+", "+o:o}}),e}});var Lf=Te((db,Gf)=>{"use strict";var Df=ot();Gf.exports=Df.isStandardBrowserEnv()?function(){var t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a"),n;function o(s){var a=s;return t&&(e.setAttribute("href",a),a=e.href),e.setAttribute("href",a),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:e.pathname.charAt(0)==="/"?e.pathname:"/"+e.pathname}}return n=o(window.location.href),function(a){var u=Df.isString(a)?o(a):a;return u.protocol===n.protocol&&u.host===n.host}}():function(){return function(){return!0}}()});var So=Te((lb,Kf)=>{"use strict";var Wa=pn(),Qg=ot();function Ff(r){Wa.call(this,r??"canceled",Wa.ERR_CANCELED),this.name="CanceledError"}Qg.inherits(Ff,Wa,{__CANCEL__:!0});Kf.exports=Ff});var Hf=Te((pb,$f)=>{"use strict";$f.exports=function(t){var e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}});var ja=Te((gb,Vf)=>{"use strict";var Eo=ot(),Wg=If(),jg=Rf(),Yg=Fa(),Xg=Va(),Zg=qf(),Jg=Lf(),eh=Ka(),xr=pn(),th=So(),rh=Hf();Vf.exports=function(t){return new Promise(function(n,o){var s=t.data,a=t.headers,u=t.responseType,p;function h(){t.cancelToken&&t.cancelToken.unsubscribe(p),t.signal&&t.signal.removeEventListener("abort",p)}Eo.isFormData(s)&&Eo.isStandardBrowserEnv()&&delete a["Content-Type"];var y=new XMLHttpRequest;if(t.auth){var A=t.auth.username||"",_=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";a.Authorization="Basic "+btoa(A+":"+_)}var T=Xg(t.baseURL,t.url);y.open(t.method.toUpperCase(),Yg(T,t.params,t.paramsSerializer),!0),y.timeout=t.timeout;function z(){if(y){var B="getAllResponseHeaders"in y?Zg(y.getAllResponseHeaders()):null,H=!u||u==="text"||u==="json"?y.responseText:y.response,k={data:H,status:y.status,statusText:y.statusText,headers:B,config:t,request:y};Wg(function(L){n(L),h()},function(L){o(L),h()},k),y=null}}if("onloadend"in y?y.onloadend=z:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(z)},y.onabort=function(){y&&(o(new xr("Request aborted",xr.ECONNABORTED,t,y)),y=null)},y.onerror=function(){o(new xr("Network Error",xr.ERR_NETWORK,t,y,y)),y=null},y.ontimeout=function(){var H=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded",k=t.transitional||eh;t.timeoutErrorMessage&&(H=t.timeoutErrorMessage),o(new xr(H,k.clarifyTimeoutError?xr.ETIMEDOUT:xr.ECONNABORTED,t,y)),y=null},Eo.isStandardBrowserEnv()){var S=(t.withCredentials||Jg(T))&&t.xsrfCookieName?jg.read(t.xsrfCookieName):void 0;S&&(a[t.xsrfHeaderName]=S)}"setRequestHeader"in y&&Eo.forEach(a,function(H,k){typeof s>"u"&&k.toLowerCase()==="content-type"?delete a[k]:y.setRequestHeader(k,H)}),Eo.isUndefined(t.withCredentials)||(y.withCredentials=!!t.withCredentials),u&&u!=="json"&&(y.responseType=t.responseType),typeof t.onDownloadProgress=="function"&&y.addEventListener("progress",t.onDownloadProgress),typeof t.onUploadProgress=="function"&&y.upload&&y.upload.addEventListener("progress",t.onUploadProgress),(t.cancelToken||t.signal)&&(p=function(B){y&&(o(!B||B&&B.type?new th:B),y.abort(),y=null)},t.cancelToken&&t.cancelToken.subscribe(p),t.signal&&(t.signal.aborted?p():t.signal.addEventListener("abort",p))),s||(s=null);var P=rh(T);if(P&&["http","https","file"].indexOf(P)===-1){o(new xr("Unsupported protocol "+P+":",xr.ERR_BAD_REQUEST,t));return}y.send(s)})}});var Wf=Te((hb,Qf)=>{"use strict";Qf.exports=null});var Yi=Te((yb,Zf)=>{"use strict";var it=ot(),jf=wf(),Yf=pn(),nh=Ka(),oh=$a(),ih={"Content-Type":"application/x-www-form-urlencoded"};function Xf(r,t){!it.isUndefined(r)&&it.isUndefined(r["Content-Type"])&&(r["Content-Type"]=t)}function sh(){var r;return typeof XMLHttpRequest<"u"?r=ja():typeof process<"u"&&Object.prototype.toString.call(process)==="[object process]"&&(r=ja()),r}function ah(r,t,e){if(it.isString(r))try{return(t||JSON.parse)(r),it.trim(r)}catch(n){if(n.name!=="SyntaxError")throw n}return(e||JSON.stringify)(r)}var ji={transitional:nh,adapter:sh(),transformRequest:[function(t,e){if(jf(e,"Accept"),jf(e,"Content-Type"),it.isFormData(t)||it.isArrayBuffer(t)||it.isBuffer(t)||it.isStream(t)||it.isFile(t)||it.isBlob(t))return t;if(it.isArrayBufferView(t))return t.buffer;if(it.isURLSearchParams(t))return Xf(e,"application/x-www-form-urlencoded;charset=utf-8"),t.toString();var n=it.isObject(t),o=e&&e["Content-Type"],s;if((s=it.isFileList(t))||n&&o==="multipart/form-data"){var a=this.env&&this.env.FormData;return oh(s?{"files[]":t}:t,a&&new a)}else if(n||o==="application/json")return Xf(e,"application/json"),ah(t);return t}],transformResponse:[function(t){var e=this.transitional||ji.transitional,n=e&&e.silentJSONParsing,o=e&&e.forcedJSONParsing,s=!n&&this.responseType==="json";if(s||o&&it.isString(t)&&t.length)try{return JSON.parse(t)}catch(a){if(s)throw a.name==="SyntaxError"?Yf.from(a,Yf.ERR_BAD_RESPONSE,this,null,this.response):a}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Wf()},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};it.forEach(["delete","get","head"],function(t){ji.headers[t]={}});it.forEach(["post","put","patch"],function(t){ji.headers[t]=it.merge(ih)});Zf.exports=ji});var ed=Te((mb,Jf)=>{"use strict";var ch=ot(),uh=Yi();Jf.exports=function(t,e,n){var o=this||uh;return ch.forEach(n,function(a){t=a.call(o,t,e)}),t}});var Ya=Te((Ab,td)=>{"use strict";td.exports=function(t){return!!(t&&t.__CANCEL__)}});var od=Te((xb,nd)=>{"use strict";var rd=ot(),Xa=ed(),fh=Ya(),dh=Yi(),lh=So();function Za(r){if(r.cancelToken&&r.cancelToken.throwIfRequested(),r.signal&&r.signal.aborted)throw new lh}nd.exports=function(t){Za(t),t.headers=t.headers||{},t.data=Xa.call(t,t.data,t.headers,t.transformRequest),t.headers=rd.merge(t.headers.common||{},t.headers[t.method]||{},t.headers),rd.forEach(["delete","get","head","post","put","patch","common"],function(o){delete t.headers[o]});var e=t.adapter||dh.adapter;return e(t).then(function(o){return Za(t),o.data=Xa.call(t,o.data,o.headers,t.transformResponse),o},function(o){return fh(o)||(Za(t),o&&o.response&&(o.response.data=Xa.call(t,o.response.data,o.response.headers,t.transformResponse))),Promise.reject(o)})}});var Ja=Te((bb,id)=>{"use strict";var Et=ot();id.exports=function(t,e){e=e||{};var n={};function o(y,A){return Et.isPlainObject(y)&&Et.isPlainObject(A)?Et.merge(y,A):Et.isPlainObject(A)?Et.merge({},A):Et.isArray(A)?A.slice():A}function s(y){if(Et.isUndefined(e[y])){if(!Et.isUndefined(t[y]))return o(void 0,t[y])}else return o(t[y],e[y])}function a(y){if(!Et.isUndefined(e[y]))return o(void 0,e[y])}function u(y){if(Et.isUndefined(e[y])){if(!Et.isUndefined(t[y]))return o(void 0,t[y])}else return o(void 0,e[y])}function p(y){if(y in e)return o(t[y],e[y]);if(y in t)return o(void 0,t[y])}var h={url:a,method:a,data:a,baseURL:u,transformRequest:u,transformResponse:u,paramsSerializer:u,timeout:u,timeoutMessage:u,withCredentials:u,adapter:u,responseType:u,xsrfCookieName:u,xsrfHeaderName:u,onUploadProgress:u,onDownloadProgress:u,decompress:u,maxContentLength:u,maxBodyLength:u,beforeRedirect:u,transport:u,httpAgent:u,httpsAgent:u,cancelToken:u,socketPath:u,responseEncoding:u,validateStatus:p};return Et.forEach(Object.keys(t).concat(Object.keys(e)),function(A){var _=h[A]||s,T=_(A);Et.isUndefined(T)&&_!==p||(n[A]=T)}),n}});var ec=Te((wb,sd)=>{"use strict";sd.exports={version:"0.27.2"}});var ud=Te((Tb,cd)=>{"use strict";var ph=ec().version,Fr=pn(),tc={};["object","boolean","number","function","string","symbol"].forEach(function(r,t){tc[r]=function(n){return typeof n===r||"a"+(t<1?"n ":" ")+r}});var ad={};tc.transitional=function(t,e,n){function o(s,a){return"[Axios v"+ph+"] Transitional option '"+s+"'"+a+(n?". "+n:"")}return function(s,a,u){if(t===!1)throw new Fr(o(a," has been removed"+(e?" in "+e:"")),Fr.ERR_DEPRECATED);return e&&!ad[a]&&(ad[a]=!0,console.warn(o(a," has been deprecated since v"+e+" and will be removed in the near future"))),t?t(s,a,u):!0}};function gh(r,t,e){if(typeof r!="object")throw new Fr("options must be an object",Fr.ERR_BAD_OPTION_VALUE);for(var n=Object.keys(r),o=n.length;o-- >0;){var s=n[o],a=t[s];if(a){var u=r[s],p=u===void 0||a(u,s,r);if(p!==!0)throw new Fr("option "+s+" must be "+p,Fr.ERR_BAD_OPTION_VALUE);continue}if(e!==!0)throw new Fr("Unknown option "+s,Fr.ERR_BAD_OPTION)}}cd.exports={assertOptions:gh,validators:tc}});var hd=Te((_b,gd)=>{"use strict";var ld=ot(),hh=Fa(),fd=xf(),dd=od(),Xi=Ja(),yh=Va(),pd=ud(),Vn=pd.validators;function Qn(r){this.defaults=r,this.interceptors={request:new fd,response:new fd}}Qn.prototype.request=function(t,e){typeof t=="string"?(e=e||{},e.url=t):e=t||{},e=Xi(this.defaults,e),e.method?e.method=e.method.toLowerCase():this.defaults.method?e.method=this.defaults.method.toLowerCase():e.method="get";var n=e.transitional;n!==void 0&&pd.assertOptions(n,{silentJSONParsing:Vn.transitional(Vn.boolean),forcedJSONParsing:Vn.transitional(Vn.boolean),clarifyTimeoutError:Vn.transitional(Vn.boolean)},!1);var o=[],s=!0;this.interceptors.request.forEach(function(T){typeof T.runWhen=="function"&&T.runWhen(e)===!1||(s=s&&T.synchronous,o.unshift(T.fulfilled,T.rejected))});var a=[];this.interceptors.response.forEach(function(T){a.push(T.fulfilled,T.rejected)});var u;if(!s){var p=[dd,void 0];for(Array.prototype.unshift.apply(p,o),p=p.concat(a),u=Promise.resolve(e);p.length;)u=u.then(p.shift(),p.shift());return u}for(var h=e;o.length;){var y=o.shift(),A=o.shift();try{h=y(h)}catch(_){A(_);break}}try{u=dd(h)}catch(_){return Promise.reject(_)}for(;a.length;)u=u.then(a.shift(),a.shift());return u};Qn.prototype.getUri=function(t){t=Xi(this.defaults,t);var e=yh(t.baseURL,t.url);return hh(e,t.params,t.paramsSerializer)};ld.forEach(["delete","get","head","options"],function(t){Qn.prototype[t]=function(e,n){return this.request(Xi(n||{},{method:t,url:e,data:(n||{}).data}))}});ld.forEach(["post","put","patch"],function(t){function e(n){return function(s,a,u){return this.request(Xi(u||{},{method:t,headers:n?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}Qn.prototype[t]=e(),Qn.prototype[t+"Form"]=e(!0)});gd.exports=Qn});var md=Te((vb,yd)=>{"use strict";var mh=So();function Wn(r){if(typeof r!="function")throw new TypeError("executor must be a function.");var t;this.promise=new Promise(function(o){t=o});var e=this;this.promise.then(function(n){if(e._listeners){var o,s=e._listeners.length;for(o=0;o<s;o++)e._listeners[o](n);e._listeners=null}}),this.promise.then=function(n){var o,s=new Promise(function(a){e.subscribe(a),o=a}).then(n);return s.cancel=function(){e.unsubscribe(o)},s},r(function(o){e.reason||(e.reason=new mh(o),t(e.reason))})}Wn.prototype.throwIfRequested=function(){if(this.reason)throw this.reason};Wn.prototype.subscribe=function(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]};Wn.prototype.unsubscribe=function(t){if(this._listeners){var e=this._listeners.indexOf(t);e!==-1&&this._listeners.splice(e,1)}};Wn.source=function(){var t,e=new Wn(function(o){t=o});return{token:e,cancel:t}};yd.exports=Wn});var xd=Te((Sb,Ad)=>{"use strict";Ad.exports=function(t){return function(n){return t.apply(null,n)}}});var wd=Te((Eb,bd)=>{"use strict";var Ah=ot();bd.exports=function(t){return Ah.isObject(t)&&t.isAxiosError===!0}});var vd=Te((Cb,rc)=>{"use strict";var Td=ot(),xh=ka(),Zi=hd(),bh=Ja(),wh=Yi();function _d(r){var t=new Zi(r),e=xh(Zi.prototype.request,t);return Td.extend(e,Zi.prototype,t),Td.extend(e,t),e.create=function(o){return _d(bh(r,o))},e}var At=_d(wh);At.Axios=Zi;At.CanceledError=So();At.CancelToken=md();At.isCancel=Ya();At.VERSION=ec().version;At.toFormData=$a();At.AxiosError=pn();At.Cancel=At.CanceledError;At.all=function(t){return Promise.all(t)};At.spread=xd();At.isAxiosError=wd();rc.exports=At;rc.exports.default=At});var Ed=Te((Ub,Sd)=>{"use strict";Sd.exports=vd()});var qh={};Uc(qh,{APTOS_BIP44_REGEX:()=>au,APTOS_COIN:()=>yo,APTOS_HARDENED_REGEX:()=>su,Account:()=>Ar,AccountAddress:()=>N,AccountAuthenticator:()=>xt,AccountAuthenticatorEd25519:()=>er,AccountAuthenticatorMultiEd25519:()=>Io,AccountAuthenticatorMultiKey:()=>gn,AccountAuthenticatorSingleKey:()=>Vt,AccountAuthenticatorVariant:()=>Os,AccountSequenceNumber:()=>jo,AddressInvalidReason:()=>$c,AnyPublicKey:()=>Me,AnyPublicKeyVariant:()=>Ns,AnySignature:()=>Zt,AnySignatureVariant:()=>ks,Aptos:()=>st,AptosApiError:()=>Wt,AptosApiType:()=>go,AptosConfig:()=>Co,AuthenticationKey:()=>$t,Bool:()=>Fe,CKDPriv:()=>sa,ChainId:()=>xn,DEFAULT_MAX_GAS_AMOUNT:()=>Gs,DEFAULT_NETWORK:()=>Ds,DEFAULT_TXN_EXP_SEC_FROM_NOW:()=>Ls,DEFAULT_TXN_TIMEOUT_SEC:()=>ho,DeriveScheme:()=>kc,Deserializer:()=>ea,Ed25519PrivateKey:()=>lr,Ed25519PublicKey:()=>Be,Ed25519Signature:()=>Ke,EntryFunction:()=>Pn,EntryFunctionBytes:()=>xo,FeePayerRawTransaction:()=>or,FixedBytes:()=>Ur,HARDENED_OFFSET:()=>na,Hex:()=>me,HexInvalidReason:()=>Fc,Identifier:()=>qe,KeyType:()=>cu,MimeType:()=>si,ModuleId:()=>jn,MoveAbility:()=>Oc,MoveFunctionVisibility:()=>Bc,MoveOption:()=>dr,MoveString:()=>Ze,MoveVector:()=>Ie,MultiAgentRawTransaction:()=>nr,MultiEd25519PublicKey:()=>Kt,MultiEd25519Signature:()=>sn,MultiKey:()=>dn,MultiSig:()=>eo,MultisigTransactionPayload:()=>to,Network:()=>po,NetworkToChainId:()=>ui,NetworkToFaucetAPI:()=>qs,NetworkToIndexerAPI:()=>ci,NetworkToNetworkName:()=>Gl,NetworkToNodeAPI:()=>Ms,ParsingError:()=>pt,PrivateKey:()=>nn,ProcessorType:()=>jr,PublicKey:()=>_t,RAW_TRANSACTION_SALT:()=>Fs,RAW_TRANSACTION_WITH_DATA_SALT:()=>fi,RawTransaction:()=>zt,RawTransactionWithData:()=>Ro,RoleType:()=>Nc,RotationProofChallenge:()=>Uo,Script:()=>Jn,ScriptTransactionArgumentVariants:()=>Mn,Secp256k1PrivateKey:()=>hr,Secp256k1PublicKey:()=>kt,Secp256k1Signature:()=>yr,Serializable:()=>Z,Serializer:()=>Gt,Signature:()=>Ft,SignedTransaction:()=>Qt,SigningScheme:()=>qn,SigningSchemeInput:()=>zs,StructTag:()=>rr,TransactionAuthenticator:()=>tr,TransactionAuthenticatorEd25519:()=>hn,TransactionAuthenticatorFeePayer:()=>mn,TransactionAuthenticatorMultiAgent:()=>yn,TransactionAuthenticatorMultiEd25519:()=>Ji,TransactionAuthenticatorSingleSender:()=>An,TransactionAuthenticatorVariant:()=>Bs,TransactionPayload:()=>$r,TransactionPayloadEntryFunction:()=>Xn,TransactionPayloadMultisig:()=>Zn,TransactionPayloadScript:()=>Yn,TransactionPayloadVariants:()=>Ps,TransactionResponseType:()=>ai,TransactionVariants:()=>Rs,TransactionWorker:()=>Yo,TypeTag:()=>He,TypeTagAddress:()=>Cn,TypeTagBool:()=>bn,TypeTagGeneric:()=>Un,TypeTagParserError:()=>ke,TypeTagParserErrorType:()=>Bd,TypeTagReference:()=>Po,TypeTagSigner:()=>Kr,TypeTagStruct:()=>br,TypeTagU128:()=>Sn,TypeTagU16:()=>Tn,TypeTagU256:()=>En,TypeTagU32:()=>_n,TypeTagU64:()=>vn,TypeTagU8:()=>wn,TypeTagVariants:()=>Is,TypeTagVector:()=>In,U128:()=>Pt,U16:()=>Ut,U256:()=>Rt,U32:()=>It,U64:()=>rt,U8:()=>ct,aptosCoinStructTag:()=>Th,aptosRequest:()=>lo,buildTransaction:()=>ls,checkOrConvertArgument:()=>ko,convertArgument:()=>uc,deriveKey:()=>vi,deriveTransactionType:()=>pc,deserializeFromScriptArgument:()=>Id,ensureBoolean:()=>yi,fetchEntryFunctionAbi:()=>cc,findFirstNonSignerArg:()=>sc,generateMultiSignersSignedTransaction:()=>Md,generateRawTransaction:()=>zd,generateSignedTransaction:()=>lc,generateSignedTransactionForSimulation:()=>fc,generateSigningMessage:()=>ps,generateTransactionPayload:()=>Mo,generateTransactionPayloadWithABI:()=>Nd,get:()=>Ks,getAptosFullNode:()=>Tt,getAuthenticatorForSimulation:()=>zo,getFunctionParts:()=>ds,isBcsAddress:()=>No,isBcsBool:()=>rs,isBcsFixedBytes:()=>Od,isBcsString:()=>ns,isBcsU128:()=>cs,isBcsU16:()=>is,isBcsU256:()=>us,isBcsU32:()=>ss,isBcsU64:()=>as,isBcsU8:()=>os,isBlockMetadataTransactionResponse:()=>Ol,isBool:()=>nc,isEd25519Signature:()=>kl,isEncodedEntryFunctionArgument:()=>ic,isFeePayerSignature:()=>ql,isGenesisTransactionResponse:()=>Bl,isLargeNumber:()=>Oo,isMultiAgentSignature:()=>Ml,isMultiEd25519Signature:()=>Dl,isNull:()=>oc,isNumber:()=>Bo,isPendingTransactionResponse:()=>Pl,isScriptDataInput:()=>fs,isSecp256k1Signature:()=>zl,isStateCheckpointTransactionResponse:()=>Nl,isString:()=>Rn,isUserTransactionResponse:()=>Rl,isValidBIP44Path:()=>oa,isValidHardenedPath:()=>ia,mnemonicToSeed:()=>wo,objectStructTag:()=>Sh,optionStructTag:()=>vh,outOfRangeErrorMessage:()=>Kc,paginateWithCursor:()=>Yr,parseTypeTag:()=>ts,post:()=>di,postAptosFaucet:()=>Hs,postAptosFullNode:()=>Xr,postAptosIndexer:()=>$s,request:()=>Mc,sign:()=>dc,splitPath:()=>aa,standardizeTypeTags:()=>ac,stringStructTag:()=>_h,throwTypeMismatch:()=>ze,validateNumberInRange:()=>cr});var Wt=class extends Error{constructor(e,n,o){super(o);this.name="AptosApiError",this.url=n.url,this.status=n.status,this.statusText=n.statusText,this.data=n.data,this.request=e}};var Rc="0.0.8";var si=(n=>(n.JSON="application/json",n.BCS="application/x-bcs",n.BCS_SIGNED_TRANSACTION="application/x.aptos.signed_transaction+bcs",n))(si||{}),Is=(T=>(T[T.Bool=0]="Bool",T[T.U8=1]="U8",T[T.U64=2]="U64",T[T.U128=3]="U128",T[T.Address=4]="Address",T[T.Signer=5]="Signer",T[T.Vector=6]="Vector",T[T.Struct=7]="Struct",T[T.U16=8]="U16",T[T.U32=9]="U32",T[T.U256=10]="U256",T[T.Reference=254]="Reference",T[T.Generic=255]="Generic",T))(Is||{}),Mn=(h=>(h[h.U8=0]="U8",h[h.U64=1]="U64",h[h.U128=2]="U128",h[h.Address=3]="Address",h[h.U8Vector=4]="U8Vector",h[h.Bool=5]="Bool",h[h.U16=6]="U16",h[h.U32=7]="U32",h[h.U256=8]="U256",h))(Mn||{}),Ps=(n=>(n[n.Script=0]="Script",n[n.EntryFunction=2]="EntryFunction",n[n.Multisig=3]="Multisig",n))(Ps||{}),Rs=(e=>(e[e.MultiAgentTransaction=0]="MultiAgentTransaction",e[e.FeePayerTransaction=1]="FeePayerTransaction",e))(Rs||{}),Bs=(s=>(s[s.Ed25519=0]="Ed25519",s[s.MultiEd25519=1]="MultiEd25519",s[s.MultiAgent=2]="MultiAgent",s[s.FeePayer=3]="FeePayer",s[s.SingleSender=4]="SingleSender",s))(Bs||{}),Os=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(Os||{}),Ns=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(Ns||{}),ks=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1=1]="Secp256k1",e))(ks||{}),ai=(s=>(s.Pending="pending_transaction",s.User="user_transaction",s.Genesis="genesis_transaction",s.BlockMetadata="block_metadata_transaction",s.StateCheckpoint="state_checkpoint_transaction",s))(ai||{});function Pl(r){return r.type==="pending_transaction"}function Rl(r){return r.type==="user_transaction"}function Bl(r){return r.type==="genesis_transaction"}function Ol(r){return r.type==="block_metadata_transaction"}function Nl(r){return r.type==="state_checkpoint_transaction"}function kl(r){return"signature"in r&&r.signature==="ed25519_signature"}function zl(r){return"signature"in r&&r.signature==="secp256k1_ecdsa_signature"}function Ml(r){return r.type==="multi_agent_signature"}function ql(r){return r.type==="fee_payer_signature"}function Dl(r){return r.type==="multi_ed25519_signature"}var Bc=(n=>(n.PRIVATE="private",n.PUBLIC="public",n.FRIEND="friend",n))(Bc||{}),Oc=(o=>(o.STORE="store",o.DROP="drop",o.KEY="key",o.COPY="copy",o))(Oc||{}),Nc=(e=>(e.VALIDATOR="validator",e.FULL_NODE="full_node",e))(Nc||{}),qn=(o=>(o[o.Ed25519=0]="Ed25519",o[o.MultiEd25519=1]="MultiEd25519",o[o.SingleKey=2]="SingleKey",o[o.MultiKey=3]="MultiKey",o))(qn||{}),zs=(e=>(e[e.Ed25519=0]="Ed25519",e[e.Secp256k1Ecdsa=2]="Secp256k1Ecdsa",e))(zs||{}),kc=(s=>(s[s.DeriveAuid=251]="DeriveAuid",s[s.DeriveObjectAddressFromObject=252]="DeriveObjectAddressFromObject",s[s.DeriveObjectAddressFromGuid=253]="DeriveObjectAddressFromGuid",s[s.DeriveObjectAddressFromSeed=254]="DeriveObjectAddressFromSeed",s[s.DeriveResourceAccountAddress=255]="DeriveResourceAccountAddress",s))(kc||{});var zc={400:"Bad Request",401:"Unauthorized",403:"Forbidden",404:"Not Found",429:"Too Many Requests",500:"Internal Server Error",502:"Bad Gateway",503:"Service Unavailable"};async function Mc(r,t){let{url:e,method:n,body:o,contentType:s,params:a,overrides:u}=r,p={...u?.HEADERS,"x-aptos-client":`aptos-ts-sdk/${Rc}`,"content-type":s??"application/json"};return u?.AUTH_TOKEN&&e.includes("faucet")&&(p.Authorization=`Bearer ${u?.AUTH_TOKEN}`),u?.API_KEY&&!e.includes("faucet")&&(p.Authorization=`Bearer ${u?.API_KEY}`),t.provider({url:e,method:n,body:o,params:a,headers:p,overrides:u})}async function lo(r,t){let{url:e,path:n}=r,o=`${e}/${n??""}`,s=await Mc({...r,url:o},t.client),a={status:s.status,statusText:s.statusText,data:s.data,headers:s.headers,config:s.config,request:s.request,url:o};if(t.isIndexerRequest(e)){let p=a.data;if(p.errors)throw new Wt(r,a,p.errors[0].message??`Unhandled Error ${s.status} : ${s.statusText}`);a.data=p.data}if(a.status>=200&&a.status<300)return a;let u;throw a&&a.data&&"message"in a.data&&"error_code"in a.data?u=JSON.stringify(a.data):a.status in zc?u=zc[a.status]:u=`Unhandled Error ${a.status} : ${a.statusText}`,new Wt(r,a,u)}var ci={mainnet:"https://indexer.mainnet.aptoslabs.com/v1/graphql",testnet:"https://indexer-testnet.staging.gcp.aptosdev.com/v1/graphql",devnet:"https://indexer-devnet.staging.gcp.aptosdev.com/v1/graphql",local:"http://127.0.0.1:8090/v1/graphql"},Ms={mainnet:"https://fullnode.mainnet.aptoslabs.com/v1",testnet:"https://fullnode.testnet.aptoslabs.com/v1",devnet:"https://fullnode.devnet.aptoslabs.com/v1",local:"http://127.0.0.1:8080/v1"},qs={mainnet:"https://faucet.mainnet.aptoslabs.com",testnet:"https://faucet.testnet.aptoslabs.com",devnet:"https://faucet.devnet.aptoslabs.com",local:"http://127.0.0.1:8081"},po=(s=>(s.MAINNET="mainnet",s.TESTNET="testnet",s.DEVNET="devnet",s.LOCAL="local",s.CUSTOM="custom",s))(po||{}),ui={mainnet:1,testnet:2},Gl={mainnet:"mainnet",testnet:"testnet",devnet:"devnet",local:"local",custom:"custom"};var go=(n=>(n[n.FULLNODE=0]="FULLNODE",n[n.INDEXER=1]="INDEXER",n[n.FAUCET=2]="FAUCET",n))(go||{}),Ds="devnet",Gs=2e5,Ls=20,ho=20,yo="0x1::aptos_coin::AptosCoin",Fs="APTOS::RawTransaction",fi="APTOS::RawTransactionWithData",jr=(h=>(h.ACCOUNT_TRANSACTION_PROCESSOR="account_transactions_processor",h.COIN_PROCESSOR="coin_processor",h.DEFAULT="default_processor",h.EVENTS_PROCESSOR="events_processor",h.FUNGIBLE_ASSET_PROCESSOR="fungible_asset_processor",h.STAKE_PROCESSOR="stake_processor",h.TOKEN_PROCESSOR="token_processor",h.TOKEN_V2_PROCESSOR="token_v2_processor",h.USER_TRANSACTION_PROCESSOR="user_transaction_processor",h))(jr||{});async function Ks(r){let{aptosConfig:t,overrides:e,params:n,contentType:o,acceptType:s,path:a,originMethod:u,type:p}=r,h=t.getRequestUrl(p);return lo({url:h,method:"GET",originMethod:u,path:a,contentType:o?.valueOf(),acceptType:s?.valueOf(),params:n,overrides:{...t.clientConfig,...e}},t)}async function Tt(r){return Ks({...r,type:0})}async function Yr(r){let t=[],e,n=r.params;for(;;){n.start=e;let o=await Ks({type:0,aptosConfig:r.aptosConfig,originMethod:r.originMethod,path:r.path,params:n,overrides:r.overrides});if(e=o.headers["x-aptos-cursor"],delete o.headers,t.push(...o.data),e==null)break}return t}async function di(r){let{type:t,originMethod:e,path:n,body:o,acceptType:s,contentType:a,params:u,aptosConfig:p,overrides:h}=r,y=p.getRequestUrl(t);return lo({url:y,method:"POST",originMethod:e,path:n,body:o,contentType:a?.valueOf(),acceptType:s?.valueOf(),params:u,overrides:{...p.clientConfig,...h}},p)}async function Xr(r){return di({...r,type:0})}async function $s(r){return di({...r,type:1})}async function Hs(r){return di({...r,type:2})}var li=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;var Vs=r=>r instanceof Uint8Array;var qc=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),jt=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),qt=(r,t)=>r<<32-t|r>>>t,Ll=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Ll)throw new Error("Non little-endian hardware is not supported");var Fl=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function Zr(r){if(!Vs(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Fl[r[e]];return t}function Dn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),a=Number.parseInt(s,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");e[n]=a}return e}function Qs(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Dt(r){if(typeof r=="string"&&(r=Qs(r)),!Vs(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Jr(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!Vs(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}var Sr=class{clone(){return this._cloneInto()}},Kl={}.toString;function Dc(r,t){if(t!==void 0&&Kl.call(t)!=="[object Object]")throw new Error("Options should be object or undefined");return Object.assign(r,t)}function Er(r){let t=n=>r().update(Dt(n)).digest(),e=r();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>r(),t}function Gc(r){let t=(n,o)=>r(o).update(Dt(n)).digest(),e=r({});return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=n=>r(n),t}function Lc(r=32){if(li&&typeof li.getRandomValues=="function")return li.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var pi=2**8-1,gi=2**16-1,ar=2**32-1,en=BigInt(2)**BigInt(64)-BigInt(1),mo=BigInt(2)**BigInt(128)-BigInt(1),hi=BigInt(2)**BigInt(256)-BigInt(1);var pt=class extends Error{constructor(e,n){super(e);this.invalidReason=n}};var Fc=(n=>(n.TOO_SHORT="too_short",n.INVALID_LENGTH="invalid_length",n.INVALID_HEX_CHARS="invalid_hex_chars",n))(Fc||{}),me=class r{constructor(t){this.data=t}toUint8Array(){return this.data}toStringWithoutPrefix(){return Zr(this.data)}toString(){return`0x${this.toStringWithoutPrefix()}`}static fromString(t){let e=t;if(e.startsWith("0x")&&(e=e.slice(2)),e.length===0)throw new pt("Hex string is too short, must be at least 1 char long, excluding the optional leading 0x.","too_short");if(e.length%2!==0)throw new pt("Hex string must be an even number of hex characters.","invalid_length");try{return new r(Dn(e))}catch(n){throw new pt(`Hex string contains invalid hex characters: ${n?.message}`,"invalid_hex_chars")}}static fromHexInput(t){return t instanceof Uint8Array?new r(t):r.fromString(t)}static isValid(t){try{return r.fromString(t),{valid:!0}}catch(e){return{valid:!1,invalidReason:e?.invalidReason,invalidReasonMessage:e?.message}}}equals(t){return this.data.length!==t.data.length?!1:this.data.every((e,n)=>e===t.data[n])}};var Z=class{bcsToBytes(){let t=new Gt;return this.serialize(t),t.toUint8Array()}bcsToHex(){let t=this.bcsToBytes();return me.fromHexInput(t)}},Gt=class{constructor(t=64){if(t<=0)throw new Error("Length needs to be greater than 0");this.buffer=new ArrayBuffer(t),this.offset=0}ensureBufferWillHandleSize(t){for(;this.buffer.byteLength<this.offset+t;){let e=new ArrayBuffer(this.buffer.byteLength*2);new Uint8Array(e).set(new Uint8Array(this.buffer)),this.buffer=e}}appendToBuffer(t){this.ensureBufferWillHandleSize(t.length),new Uint8Array(this.buffer,this.offset).set(t),this.offset+=t.length}serializeWithFunction(t,e,n){this.ensureBufferWillHandleSize(e);let o=new DataView(this.buffer,this.offset);t.apply(o,[0,n,!0]),this.offset+=e}serializeStr(t){let e=new TextEncoder;this.serializeBytes(e.encode(t))}serializeBytes(t){this.serializeU32AsUleb128(t.length),this.appendToBuffer(t)}serializeFixedBytes(t){this.appendToBuffer(t)}serializeBool(t){yi(t);let e=t?1:0;this.appendToBuffer(new Uint8Array([e]))}serializeU8(t){this.appendToBuffer(new Uint8Array([t]))}serializeU16(t){this.serializeWithFunction(DataView.prototype.setUint16,2,t)}serializeU32(t){this.serializeWithFunction(DataView.prototype.setUint32,4,t)}serializeU64(t){let e=BigInt(t)&BigInt(ar),n=BigInt(t)>>BigInt(32);this.serializeU32(Number(e)),this.serializeU32(Number(n))}serializeU128(t){let e=BigInt(t)&en,n=BigInt(t)>>BigInt(64);this.serializeU64(e),this.serializeU64(n)}serializeU256(t){let e=BigInt(t)&mo,n=BigInt(t)>>BigInt(128);this.serializeU128(e),this.serializeU128(n)}serializeU32AsUleb128(t){let e=t,n=[];for(;e>>>7;)n.push(e&127|128),e>>>=7;n.push(e),this.appendToBuffer(new Uint8Array(n))}toUint8Array(){return new Uint8Array(this.buffer).slice(0,this.offset)}serialize(t){t.serialize(this)}serializeVector(t){this.serializeU32AsUleb128(t.length),t.forEach(e=>{e.serialize(this)})}};mt([tn(0,pi)],Gt.prototype,"serializeU8",1),mt([tn(0,gi)],Gt.prototype,"serializeU16",1),mt([tn(0,ar)],Gt.prototype,"serializeU32",1),mt([tn(BigInt(0),en)],Gt.prototype,"serializeU64",1),mt([tn(BigInt(0),mo)],Gt.prototype,"serializeU128",1),mt([tn(BigInt(0),hi)],Gt.prototype,"serializeU256",1),mt([tn(0,ar)],Gt.prototype,"serializeU32AsUleb128",1);function yi(r){if(typeof r!="boolean")throw new Error(`${r} is not a boolean value`)}var Kc=(r,t,e)=>`${r} is out of range: [${t}, ${e}]`;function cr(r,t,e){let n=BigInt(r);if(n>BigInt(e)||n<BigInt(t))throw new Error(Kc(r,t,e))}function tn(r,t){return(e,n,o)=>{let s=o.value;return o.value=function(u){return cr(u,r,t),s.apply(this,[u])},o}}var $c=(u=>(u.INCORRECT_NUMBER_OF_BYTES="incorrect_number_of_bytes",u.INVALID_HEX_CHARS="invalid_hex_chars",u.TOO_SHORT="too_short",u.TOO_LONG="too_long",u.LEADING_ZERO_X_REQUIRED="leading_zero_x_required",u.LONG_FORM_REQUIRED_UNLESS_SPECIAL="long_form_required_unless_special",u.INVALID_PADDING_ZEROES="INVALID_PADDING_ZEROES",u))($c||{}),Re=class Re extends Z{constructor(e){super();if(e.length!==Re.LENGTH)throw new pt("AccountAddress data should be exactly 32 bytes long","incorrect_number_of_bytes");this.data=e}isSpecial(){return this.data.slice(0,this.data.length-1).every(e=>e===0)&&this.data[this.data.length-1]<16}toString(){return`0x${this.toStringWithoutPrefix()}`}toStringWithoutPrefix(){let e=Zr(this.data);return this.isSpecial()&&(e=e[e.length-1]),e}toStringLong(){return`0x${this.toStringLongWithoutPrefix()}`}toStringLongWithoutPrefix(){return Zr(this.data)}toUint8Array(){return this.data}serialize(e){e.serializeFixedBytes(this.data)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(3),e.serialize(this)}static deserialize(e){let n=e.deserializeFixedBytes(Re.LENGTH);return new Re(n)}static fromStringStrict(e){if(!e.startsWith("0x"))throw new pt("Hex string must start with a leading 0x.","leading_zero_x_required");let n=Re.fromString(e);if(e.length!==Re.LONG_STRING_LENGTH+2)if(n.isSpecial()){if(e.length!==3)throw new pt(`The given hex string ${e} is a special address not in LONG form, it must be 0x0 to 0xf without padding zeroes.`,"INVALID_PADDING_ZEROES")}else throw new pt(`The given hex string ${e} is not a special address, it must be represented as 0x + 64 chars.`,"long_form_required_unless_special");return n}static fromString(e){let n=e;if(e.startsWith("0x")&&(n=e.slice(2)),n.length===0)throw new pt("Hex string is too short, must be 1 to 64 chars long, excluding the leading 0x.","too_short");if(n.length>64)throw new pt("Hex string is too long, must be 1 to 64 chars long, excluding the leading 0x.","too_long");let o;try{o=Dn(n.padStart(64,"0"))}catch(s){throw new pt(`Hex characters are invalid: ${s?.message}`,"invalid_hex_chars")}return new Re(o)}static from(e){return e instanceof Re?e:e instanceof Uint8Array?new Re(e):Re.fromString(e)}static fromStrict(e){return e instanceof Re?e:e instanceof Uint8Array?new Re(e):Re.fromStringStrict(e)}static isValid(e){try{return e.strict?Re.fromStrict(e.input):Re.from(e.input),{valid:!0}}catch(n){return{valid:!1,invalidReason:n?.invalidReason,invalidReasonMessage:n?.message}}}equals(e){return this.data.length!==e.data.length?!1:this.data.every((n,o)=>n===e.data[o])}};Re.LENGTH=32,Re.LONG_STRING_LENGTH=64,Re.ZERO=Re.from("0x0"),Re.ONE=Re.from("0x1"),Re.TWO=Re.from("0x2"),Re.THREE=Re.from("0x3"),Re.FOUR=Re.from("0x4");var N=Re;function ur(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function Lt(r,...t){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(r.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${r.length}`)}function mi(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");ur(r.outputLen),ur(r.blockLen)}function fr(r,t=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(t&&r.finished)throw new Error("Hash#digest() has already been called")}function Ai(r,t){Lt(r);let e=t.outputLen;if(r.length<e)throw new Error(`digestInto() expects output buffer of length at least ${e}`)}var xi=BigInt(4294967295),Ws=BigInt(32);function Hc(r,t=!1){return t?{h:Number(r&xi),l:Number(r>>Ws&xi)}:{h:Number(r>>Ws&xi)|0,l:Number(r&xi)|0}}function js(r,t=!1){let e=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let o=0;o<r.length;o++){let{h:s,l:a}=Hc(r[o],t);[e[o],n[o]]=[s,a]}return[e,n]}var $l=(r,t)=>BigInt(r>>>0)<<Ws|BigInt(t>>>0),Hl=(r,t,e)=>r>>>e,Vl=(r,t,e)=>r<<32-e|t>>>e,Ql=(r,t,e)=>r>>>e|t<<32-e,Wl=(r,t,e)=>r<<32-e|t>>>e,jl=(r,t,e)=>r<<64-e|t>>>e-32,Yl=(r,t,e)=>r>>>e-32|t<<64-e,Xl=(r,t)=>t,Zl=(r,t)=>r,Ys=(r,t,e)=>r<<e|t>>>32-e,Xs=(r,t,e)=>t<<e|r>>>32-e,Zs=(r,t,e)=>t<<e-32|r>>>64-e,Js=(r,t,e)=>r<<e-32|t>>>64-e;function Jl(r,t,e,n){let o=(t>>>0)+(n>>>0);return{h:r+e+(o/2**32|0)|0,l:o|0}}var ep=(r,t,e)=>(r>>>0)+(t>>>0)+(e>>>0),tp=(r,t,e,n)=>t+e+n+(r/2**32|0)|0,rp=(r,t,e,n)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0),np=(r,t,e,n,o)=>t+e+n+o+(r/2**32|0)|0,op=(r,t,e,n,o)=>(r>>>0)+(t>>>0)+(e>>>0)+(n>>>0)+(o>>>0),ip=(r,t,e,n,o,s)=>t+e+n+o+s+(r/2**32|0)|0;var sp={fromBig:Hc,split:js,toBig:$l,shrSH:Hl,shrSL:Vl,rotrSH:Ql,rotrSL:Wl,rotrBH:jl,rotrBL:Yl,rotr32H:Xl,rotr32L:Zl,rotlSH:Ys,rotlSL:Xs,rotlBH:Zs,rotlBL:Js,add:Jl,add3L:ep,add3H:tp,add4L:rp,add4H:np,add5H:ip,add5L:op},pe=sp;var[Wc,jc,Yc]=[[],[],[]],ap=BigInt(0),Ao=BigInt(1),cp=BigInt(2),up=BigInt(7),fp=BigInt(256),dp=BigInt(113);for(let r=0,t=Ao,e=1,n=0;r<24;r++){[e,n]=[n,(2*e+3*n)%5],Wc.push(2*(5*n+e)),jc.push((r+1)*(r+2)/2%64);let o=ap;for(let s=0;s<7;s++)t=(t<<Ao^(t>>up)*dp)%fp,t&cp&&(o^=Ao<<(Ao<<BigInt(s))-Ao);Yc.push(o)}var[lp,pp]=js(Yc,!0),Vc=(r,t,e)=>e>32?Zs(r,t,e):Ys(r,t,e),Qc=(r,t,e)=>e>32?Js(r,t,e):Xs(r,t,e);function gp(r,t=24){let e=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let a=0;a<10;a++)e[a]=r[a]^r[a+10]^r[a+20]^r[a+30]^r[a+40];for(let a=0;a<10;a+=2){let u=(a+8)%10,p=(a+2)%10,h=e[p],y=e[p+1],A=Vc(h,y,1)^e[u],_=Qc(h,y,1)^e[u+1];for(let T=0;T<50;T+=10)r[a+T]^=A,r[a+T+1]^=_}let o=r[2],s=r[3];for(let a=0;a<24;a++){let u=jc[a],p=Vc(o,s,u),h=Qc(o,s,u),y=Wc[a];o=r[y],s=r[y+1],r[y]=p,r[y+1]=h}for(let a=0;a<50;a+=10){for(let u=0;u<10;u++)e[u]=r[a+u];for(let u=0;u<10;u++)r[a+u]^=~e[(u+2)%10]&e[(u+4)%10]}r[0]^=lp[n],r[1]^=pp[n]}e.fill(0)}var bi=class r extends Sr{constructor(t,e,n,o=!1,s=24){if(super(),this.blockLen=t,this.suffix=e,this.outputLen=n,this.enableXOF=o,this.rounds=s,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,ur(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=qc(this.state)}keccak(){gp(this.state32,this.rounds),this.posOut=0,this.pos=0}update(t){fr(this);let{blockLen:e,state:n}=this;t=Dt(t);let o=t.length;for(let s=0;s<o;){let a=Math.min(e-this.pos,o-s);for(let u=0;u<a;u++)n[this.pos++]^=t[s++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:t,suffix:e,pos:n,blockLen:o}=this;t[n]^=e,e&128&&n===o-1&&this.keccak(),t[o-1]^=128,this.keccak()}writeInto(t){fr(this,!1),Lt(t),this.finish();let e=this.state,{blockLen:n}=this;for(let o=0,s=t.length;o<s;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,s-o);t.set(e.subarray(this.posOut,this.posOut+a),o),this.posOut+=a,o+=a}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return ur(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Ai(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:e,suffix:n,outputLen:o,rounds:s,enableXOF:a}=this;return t||(t=new r(e,n,o,a,s)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=s,t.suffix=n,t.outputLen=o,t.enableXOF=a,t.destroyed=this.destroyed,t}},Cr=(r,t,e)=>Er(()=>new bi(t,r,e)),Gy=Cr(6,144,224/8),rn=Cr(6,136,256/8),Ly=Cr(6,104,384/8),Fy=Cr(6,72,512/8),Ky=Cr(1,144,224/8),$y=Cr(1,136,256/8),Hy=Cr(1,104,384/8),Vy=Cr(1,72,512/8),Xc=(r,t,e)=>Gc((n={})=>new bi(t,r,n.dkLen===void 0?e:n.dkLen,!0)),Qy=Xc(31,168,128/8),Wy=Xc(31,136,256/8);var To=Pc(Jc());var ea=class{constructor(t){this.buffer=new ArrayBuffer(t.length),new Uint8Array(this.buffer).set(t,0),this.offset=0}read(t){if(this.offset+t>this.buffer.byteLength)throw new Error("Reached to the end of buffer");let e=this.buffer.slice(this.offset,this.offset+t);return this.offset+=t,e}deserializeStr(){let t=this.deserializeBytes();return new TextDecoder().decode(t)}deserializeBytes(){let t=this.deserializeUleb128AsU32();return new Uint8Array(this.read(t))}deserializeFixedBytes(t){return new Uint8Array(this.read(t))}deserializeBool(){let t=new Uint8Array(this.read(1))[0];if(t!==1&&t!==0)throw new Error("Invalid boolean value");return t===1}deserializeU8(){return new DataView(this.read(1)).getUint8(0)}deserializeU16(){return new DataView(this.read(2)).getUint16(0,!0)}deserializeU32(){return new DataView(this.read(4)).getUint32(0,!0)}deserializeU64(){let t=this.deserializeU32(),e=this.deserializeU32();return BigInt(BigInt(e)<<BigInt(32)|BigInt(t))}deserializeU128(){let t=this.deserializeU64(),e=this.deserializeU64();return BigInt(e<<BigInt(64)|t)}deserializeU256(){let t=this.deserializeU128(),e=this.deserializeU128();return BigInt(e<<BigInt(128)|t)}deserializeUleb128AsU32(){let t=BigInt(0),e=0;for(;t<ar;){let n=this.deserializeU8();if(t|=BigInt(n&127)<<BigInt(e),!(n&128))break;e+=7}if(t>ar)throw new Error("Overflow while parsing uleb128-encoded uint32 value");return Number(t)}deserialize(t){return t.deserialize(this)}deserializeVector(t){let e=this.deserializeUleb128AsU32(),n=new Array;for(let o=0;o<e;o+=1)n.push(this.deserialize(t));return n}};var Ur=class r extends Z{constructor(e){super();this.value=me.fromHexInput(e).toUint8Array()}serialize(e){e.serializeFixedBytes(this.value)}serializeForEntryFunction(e){e.serialize(this)}serializeForScriptFunction(e){e.serialize(this)}static deserialize(e,n){let o=e.deserializeFixedBytes(n);return new r(o)}};var xo=class r extends Z{constructor(e){super();this.value=new Ur(e)}serialize(e){e.serialize(this.value)}serializeForEntryFunction(e){e.serializeU32AsUleb128(this.value.value.length),e.serialize(this)}static deserialize(e,n){let o=Ur.deserialize(e,n);return new r(o.value)}};var Fe=class r extends Z{constructor(e){super();yi(e),this.value=e}serialize(e){e.serializeBool(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(5),e.serialize(this)}static deserialize(e){return new r(e.deserializeBool())}},ct=class r extends Z{constructor(e){super();cr(e,0,pi),this.value=e}serialize(e){e.serializeU8(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(0),e.serialize(this)}static deserialize(e){return new r(e.deserializeU8())}},Ut=class r extends Z{constructor(e){super();cr(e,0,gi),this.value=e}serialize(e){e.serializeU16(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(6),e.serialize(this)}static deserialize(e){return new r(e.deserializeU16())}},It=class r extends Z{constructor(e){super();cr(e,0,ar),this.value=e}serialize(e){e.serializeU32(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(7),e.serialize(this)}static deserialize(e){return new r(e.deserializeU32())}},rt=class r extends Z{constructor(e){super();cr(e,BigInt(0),en),this.value=BigInt(e)}serialize(e){e.serializeU64(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(1),e.serialize(this)}static deserialize(e){return new r(e.deserializeU64())}},Pt=class r extends Z{constructor(e){super();cr(e,BigInt(0),mo),this.value=BigInt(e)}serialize(e){e.serializeU128(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(2),e.serialize(this)}static deserialize(e){return new r(e.deserializeU128())}},Rt=class r extends Z{constructor(e){super();cr(e,BigInt(0),hi),this.value=BigInt(e)}serialize(e){e.serializeU256(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){e.serializeU32AsUleb128(8),e.serialize(this)}static deserialize(e){return new r(e.deserializeU256())}};var Ie=class r extends Z{constructor(e){super();this.values=e}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){if(!(this.values[0]instanceof ct)&&this.values[0]!==void 0)throw new Error("Script function arguments only accept u8 vectors");e.serializeU32AsUleb128(4),e.serialize(this)}static U8(e){let n;if(Array.isArray(e)&&typeof e[0]=="number")n=e;else if(typeof e=="string"){let o=me.fromHexInput(e);n=Array.from(o.toUint8Array())}else if(e instanceof Uint8Array)n=Array.from(e);else throw new Error("Invalid input type");return new r(n.map(o=>new ct(o)))}static U16(e){return new r(e.map(n=>new Ut(n)))}static U32(e){return new r(e.map(n=>new It(n)))}static U64(e){return new r(e.map(n=>new rt(n)))}static U128(e){return new r(e.map(n=>new Pt(n)))}static U256(e){return new r(e.map(n=>new Rt(n)))}static Bool(e){return new r(e.map(n=>new Fe(n)))}static MoveString(e){return new r(e.map(n=>new Ze(n)))}serialize(e){e.serializeVector(this.values)}static deserialize(e,n){let o=e.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1)s.push(n.deserialize(e));return new r(s)}},Ze=class r extends Z{constructor(e){super();this.value=e}serialize(e){e.serializeStr(this.value)}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}serializeForScriptFunction(e){let n=this.bcsToBytes().slice(1);Ie.U8(n).serializeForScriptFunction(e)}static deserialize(e){return new r(e.deserializeStr())}},dr=class r extends Z{constructor(e){super();typeof e<"u"&&e!==null?this.vec=new Ie([e]):this.vec=new Ie([]),[this.value]=this.vec.values}serializeForEntryFunction(e){let n=this.bcsToBytes();e.serializeBytes(n)}unwrap(){if(this.isSome())return this.vec.values[0];throw new Error("Called unwrap on a MoveOption with no value")}isSome(){return this.vec.values.length===1}serialize(e){this.vec.serialize(e)}static U8(e){return new r(e!=null?new ct(e):void 0)}static U16(e){return new r(e!=null?new Ut(e):void 0)}static U32(e){return new r(e!=null?new It(e):void 0)}static U64(e){return new r(e!=null?new rt(e):void 0)}static U128(e){return new r(e!=null?new Pt(e):void 0)}static U256(e){return new r(e!=null?new Rt(e):void 0)}static Bool(e){return new r(e!=null?new Fe(e):void 0)}static MoveString(e){return new r(e!=null?new Ze(e):void 0)}static deserialize(e,n){let o=Ie.deserialize(e,n);return new r(o.values[0])}};var _t=class extends Z{},nn=class extends Z{},Ft=class extends Z{};var Ti=class extends Sr{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,mi(t);let n=Dt(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(n.length>o?t.create().update(n).digest():n);for(let a=0;a<s.length;a++)s[a]^=54;this.iHash.update(s),this.oHash=t.create();for(let a=0;a<s.length;a++)s[a]^=106;this.oHash.update(s),s.fill(0)}update(t){return fr(this),this.iHash.update(t),this}digestInto(t){fr(this),Lt(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:n,finished:o,destroyed:s,blockLen:a,outputLen:u}=this;return t=t,t.finished=o,t.destroyed=s,t.blockLen=a,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=n._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Yt=(r,t,e)=>new Ti(r,t).update(e).digest();Yt.create=(r,t)=>new Ti(r,t);function hp(r,t,e,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(t,e,n);let o=BigInt(32),s=BigInt(4294967295),a=Number(e>>o&s),u=Number(e&s),p=n?4:0,h=n?0:4;r.setUint32(t+p,a,n),r.setUint32(t+h,u,n)}var Ir=class extends Sr{constructor(t,e,n,o){super(),this.blockLen=t,this.outputLen=e,this.padOffset=n,this.isLE=o,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=jt(this.buffer)}update(t){fr(this);let{view:e,buffer:n,blockLen:o}=this;t=Dt(t);let s=t.length;for(let a=0;a<s;){let u=Math.min(o-this.pos,s-a);if(u===o){let p=jt(t);for(;o<=s-a;a+=o)this.process(p,a);continue}n.set(t.subarray(a,a+u),this.pos),this.pos+=u,a+=u,this.pos===o&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){fr(this),Ai(t,this),this.finished=!0;let{buffer:e,view:n,blockLen:o,isLE:s}=this,{pos:a}=this;e[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>o-a&&(this.process(n,0),a=0);for(let A=a;A<o;A++)e[A]=0;hp(n,o-8,BigInt(this.length*8),s),this.process(n,0);let u=jt(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");let h=p/4,y=this.get();if(h>y.length)throw new Error("_sha2: outputLen bigger than state");for(let A=0;A<h;A++)u.setUint32(4*A,y[A],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let n=t.slice(0,e);return this.destroy(),n}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:n,length:o,finished:s,destroyed:a,pos:u}=this;return t.length=o,t.pos=u,t.finished=s,t.destroyed=a,o%e&&t.buffer.set(n),t}};var[yp,mp]=(()=>pe.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),Pr=new Uint32Array(80),Rr=new Uint32Array(80),ta=class extends Ir{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:t,Al:e,Bh:n,Bl:o,Ch:s,Cl:a,Dh:u,Dl:p,Eh:h,El:y,Fh:A,Fl:_,Gh:T,Gl:z,Hh:S,Hl:P}=this;return[t,e,n,o,s,a,u,p,h,y,A,_,T,z,S,P]}set(t,e,n,o,s,a,u,p,h,y,A,_,T,z,S,P){this.Ah=t|0,this.Al=e|0,this.Bh=n|0,this.Bl=o|0,this.Ch=s|0,this.Cl=a|0,this.Dh=u|0,this.Dl=p|0,this.Eh=h|0,this.El=y|0,this.Fh=A|0,this.Fl=_|0,this.Gh=T|0,this.Gl=z|0,this.Hh=S|0,this.Hl=P|0}process(t,e){for(let k=0;k<16;k++,e+=4)Pr[k]=t.getUint32(e),Rr[k]=t.getUint32(e+=4);for(let k=16;k<80;k++){let ee=Pr[k-15]|0,L=Rr[k-15]|0,W=pe.rotrSH(ee,L,1)^pe.rotrSH(ee,L,8)^pe.shrSH(ee,L,7),J=pe.rotrSL(ee,L,1)^pe.rotrSL(ee,L,8)^pe.shrSL(ee,L,7),X=Pr[k-2]|0,Oe=Rr[k-2]|0,xe=pe.rotrSH(X,Oe,19)^pe.rotrBH(X,Oe,61)^pe.shrSH(X,Oe,6),ye=pe.rotrSL(X,Oe,19)^pe.rotrBL(X,Oe,61)^pe.shrSL(X,Oe,6),Ve=pe.add4L(J,ye,Rr[k-7],Rr[k-16]),Qe=pe.add4H(Ve,W,xe,Pr[k-7],Pr[k-16]);Pr[k]=Qe|0,Rr[k]=Ve|0}let{Ah:n,Al:o,Bh:s,Bl:a,Ch:u,Cl:p,Dh:h,Dl:y,Eh:A,El:_,Fh:T,Fl:z,Gh:S,Gl:P,Hh:B,Hl:H}=this;for(let k=0;k<80;k++){let ee=pe.rotrSH(A,_,14)^pe.rotrSH(A,_,18)^pe.rotrBH(A,_,41),L=pe.rotrSL(A,_,14)^pe.rotrSL(A,_,18)^pe.rotrBL(A,_,41),W=A&T^~A&S,J=_&z^~_&P,X=pe.add5L(H,L,J,mp[k],Rr[k]),Oe=pe.add5H(X,B,ee,W,yp[k],Pr[k]),xe=X|0,ye=pe.rotrSH(n,o,28)^pe.rotrBH(n,o,34)^pe.rotrBH(n,o,39),Ve=pe.rotrSL(n,o,28)^pe.rotrBL(n,o,34)^pe.rotrBL(n,o,39),Qe=n&s^n&u^s&u,yt=o&a^o&p^a&p;B=S|0,H=P|0,S=T|0,P=z|0,T=A|0,z=_|0,{h:A,l:_}=pe.add(h|0,y|0,Oe|0,xe|0),h=u|0,y=p|0,u=s|0,p=a|0,s=n|0,a=o|0;let O=pe.add3L(xe,Ve,yt);n=pe.add3H(O,Oe,ye,Qe),o=O|0}({h:n,l:o}=pe.add(this.Ah|0,this.Al|0,n|0,o|0)),{h:s,l:a}=pe.add(this.Bh|0,this.Bl|0,s|0,a|0),{h:u,l:p}=pe.add(this.Ch|0,this.Cl|0,u|0,p|0),{h,l:y}=pe.add(this.Dh|0,this.Dl|0,h|0,y|0),{h:A,l:_}=pe.add(this.Eh|0,this.El|0,A|0,_|0),{h:T,l:z}=pe.add(this.Fh|0,this.Fl|0,T|0,z|0),{h:S,l:P}=pe.add(this.Gh|0,this.Gl|0,S|0,P|0),{h:B,l:H}=pe.add(this.Hh|0,this.Hl|0,B|0,H|0),this.set(n,o,s,a,u,p,h,y,A,_,T,z,S,P,B,H)}roundClean(){Pr.fill(0),Rr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var on=Er(()=>new ta);function Ap(r,t,e,n){mi(r);let o=Dc({dkLen:32,asyncTick:10},n),{c:s,dkLen:a,asyncTick:u}=o;if(ur(s),ur(a),ur(u),s<1)throw new Error("PBKDF2: iterations (c) should be >= 1");let p=Dt(t),h=Dt(e),y=new Uint8Array(a),A=Yt.create(r,p),_=A._cloneInto().update(h);return{c:s,dkLen:a,asyncTick:u,DK:y,PRF:A,PRFSalt:_}}function xp(r,t,e,n,o){return r.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),e}function eu(r,t,e,n){let{c:o,dkLen:s,DK:a,PRF:u,PRFSalt:p}=Ap(r,t,e,n),h,y=new Uint8Array(4),A=jt(y),_=new Uint8Array(u.outputLen);for(let T=1,z=0;z<s;T++,z+=u.outputLen){let S=a.subarray(z,z+u.outputLen);A.setInt32(0,T,!1),(h=p._cloneInto(h)).update(y).digestInto(_),S.set(_.subarray(0,S.length));for(let P=1;P<o;P++){u._cloneInto(h).update(_).digestInto(_);for(let B=0;B<S.length;B++)S[B]^=_[B]}}return xp(u,p,a,h,_)}var bp=(r,t,e)=>r&t^~r&e,wp=(r,t,e)=>r&t^r&e^t&e,Tp=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]),Br=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Or=new Uint32Array(64),ra=class extends Ir{constructor(){super(64,32,8,!1),this.A=Br[0]|0,this.B=Br[1]|0,this.C=Br[2]|0,this.D=Br[3]|0,this.E=Br[4]|0,this.F=Br[5]|0,this.G=Br[6]|0,this.H=Br[7]|0}get(){let{A:t,B:e,C:n,D:o,E:s,F:a,G:u,H:p}=this;return[t,e,n,o,s,a,u,p]}set(t,e,n,o,s,a,u,p){this.A=t|0,this.B=e|0,this.C=n|0,this.D=o|0,this.E=s|0,this.F=a|0,this.G=u|0,this.H=p|0}process(t,e){for(let A=0;A<16;A++,e+=4)Or[A]=t.getUint32(e,!1);for(let A=16;A<64;A++){let _=Or[A-15],T=Or[A-2],z=qt(_,7)^qt(_,18)^_>>>3,S=qt(T,17)^qt(T,19)^T>>>10;Or[A]=S+Or[A-7]+z+Or[A-16]|0}let{A:n,B:o,C:s,D:a,E:u,F:p,G:h,H:y}=this;for(let A=0;A<64;A++){let _=qt(u,6)^qt(u,11)^qt(u,25),T=y+_+bp(u,p,h)+Tp[A]+Or[A]|0,S=(qt(n,2)^qt(n,13)^qt(n,22))+wp(n,o,s)|0;y=h,h=p,p=u,u=a+T|0,a=s,s=o,o=n,n=T+S|0}n=n+this.A|0,o=o+this.B|0,s=s+this.C|0,a=a+this.D|0,u=u+this.E|0,p=p+this.F|0,h=h+this.G|0,y=y+this.H|0,this.set(n,o,s,a,u,p,h,y)}roundClean(){Or.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var bo=Er(()=>new ra);function _i(r){if(!Number.isSafeInteger(r))throw new Error(`Wrong integer: ${r}`)}function ru(...r){let t=(o,s)=>a=>o(s(a)),e=Array.from(r).reverse().reduce((o,s)=>o?t(o,s.encode):s.encode,void 0),n=r.reduce((o,s)=>o?t(o,s.decode):s.decode,void 0);return{encode:e,decode:n}}function _p(r){return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("alphabet.encode input should be an array of numbers");return t.map(e=>{if(e<0||e>=r.length)throw new Error(`Digit index outside alphabet: ${e} (alphabet: ${r.length})`);return r[e]})},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("alphabet.decode input should be array of strings");return t.map(e=>{if(typeof e!="string")throw new Error(`alphabet.decode: not string element=${e}`);let n=r.indexOf(e);if(n===-1)throw new Error(`Unknown letter: "${e}". Allowed: ${r}`);return n})}}}function vp(r=""){if(typeof r!="string")throw new Error("join separator should be string");return{encode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="string")throw new Error("join.encode input should be array of strings");for(let e of t)if(typeof e!="string")throw new Error(`join.encode: non-string input=${e}`);return t.join(r)},decode:t=>{if(typeof t!="string")throw new Error("join.decode input should be string");return t.split(r)}}}function tu(r,t,e){if(t<2)throw new Error(`convertRadix: wrong from=${t}, base cannot be less than 2`);if(e<2)throw new Error(`convertRadix: wrong to=${e}, base cannot be less than 2`);if(!Array.isArray(r))throw new Error("convertRadix: data should be array");if(!r.length)return[];let n=0,o=[],s=Array.from(r);for(s.forEach(a=>{if(a<0||a>=t)throw new Error(`Wrong integer: ${a}`)});;){let a=0,u=!0;for(let p=n;p<s.length;p++){let h=s[p],y=t*a+h;if(!Number.isSafeInteger(y)||t*a/t!==a||y-h!==t*a)throw new Error("convertRadix: carry overflow");a=y%e;let A=Math.floor(y/e);if(s[p]=A,!Number.isSafeInteger(A)||A*e+a!==y)throw new Error("convertRadix: carry overflow");if(u)A?u=!1:n=p;else continue}if(o.push(a),u)break}for(let a=0;a<r.length-1&&r[a]===0;a++)o.push(0);return o.reverse()}function Sp(r){return{encode:t=>{if(!(t instanceof Uint8Array))throw new Error("radix.encode input should be Uint8Array");return tu(Array.from(t),2**8,r)},decode:t=>{if(!Array.isArray(t)||t.length&&typeof t[0]!="number")throw new Error("radix.decode input should be array of strings");return Uint8Array.from(tu(t,r,2**8))}}}function Ep(r,t){if(typeof t!="function")throw new Error("checksum fn should be function");return{encode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.encode: input should be Uint8Array");let n=t(e).slice(0,r),o=new Uint8Array(e.length+r);return o.set(e),o.set(n,e.length),o},decode(e){if(!(e instanceof Uint8Array))throw new Error("checksum.decode: input should be Uint8Array");let n=e.slice(0,-r),o=t(n).slice(0,r),s=e.slice(-r);for(let a=0;a<r;a++)if(o[a]!==s[a])throw new Error("Invalid checksum");return n}}}var Cp=r=>ru(Sp(58),_p(r),vp("")),Up=Cp("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");var nu=r=>ru(Ep(4,t=>r(r(t))),Up);function ou(r){if(typeof r!="string")throw new TypeError(`Invalid mnemonic type: ${typeof r}`);return r.normalize("NFKD")}function Ip(r){let t=ou(r),e=t.split(" ");if(![12,15,18,21,24].includes(e.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:e}}var Pp=r=>ou(`mnemonic${r}`);function iu(r,t=""){return eu(on,Ip(r).nfkd,Pp(t),{c:2048,dkLen:64})}var su=/^m\/44'\/637'\/[0-9]+'\/[0-9]+'\/[0-9]+'?$/,au=/^m\/44'\/637'\/[0-9]+'\/[0-9]+\/[0-9]+$/,cu=(t=>(t.ED25519="ed25519 seed",t))(cu||{}),na=2147483648;function oa(r){return au.test(r)}function ia(r){return su.test(r)}var vi=(r,t)=>{let e=Yt.create(on,r).update(t).digest();return{key:e.slice(0,32),chainCode:e.slice(32)}},sa=({key:r,chainCode:t},e)=>{let n=new ArrayBuffer(4);new DataView(n).setUint32(0,e);let o=new Uint8Array(n),s=new Uint8Array([0]),a=new Uint8Array([...s,...r,...o]);return vi(t,a)},Bp=r=>r.replace("'",""),aa=r=>r.split("/").slice(1).map(Bp),wo=r=>{let t=r.trim().split(/\s+/).map(e=>e.toLowerCase()).join(" ");return iu(t)};var Nr=class Nr extends _t{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==Nr.LENGTH)throw new Error(`PublicKey length should be ${Nr.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),a=o.toUint8Array();return To.default.sign.detached.verify(s,a,this.key.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Nr(n)}static load(e){let n=e.deserializeBytes();return new Nr(n)}static isPublicKey(e){return e instanceof Nr}};Nr.LENGTH=32;var Be=Nr,gt=class gt extends nn{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==gt.LENGTH)throw new Error(`PrivateKey length should be ${gt.LENGTH}`);this.signingKeyPair=To.default.sign.keyPair.fromSeed(n.toUint8Array().slice(0,gt.LENGTH))}toUint8Array(){return this.signingKeyPair.secretKey.slice(0,gt.LENGTH)}toString(){return me.fromHexInput(this.toUint8Array()).toString()}sign(e){let n=me.fromHexInput(e),o=To.default.sign.detached(n.toUint8Array(),this.signingKeyPair.secretKey);return new Ke(o)}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new gt(n)}static generate(){let e=To.default.sign.keyPair();return new gt(e.secretKey.slice(0,gt.LENGTH))}publicKey(){let e=this.signingKeyPair.publicKey;return new Be(e)}static fromDerivationPath(e,n){if(!ia(e))throw new Error(`Invalid derivation path ${e}`);return gt.fromDerivationPathInner(e,wo(n))}static fromDerivationPathInner(e,n,o=na){let{key:s,chainCode:a}=vi(gt.SLIP_0010_SEED,n),u=aa(e).map(h=>parseInt(h,10)),{key:p}=u.reduce((h,y)=>sa(h,y+o),{key:s,chainCode:a});return new gt(p)}static isPrivateKey(e){return e instanceof gt}};gt.LENGTH=32,gt.SLIP_0010_SEED="ed25519 seed";var lr=gt,kr=class kr extends Ft{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==kr.LENGTH)throw new Error(`Signature length should be ${kr.LENGTH}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new kr(n)}static load(e){let n=e.deserializeBytes();return new kr(n)}static isSignature(e){return e instanceof kr}};kr.LENGTH=64;var Ke=kr;var Bt=class Bt extends _t{constructor(e){super();let{publicKeys:n,threshold:o}=e;if(n.length>Bt.MAX_KEYS||n.length<Bt.MIN_KEYS)throw new Error(`Must have between ${Bt.MIN_KEYS} and ${Bt.MAX_KEYS} public keys, inclusive`);if(o<Bt.MIN_THRESHOLD||o>n.length)throw new Error(`Threshold must be between ${Bt.MIN_THRESHOLD} and ${n.length}, inclusive`);this.publicKeys=n,this.threshold=o}toUint8Array(){let e=new Uint8Array(this.publicKeys.length*Be.LENGTH+1);return this.publicKeys.forEach((n,o)=>{e.set(n.toUint8Array(),o*Be.LENGTH)}),e[this.publicKeys.length*Be.LENGTH]=this.threshold,e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("TODO - Method not implemented.")}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n[n.length-1],s=[];for(let a=0;a<n.length-1;a+=Be.LENGTH){let u=a;s.push(new Be(n.subarray(u,u+Be.LENGTH)))}return new Bt({publicKeys:s,threshold:o})}};Bt.MAX_KEYS=32,Bt.MIN_KEYS=2,Bt.MIN_THRESHOLD=1;var Kt=Bt,Ot=class Ot extends Ft{constructor(e){super();let{signatures:n,bitmap:o}=e;if(o.length!==Ot.BITMAP_LEN)throw new Error(`"bitmap" length should be ${Ot.BITMAP_LEN}`);if(n.length>Ot.MAX_SIGNATURES_SUPPORTED)throw new Error(`The number of signatures cannot be greater than ${Ot.MAX_SIGNATURES_SUPPORTED}`);this.signatures=n,this.bitmap=o}toUint8Array(){let e=new Uint8Array(this.signatures.length*Ke.LENGTH+Ot.BITMAP_LEN);return this.signatures.forEach((n,o)=>{e.set(n.toUint8Array(),o*Ke.LENGTH)}),e.set(this.bitmap,this.signatures.length*Ke.LENGTH),e}toString(){return me.fromHexInput(this.toUint8Array()).toString()}static createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),a=new Set;return n.forEach(u=>{if(u>=Ot.MAX_SIGNATURES_SUPPORTED)throw new Error(`Cannot have a signature larger than ${Ot.MAX_SIGNATURES_SUPPORTED-1}.`);if(a.has(u))throw new Error("Duplicate bits detected.");a.add(u);let p=Math.floor(u/8),h=s[p];h|=o>>u%8,s[p]=h}),s}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes(),o=n.subarray(n.length-4),s=[];for(let a=0;a<n.length-o.length;a+=Ke.LENGTH){let u=a;s.push(new Ke(n.subarray(u,u+Ke.LENGTH)))}return new Ot({signatures:s,bitmap:o})}};Ot.MAX_SIGNATURES_SUPPORTED=32,Ot.BITMAP_LEN=4;var sn=Ot;var da={};Uc(da,{bitGet:()=>Dp,bitLen:()=>qp,bitMask:()=>_o,bitSet:()=>Gp,bytesToHex:()=>an,bytesToNumberBE:()=>pr,bytesToNumberLE:()=>Ci,concatBytes:()=>Gn,createHmacDrbg:()=>fa,ensureBytes:()=>vt,equalBytes:()=>zp,hexToBytes:()=>cn,hexToNumber:()=>ua,numberToBytesBE:()=>zr,numberToBytesLE:()=>Ui,numberToHexUnpadded:()=>du,numberToVarBytesBE:()=>kp,utf8ToBytes:()=>Mp,validateObject:()=>Mr});var fu=BigInt(0),Si=BigInt(1),Op=BigInt(2),Ei=r=>r instanceof Uint8Array,Np=Array.from({length:256},(r,t)=>t.toString(16).padStart(2,"0"));function an(r){if(!Ei(r))throw new Error("Uint8Array expected");let t="";for(let e=0;e<r.length;e++)t+=Np[r[e]];return t}function du(r){let t=r.toString(16);return t.length&1?`0${t}`:t}function ua(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);return BigInt(r===""?"0":`0x${r}`)}function cn(r){if(typeof r!="string")throw new Error("hex string expected, got "+typeof r);let t=r.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);let e=new Uint8Array(t/2);for(let n=0;n<e.length;n++){let o=n*2,s=r.slice(o,o+2),a=Number.parseInt(s,16);if(Number.isNaN(a)||a<0)throw new Error("Invalid byte sequence");e[n]=a}return e}function pr(r){return ua(an(r))}function Ci(r){if(!Ei(r))throw new Error("Uint8Array expected");return ua(an(Uint8Array.from(r).reverse()))}function zr(r,t){return cn(r.toString(16).padStart(t*2,"0"))}function Ui(r,t){return zr(r,t).reverse()}function kp(r){return cn(du(r))}function vt(r,t,e){let n;if(typeof t=="string")try{n=cn(t)}catch(s){throw new Error(`${r} must be valid hex string, got "${t}". Cause: ${s}`)}else if(Ei(t))n=Uint8Array.from(t);else throw new Error(`${r} must be hex string or Uint8Array`);let o=n.length;if(typeof e=="number"&&o!==e)throw new Error(`${r} expected ${e} bytes, got ${o}`);return n}function Gn(...r){let t=new Uint8Array(r.reduce((n,o)=>n+o.length,0)),e=0;return r.forEach(n=>{if(!Ei(n))throw new Error("Uint8Array expected");t.set(n,e),e+=n.length}),t}function zp(r,t){if(r.length!==t.length)return!1;for(let e=0;e<r.length;e++)if(r[e]!==t[e])return!1;return!0}function Mp(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function qp(r){let t;for(t=0;r>fu;r>>=Si,t+=1);return t}function Dp(r,t){return r>>BigInt(t)&Si}var Gp=(r,t,e)=>r|(e?Si:fu)<<BigInt(t),_o=r=>(Op<<BigInt(r-1))-Si,ca=r=>new Uint8Array(r),uu=r=>Uint8Array.from(r);function fa(r,t,e){if(typeof r!="number"||r<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");let n=ca(r),o=ca(r),s=0,a=()=>{n.fill(1),o.fill(0),s=0},u=(...A)=>e(o,n,...A),p=(A=ca())=>{o=u(uu([0]),A),n=u(),A.length!==0&&(o=u(uu([1]),A),n=u())},h=()=>{if(s++>=1e3)throw new Error("drbg: tried 1000 values");let A=0,_=[];for(;A<t;){n=u();let T=n.slice();_.push(T),A+=n.length}return Gn(..._)};return(A,_)=>{a(),p(A);let T;for(;!(T=_(h()));)p();return a(),T}}var Lp={bigint:r=>typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,t)=>t.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Mr(r,t,e={}){let n=(o,s,a)=>{let u=Lp[s];if(typeof u!="function")throw new Error(`Invalid validator "${s}", expected function`);let p=r[o];if(!(a&&p===void 0)&&!u(p,r))throw new Error(`Invalid param ${String(o)}=${p} (${typeof p}), expected ${s}`)};for(let[o,s]of Object.entries(t))n(o,s,!1);for(let[o,s]of Object.entries(e))n(o,s,!0);return r}var tt=BigInt(0),$e=BigInt(1),un=BigInt(2),Fp=BigInt(3),la=BigInt(4),lu=BigInt(5),pu=BigInt(8),Kp=BigInt(9),$p=BigInt(16);function nt(r,t){let e=r%t;return e>=tt?e:t+e}function Hp(r,t,e){if(e<=tt||t<tt)throw new Error("Expected power/modulo > 0");if(e===$e)return tt;let n=$e;for(;t>tt;)t&$e&&(n=n*r%e),r=r*r%e,t>>=$e;return n}function St(r,t,e){let n=r;for(;t-- >tt;)n*=n,n%=e;return n}function Ii(r,t){if(r===tt||t<=tt)throw new Error(`invert: expected positive integers, got n=${r} mod=${t}`);let e=nt(r,t),n=t,o=tt,s=$e,a=$e,u=tt;for(;e!==tt;){let h=n/e,y=n%e,A=o-a*h,_=s-u*h;n=e,e=y,o=a,s=u,a=A,u=_}if(n!==$e)throw new Error("invert: does not exist");return nt(o,t)}function Vp(r){let t=(r-$e)/un,e,n,o;for(e=r-$e,n=0;e%un===tt;e/=un,n++);for(o=un;o<r&&Hp(o,t,r)!==r-$e;o++);if(n===1){let a=(r+$e)/la;return function(p,h){let y=p.pow(h,a);if(!p.eql(p.sqr(y),h))throw new Error("Cannot find square root");return y}}let s=(e+$e)/un;return function(u,p){if(u.pow(p,t)===u.neg(u.ONE))throw new Error("Cannot find square root");let h=n,y=u.pow(u.mul(u.ONE,o),e),A=u.pow(p,s),_=u.pow(p,e);for(;!u.eql(_,u.ONE);){if(u.eql(_,u.ZERO))return u.ZERO;let T=1;for(let S=u.sqr(_);T<h&&!u.eql(S,u.ONE);T++)S=u.sqr(S);let z=u.pow(y,$e<<BigInt(h-T-1));y=u.sqr(z),A=u.mul(A,z),_=u.mul(_,y),h=T}return A}}function Qp(r){if(r%la===Fp){let t=(r+$e)/la;return function(n,o){let s=n.pow(o,t);if(!n.eql(n.sqr(s),o))throw new Error("Cannot find square root");return s}}if(r%pu===lu){let t=(r-lu)/pu;return function(n,o){let s=n.mul(o,un),a=n.pow(s,t),u=n.mul(o,a),p=n.mul(n.mul(u,un),a),h=n.mul(u,n.sub(p,n.ONE));if(!n.eql(n.sqr(h),o))throw new Error("Cannot find square root");return h}}return r%$p,Vp(r)}var Wp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pa(r){let t={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},e=Wp.reduce((n,o)=>(n[o]="function",n),t);return Mr(r,e)}function jp(r,t,e){if(e<tt)throw new Error("Expected power > 0");if(e===tt)return r.ONE;if(e===$e)return t;let n=r.ONE,o=t;for(;e>tt;)e&$e&&(n=r.mul(n,o)),o=r.sqr(o),e>>=$e;return n}function Yp(r,t){let e=new Array(t.length),n=t.reduce((s,a,u)=>r.is0(a)?s:(e[u]=s,r.mul(s,a)),r.ONE),o=r.inv(n);return t.reduceRight((s,a,u)=>r.is0(a)?s:(e[u]=r.mul(s,e[u]),r.mul(s,a)),o),e}function ga(r,t){let e=t!==void 0?t:r.toString(2).length,n=Math.ceil(e/8);return{nBitLength:e,nByteLength:n}}function gu(r,t,e=!1,n={}){if(r<=tt)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:o,nByteLength:s}=ga(r,t);if(s>2048)throw new Error("Field lengths over 2048 bytes are not supported");let a=Qp(r),u=Object.freeze({ORDER:r,BITS:o,BYTES:s,MASK:_o(o),ZERO:tt,ONE:$e,create:p=>nt(p,r),isValid:p=>{if(typeof p!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof p}`);return tt<=p&&p<r},is0:p=>p===tt,isOdd:p=>(p&$e)===$e,neg:p=>nt(-p,r),eql:(p,h)=>p===h,sqr:p=>nt(p*p,r),add:(p,h)=>nt(p+h,r),sub:(p,h)=>nt(p-h,r),mul:(p,h)=>nt(p*h,r),pow:(p,h)=>jp(u,p,h),div:(p,h)=>nt(p*Ii(h,r),r),sqrN:p=>p*p,addN:(p,h)=>p+h,subN:(p,h)=>p-h,mulN:(p,h)=>p*h,inv:p=>Ii(p,r),sqrt:n.sqrt||(p=>a(u,p)),invertBatch:p=>Yp(u,p),cmov:(p,h,y)=>y?h:p,toBytes:p=>e?Ui(p,s):zr(p,s),fromBytes:p=>{if(p.length!==s)throw new Error(`Fp.fromBytes: expected ${s}, got ${p.length}`);return e?Ci(p):pr(p)}});return Object.freeze(u)}function hu(r){if(typeof r!="bigint")throw new Error("field order must be bigint");let t=r.toString(2).length;return Math.ceil(t/8)}function ha(r){let t=hu(r);return t+Math.ceil(t/2)}function yu(r,t,e=!1){let n=r.length,o=hu(t),s=ha(t);if(n<16||n<s||n>1024)throw new Error(`expected ${s}-1024 bytes of input, got ${n}`);let a=e?pr(r):Ci(r),u=nt(a,t-$e)+$e;return e?Ui(u,o):zr(u,o)}var Zp=BigInt(0),ya=BigInt(1);function mu(r,t){let e=(o,s)=>{let a=s.negate();return o?a:s},n=o=>{let s=Math.ceil(t/o)+1,a=2**(o-1);return{windows:s,windowSize:a}};return{constTimeNegate:e,unsafeLadder(o,s){let a=r.ZERO,u=o;for(;s>Zp;)s&ya&&(a=a.add(u)),u=u.double(),s>>=ya;return a},precomputeWindow(o,s){let{windows:a,windowSize:u}=n(s),p=[],h=o,y=h;for(let A=0;A<a;A++){y=h,p.push(y);for(let _=1;_<u;_++)y=y.add(h),p.push(y);h=y.double()}return p},wNAF(o,s,a){let{windows:u,windowSize:p}=n(o),h=r.ZERO,y=r.BASE,A=BigInt(2**o-1),_=2**o,T=BigInt(o);for(let z=0;z<u;z++){let S=z*p,P=Number(a&A);a>>=T,P>p&&(P-=_,a+=ya);let B=S,H=S+Math.abs(P)-1,k=z%2!==0,ee=P<0;P===0?y=y.add(e(k,s[B])):h=h.add(e(ee,s[H]))}return{p:h,f:y}},wNAFCached(o,s,a,u){let p=o._WINDOW_SIZE||1,h=s.get(o);return h||(h=this.precomputeWindow(o,p),p!==1&&s.set(o,u(h))),this.wNAF(p,h,a)}}}function ma(r){return pa(r.Fp),Mr(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...ga(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}function Jp(r){let t=ma(r);Mr(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:e,Fp:n,a:o}=t;if(e){if(!n.eql(o,n.ZERO))throw new Error("Endomorphism can only be defined for Koblitz curves that have a=0");if(typeof e!="object"||typeof e.beta!="bigint"||typeof e.splitScalar!="function")throw new Error("Expected endomorphism with beta: bigint and splitScalar: function")}return Object.freeze({...t})}var{bytesToNumberBE:eg,hexToBytes:tg}=da,fn={Err:class extends Error{constructor(t=""){super(t)}},_parseInt(r){let{Err:t}=fn;if(r.length<2||r[0]!==2)throw new t("Invalid signature integer tag");let e=r[1],n=r.subarray(2,e+2);if(!e||n.length!==e)throw new t("Invalid signature integer: wrong length");if(n[0]&128)throw new t("Invalid signature integer: negative");if(n[0]===0&&!(n[1]&128))throw new t("Invalid signature integer: unnecessary leading zero");return{d:eg(n),l:r.subarray(e+2)}},toSig(r){let{Err:t}=fn,e=typeof r=="string"?tg(r):r;if(!(e instanceof Uint8Array))throw new Error("ui8a expected");let n=e.length;if(n<2||e[0]!=48)throw new t("Invalid signature tag");if(e[1]!==n-2)throw new t("Invalid signature: incorrect length");let{d:o,l:s}=fn._parseInt(e.subarray(2)),{d:a,l:u}=fn._parseInt(s);if(u.length)throw new t("Invalid signature: left bytes after parsing");return{r:o,s:a}},hexFromSig(r){let t=h=>Number.parseInt(h[0],16)&8?"00"+h:h,e=h=>{let y=h.toString(16);return y.length&1?`0${y}`:y},n=t(e(r.s)),o=t(e(r.r)),s=n.length/2,a=o.length/2,u=e(s),p=e(a);return`30${e(a+s+4)}02${p}${o}02${u}${n}`}},gr=BigInt(0),Nt=BigInt(1),_0=BigInt(2),Au=BigInt(3),v0=BigInt(4);function rg(r){let t=Jp(r),{Fp:e}=t,n=t.toBytes||((z,S,P)=>{let B=S.toAffine();return Gn(Uint8Array.from([4]),e.toBytes(B.x),e.toBytes(B.y))}),o=t.fromBytes||(z=>{let S=z.subarray(1),P=e.fromBytes(S.subarray(0,e.BYTES)),B=e.fromBytes(S.subarray(e.BYTES,2*e.BYTES));return{x:P,y:B}});function s(z){let{a:S,b:P}=t,B=e.sqr(z),H=e.mul(B,z);return e.add(e.add(H,e.mul(z,S)),P)}if(!e.eql(e.sqr(t.Gy),s(t.Gx)))throw new Error("bad generator point: equation left != right");function a(z){return typeof z=="bigint"&&gr<z&&z<t.n}function u(z){if(!a(z))throw new Error("Expected valid bigint: 0 < bigint < curve.n")}function p(z){let{allowedPrivateKeyLengths:S,nByteLength:P,wrapPrivateKey:B,n:H}=t;if(S&&typeof z!="bigint"){if(z instanceof Uint8Array&&(z=an(z)),typeof z!="string"||!S.includes(z.length))throw new Error("Invalid key");z=z.padStart(P*2,"0")}let k;try{k=typeof z=="bigint"?z:pr(vt("private key",z,P))}catch{throw new Error(`private key must be ${P} bytes, hex or bigint, not ${typeof z}`)}return B&&(k=nt(k,H)),u(k),k}let h=new Map;function y(z){if(!(z instanceof A))throw new Error("ProjectivePoint expected")}class A{constructor(S,P,B){if(this.px=S,this.py=P,this.pz=B,S==null||!e.isValid(S))throw new Error("x required");if(P==null||!e.isValid(P))throw new Error("y required");if(B==null||!e.isValid(B))throw new Error("z required")}static fromAffine(S){let{x:P,y:B}=S||{};if(!S||!e.isValid(P)||!e.isValid(B))throw new Error("invalid affine point");if(S instanceof A)throw new Error("projective point not allowed");let H=k=>e.eql(k,e.ZERO);return H(P)&&H(B)?A.ZERO:new A(P,B,e.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(S){let P=e.invertBatch(S.map(B=>B.pz));return S.map((B,H)=>B.toAffine(P[H])).map(A.fromAffine)}static fromHex(S){let P=A.fromAffine(o(vt("pointHex",S)));return P.assertValidity(),P}static fromPrivateKey(S){return A.BASE.multiply(p(S))}_setWindowSize(S){this._WINDOW_SIZE=S,h.delete(this)}assertValidity(){if(this.is0()){if(t.allowInfinityPoint&&!e.is0(this.py))return;throw new Error("bad point: ZERO")}let{x:S,y:P}=this.toAffine();if(!e.isValid(S)||!e.isValid(P))throw new Error("bad point: x or y not FE");let B=e.sqr(P),H=s(S);if(!e.eql(B,H))throw new Error("bad point: equation left != right");if(!this.isTorsionFree())throw new Error("bad point: not in prime-order subgroup")}hasEvenY(){let{y:S}=this.toAffine();if(e.isOdd)return!e.isOdd(S);throw new Error("Field doesn't support isOdd")}equals(S){y(S);let{px:P,py:B,pz:H}=this,{px:k,py:ee,pz:L}=S,W=e.eql(e.mul(P,L),e.mul(k,H)),J=e.eql(e.mul(B,L),e.mul(ee,H));return W&&J}negate(){return new A(this.px,e.neg(this.py),this.pz)}double(){let{a:S,b:P}=t,B=e.mul(P,Au),{px:H,py:k,pz:ee}=this,L=e.ZERO,W=e.ZERO,J=e.ZERO,X=e.mul(H,H),Oe=e.mul(k,k),xe=e.mul(ee,ee),ye=e.mul(H,k);return ye=e.add(ye,ye),J=e.mul(H,ee),J=e.add(J,J),L=e.mul(S,J),W=e.mul(B,xe),W=e.add(L,W),L=e.sub(Oe,W),W=e.add(Oe,W),W=e.mul(L,W),L=e.mul(ye,L),J=e.mul(B,J),xe=e.mul(S,xe),ye=e.sub(X,xe),ye=e.mul(S,ye),ye=e.add(ye,J),J=e.add(X,X),X=e.add(J,X),X=e.add(X,xe),X=e.mul(X,ye),W=e.add(W,X),xe=e.mul(k,ee),xe=e.add(xe,xe),X=e.mul(xe,ye),L=e.sub(L,X),J=e.mul(xe,Oe),J=e.add(J,J),J=e.add(J,J),new A(L,W,J)}add(S){y(S);let{px:P,py:B,pz:H}=this,{px:k,py:ee,pz:L}=S,W=e.ZERO,J=e.ZERO,X=e.ZERO,Oe=t.a,xe=e.mul(t.b,Au),ye=e.mul(P,k),Ve=e.mul(B,ee),Qe=e.mul(H,L),yt=e.add(P,B),O=e.add(k,ee);yt=e.mul(yt,O),O=e.add(ye,Ve),yt=e.sub(yt,O),O=e.add(P,H);let K=e.add(k,L);return O=e.mul(O,K),K=e.add(ye,Qe),O=e.sub(O,K),K=e.add(B,H),W=e.add(ee,L),K=e.mul(K,W),W=e.add(Ve,Qe),K=e.sub(K,W),X=e.mul(Oe,O),W=e.mul(xe,Qe),X=e.add(W,X),W=e.sub(Ve,X),X=e.add(Ve,X),J=e.mul(W,X),Ve=e.add(ye,ye),Ve=e.add(Ve,ye),Qe=e.mul(Oe,Qe),O=e.mul(xe,O),Ve=e.add(Ve,Qe),Qe=e.sub(ye,Qe),Qe=e.mul(Oe,Qe),O=e.add(O,Qe),ye=e.mul(Ve,O),J=e.add(J,ye),ye=e.mul(K,O),W=e.mul(yt,W),W=e.sub(W,ye),ye=e.mul(yt,Ve),X=e.mul(K,X),X=e.add(X,ye),new A(W,J,X)}subtract(S){return this.add(S.negate())}is0(){return this.equals(A.ZERO)}wNAF(S){return T.wNAFCached(this,h,S,P=>{let B=e.invertBatch(P.map(H=>H.pz));return P.map((H,k)=>H.toAffine(B[k])).map(A.fromAffine)})}multiplyUnsafe(S){let P=A.ZERO;if(S===gr)return P;if(u(S),S===Nt)return this;let{endo:B}=t;if(!B)return T.unsafeLadder(this,S);let{k1neg:H,k1:k,k2neg:ee,k2:L}=B.splitScalar(S),W=P,J=P,X=this;for(;k>gr||L>gr;)k&Nt&&(W=W.add(X)),L&Nt&&(J=J.add(X)),X=X.double(),k>>=Nt,L>>=Nt;return H&&(W=W.negate()),ee&&(J=J.negate()),J=new A(e.mul(J.px,B.beta),J.py,J.pz),W.add(J)}multiply(S){u(S);let P=S,B,H,{endo:k}=t;if(k){let{k1neg:ee,k1:L,k2neg:W,k2:J}=k.splitScalar(P),{p:X,f:Oe}=this.wNAF(L),{p:xe,f:ye}=this.wNAF(J);X=T.constTimeNegate(ee,X),xe=T.constTimeNegate(W,xe),xe=new A(e.mul(xe.px,k.beta),xe.py,xe.pz),B=X.add(xe),H=Oe.add(ye)}else{let{p:ee,f:L}=this.wNAF(P);B=ee,H=L}return A.normalizeZ([B,H])[0]}multiplyAndAddUnsafe(S,P,B){let H=A.BASE,k=(L,W)=>W===gr||W===Nt||!L.equals(H)?L.multiplyUnsafe(W):L.multiply(W),ee=k(this,P).add(k(S,B));return ee.is0()?void 0:ee}toAffine(S){let{px:P,py:B,pz:H}=this,k=this.is0();S==null&&(S=k?e.ONE:e.inv(H));let ee=e.mul(P,S),L=e.mul(B,S),W=e.mul(H,S);if(k)return{x:e.ZERO,y:e.ZERO};if(!e.eql(W,e.ONE))throw new Error("invZ was invalid");return{x:ee,y:L}}isTorsionFree(){let{h:S,isTorsionFree:P}=t;if(S===Nt)return!0;if(P)return P(A,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:S,clearCofactor:P}=t;return S===Nt?this:P?P(A,this):this.multiplyUnsafe(t.h)}toRawBytes(S=!0){return this.assertValidity(),n(A,this,S)}toHex(S=!0){return an(this.toRawBytes(S))}}A.BASE=new A(t.Gx,t.Gy,e.ONE),A.ZERO=new A(e.ZERO,e.ONE,e.ZERO);let _=t.nBitLength,T=mu(A,t.endo?Math.ceil(_/2):_);return{CURVE:t,ProjectivePoint:A,normPrivateKeyToScalar:p,weierstrassEquation:s,isWithinCurveOrder:a}}function ng(r){let t=ma(r);return Mr(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}function xu(r){let t=ng(r),{Fp:e,n}=t,o=e.BYTES+1,s=2*e.BYTES+1;function a(O){return gr<O&&O<e.ORDER}function u(O){return nt(O,n)}function p(O){return Ii(O,n)}let{ProjectivePoint:h,normPrivateKeyToScalar:y,weierstrassEquation:A,isWithinCurveOrder:_}=rg({...t,toBytes(O,K,se){let Ee=K.toAffine(),Ue=e.toBytes(Ee.x),We=Gn;return se?We(Uint8Array.from([K.hasEvenY()?2:3]),Ue):We(Uint8Array.from([4]),Ue,e.toBytes(Ee.y))},fromBytes(O){let K=O.length,se=O[0],Ee=O.subarray(1);if(K===o&&(se===2||se===3)){let Ue=pr(Ee);if(!a(Ue))throw new Error("Point is not on curve");let We=A(Ue),at=e.sqrt(We),Ne=(at&Nt)===Nt;return(se&1)===1!==Ne&&(at=e.neg(at)),{x:Ue,y:at}}else if(K===s&&se===4){let Ue=e.fromBytes(Ee.subarray(0,e.BYTES)),We=e.fromBytes(Ee.subarray(e.BYTES,2*e.BYTES));return{x:Ue,y:We}}else throw new Error(`Point of length ${K} was invalid. Expected ${o} compressed bytes or ${s} uncompressed bytes`)}}),T=O=>an(zr(O,t.nByteLength));function z(O){let K=n>>Nt;return O>K}function S(O){return z(O)?u(-O):O}let P=(O,K,se)=>pr(O.slice(K,se));class B{constructor(K,se,Ee){this.r=K,this.s=se,this.recovery=Ee,this.assertValidity()}static fromCompact(K){let se=t.nByteLength;return K=vt("compactSignature",K,se*2),new B(P(K,0,se),P(K,se,2*se))}static fromDER(K){let{r:se,s:Ee}=fn.toSig(vt("DER",K));return new B(se,Ee)}assertValidity(){if(!_(this.r))throw new Error("r must be 0 < r < CURVE.n");if(!_(this.s))throw new Error("s must be 0 < s < CURVE.n")}addRecoveryBit(K){return new B(this.r,this.s,K)}recoverPublicKey(K){let{r:se,s:Ee,recovery:Ue}=this,We=J(vt("msgHash",K));if(Ue==null||![0,1,2,3].includes(Ue))throw new Error("recovery id invalid");let at=Ue===2||Ue===3?se+t.n:se;if(at>=e.ORDER)throw new Error("recovery id 2 or 3 invalid");let Ne=Ue&1?"03":"02",Xe=h.fromHex(Ne+T(at)),ae=p(at),Je=u(-We*ae),Tr=u(Ee*ae),Mt=h.BASE.multiplyAndAddUnsafe(Xe,Je,Tr);if(!Mt)throw new Error("point at infinify");return Mt.assertValidity(),Mt}hasHighS(){return z(this.s)}normalizeS(){return this.hasHighS()?new B(this.r,u(-this.s),this.recovery):this}toDERRawBytes(){return cn(this.toDERHex())}toDERHex(){return fn.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return cn(this.toCompactHex())}toCompactHex(){return T(this.r)+T(this.s)}}let H={isValidPrivateKey(O){try{return y(O),!0}catch{return!1}},normPrivateKeyToScalar:y,randomPrivateKey:()=>{let O=ha(t.n);return yu(t.randomBytes(O),t.n)},precompute(O=8,K=h.BASE){return K._setWindowSize(O),K.multiply(BigInt(3)),K}};function k(O,K=!0){return h.fromPrivateKey(O).toRawBytes(K)}function ee(O){let K=O instanceof Uint8Array,se=typeof O=="string",Ee=(K||se)&&O.length;return K?Ee===o||Ee===s:se?Ee===2*o||Ee===2*s:O instanceof h}function L(O,K,se=!0){if(ee(O))throw new Error("first arg must be private key");if(!ee(K))throw new Error("second arg must be public key");return h.fromHex(K).multiply(y(O)).toRawBytes(se)}let W=t.bits2int||function(O){let K=pr(O),se=O.length*8-t.nBitLength;return se>0?K>>BigInt(se):K},J=t.bits2int_modN||function(O){return u(W(O))},X=_o(t.nBitLength);function Oe(O){if(typeof O!="bigint")throw new Error("bigint expected");if(!(gr<=O&&O<X))throw new Error(`bigint expected < 2^${t.nBitLength}`);return zr(O,t.nByteLength)}function xe(O,K,se=ye){if(["recovered","canonical"].some(Ct=>Ct in se))throw new Error("sign() legacy options not supported");let{hash:Ee,randomBytes:Ue}=t,{lowS:We,prehash:at,extraEntropy:Ne}=se;We==null&&(We=!0),O=vt("msgHash",O),at&&(O=vt("prehashed msgHash",Ee(O)));let Xe=J(O),ae=y(K),Je=[Oe(ae),Oe(Xe)];if(Ne!=null){let Ct=Ne===!0?Ue(e.BYTES):Ne;Je.push(vt("extraEntropy",Ct))}let Tr=Gn(...Je),Mt=Xe;function _r(Ct){let ir=W(Ct);if(!_(ir))return;let Vr=p(ir),bt=h.BASE.multiply(ir).toAffine(),vr=u(bt.x);if(vr===gr)return;let Nn=u(Vr*u(Mt+vr*ae));if(Nn===gr)return;let ei=(bt.x===vr?0:2)|Number(bt.y&Nt),io=Nn;return We&&z(Nn)&&(io=S(Nn),ei^=1),new B(vr,io,ei)}return{seed:Tr,k2sig:_r}}let ye={lowS:t.lowS,prehash:!1},Ve={lowS:t.lowS,prehash:!1};function Qe(O,K,se=ye){let{seed:Ee,k2sig:Ue}=xe(O,K,se),We=t;return fa(We.hash.outputLen,We.nByteLength,We.hmac)(Ee,Ue)}h.BASE._setWindowSize(8);function yt(O,K,se,Ee=Ve){let Ue=O;if(K=vt("msgHash",K),se=vt("publicKey",se),"strict"in Ee)throw new Error("options.strict was renamed to lowS");let{lowS:We,prehash:at}=Ee,Ne,Xe;try{if(typeof Ue=="string"||Ue instanceof Uint8Array)try{Ne=B.fromDER(Ue)}catch(bt){if(!(bt instanceof fn.Err))throw bt;Ne=B.fromCompact(Ue)}else if(typeof Ue=="object"&&typeof Ue.r=="bigint"&&typeof Ue.s=="bigint"){let{r:bt,s:vr}=Ue;Ne=new B(bt,vr)}else throw new Error("PARSE");Xe=h.fromHex(se)}catch(bt){if(bt.message==="PARSE")throw new Error("signature must be Signature instance, Uint8Array or hex string");return!1}if(We&&Ne.hasHighS())return!1;at&&(K=t.hash(K));let{r:ae,s:Je}=Ne,Tr=J(K),Mt=p(Je),_r=u(Tr*Mt),Ct=u(ae*Mt),ir=h.BASE.multiplyAndAddUnsafe(Xe,_r,Ct)?.toAffine();return ir?u(ir.x)===ae:!1}return{CURVE:t,getPublicKey:k,getSharedSecret:L,sign:Qe,verify:yt,ProjectivePoint:h,Signature:B,utils:H}}function og(r){return{hash:r,hmac:(t,...e)=>Yt(r,t,Jr(...e)),randomBytes:Lc}}function bu(r,t){let e=n=>xu({...r,...og(n)});return Object.freeze({...e(t),create:e})}var _u=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),wu=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ig=BigInt(1),Aa=BigInt(2),Tu=(r,t)=>(r+t/Aa)/t;function sg(r){let t=_u,e=BigInt(3),n=BigInt(6),o=BigInt(11),s=BigInt(22),a=BigInt(23),u=BigInt(44),p=BigInt(88),h=r*r*r%t,y=h*h*r%t,A=St(y,e,t)*y%t,_=St(A,e,t)*y%t,T=St(_,Aa,t)*h%t,z=St(T,o,t)*T%t,S=St(z,s,t)*z%t,P=St(S,u,t)*S%t,B=St(P,p,t)*P%t,H=St(B,u,t)*S%t,k=St(H,e,t)*y%t,ee=St(k,a,t)*z%t,L=St(ee,n,t)*h%t,W=St(L,Aa,t);if(!xa.eql(xa.sqr(W),r))throw new Error("Cannot find square root");return W}var xa=gu(_u,void 0,void 0,{sqrt:sg}),lt=bu({a:BigInt(0),b:BigInt(7),Fp:xa,n:wu,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:r=>{let t=wu,e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-ig*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),s=e,a=BigInt("0x100000000000000000000000000000000"),u=Tu(s*r,t),p=Tu(-n*r,t),h=nt(r-u*e-p*o,t),y=nt(-u*n-p*s,t),A=h>a,_=y>a;if(A&&(h=t-h),_&&(y=t-y),h>a||y>a)throw new Error("splitScalar: Endomorphism failed, k="+r);return{k1neg:A,k1:h,k2neg:_,k2:y}}}},bo),O0=BigInt(0);var N0=lt.ProjectivePoint;var ag=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Su=Uint8Array.from({length:16},(r,t)=>t),cg=Su.map(r=>(9*r+5)%16),wa=[Su],Ta=[cg];for(let r=0;r<4;r++)for(let t of[wa,Ta])t.push(t[r].map(e=>ag[e]));var Eu=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(r=>new Uint8Array(r)),ug=wa.map((r,t)=>r.map(e=>Eu[t][e])),fg=Ta.map((r,t)=>r.map(e=>Eu[t][e])),dg=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),lg=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),Pi=(r,t)=>r<<t|r>>>32-t;function vu(r,t,e,n){return r===0?t^e^n:r===1?t&e|~t&n:r===2?(t|~e)^n:r===3?t&n|e&~n:t^(e|~n)}var Ri=new Uint32Array(16),ba=class extends Ir{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){let{h0:t,h1:e,h2:n,h3:o,h4:s}=this;return[t,e,n,o,s]}set(t,e,n,o,s){this.h0=t|0,this.h1=e|0,this.h2=n|0,this.h3=o|0,this.h4=s|0}process(t,e){for(let T=0;T<16;T++,e+=4)Ri[T]=t.getUint32(e,!0);let n=this.h0|0,o=n,s=this.h1|0,a=s,u=this.h2|0,p=u,h=this.h3|0,y=h,A=this.h4|0,_=A;for(let T=0;T<5;T++){let z=4-T,S=dg[T],P=lg[T],B=wa[T],H=Ta[T],k=ug[T],ee=fg[T];for(let L=0;L<16;L++){let W=Pi(n+vu(T,s,u,h)+Ri[B[L]]+S,k[L])+A|0;n=A,A=h,h=Pi(u,10)|0,u=s,s=W}for(let L=0;L<16;L++){let W=Pi(o+vu(z,a,p,y)+Ri[H[L]]+P,ee[L])+_|0;o=_,_=y,y=Pi(p,10)|0,p=a,a=W}}this.set(this.h1+u+y|0,this.h2+h+_|0,this.h3+A+o|0,this.h4+n+a|0,this.h0+s+p|0)}roundClean(){Ri.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}},Cu=Er(()=>new ba);var Bi=lt.ProjectivePoint,_a=nu(bo);function Uu(r){return BigInt(`0x${Zr(r)}`)}function pg(r){return Dn(r.toString(16).padStart(64,"0"))}var gg=Qs("Bitcoin seed"),va={private:76066276,public:76067358},Sa=2147483648,hg=r=>Cu(bo(r)),yg=r=>jt(r).getUint32(0,!1),Oi=r=>{if(!Number.isSafeInteger(r)||r<0||r>2**32-1)throw new Error(`Invalid number=${r}. Should be from 0 to 2 ** 32 - 1`);let t=new Uint8Array(4);return jt(t).setUint32(0,r,!1),t},Ni=class r{get fingerprint(){if(!this.pubHash)throw new Error("No publicKey set!");return yg(this.pubHash)}get identifier(){return this.pubHash}get pubKeyHash(){return this.pubHash}get privateKey(){return this.privKeyBytes||null}get publicKey(){return this.pubKey||null}get privateExtendedKey(){let t=this.privateKey;if(!t)throw new Error("No private key");return _a.encode(this.serialize(this.versions.private,Jr(new Uint8Array([0]),t)))}get publicExtendedKey(){if(!this.pubKey)throw new Error("No public key");return _a.encode(this.serialize(this.versions.public,this.pubKey))}static fromMasterSeed(t,e=va){if(Lt(t),8*t.length<128||8*t.length>512)throw new Error(`HDKey: wrong seed length=${t.length}. Should be between 128 and 512 bits; 256 bits is advised)`);let n=Yt(on,gg,t);return new r({versions:e,chainCode:n.slice(32),privateKey:n.slice(0,32)})}static fromExtendedKey(t,e=va){let n=_a.decode(t),o=jt(n),s=o.getUint32(0,!1),a={versions:e,depth:n[4],parentFingerprint:o.getUint32(5,!1),index:o.getUint32(9,!1),chainCode:n.slice(13,45)},u=n.slice(45),p=u[0]===0;if(s!==e[p?"private":"public"])throw new Error("Version mismatch");return p?new r({...a,privateKey:u.slice(1)}):new r({...a,publicKey:u})}static fromJSON(t){return r.fromExtendedKey(t.xpriv)}constructor(t){if(this.depth=0,this.index=0,this.chainCode=null,this.parentFingerprint=0,!t||typeof t!="object")throw new Error("HDKey.constructor must not be called directly");if(this.versions=t.versions||va,this.depth=t.depth||0,this.chainCode=t.chainCode,this.index=t.index||0,this.parentFingerprint=t.parentFingerprint||0,!this.depth&&(this.parentFingerprint||this.index))throw new Error("HDKey: zero depth with non-zero index/parent fingerprint");if(t.publicKey&&t.privateKey)throw new Error("HDKey: publicKey and privateKey at same time.");if(t.privateKey){if(!lt.utils.isValidPrivateKey(t.privateKey))throw new Error("Invalid private key");this.privKey=typeof t.privateKey=="bigint"?t.privateKey:Uu(t.privateKey),this.privKeyBytes=pg(this.privKey),this.pubKey=lt.getPublicKey(t.privateKey,!0)}else if(t.publicKey)this.pubKey=Bi.fromHex(t.publicKey).toRawBytes(!0);else throw new Error("HDKey: no public or private key provided");this.pubHash=hg(this.pubKey)}derive(t){if(!/^[mM]'?/.test(t))throw new Error('Path must start with "m" or "M"');if(/^[mM]'?$/.test(t))return this;let e=t.replace(/^[mM]'?\//,"").split("/"),n=this;for(let o of e){let s=/^(\d+)('?)$/.exec(o),a=s&&s[1];if(!s||s.length!==3||typeof a!="string")throw new Error(`Invalid child index: ${o}`);let u=+a;if(!Number.isSafeInteger(u)||u>=Sa)throw new Error("Invalid index");s[2]==="'"&&(u+=Sa),n=n.deriveChild(u)}return n}deriveChild(t){if(!this.pubKey||!this.chainCode)throw new Error("No publicKey or chainCode set");let e=Oi(t);if(t>=Sa){let u=this.privateKey;if(!u)throw new Error("Could not derive hardened child key");e=Jr(new Uint8Array([0]),u,e)}else e=Jr(this.pubKey,e);let n=Yt(on,this.chainCode,e),o=Uu(n.slice(0,32)),s=n.slice(32);if(!lt.utils.isValidPrivateKey(o))throw new Error("Tweak bigger than curve order");let a={versions:this.versions,chainCode:s,depth:this.depth+1,parentFingerprint:this.fingerprint,index:t};try{if(this.privateKey){let u=nt(this.privKey+o,lt.CURVE.n);if(!lt.utils.isValidPrivateKey(u))throw new Error("The tweak was out of range or the resulted private key is invalid");a.privateKey=u}else{let u=Bi.fromHex(this.pubKey).add(Bi.fromPrivateKey(o));if(u.equals(Bi.ZERO))throw new Error("The tweak was equal to negative P, which made the result key invalid");a.publicKey=u.toRawBytes(!0)}return new r(a)}catch{return this.deriveChild(t+1)}}sign(t){if(!this.privateKey)throw new Error("No privateKey set!");return Lt(t,32),lt.sign(t,this.privKey).toCompactRawBytes()}verify(t,e){if(Lt(t,32),Lt(e,64),!this.publicKey)throw new Error("No publicKey set!");let n;try{n=lt.Signature.fromCompact(e)}catch{return!1}return lt.verify(n,t,this.publicKey)}wipePrivateData(){return this.privKey=void 0,this.privKeyBytes&&(this.privKeyBytes.fill(0),this.privKeyBytes=void 0),this}toJSON(){return{xpriv:this.privateExtendedKey,xpub:this.publicExtendedKey}}serialize(t,e){if(!this.chainCode)throw new Error("No chainCode set");return Lt(e,33),Jr(Oi(t),new Uint8Array([this.depth]),Oi(this.parentFingerprint),Oi(this.index),this.chainCode,e)}};var qr=class qr extends _t{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==qr.LENGTH)throw new Error(`PublicKey length should be ${qr.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}verifySignature(e){let{message:n,signature:o}=e,s=me.fromHexInput(n).toUint8Array(),a=rn(s),u=o.toUint8Array();return lt.verify(u,a,this.toUint8Array())}serialize(e){e.serializeBytes(this.key.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new qr(n)}static load(e){let n=e.deserializeBytes();return new qr(n)}static isPublicKey(e){return e instanceof qr}};qr.LENGTH=65;var kt=qr,Xt=class Xt extends nn{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==Xt.LENGTH)throw new Error(`PrivateKey length should be ${Xt.LENGTH}`);this.key=n}toUint8Array(){return this.key.toUint8Array()}toString(){return this.key.toString()}sign(e){let n=me.fromHexInput(e),o=rn(n.toUint8Array()),s=lt.sign(o,this.key.toUint8Array());return new yr(s.toCompactRawBytes())}serialize(e){e.serializeBytes(this.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Xt(n)}static generate(){let e=lt.utils.randomPrivateKey();return new Xt(e)}publicKey(){let e=lt.getPublicKey(this.key.toUint8Array(),!1);return new kt(e)}static fromDerivationPath(e,n){if(!oa(e))throw new Error(`Invalid derivation path ${e}`);return Xt.fromDerivationPathInner(e,wo(n))}static fromDerivationPathInner(e,n){let{privateKey:o}=Ni.fromMasterSeed(n).derive(e);if(o===null)throw new Error("Invalid key");return new Xt(o)}static isPrivateKey(e){return e instanceof Xt}};Xt.LENGTH=32;var hr=Xt,Dr=class Dr extends Ft{constructor(e){super();let n=me.fromHexInput(e);if(n.toUint8Array().length!==Dr.LENGTH)throw new Error(`Signature length should be ${Dr.LENGTH}, recieved ${n.toUint8Array().length}`);this.data=n}toUint8Array(){return this.data.toUint8Array()}toString(){return this.data.toString()}serialize(e){e.serializeBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeBytes();return new Dr(n)}static load(e){let n=e.deserializeBytes();return new Dr(n)}static isSignature(e){return e instanceof Dr}};Dr.LENGTH=64;var yr=Dr;var Me=class r extends _t{constructor(e){super();this.publicKey=e}toUint8Array(){return this.publicKey.toUint8Array()}toString(){return this.publicKey.toString()}verifySignature(e){let{message:n,signature:o}=e;return this.publicKey.verifySignature({message:n,signature:o})}serialize(e){if(this.publicKey instanceof Be)e.serializeU32AsUleb128(0),this.publicKey.serialize(e);else if(this.publicKey instanceof kt)e.serializeU32AsUleb128(1),this.publicKey.serialize(e);else throw new Error("Unknown public key type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Be.load(e));case 1:return new r(kt.load(e));default:throw new Error(`Unknown variant index for AnyPublicKey: ${n}`)}}static isPublicKey(e){return e instanceof r}isEd25519(){return this.publicKey instanceof Be}isSecp256k1PublicKey(){return this.publicKey instanceof kt}};var dn=class r extends _t{constructor(e){super();let{publicKeys:n,signaturesRequired:o}=e;if(o<1)throw new Error("The number of required signatures needs to be greater then 0");if(n.length<o)throw new Error(`Provided ${n.length} public keys is smaller than the ${o} required signatures`);let s=[];n.forEach(a=>{a instanceof Me?s.push(a):s.push(new Me(a))}),this.publicKeys=s,this.signaturesRequired=o}toUint8Array(){return this.bcsToBytes()}createBitmap(e){let{bits:n}=e,o=128,s=new Uint8Array([0,0,0,0]),a=new Set;return n.forEach((u,p)=>{if(p+1>this.publicKeys.length)throw new Error(`Signature index ${p+1} is out of public keys range, ${this.publicKeys.length}.`);if(a.has(u))throw new Error(`Duplicate bit ${u} detected.`);a.add(u);let h=Math.floor(u/8),y=s[h];y|=o>>u%8,s[h]=y}),s}toString(){return me.fromHexInput(this.toUint8Array()).toString()}verifySignature(e){throw new Error("not implemented")}serialize(e){e.serializeVector(this.publicKeys),e.serializeU8(this.signaturesRequired)}static deserialize(e){let n=e.deserializeVector(Me),o=e.deserializeU8();return new r({publicKeys:n,signaturesRequired:o})}};var mr=class mr extends Z{constructor(e){super();let{data:n}=e,o=me.fromHexInput(n);if(o.toUint8Array().length!==mr.LENGTH)throw new Error(`Authentication Key length should be ${mr.LENGTH}`);this.data=o}serialize(e){e.serializeFixedBytes(this.data.toUint8Array())}static deserialize(e){let n=e.deserializeFixedBytes(mr.LENGTH);return new mr({data:n})}toString(){return this.data.toString()}toUint8Array(){return this.data.toUint8Array()}static fromPublicKeyAndScheme(e){let{publicKey:n,scheme:o}=e,s;switch(o){case 3:case 2:{let p=n.bcsToBytes();s=new Uint8Array([...p,o]);break}case 0:case 1:{let p=n.toUint8Array(),h=me.fromHexInput(p).toUint8Array();s=new Uint8Array([...h,o]);break}default:throw new Error(`Scheme ${o} is not supported`)}let a=rn.create();a.update(s);let u=a.digest();return new mr({data:u})}static fromPublicKey(e){let{publicKey:n}=e,o;if(n instanceof Be)o=0 .valueOf();else if(n instanceof Kt)o=1 .valueOf();else if(n instanceof Me)o=2 .valueOf();else if(n instanceof dn)o=3 .valueOf();else throw new Error("No supported authentication scheme for public key");return mr.fromPublicKeyAndScheme({publicKey:n,scheme:o})}derivedAddress(){return new N(this.data.toUint8Array())}};mr.LENGTH=32;var $t=mr;var Ar=class r{constructor(t){let{privateKey:e,address:n,legacy:o}=t,s=o??!0;if(this.publicKey=e.publicKey(),this.publicKey instanceof Be)s?this.signingScheme=0:(this.publicKey=new Me(this.publicKey),this.signingScheme=2);else if(this.publicKey instanceof Kt)this.signingScheme=1;else if(this.publicKey instanceof kt)this.publicKey=new Me(this.publicKey),this.signingScheme=2;else throw new Error("Can not create new Account, unsupported public key type");this.privateKey=e,this.accountAddress=n}static generate(t){let e=t?.legacy??!0,n,o;switch(t?.scheme){case 2:n=hr.generate(),o=new Me(n.publicKey());break;default:n=lr.generate(),e===!1?o=new Me(n.publicKey()):o=n.publicKey()}let a=$t.fromPublicKey({publicKey:o}).derivedAddress();return new r({privateKey:n,address:a,legacy:t?.legacy})}static fromPrivateKey(t){let{privateKey:e,legacy:n}=t,o=n??!0,s;if(e instanceof hr)s=new Me(e.publicKey());else if(e instanceof lr)o?s=e.publicKey():s=new Me(e.publicKey());else throw new Error(`Unsupported private key ${e}`);let u=$t.fromPublicKey({publicKey:s}).derivedAddress();return new r({privateKey:e,address:u,legacy:o})}static fromPrivateKeyAndAddress(t){let{privateKey:e,address:n,legacy:o}=t;return new r({privateKey:e,address:n,legacy:o})}static fromDerivationPath(t){let{path:e,mnemonic:n,scheme:o,legacy:s}=t,a;switch(o){case 2:a=hr.fromDerivationPath(e,n);break;case 0:a=lr.fromDerivationPath(e,n);break;default:throw new Error(`Unsupported scheme ${o}`)}return r.fromPrivateKey({privateKey:a,legacy:s})}static authKey(t){let{publicKey:e}=t;return $t.fromPublicKey({publicKey:e})}sign(t){return this.privateKey.sign(t)}verifySignature(t){let{message:e,signature:n}=t,o=me.fromHexInput(e).toUint8Array();return this.publicKey.verifySignature({message:o,signature:n})}};var mg=`
|
|
3
3
|
fragment TokenActivitiesFields on token_activities_v2 {
|
|
4
4
|
after_value
|
|
5
5
|
before_value
|
|
@@ -17,7 +17,17 @@
|
|
|
17
17
|
transaction_version
|
|
18
18
|
type
|
|
19
19
|
}
|
|
20
|
-
`,
|
|
20
|
+
`,Ag=`
|
|
21
|
+
fragment AnsTokenFragment on current_aptos_names {
|
|
22
|
+
domain
|
|
23
|
+
expiration_timestamp
|
|
24
|
+
registered_address
|
|
25
|
+
subdomain
|
|
26
|
+
token_standard
|
|
27
|
+
is_primary
|
|
28
|
+
owner_address
|
|
29
|
+
}
|
|
30
|
+
`,ki=`
|
|
21
31
|
fragment CurrentTokenOwnershipFields on current_token_ownerships_v2 {
|
|
22
32
|
token_standard
|
|
23
33
|
token_properties_mutated_v1
|
|
@@ -63,7 +73,7 @@
|
|
|
63
73
|
}
|
|
64
74
|
}
|
|
65
75
|
}
|
|
66
|
-
`,
|
|
76
|
+
`,Iu=`
|
|
67
77
|
query getAccountCoinsCount($address: String) {
|
|
68
78
|
current_fungible_asset_balances_aggregate(
|
|
69
79
|
where: {owner_address: {_eq: $address}}
|
|
@@ -73,7 +83,7 @@
|
|
|
73
83
|
}
|
|
74
84
|
}
|
|
75
85
|
}
|
|
76
|
-
`,
|
|
86
|
+
`,Pu=`
|
|
77
87
|
query getAccountCoinsData($where_condition: current_fungible_asset_balances_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_fungible_asset_balances_order_by!]) {
|
|
78
88
|
current_fungible_asset_balances(
|
|
79
89
|
where: $where_condition
|
|
@@ -106,7 +116,7 @@
|
|
|
106
116
|
}
|
|
107
117
|
}
|
|
108
118
|
}
|
|
109
|
-
`,
|
|
119
|
+
`,Ru=`
|
|
110
120
|
query getAccountCollectionsWithOwnedTokens($where_condition: current_collection_ownership_v2_view_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_collection_ownership_v2_view_order_by!]) {
|
|
111
121
|
current_collection_ownership_v2_view(
|
|
112
122
|
where: $where_condition
|
|
@@ -140,7 +150,7 @@
|
|
|
140
150
|
single_token_uri
|
|
141
151
|
}
|
|
142
152
|
}
|
|
143
|
-
`,
|
|
153
|
+
`,Bu=`
|
|
144
154
|
query getAccountOwnedObjects($where_condition: current_objects_bool_exp, $offset: Int, $limit: Int, $order_by: [current_objects_order_by!]) {
|
|
145
155
|
current_objects(
|
|
146
156
|
where: $where_condition
|
|
@@ -157,7 +167,7 @@
|
|
|
157
167
|
is_deleted
|
|
158
168
|
}
|
|
159
169
|
}
|
|
160
|
-
`,
|
|
170
|
+
`,Ou=`
|
|
161
171
|
query getAccountOwnedTokens($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
162
172
|
current_token_ownerships_v2(
|
|
163
173
|
where: $where_condition
|
|
@@ -168,7 +178,7 @@
|
|
|
168
178
|
...CurrentTokenOwnershipFields
|
|
169
179
|
}
|
|
170
180
|
}
|
|
171
|
-
${
|
|
181
|
+
${ki}`,kA=`
|
|
172
182
|
query getAccountOwnedTokensByTokenData($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
173
183
|
current_token_ownerships_v2(
|
|
174
184
|
where: $where_condition
|
|
@@ -179,7 +189,7 @@
|
|
|
179
189
|
...CurrentTokenOwnershipFields
|
|
180
190
|
}
|
|
181
191
|
}
|
|
182
|
-
${
|
|
192
|
+
${ki}`,Nu=`
|
|
183
193
|
query getAccountOwnedTokensFromCollection($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
184
194
|
current_token_ownerships_v2(
|
|
185
195
|
where: $where_condition
|
|
@@ -190,7 +200,7 @@
|
|
|
190
200
|
...CurrentTokenOwnershipFields
|
|
191
201
|
}
|
|
192
202
|
}
|
|
193
|
-
${
|
|
203
|
+
${ki}`,ku=`
|
|
194
204
|
query getAccountTokensCount($where_condition: current_token_ownerships_v2_bool_exp, $offset: Int, $limit: Int) {
|
|
195
205
|
current_token_ownerships_v2_aggregate(
|
|
196
206
|
where: $where_condition
|
|
@@ -202,7 +212,7 @@
|
|
|
202
212
|
}
|
|
203
213
|
}
|
|
204
214
|
}
|
|
205
|
-
`,
|
|
215
|
+
`,zu=`
|
|
206
216
|
query getAccountTransactionsCount($address: String) {
|
|
207
217
|
account_transactions_aggregate(where: {account_address: {_eq: $address}}) {
|
|
208
218
|
aggregate {
|
|
@@ -210,13 +220,13 @@
|
|
|
210
220
|
}
|
|
211
221
|
}
|
|
212
222
|
}
|
|
213
|
-
`,
|
|
223
|
+
`,Mu=`
|
|
214
224
|
query getChainTopUserTransactions($limit: Int) {
|
|
215
225
|
user_transactions(limit: $limit, order_by: {version: desc}) {
|
|
216
226
|
version
|
|
217
227
|
}
|
|
218
228
|
}
|
|
219
|
-
`,
|
|
229
|
+
`,qu=`
|
|
220
230
|
query getCollectionData($where_condition: current_collections_v2_bool_exp!) {
|
|
221
231
|
current_collections_v2(where: $where_condition) {
|
|
222
232
|
collection_id
|
|
@@ -235,7 +245,7 @@
|
|
|
235
245
|
uri
|
|
236
246
|
}
|
|
237
247
|
}
|
|
238
|
-
`,
|
|
248
|
+
`,Du=`
|
|
239
249
|
query getCurrentFungibleAssetBalances($where_condition: current_fungible_asset_balances_bool_exp, $offset: Int, $limit: Int) {
|
|
240
250
|
current_fungible_asset_balances(
|
|
241
251
|
where: $where_condition
|
|
@@ -253,7 +263,7 @@
|
|
|
253
263
|
token_standard
|
|
254
264
|
}
|
|
255
265
|
}
|
|
256
|
-
`,
|
|
266
|
+
`,Gu=`
|
|
257
267
|
query getDelegatedStakingActivities($delegatorAddress: String, $poolAddress: String) {
|
|
258
268
|
delegated_staking_activities(
|
|
259
269
|
where: {delegator_address: {_eq: $delegatorAddress}, pool_address: {_eq: $poolAddress}}
|
|
@@ -266,7 +276,7 @@
|
|
|
266
276
|
transaction_version
|
|
267
277
|
}
|
|
268
278
|
}
|
|
269
|
-
`,
|
|
279
|
+
`,Lu=`
|
|
270
280
|
query getEvents($where_condition: events_bool_exp, $offset: Int, $limit: Int, $order_by: [events_order_by!]) {
|
|
271
281
|
events(
|
|
272
282
|
where: $where_condition
|
|
@@ -285,7 +295,7 @@
|
|
|
285
295
|
indexed_type
|
|
286
296
|
}
|
|
287
297
|
}
|
|
288
|
-
`,
|
|
298
|
+
`,Fu=`
|
|
289
299
|
query getFungibleAssetActivities($where_condition: fungible_asset_activities_bool_exp, $offset: Int, $limit: Int) {
|
|
290
300
|
fungible_asset_activities(
|
|
291
301
|
where: $where_condition
|
|
@@ -310,7 +320,7 @@
|
|
|
310
320
|
type
|
|
311
321
|
}
|
|
312
322
|
}
|
|
313
|
-
`,
|
|
323
|
+
`,Ku=`
|
|
314
324
|
query getFungibleAssetMetadata($where_condition: fungible_asset_metadata_bool_exp, $offset: Int, $limit: Int) {
|
|
315
325
|
fungible_asset_metadata(where: $where_condition, offset: $offset, limit: $limit) {
|
|
316
326
|
icon_uri
|
|
@@ -327,22 +337,33 @@
|
|
|
327
337
|
token_standard
|
|
328
338
|
}
|
|
329
339
|
}
|
|
330
|
-
`,
|
|
331
|
-
query
|
|
340
|
+
`,Ln=`
|
|
341
|
+
query getNames($offset: Int, $limit: Int, $where_condition: current_aptos_names_bool_exp, $order_by: [current_aptos_names_order_by!]) {
|
|
342
|
+
current_aptos_names(
|
|
343
|
+
limit: $limit
|
|
344
|
+
where: $where_condition
|
|
345
|
+
order_by: $order_by
|
|
346
|
+
offset: $offset
|
|
347
|
+
) {
|
|
348
|
+
...AnsTokenFragment
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
${Ag}`,Ea=`
|
|
352
|
+
query getNumberOfDelegators($where_condition: num_active_delegator_per_pool_bool_exp, $order_by: [num_active_delegator_per_pool_order_by!]) {
|
|
332
353
|
num_active_delegator_per_pool(where: $where_condition, order_by: $order_by) {
|
|
333
354
|
num_active_delegator
|
|
334
355
|
pool_address
|
|
335
356
|
}
|
|
336
357
|
}
|
|
337
|
-
`,
|
|
338
|
-
query getProcessorStatus {
|
|
339
|
-
processor_status {
|
|
358
|
+
`,Ca=`
|
|
359
|
+
query getProcessorStatus($where_condition: processor_status_bool_exp) {
|
|
360
|
+
processor_status(where: $where_condition) {
|
|
340
361
|
last_success_version
|
|
341
362
|
processor
|
|
342
363
|
last_updated
|
|
343
364
|
}
|
|
344
365
|
}
|
|
345
|
-
|
|
366
|
+
`,$u=`
|
|
346
367
|
query getTokenActivity($where_condition: token_activities_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [token_activities_v2_order_by!]) {
|
|
347
368
|
token_activities_v2(
|
|
348
369
|
where: $where_condition
|
|
@@ -353,7 +374,7 @@
|
|
|
353
374
|
...TokenActivitiesFields
|
|
354
375
|
}
|
|
355
376
|
}
|
|
356
|
-
${
|
|
377
|
+
${mg}`,Ua=`
|
|
357
378
|
query getCurrentTokenOwnership($where_condition: current_token_ownerships_v2_bool_exp!, $offset: Int, $limit: Int, $order_by: [current_token_ownerships_v2_order_by!]) {
|
|
358
379
|
current_token_ownerships_v2(
|
|
359
380
|
where: $where_condition
|
|
@@ -364,7 +385,7 @@
|
|
|
364
385
|
...CurrentTokenOwnershipFields
|
|
365
386
|
}
|
|
366
387
|
}
|
|
367
|
-
${
|
|
388
|
+
${ki}`,Hu=`
|
|
368
389
|
query getTokenData($where_condition: current_token_datas_v2_bool_exp, $offset: Int, $limit: Int, $order_by: [current_token_datas_v2_order_by!]) {
|
|
369
390
|
current_token_datas_v2(
|
|
370
391
|
where: $where_condition
|
|
@@ -403,7 +424,7 @@
|
|
|
403
424
|
}
|
|
404
425
|
}
|
|
405
426
|
}
|
|
406
|
-
`;async function mi(r){let{aptosConfig:t}=r,{data:e}=await lt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function bu(r){let{aptosConfig:t,ledgerVersion:e,options:n}=r,{data:o}=await lt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function wu(r){let{aptosConfig:t,blockHeight:e,options:n}=r,{data:o}=await lt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function xi(r){let{aptosConfig:t,handle:e,data:n,options:o}=r;return(await Gr({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:n})).data}async function Ai(r){let{aptosConfig:t,payload:e,options:n}=r,{data:o}=await Gr({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:n?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function Tu(r){let{aptosConfig:t,limit:e}=r;return(await Ce({aptosConfig:t,query:{query:fu,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function Ce(r){let{aptosConfig:t,query:e,originMethod:n}=r,{data:o}=await bs({aptosConfig:t,originMethod:n??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function Ep(r){let{aptosConfig:t}=r;return(await Ce({aptosConfig:t,query:{query:mu},originMethod:"getProcessorStatuses"})).processor_status}async function bi(r){return(await Ep({aptosConfig:r.aptosConfig}))[0].last_success_version}var na=new Map;function Pn(r,t,e){return async(...n)=>{if(na.has(t)){let{value:s,timestamp:c}=na.get(t);if(e===void 0||Date.now()-c<=e)return s}let o=await r(...n);return na.set(t,{value:o,timestamp:Date.now()}),o}}async function on(r){let{aptosConfig:t,accountAddress:e}=r,{data:n}=await lt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${k.from(e).toString()}`});return n}async function Eu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return qr({aptosConfig:t,originMethod:"getModules",path:`accounts/${k.from(e).toString()}/modules`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??1e3}})}async function wi(r){return r.options?.ledgerVersion!==void 0?vu(r):Pn(async()=>vu(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function vu(r){let{aptosConfig:t,accountAddress:e,moduleName:n,options:o}=r,{data:s}=await lt({aptosConfig:t,originMethod:"getModule",path:`accounts/${k.from(e).toString()}/module/${n}`,params:{ledger_version:o?.ledgerVersion}});return s}async function Su(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return qr({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${k.from(e).toString()}/transactions`,params:{start:n?.offset,limit:n?.limit}})}async function Uu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return qr({aptosConfig:t,originMethod:"getResources",path:`accounts/${k.from(e).toString()}/resources`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??999}})}async function oa(r){let{aptosConfig:t,accountAddress:e,resourceType:n,options:o}=r,{data:s}=await lt({aptosConfig:t,originMethod:"getResource",path:`accounts/${k.from(e).toString()}/resource/${n}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function ia(r){let{aptosConfig:t,authenticationKey:e,options:n}=r,o=await oa({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:s}}=o,c=k.from(e);try{let u=await xi({aptosConfig:t,handle:s,data:{key:c.toString(),key_type:"address",value_type:"address"},options:n});return k.from(u)}catch(u){if(u instanceof Vt&&u.data.error_code==="table_item_not_found")return c;throw u}}async function Cu(r){let{aptosConfig:t,accountAddress:e}=r,o={owner_address:{_eq:k.from(e).toStringLong()},amount:{_gt:0}},c=await Ce({aptosConfig:t,query:{query:cu,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});if(!c.current_token_ownerships_v2_aggregate.aggregate)throw Error("Failed to get the count of account tokens");return c.current_token_ownerships_v2_aggregate.aggregate.count}async function Iu(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.token_standard={_eq:n?.tokenStandard});let c={query:su,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function Bu(r){let{aptosConfig:t,accountAddress:e,collectionAddress:n,options:o}=r,s=k.from(e).toStringLong(),c=k.from(n).toStringLong(),u={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:c}},amount:{_gt:0}};o?.tokenStandard&&(u.token_standard={_eq:o?.tokenStandard});let p={query:au,variables:{where_condition:u,offset:o?.pagination?.offset,limit:o?.pagination?.limit,order_by:o?.orderBy}};return(await Ce({aptosConfig:t,query:p,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function Ru(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.current_collection={token_standard:{_eq:n?.tokenStandard}});let c={query:ou,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function Pu(r){let{aptosConfig:t,accountAddress:e}=r,n=k.from(e).toStringLong(),s=await Ce({aptosConfig:t,query:{query:uu,variables:{address:n}},originMethod:"getAccountTransactionsCount"});if(!s.account_transactions_aggregate.aggregate)throw Error("Failed to get the count of account transactions");return s.account_transactions_aggregate.aggregate.count}async function ku(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()}},c={query:nu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function Ou(r){let{aptosConfig:t,accountAddress:e}=r,n=k.from(e).toStringLong(),s=await Ce({aptosConfig:t,query:{query:ru,variables:{address:n}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function zu(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:k.from(e).toStringLong()}},c={query:iu,variables:{where_condition:s,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:c,originMethod:"getAccountOwnedObjects"})).current_objects}async function Nu(r){let{aptosConfig:t,privateKey:e}=r,n=new Ye(e.publicKey());if(e instanceof cr){let s=Gt.fromPublicKeyAndScheme({publicKey:n,scheme:2}).derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof or){let o=Gt.fromPublicKeyAndScheme({publicKey:n,scheme:2});if(await _u({authKey:o,aptosConfig:t})){let p=o.derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!1})}let c=Gt.fromPublicKeyAndScheme({publicKey:n,scheme:0});if(await _u({authKey:c,aptosConfig:t})){let p=c.derivedAddress();return dr.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function _u(r){let{aptosConfig:t,authKey:e}=r,n=await ia({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await on({aptosConfig:t,accountAddress:n}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${n.toString()}`)}}var lo=class{constructor(t){this.config=t}async getAccountInfo(t){return on({aptosConfig:this.config,...t})}async getAccountModules(t){return Eu({aptosConfig:this.config,...t})}async getAccountModule(t){return wi({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Su({aptosConfig:this.config,...t})}async getAccountResources(t){return Uu({aptosConfig:this.config,...t})}async getAccountResource(t){return oa({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return ia({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return Cu({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return Iu({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return Bu({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return Ru({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return Pu({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return ku({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return Ou({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return zu({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return Nu({aptosConfig:this.config,...t})}};var Jf=rc(Zf(),1);async function ed(r){var t;let{params:e,method:n,url:o,headers:s,body:c,overrides:u}=r,p={headers:s,method:n,url:o,params:e,data:c,withCredentials:(t=u?.WITH_CREDENTIALS)!=null?t:!0};try{let h=await(0,Jf.default)(p);return{status:h.status,statusText:h.statusText,data:h.data,headers:h.headers,config:h.config}}catch(h){let y=h;if(y.response)return y.response;throw h}}var ho=class{constructor(t){this.network=t?.network??hs,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:ed},this.clientConfig=t?.clientConfig??{}}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return ps[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return gs[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return Ko[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return Ko[this.network]===t}};var yo=class extends Z{constructor(e){super();this.accountAddress=k.ONE;this.moduleName=new Fe("account");this.structName=new Fe("RotationProofChallenge");this.sequenceNumber=new Le(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=Be.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var pr=class r extends Mt{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof Ke)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof ur)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Ke.load(e));case 1:return new r(ur.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};async function Ca(r){return new Promise(t=>{setTimeout(t,r)})}async function td(r){let{aptosConfig:t,options:e}=r;return qr({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Bi(r){let{aptosConfig:t}=r;return Pn(async()=>{let{data:e}=await lt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function rd(r){let{aptosConfig:t,ledgerVersion:e}=r,{data:n}=await lt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return n}async function Ri(r){let{aptosConfig:t,transactionHash:e}=r,{data:n}=await lt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return n}async function nd(r){let{aptosConfig:t,transactionHash:e}=r;try{return(await Ri({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(n){if(n?.status===404)return!0;throw n}}async function Pi(r){let{aptosConfig:t,transactionHash:e,options:n}=r,o=n?.timeoutSecs??ro,s=n?.checkSuccess??!0,c=n?.indexerVersionCheck??!0,u=!0,p=0,h,y,x=200,_=1.5;for(;u&&!(p>=o);){try{if(h=await Ri({aptosConfig:t,transactionHash:e}),u=h.type==="pending_transaction",!u)break}catch(T){if(!(T instanceof Vt)||(y=T,T.status!==404&&T.status>=400&&T.status<500))throw T}await Ca(x),p+=x/1e3,x*=_}if(h===void 0)throw y||new mo(`Fetching transaction ${e} failed and timed out after ${o} seconds`,h);if(h.type==="pending_transaction")throw new mo(`Transaction ${e} timed out in pending state after ${o} seconds`,h);if(!s)return h;if(!h.success)throw new Ia(`Transaction ${e} failed with an error: ${h.vm_status}`,h);if(c)try{await Cg({aptosConfig:t,ledgerVersion:Number(h.version)})}catch{throw new mo(`Transaction ${e} committed, but timed out waiting for indexer to sync with ledger version ${h.version}.You can disable this check by setting \`indexerVersionCheck\` to false in the \`extraArgs\` parameter.`,h)}return h}async function Cg(r){let{aptosConfig:t,ledgerVersion:e}=r,n=3e3,o=new Date().getTime(),s=-1;for(;s<e;){if(new Date().getTime()-o>n)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(s=await bi({aptosConfig:t}),s>=e)break;await Ca(200)}}var mo=class extends Error{constructor(e,n){super(e);this.lastSubmittedTransaction=n}},Ia=class extends Error{constructor(e,n){super(e);this.transaction=n}};var ht=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return gr.load(t);case 1:return ki.load(t);case 2:return Wt.load(t);case 3:return Dn.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}},gr=class r extends ht{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Pe.deserialize(e),o=Ke.deserialize(e);return new r(n,o)}},ki=class r extends ht{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Dt.deserialize(e),o=Yr.deserialize(e);return new r(n,o)}},Wt=class r extends ht{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Ye.deserialize(e),o=pr.deserialize(e);return new r(n,o)}},Dn=class r extends ht{constructor(e,n,o){super();this.public_keys=e,this.signatures=n,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let n=nn.deserialize(e),o=e.deserializeVector(pr),s=e.deserializeBytes();return new r(n,o,s)}};var Yt=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return cn.load(t);case 1:return Oi.load(t);case 2:return un.load(t);case 3:return fn.load(t);case 4:return dn.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},cn=class r extends Yt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Pe.deserialize(e),o=Ke.deserialize(e);return new r(n,o)}},Oi=class r extends Yt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Dt.deserialize(e),o=Yr.deserialize(e);return new r(n,o)}},un=class r extends Yt{constructor(e,n,o){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let n=ht.deserialize(e),o=e.deserializeVector(k),s=e.deserializeVector(ht);return new r(n,o,s)}},fn=class r extends Yt{constructor(e,n,o,s){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o,this.fee_payer=s}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let n=ht.deserialize(e),o=e.deserializeVector(k),s=e.deserializeVector(ht),c=k.deserialize(e),u=ht.deserialize(e),p={address:c,authenticator:u};return new r(n,o,s,p)}},dn=class r extends Yt{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let n=ht.deserialize(e);return new r(n)}};var ln=class r extends Z{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let n=e.deserializeU8();return new r(n)}};var Ne=class r extends Z{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let n=e.deserializeStr();return new r(n)}};var qn=class r extends Z{constructor(e,n){super();this.address=e,this.name=n}static fromStr(e){let n=e.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new r(k.fromStringRelaxed(n[0]),new Ne(n[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let n=k.deserialize(e),o=Ne.deserialize(e);return new r(n,o)}};var $e=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return pn.load(t);case 1:return gn.load(t);case 2:return mn.load(t);case 3:return xn.load(t);case 4:return bn.load(t);case 5:return Or.load(t);case 6:return Tn.load(t);case 7:return hr.load(t);case 8:return hn.load(t);case 9:return yn.load(t);case 10:return An.load(t);case 255:return wn.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof pn}isAddress(){return this instanceof bn}isGeneric(){return this instanceof wn}isSigner(){return this instanceof Or}isVector(){return this instanceof Tn}isStruct(){return this instanceof hr}isU8(){return this instanceof gn}isU16(){return this instanceof hn}isU32(){return this instanceof yn}isU64(){return this instanceof mn}isU128(){return this instanceof xn}isU256(){return this instanceof An}},pn=class r extends $e{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new r}},gn=class r extends $e{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new r}},hn=class r extends $e{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new r}},yn=class r extends $e{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new r}},mn=class r extends $e{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new r}},xn=class r extends $e{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new r}},An=class r extends $e{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new r}},bn=class r extends $e{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new r}},Or=class r extends $e{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new r}},xo=class r extends $e{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let n=$e.deserialize(e);return new r(n)}},wn=class r extends $e{constructor(e){super();this.value=e}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let n=e.deserializeU32();return new r(n)}},Tn=class r extends $e{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let n=$e.deserialize(e);return new r(n)}},hr=class r extends $e{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(n=>n.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let n=Xt.deserialize(e);return new r(n)}isTypeTag(e,n,o){return this.value.moduleName.identifier===n&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(k.ONE,"string","String")}isOption(){return this.isTypeTag(k.ONE,"option","Option")}isObject(){return this.isTypeTag(k.ONE,"object","Object")}},Xt=class r extends Z{constructor(e,n,o,s){super();this.address=e,this.moduleName=n,this.name=o,this.typeArgs=s}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let n=k.deserialize(e),o=Ne.deserialize(e),s=Ne.deserialize(e),c=e.deserializeVector($e);return new r(n,o,s,c)}};function Ig(){return new Xt(k.ONE,new Ne("aptos_coin"),new Ne("AptosCoin"),[])}function Bg(){return new Xt(k.ONE,new Ne("string"),new Ne("String"),[])}function Rg(r){return new Xt(k.ONE,new Ne("option"),new Ne("Option"),[r])}function Pg(r){return new Xt(k.ONE,new Ne("object"),new Ne("Object"),[r])}function od(r){let t=r.deserializeUleb128AsU32();switch(t){case 0:return it.deserialize(r);case 1:return Le.deserialize(r);case 2:return St.deserialize(r);case 3:return k.deserialize(r);case 4:return Be.deserialize(r,it);case 5:return Ge.deserialize(r);case 6:return _t.deserialize(r);case 7:return Et.deserialize(r);case 8:return Ut.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var zr=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Gn.load(t);case 2:return Ln.load(t);case 3:return Fn.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Gn=class r extends zr{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let n=Kn.deserialize(e);return new r(n)}},Ln=class r extends zr{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let n=vn.deserialize(e);return new r(n)}},Fn=class r extends zr{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let n=Hn.deserialize(e);return new r(n)}},vn=class r{constructor(t,e,n,o){this.module_name=t,this.function_name=e,this.type_args=n,this.args=o}static build(t,e,n,o){return new r(qn.fromStr(t),new Ne(e),n,o)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=qn.deserialize(t),n=Ne.deserialize(t),o=t.deserializeVector($e),s=t.deserializeUleb128AsU32(),c=new Array;for(let u=0;u<s;u+=1){let p=t.deserializeUleb128AsU32(),h=so.deserialize(t,p);c.push(h)}return new r(e,n,o,c)}},Kn=class r{constructor(t,e,n){this.bytecode=t,this.type_args=e,this.args=n}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),n=t.deserializeVector($e),o=t.deserializeUleb128AsU32(),s=new Array;for(let c=0;c<o;c+=1){let u=od(t);s.push(u)}return new r(e,n,s)}},Hn=class r{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=k.deserialize(t),n=t.deserializeBool(),o;return n&&(o=$n.deserialize(t)),new r(e,o)}},$n=class r{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new r(vn.deserialize(t))}};var Ft=class r extends Z{constructor(e,n,o,s,c,u,p){super();this.sender=e,this.sequence_number=n,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=c,this.expiration_timestamp_secs=u,this.chain_id=p}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let n=k.deserialize(e),o=e.deserializeU64(),s=zr.deserialize(e),c=e.deserializeU64(),u=e.deserializeU64(),p=e.deserializeU64(),h=ln.deserialize(e);return new r(n,o,s,c,u,p,h)}},Ao=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return yr.load(t);case 1:return mr.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},yr=class r extends Ao{constructor(e,n){super();this.raw_txn=e,this.secondary_signer_addresses=n}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let n=Ft.deserialize(e),o=e.deserializeVector(k);return new r(n,o)}},mr=class r extends Ao{constructor(e,n,o){super();this.raw_txn=e,this.secondary_signer_addresses=n,this.fee_payer_address=o}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let n=Ft.deserialize(e),o=e.deserializeVector(k),s=k.deserialize(e);return new r(n,o,s)}};var Kt=class r extends Z{constructor(e,n){super();this.raw_txn=e,this.authenticator=n}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let n=Ft.deserialize(e),o=Yt.deserialize(e);return new r(n,o)}};function id(r){return!!r.match(/^[_a-zA-Z0-9]+$/)}function sd(r){return!!r.match(/\s/)}function kg(r){return!!r.match(/^T[0-9]+$/)}function Og(r,t){let e=t;for(;e<r.length;e+=1){let n=r[e];if(!sd(n))break}return e}var ad=(_=>(_.InvalidTypeTag="unknown type",_.UnexpectedGenericType="unexpected generic type",_.UnexpectedTypeArgumentClose="unexpected '>'",_.UnexpectedWhitespaceCharacter="unexpected whitespace character",_.UnexpectedComma="unexpected ','",_.TypeArgumentCountMismatch="type argument count doesn't match expected amount",_.MissingTypeArgumentClose="no matching '>' for '<'",_.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",_.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",_.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",_.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",_.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",_))(ad||{}),Oe=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function Vn(r,t){let e=t?.allowGenerics??!1,n=[],o=[],s=[],c=0,u="",p=1;for(;c<r.length;){let h=r[c];if(h==="<")n.push({savedExpectedTypes:p,savedStr:u,savedTypes:s}),u="",s=[],p=1;else if(h===">"){if(u!==""){let N=zi(u,o,e);s.push(N)}let y=n.pop();if(y===void 0)throw new Oe(r,"unexpected '>'");if(p!==s.length)throw new Oe(r,"type argument count doesn't match expected amount");let{savedStr:x,savedTypes:_,savedExpectedTypes:T}=y;o=s,s=_,u=x,p=T}else if(h===","){if(u.length!==0){let y=zi(u,o,e);o=[],s.push(y),u="",p+=1}}else if(sd(h)){let y=!1;if(u.length!==0){let _=zi(u,o,e);o=[],s.push(_),u="",y=!0}c=Og(r,c);let x=r[c];if(c<r.length&&y&&x!==","&&x!==">")throw new Oe(r,"unexpected whitespace character");continue}else u+=h;c+=1}if(n.length>0)throw new Oe(r,"no matching '>' for '<'");switch(s.length){case 0:return zi(u,o,e);case 1:if(u==="")return s[0];throw new Oe(r,"unexpected ','");default:throw new Oe(r,"unexpected whitespace character")}}function zi(r,t,e){switch(r){case"&signer":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new xo(new Or);case"signer":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new Or;case"bool":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new pn;case"address":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new bn;case"u8":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new gn;case"u16":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new hn;case"u32":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new yn;case"u64":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new mn;case"u128":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new xn;case"u256":if(t.length>0)throw new Oe(r,"primitive types not expected to have type arguments");return new An;case"vector":if(t.length!==1)throw new Oe(r,"vector type expected to have exactly one type argument");return new Tn(t[0]);default:if(kg(r)){if(e)return new wn(Number(r.split("T")[1]));throw new Oe(r,"unexpected generic type")}if(!r.match(/.*:.*/))throw new Oe(r,"unknown type");let n=r.split("::");if(n.length!==3)throw new Oe(r,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!id(n[1]))throw new Oe(r,"module name must only contain alphanumeric or '_' characters");if(!id(n[2]))throw new Oe(r,"struct name must only contain alphanumeric or '_' characters");return new hr(new Xt(k.fromStringRelaxed(n[0]),new Ne(n[1]),new Ne(n[2]),t))}}function Ba(r){return typeof r=="boolean"}function _n(r){return typeof r=="string"}function bo(r){return typeof r=="number"}function wo(r){return typeof r=="number"||typeof r=="bigint"||typeof r=="string"}function Ra(r){return r==null}function Ni(r){return r instanceof Ge}function To(r){return r instanceof k}function Mi(r){return r instanceof Fe}function Pa(r){return r instanceof Er}function Di(r){return r instanceof it}function qi(r){return r instanceof _t}function Gi(r){return r instanceof Et}function Li(r){return r instanceof Le}function Fi(r){return r instanceof St}function Ki(r){return r instanceof Ut}function Hi(r){return"bytecode"in r}function ze(r,t){throw new Error(`Type mismatch for argument ${t}, expected '${r}'`)}function ka(r){let t=r.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?r.params.length:t}function $i(r){let t=r.split("::");if(t.length!==3)throw new Error(`Invalid function ${r}`);let e=t[0],n=t[1],o=t[2];return{moduleAddress:e,moduleName:n,functionName:o}}function Oa(r){return r?.map(t=>_n(t)?Vn(t):t)??[]}async function za(r,t,e,n){let s=(await wi({aptosConfig:n,accountAddress:r,moduleName:t})).abi?.exposed_functions.find(p=>p.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${r}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${r}::${t}::${e}' is not an entry function`);let c=ka(s),u=[];for(let p=c;p<s.params.length;p+=1)u.push(Vn(s.params[p],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:u}}function Na(r,t,e,n,o){if(n>=t.parameters.length)throw new Error(`Too many arguments for '${r}', expected ${t.parameters.length}`);return Ni(e)||Di(e)||qi(e)||Gi(e)||Li(e)||Fi(e)||Ki(e)||To(e)||Mi(e)||Pa(e)||e instanceof Be||e instanceof Nt?(zg(t,e,n),e):Vi(e,t.parameters[n],n,o)}function Vi(r,t,e,n){if(t.isBool()){if(Ba(r))return new Ge(r);ze("boolean",e)}if(t.isAddress()){if(_n(r))return k.fromStringRelaxed(r);ze("string",e)}if(t.isU8()){if(bo(r))return new it(r);ze("number",e)}if(t.isU16()){if(bo(r))return new _t(r);ze("number",e)}if(t.isU32()){if(bo(r))return new Et(r);ze("number",e)}if(t.isU64()){if(wo(r))return new Le(BigInt(r));ze("bigint | number | string",e)}if(t.isU128()){if(wo(r))return new St(BigInt(r));ze("bigint | number | string",e)}if(t.isU256()){if(wo(r))return new Ut(BigInt(r));ze("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=n.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);Vi(r,n[o],e,n)}if(t.isVector()){if(t.value.isU8()&&_n(r))return Be.U8(me.fromHexInput(r).toUint8Array());if(Array.isArray(r))return new Be(r.map(o=>Vi(o,t.value,e,n)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(_n(r))return new Fe(r);ze("string",e)}if(t.isObject()){if(_n(r))return k.fromStringRelaxed(r);ze("string",e)}if(t.isOption())return Ra(r)?new Nt(null):new Nt(Vi(r,t.value.typeArgs[0],e,n));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function zg(r,t,e){let n=r.parameters[e];if(n.isBool()){if(Ni(t))return;ze("Bool",e)}if(n.isAddress()){if(To(t))return;ze("AccountAddress",e)}if(n.isU8()){if(Di(t))return;ze("U8",e)}if(n.isU16()){if(qi(t))return;ze("U16",e)}if(n.isU32()){if(Gi(t))return;ze("U32",e)}if(n.isU64()){if(Li(t))return;ze("U64",e)}if(n.isU128()){if(Fi(t))return;ze("U128",e)}if(n.isU256()){if(Ki(t))return;ze("U256",e)}if(n.isVector()){if(t instanceof Be)return;ze("MoveVector",e)}if(n instanceof hr){if(n.isString()){if(Mi(t))return;ze("MoveString",e)}if(n.isObject()){if(To(t))return;ze("AccountAddress",e)}if(n.isOption()){if(t instanceof Nt)return;ze("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${n.toString()}'`)}async function _o(r){if(Hi(r))return ud(r);let{moduleAddress:t,moduleName:e,functionName:n}=$i(r.function),o=await Pn(async()=>za(t,e,n,r.aptosConfig),`entry-function-${r.aptosConfig.network}-${t}-${e}-${n}`,1e3*60*5)();return cd(r,o)}function cd(r,t){if(Hi(r))return ud(r);let{moduleAddress:e,moduleName:n,functionName:o}=$i(r.function),s=Oa(r.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let c=r.functionArguments.map((p,h)=>Na(r.function,t,p,h,s));if(c.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${n}::${o}', expected ${t.parameters.length} but got ${c.length}`);let u=vn.build(`${e}::${n}`,o,s,c);if("multisigAddress"in r){let p;return typeof r.multisigAddress=="string"?p=k.from(r.multisigAddress):p=r.multisigAddress,new Fn(new Hn(p,new $n(u)))}return new Ln(u)}function ud(r){return new Gn(new Kn(me.fromHexInput(r.bytecode).toUint8Array(),r.typeArguments??[],r.functionArguments))}async function fd(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=o?.accountSequenceNumber?Promise.resolve({sequence_number:o.accountSequenceNumber}):on({aptosConfig:t,accountAddress:e}),c=Ho[t.network]?Promise.resolve({chain_id:Ho[t.network]}):mi({aptosConfig:t}),u=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Bi({aptosConfig:t}),[{sequence_number:p},{chain_id:h},{gas_estimate:y}]=await Promise.all([s,c,u]),{maxGasAmount:x,gasUnitPrice:_,expireTimestamp:T}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(ys),gasUnitPrice:BigInt(y),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+ms),...o};return new Ft(k.fromRelaxed(e),BigInt(p),n,BigInt(x),BigInt(_),BigInt(T),new ln(h))}async function Eo(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=await fd({aptosConfig:t,sender:e,payload:n,options:o});if("feePayerAddress"in r){let c=r.secondarySignerAddresses?.map(u=>k.fromRelaxed(u))??[];return{rawTransaction:s,secondarySignerAddresses:c,feePayerAddress:r?.feePayerAddress!==void 0?k.fromRelaxed(r.feePayerAddress):void 0}}if("secondarySignerAddresses"in r){let c=r.secondarySignerAddresses?.map(u=>k.fromRelaxed(u))??[];return{rawTransaction:s,secondarySignerAddresses:c}}return{rawTransaction:s}}function Ma(r){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,s=new io(e.rawTransaction.bcsToBytes()),c=Ft.deserialize(s),u=vo(t);if("feePayerAddress"in e){let h=new mr(c,e.secondarySignerAddresses??[],e.feePayerAddress),y=[];n&&(y=n.map(T=>vo(T)));let x=vo(o),_=new fn(u,e.secondarySignerAddresses??[],y,{address:e.feePayerAddress,authenticator:x});return new Kt(h.raw_txn,_).bcsToBytes()}if("secondarySignerAddresses"in e){let h=new yr(c,e.secondarySignerAddresses),y=[];y=n.map(_=>vo(_));let x=new un(u,e.secondarySignerAddresses,y);return new Kt(h.raw_txn,x).bcsToBytes()}let p;if(u instanceof gr)p=new cn(u.public_key,u.signature);else if(u instanceof Wt)p=new dn(u);else throw new Error("Invalid public key");return new Kt(c,p).bcsToBytes()}function vo(r){if(r instanceof Ye){if(r.publicKey instanceof Pe)return new Wt(r,new pr(new Ke(new Uint8Array(64))));if(r.publicKey instanceof qt)return new Wt(r,new pr(new ur(new Uint8Array(64))))}return new gr(new Pe(r.toUint8Array()),new Ke(new Uint8Array(64)))}function Da(r){let{signer:t,transaction:e}=r,n=Ga(e),o=ld(n),s=t.sign(o);switch(t.signingScheme){case 0:return new gr(new Pe(t.publicKey.toUint8Array()),new Ke(s.toUint8Array()));case 2:return new Wt(t.publicKey,new pr(s));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function qa(r){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:n,additionalSignersAuthenticators:o}=r,s=Ga(t);if(n||o)return dd(s,e,n,o);if(e instanceof gr){let c=new cn(e.public_key,e.signature);return new Kt(s,c).bcsToBytes()}if(e instanceof Wt||e instanceof Dn){let c=new dn(e);return new Kt(s,c).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function Ga(r){return"feePayerAddress"in r?new mr(r.rawTransaction,r.secondarySignerAddresses??[],r.feePayerAddress):"secondarySignerAddresses"in r?new yr(r.rawTransaction,r.secondarySignerAddresses):r.rawTransaction}function dd(r,t,e,n){if(r instanceof mr){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new fn(t,r.secondary_signer_addresses,n??[],{address:r.fee_payer_address,authenticator:e});return new Kt(r.raw_txn,o).bcsToBytes()}if(r instanceof yr){if(!n)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new un(t,r.secondary_signer_addresses,n??[]);return new Kt(r.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof r} transaction is not supported`)}function ld(r){let t=$r.create();if(r instanceof Ft)t.update(As);else if(r instanceof yr)t.update($o);else if(r instanceof mr)t.update($o);else throw new Error(`Unknown transaction type to sign on: ${r}`);let e=t.digest(),n=r.bcsToBytes(),o=new Uint8Array(e.length+n.length);return o.set(e),o.set(n,e.length),o}async function Ht(r){let{aptosConfig:t,sender:e,data:n,options:o}=r,s;if("bytecode"in n?s=n:"multisigAddress"in n?s={aptosConfig:t,multisigAddress:n.multisigAddress,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments}:s={aptosConfig:t,function:n.function,functionArguments:n.functionArguments,typeArguments:n.typeArguments},Ng(r)){let{secondarySignerAddresses:u}=r,p=r.hasFeePayer?k.ZERO:void 0,h=await _o(s);return Eo({aptosConfig:t,sender:e,payload:h,options:o,secondarySignerAddresses:u,feePayerAddress:p})}if(Mg(r)){let{secondarySignerAddresses:u}=r,p=await _o(s);return Eo({aptosConfig:t,sender:e,payload:p,options:o,secondarySignerAddresses:u})}let c=await _o(s);return Eo({aptosConfig:t,sender:e,payload:c,options:o})}function Ng(r){return"hasFeePayer"in r}function Mg(r){return"secondarySignerAddresses"in r}function La(r){return Da({...r})}async function pd(r){let{aptosConfig:t,transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:c}=r,u=Ma({transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:c}),{data:p}=await Gr({aptosConfig:t,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:r.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:r.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:r.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return p}async function Fa(r){let{aptosConfig:t}=r,e=qa({...r}),{data:n}=await Gr({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function Ka(r){let{aptosConfig:t,signer:e,transaction:n}=r,o=La({signer:e,transaction:n});return Fa({aptosConfig:t,transaction:n,senderAuthenticator:o})}async function gd(r){let{aptosConfig:t,account:e,metadataBytes:n,moduleBytecode:o,options:s}=r,c=o.map(p=>Be.U8(p));return await Ht({aptosConfig:t,sender:k.fromRelaxed(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[Be.U8(n),new Be(c)]},options:s})}async function hd(r){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:n}=r,o=await on({aptosConfig:t,accountAddress:e.accountAddress.toString()}),s=dr.fromPrivateKey({privateKey:n,legacy:!0}),u=new yo({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:k.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),p=e.sign(u),h=s.sign(u),y=await Ht({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new it(e.signingScheme.valueOf()),Be.U8(e.publicKey.toUint8Array()),new it(s.signingScheme.valueOf()),Be.U8(s.publicKey.toUint8Array()),Be.U8(p.toUint8Array()),Be.U8(h.toUint8Array())]}});return await Ka({aptosConfig:t,signer:e,transaction:y})}async function yd(r){let{aptosConfig:t,sender:e,recipient:n,amount:o,coinType:s,options:c}=r,u=s??xs;return await Ht({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[Vn(u)],functionArguments:[k.from(n),new Le(o)]},options:c})}var So=class{constructor(t){this.config=t}async transferCoinTransaction(t){return yd({aptosConfig:this.config,...t})}};async function md(r){let{aptosConfig:t,options:e,creator:n}=r;return await Ht({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new Fe(r.collection),new Fe(r.description),new Fe(r.name),new Fe(r.uri),Be.MoveString([]),Be.MoveString([]),new Be([])]},options:e})}async function xd(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:k.from(e).toStringLong()}};return(await Ce({aptosConfig:t,query:{query:Au,variables:{where_condition:n}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function Ad(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:k.from(e).toStringLong()}};return(await Ce({aptosConfig:t,query:{query:ra,variables:{where_condition:n}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function bd(r){let{aptosConfig:t,ownerAddress:e,options:n}=r,o={owner_address:{_eq:k.from(e).toStringLong()}},s={query:ra,variables:{where_condition:o,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:s,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function wd(r){let{aptosConfig:t,tokenAddress:e,options:n}=r,o={token_data_id:{_eq:k.from(e).toStringLong()}},s={query:xu,variables:{where_condition:o,offset:n?.pagination?.offset,limit:n?.pagination?.limit,order_by:n?.orderBy}};return(await Ce({aptosConfig:t,query:s,originMethod:"getTokenActivity"})).token_activities_v2}async function Td(r){let{aptosConfig:t,options:e,creator:n}=r;return await Ht({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new Fe(r.description),new Le(r.maxSupply??Kr),new Fe(r.name),new Fe(r.uri),new Ge(r.mutableDescription??!0),new Ge(r.mutableRoyalty??!0),new Ge(r.mutableURI??!0),new Ge(r.mutableTokenDescription??!0),new Ge(r.mutableTokenName??!0),new Ge(r.mutableTokenProperties??!0),new Ge(r.mutableTokenURI??!0),new Ge(r.tokensBurnableByCreator??!0),new Ge(r.tokensFreezableByCreator??!0),new Le(r.royaltyNumerator??0),new Le(r.royaltyDenominator??1)]},options:e})}async function Ha(r){let{aptosConfig:t,creatorAddress:e,collectionName:n,options:o}=r,s=k.from(e),c={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(c.token_standard={_eq:o?.tokenStandard??"v2"}),(await Ce({aptosConfig:t,query:{query:du,variables:{where_condition:c}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function vd(r){return(await Ha(r)).collection_id}var Uo=class{constructor(t){this.config=t}async createCollectionTransaction(t){return Td({aptosConfig:this.config,...t})}async getCollectionData(t){return Ha({aptosConfig:this.config,...t})}async getCollectionId(t){return vd({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return md({aptosConfig:this.config,...t})}async getTokenData(t){return xd({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return Ad({aptosConfig:this.config,...t})}async getOwnedTokens(t){return bd({aptosConfig:this.config,...t})}async getTokenActivity(t){return wd({aptosConfig:this.config,...t})}};async function _d(r){let{accountAddress:t,aptosConfig:e,creationNumber:n}=r,s={account_address:{_eq:k.from(t).toStringLong()},creation_number:{_eq:n}};return Qi({aptosConfig:e,options:{where:s}})}async function Ed(r){let{accountAddress:t,aptosConfig:e,eventType:n,options:o}=r,u={where:{account_address:{_eq:k.fromRelaxed(t).toStringLong()},indexed_type:{_eq:n}},pagination:o?.pagination,orderBy:o?.orderBy};return Qi({aptosConfig:e,options:u})}async function Qi(r){let{aptosConfig:t,options:e}=r,n={query:gu,variables:{where_condition:e?.where,offset:e?.pagination?.offset,limit:e?.pagination?.limit,order_by:e?.orderBy}};return(await Ce({aptosConfig:t,query:n,originMethod:"getEvents"})).events}var Co=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return _d({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return Ed({aptosConfig:this.config,...t})}async getEvents(t){return Qi({aptosConfig:this.config,...t})}};async function Sd(r){let{aptosConfig:t,accountAddress:e,amount:n,options:o}=r,s=o?.timeoutSecs||ro,{data:c}=await ws({aptosConfig:t,path:"fund",body:{address:k.fromRelaxed(e).toString(),amount:n},originMethod:"fundAccount"}),u=c.txn_hashes[0];return await Pi({aptosConfig:t,transactionHash:u,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess,indexerVersionCheck:o?.indexerVersionCheck}}),u}var Io=class{constructor(t){this.config=t}async fundAccount(t){return Sd({aptosConfig:this.config,...t})}};async function $a(r){let{aptosConfig:t,options:e}=r,n={query:yu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await Ce({aptosConfig:t,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Ud(r){let{aptosConfig:t,options:e}=r,n={query:hu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await Ce({aptosConfig:t,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Cd(r){let{aptosConfig:t,options:e}=r,n={query:lu,variables:{where_condition:e?.where,limit:e?.pagination?.limit,offset:e?.pagination?.offset}};return(await Ce({aptosConfig:t,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}var Bo=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return $a({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return(await $a({aptosConfig:this.config,options:{where:{asset_type:{_eq:t}}}}))[0]}async getFungibleAssetActivities(t){return Ud({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return Cd({aptosConfig:this.config,...t})}};var Ro=class{constructor(t){this.config=t}async getLedgerInfo(){return mi({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return bu({aptosConfig:this.config,...t})}async getBlockByHeight(t){return wu({aptosConfig:this.config,...t})}async getTableItem(t){return xi({aptosConfig:this.config,...t})}async view(t){return Ai({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Tu({aptosConfig:this.config,...t})}async queryIndexer(t){return Ce({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return bi({aptosConfig:this.config})}};var Id=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function Bd(r){return!(!r||r.length<3||r.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(r))}function Rd(r){let[t,e,...n]=r.replace(/\.apt$/,"").split(".");if(n.length>0)throw new Error(`${r} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!Bd(t))throw new Error(`${t} is not valid. ${Id}`);if(e&&!Bd(e))throw new Error(`${e} is not valid. ${Id}`);return{domainName:e||t,subdomainName:e?t:void 0}}var Dg="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",qg={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Dg,custom:null,devnet:null};function Pd(r){let t=qg[r.network];if(!t)throw new Error(`The ANS contract is not deployed to ${r.network}`);return t}var Gg=r=>({vec:[r]}),Lg=()=>({vec:[]}),Fg=r=>r!=null?Gg(r):Lg(),Kg=r=>{if(r&&typeof r=="object"&&"vec"in r&&Array.isArray(r.vec))return r.vec[0]};async function kd(r){let{aptosConfig:t,name:e}=r,n=Pd(t),{domainName:o,subdomainName:s}=Rd(e),c=await Ai({aptosConfig:t,payload:{function:`${n}::router::get_owner_addr`,functionArguments:[o,Fg(s)]}}),u=Kg(c[0]);return u?k.fromRelaxed(u).toString():void 0}async function Od(r){let{aptosConfig:t,expiration:e,name:n,sender:o,targetAddress:s,toAddress:c,options:u}=r,p=Pd(t),{domainName:h,subdomainName:y}=Rd(n),x=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(y&&!x)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(x&&!y)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){if(e.years!==1)throw new Error("For now, names can only be registered for 1 year at a time");let _=e.years*31536e3;return await Ht({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${p}::router::register_domain`,functionArguments:[new Fe(h),new Le(_),new Nt(s?k.from(s):null),new Nt(c?k.from(c):null)]},options:u})}throw new Error(`Policy ${e.policy} is not supported yet`)}var Po=class{constructor(t){this.config=t}async getOwnerAddress(t){return kd({aptosConfig:this.config,...t})}async registerName(t){return Od({aptosConfig:this.config,...t})}};async function zd(r){let{aptosConfig:t,poolAddress:e}=r,n=k.fromRelaxed(e).toStringLong(),s=await Ce({aptosConfig:t,query:{query:ta,variables:{where_condition:{pool_address:{_eq:n}}}}});if(s.num_active_delegator_per_pool.length===0)throw Error("Delegator pool not found");return s.num_active_delegator_per_pool[0].num_active_delegator}async function Nd(r){let{aptosConfig:t,options:e}=r,n={query:ta,variables:{where_condition:{},order_by:e?.orderBy}};return(await Ce({aptosConfig:t,query:n})).num_active_delegator_per_pool}async function Md(r){let{aptosConfig:t,delegatorAddress:e,poolAddress:n}=r,o={query:pu,variables:{delegatorAddress:k.fromRelaxed(e).toStringLong(),poolAddress:k.fromRelaxed(n).toStringLong()}};return(await Ce({aptosConfig:t,query:o})).delegated_staking_activities}var ko=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return zd({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return Nd({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return Md({aptosConfig:this.config,...t})}};var Oo=class{constructor(t){this.config=t}async getTransactions(t){return td({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return rd({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Ri({aptosConfig:this.config,...t})}async isPendingTransaction(t){return nd({aptosConfig:this.config,...t})}async waitForTransaction(t){return Pi({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Bi({aptosConfig:this.config})}};var zo=class{constructor(t){this.config=t}async generateTransaction(t){return Ht({aptosConfig:this.config,...t})}signTransaction(t){let{signer:e,transaction:n,asFeePayer:o}=t;if("feePayerAddress"in n&&o)n.feePayerAddress=e.accountAddress;else if(o)throw new Error("Transaction being signed is not a Fee payer transaction, but `asFeePayer` is set to true");return La({signer:e,transaction:n})}async simulateTransaction(t){return pd({aptosConfig:this.config,...t})}async submitTransaction(t){return Fa({aptosConfig:this.config,...t})}async signAndSubmitTransaction(t){let{signer:e,transaction:n}=t;return Ka({aptosConfig:this.config,signer:e,transaction:n})}async publishPackageTransaction(t){return gd({aptosConfig:this.config,...t})}async rotateAuthKey(t){return hd({aptosConfig:this.config,...t})}};var yt=class{constructor(t){this.config=new ho(t),this.account=new lo(this.config),this.ans=new Po(this.config),this.coin=new So(this.config),this.digitalAsset=new Uo(this.config),this.event=new Co(this.config),this.faucet=new Io(this.config),this.fungibleAsset=new Bo(this.config),this.general=new Ro(this.config),this.staking=new ko(this.config),this.transaction=new Oo(this.config),this.transactionSubmission=new zo(this.config)}};function $t(r,t,e){Object.getOwnPropertyNames(t.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(t.prototype,n);o&&(o.value=function(...s){return this[e][n](...s)},Object.defineProperty(r.prototype,n,o))})}$t(yt,lo,"account");$t(yt,Po,"ans");$t(yt,So,"coin");$t(yt,Uo,"digitalAsset");$t(yt,Co,"event");$t(yt,Io,"faucet");$t(yt,Bo,"fungibleAsset");$t(yt,Ro,"general");$t(yt,ko,"staking");$t(yt,Oo,"transaction");$t(yt,zo,"transactionSubmission");return Vd(Hg);})();
|
|
427
|
+
`;async function zi(r){let{aptosConfig:t}=r,{data:e}=await Tt({aptosConfig:t,originMethod:"getLedgerInfo",path:""});return e}async function Vu(r){let{aptosConfig:t,ledgerVersion:e,options:n}=r,{data:o}=await Tt({aptosConfig:t,originMethod:"getBlockByVersion",path:`blocks/by_version/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function Qu(r){let{aptosConfig:t,blockHeight:e,options:n}=r,{data:o}=await Tt({aptosConfig:t,originMethod:"getBlockByHeight",path:`blocks/by_height/${e}`,params:{with_transactions:n?.withTransactions}});return o}async function Mi(r){let{aptosConfig:t,handle:e,data:n,options:o}=r;return(await Xr({aptosConfig:t,originMethod:"getTableItem",path:`tables/${e}/item`,params:{ledger_version:o?.ledgerVersion},body:n})).data}async function Gr(r){let{aptosConfig:t,payload:e,options:n}=r,{data:o}=await Xr({aptosConfig:t,originMethod:"view",path:"view",params:{ledger_version:n?.ledgerVersion},body:{function:e.function,type_arguments:e.typeArguments??[],arguments:e.functionArguments??[]}});return o}async function Wu(r){let{aptosConfig:t,limit:e}=r;return(await Ae({aptosConfig:t,query:{query:Mu,variables:{limit:e}},originMethod:"getChainTopUserTransactions"})).user_transactions}async function Ae(r){let{aptosConfig:t,query:e,originMethod:n}=r,{data:o}=await $s({aptosConfig:t,originMethod:n??"queryIndexer",path:"",body:e,overrides:{WITH_CREDENTIALS:!1}});return o}async function xg(r){let{aptosConfig:t}=r;return(await Ae({aptosConfig:t,query:{query:Ca},originMethod:"getProcessorStatuses"})).processor_status}async function qi(r){return(await xg({aptosConfig:r.aptosConfig}))[0].last_success_version}async function Di(r){let{aptosConfig:t,processorType:e}=r,n={processor:{_eq:e.valueOf()}};return(await Ae({aptosConfig:t,query:{query:Ca,variables:{where_condition:n}},originMethod:"getProcessorStatus"})).processor_status[0]}var Ia=new Map;function Fn(r,t,e){return async(...n)=>{if(Ia.has(t)){let{value:s,timestamp:a}=Ia.get(t);if(e===void 0||Date.now()-a<=e)return s}let o=await r(...n);return Ia.set(t,{value:o,timestamp:Date.now()}),o}}var Zt=class r extends Ft{constructor(e){super();this.signature=e}toUint8Array(){return this.signature.toUint8Array()}toString(){return this.signature.toString()}serialize(e){if(this.signature instanceof Ke)e.serializeU32AsUleb128(0),this.signature.serialize(e);else if(this.signature instanceof yr)e.serializeU32AsUleb128(1),this.signature.serialize(e);else throw new Error("Unknown signature type")}static deserialize(e){let n=e.deserializeUleb128AsU32();switch(n){case 0:return new r(Ke.load(e));case 1:return new r(yr.load(e));default:throw new Error(`Unknown variant index for AnySignature: ${n}`)}}};async function Jt(r){let{aptosConfig:t,accountAddress:e}=r,{data:n}=await Tt({aptosConfig:t,originMethod:"getInfo",path:`accounts/${N.from(e).toString()}`});return n}async function Xu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return Yr({aptosConfig:t,originMethod:"getModules",path:`accounts/${N.from(e).toString()}/modules`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??1e3}})}async function Gi(r){return r.options?.ledgerVersion!==void 0?ju(r):Fn(async()=>ju(r),`module-${r.accountAddress}-${r.moduleName}`,1e3*60*5)()}async function ju(r){let{aptosConfig:t,accountAddress:e,moduleName:n,options:o}=r,{data:s}=await Tt({aptosConfig:t,originMethod:"getModule",path:`accounts/${N.from(e).toString()}/module/${n}`,params:{ledger_version:o?.ledgerVersion}});return s}async function Zu(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return Yr({aptosConfig:t,originMethod:"getTransactions",path:`accounts/${N.from(e).toString()}/transactions`,params:{start:n?.offset,limit:n?.limit}})}async function Ju(r){let{aptosConfig:t,accountAddress:e,options:n}=r;return Yr({aptosConfig:t,originMethod:"getResources",path:`accounts/${N.from(e).toString()}/resources`,params:{ledger_version:n?.ledgerVersion,start:n?.offset,limit:n?.limit??999}})}async function Pa(r){let{aptosConfig:t,accountAddress:e,resourceType:n,options:o}=r,{data:s}=await Tt({aptosConfig:t,originMethod:"getResource",path:`accounts/${N.from(e).toString()}/resource/${n}`,params:{ledger_version:o?.ledgerVersion}});return s.data}async function Ra(r){let{aptosConfig:t,authenticationKey:e,options:n}=r,o=await Pa({aptosConfig:t,accountAddress:"0x1",resourceType:"0x1::account::OriginatingAddress",options:n}),{address_map:{handle:s}}=o,a=N.from(e);try{let u=await Mi({aptosConfig:t,handle:s,data:{key:a.toString(),key_type:"address",value_type:"address"},options:n});return N.from(u)}catch(u){if(u instanceof Wt&&u.data.error_code==="table_item_not_found")return a;throw u}}async function ef(r){let{aptosConfig:t,accountAddress:e}=r,o={owner_address:{_eq:N.from(e).toStringLong()},amount:{_gt:0}},a=await Ae({aptosConfig:t,query:{query:ku,variables:{where_condition:o}},originMethod:"getAccountTokensCount"});return a.current_token_ownerships_v2_aggregate.aggregate?a.current_token_ownerships_v2_aggregate.aggregate.count:0}async function tf(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:N.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.token_standard={_eq:n?.tokenStandard});let a={query:Ou,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ae({aptosConfig:t,query:a,originMethod:"getAccountOwnedTokens"})).current_token_ownerships_v2}async function rf(r){let{aptosConfig:t,accountAddress:e,collectionAddress:n,options:o}=r,s=N.from(e).toStringLong(),a=N.from(n).toStringLong(),u={owner_address:{_eq:s},current_token_data:{collection_id:{_eq:a}},amount:{_gt:0}};o?.tokenStandard&&(u.token_standard={_eq:o?.tokenStandard});let p={query:Nu,variables:{where_condition:u,offset:o?.offset,limit:o?.limit,order_by:o?.orderBy}};return(await Ae({aptosConfig:t,query:p,originMethod:"getAccountOwnedTokensFromCollectionAddress"})).current_token_ownerships_v2}async function nf(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:N.from(e).toStringLong()},amount:{_gt:0}};n?.tokenStandard&&(s.current_collection={token_standard:{_eq:n?.tokenStandard}});let a={query:Ru,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ae({aptosConfig:t,query:a,originMethod:"getAccountCollectionsWithOwnedTokens"})).current_collection_ownership_v2_view}async function of(r){let{aptosConfig:t,accountAddress:e}=r,n=N.from(e).toStringLong(),s=await Ae({aptosConfig:t,query:{query:zu,variables:{address:n}},originMethod:"getAccountTransactionsCount"});return s.account_transactions_aggregate.aggregate?s.account_transactions_aggregate.aggregate.count:0}async function Ba(r){let{aptosConfig:t,accountAddress:e,coinType:n}=r,o=N.from(e).toStringLong(),s=await Oa({aptosConfig:t,accountAddress:o,options:{where:{asset_type:{_eq:n}}}});return s[0]?s[0].amount:0}async function Oa(r){let{aptosConfig:t,accountAddress:e,options:n}=r,o=N.from(e).toStringLong(),s={...n?.where,owner_address:{_eq:o}},a={query:Pu,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ae({aptosConfig:t,query:a,originMethod:"getAccountCoinsData"})).current_fungible_asset_balances}async function sf(r){let{aptosConfig:t,accountAddress:e}=r,n=N.from(e).toStringLong(),s=await Ae({aptosConfig:t,query:{query:Iu,variables:{address:n}},originMethod:"getAccountCoinsCount"});if(!s.current_fungible_asset_balances_aggregate.aggregate)throw Error("Failed to get the count of account coins");return s.current_fungible_asset_balances_aggregate.aggregate.count}async function af(r){let{aptosConfig:t,accountAddress:e,options:n}=r,s={owner_address:{_eq:N.from(e).toStringLong()}},a={query:Bu,variables:{where_condition:s,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ae({aptosConfig:t,query:a,originMethod:"getAccountOwnedObjects"})).current_objects}async function cf(r){let{aptosConfig:t,privateKey:e}=r,n=new Me(e.publicKey());if(e instanceof hr){let s=$t.fromPublicKeyAndScheme({publicKey:n,scheme:2}).derivedAddress();return Ar.fromPrivateKeyAndAddress({privateKey:e,address:s})}if(e instanceof lr){let o=$t.fromPublicKeyAndScheme({publicKey:n,scheme:2});if(await Yu({authKey:o,aptosConfig:t})){let p=o.derivedAddress();return Ar.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!1})}let a=$t.fromPublicKeyAndScheme({publicKey:n,scheme:0});if(await Yu({authKey:a,aptosConfig:t})){let p=a.derivedAddress();return Ar.fromPrivateKeyAndAddress({privateKey:e,address:p,legacy:!0})}}throw new Error(`Can't derive account from private key ${e}`)}async function Yu(r){let{aptosConfig:t,authKey:e}=r,n=await Ra({aptosConfig:t,authenticationKey:e.derivedAddress()});try{return await Jt({aptosConfig:t,accountAddress:n}),!0}catch(o){if(o.status===404)return!1;throw new Error(`Error while looking for an account info ${n.toString()}`)}}async function Lr(r){return new Promise(t=>{setTimeout(t,r)})}async function uf(r){let{aptosConfig:t,options:e}=r;return Yr({aptosConfig:t,originMethod:"getTransactions",path:"transactions",params:{start:e?.offset,limit:e?.limit}})}async function Fi(r){let{aptosConfig:t}=r;return Fn(async()=>{let{data:e}=await Tt({aptosConfig:t,originMethod:"getGasPriceEstimation",path:"estimate_gas_price"});return e},`gas-price-${t.network}`,1e3*60*5)()}async function ff(r){let{aptosConfig:t,ledgerVersion:e}=r,{data:n}=await Tt({aptosConfig:t,originMethod:"getTransactionByVersion",path:`transactions/by_version/${e}`});return n}async function Ki(r){let{aptosConfig:t,transactionHash:e}=r,{data:n}=await Tt({aptosConfig:t,path:`transactions/by_hash/${e}`,originMethod:"getTransactionByHash"});return n}async function df(r){let{aptosConfig:t,transactionHash:e}=r;try{return(await Ki({aptosConfig:t,transactionHash:e})).type==="pending_transaction"}catch(n){if(n?.status===404)return!0;throw n}}async function Kn(r){let{aptosConfig:t,transactionHash:e,options:n}=r,o=n?.timeoutSecs??ho,s=n?.checkSuccess??!0,a=!0,u=0,p,h,y=200,A=1.5;for(;a&&!(u>=o);){try{if(p=await Ki({aptosConfig:t,transactionHash:e}),a=p.type==="pending_transaction",!a)break}catch(_){if(!(_ instanceof Wt)||(h=_,_.status!==404&&_.status>=400&&_.status<500))throw _}await Lr(y),u+=y/1e3,y*=A}if(p===void 0)throw h||new Li(`Fetching transaction ${e} failed and timed out after ${o} seconds`,p);if(p.type==="pending_transaction")throw new Li(`Transaction ${e} timed out in pending state after ${o} seconds`,p);if(!s)return p;if(!p.success)throw new Na(`Transaction ${e} failed with an error: ${p.vm_status}`,p);return p}async function $i(r){let{aptosConfig:t,processorType:e}=r,n=BigInt(r.minimumLedgerVersion),o=3e3,s=new Date().getTime(),a=-1;for(;a<n;){if(new Date().getTime()-s>o)throw new Error("waitForLastSuccessIndexerVersionSync timeout");if(e===void 0?a=await qi({aptosConfig:t}):a=(await Di({aptosConfig:t,processorType:e})).last_success_version,a>=n)break;await Lr(200)}}var Li=class extends Error{constructor(e,n){super(e);this.lastSubmittedTransaction=n}},Na=class extends Error{constructor(e,n){super(e);this.transaction=n}};async function Ce(r){if(r.minimumLedgerVersion!==void 0){let t=[];for(let e of r.processorTypes)t.push($i({aptosConfig:r.config,minimumLedgerVersion:r.minimumLedgerVersion,processorType:e}));await Promise.all(t)}}var vo=class{constructor(t){this.config=t}async getAccountInfo(t){return Jt({aptosConfig:this.config,...t})}async getAccountModules(t){return Xu({aptosConfig:this.config,...t})}async getAccountModule(t){return Gi({aptosConfig:this.config,...t})}async getAccountTransactions(t){return Zu({aptosConfig:this.config,...t})}async getAccountResources(t){return Ju({aptosConfig:this.config,...t})}async getAccountResource(t){return Pa({aptosConfig:this.config,...t})}async lookupOriginalAccountAddress(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Ra({aptosConfig:this.config,...t})}async getAccountTokensCount(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),ef({aptosConfig:this.config,...t})}async getAccountOwnedTokens(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),tf({aptosConfig:this.config,...t})}async getAccountOwnedTokensFromCollectionAddress(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),rf({aptosConfig:this.config,...t})}async getAccountCollectionsWithOwnedTokens(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),nf({aptosConfig:this.config,...t})}async getAccountTransactionsCount(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),of({aptosConfig:this.config,...t})}async getAccountCoinsData(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Oa({aptosConfig:this.config,...t})}async getAccountCoinsCount(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),sf({aptosConfig:this.config,...t})}async getAccountAPTAmount(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Ba({aptosConfig:this.config,coinType:yo,...t})}async getAccountCoinAmount(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),Ba({aptosConfig:this.config,...t})}async getAccountOwnedObjects(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["account_transactions_processor"]}),af({aptosConfig:this.config,...t})}async deriveAccountFromPrivateKey(t){return cf({aptosConfig:this.config,...t})}};var Cd=Pc(Ed(),1);async function Ud(r){var t;let{params:e,method:n,url:o,headers:s,body:a,overrides:u}=r,p={headers:s,method:n,url:o,params:e,data:a,withCredentials:(t=u?.WITH_CREDENTIALS)!=null?t:!0};try{let h=await(0,Cd.default)(p);return{status:h.status,statusText:h.statusText,data:h.data,headers:h.headers,config:h.config}}catch(h){let y=h;if(y.response)return y.response;throw h}}var Co=class{constructor(t){this.network=t?.network??Ds,this.fullnode=t?.fullnode,this.faucet=t?.faucet,this.indexer=t?.indexer,this.client=t?.client??{provider:Ud},this.clientConfig=t?.clientConfig??{}}getRequestUrl(t){switch(t){case 0:if(this.fullnode!==void 0)return this.fullnode;if(this.network==="custom")throw new Error("Please provide a custom full node url");return Ms[this.network];case 2:if(this.faucet!==void 0)return this.faucet;if(this.network==="custom")throw new Error("Please provide a custom faucet url");return qs[this.network];case 1:if(this.indexer!==void 0)return this.indexer;if(this.network==="custom")throw new Error("Please provide a custom indexer url");return ci[this.network];default:throw Error(`apiType ${t} is not supported`)}}isIndexerRequest(t){return ci[this.network]===t}};var Uo=class extends Z{constructor(e){super();this.accountAddress=N.ONE;this.moduleName=new Ze("account");this.structName=new Ze("RotationProofChallenge");this.sequenceNumber=new rt(e.sequenceNumber),this.originator=e.originator,this.currentAuthKey=e.currentAuthKey,this.newPublicKey=Ie.U8(e.newPublicKey.toUint8Array())}serialize(e){e.serialize(this.accountAddress),e.serialize(this.moduleName),e.serialize(this.structName),e.serialize(this.sequenceNumber),e.serialize(this.originator),e.serialize(this.currentAuthKey),e.serialize(this.newPublicKey)}};var xt=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return er.load(t);case 1:return Io.load(t);case 2:return Vt.load(t);case 3:return gn.load(t);default:throw new Error(`Unknown variant index for AccountAuthenticator: ${e}`)}}isEd25519(){return this instanceof er}isMultiEd25519(){return this instanceof Io}isSingleKey(){return this instanceof Vt}isMultiKey(){return this instanceof gn}},er=class r extends xt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Be.deserialize(e),o=Ke.deserialize(e);return new r(n,o)}},Io=class r extends xt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Kt.deserialize(e),o=sn.deserialize(e);return new r(n,o)}},Vt=class r extends xt{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(2),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Me.deserialize(e),o=Zt.deserialize(e);return new r(n,o)}},gn=class r extends xt{constructor(e,n,o){super();this.public_keys=e,this.signatures=n,this.signatures_bitmap=o}serialize(e){e.serializeU32AsUleb128(3),this.public_keys.serialize(e),e.serializeVector(this.signatures),e.serializeBytes(this.signatures_bitmap)}static load(e){let n=dn.deserialize(e),o=e.deserializeVector(Zt),s=e.deserializeBytes();return new r(n,o,s)}};var tr=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return hn.load(t);case 1:return Ji.load(t);case 2:return yn.load(t);case 3:return mn.load(t);case 4:return An.load(t);default:throw new Error(`Unknown variant index for TransactionAuthenticator: ${e}`)}}},hn=class r extends tr{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(0),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Be.deserialize(e),o=Ke.deserialize(e);return new r(n,o)}},Ji=class r extends tr{constructor(e,n){super();this.public_key=e,this.signature=n}serialize(e){e.serializeU32AsUleb128(1),this.public_key.serialize(e),this.signature.serialize(e)}static load(e){let n=Kt.deserialize(e),o=sn.deserialize(e);return new r(n,o)}},yn=class r extends tr{constructor(e,n,o){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o}serialize(e){e.serializeU32AsUleb128(2),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers)}static load(e){let n=xt.deserialize(e),o=e.deserializeVector(N),s=e.deserializeVector(xt);return new r(n,o,s)}},mn=class r extends tr{constructor(e,n,o,s){super();this.sender=e,this.secondary_signer_addresses=n,this.secondary_signers=o,this.fee_payer=s}serialize(e){e.serializeU32AsUleb128(3),this.sender.serialize(e),e.serializeVector(this.secondary_signer_addresses),e.serializeVector(this.secondary_signers),this.fee_payer.address.serialize(e),this.fee_payer.authenticator.serialize(e)}static load(e){let n=xt.deserialize(e),o=e.deserializeVector(N),s=e.deserializeVector(xt),a=N.deserialize(e),u=xt.deserialize(e),p={address:a,authenticator:u};return new r(n,o,s,p)}},An=class r extends tr{constructor(e){super();this.sender=e}serialize(e){e.serializeU32AsUleb128(4),this.sender.serialize(e)}static load(e){let n=xt.deserialize(e);return new r(n)}};var xn=class r extends Z{constructor(e){super();this.chainId=e}serialize(e){e.serializeU8(this.chainId)}static deserialize(e){let n=e.deserializeU8();return new r(n)}};var qe=class r extends Z{constructor(e){super();this.identifier=e}serialize(e){e.serializeStr(this.identifier)}static deserialize(e){let n=e.deserializeStr();return new r(n)}};var jn=class r extends Z{constructor(e,n){super();this.address=e,this.name=n}static fromStr(e){let n=e.split("::");if(n.length!==2)throw new Error("Invalid module id.");return new r(N.fromString(n[0]),new qe(n[1]))}serialize(e){this.address.serialize(e),this.name.serialize(e)}static deserialize(e){let n=N.deserialize(e),o=qe.deserialize(e);return new r(n,o)}};var He=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return bn.load(t);case 1:return wn.load(t);case 2:return vn.load(t);case 3:return Sn.load(t);case 4:return Cn.load(t);case 5:return Kr.load(t);case 6:return In.load(t);case 7:return br.load(t);case 8:return Tn.load(t);case 9:return _n.load(t);case 10:return En.load(t);case 255:return Un.load(t);default:throw new Error(`Unknown variant index for TypeTag: ${e}`)}}isBool(){return this instanceof bn}isAddress(){return this instanceof Cn}isGeneric(){return this instanceof Un}isSigner(){return this instanceof Kr}isVector(){return this instanceof In}isStruct(){return this instanceof br}isU8(){return this instanceof wn}isU16(){return this instanceof Tn}isU32(){return this instanceof _n}isU64(){return this instanceof vn}isU128(){return this instanceof Sn}isU256(){return this instanceof En}},bn=class r extends He{toString(){return"bool"}serialize(t){t.serializeU32AsUleb128(0)}static load(t){return new r}},wn=class r extends He{toString(){return"u8"}serialize(t){t.serializeU32AsUleb128(1)}static load(t){return new r}},Tn=class r extends He{toString(){return"u16"}serialize(t){t.serializeU32AsUleb128(8)}static load(t){return new r}},_n=class r extends He{toString(){return"u32"}serialize(t){t.serializeU32AsUleb128(9)}static load(t){return new r}},vn=class r extends He{toString(){return"u64"}serialize(t){t.serializeU32AsUleb128(2)}static load(t){return new r}},Sn=class r extends He{toString(){return"u128"}serialize(t){t.serializeU32AsUleb128(3)}static load(t){return new r}},En=class r extends He{toString(){return"u256"}serialize(t){t.serializeU32AsUleb128(10)}static load(t){return new r}},Cn=class r extends He{toString(){return"address"}serialize(t){t.serializeU32AsUleb128(4)}static load(t){return new r}},Kr=class r extends He{toString(){return"signer"}serialize(t){t.serializeU32AsUleb128(5)}static load(t){return new r}},Po=class r extends He{constructor(e){super();this.value=e}toString(){return`&${this.value.toString()}`}serialize(e){e.serializeU32AsUleb128(254)}static load(e){let n=He.deserialize(e);return new r(n)}},Un=class r extends He{constructor(e){super();this.value=e}toString(){return`T${this.value}`}serialize(e){e.serializeU32AsUleb128(255),e.serializeU32(this.value)}static load(e){let n=e.deserializeU32();return new r(n)}},In=class r extends He{constructor(e){super();this.value=e}toString(){return`vector<${this.value.toString()}>`}serialize(e){e.serializeU32AsUleb128(6),this.value.serialize(e)}static load(e){let n=He.deserialize(e);return new r(n)}},br=class r extends He{constructor(e){super();this.value=e}toString(){let e="";return this.value.typeArgs.length>0&&(e=`<${this.value.typeArgs.map(n=>n.toString()).join(", ")}>`),`${this.value.address.toString()}::${this.value.moduleName.identifier}::${this.value.name.identifier}${e}`}serialize(e){e.serializeU32AsUleb128(7),this.value.serialize(e)}static load(e){let n=rr.deserialize(e);return new r(n)}isTypeTag(e,n,o){return this.value.moduleName.identifier===n&&this.value.name.identifier===o&&this.value.address.equals(e)}isString(){return this.isTypeTag(N.ONE,"string","String")}isOption(){return this.isTypeTag(N.ONE,"option","Option")}isObject(){return this.isTypeTag(N.ONE,"object","Object")}},rr=class r extends Z{constructor(e,n,o,s){super();this.address=e,this.moduleName=n,this.name=o,this.typeArgs=s}serialize(e){e.serialize(this.address),e.serialize(this.moduleName),e.serialize(this.name),e.serializeVector(this.typeArgs)}static deserialize(e){let n=N.deserialize(e),o=qe.deserialize(e),s=qe.deserialize(e),a=e.deserializeVector(He);return new r(n,o,s,a)}};function Th(){return new rr(N.ONE,new qe("aptos_coin"),new qe("AptosCoin"),[])}function _h(){return new rr(N.ONE,new qe("string"),new qe("String"),[])}function vh(r){return new rr(N.ONE,new qe("option"),new qe("Option"),[r])}function Sh(r){return new rr(N.ONE,new qe("object"),new qe("Object"),[r])}function Id(r){let t=r.deserializeUleb128AsU32();switch(t){case 0:return ct.deserialize(r);case 1:return rt.deserialize(r);case 2:return Pt.deserialize(r);case 3:return N.deserialize(r);case 4:return Ie.deserialize(r,ct);case 5:return Fe.deserialize(r);case 6:return Ut.deserialize(r);case 7:return It.deserialize(r);case 8:return Rt.deserialize(r);default:throw new Error(`Unknown variant index for ScriptTransactionArgument: ${t}`)}}var $r=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return Yn.load(t);case 2:return Xn.load(t);case 3:return Zn.load(t);default:throw new Error(`Unknown variant index for TransactionPayload: ${e}`)}}},Yn=class r extends $r{constructor(e){super();this.script=e}serialize(e){e.serializeU32AsUleb128(0),this.script.serialize(e)}static load(e){let n=Jn.deserialize(e);return new r(n)}},Xn=class r extends $r{constructor(e){super();this.entryFunction=e}serialize(e){e.serializeU32AsUleb128(2),this.entryFunction.serialize(e)}static load(e){let n=Pn.deserialize(e);return new r(n)}},Zn=class r extends $r{constructor(e){super();this.multiSig=e}serialize(e){e.serializeU32AsUleb128(3),this.multiSig.serialize(e)}static load(e){let n=eo.deserialize(e);return new r(n)}},Pn=class r{constructor(t,e,n,o){this.module_name=t,this.function_name=e,this.type_args=n,this.args=o}static build(t,e,n,o){return new r(jn.fromStr(t),new qe(e),n,o)}serialize(t){this.module_name.serialize(t),this.function_name.serialize(t),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForEntryFunction(t)})}static deserialize(t){let e=jn.deserialize(t),n=qe.deserialize(t),o=t.deserializeVector(He),s=t.deserializeUleb128AsU32(),a=new Array;for(let u=0;u<s;u+=1){let p=t.deserializeUleb128AsU32(),h=xo.deserialize(t,p);a.push(h)}return new r(e,n,o,a)}},Jn=class r{constructor(t,e,n){this.bytecode=t,this.type_args=e,this.args=n}serialize(t){t.serializeBytes(this.bytecode),t.serializeVector(this.type_args),t.serializeU32AsUleb128(this.args.length),this.args.forEach(e=>{e.serializeForScriptFunction(t)})}static deserialize(t){let e=t.deserializeBytes(),n=t.deserializeVector(He),o=t.deserializeUleb128AsU32(),s=new Array;for(let a=0;a<o;a+=1){let u=Id(t);s.push(u)}return new r(e,n,s)}},eo=class r{constructor(t,e){this.multisig_address=t,this.transaction_payload=e}serialize(t){this.multisig_address.serialize(t),this.transaction_payload===void 0?t.serializeBool(!1):(t.serializeBool(!0),this.transaction_payload.serialize(t))}static deserialize(t){let e=N.deserialize(t),n=t.deserializeBool(),o;return n&&(o=to.deserialize(t)),new r(e,o)}},to=class r{constructor(t){this.transaction_payload=t}serialize(t){t.serializeU32AsUleb128(0),this.transaction_payload.serialize(t)}static deserialize(t){return t.deserializeUleb128AsU32(),new r(Pn.deserialize(t))}};var zt=class r extends Z{constructor(e,n,o,s,a,u,p){super();this.sender=e,this.sequence_number=n,this.payload=o,this.max_gas_amount=s,this.gas_unit_price=a,this.expiration_timestamp_secs=u,this.chain_id=p}serialize(e){this.sender.serialize(e),e.serializeU64(this.sequence_number),this.payload.serialize(e),e.serializeU64(this.max_gas_amount),e.serializeU64(this.gas_unit_price),e.serializeU64(this.expiration_timestamp_secs),this.chain_id.serialize(e)}static deserialize(e){let n=N.deserialize(e),o=e.deserializeU64(),s=$r.deserialize(e),a=e.deserializeU64(),u=e.deserializeU64(),p=e.deserializeU64(),h=xn.deserialize(e);return new r(n,o,s,a,u,p,h)}},Ro=class extends Z{static deserialize(t){let e=t.deserializeUleb128AsU32();switch(e){case 0:return nr.load(t);case 1:return or.load(t);default:throw new Error(`Unknown variant index for RawTransactionWithData: ${e}`)}}},nr=class r extends Ro{constructor(e,n){super();this.raw_txn=e,this.secondary_signer_addresses=n}serialize(e){e.serializeU32AsUleb128(0),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses)}static load(e){let n=zt.deserialize(e),o=e.deserializeVector(N);return new r(n,o)}},or=class r extends Ro{constructor(e,n,o){super();this.raw_txn=e,this.secondary_signer_addresses=n,this.fee_payer_address=o}serialize(e){e.serializeU32AsUleb128(1),this.raw_txn.serialize(e),e.serializeVector(this.secondary_signer_addresses),this.fee_payer_address.serialize(e)}static load(e){let n=zt.deserialize(e),o=e.deserializeVector(N),s=N.deserialize(e);return new r(n,o,s)}};var Qt=class r extends Z{constructor(e,n){super();this.raw_txn=e,this.authenticator=n}serialize(e){this.raw_txn.serialize(e),this.authenticator.serialize(e)}static deserialize(e){let n=zt.deserialize(e),o=tr.deserialize(e);return new r(n,o)}};function Pd(r){return!!r.match(/^[_a-zA-Z0-9]+$/)}function Rd(r){return!!r.match(/\s/)}function Eh(r){return!!r.match(/^T[0-9]+$/)}function Ch(r,t){let e=t;for(;e<r.length;e+=1){let n=r[e];if(!Rd(n))break}return e}var Bd=(_=>(_.InvalidTypeTag="unknown type",_.UnexpectedGenericType="unexpected generic type",_.UnexpectedTypeArgumentClose="unexpected '>'",_.UnexpectedWhitespaceCharacter="unexpected whitespace character",_.UnexpectedComma="unexpected ','",_.TypeArgumentCountMismatch="type argument count doesn't match expected amount",_.MissingTypeArgumentClose="no matching '>' for '<'",_.UnexpectedPrimitiveTypeArguments="primitive types not expected to have type arguments",_.UnexpectedVectorTypeArgumentCount="vector type expected to have exactly one type argument",_.UnexpectedStructFormat="unexpected struct format, must be of the form 0xaddress::module_name::struct_name",_.InvalidModuleNameCharacter="module name must only contain alphanumeric or '_' characters",_.InvalidStructNameCharacter="struct name must only contain alphanumeric or '_' characters",_))(Bd||{}),ke=class extends Error{constructor(t,e){super(`Failed to parse typeTag '${t}', ${e}`)}};function ts(r,t){let e=t?.allowGenerics??!1,n=[],o=[],s=[],a=0,u="",p=1;for(;a<r.length;){let h=r[a];if(h==="<")n.push({savedExpectedTypes:p,savedStr:u,savedTypes:s}),u="",s=[],p=1;else if(h===">"){if(u!==""){let z=es(u,o,e);s.push(z)}let y=n.pop();if(y===void 0)throw new ke(r,"unexpected '>'");if(p!==s.length)throw new ke(r,"type argument count doesn't match expected amount");let{savedStr:A,savedTypes:_,savedExpectedTypes:T}=y;o=s,s=_,u=A,p=T}else if(h===","){if(u.length!==0){let y=es(u,o,e);o=[],s.push(y),u="",p+=1}}else if(Rd(h)){let y=!1;if(u.length!==0){let _=es(u,o,e);o=[],s.push(_),u="",y=!0}a=Ch(r,a);let A=r[a];if(a<r.length&&y&&A!==","&&A!==">")throw new ke(r,"unexpected whitespace character");continue}else u+=h;a+=1}if(n.length>0)throw new ke(r,"no matching '>' for '<'");switch(s.length){case 0:return es(u,o,e);case 1:if(u==="")return s[0];throw new ke(r,"unexpected ','");default:throw new ke(r,"unexpected whitespace character")}}function es(r,t,e){switch(r){case"&signer":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new Po(new Kr);case"signer":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new Kr;case"bool":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new bn;case"address":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new Cn;case"u8":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new wn;case"u16":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new Tn;case"u32":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new _n;case"u64":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new vn;case"u128":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new Sn;case"u256":if(t.length>0)throw new ke(r,"primitive types not expected to have type arguments");return new En;case"vector":if(t.length!==1)throw new ke(r,"vector type expected to have exactly one type argument");return new In(t[0]);default:if(Eh(r)){if(e)return new Un(Number(r.split("T")[1]));throw new ke(r,"unexpected generic type")}if(!r.match(/.*:.*/))throw new ke(r,"unknown type");let n=r.split("::");if(n.length!==3)throw new ke(r,"unexpected struct format, must be of the form 0xaddress::module_name::struct_name");if(!Pd(n[1]))throw new ke(r,"module name must only contain alphanumeric or '_' characters");if(!Pd(n[2]))throw new ke(r,"struct name must only contain alphanumeric or '_' characters");return new br(new rr(N.fromString(n[0]),new qe(n[1]),new qe(n[2]),t))}}function nc(r){return typeof r=="boolean"}function Rn(r){return typeof r=="string"}function Bo(r){return typeof r=="number"}function Oo(r){return typeof r=="number"||typeof r=="bigint"||typeof r=="string"}function oc(r){return r==null}function ic(r){return rs(r)||os(r)||is(r)||ss(r)||as(r)||cs(r)||us(r)||No(r)||ns(r)||Od(r)||r instanceof Ie||r instanceof dr}function rs(r){return r instanceof Fe}function No(r){return r instanceof N}function ns(r){return r instanceof Ze}function Od(r){return r instanceof Ur}function os(r){return r instanceof ct}function is(r){return r instanceof Ut}function ss(r){return r instanceof It}function as(r){return r instanceof rt}function cs(r){return r instanceof Pt}function us(r){return r instanceof Rt}function fs(r){return"bytecode"in r}function ze(r,t){throw new Error(`Type mismatch for argument ${t}, expected '${r}'`)}function sc(r){let t=r.params.findIndex(e=>e!=="signer"&&e!=="&signer");return t<0?r.params.length:t}function ds(r){let t=r.split("::");if(t.length!==3)throw new Error(`Invalid function ${r}`);let e=t[0],n=t[1],o=t[2];return{moduleAddress:e,moduleName:n,functionName:o}}function ac(r){return r?.map(t=>Rn(t)?ts(t):t)??[]}async function cc(r,t,e,n){let s=(await Gi({aptosConfig:n,accountAddress:r,moduleName:t})).abi?.exposed_functions.find(p=>p.name===e);if(!s)throw new Error(`Could not find entry function ABI for '${r}::${t}::${e}'`);if(!s.is_entry)throw new Error(`'${r}::${t}::${e}' is not an entry function`);let a=sc(s),u=[];for(let p=a;p<s.params.length;p+=1)u.push(ts(s.params[p],{allowGenerics:!0}));return{typeParameters:s.generic_type_params,parameters:u}}function uc(r,t,e,n,o){if(n>=t.parameters.length)throw new Error(`Too many arguments for '${r}', expected ${t.parameters.length}`);let s=t.parameters[n];return ko(e,s,n,o)}function ko(r,t,e,n){return ic(r)?(Ih(t,r,e),r):Uh(r,t,e,n)}function Uh(r,t,e,n){if(t.isBool()){if(nc(r))return new Fe(r);ze("boolean",e)}if(t.isAddress()){if(Rn(r))return N.fromString(r);ze("string",e)}if(t.isU8()){if(Bo(r))return new ct(r);ze("number",e)}if(t.isU16()){if(Bo(r))return new Ut(r);ze("number",e)}if(t.isU32()){if(Bo(r))return new It(r);ze("number",e)}if(t.isU64()){if(Oo(r))return new rt(BigInt(r));ze("bigint | number | string",e)}if(t.isU128()){if(Oo(r))return new Pt(BigInt(r));ze("bigint | number | string",e)}if(t.isU256()){if(Oo(r))return new Rt(BigInt(r));ze("bigint | number | string",e)}if(t.isGeneric()){let o=t.value;if(o<0||o>=n.length)throw new Error(`Generic argument ${t.toString()} is invalid for argument ${e}`);ko(r,n[o],e,n)}if(t.isVector()){if(t.value.isU8()){if(Rn(r))try{return Ie.U8(me.fromHexInput(r).toUint8Array())}catch{throw new Error(`vector<u8> must be passed in as a hex string or a Uint8array, type '${t.toString()}'`)}if(r instanceof Uint8Array)return Ie.U8(r)}if(Array.isArray(r))return new Ie(r.map(o=>ko(o,t.value,e,n)));throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}if(t.isStruct()){if(t.isString()){if(Rn(r))return new Ze(r);ze("string",e)}if(t.isObject()){if(Rn(r))return N.fromString(r);ze("string",e)}if(t.isOption())return oc(r)?new dr(null):new dr(ko(r,t.value.typeArgs[0],e,n));throw new Error(`Unsupported struct input type for argument ${e}, type '${t.toString()}'`)}throw new Error(`Type mismatch for argument ${e}, type '${t.toString()}'`)}function Ih(r,t,e){if(r.isBool()){if(rs(t))return;ze("Bool",e)}if(r.isAddress()){if(No(t))return;ze("AccountAddress",e)}if(r.isU8()){if(os(t))return;ze("U8",e)}if(r.isU16()){if(is(t))return;ze("U16",e)}if(r.isU32()){if(ss(t))return;ze("U32",e)}if(r.isU64()){if(as(t))return;ze("U64",e)}if(r.isU128()){if(cs(t))return;ze("U128",e)}if(r.isU256()){if(us(t))return;ze("U256",e)}if(r.isVector()){if(t instanceof Ie)return;ze("MoveVector",e)}if(r instanceof br){if(r.isString()){if(ns(t))return;ze("MoveString",e)}if(r.isObject()){if(No(t))return;ze("AccountAddress",e)}if(r.isOption()){if(t instanceof dr)return;ze("MoveOption",e)}}throw new Error(`Type mismatch for argument ${e}, expected '${r.toString()}'`)}async function Mo(r){if(fs(r))return kd(r);let{moduleAddress:t,moduleName:e,functionName:n}=ds(r.function),o=await Fn(async()=>cc(t,e,n,r.aptosConfig),`entry-function-${r.aptosConfig.network}-${t}-${e}-${n}`,1e3*60*5)();return Nd(r,o)}function Nd(r,t){if(fs(r))return kd(r);let{moduleAddress:e,moduleName:n,functionName:o}=ds(r.function),s=ac(r.typeArguments);if(s.length!==t.typeParameters.length)throw new Error(`Type argument count mismatch, expected ${t.typeParameters.length}, received ${s.length}`);let a=r.functionArguments.map((p,h)=>uc(r.function,t,p,h,s));if(a.length!==t.parameters.length)throw new Error(`Too few arguments for '${e}::${n}::${o}', expected ${t.parameters.length} but got ${a.length}`);let u=Pn.build(`${e}::${n}`,o,s,a);if("multisigAddress"in r){let p=N.from(r.multisigAddress);return new Zn(new eo(p,new to(u)))}return new Xn(u)}function kd(r){return new Yn(new Jn(me.fromHexInput(r.bytecode).toUint8Array(),r.typeArguments??[],r.functionArguments))}async function zd(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=o?.accountSequenceNumber!==void 0?Promise.resolve({sequence_number:o.accountSequenceNumber}):Jt({aptosConfig:t,accountAddress:e}),a=ui[t.network]?Promise.resolve({chain_id:ui[t.network]}):zi({aptosConfig:t}),u=o?.gasUnitPrice?Promise.resolve({gas_estimate:o.gasUnitPrice}):Fi({aptosConfig:t}),[{sequence_number:p},{chain_id:h},{gas_estimate:y}]=await Promise.all([s,a,u]),{maxGasAmount:A,gasUnitPrice:_,expireTimestamp:T}={maxGasAmount:o?.maxGasAmount?BigInt(o.maxGasAmount):BigInt(Gs),gasUnitPrice:BigInt(y),expireTimestamp:BigInt(Math.floor(Date.now()/1e3)+Ls),...o};return new zt(N.from(e),BigInt(p),n,BigInt(A),BigInt(_),BigInt(T),new xn(h))}async function ls(r){let{aptosConfig:t,sender:e,payload:n,options:o}=r,s=await zd({aptosConfig:t,sender:e,payload:n,options:o});if("secondarySignerAddresses"in r){let a=r.secondarySignerAddresses?.map(u=>N.from(u))??[];return{rawTransaction:s,secondarySignerAddresses:a,feePayerAddress:r.feePayerAddress?N.from(r.feePayerAddress):void 0}}return{rawTransaction:s,feePayerAddress:r.feePayerAddress?N.from(r.feePayerAddress):void 0}}function fc(r){let{signerPublicKey:t,transaction:e,secondarySignersPublicKeys:n,feePayerPublicKey:o}=r,s=zo(t);if(e.feePayerAddress){let u=new or(e.rawTransaction,e.secondarySignerAddresses??[],e.feePayerAddress),p=[];n&&(p=n.map(A=>zo(A)));let h=zo(o),y=new mn(s,e.secondarySignerAddresses??[],p,{address:e.feePayerAddress,authenticator:h});return new Qt(u.raw_txn,y).bcsToBytes()}if(e.secondarySignerAddresses){let u=new nr(e.rawTransaction,e.secondarySignerAddresses),p=[];p=n.map(y=>zo(y));let h=new yn(s,e.secondarySignerAddresses,p);return new Qt(u.raw_txn,h).bcsToBytes()}let a;if(s instanceof er)a=new hn(s.public_key,s.signature);else if(s instanceof Vt)a=new An(s);else throw new Error("Invalid public key");return new Qt(e.rawTransaction,a).bcsToBytes()}function zo(r){if(r instanceof Me){if(r.publicKey instanceof Be)return new Vt(r,new Zt(new Ke(new Uint8Array(64))));if(r.publicKey instanceof kt)return new Vt(r,new Zt(new yr(new Uint8Array(64))))}return new er(new Be(r.toUint8Array()),new Ke(new Uint8Array(64)))}function dc(r){let{signer:t,transaction:e}=r,n=ps(e),o=t.sign(n);switch(t.signingScheme){case 0:return new er(new Be(t.publicKey.toUint8Array()),new Ke(o.toUint8Array()));case 2:if(!Me.isPublicKey(t.publicKey))throw new Error(`Cannot sign transaction, public key does not match ${t.signingScheme}`);return new Vt(t.publicKey,new Zt(o));default:throw new Error(`Cannot sign transaction, signing scheme ${t.signingScheme} not supported`)}}function lc(r){let{transaction:t,senderAuthenticator:e,feePayerAuthenticator:n,additionalSignersAuthenticators:o}=r,s=pc(t);if((n||o)&&(s instanceof nr||s instanceof or))return Md(s,e,n,o);if(e instanceof er&&s instanceof zt){let a=new hn(e.public_key,e.signature);return new Qt(s,a).bcsToBytes()}if((e instanceof Vt||e instanceof gn)&&s instanceof zt){let a=new An(e);return new Qt(s,a).bcsToBytes()}throw new Error(`Cannot generate a signed transaction, ${e} is not a supported account authentication scheme`)}function pc(r){return r.feePayerAddress?new or(r.rawTransaction,r.secondarySignerAddresses??[],r.feePayerAddress):r.secondarySignerAddresses?new nr(r.rawTransaction,r.secondarySignerAddresses):r.rawTransaction}function Md(r,t,e,n){if(r instanceof or){if(!e)throw new Error("Must provide a feePayerAuthenticator argument to generate a signed fee payer transaction");let o=new mn(t,r.secondary_signer_addresses,n??[],{address:r.fee_payer_address,authenticator:e});return new Qt(r.raw_txn,o).bcsToBytes()}if(r instanceof nr){if(!n)throw new Error("Must provide a additionalSignersAuthenticators argument to generate a signed multi agent transaction");let o=new yn(t,r.secondary_signer_addresses,n??[]);return new Qt(r.raw_txn,o).bcsToBytes()}throw new Error(`Cannot prepare multi signers transaction to submission, ${typeof r} transaction is not supported`)}function ps(r){let t=pc(r),e=rn.create();if(t instanceof zt)e.update(Fs);else if(t instanceof nr)e.update(fi);else if(t instanceof or)e.update(fi);else throw new Error(`Unknown transaction type to sign on: ${t}`);let n=e.digest(),o=t.bcsToBytes(),s=new Uint8Array(n.length+o.length);return s.set(n),s.set(o,n.length),s}async function Ye(r){let t=await Ph(r);return Rh(r,t)}async function Ph(r){let{aptosConfig:t,data:e}=r,n,o;return"bytecode"in e?(n=e,o=await Mo(n)):"multisigAddress"in e?(n={aptosConfig:t,multisigAddress:e.multisigAddress,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Mo(n)):(n={aptosConfig:t,function:e.function,functionArguments:e.functionArguments,typeArguments:e.typeArguments},o=await Mo(n)),o}async function Rh(r,t){let{aptosConfig:e,sender:n,options:o}=r,s;if(Bh(r)&&(s=N.ZERO.toString()),Oh(r)){let{secondarySignerAddresses:a}=r;return ls({aptosConfig:e,sender:n,payload:t,options:o,secondarySignerAddresses:a,feePayerAddress:s})}return ls({aptosConfig:e,sender:n,payload:t,options:o,feePayerAddress:s})}function Bh(r){return r.withFeePayer===!0}function Oh(r){return"secondarySignerAddresses"in r}function qd(r){let{transaction:t}=r;return ps(t)}function gs(r){return dc({...r})}async function gc(r){let{aptosConfig:t,transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:a}=r,u=fc({transaction:e,signerPublicKey:n,secondarySignersPublicKeys:o,feePayerPublicKey:s,options:a}),{data:p}=await Xr({aptosConfig:t,body:u,path:"transactions/simulate",params:{estimate_gas_unit_price:r.options?.estimateGasUnitPrice??!1,estimate_max_gas_amount:r.options?.estimateMaxGasAmount??!1,estimate_prioritized_gas_unit_price:r.options?.estimatePrioritizedGasUnitPrice??!1},originMethod:"simulateTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return p}async function hs(r){let{aptosConfig:t}=r,e=lc({...r}),{data:n}=await Xr({aptosConfig:t,body:e,path:"transactions",originMethod:"submitTransaction",contentType:"application/x.aptos.signed_transaction+bcs"});return n}async function qo(r){let{aptosConfig:t,signer:e,transaction:n}=r,o=gs({signer:e,transaction:n});return hs({aptosConfig:t,transaction:n,senderAuthenticator:o})}async function Dd(r){let{aptosConfig:t,account:e,metadataBytes:n,moduleBytecode:o,options:s}=r,a=o.map(p=>Ie.U8(p));return await Ye({aptosConfig:t,sender:N.from(e),data:{function:"0x1::code::publish_package_txn",functionArguments:[Ie.U8(n),new Ie(a)]},options:s})}async function Gd(r){let{aptosConfig:t,fromAccount:e,toNewPrivateKey:n}=r,o=await Jt({aptosConfig:t,accountAddress:e.accountAddress}),s=Ar.fromPrivateKey({privateKey:n,legacy:!0}),u=new Uo({sequenceNumber:BigInt(o.sequence_number),originator:e.accountAddress,currentAuthKey:N.from(o.authentication_key),newPublicKey:s.publicKey}).bcsToBytes(),p=e.sign(u),h=s.sign(u),y=await Ye({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::account::rotate_authentication_key",functionArguments:[new ct(e.signingScheme.valueOf()),Ie.U8(e.publicKey.toUint8Array()),new ct(s.signingScheme.valueOf()),Ie.U8(s.publicKey.toUint8Array()),Ie.U8(p.toUint8Array()),Ie.U8(h.toUint8Array())]}});return await qo({aptosConfig:t,signer:e,transaction:y})}async function Ld(r){let{aptosConfig:t,sender:e,recipient:n,amount:o,coinType:s,options:a}=r,u=s??yo;return await Ye({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::aptos_account::transfer_coins",typeArguments:[u],functionArguments:[n,o]},options:a})}var Do=class{constructor(t){this.config=t}async transferCoinTransaction(t){return Ld({aptosConfig:this.config,...t})}};async function Fd(r){let{aptosConfig:t,options:e,creator:n}=r;return await Ye({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::mint",functionArguments:[new Ze(r.collection),new Ze(r.description),new Ze(r.name),new Ze(r.uri),Ie.MoveString([]),Ie.MoveString([]),new Ie([])]},options:e})}async function Kd(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:N.from(e).toStringLong()}};return(await Ae({aptosConfig:t,query:{query:Hu,variables:{where_condition:n}},originMethod:"getTokenData"})).current_token_datas_v2[0]}async function $d(r){let{aptosConfig:t,tokenAddress:e}=r,n={token_data_id:{_eq:N.from(e).toStringLong()}};return(await Ae({aptosConfig:t,query:{query:Ua,variables:{where_condition:n}},originMethod:"getCurrentTokenOwnership"})).current_token_ownerships_v2[0]}async function Hd(r){let{aptosConfig:t,ownerAddress:e,options:n}=r,o={owner_address:{_eq:N.from(e).toStringLong()}},s={query:Ua,variables:{where_condition:o,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ae({aptosConfig:t,query:s,originMethod:"getOwnedTokens"})).current_token_ownerships_v2}async function Vd(r){let{aptosConfig:t,tokenAddress:e,options:n}=r,o={token_data_id:{_eq:N.from(e).toStringLong()}},s={query:$u,variables:{where_condition:o,offset:n?.offset,limit:n?.limit,order_by:n?.orderBy}};return(await Ae({aptosConfig:t,query:s,originMethod:"getTokenActivity"})).token_activities_v2}async function Qd(r){let{aptosConfig:t,options:e,creator:n}=r;return await Ye({aptosConfig:t,sender:n.accountAddress,data:{function:"0x4::aptos_token::create_collection",functionArguments:[new Ze(r.description),new rt(r.maxSupply??en),new Ze(r.name),new Ze(r.uri),new Fe(r.mutableDescription??!0),new Fe(r.mutableRoyalty??!0),new Fe(r.mutableURI??!0),new Fe(r.mutableTokenDescription??!0),new Fe(r.mutableTokenName??!0),new Fe(r.mutableTokenProperties??!0),new Fe(r.mutableTokenURI??!0),new Fe(r.tokensBurnableByCreator??!0),new Fe(r.tokensFreezableByCreator??!0),new rt(r.royaltyNumerator??0),new rt(r.royaltyDenominator??1)]},options:e})}async function hc(r){let{aptosConfig:t,creatorAddress:e,collectionName:n,options:o}=r,s=N.from(e),a={collection_name:{_eq:n},creator_address:{_eq:s.toStringLong()}};return o?.tokenStandard&&(a.token_standard={_eq:o?.tokenStandard??"v2"}),(await Ae({aptosConfig:t,query:{query:qu,variables:{where_condition:a}},originMethod:"getCollectionData"})).current_collections_v2[0]}async function Wd(r){return(await hc(r)).collection_id}var Go=class{constructor(t){this.config=t}async createCollectionTransaction(t){return Qd({aptosConfig:this.config,...t})}async getCollectionData(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:ro(t.options?.tokenStandard)}),hc({aptosConfig:this.config,...t})}async getCollectionId(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:ro(t.options?.tokenStandard)}),Wd({aptosConfig:this.config,...t})}async mintTokenTransaction(t){return Fd({aptosConfig:this.config,...t})}async getTokenData(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:ro(void 0)}),Kd({aptosConfig:this.config,...t})}async getCurrentTokenOwnership(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:ro(void 0)}),$d({aptosConfig:this.config,...t})}async getOwnedTokens(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:ro(void 0)}),Hd({aptosConfig:this.config,...t})}async getTokenActivity(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:ro(void 0)}),Vd({aptosConfig:this.config,...t})}};function ro(r){switch(r){case"v1":return["token_processor"];case"v2":return["token_v2_processor"];default:return["token_processor","token_v2_processor"]}}async function jd(r){let{accountAddress:t,aptosConfig:e,creationNumber:n}=r,s={account_address:{_eq:N.from(t).toStringLong()},creation_number:{_eq:n}};return ys({aptosConfig:e,options:{where:s}})}async function Yd(r){let{accountAddress:t,aptosConfig:e,eventType:n,options:o}=r,u={where:{account_address:{_eq:N.from(t).toStringLong()},indexed_type:{_eq:n}},pagination:o,orderBy:o?.orderBy};return ys({aptosConfig:e,options:u})}async function ys(r){let{aptosConfig:t,options:e}=r,n={query:Lu,variables:{where_condition:e?.where,offset:e?.offset,limit:e?.limit,order_by:e?.orderBy}};return(await Ae({aptosConfig:t,query:n,originMethod:"getEvents"})).events}var Lo=class{constructor(t){this.config=t}async getAccountEventsByCreationNumber(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["events_processor"]}),jd({aptosConfig:this.config,...t})}async getAccountEventsByEventType(t){return await Ce({config:this.config,minimumLedgerVersion:t.minimumLedgerVersion,processorTypes:["events_processor"]}),Yd({aptosConfig:this.config,...t})}async getEvents(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["events_processor"]}),ys({aptosConfig:this.config,...t})}};async function Xd(r){let{aptosConfig:t,accountAddress:e,amount:n,options:o}=r,s=o?.timeoutSecs||ho,{data:a}=await Hs({aptosConfig:t,path:"fund",body:{address:N.from(e).toString(),amount:n},originMethod:"fundAccount"}),u=a.txn_hashes[0],p=await Kn({aptosConfig:t,transactionHash:u,options:{timeoutSecs:s,checkSuccess:o?.checkSuccess}});if(p.type==="user_transaction")return p;throw new Error(`Unexpected transaction received for fund account: ${p.type}`)}var Fo=class{constructor(t){this.config=t}async fundAccount(t){let e=await Xd({aptosConfig:this.config,...t});return t.options?.waitForIndexer!==!1&&await $i({aptosConfig:this.config,minimumLedgerVersion:BigInt(e.version)}),e}};async function yc(r){let{aptosConfig:t,options:e}=r,n={query:Ku,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Ae({aptosConfig:t,query:n,originMethod:"getFungibleAssetMetadata"})).fungible_asset_metadata}async function Zd(r){let{aptosConfig:t,options:e}=r,n={query:Fu,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Ae({aptosConfig:t,query:n,originMethod:"getFungibleAssetActivities"})).fungible_asset_activities}async function Jd(r){let{aptosConfig:t,options:e}=r,n={query:Du,variables:{where_condition:e?.where,limit:e?.limit,offset:e?.offset}};return(await Ae({aptosConfig:t,query:n,originMethod:"getCurrentFungibleAssetBalances"})).current_fungible_asset_balances}async function el(r){let{aptosConfig:t,sender:e,fungibleAssetMetadataAddress:n,recipient:o,amount:s,options:a}=r;return await Ye({aptosConfig:t,sender:e.accountAddress,data:{function:"0x1::primary_fungible_store::transfer",typeArguments:["0x1::fungible_asset::Metadata"],functionArguments:[n,o,s]},options:a})}var Ko=class{constructor(t){this.config=t}async getFungibleAssetMetadata(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),yc({aptosConfig:this.config,...t})}async getFungibleAssetMetadataByAssetType(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),(await yc({aptosConfig:this.config,options:{where:{asset_type:{_eq:t.assetType}}}}))[0]}async getFungibleAssetActivities(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),Zd({aptosConfig:this.config,...t})}async getCurrentFungibleAssetBalances(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["fungible_asset_processor"]}),Jd({aptosConfig:this.config,...t})}async transferFungibleAsset(t){return el({aptosConfig:this.config,...t})}};var $o=class{constructor(t){this.config=t}async getLedgerInfo(){return zi({aptosConfig:this.config})}async getChainId(){return(await this.getLedgerInfo()).chain_id}async getBlockByVersion(t){return Vu({aptosConfig:this.config,...t})}async getBlockByHeight(t){return Qu({aptosConfig:this.config,...t})}async getTableItem(t){return Mi({aptosConfig:this.config,...t})}async view(t){return Gr({aptosConfig:this.config,...t})}async getChainTopUserTransactions(t){return Wu({aptosConfig:this.config,...t})}async queryIndexer(t){return Ae({aptosConfig:this.config,...t})}async getIndexerLastSuccessVersion(){return qi({aptosConfig:this.config})}async getProcessorStatus(t){return Di({aptosConfig:this.config,processorType:t})}};var tl=["A name must be between 3 and 63 characters long,","and can only contain lowercase a-z, 0-9, and hyphens.","A name may not start or end with a hyphen."].join(" ");function rl(r){return!(!r||r.length<3||r.length>63||!/^[a-z\d][a-z\d-]{1,61}[a-z\d]$/.test(r))}function Hr(r){let[t,e,...n]=r.replace(/\.apt$/,"").split(".");if(n.length>0)throw new Error(`${r} is invalid. A name can only have two parts, a domain and a subdomain separated by a "."`);if(!rl(t))throw new Error(`${t} is not valid. ${tl}`);if(e&&!rl(e))throw new Error(`${e} is not valid. ${tl}`);return{domainName:e||t,subdomainName:e?t:void 0}}var Nh="0x585fc9f0f0c54183b039ffc770ca282ebd87307916c215a3e692f2f8e4305e82",kh={testnet:"0x5f8fd2347449685cf41d4db97926ec3a096eaf381332be4f1318ad4d16a8497c",mainnet:"0x867ed1f6bf916171b1de3ee92849b8978b7d1b9e0a8cc982a3d19d535dfd9c0c",local:Nh,custom:null,devnet:null};function wr(r){let t=kh[r.network];if(!t)throw new Error(`The ANS contract is not deployed to ${r.network}`);return t}var zh=r=>({vec:[r]}),Mh=()=>({vec:[]}),mc=r=>r!=null?zh(r):Mh(),ms=r=>{if(r&&typeof r=="object"&&"vec"in r&&Array.isArray(r.vec))return r.vec[0]};async function nl(r){let{aptosConfig:t,name:e}=r,n=wr(t),{domainName:o,subdomainName:s}=Hr(e),a=await Gr({aptosConfig:t,payload:{function:`${n}::router::get_owner_addr`,functionArguments:[o,mc(s)]}}),u=ms(a[0]);return u?N.from(u).toString():void 0}async function ol(r){let{aptosConfig:t,expiration:e,name:n,sender:o,targetAddress:s,toAddress:a,options:u,transferable:p}=r,h=wr(t),{domainName:y,subdomainName:A}=Hr(n),_=e.policy==="subdomain:independent"||e.policy==="subdomain:follow-domain";if(A&&!_)throw new Error("Subdomains must have an expiration policy of either 'subdomain:independent' or 'subdomain:follow-domain'");if(_&&!A)throw new Error(`Policy is set to ${e.policy} but no subdomain was provided`);if(e.policy==="domain"){let P=e.years??1;if(P!==1)throw new Error("For now, names can only be registered for 1 year at a time");let H=P*31536e3;return await Ye({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${h}::router::register_domain`,functionArguments:[y,H,s,a]},options:u})}if(!A)throw new Error(`${e.policy} requires a subdomain to be provided.`);let T=await Ac({aptosConfig:t,name:y});if(!T)throw new Error("The domain does not exist");let z=e.policy==="subdomain:independent"?e.expirationDate:T;if(z>T)throw new Error("The subdomain expiration time cannot be greater than the domain expiration time");return await Ye({aptosConfig:t,sender:o.accountAddress.toString(),data:{function:`${h}::router::register_subdomain`,functionArguments:[y,A,Math.round(z/1e3),e.policy==="subdomain:follow-domain"?1:0,!!p,s,a]},options:u})}async function Ac(r){let{aptosConfig:t,name:e}=r,n=wr(t),{domainName:o,subdomainName:s}=Hr(e);try{let a=await Gr({aptosConfig:t,payload:{function:`${n}::router::get_expiration`,functionArguments:[o,mc(s)]}});return Number(a[0])*1e3}catch{return}}async function il(r){let{aptosConfig:t,address:e}=r,n=wr(t),o=await Gr({aptosConfig:t,payload:{function:`${n}::router::get_primary_name`,functionArguments:[N.from(e).toString()]}}),s=ms(o[1]),a=ms(o[0]);if(s)return[a,s].filter(Boolean).join(".")}async function sl(r){let{aptosConfig:t,sender:e,name:n,options:o}=r,s=wr(t);if(!n)return await Ye({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::clear_primary_name`,functionArguments:[]},options:o});let{domainName:a,subdomainName:u}=Hr(n);return await Ye({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${s}::router::set_primary_name`,functionArguments:[a,u]},options:o})}async function al(r){let{aptosConfig:t,name:e}=r,n=wr(t),{domainName:o,subdomainName:s}=Hr(e),a=await Gr({aptosConfig:t,payload:{function:`${n}::router::get_target_addr`,functionArguments:[o,mc(s)]}}),u=ms(a[0]);return u?N.from(u).toString():void 0}async function cl(r){let{aptosConfig:t,sender:e,name:n,address:o,options:s}=r,a=wr(t),{domainName:u,subdomainName:p}=Hr(n);return await Ye({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${a}::router::set_target_addr`,functionArguments:[u,p,o]},options:s})}async function ul(r){let{aptosConfig:t,name:e}=r,{domainName:n,subdomainName:o=""}=Hr(e),u=(await Ae({aptosConfig:t,query:{query:Ln,variables:{where_condition:{domain:{_eq:n},subdomain:{_eq:o}},limit:1}},originMethod:"getName"})).current_aptos_names[0];return u&&(u=Ho(u)),u}async function fl(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await xc({aptosConfig:t});return(await Ae({aptosConfig:t,originMethod:"getAccountNames",query:{query:Ln,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o}}}}})).current_aptos_names.map(Ho)}async function dl(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await xc({aptosConfig:t});return(await Ae({aptosConfig:t,originMethod:"getAccountDomains",query:{query:Ln,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o},subdomain:{_eq:""}}}}})).current_aptos_names.map(Ho)}async function ll(r){let{aptosConfig:t,options:e,accountAddress:n}=r,o=await xc({aptosConfig:t});return(await Ae({aptosConfig:t,originMethod:"getAccountSubdomains",query:{query:Ln,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},owner_address:{_eq:n.toString()},expiration_timestamp:{_gte:o},subdomain:{_neq:""}}}}})).current_aptos_names.map(Ho)}async function pl(r){let{aptosConfig:t,options:e,domain:n}=r;return(await Ae({aptosConfig:t,originMethod:"getDomainSubdomains",query:{query:Ln,variables:{limit:e?.limit,offset:e?.offset,order_by:e?.orderBy,where_condition:{...r.options?.where??{},domain:{_eq:n},subdomain:{_neq:""}}}}})).current_aptos_names.map(Ho)}async function xc(r){let{aptosConfig:t}=r,e=wr(t),[n]=await Gr({aptosConfig:t,payload:{function:`${e}::config::reregistration_grace_sec`,functionArguments:[]}}),o=n/60/60/24,s=()=>new Date;return new Date(s().setDate(s().getDate()-o)).toISOString()}async function gl(r){let{aptosConfig:t,sender:e,name:n,years:o=1,options:s}=r,a=wr(t),u=o*31536e3,{domainName:p,subdomainName:h}=Hr(n);if(h)throw new Error("Subdomains cannot be renewed");if(o!==1)throw new Error("Currently, only 1 year renewals are supported");return await Ye({aptosConfig:t,sender:e.accountAddress.toString(),data:{function:`${a}::router::renew_domain`,functionArguments:[p,u]},options:s})}function Ho(r){return{...r,expiration_timestamp:new Date(r.expiration_timestamp).valueOf()}}var Vo=class{constructor(t){this.config=t}async getOwnerAddress(t){return nl({aptosConfig:this.config,...t})}async getExpiration(t){return Ac({aptosConfig:this.config,...t})}async getTargetAddress(t){return al({aptosConfig:this.config,...t})}async setTargetAddress(t){return cl({aptosConfig:this.config,...t})}async getPrimaryName(t){return il({aptosConfig:this.config,...t})}async setPrimaryName(t){return sl({aptosConfig:this.config,...t})}async registerName(t){return ol({aptosConfig:this.config,...t})}async renewDomain(t){return gl({aptosConfig:this.config,...t})}async getName(t){return ul({aptosConfig:this.config,...t})}async getAccountNames(t){return fl({aptosConfig:this.config,...t})}async getAccountDomains(t){return dl({aptosConfig:this.config,...t})}async getAccountSubdomains(t){return ll({aptosConfig:this.config,...t})}async getDomainSubdomains(t){return pl({aptosConfig:this.config,...t})}};async function hl(r){let{aptosConfig:t,poolAddress:e}=r,n=N.from(e).toStringLong(),s=await Ae({aptosConfig:t,query:{query:Ea,variables:{where_condition:{pool_address:{_eq:n}}}}});return s.num_active_delegator_per_pool[0]?s.num_active_delegator_per_pool[0].num_active_delegator:0}async function yl(r){let{aptosConfig:t,options:e}=r,n={query:Ea,variables:{order_by:e?.orderBy}};return(await Ae({aptosConfig:t,query:n})).num_active_delegator_per_pool}async function ml(r){let{aptosConfig:t,delegatorAddress:e,poolAddress:n}=r,o={query:Gu,variables:{delegatorAddress:N.from(e).toStringLong(),poolAddress:N.from(n).toStringLong()}};return(await Ae({aptosConfig:t,query:o})).delegated_staking_activities}var Qo=class{constructor(t){this.config=t}async getNumberOfDelegators(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["stake_processor"]}),hl({aptosConfig:this.config,...t})}async getNumberOfDelegatorsForAllPools(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["stake_processor"]}),yl({aptosConfig:this.config,...t})}async getDelegatedStakingActivities(t){return await Ce({config:this.config,minimumLedgerVersion:t?.minimumLedgerVersion,processorTypes:["stake_processor"]}),ml({aptosConfig:this.config,...t})}};var Wo=class{constructor(t){this.config=t}async getTransactions(t){return uf({aptosConfig:this.config,...t})}async getTransactionByVersion(t){return ff({aptosConfig:this.config,...t})}async getTransactionByHash(t){return Ki({aptosConfig:this.config,...t})}async isPendingTransaction(t){return df({aptosConfig:this.config,...t})}async waitForTransaction(t){return Kn({aptosConfig:this.config,...t})}async getGasPriceEstimation(){return Fi({aptosConfig:this.config})}getSigningMessage(t){return qd(t)}};var As=()=>Math.floor(Date.now()/1e3),jo=class{constructor(t,e,n,o,s){this.lastUncommintedNumber=null;this.currentNumber=null;this.lock=!1;this.aptosConfig=t,this.account=e,this.maxWaitTime=n,this.maximumInFlight=o,this.sleepTime=s}async nextSequenceNumber(){for(;this.lock;)await Lr(this.sleepTime);this.lock=!0;let t=BigInt(0);try{if((this.lastUncommintedNumber===null||this.currentNumber===null)&&await this.initialize(),this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight){await this.update();let e=As();for(;this.currentNumber-this.lastUncommintedNumber>=this.maximumInFlight;)await Lr(this.sleepTime),As()-e>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):await this.update()}t=this.currentNumber,this.currentNumber+=BigInt(1)}catch(e){console.error("error in getting next sequence number for this account",e)}finally{this.lock=!1}return t}async initialize(){let{sequence_number:t}=await Jt({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});this.currentNumber=BigInt(t),this.lastUncommintedNumber=BigInt(t)}async update(){let{sequence_number:t}=await Jt({aptosConfig:this.aptosConfig,accountAddress:this.account.accountAddress});return this.lastUncommintedNumber=BigInt(t),this.lastUncommintedNumber}async synchronize(){if(this.lastUncommintedNumber!==this.currentNumber){for(;this.lock;)await Lr(this.sleepTime);this.lock=!0;try{await this.update();let t=As();for(;this.lastUncommintedNumber!==this.currentNumber;)As()-t>this.maxWaitTime?(console.warn(`Waited over 30 seconds for a transaction to commit, resyncing ${this.account.accountAddress.toString()}`),await this.initialize()):(await Lr(this.sleepTime),await this.update())}catch(t){console.error("error in synchronizing this account sequence number with the one on chain",t)}finally{this.lock=!1}}}};var no=class{constructor(){this.queue=[];this.pendingDequeue=[];this.cancelled=!1}enqueue(t){if(this.cancelled=!1,this.pendingDequeue.length>0){this.pendingDequeue.shift()?.resolve(t);return}this.queue.push(t)}async dequeue(){return this.queue.length>0?Promise.resolve(this.queue.shift()):new Promise((t,e)=>{this.pendingDequeue.push({resolve:t,reject:e})})}isEmpty(){return this.queue.length===0}cancel(){this.cancelled=!0,this.pendingDequeue.forEach(async({reject:t})=>{t(new oo("Task cancelled"))}),this.pendingDequeue=[],this.queue.length=0}isCancelled(){return this.cancelled}pendingDequeueLength(){return this.pendingDequeue.length}},oo=class extends Error{};var Al="fulfilled",Yo=class{constructor(t,e,n=30,o=100,s=10){this.taskQueue=new no;this.transactionsQueue=new no;this.outstandingTransactions=new no;this.sentTransactions=[];this.executedTransactions=[];this.aptosConfig=t,this.account=e,this.started=!1,this.accountSequnceNumber=new jo(t,e,n,o,s)}async submitNextTransaction(){try{for(;;){if(this.transactionsQueue.isEmpty())return;let t=await this.accountSequnceNumber.nextSequenceNumber();if(t===null)return;let e=await this.generateNextTransaction(this.account,t);if(!e)return;let n=qo({aptosConfig:this.aptosConfig,transaction:e,signer:this.account});await this.outstandingTransactions.enqueue([n,t])}}catch(t){if(t instanceof oo)return;throw new Error(`Submit transaction failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async processTransactions(){try{for(;;){let t=[],e=[],[n,o]=await this.outstandingTransactions.dequeue();for(t.push(n),e.push(o);!this.outstandingTransactions.isEmpty();)[n,o]=await this.outstandingTransactions.dequeue(),t.push(n),e.push(o);let s=await Promise.allSettled(t);for(let a=0;a<s.length&&a<e.length;a+=1){let u=s[a];o=e[a],u.status===Al?(this.sentTransactions.push([u.value.hash,o,null]),await this.checkTransaction(u,o)):this.sentTransactions.push([u.status,o,u.reason])}}}catch(t){if(t instanceof oo)return;throw new Error(`Process execution failed for ${this.account.accountAddress.toString()} with error ${t}`)}}async checkTransaction(t,e){try{let n=[];n.push(Kn({aptosConfig:this.aptosConfig,transactionHash:t.value.hash}));let o=await Promise.allSettled(n);for(let s=0;s<o.length;s+=1){let a=o[s];a.status===Al?this.executedTransactions.push([a.value.hash,e,null]):this.executedTransactions.push([a.status,e,a.reason])}}catch(n){throw new Error(`Check transaction failed for ${this.account.accountAddress.toString()} with error ${n}`)}}async push(t,e){await this.transactionsQueue.enqueue([t,e])}async generateNextTransaction(t,e){if(this.transactionsQueue.isEmpty())return;let[n,o]=await this.transactionsQueue.dequeue();return await Ye({aptosConfig:this.aptosConfig,sender:t.accountAddress,data:n,options:{...o,accountSequenceNumber:e}})}async run(){try{for(;!this.taskQueue.isCancelled();)await(await this.taskQueue.dequeue())()}catch(t){throw new Error(`Unable to start transaction batching: ${t}`)}}start(){if(this.started)throw new Error("worker has already started");this.started=!0,this.taskQueue.enqueue(()=>this.submitNextTransaction()),this.taskQueue.enqueue(()=>this.processTransactions()),this.run()}stop(){if(this.taskQueue.isCancelled())throw new Error("worker has already stopped");this.started=!1,this.taskQueue.cancel()}};var Xo=class{constructor(t){this.config=t}async batchTransactionsForSingleAccount(t){try{let{sender:e,data:n,options:o}=t,s=new Yo(this.config,e);s.start();for(let a of n)await s.push(a,o)}catch(e){throw new Error(`failed to submit transactions with error: ${e}`)}}async signAndSubmitTransaction(t){let{signer:e,transaction:n}=t;return qo({aptosConfig:this.config,signer:e,transaction:n})}async publishPackageTransaction(t){return Dd({aptosConfig:this.config,...t})}async rotateAuthKey(t){return Gd({aptosConfig:this.config,...t})}};var Zo=class{constructor(t){this.config=t}async transaction(t){return Ye({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return Ye({aptosConfig:this.config,...t})}};var Jo=class{constructor(t){this.config=t}transaction(t){return gs({...t})}transactionAsFeePayer(t){let{signer:e,transaction:n}=t;if(!n.feePayerAddress)throw new Error(`Transaction ${n} is not a Fee Payer transaction`);return n.feePayerAddress=e.accountAddress,gs({signer:e,transaction:n})}};var Bn=class{constructor(t){this.config=t}async transaction(t){return gc({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return gc({aptosConfig:this.config,...t})}};mt([xl],Bn.prototype,"transaction",1),mt([xl],Bn.prototype,"multiAgentTransaction",1);function xl(r,t,e){let n=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerPublicKey)throw new Error("You are simulating a Fee Payer transaction but missing the feePayerPublicKey");return n.apply(this,o)},e}var On=class{constructor(t){this.config=t}async transaction(t){return hs({aptosConfig:this.config,...t})}async multiAgentTransaction(t){return hs({aptosConfig:this.config,...t})}};mt([bl],On.prototype,"transaction",1),mt([bl],On.prototype,"multiAgentTransaction",1);function bl(r,t,e){let n=e.value;return e.value=async function(...o){let[s]=o;if(s.transaction.feePayerAddress&&!s.feePayerAuthenticator)throw new Error("You are submitting a Fee Payer transaction but missing the feePayerAuthenticator");return n.apply(this,o)},e}var st=class{constructor(t){this.config=new Co(t),this.account=new vo(this.config),this.ans=new Vo(this.config),this.coin=new Do(this.config),this.digitalAsset=new Go(this.config),this.event=new Lo(this.config),this.faucet=new Fo(this.config),this.fungibleAsset=new Ko(this.config),this.general=new $o(this.config),this.staking=new Qo(this.config),this.transaction=new Wo(this.config),this.transactionSubmission=new Xo(this.config),this.build=new Zo(this.config),this.sign=new Jo(this.config),this.simulate=new Bn(this.config),this.submit=new On(this.config)}};function ht(r,t,e){Object.getOwnPropertyNames(t.prototype).forEach(n=>{let o=Object.getOwnPropertyDescriptor(t.prototype,n);o&&(o.value=function(...s){return this[e][n](...s)},Object.defineProperty(r.prototype,n,o))})}ht(st,vo,"account");ht(st,Vo,"ans");ht(st,Do,"coin");ht(st,Go,"digitalAsset");ht(st,Lo,"event");ht(st,Fo,"faucet");ht(st,Ko,"fungibleAsset");ht(st,$o,"general");ht(st,Qo,"staking");ht(st,Wo,"transaction");ht(st,Xo,"transactionSubmission");ht(st,Zo,"build");ht(st,Jo,"sign");ht(st,Bn,"simulate");ht(st,On,"submit");return Il(qh);})();
|
|
407
428
|
/*! Bundled license information:
|
|
408
429
|
|
|
409
430
|
@noble/hashes/esm/utils.js:
|