@acedatacloud/nexior 3.362.4 → 3.362.6
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/{ApiCodeButton-BA7mDSbv.js → ApiCodeButton-CE_3dTKv.js} +1 -1
- package/dist/assets/{ApiCodeDialog-BsRU8WFT.js → ApiCodeDialog-DS-qo21c.js} +2 -2
- package/dist/assets/{Artifacts-DJBH37uq.js → Artifacts-9ieQ3Qem.js} +1 -1
- package/dist/assets/{AskUserQuestionCard-DjYhfs68.js → AskUserQuestionCard-BJPTyd6G.js} +1 -1
- package/dist/assets/{AudioPreview-4SXEbJja.js → AudioPreview-B1g4dbrH.js} +1 -1
- package/dist/assets/{Auth-BOif7xOO.js → Auth-DRUyBkIK.js} +1 -1
- package/dist/assets/{Bare-B5Gm4K8P.js → Bare-Bx-zDwLA.js} +1 -1
- package/dist/assets/{BotPlaceholder-C--FHvts.js → BotPlaceholder-BvZp_nGe.js} +1 -1
- package/dist/assets/{BottomFooter-Diy1dxTR.js → BottomFooter-UFm8DUHu.js} +1 -1
- package/dist/assets/{BrowseConnectors-BfZCwj7s.js → BrowseConnectors-Y_9juoXJ.js} +1 -1
- package/dist/assets/{BrowserPairingDialog-CwcFHrVH.js → BrowserPairingDialog-B3Cujdos.js} +1 -1
- package/dist/assets/{Callback-DUubRo9v.js → Callback-B65AaJuR.js} +1 -1
- package/dist/assets/{CodeSnippet-B0neSlgP.js → CodeSnippet-BVSUZgl2.js} +1 -1
- package/dist/assets/ConnectorUtil-CEBYBGCR.js +1 -0
- package/dist/assets/{Console-D8pv2zPD.js → Console-B8JVXKxg.js} +1 -1
- package/dist/assets/ConstantsUtil-CM7Z7qJI.js +884 -0
- package/dist/assets/{Consumption-BK4nImFR.js → Consumption-B8Aoy3S9.js} +1 -1
- package/dist/assets/{Conversation-Cv9VbfEe.js → Conversation-DfcpbC5-.js} +1 -1
- package/dist/assets/{Conversation-BXtScsLN.js → Conversation-DiIcFh0M.js} +1 -1
- package/dist/assets/{CopyToClipboard-AvaqCeXT.js → CopyToClipboard-BWMbyEe8.js} +1 -1
- package/dist/assets/Detail-B2RHER-w.js +2 -0
- package/dist/assets/{Detail-BbDnDZ62.css → Detail-DMI9op2Z.css} +1 -1
- package/dist/assets/Extra-C1xhTX1S.js +1 -0
- package/dist/assets/{FilePreview-BNtZwLa2.js → FilePreview-DJNOTisa.js} +1 -1
- package/dist/assets/{Hailuo-CUHHmlNz.js → Hailuo-eKt1lI2M.js} +1 -1
- package/dist/assets/{History-BrR8Yf_Z.js → History-Cy1EnaCx.js} +1 -1
- package/dist/assets/{ImagePreview-DPhaVe-K.js → ImagePreview-3n2g823_.js} +1 -1
- package/dist/assets/{ImageWrapper-DwDvvMD7.js → ImageWrapper-Zf-ml_fL.js} +1 -1
- package/dist/assets/{Index-BadgGV7L.js → Index--3tUnerd.js} +1 -1
- package/dist/assets/{Index-DlofPOmV.js → Index-0HZhlO5T.js} +1 -1
- package/dist/assets/Index-1R3UjWko.js +1 -0
- package/dist/assets/{Index-ChX8EfQ8.js → Index-B3lcvGOC.js} +1 -1
- package/dist/assets/{Index-B1Kw72wN.js → Index-BB1bDlkg.js} +1 -1
- package/dist/assets/{Index-BgP1xjT5.js → Index-BDP7PGtI.js} +1 -1
- package/dist/assets/{Index-B83b9_wi.js → Index-BFvPdO-u.js} +1 -1
- package/dist/assets/{Index-BmXYFehz.js → Index-BPGjUAl0.js} +1 -1
- package/dist/assets/{Index-CMSWNfN_.js → Index-BbFvn7Z-.js} +1 -1
- package/dist/assets/{Index-BhVRicE6.js → Index-BbwwdeD2.js} +1 -1
- package/dist/assets/{Index-DWCDjaXA.js → Index-Be4NPAQ_.js} +1 -1
- package/dist/assets/{Index-0tDHczbM.js → Index-BhhD5gr9.js} +1 -1
- package/dist/assets/{Index-7fi1vULC2.js → Index-BjL4FbG62.js} +1 -1
- package/dist/assets/{Index-DbsIgIEX.js → Index-C3ikCwp-.js} +1 -1
- package/dist/assets/{Index-D948p6ES.js → Index-CEvPCkn9.js} +1 -1
- package/dist/assets/Index-CJJhQn0t.js +1 -0
- package/dist/assets/{Index-D8Y03OtA.js → Index-CJR760ks.js} +1 -1
- package/dist/assets/{Index-CGEzzwMb.js → Index-CouiG6eX.js} +1 -1
- package/dist/assets/{Index-D-kQkhOh.js → Index-D1QBQi1h.js} +1 -1
- package/dist/assets/{Index-Bm_crXl-.js → Index-D3OXfvMY.js} +1 -1
- package/dist/assets/Index-DAYPwZIs.js +1 -0
- package/dist/assets/Index-DL2EoTNV.js +1 -0
- package/dist/assets/Index-DUdRx1Bc.js +1 -0
- package/dist/assets/{Index-BIccEBEN.js → Index-D_gLtR0N.js} +1 -1
- package/dist/assets/Index-DhsEyroJ.js +1 -0
- package/dist/assets/{Index-DKrXlrk-.js → Index-DkWBqyko.js} +1 -1
- package/dist/assets/Index-DmTr-_VQ.js +1 -0
- package/dist/assets/{Index-CaIBqmIZ.js → Index-Dqxyoetu.js} +1 -1
- package/dist/assets/{Index-OwzwOsGt.js → Index-Eu8X5f3d.js} +1 -1
- package/dist/assets/{Index-DvmQuJd4.js → Index-MTJitVkG.js} +1 -1
- package/dist/assets/{Index-BthkIMLu.js → Index-ib-vKI7O.js} +1 -1
- package/dist/assets/{Index-CMu0wO8E.js → Index-kBhq5F_C.js} +2 -2
- package/dist/assets/Index-nJ3nXUmG.js +1 -0
- package/dist/assets/{Index-CTZWRaZt.js → Index-qY3svjvY.js} +1 -1
- package/dist/assets/{Index-BXnU9Nhc.js → Index-twLqOP1D.js} +2 -2
- package/dist/assets/{Invitees-DL1P2x5O.js → Invitees-BJIrcNI6.js} +1 -1
- package/dist/assets/List-B-N6yusv.js +1 -0
- package/dist/assets/{List-B7gE17Uu.js → List-CZ7l3Wax.js} +1 -1
- package/dist/assets/List-_-dQIH5k.js +1 -0
- package/dist/assets/{LocalTools-Dw-cSEm5.js → LocalTools-CUogyUSK.js} +1 -1
- package/dist/assets/LocalTools-Di2tl3Hu.js +5 -0
- package/dist/assets/{Logo-B5pb3LXw.js → Logo-BBnNBDj-.js} +1 -1
- package/dist/assets/{Main-gugFahba.js → Main-BbG-g4fC.js} +1 -1
- package/dist/assets/{Message-C0-5k24c.js → Message-YmiY6z2o.js} +2 -2
- package/dist/assets/{Model-DSVl1m8-.js → Model-DAH6d39D.js} +1 -1
- package/dist/assets/Navigator-BWwXDF0d.css +1 -0
- package/dist/assets/{Navigator-B-NGLAVz.js → Navigator-CRlUIJeI.js} +4 -4
- package/dist/assets/{NotFound-Bp7eiYNh.js → NotFound-Bv4oqgfG.js} +1 -1
- package/dist/assets/{PageHeader-5PIb-pRr.js → PageHeader-BBHZISMg.js} +1 -1
- package/dist/assets/Pay-MEi3wA51.js +1 -0
- package/dist/assets/{Player-BDjTM_TZ.js → Player-ByUiLBZ1.js} +1 -1
- package/dist/assets/{Poivelle-CATRUvJM.js → Poivelle-CrpCCg_p.js} +1 -1
- package/dist/assets/{RealtimeCall-4hZrsGbX.js → RealtimeCall-BRiInG4T.js} +1 -1
- package/dist/assets/{ReportButton-D07ABYgs.js → ReportButton-DX9HrIMC.js} +1 -1
- package/dist/assets/{ReportDialog-CZ_kBqmh.js → ReportDialog-DA_Yn-7b.js} +1 -1
- package/dist/assets/{ScenarioPaymentMode-DHx-gf_J.js → ScenarioPaymentMode-DyQODbhi.js} +1 -1
- package/dist/assets/{ScheduledTasks-BTdAj5bj.js → ScheduledTasks-C6Uqgv8w.js} +2 -2
- package/dist/assets/{SolanaWalletPickerDialog-Dyf4OrtZ.js → SolanaWalletPickerDialog-ZsnFesYl.js} +1 -1
- package/dist/assets/Status-CtIUekSt.js +1 -0
- package/dist/assets/{Status-7DGGTrl_.css → Status-DWcgs63d.css} +1 -1
- package/dist/assets/{Subscribe-Qqvq4kcb.js → Subscribe-Cu_waTQq.js} +1 -1
- package/dist/assets/{TabSwitcher-SRPkuCQO.js → TabSwitcher-Bx9b8MWc.js} +1 -1
- package/dist/assets/{Tts-CiW_3IBs.js → Tts-CnJ65kmy.js} +1 -1
- package/dist/assets/{VideoPlayer-89YYttvk.js → VideoPlayer-CBlsHZPm.js} +1 -1
- package/dist/assets/{VideoPreview-BlX_PPPl.js → VideoPreview-BqGUxBJp.js} +1 -1
- package/dist/assets/__vite-browser-external-Wme9VPc1.js +1 -0
- package/dist/assets/arrow-down-BwrcDSVc.js +1 -0
- package/dist/assets/{arrow-down-wide-narrow-DaI6Uvy0.js → arrow-down-wide-narrow-btm_oBSR.js} +1 -1
- package/dist/assets/arrow-left-iV7WcLY8.js +1 -0
- package/dist/assets/arrow-right-SxARbRc8.js +1 -0
- package/dist/assets/arrow-up-Bmmr5eqn.js +1 -0
- package/dist/assets/authorizeFlow-Dujmgp0X.js +1 -0
- package/dist/assets/{avatar-C6N1pFHe.js → avatar-Bt5ewMHJ.js} +1 -1
- package/dist/assets/{basic-CPefaDNi.js → basic-CyaHz3wQ.js} +102 -102
- package/dist/assets/{book-open-DAATULmD.js → book-open-CDxQI3yG.js} +1 -1
- package/dist/assets/{box-BShXku0x.js → box-Ru8CN_WA.js} +1 -1
- package/dist/assets/{boxes-OOy_NK7l.js → boxes-foONptLm.js} +1 -1
- package/dist/assets/{brain-Cu-lPJz-.js → brain-BB6Lt1en.js} +1 -1
- package/dist/assets/{chart-no-axes-combined-cFmOkyoL.js → chart-no-axes-combined-BRbG9Cw3.js} +1 -1
- package/dist/assets/{chat-2mnC6M1U.js → chat-9JinPdmu.js} +1 -1
- package/dist/assets/check-D129wUsG.js +1 -0
- package/dist/assets/chevron-down-SmsJAa7D.js +1 -0
- package/dist/assets/chevron-right-CXS1sjHz.js +1 -0
- package/dist/assets/circle-check-CicxfNPX.js +1 -0
- package/dist/assets/{circle-question-mark-ChtLUjT_.js → circle-question-mark-JDwWgK6t.js} +1 -1
- package/dist/assets/{clipboard-list-BYEYDrSf.js → clipboard-list-Bp6XIaej.js} +1 -1
- package/dist/assets/clock-CJP1L4iF.js +1 -0
- package/dist/assets/code-B8mbkWch.js +1 -0
- package/dist/assets/{codingBridge-DSl0gsJ9.js → codingBridge-BorG_XQj.js} +2 -2
- package/dist/assets/codingBridgeNotify-PSvybEiZ.js +2 -0
- package/dist/assets/{coins-DwMmRk4F.js → coins-ze5vlvFY.js} +1 -1
- package/dist/assets/{collapse-GpKda_4j.js → collapse-DuU6GFQ5.js} +1 -1
- package/dist/assets/{common-BKsvEmV6.js → common--c1slE1u.js} +1 -1
- package/dist/assets/{common-BqAdpno_.js → common-1y1xR6Hq.js} +1 -1
- package/dist/assets/{common-0gFKvUbv.js → common-5CGWhWTi.js} +1 -1
- package/dist/assets/{common-37ohr-XT.js → common-BBDXNloB.js} +1 -1
- package/dist/assets/{common-DZSi3Hh_.js → common-BF5e88UD.js} +1 -1
- package/dist/assets/{common-B4An_YTm.js → common-BJk75FxQ.js} +1 -1
- package/dist/assets/{common-xxhDQiia.js → common-BWLoKbl8.js} +1 -1
- package/dist/assets/{common-DUhRMhh_.js → common-Bd6DEYvm.js} +1 -1
- package/dist/assets/{common-DRbsZfM1.js → common-BoO0zCSB.js} +1 -1
- package/dist/assets/{common-jvlgniqw.js → common-C-XfsW3T.js} +1 -1
- package/dist/assets/{common-MsalCK0u.js → common-CJWEoJSY.js} +1 -1
- package/dist/assets/{common-CWaCL-rT.js → common-CJzTDJqS.js} +1 -1
- package/dist/assets/{common-B651gMfj.js → common-DoY46wUe.js} +1 -1
- package/dist/assets/{common-CFrdR7cP.js → common-WBrc34-3.js} +1 -1
- package/dist/assets/{common-CDAa_Wy3.js → common-fo0L07YJ.js} +1 -1
- package/dist/assets/{common-CRdaMls6.js → common-gCVhIaMo.js} +1 -1
- package/dist/assets/{common-OrWJ1sIs.js → common-lwxg-JGj.js} +1 -1
- package/dist/assets/{common-BPYnF8a5.js → common-m8zExVQB.js} +1 -1
- package/dist/assets/{constants-COIxBjYU.js → constants-DB14FZRU.js} +1 -1
- package/dist/assets/{copy-BCep57w1.js → copy-BdCOeTdw.js} +1 -1
- package/dist/assets/{createTaskActions-BXMbF95s.js → createTaskActions-D6qXHcvI.js} +1 -1
- package/dist/assets/{digitalhuman-Bnx1V9mB.js → digitalhuman-CwKgKGbn.js} +1 -1
- package/dist/assets/{dist-BTKWrJnG.js → dist-DQBaVIej.js} +1 -1
- package/dist/assets/{dollar-sign--p8_eDBy.js → dollar-sign-DkOtt1dI.js} +1 -1
- package/dist/assets/{download-Dt0wWdpW.js → download-BI2mDYwL.js} +1 -1
- package/dist/assets/{drawer-BUv2WEZF.js → drawer-LnmmvO3L.js} +1 -1
- package/dist/assets/{dropdown-UTgACN7Q.js → dropdown-BBb4svFZ.js} +1 -1
- package/dist/assets/{dropdown-CBx7fAAp.js → dropdown-CnJ3QdOV.js} +1 -1
- package/dist/assets/{ellipsis-yuDcWrJ4.js → ellipsis-4Z3lDqKY.js} +1 -1
- package/dist/assets/esm-B3VUurFj.js +2 -0
- package/dist/assets/esm-CKnrzlAu.js +1 -0
- package/dist/assets/{esm-Bme5NiGB.js → esm-D-5GXt9s.js} +1 -1
- package/dist/assets/{esm-lz8LG3c9.js → esm-D2u5tK9d.js} +2 -2
- package/dist/assets/{esm-DkEgJOIk.js → esm-Dr_IIEG1.js} +1 -1
- package/dist/assets/{esm--389sWkC.js → esm-H1SE-ruA.js} +1 -1
- package/dist/assets/esm-Og-lQZNt.js +18 -0
- package/dist/assets/{external-link-CYfNxhR8.js → external-link-IrmfutNb.js} +1 -1
- package/dist/assets/{eye-oDfmxiDV.js → eye-tnSE8Qno.js} +1 -1
- package/dist/assets/{file-tjfJc6_R.js → file-e9ByTl0U.js} +1 -1
- package/dist/assets/{file-output-XcBh5O_y.js → file-output-rDweV78w.js} +1 -1
- package/dist/assets/{file-text-DkDLGLgh.js → file-text-Y2G9vk0T.js} +1 -1
- package/dist/assets/{fish-Cx9f10Gm.js → fish-DR2Hlgd-.js} +1 -1
- package/dist/assets/{flux-Bmcbakjy.js → flux-sTLxixZP.js} +1 -1
- package/dist/assets/{folder-DAsfhav6.js → folder-BZzAP02K.js} +1 -1
- package/dist/assets/gauge-DuH-eSYd.js +1 -0
- package/dist/assets/{globe-v5rghgGg.js → globe-YZgVDgdE.js} +1 -1
- package/dist/assets/{grokvideo-C8TWPKxr.js → grokvideo-Dn7GBg1u.js} +1 -1
- package/dist/assets/{pika-CxjINjjD.js → hailuo-DzDrm7SG.js} +1 -1
- package/dist/assets/{headphones-B3pskUHm.js → headphones-mstr7_Lr.js} +1 -1
- package/dist/assets/{history-BZjtFlQ0.js → history-1SsNQiZ6.js} +1 -1
- package/dist/assets/{house-f-R5K_9D.js → house-D6QUY5v4.js} +1 -1
- package/dist/assets/{i18n-DBTdUKZz.js → i18n-xBtzqNWD.js} +1 -1
- package/dist/assets/{image-CR04SjVv.js → image-B4PLmQaF.js} +1 -1
- package/dist/assets/{imageRequests-CLSZhX1d.js → imageRequests-BqaDdLsP.js} +1 -1
- package/dist/assets/index-CcjQxvfb.js +570 -0
- package/dist/assets/index.browser.esm-BbYKZd7a.js +2 -0
- package/dist/assets/{index.es-DB6BDgPr.js → index.es-CNanbZ5D.js} +1 -1
- package/dist/assets/index.es-LzqQdC6F.js +13 -0
- package/dist/assets/{info-zYDWDLVP.js → info-SrHD5DCZ.js} +1 -1
- package/dist/assets/{input-number-B0xcuDnW.js → input-number-DF98nbHf.js} +1 -1
- package/dist/assets/{key-round-BX8FPmcu.js → key-round-C1K7fn2E.js} +1 -1
- package/dist/assets/{kling-tUEGRRxO.js → kling-BXeHpToC.js} +1 -1
- package/dist/assets/{languages-DKKUB3AY.js → languages-B8TIA7Bw.js} +1 -1
- package/dist/assets/{laptop-DSbqbKpY.js → laptop-BOU462cS.js} +1 -1
- package/dist/assets/{lightbulb-NABKBXyu.js → lightbulb-DDWWETX_.js} +1 -1
- package/dist/assets/{link-ByjYUxSr.js → link-BWBJ8c5K.js} +1 -1
- package/dist/assets/loader-circle-BZ57jq7N.js +1 -0
- package/dist/assets/{lock-gJ6pDfMu.js → lock-B1SIzp4d.js} +1 -1
- package/dist/assets/{luma-CfpOdZqb.js → luma-fSxLK8fH.js} +1 -1
- package/dist/assets/{maestro-yRubvEFE.js → maestro-BXindK0f.js} +1 -1
- package/dist/assets/{maestroLanguages-B0F58ijw.js → maestroLanguages-CtrBBaF5.js} +1 -1
- package/dist/assets/{mail-DZpi5J9I.js → mail-BJ1dF_RX.js} +1 -1
- package/dist/assets/{message-circle-D8K26AlF.js → message-circle-KEvtWA2g.js} +1 -1
- package/dist/assets/{mic-DKCR-fiK.js → mic-ZaRjoWSM.js} +1 -1
- package/dist/assets/{midjourney-DM-JhLuX.js → midjourney-t5oJPwWU.js} +1 -1
- package/dist/assets/{minimax-DxlvMTWd.js → minimax-DGMAIlVy.js} +1 -1
- package/dist/assets/{mobileLocalExec-IQ4ZYo9T.js → mobileLocalExec-x8iwdykS.js} +2 -2
- package/dist/assets/{models-DAfyWAqc.js → models-BoFv4bCY.js} +1 -1
- package/dist/assets/{monitor-dn1EyIUV.js → monitor-BX3mTRdr.js} +1 -1
- package/dist/assets/{mouse-pointer-2-C7O4LVbr.js → mouse-pointer-2-ZqhneKIA.js} +1 -1
- package/dist/assets/music-2-C-F9f7u2.js +1 -0
- package/dist/assets/{nanobanana-CxpWeSUn.js → nanobanana-p3gH3Z3F.js} +1 -1
- package/dist/assets/{omni-DxA9Ux8Y.js → omni-CWPmqCiU.js} +1 -1
- package/dist/assets/{openaiimage-DlDGJtH4.js → openaiimage-CkVJ0fOE.js} +1 -1
- package/dist/assets/{pagination-DMwQC4ut.js → pagination-7uZSahOA.js} +1 -1
- package/dist/assets/{pagination-NMff1SYZ.js → pagination-D3ecBdTD.js} +1 -1
- package/dist/assets/{pagination-C5hWM-uh.js → pagination-rZnKw6Dv.js} +1 -1
- package/dist/assets/{palette-CRW1qOCG.js → palette-CTBc55zB.js} +1 -1
- package/dist/assets/{paperclip-HA2RNkmq.js → paperclip-8SUIS4V6.js} +1 -1
- package/dist/assets/{pause-09GpN31S.js → pause-BrUxrvme.js} +1 -1
- package/dist/assets/{pencil-CD6MLBSx.js → pencil-DTlLX3aI.js} +1 -1
- package/dist/assets/{sora-DFX7Ridx.js → pika-D2ELR1BJ.js} +1 -1
- package/dist/assets/{hailuo-C1kObLTr.js → pixverse-YAmSFszN.js} +1 -1
- package/dist/assets/play-C_SfEt6Z.js +1 -0
- package/dist/assets/{plug-D6wUveI9.js → plug-BQgbxZvJ.js} +1 -1
- package/dist/assets/plus-DEuZTkzF.js +1 -0
- package/dist/assets/{poivelle-ChqnXNHp.js → poivelle-CJbGaDtU.js} +1 -1
- package/dist/assets/{popover-8bFfKyEx.js → popover-Cw22vTM3.js} +1 -1
- package/dist/assets/{producer-CZdiq23k.js → producer-BmVHJgip.js} +1 -1
- package/dist/assets/{qrart-T4a6zkdJ.js → qrart-g92I07IG.js} +1 -1
- package/dist/assets/realtime-h2ivlZjk.js +1 -0
- package/dist/assets/{refresh-cw-3eBUX5Ea.js → refresh-cw-DGY8Nssp.js} +1 -1
- package/dist/assets/rotate-ccw-ChqfNZzp.js +1 -0
- package/dist/assets/rotate-cw-BowoSSk7.js +1 -0
- package/dist/assets/{row-BQUMxfsY.js → row-BlMc5HGF.js} +1 -1
- package/dist/assets/search-J1q7Xaee.js +1 -0
- package/dist/assets/secp256k1-xksC0Kmy.js +1 -0
- package/dist/assets/{seedance-DWR0aqWj.js → seedance-DOO9kPWi.js} +1 -1
- package/dist/assets/{seedream-CMXDmAzS.js → seedream-DEg6XNwp.js} +1 -1
- package/dist/assets/{select-C0yzkTif.js → select-BODA2jf6.js} +1 -1
- package/dist/assets/{serp-Dt_PQkXV.js → serp-BtvzKdAE.js} +1 -1
- package/dist/assets/{shield-wdrqyAOI.js → shield-QlgNfgLj.js} +1 -1
- package/dist/assets/{shuffle-Bqjf3c86.js → shuffle-DYCgQitM.js} +1 -1
- package/dist/assets/{slider-BDLlDUDz.js → slider-DkOO6w7v.js} +1 -1
- package/dist/assets/solana-Bn9cyhqr.js +2 -0
- package/dist/assets/solana-wallets-DuUXJVr7.js +2 -0
- package/dist/assets/{solana-wallets-vue-B8MVw466.js → solana-wallets-vue-CvwzSqOW.js} +1 -1
- package/dist/assets/{pixverse-CzR8RnTd.js → sora-C1VhpFhj.js} +1 -1
- package/dist/assets/{sparkles-BoTKvrNO.js → sparkles-B6l3pe4D.js} +1 -1
- package/dist/assets/square-DqvXq--P.js +1 -0
- package/dist/assets/{store-B3O9u73-.js → store-BTMIDGvm.js} +1 -1
- package/dist/assets/{suno-DCe2XW0B.js → suno-Dn9tmBWw.js} +1 -1
- package/dist/assets/{switch-C7dNKdGq.js → switch-DO_m4tjD.js} +1 -1
- package/dist/assets/{table-UhquZYel.js → table-D6bwWTTA.js} +1 -1
- package/dist/assets/{tabs-BwvMWaWZ.js → tabs-CxRafyJg.js} +1 -1
- package/dist/assets/{tag-BJxLMPQ4.js → tag-RZW53z8C.js} +1 -1
- package/dist/assets/terminal-DhTdw-wQ.js +1 -0
- package/dist/assets/{time-picker-DoJ_mwqy.js → time-picker-DoXQpdJv.js} +1 -1
- package/dist/assets/{tooltip-CY9KP5TS.js → tooltip-Ck3eIRCt.js} +1 -1
- package/dist/assets/{trash-2-B1wBangj.js → trash-2-BrR9MfiV.js} +1 -1
- package/dist/assets/{triangle-alert-CAuu6B-W.js → triangle-alert-BOFNM383.js} +1 -1
- package/dist/assets/{upload-D_4LkjOW.js → upload-D5utuckf.js} +1 -1
- package/dist/assets/{upload-D6AM_V-z.js → upload-KvU-H2Pn.js} +1 -1
- package/dist/assets/user-Cse7zZa3.js +1 -0
- package/dist/assets/{veo-W71kXy0Z.js → veo-VkkgFc00.js} +1 -1
- package/dist/assets/{video-DVgqKgsY.js → video-CdClpytA.js} +1 -1
- package/dist/assets/{volume-2-DocaJU2F.js → volume-2-1ocI-qzO.js} +1 -1
- package/dist/assets/{w3m-modal-CcAeUAZf.js → w3m-modal-BXg-8Jr5.js} +26 -26
- package/dist/assets/{wallet-RBRJCWek.js → wallet-DgphXG1K.js} +1 -1
- package/dist/assets/{wan-CgXklc_4.js → wan-Cj2ZSym0.js} +1 -1
- package/dist/assets/{wand-sparkles-CJH0v5L4.js → wand-sparkles-RkL6p2k8.js} +1 -1
- package/dist/assets/{web-nUZelD8c.js → web-BCC6qgJS.js} +1 -1
- package/dist/assets/{web-DRJhyBh_.js → web-B_clN23Y.js} +1 -1
- package/dist/assets/{web-9nZX65Vh.js → web-BkYDAxsa.js} +1 -1
- package/dist/assets/{web-D29bO3g4.js → web-JJHCetdA.js} +1 -1
- package/dist/assets/{web-BjNw9wT3.js → web-WjQTyOKD.js} +1 -1
- package/dist/assets/{webextrator-C1x7ltX3.js → webextrator-CZbaFhxj.js} +1 -1
- package/dist/assets/{wui-text-IdpNh4yv.js → wui-text-Cn4Xd1Sh.js} +1 -1
- package/dist/assets/{zap-Bo8Pzpwk.js → zap-B1VAKgJ8.js} +1 -1
- package/dist/index.html +6 -5
- package/package.json +2 -1
- package/dist/assets/ConnectorUtil-BNHqGaBo.js +0 -1
- package/dist/assets/ConstantsUtil-CiJQ7E9o.js +0 -885
- package/dist/assets/Detail-BynbMCsg.js +0 -2
- package/dist/assets/Extra-Dy27Xepl.js +0 -1
- package/dist/assets/Index-2pUrfZDO.js +0 -1
- package/dist/assets/Index-B2gSKiZ3.js +0 -1
- package/dist/assets/Index-BneErBTq.js +0 -1
- package/dist/assets/Index-CLKH3TKM.js +0 -1
- package/dist/assets/Index-CqRMg-uH.js +0 -1
- package/dist/assets/Index-Crdhl-Vx.js +0 -1
- package/dist/assets/Index-DMQ9DZGa.js +0 -1
- package/dist/assets/Index-DaePlNci.js +0 -1
- package/dist/assets/List-By1Vg7U3.js +0 -1
- package/dist/assets/List-ByRoWUqS.js +0 -1
- package/dist/assets/LocalTools-C0CsQekj.js +0 -5
- package/dist/assets/Navigator-DJAPAK_Y.css +0 -1
- package/dist/assets/Pay-BXFjGCjg.js +0 -1
- package/dist/assets/Status-BAOOm7Y6.js +0 -1
- package/dist/assets/arrow-down-M2F1qebD.js +0 -1
- package/dist/assets/arrow-left-D_2mJNNF.js +0 -1
- package/dist/assets/arrow-right-abRRWNmS.js +0 -1
- package/dist/assets/arrow-up-DMpA1IsJ.js +0 -1
- package/dist/assets/authorizeFlow-CujA2Sko.js +0 -1
- package/dist/assets/check-TtZdHrlm.js +0 -1
- package/dist/assets/chevron-down-DMXTi49q.js +0 -1
- package/dist/assets/chevron-right-DIQNv_0r.js +0 -1
- package/dist/assets/circle-check-DKBPWCH5.js +0 -1
- package/dist/assets/clock-D5NbflY9.js +0 -1
- package/dist/assets/code-wKSqPZcq.js +0 -1
- package/dist/assets/codingBridgeNotify-kOlSTgx4.js +0 -2
- package/dist/assets/esm-BgUDy7vB.js +0 -1
- package/dist/assets/esm-C9MRpvkK.js +0 -28
- package/dist/assets/esm-D4Ha2HnB.js +0 -2
- package/dist/assets/gauge-DP9sk0Fe.js +0 -1
- package/dist/assets/index-CTn7SLTr.js +0 -570
- package/dist/assets/index.browser.esm-BuWinGJ1.js +0 -2
- package/dist/assets/loader-circle-r7o2cOdj.js +0 -1
- package/dist/assets/music-2-UxfKU68J.js +0 -1
- package/dist/assets/play-1r8M6tGa.js +0 -1
- package/dist/assets/plus-Dzhx2WdR.js +0 -1
- package/dist/assets/realtime-C0bVe3k2.js +0 -1
- package/dist/assets/rotate-ccw-DFETd1JJ.js +0 -1
- package/dist/assets/rotate-cw-BLViYEn3.js +0 -1
- package/dist/assets/search-CiYRAPUv.js +0 -1
- package/dist/assets/secp256k1-CBKdYWfq.js +0 -1
- package/dist/assets/solana-CLOcWury.js +0 -2
- package/dist/assets/solana-wallets-C-BcnEbE.js +0 -2
- package/dist/assets/square-B9lxDeHX.js +0 -1
- package/dist/assets/terminal-C5ne2YRf.js +0 -1
- package/dist/assets/user-B3wTOjwB.js +0 -1
- package/dist/assets/utils-CGq_Culp.js +0 -1
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/secp256k1-xksC0Kmy.js","assets/rolldown-runtime--c01j_DQ.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{a as e,i as t,n,o as r,r as i,t as a}from"./rolldown-runtime--c01j_DQ.js";import{t as o}from"./preload-helper-zJ_50EbN.js";import{t as s}from"./__vite-browser-external-Wme9VPc1.js";var c=a(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),l=i({__assign:()=>M,__asyncDelegator:()=>T,__asyncGenerator:()=>w,__asyncValues:()=>E,__await:()=>C,__awaiter:()=>h,__classPrivateFieldGet:()=>A,__classPrivateFieldSet:()=>ee,__createBinding:()=>_,__decorate:()=>f,__exportStar:()=>v,__extends:()=>u,__generator:()=>g,__importDefault:()=>k,__importStar:()=>O,__makeTemplateObject:()=>D,__metadata:()=>m,__param:()=>p,__read:()=>b,__rest:()=>d,__spread:()=>x,__spreadArrays:()=>S,__values:()=>y});function u(e,t){j(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function d(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function f(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function p(e,t){return function(n,r){t(n,r,e)}}function m(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function h(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function g(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function _(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function v(e,t){for(var n in e)n!==`default`&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function y(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function b(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function x(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(b(arguments[t]));return e}function S(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function C(e){return this instanceof C?(this.v=e,this):new C(e)}function w(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof C?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function T(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:C(e[r](t)),done:r===`return`}:i?i(t):t}:i}}function E(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof y==`function`?y(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function D(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function O(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function k(e){return e&&e.__esModule?e:{default:e}}function A(e,t){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return t.get(e)}function ee(e,t,n){if(!t.has(e))throw TypeError(`attempted to set private field on non-instance`);return t.set(e,n),n}var j,M,N=n((()=>{j=function(e,t){return j=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},j(e,t)},M=function(){return M=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},M.apply(this,arguments)}})),P=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.delay=void 0;function t(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}e.delay=t})),F=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_THOUSAND=e.ONE_HUNDRED=void 0,e.ONE_HUNDRED=100,e.ONE_THOUSAND=1e3})),te=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.ONE_YEAR=e.FOUR_WEEKS=e.THREE_WEEKS=e.TWO_WEEKS=e.ONE_WEEK=e.THIRTY_DAYS=e.SEVEN_DAYS=e.FIVE_DAYS=e.THREE_DAYS=e.ONE_DAY=e.TWENTY_FOUR_HOURS=e.TWELVE_HOURS=e.SIX_HOURS=e.THREE_HOURS=e.ONE_HOUR=e.SIXTY_MINUTES=e.THIRTY_MINUTES=e.TEN_MINUTES=e.FIVE_MINUTES=e.ONE_MINUTE=e.SIXTY_SECONDS=e.THIRTY_SECONDS=e.TEN_SECONDS=e.FIVE_SECONDS=e.ONE_SECOND=void 0,e.ONE_SECOND=1,e.FIVE_SECONDS=5,e.TEN_SECONDS=10,e.THIRTY_SECONDS=30,e.SIXTY_SECONDS=60,e.ONE_MINUTE=e.SIXTY_SECONDS,e.FIVE_MINUTES=e.ONE_MINUTE*5,e.TEN_MINUTES=e.ONE_MINUTE*10,e.THIRTY_MINUTES=e.ONE_MINUTE*30,e.SIXTY_MINUTES=e.ONE_MINUTE*60,e.ONE_HOUR=e.SIXTY_MINUTES,e.THREE_HOURS=e.ONE_HOUR*3,e.SIX_HOURS=e.ONE_HOUR*6,e.TWELVE_HOURS=e.ONE_HOUR*12,e.TWENTY_FOUR_HOURS=e.ONE_HOUR*24,e.ONE_DAY=e.TWENTY_FOUR_HOURS,e.THREE_DAYS=e.ONE_DAY*3,e.FIVE_DAYS=e.ONE_DAY*5,e.SEVEN_DAYS=e.ONE_DAY*7,e.THIRTY_DAYS=e.ONE_DAY*30,e.ONE_WEEK=e.SEVEN_DAYS,e.TWO_WEEKS=e.ONE_WEEK*2,e.THREE_WEEKS=e.ONE_WEEK*3,e.FOUR_WEEKS=e.ONE_WEEK*4,e.ONE_YEAR=e.ONE_DAY*365})),I=a((t=>{Object.defineProperty(t,"__esModule",{value:!0});var n=(N(),e(l));n.__exportStar(F(),t),n.__exportStar(te(),t)})),ne=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.fromMiliseconds=e.toMiliseconds=void 0;var t=I();function n(e){return e*t.ONE_THOUSAND}e.toMiliseconds=n;function r(e){return Math.floor(e/t.ONE_THOUSAND)}e.fromMiliseconds=r})),re=a((t=>{Object.defineProperty(t,"__esModule",{value:!0});var n=(N(),e(l));n.__exportStar(P(),t),n.__exportStar(ne(),t)})),L=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.Watch=void 0;var t=class{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let t=this.get(e);if(t.elapsed!==void 0)throw Error(`Watch already stopped for label: ${e}`);let n=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:n})}get(e){let t=this.timestamps.get(e);if(t===void 0)throw Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}};e.Watch=t,e.default=t})),R=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.IWatch=void 0,e.IWatch=class{}})),ie=a((t=>{Object.defineProperty(t,"__esModule",{value:!0}),(N(),e(l)).__exportStar(R(),t)})),z=a((t=>{Object.defineProperty(t,"__esModule",{value:!0});var n=(N(),e(l));n.__exportStar(re(),t),n.__exportStar(L(),t),n.__exportStar(ie(),t),n.__exportStar(I(),t)})),B=class{},ae=r(c()),V=z(),oe=class extends B{constructor(e){super()}},se=V.FIVE_SECONDS,ce={pulse:`heartbeat_pulse`},le=class e extends oe{constructor(e){super(e),this.events=new ae.EventEmitter,this.interval=se,this.interval=e?.interval||se}static async init(t){let n=new e(t);return await n.init(),n}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,V.toMiliseconds)(this.interval))}pulse(){this.events.emit(ce.pulse)}},ue=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,de=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,fe=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function pe(e,t){if(e===`__proto__`||e===`constructor`&&t&&typeof t==`object`&&`prototype`in t){me(e);return}return t}function me(e){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`)}function he(e,t={}){if(typeof e!=`string`)return e;if(e[0]===`"`&&e[e.length-1]===`"`&&e.indexOf(`\\`)===-1)return e.slice(1,-1);let n=e.trim();if(n.length<=9)switch(n.toLowerCase()){case`true`:return!0;case`false`:return!1;case`undefined`:return;case`null`:return null;case`nan`:return NaN;case`infinity`:return 1/0;case`-infinity`:return-1/0}if(!fe.test(e)){if(t.strict)throw SyntaxError(`[destr] Invalid JSON`);return e}try{if(ue.test(e)||de.test(e)){if(t.strict)throw Error(`[destr] Possible prototype pollution`);return JSON.parse(e,pe)}return JSON.parse(e)}catch(n){if(t.strict)throw n;return e}}function ge(e){return!e||typeof e.then!=`function`?Promise.resolve(e):e}function H(e,...t){try{return ge(e(...t))}catch(e){return Promise.reject(e)}}function _e(e){let t=typeof e;return e===null||t!==`object`&&t!==`function`}function ve(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}function ye(e){if(_e(e))return String(e);if(ve(e)||Array.isArray(e))return JSON.stringify(e);if(typeof e.toJSON==`function`)return ye(e.toJSON());throw Error(`[unstorage] Cannot stringify value!`)}var be=`base64:`;function xe(e){return typeof e==`string`?e:be+Ce(e)}function Se(e){return typeof e!=`string`||!e.startsWith(be)?e:U(e.slice(7))}function U(e){return globalThis.Buffer?Buffer.from(e,`base64`):Uint8Array.from(globalThis.atob(e),e=>e.codePointAt(0))}function Ce(e){return globalThis.Buffer?Buffer.from(e).toString(`base64`):globalThis.btoa(String.fromCodePoint(...e))}function W(e){return e&&e.split(`?`)[0]?.replace(/[/\\]/g,`:`).replace(/:+/g,`:`).replace(/^:|:$/g,``)||``}function we(...e){return W(e.join(`:`))}function Te(e){return e=W(e),e?e+`:`:``}function Ee(e,t){if(t===void 0)return!0;let n=0,r=e.indexOf(`:`);for(;r>-1;)n++,r=e.indexOf(`:`,r+1);return n<=t}function De(e,t){return t?e.startsWith(t)&&e[e.length-1]!==`$`:e[e.length-1]!==`$`}function Oe(e){return e}var ke=`memory`,Ae=Oe(()=>{let e=new Map;return{name:ke,getInstance:()=>e,hasItem(t){return e.has(t)},getItem(t){return e.get(t)??null},getItemRaw(t){return e.get(t)??null},setItem(t,n){e.set(t,n)},setItemRaw(t,n){e.set(t,n)},removeItem(t){e.delete(t)},getKeys(){return[...e.keys()]},clear(){e.clear()},dispose(){e.clear()}}});function je(e={}){let t={mounts:{"":e.driver||Ae()},mountpoints:[``],watching:!1,watchListeners:[],unwatch:{}},n=e=>{for(let n of t.mountpoints)if(e.startsWith(n))return{base:n,relativeKey:e.slice(n.length),driver:t.mounts[n]};return{base:``,relativeKey:e,driver:t.mounts[``]}},r=(e,n)=>t.mountpoints.filter(t=>t.startsWith(e)||n&&e.startsWith(t)).map(n=>({relativeBase:e.length>n.length?e.slice(n.length):void 0,mountpoint:n,driver:t.mounts[n]})),i=(e,n)=>{if(t.watching){n=W(n);for(let r of t.watchListeners)r(e,n)}},a=async()=>{if(!t.watching){t.watching=!0;for(let e in t.mounts)t.unwatch[e]=await Me(t.mounts[e],i,e)}},o=async()=>{if(t.watching){for(let e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},s=(e,t,r)=>{let i=new Map,a=e=>{let t=i.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},i.set(e.base,t)),t};for(let r of e){let e=typeof r==`string`,i=W(e?r:r.key),o=e?void 0:r.value,s=e||!r.options?t:{...t,...r.options},c=n(i);a(c).items.push({key:i,value:o,relativeKey:c.relativeKey,options:s})}return Promise.all([...i.values()].map(e=>r(e))).then(e=>e.flat())},c={hasItem(e,t={}){e=W(e);let{relativeKey:r,driver:i}=n(e);return H(i.hasItem,r,t)},getItem(e,t={}){e=W(e);let{relativeKey:r,driver:i}=n(e);return H(i.getItem,r,t).then(e=>he(e))},getItems(e,t={}){return s(e,t,e=>e.driver.getItems?H(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:we(e.base,t.key),value:he(t.value)}))):Promise.all(e.items.map(t=>H(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:he(e)})))))},getItemRaw(e,t={}){e=W(e);let{relativeKey:r,driver:i}=n(e);return i.getItemRaw?H(i.getItemRaw,r,t):H(i.getItem,r,t).then(e=>Se(e))},async setItem(e,t,r={}){if(t===void 0)return c.removeItem(e);e=W(e);let{relativeKey:a,driver:o}=n(e);o.setItem&&(await H(o.setItem,a,ye(t),r),o.watch||i(`update`,e))},async setItems(e,t){await s(e,t,async e=>{if(e.driver.setItems)return H(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:ye(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>H(e.driver.setItem,t.relativeKey,ye(t.value),t.options)))})},async setItemRaw(e,t,r={}){if(t===void 0)return c.removeItem(e,r);e=W(e);let{relativeKey:a,driver:o}=n(e);if(o.setItemRaw)await H(o.setItemRaw,a,t,r);else if(o.setItem)await H(o.setItem,a,xe(t),r);else return;o.watch||i(`update`,e)},async removeItem(e,t={}){typeof t==`boolean`&&(t={removeMeta:t}),e=W(e);let{relativeKey:r,driver:a}=n(e);a.removeItem&&(await H(a.removeItem,r,t),(t.removeMeta||t.removeMata)&&await H(a.removeItem,r+`$`,t),a.watch||i(`remove`,e))},async getMeta(e,t={}){typeof t==`boolean`&&(t={nativeOnly:t}),e=W(e);let{relativeKey:r,driver:i}=n(e),a=Object.create(null);if(i.getMeta&&Object.assign(a,await H(i.getMeta,r,t)),!t.nativeOnly){let e=await H(i.getItem,r+`$`,t).then(e=>he(e));e&&typeof e==`object`&&(typeof e.atime==`string`&&(e.atime=new Date(e.atime)),typeof e.mtime==`string`&&(e.mtime=new Date(e.mtime)),Object.assign(a,e))}return a},setMeta(e,t,n={}){return this.setItem(e+`$`,t,n)},removeMeta(e,t={}){return this.removeItem(e+`$`,t)},async getKeys(e,t={}){e=Te(e);let n=r(e,!0),i=[],a=[],o=!0;for(let e of n){e.driver.flags?.maxDepth||(o=!1);let n=await H(e.driver.getKeys,e.relativeBase,t);for(let t of n){let n=e.mountpoint+W(t);i.some(e=>n.startsWith(e))||a.push(n)}i=[e.mountpoint,...i.filter(t=>!t.startsWith(e.mountpoint))]}let s=t.maxDepth!==void 0&&!o;return a.filter(n=>(!s||Ee(n,t.maxDepth))&&De(n,e))},async clear(e,t={}){e=Te(e),await Promise.all(r(e,!1).map(async e=>{if(e.driver.clear)return H(e.driver.clear,e.relativeBase,t);if(e.driver.removeItem){let n=await e.driver.getKeys(e.relativeBase||``,t);return Promise.all(n.map(n=>e.driver.removeItem(n,t)))}}))},async dispose(){await Promise.all(Object.values(t.mounts).map(e=>Ne(e)))},async watch(e){return await a(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter(t=>t!==e),t.watchListeners.length===0&&await o()}},async unwatch(){t.watchListeners=[],await o()},mount(e,n){if(e=Te(e),e&&t.mounts[e])throw Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort((e,t)=>t.length-e.length)),t.mounts[e]=n,t.watching&&Promise.resolve(Me(n,i,e)).then(n=>{t.unwatch[e]=n}).catch(console.error),c},async unmount(e,n=!0){e=Te(e),!(!e||!t.mounts[e])&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),n&&await Ne(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=``){e=W(e)+`:`;let t=n(e);return{driver:t.driver,base:t.base}},getMounts(e=``,t={}){return e=W(e),r(e,t.parents).map(e=>({driver:e.driver,base:e.mountpoint}))},keys:(e,t={})=>c.getKeys(e,t),get:(e,t={})=>c.getItem(e,t),set:(e,t,n={})=>c.setItem(e,t,n),has:(e,t={})=>c.hasItem(e,t),del:(e,t={})=>c.removeItem(e,t),remove:(e,t={})=>c.removeItem(e,t)};return c}function Me(e,t,n){return e.watch?e.watch((e,r)=>t(e,n+r)):()=>{}}async function Ne(e){typeof e.dispose==`function`&&await H(e.dispose)}function Pe(e){return new Promise((t,n)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>n(e.error)})}function Fe(e,t){let n,r=()=>{if(n)return n;let r=indexedDB.open(e);return r.onupgradeneeded=()=>r.result.createObjectStore(t),n=Pe(r),n.then(e=>{e.onclose=()=>n=void 0},()=>{}),n};return(e,n)=>r().then(r=>n(r.transaction(t,e).objectStore(t)))}var Ie;function Le(){return Ie||=Fe(`keyval-store`,`keyval`),Ie}function Re(e,t=Le()){return t(`readonly`,t=>Pe(t.get(e)))}function ze(e,t,n=Le()){return n(`readwrite`,n=>(n.put(t,e),Pe(n.transaction)))}function Be(e,t=Le()){return t(`readwrite`,t=>(t.delete(e),Pe(t.transaction)))}function Ve(e=Le()){return e(`readwrite`,e=>(e.clear(),Pe(e.transaction)))}function He(e,t){return e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Pe(e.transaction)}function Ue(e=Le()){return e(`readonly`,e=>{if(e.getAllKeys)return Pe(e.getAllKeys());let t=[];return He(e,e=>t.push(e.key)).then(()=>t)})}var We=e=>JSON.stringify(e,(e,t)=>typeof t==`bigint`?t.toString()+`n`:t),Ge=e=>{let t=e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,`$1"$2n"$3`);return JSON.parse(t,(e,t)=>typeof t==`string`&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t)};function Ke(e){if(typeof e!=`string`)throw Error(`Cannot safe json parse value of type ${typeof e}`);try{return Ge(e)}catch{return e}}function qe(e){return typeof e==`string`?e:We(e)||``}var Je=`idb-keyval`,Ye=(e={})=>{let t=e.base&&e.base.length>0?`${e.base}:`:``,n=e=>t+e,r;return e.dbName&&e.storeName&&(r=Fe(e.dbName,e.storeName)),{name:Je,options:e,async hasItem(e){return!(typeof await Re(n(e),r)>`u`)},async getItem(e){return await Re(n(e),r)??null},setItem(e,t){return ze(n(e),t,r)},removeItem(e){return Be(n(e),r)},getKeys(){return Ue(r)},clear(){return Ve(r)}}},Xe=`WALLET_CONNECT_V2_INDEXED_DB`,Ze=`keyvaluestorage`,Qe=class{constructor(){this.indexedDb=je({driver:Ye({dbName:Xe,storeName:Ze})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let t=await this.indexedDb.getItem(e);if(t!==null)return t}async setItem(e,t){await this.indexedDb.setItem(e,qe(t))}async removeItem(e){await this.indexedDb.removeItem(e)}},$e=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{},et={exports:{}};(function(){let e;function t(){}e=t,e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){let e=this;Object.keys(e).forEach(function(t){e[t]=void 0,delete e[t]})},e.prototype.key=function(e){return e||=0,Object.keys(this)[e]},e.prototype.__defineGetter__(`length`,function(){return Object.keys(this).length}),typeof $e<`u`&&$e.localStorage?et.exports=$e.localStorage:typeof window<`u`&&window.localStorage?et.exports=window.localStorage:et.exports=new t})();function tt(e){return[e[0],Ke(e[1]??``)]}var nt=class{constructor(){this.localStorage=et.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(tt)}async getItem(e){let t=this.localStorage.getItem(e);if(t!==null)return Ke(t)}async setItem(e,t){this.localStorage.setItem(e,qe(t))}async removeItem(e){this.localStorage.removeItem(e)}},rt=`wc_storage_version`,it=1,at=async(e,t,n)=>{let r=rt,i=await t.getItem(r);if(i&&i>=it){n(t);return}let a=await e.getKeys();if(!a.length){n(t);return}let o=[];for(;a.length;){let n=a.shift();if(!n)continue;let r=n.toLowerCase();if(r.includes(`wc@`)||r.includes(`walletconnect`)||r.includes(`wc_`)||r.includes(`wallet_connect`)){let r=await e.getItem(n);await t.setItem(n,r),o.push(n)}}await t.setItem(r,it),n(t),ot(e,o)},ot=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})},st=class{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};let e=new nt;this.storage=e;try{at(e,new Qe,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}},ct=a(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--;break}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),lt=r(a(((e,t)=>{var n=ct();t.exports=o;var r=C().console||{},i={mapHttpRequest:g,mapHttpResponse:g,wrapRequestSerializer:_,wrapResponseSerializer:_,wrapErrorSerializer:_,req:g,res:g,err:m};function a(e,t){return Array.isArray(e)?e.filter(function(e){return e!==`!stdSerializers.err`}):e===!0?Object.keys(t):!1}function o(e){e||={},e.browser=e.browser||{};let t=e.browser.transmit;if(t&&typeof t.send!=`function`)throw Error(`pino: transmit option must have a send function`);let n=e.browser.write||r;e.browser.write&&(e.browser.asObject=!0);let i=e.serializers||{},c=a(e.browser.serialize,i),l=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf(`!stdSerializers.err`)>-1&&(l=!1);let f=[`error`,`fatal`,`warn`,`info`,`debug`,`trace`];typeof n==`function`&&(n.error=n.fatal=n.warn=n.info=n.debug=n.trace=n),e.enabled===!1&&(e.level=`silent`);let m=e.level||`info`,g=Object.create(n);g.log||=v,Object.defineProperty(g,"levelVal",{get:y}),Object.defineProperty(g,"level",{get:b,set:x});let _={transmit:t,serialize:c,asObject:e.browser.asObject,levels:f,timestamp:h(e)};g.levels=o.levels,g.level=m,g.setMaxListeners=g.getMaxListeners=g.emit=g.addListener=g.on=g.prependListener=g.once=g.prependOnceListener=g.removeListener=g.removeAllListeners=g.listeners=g.listenerCount=g.eventNames=g.write=g.flush=v,g.serializers=i,g._serialize=c,g._stdErrSerialize=l,g.child=S,t&&(g._logEvent=p());function y(){return this.level===`silent`?1/0:this.levels.values[this.level]}function b(){return this._level}function x(e){if(e!==`silent`&&!this.levels.values[e])throw Error(`unknown level `+e);this._level=e,s(_,g,`error`,`log`),s(_,g,`fatal`,`error`),s(_,g,`warn`,`error`),s(_,g,`info`,`log`),s(_,g,`debug`,`log`),s(_,g,`trace`,`log`)}function S(n,r){if(!n)throw Error(`missing bindings for child Pino`);r||={},c&&n.serializers&&(r.serializers=n.serializers);let a=r.serializers;if(c&&a){var o=Object.assign({},i,a),s=e.browser.serialize===!0?Object.keys(o):c;delete n.serializers,u([n],s,o,this._stdErrSerialize)}function l(e){this._childLevel=(e._childLevel|0)+1,this.error=d(e,n,`error`),this.fatal=d(e,n,`fatal`),this.warn=d(e,n,`warn`),this.info=d(e,n,`info`),this.debug=d(e,n,`debug`),this.trace=d(e,n,`trace`),o&&(this.serializers=o,this._serialize=s),t&&(this._logEvent=p([].concat(e._logEvent.bindings,n)))}return l.prototype=this,new l(this)}return g}o.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:`trace`,20:`debug`,30:`info`,40:`warn`,50:`error`,60:`fatal`}},o.stdSerializers=i,o.stdTimeFunctions=Object.assign({},{nullTime:y,epochTime:b,unixTime:x,isoTime:S});function s(e,t,n,i){let a=Object.getPrototypeOf(t);t[n]=t.levelVal>t.levels.values[n]?v:a[n]?a[n]:r[n]||r[i]||v,c(e,t,n)}function c(e,t,n){!e.transmit&&t[n]===v||(t[n]=(function(i){return function(){let a=e.timestamp(),s=Array(arguments.length),c=Object.getPrototypeOf&&Object.getPrototypeOf(this)===r?r:this;for(var d=0;d<s.length;d++)s[d]=arguments[d];if(e.serialize&&!e.asObject&&u(s,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?i.call(c,l(this,n,s,a)):i.apply(c,s),e.transmit){let r=e.transmit.level||t.level,i=o.levels.values[r],c=o.levels.values[n];if(c<i)return;f(this,{ts:a,methodLevel:n,methodValue:c,transmitLevel:r,transmitValue:o.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},s)}}})(t[n]))}function l(e,t,r,i){e._serialize&&u(r,e._serialize,e.serializers,e._stdErrSerialize);let a=r.slice(),s=a[0],c={};i&&(c.time=i),c.level=o.levels.values[t];let l=(e._childLevel|0)+1;if(l<1&&(l=1),typeof s==`object`&&s){for(;l--&&typeof a[0]==`object`;)Object.assign(c,a.shift());s=a.length?n(a.shift(),a):void 0}else typeof s==`string`&&(s=n(a.shift(),a));return s!==void 0&&(c.msg=s),c}function u(e,t,n,r){for(let i in e)if(r&&e[i]instanceof Error)e[i]=o.stdSerializers.err(e[i]);else if(typeof e[i]==`object`&&!Array.isArray(e[i]))for(let r in e[i])t&&t.indexOf(r)>-1&&r in n&&(e[i][r]=n[r](e[i][r]))}function d(e,t,n){return function(){let r=Array(1+arguments.length);r[0]=t;for(var i=1;i<r.length;i++)r[i]=arguments[i-1];return e[n].apply(this,r)}}function f(e,t,n){let r=t.send,i=t.ts,a=t.methodLevel,o=t.methodValue,s=t.val,c=e._logEvent.bindings;u(n,e._serialize||Object.keys(e.serializers),e.serializers,e._stdErrSerialize===void 0?!0:e._stdErrSerialize),e._logEvent.ts=i,e._logEvent.messages=n.filter(function(e){return c.indexOf(e)===-1}),e._logEvent.level.label=a,e._logEvent.level.value=o,r(a,e._logEvent,s),e._logEvent=p(c)}function p(e){return{ts:0,messages:[],bindings:e||[],level:{label:``,value:0}}}function m(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let n in e)t[n]===void 0&&(t[n]=e[n]);return t}function h(e){return typeof e.timestamp==`function`?e.timestamp:e.timestamp===!1?y:b}function g(){return{}}function _(e){return e}function v(){}function y(){return!1}function b(){return Date.now()}function x(){return Math.round(Date.now()/1e3)}function S(){return new Date(Date.now()).toISOString()}function C(){function e(e){return e!==void 0&&e}try{return typeof globalThis<`u`||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return e(self)||e(window)||e(this)||{}}}}))()),ut={level:`info`},dt=`custom_context`,ft=1e3*1024,pt=class{constructor(e){this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}},mt=class{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let t=new pt(e);if(t.size>this.maxSizeInBytes)throw Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=t),this.tail=t):(this.head=t,this.tail=t),this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],t=this.head;for(;t!==null;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};let t=e.value;return e=e.next,{done:!1,value:t}}}}},ht=class{constructor(e,t=ft){this.level=e??`error`,this.levelValue=lt.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new mt(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===lt.levels.values.error?console.error(e):t===lt.levels.values.warn?console.warn(e):t===lt.levels.values.debug?console.debug(e):t===lt.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(qe({timestamp:new Date().toISOString(),log:e}));let t=typeof e==`string`?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new mt(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let t=this.getLogArray();return t.push(qe({extraMetadata:e})),new Blob(t,{type:`application/json`})}},gt=class{constructor(e,t=ft){this.baseChunkLogger=new ht(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){let t=URL.createObjectURL(this.logsToBlob(e)),n=document.createElement(`a`);n.href=t,n.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}},_t=class{constructor(e,t=ft){this.baseChunkLogger=new ht(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}},vt=Object.defineProperty,yt=Object.defineProperties,bt=Object.getOwnPropertyDescriptors,xt=Object.getOwnPropertySymbols,St=Object.prototype.hasOwnProperty,Ct=Object.prototype.propertyIsEnumerable,wt=(e,t,n)=>t in e?vt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tt=(e,t)=>{for(var n in t||={})St.call(t,n)&&wt(e,n,t[n]);if(xt)for(var n of xt(t))Ct.call(t,n)&&wt(e,n,t[n]);return e},Et=(e,t)=>yt(e,bt(t));function Dt(e){return Et(Tt({},e),{level:e?.level||ut.level})}function Ot(e,t=dt){return e[t]||``}function kt(e,t,n=dt){return e[n]=t,e}function At(e,t=dt){let n=``;return n=typeof e.bindings>`u`?Ot(e,t):e.bindings().context||``,n}function jt(e,t,n=dt){let r=At(e,n);return r.trim()?`${r}/${t}`:t}function Mt(e,t,n=dt){let r=jt(e,t,n);return kt(e.child({context:r}),r,n)}function Nt(e){let t=new gt(e.opts?.level,e.maxSizeInBytes);return{logger:(0,lt.default)(Et(Tt({},e.opts),{level:`trace`,browser:Et(Tt({},e.opts?.browser),{write:e=>t.write(e)})})),chunkLoggerController:t}}function Pt(e){let t=new _t(e.opts?.level,e.maxSizeInBytes);return{logger:(0,lt.default)(Et(Tt({},e.opts),{level:`trace`}),t),chunkLoggerController:t}}function Ft(e){return typeof e.loggerOverride<`u`&&typeof e.loggerOverride!=`string`?{logger:e.loggerOverride,chunkLoggerController:null}:typeof window<`u`?Nt(e):Pt(e)}function It(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Lt(e,...t){if(!It(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function Rt(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function zt(e,t){Lt(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}var Bt=typeof globalThis==`object`&&`crypto`in globalThis?globalThis.crypto:void 0,Vt=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function Ht(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got `+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Ut(e){return typeof e==`string`&&(e=Ht(e)),Lt(e),e}var Wt=class{clone(){return this._cloneInto()}};function Gt(e){let t=t=>e().update(Ut(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Kt(e=32){if(Bt&&typeof Bt.getRandomValues==`function`)return Bt.getRandomValues(new Uint8Array(e));if(Bt&&typeof Bt.randomBytes==`function`)return Bt.randomBytes(e);throw Error(`crypto.getRandomValues must be defined`)}function qt(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}var Jt=class extends Wt{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Vt(this.buffer)}update(e){Rt(this);let{view:t,buffer:n,blockLen:r}=this;e=Ut(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=Vt(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Rt(this),zt(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;qt(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=Vt(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.length=r,e.pos=o,e.finished=i,e.destroyed=a,r%t&&e.buffer.set(n),e}},Yt=BigInt(2**32-1),Xt=BigInt(32);function Zt(e,t=!1){return t?{h:Number(e&Yt),l:Number(e>>Xt&Yt)}:{h:Number(e>>Xt&Yt)|0,l:Number(e&Yt)|0}}function Qt(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:a,l:o}=Zt(e[i],t);[n[i],r[i]]=[a,o]}return[n,r]}var $t=(e,t)=>BigInt(e>>>0)<<Xt|BigInt(t>>>0),en=(e,t,n)=>e>>>n,tn=(e,t,n)=>e<<32-n|t>>>n,nn=(e,t,n)=>e>>>n|t<<32-n,rn=(e,t,n)=>e<<32-n|t>>>n,an=(e,t,n)=>e<<64-n|t>>>n-32,on=(e,t,n)=>e>>>n-32|t<<64-n,sn=(e,t)=>t,cn=(e,t)=>e,ln=(e,t,n)=>e<<n|t>>>32-n,un=(e,t,n)=>t<<n|e>>>32-n,dn=(e,t,n)=>t<<n-32|e>>>64-n,fn=(e,t,n)=>e<<n-32|t>>>64-n;function pn(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var G={fromBig:Zt,split:Qt,toBig:$t,shrSH:en,shrSL:tn,rotrSH:nn,rotrSL:rn,rotrBH:an,rotrBL:on,rotr32H:sn,rotr32L:cn,rotlSH:ln,rotlSL:un,rotlBH:dn,rotlBL:fn,add:pn,add3L:(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),add3H:(e,t,n,r)=>t+n+r+(e/2**32|0)|0,add4L:(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),add4H:(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,add5H:(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0,add5L:(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0)},[mn,hn]=G.split(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e))),gn=new Uint32Array(80),_n=new Uint32Array(80),vn=class extends Jt{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=4)gn[n]=e.getUint32(t),_n[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=gn[e-15]|0,n=_n[e-15]|0,r=G.rotrSH(t,n,1)^G.rotrSH(t,n,8)^G.shrSH(t,n,7),i=G.rotrSL(t,n,1)^G.rotrSL(t,n,8)^G.shrSL(t,n,7),a=gn[e-2]|0,o=_n[e-2]|0,s=G.rotrSH(a,o,19)^G.rotrBH(a,o,61)^G.shrSH(a,o,6),c=G.rotrSL(a,o,19)^G.rotrBL(a,o,61)^G.shrSL(a,o,6),l=G.add4L(i,c,_n[e-7],_n[e-16]);gn[e]=G.add4H(l,r,s,gn[e-7],gn[e-16])|0,_n[e]=l|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=G.rotrSH(u,d,14)^G.rotrSH(u,d,18)^G.rotrBH(u,d,41),v=G.rotrSL(u,d,14)^G.rotrSL(u,d,18)^G.rotrBL(u,d,41),y=u&f^~u&m,b=d&p^~d&h,x=G.add5L(_,v,b,hn[e],_n[e]),S=G.add5H(x,g,t,y,mn[e],gn[e]),C=x|0,w=G.rotrSH(n,r,28)^G.rotrBH(n,r,34)^G.rotrBH(n,r,39),T=G.rotrSL(n,r,28)^G.rotrBL(n,r,34)^G.rotrBL(n,r,39),E=n&i^n&o^i&o,D=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=G.add(c|0,l|0,S|0,C|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let O=G.add3L(C,T,D);n=G.add3H(O,S,w,E),r=O|0}({h:n,l:r}=G.add(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=G.add(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=G.add(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=G.add(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=G.add(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=G.add(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=G.add(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=G.add(this.Hh|0,this.Hl|0,g|0,_|0),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){gn.fill(0),_n.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},yn=Gt(()=>new vn),bn=BigInt(0),xn=BigInt(1),Sn=BigInt(2);function Cn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function wn(e){if(!Cn(e))throw Error(`Uint8Array expected`)}function Tn(e,t){if(typeof t!=`boolean`)throw Error(e+` boolean expected, got `+t)}var En=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Dn(e){wn(e);let t=``;for(let n=0;n<e.length;n++)t+=En[e[n]];return t}function On(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return e===``?bn:BigInt(`0x`+e)}var kn={_0:48,_9:57,A:65,F:70,a:97,f:102};function An(e){if(e>=kn._0&&e<=kn._9)return e-kn._0;if(e>=kn.A&&e<=kn.F)return e-(kn.A-10);if(e>=kn.a&&e<=kn.f)return e-(kn.a-10)}function jn(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);let t=e.length,n=t/2;if(t%2)throw Error(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=An(e.charCodeAt(i)),a=An(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function Mn(e){return On(Dn(e))}function Nn(e){return wn(e),On(Dn(Uint8Array.from(e).reverse()))}function Pn(e,t){return jn(e.toString(16).padStart(t*2,`0`))}function Fn(e,t){return Pn(e,t).reverse()}function In(e,t,n){let r;if(typeof t==`string`)try{r=jn(t)}catch(t){throw Error(e+` must be hex string or Uint8Array, cause: `+t)}else if(Cn(t))r=Uint8Array.from(t);else throw Error(e+` must be hex string or Uint8Array`);let i=r.length;if(typeof n==`number`&&i!==n)throw Error(e+` of length `+n+` expected, got `+i);return r}function Ln(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];wn(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}var Rn=e=>typeof e==`bigint`&&bn<=e;function zn(e,t,n){return Rn(e)&&Rn(t)&&Rn(n)&&t<=e&&e<n}function Bn(e,t,n,r){if(!zn(t,n,r))throw Error(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function Vn(e){let t;for(t=0;e>bn;e>>=xn,t+=1);return t}var Hn=e=>(Sn<<BigInt(e-1))-xn,Un={bigint:e=>typeof e==`bigint`,function:e=>typeof e==`function`,boolean:e=>typeof e==`boolean`,string:e=>typeof e==`string`,stringOrUint8Array:e=>typeof e==`string`||Cn(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e==`function`&&Number.isSafeInteger(e.outputLen)};function Wn(e,t,n={}){let r=(t,n,r)=>{let i=Un[n];if(typeof i!=`function`)throw Error(`invalid validator function`);let a=e[t];if(!(r&&a===void 0)&&!i(a,e))throw Error(`param `+String(t)+` is invalid. Expected `+n+`, got `+a)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e}function Gn(e){let t=new WeakMap;return(n,...r)=>{let i=t.get(n);if(i!==void 0)return i;let a=e(n,...r);return t.set(n,a),a}}var Kn=BigInt(0),qn=BigInt(1),Jn=BigInt(2),Yn=BigInt(3),Xn=BigInt(4),Zn=BigInt(5),Qn=BigInt(8);function $n(e,t){let n=e%t;return n>=Kn?n:t+n}function er(e,t,n){if(t<Kn)throw Error(`invalid exponent, negatives unsupported`);if(n<=Kn)throw Error(`invalid modulus`);if(n===qn)return Kn;let r=qn;for(;t>Kn;)t&qn&&(r=r*e%n),e=e*e%n,t>>=qn;return r}function tr(e,t,n){let r=e;for(;t-- >Kn;)r*=r,r%=n;return r}function nr(e,t){if(e===Kn)throw Error(`invert: expected non-zero number`);if(t<=Kn)throw Error(`invert: expected positive modulus, got `+t);let n=$n(e,t),r=t,i=Kn,a=qn;for(;n!==Kn;){let e=r/n,t=r%n,o=i-a*e;r=n,n=t,i=a,a=o}if(r!==qn)throw Error(`invert: does not exist`);return $n(i,t)}function rr(e){let t=(e-qn)/Jn,n,r,i;for(n=e-qn,r=0;n%Jn===Kn;n/=Jn,r++);for(i=Jn;i<e&&er(i,t,e)!==e-qn;i++)if(i>1e3)throw Error(`Cannot find square root: likely non-prime P`);if(r===1){let t=(e+qn)/Xn;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error(`Cannot find square root`);return r}}let a=(n+qn)/Jn;return function(e,o){if(e.pow(o,t)===e.neg(e.ONE))throw Error(`Cannot find square root`);let s=r,c=e.pow(e.mul(e.ONE,i),n),l=e.pow(o,a),u=e.pow(o,n);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let n=e.sqr(u);t<s&&!e.eql(n,e.ONE);t++)n=e.sqr(n);let n=e.pow(c,qn<<BigInt(s-t-1));c=e.sqr(n),l=e.mul(l,n),u=e.mul(u,c),s=t}return l}}function ir(e){if(e%Xn===Yn){let t=(e+qn)/Xn;return function(e,n){let r=e.pow(n,t);if(!e.eql(e.sqr(r),n))throw Error(`Cannot find square root`);return r}}if(e%Qn===Zn){let t=(e-Zn)/Qn;return function(e,n){let r=e.mul(n,Jn),i=e.pow(r,t),a=e.mul(n,i),o=e.mul(e.mul(a,Jn),i),s=e.mul(a,e.sub(o,e.ONE));if(!e.eql(e.sqr(s),n))throw Error(`Cannot find square root`);return s}}return rr(e)}var ar=(e,t)=>($n(e,t)&qn)===qn,or=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function sr(e){return Wn(e,or.reduce((e,t)=>(e[t]=`function`,e),{ORDER:`bigint`,MASK:`bigint`,BYTES:`isSafeInteger`,BITS:`isSafeInteger`}))}function cr(e,t,n){if(n<Kn)throw Error(`invalid exponent, negatives unsupported`);if(n===Kn)return e.ONE;if(n===qn)return t;let r=e.ONE,i=t;for(;n>Kn;)n&qn&&(r=e.mul(r,i)),i=e.sqr(i),n>>=qn;return r}function lr(e,t){let n=Array(t.length),r=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),i=e.inv(r);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),i),n}function ur(e,t){let n=t===void 0?e.toString(2).length:t;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function dr(e,t,n=!1,r={}){if(e<=Kn)throw Error(`invalid field: expected ORDER > 0, got `+e);let{nBitLength:i,nByteLength:a}=ur(e,t);if(a>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);let o,s=Object.freeze({ORDER:e,isLE:n,BITS:i,BYTES:a,MASK:Hn(i),ZERO:Kn,ONE:qn,create:t=>$n(t,e),isValid:t=>{if(typeof t!=`bigint`)throw Error(`invalid field element: expected bigint, got `+typeof t);return Kn<=t&&t<e},is0:e=>e===Kn,isOdd:e=>(e&qn)===qn,neg:t=>$n(-t,e),eql:(e,t)=>e===t,sqr:t=>$n(t*t,e),add:(t,n)=>$n(t+n,e),sub:(t,n)=>$n(t-n,e),mul:(t,n)=>$n(t*n,e),pow:(e,t)=>cr(s,e,t),div:(t,n)=>$n(t*nr(n,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>nr(t,e),sqrt:r.sqrt||(t=>(o||=ir(e),o(s,t))),invertBatch:e=>lr(s,e),cmov:(e,t,n)=>n?t:e,toBytes:e=>n?Fn(e,a):Pn(e,a),fromBytes:e=>{if(e.length!==a)throw Error(`Field.fromBytes: expected `+a+` bytes, got `+e.length);return n?Nn(e):Mn(e)}});return Object.freeze(s)}var fr=BigInt(0),pr=BigInt(1);function mr(e,t){let n=t.negate();return e?n:t}function hr(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error(`invalid window size, expected [1..`+t+`], got W=`+e)}function gr(e,t){return hr(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}function _r(e,t){if(!Array.isArray(e))throw Error(`array expected`);e.forEach((e,n)=>{if(!(e instanceof t))throw Error(`invalid point at index `+n)})}function vr(e,t){if(!Array.isArray(e))throw Error(`array of scalars expected`);e.forEach((e,n)=>{if(!t.isValid(e))throw Error(`invalid scalar at index `+n)})}var yr=new WeakMap,br=new WeakMap;function xr(e){return br.get(e)||1}function Sr(e,t){return{constTimeNegate:mr,hasPrecomputes(e){return xr(e)!==1},unsafeLadder(t,n,r=e.ZERO){let i=t;for(;n>fr;)n&pr&&(r=r.add(i)),i=i.double(),n>>=pr;return r},precomputeWindow(e,n){let{windows:r,windowSize:i}=gr(n,t),a=[],o=e,s=o;for(let e=0;e<r;e++){s=o,a.push(s);for(let e=1;e<i;e++)s=s.add(o),a.push(s);o=s.double()}return a},wNAF(n,r,i){let{windows:a,windowSize:o}=gr(n,t),s=e.ZERO,c=e.BASE,l=BigInt(2**n-1),u=2**n,d=BigInt(n);for(let e=0;e<a;e++){let t=e*o,n=Number(i&l);i>>=d,n>o&&(n-=u,i+=pr);let a=t,f=t+Math.abs(n)-1,p=e%2!=0,m=n<0;n===0?c=c.add(mr(p,r[a])):s=s.add(mr(m,r[f]))}return{p:s,f:c}},wNAFUnsafe(n,r,i,a=e.ZERO){let{windows:o,windowSize:s}=gr(n,t),c=BigInt(2**n-1),l=2**n,u=BigInt(n);for(let e=0;e<o;e++){let t=e*s;if(i===fr)break;let n=Number(i&c);if(i>>=u,n>s&&(n-=l,i+=pr),n===0)continue;let o=r[t+Math.abs(n)-1];n<0&&(o=o.negate()),a=a.add(o)}return a},getPrecomputes(e,t,n){let r=yr.get(t);return r||(r=this.precomputeWindow(t,e),e!==1&&yr.set(t,n(r))),r},wNAFCached(e,t,n){let r=xr(e);return this.wNAF(r,this.getPrecomputes(r,e,n),t)},wNAFCachedUnsafe(e,t,n,r){let i=xr(e);return i===1?this.unsafeLadder(e,t,r):this.wNAFUnsafe(i,this.getPrecomputes(i,e,n),t,r)},setWindowSize(e,n){hr(n,t),br.set(e,n),yr.delete(e)}}}function Cr(e,t,n,r){if(_r(n,e),vr(r,t),n.length!==r.length)throw Error(`arrays of points and scalars must have equal length`);let i=e.ZERO,a=Vn(BigInt(n.length)),o=a>12?a-3:a>4?a-2:a?2:1,s=(1<<o)-1,c=Array(s+1).fill(i),l=Math.floor((t.BITS-1)/o)*o,u=i;for(let e=l;e>=0;e-=o){c.fill(i);for(let t=0;t<r.length;t++){let i=r[t],a=Number(i>>BigInt(e)&BigInt(s));c[a]=c[a].add(n[t])}let t=i;for(let e=c.length-1,n=i;e>0;e--)n=n.add(c[e]),t=t.add(n);if(u=u.add(t),e!==0)for(let e=0;e<o;e++)u=u.double()}return u}function wr(e){return sr(e.Fp),Wn(e,{n:`bigint`,h:`bigint`,Gx:`field`,Gy:`field`},{nBitLength:`isSafeInteger`,nByteLength:`isSafeInteger`}),Object.freeze({...ur(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}var Tr=BigInt(0),Er=BigInt(1),Dr=BigInt(2),Or=BigInt(8),kr={zip215:!0};function Ar(e){let t=wr(e);return Wn(e,{hash:`function`,a:`bigint`,d:`bigint`,randomBytes:`function`},{adjustScalarBytes:`function`,domain:`function`,uvRatio:`function`,mapToCurve:`function`}),Object.freeze({...t})}function jr(e){let t=Ar(e),{Fp:n,n:r,prehash:i,hash:a,randomBytes:o,nByteLength:s,h:c}=t,l=Dr<<BigInt(s*8)-Er,u=n.create,d=dr(t.n,t.nBitLength),f=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch{return{isValid:!1,value:Tr}}}),p=t.adjustScalarBytes||(e=>e),m=t.domain||((e,t,n)=>{if(Tn(`phflag`,n),t.length||n)throw Error(`Contexts/pre-hash are not supported`);return e});function h(e,t){Bn(`coordinate `+e,t,Tr,l)}function g(e){if(!(e instanceof y))throw Error(`ExtendedPoint expected`)}let _=Gn((e,t)=>{let{ex:r,ey:i,ez:a}=e,o=e.is0();t??=o?Or:n.inv(a);let s=u(r*t),c=u(i*t),l=u(a*t);if(o)return{x:Tr,y:Er};if(l!==Er)throw Error(`invZ was invalid`);return{x:s,y:c}}),v=Gn(e=>{let{a:n,d:r}=t;if(e.is0())throw Error(`bad point: ZERO`);let{ex:i,ey:a,ez:o,et:s}=e,c=u(i*i),l=u(a*a),d=u(o*o),f=u(d*d);if(u(d*u(u(c*n)+l))!==u(f+u(r*u(c*l))))throw Error(`bad point: equation left != right (1)`);if(u(i*a)!==u(o*s))throw Error(`bad point: equation left != right (2)`);return!0});class y{constructor(e,t,n,r){this.ex=e,this.ey=t,this.ez=n,this.et=r,h(`x`,e),h(`y`,t),h(`z`,n),h(`t`,r),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof y)throw Error(`extended point not allowed`);let{x:t,y:n}=e||{};return h(`x`,t),h(`y`,n),new y(t,n,Er,u(t*n))}static normalizeZ(e){let t=n.invertBatch(e.map(e=>e.ez));return e.map((e,n)=>e.toAffine(t[n])).map(y.fromAffine)}static msm(e,t){return Cr(y,d,e,t)}_setWindowSize(e){S.setWindowSize(this,e)}assertValidity(){v(this)}equals(e){g(e);let{ex:t,ey:n,ez:r}=this,{ex:i,ey:a,ez:o}=e,s=u(t*o),c=u(i*r),l=u(n*o),d=u(a*r);return s===c&&l===d}is0(){return this.equals(y.ZERO)}negate(){return new y(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:e}=t,{ex:n,ey:r,ez:i}=this,a=u(n*n),o=u(r*r),s=u(Dr*u(i*i)),c=u(e*a),l=n+r,d=u(u(l*l)-a-o),f=c+o,p=f-s,m=c-o,h=u(d*p),g=u(f*m),_=u(d*m);return new y(h,g,u(p*f),_)}add(e){g(e);let{a:n,d:r}=t,{ex:i,ey:a,ez:o,et:s}=this,{ex:c,ey:l,ez:d,et:f}=e;if(n===BigInt(-1)){let e=u((a-i)*(l+c)),t=u((a+i)*(l-c)),n=u(t-e);if(n===Tr)return this.double();let r=u(o*Dr*f),p=u(s*Dr*d),m=p+r,h=t+e,g=p-r,_=u(m*n),v=u(h*g),b=u(m*g);return new y(_,v,u(n*h),b)}let p=u(i*c),m=u(a*l),h=u(s*r*f),_=u(o*d),v=u((i+a)*(c+l)-p-m),b=_-h,x=_+h,S=u(m-n*p),C=u(v*b),w=u(x*S),T=u(v*S);return new y(C,w,u(b*x),T)}subtract(e){return this.add(e.negate())}wNAF(e){return S.wNAFCached(this,e,y.normalizeZ)}multiply(e){let t=e;Bn(`scalar`,t,Er,r);let{p:n,f:i}=this.wNAF(t);return y.normalizeZ([n,i])[0]}multiplyUnsafe(e,t=y.ZERO){let n=e;return Bn(`scalar`,n,Tr,r),n===Tr?x:this.is0()||n===Er?this:S.wNAFCachedUnsafe(this,n,y.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return S.unsafeLadder(this,r).is0()}toAffine(e){return _(this,e)}clearCofactor(){let{h:e}=t;return e===Er?this:this.multiplyUnsafe(e)}static fromHex(e,r=!1){let{d:i,a}=t,o=n.BYTES;e=In(`pointHex`,e,o),Tn(`zip215`,r);let s=e.slice(),c=e[o-1];s[o-1]=c&-129;let d=Nn(s);Bn(`pointHex.y`,d,Tr,r?l:n.ORDER);let p=u(d*d),{isValid:m,value:h}=f(u(p-Er),u(i*p-a));if(!m)throw Error(`Point.fromHex: invalid y coordinate`);let g=(h&Er)===Er,_=(c&128)!=0;if(!r&&h===Tr&&_)throw Error(`Point.fromHex: x=0 and x_0=1`);return _!==g&&(h=u(-h)),y.fromAffine({x:h,y:d})}static fromPrivateKey(e){return T(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=Fn(t,n.BYTES);return r[r.length-1]|=e&Er?128:0,r}toHex(){return Dn(this.toRawBytes())}}y.BASE=new y(t.Gx,t.Gy,Er,u(t.Gx*t.Gy)),y.ZERO=new y(Tr,Er,Er,Tr);let{BASE:b,ZERO:x}=y,S=Sr(y,s*8);function C(e){return $n(e,r)}function w(e){return C(Nn(e))}function T(e){let t=n.BYTES;e=In(`private key`,e,t);let r=In(`hashed private key`,a(e),2*t),i=p(r.slice(0,t)),o=r.slice(t,2*t),s=w(i),c=b.multiply(s);return{head:i,prefix:o,scalar:s,point:c,pointBytes:c.toRawBytes()}}function E(e){return T(e).pointBytes}function D(e=new Uint8Array,...t){return w(a(m(Ln(...t),In(`context`,e),!!i)))}function O(e,t,a={}){e=In(`message`,e),i&&(e=i(e));let{prefix:o,scalar:s,pointBytes:c}=T(t),l=D(a.context,o,e),u=b.multiply(l).toRawBytes(),d=C(l+D(a.context,u,c,e)*s);return Bn(`signature.s`,d,Tr,r),In(`result`,Ln(u,Fn(d,n.BYTES)),n.BYTES*2)}let k=kr;function A(e,t,r,a=k){let{context:o,zip215:s}=a,c=n.BYTES;e=In(`signature`,e,2*c),t=In(`message`,t),r=In(`publicKey`,r,c),s!==void 0&&Tn(`zip215`,s),i&&(t=i(t));let l=Nn(e.slice(c,2*c)),u,d,f;try{u=y.fromHex(r,s),d=y.fromHex(e.slice(0,c),s),f=b.multiplyUnsafe(l)}catch{return!1}if(!s&&u.isSmallOrder())return!1;let p=D(o,d.toRawBytes(),u.toRawBytes(),t);return d.add(u.multiplyUnsafe(p)).subtract(f).clearCofactor().equals(y.ZERO)}return b._setWindowSize(8),{CURVE:t,getPublicKey:E,sign:O,verify:A,ExtendedPoint:y,utils:{getExtendedPublicKey:T,randomPrivateKey:()=>o(n.BYTES),precompute(e=8,t=y.BASE){return t._setWindowSize(e),t.multiply(BigInt(3)),t}}}}var Mr=BigInt(`57896044618658097711785492504343953926634992332820282019728792003956564819949`),Nr=BigInt(`19681161376707505956807079304988542015446066515923890162744021073123829784752`),Pr=BigInt(1),Fr=BigInt(2),Ir=BigInt(5),Lr=BigInt(8);function Rr(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),a=Mr,o=e*e%a*e%a,s=tr(tr(o,Fr,a)*o%a,Pr,a)*e%a,c=tr(s,Ir,a)*s%a,l=tr(c,t,a)*c%a,u=tr(l,n,a)*l%a,d=tr(u,r,a)*u%a;return{pow_p_5_8:tr(tr(tr(tr(d,i,a)*d%a,i,a)*d%a,t,a)*c%a,Fr,a)*e%a,b2:o}}function zr(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}function Br(e,t){let n=Mr,r=$n(t*t*t,n),i=Rr(e*$n(r*r*t,n)).pow_p_5_8,a=$n(e*r*i,n),o=$n(t*a*a,n),s=a,c=$n(a*Nr,n),l=o===e,u=o===$n(-e,n),d=o===$n(-e*Nr,n);return l&&(a=s),(u||d)&&(a=c),ar(a,n)&&(a=$n(-a,n)),{isValid:l||u,value:a}}var Vr=dr(Mr,void 0,!0),Hr=jr({a:BigInt(-1),d:BigInt(`37095705934669439343138083508754565189542113879843219016388785533085940283555`),Fp:Vr,n:BigInt(`7237005577332262213973186563042994240857116359379907606001950938285454250989`),h:Lr,Gx:BigInt(`15112221349535400772501151409588531511454012693041857206046113283949847762202`),Gy:BigInt(`46316835694926478169428394003475163141307993866256225615783033603165251855960`),hash:yn,randomBytes:Kt,adjustScalarBytes:zr,uvRatio:Br}),Ur=`EdDSA`,Wr=`base64url`,Gr=`utf8`,Kr=`utf8`,qr=`base58btc`;function Jr(e){return globalThis.Buffer==null?e:new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}function Yr(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?Jr(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function Xr(e,t){t||=e.reduce((e,t)=>e+t.length,0);let n=Yr(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return Jr(n)}function Zr(e,t){if(e.length>=255)throw TypeError(`Alphabet too long`);for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var a=e.charAt(i),o=a.charCodeAt(0);if(n[o]!==255)throw TypeError(a+` is ambiguous`);n[o]=i}var s=e.length,c=e.charAt(0),l=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function d(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;for(var n=0,r=0,i=0,a=t.length;i!==a&&t[i]===0;)i++,n++;for(var o=(a-i)*u+1>>>0,l=new Uint8Array(o);i!==a;){for(var d=t[i],f=0,p=o-1;(d!==0||f<r)&&p!==-1;p--,f++)d+=256*l[p]>>>0,l[p]=d%s>>>0,d=d/s>>>0;if(d!==0)throw Error(`Non-zero carry`);r=f,i++}for(var m=o-r;m!==o&&l[m]===0;)m++;for(var h=c.repeat(n);m<o;++m)h+=e.charAt(l[m]);return h}function f(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;var t=0;if(e[t]!==` `){for(var r=0,i=0;e[t]===c;)r++,t++;for(var a=(e.length-t)*l+1>>>0,o=new Uint8Array(a);e[t];){var u=n[e.charCodeAt(t)];if(u===255)return;for(var d=0,f=a-1;(u!==0||d<i)&&f!==-1;f--,d++)u+=s*o[f]>>>0,o[f]=u%256>>>0,u=u/256>>>0;if(u!==0)throw Error(`Non-zero carry`);i=d,t++}if(e[t]!==` `){for(var p=a-i;p!==a&&o[p]===0;)p++;for(var m=new Uint8Array(r+(a-p)),h=r;p!==a;)m[h++]=o[p++];return m}}}function p(e){var n=f(e);if(n)return n;throw Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:f,decode:p}}var Qr=Zr,$r=e=>{if(e instanceof Uint8Array&&e.constructor.name===`Uint8Array`)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Unknown type, must be binary type`)},ei=e=>new TextEncoder().encode(e),ti=e=>new TextDecoder().decode(e),ni=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error(`Unknown type, must be binary type`)}},ri=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw Error(`Invalid prefix character`);this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e==`string`){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error(`Can only multibase decode strings`)}or(e){return ai(this,e)}},ii=class{constructor(e){this.decoders=e}or(e){return ai(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},ai=(e,t)=>new ii({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),oi=class{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new ni(e,t,n),this.decoder=new ri(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},si=({name:e,prefix:t,encode:n,decode:r})=>new oi(e,t,n,r),ci=({prefix:e,name:t,alphabet:n})=>{let{encode:r,decode:i}=Qr(n,t);return si({prefix:e,name:t,encode:r,decode:e=>$r(i(e))})},li=(e,t,n,r)=>{let i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let a=e.length;for(;e[a-1]===`=`;)--a;let o=new Uint8Array(a*n/8|0),s=0,c=0,l=0;for(let t=0;t<a;++t){let a=i[e[t]];if(a===void 0)throw SyntaxError(`Non-${r} character`);c=c<<n|a,s+=n,s>=8&&(s-=8,o[l++]=255&c>>s)}if(s>=n||255&c<<8-s)throw SyntaxError(`Unexpected end of data`);return o},ui=(e,t,n)=>{let r=t[t.length-1]===`=`,i=(1<<n)-1,a=``,o=0,s=0;for(let r=0;r<e.length;++r)for(s=s<<8|e[r],o+=8;o>n;)o-=n,a+=t[i&s>>o];if(o&&(a+=t[i&s<<n-o]),r)for(;a.length*n&7;)a+=`=`;return a},di=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>si({prefix:t,name:e,encode(e){return ui(e,r,n)},decode(t){return li(t,r,n,e)}}),fi=si({prefix:`\0`,name:`identity`,encode:e=>ti(e),decode:e=>ei(e)}),pi=Object.freeze({__proto__:null,identity:fi}),mi=di({prefix:`0`,name:`base2`,alphabet:`01`,bitsPerChar:1}),hi=Object.freeze({__proto__:null,base2:mi}),gi=di({prefix:`7`,name:`base8`,alphabet:`01234567`,bitsPerChar:3}),_i=Object.freeze({__proto__:null,base8:gi}),vi=ci({prefix:`9`,name:`base10`,alphabet:`0123456789`}),yi=Object.freeze({__proto__:null,base10:vi}),bi=di({prefix:`f`,name:`base16`,alphabet:`0123456789abcdef`,bitsPerChar:4}),xi=di({prefix:`F`,name:`base16upper`,alphabet:`0123456789ABCDEF`,bitsPerChar:4}),Si=Object.freeze({__proto__:null,base16:bi,base16upper:xi}),Ci=di({prefix:`b`,name:`base32`,alphabet:`abcdefghijklmnopqrstuvwxyz234567`,bitsPerChar:5}),wi=di({prefix:`B`,name:`base32upper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,bitsPerChar:5}),Ti=di({prefix:`c`,name:`base32pad`,alphabet:`abcdefghijklmnopqrstuvwxyz234567=`,bitsPerChar:5}),Ei=di({prefix:`C`,name:`base32padupper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=`,bitsPerChar:5}),Di=di({prefix:`v`,name:`base32hex`,alphabet:`0123456789abcdefghijklmnopqrstuv`,bitsPerChar:5}),Oi=di({prefix:`V`,name:`base32hexupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV`,bitsPerChar:5}),ki=di({prefix:`t`,name:`base32hexpad`,alphabet:`0123456789abcdefghijklmnopqrstuv=`,bitsPerChar:5}),Ai=di({prefix:`T`,name:`base32hexpadupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV=`,bitsPerChar:5}),ji=di({prefix:`h`,name:`base32z`,alphabet:`ybndrfg8ejkmcpqxot1uwisza345h769`,bitsPerChar:5}),Mi=Object.freeze({__proto__:null,base32:Ci,base32upper:wi,base32pad:Ti,base32padupper:Ei,base32hex:Di,base32hexupper:Oi,base32hexpad:ki,base32hexpadupper:Ai,base32z:ji}),Ni=ci({prefix:`k`,name:`base36`,alphabet:`0123456789abcdefghijklmnopqrstuvwxyz`}),Pi=ci({prefix:`K`,name:`base36upper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`}),Fi=Object.freeze({__proto__:null,base36:Ni,base36upper:Pi}),Ii=ci({name:`base58btc`,prefix:`z`,alphabet:`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`}),Li=ci({name:`base58flickr`,prefix:`Z`,alphabet:`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`}),Ri=Object.freeze({__proto__:null,base58btc:Ii,base58flickr:Li}),zi=di({prefix:`m`,name:`base64`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,bitsPerChar:6}),Bi=di({prefix:`M`,name:`base64pad`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,bitsPerChar:6}),Vi=di({prefix:`u`,name:`base64url`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,bitsPerChar:6}),Hi=di({prefix:`U`,name:`base64urlpad`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=`,bitsPerChar:6}),Ui=Object.freeze({__proto__:null,base64:zi,base64pad:Bi,base64url:Vi,base64urlpad:Hi}),Wi=Array.from(`🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂`),Gi=Wi.reduce((e,t,n)=>(e[n]=t,e),[]),Ki=Wi.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function qi(e){return e.reduce((e,t)=>(e+=Gi[t],e),``)}function Ji(e){let t=[];for(let n of e){let e=Ki[n.codePointAt(0)];if(e===void 0)throw Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}var Yi=si({prefix:`🚀`,name:`base256emoji`,encode:qi,decode:Ji}),Xi=Object.freeze({__proto__:null,base256emoji:Yi}),Zi=ta,Qi=128,$i=-128,ea=2**31;function ta(e,t,n){t||=[],n||=0;for(var r=n;e>=ea;)t[n++]=e&255|Qi,e/=128;for(;e&$i;)t[n++]=e&255|Qi,e>>>=7;return t[n]=e|0,ta.bytes=n-r+1,t}var na=aa,ra=128,ia=127;function aa(e,t){var n=0,t=t||0,r=0,i=t,a,o=e.length;do{if(i>=o)throw aa.bytes=0,RangeError(`Could not decode varint`);a=e[i++],n+=r<28?(a&ia)<<r:(a&ia)*2**r,r+=7}while(a>=ra);return aa.bytes=i-t,n}var oa=2**7,sa=2**14,ca=2**21,la=2**28,ua=2**35,da=2**42,fa=2**49,pa=2**56,ma=2**63,ha={encode:Zi,decode:na,encodingLength:function(e){return e<oa?1:e<sa?2:e<ca?3:e<la?4:e<ua?5:e<da?6:e<fa?7:e<pa?8:e<ma?9:10}},ga=(e,t,n=0)=>(ha.encode(e,t,n),t),_a=e=>ha.encodingLength(e),va=(e,t)=>{let n=t.byteLength,r=_a(e),i=r+_a(n),a=new Uint8Array(i+n);return ga(e,a,0),ga(n,a,r),a.set(t,i),new ya(e,n,t,a)},ya=class{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}},ba=({name:e,code:t,encode:n})=>new xa(e,t,n),xa=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?va(this.code,t):t.then(e=>va(this.code,e))}else throw Error(`Unknown type, must be binary type`)}},Sa=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Ca=ba({name:`sha2-256`,code:18,encode:Sa(`SHA-256`)}),wa=ba({name:`sha2-512`,code:19,encode:Sa(`SHA-512`)}),Ta=Object.freeze({__proto__:null,sha256:Ca,sha512:wa}),Ea=0,Da=`identity`,Oa=$r,ka=Object.freeze({__proto__:null,identity:{code:Ea,name:Da,encode:Oa,digest:e=>va(Ea,Oa(e))}});new TextEncoder,new TextDecoder;var Aa={...pi,...hi,..._i,...yi,...Si,...Mi,...Fi,...Ri,...Ui,...Xi};({...Ta,...ka});function ja(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}var Ma=ja(`utf8`,`u`,e=>`u`+new TextDecoder(`utf8`).decode(e),e=>new TextEncoder().encode(e.substring(1))),Na=ja(`ascii`,`a`,e=>{let t=`a`;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);let t=Yr(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),Pa={utf8:Ma,"utf-8":Ma,hex:Aa.base16,latin1:Na,ascii:Na,binary:Na,...Aa};function Fa(e,t=`utf8`){let n=Pa[t];if(!n)throw Error(`Unsupported encoding "${t}"`);return(t===`utf8`||t===`utf-8`)&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`utf8`):n.encoder.encode(e).substring(1)}function Ia(e,t=`utf8`){let n=Pa[t];if(!n)throw Error(`Unsupported encoding "${t}"`);return(t===`utf8`||t===`utf-8`)&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?Jr(globalThis.Buffer.from(e,`utf-8`)):n.decoder.decode(`${n.prefix}${e}`)}function La(e){return Ke(Fa(Ia(e,Wr),Gr))}function Ra(e){return Fa(Ia(qe(e),Gr),Wr)}function za(e){return[`did`,`key`,`z`+Fa(Xr([Ia(`K36`,qr),e]),qr)].join(`:`)}function Ba(e){return Fa(e,Wr)}function Va(e){return Ia(e,Wr)}function Ha(e){return Ia([Ra(e.header),Ra(e.payload)].join(`.`),Kr)}function Ua(e){return[Ra(e.header),Ra(e.payload),Ba(e.signature)].join(`.`)}function Wa(e){let t=e.split(`.`);return{header:La(t[0]),payload:La(t[1]),signature:Va(t[2]),data:Ia(t.slice(0,2).join(`.`),Kr)}}function Ga(e=Kt(32)){let t=Hr.getPublicKey(e);return{secretKey:Xr([e,t]),publicKey:t}}async function Ka(e,t,n,r,i=(0,V.fromMiliseconds)(Date.now())){let a={alg:Ur,typ:`JWT`},o={iss:za(r.publicKey),sub:e,aud:t,iat:i,exp:i+n},s=Ha({header:a,payload:o});return Ua({header:a,payload:o,signature:Hr.sign(s,r.secretKey.slice(0,32))})}var qa=function(e,t,n){if(n||arguments.length===2)for(var r=0,i=t.length,a;r<i;r++)(a||!(r in t))&&(a||=Array.prototype.slice.call(t,0,r),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))},Ja=function(){function e(e,t,n){this.name=e,this.version=t,this.os=n,this.type=`browser`}return e}(),Ya=function(){function e(e){this.version=e,this.type=`node`,this.name=`node`,this.os=process.platform}return e}(),Xa=function(){function e(e,t,n,r){this.name=e,this.version=t,this.os=n,this.bot=r,this.type=`bot-device`}return e}(),Za=function(){function e(){this.type=`bot`,this.bot=!0,this.name=`bot`,this.version=null,this.os=null}return e}(),Qa=function(){function e(){this.type=`react-native`,this.name=`react-native`,this.version=null,this.os=null}return e}(),$a=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,eo=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,to=3,no=[[`aol`,/AOLShield\/([0-9\._]+)/],[`edge`,/Edge\/([0-9\._]+)/],[`edge-ios`,/EdgiOS\/([0-9\._]+)/],[`yandexbrowser`,/YaBrowser\/([0-9\._]+)/],[`kakaotalk`,/KAKAOTALK\s([0-9\.]+)/],[`samsung`,/SamsungBrowser\/([0-9\.]+)/],[`silk`,/\bSilk\/([0-9._-]+)\b/],[`miui`,/MiuiBrowser\/([0-9\.]+)$/],[`beaker`,/BeakerBrowser\/([0-9\.]+)/],[`edge-chromium`,/EdgA?\/([0-9\.]+)/],[`chromium-webview`,/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],[`chrome`,/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],[`phantomjs`,/PhantomJS\/([0-9\.]+)(:?\s|$)/],[`crios`,/CriOS\/([0-9\.]+)(:?\s|$)/],[`firefox`,/Firefox\/([0-9\.]+)(?:\s|$)/],[`fxios`,/FxiOS\/([0-9\.]+)/],[`opera-mini`,/Opera Mini.*Version\/([0-9\.]+)/],[`opera`,/Opera\/([0-9\.]+)(?:\s|$)/],[`opera`,/OPR\/([0-9\.]+)(:?\s|$)/],[`pie`,/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],[`pie`,/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],[`netfront`,/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],[`ie`,/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],[`ie`,/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],[`ie`,/MSIE\s(7\.0)/],[`bb10`,/BB10;\sTouch.*Version\/([0-9\.]+)/],[`android`,/Android\s([0-9\.]+)/],[`ios`,/Version\/([0-9\._]+).*Mobile.*Safari.*/],[`safari`,/Version\/([0-9\._]+).*Safari/],[`facebook`,/FB[AS]V\/([0-9\.]+)/],[`instagram`,/Instagram\s([0-9\.]+)/],[`ios-webview`,/AppleWebKit\/([0-9\.]+).*Mobile/],[`ios-webview`,/AppleWebKit\/([0-9\.]+).*Gecko\)$/],[`curl`,/^curl\/([0-9\.]+)$/],[`searchbot`,$a]],ro=[[`iOS`,/iP(hone|od|ad)/],[`Android OS`,/Android/],[`BlackBerry OS`,/BlackBerry|BB10/],[`Windows Mobile`,/IEMobile/],[`Amazon OS`,/Kindle/],[`Windows 3.11`,/Win16/],[`Windows 95`,/(Windows 95)|(Win95)|(Windows_95)/],[`Windows 98`,/(Windows 98)|(Win98)/],[`Windows 2000`,/(Windows NT 5.0)|(Windows 2000)/],[`Windows XP`,/(Windows NT 5.1)|(Windows XP)/],[`Windows Server 2003`,/(Windows NT 5.2)/],[`Windows Vista`,/(Windows NT 6.0)/],[`Windows 7`,/(Windows NT 6.1)/],[`Windows 8`,/(Windows NT 6.2)/],[`Windows 8.1`,/(Windows NT 6.3)/],[`Windows 10`,/(Windows NT 10.0)/],[`Windows ME`,/Windows ME/],[`Windows CE`,/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],[`Open BSD`,/OpenBSD/],[`Sun OS`,/SunOS/],[`Chrome OS`,/CrOS/],[`Linux`,/(Linux)|(X11)/],[`Mac OS`,/(Mac_PowerPC)|(Macintosh)/],[`QNX`,/QNX/],[`BeOS`,/BeOS/],[`OS/2`,/OS\/2/]];function io(e){return e?oo(e):typeof document>`u`&&typeof navigator<`u`&&navigator.product===`ReactNative`?new Qa:typeof navigator<`u`?oo(navigator.userAgent):co()}function ao(e){return e!==``&&no.reduce(function(t,n){var r=n[0],i=n[1];if(t)return t;var a=i.exec(e);return!!a&&[r,a]},!1)}function oo(e){var t=ao(e);if(!t)return null;var n=t[0],r=t[1];if(n===`searchbot`)return new Za;var i=r[1]&&r[1].split(`.`).join(`_`).split(`_`).slice(0,3);i?i.length<to&&(i=qa(qa([],i,!0),lo(to-i.length),!0)):i=[];var a=i.join(`.`),o=so(e),s=eo.exec(e);return s&&s[1]?new Xa(n,a,o,s[1]):new Ja(n,a,o)}function so(e){for(var t=0,n=ro.length;t<n;t++){var r=ro[t],i=r[0];if(r[1].exec(e))return i}return null}function co(){return typeof process<`u`&&process.version?new Ya(process.version.slice(1)):null}function lo(e){for(var t=[],n=0;n<e;n++)t.push(`0`);return t}var uo=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getLocalStorage=e.getLocalStorageOrThrow=e.getCrypto=e.getCryptoOrThrow=e.getLocation=e.getLocationOrThrow=e.getNavigator=e.getNavigatorOrThrow=e.getDocument=e.getDocumentOrThrow=e.getFromWindowOrThrow=e.getFromWindow=void 0;function t(e){let t;return typeof window<`u`&&window[e]!==void 0&&(t=window[e]),t}e.getFromWindow=t;function n(e){let n=t(e);if(!n)throw Error(`${e} is not defined in Window`);return n}e.getFromWindowOrThrow=n;function r(){return n(`document`)}e.getDocumentOrThrow=r;function i(){return t(`document`)}e.getDocument=i;function a(){return n(`navigator`)}e.getNavigatorOrThrow=a;function o(){return t(`navigator`)}e.getNavigator=o;function s(){return n(`location`)}e.getLocationOrThrow=s;function c(){return t(`location`)}e.getLocation=c;function l(){return n(`crypto`)}e.getCryptoOrThrow=l;function u(){return t(`crypto`)}e.getCrypto=u;function d(){return n(`localStorage`)}e.getLocalStorageOrThrow=d;function f(){return t(`localStorage`)}e.getLocalStorage=f})),fo=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.getWindowMetadata=void 0;var t=uo();function n(){let e,n;try{e=t.getDocumentOrThrow(),n=t.getLocationOrThrow()}catch{return null}function r(){let t=e.getElementsByTagName(`link`),r=[];for(let e=0;e<t.length;e++){let i=t[e],a=i.getAttribute(`rel`);if(a&&a.toLowerCase().indexOf(`icon`)>-1){let e=i.getAttribute(`href`);if(e)if(e.toLowerCase().indexOf(`https:`)===-1&&e.toLowerCase().indexOf(`http:`)===-1&&e.indexOf(`//`)!==0){let t=n.protocol+`//`+n.host;if(e.indexOf(`/`)===0)t+=e;else{let r=n.pathname.split(`/`);r.pop();let i=r.join(`/`);t+=i+`/`+e}r.push(t)}else if(e.indexOf(`//`)===0){let t=n.protocol+e;r.push(t)}else r.push(e)}}return r}function i(...t){let n=e.getElementsByTagName(`meta`);for(let e=0;e<n.length;e++){let r=n[e],i=[`itemprop`,`property`,`name`].map(e=>r.getAttribute(e)).filter(e=>e?t.includes(e):!1);if(i.length&&i){let e=r.getAttribute(`content`);if(e)return e}}return``}function a(){let t=i(`name`,`og:site_name`,`og:title`,`twitter:title`);return t||=e.title,t}function o(){return i(`description`,`og:description`,`twitter:description`,`keywords`)}let s=a();return{description:o(),url:n.origin,icons:r(),name:s}}e.getWindowMetadata=n})),po=uo(),mo=fo();function ho(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function go(e,t){t||=e.reduce((e,t)=>e+t.length,0);let n=ho(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function _o(e,t){if(e.length>=255)throw TypeError(`Alphabet too long`);for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var a=e.charAt(i),o=a.charCodeAt(0);if(n[o]!==255)throw TypeError(a+` is ambiguous`);n[o]=i}var s=e.length,c=e.charAt(0),l=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function d(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;for(var n=0,r=0,i=0,a=t.length;i!==a&&t[i]===0;)i++,n++;for(var o=(a-i)*u+1>>>0,l=new Uint8Array(o);i!==a;){for(var d=t[i],f=0,p=o-1;(d!==0||f<r)&&p!==-1;p--,f++)d+=256*l[p]>>>0,l[p]=d%s>>>0,d=d/s>>>0;if(d!==0)throw Error(`Non-zero carry`);r=f,i++}for(var m=o-r;m!==o&&l[m]===0;)m++;for(var h=c.repeat(n);m<o;++m)h+=e.charAt(l[m]);return h}function f(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;var t=0;if(e[t]!==` `){for(var r=0,i=0;e[t]===c;)r++,t++;for(var a=(e.length-t)*l+1>>>0,o=new Uint8Array(a);e[t];){var u=n[e.charCodeAt(t)];if(u===255)return;for(var d=0,f=a-1;(u!==0||d<i)&&f!==-1;f--,d++)u+=s*o[f]>>>0,o[f]=u%256>>>0,u=u/256>>>0;if(u!==0)throw Error(`Non-zero carry`);i=d,t++}if(e[t]!==` `){for(var p=a-i;p!==a&&o[p]===0;)p++;for(var m=new Uint8Array(r+(a-p)),h=r;p!==a;)m[h++]=o[p++];return m}}}function p(e){var n=f(e);if(n)return n;throw Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:f,decode:p}}var vo=_o,yo=e=>{if(e instanceof Uint8Array&&e.constructor.name===`Uint8Array`)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Unknown type, must be binary type`)},bo=e=>new TextEncoder().encode(e),xo=e=>new TextDecoder().decode(e),So=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error(`Unknown type, must be binary type`)}},Co=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw Error(`Invalid prefix character`);this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e==`string`){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error(`Can only multibase decode strings`)}or(e){return To(this,e)}},wo=class{constructor(e){this.decoders=e}or(e){return To(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},To=(e,t)=>new wo({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),Eo=class{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new So(e,t,n),this.decoder=new Co(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},Do=({name:e,prefix:t,encode:n,decode:r})=>new Eo(e,t,n,r),Oo=({prefix:e,name:t,alphabet:n})=>{let{encode:r,decode:i}=vo(n,t);return Do({prefix:e,name:t,encode:r,decode:e=>yo(i(e))})},ko=(e,t,n,r)=>{let i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let a=e.length;for(;e[a-1]===`=`;)--a;let o=new Uint8Array(a*n/8|0),s=0,c=0,l=0;for(let t=0;t<a;++t){let a=i[e[t]];if(a===void 0)throw SyntaxError(`Non-${r} character`);c=c<<n|a,s+=n,s>=8&&(s-=8,o[l++]=255&c>>s)}if(s>=n||255&c<<8-s)throw SyntaxError(`Unexpected end of data`);return o},Ao=(e,t,n)=>{let r=t[t.length-1]===`=`,i=(1<<n)-1,a=``,o=0,s=0;for(let r=0;r<e.length;++r)for(s=s<<8|e[r],o+=8;o>n;)o-=n,a+=t[i&s>>o];if(o&&(a+=t[i&s<<n-o]),r)for(;a.length*n&7;)a+=`=`;return a},jo=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>Do({prefix:t,name:e,encode(e){return Ao(e,r,n)},decode(t){return ko(t,r,n,e)}}),Mo=i({identity:()=>No}),No=Do({prefix:`\0`,name:`identity`,encode:e=>xo(e),decode:e=>bo(e)}),Po=i({base2:()=>Fo}),Fo=jo({prefix:`0`,name:`base2`,alphabet:`01`,bitsPerChar:1}),Io=i({base8:()=>Lo}),Lo=jo({prefix:`7`,name:`base8`,alphabet:`01234567`,bitsPerChar:3}),Ro=i({base10:()=>zo}),zo=Oo({prefix:`9`,name:`base10`,alphabet:`0123456789`}),Bo=i({base16:()=>Vo,base16upper:()=>Ho}),Vo=jo({prefix:`f`,name:`base16`,alphabet:`0123456789abcdef`,bitsPerChar:4}),Ho=jo({prefix:`F`,name:`base16upper`,alphabet:`0123456789ABCDEF`,bitsPerChar:4}),Uo=i({base32:()=>Wo,base32hex:()=>Jo,base32hexpad:()=>Xo,base32hexpadupper:()=>Zo,base32hexupper:()=>Yo,base32pad:()=>Ko,base32padupper:()=>qo,base32upper:()=>Go,base32z:()=>Qo}),Wo=jo({prefix:`b`,name:`base32`,alphabet:`abcdefghijklmnopqrstuvwxyz234567`,bitsPerChar:5}),Go=jo({prefix:`B`,name:`base32upper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,bitsPerChar:5}),Ko=jo({prefix:`c`,name:`base32pad`,alphabet:`abcdefghijklmnopqrstuvwxyz234567=`,bitsPerChar:5}),qo=jo({prefix:`C`,name:`base32padupper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=`,bitsPerChar:5}),Jo=jo({prefix:`v`,name:`base32hex`,alphabet:`0123456789abcdefghijklmnopqrstuv`,bitsPerChar:5}),Yo=jo({prefix:`V`,name:`base32hexupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV`,bitsPerChar:5}),Xo=jo({prefix:`t`,name:`base32hexpad`,alphabet:`0123456789abcdefghijklmnopqrstuv=`,bitsPerChar:5}),Zo=jo({prefix:`T`,name:`base32hexpadupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV=`,bitsPerChar:5}),Qo=jo({prefix:`h`,name:`base32z`,alphabet:`ybndrfg8ejkmcpqxot1uwisza345h769`,bitsPerChar:5}),$o=i({base36:()=>es,base36upper:()=>ts}),es=Oo({prefix:`k`,name:`base36`,alphabet:`0123456789abcdefghijklmnopqrstuvwxyz`}),ts=Oo({prefix:`K`,name:`base36upper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`}),ns=i({base58btc:()=>rs,base58flickr:()=>is}),rs=Oo({name:`base58btc`,prefix:`z`,alphabet:`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`}),is=Oo({name:`base58flickr`,prefix:`Z`,alphabet:`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`}),as=i({base64:()=>os,base64pad:()=>ss,base64url:()=>cs,base64urlpad:()=>ls}),os=jo({prefix:`m`,name:`base64`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,bitsPerChar:6}),ss=jo({prefix:`M`,name:`base64pad`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,bitsPerChar:6}),cs=jo({prefix:`u`,name:`base64url`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,bitsPerChar:6}),ls=jo({prefix:`U`,name:`base64urlpad`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=`,bitsPerChar:6}),us=i({base256emoji:()=>gs}),ds=Array.from(`🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂`),fs=ds.reduce((e,t,n)=>(e[n]=t,e),[]),ps=ds.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function ms(e){return e.reduce((e,t)=>(e+=fs[t],e),``)}function hs(e){let t=[];for(let n of e){let e=ps[n.codePointAt(0)];if(e===void 0)throw Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}var gs=Do({prefix:`🚀`,name:`base256emoji`,encode:ms,decode:hs}),_s=xs,vs=128,ys=-128,bs=2**31;function xs(e,t,n){t||=[],n||=0;for(var r=n;e>=bs;)t[n++]=e&255|vs,e/=128;for(;e&ys;)t[n++]=e&255|vs,e>>>=7;return t[n]=e|0,xs.bytes=n-r+1,t}var Ss=Ts,Cs=128,ws=127;function Ts(e,t){var n=0,t=t||0,r=0,i=t,a,o=e.length;do{if(i>=o)throw Ts.bytes=0,RangeError(`Could not decode varint`);a=e[i++],n+=r<28?(a&ws)<<r:(a&ws)*2**r,r+=7}while(a>=Cs);return Ts.bytes=i-t,n}var Es=2**7,Ds=2**14,Os=2**21,ks=2**28,As=2**35,js=2**42,Ms=2**49,Ns=2**56,Ps=2**63,Fs={encode:_s,decode:Ss,encodingLength:function(e){return e<Es?1:e<Ds?2:e<Os?3:e<ks?4:e<As?5:e<js?6:e<Ms?7:e<Ns?8:e<Ps?9:10}},Is=(e,t,n=0)=>(Fs.encode(e,t,n),t),Ls=e=>Fs.encodingLength(e),Rs=(e,t)=>{let n=t.byteLength,r=Ls(e),i=r+Ls(n),a=new Uint8Array(i+n);return Is(e,a,0),Is(n,a,r),a.set(t,i),new zs(e,n,t,a)},zs=class{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}},Bs=({name:e,code:t,encode:n})=>new Vs(e,t,n),Vs=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?Rs(this.code,t):t.then(e=>Rs(this.code,e))}else throw Error(`Unknown type, must be binary type`)}},Hs=i({sha256:()=>Ws,sha512:()=>Gs}),Us=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Ws=Bs({name:`sha2-256`,code:18,encode:Us(`SHA-256`)}),Gs=Bs({name:`sha2-512`,code:19,encode:Us(`SHA-512`)}),Ks=i({identity:()=>Xs}),qs=0,Js=`identity`,Ys=yo,Xs={code:qs,name:Js,encode:Ys,digest:e=>Rs(qs,Ys(e))};new TextEncoder,new TextDecoder;var Zs={...Mo,...Po,...Io,...Ro,...Bo,...Uo,...$o,...ns,...as,...us};({...Hs,...Ks});function Qs(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}var $s=Qs(`utf8`,`u`,e=>`u`+new TextDecoder(`utf8`).decode(e),e=>new TextEncoder().encode(e.substring(1))),ec=Qs(`ascii`,`a`,e=>{let t=`a`;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);let t=ho(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),tc={utf8:$s,"utf-8":$s,hex:Zs.base16,latin1:ec,ascii:ec,binary:ec,...Zs};function nc(e,t=`utf8`){let n=tc[t];if(!n)throw Error(`Unsupported encoding "${t}"`);return(t===`utf8`||t===`utf-8`)&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,`utf8`):n.decoder.decode(`${n.prefix}${e}`)}function rc(e,t=`utf8`){let n=tc[t];if(!n)throw Error(`Unsupported encoding "${t}"`);return(t===`utf8`||t===`utf-8`)&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString(`utf8`):n.encoder.encode(e).substring(1)}var ic=i({author:()=>pc,bugs:()=>mc,default:()=>vc,dependencies:()=>_c,description:()=>sc,devDependencies:()=>gc,files:()=>lc,homepage:()=>hc,keywords:()=>fc,license:()=>`MIT`,main:()=>cc,name:()=>ac,repository:()=>dc,scripts:()=>uc,version:()=>oc}),ac,oc,sc,cc,lc,uc,dc,fc,pc,mc,hc,gc,_c,vc,yc=n((()=>{ac=`elliptic`,oc=`6.6.1`,sc=`EC cryptography`,cc=`lib/elliptic.js`,lc=[`lib`],uc={lint:`eslint lib test`,"lint:fix":`npm run lint -- --fix`,unit:`istanbul test _mocha --reporter=spec test/index.js`,test:`npm run lint && npm run unit`,version:`grunt dist && git add dist/`},dc={type:`git`,url:`git@github.com:indutny/elliptic`},fc=[`EC`,`Elliptic`,`curve`,`Cryptography`],pc=`Fedor Indutny <fedor@indutny.com>`,mc={url:`https://github.com/indutny/elliptic/issues`},hc=`https://github.com/indutny/elliptic`,gc={brfs:`^2.0.2`,coveralls:`^3.1.0`,eslint:`^7.6.0`,grunt:`^1.2.1`,"grunt-browserify":`^5.3.0`,"grunt-cli":`^1.3.2`,"grunt-contrib-connect":`^3.0.0`,"grunt-contrib-copy":`^1.0.0`,"grunt-contrib-uglify":`^5.0.0`,"grunt-mocha-istanbul":`^5.0.2`,"grunt-saucelabs":`^9.0.1`,istanbul:`^0.4.5`,mocha:`^8.0.1`},_c={"bn.js":`^4.11.9`,brorand:`^1.1.0`,"hash.js":`^1.0.0`,"hmac-drbg":`^1.0.1`,inherits:`^2.0.4`,"minimalistic-assert":`^1.0.1`,"minimalistic-crypto-utils":`^1.0.1`},vc={name:ac,version:oc,description:sc,main:cc,files:lc,scripts:uc,repository:dc,keywords:fc,author:pc,license:`MIT`,bugs:mc,homepage:hc,devDependencies:gc,dependencies:_c}})),bc=a(((e,t)=>{(function(e,t){function n(e,t){if(!e)throw Error(t||`Assertion failed`)}function r(e,t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}function i(e,t,n){if(i.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t===`le`||t===`be`)&&(n=t,t=10),this._init(e||0,t||10,n||`be`))}typeof e==`object`?e.exports=i:t.BN=i,i.BN=i,i.wordSize=26;var a;try{a=typeof window<`u`&&window.Buffer!==void 0?window.Buffer:s().Buffer}catch{}i.isBN=function(e){return e instanceof i?!0:typeof e==`object`&&!!e&&e.constructor.wordSize===i.wordSize&&Array.isArray(e.words)},i.max=function(e,t){return e.cmp(t)>0?e:t},i.min=function(e,t){return e.cmp(t)<0?e:t},i.prototype._init=function(e,t,r){if(typeof e==`number`)return this._initNumber(e,t,r);if(typeof e==`object`)return this._initArray(e,t,r);t===`hex`&&(t=16),n(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,``);var i=0;e[0]===`-`&&(i++,this.negative=1),i<e.length&&(t===16?this._parseHex(e,i,r):(this._parseBase(e,t,i),r===`le`&&this._initArray(this.toArray(),t,r)))},i.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),r===`le`&&this._initArray(this.toArray(),t,r)},i.prototype._initArray=function(e,t,r){if(n(typeof e.length==`number`),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var a,o,s=0;if(r===`be`)for(i=e.length-1,a=0;i>=0;i-=3)o=e[i]|e[i-1]<<8|e[i-2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);else if(r===`le`)for(i=0,a=0;i<e.length;i+=3)o=e[i]|e[i+1]<<8|e[i+2]<<16,this.words[a]|=o<<s&67108863,this.words[a+1]=o>>>26-s&67108863,s+=24,s>=26&&(s-=26,a++);return this.strip()};function o(e,t){var n=e.charCodeAt(t);return n>=65&&n<=70?n-55:n>=97&&n<=102?n-87:n-48&15}function c(e,t,n){var r=o(e,n);return n-1>=t&&(r|=o(e,n-1)<<4),r}i.prototype._parseHex=function(e,t,n){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var r=0;r<this.length;r++)this.words[r]=0;var i=0,a=0,o;if(n===`be`)for(r=e.length-1;r>=t;r-=2)o=c(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;else for(r=(e.length-t)%2==0?t+1:t;r<e.length;r+=2)o=c(e,t,r)<<i,this.words[a]|=o&67108863,i>=18?(i-=18,a+=1,this.words[a]|=o>>>26):i+=8;this.strip()};function l(e,t,n,r){for(var i=0,a=Math.min(e.length,n),o=t;o<a;o++){var s=e.charCodeAt(o)-48;i*=r,s>=49?i+=s-49+10:s>=17?i+=s-17+10:i+=s}return i}i.prototype._parseBase=function(e,t,n){this.words=[0],this.length=1;for(var r=0,i=1;i<=67108863;i*=t)r++;r--,i=i/t|0;for(var a=e.length-n,o=a%r,s=Math.min(a,a-o)+n,c=0,u=n;u<s;u+=r)c=l(e,u,u+r,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(o!==0){var d=1;for(c=l(e,u,e.length,t),u=0;u<o;u++)d*=t;this.imuln(d),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this.strip()},i.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},i.prototype.clone=function(){var e=new i(null);return this.copy(e),e},i.prototype._expand=function(e){for(;this.length<e;)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},i.prototype.inspect=function(){return(this.red?`<BN-R: `:`<BN: `)+this.toString(16)+`>`};var u=`.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`.split(`.`),d=[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],f=[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(e,t){e||=10,t=t|0||1;var r;if(e===16||e===`hex`){r=``;for(var i=0,a=0,o=0;o<this.length;o++){var s=this.words[o],c=((s<<i|a)&16777215).toString(16);a=s>>>24-i&16777215,i+=2,i>=26&&(i-=26,o--),r=a!==0||o!==this.length-1?u[6-c.length]+c+r:c+r}for(a!==0&&(r=a.toString(16)+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}if(e===(e|0)&&e>=2&&e<=36){var l=d[e],p=f[e];r=``;var m=this.clone();for(m.negative=0;!m.isZero();){var h=m.modn(p).toString(e);m=m.idivn(p),r=m.isZero()?h+r:u[l-h.length]+h+r}for(this.isZero()&&(r=`0`+r);r.length%t!==0;)r=`0`+r;return this.negative!==0&&(r=`-`+r),r}n(!1,`Base should be between 2 and 36`)},i.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&n(!1,`Number can only safely store up to 53 bits`),this.negative===0?e:-e},i.prototype.toJSON=function(){return this.toString(16)},i.prototype.toBuffer=function(e,t){return n(a!==void 0),this.toArrayLike(a,e,t)},i.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},i.prototype.toArrayLike=function(e,t,r){var i=this.byteLength(),a=r||Math.max(1,i);n(i<=a,`byte array longer than desired length`),n(a>0,`Requested array length <= 0`),this.strip();var o=t===`le`,s=new e(a),c,l,u=this.clone();if(o){for(l=0;!u.isZero();l++)c=u.andln(255),u.iushrn(8),s[l]=c;for(;l<a;l++)s[l]=0}else{for(l=0;l<a-i;l++)s[l]=0;for(l=0;!u.isZero();l++)c=u.andln(255),u.iushrn(8),s[a-l-1]=c}return s},Math.clz32?i.prototype._countBits=function(e){return 32-Math.clz32(e)}:i.prototype._countBits=function(e){var t=e,n=0;return t>=4096&&(n+=13,t>>>=13),t>=64&&(n+=7,t>>>=7),t>=8&&(n+=4,t>>>=4),t>=2&&(n+=2,t>>>=2),n+t},i.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,n=0;return t&8191||(n+=13,t>>>=13),t&127||(n+=7,t>>>=7),t&15||(n+=4,t>>>=4),t&3||(n+=2,t>>>=2),t&1||n++,n},i.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function p(e){for(var t=Array(e.bitLength()),n=0;n<t.length;n++){var r=n/26|0,i=n%26;t[n]=(e.words[r]&1<<i)>>>i}return t}i.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var n=this._zeroBits(this.words[t]);if(e+=n,n!==26)break}return e},i.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},i.prototype.toTwos=function(e){return this.negative===0?this.clone():this.abs().inotn(e).iaddn(1)},i.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).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(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},i.prototype.ior=function(e){return n((this.negative|e.negative)===0),this.iuor(e)},i.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},i.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},i.prototype.iuand=function(e){for(var t=this.length>e.length?e:this,n=0;n<t.length;n++)this.words[n]=this.words[n]&e.words[n];return this.length=t.length,this.strip()},i.prototype.iand=function(e){return n((this.negative|e.negative)===0),this.iuand(e)},i.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},i.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},i.prototype.iuxor=function(e){var t,n;this.length>e.length?(t=this,n=e):(t=e,n=this);for(var r=0;r<n.length;r++)this.words[r]=t.words[r]^n.words[r];if(this!==t)for(;r<t.length;r++)this.words[r]=t.words[r];return this.length=t.length,this.strip()},i.prototype.ixor=function(e){return n((this.negative|e.negative)===0),this.iuxor(e)},i.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},i.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},i.prototype.inotn=function(e){n(typeof e==`number`&&e>=0);var t=Math.ceil(e/26)|0,r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=~this.words[i]&67108863;return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this.strip()},i.prototype.notn=function(e){return this.clone().inotn(e)},i.prototype.setn=function(e,t){n(typeof e==`number`&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this.strip()},i.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var n,r;this.length>e.length?(n=this,r=e):(n=e,r=this);for(var i=0,a=0;a<r.length;a++)t=(n.words[a]|0)+(r.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;for(;i!==0&&a<n.length;a++)t=(n.words[a]|0)+i,this.words[a]=t&67108863,i=t>>>26;if(this.length=n.length,i!==0)this.words[this.length]=i,this.length++;else if(n!==this)for(;a<n.length;a++)this.words[a]=n.words[a];return this},i.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},i.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(n===0)return this.negative=0,this.length=1,this.words[0]=0,this;var r,i;n>0?(r=this,i=e):(r=e,i=this);for(var a=0,o=0;o<i.length;o++)t=(r.words[o]|0)-(i.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;for(;a!==0&&o<r.length;o++)t=(r.words[o]|0)+a,a=t>>26,this.words[o]=t&67108863;if(a===0&&o<r.length&&r!==this)for(;o<r.length;o++)this.words[o]=r.words[o];return this.length=Math.max(this.length,o),r!==this&&(this.negative=1),this.strip()},i.prototype.sub=function(e){return this.clone().isub(e)};function m(e,t,n){n.negative=t.negative^e.negative;var r=e.length+t.length|0;n.length=r,r=r-1|0;var i=e.words[0]|0,a=t.words[0]|0,o=i*a,s=o&67108863,c=o/67108864|0;n.words[0]=s;for(var l=1;l<r;l++){for(var u=c>>>26,d=c&67108863,f=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=f;p++){var m=l-p|0;i=e.words[m]|0,a=t.words[p]|0,o=i*a+d,u+=o/67108864|0,d=o&67108863}n.words[l]=d|0,c=u|0}return c===0?n.length--:n.words[l]=c|0,n.strip()}var h=function(e,t,n){var r=e.words,i=t.words,a=n.words,o=0,s,c,l,u=r[0]|0,d=u&8191,f=u>>>13,p=r[1]|0,m=p&8191,h=p>>>13,g=r[2]|0,_=g&8191,v=g>>>13,y=r[3]|0,b=y&8191,x=y>>>13,S=r[4]|0,C=S&8191,w=S>>>13,T=r[5]|0,E=T&8191,D=T>>>13,O=r[6]|0,k=O&8191,A=O>>>13,ee=r[7]|0,j=ee&8191,M=ee>>>13,N=r[8]|0,P=N&8191,F=N>>>13,te=r[9]|0,I=te&8191,ne=te>>>13,re=i[0]|0,L=re&8191,R=re>>>13,ie=i[1]|0,z=ie&8191,B=ie>>>13,ae=i[2]|0,V=ae&8191,oe=ae>>>13,se=i[3]|0,ce=se&8191,le=se>>>13,ue=i[4]|0,de=ue&8191,fe=ue>>>13,pe=i[5]|0,me=pe&8191,he=pe>>>13,ge=i[6]|0,H=ge&8191,_e=ge>>>13,ve=i[7]|0,ye=ve&8191,be=ve>>>13,xe=i[8]|0,Se=xe&8191,U=xe>>>13,Ce=i[9]|0,W=Ce&8191,we=Ce>>>13;n.negative=e.negative^t.negative,n.length=19,s=Math.imul(d,L),c=Math.imul(d,R),c=c+Math.imul(f,L)|0,l=Math.imul(f,R);var Te=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Te>>>26)|0,Te&=67108863,s=Math.imul(m,L),c=Math.imul(m,R),c=c+Math.imul(h,L)|0,l=Math.imul(h,R),s=s+Math.imul(d,z)|0,c=c+Math.imul(d,B)|0,c=c+Math.imul(f,z)|0,l=l+Math.imul(f,B)|0;var Ee=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ee>>>26)|0,Ee&=67108863,s=Math.imul(_,L),c=Math.imul(_,R),c=c+Math.imul(v,L)|0,l=Math.imul(v,R),s=s+Math.imul(m,z)|0,c=c+Math.imul(m,B)|0,c=c+Math.imul(h,z)|0,l=l+Math.imul(h,B)|0,s=s+Math.imul(d,V)|0,c=c+Math.imul(d,oe)|0,c=c+Math.imul(f,V)|0,l=l+Math.imul(f,oe)|0;var De=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(De>>>26)|0,De&=67108863,s=Math.imul(b,L),c=Math.imul(b,R),c=c+Math.imul(x,L)|0,l=Math.imul(x,R),s=s+Math.imul(_,z)|0,c=c+Math.imul(_,B)|0,c=c+Math.imul(v,z)|0,l=l+Math.imul(v,B)|0,s=s+Math.imul(m,V)|0,c=c+Math.imul(m,oe)|0,c=c+Math.imul(h,V)|0,l=l+Math.imul(h,oe)|0,s=s+Math.imul(d,ce)|0,c=c+Math.imul(d,le)|0,c=c+Math.imul(f,ce)|0,l=l+Math.imul(f,le)|0;var Oe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Oe>>>26)|0,Oe&=67108863,s=Math.imul(C,L),c=Math.imul(C,R),c=c+Math.imul(w,L)|0,l=Math.imul(w,R),s=s+Math.imul(b,z)|0,c=c+Math.imul(b,B)|0,c=c+Math.imul(x,z)|0,l=l+Math.imul(x,B)|0,s=s+Math.imul(_,V)|0,c=c+Math.imul(_,oe)|0,c=c+Math.imul(v,V)|0,l=l+Math.imul(v,oe)|0,s=s+Math.imul(m,ce)|0,c=c+Math.imul(m,le)|0,c=c+Math.imul(h,ce)|0,l=l+Math.imul(h,le)|0,s=s+Math.imul(d,de)|0,c=c+Math.imul(d,fe)|0,c=c+Math.imul(f,de)|0,l=l+Math.imul(f,fe)|0;var ke=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ke>>>26)|0,ke&=67108863,s=Math.imul(E,L),c=Math.imul(E,R),c=c+Math.imul(D,L)|0,l=Math.imul(D,R),s=s+Math.imul(C,z)|0,c=c+Math.imul(C,B)|0,c=c+Math.imul(w,z)|0,l=l+Math.imul(w,B)|0,s=s+Math.imul(b,V)|0,c=c+Math.imul(b,oe)|0,c=c+Math.imul(x,V)|0,l=l+Math.imul(x,oe)|0,s=s+Math.imul(_,ce)|0,c=c+Math.imul(_,le)|0,c=c+Math.imul(v,ce)|0,l=l+Math.imul(v,le)|0,s=s+Math.imul(m,de)|0,c=c+Math.imul(m,fe)|0,c=c+Math.imul(h,de)|0,l=l+Math.imul(h,fe)|0,s=s+Math.imul(d,me)|0,c=c+Math.imul(d,he)|0,c=c+Math.imul(f,me)|0,l=l+Math.imul(f,he)|0;var Ae=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ae>>>26)|0,Ae&=67108863,s=Math.imul(k,L),c=Math.imul(k,R),c=c+Math.imul(A,L)|0,l=Math.imul(A,R),s=s+Math.imul(E,z)|0,c=c+Math.imul(E,B)|0,c=c+Math.imul(D,z)|0,l=l+Math.imul(D,B)|0,s=s+Math.imul(C,V)|0,c=c+Math.imul(C,oe)|0,c=c+Math.imul(w,V)|0,l=l+Math.imul(w,oe)|0,s=s+Math.imul(b,ce)|0,c=c+Math.imul(b,le)|0,c=c+Math.imul(x,ce)|0,l=l+Math.imul(x,le)|0,s=s+Math.imul(_,de)|0,c=c+Math.imul(_,fe)|0,c=c+Math.imul(v,de)|0,l=l+Math.imul(v,fe)|0,s=s+Math.imul(m,me)|0,c=c+Math.imul(m,he)|0,c=c+Math.imul(h,me)|0,l=l+Math.imul(h,he)|0,s=s+Math.imul(d,H)|0,c=c+Math.imul(d,_e)|0,c=c+Math.imul(f,H)|0,l=l+Math.imul(f,_e)|0;var je=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(je>>>26)|0,je&=67108863,s=Math.imul(j,L),c=Math.imul(j,R),c=c+Math.imul(M,L)|0,l=Math.imul(M,R),s=s+Math.imul(k,z)|0,c=c+Math.imul(k,B)|0,c=c+Math.imul(A,z)|0,l=l+Math.imul(A,B)|0,s=s+Math.imul(E,V)|0,c=c+Math.imul(E,oe)|0,c=c+Math.imul(D,V)|0,l=l+Math.imul(D,oe)|0,s=s+Math.imul(C,ce)|0,c=c+Math.imul(C,le)|0,c=c+Math.imul(w,ce)|0,l=l+Math.imul(w,le)|0,s=s+Math.imul(b,de)|0,c=c+Math.imul(b,fe)|0,c=c+Math.imul(x,de)|0,l=l+Math.imul(x,fe)|0,s=s+Math.imul(_,me)|0,c=c+Math.imul(_,he)|0,c=c+Math.imul(v,me)|0,l=l+Math.imul(v,he)|0,s=s+Math.imul(m,H)|0,c=c+Math.imul(m,_e)|0,c=c+Math.imul(h,H)|0,l=l+Math.imul(h,_e)|0,s=s+Math.imul(d,ye)|0,c=c+Math.imul(d,be)|0,c=c+Math.imul(f,ye)|0,l=l+Math.imul(f,be)|0;var Me=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Me>>>26)|0,Me&=67108863,s=Math.imul(P,L),c=Math.imul(P,R),c=c+Math.imul(F,L)|0,l=Math.imul(F,R),s=s+Math.imul(j,z)|0,c=c+Math.imul(j,B)|0,c=c+Math.imul(M,z)|0,l=l+Math.imul(M,B)|0,s=s+Math.imul(k,V)|0,c=c+Math.imul(k,oe)|0,c=c+Math.imul(A,V)|0,l=l+Math.imul(A,oe)|0,s=s+Math.imul(E,ce)|0,c=c+Math.imul(E,le)|0,c=c+Math.imul(D,ce)|0,l=l+Math.imul(D,le)|0,s=s+Math.imul(C,de)|0,c=c+Math.imul(C,fe)|0,c=c+Math.imul(w,de)|0,l=l+Math.imul(w,fe)|0,s=s+Math.imul(b,me)|0,c=c+Math.imul(b,he)|0,c=c+Math.imul(x,me)|0,l=l+Math.imul(x,he)|0,s=s+Math.imul(_,H)|0,c=c+Math.imul(_,_e)|0,c=c+Math.imul(v,H)|0,l=l+Math.imul(v,_e)|0,s=s+Math.imul(m,ye)|0,c=c+Math.imul(m,be)|0,c=c+Math.imul(h,ye)|0,l=l+Math.imul(h,be)|0,s=s+Math.imul(d,Se)|0,c=c+Math.imul(d,U)|0,c=c+Math.imul(f,Se)|0,l=l+Math.imul(f,U)|0;var Ne=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ne>>>26)|0,Ne&=67108863,s=Math.imul(I,L),c=Math.imul(I,R),c=c+Math.imul(ne,L)|0,l=Math.imul(ne,R),s=s+Math.imul(P,z)|0,c=c+Math.imul(P,B)|0,c=c+Math.imul(F,z)|0,l=l+Math.imul(F,B)|0,s=s+Math.imul(j,V)|0,c=c+Math.imul(j,oe)|0,c=c+Math.imul(M,V)|0,l=l+Math.imul(M,oe)|0,s=s+Math.imul(k,ce)|0,c=c+Math.imul(k,le)|0,c=c+Math.imul(A,ce)|0,l=l+Math.imul(A,le)|0,s=s+Math.imul(E,de)|0,c=c+Math.imul(E,fe)|0,c=c+Math.imul(D,de)|0,l=l+Math.imul(D,fe)|0,s=s+Math.imul(C,me)|0,c=c+Math.imul(C,he)|0,c=c+Math.imul(w,me)|0,l=l+Math.imul(w,he)|0,s=s+Math.imul(b,H)|0,c=c+Math.imul(b,_e)|0,c=c+Math.imul(x,H)|0,l=l+Math.imul(x,_e)|0,s=s+Math.imul(_,ye)|0,c=c+Math.imul(_,be)|0,c=c+Math.imul(v,ye)|0,l=l+Math.imul(v,be)|0,s=s+Math.imul(m,Se)|0,c=c+Math.imul(m,U)|0,c=c+Math.imul(h,Se)|0,l=l+Math.imul(h,U)|0,s=s+Math.imul(d,W)|0,c=c+Math.imul(d,we)|0,c=c+Math.imul(f,W)|0,l=l+Math.imul(f,we)|0;var Pe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Pe>>>26)|0,Pe&=67108863,s=Math.imul(I,z),c=Math.imul(I,B),c=c+Math.imul(ne,z)|0,l=Math.imul(ne,B),s=s+Math.imul(P,V)|0,c=c+Math.imul(P,oe)|0,c=c+Math.imul(F,V)|0,l=l+Math.imul(F,oe)|0,s=s+Math.imul(j,ce)|0,c=c+Math.imul(j,le)|0,c=c+Math.imul(M,ce)|0,l=l+Math.imul(M,le)|0,s=s+Math.imul(k,de)|0,c=c+Math.imul(k,fe)|0,c=c+Math.imul(A,de)|0,l=l+Math.imul(A,fe)|0,s=s+Math.imul(E,me)|0,c=c+Math.imul(E,he)|0,c=c+Math.imul(D,me)|0,l=l+Math.imul(D,he)|0,s=s+Math.imul(C,H)|0,c=c+Math.imul(C,_e)|0,c=c+Math.imul(w,H)|0,l=l+Math.imul(w,_e)|0,s=s+Math.imul(b,ye)|0,c=c+Math.imul(b,be)|0,c=c+Math.imul(x,ye)|0,l=l+Math.imul(x,be)|0,s=s+Math.imul(_,Se)|0,c=c+Math.imul(_,U)|0,c=c+Math.imul(v,Se)|0,l=l+Math.imul(v,U)|0,s=s+Math.imul(m,W)|0,c=c+Math.imul(m,we)|0,c=c+Math.imul(h,W)|0,l=l+Math.imul(h,we)|0;var Fe=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Fe>>>26)|0,Fe&=67108863,s=Math.imul(I,V),c=Math.imul(I,oe),c=c+Math.imul(ne,V)|0,l=Math.imul(ne,oe),s=s+Math.imul(P,ce)|0,c=c+Math.imul(P,le)|0,c=c+Math.imul(F,ce)|0,l=l+Math.imul(F,le)|0,s=s+Math.imul(j,de)|0,c=c+Math.imul(j,fe)|0,c=c+Math.imul(M,de)|0,l=l+Math.imul(M,fe)|0,s=s+Math.imul(k,me)|0,c=c+Math.imul(k,he)|0,c=c+Math.imul(A,me)|0,l=l+Math.imul(A,he)|0,s=s+Math.imul(E,H)|0,c=c+Math.imul(E,_e)|0,c=c+Math.imul(D,H)|0,l=l+Math.imul(D,_e)|0,s=s+Math.imul(C,ye)|0,c=c+Math.imul(C,be)|0,c=c+Math.imul(w,ye)|0,l=l+Math.imul(w,be)|0,s=s+Math.imul(b,Se)|0,c=c+Math.imul(b,U)|0,c=c+Math.imul(x,Se)|0,l=l+Math.imul(x,U)|0,s=s+Math.imul(_,W)|0,c=c+Math.imul(_,we)|0,c=c+Math.imul(v,W)|0,l=l+Math.imul(v,we)|0;var Ie=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ie>>>26)|0,Ie&=67108863,s=Math.imul(I,ce),c=Math.imul(I,le),c=c+Math.imul(ne,ce)|0,l=Math.imul(ne,le),s=s+Math.imul(P,de)|0,c=c+Math.imul(P,fe)|0,c=c+Math.imul(F,de)|0,l=l+Math.imul(F,fe)|0,s=s+Math.imul(j,me)|0,c=c+Math.imul(j,he)|0,c=c+Math.imul(M,me)|0,l=l+Math.imul(M,he)|0,s=s+Math.imul(k,H)|0,c=c+Math.imul(k,_e)|0,c=c+Math.imul(A,H)|0,l=l+Math.imul(A,_e)|0,s=s+Math.imul(E,ye)|0,c=c+Math.imul(E,be)|0,c=c+Math.imul(D,ye)|0,l=l+Math.imul(D,be)|0,s=s+Math.imul(C,Se)|0,c=c+Math.imul(C,U)|0,c=c+Math.imul(w,Se)|0,l=l+Math.imul(w,U)|0,s=s+Math.imul(b,W)|0,c=c+Math.imul(b,we)|0,c=c+Math.imul(x,W)|0,l=l+Math.imul(x,we)|0;var Le=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Le>>>26)|0,Le&=67108863,s=Math.imul(I,de),c=Math.imul(I,fe),c=c+Math.imul(ne,de)|0,l=Math.imul(ne,fe),s=s+Math.imul(P,me)|0,c=c+Math.imul(P,he)|0,c=c+Math.imul(F,me)|0,l=l+Math.imul(F,he)|0,s=s+Math.imul(j,H)|0,c=c+Math.imul(j,_e)|0,c=c+Math.imul(M,H)|0,l=l+Math.imul(M,_e)|0,s=s+Math.imul(k,ye)|0,c=c+Math.imul(k,be)|0,c=c+Math.imul(A,ye)|0,l=l+Math.imul(A,be)|0,s=s+Math.imul(E,Se)|0,c=c+Math.imul(E,U)|0,c=c+Math.imul(D,Se)|0,l=l+Math.imul(D,U)|0,s=s+Math.imul(C,W)|0,c=c+Math.imul(C,we)|0,c=c+Math.imul(w,W)|0,l=l+Math.imul(w,we)|0;var Re=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Re>>>26)|0,Re&=67108863,s=Math.imul(I,me),c=Math.imul(I,he),c=c+Math.imul(ne,me)|0,l=Math.imul(ne,he),s=s+Math.imul(P,H)|0,c=c+Math.imul(P,_e)|0,c=c+Math.imul(F,H)|0,l=l+Math.imul(F,_e)|0,s=s+Math.imul(j,ye)|0,c=c+Math.imul(j,be)|0,c=c+Math.imul(M,ye)|0,l=l+Math.imul(M,be)|0,s=s+Math.imul(k,Se)|0,c=c+Math.imul(k,U)|0,c=c+Math.imul(A,Se)|0,l=l+Math.imul(A,U)|0,s=s+Math.imul(E,W)|0,c=c+Math.imul(E,we)|0,c=c+Math.imul(D,W)|0,l=l+Math.imul(D,we)|0;var ze=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(ze>>>26)|0,ze&=67108863,s=Math.imul(I,H),c=Math.imul(I,_e),c=c+Math.imul(ne,H)|0,l=Math.imul(ne,_e),s=s+Math.imul(P,ye)|0,c=c+Math.imul(P,be)|0,c=c+Math.imul(F,ye)|0,l=l+Math.imul(F,be)|0,s=s+Math.imul(j,Se)|0,c=c+Math.imul(j,U)|0,c=c+Math.imul(M,Se)|0,l=l+Math.imul(M,U)|0,s=s+Math.imul(k,W)|0,c=c+Math.imul(k,we)|0,c=c+Math.imul(A,W)|0,l=l+Math.imul(A,we)|0;var Be=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Be>>>26)|0,Be&=67108863,s=Math.imul(I,ye),c=Math.imul(I,be),c=c+Math.imul(ne,ye)|0,l=Math.imul(ne,be),s=s+Math.imul(P,Se)|0,c=c+Math.imul(P,U)|0,c=c+Math.imul(F,Se)|0,l=l+Math.imul(F,U)|0,s=s+Math.imul(j,W)|0,c=c+Math.imul(j,we)|0,c=c+Math.imul(M,W)|0,l=l+Math.imul(M,we)|0;var Ve=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(Ve>>>26)|0,Ve&=67108863,s=Math.imul(I,Se),c=Math.imul(I,U),c=c+Math.imul(ne,Se)|0,l=Math.imul(ne,U),s=s+Math.imul(P,W)|0,c=c+Math.imul(P,we)|0,c=c+Math.imul(F,W)|0,l=l+Math.imul(F,we)|0;var He=(o+s|0)+((c&8191)<<13)|0;o=(l+(c>>>13)|0)+(He>>>26)|0,He&=67108863,s=Math.imul(I,W),c=Math.imul(I,we),c=c+Math.imul(ne,W)|0,l=Math.imul(ne,we);var Ue=(o+s|0)+((c&8191)<<13)|0;return o=(l+(c>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,a[0]=Te,a[1]=Ee,a[2]=De,a[3]=Oe,a[4]=ke,a[5]=Ae,a[6]=je,a[7]=Me,a[8]=Ne,a[9]=Pe,a[10]=Fe,a[11]=Ie,a[12]=Le,a[13]=Re,a[14]=ze,a[15]=Be,a[16]=Ve,a[17]=He,a[18]=Ue,o!==0&&(a[19]=o,n.length++),n};Math.imul||(h=m);function g(e,t,n){n.negative=t.negative^e.negative,n.length=e.length+t.length;for(var r=0,i=0,a=0;a<n.length-1;a++){var o=i;i=0;for(var s=r&67108863,c=Math.min(a,t.length-1),l=Math.max(0,a-e.length+1);l<=c;l++){var u=a-l,d=(e.words[u]|0)*(t.words[l]|0),f=d&67108863;o=o+(d/67108864|0)|0,f=f+s|0,s=f&67108863,o=o+(f>>>26)|0,i+=o>>>26,o&=67108863}n.words[a]=s,r=o,o=i}return r===0?n.length--:n.words[a]=r,n.strip()}function _(e,t,n){return new v().mulp(e,t,n)}i.prototype.mulTo=function(e,t){var n,r=this.length+e.length;return n=this.length===10&&e.length===10?h(this,e,t):r<63?m(this,e,t):r<1024?g(this,e,t):_(this,e,t),n};function v(e,t){this.x=e,this.y=t}v.prototype.makeRBT=function(e){for(var t=Array(e),n=i.prototype._countBits(e)-1,r=0;r<e;r++)t[r]=this.revBin(r,n,e);return t},v.prototype.revBin=function(e,t,n){if(e===0||e===n-1)return e;for(var r=0,i=0;i<t;i++)r|=(e&1)<<t-i-1,e>>=1;return r},v.prototype.permute=function(e,t,n,r,i,a){for(var o=0;o<a;o++)r[o]=t[e[o]],i[o]=n[e[o]]},v.prototype.transform=function(e,t,n,r,i,a){this.permute(a,e,t,n,r,i);for(var o=1;o<i;o<<=1)for(var s=o<<1,c=Math.cos(2*Math.PI/s),l=Math.sin(2*Math.PI/s),u=0;u<i;u+=s)for(var d=c,f=l,p=0;p<o;p++){var m=n[u+p],h=r[u+p],g=n[u+p+o],_=r[u+p+o],v=d*g-f*_;_=d*_+f*g,g=v,n[u+p]=m+g,r[u+p]=h+_,n[u+p+o]=m-g,r[u+p+o]=h-_,p!==s&&(v=c*d-l*f,f=c*f+l*d,d=v)}},v.prototype.guessLen13b=function(e,t){var n=Math.max(t,e)|1,r=n&1,i=0;for(n=n/2|0;n;n>>>=1)i++;return 1<<i+1+r},v.prototype.conjugate=function(e,t,n){if(!(n<=1))for(var r=0;r<n/2;r++){var i=e[r];e[r]=e[n-r-1],e[n-r-1]=i,i=t[r],t[r]=-t[n-r-1],t[n-r-1]=-i}},v.prototype.normalize13b=function(e,t){for(var n=0,r=0;r<t/2;r++){var i=Math.round(e[2*r+1]/t)*8192+Math.round(e[2*r]/t)+n;e[r]=i&67108863,n=i<67108864?0:i/67108864|0}return e},v.prototype.convert13b=function(e,t,r,i){for(var a=0,o=0;o<t;o++)a+=e[o]|0,r[2*o]=a&8191,a>>>=13,r[2*o+1]=a&8191,a>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(a===0),n((a&-8192)==0)},v.prototype.stub=function(e){for(var t=Array(e),n=0;n<e;n++)t[n]=0;return t},v.prototype.mulp=function(e,t,n){var r=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(r),a=this.stub(r),o=Array(r),s=Array(r),c=Array(r),l=Array(r),u=Array(r),d=Array(r),f=n.words;f.length=r,this.convert13b(e.words,e.length,o,r),this.convert13b(t.words,t.length,l,r),this.transform(o,a,s,c,r,i),this.transform(l,a,u,d,r,i);for(var p=0;p<r;p++){var m=s[p]*u[p]-c[p]*d[p];c[p]=s[p]*d[p]+c[p]*u[p],s[p]=m}return this.conjugate(s,c,r),this.transform(s,c,f,a,r,i),this.conjugate(f,a,r),this.normalize13b(f,r),n.negative=e.negative^t.negative,n.length=e.length+t.length,n.strip()},i.prototype.mul=function(e){var t=new i(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},i.prototype.mulf=function(e){var t=new i(null);return t.words=Array(this.length+e.length),_(this,e,t)},i.prototype.imul=function(e){return this.clone().mulTo(e,this)},i.prototype.imuln=function(e){n(typeof e==`number`),n(e<67108864);for(var t=0,r=0;r<this.length;r++){var i=(this.words[r]|0)*e,a=(i&67108863)+(t&67108863);t>>=26,t+=i/67108864|0,t+=a>>>26,this.words[r]=a&67108863}return t!==0&&(this.words[r]=t,this.length++),this.length=e===0?1:this.length,this},i.prototype.muln=function(e){return this.clone().imuln(e)},i.prototype.sqr=function(){return this.mul(this)},i.prototype.isqr=function(){return this.imul(this.clone())},i.prototype.pow=function(e){var t=p(e);if(t.length===0)return new i(1);for(var n=this,r=0;r<t.length&&t[r]===0;r++,n=n.sqr());if(++r<t.length)for(var a=n.sqr();r<t.length;r++,a=a.sqr())t[r]!==0&&(n=n.mul(a));return n},i.prototype.iushln=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=67108863>>>26-t<<26-t,a;if(t!==0){var o=0;for(a=0;a<this.length;a++){var s=this.words[a]&i,c=(this.words[a]|0)-s<<t;this.words[a]=c|o,o=s>>>26-t}o&&(this.words[a]=o,this.length++)}if(r!==0){for(a=this.length-1;a>=0;a--)this.words[a+r]=this.words[a];for(a=0;a<r;a++)this.words[a]=0;this.length+=r}return this.strip()},i.prototype.ishln=function(e){return n(this.negative===0),this.iushln(e)},i.prototype.iushrn=function(e,t,r){n(typeof e==`number`&&e>=0);var i=t?(t-t%26)/26:0,a=e%26,o=Math.min((e-a)/26,this.length),s=67108863^67108863>>>a<<a,c=r;if(i-=o,i=Math.max(0,i),c){for(var l=0;l<o;l++)c.words[l]=this.words[l];c.length=o}if(o!==0)if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var u=0;for(l=this.length-1;l>=0&&(u!==0||l>=i);l--){var d=this.words[l]|0;this.words[l]=u<<26-a|d>>>a,u=d&s}return c&&u!==0&&(c.words[c.length++]=u),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.ishrn=function(e,t,r){return n(this.negative===0),this.iushrn(e,t,r)},i.prototype.shln=function(e){return this.clone().ishln(e)},i.prototype.ushln=function(e){return this.clone().iushln(e)},i.prototype.shrn=function(e){return this.clone().ishrn(e)},i.prototype.ushrn=function(e){return this.clone().iushrn(e)},i.prototype.testn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26,i=1<<t;return this.length<=r?!1:!!(this.words[r]&i)},i.prototype.imaskn=function(e){n(typeof e==`number`&&e>=0);var t=e%26,r=(e-t)/26;if(n(this.negative===0,`imaskn works only with positive numbers`),this.length<=r)return this;if(t!==0&&r++,this.length=Math.min(r,this.length),t!==0){var i=67108863^67108863>>>t<<t;this.words[this.length-1]&=i}return this.length===0&&(this.words[0]=0,this.length=1),this.strip()},i.prototype.maskn=function(e){return this.clone().imaskn(e)},i.prototype.iaddn=function(e){return n(typeof e==`number`),n(e<67108864),e<0?this.isubn(-e):this.negative===0?this._iaddn(e):this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this)},i.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},i.prototype.isubn=function(e){if(n(typeof e==`number`),n(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,--this.words[t+1];return this.strip()},i.prototype.addn=function(e){return this.clone().iaddn(e)},i.prototype.subn=function(e){return this.clone().isubn(e)},i.prototype.iabs=function(){return this.negative=0,this},i.prototype.abs=function(){return this.clone().iabs()},i.prototype._ishlnsubmul=function(e,t,r){var i=e.length+r,a;this._expand(i);var o,s=0;for(a=0;a<e.length;a++){o=(this.words[a+r]|0)+s;var c=(e.words[a]|0)*t;o-=c&67108863,s=(o>>26)-(c/67108864|0),this.words[a+r]=o&67108863}for(;a<this.length-r;a++)o=(this.words[a+r]|0)+s,s=o>>26,this.words[a+r]=o&67108863;if(s===0)return this.strip();for(n(s===-1),s=0,a=0;a<this.length;a++)o=-(this.words[a]|0)+s,s=o>>26,this.words[a]=o&67108863;return this.negative=1,this.strip()},i.prototype._wordDiv=function(e,t){var n=this.length-e.length,r=this.clone(),a=e,o=a.words[a.length-1]|0;n=26-this._countBits(o),n!==0&&(a=a.ushln(n),r.iushln(n),o=a.words[a.length-1]|0);var s=r.length-a.length,c;if(t!==`mod`){c=new i(null),c.length=s+1,c.words=Array(c.length);for(var l=0;l<c.length;l++)c.words[l]=0}var u=r.clone()._ishlnsubmul(a,1,s);u.negative===0&&(r=u,c&&(c.words[s]=1));for(var d=s-1;d>=0;d--){var f=(r.words[a.length+d]|0)*67108864+(r.words[a.length+d-1]|0);for(f=Math.min(f/o|0,67108863),r._ishlnsubmul(a,f,d);r.negative!==0;)f--,r.negative=0,r._ishlnsubmul(a,1,d),r.isZero()||(r.negative^=1);c&&(c.words[d]=f)}return c&&c.strip(),r.strip(),t!==`div`&&n!==0&&r.iushrn(n),{div:c||null,mod:r}},i.prototype.divmod=function(e,t,r){if(n(!e.isZero()),this.isZero())return{div:new i(0),mod:new i(0)};var a,o,s;return this.negative!==0&&e.negative===0?(s=this.neg().divmod(e,t),t!==`mod`&&(a=s.div.neg()),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.iadd(e)),{div:a,mod:o}):this.negative===0&&e.negative!==0?(s=this.divmod(e.neg(),t),t!==`mod`&&(a=s.div.neg()),{div:a,mod:s.mod}):(this.negative&e.negative)===0?e.length>this.length||this.cmp(e)<0?{div:new i(0),mod:this}:e.length===1?t===`div`?{div:this.divn(e.words[0]),mod:null}:t===`mod`?{div:null,mod:new i(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new i(this.modn(e.words[0]))}:this._wordDiv(e,t):(s=this.neg().divmod(e.neg(),t),t!==`div`&&(o=s.mod.neg(),r&&o.negative!==0&&o.isub(e)),{div:s.div,mod:o})},i.prototype.div=function(e){return this.divmod(e,`div`,!1).div},i.prototype.mod=function(e){return this.divmod(e,`mod`,!1).mod},i.prototype.umod=function(e){return this.divmod(e,`mod`,!0).mod},i.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var n=t.div.negative===0?t.mod:t.mod.isub(e),r=e.ushrn(1),i=e.andln(1),a=n.cmp(r);return a<0||i===1&&a===0?t.div:t.div.negative===0?t.div.iaddn(1):t.div.isubn(1)},i.prototype.modn=function(e){n(e<=67108863);for(var t=(1<<26)%e,r=0,i=this.length-1;i>=0;i--)r=(t*r+(this.words[i]|0))%e;return r},i.prototype.idivn=function(e){n(e<=67108863);for(var t=0,r=this.length-1;r>=0;r--){var i=(this.words[r]|0)+t*67108864;this.words[r]=i/e|0,t=i%e}return this.strip()},i.prototype.divn=function(e){return this.clone().idivn(e)},i.prototype.egcd=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=new i(0),c=new i(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),d=t.clone();!t.isZero();){for(var f=0,p=1;(t.words[0]&p)===0&&f<26;++f,p<<=1);if(f>0)for(t.iushrn(f);f-- >0;)(a.isOdd()||o.isOdd())&&(a.iadd(u),o.isub(d)),a.iushrn(1),o.iushrn(1);for(var m=0,h=1;(r.words[0]&h)===0&&m<26;++m,h<<=1);if(m>0)for(r.iushrn(m);m-- >0;)(s.isOdd()||c.isOdd())&&(s.iadd(u),c.isub(d)),s.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(s),o.isub(c)):(r.isub(t),s.isub(a),c.isub(o))}return{a:s,b:c,gcd:r.iushln(l)}},i.prototype._invmp=function(e){n(e.negative===0),n(!e.isZero());var t=this,r=e.clone();t=t.negative===0?t.clone():t.umod(e);for(var a=new i(1),o=new i(0),s=r.clone();t.cmpn(1)>0&&r.cmpn(1)>0;){for(var c=0,l=1;(t.words[0]&l)===0&&c<26;++c,l<<=1);if(c>0)for(t.iushrn(c);c-- >0;)a.isOdd()&&a.iadd(s),a.iushrn(1);for(var u=0,d=1;(r.words[0]&d)===0&&u<26;++u,d<<=1);if(u>0)for(r.iushrn(u);u-- >0;)o.isOdd()&&o.iadd(s),o.iushrn(1);t.cmp(r)>=0?(t.isub(r),a.isub(o)):(r.isub(t),o.isub(a))}var f=t.cmpn(1)===0?a:o;return f.cmpn(0)<0&&f.iadd(e),f},i.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),n=e.clone();t.negative=0,n.negative=0;for(var r=0;t.isEven()&&n.isEven();r++)t.iushrn(1),n.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;n.isEven();)n.iushrn(1);var i=t.cmp(n);if(i<0){var a=t;t=n,n=a}else if(i===0||n.cmpn(1)===0)break;t.isub(n)}while(!0);return n.iushln(r)},i.prototype.invm=function(e){return this.egcd(e).a.umod(e)},i.prototype.isEven=function(){return(this.words[0]&1)==0},i.prototype.isOdd=function(){return(this.words[0]&1)==1},i.prototype.andln=function(e){return this.words[0]&e},i.prototype.bincn=function(e){n(typeof e==`number`);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var a=i,o=r;a!==0&&o<this.length;o++){var s=this.words[o]|0;s+=a,a=s>>>26,s&=67108863,this.words[o]=s}return a!==0&&(this.words[o]=a,this.length++),this},i.prototype.isZero=function(){return this.length===1&&this.words[0]===0},i.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var r;if(this.length>1)r=1;else{t&&(e=-e),n(e<=67108863,`Number is too big`);var i=this.words[0]|0;r=i===e?0:i<e?-1:1}return this.negative===0?r:-r|0},i.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative===0?t:-t|0},i.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,n=this.length-1;n>=0;n--){var r=this.words[n]|0,i=e.words[n]|0;if(r!==i){r<i?t=-1:r>i&&(t=1);break}}return t},i.prototype.gtn=function(e){return this.cmpn(e)===1},i.prototype.gt=function(e){return this.cmp(e)===1},i.prototype.gten=function(e){return this.cmpn(e)>=0},i.prototype.gte=function(e){return this.cmp(e)>=0},i.prototype.ltn=function(e){return this.cmpn(e)===-1},i.prototype.lt=function(e){return this.cmp(e)===-1},i.prototype.lten=function(e){return this.cmpn(e)<=0},i.prototype.lte=function(e){return this.cmp(e)<=0},i.prototype.eqn=function(e){return this.cmpn(e)===0},i.prototype.eq=function(e){return this.cmp(e)===0},i.red=function(e){return new T(e)},i.prototype.toRed=function(e){return n(!this.red,`Already a number in reduction context`),n(this.negative===0,`red works only with positives`),e.convertTo(this)._forceRed(e)},i.prototype.fromRed=function(){return n(this.red,`fromRed works only with numbers in reduction context`),this.red.convertFrom(this)},i.prototype._forceRed=function(e){return this.red=e,this},i.prototype.forceRed=function(e){return n(!this.red,`Already a number in reduction context`),this._forceRed(e)},i.prototype.redAdd=function(e){return n(this.red,`redAdd works only with red numbers`),this.red.add(this,e)},i.prototype.redIAdd=function(e){return n(this.red,`redIAdd works only with red numbers`),this.red.iadd(this,e)},i.prototype.redSub=function(e){return n(this.red,`redSub works only with red numbers`),this.red.sub(this,e)},i.prototype.redISub=function(e){return n(this.red,`redISub works only with red numbers`),this.red.isub(this,e)},i.prototype.redShl=function(e){return n(this.red,`redShl works only with red numbers`),this.red.shl(this,e)},i.prototype.redMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.mul(this,e)},i.prototype.redIMul=function(e){return n(this.red,`redMul works only with red numbers`),this.red._verify2(this,e),this.red.imul(this,e)},i.prototype.redSqr=function(){return n(this.red,`redSqr works only with red numbers`),this.red._verify1(this),this.red.sqr(this)},i.prototype.redISqr=function(){return n(this.red,`redISqr works only with red numbers`),this.red._verify1(this),this.red.isqr(this)},i.prototype.redSqrt=function(){return n(this.red,`redSqrt works only with red numbers`),this.red._verify1(this),this.red.sqrt(this)},i.prototype.redInvm=function(){return n(this.red,`redInvm works only with red numbers`),this.red._verify1(this),this.red.invm(this)},i.prototype.redNeg=function(){return n(this.red,`redNeg works only with red numbers`),this.red._verify1(this),this.red.neg(this)},i.prototype.redPow=function(e){return n(this.red&&!e.red,`redPow(normalNum)`),this.red._verify1(this),this.red.pow(this,e)};var y={k256:null,p224:null,p192:null,p25519:null};function b(e,t){this.name=e,this.p=new i(t,16),this.n=this.p.bitLength(),this.k=new i(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}b.prototype._tmp=function(){var e=new i(null);return e.words=Array(Math.ceil(this.n/13)),e},b.prototype.ireduce=function(e){var t=e,n;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),n=t.bitLength();while(n>this.n);var r=n<this.n?-1:t.ucmp(this.p);return r===0?(t.words[0]=0,t.length=1):r>0?t.isub(this.p):t.strip===void 0?t._strip():t.strip(),t},b.prototype.split=function(e,t){e.iushrn(this.n,0,t)},b.prototype.imulK=function(e){return e.imul(this.k)};function x(){b.call(this,`k256`,`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`)}r(x,b),x.prototype.split=function(e,t){for(var n=4194303,r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var a=e.words[9];for(t.words[t.length++]=a&n,i=10;i<e.length;i++){var o=e.words[i]|0;e.words[i-10]=(o&n)<<4|a>>>22,a=o}a>>>=22,e.words[i-10]=a,a===0&&e.length>10?e.length-=10:e.length-=9},x.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,n=0;n<e.length;n++){var r=e.words[n]|0;t+=r*977,e.words[n]=t&67108863,t=r*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function S(){b.call(this,`p224`,`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`)}r(S,b);function C(){b.call(this,`p192`,`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`)}r(C,b);function w(){b.call(this,`25519`,`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`)}r(w,b),w.prototype.imulK=function(e){for(var t=0,n=0;n<e.length;n++){var r=(e.words[n]|0)*19+t,i=r&67108863;r>>>=26,e.words[n]=i,t=r}return t!==0&&(e.words[e.length++]=t),e},i._prime=function(e){if(y[e])return y[e];var t;if(e===`k256`)t=new x;else if(e===`p224`)t=new S;else if(e===`p192`)t=new C;else if(e===`p25519`)t=new w;else throw Error(`Unknown prime `+e);return y[e]=t,t};function T(e){if(typeof e==`string`){var t=i._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),`modulus must be greater than 1`),this.m=e,this.prime=null}T.prototype._verify1=function(e){n(e.negative===0,`red works only with positives`),n(e.red,`red works only with red numbers`)},T.prototype._verify2=function(e,t){n((e.negative|t.negative)===0,`red works only with positives`),n(e.red&&e.red===t.red,`red works only with red numbers`)},T.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},T.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},T.prototype.add=function(e,t){this._verify2(e,t);var n=e.add(t);return n.cmp(this.m)>=0&&n.isub(this.m),n._forceRed(this)},T.prototype.iadd=function(e,t){this._verify2(e,t);var n=e.iadd(t);return n.cmp(this.m)>=0&&n.isub(this.m),n},T.prototype.sub=function(e,t){this._verify2(e,t);var n=e.sub(t);return n.cmpn(0)<0&&n.iadd(this.m),n._forceRed(this)},T.prototype.isub=function(e,t){this._verify2(e,t);var n=e.isub(t);return n.cmpn(0)<0&&n.iadd(this.m),n},T.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},T.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},T.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},T.prototype.isqr=function(e){return this.imul(e,e.clone())},T.prototype.sqr=function(e){return this.mul(e,e)},T.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),t===3){var r=this.m.add(new i(1)).iushrn(2);return this.pow(e,r)}for(var a=this.m.subn(1),o=0;!a.isZero()&&a.andln(1)===0;)o++,a.iushrn(1);n(!a.isZero());var s=new i(1).toRed(this),c=s.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new i(2*u*u).toRed(this);this.pow(u,l).cmp(c)!==0;)u.redIAdd(c);for(var d=this.pow(u,a),f=this.pow(e,a.addn(1).iushrn(1)),p=this.pow(e,a),m=o;p.cmp(s)!==0;){for(var h=p,g=0;h.cmp(s)!==0;g++)h=h.redSqr();n(g<m);var _=this.pow(d,new i(1).iushln(m-g-1));f=f.redMul(_),d=_.redSqr(),p=p.redMul(d),m=g}return f},T.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative===0?this.imod(t):(t.negative=0,this.imod(t).redNeg())},T.prototype.pow=function(e,t){if(t.isZero())return new i(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var n=4,r=Array(1<<n);r[0]=new i(1).toRed(this),r[1]=e;for(var a=2;a<r.length;a++)r[a]=this.mul(r[a-1],e);var o=r[0],s=0,c=0,l=t.bitLength()%26;for(l===0&&(l=26),a=t.length-1;a>=0;a--){for(var u=t.words[a],d=l-1;d>=0;d--){var f=u>>d&1;if(o!==r[0]&&(o=this.sqr(o)),f===0&&s===0){c=0;continue}s<<=1,s|=f,c++,!(c!==n&&(a!==0||d!==0))&&(o=this.mul(o,r[s]),c=0,s=0)}l=26}return o},T.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},T.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},i.mont=function(e){return new E(e)};function E(e){T.call(this,e),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)}r(E,T),E.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},E.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},E.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var n=e.imul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=n.isub(r).iushrn(this.shift),a=i;return i.cmp(this.m)>=0?a=i.isub(this.m):i.cmpn(0)<0&&(a=i.iadd(this.m)),a._forceRed(this)},E.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new i(0)._forceRed(this);var n=e.mul(t),r=n.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),a=n.isub(r).iushrn(this.shift),o=a;return a.cmp(this.m)>=0?o=a.isub(this.m):a.cmpn(0)<0&&(o=a.iadd(this.m)),o._forceRed(this)},E.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}})(t===void 0||t,e)})),xc=a(((e,t)=>{t.exports=n;function n(e,t){if(!e)throw Error(t||`Assertion failed`)}n.equal=function(e,t,n){if(e!=t)throw Error(n||`Assertion failed: `+e+` != `+t)}})),Sc=a((e=>{var t=e;function n(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var n=[];if(typeof e!=`string`){for(var r=0;r<e.length;r++)n[r]=e[r]|0;return n}if(t===`hex`){e=e.replace(/[^a-z0-9]+/gi,``),e.length%2!=0&&(e=`0`+e);for(var r=0;r<e.length;r+=2)n.push(parseInt(e[r]+e[r+1],16))}else for(var r=0;r<e.length;r++){var i=e.charCodeAt(r),a=i>>8,o=i&255;a?n.push(a,o):n.push(o)}return n}t.toArray=n;function r(e){return e.length===1?`0`+e:e}t.zero2=r;function i(e){for(var t=``,n=0;n<e.length;n++)t+=r(e[n].toString(16));return t}t.toHex=i,t.encode=function(e,t){return t===`hex`?i(e):e}})),Cc=a((e=>{var t=e,n=bc(),r=xc(),i=Sc();t.assert=r,t.toArray=i.toArray,t.zero2=i.zero2,t.toHex=i.toHex,t.encode=i.encode;function a(e,t,n){var r=Array(Math.max(e.bitLength(),n)+1),i;for(i=0;i<r.length;i+=1)r[i]=0;var a=1<<t+1,o=e.clone();for(i=0;i<r.length;i++){var s,c=o.andln(a-1);o.isOdd()?(s=c>(a>>1)-1?(a>>1)-c:c,o.isubn(s)):s=0,r[i]=s,o.iushrn(1)}return r}t.getNAF=a;function o(e,t){var n=[[],[]];e=e.clone(),t=t.clone();for(var r=0,i=0,a;e.cmpn(-r)>0||t.cmpn(-i)>0;){var o=e.andln(3)+r&3,s=t.andln(3)+i&3;o===3&&(o=-1),s===3&&(s=-1);var c;o&1?(a=e.andln(7)+r&7,c=(a===3||a===5)&&s===2?-o:o):c=0,n[0].push(c);var l;s&1?(a=t.andln(7)+i&7,l=(a===3||a===5)&&o===2?-s:s):l=0,n[1].push(l),2*r===c+1&&(r=1-r),2*i===l+1&&(i=1-i),e.iushrn(1),t.iushrn(1)}return n}t.getJSF=o;function s(e,t,n){var r=`_`+t;e.prototype[t]=function(){return this[r]===void 0?this[r]=n.call(this):this[r]}}t.cachedProperty=s;function c(e){return typeof e==`string`?t.toArray(e,`hex`):e}t.parseBytes=c;function l(e){return new n(e,`hex`,`le`)}t.intFromLE=l})),wc=a(((e,t)=>{var n;t.exports=function(e){return n||=new r(null),n.generate(e)};function r(e){this.rand=e}if(t.exports.Rand=r,r.prototype.generate=function(e){return this._rand(e)},r.prototype._rand=function(e){if(this.rand.getBytes)return this.rand.getBytes(e);for(var t=new Uint8Array(e),n=0;n<t.length;n++)t[n]=this.rand.getByte();return t},typeof self==`object`)self.crypto&&self.crypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.crypto.getRandomValues(t),t}:self.msCrypto&&self.msCrypto.getRandomValues?r.prototype._rand=function(e){var t=new Uint8Array(e);return self.msCrypto.getRandomValues(t),t}:typeof window==`object`&&(r.prototype._rand=function(){throw Error(`Not implemented yet`)});else try{var i=s();if(typeof i.randomBytes!=`function`)throw Error(`Not supported`);r.prototype._rand=function(e){return i.randomBytes(e)}}catch{}})),Tc=a(((e,t)=>{var n=bc(),r=Cc(),i=r.getNAF,a=r.getJSF,o=r.assert;function s(e,t){this.type=e,this.p=new n(t.p,16),this.red=t.prime?n.red(t.prime):n.mont(this.p),this.zero=new n(0).toRed(this.red),this.one=new n(1).toRed(this.red),this.two=new n(2).toRed(this.red),this.n=t.n&&new n(t.n,16),this.g=t.g&&this.pointFromJSON(t.g,t.gRed),this._wnafT1=[,,,,],this._wnafT2=[,,,,],this._wnafT3=[,,,,],this._wnafT4=[,,,,],this._bitLength=this.n?this.n.bitLength():0;var r=this.n&&this.p.div(this.n);!r||r.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}t.exports=s,s.prototype.point=function(){throw Error(`Not implemented`)},s.prototype.validate=function(){throw Error(`Not implemented`)},s.prototype._fixedNafMul=function(e,t){o(e.precomputed);var n=e._getDoubles(),r=i(t,1,this._bitLength),a=(1<<n.step+1)-(n.step%2==0?2:1);a/=3;var s=[],c,l;for(c=0;c<r.length;c+=n.step){l=0;for(var u=c+n.step-1;u>=c;u--)l=(l<<1)+r[u];s.push(l)}for(var d=this.jpoint(null,null,null),f=this.jpoint(null,null,null),p=a;p>0;p--){for(c=0;c<s.length;c++)l=s[c],l===p?f=f.mixedAdd(n.points[c]):l===-p&&(f=f.mixedAdd(n.points[c].neg()));d=d.add(f)}return d.toP()},s.prototype._wnafMul=function(e,t){var n=4,r=e._getNAFPoints(n);n=r.wnd;for(var a=r.points,s=i(t,n,this._bitLength),c=this.jpoint(null,null,null),l=s.length-1;l>=0;l--){for(var u=0;l>=0&&s[l]===0;l--)u++;if(l>=0&&u++,c=c.dblp(u),l<0)break;var d=s[l];o(d!==0),c=e.type===`affine`?d>0?c.mixedAdd(a[d-1>>1]):c.mixedAdd(a[-d-1>>1].neg()):d>0?c.add(a[d-1>>1]):c.add(a[-d-1>>1].neg())}return e.type===`affine`?c.toP():c},s.prototype._wnafMulAdd=function(e,t,n,r,o){var s=this._wnafT1,c=this._wnafT2,l=this._wnafT3,u=0,d,f,p;for(d=0;d<r;d++){p=t[d];var m=p._getNAFPoints(e);s[d]=m.wnd,c[d]=m.points}for(d=r-1;d>=1;d-=2){var h=d-1,g=d;if(s[h]!==1||s[g]!==1){l[h]=i(n[h],s[h],this._bitLength),l[g]=i(n[g],s[g],this._bitLength),u=Math.max(l[h].length,u),u=Math.max(l[g].length,u);continue}var _=[t[h],null,null,t[g]];t[h].y.cmp(t[g].y)===0?(_[1]=t[h].add(t[g]),_[2]=t[h].toJ().mixedAdd(t[g].neg())):t[h].y.cmp(t[g].y.redNeg())===0?(_[1]=t[h].toJ().mixedAdd(t[g]),_[2]=t[h].add(t[g].neg())):(_[1]=t[h].toJ().mixedAdd(t[g]),_[2]=t[h].toJ().mixedAdd(t[g].neg()));var v=[-3,-1,-5,-7,0,7,5,1,3],y=a(n[h],n[g]);for(u=Math.max(y[0].length,u),l[h]=Array(u),l[g]=Array(u),f=0;f<u;f++){var b=y[0][f]|0,x=y[1][f]|0;l[h][f]=v[(b+1)*3+(x+1)],l[g][f]=0,c[h]=_}}var S=this.jpoint(null,null,null),C=this._wnafT4;for(d=u;d>=0;d--){for(var w=0;d>=0;){var T=!0;for(f=0;f<r;f++)C[f]=l[f][d]|0,C[f]!==0&&(T=!1);if(!T)break;w++,d--}if(d>=0&&w++,S=S.dblp(w),d<0)break;for(f=0;f<r;f++){var E=C[f];E!==0&&(E>0?p=c[f][E-1>>1]:E<0&&(p=c[f][-E-1>>1].neg()),S=p.type===`affine`?S.mixedAdd(p):S.add(p))}}for(d=0;d<r;d++)c[d]=null;return o?S:S.toP()};function c(e,t){this.curve=e,this.type=t,this.precomputed=null}s.BasePoint=c,c.prototype.eq=function(){throw Error(`Not implemented`)},c.prototype.validate=function(){return this.curve.validate(this)},s.prototype.decodePoint=function(e,t){e=r.toArray(e,t);var n=this.p.byteLength();if((e[0]===4||e[0]===6||e[0]===7)&&e.length-1==2*n)return e[0]===6?o(e[e.length-1]%2==0):e[0]===7&&o(e[e.length-1]%2==1),this.point(e.slice(1,1+n),e.slice(1+n,1+2*n));if((e[0]===2||e[0]===3)&&e.length-1===n)return this.pointFromX(e.slice(1,1+n),e[0]===3);throw Error(`Unknown point format`)},c.prototype.encodeCompressed=function(e){return this.encode(e,!0)},c.prototype._encode=function(e){var t=this.curve.p.byteLength(),n=this.getX().toArray(`be`,t);return e?[this.getY().isEven()?2:3].concat(n):[4].concat(n,this.getY().toArray(`be`,t))},c.prototype.encode=function(e,t){return r.encode(this._encode(t),e)},c.prototype.precompute=function(e){if(this.precomputed)return this;var t={doubles:null,naf:null,beta:null};return t.naf=this._getNAFPoints(8),t.doubles=this._getDoubles(4,e),t.beta=this._getBeta(),this.precomputed=t,this},c.prototype._hasDoubles=function(e){if(!this.precomputed)return!1;var t=this.precomputed.doubles;return t?t.points.length>=Math.ceil((e.bitLength()+1)/t.step):!1},c.prototype._getDoubles=function(e,t){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var n=[this],r=this,i=0;i<t;i+=e){for(var a=0;a<e;a++)r=r.dbl();n.push(r)}return{step:e,points:n}},c.prototype._getNAFPoints=function(e){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var t=[this],n=(1<<e)-1,r=n===1?null:this.dbl(),i=1;i<n;i++)t[i]=t[i-1].add(r);return{wnd:e,points:t}},c.prototype._getBeta=function(){return null},c.prototype.dblp=function(e){for(var t=this,n=0;n<e;n++)t=t.dbl();return t}})),Ec=a(((e,t)=>{typeof Object.create==`function`?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),Dc=a(((e,t)=>{var n=Cc(),r=bc(),i=Ec(),a=Tc(),o=n.assert;function s(e){a.call(this,`short`,e),this.a=new r(e.a,16).toRed(this.red),this.b=new r(e.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(e),this._endoWnafT1=[,,,,],this._endoWnafT2=[,,,,]}i(s,a),t.exports=s,s.prototype._getEndomorphism=function(e){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var t,n;if(e.beta)t=new r(e.beta,16).toRed(this.red);else{var i=this._getEndoRoots(this.p);t=i[0].cmp(i[1])<0?i[0]:i[1],t=t.toRed(this.red)}if(e.lambda)n=new r(e.lambda,16);else{var a=this._getEndoRoots(this.n);this.g.mul(a[0]).x.cmp(this.g.x.redMul(t))===0?n=a[0]:(n=a[1],o(this.g.mul(n).x.cmp(this.g.x.redMul(t))===0))}var s=e.basis?e.basis.map(function(e){return{a:new r(e.a,16),b:new r(e.b,16)}}):this._getEndoBasis(n);return{beta:t,lambda:n,basis:s}}},s.prototype._getEndoRoots=function(e){var t=e===this.p?this.red:r.mont(e),n=new r(2).toRed(t).redInvm(),i=n.redNeg(),a=new r(3).toRed(t).redNeg().redSqrt().redMul(n);return[i.redAdd(a).fromRed(),i.redSub(a).fromRed()]},s.prototype._getEndoBasis=function(e){for(var t=this.n.ushrn(Math.floor(this.n.bitLength()/2)),n=e,i=this.n.clone(),a=new r(1),o=new r(0),s=new r(0),c=new r(1),l,u,d,f,p,m,h,g=0,_,v;n.cmpn(0)!==0;){var y=i.div(n);_=i.sub(y.mul(n)),v=s.sub(y.mul(a));var b=c.sub(y.mul(o));if(!d&&_.cmp(t)<0)l=h.neg(),u=a,d=_.neg(),f=v;else if(d&&++g===2)break;h=_,i=n,n=_,s=a,a=v,c=o,o=b}p=_.neg(),m=v;var x=d.sqr().add(f.sqr());return p.sqr().add(m.sqr()).cmp(x)>=0&&(p=l,m=u),d.negative&&(d=d.neg(),f=f.neg()),p.negative&&(p=p.neg(),m=m.neg()),[{a:d,b:f},{a:p,b:m}]},s.prototype._endoSplit=function(e){var t=this.endo.basis,n=t[0],r=t[1],i=r.b.mul(e).divRound(this.n),a=n.b.neg().mul(e).divRound(this.n),o=i.mul(n.a),s=a.mul(r.a),c=i.mul(n.b),l=a.mul(r.b);return{k1:e.sub(o).sub(s),k2:c.add(l).neg()}},s.prototype.pointFromX=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr().redMul(e).redIAdd(e.redMul(this.a)).redIAdd(this.b),i=n.redSqrt();if(i.redSqr().redSub(n).cmp(this.zero)!==0)throw Error(`invalid point`);var a=i.fromRed().isOdd();return(t&&!a||!t&&a)&&(i=i.redNeg()),this.point(e,i)},s.prototype.validate=function(e){if(e.inf)return!0;var t=e.x,n=e.y,r=this.a.redMul(t),i=t.redSqr().redMul(t).redIAdd(r).redIAdd(this.b);return n.redSqr().redISub(i).cmpn(0)===0},s.prototype._endoWnafMulAdd=function(e,t,n){for(var r=this._endoWnafT1,i=this._endoWnafT2,a=0;a<e.length;a++){var o=this._endoSplit(t[a]),s=e[a],c=s._getBeta();o.k1.negative&&(o.k1.ineg(),s=s.neg(!0)),o.k2.negative&&(o.k2.ineg(),c=c.neg(!0)),r[a*2]=s,r[a*2+1]=c,i[a*2]=o.k1,i[a*2+1]=o.k2}for(var l=this._wnafMulAdd(1,r,i,a*2,n),u=0;u<a*2;u++)r[u]=null,i[u]=null;return l};function c(e,t,n,i){a.BasePoint.call(this,e,`affine`),t===null&&n===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new r(t,16),this.y=new r(n,16),i&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}i(c,a.BasePoint),s.prototype.point=function(e,t,n){return new c(this,e,t,n)},s.prototype.pointFromJSON=function(e,t){return c.fromJSON(this,e,t)},c.prototype._getBeta=function(){if(this.curve.endo){var e=this.precomputed;if(e&&e.beta)return e.beta;var t=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(e){var n=this.curve,r=function(e){return n.point(e.x.redMul(n.endo.beta),e.y)};e.beta=t,t.precomputed={beta:null,naf:e.naf&&{wnd:e.naf.wnd,points:e.naf.points.map(r)},doubles:e.doubles&&{step:e.doubles.step,points:e.doubles.points.map(r)}}}return t}},c.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]},c.fromJSON=function(e,t,n){typeof t==`string`&&(t=JSON.parse(t));var r=e.point(t[0],t[1],n);if(!t[2])return r;function i(t){return e.point(t[0],t[1],n)}var a=t[2];return r.precomputed={beta:null,doubles:a.doubles&&{step:a.doubles.step,points:[r].concat(a.doubles.points.map(i))},naf:a.naf&&{wnd:a.naf.wnd,points:[r].concat(a.naf.points.map(i))}},r},c.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` y: `+this.y.fromRed().toString(16,2)+`>`},c.prototype.isInfinity=function(){return this.inf},c.prototype.add=function(e){if(this.inf)return e;if(e.inf)return this;if(this.eq(e))return this.dbl();if(this.neg().eq(e)||this.x.cmp(e.x)===0)return this.curve.point(null,null);var t=this.y.redSub(e.y);t.cmpn(0)!==0&&(t=t.redMul(this.x.redSub(e.x).redInvm()));var n=t.redSqr().redISub(this.x).redISub(e.x),r=t.redMul(this.x.redSub(n)).redISub(this.y);return this.curve.point(n,r)},c.prototype.dbl=function(){if(this.inf)return this;var e=this.y.redAdd(this.y);if(e.cmpn(0)===0)return this.curve.point(null,null);var t=this.curve.a,n=this.x.redSqr(),r=e.redInvm(),i=n.redAdd(n).redIAdd(n).redIAdd(t).redMul(r),a=i.redSqr().redISub(this.x.redAdd(this.x)),o=i.redMul(this.x.redSub(a)).redISub(this.y);return this.curve.point(a,o)},c.prototype.getX=function(){return this.x.fromRed()},c.prototype.getY=function(){return this.y.fromRed()},c.prototype.mul=function(e){return e=new r(e,16),this.isInfinity()?this:this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve.endo?this.curve._endoWnafMulAdd([this],[e]):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i):this.curve._wnafMulAdd(1,r,i,2)},c.prototype.jmulAdd=function(e,t,n){var r=[this,t],i=[e,n];return this.curve.endo?this.curve._endoWnafMulAdd(r,i,!0):this.curve._wnafMulAdd(1,r,i,2,!0)},c.prototype.eq=function(e){return this===e||this.inf===e.inf&&(this.inf||this.x.cmp(e.x)===0&&this.y.cmp(e.y)===0)},c.prototype.neg=function(e){if(this.inf)return this;var t=this.curve.point(this.x,this.y.redNeg());if(e&&this.precomputed){var n=this.precomputed,r=function(e){return e.neg()};t.precomputed={naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(r)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(r)}}}return t},c.prototype.toJ=function(){return this.inf?this.curve.jpoint(null,null,null):this.curve.jpoint(this.x,this.y,this.curve.one)};function l(e,t,n,i){a.BasePoint.call(this,e,`jacobian`),t===null&&n===null&&i===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new r(0)):(this.x=new r(t,16),this.y=new r(n,16),this.z=new r(i,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}i(l,a.BasePoint),s.prototype.jpoint=function(e,t,n){return new l(this,e,t,n)},l.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var e=this.z.redInvm(),t=e.redSqr(),n=this.x.redMul(t),r=this.y.redMul(t).redMul(e);return this.curve.point(n,r)},l.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},l.prototype.add=function(e){if(this.isInfinity())return e;if(e.isInfinity())return this;var t=e.z.redSqr(),n=this.z.redSqr(),r=this.x.redMul(t),i=e.x.redMul(n),a=this.y.redMul(t.redMul(e.z)),o=e.y.redMul(n.redMul(this.z)),s=r.redSub(i),c=a.redSub(o);if(s.cmpn(0)===0)return c.cmpn(0)===0?this.dbl():this.curve.jpoint(null,null,null);var l=s.redSqr(),u=l.redMul(s),d=r.redMul(l),f=c.redSqr().redIAdd(u).redISub(d).redISub(d),p=c.redMul(d.redISub(f)).redISub(a.redMul(u)),m=this.z.redMul(e.z).redMul(s);return this.curve.jpoint(f,p,m)},l.prototype.mixedAdd=function(e){if(this.isInfinity())return e.toJ();if(e.isInfinity())return this;var t=this.z.redSqr(),n=this.x,r=e.x.redMul(t),i=this.y,a=e.y.redMul(t).redMul(this.z),o=n.redSub(r),s=i.redSub(a);if(o.cmpn(0)===0)return s.cmpn(0)===0?this.dbl():this.curve.jpoint(null,null,null);var c=o.redSqr(),l=c.redMul(o),u=n.redMul(c),d=s.redSqr().redIAdd(l).redISub(u).redISub(u),f=s.redMul(u.redISub(d)).redISub(i.redMul(l)),p=this.z.redMul(o);return this.curve.jpoint(d,f,p)},l.prototype.dblp=function(e){if(e===0||this.isInfinity())return this;if(!e)return this.dbl();var t;if(this.curve.zeroA||this.curve.threeA){var n=this;for(t=0;t<e;t++)n=n.dbl();return n}var r=this.curve.a,i=this.curve.tinv,a=this.x,o=this.y,s=this.z,c=s.redSqr().redSqr(),l=o.redAdd(o);for(t=0;t<e;t++){var u=a.redSqr(),d=l.redSqr(),f=d.redSqr(),p=u.redAdd(u).redIAdd(u).redIAdd(r.redMul(c)),m=a.redMul(d),h=p.redSqr().redISub(m.redAdd(m)),g=m.redISub(h),_=p.redMul(g);_=_.redIAdd(_).redISub(f);var v=l.redMul(s);t+1<e&&(c=c.redMul(f)),a=h,s=v,l=_}return this.curve.jpoint(a,l.redMul(i),s)},l.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()},l.prototype._zeroDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r),c=s.redSqr().redISub(o).redISub(o),l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),e=c,t=s.redMul(o.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.x.redSqr(),d=this.y.redSqr(),f=d.redSqr(),p=this.x.redAdd(d).redSqr().redISub(u).redISub(f);p=p.redIAdd(p);var m=u.redAdd(u).redIAdd(u),h=m.redSqr(),g=f.redIAdd(f);g=g.redIAdd(g),g=g.redIAdd(g),e=h.redISub(p).redISub(p),t=m.redMul(p.redISub(e)).redISub(g),n=this.y.redMul(this.z),n=n.redIAdd(n)}return this.curve.jpoint(e,t,n)},l.prototype._threeDbl=function(){var e,t,n;if(this.zOne){var r=this.x.redSqr(),i=this.y.redSqr(),a=i.redSqr(),o=this.x.redAdd(i).redSqr().redISub(r).redISub(a);o=o.redIAdd(o);var s=r.redAdd(r).redIAdd(r).redIAdd(this.curve.a),c=s.redSqr().redISub(o).redISub(o);e=c;var l=a.redIAdd(a);l=l.redIAdd(l),l=l.redIAdd(l),t=s.redMul(o.redISub(c)).redISub(l),n=this.y.redAdd(this.y)}else{var u=this.z.redSqr(),d=this.y.redSqr(),f=this.x.redMul(d),p=this.x.redSub(u).redMul(this.x.redAdd(u));p=p.redAdd(p).redIAdd(p);var m=f.redIAdd(f);m=m.redIAdd(m);var h=m.redAdd(m);e=p.redSqr().redISub(h),n=this.y.redAdd(this.z).redSqr().redISub(d).redISub(u);var g=d.redSqr();g=g.redIAdd(g),g=g.redIAdd(g),g=g.redIAdd(g),t=p.redMul(m.redISub(e)).redISub(g)}return this.curve.jpoint(e,t,n)},l.prototype._dbl=function(){var e=this.curve.a,t=this.x,n=this.y,r=this.z,i=r.redSqr().redSqr(),a=t.redSqr(),o=n.redSqr(),s=a.redAdd(a).redIAdd(a).redIAdd(e.redMul(i)),c=t.redAdd(t);c=c.redIAdd(c);var l=c.redMul(o),u=s.redSqr().redISub(l.redAdd(l)),d=l.redISub(u),f=o.redSqr();f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var p=s.redMul(d).redISub(f),m=n.redAdd(n).redMul(r);return this.curve.jpoint(u,p,m)},l.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr(),r=t.redSqr(),i=e.redAdd(e).redIAdd(e),a=i.redSqr(),o=this.x.redAdd(t).redSqr().redISub(e).redISub(r);o=o.redIAdd(o),o=o.redAdd(o).redIAdd(o),o=o.redISub(a);var s=o.redSqr(),c=r.redIAdd(r);c=c.redIAdd(c),c=c.redIAdd(c),c=c.redIAdd(c);var l=i.redIAdd(o).redSqr().redISub(a).redISub(s).redISub(c),u=t.redMul(l);u=u.redIAdd(u),u=u.redIAdd(u);var d=this.x.redMul(s).redISub(u);d=d.redIAdd(d),d=d.redIAdd(d);var f=this.y.redMul(l.redMul(c.redISub(l)).redISub(o.redMul(s)));f=f.redIAdd(f),f=f.redIAdd(f),f=f.redIAdd(f);var p=this.z.redAdd(o).redSqr().redISub(n).redISub(s);return this.curve.jpoint(d,f,p)},l.prototype.mul=function(e,t){return e=new r(e,t),this.curve._wnafMul(this,e)},l.prototype.eq=function(e){if(e.type===`affine`)return this.eq(e.toJ());if(this===e)return!0;var t=this.z.redSqr(),n=e.z.redSqr();if(this.x.redMul(n).redISub(e.x.redMul(t)).cmpn(0)!==0)return!1;var r=t.redMul(this.z),i=n.redMul(e.z);return this.y.redMul(i).redISub(e.y.redMul(r)).cmpn(0)===0},l.prototype.eqXToP=function(e){var t=this.z.redSqr(),n=e.toRed(this.curve.red).redMul(t);if(this.x.cmp(n)===0)return!0;for(var r=e.clone(),i=this.curve.redN.redMul(t);;){if(r.iadd(this.curve.n),r.cmp(this.curve.p)>=0)return!1;if(n.redIAdd(i),this.x.cmp(n)===0)return!0}},l.prototype.inspect=function(){return this.isInfinity()?`<EC JPoint Infinity>`:`<EC JPoint x: `+this.x.toString(16,2)+` y: `+this.y.toString(16,2)+` z: `+this.z.toString(16,2)+`>`},l.prototype.isInfinity=function(){return this.z.cmpn(0)===0}})),Oc=a(((e,t)=>{var n=bc(),r=Ec(),i=Tc(),a=Cc();function o(e){i.call(this,`mont`,e),this.a=new n(e.a,16).toRed(this.red),this.b=new n(e.b,16).toRed(this.red),this.i4=new n(4).toRed(this.red).redInvm(),this.two=new n(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}r(o,i),t.exports=o,o.prototype.validate=function(e){var t=e.normalize().x,n=t.redSqr(),r=n.redMul(t).redAdd(n.redMul(this.a)).redAdd(t);return r.redSqrt().redSqr().cmp(r)===0};function s(e,t,r){i.BasePoint.call(this,e,`projective`),t===null&&r===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new n(t,16),this.z=new n(r,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}r(s,i.BasePoint),o.prototype.decodePoint=function(e,t){return this.point(a.toArray(e,t),1)},o.prototype.point=function(e,t){return new s(this,e,t)},o.prototype.pointFromJSON=function(e){return s.fromJSON(this,e)},s.prototype.precompute=function(){},s.prototype._encode=function(){return this.getX().toArray(`be`,this.curve.p.byteLength())},s.fromJSON=function(e,t){return new s(e,t[0],t[1]||e.one)},s.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` z: `+this.z.fromRed().toString(16,2)+`>`},s.prototype.isInfinity=function(){return this.z.cmpn(0)===0},s.prototype.dbl=function(){var e=this.x.redAdd(this.z).redSqr(),t=this.x.redSub(this.z).redSqr(),n=e.redSub(t),r=e.redMul(t),i=n.redMul(t.redAdd(this.curve.a24.redMul(n)));return this.curve.point(r,i)},s.prototype.add=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.diffAdd=function(e,t){var n=this.x.redAdd(this.z),r=this.x.redSub(this.z),i=e.x.redAdd(e.z),a=e.x.redSub(e.z).redMul(n),o=i.redMul(r),s=t.z.redMul(a.redAdd(o).redSqr()),c=t.x.redMul(a.redISub(o).redSqr());return this.curve.point(s,c)},s.prototype.mul=function(e){for(var t=e.clone(),n=this,r=this.curve.point(null,null),i=this,a=[];t.cmpn(0)!==0;t.iushrn(1))a.push(t.andln(1));for(var o=a.length-1;o>=0;o--)a[o]===0?(n=n.diffAdd(r,i),r=r.dbl()):(r=n.diffAdd(r,i),n=n.dbl());return r},s.prototype.mulAdd=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.jumlAdd=function(){throw Error(`Not supported on Montgomery curve`)},s.prototype.eq=function(e){return this.getX().cmp(e.getX())===0},s.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},s.prototype.getX=function(){return this.normalize(),this.x.fromRed()}})),kc=a(((e,t)=>{var n=Cc(),r=bc(),i=Ec(),a=Tc(),o=n.assert;function s(e){this.twisted=(e.a|0)!=1,this.mOneA=this.twisted&&(e.a|0)==-1,this.extended=this.mOneA,a.call(this,`edwards`,e),this.a=new r(e.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new r(e.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new r(e.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),o(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(e.c|0)==1}i(s,a),t.exports=s,s.prototype._mulA=function(e){return this.mOneA?e.redNeg():this.a.redMul(e)},s.prototype._mulC=function(e){return this.oneC?e:this.c.redMul(e)},s.prototype.jpoint=function(e,t,n,r){return this.point(e,t,n,r)},s.prototype.pointFromX=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=this.c2.redSub(this.a.redMul(n)),a=this.one.redSub(this.c2.redMul(this.d).redMul(n)),o=i.redMul(a.redInvm()),s=o.redSqrt();if(s.redSqr().redSub(o).cmp(this.zero)!==0)throw Error(`invalid point`);var c=s.fromRed().isOdd();return(t&&!c||!t&&c)&&(s=s.redNeg()),this.point(e,s)},s.prototype.pointFromY=function(e,t){e=new r(e,16),e.red||(e=e.toRed(this.red));var n=e.redSqr(),i=n.redSub(this.c2),a=n.redMul(this.d).redMul(this.c2).redSub(this.a),o=i.redMul(a.redInvm());if(o.cmp(this.zero)===0){if(t)throw Error(`invalid point`);return this.point(this.zero,e)}var s=o.redSqrt();if(s.redSqr().redSub(o).cmp(this.zero)!==0)throw Error(`invalid point`);return s.fromRed().isOdd()!==t&&(s=s.redNeg()),this.point(s,e)},s.prototype.validate=function(e){if(e.isInfinity())return!0;e.normalize();var t=e.x.redSqr(),n=e.y.redSqr(),r=t.redMul(this.a).redAdd(n),i=this.c2.redMul(this.one.redAdd(this.d.redMul(t).redMul(n)));return r.cmp(i)===0};function c(e,t,n,i,o){a.BasePoint.call(this,e,`projective`),t===null&&n===null&&i===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new r(t,16),this.y=new r(n,16),this.z=i?new r(i,16):this.curve.one,this.t=o&&new r(o,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}i(c,a.BasePoint),s.prototype.pointFromJSON=function(e){return c.fromJSON(this,e)},s.prototype.point=function(e,t,n,r){return new c(this,e,t,n,r)},c.fromJSON=function(e,t){return new c(e,t[0],t[1],t[2])},c.prototype.inspect=function(){return this.isInfinity()?`<EC Point Infinity>`:`<EC Point x: `+this.x.fromRed().toString(16,2)+` y: `+this.y.fromRed().toString(16,2)+` z: `+this.z.fromRed().toString(16,2)+`>`},c.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},c.prototype._extDbl=function(){var e=this.x.redSqr(),t=this.y.redSqr(),n=this.z.redSqr();n=n.redIAdd(n);var r=this.curve._mulA(e),i=this.x.redAdd(this.y).redSqr().redISub(e).redISub(t),a=r.redAdd(t),o=a.redSub(n),s=r.redSub(t),c=i.redMul(o),l=a.redMul(s),u=i.redMul(s),d=o.redMul(a);return this.curve.point(c,l,d,u)},c.prototype._projDbl=function(){var e=this.x.redAdd(this.y).redSqr(),t=this.x.redSqr(),n=this.y.redSqr(),r,i,a,o,s,c;if(this.curve.twisted){o=this.curve._mulA(t);var l=o.redAdd(n);this.zOne?(r=e.redSub(t).redSub(n).redMul(l.redSub(this.curve.two)),i=l.redMul(o.redSub(n)),a=l.redSqr().redSub(l).redSub(l)):(s=this.z.redSqr(),c=l.redSub(s).redISub(s),r=e.redSub(t).redISub(n).redMul(c),i=l.redMul(o.redSub(n)),a=l.redMul(c))}else o=t.redAdd(n),s=this.curve._mulC(this.z).redSqr(),c=o.redSub(s).redSub(s),r=this.curve._mulC(e.redISub(o)).redMul(c),i=this.curve._mulC(o).redMul(t.redISub(n)),a=o.redMul(c);return this.curve.point(r,i,a)},c.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},c.prototype._extAdd=function(e){var t=this.y.redSub(this.x).redMul(e.y.redSub(e.x)),n=this.y.redAdd(this.x).redMul(e.y.redAdd(e.x)),r=this.t.redMul(this.curve.dd).redMul(e.t),i=this.z.redMul(e.z.redAdd(e.z)),a=n.redSub(t),o=i.redSub(r),s=i.redAdd(r),c=n.redAdd(t),l=a.redMul(o),u=s.redMul(c),d=a.redMul(c),f=o.redMul(s);return this.curve.point(l,u,f,d)},c.prototype._projAdd=function(e){var t=this.z.redMul(e.z),n=t.redSqr(),r=this.x.redMul(e.x),i=this.y.redMul(e.y),a=this.curve.d.redMul(r).redMul(i),o=n.redSub(a),s=n.redAdd(a),c=this.x.redAdd(this.y).redMul(e.x.redAdd(e.y)).redISub(r).redISub(i),l=t.redMul(o).redMul(c),u,d;return this.curve.twisted?(u=t.redMul(s).redMul(i.redSub(this.curve._mulA(r))),d=o.redMul(s)):(u=t.redMul(s).redMul(i.redSub(r)),d=this.curve._mulC(o).redMul(s)),this.curve.point(l,u,d)},c.prototype.add=function(e){return this.isInfinity()?e:e.isInfinity()?this:this.curve.extended?this._extAdd(e):this._projAdd(e)},c.prototype.mul=function(e){return this._hasDoubles(e)?this.curve._fixedNafMul(this,e):this.curve._wnafMul(this,e)},c.prototype.mulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!1)},c.prototype.jmulAdd=function(e,t,n){return this.curve._wnafMulAdd(1,[this,t],[e,n],2,!0)},c.prototype.normalize=function(){if(this.zOne)return this;var e=this.z.redInvm();return this.x=this.x.redMul(e),this.y=this.y.redMul(e),this.t&&=this.t.redMul(e),this.z=this.curve.one,this.zOne=!0,this},c.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},c.prototype.getX=function(){return this.normalize(),this.x.fromRed()},c.prototype.getY=function(){return this.normalize(),this.y.fromRed()},c.prototype.eq=function(e){return this===e||this.getX().cmp(e.getX())===0&&this.getY().cmp(e.getY())===0},c.prototype.eqXToP=function(e){var t=e.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(t)===0)return!0;for(var n=e.clone(),r=this.curve.redN.redMul(this.z);;){if(n.iadd(this.curve.n),n.cmp(this.curve.p)>=0)return!1;if(t.redIAdd(r),this.x.cmp(t)===0)return!0}},c.prototype.toP=c.prototype.normalize,c.prototype.mixedAdd=c.prototype.add})),Ac=a((e=>{var t=e;t.base=Tc(),t.short=Dc(),t.mont=Oc(),t.edwards=kc()})),jc=a((e=>{var t=xc();e.inherits=Ec();function n(e,t){return(e.charCodeAt(t)&64512)!=55296||t<0||t+1>=e.length?!1:(e.charCodeAt(t+1)&64512)==56320}function r(e,t){if(Array.isArray(e))return e.slice();if(!e)return[];var r=[];if(typeof e==`string`){if(!t)for(var i=0,a=0;a<e.length;a++){var o=e.charCodeAt(a);o<128?r[i++]=o:o<2048?(r[i++]=o>>6|192,r[i++]=o&63|128):n(e,a)?(o=65536+((o&1023)<<10)+(e.charCodeAt(++a)&1023),r[i++]=o>>18|240,r[i++]=o>>12&63|128,r[i++]=o>>6&63|128,r[i++]=o&63|128):(r[i++]=o>>12|224,r[i++]=o>>6&63|128,r[i++]=o&63|128)}else if(t===`hex`)for(e=e.replace(/[^a-z0-9]+/gi,``),e.length%2!=0&&(e=`0`+e),a=0;a<e.length;a+=2)r.push(parseInt(e[a]+e[a+1],16))}else for(a=0;a<e.length;a++)r[a]=e[a]|0;return r}e.toArray=r;function i(e){for(var t=``,n=0;n<e.length;n++)t+=s(e[n].toString(16));return t}e.toHex=i;function a(e){return(e>>>24|e>>>8&65280|e<<8&16711680|(e&255)<<24)>>>0}e.htonl=a;function o(e,t){for(var n=``,r=0;r<e.length;r++){var i=e[r];t===`little`&&(i=a(i)),n+=c(i.toString(16))}return n}e.toHex32=o;function s(e){return e.length===1?`0`+e:e}e.zero2=s;function c(e){return e.length===7?`0`+e:e.length===6?`00`+e:e.length===5?`000`+e:e.length===4?`0000`+e:e.length===3?`00000`+e:e.length===2?`000000`+e:e.length===1?`0000000`+e:e}e.zero8=c;function l(e,n,r,i){var a=r-n;t(a%4==0);for(var o=Array(a/4),s=0,c=n;s<o.length;s++,c+=4)o[s]=(i===`big`?e[c]<<24|e[c+1]<<16|e[c+2]<<8|e[c+3]:e[c+3]<<24|e[c+2]<<16|e[c+1]<<8|e[c])>>>0;return o}e.join32=l;function u(e,t){for(var n=Array(e.length*4),r=0,i=0;r<e.length;r++,i+=4){var a=e[r];t===`big`?(n[i]=a>>>24,n[i+1]=a>>>16&255,n[i+2]=a>>>8&255,n[i+3]=a&255):(n[i+3]=a>>>24,n[i+2]=a>>>16&255,n[i+1]=a>>>8&255,n[i]=a&255)}return n}e.split32=u;function d(e,t){return e>>>t|e<<32-t}e.rotr32=d;function f(e,t){return e<<t|e>>>32-t}e.rotl32=f;function p(e,t){return e+t>>>0}e.sum32=p;function m(e,t,n){return e+t+n>>>0}e.sum32_3=m;function h(e,t,n,r){return e+t+n+r>>>0}e.sum32_4=h;function g(e,t,n,r,i){return e+t+n+r+i>>>0}e.sum32_5=g;function _(e,t,n,r){var i=e[t],a=r+e[t+1]>>>0;e[t]=+(a<r)+n+i>>>0,e[t+1]=a}e.sum64=_;function v(e,t,n,r){return+(t+r>>>0<t)+e+n>>>0}e.sum64_hi=v;function y(e,t,n,r){return t+r>>>0}e.sum64_lo=y;function b(e,t,n,r,i,a,o,s){var c=0,l=t;return l=l+r>>>0,c+=+(l<t),l=l+a>>>0,c+=+(l<a),l=l+s>>>0,c+=+(l<s),e+n+i+o+c>>>0}e.sum64_4_hi=b;function x(e,t,n,r,i,a,o,s){return t+r+a+s>>>0}e.sum64_4_lo=x;function S(e,t,n,r,i,a,o,s,c,l){var u=0,d=t;return d=d+r>>>0,u+=+(d<t),d=d+a>>>0,u+=+(d<a),d=d+s>>>0,u+=+(d<s),d=d+l>>>0,u+=+(d<l),e+n+i+o+c+u>>>0}e.sum64_5_hi=S;function C(e,t,n,r,i,a,o,s,c,l){return t+r+a+s+l>>>0}e.sum64_5_lo=C;function w(e,t,n){return(t<<32-n|e>>>n)>>>0}e.rotr64_hi=w;function T(e,t,n){return(e<<32-n|t>>>n)>>>0}e.rotr64_lo=T;function E(e,t,n){return e>>>n}e.shr64_hi=E;function D(e,t,n){return(e<<32-n|t>>>n)>>>0}e.shr64_lo=D})),Mc=a((e=>{var t=jc(),n=xc();function r(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian=`big`,this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}e.BlockHash=r,r.prototype.update=function(e,n){if(e=t.toArray(e,n),this.pending?this.pending=this.pending.concat(e):this.pending=e,this.pendingTotal+=e.length,this.pending.length>=this._delta8){e=this.pending;var r=e.length%this._delta8;this.pending=e.slice(e.length-r,e.length),this.pending.length===0&&(this.pending=null),e=t.join32(e,0,e.length-r,this.endian);for(var i=0;i<e.length;i+=this._delta32)this._update(e,i,i+this._delta32)}return this},r.prototype.digest=function(e){return this.update(this._pad()),n(this.pending===null),this._digest(e)},r.prototype._pad=function(){var e=this.pendingTotal,t=this._delta8,n=t-(e+this.padLength)%t,r=Array(n+this.padLength);r[0]=128;for(var i=1;i<n;i++)r[i]=0;if(e<<=3,this.endian===`big`){for(var a=8;a<this.padLength;a++)r[i++]=0;r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=e>>>24&255,r[i++]=e>>>16&255,r[i++]=e>>>8&255,r[i++]=e&255}else for(r[i++]=e&255,r[i++]=e>>>8&255,r[i++]=e>>>16&255,r[i++]=e>>>24&255,r[i++]=0,r[i++]=0,r[i++]=0,r[i++]=0,a=8;a<this.padLength;a++)r[i++]=0;return r}})),Nc=a((e=>{var t=jc().rotr32;function n(e,t,n,o){if(e===0)return r(t,n,o);if(e===1||e===3)return a(t,n,o);if(e===2)return i(t,n,o)}e.ft_1=n;function r(e,t,n){return e&t^~e&n}e.ch32=r;function i(e,t,n){return e&t^e&n^t&n}e.maj32=i;function a(e,t,n){return e^t^n}e.p32=a;function o(e){return t(e,2)^t(e,13)^t(e,22)}e.s0_256=o;function s(e){return t(e,6)^t(e,11)^t(e,25)}e.s1_256=s;function c(e){return t(e,7)^t(e,18)^e>>>3}e.g0_256=c;function l(e){return t(e,17)^t(e,19)^e>>>10}e.g1_256=l})),Pc=a(((e,t)=>{var n=jc(),r=Mc(),i=Nc(),a=n.rotl32,o=n.sum32,s=n.sum32_5,c=i.ft_1,l=r.BlockHash,u=[1518500249,1859775393,2400959708,3395469782];function d(){if(!(this instanceof d))return new d;l.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=Array(80)}n.inherits(d,l),t.exports=d,d.blockSize=512,d.outSize=160,d.hmacStrength=80,d.padLength=64,d.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=a(n[r-3]^n[r-8]^n[r-14]^n[r-16],1);var i=this.h[0],l=this.h[1],d=this.h[2],f=this.h[3],p=this.h[4];for(r=0;r<n.length;r++){var m=~~(r/20),h=s(a(i,5),c(m,l,d,f),p,n[r],u[m]);p=f,f=d,d=a(l,30),l=i,i=h}this.h[0]=o(this.h[0],i),this.h[1]=o(this.h[1],l),this.h[2]=o(this.h[2],d),this.h[3]=o(this.h[3],f),this.h[4]=o(this.h[4],p)},d.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)}})),Fc=a(((e,t)=>{var n=jc(),r=Mc(),i=Nc(),a=xc(),o=n.sum32,s=n.sum32_4,c=n.sum32_5,l=i.ch32,u=i.maj32,d=i.s0_256,f=i.s1_256,p=i.g0_256,m=i.g1_256,h=r.BlockHash,g=[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];function _(){if(!(this instanceof _))return new _;h.call(this),this.h=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225],this.k=g,this.W=Array(64)}n.inherits(_,h),t.exports=_,_.blockSize=512,_.outSize=256,_.hmacStrength=192,_.padLength=64,_.prototype._update=function(e,t){for(var n=this.W,r=0;r<16;r++)n[r]=e[t+r];for(;r<n.length;r++)n[r]=s(m(n[r-2]),n[r-7],p(n[r-15]),n[r-16]);var i=this.h[0],h=this.h[1],g=this.h[2],_=this.h[3],v=this.h[4],y=this.h[5],b=this.h[6],x=this.h[7];for(a(this.k.length===n.length),r=0;r<n.length;r++){var S=c(x,f(v),l(v,y,b),this.k[r],n[r]),C=o(d(i),u(i,h,g));x=b,b=y,y=v,v=o(_,S),_=g,g=h,h=i,i=o(S,C)}this.h[0]=o(this.h[0],i),this.h[1]=o(this.h[1],h),this.h[2]=o(this.h[2],g),this.h[3]=o(this.h[3],_),this.h[4]=o(this.h[4],v),this.h[5]=o(this.h[5],y),this.h[6]=o(this.h[6],b),this.h[7]=o(this.h[7],x)},_.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)}})),Ic=a(((e,t)=>{var n=jc(),r=Fc();function i(){if(!(this instanceof i))return new i;r.call(this),this.h=[3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428]}n.inherits(i,r),t.exports=i,i.blockSize=512,i.outSize=224,i.hmacStrength=192,i.padLength=64,i.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h.slice(0,7),`big`):n.split32(this.h.slice(0,7),`big`)}})),Lc=a(((e,t)=>{var n=jc(),r=Mc(),i=xc(),a=n.rotr64_hi,o=n.rotr64_lo,s=n.shr64_hi,c=n.shr64_lo,l=n.sum64,u=n.sum64_hi,d=n.sum64_lo,f=n.sum64_4_hi,p=n.sum64_4_lo,m=n.sum64_5_hi,h=n.sum64_5_lo,g=r.BlockHash,_=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function v(){if(!(this instanceof v))return new v;g.call(this),this.h=[1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209],this.k=_,this.W=Array(160)}n.inherits(v,g),t.exports=v,v.blockSize=1024,v.outSize=512,v.hmacStrength=192,v.padLength=128,v.prototype._prepareBlock=function(e,t){for(var n=this.W,r=0;r<32;r++)n[r]=e[t+r];for(;r<n.length;r+=2){var i=k(n[r-4],n[r-3]),a=A(n[r-4],n[r-3]),o=n[r-14],s=n[r-13],c=D(n[r-30],n[r-29]),l=O(n[r-30],n[r-29]),u=n[r-32],d=n[r-31];n[r]=f(i,a,o,s,c,l,u,d),n[r+1]=p(i,a,o,s,c,l,u,d)}},v.prototype._update=function(e,t){this._prepareBlock(e,t);var n=this.W,r=this.h[0],a=this.h[1],o=this.h[2],s=this.h[3],c=this.h[4],f=this.h[5],p=this.h[6],g=this.h[7],_=this.h[8],v=this.h[9],D=this.h[10],O=this.h[11],k=this.h[12],A=this.h[13],ee=this.h[14],j=this.h[15];i(this.k.length===n.length);for(var M=0;M<n.length;M+=2){var N=ee,P=j,F=T(_,v),te=E(_,v),I=y(_,v,D,O,k,A),ne=b(_,v,D,O,k,A),re=this.k[M],L=this.k[M+1],R=n[M],ie=n[M+1],z=m(N,P,F,te,I,ne,re,L,R,ie),B=h(N,P,F,te,I,ne,re,L,R,ie);N=C(r,a),P=w(r,a),F=x(r,a,o,s,c,f),te=S(r,a,o,s,c,f);var ae=u(N,P,F,te),V=d(N,P,F,te);ee=k,j=A,k=D,A=O,D=_,O=v,_=u(p,g,z,B),v=d(g,g,z,B),p=c,g=f,c=o,f=s,o=r,s=a,r=u(z,B,ae,V),a=d(z,B,ae,V)}l(this.h,0,r,a),l(this.h,2,o,s),l(this.h,4,c,f),l(this.h,6,p,g),l(this.h,8,_,v),l(this.h,10,D,O),l(this.h,12,k,A),l(this.h,14,ee,j)},v.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h,`big`):n.split32(this.h,`big`)};function y(e,t,n,r,i){var a=e&n^~e&i;return a<0&&(a+=4294967296),a}function b(e,t,n,r,i,a){var o=t&r^~t&a;return o<0&&(o+=4294967296),o}function x(e,t,n,r,i){var a=e&n^e&i^n&i;return a<0&&(a+=4294967296),a}function S(e,t,n,r,i,a){var o=t&r^t&a^r&a;return o<0&&(o+=4294967296),o}function C(e,t){var n=a(e,t,28),r=a(t,e,2),i=a(t,e,7),o=n^r^i;return o<0&&(o+=4294967296),o}function w(e,t){var n=o(e,t,28),r=o(t,e,2),i=o(t,e,7),a=n^r^i;return a<0&&(a+=4294967296),a}function T(e,t){var n=a(e,t,14),r=a(e,t,18),i=a(t,e,9),o=n^r^i;return o<0&&(o+=4294967296),o}function E(e,t){var n=o(e,t,14),r=o(e,t,18),i=o(t,e,9),a=n^r^i;return a<0&&(a+=4294967296),a}function D(e,t){var n=a(e,t,1),r=a(e,t,8),i=s(e,t,7),o=n^r^i;return o<0&&(o+=4294967296),o}function O(e,t){var n=o(e,t,1),r=o(e,t,8),i=c(e,t,7),a=n^r^i;return a<0&&(a+=4294967296),a}function k(e,t){var n=a(e,t,19),r=a(t,e,29),i=s(e,t,6),o=n^r^i;return o<0&&(o+=4294967296),o}function A(e,t){var n=o(e,t,19),r=o(t,e,29),i=c(e,t,6),a=n^r^i;return a<0&&(a+=4294967296),a}})),Rc=a(((e,t)=>{var n=jc(),r=Lc();function i(){if(!(this instanceof i))return new i;r.call(this),this.h=[3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]}n.inherits(i,r),t.exports=i,i.blockSize=1024,i.outSize=384,i.hmacStrength=192,i.padLength=128,i.prototype._digest=function(e){return e===`hex`?n.toHex32(this.h.slice(0,12),`big`):n.split32(this.h.slice(0,12),`big`)}})),zc=a((e=>{e.sha1=Pc(),e.sha224=Ic(),e.sha256=Fc(),e.sha384=Rc(),e.sha512=Lc()})),Bc=a((e=>{var t=jc(),n=Mc(),r=t.rotl32,i=t.sum32,a=t.sum32_3,o=t.sum32_4,s=n.BlockHash;function c(){if(!(this instanceof c))return new c;s.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.endian=`little`}t.inherits(c,s),e.ripemd160=c,c.blockSize=512,c.outSize=160,c.hmacStrength=192,c.padLength=64,c.prototype._update=function(e,t){for(var n=this.h[0],s=this.h[1],c=this.h[2],g=this.h[3],_=this.h[4],v=n,y=s,b=c,x=g,S=_,C=0;C<80;C++){var w=i(r(o(n,l(C,s,c,g),e[f[C]+t],u(C)),m[C]),_);n=_,_=g,g=r(c,10),c=s,s=w,w=i(r(o(v,l(79-C,y,b,x),e[p[C]+t],d(C)),h[C]),S),v=S,S=x,x=r(b,10),b=y,y=w}w=a(this.h[1],c,x),this.h[1]=a(this.h[2],g,S),this.h[2]=a(this.h[3],_,v),this.h[3]=a(this.h[4],n,y),this.h[4]=a(this.h[0],s,b),this.h[0]=w},c.prototype._digest=function(e){return e===`hex`?t.toHex32(this.h,`little`):t.split32(this.h,`little`)};function l(e,t,n,r){return e<=15?t^n^r:e<=31?t&n|~t&r:e<=47?(t|~n)^r:e<=63?t&r|n&~r:t^(n|~r)}function u(e){return e<=15?0:e<=31?1518500249:e<=47?1859775393:e<=63?2400959708:2840853838}function d(e){return e<=15?1352829926:e<=31?1548603684:e<=47?1836072691:e<=63?2053994217:0}var f=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],p=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],m=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],h=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]})),Vc=a(((e,t)=>{var n=jc(),r=xc();function i(e,t,r){if(!(this instanceof i))return new i(e,t,r);this.Hash=e,this.blockSize=e.blockSize/8,this.outSize=e.outSize/8,this.inner=null,this.outer=null,this._init(n.toArray(t,r))}t.exports=i,i.prototype._init=function(e){e.length>this.blockSize&&(e=new this.Hash().update(e).digest()),r(e.length<=this.blockSize);for(var t=e.length;t<this.blockSize;t++)e.push(0);for(t=0;t<e.length;t++)e[t]^=54;for(this.inner=new this.Hash().update(e),t=0;t<e.length;t++)e[t]^=106;this.outer=new this.Hash().update(e)},i.prototype.update=function(e,t){return this.inner.update(e,t),this},i.prototype.digest=function(e){return this.outer.update(this.inner.digest()),this.outer.digest(e)}})),Hc=a((e=>{var t=e;t.utils=jc(),t.common=Mc(),t.sha=zc(),t.ripemd=Bc(),t.hmac=Vc(),t.sha1=t.sha.sha1,t.sha256=t.sha.sha256,t.sha224=t.sha.sha224,t.sha384=t.sha.sha384,t.sha512=t.sha.sha512,t.ripemd160=t.ripemd.ripemd160})),Uc=a(((e,t)=>{t.exports={doubles:{step:4,points:[[`e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a`,`f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821`],[`8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508`,`11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf`],[`175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739`,`d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695`],[`363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640`,`4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9`],[`8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c`,`4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36`],[`723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda`,`96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f`],[`eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa`,`5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999`],[`100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0`,`cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09`],[`e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d`,`9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d`],[`feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d`,`e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088`],[`da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1`,`9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d`],[`53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0`,`5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8`],[`8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047`,`10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a`],[`385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862`,`283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453`],[`6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7`,`7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160`],[`3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd`,`56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0`],[`85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83`,`7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6`],[`948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a`,`53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589`],[`6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8`,`bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17`],[`e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d`,`4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda`],[`e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725`,`7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd`],[`213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754`,`4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2`],[`4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c`,`17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6`],[`fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6`,`6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f`],[`76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39`,`c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01`],[`c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891`,`893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3`],[`d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b`,`febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f`],[`b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03`,`2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7`],[`e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d`,`eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78`],[`a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070`,`7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1`],[`90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4`,`e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150`],[`8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da`,`662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82`],[`e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11`,`1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc`],[`8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e`,`efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b`],[`e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41`,`2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51`],[`b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef`,`67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45`],[`d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8`,`db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120`],[`324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d`,`648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84`],[`4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96`,`35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d`],[`9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd`,`ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d`],[`6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5`,`9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8`],[`a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266`,`40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8`],[`7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71`,`34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac`],[`928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac`,`c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f`],[`85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751`,`1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962`],[`ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e`,`493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907`],[`827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241`,`c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec`],[`eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3`,`be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d`],[`e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f`,`4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414`],[`1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19`,`aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd`],[`146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be`,`b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0`],[`fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9`,`6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811`],[`da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2`,`8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1`],[`a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13`,`7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c`],[`174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c`,`ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73`],[`959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba`,`2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd`],[`d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151`,`e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405`],[`64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073`,`d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589`],[`8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458`,`38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e`],[`13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b`,`69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27`],[`bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366`,`d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1`],[`8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa`,`40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482`],[`8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0`,`620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945`],[`dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787`,`7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573`],[`f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e`,`ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82`]]},naf:{wnd:7,points:[[`f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9`,`388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672`],[`2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4`,`d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6`],[`5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc`,`6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da`],[`acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe`,`cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37`],[`774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb`,`d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b`],[`f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8`,`ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81`],[`d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e`,`581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58`],[`defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34`,`4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77`],[`2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c`,`85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a`],[`352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5`,`321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c`],[`2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f`,`2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67`],[`9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714`,`73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402`],[`daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729`,`a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55`],[`c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db`,`2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482`],[`6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4`,`e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82`],[`1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5`,`b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396`],[`605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479`,`2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49`],[`62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d`,`80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf`],[`80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f`,`1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a`],[`7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb`,`d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7`],[`d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9`,`eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933`],[`49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963`,`758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a`],[`77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74`,`958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6`],[`f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530`,`e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37`],[`463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b`,`5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e`],[`f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247`,`cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6`],[`caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1`,`cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476`],[`2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120`,`4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40`],[`7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435`,`91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61`],[`754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18`,`673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683`],[`e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8`,`59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5`],[`186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb`,`3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b`],[`df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f`,`55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417`],[`5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143`,`efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868`],[`290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba`,`e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a`],[`af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45`,`f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6`],[`766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a`,`744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996`],[`59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e`,`c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e`],[`f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8`,`e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d`],[`7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c`,`30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2`],[`948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519`,`e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e`],[`7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab`,`100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437`],[`3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca`,`ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311`],[`d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf`,`8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4`],[`1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610`,`68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575`],[`733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4`,`f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d`],[`15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c`,`d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d`],[`a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940`,`edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629`],[`e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980`,`a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06`],[`311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3`,`66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374`],[`34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf`,`9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee`],[`f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63`,`4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1`],[`d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448`,`fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b`],[`32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf`,`5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661`],[`7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5`,`8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6`],[`ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6`,`8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e`],[`16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5`,`5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d`],[`eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99`,`f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc`],[`78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51`,`f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4`],[`494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5`,`42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c`],[`a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5`,`204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b`],[`c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997`,`4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913`],[`841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881`,`73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154`],[`5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5`,`39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865`],[`36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66`,`d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc`],[`336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726`,`ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224`],[`8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede`,`6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e`],[`1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94`,`60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6`],[`85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31`,`3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511`],[`29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51`,`b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b`],[`a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252`,`ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2`],[`4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5`,`cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c`],[`d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b`,`6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3`],[`ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4`,`322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d`],[`af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f`,`6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700`],[`e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889`,`2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4`],[`591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246`,`b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196`],[`11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984`,`998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4`],[`3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a`,`b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257`],[`cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030`,`bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13`],[`c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197`,`6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096`],[`c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593`,`c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38`],[`a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef`,`21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f`],[`347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38`,`60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448`],[`da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a`,`49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a`],[`c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111`,`5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4`],[`4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502`,`7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437`],[`3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea`,`be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7`],[`cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26`,`8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d`],[`b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986`,`39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a`],[`d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e`,`62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54`],[`48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4`,`25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77`],[`dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda`,`ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517`],[`6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859`,`cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10`],[`e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f`,`f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125`],[`eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c`,`6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e`],[`13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942`,`fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1`],[`ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a`,`1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2`],[`b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80`,`5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423`],[`ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d`,`438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8`],[`8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1`,`cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758`],[`52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63`,`c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375`],[`e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352`,`6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d`],[`7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193`,`ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec`],[`5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00`,`9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0`],[`32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58`,`ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c`],[`e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7`,`d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4`],[`8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8`,`c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f`],[`4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e`,`67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649`],[`3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d`,`cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826`],[`674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b`,`299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5`],[`d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f`,`f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87`],[`30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6`,`462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b`],[`be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297`,`62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc`],[`93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a`,`7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c`],[`b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c`,`ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f`],[`d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52`,`4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a`],[`d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb`,`bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46`],[`463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065`,`bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f`],[`7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917`,`603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03`],[`74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9`,`cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08`],[`30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3`,`553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8`],[`9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57`,`712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373`],[`176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66`,`ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3`],[`75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8`,`9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8`],[`809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721`,`9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1`],[`1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180`,`4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9`]]}}})),Wc=a((e=>{var t=e,n=Hc(),r=Ac(),i=Cc().assert;function a(e){e.type===`short`?this.curve=new r.short(e):e.type===`edwards`?this.curve=new r.edwards(e):this.curve=new r.mont(e),this.g=this.curve.g,this.n=this.curve.n,this.hash=e.hash,i(this.g.validate(),`Invalid curve`),i(this.g.mul(this.n).isInfinity(),`Invalid curve, G*N != O`)}t.PresetCurve=a;function o(e,n){Object.defineProperty(t,e,{configurable:!0,enumerable:!0,get:function(){var r=new a(n);return Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:r}),r}})}o(`p192`,{type:`short`,prime:`p192`,p:`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff`,a:`ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc`,b:`64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1`,n:`ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831`,hash:n.sha256,gRed:!1,g:[`188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012`,`07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811`]}),o(`p224`,{type:`short`,prime:`p224`,p:`ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001`,a:`ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe`,b:`b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4`,n:`ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d`,hash:n.sha256,gRed:!1,g:[`b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21`,`bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34`]}),o(`p256`,{type:`short`,prime:null,p:`ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff`,a:`ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc`,b:`5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b`,n:`ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551`,hash:n.sha256,gRed:!1,g:[`6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296`,`4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5`]}),o(`p384`,{type:`short`,prime:null,p:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff`,a:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc`,b:`b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef`,n:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973`,hash:n.sha384,gRed:!1,g:[`aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7`,`3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f`]}),o(`p521`,{type:`short`,prime:null,p:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff`,a:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc`,b:`00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00`,n:`000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409`,hash:n.sha512,gRed:!1,g:[`000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66`,`00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650`]}),o(`curve25519`,{type:`mont`,prime:`p25519`,p:`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`,a:`76d06`,b:`1`,n:`1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed`,hash:n.sha256,gRed:!1,g:[`9`]}),o(`ed25519`,{type:`edwards`,prime:`p25519`,p:`7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed`,a:`-1`,c:`1`,d:`52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3`,n:`1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed`,hash:n.sha256,gRed:!1,g:[`216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`,`6666666666666666666666666666666666666666666666666666666666666658`]});var s;try{s=Uc()}catch{s=void 0}o(`secp256k1`,{type:`short`,prime:`k256`,p:`ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f`,a:`0`,b:`7`,n:`ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141`,h:`1`,hash:n.sha256,beta:`7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee`,lambda:`5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72`,basis:[{a:`3086d221a7d46bcde86c90e49284eb15`,b:`-e4437ed6010e88286f547fa90abfe4c3`},{a:`114ca50f7a8e2f3f657c1108d9d44cfd8`,b:`3086d221a7d46bcde86c90e49284eb15`}],gRed:!1,g:[`79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798`,`483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8`,s]})})),Gc=a(((e,t)=>{var n=Hc(),r=Sc(),i=xc();function a(e){if(!(this instanceof a))return new a(e);this.hash=e.hash,this.predResist=!!e.predResist,this.outLen=this.hash.outSize,this.minEntropy=e.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var t=r.toArray(e.entropy,e.entropyEnc||`hex`),n=r.toArray(e.nonce,e.nonceEnc||`hex`),o=r.toArray(e.pers,e.persEnc||`hex`);i(t.length>=this.minEntropy/8,`Not enough entropy. Minimum is: `+this.minEntropy+` bits`),this._init(t,n,o)}t.exports=a,a.prototype._init=function(e,t,n){var r=e.concat(t).concat(n);this.K=Array(this.outLen/8),this.V=Array(this.outLen/8);for(var i=0;i<this.V.length;i++)this.K[i]=0,this.V[i]=1;this._update(r),this._reseed=1,this.reseedInterval=281474976710656},a.prototype._hmac=function(){return new n.hmac(this.hash,this.K)},a.prototype._update=function(e){var t=this._hmac().update(this.V).update([0]);e&&(t=t.update(e)),this.K=t.digest(),this.V=this._hmac().update(this.V).digest(),e&&(this.K=this._hmac().update(this.V).update([1]).update(e).digest(),this.V=this._hmac().update(this.V).digest())},a.prototype.reseed=function(e,t,n,a){typeof t!=`string`&&(a=n,n=t,t=null),e=r.toArray(e,t),n=r.toArray(n,a),i(e.length>=this.minEntropy/8,`Not enough entropy. Minimum is: `+this.minEntropy+` bits`),this._update(e.concat(n||[])),this._reseed=1},a.prototype.generate=function(e,t,n,i){if(this._reseed>this.reseedInterval)throw Error(`Reseed is required`);typeof t!=`string`&&(i=n,n=t,t=null),n&&(n=r.toArray(n,i||`hex`),this._update(n));for(var a=[];a.length<e;)this.V=this._hmac().update(this.V).digest(),a=a.concat(this.V);var o=a.slice(0,e);return this._update(n),this._reseed++,r.encode(o,t)}})),Kc=a(((e,t)=>{var n=bc(),r=Cc().assert;function i(e,t){this.ec=e,this.priv=null,this.pub=null,t.priv&&this._importPrivate(t.priv,t.privEnc),t.pub&&this._importPublic(t.pub,t.pubEnc)}t.exports=i,i.fromPublic=function(e,t,n){return t instanceof i?t:new i(e,{pub:t,pubEnc:n})},i.fromPrivate=function(e,t,n){return t instanceof i?t:new i(e,{priv:t,privEnc:n})},i.prototype.validate=function(){var e=this.getPublic();return e.isInfinity()?{result:!1,reason:`Invalid public key`}:e.validate()?e.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:`Public key * N != O`}:{result:!1,reason:`Public key is not a point`}},i.prototype.getPublic=function(e,t){return typeof e==`string`&&(t=e,e=null),this.pub||=this.ec.g.mul(this.priv),t?this.pub.encode(t,e):this.pub},i.prototype.getPrivate=function(e){return e===`hex`?this.priv.toString(16,2):this.priv},i.prototype._importPrivate=function(e,t){this.priv=new n(e,t||16),this.priv=this.priv.umod(this.ec.curve.n)},i.prototype._importPublic=function(e,t){if(e.x||e.y){this.ec.curve.type===`mont`?r(e.x,`Need x coordinate`):(this.ec.curve.type===`short`||this.ec.curve.type===`edwards`)&&r(e.x&&e.y,`Need both x and y coordinate`),this.pub=this.ec.curve.point(e.x,e.y);return}this.pub=this.ec.curve.decodePoint(e,t)},i.prototype.derive=function(e){return e.validate()||r(e.validate(),`public point not validated`),e.mul(this.priv).getX()},i.prototype.sign=function(e,t,n){return this.ec.sign(e,this,t,n)},i.prototype.verify=function(e,t,n){return this.ec.verify(e,t,this,void 0,n)},i.prototype.inspect=function(){return`<Key priv: `+(this.priv&&this.priv.toString(16,2))+` pub: `+(this.pub&&this.pub.inspect())+` >`}})),qc=a(((e,t)=>{var n=bc(),r=Cc(),i=r.assert;function a(e,t){if(e instanceof a)return e;this._importDER(e,t)||(i(e.r&&e.s,`Signature without r or s`),this.r=new n(e.r,16),this.s=new n(e.s,16),e.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=e.recoveryParam)}t.exports=a;function o(){this.place=0}function s(e,t){var n=e[t.place++];if(!(n&128))return n;var r=n&15;if(r===0||r>4||e[t.place]===0)return!1;for(var i=0,a=0,o=t.place;a<r;a++,o++)i<<=8,i|=e[o],i>>>=0;return i<=127?!1:(t.place=o,i)}function c(e){for(var t=0,n=e.length-1;!e[t]&&!(e[t+1]&128)&&t<n;)t++;return t===0?e:e.slice(t)}a.prototype._importDER=function(e,t){e=r.toArray(e,t);var i=new o;if(e[i.place++]!==48)return!1;var a=s(e,i);if(a===!1||a+i.place!==e.length||e[i.place++]!==2)return!1;var c=s(e,i);if(c===!1||e[i.place]&128)return!1;var l=e.slice(i.place,c+i.place);if(i.place+=c,e[i.place++]!==2)return!1;var u=s(e,i);if(u===!1||e.length!==u+i.place||e[i.place]&128)return!1;var d=e.slice(i.place,u+i.place);if(l[0]===0)if(l[1]&128)l=l.slice(1);else return!1;if(d[0]===0)if(d[1]&128)d=d.slice(1);else return!1;return this.r=new n(l),this.s=new n(d),this.recoveryParam=null,!0};function l(e,t){if(t<128){e.push(t);return}var n=1+(Math.log(t)/Math.LN2>>>3);for(e.push(n|128);--n;)e.push(t>>>(n<<3)&255);e.push(t)}a.prototype.toDER=function(e){var t=this.r.toArray(),n=this.s.toArray();for(t[0]&128&&(t=[0].concat(t)),n[0]&128&&(n=[0].concat(n)),t=c(t),n=c(n);!n[0]&&!(n[1]&128);)n=n.slice(1);var i=[2];l(i,t.length),i=i.concat(t),i.push(2),l(i,n.length);var a=i.concat(n),o=[48];return l(o,a.length),o=o.concat(a),r.encode(o,e)}})),Jc=a(((e,t)=>{var n=bc(),r=Gc(),i=Cc(),a=Wc(),o=wc(),s=i.assert,c=Kc(),l=qc();function u(e){if(!(this instanceof u))return new u(e);typeof e==`string`&&(s(Object.prototype.hasOwnProperty.call(a,e),`Unknown curve `+e),e=a[e]),e instanceof a.PresetCurve&&(e={curve:e}),this.curve=e.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=e.curve.g,this.g.precompute(e.curve.n.bitLength()+1),this.hash=e.hash||e.curve.hash}t.exports=u,u.prototype.keyPair=function(e){return new c(this,e)},u.prototype.keyFromPrivate=function(e,t){return c.fromPrivate(this,e,t)},u.prototype.keyFromPublic=function(e,t){return c.fromPublic(this,e,t)},u.prototype.genKeyPair=function(e){e||={};for(var t=new r({hash:this.hash,pers:e.pers,persEnc:e.persEnc||`utf8`,entropy:e.entropy||o(this.hash.hmacStrength),entropyEnc:e.entropy&&e.entropyEnc||`utf8`,nonce:this.n.toArray()}),i=this.n.byteLength(),a=this.n.sub(new n(2));;){var s=new n(t.generate(i));if(!(s.cmp(a)>0))return s.iaddn(1),this.keyFromPrivate(s)}},u.prototype._truncateToN=function(e,t,r){var i;if(n.isBN(e)||typeof e==`number`)e=new n(e,16),i=e.byteLength();else if(typeof e==`object`)i=e.length,e=new n(e,16);else{var a=e.toString();i=a.length+1>>>1,e=new n(a,16)}typeof r!=`number`&&(r=i*8);var o=r-this.n.bitLength();return o>0&&(e=e.ushrn(o)),!t&&e.cmp(this.n)>=0?e.sub(this.n):e},u.prototype.sign=function(e,t,i,a){if(typeof i==`object`&&(a=i,i=null),a||={},typeof e!=`string`&&typeof e!=`number`&&!n.isBN(e)){s(typeof e==`object`&&e&&typeof e.length==`number`,`Expected message to be an array-like, a hex string, or a BN instance`),s(e.length>>>0===e.length);for(var o=0;o<e.length;o++)s((e[o]&255)===e[o])}t=this.keyFromPrivate(t,i),e=this._truncateToN(e,!1,a.msgBitLength),s(!e.isNeg(),`Can not sign a negative message`);var c=this.n.byteLength(),u=t.getPrivate().toArray(`be`,c),d=e.toArray(`be`,c);s(new n(d).eq(e),`Can not sign message`);for(var f=new r({hash:this.hash,entropy:u,nonce:d,pers:a.pers,persEnc:a.persEnc||`utf8`}),p=this.n.sub(new n(1)),m=0;;m++){var h=a.k?a.k(m):new n(f.generate(this.n.byteLength()));if(h=this._truncateToN(h,!0),!(h.cmpn(1)<=0||h.cmp(p)>=0)){var g=this.g.mul(h);if(!g.isInfinity()){var _=g.getX(),v=_.umod(this.n);if(v.cmpn(0)!==0){var y=h.invm(this.n).mul(v.mul(t.getPrivate()).iadd(e));if(y=y.umod(this.n),y.cmpn(0)!==0){var b=!!g.getY().isOdd()|(_.cmp(v)===0?0:2);return a.canonical&&y.cmp(this.nh)>0&&(y=this.n.sub(y),b^=1),new l({r:v,s:y,recoveryParam:b})}}}}}},u.prototype.verify=function(e,t,n,r,i){i||={},e=this._truncateToN(e,!1,i.msgBitLength),n=this.keyFromPublic(n,r),t=new l(t,`hex`);var a=t.r,o=t.s;if(a.cmpn(1)<0||a.cmp(this.n)>=0||o.cmpn(1)<0||o.cmp(this.n)>=0)return!1;var s=o.invm(this.n),c=s.mul(e).umod(this.n),u=s.mul(a).umod(this.n),d;return this.curve._maxwellTrick?(d=this.g.jmulAdd(c,n.getPublic(),u),d.isInfinity()?!1:d.eqXToP(a)):(d=this.g.mulAdd(c,n.getPublic(),u),d.isInfinity()?!1:d.getX().umod(this.n).cmp(a)===0)},u.prototype.recoverPubKey=function(e,t,r,i){s((3&r)===r,`The recovery param is more than two bits`),t=new l(t,i);var a=this.n,o=new n(e),c=t.r,u=t.s,d=r&1,f=r>>1;if(c.cmp(this.curve.p.umod(this.curve.n))>=0&&f)throw Error(`Unable to find sencond key candinate`);c=f?this.curve.pointFromX(c.add(this.curve.n),d):this.curve.pointFromX(c,d);var p=t.r.invm(a),m=a.sub(o).mul(p).umod(a),h=u.mul(p).umod(a);return this.g.mulAdd(m,c,h)},u.prototype.getKeyRecoveryParam=function(e,t,n,r){if(t=new l(t,r),t.recoveryParam!==null)return t.recoveryParam;for(var i=0;i<4;i++){var a;try{a=this.recoverPubKey(e,t,i)}catch{continue}if(a.eq(n))return i}throw Error(`Unable to find valid recovery factor`)}})),Yc=a(((e,t)=>{var n=Cc(),r=n.assert,i=n.parseBytes,a=n.cachedProperty;function o(e,t){this.eddsa=e,this._secret=i(t.secret),e.isPoint(t.pub)?this._pub=t.pub:this._pubBytes=i(t.pub)}o.fromPublic=function(e,t){return t instanceof o?t:new o(e,{pub:t})},o.fromSecret=function(e,t){return t instanceof o?t:new o(e,{secret:t})},o.prototype.secret=function(){return this._secret},a(o,`pubBytes`,function(){return this.eddsa.encodePoint(this.pub())}),a(o,`pub`,function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),a(o,`privBytes`,function(){var e=this.eddsa,t=this.hash(),n=e.encodingLength-1,r=t.slice(0,e.encodingLength);return r[0]&=248,r[n]&=127,r[n]|=64,r}),a(o,`priv`,function(){return this.eddsa.decodeInt(this.privBytes())}),a(o,`hash`,function(){return this.eddsa.hash().update(this.secret()).digest()}),a(o,`messagePrefix`,function(){return this.hash().slice(this.eddsa.encodingLength)}),o.prototype.sign=function(e){return r(this._secret,`KeyPair can only verify`),this.eddsa.sign(e,this)},o.prototype.verify=function(e,t){return this.eddsa.verify(e,t,this)},o.prototype.getSecret=function(e){return r(this._secret,`KeyPair is public only`),n.encode(this.secret(),e)},o.prototype.getPublic=function(e){return n.encode(this.pubBytes(),e)},t.exports=o})),Xc=a(((e,t)=>{var n=bc(),r=Cc(),i=r.assert,a=r.cachedProperty,o=r.parseBytes;function s(e,t){this.eddsa=e,typeof t!=`object`&&(t=o(t)),Array.isArray(t)&&(i(t.length===e.encodingLength*2,`Signature has invalid size`),t={R:t.slice(0,e.encodingLength),S:t.slice(e.encodingLength)}),i(t.R&&t.S,`Signature without R or S`),e.isPoint(t.R)&&(this._R=t.R),t.S instanceof n&&(this._S=t.S),this._Rencoded=Array.isArray(t.R)?t.R:t.Rencoded,this._Sencoded=Array.isArray(t.S)?t.S:t.Sencoded}a(s,`S`,function(){return this.eddsa.decodeInt(this.Sencoded())}),a(s,`R`,function(){return this.eddsa.decodePoint(this.Rencoded())}),a(s,`Rencoded`,function(){return this.eddsa.encodePoint(this.R())}),a(s,`Sencoded`,function(){return this.eddsa.encodeInt(this.S())}),s.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},s.prototype.toHex=function(){return r.encode(this.toBytes(),`hex`).toUpperCase()},t.exports=s})),Zc=a(((e,t)=>{var n=Hc(),r=Wc(),i=Cc(),a=i.assert,o=i.parseBytes,s=Yc(),c=Xc();function l(e){if(a(e===`ed25519`,`only tested with ed25519 so far`),!(this instanceof l))return new l(e);e=r[e].curve,this.curve=e,this.g=e.g,this.g.precompute(e.n.bitLength()+1),this.pointClass=e.point().constructor,this.encodingLength=Math.ceil(e.n.bitLength()/8),this.hash=n.sha512}t.exports=l,l.prototype.sign=function(e,t){e=o(e);var n=this.keyFromSecret(t),r=this.hashInt(n.messagePrefix(),e),i=this.g.mul(r),a=this.encodePoint(i),s=this.hashInt(a,n.pubBytes(),e).mul(n.priv()),c=r.add(s).umod(this.curve.n);return this.makeSignature({R:i,S:c,Rencoded:a})},l.prototype.verify=function(e,t,n){if(e=o(e),t=this.makeSignature(t),t.S().gte(t.eddsa.curve.n)||t.S().isNeg())return!1;var r=this.keyFromPublic(n),i=this.hashInt(t.Rencoded(),r.pubBytes(),e),a=this.g.mul(t.S());return t.R().add(r.pub().mul(i)).eq(a)},l.prototype.hashInt=function(){for(var e=this.hash(),t=0;t<arguments.length;t++)e.update(arguments[t]);return i.intFromLE(e.digest()).umod(this.curve.n)},l.prototype.keyFromPublic=function(e){return s.fromPublic(this,e)},l.prototype.keyFromSecret=function(e){return s.fromSecret(this,e)},l.prototype.makeSignature=function(e){return e instanceof c?e:new c(this,e)},l.prototype.encodePoint=function(e){var t=e.getY().toArray(`le`,this.encodingLength);return t[this.encodingLength-1]|=e.getX().isOdd()?128:0,t},l.prototype.decodePoint=function(e){e=i.parseBytes(e);var t=e.length-1,n=e.slice(0,t).concat(e[t]&-129),r=(e[t]&128)!=0,a=i.intFromLE(n);return this.curve.pointFromY(a,r)},l.prototype.encodeInt=function(e){return e.toArray(`le`,this.encodingLength)},l.prototype.decodeInt=function(e){return i.intFromLE(e)},l.prototype.isPoint=function(e){return e instanceof this.pointClass}})),Qc=a((t=>{var n=t;n.version=(yc(),e(ic).default).version,n.utils=Cc(),n.rand=wc(),n.curve=Ac(),n.curves=Wc(),n.ec=Jc(),n.eddsa=Zc()})),$c=Qc(),el={waku:{publish:`waku_publish`,batchPublish:`waku_batchPublish`,subscribe:`waku_subscribe`,batchSubscribe:`waku_batchSubscribe`,subscription:`waku_subscription`,unsubscribe:`waku_unsubscribe`,batchUnsubscribe:`waku_batchUnsubscribe`,batchFetchMessages:`waku_batchFetchMessages`},irn:{publish:`irn_publish`,batchPublish:`irn_batchPublish`,subscribe:`irn_subscribe`,batchSubscribe:`irn_batchSubscribe`,subscription:`irn_subscription`,unsubscribe:`irn_unsubscribe`,batchUnsubscribe:`irn_batchUnsubscribe`,batchFetchMessages:`irn_batchFetchMessages`},iridium:{publish:`iridium_publish`,batchPublish:`iridium_batchPublish`,subscribe:`iridium_subscribe`,batchSubscribe:`iridium_batchSubscribe`,subscription:`iridium_subscription`,unsubscribe:`iridium_unsubscribe`,batchUnsubscribe:`iridium_batchUnsubscribe`,batchFetchMessages:`iridium_batchFetchMessages`}},tl=`PARSE_ERROR`,nl=`INVALID_REQUEST`,rl=`METHOD_NOT_FOUND`,il=`INVALID_PARAMS`,al=`INTERNAL_ERROR`,ol=`SERVER_ERROR`,sl=[-32700,-32600,-32601,-32602,-32603],cl=[-32e3,-32099],ll={[tl]:{code:-32700,message:`Parse error`},[nl]:{code:-32600,message:`Invalid Request`},[rl]:{code:-32601,message:`Method not found`},[il]:{code:-32602,message:`Invalid params`},[al]:{code:-32603,message:`Internal error`},[ol]:{code:-32e3,message:`Server error`}},ul=ol;function dl(e){return e<=cl[0]&&e>=cl[1]}function fl(e){return sl.includes(e)}function pl(e){return typeof e==`number`}function ml(e){return Object.keys(ll).includes(e)?ll[e]:ll[ul]}function hl(e){return Object.values(ll).find(t=>t.code===e)||ll[ul]}function gl(e){if(e.error.code===void 0)return{valid:!1,error:`Missing code for JSON-RPC error`};if(e.error.message===void 0)return{valid:!1,error:`Missing message for JSON-RPC error`};if(!pl(e.error.code))return{valid:!1,error:`Invalid error code type for JSON-RPC: ${e.error.code}`};if(fl(e.error.code)){let t=hl(e.error.code);if(t.message!==ll.SERVER_ERROR.message&&e.error.message===t.message)return{valid:!1,error:`Invalid error code message for JSON-RPC: ${e.error.code}`}}return{valid:!0}}function _l(e,t,n){return e.message.includes(`getaddrinfo ENOTFOUND`)||e.message.includes(`connect ECONNREFUSED`)?Error(`Unavailable ${n} RPC url at ${t}`):e}var vl=i({__assign:()=>Hl,__asyncDelegator:()=>Pl,__asyncGenerator:()=>Nl,__asyncValues:()=>Fl,__await:()=>Ml,__awaiter:()=>wl,__classPrivateFieldGet:()=>zl,__classPrivateFieldSet:()=>Bl,__createBinding:()=>El,__decorate:()=>xl,__exportStar:()=>Dl,__extends:()=>yl,__generator:()=>Tl,__importDefault:()=>Rl,__importStar:()=>Ll,__makeTemplateObject:()=>Il,__metadata:()=>Cl,__param:()=>Sl,__read:()=>kl,__rest:()=>bl,__spread:()=>Al,__spreadArrays:()=>jl,__values:()=>Ol});function yl(e,t){Vl(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}function bl(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols==`function`)for(var i=0,r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]]);return n}function xl(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a}function Sl(e,t){return function(n,r){t(n,r,e)}}function Cl(e,t){if(typeof Reflect==`object`&&typeof Reflect.metadata==`function`)return Reflect.metadata(e,t)}function wl(e,t,n,r){function i(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||=Promise)(function(n,a){function o(e){try{c(r.next(e))}catch(e){a(e)}}function s(e){try{c(r.throw(e))}catch(e){a(e)}}function c(e){e.done?n(e.value):i(e.value).then(o,s)}c((r=r.apply(e,t||[])).next())})}function Tl(e,t){var n={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},r,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol==`function`&&(o[Symbol.iterator]=function(){return this}),o;function s(e){return function(t){return c([e,t])}}function c(o){if(r)throw TypeError(`Generator is already executing.`);for(;n;)try{if(r=1,i&&(a=o[0]&2?i.return:o[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,o[1])).done)return a;switch(i=0,a&&(o=[o[0]&2,a.value]),o[0]){case 0:case 1:a=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,i=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if((a=n.trys,!(a=a.length>0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]<a[3])){n.label=o[1];break}if(o[0]===6&&n.label<a[1]){n.label=a[1],a=o;break}if(a&&n.label<a[2]){n.label=a[2],n.ops.push(o);break}a[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],i=0}finally{r=a=0}if(o[0]&5)throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}}function El(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]}function Dl(e,t){for(var n in e)n!==`default`&&!t.hasOwnProperty(n)&&(t[n]=e[n])}function Ol(e){var t=typeof Symbol==`function`&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&typeof e.length==`number`)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw TypeError(t?`Object is not iterable.`:`Symbol.iterator is not defined.`)}function kl(e,t){var n=typeof Symbol==`function`&&e[Symbol.iterator];if(!n)return e;var r=n.call(e),i,a=[],o;try{for(;(t===void 0||t-- >0)&&!(i=r.next()).done;)a.push(i.value)}catch(e){o={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(o)throw o.error}}return a}function Al(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(kl(arguments[t]));return e}function jl(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;for(var r=Array(e),i=0,t=0;t<n;t++)for(var a=arguments[t],o=0,s=a.length;o<s;o++,i++)r[i]=a[o];return r}function Ml(e){return this instanceof Ml?(this.v=e,this):new Ml(e)}function Nl(e,t,n){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var r=n.apply(e,t||[]),i,a=[];return i={},o(`next`),o(`throw`),o(`return`),i[Symbol.asyncIterator]=function(){return this},i;function o(e){r[e]&&(i[e]=function(t){return new Promise(function(n,r){a.push([e,t,n,r])>1||s(e,t)})})}function s(e,t){try{c(r[e](t))}catch(e){d(a[0][3],e)}}function c(e){e.value instanceof Ml?Promise.resolve(e.value.v).then(l,u):d(a[0][2],e)}function l(e){s(`next`,e)}function u(e){s(`throw`,e)}function d(e,t){e(t),a.shift(),a.length&&s(a[0][0],a[0][1])}}function Pl(e){var t,n;return t={},r(`next`),r(`throw`,function(e){throw e}),r(`return`),t[Symbol.iterator]=function(){return this},t;function r(r,i){t[r]=e[r]?function(t){return(n=!n)?{value:Ml(e[r](t)),done:r===`return`}:i?i(t):t}:i}}function Fl(e){if(!Symbol.asyncIterator)throw TypeError(`Symbol.asyncIterator is not defined.`);var t=e[Symbol.asyncIterator],n;return t?t.call(e):(e=typeof Ol==`function`?Ol(e):e[Symbol.iterator](),n={},r(`next`),r(`throw`),r(`return`),n[Symbol.asyncIterator]=function(){return this},n);function r(t){n[t]=e[t]&&function(n){return new Promise(function(r,a){n=e[t](n),i(r,a,n.done,n.value)})}}function i(e,t,n,r){Promise.resolve(r).then(function(t){e({value:t,done:n})},t)}}function Il(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function Ll(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t}function Rl(e){return e&&e.__esModule?e:{default:e}}function zl(e,t){if(!t.has(e))throw TypeError(`attempted to get private field on non-instance`);return t.get(e)}function Bl(e,t,n){if(!t.has(e))throw TypeError(`attempted to set private field on non-instance`);return t.set(e,n),n}var Vl,Hl,Ul=n((()=>{Vl=function(e,t){return Vl=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Vl(e,t)},Hl=function(){return Hl=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},Hl.apply(this,arguments)}})),Wl=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowserCryptoAvailable=e.getSubtleCrypto=e.getBrowerCrypto=void 0;function t(){return(global==null?void 0:global.crypto)||(global==null?void 0:global.msCrypto)||{}}e.getBrowerCrypto=t;function n(){let e=t();return e.subtle||e.webkitSubtle}e.getSubtleCrypto=n;function r(){return!!t()&&!!n()}e.isBrowserCryptoAvailable=r})),Gl=a((e=>{Object.defineProperty(e,"__esModule",{value:!0}),e.isBrowser=e.isNode=e.isReactNative=void 0;function t(){return typeof document>`u`&&typeof navigator<`u`&&navigator.product===`ReactNative`}e.isReactNative=t;function n(){return typeof process<`u`&&process.versions!==void 0&&process.versions.node!==void 0}e.isNode=n;function r(){return!t()&&!n()}e.isBrowser=r})),Kl=a((t=>{Object.defineProperty(t,"__esModule",{value:!0});var n=(Ul(),e(vl));n.__exportStar(Wl(),t),n.__exportStar(Gl(),t)})),ql=i({isNodeJs:()=>Yl}),Jl=Kl();t(ql,r(Kl()));var Yl=Jl.isNode;function Xl(e=3){return Date.now()*10**e+Math.floor(Math.random()*10**e)}function Zl(e=6){return BigInt(Xl(e))}function Ql(e,t,n){return{id:n||Xl(),jsonrpc:`2.0`,method:e,params:t}}function $l(e,t){return{id:e,jsonrpc:`2.0`,result:t}}function eu(e,t,n){return{id:e,jsonrpc:`2.0`,error:tu(t,n)}}function tu(e,t){return e===void 0?ml(al):(typeof e==`string`&&(e=Object.assign(Object.assign({},ml(ol)),{message:e})),t!==void 0&&(e.data=t),fl(e.code)&&(e=hl(e.code)),e)}function nu(e){return e.includes(`*`)?iu(e):!/\W/g.test(e)}function ru(e){return e===`*`}function iu(e){return ru(e)?!0:!(!e.includes(`*`)||e.split(`*`).length!==2||e.split(`*`).filter(e=>e.trim()===``).length!==1)}function au(e){return!ru(e)&&iu(e)&&!e.split(`*`)[0].trim()}function ou(e){return!ru(e)&&iu(e)&&!e.split(`*`)[1].trim()}var su=class{},cu=class extends su{constructor(e){super()}},lu=class extends su{constructor(){super()}},uu=class extends lu{constructor(e){super()}},du=`^https?:`,fu=`^wss?:`;function pu(e){let t=e.match(new RegExp(/^\w+:/,`gi`));if(!(!t||!t.length))return t[0]}function mu(e,t){let n=pu(e);return n===void 0?!1:new RegExp(t).test(n)}function hu(e){return mu(e,du)}function gu(e){return mu(e,fu)}function _u(e){return RegExp(`wss?://localhost(:d{2,5})?`).test(e)}function vu(e){return typeof e==`object`&&`id`in e&&`jsonrpc`in e&&e.jsonrpc===`2.0`}function yu(e){return vu(e)&&`method`in e}function bu(e){return vu(e)&&(xu(e)||Su(e))}function xu(e){return`result`in e}function Su(e){return`error`in e}function Cu(e){return`error`in e&&e.valid===!1}var wu=i({DEFAULT_ERROR:()=>ul,IBaseJsonRpcProvider:()=>lu,IEvents:()=>su,IJsonRpcConnection:()=>cu,IJsonRpcProvider:()=>uu,INTERNAL_ERROR:()=>al,INVALID_PARAMS:()=>il,INVALID_REQUEST:()=>nl,METHOD_NOT_FOUND:()=>rl,PARSE_ERROR:()=>tl,RESERVED_ERROR_CODES:()=>sl,SERVER_ERROR:()=>ol,SERVER_ERROR_CODE_RANGE:()=>cl,STANDARD_ERROR_MAP:()=>ll,formatErrorMessage:()=>tu,formatJsonRpcError:()=>eu,formatJsonRpcRequest:()=>Ql,formatJsonRpcResult:()=>$l,getBigIntRpcId:()=>Zl,getError:()=>ml,getErrorByCode:()=>hl,isHttpUrl:()=>hu,isJsonRpcError:()=>Su,isJsonRpcPayload:()=>vu,isJsonRpcRequest:()=>yu,isJsonRpcResponse:()=>bu,isJsonRpcResult:()=>xu,isJsonRpcValidationInvalid:()=>Cu,isLocalhostUrl:()=>_u,isNodeJs:()=>Yl,isReservedErrorCode:()=>fl,isServerErrorCode:()=>dl,isValidDefaultRoute:()=>ru,isValidErrorCode:()=>pl,isValidLeadingWildcardRoute:()=>au,isValidRoute:()=>nu,isValidTrailingWildcardRoute:()=>ou,isValidWildcardRoute:()=>iu,isWsUrl:()=>gu,parseConnectionError:()=>_l,payloadId:()=>Xl,validateJsonRpcError:()=>gl});t(wu,ql);var Tu=class extends uu{constructor(e){super(e),this.events=new ae.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict(Ql(e.method,e.params||[],e.id||Zl().toString()),t)}async requestStrict(e,t){return new Promise(async(n,r)=>{if(!this.connection.connected)try{await this.open()}catch(e){r(e)}this.events.on(`${e.id}`,e=>{Su(e)?r(e.error):n(e.result)});try{await this.connection.send(e,t)}catch(e){r(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit(`payload`,e),bu(e)?this.events.emit(`${e.id}`,e):this.events.emit(`message`,{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit(`error`,Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:``}`)),this.events.emit(`disconnect`)}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e==`string`&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit(`connect`))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||=(this.connection.on(`payload`,e=>this.onPayload(e)),this.connection.on(`close`,e=>this.onClose(e)),this.connection.on(`error`,e=>this.events.emit(`error`,e)),this.connection.on(`register_error`,e=>this.onClose()),!0)}},Eu=a(((e,t)=>{t.exports=function(){throw Error(`ws does not work in the browser. Browser clients must use the native WebSocket object`)}})),Du=()=>typeof WebSocket<`u`?WebSocket:typeof global<`u`&&typeof global.WebSocket<`u`?global.WebSocket:typeof window<`u`&&typeof window.WebSocket<`u`?window.WebSocket:typeof self<`u`&&typeof self.WebSocket<`u`?self.WebSocket:Eu(),Ou=()=>typeof WebSocket<`u`||typeof global<`u`&&typeof global.WebSocket<`u`||typeof window<`u`&&typeof window.WebSocket<`u`||typeof self<`u`&&typeof self.WebSocket<`u`,ku=e=>e.split(`?`)[0],Au=10,ju=Du(),Mu=class{constructor(e){if(this.url=e,this.events=new ae.EventEmitter,this.registering=!1,!gu(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<`u`}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>{if(typeof this.socket>`u`){t(Error(`Connection already closed`));return}this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()})}async send(e){typeof this.socket>`u`&&(this.socket=await this.register());try{this.socket.send(qe(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!gu(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount(`register_error`)>=e||this.events.listenerCount(`open`)>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once(`register_error`,e=>{this.resetMaxListeners(),t(e)}),this.events.once(`open`,()=>{if(this.resetMaxListeners(),typeof this.socket>`u`)return t(Error(`WebSocket connection is missing or invalid`));e(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,n)=>{let r=new ju(e,[],(0,wu.isReactNative)()?void 0:{rejectUnauthorized:!_u(e)});Ou()?r.onerror=e=>{let t=e;n(this.emitError(t.error))}:r.on(`error`,e=>{n(this.emitError(e))}),r.onopen=()=>{this.onOpen(r),t(r)}})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit(`open`)}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit(`close`,e)}onPayload(e){if(typeof e.data>`u`)return;let t=typeof e.data==`string`?Ke(e.data):e.data;this.events.emit(`payload`,t)}onError(e,t){let n=this.parseError(t),r=eu(e,n.message||n.toString());this.events.emit(`payload`,r)}parseError(e,t=this.url){return _l(e,ku(t),`WS`)}resetMaxListeners(){this.events.getMaxListeners()>Au&&this.events.setMaxListeners(Au)}emitError(e){let t=this.parseError(Error(e?.message||`WebSocket connection failed for host: ${ku(this.url)}`));return this.events.emit(`register_error`,t),t}},Nu=r(a(((e,t)=>{var n=typeof globalThis<`u`&&globalThis||typeof self<`u`&&self||typeof global<`u`&&global,r=(function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e})();(function(e){(function(t){var n=e!==void 0&&e||typeof self<`u`&&self||typeof global<`u`&&global||{},r={searchParams:`URLSearchParams`in n,iterable:`Symbol`in n&&`iterator`in Symbol,blob:`FileReader`in n&&`Blob`in n&&(function(){try{return new Blob,!0}catch{return!1}})(),formData:`FormData`in n,arrayBuffer:`ArrayBuffer`in n};function i(e){return e&&DataView.prototype.isPrototypeOf(e)}if(r.arrayBuffer)var a=[`[object Int8Array]`,`[object Uint8Array]`,`[object Uint8ClampedArray]`,`[object Int16Array]`,`[object Uint16Array]`,`[object Int32Array]`,`[object Uint32Array]`,`[object Float32Array]`,`[object Float64Array]`],o=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function s(e){if(typeof e!=`string`&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||e===``)throw TypeError(`Invalid character in header field name: "`+e+`"`);return e.toLowerCase()}function c(e){return typeof e!=`string`&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:t===void 0,value:t}}};return r.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){if(e.length!=2)throw TypeError(`Headers constructor: expected name/value pair to be length 2, found`+e.length);this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}u.prototype.append=function(e,t){e=s(e),t=c(t);var n=this.map[e];this.map[e]=n?n+`, `+t:t},u.prototype.delete=function(e){delete this.map[s(e)]},u.prototype.get=function(e){return e=s(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(s(e))},u.prototype.set=function(e,t){this.map[s(e)]=c(t)},u.prototype.forEach=function(e,t){for(var n in this.map)this.map.hasOwnProperty(n)&&e.call(t,this.map[n],n,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(t,n){e.push(n)}),l(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),l(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,n){e.push([n,t])}),l(e)},r.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);function d(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError(`Already read`));e.bodyUsed=!0}}function f(e){return new Promise(function(t,n){e.onload=function(){t(e.result)},e.onerror=function(){n(e.error)}})}function p(e){var t=new FileReader,n=f(t);return t.readAsArrayBuffer(e),n}function m(e){var t=new FileReader,n=f(t),r=/charset=([A-Za-z0-9_-]+)/.exec(e.type),i=r?r[1]:`utf-8`;return t.readAsText(e,i),n}function h(e){for(var t=new Uint8Array(e),n=Array(t.length),r=0;r<t.length;r++)n[r]=String.fromCharCode(t[r]);return n.join(``)}function g(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function _(){return this.bodyUsed=!1,this._initBody=function(e){this.bodyUsed=this.bodyUsed,this._bodyInit=e,e?typeof e==`string`?this._bodyText=e:r.blob&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:r.formData&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():r.arrayBuffer&&r.blob&&i(e)?(this._bodyArrayBuffer=g(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):r.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=g(e):this._bodyText=e=Object.prototype.toString.call(e):(this._noBody=!0,this._bodyText=``),this.headers.get(`content-type`)||(typeof e==`string`?this.headers.set(`content-type`,`text/plain;charset=UTF-8`):this._bodyBlob&&this._bodyBlob.type?this.headers.set(`content-type`,this._bodyBlob.type):r.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set(`content-type`,`application/x-www-form-urlencoded;charset=UTF-8`))},r.blob&&(this.blob=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw Error(`could not read FormData body as blob`);return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return d(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(r.blob)return this.blob().then(p);throw Error(`could not read as ArrayBuffer`)},this.text=function(){var e=d(this);if(e)return e;if(this._bodyBlob)return m(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(h(this._bodyArrayBuffer));if(this._bodyFormData)throw Error(`could not read FormData body as text`);return Promise.resolve(this._bodyText)},r.formData&&(this.formData=function(){return this.text().then(x)}),this.json=function(){return this.text().then(JSON.parse)},this}var v=[`CONNECT`,`DELETE`,`GET`,`HEAD`,`OPTIONS`,`PATCH`,`POST`,`PUT`,`TRACE`];function y(e){var t=e.toUpperCase();return v.indexOf(t)>-1?t:e}function b(e,t){if(!(this instanceof b))throw TypeError(`Please use the "new" operator, this DOM object constructor cannot be called as a function.`);t||={};var r=t.body;if(e instanceof b){if(e.bodyUsed)throw TypeError(`Already read`);this.url=e.url,this.credentials=e.credentials,t.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,!r&&e._bodyInit!=null&&(r=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=t.credentials||this.credentials||`same-origin`,(t.headers||!this.headers)&&(this.headers=new u(t.headers)),this.method=y(t.method||this.method||`GET`),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal||function(){if(`AbortController`in n)return new AbortController().signal}(),this.referrer=null,(this.method===`GET`||this.method===`HEAD`)&&r)throw TypeError(`Body not allowed for GET or HEAD requests`);if(this._initBody(r),(this.method===`GET`||this.method===`HEAD`)&&(t.cache===`no-store`||t.cache===`no-cache`)){var i=/([?&])_=[^&]*/;if(i.test(this.url))this.url=this.url.replace(i,`$1_=`+new Date().getTime());else{var a=/\?/;this.url+=(a.test(this.url)?`&`:`?`)+`_=`+new Date().getTime()}}}b.prototype.clone=function(){return new b(this,{body:this._bodyInit})};function x(e){var t=new FormData;return e.trim().split(`&`).forEach(function(e){if(e){var n=e.split(`=`),r=n.shift().replace(/\+/g,` `),i=n.join(`=`).replace(/\+/g,` `);t.append(decodeURIComponent(r),decodeURIComponent(i))}}),t}function S(e){var t=new u;return e.replace(/\r?\n[\t ]+/g,` `).split(`\r`).map(function(e){return e.indexOf(`
|
|
3
|
+
`)===0?e.substr(1,e.length):e}).forEach(function(e){var n=e.split(`:`),r=n.shift().trim();if(r){var i=n.join(`:`).trim();try{t.append(r,i)}catch(e){console.warn(`Response `+e.message)}}}),t}_.call(b.prototype);function C(e,t){if(!(this instanceof C))throw TypeError(`Please use the "new" operator, this DOM object constructor cannot be called as a function.`);if(t||={},this.type=`default`,this.status=t.status===void 0?200:t.status,this.status<200||this.status>599)throw RangeError(`Failed to construct 'Response': The status provided (0) is outside the range [200, 599].`);this.ok=this.status>=200&&this.status<300,this.statusText=t.statusText===void 0?``:``+t.statusText,this.headers=new u(t.headers),this.url=t.url||``,this._initBody(e)}_.call(C.prototype),C.prototype.clone=function(){return new C(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},C.error=function(){var e=new C(null,{status:200,statusText:``});return e.ok=!1,e.status=0,e.type=`error`,e};var w=[301,302,303,307,308];C.redirect=function(e,t){if(w.indexOf(t)===-1)throw RangeError(`Invalid status code`);return new C(null,{status:t,headers:{location:e}})},t.DOMException=n.DOMException;try{new t.DOMException}catch{t.DOMException=function(e,t){this.message=e,this.name=t;var n=Error(e);this.stack=n.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function T(e,i){return new Promise(function(a,o){var l=new b(e,i);if(l.signal&&l.signal.aborted)return o(new t.DOMException(`Aborted`,`AbortError`));var d=new XMLHttpRequest;function f(){d.abort()}d.onload=function(){var e={statusText:d.statusText,headers:S(d.getAllResponseHeaders()||``)};l.url.indexOf(`file://`)===0&&(d.status<200||d.status>599)?e.status=200:e.status=d.status,e.url=`responseURL`in d?d.responseURL:e.headers.get(`X-Request-URL`);var t=`response`in d?d.response:d.responseText;setTimeout(function(){a(new C(t,e))},0)},d.onerror=function(){setTimeout(function(){o(TypeError(`Network request failed`))},0)},d.ontimeout=function(){setTimeout(function(){o(TypeError(`Network request timed out`))},0)},d.onabort=function(){setTimeout(function(){o(new t.DOMException(`Aborted`,`AbortError`))},0)};function p(e){try{return e===``&&n.location.href?n.location.href:e}catch{return e}}if(d.open(l.method,p(l.url),!0),l.credentials===`include`?d.withCredentials=!0:l.credentials===`omit`&&(d.withCredentials=!1),`responseType`in d&&(r.blob?d.responseType=`blob`:r.arrayBuffer&&(d.responseType=`arraybuffer`)),i&&typeof i.headers==`object`&&!(i.headers instanceof u||n.Headers&&i.headers instanceof n.Headers)){var m=[];Object.getOwnPropertyNames(i.headers).forEach(function(e){m.push(s(e)),d.setRequestHeader(e,c(i.headers[e]))}),l.headers.forEach(function(e,t){m.indexOf(t)===-1&&d.setRequestHeader(t,e)})}else l.headers.forEach(function(e,t){d.setRequestHeader(t,e)});l.signal&&(l.signal.addEventListener(`abort`,f),d.onreadystatechange=function(){d.readyState===4&&l.signal.removeEventListener(`abort`,f)}),d.send(l._bodyInit===void 0?null:l._bodyInit)})}return T.polyfill=!0,n.fetch||(n.fetch=T,n.Headers=u,n.Request=b,n.Response=C),t.Headers=u,t.Request=b,t.Response=C,t.fetch=T,Object.defineProperty(t,"__esModule",{value:!0}),t})({})})(r),r.fetch.ponyfill=!0,delete r.fetch.polyfill;var i=n.fetch?n:r;e=i.fetch,e.default=i.fetch,e.fetch=i.fetch,e.Headers=i.Headers,e.Request=i.Request,e.Response=i.Response,t.exports=e}))()),Pu=Object.defineProperty,Fu=Object.defineProperties,Iu=Object.getOwnPropertyDescriptors,Lu=Object.getOwnPropertySymbols,Ru=Object.prototype.hasOwnProperty,zu=Object.prototype.propertyIsEnumerable,Bu=(e,t,n)=>t in e?Pu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Vu=(e,t)=>{for(var n in t||={})Ru.call(t,n)&&Bu(e,n,t[n]);if(Lu)for(var n of Lu(t))zu.call(t,n)&&Bu(e,n,t[n]);return e},Hu=(e,t)=>Fu(e,Iu(t)),Uu={headers:{Accept:`application/json`,"Content-Type":`application/json`},method:`POST`},Wu=10,Gu=class{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new ae.EventEmitter,this.isAvailable=!1,this.registering=!1,!hu(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw Error(`Connection already closed`);this.onClose()}async send(e){this.isAvailable||await this.register();try{let t=qe(e),n=await(await(0,Nu.default)(this.url,Hu(Vu({},Uu),{body:t}))).json();this.onPayload({data:n})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!hu(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount(`register_error`)>=e||this.events.listenerCount(`open`)>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once(`register_error`,e=>{this.resetMaxListeners(),t(e)}),this.events.once(`open`,()=>{if(this.resetMaxListeners(),typeof this.isAvailable>`u`)return t(Error(`HTTP connection is missing or invalid`));e()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){let t=qe({id:1,jsonrpc:`2.0`,method:`test`,params:[]});await(0,Nu.default)(e,Hu(Vu({},Uu),{body:t}))}this.onOpen()}catch(e){let t=this.parseError(e);throw this.events.emit(`register_error`,t),this.onClose(),t}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit(`open`)}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit(`close`)}onPayload(e){if(typeof e.data>`u`)return;let t=typeof e.data==`string`?Ke(e.data):e.data;this.events.emit(`payload`,t)}onError(e,t){let n=this.parseError(t),r=eu(e,n.message||n.toString());this.events.emit(`payload`,r)}parseError(e,t=this.url){return _l(e,t,`HTTP`)}resetMaxListeners(){this.events.getMaxListeners()>Wu&&this.events.setMaxListeners(Wu)}},Ku=Object.defineProperty,qu=(e,t,n)=>t in e?Ku(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ju=(e,t,n)=>qu(e,typeof t==`symbol`?t:t+``,n),Yu=class extends B{constructor(e){super(),this.opts=e,Ju(this,`protocol`,`wc`),Ju(this,`version`,2)}},Xu=Object.defineProperty,Zu=(e,t,n)=>t in e?Xu(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qu=(e,t,n)=>Zu(e,typeof t==`symbol`?t:t+``,n),$u=class extends B{constructor(e,t){super(),this.core=e,this.logger=t,Qu(this,`records`,new Map)}},ed=class{constructor(e,t){this.logger=e,this.core=t}},td=class extends B{constructor(e,t){super(),this.relayer=e,this.logger=t}},nd=class extends B{constructor(e){super()}},rd=class{constructor(e,t,n,r){this.core=e,this.logger=t,this.name=n}},id=class extends B{constructor(e,t){super(),this.relayer=e,this.logger=t}},ad=class extends B{constructor(e,t){super(),this.core=e,this.logger=t}},od=class{constructor(e,t,n){this.core=e,this.logger=t,this.store=n}},sd=class{constructor(e,t){this.projectId=e,this.logger=t}},cd=class{constructor(e,t,n){this.core=e,this.logger=t,this.telemetryEnabled=n}};function ld(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function ud(e){return ld(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var dd=`2.23.2`,fd={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${dd}`},pd=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=fd.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...fd.version?[`Version: ${fd.version}`]:[]].join(`
|
|
4
|
+
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=dd}walk(e){return md(this,e)}};function md(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?md(e.cause,t):t?null:e}var hd=class extends pd{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function gd(e,{dir:t,size:n=32}={}){return typeof e==`string`?_d(e,{dir:t,size:n}):vd(e,{dir:t,size:n})}function _d(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new hd({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function vd(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new hd({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var yd=class extends pd{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},bd=class extends pd{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function xd(e,{size:t}){if(ud(e)>t)throw new bd({givenSize:ud(e),maxSize:t})}function Sd(e,t={}){let{signed:n}=t;t.size&&xd(e,{size:t.size});let r=BigInt(e);if(!n)return r;let i=(e.length-2)/2;return r<=(1n<<BigInt(i)*8n-1n)-1n?r:r-BigInt(`0x${`f`.padStart(i*2,`f`)}`)-1n}function Cd(e,t={}){return Number(Sd(e,t))}var wd=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function Td(e,t={}){return typeof e==`number`||typeof e==`bigint`?Od(e,t):typeof e==`string`?Ad(e,t):typeof e==`boolean`?Ed(e,t):Dd(e,t)}function Ed(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(xd(n,{size:t.size}),gd(n,{size:t.size})):n}function Dd(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=wd[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(xd(r,{size:t.size}),gd(r,{dir:`right`,size:t.size})):r}function Od(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new yd({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?gd(s,{size:r}):s}var kd=new TextEncoder;function Ad(e,t={}){return Dd(kd.encode(e),t)}var jd=new TextEncoder;function Md(e,t={}){return typeof e==`number`||typeof e==`bigint`?Ld(e,t):typeof e==`boolean`?Nd(e,t):ld(e)?Id(e,t):Rd(e,t)}function Nd(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(xd(n,{size:t.size}),gd(n,{size:t.size})):n}var Pd={zero:48,nine:57,A:65,F:70,a:97,f:102};function Fd(e){if(e>=Pd.zero&&e<=Pd.nine)return e-Pd.zero;if(e>=Pd.A&&e<=Pd.F)return e-(Pd.A-10);if(e>=Pd.a&&e<=Pd.f)return e-(Pd.a-10)}function Id(e,t={}){let n=e;t.size&&(xd(n,{size:t.size}),n=gd(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=Fd(r.charCodeAt(t++)),i=Fd(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new pd(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function Ld(e,t){return Id(Od(e,t))}function Rd(e,t={}){let n=jd.encode(e);return typeof t.size==`number`?(xd(n,{size:t.size}),gd(n,{dir:`right`,size:t.size})):n}function zd(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function Bd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Vd(e,...t){if(!Bd(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function Hd(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.wrapConstructor`);zd(e.outputLen),zd(e.blockLen)}function Ud(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function Wd(e,t){Vd(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}var Gd=BigInt(2**32-1),Kd=BigInt(32);function qd(e,t=!1){return t?{h:Number(e&Gd),l:Number(e>>Kd&Gd)}:{h:Number(e>>Kd&Gd)|0,l:Number(e&Gd)|0}}function Jd(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:a,l:o}=qd(e[i],t);[n[i],r[i]]=[a,o]}return[n,r]}var Yd=(e,t,n)=>e<<n|t>>>32-n,Xd=(e,t,n)=>t<<n|e>>>32-n,Zd=(e,t,n)=>t<<n-32|e>>>64-n,Qd=(e,t,n)=>e<<n-32|t>>>64-n,$d=typeof globalThis==`object`&&`crypto`in globalThis?globalThis.crypto:void 0;function ef(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function tf(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function nf(e,t){return e<<32-t|e>>>t}var rf=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function af(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function of(e){for(let t=0;t<e.length;t++)e[t]=af(e[t])}function sf(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got `+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function cf(e){return typeof e==`string`&&(e=sf(e)),Vd(e),e}function lf(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];Vd(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}var uf=class{clone(){return this._cloneInto()}};function df(e){let t=t=>e().update(cf(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function ff(e=32){if($d&&typeof $d.getRandomValues==`function`)return $d.getRandomValues(new Uint8Array(e));if($d&&typeof $d.randomBytes==`function`)return $d.randomBytes(e);throw Error(`crypto.getRandomValues must be defined`)}var pf=[],mf=[],hf=[],gf=BigInt(0),_f=BigInt(1),vf=BigInt(2),yf=BigInt(7),bf=BigInt(256),xf=BigInt(113);for(let e=0,t=_f,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],pf.push(2*(5*r+n)),mf.push((e+1)*(e+2)/2%64);let i=gf;for(let e=0;e<7;e++)t=(t<<_f^(t>>yf)*xf)%bf,t&vf&&(i^=_f<<(_f<<BigInt(e))-_f);hf.push(i)}var[Sf,Cf]=Jd(hf,!0),wf=(e,t,n)=>n>32?Zd(e,t,n):Yd(e,t,n),Tf=(e,t,n)=>n>32?Qd(e,t,n):Xd(e,t,n);function Ef(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=wf(a,o,1)^n[r],c=Tf(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=mf[n],a=wf(t,i,r),o=Tf(t,i,r),s=pf[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=Sf[r],e[1]^=Cf[r]}n.fill(0)}var Df=class e extends uf{constructor(e,t,n,r=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,zd(n),0>=this.blockLen||this.blockLen>=200)throw Error(`Sha3 supports only keccak-f1600 function`);this.state=new Uint8Array(200),this.state32=ef(this.state)}keccak(){rf||of(this.state32),Ef(this.state32,this.rounds),rf||of(this.state32),this.posOut=0,this.pos=0}update(e){Ud(this);let{blockLen:t,state:n}=this;e=cf(e);let r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Ud(this,!1),Vd(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return zd(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Wd(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}},Of=((e,t,n)=>df(()=>new Df(t,e,n)))(1,136,256/8);function kf(e,t){let n=t||`hex`,r=Of(ld(e,{strict:!1})?Md(e):e);return n===`bytes`?r:Td(r)}var Af=new class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&t!==void 0&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}(8192);function jf(e,t){if(Af.has(`${e}.${t}`))return Af.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=kf(Rd(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return Af.set(`${e}.${t}`,a),a}function Mf(e){return jf(`0x${kf(`0x${e.substring(4)}`).substring(26)}`)}async function Nf({hash:e,signature:t}){let n=ld(e)?e:Td(e),{secp256k1:r}=await o(async()=>{let{secp256k1:e}=await import(`./secp256k1-xksC0Kmy.js`);return{secp256k1:e}},__vite__mapDeps([0,1]));return`0x${(()=>{if(typeof t==`object`&&`r`in t&&`s`in t){let{r:e,s:n,v:i,yParity:a}=t,o=Pf(Number(a??i));return new r.Signature(Sd(e),Sd(n)).addRecoveryBit(o)}let e=ld(t)?t:Td(t),n=Pf(Cd(`0x${e.slice(130)}`));return r.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(n)})().recoverPublicKey(n.substring(2)).toHex(!1)}`}function Pf(e){if(e===0||e===1)return e;if(e===27)return 0;if(e===28)return 1;throw Error(`Invalid yParityOrV value`)}async function Ff({hash:e,signature:t}){return Mf(await Nf({hash:e,signature:t}))}var If=`:`;function Lf(e){let[t,n]=e.split(If);return{namespace:t,reference:n}}function Rf(e){let[t,n,r]=e.split(If);return{namespace:t,reference:n,address:r}}function zf(e,t){return e.includes(`:`)?[e]:t.chains||[]}var Bf={reactNative:`react-native`,node:`node`,browser:`browser`,unknown:`unknown`};function Vf(){return typeof process<`u`&&typeof process.versions<`u`&&typeof process.versions.node<`u`}function Hf(){return!(0,po.getDocument)()&&!!(0,po.getNavigator)()&&navigator.product===`ReactNative`}function Uf(){return Hf()&&typeof global<`u`&&typeof(global==null?void 0:global.Platform)<`u`&&(global==null?void 0:global.Platform.OS)===`android`}function Wf(){return Hf()&&typeof global<`u`&&typeof(global==null?void 0:global.Platform)<`u`&&(global==null?void 0:global.Platform.OS)===`ios`}function Gf(){return!Vf()&&!!(0,po.getNavigator)()&&!!(0,po.getDocument)()}function Kf(){return Hf()?Bf.reactNative:Vf()?Bf.node:Gf()?Bf.browser:Bf.unknown}function qf(){try{return Hf()&&typeof global<`u`&&typeof(global==null?void 0:global.Application)<`u`?global.Application?.applicationId:void 0}catch{return}}function Jf(e,t){let n=new URLSearchParams(e);for(let e of Object.keys(t).sort())if(t.hasOwnProperty(e)){let r=t[e];r!==void 0&&n.set(e,r)}return n.toString()}function Yf(){return(0,mo.getWindowMetadata)()||{name:``,description:``,url:``,icons:[``]}}function Xf(){if(Kf()===Bf.reactNative&&typeof global<`u`&&typeof(global==null?void 0:global.Platform)<`u`){let{OS:e,Version:t}=global.Platform;return[e,t].join(`-`)}let e=io();if(e===null)return`unknown`;let t=e.os?e.os.replace(` `,``).toLowerCase():`unknown`;return e.type===`browser`?[t,e.name,e.version].join(`-`):[t,e.version].join(`-`)}function Zf(){let e=Kf();return e===Bf.browser?[e,(0,po.getLocation)()?.host||`unknown`].join(`:`):e}function Qf(e,t,n){let r=Xf(),i=Zf();return[[e,t].join(`-`),[`js`,n].join(`-`),r,i].join(`/`)}function $f({protocol:e,version:t,relayUrl:n,sdkVersion:r,auth:i,projectId:a,useOnCloseEvent:o,bundleId:s,packageName:c}){let l=n.split(`?`),u={auth:i,ua:Qf(e,t,r),projectId:a,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:s||void 0},d=Jf(l[1]||``,u);return l[0]+`?`+d}function ep(e,t){return e.filter(e=>t.includes(e)).length===e.length}function tp(e){return Object.fromEntries(e.entries())}function np(e){return new Map(Object.entries(e))}function rp(e=V.FIVE_MINUTES,t){let n=(0,V.toMiliseconds)(e||V.FIVE_MINUTES),r,i,a,o;return{resolve:e=>{a&&r&&(clearTimeout(a),r(e),o=Promise.resolve(e))},reject:e=>{a&&i&&(clearTimeout(a),i(e))},done:()=>new Promise((e,s)=>{if(o)return e(o);a=setTimeout(()=>{let e=Error(t);o=Promise.reject(e),s(e)},n),r=e,i=s})}}function ip(e,t,n){return new Promise(async(r,i)=>{let a=setTimeout(()=>i(Error(n)),t);try{r(await e)}catch(e){i(e)}clearTimeout(a)})}function ap(e,t){if(typeof t==`string`&&t.startsWith(`${e}:`))return t;if(e.toLowerCase()===`topic`){if(typeof t!=`string`)throw Error(`Value must be "string" for expirer target type: topic`);return`topic:${t}`}else if(e.toLowerCase()===`id`){if(typeof t!=`number`)throw Error(`Value must be "number" for expirer target type: id`);return`id:${t}`}throw Error(`Unknown expirer target type: ${e}`)}function op(e){return ap(`topic`,e)}function sp(e){return ap(`id`,e)}function cp(e){let[t,n]=e.split(`:`),r={id:void 0,topic:void 0};if(t===`topic`&&typeof n==`string`)r.topic=n;else if(t===`id`&&Number.isInteger(Number(n)))r.id=Number(n);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${n}`);return r}function lp(e,t){return(0,V.fromMiliseconds)((t||Date.now())+(0,V.toMiliseconds)(e))}function up(e){return Date.now()>=(0,V.toMiliseconds)(e)}function K(e,t){return`${e}${t?`:${t}`:``}`}function dp(e=[],t=[]){return[...new Set([...e,...t])]}async function fp({id:e,topic:t,wcDeepLink:n}){var r;try{if(!n)return;let i=(typeof n==`string`?JSON.parse(n):n)?.href;if(typeof i!=`string`)return;let a=pp(i,e,t),o=Kf();if(o===Bf.browser){if(!((r=(0,po.getDocument)())!=null&&r.hasFocus())){console.warn(`Document does not have focus, skipping deeplink.`);return}mp(a)}else o===Bf.reactNative&&typeof(global==null?void 0:global.Linking)<`u`&&await global.Linking.openURL(a)}catch(e){console.error(e)}}function pp(e,t,n){let r=`requestId=${t}&sessionTopic=${n}`;e.endsWith(`/`)&&(e=e.slice(0,-1));let i=`${e}`;if(e.startsWith(`https://t.me`)){let t=e.includes(`?`)?`&startapp=`:`?startapp=`;i=`${i}${t}${xp(r,!0)}`}else i=`${i}/wc?${r}`;return i}function mp(e){let t=`_self`;bp()?t=`_top`:(yp()||e.startsWith(`https://`)||e.startsWith(`http://`))&&(t=`_blank`),window.open(e,t,`noreferrer noopener`)}async function hp(e,t){let n=``;try{if(Gf()&&(n=localStorage.getItem(t),n))return n;n=await e.getItem(t)}catch(e){console.error(e)}return n}function gp(e,t){if(!e.includes(t))return null;let n=e.split(/([&,?,=])/);return n[n.indexOf(t)+2]}function _p(){return typeof crypto<`u`&&crypto!=null&&crypto.randomUUID?crypto.randomUUID():`xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx`.replace(/[xy]/gu,e=>{let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function vp(){return typeof process<`u`&&{}.IS_VITEST===`true`}function yp(){return typeof window<`u`&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}function bp(){try{return window.self!==window.top}catch{return!1}}function xp(e,t=!1){let n=Buffer.from(e).toString(`base64`);return t?n.replace(/[=]/g,``):n}function Sp(e){return Buffer.from(e,`base64`).toString(`utf-8`)}function Cp(e){return new Promise(t=>setTimeout(t,e))}function wp(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function Tp(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Ep(e,...t){if(!Tp(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function Dp(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.wrapConstructor`);wp(e.outputLen),wp(e.blockLen)}function Op(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function kp(e,t){Ep(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}var Ap=BigInt(2**32-1),jp=BigInt(32);function Mp(e,t=!1){return t?{h:Number(e&Ap),l:Number(e>>jp&Ap)}:{h:Number(e>>jp&Ap)|0,l:Number(e&Ap)|0}}function Np(e,t=!1){let n=new Uint32Array(e.length),r=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:a,l:o}=Mp(e[i],t);[n[i],r[i]]=[a,o]}return[n,r]}var Pp=(e,t,n)=>e<<n|t>>>32-n,Fp=(e,t,n)=>t<<n|e>>>32-n,Ip=(e,t,n)=>t<<n-32|e>>>64-n,Lp=(e,t,n)=>e<<n-32|t>>>64-n,Rp=typeof globalThis==`object`&&`crypto`in globalThis?globalThis.crypto:void 0;function zp(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Bp(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Vp(e,t){return e<<32-t|e>>>t}var Hp=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Up(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Wp(e){for(let t=0;t<e.length;t++)e[t]=Up(e[t])}function Gp(e){if(typeof e!=`string`)throw Error(`utf8ToBytes expected string, got `+typeof e);return new Uint8Array(new TextEncoder().encode(e))}function Kp(e){return typeof e==`string`&&(e=Gp(e)),Ep(e),e}var qp=class{clone(){return this._cloneInto()}};function Jp(e){let t=t=>e().update(Kp(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function Yp(e=32){if(Rp&&typeof Rp.getRandomValues==`function`)return Rp.getRandomValues(new Uint8Array(e));if(Rp&&typeof Rp.randomBytes==`function`)return Rp.randomBytes(e);throw Error(`crypto.getRandomValues must be defined`)}var Xp=[],Zp=[],Qp=[],$p=BigInt(0),em=BigInt(1),tm=BigInt(2),nm=BigInt(7),rm=BigInt(256),im=BigInt(113);for(let e=0,t=em,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],Xp.push(2*(5*r+n)),Zp.push((e+1)*(e+2)/2%64);let i=$p;for(let e=0;e<7;e++)t=(t<<em^(t>>nm)*im)%rm,t&tm&&(i^=em<<(em<<BigInt(e))-em);Qp.push(i)}var[am,om]=Np(Qp,!0),sm=(e,t,n)=>n>32?Ip(e,t,n):Pp(e,t,n),cm=(e,t,n)=>n>32?Lp(e,t,n):Fp(e,t,n);function lm(e,t=24){let n=new Uint32Array(10);for(let r=24-t;r<24;r++){for(let t=0;t<10;t++)n[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let r=(t+8)%10,i=(t+2)%10,a=n[i],o=n[i+1],s=sm(a,o,1)^n[r],c=cm(a,o,1)^n[r+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=Zp[n],a=sm(t,i,r),o=cm(t,i,r),s=Xp[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let r=0;r<10;r++)n[r]=e[t+r];for(let r=0;r<10;r++)e[t+r]^=~n[(r+2)%10]&n[(r+4)%10]}e[0]^=am[r],e[1]^=om[r]}n.fill(0)}var um=class e extends qp{constructor(e,t,n,r=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,wp(n),0>=this.blockLen||this.blockLen>=200)throw Error(`Sha3 supports only keccak-f1600 function`);this.state=new Uint8Array(200),this.state32=zp(this.state)}keccak(){Hp||Wp(this.state32),lm(this.state32,this.rounds),Hp||Wp(this.state32),this.posOut=0,this.pos=0}update(e){Op(this);let{blockLen:t,state:n}=this;e=Kp(e);let r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){Op(this,!1),Ep(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return wp(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(kp(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){let{blockLen:n,suffix:r,outputLen:i,rounds:a,enableXOF:o}=this;return t||=new e(n,r,i,o,a),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=a,t.suffix=r,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}},dm=((e,t,n)=>Jp(()=>new um(t,e,n)))(1,136,256/8),fm=`https://rpc.walletconnect.org/v1`;function pm(e){let t=`Ethereum Signed Message:
|
|
5
|
+
${e.length}`,n=new TextEncoder().encode(t+e);return`0x`+Buffer.from(dm(n)).toString(`hex`)}async function mm(e,t,n,r,i,a){switch(n.t){case`eip191`:return await hm(e,t,n.s);case`eip1271`:return await gm(e,t,n.s,r,i,a);default:throw Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}async function hm(e,t,n){return(await Ff({hash:pm(t),signature:n})).toLowerCase()===e.toLowerCase()}async function gm(e,t,n,r,i,a){let o=Lf(r);if(!o.namespace||!o.reference)throw Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{let o=n.substring(2),s=`0x1626ba7e`+pm(t).substring(2)+`00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041`+o,{result:c}=await(await fetch(`${a||fm}/?chainId=${r}&projectId=${i}`,{method:`POST`,body:JSON.stringify({id:_m(),jsonrpc:`2.0`,method:`eth_call`,params:[{to:e,data:s},`latest`]})})).json();return c?c.slice(0,10).toLowerCase()===`0x1626ba7e`:!1}catch(e){return console.error(`isValidEip1271Signature: `,e),!1}}function _m(){return Date.now()+Math.floor(Math.random()*1e3)}var vm=Object.defineProperty,ym=Object.defineProperties,bm=Object.getOwnPropertyDescriptors,xm=Object.getOwnPropertySymbols,Sm=Object.prototype.hasOwnProperty,Cm=Object.prototype.propertyIsEnumerable,wm=(e,t,n)=>t in e?vm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Tm=(e,t)=>{for(var n in t||={})Sm.call(t,n)&&wm(e,n,t[n]);if(xm)for(var n of xm(t))Cm.call(t,n)&&wm(e,n,t[n]);return e},Em=(e,t)=>ym(e,bm(t)),Dm=`did:pkh:`,Om=e=>e?.split(`:`),km=e=>{let t=e&&Om(e);if(t)return e.includes(Dm)?t[3]:t[1]},Am=e=>{let t=e&&Om(e);if(t)return t[2]+`:`+t[3]},jm=e=>{let t=e&&Om(e);if(t)return t.pop()};async function Mm(e){let{cacao:t,projectId:n}=e,{s:r,p:i}=t,a=Nm(i,i.iss);return await mm(jm(i.iss),a,r,Am(i.iss),n)}var Nm=(e,t)=>{let n=`${e.domain} wants you to sign in with your Ethereum account:`,r=jm(t);if(!e.aud&&!e.uri)throw Error("Either `aud` or `uri` is required to construct the message");let i=e.statement||void 0,a=`URI: ${e.aud||e.uri}`,o=`Version: ${e.version}`,s=`Chain ID: ${km(t)}`,c=`Nonce: ${e.nonce}`,l=`Issued At: ${e.iat}`,u=e.exp?`Expiration Time: ${e.exp}`:void 0,d=e.nbf?`Not Before: ${e.nbf}`:void 0,f=e.requestId?`Request ID: ${e.requestId}`:void 0,p=e.resources?`Resources:${e.resources.map(e=>`
|
|
6
|
+
- ${e}`).join(``)}`:void 0,m=Jm(e.resources);if(m){let e=Bm(m);i=Gm(i,e)}return[n,r,``,i,``,a,o,s,c,l,u,d,f,p].filter(e=>e!=null).join(`
|
|
7
|
+
`)};function Pm(e){return Buffer.from(JSON.stringify(e)).toString(`base64`)}function Fm(e){return JSON.parse(Buffer.from(e,`base64`).toString(`utf-8`))}function Im(e){if(!e)throw Error(`No recap provided, value is undefined`);if(!e.att)throw Error("No `att` property found");let t=Object.keys(e.att);if(!(t!=null&&t.length))throw Error("No resources found in `att` property");t.forEach(t=>{let n=e.att[t];if(Array.isArray(n)||typeof n!=`object`)throw Error(`Resource must be an object: ${t}`);if(!Object.keys(n).length)throw Error(`Resource object is empty: ${t}`);Object.keys(n).forEach(e=>{let t=n[e];if(!Array.isArray(t))throw Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach(t=>{if(typeof t!=`object`)throw Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)})})})}function Lm(e,t,n,r={}){return n?.sort((e,t)=>e.localeCompare(t)),{att:{[e]:Rm(t,n,r)}}}function Rm(e,t,n={}){t=t?.sort((e,t)=>e.localeCompare(t));let r=t.map(t=>({[`${e}/${t}`]:[n]}));return Object.assign({},...r)}function zm(e){return Im(e),`urn:recap:${Pm(e).replace(/=/g,``)}`}function Bm(e){let t=Fm(e.replace(`urn:recap:`,``));return Im(t),t}function Vm(e,t,n){return zm(Lm(e,t,n))}function Hm(e){return e&&e.includes(`urn:recap:`)}function Um(e,t){return zm(Wm(Bm(e),Bm(t)))}function Wm(e,t){Im(e),Im(t);let n=Object.keys(e.att).concat(Object.keys(t.att)).sort((e,t)=>e.localeCompare(t)),r={att:{}};return n.forEach(n=>{Object.keys(e.att?.[n]||{}).concat(Object.keys(t.att?.[n]||{})).sort((e,t)=>e.localeCompare(t)).forEach(i=>{r.att[n]=Em(Tm({},r.att[n]),{[i]:e.att[n]?.[i]||t.att[n]?.[i]})})}),r}function Gm(e=``,t){Im(t);let n=`I further authorize the stated URI to perform the following actions on my behalf: `;if(e.includes(n))return e;let r=[],i=0;Object.keys(t.att).forEach(e=>{let n=Object.keys(t.att[e]).map(e=>({ability:e.split(`/`)[0],action:e.split(`/`)[1]}));n.sort((e,t)=>e.action.localeCompare(t.action));let a={};n.forEach(e=>{a[e.ability]||(a[e.ability]=[]),a[e.ability].push(e.action)});let o=Object.keys(a).map(t=>(i++,`(${i}) '${t}': '${a[t].join(`', '`)}' for '${e}'.`));r.push(o.join(`, `).replace(`.,`,`.`))});let a=`${n}${r.join(` `)}`;return`${e?e+` `:``}${a}`}function Km(e){let t=Bm(e);Im(t);let n=t.att?.eip155;return n?Object.keys(n).map(e=>e.split(`/`)[1]):[]}function qm(e){let t=Bm(e);Im(t);let n=[];return Object.values(t.att).forEach(e=>{Object.values(e).forEach(e=>{var t;(t=e?.[0])!=null&&t.chains&&n.push(e[0].chains)})}),[...new Set(n.flat())]}function Jm(e){if(!e)return;let t=e?.[e.length-1];return Hm(t)?t:void 0}function Ym(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function Xm(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function Zm(e,...t){if(!Xm(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function Qm(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function $m(e,t){Zm(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function eh(e){if(typeof e!=`boolean`)throw Error(`boolean expected, not ${e}`)}var th=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),nh=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(new Uint8Array(new Uint32Array([287454020]).buffer)[0]!==68)throw Error(`Non little-endian hardware is not supported`);function rh(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function ih(e){if(typeof e==`string`)e=rh(e);else if(Xm(e))e=dh(e);else throw Error(`Uint8Array expected, got `+typeof e);return e}function ah(e,t){if(typeof t!=`object`||!t)throw Error(`options must be defined`);return Object.assign(e,t)}function oh(e,t){if(e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}var sh=(e,t)=>{function n(n,...r){if(Zm(n),e.nonceLength!==void 0){let t=r[0];if(!t)throw Error(`nonce / iv required`);e.varSizeNonce?Zm(t):Zm(t,e.nonceLength)}let i=e.tagLength;i&&r[1]!==void 0&&Zm(r[1]);let a=t(n,...r),o=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);Zm(t)}},s=!1;return{encrypt(e,t){if(s)throw Error(`cannot encrypt() twice with same key + nonce`);return s=!0,Zm(e),o(a.encrypt.length,t),a.encrypt(e,t)},decrypt(e,t){if(Zm(e),i&&e.length<i)throw Error(`invalid ciphertext length: smaller than tagLength=`+i);return o(a.decrypt.length,t),a.decrypt(e,t)}}}return Object.assign(n,e),n};function ch(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(t.length!==e)throw Error(`invalid output length, expected `+e+`, got: `+t.length);if(n&&!uh(t))throw Error(`invalid output, must be aligned`);return t}function lh(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function uh(e){return e.byteOffset%4==0}function dh(e){return Uint8Array.from(e)}function fh(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}var ph=e=>Uint8Array.from(e.split(``).map(e=>e.charCodeAt(0))),mh=ph(`expand 16-byte k`),hh=ph(`expand 32-byte k`),gh=th(mh),_h=th(hh);function q(e,t){return e<<t|e>>>32-t}function vh(e){return e.byteOffset%4==0}var yh=64,bh=16,xh=2**32-1,Sh=new Uint32Array;function Ch(e,t,n,r,i,a,o,s){let c=i.length,l=new Uint8Array(yh),u=th(l),d=vh(i)&&vh(a),f=d?th(i):Sh,p=d?th(a):Sh;for(let m=0;m<c;o++){if(e(t,n,r,u,o,s),o>=xh)throw Error(`arx: counter overflow`);let h=Math.min(yh,c-m);if(d&&h===yh){let e=m/4;if(m%4!=0)throw Error(`arx: invalid block position`);for(let t=0,n;t<bh;t++)n=e+t,p[n]=f[n]^u[t];m+=yh;continue}for(let e=0,t;e<h;e++)t=m+e,a[t]=i[t]^l[e];m+=h}}function wh(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:a,rounds:o}=ah({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!=`function`)throw Error(`core must be a function`);return Ym(i),Ym(o),eh(a),eh(n),(t,s,c,l,u=0)=>{Zm(t),Zm(s),Zm(c);let d=c.length;if(l===void 0&&(l=new Uint8Array(d)),Zm(l),Ym(u),u<0||u>=xh)throw Error(`arx: counter overflow`);if(l.length<d)throw Error(`arx: output (${l.length}) is shorter than data (${d})`);let f=[],p=t.length,m,h;if(p===32)f.push(m=dh(t)),h=_h;else if(p===16&&n)m=new Uint8Array(32),m.set(t),m.set(t,16),h=gh,f.push(m);else throw Error(`arx: invalid 32-byte key, got length=${p}`);vh(s)||f.push(s=dh(s));let g=th(m);if(r){if(s.length!==24)throw Error(`arx: extended nonce must be 24 bytes`);r(h,g,th(s.subarray(0,16)),g),s=s.subarray(16)}let _=16-i;if(_!==s.length)throw Error(`arx: nonce must be ${_} or 16 bytes`);if(_!==12){let e=new Uint8Array(12);e.set(s,a?0:12-s.length),s=e,f.push(s)}let v=th(s);return Ch(e,h,g,v,c,l,u,o),fh(...f),l}}var Th=(e,t)=>e[t++]&255|(e[t++]&255)<<8,Eh=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=ih(e),Zm(e,32);let t=Th(e,0),n=Th(e,2),r=Th(e,4),i=Th(e,6),a=Th(e,8),o=Th(e,10),s=Th(e,12),c=Th(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|n<<3)&8191,this.r[2]=(n>>>10|r<<6)&7939,this.r[3]=(r>>>7|i<<9)&8191,this.r[4]=(i>>>4|a<<12)&255,this.r[5]=a>>>1&8190,this.r[6]=(a>>>14|o<<2)&8191,this.r[7]=(o>>>11|s<<5)&8065,this.r[8]=(s>>>8|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=Th(e,16+2*t)}process(e,t,n=!1){let r=n?0:2048,{h:i,r:a}=this,o=a[0],s=a[1],c=a[2],l=a[3],u=a[4],d=a[5],f=a[6],p=a[7],m=a[8],h=a[9],g=Th(e,t+0),_=Th(e,t+2),v=Th(e,t+4),y=Th(e,t+6),b=Th(e,t+8),x=Th(e,t+10),S=Th(e,t+12),C=Th(e,t+14),w=i[0]+(g&8191),T=i[1]+((g>>>13|_<<3)&8191),E=i[2]+((_>>>10|v<<6)&8191),D=i[3]+((v>>>7|y<<9)&8191),O=i[4]+((y>>>4|b<<12)&8191),k=i[5]+(b>>>1&8191),A=i[6]+((b>>>14|x<<2)&8191),ee=i[7]+((x>>>11|S<<5)&8191),j=i[8]+((S>>>8|C<<8)&8191),M=i[9]+(C>>>5|r),N=0,P=N+w*o+5*h*T+5*m*E+5*p*D+5*f*O;N=P>>>13,P&=8191,P+=5*d*k+5*u*A+5*l*ee+5*c*j+5*s*M,N+=P>>>13,P&=8191;let F=N+w*s+T*o+5*h*E+5*m*D+5*p*O;N=F>>>13,F&=8191,F+=5*f*k+5*d*A+5*u*ee+5*l*j+5*c*M,N+=F>>>13,F&=8191;let te=N+w*c+T*s+E*o+5*h*D+5*m*O;N=te>>>13,te&=8191,te+=5*p*k+5*f*A+5*d*ee+5*u*j+5*l*M,N+=te>>>13,te&=8191;let I=N+w*l+T*c+E*s+D*o+5*h*O;N=I>>>13,I&=8191,I+=5*m*k+5*p*A+5*f*ee+5*d*j+5*u*M,N+=I>>>13,I&=8191;let ne=N+w*u+T*l+E*c+D*s+O*o;N=ne>>>13,ne&=8191,ne+=5*h*k+5*m*A+5*p*ee+5*f*j+5*d*M,N+=ne>>>13,ne&=8191;let re=N+w*d+T*u+E*l+D*c+O*s;N=re>>>13,re&=8191,re+=k*o+5*h*A+5*m*ee+5*p*j+5*f*M,N+=re>>>13,re&=8191;let L=N+w*f+T*d+E*u+D*l+O*c;N=L>>>13,L&=8191,L+=k*s+A*o+5*h*ee+5*m*j+5*p*M,N+=L>>>13,L&=8191;let R=N+w*p+T*f+E*d+D*u+O*l;N=R>>>13,R&=8191,R+=k*c+A*s+ee*o+5*h*j+5*m*M,N+=R>>>13,R&=8191;let ie=N+w*m+T*p+E*f+D*d+O*u;N=ie>>>13,ie&=8191,ie+=k*l+A*c+ee*s+j*o+5*h*M,N+=ie>>>13,ie&=8191;let z=N+w*h+T*m+E*p+D*f+O*d;N=z>>>13,z&=8191,z+=k*u+A*l+ee*c+j*s+M*o,N+=z>>>13,z&=8191,N=(N<<2)+N|0,N=N+P|0,P=N&8191,N>>>=13,F+=N,i[0]=P,i[1]=F,i[2]=te,i[3]=I,i[4]=ne,i[5]=re,i[6]=L,i[7]=R,i[8]=ie,i[9]=z}finalize(){let{h:e,pad:t}=this,n=new Uint16Array(10),r=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=r,r=e[t]>>>13,e[t]&=8191;e[0]+=r*5,r=e[0]>>>13,e[0]&=8191,e[1]+=r,r=e[1]>>>13,e[1]&=8191,e[2]+=r,n[0]=e[0]+5,r=n[0]>>>13,n[0]&=8191;for(let t=1;t<10;t++)n[t]=e[t]+r,r=n[t]>>>13,n[t]&=8191;n[9]-=8192;let i=(r^1)-1;for(let e=0;e<10;e++)n[e]&=i;i=~i;for(let t=0;t<10;t++)e[t]=e[t]&i|n[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let a=e[0]+t[0];e[0]=a&65535;for(let n=1;n<8;n++)a=(e[n]+t[n]|0)+(a>>>16)|0,e[n]=a&65535;fh(n)}update(e){Qm(this);let{buffer:t,blockLen:n}=this;e=ih(e);let r=e.length;for(let i=0;i<r;){let a=Math.min(n-this.pos,r-i);if(a===n){for(;n<=r-i;i+=n)this.process(e,i);continue}t.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===n&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){fh(this.h,this.r,this.buffer,this.pad)}digestInto(e){Qm(this),$m(e,this),this.finished=!0;let{buffer:t,h:n}=this,{pos:r}=this;if(r){for(t[r++]=1;r<16;r++)t[r]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let t=0;t<8;t++)e[i++]=n[t]>>>0,e[i++]=n[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}};function Dh(e){let t=(t,n)=>e(n).update(ih(t)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t}var Oh=Dh(e=>new Eh(e));function kh(e,t,n,r,i,a=20){let o=e[0],s=e[1],c=e[2],l=e[3],u=t[0],d=t[1],f=t[2],p=t[3],m=t[4],h=t[5],g=t[6],_=t[7],v=i,y=n[0],b=n[1],x=n[2],S=o,C=s,w=c,T=l,E=u,D=d,O=f,k=p,A=m,ee=h,j=g,M=_,N=v,P=y,F=b,te=x;for(let e=0;e<a;e+=2)S=S+E|0,N=q(N^S,16),A=A+N|0,E=q(E^A,12),S=S+E|0,N=q(N^S,8),A=A+N|0,E=q(E^A,7),C=C+D|0,P=q(P^C,16),ee=ee+P|0,D=q(D^ee,12),C=C+D|0,P=q(P^C,8),ee=ee+P|0,D=q(D^ee,7),w=w+O|0,F=q(F^w,16),j=j+F|0,O=q(O^j,12),w=w+O|0,F=q(F^w,8),j=j+F|0,O=q(O^j,7),T=T+k|0,te=q(te^T,16),M=M+te|0,k=q(k^M,12),T=T+k|0,te=q(te^T,8),M=M+te|0,k=q(k^M,7),S=S+D|0,te=q(te^S,16),j=j+te|0,D=q(D^j,12),S=S+D|0,te=q(te^S,8),j=j+te|0,D=q(D^j,7),C=C+O|0,N=q(N^C,16),M=M+N|0,O=q(O^M,12),C=C+O|0,N=q(N^C,8),M=M+N|0,O=q(O^M,7),w=w+k|0,P=q(P^w,16),A=A+P|0,k=q(k^A,12),w=w+k|0,P=q(P^w,8),A=A+P|0,k=q(k^A,7),T=T+E|0,F=q(F^T,16),ee=ee+F|0,E=q(E^ee,12),T=T+E|0,F=q(F^T,8),ee=ee+F|0,E=q(E^ee,7);let I=0;r[I++]=o+S|0,r[I++]=s+C|0,r[I++]=c+w|0,r[I++]=l+T|0,r[I++]=u+E|0,r[I++]=d+D|0,r[I++]=f+O|0,r[I++]=p+k|0,r[I++]=m+A|0,r[I++]=h+ee|0,r[I++]=g+j|0,r[I++]=_+M|0,r[I++]=v+N|0,r[I++]=y+P|0,r[I++]=b+F|0,r[I++]=x+te|0}var Ah=wh(kh,{counterRight:!1,counterLength:4,allowShortKeys:!1}),jh=new Uint8Array(16),Mh=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(jh.subarray(n))},Nh=new Uint8Array(32);function Ph(e,t,n,r,i){let a=e(t,n,Nh),o=Oh.create(a);i&&Mh(o,i),Mh(o,r);let s=new Uint8Array(16),c=nh(s);lh(c,0,BigInt(i?i.length:0),!0),lh(c,8,BigInt(r.length),!0),o.update(s);let l=o.digest();return fh(a,s),l}var Fh=sh({blockSize:64,nonceLength:12,tagLength:16},(e=>(t,n,r)=>({encrypt(i,a){let o=i.length;a=ch(o+16,a,!1),a.set(i);let s=a.subarray(0,-16);e(t,n,s,s,1);let c=Ph(e,t,n,s,r);return a.set(c,o),fh(c),a},decrypt(i,a){a=ch(i.length-16,a,!1);let o=i.subarray(0,-16),s=i.subarray(-16),c=Ph(e,t,n,o,r);if(!oh(s,c))throw Error(`invalid tag`);return a.set(i.subarray(0,-16)),e(t,n,a,a,1),fh(c),a}}))(Ah)),Ih=class extends qp{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,Dp(e);let n=Kp(t);if(this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let r=this.blockLen,i=new Uint8Array(r);i.set(n.length>r?e.create().update(n).digest():n);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return Op(this),this.iHash.update(e),this}digestInto(e){Op(this),Ep(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Lh=(e,t,n)=>new Ih(e,t).update(n).digest();Lh.create=(e,t)=>new Ih(e,t);function Rh(e,t,n){return Dp(e),n===void 0&&(n=new Uint8Array(e.outputLen)),Lh(e,Kp(n),Kp(t))}var zh=new Uint8Array([0]),Bh=new Uint8Array;function Vh(e,t,n,r=32){if(Dp(e),wp(r),r>255*e.outputLen)throw Error(`Length should be <= 255*HashLen`);let i=Math.ceil(r/e.outputLen);n===void 0&&(n=Bh);let a=new Uint8Array(i*e.outputLen),o=Lh.create(e,t),s=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let t=0;t<i;t++)zh[0]=t+1,s.update(t===0?Bh:c).update(n).update(zh).digestInto(c),a.set(c,e.outputLen*t),o._cloneInto(s);return o.destroy(),s.destroy(),c.fill(0),zh.fill(0),a.slice(0,r)}var Hh=(e,t,n,r,i)=>Vh(e,Rh(e,t,n),r,i);function Uh(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function Wh(e,t,n){return e&t^~e&n}function Gh(e,t,n){return e&t^e&n^t&n}var Kh=class extends qp{constructor(e,t,n,r){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Bp(this.buffer)}update(e){Op(this);let{view:t,buffer:n,blockLen:r}=this;e=Kp(e);let i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=Bp(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Op(this),kp(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;Uh(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=Bp(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.length=r,e.pos=o,e.finished=i,e.destroyed=a,r%t&&e.buffer.set(n),e}},qh=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Jh=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Yh=new Uint32Array(64),Xh=class extends Kh{constructor(){super(64,32,8,!1),this.A=Jh[0]|0,this.B=Jh[1]|0,this.C=Jh[2]|0,this.D=Jh[3]|0,this.E=Jh[4]|0,this.F=Jh[5]|0,this.G=Jh[6]|0,this.H=Jh[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)Yh[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=Yh[e-15],n=Yh[e-2],r=Vp(t,7)^Vp(t,18)^t>>>3;Yh[e]=(Vp(n,17)^Vp(n,19)^n>>>10)+Yh[e-7]+r+Yh[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=Vp(o,6)^Vp(o,11)^Vp(o,25),u=l+t+Wh(o,s,c)+qh[e]+Yh[e]|0,d=(Vp(n,2)^Vp(n,13)^Vp(n,22))+Gh(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){Yh.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Zh=Jp(()=>new Xh),Qh=BigInt(0);function $h(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function eg(e){if(!$h(e))throw Error(`Uint8Array expected`)}var tg=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function ng(e){eg(e);let t=``;for(let n=0;n<e.length;n++)t+=tg[e[n]];return t}function rg(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);return e===``?Qh:BigInt(`0x`+e)}var ig={_0:48,_9:57,A:65,F:70,a:97,f:102};function ag(e){if(e>=ig._0&&e<=ig._9)return e-ig._0;if(e>=ig.A&&e<=ig.F)return e-(ig.A-10);if(e>=ig.a&&e<=ig.f)return e-(ig.a-10)}function og(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);let t=e.length,n=t/2;if(t%2)throw Error(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=ag(e.charCodeAt(i)),a=ag(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function sg(e){return eg(e),rg(ng(Uint8Array.from(e).reverse()))}function cg(e,t){return og(e.toString(16).padStart(t*2,`0`))}function lg(e,t){return cg(e,t).reverse()}function ug(e,t,n){let r;if(typeof t==`string`)try{r=og(t)}catch(t){throw Error(e+` must be hex string or Uint8Array, cause: `+t)}else if($h(t))r=Uint8Array.from(t);else throw Error(e+` must be hex string or Uint8Array`);let i=r.length;if(typeof n==`number`&&i!==n)throw Error(e+` of length `+n+` expected, got `+i);return r}var dg=e=>typeof e==`bigint`&&Qh<=e;function fg(e,t,n){return dg(e)&&dg(t)&&dg(n)&&t<=e&&e<n}function pg(e,t,n,r){if(!fg(t,n,r))throw Error(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}var mg={bigint:e=>typeof e==`bigint`,function:e=>typeof e==`function`,boolean:e=>typeof e==`boolean`,string:e=>typeof e==`string`,stringOrUint8Array:e=>typeof e==`string`||$h(e),isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>typeof e==`function`&&Number.isSafeInteger(e.outputLen)};function hg(e,t,n={}){let r=(t,n,r)=>{let i=mg[n];if(typeof i!=`function`)throw Error(`invalid validator function`);let a=e[t];if(!(r&&a===void 0)&&!i(a,e))throw Error(`param `+String(t)+` is invalid. Expected `+n+`, got `+a)};for(let[e,n]of Object.entries(t))r(e,n,!1);for(let[e,t]of Object.entries(n))r(e,t,!0);return e}var gg=BigInt(0),_g=BigInt(1);function vg(e,t){let n=e%t;return n>=gg?n:t+n}function yg(e,t,n){if(t<gg)throw Error(`invalid exponent, negatives unsupported`);if(n<=gg)throw Error(`invalid modulus`);if(n===_g)return gg;let r=_g;for(;t>gg;)t&_g&&(r=r*e%n),e=e*e%n,t>>=_g;return r}function bg(e,t,n){let r=e;for(;t-- >gg;)r*=r,r%=n;return r}var xg=BigInt(0),Sg=BigInt(1);function Cg(e){return hg(e,{a:`bigint`},{montgomeryBits:`isSafeInteger`,nByteLength:`isSafeInteger`,adjustScalarBytes:`function`,domain:`function`,powPminus2:`function`,Gu:`bigint`}),Object.freeze({...e})}function wg(e){let t=Cg(e),{P:n}=t,r=e=>vg(e,n),i=t.montgomeryBits,a=Math.ceil(i/8),o=t.nByteLength,s=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>yg(e,n-BigInt(2),n));function l(e,t,n){let i=r(e*(t-n));return t=r(t-i),n=r(n+i),[t,n]}let u=(t.a-BigInt(2))/BigInt(4);function d(e,t){pg(`u`,e,xg,n),pg(`scalar`,t,xg,n);let a=t,o=e,s=Sg,d=xg,f=e,p=Sg,m=xg,h;for(let e=BigInt(i-1);e>=xg;e--){let t=a>>e&Sg;m^=t,h=l(m,s,f),s=h[0],f=h[1],h=l(m,d,p),d=h[0],p=h[1],m=t;let n=s+d,i=r(n*n),c=s-d,g=r(c*c),_=i-g,v=f+p,y=r((f-p)*n),b=r(v*c),x=y+b,S=y-b;f=r(x*x),p=r(o*r(S*S)),s=r(i*g),d=r(_*(i+r(u*_)))}h=l(m,s,f),s=h[0],f=h[1],h=l(m,d,p),d=h[0],p=h[1];let g=c(d);return r(s*g)}function f(e){return lg(r(e),a)}function p(e){let t=ug(`u coordinate`,e,a);return o===32&&(t[31]&=127),sg(t)}function m(e){let t=ug(`scalar`,e),n=t.length;if(n!==a&&n!==o){let e=``+a+` or `+o;throw Error(`invalid scalar, expected `+e+` bytes, got `+n)}return sg(s(t))}function h(e,t){let n=d(p(t),m(e));if(n===xg)throw Error(`invalid private or public key received`);return f(n)}let g=f(t.Gu);function _(e){return h(e,g)}return{scalarMult:h,scalarMultBase:_,getSharedSecret:(e,t)=>h(e,t),getPublicKey:e=>_(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:g}}var Tg=BigInt(`57896044618658097711785492504343953926634992332820282019728792003956564819949`),Eg=BigInt(1),Dg=BigInt(2),Og=BigInt(3),kg=BigInt(5);function Ag(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),a=Tg,o=e*e%a*e%a,s=bg(bg(o,Dg,a)*o%a,Eg,a)*e%a,c=bg(s,kg,a)*s%a,l=bg(c,t,a)*c%a,u=bg(l,n,a)*l%a,d=bg(u,r,a)*u%a;return{pow_p_5_8:bg(bg(bg(bg(d,i,a)*d%a,i,a)*d%a,t,a)*c%a,Dg,a)*e%a,b2:o}}function jg(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var Mg=wg({P:Tg,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let t=Tg,{pow_p_5_8:n,b2:r}=Ag(e);return vg(bg(n,Og,t)*r,t)},adjustScalarBytes:jg,randomBytes:Yp}),Ng=`base10`,Pg=`base16`,Fg=`base64pad`,Ig=`base64url`,Lg=`utf8`,Rg=0,zg=1,Bg=12,Vg=32;function Hg(){let e=Mg.utils.randomPrivateKey(),t=Mg.getPublicKey(e);return{privateKey:rc(e,Pg),publicKey:rc(t,Pg)}}function Ug(){return rc(Yp(Vg),Pg)}function Wg(e,t){return rc(Hh(Zh,Mg.getSharedSecret(nc(e,Pg),nc(t,Pg)),void 0,void 0,Vg),Pg)}function Gg(e){return rc(Zh(nc(e,Pg)),Pg)}function Kg(e){return rc(Zh(nc(e,Lg)),Pg)}function qg(e){return nc(`${e}`,Ng)}function Jg(e){return Number(rc(e,Ng))}function Yg(e){let t=qg(typeof e.type<`u`?e.type:0);if(Jg(t)===1&&typeof e.senderPublicKey>`u`)throw Error(`Missing sender public key for type 1 envelope`);let n=typeof e.senderPublicKey<`u`?nc(e.senderPublicKey,Pg):void 0,r=typeof e.iv<`u`?nc(e.iv,Pg):Yp(Bg);return $g({type:t,sealed:Fh(nc(e.symKey,Pg),r).encrypt(nc(e.message,Lg)),iv:r,senderPublicKey:n,encoding:e.encoding})}function Xg(e){let t=nc(e.symKey,Pg),{sealed:n,iv:r}=e_(e),i=Fh(t,r).decrypt(n);if(i===null)throw Error(`Failed to decrypt`);return rc(i,Lg)}function Zg(e,t){let n=qg(2),r=Yp(Bg);return $g({type:n,sealed:nc(e,Lg),iv:r,encoding:t})}function Qg(e,t){let{sealed:n}=e_({encoded:e,encoding:t});return rc(n,Lg)}function $g(e){let{encoding:t=Fg}=e;if(Jg(e.type)===2)return rc(go([e.type,e.sealed]),t);if(Jg(e.type)===1){if(typeof e.senderPublicKey>`u`)throw Error(`Missing sender public key for type 1 envelope`);return rc(go([e.type,e.senderPublicKey,e.iv,e.sealed]),t)}return rc(go([e.type,e.iv,e.sealed]),t)}function e_(e){let{encoded:t,encoding:n=Fg}=e,r=nc(t,n),i=r.slice(Rg,zg),a=zg;if(Jg(i)===1){let e=r.slice(a,33),t=r.slice(33,45);return{type:i,sealed:r.slice(45),iv:t,senderPublicKey:e}}if(Jg(i)===2)return{type:i,sealed:r.slice(a),iv:Yp(Bg)};let o=r.slice(a,13);return{type:i,sealed:r.slice(13),iv:o}}function t_(e,t){let n=e_({encoded:e,encoding:t?.encoding});return n_({type:Jg(n.type),senderPublicKey:typeof n.senderPublicKey<`u`?rc(n.senderPublicKey,Pg):void 0,receiverPublicKey:t?.receiverPublicKey})}function n_(e){let t=e?.type||0;if(t===1){if(typeof e?.senderPublicKey>`u`)throw Error(`missing sender public key`);if(typeof e?.receiverPublicKey>`u`)throw Error(`missing receiver public key`)}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function r_(e){return e.type===1&&typeof e.senderPublicKey==`string`&&typeof e.receiverPublicKey==`string`}function i_(e){return e.type===2}function a_(e){return new $c.ec(`p256`).keyFromPublic({x:Buffer.from(e.x,`base64`).toString(`hex`),y:Buffer.from(e.y,`base64`).toString(`hex`)},`hex`)}function o_(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=t.length%4;return n>0&&(t+=`=`.repeat(4-n)),t}function s_(e){return Buffer.from(o_(e),`base64`)}function c_(e,t){let[n,r,i]=e.split(`.`),a=s_(i);if(a.length!==64)throw Error(`Invalid signature length`);let o=a.slice(0,32).toString(`hex`),s=a.slice(32,64).toString(`hex`),c=Zh(`${n}.${r}`),l=a_(t),u=rc(c,Pg);if(!l.verify(u,{r:o,s}))throw Error(`Invalid signature`);return Wa(e).payload}function l_(e){return e?.relay||{protocol:`irn`}}function u_(e){let t=el[e];if(typeof t>`u`)throw Error(`Relay Protocol not supported: ${e}`);return t}function d_(e,t=`-`){let n={},r=`relay`+t;return Object.keys(e).forEach(t=>{if(t.startsWith(r)){let i=t.replace(r,``);n[i]=e[t]}}),n}function f_(e){if(!e.includes(`wc:`)){let t=Sp(e);t!=null&&t.includes(`wc:`)&&(e=t)}e=e.includes(`wc://`)?e.replace(`wc://`,``):e,e=e.includes(`wc:`)?e.replace(`wc:`,``):e;let t=e.indexOf(`:`),n=e.indexOf(`?`)===-1?void 0:e.indexOf(`?`),r=e.substring(0,t),i=e.substring(t+1,n).split(`@`),a=typeof n<`u`?e.substring(n):``,o=new URLSearchParams(a),s={};o.forEach((e,t)=>{s[t]=e});let c=typeof s.methods==`string`?s.methods.split(`,`):void 0;return{protocol:r,topic:p_(i[0]),version:parseInt(i[1],10),symKey:s.symKey,relay:d_(s),methods:c,expiryTimestamp:s.expiryTimestamp?parseInt(s.expiryTimestamp,10):void 0}}function p_(e){return e.startsWith(`//`)?e.substring(2):e}function m_(e,t=`-`){let n={};return Object.keys(e).forEach(r=>{let i=r,a=`relay`+t+i;e[i]&&(n[a]=e[i])}),n}function h_(e){let t=new URLSearchParams,n=m_(e.relay);Object.keys(n).sort().forEach(e=>{t.set(e,n[e])}),t.set(`symKey`,e.symKey),e.expiryTimestamp&&t.set(`expiryTimestamp`,e.expiryTimestamp.toString()),e.methods&&t.set(`methods`,e.methods.join(`,`));let r=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${r}`}function g_(e,t,n){return`${e}?wc_ev=${n}&topic=${t}`}function __(e){let t=[];return e.forEach(e=>{let[n,r]=e.split(`:`);t.push(`${n}:${r}`)}),t}function v_(e){let t=[];return Object.values(e).forEach(e=>{t.push(...__(e.accounts))}),t}function y_(e,t){let n=[];return Object.values(e).forEach(e=>{__(e.accounts).includes(t)&&n.push(...e.methods)}),n}function b_(e,t){let n=[];return Object.values(e).forEach(e=>{__(e.accounts).includes(t)&&n.push(...e.events)}),n}function x_(e){return e.includes(`:`)}function S_(e){return x_(e)?e.split(`:`)[0]:e}function C_(e){let t={};return e?.forEach(e=>{var n;let[r,i]=e.split(`:`);t[r]||(t[r]={accounts:[],chains:[],events:[],methods:[]}),t[r].accounts.push(e),(n=t[r].chains)==null||n.push(`${r}:${i}`)}),t}function w_(e,t){t=t.map(e=>e.replace(`did:pkh:`,``));let n=C_(t);for(let[t,r]of Object.entries(n))r.methods?r.methods=dp(r.methods,e):r.methods=e,r.events=[`chainChanged`,`accountsChanged`];return n}var T_={INVALID_METHOD:{message:`Invalid method.`,code:1001},INVALID_EVENT:{message:`Invalid event.`,code:1002},INVALID_UPDATE_REQUEST:{message:`Invalid update request.`,code:1003},INVALID_EXTEND_REQUEST:{message:`Invalid extend request.`,code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:`Invalid session settle request.`,code:1005},UNAUTHORIZED_METHOD:{message:`Unauthorized method.`,code:3001},UNAUTHORIZED_EVENT:{message:`Unauthorized event.`,code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:`Unauthorized update request.`,code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:`Unauthorized extend request.`,code:3004},USER_REJECTED:{message:`User rejected.`,code:5e3},USER_REJECTED_CHAINS:{message:`User rejected chains.`,code:5001},USER_REJECTED_METHODS:{message:`User rejected methods.`,code:5002},USER_REJECTED_EVENTS:{message:`User rejected events.`,code:5003},UNSUPPORTED_CHAINS:{message:`Unsupported chains.`,code:5100},UNSUPPORTED_METHODS:{message:`Unsupported methods.`,code:5101},UNSUPPORTED_EVENTS:{message:`Unsupported events.`,code:5102},UNSUPPORTED_ACCOUNTS:{message:`Unsupported accounts.`,code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:`Unsupported namespace key.`,code:5104},USER_DISCONNECTED:{message:`User disconnected.`,code:6e3},SESSION_SETTLEMENT_FAILED:{message:`Session settlement failed.`,code:7e3},WC_METHOD_UNSUPPORTED:{message:`Unsupported wc_ method.`,code:10001}},E_={NOT_INITIALIZED:{message:`Not initialized.`,code:1},NO_MATCHING_KEY:{message:`No matching key.`,code:2},RESTORE_WILL_OVERRIDE:{message:`Restore will override.`,code:3},RESUBSCRIBED:{message:`Resubscribed.`,code:4},MISSING_OR_INVALID:{message:`Missing or invalid.`,code:5},EXPIRED:{message:`Expired.`,code:6},UNKNOWN_TYPE:{message:`Unknown type.`,code:7},MISMATCHED_TOPIC:{message:`Mismatched topic.`,code:8},NON_CONFORMING_NAMESPACES:{message:`Non conforming namespaces.`,code:9}};function J(e,t){let{message:n,code:r}=E_[e];return{message:t?`${n} ${t}`:n,code:r}}function D_(e,t){let{message:n,code:r}=T_[e];return{message:t?`${n} ${t}`:n,code:r}}function O_(e,t){return Array.isArray(e)?typeof t<`u`&&e.length?e.every(t):!0:!1}function k_(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function A_(e){return typeof e>`u`}function j_(e,t){return t&&A_(e)?!0:typeof e==`string`&&!!e.trim().length}function M_(e,t){return t&&A_(e)?!0:typeof e==`number`&&!isNaN(e)}function N_(e,t){let{requiredNamespaces:n}=t,r=Object.keys(e.namespaces),i=Object.keys(n),a=!0;return ep(i,r)?(r.forEach(t=>{let{accounts:r,methods:i,events:o}=e.namespaces[t],s=__(r),c=n[t];(!ep(zf(t,c),s)||!ep(c.methods,i)||!ep(c.events,o))&&(a=!1)}),a):!1}function P_(e){return j_(e,!1)&&e.includes(`:`)?e.split(`:`).length===2:!1}function F_(e){if(j_(e,!1)&&e.includes(`:`)){let t=e.split(`:`);if(t.length===3){let e=t[0]+`:`+t[1];return!!t[2]&&P_(e)}}return!1}function I_(e){function t(e){try{return typeof new URL(e)<`u`}catch{return!1}}try{if(j_(e,!1))return t(e)?!0:t(Sp(e))}catch{}return!1}function L_(e){return e?.proposer?.publicKey}function R_(e){return e?.topic}function z_(e,t){let n=null;return j_(e?.publicKey,!1)||(n=J(`MISSING_OR_INVALID`,`${t} controller public key should be a string`)),n}function B_(e){let t=!0;return O_(e)?e.length&&(t=e.every(e=>j_(e,!1))):t=!1,t}function V_(e,t,n){let r=null;return O_(t)&&t.length?t.forEach(e=>{r||P_(e)||(r=D_(`UNSUPPORTED_CHAINS`,`${n}, chain ${e} should be a string and conform to "namespace:chainId" format`))}):P_(e)||(r=D_(`UNSUPPORTED_CHAINS`,`${n}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),r}function H_(e,t,n){let r=null;return Object.entries(e).forEach(([e,i])=>{if(r)return;let a=V_(e,zf(e,i),`${t} ${n}`);a&&(r=a)}),r}function U_(e,t){let n=null;return O_(e)?e.forEach(e=>{n||F_(e)||(n=D_(`UNSUPPORTED_ACCOUNTS`,`${t}, account ${e} should be a string and conform to "namespace:chainId:address" format`))}):n=D_(`UNSUPPORTED_ACCOUNTS`,`${t}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}function W_(e,t){let n=null;return Object.values(e).forEach(e=>{if(n)return;let r=U_(e?.accounts,`${t} namespace`);r&&(n=r)}),n}function G_(e,t){let n=null;return B_(e?.methods)?B_(e?.events)||(n=D_(`UNSUPPORTED_EVENTS`,`${t}, events should be an array of strings or empty array for no events`)):n=D_(`UNSUPPORTED_METHODS`,`${t}, methods should be an array of strings or empty array for no methods`),n}function K_(e,t){let n=null;return Object.values(e).forEach(e=>{if(n)return;let r=G_(e,`${t}, namespace`);r&&(n=r)}),n}function q_(e,t,n){let r=null;if(e&&k_(e)){let i=K_(e,t);i&&(r=i);let a=H_(e,t,n);a&&(r=a)}else r=J(`MISSING_OR_INVALID`,`${t}, ${n} should be an object with data`);return r}function J_(e,t){let n=null;if(e&&k_(e)){let r=K_(e,t);r&&(n=r);let i=W_(e,t);i&&(n=i)}else n=J(`MISSING_OR_INVALID`,`${t}, namespaces should be an object with data`);return n}function Y_(e){return j_(e.protocol,!0)}function X_(e,t){let n=!1;return t&&!e?n=!0:e&&O_(e)&&e.length&&e.forEach(e=>{n=Y_(e)}),n}function Z_(e){return typeof e==`number`}function Q_(e){return typeof e<`u`&&!0}function $_(e){return!(!e||typeof e!=`object`||!e.code||!M_(e.code,!1)||!e.message||!j_(e.message,!1))}function ev(e){return!(A_(e)||!j_(e.method,!1))}function tv(e){return!(A_(e)||A_(e.result)&&A_(e.error)||!M_(e.id,!1)||!j_(e.jsonrpc,!1))}function nv(e){return!(A_(e)||!j_(e.name,!1))}function rv(e,t){return!(!P_(t)||!v_(e).includes(t))}function iv(e,t,n){return j_(n,!1)?y_(e,t).includes(n):!1}function av(e,t,n){return j_(n,!1)?b_(e,t).includes(n):!1}function ov(e,t,n){let r=null,i=sv(e),a=lv(t),o=Object.keys(i),s=Object.keys(a),c=cv(Object.keys(e)),l=cv(Object.keys(t)),u=c.filter(e=>!l.includes(e));return u.length&&(r=J(`NON_CONFORMING_NAMESPACES`,`${n} namespaces keys don't satisfy requiredNamespaces.
|
|
8
|
+
Required: ${u.toString()}
|
|
9
|
+
Received: ${Object.keys(t).toString()}`)),ep(o,s)||(r=J(`NON_CONFORMING_NAMESPACES`,`${n} namespaces chains don't satisfy required namespaces.
|
|
10
|
+
Required: ${o.toString()}
|
|
11
|
+
Approved: ${s.toString()}`)),Object.keys(t).forEach(e=>{if(!e.includes(`:`)||r)return;let i=__(t[e].accounts);i.includes(e)||(r=J(`NON_CONFORMING_NAMESPACES`,`${n} namespaces accounts don't satisfy namespace accounts for ${e}
|
|
12
|
+
Required: ${e}
|
|
13
|
+
Approved: ${i.toString()}`))}),o.forEach(e=>{r||(ep(i[e].methods,a[e].methods)?ep(i[e].events,a[e].events)||(r=J(`NON_CONFORMING_NAMESPACES`,`${n} namespaces events don't satisfy namespace events for ${e}`)):r=J(`NON_CONFORMING_NAMESPACES`,`${n} namespaces methods don't satisfy namespace methods for ${e}`))}),r}function sv(e){let t={};return Object.keys(e).forEach(n=>{var r;n.includes(`:`)?t[n]=e[n]:(r=e[n].chains)==null||r.forEach(r=>{t[r]={methods:e[n].methods,events:e[n].events}})}),t}function cv(e){return[...new Set(e.map(e=>e.includes(`:`)?e.split(`:`)[0]:e))]}function lv(e){let t={};return Object.keys(e).forEach(n=>{n.includes(`:`)?t[n]=e[n]:__(e[n].accounts)?.forEach(r=>{t[r]={accounts:e[n].accounts.filter(e=>e.includes(`${r}:`)),methods:e[n].methods,events:e[n].events}})}),t}function uv(e,t){return M_(e,!1)&&e<=t.max&&e>=t.min}function dv(){let e=Kf();return new Promise(t=>{switch(e){case Bf.browser:t(fv());break;case Bf.reactNative:t(pv());break;case Bf.node:t(mv());break;default:t(!0)}})}function fv(){return Gf()&&navigator?.onLine}async function pv(){return Hf()&&typeof global<`u`&&global!=null&&global.NetInfo?(await(global==null?void 0:global.NetInfo.fetch()))?.isConnected:!0}function mv(){return!0}function hv(e){switch(Kf()){case Bf.browser:gv(e);break;case Bf.reactNative:_v(e);break;case Bf.node:break}}function gv(e){!Hf()&&Gf()&&(window.addEventListener(`online`,()=>e(!0)),window.addEventListener(`offline`,()=>e(!1)))}function _v(e){Hf()&&typeof global<`u`&&global!=null&&global.NetInfo&&global?.NetInfo.addEventListener(t=>e(t?.isConnected))}var vv={},yv=class{static get(e){return vv[e]}static set(e,t){vv[e]=t}static delete(e){delete vv[e]}},bv=r(a(((e,t)=>{var n=200,r=`__lodash_hash_undefined__`,i=1,a=2,o=9007199254740991,s=`[object Arguments]`,c=`[object Array]`,l=`[object AsyncFunction]`,u=`[object Boolean]`,d=`[object Date]`,f=`[object Error]`,p=`[object Function]`,m=`[object GeneratorFunction]`,h=`[object Map]`,g=`[object Number]`,_=`[object Null]`,v=`[object Object]`,y=`[object Promise]`,b=`[object Proxy]`,x=`[object RegExp]`,S=`[object Set]`,C=`[object String]`,w=`[object Symbol]`,T=`[object Undefined]`,E=`[object WeakMap]`,D=`[object ArrayBuffer]`,O=`[object DataView]`,k=`[object Float32Array]`,A=`[object Float64Array]`,ee=`[object Int8Array]`,j=`[object Int16Array]`,M=`[object Int32Array]`,N=`[object Uint8Array]`,P=`[object Uint8ClampedArray]`,F=`[object Uint16Array]`,te=`[object Uint32Array]`,I=/[\\^$.*+?()[\]{}|]/g,ne=/^\[object .+?Constructor\]$/,re=/^(?:0|[1-9]\d*)$/,L={};L[k]=L[A]=L[ee]=L[j]=L[M]=L[N]=L[P]=L[F]=L[te]=!0,L[s]=L[c]=L[D]=L[u]=L[O]=L[d]=L[f]=L[p]=L[h]=L[g]=L[v]=L[x]=L[S]=L[C]=L[E]=!1;var R=typeof global==`object`&&global&&global.Object===Object&&global,ie=typeof self==`object`&&self&&self.Object===Object&&self,z=R||ie||Function(`return this`)(),B=typeof e==`object`&&e&&!e.nodeType&&e,ae=B&&typeof t==`object`&&t&&!t.nodeType&&t,V=ae&&ae.exports===B,oe=V&&R.process,se=function(){try{return oe&&oe.binding&&oe.binding(`util`)}catch{}}(),ce=se&&se.isTypedArray;function le(e,t){for(var n=-1,r=e==null?0:e.length,i=0,a=[];++n<r;){var o=e[n];t(o,n,e)&&(a[i++]=o)}return a}function ue(e,t){for(var n=-1,r=t.length,i=e.length;++n<r;)e[i+n]=t[n];return e}function de(e,t){for(var n=-1,r=e==null?0:e.length;++n<r;)if(t(e[n],n,e))return!0;return!1}function fe(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function pe(e){return function(t){return e(t)}}function me(e,t){return e.has(t)}function he(e,t){return e?.[t]}function ge(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function H(e,t){return function(n){return e(t(n))}}function _e(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var ve=Array.prototype,ye=Function.prototype,be=Object.prototype,xe=z[`__core-js_shared__`],Se=ye.toString,U=be.hasOwnProperty,Ce=function(){var e=/[^.]+$/.exec(xe&&xe.keys&&xe.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),W=be.toString,we=RegExp(`^`+Se.call(U).replace(I,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),Te=V?z.Buffer:void 0,Ee=z.Symbol,De=z.Uint8Array,Oe=be.propertyIsEnumerable,ke=ve.splice,Ae=Ee?Ee.toStringTag:void 0,je=Object.getOwnPropertySymbols,Me=Te?Te.isBuffer:void 0,Ne=H(Object.keys,Object),Pe=Ft(z,`DataView`),Fe=Ft(z,`Map`),Ie=Ft(z,`Promise`),Le=Ft(z,`Set`),Re=Ft(z,`WeakMap`),ze=Ft(Object,`create`),Be=Wt(Pe),Ve=Wt(Fe),He=Wt(Ie),Ue=Wt(Le),We=Wt(Re),Ge=Ee?Ee.prototype:void 0,Ke=Ge?Ge.valueOf:void 0;function qe(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Je(){this.__data__=ze?ze(null):{},this.size=0}function Ye(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}function Xe(e){var t=this.__data__;if(ze){var n=t[e];return n===r?void 0:n}return U.call(t,e)?t[e]:void 0}function Ze(e){var t=this.__data__;return ze?t[e]!==void 0:U.call(t,e)}function Qe(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=ze&&t===void 0?r:t,this}qe.prototype.clear=Je,qe.prototype.delete=Ye,qe.prototype.get=Xe,qe.prototype.has=Ze,qe.prototype.set=Qe;function $e(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function et(){this.__data__=[],this.size=0}function tt(e){var t=this.__data__,n=xt(t,e);return n<0?!1:(n==t.length-1?t.pop():ke.call(t,n,1),--this.size,!0)}function nt(e){var t=this.__data__,n=xt(t,e);return n<0?void 0:t[n][1]}function rt(e){return xt(this.__data__,e)>-1}function it(e,t){var n=this.__data__,r=xt(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}$e.prototype.clear=et,$e.prototype.delete=tt,$e.prototype.get=nt,$e.prototype.has=rt,$e.prototype.set=it;function at(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ot(){this.size=0,this.__data__={hash:new qe,map:new(Fe||$e),string:new qe}}function st(e){var t=Pt(this,e).delete(e);return this.size-=+!!t,t}function ct(e){return Pt(this,e).get(e)}function lt(e){return Pt(this,e).has(e)}function ut(e,t){var n=Pt(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}at.prototype.clear=ot,at.prototype.delete=st,at.prototype.get=ct,at.prototype.has=lt,at.prototype.set=ut;function dt(e){var t=-1,n=e==null?0:e.length;for(this.__data__=new at;++t<n;)this.add(e[t])}function ft(e){return this.__data__.set(e,r),this}function pt(e){return this.__data__.has(e)}dt.prototype.add=dt.prototype.push=ft,dt.prototype.has=pt;function mt(e){var t=this.__data__=new $e(e);this.size=t.size}function ht(){this.__data__=new $e,this.size=0}function gt(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}function _t(e){return this.__data__.get(e)}function vt(e){return this.__data__.has(e)}function yt(e,t){var r=this.__data__;if(r instanceof $e){var i=r.__data__;if(!Fe||i.length<n-1)return i.push([e,t]),this.size=++r.size,this;r=this.__data__=new at(i)}return r.set(e,t),this.size=r.size,this}mt.prototype.clear=ht,mt.prototype.delete=gt,mt.prototype.get=_t,mt.prototype.has=vt,mt.prototype.set=yt;function bt(e,t){var n=qt(e),r=!n&&Kt(e),i=!n&&!r&&Yt(e),a=!n&&!r&&!i&&tn(e),o=n||r||i||a,s=o?fe(e.length,String):[],c=s.length;for(var l in e)(t||U.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||zt(l,c)))&&s.push(l);return s}function xt(e,t){for(var n=e.length;n--;)if(Gt(e[n][0],t))return n;return-1}function St(e,t,n){var r=t(e);return qt(e)?r:ue(r,n(e))}function Ct(e){return e==null?e===void 0?T:_:Ae&&Ae in Object(e)?It(e):Ut(e)}function wt(e){return en(e)&&Ct(e)==s}function Tt(e,t,n,r,i){return e===t?!0:e==null||t==null||!en(e)&&!en(t)?e!==e&&t!==t:Et(e,t,n,r,Tt,i)}function Et(e,t,n,r,a,o){var l=qt(e),u=qt(t),d=l?c:Rt(e),f=u?c:Rt(t);d=d==s?v:d,f=f==s?v:f;var p=d==v,m=f==v,h=d==f;if(h&&Yt(e)){if(!Yt(t))return!1;l=!0,p=!1}if(h&&!p)return o||=new mt,l||tn(e)?At(e,t,n,r,a,o):jt(e,t,d,n,r,a,o);if(!(n&i)){var g=p&&U.call(e,`__wrapped__`),_=m&&U.call(t,`__wrapped__`);if(g||_){var y=g?e.value():e,b=_?t.value():t;return o||=new mt,a(y,b,n,r,o)}}return h?(o||=new mt,Mt(e,t,n,r,a,o)):!1}function Dt(e){return!$t(e)||Vt(e)?!1:(Zt(e)?we:ne).test(Wt(e))}function Ot(e){return en(e)&&Qt(e.length)&&!!L[Ct(e)]}function kt(e){if(!Ht(e))return Ne(e);var t=[];for(var n in Object(e))U.call(e,n)&&n!=`constructor`&&t.push(n);return t}function At(e,t,n,r,o,s){var c=n&i,l=e.length,u=t.length;if(l!=u&&!(c&&u>l))return!1;var d=s.get(e);if(d&&s.get(t))return d==t;var f=-1,p=!0,m=n&a?new dt:void 0;for(s.set(e,t),s.set(t,e);++f<l;){var h=e[f],g=t[f];if(r)var _=c?r(g,h,f,t,e,s):r(h,g,f,e,t,s);if(_!==void 0){if(_)continue;p=!1;break}if(m){if(!de(t,function(e,t){if(!me(m,t)&&(h===e||o(h,e,n,r,s)))return m.push(t)})){p=!1;break}}else if(!(h===g||o(h,g,n,r,s))){p=!1;break}}return s.delete(e),s.delete(t),p}function jt(e,t,n,r,o,s,c){switch(n){case O:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case D:return!(e.byteLength!=t.byteLength||!s(new De(e),new De(t)));case u:case d:case g:return Gt(+e,+t);case f:return e.name==t.name&&e.message==t.message;case x:case C:return e==t+``;case h:var l=ge;case S:var p=r&i;if(l||=_e,e.size!=t.size&&!p)return!1;var m=c.get(e);if(m)return m==t;r|=a,c.set(e,t);var _=At(l(e),l(t),r,o,s,c);return c.delete(e),_;case w:if(Ke)return Ke.call(e)==Ke.call(t)}return!1}function Mt(e,t,n,r,a,o){var s=n&i,c=Nt(e),l=c.length;if(l!=Nt(t).length&&!s)return!1;for(var u=l;u--;){var d=c[u];if(!(s?d in t:U.call(t,d)))return!1}var f=o.get(e);if(f&&o.get(t))return f==t;var p=!0;o.set(e,t),o.set(t,e);for(var m=s;++u<l;){d=c[u];var h=e[d],g=t[d];if(r)var _=s?r(g,h,d,t,e,o):r(h,g,d,e,t,o);if(!(_===void 0?h===g||a(h,g,n,r,o):_)){p=!1;break}m||=d==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return o.delete(e),o.delete(t),p}function Nt(e){return St(e,nn,Lt)}function Pt(e,t){var n=e.__data__;return Bt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function Ft(e,t){var n=he(e,t);return Dt(n)?n:void 0}function It(e){var t=U.call(e,Ae),n=e[Ae];try{e[Ae]=void 0;var r=!0}catch{}var i=W.call(e);return r&&(t?e[Ae]=n:delete e[Ae]),i}var Lt=je?function(e){return e==null?[]:(e=Object(e),le(je(e),function(t){return Oe.call(e,t)}))}:rn,Rt=Ct;(Pe&&Rt(new Pe(new ArrayBuffer(1)))!=O||Fe&&Rt(new Fe)!=h||Ie&&Rt(Ie.resolve())!=y||Le&&Rt(new Le)!=S||Re&&Rt(new Re)!=E)&&(Rt=function(e){var t=Ct(e),n=t==v?e.constructor:void 0,r=n?Wt(n):``;if(r)switch(r){case Be:return O;case Ve:return h;case He:return y;case Ue:return S;case We:return E}return t});function zt(e,t){return t??=o,!!t&&(typeof e==`number`||re.test(e))&&e>-1&&e%1==0&&e<t}function Bt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Vt(e){return!!Ce&&Ce in e}function Ht(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||be)}function Ut(e){return W.call(e)}function Wt(e){if(e!=null){try{return Se.call(e)}catch{}try{return e+``}catch{}}return``}function Gt(e,t){return e===t||e!==e&&t!==t}var Kt=wt(function(){return arguments}())?wt:function(e){return en(e)&&U.call(e,`callee`)&&!Oe.call(e,`callee`)},qt=Array.isArray;function Jt(e){return e!=null&&Qt(e.length)&&!Zt(e)}var Yt=Me||an;function Xt(e,t){return Tt(e,t)}function Zt(e){if(!$t(e))return!1;var t=Ct(e);return t==p||t==m||t==l||t==b}function Qt(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=o}function $t(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}function en(e){return typeof e==`object`&&!!e}var tn=ce?pe(ce):Ot;function nn(e){return Jt(e)?bt(e):kt(e)}function rn(){return[]}function an(){return!1}t.exports=Xt}))()),xv=`core`,Sv=`wc@2:${xv}:`,Cv={name:xv,logger:`error`},wv={database:`:memory:`},Tv=`crypto`,Ev=`client_ed25519_seed`,Dv=V.ONE_DAY,Ov=`keychain`,kv=`messages`,Av=V.SIX_HOURS,jv=`publisher`,Mv=`relayer`,Nv={message:`relayer_message`,message_ack:`relayer_message_ack`,connect:`relayer_connect`,disconnect:`relayer_disconnect`,error:`relayer_error`,connection_stalled:`relayer_connection_stalled`,transport_closed:`relayer_transport_closed`,publish:`relayer_publish`},Pv={payload:`payload`,connect:`connect`,disconnect:`disconnect`,error:`error`},Fv=`2.19.0`,Iv={link_mode:`link_mode`,relay:`relay`},Lv=`WALLETCONNECT_CLIENT_ID`,Rv={created:`subscription_created`,deleted:`subscription_deleted`,expired:`subscription_expired`,disabled:`subscription_disabled`,sync:`subscription_sync`,resubscribed:`subscription_resubscribed`};V.THIRTY_DAYS;var zv=`subscription`,Bv=V.FIVE_SECONDS*1e3,Vv=`pairing`;V.THIRTY_DAYS;var Hv={wc_pairingDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:V.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:V.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:V.ONE_DAY,prompt:!1,tag:0},res:{ttl:V.ONE_DAY,prompt:!1,tag:0}}},Uv={create:`pairing_create`,expire:`pairing_expire`,delete:`pairing_delete`,ping:`pairing_ping`},Wv={created:`history_created`,updated:`history_updated`,deleted:`history_deleted`,sync:`history_sync`},Gv=`history`,Kv=`expirer`,qv={created:`expirer_created`,deleted:`expirer_deleted`,expired:`expirer_expired`,sync:`expirer_sync`};V.ONE_DAY;var Jv=`verify-api`,Yv=`https://verify.walletconnect.com`,Xv=`https://verify.walletconnect.org`,Zv=`${Xv}/v3`,Qv=[Yv,Xv],$v=`echo`,ey=`https://echo.walletconnect.com`,ty={pairing_started:`pairing_started`,pairing_uri_validation_success:`pairing_uri_validation_success`,pairing_uri_not_expired:`pairing_uri_not_expired`,store_new_pairing:`store_new_pairing`,subscribing_pairing_topic:`subscribing_pairing_topic`,subscribe_pairing_topic_success:`subscribe_pairing_topic_success`,existing_pairing:`existing_pairing`,pairing_not_expired:`pairing_not_expired`,emit_inactive_pairing:`emit_inactive_pairing`,emit_session_proposal:`emit_session_proposal`,subscribing_to_pairing_topic:`subscribing_to_pairing_topic`},ny={no_wss_connection:`no_wss_connection`,no_internet_connection:`no_internet_connection`,malformed_pairing_uri:`malformed_pairing_uri`,active_pairing_already_exists:`active_pairing_already_exists`,subscribe_pairing_topic_failure:`subscribe_pairing_topic_failure`,pairing_expired:`pairing_expired`,proposal_expired:`proposal_expired`,proposal_listener_not_found:`proposal_listener_not_found`},ry={session_approve_started:`session_approve_started`,proposal_not_expired:`proposal_not_expired`,session_namespaces_validation_success:`session_namespaces_validation_success`,create_session_topic:`create_session_topic`,subscribing_session_topic:`subscribing_session_topic`,subscribe_session_topic_success:`subscribe_session_topic_success`,publishing_session_approve:`publishing_session_approve`,session_approve_publish_success:`session_approve_publish_success`,store_session:`store_session`,publishing_session_settle:`publishing_session_settle`,session_settle_publish_success:`session_settle_publish_success`},iy={no_internet_connection:`no_internet_connection`,no_wss_connection:`no_wss_connection`,proposal_expired:`proposal_expired`,subscribe_session_topic_failure:`subscribe_session_topic_failure`,session_approve_publish_failure:`session_approve_publish_failure`,session_settle_publish_failure:`session_settle_publish_failure`,session_approve_namespace_validation_failure:`session_approve_namespace_validation_failure`,proposal_not_found:`proposal_not_found`},ay={authenticated_session_approve_started:`authenticated_session_approve_started`,authenticated_session_not_expired:`authenticated_session_not_expired`,chains_caip2_compliant:`chains_caip2_compliant`,chains_evm_compliant:`chains_evm_compliant`,create_authenticated_session_topic:`create_authenticated_session_topic`,cacaos_verified:`cacaos_verified`,store_authenticated_session:`store_authenticated_session`,subscribing_authenticated_session_topic:`subscribing_authenticated_session_topic`,subscribe_authenticated_session_topic_success:`subscribe_authenticated_session_topic_success`,publishing_authenticated_session_approve:`publishing_authenticated_session_approve`,authenticated_session_approve_publish_success:`authenticated_session_approve_publish_success`},oy={no_internet_connection:`no_internet_connection`,no_wss_connection:`no_wss_connection`,missing_session_authenticate_request:`missing_session_authenticate_request`,session_authenticate_request_expired:`session_authenticate_request_expired`,chains_caip2_compliant_failure:`chains_caip2_compliant_failure`,chains_evm_compliant_failure:`chains_evm_compliant_failure`,invalid_cacao:`invalid_cacao`,subscribe_authenticated_session_topic_failure:`subscribe_authenticated_session_topic_failure`,authenticated_session_approve_publish_failure:`authenticated_session_approve_publish_failure`,authenticated_session_pending_request_not_found:`authenticated_session_pending_request_not_found`},sy=.1,cy=`event-client`,ly=`https://pulse.walletconnect.org/batch`;function uy(e,t){if(e.length>=255)throw TypeError(`Alphabet too long`);for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var i=0;i<e.length;i++){var a=e.charAt(i),o=a.charCodeAt(0);if(n[o]!==255)throw TypeError(a+` is ambiguous`);n[o]=i}var s=e.length,c=e.charAt(0),l=Math.log(s)/Math.log(256),u=Math.log(256)/Math.log(s);function d(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;for(var n=0,r=0,i=0,a=t.length;i!==a&&t[i]===0;)i++,n++;for(var o=(a-i)*u+1>>>0,l=new Uint8Array(o);i!==a;){for(var d=t[i],f=0,p=o-1;(d!==0||f<r)&&p!==-1;p--,f++)d+=256*l[p]>>>0,l[p]=d%s>>>0,d=d/s>>>0;if(d!==0)throw Error(`Non-zero carry`);r=f,i++}for(var m=o-r;m!==o&&l[m]===0;)m++;for(var h=c.repeat(n);m<o;++m)h+=e.charAt(l[m]);return h}function f(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;var t=0;if(e[t]!==` `){for(var r=0,i=0;e[t]===c;)r++,t++;for(var a=(e.length-t)*l+1>>>0,o=new Uint8Array(a);e[t];){var u=n[e.charCodeAt(t)];if(u===255)return;for(var d=0,f=a-1;(u!==0||d<i)&&f!==-1;f--,d++)u+=s*o[f]>>>0,o[f]=u%256>>>0,u=u/256>>>0;if(u!==0)throw Error(`Non-zero carry`);i=d,t++}if(e[t]!==` `){for(var p=a-i;p!==a&&o[p]===0;)p++;for(var m=new Uint8Array(r+(a-p)),h=r;p!==a;)m[h++]=o[p++];return m}}}function p(e){var n=f(e);if(n)return n;throw Error(`Non-${t} character`)}return{encode:d,decodeUnsafe:f,decode:p}}var dy=uy,fy=e=>{if(e instanceof Uint8Array&&e.constructor.name===`Uint8Array`)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error(`Unknown type, must be binary type`)},py=e=>new TextEncoder().encode(e),my=e=>new TextDecoder().decode(e),hy=class{constructor(e,t,n){this.name=e,this.prefix=t,this.baseEncode=n}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error(`Unknown type, must be binary type`)}},gy=class{constructor(e,t,n){if(this.name=e,this.prefix=t,t.codePointAt(0)===void 0)throw Error(`Invalid prefix character`);this.prefixCodePoint=t.codePointAt(0),this.baseDecode=n}decode(e){if(typeof e==`string`){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}else throw Error(`Can only multibase decode strings`)}or(e){return vy(this,e)}},_y=class{constructor(e){this.decoders=e}or(e){return vy(this,e)}decode(e){let t=e[0],n=this.decoders[t];if(n)return n.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}},vy=(e,t)=>new _y({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}}),yy=class{constructor(e,t,n,r){this.name=e,this.prefix=t,this.baseEncode=n,this.baseDecode=r,this.encoder=new hy(e,t,n),this.decoder=new gy(e,t,r)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}},by=({name:e,prefix:t,encode:n,decode:r})=>new yy(e,t,n,r),xy=({prefix:e,name:t,alphabet:n})=>{let{encode:r,decode:i}=dy(n,t);return by({prefix:e,name:t,encode:r,decode:e=>fy(i(e))})},Sy=(e,t,n,r)=>{let i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let a=e.length;for(;e[a-1]===`=`;)--a;let o=new Uint8Array(a*n/8|0),s=0,c=0,l=0;for(let t=0;t<a;++t){let a=i[e[t]];if(a===void 0)throw SyntaxError(`Non-${r} character`);c=c<<n|a,s+=n,s>=8&&(s-=8,o[l++]=255&c>>s)}if(s>=n||255&c<<8-s)throw SyntaxError(`Unexpected end of data`);return o},Cy=(e,t,n)=>{let r=t[t.length-1]===`=`,i=(1<<n)-1,a=``,o=0,s=0;for(let r=0;r<e.length;++r)for(s=s<<8|e[r],o+=8;o>n;)o-=n,a+=t[i&s>>o];if(o&&(a+=t[i&s<<n-o]),r)for(;a.length*n&7;)a+=`=`;return a},wy=({name:e,prefix:t,bitsPerChar:n,alphabet:r})=>by({prefix:t,name:e,encode(e){return Cy(e,r,n)},decode(t){return Sy(t,r,n,e)}}),Ty=by({prefix:`\0`,name:`identity`,encode:e=>my(e),decode:e=>py(e)}),Ey=Object.freeze({__proto__:null,identity:Ty}),Dy=wy({prefix:`0`,name:`base2`,alphabet:`01`,bitsPerChar:1}),Oy=Object.freeze({__proto__:null,base2:Dy}),ky=wy({prefix:`7`,name:`base8`,alphabet:`01234567`,bitsPerChar:3}),Ay=Object.freeze({__proto__:null,base8:ky}),jy=xy({prefix:`9`,name:`base10`,alphabet:`0123456789`}),My=Object.freeze({__proto__:null,base10:jy}),Ny=wy({prefix:`f`,name:`base16`,alphabet:`0123456789abcdef`,bitsPerChar:4}),Py=wy({prefix:`F`,name:`base16upper`,alphabet:`0123456789ABCDEF`,bitsPerChar:4}),Fy=Object.freeze({__proto__:null,base16:Ny,base16upper:Py}),Iy=wy({prefix:`b`,name:`base32`,alphabet:`abcdefghijklmnopqrstuvwxyz234567`,bitsPerChar:5}),Ly=wy({prefix:`B`,name:`base32upper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567`,bitsPerChar:5}),Ry=wy({prefix:`c`,name:`base32pad`,alphabet:`abcdefghijklmnopqrstuvwxyz234567=`,bitsPerChar:5}),zy=wy({prefix:`C`,name:`base32padupper`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=`,bitsPerChar:5}),By=wy({prefix:`v`,name:`base32hex`,alphabet:`0123456789abcdefghijklmnopqrstuv`,bitsPerChar:5}),Vy=wy({prefix:`V`,name:`base32hexupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV`,bitsPerChar:5}),Hy=wy({prefix:`t`,name:`base32hexpad`,alphabet:`0123456789abcdefghijklmnopqrstuv=`,bitsPerChar:5}),Uy=wy({prefix:`T`,name:`base32hexpadupper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUV=`,bitsPerChar:5}),Wy=wy({prefix:`h`,name:`base32z`,alphabet:`ybndrfg8ejkmcpqxot1uwisza345h769`,bitsPerChar:5}),Gy=Object.freeze({__proto__:null,base32:Iy,base32upper:Ly,base32pad:Ry,base32padupper:zy,base32hex:By,base32hexupper:Vy,base32hexpad:Hy,base32hexpadupper:Uy,base32z:Wy}),Ky=xy({prefix:`k`,name:`base36`,alphabet:`0123456789abcdefghijklmnopqrstuvwxyz`}),qy=xy({prefix:`K`,name:`base36upper`,alphabet:`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ`}),Jy=Object.freeze({__proto__:null,base36:Ky,base36upper:qy}),Yy=xy({name:`base58btc`,prefix:`z`,alphabet:`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`}),Xy=xy({name:`base58flickr`,prefix:`Z`,alphabet:`123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ`}),Zy=Object.freeze({__proto__:null,base58btc:Yy,base58flickr:Xy}),Qy=wy({prefix:`m`,name:`base64`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,bitsPerChar:6}),$y=wy({prefix:`M`,name:`base64pad`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`,bitsPerChar:6}),eb=wy({prefix:`u`,name:`base64url`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`,bitsPerChar:6}),tb=wy({prefix:`U`,name:`base64urlpad`,alphabet:`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=`,bitsPerChar:6}),nb=Object.freeze({__proto__:null,base64:Qy,base64pad:$y,base64url:eb,base64urlpad:tb}),rb=Array.from(`🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂`),ib=rb.reduce((e,t,n)=>(e[n]=t,e),[]),ab=rb.reduce((e,t,n)=>(e[t.codePointAt(0)]=n,e),[]);function ob(e){return e.reduce((e,t)=>(e+=ib[t],e),``)}function sb(e){let t=[];for(let n of e){let e=ab[n.codePointAt(0)];if(e===void 0)throw Error(`Non-base256emoji character: ${n}`);t.push(e)}return new Uint8Array(t)}var cb=by({prefix:`🚀`,name:`base256emoji`,encode:ob,decode:sb}),lb=Object.freeze({__proto__:null,base256emoji:cb}),ub=mb,db=128,fb=-128,pb=2**31;function mb(e,t,n){t||=[],n||=0;for(var r=n;e>=pb;)t[n++]=e&255|db,e/=128;for(;e&fb;)t[n++]=e&255|db,e>>>=7;return t[n]=e|0,mb.bytes=n-r+1,t}var hb=vb,gb=128,_b=127;function vb(e,t){var n=0,t=t||0,r=0,i=t,a,o=e.length;do{if(i>=o)throw vb.bytes=0,RangeError(`Could not decode varint`);a=e[i++],n+=r<28?(a&_b)<<r:(a&_b)*2**r,r+=7}while(a>=gb);return vb.bytes=i-t,n}var yb=2**7,bb=2**14,xb=2**21,Sb=2**28,Cb=2**35,wb=2**42,Tb=2**49,Eb=2**56,Db=2**63,Ob={encode:ub,decode:hb,encodingLength:function(e){return e<yb?1:e<bb?2:e<xb?3:e<Sb?4:e<Cb?5:e<wb?6:e<Tb?7:e<Eb?8:e<Db?9:10}},kb=(e,t,n=0)=>(Ob.encode(e,t,n),t),Ab=e=>Ob.encodingLength(e),jb=(e,t)=>{let n=t.byteLength,r=Ab(e),i=r+Ab(n),a=new Uint8Array(i+n);return kb(e,a,0),kb(n,a,r),a.set(t,i),new Mb(e,n,t,a)},Mb=class{constructor(e,t,n,r){this.code=e,this.size=t,this.digest=n,this.bytes=r}},Nb=({name:e,code:t,encode:n})=>new Pb(e,t,n),Pb=class{constructor(e,t,n){this.name=e,this.code=t,this.encode=n}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?jb(this.code,t):t.then(e=>jb(this.code,e))}else throw Error(`Unknown type, must be binary type`)}},Fb=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),Ib=Nb({name:`sha2-256`,code:18,encode:Fb(`SHA-256`)}),Lb=Nb({name:`sha2-512`,code:19,encode:Fb(`SHA-512`)}),Rb=Object.freeze({__proto__:null,sha256:Ib,sha512:Lb}),zb=0,Bb=`identity`,Vb=fy,Hb=Object.freeze({__proto__:null,identity:{code:zb,name:Bb,encode:Vb,digest:e=>jb(zb,Vb(e))}});new TextEncoder,new TextDecoder;var Ub={...Ey,...Oy,...Ay,...My,...Fy,...Gy,...Jy,...Zy,...nb,...lb};({...Rb,...Hb});function Wb(e=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function Gb(e,t,n,r){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:n},decoder:{decode:r}}}var Kb=Gb(`utf8`,`u`,e=>`u`+new TextDecoder(`utf8`).decode(e),e=>new TextEncoder().encode(e.substring(1))),qb=Gb(`ascii`,`a`,e=>{let t=`a`;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return t},e=>{e=e.substring(1);let t=Wb(e.length);for(let n=0;n<e.length;n++)t[n]=e.charCodeAt(n);return t}),Jb={utf8:Kb,"utf-8":Kb,hex:Ub.base16,latin1:qb,ascii:qb,binary:qb,...Ub};function Yb(e,t=`utf8`){let n=Jb[t];if(!n)throw Error(`Unsupported encoding "${t}"`);return(t===`utf8`||t===`utf-8`)&&globalThis.Buffer!=null&&globalThis.Buffer.from!=null?globalThis.Buffer.from(e,`utf8`):n.decoder.decode(`${n.prefix}${e}`)}var Xb=Object.defineProperty,Zb=(e,t,n)=>t in e?Xb(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qb=(e,t,n)=>Zb(e,typeof t==`symbol`?t:t+``,n),$b=class{constructor(e,t){this.core=e,this.logger=t,Qb(this,`keychain`,new Map),Qb(this,`name`,Ov),Qb(this,`version`,`0.3`),Qb(this,`initialized`,!1),Qb(this,`storagePrefix`,Sv),Qb(this,`init`,async()=>{if(!this.initialized){let e=await this.getKeyChain();typeof e<`u`&&(this.keychain=e),this.initialized=!0}}),Qb(this,`has`,e=>(this.isInitialized(),this.keychain.has(e))),Qb(this,`set`,async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()}),Qb(this,`get`,e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>`u`){let{message:t}=J(`NO_MATCHING_KEY`,`${this.name}: ${e}`);throw Error(t)}return t}),Qb(this,`del`,async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()}),this.core=e,this.logger=Mt(t,this.name)}get context(){return At(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+`//`+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,tp(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<`u`?np(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}},ex=Object.defineProperty,tx=(e,t,n)=>t in e?ex(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,nx=(e,t,n)=>tx(e,typeof t==`symbol`?t:t+``,n),rx=class{constructor(e,t,n){this.core=e,this.logger=t,nx(this,`name`,Tv),nx(this,`keychain`),nx(this,`randomSessionIdentifier`,Ug()),nx(this,`initialized`,!1),nx(this,`init`,async()=>{this.initialized||=(await this.keychain.init(),!0)}),nx(this,`hasKeys`,e=>(this.isInitialized(),this.keychain.has(e))),nx(this,`getClientId`,async()=>(this.isInitialized(),za(Ga(await this.getClientSeed()).publicKey))),nx(this,`generateKeyPair`,()=>{this.isInitialized();let e=Hg();return this.setPrivateKey(e.publicKey,e.privateKey)}),nx(this,`signJWT`,async e=>{this.isInitialized();let t=Ga(await this.getClientSeed()),n=this.randomSessionIdentifier;return await Ka(n,e,Dv,t)}),nx(this,`generateSharedKey`,(e,t,n)=>{this.isInitialized();let r=Wg(this.getPrivateKey(e),t);return this.setSymKey(r,n)}),nx(this,`setSymKey`,async(e,t)=>{this.isInitialized();let n=t||Gg(e);return await this.keychain.set(n,e),n}),nx(this,`deleteKeyPair`,async e=>{this.isInitialized(),await this.keychain.del(e)}),nx(this,`deleteSymKey`,async e=>{this.isInitialized(),await this.keychain.del(e)}),nx(this,`encode`,async(e,t,n)=>{this.isInitialized();let r=n_(n),i=qe(t);if(i_(r))return Zg(i,n?.encoding);if(r_(r)){let t=r.senderPublicKey,n=r.receiverPublicKey;e=await this.generateSharedKey(t,n)}let a=this.getSymKey(e),{type:o,senderPublicKey:s}=r;return Yg({type:o,symKey:a,message:i,senderPublicKey:s,encoding:n?.encoding})}),nx(this,`decode`,async(e,t,n)=>{this.isInitialized();let r=t_(t,n);if(i_(r))return Ke(Qg(t,n?.encoding));if(r_(r)){let t=r.receiverPublicKey,n=r.senderPublicKey;e=await this.generateSharedKey(t,n)}try{return Ke(Xg({symKey:this.getSymKey(e),encoded:t,encoding:n?.encoding}))}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}}),nx(this,`getPayloadType`,(e,t=Fg)=>Jg(e_({encoded:e,encoding:t}).type)),nx(this,`getPayloadSenderPublicKey`,(e,t=Fg)=>{let n=e_({encoded:e,encoding:t});return n.senderPublicKey?rc(n.senderPublicKey,Pg):void 0}),this.core=e,this.logger=Mt(t,this.name),this.keychain=n||new $b(this.core,this.logger)}get context(){return At(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e=``;try{e=this.keychain.get(Ev)}catch{e=Ug(),await this.keychain.set(Ev,e)}return Yb(e,`base16`)}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}},ix=Object.defineProperty,ax=(e,t,n)=>t in e?ix(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ox=(e,t,n)=>ax(e,typeof t==`symbol`?t:t+``,n),sx=class extends ed{constructor(e,t){super(e,t),this.logger=e,this.core=t,ox(this,`messages`,new Map),ox(this,`name`,kv),ox(this,`version`,`0.3`),ox(this,`initialized`,!1),ox(this,`storagePrefix`,Sv),ox(this,`init`,async()=>{if(!this.initialized){this.logger.trace(`Initialized`);try{let e=await this.getRelayerMessages();typeof e<`u`&&(this.messages=e),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:`method`,method:`restore`,size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}}),ox(this,`set`,async(e,t)=>{this.isInitialized();let n=Kg(t),r=this.messages.get(e);return typeof r>`u`&&(r={}),typeof r[n]<`u`||(r[n]=t,this.messages.set(e,r),await this.persist()),n}),ox(this,`get`,e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>`u`&&(t={}),t}),ox(this,`has`,(e,t)=>(this.isInitialized(),typeof this.get(e)[Kg(t)]<`u`)),ox(this,`del`,async e=>{this.isInitialized(),this.messages.delete(e),await this.persist()}),this.logger=Mt(e,this.name),this.core=t}get context(){return At(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+`//`+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,tp(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return typeof e<`u`?np(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}},cx=Object.defineProperty,lx=Object.defineProperties,ux=Object.getOwnPropertyDescriptors,dx=Object.getOwnPropertySymbols,fx=Object.prototype.hasOwnProperty,px=Object.prototype.propertyIsEnumerable,mx=(e,t,n)=>t in e?cx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hx=(e,t)=>{for(var n in t||={})fx.call(t,n)&&mx(e,n,t[n]);if(dx)for(var n of dx(t))px.call(t,n)&&mx(e,n,t[n]);return e},gx=(e,t)=>lx(e,ux(t)),_x=(e,t,n)=>mx(e,typeof t==`symbol`?t:t+``,n),vx=class extends td{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,_x(this,`events`,new ae.EventEmitter),_x(this,`name`,jv),_x(this,`queue`,new Map),_x(this,`publishTimeout`,(0,V.toMiliseconds)(V.ONE_MINUTE)),_x(this,`initialPublishTimeout`,(0,V.toMiliseconds)(V.ONE_SECOND*15)),_x(this,`needsTransportRestart`,!1),_x(this,`publish`,async(e,t,n)=>{var r;this.logger.debug(`Publishing Payload`),this.logger.trace({type:`method`,method:`publish`,params:{topic:e,message:t,opts:n}});let i=n?.ttl||Av,a=l_(n),o=n?.prompt||!1,s=n?.tag||0,c=n?.id||Zl().toString(),l={topic:e,message:t,opts:{ttl:i,relay:a,prompt:o,tag:s,id:c,attestation:n?.attestation,tvf:n?.tvf}},u=`Failed to publish payload, please try again. id:${c} tag:${s}`;try{let r=new Promise(async r=>{let a=({id:e})=>{l.opts.id===e&&(this.removeRequestFromQueue(e),this.relayer.events.removeListener(Nv.publish,a),r(l))};this.relayer.events.on(Nv.publish,a);let u=ip(new Promise((r,a)=>{this.rpcPublish({topic:e,message:t,ttl:i,prompt:o,tag:s,id:c,attestation:n?.attestation,tvf:n?.tvf}).then(r).catch(e=>{this.logger.warn(e,e?.message),a(e)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${c} tag:${s}`);try{await u,this.events.removeListener(Nv.publish,a)}catch(e){this.queue.set(c,gx(hx({},l),{attempt:1})),this.logger.warn(e,e?.message)}});this.logger.trace({type:`method`,method:`publish`,params:{id:c,topic:e,message:t,opts:n}}),await ip(r,this.publishTimeout,u)}catch(e){if(this.logger.debug(`Failed to Publish Payload`),this.logger.error(e),(r=n?.internal)!=null&&r.throwOnFailedPublish)throw e}finally{this.queue.delete(c)}}),_x(this,`on`,(e,t)=>{this.events.on(e,t)}),_x(this,`once`,(e,t)=>{this.events.once(e,t)}),_x(this,`off`,(e,t)=>{this.events.off(e,t)}),_x(this,`removeListener`,(e,t)=>{this.events.removeListener(e,t)}),this.relayer=e,this.logger=Mt(t,this.name),this.registerEventListeners()}get context(){return At(this.logger)}async rpcPublish(e){var t,n;let{topic:r,message:i,ttl:a=Av,prompt:o,tag:s,id:c,attestation:l,tvf:u}=e,d={method:u_(l_().protocol).publish,params:hx({topic:r,message:i,ttl:a,prompt:o,tag:s,attestation:l},u),id:c};A_(d.params?.prompt)&&((t=d.params)==null||delete t.prompt),A_(d.params?.tag)&&((n=d.params)==null||delete n.tag),this.logger.debug(`Outgoing Relay Payload`),this.logger.trace({type:`message`,direction:`outgoing`,request:d});let f=await this.relayer.request(d);return this.relayer.events.emit(Nv.publish,e),this.logger.debug(`Successfully Published Payload`),f}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{let n=e.attempt+1;this.queue.set(t,gx(hx({},e),{attempt:n}));let{topic:r,message:i,opts:a,attestation:o}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${n}`),await this.rpcPublish(gx(hx({},e),{topic:r,message:i,ttl:a.ttl,prompt:a.prompt,tag:a.tag,id:a.id,attestation:o,tvf:a.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(ce.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(Nv.connection_stalled);return}this.checkQueue()}),this.relayer.on(Nv.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}},yx=Object.defineProperty,bx=(e,t,n)=>t in e?yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xx=(e,t,n)=>bx(e,typeof t==`symbol`?t:t+``,n),Sx=class{constructor(){xx(this,`map`,new Map),xx(this,`set`,(e,t)=>{let n=this.get(e);this.exists(e,t)||this.map.set(e,[...n,t])}),xx(this,`get`,e=>this.map.get(e)||[]),xx(this,`exists`,(e,t)=>this.get(e).includes(t)),xx(this,`delete`,(e,t)=>{if(typeof t>`u`){this.map.delete(e);return}if(!this.map.has(e))return;let n=this.get(e);if(!this.exists(e,t))return;let r=n.filter(e=>e!==t);if(!r.length){this.map.delete(e);return}this.map.set(e,r)}),xx(this,`clear`,()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}},Cx=Object.defineProperty,wx=Object.defineProperties,Tx=Object.getOwnPropertyDescriptors,Ex=Object.getOwnPropertySymbols,Dx=Object.prototype.hasOwnProperty,Ox=Object.prototype.propertyIsEnumerable,kx=(e,t,n)=>t in e?Cx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ax=(e,t)=>{for(var n in t||={})Dx.call(t,n)&&kx(e,n,t[n]);if(Ex)for(var n of Ex(t))Ox.call(t,n)&&kx(e,n,t[n]);return e},jx=(e,t)=>wx(e,Tx(t)),Mx=(e,t,n)=>kx(e,typeof t==`symbol`?t:t+``,n),Nx=class extends id{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,Mx(this,`subscriptions`,new Map),Mx(this,`topicMap`,new Sx),Mx(this,`events`,new ae.EventEmitter),Mx(this,`name`,zv),Mx(this,`version`,`0.3`),Mx(this,`pending`,new Map),Mx(this,`cached`,[]),Mx(this,`initialized`,!1),Mx(this,`pendingSubscriptionWatchLabel`,`pending_sub_watch_label`),Mx(this,`pollingInterval`,20),Mx(this,`storagePrefix`,Sv),Mx(this,`subscribeTimeout`,(0,V.toMiliseconds)(V.ONE_MINUTE)),Mx(this,`initialSubscribeTimeout`,(0,V.toMiliseconds)(V.ONE_SECOND*15)),Mx(this,`clientId`),Mx(this,`batchSubscribeTopicsLimit`,500),Mx(this,`init`,async()=>{this.initialized||(this.logger.trace(`Initialized`),this.registerEventListeners(),await this.restore()),this.initialized=!0}),Mx(this,`subscribe`,async(e,t)=>{this.isInitialized(),this.logger.debug(`Subscribing Topic`),this.logger.trace({type:`method`,method:`subscribe`,params:{topic:e,opts:t}});try{let n=l_(t),r={topic:e,relay:n,transportType:t?.transportType};this.pending.set(e,r);let i=await this.rpcSubscribe(e,n,t);return typeof i==`string`&&(this.onSubscribe(i,r),this.logger.debug(`Successfully Subscribed Topic`),this.logger.trace({type:`method`,method:`subscribe`,params:{topic:e,opts:t}})),i}catch(e){throw this.logger.debug(`Failed to Subscribe Topic`),this.logger.error(e),e}}),Mx(this,`unsubscribe`,async(e,t)=>{this.isInitialized(),typeof t?.id<`u`?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)}),Mx(this,`isSubscribed`,async e=>{if(this.topics.includes(e))return!0;let t=`${this.pendingSubscriptionWatchLabel}_${e}`;return await new Promise((n,r)=>{let i=new V.Watch;i.start(t);let a=setInterval(()=>{(!this.pending.has(e)&&this.topics.includes(e)||this.cached.some(t=>t.topic===e))&&(clearInterval(a),i.stop(t),n(!0)),i.elapsed(t)>=Bv&&(clearInterval(a),i.stop(t),r(Error(`Subscription resolution timeout`)))},this.pollingInterval)}).catch(()=>!1)}),Mx(this,`on`,(e,t)=>{this.events.on(e,t)}),Mx(this,`once`,(e,t)=>{this.events.once(e,t)}),Mx(this,`off`,(e,t)=>{this.events.off(e,t)}),Mx(this,`removeListener`,(e,t)=>{this.events.removeListener(e,t)}),Mx(this,`start`,async()=>{await this.onConnect()}),Mx(this,`stop`,async()=>{await this.onDisconnect()}),Mx(this,`restart`,async()=>{await this.restore(),await this.onRestart()}),Mx(this,`checkPending`,async()=>{if(this.pending.size===0&&(!this.initialized||!this.relayer.connected))return;let e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}),Mx(this,`registerEventListeners`,()=>{this.relayer.core.heartbeat.on(ce.pulse,async()=>{await this.checkPending()}),this.events.on(Rv.created,async e=>{let t=Rv.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,data:e}),await this.persist()}),this.events.on(Rv.deleted,async e=>{let t=Rv.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,data:e}),await this.persist()})}),this.relayer=e,this.logger=Mt(t,this.name),this.clientId=``}get context(){return At(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+`//`+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,t){let n=!1;try{n=this.getSubscription(e).topic===t}catch{}return n}reset(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){let n=this.topicMap.get(e);await Promise.all(n.map(async n=>await this.unsubscribeById(e,n,t)))}async unsubscribeById(e,t,n){this.logger.debug(`Unsubscribing Topic`),this.logger.trace({type:`method`,method:`unsubscribe`,params:{topic:e,id:t,opts:n}});try{let r=l_(n);await this.restartToComplete({topic:e,id:t,relay:r}),await this.rpcUnsubscribe(e,t,r);let i=D_(`USER_DISCONNECTED`,`${this.name}, ${e}`);await this.onUnsubscribe(e,t,i),this.logger.debug(`Successfully Unsubscribed Topic`),this.logger.trace({type:`method`,method:`unsubscribe`,params:{topic:e,id:t,opts:n}})}catch(e){throw this.logger.debug(`Failed to Unsubscribe Topic`),this.logger.error(e),e}}async rpcSubscribe(e,t,n){(!n||n?.transportType===Iv.relay)&&await this.restartToComplete({topic:e,id:e,relay:t});let r={method:u_(t.protocol).subscribe,params:{topic:e}};this.logger.debug(`Outgoing Relay Payload`),this.logger.trace({type:`payload`,direction:`outgoing`,request:r});let i=n?.internal?.throwOnFailedPublish;try{let t=await this.getSubscriptionId(e);if(n?.transportType===Iv.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(r).catch(e=>this.logger.warn(e))},(0,V.toMiliseconds)(V.ONE_SECOND)),t;let a=await ip(new Promise(async t=>{let n=r=>{r.topic===e&&(this.events.removeListener(Rv.created,n),t(r.id))};this.events.on(Rv.created,n);try{let i=await ip(new Promise((e,t)=>{this.relayer.request(r).catch(e=>{this.logger.warn(e,e?.message),t(e)}).then(e)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(Rv.created,n),t(i)}catch{}}),this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!a&&i)throw Error(`Subscribing to ${e} failed, please try again`);return a?t:null}catch(e){if(this.logger.debug(`Outgoing Relay Subscribe Payload stalled`),this.relayer.events.emit(Nv.connection_stalled),i)throw e}return null}async rpcBatchSubscribe(e){if(!e.length)return;let t=e[0].relay,n={method:u_(t.protocol).batchSubscribe,params:{topics:e.map(e=>e.topic)}};this.logger.debug(`Outgoing Relay Payload`),this.logger.trace({type:`payload`,direction:`outgoing`,request:n});try{await await ip(new Promise(e=>{this.relayer.request(n).catch(e=>this.logger.warn(e)).then(e)}),this.subscribeTimeout,`rpcBatchSubscribe failed, please try again`)}catch{this.relayer.events.emit(Nv.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;let t=e[0].relay,n={method:u_(t.protocol).batchFetchMessages,params:{topics:e.map(e=>e.topic)}};this.logger.debug(`Outgoing Relay Payload`),this.logger.trace({type:`payload`,direction:`outgoing`,request:n});let r;try{r=await await ip(new Promise((e,t)=>{this.relayer.request(n).catch(e=>{this.logger.warn(e),t(e)}).then(e)}),this.subscribeTimeout,`rpcBatchFetchMessages failed, please try again`)}catch{this.relayer.events.emit(Nv.connection_stalled)}return r}rpcUnsubscribe(e,t,n){let r={method:u_(n.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug(`Outgoing Relay Payload`),this.logger.trace({type:`payload`,direction:`outgoing`,request:r}),this.relayer.request(r)}onSubscribe(e,t){this.setSubscription(e,jx(Ax({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,Ax({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(e,t,n){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,n),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug(`Setting subscription`),this.logger.trace({type:`method`,method:`setSubscription`,id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,Ax({},t)),this.topicMap.set(t.topic,e),this.events.emit(Rv.created,t)}getSubscription(e){this.logger.debug(`Getting subscription`),this.logger.trace({type:`method`,method:`getSubscription`,id:e});let t=this.subscriptions.get(e);if(!t){let{message:t}=J(`NO_MATCHING_KEY`,`${this.name}: ${e}`);throw Error(t)}return t}deleteSubscription(e,t){this.logger.debug(`Deleting subscription`),this.logger.trace({type:`method`,method:`deleteSubscription`,id:e,reason:t});let n=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(n.topic,e),this.events.emit(Rv.deleted,jx(Ax({},n),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(Rv.sync)}async onRestart(){if(this.cached.length){let e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let n=0;n<t;n++){let t=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(t)}}this.events.emit(Rv.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>`u`||!e.length)return;if(this.subscriptions.size){let{message:e}=J(`RESTORE_WILL_OVERRIDE`,this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:`method`,method:`restore`,subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async e=>jx(Ax({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let t=await this.rpcBatchFetchMessages(e);t&&t.messages&&(await Cp((0,V.toMiliseconds)(V.ONE_SECOND)),await this.relayer.handleBatchMessageEvents(t.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}async restartToComplete(e){!this.relayer.connected&&!this.relayer.connecting&&(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||=await this.relayer.core.crypto.getClientId(),this.clientId}async getSubscriptionId(e){return Kg(e+await this.getClientId())}},Px=Object.defineProperty,Fx=Object.getOwnPropertySymbols,Ix=Object.prototype.hasOwnProperty,Lx=Object.prototype.propertyIsEnumerable,Rx=(e,t,n)=>t in e?Px(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zx=(e,t)=>{for(var n in t||={})Ix.call(t,n)&&Rx(e,n,t[n]);if(Fx)for(var n of Fx(t))Lx.call(t,n)&&Rx(e,n,t[n]);return e},Y=(e,t,n)=>Rx(e,typeof t==`symbol`?t:t+``,n),Bx=class extends nd{constructor(e){super(e),Y(this,`protocol`,`wc`),Y(this,`version`,2),Y(this,`core`),Y(this,`logger`),Y(this,`events`,new ae.EventEmitter),Y(this,`provider`),Y(this,`messages`),Y(this,`subscriber`),Y(this,`publisher`),Y(this,`name`,Mv),Y(this,`transportExplicitlyClosed`,!1),Y(this,`initialized`,!1),Y(this,`connectionAttemptInProgress`,!1),Y(this,`relayUrl`),Y(this,`projectId`),Y(this,`packageName`),Y(this,`bundleId`),Y(this,`hasExperiencedNetworkDisruption`,!1),Y(this,`pingTimeout`),Y(this,`heartBeatTimeout`,(0,V.toMiliseconds)(V.THIRTY_SECONDS+V.FIVE_SECONDS)),Y(this,`reconnectTimeout`),Y(this,`connectPromise`),Y(this,`reconnectInProgress`,!1),Y(this,`requestsInFlight`,[]),Y(this,`connectTimeout`,(0,V.toMiliseconds)(V.ONE_SECOND*15)),Y(this,`request`,async e=>{this.logger.debug(`Publishing Request Payload`);let t=e.id||Zl().toString();await this.toEstablishConnection();try{this.logger.trace({id:t,method:e.method,topic:e.params?.topic},`relayer.request - publishing...`);let n=`${t}:${e.params?.tag||``}`;this.requestsInFlight.push(n);let r=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(e=>e!==n),r}catch(e){throw this.logger.debug(`Failed to Publish Request: ${t}`),e}}),Y(this,`resetPingTimeout`,()=>{if(Vf())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e;this.logger.debug({},`pingTimeout: Connection stalled, terminating...`),(e=this.provider?.connection?.socket)==null||e.terminate()},this.heartBeatTimeout)}catch(e){this.logger.warn(e,e?.message)}}),Y(this,`onPayloadHandler`,e=>{this.onProviderPayload(e),this.resetPingTimeout()}),Y(this,`onConnectHandler`,()=>{this.logger.warn({},`Relayer connected 🛜`),this.startPingTimeout(),this.events.emit(Nv.connect)}),Y(this,`onDisconnectHandler`,()=>{this.logger.warn({},`Relayer disconnected 🛑`),this.requestsInFlight=[],this.onProviderDisconnect()}),Y(this,`onProviderErrorHandler`,e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(Nv.error,e),this.logger.fatal(`Fatal socket error received, closing transport`),this.transportClose()}),Y(this,`registerProviderListeners`,()=>{this.provider.on(Pv.payload,this.onPayloadHandler),this.provider.on(Pv.connect,this.onConnectHandler),this.provider.on(Pv.disconnect,this.onDisconnectHandler),this.provider.on(Pv.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=typeof e.logger<`u`&&typeof e.logger!=`string`?Mt(e.logger,this.name):(0,lt.default)(Dt({level:e.logger||`error`})),this.messages=new sx(this.logger,e.core),this.subscriber=new Nx(this,this.logger),this.publisher=new vx(this,this.logger),this.relayUrl=e?.relayUrl||`wss://relay.walletconnect.org`,this.projectId=e.projectId,Uf()?this.packageName=qf():Wf()&&(this.bundleId=qf()),this.provider={}}async init(){if(this.logger.trace(`Initialized`),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return At(this.logger)}get connected(){return this.provider?.connection?.socket?.readyState===1||!1}get connecting(){return this.provider?.connection?.socket?.readyState===0||this.connectPromise!==void 0||!1}async publish(e,t,n){this.isInitialized(),await this.publisher.publish(e,t,n),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:Iv.relay})}async subscribe(e,t){this.isInitialized(),(!(t!=null&&t.transportType)||t?.transportType===`relay`)&&await this.toEstablishConnection();let n=typeof t?.internal?.throwOnFailedPublish>`u`?!0:t?.internal?.throwOnFailedPublish,r=this.subscriber.topicMap.get(e)?.[0]||``,i,a=t=>{t.topic===e&&(this.subscriber.off(Rv.created,a),i())};return await Promise.all([new Promise(e=>{i=e,this.subscriber.on(Rv.created,a)}),new Promise(async(i,a)=>{r=await this.subscriber.subscribe(e,zx({internal:{throwOnFailedPublish:n}},t)).catch(e=>{n&&a(e)})||r,i()})]),r}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await ip(this.provider.disconnect(),2e3,`provider.disconnect()`).catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.warn(`Starting WS connection skipped because the client has no topics to work with.`);return}if(this.connectPromise?(this.logger.debug({},`Waiting for existing connection attempt to resolve...`),await this.connectPromise,this.logger.debug({},`Existing connection attempt resolved`)):(this.connectPromise=new Promise(async(t,n)=>{await this.connect(e).then(t).catch(n).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},`Restarting transport...`),!this.connectionAttemptInProgress&&(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await dv())throw Error(`No internet connection detected. Please restart your network and try again.`)}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace(`Batch message events is empty. Ignoring...`);return}let t=e.sort((e,t)=>e.publishedAt-t.publishedAt);this.logger.debug(`Batch of ${t.length} message events sorted`);for(let e of t)try{await this.onMessageEvent(e)}catch(e){this.logger.warn(e,`Error while processing batch message event: `+e?.message)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){let{topic:n}=e;if(!t.sessionExists){let e={topic:n,expiry:lp(V.FIVE_MINUTES),relay:{protocol:`irn`},active:!1};await this.core.pairing.pairings.set(n,e)}this.events.emit(Nv.message,e),await this.recordMessageEvent(e)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(e,t)=>{let n=()=>{t(Error(`Connection interrupted while trying to subscribe`))};this.provider.once(Pv.disconnect,n),await ip(new Promise((e,t)=>{this.provider.connect().then(e).catch(t)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(e=>{t(e)}).finally(()=>{this.provider.off(Pv.disconnect,n),clearTimeout(this.reconnectTimeout)}),await new Promise(async(e,t)=>{let n=()=>{t(Error(`Connection interrupted while trying to subscribe`))};this.provider.once(Pv.disconnect,n),await this.subscriber.start().then(e).catch(t).finally(()=>{this.provider.off(Pv.disconnect,n)})}),this.hasExperiencedNetworkDisruption=!1,e()})}catch(e){await this.subscriber.stop();let t=e;this.logger.warn({},t.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(e=>setTimeout(e,(0,V.toMiliseconds)(t*1))),t++}}startPingTimeout(){var e,t;if(Vf())try{(e=this.provider?.connection)!=null&&e.socket&&((t=this.provider?.connection?.socket)==null||t.on(`ping`,()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(e){this.logger.warn(e,e?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new Tu(new Mu($f({sdkVersion:Fv,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e){let{topic:t,message:n}=e;await this.messages.set(t,n)}async shouldIgnoreMessageEvent(e){let{topic:t,message:n}=e;if(!n||n.length===0)return this.logger.warn(`Ignoring invalid/empty message: ${n}`),!0;if(!await this.subscriber.isSubscribed(t))return this.logger.warn(`Ignoring message for non-subscribed topic ${t}`),!0;let r=this.messages.has(t,n);return r&&this.logger.warn(`Ignoring duplicate message: ${n}`),r}async onProviderPayload(e){if(this.logger.debug(`Incoming Relay Payload`),this.logger.trace({type:`payload`,direction:`incoming`,payload:e}),yu(e)){if(!e.method.endsWith(`_subscription`))return;let t=e.params,{topic:n,message:r,publishedAt:i,attestation:a}=t.data,o={topic:n,message:r,publishedAt:i,transportType:Iv.relay,attestation:a};this.logger.debug(`Emitting Relayer Payload`),this.logger.trace(zx({type:`event`,event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else bu(e)&&this.events.emit(Nv.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(Nv.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){let t=$l(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(Pv.payload,this.onPayloadHandler),this.provider.off(Pv.connect,this.onConnectHandler),this.provider.off(Pv.disconnect,this.onDisconnectHandler),this.provider.off(Pv.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await dv();hv(async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(e=>this.logger.error(e,e?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(Nv.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},(0,V.toMiliseconds)(.1)))))}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&await this.connect()}},Vx=Object.defineProperty,Hx=Object.getOwnPropertySymbols,Ux=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,Gx=(e,t,n)=>t in e?Vx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Kx=(e,t)=>{for(var n in t||={})Ux.call(t,n)&&Gx(e,n,t[n]);if(Hx)for(var n of Hx(t))Wx.call(t,n)&&Gx(e,n,t[n]);return e},qx=(e,t,n)=>Gx(e,typeof t==`symbol`?t:t+``,n),Jx=class extends rd{constructor(e,t,n,r=Sv,i=void 0){super(e,t,n,r),this.core=e,this.logger=t,this.name=n,qx(this,`map`,new Map),qx(this,`version`,`0.3`),qx(this,`cached`,[]),qx(this,`initialized`,!1),qx(this,`getKey`),qx(this,`storagePrefix`,Sv),qx(this,`recentlyDeleted`,[]),qx(this,`recentlyDeletedLimit`,200),qx(this,`init`,async()=>{this.initialized||=(this.logger.trace(`Initialized`),await this.restore(),this.cached.forEach(e=>{this.getKey&&e!==null&&!A_(e)?this.map.set(this.getKey(e),e):L_(e)?this.map.set(e.id,e):R_(e)&&this.map.set(e.topic,e)}),this.cached=[],!0)}),qx(this,`set`,async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug(`Setting value`),this.logger.trace({type:`method`,method:`set`,key:e,value:t}),this.map.set(e,t),await this.persist())}),qx(this,`get`,e=>(this.isInitialized(),this.logger.debug(`Getting value`),this.logger.trace({type:`method`,method:`get`,key:e}),this.getData(e))),qx(this,`getAll`,e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(n=>(0,bv.default)(t[n],e[n]))):this.values)),qx(this,`update`,async(e,t)=>{this.isInitialized(),this.logger.debug(`Updating value`),this.logger.trace({type:`method`,method:`update`,key:e,update:t});let n=Kx(Kx({},this.getData(e)),t);this.map.set(e,n),await this.persist()}),qx(this,`delete`,async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug(`Deleting value`),this.logger.trace({type:`method`,method:`delete`,key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())}),this.logger=Mt(t,this.name),this.storagePrefix=r,this.getKey=i}get context(){return At(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+`//`+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){let{message:t}=J(`MISSING_OR_INVALID`,`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),Error(t)}let{message:t}=J(`NO_MATCHING_KEY`,`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>`u`||!e.length)return;if(this.map.size){let{message:e}=J(`RESTORE_WILL_OVERRIDE`,this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:`method`,method:`restore`,value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}},Yx=Object.defineProperty,Xx=(e,t,n)=>t in e?Yx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,X=(e,t,n)=>Xx(e,typeof t==`symbol`?t:t+``,n),Zx=class{constructor(e,t){this.core=e,this.logger=t,X(this,`name`,Vv),X(this,`version`,`0.3`),X(this,`events`,new ae.default),X(this,`pairings`),X(this,`initialized`,!1),X(this,`storagePrefix`,Sv),X(this,`ignoredPayloadTypes`,[1]),X(this,`registeredMethods`,[]),X(this,`init`,async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace(`Initialized`))}),X(this,`register`,({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]}),X(this,`create`,async e=>{this.isInitialized();let t=Ug(),n=await this.core.crypto.setSymKey(t),r=lp(V.FIVE_MINUTES),i={protocol:`irn`},a={topic:n,expiry:r,relay:i,active:!1,methods:e?.methods},o=h_({protocol:this.core.protocol,version:this.core.version,topic:n,symKey:t,relay:i,expiryTimestamp:r,methods:e?.methods});return this.events.emit(Uv.create,a),this.core.expirer.set(n,r),await this.pairings.set(n,a),await this.core.relayer.subscribe(n,{transportType:e?.transportType}),{topic:n,uri:o}}),X(this,`pair`,async e=>{this.isInitialized();let t=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[ty.pairing_started]}});this.isValidPair(e,t);let{topic:n,symKey:r,relay:i,expiryTimestamp:a,methods:o}=f_(e.uri);t.props.properties.topic=n,t.addTrace(ty.pairing_uri_validation_success),t.addTrace(ty.pairing_uri_not_expired);let s;if(this.pairings.keys.includes(n)){if(s=this.pairings.get(n),t.addTrace(ty.existing_pairing),s.active)throw t.setError(ny.active_pairing_already_exists),Error(`Pairing already exists: ${n}. Please try again with a new connection URI.`);t.addTrace(ty.pairing_not_expired)}let c=a||lp(V.FIVE_MINUTES),l={topic:n,relay:i,expiry:c,active:!1,methods:o};this.core.expirer.set(n,c),await this.pairings.set(n,l),t.addTrace(ty.store_new_pairing),e.activatePairing&&await this.activate({topic:n}),this.events.emit(Uv.create,l),t.addTrace(ty.emit_inactive_pairing),this.core.crypto.keychain.has(n)||await this.core.crypto.setSymKey(r,n),t.addTrace(ty.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{t.setError(ny.no_internet_connection)}try{await this.core.relayer.subscribe(n,{relay:i})}catch(e){throw t.setError(ny.subscribe_pairing_topic_failure),e}return t.addTrace(ty.subscribe_pairing_topic_success),l}),X(this,`activate`,async({topic:e})=>{this.isInitialized();let t=lp(V.FIVE_MINUTES);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})}),X(this,`ping`,async e=>{this.isInitialized(),await this.isValidPing(e),this.logger.warn(`ping() is deprecated and will be removed in the next major release.`);let{topic:t}=e;if(this.pairings.keys.includes(t)){let e=await this.sendRequest(t,`wc_pairingPing`,{}),{done:n,resolve:r,reject:i}=rp();this.events.once(K(`pairing_ping`,e),({error:e})=>{e?i(e):r()}),await n()}}),X(this,`updateExpiry`,async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})}),X(this,`updateMetadata`,async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})}),X(this,`getPairings`,()=>(this.isInitialized(),this.pairings.values)),X(this,`disconnect`,async e=>{this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,`wc_pairingDelete`,D_(`USER_DISCONNECTED`)),await this.deletePairing(t))}),X(this,`formatUriFromPairing`,e=>{this.isInitialized();let{topic:t,relay:n,expiry:r,methods:i}=e,a=this.core.crypto.keychain.get(t);return h_({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:a,relay:n,expiryTimestamp:r,methods:i})}),X(this,`sendRequest`,async(e,t,n)=>{let r=Ql(t,n),i=await this.core.crypto.encode(e,r),a=Hv[t].req;return this.core.history.set(e,r),this.core.relayer.publish(e,i,a),r.id}),X(this,`sendResult`,async(e,t,n)=>{let r=$l(e,n),i=await this.core.crypto.encode(t,r),a=Hv[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,i,a),await this.core.history.resolve(r)}),X(this,`sendError`,async(e,t,n)=>{let r=eu(e,n),i=await this.core.crypto.encode(t,r),a=(await this.core.history.get(t,e)).request.method,o=Hv[a]?Hv[a].res:Hv.unregistered_method.res;await this.core.relayer.publish(t,i,o),await this.core.history.resolve(r)}),X(this,`deletePairing`,async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,D_(`USER_DISCONNECTED`)),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])}),X(this,`cleanup`,async()=>{let e=this.pairings.getAll().filter(e=>up(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))}),X(this,`onRelayEventRequest`,e=>{let{topic:t,payload:n}=e;switch(n.method){case`wc_pairingPing`:return this.onPairingPingRequest(t,n);case`wc_pairingDelete`:return this.onPairingDeleteRequest(t,n);default:return this.onUnknownRpcMethodRequest(t,n)}}),X(this,`onRelayEventResponse`,async e=>{let{topic:t,payload:n}=e,r=(await this.core.history.get(t,n.id)).request.method;switch(r){case`wc_pairingPing`:return this.onPairingPingResponse(t,n);default:return this.onUnknownRpcMethodResponse(r)}}),X(this,`onPairingPingRequest`,async(e,t)=>{let{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult(n,e,!0),this.events.emit(Uv.ping,{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.logger.error(t)}}),X(this,`onPairingPingResponse`,(e,t)=>{let{id:n}=t;setTimeout(()=>{xu(t)?this.events.emit(K(`pairing_ping`,n),{}):Su(t)&&this.events.emit(K(`pairing_ping`,n),{error:t.error})},500)}),X(this,`onPairingDeleteRequest`,async(e,t)=>{let{id:n}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(Uv.delete,{id:n,topic:e})}catch(t){await this.sendError(n,e,t),this.logger.error(t)}}),X(this,`onUnknownRpcMethodRequest`,async(e,t)=>{let{id:n,method:r}=t;try{if(this.registeredMethods.includes(r))return;let t=D_(`WC_METHOD_UNSUPPORTED`,r);await this.sendError(n,e,t),this.logger.error(t)}catch(t){await this.sendError(n,e,t),this.logger.error(t)}}),X(this,`onUnknownRpcMethodResponse`,e=>{this.registeredMethods.includes(e)||this.logger.error(D_(`WC_METHOD_UNSUPPORTED`,e))}),X(this,`isValidPair`,(e,t)=>{var n;if(!Q_(e)){let{message:n}=J(`MISSING_OR_INVALID`,`pair() params: ${e}`);throw t.setError(ny.malformed_pairing_uri),Error(n)}if(!I_(e.uri)){let{message:n}=J(`MISSING_OR_INVALID`,`pair() uri: ${e.uri}`);throw t.setError(ny.malformed_pairing_uri),Error(n)}let r=f_(e?.uri);if(!((n=r?.relay)!=null&&n.protocol)){let{message:e}=J(`MISSING_OR_INVALID`,`pair() uri#relay-protocol`);throw t.setError(ny.malformed_pairing_uri),Error(e)}if(!(r!=null&&r.symKey)){let{message:e}=J(`MISSING_OR_INVALID`,`pair() uri#symKey`);throw t.setError(ny.malformed_pairing_uri),Error(e)}if(r!=null&&r.expiryTimestamp&&(0,V.toMiliseconds)(r?.expiryTimestamp)<Date.now()){t.setError(ny.pairing_expired);let{message:e}=J(`EXPIRED`,`pair() URI has expired. Please try again with a new connection URI.`);throw Error(e)}}),X(this,`isValidPing`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),X(this,`isValidDisconnect`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),X(this,`isValidPairingTopic`,async e=>{if(!j_(e,!1)){let{message:t}=J(`MISSING_OR_INVALID`,`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=J(`NO_MATCHING_KEY`,`pairing topic doesn't exist: ${e}`);throw Error(t)}if(up(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=J(`EXPIRED`,`pairing topic: ${e}`);throw Error(t)}}),this.core=e,this.logger=Mt(t,this.name),this.pairings=new Jx(this.core,this.logger,this.name,this.storagePrefix)}get context(){return At(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(Nv.message,async e=>{let{topic:t,message:n,transportType:r}=e;if(!this.pairings.keys.includes(t)||r===Iv.link_mode||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(n)))return;let i=await this.core.crypto.decode(t,n);try{yu(i)?(this.core.history.set(t,i),this.onRelayEventRequest({topic:t,payload:i})):bu(i)&&(await this.core.history.resolve(i),await this.onRelayEventResponse({topic:t,payload:i}),this.core.history.delete(t,i.id))}catch(e){this.logger.error(e)}})}registerExpirerEvents(){this.core.expirer.on(qv.expired,async e=>{let{topic:t}=cp(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(Uv.expire,{topic:t}))})}},Qx=Object.defineProperty,$x=(e,t,n)=>t in e?Qx(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,eS=(e,t,n)=>$x(e,typeof t==`symbol`?t:t+``,n),tS=class extends $u{constructor(e,t){super(e,t),this.core=e,this.logger=t,eS(this,`records`,new Map),eS(this,`events`,new ae.EventEmitter),eS(this,`name`,Gv),eS(this,`version`,`0.3`),eS(this,`cached`,[]),eS(this,`initialized`,!1),eS(this,`storagePrefix`,Sv),eS(this,`init`,async()=>{this.initialized||=(this.logger.trace(`Initialized`),await this.restore(),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),!0)}),eS(this,`set`,(e,t,n)=>{if(this.isInitialized(),this.logger.debug(`Setting JSON-RPC request history record`),this.logger.trace({type:`method`,method:`set`,topic:e,request:t,chainId:n}),this.records.has(t.id))return;let r={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:n,expiry:lp(V.THIRTY_DAYS)};this.records.set(r.id,r),this.persist(),this.events.emit(Wv.created,r)}),eS(this,`resolve`,async e=>{if(this.isInitialized(),this.logger.debug(`Updating JSON-RPC response history record`),this.logger.trace({type:`method`,method:`update`,response:e}),!this.records.has(e.id))return;let t=await this.getRecord(e.id);typeof t.response>`u`&&(t.response=Su(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(Wv.updated,t))}),eS(this,`get`,async(e,t)=>(this.isInitialized(),this.logger.debug(`Getting record`),this.logger.trace({type:`method`,method:`get`,topic:e,id:t}),await this.getRecord(t))),eS(this,`delete`,(e,t)=>{this.isInitialized(),this.logger.debug(`Deleting record`),this.logger.trace({type:`method`,method:`delete`,id:t}),this.values.forEach(n=>{if(n.topic===e){if(typeof t<`u`&&n.id!==t)return;this.records.delete(n.id),this.events.emit(Wv.deleted,n)}}),this.persist()}),eS(this,`exists`,async(e,t)=>(this.isInitialized(),this.records.has(t)?(await this.getRecord(t)).topic===e:!1)),eS(this,`on`,(e,t)=>{this.events.on(e,t)}),eS(this,`once`,(e,t)=>{this.events.once(e,t)}),eS(this,`off`,(e,t)=>{this.events.off(e,t)}),eS(this,`removeListener`,(e,t)=>{this.events.removeListener(e,t)}),this.logger=Mt(t,this.name)}get context(){return At(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+`//`+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(t=>{if(typeof t.response<`u`)return;let n={topic:t.topic,request:Ql(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(n)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let t=this.records.get(e);if(!t){let{message:t}=J(`NO_MATCHING_KEY`,`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(Wv.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>`u`||!e.length)return;if(this.records.size){let{message:e}=J(`RESTORE_WILL_OVERRIDE`,this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:`method`,method:`restore`,records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(Wv.created,e=>{let t=Wv.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,record:e})}),this.events.on(Wv.updated,e=>{let t=Wv.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,record:e})}),this.events.on(Wv.deleted,e=>{let t=Wv.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,record:e})}),this.core.heartbeat.on(ce.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{(0,V.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(Wv.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}},nS=Object.defineProperty,rS=(e,t,n)=>t in e?nS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,iS=(e,t,n)=>rS(e,typeof t==`symbol`?t:t+``,n),aS=class extends ad{constructor(e,t){super(e,t),this.core=e,this.logger=t,iS(this,`expirations`,new Map),iS(this,`events`,new ae.EventEmitter),iS(this,`name`,Kv),iS(this,`version`,`0.3`),iS(this,`cached`,[]),iS(this,`initialized`,!1),iS(this,`storagePrefix`,Sv),iS(this,`init`,async()=>{this.initialized||=(this.logger.trace(`Initialized`),await this.restore(),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),!0)}),iS(this,`has`,e=>{try{let t=this.formatTarget(e);return typeof this.getExpiration(t)<`u`}catch{return!1}}),iS(this,`set`,(e,t)=>{this.isInitialized();let n=this.formatTarget(e),r={target:n,expiry:t};this.expirations.set(n,r),this.checkExpiry(n,r),this.events.emit(qv.created,{target:n,expiration:r})}),iS(this,`get`,e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)}),iS(this,`del`,e=>{if(this.isInitialized(),this.has(e)){let t=this.formatTarget(e),n=this.getExpiration(t);this.expirations.delete(t),this.events.emit(qv.deleted,{target:t,expiration:n})}}),iS(this,`on`,(e,t)=>{this.events.on(e,t)}),iS(this,`once`,(e,t)=>{this.events.once(e,t)}),iS(this,`off`,(e,t)=>{this.events.off(e,t)}),iS(this,`removeListener`,(e,t)=>{this.events.removeListener(e,t)}),this.logger=Mt(t,this.name)}get context(){return At(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+`//`+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if(typeof e==`string`)return op(e);if(typeof e==`number`)return sp(e);let{message:t}=J(`UNKNOWN_TYPE`,`Target type: ${typeof e}`);throw Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(qv.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>`u`||!e.length)return;if(this.expirations.size){let{message:e}=J(`RESTORE_WILL_OVERRIDE`,this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:`method`,method:`restore`,expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let t=this.expirations.get(e);if(!t){let{message:t}=J(`NO_MATCHING_KEY`,`${this.name}: ${e}`);throw this.logger.warn(t),Error(t)}return t}checkExpiry(e,t){let{expiry:n}=t;(0,V.toMiliseconds)(n)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(qv.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(ce.pulse,()=>this.checkExpirations()),this.events.on(qv.created,e=>{let t=qv.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,data:e}),this.persist()}),this.events.on(qv.expired,e=>{let t=qv.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,data:e}),this.persist()}),this.events.on(qv.deleted,e=>{let t=qv.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:`event`,event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}},oS=Object.defineProperty,sS=(e,t,n)=>t in e?oS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,cS=(e,t,n)=>sS(e,typeof t==`symbol`?t:t+``,n),lS=class extends od{constructor(e,t,n){super(e,t,n),this.core=e,this.logger=t,this.store=n,cS(this,`name`,Jv),cS(this,`abortController`),cS(this,`isDevEnv`),cS(this,`verifyUrlV3`,Zv),cS(this,`storagePrefix`,Sv),cS(this,`version`,2),cS(this,`publicKey`),cS(this,`fetchPromise`),cS(this,`init`,async()=>{this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,V.toMiliseconds)(this.publicKey?.expiresAt)<Date.now()&&(this.logger.debug(`verify v2 public key expired`),await this.removePublicKey()))}),cS(this,`register`,async e=>{if(!Gf()||this.isDevEnv)return;let t=window.location.origin,{id:n,decryptedId:r}=e,i=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${n}&decryptedId=${r}`;try{let e=(0,po.getDocument)(),t=this.startAbortTimer(V.ONE_SECOND*5),r=await new Promise((r,a)=>{let o=()=>{window.removeEventListener(`message`,c),e.body.removeChild(s),a(`attestation aborted`)};this.abortController.signal.addEventListener(`abort`,o);let s=e.createElement(`iframe`);s.src=i,s.style.display=`none`,s.addEventListener(`error`,o,{signal:this.abortController.signal});let c=i=>{if(i.data&&typeof i.data==`string`)try{let a=JSON.parse(i.data);if(a.type===`verify_attestation`){if(Wa(a.attestation).payload.id!==n)return;clearInterval(t),e.body.removeChild(s),this.abortController.signal.removeEventListener(`abort`,o),window.removeEventListener(`message`,c),r(a.attestation===null?``:a.attestation)}}catch(e){this.logger.warn(e)}};e.body.appendChild(s),window.addEventListener(`message`,c,{signal:this.abortController.signal})});return this.logger.debug(`jwt attestation`,r),r}catch(e){this.logger.warn(e)}return``}),cS(this,`resolve`,async e=>{if(this.isDevEnv)return``;let{attestationId:t,hash:n,encryptedId:r}=e;if(t===``){this.logger.debug(`resolve: attestationId is empty, skipping`);return}if(t){if(Wa(t).payload.id!==r)return;let e=await this.isValidJwtAttestation(t);if(e){if(!e.isVerified){this.logger.warn(`resolve: jwt attestation: origin url not verified`);return}return e}}if(!n)return;let i=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(n,i)}),cS(this,`fetchAttestation`,async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);let n=this.startAbortTimer(V.ONE_SECOND*5),r=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(n),r.status===200?await r.json():void 0}),cS(this,`getVerifyUrl`,e=>{let t=e||`https://verify.walletconnect.org`;return Qv.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: https://verify.walletconnect.org`),t=`https://verify.walletconnect.org`),t}),cS(this,`fetchPublicKey`,async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let e=this.startAbortTimer(V.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}}),cS(this,`persistPublicKey`,async e=>{this.logger.debug(`persisting public key to local storage`,e),await this.store.setItem(this.storeKey,e),this.publicKey=e}),cS(this,`removePublicKey`,async()=>{this.logger.debug(`removing verify v2 public key from storage`),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),cS(this,`isValidJwtAttestation`,async e=>{let t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(e){this.logger.error(e),this.logger.warn(`error validating attestation`)}let n=await this.fetchAndPersistPublicKey();try{if(n)return this.validateAttestation(e,n)}catch(e){this.logger.error(e),this.logger.warn(`error validating attestation`)}}),cS(this,`getPublicKey`,async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),cS(this,`fetchAndPersistPublicKey`,async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async e=>{let t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))});let e=await this.fetchPromise;return this.fetchPromise=void 0,e}),cS(this,`validateAttestation`,(e,t)=>{let n=c_(e,t.publicKey),r={hasExpired:(0,V.toMiliseconds)(n.exp)<Date.now(),payload:n};if(r.hasExpired)throw this.logger.warn(`resolve: jwt attestation expired`),Error(`JWT attestation expired`);return{origin:r.payload.origin,isScam:r.payload.isScam,isVerified:r.payload.isVerified}}),this.logger=Mt(t,this.name),this.abortController=new AbortController,this.isDevEnv=vp(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+`//verify:public:key`}get context(){return At(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,V.toMiliseconds)(e))}},uS=Object.defineProperty,dS=(e,t,n)=>t in e?uS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,fS=(e,t,n)=>dS(e,typeof t==`symbol`?t:t+``,n),pS=class extends sd{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,fS(this,`context`,$v),fS(this,`registerDeviceToken`,async e=>{let{clientId:t,token:n,notificationType:r,enableEncrypted:i=!1}=e,a=`${ey}/${this.projectId}/clients`;await fetch(a,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({client_id:t,type:r,token:n,always_raw:i})})}),this.logger=Mt(t,this.context)}},mS=Object.defineProperty,hS=Object.getOwnPropertySymbols,gS=Object.prototype.hasOwnProperty,_S=Object.prototype.propertyIsEnumerable,vS=(e,t,n)=>t in e?mS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yS=(e,t)=>{for(var n in t||={})gS.call(t,n)&&vS(e,n,t[n]);if(hS)for(var n of hS(t))_S.call(t,n)&&vS(e,n,t[n]);return e},bS=(e,t,n)=>vS(e,typeof t==`symbol`?t:t+``,n),xS=class extends cd{constructor(e,t,n=!0){super(e,t,n),this.core=e,this.logger=t,bS(this,`context`,cy),bS(this,`storagePrefix`,Sv),bS(this,`storageVersion`,sy),bS(this,`events`,new Map),bS(this,`shouldPersist`,!1),bS(this,`init`,async()=>{if(!vp())try{let e={eventId:_p(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:`INIT`,type:``,properties:{client_id:await this.core.crypto.getClientId(),user_agent:Qf(this.core.relayer.protocol,this.core.relayer.version,Fv)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}}),bS(this,`createEvent`,e=>{let{event:t=`ERROR`,type:n=``,properties:{topic:r,trace:i}}=e,a=_p(),o=this.core.projectId||``,s=yS({eventId:a,timestamp:Date.now(),props:{event:t,type:n,properties:{topic:r,trace:i}},bundleId:o,domain:this.getAppDomain()},this.setMethods(a));return this.telemetryEnabled&&(this.events.set(a,s),this.shouldPersist=!0),s}),bS(this,`getEvent`,e=>{let{eventId:t,topic:n}=e;if(t)return this.events.get(t);let r=Array.from(this.events.values()).find(e=>e.props.properties.topic===n);if(r)return yS(yS({},r),this.setMethods(r.eventId))}),bS(this,`deleteEvent`,e=>{let{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0}),bS(this,`setEventListeners`,()=>{this.core.heartbeat.on(ce.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(e=>{(0,V.fromMiliseconds)(Date.now())-(0,V.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)})})}),bS(this,`setMethods`,e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)})),bS(this,`addTrace`,(e,t)=>{let n=this.events.get(e);n&&(n.props.properties.trace.push(t),this.events.set(e,n),this.shouldPersist=!0)}),bS(this,`setError`,(e,t)=>{let n=this.events.get(e);n&&(n.props.type=t,n.timestamp=Date.now(),this.events.set(e,n),this.shouldPersist=!0)}),bS(this,`persist`,async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),bS(this,`restore`,async()=>{try{let e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach(e=>{this.events.set(e.eventId,yS(yS({},e),this.setMethods(e.eventId)))})}catch(e){this.logger.warn(e)}}),bS(this,`submit`,async()=>{if(!this.telemetryEnabled||this.events.size===0)return;let e=[];for(let[t,n]of this.events)n.props.type&&e.push(n);if(e.length!==0)try{if((await this.sendEvent(e)).ok)for(let t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(e){this.logger.warn(e)}}),bS(this,`sendEvent`,async e=>{let t=this.getAppDomain()?``:`&sp=desktop`;return await fetch(`${ly}?projectId=${this.core.projectId}&st=events_sdk&sv=js-${Fv}${t}`,{method:`POST`,body:JSON.stringify(e)})}),bS(this,`getAppDomain`,()=>Yf().url),this.logger=Mt(t,this.context),this.telemetryEnabled=n,n?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+`//`+this.context}},SS=Object.defineProperty,CS=Object.getOwnPropertySymbols,wS=Object.prototype.hasOwnProperty,TS=Object.prototype.propertyIsEnumerable,ES=(e,t,n)=>t in e?SS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,DS=(e,t)=>{for(var n in t||={})wS.call(t,n)&&ES(e,n,t[n]);if(CS)for(var n of CS(t))TS.call(t,n)&&ES(e,n,t[n]);return e},OS=(e,t,n)=>ES(e,typeof t==`symbol`?t:t+``,n),kS=class e extends Yu{constructor(e){var t;super(e),OS(this,`protocol`,`wc`),OS(this,`version`,2),OS(this,`name`,xv),OS(this,`relayUrl`),OS(this,`projectId`),OS(this,`customStoragePrefix`),OS(this,`events`,new ae.EventEmitter),OS(this,`logger`),OS(this,`heartbeat`),OS(this,`relayer`),OS(this,`crypto`),OS(this,`storage`),OS(this,`history`),OS(this,`expirer`),OS(this,`pairing`),OS(this,`verify`),OS(this,`echoClient`),OS(this,`linkModeSupportedApps`),OS(this,`eventClient`),OS(this,`initialized`,!1),OS(this,`logChunkController`),OS(this,`on`,(e,t)=>this.events.on(e,t)),OS(this,`once`,(e,t)=>this.events.once(e,t)),OS(this,`off`,(e,t)=>this.events.off(e,t)),OS(this,`removeListener`,(e,t)=>this.events.removeListener(e,t)),OS(this,`dispatchEnvelope`,({topic:e,message:t,sessionExists:n})=>{if(!e||!t)return;let r={topic:e,message:t,publishedAt:Date.now(),transportType:Iv.link_mode};this.relayer.onLinkMessageEvent(r,{sessionExists:n})}),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||`wss://relay.walletconnect.org`,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:``;let{logger:n,chunkLoggerController:r}=Ft({opts:Dt({level:typeof e?.logger==`string`&&e.logger?e.logger:Cv.logger,name:xv}),maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=r,(t=this.logChunkController)!=null&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;(e=this.logChunkController)!=null&&e.downloadLogsBlobInBrowser&&((t=this.logChunkController)==null||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=Mt(n,this.name),this.heartbeat=new le,this.crypto=new rx(this,this.logger,e?.keychain),this.history=new tS(this,this.logger),this.expirer=new aS(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new st(DS(DS({},wv),e?.storageOptions)),this.relayer=new Bx({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Zx(this,this.logger),this.verify=new lS(this,this.logger,this.storage),this.echoClient=new pS(this.projectId||``,this.logger),this.linkModeSupportedApps=[],this.eventClient=new xS(this,this.logger,e?.telemetryEnabled)}static async init(t){let n=new e(t);await n.initialize();let r=await n.crypto.getClientId();return await n.storage.setItem(Lv,r),n}get context(){return At(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){return this.logChunkController?.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(`WALLETCONNECT_LINK_MODE_APPS`,this.linkModeSupportedApps))}async initialize(){this.logger.trace(`Initialized`);try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(`WALLETCONNECT_LINK_MODE_APPS`)||[],this.initialized=!0,this.logger.info(`Core Initialization Success`)}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}},AS=Object.defineProperty,jS=(e,t,n)=>t in e?AS(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,MS=(e,t,n)=>jS(e,typeof t==`symbol`?t:t+``,n),NS=class{constructor(e){this.opts=e,MS(this,`protocol`,`wc`),MS(this,`version`,2)}},PS=class{constructor(e){this.client=e}},FS=`client`,IS=`wc@2:${FS}:`,LS={name:FS,logger:`error`,controller:!1,relayUrl:`wss://relay.walletconnect.org`},RS=`WALLETCONNECT_DEEPLINK_CHOICE`,zS=`proposal`;V.THIRTY_DAYS;var BS=`Proposal expired`,VS=`session`,HS=V.SEVEN_DAYS,US=`engine`,WS={wc_sessionPropose:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1104},res:{ttl:V.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1106},res:{ttl:V.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:V.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1112},res:{ttl:V.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:V.ONE_DAY,prompt:!1,tag:1114},res:{ttl:V.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:V.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:V.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:V.FIVE_MINUTES,prompt:!1,tag:1119}}},GS={min:V.FIVE_MINUTES,max:V.SEVEN_DAYS},KS={idle:`IDLE`,active:`ACTIVE`},qS={eth_sendTransaction:{key:``},eth_sendRawTransaction:{key:``},wallet_sendCalls:{key:``},solana_signTransaction:{key:`signature`},solana_signAllTransactions:{key:`transactions`},solana_signAndSendTransaction:{key:`signature`}},JS=`request`,YS=[`wc_sessionPropose`,`wc_sessionRequest`,`wc_authRequest`,`wc_sessionAuthenticate`],XS=`auth`,ZS=`authKeys`,QS=`pairingTopics`,$S=`requests`,eC=`wc@1.5:${XS}:`,tC=`${eC}:PUB_KEY`,nC=Object.defineProperty,rC=Object.defineProperties,iC=Object.getOwnPropertyDescriptors,aC=Object.getOwnPropertySymbols,oC=Object.prototype.hasOwnProperty,sC=Object.prototype.propertyIsEnumerable,cC=(e,t,n)=>t in e?nC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,lC=(e,t)=>{for(var n in t||={})oC.call(t,n)&&cC(e,n,t[n]);if(aC)for(var n of aC(t))sC.call(t,n)&&cC(e,n,t[n]);return e},uC=(e,t)=>rC(e,iC(t)),Z=(e,t,n)=>cC(e,typeof t==`symbol`?t:t+``,n),dC=class extends PS{constructor(e){super(e),Z(this,`name`,US),Z(this,`events`,new ae.default),Z(this,`initialized`,!1),Z(this,`requestQueue`,{state:KS.idle,queue:[]}),Z(this,`sessionRequestQueue`,{state:KS.idle,queue:[]}),Z(this,`requestQueueDelay`,V.ONE_SECOND),Z(this,`expectedPairingMethodMap`,new Map),Z(this,`recentlyDeletedMap`,new Map),Z(this,`recentlyDeletedLimit`,200),Z(this,`relayMessageCache`,[]),Z(this,`pendingSessions`,new Map),Z(this,`init`,async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(WS)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,V.toMiliseconds)(this.requestQueueDelay)))}),Z(this,`connect`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let t=uC(lC({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);let{pairingTopic:n,requiredNamespaces:r,optionalNamespaces:i,sessionProperties:a,relays:o}=t,s=n,c,l=!1;try{if(s){let e=this.client.core.pairing.pairings.get(s);this.client.logger.warn(`connect() with existing pairing topic is deprecated and will be removed in the next major release.`),l=e.active}}catch(e){throw this.client.logger.error(`connect() -> pairing.get(${s}) failed`),e}if(!s||!l){let{topic:e,uri:t}=await this.client.core.pairing.create();s=e,c=t}if(!s){let{message:e}=J(`NO_MATCHING_KEY`,`connect() pairing topic: ${s}`);throw Error(e)}let u=await this.client.core.crypto.generateKeyPair(),d=WS.wc_sessionPropose.req.ttl||V.FIVE_MINUTES,f=lp(d),p=uC(lC({requiredNamespaces:r,optionalNamespaces:i,relays:o??[{protocol:`irn`}],proposer:{publicKey:u,metadata:this.client.metadata},expiryTimestamp:f,pairingTopic:s},a&&{sessionProperties:a}),{id:Xl()}),m=K(`session_connect`,p.id),{reject:h,resolve:g,done:_}=rp(d,BS),v=({id:e})=>{e===p.id&&(this.client.events.off(`proposal_expire`,v),this.pendingSessions.delete(p.id),this.events.emit(m,{error:{message:`Proposal expired`,code:0}}))};return this.client.events.on(`proposal_expire`,v),this.events.once(m,({error:e,session:t})=>{this.client.events.off(`proposal_expire`,v),e?h(e):t&&g(t)}),await this.sendRequest({topic:s,method:`wc_sessionPropose`,params:p,throwOnFailedPublish:!0,clientRpcId:p.id}),await this.setProposal(p.id,p),{uri:c,approval:_}}),Z(this,`pair`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(e){throw this.client.logger.error(`pair() failed`),e}}),Z(this,`approve`,async e=>{let t=this.client.core.eventClient.createEvent({properties:{topic:(e?.id)?.toString(),trace:[ry.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(e){throw t.setError(iy.no_internet_connection),e}try{await this.isValidProposalId(e?.id)}catch(n){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),t.setError(iy.proposal_not_found),n}try{await this.isValidApprove(e)}catch(e){throw this.client.logger.error(`approve() -> isValidApprove() failed`),t.setError(iy.session_approve_namespace_validation_failure),e}let{id:n,relayProtocol:r,namespaces:i,sessionProperties:a,sessionConfig:o}=e,s=this.client.proposal.get(n);this.client.core.eventClient.deleteEvent({eventId:t.eventId});let{pairingTopic:c,proposer:l,requiredNamespaces:u,optionalNamespaces:d}=s,f=this.client.core.eventClient?.getEvent({topic:c});f||=this.client.core.eventClient?.createEvent({type:ry.session_approve_started,properties:{topic:c,trace:[ry.session_approve_started,ry.session_namespaces_validation_success]}});let p=await this.client.core.crypto.generateKeyPair(),m=l.publicKey,h=await this.client.core.crypto.generateSharedKey(p,m),g=lC(lC({relay:{protocol:r??`irn`},namespaces:i,controller:{publicKey:p,metadata:this.client.metadata},expiry:lp(HS)},a&&{sessionProperties:a}),o&&{sessionConfig:o}),_=Iv.relay;f.addTrace(ry.subscribing_session_topic);try{await this.client.core.relayer.subscribe(h,{transportType:_})}catch(e){throw f.setError(iy.subscribe_session_topic_failure),e}f.addTrace(ry.subscribe_session_topic_success);let v=uC(lC({},g),{topic:h,requiredNamespaces:u,optionalNamespaces:d,pairingTopic:c,acknowledged:!1,self:g.controller,peer:{publicKey:l.publicKey,metadata:l.metadata},controller:p,transportType:Iv.relay});await this.client.session.set(h,v),f.addTrace(ry.store_session);try{f.addTrace(ry.publishing_session_settle),await this.sendRequest({topic:h,method:`wc_sessionSettle`,params:g,throwOnFailedPublish:!0}).catch(e=>{throw f?.setError(iy.session_settle_publish_failure),e}),f.addTrace(ry.session_settle_publish_success),f.addTrace(ry.publishing_session_approve),await this.sendResult({id:n,topic:c,result:{relay:{protocol:r??`irn`},responderPublicKey:p},throwOnFailedPublish:!0}).catch(e=>{throw f?.setError(iy.session_approve_publish_failure),e}),f.addTrace(ry.session_approve_publish_success)}catch(e){throw this.client.logger.error(e),this.client.session.delete(h,D_(`USER_DISCONNECTED`)),await this.client.core.relayer.unsubscribe(h),e}return this.client.core.eventClient.deleteEvent({eventId:f.eventId}),await this.client.core.pairing.updateMetadata({topic:c,metadata:l.metadata}),await this.client.proposal.delete(n,D_(`USER_DISCONNECTED`)),await this.client.core.pairing.activate({topic:c}),await this.setExpiry(h,lp(HS)),{topic:h,acknowledged:()=>Promise.resolve(this.client.session.get(h))}}),Z(this,`reject`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(e){throw this.client.logger.error(`reject() -> isValidReject() failed`),e}let{id:t,reason:n}=e,r;try{r=this.client.proposal.get(t).pairingTopic}catch(e){throw this.client.logger.error(`reject() -> proposal.get(${t}) failed`),e}r&&(await this.sendError({id:t,topic:r,error:n,rpcOpts:WS.wc_sessionPropose.reject}),await this.client.proposal.delete(t,D_(`USER_DISCONNECTED`)))}),Z(this,`update`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(e){throw this.client.logger.error(`update() -> isValidUpdate() failed`),e}let{topic:t,namespaces:n}=e,{done:r,resolve:i,reject:a}=rp(),o=Xl(),s=Zl().toString(),c=this.client.session.get(t).namespaces;return this.events.once(K(`session_update`,o),({error:e})=>{e?a(e):i()}),await this.client.session.update(t,{namespaces:n}),await this.sendRequest({topic:t,method:`wc_sessionUpdate`,params:{namespaces:n},throwOnFailedPublish:!0,clientRpcId:o,relayRpcId:s}).catch(e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:c}),a(e)}),{acknowledged:r}}),Z(this,`extend`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(e){throw this.client.logger.error(`extend() -> isValidExtend() failed`),e}let{topic:t}=e,n=Xl(),{done:r,resolve:i,reject:a}=rp();return this.events.once(K(`session_extend`,n),({error:e})=>{e?a(e):i()}),await this.setExpiry(t,lp(HS)),this.sendRequest({topic:t,method:`wc_sessionExtend`,params:{},clientRpcId:n,throwOnFailedPublish:!0}).catch(e=>{a(e)}),{acknowledged:r}}),Z(this,`request`,async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(e){throw this.client.logger.error(`request() -> isValidRequest() failed`),e}let{chainId:t,request:n,topic:r,expiry:i=WS.wc_sessionRequest.req.ttl}=e,a=this.client.session.get(r);a?.transportType===Iv.relay&&await this.confirmOnlineStateOrThrow();let o=Xl(),s=Zl().toString(),{done:c,resolve:l,reject:u}=rp(i,`Request expired. Please try again.`);this.events.once(K(`session_request`,o),({error:e,result:t})=>{e?u(e):l(t)});let d=`wc_sessionRequest`,f=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);if(f)return await this.sendRequest({clientRpcId:o,relayRpcId:s,topic:r,method:d,params:{request:uC(lC({},n),{expiryTimestamp:lp(i)}),chainId:t},expiry:i,throwOnFailedPublish:!0,appLink:f}).catch(e=>u(e)),this.client.events.emit(`session_request_sent`,{topic:r,request:n,chainId:t,id:o}),await c();let p={request:uC(lC({},n),{expiryTimestamp:lp(i)}),chainId:t},m=this.shouldSetTVF(d,p);return await Promise.all([new Promise(async e=>{await this.sendRequest(lC({clientRpcId:o,relayRpcId:s,topic:r,method:d,params:p,expiry:i,throwOnFailedPublish:!0},m&&{tvf:this.getTVFParams(o,p)})).catch(e=>u(e)),this.client.events.emit(`session_request_sent`,{topic:r,request:n,chainId:t,id:o}),e()}),new Promise(async e=>{var t;(t=a.sessionConfig)!=null&&t.disableDeepLink||await fp({id:o,topic:r,wcDeepLink:await hp(this.client.core.storage,RS)}),e()}),c()]).then(e=>e[2])}),Z(this,`respond`,async e=>{this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:n}=e,{id:r}=n,i=this.client.session.get(t);i.transportType===Iv.relay&&await this.confirmOnlineStateOrThrow();let a=this.getAppLinkIfEnabled(i.peer.metadata,i.transportType);xu(n)?await this.sendResult({id:r,topic:t,result:n.result,throwOnFailedPublish:!0,appLink:a}):Su(n)&&await this.sendError({id:r,topic:t,error:n.error,appLink:a}),this.cleanupAfterResponse(e)}),Z(this,`ping`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(e){throw this.client.logger.error(`ping() -> isValidPing() failed`),e}let{topic:t}=e;if(this.client.session.keys.includes(t)){let e=Xl(),n=Zl().toString(),{done:r,resolve:i,reject:a}=rp();this.events.once(K(`session_ping`,e),({error:e})=>{e?a(e):i()}),await Promise.all([this.sendRequest({topic:t,method:`wc_sessionPing`,params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:n}),r()])}else this.client.core.pairing.pairings.keys.includes(t)&&(this.client.logger.warn(`ping() on pairing topic is deprecated and will be removed in the next major release.`),await this.client.core.pairing.ping({topic:t}))}),Z(this,`emit`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);let{topic:t,event:n,chainId:r}=e,i=Zl().toString(),a=Xl();await this.sendRequest({topic:t,method:`wc_sessionEvent`,params:{event:n,chainId:r},throwOnFailedPublish:!0,relayRpcId:i,clientRpcId:a})}),Z(this,`disconnect`,async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);let{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:`wc_sessionDelete`,params:D_(`USER_DISCONNECTED`),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(t))await this.client.core.pairing.disconnect({topic:t});else{let{message:e}=J(`MISMATCHED_TOPIC`,`Session or pairing topic not found: ${t}`);throw Error(e)}}),Z(this,`find`,e=>(this.isInitialized(),this.client.session.getAll().filter(t=>N_(t,e)))),Z(this,`getPendingSessionRequests`,()=>this.client.pendingRequest.getAll()),Z(this,`authenticate`,async(e,t)=>{this.isInitialized(),this.isValidAuthenticate(e);let n=t&&this.client.core.linkModeSupportedApps.includes(t)&&this.client.metadata.redirect?.linkMode,r=n?Iv.link_mode:Iv.relay;r===Iv.relay&&await this.confirmOnlineStateOrThrow();let{chains:i,statement:a=``,uri:o,domain:s,nonce:c,type:l,exp:u,nbf:d,methods:f=[],expiry:p}=e,m=[...e.resources||[]],{topic:h,uri:g}=await this.client.core.pairing.create({methods:[`wc_sessionAuthenticate`],transportType:r});this.client.logger.info({message:`Generated new pairing`,pairing:{topic:h,uri:g}});let _=await this.client.core.crypto.generateKeyPair(),v=Gg(_);if(await Promise.all([this.client.auth.authKeys.set(tC,{responseTopic:v,publicKey:_}),this.client.auth.pairingTopics.set(v,{topic:v,pairingTopic:h})]),await this.client.core.relayer.subscribe(v,{transportType:r}),this.client.logger.info(`sending request to new pairing topic: ${h}`),f.length>0){let{namespace:e}=Lf(i[0]),t=Vm(e,`request`,f);Jm(m)&&(t=Um(t,m.pop())),m.push(t)}let y=p&&p>WS.wc_sessionAuthenticate.req.ttl?p:WS.wc_sessionAuthenticate.req.ttl,b={authPayload:{type:l??`caip122`,chains:i,statement:a,aud:o,domain:s,version:`1`,nonce:c,iat:new Date().toISOString(),exp:u,nbf:d,resources:m},requester:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:lp(y)},x={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:i,methods:[...new Set([`personal_sign`,...f])],events:[`chainChanged`,`accountsChanged`]}},relays:[{protocol:`irn`}],pairingTopic:h,proposer:{publicKey:_,metadata:this.client.metadata},expiryTimestamp:lp(WS.wc_sessionPropose.req.ttl),id:Xl()},{done:S,resolve:C,reject:w}=rp(y,`Request expired`),T=Xl(),E=K(`session_connect`,x.id),D=K(`session_request`,T),O=async({error:e,session:t})=>{this.events.off(D,k),e?w(e):t&&C({session:t})},k=async e=>{var n,i,a;if(await this.deletePendingAuthRequest(T,{message:`fulfilled`,code:0}),e.error){let t=D_(`WC_METHOD_UNSUPPORTED`,`wc_sessionAuthenticate`);return e.error.code===t.code?void 0:(this.events.off(E,O),w(e.error.message))}await this.deleteProposal(x.id),this.events.off(E,O);let{cacaos:o,responder:s}=e.result,c=[],l=[];for(let e of o){await Mm({cacao:e,projectId:this.client.core.projectId})||(this.client.logger.error(e,`Signature verification failed`),w(D_(`SESSION_SETTLEMENT_FAILED`,`Signature verification failed`)));let{p:t}=e,n=Jm(t.resources),r=[Am(t.iss)],i=jm(t.iss);if(n){let e=Km(n),t=qm(n);c.push(...e),r.push(...t)}for(let e of r)l.push(`${e}:${i}`)}let u=await this.client.core.crypto.generateSharedKey(_,s.publicKey),d;c.length>0&&(d={topic:u,acknowledged:!0,self:{publicKey:_,metadata:this.client.metadata},peer:s,controller:s.publicKey,expiry:lp(HS),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:`irn`},pairingTopic:h,namespaces:w_([...new Set(c)],[...new Set(l)]),transportType:r},await this.client.core.relayer.subscribe(u,{transportType:r}),await this.client.session.set(u,d),h&&await this.client.core.pairing.updateMetadata({topic:h,metadata:s.metadata}),d=this.client.session.get(u)),(n=this.client.metadata.redirect)!=null&&n.linkMode&&(i=s.metadata.redirect)!=null&&i.linkMode&&(a=s.metadata.redirect)!=null&&a.universal&&t&&(this.client.core.addLinkModeSupportedApp(s.metadata.redirect.universal),this.client.session.update(u,{transportType:Iv.link_mode})),C({auths:o,session:d})};this.events.once(E,O),this.events.once(D,k);let A;try{if(n){let e=Ql(`wc_sessionAuthenticate`,b,T);this.client.core.history.set(h,e),A=g_(t,h,await this.client.core.crypto.encode(``,e,{type:2,encoding:Ig}))}else await Promise.all([this.sendRequest({topic:h,method:`wc_sessionAuthenticate`,params:b,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:T}),this.sendRequest({topic:h,method:`wc_sessionPropose`,params:x,expiry:WS.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:x.id})])}catch(e){throw this.events.off(E,O),this.events.off(D,k),e}return await this.setProposal(x.id,x),await this.setAuthRequest(T,{request:uC(lC({},b),{verifyContext:{}}),pairingTopic:h,transportType:r}),{uri:A??g,response:S}}),Z(this,`approveSessionAuthenticate`,async e=>{let{id:t,auths:n}=e,r=this.client.core.eventClient.createEvent({properties:{topic:t.toString(),trace:[ay.authenticated_session_approve_started]}});try{this.isInitialized()}catch(e){throw r.setError(oy.no_internet_connection),e}let i=this.getPendingAuthRequest(t);if(!i)throw r.setError(oy.authenticated_session_pending_request_not_found),Error(`Could not find pending auth request with id ${t}`);let a=i.transportType||Iv.relay;a===Iv.relay&&await this.confirmOnlineStateOrThrow();let o=i.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),c=Gg(o),l={type:1,receiverPublicKey:o,senderPublicKey:s},u=[],d=[];for(let e of n){if(!await Mm({cacao:e,projectId:this.client.core.projectId})){r.setError(oy.invalid_cacao);let e=D_(`SESSION_SETTLEMENT_FAILED`,`Signature verification failed`);throw await this.sendError({id:t,topic:c,error:e,encodeOpts:l}),Error(e.message)}r.addTrace(ay.cacaos_verified);let{p:n}=e,i=Jm(n.resources),a=[Am(n.iss)],o=jm(n.iss);if(i){let e=Km(i),t=qm(i);u.push(...e),a.push(...t)}for(let e of a)d.push(`${e}:${o}`)}let f=await this.client.core.crypto.generateSharedKey(s,o);r.addTrace(ay.create_authenticated_session_topic);let p;if(u?.length>0){p={topic:f,acknowledged:!0,self:{publicKey:s,metadata:this.client.metadata},peer:{publicKey:o,metadata:i.requester.metadata},controller:o,expiry:lp(HS),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:`irn`},pairingTopic:i.pairingTopic,namespaces:w_([...new Set(u)],[...new Set(d)]),transportType:a},r.addTrace(ay.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(f,{transportType:a})}catch(e){throw r.setError(oy.subscribe_authenticated_session_topic_failure),e}r.addTrace(ay.subscribe_authenticated_session_topic_success),await this.client.session.set(f,p),r.addTrace(ay.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:i.pairingTopic,metadata:i.requester.metadata})}r.addTrace(ay.publishing_authenticated_session_approve);try{await this.sendResult({topic:c,id:t,result:{cacaos:n,responder:{publicKey:s,metadata:this.client.metadata}},encodeOpts:l,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(i.requester.metadata,a)})}catch(e){throw r.setError(oy.authenticated_session_approve_publish_failure),e}return await this.client.auth.requests.delete(t,{message:`fulfilled`,code:0}),await this.client.core.pairing.activate({topic:i.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:r.eventId}),{session:p}}),Z(this,`rejectSessionAuthenticate`,async e=>{this.isInitialized();let{id:t,reason:n}=e,r=this.getPendingAuthRequest(t);if(!r)throw Error(`Could not find pending auth request with id ${t}`);r.transportType===Iv.relay&&await this.confirmOnlineStateOrThrow();let i=r.requester.publicKey,a=await this.client.core.crypto.generateKeyPair(),o=Gg(i),s={type:1,receiverPublicKey:i,senderPublicKey:a};await this.sendError({id:t,topic:o,error:n,encodeOpts:s,rpcOpts:WS.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(r.requester.metadata,r.transportType)}),await this.client.auth.requests.delete(t,{message:`rejected`,code:0}),await this.client.proposal.delete(t,D_(`USER_DISCONNECTED`))}),Z(this,`formatAuthMessage`,e=>{this.isInitialized();let{request:t,iss:n}=e;return Nm(t,n)}),Z(this,`processRelayMessageCache`,()=>{setTimeout(async()=>{if(this.relayMessageCache.length!==0)for(;this.relayMessageCache.length>0;)try{let e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),Z(this,`cleanupDuplicatePairings`,async e=>{if(e.pairingTopic)try{let t=this.client.core.pairing.pairings.get(e.pairingTopic),n=this.client.core.pairing.pairings.getAll().filter(n=>n.peerMetadata?.url&&n.peerMetadata?.url===e.peer.metadata.url&&n.topic&&n.topic!==t.topic);if(n.length===0)return;this.client.logger.info(`Cleaning up ${n.length} duplicate pairing(s)`),await Promise.all(n.map(e=>this.client.core.pairing.disconnect({topic:e.topic}))),this.client.logger.info(`Duplicate pairings clean up finished`)}catch(e){this.client.logger.error(e)}}),Z(this,`deleteSession`,async e=>{let{topic:t,expirerHasDeleted:n=!1,emitEvent:r=!0,id:i=0}=e,{self:a}=this.client.session.get(t);await this.client.core.relayer.unsubscribe(t),await this.client.session.delete(t,D_(`USER_DISCONNECTED`)),this.addToRecentlyDeleted(t,`session`),this.client.core.crypto.keychain.has(a.publicKey)&&await this.client.core.crypto.deleteKeyPair(a.publicKey),this.client.core.crypto.keychain.has(t)&&await this.client.core.crypto.deleteSymKey(t),n||this.client.core.expirer.del(t),this.client.core.storage.removeItem(RS).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(e=>{e.topic===t&&this.deletePendingSessionRequest(e.id,D_(`USER_DISCONNECTED`))}),t===this.sessionRequestQueue.queue[0]?.topic&&(this.sessionRequestQueue.state=KS.idle),r&&this.client.events.emit(`session_delete`,{id:i,topic:t})}),Z(this,`deleteProposal`,async(e,t)=>{if(t)try{let t=this.client.proposal.get(e);this.client.core.eventClient.getEvent({topic:t.pairingTopic})?.setError(iy.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,D_(`USER_DISCONNECTED`)),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,`proposal`)}),Z(this,`deletePendingSessionRequest`,async(e,t,n=!1)=>{await Promise.all([this.client.pendingRequest.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,`request`),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(t=>t.id!==e),n&&(this.sessionRequestQueue.state=KS.idle,this.client.events.emit(`session_request_expire`,{id:e}))}),Z(this,`deletePendingAuthRequest`,async(e,t,n=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),n?Promise.resolve():this.client.core.expirer.del(e)])}),Z(this,`setExpiry`,async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))}),Z(this,`setProposal`,async(e,t)=>{this.client.core.expirer.set(e,lp(WS.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)}),Z(this,`setAuthRequest`,async(e,t)=>{let{request:n,pairingTopic:r,transportType:i=Iv.relay}=t;this.client.core.expirer.set(e,n.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:n.authPayload,requester:n.requester,expiryTimestamp:n.expiryTimestamp,id:e,pairingTopic:r,verifyContext:n.verifyContext,transportType:i})}),Z(this,`setPendingSessionRequest`,async e=>{let{id:t,topic:n,params:r,verifyContext:i}=e,a=r.request.expiryTimestamp||lp(WS.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,a),await this.client.pendingRequest.set(t,{id:t,topic:n,params:r,verifyContext:i})}),Z(this,`sendRequest`,async e=>{let{topic:t,method:n,params:r,expiry:i,relayRpcId:a,clientRpcId:o,throwOnFailedPublish:s,appLink:c,tvf:l}=e,u=Ql(n,r,o),d,f=!!c;try{let e=f?Ig:Fg;d=await this.client.core.crypto.encode(t,u,{encoding:e})}catch(e){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${t} failed`),e}let p;if(YS.includes(n)){let e=Kg(JSON.stringify(u)),t=Kg(d);p=await this.client.core.verify.register({id:t,decryptedId:e})}let m=WS[n].req;if(m.attestation=p,i&&(m.ttl=i),a&&(m.id=a),this.client.core.history.set(t,u),f){let e=g_(c,t,d);await global.Linking.openURL(e,this.client.name)}else{let e=WS[n].req;i&&(e.ttl=i),a&&(e.id=a),e.tvf=uC(lC({},l),{correlationId:u.id}),s?(e.internal=uC(lC({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(t,d,e)):this.client.core.relayer.publish(t,d,e).catch(e=>this.client.logger.error(e))}return u.id}),Z(this,`sendResult`,async e=>{let{id:t,topic:n,result:r,throwOnFailedPublish:i,encodeOpts:a,appLink:o}=e,s=$l(t,r),c,l=o&&typeof(global==null?void 0:global.Linking)<`u`;try{let e=l?Ig:Fg;c=await this.client.core.crypto.encode(n,s,uC(lC({},a||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${n} failed`),e}let u,d;try{u=await this.client.core.history.get(n,t);let e=u.request;try{this.shouldSetTVF(e.method,e.params)&&(d=this.getTVFParams(t,e.params,r))}catch(e){this.client.logger.warn(`sendResult() -> getTVFParams() failed`,e)}}catch(e){throw this.client.logger.error(`sendResult() -> history.get(${n}, ${t}) failed`),e}if(l){let e=g_(o,n,c);await global.Linking.openURL(e,this.client.name)}else{let e=WS[u.request.method].res;e.tvf=uC(lC({},d),{correlationId:t}),i?(e.internal=uC(lC({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,c,e)):this.client.core.relayer.publish(n,c,e).catch(e=>this.client.logger.error(e))}await this.client.core.history.resolve(s)}),Z(this,`sendError`,async e=>{let{id:t,topic:n,error:r,encodeOpts:i,rpcOpts:a,appLink:o}=e,s=eu(t,r),c,l=o&&typeof(global==null?void 0:global.Linking)<`u`;try{let e=l?Ig:Fg;c=await this.client.core.crypto.encode(n,s,uC(lC({},i||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${n} failed`),e}let u;try{u=await this.client.core.history.get(n,t)}catch(e){throw this.client.logger.error(`sendError() -> history.get(${n}, ${t}) failed`),e}if(l){let e=g_(o,n,c);await global.Linking.openURL(e,this.client.name)}else{let e=u.request.method,t=a||WS[e].res;this.client.core.relayer.publish(n,c,t)}await this.client.core.history.resolve(s)}),Z(this,`cleanup`,async()=>{let e=[],t=[];this.client.session.getAll().forEach(t=>{let n=!1;up(t.expiry)&&(n=!0),this.client.core.crypto.keychain.has(t.topic)||(n=!0),n&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{up(e.expiryTimestamp)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession({topic:e})),...t.map(e=>this.deleteProposal(e))])}),Z(this,`onRelayEventRequest`,async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),Z(this,`processRequestsQueue`,async()=>{if(this.requestQueue.state===KS.active){this.client.logger.info(`Request queue already active, skipping...`);return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=KS.active;let e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=KS.idle}),Z(this,`processRequest`,async e=>{let{topic:t,payload:n,attestation:r,transportType:i,encryptedId:a}=e,o=n.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:o}))switch(o){case`wc_sessionPropose`:return await this.onSessionProposeRequest({topic:t,payload:n,attestation:r,encryptedId:a});case`wc_sessionSettle`:return await this.onSessionSettleRequest(t,n);case`wc_sessionUpdate`:return await this.onSessionUpdateRequest(t,n);case`wc_sessionExtend`:return await this.onSessionExtendRequest(t,n);case`wc_sessionPing`:return await this.onSessionPingRequest(t,n);case`wc_sessionDelete`:return await this.onSessionDeleteRequest(t,n);case`wc_sessionRequest`:return await this.onSessionRequest({topic:t,payload:n,attestation:r,encryptedId:a,transportType:i});case`wc_sessionEvent`:return await this.onSessionEventRequest(t,n);case`wc_sessionAuthenticate`:return await this.onSessionAuthenticateRequest({topic:t,payload:n,attestation:r,encryptedId:a,transportType:i});default:return this.client.logger.info(`Unsupported request method ${o}`)}}),Z(this,`onRelayEventResponse`,async e=>{let{topic:t,payload:n,transportType:r}=e,i=(await this.client.core.history.get(t,n.id)).request.method;switch(i){case`wc_sessionPropose`:return this.onSessionProposeResponse(t,n,r);case`wc_sessionSettle`:return this.onSessionSettleResponse(t,n);case`wc_sessionUpdate`:return this.onSessionUpdateResponse(t,n);case`wc_sessionExtend`:return this.onSessionExtendResponse(t,n);case`wc_sessionPing`:return this.onSessionPingResponse(t,n);case`wc_sessionRequest`:return this.onSessionRequestResponse(t,n);case`wc_sessionAuthenticate`:return this.onSessionAuthenticateResponse(t,n);default:return this.client.logger.info(`Unsupported response method ${i}`)}}),Z(this,`onRelayEventUnknownPayload`,e=>{let{topic:t}=e,{message:n}=J(`MISSING_OR_INVALID`,`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(n)}),Z(this,`shouldIgnorePairingRequest`,e=>{let{topic:t,requestMethod:n}=e,r=this.expectedPairingMethodMap.get(t);return!r||r.includes(n)?!1:!!(r.includes(`wc_sessionAuthenticate`)&&this.client.events.listenerCount(`session_authenticate`)>0)}),Z(this,`onSessionProposeRequest`,async e=>{let{topic:t,payload:n,attestation:r,encryptedId:i}=e,{params:a,id:o}=n;try{let e=this.client.core.eventClient.getEvent({topic:t});this.client.events.listenerCount(`session_proposal`)===0&&(console.warn(`No listener for session_proposal event`),e?.setError(ny.proposal_listener_not_found)),this.isValidConnect(lC({},n.params));let s=lC({id:o,pairingTopic:t,expiryTimestamp:a.expiryTimestamp||lp(WS.wc_sessionPropose.req.ttl)},a);await this.setProposal(o,s);let c=await this.getVerifyContext({attestationId:r,hash:Kg(JSON.stringify(n)),encryptedId:i,metadata:s.proposer.metadata});e?.addTrace(ty.emit_session_proposal),this.client.events.emit(`session_proposal`,{id:o,params:s,verifyContext:c})}catch(e){await this.sendError({id:o,topic:t,error:e,rpcOpts:WS.wc_sessionPropose.autoReject}),this.client.logger.error(e)}}),Z(this,`onSessionProposeResponse`,async(e,t,n)=>{let{id:r}=t;if(xu(t)){let{result:i}=t;this.client.logger.trace({type:`method`,method:`onSessionProposeResponse`,result:i});let a=this.client.proposal.get(r);this.client.logger.trace({type:`method`,method:`onSessionProposeResponse`,proposal:a});let o=a.proposer.publicKey;this.client.logger.trace({type:`method`,method:`onSessionProposeResponse`,selfPublicKey:o});let s=i.responderPublicKey;this.client.logger.trace({type:`method`,method:`onSessionProposeResponse`,peerPublicKey:s});let c=await this.client.core.crypto.generateSharedKey(o,s);this.pendingSessions.set(r,{sessionTopic:c,pairingTopic:e,proposalId:r,publicKey:o});let l=await this.client.core.relayer.subscribe(c,{transportType:n});this.client.logger.trace({type:`method`,method:`onSessionProposeResponse`,subscriptionId:l}),await this.client.core.pairing.activate({topic:e})}else if(Su(t)){await this.client.proposal.delete(r,D_(`USER_DISCONNECTED`));let e=K(`session_connect`,r);if(this.events.listenerCount(e)===0)throw Error(`emitting ${e} without any listeners, 954`);this.events.emit(e,{error:t.error})}}),Z(this,`onSessionSettleRequest`,async(e,t)=>{let{id:n,params:r}=t;try{this.isValidSessionSettleRequest(r);let{relay:n,controller:i,expiry:a,namespaces:o,sessionProperties:s,sessionConfig:c}=t.params,l=[...this.pendingSessions.values()].find(t=>t.sessionTopic===e);if(!l)return this.client.logger.error(`Pending session not found for topic ${e}`);let u=this.client.proposal.get(l.proposalId),d=uC(lC(lC({topic:e,relay:n,expiry:a,namespaces:o,acknowledged:!0,pairingTopic:l.pairingTopic,requiredNamespaces:u.requiredNamespaces,optionalNamespaces:u.optionalNamespaces,controller:i.publicKey,self:{publicKey:l.publicKey,metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},s&&{sessionProperties:s}),c&&{sessionConfig:c}),{transportType:Iv.relay});await this.client.session.set(d.topic,d),await this.setExpiry(d.topic,d.expiry),await this.client.core.pairing.updateMetadata({topic:l.pairingTopic,metadata:d.peer.metadata}),this.client.events.emit(`session_connect`,{session:d}),this.events.emit(K(`session_connect`,l.proposalId),{session:d}),this.pendingSessions.delete(l.proposalId),this.deleteProposal(l.proposalId,!1),this.cleanupDuplicatePairings(d),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(t){await this.sendError({id:n,topic:e,error:t}),this.client.logger.error(t)}}),Z(this,`onSessionSettleResponse`,async(e,t)=>{let{id:n}=t;xu(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(K(`session_approve`,n),{})):Su(t)&&(await this.client.session.delete(e,D_(`USER_DISCONNECTED`)),this.events.emit(K(`session_approve`,n),{error:t.error}))}),Z(this,`onSessionUpdateRequest`,async(e,t)=>{let{params:n,id:r}=t;try{let t=`${e}_session_update`,i=yv.get(t);if(i&&this.isRequestOutOfSync(i,r)){this.client.logger.warn(`Discarding out of sync request - ${r}`),this.sendError({id:r,topic:e,error:D_(`INVALID_UPDATE_REQUEST`)});return}this.isValidUpdate(lC({topic:e},n));try{yv.set(t,r),await this.client.session.update(e,{namespaces:n.namespaces}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0})}catch(e){throw yv.delete(t),e}this.client.events.emit(`session_update`,{id:r,topic:e,params:n})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),Z(this,`isRequestOutOfSync`,(e,t)=>t.toString().slice(0,-3)<e.toString().slice(0,-3)),Z(this,`onSessionUpdateResponse`,(e,t)=>{let{id:n}=t,r=K(`session_update`,n);if(this.events.listenerCount(r)===0)throw Error(`emitting ${r} without any listeners`);xu(t)?this.events.emit(K(`session_update`,n),{}):Su(t)&&this.events.emit(K(`session_update`,n),{error:t.error})}),Z(this,`onSessionExtendRequest`,async(e,t)=>{let{id:n}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,lp(HS)),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit(`session_extend`,{id:n,topic:e})}catch(t){await this.sendError({id:n,topic:e,error:t}),this.client.logger.error(t)}}),Z(this,`onSessionExtendResponse`,(e,t)=>{let{id:n}=t,r=K(`session_extend`,n);if(this.events.listenerCount(r)===0)throw Error(`emitting ${r} without any listeners`);xu(t)?this.events.emit(K(`session_extend`,n),{}):Su(t)&&this.events.emit(K(`session_extend`,n),{error:t.error})}),Z(this,`onSessionPingRequest`,async(e,t)=>{let{id:n}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit(`session_ping`,{id:n,topic:e})}catch(t){await this.sendError({id:n,topic:e,error:t}),this.client.logger.error(t)}}),Z(this,`onSessionPingResponse`,(e,t)=>{let{id:n}=t,r=K(`session_ping`,n);if(this.events.listenerCount(r)===0)throw Error(`emitting ${r} without any listeners`);setTimeout(()=>{xu(t)?this.events.emit(K(`session_ping`,n),{}):Su(t)&&this.events.emit(K(`session_ping`,n),{error:t.error})},500)}),Z(this,`onSessionDeleteRequest`,async(e,t)=>{let{id:n}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise(t=>{this.client.core.relayer.once(Nv.publish,async()=>{t(await this.deleteSession({topic:e,id:n}))})}),this.sendResult({id:n,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:D_(`USER_DISCONNECTED`)})]).catch(e=>this.client.logger.error(e))}catch(e){this.client.logger.error(e)}}),Z(this,`onSessionRequest`,async e=>{var t,n;let{topic:r,payload:i,attestation:a,encryptedId:o,transportType:s}=e,{id:c,params:l}=i;try{await this.isValidRequest(lC({topic:r},l));let e=this.client.session.get(r),i={id:c,topic:r,params:l,verifyContext:await this.getVerifyContext({attestationId:a,hash:Kg(JSON.stringify(Ql(`wc_sessionRequest`,l,c))),encryptedId:o,metadata:e.peer.metadata,transportType:s})};await this.setPendingSessionRequest(i),s===Iv.link_mode&&(t=e.peer.metadata.redirect)!=null&&t.universal&&this.client.core.addLinkModeSupportedApp(e.peer.metadata.redirect?.universal),(n=this.client.signConfig)!=null&&n.disableRequestQueue?this.emitSessionRequest(i):(this.addSessionRequestToSessionRequestQueue(i),this.processSessionRequestQueue())}catch(e){await this.sendError({id:c,topic:r,error:e}),this.client.logger.error(e)}}),Z(this,`onSessionRequestResponse`,(e,t)=>{let{id:n}=t,r=K(`session_request`,n);if(this.events.listenerCount(r)===0)throw Error(`emitting ${r} without any listeners`);xu(t)?this.events.emit(K(`session_request`,n),{result:t.result}):Su(t)&&this.events.emit(K(`session_request`,n),{error:t.error})}),Z(this,`onSessionEventRequest`,async(e,t)=>{let{id:n,params:r}=t;try{let t=`${e}_session_event_${r.event.name}`,i=yv.get(t);if(i&&this.isRequestOutOfSync(i,n)){this.client.logger.info(`Discarding out of sync request - ${n}`);return}this.isValidEmit(lC({topic:e},r)),this.client.events.emit(`session_event`,{id:n,topic:e,params:r}),yv.set(t,n)}catch(t){await this.sendError({id:n,topic:e,error:t}),this.client.logger.error(t)}}),Z(this,`onSessionAuthenticateResponse`,(e,t)=>{let{id:n}=t;this.client.logger.trace({type:`method`,method:`onSessionAuthenticateResponse`,topic:e,payload:t}),xu(t)?this.events.emit(K(`session_request`,n),{result:t.result}):Su(t)&&this.events.emit(K(`session_request`,n),{error:t.error})}),Z(this,`onSessionAuthenticateRequest`,async e=>{var t;let{topic:n,payload:r,attestation:i,encryptedId:a,transportType:o}=e;try{let{requester:e,authPayload:s,expiryTimestamp:c}=r.params,l=await this.getVerifyContext({attestationId:i,hash:Kg(JSON.stringify(r)),encryptedId:a,metadata:e.metadata,transportType:o}),u={requester:e,pairingTopic:n,id:r.id,authPayload:s,verifyContext:l,expiryTimestamp:c};await this.setAuthRequest(r.id,{request:u,pairingTopic:n,transportType:o}),o===Iv.link_mode&&(t=e.metadata.redirect)!=null&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit(`session_authenticate`,{topic:n,params:r.params,id:r.id,verifyContext:l})}catch(e){this.client.logger.error(e);let t=r.params.requester.publicKey,i=await this.client.core.crypto.generateKeyPair(),a=this.getAppLinkIfEnabled(r.params.requester.metadata,o),s={type:1,receiverPublicKey:t,senderPublicKey:i};await this.sendError({id:r.id,topic:n,error:e,encodeOpts:s,rpcOpts:WS.wc_sessionAuthenticate.autoReject,appLink:a})}}),Z(this,`addSessionRequestToSessionRequestQueue`,e=>{this.sessionRequestQueue.queue.push(e)}),Z(this,`cleanupAfterResponse`,e=>{this.deletePendingSessionRequest(e.response.id,{message:`fulfilled`,code:0}),setTimeout(()=>{this.sessionRequestQueue.state=KS.idle,this.processSessionRequestQueue()},(0,V.toMiliseconds)(this.requestQueueDelay))}),Z(this,`cleanupPendingSentRequestsForTopic`,({topic:e,error:t})=>{let n=this.client.core.history.pending;n.length>0&&n.filter(t=>t.topic===e&&t.request.method===`wc_sessionRequest`).forEach(e=>{let n=e.request.id,r=K(`session_request`,n);if(this.events.listenerCount(r)===0)throw Error(`emitting ${r} without any listeners`);this.events.emit(K(`session_request`,e.request.id),{error:t})})}),Z(this,`processSessionRequestQueue`,()=>{if(this.sessionRequestQueue.state===KS.active){this.client.logger.info(`session request queue is already active.`);return}let e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info(`session request queue is empty.`);return}try{this.sessionRequestQueue.state=KS.active,this.emitSessionRequest(e)}catch(e){this.client.logger.error(e)}}),Z(this,`emitSessionRequest`,e=>{this.client.events.emit(`session_request`,e)}),Z(this,`onPairingCreated`,e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;let t=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);t&&this.onSessionProposeRequest({topic:e.topic,payload:Ql(`wc_sessionPropose`,{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties},t.id)})}),Z(this,`isValidConnect`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:t,requiredNamespaces:n,optionalNamespaces:r,sessionProperties:i,relays:a}=e;if(A_(t)||await this.isValidPairingTopic(t),!X_(a,!0)){let{message:e}=J(`MISSING_OR_INVALID`,`connect() relays: ${a}`);throw Error(e)}!A_(n)&&k_(n)!==0&&this.validateNamespaces(n,`requiredNamespaces`),!A_(r)&&k_(r)!==0&&this.validateNamespaces(r,`optionalNamespaces`),A_(i)||this.validateSessionProps(i,`sessionProperties`)}),Z(this,`validateNamespaces`,(e,t)=>{let n=q_(e,`connect()`,t);if(n)throw Error(n.message)}),Z(this,`isValidApprove`,async e=>{if(!Q_(e))throw Error(J(`MISSING_OR_INVALID`,`approve() params: ${e}`).message);let{id:t,namespaces:n,relayProtocol:r,sessionProperties:i}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);let a=this.client.proposal.get(t),o=J_(n,`approve()`);if(o)throw Error(o.message);let s=ov(a.requiredNamespaces,n,`approve()`);if(s)throw Error(s.message);if(!j_(r,!0)){let{message:e}=J(`MISSING_OR_INVALID`,`approve() relayProtocol: ${r}`);throw Error(e)}A_(i)||this.validateSessionProps(i,`sessionProperties`)}),Z(this,`isValidReject`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`reject() params: ${e}`);throw Error(t)}let{id:t,reason:n}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!$_(n)){let{message:e}=J(`MISSING_OR_INVALID`,`reject() reason: ${JSON.stringify(n)}`);throw Error(e)}}),Z(this,`isValidSessionSettleRequest`,e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`onSessionSettleRequest() params: ${e}`);throw Error(t)}let{relay:t,controller:n,namespaces:r,expiry:i}=e;if(!Y_(t)){let{message:e}=J(`MISSING_OR_INVALID`,`onSessionSettleRequest() relay protocol should be a string`);throw Error(e)}let a=z_(n,`onSessionSettleRequest()`);if(a)throw Error(a.message);let o=J_(r,`onSessionSettleRequest()`);if(o)throw Error(o.message);if(up(i)){let{message:e}=J(`EXPIRED`,`onSessionSettleRequest()`);throw Error(e)}}),Z(this,`isValidUpdate`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:n}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let r=this.client.session.get(t),i=J_(n,`update()`);if(i)throw Error(i.message);let a=ov(r.requiredNamespaces,n,`update()`);if(a)throw Error(a.message)}),Z(this,`isValidExtend`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)}),Z(this,`isValidRequest`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`request() params: ${e}`);throw Error(t)}let{topic:t,request:n,chainId:r,expiry:i}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);let{namespaces:a}=this.client.session.get(t);if(!rv(a,r)){let{message:e}=J(`MISSING_OR_INVALID`,`request() chainId: ${r}`);throw Error(e)}if(!ev(n)){let{message:e}=J(`MISSING_OR_INVALID`,`request() ${JSON.stringify(n)}`);throw Error(e)}if(!iv(a,r,n.method)){let{message:e}=J(`MISSING_OR_INVALID`,`request() method: ${n.method}`);throw Error(e)}if(i&&!uv(i,GS)){let{message:e}=J(`MISSING_OR_INVALID`,`request() expiry: ${i}. Expiry must be a number (in seconds) between ${GS.min} and ${GS.max}`);throw Error(e)}}),Z(this,`isValidRespond`,async e=>{var t;if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`respond() params: ${e}`);throw Error(t)}let{topic:n,response:r}=e;try{await this.isValidSessionTopic(n)}catch(n){throw(t=e?.response)!=null&&t.id&&this.cleanupAfterResponse(e),n}if(!tv(r)){let{message:e}=J(`MISSING_OR_INVALID`,`respond() response: ${JSON.stringify(r)}`);throw Error(e)}}),Z(this,`isValidPing`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),Z(this,`isValidEmit`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`emit() params: ${e}`);throw Error(t)}let{topic:t,event:n,chainId:r}=e;await this.isValidSessionTopic(t);let{namespaces:i}=this.client.session.get(t);if(!rv(i,r)){let{message:e}=J(`MISSING_OR_INVALID`,`emit() chainId: ${r}`);throw Error(e)}if(!nv(n)){let{message:e}=J(`MISSING_OR_INVALID`,`emit() event: ${JSON.stringify(n)}`);throw Error(e)}if(!av(i,r,n.name)){let{message:e}=J(`MISSING_OR_INVALID`,`emit() event: ${JSON.stringify(n)}`);throw Error(e)}}),Z(this,`isValidDisconnect`,async e=>{if(!Q_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),Z(this,`isValidAuthenticate`,e=>{let{chains:t,uri:n,domain:r,nonce:i}=e;if(!Array.isArray(t)||t.length===0)throw Error(`chains is required and must be a non-empty array`);if(!j_(n,!1))throw Error(`uri is required parameter`);if(!j_(r,!1))throw Error(`domain is required parameter`);if(!j_(i,!1))throw Error(`nonce is required parameter`);if([...new Set(t.map(e=>Lf(e).namespace))].length>1)throw Error(`Multi-namespace requests are not supported. Please request single namespace only.`);let{namespace:a}=Lf(t[0]);if(a!==`eip155`)throw Error(`Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.`)}),Z(this,`getVerifyContext`,async e=>{let{attestationId:t,hash:n,encryptedId:r,metadata:i,transportType:a}=e,o={verified:{verifyUrl:i.verifyUrl||`https://verify.walletconnect.org`,validation:`UNKNOWN`,origin:i.url||``}};try{if(a===Iv.link_mode){let e=this.getAppLinkIfEnabled(i,a);return o.verified.validation=e&&new URL(e).origin===new URL(i.url).origin?`VALID`:`INVALID`,o}let e=await this.client.core.verify.resolve({attestationId:t,hash:n,encryptedId:r,verifyUrl:i.verifyUrl});e&&(o.verified.origin=e.origin,o.verified.isScam=e.isScam,o.verified.validation=e.origin===new URL(i.url).origin?`VALID`:`INVALID`)}catch(e){this.client.logger.warn(e)}return this.client.logger.debug(`Verify context: ${JSON.stringify(o)}`),o}),Z(this,`validateSessionProps`,(e,t)=>{Object.values(e).forEach(e=>{if(!j_(e,!1)){let{message:n}=J(`MISSING_OR_INVALID`,`${t} must be in Record<string, string> format. Received: ${JSON.stringify(e)}`);throw Error(n)}})}),Z(this,`getPendingAuthRequest`,e=>{let t=this.client.auth.requests.get(e);return typeof t==`object`?t:void 0}),Z(this,`addToRecentlyDeleted`,(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0,t=this.recentlyDeletedLimit/2;for(let n of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(n)}}}),Z(this,`checkRecentlyDeleted`,e=>{let t=this.recentlyDeletedMap.get(e);if(t){let{message:n}=J(`MISSING_OR_INVALID`,`Record was recently deleted - ${t}: ${e}`);throw Error(n)}}),Z(this,`isLinkModeEnabled`,(e,t)=>!e||t!==Iv.link_mode?!1:this.client.metadata?.redirect?.linkMode===!0&&this.client.metadata?.redirect?.universal!==void 0&&this.client.metadata?.redirect?.universal!==``&&e?.redirect?.universal!==void 0&&e?.redirect?.universal!==``&&e?.redirect?.linkMode===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&typeof(global==null?void 0:global.Linking)<`u`),Z(this,`getAppLinkIfEnabled`,(e,t)=>this.isLinkModeEnabled(e,t)?e?.redirect?.universal:void 0),Z(this,`handleLinkModeMessage`,({url:e})=>{if(!e||!e.includes(`wc_ev`)||!e.includes(`topic`))return;let t=gp(e,`topic`)||``,n=decodeURIComponent(gp(e,`wc_ev`)||``),r=this.client.session.keys.includes(t);r&&this.client.session.update(t,{transportType:Iv.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:n,sessionExists:r})}),Z(this,`registerLinkModeListeners`,async()=>{var e;if(vp()||Hf()&&(e=this.client.metadata.redirect)!=null&&e.linkMode){let e=global==null?void 0:global.Linking;if(typeof e<`u`){e.addEventListener(`url`,this.handleLinkModeMessage,this.client.name);let t=await e.getInitialURL();t&&setTimeout(()=>{this.handleLinkModeMessage({url:t})},50)}}}),Z(this,`shouldSetTVF`,(e,t)=>{if(!t||e!==`wc_sessionRequest`)return!1;let{request:n}=t;return Object.keys(qS).includes(n.method)}),Z(this,`getTVFParams`,(e,t,n)=>{try{let r=t.request.method,i=this.extractTxHashesFromResult(r,n);return uC(lC({correlationId:e,rpcMethods:[r],chainId:t.chainId},this.isValidContractData(t.request.params)&&{contractAddresses:[t.request.params?.[0]?.to]}),{txHashes:i})}catch(e){this.client.logger.warn(`Error getting TVF params`,e)}return{}}),Z(this,`isValidContractData`,e=>{if(!e)return!1;try{let t=e?.data||e?.[0]?.data;if(!t.startsWith(`0x`))return!1;let n=t.slice(2);return/^[0-9a-fA-F]*$/.test(n)?n.length%2==0:!1}catch{}return!1}),Z(this,`extractTxHashesFromResult`,(e,t)=>{try{let n=qS[e];if(typeof t==`string`)return[t];let r=t[n.key];if(O_(r))return r;if(typeof r==`string`)return[r]}catch(e){this.client.logger.warn(`Error extracting tx hashes from result`,e)}return[]})}isInitialized(){if(!this.initialized){let{message:e}=J(`NOT_INITIALIZED`,this.name);throw Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(Nv.message,e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):this.onRelayMessage(e)})}async onRelayMessage(e){let{topic:t,message:n,attestation:r,transportType:i}=e,{publicKey:a}=this.client.auth.authKeys.keys.includes(tC)?this.client.auth.authKeys.get(tC):{responseTopic:void 0,publicKey:void 0},o=await this.client.core.crypto.decode(t,n,{receiverPublicKey:a,encoding:i===Iv.link_mode?Ig:Fg});try{yu(o)?(this.client.core.history.set(t,o),this.onRelayEventRequest({topic:t,payload:o,attestation:r,transportType:i,encryptedId:Kg(n)})):bu(o)?(await this.client.core.history.resolve(o),await this.onRelayEventResponse({topic:t,payload:o,transportType:i}),this.client.core.history.delete(t,o.id)):this.onRelayEventUnknownPayload({topic:t,payload:o,transportType:i})}catch(e){this.client.logger.error(e)}}registerExpirerEvents(){this.client.core.expirer.on(qv.expired,async e=>{let{topic:t,id:n}=cp(e.target);if(n&&this.client.pendingRequest.keys.includes(n))return await this.deletePendingSessionRequest(n,J(`EXPIRED`),!0);if(n&&this.client.auth.requests.keys.includes(n))return await this.deletePendingAuthRequest(n,J(`EXPIRED`),!0);t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit(`session_expire`,{topic:t})):n&&(await this.deleteProposal(n,!0),this.client.events.emit(`proposal_expire`,{id:n}))})}registerPairingEvents(){this.client.core.pairing.events.on(Uv.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(Uv.delete,e=>{this.addToRecentlyDeleted(e.topic,`pairing`)})}isValidPairingTopic(e){if(!j_(e,!1)){let{message:t}=J(`MISSING_OR_INVALID`,`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=J(`NO_MATCHING_KEY`,`pairing topic doesn't exist: ${e}`);throw Error(t)}if(up(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=J(`EXPIRED`,`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!j_(e,!1)){let{message:t}=J(`MISSING_OR_INVALID`,`session topic should be a string: ${e}`);throw Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:t}=J(`NO_MATCHING_KEY`,`session topic doesn't exist: ${e}`);throw Error(t)}if(up(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:t}=J(`EXPIRED`,`session topic: ${e}`);throw Error(t)}if(!this.client.core.crypto.keychain.has(e)){let{message:t}=J(`MISSING_OR_INVALID`,`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(j_(e,!1)){let{message:t}=J(`NO_MATCHING_KEY`,`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=J(`MISSING_OR_INVALID`,`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if(!Z_(e)){let{message:t}=J(`MISSING_OR_INVALID`,`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=J(`NO_MATCHING_KEY`,`proposal id doesn't exist: ${e}`);throw Error(t)}if(up(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:t}=J(`EXPIRED`,`proposal id: ${e}`);throw Error(t)}}},fC=class extends Jx{constructor(e,t){super(e,t,zS,IS),this.core=e,this.logger=t}},pC=class extends Jx{constructor(e,t){super(e,t,VS,IS),this.core=e,this.logger=t}},mC=class extends Jx{constructor(e,t){super(e,t,JS,IS,e=>e.id),this.core=e,this.logger=t}},hC=class extends Jx{constructor(e,t){super(e,t,ZS,eC,()=>tC),this.core=e,this.logger=t}},gC=class extends Jx{constructor(e,t){super(e,t,QS,eC),this.core=e,this.logger=t}},_C=class extends Jx{constructor(e,t){super(e,t,$S,eC,e=>e.id),this.core=e,this.logger=t}},vC=Object.defineProperty,yC=(e,t,n)=>t in e?vC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,bC=(e,t,n)=>yC(e,typeof t==`symbol`?t:t+``,n),xC=class{constructor(e,t){this.core=e,this.logger=t,bC(this,`authKeys`),bC(this,`pairingTopics`),bC(this,`requests`),this.authKeys=new hC(this.core,this.logger),this.pairingTopics=new gC(this.core,this.logger),this.requests=new _C(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}},SC=Object.defineProperty,CC=(e,t,n)=>t in e?SC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Q=(e,t,n)=>CC(e,typeof t==`symbol`?t:t+``,n),wC=class e extends NS{constructor(e){super(e),Q(this,`protocol`,`wc`),Q(this,`version`,2),Q(this,`name`,LS.name),Q(this,`metadata`),Q(this,`core`),Q(this,`logger`),Q(this,`events`,new ae.EventEmitter),Q(this,`engine`),Q(this,`session`),Q(this,`proposal`),Q(this,`pendingRequest`),Q(this,`auth`),Q(this,`signConfig`),Q(this,`on`,(e,t)=>this.events.on(e,t)),Q(this,`once`,(e,t)=>this.events.once(e,t)),Q(this,`off`,(e,t)=>this.events.off(e,t)),Q(this,`removeListener`,(e,t)=>this.events.removeListener(e,t)),Q(this,`removeAllListeners`,e=>this.events.removeAllListeners(e)),Q(this,`connect`,async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`pair`,async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`approve`,async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`reject`,async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`update`,async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`extend`,async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`request`,async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`respond`,async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`ping`,async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`emit`,async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`disconnect`,async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`find`,e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`getPendingSessionRequests`,()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}}),Q(this,`authenticate`,async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`formatAuthMessage`,e=>{try{return this.engine.formatAuthMessage(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`approveSessionAuthenticate`,async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),Q(this,`rejectSessionAuthenticate`,async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),this.name=e?.name||LS.name,this.metadata=e?.metadata||Yf(),this.signConfig=e?.signConfig;let t=typeof e?.logger<`u`&&typeof e?.logger!=`string`?e.logger:(0,lt.default)(Dt({level:e?.logger||LS.logger}));this.core=e?.core||new kS(e),this.logger=Mt(t,this.name),this.session=new pC(this.core,this.logger),this.proposal=new fC(this.core,this.logger),this.pendingRequest=new mC(this.core,this.logger),this.engine=new dC(this),this.auth=new xC(this.core,this.logger)}static async init(t){let n=new e(t);return await n.initialize(),n}get context(){return At(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace(`Initialized`);try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info(`SignClient Initialization Success`),setTimeout(()=>{this.engine.processRelayMessageCache()},(0,V.toMiliseconds)(V.ONE_SECOND))}catch(e){throw this.logger.info(`SignClient Initialization Failure`),this.logger.error(e.message),e}}},TC=i({UniversalProvider:()=>nM,default:()=>tM}),EC=`error`,DC=`wss://relay.walletconnect.org`,OC=`wc@2:universal_provider:`,kC=`https://rpc.walletconnect.org/v1/`,AC=`generic`,jC=`${kC}bundler`,MC={DEFAULT_CHAIN_CHANGED:`default_chain_changed`},NC=typeof globalThis<`u`?globalThis:typeof window<`u`?window:typeof global<`u`?global:typeof self<`u`?self:{};function PC(){this.__data__=[],this.size=0}var FC=PC;function IC(e,t){return e===t||e!==e&&t!==t}var LC=IC,RC=LC;function zC(e,t){for(var n=e.length;n--;)if(RC(e[n][0],t))return n;return-1}var BC=zC,VC=BC,HC=Array.prototype.splice;function UC(e){var t=this.__data__,n=VC(t,e);return n<0?!1:(n==t.length-1?t.pop():HC.call(t,n,1),--this.size,!0)}var WC=UC,GC=BC;function KC(e){var t=this.__data__,n=GC(t,e);return n<0?void 0:t[n][1]}var qC=KC,JC=BC;function YC(e){return JC(this.__data__,e)>-1}var XC=YC,ZC=BC;function QC(e,t){var n=this.__data__,r=ZC(n,e);return r<0?(++this.size,n.push([e,t])):n[r][1]=t,this}var $C=QC,ew=FC,tw=WC,nw=qC,rw=XC,iw=$C;function aw(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}aw.prototype.clear=ew,aw.prototype.delete=tw,aw.prototype.get=nw,aw.prototype.has=rw,aw.prototype.set=iw;var ow=aw,sw=ow;function cw(){this.__data__=new sw,this.size=0}var lw=cw;function uw(e){var t=this.__data__,n=t.delete(e);return this.size=t.size,n}var dw=uw;function fw(e){return this.__data__.get(e)}var pw=fw;function mw(e){return this.__data__.has(e)}var hw=mw,gw=typeof NC==`object`&&NC&&NC.Object===Object&&NC,_w=gw,vw=typeof self==`object`&&self&&self.Object===Object&&self,yw=_w||vw||Function(`return this`)(),bw=yw.Symbol,xw=bw,Sw=Object.prototype,Cw=Sw.hasOwnProperty,ww=Sw.toString,Tw=xw?xw.toStringTag:void 0;function Ew(e){var t=Cw.call(e,Tw),n=e[Tw];try{e[Tw]=void 0;var r=!0}catch{}var i=ww.call(e);return r&&(t?e[Tw]=n:delete e[Tw]),i}var Dw=Ew,Ow=Object.prototype.toString;function kw(e){return Ow.call(e)}var Aw=kw,jw=bw,Mw=Dw,Nw=Aw,Pw=`[object Null]`,Fw=`[object Undefined]`,Iw=jw?jw.toStringTag:void 0;function Lw(e){return e==null?e===void 0?Fw:Pw:Iw&&Iw in Object(e)?Mw(e):Nw(e)}var Rw=Lw;function zw(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}var Bw=zw,Vw=Rw,Hw=Bw,Uw=`[object AsyncFunction]`,Ww=`[object Function]`,Gw=`[object GeneratorFunction]`,Kw=`[object Proxy]`;function qw(e){if(!Hw(e))return!1;var t=Vw(e);return t==Ww||t==Gw||t==Uw||t==Kw}var Jw=qw,Yw=yw[`__core-js_shared__`],Xw=function(){var e=/[^.]+$/.exec(Yw&&Yw.keys&&Yw.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}();function Zw(e){return!!Xw&&Xw in e}var Qw=Zw,$w=Function.prototype.toString;function eT(e){if(e!=null){try{return $w.call(e)}catch{}try{return e+``}catch{}}return``}var tT=eT,nT=Jw,rT=Qw,iT=Bw,aT=tT,oT=/[\\^$.*+?()[\]{}|]/g,sT=/^\[object .+?Constructor\]$/,cT=Function.prototype,lT=Object.prototype,uT=cT.toString,dT=lT.hasOwnProperty,fT=RegExp(`^`+uT.call(dT).replace(oT,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`);function pT(e){return!iT(e)||rT(e)?!1:(nT(e)?fT:sT).test(aT(e))}var mT=pT;function hT(e,t){return e?.[t]}var gT=hT,_T=mT,vT=gT;function yT(e,t){var n=vT(e,t);return _T(n)?n:void 0}var bT=yT,xT=bT(yw,`Map`),ST=bT(Object,`create`),CT=ST;function wT(){this.__data__=CT?CT(null):{},this.size=0}var TT=wT;function ET(e){var t=this.has(e)&&delete this.__data__[e];return this.size-=+!!t,t}var DT=ET,OT=ST,kT=`__lodash_hash_undefined__`,AT=Object.prototype.hasOwnProperty;function jT(e){var t=this.__data__;if(OT){var n=t[e];return n===kT?void 0:n}return AT.call(t,e)?t[e]:void 0}var MT=jT,NT=ST,PT=Object.prototype.hasOwnProperty;function FT(e){var t=this.__data__;return NT?t[e]!==void 0:PT.call(t,e)}var IT=FT,LT=ST,RT=`__lodash_hash_undefined__`;function zT(e,t){var n=this.__data__;return this.size+=+!this.has(e),n[e]=LT&&t===void 0?RT:t,this}var BT=zT,VT=TT,HT=DT,UT=MT,WT=IT,GT=BT;function KT(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}KT.prototype.clear=VT,KT.prototype.delete=HT,KT.prototype.get=UT,KT.prototype.has=WT,KT.prototype.set=GT;var qT=KT,JT=ow,YT=xT;function XT(){this.size=0,this.__data__={hash:new qT,map:new(YT||JT),string:new qT}}var ZT=XT;function QT(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}var $T=QT;function eE(e,t){var n=e.__data__;return $T(t)?n[typeof t==`string`?`string`:`hash`]:n.map}var tE=eE,nE=tE;function rE(e){var t=nE(this,e).delete(e);return this.size-=+!!t,t}var iE=rE,aE=tE;function oE(e){return aE(this,e).get(e)}var sE=oE,cE=tE;function lE(e){return cE(this,e).has(e)}var uE=lE,dE=tE;function fE(e,t){var n=dE(this,e),r=n.size;return n.set(e,t),this.size+=n.size==r?0:1,this}var pE=fE,mE=ZT,hE=iE,gE=sE,_E=uE,vE=pE;function yE(e){var t=-1,n=e==null?0:e.length;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}yE.prototype.clear=mE,yE.prototype.delete=hE,yE.prototype.get=gE,yE.prototype.has=_E,yE.prototype.set=vE;var bE=yE,xE=ow,SE=xT,CE=bE,wE=200;function TE(e,t){var n=this.__data__;if(n instanceof xE){var r=n.__data__;if(!SE||r.length<wE-1)return r.push([e,t]),this.size=++n.size,this;n=this.__data__=new CE(r)}return n.set(e,t),this.size=n.size,this}var EE=TE,DE=ow,OE=lw,kE=dw,AE=pw,jE=hw,ME=EE;function NE(e){var t=this.__data__=new DE(e);this.size=t.size}NE.prototype.clear=OE,NE.prototype.delete=kE,NE.prototype.get=AE,NE.prototype.has=jE,NE.prototype.set=ME;var PE=NE,FE=bT,IE=function(){try{var e=FE(Object,`defineProperty`);return e({},``,{}),e}catch{}}(),LE=IE;function RE(e,t,n){t==`__proto__`&&LE?LE(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var zE=RE,BE=zE,VE=LC;function HE(e,t,n){(n!==void 0&&!VE(e[t],n)||n===void 0&&!(t in e))&&BE(e,t,n)}var UE=HE;function WE(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var GE=WE(),KE={exports:{}};(function(e,t){var n=yw,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r?n.Buffer:void 0,o=a?a.allocUnsafe:void 0;function s(e,t){if(t)return e.slice();var n=e.length,r=o?o(n):new e.constructor(n);return e.copy(r),r}e.exports=s})(KE,KE.exports);var qE=yw.Uint8Array;function JE(e){var t=new e.constructor(e.byteLength);return new qE(t).set(new qE(e)),t}var YE=JE;function XE(e,t){var n=t?YE(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var ZE=XE;function QE(e,t){var n=-1,r=e.length;for(t||=Array(r);++n<r;)t[n]=e[n];return t}var $E=QE,eD=Bw,tD=Object.create,nD=function(){function e(){}return function(t){if(!eD(t))return{};if(tD)return tD(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}();function rD(e,t){return function(n){return e(t(n))}}var iD=rD(Object.getPrototypeOf,Object),aD=Object.prototype;function oD(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||aD)}var sD=oD,cD=nD,lD=iD,uD=sD;function dD(e){return typeof e.constructor==`function`&&!uD(e)?cD(lD(e)):{}}var fD=dD;function pD(e){return typeof e==`object`&&!!e}var mD=pD,hD=Rw,gD=mD,_D=`[object Arguments]`;function vD(e){return gD(e)&&hD(e)==_D}var yD=vD,bD=mD,xD=Object.prototype,SD=xD.hasOwnProperty,CD=xD.propertyIsEnumerable,wD=yD(function(){return arguments}())?yD:function(e){return bD(e)&&SD.call(e,`callee`)&&!CD.call(e,`callee`)},TD=Array.isArray,ED=9007199254740991;function DD(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=ED}var OD=DD,kD=Jw,AD=OD;function jD(e){return e!=null&&AD(e.length)&&!kD(e)}var MD=jD,ND=MD,PD=mD;function FD(e){return PD(e)&&ND(e)}var ID=FD,LD={exports:{}};function RD(){return!1}var zD=RD;(function(e,t){var n=yw,r=zD,i=t&&!t.nodeType&&t,a=i&&e&&!e.nodeType&&e,o=a&&a.exports===i?n.Buffer:void 0;e.exports=(o?o.isBuffer:void 0)||r})(LD,LD.exports);var BD=Rw,VD=iD,HD=mD,UD=`[object Object]`,WD=Function.prototype,GD=Object.prototype,KD=WD.toString,qD=GD.hasOwnProperty,JD=KD.call(Object);function YD(e){if(!HD(e)||BD(e)!=UD)return!1;var t=VD(e);if(t===null)return!0;var n=qD.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&KD.call(n)==JD}var XD=YD,ZD=Rw,QD=OD,$D=mD,eO=`[object Arguments]`,tO=`[object Array]`,nO=`[object Boolean]`,rO=`[object Date]`,iO=`[object Error]`,aO=`[object Function]`,oO=`[object Map]`,sO=`[object Number]`,cO=`[object Object]`,lO=`[object RegExp]`,uO=`[object Set]`,dO=`[object String]`,fO=`[object WeakMap]`,pO=`[object ArrayBuffer]`,mO=`[object DataView]`,hO=`[object Float32Array]`,gO=`[object Float64Array]`,_O=`[object Int8Array]`,vO=`[object Int16Array]`,yO=`[object Int32Array]`,bO=`[object Uint8Array]`,xO=`[object Uint8ClampedArray]`,SO=`[object Uint16Array]`,CO=`[object Uint32Array]`,wO={};wO[hO]=wO[gO]=wO[_O]=wO[vO]=wO[yO]=wO[bO]=wO[xO]=wO[SO]=wO[CO]=!0,wO[eO]=wO[tO]=wO[pO]=wO[nO]=wO[mO]=wO[rO]=wO[iO]=wO[aO]=wO[oO]=wO[sO]=wO[cO]=wO[lO]=wO[uO]=wO[dO]=wO[fO]=!1;function TO(e){return $D(e)&&QD(e.length)&&!!wO[ZD(e)]}var EO=TO;function DO(e){return function(t){return e(t)}}var OO=DO,kO={exports:{}};(function(e,t){var n=gw,r=t&&!t.nodeType&&t,i=r&&e&&!e.nodeType&&e,a=i&&i.exports===r&&n.process;e.exports=function(){try{return i&&i.require&&i.require(`util`).types||a&&a.binding&&a.binding(`util`)}catch{}}()})(kO,kO.exports);var AO=EO,jO=OO,MO=kO.exports,NO=MO&&MO.isTypedArray,PO=NO?jO(NO):AO;function FO(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var IO=FO,LO=zE,RO=LC,zO=Object.prototype.hasOwnProperty;function BO(e,t,n){var r=e[t];(!(zO.call(e,t)&&RO(r,n))||n===void 0&&!(t in e))&&LO(e,t,n)}var VO=BO,HO=zE;function UO(e,t,n,r){var i=!n;n||={};for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?HO(n,s,c):VO(n,s,c)}return n}var WO=UO;function GO(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}var KO=GO,qO=9007199254740991,JO=/^(?:0|[1-9]\d*)$/;function YO(e,t){var n=typeof e;return t??=qO,!!t&&(n==`number`||n!=`symbol`&&JO.test(e))&&e>-1&&e%1==0&&e<t}var XO=YO,ZO=KO,QO=wD,$O=TD,ek=LD.exports,tk=XO,nk=PO,rk=Object.prototype.hasOwnProperty;function ik(e,t){var n=$O(e),r=!n&&QO(e),i=!n&&!r&&ek(e),a=!n&&!r&&!i&&nk(e),o=n||r||i||a,s=o?ZO(e.length,String):[],c=s.length;for(var l in e)(t||rk.call(e,l))&&!(o&&(l==`length`||i&&(l==`offset`||l==`parent`)||a&&(l==`buffer`||l==`byteLength`||l==`byteOffset`)||tk(l,c)))&&s.push(l);return s}var ak=ik;function ok(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var sk=ok,ck=Bw,lk=sD,uk=sk,dk=Object.prototype.hasOwnProperty;function fk(e){if(!ck(e))return uk(e);var t=lk(e),n=[];for(var r in e)r==`constructor`&&(t||!dk.call(e,r))||n.push(r);return n}var pk=fk,mk=ak,hk=pk,gk=MD;function _k(e){return gk(e)?mk(e,!0):hk(e)}var vk=_k,yk=WO,bk=vk;function xk(e){return yk(e,bk(e))}var Sk=xk,Ck=UE,wk=KE.exports,Tk=ZE,Ek=$E,Dk=fD,Ok=wD,kk=TD,Ak=ID,jk=LD.exports,Mk=Jw,Nk=Bw,Pk=XD,Fk=PO,Ik=IO,Lk=Sk;function Rk(e,t,n,r,i,a,o){var s=Ik(e,n),c=Ik(t,n),l=o.get(c);if(l){Ck(e,n,l);return}var u=a?a(s,c,n+``,e,t,o):void 0,d=u===void 0;if(d){var f=kk(c),p=!f&&jk(c),m=!f&&!p&&Fk(c);u=c,f||p||m?kk(s)?u=s:Ak(s)?u=Ek(s):p?(d=!1,u=wk(c,!0)):m?(d=!1,u=Tk(c,!0)):u=[]:Pk(c)||Ok(c)?(u=s,Ok(s)?u=Lk(s):(!Nk(s)||Mk(s))&&(u=Dk(c))):d=!1}d&&(o.set(c,u),i(u,c,r,a,o),o.delete(c)),Ck(e,n,u)}var zk=Rk,Bk=PE,Vk=UE,Hk=GE,Uk=zk,Wk=Bw,Gk=vk,Kk=IO;function qk(e,t,n,r,i){e!==t&&Hk(t,function(a,o){if(i||=new Bk,Wk(a))Uk(e,t,o,n,qk,r,i);else{var s=r?r(Kk(e,o),a,o+``,e,t,i):void 0;s===void 0&&(s=a),Vk(e,o,s)}},Gk)}var Jk=qk;function Yk(e){return e}var Xk=Yk;function Zk(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Qk=Zk,$k=Math.max;function eA(e,t,n){return t=$k(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=$k(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),Qk(e,this,s)}}var tA=eA;function nA(e){return function(){return e}}var rA=nA,iA=IE,aA=iA?function(e,t){return iA(e,`toString`,{configurable:!0,enumerable:!1,value:rA(t),writable:!0})}:Xk,oA=800,sA=16,cA=Date.now;function lA(e){var t=0,n=0;return function(){var r=cA(),i=sA-(r-n);if(n=r,i>0){if(++t>=oA)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var uA=lA(aA),dA=Xk,fA=tA,pA=uA;function mA(e,t){return pA(fA(e,t,dA),e+``)}var hA=mA,gA=LC,_A=MD,vA=XO,yA=Bw;function bA(e,t,n){if(!yA(n))return!1;var r=typeof t;return(r==`number`?_A(n)&&vA(t,n.length):r==`string`&&t in n)?gA(n[t],e):!1}var xA=bA,SA=hA,CA=xA;function wA(e){return SA(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&CA(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var TA=wA,EA=Jk,DA=TA(function(e,t,n){EA(e,t,n)}),OA=Object.defineProperty,kA=Object.defineProperties,AA=Object.getOwnPropertyDescriptors,jA=Object.getOwnPropertySymbols,MA=Object.prototype.hasOwnProperty,NA=Object.prototype.propertyIsEnumerable,PA=(e,t,n)=>t in e?OA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,FA=(e,t)=>{for(var n in t||={})MA.call(t,n)&&PA(e,n,t[n]);if(jA)for(var n of jA(t))NA.call(t,n)&&PA(e,n,t[n]);return e},IA=(e,t)=>kA(e,AA(t));function LA(e,t,n){let r=Lf(e);return t.rpcMap?.[r.reference]||`${kC}?chainId=${r.namespace}:${r.reference}&projectId=${n}`}function RA(e){return e.includes(`:`)?e.split(`:`)[1]:e}function zA(e){return e.map(e=>`${e.split(`:`)[0]}:${e.split(`:`)[1]}`)}function BA(e,t){let n=Object.keys(t.namespaces).filter(t=>t.includes(e));if(!n.length)return[];let r=[];return n.forEach(e=>{let n=t.namespaces[e].accounts;r.push(...n)}),r}function VA(e={},t={}){return DA(HA(e),HA(t))}function HA(e){let t={};if(!k_(e))return t;for(let[n,r]of Object.entries(e)){let e=x_(n)?[n]:r.chains,i=r.methods||[],a=r.events||[],o=r.rpcMap||{},s=S_(n);t[s]=IA(FA(FA({},t[s]),r),{chains:dp(e,t[s]?.chains),methods:dp(i,t[s]?.methods),events:dp(a,t[s]?.events),rpcMap:FA(FA({},o),t[s]?.rpcMap)})}return t}function UA(e){return e.includes(`:`)?e.split(`:`)[2]:e}function WA(e){let t={};for(let[n,r]of Object.entries(e)){let e=r.methods||[],i=r.events||[],a=r.accounts||[];t[n]={chains:x_(n)?[n]:r.chains?r.chains:zA(r.accounts),methods:e,events:i,accounts:a}}return t}function GA(e){return typeof e==`number`?e:e.includes(`0x`)?parseInt(e,16):(e=e.includes(`:`)?e.split(`:`)[1]:e,isNaN(Number(e))?e:Number(e))}var KA={},$=e=>KA[e],qA=(e,t)=>{KA[e]=t},JA=Object.defineProperty,YA=(e,t,n)=>t in e?JA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,XA=(e,t,n)=>YA(e,typeof t==`symbol`?t:t+``,n),ZA=class{constructor(e){XA(this,`name`,`polkadot`),XA(this,`client`),XA(this,`httpProviders`),XA(this,`events`),XA(this,`namespace`),XA(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let n=RA(t);e[n]=this.createHttpProvider(n,this.namespace.rpcMap?.[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}},QA=Object.defineProperty,$A=Object.defineProperties,ej=Object.getOwnPropertyDescriptors,tj=Object.getOwnPropertySymbols,nj=Object.prototype.hasOwnProperty,rj=Object.prototype.propertyIsEnumerable,ij=(e,t,n)=>t in e?QA(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,aj=(e,t)=>{for(var n in t||={})nj.call(t,n)&&ij(e,n,t[n]);if(tj)for(var n of tj(t))rj.call(t,n)&&ij(e,n,t[n]);return e},oj=(e,t)=>$A(e,ej(t)),sj=(e,t,n)=>ij(e,typeof t==`symbol`?t:t+``,n),cj=class{constructor(e){sj(this,`name`,`eip155`),sj(this,`client`),sj(this,`chainId`),sj(this,`namespace`),sj(this,`httpProviders`),sj(this,`events`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case`eth_requestAccounts`:return this.getAccounts();case`eth_accounts`:return this.getAccounts();case`wallet_switchEthereumChain`:return await this.handleSwitchChain(e);case`eth_chainId`:return parseInt(this.getDefaultChain());case`wallet_getCapabilities`:return await this.getCapabilities(e);case`wallet_getCallsStatus`:return await this.getCallStatus(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t),this.chainId=parseInt(e),this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}createHttpProvider(e,t){let n=t||LA(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let n=parseInt(RA(t));e[n]=this.createHttpProvider(n,this.namespace.rpcMap?.[t])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}getHttpProvider(){let e=this.chainId,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){let t=e.request.params?e.request.params[0]?.chainId:`0x0`;t=t.startsWith(`0x`)?t:`0x${t}`;let n=parseInt(t,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes(`wallet_switchEthereumChain`))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:t}]},chainId:this.namespace.chains?.[0]}),this.setDefaultChain(`${n}`);else throw Error(`Failed to switch to chain 'eip155:${n}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){let t=e.request?.params?.[0];if(!t)throw Error("Missing address parameter in `wallet_getCapabilities` request");let n=this.client.session.get(e.topic),r=n?.sessionProperties?.capabilities||{};if(r!=null&&r[t])return r?.[t];let i=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:oj(aj({},n.sessionProperties||{}),{capabilities:oj(aj({},r||{}),{[t]:i})})})}catch(e){console.warn(`Failed to update session with capabilities`,e)}return i}async getCallStatus(e){let t=this.client.session.get(e.topic),n=t.sessionProperties?.bundler_name;if(n){let t=this.getBundlerUrl(e.chainId,n);try{return await this.getUserOperationReceipt(t,e)}catch(e){console.warn(`Failed to fetch call status from bundler`,e,t)}}let r=t.sessionProperties?.bundler_url;if(r)try{return await this.getUserOperationReceipt(r,e)}catch(e){console.warn(`Failed to fetch call status from custom bundler`,e,r)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw Error(`Fetching call status not approved by the wallet.`)}async getUserOperationReceipt(e,t){let n=new URL(e),r=await fetch(n,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(Ql(`eth_getUserOperationReceipt`,[t.request.params?.[0]]))});if(!r.ok)throw Error(`Failed to fetch user operation receipt - ${r.status}`);return await r.json()}getBundlerUrl(e,t){return`${jC}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}},lj=Object.defineProperty,uj=(e,t,n)=>t in e?lj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,dj=(e,t,n)=>uj(e,typeof t==`symbol`?t:t+``,n),fj=class{constructor(e){dj(this,`name`,`solana`),dj(this,`client`),dj(this,`httpProviders`),dj(this,`events`),dj(this,`namespace`),dj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let n=RA(t);e[n]=this.createHttpProvider(n,this.namespace.rpcMap?.[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}},pj=Object.defineProperty,mj=(e,t,n)=>t in e?pj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,hj=(e,t,n)=>mj(e,typeof t==`symbol`?t:t+``,n),gj=class{constructor(e){hj(this,`name`,`cosmos`),hj(this,`client`),hj(this,`httpProviders`),hj(this,`events`),hj(this,`namespace`),hj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let n=RA(t);e[n]=this.createHttpProvider(n,this.namespace.rpcMap?.[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}},_j=Object.defineProperty,vj=(e,t,n)=>t in e?_j(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,yj=(e,t,n)=>vj(e,typeof t==`symbol`?t:t+``,n),bj=class{constructor(e){yj(this,`name`,`algorand`),yj(this,`client`),yj(this,`httpProviders`),yj(this,`events`),yj(this,`namespace`),yj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){let n=t||LA(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t,this.namespace.rpcMap?.[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace,this.client.core.projectId);return typeof n>`u`?void 0:new Tu(new Gu(n,$(`disableProviderPing`)))}},xj=Object.defineProperty,Sj=(e,t,n)=>t in e?xj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cj=(e,t,n)=>Sj(e,typeof t==`symbol`?t:t+``,n),wj=class{constructor(e){Cj(this,`name`,`cip34`),Cj(this,`client`),Cj(this,`httpProviders`),Cj(this,`events`),Cj(this,`namespace`),Cj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let n=this.getCardanoRPCUrl(t),r=RA(t);e[r]=this.createHttpProvider(r,n)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){let t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||this.getCardanoRPCUrl(e);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}},Tj=Object.defineProperty,Ej=(e,t,n)=>t in e?Tj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Dj=(e,t,n)=>Ej(e,typeof t==`symbol`?t:t+``,n),Oj=class{constructor(e){Dj(this,`name`,`elrond`),Dj(this,`client`),Dj(this,`httpProviders`),Dj(this,`events`),Dj(this,`namespace`),Dj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let n=RA(t);e[n]=this.createHttpProvider(n,this.namespace.rpcMap?.[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}},kj=Object.defineProperty,Aj=(e,t,n)=>t in e?kj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,jj=(e,t,n)=>Aj(e,typeof t==`symbol`?t:t+``,n),Mj=class{constructor(e){jj(this,`name`,`multiversx`),jj(this,`client`),jj(this,`httpProviders`),jj(this,`events`),jj(this,`namespace`),jj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{let n=RA(t);e[n]=this.createHttpProvider(n,this.namespace.rpcMap?.[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}},Nj=Object.defineProperty,Pj=(e,t,n)=>t in e?Nj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Fj=(e,t,n)=>Pj(e,typeof t==`symbol`?t:t+``,n),Ij=class{constructor(e){Fj(this,`name`,`near`),Fj(this,`client`),Fj(this,`httpProviders`),Fj(this,`events`),Fj(this,`namespace`),Fj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let n=t||LA(`${this.name}:${e}`,this.namespace);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t,this.namespace.rpcMap?.[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace);return typeof n>`u`?void 0:new Tu(new Gu(n,$(`disableProviderPing`)))}},Lj=Object.defineProperty,Rj=(e,t,n)=>t in e?Lj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,zj=(e,t,n)=>Rj(e,typeof t==`symbol`?t:t+``,n),Bj=class{constructor(e){zj(this,`name`,`tezos`),zj(this,`client`),zj(this,`httpProviders`),zj(this,`events`),zj(this,`namespace`),zj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let n=t||LA(`${this.name}:${e}`,this.namespace);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,n)}this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace);return typeof n>`u`?void 0:new Tu(new Gu(n))}},Vj=Object.defineProperty,Hj=(e,t,n)=>t in e?Vj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Uj=(e,t,n)=>Hj(e,typeof t==`symbol`?t:t+``,n),Wj=class{constructor(e){Uj(this,`name`,AC),Uj(this,`client`),Uj(this,`httpProviders`),Uj(this,`events`),Uj(this,`namespace`),Uj(this,`chainId`),this.namespace=e.namespace,this.events=$(`events`),this.client=$(`client`),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(MC.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error(`ChainId not found`);return e.split(`:`)[1]}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(`:`)[1]===this.chainId.toString()).map(e=>e.split(`:`)[2]))]:[]}createHttpProviders(){var e;let t={};return(e=this.namespace?.accounts)==null||e.forEach(e=>{let n=Lf(e);t[`${n.namespace}:${n.reference}`]=this.createHttpProvider(e)}),t}getHttpProvider(e){let t=this.httpProviders[e];if(typeof t>`u`)throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let n=this.createHttpProvider(e,t);n&&(this.httpProviders[e]=n)}createHttpProvider(e,t){let n=t||LA(e,this.namespace,this.client.core.projectId);if(!n)throw Error(`No RPC url provided for chainId: ${e}`);return new Tu(new Gu(n,$(`disableProviderPing`)))}},Gj=Object.defineProperty,Kj=Object.defineProperties,qj=Object.getOwnPropertyDescriptors,Jj=Object.getOwnPropertySymbols,Yj=Object.prototype.hasOwnProperty,Xj=Object.prototype.propertyIsEnumerable,Zj=(e,t,n)=>t in e?Gj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qj=(e,t)=>{for(var n in t||={})Yj.call(t,n)&&Zj(e,n,t[n]);if(Jj)for(var n of Jj(t))Xj.call(t,n)&&Zj(e,n,t[n]);return e},$j=(e,t)=>Kj(e,qj(t)),eM=(e,t,n)=>Zj(e,typeof t==`symbol`?t:t+``,n),tM=class e{constructor(e){eM(this,`client`),eM(this,`namespaces`),eM(this,`optionalNamespaces`),eM(this,`sessionProperties`),eM(this,`events`,new ae.default),eM(this,`rpcProviders`,{}),eM(this,`session`),eM(this,`providerOpts`),eM(this,`logger`),eM(this,`uri`),eM(this,`disableProviderPing`,!1),this.providerOpts=e,this.logger=typeof e?.logger<`u`&&typeof e?.logger!=`string`?e.logger:(0,lt.default)(Dt({level:e?.logger||EC})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(t){let n=new e(t);return await n.initialize(),n}async request(e,t,n){let[r,i]=this.validateChain(t);if(!this.session)throw Error(`Please call connect() before request()`);return await this.getProvider(r).request({request:Qj({},e),chainId:`${r}:${i}`,topic:this.session.topic,expiry:n})}sendAsync(e,t,n,r){let i=new Date().getTime();this.request(e,n,r).then(e=>t(null,$l(i,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw Error(`Sign Client not initialized`);return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){if(!this.session)throw Error(`Please call connect() before enable()`);await this.client.disconnect({topic:this.session?.topic,reason:D_(`USER_DISCONNECTED`)}),await this.cleanup()}async connect(e){if(!this.client)throw Error(`Sign Client not initialized`);if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw Error(`Sign Client not initialized`);this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:n,response:r}=await this.client.authenticate(e,t);n&&(this.uri=n,this.events.emit(`display_uri`,n));let i=await r();if(this.session=i.session,this.session){let e=WA(this.session.namespaces);this.namespaces=VA(this.namespaces,e),this.persist(`namespaces`,this.namespaces),this.onConnect()}return i}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){let{uri:t,approval:n}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});t&&(this.uri=t,this.events.emit(`display_uri`,t));let r=await n();this.session=r;let i=WA(r.namespaces);return this.namespaces=VA(this.namespaces,i),this.persist(`namespaces`,this.namespaces),this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;let[n,r]=this.validateChain(e),i=this.getProvider(n);i.name===AC?i.setDefaultChain(`${n}:${r}`,t):i.setDefaultChain(r,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info(`Cleaning up inactive pairings...`);let t=this.client.pairing.getAll();if(O_(t)){for(let n of t)e.deletePairings?this.client.core.expirer.set(n.topic,0):await this.client.core.relayer.subscriber.unsubscribe(n.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}}abortPairingAttempt(){this.logger.warn(`abortPairingAttempt is deprecated. This is now a no-op.`)}async checkStorage(){if(this.namespaces=await this.getFromStore(`namespaces`),this.optionalNamespaces=await this.getFromStore(`optionalNamespaces`)||{},this.client.session.length){let e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace(`Initialized`),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await wC.init({core:this.providerOpts.core,logger:this.providerOpts.logger||EC,relayUrl:this.providerOpts.relayUrl||DC,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.logger.trace(`SignClient Initialized`)}createProviders(){if(!this.client)throw Error(`Sign Client not initialized`);if(!this.session)throw Error(`Session not initialized. Please call connect() before enable()`);let e=[...new Set(Object.keys(this.session.namespaces).map(e=>S_(e)))];qA(`client`,this.client),qA(`events`,this.events),qA(`disableProviderPing`,this.disableProviderPing),e.forEach(e=>{if(!this.session)return;let t=BA(e,this.session),n=zA(t),r=$j(Qj({},VA(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:n});switch(e){case`eip155`:this.rpcProviders[e]=new cj({namespace:r});break;case`algorand`:this.rpcProviders[e]=new bj({namespace:r});break;case`solana`:this.rpcProviders[e]=new fj({namespace:r});break;case`cosmos`:this.rpcProviders[e]=new gj({namespace:r});break;case`polkadot`:this.rpcProviders[e]=new ZA({namespace:r});break;case`cip34`:this.rpcProviders[e]=new wj({namespace:r});break;case`elrond`:this.rpcProviders[e]=new Oj({namespace:r});break;case`multiversx`:this.rpcProviders[e]=new Mj({namespace:r});break;case`near`:this.rpcProviders[e]=new Ij({namespace:r});break;case`tezos`:this.rpcProviders[e]=new Bj({namespace:r});break;default:this.rpcProviders[AC]?this.rpcProviders[AC].updateNamespace(r):this.rpcProviders[AC]=new Wj({namespace:r})}})}registerEventListeners(){if(typeof this.client>`u`)throw Error(`Sign Client is not initialized`);this.client.on(`session_ping`,e=>{this.events.emit(`session_ping`,e)}),this.client.on(`session_event`,e=>{let{params:t}=e,{event:n}=t;if(n.name===`accountsChanged`){let e=n.data;e&&O_(e)&&this.events.emit(`accountsChanged`,e.map(UA))}else if(n.name===`chainChanged`){let e=t.chainId,n=t.event.data,r=S_(e),i=GA(e)===GA(n)?e:`${r}:${GA(n)}`;this.onChainChanged(i)}else this.events.emit(n.name,n.data);this.events.emit(`session_event`,e)}),this.client.on(`session_update`,({topic:e,params:t})=>{let{namespaces:n}=t,r=this.client?.session.get(e);this.session=$j(Qj({},r),{namespaces:n}),this.onSessionUpdate(),this.events.emit(`session_update`,{topic:e,params:t})}),this.client.on(`session_delete`,async e=>{await this.cleanup(),this.events.emit(`session_delete`,e),this.events.emit(`disconnect`,$j(Qj({},D_(`USER_DISCONNECTED`)),{data:e.topic}))}),this.on(MC.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[AC]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{this.getProvider(e).updateNamespace(this.session?.namespaces[e])})}setNamespaces(e){let{namespaces:t,optionalNamespaces:n,sessionProperties:r}=e;t&&Object.keys(t).length&&(this.namespaces=t),n&&Object.keys(n).length&&(this.optionalNamespaces=n),this.sessionProperties=r,this.persist(`namespaces`,t),this.persist(`optionalNamespaces`,n)}validateChain(e){let[t,n]=e?.split(`:`)||[``,``];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,n];if(t&&!Object.keys(this.namespaces||{}).map(e=>S_(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&n)return[t,n];let r=S_(Object.keys(this.namespaces)[0]);return[r,this.rpcProviders[r].getDefaultChain()]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,t=!1){if(!this.namespaces)return;let[n,r]=this.validateChain(e);r&&(t||this.getProvider(n).setDefaultChain(r),this.namespaces[n]?this.namespaces[n].defaultChain=r:this.namespaces[`${n}:${r}`]?this.namespaces[`${n}:${r}`].defaultChain=r:this.namespaces[`${n}:${r}`]={defaultChain:r},this.persist(`namespaces`,this.namespaces),this.events.emit(`chainChanged`,r))}onConnect(){this.createProviders(),this.events.emit(`connect`,{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist(`namespaces`,void 0),this.persist(`optionalNamespaces`,void 0),this.persist(`sessionProperties`,void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,t){this.client.core.storage.setItem(`${OC}/${e}`,t)}async getFromStore(e){return await this.client.core.storage.getItem(`${OC}/${e}`)}},nM=tM;export{nc as A,Mt as B,Ql as C,el as D,Xl as E,Ga as F,Ke as G,Dt as H,za as I,ce as J,qe as K,Ka as L,fo as M,uo as N,Qc as O,io as P,Wa as R,eu as S,Zl as T,At as U,lt as V,st as W,z as X,B as Y,c as Z,Tu as _,lf as a,bu as b,nf as c,Vd as d,Ud as f,Mu as g,Gu as h,uf as i,go as j,rc as k,cf as l,Wd as m,nM as n,tf as o,Hd as p,le as q,Rf as r,ff as s,TC as t,df as u,Su as v,$l as w,xu as x,yu as y,Ft as z};
|