@acedatacloud/nexior 3.74.0 → 3.75.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-DXb7JbvM.js → Auth-BVDMU7zJ.js} +1 -1
- package/dist/assets/{BotPlaceholder-DxNfSpAj.js → BotPlaceholder-IhsEr4zv.js} +1 -1
- package/dist/assets/{Callback-OOCIjlbp.js → Callback-BXlUV61r.js} +1 -1
- package/dist/assets/{Console-CjFzbgqB.js → Console-JFpeCo0y.js} +1 -1
- package/dist/assets/{Consumption-BhtOulkD.js → Consumption-Beuepw8C.js} +1 -1
- package/dist/assets/{Conversation-D2FglBjy.js → Conversation-DSnK-zlw.js} +1 -1
- package/dist/assets/{CopyToClipboard-B8fD1MOY.js → CopyToClipboard-CU2QRkly.js} +1 -1
- package/dist/assets/{Detail-cmmQHonZ.js → Detail-CQvNCI_G.js} +2 -2
- package/dist/assets/{EditArray-0WTvdiOn.js → EditArray-n9k7BVEw.js} +1 -1
- package/dist/assets/{Extra-YvpVYtrs.js → Extra-DZYDTF9g.js} +1 -1
- package/dist/assets/{FilePreview-BfSKchDA.js → FilePreview-DR_vOrJd.js} +1 -1
- package/dist/assets/{History-BrUbtfBB.js → History-BMitdysS.js} +1 -1
- package/dist/assets/{IconPark.vue_vue_type_script_setup_true_lang-ByG746jv.js → IconPark.vue_vue_type_script_setup_true_lang-Dst1jO3t.js} +1 -1
- package/dist/assets/{ImagePreview-1Uv8U161.js → ImagePreview-CPc0rkNC.js} +1 -1
- package/dist/assets/{ImageWrapper-DiCmcoV5.js → ImageWrapper-BkENnvZx.js} +1 -1
- package/dist/assets/Index-BIqwWYpi.js +1 -0
- package/dist/assets/{Index-qLx5hZvP.js → Index-BSEnGxl7.js} +1 -1
- package/dist/assets/{Index-m3eDrs89.js → Index-BaUBungQ.js} +1 -1
- package/dist/assets/{Index-CKM37J9L.js → Index-BbrQBxLr.js} +1 -1
- package/dist/assets/{Index-B80K_et3.js → Index-Bi6quCVE.js} +1 -1
- package/dist/assets/{Index-DhyJ_fn0.js → Index-Bvsx71E3.js} +1 -1
- package/dist/assets/{Index-BcMHaHf3.js → Index-C2xKX8g9.js} +1 -1
- package/dist/assets/{Index-DxM0XyWP.js → Index-C7Q99Fmh.js} +1 -1
- package/dist/assets/{Index-cygunJ4I.js → Index-CO7kvPnV.js} +1 -1
- package/dist/assets/{Index-B1Jhd8EX.js → Index-CPF1ezh4.js} +1 -1
- package/dist/assets/{Index-5XM49P0r.js → Index-CSK351MB.js} +1 -1
- package/dist/assets/{Index-CN3uuFMX.js → Index-CWCtTh4_.js} +1 -1
- package/dist/assets/{Index-uByP6m1A.js → Index-C_IAzmEl.js} +1 -1
- package/dist/assets/{Index-D98iycxc.js → Index-CdZ9vkqb.js} +1 -1
- package/dist/assets/{Index-5VtzMeim.js → Index-CqunhB_C.js} +1 -1
- package/dist/assets/{Index-B9-EfF8Y.js → Index-CrvTeHJ2.js} +1 -1
- package/dist/assets/{Index-CPJAVcqj.js → Index-CvzQifen.js} +1 -1
- package/dist/assets/Index-D47bcR6T.css +1 -0
- package/dist/assets/{Index-DqLi0o16.js → Index-D6h1830f.js} +1 -1
- package/dist/assets/{Index-B2dhl3tJ.js → Index-Dv_wExu1.js} +1 -1
- package/dist/assets/{Index-BI-6kASG.js → Index-EFpqAz7a.js} +1 -1
- package/dist/assets/{Index-CMhKHlAt.js → Index-QNt5QVJA.js} +1 -1
- package/dist/assets/{Index-BdGTgVpP.js → Index-Ycpw_FEE.js} +1 -1
- package/dist/assets/{Index-VcdV800i.js → Index-anw9zQDz.js} +1 -1
- package/dist/assets/{Index-DXQgCXQC.js → Index-ucfNO5vS.js} +1 -1
- package/dist/assets/{Index-CegIxmi4.js → Index-x7sKx_-g.js} +1 -1
- package/dist/assets/{Invitees-NgwzSow-.js → Invitees-BxuG6kQr.js} +1 -1
- package/dist/assets/{List-DbcK-y-t.js → List-BUEr_gnC.js} +1 -1
- package/dist/assets/{List-DH82K9Cl.js → List-CwMVnaNc.js} +1 -1
- package/dist/assets/{List-Ct3dkNKG.js → List-LZHKCApS.js} +1 -1
- package/dist/assets/{List-CLrPT-kN.js → List-ysPPRHep.js} +1 -1
- package/dist/assets/{Main-EFI4_WpY.js → Main-aJNyHUK7.js} +1 -1
- package/dist/assets/{Navigator-BVD52E9t.js → Navigator-CI0mNoeu.js} +1 -1
- package/dist/assets/{NoTasks-BlK3V8G5.js → NoTasks-B_8tJAS4.js} +1 -1
- package/dist/assets/{NotFound-wt9jluKI.js → NotFound-CrA0fPmy.js} +1 -1
- package/dist/assets/{OAuthCallback-Cc2ZpW3o.js → OAuthCallback-C5GbVmYy.js} +1 -1
- package/dist/assets/{Pagination-BQBQ3NzG.js → Pagination-JjLsL1gO.js} +1 -1
- package/dist/assets/{ScrollList-BOdmvFnt.js → ScrollList-CNMyW1a-.js} +1 -1
- package/dist/assets/{Status-BK0cZidI.js → Status-BwiAU83d.js} +1 -1
- package/dist/assets/{Subscribe-RJi23fjC.js → Subscribe-C6ZyBPDG.js} +1 -1
- package/dist/assets/{TransportWebHID-CwxHJVqm.js → TransportWebHID-CQ69pr7N.js} +1 -1
- package/dist/assets/{VideoPlayer-DSxv2U0y.js → VideoPlayer-CyC0sOdz.js} +1 -1
- package/dist/assets/{_Uint8Array-N0T_55nr.js → _Uint8Array-Da_vqiT3.js} +1 -1
- package/dist/assets/{_baseClone-BwcB0PL4.js → _baseClone-Dsb3vjen.js} +1 -1
- package/dist/assets/{_baseIteratee-XHAnGxNR.js → _baseIteratee-C6_w1oWS.js} +1 -1
- package/dist/assets/{_initCloneObject-tDj2TPB_.js → _initCloneObject-B7rxZug-.js} +1 -1
- package/dist/assets/{add-BmCJ5AHn.js → add-Dr4TYbBU.js} +1 -1
- package/dist/assets/{all-wallets-BMaggAVu.js → all-wallets-BortO6et.js} +1 -1
- package/dist/assets/{app-store-BNe2QdS-.js → app-store-D34P5zne.js} +1 -1
- package/dist/assets/{apple-GSBOpXCW.js → apple-DgpEeXmN.js} +1 -1
- package/dist/assets/{arrow-bottom-DQgBaf38.js → arrow-bottom-BjIppeTp.js} +1 -1
- package/dist/assets/{arrow-bottom-circle-Co-Cc4eP.js → arrow-bottom-circle-i3qJBV_k.js} +1 -1
- package/dist/assets/{arrow-left-yJhYPJiF.js → arrow-left-COKkWzT3.js} +1 -1
- package/dist/assets/{arrow-right-Bxe4K9CT.js → arrow-right-BtmbTuOM.js} +1 -1
- package/dist/assets/{arrow-top-DTfjrPUA.js → arrow-top-D_DML2V1.js} +1 -1
- package/dist/assets/{avatar-BEtk-MBk.js → avatar-4AJ44J6g.js} +1 -1
- package/dist/assets/{bank-IrDNH4Wv.js → bank-BlsbOq3Y.js} +1 -1
- package/dist/assets/{basic-DTuXQa-m.js → basic-DocQs29a.js} +1 -1
- package/dist/assets/{browser-B3yfGOcx.js → browser-ZeNLva4Y.js} +1 -1
- package/dist/assets/{byokCredential-BZ2Y4dye.js → byokCredential-LM4PPMLA.js} +1 -1
- package/dist/assets/{card-jXGC8YLC.js → card-CDccl91u.js} +1 -1
- package/dist/assets/{castArray-TZ33WRsR.js → castArray-sgexmJJM.js} +1 -1
- package/dist/assets/{chat-CyrtdlX6.js → chat-C7lnh45_.js} +1 -1
- package/dist/assets/{checkmark-BmdSZKG_.js → checkmark-AKkyu6eV.js} +1 -1
- package/dist/assets/{checkmark-bold-CUGEUhjP.js → checkmark-bold-BOe0-_Tp.js} +1 -1
- package/dist/assets/{chevron-bottom-BpetabXJ.js → chevron-bottom-GOXhpAMT.js} +1 -1
- package/dist/assets/{chevron-left-pIFYUyj2.js → chevron-left-BfIgKINd.js} +1 -1
- package/dist/assets/{chevron-right-BoIuZKwL.js → chevron-right-B3a7HK4V.js} +1 -1
- package/dist/assets/{chevron-top-BMCi4wbV.js → chevron-top-BU7NTgef.js} +1 -1
- package/dist/assets/{chrome-store-C05bjDs6.js → chrome-store-B6IgPaPA.js} +1 -1
- package/dist/assets/{clock-Hmcd3BlP.js → clock-BSnH9Zey.js} +1 -1
- package/dist/assets/{close-DvxRBNWj.js → close-BtnkKx8y.js} +1 -1
- package/dist/assets/{coinPlaceholder-BkD_Felt.js → coinPlaceholder-oT3R1ojC.js} +1 -1
- package/dist/assets/{compass-xm7qbm3A.js → compass-62i_rfoH.js} +1 -1
- package/dist/assets/{copy-CxcFJpLy.js → copy-DIiIUMV4.js} +1 -1
- package/dist/assets/{cursor-D_EWenm6.js → cursor-fxL9OU5j.js} +1 -1
- package/dist/assets/{cursor-transparent-CawHHO7v.js → cursor-transparent-BzliFkzF.js} +1 -1
- package/dist/assets/{debounce-BoQ8giFp.js → debounce-BtB3XX1D.js} +1 -1
- package/dist/assets/{desktop-CN1hqahl.js → desktop-l1LQ6WHW.js} +1 -1
- package/dist/assets/{disconnect-ByXeDEcO.js → disconnect-CqxaNx_L.js} +1 -1
- package/dist/assets/{discord-CxFfALNx.js → discord-Ch-AUzCs.js} +1 -1
- package/dist/assets/{distribution-fie-dLT7.js → distribution-D9TxQCLE.js} +1 -1
- package/dist/assets/{dropdown-DGJBMTF2.js → dropdown-nUHjEWRr.js} +1 -1
- package/dist/assets/{etherscan-C6-upWeC.js → etherscan-B9fFf-AI.js} +1 -1
- package/dist/assets/{exclamation-triangle-CrtAEWxS.js → exclamation-triangle-B1n7jBys.js} +1 -1
- package/dist/assets/{extension-b9nXYdIG.js → extension-DvGyfMCw.js} +1 -1
- package/dist/assets/{external-link-Clo4A5LX.js → external-link-BAd4XX26.js} +1 -1
- package/dist/assets/{facebook-D7yy160o.js → facebook-CaSAzvMl.js} +1 -1
- package/dist/assets/{farcaster-CiBddthx.js → farcaster-Bo12Dm1o.js} +1 -1
- package/dist/assets/{filters-BxzUxZtp.js → filters-BjISJiXg.js} +1 -1
- package/dist/assets/{flux-DWxe5u7p.js → flux-4O5pkFPr.js} +1 -1
- package/dist/assets/{github-CGB4btsg.js → github-BI8CAE6U.js} +1 -1
- package/dist/assets/{google-oncCjLcw.js → google-zQpuoZrM.js} +1 -1
- package/dist/assets/{hailuo-BskLrKef.js → hailuo-D-sJgJyL.js} +1 -1
- package/dist/assets/{headshots-BhqzyB6i.js → headshots-BcBdqxSM.js} +1 -1
- package/dist/assets/{help-circle-LZmjh0Gd.js → help-circle-D70y2Bg2.js} +1 -1
- package/dist/assets/{id-4SKRV957.js → id-DAcT8LG2.js} +1 -1
- package/dist/assets/{image-CNjRF2jE.js → image-BsbEq4Id.js} +1 -1
- package/dist/assets/{index-C5kqqCCT.js → index-0W4qCO6a.js} +1 -1
- package/dist/assets/{index-BcCQp_c3.js → index-1GgtHP5g.js} +1 -1
- package/dist/assets/{index-B6Y0SQpt.js → index-2WVcjXan.js} +1 -1
- package/dist/assets/{index-LpK1B2b8.js → index-5qdWgHXM.js} +1 -1
- package/dist/assets/{index-DIE1ivW7.js → index-99HWYUxb.js} +1 -1
- package/dist/assets/{index-CsFqZQ2K.js → index-9wx-I1gv.js} +1 -1
- package/dist/assets/{index-i_lwvGy0.js → index-B-0WiowJ.js} +1 -1
- package/dist/assets/{index-CN-ebvOL.js → index-B19FDZiy.js} +1 -1
- package/dist/assets/{index-s9dWwz6p.js → index-B746jP2g.js} +1 -1
- package/dist/assets/{index-Dy1HS0SX.js → index-B8q3-kNF.js} +1 -1
- package/dist/assets/{index-pvvyioHi.js → index-BAqkNY8N.js} +1 -1
- package/dist/assets/{index-E-pTxr2w.js → index-BGE3XMjI.js} +1 -1
- package/dist/assets/{index-CaFKS5U_.js → index-BGqLjxEX.js} +1 -1
- package/dist/assets/{index-K-A1x_Lb.js → index-BTvg_L_n.js} +4 -4
- package/dist/assets/{index-Clo7m7_9.js → index-BXyXVF80.js} +1 -1
- package/dist/assets/{index-DVA_w_4k.js → index-BiBBOINV.js} +1 -1
- package/dist/assets/{index-CZFv6ihm.js → index-BlinnLLp.js} +1 -1
- package/dist/assets/{index-ClBZflee.js → index-BmL1MyF-.js} +2 -2
- package/dist/assets/{index-DsEvRN70.js → index-BqqUL9Tn.js} +1 -1
- package/dist/assets/{index-DRtEmACc.js → index-BtJwIQyF.js} +1 -1
- package/dist/assets/{index-CAdvClb7.js → index-Bv4Pupd8.js} +1 -1
- package/dist/assets/{index-DAxGqvuJ.js → index-BwlI8FGx.js} +6 -6
- package/dist/assets/{index-CQn0Y58v.js → index-By4y0Ea8.js} +1 -1
- package/dist/assets/{index-Ddq_rUF-.js → index-Bysd3ijL.js} +1 -1
- package/dist/assets/{index-BMeAE24J.js → index-C1iSHrky.js} +3 -3
- package/dist/assets/index-C3K3RvIl.js +1 -0
- package/dist/assets/{index-T-eH6jtW.js → index-C57GzdVx.js} +1 -1
- package/dist/assets/{index-CPHCcW8_.js → index-CEicbmg3.js} +1 -1
- package/dist/assets/{index-5Z-2Lig9.js → index-CHsUWop8.js} +1 -1
- package/dist/assets/{index-2_x9nXmz.js → index-CJFJbQzF.js} +1 -1
- package/dist/assets/{index-CEd7Pib2.js → index-CXPR2QIy.js} +1 -1
- package/dist/assets/{index-a0lFEc5-.js → index-CXtdvASY.js} +1 -1
- package/dist/assets/{index-nE07xhon.js → index-CgOzK-R6.js} +1 -1
- package/dist/assets/{index-BhBthUc5.js → index-Cn69_ppM.js} +1 -1
- package/dist/assets/{index-DuTCoQaq.js → index-Cnf415Z-.js} +1 -1
- package/dist/assets/{index-DB2UiVI-.js → index-Cnjk17Rs.js} +1 -1
- package/dist/assets/{index-CZPOGXm_.js → index-CnyI-9ke.js} +1 -1
- package/dist/assets/{index-D5WX4zHQ.js → index-CscVjjf9.js} +1 -1
- package/dist/assets/{index-B_rVcvK-.js → index-Cw3EBxXH.js} +1 -1
- package/dist/assets/{index-DldaA7y3.js → index-CwY5STPL.js} +1 -1
- package/dist/assets/{index-C1Ozn3PM.js → index-CzfGQRqg.js} +1 -1
- package/dist/assets/{index-DgVCWKRA.js → index-D1b4Yn1r.js} +1 -1
- package/dist/assets/{index-CFIovmns.js → index-DACKFQD5.js} +1 -1
- package/dist/assets/{index-DK1FH5Yw.js → index-DB3i_DbK.js} +1 -1
- package/dist/assets/{index-D1aezVOA.js → index-DJS_zzBs.js} +1 -1
- package/dist/assets/{index-Cn4zrk5d.js → index-DLBKmIKE.js} +1 -1
- package/dist/assets/{index-BE2t5XJ3.js → index-DNJwK1n1.js} +1 -1
- package/dist/assets/{index-DWy-gMk1.js → index-DNKZsQnB.js} +1 -1
- package/dist/assets/{index-DEVAP8QN.css → index-DPToRbcZ.css} +1 -1
- package/dist/assets/{index-CFb8SN9I.js → index-DQNtbo_T.js} +1 -1
- package/dist/assets/{index-cozX41Iv.js → index-DTZYdJGU.js} +1 -1
- package/dist/assets/{index-GRkPjsov.js → index-DlkJHBCX.js} +1 -1
- package/dist/assets/{index-DquOwAmU.js → index-DqzP-ZX_.js} +1 -1
- package/dist/assets/{index-kYTygPjY.js → index-Dxaf2Ps6.js} +1 -1
- package/dist/assets/{index-BTWEiU3z.js → index-FqX9ua0G.js} +1 -1
- package/dist/assets/{index-BDSn_6IF.js → index-OwSfCcsZ.js} +1 -1
- package/dist/assets/{index-rhRl-U8z.js → index-W4oQZqHB.js} +1 -1
- package/dist/assets/{index-C7yII_0D.js → index-XfPFkNIm.js} +1 -1
- package/dist/assets/{index-jBL3EQhc.js → index-jfvp7-lT.js} +1 -1
- package/dist/assets/{index-i-jBnQaf.js → index-n2cN5GL-.js} +1 -1
- package/dist/assets/{index-6uHdLaGe.js → index-roH260pR.js} +1 -1
- package/dist/assets/{index-CqG7Krgt.js → index-vu9HmTZ2.js} +1 -1
- package/dist/assets/{index.browser.esm-Bpaw2clE.js → index.browser.esm-BUOM0pe_.js} +1 -1
- package/dist/assets/{index.es-C0kXnOm7.js → index.es-Cvem-v2q.js} +1 -1
- package/dist/assets/{info-CMes9e-8.js → info-Cf_h-VQJ.js} +1 -1
- package/dist/assets/{info-circle-DV-M0-Ya.js → info-circle-CnTerd-e.js} +1 -1
- package/dist/assets/{isEqual-BGDCZ_eB.js → isEqual-fp9TwbCC.js} +1 -1
- package/dist/assets/{isPlainObject-Dt9Ed1u0.js → isPlainObject-C1efrjxP.js} +1 -1
- package/dist/assets/{kling-yF08dkZ7.js → kling-BvhmZ-mV.js} +1 -1
- package/dist/assets/{lightbulb-BffVjjz9.js → lightbulb-BF2-lWWP.js} +1 -1
- package/dist/assets/{luma-DJ4nvDEj.js → luma-Bl_bGzWM.js} +1 -1
- package/dist/assets/{mail-BZhL4xNw.js → mail-Cy9Ez5Uf.js} +1 -1
- package/dist/assets/{midjourney-DewB0iLH.js → midjourney-dJtTP99n.js} +1 -1
- package/dist/assets/{mobile-DrS-zzTT.js → mobile-DjCMECAC.js} +1 -1
- package/dist/assets/{more-CTfxV_BP.js → more-BWs0qzFL.js} +1 -1
- package/dist/assets/{nanobanana-CgfIDyfU.js → nanobanana-DjYZNwPp.js} +1 -1
- package/dist/assets/{network-placeholder-CzL1Rzdq.js → network-placeholder-CQwFNKQx.js} +1 -1
- package/dist/assets/{nftPlaceholder-KtW0WUUl.js → nftPlaceholder-B7nDsnkA.js} +1 -1
- package/dist/assets/{off-CMgdqz9A.js → off-_H9OypWo.js} +1 -1
- package/dist/assets/{openaiimage-DYXoisUt.js → openaiimage-BOfDXi6k.js} +1 -1
- package/dist/assets/{order-Brksls1w.js → order-g7XgfUHq.js} +1 -1
- package/dist/assets/{pika-C4eudUPH.js → pika-FXVe4OtC.js} +1 -1
- package/dist/assets/{pixverse-BsRvoD3G.js → pixverse-BvzWkLLY.js} +1 -1
- package/dist/assets/{play-store-BetLVqXI.js → play-store-C5xYJOJ-.js} +1 -1
- package/dist/assets/{plus-h51o-TYa.js → plus-C8ArTLk0.js} +1 -1
- package/dist/assets/{price-FDYmLMb0.js → price-BPDhJHTb.js} +1 -1
- package/dist/assets/{producer-Cap-WKOP.js → producer-CnioodzT.js} +1 -1
- package/dist/assets/{qr-code-Cv6GYLnY.js → qr-code--A19SFTN.js} +1 -1
- package/dist/assets/{qrart-BMpfvrCE.js → qrart-B6fOXLel.js} +1 -1
- package/dist/assets/{recycle-horizontal-N8Ba7Lga.js → recycle-horizontal-IHjLzwkN.js} +1 -1
- package/dist/assets/{refresh-CX_tbKi2.js → refresh-BuwIqBjA.js} +1 -1
- package/dist/assets/{reown-logo-owsGFkz6.js → reown-logo-DMSOJA9f.js} +1 -1
- package/dist/assets/{search-XEa0GHTr.js → search-DA6MRiW9.js} +1 -1
- package/dist/assets/{secp256k1-BtcoReqQ.js → secp256k1-C3mgkRzr.js} +1 -1
- package/dist/assets/{secp256k1-CLrBZvjf.js → secp256k1-N2qIipFO.js} +1 -1
- package/dist/assets/{seedance-HnBeU2KD.js → seedance-BQf3IgJ4.js} +1 -1
- package/dist/assets/{seedream-Cf0AQdb6.js → seedream-C0UjLWbl.js} +1 -1
- package/dist/assets/{send-D4lsn-4k.js → send-DdZfY6cA.js} +1 -1
- package/dist/assets/{service-CElsavN1.js → service-CJVkCidP.js} +1 -1
- package/dist/assets/{solana-wallets-CCeduR-e.js → solana-wallets-d5YCaO4R.js} +2 -2
- package/dist/assets/{solana-wallets-vue-BeoPkhek.js → solana-wallets-vue-VEVQZFPr.js} +1 -1
- package/dist/assets/{solanaEmbed.esm-DO77ZzCH.js → solanaEmbed.esm-K3d78-C6.js} +1 -1
- package/dist/assets/{sora-CowQfXh2.js → sora-DuM4FFgd.js} +1 -1
- package/dist/assets/{string_decoder-DpNonnXi.js → string_decoder-BRoXwm1E.js} +1 -1
- package/dist/assets/subsite-BCz3Wag4.js +1 -0
- package/dist/assets/subsite-v6NfIAE5.js +1 -0
- package/dist/assets/{suno-CyiWYrWc.js → suno-Xr1W14Ww.js} +1 -1
- package/dist/assets/{swapHorizontal-CSzRXSQt.js → swapHorizontal-BfA1R464.js} +1 -1
- package/dist/assets/{swapHorizontalBold-D3EkbKsA.js → swapHorizontalBold-DAVj4x-N.js} +1 -1
- package/dist/assets/{swapHorizontalMedium-Dkt9CPnM.js → swapHorizontalMedium-CvEN8oWW.js} +1 -1
- package/dist/assets/{swapHorizontalRoundedBold-Cn318a3F.js → swapHorizontalRoundedBold--967_VGm.js} +1 -1
- package/dist/assets/{swapVertical-D6LdiLOT.js → swapVertical-CDrNKJWm.js} +1 -1
- package/dist/assets/{telegram-nGwvLBrP.js → telegram-CMO8i--N.js} +1 -1
- package/dist/assets/{three-dots-CtNqWC3S.js → three-dots-xtokknS_.js} +1 -1
- package/dist/assets/{twitch-BW7B_ZZj.js → twitch-DqMCtE_b.js} +1 -1
- package/dist/assets/{twitterIcon-DtBlCqIp.js → twitterIcon-CKLI6Pga.js} +1 -1
- package/dist/assets/{typescript-BNlpYnfV.js → typescript-BqvehGHf.js} +1 -1
- package/dist/assets/{use-form-item-DD9zRA7f.js → use-form-item-DGwoVBkX.js} +1 -1
- package/dist/assets/validator-DSbDxG8s.js +1 -0
- package/dist/assets/{veo-CUb_kjJP.js → veo-b6Q6DvmW.js} +1 -1
- package/dist/assets/{verify-CE9qreJi.js → verify-BxICN3BP.js} +1 -1
- package/dist/assets/{verify-filled-CJk81dtg.js → verify-filled-Bh_nhymH.js} +1 -1
- package/dist/assets/{w3m-modal-DJ3jVfIb.js → w3m-modal-CNn-hDrM.js} +1 -1
- package/dist/assets/{wallet-CdP10wfj.js → wallet-BGyxX1lz.js} +1 -1
- package/dist/assets/{wallet-placeholder-4KSF2qxu.js → wallet-placeholder-mSwWkMEf.js} +1 -1
- package/dist/assets/{walletconnect-W__jCknZ.js → walletconnect-CKtnpQG0.js} +1 -1
- package/dist/assets/{wan-D_OsnfOs.js → wan-Ce_jHAZX.js} +1 -1
- package/dist/assets/{warning-circle-BsHgwnar.js → warning-circle-Ddgrc772.js} +1 -1
- package/dist/assets/{web-CdxNM2v5.js → web-B04rv1-e.js} +1 -1
- package/dist/assets/{web-Bjdieo1L.js → web-BmWN-hCk.js} +1 -1
- package/dist/assets/{x-JbCikOce.js → x-CjFA9Mm4.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/Index-BxLCgj_e.css +0 -1
- package/dist/assets/Index-L3cPT95P.js +0 -1
- package/dist/assets/index-DnslJSug.js +0 -1
- package/dist/assets/subsite-BYqXQYsJ.js +0 -1
- package/dist/assets/subsite-a5yzcXHF.js +0 -1
- package/dist/assets/validator-C3cLF2Ca.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as Oi,a as ko}from"./vendor-dayjs-Cvgzdobq.js";import{e6 as qa}from"./index-K-A1x_Lb.js";import{E as vo}from"./index-CVHPJfCy.js";var Qn={},Lr={},ks;function Da(){if(ks)return Lr;ks=1,Lr.byteLength=u,Lr.toByteArray=v,Lr.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 Lr}var Jr={};var vs;function Wa(){return vs||(vs=1,Jr.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)},Jr.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}),Jr}var Ss;function Ni(){return Ss||(Ss=1,(function(n){const t=Da(),e=Wa(),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,j=Math.min(x,O);K<j;++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 j=h[x];if(xe(j,Uint8Array))K+j.length>O.length?(u.isBuffer(j)||(j=u.from(j)),j.copy(O,K)):Uint8Array.prototype.set.call(O,j,K);else if(u.isBuffer(j))j.copy(O,K);else throw new TypeError('"list" argument must be an Array of Buffers');K+=j.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 j=K-O,pt=x-d;const dt=Math.min(j,pt),lt=this.slice(O,K),Tt=h.slice(d,x);for(let ht=0;ht<dt;++ht)if(lt[ht]!==Tt[ht]){j=lt[ht],pt=Tt[ht];break}return j<pt?-1:pt<j?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,j=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,j/=2,pt/=2,d/=2}function dt(Tt,ht){return K===1?Tt[ht]:Tt.readUInt16BE(ht*K)}let lt;if(O){let Tt=-1;for(lt=d;lt<j;lt++)if(dt(m,lt)===dt(h,Tt===-1?0:lt-Tt)){if(Tt===-1&&(Tt=lt),lt-Tt+1===pt)return Tt*K}else Tt!==-1&&(lt-=lt-Tt),Tt=-1}else for(d+pt>j&&(d=j-pt),lt=d;lt>=0;lt--){let Tt=!0;for(let ht=0;ht<pt;ht++)if(dt(m,lt+ht)!==dt(h,ht)){Tt=!1;break}if(Tt)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 j;for(j=0;j<x;++j){const pt=parseInt(h.substr(j*2,2),16);if(Lt(pt))return j;m[d+j]=pt}return j}function C(m,h,d,x){return Mt(Pt(h,m.length-d),m,d,x)}function U(m,h,d,x){return Mt(Ft(h),m,d,x)}function D(m,h,d,x){return Mt(Ct(h),m,d,x)}function V(m,h,d,x){return Mt(Xr(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 j=!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(j)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),j=!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 j=null,pt=K>239?4:K>223?3:K>191?2:1;if(O+pt<=d){let dt,lt,Tt,ht;switch(pt){case 1:K<128&&(j=K);break;case 2:dt=m[O+1],(dt&192)===128&&(ht=(K&31)<<6|dt&63,ht>127&&(j=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)&&(j=ht));break;case 4:dt=m[O+1],lt=m[O+2],Tt=m[O+3],(dt&192)===128&&(lt&192)===128&&(Tt&192)===128&&(ht=(K&15)<<18|(dt&63)<<12|(lt&63)<<6|Tt&63,ht>65535&&ht<1114112&&(j=ht))}}j===null?(j=65533,pt=1):j>65535&&(j-=65536,x.push(j>>>10&1023|55296),j=56320|j&1023),x.push(j),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,j=0;for(;++j<d&&(K*=256);)O+=this[h+j]*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)&&_t(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)&&_t(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,j=0;for(;++j<d&&(K*=256);)O+=this[h+j]*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,j=this[h+--O];for(;O>0&&(K*=256);)j+=this[h+--O]*K;return K*=128,j>=K&&(j-=Math.pow(2,8*d)),j},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)&&_t(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)&&_t(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,j=0;for(this[d]=h&255;++j<x&&(K*=256);)this[d+j]=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,j=1;for(this[d+K]=h&255;--K>=0&&(j*=256);)this[d+K]=h/j&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){At(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 j=Number(h>>BigInt(32)&BigInt(4294967295));return m[d++]=j,j=j>>8,m[d++]=j,j=j>>8,m[d++]=j,j=j>>8,m[d++]=j,d}function w(m,h,d,x,O){At(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 j=Number(h>>BigInt(32)&BigInt(4294967295));return m[d+3]=j,j=j>>8,m[d+2]=j,j=j>>8,m[d+1]=j,j=j>>8,m[d]=j,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,j=1,pt=0;for(this[d]=h&255;++K<x&&(j*=256);)h<0&&pt===0&&this[d+K-1]!==0&&(pt=1),this[d+K]=(h/j>>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,j=1,pt=0;for(this[d+K]=h&255;--K>=0&&(j*=256);)h<0&&pt===0&&this[d+K+1]!==0&&(pt=1),this[d+K]=(h/j>>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 G(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 G(this,h,d,!0,x)},u.prototype.writeDoubleBE=function(h,d,x){return G(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 j=h.charCodeAt(0);(O==="utf8"&&j<128||O==="latin1")&&(h=j)}}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 j=u.isBuffer(h)?h:u.from(h,O),pt=j.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]=j[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 St(m,h,d){Ie(h,"offset"),(m[h]===void 0||m[h+d]===void 0)&&_t(h,m.length-(d+1))}function At(m,h,d,x,O,K){if(m>d||m<h){const j=typeof h=="bigint"?"n":"";let pt;throw h===0||h===BigInt(0)?pt=`>= 0${j} and < 2${j} ** ${(K+1)*8}${j}`:pt=`>= -(2${j} ** ${(K+1)*8-1}${j}) and < 2 ** ${(K+1)*8-1}${j}`,new rt.ERR_OUT_OF_RANGE("value",pt,m)}St(x,O,K)}function Ie(m,h){if(typeof m!="number")throw new rt.ERR_INVALID_ARG_TYPE(h,"number",m)}function _t(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 Yr(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 j=0;j<x;++j){if(d=m.charCodeAt(j),d>55295&&d<57344){if(!O){if(d>56319){(h-=3)>-1&&K.push(239,191,189);continue}else if(j+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 Xr(m,h){let d,x,O;const K=[];for(let j=0;j<m.length&&!((h-=2)<0);++j)d=m.charCodeAt(j),x=d>>8,O=d%256,K.push(O),K.push(x);return K}function Ct(m){return t.toByteArray(Yr(m))}function Mt(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")}})(Qn)),Qn}var ft=Ni();const pr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Wr(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Nr(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function He(n,...t){if(!Wr(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 So(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Nr(n.outputLen),Nr(n.blockLen)}function Er(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 xo(n,t){He(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function $a(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function tr(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function ti(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Me(n,t){return n<<32-t|n>>>t}const Va=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ha(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}function ja(n){for(let t=0;t<n.length;t++)n[t]=Ha(n[t]);return n}const xs=Va?n=>n:ja,Eo=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ga=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function or(n){if(He(n),Eo)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Ga[n[e]];return t}const ze={_0:48,_9:57,A:65,F:70,a:97,f:102};function Es(n){if(n>=ze._0&&n<=ze._9)return n-ze._0;if(n>=ze.A&&n<=ze.F)return n-(ze.A-10);if(n>=ze.a&&n<=ze.f)return n-(ze.a-10)}function hn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(Eo)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=Es(n.charCodeAt(i)),u=Es(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 Za(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function vn(n){return typeof n=="string"&&(n=Za(n)),He(n),n}function Pe(...n){let t=0;for(let r=0;r<n.length;r++){const s=n[r];He(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 Fi{}function zi(n){const t=r=>n().update(vn(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Ki(n=32){if(pr&&typeof pr.getRandomValues=="function")return pr.getRandomValues(new Uint8Array(n));if(pr&&typeof pr.randomBytes=="function")return Uint8Array.from(pr.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function Ya(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 Xa(n,t,e){return n&t^~n&e}function Ja(n,t,e){return n&t^n&e^t&e}class Io extends Fi{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=ti(this.buffer)}update(t){Er(this),t=vn(t),He(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=ti(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){Er(this),xo(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;e[o++]=128,tr(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let P=o;P<s;P++)e[P]=0;Ya(r,s-8,BigInt(this.length*8),i),this.process(r,0);const u=ti(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 je=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]),Qr=BigInt(2**32-1),Is=BigInt(32);function Qa(n,t=!1){return t?{h:Number(n&Qr),l:Number(n>>Is&Qr)}:{h:Number(n>>Is&Qr)|0,l:Number(n&Qr)|0}}function Ao(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}=Qa(n[i],t);[r[i],s[i]]=[o,u]}return[r,s]}const As=(n,t,e)=>n>>>e,_s=(n,t,e)=>n<<32-e|t>>>e,gr=(n,t,e)=>n>>>e|t<<32-e,yr=(n,t,e)=>n<<32-e|t>>>e,tn=(n,t,e)=>n<<64-e|t>>>e-32,en=(n,t,e)=>n>>>e-32|t<<64-e,tc=(n,t,e)=>n<<e|t>>>32-e,ec=(n,t,e)=>t<<e|n>>>32-e,rc=(n,t,e)=>t<<e-32|n>>>64-e,nc=(n,t,e)=>n<<e-32|t>>>64-e;function Ke(n,t,e,r){const s=(t>>>0)+(r>>>0);return{h:n+e+(s/2**32|0)|0,l:s|0}}const ic=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),sc=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,oc=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),ac=(n,t,e,r,s)=>t+e+r+s+(n/2**32|0)|0,cc=(n,t,e,r,s)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(s>>>0),uc=(n,t,e,r,s,i)=>t+e+r+s+i+(n/2**32|0)|0,fc=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]),Ge=new Uint32Array(64);class hc extends Io{constructor(t=32){super(64,t,8,!1),this.A=je[0]|0,this.B=je[1]|0,this.C=je[2]|0,this.D=je[3]|0,this.E=je[4]|0,this.F=je[5]|0,this.G=je[6]|0,this.H=je[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)Ge[P]=t.getUint32(e,!1);for(let P=16;P<64;P++){const _=Ge[P-15],S=Ge[P-2],T=Me(_,7)^Me(_,18)^_>>>3,M=Me(S,17)^Me(S,19)^S>>>10;Ge[P]=M+Ge[P-7]+T+Ge[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 _=Me(u,6)^Me(u,11)^Me(u,25),S=B+_+Xa(u,p,v)+fc[P]+Ge[P]|0,M=(Me(r,2)^Me(r,13)^Me(r,22))+Ja(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(){tr(Ge)}destroy(){this.set(0,0,0,0,0,0,0,0),tr(this.buffer)}}const _o=Ao(["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))),lc=_o[0],dc=_o[1],Ze=new Uint32Array(80),Ye=new Uint32Array(80);class pc extends Io{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)Ze[$]=t.getUint32(e),Ye[$]=t.getUint32(e+=4);for(let $=16;$<80;$++){const Y=Ze[$-15]|0,X=Ye[$-15]|0,Q=gr(Y,X,1)^gr(Y,X,8)^As(Y,X,7),ct=yr(Y,X,1)^yr(Y,X,8)^_s(Y,X,7),ot=Ze[$-2]|0,C=Ye[$-2]|0,U=gr(ot,C,19)^tn(ot,C,61)^As(ot,C,6),D=yr(ot,C,19)^en(ot,C,61)^_s(ot,C,6),V=oc(ct,D,Ye[$-7],Ye[$-16]),y=ac(V,Q,U,Ze[$-7],Ze[$-16]);Ze[$]=y|0,Ye[$]=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=gr(P,_,14)^gr(P,_,18)^tn(P,_,41),X=yr(P,_,14)^yr(P,_,18)^en(P,_,41),Q=P&S^~P&M,ct=_&T^~_&N,ot=cc(H,X,ct,dc[$],Ye[$]),C=uc(ot,F,Y,Q,lc[$],Ze[$]),U=ot|0,D=gr(r,s,28)^tn(r,s,34)^tn(r,s,39),V=yr(r,s,28)^en(r,s,34)^en(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:_}=Ke(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=ic(U,V,a);r=sc(l,C,D,y),s=l|0}({h:r,l:s}=Ke(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ke(this.Bh|0,this.Bl|0,i|0,o|0),{h:u,l:p}=Ke(this.Ch|0,this.Cl|0,u|0,p|0),{h:v,l:B}=Ke(this.Dh|0,this.Dl|0,v|0,B|0),{h:P,l:_}=Ke(this.Eh|0,this.El|0,P|0,_|0),{h:S,l:T}=Ke(this.Fh|0,this.Fl|0,S|0,T|0),{h:M,l:N}=Ke(this.Gh|0,this.Gl|0,M|0,N|0),{h:F,l:H}=Ke(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(){tr(Ze,Ye)}destroy(){tr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Bo=zi(()=>new hc),gc=zi(()=>new pc);const qi=BigInt(0),Ai=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=Wr(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 rn(n){const t=n.toString(16);return t.length&1?"0"+t:t}function Ro(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?qi:BigInt("0x"+n)}function Sn(n){return Ro(or(n))}function Fr(n){return He(n),Ro(or(Uint8Array.from(n).reverse()))}function Di(n,t){return hn(n.toString(16).padStart(t*2,"0"))}function Mo(n,t){return Di(n,t).reverse()}function Dt(n,t,e){let r;if(typeof t=="string")try{r=hn(t)}catch(i){throw new Error(n+" must be hex string or Uint8Array, cause: "+i)}else if(Wr(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 Bs(n){return Uint8Array.from(n)}const ei=n=>typeof n=="bigint"&&qi<=n;function yc(n,t,e){return ei(n)&&ei(t)&&ei(e)&&t<=n&&n<e}function _i(n,t,e,r){if(!yc(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function To(n){let t;for(t=0;n>qi;n>>=Ai,t+=1);return t}const $r=n=>(Ai<<BigInt(n))-Ai;function mc(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 Pe(...T)};return(S,T)=>{p(),B(S);let M;for(;!(M=T(P()));)B();return p(),M}}function Vr(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 ln(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),rr=BigInt(2),Po=BigInt(3),Lo=BigInt(4),Co=BigInt(5),wc=BigInt(7),Uo=BigInt(8),bc=BigInt(9),Oo=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 Rs(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 Wi(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function No(n,t){const e=(n.ORDER+de)/Lo,r=n.pow(t,e);return Wi(n,r,t),r}function kc(n,t){const e=(n.ORDER-Co)/Uo,r=n.mul(t,rr),s=n.pow(r,e),i=n.mul(t,s),o=n.mul(n.mul(i,rr),s),u=n.mul(i,n.sub(o,n.ONE));return Wi(n,u,t),u}function vc(n){const t=fr(n),e=Fo(n),r=e(t,t.neg(t.ONE)),s=e(t,r),i=e(t,t.neg(r)),o=(n+wc)/Oo;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 Wi(u,N,p),N}}function Fo(n){if(n<Po)throw new Error("sqrt is not defined for small field");let t=n-de,e=0;for(;t%rr===Se;)t/=rr,e++;let r=rr;const s=fr(n);for(;Ms(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return No;let i=s.pow(r,t);const o=(t+de)/rr;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 Sc(n){return n%Lo===Po?No:n%Uo===Co?kc:n%Oo===bc?vc(n):Fo(n)}const xc=(n,t)=>(ae(n,t)&de)===de,Ec=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ic(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=Ec.reduce((r,s)=>(r[s]="function",r),t);return Vr(n,e),n}function Ac(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 zo(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)/rr,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 Ko(n,t){t!==void 0&&Nr(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function fr(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}=Ko(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:$r(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)=>Ac(P,_,S),div:(_,S)=>ae(_*Rs(S,n),n),sqrN:_=>_*_,addN:(_,S)=>_+S,subN:(_,S)=>_-S,mulN:(_,S)=>_*S,inv:_=>Rs(_,n),sqrt:i||(_=>(B||(B=Sc(n)),B(P,_))),toBytes:_=>e?Mo(_,v):Di(_,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?Fr(_):Sn(_);if(o&&(T=ae(T,n)),!S&&!P.isValid(T))throw new Error("invalid field element: outside of range 0..ORDER");return T},invertBatch:_=>zo(P,_),cmov:(_,S,T)=>T?S:_});return Object.freeze(P)}function qo(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 Do(n){const t=qo(n);return t+Math.ceil(t/2)}function _c(n,t,e=!1){const r=n.length,s=qo(t),i=Do(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=e?Fr(n):Sn(n),u=ae(o,t-de)+de;return e?Mo(u,s):Di(u,s)}const Ir=BigInt(0),nr=BigInt(1);function dn(n,t){const e=t.negate();return n?e:t}function ir(n,t){const e=zo(n.Fp,t.map(r=>r.Z));return t.map((r,s)=>n.fromAffine(r.toAffine(e[s])))}function Wo(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function ri(n,t){Wo(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),s=2**n,i=$r(n),o=BigInt(n);return{windows:e,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function Ts(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+=nr);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 Bc(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 Rc(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 ni=new WeakMap,$o=new WeakMap;function ii(n){return $o.get(n)||1}function Ps(n){if(n!==Ir)throw new Error("invalid wNAF")}class Vo{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>Ir;)e&nr&&(r=r.add(s)),s=s.double(),e>>=nr;return r}precomputeWindow(t,e){const{windows:r,windowSize:s}=ri(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=ri(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:p,offset:v,isZero:B,isNeg:P,isNegF:_,offsetF:S}=Ts(r,u,o);r=p,B?i=i.add(dn(_,e[S])):s=s.add(dn(P,e[v]))}return Ps(r),{p:s,f:i}}wNAFUnsafe(t,e,r,s=this.ZERO){const i=ri(t,this.bits);for(let o=0;o<i.windows&&r!==Ir;o++){const{nextN:u,offset:p,isZero:v,isNeg:B}=Ts(r,o,i);if(r=u,!v){const P=e[p];s=s.add(B?P.negate():P)}}return Ps(r),s}getPrecomputes(t,e,r){let s=ni.get(e);return s||(s=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(s=r(s)),ni.set(e,s))),s}cached(t,e,r){const s=ii(t);return this.wNAF(s,this.getPrecomputes(s,t,r),e)}unsafe(t,e,r,s){const i=ii(t);return i===1?this._unsafeLadder(t,e,s):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),e,s)}createCache(t,e){Wo(e,this.bits),$o.set(t,e),ni.delete(t)}hasCache(t){return ii(t)!==1}}function Mc(n,t,e,r){let s=t,i=n.ZERO,o=n.ZERO;for(;e>Ir||r>Ir;)e&nr&&(i=i.add(s)),r&nr&&(o=o.add(s)),s=s.double(),e>>=nr,r>>=nr;return{p1:i,p2:o}}function Ho(n,t,e,r){Bc(e,n),Rc(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=To(BigInt(s));let p=1;u>12?p=u-3:u>4?p=u-2:u>0&&(p=2);const v=$r(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 Ls(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Ic(t),t}else return fr(n,{isLE:e})}function jo(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>Ir))throw new Error(`CURVE.${p} must be positive bigint`)}const s=Ls(t.p,e.Fp,r),i=Ls(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 Xe=BigInt(0),ce=BigInt(1),si=BigInt(2),Tc=BigInt(8);function Pc(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 Lc(n,t={}){const e=jo("edwards",n,t,t.FpFnLE),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o}=i;Vr(t,{},{uvRatio:"function"});const u=si<<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:Xe}}});if(!Pc(r,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function B(N,F,H=!1){const $=H?ce:Xe;return _i("coordinate "+N,F,$,u),F}function P(N){if(!(N instanceof T))throw new Error("ExtendedPoint expected")}const _=ln((N,F)=>{const{X:H,Y:$,Z:Y}=N,X=N.is0();F==null&&(F=X?Tc:r.inv(Y));const Q=p(H*F),ct=p($*F),ot=r.mul(Y,F);if(X)return{x:Xe,y:ce};if(ot!==ce)throw new Error("invZ was invalid");return{x:Q,y:ct}}),S=ln(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=Bs(_e(F,$,"point")),ar(H,"zip215");const Q=Bs(F),ct=F[$-1];Q[$-1]=ct&-129;const ot=Fr(Q),C=H?u:r.ORDER;_i("point.y",ot,Xe,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===Xe&&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(si),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(si*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=>ir(T,Y));return ir(T,[H,$])[0]}multiplyUnsafe(F,H=T.ZERO){if(!s.isValid(F))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return F===Xe?T.ZERO:this.is0()||F===ce?this:M.unsafe(this,F,$=>ir(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 or(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 ir(T,F)}static msm(F,H){return Ho(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(Xe,ce,ce,Xe),T.Fp=r,T.Fn=s;const M=new Vo(T,s.BITS);return T.BASE.precompute(8),T}function Cc(n,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');Vr(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||Ki,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(Fr(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=Pe(...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=Pe(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=Fr(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 Wr(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 Uc(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=fr(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 Oc(n,t){const e=t.Point;return Object.assign({},t,{ExtendedPoint:e,CURVE:n,nBitLength:e.Fn.BITS,nByteLength:e.Fn.BYTES})}function Nc(n){const{CURVE:t,curveOpts:e,hash:r,eddsaOpts:s}=Uc(n),i=Lc(t,e),o=Cc(i,r,s);return Oc(n,o)}const Fc=BigInt(1),Cs=BigInt(2);BigInt(3);const zc=BigInt(5),Kc=BigInt(8),$i=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Go={p:$i,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Kc,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function qc(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),s=BigInt(80),i=$i,u=n*n%i*n%i,p=qt(u,Cs,i)*u%i,v=qt(p,Fc,i)*n%i,B=qt(v,zc,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,Cs,i)*n%i,b2:u}}function Dc(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const Us=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Wc(n,t){const e=$i,r=ae(t*t*t,e),s=ae(r*r*t,e),i=qc(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*Us,e),B=u===n,P=u===ae(-n,e),_=u===ae(-n*Us,e);return B&&(o=p),(P||_)&&(o=v),xc(o,e)&&(o=ae(-o,e)),{isValid:B||P,value:o}}const $c=fr(Go.p,{isLE:!0}),Vc={...Go,Fp:$c,hash:gc,adjustScalarBytes:Dc,uvRatio:Wc},Rr=Nc(Vc);var cn={exports:{}},Hc=cn.exports,Os;function Zo(){return Os||(Os=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=qa.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 G=c-z|0;k=y.words[G]|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,G=k[1]|0,rt=G&8191,st=G>>>13,kt=k[2]|0,St=kt&8191,At=kt>>>13,Ie=k[3]|0,_t=Ie&8191,Nt=Ie>>>13,Yr=k[4]|0,Pt=Yr&8191,Ft=Yr>>>13,Xr=k[5]|0,Ct=Xr&8191,Mt=Xr>>>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,j=O>>>13,pt=E[0]|0,dt=pt&8191,lt=pt>>>13,Tt=E[1]|0,ht=Tt&8191,$t=Tt>>>13,ls=E[2]|0,Vt=ls&8191,Ht=ls>>>13,ds=E[3]|0,jt=ds&8191,Gt=ds>>>13,ps=E[4]|0,Zt=ps&8191,Yt=ps>>>13,gs=E[5]|0,Xt=gs&8191,Jt=gs>>>13,ys=E[6]|0,Qt=ys&8191,te=ys>>>13,ms=E[7]|0,ee=ms&8191,re=ms>>>13,ws=E[8]|0,ne=ws&8191,ie=ws>>>13,bs=E[9]|0,se=bs&8191,oe=bs>>>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 Cn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Cn>>>26)|0,Cn&=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 Un=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Un>>>26)|0,Un&=67108863,b=Math.imul(St,dt),c=Math.imul(St,lt),c=c+Math.imul(At,dt)|0,f=Math.imul(At,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 On=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(On>>>26)|0,On&=67108863,b=Math.imul(_t,dt),c=Math.imul(_t,lt),c=c+Math.imul(Nt,dt)|0,f=Math.imul(Nt,lt),b=b+Math.imul(St,ht)|0,c=c+Math.imul(St,$t)|0,c=c+Math.imul(At,ht)|0,f=f+Math.imul(At,$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,jt)|0,c=c+Math.imul(I,Gt)|0,c=c+Math.imul(z,jt)|0,f=f+Math.imul(z,Gt)|0;var Nn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Nn>>>26)|0,Nn&=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(_t,ht)|0,c=c+Math.imul(_t,$t)|0,c=c+Math.imul(Nt,ht)|0,f=f+Math.imul(Nt,$t)|0,b=b+Math.imul(St,Vt)|0,c=c+Math.imul(St,Ht)|0,c=c+Math.imul(At,Vt)|0,f=f+Math.imul(At,Ht)|0,b=b+Math.imul(rt,jt)|0,c=c+Math.imul(rt,Gt)|0,c=c+Math.imul(st,jt)|0,f=f+Math.imul(st,Gt)|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 Fn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,b=Math.imul(Ct,dt),c=Math.imul(Ct,lt),c=c+Math.imul(Mt,dt)|0,f=Math.imul(Mt,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(_t,Vt)|0,c=c+Math.imul(_t,Ht)|0,c=c+Math.imul(Nt,Vt)|0,f=f+Math.imul(Nt,Ht)|0,b=b+Math.imul(St,jt)|0,c=c+Math.imul(St,Gt)|0,c=c+Math.imul(At,jt)|0,f=f+Math.imul(At,Gt)|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 zn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(zn>>>26)|0,zn&=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(Mt,ht)|0,f=f+Math.imul(Mt,$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(_t,jt)|0,c=c+Math.imul(_t,Gt)|0,c=c+Math.imul(Nt,jt)|0,f=f+Math.imul(Nt,Gt)|0,b=b+Math.imul(St,Zt)|0,c=c+Math.imul(St,Yt)|0,c=c+Math.imul(At,Zt)|0,f=f+Math.imul(At,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 Kn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Kn>>>26)|0,Kn&=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(Mt,Vt)|0,f=f+Math.imul(Mt,Ht)|0,b=b+Math.imul(Pt,jt)|0,c=c+Math.imul(Pt,Gt)|0,c=c+Math.imul(Ft,jt)|0,f=f+Math.imul(Ft,Gt)|0,b=b+Math.imul(_t,Zt)|0,c=c+Math.imul(_t,Yt)|0,c=c+Math.imul(Nt,Zt)|0,f=f+Math.imul(Nt,Yt)|0,b=b+Math.imul(St,Xt)|0,c=c+Math.imul(St,Jt)|0,c=c+Math.imul(At,Xt)|0,f=f+Math.imul(At,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 qn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(qn>>>26)|0,qn&=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,jt)|0,c=c+Math.imul(Ct,Gt)|0,c=c+Math.imul(Mt,jt)|0,f=f+Math.imul(Mt,Gt)|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(_t,Xt)|0,c=c+Math.imul(_t,Jt)|0,c=c+Math.imul(Nt,Xt)|0,f=f+Math.imul(Nt,Jt)|0,b=b+Math.imul(St,Qt)|0,c=c+Math.imul(St,te)|0,c=c+Math.imul(At,Qt)|0,f=f+Math.imul(At,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 Dn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,b=Math.imul(K,dt),c=Math.imul(K,lt),c=c+Math.imul(j,dt)|0,f=Math.imul(j,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,jt)|0,c=c+Math.imul(Lt,Gt)|0,c=c+Math.imul(zt,jt)|0,f=f+Math.imul(zt,Gt)|0,b=b+Math.imul(Ct,Zt)|0,c=c+Math.imul(Ct,Yt)|0,c=c+Math.imul(Mt,Zt)|0,f=f+Math.imul(Mt,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(_t,Qt)|0,c=c+Math.imul(_t,te)|0,c=c+Math.imul(Nt,Qt)|0,f=f+Math.imul(Nt,te)|0,b=b+Math.imul(St,ee)|0,c=c+Math.imul(St,re)|0,c=c+Math.imul(At,ee)|0,f=f+Math.imul(At,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 Wn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,b=Math.imul(K,ht),c=Math.imul(K,$t),c=c+Math.imul(j,ht)|0,f=Math.imul(j,$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,jt)|0,c=c+Math.imul(Kt,Gt)|0,c=c+Math.imul(m,jt)|0,f=f+Math.imul(m,Gt)|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(Mt,Xt)|0,f=f+Math.imul(Mt,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(_t,ee)|0,c=c+Math.imul(_t,re)|0,c=c+Math.imul(Nt,ee)|0,f=f+Math.imul(Nt,re)|0,b=b+Math.imul(St,ne)|0,c=c+Math.imul(St,ie)|0,c=c+Math.imul(At,ne)|0,f=f+Math.imul(At,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 $n=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+($n>>>26)|0,$n&=67108863,b=Math.imul(K,Vt),c=Math.imul(K,Ht),c=c+Math.imul(j,Vt)|0,f=Math.imul(j,Ht),b=b+Math.imul(d,jt)|0,c=c+Math.imul(d,Gt)|0,c=c+Math.imul(x,jt)|0,f=f+Math.imul(x,Gt)|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(Mt,Qt)|0,f=f+Math.imul(Mt,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(_t,ne)|0,c=c+Math.imul(_t,ie)|0,c=c+Math.imul(Nt,ne)|0,f=f+Math.imul(Nt,ie)|0,b=b+Math.imul(St,se)|0,c=c+Math.imul(St,oe)|0,c=c+Math.imul(At,se)|0,f=f+Math.imul(At,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,jt),c=Math.imul(K,Gt),c=c+Math.imul(j,jt)|0,f=Math.imul(j,Gt),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(Mt,ee)|0,f=f+Math.imul(Mt,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(_t,se)|0,c=c+Math.imul(_t,oe)|0,c=c+Math.imul(Nt,se)|0,f=f+Math.imul(Nt,oe)|0;var Hn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,b=Math.imul(K,Zt),c=Math.imul(K,Yt),c=c+Math.imul(j,Zt)|0,f=Math.imul(j,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(Mt,ne)|0,f=f+Math.imul(Mt,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 jn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(jn>>>26)|0,jn&=67108863,b=Math.imul(K,Xt),c=Math.imul(K,Jt),c=c+Math.imul(j,Xt)|0,f=Math.imul(j,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(Mt,se)|0,f=f+Math.imul(Mt,oe)|0;var Gn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,b=Math.imul(K,Qt),c=Math.imul(K,te),c=c+Math.imul(j,Qt)|0,f=Math.imul(j,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 Zn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,b=Math.imul(K,ee),c=Math.imul(K,re),c=c+Math.imul(j,ee)|0,f=Math.imul(j,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 Yn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,b=Math.imul(K,ne),c=Math.imul(K,ie),c=c+Math.imul(j,ne)|0,f=Math.imul(j,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 Xn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,b=Math.imul(K,se),c=Math.imul(K,oe),c=c+Math.imul(j,se)|0,f=Math.imul(j,oe);var Jn=(L+b|0)+((c&8191)<<13)|0;return L=(f+(c>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,A[0]=Cn,A[1]=Un,A[2]=On,A[3]=Nn,A[4]=Fn,A[5]=zn,A[6]=Kn,A[7]=qn,A[8]=Dn,A[9]=Wn,A[10]=$n,A[11]=Vn,A[12]=Hn,A[13]=jn,A[14]=Gn,A[15]=Zn,A[16]=Yn,A[17]=Xn,A[18]=Jn,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,G=z&67108863;A=A+(z/67108864|0)|0,G=G+L|0,L=G&67108863,A=A+(G>>>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,G=1;(g.words[0]&G)===0&&z<26;++z,G<<=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 G=I,rt=0;G.cmp(A)!==0;rt++)G=G.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,Hc)})(cn)),cn.exports}var jc=Zo();const Ns=Oi(jc);var nn={exports:{}};var Fs;function Yo(){return Fs||(Fs=1,(function(n,t){var e=Ni(),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)}})(nn,nn.exports)),nn.exports}var oi,zs;function Gc(){if(zs)return oi;zs=1;var n=Yo().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 oi=t,oi}var ai,Ks;function Zc(){if(Ks)return ai;Ks=1;var n=Gc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ai=n(t),ai}var Yc=Zc();const le=Oi(Yc),qs=Bo;var Et={},ci,Ds;function Xc(){if(Ds)return ci;Ds=1;var n=Yo().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 ci=t,ci}var ui,Ws;function Jc(){if(Ws)return ui;Ws=1;var n=Xc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ui=n(t),ui}function We(n,t,e){return t<=n&&n<=e}function xn(n){if(n===void 0)return{};if(n===Object(n))return n;throw TypeError("Could not convert argument to dictionary")}function Qc(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 tu(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 pn=-1;function Vi(n){this.tokens=[].slice.call(n)}Vi.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():pn},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 Ar=-1;function fi(n,t){if(n)throw TypeError("Decoder error");return t||65533}var gn="utf-8";function yn(n,t){if(!(this instanceof yn))return new yn(n,t);if(n=n!==void 0?String(n).toLowerCase():gn,n!==gn)throw new Error("Encoding not supported. Only utf-8 is supported");t=xn(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})}yn.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=xn(e),this._streaming||(this._decoder=new eu({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var s=new Vi(r),i=[],o;!s.endOfStream()&&(o=this._decoder.handler(s,s.read()),o!==Ar);)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===Ar)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),tu(i)}};function mn(n,t){if(!(this instanceof mn))return new mn(n,t);if(n=n!==void 0?String(n).toLowerCase():gn,n!==gn)throw new Error("Encoding not supported. Only utf-8 is supported");t=xn(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}mn.prototype={encode:function(t,e){t=t?String(t):"",e=xn(e),this._streaming||(this._encoder=new ru(this._options)),this._streaming=!!e.stream;for(var r=[],s=new Vi(Qc(t)),i;!s.endOfStream()&&(i=this._encoder.handler(s,s.read()),i!==Ar);)Array.isArray(i)?r.push.apply(r,i):r.push(i);if(!this._streaming){for(;i=this._encoder.handler(s,s.read()),i!==Ar;)Array.isArray(i)?r.push.apply(r,i):r.push(i);this._encoder=null}return new Uint8Array(r)}};function eu(n){var t=n.fatal,e=0,r=0,s=0,i=128,o=191;this.handler=function(u,p){if(p===pn&&s!==0)return s=0,fi(t);if(p===pn)return Ar;if(s===0){if(We(p,0,127))return p;if(We(p,194,223))s=1,e=p-192;else if(We(p,224,239))p===224&&(i=160),p===237&&(o=159),s=2,e=p-224;else if(We(p,240,244))p===240&&(i=144),p===244&&(o=143),s=3,e=p-240;else return fi(t);return e=e<<6*s,null}if(!We(p,i,o))return e=s=r=0,i=128,o=191,u.prepend(p),fi(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 ru(n){n.fatal,this.handler=function(t,e){if(e===pn)return Ar;if(We(e,0,127))return e;var r,s;We(e,128,2047)?(r=1,s=192):We(e,2048,65535)?(r=2,s=224):We(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 nu=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:yn,TextEncoder:mn},Symbol.toStringTag,{value:"Module"})),iu=ko(nu);var $s;function su(){if($s)return Et;$s=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(Jc()),u=r(iu),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 hi=su(),W={},Vs;function ou(){if(Vs)return W;Vs=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=Ni();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),G=I.readUInt32LE(w+4);return M(G,z)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeUInt32LE(z.lo32,I),G.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),G=I.readUInt32BE(w+4);return M(z,G)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeUInt32BE(z.hi32,I),G.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),G=I.readInt32LE(w+4);return M(G,z)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeUInt32LE(z.lo32,I),G.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),G=I.readUInt32BE(w+4);return M(z,G)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeInt32BE(z.hi32,I),G.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 G=0;for(;G<z;)I+=this.elementLayout.getSpan(f,w+I),++G}return I}decode(f,w=0){const I=[];let z=0,G=this.count;for(G instanceof o&&(G=G.decode(f,w));z<G;)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,G=f.reduce((rt,st)=>rt+z.encode(st,w,I+rt),0);return this.count instanceof o&&this.count.encode(f.length,w,I),G}}W.Sequence=ot;class C extends r{constructor(f,w,I){if(!(Array.isArray(f)&&f.reduce((G,rt)=>G&&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 G of f)if(0>G.span&&G.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let z=-1;try{z=f.reduce((G,rt)=>G+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,G)=>{const rt=G.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 G=0,rt=0;for(const st of this.fields){let kt=st.span;if(rt=0<kt?kt:0,st.property!==void 0){const St=f[st.property];St!==void 0&&(rt=st.encode(St,w,I),0>kt&&(kt=st.getSpan(w,I)))}G=I,I+=kt}return G+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 G=-1;w&&(G=w.span,0<=G&&(f instanceof v||f instanceof B)&&(G+=z.layout.span)),super(G,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,G=z.decode(f,w),rt=this.registry[G];if(rt===void 0){const st=this.defaultLayout;let kt=0;this.usesPrefixDiscriminator&&(kt=z.layout.span),I=this.makeDestinationObject(),I[z.property]=G,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 G=this.discriminator,rt=this.defaultLayout;let st=0;return this.usesPrefixDiscriminator&&(st=G.layout.span),G.encode(f[G.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 G=f.span;0>f.span&&(G=I?I.span:0,0<=G&&f.usesPrefixDiscriminator&&(G+=f.discriminator.layout.span)),super(G,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 G=z;if(this.layout&&(this.layout.encode(f[this.property],w,I+z),G+=this.layout.getSpan(w,I+z),0<=this.union.span&&G>this.union.span))throw new Error("encoded variant overruns containing union");return G}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(G){return z=a(G),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 G of this.fields)G.property!==void 0&&(I[G.property]=G.decode(f));return I}encode(f,w,I=0){const z=this.word.decode(w,I);this._packedSetValue(z);for(const G of this.fields)if(G.property!==void 0){const rt=f[G.property];rt!==void 0&&G.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,G=f.fields.reduce((rt,st)=>rt+st.bits,0);if(w+G>z)throw new Error("bits too long for span remainder ("+(z-G)+" of "+z+" remain)");this.container=f,this.bits=w,this.valueMask=(1<<w)-1,w===32&&(this.valueMask=4294967295),this.start=G,this.container.msb&&(this.start=z-G-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 G=e(f);return e(w).write(G.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"),G=z.length;if(I+G>w.length)throw new RangeError("encoding overruns Buffer");const rt=e(w);return z.copy(rt,I),rt[I+G]=0,G+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"),G=z.length;if(0<=this.maxSpan&&this.maxSpan<G)throw new RangeError("text length exceeds maxSpan");if(I+G>w.length)throw new RangeError("encoding overruns Buffer");return z.copy(e(w),I),G}}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=ou(),au=8078e3,cu=8078001,uu=8078004,fu=8078005,hu=8078006,lu=8078011;function Xo(n){return Array.isArray(n)?"%5B"+n.map(Xo).join("%2C%20")+"%5D":typeof n=="bigint"?`${n}n`:encodeURIComponent(String(n!=null&&Object.getPrototypeOf(n)===null?{...n}:n))}function du([n,t]){return`${n}=${Xo(t)}`}function pu(n){const t=Object.entries(n).map(du).join("&");return btoa(t)}function gu(n,t={}){{let e=`Solana error #${n}; Decode this error by running \`npx @solana/errors decode -- ${n}`;return Object.keys(t).length&&(e+=` '${pu(t)}'`),`${e}\``}}var kr=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=gu(n,e);super(s,r),this.context={__code:n,...e},this.name="SolanaError"}};function yu(n,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(n)}function mu(n){return Object.freeze({...n,encode:t=>{const e=new Uint8Array(yu(t,n));return n.write(t,e,0),e}})}function wu(n){return Object.freeze({...n,decode:(t,e=0)=>n.read(t,e)[0]})}function mr(n){return"fixedSize"in n&&typeof n.fixedSize=="number"}function bu(n,t){if(mr(n)!==mr(t))throw new kr(uu);if(mr(n)&&mr(t)&&n.fixedSize!==t.fixedSize)throw new kr(fu,{decoderFixedSize:t.fixedSize,encoderFixedSize:n.fixedSize});if(!mr(n)&&!mr(t)&&n.maxSize!==t.maxSize)throw new kr(hu,{decoderMaxSize:t.maxSize,encoderMaxSize:n.maxSize});return{...t,...n,decode:t.decode,encode:n.encode,read:t.read,write:n.write}}function ku(n,t,e=0){if(t.length-e<=0)throw new kr(au,{codecDescription:n})}function vu(n,t,e,r=0){const s=e.length-r;if(s<t)throw new kr(cu,{bytesLength:s,codecDescription:n,expected:t})}function Su(n,t,e,r){if(r<t||r>e)throw new kr(lu,{codecDescription:n,max:e,min:t,value:r})}function Jo(n){return n?.endian!==1}function xu(n){return mu({fixedSize:n.size,write(t,e,r){n.range&&Su(n.name,n.range[0],n.range[1],t);const s=new ArrayBuffer(n.size);return n.set(new DataView(s),t,Jo(n.config)),e.set(new Uint8Array(s),r),r+n.size}})}function Eu(n){return wu({fixedSize:n.size,read(t,e=0){ku(n.name,t,e),vu(n.name,n.size,t,e);const r=new DataView(Iu(t,e,n.size));return[n.get(r,Jo(n.config)),e+n.size]}})}function Iu(n,t,e){const r=n.byteOffset+(t??0),s=e??n.byteLength;return n.buffer.slice(r,r+s)}var Qo=(n={})=>xu({config:n,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}),Au=(n={})=>Eu({config:n,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}),_u=(n={})=>bu(Qo(n),Au(n));class Bu 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 Ru(n){return Hr(n)&&typeof n[Symbol.iterator]=="function"}function Hr(n){return typeof n=="object"&&n!=null}function wn(n){return Hr(n)&&!Array.isArray(n)}function Be(n){return typeof n=="symbol"?n.toString():typeof n=="string"?JSON.stringify(n):`${n}`}function Mu(n){const{done:t,value:e}=n.next();return t?void 0:e}function Tu(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*Hs(n,t,e,r){Ru(n)||(n=[n]);for(const s of n){const i=Tu(s,t,e,r);i&&(yield i)}}function*Hi(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 _=Hi(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):Hr(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 Fe=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 Hs(B,v,this,p)}:this.validator=()=>[],i?this.refiner=(p,v)=>{const B=i(p,v);return Hs(B,v,this,p)}:this.refiner=()=>[]}assert(t,e){return ta(t,this,e)}create(t,e){return et(t,this,e)}is(t){return ea(t,this)}mask(t,e){return Pu(t,this,e)}validate(t,e={}){return jr(t,this,e)}};function ta(n,t,e){const r=jr(n,t,{message:e});if(r[0])throw r[0]}function et(n,t,e){const r=jr(n,t,{coerce:!0,message:e});if(r[0])throw r[0];return r[1]}function Pu(n,t,e){const r=jr(n,t,{coerce:!0,mask:!0,message:e});if(r[0])throw r[0];return r[1]}function ea(n,t){return!jr(n,t)[0]}function jr(n,t,e={}){const r=Hi(n,t,e),s=Mu(r);return s[0]?[new Bu(s[0],function*(){for(const o of r)o[0]&&(yield o[0])}),void 0]:[void 0,s[1]]}function hr(n,t){return new Fe({type:n,schema:null,validator:t})}function Lu(){return hr("any",()=>!0)}function nt(n){return new Fe({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 Ne(){return hr("boolean",n=>typeof n=="boolean")}function ji(n){return hr("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 Fe({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 Cu(){return hr("never",()=>!1)}function it(n){return new Fe({...n,validator:(t,e)=>t===null||n.validator(t,e),refiner:(t,e)=>t===null||n.refiner(t,e)})}function q(){return hr("number",n=>typeof n=="number"&&!isNaN(n)||`Expected a number, but received: ${Be(n)}`)}function ut(n){return new Fe({...n,validator:(t,e)=>t===void 0||n.validator(t,e),refiner:(t,e)=>t===void 0||n.refiner(t,e)})}function ra(n,t){return new Fe({type:"record",schema:null,*entries(e){if(Hr(e))for(const r in e){const s=e[r];yield[r,r,n],yield[r,s,t]}},validator(e){return wn(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return wn(e)?{...e}:e}})}function J(){return hr("string",n=>typeof n=="string"||`Expected a string, but received: ${Be(n)}`)}function Gi(n){const t=Cu();return new Fe({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 Fe({type:"type",schema:n,*entries(e){if(Hr(e))for(const r of t)yield[r,e[r],n[r]]},validator(e){return wn(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return wn(e)?{...e}:e}})}function be(n){const t=n.map(e=>e.type).join(" | ");return new Fe({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]=Hi(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 Mr(){return hr("unknown",()=>!0)}function Gr(n,t,e){return new Fe({...n,coercer:(r,s)=>ea(r,t)?n.coercer(e(r,s),s):n.coercer(r,s)})}var sn,Uu=new Uint8Array(16);function na(){if(!sn&&(sn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!sn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return sn(Uu)}const Ou=/^(?:[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 En(n){return typeof n=="string"&&Ou.test(n)}var he=[];for(var li=0;li<256;++li)he.push((li+256).toString(16).substr(1));function In(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(he[n[t+0]]+he[n[t+1]]+he[n[t+2]]+he[n[t+3]]+"-"+he[n[t+4]]+he[n[t+5]]+"-"+he[n[t+6]]+he[n[t+7]]+"-"+he[n[t+8]]+he[n[t+9]]+"-"+he[n[t+10]]+he[n[t+11]]+he[n[t+12]]+he[n[t+13]]+he[n[t+14]]+he[n[t+15]]).toLowerCase();if(!En(e))throw TypeError("Stringified UUID is invalid");return e}var js,di,pi=0,gi=0;function Nu(n,t,e){var r=t&&e||0,s=t||new Array(16);n=n||{};var i=n.node||js,o=n.clockseq!==void 0?n.clockseq:di;if(i==null||o==null){var u=n.random||(n.rng||na)();i==null&&(i=js=[u[0]|1,u[1],u[2],u[3],u[4],u[5]]),o==null&&(o=di=(u[6]<<8|u[7])&16383)}var p=n.msecs!==void 0?n.msecs:Date.now(),v=n.nsecs!==void 0?n.nsecs:gi+1,B=p-pi+(v-gi)/1e4;if(B<0&&n.clockseq===void 0&&(o=o+1&16383),(B<0||p>pi)&&n.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");pi=p,gi=v,di=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||In(s)}function ia(n){if(!En(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 Fu(n){n=unescape(encodeURIComponent(n));for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e));return t}var zu="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Ku="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function sa(n,t,e){function r(s,i,o,u){if(typeof s=="string"&&(s=Fu(s)),typeof i=="string"&&(i=ia(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 In(p)}try{r.name=n}catch{}return r.DNS=zu,r.URL=Ku,r}function qu(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 Du(Wu($u(n),n.length*8))}function Du(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 oa(n){return(n+64>>>9<<4)+14+1}function Wu(n,t){n[t>>5]|=128<<t%32,n[oa(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 $u(n){if(n.length===0)return[];for(var t=n.length*8,e=new Uint32Array(oa(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 Vu(n,t){return n<<t|n>>>32-t}function An(n,t,e,r,s,i){return Je(Vu(Je(Je(t,n),Je(r,i)),s),e)}function ge(n,t,e,r,s,i,o){return An(t&e|~t&r,n,t,s,i,o)}function ye(n,t,e,r,s,i,o){return An(t&r|e&~r,n,t,s,i,o)}function me(n,t,e,r,s,i,o){return An(t^e^r,n,t,s,i,o)}function we(n,t,e,r,s,i,o){return An(e^(t|~r),n,t,s,i,o)}var Hu=sa("v3",48,qu);function ju(n,t,e){n=n||{};var r=n.random||(n.rng||na)();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 In(r)}function Gu(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 yi(n,t){return n<<t|n>>>32-t}function Zu(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]=yi(_[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=yi(M,5)+Gu(X,N,F,H)+$+t[X]+_[Y]>>>0;$=H,H=F,F=yi(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 Yu=sa("v5",80,Zu);const Xu="00000000-0000-0000-0000-000000000000";function Ju(n){if(!En(n))throw TypeError("Invalid UUID");return parseInt(n.substr(14,1),16)}const Qu=Object.freeze(Object.defineProperty({__proto__:null,NIL:Xu,parse:ia,stringify:In,v1:Nu,v3:Hu,v4:ju,v5:Yu,validate:En,version:Ju},Symbol.toStringTag,{value:"Module"})),aa=ko(Qu);var mi,Gs;function tf(){if(Gs)return mi;Gs=1;const n=aa.v4;return mi=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},mi}var wi,Zs;function ef(){if(Zs)return wi;Zs=1;const n=aa.v4,t=tf(),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 wi=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)},wi}var rf=ef();const nf=Oi(rf);var sf=class extends vo{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 of(n,t){return new sf(n,t)}var af=class{encode(n){return JSON.stringify(n)}decode(n){return JSON.parse(n)}},cf=class extends vo{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 af,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 uf=BigInt(0),Cr=BigInt(1),ff=BigInt(2),hf=BigInt(7),lf=BigInt(256),df=BigInt(113),ca=[],ua=[],fa=[];for(let n=0,t=Cr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],ca.push(2*(5*r+e)),ua.push((n+1)*(n+2)/2%64);let s=uf;for(let i=0;i<7;i++)t=(t<<Cr^(t>>hf)*df)%lf,t&ff&&(s^=Cr<<(Cr<<BigInt(i))-Cr);fa.push(s)}const ha=Ao(fa,!0),pf=ha[0],gf=ha[1],Ys=(n,t,e)=>e>32?rc(n,t,e):tc(n,t,e),Xs=(n,t,e)=>e>32?nc(n,t,e):ec(n,t,e);function yf(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=Ys(v,B,1)^e[u],_=Xs(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=ua[o],p=Ys(s,i,u),v=Xs(s,i,u),B=ca[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]^=pf[r],n[1]^=gf[r]}tr(e)}class Zi extends Fi{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,Nr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$a(this.state)}clone(){return this._cloneInto()}keccak(){xs(this.state32),yf(this.state32,this.rounds),xs(this.state32),this.posOut=0,this.pos=0}update(t){Er(this),t=vn(t),He(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){Er(this,!1),He(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 Nr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(xo(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,tr(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new Zi(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 mf=(n,t,e)=>zi(()=>new Zi(t,n,e)),Js=mf(1,136,256/8);class la extends Fi{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,So(t);const r=vn(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),tr(i)}update(t){return Er(this),this.iHash.update(t),this}digestInto(t){Er(this),He(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 da=(n,t,e)=>new la(n,t).update(e).digest();da.create=(n,t)=>new la(n,t);const Qs=(n,t)=>(n+(n>=0?t:-t)/pa)/t;function wf(n,t,e){const[[r,s],[i,o]]=t,u=Qs(o*n,e),p=Qs(-s*n,e);let v=n-u*r-p*i,B=-u*s-p*o;const P=v<Ve,_=B<Ve;P&&(v=-v),_&&(B=-B);const S=$r(Math.ceil(To(e)/2))+vr;if(v<Ve||v>=S||B<Ve||B>=S)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:P,k1:v,k2neg:_,k2:B}}function Bi(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function bi(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&&Bi(e.format),e}class bf extends Error{constructor(t=""){super(t)}}const De={Err:bf,_tlv:{encode:(n,t)=>{const{Err:e}=De;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=rn(r);if(s.length/2&128)throw new e("tlv.encode: long form length too big");const i=r>127?rn(s.length/2|128):"";return rn(n)+i+s+t},decode(n,t){const{Err:e}=De;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}=De;if(n<Ve)throw new t("integer: negative integers are not allowed");let e=rn(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}=De;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 Sn(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=De,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}=De,r=t.encode(2,e.encode(n.r)),s=t.encode(2,e.encode(n.s)),i=r+s;return t.encode(48,i)}},Ve=BigInt(0),vr=BigInt(1),pa=BigInt(2),on=BigInt(3),kf=BigInt(4);function wr(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 vf(n,t={}){const e=jo("weierstrass",n,t),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o,n:u}=i;Vr(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=ya(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 Pe(ga(E),k)}else return Pe(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,on),kf),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 wf(V,p.basises,s.ORDER)}const Q=ln((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=ln(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=dn(l,y),a=dn(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(on),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,on),{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,on);let I=r.mul(a,k),z=r.mul(l,E),G=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,G),st=r.sub(st,kt),kt=r.add(l,g),L=r.add(E,A),kt=r.mul(kt,L),L=r.add(z,G),kt=r.sub(kt,L),c=r.mul(f,st),L=r.mul(w,G),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),G=r.mul(f,G),st=r.mul(w,st),z=r.add(z,G),G=r.sub(I,G),G=r.mul(f,G),st=r.add(st,G),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=>ir(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 ir(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===Ve||l.is0())return C.ZERO;if(y===vr)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}=Mc(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===vr?!0:y?y(C,this):D.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:y}=t;return o===vr?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 or(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 ir(C,y)}static msm(y,a){return Ho(C,s,y,a)}static fromPrivateKey(y){return C.BASE.multiply(wr(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 Vo(C,t.endo?Math.ceil(U/2):U);return C.BASE.precompute(8),C}function ga(n){return Uint8Array.of(n?2:3)}function ya(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Sf(n,t={}){const{Fn:e}=n,r=t.randomBytes||Ki,s=Object.assign(ya(n.Fp,e),{seed:Do(e.ORDER)});function i(S){try{return!!wr(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 _c(_e(S,s.seed,"seed"),e.ORDER)}function p(S,T=!0){return n.BASE.multiply(wr(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=wr(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=>wr(e,S),precompute(S=8,T=n.BASE){return T.precompute(S,!1)}},lengths:s})}function xf(n,t,e={}){So(t),Vr(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=e.randomBytes||Ki,s=e.hmac||((a,...l)=>da(t,a,Pe(...l))),{Fp:i,Fn:o}=n,{ORDER:u,BITS:p}=o,{keygen:v,getPublicKey:B,getSharedSecret:P,utils:_,lengths:S}=Sf(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>>vr;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){Bi(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}=De.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(hn(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*pa<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(Pe(ga((A&1)===0),c)),w=o.inv(b),I=X(Dt("msgHash",l)),z=o.create(-I*w),G=o.create(E*w),rt=n.BASE.multiplyUnsafe(z).add(f.multiplyUnsafe(G));if(rt.is0())throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return N(this.s)}toBytes(l=M){if(Bi(l),l==="der")return hn(De.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 Pe(Uint8Array.of(this.recovery),g,k)}return Pe(g,k)}toHex(l){return or(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 or(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return or(this.toBytes("compact"))}}const Y=e.bits2int||function(l){if(l.length>8192)throw new Error("input is too large");const g=Sn(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=$r(p);function ct(a){return _i("num < 2^"+p,a,Ve,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}=bi(g,T);a=ot(a,E);const L=X(a),b=wr(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=Pe(...c),w=L;function I(z){const G=Y(z);if(!o.isValidNot0(G))return;const rt=o.inv(G),st=n.BASE.multiply(G).toAffine(),kt=o.create(st.x);if(kt===Ve)return;const St=o.create(rt*o.create(w+kt*b));if(St===Ve)return;let At=(st.x===kt?0:2)|Number(st.y&vr),Ie=St;return k&&N(St)&&(Ie=o.neg(St),At^=1),new $(kt,Ie,At)}return{seed:f,k2sig:I}}function U(a,l,g={}){a=Dt("message",a);const{seed:k,k2sig:E}=C(a,l,g);return mc(t.outputLen,o.BYTES,s)(k,E)}function D(a){let l;const g=typeof a=="string"||Wr(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 De.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}=bi(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),G=o.create(I*z),rt=o.create(f*z),st=n.BASE.multiplyUnsafe(G).add(c.multiplyUnsafe(rt));return st.is0()?!1:o.create(st.x)===f}catch{return!1}}function y(a,l,g={}){const{prehash:k}=bi(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 Ef(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=fr(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 If(n){const{CURVE:t,curveOpts:e}=Ef(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 Af(n,t){const e=t.Point;return Object.assign({},t,{ProjectivePoint:e,CURVE:Object.assign({},n,Ko(e.Fn.ORDER,e.Fn.BITS))})}function _f(n){const{CURVE:t,curveOpts:e,hash:r,ecdsaOpts:s}=If(n),i=vf(t,e),o=xf(i,r,s);return Af(n,o)}function Bf(n,t){const e=r=>_f({...n,hash:r});return{...e(t),create:e}}const Yi={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Rf={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},to=BigInt(2);function Mf(n){const t=Yi.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(_,to,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,to,t);if(!Ri.eql(Ri.sqr(Q),n))throw new Error("Cannot find square root");return Q}const Ri=fr(Yi.p,{sqrt:Mf}),Xi=Bf({...Yi,Fp:Ri,lowS:!0,endo:Rf},Bo),Tf=Rr.utils.randomPrivateKey,eo=()=>{const n=Rr.utils.randomPrivateKey(),t=bn(n),e=new Uint8Array(64);return e.set(n),e.set(t,32),{publicKey:t,secretKey:e}},bn=Rr.getPublicKey;function ro(n){try{return Rr.ExtendedPoint.fromHex(n),!0}catch{return!1}}const Ji=(n,t)=>Rr.sign(n,t.slice(0,32)),Pf=Rr.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 Qi{constructor(t){Object.assign(this,t)}encode(){return ft.Buffer.from(hi.serialize(Or,this))}static decode(t){return hi.deserialize(Or,this,t)}static decodeUnchecked(t){return hi.deserializeUnchecked(Or,this,t)}}class Lf extends Qi{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 Or=new Map;var ma;const wa=32,Oe=32;function Cf(n){return n._bn!==void 0}let no=1;class tt extends Qi{constructor(t){if(super({}),this._bn=void 0,Cf(t))this._bn=t._bn;else{if(typeof t=="string"){const e=le.decode(t);if(e.length!=Oe)throw new Error("Invalid public key input");this._bn=new Ns(e)}else this._bn=new Ns(t);if(this._bn.byteLength()>Oe)throw new Error("Invalid public key input")}}static unique(){const t=new tt(no);return no+=1,new tt(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return le.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===Oe)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=qs(s);return new tt(i)}static createProgramAddressSync(t,e){let r=ft.Buffer.alloc(0);t.forEach(function(i){if(i.length>wa)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=qs(r);if(ro(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 ro(e.toBytes())}}ma=tt;tt.default=new ma("11111111111111111111111111111111");Or.set(tt,{kind:"struct",fields:[["_bn","u256"]]});class Uf{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(Tf()),this._publicKey=yt(bn(this._secretKey))}get publicKey(){return new tt(this._publicKey)}get secretKey(){return ft.Buffer.concat([this._secretKey,this._publicKey],64)}}const Of=new tt("BPFLoader1111111111111111111111111111111111"),Qe=1232,_n=127,zr=64;class ts extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(ts.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class es 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(es.prototype,"name",{value:"TransactionExpiredTimeoutError"});class br extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(br.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Kr{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),Nf=(n="signature")=>R.blob(64,n),sr=(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},Ff=(n="authorized")=>R.struct([mt("staker"),mt("withdrawer")],n),zf=(n="lockup")=>R.struct([R.ns64("unixTimestamp"),R.ns64("epoch"),mt("custodian")],n),Kf=(n="voteInit")=>R.struct([mt("nodePubkey"),mt("authorizedVoter"),mt("authorizedWithdrawer"),R.u8("commission")],n),qf=(n="voteAuthorizeWithSeedArgs")=>R.struct([R.u32("voteAuthorizationType"),mt("currentAuthorityDerivedKeyOwnerPubkey"),sr("currentAuthorityDerivedKeySeed"),mt("newAuthorized")],n);function ba(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 ba({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 Bn{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 Bn(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 ka="Reached end of buffer unexpectedly";function Le(n){if(n.length===0)throw new Error(ka);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(ka);return n.splice(...t)}class Re{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:le.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Kr(this.staticAccountKeys)}static compile(t){const e=Bn.compile(t.instructions,t.payerKey),[r,s]=e.getMessageComponents(),o=new Kr(s).compileInstructions(t.instructions).map(u=>({programIdIndex:u.programIdIndex,accounts:u.accountKeyIndexes,data:le.encode(u.data)}));return new Re({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(le.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(Qe);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:le.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=Le(e);if(r!==(r&_n))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const s=Le(e),i=Le(e),o=ke(e);let u=[];for(let _=0;_<o;_++){const S=ve(e,0,Oe);u.push(new tt(ft.Buffer.from(S)))}const p=ve(e,0,Oe),v=ke(e);let B=[];for(let _=0;_<v;_++){const S=Le(e),T=ke(e),M=ve(e,0,T),N=ke(e),F=ve(e,0,N),H=le.encode(ft.Buffer.from(F));B.push({programIdIndex:S,accounts:M,data:H})}const P={header:{numRequiredSignatures:r,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:i},recentBlockhash:le.encode(ft.Buffer.from(p)),accountKeys:u,instructions:B};return new Re(P)}}class cr{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 Kr(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=Bn.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 Kr(u,s).compileInstructions(t.instructions);return new cr({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(Qe),v=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(B=>B.toBytes()),recentBlockhash:le.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(Qe);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(Qe);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=Le(e),s=r&_n;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:Le(e),numReadonlySignedAccounts:Le(e),numReadonlyUnsignedAccounts:Le(e)},u=[],p=ke(e);for(let T=0;T<p;T++)u.push(new tt(ve(e,0,Oe)));const v=le.encode(ve(e,0,Oe)),B=ke(e),P=[];for(let T=0;T<B;T++){const M=Le(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,Oe)),N=ke(e),F=ve(e,0,N),H=ke(e),$=ve(e,0,H);S.push({accountKey:M,writableIndexes:F,readonlyIndexes:$})}return new cr({header:o,staticAccountKeys:u,recentBlockhash:v,compiledInstructions:P,addressTableLookups:S})}}const rs={deserializeMessageVersion(n){const t=n[0],e=t&_n;return e===t?"legacy":e},deserialize:n=>{const t=rs.deserializeMessageVersion(n);if(t==="legacy")return Re.from(n);if(t===0)return cr.deserialize(n);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let qe=(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 Df=ft.Buffer.alloc(zr).fill(0);class It{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 vt{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 It(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:le.encode(N)}});return T.forEach(M=>{bt(M.programIdIndex>=0),M.accounts.forEach(N=>bt(N>=0))}),new Re({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=Ji(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):Pf(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 Oi,a as ko}from"./vendor-dayjs-Cvgzdobq.js";import{e6 as qa}from"./index-BTvg_L_n.js";import{E as vo}from"./index-CVHPJfCy.js";var Qn={},Lr={},ks;function Da(){if(ks)return Lr;ks=1,Lr.byteLength=u,Lr.toByteArray=v,Lr.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 Lr}var Jr={};var vs;function Wa(){return vs||(vs=1,Jr.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)},Jr.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}),Jr}var Ss;function Ni(){return Ss||(Ss=1,(function(n){const t=Da(),e=Wa(),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,j=Math.min(x,O);K<j;++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 j=h[x];if(xe(j,Uint8Array))K+j.length>O.length?(u.isBuffer(j)||(j=u.from(j)),j.copy(O,K)):Uint8Array.prototype.set.call(O,j,K);else if(u.isBuffer(j))j.copy(O,K);else throw new TypeError('"list" argument must be an Array of Buffers');K+=j.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 j=K-O,pt=x-d;const dt=Math.min(j,pt),lt=this.slice(O,K),Tt=h.slice(d,x);for(let ht=0;ht<dt;++ht)if(lt[ht]!==Tt[ht]){j=lt[ht],pt=Tt[ht];break}return j<pt?-1:pt<j?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,j=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,j/=2,pt/=2,d/=2}function dt(Tt,ht){return K===1?Tt[ht]:Tt.readUInt16BE(ht*K)}let lt;if(O){let Tt=-1;for(lt=d;lt<j;lt++)if(dt(m,lt)===dt(h,Tt===-1?0:lt-Tt)){if(Tt===-1&&(Tt=lt),lt-Tt+1===pt)return Tt*K}else Tt!==-1&&(lt-=lt-Tt),Tt=-1}else for(d+pt>j&&(d=j-pt),lt=d;lt>=0;lt--){let Tt=!0;for(let ht=0;ht<pt;ht++)if(dt(m,lt+ht)!==dt(h,ht)){Tt=!1;break}if(Tt)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 j;for(j=0;j<x;++j){const pt=parseInt(h.substr(j*2,2),16);if(Lt(pt))return j;m[d+j]=pt}return j}function C(m,h,d,x){return Mt(Pt(h,m.length-d),m,d,x)}function U(m,h,d,x){return Mt(Ft(h),m,d,x)}function D(m,h,d,x){return Mt(Ct(h),m,d,x)}function V(m,h,d,x){return Mt(Xr(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 j=!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(j)throw new TypeError("Unknown encoding: "+O);O=(""+O).toLowerCase(),j=!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 j=null,pt=K>239?4:K>223?3:K>191?2:1;if(O+pt<=d){let dt,lt,Tt,ht;switch(pt){case 1:K<128&&(j=K);break;case 2:dt=m[O+1],(dt&192)===128&&(ht=(K&31)<<6|dt&63,ht>127&&(j=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)&&(j=ht));break;case 4:dt=m[O+1],lt=m[O+2],Tt=m[O+3],(dt&192)===128&&(lt&192)===128&&(Tt&192)===128&&(ht=(K&15)<<18|(dt&63)<<12|(lt&63)<<6|Tt&63,ht>65535&&ht<1114112&&(j=ht))}}j===null?(j=65533,pt=1):j>65535&&(j-=65536,x.push(j>>>10&1023|55296),j=56320|j&1023),x.push(j),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,j=0;for(;++j<d&&(K*=256);)O+=this[h+j]*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)&&_t(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)&&_t(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,j=0;for(;++j<d&&(K*=256);)O+=this[h+j]*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,j=this[h+--O];for(;O>0&&(K*=256);)j+=this[h+--O]*K;return K*=128,j>=K&&(j-=Math.pow(2,8*d)),j},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)&&_t(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)&&_t(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,j=0;for(this[d]=h&255;++j<x&&(K*=256);)this[d+j]=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,j=1;for(this[d+K]=h&255;--K>=0&&(j*=256);)this[d+K]=h/j&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){At(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 j=Number(h>>BigInt(32)&BigInt(4294967295));return m[d++]=j,j=j>>8,m[d++]=j,j=j>>8,m[d++]=j,j=j>>8,m[d++]=j,d}function w(m,h,d,x,O){At(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 j=Number(h>>BigInt(32)&BigInt(4294967295));return m[d+3]=j,j=j>>8,m[d+2]=j,j=j>>8,m[d+1]=j,j=j>>8,m[d]=j,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,j=1,pt=0;for(this[d]=h&255;++K<x&&(j*=256);)h<0&&pt===0&&this[d+K-1]!==0&&(pt=1),this[d+K]=(h/j>>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,j=1,pt=0;for(this[d+K]=h&255;--K>=0&&(j*=256);)h<0&&pt===0&&this[d+K+1]!==0&&(pt=1),this[d+K]=(h/j>>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 G(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 G(this,h,d,!0,x)},u.prototype.writeDoubleBE=function(h,d,x){return G(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 j=h.charCodeAt(0);(O==="utf8"&&j<128||O==="latin1")&&(h=j)}}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 j=u.isBuffer(h)?h:u.from(h,O),pt=j.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]=j[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 St(m,h,d){Ie(h,"offset"),(m[h]===void 0||m[h+d]===void 0)&&_t(h,m.length-(d+1))}function At(m,h,d,x,O,K){if(m>d||m<h){const j=typeof h=="bigint"?"n":"";let pt;throw h===0||h===BigInt(0)?pt=`>= 0${j} and < 2${j} ** ${(K+1)*8}${j}`:pt=`>= -(2${j} ** ${(K+1)*8-1}${j}) and < 2 ** ${(K+1)*8-1}${j}`,new rt.ERR_OUT_OF_RANGE("value",pt,m)}St(x,O,K)}function Ie(m,h){if(typeof m!="number")throw new rt.ERR_INVALID_ARG_TYPE(h,"number",m)}function _t(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 Yr(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 j=0;j<x;++j){if(d=m.charCodeAt(j),d>55295&&d<57344){if(!O){if(d>56319){(h-=3)>-1&&K.push(239,191,189);continue}else if(j+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 Xr(m,h){let d,x,O;const K=[];for(let j=0;j<m.length&&!((h-=2)<0);++j)d=m.charCodeAt(j),x=d>>8,O=d%256,K.push(O),K.push(x);return K}function Ct(m){return t.toByteArray(Yr(m))}function Mt(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")}})(Qn)),Qn}var ft=Ni();const pr=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;function Wr(n){return n instanceof Uint8Array||ArrayBuffer.isView(n)&&n.constructor.name==="Uint8Array"}function Nr(n){if(!Number.isSafeInteger(n)||n<0)throw new Error("positive integer expected, got "+n)}function He(n,...t){if(!Wr(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 So(n){if(typeof n!="function"||typeof n.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Nr(n.outputLen),Nr(n.blockLen)}function Er(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 xo(n,t){He(n);const e=t.outputLen;if(n.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function $a(n){return new Uint32Array(n.buffer,n.byteOffset,Math.floor(n.byteLength/4))}function tr(...n){for(let t=0;t<n.length;t++)n[t].fill(0)}function ti(n){return new DataView(n.buffer,n.byteOffset,n.byteLength)}function Me(n,t){return n<<32-t|n>>>t}const Va=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ha(n){return n<<24&4278190080|n<<8&16711680|n>>>8&65280|n>>>24&255}function ja(n){for(let t=0;t<n.length;t++)n[t]=Ha(n[t]);return n}const xs=Va?n=>n:ja,Eo=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",Ga=Array.from({length:256},(n,t)=>t.toString(16).padStart(2,"0"));function or(n){if(He(n),Eo)return n.toHex();let t="";for(let e=0;e<n.length;e++)t+=Ga[n[e]];return t}const ze={_0:48,_9:57,A:65,F:70,a:97,f:102};function Es(n){if(n>=ze._0&&n<=ze._9)return n-ze._0;if(n>=ze.A&&n<=ze.F)return n-(ze.A-10);if(n>=ze.a&&n<=ze.f)return n-(ze.a-10)}function hn(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);if(Eo)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=Es(n.charCodeAt(i)),u=Es(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 Za(n){if(typeof n!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(n))}function vn(n){return typeof n=="string"&&(n=Za(n)),He(n),n}function Pe(...n){let t=0;for(let r=0;r<n.length;r++){const s=n[r];He(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 Fi{}function zi(n){const t=r=>n().update(vn(r)).digest(),e=n();return t.outputLen=e.outputLen,t.blockLen=e.blockLen,t.create=()=>n(),t}function Ki(n=32){if(pr&&typeof pr.getRandomValues=="function")return pr.getRandomValues(new Uint8Array(n));if(pr&&typeof pr.randomBytes=="function")return Uint8Array.from(pr.randomBytes(n));throw new Error("crypto.getRandomValues must be defined")}function Ya(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 Xa(n,t,e){return n&t^~n&e}function Ja(n,t,e){return n&t^n&e^t&e}class Io extends Fi{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=ti(this.buffer)}update(t){Er(this),t=vn(t),He(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=ti(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){Er(this),xo(t,this),this.finished=!0;const{buffer:e,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;e[o++]=128,tr(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let P=o;P<s;P++)e[P]=0;Ya(r,s-8,BigInt(this.length*8),i),this.process(r,0);const u=ti(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 je=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]),Qr=BigInt(2**32-1),Is=BigInt(32);function Qa(n,t=!1){return t?{h:Number(n&Qr),l:Number(n>>Is&Qr)}:{h:Number(n>>Is&Qr)|0,l:Number(n&Qr)|0}}function Ao(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}=Qa(n[i],t);[r[i],s[i]]=[o,u]}return[r,s]}const As=(n,t,e)=>n>>>e,_s=(n,t,e)=>n<<32-e|t>>>e,gr=(n,t,e)=>n>>>e|t<<32-e,yr=(n,t,e)=>n<<32-e|t>>>e,tn=(n,t,e)=>n<<64-e|t>>>e-32,en=(n,t,e)=>n>>>e-32|t<<64-e,tc=(n,t,e)=>n<<e|t>>>32-e,ec=(n,t,e)=>t<<e|n>>>32-e,rc=(n,t,e)=>t<<e-32|n>>>64-e,nc=(n,t,e)=>n<<e-32|t>>>64-e;function Ke(n,t,e,r){const s=(t>>>0)+(r>>>0);return{h:n+e+(s/2**32|0)|0,l:s|0}}const ic=(n,t,e)=>(n>>>0)+(t>>>0)+(e>>>0),sc=(n,t,e,r)=>t+e+r+(n/2**32|0)|0,oc=(n,t,e,r)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0),ac=(n,t,e,r,s)=>t+e+r+s+(n/2**32|0)|0,cc=(n,t,e,r,s)=>(n>>>0)+(t>>>0)+(e>>>0)+(r>>>0)+(s>>>0),uc=(n,t,e,r,s,i)=>t+e+r+s+i+(n/2**32|0)|0,fc=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]),Ge=new Uint32Array(64);class hc extends Io{constructor(t=32){super(64,t,8,!1),this.A=je[0]|0,this.B=je[1]|0,this.C=je[2]|0,this.D=je[3]|0,this.E=je[4]|0,this.F=je[5]|0,this.G=je[6]|0,this.H=je[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)Ge[P]=t.getUint32(e,!1);for(let P=16;P<64;P++){const _=Ge[P-15],S=Ge[P-2],T=Me(_,7)^Me(_,18)^_>>>3,M=Me(S,17)^Me(S,19)^S>>>10;Ge[P]=M+Ge[P-7]+T+Ge[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 _=Me(u,6)^Me(u,11)^Me(u,25),S=B+_+Xa(u,p,v)+fc[P]+Ge[P]|0,M=(Me(r,2)^Me(r,13)^Me(r,22))+Ja(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(){tr(Ge)}destroy(){this.set(0,0,0,0,0,0,0,0),tr(this.buffer)}}const _o=Ao(["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))),lc=_o[0],dc=_o[1],Ze=new Uint32Array(80),Ye=new Uint32Array(80);class pc extends Io{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)Ze[$]=t.getUint32(e),Ye[$]=t.getUint32(e+=4);for(let $=16;$<80;$++){const Y=Ze[$-15]|0,X=Ye[$-15]|0,Q=gr(Y,X,1)^gr(Y,X,8)^As(Y,X,7),ct=yr(Y,X,1)^yr(Y,X,8)^_s(Y,X,7),ot=Ze[$-2]|0,C=Ye[$-2]|0,U=gr(ot,C,19)^tn(ot,C,61)^As(ot,C,6),D=yr(ot,C,19)^en(ot,C,61)^_s(ot,C,6),V=oc(ct,D,Ye[$-7],Ye[$-16]),y=ac(V,Q,U,Ze[$-7],Ze[$-16]);Ze[$]=y|0,Ye[$]=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=gr(P,_,14)^gr(P,_,18)^tn(P,_,41),X=yr(P,_,14)^yr(P,_,18)^en(P,_,41),Q=P&S^~P&M,ct=_&T^~_&N,ot=cc(H,X,ct,dc[$],Ye[$]),C=uc(ot,F,Y,Q,lc[$],Ze[$]),U=ot|0,D=gr(r,s,28)^tn(r,s,34)^tn(r,s,39),V=yr(r,s,28)^en(r,s,34)^en(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:_}=Ke(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=ic(U,V,a);r=sc(l,C,D,y),s=l|0}({h:r,l:s}=Ke(this.Ah|0,this.Al|0,r|0,s|0)),{h:i,l:o}=Ke(this.Bh|0,this.Bl|0,i|0,o|0),{h:u,l:p}=Ke(this.Ch|0,this.Cl|0,u|0,p|0),{h:v,l:B}=Ke(this.Dh|0,this.Dl|0,v|0,B|0),{h:P,l:_}=Ke(this.Eh|0,this.El|0,P|0,_|0),{h:S,l:T}=Ke(this.Fh|0,this.Fl|0,S|0,T|0),{h:M,l:N}=Ke(this.Gh|0,this.Gl|0,M|0,N|0),{h:F,l:H}=Ke(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(){tr(Ze,Ye)}destroy(){tr(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Bo=zi(()=>new hc),gc=zi(()=>new pc);const qi=BigInt(0),Ai=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=Wr(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 rn(n){const t=n.toString(16);return t.length&1?"0"+t:t}function Ro(n){if(typeof n!="string")throw new Error("hex string expected, got "+typeof n);return n===""?qi:BigInt("0x"+n)}function Sn(n){return Ro(or(n))}function Fr(n){return He(n),Ro(or(Uint8Array.from(n).reverse()))}function Di(n,t){return hn(n.toString(16).padStart(t*2,"0"))}function Mo(n,t){return Di(n,t).reverse()}function Dt(n,t,e){let r;if(typeof t=="string")try{r=hn(t)}catch(i){throw new Error(n+" must be hex string or Uint8Array, cause: "+i)}else if(Wr(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 Bs(n){return Uint8Array.from(n)}const ei=n=>typeof n=="bigint"&&qi<=n;function yc(n,t,e){return ei(n)&&ei(t)&&ei(e)&&t<=n&&n<e}function _i(n,t,e,r){if(!yc(t,e,r))throw new Error("expected valid "+n+": "+e+" <= n < "+r+", got "+t)}function To(n){let t;for(t=0;n>qi;n>>=Ai,t+=1);return t}const $r=n=>(Ai<<BigInt(n))-Ai;function mc(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 Pe(...T)};return(S,T)=>{p(),B(S);let M;for(;!(M=T(P()));)B();return p(),M}}function Vr(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 ln(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),rr=BigInt(2),Po=BigInt(3),Lo=BigInt(4),Co=BigInt(5),wc=BigInt(7),Uo=BigInt(8),bc=BigInt(9),Oo=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 Rs(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 Wi(n,t,e){if(!n.eql(n.sqr(t),e))throw new Error("Cannot find square root")}function No(n,t){const e=(n.ORDER+de)/Lo,r=n.pow(t,e);return Wi(n,r,t),r}function kc(n,t){const e=(n.ORDER-Co)/Uo,r=n.mul(t,rr),s=n.pow(r,e),i=n.mul(t,s),o=n.mul(n.mul(i,rr),s),u=n.mul(i,n.sub(o,n.ONE));return Wi(n,u,t),u}function vc(n){const t=fr(n),e=Fo(n),r=e(t,t.neg(t.ONE)),s=e(t,r),i=e(t,t.neg(r)),o=(n+wc)/Oo;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 Wi(u,N,p),N}}function Fo(n){if(n<Po)throw new Error("sqrt is not defined for small field");let t=n-de,e=0;for(;t%rr===Se;)t/=rr,e++;let r=rr;const s=fr(n);for(;Ms(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(e===1)return No;let i=s.pow(r,t);const o=(t+de)/rr;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 Sc(n){return n%Lo===Po?No:n%Uo===Co?kc:n%Oo===bc?vc(n):Fo(n)}const xc=(n,t)=>(ae(n,t)&de)===de,Ec=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ic(n){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},e=Ec.reduce((r,s)=>(r[s]="function",r),t);return Vr(n,e),n}function Ac(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 zo(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)/rr,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 Ko(n,t){t!==void 0&&Nr(t);const e=t!==void 0?t:n.toString(2).length,r=Math.ceil(e/8);return{nBitLength:e,nByteLength:r}}function fr(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}=Ko(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:$r(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)=>Ac(P,_,S),div:(_,S)=>ae(_*Rs(S,n),n),sqrN:_=>_*_,addN:(_,S)=>_+S,subN:(_,S)=>_-S,mulN:(_,S)=>_*S,inv:_=>Rs(_,n),sqrt:i||(_=>(B||(B=Sc(n)),B(P,_))),toBytes:_=>e?Mo(_,v):Di(_,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?Fr(_):Sn(_);if(o&&(T=ae(T,n)),!S&&!P.isValid(T))throw new Error("invalid field element: outside of range 0..ORDER");return T},invertBatch:_=>zo(P,_),cmov:(_,S,T)=>T?S:_});return Object.freeze(P)}function qo(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 Do(n){const t=qo(n);return t+Math.ceil(t/2)}function _c(n,t,e=!1){const r=n.length,s=qo(t),i=Do(t);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const o=e?Fr(n):Sn(n),u=ae(o,t-de)+de;return e?Mo(u,s):Di(u,s)}const Ir=BigInt(0),nr=BigInt(1);function dn(n,t){const e=t.negate();return n?e:t}function ir(n,t){const e=zo(n.Fp,t.map(r=>r.Z));return t.map((r,s)=>n.fromAffine(r.toAffine(e[s])))}function Wo(n,t){if(!Number.isSafeInteger(n)||n<=0||n>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+n)}function ri(n,t){Wo(n,t);const e=Math.ceil(t/n)+1,r=2**(n-1),s=2**n,i=$r(n),o=BigInt(n);return{windows:e,windowSize:r,mask:i,maxNumber:s,shiftBy:o}}function Ts(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+=nr);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 Bc(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 Rc(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 ni=new WeakMap,$o=new WeakMap;function ii(n){return $o.get(n)||1}function Ps(n){if(n!==Ir)throw new Error("invalid wNAF")}class Vo{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>Ir;)e&nr&&(r=r.add(s)),s=s.double(),e>>=nr;return r}precomputeWindow(t,e){const{windows:r,windowSize:s}=ri(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=ri(t,this.bits);for(let u=0;u<o.windows;u++){const{nextN:p,offset:v,isZero:B,isNeg:P,isNegF:_,offsetF:S}=Ts(r,u,o);r=p,B?i=i.add(dn(_,e[S])):s=s.add(dn(P,e[v]))}return Ps(r),{p:s,f:i}}wNAFUnsafe(t,e,r,s=this.ZERO){const i=ri(t,this.bits);for(let o=0;o<i.windows&&r!==Ir;o++){const{nextN:u,offset:p,isZero:v,isNeg:B}=Ts(r,o,i);if(r=u,!v){const P=e[p];s=s.add(B?P.negate():P)}}return Ps(r),s}getPrecomputes(t,e,r){let s=ni.get(e);return s||(s=this.precomputeWindow(e,t),t!==1&&(typeof r=="function"&&(s=r(s)),ni.set(e,s))),s}cached(t,e,r){const s=ii(t);return this.wNAF(s,this.getPrecomputes(s,t,r),e)}unsafe(t,e,r,s){const i=ii(t);return i===1?this._unsafeLadder(t,e,s):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),e,s)}createCache(t,e){Wo(e,this.bits),$o.set(t,e),ni.delete(t)}hasCache(t){return ii(t)!==1}}function Mc(n,t,e,r){let s=t,i=n.ZERO,o=n.ZERO;for(;e>Ir||r>Ir;)e&nr&&(i=i.add(s)),r&nr&&(o=o.add(s)),s=s.double(),e>>=nr,r>>=nr;return{p1:i,p2:o}}function Ho(n,t,e,r){Bc(e,n),Rc(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=To(BigInt(s));let p=1;u>12?p=u-3:u>4?p=u-2:u>0&&(p=2);const v=$r(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 Ls(n,t,e){if(t){if(t.ORDER!==n)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Ic(t),t}else return fr(n,{isLE:e})}function jo(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>Ir))throw new Error(`CURVE.${p} must be positive bigint`)}const s=Ls(t.p,e.Fp,r),i=Ls(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 Xe=BigInt(0),ce=BigInt(1),si=BigInt(2),Tc=BigInt(8);function Pc(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 Lc(n,t={}){const e=jo("edwards",n,t,t.FpFnLE),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o}=i;Vr(t,{},{uvRatio:"function"});const u=si<<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:Xe}}});if(!Pc(r,i,i.Gx,i.Gy))throw new Error("bad curve params: generator point");function B(N,F,H=!1){const $=H?ce:Xe;return _i("coordinate "+N,F,$,u),F}function P(N){if(!(N instanceof T))throw new Error("ExtendedPoint expected")}const _=ln((N,F)=>{const{X:H,Y:$,Z:Y}=N,X=N.is0();F==null&&(F=X?Tc:r.inv(Y));const Q=p(H*F),ct=p($*F),ot=r.mul(Y,F);if(X)return{x:Xe,y:ce};if(ot!==ce)throw new Error("invZ was invalid");return{x:Q,y:ct}}),S=ln(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=Bs(_e(F,$,"point")),ar(H,"zip215");const Q=Bs(F),ct=F[$-1];Q[$-1]=ct&-129;const ot=Fr(Q),C=H?u:r.ORDER;_i("point.y",ot,Xe,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===Xe&&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(si),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(si*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=>ir(T,Y));return ir(T,[H,$])[0]}multiplyUnsafe(F,H=T.ZERO){if(!s.isValid(F))throw new Error("invalid scalar: expected 0 <= sc < curve.n");return F===Xe?T.ZERO:this.is0()||F===ce?this:M.unsafe(this,F,$=>ir(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 or(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 ir(T,F)}static msm(F,H){return Ho(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(Xe,ce,ce,Xe),T.Fp=r,T.Fn=s;const M=new Vo(T,s.BITS);return T.BASE.precompute(8),T}function Cc(n,t,e={}){if(typeof t!="function")throw new Error('"hash" function param is required');Vr(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||Ki,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(Fr(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=Pe(...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=Pe(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=Fr(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 Wr(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 Uc(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=fr(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 Oc(n,t){const e=t.Point;return Object.assign({},t,{ExtendedPoint:e,CURVE:n,nBitLength:e.Fn.BITS,nByteLength:e.Fn.BYTES})}function Nc(n){const{CURVE:t,curveOpts:e,hash:r,eddsaOpts:s}=Uc(n),i=Lc(t,e),o=Cc(i,r,s);return Oc(n,o)}const Fc=BigInt(1),Cs=BigInt(2);BigInt(3);const zc=BigInt(5),Kc=BigInt(8),$i=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),Go={p:$i,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:Kc,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")};function qc(n){const t=BigInt(10),e=BigInt(20),r=BigInt(40),s=BigInt(80),i=$i,u=n*n%i*n%i,p=qt(u,Cs,i)*u%i,v=qt(p,Fc,i)*n%i,B=qt(v,zc,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,Cs,i)*n%i,b2:u}}function Dc(n){return n[0]&=248,n[31]&=127,n[31]|=64,n}const Us=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function Wc(n,t){const e=$i,r=ae(t*t*t,e),s=ae(r*r*t,e),i=qc(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*Us,e),B=u===n,P=u===ae(-n,e),_=u===ae(-n*Us,e);return B&&(o=p),(P||_)&&(o=v),xc(o,e)&&(o=ae(-o,e)),{isValid:B||P,value:o}}const $c=fr(Go.p,{isLE:!0}),Vc={...Go,Fp:$c,hash:gc,adjustScalarBytes:Dc,uvRatio:Wc},Rr=Nc(Vc);var cn={exports:{}},Hc=cn.exports,Os;function Zo(){return Os||(Os=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=qa.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 G=c-z|0;k=y.words[G]|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,G=k[1]|0,rt=G&8191,st=G>>>13,kt=k[2]|0,St=kt&8191,At=kt>>>13,Ie=k[3]|0,_t=Ie&8191,Nt=Ie>>>13,Yr=k[4]|0,Pt=Yr&8191,Ft=Yr>>>13,Xr=k[5]|0,Ct=Xr&8191,Mt=Xr>>>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,j=O>>>13,pt=E[0]|0,dt=pt&8191,lt=pt>>>13,Tt=E[1]|0,ht=Tt&8191,$t=Tt>>>13,ls=E[2]|0,Vt=ls&8191,Ht=ls>>>13,ds=E[3]|0,jt=ds&8191,Gt=ds>>>13,ps=E[4]|0,Zt=ps&8191,Yt=ps>>>13,gs=E[5]|0,Xt=gs&8191,Jt=gs>>>13,ys=E[6]|0,Qt=ys&8191,te=ys>>>13,ms=E[7]|0,ee=ms&8191,re=ms>>>13,ws=E[8]|0,ne=ws&8191,ie=ws>>>13,bs=E[9]|0,se=bs&8191,oe=bs>>>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 Cn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Cn>>>26)|0,Cn&=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 Un=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Un>>>26)|0,Un&=67108863,b=Math.imul(St,dt),c=Math.imul(St,lt),c=c+Math.imul(At,dt)|0,f=Math.imul(At,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 On=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(On>>>26)|0,On&=67108863,b=Math.imul(_t,dt),c=Math.imul(_t,lt),c=c+Math.imul(Nt,dt)|0,f=Math.imul(Nt,lt),b=b+Math.imul(St,ht)|0,c=c+Math.imul(St,$t)|0,c=c+Math.imul(At,ht)|0,f=f+Math.imul(At,$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,jt)|0,c=c+Math.imul(I,Gt)|0,c=c+Math.imul(z,jt)|0,f=f+Math.imul(z,Gt)|0;var Nn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Nn>>>26)|0,Nn&=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(_t,ht)|0,c=c+Math.imul(_t,$t)|0,c=c+Math.imul(Nt,ht)|0,f=f+Math.imul(Nt,$t)|0,b=b+Math.imul(St,Vt)|0,c=c+Math.imul(St,Ht)|0,c=c+Math.imul(At,Vt)|0,f=f+Math.imul(At,Ht)|0,b=b+Math.imul(rt,jt)|0,c=c+Math.imul(rt,Gt)|0,c=c+Math.imul(st,jt)|0,f=f+Math.imul(st,Gt)|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 Fn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Fn>>>26)|0,Fn&=67108863,b=Math.imul(Ct,dt),c=Math.imul(Ct,lt),c=c+Math.imul(Mt,dt)|0,f=Math.imul(Mt,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(_t,Vt)|0,c=c+Math.imul(_t,Ht)|0,c=c+Math.imul(Nt,Vt)|0,f=f+Math.imul(Nt,Ht)|0,b=b+Math.imul(St,jt)|0,c=c+Math.imul(St,Gt)|0,c=c+Math.imul(At,jt)|0,f=f+Math.imul(At,Gt)|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 zn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(zn>>>26)|0,zn&=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(Mt,ht)|0,f=f+Math.imul(Mt,$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(_t,jt)|0,c=c+Math.imul(_t,Gt)|0,c=c+Math.imul(Nt,jt)|0,f=f+Math.imul(Nt,Gt)|0,b=b+Math.imul(St,Zt)|0,c=c+Math.imul(St,Yt)|0,c=c+Math.imul(At,Zt)|0,f=f+Math.imul(At,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 Kn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Kn>>>26)|0,Kn&=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(Mt,Vt)|0,f=f+Math.imul(Mt,Ht)|0,b=b+Math.imul(Pt,jt)|0,c=c+Math.imul(Pt,Gt)|0,c=c+Math.imul(Ft,jt)|0,f=f+Math.imul(Ft,Gt)|0,b=b+Math.imul(_t,Zt)|0,c=c+Math.imul(_t,Yt)|0,c=c+Math.imul(Nt,Zt)|0,f=f+Math.imul(Nt,Yt)|0,b=b+Math.imul(St,Xt)|0,c=c+Math.imul(St,Jt)|0,c=c+Math.imul(At,Xt)|0,f=f+Math.imul(At,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 qn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(qn>>>26)|0,qn&=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,jt)|0,c=c+Math.imul(Ct,Gt)|0,c=c+Math.imul(Mt,jt)|0,f=f+Math.imul(Mt,Gt)|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(_t,Xt)|0,c=c+Math.imul(_t,Jt)|0,c=c+Math.imul(Nt,Xt)|0,f=f+Math.imul(Nt,Jt)|0,b=b+Math.imul(St,Qt)|0,c=c+Math.imul(St,te)|0,c=c+Math.imul(At,Qt)|0,f=f+Math.imul(At,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 Dn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Dn>>>26)|0,Dn&=67108863,b=Math.imul(K,dt),c=Math.imul(K,lt),c=c+Math.imul(j,dt)|0,f=Math.imul(j,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,jt)|0,c=c+Math.imul(Lt,Gt)|0,c=c+Math.imul(zt,jt)|0,f=f+Math.imul(zt,Gt)|0,b=b+Math.imul(Ct,Zt)|0,c=c+Math.imul(Ct,Yt)|0,c=c+Math.imul(Mt,Zt)|0,f=f+Math.imul(Mt,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(_t,Qt)|0,c=c+Math.imul(_t,te)|0,c=c+Math.imul(Nt,Qt)|0,f=f+Math.imul(Nt,te)|0,b=b+Math.imul(St,ee)|0,c=c+Math.imul(St,re)|0,c=c+Math.imul(At,ee)|0,f=f+Math.imul(At,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 Wn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Wn>>>26)|0,Wn&=67108863,b=Math.imul(K,ht),c=Math.imul(K,$t),c=c+Math.imul(j,ht)|0,f=Math.imul(j,$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,jt)|0,c=c+Math.imul(Kt,Gt)|0,c=c+Math.imul(m,jt)|0,f=f+Math.imul(m,Gt)|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(Mt,Xt)|0,f=f+Math.imul(Mt,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(_t,ee)|0,c=c+Math.imul(_t,re)|0,c=c+Math.imul(Nt,ee)|0,f=f+Math.imul(Nt,re)|0,b=b+Math.imul(St,ne)|0,c=c+Math.imul(St,ie)|0,c=c+Math.imul(At,ne)|0,f=f+Math.imul(At,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 $n=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+($n>>>26)|0,$n&=67108863,b=Math.imul(K,Vt),c=Math.imul(K,Ht),c=c+Math.imul(j,Vt)|0,f=Math.imul(j,Ht),b=b+Math.imul(d,jt)|0,c=c+Math.imul(d,Gt)|0,c=c+Math.imul(x,jt)|0,f=f+Math.imul(x,Gt)|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(Mt,Qt)|0,f=f+Math.imul(Mt,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(_t,ne)|0,c=c+Math.imul(_t,ie)|0,c=c+Math.imul(Nt,ne)|0,f=f+Math.imul(Nt,ie)|0,b=b+Math.imul(St,se)|0,c=c+Math.imul(St,oe)|0,c=c+Math.imul(At,se)|0,f=f+Math.imul(At,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,jt),c=Math.imul(K,Gt),c=c+Math.imul(j,jt)|0,f=Math.imul(j,Gt),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(Mt,ee)|0,f=f+Math.imul(Mt,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(_t,se)|0,c=c+Math.imul(_t,oe)|0,c=c+Math.imul(Nt,se)|0,f=f+Math.imul(Nt,oe)|0;var Hn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Hn>>>26)|0,Hn&=67108863,b=Math.imul(K,Zt),c=Math.imul(K,Yt),c=c+Math.imul(j,Zt)|0,f=Math.imul(j,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(Mt,ne)|0,f=f+Math.imul(Mt,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 jn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(jn>>>26)|0,jn&=67108863,b=Math.imul(K,Xt),c=Math.imul(K,Jt),c=c+Math.imul(j,Xt)|0,f=Math.imul(j,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(Mt,se)|0,f=f+Math.imul(Mt,oe)|0;var Gn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Gn>>>26)|0,Gn&=67108863,b=Math.imul(K,Qt),c=Math.imul(K,te),c=c+Math.imul(j,Qt)|0,f=Math.imul(j,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 Zn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Zn>>>26)|0,Zn&=67108863,b=Math.imul(K,ee),c=Math.imul(K,re),c=c+Math.imul(j,ee)|0,f=Math.imul(j,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 Yn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Yn>>>26)|0,Yn&=67108863,b=Math.imul(K,ne),c=Math.imul(K,ie),c=c+Math.imul(j,ne)|0,f=Math.imul(j,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 Xn=(L+b|0)+((c&8191)<<13)|0;L=(f+(c>>>13)|0)+(Xn>>>26)|0,Xn&=67108863,b=Math.imul(K,se),c=Math.imul(K,oe),c=c+Math.imul(j,se)|0,f=Math.imul(j,oe);var Jn=(L+b|0)+((c&8191)<<13)|0;return L=(f+(c>>>13)|0)+(Jn>>>26)|0,Jn&=67108863,A[0]=Cn,A[1]=Un,A[2]=On,A[3]=Nn,A[4]=Fn,A[5]=zn,A[6]=Kn,A[7]=qn,A[8]=Dn,A[9]=Wn,A[10]=$n,A[11]=Vn,A[12]=Hn,A[13]=jn,A[14]=Gn,A[15]=Zn,A[16]=Yn,A[17]=Xn,A[18]=Jn,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,G=z&67108863;A=A+(z/67108864|0)|0,G=G+L|0,L=G&67108863,A=A+(G>>>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,G=1;(g.words[0]&G)===0&&z<26;++z,G<<=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 G=I,rt=0;G.cmp(A)!==0;rt++)G=G.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,Hc)})(cn)),cn.exports}var jc=Zo();const Ns=Oi(jc);var nn={exports:{}};var Fs;function Yo(){return Fs||(Fs=1,(function(n,t){var e=Ni(),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)}})(nn,nn.exports)),nn.exports}var oi,zs;function Gc(){if(zs)return oi;zs=1;var n=Yo().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 oi=t,oi}var ai,Ks;function Zc(){if(Ks)return ai;Ks=1;var n=Gc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ai=n(t),ai}var Yc=Zc();const le=Oi(Yc),qs=Bo;var Et={},ci,Ds;function Xc(){if(Ds)return ci;Ds=1;var n=Yo().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 ci=t,ci}var ui,Ws;function Jc(){if(Ws)return ui;Ws=1;var n=Xc(),t="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";return ui=n(t),ui}function We(n,t,e){return t<=n&&n<=e}function xn(n){if(n===void 0)return{};if(n===Object(n))return n;throw TypeError("Could not convert argument to dictionary")}function Qc(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 tu(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 pn=-1;function Vi(n){this.tokens=[].slice.call(n)}Vi.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():pn},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 Ar=-1;function fi(n,t){if(n)throw TypeError("Decoder error");return t||65533}var gn="utf-8";function yn(n,t){if(!(this instanceof yn))return new yn(n,t);if(n=n!==void 0?String(n).toLowerCase():gn,n!==gn)throw new Error("Encoding not supported. Only utf-8 is supported");t=xn(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})}yn.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=xn(e),this._streaming||(this._decoder=new eu({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!e.stream;for(var s=new Vi(r),i=[],o;!s.endOfStream()&&(o=this._decoder.handler(s,s.read()),o!==Ar);)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===Ar)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),tu(i)}};function mn(n,t){if(!(this instanceof mn))return new mn(n,t);if(n=n!==void 0?String(n).toLowerCase():gn,n!==gn)throw new Error("Encoding not supported. Only utf-8 is supported");t=xn(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}mn.prototype={encode:function(t,e){t=t?String(t):"",e=xn(e),this._streaming||(this._encoder=new ru(this._options)),this._streaming=!!e.stream;for(var r=[],s=new Vi(Qc(t)),i;!s.endOfStream()&&(i=this._encoder.handler(s,s.read()),i!==Ar);)Array.isArray(i)?r.push.apply(r,i):r.push(i);if(!this._streaming){for(;i=this._encoder.handler(s,s.read()),i!==Ar;)Array.isArray(i)?r.push.apply(r,i):r.push(i);this._encoder=null}return new Uint8Array(r)}};function eu(n){var t=n.fatal,e=0,r=0,s=0,i=128,o=191;this.handler=function(u,p){if(p===pn&&s!==0)return s=0,fi(t);if(p===pn)return Ar;if(s===0){if(We(p,0,127))return p;if(We(p,194,223))s=1,e=p-192;else if(We(p,224,239))p===224&&(i=160),p===237&&(o=159),s=2,e=p-224;else if(We(p,240,244))p===240&&(i=144),p===244&&(o=143),s=3,e=p-240;else return fi(t);return e=e<<6*s,null}if(!We(p,i,o))return e=s=r=0,i=128,o=191,u.prepend(p),fi(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 ru(n){n.fatal,this.handler=function(t,e){if(e===pn)return Ar;if(We(e,0,127))return e;var r,s;We(e,128,2047)?(r=1,s=192):We(e,2048,65535)?(r=2,s=224):We(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 nu=Object.freeze(Object.defineProperty({__proto__:null,TextDecoder:yn,TextEncoder:mn},Symbol.toStringTag,{value:"Module"})),iu=ko(nu);var $s;function su(){if($s)return Et;$s=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(Jc()),u=r(iu),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 hi=su(),W={},Vs;function ou(){if(Vs)return W;Vs=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=Ni();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),G=I.readUInt32LE(w+4);return M(G,z)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeUInt32LE(z.lo32,I),G.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),G=I.readUInt32BE(w+4);return M(z,G)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeUInt32BE(z.hi32,I),G.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),G=I.readInt32LE(w+4);return M(G,z)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeUInt32LE(z.lo32,I),G.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),G=I.readUInt32BE(w+4);return M(z,G)}encode(f,w,I=0){const z=T(f),G=e(w);return G.writeInt32BE(z.hi32,I),G.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 G=0;for(;G<z;)I+=this.elementLayout.getSpan(f,w+I),++G}return I}decode(f,w=0){const I=[];let z=0,G=this.count;for(G instanceof o&&(G=G.decode(f,w));z<G;)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,G=f.reduce((rt,st)=>rt+z.encode(st,w,I+rt),0);return this.count instanceof o&&this.count.encode(f.length,w,I),G}}W.Sequence=ot;class C extends r{constructor(f,w,I){if(!(Array.isArray(f)&&f.reduce((G,rt)=>G&&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 G of f)if(0>G.span&&G.property===void 0)throw new Error("fields cannot contain unnamed variable-length layout");let z=-1;try{z=f.reduce((G,rt)=>G+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,G)=>{const rt=G.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 G=0,rt=0;for(const st of this.fields){let kt=st.span;if(rt=0<kt?kt:0,st.property!==void 0){const St=f[st.property];St!==void 0&&(rt=st.encode(St,w,I),0>kt&&(kt=st.getSpan(w,I)))}G=I,I+=kt}return G+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 G=-1;w&&(G=w.span,0<=G&&(f instanceof v||f instanceof B)&&(G+=z.layout.span)),super(G,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,G=z.decode(f,w),rt=this.registry[G];if(rt===void 0){const st=this.defaultLayout;let kt=0;this.usesPrefixDiscriminator&&(kt=z.layout.span),I=this.makeDestinationObject(),I[z.property]=G,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 G=this.discriminator,rt=this.defaultLayout;let st=0;return this.usesPrefixDiscriminator&&(st=G.layout.span),G.encode(f[G.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 G=f.span;0>f.span&&(G=I?I.span:0,0<=G&&f.usesPrefixDiscriminator&&(G+=f.discriminator.layout.span)),super(G,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 G=z;if(this.layout&&(this.layout.encode(f[this.property],w,I+z),G+=this.layout.getSpan(w,I+z),0<=this.union.span&&G>this.union.span))throw new Error("encoded variant overruns containing union");return G}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(G){return z=a(G),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 G of this.fields)G.property!==void 0&&(I[G.property]=G.decode(f));return I}encode(f,w,I=0){const z=this.word.decode(w,I);this._packedSetValue(z);for(const G of this.fields)if(G.property!==void 0){const rt=f[G.property];rt!==void 0&&G.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,G=f.fields.reduce((rt,st)=>rt+st.bits,0);if(w+G>z)throw new Error("bits too long for span remainder ("+(z-G)+" of "+z+" remain)");this.container=f,this.bits=w,this.valueMask=(1<<w)-1,w===32&&(this.valueMask=4294967295),this.start=G,this.container.msb&&(this.start=z-G-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 G=e(f);return e(w).write(G.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"),G=z.length;if(I+G>w.length)throw new RangeError("encoding overruns Buffer");const rt=e(w);return z.copy(rt,I),rt[I+G]=0,G+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"),G=z.length;if(0<=this.maxSpan&&this.maxSpan<G)throw new RangeError("text length exceeds maxSpan");if(I+G>w.length)throw new RangeError("encoding overruns Buffer");return z.copy(e(w),I),G}}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=ou(),au=8078e3,cu=8078001,uu=8078004,fu=8078005,hu=8078006,lu=8078011;function Xo(n){return Array.isArray(n)?"%5B"+n.map(Xo).join("%2C%20")+"%5D":typeof n=="bigint"?`${n}n`:encodeURIComponent(String(n!=null&&Object.getPrototypeOf(n)===null?{...n}:n))}function du([n,t]){return`${n}=${Xo(t)}`}function pu(n){const t=Object.entries(n).map(du).join("&");return btoa(t)}function gu(n,t={}){{let e=`Solana error #${n}; Decode this error by running \`npx @solana/errors decode -- ${n}`;return Object.keys(t).length&&(e+=` '${pu(t)}'`),`${e}\``}}var kr=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=gu(n,e);super(s,r),this.context={__code:n,...e},this.name="SolanaError"}};function yu(n,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(n)}function mu(n){return Object.freeze({...n,encode:t=>{const e=new Uint8Array(yu(t,n));return n.write(t,e,0),e}})}function wu(n){return Object.freeze({...n,decode:(t,e=0)=>n.read(t,e)[0]})}function mr(n){return"fixedSize"in n&&typeof n.fixedSize=="number"}function bu(n,t){if(mr(n)!==mr(t))throw new kr(uu);if(mr(n)&&mr(t)&&n.fixedSize!==t.fixedSize)throw new kr(fu,{decoderFixedSize:t.fixedSize,encoderFixedSize:n.fixedSize});if(!mr(n)&&!mr(t)&&n.maxSize!==t.maxSize)throw new kr(hu,{decoderMaxSize:t.maxSize,encoderMaxSize:n.maxSize});return{...t,...n,decode:t.decode,encode:n.encode,read:t.read,write:n.write}}function ku(n,t,e=0){if(t.length-e<=0)throw new kr(au,{codecDescription:n})}function vu(n,t,e,r=0){const s=e.length-r;if(s<t)throw new kr(cu,{bytesLength:s,codecDescription:n,expected:t})}function Su(n,t,e,r){if(r<t||r>e)throw new kr(lu,{codecDescription:n,max:e,min:t,value:r})}function Jo(n){return n?.endian!==1}function xu(n){return mu({fixedSize:n.size,write(t,e,r){n.range&&Su(n.name,n.range[0],n.range[1],t);const s=new ArrayBuffer(n.size);return n.set(new DataView(s),t,Jo(n.config)),e.set(new Uint8Array(s),r),r+n.size}})}function Eu(n){return wu({fixedSize:n.size,read(t,e=0){ku(n.name,t,e),vu(n.name,n.size,t,e);const r=new DataView(Iu(t,e,n.size));return[n.get(r,Jo(n.config)),e+n.size]}})}function Iu(n,t,e){const r=n.byteOffset+(t??0),s=e??n.byteLength;return n.buffer.slice(r,r+s)}var Qo=(n={})=>xu({config:n,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(t,e,r)=>t.setBigUint64(0,BigInt(e),r),size:8}),Au=(n={})=>Eu({config:n,get:(t,e)=>t.getBigUint64(0,e),name:"u64",size:8}),_u=(n={})=>bu(Qo(n),Au(n));class Bu 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 Ru(n){return Hr(n)&&typeof n[Symbol.iterator]=="function"}function Hr(n){return typeof n=="object"&&n!=null}function wn(n){return Hr(n)&&!Array.isArray(n)}function Be(n){return typeof n=="symbol"?n.toString():typeof n=="string"?JSON.stringify(n):`${n}`}function Mu(n){const{done:t,value:e}=n.next();return t?void 0:e}function Tu(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*Hs(n,t,e,r){Ru(n)||(n=[n]);for(const s of n){const i=Tu(s,t,e,r);i&&(yield i)}}function*Hi(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 _=Hi(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):Hr(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 Fe=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 Hs(B,v,this,p)}:this.validator=()=>[],i?this.refiner=(p,v)=>{const B=i(p,v);return Hs(B,v,this,p)}:this.refiner=()=>[]}assert(t,e){return ta(t,this,e)}create(t,e){return et(t,this,e)}is(t){return ea(t,this)}mask(t,e){return Pu(t,this,e)}validate(t,e={}){return jr(t,this,e)}};function ta(n,t,e){const r=jr(n,t,{message:e});if(r[0])throw r[0]}function et(n,t,e){const r=jr(n,t,{coerce:!0,message:e});if(r[0])throw r[0];return r[1]}function Pu(n,t,e){const r=jr(n,t,{coerce:!0,mask:!0,message:e});if(r[0])throw r[0];return r[1]}function ea(n,t){return!jr(n,t)[0]}function jr(n,t,e={}){const r=Hi(n,t,e),s=Mu(r);return s[0]?[new Bu(s[0],function*(){for(const o of r)o[0]&&(yield o[0])}),void 0]:[void 0,s[1]]}function hr(n,t){return new Fe({type:n,schema:null,validator:t})}function Lu(){return hr("any",()=>!0)}function nt(n){return new Fe({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 Ne(){return hr("boolean",n=>typeof n=="boolean")}function ji(n){return hr("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 Fe({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 Cu(){return hr("never",()=>!1)}function it(n){return new Fe({...n,validator:(t,e)=>t===null||n.validator(t,e),refiner:(t,e)=>t===null||n.refiner(t,e)})}function q(){return hr("number",n=>typeof n=="number"&&!isNaN(n)||`Expected a number, but received: ${Be(n)}`)}function ut(n){return new Fe({...n,validator:(t,e)=>t===void 0||n.validator(t,e),refiner:(t,e)=>t===void 0||n.refiner(t,e)})}function ra(n,t){return new Fe({type:"record",schema:null,*entries(e){if(Hr(e))for(const r in e){const s=e[r];yield[r,r,n],yield[r,s,t]}},validator(e){return wn(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return wn(e)?{...e}:e}})}function J(){return hr("string",n=>typeof n=="string"||`Expected a string, but received: ${Be(n)}`)}function Gi(n){const t=Cu();return new Fe({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 Fe({type:"type",schema:n,*entries(e){if(Hr(e))for(const r of t)yield[r,e[r],n[r]]},validator(e){return wn(e)||`Expected an object, but received: ${Be(e)}`},coercer(e){return wn(e)?{...e}:e}})}function be(n){const t=n.map(e=>e.type).join(" | ");return new Fe({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]=Hi(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 Mr(){return hr("unknown",()=>!0)}function Gr(n,t,e){return new Fe({...n,coercer:(r,s)=>ea(r,t)?n.coercer(e(r,s),s):n.coercer(r,s)})}var sn,Uu=new Uint8Array(16);function na(){if(!sn&&(sn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!sn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return sn(Uu)}const Ou=/^(?:[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 En(n){return typeof n=="string"&&Ou.test(n)}var he=[];for(var li=0;li<256;++li)he.push((li+256).toString(16).substr(1));function In(n){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,e=(he[n[t+0]]+he[n[t+1]]+he[n[t+2]]+he[n[t+3]]+"-"+he[n[t+4]]+he[n[t+5]]+"-"+he[n[t+6]]+he[n[t+7]]+"-"+he[n[t+8]]+he[n[t+9]]+"-"+he[n[t+10]]+he[n[t+11]]+he[n[t+12]]+he[n[t+13]]+he[n[t+14]]+he[n[t+15]]).toLowerCase();if(!En(e))throw TypeError("Stringified UUID is invalid");return e}var js,di,pi=0,gi=0;function Nu(n,t,e){var r=t&&e||0,s=t||new Array(16);n=n||{};var i=n.node||js,o=n.clockseq!==void 0?n.clockseq:di;if(i==null||o==null){var u=n.random||(n.rng||na)();i==null&&(i=js=[u[0]|1,u[1],u[2],u[3],u[4],u[5]]),o==null&&(o=di=(u[6]<<8|u[7])&16383)}var p=n.msecs!==void 0?n.msecs:Date.now(),v=n.nsecs!==void 0?n.nsecs:gi+1,B=p-pi+(v-gi)/1e4;if(B<0&&n.clockseq===void 0&&(o=o+1&16383),(B<0||p>pi)&&n.nsecs===void 0&&(v=0),v>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");pi=p,gi=v,di=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||In(s)}function ia(n){if(!En(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 Fu(n){n=unescape(encodeURIComponent(n));for(var t=[],e=0;e<n.length;++e)t.push(n.charCodeAt(e));return t}var zu="6ba7b810-9dad-11d1-80b4-00c04fd430c8",Ku="6ba7b811-9dad-11d1-80b4-00c04fd430c8";function sa(n,t,e){function r(s,i,o,u){if(typeof s=="string"&&(s=Fu(s)),typeof i=="string"&&(i=ia(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 In(p)}try{r.name=n}catch{}return r.DNS=zu,r.URL=Ku,r}function qu(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 Du(Wu($u(n),n.length*8))}function Du(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 oa(n){return(n+64>>>9<<4)+14+1}function Wu(n,t){n[t>>5]|=128<<t%32,n[oa(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 $u(n){if(n.length===0)return[];for(var t=n.length*8,e=new Uint32Array(oa(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 Vu(n,t){return n<<t|n>>>32-t}function An(n,t,e,r,s,i){return Je(Vu(Je(Je(t,n),Je(r,i)),s),e)}function ge(n,t,e,r,s,i,o){return An(t&e|~t&r,n,t,s,i,o)}function ye(n,t,e,r,s,i,o){return An(t&r|e&~r,n,t,s,i,o)}function me(n,t,e,r,s,i,o){return An(t^e^r,n,t,s,i,o)}function we(n,t,e,r,s,i,o){return An(e^(t|~r),n,t,s,i,o)}var Hu=sa("v3",48,qu);function ju(n,t,e){n=n||{};var r=n.random||(n.rng||na)();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 In(r)}function Gu(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 yi(n,t){return n<<t|n>>>32-t}function Zu(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]=yi(_[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=yi(M,5)+Gu(X,N,F,H)+$+t[X]+_[Y]>>>0;$=H,H=F,F=yi(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 Yu=sa("v5",80,Zu);const Xu="00000000-0000-0000-0000-000000000000";function Ju(n){if(!En(n))throw TypeError("Invalid UUID");return parseInt(n.substr(14,1),16)}const Qu=Object.freeze(Object.defineProperty({__proto__:null,NIL:Xu,parse:ia,stringify:In,v1:Nu,v3:Hu,v4:ju,v5:Yu,validate:En,version:Ju},Symbol.toStringTag,{value:"Module"})),aa=ko(Qu);var mi,Gs;function tf(){if(Gs)return mi;Gs=1;const n=aa.v4;return mi=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},mi}var wi,Zs;function ef(){if(Zs)return wi;Zs=1;const n=aa.v4,t=tf(),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 wi=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)},wi}var rf=ef();const nf=Oi(rf);var sf=class extends vo{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 of(n,t){return new sf(n,t)}var af=class{encode(n){return JSON.stringify(n)}decode(n){return JSON.parse(n)}},cf=class extends vo{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 af,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 uf=BigInt(0),Cr=BigInt(1),ff=BigInt(2),hf=BigInt(7),lf=BigInt(256),df=BigInt(113),ca=[],ua=[],fa=[];for(let n=0,t=Cr,e=1,r=0;n<24;n++){[e,r]=[r,(2*e+3*r)%5],ca.push(2*(5*r+e)),ua.push((n+1)*(n+2)/2%64);let s=uf;for(let i=0;i<7;i++)t=(t<<Cr^(t>>hf)*df)%lf,t&ff&&(s^=Cr<<(Cr<<BigInt(i))-Cr);fa.push(s)}const ha=Ao(fa,!0),pf=ha[0],gf=ha[1],Ys=(n,t,e)=>e>32?rc(n,t,e):tc(n,t,e),Xs=(n,t,e)=>e>32?nc(n,t,e):ec(n,t,e);function yf(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=Ys(v,B,1)^e[u],_=Xs(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=ua[o],p=Ys(s,i,u),v=Xs(s,i,u),B=ca[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]^=pf[r],n[1]^=gf[r]}tr(e)}class Zi extends Fi{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,Nr(r),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=$a(this.state)}clone(){return this._cloneInto()}keccak(){xs(this.state32),yf(this.state32,this.rounds),xs(this.state32),this.posOut=0,this.pos=0}update(t){Er(this),t=vn(t),He(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){Er(this,!1),He(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 Nr(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(xo(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,tr(this.state)}_cloneInto(t){const{blockLen:e,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return t||(t=new Zi(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 mf=(n,t,e)=>zi(()=>new Zi(t,n,e)),Js=mf(1,136,256/8);class la extends Fi{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,So(t);const r=vn(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),tr(i)}update(t){return Er(this),this.iHash.update(t),this}digestInto(t){Er(this),He(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 da=(n,t,e)=>new la(n,t).update(e).digest();da.create=(n,t)=>new la(n,t);const Qs=(n,t)=>(n+(n>=0?t:-t)/pa)/t;function wf(n,t,e){const[[r,s],[i,o]]=t,u=Qs(o*n,e),p=Qs(-s*n,e);let v=n-u*r-p*i,B=-u*s-p*o;const P=v<Ve,_=B<Ve;P&&(v=-v),_&&(B=-B);const S=$r(Math.ceil(To(e)/2))+vr;if(v<Ve||v>=S||B<Ve||B>=S)throw new Error("splitScalar (endomorphism): failed, k="+n);return{k1neg:P,k1:v,k2neg:_,k2:B}}function Bi(n){if(!["compact","recovered","der"].includes(n))throw new Error('Signature format must be "compact", "recovered", or "der"');return n}function bi(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&&Bi(e.format),e}class bf extends Error{constructor(t=""){super(t)}}const De={Err:bf,_tlv:{encode:(n,t)=>{const{Err:e}=De;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=rn(r);if(s.length/2&128)throw new e("tlv.encode: long form length too big");const i=r>127?rn(s.length/2|128):"";return rn(n)+i+s+t},decode(n,t){const{Err:e}=De;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}=De;if(n<Ve)throw new t("integer: negative integers are not allowed");let e=rn(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}=De;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 Sn(n)}},toSig(n){const{Err:t,_int:e,_tlv:r}=De,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}=De,r=t.encode(2,e.encode(n.r)),s=t.encode(2,e.encode(n.s)),i=r+s;return t.encode(48,i)}},Ve=BigInt(0),vr=BigInt(1),pa=BigInt(2),on=BigInt(3),kf=BigInt(4);function wr(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 vf(n,t={}){const e=jo("weierstrass",n,t),{Fp:r,Fn:s}=e;let i=e.CURVE;const{h:o,n:u}=i;Vr(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=ya(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 Pe(ga(E),k)}else return Pe(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,on),kf),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 wf(V,p.basises,s.ORDER)}const Q=ln((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=ln(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=dn(l,y),a=dn(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(on),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,on),{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,on);let I=r.mul(a,k),z=r.mul(l,E),G=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,G),st=r.sub(st,kt),kt=r.add(l,g),L=r.add(E,A),kt=r.mul(kt,L),L=r.add(z,G),kt=r.sub(kt,L),c=r.mul(f,st),L=r.mul(w,G),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),G=r.mul(f,G),st=r.mul(w,st),z=r.add(z,G),G=r.sub(I,G),G=r.mul(f,G),st=r.add(st,G),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=>ir(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 ir(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===Ve||l.is0())return C.ZERO;if(y===vr)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}=Mc(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===vr?!0:y?y(C,this):D.unsafe(this,u).is0()}clearCofactor(){const{clearCofactor:y}=t;return o===vr?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 or(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 ir(C,y)}static msm(y,a){return Ho(C,s,y,a)}static fromPrivateKey(y){return C.BASE.multiply(wr(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 Vo(C,t.endo?Math.ceil(U/2):U);return C.BASE.precompute(8),C}function ga(n){return Uint8Array.of(n?2:3)}function ya(n,t){return{secretKey:t.BYTES,publicKey:1+n.BYTES,publicKeyUncompressed:1+2*n.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Sf(n,t={}){const{Fn:e}=n,r=t.randomBytes||Ki,s=Object.assign(ya(n.Fp,e),{seed:Do(e.ORDER)});function i(S){try{return!!wr(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 _c(_e(S,s.seed,"seed"),e.ORDER)}function p(S,T=!0){return n.BASE.multiply(wr(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=wr(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=>wr(e,S),precompute(S=8,T=n.BASE){return T.precompute(S,!1)}},lengths:s})}function xf(n,t,e={}){So(t),Vr(e,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=e.randomBytes||Ki,s=e.hmac||((a,...l)=>da(t,a,Pe(...l))),{Fp:i,Fn:o}=n,{ORDER:u,BITS:p}=o,{keygen:v,getPublicKey:B,getSharedSecret:P,utils:_,lengths:S}=Sf(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>>vr;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){Bi(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}=De.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(hn(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*pa<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(Pe(ga((A&1)===0),c)),w=o.inv(b),I=X(Dt("msgHash",l)),z=o.create(-I*w),G=o.create(E*w),rt=n.BASE.multiplyUnsafe(z).add(f.multiplyUnsafe(G));if(rt.is0())throw new Error("point at infinify");return rt.assertValidity(),rt}hasHighS(){return N(this.s)}toBytes(l=M){if(Bi(l),l==="der")return hn(De.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 Pe(Uint8Array.of(this.recovery),g,k)}return Pe(g,k)}toHex(l){return or(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 or(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return or(this.toBytes("compact"))}}const Y=e.bits2int||function(l){if(l.length>8192)throw new Error("input is too large");const g=Sn(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=$r(p);function ct(a){return _i("num < 2^"+p,a,Ve,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}=bi(g,T);a=ot(a,E);const L=X(a),b=wr(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=Pe(...c),w=L;function I(z){const G=Y(z);if(!o.isValidNot0(G))return;const rt=o.inv(G),st=n.BASE.multiply(G).toAffine(),kt=o.create(st.x);if(kt===Ve)return;const St=o.create(rt*o.create(w+kt*b));if(St===Ve)return;let At=(st.x===kt?0:2)|Number(st.y&vr),Ie=St;return k&&N(St)&&(Ie=o.neg(St),At^=1),new $(kt,Ie,At)}return{seed:f,k2sig:I}}function U(a,l,g={}){a=Dt("message",a);const{seed:k,k2sig:E}=C(a,l,g);return mc(t.outputLen,o.BYTES,s)(k,E)}function D(a){let l;const g=typeof a=="string"||Wr(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 De.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}=bi(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),G=o.create(I*z),rt=o.create(f*z),st=n.BASE.multiplyUnsafe(G).add(c.multiplyUnsafe(rt));return st.is0()?!1:o.create(st.x)===f}catch{return!1}}function y(a,l,g={}){const{prehash:k}=bi(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 Ef(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=fr(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 If(n){const{CURVE:t,curveOpts:e}=Ef(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 Af(n,t){const e=t.Point;return Object.assign({},t,{ProjectivePoint:e,CURVE:Object.assign({},n,Ko(e.Fn.ORDER,e.Fn.BITS))})}function _f(n){const{CURVE:t,curveOpts:e,hash:r,ecdsaOpts:s}=If(n),i=vf(t,e),o=xf(i,r,s);return Af(n,o)}function Bf(n,t){const e=r=>_f({...n,hash:r});return{...e(t),create:e}}const Yi={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},Rf={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},to=BigInt(2);function Mf(n){const t=Yi.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(_,to,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,to,t);if(!Ri.eql(Ri.sqr(Q),n))throw new Error("Cannot find square root");return Q}const Ri=fr(Yi.p,{sqrt:Mf}),Xi=Bf({...Yi,Fp:Ri,lowS:!0,endo:Rf},Bo),Tf=Rr.utils.randomPrivateKey,eo=()=>{const n=Rr.utils.randomPrivateKey(),t=bn(n),e=new Uint8Array(64);return e.set(n),e.set(t,32),{publicKey:t,secretKey:e}},bn=Rr.getPublicKey;function ro(n){try{return Rr.ExtendedPoint.fromHex(n),!0}catch{return!1}}const Ji=(n,t)=>Rr.sign(n,t.slice(0,32)),Pf=Rr.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 Qi{constructor(t){Object.assign(this,t)}encode(){return ft.Buffer.from(hi.serialize(Or,this))}static decode(t){return hi.deserialize(Or,this,t)}static decodeUnchecked(t){return hi.deserializeUnchecked(Or,this,t)}}class Lf extends Qi{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 Or=new Map;var ma;const wa=32,Oe=32;function Cf(n){return n._bn!==void 0}let no=1;class tt extends Qi{constructor(t){if(super({}),this._bn=void 0,Cf(t))this._bn=t._bn;else{if(typeof t=="string"){const e=le.decode(t);if(e.length!=Oe)throw new Error("Invalid public key input");this._bn=new Ns(e)}else this._bn=new Ns(t);if(this._bn.byteLength()>Oe)throw new Error("Invalid public key input")}}static unique(){const t=new tt(no);return no+=1,new tt(t.toBuffer())}equals(t){return this._bn.eq(t._bn)}toBase58(){return le.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===Oe)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=qs(s);return new tt(i)}static createProgramAddressSync(t,e){let r=ft.Buffer.alloc(0);t.forEach(function(i){if(i.length>wa)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=qs(r);if(ro(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 ro(e.toBytes())}}ma=tt;tt.default=new ma("11111111111111111111111111111111");Or.set(tt,{kind:"struct",fields:[["_bn","u256"]]});class Uf{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(Tf()),this._publicKey=yt(bn(this._secretKey))}get publicKey(){return new tt(this._publicKey)}get secretKey(){return ft.Buffer.concat([this._secretKey,this._publicKey],64)}}const Of=new tt("BPFLoader1111111111111111111111111111111111"),Qe=1232,_n=127,zr=64;class ts extends Error{constructor(t){super(`Signature ${t} has expired: block height exceeded.`),this.signature=void 0,this.signature=t}}Object.defineProperty(ts.prototype,"name",{value:"TransactionExpiredBlockheightExceededError"});class es 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(es.prototype,"name",{value:"TransactionExpiredTimeoutError"});class br extends Error{constructor(t){super(`Signature ${t} has expired: the nonce is no longer valid.`),this.signature=void 0,this.signature=t}}Object.defineProperty(br.prototype,"name",{value:"TransactionExpiredNonceInvalidError"});class Kr{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),Nf=(n="signature")=>R.blob(64,n),sr=(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},Ff=(n="authorized")=>R.struct([mt("staker"),mt("withdrawer")],n),zf=(n="lockup")=>R.struct([R.ns64("unixTimestamp"),R.ns64("epoch"),mt("custodian")],n),Kf=(n="voteInit")=>R.struct([mt("nodePubkey"),mt("authorizedVoter"),mt("authorizedWithdrawer"),R.u8("commission")],n),qf=(n="voteAuthorizeWithSeedArgs")=>R.struct([R.u32("voteAuthorizationType"),mt("currentAuthorityDerivedKeyOwnerPubkey"),sr("currentAuthorityDerivedKeySeed"),mt("newAuthorized")],n);function ba(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 ba({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 Bn{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 Bn(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 ka="Reached end of buffer unexpectedly";function Le(n){if(n.length===0)throw new Error(ka);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(ka);return n.splice(...t)}class Re{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:le.decode(t.data)}))}get addressTableLookups(){return[]}getAccountKeys(){return new Kr(this.staticAccountKeys)}static compile(t){const e=Bn.compile(t.instructions,t.payerKey),[r,s]=e.getMessageComponents(),o=new Kr(s).compileInstructions(t.instructions).map(u=>({programIdIndex:u.programIdIndex,accounts:u.accountKeyIndexes,data:le.encode(u.data)}));return new Re({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(le.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(Qe);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:le.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=Le(e);if(r!==(r&_n))throw new Error("Versioned messages must be deserialized with VersionedMessage.deserialize()");const s=Le(e),i=Le(e),o=ke(e);let u=[];for(let _=0;_<o;_++){const S=ve(e,0,Oe);u.push(new tt(ft.Buffer.from(S)))}const p=ve(e,0,Oe),v=ke(e);let B=[];for(let _=0;_<v;_++){const S=Le(e),T=ke(e),M=ve(e,0,T),N=ke(e),F=ve(e,0,N),H=le.encode(ft.Buffer.from(F));B.push({programIdIndex:S,accounts:M,data:H})}const P={header:{numRequiredSignatures:r,numReadonlySignedAccounts:s,numReadonlyUnsignedAccounts:i},recentBlockhash:le.encode(ft.Buffer.from(p)),accountKeys:u,instructions:B};return new Re(P)}}class cr{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 Kr(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=Bn.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 Kr(u,s).compileInstructions(t.instructions);return new cr({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(Qe),v=o.encode({prefix:128,header:this.header,staticAccountKeysLength:new Uint8Array(t),staticAccountKeys:this.staticAccountKeys.map(B=>B.toBytes()),recentBlockhash:le.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(Qe);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(Qe);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=Le(e),s=r&_n;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:Le(e),numReadonlySignedAccounts:Le(e),numReadonlyUnsignedAccounts:Le(e)},u=[],p=ke(e);for(let T=0;T<p;T++)u.push(new tt(ve(e,0,Oe)));const v=le.encode(ve(e,0,Oe)),B=ke(e),P=[];for(let T=0;T<B;T++){const M=Le(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,Oe)),N=ke(e),F=ve(e,0,N),H=ke(e),$=ve(e,0,H);S.push({accountKey:M,writableIndexes:F,readonlyIndexes:$})}return new cr({header:o,staticAccountKeys:u,recentBlockhash:v,compiledInstructions:P,addressTableLookups:S})}}const rs={deserializeMessageVersion(n){const t=n[0],e=t&_n;return e===t?"legacy":e},deserialize:n=>{const t=rs.deserializeMessageVersion(n);if(t==="legacy")return Re.from(n);if(t===0)return cr.deserialize(n);throw new Error(`Transaction message version ${t} deserialization is not supported`)}};let qe=(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 Df=ft.Buffer.alloc(zr).fill(0);class It{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 vt{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 It(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:le.encode(N)}});return T.forEach(M=>{bt(M.programIdIndex>=0),M.accounts.forEach(N=>bt(N>=0))}),new Re({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=Ji(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):Pf(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<=Qe,`Transaction too large: ${i.length} > ${Qe}`),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,zr);s.push(le.encode(ft.Buffer.from(o)))}return vt.populate(Re.from(e),s)}static populate(t,e=[]){const r=new vt;return r.recentBlockhash=t.recentBlockhash,t.header.numRequiredSignatures>0&&(r.feePayer=t.accountKeys[0]),e.forEach((s,i)=>{const o={signature:s==le.encode(Df)?null:le.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 It({keys:i,programId:t.accountKeys[s.programIdIndex],data:le.decode(s.data)}))}),r._message=t,r._json=r.toJSON(),r}}class ns{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 It({programId:N,data:yt(T.data),keys:M}))}return new ns({payerKey:_,instructions:S,recentBlockhash:i})}compileToLegacyMessage(){return Re.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions})}compileToV0Message(t){return cr.compile({payerKey:this.payerKey,recentBlockhash:this.recentBlockhash,instructions:this.instructions,addressLookupTableAccounts:t})}}class is{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(zr));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(Nf(),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,zr)));const i=rs.deserialize(new Uint8Array(e));return new is(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]=Ji(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 Wf=160,$f=64,Vf=Wf/$f,va=1e3/Vf,Te=new tt("SysvarC1ock11111111111111111111111111111111"),Hf=new tt("SysvarEpochSchedu1e111111111111111111111111"),jf=new tt("Sysvar1nstructions1111111111111111111111111"),un=new tt("SysvarRecentB1ockHashes11111111111111111111"),_r=new tt("SysvarRent111111111111111111111111111111111"),Gf=new tt("SysvarRewards111111111111111111111111111111"),Zf=new tt("SysvarS1otHashes111111111111111111111111111"),Yf=new tt("SysvarS1otHistory11111111111111111111111111"),fn=new tt("SysvarStakeHistory1111111111111111111111111");class qr 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.
|