@acedatacloud/nexior 3.167.0 → 3.168.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Auth-BYDwGwaF.js → Auth-BDyXSjIe.js} +1 -1
- package/dist/assets/{BotPlaceholder-BqeR06y3.js → BotPlaceholder-BEomWKuP.js} +1 -1
- package/dist/assets/{Callback--SyBMjm7.js → Callback-DoJBHDRi.js} +1 -1
- package/dist/assets/{Console-WixW6BSu.js → Console-B85hzCWD.js} +1 -1
- package/dist/assets/{Consumption-CL3WRYVN.js → Consumption-Vrs9Ym-e.js} +1 -1
- package/dist/assets/{Conversation-Brvaxxml.js → Conversation-yBAeOfTL.js} +1 -1
- package/dist/assets/{CopyToClipboard-TC6O9s7V.js → CopyToClipboard-BKPPPZex.js} +1 -1
- package/dist/assets/{Detail-oRAPiSXy.js → Detail-IqUP_8Rf.js} +2 -2
- package/dist/assets/{EditArray-Cr1IK11e.js → EditArray-c0xJ35n-.js} +1 -1
- package/dist/assets/{Extra-9TZNXkOm.js → Extra-B0rcl4cC.js} +1 -1
- package/dist/assets/{FilePreview-BHbzMFA3.js → FilePreview-B83vVjmo.js} +1 -1
- package/dist/assets/{History-DArAVdnl.js → History-CLZkfWJ_.js} +1 -1
- package/dist/assets/{IconPark.vue_vue_type_script_setup_true_lang-VGkf-8vn.js → IconPark.vue_vue_type_script_setup_true_lang-ksQMUIfc.js} +1 -1
- package/dist/assets/{ImagePreview-CATcaSwT.js → ImagePreview-B0AGcjB1.js} +1 -1
- package/dist/assets/{ImageWrapper-C-2wIJYB.js → ImageWrapper-_iiM_a6H.js} +1 -1
- package/dist/assets/{Index-ip063XOA.js → Index-B672ipBS.js} +1 -1
- package/dist/assets/{Index-6O25pgqo.js → Index-B7N_ZM2U.js} +1 -1
- package/dist/assets/{Index-Ba9ChGUK.js → Index-BKjB-9Oe.js} +2 -2
- package/dist/assets/{Index-CofV8BK0.js → Index-By3xsmxj.js} +1 -1
- package/dist/assets/{Index-BKgJVlqc.js → Index-CSuhKEjt.js} +1 -1
- package/dist/assets/{Index-DbBMgNaM.js → Index-CezD43xH.js} +1 -1
- package/dist/assets/{Index-BmLW9xeN.js → Index-CxsRl-11.js} +1 -1
- package/dist/assets/{Index-Cl3Lz1dF.js → Index-D-qTlC3Z.js} +1 -1
- package/dist/assets/{Index-Bvrq7JLb.js → Index-D1tmlbyD.js} +1 -1
- package/dist/assets/Index-DC676h74.js +1 -0
- package/dist/assets/{Index-C01475yx.js → Index-DHx4p08s.js} +1 -1
- package/dist/assets/{Index-eTNf6k_N.js → Index-DZ47oisV.js} +1 -1
- package/dist/assets/{Index-BZkdecyf.js → Index-DbKTdta8.js} +1 -1
- package/dist/assets/{Index-Dh9rUBhI.js → Index-Dc2nFTk1.js} +1 -1
- package/dist/assets/{Index-DBlvbTmY.js → Index-Did7kzpk.js} +1 -1
- package/dist/assets/{Index-DZl1YUel.js → Index-DpHIGaEz.js} +1 -1
- package/dist/assets/{Index-C3f-qhzZ.js → Index-F42-VQFW.js} +1 -1
- package/dist/assets/{Index-BQQpmfdB.js → Index-NTKMlpsi.js} +1 -1
- package/dist/assets/{Index-C5HV03FO.js → Index-T9ebwI8G.js} +1 -1
- package/dist/assets/Index-YCV8wVla.css +1 -0
- package/dist/assets/{Index-BQL51iA5.js → Index-ah7mFp7z.js} +1 -1
- package/dist/assets/{Index-BGjqeGFj.js → Index-mAdg-qFC.js} +1 -1
- package/dist/assets/{Index-ogoTClu0.js → Index-mfKfVj3g.js} +1 -1
- package/dist/assets/{Index-DIF8W8Uc.js → Index-pNqGPmBt.js} +1 -1
- package/dist/assets/{Index-BUxrI5H9.js → Index-vu_JhkJW.js} +1 -1
- package/dist/assets/{Invitees-Cc3NpC2g.js → Invitees-B_jQ5kVN.js} +1 -1
- package/dist/assets/{List-DvSsX3Z0.js → List-7Wl_Izc4.js} +1 -1
- package/dist/assets/{List-D7DfvKQy.js → List-BCkL1DtJ.js} +1 -1
- package/dist/assets/{List-B4p4ZhQE.js → List-CvW8rP13.js} +1 -1
- package/dist/assets/{Main-BVKGaNZg.js → Main-QbmvnnMG.js} +1 -1
- package/dist/assets/{Navigator-9ddEoj7J.js → Navigator-C-p3RzVC.js} +1 -1
- package/dist/assets/{NoTasks-C3t8bmtA.js → NoTasks-DTEzeszL.js} +1 -1
- package/dist/assets/{NotFound-Hnpwk4F4.js → NotFound-CVtQTglJ.js} +1 -1
- package/dist/assets/{OAuthCallback-COGnrcdn.js → OAuthCallback-CpR2-nmg.js} +1 -1
- package/dist/assets/{Pagination-wNLMuHeO.js → Pagination-DmumC74j.js} +1 -1
- package/dist/assets/{Status-CIYhFNcJ.js → Status-Bf9lfqL1.js} +1 -1
- package/dist/assets/{Subscribe-lEko0pof.js → Subscribe-Db51l7te.js} +1 -1
- package/dist/assets/{VideoPlayer-c9dt-3yZ.js → VideoPlayer-DLqpJWFk.js} +1 -1
- package/dist/assets/_Uint8Array-BXWVuq2q.js +1 -0
- package/dist/assets/{_baseClone-Bmu_sg3j.js → _baseClone-CdH871Qw.js} +1 -1
- package/dist/assets/{_baseIteratee-lG75D4iw.js → _baseIteratee-BD8B7GME.js} +1 -1
- package/dist/assets/{_initCloneObject-C-Q8oqTt.js → _initCloneObject-BBeThwBy.js} +1 -1
- package/dist/assets/{add-6LL9G5Z5.js → add-UrLMzye7.js} +1 -1
- package/dist/assets/{all-wallets-aEppbPWX.js → all-wallets-opGrYoFq.js} +1 -1
- package/dist/assets/{app-store-DID464Wp.js → app-store-eRITh79T.js} +1 -1
- package/dist/assets/{apple-DORiIW02.js → apple-BJrlVv7w.js} +1 -1
- package/dist/assets/{arrow-bottom-CmCVBSrV.js → arrow-bottom-Bjnbevqv.js} +1 -1
- package/dist/assets/{arrow-bottom-circle-dyY9qLpT.js → arrow-bottom-circle-B3cg2xpo.js} +1 -1
- package/dist/assets/{arrow-left-BaoMx2wj.js → arrow-left-BIRR85uZ.js} +1 -1
- package/dist/assets/{arrow-right-6ZIR8uWG.js → arrow-right-CMkhN4--.js} +1 -1
- package/dist/assets/{arrow-top-DV5TBwIJ.js → arrow-top-D-ULF3EB.js} +1 -1
- package/dist/assets/{avatar-CZpCU7-m.js → avatar-D0aH2OKD.js} +1 -1
- package/dist/assets/{bank-DYz2uXPn.js → bank-B9xrTyFs.js} +1 -1
- package/dist/assets/{basic-CH4UgvMg.js → basic-LOPbFEDH.js} +60 -60
- package/dist/assets/{browser-CKmIG2h_.js → browser-Da5KzxtX.js} +1 -1
- package/dist/assets/{byokCredential-BdY2oFpq.js → byokCredential-Pee77Xtw.js} +1 -1
- package/dist/assets/{card-3UfZE5zt.js → card-Cmds_I_j.js} +1 -1
- package/dist/assets/{castArray-YvIMFTc9.js → castArray-CUDnQsIK.js} +1 -1
- package/dist/assets/{chat-CpxTF3jE.js → chat-E_RwqKGz.js} +1 -1
- package/dist/assets/{checkmark-BWZoFv2_.js → checkmark-D5qigt51.js} +1 -1
- package/dist/assets/{checkmark-bold-CEX8QndR.js → checkmark-bold-LvKhYYxu.js} +1 -1
- package/dist/assets/{chevron-bottom-BI142s1X.js → chevron-bottom-CCJifxR0.js} +1 -1
- package/dist/assets/{chevron-left-tLzTrSXr.js → chevron-left-DoFRVtBs.js} +1 -1
- package/dist/assets/{chevron-right-Dyf_ffQQ.js → chevron-right-7VzYWBD3.js} +1 -1
- package/dist/assets/{chevron-top-DPDBxfl4.js → chevron-top-Cr09TF1o.js} +1 -1
- package/dist/assets/{chrome-store-D5SW-iy-.js → chrome-store-tZ5X31Ib.js} +1 -1
- package/dist/assets/{clock-CKF6goQf.js → clock-DhSlFX8L.js} +1 -1
- package/dist/assets/{close-De8y1RWE.js → close-8NNhk5MQ.js} +1 -1
- package/dist/assets/{coinPlaceholder-Dkkrmbg7.js → coinPlaceholder-CGqCWk_o.js} +1 -1
- package/dist/assets/{compass-cqEFwAme.js → compass-DcyOP90T.js} +1 -1
- package/dist/assets/{copy-Es56qz4c.js → copy-D1WNYxGL.js} +1 -1
- package/dist/assets/{createTaskActions-BXbGVAyn.js → createTaskActions-DAYGdsVq.js} +1 -1
- package/dist/assets/{cursor-Cq5X5f50.js → cursor-cMwhnIk5.js} +1 -1
- package/dist/assets/{cursor-transparent-xlWXmwGt.js → cursor-transparent-CrQv8Onm.js} +1 -1
- package/dist/assets/{debounce-BpWk7nuI.js → debounce-DCSodorO.js} +1 -1
- package/dist/assets/{desktop-D1J2Uie2.js → desktop-B93vdfc0.js} +1 -1
- package/dist/assets/{disconnect-Cks823Of.js → disconnect-CTOrg89I.js} +1 -1
- package/dist/assets/{discord-zkmftcBQ.js → discord-B928iac1.js} +1 -1
- package/dist/assets/{distribution-o7xqSpRT.js → distribution-CnJXY8oi.js} +1 -1
- package/dist/assets/{dropdown-Bvb4dRSD.js → dropdown-BDLqMJ6c.js} +1 -1
- package/dist/assets/{etherscan-I41foa4d.js → etherscan-C7rdhh_l.js} +1 -1
- package/dist/assets/{exclamation-triangle-DoIkNHiW.js → exclamation-triangle-TLEW8o_8.js} +1 -1
- package/dist/assets/{extension-C2DGwOS2.js → extension-BCPc05eE.js} +1 -1
- package/dist/assets/{external-link-B2ZBFNNw.js → external-link-BVSFanSk.js} +1 -1
- package/dist/assets/{facebook-CO7UwlKf.js → facebook-yWzRWreo.js} +1 -1
- package/dist/assets/{farcaster-DFerNXVJ.js → farcaster-ObXhKU7L.js} +1 -1
- package/dist/assets/{filters-Cq5-UFL3.js → filters-D65QChWv.js} +1 -1
- package/dist/assets/{github-BOpdRs3D.js → github-CfpVGN4l.js} +1 -1
- package/dist/assets/{google-B1iBXSb_.js → google-DgM2THGc.js} +1 -1
- package/dist/assets/{help-circle-FMe2_GKk.js → help-circle-BuTaWLeN.js} +1 -1
- package/dist/assets/{id-B8JtAbxm.js → id-BDpIvgHc.js} +1 -1
- package/dist/assets/{image-B7X95LW6.js → image-BPV6AkRv.js} +1 -1
- package/dist/assets/{index-DqHEB8wJ.js → index--_ruvatY.js} +1 -1
- package/dist/assets/{index-5PCSoafl.js → index-50IhPevG.js} +2 -2
- package/dist/assets/{index-HTtxGNNR.js → index-B0_GI7q2.js} +1 -1
- package/dist/assets/{index-BD55w4j0.js → index-B6H89xyY.js} +1 -1
- package/dist/assets/{index-C8WbvFlX.js → index-BEB0_UvQ.js} +1 -1
- package/dist/assets/{index-0u_G2kSj.js → index-BFQ7oRfU.js} +1 -1
- package/dist/assets/{index-DC9KLk-Y.js → index-BJD6-2dA.js} +1 -1
- package/dist/assets/{index-DSRawDTE.js → index-BKkACFcM.js} +1 -1
- package/dist/assets/{index-CmMnj3Xx.js → index-BNn6E6CM.js} +1 -1
- package/dist/assets/{index-BbcE4PaG.js → index-BP0i0DI0.js} +1 -1
- package/dist/assets/{index-Cjg_OuWc.js → index-BS0e3mH-.js} +1 -1
- package/dist/assets/{index-BVZShYNY.js → index-BT6khhJu.js} +1 -1
- package/dist/assets/{index-CniEO1Oz.js → index-BX7sWEUw.js} +1 -1
- package/dist/assets/{index-XpcsQaS3.js → index-BZ0LCluE.js} +1 -1
- package/dist/assets/{index-BMe4XQdI.js → index-BfTKfSn5.js} +1 -1
- package/dist/assets/{index-yXdj_vJc.js → index-BgIT6hC5.js} +1 -1
- package/dist/assets/{index-Df86EZ4H.js → index-BmuW8LII.js} +1 -1
- package/dist/assets/{index-CbnoagxV.js → index-Bo_W4_wC.js} +1 -1
- package/dist/assets/{index--MBG5Bxw.js → index-C2Ix0O_U.js} +1 -1
- package/dist/assets/{index-DZXPcke9.js → index-CAjrQ30c.js} +1 -1
- package/dist/assets/{index-BiXpC_cY.js → index-CAk112Jj.js} +1 -1
- package/dist/assets/{index-gQH-ITVc.js → index-CNiheU_Y.js} +1 -1
- package/dist/assets/{index-DtaZfQsb.js → index-COHCLZDM.js} +1 -1
- package/dist/assets/{index-BPRTWZ0b.js → index-CajQSidV.js} +1 -1
- package/dist/assets/{index-qJmkBTaB.js → index-CeewlRvZ.js} +1 -1
- package/dist/assets/{index-CP6lS__f.js → index-CfNLp6F4.js} +1 -1
- package/dist/assets/{index-DzqsLvLw.js → index-CfmUVjcp.js} +1 -1
- package/dist/assets/{index-DTq8xdm6.js → index-CjU5cdO7.js} +1 -1
- package/dist/assets/{index-8jmQ7jsv.js → index-ClmF6hRq.js} +1 -1
- package/dist/assets/{index-CTspmpeX.js → index-Cncx8-l_.js} +1 -1
- package/dist/assets/{index-B05MCcWV.js → index-CnleZlCG.js} +1 -1
- package/dist/assets/{index-DWkcw7l1.js → index-CoVdVq1Z.js} +1 -1
- package/dist/assets/{index--FfOeMhK.js → index-D6Kzs1Nw.js} +1 -1
- package/dist/assets/{index-CVzcynKu.js → index-D9DK1isc.js} +1 -1
- package/dist/assets/{index-COPlSq-K.js → index-DCbpcMpj.js} +1 -1
- package/dist/assets/{index-DvJO3nj9.js → index-DHULlsKQ.js} +1 -1
- package/dist/assets/{index-cnvaHQUI.js → index-DHnWz_8g.js} +1 -1
- package/dist/assets/{index-ruJel4IC.js → index-DHoQZLtm.js} +1 -1
- package/dist/assets/{index-CD8qf4tY.js → index-DLUXCsx1.js} +1 -1
- package/dist/assets/{index-BXuYZoDz.js → index-DMucU6uG.js} +1 -1
- package/dist/assets/{index-BzRVav2J.js → index-DXwCOxQx.js} +14 -14
- package/dist/assets/{index-DLlZmkfC.js → index-DZM-NR6G.js} +1 -1
- package/dist/assets/{index-karJESpY.js → index-DcjROC1z.js} +1 -1
- package/dist/assets/{index-SAsUj7Pk.js → index-DcjdVEoX.js} +1 -1
- package/dist/assets/{index-DTbz6TSn.js → index-DdSlwtcL.js} +1 -1
- package/dist/assets/{index-DEcBa7gX.js → index-Df15q-se.js} +1 -1
- package/dist/assets/{index-De-wy4Tc.js → index-DfM49-13.js} +1 -1
- package/dist/assets/{index-ZhVk9kkG.js → index-DgEnLOYy.js} +5 -5
- package/dist/assets/{index-BkvfyPBC.js → index-Dttr4JHi.js} +1 -1
- package/dist/assets/{index-D5ReSuuO.js → index-Gby8YUdT.js} +1 -1
- package/dist/assets/{index-CMexzqoP.js → index-OKrnShZm.js} +1 -1
- package/dist/assets/{index-D7b8OrcI.js → index-Pf9Yjl5V.js} +1 -1
- package/dist/assets/{index-C3GoyrG4.js → index-RCOqdLUs.js} +1 -1
- package/dist/assets/{index-CIdZDW4_.js → index-TEpyQgfK.js} +3 -3
- package/dist/assets/{index-Dt0xHpag.js → index-jU7GB09F.js} +1 -1
- package/dist/assets/{index-F7u9olkI.js → index-tZ_Ise3S.js} +1 -1
- package/dist/assets/{index--UH2lqMs.js → index-uHPJAWOO.js} +1 -1
- package/dist/assets/{index-CMTPLs4z.js → index-uvAG1r2M.js} +1 -1
- package/dist/assets/{index-DYXoPIXH.js → index-wIXuMScl.js} +1 -1
- package/dist/assets/{index-bUBBPa9N.js → index-y4M9HGmQ.js} +1 -1
- package/dist/assets/{index.browser.esm-DkzdYcbc.js → index.browser.esm-D7d8Rln2.js} +1 -1
- package/dist/assets/{index.es-C_WLtS18.js → index.es-CGNqC7gi.js} +1 -1
- package/dist/assets/{info-CWQKBayg.js → info-DM9rskjg.js} +1 -1
- package/dist/assets/{info-circle-xZWu29E_.js → info-circle-DlTmoyc5.js} +1 -1
- package/dist/assets/{isEqual-yYS0dh2f.js → isEqual-DBKyqIIt.js} +1 -1
- package/dist/assets/{isPlainObject-CRl4nmqU.js → isPlainObject-BEU12YqN.js} +1 -1
- package/dist/assets/{lightbulb-DDxET3cE.js → lightbulb-DHpQkifU.js} +1 -1
- package/dist/assets/{mail-CFH0lanX.js → mail-RQ1QwebF.js} +1 -1
- package/dist/assets/{midjourney-DRsfJ6XL.js → midjourney-DtyT0jZS.js} +1 -1
- package/dist/assets/{mobile-ikIUiDOY.js → mobile-VdDXMKEH.js} +1 -1
- package/dist/assets/{more-BOWsr6fH.js → more-BE6J6IIj.js} +1 -1
- package/dist/assets/{network-placeholder-WAP_pG5W.js → network-placeholder-Mx5SY88G.js} +1 -1
- package/dist/assets/{nftPlaceholder-mS2qsTTR.js → nftPlaceholder-C7cAVXAB.js} +1 -1
- package/dist/assets/{off-DgdEkHnP.js → off-D5KoU2IH.js} +1 -1
- package/dist/assets/{order-Cb2RT6uu.js → order-BscwC2FZ.js} +1 -1
- package/dist/assets/{pagination-mZXKDVMd.js → pagination-ttqKdzba.js} +1 -1
- package/dist/assets/{play-store-8C4ifU8u.js → play-store-NLHYHAzn.js} +1 -1
- package/dist/assets/{plus-FPrDhto7.js → plus-B4X29bak.js} +1 -1
- package/dist/assets/{price-Cr67gCty.js → price-DpiQB5Yf.js} +1 -1
- package/dist/assets/{producer-Q-cOb_Ne.js → producer-CvNMCVkQ.js} +1 -1
- package/dist/assets/{qr-code-DRShCRVn.js → qr-code-DeoPDarM.js} +1 -1
- package/dist/assets/{recycle-horizontal-C8dBoRZt.js → recycle-horizontal-C8vaKTfu.js} +1 -1
- package/dist/assets/{refresh-CImlMCgq.js → refresh-BTBS0EUI.js} +1 -1
- package/dist/assets/{reown-logo-4ZKneMrf.js → reown-logo-D682jtgT.js} +1 -1
- package/dist/assets/{search-CGNtTO4W.js → search-CLA1DAiY.js} +1 -1
- package/dist/assets/{secp256k1-BWP6UeVl.js → secp256k1-C0KaaotE.js} +1 -1
- package/dist/assets/{secp256k1-C2CXj9YW.js → secp256k1-UQxLo_3_.js} +1 -1
- package/dist/assets/{seedream-DpE59ZMf.js → seedream-D8o6AzwQ.js} +1 -1
- package/dist/assets/seedream-DcTLW5r2.js +1 -0
- package/dist/assets/seedream-rLJUDb-d.js +1 -0
- package/dist/assets/{send-DCL9Yk32.js → send-aX_GxPEK.js} +1 -1
- package/dist/assets/{service-BJ-ypgj8.js → service-Bl8gGQ55.js} +1 -1
- package/dist/assets/{solana-wallets-yxjVsaPt.js → solana-wallets-DplP8WdI.js} +2 -2
- package/dist/assets/{solana-wallets-vue-C8Fkxc_p.js → solana-wallets-vue-Ci7B_C6i.js} +1 -1
- package/dist/assets/{suno-BZWrSxwO.js → suno-Cx2k0nCv.js} +1 -1
- package/dist/assets/{swapHorizontal-Bfn7eZ90.js → swapHorizontal-C0y88R1i.js} +1 -1
- package/dist/assets/{swapHorizontalBold-DGPhnPkP.js → swapHorizontalBold-ChU04fWb.js} +1 -1
- package/dist/assets/{swapHorizontalMedium-DqzPWlW6.js → swapHorizontalMedium-DJDVePDM.js} +1 -1
- package/dist/assets/{swapHorizontalRoundedBold-DPpuDpww.js → swapHorizontalRoundedBold-DX-bndMU.js} +1 -1
- package/dist/assets/{swapVertical--7_aleOl.js → swapVertical-AcQg_Wvo.js} +1 -1
- package/dist/assets/{telegram-DkMIuO8p.js → telegram-Lgnv9Ozw.js} +1 -1
- package/dist/assets/{three-dots-DIIrfSEt.js → three-dots-BWmtbAZ_.js} +1 -1
- package/dist/assets/{twitch-CiiHF84Y.js → twitch-DOUAsbJl.js} +1 -1
- package/dist/assets/{twitterIcon-ocXCXtXI.js → twitterIcon-CbBbPa9k.js} +1 -1
- package/dist/assets/{typescript-D6sat8h_.js → typescript-BS0psKoU.js} +1 -1
- package/dist/assets/{use-form-item-B5rZE33a.js → use-form-item-BCHl5hOu.js} +1 -1
- package/dist/assets/validator-CmY_SPNn.js +1 -0
- package/dist/assets/{verify-BNbMn2WA.js → verify-D8_6usMb.js} +1 -1
- package/dist/assets/{verify-filled-BYrl9ds5.js → verify-filled-YSomKc90.js} +1 -1
- package/dist/assets/{w3m-modal-1D4qbzJa.js → w3m-modal-CjCjnI4-.js} +1 -1
- package/dist/assets/{wallet-FOzEXpqB.js → wallet-CQ4eeF60.js} +1 -1
- package/dist/assets/{wallet-placeholder-B68god-e.js → wallet-placeholder-BWHCAd0e.js} +1 -1
- package/dist/assets/{walletconnect-BgAZqbXg.js → walletconnect-CCdGO7JL.js} +1 -1
- package/dist/assets/{warning-circle-OFLJWcAI.js → warning-circle-gDsO_gdI.js} +1 -1
- package/dist/assets/{web-DWdZiDY7.js → web-BIxDucrP.js} +1 -1
- package/dist/assets/{web-MzbMqkc3.js → web-VeP6mq4A.js} +1 -1
- package/dist/assets/{x-CIb6zO-n.js → x-DgWe3wGg.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/Index-CwVq3Ycf.js +0 -1
- package/dist/assets/Index-D_5VDtZe.css +0 -1
- package/dist/assets/_Uint8Array-BP4C5DZm.js +0 -1
- package/dist/assets/seedream-CBaTJXUS.js +0 -1
- package/dist/assets/seedream-CXCUm_0w.js +0 -1
- package/dist/assets/validator-DGv8iqeP.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Ri,j as uo}from"./vendor-dayjs-v0j1UNZp.js";import{eD as La}from"./index-BzRVav2J.js";import{E as fo}from"./index-9HGDSJTR.js";import"./vendor-vue-NSDaktjZ.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-vue-router-Kg6s1a65.js";var Gn={},Br={},as;function Ca(){if(as)return Br;as=1,Br.byteLength=u,Br.toByteArray=v,Br.fromByteArray=_;for(var n=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=r.length;s<i;++s)n[s]=r[s],t[r.charCodeAt(s)]=s;t[45]=62,t[95]=63;function o(S){var T=S.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var M=S.indexOf("=");M===-1&&(M=T);var N=M===T?0:4-M%4;return[M,N]}function u(S){var T=o(S),M=T[0],N=T[1];return(M+N)*3/4-N}function p(S,T,M){return(T+M)*3/4-M}function v(S){var T,M=o(S),N=M[0],F=M[1],H=new e(p(S,N,F)),$=0,Y=F>0?N-4:N,X;for(X=0;X<Y;X+=4)T=t[S.charCodeAt(X)]<<18|t[S.charCodeAt(X+1)]<<12|t[S.charCodeAt(X+2)]<<6|t[S.charCodeAt(X+3)],H[$++]=T>>16&255,H[$++]=T>>8&255,H[$++]=T&255;return F===2&&(T=t[S.charCodeAt(X)]<<2|t[S.charCodeAt(X+1)]>>4,H[$++]=T&255),F===1&&(T=t[S.charCodeAt(X)]<<10|t[S.charCodeAt(X+1)]<<4|t[S.charCodeAt(X+2)]>>2,H[$++]=T>>8&255,H[$++]=T&255),H}function B(S){return n[S>>18&63]+n[S>>12&63]+n[S>>6&63]+n[S&63]}function P(S,T,M){for(var N,F=[],H=T;H<M;H+=3)N=(S[H]<<16&16711680)+(S[H+1]<<8&65280)+(S[H+2]&255),F.push(B(N));return F.join("")}function _(S){for(var T,M=S.length,N=M%3,F=[],H=16383,$=0,Y=M-N;$<Y;$+=H)F.push(P(S,$,$+H>Y?Y:$+H));return N===1?(T=S[M-1],F.push(n[T>>2]+n[T<<4&63]+"==")):N===2&&(T=(S[M-2]<<8)+S[M-1],F.push(n[T>>10]+n[T>>4&63]+n[T<<2&63]+"=")),F.join("")}return Br}var Gr={};var cs;function Ua(){return cs||(cs=1,Gr.read=function(n,t,e,r,s){var i,o,u=s*8-r-1,p=(1<<u)-1,v=p>>1,B=-7,P=e?s-1:0,_=e?-1:1,S=n[t+P];for(P+=_,i=S&(1<<-B)-1,S>>=-B,B+=u;B>0;i=i*256+n[t+P],P+=_,B-=8);for(o=i&(1<<-B)-1,i>>=-B,B+=r;B>0;o=o*256+n[t+P],P+=_,B-=8);if(i===0)i=1-v;else{if(i===p)return o?NaN:(S?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-v}return(S?-1:1)*o*Math.pow(2,i-r)},Gr.write=function(n,t,e,r,s,i){var o,u,p,v=i*8-s-1,B=(1<<v)-1,P=B>>1,_=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=r?0:i-1,T=r?1:-1,M=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=B):(o=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-o))<1&&(o--,p*=2),o+P>=1?t+=_/p:t+=_*Math.pow(2,1-P),t*p>=2&&(o++,p/=2),o+P>=B?(u=0,o=B):o+P>=1?(u=(t*p-1)*Math.pow(2,s),o=o+P):(u=t*Math.pow(2,P-1)*Math.pow(2,s),o=0));s>=8;n[e+S]=u&255,S+=T,u/=256,s-=8);for(o=o<<s|u,v+=s;v>0;n[e+S]=o&255,S+=T,o/=256,v-=8);n[e+S-T]|=M*128}),Gr}var us;function Mi(){return us||(us=1,(function(n){const t=Ca(),e=Ua(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=u,n.SlowBuffer=H,n.INSPECT_MAX_BYTES=50;const s=2147483647;n.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=i(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const m=new Uint8Array(1),h={foo:function(){return 42}};return Object.setPrototypeOf(h,Uint8Array.prototype),Object.setPrototypeOf(m,h),m.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function o(m){if(m>s)throw new RangeError('The value "'+m+'" is invalid for option "size"');const h=new Uint8Array(m);return Object.setPrototypeOf(h,u.prototype),h}function u(m,h,d){if(typeof m=="number"){if(typeof h=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return P(m)}return p(m,h,d)}u.poolSize=8192;function p(m,h,d){if(typeof m=="string")return _(m,h);if(ArrayBuffer.isView(m))return T(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(xe(m,ArrayBuffer)||m&&xe(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xe(m,SharedArrayBuffer)||m&&xe(m.buffer,SharedArrayBuffer)))return M(m,h,d);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const x=m.valueOf&&m.valueOf();if(x!=null&&x!==m)return u.from(x,h,d);const O=N(m);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return u.from(m[Symbol.toPrimitive]("string"),h,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}u.from=function(m,h,d){return p(m,h,d)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function v(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function B(m,h,d){return v(m),m<=0?o(m):h!==void 0?typeof d=="string"?o(m).fill(h,d):o(m).fill(h):o(m)}u.alloc=function(m,h,d){return B(m,h,d)};function P(m){return v(m),o(m<0?0:F(m)|0)}u.allocUnsafe=function(m){return P(m)},u.allocUnsafeSlow=function(m){return P(m)};function _(m,h){if((typeof h!="string"||h==="")&&(h="utf8"),!u.isEncoding(h))throw new TypeError("Unknown encoding: "+h);const d=$(m,h)|0;let x=o(d);const O=x.write(m,h);return O!==d&&(x=x.slice(0,O)),x}function S(m){const h=m.length<0?0:F(m.length)|0,d=o(h);for(let x=0;x<h;x+=1)d[x]=m[x]&255;return d}function T(m){if(xe(m,Uint8Array)){const h=new Uint8Array(m);return M(h.buffer,h.byteOffset,h.byteLength)}return S(m)}function M(m,h,d){if(h<0||m.byteLength<h)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<h+(d||0))throw new RangeError('"length" is outside of buffer bounds');let x;return h===void 0&&d===void 0?x=new Uint8Array(m):d===void 0?x=new Uint8Array(m,h):x=new Uint8Array(m,h,d),Object.setPrototypeOf(x,u.prototype),x}function N(m){if(u.isBuffer(m)){const h=F(m.length)|0,d=o(h);return d.length===0||m.copy(d,0,0,h),d}if(m.length!==void 0)return typeof m.length!="number"||Lt(m.length)?o(0):S(m);if(m.type==="Buffer"&&Array.isArray(m.data))return S(m.data)}function F(m){if(m>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return m|0}function H(m){return+m!=m&&(m=0),u.alloc(+m)}u.isBuffer=function(h){return h!=null&&h._isBuffer===!0&&h!==u.prototype},u.compare=function(h,d){if(xe(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),xe(d,Uint8Array)&&(d=u.from(d,d.offset,d.byteLength)),!u.isBuffer(h)||!u.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(h===d)return 0;let x=h.length,O=d.length;for(let K=0,G=Math.min(x,O);K<G;++K)if(h[K]!==d[K]){x=h[K],O=d[K];break}return x<O?-1:O<x?1:0},u.isEncoding=function(h){switch(String(h).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(h,d){if(!Array.isArray(h))throw new TypeError('"list" argument must be an Array of Buffers');if(h.length===0)return u.alloc(0);let x;if(d===void 0)for(d=0,x=0;x<h.length;++x)d+=h[x].length;const O=u.allocUnsafe(d);let K=0;for(x=0;x<h.length;++x){let G=h[x];if(xe(G,Uint8Array))K+G.length>O.length?(u.isBuffer(G)||(G=u.from(G)),G.copy(O,K)):Uint8Array.prototype.set.call(O,G,K);else if(u.isBuffer(G))G.copy(O,K);else throw new TypeError('"list" argument must be an Array of Buffers');K+=G.length}return O};function $(m,h){if(u.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||xe(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);const d=m.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&d===0)return 0;let O=!1;for(;;)switch(h){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return Pt(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return Ct(m).length;default:if(O)return x?-1:Pt(m).length;h=(""+h).toLowerCase(),O=!0}}u.byteLength=$;function Y(m,h,d){let x=!1;if((h===void 0||h<0)&&(h=0),h>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,h>>>=0,d<=h))return"";for(m||(m="utf8");;)switch(m){case"hex":return A(this,h,d);case"utf8":case"utf-8":return a(this,h,d);case"ascii":return k(this,h,d);case"latin1":case"binary":return E(this,h,d);case"base64":return y(this,h,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,h,d);default:if(x)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),x=!0}}u.prototype._isBuffer=!0;function X(m,h,d){const x=m[h];m[h]=m[d],m[d]=x}u.prototype.swap16=function(){const h=this.length;if(h%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<h;d+=2)X(this,d,d+1);return this},u.prototype.swap32=function(){const h=this.length;if(h%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<h;d+=4)X(this,d,d+3),X(this,d+1,d+2);return this},u.prototype.swap64=function(){const h=this.length;if(h%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<h;d+=8)X(this,d,d+7),X(this,d+1,d+6),X(this,d+2,d+5),X(this,d+3,d+4);return this},u.prototype.toString=function(){const h=this.length;return h===0?"":arguments.length===0?a(this,0,h):Y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(h){if(!u.isBuffer(h))throw new TypeError("Argument must be a Buffer");return this===h?!0:u.compare(this,h)===0},u.prototype.inspect=function(){let h="";const d=n.INSPECT_MAX_BYTES;return h=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(h+=" ... "),"<Buffer "+h+">"},r&&(u.prototype[r]=u.prototype.inspect),u.prototype.compare=function(h,d,x,O,K){if(xe(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),!u.isBuffer(h))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof h);if(d===void 0&&(d=0),x===void 0&&(x=h?h.length:0),O===void 0&&(O=0),K===void 0&&(K=this.length),d<0||x>h.length||O<0||K>this.length)throw new RangeError("out of range index");if(O>=K&&d>=x)return 0;if(O>=K)return-1;if(d>=x)return 1;if(d>>>=0,x>>>=0,O>>>=0,K>>>=0,this===h)return 0;let G=K-O,pt=x-d;const dt=Math.min(G,pt),lt=this.slice(O,K),Mt=h.slice(d,x);for(let ht=0;ht<dt;++ht)if(lt[ht]!==Mt[ht]){G=lt[ht],pt=Mt[ht];break}return G<pt?-1:pt<G?1:0};function Q(m,h,d,x,O){if(m.length===0)return-1;if(typeof d=="string"?(x=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,Lt(d)&&(d=O?0:m.length-1),d<0&&(d=m.length+d),d>=m.length){if(O)return-1;d=m.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof h=="string"&&(h=u.from(h,x)),u.isBuffer(h))return h.length===0?-1:ct(m,h,d,x,O);if(typeof h=="number")return h=h&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(m,h,d):Uint8Array.prototype.lastIndexOf.call(m,h,d):ct(m,[h],d,x,O);throw new TypeError("val must be string, number or Buffer")}function ct(m,h,d,x,O){let K=1,G=m.length,pt=h.length;if(x!==void 0&&(x=String(x).toLowerCase(),x==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(m.length<2||h.length<2)return-1;K=2,G/=2,pt/=2,d/=2}function dt(Mt,ht){return K===1?Mt[ht]:Mt.readUInt16BE(ht*K)}let lt;if(O){let Mt=-1;for(lt=d;lt<G;lt++)if(dt(m,lt)===dt(h,Mt===-1?0:lt-Mt)){if(Mt===-1&&(Mt=lt),lt-Mt+1===pt)return Mt*K}else Mt!==-1&&(lt-=lt-Mt),Mt=-1}else for(d+pt>G&&(d=G-pt),lt=d;lt>=0;lt--){let Mt=!0;for(let ht=0;ht<pt;ht++)if(dt(m,lt+ht)!==dt(h,ht)){Mt=!1;break}if(Mt)return lt}return-1}u.prototype.includes=function(h,d,x){return this.indexOf(h,d,x)!==-1},u.prototype.indexOf=function(h,d,x){return Q(this,h,d,x,!0)},u.prototype.lastIndexOf=function(h,d,x){return Q(this,h,d,x,!1)};function ot(m,h,d,x){d=Number(d)||0;const O=m.length-d;x?(x=Number(x),x>O&&(x=O)):x=O;const K=h.length;x>K/2&&(x=K/2);let G;for(G=0;G<x;++G){const pt=parseInt(h.substr(G*2,2),16);if(Lt(pt))return G;m[d+G]=pt}return G}function C(m,h,d,x){return Rt(Pt(h,m.length-d),m,d,x)}function U(m,h,d,x){return Rt(Ft(h),m,d,x)}function D(m,h,d,x){return Rt(Ct(h),m,d,x)}function V(m,h,d,x){return Rt(Hr(h,m.length-d),m,d,x)}u.prototype.write=function(h,d,x,O){if(d===void 0)O="utf8",x=this.length,d=0;else if(x===void 0&&typeof d=="string")O=d,x=this.length,d=0;else if(isFinite(d))d=d>>>0,isFinite(x)?(x=x>>>0,O===void 0&&(O="utf8")):(O=x,x=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const K=this.length-d;if((x===void 0||x>K)&&(x=K),h.length>0&&(x<0||d<0)||d>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let G=!1;for(;;)switch(O){case"hex":return ot(this,h,d,x);case"utf8":case"utf-8":return C(this,h,d,x);case"ascii":case"latin1":case"binary":return U(this,h,d,x);case"base64":return D(this,h,d,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,h,d,x);default:if(G)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),G=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function y(m,h,d){return h===0&&d===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(h,d))}function a(m,h,d){d=Math.min(m.length,d);const x=[];let O=h;for(;O<d;){const K=m[O];let G=null,pt=K>239?4:K>223?3:K>191?2:1;if(O+pt<=d){let dt,lt,Mt,ht;switch(pt){case 1:K<128&&(G=K);break;case 2:dt=m[O+1],(dt&192)===128&&(ht=(K&31)<<6|dt&63,ht>127&&(G=ht));break;case 3:dt=m[O+1],lt=m[O+2],(dt&192)===128&&(lt&192)===128&&(ht=(K&15)<<12|(dt&63)<<6|lt&63,ht>2047&&(ht<55296||ht>57343)&&(G=ht));break;case 4:dt=m[O+1],lt=m[O+2],Mt=m[O+3],(dt&192)===128&&(lt&192)===128&&(Mt&192)===128&&(ht=(K&15)<<18|(dt&63)<<12|(lt&63)<<6|Mt&63,ht>65535&&ht<1114112&&(G=ht))}}G===null?(G=65533,pt=1):G>65535&&(G-=65536,x.push(G>>>10&1023|55296),G=56320|G&1023),x.push(G),O+=pt}return g(x)}const l=4096;function g(m){const h=m.length;if(h<=l)return String.fromCharCode.apply(String,m);let d="",x=0;for(;x<h;)d+=String.fromCharCode.apply(String,m.slice(x,x+=l));return d}function k(m,h,d){let x="";d=Math.min(m.length,d);for(let O=h;O<d;++O)x+=String.fromCharCode(m[O]&127);return x}function E(m,h,d){let x="";d=Math.min(m.length,d);for(let O=h;O<d;++O)x+=String.fromCharCode(m[O]);return x}function A(m,h,d){const x=m.length;(!h||h<0)&&(h=0),(!d||d<0||d>x)&&(d=x);let O="";for(let K=h;K<d;++K)O+=zt[m[K]];return O}function L(m,h,d){const x=m.slice(h,d);let O="";for(let K=0;K<x.length-1;K+=2)O+=String.fromCharCode(x[K]+x[K+1]*256);return O}u.prototype.slice=function(h,d){const x=this.length;h=~~h,d=d===void 0?x:~~d,h<0?(h+=x,h<0&&(h=0)):h>x&&(h=x),d<0?(d+=x,d<0&&(d=0)):d>x&&(d=x),d<h&&(d=h);const O=this.subarray(h,d);return Object.setPrototypeOf(O,u.prototype),O};function b(m,h,d){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+h>d)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=this[h],K=1,G=0;for(;++G<d&&(K*=256);)O+=this[h+G]*K;return O},u.prototype.readUintBE=u.prototype.readUIntBE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=this[h+--d],K=1;for(;d>0&&(K*=256);)O+=this[h+--d]*K;return O},u.prototype.readUint8=u.prototype.readUInt8=function(h,d){return h=h>>>0,d||b(h,1,this.length),this[h]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(h,d){return h=h>>>0,d||b(h,2,this.length),this[h]|this[h+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(h,d){return h=h>>>0,d||b(h,2,this.length),this[h]<<8|this[h+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(h,d){return h=h>>>0,d||b(h,4,this.length),(this[h]|this[h+1]<<8|this[h+2]<<16)+this[h+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(h,d){return h=h>>>0,d||b(h,4,this.length),this[h]*16777216+(this[h+1]<<16|this[h+2]<<8|this[h+3])},u.prototype.readBigUInt64LE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=d+this[++h]*2**8+this[++h]*2**16+this[++h]*2**24,K=this[++h]+this[++h]*2**8+this[++h]*2**16+x*2**24;return BigInt(O)+(BigInt(K)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=d*2**24+this[++h]*2**16+this[++h]*2**8+this[++h],K=this[++h]*2**24+this[++h]*2**16+this[++h]*2**8+x;return(BigInt(O)<<BigInt(32))+BigInt(K)}),u.prototype.readIntLE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=this[h],K=1,G=0;for(;++G<d&&(K*=256);)O+=this[h+G]*K;return K*=128,O>=K&&(O-=Math.pow(2,8*d)),O},u.prototype.readIntBE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=d,K=1,G=this[h+--O];for(;O>0&&(K*=256);)G+=this[h+--O]*K;return K*=128,G>=K&&(G-=Math.pow(2,8*d)),G},u.prototype.readInt8=function(h,d){return h=h>>>0,d||b(h,1,this.length),this[h]&128?(255-this[h]+1)*-1:this[h]},u.prototype.readInt16LE=function(h,d){h=h>>>0,d||b(h,2,this.length);const x=this[h]|this[h+1]<<8;return x&32768?x|4294901760:x},u.prototype.readInt16BE=function(h,d){h=h>>>0,d||b(h,2,this.length);const x=this[h+1]|this[h]<<8;return x&32768?x|4294901760:x},u.prototype.readInt32LE=function(h,d){return h=h>>>0,d||b(h,4,this.length),this[h]|this[h+1]<<8|this[h+2]<<16|this[h+3]<<24},u.prototype.readInt32BE=function(h,d){return h=h>>>0,d||b(h,4,this.length),this[h]<<24|this[h+1]<<16|this[h+2]<<8|this[h+3]},u.prototype.readBigInt64LE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=this[h+4]+this[h+5]*2**8+this[h+6]*2**16+(x<<24);return(BigInt(O)<<BigInt(32))+BigInt(d+this[++h]*2**8+this[++h]*2**16+this[++h]*2**24)}),u.prototype.readBigInt64BE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=(d<<24)+this[++h]*2**16+this[++h]*2**8+this[++h];return(BigInt(O)<<BigInt(32))+BigInt(this[++h]*2**24+this[++h]*2**16+this[++h]*2**8+x)}),u.prototype.readFloatLE=function(h,d){return h=h>>>0,d||b(h,4,this.length),e.read(this,h,!0,23,4)},u.prototype.readFloatBE=function(h,d){return h=h>>>0,d||b(h,4,this.length),e.read(this,h,!1,23,4)},u.prototype.readDoubleLE=function(h,d){return h=h>>>0,d||b(h,8,this.length),e.read(this,h,!0,52,8)},u.prototype.readDoubleBE=function(h,d){return h=h>>>0,d||b(h,8,this.length),e.read(this,h,!1,52,8)};function c(m,h,d,x,O,K){if(!u.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(h>O||h<K)throw new RangeError('"value" argument is out of bounds');if(d+x>m.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(h,d,x,O){if(h=+h,d=d>>>0,x=x>>>0,!O){const pt=Math.pow(2,8*x)-1;c(this,h,d,x,pt,0)}let K=1,G=0;for(this[d]=h&255;++G<x&&(K*=256);)this[d+G]=h/K&255;return d+x},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(h,d,x,O){if(h=+h,d=d>>>0,x=x>>>0,!O){const pt=Math.pow(2,8*x)-1;c(this,h,d,x,pt,0)}let K=x-1,G=1;for(this[d+K]=h&255;--K>=0&&(G*=256);)this[d+K]=h/G&255;return d+x},u.prototype.writeUint8=u.prototype.writeUInt8=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,1,255,0),this[d]=h&255,d+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,65535,0),this[d]=h&255,this[d+1]=h>>>8,d+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,65535,0),this[d]=h>>>8,this[d+1]=h&255,d+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,4294967295,0),this[d+3]=h>>>24,this[d+2]=h>>>16,this[d+1]=h>>>8,this[d]=h&255,d+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,4294967295,0),this[d]=h>>>24,this[d+1]=h>>>16,this[d+2]=h>>>8,this[d+3]=h&255,d+4};function f(m,h,d,x,O){It(h,x,O,m,d,7);let K=Number(h&BigInt(4294967295));m[d++]=K,K=K>>8,m[d++]=K,K=K>>8,m[d++]=K,K=K>>8,m[d++]=K;let G=Number(h>>BigInt(32)&BigInt(4294967295));return m[d++]=G,G=G>>8,m[d++]=G,G=G>>8,m[d++]=G,G=G>>8,m[d++]=G,d}function w(m,h,d,x,O){It(h,x,O,m,d,7);let K=Number(h&BigInt(4294967295));m[d+7]=K,K=K>>8,m[d+6]=K,K=K>>8,m[d+5]=K,K=K>>8,m[d+4]=K;let G=Number(h>>BigInt(32)&BigInt(4294967295));return m[d+3]=G,G=G>>8,m[d+2]=G,G=G>>8,m[d+1]=G,G=G>>8,m[d]=G,d+8}u.prototype.writeBigUInt64LE=Ae(function(h,d=0){return f(this,h,d,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ae(function(h,d=0){return w(this,h,d,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(h,d,x,O){if(h=+h,d=d>>>0,!O){const dt=Math.pow(2,8*x-1);c(this,h,d,x,dt-1,-dt)}let K=0,G=1,pt=0;for(this[d]=h&255;++K<x&&(G*=256);)h<0&&pt===0&&this[d+K-1]!==0&&(pt=1),this[d+K]=(h/G>>0)-pt&255;return d+x},u.prototype.writeIntBE=function(h,d,x,O){if(h=+h,d=d>>>0,!O){const dt=Math.pow(2,8*x-1);c(this,h,d,x,dt-1,-dt)}let K=x-1,G=1,pt=0;for(this[d+K]=h&255;--K>=0&&(G*=256);)h<0&&pt===0&&this[d+K+1]!==0&&(pt=1),this[d+K]=(h/G>>0)-pt&255;return d+x},u.prototype.writeInt8=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,1,127,-128),h<0&&(h=255+h+1),this[d]=h&255,d+1},u.prototype.writeInt16LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,32767,-32768),this[d]=h&255,this[d+1]=h>>>8,d+2},u.prototype.writeInt16BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,32767,-32768),this[d]=h>>>8,this[d+1]=h&255,d+2},u.prototype.writeInt32LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,2147483647,-2147483648),this[d]=h&255,this[d+1]=h>>>8,this[d+2]=h>>>16,this[d+3]=h>>>24,d+4},u.prototype.writeInt32BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,2147483647,-2147483648),h<0&&(h=4294967295+h+1),this[d]=h>>>24,this[d+1]=h>>>16,this[d+2]=h>>>8,this[d+3]=h&255,d+4},u.prototype.writeBigInt64LE=Ae(function(h,d=0){return f(this,h,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ae(function(h,d=0){return w(this,h,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function I(m,h,d,x,O,K){if(d+x>m.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function z(m,h,d,x,O){return h=+h,d=d>>>0,O||I(m,h,d,4),e.write(m,h,d,x,23,4),d+4}u.prototype.writeFloatLE=function(h,d,x){return z(this,h,d,!0,x)},u.prototype.writeFloatBE=function(h,d,x){return z(this,h,d,!1,x)};function j(m,h,d,x,O){return h=+h,d=d>>>0,O||I(m,h,d,8),e.write(m,h,d,x,52,8),d+8}u.prototype.writeDoubleLE=function(h,d,x){return j(this,h,d,!0,x)},u.prototype.writeDoubleBE=function(h,d,x){return j(this,h,d,!1,x)},u.prototype.copy=function(h,d,x,O){if(!u.isBuffer(h))throw new TypeError("argument should be a Buffer");if(x||(x=0),!O&&O!==0&&(O=this.length),d>=h.length&&(d=h.length),d||(d=0),O>0&&O<x&&(O=x),O===x||h.length===0||this.length===0)return 0;if(d<0)throw new RangeError("targetStart out of bounds");if(x<0||x>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),h.length-d<O-x&&(O=h.length-d+x);const K=O-x;return this===h&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(d,x,O):Uint8Array.prototype.set.call(h,this.subarray(x,O),d),K},u.prototype.fill=function(h,d,x,O){if(typeof h=="string"){if(typeof d=="string"?(O=d,d=0,x=this.length):typeof x=="string"&&(O=x,x=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!u.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(h.length===1){const G=h.charCodeAt(0);(O==="utf8"&&G<128||O==="latin1")&&(h=G)}}else typeof h=="number"?h=h&255:typeof h=="boolean"&&(h=Number(h));if(d<0||this.length<d||this.length<x)throw new RangeError("Out of range index");if(x<=d)return this;d=d>>>0,x=x===void 0?this.length:x>>>0,h||(h=0);let K;if(typeof h=="number")for(K=d;K<x;++K)this[K]=h;else{const G=u.isBuffer(h)?h:u.from(h,O),pt=G.length;if(pt===0)throw new TypeError('The value "'+h+'" is invalid for argument "value"');for(K=0;K<x-d;++K)this[K+d]=G[K%pt]}return this};const rt={};function st(m,h,d){rt[m]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:h.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}st("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),st("ERR_INVALID_ARG_TYPE",function(m,h){return`The "${m}" argument must be of type number. Received type ${typeof h}`},TypeError),st("ERR_OUT_OF_RANGE",function(m,h,d){let x=`The value of "${m}" is out of range.`,O=d;return Number.isInteger(d)&&Math.abs(d)>2**32?O=kt(String(d)):typeof d=="bigint"&&(O=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(O=kt(O)),O+="n"),x+=` It must be ${h}. Received ${O}`,x},RangeError);function kt(m){let h="",d=m.length;const x=m[0]==="-"?1:0;for(;d>=x+4;d-=3)h=`_${m.slice(d-3,d)}${h}`;return`${m.slice(0,d)}${h}`}function vt(m,h,d){Ie(h,"offset"),(m[h]===void 0||m[h+d]===void 0)&&At(h,m.length-(d+1))}function It(m,h,d,x,O,K){if(m>d||m<h){const G=typeof h=="bigint"?"n":"";let pt;throw h===0||h===BigInt(0)?pt=`>= 0${G} and < 2${G} ** ${(K+1)*8}${G}`:pt=`>= -(2${G} ** ${(K+1)*8-1}${G}) and < 2 ** ${(K+1)*8-1}${G}`,new rt.ERR_OUT_OF_RANGE("value",pt,m)}vt(x,O,K)}function Ie(m,h){if(typeof m!="number")throw new rt.ERR_INVALID_ARG_TYPE(h,"number",m)}function At(m,h,d){throw Math.floor(m)!==m?(Ie(m,d),new rt.ERR_OUT_OF_RANGE("offset","an integer",m)):h<0?new rt.ERR_BUFFER_OUT_OF_BOUNDS:new rt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${h}`,m)}const Nt=/[^+/0-9A-Za-z-_]/g;function Vr(m){if(m=m.split("=")[0],m=m.trim().replace(Nt,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Pt(m,h){h=h||1/0;let d;const x=m.length;let O=null;const K=[];for(let G=0;G<x;++G){if(d=m.charCodeAt(G),d>55295&&d<57344){if(!O){if(d>56319){(h-=3)>-1&&K.push(239,191,189);continue}else if(G+1===x){(h-=3)>-1&&K.push(239,191,189);continue}O=d;continue}if(d<56320){(h-=3)>-1&&K.push(239,191,189),O=d;continue}d=(O-55296<<10|d-56320)+65536}else O&&(h-=3)>-1&&K.push(239,191,189);if(O=null,d<128){if((h-=1)<0)break;K.push(d)}else if(d<2048){if((h-=2)<0)break;K.push(d>>6|192,d&63|128)}else if(d<65536){if((h-=3)<0)break;K.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((h-=4)<0)break;K.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return K}function Ft(m){const h=[];for(let d=0;d<m.length;++d)h.push(m.charCodeAt(d)&255);return h}function Hr(m,h){let d,x,O;const K=[];for(let G=0;G<m.length&&!((h-=2)<0);++G)d=m.charCodeAt(G),x=d>>8,O=d%256,K.push(O),K.push(x);return K}function Ct(m){return t.toByteArray(Vr(m))}function Rt(m,h,d,x){let O;for(O=0;O<x&&!(O+d>=h.length||O>=m.length);++O)h[O+d]=m[O];return O}function xe(m,h){return m instanceof h||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===h.name}function Lt(m){return m!==m}const zt=(function(){const m="0123456789abcdef",h=new Array(256);for(let d=0;d<16;++d){const x=d*16;for(let O=0;O<16;++O)h[x+O]=m[d]+m[O]}return h})();function Ae(m){return typeof BigInt>"u"?Kt:m}function Kt(){throw new Error("BigInt not supported")}})(Gn)),Gn}var ft=Mi();const lr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Fr(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Cr(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function $e(n,...t){if(!Fr(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function ho(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Cr(n.outputLen),Cr(n.blockLen)}function br(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function lo(n,t){$e(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Oa(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function Qe(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function jn(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Re(n,t){return n<<32-t|n>>>t}const Na=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Fa(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}function za(n){for(let t=0;t<n.length;t++)n[t]=Fa(n[t]);return n}const fs=Na?n=>n:za,po=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ka=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function sr(n){if($e(n),po)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Ka[n[e]];return t}const Oe={_0:48,_9:57,A:65,F:70,a:97,f:102};function hs(n){if(n>=Oe._0&&n<=Oe._9)return n-Oe._0;if(n>=Oe.A&&n<=Oe.F)return n-(Oe.A-10);if(n>=Oe.a&&n<=Oe.f)return n-(Oe.a-10)}function sn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(po)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let s=0,i=0;s<e;s++,i+=2){const o=hs(n.charCodeAt(i)),u=hs(n.charCodeAt(i+1));if(o===void 0||u===void 0){const p=n[i]+n[i+1];throw new Error('hex string expected, got non-hex character "'+p+'" at index '+i)}r[s]=o*16+u}return r}function qa(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function wn(n){return typeof n=="string"&&(n=qa(n)),$e(n),n}function Me(...n){let t=0;for(let r=0;r<n.length;r++){const s=n[r];$e(s),t+=s.length}const e=new Uint8Array(t);for(let r=0,s=0;r<n.length;r++){const i=n[r];e.set(i,s),s+=i.length}return e}class Ti{}function Pi(n){const t=r=>n().update(wn(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Li(n=32){if(lr&&typeof lr.getRandomValues=="function")return lr.getRandomValues(new Uint8Array(n));if(lr&&typeof lr.randomBytes=="function")return Uint8Array.from(lr.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function Da(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(e>>s&i),u=Number(e&i),p=r?4:0,v=r?0:4;n.setUint32(t+p,o,r),n.setUint32(t+v,u,r)}function Wa(n,t,e){return n&t^~n&e}function $a(n,t,e){return n&t^n&e^t&e}class go extends Ti{constructor(t,e,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=jn(this.buffer)}update(t){br(this),t=wn(t),$e(t);const{view:e,buffer:r,blockLen:s}=this,i=t.length;for(let o=0;o<i;){const u=Math.min(s-this.pos,i-o);if(u===s){const p=jn(t);for(;s<=i-o;o+=s)this.process(p,o);continue}r.set(t.subarray(o,o+u),this.pos),this.pos+=u,o+=u,this.pos===s&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){br(this),lo(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;e[o++]=128,Qe(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let P=o;P<s;P++)e[P]=0;Da(r,s-8,BigInt(this.length*8),i),this.process(r,0);const u=jn(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const v=p/4,B=this.get();if(v>B.length)throw new Error("_sha2: outputLen bigger than state");for(let P=0;P<v;P++)u.setUint32(4*P,B[P],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:s,finished:i,destroyed:o,pos:u}=this;return t.destroyed=o,t.finished=i,t.length=s,t.pos=u,s%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Ve=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),jr=BigInt(2**32-1),ls=BigInt(32);function Va(n,t=!1){return t?{h:Number(n&jr),l:Number(n>>ls&jr)}:{h:Number(n>>ls&jr)|0,l:Number(n&jr)|0}}function yo(n,t=!1){const e=n.length;let r=new Uint32Array(e),s=new Uint32Array(e);for(let i=0;i<e;i++){const{h:o,l:u}=Va(n[i],t);[r[i],s[i]]=[o,u]}return[r,s]}const ds=(n,t,e)=>n>>>e,ps=(n,t,e)=>n<<32-e|t>>>e,dr=(n,t,e)=>n>>>e|t<<32-e,pr=(n,t,e)=>n<<32-e|t>>>e,Zr=(n,t,e)=>n<<64-e|t>>>e-32,Yr=(n,t,e)=>n>>>e-32|t<<64-e,Ha=(n,t,e)=>n<<e|t>>>32-e,Ga=(n,t,e)=>t<<e|n>>>32-e,ja=(n,t,e)=>t<<e-32|n>>>64-e,Za=(n,t,e)=>n<<e-32|t>>>64-e;function Ne(n,t,e,r){const s=(t>>>0)+(r>>>0);return{h:n+e+(s/2**32|0)|0,l:s|0}}const Ya=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Xa=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Ja=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Qa=(n,t,e,r,s)=>t+e+r+s+(n/2**32|0)|0,tc=(n,t,e,r,s)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(s>>>0),ec=(n,t,e,r,s,i)=>t+e+r+s+i+(n/2**32|0)|0,rc=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),He=new Uint32Array(64);class nc extends go{constructor(t=32){super(64,t,8,!1),this.A=Ve[0]|0,this.B=Ve[1]|0,this.C=Ve[2]|0,this.D=Ve[3]|0,this.E=Ve[4]|0,this.F=Ve[5]|0,this.G=Ve[6]|0,this.H=Ve[7]|0}get(){const{A:t,B:e,C:r,D:s,E:i,F:o,G:u,H:p}=this;return[t,e,r,s,i,o,u,p]}set(t,e,r,s,i,o,u,p){this.A=t|0,this.B=e|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=u|0,this.H=p|0}process(t,e){for(let P=0;P<16;P++,e+=4)He[P]=t.getUint32(e,!1);for(let P=16;P<64;P++){const _=He[P-15],S=He[P-2],T=Re(_,7)^Re(_,18)^_>>>3,M=Re(S,17)^Re(S,19)^S>>>10;He[P]=M+He[P-7]+T+He[P-16]|0}let{A:r,B:s,C:i,D:o,E:u,F:p,G:v,H:B}=this;for(let P=0;P<64;P++){const _=Re(u,6)^Re(u,11)^Re(u,25),S=B+_+Wa(u,p,v)+rc[P]+He[P]|0,M=(Re(r,2)^Re(r,13)^Re(r,22))+$a(r,s,i)|0;B=v,v=p,p=u,u=o+S|0,o=i,i=s,s=r,r=S+M|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,u=u+this.E|0,p=p+this.F|0,v=v+this.G|0,B=B+this.H|0,this.set(r,s,i,o,u,p,v,B)}roundClean(){Qe(He)}destroy(){this.set(0,0,0,0,0,0,0,0),Qe(this.buffer)}}const mo=yo(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),ic=mo[0],sc=mo[1],Ge=new Uint32Array(80),je=new Uint32Array(80);class oc extends go{constructor(t=64){super(128,t,16,!1),this.Ah=pe[0]|0,this.Al=pe[1]|0,this.Bh=pe[2]|0,this.Bl=pe[3]|0,this.Ch=pe[4]|0,this.Cl=pe[5]|0,this.Dh=pe[6]|0,this.Dl=pe[7]|0,this.Eh=pe[8]|0,this.El=pe[9]|0,this.Fh=pe[10]|0,this.Fl=pe[11]|0,this.Gh=pe[12]|0,this.Gl=pe[13]|0,this.Hh=pe[14]|0,this.Hl=pe[15]|0}get(){const{Ah:t,Al:e,Bh:r,Bl:s,Ch:i,Cl:o,Dh:u,Dl:p,Eh:v,El:B,Fh:P,Fl:_,Gh:S,Gl:T,Hh:M,Hl:N}=this;return[t,e,r,s,i,o,u,p,v,B,P,_,S,T,M,N]}set(t,e,r,s,i,o,u,p,v,B,P,_,S,T,M,N){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=u|0,this.Dl=p|0,this.Eh=v|0,this.El=B|0,this.Fh=P|0,this.Fl=_|0,this.Gh=S|0,this.Gl=T|0,this.Hh=M|0,this.Hl=N|0}process(t,e){for(let $=0;$<16;$++,e+=4)Ge[$]=t.getUint32(e),je[$]=t.getUint32(e+=4);for(let $=16;$<80;$++){const Y=Ge[$-15]|0,X=je[$-15]|0,Q=dr(Y,X,1)^dr(Y,X,8)^ds(Y,X,7),ct=pr(Y,X,1)^pr(Y,X,8)^ps(Y,X,7),ot=Ge[$-2]|0,C=je[$-2]|0,U=dr(ot,C,19)^Zr(ot,C,61)^ds(ot,C,6),D=pr(ot,C,19)^Yr(ot,C,61)^ps(ot,C,6),V=Ja(ct,D,je[$-7],je[$-16]),y=Qa(V,Q,U,Ge[$-7],Ge[$-16]);Ge[$]=y|0,je[$]=V|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:u,Cl:p,Dh:v,Dl:B,Eh:P,El:_,Fh:S,Fl:T,Gh:M,Gl:N,Hh:F,Hl:H}=this;for(let $=0;$<80;$++){const Y=dr(P,_,14)^dr(P,_,18)^Zr(P,_,41),X=pr(P,_,14)^pr(P,_,18)^Yr(P,_,41),Q=P&S^~P&M,ct=_&T^~_&N,ot=tc(H,X,ct,sc[$],je[$]),C=ec(ot,F,Y,Q,ic[$],Ge[$]),U=ot|0,D=dr(r,s,28)^Zr(r,s,34)^Zr(r,s,39),V=pr(r,s,28)^Yr(r,s,34)^Yr(r,s,39),y=r&i^r&u^i&u,a=s&o^s&p^o&p;F=M|0,H=N|0,M=S|0,N=T|0,S=P|0,T=_|0,{h:P,l:_}=Ne(v|0,B|0,C|0,U|0),v=u|0,B=p|0,u=i|0,p=o|0,i=r|0,o=s|0;const l=Ya(U,V,a);r=Xa(l,C,D,y),s=l|0}({h:r,l:s}=Ne(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ne(this.Bh|0,this.Bl|0,i|0,o|0),{h:u,l:p}=Ne(this.Ch|0,this.Cl|0,u|0,p|0),{h:v,l:B}=Ne(this.Dh|0,this.Dl|0,v|0,B|0),{h:P,l:_}=Ne(this.Eh|0,this.El|0,P|0,_|0),{h:S,l:T}=Ne(this.Fh|0,this.Fl|0,S|0,T|0),{h:M,l:N}=Ne(this.Gh|0,this.Gl|0,M|0,N|0),{h:F,l:H}=Ne(this.Hh|0,this.Hl|0,F|0,H|0),this.set(r,s,i,o,u,p,v,B,P,_,S,T,M,N,F,H)}roundClean(){Qe(Ge,je)}destroy(){Qe(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const wo=Pi(()=>new nc),ac=Pi(()=>new oc);const Ci=BigInt(0),Si=BigInt(1);function ar(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}"`;throw new Error(e+"expected boolean, got type="+typeof n)}return n}function _e(n,t,e=""){const r=Fr(n),s=n?.length,i=t!==void 0;if(!r||i&&s!==t){const o=e&&`"${e}" `,u=i?` of length ${t}`:"",p=r?`length=${s}`:`type=${typeof n}`;throw new Error(o+"expected Uint8Array"+u+", got "+p)}return n}function Xr(n){const t=n.toString(16);return t.length&1?"0"+t:t}function bo(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Ci:BigInt("0x"+n)}function bn(n){return bo(sr(n))}function Ur(n){return $e(n),bo(sr(Uint8Array.from(n).reverse()))}function Ui(n,t){return sn(n.toString(16).padStart(t*2,"0"))}function ko(n,t){return Ui(n,t).reverse()}function Dt(n,t,e){let r;if(typeof t=="string")try{r=sn(t)}catch(i){throw new Error(n+" must be hex string or Uint8Array, cause: "+i)}else if(Fr(t))r=Uint8Array.from(t);else throw new Error(n+" must be hex string or Uint8Array");const s=r.length;if(typeof e=="number"&&s!==e)throw new Error(n+" of length "+e+" expected, got "+s);return r}function gs(n){return Uint8Array.from(n)}const Zn=n=>typeof n=="bigint"&&Ci<=n;function cc(n,t,e){return Zn(n)&&Zn(t)&&Zn(e)&&t<=n&&n<e}function xi(n,t,e,r){if(!cc(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function vo(n){let t;for(t=0;n>Ci;n>>=Si,t+=1);return t}const zr=n=>(Si<<BigInt(n))-Si;function uc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");const r=S=>new Uint8Array(S),s=S=>Uint8Array.of(S);let i=r(n),o=r(n),u=0;const p=()=>{i.fill(1),o.fill(0),u=0},v=(...S)=>e(o,i,...S),B=(S=r(0))=>{o=v(s(0),S),i=v(),S.length!==0&&(o=v(s(1),S),i=v())},P=()=>{if(u++>=1e3)throw new Error("drbg: tried 1000 values");let S=0;const T=[];for(;S<t;){i=v();const M=i.slice();T.push(M),S+=i.length}return Me(...T)};return(S,T)=>{p(),B(S);let M;for(;!(M=T(P()));)B();return p(),M}}function Kr(n,t,e={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(s,i,o){const u=n[s];if(o&&u===void 0)return;const p=typeof u;if(p!==i||u===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${p}`)}Object.entries(t).forEach(([s,i])=>r(s,i,!1)),Object.entries(e).forEach(([s,i])=>r(s,i,!0))}function on(n){const t=new WeakMap;return(e,...r)=>{const s=t.get(e);if(s!==void 0)return s;const i=n(e,...r);return t.set(e,i),i}}const Se=BigInt(0),de=BigInt(1),er=BigInt(2),So=BigInt(3),xo=BigInt(4),Eo=BigInt(5),fc=BigInt(7),Io=BigInt(8),hc=BigInt(9),Ao=BigInt(16);function ae(n,t){const e=n%t;return e>=Se?e:t+e}function qt(n,t,e){let r=n;for(;t-- >Se;)r*=r,r%=e;return r}function ys(n,t){if(n===Se)throw new Error("invert: expected non-zero number");if(t<=Se)throw new Error("invert: expected positive modulus, got "+t);let e=ae(n,t),r=t,s=Se,i=de;for(;e!==Se;){const u=r/e,p=r%e,v=s-i*u;r=e,e=p,s=i,i=v}if(r!==de)throw new Error("invert: does not exist");return ae(s,t)}function Oi(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function _o(n,t){const e=(n.ORDER+de)/xo,r=n.pow(t,e);return Oi(n,r,t),r}function lc(n,t){const e=(n.ORDER-Eo)/Io,r=n.mul(t,er),s=n.pow(r,e),i=n.mul(t,s),o=n.mul(n.mul(i,er),s),u=n.mul(i,n.sub(o,n.ONE));return Oi(n,u,t),u}function dc(n){const t=cr(n),e=Bo(n),r=e(t,t.neg(t.ONE)),s=e(t,r),i=e(t,t.neg(r)),o=(n+fc)/Ao;return(u,p)=>{let v=u.pow(p,o),B=u.mul(v,r);const P=u.mul(v,s),_=u.mul(v,i),S=u.eql(u.sqr(B),p),T=u.eql(u.sqr(P),p);v=u.cmov(v,B,S),B=u.cmov(_,P,T);const M=u.eql(u.sqr(B),p),N=u.cmov(v,B,M);return Oi(u,N,p),N}}function Bo(n){if(n<So)throw new Error("sqrt is not defined for small field");let t=n-de,e=0;for(;t%er===Se;)t/=er,e++;let r=er;const s=cr(n);for(;ms(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return _o;let i=s.pow(r,t);const o=(t+de)/er;return function(p,v){if(p.is0(v))return v;if(ms(p,v)!==1)throw new Error("Cannot find square root");let B=e,P=p.mul(p.ONE,i),_=p.pow(v,t),S=p.pow(v,o);for(;!p.eql(_,p.ONE);){if(p.is0(_))return p.ZERO;let T=1,M=p.sqr(_);for(;!p.eql(M,p.ONE);)if(T++,M=p.sqr(M),T===B)throw new Error("Cannot find square root");const N=de<<BigInt(B-T-1),F=p.pow(P,N);B=T,P=p.sqr(F),_=p.mul(_,P),S=p.mul(S,F)}return S}}function pc(n){return n%xo===So?_o:n%Io===Eo?lc:n%Ao===hc?dc(n):Bo(n)}const gc=(n,t)=>(ae(n,t)&de)===de,yc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mc(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=yc.reduce((r,s)=>(r[s]="function",r),t);return Kr(n,e),n}function wc(n,t,e){if(e<Se)throw new Error("invalid exponent, negatives unsupported");if(e===Se)return n.ONE;if(e===de)return t;let r=n.ONE,s=t;for(;e>Se;)e&de&&(r=n.mul(r,s)),s=n.sqr(s),e>>=de;return r}function Ro(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),s=t.reduce((o,u,p)=>n.is0(u)?o:(r[p]=o,n.mul(o,u)),n.ONE),i=n.inv(s);return t.reduceRight((o,u,p)=>n.is0(u)?o:(r[p]=n.mul(o,r[p]),n.mul(o,u)),i),r}function ms(n,t){const e=(n.ORDER-de)/er,r=n.pow(t,e),s=n.eql(r,n.ONE),i=n.eql(r,n.ZERO),o=n.eql(r,n.neg(n.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Mo(n,t){t!==void 0&&Cr(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function cr(n,t,e=!1,r={}){if(n<=Se)throw new Error("invalid field: expected ORDER > 0, got "+n);let s,i,o=!1,u;if(typeof t=="object"&&t!=null){if(r.sqrt||e)throw new Error("cannot specify opts in two arguments");const _=t;_.BITS&&(s=_.BITS),_.sqrt&&(i=_.sqrt),typeof _.isLE=="boolean"&&(e=_.isLE),typeof _.modFromBytes=="boolean"&&(o=_.modFromBytes),u=_.allowedLengths}else typeof t=="number"&&(s=t),r.sqrt&&(i=r.sqrt);const{nBitLength:p,nByteLength:v}=Mo(n,s);if(v>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let B;const P=Object.freeze({ORDER:n,isLE:e,BITS:p,BYTES:v,MASK:zr(p),ZERO:Se,ONE:de,allowedLengths:u,create:_=>ae(_,n),isValid:_=>{if(typeof _!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof _);return Se<=_&&_<n},is0:_=>_===Se,isValidNot0:_=>!P.is0(_)&&P.isValid(_),isOdd:_=>(_&de)===de,neg:_=>ae(-_,n),eql:(_,S)=>_===S,sqr:_=>ae(_*_,n),add:(_,S)=>ae(_+S,n),sub:(_,S)=>ae(_-S,n),mul:(_,S)=>ae(_*S,n),pow:(_,S)=>wc(P,_,S),div:(_,S)=>ae(_*ys(S,n),n),sqrN:_=>_*_,addN:(_,S)=>_+S,subN:(_,S)=>_-S,mulN:(_,S)=>_*S,inv:_=>ys(_,n),sqrt:i||(_=>(B||(B=pc(n)),B(P,_))),toBytes:_=>e?ko(_,v):Ui(_,v),fromBytes:(_,S=!0)=>{if(u){if(!u.includes(_.length)||_.length>v)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+_.length);const M=new Uint8Array(v);M.set(_,e?0:M.length-_.length),_=M}if(_.length!==v)throw new Error("Field.fromBytes: expected "+v+" bytes, got "+_.length);let T=e?Ur(_):bn(_);if(o&&(T=ae(T,n)),!S&&!P.isValid(T))throw new Error("invalid field element: outside of range 0..ORDER");return T},invertBatch:_=>Ro(P,_),cmov:(_,S,T)=>T?S:_});return Object.freeze(P)}function To(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Po(n){const t=To(n);return t+Math.ceil(t/2)}function bc(n,t,e=!1){const r=n.length,s=To(t),i=Po(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=e?Ur(n):bn(n),u=ae(o,t-de)+de;return e?ko(u,s):Ui(u,s)}const kr=BigInt(0),rr=BigInt(1);function an(n,t){const e=t.negate();return n?e:t}function nr(n,t){const e=Ro(n.Fp,t.map(r=>r.Z));return t.map((r,s)=>n.fromAffine(r.toAffine(e[s])))}function Lo(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Yn(n,t){Lo(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),s=2**n,i=zr(n),o=BigInt(n);return{windows:e,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function ws(n,t,e){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=e;let u=Number(n&s),p=n>>o;u>r&&(u-=i,p+=rr);const v=t*r,B=v+Math.abs(u)-1,P=u===0,_=u<0,S=t%2!==0;return{nextN:p,offset:B,isZero:P,isNeg:_,isNegF:S,offsetF:v}}function kc(n,t){if(!Array.isArray(n))throw new Error("array expected");n.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function vc(n,t){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const Xn=new WeakMap,Co=new WeakMap;function Jn(n){return Co.get(n)||1}function bs(n){if(n!==kr)throw new Error("invalid wNAF")}class Uo{constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,r=this.ZERO){let s=t;for(;e>kr;)e&rr&&(r=r.add(s)),s=s.double(),e>>=rr;return r}precomputeWindow(t,e){const{windows:r,windowSize:s}=Yn(e,this.bits),i=[];let o=t,u=o;for(let p=0;p<r;p++){u=o,i.push(u);for(let v=1;v<s;v++)u=u.add(o),i.push(u);o=u.double()}return i}wNAF(t,e,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let s=this.ZERO,i=this.BASE;const o=Yn(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:p,offset:v,isZero:B,isNeg:P,isNegF:_,offsetF:S}=ws(r,u,o);r=p,B?i=i.add(an(_,e[S])):s=s.add(an(P,e[v]))}return bs(r),{p:s,f:i}}wNAFUnsafe(t,e,r,s=this.ZERO){const i=Yn(t,this.bits);for(let o=0;o<i.windows&&r!==kr;o++){const{nextN:u,offset:p,isZero:v,isNeg:B}=ws(r,o,i);if(r=u,!v){const P=e[p];s=s.add(B?P.negate():P)}}return bs(r),s}getPrecomputes(t,e,r){let s=Xn.get(e);return s||(s=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(s=r(s)),Xn.set(e,s))),s}cached(t,e,r){const s=Jn(t);return this.wNAF(s,this.getPrecomputes(s,t,r),e)}unsafe(t,e,r,s){const i=Jn(t);return i===1?this._unsafeLadder(t,e,s):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),e,s)}createCache(t,e){Lo(e,this.bits),Co.set(t,e),Xn.delete(t)}hasCache(t){return Jn(t)!==1}}function Sc(n,t,e,r){let s=t,i=n.ZERO,o=n.ZERO;for(;e>kr||r>kr;)e&rr&&(i=i.add(s)),r&rr&&(o=o.add(s)),s=s.double(),e>>=rr,r>>=rr;return{p1:i,p2:o}}function Oo(n,t,e,r){kc(e,n),vc(r,t);const s=e.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,u=vo(BigInt(s));let p=1;u>12?p=u-3:u>4?p=u-2:u>0&&(p=2);const v=zr(p),B=new Array(Number(v)+1).fill(o),P=Math.floor((t.BITS-1)/p)*p;let _=o;for(let S=P;S>=0;S-=p){B.fill(o);for(let M=0;M<i;M++){const N=r[M],F=Number(N>>BigInt(S)&v);B[F]=B[F].add(e[M])}let T=o;for(let M=B.length-1,N=o;M>0;M--)N=N.add(B[M]),T=T.add(N);if(_=_.add(T),S!==0)for(let M=0;M<p;M++)_=_.double()}return _}function ks(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return mc(t),t}else return cr(n,{isLE:e})}function No(n,t,e={},r){if(r===void 0&&(r=n==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const p of["p","n","h"]){const v=t[p];if(!(typeof v=="bigint"&&v>kr))throw new Error(`CURVE.${p} must be positive bigint`)}const s=ks(t.p,e.Fp,r),i=ks(t.n,e.Fn,r),u=["Gx","Gy","a",n==="weierstrass"?"b":"d"];for(const p of u)if(!s.isValid(t[p]))throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:s,Fn:i}}const Ze=BigInt(0),ce=BigInt(1),Qn=BigInt(2),xc=BigInt(8);function Ec(n,t,e,r){const s=n.sqr(e),i=n.sqr(r),o=n.add(n.mul(t.a,s),i),u=n.add(n.ONE,n.mul(t.d,n.mul(s,i)));return n.eql(o,u)}function Ic(n,t={}){const e=No("edwards",n,t,t.FpFnLE),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o}=i;Kr(t,{},{uvRatio:"function"});const u=Qn<<BigInt(s.BYTES*8)-ce,p=N=>r.create(N),v=t.uvRatio||((N,F)=>{try{return{isValid:!0,value:r.sqrt(r.div(N,F))}}catch{return{isValid:!1,value:Ze}}});if(!Ec(r,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function B(N,F,H=!1){const $=H?ce:Ze;return xi("coordinate "+N,F,$,u),F}function P(N){if(!(N instanceof T))throw new Error("ExtendedPoint expected")}const _=on((N,F)=>{const{X:H,Y:$,Z:Y}=N,X=N.is0();F==null&&(F=X?xc:r.inv(Y));const Q=p(H*F),ct=p($*F),ot=r.mul(Y,F);if(X)return{x:Ze,y:ce};if(ot!==ce)throw new Error("invZ was invalid");return{x:Q,y:ct}}),S=on(N=>{const{a:F,d:H}=i;if(N.is0())throw new Error("bad point: ZERO");const{X:$,Y,Z:X,T:Q}=N,ct=p($*$),ot=p(Y*Y),C=p(X*X),U=p(C*C),D=p(ct*F),V=p(C*p(D+ot)),y=p(U+p(H*p(ct*ot)));if(V!==y)throw new Error("bad point: equation left != right (1)");const a=p($*Y),l=p(X*Q);if(a!==l)throw new Error("bad point: equation left != right (2)");return!0});class T{constructor(F,H,$,Y){this.X=B("x",F),this.Y=B("y",H),this.Z=B("z",$,!0),this.T=B("t",Y),Object.freeze(this)}static CURVE(){return i}static fromAffine(F){if(F instanceof T)throw new Error("extended point not allowed");const{x:H,y:$}=F||{};return B("x",H),B("y",$),new T(H,$,ce,p(H*$))}static fromBytes(F,H=!1){const $=r.BYTES,{a:Y,d:X}=i;F=gs(_e(F,$,"point")),ar(H,"zip215");const Q=gs(F),ct=F[$-1];Q[$-1]=ct&-129;const ot=Ur(Q),C=H?u:r.ORDER;xi("point.y",ot,Ze,C);const U=p(ot*ot),D=p(U-ce),V=p(X*U-Y);let{isValid:y,value:a}=v(D,V);if(!y)throw new Error("bad point: invalid y coordinate");const l=(a&ce)===ce,g=(ct&128)!==0;if(!H&&a===Ze&&g)throw new Error("bad point: x=0 and x_0=1");return g!==l&&(a=p(-a)),T.fromAffine({x:a,y:ot})}static fromHex(F,H=!1){return T.fromBytes(Dt("point",F),H)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(F=8,H=!0){return M.createCache(this,F),H||this.multiply(Qn),this}assertValidity(){S(this)}equals(F){P(F);const{X:H,Y:$,Z:Y}=this,{X,Y:Q,Z:ct}=F,ot=p(H*ct),C=p(X*Y),U=p($*ct),D=p(Q*Y);return ot===C&&U===D}is0(){return this.equals(T.ZERO)}negate(){return new T(p(-this.X),this.Y,this.Z,p(-this.T))}double(){const{a:F}=i,{X:H,Y:$,Z:Y}=this,X=p(H*H),Q=p($*$),ct=p(Qn*p(Y*Y)),ot=p(F*X),C=H+$,U=p(p(C*C)-X-Q),D=ot+Q,V=D-ct,y=ot-Q,a=p(U*V),l=p(D*y),g=p(U*y),k=p(V*D);return new T(a,l,k,g)}add(F){P(F);const{a:H,d:$}=i,{X:Y,Y:X,Z:Q,T:ct}=this,{X:ot,Y:C,Z:U,T:D}=F,V=p(Y*ot),y=p(X*C),a=p(ct*$*D),l=p(Q*U),g=p((Y+X)*(ot+C)-V-y),k=l-a,E=l+a,A=p(y-H*V),L=p(g*k),b=p(E*A),c=p(g*A),f=p(k*E);return new T(L,b,f,c)}subtract(F){return this.add(F.negate())}multiply(F){if(!s.isValidNot0(F))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:H,f:$}=M.cached(this,F,Y=>nr(T,Y));return nr(T,[H,$])[0]}multiplyUnsafe(F,H=T.ZERO){if(!s.isValid(F))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return F===Ze?T.ZERO:this.is0()||F===ce?this:M.unsafe(this,F,$=>nr(T,$),H)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return M.unsafe(this,i.n).is0()}toAffine(F){return _(this,F)}clearCofactor(){return o===ce?this:this.multiplyUnsafe(o)}toBytes(){const{x:F,y:H}=this.toAffine(),$=r.toBytes(H);return $[$.length-1]|=F&ce?128:0,$}toHex(){return sr(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(F){return nr(T,F)}static msm(F,H){return Oo(T,s,F,H)}_setWindowSize(F){this.precompute(F)}toRawBytes(){return this.toBytes()}}T.BASE=new T(i.Gx,i.Gy,ce,p(i.Gx*i.Gy)),T.ZERO=new T(Ze,ce,ce,Ze),T.Fp=r,T.Fn=s;const M=new Uo(T,s.BITS);return T.BASE.precompute(8),T}function Ac(n,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');Kr(e,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:r}=e,{BASE:s,Fp:i,Fn:o}=n,u=e.randomBytes||Li,p=e.adjustScalarBytes||(C=>C),v=e.domain||((C,U,D)=>{if(ar(D,"phflag"),U.length||D)throw new Error("Contexts/pre-hash are not supported");return C});function B(C){return o.create(Ur(C))}function P(C){const U=$.secretKey;C=Dt("private key",C,U);const D=Dt("hashed private key",t(C),2*U),V=p(D.slice(0,U)),y=D.slice(U,2*U),a=B(V);return{head:V,prefix:y,scalar:a}}function _(C){const{head:U,prefix:D,scalar:V}=P(C),y=s.multiply(V),a=y.toBytes();return{head:U,prefix:D,scalar:V,point:y,pointBytes:a}}function S(C){return _(C).pointBytes}function T(C=Uint8Array.of(),...U){const D=Me(...U);return B(t(v(D,Dt("context",C),!!r)))}function M(C,U,D={}){C=Dt("message",C),r&&(C=r(C));const{prefix:V,scalar:y,pointBytes:a}=_(U),l=T(D.context,V,C),g=s.multiply(l).toBytes(),k=T(D.context,g,a,C),E=o.create(l+k*y);if(!o.isValid(E))throw new Error("sign failed: invalid s");const A=Me(g,o.toBytes(E));return _e(A,$.signature,"result")}const N={zip215:!0};function F(C,U,D,V=N){const{context:y,zip215:a}=V,l=$.signature;C=Dt("signature",C,l),U=Dt("message",U),D=Dt("publicKey",D,$.publicKey),a!==void 0&&ar(a,"zip215"),r&&(U=r(U));const g=l/2,k=C.subarray(0,g),E=Ur(C.subarray(g,l));let A,L,b;try{A=n.fromBytes(D,a),L=n.fromBytes(k,a),b=s.multiplyUnsafe(E)}catch{return!1}if(!a&&A.isSmallOrder())return!1;const c=T(y,L.toBytes(),A.toBytes(),U);return L.add(A.multiplyUnsafe(c)).subtract(b).clearCofactor().is0()}const H=i.BYTES,$={secretKey:H,publicKey:H,signature:2*H,seed:H};function Y(C=u($.seed)){return _e(C,$.seed,"seed")}function X(C){const U=ot.randomSecretKey(C);return{secretKey:U,publicKey:S(U)}}function Q(C){return Fr(C)&&C.length===o.BYTES}function ct(C,U){try{return!!n.fromBytes(C,U)}catch{return!1}}const ot={getExtendedPublicKey:_,randomSecretKey:Y,isValidSecretKey:Q,isValidPublicKey:ct,toMontgomery(C){const{y:U}=n.fromBytes(C),D=$.publicKey,V=D===32;if(!V&&D!==57)throw new Error("only defined for 25519 and 448");const y=V?i.div(ce+U,ce-U):i.div(U-ce,U+ce);return i.toBytes(y)},toMontgomerySecret(C){const U=$.secretKey;_e(C,U);const D=t(C.subarray(0,U));return p(D).subarray(0,U)},randomPrivateKey:Y,precompute(C=8,U=n.BASE){return U.precompute(C,!1)}};return Object.freeze({keygen:X,getPublicKey:S,sign:M,verify:F,utils:ot,Point:n,lengths:$})}function _c(n){const t={a:n.a,d:n.d,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e=n.Fp,r=cr(t.n,n.nBitLength,!0),s={Fp:e,Fn:r,uvRatio:n.uvRatio},i={randomBytes:n.randomBytes,adjustScalarBytes:n.adjustScalarBytes,domain:n.domain,prehash:n.prehash,mapToCurve:n.mapToCurve};return{CURVE:t,curveOpts:s,hash:n.hash,eddsaOpts:i}}function Bc(n,t){const e=t.Point;return Object.assign({},t,{ExtendedPoint:e,CURVE:n,nBitLength:e.Fn.BITS,nByteLength:e.Fn.BYTES})}function Rc(n){const{CURVE:t,curveOpts:e,hash:r,eddsaOpts:s}=_c(n),i=Ic(t,e),o=Ac(i,r,s);return Bc(n,o)}const Mc=BigInt(1),vs=BigInt(2);BigInt(3);const Tc=BigInt(5),Pc=BigInt(8),Ni=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Fo={p:Ni,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Pc,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Lc(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),s=BigInt(80),i=Ni,u=n*n%i*n%i,p=qt(u,vs,i)*u%i,v=qt(p,Mc,i)*n%i,B=qt(v,Tc,i)*v%i,P=qt(B,t,i)*B%i,_=qt(P,e,i)*P%i,S=qt(_,r,i)*_%i,T=qt(S,s,i)*S%i,M=qt(T,s,i)*S%i,N=qt(M,t,i)*B%i;return{pow_p_5_8:qt(N,vs,i)*n%i,b2:u}}function Cc(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const Ss=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Uc(n,t){const e=Ni,r=ae(t*t*t,e),s=ae(r*r*t,e),i=Lc(n*s).pow_p_5_8;let o=ae(n*r*i,e);const u=ae(t*o*o,e),p=o,v=ae(o*Ss,e),B=u===n,P=u===ae(-n,e),_=u===ae(-n*Ss,e);return B&&(o=p),(P||_)&&(o=v),gc(o,e)&&(o=ae(-o,e)),{isValid:B||P,value:o}}const Oc=cr(Fo.p,{isLE:!0}),Nc={...Fo,Fp:Oc,hash:ac,adjustScalarBytes:Cc,uvRatio:Uc},Ir=Rc(Nc);var rn={exports:{}},Fc=rn.exports,xs;function zo(){return xs||(xs=1,(function(n){(function(t,e){function r(y,a){if(!y)throw new Error(a||"Assertion failed")}function s(y,a){y.super_=a;var l=function(){};l.prototype=a.prototype,y.prototype=new l,y.prototype.constructor=y}function i(y,a,l){if(i.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((a==="le"||a==="be")&&(l=a,a=10),this._init(y||0,a||10,l||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=La.Buffer}catch{}i.isBN=function(a){return a instanceof i?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===i.wordSize&&Array.isArray(a.words)},i.max=function(a,l){return a.cmp(l)>0?a:l},i.min=function(a,l){return a.cmp(l)<0?a:l},i.prototype._init=function(a,l,g){if(typeof a=="number")return this._initNumber(a,l,g);if(typeof a=="object")return this._initArray(a,l,g);l==="hex"&&(l=16),r(l===(l|0)&&l>=2&&l<=36),a=a.toString().replace(/\s+/g,"");var k=0;a[0]==="-"&&(k++,this.negative=1),k<a.length&&(l===16?this._parseHex(a,k,g):(this._parseBase(a,l,k),g==="le"&&this._initArray(this.toArray(),l,g)))},i.prototype._initNumber=function(a,l,g){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(r(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),g==="le"&&this._initArray(this.toArray(),l,g)},i.prototype._initArray=function(a,l,g){if(r(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var k=0;k<this.length;k++)this.words[k]=0;var E,A,L=0;if(g==="be")for(k=a.length-1,E=0;k>=0;k-=3)A=a[k]|a[k-1]<<8|a[k-2]<<16,this.words[E]|=A<<L&67108863,this.words[E+1]=A>>>26-L&67108863,L+=24,L>=26&&(L-=26,E++);else if(g==="le")for(k=0,E=0;k<a.length;k+=3)A=a[k]|a[k+1]<<8|a[k+2]<<16,this.words[E]|=A<<L&67108863,this.words[E+1]=A>>>26-L&67108863,L+=24,L>=26&&(L-=26,E++);return this._strip()};function u(y,a){var l=y.charCodeAt(a);if(l>=48&&l<=57)return l-48;if(l>=65&&l<=70)return l-55;if(l>=97&&l<=102)return l-87;r(!1,"Invalid character in "+y)}function p(y,a,l){var g=u(y,l);return l-1>=a&&(g|=u(y,l-1)<<4),g}i.prototype._parseHex=function(a,l,g){this.length=Math.ceil((a.length-l)/6),this.words=new Array(this.length);for(var k=0;k<this.length;k++)this.words[k]=0;var E=0,A=0,L;if(g==="be")for(k=a.length-1;k>=l;k-=2)L=p(a,l,k)<<E,this.words[A]|=L&67108863,E>=18?(E-=18,A+=1,this.words[A]|=L>>>26):E+=8;else{var b=a.length-l;for(k=b%2===0?l+1:l;k<a.length;k+=2)L=p(a,l,k)<<E,this.words[A]|=L&67108863,E>=18?(E-=18,A+=1,this.words[A]|=L>>>26):E+=8}this._strip()};function v(y,a,l,g){for(var k=0,E=0,A=Math.min(y.length,l),L=a;L<A;L++){var b=y.charCodeAt(L)-48;k*=g,b>=49?E=b-49+10:b>=17?E=b-17+10:E=b,r(b>=0&&E<g,"Invalid character"),k+=E}return k}i.prototype._parseBase=function(a,l,g){this.words=[0],this.length=1;for(var k=0,E=1;E<=67108863;E*=l)k++;k--,E=E/l|0;for(var A=a.length-g,L=A%k,b=Math.min(A,A-L)+g,c=0,f=g;f<b;f+=k)c=v(a,f,f+k,l),this.imuln(E),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(L!==0){var w=1;for(c=v(a,f,a.length,l),f=0;f<L;f++)w*=l;this.imuln(w),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(a){a.words=new Array(this.length);for(var l=0;l<this.length;l++)a.words[l]=this.words[l];a.length=this.length,a.negative=this.negative,a.red=this.red};function B(y,a){y.words=a.words,y.length=a.length,y.negative=a.negative,y.red=a.red}if(i.prototype._move=function(a){B(a,this)},i.prototype.clone=function(){var a=new i(null);return this.copy(a),a},i.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=P}catch{i.prototype.inspect=P}else i.prototype.inspect=P;function P(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],T=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(a,l){a=a||10,l=l|0||1;var g;if(a===16||a==="hex"){g="";for(var k=0,E=0,A=0;A<this.length;A++){var L=this.words[A],b=((L<<k|E)&16777215).toString(16);E=L>>>24-k&16777215,k+=2,k>=26&&(k-=26,A--),E!==0||A!==this.length-1?g=_[6-b.length]+b+g:g=b+g}for(E!==0&&(g=E.toString(16)+g);g.length%l!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(a===(a|0)&&a>=2&&a<=36){var c=S[a],f=T[a];g="";var w=this.clone();for(w.negative=0;!w.isZero();){var I=w.modrn(f).toString(a);w=w.idivn(f),w.isZero()?g=I+g:g=_[c-I.length]+I+g}for(this.isZero()&&(g="0"+g);g.length%l!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(a,l){return this.toArrayLike(o,a,l)}),i.prototype.toArray=function(a,l){return this.toArrayLike(Array,a,l)};var M=function(a,l){return a.allocUnsafe?a.allocUnsafe(l):new a(l)};i.prototype.toArrayLike=function(a,l,g){this._strip();var k=this.byteLength(),E=g||Math.max(1,k);r(k<=E,"byte array longer than desired length"),r(E>0,"Requested array length <= 0");var A=M(a,E),L=l==="le"?"LE":"BE";return this["_toArrayLike"+L](A,k),A},i.prototype._toArrayLikeLE=function(a,l){for(var g=0,k=0,E=0,A=0;E<this.length;E++){var L=this.words[E]<<A|k;a[g++]=L&255,g<a.length&&(a[g++]=L>>8&255),g<a.length&&(a[g++]=L>>16&255),A===6?(g<a.length&&(a[g++]=L>>24&255),k=0,A=0):(k=L>>>24,A+=2)}if(g<a.length)for(a[g++]=k;g<a.length;)a[g++]=0},i.prototype._toArrayLikeBE=function(a,l){for(var g=a.length-1,k=0,E=0,A=0;E<this.length;E++){var L=this.words[E]<<A|k;a[g--]=L&255,g>=0&&(a[g--]=L>>8&255),g>=0&&(a[g--]=L>>16&255),A===6?(g>=0&&(a[g--]=L>>24&255),k=0,A=0):(k=L>>>24,A+=2)}if(g>=0)for(a[g--]=k;g>=0;)a[g--]=0},Math.clz32?i.prototype._countBits=function(a){return 32-Math.clz32(a)}:i.prototype._countBits=function(a){var l=a,g=0;return l>=4096&&(g+=13,l>>>=13),l>=64&&(g+=7,l>>>=7),l>=8&&(g+=4,l>>>=4),l>=2&&(g+=2,l>>>=2),g+l},i.prototype._zeroBits=function(a){if(a===0)return 26;var l=a,g=0;return(l&8191)===0&&(g+=13,l>>>=13),(l&127)===0&&(g+=7,l>>>=7),(l&15)===0&&(g+=4,l>>>=4),(l&3)===0&&(g+=2,l>>>=2),(l&1)===0&&g++,g},i.prototype.bitLength=function(){var a=this.words[this.length-1],l=this._countBits(a);return(this.length-1)*26+l};function N(y){for(var a=new Array(y.bitLength()),l=0;l<a.length;l++){var g=l/26|0,k=l%26;a[l]=y.words[g]>>>k&1}return a}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,l=0;l<this.length;l++){var g=this._zeroBits(this.words[l]);if(a+=g,g!==26)break}return a},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},i.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var l=0;l<a.length;l++)this.words[l]=this.words[l]|a.words[l];return this._strip()},i.prototype.ior=function(a){return r((this.negative|a.negative)===0),this.iuor(a)},i.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},i.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},i.prototype.iuand=function(a){var l;this.length>a.length?l=a:l=this;for(var g=0;g<l.length;g++)this.words[g]=this.words[g]&a.words[g];return this.length=l.length,this._strip()},i.prototype.iand=function(a){return r((this.negative|a.negative)===0),this.iuand(a)},i.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},i.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},i.prototype.iuxor=function(a){var l,g;this.length>a.length?(l=this,g=a):(l=a,g=this);for(var k=0;k<g.length;k++)this.words[k]=l.words[k]^g.words[k];if(this!==l)for(;k<l.length;k++)this.words[k]=l.words[k];return this.length=l.length,this._strip()},i.prototype.ixor=function(a){return r((this.negative|a.negative)===0),this.iuxor(a)},i.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},i.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},i.prototype.inotn=function(a){r(typeof a=="number"&&a>=0);var l=Math.ceil(a/26)|0,g=a%26;this._expand(l),g>0&&l--;for(var k=0;k<l;k++)this.words[k]=~this.words[k]&67108863;return g>0&&(this.words[k]=~this.words[k]&67108863>>26-g),this._strip()},i.prototype.notn=function(a){return this.clone().inotn(a)},i.prototype.setn=function(a,l){r(typeof a=="number"&&a>=0);var g=a/26|0,k=a%26;return this._expand(g+1),l?this.words[g]=this.words[g]|1<<k:this.words[g]=this.words[g]&~(1<<k),this._strip()},i.prototype.iadd=function(a){var l;if(this.negative!==0&&a.negative===0)return this.negative=0,l=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,l=this.isub(a),a.negative=1,l._normSign();var g,k;this.length>a.length?(g=this,k=a):(g=a,k=this);for(var E=0,A=0;A<k.length;A++)l=(g.words[A]|0)+(k.words[A]|0)+E,this.words[A]=l&67108863,E=l>>>26;for(;E!==0&&A<g.length;A++)l=(g.words[A]|0)+E,this.words[A]=l&67108863,E=l>>>26;if(this.length=g.length,E!==0)this.words[this.length]=E,this.length++;else if(g!==this)for(;A<g.length;A++)this.words[A]=g.words[A];return this},i.prototype.add=function(a){var l;return a.negative!==0&&this.negative===0?(a.negative=0,l=this.sub(a),a.negative^=1,l):a.negative===0&&this.negative!==0?(this.negative=0,l=a.sub(this),this.negative=1,l):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},i.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var l=this.iadd(a);return a.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var g=this.cmp(a);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var k,E;g>0?(k=this,E=a):(k=a,E=this);for(var A=0,L=0;L<E.length;L++)l=(k.words[L]|0)-(E.words[L]|0)+A,A=l>>26,this.words[L]=l&67108863;for(;A!==0&&L<k.length;L++)l=(k.words[L]|0)+A,A=l>>26,this.words[L]=l&67108863;if(A===0&&L<k.length&&k!==this)for(;L<k.length;L++)this.words[L]=k.words[L];return this.length=Math.max(this.length,L),k!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(a){return this.clone().isub(a)};function F(y,a,l){l.negative=a.negative^y.negative;var g=y.length+a.length|0;l.length=g,g=g-1|0;var k=y.words[0]|0,E=a.words[0]|0,A=k*E,L=A&67108863,b=A/67108864|0;l.words[0]=L;for(var c=1;c<g;c++){for(var f=b>>>26,w=b&67108863,I=Math.min(c,a.length-1),z=Math.max(0,c-y.length+1);z<=I;z++){var j=c-z|0;k=y.words[j]|0,E=a.words[z]|0,A=k*E+w,f+=A/67108864|0,w=A&67108863}l.words[c]=w|0,b=f|0}return b!==0?l.words[c]=b|0:l.length--,l._strip()}var H=function(a,l,g){var k=a.words,E=l.words,A=g.words,L=0,b,c,f,w=k[0]|0,I=w&8191,z=w>>>13,j=k[1]|0,rt=j&8191,st=j>>>13,kt=k[2]|0,vt=kt&8191,It=kt>>>13,Ie=k[3]|0,At=Ie&8191,Nt=Ie>>>13,Vr=k[4]|0,Pt=Vr&8191,Ft=Vr>>>13,Hr=k[5]|0,Ct=Hr&8191,Rt=Hr>>>13,xe=k[6]|0,Lt=xe&8191,zt=xe>>>13,Ae=k[7]|0,Kt=Ae&8191,m=Ae>>>13,h=k[8]|0,d=h&8191,x=h>>>13,O=k[9]|0,K=O&8191,G=O>>>13,pt=E[0]|0,dt=pt&8191,lt=pt>>>13,Mt=E[1]|0,ht=Mt&8191,$t=Mt>>>13,Qi=E[2]|0,Vt=Qi&8191,Ht=Qi>>>13,ts=E[3]|0,Gt=ts&8191,jt=ts>>>13,es=E[4]|0,Zt=es&8191,Yt=es>>>13,rs=E[5]|0,Xt=rs&8191,Jt=rs>>>13,ns=E[6]|0,Qt=ns&8191,te=ns>>>13,is=E[7]|0,ee=is&8191,re=is>>>13,ss=E[8]|0,ne=ss&8191,ie=ss>>>13,os=E[9]|0,se=os&8191,oe=os>>>13;g.negative=a.negative^l.negative,g.length=19,b=Math.imul(I,dt),c=Math.imul(I,lt),c=c+Math.imul(z,dt)|0,f=Math.imul(z,lt);var Bn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,b=Math.imul(rt,dt),c=Math.imul(rt,lt),c=c+Math.imul(st,dt)|0,f=Math.imul(st,lt),b=b+Math.imul(I,ht)|0,c=c+Math.imul(I,$t)|0,c=c+Math.imul(z,ht)|0,f=f+Math.imul(z,$t)|0;var Rn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,b=Math.imul(vt,dt),c=Math.imul(vt,lt),c=c+Math.imul(It,dt)|0,f=Math.imul(It,lt),b=b+Math.imul(rt,ht)|0,c=c+Math.imul(rt,$t)|0,c=c+Math.imul(st,ht)|0,f=f+Math.imul(st,$t)|0,b=b+Math.imul(I,Vt)|0,c=c+Math.imul(I,Ht)|0,c=c+Math.imul(z,Vt)|0,f=f+Math.imul(z,Ht)|0;var Mn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Mn>>>26)|0,Mn&=67108863,b=Math.imul(At,dt),c=Math.imul(At,lt),c=c+Math.imul(Nt,dt)|0,f=Math.imul(Nt,lt),b=b+Math.imul(vt,ht)|0,c=c+Math.imul(vt,$t)|0,c=c+Math.imul(It,ht)|0,f=f+Math.imul(It,$t)|0,b=b+Math.imul(rt,Vt)|0,c=c+Math.imul(rt,Ht)|0,c=c+Math.imul(st,Vt)|0,f=f+Math.imul(st,Ht)|0,b=b+Math.imul(I,Gt)|0,c=c+Math.imul(I,jt)|0,c=c+Math.imul(z,Gt)|0,f=f+Math.imul(z,jt)|0;var Tn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,b=Math.imul(Pt,dt),c=Math.imul(Pt,lt),c=c+Math.imul(Ft,dt)|0,f=Math.imul(Ft,lt),b=b+Math.imul(At,ht)|0,c=c+Math.imul(At,$t)|0,c=c+Math.imul(Nt,ht)|0,f=f+Math.imul(Nt,$t)|0,b=b+Math.imul(vt,Vt)|0,c=c+Math.imul(vt,Ht)|0,c=c+Math.imul(It,Vt)|0,f=f+Math.imul(It,Ht)|0,b=b+Math.imul(rt,Gt)|0,c=c+Math.imul(rt,jt)|0,c=c+Math.imul(st,Gt)|0,f=f+Math.imul(st,jt)|0,b=b+Math.imul(I,Zt)|0,c=c+Math.imul(I,Yt)|0,c=c+Math.imul(z,Zt)|0,f=f+Math.imul(z,Yt)|0;var Pn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,b=Math.imul(Ct,dt),c=Math.imul(Ct,lt),c=c+Math.imul(Rt,dt)|0,f=Math.imul(Rt,lt),b=b+Math.imul(Pt,ht)|0,c=c+Math.imul(Pt,$t)|0,c=c+Math.imul(Ft,ht)|0,f=f+Math.imul(Ft,$t)|0,b=b+Math.imul(At,Vt)|0,c=c+Math.imul(At,Ht)|0,c=c+Math.imul(Nt,Vt)|0,f=f+Math.imul(Nt,Ht)|0,b=b+Math.imul(vt,Gt)|0,c=c+Math.imul(vt,jt)|0,c=c+Math.imul(It,Gt)|0,f=f+Math.imul(It,jt)|0,b=b+Math.imul(rt,Zt)|0,c=c+Math.imul(rt,Yt)|0,c=c+Math.imul(st,Zt)|0,f=f+Math.imul(st,Yt)|0,b=b+Math.imul(I,Xt)|0,c=c+Math.imul(I,Jt)|0,c=c+Math.imul(z,Xt)|0,f=f+Math.imul(z,Jt)|0;var Ln=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,b=Math.imul(Lt,dt),c=Math.imul(Lt,lt),c=c+Math.imul(zt,dt)|0,f=Math.imul(zt,lt),b=b+Math.imul(Ct,ht)|0,c=c+Math.imul(Ct,$t)|0,c=c+Math.imul(Rt,ht)|0,f=f+Math.imul(Rt,$t)|0,b=b+Math.imul(Pt,Vt)|0,c=c+Math.imul(Pt,Ht)|0,c=c+Math.imul(Ft,Vt)|0,f=f+Math.imul(Ft,Ht)|0,b=b+Math.imul(At,Gt)|0,c=c+Math.imul(At,jt)|0,c=c+Math.imul(Nt,Gt)|0,f=f+Math.imul(Nt,jt)|0,b=b+Math.imul(vt,Zt)|0,c=c+Math.imul(vt,Yt)|0,c=c+Math.imul(It,Zt)|0,f=f+Math.imul(It,Yt)|0,b=b+Math.imul(rt,Xt)|0,c=c+Math.imul(rt,Jt)|0,c=c+Math.imul(st,Xt)|0,f=f+Math.imul(st,Jt)|0,b=b+Math.imul(I,Qt)|0,c=c+Math.imul(I,te)|0,c=c+Math.imul(z,Qt)|0,f=f+Math.imul(z,te)|0;var Cn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,b=Math.imul(Kt,dt),c=Math.imul(Kt,lt),c=c+Math.imul(m,dt)|0,f=Math.imul(m,lt),b=b+Math.imul(Lt,ht)|0,c=c+Math.imul(Lt,$t)|0,c=c+Math.imul(zt,ht)|0,f=f+Math.imul(zt,$t)|0,b=b+Math.imul(Ct,Vt)|0,c=c+Math.imul(Ct,Ht)|0,c=c+Math.imul(Rt,Vt)|0,f=f+Math.imul(Rt,Ht)|0,b=b+Math.imul(Pt,Gt)|0,c=c+Math.imul(Pt,jt)|0,c=c+Math.imul(Ft,Gt)|0,f=f+Math.imul(Ft,jt)|0,b=b+Math.imul(At,Zt)|0,c=c+Math.imul(At,Yt)|0,c=c+Math.imul(Nt,Zt)|0,f=f+Math.imul(Nt,Yt)|0,b=b+Math.imul(vt,Xt)|0,c=c+Math.imul(vt,Jt)|0,c=c+Math.imul(It,Xt)|0,f=f+Math.imul(It,Jt)|0,b=b+Math.imul(rt,Qt)|0,c=c+Math.imul(rt,te)|0,c=c+Math.imul(st,Qt)|0,f=f+Math.imul(st,te)|0,b=b+Math.imul(I,ee)|0,c=c+Math.imul(I,re)|0,c=c+Math.imul(z,ee)|0,f=f+Math.imul(z,re)|0;var Un=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Un>>>26)|0,Un&=67108863,b=Math.imul(d,dt),c=Math.imul(d,lt),c=c+Math.imul(x,dt)|0,f=Math.imul(x,lt),b=b+Math.imul(Kt,ht)|0,c=c+Math.imul(Kt,$t)|0,c=c+Math.imul(m,ht)|0,f=f+Math.imul(m,$t)|0,b=b+Math.imul(Lt,Vt)|0,c=c+Math.imul(Lt,Ht)|0,c=c+Math.imul(zt,Vt)|0,f=f+Math.imul(zt,Ht)|0,b=b+Math.imul(Ct,Gt)|0,c=c+Math.imul(Ct,jt)|0,c=c+Math.imul(Rt,Gt)|0,f=f+Math.imul(Rt,jt)|0,b=b+Math.imul(Pt,Zt)|0,c=c+Math.imul(Pt,Yt)|0,c=c+Math.imul(Ft,Zt)|0,f=f+Math.imul(Ft,Yt)|0,b=b+Math.imul(At,Xt)|0,c=c+Math.imul(At,Jt)|0,c=c+Math.imul(Nt,Xt)|0,f=f+Math.imul(Nt,Jt)|0,b=b+Math.imul(vt,Qt)|0,c=c+Math.imul(vt,te)|0,c=c+Math.imul(It,Qt)|0,f=f+Math.imul(It,te)|0,b=b+Math.imul(rt,ee)|0,c=c+Math.imul(rt,re)|0,c=c+Math.imul(st,ee)|0,f=f+Math.imul(st,re)|0,b=b+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,c=c+Math.imul(z,ne)|0,f=f+Math.imul(z,ie)|0;var On=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(On>>>26)|0,On&=67108863,b=Math.imul(K,dt),c=Math.imul(K,lt),c=c+Math.imul(G,dt)|0,f=Math.imul(G,lt),b=b+Math.imul(d,ht)|0,c=c+Math.imul(d,$t)|0,c=c+Math.imul(x,ht)|0,f=f+Math.imul(x,$t)|0,b=b+Math.imul(Kt,Vt)|0,c=c+Math.imul(Kt,Ht)|0,c=c+Math.imul(m,Vt)|0,f=f+Math.imul(m,Ht)|0,b=b+Math.imul(Lt,Gt)|0,c=c+Math.imul(Lt,jt)|0,c=c+Math.imul(zt,Gt)|0,f=f+Math.imul(zt,jt)|0,b=b+Math.imul(Ct,Zt)|0,c=c+Math.imul(Ct,Yt)|0,c=c+Math.imul(Rt,Zt)|0,f=f+Math.imul(Rt,Yt)|0,b=b+Math.imul(Pt,Xt)|0,c=c+Math.imul(Pt,Jt)|0,c=c+Math.imul(Ft,Xt)|0,f=f+Math.imul(Ft,Jt)|0,b=b+Math.imul(At,Qt)|0,c=c+Math.imul(At,te)|0,c=c+Math.imul(Nt,Qt)|0,f=f+Math.imul(Nt,te)|0,b=b+Math.imul(vt,ee)|0,c=c+Math.imul(vt,re)|0,c=c+Math.imul(It,ee)|0,f=f+Math.imul(It,re)|0,b=b+Math.imul(rt,ne)|0,c=c+Math.imul(rt,ie)|0,c=c+Math.imul(st,ne)|0,f=f+Math.imul(st,ie)|0,b=b+Math.imul(I,se)|0,c=c+Math.imul(I,oe)|0,c=c+Math.imul(z,se)|0,f=f+Math.imul(z,oe)|0;var Nn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,b=Math.imul(K,ht),c=Math.imul(K,$t),c=c+Math.imul(G,ht)|0,f=Math.imul(G,$t),b=b+Math.imul(d,Vt)|0,c=c+Math.imul(d,Ht)|0,c=c+Math.imul(x,Vt)|0,f=f+Math.imul(x,Ht)|0,b=b+Math.imul(Kt,Gt)|0,c=c+Math.imul(Kt,jt)|0,c=c+Math.imul(m,Gt)|0,f=f+Math.imul(m,jt)|0,b=b+Math.imul(Lt,Zt)|0,c=c+Math.imul(Lt,Yt)|0,c=c+Math.imul(zt,Zt)|0,f=f+Math.imul(zt,Yt)|0,b=b+Math.imul(Ct,Xt)|0,c=c+Math.imul(Ct,Jt)|0,c=c+Math.imul(Rt,Xt)|0,f=f+Math.imul(Rt,Jt)|0,b=b+Math.imul(Pt,Qt)|0,c=c+Math.imul(Pt,te)|0,c=c+Math.imul(Ft,Qt)|0,f=f+Math.imul(Ft,te)|0,b=b+Math.imul(At,ee)|0,c=c+Math.imul(At,re)|0,c=c+Math.imul(Nt,ee)|0,f=f+Math.imul(Nt,re)|0,b=b+Math.imul(vt,ne)|0,c=c+Math.imul(vt,ie)|0,c=c+Math.imul(It,ne)|0,f=f+Math.imul(It,ie)|0,b=b+Math.imul(rt,se)|0,c=c+Math.imul(rt,oe)|0,c=c+Math.imul(st,se)|0,f=f+Math.imul(st,oe)|0;var Fn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,b=Math.imul(K,Vt),c=Math.imul(K,Ht),c=c+Math.imul(G,Vt)|0,f=Math.imul(G,Ht),b=b+Math.imul(d,Gt)|0,c=c+Math.imul(d,jt)|0,c=c+Math.imul(x,Gt)|0,f=f+Math.imul(x,jt)|0,b=b+Math.imul(Kt,Zt)|0,c=c+Math.imul(Kt,Yt)|0,c=c+Math.imul(m,Zt)|0,f=f+Math.imul(m,Yt)|0,b=b+Math.imul(Lt,Xt)|0,c=c+Math.imul(Lt,Jt)|0,c=c+Math.imul(zt,Xt)|0,f=f+Math.imul(zt,Jt)|0,b=b+Math.imul(Ct,Qt)|0,c=c+Math.imul(Ct,te)|0,c=c+Math.imul(Rt,Qt)|0,f=f+Math.imul(Rt,te)|0,b=b+Math.imul(Pt,ee)|0,c=c+Math.imul(Pt,re)|0,c=c+Math.imul(Ft,ee)|0,f=f+Math.imul(Ft,re)|0,b=b+Math.imul(At,ne)|0,c=c+Math.imul(At,ie)|0,c=c+Math.imul(Nt,ne)|0,f=f+Math.imul(Nt,ie)|0,b=b+Math.imul(vt,se)|0,c=c+Math.imul(vt,oe)|0,c=c+Math.imul(It,se)|0,f=f+Math.imul(It,oe)|0;var zn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(zn>>>26)|0,zn&=67108863,b=Math.imul(K,Gt),c=Math.imul(K,jt),c=c+Math.imul(G,Gt)|0,f=Math.imul(G,jt),b=b+Math.imul(d,Zt)|0,c=c+Math.imul(d,Yt)|0,c=c+Math.imul(x,Zt)|0,f=f+Math.imul(x,Yt)|0,b=b+Math.imul(Kt,Xt)|0,c=c+Math.imul(Kt,Jt)|0,c=c+Math.imul(m,Xt)|0,f=f+Math.imul(m,Jt)|0,b=b+Math.imul(Lt,Qt)|0,c=c+Math.imul(Lt,te)|0,c=c+Math.imul(zt,Qt)|0,f=f+Math.imul(zt,te)|0,b=b+Math.imul(Ct,ee)|0,c=c+Math.imul(Ct,re)|0,c=c+Math.imul(Rt,ee)|0,f=f+Math.imul(Rt,re)|0,b=b+Math.imul(Pt,ne)|0,c=c+Math.imul(Pt,ie)|0,c=c+Math.imul(Ft,ne)|0,f=f+Math.imul(Ft,ie)|0,b=b+Math.imul(At,se)|0,c=c+Math.imul(At,oe)|0,c=c+Math.imul(Nt,se)|0,f=f+Math.imul(Nt,oe)|0;var Kn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,b=Math.imul(K,Zt),c=Math.imul(K,Yt),c=c+Math.imul(G,Zt)|0,f=Math.imul(G,Yt),b=b+Math.imul(d,Xt)|0,c=c+Math.imul(d,Jt)|0,c=c+Math.imul(x,Xt)|0,f=f+Math.imul(x,Jt)|0,b=b+Math.imul(Kt,Qt)|0,c=c+Math.imul(Kt,te)|0,c=c+Math.imul(m,Qt)|0,f=f+Math.imul(m,te)|0,b=b+Math.imul(Lt,ee)|0,c=c+Math.imul(Lt,re)|0,c=c+Math.imul(zt,ee)|0,f=f+Math.imul(zt,re)|0,b=b+Math.imul(Ct,ne)|0,c=c+Math.imul(Ct,ie)|0,c=c+Math.imul(Rt,ne)|0,f=f+Math.imul(Rt,ie)|0,b=b+Math.imul(Pt,se)|0,c=c+Math.imul(Pt,oe)|0,c=c+Math.imul(Ft,se)|0,f=f+Math.imul(Ft,oe)|0;var qn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(qn>>>26)|0,qn&=67108863,b=Math.imul(K,Xt),c=Math.imul(K,Jt),c=c+Math.imul(G,Xt)|0,f=Math.imul(G,Jt),b=b+Math.imul(d,Qt)|0,c=c+Math.imul(d,te)|0,c=c+Math.imul(x,Qt)|0,f=f+Math.imul(x,te)|0,b=b+Math.imul(Kt,ee)|0,c=c+Math.imul(Kt,re)|0,c=c+Math.imul(m,ee)|0,f=f+Math.imul(m,re)|0,b=b+Math.imul(Lt,ne)|0,c=c+Math.imul(Lt,ie)|0,c=c+Math.imul(zt,ne)|0,f=f+Math.imul(zt,ie)|0,b=b+Math.imul(Ct,se)|0,c=c+Math.imul(Ct,oe)|0,c=c+Math.imul(Rt,se)|0,f=f+Math.imul(Rt,oe)|0;var Dn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,b=Math.imul(K,Qt),c=Math.imul(K,te),c=c+Math.imul(G,Qt)|0,f=Math.imul(G,te),b=b+Math.imul(d,ee)|0,c=c+Math.imul(d,re)|0,c=c+Math.imul(x,ee)|0,f=f+Math.imul(x,re)|0,b=b+Math.imul(Kt,ne)|0,c=c+Math.imul(Kt,ie)|0,c=c+Math.imul(m,ne)|0,f=f+Math.imul(m,ie)|0,b=b+Math.imul(Lt,se)|0,c=c+Math.imul(Lt,oe)|0,c=c+Math.imul(zt,se)|0,f=f+Math.imul(zt,oe)|0;var Wn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,b=Math.imul(K,ee),c=Math.imul(K,re),c=c+Math.imul(G,ee)|0,f=Math.imul(G,re),b=b+Math.imul(d,ne)|0,c=c+Math.imul(d,ie)|0,c=c+Math.imul(x,ne)|0,f=f+Math.imul(x,ie)|0,b=b+Math.imul(Kt,se)|0,c=c+Math.imul(Kt,oe)|0,c=c+Math.imul(m,se)|0,f=f+Math.imul(m,oe)|0;var $n=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+($n>>>26)|0,$n&=67108863,b=Math.imul(K,ne),c=Math.imul(K,ie),c=c+Math.imul(G,ne)|0,f=Math.imul(G,ie),b=b+Math.imul(d,se)|0,c=c+Math.imul(d,oe)|0,c=c+Math.imul(x,se)|0,f=f+Math.imul(x,oe)|0;var Vn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,b=Math.imul(K,se),c=Math.imul(K,oe),c=c+Math.imul(G,se)|0,f=Math.imul(G,oe);var Hn=(L+b|0)+((c&8191)<<13)|0;return L=(f+(c>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,A[0]=Bn,A[1]=Rn,A[2]=Mn,A[3]=Tn,A[4]=Pn,A[5]=Ln,A[6]=Cn,A[7]=Un,A[8]=On,A[9]=Nn,A[10]=Fn,A[11]=zn,A[12]=Kn,A[13]=qn,A[14]=Dn,A[15]=Wn,A[16]=$n,A[17]=Vn,A[18]=Hn,L!==0&&(A[19]=L,g.length++),g};Math.imul||(H=F);function $(y,a,l){l.negative=a.negative^y.negative,l.length=y.length+a.length;for(var g=0,k=0,E=0;E<l.length-1;E++){var A=k;k=0;for(var L=g&67108863,b=Math.min(E,a.length-1),c=Math.max(0,E-y.length+1);c<=b;c++){var f=E-c,w=y.words[f]|0,I=a.words[c]|0,z=w*I,j=z&67108863;A=A+(z/67108864|0)|0,j=j+L|0,L=j&67108863,A=A+(j>>>26)|0,k+=A>>>26,A&=67108863}l.words[E]=L,g=A,A=k}return g!==0?l.words[E]=g:l.length--,l._strip()}function Y(y,a,l){return $(y,a,l)}i.prototype.mulTo=function(a,l){var g,k=this.length+a.length;return this.length===10&&a.length===10?g=H(this,a,l):k<63?g=F(this,a,l):k<1024?g=$(this,a,l):g=Y(this,a,l),g},i.prototype.mul=function(a){var l=new i(null);return l.words=new Array(this.length+a.length),this.mulTo(a,l)},i.prototype.mulf=function(a){var l=new i(null);return l.words=new Array(this.length+a.length),Y(this,a,l)},i.prototype.imul=function(a){return this.clone().mulTo(a,this)},i.prototype.imuln=function(a){var l=a<0;l&&(a=-a),r(typeof a=="number"),r(a<67108864);for(var g=0,k=0;k<this.length;k++){var E=(this.words[k]|0)*a,A=(E&67108863)+(g&67108863);g>>=26,g+=E/67108864|0,g+=A>>>26,this.words[k]=A&67108863}return g!==0&&(this.words[k]=g,this.length++),this.length=a===0?1:this.length,l?this.ineg():this},i.prototype.muln=function(a){return this.clone().imuln(a)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(a){var l=N(a);if(l.length===0)return new i(1);for(var g=this,k=0;k<l.length&&l[k]===0;k++,g=g.sqr());if(++k<l.length)for(var E=g.sqr();k<l.length;k++,E=E.sqr())l[k]!==0&&(g=g.mul(E));return g},i.prototype.iushln=function(a){r(typeof a=="number"&&a>=0);var l=a%26,g=(a-l)/26,k=67108863>>>26-l<<26-l,E;if(l!==0){var A=0;for(E=0;E<this.length;E++){var L=this.words[E]&k,b=(this.words[E]|0)-L<<l;this.words[E]=b|A,A=L>>>26-l}A&&(this.words[E]=A,this.length++)}if(g!==0){for(E=this.length-1;E>=0;E--)this.words[E+g]=this.words[E];for(E=0;E<g;E++)this.words[E]=0;this.length+=g}return this._strip()},i.prototype.ishln=function(a){return r(this.negative===0),this.iushln(a)},i.prototype.iushrn=function(a,l,g){r(typeof a=="number"&&a>=0);var k;l?k=(l-l%26)/26:k=0;var E=a%26,A=Math.min((a-E)/26,this.length),L=67108863^67108863>>>E<<E,b=g;if(k-=A,k=Math.max(0,k),b){for(var c=0;c<A;c++)b.words[c]=this.words[c];b.length=A}if(A!==0)if(this.length>A)for(this.length-=A,c=0;c<this.length;c++)this.words[c]=this.words[c+A];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(f!==0||c>=k);c--){var w=this.words[c]|0;this.words[c]=f<<26-E|w>>>E,f=w&L}return b&&f!==0&&(b.words[b.length++]=f),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(a,l,g){return r(this.negative===0),this.iushrn(a,l,g)},i.prototype.shln=function(a){return this.clone().ishln(a)},i.prototype.ushln=function(a){return this.clone().iushln(a)},i.prototype.shrn=function(a){return this.clone().ishrn(a)},i.prototype.ushrn=function(a){return this.clone().iushrn(a)},i.prototype.testn=function(a){r(typeof a=="number"&&a>=0);var l=a%26,g=(a-l)/26,k=1<<l;if(this.length<=g)return!1;var E=this.words[g];return!!(E&k)},i.prototype.imaskn=function(a){r(typeof a=="number"&&a>=0);var l=a%26,g=(a-l)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(l!==0&&g++,this.length=Math.min(g,this.length),l!==0){var k=67108863^67108863>>>l<<l;this.words[this.length-1]&=k}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(a){return this.clone().imaskn(a)},i.prototype.iaddn=function(a){return r(typeof a=="number"),r(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},i.prototype._iaddn=function(a){this.words[0]+=a;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},i.prototype.isubn=function(a){if(r(typeof a=="number"),r(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this._strip()},i.prototype.addn=function(a){return this.clone().iaddn(a)},i.prototype.subn=function(a){return this.clone().isubn(a)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(a,l,g){var k=a.length+g,E;this._expand(k);var A,L=0;for(E=0;E<a.length;E++){A=(this.words[E+g]|0)+L;var b=(a.words[E]|0)*l;A-=b&67108863,L=(A>>26)-(b/67108864|0),this.words[E+g]=A&67108863}for(;E<this.length-g;E++)A=(this.words[E+g]|0)+L,L=A>>26,this.words[E+g]=A&67108863;if(L===0)return this._strip();for(r(L===-1),L=0,E=0;E<this.length;E++)A=-(this.words[E]|0)+L,L=A>>26,this.words[E]=A&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(a,l){var g=this.length-a.length,k=this.clone(),E=a,A=E.words[E.length-1]|0,L=this._countBits(A);g=26-L,g!==0&&(E=E.ushln(g),k.iushln(g),A=E.words[E.length-1]|0);var b=k.length-E.length,c;if(l!=="mod"){c=new i(null),c.length=b+1,c.words=new Array(c.length);for(var f=0;f<c.length;f++)c.words[f]=0}var w=k.clone()._ishlnsubmul(E,1,b);w.negative===0&&(k=w,c&&(c.words[b]=1));for(var I=b-1;I>=0;I--){var z=(k.words[E.length+I]|0)*67108864+(k.words[E.length+I-1]|0);for(z=Math.min(z/A|0,67108863),k._ishlnsubmul(E,z,I);k.negative!==0;)z--,k.negative=0,k._ishlnsubmul(E,1,I),k.isZero()||(k.negative^=1);c&&(c.words[I]=z)}return c&&c._strip(),k._strip(),l!=="div"&&g!==0&&k.iushrn(g),{div:c||null,mod:k}},i.prototype.divmod=function(a,l,g){if(r(!a.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var k,E,A;return this.negative!==0&&a.negative===0?(A=this.neg().divmod(a,l),l!=="mod"&&(k=A.div.neg()),l!=="div"&&(E=A.mod.neg(),g&&E.negative!==0&&E.iadd(a)),{div:k,mod:E}):this.negative===0&&a.negative!==0?(A=this.divmod(a.neg(),l),l!=="mod"&&(k=A.div.neg()),{div:k,mod:A.mod}):(this.negative&a.negative)!==0?(A=this.neg().divmod(a.neg(),l),l!=="div"&&(E=A.mod.neg(),g&&E.negative!==0&&E.isub(a)),{div:A.div,mod:E}):a.length>this.length||this.cmp(a)<0?{div:new i(0),mod:this}:a.length===1?l==="div"?{div:this.divn(a.words[0]),mod:null}:l==="mod"?{div:null,mod:new i(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new i(this.modrn(a.words[0]))}:this._wordDiv(a,l)},i.prototype.div=function(a){return this.divmod(a,"div",!1).div},i.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},i.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},i.prototype.divRound=function(a){var l=this.divmod(a);if(l.mod.isZero())return l.div;var g=l.div.negative!==0?l.mod.isub(a):l.mod,k=a.ushrn(1),E=a.andln(1),A=g.cmp(k);return A<0||E===1&&A===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},i.prototype.modrn=function(a){var l=a<0;l&&(a=-a),r(a<=67108863);for(var g=(1<<26)%a,k=0,E=this.length-1;E>=0;E--)k=(g*k+(this.words[E]|0))%a;return l?-k:k},i.prototype.modn=function(a){return this.modrn(a)},i.prototype.idivn=function(a){var l=a<0;l&&(a=-a),r(a<=67108863);for(var g=0,k=this.length-1;k>=0;k--){var E=(this.words[k]|0)+g*67108864;this.words[k]=E/a|0,g=E%a}return this._strip(),l?this.ineg():this},i.prototype.divn=function(a){return this.clone().idivn(a)},i.prototype.egcd=function(a){r(a.negative===0),r(!a.isZero());var l=this,g=a.clone();l.negative!==0?l=l.umod(a):l=l.clone();for(var k=new i(1),E=new i(0),A=new i(0),L=new i(1),b=0;l.isEven()&&g.isEven();)l.iushrn(1),g.iushrn(1),++b;for(var c=g.clone(),f=l.clone();!l.isZero();){for(var w=0,I=1;(l.words[0]&I)===0&&w<26;++w,I<<=1);if(w>0)for(l.iushrn(w);w-- >0;)(k.isOdd()||E.isOdd())&&(k.iadd(c),E.isub(f)),k.iushrn(1),E.iushrn(1);for(var z=0,j=1;(g.words[0]&j)===0&&z<26;++z,j<<=1);if(z>0)for(g.iushrn(z);z-- >0;)(A.isOdd()||L.isOdd())&&(A.iadd(c),L.isub(f)),A.iushrn(1),L.iushrn(1);l.cmp(g)>=0?(l.isub(g),k.isub(A),E.isub(L)):(g.isub(l),A.isub(k),L.isub(E))}return{a:A,b:L,gcd:g.iushln(b)}},i.prototype._invmp=function(a){r(a.negative===0),r(!a.isZero());var l=this,g=a.clone();l.negative!==0?l=l.umod(a):l=l.clone();for(var k=new i(1),E=new i(0),A=g.clone();l.cmpn(1)>0&&g.cmpn(1)>0;){for(var L=0,b=1;(l.words[0]&b)===0&&L<26;++L,b<<=1);if(L>0)for(l.iushrn(L);L-- >0;)k.isOdd()&&k.iadd(A),k.iushrn(1);for(var c=0,f=1;(g.words[0]&f)===0&&c<26;++c,f<<=1);if(c>0)for(g.iushrn(c);c-- >0;)E.isOdd()&&E.iadd(A),E.iushrn(1);l.cmp(g)>=0?(l.isub(g),k.isub(E)):(g.isub(l),E.isub(k))}var w;return l.cmpn(1)===0?w=k:w=E,w.cmpn(0)<0&&w.iadd(a),w},i.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var l=this.clone(),g=a.clone();l.negative=0,g.negative=0;for(var k=0;l.isEven()&&g.isEven();k++)l.iushrn(1),g.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;g.isEven();)g.iushrn(1);var E=l.cmp(g);if(E<0){var A=l;l=g,g=A}else if(E===0||g.cmpn(1)===0)break;l.isub(g)}while(!0);return g.iushln(k)},i.prototype.invm=function(a){return this.egcd(a).a.umod(a)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(a){return this.words[0]&a},i.prototype.bincn=function(a){r(typeof a=="number");var l=a%26,g=(a-l)/26,k=1<<l;if(this.length<=g)return this._expand(g+1),this.words[g]|=k,this;for(var E=k,A=g;E!==0&&A<this.length;A++){var L=this.words[A]|0;L+=E,E=L>>>26,L&=67108863,this.words[A]=L}return E!==0&&(this.words[A]=E,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(a){var l=a<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this._strip();var g;if(this.length>1)g=1;else{l&&(a=-a),r(a<=67108863,"Number is too big");var k=this.words[0]|0;g=k===a?0:k<a?-1:1}return this.negative!==0?-g|0:g},i.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var l=this.ucmp(a);return this.negative!==0?-l|0:l},i.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var l=0,g=this.length-1;g>=0;g--){var k=this.words[g]|0,E=a.words[g]|0;if(k!==E){k<E?l=-1:k>E&&(l=1);break}}return l},i.prototype.gtn=function(a){return this.cmpn(a)===1},i.prototype.gt=function(a){return this.cmp(a)===1},i.prototype.gten=function(a){return this.cmpn(a)>=0},i.prototype.gte=function(a){return this.cmp(a)>=0},i.prototype.ltn=function(a){return this.cmpn(a)===-1},i.prototype.lt=function(a){return this.cmp(a)===-1},i.prototype.lten=function(a){return this.cmpn(a)<=0},i.prototype.lte=function(a){return this.cmp(a)<=0},i.prototype.eqn=function(a){return this.cmpn(a)===0},i.prototype.eq=function(a){return this.cmp(a)===0},i.red=function(a){return new D(a)},i.prototype.toRed=function(a){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(a){return this.red=a,this},i.prototype.forceRed=function(a){return r(!this.red,"Already a number in reduction context"),this._forceRed(a)},i.prototype.redAdd=function(a){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},i.prototype.redIAdd=function(a){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},i.prototype.redSub=function(a){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},i.prototype.redISub=function(a){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},i.prototype.redShl=function(a){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},i.prototype.redMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},i.prototype.redIMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(a){return r(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var X={k256:null,p224:null,p192:null,p25519:null};function Q(y,a){this.name=y,this.p=new i(a,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Q.prototype._tmp=function(){var a=new i(null);return a.words=new Array(Math.ceil(this.n/13)),a},Q.prototype.ireduce=function(a){var l=a,g;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),g=l.bitLength();while(g>this.n);var k=g<this.n?-1:l.ucmp(this.p);return k===0?(l.words[0]=0,l.length=1):k>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Q.prototype.split=function(a,l){a.iushrn(this.n,0,l)},Q.prototype.imulK=function(a){return a.imul(this.k)};function ct(){Q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(ct,Q),ct.prototype.split=function(a,l){for(var g=4194303,k=Math.min(a.length,9),E=0;E<k;E++)l.words[E]=a.words[E];if(l.length=k,a.length<=9){a.words[0]=0,a.length=1;return}var A=a.words[9];for(l.words[l.length++]=A&g,E=10;E<a.length;E++){var L=a.words[E]|0;a.words[E-10]=(L&g)<<4|A>>>22,A=L}A>>>=22,a.words[E-10]=A,A===0&&a.length>10?a.length-=10:a.length-=9},ct.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var l=0,g=0;g<a.length;g++){var k=a.words[g]|0;l+=k*977,a.words[g]=l&67108863,l=k*64+(l/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function ot(){Q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ot,Q);function C(){Q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(C,Q);function U(){Q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(U,Q),U.prototype.imulK=function(a){for(var l=0,g=0;g<a.length;g++){var k=(a.words[g]|0)*19+l,E=k&67108863;k>>>=26,a.words[g]=E,l=k}return l!==0&&(a.words[a.length++]=l),a},i._prime=function(a){if(X[a])return X[a];var l;if(a==="k256")l=new ct;else if(a==="p224")l=new ot;else if(a==="p192")l=new C;else if(a==="p25519")l=new U;else throw new Error("Unknown prime "+a);return X[a]=l,l};function D(y){if(typeof y=="string"){var a=i._prime(y);this.m=a.p,this.prime=a}else r(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}D.prototype._verify1=function(a){r(a.negative===0,"red works only with positives"),r(a.red,"red works only with red numbers")},D.prototype._verify2=function(a,l){r((a.negative|l.negative)===0,"red works only with positives"),r(a.red&&a.red===l.red,"red works only with red numbers")},D.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(B(a,a.umod(this.m)._forceRed(this)),a)},D.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},D.prototype.add=function(a,l){this._verify2(a,l);var g=a.add(l);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},D.prototype.iadd=function(a,l){this._verify2(a,l);var g=a.iadd(l);return g.cmp(this.m)>=0&&g.isub(this.m),g},D.prototype.sub=function(a,l){this._verify2(a,l);var g=a.sub(l);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},D.prototype.isub=function(a,l){this._verify2(a,l);var g=a.isub(l);return g.cmpn(0)<0&&g.iadd(this.m),g},D.prototype.shl=function(a,l){return this._verify1(a),this.imod(a.ushln(l))},D.prototype.imul=function(a,l){return this._verify2(a,l),this.imod(a.imul(l))},D.prototype.mul=function(a,l){return this._verify2(a,l),this.imod(a.mul(l))},D.prototype.isqr=function(a){return this.imul(a,a.clone())},D.prototype.sqr=function(a){return this.mul(a,a)},D.prototype.sqrt=function(a){if(a.isZero())return a.clone();var l=this.m.andln(3);if(r(l%2===1),l===3){var g=this.m.add(new i(1)).iushrn(2);return this.pow(a,g)}for(var k=this.m.subn(1),E=0;!k.isZero()&&k.andln(1)===0;)E++,k.iushrn(1);r(!k.isZero());var A=new i(1).toRed(this),L=A.redNeg(),b=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);this.pow(c,b).cmp(L)!==0;)c.redIAdd(L);for(var f=this.pow(c,k),w=this.pow(a,k.addn(1).iushrn(1)),I=this.pow(a,k),z=E;I.cmp(A)!==0;){for(var j=I,rt=0;j.cmp(A)!==0;rt++)j=j.redSqr();r(rt<z);var st=this.pow(f,new i(1).iushln(z-rt-1));w=w.redMul(st),f=st.redSqr(),I=I.redMul(f),z=rt}return w},D.prototype.invm=function(a){var l=a._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},D.prototype.pow=function(a,l){if(l.isZero())return new i(1).toRed(this);if(l.cmpn(1)===0)return a.clone();var g=4,k=new Array(1<<g);k[0]=new i(1).toRed(this),k[1]=a;for(var E=2;E<k.length;E++)k[E]=this.mul(k[E-1],a);var A=k[0],L=0,b=0,c=l.bitLength()%26;for(c===0&&(c=26),E=l.length-1;E>=0;E--){for(var f=l.words[E],w=c-1;w>=0;w--){var I=f>>w&1;if(A!==k[0]&&(A=this.sqr(A)),I===0&&L===0){b=0;continue}L<<=1,L|=I,b++,!(b!==g&&(E!==0||w!==0))&&(A=this.mul(A,k[L]),b=0,L=0)}c=26}return A},D.prototype.convertTo=function(a){var l=a.umod(this.m);return l===a?l.clone():l},D.prototype.convertFrom=function(a){var l=a.clone();return l.red=null,l},i.mont=function(a){return new V(a)};function V(y){D.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(V,D),V.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},V.prototype.convertFrom=function(a){var l=this.imod(a.mul(this.rinv));return l.red=null,l},V.prototype.imul=function(a,l){if(a.isZero()||l.isZero())return a.words[0]=0,a.length=1,a;var g=a.imul(l),k=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=g.isub(k).iushrn(this.shift),A=E;return E.cmp(this.m)>=0?A=E.isub(this.m):E.cmpn(0)<0&&(A=E.iadd(this.m)),A._forceRed(this)},V.prototype.mul=function(a,l){if(a.isZero()||l.isZero())return new i(0)._forceRed(this);var g=a.mul(l),k=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=g.isub(k).iushrn(this.shift),A=E;return E.cmp(this.m)>=0?A=E.isub(this.m):E.cmpn(0)<0&&(A=E.iadd(this.m)),A._forceRed(this)},V.prototype.invm=function(a){var l=this.imod(a._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(n,Fc)})(rn)),rn.exports}var zc=zo();const Es=Ri(zc);var Jr={exports:{}};var Is;function Ko(){return Is||(Is=1,(function(n,t){var e=Mi(),r=e.Buffer;function s(o,u){for(var p in o)u[p]=o[p]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?n.exports=e:(s(e,t),t.Buffer=i);function i(o,u,p){return r(o,u,p)}i.prototype=Object.create(r.prototype),s(r,i),i.from=function(o,u,p){if(typeof o=="number")throw new TypeError("Argument must not be a number");return r(o,u,p)},i.alloc=function(o,u,p){if(typeof o!="number")throw new TypeError("Argument must be a number");var v=r(o);return u!==void 0?typeof p=="string"?v.fill(u,p):v.fill(u):v.fill(0),v},i.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r(o)},i.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(o)}})(Jr,Jr.exports)),Jr.exports}var ti,As;function Kc(){if(As)return ti;As=1;var n=Ko().Buffer;function t(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),s=0;s<r.length;s++)r[s]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),u=o.charCodeAt(0);if(r[u]!==255)throw new TypeError(o+" is ambiguous");r[u]=i}var p=e.length,v=e.charAt(0),B=Math.log(p)/Math.log(256),P=Math.log(256)/Math.log(p);function _(M){if((Array.isArray(M)||M instanceof Uint8Array)&&(M=n.from(M)),!n.isBuffer(M))throw new TypeError("Expected Buffer");if(M.length===0)return"";for(var N=0,F=0,H=0,$=M.length;H!==$&&M[H]===0;)H++,N++;for(var Y=($-H)*P+1>>>0,X=new Uint8Array(Y);H!==$;){for(var Q=M[H],ct=0,ot=Y-1;(Q!==0||ct<F)&&ot!==-1;ot--,ct++)Q+=256*X[ot]>>>0,X[ot]=Q%p>>>0,Q=Q/p>>>0;if(Q!==0)throw new Error("Non-zero carry");F=ct,H++}for(var C=Y-F;C!==Y&&X[C]===0;)C++;for(var U=v.repeat(N);C<Y;++C)U+=e.charAt(X[C]);return U}function S(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return n.alloc(0);for(var N=0,F=0,H=0;M[N]===v;)F++,N++;for(var $=(M.length-N)*B+1>>>0,Y=new Uint8Array($);N<M.length;){var X=M.charCodeAt(N);if(X>255)return;var Q=r[X];if(Q===255)return;for(var ct=0,ot=$-1;(Q!==0||ct<H)&&ot!==-1;ot--,ct++)Q+=p*Y[ot]>>>0,Y[ot]=Q%256>>>0,Q=Q/256>>>0;if(Q!==0)throw new Error("Non-zero carry");H=ct,N++}for(var C=$-H;C!==$&&Y[C]===0;)C++;var U=n.allocUnsafe(F+($-C));U.fill(0,0,F);for(var D=F;C!==$;)U[D++]=Y[C++];return U}function T(M){var N=S(M);if(N)return N;throw new Error("Non-base"+p+" character")}return{encode:_,decodeUnsafe:S,decode:T}}return ti=t,ti}var ei,_s;function qc(){if(_s)return ei;_s=1;var n=Kc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ei=n(t),ei}var Dc=qc();const he=Ri(Dc),Bs=wo;var Et={},ri,Rs;function Wc(){if(Rs)return ri;Rs=1;var n=Ko().Buffer;function t(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),s=0;s<r.length;s++)r[s]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),u=o.charCodeAt(0);if(r[u]!==255)throw new TypeError(o+" is ambiguous");r[u]=i}var p=e.length,v=e.charAt(0),B=Math.log(p)/Math.log(256),P=Math.log(256)/Math.log(p);function _(M){if((Array.isArray(M)||M instanceof Uint8Array)&&(M=n.from(M)),!n.isBuffer(M))throw new TypeError("Expected Buffer");if(M.length===0)return"";for(var N=0,F=0,H=0,$=M.length;H!==$&&M[H]===0;)H++,N++;for(var Y=($-H)*P+1>>>0,X=new Uint8Array(Y);H!==$;){for(var Q=M[H],ct=0,ot=Y-1;(Q!==0||ct<F)&&ot!==-1;ot--,ct++)Q+=256*X[ot]>>>0,X[ot]=Q%p>>>0,Q=Q/p>>>0;if(Q!==0)throw new Error("Non-zero carry");F=ct,H++}for(var C=Y-F;C!==Y&&X[C]===0;)C++;for(var U=v.repeat(N);C<Y;++C)U+=e.charAt(X[C]);return U}function S(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return n.alloc(0);for(var N=0,F=0,H=0;M[N]===v;)F++,N++;for(var $=(M.length-N)*B+1>>>0,Y=new Uint8Array($);N<M.length;){var X=M.charCodeAt(N);if(X>255)return;var Q=r[X];if(Q===255)return;for(var ct=0,ot=$-1;(Q!==0||ct<H)&&ot!==-1;ot--,ct++)Q+=p*Y[ot]>>>0,Y[ot]=Q%256>>>0,Q=Q/256>>>0;if(Q!==0)throw new Error("Non-zero carry");H=ct,N++}for(var C=$-H;C!==$&&Y[C]===0;)C++;var U=n.allocUnsafe(F+($-C));U.fill(0,0,F);for(var D=F;C!==$;)U[D++]=Y[C++];return U}function T(M){var N=S(M);if(N)return N;throw new Error("Non-base"+p+" character")}return{encode:_,decodeUnsafe:S,decode:T}}return ri=t,ri}var ni,Ms;function $c(){if(Ms)return ni;Ms=1;var n=Wc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ni=n(t),ni}function Ke(n,t,e){return t<=n&&n<=e}function kn(n){if(n===void 0)return{};if(n===Object(n))return n;throw TypeError("Could not convert argument to dictionary")}function Vc(n){for(var t=String(n),e=t.length,r=0,s=[];r<e;){var i=t.charCodeAt(r);if(i<55296||i>57343)s.push(i);else if(56320<=i&&i<=57343)s.push(65533);else if(55296<=i&&i<=56319)if(r===e-1)s.push(65533);else{var o=n.charCodeAt(r+1);if(56320<=o&&o<=57343){var u=i&1023,p=o&1023;s.push(65536+(u<<10)+p),r+=1}else s.push(65533)}r+=1}return s}function Hc(n){for(var t="",e=0;e<n.length;++e){var r=n[e];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return t}var cn=-1;function Fi(n){this.tokens=[].slice.call(n)}Fi.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():cn},prepend:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(n)},push:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.push(t.shift());else this.tokens.push(n)}};var vr=-1;function ii(n,t){if(n)throw TypeError("Decoder error");return t||65533}var un="utf-8";function fn(n,t){if(!(this instanceof fn))return new fn(n,t);if(n=n!==void 0?String(n).toLowerCase():un,n!==un)throw new Error("Encoding not supported. Only utf-8 is supported");t=kn(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}fn.prototype={decode:function(t,e){var r;typeof t=="object"&&t instanceof ArrayBuffer?r=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):r=new Uint8Array(0),e=kn(e),this._streaming||(this._decoder=new Gc({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var s=new Fi(r),i=[],o;!s.endOfStream()&&(o=this._decoder.handler(s,s.read()),o!==vr);)o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o));if(!this._streaming){do{if(o=this._decoder.handler(s,s.read()),o===vr)break;o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o))}while(!s.endOfStream());this._decoder=null}return i.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0),Hc(i)}};function hn(n,t){if(!(this instanceof hn))return new hn(n,t);if(n=n!==void 0?String(n).toLowerCase():un,n!==un)throw new Error("Encoding not supported. Only utf-8 is supported");t=kn(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}hn.prototype={encode:function(t,e){t=t?String(t):"",e=kn(e),this._streaming||(this._encoder=new jc(this._options)),this._streaming=!!e.stream;for(var r=[],s=new Fi(Vc(t)),i;!s.endOfStream()&&(i=this._encoder.handler(s,s.read()),i!==vr);)Array.isArray(i)?r.push.apply(r,i):r.push(i);if(!this._streaming){for(;i=this._encoder.handler(s,s.read()),i!==vr;)Array.isArray(i)?r.push.apply(r,i):r.push(i);this._encoder=null}return new Uint8Array(r)}};function Gc(n){var t=n.fatal,e=0,r=0,s=0,i=128,o=191;this.handler=function(u,p){if(p===cn&&s!==0)return s=0,ii(t);if(p===cn)return vr;if(s===0){if(Ke(p,0,127))return p;if(Ke(p,194,223))s=1,e=p-192;else if(Ke(p,224,239))p===224&&(i=160),p===237&&(o=159),s=2,e=p-224;else if(Ke(p,240,244))p===240&&(i=144),p===244&&(o=143),s=3,e=p-240;else return ii(t);return e=e<<6*s,null}if(!Ke(p,i,o))return e=s=r=0,i=128,o=191,u.prepend(p),ii(t);if(i=128,o=191,r+=1,e+=p-128<<6*(s-r),r!==s)return null;var v=e;return e=s=r=0,v}}function jc(n){n.fatal,this.handler=function(t,e){if(e===cn)return vr;if(Ke(e,0,127))return e;var r,s;Ke(e,128,2047)?(r=1,s=192):Ke(e,2048,65535)?(r=2,s=224):Ke(e,65536,1114111)&&(r=3,s=240);for(var i=[(e>>6*r)+s];r>0;){var o=e>>6*(r-1);i.push(128|o&63),r-=1}return i}}const Zc=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:fn,TextEncoder:hn},Symbol.toStringTag,{value:"Module"})),Yc=uo(Zc);var Ts;function Xc(){if(Ts)return Et;Ts=1;var n=Et&&Et.__createBinding||(Object.create?(function(C,U,D,V){V===void 0&&(V=D),Object.defineProperty(C,V,{enumerable:!0,get:function(){return U[D]}})}):(function(C,U,D,V){V===void 0&&(V=D),C[V]=U[D]})),t=Et&&Et.__setModuleDefault||(Object.create?(function(C,U){Object.defineProperty(C,"default",{enumerable:!0,value:U})}):function(C,U){C.default=U}),e=Et&&Et.__decorate||function(C,U,D,V){var y=arguments.length,a=y<3?U:V===null?V=Object.getOwnPropertyDescriptor(U,D):V,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(C,U,D,V);else for(var g=C.length-1;g>=0;g--)(l=C[g])&&(a=(y<3?l(a):y>3?l(U,D,a):l(U,D))||a);return y>3&&a&&Object.defineProperty(U,D,a),a},r=Et&&Et.__importStar||function(C){if(C&&C.__esModule)return C;var U={};if(C!=null)for(var D in C)D!=="default"&&Object.hasOwnProperty.call(C,D)&&n(U,C,D);return t(U,C),U},s=Et&&Et.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(Et,"__esModule",{value:!0}),Et.deserializeUnchecked=Et.deserialize=Et.serialize=Et.BinaryReader=Et.BinaryWriter=Et.BorshError=Et.baseDecode=Et.baseEncode=void 0;const i=s(zo()),o=s($c()),u=r(Yc),p=typeof TextDecoder!="function"?u.TextDecoder:TextDecoder,v=new p("utf-8",{fatal:!0});function B(C){return typeof C=="string"&&(C=Buffer.from(C,"utf8")),o.default.encode(Buffer.from(C))}Et.baseEncode=B;function P(C){return Buffer.from(o.default.decode(C))}Et.baseDecode=P;const _=1024;class S extends Error{constructor(U){super(U),this.fieldPath=[],this.originalMessage=U}addToFieldPath(U){this.fieldPath.splice(0,0,U),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Et.BorshError=S;class T{constructor(){this.buf=Buffer.alloc(_),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(_)]))}writeU8(U){this.maybeResize(),this.buf.writeUInt8(U,this.length),this.length+=1}writeU16(U){this.maybeResize(),this.buf.writeUInt16LE(U,this.length),this.length+=2}writeU32(U){this.maybeResize(),this.buf.writeUInt32LE(U,this.length),this.length+=4}writeU64(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",8)))}writeU128(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",16)))}writeU256(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",32)))}writeU512(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",64)))}writeBuffer(U){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),U,Buffer.alloc(_)]),this.length+=U.length}writeString(U){this.maybeResize();const D=Buffer.from(U,"utf8");this.writeU32(D.length),this.writeBuffer(D)}writeFixedArray(U){this.writeBuffer(Buffer.from(U))}writeArray(U,D){this.maybeResize(),this.writeU32(U.length);for(const V of U)this.maybeResize(),D(V)}toArray(){return this.buf.subarray(0,this.length)}}Et.BinaryWriter=T;function M(C,U,D){const V=D.value;D.value=function(...y){try{return V.apply(this,y)}catch(a){if(a instanceof RangeError){const l=a.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(l)>=0)throw new S("Reached the end of buffer when deserializing")}throw a}}}class N{constructor(U){this.buf=U,this.offset=0}readU8(){const U=this.buf.readUInt8(this.offset);return this.offset+=1,U}readU16(){const U=this.buf.readUInt16LE(this.offset);return this.offset+=2,U}readU32(){const U=this.buf.readUInt32LE(this.offset);return this.offset+=4,U}readU64(){const U=this.readBuffer(8);return new i.default(U,"le")}readU128(){const U=this.readBuffer(16);return new i.default(U,"le")}readU256(){const U=this.readBuffer(32);return new i.default(U,"le")}readU512(){const U=this.readBuffer(64);return new i.default(U,"le")}readBuffer(U){if(this.offset+U>this.buf.length)throw new S(`Expected buffer length ${U} isn't within bounds`);const D=this.buf.slice(this.offset,this.offset+U);return this.offset+=U,D}readString(){const U=this.readU32(),D=this.readBuffer(U);try{return v.decode(D)}catch(V){throw new S(`Error decoding UTF-8 string: ${V}`)}}readFixedArray(U){return new Uint8Array(this.readBuffer(U))}readArray(U){const D=this.readU32(),V=Array();for(let y=0;y<D;++y)V.push(U());return V}}e([M],N.prototype,"readU8",null),e([M],N.prototype,"readU16",null),e([M],N.prototype,"readU32",null),e([M],N.prototype,"readU64",null),e([M],N.prototype,"readU128",null),e([M],N.prototype,"readU256",null),e([M],N.prototype,"readU512",null),e([M],N.prototype,"readString",null),e([M],N.prototype,"readFixedArray",null),e([M],N.prototype,"readArray",null),Et.BinaryReader=N;function F(C){return C.charAt(0).toUpperCase()+C.slice(1)}function H(C,U,D,V,y){try{if(typeof V=="string")y[`write${F(V)}`](D);else if(V instanceof Array)if(typeof V[0]=="number"){if(D.length!==V[0])throw new S(`Expecting byte array of length ${V[0]}, but got ${D.length} bytes`);y.writeFixedArray(D)}else if(V.length===2&&typeof V[1]=="number"){if(D.length!==V[1])throw new S(`Expecting byte array of length ${V[1]}, but got ${D.length} bytes`);for(let a=0;a<V[1];a++)H(C,null,D[a],V[0],y)}else y.writeArray(D,a=>{H(C,U,a,V[0],y)});else if(V.kind!==void 0)switch(V.kind){case"option":{D==null?y.writeU8(0):(y.writeU8(1),H(C,U,D,V.type,y));break}case"map":{y.writeU32(D.size),D.forEach((a,l)=>{H(C,U,l,V.key,y),H(C,U,a,V.value,y)});break}default:throw new S(`FieldType ${V} unrecognized`)}else $(C,D,y)}catch(a){throw a instanceof S&&a.addToFieldPath(U),a}}function $(C,U,D){if(typeof U.borshSerialize=="function"){U.borshSerialize(D);return}const V=C.get(U.constructor);if(!V)throw new S(`Class ${U.constructor.name} is missing in schema`);if(V.kind==="struct")V.fields.map(([y,a])=>{H(C,y,U[y],a,D)});else if(V.kind==="enum"){const y=U[V.field];for(let a=0;a<V.values.length;++a){const[l,g]=V.values[a];if(l===y){D.writeU8(a),H(C,l,U[l],g,D);break}}}else throw new S(`Unexpected schema kind: ${V.kind} for ${U.constructor.name}`)}function Y(C,U,D=T){const V=new D;return $(C,U,V),V.toArray()}Et.serialize=Y;function X(C,U,D,V){try{if(typeof D=="string")return V[`read${F(D)}`]();if(D instanceof Array){if(typeof D[0]=="number")return V.readFixedArray(D[0]);if(typeof D[1]=="number"){const y=[];for(let a=0;a<D[1];a++)y.push(X(C,null,D[0],V));return y}else return V.readArray(()=>X(C,U,D[0],V))}if(D.kind==="option")return V.readU8()?X(C,U,D.type,V):void 0;if(D.kind==="map"){let y=new Map;const a=V.readU32();for(let l=0;l<a;l++){const g=X(C,U,D.key,V),k=X(C,U,D.value,V);y.set(g,k)}return y}return Q(C,D,V)}catch(y){throw y instanceof S&&y.addToFieldPath(U),y}}function Q(C,U,D){if(typeof U.borshDeserialize=="function")return U.borshDeserialize(D);const V=C.get(U);if(!V)throw new S(`Class ${U.name} is missing in schema`);if(V.kind==="struct"){const y={};for(const[a,l]of C.get(U).fields)y[a]=X(C,a,l,D);return new U(y)}if(V.kind==="enum"){const y=D.readU8();if(y>=V.values.length)throw new S(`Enum index: ${y} is out of range`);const[a,l]=V.values[y],g=X(C,a,l,D);return new U({[a]:g})}throw new S(`Unexpected schema kind: ${V.kind} for ${U.constructor.name}`)}function ct(C,U,D,V=N){const y=new V(D),a=Q(C,U,y);if(y.offset<D.length)throw new S(`Unexpected ${D.length-y.offset} bytes after deserialized data`);return a}Et.deserialize=ct;function ot(C,U,D,V=N){const y=new V(D);return Q(C,U,y)}return Et.deserializeUnchecked=ot,Et}var si=Xc(),W={},Ps;function Jc(){if(Ps)return W;Ps=1,Object.defineProperty(W,"__esModule",{value:!0}),W.s16=W.s8=W.nu64be=W.u48be=W.u40be=W.u32be=W.u24be=W.u16be=W.nu64=W.u48=W.u40=W.u32=W.u24=W.u16=W.u8=W.offset=W.greedy=W.Constant=W.UTF8=W.CString=W.Blob=W.Boolean=W.BitField=W.BitStructure=W.VariantLayout=W.Union=W.UnionLayoutDiscriminator=W.UnionDiscriminator=W.Structure=W.Sequence=W.DoubleBE=W.Double=W.FloatBE=W.Float=W.NearInt64BE=W.NearInt64=W.NearUInt64BE=W.NearUInt64=W.IntBE=W.Int=W.UIntBE=W.UInt=W.OffsetLayout=W.GreedyCount=W.ExternalLayout=W.bindConstructorLayout=W.nameWithProperty=W.Layout=W.uint8ArrayToBuffer=W.checkUint8Array=void 0,W.constant=W.utf8=W.cstr=W.blob=W.unionLayoutDiscriminator=W.union=W.seq=W.bits=W.struct=W.f64be=W.f64=W.f32be=W.f32=W.ns64be=W.s48be=W.s40be=W.s32be=W.s24be=W.s16be=W.ns64=W.s48=W.s40=W.s32=W.s24=void 0;const n=Mi();function t(c){if(!(c instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}W.checkUint8Array=t;function e(c){return t(c),n.Buffer.from(c.buffer,c.byteOffset,c.length)}W.uint8ArrayToBuffer=e;let r=class{constructor(f,w){if(!Number.isInteger(f))throw new TypeError("span must be an integer");this.span=f,this.property=w}makeDestinationObject(){return{}}getSpan(f,w){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(f){const w=Object.create(this.constructor.prototype);return Object.assign(w,this),w.property=f,w}fromArray(f){}};W.Layout=r;function s(c,f){return f.property?c+"["+f.property+"]":c}W.nameWithProperty=s;function i(c,f){if(typeof c!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(c,"layout_"))throw new Error("Class is already bound to a layout");if(!(f&&f instanceof r))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(f,"boundConstructor_"))throw new Error("layout is already bound to a constructor");c.layout_=f,f.boundConstructor_=c,f.makeDestinationObject=(()=>new c),Object.defineProperty(c.prototype,"encode",{value(w,I){return f.encode(this,w,I)},writable:!0}),Object.defineProperty(c,"decode",{value(w,I){return f.decode(w,I)},writable:!0})}W.bindConstructorLayout=i;class o extends r{isCount(){throw new Error("ExternalLayout is abstract")}}W.ExternalLayout=o;class u extends o{constructor(f=1,w){if(!Number.isInteger(f)||0>=f)throw new TypeError("elementSpan must be a (positive) integer");super(-1,w),this.elementSpan=f}isCount(){return!0}decode(f,w=0){t(f);const I=f.length-w;return Math.floor(I/this.elementSpan)}encode(f,w,I){return 0}}W.GreedyCount=u;class p extends o{constructor(f,w=0,I){if(!(f instanceof r))throw new TypeError("layout must be a Layout");if(!Number.isInteger(w))throw new TypeError("offset must be integer or undefined");super(f.span,I||f.property),this.layout=f,this.offset=w}isCount(){return this.layout instanceof v||this.layout instanceof B}decode(f,w=0){return this.layout.decode(f,w+this.offset)}encode(f,w,I=0){return this.layout.encode(f,w,I+this.offset)}}W.OffsetLayout=p;class v extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readUIntLE(w,this.span)}encode(f,w,I=0){return e(w).writeUIntLE(f,I,this.span),this.span}}W.UInt=v;class B extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readUIntBE(w,this.span)}encode(f,w,I=0){return e(w).writeUIntBE(f,I,this.span),this.span}}W.UIntBE=B;class P extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readIntLE(w,this.span)}encode(f,w,I=0){return e(w).writeIntLE(f,I,this.span),this.span}}W.Int=P;class _ extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readIntBE(w,this.span)}encode(f,w,I=0){return e(w).writeIntBE(f,I,this.span),this.span}}W.IntBE=_;const S=Math.pow(2,32);function T(c){const f=Math.floor(c/S),w=c-f*S;return{hi32:f,lo32:w}}function M(c,f){return c*S+f}class N extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readUInt32LE(w),j=I.readUInt32LE(w+4);return M(j,z)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeUInt32LE(z.lo32,I),j.writeUInt32LE(z.hi32,I+4),8}}W.NearUInt64=N;class F extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readUInt32BE(w),j=I.readUInt32BE(w+4);return M(z,j)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeUInt32BE(z.hi32,I),j.writeUInt32BE(z.lo32,I+4),8}}W.NearUInt64BE=F;class H extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readUInt32LE(w),j=I.readInt32LE(w+4);return M(j,z)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeUInt32LE(z.lo32,I),j.writeInt32LE(z.hi32,I+4),8}}W.NearInt64=H;class $ extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readInt32BE(w),j=I.readUInt32BE(w+4);return M(z,j)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeInt32BE(z.hi32,I),j.writeUInt32BE(z.lo32,I+4),8}}W.NearInt64BE=$;class Y extends r{constructor(f){super(4,f)}decode(f,w=0){return e(f).readFloatLE(w)}encode(f,w,I=0){return e(w).writeFloatLE(f,I),4}}W.Float=Y;class X extends r{constructor(f){super(4,f)}decode(f,w=0){return e(f).readFloatBE(w)}encode(f,w,I=0){return e(w).writeFloatBE(f,I),4}}W.FloatBE=X;class Q extends r{constructor(f){super(8,f)}decode(f,w=0){return e(f).readDoubleLE(w)}encode(f,w,I=0){return e(w).writeDoubleLE(f,I),8}}W.Double=Q;class ct extends r{constructor(f){super(8,f)}decode(f,w=0){return e(f).readDoubleBE(w)}encode(f,w,I=0){return e(w).writeDoubleBE(f,I),8}}W.DoubleBE=ct;class ot extends r{constructor(f,w,I){if(!(f instanceof r))throw new TypeError("elementLayout must be a Layout");if(!(w instanceof o&&w.isCount()||Number.isInteger(w)&&0<=w))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let z=-1;!(w instanceof o)&&0<f.span&&(z=w*f.span),super(z,I),this.elementLayout=f,this.count=w}getSpan(f,w=0){if(0<=this.span)return this.span;let I=0,z=this.count;if(z instanceof o&&(z=z.decode(f,w)),0<this.elementLayout.span)I=z*this.elementLayout.span;else{let j=0;for(;j<z;)I+=this.elementLayout.getSpan(f,w+I),++j}return I}decode(f,w=0){const I=[];let z=0,j=this.count;for(j instanceof o&&(j=j.decode(f,w));z<j;)I.push(this.elementLayout.decode(f,w)),w+=this.elementLayout.getSpan(f,w),z+=1;return I}encode(f,w,I=0){const z=this.elementLayout,j=f.reduce((rt,st)=>rt+z.encode(st,w,I+rt),0);return this.count instanceof o&&this.count.encode(f.length,w,I),j}}W.Sequence=ot;class C extends r{constructor(f,w,I){if(!(Array.isArray(f)&&f.reduce((j,rt)=>j&&rt instanceof r,!0)))throw new TypeError("fields must be array of Layout instances");typeof w=="boolean"&&I===void 0&&(I=w,w=void 0);for(const j of f)if(0>j.span&&j.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let z=-1;try{z=f.reduce((j,rt)=>j+rt.getSpan(),0)}catch{}super(z,w),this.fields=f,this.decodePrefixes=!!I}getSpan(f,w=0){if(0<=this.span)return this.span;let I=0;try{I=this.fields.reduce((z,j)=>{const rt=j.getSpan(f,w);return w+=rt,z+rt},0)}catch{throw new RangeError("indeterminate span")}return I}decode(f,w=0){t(f);const I=this.makeDestinationObject();for(const z of this.fields)if(z.property!==void 0&&(I[z.property]=z.decode(f,w)),w+=z.getSpan(f,w),this.decodePrefixes&&f.length===w)break;return I}encode(f,w,I=0){const z=I;let j=0,rt=0;for(const st of this.fields){let kt=st.span;if(rt=0<kt?kt:0,st.property!==void 0){const vt=f[st.property];vt!==void 0&&(rt=st.encode(vt,w,I),0>kt&&(kt=st.getSpan(w,I)))}j=I,I+=kt}return j+rt-z}fromArray(f){const w=this.makeDestinationObject();for(const I of this.fields)I.property!==void 0&&0<f.length&&(w[I.property]=f.shift());return w}layoutFor(f){if(typeof f!="string")throw new TypeError("property must be string");for(const w of this.fields)if(w.property===f)return w}offsetOf(f){if(typeof f!="string")throw new TypeError("property must be string");let w=0;for(const I of this.fields){if(I.property===f)return w;0>I.span?w=-1:0<=w&&(w+=I.span)}}}W.Structure=C;class U{constructor(f){this.property=f}decode(f,w){throw new Error("UnionDiscriminator is abstract")}encode(f,w,I){throw new Error("UnionDiscriminator is abstract")}}W.UnionDiscriminator=U;class D extends U{constructor(f,w){if(!(f instanceof o&&f.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(w||f.property||"variant"),this.layout=f}decode(f,w){return this.layout.decode(f,w)}encode(f,w,I){return this.layout.encode(f,w,I)}}W.UnionLayoutDiscriminator=D;class V extends r{constructor(f,w,I){let z;if(f instanceof v||f instanceof B)z=new D(new p(f));else if(f instanceof o&&f.isCount())z=new D(f);else if(f instanceof U)z=f;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(w===void 0&&(w=null),!(w===null||w instanceof r))throw new TypeError("defaultLayout must be null or a Layout");if(w!==null){if(0>w.span)throw new Error("defaultLayout must have constant span");w.property===void 0&&(w=w.replicate("content"))}let j=-1;w&&(j=w.span,0<=j&&(f instanceof v||f instanceof B)&&(j+=z.layout.span)),super(j,I),this.discriminator=z,this.usesPrefixDiscriminator=f instanceof v||f instanceof B,this.defaultLayout=w,this.registry={};let rt=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(st){return rt(st)},this.configGetSourceVariant=function(st){rt=st.bind(this)}}getSpan(f,w=0){if(0<=this.span)return this.span;const I=this.getVariant(f,w);if(!I)throw new Error("unable to determine span for unrecognized variant");return I.getSpan(f,w)}defaultGetSourceVariant(f){if(Object.prototype.hasOwnProperty.call(f,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(f,this.defaultLayout.property))return;const w=this.registry[f[this.discriminator.property]];if(w&&(!w.layout||w.property&&Object.prototype.hasOwnProperty.call(f,w.property)))return w}else for(const w in this.registry){const I=this.registry[w];if(I.property&&Object.prototype.hasOwnProperty.call(f,I.property))return I}throw new Error("unable to infer src variant")}decode(f,w=0){let I;const z=this.discriminator,j=z.decode(f,w),rt=this.registry[j];if(rt===void 0){const st=this.defaultLayout;let kt=0;this.usesPrefixDiscriminator&&(kt=z.layout.span),I=this.makeDestinationObject(),I[z.property]=j,I[st.property]=st.decode(f,w+kt)}else I=rt.decode(f,w);return I}encode(f,w,I=0){const z=this.getSourceVariant(f);if(z===void 0){const j=this.discriminator,rt=this.defaultLayout;let st=0;return this.usesPrefixDiscriminator&&(st=j.layout.span),j.encode(f[j.property],w,I),st+rt.encode(f[rt.property],w,I+st)}return z.encode(f,w,I)}addVariant(f,w,I){const z=new y(this,f,w,I);return this.registry[f]=z,z}getVariant(f,w=0){let I;return f instanceof Uint8Array?I=this.discriminator.decode(f,w):I=f,this.registry[I]}}W.Union=V;class y extends r{constructor(f,w,I,z){if(!(f instanceof V))throw new TypeError("union must be a Union");if(!Number.isInteger(w)||0>w)throw new TypeError("variant must be a (non-negative) integer");if(typeof I=="string"&&z===void 0&&(z=I,I=null),I){if(!(I instanceof r))throw new TypeError("layout must be a Layout");if(f.defaultLayout!==null&&0<=I.span&&I.span>f.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof z!="string")throw new TypeError("variant must have a String property")}let j=f.span;0>f.span&&(j=I?I.span:0,0<=j&&f.usesPrefixDiscriminator&&(j+=f.discriminator.layout.span)),super(j,z),this.union=f,this.variant=w,this.layout=I||null}getSpan(f,w=0){if(0<=this.span)return this.span;let I=0;this.union.usesPrefixDiscriminator&&(I=this.union.discriminator.layout.span);let z=0;return this.layout&&(z=this.layout.getSpan(f,w+I)),I+z}decode(f,w=0){const I=this.makeDestinationObject();if(this!==this.union.getVariant(f,w))throw new Error("variant mismatch");let z=0;return this.union.usesPrefixDiscriminator&&(z=this.union.discriminator.layout.span),this.layout?I[this.property]=this.layout.decode(f,w+z):this.property?I[this.property]=!0:this.union.usesPrefixDiscriminator&&(I[this.union.discriminator.property]=this.variant),I}encode(f,w,I=0){let z=0;if(this.union.usesPrefixDiscriminator&&(z=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(f,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,w,I);let j=z;if(this.layout&&(this.layout.encode(f[this.property],w,I+z),j+=this.layout.getSpan(w,I+z),0<=this.union.span&&j>this.union.span))throw new Error("encoded variant overruns containing union");return j}fromArray(f){if(this.layout)return this.layout.fromArray(f)}}W.VariantLayout=y;function a(c){return 0>c&&(c+=4294967296),c}class l extends r{constructor(f,w,I){if(!(f instanceof v||f instanceof B))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof w=="string"&&I===void 0&&(I=w,w=!1),4<f.span)throw new RangeError("word cannot exceed 32 bits");super(f.span,I),this.word=f,this.msb=!!w,this.fields=[];let z=0;this._packedSetValue=function(j){return z=a(j),this},this._packedGetValue=function(){return z}}decode(f,w=0){const I=this.makeDestinationObject(),z=this.word.decode(f,w);this._packedSetValue(z);for(const j of this.fields)j.property!==void 0&&(I[j.property]=j.decode(f));return I}encode(f,w,I=0){const z=this.word.decode(w,I);this._packedSetValue(z);for(const j of this.fields)if(j.property!==void 0){const rt=f[j.property];rt!==void 0&&j.encode(rt)}return this.word.encode(this._packedGetValue(),w,I)}addField(f,w){const I=new g(this,f,w);return this.fields.push(I),I}addBoolean(f){const w=new k(this,f);return this.fields.push(w),w}fieldFor(f){if(typeof f!="string")throw new TypeError("property must be string");for(const w of this.fields)if(w.property===f)return w}}W.BitStructure=l;class g{constructor(f,w,I){if(!(f instanceof l))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(w)||0>=w)throw new TypeError("bits must be positive integer");const z=8*f.span,j=f.fields.reduce((rt,st)=>rt+st.bits,0);if(w+j>z)throw new Error("bits too long for span remainder ("+(z-j)+" of "+z+" remain)");this.container=f,this.bits=w,this.valueMask=(1<<w)-1,w===32&&(this.valueMask=4294967295),this.start=j,this.container.msb&&(this.start=z-j-w),this.wordMask=a(this.valueMask<<this.start),this.property=I}decode(f,w){const I=this.container._packedGetValue();return a(I&this.wordMask)>>>this.start}encode(f){if(typeof f!="number"||!Number.isInteger(f)||f!==a(f&this.valueMask))throw new TypeError(s("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const w=this.container._packedGetValue(),I=a(f<<this.start);this.container._packedSetValue(a(w&~this.wordMask)|I)}}W.BitField=g;class k extends g{constructor(f,w){super(f,1,w)}decode(f,w){return!!super.decode(f,w)}encode(f){typeof f=="boolean"&&(f=+f),super.encode(f)}}W.Boolean=k;class E extends r{constructor(f,w){if(!(f instanceof o&&f.isCount()||Number.isInteger(f)&&0<=f))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let I=-1;f instanceof o||(I=f),super(I,w),this.length=f}getSpan(f,w){let I=this.span;return 0>I&&(I=this.length.decode(f,w)),I}decode(f,w=0){let I=this.span;return 0>I&&(I=this.length.decode(f,w)),e(f).slice(w,w+I)}encode(f,w,I){let z=this.length;if(this.length instanceof o&&(z=f.length),!(f instanceof Uint8Array&&z===f.length))throw new TypeError(s("Blob.encode",this)+" requires (length "+z+") Uint8Array as src");if(I+z>w.length)throw new RangeError("encoding overruns Uint8Array");const j=e(f);return e(w).write(j.toString("hex"),I,z,"hex"),this.length instanceof o&&this.length.encode(z,w,I),z}}W.Blob=E;class A extends r{constructor(f){super(-1,f)}getSpan(f,w=0){t(f);let I=w;for(;I<f.length&&f[I]!==0;)I+=1;return 1+I-w}decode(f,w=0){const I=this.getSpan(f,w);return e(f).slice(w,w+I-1).toString("utf-8")}encode(f,w,I=0){typeof f!="string"&&(f=String(f));const z=n.Buffer.from(f,"utf8"),j=z.length;if(I+j>w.length)throw new RangeError("encoding overruns Buffer");const rt=e(w);return z.copy(rt,I),rt[I+j]=0,j+1}}W.CString=A;class L extends r{constructor(f,w){if(typeof f=="string"&&w===void 0&&(w=f,f=void 0),f===void 0)f=-1;else if(!Number.isInteger(f))throw new TypeError("maxSpan must be an integer");super(-1,w),this.maxSpan=f}getSpan(f,w=0){return t(f),f.length-w}decode(f,w=0){const I=this.getSpan(f,w);if(0<=this.maxSpan&&this.maxSpan<I)throw new RangeError("text length exceeds maxSpan");return e(f).slice(w,w+I).toString("utf-8")}encode(f,w,I=0){typeof f!="string"&&(f=String(f));const z=n.Buffer.from(f,"utf8"),j=z.length;if(0<=this.maxSpan&&this.maxSpan<j)throw new RangeError("text length exceeds maxSpan");if(I+j>w.length)throw new RangeError("encoding overruns Buffer");return z.copy(e(w),I),j}}W.UTF8=L;class b extends r{constructor(f,w){super(0,w),this.value=f}decode(f,w){return this.value}encode(f,w,I){return 0}}return W.Constant=b,W.greedy=((c,f)=>new u(c,f)),W.offset=((c,f,w)=>new p(c,f,w)),W.u8=(c=>new v(1,c)),W.u16=(c=>new v(2,c)),W.u24=(c=>new v(3,c)),W.u32=(c=>new v(4,c)),W.u40=(c=>new v(5,c)),W.u48=(c=>new v(6,c)),W.nu64=(c=>new N(c)),W.u16be=(c=>new B(2,c)),W.u24be=(c=>new B(3,c)),W.u32be=(c=>new B(4,c)),W.u40be=(c=>new B(5,c)),W.u48be=(c=>new B(6,c)),W.nu64be=(c=>new F(c)),W.s8=(c=>new P(1,c)),W.s16=(c=>new P(2,c)),W.s24=(c=>new P(3,c)),W.s32=(c=>new P(4,c)),W.s40=(c=>new P(5,c)),W.s48=(c=>new P(6,c)),W.ns64=(c=>new H(c)),W.s16be=(c=>new _(2,c)),W.s24be=(c=>new _(3,c)),W.s32be=(c=>new _(4,c)),W.s40be=(c=>new _(5,c)),W.s48be=(c=>new _(6,c)),W.ns64be=(c=>new $(c)),W.f32=(c=>new Y(c)),W.f32be=(c=>new X(c)),W.f64=(c=>new Q(c)),W.f64be=(c=>new ct(c)),W.struct=((c,f,w)=>new C(c,f,w)),W.bits=((c,f,w)=>new l(c,f,w)),W.seq=((c,f,w)=>new ot(c,f,w)),W.union=((c,f,w)=>new V(c,f,w)),W.unionLayoutDiscriminator=((c,f)=>new D(c,f)),W.blob=((c,f)=>new E(c,f)),W.cstr=(c=>new A(c)),W.utf8=((c,f)=>new L(c,f)),W.constant=((c,f)=>new b(c,f)),W}var R=Jc(),Qc=8078e3,tu=8078001,eu=8078004,ru=8078005,nu=8078006,iu=8078011;function qo(n){return Array.isArray(n)?"%5B"+n.map(qo).join("%2C%20")+"%5D":typeof n=="bigint"?`${n}n`:encodeURIComponent(String(n!=null&&Object.getPrototypeOf(n)===null?{...n}:n))}function su([n,t]){return`${n}=${qo(t)}`}function ou(n){const t=Object.entries(n).map(su).join("&");return btoa(t)}function au(n,t={}){{let e=`Solana error #${n}; Decode this error by running \`npx @solana/errors decode -- ${n}`;return Object.keys(t).length&&(e+=` '${ou(t)}'`),`${e}\``}}var mr=class extends Error{cause=this.cause;context;constructor(...[n,t]){let e,r;if(t){const{cause:i,...o}=t;i&&(r={cause:i}),Object.keys(o).length>0&&(e=o)}const s=au(n,e);super(s,r),this.context={__code:n,...e},this.name="SolanaError"}};function cu(n,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(n)}function uu(n){return Object.freeze({...n,encode:t=>{const e=new Uint8Array(cu(t,n));return n.write(t,e,0),e}})}function fu(n){return Object.freeze({...n,decode:(t,e=0)=>n.read(t,e)[0]})}function gr(n){return"fixedSize"in n&&typeof n.fixedSize=="number"}function hu(n,t){if(gr(n)!==gr(t))throw new mr(eu);if(gr(n)&&gr(t)&&n.fixedSize!==t.fixedSize)throw new mr(ru,{decoderFixedSize:t.fixedSize,encoderFixedSize:n.fixedSize});if(!gr(n)&&!gr(t)&&n.maxSize!==t.maxSize)throw new mr(nu,{decoderMaxSize:t.maxSize,encoderMaxSize:n.maxSize});return{...t,...n,decode:t.decode,encode:n.encode,read:t.read,write:n.write}}function lu(n,t,e=0){if(t.length-e<=0)throw new mr(Qc,{codecDescription:n})}function du(n,t,e,r=0){const s=e.length-r;if(s<t)throw new mr(tu,{bytesLength:s,codecDescription:n,expected:t})}function pu(n,t,e,r){if(r<t||r>e)throw new mr(iu,{codecDescription:n,max:e,min:t,value:r})}function Do(n){return n?.endian!==1}function gu(n){return uu({fixedSize:n.size,write(t,e,r){n.range&&pu(n.name,n.range[0],n.range[1],t);const s=new ArrayBuffer(n.size);return n.set(new DataView(s),t,Do(n.config)),e.set(new Uint8Array(s),r),r+n.size}})}function yu(n){return fu({fixedSize:n.size,read(t,e=0){lu(n.name,t,e),du(n.name,n.size,t,e);const r=new DataView(mu(t,e,n.size));return[n.get(r,Do(n.config)),e+n.size]}})}function mu(n,t,e){const r=n.byteOffset+(t??0),s=e??n.byteLength;return n.buffer.slice(r,r+s)}var Wo=(n={})=>gu({config:n,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}),wu=(n={})=>yu({config:n,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}),bu=(n={})=>hu(Wo(n),wu(n));class ku extends TypeError{constructor(t,e){let r;const{message:s,explanation:i,...o}=t,{path:u}=t,p=u.length===0?s:`At path: ${u.join(".")} -- ${s}`;super(i??p),i!=null&&(this.cause=p),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...e()])}}function vu(n){return qr(n)&&typeof n[Symbol.iterator]=="function"}function qr(n){return typeof n=="object"&&n!=null}function ln(n){return qr(n)&&!Array.isArray(n)}function Be(n){return typeof n=="symbol"?n.toString():typeof n=="string"?JSON.stringify(n):`${n}`}function Su(n){const{done:t,value:e}=n.next();return t?void 0:e}function xu(n,t,e,r){if(n===!0)return;n===!1?n={}:typeof n=="string"&&(n={message:n});const{path:s,branch:i}=t,{type:o}=e,{refinement:u,message:p=`Expected a value of type \`${o}\`${u?` with refinement \`${u}\``:""}, but received: \`${Be(r)}\``}=n;return{value:r,type:o,refinement:u,key:s[s.length-1],path:s,branch:i,...n,message:p}}function*Ls(n,t,e,r){vu(n)||(n=[n]);for(const s of n){const i=xu(s,t,e,r);i&&(yield i)}}function*zi(n,t,e={}){const{path:r=[],branch:s=[n],coerce:i=!1,mask:o=!1}=e,u={path:r,branch:s,mask:o};i&&(n=t.coercer(n,u));let p="valid";for(const v of t.validator(n,u))v.explanation=e.message,p="not_valid",yield[v,void 0];for(let[v,B,P]of t.entries(n,u)){const _=zi(B,P,{path:v===void 0?r:[...r,v],branch:v===void 0?s:[...s,B],coerce:i,mask:o,message:e.message});for(const S of _)S[0]?(p=S[0].refinement!=null?"not_refined":"not_valid",yield[S[0],void 0]):i&&(B=S[1],v===void 0?n=B:n instanceof Map?n.set(v,B):n instanceof Set?n.add(B):qr(n)&&(B!==void 0||v in n)&&(n[v]=B))}if(p!=="not_valid")for(const v of t.refiner(n,u))v.explanation=e.message,p="not_refined",yield[v,void 0];p==="valid"&&(yield[void 0,n])}let Ue=class{constructor(t){const{type:e,schema:r,validator:s,refiner:i,coercer:o=p=>p,entries:u=function*(){}}=t;this.type=e,this.schema=r,this.entries=u,this.coercer=o,s?this.validator=(p,v)=>{const B=s(p,v);return Ls(B,v,this,p)}:this.validator=()=>[],i?this.refiner=(p,v)=>{const B=i(p,v);return Ls(B,v,this,p)}:this.refiner=()=>[]}assert(t,e){return $o(t,this,e)}create(t,e){return et(t,this,e)}is(t){return Vo(t,this)}mask(t,e){return Eu(t,this,e)}validate(t,e={}){return Dr(t,this,e)}};function $o(n,t,e){const r=Dr(n,t,{message:e});if(r[0])throw r[0]}function et(n,t,e){const r=Dr(n,t,{coerce:!0,message:e});if(r[0])throw r[0];return r[1]}function Eu(n,t,e){const r=Dr(n,t,{coerce:!0,mask:!0,message:e});if(r[0])throw r[0];return r[1]}function Vo(n,t){return!Dr(n,t)[0]}function Dr(n,t,e={}){const r=zi(n,t,e),s=Su(r);return s[0]?[new ku(s[0],function*(){for(const o of r)o[0]&&(yield o[0])}),void 0]:[void 0,s[1]]}function ur(n,t){return new Ue({type:n,schema:null,validator:t})}function Iu(){return ur("any",()=>!0)}function nt(n){return new Ue({type:"array",schema:n,*entries(t){if(n&&Array.isArray(t))for(const[e,r]of t.entries())yield[e,r,n]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Be(t)}`}})}function Le(){return ur("boolean",n=>typeof n=="boolean")}function Ki(n){return ur("instance",t=>t instanceof n||`Expected a \`${n.name}\` instance, but received: ${Be(t)}`)}function Ut(n){const t=Be(n),e=typeof n;return new Ue({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?n:null,validator(r){return r===n||`Expected the literal \`${t}\`, but received: ${Be(r)}`}})}function Au(){return ur("never",()=>!1)}function it(n){return new Ue({...n,validator:(t,e)=>t===null||n.validator(t,e),refiner:(t,e)=>t===null||n.refiner(t,e)})}function q(){return ur("number",n=>typeof n=="number"&&!isNaN(n)||`Expected a number, but received: ${Be(n)}`)}function ut(n){return new Ue({...n,validator:(t,e)=>t===void 0||n.validator(t,e),refiner:(t,e)=>t===void 0||n.refiner(t,e)})}function Ho(n,t){return new Ue({type:"record",schema:null,*entries(e){if(qr(e))for(const r in e){const s=e[r];yield[r,r,n],yield[r,s,t]}},validator(e){return ln(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return ln(e)?{...e}:e}})}function J(){return ur("string",n=>typeof n=="string"||`Expected a string, but received: ${Be(n)}`)}function qi(n){const t=Au();return new Ue({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const r=Math.max(n.length,e.length);for(let s=0;s<r;s++)yield[s,e[s],n[s]||t]}},validator(e){return Array.isArray(e)||`Expected an array, but received: ${Be(e)}`},coercer(e){return Array.isArray(e)?e.slice():e}})}function Z(n){const t=Object.keys(n);return new Ue({type:"type",schema:n,*entries(e){if(qr(e))for(const r of t)yield[r,e[r],n[r]]},validator(e){return ln(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return ln(e)?{...e}:e}})}function be(n){const t=n.map(e=>e.type).join(" | ");return new Ue({type:"union",schema:null,coercer(e,r){for(const s of n){const[i,o]=s.validate(e,{coerce:!0,mask:r.mask});if(!i)return o}return e},validator(e,r){const s=[];for(const i of n){const[...o]=zi(e,i,r),[u]=o;if(u[0])for(const[p]of o)p&&s.push(p);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Be(e)}`,...s]}})}function Ar(){return ur("unknown",()=>!0)}function Wr(n,t,e){return new Ue({...n,coercer:(r,s)=>Vo(r,t)?n.coercer(e(r,s),s):n.coercer(r,s)})}var Qr,_u=new Uint8Array(16);function Go(){if(!Qr&&(Qr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Qr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qr(_u)}const Bu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function vn(n){return typeof n=="string"&&Bu.test(n)}var ue=[];for(var oi=0;oi<256;++oi)ue.push((oi+256).toString(16).substr(1));function Sn(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(ue[n[t+0]]+ue[n[t+1]]+ue[n[t+2]]+ue[n[t+3]]+"-"+ue[n[t+4]]+ue[n[t+5]]+"-"+ue[n[t+6]]+ue[n[t+7]]+"-"+ue[n[t+8]]+ue[n[t+9]]+"-"+ue[n[t+10]]+ue[n[t+11]]+ue[n[t+12]]+ue[n[t+13]]+ue[n[t+14]]+ue[n[t+15]]).toLowerCase();if(!vn(e))throw TypeError("Stringified UUID is invalid");return e}var Cs,ai,ci=0,ui=0;function Ru(n,t,e){var r=t&&e||0,s=t||new Array(16);n=n||{};var i=n.node||Cs,o=n.clockseq!==void 0?n.clockseq:ai;if(i==null||o==null){var u=n.random||(n.rng||Go)();i==null&&(i=Cs=[u[0]|1,u[1],u[2],u[3],u[4],u[5]]),o==null&&(o=ai=(u[6]<<8|u[7])&16383)}var p=n.msecs!==void 0?n.msecs:Date.now(),v=n.nsecs!==void 0?n.nsecs:ui+1,B=p-ci+(v-ui)/1e4;if(B<0&&n.clockseq===void 0&&(o=o+1&16383),(B<0||p>ci)&&n.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ci=p,ui=v,ai=o,p+=122192928e5;var P=((p&268435455)*1e4+v)%4294967296;s[r++]=P>>>24&255,s[r++]=P>>>16&255,s[r++]=P>>>8&255,s[r++]=P&255;var _=p/4294967296*1e4&268435455;s[r++]=_>>>8&255,s[r++]=_&255,s[r++]=_>>>24&15|16,s[r++]=_>>>16&255,s[r++]=o>>>8|128,s[r++]=o&255;for(var S=0;S<6;++S)s[r+S]=i[S];return t||Sn(s)}function jo(n){if(!vn(n))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(n.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(n.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(n.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(n.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(n.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}function Mu(n){n=unescape(encodeURIComponent(n));for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e));return t}var Tu="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Pu="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Zo(n,t,e){function r(s,i,o,u){if(typeof s=="string"&&(s=Mu(s)),typeof i=="string"&&(i=jo(i)),i.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var p=new Uint8Array(16+s.length);if(p.set(i),p.set(s,i.length),p=e(p),p[6]=p[6]&15|t,p[8]=p[8]&63|128,o){u=u||0;for(var v=0;v<16;++v)o[u+v]=p[v];return o}return Sn(p)}try{r.name=n}catch{}return r.DNS=Tu,r.URL=Pu,r}function Lu(n){if(typeof n=="string"){var t=unescape(encodeURIComponent(n));n=new Uint8Array(t.length);for(var e=0;e<t.length;++e)n[e]=t.charCodeAt(e)}return Cu(Uu(Ou(n),n.length*8))}function Cu(n){for(var t=[],e=n.length*32,r="0123456789abcdef",s=0;s<e;s+=8){var i=n[s>>5]>>>s%32&255,o=parseInt(r.charAt(i>>>4&15)+r.charAt(i&15),16);t.push(o)}return t}function Yo(n){return(n+64>>>9<<4)+14+1}function Uu(n,t){n[t>>5]|=128<<t%32,n[Yo(t)-1]=t;for(var e=1732584193,r=-271733879,s=-1732584194,i=271733878,o=0;o<n.length;o+=16){var u=e,p=r,v=s,B=i;e=ge(e,r,s,i,n[o],7,-680876936),i=ge(i,e,r,s,n[o+1],12,-389564586),s=ge(s,i,e,r,n[o+2],17,606105819),r=ge(r,s,i,e,n[o+3],22,-1044525330),e=ge(e,r,s,i,n[o+4],7,-176418897),i=ge(i,e,r,s,n[o+5],12,1200080426),s=ge(s,i,e,r,n[o+6],17,-1473231341),r=ge(r,s,i,e,n[o+7],22,-45705983),e=ge(e,r,s,i,n[o+8],7,1770035416),i=ge(i,e,r,s,n[o+9],12,-1958414417),s=ge(s,i,e,r,n[o+10],17,-42063),r=ge(r,s,i,e,n[o+11],22,-1990404162),e=ge(e,r,s,i,n[o+12],7,1804603682),i=ge(i,e,r,s,n[o+13],12,-40341101),s=ge(s,i,e,r,n[o+14],17,-1502002290),r=ge(r,s,i,e,n[o+15],22,1236535329),e=ye(e,r,s,i,n[o+1],5,-165796510),i=ye(i,e,r,s,n[o+6],9,-1069501632),s=ye(s,i,e,r,n[o+11],14,643717713),r=ye(r,s,i,e,n[o],20,-373897302),e=ye(e,r,s,i,n[o+5],5,-701558691),i=ye(i,e,r,s,n[o+10],9,38016083),s=ye(s,i,e,r,n[o+15],14,-660478335),r=ye(r,s,i,e,n[o+4],20,-405537848),e=ye(e,r,s,i,n[o+9],5,568446438),i=ye(i,e,r,s,n[o+14],9,-1019803690),s=ye(s,i,e,r,n[o+3],14,-187363961),r=ye(r,s,i,e,n[o+8],20,1163531501),e=ye(e,r,s,i,n[o+13],5,-1444681467),i=ye(i,e,r,s,n[o+2],9,-51403784),s=ye(s,i,e,r,n[o+7],14,1735328473),r=ye(r,s,i,e,n[o+12],20,-1926607734),e=me(e,r,s,i,n[o+5],4,-378558),i=me(i,e,r,s,n[o+8],11,-2022574463),s=me(s,i,e,r,n[o+11],16,1839030562),r=me(r,s,i,e,n[o+14],23,-35309556),e=me(e,r,s,i,n[o+1],4,-1530992060),i=me(i,e,r,s,n[o+4],11,1272893353),s=me(s,i,e,r,n[o+7],16,-155497632),r=me(r,s,i,e,n[o+10],23,-1094730640),e=me(e,r,s,i,n[o+13],4,681279174),i=me(i,e,r,s,n[o],11,-358537222),s=me(s,i,e,r,n[o+3],16,-722521979),r=me(r,s,i,e,n[o+6],23,76029189),e=me(e,r,s,i,n[o+9],4,-640364487),i=me(i,e,r,s,n[o+12],11,-421815835),s=me(s,i,e,r,n[o+15],16,530742520),r=me(r,s,i,e,n[o+2],23,-995338651),e=we(e,r,s,i,n[o],6,-198630844),i=we(i,e,r,s,n[o+7],10,1126891415),s=we(s,i,e,r,n[o+14],15,-1416354905),r=we(r,s,i,e,n[o+5],21,-57434055),e=we(e,r,s,i,n[o+12],6,1700485571),i=we(i,e,r,s,n[o+3],10,-1894986606),s=we(s,i,e,r,n[o+10],15,-1051523),r=we(r,s,i,e,n[o+1],21,-2054922799),e=we(e,r,s,i,n[o+8],6,1873313359),i=we(i,e,r,s,n[o+15],10,-30611744),s=we(s,i,e,r,n[o+6],15,-1560198380),r=we(r,s,i,e,n[o+13],21,1309151649),e=we(e,r,s,i,n[o+4],6,-145523070),i=we(i,e,r,s,n[o+11],10,-1120210379),s=we(s,i,e,r,n[o+2],15,718787259),r=we(r,s,i,e,n[o+9],21,-343485551),e=Je(e,u),r=Je(r,p),s=Je(s,v),i=Je(i,B)}return[e,r,s,i]}function Ou(n){if(n.length===0)return[];for(var t=n.length*8,e=new Uint32Array(Yo(t)),r=0;r<t;r+=8)e[r>>5]|=(n[r/8]&255)<<r%32;return e}function Je(n,t){var e=(n&65535)+(t&65535),r=(n>>16)+(t>>16)+(e>>16);return r<<16|e&65535}function Nu(n,t){return n<<t|n>>>32-t}function xn(n,t,e,r,s,i){return Je(Nu(Je(Je(t,n),Je(r,i)),s),e)}function ge(n,t,e,r,s,i,o){return xn(t&e|~t&r,n,t,s,i,o)}function ye(n,t,e,r,s,i,o){return xn(t&r|e&~r,n,t,s,i,o)}function me(n,t,e,r,s,i,o){return xn(t^e^r,n,t,s,i,o)}function we(n,t,e,r,s,i,o){return xn(e^(t|~r),n,t,s,i,o)}var Fu=Zo("v3",48,Lu);function zu(n,t,e){n=n||{};var r=n.random||(n.rng||Go)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=r[s];return t}return Sn(r)}function Ku(n,t,e,r){switch(n){case 0:return t&e^~t&r;case 1:return t^e^r;case 2:return t&e^t&r^e&r;case 3:return t^e^r}}function fi(n,t){return n<<t|n>>>32-t}function qu(n){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof n=="string"){var r=unescape(encodeURIComponent(n));n=[];for(var s=0;s<r.length;++s)n.push(r.charCodeAt(s))}else Array.isArray(n)||(n=Array.prototype.slice.call(n));n.push(128);for(var i=n.length/4+2,o=Math.ceil(i/16),u=new Array(o),p=0;p<o;++p){for(var v=new Uint32Array(16),B=0;B<16;++B)v[B]=n[p*64+B*4]<<24|n[p*64+B*4+1]<<16|n[p*64+B*4+2]<<8|n[p*64+B*4+3];u[p]=v}u[o-1][14]=(n.length-1)*8/Math.pow(2,32),u[o-1][14]=Math.floor(u[o-1][14]),u[o-1][15]=(n.length-1)*8&4294967295;for(var P=0;P<o;++P){for(var _=new Uint32Array(80),S=0;S<16;++S)_[S]=u[P][S];for(var T=16;T<80;++T)_[T]=fi(_[T-3]^_[T-8]^_[T-14]^_[T-16],1);for(var M=e[0],N=e[1],F=e[2],H=e[3],$=e[4],Y=0;Y<80;++Y){var X=Math.floor(Y/20),Q=fi(M,5)+Ku(X,N,F,H)+$+t[X]+_[Y]>>>0;$=H,H=F,F=fi(N,30)>>>0,N=M,M=Q}e[0]=e[0]+M>>>0,e[1]=e[1]+N>>>0,e[2]=e[2]+F>>>0,e[3]=e[3]+H>>>0,e[4]=e[4]+$>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var Du=Zo("v5",80,qu);const Wu="00000000-0000-0000-0000-000000000000";function $u(n){if(!vn(n))throw TypeError("Invalid UUID");return parseInt(n.substr(14,1),16)}const Vu=Object.freeze(Object.defineProperty({__proto__:null,NIL:Wu,parse:jo,stringify:Sn,v1:Ru,v3:Fu,v4:zu,v5:Du,validate:vn,version:$u},Symbol.toStringTag,{value:"Module"})),Xo=uo(Vu);var hi,Us;function Hu(){if(Us)return hi;Us=1;const n=Xo.v4;return hi=function(e,r,s,i){if(typeof e!="string")throw new TypeError(e+" must be a string");i=i||{};const o=typeof i.version=="number"?i.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");const u={method:e};if(o===2&&(u.jsonrpc="2.0"),r){if(typeof r!="object"&&!Array.isArray(r))throw new TypeError(r+" must be an object, array or omitted");u.params=r}if(typeof s>"u"){const p=typeof i.generator=="function"?i.generator:function(){return n()};u.id=p(u,i)}else o===2&&s===null?i.notificationIdNull&&(u.id=null):u.id=s;return u},hi}var li,Os;function Gu(){if(Os)return li;Os=1;const n=Xo.v4,t=Hu(),e=function(r,s){if(!(this instanceof e))return new e(r,s);s||(s={}),this.options={reviver:typeof s.reviver<"u"?s.reviver:null,replacer:typeof s.replacer<"u"?s.replacer:null,generator:typeof s.generator<"u"?s.generator:function(){return n()},version:typeof s.version<"u"?s.version:2,notificationIdNull:typeof s.notificationIdNull=="boolean"?s.notificationIdNull:!1},this.callServer=r};return li=e,e.prototype.request=function(r,s,i,o){const u=this;let p=null;const v=Array.isArray(r)&&typeof s=="function";if(this.options.version===1&&v)throw new TypeError("JSON-RPC 1.0 does not support batching");if(v||!v&&r&&typeof r=="object"&&typeof s=="function")o=s,p=r;else{typeof i=="function"&&(o=i,i=void 0);const _=typeof o=="function";try{p=t(r,s,i,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(S){if(_){o(S);return}throw S}if(!_)return p}let P;try{P=JSON.stringify(p,this.options.replacer)}catch(_){o(_);return}return this.callServer(P,function(_,S){u._parseResponse(_,S,o)}),p},e.prototype._parseResponse=function(r,s,i){if(r){i(r);return}if(!s){i();return}let o;try{o=JSON.parse(s,this.options.reviver)}catch(u){i(u);return}if(i.length===3)if(Array.isArray(o)){const u=function(v){return typeof v.error<"u"},p=function(v){return!u(v)};i(null,o.filter(u),o.filter(p));return}else{i(null,o.error,o.result);return}i(null,o)},li}var ju=Gu();const Zu=Ri(ju);var Yu=class extends fo{socket;constructor(n,t){super(),this.socket=new window.WebSocket(n,t.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(n,t,e){const r=e||t;try{this.socket.send(n),r()}catch(s){r(s)}}close(n,t){this.socket.close(n,t)}addEventListener(n,t,e){this.socket.addEventListener(n,t,e)}};function Xu(n,t){return new Yu(n,t)}var Ju=class{encode(n){return JSON.stringify(n)}decode(n){return JSON.parse(n)}},Qu=class extends fo{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(n,t="ws://localhost:8080",{autoconnect:e=!0,reconnect:r=!0,reconnect_interval:s=1e3,max_reconnects:i=5,...o}={},u,p){super(),this.webSocketFactory=n,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=e,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=s,this.max_reconnects=i,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=u||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),p?this.dataPack=p:this.dataPack=new Ju,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(n,t,e,r){return!r&&typeof e=="object"&&(r=e,e=null),new Promise((s,i)=>{if(!this.ready)return i(new Error("socket not ready"));const o=this.generate_request_id(n,t),u={jsonrpc:"2.0",method:n,params:t||void 0,id:o};this.socket.send(this.dataPack.encode(u),r,p=>{if(p)return i(p);this.queue[o]={promise:[s,i]},e&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],i(new Error("reply timeout"))},e))})})}async login(n){const t=await this.call("rpc.login",n);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(n,t){return new Promise((e,r)=>{if(!this.ready)return r(new Error("socket not ready"));const s={jsonrpc:"2.0",method:n,params:t};this.socket.send(this.dataPack.encode(s),i=>{if(i)return r(i);e()})})}async subscribe(n){typeof n=="string"&&(n=[n]);const t=await this.call("rpc.on",n);if(typeof n=="string"&&t[n]!=="ok")throw new Error("Failed subscribing to an event '"+n+"' with: "+t[n]);return t}async unsubscribe(n){typeof n=="string"&&(n=[n]);const t=await this.call("rpc.off",n);if(typeof n=="string"&&t[n]!=="ok")throw new Error("Failed unsubscribing from an event with: "+t);return t}close(n,t){this.socket&&this.socket.close(n||1e3,t)}setAutoReconnect(n){this.reconnect=n}setReconnectInterval(n){this.reconnect_interval=n}setMaxReconnects(n){this.max_reconnects=n}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(n,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(n,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=ft.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch{return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);const r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(let s=0;s<e.params.length;s++)r.push(e.params[s]);return Promise.resolve().then(()=>{this.emit.apply(this,r)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,e?.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>this.emit("error",e)),this.socket.addEventListener("close",({code:e,reason:r})=>{this.ready&&setTimeout(()=>this.emit("close",e,r),0),this.ready=!1,this.socket=void 0,e!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(n,t),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",e,r),1))})}};const tf=BigInt(0),Rr=BigInt(1),ef=BigInt(2),rf=BigInt(7),nf=BigInt(256),sf=BigInt(113),Jo=[],Qo=[],ta=[];for(let n=0,t=Rr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Jo.push(2*(5*r+e)),Qo.push((n+1)*(n+2)/2%64);let s=tf;for(let i=0;i<7;i++)t=(t<<Rr^(t>>rf)*sf)%nf,t&ef&&(s^=Rr<<(Rr<<BigInt(i))-Rr);ta.push(s)}const ea=yo(ta,!0),of=ea[0],af=ea[1],Ns=(n,t,e)=>e>32?ja(n,t,e):Ha(n,t,e),Fs=(n,t,e)=>e>32?Za(n,t,e):Ga(n,t,e);function cf(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const u=(o+8)%10,p=(o+2)%10,v=e[p],B=e[p+1],P=Ns(v,B,1)^e[u],_=Fs(v,B,1)^e[u+1];for(let S=0;S<50;S+=10)n[o+S]^=P,n[o+S+1]^=_}let s=n[2],i=n[3];for(let o=0;o<24;o++){const u=Qo[o],p=Ns(s,i,u),v=Fs(s,i,u),B=Jo[o];s=n[B],i=n[B+1],n[B]=p,n[B+1]=v}for(let o=0;o<50;o+=10){for(let u=0;u<10;u++)e[u]=n[o+u];for(let u=0;u<10;u++)n[o+u]^=~e[(u+2)%10]&e[(u+4)%10]}n[0]^=of[r],n[1]^=af[r]}Qe(e)}class Di extends Ti{constructor(t,e,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=s,this.rounds=i,Cr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Oa(this.state)}clone(){return this._cloneInto()}keccak(){fs(this.state32),cf(this.state32,this.rounds),fs(this.state32),this.posOut=0,this.pos=0}update(t){br(this),t=wn(t),$e(t);const{blockLen:e,state:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(e-this.pos,s-i);for(let u=0;u<o;u++)r[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:s}=this;t[r]^=e,(e&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){br(this,!1),$e(t),this.finish();const e=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(e.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Cr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(lo(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,Qe(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new Di(e,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}}const uf=(n,t,e)=>Pi(()=>new Di(t,n,e)),zs=uf(1,136,256/8);class ra extends Ti{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ho(t);const r=wn(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),Qe(i)}update(t){return br(this),this.iHash.update(t),this}digestInto(t){br(this),$e(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:u}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const na=(n,t,e)=>new ra(n,t).update(e).digest();na.create=(n,t)=>new ra(n,t);const Ks=(n,t)=>(n+(n>=0?t:-t)/ia)/t;function ff(n,t,e){const[[r,s],[i,o]]=t,u=Ks(o*n,e),p=Ks(-s*n,e);let v=n-u*r-p*i,B=-u*s-p*o;const P=v<De,_=B<De;P&&(v=-v),_&&(B=-B);const S=zr(Math.ceil(vo(e)/2))+wr;if(v<De||v>=S||B<De||B>=S)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:P,k1:v,k2neg:_,k2:B}}function Ei(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function di(n,t){const e={};for(let r of Object.keys(t))e[r]=n[r]===void 0?t[r]:n[r];return ar(e.lowS,"lowS"),ar(e.prehash,"prehash"),e.format!==void 0&&Ei(e.format),e}class hf extends Error{constructor(t=""){super(t)}}const Fe={Err:hf,_tlv:{encode:(n,t)=>{const{Err:e}=Fe;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,s=Xr(r);if(s.length/2&128)throw new e("tlv.encode: long form length too big");const i=r>127?Xr(s.length/2|128):"";return Xr(n)+i+s+t},decode(n,t){const{Err:e}=Fe;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const p=s&127;if(!p)throw new e("tlv.decode(long): indefinite length not supported");if(p>4)throw new e("tlv.decode(long): byte length is too big");const v=t.subarray(r,r+p);if(v.length!==p)throw new e("tlv.decode: length bytes not complete");if(v[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const B of v)o=o<<8|B;if(r+=p,o<128)throw new e("tlv.decode(long): not minimal encoding")}const u=t.subarray(r,r+o);if(u.length!==o)throw new e("tlv.decode: wrong value length");return{v:u,l:t.subarray(r+o)}}},_int:{encode(n){const{Err:t}=Fe;if(n<De)throw new t("integer: negative integers are not allowed");let e=Xr(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Fe;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 bn(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Fe,s=Dt("signature",n),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l:p}=r.decode(2,i),{v,l:B}=r.decode(2,p);if(B.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(u),s:e.decode(v)}},hexFromSig(n){const{_tlv:t,_int:e}=Fe,r=t.encode(2,e.encode(n.r)),s=t.encode(2,e.encode(n.s)),i=r+s;return t.encode(48,i)}},De=BigInt(0),wr=BigInt(1),ia=BigInt(2),tn=BigInt(3),lf=BigInt(4);function yr(n,t){const{BYTES:e}=n;let r;if(typeof t=="bigint")r=t;else{let s=Dt("private key",t);try{r=n.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${e}, got ${typeof t}`)}}if(!n.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function df(n,t={}){const e=No("weierstrass",n,t),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o,n:u}=i;Kr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:p}=t;if(p&&(!r.is0(i.a)||typeof p.beta!="bigint"||!Array.isArray(p.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const v=oa(r,s);function B(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function P(V,y,a){const{x:l,y:g}=y.toAffine(),k=r.toBytes(l);if(ar(a,"isCompressed"),a){B();const E=!r.isOdd(g);return Me(sa(E),k)}else return Me(Uint8Array.of(4),k,r.toBytes(g))}function _(V){_e(V,void 0,"Point");const{publicKey:y,publicKeyUncompressed:a}=v,l=V.length,g=V[0],k=V.subarray(1);if(l===y&&(g===2||g===3)){const E=r.fromBytes(k);if(!r.isValid(E))throw new Error("bad point: is not on curve, wrong x");const A=M(E);let L;try{L=r.sqrt(A)}catch(f){const w=f instanceof Error?": "+f.message:"";throw new Error("bad point: is not on curve, sqrt error"+w)}B();const b=r.isOdd(L);return(g&1)===1!==b&&(L=r.neg(L)),{x:E,y:L}}else if(l===a&&g===4){const E=r.BYTES,A=r.fromBytes(k.subarray(0,E)),L=r.fromBytes(k.subarray(E,E*2));if(!N(A,L))throw new Error("bad point: is not on curve");return{x:A,y:L}}else throw new Error(`bad point: got length ${l}, expected compressed=${y} or uncompressed=${a}`)}const S=t.toBytes||P,T=t.fromBytes||_;function M(V){const y=r.sqr(V),a=r.mul(y,V);return r.add(r.add(a,r.mul(V,i.a)),i.b)}function N(V,y){const a=r.sqr(y),l=M(V);return r.eql(a,l)}if(!N(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const F=r.mul(r.pow(i.a,tn),lf),H=r.mul(r.sqr(i.b),BigInt(27));if(r.is0(r.add(F,H)))throw new Error("bad curve params: a or b");function $(V,y,a=!1){if(!r.isValid(y)||a&&r.is0(y))throw new Error(`bad point coordinate ${V}`);return y}function Y(V){if(!(V instanceof C))throw new Error("ProjectivePoint expected")}function X(V){if(!p||!p.basises)throw new Error("no endo");return ff(V,p.basises,s.ORDER)}const Q=on((V,y)=>{const{X:a,Y:l,Z:g}=V;if(r.eql(g,r.ONE))return{x:a,y:l};const k=V.is0();y==null&&(y=k?r.ONE:r.inv(g));const E=r.mul(a,y),A=r.mul(l,y),L=r.mul(g,y);if(k)return{x:r.ZERO,y:r.ZERO};if(!r.eql(L,r.ONE))throw new Error("invZ was invalid");return{x:E,y:A}}),ct=on(V=>{if(V.is0()){if(t.allowInfinityPoint&&!r.is0(V.Y))return;throw new Error("bad point: ZERO")}const{x:y,y:a}=V.toAffine();if(!r.isValid(y)||!r.isValid(a))throw new Error("bad point: x or y not field elements");if(!N(y,a))throw new Error("bad point: equation left != right");if(!V.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function ot(V,y,a,l,g){return a=new C(r.mul(a.X,V),a.Y,a.Z),y=an(l,y),a=an(g,a),y.add(a)}class C{constructor(y,a,l){this.X=$("x",y),this.Y=$("y",a,!0),this.Z=$("z",l),Object.freeze(this)}static CURVE(){return i}static fromAffine(y){const{x:a,y:l}=y||{};if(!y||!r.isValid(a)||!r.isValid(l))throw new Error("invalid affine point");if(y instanceof C)throw new Error("projective point not allowed");return r.is0(a)&&r.is0(l)?C.ZERO:new C(a,l,r.ONE)}static fromBytes(y){const a=C.fromAffine(T(_e(y,void 0,"point")));return a.assertValidity(),a}static fromHex(y){return C.fromBytes(Dt("pointHex",y))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,a=!0){return D.createCache(this,y),a||this.multiply(tn),this}assertValidity(){ct(this)}hasEvenY(){const{y}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(y)}equals(y){Y(y);const{X:a,Y:l,Z:g}=this,{X:k,Y:E,Z:A}=y,L=r.eql(r.mul(a,A),r.mul(k,g)),b=r.eql(r.mul(l,A),r.mul(E,g));return L&&b}negate(){return new C(this.X,r.neg(this.Y),this.Z)}double(){const{a:y,b:a}=i,l=r.mul(a,tn),{X:g,Y:k,Z:E}=this;let A=r.ZERO,L=r.ZERO,b=r.ZERO,c=r.mul(g,g),f=r.mul(k,k),w=r.mul(E,E),I=r.mul(g,k);return I=r.add(I,I),b=r.mul(g,E),b=r.add(b,b),A=r.mul(y,b),L=r.mul(l,w),L=r.add(A,L),A=r.sub(f,L),L=r.add(f,L),L=r.mul(A,L),A=r.mul(I,A),b=r.mul(l,b),w=r.mul(y,w),I=r.sub(c,w),I=r.mul(y,I),I=r.add(I,b),b=r.add(c,c),c=r.add(b,c),c=r.add(c,w),c=r.mul(c,I),L=r.add(L,c),w=r.mul(k,E),w=r.add(w,w),c=r.mul(w,I),A=r.sub(A,c),b=r.mul(w,f),b=r.add(b,b),b=r.add(b,b),new C(A,L,b)}add(y){Y(y);const{X:a,Y:l,Z:g}=this,{X:k,Y:E,Z:A}=y;let L=r.ZERO,b=r.ZERO,c=r.ZERO;const f=i.a,w=r.mul(i.b,tn);let I=r.mul(a,k),z=r.mul(l,E),j=r.mul(g,A),rt=r.add(a,l),st=r.add(k,E);rt=r.mul(rt,st),st=r.add(I,z),rt=r.sub(rt,st),st=r.add(a,g);let kt=r.add(k,A);return st=r.mul(st,kt),kt=r.add(I,j),st=r.sub(st,kt),kt=r.add(l,g),L=r.add(E,A),kt=r.mul(kt,L),L=r.add(z,j),kt=r.sub(kt,L),c=r.mul(f,st),L=r.mul(w,j),c=r.add(L,c),L=r.sub(z,c),c=r.add(z,c),b=r.mul(L,c),z=r.add(I,I),z=r.add(z,I),j=r.mul(f,j),st=r.mul(w,st),z=r.add(z,j),j=r.sub(I,j),j=r.mul(f,j),st=r.add(st,j),I=r.mul(z,st),b=r.add(b,I),I=r.mul(kt,st),L=r.mul(rt,L),L=r.sub(L,I),I=r.mul(rt,z),c=r.mul(kt,c),c=r.add(c,I),new C(L,b,c)}subtract(y){return this.add(y.negate())}is0(){return this.equals(C.ZERO)}multiply(y){const{endo:a}=t;if(!s.isValidNot0(y))throw new Error("invalid scalar: out of range");let l,g;const k=E=>D.cached(this,E,A=>nr(C,A));if(a){const{k1neg:E,k1:A,k2neg:L,k2:b}=X(y),{p:c,f}=k(A),{p:w,f:I}=k(b);g=f.add(I),l=ot(a.beta,c,w,E,L)}else{const{p:E,f:A}=k(y);l=E,g=A}return nr(C,[l,g])[0]}multiplyUnsafe(y){const{endo:a}=t,l=this;if(!s.isValid(y))throw new Error("invalid scalar: out of range");if(y===De||l.is0())return C.ZERO;if(y===wr)return l;if(D.hasCache(this))return this.multiply(y);if(a){const{k1neg:g,k1:k,k2neg:E,k2:A}=X(y),{p1:L,p2:b}=Sc(C,l,k,A);return ot(a.beta,L,b,g,E)}else return D.unsafe(l,y)}multiplyAndAddUnsafe(y,a,l){const g=this.multiplyUnsafe(a).add(y.multiplyUnsafe(l));return g.is0()?void 0:g}toAffine(y){return Q(this,y)}isTorsionFree(){const{isTorsionFree:y}=t;return o===wr?!0:y?y(C,this):D.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:y}=t;return o===wr?this:y?y(C,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(y=!0){return ar(y,"isCompressed"),this.assertValidity(),S(C,this,y)}toHex(y=!0){return sr(this.toBytes(y))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(y=!0){return this.toBytes(y)}_setWindowSize(y){this.precompute(y)}static normalizeZ(y){return nr(C,y)}static msm(y,a){return Oo(C,s,y,a)}static fromPrivateKey(y){return C.BASE.multiply(yr(s,y))}}C.BASE=new C(i.Gx,i.Gy,r.ONE),C.ZERO=new C(r.ZERO,r.ONE,r.ZERO),C.Fp=r,C.Fn=s;const U=s.BITS,D=new Uo(C,t.endo?Math.ceil(U/2):U);return C.BASE.precompute(8),C}function sa(n){return Uint8Array.of(n?2:3)}function oa(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function pf(n,t={}){const{Fn:e}=n,r=t.randomBytes||Li,s=Object.assign(oa(n.Fp,e),{seed:Po(e.ORDER)});function i(S){try{return!!yr(e,S)}catch{return!1}}function o(S,T){const{publicKey:M,publicKeyUncompressed:N}=s;try{const F=S.length;return T===!0&&F!==M||T===!1&&F!==N?!1:!!n.fromBytes(S)}catch{return!1}}function u(S=r(s.seed)){return bc(_e(S,s.seed,"seed"),e.ORDER)}function p(S,T=!0){return n.BASE.multiply(yr(e,S)).toBytes(T)}function v(S){const T=u(S);return{secretKey:T,publicKey:p(T)}}function B(S){if(typeof S=="bigint")return!1;if(S instanceof n)return!0;const{secretKey:T,publicKey:M,publicKeyUncompressed:N}=s;if(e.allowedLengths||T===M)return;const F=Dt("key",S).length;return F===M||F===N}function P(S,T,M=!0){if(B(S)===!0)throw new Error("first arg must be private key");if(B(T)===!1)throw new Error("second arg must be public key");const N=yr(e,S);return n.fromHex(T).multiply(N).toBytes(M)}return Object.freeze({getPublicKey:p,getSharedSecret:P,keygen:v,Point:n,utils:{isValidSecretKey:i,isValidPublicKey:o,randomSecretKey:u,isValidPrivateKey:i,randomPrivateKey:u,normPrivateKeyToScalar:S=>yr(e,S),precompute(S=8,T=n.BASE){return T.precompute(S,!1)}},lengths:s})}function gf(n,t,e={}){ho(t),Kr(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=e.randomBytes||Li,s=e.hmac||((a,...l)=>na(t,a,Me(...l))),{Fp:i,Fn:o}=n,{ORDER:u,BITS:p}=o,{keygen:v,getPublicKey:B,getSharedSecret:P,utils:_,lengths:S}=pf(n,e),T={prehash:!1,lowS:typeof e.lowS=="boolean"?e.lowS:!1,format:void 0,extraEntropy:!1},M="compact";function N(a){const l=u>>wr;return a>l}function F(a,l){if(!o.isValidNot0(l))throw new Error(`invalid signature ${a}: out of range 1..Point.Fn.ORDER`);return l}function H(a,l){Ei(l);const g=S.signature,k=l==="compact"?g:l==="recovered"?g+1:void 0;return _e(a,k,`${l} signature`)}class ${constructor(l,g,k){this.r=F("r",l),this.s=F("s",g),k!=null&&(this.recovery=k),Object.freeze(this)}static fromBytes(l,g=M){H(l,g);let k;if(g==="der"){const{r:b,s:c}=Fe.toSig(_e(l));return new $(b,c)}g==="recovered"&&(k=l[0],g="compact",l=l.subarray(1));const E=o.BYTES,A=l.subarray(0,E),L=l.subarray(E,E*2);return new $(o.fromBytes(A),o.fromBytes(L),k)}static fromHex(l,g){return this.fromBytes(sn(l),g)}addRecoveryBit(l){return new $(this.r,this.s,l)}recoverPublicKey(l){const g=i.ORDER,{r:k,s:E,recovery:A}=this;if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");if(u*ia<g&&A>1)throw new Error("recovery id is ambiguous for h>1 curve");const b=A===2||A===3?k+u:k;if(!i.isValid(b))throw new Error("recovery id 2 or 3 invalid");const c=i.toBytes(b),f=n.fromBytes(Me(sa((A&1)===0),c)),w=o.inv(b),I=X(Dt("msgHash",l)),z=o.create(-I*w),j=o.create(E*w),rt=n.BASE.multiplyUnsafe(z).add(f.multiplyUnsafe(j));if(rt.is0())throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return N(this.s)}toBytes(l=M){if(Ei(l),l==="der")return sn(Fe.hexFromSig(this));const g=o.toBytes(this.r),k=o.toBytes(this.s);if(l==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Me(Uint8Array.of(this.recovery),g,k)}return Me(g,k)}toHex(l){return sr(this.toBytes(l))}assertValidity(){}static fromCompact(l){return $.fromBytes(Dt("sig",l),"compact")}static fromDER(l){return $.fromBytes(Dt("sig",l),"der")}normalizeS(){return this.hasHighS()?new $(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return sr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return sr(this.toBytes("compact"))}}const Y=e.bits2int||function(l){if(l.length>8192)throw new Error("input is too large");const g=bn(l),k=l.length*8-p;return k>0?g>>BigInt(k):g},X=e.bits2int_modN||function(l){return o.create(Y(l))},Q=zr(p);function ct(a){return xi("num < 2^"+p,a,De,Q),o.toBytes(a)}function ot(a,l){return _e(a,void 0,"message"),l?_e(t(a),void 0,"prehashed message"):a}function C(a,l,g){if(["recovered","canonical"].some(z=>z in g))throw new Error("sign() legacy options not supported");const{lowS:k,prehash:E,extraEntropy:A}=di(g,T);a=ot(a,E);const L=X(a),b=yr(o,l),c=[ct(b),ct(L)];if(A!=null&&A!==!1){const z=A===!0?r(S.secretKey):A;c.push(Dt("extraEntropy",z))}const f=Me(...c),w=L;function I(z){const j=Y(z);if(!o.isValidNot0(j))return;const rt=o.inv(j),st=n.BASE.multiply(j).toAffine(),kt=o.create(st.x);if(kt===De)return;const vt=o.create(rt*o.create(w+kt*b));if(vt===De)return;let It=(st.x===kt?0:2)|Number(st.y&wr),Ie=vt;return k&&N(vt)&&(Ie=o.neg(vt),It^=1),new $(kt,Ie,It)}return{seed:f,k2sig:I}}function U(a,l,g={}){a=Dt("message",a);const{seed:k,k2sig:E}=C(a,l,g);return uc(t.outputLen,o.BYTES,s)(k,E)}function D(a){let l;const g=typeof a=="string"||Fr(a),k=!g&&a!==null&&typeof a=="object"&&typeof a.r=="bigint"&&typeof a.s=="bigint";if(!g&&!k)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(k)l=new $(a.r,a.s);else if(g){try{l=$.fromBytes(Dt("sig",a),"der")}catch(E){if(!(E instanceof Fe.Err))throw E}if(!l)try{l=$.fromBytes(Dt("sig",a),"compact")}catch{return!1}}return l||!1}function V(a,l,g,k={}){const{lowS:E,prehash:A,format:L}=di(k,T);if(g=Dt("publicKey",g),l=ot(Dt("message",l),A),"strict"in k)throw new Error("options.strict was renamed to lowS");const b=L===void 0?D(a):$.fromBytes(Dt("sig",a),L);if(b===!1)return!1;try{const c=n.fromBytes(g);if(E&&b.hasHighS())return!1;const{r:f,s:w}=b,I=X(l),z=o.inv(w),j=o.create(I*z),rt=o.create(f*z),st=n.BASE.multiplyUnsafe(j).add(c.multiplyUnsafe(rt));return st.is0()?!1:o.create(st.x)===f}catch{return!1}}function y(a,l,g={}){const{prehash:k}=di(g,T);return l=ot(l,k),$.fromBytes(a,"recovered").recoverPublicKey(l).toBytes()}return Object.freeze({keygen:v,getPublicKey:B,getSharedSecret:P,utils:_,lengths:S,Point:n,sign:U,verify:V,recoverPublicKey:y,Signature:$,hash:t})}function yf(n){const t={a:n.a,b:n.b,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e=n.Fp;let r=n.allowedPrivateKeyLengths?Array.from(new Set(n.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const s=cr(t.n,{BITS:n.nBitLength,allowedLengths:r,modFromBytes:n.wrapPrivateKey}),i={Fp:e,Fn:s,allowInfinityPoint:n.allowInfinityPoint,endo:n.endo,isTorsionFree:n.isTorsionFree,clearCofactor:n.clearCofactor,fromBytes:n.fromBytes,toBytes:n.toBytes};return{CURVE:t,curveOpts:i}}function mf(n){const{CURVE:t,curveOpts:e}=yf(n),r={hmac:n.hmac,randomBytes:n.randomBytes,lowS:n.lowS,bits2int:n.bits2int,bits2int_modN:n.bits2int_modN};return{CURVE:t,curveOpts:e,hash:n.hash,ecdsaOpts:r}}function wf(n,t){const e=t.Point;return Object.assign({},t,{ProjectivePoint:e,CURVE:Object.assign({},n,Mo(e.Fn.ORDER,e.Fn.BITS))})}function bf(n){const{CURVE:t,curveOpts:e,hash:r,ecdsaOpts:s}=mf(n),i=df(t,e),o=gf(i,r,s);return wf(n,o)}function kf(n,t){const e=r=>bf({...n,hash:r});return{...e(t),create:e}}const Wi={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},vf={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},qs=BigInt(2);function Sf(n){const t=Wi.p,e=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),u=BigInt(44),p=BigInt(88),v=n*n*n%t,B=v*v*n%t,P=qt(B,e,t)*B%t,_=qt(P,e,t)*B%t,S=qt(_,qs,t)*v%t,T=qt(S,s,t)*S%t,M=qt(T,i,t)*T%t,N=qt(M,u,t)*M%t,F=qt(N,p,t)*N%t,H=qt(F,u,t)*M%t,$=qt(H,e,t)*B%t,Y=qt($,o,t)*T%t,X=qt(Y,r,t)*v%t,Q=qt(X,qs,t);if(!Ii.eql(Ii.sqr(Q),n))throw new Error("Cannot find square root");return Q}const Ii=cr(Wi.p,{sqrt:Sf}),$i=kf({...Wi,Fp:Ii,lowS:!0,endo:vf},wo),xf=Ir.utils.randomPrivateKey,Ds=()=>{const n=Ir.utils.randomPrivateKey(),t=dn(n),e=new Uint8Array(64);return e.set(n),e.set(t,32),{publicKey:t,secretKey:e}},dn=Ir.getPublicKey;function Ws(n){try{return Ir.ExtendedPoint.fromHex(n),!0}catch{return!1}}const Vi=(n,t)=>Ir.sign(n,t.slice(0,32)),Ef=Ir.verify,yt=n=>ft.Buffer.isBuffer(n)?n:n instanceof Uint8Array?ft.Buffer.from(n.buffer,n.byteOffset,n.byteLength):ft.Buffer.from(n);class aa{constructor(t){Object.assign(this,t)}encode(){return ft.Buffer.from(si.serialize(nn,this))}static decode(t){return si.deserialize(nn,this,t)}static decodeUnchecked(t){return si.deserializeUnchecked(nn,this,t)}}class Pl extends aa{constructor(t){if(super(t),this.enum="",Object.keys(t).length!==1)throw new Error("Enum can only take single value");Object.keys(t).map(e=>{this.enum=e})}}const nn=new Map;var ca;const If=32,We=32;function Af(n){return n._bn!==void 0}let $s=1;class tt extends aa{constructor(t){if(super({}),this._bn=void 0,Af(t))this._bn=t._bn;else{if(typeof t=="string"){const e=he.decode(t);if(e.length!=We)throw new Error("Invalid public key input");this._bn=new Es(e)}else this._bn=new Es(t);if(this._bn.byteLength()>We)throw new Error("Invalid public key input")}}static unique(){const t=new tt($s);return $s+=1,new tt(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return he.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(ft.Buffer);if(t.length===We)return t;const e=ft.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){const s=ft.Buffer.concat([t.toBuffer(),ft.Buffer.from(e),r.toBuffer()]),i=Bs(s);return new tt(i)}static createProgramAddressSync(t,e){let r=ft.Buffer.alloc(0);t.forEach(function(i){if(i.length>If)throw new TypeError("Max seed length exceeded");r=ft.Buffer.concat([r,yt(i)])}),r=ft.Buffer.concat([r,e.toBuffer(),ft.Buffer.from("ProgramDerivedAddress")]);const s=Bs(r);if(Ws(s))throw new Error("Invalid seeds, address must fall off the curve");return new tt(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r=255,s;for(;r!=0;){try{const i=t.concat(ft.Buffer.from([r]));s=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;r--;continue}return[s,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){const e=new tt(t);return Ws(e.toBytes())}}ca=tt;tt.default=new ca("11111111111111111111111111111111");nn.set(tt,{kind:"struct",fields:[["_bn","u256"]]});class Ll{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=yt(t);if(t.length!==64)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=yt(xf()),this._publicKey=yt(dn(this._secretKey))}get publicKey(){return new tt(this._publicKey)}get secretKey(){return ft.Buffer.concat([this._secretKey,this._publicKey],64)}}const Cl=new tt("BPFLoader1111111111111111111111111111111111"),or=1232,Hi=127,pn=64;class ua extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(ua.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class fa extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(fa.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Tr extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Tr.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class gn{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t<e.length)return e[t];t-=e.length}}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const r=new Map;this.keySegments().flat().forEach((i,o)=>{r.set(i.toBase58(),o)});const s=i=>{const o=r.get(i.toBase58());if(o===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return o};return t.map(i=>({programIdIndex:s(i.programId),accountKeyIndexes:i.keys.map(o=>s(o.pubkey)),data:i.data}))}}const mt=(n="publicKey")=>R.blob(32,n),_f=(n="signature")=>R.blob(64,n),ir=(n="string")=>{const t=R.struct([R.u32("length"),R.u32("lengthPadding"),R.blob(R.offset(R.u32(),-8),"chars")],n),e=t.decode.bind(t),r=t.encode.bind(t),s=t;return s.decode=(i,o)=>e(i,o).chars.toString(),s.encode=(i,o,u)=>{const p={chars:ft.Buffer.from(i,"utf8")};return r(p,o,u)},s.alloc=i=>R.u32().span+R.u32().span+ft.Buffer.from(i,"utf8").length,s},Bf=(n="authorized")=>R.struct([mt("staker"),mt("withdrawer")],n),Rf=(n="lockup")=>R.struct([R.ns64("unixTimestamp"),R.ns64("epoch"),mt("custodian")],n),Mf=(n="voteInit")=>R.struct([mt("nodePubkey"),mt("authorizedVoter"),mt("authorizedWithdrawer"),R.u8("commission")],n),Tf=(n="voteAuthorizeWithSeedArgs")=>R.struct([R.u32("voteAuthorizationType"),mt("currentAuthorityDerivedKeyOwnerPubkey"),ir("currentAuthorityDerivedKeySeed"),mt("newAuthorized")],n);function ha(n,t){const e=s=>{if(s.span>=0)return s.span;if(typeof s.alloc=="function")return s.alloc(t[s.property]);if("count"in s&&"elementLayout"in s){const i=t[s.property];if(Array.isArray(i))return i.length*e(s.elementLayout)}else if("fields"in s)return ha({layout:s},t[s.property]);return 0};let r=0;return n.layout.fields.forEach(s=>{r+=e(s)}),r}function ke(n){let t=0,e=0;for(;;){let r=n.shift();if(t|=(r&127)<<e*7,e+=1,(r&128)===0)break}return t}function Ee(n,t){let e=t;for(;;){let r=e&127;if(e>>=7,e==0){n.push(r);break}else r|=128,n.push(r)}}function bt(n,t){if(!n)throw new Error(t||"Assertion failed")}class En{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const r=new Map,s=o=>{const u=o.toBase58();let p=r.get(u);return p===void 0&&(p={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(u,p)),p},i=s(e);i.isSigner=!0,i.isWritable=!0;for(const o of t){s(o.programId).isInvoked=!0;for(const u of o.keys){const p=s(u.pubkey);p.isSigner||=u.isSigner,p.isWritable||=u.isWritable}}return new En(e,r)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];bt(t.length<=256,"Max static account keys length exceeded");const e=t.filter(([,p])=>p.isSigner&&p.isWritable),r=t.filter(([,p])=>p.isSigner&&!p.isWritable),s=t.filter(([,p])=>!p.isSigner&&p.isWritable),i=t.filter(([,p])=>!p.isSigner&&!p.isWritable),o={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{bt(e.length>0,"Expected at least one writable signer key");const[p]=e[0];bt(p===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const u=[...e.map(([p])=>new tt(p)),...r.map(([p])=>new tt(p)),...s.map(([p])=>new tt(p)),...i.map(([p])=>new tt(p))];return[o,u]}extractTableLookup(t){const[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&o.isWritable),[s,i]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&!o.isWritable);if(!(e.length===0&&s.length===0))return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:s},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(t,e){const r=new Array,s=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const u=new tt(i),p=t.findIndex(v=>v.equals(u));p>=0&&(bt(p<256,"Max lookup table index exceeded"),r.push(p),s.push(u),this.keyMetaMap.delete(i))}return[r,s]}}const la="Reached end of buffer unexpectedly";function Te(n){if(n.length===0)throw new Error(la);return n.shift()}function ve(n,...t){const[e]=t;if(t.length===2?e+(t[1]??0)>n.length:e>=n.length)throw new Error(la);return n.splice(...t)}class Ce{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new tt(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:he.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new gn(this.staticAccountKeys)}static compile(t){const e=En.compile(t.instructions,t.payerKey),[r,s]=e.getMessageComponents(),o=new gn(s).compileInstructions(t.instructions).map(u=>({programIdIndex:u.programIdIndex,accounts:u.accountKeyIndexes,data:he.encode(u.data)}));return new Ce({header:r,accountKeys:s,recentBlockhash:t.recentBlockhash,instructions:o})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const e=this.header.numRequiredSignatures;if(t>=this.header.numRequiredSignatures){const r=t-e,i=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return r<i}else{const r=e-this.header.numReadonlySignedAccounts;return t<r}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,e)=>!this.isProgramId(e))}serialize(){const t=this.accountKeys.length;let e=[];Ee(e,t);const r=this.instructions.map(P=>{const{accounts:_,programIdIndex:S}=P,T=Array.from(he.decode(P.data));let M=[];Ee(M,_.length);let N=[];return Ee(N,T.length),{programIdIndex:S,keyIndicesCount:ft.Buffer.from(M),keyIndices:_,dataLength:ft.Buffer.from(N),data:T}});let s=[];Ee(s,r.length);let i=ft.Buffer.alloc(or);ft.Buffer.from(s).copy(i);let o=s.length;r.forEach(P=>{const S=R.struct([R.u8("programIdIndex"),R.blob(P.keyIndicesCount.length,"keyIndicesCount"),R.seq(R.u8("keyIndex"),P.keyIndices.length,"keyIndices"),R.blob(P.dataLength.length,"dataLength"),R.seq(R.u8("userdatum"),P.data.length,"data")]).encode(P,i,o);o+=S}),i=i.slice(0,o);const u=R.struct([R.blob(1,"numRequiredSignatures"),R.blob(1,"numReadonlySignedAccounts"),R.blob(1,"numReadonlyUnsignedAccounts"),R.blob(e.length,"keyCount"),R.seq(mt("key"),t,"keys"),mt("recentBlockhash")]),p={numRequiredSignatures:ft.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:ft.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:ft.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:ft.Buffer.from(e),keys:this.accountKeys.map(P=>yt(P.toBytes())),recentBlockhash:he.decode(this.recentBlockhash)};let v=ft.Buffer.alloc(2048);const B=u.encode(p,v);return i.copy(v,B),v.slice(0,B+i.length)}static from(t){let e=[...t];const r=Te(e);if(r!==(r&Hi))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const s=Te(e),i=Te(e),o=ke(e);let u=[];for(let _=0;_<o;_++){const S=ve(e,0,We);u.push(new tt(ft.Buffer.from(S)))}const p=ve(e,0,We),v=ke(e);let B=[];for(let _=0;_<v;_++){const S=Te(e),T=ke(e),M=ve(e,0,T),N=ke(e),F=ve(e,0,N),H=he.encode(ft.Buffer.from(F));B.push({programIdIndex:S,accounts:M,data:H})}const P={header:{numRequiredSignatures:r,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:i},recentBlockhash:he.encode(ft.Buffer.from(p)),accountKeys:u,instructions:B};return new Ce(P)}}class Sr{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(const e of this.addressTableLookups)t+=e.readonlyIndexes.length+e.writableIndexes.length;return t}getAccountKeys(t){let e;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");e=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)e=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new gn(this.staticAccountKeys,e)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const e=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(t>=r){const s=t-r,i=this.addressTableLookups.reduce((o,u)=>o+u.writableIndexes.length,0);return s<i}else if(t>=this.header.numRequiredSignatures){const s=t-e,o=r-e-this.header.numReadonlyUnsignedAccounts;return s<o}else{const s=e-this.header.numReadonlySignedAccounts;return t<s}}resolveAddressTableLookups(t){const e={writable:[],readonly:[]};for(const r of this.addressTableLookups){const s=t.find(i=>i.key.equals(r.accountKey));if(!s)throw new Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(const i of r.writableIndexes)if(i<s.state.addresses.length)e.writable.push(s.state.addresses[i]);else throw new Error(`Failed to find address for index ${i} in address lookup table ${r.accountKey.toBase58()}`);for(const i of r.readonlyIndexes)if(i<s.state.addresses.length)e.readonly.push(s.state.addresses[i]);else throw new Error(`Failed to find address for index ${i} in address lookup table ${r.accountKey.toBase58()}`)}return e}static compile(t){const e=En.compile(t.instructions,t.payerKey),r=new Array,s={writable:new Array,readonly:new Array},i=t.addressLookupTableAccounts||[];for(const B of i){const P=e.extractTableLookup(B);if(P!==void 0){const[_,{writable:S,readonly:T}]=P;r.push(_),s.writable.push(...S),s.readonly.push(...T)}}const[o,u]=e.getMessageComponents(),v=new gn(u,s).compileInstructions(t.instructions);return new Sr({header:o,staticAccountKeys:u,recentBlockhash:t.recentBlockhash,compiledInstructions:v,addressTableLookups:r})}serialize(){const t=Array();Ee(t,this.staticAccountKeys.length);const e=this.serializeInstructions(),r=Array();Ee(r,this.compiledInstructions.length);const s=this.serializeAddressTableLookups(),i=Array();Ee(i,this.addressTableLookups.length);const o=R.struct([R.u8("prefix"),R.struct([R.u8("numRequiredSignatures"),R.u8("numReadonlySignedAccounts"),R.u8("numReadonlyUnsignedAccounts")],"header"),R.blob(t.length,"staticAccountKeysLength"),R.seq(mt(),this.staticAccountKeys.length,"staticAccountKeys"),mt("recentBlockhash"),R.blob(r.length,"instructionsLength"),R.blob(e.length,"serializedInstructions"),R.blob(i.length,"addressTableLookupsLength"),R.blob(s.length,"serializedAddressTableLookups")]),u=new Uint8Array(or),v=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(B=>B.toBytes()),recentBlockhash:he.decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:s},u);return u.slice(0,v)}serializeInstructions(){let t=0;const e=new Uint8Array(or);for(const r of this.compiledInstructions){const s=Array();Ee(s,r.accountKeyIndexes.length);const i=Array();Ee(i,r.data.length);const o=R.struct([R.u8("programIdIndex"),R.blob(s.length,"encodedAccountKeyIndexesLength"),R.seq(R.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),R.blob(i.length,"encodedDataLength"),R.blob(r.data.length,"data")]);t+=o.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(s),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:r.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(or);for(const r of this.addressTableLookups){const s=Array();Ee(s,r.writableIndexes.length);const i=Array();Ee(i,r.readonlyIndexes.length);const o=R.struct([mt("accountKey"),R.blob(s.length,"encodedWritableIndexesLength"),R.seq(R.u8(),r.writableIndexes.length,"writableIndexes"),R.blob(i.length,"encodedReadonlyIndexesLength"),R.seq(R.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);t+=o.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(s),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:r.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const r=Te(e),s=r&Hi;bt(r!==s,"Expected versioned message but received legacy message");const i=s;bt(i===0,`Expected versioned message with version 0 but found version ${i}`);const o={numRequiredSignatures:Te(e),numReadonlySignedAccounts:Te(e),numReadonlyUnsignedAccounts:Te(e)},u=[],p=ke(e);for(let T=0;T<p;T++)u.push(new tt(ve(e,0,We)));const v=he.encode(ve(e,0,We)),B=ke(e),P=[];for(let T=0;T<B;T++){const M=Te(e),N=ke(e),F=ve(e,0,N),H=ke(e),$=new Uint8Array(ve(e,0,H));P.push({programIdIndex:M,accountKeyIndexes:F,data:$})}const _=ke(e),S=[];for(let T=0;T<_;T++){const M=new tt(ve(e,0,We)),N=ke(e),F=ve(e,0,N),H=ke(e),$=ve(e,0,H);S.push({accountKey:M,writableIndexes:F,readonlyIndexes:$})}return new Sr({header:o,staticAccountKeys:u,recentBlockhash:v,compiledInstructions:P,addressTableLookups:S})}}const da={deserializeMessageVersion(n){const t=n[0],e=t&Hi;return e===t?"legacy":e},deserialize:n=>{const t=da.deserializeMessageVersion(n);if(t==="legacy")return Ce.from(n);if(t===0)return Sr.deserialize(n);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let Ye=(function(n){return n[n.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",n[n.PROCESSED=1]="PROCESSED",n[n.TIMED_OUT=2]="TIMED_OUT",n[n.NONCE_INVALID=3]="NONCE_INVALID",n})({});const Pf=ft.Buffer.alloc(pn).fill(0);class Bt{constructor(t){this.keys=void 0,this.programId=void 0,this.data=ft.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:e,isWritable:r})=>({pubkey:t.toJSON(),isSigner:e,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}class xt{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:r}=t;this.minNonceContextSlot=e,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:r}=t;this.recentBlockhash=e,this.lastValidBlockHeight=r}else{const{recentBlockhash:e,nonceInfo:r}=t;r&&(this.nonceInfo=r),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Bt(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?e=[this.nonceInfo.nonceInstruction,...this.instructions]:e=this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");e.length<1&&console.warn("No instructions provided");let r;if(this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let M=0;M<e.length;M++)if(e[M].programId===void 0)throw new Error(`Transaction instruction index ${M} has undefined program id`);const s=[],i=[];e.forEach(M=>{M.keys.forEach(F=>{i.push({...F})});const N=M.programId.toString();s.includes(N)||s.push(N)}),s.forEach(M=>{i.push({pubkey:new tt(M),isSigner:!1,isWritable:!1})});const o=[];i.forEach(M=>{const N=M.pubkey.toString(),F=o.findIndex(H=>H.pubkey.toString()===N);F>-1?(o[F].isWritable=o[F].isWritable||M.isWritable,o[F].isSigner=o[F].isSigner||M.isSigner):o.push(M)}),o.sort(function(M,N){if(M.isSigner!==N.isSigner)return M.isSigner?-1:1;if(M.isWritable!==N.isWritable)return M.isWritable?-1:1;const F={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return M.pubkey.toBase58().localeCompare(N.pubkey.toBase58(),"en",F)});const u=o.findIndex(M=>M.pubkey.equals(r));if(u>-1){const[M]=o.splice(u,1);M.isSigner=!0,M.isWritable=!0,o.unshift(M)}else o.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const M of this.signatures){const N=o.findIndex(F=>F.pubkey.equals(M.publicKey));if(N>-1)o[N].isSigner||(o[N].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${M.publicKey.toString()}`)}let p=0,v=0,B=0;const P=[],_=[];o.forEach(({pubkey:M,isSigner:N,isWritable:F})=>{N?(P.push(M.toString()),p+=1,F||(v+=1)):(_.push(M.toString()),F||(B+=1))});const S=P.concat(_),T=e.map(M=>{const{data:N,programId:F}=M;return{programIdIndex:S.indexOf(F.toString()),accounts:M.keys.map(H=>S.indexOf(H.pubkey.toString())),data:he.encode(N)}});return T.forEach(M=>{bt(M.programIdIndex>=0),M.accounts.forEach(N=>bt(N>=0))}),new Ce({header:{numRequiredSignatures:p,numReadonlySignedAccounts:v,numReadonlyUnsignedAccounts:B},accountKeys:S,recentBlockhash:t,instructions:T})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((s,i)=>e[i].equals(s.publicKey))||(this.signatures=e.map(r=>({signature:null,publicKey:r}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const e=new Set;this.signatures=t.filter(r=>{const s=r.toString();return e.has(s)?!1:(e.add(s),!0)}).map(r=>({signature:null,publicKey:r}))}sign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,r=[];for(const i of t){const o=i.publicKey.toString();e.has(o)||(e.add(o),r.push(i))}this.signatures=r.map(i=>({signature:null,publicKey:i.publicKey}));const s=this._compile();this._partialSign(s,...r)}partialSign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,r=[];for(const i of t){const o=i.publicKey.toString();e.has(o)||(e.add(o),r.push(i))}const s=this._compile();this._partialSign(s,...r)}_partialSign(t,...e){const r=t.serialize();e.forEach(s=>{const i=Vi(r,s.secretKey);this._addSignature(s.publicKey,yt(i))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){bt(e.length===64);const r=this.signatures.findIndex(s=>t.equals(s.publicKey));if(r<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=ft.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const r={};for(const{signature:s,publicKey:i}of this.signatures)s===null?e&&(r.missing||=[]).push(i):Ef(s,t,i.toBytes())||(r.invalid||=[]).push(i);return r.invalid||r.missing?r:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),s=this.serializeMessage();if(r){const i=this._getMessageSignednessErrors(s,e);if(i){let o="Signature verification failed.";throw i.invalid&&(o+=`
|
|
1
|
+
import{g as Ri,j as uo}from"./vendor-dayjs-v0j1UNZp.js";import{eL as La}from"./index-DXwCOxQx.js";import{E as fo}from"./index-9HGDSJTR.js";import"./vendor-vue-NSDaktjZ.js";import"./vendor-axios-B8_nURbH.js";import"./vendor-vue-router-Kg6s1a65.js";var Gn={},Br={},as;function Ca(){if(as)return Br;as=1,Br.byteLength=u,Br.toByteArray=v,Br.fromByteArray=_;for(var n=[],t=[],e=typeof Uint8Array<"u"?Uint8Array:Array,r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,i=r.length;s<i;++s)n[s]=r[s],t[r.charCodeAt(s)]=s;t[45]=62,t[95]=63;function o(S){var T=S.length;if(T%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var M=S.indexOf("=");M===-1&&(M=T);var N=M===T?0:4-M%4;return[M,N]}function u(S){var T=o(S),M=T[0],N=T[1];return(M+N)*3/4-N}function p(S,T,M){return(T+M)*3/4-M}function v(S){var T,M=o(S),N=M[0],F=M[1],H=new e(p(S,N,F)),$=0,Y=F>0?N-4:N,X;for(X=0;X<Y;X+=4)T=t[S.charCodeAt(X)]<<18|t[S.charCodeAt(X+1)]<<12|t[S.charCodeAt(X+2)]<<6|t[S.charCodeAt(X+3)],H[$++]=T>>16&255,H[$++]=T>>8&255,H[$++]=T&255;return F===2&&(T=t[S.charCodeAt(X)]<<2|t[S.charCodeAt(X+1)]>>4,H[$++]=T&255),F===1&&(T=t[S.charCodeAt(X)]<<10|t[S.charCodeAt(X+1)]<<4|t[S.charCodeAt(X+2)]>>2,H[$++]=T>>8&255,H[$++]=T&255),H}function B(S){return n[S>>18&63]+n[S>>12&63]+n[S>>6&63]+n[S&63]}function P(S,T,M){for(var N,F=[],H=T;H<M;H+=3)N=(S[H]<<16&16711680)+(S[H+1]<<8&65280)+(S[H+2]&255),F.push(B(N));return F.join("")}function _(S){for(var T,M=S.length,N=M%3,F=[],H=16383,$=0,Y=M-N;$<Y;$+=H)F.push(P(S,$,$+H>Y?Y:$+H));return N===1?(T=S[M-1],F.push(n[T>>2]+n[T<<4&63]+"==")):N===2&&(T=(S[M-2]<<8)+S[M-1],F.push(n[T>>10]+n[T>>4&63]+n[T<<2&63]+"=")),F.join("")}return Br}var Gr={};var cs;function Ua(){return cs||(cs=1,Gr.read=function(n,t,e,r,s){var i,o,u=s*8-r-1,p=(1<<u)-1,v=p>>1,B=-7,P=e?s-1:0,_=e?-1:1,S=n[t+P];for(P+=_,i=S&(1<<-B)-1,S>>=-B,B+=u;B>0;i=i*256+n[t+P],P+=_,B-=8);for(o=i&(1<<-B)-1,i>>=-B,B+=r;B>0;o=o*256+n[t+P],P+=_,B-=8);if(i===0)i=1-v;else{if(i===p)return o?NaN:(S?-1:1)*(1/0);o=o+Math.pow(2,r),i=i-v}return(S?-1:1)*o*Math.pow(2,i-r)},Gr.write=function(n,t,e,r,s,i){var o,u,p,v=i*8-s-1,B=(1<<v)-1,P=B>>1,_=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,S=r?0:i-1,T=r?1:-1,M=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(u=isNaN(t)?1:0,o=B):(o=Math.floor(Math.log(t)/Math.LN2),t*(p=Math.pow(2,-o))<1&&(o--,p*=2),o+P>=1?t+=_/p:t+=_*Math.pow(2,1-P),t*p>=2&&(o++,p/=2),o+P>=B?(u=0,o=B):o+P>=1?(u=(t*p-1)*Math.pow(2,s),o=o+P):(u=t*Math.pow(2,P-1)*Math.pow(2,s),o=0));s>=8;n[e+S]=u&255,S+=T,u/=256,s-=8);for(o=o<<s|u,v+=s;v>0;n[e+S]=o&255,S+=T,o/=256,v-=8);n[e+S-T]|=M*128}),Gr}var us;function Mi(){return us||(us=1,(function(n){const t=Ca(),e=Ua(),r=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;n.Buffer=u,n.SlowBuffer=H,n.INSPECT_MAX_BYTES=50;const s=2147483647;n.kMaxLength=s,u.TYPED_ARRAY_SUPPORT=i(),!u.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function i(){try{const m=new Uint8Array(1),h={foo:function(){return 42}};return Object.setPrototypeOf(h,Uint8Array.prototype),Object.setPrototypeOf(m,h),m.foo()===42}catch{return!1}}Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}});function o(m){if(m>s)throw new RangeError('The value "'+m+'" is invalid for option "size"');const h=new Uint8Array(m);return Object.setPrototypeOf(h,u.prototype),h}function u(m,h,d){if(typeof m=="number"){if(typeof h=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return P(m)}return p(m,h,d)}u.poolSize=8192;function p(m,h,d){if(typeof m=="string")return _(m,h);if(ArrayBuffer.isView(m))return T(m);if(m==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m);if(xe(m,ArrayBuffer)||m&&xe(m.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(xe(m,SharedArrayBuffer)||m&&xe(m.buffer,SharedArrayBuffer)))return M(m,h,d);if(typeof m=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');const x=m.valueOf&&m.valueOf();if(x!=null&&x!==m)return u.from(x,h,d);const O=N(m);if(O)return O;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof m[Symbol.toPrimitive]=="function")return u.from(m[Symbol.toPrimitive]("string"),h,d);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof m)}u.from=function(m,h,d){return p(m,h,d)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array);function v(m){if(typeof m!="number")throw new TypeError('"size" argument must be of type number');if(m<0)throw new RangeError('The value "'+m+'" is invalid for option "size"')}function B(m,h,d){return v(m),m<=0?o(m):h!==void 0?typeof d=="string"?o(m).fill(h,d):o(m).fill(h):o(m)}u.alloc=function(m,h,d){return B(m,h,d)};function P(m){return v(m),o(m<0?0:F(m)|0)}u.allocUnsafe=function(m){return P(m)},u.allocUnsafeSlow=function(m){return P(m)};function _(m,h){if((typeof h!="string"||h==="")&&(h="utf8"),!u.isEncoding(h))throw new TypeError("Unknown encoding: "+h);const d=$(m,h)|0;let x=o(d);const O=x.write(m,h);return O!==d&&(x=x.slice(0,O)),x}function S(m){const h=m.length<0?0:F(m.length)|0,d=o(h);for(let x=0;x<h;x+=1)d[x]=m[x]&255;return d}function T(m){if(xe(m,Uint8Array)){const h=new Uint8Array(m);return M(h.buffer,h.byteOffset,h.byteLength)}return S(m)}function M(m,h,d){if(h<0||m.byteLength<h)throw new RangeError('"offset" is outside of buffer bounds');if(m.byteLength<h+(d||0))throw new RangeError('"length" is outside of buffer bounds');let x;return h===void 0&&d===void 0?x=new Uint8Array(m):d===void 0?x=new Uint8Array(m,h):x=new Uint8Array(m,h,d),Object.setPrototypeOf(x,u.prototype),x}function N(m){if(u.isBuffer(m)){const h=F(m.length)|0,d=o(h);return d.length===0||m.copy(d,0,0,h),d}if(m.length!==void 0)return typeof m.length!="number"||Lt(m.length)?o(0):S(m);if(m.type==="Buffer"&&Array.isArray(m.data))return S(m.data)}function F(m){if(m>=s)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+s.toString(16)+" bytes");return m|0}function H(m){return+m!=m&&(m=0),u.alloc(+m)}u.isBuffer=function(h){return h!=null&&h._isBuffer===!0&&h!==u.prototype},u.compare=function(h,d){if(xe(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),xe(d,Uint8Array)&&(d=u.from(d,d.offset,d.byteLength)),!u.isBuffer(h)||!u.isBuffer(d))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(h===d)return 0;let x=h.length,O=d.length;for(let K=0,G=Math.min(x,O);K<G;++K)if(h[K]!==d[K]){x=h[K],O=d[K];break}return x<O?-1:O<x?1:0},u.isEncoding=function(h){switch(String(h).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(h,d){if(!Array.isArray(h))throw new TypeError('"list" argument must be an Array of Buffers');if(h.length===0)return u.alloc(0);let x;if(d===void 0)for(d=0,x=0;x<h.length;++x)d+=h[x].length;const O=u.allocUnsafe(d);let K=0;for(x=0;x<h.length;++x){let G=h[x];if(xe(G,Uint8Array))K+G.length>O.length?(u.isBuffer(G)||(G=u.from(G)),G.copy(O,K)):Uint8Array.prototype.set.call(O,G,K);else if(u.isBuffer(G))G.copy(O,K);else throw new TypeError('"list" argument must be an Array of Buffers');K+=G.length}return O};function $(m,h){if(u.isBuffer(m))return m.length;if(ArrayBuffer.isView(m)||xe(m,ArrayBuffer))return m.byteLength;if(typeof m!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof m);const d=m.length,x=arguments.length>2&&arguments[2]===!0;if(!x&&d===0)return 0;let O=!1;for(;;)switch(h){case"ascii":case"latin1":case"binary":return d;case"utf8":case"utf-8":return Pt(m).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return d*2;case"hex":return d>>>1;case"base64":return Ct(m).length;default:if(O)return x?-1:Pt(m).length;h=(""+h).toLowerCase(),O=!0}}u.byteLength=$;function Y(m,h,d){let x=!1;if((h===void 0||h<0)&&(h=0),h>this.length||((d===void 0||d>this.length)&&(d=this.length),d<=0)||(d>>>=0,h>>>=0,d<=h))return"";for(m||(m="utf8");;)switch(m){case"hex":return A(this,h,d);case"utf8":case"utf-8":return a(this,h,d);case"ascii":return k(this,h,d);case"latin1":case"binary":return E(this,h,d);case"base64":return y(this,h,d);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return L(this,h,d);default:if(x)throw new TypeError("Unknown encoding: "+m);m=(m+"").toLowerCase(),x=!0}}u.prototype._isBuffer=!0;function X(m,h,d){const x=m[h];m[h]=m[d],m[d]=x}u.prototype.swap16=function(){const h=this.length;if(h%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let d=0;d<h;d+=2)X(this,d,d+1);return this},u.prototype.swap32=function(){const h=this.length;if(h%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let d=0;d<h;d+=4)X(this,d,d+3),X(this,d+1,d+2);return this},u.prototype.swap64=function(){const h=this.length;if(h%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let d=0;d<h;d+=8)X(this,d,d+7),X(this,d+1,d+6),X(this,d+2,d+5),X(this,d+3,d+4);return this},u.prototype.toString=function(){const h=this.length;return h===0?"":arguments.length===0?a(this,0,h):Y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(h){if(!u.isBuffer(h))throw new TypeError("Argument must be a Buffer");return this===h?!0:u.compare(this,h)===0},u.prototype.inspect=function(){let h="";const d=n.INSPECT_MAX_BYTES;return h=this.toString("hex",0,d).replace(/(.{2})/g,"$1 ").trim(),this.length>d&&(h+=" ... "),"<Buffer "+h+">"},r&&(u.prototype[r]=u.prototype.inspect),u.prototype.compare=function(h,d,x,O,K){if(xe(h,Uint8Array)&&(h=u.from(h,h.offset,h.byteLength)),!u.isBuffer(h))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof h);if(d===void 0&&(d=0),x===void 0&&(x=h?h.length:0),O===void 0&&(O=0),K===void 0&&(K=this.length),d<0||x>h.length||O<0||K>this.length)throw new RangeError("out of range index");if(O>=K&&d>=x)return 0;if(O>=K)return-1;if(d>=x)return 1;if(d>>>=0,x>>>=0,O>>>=0,K>>>=0,this===h)return 0;let G=K-O,pt=x-d;const dt=Math.min(G,pt),lt=this.slice(O,K),Mt=h.slice(d,x);for(let ht=0;ht<dt;++ht)if(lt[ht]!==Mt[ht]){G=lt[ht],pt=Mt[ht];break}return G<pt?-1:pt<G?1:0};function Q(m,h,d,x,O){if(m.length===0)return-1;if(typeof d=="string"?(x=d,d=0):d>2147483647?d=2147483647:d<-2147483648&&(d=-2147483648),d=+d,Lt(d)&&(d=O?0:m.length-1),d<0&&(d=m.length+d),d>=m.length){if(O)return-1;d=m.length-1}else if(d<0)if(O)d=0;else return-1;if(typeof h=="string"&&(h=u.from(h,x)),u.isBuffer(h))return h.length===0?-1:ct(m,h,d,x,O);if(typeof h=="number")return h=h&255,typeof Uint8Array.prototype.indexOf=="function"?O?Uint8Array.prototype.indexOf.call(m,h,d):Uint8Array.prototype.lastIndexOf.call(m,h,d):ct(m,[h],d,x,O);throw new TypeError("val must be string, number or Buffer")}function ct(m,h,d,x,O){let K=1,G=m.length,pt=h.length;if(x!==void 0&&(x=String(x).toLowerCase(),x==="ucs2"||x==="ucs-2"||x==="utf16le"||x==="utf-16le")){if(m.length<2||h.length<2)return-1;K=2,G/=2,pt/=2,d/=2}function dt(Mt,ht){return K===1?Mt[ht]:Mt.readUInt16BE(ht*K)}let lt;if(O){let Mt=-1;for(lt=d;lt<G;lt++)if(dt(m,lt)===dt(h,Mt===-1?0:lt-Mt)){if(Mt===-1&&(Mt=lt),lt-Mt+1===pt)return Mt*K}else Mt!==-1&&(lt-=lt-Mt),Mt=-1}else for(d+pt>G&&(d=G-pt),lt=d;lt>=0;lt--){let Mt=!0;for(let ht=0;ht<pt;ht++)if(dt(m,lt+ht)!==dt(h,ht)){Mt=!1;break}if(Mt)return lt}return-1}u.prototype.includes=function(h,d,x){return this.indexOf(h,d,x)!==-1},u.prototype.indexOf=function(h,d,x){return Q(this,h,d,x,!0)},u.prototype.lastIndexOf=function(h,d,x){return Q(this,h,d,x,!1)};function ot(m,h,d,x){d=Number(d)||0;const O=m.length-d;x?(x=Number(x),x>O&&(x=O)):x=O;const K=h.length;x>K/2&&(x=K/2);let G;for(G=0;G<x;++G){const pt=parseInt(h.substr(G*2,2),16);if(Lt(pt))return G;m[d+G]=pt}return G}function C(m,h,d,x){return Rt(Pt(h,m.length-d),m,d,x)}function U(m,h,d,x){return Rt(Ft(h),m,d,x)}function D(m,h,d,x){return Rt(Ct(h),m,d,x)}function V(m,h,d,x){return Rt(Hr(h,m.length-d),m,d,x)}u.prototype.write=function(h,d,x,O){if(d===void 0)O="utf8",x=this.length,d=0;else if(x===void 0&&typeof d=="string")O=d,x=this.length,d=0;else if(isFinite(d))d=d>>>0,isFinite(x)?(x=x>>>0,O===void 0&&(O="utf8")):(O=x,x=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");const K=this.length-d;if((x===void 0||x>K)&&(x=K),h.length>0&&(x<0||d<0)||d>this.length)throw new RangeError("Attempt to write outside buffer bounds");O||(O="utf8");let G=!1;for(;;)switch(O){case"hex":return ot(this,h,d,x);case"utf8":case"utf-8":return C(this,h,d,x);case"ascii":case"latin1":case"binary":return U(this,h,d,x);case"base64":return D(this,h,d,x);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return V(this,h,d,x);default:if(G)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),G=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function y(m,h,d){return h===0&&d===m.length?t.fromByteArray(m):t.fromByteArray(m.slice(h,d))}function a(m,h,d){d=Math.min(m.length,d);const x=[];let O=h;for(;O<d;){const K=m[O];let G=null,pt=K>239?4:K>223?3:K>191?2:1;if(O+pt<=d){let dt,lt,Mt,ht;switch(pt){case 1:K<128&&(G=K);break;case 2:dt=m[O+1],(dt&192)===128&&(ht=(K&31)<<6|dt&63,ht>127&&(G=ht));break;case 3:dt=m[O+1],lt=m[O+2],(dt&192)===128&&(lt&192)===128&&(ht=(K&15)<<12|(dt&63)<<6|lt&63,ht>2047&&(ht<55296||ht>57343)&&(G=ht));break;case 4:dt=m[O+1],lt=m[O+2],Mt=m[O+3],(dt&192)===128&&(lt&192)===128&&(Mt&192)===128&&(ht=(K&15)<<18|(dt&63)<<12|(lt&63)<<6|Mt&63,ht>65535&&ht<1114112&&(G=ht))}}G===null?(G=65533,pt=1):G>65535&&(G-=65536,x.push(G>>>10&1023|55296),G=56320|G&1023),x.push(G),O+=pt}return g(x)}const l=4096;function g(m){const h=m.length;if(h<=l)return String.fromCharCode.apply(String,m);let d="",x=0;for(;x<h;)d+=String.fromCharCode.apply(String,m.slice(x,x+=l));return d}function k(m,h,d){let x="";d=Math.min(m.length,d);for(let O=h;O<d;++O)x+=String.fromCharCode(m[O]&127);return x}function E(m,h,d){let x="";d=Math.min(m.length,d);for(let O=h;O<d;++O)x+=String.fromCharCode(m[O]);return x}function A(m,h,d){const x=m.length;(!h||h<0)&&(h=0),(!d||d<0||d>x)&&(d=x);let O="";for(let K=h;K<d;++K)O+=zt[m[K]];return O}function L(m,h,d){const x=m.slice(h,d);let O="";for(let K=0;K<x.length-1;K+=2)O+=String.fromCharCode(x[K]+x[K+1]*256);return O}u.prototype.slice=function(h,d){const x=this.length;h=~~h,d=d===void 0?x:~~d,h<0?(h+=x,h<0&&(h=0)):h>x&&(h=x),d<0?(d+=x,d<0&&(d=0)):d>x&&(d=x),d<h&&(d=h);const O=this.subarray(h,d);return Object.setPrototypeOf(O,u.prototype),O};function b(m,h,d){if(m%1!==0||m<0)throw new RangeError("offset is not uint");if(m+h>d)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUintLE=u.prototype.readUIntLE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=this[h],K=1,G=0;for(;++G<d&&(K*=256);)O+=this[h+G]*K;return O},u.prototype.readUintBE=u.prototype.readUIntBE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=this[h+--d],K=1;for(;d>0&&(K*=256);)O+=this[h+--d]*K;return O},u.prototype.readUint8=u.prototype.readUInt8=function(h,d){return h=h>>>0,d||b(h,1,this.length),this[h]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(h,d){return h=h>>>0,d||b(h,2,this.length),this[h]|this[h+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(h,d){return h=h>>>0,d||b(h,2,this.length),this[h]<<8|this[h+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(h,d){return h=h>>>0,d||b(h,4,this.length),(this[h]|this[h+1]<<8|this[h+2]<<16)+this[h+3]*16777216},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(h,d){return h=h>>>0,d||b(h,4,this.length),this[h]*16777216+(this[h+1]<<16|this[h+2]<<8|this[h+3])},u.prototype.readBigUInt64LE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=d+this[++h]*2**8+this[++h]*2**16+this[++h]*2**24,K=this[++h]+this[++h]*2**8+this[++h]*2**16+x*2**24;return BigInt(O)+(BigInt(K)<<BigInt(32))}),u.prototype.readBigUInt64BE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=d*2**24+this[++h]*2**16+this[++h]*2**8+this[++h],K=this[++h]*2**24+this[++h]*2**16+this[++h]*2**8+x;return(BigInt(O)<<BigInt(32))+BigInt(K)}),u.prototype.readIntLE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=this[h],K=1,G=0;for(;++G<d&&(K*=256);)O+=this[h+G]*K;return K*=128,O>=K&&(O-=Math.pow(2,8*d)),O},u.prototype.readIntBE=function(h,d,x){h=h>>>0,d=d>>>0,x||b(h,d,this.length);let O=d,K=1,G=this[h+--O];for(;O>0&&(K*=256);)G+=this[h+--O]*K;return K*=128,G>=K&&(G-=Math.pow(2,8*d)),G},u.prototype.readInt8=function(h,d){return h=h>>>0,d||b(h,1,this.length),this[h]&128?(255-this[h]+1)*-1:this[h]},u.prototype.readInt16LE=function(h,d){h=h>>>0,d||b(h,2,this.length);const x=this[h]|this[h+1]<<8;return x&32768?x|4294901760:x},u.prototype.readInt16BE=function(h,d){h=h>>>0,d||b(h,2,this.length);const x=this[h+1]|this[h]<<8;return x&32768?x|4294901760:x},u.prototype.readInt32LE=function(h,d){return h=h>>>0,d||b(h,4,this.length),this[h]|this[h+1]<<8|this[h+2]<<16|this[h+3]<<24},u.prototype.readInt32BE=function(h,d){return h=h>>>0,d||b(h,4,this.length),this[h]<<24|this[h+1]<<16|this[h+2]<<8|this[h+3]},u.prototype.readBigInt64LE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=this[h+4]+this[h+5]*2**8+this[h+6]*2**16+(x<<24);return(BigInt(O)<<BigInt(32))+BigInt(d+this[++h]*2**8+this[++h]*2**16+this[++h]*2**24)}),u.prototype.readBigInt64BE=Ae(function(h){h=h>>>0,Ie(h,"offset");const d=this[h],x=this[h+7];(d===void 0||x===void 0)&&At(h,this.length-8);const O=(d<<24)+this[++h]*2**16+this[++h]*2**8+this[++h];return(BigInt(O)<<BigInt(32))+BigInt(this[++h]*2**24+this[++h]*2**16+this[++h]*2**8+x)}),u.prototype.readFloatLE=function(h,d){return h=h>>>0,d||b(h,4,this.length),e.read(this,h,!0,23,4)},u.prototype.readFloatBE=function(h,d){return h=h>>>0,d||b(h,4,this.length),e.read(this,h,!1,23,4)},u.prototype.readDoubleLE=function(h,d){return h=h>>>0,d||b(h,8,this.length),e.read(this,h,!0,52,8)},u.prototype.readDoubleBE=function(h,d){return h=h>>>0,d||b(h,8,this.length),e.read(this,h,!1,52,8)};function c(m,h,d,x,O,K){if(!u.isBuffer(m))throw new TypeError('"buffer" argument must be a Buffer instance');if(h>O||h<K)throw new RangeError('"value" argument is out of bounds');if(d+x>m.length)throw new RangeError("Index out of range")}u.prototype.writeUintLE=u.prototype.writeUIntLE=function(h,d,x,O){if(h=+h,d=d>>>0,x=x>>>0,!O){const pt=Math.pow(2,8*x)-1;c(this,h,d,x,pt,0)}let K=1,G=0;for(this[d]=h&255;++G<x&&(K*=256);)this[d+G]=h/K&255;return d+x},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(h,d,x,O){if(h=+h,d=d>>>0,x=x>>>0,!O){const pt=Math.pow(2,8*x)-1;c(this,h,d,x,pt,0)}let K=x-1,G=1;for(this[d+K]=h&255;--K>=0&&(G*=256);)this[d+K]=h/G&255;return d+x},u.prototype.writeUint8=u.prototype.writeUInt8=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,1,255,0),this[d]=h&255,d+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,65535,0),this[d]=h&255,this[d+1]=h>>>8,d+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,65535,0),this[d]=h>>>8,this[d+1]=h&255,d+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,4294967295,0),this[d+3]=h>>>24,this[d+2]=h>>>16,this[d+1]=h>>>8,this[d]=h&255,d+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,4294967295,0),this[d]=h>>>24,this[d+1]=h>>>16,this[d+2]=h>>>8,this[d+3]=h&255,d+4};function f(m,h,d,x,O){It(h,x,O,m,d,7);let K=Number(h&BigInt(4294967295));m[d++]=K,K=K>>8,m[d++]=K,K=K>>8,m[d++]=K,K=K>>8,m[d++]=K;let G=Number(h>>BigInt(32)&BigInt(4294967295));return m[d++]=G,G=G>>8,m[d++]=G,G=G>>8,m[d++]=G,G=G>>8,m[d++]=G,d}function w(m,h,d,x,O){It(h,x,O,m,d,7);let K=Number(h&BigInt(4294967295));m[d+7]=K,K=K>>8,m[d+6]=K,K=K>>8,m[d+5]=K,K=K>>8,m[d+4]=K;let G=Number(h>>BigInt(32)&BigInt(4294967295));return m[d+3]=G,G=G>>8,m[d+2]=G,G=G>>8,m[d+1]=G,G=G>>8,m[d]=G,d+8}u.prototype.writeBigUInt64LE=Ae(function(h,d=0){return f(this,h,d,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeBigUInt64BE=Ae(function(h,d=0){return w(this,h,d,BigInt(0),BigInt("0xffffffffffffffff"))}),u.prototype.writeIntLE=function(h,d,x,O){if(h=+h,d=d>>>0,!O){const dt=Math.pow(2,8*x-1);c(this,h,d,x,dt-1,-dt)}let K=0,G=1,pt=0;for(this[d]=h&255;++K<x&&(G*=256);)h<0&&pt===0&&this[d+K-1]!==0&&(pt=1),this[d+K]=(h/G>>0)-pt&255;return d+x},u.prototype.writeIntBE=function(h,d,x,O){if(h=+h,d=d>>>0,!O){const dt=Math.pow(2,8*x-1);c(this,h,d,x,dt-1,-dt)}let K=x-1,G=1,pt=0;for(this[d+K]=h&255;--K>=0&&(G*=256);)h<0&&pt===0&&this[d+K+1]!==0&&(pt=1),this[d+K]=(h/G>>0)-pt&255;return d+x},u.prototype.writeInt8=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,1,127,-128),h<0&&(h=255+h+1),this[d]=h&255,d+1},u.prototype.writeInt16LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,32767,-32768),this[d]=h&255,this[d+1]=h>>>8,d+2},u.prototype.writeInt16BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,2,32767,-32768),this[d]=h>>>8,this[d+1]=h&255,d+2},u.prototype.writeInt32LE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,2147483647,-2147483648),this[d]=h&255,this[d+1]=h>>>8,this[d+2]=h>>>16,this[d+3]=h>>>24,d+4},u.prototype.writeInt32BE=function(h,d,x){return h=+h,d=d>>>0,x||c(this,h,d,4,2147483647,-2147483648),h<0&&(h=4294967295+h+1),this[d]=h>>>24,this[d+1]=h>>>16,this[d+2]=h>>>8,this[d+3]=h&255,d+4},u.prototype.writeBigInt64LE=Ae(function(h,d=0){return f(this,h,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),u.prototype.writeBigInt64BE=Ae(function(h,d=0){return w(this,h,d,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function I(m,h,d,x,O,K){if(d+x>m.length)throw new RangeError("Index out of range");if(d<0)throw new RangeError("Index out of range")}function z(m,h,d,x,O){return h=+h,d=d>>>0,O||I(m,h,d,4),e.write(m,h,d,x,23,4),d+4}u.prototype.writeFloatLE=function(h,d,x){return z(this,h,d,!0,x)},u.prototype.writeFloatBE=function(h,d,x){return z(this,h,d,!1,x)};function j(m,h,d,x,O){return h=+h,d=d>>>0,O||I(m,h,d,8),e.write(m,h,d,x,52,8),d+8}u.prototype.writeDoubleLE=function(h,d,x){return j(this,h,d,!0,x)},u.prototype.writeDoubleBE=function(h,d,x){return j(this,h,d,!1,x)},u.prototype.copy=function(h,d,x,O){if(!u.isBuffer(h))throw new TypeError("argument should be a Buffer");if(x||(x=0),!O&&O!==0&&(O=this.length),d>=h.length&&(d=h.length),d||(d=0),O>0&&O<x&&(O=x),O===x||h.length===0||this.length===0)return 0;if(d<0)throw new RangeError("targetStart out of bounds");if(x<0||x>=this.length)throw new RangeError("Index out of range");if(O<0)throw new RangeError("sourceEnd out of bounds");O>this.length&&(O=this.length),h.length-d<O-x&&(O=h.length-d+x);const K=O-x;return this===h&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(d,x,O):Uint8Array.prototype.set.call(h,this.subarray(x,O),d),K},u.prototype.fill=function(h,d,x,O){if(typeof h=="string"){if(typeof d=="string"?(O=d,d=0,x=this.length):typeof x=="string"&&(O=x,x=this.length),O!==void 0&&typeof O!="string")throw new TypeError("encoding must be a string");if(typeof O=="string"&&!u.isEncoding(O))throw new TypeError("Unknown encoding: "+O);if(h.length===1){const G=h.charCodeAt(0);(O==="utf8"&&G<128||O==="latin1")&&(h=G)}}else typeof h=="number"?h=h&255:typeof h=="boolean"&&(h=Number(h));if(d<0||this.length<d||this.length<x)throw new RangeError("Out of range index");if(x<=d)return this;d=d>>>0,x=x===void 0?this.length:x>>>0,h||(h=0);let K;if(typeof h=="number")for(K=d;K<x;++K)this[K]=h;else{const G=u.isBuffer(h)?h:u.from(h,O),pt=G.length;if(pt===0)throw new TypeError('The value "'+h+'" is invalid for argument "value"');for(K=0;K<x-d;++K)this[K+d]=G[K%pt]}return this};const rt={};function st(m,h,d){rt[m]=class extends d{constructor(){super(),Object.defineProperty(this,"message",{value:h.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${m}]`,this.stack,delete this.name}get code(){return m}set code(O){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:O,writable:!0})}toString(){return`${this.name} [${m}]: ${this.message}`}}}st("ERR_BUFFER_OUT_OF_BOUNDS",function(m){return m?`${m} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),st("ERR_INVALID_ARG_TYPE",function(m,h){return`The "${m}" argument must be of type number. Received type ${typeof h}`},TypeError),st("ERR_OUT_OF_RANGE",function(m,h,d){let x=`The value of "${m}" is out of range.`,O=d;return Number.isInteger(d)&&Math.abs(d)>2**32?O=kt(String(d)):typeof d=="bigint"&&(O=String(d),(d>BigInt(2)**BigInt(32)||d<-(BigInt(2)**BigInt(32)))&&(O=kt(O)),O+="n"),x+=` It must be ${h}. Received ${O}`,x},RangeError);function kt(m){let h="",d=m.length;const x=m[0]==="-"?1:0;for(;d>=x+4;d-=3)h=`_${m.slice(d-3,d)}${h}`;return`${m.slice(0,d)}${h}`}function vt(m,h,d){Ie(h,"offset"),(m[h]===void 0||m[h+d]===void 0)&&At(h,m.length-(d+1))}function It(m,h,d,x,O,K){if(m>d||m<h){const G=typeof h=="bigint"?"n":"";let pt;throw h===0||h===BigInt(0)?pt=`>= 0${G} and < 2${G} ** ${(K+1)*8}${G}`:pt=`>= -(2${G} ** ${(K+1)*8-1}${G}) and < 2 ** ${(K+1)*8-1}${G}`,new rt.ERR_OUT_OF_RANGE("value",pt,m)}vt(x,O,K)}function Ie(m,h){if(typeof m!="number")throw new rt.ERR_INVALID_ARG_TYPE(h,"number",m)}function At(m,h,d){throw Math.floor(m)!==m?(Ie(m,d),new rt.ERR_OUT_OF_RANGE("offset","an integer",m)):h<0?new rt.ERR_BUFFER_OUT_OF_BOUNDS:new rt.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${h}`,m)}const Nt=/[^+/0-9A-Za-z-_]/g;function Vr(m){if(m=m.split("=")[0],m=m.trim().replace(Nt,""),m.length<2)return"";for(;m.length%4!==0;)m=m+"=";return m}function Pt(m,h){h=h||1/0;let d;const x=m.length;let O=null;const K=[];for(let G=0;G<x;++G){if(d=m.charCodeAt(G),d>55295&&d<57344){if(!O){if(d>56319){(h-=3)>-1&&K.push(239,191,189);continue}else if(G+1===x){(h-=3)>-1&&K.push(239,191,189);continue}O=d;continue}if(d<56320){(h-=3)>-1&&K.push(239,191,189),O=d;continue}d=(O-55296<<10|d-56320)+65536}else O&&(h-=3)>-1&&K.push(239,191,189);if(O=null,d<128){if((h-=1)<0)break;K.push(d)}else if(d<2048){if((h-=2)<0)break;K.push(d>>6|192,d&63|128)}else if(d<65536){if((h-=3)<0)break;K.push(d>>12|224,d>>6&63|128,d&63|128)}else if(d<1114112){if((h-=4)<0)break;K.push(d>>18|240,d>>12&63|128,d>>6&63|128,d&63|128)}else throw new Error("Invalid code point")}return K}function Ft(m){const h=[];for(let d=0;d<m.length;++d)h.push(m.charCodeAt(d)&255);return h}function Hr(m,h){let d,x,O;const K=[];for(let G=0;G<m.length&&!((h-=2)<0);++G)d=m.charCodeAt(G),x=d>>8,O=d%256,K.push(O),K.push(x);return K}function Ct(m){return t.toByteArray(Vr(m))}function Rt(m,h,d,x){let O;for(O=0;O<x&&!(O+d>=h.length||O>=m.length);++O)h[O+d]=m[O];return O}function xe(m,h){return m instanceof h||m!=null&&m.constructor!=null&&m.constructor.name!=null&&m.constructor.name===h.name}function Lt(m){return m!==m}const zt=(function(){const m="0123456789abcdef",h=new Array(256);for(let d=0;d<16;++d){const x=d*16;for(let O=0;O<16;++O)h[x+O]=m[d]+m[O]}return h})();function Ae(m){return typeof BigInt>"u"?Kt:m}function Kt(){throw new Error("BigInt not supported")}})(Gn)),Gn}var ft=Mi();const lr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Fr(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Cr(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function $e(n,...t){if(!Fr(n))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(n.length))throw new Error("Uint8Array expected of length "+t+", got length="+n.length)}function ho(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Cr(n.outputLen),Cr(n.blockLen)}function br(n,t=!0){if(n.destroyed)throw new Error("Hash instance has been destroyed");if(t&&n.finished)throw new Error("Hash#digest() has already been called")}function lo(n,t){$e(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function Oa(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function Qe(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function jn(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Re(n,t){return n<<32-t|n>>>t}const Na=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Fa(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}function za(n){for(let t=0;t<n.length;t++)n[t]=Fa(n[t]);return n}const fs=Na?n=>n:za,po=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ka=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function sr(n){if($e(n),po)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Ka[n[e]];return t}const Oe={_0:48,_9:57,A:65,F:70,a:97,f:102};function hs(n){if(n>=Oe._0&&n<=Oe._9)return n-Oe._0;if(n>=Oe.A&&n<=Oe.F)return n-(Oe.A-10);if(n>=Oe.a&&n<=Oe.f)return n-(Oe.a-10)}function sn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(po)return Uint8Array.fromHex(n);const t=n.length,e=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(e);for(let s=0,i=0;s<e;s++,i+=2){const o=hs(n.charCodeAt(i)),u=hs(n.charCodeAt(i+1));if(o===void 0||u===void 0){const p=n[i]+n[i+1];throw new Error('hex string expected, got non-hex character "'+p+'" at index '+i)}r[s]=o*16+u}return r}function qa(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function wn(n){return typeof n=="string"&&(n=qa(n)),$e(n),n}function Me(...n){let t=0;for(let r=0;r<n.length;r++){const s=n[r];$e(s),t+=s.length}const e=new Uint8Array(t);for(let r=0,s=0;r<n.length;r++){const i=n[r];e.set(i,s),s+=i.length}return e}class Ti{}function Pi(n){const t=r=>n().update(wn(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Li(n=32){if(lr&&typeof lr.getRandomValues=="function")return lr.getRandomValues(new Uint8Array(n));if(lr&&typeof lr.randomBytes=="function")return Uint8Array.from(lr.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function Da(n,t,e,r){if(typeof n.setBigUint64=="function")return n.setBigUint64(t,e,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(e>>s&i),u=Number(e&i),p=r?4:0,v=r?0:4;n.setUint32(t+p,o,r),n.setUint32(t+v,u,r)}function Wa(n,t,e){return n&t^~n&e}function $a(n,t,e){return n&t^n&e^t&e}class go extends Ti{constructor(t,e,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=jn(this.buffer)}update(t){br(this),t=wn(t),$e(t);const{view:e,buffer:r,blockLen:s}=this,i=t.length;for(let o=0;o<i;){const u=Math.min(s-this.pos,i-o);if(u===s){const p=jn(t);for(;s<=i-o;o+=s)this.process(p,o);continue}r.set(t.subarray(o,o+u),this.pos),this.pos+=u,o+=u,this.pos===s&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){br(this),lo(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;e[o++]=128,Qe(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let P=o;P<s;P++)e[P]=0;Da(r,s-8,BigInt(this.length*8),i),this.process(r,0);const u=jn(t),p=this.outputLen;if(p%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const v=p/4,B=this.get();if(v>B.length)throw new Error("_sha2: outputLen bigger than state");for(let P=0;P<v;P++)u.setUint32(4*P,B[P],i)}digest(){const{buffer:t,outputLen:e}=this;this.digestInto(t);const r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:e,buffer:r,length:s,finished:i,destroyed:o,pos:u}=this;return t.destroyed=o,t.finished=i,t.length=s,t.pos=u,s%e&&t.buffer.set(r),t}clone(){return this._cloneInto()}}const Ve=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),pe=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),jr=BigInt(2**32-1),ls=BigInt(32);function Va(n,t=!1){return t?{h:Number(n&jr),l:Number(n>>ls&jr)}:{h:Number(n>>ls&jr)|0,l:Number(n&jr)|0}}function yo(n,t=!1){const e=n.length;let r=new Uint32Array(e),s=new Uint32Array(e);for(let i=0;i<e;i++){const{h:o,l:u}=Va(n[i],t);[r[i],s[i]]=[o,u]}return[r,s]}const ds=(n,t,e)=>n>>>e,ps=(n,t,e)=>n<<32-e|t>>>e,dr=(n,t,e)=>n>>>e|t<<32-e,pr=(n,t,e)=>n<<32-e|t>>>e,Zr=(n,t,e)=>n<<64-e|t>>>e-32,Yr=(n,t,e)=>n>>>e-32|t<<64-e,Ha=(n,t,e)=>n<<e|t>>>32-e,Ga=(n,t,e)=>t<<e|n>>>32-e,ja=(n,t,e)=>t<<e-32|n>>>64-e,Za=(n,t,e)=>n<<e-32|t>>>64-e;function Ne(n,t,e,r){const s=(t>>>0)+(r>>>0);return{h:n+e+(s/2**32|0)|0,l:s|0}}const Ya=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),Xa=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,Ja=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),Qa=(n,t,e,r,s)=>t+e+r+s+(n/2**32|0)|0,tc=(n,t,e,r,s)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(s>>>0),ec=(n,t,e,r,s,i)=>t+e+r+s+i+(n/2**32|0)|0,rc=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),He=new Uint32Array(64);class nc extends go{constructor(t=32){super(64,t,8,!1),this.A=Ve[0]|0,this.B=Ve[1]|0,this.C=Ve[2]|0,this.D=Ve[3]|0,this.E=Ve[4]|0,this.F=Ve[5]|0,this.G=Ve[6]|0,this.H=Ve[7]|0}get(){const{A:t,B:e,C:r,D:s,E:i,F:o,G:u,H:p}=this;return[t,e,r,s,i,o,u,p]}set(t,e,r,s,i,o,u,p){this.A=t|0,this.B=e|0,this.C=r|0,this.D=s|0,this.E=i|0,this.F=o|0,this.G=u|0,this.H=p|0}process(t,e){for(let P=0;P<16;P++,e+=4)He[P]=t.getUint32(e,!1);for(let P=16;P<64;P++){const _=He[P-15],S=He[P-2],T=Re(_,7)^Re(_,18)^_>>>3,M=Re(S,17)^Re(S,19)^S>>>10;He[P]=M+He[P-7]+T+He[P-16]|0}let{A:r,B:s,C:i,D:o,E:u,F:p,G:v,H:B}=this;for(let P=0;P<64;P++){const _=Re(u,6)^Re(u,11)^Re(u,25),S=B+_+Wa(u,p,v)+rc[P]+He[P]|0,M=(Re(r,2)^Re(r,13)^Re(r,22))+$a(r,s,i)|0;B=v,v=p,p=u,u=o+S|0,o=i,i=s,s=r,r=S+M|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,u=u+this.E|0,p=p+this.F|0,v=v+this.G|0,B=B+this.H|0,this.set(r,s,i,o,u,p,v,B)}roundClean(){Qe(He)}destroy(){this.set(0,0,0,0,0,0,0,0),Qe(this.buffer)}}const mo=yo(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(n=>BigInt(n))),ic=mo[0],sc=mo[1],Ge=new Uint32Array(80),je=new Uint32Array(80);class oc extends go{constructor(t=64){super(128,t,16,!1),this.Ah=pe[0]|0,this.Al=pe[1]|0,this.Bh=pe[2]|0,this.Bl=pe[3]|0,this.Ch=pe[4]|0,this.Cl=pe[5]|0,this.Dh=pe[6]|0,this.Dl=pe[7]|0,this.Eh=pe[8]|0,this.El=pe[9]|0,this.Fh=pe[10]|0,this.Fl=pe[11]|0,this.Gh=pe[12]|0,this.Gl=pe[13]|0,this.Hh=pe[14]|0,this.Hl=pe[15]|0}get(){const{Ah:t,Al:e,Bh:r,Bl:s,Ch:i,Cl:o,Dh:u,Dl:p,Eh:v,El:B,Fh:P,Fl:_,Gh:S,Gl:T,Hh:M,Hl:N}=this;return[t,e,r,s,i,o,u,p,v,B,P,_,S,T,M,N]}set(t,e,r,s,i,o,u,p,v,B,P,_,S,T,M,N){this.Ah=t|0,this.Al=e|0,this.Bh=r|0,this.Bl=s|0,this.Ch=i|0,this.Cl=o|0,this.Dh=u|0,this.Dl=p|0,this.Eh=v|0,this.El=B|0,this.Fh=P|0,this.Fl=_|0,this.Gh=S|0,this.Gl=T|0,this.Hh=M|0,this.Hl=N|0}process(t,e){for(let $=0;$<16;$++,e+=4)Ge[$]=t.getUint32(e),je[$]=t.getUint32(e+=4);for(let $=16;$<80;$++){const Y=Ge[$-15]|0,X=je[$-15]|0,Q=dr(Y,X,1)^dr(Y,X,8)^ds(Y,X,7),ct=pr(Y,X,1)^pr(Y,X,8)^ps(Y,X,7),ot=Ge[$-2]|0,C=je[$-2]|0,U=dr(ot,C,19)^Zr(ot,C,61)^ds(ot,C,6),D=pr(ot,C,19)^Yr(ot,C,61)^ps(ot,C,6),V=Ja(ct,D,je[$-7],je[$-16]),y=Qa(V,Q,U,Ge[$-7],Ge[$-16]);Ge[$]=y|0,je[$]=V|0}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:u,Cl:p,Dh:v,Dl:B,Eh:P,El:_,Fh:S,Fl:T,Gh:M,Gl:N,Hh:F,Hl:H}=this;for(let $=0;$<80;$++){const Y=dr(P,_,14)^dr(P,_,18)^Zr(P,_,41),X=pr(P,_,14)^pr(P,_,18)^Yr(P,_,41),Q=P&S^~P&M,ct=_&T^~_&N,ot=tc(H,X,ct,sc[$],je[$]),C=ec(ot,F,Y,Q,ic[$],Ge[$]),U=ot|0,D=dr(r,s,28)^Zr(r,s,34)^Zr(r,s,39),V=pr(r,s,28)^Yr(r,s,34)^Yr(r,s,39),y=r&i^r&u^i&u,a=s&o^s&p^o&p;F=M|0,H=N|0,M=S|0,N=T|0,S=P|0,T=_|0,{h:P,l:_}=Ne(v|0,B|0,C|0,U|0),v=u|0,B=p|0,u=i|0,p=o|0,i=r|0,o=s|0;const l=Ya(U,V,a);r=Xa(l,C,D,y),s=l|0}({h:r,l:s}=Ne(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ne(this.Bh|0,this.Bl|0,i|0,o|0),{h:u,l:p}=Ne(this.Ch|0,this.Cl|0,u|0,p|0),{h:v,l:B}=Ne(this.Dh|0,this.Dl|0,v|0,B|0),{h:P,l:_}=Ne(this.Eh|0,this.El|0,P|0,_|0),{h:S,l:T}=Ne(this.Fh|0,this.Fl|0,S|0,T|0),{h:M,l:N}=Ne(this.Gh|0,this.Gl|0,M|0,N|0),{h:F,l:H}=Ne(this.Hh|0,this.Hl|0,F|0,H|0),this.set(r,s,i,o,u,p,v,B,P,_,S,T,M,N,F,H)}roundClean(){Qe(Ge,je)}destroy(){Qe(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const wo=Pi(()=>new nc),ac=Pi(()=>new oc);const Ci=BigInt(0),Si=BigInt(1);function ar(n,t=""){if(typeof n!="boolean"){const e=t&&`"${t}"`;throw new Error(e+"expected boolean, got type="+typeof n)}return n}function _e(n,t,e=""){const r=Fr(n),s=n?.length,i=t!==void 0;if(!r||i&&s!==t){const o=e&&`"${e}" `,u=i?` of length ${t}`:"",p=r?`length=${s}`:`type=${typeof n}`;throw new Error(o+"expected Uint8Array"+u+", got "+p)}return n}function Xr(n){const t=n.toString(16);return t.length&1?"0"+t:t}function bo(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?Ci:BigInt("0x"+n)}function bn(n){return bo(sr(n))}function Ur(n){return $e(n),bo(sr(Uint8Array.from(n).reverse()))}function Ui(n,t){return sn(n.toString(16).padStart(t*2,"0"))}function ko(n,t){return Ui(n,t).reverse()}function Dt(n,t,e){let r;if(typeof t=="string")try{r=sn(t)}catch(i){throw new Error(n+" must be hex string or Uint8Array, cause: "+i)}else if(Fr(t))r=Uint8Array.from(t);else throw new Error(n+" must be hex string or Uint8Array");const s=r.length;if(typeof e=="number"&&s!==e)throw new Error(n+" of length "+e+" expected, got "+s);return r}function gs(n){return Uint8Array.from(n)}const Zn=n=>typeof n=="bigint"&&Ci<=n;function cc(n,t,e){return Zn(n)&&Zn(t)&&Zn(e)&&t<=n&&n<e}function xi(n,t,e,r){if(!cc(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function vo(n){let t;for(t=0;n>Ci;n>>=Si,t+=1);return t}const zr=n=>(Si<<BigInt(n))-Si;function uc(n,t,e){if(typeof n!="number"||n<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof e!="function")throw new Error("hmacFn must be a function");const r=S=>new Uint8Array(S),s=S=>Uint8Array.of(S);let i=r(n),o=r(n),u=0;const p=()=>{i.fill(1),o.fill(0),u=0},v=(...S)=>e(o,i,...S),B=(S=r(0))=>{o=v(s(0),S),i=v(),S.length!==0&&(o=v(s(1),S),i=v())},P=()=>{if(u++>=1e3)throw new Error("drbg: tried 1000 values");let S=0;const T=[];for(;S<t;){i=v();const M=i.slice();T.push(M),S+=i.length}return Me(...T)};return(S,T)=>{p(),B(S);let M;for(;!(M=T(P()));)B();return p(),M}}function Kr(n,t,e={}){if(!n||typeof n!="object")throw new Error("expected valid options object");function r(s,i,o){const u=n[s];if(o&&u===void 0)return;const p=typeof u;if(p!==i||u===null)throw new Error(`param "${s}" is invalid: expected ${i}, got ${p}`)}Object.entries(t).forEach(([s,i])=>r(s,i,!1)),Object.entries(e).forEach(([s,i])=>r(s,i,!0))}function on(n){const t=new WeakMap;return(e,...r)=>{const s=t.get(e);if(s!==void 0)return s;const i=n(e,...r);return t.set(e,i),i}}const Se=BigInt(0),de=BigInt(1),er=BigInt(2),So=BigInt(3),xo=BigInt(4),Eo=BigInt(5),fc=BigInt(7),Io=BigInt(8),hc=BigInt(9),Ao=BigInt(16);function ae(n,t){const e=n%t;return e>=Se?e:t+e}function qt(n,t,e){let r=n;for(;t-- >Se;)r*=r,r%=e;return r}function ys(n,t){if(n===Se)throw new Error("invert: expected non-zero number");if(t<=Se)throw new Error("invert: expected positive modulus, got "+t);let e=ae(n,t),r=t,s=Se,i=de;for(;e!==Se;){const u=r/e,p=r%e,v=s-i*u;r=e,e=p,s=i,i=v}if(r!==de)throw new Error("invert: does not exist");return ae(s,t)}function Oi(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function _o(n,t){const e=(n.ORDER+de)/xo,r=n.pow(t,e);return Oi(n,r,t),r}function lc(n,t){const e=(n.ORDER-Eo)/Io,r=n.mul(t,er),s=n.pow(r,e),i=n.mul(t,s),o=n.mul(n.mul(i,er),s),u=n.mul(i,n.sub(o,n.ONE));return Oi(n,u,t),u}function dc(n){const t=cr(n),e=Bo(n),r=e(t,t.neg(t.ONE)),s=e(t,r),i=e(t,t.neg(r)),o=(n+fc)/Ao;return(u,p)=>{let v=u.pow(p,o),B=u.mul(v,r);const P=u.mul(v,s),_=u.mul(v,i),S=u.eql(u.sqr(B),p),T=u.eql(u.sqr(P),p);v=u.cmov(v,B,S),B=u.cmov(_,P,T);const M=u.eql(u.sqr(B),p),N=u.cmov(v,B,M);return Oi(u,N,p),N}}function Bo(n){if(n<So)throw new Error("sqrt is not defined for small field");let t=n-de,e=0;for(;t%er===Se;)t/=er,e++;let r=er;const s=cr(n);for(;ms(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return _o;let i=s.pow(r,t);const o=(t+de)/er;return function(p,v){if(p.is0(v))return v;if(ms(p,v)!==1)throw new Error("Cannot find square root");let B=e,P=p.mul(p.ONE,i),_=p.pow(v,t),S=p.pow(v,o);for(;!p.eql(_,p.ONE);){if(p.is0(_))return p.ZERO;let T=1,M=p.sqr(_);for(;!p.eql(M,p.ONE);)if(T++,M=p.sqr(M),T===B)throw new Error("Cannot find square root");const N=de<<BigInt(B-T-1),F=p.pow(P,N);B=T,P=p.sqr(F),_=p.mul(_,P),S=p.mul(S,F)}return S}}function pc(n){return n%xo===So?_o:n%Io===Eo?lc:n%Ao===hc?dc(n):Bo(n)}const gc=(n,t)=>(ae(n,t)&de)===de,yc=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function mc(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=yc.reduce((r,s)=>(r[s]="function",r),t);return Kr(n,e),n}function wc(n,t,e){if(e<Se)throw new Error("invalid exponent, negatives unsupported");if(e===Se)return n.ONE;if(e===de)return t;let r=n.ONE,s=t;for(;e>Se;)e&de&&(r=n.mul(r,s)),s=n.sqr(s),e>>=de;return r}function Ro(n,t,e=!1){const r=new Array(t.length).fill(e?n.ZERO:void 0),s=t.reduce((o,u,p)=>n.is0(u)?o:(r[p]=o,n.mul(o,u)),n.ONE),i=n.inv(s);return t.reduceRight((o,u,p)=>n.is0(u)?o:(r[p]=n.mul(o,r[p]),n.mul(o,u)),i),r}function ms(n,t){const e=(n.ORDER-de)/er,r=n.pow(t,e),s=n.eql(r,n.ONE),i=n.eql(r,n.ZERO),o=n.eql(r,n.neg(n.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Mo(n,t){t!==void 0&&Cr(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function cr(n,t,e=!1,r={}){if(n<=Se)throw new Error("invalid field: expected ORDER > 0, got "+n);let s,i,o=!1,u;if(typeof t=="object"&&t!=null){if(r.sqrt||e)throw new Error("cannot specify opts in two arguments");const _=t;_.BITS&&(s=_.BITS),_.sqrt&&(i=_.sqrt),typeof _.isLE=="boolean"&&(e=_.isLE),typeof _.modFromBytes=="boolean"&&(o=_.modFromBytes),u=_.allowedLengths}else typeof t=="number"&&(s=t),r.sqrt&&(i=r.sqrt);const{nBitLength:p,nByteLength:v}=Mo(n,s);if(v>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let B;const P=Object.freeze({ORDER:n,isLE:e,BITS:p,BYTES:v,MASK:zr(p),ZERO:Se,ONE:de,allowedLengths:u,create:_=>ae(_,n),isValid:_=>{if(typeof _!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof _);return Se<=_&&_<n},is0:_=>_===Se,isValidNot0:_=>!P.is0(_)&&P.isValid(_),isOdd:_=>(_&de)===de,neg:_=>ae(-_,n),eql:(_,S)=>_===S,sqr:_=>ae(_*_,n),add:(_,S)=>ae(_+S,n),sub:(_,S)=>ae(_-S,n),mul:(_,S)=>ae(_*S,n),pow:(_,S)=>wc(P,_,S),div:(_,S)=>ae(_*ys(S,n),n),sqrN:_=>_*_,addN:(_,S)=>_+S,subN:(_,S)=>_-S,mulN:(_,S)=>_*S,inv:_=>ys(_,n),sqrt:i||(_=>(B||(B=pc(n)),B(P,_))),toBytes:_=>e?ko(_,v):Ui(_,v),fromBytes:(_,S=!0)=>{if(u){if(!u.includes(_.length)||_.length>v)throw new Error("Field.fromBytes: expected "+u+" bytes, got "+_.length);const M=new Uint8Array(v);M.set(_,e?0:M.length-_.length),_=M}if(_.length!==v)throw new Error("Field.fromBytes: expected "+v+" bytes, got "+_.length);let T=e?Ur(_):bn(_);if(o&&(T=ae(T,n)),!S&&!P.isValid(T))throw new Error("invalid field element: outside of range 0..ORDER");return T},invertBatch:_=>Ro(P,_),cmov:(_,S,T)=>T?S:_});return Object.freeze(P)}function To(n){if(typeof n!="bigint")throw new Error("field order must be bigint");const t=n.toString(2).length;return Math.ceil(t/8)}function Po(n){const t=To(n);return t+Math.ceil(t/2)}function bc(n,t,e=!1){const r=n.length,s=To(t),i=Po(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=e?Ur(n):bn(n),u=ae(o,t-de)+de;return e?ko(u,s):Ui(u,s)}const kr=BigInt(0),rr=BigInt(1);function an(n,t){const e=t.negate();return n?e:t}function nr(n,t){const e=Ro(n.Fp,t.map(r=>r.Z));return t.map((r,s)=>n.fromAffine(r.toAffine(e[s])))}function Lo(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function Yn(n,t){Lo(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),s=2**n,i=zr(n),o=BigInt(n);return{windows:e,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function ws(n,t,e){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=e;let u=Number(n&s),p=n>>o;u>r&&(u-=i,p+=rr);const v=t*r,B=v+Math.abs(u)-1,P=u===0,_=u<0,S=t%2!==0;return{nextN:p,offset:B,isZero:P,isNeg:_,isNegF:S,offsetF:v}}function kc(n,t){if(!Array.isArray(n))throw new Error("array expected");n.forEach((e,r)=>{if(!(e instanceof t))throw new Error("invalid point at index "+r)})}function vc(n,t){if(!Array.isArray(n))throw new Error("array of scalars expected");n.forEach((e,r)=>{if(!t.isValid(e))throw new Error("invalid scalar at index "+r)})}const Xn=new WeakMap,Co=new WeakMap;function Jn(n){return Co.get(n)||1}function bs(n){if(n!==kr)throw new Error("invalid wNAF")}class Uo{constructor(t,e){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=e}_unsafeLadder(t,e,r=this.ZERO){let s=t;for(;e>kr;)e&rr&&(r=r.add(s)),s=s.double(),e>>=rr;return r}precomputeWindow(t,e){const{windows:r,windowSize:s}=Yn(e,this.bits),i=[];let o=t,u=o;for(let p=0;p<r;p++){u=o,i.push(u);for(let v=1;v<s;v++)u=u.add(o),i.push(u);o=u.double()}return i}wNAF(t,e,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let s=this.ZERO,i=this.BASE;const o=Yn(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:p,offset:v,isZero:B,isNeg:P,isNegF:_,offsetF:S}=ws(r,u,o);r=p,B?i=i.add(an(_,e[S])):s=s.add(an(P,e[v]))}return bs(r),{p:s,f:i}}wNAFUnsafe(t,e,r,s=this.ZERO){const i=Yn(t,this.bits);for(let o=0;o<i.windows&&r!==kr;o++){const{nextN:u,offset:p,isZero:v,isNeg:B}=ws(r,o,i);if(r=u,!v){const P=e[p];s=s.add(B?P.negate():P)}}return bs(r),s}getPrecomputes(t,e,r){let s=Xn.get(e);return s||(s=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(s=r(s)),Xn.set(e,s))),s}cached(t,e,r){const s=Jn(t);return this.wNAF(s,this.getPrecomputes(s,t,r),e)}unsafe(t,e,r,s){const i=Jn(t);return i===1?this._unsafeLadder(t,e,s):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),e,s)}createCache(t,e){Lo(e,this.bits),Co.set(t,e),Xn.delete(t)}hasCache(t){return Jn(t)!==1}}function Sc(n,t,e,r){let s=t,i=n.ZERO,o=n.ZERO;for(;e>kr||r>kr;)e&rr&&(i=i.add(s)),r&rr&&(o=o.add(s)),s=s.double(),e>>=rr,r>>=rr;return{p1:i,p2:o}}function Oo(n,t,e,r){kc(e,n),vc(r,t);const s=e.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=n.ZERO,u=vo(BigInt(s));let p=1;u>12?p=u-3:u>4?p=u-2:u>0&&(p=2);const v=zr(p),B=new Array(Number(v)+1).fill(o),P=Math.floor((t.BITS-1)/p)*p;let _=o;for(let S=P;S>=0;S-=p){B.fill(o);for(let M=0;M<i;M++){const N=r[M],F=Number(N>>BigInt(S)&v);B[F]=B[F].add(e[M])}let T=o;for(let M=B.length-1,N=o;M>0;M--)N=N.add(B[M]),T=T.add(N);if(_=_.add(T),S!==0)for(let M=0;M<p;M++)_=_.double()}return _}function ks(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return mc(t),t}else return cr(n,{isLE:e})}function No(n,t,e={},r){if(r===void 0&&(r=n==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${n} CURVE object`);for(const p of["p","n","h"]){const v=t[p];if(!(typeof v=="bigint"&&v>kr))throw new Error(`CURVE.${p} must be positive bigint`)}const s=ks(t.p,e.Fp,r),i=ks(t.n,e.Fn,r),u=["Gx","Gy","a",n==="weierstrass"?"b":"d"];for(const p of u)if(!s.isValid(t[p]))throw new Error(`CURVE.${p} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:s,Fn:i}}const Ze=BigInt(0),ce=BigInt(1),Qn=BigInt(2),xc=BigInt(8);function Ec(n,t,e,r){const s=n.sqr(e),i=n.sqr(r),o=n.add(n.mul(t.a,s),i),u=n.add(n.ONE,n.mul(t.d,n.mul(s,i)));return n.eql(o,u)}function Ic(n,t={}){const e=No("edwards",n,t,t.FpFnLE),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o}=i;Kr(t,{},{uvRatio:"function"});const u=Qn<<BigInt(s.BYTES*8)-ce,p=N=>r.create(N),v=t.uvRatio||((N,F)=>{try{return{isValid:!0,value:r.sqrt(r.div(N,F))}}catch{return{isValid:!1,value:Ze}}});if(!Ec(r,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function B(N,F,H=!1){const $=H?ce:Ze;return xi("coordinate "+N,F,$,u),F}function P(N){if(!(N instanceof T))throw new Error("ExtendedPoint expected")}const _=on((N,F)=>{const{X:H,Y:$,Z:Y}=N,X=N.is0();F==null&&(F=X?xc:r.inv(Y));const Q=p(H*F),ct=p($*F),ot=r.mul(Y,F);if(X)return{x:Ze,y:ce};if(ot!==ce)throw new Error("invZ was invalid");return{x:Q,y:ct}}),S=on(N=>{const{a:F,d:H}=i;if(N.is0())throw new Error("bad point: ZERO");const{X:$,Y,Z:X,T:Q}=N,ct=p($*$),ot=p(Y*Y),C=p(X*X),U=p(C*C),D=p(ct*F),V=p(C*p(D+ot)),y=p(U+p(H*p(ct*ot)));if(V!==y)throw new Error("bad point: equation left != right (1)");const a=p($*Y),l=p(X*Q);if(a!==l)throw new Error("bad point: equation left != right (2)");return!0});class T{constructor(F,H,$,Y){this.X=B("x",F),this.Y=B("y",H),this.Z=B("z",$,!0),this.T=B("t",Y),Object.freeze(this)}static CURVE(){return i}static fromAffine(F){if(F instanceof T)throw new Error("extended point not allowed");const{x:H,y:$}=F||{};return B("x",H),B("y",$),new T(H,$,ce,p(H*$))}static fromBytes(F,H=!1){const $=r.BYTES,{a:Y,d:X}=i;F=gs(_e(F,$,"point")),ar(H,"zip215");const Q=gs(F),ct=F[$-1];Q[$-1]=ct&-129;const ot=Ur(Q),C=H?u:r.ORDER;xi("point.y",ot,Ze,C);const U=p(ot*ot),D=p(U-ce),V=p(X*U-Y);let{isValid:y,value:a}=v(D,V);if(!y)throw new Error("bad point: invalid y coordinate");const l=(a&ce)===ce,g=(ct&128)!==0;if(!H&&a===Ze&&g)throw new Error("bad point: x=0 and x_0=1");return g!==l&&(a=p(-a)),T.fromAffine({x:a,y:ot})}static fromHex(F,H=!1){return T.fromBytes(Dt("point",F),H)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(F=8,H=!0){return M.createCache(this,F),H||this.multiply(Qn),this}assertValidity(){S(this)}equals(F){P(F);const{X:H,Y:$,Z:Y}=this,{X,Y:Q,Z:ct}=F,ot=p(H*ct),C=p(X*Y),U=p($*ct),D=p(Q*Y);return ot===C&&U===D}is0(){return this.equals(T.ZERO)}negate(){return new T(p(-this.X),this.Y,this.Z,p(-this.T))}double(){const{a:F}=i,{X:H,Y:$,Z:Y}=this,X=p(H*H),Q=p($*$),ct=p(Qn*p(Y*Y)),ot=p(F*X),C=H+$,U=p(p(C*C)-X-Q),D=ot+Q,V=D-ct,y=ot-Q,a=p(U*V),l=p(D*y),g=p(U*y),k=p(V*D);return new T(a,l,k,g)}add(F){P(F);const{a:H,d:$}=i,{X:Y,Y:X,Z:Q,T:ct}=this,{X:ot,Y:C,Z:U,T:D}=F,V=p(Y*ot),y=p(X*C),a=p(ct*$*D),l=p(Q*U),g=p((Y+X)*(ot+C)-V-y),k=l-a,E=l+a,A=p(y-H*V),L=p(g*k),b=p(E*A),c=p(g*A),f=p(k*E);return new T(L,b,f,c)}subtract(F){return this.add(F.negate())}multiply(F){if(!s.isValidNot0(F))throw new Error("invalid scalar: expected 1 <= sc < curve.n");const{p:H,f:$}=M.cached(this,F,Y=>nr(T,Y));return nr(T,[H,$])[0]}multiplyUnsafe(F,H=T.ZERO){if(!s.isValid(F))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return F===Ze?T.ZERO:this.is0()||F===ce?this:M.unsafe(this,F,$=>nr(T,$),H)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}isTorsionFree(){return M.unsafe(this,i.n).is0()}toAffine(F){return _(this,F)}clearCofactor(){return o===ce?this:this.multiplyUnsafe(o)}toBytes(){const{x:F,y:H}=this.toAffine(),$=r.toBytes(H);return $[$.length-1]|=F&ce?128:0,$}toHex(){return sr(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(F){return nr(T,F)}static msm(F,H){return Oo(T,s,F,H)}_setWindowSize(F){this.precompute(F)}toRawBytes(){return this.toBytes()}}T.BASE=new T(i.Gx,i.Gy,ce,p(i.Gx*i.Gy)),T.ZERO=new T(Ze,ce,ce,Ze),T.Fp=r,T.Fn=s;const M=new Uo(T,s.BITS);return T.BASE.precompute(8),T}function Ac(n,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');Kr(e,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});const{prehash:r}=e,{BASE:s,Fp:i,Fn:o}=n,u=e.randomBytes||Li,p=e.adjustScalarBytes||(C=>C),v=e.domain||((C,U,D)=>{if(ar(D,"phflag"),U.length||D)throw new Error("Contexts/pre-hash are not supported");return C});function B(C){return o.create(Ur(C))}function P(C){const U=$.secretKey;C=Dt("private key",C,U);const D=Dt("hashed private key",t(C),2*U),V=p(D.slice(0,U)),y=D.slice(U,2*U),a=B(V);return{head:V,prefix:y,scalar:a}}function _(C){const{head:U,prefix:D,scalar:V}=P(C),y=s.multiply(V),a=y.toBytes();return{head:U,prefix:D,scalar:V,point:y,pointBytes:a}}function S(C){return _(C).pointBytes}function T(C=Uint8Array.of(),...U){const D=Me(...U);return B(t(v(D,Dt("context",C),!!r)))}function M(C,U,D={}){C=Dt("message",C),r&&(C=r(C));const{prefix:V,scalar:y,pointBytes:a}=_(U),l=T(D.context,V,C),g=s.multiply(l).toBytes(),k=T(D.context,g,a,C),E=o.create(l+k*y);if(!o.isValid(E))throw new Error("sign failed: invalid s");const A=Me(g,o.toBytes(E));return _e(A,$.signature,"result")}const N={zip215:!0};function F(C,U,D,V=N){const{context:y,zip215:a}=V,l=$.signature;C=Dt("signature",C,l),U=Dt("message",U),D=Dt("publicKey",D,$.publicKey),a!==void 0&&ar(a,"zip215"),r&&(U=r(U));const g=l/2,k=C.subarray(0,g),E=Ur(C.subarray(g,l));let A,L,b;try{A=n.fromBytes(D,a),L=n.fromBytes(k,a),b=s.multiplyUnsafe(E)}catch{return!1}if(!a&&A.isSmallOrder())return!1;const c=T(y,L.toBytes(),A.toBytes(),U);return L.add(A.multiplyUnsafe(c)).subtract(b).clearCofactor().is0()}const H=i.BYTES,$={secretKey:H,publicKey:H,signature:2*H,seed:H};function Y(C=u($.seed)){return _e(C,$.seed,"seed")}function X(C){const U=ot.randomSecretKey(C);return{secretKey:U,publicKey:S(U)}}function Q(C){return Fr(C)&&C.length===o.BYTES}function ct(C,U){try{return!!n.fromBytes(C,U)}catch{return!1}}const ot={getExtendedPublicKey:_,randomSecretKey:Y,isValidSecretKey:Q,isValidPublicKey:ct,toMontgomery(C){const{y:U}=n.fromBytes(C),D=$.publicKey,V=D===32;if(!V&&D!==57)throw new Error("only defined for 25519 and 448");const y=V?i.div(ce+U,ce-U):i.div(U-ce,U+ce);return i.toBytes(y)},toMontgomerySecret(C){const U=$.secretKey;_e(C,U);const D=t(C.subarray(0,U));return p(D).subarray(0,U)},randomPrivateKey:Y,precompute(C=8,U=n.BASE){return U.precompute(C,!1)}};return Object.freeze({keygen:X,getPublicKey:S,sign:M,verify:F,utils:ot,Point:n,lengths:$})}function _c(n){const t={a:n.a,d:n.d,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e=n.Fp,r=cr(t.n,n.nBitLength,!0),s={Fp:e,Fn:r,uvRatio:n.uvRatio},i={randomBytes:n.randomBytes,adjustScalarBytes:n.adjustScalarBytes,domain:n.domain,prehash:n.prehash,mapToCurve:n.mapToCurve};return{CURVE:t,curveOpts:s,hash:n.hash,eddsaOpts:i}}function Bc(n,t){const e=t.Point;return Object.assign({},t,{ExtendedPoint:e,CURVE:n,nBitLength:e.Fn.BITS,nByteLength:e.Fn.BYTES})}function Rc(n){const{CURVE:t,curveOpts:e,hash:r,eddsaOpts:s}=_c(n),i=Ic(t,e),o=Ac(i,r,s);return Bc(n,o)}const Mc=BigInt(1),vs=BigInt(2);BigInt(3);const Tc=BigInt(5),Pc=BigInt(8),Ni=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Fo={p:Ni,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Pc,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function Lc(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),s=BigInt(80),i=Ni,u=n*n%i*n%i,p=qt(u,vs,i)*u%i,v=qt(p,Mc,i)*n%i,B=qt(v,Tc,i)*v%i,P=qt(B,t,i)*B%i,_=qt(P,e,i)*P%i,S=qt(_,r,i)*_%i,T=qt(S,s,i)*S%i,M=qt(T,s,i)*S%i,N=qt(M,t,i)*B%i;return{pow_p_5_8:qt(N,vs,i)*n%i,b2:u}}function Cc(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const Ss=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Uc(n,t){const e=Ni,r=ae(t*t*t,e),s=ae(r*r*t,e),i=Lc(n*s).pow_p_5_8;let o=ae(n*r*i,e);const u=ae(t*o*o,e),p=o,v=ae(o*Ss,e),B=u===n,P=u===ae(-n,e),_=u===ae(-n*Ss,e);return B&&(o=p),(P||_)&&(o=v),gc(o,e)&&(o=ae(-o,e)),{isValid:B||P,value:o}}const Oc=cr(Fo.p,{isLE:!0}),Nc={...Fo,Fp:Oc,hash:ac,adjustScalarBytes:Cc,uvRatio:Uc},Ir=Rc(Nc);var rn={exports:{}},Fc=rn.exports,xs;function zo(){return xs||(xs=1,(function(n){(function(t,e){function r(y,a){if(!y)throw new Error(a||"Assertion failed")}function s(y,a){y.super_=a;var l=function(){};l.prototype=a.prototype,y.prototype=new l,y.prototype.constructor=y}function i(y,a,l){if(i.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((a==="le"||a==="be")&&(l=a,a=10),this._init(y||0,a||10,l||"be"))}typeof t=="object"?t.exports=i:e.BN=i,i.BN=i,i.wordSize=26;var o;try{typeof window<"u"&&typeof window.Buffer<"u"?o=window.Buffer:o=La.Buffer}catch{}i.isBN=function(a){return a instanceof i?!0:a!==null&&typeof a=="object"&&a.constructor.wordSize===i.wordSize&&Array.isArray(a.words)},i.max=function(a,l){return a.cmp(l)>0?a:l},i.min=function(a,l){return a.cmp(l)<0?a:l},i.prototype._init=function(a,l,g){if(typeof a=="number")return this._initNumber(a,l,g);if(typeof a=="object")return this._initArray(a,l,g);l==="hex"&&(l=16),r(l===(l|0)&&l>=2&&l<=36),a=a.toString().replace(/\s+/g,"");var k=0;a[0]==="-"&&(k++,this.negative=1),k<a.length&&(l===16?this._parseHex(a,k,g):(this._parseBase(a,l,k),g==="le"&&this._initArray(this.toArray(),l,g)))},i.prototype._initNumber=function(a,l,g){a<0&&(this.negative=1,a=-a),a<67108864?(this.words=[a&67108863],this.length=1):a<4503599627370496?(this.words=[a&67108863,a/67108864&67108863],this.length=2):(r(a<9007199254740992),this.words=[a&67108863,a/67108864&67108863,1],this.length=3),g==="le"&&this._initArray(this.toArray(),l,g)},i.prototype._initArray=function(a,l,g){if(r(typeof a.length=="number"),a.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(a.length/3),this.words=new Array(this.length);for(var k=0;k<this.length;k++)this.words[k]=0;var E,A,L=0;if(g==="be")for(k=a.length-1,E=0;k>=0;k-=3)A=a[k]|a[k-1]<<8|a[k-2]<<16,this.words[E]|=A<<L&67108863,this.words[E+1]=A>>>26-L&67108863,L+=24,L>=26&&(L-=26,E++);else if(g==="le")for(k=0,E=0;k<a.length;k+=3)A=a[k]|a[k+1]<<8|a[k+2]<<16,this.words[E]|=A<<L&67108863,this.words[E+1]=A>>>26-L&67108863,L+=24,L>=26&&(L-=26,E++);return this._strip()};function u(y,a){var l=y.charCodeAt(a);if(l>=48&&l<=57)return l-48;if(l>=65&&l<=70)return l-55;if(l>=97&&l<=102)return l-87;r(!1,"Invalid character in "+y)}function p(y,a,l){var g=u(y,l);return l-1>=a&&(g|=u(y,l-1)<<4),g}i.prototype._parseHex=function(a,l,g){this.length=Math.ceil((a.length-l)/6),this.words=new Array(this.length);for(var k=0;k<this.length;k++)this.words[k]=0;var E=0,A=0,L;if(g==="be")for(k=a.length-1;k>=l;k-=2)L=p(a,l,k)<<E,this.words[A]|=L&67108863,E>=18?(E-=18,A+=1,this.words[A]|=L>>>26):E+=8;else{var b=a.length-l;for(k=b%2===0?l+1:l;k<a.length;k+=2)L=p(a,l,k)<<E,this.words[A]|=L&67108863,E>=18?(E-=18,A+=1,this.words[A]|=L>>>26):E+=8}this._strip()};function v(y,a,l,g){for(var k=0,E=0,A=Math.min(y.length,l),L=a;L<A;L++){var b=y.charCodeAt(L)-48;k*=g,b>=49?E=b-49+10:b>=17?E=b-17+10:E=b,r(b>=0&&E<g,"Invalid character"),k+=E}return k}i.prototype._parseBase=function(a,l,g){this.words=[0],this.length=1;for(var k=0,E=1;E<=67108863;E*=l)k++;k--,E=E/l|0;for(var A=a.length-g,L=A%k,b=Math.min(A,A-L)+g,c=0,f=g;f<b;f+=k)c=v(a,f,f+k,l),this.imuln(E),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(L!==0){var w=1;for(c=v(a,f,a.length,l),f=0;f<L;f++)w*=l;this.imuln(w),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},i.prototype.copy=function(a){a.words=new Array(this.length);for(var l=0;l<this.length;l++)a.words[l]=this.words[l];a.length=this.length,a.negative=this.negative,a.red=this.red};function B(y,a){y.words=a.words,y.length=a.length,y.negative=a.negative,y.red=a.red}if(i.prototype._move=function(a){B(a,this)},i.prototype.clone=function(){var a=new i(null);return this.copy(a),a},i.prototype._expand=function(a){for(;this.length<a;)this.words[this.length++]=0;return this},i.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},i.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{i.prototype[Symbol.for("nodejs.util.inspect.custom")]=P}catch{i.prototype.inspect=P}else i.prototype.inspect=P;function P(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var _=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],S=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],T=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];i.prototype.toString=function(a,l){a=a||10,l=l|0||1;var g;if(a===16||a==="hex"){g="";for(var k=0,E=0,A=0;A<this.length;A++){var L=this.words[A],b=((L<<k|E)&16777215).toString(16);E=L>>>24-k&16777215,k+=2,k>=26&&(k-=26,A--),E!==0||A!==this.length-1?g=_[6-b.length]+b+g:g=b+g}for(E!==0&&(g=E.toString(16)+g);g.length%l!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}if(a===(a|0)&&a>=2&&a<=36){var c=S[a],f=T[a];g="";var w=this.clone();for(w.negative=0;!w.isZero();){var I=w.modrn(f).toString(a);w=w.idivn(f),w.isZero()?g=I+g:g=_[c-I.length]+I+g}for(this.isZero()&&(g="0"+g);g.length%l!==0;)g="0"+g;return this.negative!==0&&(g="-"+g),g}r(!1,"Base should be between 2 and 36")},i.prototype.toNumber=function(){var a=this.words[0];return this.length===2?a+=this.words[1]*67108864:this.length===3&&this.words[2]===1?a+=4503599627370496+this.words[1]*67108864:this.length>2&&r(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-a:a},i.prototype.toJSON=function(){return this.toString(16,2)},o&&(i.prototype.toBuffer=function(a,l){return this.toArrayLike(o,a,l)}),i.prototype.toArray=function(a,l){return this.toArrayLike(Array,a,l)};var M=function(a,l){return a.allocUnsafe?a.allocUnsafe(l):new a(l)};i.prototype.toArrayLike=function(a,l,g){this._strip();var k=this.byteLength(),E=g||Math.max(1,k);r(k<=E,"byte array longer than desired length"),r(E>0,"Requested array length <= 0");var A=M(a,E),L=l==="le"?"LE":"BE";return this["_toArrayLike"+L](A,k),A},i.prototype._toArrayLikeLE=function(a,l){for(var g=0,k=0,E=0,A=0;E<this.length;E++){var L=this.words[E]<<A|k;a[g++]=L&255,g<a.length&&(a[g++]=L>>8&255),g<a.length&&(a[g++]=L>>16&255),A===6?(g<a.length&&(a[g++]=L>>24&255),k=0,A=0):(k=L>>>24,A+=2)}if(g<a.length)for(a[g++]=k;g<a.length;)a[g++]=0},i.prototype._toArrayLikeBE=function(a,l){for(var g=a.length-1,k=0,E=0,A=0;E<this.length;E++){var L=this.words[E]<<A|k;a[g--]=L&255,g>=0&&(a[g--]=L>>8&255),g>=0&&(a[g--]=L>>16&255),A===6?(g>=0&&(a[g--]=L>>24&255),k=0,A=0):(k=L>>>24,A+=2)}if(g>=0)for(a[g--]=k;g>=0;)a[g--]=0},Math.clz32?i.prototype._countBits=function(a){return 32-Math.clz32(a)}:i.prototype._countBits=function(a){var l=a,g=0;return l>=4096&&(g+=13,l>>>=13),l>=64&&(g+=7,l>>>=7),l>=8&&(g+=4,l>>>=4),l>=2&&(g+=2,l>>>=2),g+l},i.prototype._zeroBits=function(a){if(a===0)return 26;var l=a,g=0;return(l&8191)===0&&(g+=13,l>>>=13),(l&127)===0&&(g+=7,l>>>=7),(l&15)===0&&(g+=4,l>>>=4),(l&3)===0&&(g+=2,l>>>=2),(l&1)===0&&g++,g},i.prototype.bitLength=function(){var a=this.words[this.length-1],l=this._countBits(a);return(this.length-1)*26+l};function N(y){for(var a=new Array(y.bitLength()),l=0;l<a.length;l++){var g=l/26|0,k=l%26;a[l]=y.words[g]>>>k&1}return a}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var a=0,l=0;l<this.length;l++){var g=this._zeroBits(this.words[l]);if(a+=g,g!==26)break}return a},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(a){return this.negative!==0?this.abs().inotn(a).iaddn(1):this.clone()},i.prototype.fromTwos=function(a){return this.testn(a-1)?this.notn(a).iaddn(1).ineg():this.clone()},i.prototype.isNeg=function(){return this.negative!==0},i.prototype.neg=function(){return this.clone().ineg()},i.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},i.prototype.iuor=function(a){for(;this.length<a.length;)this.words[this.length++]=0;for(var l=0;l<a.length;l++)this.words[l]=this.words[l]|a.words[l];return this._strip()},i.prototype.ior=function(a){return r((this.negative|a.negative)===0),this.iuor(a)},i.prototype.or=function(a){return this.length>a.length?this.clone().ior(a):a.clone().ior(this)},i.prototype.uor=function(a){return this.length>a.length?this.clone().iuor(a):a.clone().iuor(this)},i.prototype.iuand=function(a){var l;this.length>a.length?l=a:l=this;for(var g=0;g<l.length;g++)this.words[g]=this.words[g]&a.words[g];return this.length=l.length,this._strip()},i.prototype.iand=function(a){return r((this.negative|a.negative)===0),this.iuand(a)},i.prototype.and=function(a){return this.length>a.length?this.clone().iand(a):a.clone().iand(this)},i.prototype.uand=function(a){return this.length>a.length?this.clone().iuand(a):a.clone().iuand(this)},i.prototype.iuxor=function(a){var l,g;this.length>a.length?(l=this,g=a):(l=a,g=this);for(var k=0;k<g.length;k++)this.words[k]=l.words[k]^g.words[k];if(this!==l)for(;k<l.length;k++)this.words[k]=l.words[k];return this.length=l.length,this._strip()},i.prototype.ixor=function(a){return r((this.negative|a.negative)===0),this.iuxor(a)},i.prototype.xor=function(a){return this.length>a.length?this.clone().ixor(a):a.clone().ixor(this)},i.prototype.uxor=function(a){return this.length>a.length?this.clone().iuxor(a):a.clone().iuxor(this)},i.prototype.inotn=function(a){r(typeof a=="number"&&a>=0);var l=Math.ceil(a/26)|0,g=a%26;this._expand(l),g>0&&l--;for(var k=0;k<l;k++)this.words[k]=~this.words[k]&67108863;return g>0&&(this.words[k]=~this.words[k]&67108863>>26-g),this._strip()},i.prototype.notn=function(a){return this.clone().inotn(a)},i.prototype.setn=function(a,l){r(typeof a=="number"&&a>=0);var g=a/26|0,k=a%26;return this._expand(g+1),l?this.words[g]=this.words[g]|1<<k:this.words[g]=this.words[g]&~(1<<k),this._strip()},i.prototype.iadd=function(a){var l;if(this.negative!==0&&a.negative===0)return this.negative=0,l=this.isub(a),this.negative^=1,this._normSign();if(this.negative===0&&a.negative!==0)return a.negative=0,l=this.isub(a),a.negative=1,l._normSign();var g,k;this.length>a.length?(g=this,k=a):(g=a,k=this);for(var E=0,A=0;A<k.length;A++)l=(g.words[A]|0)+(k.words[A]|0)+E,this.words[A]=l&67108863,E=l>>>26;for(;E!==0&&A<g.length;A++)l=(g.words[A]|0)+E,this.words[A]=l&67108863,E=l>>>26;if(this.length=g.length,E!==0)this.words[this.length]=E,this.length++;else if(g!==this)for(;A<g.length;A++)this.words[A]=g.words[A];return this},i.prototype.add=function(a){var l;return a.negative!==0&&this.negative===0?(a.negative=0,l=this.sub(a),a.negative^=1,l):a.negative===0&&this.negative!==0?(this.negative=0,l=a.sub(this),this.negative=1,l):this.length>a.length?this.clone().iadd(a):a.clone().iadd(this)},i.prototype.isub=function(a){if(a.negative!==0){a.negative=0;var l=this.iadd(a);return a.negative=1,l._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(a),this.negative=1,this._normSign();var g=this.cmp(a);if(g===0)return this.negative=0,this.length=1,this.words[0]=0,this;var k,E;g>0?(k=this,E=a):(k=a,E=this);for(var A=0,L=0;L<E.length;L++)l=(k.words[L]|0)-(E.words[L]|0)+A,A=l>>26,this.words[L]=l&67108863;for(;A!==0&&L<k.length;L++)l=(k.words[L]|0)+A,A=l>>26,this.words[L]=l&67108863;if(A===0&&L<k.length&&k!==this)for(;L<k.length;L++)this.words[L]=k.words[L];return this.length=Math.max(this.length,L),k!==this&&(this.negative=1),this._strip()},i.prototype.sub=function(a){return this.clone().isub(a)};function F(y,a,l){l.negative=a.negative^y.negative;var g=y.length+a.length|0;l.length=g,g=g-1|0;var k=y.words[0]|0,E=a.words[0]|0,A=k*E,L=A&67108863,b=A/67108864|0;l.words[0]=L;for(var c=1;c<g;c++){for(var f=b>>>26,w=b&67108863,I=Math.min(c,a.length-1),z=Math.max(0,c-y.length+1);z<=I;z++){var j=c-z|0;k=y.words[j]|0,E=a.words[z]|0,A=k*E+w,f+=A/67108864|0,w=A&67108863}l.words[c]=w|0,b=f|0}return b!==0?l.words[c]=b|0:l.length--,l._strip()}var H=function(a,l,g){var k=a.words,E=l.words,A=g.words,L=0,b,c,f,w=k[0]|0,I=w&8191,z=w>>>13,j=k[1]|0,rt=j&8191,st=j>>>13,kt=k[2]|0,vt=kt&8191,It=kt>>>13,Ie=k[3]|0,At=Ie&8191,Nt=Ie>>>13,Vr=k[4]|0,Pt=Vr&8191,Ft=Vr>>>13,Hr=k[5]|0,Ct=Hr&8191,Rt=Hr>>>13,xe=k[6]|0,Lt=xe&8191,zt=xe>>>13,Ae=k[7]|0,Kt=Ae&8191,m=Ae>>>13,h=k[8]|0,d=h&8191,x=h>>>13,O=k[9]|0,K=O&8191,G=O>>>13,pt=E[0]|0,dt=pt&8191,lt=pt>>>13,Mt=E[1]|0,ht=Mt&8191,$t=Mt>>>13,Qi=E[2]|0,Vt=Qi&8191,Ht=Qi>>>13,ts=E[3]|0,Gt=ts&8191,jt=ts>>>13,es=E[4]|0,Zt=es&8191,Yt=es>>>13,rs=E[5]|0,Xt=rs&8191,Jt=rs>>>13,ns=E[6]|0,Qt=ns&8191,te=ns>>>13,is=E[7]|0,ee=is&8191,re=is>>>13,ss=E[8]|0,ne=ss&8191,ie=ss>>>13,os=E[9]|0,se=os&8191,oe=os>>>13;g.negative=a.negative^l.negative,g.length=19,b=Math.imul(I,dt),c=Math.imul(I,lt),c=c+Math.imul(z,dt)|0,f=Math.imul(z,lt);var Bn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Bn>>>26)|0,Bn&=67108863,b=Math.imul(rt,dt),c=Math.imul(rt,lt),c=c+Math.imul(st,dt)|0,f=Math.imul(st,lt),b=b+Math.imul(I,ht)|0,c=c+Math.imul(I,$t)|0,c=c+Math.imul(z,ht)|0,f=f+Math.imul(z,$t)|0;var Rn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Rn>>>26)|0,Rn&=67108863,b=Math.imul(vt,dt),c=Math.imul(vt,lt),c=c+Math.imul(It,dt)|0,f=Math.imul(It,lt),b=b+Math.imul(rt,ht)|0,c=c+Math.imul(rt,$t)|0,c=c+Math.imul(st,ht)|0,f=f+Math.imul(st,$t)|0,b=b+Math.imul(I,Vt)|0,c=c+Math.imul(I,Ht)|0,c=c+Math.imul(z,Vt)|0,f=f+Math.imul(z,Ht)|0;var Mn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Mn>>>26)|0,Mn&=67108863,b=Math.imul(At,dt),c=Math.imul(At,lt),c=c+Math.imul(Nt,dt)|0,f=Math.imul(Nt,lt),b=b+Math.imul(vt,ht)|0,c=c+Math.imul(vt,$t)|0,c=c+Math.imul(It,ht)|0,f=f+Math.imul(It,$t)|0,b=b+Math.imul(rt,Vt)|0,c=c+Math.imul(rt,Ht)|0,c=c+Math.imul(st,Vt)|0,f=f+Math.imul(st,Ht)|0,b=b+Math.imul(I,Gt)|0,c=c+Math.imul(I,jt)|0,c=c+Math.imul(z,Gt)|0,f=f+Math.imul(z,jt)|0;var Tn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Tn>>>26)|0,Tn&=67108863,b=Math.imul(Pt,dt),c=Math.imul(Pt,lt),c=c+Math.imul(Ft,dt)|0,f=Math.imul(Ft,lt),b=b+Math.imul(At,ht)|0,c=c+Math.imul(At,$t)|0,c=c+Math.imul(Nt,ht)|0,f=f+Math.imul(Nt,$t)|0,b=b+Math.imul(vt,Vt)|0,c=c+Math.imul(vt,Ht)|0,c=c+Math.imul(It,Vt)|0,f=f+Math.imul(It,Ht)|0,b=b+Math.imul(rt,Gt)|0,c=c+Math.imul(rt,jt)|0,c=c+Math.imul(st,Gt)|0,f=f+Math.imul(st,jt)|0,b=b+Math.imul(I,Zt)|0,c=c+Math.imul(I,Yt)|0,c=c+Math.imul(z,Zt)|0,f=f+Math.imul(z,Yt)|0;var Pn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Pn>>>26)|0,Pn&=67108863,b=Math.imul(Ct,dt),c=Math.imul(Ct,lt),c=c+Math.imul(Rt,dt)|0,f=Math.imul(Rt,lt),b=b+Math.imul(Pt,ht)|0,c=c+Math.imul(Pt,$t)|0,c=c+Math.imul(Ft,ht)|0,f=f+Math.imul(Ft,$t)|0,b=b+Math.imul(At,Vt)|0,c=c+Math.imul(At,Ht)|0,c=c+Math.imul(Nt,Vt)|0,f=f+Math.imul(Nt,Ht)|0,b=b+Math.imul(vt,Gt)|0,c=c+Math.imul(vt,jt)|0,c=c+Math.imul(It,Gt)|0,f=f+Math.imul(It,jt)|0,b=b+Math.imul(rt,Zt)|0,c=c+Math.imul(rt,Yt)|0,c=c+Math.imul(st,Zt)|0,f=f+Math.imul(st,Yt)|0,b=b+Math.imul(I,Xt)|0,c=c+Math.imul(I,Jt)|0,c=c+Math.imul(z,Xt)|0,f=f+Math.imul(z,Jt)|0;var Ln=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Ln>>>26)|0,Ln&=67108863,b=Math.imul(Lt,dt),c=Math.imul(Lt,lt),c=c+Math.imul(zt,dt)|0,f=Math.imul(zt,lt),b=b+Math.imul(Ct,ht)|0,c=c+Math.imul(Ct,$t)|0,c=c+Math.imul(Rt,ht)|0,f=f+Math.imul(Rt,$t)|0,b=b+Math.imul(Pt,Vt)|0,c=c+Math.imul(Pt,Ht)|0,c=c+Math.imul(Ft,Vt)|0,f=f+Math.imul(Ft,Ht)|0,b=b+Math.imul(At,Gt)|0,c=c+Math.imul(At,jt)|0,c=c+Math.imul(Nt,Gt)|0,f=f+Math.imul(Nt,jt)|0,b=b+Math.imul(vt,Zt)|0,c=c+Math.imul(vt,Yt)|0,c=c+Math.imul(It,Zt)|0,f=f+Math.imul(It,Yt)|0,b=b+Math.imul(rt,Xt)|0,c=c+Math.imul(rt,Jt)|0,c=c+Math.imul(st,Xt)|0,f=f+Math.imul(st,Jt)|0,b=b+Math.imul(I,Qt)|0,c=c+Math.imul(I,te)|0,c=c+Math.imul(z,Qt)|0,f=f+Math.imul(z,te)|0;var Cn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Cn>>>26)|0,Cn&=67108863,b=Math.imul(Kt,dt),c=Math.imul(Kt,lt),c=c+Math.imul(m,dt)|0,f=Math.imul(m,lt),b=b+Math.imul(Lt,ht)|0,c=c+Math.imul(Lt,$t)|0,c=c+Math.imul(zt,ht)|0,f=f+Math.imul(zt,$t)|0,b=b+Math.imul(Ct,Vt)|0,c=c+Math.imul(Ct,Ht)|0,c=c+Math.imul(Rt,Vt)|0,f=f+Math.imul(Rt,Ht)|0,b=b+Math.imul(Pt,Gt)|0,c=c+Math.imul(Pt,jt)|0,c=c+Math.imul(Ft,Gt)|0,f=f+Math.imul(Ft,jt)|0,b=b+Math.imul(At,Zt)|0,c=c+Math.imul(At,Yt)|0,c=c+Math.imul(Nt,Zt)|0,f=f+Math.imul(Nt,Yt)|0,b=b+Math.imul(vt,Xt)|0,c=c+Math.imul(vt,Jt)|0,c=c+Math.imul(It,Xt)|0,f=f+Math.imul(It,Jt)|0,b=b+Math.imul(rt,Qt)|0,c=c+Math.imul(rt,te)|0,c=c+Math.imul(st,Qt)|0,f=f+Math.imul(st,te)|0,b=b+Math.imul(I,ee)|0,c=c+Math.imul(I,re)|0,c=c+Math.imul(z,ee)|0,f=f+Math.imul(z,re)|0;var Un=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Un>>>26)|0,Un&=67108863,b=Math.imul(d,dt),c=Math.imul(d,lt),c=c+Math.imul(x,dt)|0,f=Math.imul(x,lt),b=b+Math.imul(Kt,ht)|0,c=c+Math.imul(Kt,$t)|0,c=c+Math.imul(m,ht)|0,f=f+Math.imul(m,$t)|0,b=b+Math.imul(Lt,Vt)|0,c=c+Math.imul(Lt,Ht)|0,c=c+Math.imul(zt,Vt)|0,f=f+Math.imul(zt,Ht)|0,b=b+Math.imul(Ct,Gt)|0,c=c+Math.imul(Ct,jt)|0,c=c+Math.imul(Rt,Gt)|0,f=f+Math.imul(Rt,jt)|0,b=b+Math.imul(Pt,Zt)|0,c=c+Math.imul(Pt,Yt)|0,c=c+Math.imul(Ft,Zt)|0,f=f+Math.imul(Ft,Yt)|0,b=b+Math.imul(At,Xt)|0,c=c+Math.imul(At,Jt)|0,c=c+Math.imul(Nt,Xt)|0,f=f+Math.imul(Nt,Jt)|0,b=b+Math.imul(vt,Qt)|0,c=c+Math.imul(vt,te)|0,c=c+Math.imul(It,Qt)|0,f=f+Math.imul(It,te)|0,b=b+Math.imul(rt,ee)|0,c=c+Math.imul(rt,re)|0,c=c+Math.imul(st,ee)|0,f=f+Math.imul(st,re)|0,b=b+Math.imul(I,ne)|0,c=c+Math.imul(I,ie)|0,c=c+Math.imul(z,ne)|0,f=f+Math.imul(z,ie)|0;var On=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(On>>>26)|0,On&=67108863,b=Math.imul(K,dt),c=Math.imul(K,lt),c=c+Math.imul(G,dt)|0,f=Math.imul(G,lt),b=b+Math.imul(d,ht)|0,c=c+Math.imul(d,$t)|0,c=c+Math.imul(x,ht)|0,f=f+Math.imul(x,$t)|0,b=b+Math.imul(Kt,Vt)|0,c=c+Math.imul(Kt,Ht)|0,c=c+Math.imul(m,Vt)|0,f=f+Math.imul(m,Ht)|0,b=b+Math.imul(Lt,Gt)|0,c=c+Math.imul(Lt,jt)|0,c=c+Math.imul(zt,Gt)|0,f=f+Math.imul(zt,jt)|0,b=b+Math.imul(Ct,Zt)|0,c=c+Math.imul(Ct,Yt)|0,c=c+Math.imul(Rt,Zt)|0,f=f+Math.imul(Rt,Yt)|0,b=b+Math.imul(Pt,Xt)|0,c=c+Math.imul(Pt,Jt)|0,c=c+Math.imul(Ft,Xt)|0,f=f+Math.imul(Ft,Jt)|0,b=b+Math.imul(At,Qt)|0,c=c+Math.imul(At,te)|0,c=c+Math.imul(Nt,Qt)|0,f=f+Math.imul(Nt,te)|0,b=b+Math.imul(vt,ee)|0,c=c+Math.imul(vt,re)|0,c=c+Math.imul(It,ee)|0,f=f+Math.imul(It,re)|0,b=b+Math.imul(rt,ne)|0,c=c+Math.imul(rt,ie)|0,c=c+Math.imul(st,ne)|0,f=f+Math.imul(st,ie)|0,b=b+Math.imul(I,se)|0,c=c+Math.imul(I,oe)|0,c=c+Math.imul(z,se)|0,f=f+Math.imul(z,oe)|0;var Nn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Nn>>>26)|0,Nn&=67108863,b=Math.imul(K,ht),c=Math.imul(K,$t),c=c+Math.imul(G,ht)|0,f=Math.imul(G,$t),b=b+Math.imul(d,Vt)|0,c=c+Math.imul(d,Ht)|0,c=c+Math.imul(x,Vt)|0,f=f+Math.imul(x,Ht)|0,b=b+Math.imul(Kt,Gt)|0,c=c+Math.imul(Kt,jt)|0,c=c+Math.imul(m,Gt)|0,f=f+Math.imul(m,jt)|0,b=b+Math.imul(Lt,Zt)|0,c=c+Math.imul(Lt,Yt)|0,c=c+Math.imul(zt,Zt)|0,f=f+Math.imul(zt,Yt)|0,b=b+Math.imul(Ct,Xt)|0,c=c+Math.imul(Ct,Jt)|0,c=c+Math.imul(Rt,Xt)|0,f=f+Math.imul(Rt,Jt)|0,b=b+Math.imul(Pt,Qt)|0,c=c+Math.imul(Pt,te)|0,c=c+Math.imul(Ft,Qt)|0,f=f+Math.imul(Ft,te)|0,b=b+Math.imul(At,ee)|0,c=c+Math.imul(At,re)|0,c=c+Math.imul(Nt,ee)|0,f=f+Math.imul(Nt,re)|0,b=b+Math.imul(vt,ne)|0,c=c+Math.imul(vt,ie)|0,c=c+Math.imul(It,ne)|0,f=f+Math.imul(It,ie)|0,b=b+Math.imul(rt,se)|0,c=c+Math.imul(rt,oe)|0,c=c+Math.imul(st,se)|0,f=f+Math.imul(st,oe)|0;var Fn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,b=Math.imul(K,Vt),c=Math.imul(K,Ht),c=c+Math.imul(G,Vt)|0,f=Math.imul(G,Ht),b=b+Math.imul(d,Gt)|0,c=c+Math.imul(d,jt)|0,c=c+Math.imul(x,Gt)|0,f=f+Math.imul(x,jt)|0,b=b+Math.imul(Kt,Zt)|0,c=c+Math.imul(Kt,Yt)|0,c=c+Math.imul(m,Zt)|0,f=f+Math.imul(m,Yt)|0,b=b+Math.imul(Lt,Xt)|0,c=c+Math.imul(Lt,Jt)|0,c=c+Math.imul(zt,Xt)|0,f=f+Math.imul(zt,Jt)|0,b=b+Math.imul(Ct,Qt)|0,c=c+Math.imul(Ct,te)|0,c=c+Math.imul(Rt,Qt)|0,f=f+Math.imul(Rt,te)|0,b=b+Math.imul(Pt,ee)|0,c=c+Math.imul(Pt,re)|0,c=c+Math.imul(Ft,ee)|0,f=f+Math.imul(Ft,re)|0,b=b+Math.imul(At,ne)|0,c=c+Math.imul(At,ie)|0,c=c+Math.imul(Nt,ne)|0,f=f+Math.imul(Nt,ie)|0,b=b+Math.imul(vt,se)|0,c=c+Math.imul(vt,oe)|0,c=c+Math.imul(It,se)|0,f=f+Math.imul(It,oe)|0;var zn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(zn>>>26)|0,zn&=67108863,b=Math.imul(K,Gt),c=Math.imul(K,jt),c=c+Math.imul(G,Gt)|0,f=Math.imul(G,jt),b=b+Math.imul(d,Zt)|0,c=c+Math.imul(d,Yt)|0,c=c+Math.imul(x,Zt)|0,f=f+Math.imul(x,Yt)|0,b=b+Math.imul(Kt,Xt)|0,c=c+Math.imul(Kt,Jt)|0,c=c+Math.imul(m,Xt)|0,f=f+Math.imul(m,Jt)|0,b=b+Math.imul(Lt,Qt)|0,c=c+Math.imul(Lt,te)|0,c=c+Math.imul(zt,Qt)|0,f=f+Math.imul(zt,te)|0,b=b+Math.imul(Ct,ee)|0,c=c+Math.imul(Ct,re)|0,c=c+Math.imul(Rt,ee)|0,f=f+Math.imul(Rt,re)|0,b=b+Math.imul(Pt,ne)|0,c=c+Math.imul(Pt,ie)|0,c=c+Math.imul(Ft,ne)|0,f=f+Math.imul(Ft,ie)|0,b=b+Math.imul(At,se)|0,c=c+Math.imul(At,oe)|0,c=c+Math.imul(Nt,se)|0,f=f+Math.imul(Nt,oe)|0;var Kn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Kn>>>26)|0,Kn&=67108863,b=Math.imul(K,Zt),c=Math.imul(K,Yt),c=c+Math.imul(G,Zt)|0,f=Math.imul(G,Yt),b=b+Math.imul(d,Xt)|0,c=c+Math.imul(d,Jt)|0,c=c+Math.imul(x,Xt)|0,f=f+Math.imul(x,Jt)|0,b=b+Math.imul(Kt,Qt)|0,c=c+Math.imul(Kt,te)|0,c=c+Math.imul(m,Qt)|0,f=f+Math.imul(m,te)|0,b=b+Math.imul(Lt,ee)|0,c=c+Math.imul(Lt,re)|0,c=c+Math.imul(zt,ee)|0,f=f+Math.imul(zt,re)|0,b=b+Math.imul(Ct,ne)|0,c=c+Math.imul(Ct,ie)|0,c=c+Math.imul(Rt,ne)|0,f=f+Math.imul(Rt,ie)|0,b=b+Math.imul(Pt,se)|0,c=c+Math.imul(Pt,oe)|0,c=c+Math.imul(Ft,se)|0,f=f+Math.imul(Ft,oe)|0;var qn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(qn>>>26)|0,qn&=67108863,b=Math.imul(K,Xt),c=Math.imul(K,Jt),c=c+Math.imul(G,Xt)|0,f=Math.imul(G,Jt),b=b+Math.imul(d,Qt)|0,c=c+Math.imul(d,te)|0,c=c+Math.imul(x,Qt)|0,f=f+Math.imul(x,te)|0,b=b+Math.imul(Kt,ee)|0,c=c+Math.imul(Kt,re)|0,c=c+Math.imul(m,ee)|0,f=f+Math.imul(m,re)|0,b=b+Math.imul(Lt,ne)|0,c=c+Math.imul(Lt,ie)|0,c=c+Math.imul(zt,ne)|0,f=f+Math.imul(zt,ie)|0,b=b+Math.imul(Ct,se)|0,c=c+Math.imul(Ct,oe)|0,c=c+Math.imul(Rt,se)|0,f=f+Math.imul(Rt,oe)|0;var Dn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,b=Math.imul(K,Qt),c=Math.imul(K,te),c=c+Math.imul(G,Qt)|0,f=Math.imul(G,te),b=b+Math.imul(d,ee)|0,c=c+Math.imul(d,re)|0,c=c+Math.imul(x,ee)|0,f=f+Math.imul(x,re)|0,b=b+Math.imul(Kt,ne)|0,c=c+Math.imul(Kt,ie)|0,c=c+Math.imul(m,ne)|0,f=f+Math.imul(m,ie)|0,b=b+Math.imul(Lt,se)|0,c=c+Math.imul(Lt,oe)|0,c=c+Math.imul(zt,se)|0,f=f+Math.imul(zt,oe)|0;var Wn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,b=Math.imul(K,ee),c=Math.imul(K,re),c=c+Math.imul(G,ee)|0,f=Math.imul(G,re),b=b+Math.imul(d,ne)|0,c=c+Math.imul(d,ie)|0,c=c+Math.imul(x,ne)|0,f=f+Math.imul(x,ie)|0,b=b+Math.imul(Kt,se)|0,c=c+Math.imul(Kt,oe)|0,c=c+Math.imul(m,se)|0,f=f+Math.imul(m,oe)|0;var $n=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+($n>>>26)|0,$n&=67108863,b=Math.imul(K,ne),c=Math.imul(K,ie),c=c+Math.imul(G,ne)|0,f=Math.imul(G,ie),b=b+Math.imul(d,se)|0,c=c+Math.imul(d,oe)|0,c=c+Math.imul(x,se)|0,f=f+Math.imul(x,oe)|0;var Vn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Vn>>>26)|0,Vn&=67108863,b=Math.imul(K,se),c=Math.imul(K,oe),c=c+Math.imul(G,se)|0,f=Math.imul(G,oe);var Hn=(L+b|0)+((c&8191)<<13)|0;return L=(f+(c>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,A[0]=Bn,A[1]=Rn,A[2]=Mn,A[3]=Tn,A[4]=Pn,A[5]=Ln,A[6]=Cn,A[7]=Un,A[8]=On,A[9]=Nn,A[10]=Fn,A[11]=zn,A[12]=Kn,A[13]=qn,A[14]=Dn,A[15]=Wn,A[16]=$n,A[17]=Vn,A[18]=Hn,L!==0&&(A[19]=L,g.length++),g};Math.imul||(H=F);function $(y,a,l){l.negative=a.negative^y.negative,l.length=y.length+a.length;for(var g=0,k=0,E=0;E<l.length-1;E++){var A=k;k=0;for(var L=g&67108863,b=Math.min(E,a.length-1),c=Math.max(0,E-y.length+1);c<=b;c++){var f=E-c,w=y.words[f]|0,I=a.words[c]|0,z=w*I,j=z&67108863;A=A+(z/67108864|0)|0,j=j+L|0,L=j&67108863,A=A+(j>>>26)|0,k+=A>>>26,A&=67108863}l.words[E]=L,g=A,A=k}return g!==0?l.words[E]=g:l.length--,l._strip()}function Y(y,a,l){return $(y,a,l)}i.prototype.mulTo=function(a,l){var g,k=this.length+a.length;return this.length===10&&a.length===10?g=H(this,a,l):k<63?g=F(this,a,l):k<1024?g=$(this,a,l):g=Y(this,a,l),g},i.prototype.mul=function(a){var l=new i(null);return l.words=new Array(this.length+a.length),this.mulTo(a,l)},i.prototype.mulf=function(a){var l=new i(null);return l.words=new Array(this.length+a.length),Y(this,a,l)},i.prototype.imul=function(a){return this.clone().mulTo(a,this)},i.prototype.imuln=function(a){var l=a<0;l&&(a=-a),r(typeof a=="number"),r(a<67108864);for(var g=0,k=0;k<this.length;k++){var E=(this.words[k]|0)*a,A=(E&67108863)+(g&67108863);g>>=26,g+=E/67108864|0,g+=A>>>26,this.words[k]=A&67108863}return g!==0&&(this.words[k]=g,this.length++),this.length=a===0?1:this.length,l?this.ineg():this},i.prototype.muln=function(a){return this.clone().imuln(a)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(a){var l=N(a);if(l.length===0)return new i(1);for(var g=this,k=0;k<l.length&&l[k]===0;k++,g=g.sqr());if(++k<l.length)for(var E=g.sqr();k<l.length;k++,E=E.sqr())l[k]!==0&&(g=g.mul(E));return g},i.prototype.iushln=function(a){r(typeof a=="number"&&a>=0);var l=a%26,g=(a-l)/26,k=67108863>>>26-l<<26-l,E;if(l!==0){var A=0;for(E=0;E<this.length;E++){var L=this.words[E]&k,b=(this.words[E]|0)-L<<l;this.words[E]=b|A,A=L>>>26-l}A&&(this.words[E]=A,this.length++)}if(g!==0){for(E=this.length-1;E>=0;E--)this.words[E+g]=this.words[E];for(E=0;E<g;E++)this.words[E]=0;this.length+=g}return this._strip()},i.prototype.ishln=function(a){return r(this.negative===0),this.iushln(a)},i.prototype.iushrn=function(a,l,g){r(typeof a=="number"&&a>=0);var k;l?k=(l-l%26)/26:k=0;var E=a%26,A=Math.min((a-E)/26,this.length),L=67108863^67108863>>>E<<E,b=g;if(k-=A,k=Math.max(0,k),b){for(var c=0;c<A;c++)b.words[c]=this.words[c];b.length=A}if(A!==0)if(this.length>A)for(this.length-=A,c=0;c<this.length;c++)this.words[c]=this.words[c+A];else this.words[0]=0,this.length=1;var f=0;for(c=this.length-1;c>=0&&(f!==0||c>=k);c--){var w=this.words[c]|0;this.words[c]=f<<26-E|w>>>E,f=w&L}return b&&f!==0&&(b.words[b.length++]=f),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.ishrn=function(a,l,g){return r(this.negative===0),this.iushrn(a,l,g)},i.prototype.shln=function(a){return this.clone().ishln(a)},i.prototype.ushln=function(a){return this.clone().iushln(a)},i.prototype.shrn=function(a){return this.clone().ishrn(a)},i.prototype.ushrn=function(a){return this.clone().iushrn(a)},i.prototype.testn=function(a){r(typeof a=="number"&&a>=0);var l=a%26,g=(a-l)/26,k=1<<l;if(this.length<=g)return!1;var E=this.words[g];return!!(E&k)},i.prototype.imaskn=function(a){r(typeof a=="number"&&a>=0);var l=a%26,g=(a-l)/26;if(r(this.negative===0,"imaskn works only with positive numbers"),this.length<=g)return this;if(l!==0&&g++,this.length=Math.min(g,this.length),l!==0){var k=67108863^67108863>>>l<<l;this.words[this.length-1]&=k}return this.length===0&&(this.words[0]=0,this.length=1),this._strip()},i.prototype.maskn=function(a){return this.clone().imaskn(a)},i.prototype.iaddn=function(a){return r(typeof a=="number"),r(a<67108864),a<0?this.isubn(-a):this.negative!==0?this.length===1&&(this.words[0]|0)<=a?(this.words[0]=a-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(a),this.negative=1,this):this._iaddn(a)},i.prototype._iaddn=function(a){this.words[0]+=a;for(var l=0;l<this.length&&this.words[l]>=67108864;l++)this.words[l]-=67108864,l===this.length-1?this.words[l+1]=1:this.words[l+1]++;return this.length=Math.max(this.length,l+1),this},i.prototype.isubn=function(a){if(r(typeof a=="number"),r(a<67108864),a<0)return this.iaddn(-a);if(this.negative!==0)return this.negative=0,this.iaddn(a),this.negative=1,this;if(this.words[0]-=a,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var l=0;l<this.length&&this.words[l]<0;l++)this.words[l]+=67108864,this.words[l+1]-=1;return this._strip()},i.prototype.addn=function(a){return this.clone().iaddn(a)},i.prototype.subn=function(a){return this.clone().isubn(a)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(a,l,g){var k=a.length+g,E;this._expand(k);var A,L=0;for(E=0;E<a.length;E++){A=(this.words[E+g]|0)+L;var b=(a.words[E]|0)*l;A-=b&67108863,L=(A>>26)-(b/67108864|0),this.words[E+g]=A&67108863}for(;E<this.length-g;E++)A=(this.words[E+g]|0)+L,L=A>>26,this.words[E+g]=A&67108863;if(L===0)return this._strip();for(r(L===-1),L=0,E=0;E<this.length;E++)A=-(this.words[E]|0)+L,L=A>>26,this.words[E]=A&67108863;return this.negative=1,this._strip()},i.prototype._wordDiv=function(a,l){var g=this.length-a.length,k=this.clone(),E=a,A=E.words[E.length-1]|0,L=this._countBits(A);g=26-L,g!==0&&(E=E.ushln(g),k.iushln(g),A=E.words[E.length-1]|0);var b=k.length-E.length,c;if(l!=="mod"){c=new i(null),c.length=b+1,c.words=new Array(c.length);for(var f=0;f<c.length;f++)c.words[f]=0}var w=k.clone()._ishlnsubmul(E,1,b);w.negative===0&&(k=w,c&&(c.words[b]=1));for(var I=b-1;I>=0;I--){var z=(k.words[E.length+I]|0)*67108864+(k.words[E.length+I-1]|0);for(z=Math.min(z/A|0,67108863),k._ishlnsubmul(E,z,I);k.negative!==0;)z--,k.negative=0,k._ishlnsubmul(E,1,I),k.isZero()||(k.negative^=1);c&&(c.words[I]=z)}return c&&c._strip(),k._strip(),l!=="div"&&g!==0&&k.iushrn(g),{div:c||null,mod:k}},i.prototype.divmod=function(a,l,g){if(r(!a.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var k,E,A;return this.negative!==0&&a.negative===0?(A=this.neg().divmod(a,l),l!=="mod"&&(k=A.div.neg()),l!=="div"&&(E=A.mod.neg(),g&&E.negative!==0&&E.iadd(a)),{div:k,mod:E}):this.negative===0&&a.negative!==0?(A=this.divmod(a.neg(),l),l!=="mod"&&(k=A.div.neg()),{div:k,mod:A.mod}):(this.negative&a.negative)!==0?(A=this.neg().divmod(a.neg(),l),l!=="div"&&(E=A.mod.neg(),g&&E.negative!==0&&E.isub(a)),{div:A.div,mod:E}):a.length>this.length||this.cmp(a)<0?{div:new i(0),mod:this}:a.length===1?l==="div"?{div:this.divn(a.words[0]),mod:null}:l==="mod"?{div:null,mod:new i(this.modrn(a.words[0]))}:{div:this.divn(a.words[0]),mod:new i(this.modrn(a.words[0]))}:this._wordDiv(a,l)},i.prototype.div=function(a){return this.divmod(a,"div",!1).div},i.prototype.mod=function(a){return this.divmod(a,"mod",!1).mod},i.prototype.umod=function(a){return this.divmod(a,"mod",!0).mod},i.prototype.divRound=function(a){var l=this.divmod(a);if(l.mod.isZero())return l.div;var g=l.div.negative!==0?l.mod.isub(a):l.mod,k=a.ushrn(1),E=a.andln(1),A=g.cmp(k);return A<0||E===1&&A===0?l.div:l.div.negative!==0?l.div.isubn(1):l.div.iaddn(1)},i.prototype.modrn=function(a){var l=a<0;l&&(a=-a),r(a<=67108863);for(var g=(1<<26)%a,k=0,E=this.length-1;E>=0;E--)k=(g*k+(this.words[E]|0))%a;return l?-k:k},i.prototype.modn=function(a){return this.modrn(a)},i.prototype.idivn=function(a){var l=a<0;l&&(a=-a),r(a<=67108863);for(var g=0,k=this.length-1;k>=0;k--){var E=(this.words[k]|0)+g*67108864;this.words[k]=E/a|0,g=E%a}return this._strip(),l?this.ineg():this},i.prototype.divn=function(a){return this.clone().idivn(a)},i.prototype.egcd=function(a){r(a.negative===0),r(!a.isZero());var l=this,g=a.clone();l.negative!==0?l=l.umod(a):l=l.clone();for(var k=new i(1),E=new i(0),A=new i(0),L=new i(1),b=0;l.isEven()&&g.isEven();)l.iushrn(1),g.iushrn(1),++b;for(var c=g.clone(),f=l.clone();!l.isZero();){for(var w=0,I=1;(l.words[0]&I)===0&&w<26;++w,I<<=1);if(w>0)for(l.iushrn(w);w-- >0;)(k.isOdd()||E.isOdd())&&(k.iadd(c),E.isub(f)),k.iushrn(1),E.iushrn(1);for(var z=0,j=1;(g.words[0]&j)===0&&z<26;++z,j<<=1);if(z>0)for(g.iushrn(z);z-- >0;)(A.isOdd()||L.isOdd())&&(A.iadd(c),L.isub(f)),A.iushrn(1),L.iushrn(1);l.cmp(g)>=0?(l.isub(g),k.isub(A),E.isub(L)):(g.isub(l),A.isub(k),L.isub(E))}return{a:A,b:L,gcd:g.iushln(b)}},i.prototype._invmp=function(a){r(a.negative===0),r(!a.isZero());var l=this,g=a.clone();l.negative!==0?l=l.umod(a):l=l.clone();for(var k=new i(1),E=new i(0),A=g.clone();l.cmpn(1)>0&&g.cmpn(1)>0;){for(var L=0,b=1;(l.words[0]&b)===0&&L<26;++L,b<<=1);if(L>0)for(l.iushrn(L);L-- >0;)k.isOdd()&&k.iadd(A),k.iushrn(1);for(var c=0,f=1;(g.words[0]&f)===0&&c<26;++c,f<<=1);if(c>0)for(g.iushrn(c);c-- >0;)E.isOdd()&&E.iadd(A),E.iushrn(1);l.cmp(g)>=0?(l.isub(g),k.isub(E)):(g.isub(l),E.isub(k))}var w;return l.cmpn(1)===0?w=k:w=E,w.cmpn(0)<0&&w.iadd(a),w},i.prototype.gcd=function(a){if(this.isZero())return a.abs();if(a.isZero())return this.abs();var l=this.clone(),g=a.clone();l.negative=0,g.negative=0;for(var k=0;l.isEven()&&g.isEven();k++)l.iushrn(1),g.iushrn(1);do{for(;l.isEven();)l.iushrn(1);for(;g.isEven();)g.iushrn(1);var E=l.cmp(g);if(E<0){var A=l;l=g,g=A}else if(E===0||g.cmpn(1)===0)break;l.isub(g)}while(!0);return g.iushln(k)},i.prototype.invm=function(a){return this.egcd(a).a.umod(a)},i.prototype.isEven=function(){return(this.words[0]&1)===0},i.prototype.isOdd=function(){return(this.words[0]&1)===1},i.prototype.andln=function(a){return this.words[0]&a},i.prototype.bincn=function(a){r(typeof a=="number");var l=a%26,g=(a-l)/26,k=1<<l;if(this.length<=g)return this._expand(g+1),this.words[g]|=k,this;for(var E=k,A=g;E!==0&&A<this.length;A++){var L=this.words[A]|0;L+=E,E=L>>>26,L&=67108863,this.words[A]=L}return E!==0&&(this.words[A]=E,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(a){var l=a<0;if(this.negative!==0&&!l)return-1;if(this.negative===0&&l)return 1;this._strip();var g;if(this.length>1)g=1;else{l&&(a=-a),r(a<=67108863,"Number is too big");var k=this.words[0]|0;g=k===a?0:k<a?-1:1}return this.negative!==0?-g|0:g},i.prototype.cmp=function(a){if(this.negative!==0&&a.negative===0)return-1;if(this.negative===0&&a.negative!==0)return 1;var l=this.ucmp(a);return this.negative!==0?-l|0:l},i.prototype.ucmp=function(a){if(this.length>a.length)return 1;if(this.length<a.length)return-1;for(var l=0,g=this.length-1;g>=0;g--){var k=this.words[g]|0,E=a.words[g]|0;if(k!==E){k<E?l=-1:k>E&&(l=1);break}}return l},i.prototype.gtn=function(a){return this.cmpn(a)===1},i.prototype.gt=function(a){return this.cmp(a)===1},i.prototype.gten=function(a){return this.cmpn(a)>=0},i.prototype.gte=function(a){return this.cmp(a)>=0},i.prototype.ltn=function(a){return this.cmpn(a)===-1},i.prototype.lt=function(a){return this.cmp(a)===-1},i.prototype.lten=function(a){return this.cmpn(a)<=0},i.prototype.lte=function(a){return this.cmp(a)<=0},i.prototype.eqn=function(a){return this.cmpn(a)===0},i.prototype.eq=function(a){return this.cmp(a)===0},i.red=function(a){return new D(a)},i.prototype.toRed=function(a){return r(!this.red,"Already a number in reduction context"),r(this.negative===0,"red works only with positives"),a.convertTo(this)._forceRed(a)},i.prototype.fromRed=function(){return r(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},i.prototype._forceRed=function(a){return this.red=a,this},i.prototype.forceRed=function(a){return r(!this.red,"Already a number in reduction context"),this._forceRed(a)},i.prototype.redAdd=function(a){return r(this.red,"redAdd works only with red numbers"),this.red.add(this,a)},i.prototype.redIAdd=function(a){return r(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,a)},i.prototype.redSub=function(a){return r(this.red,"redSub works only with red numbers"),this.red.sub(this,a)},i.prototype.redISub=function(a){return r(this.red,"redISub works only with red numbers"),this.red.isub(this,a)},i.prototype.redShl=function(a){return r(this.red,"redShl works only with red numbers"),this.red.shl(this,a)},i.prototype.redMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.mul(this,a)},i.prototype.redIMul=function(a){return r(this.red,"redMul works only with red numbers"),this.red._verify2(this,a),this.red.imul(this,a)},i.prototype.redSqr=function(){return r(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return r(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return r(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return r(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return r(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(a){return r(this.red&&!a.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,a)};var X={k256:null,p224:null,p192:null,p25519:null};function Q(y,a){this.name=y,this.p=new i(a,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Q.prototype._tmp=function(){var a=new i(null);return a.words=new Array(Math.ceil(this.n/13)),a},Q.prototype.ireduce=function(a){var l=a,g;do this.split(l,this.tmp),l=this.imulK(l),l=l.iadd(this.tmp),g=l.bitLength();while(g>this.n);var k=g<this.n?-1:l.ucmp(this.p);return k===0?(l.words[0]=0,l.length=1):k>0?l.isub(this.p):l.strip!==void 0?l.strip():l._strip(),l},Q.prototype.split=function(a,l){a.iushrn(this.n,0,l)},Q.prototype.imulK=function(a){return a.imul(this.k)};function ct(){Q.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}s(ct,Q),ct.prototype.split=function(a,l){for(var g=4194303,k=Math.min(a.length,9),E=0;E<k;E++)l.words[E]=a.words[E];if(l.length=k,a.length<=9){a.words[0]=0,a.length=1;return}var A=a.words[9];for(l.words[l.length++]=A&g,E=10;E<a.length;E++){var L=a.words[E]|0;a.words[E-10]=(L&g)<<4|A>>>22,A=L}A>>>=22,a.words[E-10]=A,A===0&&a.length>10?a.length-=10:a.length-=9},ct.prototype.imulK=function(a){a.words[a.length]=0,a.words[a.length+1]=0,a.length+=2;for(var l=0,g=0;g<a.length;g++){var k=a.words[g]|0;l+=k*977,a.words[g]=l&67108863,l=k*64+(l/67108864|0)}return a.words[a.length-1]===0&&(a.length--,a.words[a.length-1]===0&&a.length--),a};function ot(){Q.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}s(ot,Q);function C(){Q.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}s(C,Q);function U(){Q.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}s(U,Q),U.prototype.imulK=function(a){for(var l=0,g=0;g<a.length;g++){var k=(a.words[g]|0)*19+l,E=k&67108863;k>>>=26,a.words[g]=E,l=k}return l!==0&&(a.words[a.length++]=l),a},i._prime=function(a){if(X[a])return X[a];var l;if(a==="k256")l=new ct;else if(a==="p224")l=new ot;else if(a==="p192")l=new C;else if(a==="p25519")l=new U;else throw new Error("Unknown prime "+a);return X[a]=l,l};function D(y){if(typeof y=="string"){var a=i._prime(y);this.m=a.p,this.prime=a}else r(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null}D.prototype._verify1=function(a){r(a.negative===0,"red works only with positives"),r(a.red,"red works only with red numbers")},D.prototype._verify2=function(a,l){r((a.negative|l.negative)===0,"red works only with positives"),r(a.red&&a.red===l.red,"red works only with red numbers")},D.prototype.imod=function(a){return this.prime?this.prime.ireduce(a)._forceRed(this):(B(a,a.umod(this.m)._forceRed(this)),a)},D.prototype.neg=function(a){return a.isZero()?a.clone():this.m.sub(a)._forceRed(this)},D.prototype.add=function(a,l){this._verify2(a,l);var g=a.add(l);return g.cmp(this.m)>=0&&g.isub(this.m),g._forceRed(this)},D.prototype.iadd=function(a,l){this._verify2(a,l);var g=a.iadd(l);return g.cmp(this.m)>=0&&g.isub(this.m),g},D.prototype.sub=function(a,l){this._verify2(a,l);var g=a.sub(l);return g.cmpn(0)<0&&g.iadd(this.m),g._forceRed(this)},D.prototype.isub=function(a,l){this._verify2(a,l);var g=a.isub(l);return g.cmpn(0)<0&&g.iadd(this.m),g},D.prototype.shl=function(a,l){return this._verify1(a),this.imod(a.ushln(l))},D.prototype.imul=function(a,l){return this._verify2(a,l),this.imod(a.imul(l))},D.prototype.mul=function(a,l){return this._verify2(a,l),this.imod(a.mul(l))},D.prototype.isqr=function(a){return this.imul(a,a.clone())},D.prototype.sqr=function(a){return this.mul(a,a)},D.prototype.sqrt=function(a){if(a.isZero())return a.clone();var l=this.m.andln(3);if(r(l%2===1),l===3){var g=this.m.add(new i(1)).iushrn(2);return this.pow(a,g)}for(var k=this.m.subn(1),E=0;!k.isZero()&&k.andln(1)===0;)E++,k.iushrn(1);r(!k.isZero());var A=new i(1).toRed(this),L=A.redNeg(),b=this.m.subn(1).iushrn(1),c=this.m.bitLength();for(c=new i(2*c*c).toRed(this);this.pow(c,b).cmp(L)!==0;)c.redIAdd(L);for(var f=this.pow(c,k),w=this.pow(a,k.addn(1).iushrn(1)),I=this.pow(a,k),z=E;I.cmp(A)!==0;){for(var j=I,rt=0;j.cmp(A)!==0;rt++)j=j.redSqr();r(rt<z);var st=this.pow(f,new i(1).iushln(z-rt-1));w=w.redMul(st),f=st.redSqr(),I=I.redMul(f),z=rt}return w},D.prototype.invm=function(a){var l=a._invmp(this.m);return l.negative!==0?(l.negative=0,this.imod(l).redNeg()):this.imod(l)},D.prototype.pow=function(a,l){if(l.isZero())return new i(1).toRed(this);if(l.cmpn(1)===0)return a.clone();var g=4,k=new Array(1<<g);k[0]=new i(1).toRed(this),k[1]=a;for(var E=2;E<k.length;E++)k[E]=this.mul(k[E-1],a);var A=k[0],L=0,b=0,c=l.bitLength()%26;for(c===0&&(c=26),E=l.length-1;E>=0;E--){for(var f=l.words[E],w=c-1;w>=0;w--){var I=f>>w&1;if(A!==k[0]&&(A=this.sqr(A)),I===0&&L===0){b=0;continue}L<<=1,L|=I,b++,!(b!==g&&(E!==0||w!==0))&&(A=this.mul(A,k[L]),b=0,L=0)}c=26}return A},D.prototype.convertTo=function(a){var l=a.umod(this.m);return l===a?l.clone():l},D.prototype.convertFrom=function(a){var l=a.clone();return l.red=null,l},i.mont=function(a){return new V(a)};function V(y){D.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new i(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}s(V,D),V.prototype.convertTo=function(a){return this.imod(a.ushln(this.shift))},V.prototype.convertFrom=function(a){var l=this.imod(a.mul(this.rinv));return l.red=null,l},V.prototype.imul=function(a,l){if(a.isZero()||l.isZero())return a.words[0]=0,a.length=1,a;var g=a.imul(l),k=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=g.isub(k).iushrn(this.shift),A=E;return E.cmp(this.m)>=0?A=E.isub(this.m):E.cmpn(0)<0&&(A=E.iadd(this.m)),A._forceRed(this)},V.prototype.mul=function(a,l){if(a.isZero()||l.isZero())return new i(0)._forceRed(this);var g=a.mul(l),k=g.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),E=g.isub(k).iushrn(this.shift),A=E;return E.cmp(this.m)>=0?A=E.isub(this.m):E.cmpn(0)<0&&(A=E.iadd(this.m)),A._forceRed(this)},V.prototype.invm=function(a){var l=this.imod(a._invmp(this.m).mul(this.r2));return l._forceRed(this)}})(n,Fc)})(rn)),rn.exports}var zc=zo();const Es=Ri(zc);var Jr={exports:{}};var Is;function Ko(){return Is||(Is=1,(function(n,t){var e=Mi(),r=e.Buffer;function s(o,u){for(var p in o)u[p]=o[p]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?n.exports=e:(s(e,t),t.Buffer=i);function i(o,u,p){return r(o,u,p)}i.prototype=Object.create(r.prototype),s(r,i),i.from=function(o,u,p){if(typeof o=="number")throw new TypeError("Argument must not be a number");return r(o,u,p)},i.alloc=function(o,u,p){if(typeof o!="number")throw new TypeError("Argument must be a number");var v=r(o);return u!==void 0?typeof p=="string"?v.fill(u,p):v.fill(u):v.fill(0),v},i.allocUnsafe=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return r(o)},i.allocUnsafeSlow=function(o){if(typeof o!="number")throw new TypeError("Argument must be a number");return e.SlowBuffer(o)}})(Jr,Jr.exports)),Jr.exports}var ti,As;function Kc(){if(As)return ti;As=1;var n=Ko().Buffer;function t(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),s=0;s<r.length;s++)r[s]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),u=o.charCodeAt(0);if(r[u]!==255)throw new TypeError(o+" is ambiguous");r[u]=i}var p=e.length,v=e.charAt(0),B=Math.log(p)/Math.log(256),P=Math.log(256)/Math.log(p);function _(M){if((Array.isArray(M)||M instanceof Uint8Array)&&(M=n.from(M)),!n.isBuffer(M))throw new TypeError("Expected Buffer");if(M.length===0)return"";for(var N=0,F=0,H=0,$=M.length;H!==$&&M[H]===0;)H++,N++;for(var Y=($-H)*P+1>>>0,X=new Uint8Array(Y);H!==$;){for(var Q=M[H],ct=0,ot=Y-1;(Q!==0||ct<F)&&ot!==-1;ot--,ct++)Q+=256*X[ot]>>>0,X[ot]=Q%p>>>0,Q=Q/p>>>0;if(Q!==0)throw new Error("Non-zero carry");F=ct,H++}for(var C=Y-F;C!==Y&&X[C]===0;)C++;for(var U=v.repeat(N);C<Y;++C)U+=e.charAt(X[C]);return U}function S(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return n.alloc(0);for(var N=0,F=0,H=0;M[N]===v;)F++,N++;for(var $=(M.length-N)*B+1>>>0,Y=new Uint8Array($);N<M.length;){var X=M.charCodeAt(N);if(X>255)return;var Q=r[X];if(Q===255)return;for(var ct=0,ot=$-1;(Q!==0||ct<H)&&ot!==-1;ot--,ct++)Q+=p*Y[ot]>>>0,Y[ot]=Q%256>>>0,Q=Q/256>>>0;if(Q!==0)throw new Error("Non-zero carry");H=ct,N++}for(var C=$-H;C!==$&&Y[C]===0;)C++;var U=n.allocUnsafe(F+($-C));U.fill(0,0,F);for(var D=F;C!==$;)U[D++]=Y[C++];return U}function T(M){var N=S(M);if(N)return N;throw new Error("Non-base"+p+" character")}return{encode:_,decodeUnsafe:S,decode:T}}return ti=t,ti}var ei,_s;function qc(){if(_s)return ei;_s=1;var n=Kc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ei=n(t),ei}var Dc=qc();const he=Ri(Dc),Bs=wo;var Et={},ri,Rs;function Wc(){if(Rs)return ri;Rs=1;var n=Ko().Buffer;function t(e){if(e.length>=255)throw new TypeError("Alphabet too long");for(var r=new Uint8Array(256),s=0;s<r.length;s++)r[s]=255;for(var i=0;i<e.length;i++){var o=e.charAt(i),u=o.charCodeAt(0);if(r[u]!==255)throw new TypeError(o+" is ambiguous");r[u]=i}var p=e.length,v=e.charAt(0),B=Math.log(p)/Math.log(256),P=Math.log(256)/Math.log(p);function _(M){if((Array.isArray(M)||M instanceof Uint8Array)&&(M=n.from(M)),!n.isBuffer(M))throw new TypeError("Expected Buffer");if(M.length===0)return"";for(var N=0,F=0,H=0,$=M.length;H!==$&&M[H]===0;)H++,N++;for(var Y=($-H)*P+1>>>0,X=new Uint8Array(Y);H!==$;){for(var Q=M[H],ct=0,ot=Y-1;(Q!==0||ct<F)&&ot!==-1;ot--,ct++)Q+=256*X[ot]>>>0,X[ot]=Q%p>>>0,Q=Q/p>>>0;if(Q!==0)throw new Error("Non-zero carry");F=ct,H++}for(var C=Y-F;C!==Y&&X[C]===0;)C++;for(var U=v.repeat(N);C<Y;++C)U+=e.charAt(X[C]);return U}function S(M){if(typeof M!="string")throw new TypeError("Expected String");if(M.length===0)return n.alloc(0);for(var N=0,F=0,H=0;M[N]===v;)F++,N++;for(var $=(M.length-N)*B+1>>>0,Y=new Uint8Array($);N<M.length;){var X=M.charCodeAt(N);if(X>255)return;var Q=r[X];if(Q===255)return;for(var ct=0,ot=$-1;(Q!==0||ct<H)&&ot!==-1;ot--,ct++)Q+=p*Y[ot]>>>0,Y[ot]=Q%256>>>0,Q=Q/256>>>0;if(Q!==0)throw new Error("Non-zero carry");H=ct,N++}for(var C=$-H;C!==$&&Y[C]===0;)C++;var U=n.allocUnsafe(F+($-C));U.fill(0,0,F);for(var D=F;C!==$;)U[D++]=Y[C++];return U}function T(M){var N=S(M);if(N)return N;throw new Error("Non-base"+p+" character")}return{encode:_,decodeUnsafe:S,decode:T}}return ri=t,ri}var ni,Ms;function $c(){if(Ms)return ni;Ms=1;var n=Wc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ni=n(t),ni}function Ke(n,t,e){return t<=n&&n<=e}function kn(n){if(n===void 0)return{};if(n===Object(n))return n;throw TypeError("Could not convert argument to dictionary")}function Vc(n){for(var t=String(n),e=t.length,r=0,s=[];r<e;){var i=t.charCodeAt(r);if(i<55296||i>57343)s.push(i);else if(56320<=i&&i<=57343)s.push(65533);else if(55296<=i&&i<=56319)if(r===e-1)s.push(65533);else{var o=n.charCodeAt(r+1);if(56320<=o&&o<=57343){var u=i&1023,p=o&1023;s.push(65536+(u<<10)+p),r+=1}else s.push(65533)}r+=1}return s}function Hc(n){for(var t="",e=0;e<n.length;++e){var r=n[e];r<=65535?t+=String.fromCharCode(r):(r-=65536,t+=String.fromCharCode((r>>10)+55296,(r&1023)+56320))}return t}var cn=-1;function Fi(n){this.tokens=[].slice.call(n)}Fi.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():cn},prepend:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.unshift(t.pop());else this.tokens.unshift(n)},push:function(n){if(Array.isArray(n))for(var t=n;t.length;)this.tokens.push(t.shift());else this.tokens.push(n)}};var vr=-1;function ii(n,t){if(n)throw TypeError("Decoder error");return t||65533}var un="utf-8";function fn(n,t){if(!(this instanceof fn))return new fn(n,t);if(n=n!==void 0?String(n).toLowerCase():un,n!==un)throw new Error("Encoding not supported. Only utf-8 is supported");t=kn(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}fn.prototype={decode:function(t,e){var r;typeof t=="object"&&t instanceof ArrayBuffer?r=new Uint8Array(t):typeof t=="object"&&"buffer"in t&&t.buffer instanceof ArrayBuffer?r=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):r=new Uint8Array(0),e=kn(e),this._streaming||(this._decoder=new Gc({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var s=new Fi(r),i=[],o;!s.endOfStream()&&(o=this._decoder.handler(s,s.read()),o!==vr);)o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o));if(!this._streaming){do{if(o=this._decoder.handler(s,s.read()),o===vr)break;o!==null&&(Array.isArray(o)?i.push.apply(i,o):i.push(o))}while(!s.endOfStream());this._decoder=null}return i.length&&["utf-8"].indexOf(this.encoding)!==-1&&!this._ignoreBOM&&!this._BOMseen&&(i[0]===65279?(this._BOMseen=!0,i.shift()):this._BOMseen=!0),Hc(i)}};function hn(n,t){if(!(this instanceof hn))return new hn(n,t);if(n=n!==void 0?String(n).toLowerCase():un,n!==un)throw new Error("Encoding not supported. Only utf-8 is supported");t=kn(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}hn.prototype={encode:function(t,e){t=t?String(t):"",e=kn(e),this._streaming||(this._encoder=new jc(this._options)),this._streaming=!!e.stream;for(var r=[],s=new Fi(Vc(t)),i;!s.endOfStream()&&(i=this._encoder.handler(s,s.read()),i!==vr);)Array.isArray(i)?r.push.apply(r,i):r.push(i);if(!this._streaming){for(;i=this._encoder.handler(s,s.read()),i!==vr;)Array.isArray(i)?r.push.apply(r,i):r.push(i);this._encoder=null}return new Uint8Array(r)}};function Gc(n){var t=n.fatal,e=0,r=0,s=0,i=128,o=191;this.handler=function(u,p){if(p===cn&&s!==0)return s=0,ii(t);if(p===cn)return vr;if(s===0){if(Ke(p,0,127))return p;if(Ke(p,194,223))s=1,e=p-192;else if(Ke(p,224,239))p===224&&(i=160),p===237&&(o=159),s=2,e=p-224;else if(Ke(p,240,244))p===240&&(i=144),p===244&&(o=143),s=3,e=p-240;else return ii(t);return e=e<<6*s,null}if(!Ke(p,i,o))return e=s=r=0,i=128,o=191,u.prepend(p),ii(t);if(i=128,o=191,r+=1,e+=p-128<<6*(s-r),r!==s)return null;var v=e;return e=s=r=0,v}}function jc(n){n.fatal,this.handler=function(t,e){if(e===cn)return vr;if(Ke(e,0,127))return e;var r,s;Ke(e,128,2047)?(r=1,s=192):Ke(e,2048,65535)?(r=2,s=224):Ke(e,65536,1114111)&&(r=3,s=240);for(var i=[(e>>6*r)+s];r>0;){var o=e>>6*(r-1);i.push(128|o&63),r-=1}return i}}const Zc=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:fn,TextEncoder:hn},Symbol.toStringTag,{value:"Module"})),Yc=uo(Zc);var Ts;function Xc(){if(Ts)return Et;Ts=1;var n=Et&&Et.__createBinding||(Object.create?(function(C,U,D,V){V===void 0&&(V=D),Object.defineProperty(C,V,{enumerable:!0,get:function(){return U[D]}})}):(function(C,U,D,V){V===void 0&&(V=D),C[V]=U[D]})),t=Et&&Et.__setModuleDefault||(Object.create?(function(C,U){Object.defineProperty(C,"default",{enumerable:!0,value:U})}):function(C,U){C.default=U}),e=Et&&Et.__decorate||function(C,U,D,V){var y=arguments.length,a=y<3?U:V===null?V=Object.getOwnPropertyDescriptor(U,D):V,l;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(C,U,D,V);else for(var g=C.length-1;g>=0;g--)(l=C[g])&&(a=(y<3?l(a):y>3?l(U,D,a):l(U,D))||a);return y>3&&a&&Object.defineProperty(U,D,a),a},r=Et&&Et.__importStar||function(C){if(C&&C.__esModule)return C;var U={};if(C!=null)for(var D in C)D!=="default"&&Object.hasOwnProperty.call(C,D)&&n(U,C,D);return t(U,C),U},s=Et&&Et.__importDefault||function(C){return C&&C.__esModule?C:{default:C}};Object.defineProperty(Et,"__esModule",{value:!0}),Et.deserializeUnchecked=Et.deserialize=Et.serialize=Et.BinaryReader=Et.BinaryWriter=Et.BorshError=Et.baseDecode=Et.baseEncode=void 0;const i=s(zo()),o=s($c()),u=r(Yc),p=typeof TextDecoder!="function"?u.TextDecoder:TextDecoder,v=new p("utf-8",{fatal:!0});function B(C){return typeof C=="string"&&(C=Buffer.from(C,"utf8")),o.default.encode(Buffer.from(C))}Et.baseEncode=B;function P(C){return Buffer.from(o.default.decode(C))}Et.baseDecode=P;const _=1024;class S extends Error{constructor(U){super(U),this.fieldPath=[],this.originalMessage=U}addToFieldPath(U){this.fieldPath.splice(0,0,U),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}Et.BorshError=S;class T{constructor(){this.buf=Buffer.alloc(_),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=Buffer.concat([this.buf,Buffer.alloc(_)]))}writeU8(U){this.maybeResize(),this.buf.writeUInt8(U,this.length),this.length+=1}writeU16(U){this.maybeResize(),this.buf.writeUInt16LE(U,this.length),this.length+=2}writeU32(U){this.maybeResize(),this.buf.writeUInt32LE(U,this.length),this.length+=4}writeU64(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",8)))}writeU128(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",16)))}writeU256(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",32)))}writeU512(U){this.maybeResize(),this.writeBuffer(Buffer.from(new i.default(U).toArray("le",64)))}writeBuffer(U){this.buf=Buffer.concat([Buffer.from(this.buf.subarray(0,this.length)),U,Buffer.alloc(_)]),this.length+=U.length}writeString(U){this.maybeResize();const D=Buffer.from(U,"utf8");this.writeU32(D.length),this.writeBuffer(D)}writeFixedArray(U){this.writeBuffer(Buffer.from(U))}writeArray(U,D){this.maybeResize(),this.writeU32(U.length);for(const V of U)this.maybeResize(),D(V)}toArray(){return this.buf.subarray(0,this.length)}}Et.BinaryWriter=T;function M(C,U,D){const V=D.value;D.value=function(...y){try{return V.apply(this,y)}catch(a){if(a instanceof RangeError){const l=a.code;if(["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(l)>=0)throw new S("Reached the end of buffer when deserializing")}throw a}}}class N{constructor(U){this.buf=U,this.offset=0}readU8(){const U=this.buf.readUInt8(this.offset);return this.offset+=1,U}readU16(){const U=this.buf.readUInt16LE(this.offset);return this.offset+=2,U}readU32(){const U=this.buf.readUInt32LE(this.offset);return this.offset+=4,U}readU64(){const U=this.readBuffer(8);return new i.default(U,"le")}readU128(){const U=this.readBuffer(16);return new i.default(U,"le")}readU256(){const U=this.readBuffer(32);return new i.default(U,"le")}readU512(){const U=this.readBuffer(64);return new i.default(U,"le")}readBuffer(U){if(this.offset+U>this.buf.length)throw new S(`Expected buffer length ${U} isn't within bounds`);const D=this.buf.slice(this.offset,this.offset+U);return this.offset+=U,D}readString(){const U=this.readU32(),D=this.readBuffer(U);try{return v.decode(D)}catch(V){throw new S(`Error decoding UTF-8 string: ${V}`)}}readFixedArray(U){return new Uint8Array(this.readBuffer(U))}readArray(U){const D=this.readU32(),V=Array();for(let y=0;y<D;++y)V.push(U());return V}}e([M],N.prototype,"readU8",null),e([M],N.prototype,"readU16",null),e([M],N.prototype,"readU32",null),e([M],N.prototype,"readU64",null),e([M],N.prototype,"readU128",null),e([M],N.prototype,"readU256",null),e([M],N.prototype,"readU512",null),e([M],N.prototype,"readString",null),e([M],N.prototype,"readFixedArray",null),e([M],N.prototype,"readArray",null),Et.BinaryReader=N;function F(C){return C.charAt(0).toUpperCase()+C.slice(1)}function H(C,U,D,V,y){try{if(typeof V=="string")y[`write${F(V)}`](D);else if(V instanceof Array)if(typeof V[0]=="number"){if(D.length!==V[0])throw new S(`Expecting byte array of length ${V[0]}, but got ${D.length} bytes`);y.writeFixedArray(D)}else if(V.length===2&&typeof V[1]=="number"){if(D.length!==V[1])throw new S(`Expecting byte array of length ${V[1]}, but got ${D.length} bytes`);for(let a=0;a<V[1];a++)H(C,null,D[a],V[0],y)}else y.writeArray(D,a=>{H(C,U,a,V[0],y)});else if(V.kind!==void 0)switch(V.kind){case"option":{D==null?y.writeU8(0):(y.writeU8(1),H(C,U,D,V.type,y));break}case"map":{y.writeU32(D.size),D.forEach((a,l)=>{H(C,U,l,V.key,y),H(C,U,a,V.value,y)});break}default:throw new S(`FieldType ${V} unrecognized`)}else $(C,D,y)}catch(a){throw a instanceof S&&a.addToFieldPath(U),a}}function $(C,U,D){if(typeof U.borshSerialize=="function"){U.borshSerialize(D);return}const V=C.get(U.constructor);if(!V)throw new S(`Class ${U.constructor.name} is missing in schema`);if(V.kind==="struct")V.fields.map(([y,a])=>{H(C,y,U[y],a,D)});else if(V.kind==="enum"){const y=U[V.field];for(let a=0;a<V.values.length;++a){const[l,g]=V.values[a];if(l===y){D.writeU8(a),H(C,l,U[l],g,D);break}}}else throw new S(`Unexpected schema kind: ${V.kind} for ${U.constructor.name}`)}function Y(C,U,D=T){const V=new D;return $(C,U,V),V.toArray()}Et.serialize=Y;function X(C,U,D,V){try{if(typeof D=="string")return V[`read${F(D)}`]();if(D instanceof Array){if(typeof D[0]=="number")return V.readFixedArray(D[0]);if(typeof D[1]=="number"){const y=[];for(let a=0;a<D[1];a++)y.push(X(C,null,D[0],V));return y}else return V.readArray(()=>X(C,U,D[0],V))}if(D.kind==="option")return V.readU8()?X(C,U,D.type,V):void 0;if(D.kind==="map"){let y=new Map;const a=V.readU32();for(let l=0;l<a;l++){const g=X(C,U,D.key,V),k=X(C,U,D.value,V);y.set(g,k)}return y}return Q(C,D,V)}catch(y){throw y instanceof S&&y.addToFieldPath(U),y}}function Q(C,U,D){if(typeof U.borshDeserialize=="function")return U.borshDeserialize(D);const V=C.get(U);if(!V)throw new S(`Class ${U.name} is missing in schema`);if(V.kind==="struct"){const y={};for(const[a,l]of C.get(U).fields)y[a]=X(C,a,l,D);return new U(y)}if(V.kind==="enum"){const y=D.readU8();if(y>=V.values.length)throw new S(`Enum index: ${y} is out of range`);const[a,l]=V.values[y],g=X(C,a,l,D);return new U({[a]:g})}throw new S(`Unexpected schema kind: ${V.kind} for ${U.constructor.name}`)}function ct(C,U,D,V=N){const y=new V(D),a=Q(C,U,y);if(y.offset<D.length)throw new S(`Unexpected ${D.length-y.offset} bytes after deserialized data`);return a}Et.deserialize=ct;function ot(C,U,D,V=N){const y=new V(D);return Q(C,U,y)}return Et.deserializeUnchecked=ot,Et}var si=Xc(),W={},Ps;function Jc(){if(Ps)return W;Ps=1,Object.defineProperty(W,"__esModule",{value:!0}),W.s16=W.s8=W.nu64be=W.u48be=W.u40be=W.u32be=W.u24be=W.u16be=W.nu64=W.u48=W.u40=W.u32=W.u24=W.u16=W.u8=W.offset=W.greedy=W.Constant=W.UTF8=W.CString=W.Blob=W.Boolean=W.BitField=W.BitStructure=W.VariantLayout=W.Union=W.UnionLayoutDiscriminator=W.UnionDiscriminator=W.Structure=W.Sequence=W.DoubleBE=W.Double=W.FloatBE=W.Float=W.NearInt64BE=W.NearInt64=W.NearUInt64BE=W.NearUInt64=W.IntBE=W.Int=W.UIntBE=W.UInt=W.OffsetLayout=W.GreedyCount=W.ExternalLayout=W.bindConstructorLayout=W.nameWithProperty=W.Layout=W.uint8ArrayToBuffer=W.checkUint8Array=void 0,W.constant=W.utf8=W.cstr=W.blob=W.unionLayoutDiscriminator=W.union=W.seq=W.bits=W.struct=W.f64be=W.f64=W.f32be=W.f32=W.ns64be=W.s48be=W.s40be=W.s32be=W.s24be=W.s16be=W.ns64=W.s48=W.s40=W.s32=W.s24=void 0;const n=Mi();function t(c){if(!(c instanceof Uint8Array))throw new TypeError("b must be a Uint8Array")}W.checkUint8Array=t;function e(c){return t(c),n.Buffer.from(c.buffer,c.byteOffset,c.length)}W.uint8ArrayToBuffer=e;let r=class{constructor(f,w){if(!Number.isInteger(f))throw new TypeError("span must be an integer");this.span=f,this.property=w}makeDestinationObject(){return{}}getSpan(f,w){if(0>this.span)throw new RangeError("indeterminate span");return this.span}replicate(f){const w=Object.create(this.constructor.prototype);return Object.assign(w,this),w.property=f,w}fromArray(f){}};W.Layout=r;function s(c,f){return f.property?c+"["+f.property+"]":c}W.nameWithProperty=s;function i(c,f){if(typeof c!="function")throw new TypeError("Class must be constructor");if(Object.prototype.hasOwnProperty.call(c,"layout_"))throw new Error("Class is already bound to a layout");if(!(f&&f instanceof r))throw new TypeError("layout must be a Layout");if(Object.prototype.hasOwnProperty.call(f,"boundConstructor_"))throw new Error("layout is already bound to a constructor");c.layout_=f,f.boundConstructor_=c,f.makeDestinationObject=(()=>new c),Object.defineProperty(c.prototype,"encode",{value(w,I){return f.encode(this,w,I)},writable:!0}),Object.defineProperty(c,"decode",{value(w,I){return f.decode(w,I)},writable:!0})}W.bindConstructorLayout=i;class o extends r{isCount(){throw new Error("ExternalLayout is abstract")}}W.ExternalLayout=o;class u extends o{constructor(f=1,w){if(!Number.isInteger(f)||0>=f)throw new TypeError("elementSpan must be a (positive) integer");super(-1,w),this.elementSpan=f}isCount(){return!0}decode(f,w=0){t(f);const I=f.length-w;return Math.floor(I/this.elementSpan)}encode(f,w,I){return 0}}W.GreedyCount=u;class p extends o{constructor(f,w=0,I){if(!(f instanceof r))throw new TypeError("layout must be a Layout");if(!Number.isInteger(w))throw new TypeError("offset must be integer or undefined");super(f.span,I||f.property),this.layout=f,this.offset=w}isCount(){return this.layout instanceof v||this.layout instanceof B}decode(f,w=0){return this.layout.decode(f,w+this.offset)}encode(f,w,I=0){return this.layout.encode(f,w,I+this.offset)}}W.OffsetLayout=p;class v extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readUIntLE(w,this.span)}encode(f,w,I=0){return e(w).writeUIntLE(f,I,this.span),this.span}}W.UInt=v;class B extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readUIntBE(w,this.span)}encode(f,w,I=0){return e(w).writeUIntBE(f,I,this.span),this.span}}W.UIntBE=B;class P extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readIntLE(w,this.span)}encode(f,w,I=0){return e(w).writeIntLE(f,I,this.span),this.span}}W.Int=P;class _ extends r{constructor(f,w){if(super(f,w),6<this.span)throw new RangeError("span must not exceed 6 bytes")}decode(f,w=0){return e(f).readIntBE(w,this.span)}encode(f,w,I=0){return e(w).writeIntBE(f,I,this.span),this.span}}W.IntBE=_;const S=Math.pow(2,32);function T(c){const f=Math.floor(c/S),w=c-f*S;return{hi32:f,lo32:w}}function M(c,f){return c*S+f}class N extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readUInt32LE(w),j=I.readUInt32LE(w+4);return M(j,z)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeUInt32LE(z.lo32,I),j.writeUInt32LE(z.hi32,I+4),8}}W.NearUInt64=N;class F extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readUInt32BE(w),j=I.readUInt32BE(w+4);return M(z,j)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeUInt32BE(z.hi32,I),j.writeUInt32BE(z.lo32,I+4),8}}W.NearUInt64BE=F;class H extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readUInt32LE(w),j=I.readInt32LE(w+4);return M(j,z)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeUInt32LE(z.lo32,I),j.writeInt32LE(z.hi32,I+4),8}}W.NearInt64=H;class $ extends r{constructor(f){super(8,f)}decode(f,w=0){const I=e(f),z=I.readInt32BE(w),j=I.readUInt32BE(w+4);return M(z,j)}encode(f,w,I=0){const z=T(f),j=e(w);return j.writeInt32BE(z.hi32,I),j.writeUInt32BE(z.lo32,I+4),8}}W.NearInt64BE=$;class Y extends r{constructor(f){super(4,f)}decode(f,w=0){return e(f).readFloatLE(w)}encode(f,w,I=0){return e(w).writeFloatLE(f,I),4}}W.Float=Y;class X extends r{constructor(f){super(4,f)}decode(f,w=0){return e(f).readFloatBE(w)}encode(f,w,I=0){return e(w).writeFloatBE(f,I),4}}W.FloatBE=X;class Q extends r{constructor(f){super(8,f)}decode(f,w=0){return e(f).readDoubleLE(w)}encode(f,w,I=0){return e(w).writeDoubleLE(f,I),8}}W.Double=Q;class ct extends r{constructor(f){super(8,f)}decode(f,w=0){return e(f).readDoubleBE(w)}encode(f,w,I=0){return e(w).writeDoubleBE(f,I),8}}W.DoubleBE=ct;class ot extends r{constructor(f,w,I){if(!(f instanceof r))throw new TypeError("elementLayout must be a Layout");if(!(w instanceof o&&w.isCount()||Number.isInteger(w)&&0<=w))throw new TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let z=-1;!(w instanceof o)&&0<f.span&&(z=w*f.span),super(z,I),this.elementLayout=f,this.count=w}getSpan(f,w=0){if(0<=this.span)return this.span;let I=0,z=this.count;if(z instanceof o&&(z=z.decode(f,w)),0<this.elementLayout.span)I=z*this.elementLayout.span;else{let j=0;for(;j<z;)I+=this.elementLayout.getSpan(f,w+I),++j}return I}decode(f,w=0){const I=[];let z=0,j=this.count;for(j instanceof o&&(j=j.decode(f,w));z<j;)I.push(this.elementLayout.decode(f,w)),w+=this.elementLayout.getSpan(f,w),z+=1;return I}encode(f,w,I=0){const z=this.elementLayout,j=f.reduce((rt,st)=>rt+z.encode(st,w,I+rt),0);return this.count instanceof o&&this.count.encode(f.length,w,I),j}}W.Sequence=ot;class C extends r{constructor(f,w,I){if(!(Array.isArray(f)&&f.reduce((j,rt)=>j&&rt instanceof r,!0)))throw new TypeError("fields must be array of Layout instances");typeof w=="boolean"&&I===void 0&&(I=w,w=void 0);for(const j of f)if(0>j.span&&j.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let z=-1;try{z=f.reduce((j,rt)=>j+rt.getSpan(),0)}catch{}super(z,w),this.fields=f,this.decodePrefixes=!!I}getSpan(f,w=0){if(0<=this.span)return this.span;let I=0;try{I=this.fields.reduce((z,j)=>{const rt=j.getSpan(f,w);return w+=rt,z+rt},0)}catch{throw new RangeError("indeterminate span")}return I}decode(f,w=0){t(f);const I=this.makeDestinationObject();for(const z of this.fields)if(z.property!==void 0&&(I[z.property]=z.decode(f,w)),w+=z.getSpan(f,w),this.decodePrefixes&&f.length===w)break;return I}encode(f,w,I=0){const z=I;let j=0,rt=0;for(const st of this.fields){let kt=st.span;if(rt=0<kt?kt:0,st.property!==void 0){const vt=f[st.property];vt!==void 0&&(rt=st.encode(vt,w,I),0>kt&&(kt=st.getSpan(w,I)))}j=I,I+=kt}return j+rt-z}fromArray(f){const w=this.makeDestinationObject();for(const I of this.fields)I.property!==void 0&&0<f.length&&(w[I.property]=f.shift());return w}layoutFor(f){if(typeof f!="string")throw new TypeError("property must be string");for(const w of this.fields)if(w.property===f)return w}offsetOf(f){if(typeof f!="string")throw new TypeError("property must be string");let w=0;for(const I of this.fields){if(I.property===f)return w;0>I.span?w=-1:0<=w&&(w+=I.span)}}}W.Structure=C;class U{constructor(f){this.property=f}decode(f,w){throw new Error("UnionDiscriminator is abstract")}encode(f,w,I){throw new Error("UnionDiscriminator is abstract")}}W.UnionDiscriminator=U;class D extends U{constructor(f,w){if(!(f instanceof o&&f.isCount()))throw new TypeError("layout must be an unsigned integer ExternalLayout");super(w||f.property||"variant"),this.layout=f}decode(f,w){return this.layout.decode(f,w)}encode(f,w,I){return this.layout.encode(f,w,I)}}W.UnionLayoutDiscriminator=D;class V extends r{constructor(f,w,I){let z;if(f instanceof v||f instanceof B)z=new D(new p(f));else if(f instanceof o&&f.isCount())z=new D(f);else if(f instanceof U)z=f;else throw new TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(w===void 0&&(w=null),!(w===null||w instanceof r))throw new TypeError("defaultLayout must be null or a Layout");if(w!==null){if(0>w.span)throw new Error("defaultLayout must have constant span");w.property===void 0&&(w=w.replicate("content"))}let j=-1;w&&(j=w.span,0<=j&&(f instanceof v||f instanceof B)&&(j+=z.layout.span)),super(j,I),this.discriminator=z,this.usesPrefixDiscriminator=f instanceof v||f instanceof B,this.defaultLayout=w,this.registry={};let rt=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(st){return rt(st)},this.configGetSourceVariant=function(st){rt=st.bind(this)}}getSpan(f,w=0){if(0<=this.span)return this.span;const I=this.getVariant(f,w);if(!I)throw new Error("unable to determine span for unrecognized variant");return I.getSpan(f,w)}defaultGetSourceVariant(f){if(Object.prototype.hasOwnProperty.call(f,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(f,this.defaultLayout.property))return;const w=this.registry[f[this.discriminator.property]];if(w&&(!w.layout||w.property&&Object.prototype.hasOwnProperty.call(f,w.property)))return w}else for(const w in this.registry){const I=this.registry[w];if(I.property&&Object.prototype.hasOwnProperty.call(f,I.property))return I}throw new Error("unable to infer src variant")}decode(f,w=0){let I;const z=this.discriminator,j=z.decode(f,w),rt=this.registry[j];if(rt===void 0){const st=this.defaultLayout;let kt=0;this.usesPrefixDiscriminator&&(kt=z.layout.span),I=this.makeDestinationObject(),I[z.property]=j,I[st.property]=st.decode(f,w+kt)}else I=rt.decode(f,w);return I}encode(f,w,I=0){const z=this.getSourceVariant(f);if(z===void 0){const j=this.discriminator,rt=this.defaultLayout;let st=0;return this.usesPrefixDiscriminator&&(st=j.layout.span),j.encode(f[j.property],w,I),st+rt.encode(f[rt.property],w,I+st)}return z.encode(f,w,I)}addVariant(f,w,I){const z=new y(this,f,w,I);return this.registry[f]=z,z}getVariant(f,w=0){let I;return f instanceof Uint8Array?I=this.discriminator.decode(f,w):I=f,this.registry[I]}}W.Union=V;class y extends r{constructor(f,w,I,z){if(!(f instanceof V))throw new TypeError("union must be a Union");if(!Number.isInteger(w)||0>w)throw new TypeError("variant must be a (non-negative) integer");if(typeof I=="string"&&z===void 0&&(z=I,I=null),I){if(!(I instanceof r))throw new TypeError("layout must be a Layout");if(f.defaultLayout!==null&&0<=I.span&&I.span>f.defaultLayout.span)throw new Error("variant span exceeds span of containing union");if(typeof z!="string")throw new TypeError("variant must have a String property")}let j=f.span;0>f.span&&(j=I?I.span:0,0<=j&&f.usesPrefixDiscriminator&&(j+=f.discriminator.layout.span)),super(j,z),this.union=f,this.variant=w,this.layout=I||null}getSpan(f,w=0){if(0<=this.span)return this.span;let I=0;this.union.usesPrefixDiscriminator&&(I=this.union.discriminator.layout.span);let z=0;return this.layout&&(z=this.layout.getSpan(f,w+I)),I+z}decode(f,w=0){const I=this.makeDestinationObject();if(this!==this.union.getVariant(f,w))throw new Error("variant mismatch");let z=0;return this.union.usesPrefixDiscriminator&&(z=this.union.discriminator.layout.span),this.layout?I[this.property]=this.layout.decode(f,w+z):this.property?I[this.property]=!0:this.union.usesPrefixDiscriminator&&(I[this.union.discriminator.property]=this.variant),I}encode(f,w,I=0){let z=0;if(this.union.usesPrefixDiscriminator&&(z=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(f,this.property))throw new TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,w,I);let j=z;if(this.layout&&(this.layout.encode(f[this.property],w,I+z),j+=this.layout.getSpan(w,I+z),0<=this.union.span&&j>this.union.span))throw new Error("encoded variant overruns containing union");return j}fromArray(f){if(this.layout)return this.layout.fromArray(f)}}W.VariantLayout=y;function a(c){return 0>c&&(c+=4294967296),c}class l extends r{constructor(f,w,I){if(!(f instanceof v||f instanceof B))throw new TypeError("word must be a UInt or UIntBE layout");if(typeof w=="string"&&I===void 0&&(I=w,w=!1),4<f.span)throw new RangeError("word cannot exceed 32 bits");super(f.span,I),this.word=f,this.msb=!!w,this.fields=[];let z=0;this._packedSetValue=function(j){return z=a(j),this},this._packedGetValue=function(){return z}}decode(f,w=0){const I=this.makeDestinationObject(),z=this.word.decode(f,w);this._packedSetValue(z);for(const j of this.fields)j.property!==void 0&&(I[j.property]=j.decode(f));return I}encode(f,w,I=0){const z=this.word.decode(w,I);this._packedSetValue(z);for(const j of this.fields)if(j.property!==void 0){const rt=f[j.property];rt!==void 0&&j.encode(rt)}return this.word.encode(this._packedGetValue(),w,I)}addField(f,w){const I=new g(this,f,w);return this.fields.push(I),I}addBoolean(f){const w=new k(this,f);return this.fields.push(w),w}fieldFor(f){if(typeof f!="string")throw new TypeError("property must be string");for(const w of this.fields)if(w.property===f)return w}}W.BitStructure=l;class g{constructor(f,w,I){if(!(f instanceof l))throw new TypeError("container must be a BitStructure");if(!Number.isInteger(w)||0>=w)throw new TypeError("bits must be positive integer");const z=8*f.span,j=f.fields.reduce((rt,st)=>rt+st.bits,0);if(w+j>z)throw new Error("bits too long for span remainder ("+(z-j)+" of "+z+" remain)");this.container=f,this.bits=w,this.valueMask=(1<<w)-1,w===32&&(this.valueMask=4294967295),this.start=j,this.container.msb&&(this.start=z-j-w),this.wordMask=a(this.valueMask<<this.start),this.property=I}decode(f,w){const I=this.container._packedGetValue();return a(I&this.wordMask)>>>this.start}encode(f){if(typeof f!="number"||!Number.isInteger(f)||f!==a(f&this.valueMask))throw new TypeError(s("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);const w=this.container._packedGetValue(),I=a(f<<this.start);this.container._packedSetValue(a(w&~this.wordMask)|I)}}W.BitField=g;class k extends g{constructor(f,w){super(f,1,w)}decode(f,w){return!!super.decode(f,w)}encode(f){typeof f=="boolean"&&(f=+f),super.encode(f)}}W.Boolean=k;class E extends r{constructor(f,w){if(!(f instanceof o&&f.isCount()||Number.isInteger(f)&&0<=f))throw new TypeError("length must be positive integer or an unsigned integer ExternalLayout");let I=-1;f instanceof o||(I=f),super(I,w),this.length=f}getSpan(f,w){let I=this.span;return 0>I&&(I=this.length.decode(f,w)),I}decode(f,w=0){let I=this.span;return 0>I&&(I=this.length.decode(f,w)),e(f).slice(w,w+I)}encode(f,w,I){let z=this.length;if(this.length instanceof o&&(z=f.length),!(f instanceof Uint8Array&&z===f.length))throw new TypeError(s("Blob.encode",this)+" requires (length "+z+") Uint8Array as src");if(I+z>w.length)throw new RangeError("encoding overruns Uint8Array");const j=e(f);return e(w).write(j.toString("hex"),I,z,"hex"),this.length instanceof o&&this.length.encode(z,w,I),z}}W.Blob=E;class A extends r{constructor(f){super(-1,f)}getSpan(f,w=0){t(f);let I=w;for(;I<f.length&&f[I]!==0;)I+=1;return 1+I-w}decode(f,w=0){const I=this.getSpan(f,w);return e(f).slice(w,w+I-1).toString("utf-8")}encode(f,w,I=0){typeof f!="string"&&(f=String(f));const z=n.Buffer.from(f,"utf8"),j=z.length;if(I+j>w.length)throw new RangeError("encoding overruns Buffer");const rt=e(w);return z.copy(rt,I),rt[I+j]=0,j+1}}W.CString=A;class L extends r{constructor(f,w){if(typeof f=="string"&&w===void 0&&(w=f,f=void 0),f===void 0)f=-1;else if(!Number.isInteger(f))throw new TypeError("maxSpan must be an integer");super(-1,w),this.maxSpan=f}getSpan(f,w=0){return t(f),f.length-w}decode(f,w=0){const I=this.getSpan(f,w);if(0<=this.maxSpan&&this.maxSpan<I)throw new RangeError("text length exceeds maxSpan");return e(f).slice(w,w+I).toString("utf-8")}encode(f,w,I=0){typeof f!="string"&&(f=String(f));const z=n.Buffer.from(f,"utf8"),j=z.length;if(0<=this.maxSpan&&this.maxSpan<j)throw new RangeError("text length exceeds maxSpan");if(I+j>w.length)throw new RangeError("encoding overruns Buffer");return z.copy(e(w),I),j}}W.UTF8=L;class b extends r{constructor(f,w){super(0,w),this.value=f}decode(f,w){return this.value}encode(f,w,I){return 0}}return W.Constant=b,W.greedy=((c,f)=>new u(c,f)),W.offset=((c,f,w)=>new p(c,f,w)),W.u8=(c=>new v(1,c)),W.u16=(c=>new v(2,c)),W.u24=(c=>new v(3,c)),W.u32=(c=>new v(4,c)),W.u40=(c=>new v(5,c)),W.u48=(c=>new v(6,c)),W.nu64=(c=>new N(c)),W.u16be=(c=>new B(2,c)),W.u24be=(c=>new B(3,c)),W.u32be=(c=>new B(4,c)),W.u40be=(c=>new B(5,c)),W.u48be=(c=>new B(6,c)),W.nu64be=(c=>new F(c)),W.s8=(c=>new P(1,c)),W.s16=(c=>new P(2,c)),W.s24=(c=>new P(3,c)),W.s32=(c=>new P(4,c)),W.s40=(c=>new P(5,c)),W.s48=(c=>new P(6,c)),W.ns64=(c=>new H(c)),W.s16be=(c=>new _(2,c)),W.s24be=(c=>new _(3,c)),W.s32be=(c=>new _(4,c)),W.s40be=(c=>new _(5,c)),W.s48be=(c=>new _(6,c)),W.ns64be=(c=>new $(c)),W.f32=(c=>new Y(c)),W.f32be=(c=>new X(c)),W.f64=(c=>new Q(c)),W.f64be=(c=>new ct(c)),W.struct=((c,f,w)=>new C(c,f,w)),W.bits=((c,f,w)=>new l(c,f,w)),W.seq=((c,f,w)=>new ot(c,f,w)),W.union=((c,f,w)=>new V(c,f,w)),W.unionLayoutDiscriminator=((c,f)=>new D(c,f)),W.blob=((c,f)=>new E(c,f)),W.cstr=(c=>new A(c)),W.utf8=((c,f)=>new L(c,f)),W.constant=((c,f)=>new b(c,f)),W}var R=Jc(),Qc=8078e3,tu=8078001,eu=8078004,ru=8078005,nu=8078006,iu=8078011;function qo(n){return Array.isArray(n)?"%5B"+n.map(qo).join("%2C%20")+"%5D":typeof n=="bigint"?`${n}n`:encodeURIComponent(String(n!=null&&Object.getPrototypeOf(n)===null?{...n}:n))}function su([n,t]){return`${n}=${qo(t)}`}function ou(n){const t=Object.entries(n).map(su).join("&");return btoa(t)}function au(n,t={}){{let e=`Solana error #${n}; Decode this error by running \`npx @solana/errors decode -- ${n}`;return Object.keys(t).length&&(e+=` '${ou(t)}'`),`${e}\``}}var mr=class extends Error{cause=this.cause;context;constructor(...[n,t]){let e,r;if(t){const{cause:i,...o}=t;i&&(r={cause:i}),Object.keys(o).length>0&&(e=o)}const s=au(n,e);super(s,r),this.context={__code:n,...e},this.name="SolanaError"}};function cu(n,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(n)}function uu(n){return Object.freeze({...n,encode:t=>{const e=new Uint8Array(cu(t,n));return n.write(t,e,0),e}})}function fu(n){return Object.freeze({...n,decode:(t,e=0)=>n.read(t,e)[0]})}function gr(n){return"fixedSize"in n&&typeof n.fixedSize=="number"}function hu(n,t){if(gr(n)!==gr(t))throw new mr(eu);if(gr(n)&&gr(t)&&n.fixedSize!==t.fixedSize)throw new mr(ru,{decoderFixedSize:t.fixedSize,encoderFixedSize:n.fixedSize});if(!gr(n)&&!gr(t)&&n.maxSize!==t.maxSize)throw new mr(nu,{decoderMaxSize:t.maxSize,encoderMaxSize:n.maxSize});return{...t,...n,decode:t.decode,encode:n.encode,read:t.read,write:n.write}}function lu(n,t,e=0){if(t.length-e<=0)throw new mr(Qc,{codecDescription:n})}function du(n,t,e,r=0){const s=e.length-r;if(s<t)throw new mr(tu,{bytesLength:s,codecDescription:n,expected:t})}function pu(n,t,e,r){if(r<t||r>e)throw new mr(iu,{codecDescription:n,max:e,min:t,value:r})}function Do(n){return n?.endian!==1}function gu(n){return uu({fixedSize:n.size,write(t,e,r){n.range&&pu(n.name,n.range[0],n.range[1],t);const s=new ArrayBuffer(n.size);return n.set(new DataView(s),t,Do(n.config)),e.set(new Uint8Array(s),r),r+n.size}})}function yu(n){return fu({fixedSize:n.size,read(t,e=0){lu(n.name,t,e),du(n.name,n.size,t,e);const r=new DataView(mu(t,e,n.size));return[n.get(r,Do(n.config)),e+n.size]}})}function mu(n,t,e){const r=n.byteOffset+(t??0),s=e??n.byteLength;return n.buffer.slice(r,r+s)}var Wo=(n={})=>gu({config:n,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}),wu=(n={})=>yu({config:n,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}),bu=(n={})=>hu(Wo(n),wu(n));class ku extends TypeError{constructor(t,e){let r;const{message:s,explanation:i,...o}=t,{path:u}=t,p=u.length===0?s:`At path: ${u.join(".")} -- ${s}`;super(i??p),i!=null&&(this.cause=p),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>r??(r=[t,...e()])}}function vu(n){return qr(n)&&typeof n[Symbol.iterator]=="function"}function qr(n){return typeof n=="object"&&n!=null}function ln(n){return qr(n)&&!Array.isArray(n)}function Be(n){return typeof n=="symbol"?n.toString():typeof n=="string"?JSON.stringify(n):`${n}`}function Su(n){const{done:t,value:e}=n.next();return t?void 0:e}function xu(n,t,e,r){if(n===!0)return;n===!1?n={}:typeof n=="string"&&(n={message:n});const{path:s,branch:i}=t,{type:o}=e,{refinement:u,message:p=`Expected a value of type \`${o}\`${u?` with refinement \`${u}\``:""}, but received: \`${Be(r)}\``}=n;return{value:r,type:o,refinement:u,key:s[s.length-1],path:s,branch:i,...n,message:p}}function*Ls(n,t,e,r){vu(n)||(n=[n]);for(const s of n){const i=xu(s,t,e,r);i&&(yield i)}}function*zi(n,t,e={}){const{path:r=[],branch:s=[n],coerce:i=!1,mask:o=!1}=e,u={path:r,branch:s,mask:o};i&&(n=t.coercer(n,u));let p="valid";for(const v of t.validator(n,u))v.explanation=e.message,p="not_valid",yield[v,void 0];for(let[v,B,P]of t.entries(n,u)){const _=zi(B,P,{path:v===void 0?r:[...r,v],branch:v===void 0?s:[...s,B],coerce:i,mask:o,message:e.message});for(const S of _)S[0]?(p=S[0].refinement!=null?"not_refined":"not_valid",yield[S[0],void 0]):i&&(B=S[1],v===void 0?n=B:n instanceof Map?n.set(v,B):n instanceof Set?n.add(B):qr(n)&&(B!==void 0||v in n)&&(n[v]=B))}if(p!=="not_valid")for(const v of t.refiner(n,u))v.explanation=e.message,p="not_refined",yield[v,void 0];p==="valid"&&(yield[void 0,n])}let Ue=class{constructor(t){const{type:e,schema:r,validator:s,refiner:i,coercer:o=p=>p,entries:u=function*(){}}=t;this.type=e,this.schema=r,this.entries=u,this.coercer=o,s?this.validator=(p,v)=>{const B=s(p,v);return Ls(B,v,this,p)}:this.validator=()=>[],i?this.refiner=(p,v)=>{const B=i(p,v);return Ls(B,v,this,p)}:this.refiner=()=>[]}assert(t,e){return $o(t,this,e)}create(t,e){return et(t,this,e)}is(t){return Vo(t,this)}mask(t,e){return Eu(t,this,e)}validate(t,e={}){return Dr(t,this,e)}};function $o(n,t,e){const r=Dr(n,t,{message:e});if(r[0])throw r[0]}function et(n,t,e){const r=Dr(n,t,{coerce:!0,message:e});if(r[0])throw r[0];return r[1]}function Eu(n,t,e){const r=Dr(n,t,{coerce:!0,mask:!0,message:e});if(r[0])throw r[0];return r[1]}function Vo(n,t){return!Dr(n,t)[0]}function Dr(n,t,e={}){const r=zi(n,t,e),s=Su(r);return s[0]?[new ku(s[0],function*(){for(const o of r)o[0]&&(yield o[0])}),void 0]:[void 0,s[1]]}function ur(n,t){return new Ue({type:n,schema:null,validator:t})}function Iu(){return ur("any",()=>!0)}function nt(n){return new Ue({type:"array",schema:n,*entries(t){if(n&&Array.isArray(t))for(const[e,r]of t.entries())yield[e,r,n]},coercer(t){return Array.isArray(t)?t.slice():t},validator(t){return Array.isArray(t)||`Expected an array value, but received: ${Be(t)}`}})}function Le(){return ur("boolean",n=>typeof n=="boolean")}function Ki(n){return ur("instance",t=>t instanceof n||`Expected a \`${n.name}\` instance, but received: ${Be(t)}`)}function Ut(n){const t=Be(n),e=typeof n;return new Ue({type:"literal",schema:e==="string"||e==="number"||e==="boolean"?n:null,validator(r){return r===n||`Expected the literal \`${t}\`, but received: ${Be(r)}`}})}function Au(){return ur("never",()=>!1)}function it(n){return new Ue({...n,validator:(t,e)=>t===null||n.validator(t,e),refiner:(t,e)=>t===null||n.refiner(t,e)})}function q(){return ur("number",n=>typeof n=="number"&&!isNaN(n)||`Expected a number, but received: ${Be(n)}`)}function ut(n){return new Ue({...n,validator:(t,e)=>t===void 0||n.validator(t,e),refiner:(t,e)=>t===void 0||n.refiner(t,e)})}function Ho(n,t){return new Ue({type:"record",schema:null,*entries(e){if(qr(e))for(const r in e){const s=e[r];yield[r,r,n],yield[r,s,t]}},validator(e){return ln(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return ln(e)?{...e}:e}})}function J(){return ur("string",n=>typeof n=="string"||`Expected a string, but received: ${Be(n)}`)}function qi(n){const t=Au();return new Ue({type:"tuple",schema:null,*entries(e){if(Array.isArray(e)){const r=Math.max(n.length,e.length);for(let s=0;s<r;s++)yield[s,e[s],n[s]||t]}},validator(e){return Array.isArray(e)||`Expected an array, but received: ${Be(e)}`},coercer(e){return Array.isArray(e)?e.slice():e}})}function Z(n){const t=Object.keys(n);return new Ue({type:"type",schema:n,*entries(e){if(qr(e))for(const r of t)yield[r,e[r],n[r]]},validator(e){return ln(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return ln(e)?{...e}:e}})}function be(n){const t=n.map(e=>e.type).join(" | ");return new Ue({type:"union",schema:null,coercer(e,r){for(const s of n){const[i,o]=s.validate(e,{coerce:!0,mask:r.mask});if(!i)return o}return e},validator(e,r){const s=[];for(const i of n){const[...o]=zi(e,i,r),[u]=o;if(u[0])for(const[p]of o)p&&s.push(p);else return[]}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${Be(e)}`,...s]}})}function Ar(){return ur("unknown",()=>!0)}function Wr(n,t,e){return new Ue({...n,coercer:(r,s)=>Vo(r,t)?n.coercer(e(r,s),s):n.coercer(r,s)})}var Qr,_u=new Uint8Array(16);function Go(){if(!Qr&&(Qr=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Qr))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Qr(_u)}const Bu=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;function vn(n){return typeof n=="string"&&Bu.test(n)}var ue=[];for(var oi=0;oi<256;++oi)ue.push((oi+256).toString(16).substr(1));function Sn(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(ue[n[t+0]]+ue[n[t+1]]+ue[n[t+2]]+ue[n[t+3]]+"-"+ue[n[t+4]]+ue[n[t+5]]+"-"+ue[n[t+6]]+ue[n[t+7]]+"-"+ue[n[t+8]]+ue[n[t+9]]+"-"+ue[n[t+10]]+ue[n[t+11]]+ue[n[t+12]]+ue[n[t+13]]+ue[n[t+14]]+ue[n[t+15]]).toLowerCase();if(!vn(e))throw TypeError("Stringified UUID is invalid");return e}var Cs,ai,ci=0,ui=0;function Ru(n,t,e){var r=t&&e||0,s=t||new Array(16);n=n||{};var i=n.node||Cs,o=n.clockseq!==void 0?n.clockseq:ai;if(i==null||o==null){var u=n.random||(n.rng||Go)();i==null&&(i=Cs=[u[0]|1,u[1],u[2],u[3],u[4],u[5]]),o==null&&(o=ai=(u[6]<<8|u[7])&16383)}var p=n.msecs!==void 0?n.msecs:Date.now(),v=n.nsecs!==void 0?n.nsecs:ui+1,B=p-ci+(v-ui)/1e4;if(B<0&&n.clockseq===void 0&&(o=o+1&16383),(B<0||p>ci)&&n.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");ci=p,ui=v,ai=o,p+=122192928e5;var P=((p&268435455)*1e4+v)%4294967296;s[r++]=P>>>24&255,s[r++]=P>>>16&255,s[r++]=P>>>8&255,s[r++]=P&255;var _=p/4294967296*1e4&268435455;s[r++]=_>>>8&255,s[r++]=_&255,s[r++]=_>>>24&15|16,s[r++]=_>>>16&255,s[r++]=o>>>8|128,s[r++]=o&255;for(var S=0;S<6;++S)s[r+S]=i[S];return t||Sn(s)}function jo(n){if(!vn(n))throw TypeError("Invalid UUID");var t,e=new Uint8Array(16);return e[0]=(t=parseInt(n.slice(0,8),16))>>>24,e[1]=t>>>16&255,e[2]=t>>>8&255,e[3]=t&255,e[4]=(t=parseInt(n.slice(9,13),16))>>>8,e[5]=t&255,e[6]=(t=parseInt(n.slice(14,18),16))>>>8,e[7]=t&255,e[8]=(t=parseInt(n.slice(19,23),16))>>>8,e[9]=t&255,e[10]=(t=parseInt(n.slice(24,36),16))/1099511627776&255,e[11]=t/4294967296&255,e[12]=t>>>24&255,e[13]=t>>>16&255,e[14]=t>>>8&255,e[15]=t&255,e}function Mu(n){n=unescape(encodeURIComponent(n));for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e));return t}var Tu="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Pu="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function Zo(n,t,e){function r(s,i,o,u){if(typeof s=="string"&&(s=Mu(s)),typeof i=="string"&&(i=jo(i)),i.length!==16)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");var p=new Uint8Array(16+s.length);if(p.set(i),p.set(s,i.length),p=e(p),p[6]=p[6]&15|t,p[8]=p[8]&63|128,o){u=u||0;for(var v=0;v<16;++v)o[u+v]=p[v];return o}return Sn(p)}try{r.name=n}catch{}return r.DNS=Tu,r.URL=Pu,r}function Lu(n){if(typeof n=="string"){var t=unescape(encodeURIComponent(n));n=new Uint8Array(t.length);for(var e=0;e<t.length;++e)n[e]=t.charCodeAt(e)}return Cu(Uu(Ou(n),n.length*8))}function Cu(n){for(var t=[],e=n.length*32,r="0123456789abcdef",s=0;s<e;s+=8){var i=n[s>>5]>>>s%32&255,o=parseInt(r.charAt(i>>>4&15)+r.charAt(i&15),16);t.push(o)}return t}function Yo(n){return(n+64>>>9<<4)+14+1}function Uu(n,t){n[t>>5]|=128<<t%32,n[Yo(t)-1]=t;for(var e=1732584193,r=-271733879,s=-1732584194,i=271733878,o=0;o<n.length;o+=16){var u=e,p=r,v=s,B=i;e=ge(e,r,s,i,n[o],7,-680876936),i=ge(i,e,r,s,n[o+1],12,-389564586),s=ge(s,i,e,r,n[o+2],17,606105819),r=ge(r,s,i,e,n[o+3],22,-1044525330),e=ge(e,r,s,i,n[o+4],7,-176418897),i=ge(i,e,r,s,n[o+5],12,1200080426),s=ge(s,i,e,r,n[o+6],17,-1473231341),r=ge(r,s,i,e,n[o+7],22,-45705983),e=ge(e,r,s,i,n[o+8],7,1770035416),i=ge(i,e,r,s,n[o+9],12,-1958414417),s=ge(s,i,e,r,n[o+10],17,-42063),r=ge(r,s,i,e,n[o+11],22,-1990404162),e=ge(e,r,s,i,n[o+12],7,1804603682),i=ge(i,e,r,s,n[o+13],12,-40341101),s=ge(s,i,e,r,n[o+14],17,-1502002290),r=ge(r,s,i,e,n[o+15],22,1236535329),e=ye(e,r,s,i,n[o+1],5,-165796510),i=ye(i,e,r,s,n[o+6],9,-1069501632),s=ye(s,i,e,r,n[o+11],14,643717713),r=ye(r,s,i,e,n[o],20,-373897302),e=ye(e,r,s,i,n[o+5],5,-701558691),i=ye(i,e,r,s,n[o+10],9,38016083),s=ye(s,i,e,r,n[o+15],14,-660478335),r=ye(r,s,i,e,n[o+4],20,-405537848),e=ye(e,r,s,i,n[o+9],5,568446438),i=ye(i,e,r,s,n[o+14],9,-1019803690),s=ye(s,i,e,r,n[o+3],14,-187363961),r=ye(r,s,i,e,n[o+8],20,1163531501),e=ye(e,r,s,i,n[o+13],5,-1444681467),i=ye(i,e,r,s,n[o+2],9,-51403784),s=ye(s,i,e,r,n[o+7],14,1735328473),r=ye(r,s,i,e,n[o+12],20,-1926607734),e=me(e,r,s,i,n[o+5],4,-378558),i=me(i,e,r,s,n[o+8],11,-2022574463),s=me(s,i,e,r,n[o+11],16,1839030562),r=me(r,s,i,e,n[o+14],23,-35309556),e=me(e,r,s,i,n[o+1],4,-1530992060),i=me(i,e,r,s,n[o+4],11,1272893353),s=me(s,i,e,r,n[o+7],16,-155497632),r=me(r,s,i,e,n[o+10],23,-1094730640),e=me(e,r,s,i,n[o+13],4,681279174),i=me(i,e,r,s,n[o],11,-358537222),s=me(s,i,e,r,n[o+3],16,-722521979),r=me(r,s,i,e,n[o+6],23,76029189),e=me(e,r,s,i,n[o+9],4,-640364487),i=me(i,e,r,s,n[o+12],11,-421815835),s=me(s,i,e,r,n[o+15],16,530742520),r=me(r,s,i,e,n[o+2],23,-995338651),e=we(e,r,s,i,n[o],6,-198630844),i=we(i,e,r,s,n[o+7],10,1126891415),s=we(s,i,e,r,n[o+14],15,-1416354905),r=we(r,s,i,e,n[o+5],21,-57434055),e=we(e,r,s,i,n[o+12],6,1700485571),i=we(i,e,r,s,n[o+3],10,-1894986606),s=we(s,i,e,r,n[o+10],15,-1051523),r=we(r,s,i,e,n[o+1],21,-2054922799),e=we(e,r,s,i,n[o+8],6,1873313359),i=we(i,e,r,s,n[o+15],10,-30611744),s=we(s,i,e,r,n[o+6],15,-1560198380),r=we(r,s,i,e,n[o+13],21,1309151649),e=we(e,r,s,i,n[o+4],6,-145523070),i=we(i,e,r,s,n[o+11],10,-1120210379),s=we(s,i,e,r,n[o+2],15,718787259),r=we(r,s,i,e,n[o+9],21,-343485551),e=Je(e,u),r=Je(r,p),s=Je(s,v),i=Je(i,B)}return[e,r,s,i]}function Ou(n){if(n.length===0)return[];for(var t=n.length*8,e=new Uint32Array(Yo(t)),r=0;r<t;r+=8)e[r>>5]|=(n[r/8]&255)<<r%32;return e}function Je(n,t){var e=(n&65535)+(t&65535),r=(n>>16)+(t>>16)+(e>>16);return r<<16|e&65535}function Nu(n,t){return n<<t|n>>>32-t}function xn(n,t,e,r,s,i){return Je(Nu(Je(Je(t,n),Je(r,i)),s),e)}function ge(n,t,e,r,s,i,o){return xn(t&e|~t&r,n,t,s,i,o)}function ye(n,t,e,r,s,i,o){return xn(t&r|e&~r,n,t,s,i,o)}function me(n,t,e,r,s,i,o){return xn(t^e^r,n,t,s,i,o)}function we(n,t,e,r,s,i,o){return xn(e^(t|~r),n,t,s,i,o)}var Fu=Zo("v3",48,Lu);function zu(n,t,e){n=n||{};var r=n.random||(n.rng||Go)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){e=e||0;for(var s=0;s<16;++s)t[e+s]=r[s];return t}return Sn(r)}function Ku(n,t,e,r){switch(n){case 0:return t&e^~t&r;case 1:return t^e^r;case 2:return t&e^t&r^e&r;case 3:return t^e^r}}function fi(n,t){return n<<t|n>>>32-t}function qu(n){var t=[1518500249,1859775393,2400959708,3395469782],e=[1732584193,4023233417,2562383102,271733878,3285377520];if(typeof n=="string"){var r=unescape(encodeURIComponent(n));n=[];for(var s=0;s<r.length;++s)n.push(r.charCodeAt(s))}else Array.isArray(n)||(n=Array.prototype.slice.call(n));n.push(128);for(var i=n.length/4+2,o=Math.ceil(i/16),u=new Array(o),p=0;p<o;++p){for(var v=new Uint32Array(16),B=0;B<16;++B)v[B]=n[p*64+B*4]<<24|n[p*64+B*4+1]<<16|n[p*64+B*4+2]<<8|n[p*64+B*4+3];u[p]=v}u[o-1][14]=(n.length-1)*8/Math.pow(2,32),u[o-1][14]=Math.floor(u[o-1][14]),u[o-1][15]=(n.length-1)*8&4294967295;for(var P=0;P<o;++P){for(var _=new Uint32Array(80),S=0;S<16;++S)_[S]=u[P][S];for(var T=16;T<80;++T)_[T]=fi(_[T-3]^_[T-8]^_[T-14]^_[T-16],1);for(var M=e[0],N=e[1],F=e[2],H=e[3],$=e[4],Y=0;Y<80;++Y){var X=Math.floor(Y/20),Q=fi(M,5)+Ku(X,N,F,H)+$+t[X]+_[Y]>>>0;$=H,H=F,F=fi(N,30)>>>0,N=M,M=Q}e[0]=e[0]+M>>>0,e[1]=e[1]+N>>>0,e[2]=e[2]+F>>>0,e[3]=e[3]+H>>>0,e[4]=e[4]+$>>>0}return[e[0]>>24&255,e[0]>>16&255,e[0]>>8&255,e[0]&255,e[1]>>24&255,e[1]>>16&255,e[1]>>8&255,e[1]&255,e[2]>>24&255,e[2]>>16&255,e[2]>>8&255,e[2]&255,e[3]>>24&255,e[3]>>16&255,e[3]>>8&255,e[3]&255,e[4]>>24&255,e[4]>>16&255,e[4]>>8&255,e[4]&255]}var Du=Zo("v5",80,qu);const Wu="00000000-0000-0000-0000-000000000000";function $u(n){if(!vn(n))throw TypeError("Invalid UUID");return parseInt(n.substr(14,1),16)}const Vu=Object.freeze(Object.defineProperty({__proto__:null,NIL:Wu,parse:jo,stringify:Sn,v1:Ru,v3:Fu,v4:zu,v5:Du,validate:vn,version:$u},Symbol.toStringTag,{value:"Module"})),Xo=uo(Vu);var hi,Us;function Hu(){if(Us)return hi;Us=1;const n=Xo.v4;return hi=function(e,r,s,i){if(typeof e!="string")throw new TypeError(e+" must be a string");i=i||{};const o=typeof i.version=="number"?i.version:2;if(o!==1&&o!==2)throw new TypeError(o+" must be 1 or 2");const u={method:e};if(o===2&&(u.jsonrpc="2.0"),r){if(typeof r!="object"&&!Array.isArray(r))throw new TypeError(r+" must be an object, array or omitted");u.params=r}if(typeof s>"u"){const p=typeof i.generator=="function"?i.generator:function(){return n()};u.id=p(u,i)}else o===2&&s===null?i.notificationIdNull&&(u.id=null):u.id=s;return u},hi}var li,Os;function Gu(){if(Os)return li;Os=1;const n=Xo.v4,t=Hu(),e=function(r,s){if(!(this instanceof e))return new e(r,s);s||(s={}),this.options={reviver:typeof s.reviver<"u"?s.reviver:null,replacer:typeof s.replacer<"u"?s.replacer:null,generator:typeof s.generator<"u"?s.generator:function(){return n()},version:typeof s.version<"u"?s.version:2,notificationIdNull:typeof s.notificationIdNull=="boolean"?s.notificationIdNull:!1},this.callServer=r};return li=e,e.prototype.request=function(r,s,i,o){const u=this;let p=null;const v=Array.isArray(r)&&typeof s=="function";if(this.options.version===1&&v)throw new TypeError("JSON-RPC 1.0 does not support batching");if(v||!v&&r&&typeof r=="object"&&typeof s=="function")o=s,p=r;else{typeof i=="function"&&(o=i,i=void 0);const _=typeof o=="function";try{p=t(r,s,i,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(S){if(_){o(S);return}throw S}if(!_)return p}let P;try{P=JSON.stringify(p,this.options.replacer)}catch(_){o(_);return}return this.callServer(P,function(_,S){u._parseResponse(_,S,o)}),p},e.prototype._parseResponse=function(r,s,i){if(r){i(r);return}if(!s){i();return}let o;try{o=JSON.parse(s,this.options.reviver)}catch(u){i(u);return}if(i.length===3)if(Array.isArray(o)){const u=function(v){return typeof v.error<"u"},p=function(v){return!u(v)};i(null,o.filter(u),o.filter(p));return}else{i(null,o.error,o.result);return}i(null,o)},li}var ju=Gu();const Zu=Ri(ju);var Yu=class extends fo{socket;constructor(n,t){super(),this.socket=new window.WebSocket(n,t.protocols),this.socket.onopen=()=>this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(n,t,e){const r=e||t;try{this.socket.send(n),r()}catch(s){r(s)}}close(n,t){this.socket.close(n,t)}addEventListener(n,t,e){this.socket.addEventListener(n,t,e)}};function Xu(n,t){return new Yu(n,t)}var Ju=class{encode(n){return JSON.stringify(n)}decode(n){return JSON.parse(n)}},Qu=class extends fo{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(n,t="ws://localhost:8080",{autoconnect:e=!0,reconnect:r=!0,reconnect_interval:s=1e3,max_reconnects:i=5,...o}={},u,p){super(),this.webSocketFactory=n,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=e,this.ready=!1,this.reconnect=r,this.reconnect_timer_id=void 0,this.reconnect_interval=s,this.max_reconnects=i,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=u||(()=>typeof this.rpc_id=="number"?++this.rpc_id:Number(this.rpc_id)+1),p?this.dataPack=p:this.dataPack=new Ju,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(n,t,e,r){return!r&&typeof e=="object"&&(r=e,e=null),new Promise((s,i)=>{if(!this.ready)return i(new Error("socket not ready"));const o=this.generate_request_id(n,t),u={jsonrpc:"2.0",method:n,params:t||void 0,id:o};this.socket.send(this.dataPack.encode(u),r,p=>{if(p)return i(p);this.queue[o]={promise:[s,i]},e&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],i(new Error("reply timeout"))},e))})})}async login(n){const t=await this.call("rpc.login",n);if(!t)throw new Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(n,t){return new Promise((e,r)=>{if(!this.ready)return r(new Error("socket not ready"));const s={jsonrpc:"2.0",method:n,params:t};this.socket.send(this.dataPack.encode(s),i=>{if(i)return r(i);e()})})}async subscribe(n){typeof n=="string"&&(n=[n]);const t=await this.call("rpc.on",n);if(typeof n=="string"&&t[n]!=="ok")throw new Error("Failed subscribing to an event '"+n+"' with: "+t[n]);return t}async unsubscribe(n){typeof n=="string"&&(n=[n]);const t=await this.call("rpc.off",n);if(typeof n=="string"&&t[n]!=="ok")throw new Error("Failed unsubscribing from an event with: "+t);return t}close(n,t){this.socket&&this.socket.close(n||1e3,t)}setAutoReconnect(n){this.reconnect=n}setReconnectInterval(n){this.reconnect_interval=n}setMaxReconnects(n){this.max_reconnects=n}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return this.reconnect_timer_id!==void 0}willReconnect(){return this.reconnect&&(this.max_reconnects===0||this.current_reconnects<this.max_reconnects)}_connect(n,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(n,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=ft.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch{return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);const r=[e.notification];if(e.params.constructor===Object)r.push(e.params);else for(let s=0;s<e.params.length;s++)r.push(e.params[s]);return Promise.resolve().then(()=>{this.emit.apply(this,r)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,e?.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](new Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>this.emit("error",e)),this.socket.addEventListener("close",({code:e,reason:r})=>{this.ready&&setTimeout(()=>this.emit("close",e,r),0),this.ready=!1,this.socket=void 0,e!==1e3&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||this.max_reconnects===0)?this.reconnect_timer_id=setTimeout(()=>this._connect(n,t),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",e,r),1))})}};const tf=BigInt(0),Rr=BigInt(1),ef=BigInt(2),rf=BigInt(7),nf=BigInt(256),sf=BigInt(113),Jo=[],Qo=[],ta=[];for(let n=0,t=Rr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],Jo.push(2*(5*r+e)),Qo.push((n+1)*(n+2)/2%64);let s=tf;for(let i=0;i<7;i++)t=(t<<Rr^(t>>rf)*sf)%nf,t&ef&&(s^=Rr<<(Rr<<BigInt(i))-Rr);ta.push(s)}const ea=yo(ta,!0),of=ea[0],af=ea[1],Ns=(n,t,e)=>e>32?ja(n,t,e):Ha(n,t,e),Fs=(n,t,e)=>e>32?Za(n,t,e):Ga(n,t,e);function cf(n,t=24){const e=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let o=0;o<10;o++)e[o]=n[o]^n[o+10]^n[o+20]^n[o+30]^n[o+40];for(let o=0;o<10;o+=2){const u=(o+8)%10,p=(o+2)%10,v=e[p],B=e[p+1],P=Ns(v,B,1)^e[u],_=Fs(v,B,1)^e[u+1];for(let S=0;S<50;S+=10)n[o+S]^=P,n[o+S+1]^=_}let s=n[2],i=n[3];for(let o=0;o<24;o++){const u=Qo[o],p=Ns(s,i,u),v=Fs(s,i,u),B=Jo[o];s=n[B],i=n[B+1],n[B]=p,n[B+1]=v}for(let o=0;o<50;o+=10){for(let u=0;u<10;u++)e[u]=n[o+u];for(let u=0;u<10;u++)n[o+u]^=~e[(u+2)%10]&e[(u+4)%10]}n[0]^=of[r],n[1]^=af[r]}Qe(e)}class Di extends Ti{constructor(t,e,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=e,this.outputLen=r,this.enableXOF=s,this.rounds=i,Cr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Oa(this.state)}clone(){return this._cloneInto()}keccak(){fs(this.state32),cf(this.state32,this.rounds),fs(this.state32),this.posOut=0,this.pos=0}update(t){br(this),t=wn(t),$e(t);const{blockLen:e,state:r}=this,s=t.length;for(let i=0;i<s;){const o=Math.min(e-this.pos,s-i);for(let u=0;u<o;u++)r[this.pos++]^=t[i++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:e,pos:r,blockLen:s}=this;t[r]^=e,(e&128)!==0&&r===s-1&&this.keccak(),t[s-1]^=128,this.keccak()}writeInto(t){br(this,!1),$e(t),this.finish();const e=this.state,{blockLen:r}=this;for(let s=0,i=t.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);t.set(e.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Cr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(lo(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,Qe(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new Di(e,r,s,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=r,t.outputLen=s,t.enableXOF=o,t.destroyed=this.destroyed,t}}const uf=(n,t,e)=>Pi(()=>new Di(t,n,e)),zs=uf(1,136,256/8);class ra extends Ti{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,ho(t);const r=wn(e);if(this.iHash=t.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?t.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=t.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),Qe(i)}update(t){return br(this),this.iHash.update(t),this}digestInto(t){br(this),$e(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:e,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:u}=this;return t=t,t.finished=s,t.destroyed=i,t.blockLen=o,t.outputLen=u,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const na=(n,t,e)=>new ra(n,t).update(e).digest();na.create=(n,t)=>new ra(n,t);const Ks=(n,t)=>(n+(n>=0?t:-t)/ia)/t;function ff(n,t,e){const[[r,s],[i,o]]=t,u=Ks(o*n,e),p=Ks(-s*n,e);let v=n-u*r-p*i,B=-u*s-p*o;const P=v<De,_=B<De;P&&(v=-v),_&&(B=-B);const S=zr(Math.ceil(vo(e)/2))+wr;if(v<De||v>=S||B<De||B>=S)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:P,k1:v,k2neg:_,k2:B}}function Ei(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function di(n,t){const e={};for(let r of Object.keys(t))e[r]=n[r]===void 0?t[r]:n[r];return ar(e.lowS,"lowS"),ar(e.prehash,"prehash"),e.format!==void 0&&Ei(e.format),e}class hf extends Error{constructor(t=""){super(t)}}const Fe={Err:hf,_tlv:{encode:(n,t)=>{const{Err:e}=Fe;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length&1)throw new e("tlv.encode: unpadded data");const r=t.length/2,s=Xr(r);if(s.length/2&128)throw new e("tlv.encode: long form length too big");const i=r>127?Xr(s.length/2|128):"";return Xr(n)+i+s+t},decode(n,t){const{Err:e}=Fe;let r=0;if(n<0||n>256)throw new e("tlv.encode: wrong tag");if(t.length<2||t[r++]!==n)throw new e("tlv.decode: wrong tlv");const s=t[r++],i=!!(s&128);let o=0;if(!i)o=s;else{const p=s&127;if(!p)throw new e("tlv.decode(long): indefinite length not supported");if(p>4)throw new e("tlv.decode(long): byte length is too big");const v=t.subarray(r,r+p);if(v.length!==p)throw new e("tlv.decode: length bytes not complete");if(v[0]===0)throw new e("tlv.decode(long): zero leftmost byte");for(const B of v)o=o<<8|B;if(r+=p,o<128)throw new e("tlv.decode(long): not minimal encoding")}const u=t.subarray(r,r+o);if(u.length!==o)throw new e("tlv.decode: wrong value length");return{v:u,l:t.subarray(r+o)}}},_int:{encode(n){const{Err:t}=Fe;if(n<De)throw new t("integer: negative integers are not allowed");let e=Xr(n);if(Number.parseInt(e[0],16)&8&&(e="00"+e),e.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return e},decode(n){const{Err:t}=Fe;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 bn(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=Fe,s=Dt("signature",n),{v:i,l:o}=r.decode(48,s);if(o.length)throw new t("invalid signature: left bytes after parsing");const{v:u,l:p}=r.decode(2,i),{v,l:B}=r.decode(2,p);if(B.length)throw new t("invalid signature: left bytes after parsing");return{r:e.decode(u),s:e.decode(v)}},hexFromSig(n){const{_tlv:t,_int:e}=Fe,r=t.encode(2,e.encode(n.r)),s=t.encode(2,e.encode(n.s)),i=r+s;return t.encode(48,i)}},De=BigInt(0),wr=BigInt(1),ia=BigInt(2),tn=BigInt(3),lf=BigInt(4);function yr(n,t){const{BYTES:e}=n;let r;if(typeof t=="bigint")r=t;else{let s=Dt("private key",t);try{r=n.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${e}, got ${typeof t}`)}}if(!n.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function df(n,t={}){const e=No("weierstrass",n,t),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o,n:u}=i;Kr(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:p}=t;if(p&&(!r.is0(i.a)||typeof p.beta!="bigint"||!Array.isArray(p.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const v=oa(r,s);function B(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function P(V,y,a){const{x:l,y:g}=y.toAffine(),k=r.toBytes(l);if(ar(a,"isCompressed"),a){B();const E=!r.isOdd(g);return Me(sa(E),k)}else return Me(Uint8Array.of(4),k,r.toBytes(g))}function _(V){_e(V,void 0,"Point");const{publicKey:y,publicKeyUncompressed:a}=v,l=V.length,g=V[0],k=V.subarray(1);if(l===y&&(g===2||g===3)){const E=r.fromBytes(k);if(!r.isValid(E))throw new Error("bad point: is not on curve, wrong x");const A=M(E);let L;try{L=r.sqrt(A)}catch(f){const w=f instanceof Error?": "+f.message:"";throw new Error("bad point: is not on curve, sqrt error"+w)}B();const b=r.isOdd(L);return(g&1)===1!==b&&(L=r.neg(L)),{x:E,y:L}}else if(l===a&&g===4){const E=r.BYTES,A=r.fromBytes(k.subarray(0,E)),L=r.fromBytes(k.subarray(E,E*2));if(!N(A,L))throw new Error("bad point: is not on curve");return{x:A,y:L}}else throw new Error(`bad point: got length ${l}, expected compressed=${y} or uncompressed=${a}`)}const S=t.toBytes||P,T=t.fromBytes||_;function M(V){const y=r.sqr(V),a=r.mul(y,V);return r.add(r.add(a,r.mul(V,i.a)),i.b)}function N(V,y){const a=r.sqr(y),l=M(V);return r.eql(a,l)}if(!N(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const F=r.mul(r.pow(i.a,tn),lf),H=r.mul(r.sqr(i.b),BigInt(27));if(r.is0(r.add(F,H)))throw new Error("bad curve params: a or b");function $(V,y,a=!1){if(!r.isValid(y)||a&&r.is0(y))throw new Error(`bad point coordinate ${V}`);return y}function Y(V){if(!(V instanceof C))throw new Error("ProjectivePoint expected")}function X(V){if(!p||!p.basises)throw new Error("no endo");return ff(V,p.basises,s.ORDER)}const Q=on((V,y)=>{const{X:a,Y:l,Z:g}=V;if(r.eql(g,r.ONE))return{x:a,y:l};const k=V.is0();y==null&&(y=k?r.ONE:r.inv(g));const E=r.mul(a,y),A=r.mul(l,y),L=r.mul(g,y);if(k)return{x:r.ZERO,y:r.ZERO};if(!r.eql(L,r.ONE))throw new Error("invZ was invalid");return{x:E,y:A}}),ct=on(V=>{if(V.is0()){if(t.allowInfinityPoint&&!r.is0(V.Y))return;throw new Error("bad point: ZERO")}const{x:y,y:a}=V.toAffine();if(!r.isValid(y)||!r.isValid(a))throw new Error("bad point: x or y not field elements");if(!N(y,a))throw new Error("bad point: equation left != right");if(!V.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function ot(V,y,a,l,g){return a=new C(r.mul(a.X,V),a.Y,a.Z),y=an(l,y),a=an(g,a),y.add(a)}class C{constructor(y,a,l){this.X=$("x",y),this.Y=$("y",a,!0),this.Z=$("z",l),Object.freeze(this)}static CURVE(){return i}static fromAffine(y){const{x:a,y:l}=y||{};if(!y||!r.isValid(a)||!r.isValid(l))throw new Error("invalid affine point");if(y instanceof C)throw new Error("projective point not allowed");return r.is0(a)&&r.is0(l)?C.ZERO:new C(a,l,r.ONE)}static fromBytes(y){const a=C.fromAffine(T(_e(y,void 0,"point")));return a.assertValidity(),a}static fromHex(y){return C.fromBytes(Dt("pointHex",y))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(y=8,a=!0){return D.createCache(this,y),a||this.multiply(tn),this}assertValidity(){ct(this)}hasEvenY(){const{y}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(y)}equals(y){Y(y);const{X:a,Y:l,Z:g}=this,{X:k,Y:E,Z:A}=y,L=r.eql(r.mul(a,A),r.mul(k,g)),b=r.eql(r.mul(l,A),r.mul(E,g));return L&&b}negate(){return new C(this.X,r.neg(this.Y),this.Z)}double(){const{a:y,b:a}=i,l=r.mul(a,tn),{X:g,Y:k,Z:E}=this;let A=r.ZERO,L=r.ZERO,b=r.ZERO,c=r.mul(g,g),f=r.mul(k,k),w=r.mul(E,E),I=r.mul(g,k);return I=r.add(I,I),b=r.mul(g,E),b=r.add(b,b),A=r.mul(y,b),L=r.mul(l,w),L=r.add(A,L),A=r.sub(f,L),L=r.add(f,L),L=r.mul(A,L),A=r.mul(I,A),b=r.mul(l,b),w=r.mul(y,w),I=r.sub(c,w),I=r.mul(y,I),I=r.add(I,b),b=r.add(c,c),c=r.add(b,c),c=r.add(c,w),c=r.mul(c,I),L=r.add(L,c),w=r.mul(k,E),w=r.add(w,w),c=r.mul(w,I),A=r.sub(A,c),b=r.mul(w,f),b=r.add(b,b),b=r.add(b,b),new C(A,L,b)}add(y){Y(y);const{X:a,Y:l,Z:g}=this,{X:k,Y:E,Z:A}=y;let L=r.ZERO,b=r.ZERO,c=r.ZERO;const f=i.a,w=r.mul(i.b,tn);let I=r.mul(a,k),z=r.mul(l,E),j=r.mul(g,A),rt=r.add(a,l),st=r.add(k,E);rt=r.mul(rt,st),st=r.add(I,z),rt=r.sub(rt,st),st=r.add(a,g);let kt=r.add(k,A);return st=r.mul(st,kt),kt=r.add(I,j),st=r.sub(st,kt),kt=r.add(l,g),L=r.add(E,A),kt=r.mul(kt,L),L=r.add(z,j),kt=r.sub(kt,L),c=r.mul(f,st),L=r.mul(w,j),c=r.add(L,c),L=r.sub(z,c),c=r.add(z,c),b=r.mul(L,c),z=r.add(I,I),z=r.add(z,I),j=r.mul(f,j),st=r.mul(w,st),z=r.add(z,j),j=r.sub(I,j),j=r.mul(f,j),st=r.add(st,j),I=r.mul(z,st),b=r.add(b,I),I=r.mul(kt,st),L=r.mul(rt,L),L=r.sub(L,I),I=r.mul(rt,z),c=r.mul(kt,c),c=r.add(c,I),new C(L,b,c)}subtract(y){return this.add(y.negate())}is0(){return this.equals(C.ZERO)}multiply(y){const{endo:a}=t;if(!s.isValidNot0(y))throw new Error("invalid scalar: out of range");let l,g;const k=E=>D.cached(this,E,A=>nr(C,A));if(a){const{k1neg:E,k1:A,k2neg:L,k2:b}=X(y),{p:c,f}=k(A),{p:w,f:I}=k(b);g=f.add(I),l=ot(a.beta,c,w,E,L)}else{const{p:E,f:A}=k(y);l=E,g=A}return nr(C,[l,g])[0]}multiplyUnsafe(y){const{endo:a}=t,l=this;if(!s.isValid(y))throw new Error("invalid scalar: out of range");if(y===De||l.is0())return C.ZERO;if(y===wr)return l;if(D.hasCache(this))return this.multiply(y);if(a){const{k1neg:g,k1:k,k2neg:E,k2:A}=X(y),{p1:L,p2:b}=Sc(C,l,k,A);return ot(a.beta,L,b,g,E)}else return D.unsafe(l,y)}multiplyAndAddUnsafe(y,a,l){const g=this.multiplyUnsafe(a).add(y.multiplyUnsafe(l));return g.is0()?void 0:g}toAffine(y){return Q(this,y)}isTorsionFree(){const{isTorsionFree:y}=t;return o===wr?!0:y?y(C,this):D.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:y}=t;return o===wr?this:y?y(C,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(y=!0){return ar(y,"isCompressed"),this.assertValidity(),S(C,this,y)}toHex(y=!0){return sr(this.toBytes(y))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(y=!0){return this.toBytes(y)}_setWindowSize(y){this.precompute(y)}static normalizeZ(y){return nr(C,y)}static msm(y,a){return Oo(C,s,y,a)}static fromPrivateKey(y){return C.BASE.multiply(yr(s,y))}}C.BASE=new C(i.Gx,i.Gy,r.ONE),C.ZERO=new C(r.ZERO,r.ONE,r.ZERO),C.Fp=r,C.Fn=s;const U=s.BITS,D=new Uo(C,t.endo?Math.ceil(U/2):U);return C.BASE.precompute(8),C}function sa(n){return Uint8Array.of(n?2:3)}function oa(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function pf(n,t={}){const{Fn:e}=n,r=t.randomBytes||Li,s=Object.assign(oa(n.Fp,e),{seed:Po(e.ORDER)});function i(S){try{return!!yr(e,S)}catch{return!1}}function o(S,T){const{publicKey:M,publicKeyUncompressed:N}=s;try{const F=S.length;return T===!0&&F!==M||T===!1&&F!==N?!1:!!n.fromBytes(S)}catch{return!1}}function u(S=r(s.seed)){return bc(_e(S,s.seed,"seed"),e.ORDER)}function p(S,T=!0){return n.BASE.multiply(yr(e,S)).toBytes(T)}function v(S){const T=u(S);return{secretKey:T,publicKey:p(T)}}function B(S){if(typeof S=="bigint")return!1;if(S instanceof n)return!0;const{secretKey:T,publicKey:M,publicKeyUncompressed:N}=s;if(e.allowedLengths||T===M)return;const F=Dt("key",S).length;return F===M||F===N}function P(S,T,M=!0){if(B(S)===!0)throw new Error("first arg must be private key");if(B(T)===!1)throw new Error("second arg must be public key");const N=yr(e,S);return n.fromHex(T).multiply(N).toBytes(M)}return Object.freeze({getPublicKey:p,getSharedSecret:P,keygen:v,Point:n,utils:{isValidSecretKey:i,isValidPublicKey:o,randomSecretKey:u,isValidPrivateKey:i,randomPrivateKey:u,normPrivateKeyToScalar:S=>yr(e,S),precompute(S=8,T=n.BASE){return T.precompute(S,!1)}},lengths:s})}function gf(n,t,e={}){ho(t),Kr(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=e.randomBytes||Li,s=e.hmac||((a,...l)=>na(t,a,Me(...l))),{Fp:i,Fn:o}=n,{ORDER:u,BITS:p}=o,{keygen:v,getPublicKey:B,getSharedSecret:P,utils:_,lengths:S}=pf(n,e),T={prehash:!1,lowS:typeof e.lowS=="boolean"?e.lowS:!1,format:void 0,extraEntropy:!1},M="compact";function N(a){const l=u>>wr;return a>l}function F(a,l){if(!o.isValidNot0(l))throw new Error(`invalid signature ${a}: out of range 1..Point.Fn.ORDER`);return l}function H(a,l){Ei(l);const g=S.signature,k=l==="compact"?g:l==="recovered"?g+1:void 0;return _e(a,k,`${l} signature`)}class ${constructor(l,g,k){this.r=F("r",l),this.s=F("s",g),k!=null&&(this.recovery=k),Object.freeze(this)}static fromBytes(l,g=M){H(l,g);let k;if(g==="der"){const{r:b,s:c}=Fe.toSig(_e(l));return new $(b,c)}g==="recovered"&&(k=l[0],g="compact",l=l.subarray(1));const E=o.BYTES,A=l.subarray(0,E),L=l.subarray(E,E*2);return new $(o.fromBytes(A),o.fromBytes(L),k)}static fromHex(l,g){return this.fromBytes(sn(l),g)}addRecoveryBit(l){return new $(this.r,this.s,l)}recoverPublicKey(l){const g=i.ORDER,{r:k,s:E,recovery:A}=this;if(A==null||![0,1,2,3].includes(A))throw new Error("recovery id invalid");if(u*ia<g&&A>1)throw new Error("recovery id is ambiguous for h>1 curve");const b=A===2||A===3?k+u:k;if(!i.isValid(b))throw new Error("recovery id 2 or 3 invalid");const c=i.toBytes(b),f=n.fromBytes(Me(sa((A&1)===0),c)),w=o.inv(b),I=X(Dt("msgHash",l)),z=o.create(-I*w),j=o.create(E*w),rt=n.BASE.multiplyUnsafe(z).add(f.multiplyUnsafe(j));if(rt.is0())throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return N(this.s)}toBytes(l=M){if(Ei(l),l==="der")return sn(Fe.hexFromSig(this));const g=o.toBytes(this.r),k=o.toBytes(this.s);if(l==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return Me(Uint8Array.of(this.recovery),g,k)}return Me(g,k)}toHex(l){return sr(this.toBytes(l))}assertValidity(){}static fromCompact(l){return $.fromBytes(Dt("sig",l),"compact")}static fromDER(l){return $.fromBytes(Dt("sig",l),"der")}normalizeS(){return this.hasHighS()?new $(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return sr(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return sr(this.toBytes("compact"))}}const Y=e.bits2int||function(l){if(l.length>8192)throw new Error("input is too large");const g=bn(l),k=l.length*8-p;return k>0?g>>BigInt(k):g},X=e.bits2int_modN||function(l){return o.create(Y(l))},Q=zr(p);function ct(a){return xi("num < 2^"+p,a,De,Q),o.toBytes(a)}function ot(a,l){return _e(a,void 0,"message"),l?_e(t(a),void 0,"prehashed message"):a}function C(a,l,g){if(["recovered","canonical"].some(z=>z in g))throw new Error("sign() legacy options not supported");const{lowS:k,prehash:E,extraEntropy:A}=di(g,T);a=ot(a,E);const L=X(a),b=yr(o,l),c=[ct(b),ct(L)];if(A!=null&&A!==!1){const z=A===!0?r(S.secretKey):A;c.push(Dt("extraEntropy",z))}const f=Me(...c),w=L;function I(z){const j=Y(z);if(!o.isValidNot0(j))return;const rt=o.inv(j),st=n.BASE.multiply(j).toAffine(),kt=o.create(st.x);if(kt===De)return;const vt=o.create(rt*o.create(w+kt*b));if(vt===De)return;let It=(st.x===kt?0:2)|Number(st.y&wr),Ie=vt;return k&&N(vt)&&(Ie=o.neg(vt),It^=1),new $(kt,Ie,It)}return{seed:f,k2sig:I}}function U(a,l,g={}){a=Dt("message",a);const{seed:k,k2sig:E}=C(a,l,g);return uc(t.outputLen,o.BYTES,s)(k,E)}function D(a){let l;const g=typeof a=="string"||Fr(a),k=!g&&a!==null&&typeof a=="object"&&typeof a.r=="bigint"&&typeof a.s=="bigint";if(!g&&!k)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(k)l=new $(a.r,a.s);else if(g){try{l=$.fromBytes(Dt("sig",a),"der")}catch(E){if(!(E instanceof Fe.Err))throw E}if(!l)try{l=$.fromBytes(Dt("sig",a),"compact")}catch{return!1}}return l||!1}function V(a,l,g,k={}){const{lowS:E,prehash:A,format:L}=di(k,T);if(g=Dt("publicKey",g),l=ot(Dt("message",l),A),"strict"in k)throw new Error("options.strict was renamed to lowS");const b=L===void 0?D(a):$.fromBytes(Dt("sig",a),L);if(b===!1)return!1;try{const c=n.fromBytes(g);if(E&&b.hasHighS())return!1;const{r:f,s:w}=b,I=X(l),z=o.inv(w),j=o.create(I*z),rt=o.create(f*z),st=n.BASE.multiplyUnsafe(j).add(c.multiplyUnsafe(rt));return st.is0()?!1:o.create(st.x)===f}catch{return!1}}function y(a,l,g={}){const{prehash:k}=di(g,T);return l=ot(l,k),$.fromBytes(a,"recovered").recoverPublicKey(l).toBytes()}return Object.freeze({keygen:v,getPublicKey:B,getSharedSecret:P,utils:_,lengths:S,Point:n,sign:U,verify:V,recoverPublicKey:y,Signature:$,hash:t})}function yf(n){const t={a:n.a,b:n.b,p:n.Fp.ORDER,n:n.n,h:n.h,Gx:n.Gx,Gy:n.Gy},e=n.Fp;let r=n.allowedPrivateKeyLengths?Array.from(new Set(n.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;const s=cr(t.n,{BITS:n.nBitLength,allowedLengths:r,modFromBytes:n.wrapPrivateKey}),i={Fp:e,Fn:s,allowInfinityPoint:n.allowInfinityPoint,endo:n.endo,isTorsionFree:n.isTorsionFree,clearCofactor:n.clearCofactor,fromBytes:n.fromBytes,toBytes:n.toBytes};return{CURVE:t,curveOpts:i}}function mf(n){const{CURVE:t,curveOpts:e}=yf(n),r={hmac:n.hmac,randomBytes:n.randomBytes,lowS:n.lowS,bits2int:n.bits2int,bits2int_modN:n.bits2int_modN};return{CURVE:t,curveOpts:e,hash:n.hash,ecdsaOpts:r}}function wf(n,t){const e=t.Point;return Object.assign({},t,{ProjectivePoint:e,CURVE:Object.assign({},n,Mo(e.Fn.ORDER,e.Fn.BITS))})}function bf(n){const{CURVE:t,curveOpts:e,hash:r,ecdsaOpts:s}=mf(n),i=df(t,e),o=gf(i,r,s);return wf(n,o)}function kf(n,t){const e=r=>bf({...n,hash:r});return{...e(t),create:e}}const Wi={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},vf={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},qs=BigInt(2);function Sf(n){const t=Wi.p,e=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),u=BigInt(44),p=BigInt(88),v=n*n*n%t,B=v*v*n%t,P=qt(B,e,t)*B%t,_=qt(P,e,t)*B%t,S=qt(_,qs,t)*v%t,T=qt(S,s,t)*S%t,M=qt(T,i,t)*T%t,N=qt(M,u,t)*M%t,F=qt(N,p,t)*N%t,H=qt(F,u,t)*M%t,$=qt(H,e,t)*B%t,Y=qt($,o,t)*T%t,X=qt(Y,r,t)*v%t,Q=qt(X,qs,t);if(!Ii.eql(Ii.sqr(Q),n))throw new Error("Cannot find square root");return Q}const Ii=cr(Wi.p,{sqrt:Sf}),$i=kf({...Wi,Fp:Ii,lowS:!0,endo:vf},wo),xf=Ir.utils.randomPrivateKey,Ds=()=>{const n=Ir.utils.randomPrivateKey(),t=dn(n),e=new Uint8Array(64);return e.set(n),e.set(t,32),{publicKey:t,secretKey:e}},dn=Ir.getPublicKey;function Ws(n){try{return Ir.ExtendedPoint.fromHex(n),!0}catch{return!1}}const Vi=(n,t)=>Ir.sign(n,t.slice(0,32)),Ef=Ir.verify,yt=n=>ft.Buffer.isBuffer(n)?n:n instanceof Uint8Array?ft.Buffer.from(n.buffer,n.byteOffset,n.byteLength):ft.Buffer.from(n);class aa{constructor(t){Object.assign(this,t)}encode(){return ft.Buffer.from(si.serialize(nn,this))}static decode(t){return si.deserialize(nn,this,t)}static decodeUnchecked(t){return si.deserializeUnchecked(nn,this,t)}}class Pl extends aa{constructor(t){if(super(t),this.enum="",Object.keys(t).length!==1)throw new Error("Enum can only take single value");Object.keys(t).map(e=>{this.enum=e})}}const nn=new Map;var ca;const If=32,We=32;function Af(n){return n._bn!==void 0}let $s=1;class tt extends aa{constructor(t){if(super({}),this._bn=void 0,Af(t))this._bn=t._bn;else{if(typeof t=="string"){const e=he.decode(t);if(e.length!=We)throw new Error("Invalid public key input");this._bn=new Es(e)}else this._bn=new Es(t);if(this._bn.byteLength()>We)throw new Error("Invalid public key input")}}static unique(){const t=new tt($s);return $s+=1,new tt(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return he.encode(this.toBytes())}toJSON(){return this.toBase58()}toBytes(){const t=this.toBuffer();return new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}toBuffer(){const t=this._bn.toArrayLike(ft.Buffer);if(t.length===We)return t;const e=ft.Buffer.alloc(32);return t.copy(e,32-t.length),e}get[Symbol.toStringTag](){return`PublicKey(${this.toString()})`}toString(){return this.toBase58()}static async createWithSeed(t,e,r){const s=ft.Buffer.concat([t.toBuffer(),ft.Buffer.from(e),r.toBuffer()]),i=Bs(s);return new tt(i)}static createProgramAddressSync(t,e){let r=ft.Buffer.alloc(0);t.forEach(function(i){if(i.length>If)throw new TypeError("Max seed length exceeded");r=ft.Buffer.concat([r,yt(i)])}),r=ft.Buffer.concat([r,e.toBuffer(),ft.Buffer.from("ProgramDerivedAddress")]);const s=Bs(r);if(Ws(s))throw new Error("Invalid seeds, address must fall off the curve");return new tt(s)}static async createProgramAddress(t,e){return this.createProgramAddressSync(t,e)}static findProgramAddressSync(t,e){let r=255,s;for(;r!=0;){try{const i=t.concat(ft.Buffer.from([r]));s=this.createProgramAddressSync(i,e)}catch(i){if(i instanceof TypeError)throw i;r--;continue}return[s,r]}throw new Error("Unable to find a viable program address nonce")}static async findProgramAddress(t,e){return this.findProgramAddressSync(t,e)}static isOnCurve(t){const e=new tt(t);return Ws(e.toBytes())}}ca=tt;tt.default=new ca("11111111111111111111111111111111");nn.set(tt,{kind:"struct",fields:[["_bn","u256"]]});class Ll{constructor(t){if(this._publicKey=void 0,this._secretKey=void 0,t){const e=yt(t);if(t.length!==64)throw new Error("bad secret key size");this._publicKey=e.slice(32,64),this._secretKey=e.slice(0,32)}else this._secretKey=yt(xf()),this._publicKey=yt(dn(this._secretKey))}get publicKey(){return new tt(this._publicKey)}get secretKey(){return ft.Buffer.concat([this._secretKey,this._publicKey],64)}}const Cl=new tt("BPFLoader1111111111111111111111111111111111"),or=1232,Hi=127,pn=64;class ua extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(ua.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class fa extends Error{constructor(t,e){super(`Transaction was not confirmed in ${e.toFixed(2)} seconds. It is unknown if it succeeded or failed. Check signature ${t} using the Solana Explorer or CLI tools.`),this.signature=void 0,this.signature=t}}Object.defineProperty(fa.prototype,"name",{value:"TransactionExpiredTimeoutError"});class Tr extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(Tr.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class gn{constructor(t,e){this.staticAccountKeys=void 0,this.accountKeysFromLookups=void 0,this.staticAccountKeys=t,this.accountKeysFromLookups=e}keySegments(){const t=[this.staticAccountKeys];return this.accountKeysFromLookups&&(t.push(this.accountKeysFromLookups.writable),t.push(this.accountKeysFromLookups.readonly)),t}get(t){for(const e of this.keySegments()){if(t<e.length)return e[t];t-=e.length}}get length(){return this.keySegments().flat().length}compileInstructions(t){if(this.length>256)throw new Error("Account index overflow encountered during compilation");const r=new Map;this.keySegments().flat().forEach((i,o)=>{r.set(i.toBase58(),o)});const s=i=>{const o=r.get(i.toBase58());if(o===void 0)throw new Error("Encountered an unknown instruction account key during compilation");return o};return t.map(i=>({programIdIndex:s(i.programId),accountKeyIndexes:i.keys.map(o=>s(o.pubkey)),data:i.data}))}}const mt=(n="publicKey")=>R.blob(32,n),_f=(n="signature")=>R.blob(64,n),ir=(n="string")=>{const t=R.struct([R.u32("length"),R.u32("lengthPadding"),R.blob(R.offset(R.u32(),-8),"chars")],n),e=t.decode.bind(t),r=t.encode.bind(t),s=t;return s.decode=(i,o)=>e(i,o).chars.toString(),s.encode=(i,o,u)=>{const p={chars:ft.Buffer.from(i,"utf8")};return r(p,o,u)},s.alloc=i=>R.u32().span+R.u32().span+ft.Buffer.from(i,"utf8").length,s},Bf=(n="authorized")=>R.struct([mt("staker"),mt("withdrawer")],n),Rf=(n="lockup")=>R.struct([R.ns64("unixTimestamp"),R.ns64("epoch"),mt("custodian")],n),Mf=(n="voteInit")=>R.struct([mt("nodePubkey"),mt("authorizedVoter"),mt("authorizedWithdrawer"),R.u8("commission")],n),Tf=(n="voteAuthorizeWithSeedArgs")=>R.struct([R.u32("voteAuthorizationType"),mt("currentAuthorityDerivedKeyOwnerPubkey"),ir("currentAuthorityDerivedKeySeed"),mt("newAuthorized")],n);function ha(n,t){const e=s=>{if(s.span>=0)return s.span;if(typeof s.alloc=="function")return s.alloc(t[s.property]);if("count"in s&&"elementLayout"in s){const i=t[s.property];if(Array.isArray(i))return i.length*e(s.elementLayout)}else if("fields"in s)return ha({layout:s},t[s.property]);return 0};let r=0;return n.layout.fields.forEach(s=>{r+=e(s)}),r}function ke(n){let t=0,e=0;for(;;){let r=n.shift();if(t|=(r&127)<<e*7,e+=1,(r&128)===0)break}return t}function Ee(n,t){let e=t;for(;;){let r=e&127;if(e>>=7,e==0){n.push(r);break}else r|=128,n.push(r)}}function bt(n,t){if(!n)throw new Error(t||"Assertion failed")}class En{constructor(t,e){this.payer=void 0,this.keyMetaMap=void 0,this.payer=t,this.keyMetaMap=e}static compile(t,e){const r=new Map,s=o=>{const u=o.toBase58();let p=r.get(u);return p===void 0&&(p={isSigner:!1,isWritable:!1,isInvoked:!1},r.set(u,p)),p},i=s(e);i.isSigner=!0,i.isWritable=!0;for(const o of t){s(o.programId).isInvoked=!0;for(const u of o.keys){const p=s(u.pubkey);p.isSigner||=u.isSigner,p.isWritable||=u.isWritable}}return new En(e,r)}getMessageComponents(){const t=[...this.keyMetaMap.entries()];bt(t.length<=256,"Max static account keys length exceeded");const e=t.filter(([,p])=>p.isSigner&&p.isWritable),r=t.filter(([,p])=>p.isSigner&&!p.isWritable),s=t.filter(([,p])=>!p.isSigner&&p.isWritable),i=t.filter(([,p])=>!p.isSigner&&!p.isWritable),o={numRequiredSignatures:e.length+r.length,numReadonlySignedAccounts:r.length,numReadonlyUnsignedAccounts:i.length};{bt(e.length>0,"Expected at least one writable signer key");const[p]=e[0];bt(p===this.payer.toBase58(),"Expected first writable signer key to be the fee payer")}const u=[...e.map(([p])=>new tt(p)),...r.map(([p])=>new tt(p)),...s.map(([p])=>new tt(p)),...i.map(([p])=>new tt(p))];return[o,u]}extractTableLookup(t){const[e,r]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&o.isWritable),[s,i]=this.drainKeysFoundInLookupTable(t.state.addresses,o=>!o.isSigner&&!o.isInvoked&&!o.isWritable);if(!(e.length===0&&s.length===0))return[{accountKey:t.key,writableIndexes:e,readonlyIndexes:s},{writable:r,readonly:i}]}drainKeysFoundInLookupTable(t,e){const r=new Array,s=new Array;for(const[i,o]of this.keyMetaMap.entries())if(e(o)){const u=new tt(i),p=t.findIndex(v=>v.equals(u));p>=0&&(bt(p<256,"Max lookup table index exceeded"),r.push(p),s.push(u),this.keyMetaMap.delete(i))}return[r,s]}}const la="Reached end of buffer unexpectedly";function Te(n){if(n.length===0)throw new Error(la);return n.shift()}function ve(n,...t){const[e]=t;if(t.length===2?e+(t[1]??0)>n.length:e>=n.length)throw new Error(la);return n.splice(...t)}class Ce{constructor(t){this.header=void 0,this.accountKeys=void 0,this.recentBlockhash=void 0,this.instructions=void 0,this.indexToProgramIds=new Map,this.header=t.header,this.accountKeys=t.accountKeys.map(e=>new tt(e)),this.recentBlockhash=t.recentBlockhash,this.instructions=t.instructions,this.instructions.forEach(e=>this.indexToProgramIds.set(e.programIdIndex,this.accountKeys[e.programIdIndex]))}get version(){return"legacy"}get staticAccountKeys(){return this.accountKeys}get compiledInstructions(){return this.instructions.map(t=>({programIdIndex:t.programIdIndex,accountKeyIndexes:t.accounts,data:he.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new gn(this.staticAccountKeys)}static compile(t){const e=En.compile(t.instructions,t.payerKey),[r,s]=e.getMessageComponents(),o=new gn(s).compileInstructions(t.instructions).map(u=>({programIdIndex:u.programIdIndex,accounts:u.accountKeyIndexes,data:he.encode(u.data)}));return new Ce({header:r,accountKeys:s,recentBlockhash:t.recentBlockhash,instructions:o})}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const e=this.header.numRequiredSignatures;if(t>=this.header.numRequiredSignatures){const r=t-e,i=this.accountKeys.length-e-this.header.numReadonlyUnsignedAccounts;return r<i}else{const r=e-this.header.numReadonlySignedAccounts;return t<r}}isProgramId(t){return this.indexToProgramIds.has(t)}programIds(){return[...this.indexToProgramIds.values()]}nonProgramIds(){return this.accountKeys.filter((t,e)=>!this.isProgramId(e))}serialize(){const t=this.accountKeys.length;let e=[];Ee(e,t);const r=this.instructions.map(P=>{const{accounts:_,programIdIndex:S}=P,T=Array.from(he.decode(P.data));let M=[];Ee(M,_.length);let N=[];return Ee(N,T.length),{programIdIndex:S,keyIndicesCount:ft.Buffer.from(M),keyIndices:_,dataLength:ft.Buffer.from(N),data:T}});let s=[];Ee(s,r.length);let i=ft.Buffer.alloc(or);ft.Buffer.from(s).copy(i);let o=s.length;r.forEach(P=>{const S=R.struct([R.u8("programIdIndex"),R.blob(P.keyIndicesCount.length,"keyIndicesCount"),R.seq(R.u8("keyIndex"),P.keyIndices.length,"keyIndices"),R.blob(P.dataLength.length,"dataLength"),R.seq(R.u8("userdatum"),P.data.length,"data")]).encode(P,i,o);o+=S}),i=i.slice(0,o);const u=R.struct([R.blob(1,"numRequiredSignatures"),R.blob(1,"numReadonlySignedAccounts"),R.blob(1,"numReadonlyUnsignedAccounts"),R.blob(e.length,"keyCount"),R.seq(mt("key"),t,"keys"),mt("recentBlockhash")]),p={numRequiredSignatures:ft.Buffer.from([this.header.numRequiredSignatures]),numReadonlySignedAccounts:ft.Buffer.from([this.header.numReadonlySignedAccounts]),numReadonlyUnsignedAccounts:ft.Buffer.from([this.header.numReadonlyUnsignedAccounts]),keyCount:ft.Buffer.from(e),keys:this.accountKeys.map(P=>yt(P.toBytes())),recentBlockhash:he.decode(this.recentBlockhash)};let v=ft.Buffer.alloc(2048);const B=u.encode(p,v);return i.copy(v,B),v.slice(0,B+i.length)}static from(t){let e=[...t];const r=Te(e);if(r!==(r&Hi))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const s=Te(e),i=Te(e),o=ke(e);let u=[];for(let _=0;_<o;_++){const S=ve(e,0,We);u.push(new tt(ft.Buffer.from(S)))}const p=ve(e,0,We),v=ke(e);let B=[];for(let _=0;_<v;_++){const S=Te(e),T=ke(e),M=ve(e,0,T),N=ke(e),F=ve(e,0,N),H=he.encode(ft.Buffer.from(F));B.push({programIdIndex:S,accounts:M,data:H})}const P={header:{numRequiredSignatures:r,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:i},recentBlockhash:he.encode(ft.Buffer.from(p)),accountKeys:u,instructions:B};return new Ce(P)}}class Sr{constructor(t){this.header=void 0,this.staticAccountKeys=void 0,this.recentBlockhash=void 0,this.compiledInstructions=void 0,this.addressTableLookups=void 0,this.header=t.header,this.staticAccountKeys=t.staticAccountKeys,this.recentBlockhash=t.recentBlockhash,this.compiledInstructions=t.compiledInstructions,this.addressTableLookups=t.addressTableLookups}get version(){return 0}get numAccountKeysFromLookups(){let t=0;for(const e of this.addressTableLookups)t+=e.readonlyIndexes.length+e.writableIndexes.length;return t}getAccountKeys(t){let e;if(t&&"accountKeysFromLookups"in t&&t.accountKeysFromLookups){if(this.numAccountKeysFromLookups!=t.accountKeysFromLookups.writable.length+t.accountKeysFromLookups.readonly.length)throw new Error("Failed to get account keys because of a mismatch in the number of account keys from lookups");e=t.accountKeysFromLookups}else if(t&&"addressLookupTableAccounts"in t&&t.addressLookupTableAccounts)e=this.resolveAddressTableLookups(t.addressLookupTableAccounts);else if(this.addressTableLookups.length>0)throw new Error("Failed to get account keys because address table lookups were not resolved");return new gn(this.staticAccountKeys,e)}isAccountSigner(t){return t<this.header.numRequiredSignatures}isAccountWritable(t){const e=this.header.numRequiredSignatures,r=this.staticAccountKeys.length;if(t>=r){const s=t-r,i=this.addressTableLookups.reduce((o,u)=>o+u.writableIndexes.length,0);return s<i}else if(t>=this.header.numRequiredSignatures){const s=t-e,o=r-e-this.header.numReadonlyUnsignedAccounts;return s<o}else{const s=e-this.header.numReadonlySignedAccounts;return t<s}}resolveAddressTableLookups(t){const e={writable:[],readonly:[]};for(const r of this.addressTableLookups){const s=t.find(i=>i.key.equals(r.accountKey));if(!s)throw new Error(`Failed to find address lookup table account for table key ${r.accountKey.toBase58()}`);for(const i of r.writableIndexes)if(i<s.state.addresses.length)e.writable.push(s.state.addresses[i]);else throw new Error(`Failed to find address for index ${i} in address lookup table ${r.accountKey.toBase58()}`);for(const i of r.readonlyIndexes)if(i<s.state.addresses.length)e.readonly.push(s.state.addresses[i]);else throw new Error(`Failed to find address for index ${i} in address lookup table ${r.accountKey.toBase58()}`)}return e}static compile(t){const e=En.compile(t.instructions,t.payerKey),r=new Array,s={writable:new Array,readonly:new Array},i=t.addressLookupTableAccounts||[];for(const B of i){const P=e.extractTableLookup(B);if(P!==void 0){const[_,{writable:S,readonly:T}]=P;r.push(_),s.writable.push(...S),s.readonly.push(...T)}}const[o,u]=e.getMessageComponents(),v=new gn(u,s).compileInstructions(t.instructions);return new Sr({header:o,staticAccountKeys:u,recentBlockhash:t.recentBlockhash,compiledInstructions:v,addressTableLookups:r})}serialize(){const t=Array();Ee(t,this.staticAccountKeys.length);const e=this.serializeInstructions(),r=Array();Ee(r,this.compiledInstructions.length);const s=this.serializeAddressTableLookups(),i=Array();Ee(i,this.addressTableLookups.length);const o=R.struct([R.u8("prefix"),R.struct([R.u8("numRequiredSignatures"),R.u8("numReadonlySignedAccounts"),R.u8("numReadonlyUnsignedAccounts")],"header"),R.blob(t.length,"staticAccountKeysLength"),R.seq(mt(),this.staticAccountKeys.length,"staticAccountKeys"),mt("recentBlockhash"),R.blob(r.length,"instructionsLength"),R.blob(e.length,"serializedInstructions"),R.blob(i.length,"addressTableLookupsLength"),R.blob(s.length,"serializedAddressTableLookups")]),u=new Uint8Array(or),v=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(B=>B.toBytes()),recentBlockhash:he.decode(this.recentBlockhash),instructionsLength:new Uint8Array(r),serializedInstructions:e,addressTableLookupsLength:new Uint8Array(i),serializedAddressTableLookups:s},u);return u.slice(0,v)}serializeInstructions(){let t=0;const e=new Uint8Array(or);for(const r of this.compiledInstructions){const s=Array();Ee(s,r.accountKeyIndexes.length);const i=Array();Ee(i,r.data.length);const o=R.struct([R.u8("programIdIndex"),R.blob(s.length,"encodedAccountKeyIndexesLength"),R.seq(R.u8(),r.accountKeyIndexes.length,"accountKeyIndexes"),R.blob(i.length,"encodedDataLength"),R.blob(r.data.length,"data")]);t+=o.encode({programIdIndex:r.programIdIndex,encodedAccountKeyIndexesLength:new Uint8Array(s),accountKeyIndexes:r.accountKeyIndexes,encodedDataLength:new Uint8Array(i),data:r.data},e,t)}return e.slice(0,t)}serializeAddressTableLookups(){let t=0;const e=new Uint8Array(or);for(const r of this.addressTableLookups){const s=Array();Ee(s,r.writableIndexes.length);const i=Array();Ee(i,r.readonlyIndexes.length);const o=R.struct([mt("accountKey"),R.blob(s.length,"encodedWritableIndexesLength"),R.seq(R.u8(),r.writableIndexes.length,"writableIndexes"),R.blob(i.length,"encodedReadonlyIndexesLength"),R.seq(R.u8(),r.readonlyIndexes.length,"readonlyIndexes")]);t+=o.encode({accountKey:r.accountKey.toBytes(),encodedWritableIndexesLength:new Uint8Array(s),writableIndexes:r.writableIndexes,encodedReadonlyIndexesLength:new Uint8Array(i),readonlyIndexes:r.readonlyIndexes},e,t)}return e.slice(0,t)}static deserialize(t){let e=[...t];const r=Te(e),s=r&Hi;bt(r!==s,"Expected versioned message but received legacy message");const i=s;bt(i===0,`Expected versioned message with version 0 but found version ${i}`);const o={numRequiredSignatures:Te(e),numReadonlySignedAccounts:Te(e),numReadonlyUnsignedAccounts:Te(e)},u=[],p=ke(e);for(let T=0;T<p;T++)u.push(new tt(ve(e,0,We)));const v=he.encode(ve(e,0,We)),B=ke(e),P=[];for(let T=0;T<B;T++){const M=Te(e),N=ke(e),F=ve(e,0,N),H=ke(e),$=new Uint8Array(ve(e,0,H));P.push({programIdIndex:M,accountKeyIndexes:F,data:$})}const _=ke(e),S=[];for(let T=0;T<_;T++){const M=new tt(ve(e,0,We)),N=ke(e),F=ve(e,0,N),H=ke(e),$=ve(e,0,H);S.push({accountKey:M,writableIndexes:F,readonlyIndexes:$})}return new Sr({header:o,staticAccountKeys:u,recentBlockhash:v,compiledInstructions:P,addressTableLookups:S})}}const da={deserializeMessageVersion(n){const t=n[0],e=t&Hi;return e===t?"legacy":e},deserialize:n=>{const t=da.deserializeMessageVersion(n);if(t==="legacy")return Ce.from(n);if(t===0)return Sr.deserialize(n);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let Ye=(function(n){return n[n.BLOCKHEIGHT_EXCEEDED=0]="BLOCKHEIGHT_EXCEEDED",n[n.PROCESSED=1]="PROCESSED",n[n.TIMED_OUT=2]="TIMED_OUT",n[n.NONCE_INVALID=3]="NONCE_INVALID",n})({});const Pf=ft.Buffer.alloc(pn).fill(0);class Bt{constructor(t){this.keys=void 0,this.programId=void 0,this.data=ft.Buffer.alloc(0),this.programId=t.programId,this.keys=t.keys,t.data&&(this.data=t.data)}toJSON(){return{keys:this.keys.map(({pubkey:t,isSigner:e,isWritable:r})=>({pubkey:t.toJSON(),isSigner:e,isWritable:r})),programId:this.programId.toJSON(),data:[...this.data]}}}class xt{get signature(){return this.signatures.length>0?this.signatures[0].signature:null}constructor(t){if(this.signatures=[],this.feePayer=void 0,this.instructions=[],this.recentBlockhash=void 0,this.lastValidBlockHeight=void 0,this.nonceInfo=void 0,this.minNonceContextSlot=void 0,this._message=void 0,this._json=void 0,!!t)if(t.feePayer&&(this.feePayer=t.feePayer),t.signatures&&(this.signatures=t.signatures),Object.prototype.hasOwnProperty.call(t,"nonceInfo")){const{minContextSlot:e,nonceInfo:r}=t;this.minNonceContextSlot=e,this.nonceInfo=r}else if(Object.prototype.hasOwnProperty.call(t,"lastValidBlockHeight")){const{blockhash:e,lastValidBlockHeight:r}=t;this.recentBlockhash=e,this.lastValidBlockHeight=r}else{const{recentBlockhash:e,nonceInfo:r}=t;r&&(this.nonceInfo=r),this.recentBlockhash=e}}toJSON(){return{recentBlockhash:this.recentBlockhash||null,feePayer:this.feePayer?this.feePayer.toJSON():null,nonceInfo:this.nonceInfo?{nonce:this.nonceInfo.nonce,nonceInstruction:this.nonceInfo.nonceInstruction.toJSON()}:null,instructions:this.instructions.map(t=>t.toJSON()),signers:this.signatures.map(({publicKey:t})=>t.toJSON())}}add(...t){if(t.length===0)throw new Error("No instructions");return t.forEach(e=>{"instructions"in e?this.instructions=this.instructions.concat(e.instructions):"data"in e&&"programId"in e&&"keys"in e?this.instructions.push(e):this.instructions.push(new Bt(e))}),this}compileMessage(){if(this._message&&JSON.stringify(this.toJSON())===JSON.stringify(this._json))return this._message;let t,e;if(this.nonceInfo?(t=this.nonceInfo.nonce,this.instructions[0]!=this.nonceInfo.nonceInstruction?e=[this.nonceInfo.nonceInstruction,...this.instructions]:e=this.instructions):(t=this.recentBlockhash,e=this.instructions),!t)throw new Error("Transaction recentBlockhash required");e.length<1&&console.warn("No instructions provided");let r;if(this.feePayer)r=this.feePayer;else if(this.signatures.length>0&&this.signatures[0].publicKey)r=this.signatures[0].publicKey;else throw new Error("Transaction fee payer required");for(let M=0;M<e.length;M++)if(e[M].programId===void 0)throw new Error(`Transaction instruction index ${M} has undefined program id`);const s=[],i=[];e.forEach(M=>{M.keys.forEach(F=>{i.push({...F})});const N=M.programId.toString();s.includes(N)||s.push(N)}),s.forEach(M=>{i.push({pubkey:new tt(M),isSigner:!1,isWritable:!1})});const o=[];i.forEach(M=>{const N=M.pubkey.toString(),F=o.findIndex(H=>H.pubkey.toString()===N);F>-1?(o[F].isWritable=o[F].isWritable||M.isWritable,o[F].isSigner=o[F].isSigner||M.isSigner):o.push(M)}),o.sort(function(M,N){if(M.isSigner!==N.isSigner)return M.isSigner?-1:1;if(M.isWritable!==N.isWritable)return M.isWritable?-1:1;const F={localeMatcher:"best fit",usage:"sort",sensitivity:"variant",ignorePunctuation:!1,numeric:!1,caseFirst:"lower"};return M.pubkey.toBase58().localeCompare(N.pubkey.toBase58(),"en",F)});const u=o.findIndex(M=>M.pubkey.equals(r));if(u>-1){const[M]=o.splice(u,1);M.isSigner=!0,M.isWritable=!0,o.unshift(M)}else o.unshift({pubkey:r,isSigner:!0,isWritable:!0});for(const M of this.signatures){const N=o.findIndex(F=>F.pubkey.equals(M.publicKey));if(N>-1)o[N].isSigner||(o[N].isSigner=!0,console.warn("Transaction references a signature that is unnecessary, only the fee payer and instruction signer accounts should sign a transaction. This behavior is deprecated and will throw an error in the next major version release."));else throw new Error(`unknown signer: ${M.publicKey.toString()}`)}let p=0,v=0,B=0;const P=[],_=[];o.forEach(({pubkey:M,isSigner:N,isWritable:F})=>{N?(P.push(M.toString()),p+=1,F||(v+=1)):(_.push(M.toString()),F||(B+=1))});const S=P.concat(_),T=e.map(M=>{const{data:N,programId:F}=M;return{programIdIndex:S.indexOf(F.toString()),accounts:M.keys.map(H=>S.indexOf(H.pubkey.toString())),data:he.encode(N)}});return T.forEach(M=>{bt(M.programIdIndex>=0),M.accounts.forEach(N=>bt(N>=0))}),new Ce({header:{numRequiredSignatures:p,numReadonlySignedAccounts:v,numReadonlyUnsignedAccounts:B},accountKeys:S,recentBlockhash:t,instructions:T})}_compile(){const t=this.compileMessage(),e=t.accountKeys.slice(0,t.header.numRequiredSignatures);return this.signatures.length===e.length&&this.signatures.every((s,i)=>e[i].equals(s.publicKey))||(this.signatures=e.map(r=>({signature:null,publicKey:r}))),t}serializeMessage(){return this._compile().serialize()}async getEstimatedFee(t){return(await t.getFeeForMessage(this.compileMessage())).value}setSigners(...t){if(t.length===0)throw new Error("No signers");const e=new Set;this.signatures=t.filter(r=>{const s=r.toString();return e.has(s)?!1:(e.add(s),!0)}).map(r=>({signature:null,publicKey:r}))}sign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,r=[];for(const i of t){const o=i.publicKey.toString();e.has(o)||(e.add(o),r.push(i))}this.signatures=r.map(i=>({signature:null,publicKey:i.publicKey}));const s=this._compile();this._partialSign(s,...r)}partialSign(...t){if(t.length===0)throw new Error("No signers");const e=new Set,r=[];for(const i of t){const o=i.publicKey.toString();e.has(o)||(e.add(o),r.push(i))}const s=this._compile();this._partialSign(s,...r)}_partialSign(t,...e){const r=t.serialize();e.forEach(s=>{const i=Vi(r,s.secretKey);this._addSignature(s.publicKey,yt(i))})}addSignature(t,e){this._compile(),this._addSignature(t,e)}_addSignature(t,e){bt(e.length===64);const r=this.signatures.findIndex(s=>t.equals(s.publicKey));if(r<0)throw new Error(`unknown signer: ${t.toString()}`);this.signatures[r].signature=ft.Buffer.from(e)}verifySignatures(t=!0){return!this._getMessageSignednessErrors(this.serializeMessage(),t)}_getMessageSignednessErrors(t,e){const r={};for(const{signature:s,publicKey:i}of this.signatures)s===null?e&&(r.missing||=[]).push(i):Ef(s,t,i.toBytes())||(r.invalid||=[]).push(i);return r.invalid||r.missing?r:void 0}serialize(t){const{requireAllSignatures:e,verifySignatures:r}=Object.assign({requireAllSignatures:!0,verifySignatures:!0},t),s=this.serializeMessage();if(r){const i=this._getMessageSignednessErrors(s,e);if(i){let o="Signature verification failed.";throw i.invalid&&(o+=`
|
|
2
2
|
Invalid signature for public key${i.invalid.length===1?"":"(s)"} [\`${i.invalid.map(u=>u.toBase58()).join("`, `")}\`].`),i.missing&&(o+=`
|
|
3
3
|
Missing signature for public key${i.missing.length===1?"":"(s)"} [\`${i.missing.map(u=>u.toBase58()).join("`, `")}\`].`),new Error(o)}}return this._serialize(s)}_serialize(t){const{signatures:e}=this,r=[];Ee(r,e.length);const s=r.length+e.length*64+t.length,i=ft.Buffer.alloc(s);return bt(e.length<256),ft.Buffer.from(r).copy(i,0),e.forEach(({signature:o},u)=>{o!==null&&(bt(o.length===64,"signature has invalid length"),ft.Buffer.from(o).copy(i,r.length+u*64))}),t.copy(i,r.length+e.length*64),bt(i.length<=or,`Transaction too large: ${i.length} > ${or}`),i}get keys(){return bt(this.instructions.length===1),this.instructions[0].keys.map(t=>t.pubkey)}get programId(){return bt(this.instructions.length===1),this.instructions[0].programId}get data(){return bt(this.instructions.length===1),this.instructions[0].data}static from(t){let e=[...t];const r=ke(e);let s=[];for(let i=0;i<r;i++){const o=ve(e,0,pn);s.push(he.encode(ft.Buffer.from(o)))}return xt.populate(Ce.from(e),s)}static populate(t,e=[]){const r=new xt;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),e.forEach((s,i)=>{const o={signature:s==he.encode(Pf)?null:he.decode(s),publicKey:t.accountKeys[i]};r.signatures.push(o)}),t.instructions.forEach(s=>{const i=s.accounts.map(o=>{const u=t.accountKeys[o];return{pubkey:u,isSigner:r.signatures.some(p=>p.publicKey.toString()===u.toString())||t.isAccountSigner(o),isWritable:t.isAccountWritable(o)}});r.instructions.push(new Bt({keys:i,programId:t.accountKeys[s.programIdIndex],data:he.decode(s.data)}))}),r._message=t,r._json=r.toJSON(),r}}class pa{constructor(t){this.payerKey=void 0,this.instructions=void 0,this.recentBlockhash=void 0,this.payerKey=t.payerKey,this.instructions=t.instructions,this.recentBlockhash=t.recentBlockhash}static decompile(t,e){const{header:r,compiledInstructions:s,recentBlockhash:i}=t,{numRequiredSignatures:o,numReadonlySignedAccounts:u,numReadonlyUnsignedAccounts:p}=r,v=o-u;bt(v>0,"Message header is invalid");const B=t.staticAccountKeys.length-o-p;bt(B>=0,"Message header is invalid");const P=t.getAccountKeys(e),_=P.get(0);if(_===void 0)throw new Error("Failed to decompile message because no account keys were found");const S=[];for(const T of s){const M=[];for(const F of T.accountKeyIndexes){const H=P.get(F);if(H===void 0)throw new Error(`Failed to find key for account key index ${F}`);const $=F<o;let Y;$?Y=F<v:F<P.staticAccountKeys.length?Y=F-o<B:Y=F-P.staticAccountKeys.length<P.accountKeysFromLookups.writable.length,M.push({pubkey:H,isSigner:F<r.numRequiredSignatures,isWritable:Y})}const N=P.get(T.programIdIndex);if(N===void 0)throw new Error(`Failed to find program id for program id index ${T.programIdIndex}`);S.push(new Bt({programId:N,data:yt(T.data),keys:M}))}return new pa({payerKey:_,instructions:S,recentBlockhash:i})}compileToLegacyMessage(){return Ce.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}compileToV0Message(t){return Sr.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}class ga{get version(){return this.message.version}constructor(t,e){if(this.signatures=void 0,this.message=void 0,e!==void 0)bt(e.length===t.header.numRequiredSignatures,"Expected signatures length to be equal to the number of required signatures"),this.signatures=e;else{const r=[];for(let s=0;s<t.header.numRequiredSignatures;s++)r.push(new Uint8Array(pn));this.signatures=r}this.message=t}serialize(){const t=this.message.serialize(),e=Array();Ee(e,this.signatures.length);const r=R.struct([R.blob(e.length,"encodedSignaturesLength"),R.seq(_f(),this.signatures.length,"signatures"),R.blob(t.length,"serializedMessage")]),s=new Uint8Array(2048),i=r.encode({encodedSignaturesLength:new Uint8Array(e),signatures:this.signatures,serializedMessage:t},s);return s.slice(0,i)}static deserialize(t){let e=[...t];const r=[],s=ke(e);for(let o=0;o<s;o++)r.push(new Uint8Array(ve(e,0,pn)));const i=da.deserialize(new Uint8Array(e));return new ga(i,r)}sign(t){const e=this.message.serialize(),r=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures);for(const s of t){const i=r.findIndex(o=>o.equals(s.publicKey));bt(i>=0,`Cannot sign with non signer key ${s.publicKey.toBase58()}`),this.signatures[i]=Vi(e,s.secretKey)}}addSignature(t,e){bt(e.byteLength===64,"Signature must be 64 bytes long");const s=this.message.staticAccountKeys.slice(0,this.message.header.numRequiredSignatures).findIndex(i=>i.equals(t));bt(s>=0,`Can not add signature; \`${t.toBase58()}\` is not required to sign this transaction`),this.signatures[s]=e}}const Lf=160,Cf=64,Uf=Lf/Cf,ya=1e3/Uf,ze=new tt("SysvarC1ock11111111111111111111111111111111"),Ul=new tt("SysvarEpochSchedu1e111111111111111111111111"),Ol=new tt("Sysvar1nstructions1111111111111111111111111"),pi=new tt("SysvarRecentB1ockHashes11111111111111111111"),Or=new tt("SysvarRent111111111111111111111111111111111"),Nl=new tt("SysvarRewards111111111111111111111111111111"),Fl=new tt("SysvarS1otHashes111111111111111111111111111"),zl=new tt("SysvarS1otHistory11111111111111111111111111"),gi=new tt("SysvarStakeHistory1111111111111111111111111");class yn extends Error{constructor({action:t,signature:e,transactionMessage:r,logs:s}){const i=s?`Logs:
|
|
4
4
|
${JSON.stringify(s.slice(-10),null,2)}. `:"",o="\nCatch the `SendTransactionError` and call `getLogs()` on it for full details.";let u;switch(t){case"send":u=`Transaction ${e} resulted in an error.
|