ryco-cli 0.1.23 → 0.1.25
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/{AcpNativeLogging-COepku4a.cjs → AcpNativeLogging-CA6XYzIS.cjs} +1 -1
- package/dist/{AcpNativeLogging-D7e1dn7s.mjs → AcpNativeLogging-D4-VoHrq.mjs} +1 -1
- package/dist/{AzureDevOpsSourceControlProvider-BNGEg1R8.mjs → AzureDevOpsSourceControlProvider-B_E0XXfD.mjs} +2 -2
- package/dist/{AzureDevOpsSourceControlProvider-CrvgKNf2.cjs → AzureDevOpsSourceControlProvider-COmd21c-.cjs} +2 -2
- package/dist/{BitbucketSourceControlProvider-BzhsQwH-.cjs → BitbucketSourceControlProvider-CD8IvXQK.cjs} +2 -2
- package/dist/{BitbucketSourceControlProvider-Bt21jw68.mjs → BitbucketSourceControlProvider-pUKsNXcg.mjs} +2 -2
- package/dist/{ClaudeDriver-C4yu7Jit.mjs → ClaudeDriver-CGifBixr.mjs} +2 -2
- package/dist/{ClaudeDriver-B7mbf51W.cjs → ClaudeDriver-Dry5uJfX.cjs} +2 -2
- package/dist/{CodexDriver-CR0S17Lb.cjs → CodexDriver-BzR8gA8w.cjs} +3 -3
- package/dist/{CodexDriver-DnnqkGoY.mjs → CodexDriver-V4CL9APE.mjs} +3 -3
- package/dist/{CodexTextGeneration-tlfe1S5W.cjs → CodexTextGeneration-DTrSzY-I.cjs} +1 -1
- package/dist/{CodexTextGeneration-Cw-FZbSS.mjs → CodexTextGeneration-DoCidwvI.mjs} +1 -1
- package/dist/{CopilotDriver-GxKLX5pL.mjs → CopilotDriver-Dt13X60f.mjs} +3 -3
- package/dist/{CopilotDriver-IBd27Ji2.cjs → CopilotDriver-rLcA8PSN.cjs} +3 -3
- package/dist/{CursorDriver-C4Enoe9N.cjs → CursorDriver-C3s-8s9F.cjs} +3 -3
- package/dist/{CursorDriver-CNo9Uzo8.mjs → CursorDriver-HIPUs7cz.mjs} +3 -3
- package/dist/{ForgejoSourceControlProvider-BGXysSX6.mjs → ForgejoSourceControlProvider-CmvOAzEG.mjs} +2 -2
- package/dist/{ForgejoSourceControlProvider-Dh6DOoc8.cjs → ForgejoSourceControlProvider-JgiyrMqp.cjs} +2 -2
- package/dist/{GitHubSourceControlProvider-CPCYV8Xo.mjs → GitHubSourceControlProvider-BYuvbcBf.mjs} +2 -2
- package/dist/{GitHubSourceControlProvider-8hsv_kCE.cjs → GitHubSourceControlProvider-CItCpOcC.cjs} +2 -2
- package/dist/{GitLabSourceControlProvider-B0ZbF9Zx.cjs → GitLabSourceControlProvider-CMce22nU.cjs} +2 -2
- package/dist/{GitLabSourceControlProvider-Bvknpaon.mjs → GitLabSourceControlProvider-DZzEaVSi.mjs} +2 -2
- package/dist/{GrokDriver-DSPEmiwq.mjs → GrokDriver-CduUwiOH.mjs} +3 -3
- package/dist/{GrokDriver-RyyFeh_q.cjs → GrokDriver-D0jraOC_.cjs} +3 -3
- package/dist/{OpenCodeDriver-0q44rSQX.mjs → OpenCodeDriver-Bz_uJdMA.mjs} +2 -2
- package/dist/{OpenCodeDriver-CDcvPT9v.cjs → OpenCodeDriver-DxGpgtDS.cjs} +2 -2
- package/dist/{SourceControlProviderDiscoveryCatalog-DreaAH1H.cjs → SourceControlProviderDiscoveryCatalog-Dm_lhrhv.cjs} +1 -1
- package/dist/{SourceControlProviderDiscoveryCatalog-B37RHe2u.mjs → SourceControlProviderDiscoveryCatalog-ZtwPWoxE.mjs} +1 -1
- package/dist/bin.cjs +518 -263
- package/dist/bin.mjs +519 -264
- package/dist/client/assets/AccountSettings-Bv57-JYy.js +1 -0
- package/dist/client/assets/AiFocusSettings-DCPHmJpA.js +1 -0
- package/dist/client/assets/{AnimatedHeight-D9bpLPqe.js → AnimatedHeight-DPqb09B0.js} +1 -1
- package/dist/client/assets/AppearanceSettings-EmTrtb_U.js +1 -0
- package/dist/client/assets/BranchToolbar.logic-CHRK3hDt.js +1 -0
- package/dist/client/assets/BrowserPanel-2Xu08il5.js +1 -0
- package/dist/client/assets/ChatRightPanel-C1VD6GCV.js +194 -0
- package/dist/client/assets/ChatThreadRouteView-CNww3i2J.js +1 -0
- package/dist/client/assets/CommandPaletteDialog-B_f3fKp7.js +1 -0
- package/dist/client/assets/CompositeRoot-B40iitmH.js +1 -0
- package/dist/client/assets/ComputerUseSettings-BJs7jqR0.js +1 -0
- package/dist/client/assets/ConnectionsSettings-B9nfvgLG.js +7 -0
- package/dist/client/assets/ContextHandoffEndpointLabel-BSQOArMR.js +4 -0
- package/dist/client/assets/DiagnosticsSettings-BmrqOKMe.js +2 -0
- package/dist/client/assets/DialogHandle-pelzaaiH.js +1 -0
- package/dist/client/assets/DialogPopup-BLM0vN4N.js +1 -0
- package/dist/client/assets/DialogRoot-CY6ZzEUS.js +1 -0
- package/dist/client/assets/DialogTitle-BvIjMtMm.js +1 -0
- package/dist/client/assets/DialogTrigger-CIeVAA-a.js +1 -0
- package/dist/client/assets/DialogViewport-Cz0OadGI.js +1 -0
- package/dist/client/assets/DraftChatThreadRouteView-DMIGMESb.js +1 -0
- package/dist/client/assets/{ExternalIdentityWeb.logic-pjD4pCDd.js → ExternalIdentityWeb.logic-3rlDV7lT.js} +1 -1
- package/dist/client/assets/GlassSurface-CEVIdyfP.js +1 -0
- package/dist/client/assets/HostedConnectionControls-r9cyZPyF.js +1 -0
- package/dist/client/assets/HostedHubRoot-BkfafJ5x.js +2 -0
- package/dist/client/assets/HostedNativeAuthorizationRoute-CqHuW853.js +2 -0
- package/dist/client/assets/HostedNodeRenameDialog-C7m-nvTj.js +1 -0
- package/dist/client/assets/HostedRelayTrustNotice-DNZQyAX0.js +1 -0
- package/dist/client/assets/IntegrationsSettingsPanel-hul3ysgL.js +2 -0
- package/dist/client/assets/KeybindingsSettings-Cme6omBM.js +7 -0
- package/dist/client/assets/LazyBrowserPanel-COJFwNK7.js +2 -0
- package/dist/client/assets/McpServersSettings-CPeNF8_u.js +6 -0
- package/dist/client/assets/MobileSheet-BZo-RAfm.js +1 -0
- package/dist/client/assets/NodeSecuritySettings-CwT5nEW9.js +1 -0
- package/dist/client/assets/OpinionatedPluginsSettings-D8A1CbMG.js +1 -0
- package/dist/client/assets/PhoneGetAppInterstitial-BBnGXVkR.js +1 -0
- package/dist/client/assets/PhoneHome-BTKOPVjw.js +1 -0
- package/dist/client/assets/PhoneSettingsSurface-DdVCndyt.js +2 -0
- package/dist/client/assets/ProviderModelPicker-DoYEUZrn.js +1 -0
- package/dist/client/assets/ProvidersSettingsPanel-ldDCPVIY.js +1 -0
- package/dist/client/assets/QuitShortcutFeedback-mF7X0WMD.js +1 -0
- package/dist/client/assets/RedactedSensitiveText-DovqFcmM.js +1 -0
- package/dist/client/assets/RootAppShell-CzmEWO9w.js +7 -0
- package/dist/client/assets/Separator-BhAVTIOc.js +1 -0
- package/dist/client/assets/SettingsDialog-ByXgBN0U.js +2 -0
- package/dist/client/assets/SettingsPanels-Bgf4vkrJ.js +3 -0
- package/dist/client/assets/SettingsPanels.editor-d-rVlbeN.js +1 -0
- package/dist/client/assets/SourceControlSettings-dKw0FaN1.js +1 -0
- package/dist/client/assets/StatisticsPage-C2RuqDIK.js +1 -0
- package/dist/client/assets/StatisticsPanel-DqoXnrhQ.js +1 -0
- package/dist/client/assets/StatisticsSettingsLink-C_f31sb4.js +1 -0
- package/dist/client/assets/{ThreadTerminalDrawer-DcZk76Y9.js → ThreadTerminalDrawer-DaLrSTn9.js} +11 -11
- package/dist/client/assets/ThreadWorkspacePanel-BvRZIxZQ.js +2073 -0
- package/dist/client/assets/activity-bn_fBQGf.js +1 -0
- package/dist/client/assets/alert-BmLJh6DH.js +1 -0
- package/dist/client/assets/{appChrome-CiOQzE1d.js → appChrome-Dy57Ve9N.js} +1 -1
- package/dist/client/assets/arrow-left-pzj1cbX3.js +1 -0
- package/dist/client/assets/arrow-right-BW5jU-vo.js +1 -0
- package/dist/client/assets/arrow-up-right-AfC5AaSO.js +1 -0
- package/dist/client/assets/authorization-7xVVtCBu.js +1 -0
- package/dist/client/assets/badge-DnBuGHGL.js +1 -0
- package/dist/client/assets/bot-CsKkSRlb.js +1 -0
- package/dist/client/assets/{capabilities-BTd0MRtv.js → capabilities-DskyVNd2.js} +1 -1
- package/dist/client/assets/chart-column-DhvWXIiH.js +1 -0
- package/dist/client/assets/chevron-right-CITtTwME.js +1 -0
- package/dist/client/assets/clipboard-copy-fJnfdl4H.js +1 -0
- package/dist/client/assets/data-list-_E-Al1sf.js +1 -0
- package/dist/client/assets/desktopWorkspace-DycXKuMm.js +1 -0
- package/dist/client/assets/download-CLQzE1di.js +1 -0
- package/dist/client/assets/editorPreferences-Bg624RVT.js +1 -0
- package/dist/client/assets/empty-YXFtCUDN.js +1 -0
- package/dist/client/assets/group-DOCkUmuY.js +1 -0
- package/dist/client/assets/hostedConnectionCoordinator-JZ1dLx4v.js +1 -0
- package/dist/client/assets/{hostedPairing-PogXRAb7.js → hostedPairing-B_ylEEDa.js} +1 -1
- package/dist/client/assets/hubRoutes-C2S5of9_.js +1 -0
- package/dist/client/assets/{index-D5j6WG7w.js → index-CvRFRkBK.js} +2 -2
- package/dist/client/assets/input-C2xv8mMt.js +1 -0
- package/dist/client/assets/kbd-4-4mGdIa.js +1 -0
- package/dist/client/assets/key-round-CYcb9lAa.js +1 -0
- package/dist/client/assets/layers-CGlOWYxu.js +1 -0
- package/dist/client/assets/log-out-CZW2EpNJ.js +1 -0
- package/dist/client/assets/{logging-DfaR8ACp.js → logging-BpmZOfmu.js} +1 -1
- package/dist/client/assets/main-CC-U8LrA.css +2 -0
- package/dist/client/assets/main-CzDOnLFw.js +9 -0
- package/dist/client/assets/palette-CQOuNfSO.js +1 -0
- package/dist/client/assets/play-CPVy9wwV.js +1 -0
- package/dist/client/assets/primary-CjhRI8fe.js +2 -0
- package/dist/client/assets/providerDriverMeta-BVHpFupf.js +1 -0
- package/dist/client/assets/providerModels-BsybzP4P.js +1 -0
- package/dist/client/assets/{qr-code-Bun4dpvz.js → qr-code-BPqDlVMn.js} +1 -1
- package/dist/client/assets/qr-code-C6BVTc4V.js +1 -0
- package/dist/client/assets/radio-group-C8qudOQH.js +2 -0
- package/dist/client/assets/refresh-cw-B5Cz1z3e.js +1 -0
- package/dist/client/assets/runtime-Bxg7k81u.js +17 -0
- package/dist/client/assets/save-C7zM6ey6.js +1 -0
- package/dist/client/assets/scroll-area-5OU_pvTW.js +1 -0
- package/dist/client/assets/scrollEdges-qnEXfIOg.js +1 -0
- package/dist/client/assets/separator-B5HfRiaO.js +1 -0
- package/dist/client/assets/settingsLayout-CfKq88KD.js +1 -0
- package/dist/client/assets/sheet-B9gQDy_I.js +1 -0
- package/dist/client/assets/shield-alert-7yBlEyOs.js +1 -0
- package/dist/client/assets/shield-check-CnKgVJ0F.js +1 -0
- package/dist/client/assets/shield-rdjnBE2Q.js +1 -0
- package/dist/client/assets/sidebar-BdvL1Pbj.js +1 -0
- package/dist/client/assets/sidebarProjectFolders-BH8XBqNe.js +4 -0
- package/dist/client/assets/sidebarStatusText-CZKsUFBD.js +1 -0
- package/dist/client/assets/skeleton-CoyLqyaB.js +1 -0
- package/dist/client/assets/smartphone-CBgpMHXR.js +1 -0
- package/dist/client/assets/sparkles-w-UZXQx1.js +1 -0
- package/dist/client/assets/src-Bi-5Nw9C.js +14 -0
- package/dist/client/assets/star-BZ-RtSFD.js +1 -0
- package/dist/client/assets/switch-CEJEmLe7.js +48 -0
- package/dist/client/assets/toastHelpers-CSQRKo4F.js +1 -0
- package/dist/client/assets/toggle-DVGrNHjq.js +1 -0
- package/dist/client/assets/toggle-group-CNDOfNhH.js +1 -0
- package/dist/client/assets/tokenModePresentation-CQNdC9CW.js +1 -0
- package/dist/client/assets/tooltip-B7Z4qomY.js +1 -0
- package/dist/client/assets/unplug-CRUwFNFw.js +1 -0
- package/dist/client/assets/useAppSidebarCollapsed-wq6czkNJ.js +1 -0
- package/dist/client/assets/useBaseUiId-OYaGjnkh.js +1 -0
- package/dist/client/assets/useLabelableId-VMc-yITe.js +1 -0
- package/dist/client/assets/useNavigate-DVi0rBlf.js +1 -0
- package/dist/client/assets/usePhoneThreadActions-CwwHikjB.js +1 -0
- package/dist/client/assets/usePopupViewport-BcSIK_ph.js +1 -0
- package/dist/client/assets/useScrollLock-BQf9VYJT.js +1 -0
- package/dist/client/assets/{useStatistics-DfLU9_Qu.js → useStatistics-DczKdEfy.js} +15 -15
- package/dist/client/assets/useTriggerFocusGuards-DjP-D0_a.js +1 -0
- package/dist/client/assets/useValueChanged-CRwCkFdy.js +1 -0
- package/dist/client/assets/user-round-DStbWN3z.js +1 -0
- package/dist/client/assets/{vscode-icons-Dgo7Sslf.js → vscode-icons-BihBo3tb.js} +1 -1
- package/dist/client/assets/{workspaceMetadataProjection-UiprkDbH.js → workspaceMetadataProjection-j3BGlVOB.js} +1 -1
- package/dist/client/assets/wrench-BBIgGxy9.js +1 -0
- package/dist/client/index.html +1 -1
- package/dist/{collectUint8StreamText-C_VNyArd.mjs → collectUint8StreamText-CE1Re5Ij.mjs} +41 -3
- package/dist/{collectUint8StreamText-DStwNTTK.cjs → collectUint8StreamText-whblCEfg.cjs} +52 -2
- package/dist/{makeManagedServerProvider-GZcpSLrW.mjs → makeManagedServerProvider-CwYhl_P-.mjs} +1 -1
- package/dist/{makeManagedServerProvider-VzxWN-04.cjs → makeManagedServerProvider-Dy2Ny9tk.cjs} +1 -1
- package/dist/resource-monitor/ryco-resource-monitor +0 -0
- package/dist/resource-monitor/ryco-resource-monitor.exe +0 -0
- package/dist/resource-monitor/win32-arm64/ryco-resource-monitor.exe +0 -0
- package/dist/resource-monitor/win32-x64/ryco-resource-monitor.exe +0 -0
- package/package.json +1 -1
- package/dist/client/assets/AccountSettings-DGvZzAqN.js +0 -1
- package/dist/client/assets/AiFocusSettings-D8wZfNES.js +0 -1
- package/dist/client/assets/AppearanceSettings-BFo6g6_s.js +0 -1
- package/dist/client/assets/BranchToolbar.logic-CmO2U1U7.js +0 -1
- package/dist/client/assets/BrowserPanel-r6is5C3e.js +0 -1
- package/dist/client/assets/ChatRightPanel-BewXBRFZ.js +0 -194
- package/dist/client/assets/ChatThreadRouteView-CC_6FmHd.js +0 -1
- package/dist/client/assets/CommandPaletteDialog-ftA_Xg2G.js +0 -1
- package/dist/client/assets/CompositeRoot-arlgwzfX.js +0 -1
- package/dist/client/assets/ComputerUseSettings-V-oMtddy.js +0 -1
- package/dist/client/assets/ConnectionsSettings-BrFvrRjz.js +0 -7
- package/dist/client/assets/ContextHandoffEndpointLabel-CPeU4K5A.js +0 -4
- package/dist/client/assets/DiagnosticsSettings-Dk3JaIOU.js +0 -2
- package/dist/client/assets/DialogHandle-00ZXxxpz.js +0 -1
- package/dist/client/assets/DialogPopup-mazVJKyB.js +0 -1
- package/dist/client/assets/DialogRoot-CWlzx19Z.js +0 -1
- package/dist/client/assets/DialogTitle-CKaEtTky.js +0 -1
- package/dist/client/assets/DialogTrigger-CiElTNmo.js +0 -1
- package/dist/client/assets/DialogViewport-a5beR5bY.js +0 -1
- package/dist/client/assets/DraftChatThreadRouteView-DMwnSfgh.js +0 -1
- package/dist/client/assets/FloatingPortalLite-DWdtHKob.js +0 -1
- package/dist/client/assets/GlassSurface-BqfxDYiR.js +0 -1
- package/dist/client/assets/HostedConnectionControls-BmJd89CC.js +0 -1
- package/dist/client/assets/HostedHubRoot-CRIiJ67A.js +0 -2
- package/dist/client/assets/HostedNativeAuthorizationRoute-DcksCt9n.js +0 -2
- package/dist/client/assets/HostedRelayTrustNotice-C9pl5h2a.js +0 -1
- package/dist/client/assets/IntegrationsSettingsPanel-BnfjyLrM.js +0 -2
- package/dist/client/assets/KeybindingsSettings-CkW7lzvz.js +0 -7
- package/dist/client/assets/LazyBrowserPanel-C6uMUmoV.js +0 -2
- package/dist/client/assets/McpServersSettings-BdXgS-Pm.js +0 -6
- package/dist/client/assets/MobileSheet-D19YdeQ9.js +0 -1
- package/dist/client/assets/NodeSecuritySettings-BfcBgtEg.js +0 -1
- package/dist/client/assets/OpinionatedPluginsSettings-YY54IT7P.js +0 -1
- package/dist/client/assets/PhoneGetAppInterstitial-9r6NwJP8.js +0 -1
- package/dist/client/assets/PhoneHome-DnEJp0bU.js +0 -1
- package/dist/client/assets/PhoneSettingsSurface-NKJrLCxU.js +0 -2
- package/dist/client/assets/ProviderModelPicker-CYGv-4fE.js +0 -1
- package/dist/client/assets/ProvidersSettingsPanel-DsXHij4h.js +0 -1
- package/dist/client/assets/QuitShortcutFeedback-BVyYaNtd.js +0 -1
- package/dist/client/assets/RedactedSensitiveText-D8j7kpow.js +0 -1
- package/dist/client/assets/RootAppShell-D7c8sbA0.js +0 -7
- package/dist/client/assets/Separator-Bn8l1oSK.js +0 -1
- package/dist/client/assets/SettingsDialog-BlPX1mT8.js +0 -2
- package/dist/client/assets/SettingsPanels-CeuvwIV_.js +0 -3
- package/dist/client/assets/SettingsPanels.editor-CLJJeKLI.js +0 -1
- package/dist/client/assets/SourceControlSettings-D-GeZ6PW.js +0 -1
- package/dist/client/assets/StatisticsPage-poomFDoQ.js +0 -1
- package/dist/client/assets/StatisticsPanel-DbGgCCpZ.js +0 -1
- package/dist/client/assets/StatisticsSettingsLink-Brc9--O7.js +0 -1
- package/dist/client/assets/ThreadWorkspacePanel-Shhau2BD.js +0 -2073
- package/dist/client/assets/activity-Dy-wOS-S.js +0 -1
- package/dist/client/assets/alert-4WZo8oMe.js +0 -1
- package/dist/client/assets/arrow-left-gLRAasih.js +0 -1
- package/dist/client/assets/arrow-right-CAK2t4QL.js +0 -1
- package/dist/client/assets/arrow-up-right-DP0hmMEB.js +0 -1
- package/dist/client/assets/authorization-K_UCP_xh.js +0 -1
- package/dist/client/assets/badge-CYDyJZRJ.js +0 -1
- package/dist/client/assets/bot-CCrx5oCt.js +0 -1
- package/dist/client/assets/button-QrCU0tNP.js +0 -1
- package/dist/client/assets/chart-column-BvK6lSzG.js +0 -1
- package/dist/client/assets/chevron-down-yka18-iP.js +0 -1
- package/dist/client/assets/chevron-right-CHyIXx5W.js +0 -1
- package/dist/client/assets/clamp-D0kAXd-u.js +0 -1
- package/dist/client/assets/clipboard-copy-DfdkWOiT.js +0 -1
- package/dist/client/assets/copy-riIPLkKV.js +0 -1
- package/dist/client/assets/data-list-CsiYTho5.js +0 -1
- package/dist/client/assets/download-B0lbSdq5.js +0 -1
- package/dist/client/assets/editorPreferences-Cf2Smgu1.js +0 -1
- package/dist/client/assets/empty-CHk0OiOB.js +0 -1
- package/dist/client/assets/group-DfFZdj79.js +0 -1
- package/dist/client/assets/hostedConnectionCoordinator-DZh1yVqz.js +0 -1
- package/dist/client/assets/input-BAC5Cd3b.js +0 -1
- package/dist/client/assets/kbd-CMUW8K7b.js +0 -1
- package/dist/client/assets/key-round-Cm6itp2V.js +0 -1
- package/dist/client/assets/layers-DoDpJao_.js +0 -1
- package/dist/client/assets/loader-circle-D0CNb5GI.js +0 -1
- package/dist/client/assets/log-out-BuoOiS45.js +0 -1
- package/dist/client/assets/main-CRk9p9SC.css +0 -2
- package/dist/client/assets/main-DaXSCt8g.js +0 -9
- package/dist/client/assets/monitor-Dyigmrl2.js +0 -1
- package/dist/client/assets/palette-kIM_geXk.js +0 -1
- package/dist/client/assets/play-Dh8XDMnw.js +0 -1
- package/dist/client/assets/primary-DjXNHNGV.js +0 -2
- package/dist/client/assets/providerDriverMeta-Cl-ADdmZ.js +0 -1
- package/dist/client/assets/providerModels-dpugJUmV.js +0 -1
- package/dist/client/assets/qr-code-CkI1p05P.js +0 -1
- package/dist/client/assets/radio-group-Hh0oQGyf.js +0 -2
- package/dist/client/assets/react-dom-x9LNwWQc.js +0 -1
- package/dist/client/assets/refresh-cw-MqmsC7V0.js +0 -1
- package/dist/client/assets/runtime-L56puJDA.js +0 -17
- package/dist/client/assets/save-BSB81i-r.js +0 -1
- package/dist/client/assets/scroll-area-DCGCzd6v.js +0 -1
- package/dist/client/assets/scrollEdges-DIzjkUJG.js +0 -1
- package/dist/client/assets/separator-YeH3P39x.js +0 -1
- package/dist/client/assets/settingsLayout-CmNqO2kB.js +0 -1
- package/dist/client/assets/settingsSections.logic-Bg960p_I.js +0 -1
- package/dist/client/assets/sheet-CTbjQ5Bv.js +0 -1
- package/dist/client/assets/shield-DlqCO-0N.js +0 -1
- package/dist/client/assets/shield-alert-BrZ-Rb8N.js +0 -1
- package/dist/client/assets/shield-check-DHxdM6te.js +0 -1
- package/dist/client/assets/sidebar-4cwEndEB.js +0 -1
- package/dist/client/assets/sidebarProjectFolders-C7WDwUYJ.js +0 -4
- package/dist/client/assets/sidebarStatusText-Cq_MMykN.js +0 -1
- package/dist/client/assets/skeleton-BlostfCS.js +0 -1
- package/dist/client/assets/smartphone-OaA-Xj_d.js +0 -1
- package/dist/client/assets/sparkles-BXwkPX2M.js +0 -1
- package/dist/client/assets/src-gDjuIvMO.js +0 -14
- package/dist/client/assets/star-BjaAYD-x.js +0 -1
- package/dist/client/assets/switch-COrEGDkz.js +0 -48
- package/dist/client/assets/toast-C_F1LeME.js +0 -1
- package/dist/client/assets/toggle-BPNEBXg_.js +0 -1
- package/dist/client/assets/toggle-group-BC1zJ9xi.js +0 -1
- package/dist/client/assets/tokenModePresentation-DUJ8DMTy.js +0 -1
- package/dist/client/assets/tooltip-iy3_osu5.js +0 -1
- package/dist/client/assets/triangle-alert-YXqtFxD6.js +0 -1
- package/dist/client/assets/unplug-e3z4rXgY.js +0 -1
- package/dist/client/assets/useAppSidebarCollapsed-mtvJ7qbW.js +0 -1
- package/dist/client/assets/useLabelableId-NJQsKdL6.js +0 -1
- package/dist/client/assets/useNavigate-2tVq4iZ2.js +0 -1
- package/dist/client/assets/usePhoneThreadActions-97AsVVIR.js +0 -1
- package/dist/client/assets/usePopupViewport-8OM2irPK.js +0 -1
- package/dist/client/assets/usePositioner-0Kb-C4al.js +0 -1
- package/dist/client/assets/useRenderElement-D0HVF5g_.js +0 -1
- package/dist/client/assets/useRouter-CcIDS3PN.js +0 -1
- package/dist/client/assets/useScrollLock-AUqaSAkf.js +0 -1
- package/dist/client/assets/useSwipeDismiss-CcW-GPO_.js +0 -1
- package/dist/client/assets/useTriggerFocusGuards-ChBvppef.js +0 -1
- package/dist/client/assets/useValueChanged-CThCTn4h.js +0 -1
- package/dist/client/assets/user-round-evbX_eto.js +0 -1
- package/dist/client/assets/utils-5-6TOrS1.js +0 -1
- package/dist/client/assets/visuallyHidden-BRaogTVF.js +0 -1
- package/dist/client/assets/wrench-mA--bcId.js +0 -1
- package/dist/client/assets/x-_SjFRYll.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e}from"./useRenderElement-D0HVF5g_.js";var t={name:`activity`,size:24,node:[[`path`,{d:`M22 12h-2.48a2 2 0 0 0-1.93 1.46l-2.35 8.36a.25.25 0 0 1-.48 0L9.24 2.18a.25.25 0 0 0-.48 0l-2.35 8.36A2 2 0 0 1 4.49 12H2`,key:`169zse`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ia as e}from"./runtime-L56puJDA.js";import{t}from"./compiler-runtime-qmuS0Svy.js";import{t as n,u as r}from"./utils-5-6TOrS1.js";var i=t(),a=e(),o=r(`relative grid w-full items-start gap-x-2 gap-y-0.5 rounded-xl border px-3.5 py-3 text-card-foreground text-sm has-[>svg]:has-data-[slot=alert-action]:grid-cols-[calc(var(--spacing)*4)_1fr_auto] has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] has-data-[slot=alert-action]:grid-cols-[1fr_auto] has-[>svg]:gap-x-2 [&>svg]:h-lh [&>svg]:w-4`,{defaultVariants:{variant:`default`},variants:{variant:{default:`bg-transparent dark:bg-input/32 [&>svg]:text-muted-foreground`,error:`border-destructive/32 bg-destructive/4 [&>svg]:text-destructive`,info:`border-info/32 bg-info/4 [&>svg]:text-info`,success:`border-success/32 bg-success/4 [&>svg]:text-success`,warning:`border-warning/32 bg-warning/4 [&>svg]:text-warning`}}});function s(e){let t=(0,i.c)(10),r,s,c;t[0]===e?(r=t[1],s=t[2],c=t[3]):({className:r,variant:c,...s}=e,t[0]=e,t[1]=r,t[2]=s,t[3]=c);let l;t[4]!==r||t[5]!==c?(l=n(o({variant:c}),r),t[4]=r,t[5]=c,t[6]=l):l=t[6];let u;return t[7]!==s||t[8]!==l?(u=(0,a.jsx)(`div`,{className:l,"data-slot":`alert`,role:`alert`,...s}),t[7]=s,t[8]=l,t[9]=u):u=t[9],u}function c(e){let t=(0,i.c)(8),r,o;t[0]===e?(r=t[1],o=t[2]):({className:r,...o}=e,t[0]=e,t[1]=r,t[2]=o);let s;t[3]===r?s=t[4]:(s=n(`font-medium [svg~&]:col-start-2`,r),t[3]=r,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{className:s,"data-slot":`alert-title`,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function l(e){let t=(0,i.c)(8),r,o;t[0]===e?(r=t[1],o=t[2]):({className:r,...o}=e,t[0]=e,t[1]=r,t[2]=o);let s;t[3]===r?s=t[4]:(s=n(`flex flex-col gap-2.5 text-muted-foreground [svg~&]:col-start-2`,r),t[3]=r,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{className:s,"data-slot":`alert-description`,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}function u(e){let t=(0,i.c)(8),r,o;t[0]===e?(r=t[1],o=t[2]):({className:r,...o}=e,t[0]=e,t[1]=r,t[2]=o);let s;t[3]===r?s=t[4]:(s=n(`flex gap-1 max-sm:col-start-2 max-sm:mt-2 sm:row-start-1 sm:row-end-3 sm:self-center sm:[[data-slot=alert-description]~&]:col-start-2 sm:[[data-slot=alert-title]~&]:col-start-2 sm:[svg~&]:col-start-2 sm:[svg~[data-slot=alert-description]~&]:col-start-3 sm:[svg~[data-slot=alert-title]~&]:col-start-3`,r),t[3]=r,t[4]=s);let c;return t[5]!==o||t[6]!==s?(c=(0,a.jsx)(`div`,{className:s,"data-slot":`alert-action`,...o}),t[5]=o,t[6]=s,t[7]=c):c=t[7],c}export{c as i,u as n,l as r,s as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e}from"./useRenderElement-D0HVF5g_.js";var t={name:`arrow-left`,size:24,node:[[`path`,{d:`m12 19-7-7 7-7`,key:`1l729n`}],[`path`,{d:`M19 12H5`,key:`x3x0zl`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e}from"./useRenderElement-D0HVF5g_.js";var t={name:`arrow-right`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}],[`path`,{d:`m12 5 7 7-7 7`,key:`xquz4c`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{f as e}from"./useRenderElement-D0HVF5g_.js";var t={name:`arrow-up-right`,size:24,node:[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]};t.node;var n=e(t);export{n as t};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{$n as e,$t as t,An as n,Ar as r,At as i,B as a,Bn as o,Bt as s,Cn as c,Cr as l,Ct as u,Dn as d,Dr as f,Dt as p,En as m,Er as h,Et as g,F as _,Fn as v,Ft as y,Gn as b,Gr as ee,Gt as x,Hn as S,Hr as C,Ht as w,In as T,It as E,Jn as D,Jr as O,Jt as k,Kn as A,Kr as j,Kt as M,Ln as N,Lt as P,Mn as te,Mr as ne,Mt as re,Nn as ie,Nr as ae,On as oe,Or as se,Ot as ce,Pn as le,Pr as ue,Pt as de,Qn as fe,Qr as pe,Qt as me,Rn as he,Rt as ge,Sn as _e,Sr as ve,St as ye,Tn as be,Tr as xe,Tt as Se,Un as Ce,Ut as we,Vn as Te,Vt as Ee,Wn as De,Wr as Oe,Wt as ke,Xn as Ae,Xt as je,Yn as Me,Yt as Ne,Zn as Pe,Zt as Fe,_n as Ie,_r as Le,_t as Re,an as ze,ar as Be,bn as Ve,br as He,bt as Ue,ca as We,cn as Ge,cr as Ke,dn as qe,dr as Je,dt as Ye,en as Xe,er as Ze,f as Qe,fn as $e,fr as et,ft as tt,gn as nt,gr as rt,gt as it,hn as at,hr as ot,ht as st,in as ct,ir as lt,jn as ut,jr as dt,jt as ft,kn as pt,kr as mt,kt as ht,ln as gt,lr as _t,mn as vt,mr as yt,mt as bt,nn as xt,nr as St,on as Ct,or as wt,pn as Tt,pr as Et,pt as Dt,qn as Ot,qt as kt,rn as At,rr as jt,sn as Mt,sr as Nt,t as F,tn as Pt,tr as Ft,u as It,ua as Lt,uc as Rt,un as zt,ur as Bt,vn as Vt,vr as Ht,vt as Ut,wn as Wt,wr as Gt,wt as Kt,xn as qt,xr as Jt,xt as Yt,yn as Xt,yr as Zt,yt as Qt,zn as $t,zt as en}from"./src-gDjuIvMO.js";function tn(e){if(!/^[A-Za-z0-9_-]+$/u.test(e))throw Error(`Invalid encoded material.`);let t=e.replace(/-/gu,`+`).replace(/_/gu,`/`).padEnd(Math.ceil(e.length/4)*4,`=`),n;try{n=atob(t)}catch{throw Error(`Invalid encoded material.`)}let r=new Uint8Array(n.length);for(let e=0;e<n.length;e+=1)r[e]=n.charCodeAt(e);return r}function nn(e){let t=e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/gu,`-`).replace(/\//gu,`_`).replace(/=+$/gu,``)}var rn=Uint8Array.from([32,9,13,10,32,9,13,10]);function an(e){return e.byteLength>=8&&e[0]===0}function on(e){if(e.byteLength<rn.byteLength)return!1;for(let t=0;t<rn.byteLength;t+=1)if(e[t]!==rn[t])return!1;return!0}function sn(e){return on(e)?{advertised:!0,message:e.subarray(rn.byteLength)}:{advertised:!1,message:e}}function cn(e,t,n){e[0]=0,e[1]=1,e[2]=+!!n,e[3]=0,e[4]=t>>>24&255,e[5]=t>>>16&255,e[6]=t>>>8&255,e[7]=t&255}function ln(e){return(e[4]<<24>>>0)+(e[5]<<16>>>0)+(e[6]<<8>>>0)+e[7]}function un(e,t){if(e.byteLength<=t)return[e];let n=t-8;if(n<=0)throw Error(`Relay chunk limit is too small to carry a chunk header.`);let r=[];for(let t=0;t<e.byteLength;t+=n){let i=e.subarray(t,Math.min(t+n,e.byteLength)),a=new Uint8Array(8+i.byteLength);cn(a,e.byteLength,t+i.byteLength>=e.byteLength),a.set(i,8),r.push(a)}return r}function dn(e,t){if(!Number.isSafeInteger(t.maxChunkBytes)||t.maxChunkBytes<=0||!Number.isSafeInteger(t.maxMessageBytes)||t.maxMessageBytes<0||!Number.isSafeInteger(e)||e<0)throw TypeError(`Relay chunk limits must be positive and message limits non-negative safe integers.`);if(e>t.maxMessageBytes)return{kind:`error`,reason:`message_too_large`};if(e<=t.maxChunkBytes){let n=e+rn.byteLength<=t.maxChunkBytes;return{kind:`ready`,advertised:n,chunked:!1,payloadBytes:[n?rn.byteLength+e:e]}}if(!t.peerSupportsChunking)return{kind:`error`,reason:`peer_unsupported`};let n=t.maxChunkBytes-8;if(n<=0)throw Error(`Relay chunk limit is too small to carry a chunk header.`);let r=[];for(let t=0;t<e;t+=n)r.push(8+Math.min(n,e-t));return{kind:`ready`,advertised:!1,chunked:!0,payloadBytes:r}}function fn(e,t){let n=dn(e.byteLength,t);if(n.kind===`error`)return n;if(n.chunked)return{kind:`ready`,payloads:un(e,t.maxChunkBytes)};if(!n.advertised)return{kind:`ready`,payloads:[e]};let r=new Uint8Array(rn.byteLength+e.byteLength);return r.set(rn),r.set(e,rn.byteLength),{kind:`ready`,payloads:[r]}}var pn=class{#e=[];#t=0;#n=0;#r=!1;get heldBytes(){return this.#t}get incompleteMessage(){return this.#n!==0}get peerSupportsChunking(){return this.#r}push(e){if(!an(e)){if(this.#n!==0)return this.reset(),{kind:`error`,reason:`interleaved_legacy`};let t=sn(e);return t.advertised&&(this.#r=!0),{kind:`done`,message:t.message}}if(e[1]!==1||e[2]&-2||e[3]!==0)return this.reset(),{kind:`error`,reason:`bad_header`};let t=ln(e),n=e.subarray(8),r=!!(e[2]&1);if(n.byteLength===0)return this.reset(),{kind:`error`,reason:`bad_header`};if(this.#n===0){if(t>4194304||t===0)return{kind:`error`,reason:`message_too_large`};this.#n=t,this.#t=0}else if(t!==this.#n)return this.reset(),{kind:`error`,reason:`total_mismatch`};if(this.#t+n.byteLength>this.#n)return this.reset(),{kind:`error`,reason:`overflow`};this.#r=!0;let i=Uint8Array.from(n);if(n.fill(0),this.#e.push(i),this.#t+=n.byteLength,!r)return{kind:`pending`};if(this.#t!==this.#n)return this.reset(),{kind:`error`,reason:`truncated`};let a=new Uint8Array(this.#n),o=0;for(let e of this.#e)a.set(e,o),o+=e.byteLength,e.fill(0);return this.#e=[],this.#t=0,this.#n=0,{kind:`done`,message:a}}reset(){for(let e of this.#e)e.fill(0);this.#e=[],this.#t=0,this.#n=0,this.#r=!1}},mn=4096,hn=8192,gn=Re;function _n(e){return e.maxQueuedBytes-e.maxControlFrameBytes}function vn(e){let t=Math.min(C,e.maxQueuedBytes-e.maxControlFrameBytes),n=t-32;return{effectiveMessageCeiling:t,plaintextCeiling:n,establishable:n>0}}var yn=1500,bn=3e3,xn=3e3,Sn=1500,Cn=1e3,wn=4294967295n,Tn=18446744073709551615n,En={digits:60,groups:12,digitsPerGroup:5,separator:` `},Dn={chars:8,groups:2,charsPerGroup:4,separator:`-`},On=`0123456789ABCDEFGHJKMNPQRSTVWXYZ`;rn.byteLength;var kn=8e3,An=BigInt(2**32-1),jn=BigInt(32);function Mn(e,t=!1){return t?{h:Number(e&An),l:Number(e>>jn&An)}:{h:Number(e>>jn&An)|0,l:Number(e&An)|0}}function Nn(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=Mn(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}var Pn=e=>e/2**32|0,Fn=e=>e>>>0;function In(e,t,n,r){let i=Pn(n),a=Fn(n);e.setUint32(t,r?a:i,r),e.setUint32(t+4,r?i:a,r)}var Ln=(e,t,n)=>e>>>n,Rn=(e,t,n)=>e<<32-n|t>>>n,zn=(e,t,n)=>e>>>n|t<<32-n,Bn=(e,t,n)=>e<<32-n|t>>>n,Vn=(e,t,n)=>e<<64-n|t>>>n-32,Hn=(e,t,n)=>e>>>n-32|t<<64-n;function Un(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}var Wn=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),Gn=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,Kn=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),qn=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,Jn=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),Yn=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0;function Xn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var Zn=e=>e?`"${e}" `:``;function Qn(e,t=``){if(typeof e!=`number`)throw TypeError(Zn(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(Zn(t)+`expected integer >= 0, got `+e);return e}function $n(e,t,n=``){if(Xn(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Qn(t,`length`);let r=Xn(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=Zn(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}function er(e){if(typeof e!=`function`||typeof e.create!=`function`)throw TypeError(`expected hash wrapped by utils.createHasher`);if(Qn(e.outputLen),Qn(e.blockLen),e.outputLen<1||e.blockLen<1)throw Error(`hash blockLen / outputLen must be >= 1`)}var tr=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError((t===`object`?``:`"${t}" `)+`expected object, got type=`+typeof e)};function nr(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function rr(e,t){$n(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function ir(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function ar(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function or(e,t){return e<<32-t|e>>>t}var sr=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,cr=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function lr(e){if($n(e),sr)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=cr[e[n]];return t}function ur(e){return e>=48&&e<=57?e-48:e>=65&&e<=70?e-55:e>=97&&e<=102?e-87:void 0}function dr(e){if(typeof e!=`string`)throw TypeError(`hex string expected, got `+typeof e);if(sr)try{return Uint8Array.fromHex(e)}catch(e){throw e instanceof SyntaxError?RangeError(e.message):e}let t=e.length,n=t/2;if(t%2)throw RangeError(`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=ur(e.charCodeAt(i)),a=ur(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw RangeError(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function fr(e){if(typeof e!=`string`)throw TypeError(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function pr(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];$n(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}function mr(e,t,n=`opts`){return tr(e,`defaults`),t!==void 0&&tr(t,n),Object.assign(e,t)}function hr(e,t={}){if(typeof e!=`function`)throw TypeError(`"hashCons" expected function, got type=`+typeof e);t=mr({},t,`info`);let n=(t,n)=>e(n).update(t).digest(),r=e(void 0);return n.outputLen=r.outputLen,n.blockLen=r.blockLen,n.canXOF=r.canXOF,n.create=t=>e(t),Object.assign(n,t),Object.freeze(n)}function gr(e=32){Qn(e,`bytesLength`);let t=typeof globalThis==`object`?globalThis.crypto:null;if(typeof t?.getRandomValues!=`function`)throw Error(`crypto.getRandomValues must be defined`);if(e>65536)throw RangeError(`"bytesLength" expected <= 65536, got ${e}`);return t.getRandomValues(new Uint8Array(e))}var _r=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function vr(e,t,n){return e&t^~e&n}function yr(e,t,n){return e&t^e&n^t&n}var br=class{blockLen;outputLen;canXOF=!1;padOffset;isLE;buffer;view;finished=!1;length=0;pos=0;destroyed=!1;constructor(e,t,n,r){this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=ar(this.buffer)}update(e){nr(this),$n(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length,a=!1;for(let o=0;o<i;){let s=Math.min(r-this.pos,i-o);if(s===r){let t=ar(e);for(;r<=i-o;o+=r)this.process(t,o);a=!0;continue}n.set(o===0&&s===i?e:e.subarray(o,o+s),this.pos),this.pos+=s,o+=s,this.pos===r&&(this.process(t,0),this.pos=0,a=!0)}return this.length+=e.length,a&&this.roundClean(),this}digestInto(e){nr(this),rr(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,t.fill(0,a),this.padOffset>r-a&&(this.process(n,0),t.fill(0)),In(n,r-8,this.length*8,i),this.process(n,0),this.roundClean();let o=e===t?n:ar(e),s=this.outputLen,c=s/4,l=this.get();if(s%4||c>l.length)throw Error(`invalid outputLen`);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}_cloneIntoMeta(e){let{buffer:t,length:n,finished:r,destroyed:i,pos:a}=this;return e.destroyed=i,e.finished=r,e.length=n,e.pos=a,a&&e.buffer.set(t),e}clone(){return this._cloneInto()}},xr=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Sr=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),Cr=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),wr=new Uint32Array(64),Tr=class extends br{A=0;B=0;C=0;D=0;E=0;F=0;G=0;H=0;constructor(e,t){super(64,e,8,!1),this.A=t[0]|0,this.B=t[1]|0,this.C=t[2]|0,this.D=t[3]|0,this.E=t[4]|0,this.F=t[5]|0,this.G=t[6]|0,this.H=t[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}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)wr[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=wr[e-15],n=wr[e-2],r=or(t,7)^or(t,18)^t>>>3,i=or(n,17)^or(n,19)^n>>>10;wr[e]=i+wr[e-7]+r+wr[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=or(o,6)^or(o,11)^or(o,25),u=l+t+vr(o,s,c)+Cr[e]+wr[e]|0,d=(or(n,2)^or(n,13)^or(n,22))+yr(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(){ir(wr)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ir(this.buffer)}},Er=class extends Tr{constructor(){super(32,xr)}},Dr=Nn(`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))),Or=Dr[0],kr=Dr[1],Ar=new Uint32Array(80),jr=new Uint32Array(80),Mr=class extends br{Ah=0;Al=0;Bh=0;Bl=0;Ch=0;Cl=0;Dh=0;Dl=0;Eh=0;El=0;Fh=0;Fl=0;Gh=0;Gl=0;Hh=0;Hl=0;constructor(e,t){super(128,e,16,!1),this.Ah=t[0]|0,this.Al=t[1]|0,this.Bh=t[2]|0,this.Bl=t[3]|0,this.Ch=t[4]|0,this.Cl=t[5]|0,this.Dh=t[6]|0,this.Dl=t[7]|0,this.Eh=t[8]|0,this.El=t[9]|0,this.Fh=t[10]|0,this.Fl=t[11]|0,this.Gh=t[12]|0,this.Gl=t[13]|0,this.Hh=t[14]|0,this.Hl=t[15]|0}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}_cloneInto(e){return(e||=new this.constructor).set(...this.get()),this._cloneIntoMeta(e)}process(e,t){for(let n=0;n<16;n++,t+=4)Ar[n]=e.getUint32(t),jr[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=Ar[e-15]|0,n=jr[e-15]|0,r=zn(t,n,1)^zn(t,n,8)^Ln(t,n,7),i=Bn(t,n,1)^Bn(t,n,8)^Rn(t,n,7),a=Ar[e-2]|0,o=jr[e-2]|0,s=zn(a,o,19)^Vn(a,o,61)^Ln(a,o,6),c=Kn(i,Bn(a,o,19)^Hn(a,o,61)^Rn(a,o,6),jr[e-7],jr[e-16]),l=qn(c,r,s,Ar[e-7],Ar[e-16]);Ar[e]=l|0,jr[e]=c|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=zn(u,d,14)^zn(u,d,18)^Vn(u,d,41),v=Bn(u,d,14)^Bn(u,d,18)^Hn(u,d,41),y=u&f^~u&m,b=d&p^~d&h,ee=Jn(_,v,b,kr[e],jr[e]),x=Yn(ee,g,t,y,Or[e],Ar[e]),S=ee|0,C=zn(n,r,28)^Vn(n,r,34)^Vn(n,r,39),w=Bn(n,r,28)^Hn(n,r,34)^Hn(n,r,39),T=n&i^n&o^i&o,E=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}=Un(c|0,l|0,x|0,S|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let D=Wn(S,w,E);n=Gn(D,x,C,T),r=D|0}({h:n,l:r}=Un(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=Un(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=Un(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=Un(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=Un(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=Un(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=Un(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=Un(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(){ir(Ar,jr)}destroy(){this.destroyed=!0,ir(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},Nr=class extends Mr{constructor(){super(64,Sr)}},I=hr(()=>new Er,_r(1)),Pr=hr(()=>new Nr,_r(3)),Fr=[`Object`,`RegExp`,`Date`,`Error`,`Map`,`Set`,`WeakMap`,`WeakSet`,`ArrayBuffer`,`SharedArrayBuffer`,`DataView`,`Promise`,`URL`,`HTMLElement`,`Int8Array`,`Uint8ClampedArray`,`Int16Array`,`Uint16Array`,`Int32Array`,`Uint32Array`,`Float32Array`,`Float64Array`,`BigInt64Array`,`BigUint64Array`,`Tagged`];function Ir(e){if(e===null)return`null`;if(e===void 0)return`undefined`;if(e===!0||e===!1)return`boolean`;let t=typeof e;return t===`string`||t===`number`||t===`bigint`||t===`symbol`?t:t===`function`?`Function`:Array.isArray(e)?`Array`:e instanceof Uint8Array?`Uint8Array`:e.constructor===Object?`Object`:Lr(e)||`Object`}function Lr(e){let t=Object.prototype.toString.call(e).slice(8,-1);if(Fr.includes(t))return t}var L=class{constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:+(this.major>e.major)}static equals(e,t){return e===t||e.major===t.major&&e.name===t.name}};L.uint=new L(0,`uint`,!0),L.negint=new L(1,`negint`,!0),L.bytes=new L(2,`bytes`,!0),L.string=new L(3,`string`,!0),L.array=new L(4,`array`,!1),L.map=new L(5,`map`,!1),L.tag=new L(6,`tag`,!1),L.float=new L(7,`float`,!0),L.false=new L(7,`false`,!0),L.true=new L(7,`true`,!0),L.null=new L(7,`null`,!0),L.undefined=new L(7,`undefined`,!0),L.break=new L(7,`break`,!0);var R=class{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}},Rr=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&typeof globalThis.Buffer.isBuffer==`function`,zr=new TextEncoder;function Br(e){return Rr&&globalThis.Buffer.isBuffer(e)}function Vr(e){return e instanceof Uint8Array?Br(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e:Uint8Array.from(e)}var Hr=24,Ur=200,Wr=Rr?e=>e.length>=Hr?globalThis.Buffer.from(e):Xr(e):e=>e.length>=Ur?zr.encode(e):Xr(e),Gr=e=>Uint8Array.from(e),Kr=Rr?(e,t,n)=>Br(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n),qr=Rr?(e,t)=>(e=e.map(e=>e instanceof Uint8Array?e:globalThis.Buffer.from(e)),Vr(globalThis.Buffer.concat(e,t))):(e,t)=>{let n=new Uint8Array(t),r=0;for(let t of e)r+t.length>n.length&&(t=t.subarray(0,n.length-r)),n.set(t,r),r+=t.length;return n},Jr=Rr?e=>globalThis.Buffer.allocUnsafe(e):e=>new Uint8Array(e);function Yr(e,t){if(Br(e)&&Br(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}function Xr(e){let t=[],n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=i&63|128):(i&64512)==55296&&r+1<e.length&&(e.charCodeAt(r+1)&64512)==56320?(i=65536+((i&1023)<<10)+(e.charCodeAt(++r)&1023),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=i&63|128):(i>=55296&&i<=57343&&(i=65533),t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=i&63|128)}return t}var Zr=256,Qr=class{constructor(e=Zr){this.chunkSize=e,this.cursor=0,this.maxCursor=-1,this.chunks=[],this._initReuseChunk=null}reset(){this.cursor=0,this.maxCursor=-1,this.chunks.length&&(this.chunks=[]),this._initReuseChunk!==null&&(this.chunks.push(this._initReuseChunk),this.maxCursor=this._initReuseChunk.length-1)}pushByte(e){let t=this.chunks[this.chunks.length-1];this.cursor>this.maxCursor&&(t=Jr(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t));let n=t.length-(this.maxCursor-this.cursor)-1;t[n]=e,this.cursor++}push(e){let t=this.chunks[this.chunks.length-1];if(this.cursor+e.length<=this.maxCursor+1){let n=t.length-(this.maxCursor-this.cursor)-1;t.set(e,n)}else{if(t){let e=t.length-(this.maxCursor-this.cursor)-1;e<t.length&&(this.chunks[this.chunks.length-1]=t.subarray(0,e),this.maxCursor=this.cursor-1)}e.length<64&&e.length<this.chunkSize?(t=Jr(this.chunkSize),this.chunks.push(t),this.maxCursor+=t.length,this._initReuseChunk===null&&(this._initReuseChunk=t),t.set(e,0)):(this.chunks.push(e),this.maxCursor+=e.length)}this.cursor+=e.length}toBytes(e=!1){let t;if(this.chunks.length===1){let n=this.chunks[0];e&&this.cursor>n.length/2?(t=this.cursor===n.length?n:n.subarray(0,this.cursor),this._initReuseChunk=null,this.chunks=[]):t=Kr(n,0,this.cursor)}else t=qr(this.chunks,this.cursor);return e&&this.reset(),t}},$r=class{constructor(e){this.dest=e,this.cursor=0,this.chunks=[e]}reset(){this.cursor=0}pushByte(e){if(this.cursor>=this.dest.length)throw Error(`write out of bounds, destination buffer is too small`);this.dest[this.cursor++]=e}push(e){if(this.cursor+e.length>this.dest.length)throw Error(`write out of bounds, destination buffer is too small`);this.dest.set(e,this.cursor),this.cursor+=e.length}toBytes(e=!1){let t=this.dest.subarray(0,this.cursor);return e&&this.reset(),t}},z=`CBOR decode error:`,ei=`CBOR encode error:`;function ti(e,t,n){if(e.length-t<n)throw Error(`${z} not enough data for type`)}var ni=[24,256,65536,4294967296,BigInt(`18446744073709551616`)];function ri(e,t,n){ti(e,t,1);let r=e[t];if(n.strict===!0&&r<ni[0])throw Error(`${z} integer encoded in more bytes than necessary (strict decode)`);return r}function ii(e,t,n){ti(e,t,2);let r=e[t]<<8|e[t+1];if(n.strict===!0&&r<ni[1])throw Error(`${z} integer encoded in more bytes than necessary (strict decode)`);return r}function ai(e,t,n){ti(e,t,4);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(n.strict===!0&&r<ni[2])throw Error(`${z} integer encoded in more bytes than necessary (strict decode)`);return r}function oi(e,t,n){ti(e,t,8);let r=e[t]*16777216+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],i=e[t+4]*16777216+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],a=(BigInt(r)<<BigInt(32))+BigInt(i);if(n.strict===!0&&a<ni[3])throw Error(`${z} integer encoded in more bytes than necessary (strict decode)`);if(a<=2**53-1)return Number(a);if(n.allowBigInt===!0)return a;throw Error(`${z} integers outside of the safe integer range are not supported`)}function si(e,t,n,r){return new R(L.uint,ri(e,t+1,r),2)}function ci(e,t,n,r){return new R(L.uint,ii(e,t+1,r),3)}function li(e,t,n,r){return new R(L.uint,ai(e,t+1,r),5)}function ui(e,t,n,r){return new R(L.uint,oi(e,t+1,r),9)}function di(e,t){return fi(e,0,t.value)}function fi(e,t,n){if(n<ni[0]){let r=Number(n);e.pushByte(t|r)}else if(n<ni[1]){let r=Number(n);e.push([t|24,r])}else if(n<ni[2]){let r=Number(n);e.push([t|25,r>>>8,r&255])}else if(n<ni[3]){let r=Number(n);e.push([t|26,r>>>24&255,r>>>16&255,r>>>8&255,r&255])}else{let r=BigInt(n);if(r<ni[4]){let n=[t|27,0,0,0,0,0,0,0],i=Number(r&BigInt(4294967295)),a=Number(r>>BigInt(32)&BigInt(4294967295));n[8]=i&255,i>>=8,n[7]=i&255,i>>=8,n[6]=i&255,i>>=8,n[5]=i&255,n[4]=a&255,a>>=8,n[3]=a&255,a>>=8,n[2]=a&255,a>>=8,n[1]=a&255,e.push(n)}else throw Error(`${z} encountered BigInt larger than allowable range`)}}di.encodedSize=function(e){return fi.encodedSize(e.value)},fi.encodedSize=function(e){return e<ni[0]?1:e<ni[1]?2:e<ni[2]?3:e<ni[3]?5:9},di.compareTokens=function(e,t){return e.value<t.value?-1:+(e.value>t.value)};function pi(e,t,n,r){return new R(L.negint,-1-ri(e,t+1,r),2)}function mi(e,t,n,r){return new R(L.negint,-1-ii(e,t+1,r),3)}function hi(e,t,n,r){return new R(L.negint,-1-ai(e,t+1,r),5)}var gi=BigInt(-1),_i=BigInt(1);function vi(e,t,n,r){let i=oi(e,t+1,r);if(typeof i!=`bigint`){let e=-1-i;if(e>=-(2**53-1))return new R(L.negint,e,9)}if(r.allowBigInt!==!0)throw Error(`${z} integers outside of the safe integer range are not supported`);return new R(L.negint,gi-BigInt(i),9)}function yi(e,t){let n=t.value,r=typeof n==`bigint`?n*gi-_i:n*-1-1;fi(e,t.type.majorEncoded,r)}yi.encodedSize=function(e){let t=e.value,n=typeof t==`bigint`?t*gi-_i:t*-1-1;return n<ni[0]?1:n<ni[1]?2:n<ni[2]?3:n<ni[3]?5:9},yi.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0};function bi(e,t,n,r){ti(e,t,n+r);let i=e.slice(t+n,t+n+r);return new R(L.bytes,i,n+r)}function xi(e,t,n,r){return bi(e,t,1,n)}function Si(e,t,n,r){return bi(e,t,2,ri(e,t+1,r))}function Ci(e,t,n,r){return bi(e,t,3,ii(e,t+1,r))}function wi(e,t,n,r){return bi(e,t,5,ai(e,t+1,r))}function Ti(e,t,n,r){let i=oi(e,t+1,r);if(typeof i==`bigint`)throw Error(`${z} 64-bit integer bytes lengths not supported`);return bi(e,t,9,i)}function Ei(e){return e.encodedBytes===void 0&&(e.encodedBytes=L.equals(e.type,L.string)?Wr(e.value):e.value),e.encodedBytes}function Di(e,t){let n=Ei(t);fi(e,t.type.majorEncoded,n.length),e.push(n)}Di.encodedSize=function(e){let t=Ei(e);return fi.encodedSize(t.length)+t.length},Di.compareTokens=function(e,t){return Oi(Ei(e),Ei(t))};function Oi(e,t){return e.length<t.length?-1:e.length>t.length?1:Yr(e,t)}var ki=new TextDecoder,Ai=32;function ji(e,t,n){if(n-t<Ai){let r=``;for(let i=t;i<n;i++){let a=e[i];if(a&128)return ki.decode(e.subarray(t,n));r+=String.fromCharCode(a)}return r}return ki.decode(e.subarray(t,n))}function Mi(e,t,n,r,i){let a=n+r;ti(e,t,a);let o=new R(L.string,ji(e,t+n,t+a),a);return i.retainStringBytes===!0&&(o.byteValue=e.slice(t+n,t+a)),o}function Ni(e,t,n,r){return Mi(e,t,1,n,r)}function Pi(e,t,n,r){return Mi(e,t,2,ri(e,t+1,r),r)}function Fi(e,t,n,r){return Mi(e,t,3,ii(e,t+1,r),r)}function Ii(e,t,n,r){return Mi(e,t,5,ai(e,t+1,r),r)}function Li(e,t,n,r){let i=oi(e,t+1,r);if(typeof i==`bigint`)throw Error(`${z} 64-bit integer string lengths not supported`);return Mi(e,t,9,i,r)}var Ri=Di;function zi(e,t,n,r){return new R(L.array,r,n)}function Bi(e,t,n,r){return zi(e,t,1,n)}function Vi(e,t,n,r){return zi(e,t,2,ri(e,t+1,r))}function Hi(e,t,n,r){return zi(e,t,3,ii(e,t+1,r))}function Ui(e,t,n,r){return zi(e,t,5,ai(e,t+1,r))}function Wi(e,t,n,r){let i=oi(e,t+1,r);if(typeof i==`bigint`)throw Error(`${z} 64-bit integer array lengths not supported`);return zi(e,t,9,i)}function Gi(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${z} indefinite length items not allowed`);return zi(e,t,1,1/0)}function Ki(e,t){fi(e,L.array.majorEncoded,t.value)}Ki.compareTokens=di.compareTokens,Ki.encodedSize=function(e){return fi.encodedSize(e.value)};function qi(e,t,n,r){return new R(L.map,r,n)}function Ji(e,t,n,r){return qi(e,t,1,n)}function Yi(e,t,n,r){return qi(e,t,2,ri(e,t+1,r))}function Xi(e,t,n,r){return qi(e,t,3,ii(e,t+1,r))}function Zi(e,t,n,r){return qi(e,t,5,ai(e,t+1,r))}function Qi(e,t,n,r){let i=oi(e,t+1,r);if(typeof i==`bigint`)throw Error(`${z} 64-bit integer map lengths not supported`);return qi(e,t,9,i)}function $i(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${z} indefinite length items not allowed`);return qi(e,t,1,1/0)}function ea(e,t){fi(e,L.map.majorEncoded,t.value)}ea.compareTokens=di.compareTokens,ea.encodedSize=function(e){return fi.encodedSize(e.value)};function ta(e,t,n,r){return new R(L.tag,n,1)}function na(e,t,n,r){return new R(L.tag,ri(e,t+1,r),2)}function ra(e,t,n,r){return new R(L.tag,ii(e,t+1,r),3)}function ia(e,t,n,r){return new R(L.tag,ai(e,t+1,r),5)}function aa(e,t,n,r){return new R(L.tag,oi(e,t+1,r),9)}function oa(e,t){fi(e,L.tag.majorEncoded,t.value)}oa.compareTokens=di.compareTokens,oa.encodedSize=function(e){return fi.encodedSize(e.value)};function sa(e,t,n,r){if(r.allowUndefined===!1)throw Error(`${z} undefined values are not supported`);return r.coerceUndefinedToNull===!0?new R(L.null,null,1):new R(L.undefined,void 0,1)}function ca(e,t,n,r){if(r.allowIndefinite===!1)throw Error(`${z} indefinite length items not allowed`);return new R(L.break,void 0,1)}function la(e,t,n){if(n){if(n.allowNaN===!1&&Number.isNaN(e))throw Error(`${z} NaN values are not supported`);if(n.allowInfinity===!1&&(e===1/0||e===-1/0))throw Error(`${z} Infinity values are not supported`)}return new R(L.float,e,t)}function ua(e,t,n,r){return la(va(e,t+1),3,r)}function da(e,t,n,r){return la(ba(e,t+1),5,r)}function fa(e,t,n,r){return la(Sa(e,t+1),9,r)}function pa(e,t,n){let r=t.value;if(r===!1)e.pushByte(L.float.majorEncoded|20);else if(r===!0)e.pushByte(L.float.majorEncoded|21);else if(r===null)e.pushByte(L.float.majorEncoded|22);else if(r===void 0)e.pushByte(L.float.majorEncoded|23);else{let t,i=!1;(!n||n.float64!==!0)&&(_a(r),t=va(ga,1),r===t||Number.isNaN(r)?(ga[0]=249,e.push(ga.slice(0,3)),i=!0):(ya(r),t=ba(ga,1),r===t&&(ga[0]=250,e.push(ga.slice(0,5)),i=!0))),i||(xa(r),t=Sa(ga,1),ga[0]=251,e.push(ga.slice(0,9)))}}pa.encodedSize=function(e,t){let n=e.value;if(n===!1||n===!0||n==null)return 1;if(!t||t.float64!==!0){_a(n);let e=va(ga,1);if(n===e||Number.isNaN(n))return 3;if(ya(n),e=ba(ga,1),n===e)return 5}return 9};var ma=new ArrayBuffer(9),ha=new DataView(ma,1),ga=new Uint8Array(ma,0);function _a(e){if(e===1/0)ha.setUint16(0,31744,!1);else if(e===-1/0)ha.setUint16(0,64512,!1);else if(Number.isNaN(e))ha.setUint16(0,32256,!1);else{ha.setFloat32(0,e);let t=ha.getUint32(0),n=(t&2139095040)>>23,r=t&8388607;if(n===255)ha.setUint16(0,31744,!1);else if(n===0)ha.setUint16(0,(t&2147483648)>>16|r>>13,!1);else{let e=n-127;e<-24?ha.setUint16(0,0):e<-14?ha.setUint16(0,(t&2147483648)>>16|1<<24+e,!1):ha.setUint16(0,(t&2147483648)>>16|e+15<<10|r>>13,!1)}}}function va(e,t){if(e.length-t<2)throw Error(`${z} not enough data for float16`);let n=(e[t]<<8)+e[t+1];if(n===31744)return 1/0;if(n===64512)return-1/0;if(n===32256)return NaN;let r=n>>10&31,i=n&1023,a;return a=r===0?i*2**-24:r===31?i===0?1/0:NaN:(i+1024)*2**(r-25),n&32768?-a:a}function ya(e){ha.setFloat32(0,e,!1)}function ba(e,t){if(e.length-t<4)throw Error(`${z} not enough data for float32`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function xa(e){ha.setFloat64(0,e,!1)}function Sa(e,t){if(e.length-t<8)throw Error(`${z} not enough data for float64`);let n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}function Ca(e,t){let n=e.value;if(n===!1)return Uint8Array.of(L.float.majorEncoded|20);if(n===!0)return Uint8Array.of(L.float.majorEncoded|21);if(n===null)return Uint8Array.of(L.float.majorEncoded|22);if(n===void 0)return Uint8Array.of(L.float.majorEncoded|23);if(!t){if(_a(n),n===va(ga,1)||Number.isNaN(n))return ga[0]=249,ga.slice(0,3);if(ya(n),n===ba(ga,1))return ga[0]=250,ga.slice(0,5)}return xa(n),ga[0]=251,ga.slice(0,9)}function wa(e,t){let n=e,r=t?.float64===!0,i=r?n._keyBytesFloat64:n._keyBytes;if(i!==void 0)return i;let a=Ca(e,r);return r?n._keyBytesFloat64=a:n._keyBytes=a,a}pa.compareTokens=function(e,t,n){let r=wa(e,n),i=wa(t,n);return r.length===i.length?Yr(r,i):r.length<i.length?-1:1};function B(e,t,n){throw Error(`${z} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function Ta(e){return()=>{throw Error(`${z} ${e}`)}}var V=[];for(let e=0;e<=23;e++)V[e]=B;V[24]=si,V[25]=ci,V[26]=li,V[27]=ui,V[28]=B,V[29]=B,V[30]=B,V[31]=B;for(let e=32;e<=55;e++)V[e]=B;V[56]=pi,V[57]=mi,V[58]=hi,V[59]=vi,V[60]=B,V[61]=B,V[62]=B,V[63]=B;for(let e=64;e<=87;e++)V[e]=xi;V[88]=Si,V[89]=Ci,V[90]=wi,V[91]=Ti,V[92]=B,V[93]=B,V[94]=B,V[95]=Ta(`indefinite length bytes/strings are not supported`);for(let e=96;e<=119;e++)V[e]=Ni;V[120]=Pi,V[121]=Fi,V[122]=Ii,V[123]=Li,V[124]=B,V[125]=B,V[126]=B,V[127]=Ta(`indefinite length bytes/strings are not supported`);for(let e=128;e<=151;e++)V[e]=Bi;V[152]=Vi,V[153]=Hi,V[154]=Ui,V[155]=Wi,V[156]=B,V[157]=B,V[158]=B,V[159]=Gi;for(let e=160;e<=183;e++)V[e]=Ji;V[184]=Yi,V[185]=Xi,V[186]=Zi,V[187]=Qi,V[188]=B,V[189]=B,V[190]=B,V[191]=$i;for(let e=192;e<=215;e++)V[e]=ta;V[216]=na,V[217]=ra,V[218]=ia,V[219]=aa,V[220]=B,V[221]=B,V[222]=B,V[223]=B;for(let e=224;e<=243;e++)V[e]=Ta(`simple values are not supported`);V[244]=B,V[245]=B,V[246]=B,V[247]=sa,V[248]=Ta(`simple values are not supported`),V[249]=ua,V[250]=da,V[251]=fa,V[252]=B,V[253]=B,V[254]=B,V[255]=ca;var Ea=[];for(let e=0;e<24;e++)Ea[e]=new R(L.uint,e,1);for(let e=-1;e>=-24;e--)Ea[31-e]=new R(L.negint,e,1);Ea[64]=new R(L.bytes,new Uint8Array,1),Ea[96]=new R(L.string,``,1),Ea[128]=new R(L.array,0,1),Ea[160]=new R(L.map,0,1),Ea[244]=new R(L.false,!1,1),Ea[245]=new R(L.true,!0,1),Ea[246]=new R(L.null,null,1);function Da(e){switch(e.type){case L.false:return Gr([244]);case L.true:return Gr([245]);case L.null:return Gr([246]);case L.bytes:return e.value.length?void 0:Gr([64]);case L.string:return e.value===``?Gr([96]):void 0;case L.array:return e.value===0?Gr([128]):void 0;case L.map:return e.value===0?Gr([160]):void 0;case L.uint:return e.value<24?Gr([Number(e.value)]):void 0;case L.negint:if(e.value>=-24)return Gr([31-Number(e.value)])}}var Oa={float64:!1,mapSorter:Ra,quickEncodeToken:Da},ka=Object.freeze({mapSorter:za,quickEncodeToken:Da});function Aa(){let e=[];return e[L.uint.major]=di,e[L.negint.major]=yi,e[L.bytes.major]=Di,e[L.string.major]=Ri,e[L.array.major]=Ki,e[L.map.major]=ea,e[L.tag.major]=oa,e[L.float.major]=pa,e}var ja=Aa(),Ma=new Qr,Na=class e{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do if(t.obj===e)return!0;while(t=t.parent);return!1}static createCheck(t,n){if(t&&t.includes(n))throw Error(`${ei} object contains circular references`);return new e(n,t)}},Pa={null:new R(L.null,null),undefined:new R(L.undefined,void 0),true:new R(L.true,!0),false:new R(L.false,!1),emptyArray:new R(L.array,0),emptyMap:new R(L.map,0)},Fa={number(e,t,n,r){return!Number.isInteger(e)||!Number.isSafeInteger(e)?new R(L.float,e):e>=0?new R(L.uint,e):new R(L.negint,e)},bigint(e,t,n,r){return e>=BigInt(0)?new R(L.uint,e):new R(L.negint,e)},Uint8Array(e,t,n,r){return new R(L.bytes,e)},string(e,t,n,r){return new R(L.string,e)},boolean(e,t,n,r){return e?Pa.true:Pa.false},null(e,t,n,r){return Pa.null},undefined(e,t,n,r){return Pa.undefined},ArrayBuffer(e,t,n,r){return new R(L.bytes,new Uint8Array(e))},DataView(e,t,n,r){return new R(L.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength))},Array(e,t,n,r){if(!e.length)return n.addBreakTokens===!0?[Pa.emptyArray,new R(L.break)]:Pa.emptyArray;r=Na.createCheck(r,e);let i=[],a=0;for(let t of e)i[a++]=Ia(t,n,r);return n.addBreakTokens?[new R(L.array,e.length),i,new R(L.break)]:[new R(L.array,e.length),i]},Object(e,t,n,r){let i=t!==`Object`,a=i?e.keys():Object.keys(e),o=i?e.size:a.length,s;if(o){s=Array(o),r=Na.createCheck(r,e);let t=!i&&n.ignoreUndefinedProperties,c=0;for(let o of a){let a=i?e.get(o):e[o];t&&a===void 0||(s[c++]=[Ia(o,n,r),Ia(a,n,r)])}c<o&&(s.length=c)}return s?.length?(La(s,n),n.addBreakTokens?[new R(L.map,s.length),s,new R(L.break)]:[new R(L.map,s.length),s]):n.addBreakTokens===!0?[Pa.emptyMap,new R(L.break)]:Pa.emptyMap},Tagged(e,t,n,r){return[new R(L.tag,e.tag),Ia(e.value,n,r)]}};Fa.Map=Fa.Object,Fa.Buffer=Fa.Uint8Array;for(let e of`Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64`.split(` `))Fa[`${e}Array`]=Fa.DataView;function Ia(e,t={},n){let r=Ir(e),i=t&&t.typeEncoders&&t.typeEncoders[r]||Fa[r];if(typeof i==`function`){let a=i(e,r,t,n);if(a!=null)return a}let a=Fa[r];if(!a)throw Error(`${ei} unsupported type: ${r}`);return a(e,r,t,n)}function La(e,t){let n=t.mapSorter;n&&e.sort((e,r)=>n(e,r,t))}function Ra(e,t,n){let r=Array.isArray(e[0])?e[0][0]:e[0],i=Array.isArray(t[0])?t[0][0]:t[0];if(r.type.major!==i.type.major)return r.type.compare(i.type);let a=ja[r.type.major].compareTokens(r,i,n);return a===0&&console.warn(`WARNING: complex key types used, CBOR key sorting guarantees are gone`),a}function za(e,t){if(e[0]instanceof R&&t[0]instanceof R){let n=e[0],r=t[0];return n._keyBytes||=Ba(n.value),r._keyBytes||=Ba(r.value),Yr(n._keyBytes,r._keyBytes)}throw Error(`rfc8949MapSorter: complex key types are not supported yet`)}function Ba(e){return io(e,ja,ka)}function Va(e,t,n,r){if(Array.isArray(t))for(let i of t)Va(e,i,n,r);else n[t.type.major](e,t,r)}var Ha=L.uint.majorEncoded,Ua=L.negint.majorEncoded,Wa=L.bytes.majorEncoded,Ga=L.string.majorEncoded,Ka=L.array.majorEncoded,qa=L.map.majorEncoded,Ja=L.float.majorEncoded|20,Ya=L.float.majorEncoded|21,Xa=L.float.majorEncoded|22,Za=L.float.majorEncoded|23,Qa=BigInt(-1),$a=BigInt(1);function eo(e,t,n){n<24?e.pushByte(t|Number(n)):fi(e,t,n)}function to(e){return e.addBreakTokens!==!0}function no(e,t,n,r,i){let a=n===`Map`,o=a?t.keys():Object.keys(t),s=a?t.size:o.length;if(!s){e.pushByte(qa);return}i=Na.createCheck(i,t);let c=!a&&r.ignoreUndefinedProperties,l=Array(s),u=0;for(let e of o){let n=a?t.get(e):t[e];c&&n===void 0||(l[u++]=[Ia(e,r,i),n])}if(u===0){e.pushByte(qa);return}u<s&&(l.length=u),l.sort((e,t)=>Ra(e,t,r)),eo(e,qa,u);for(let[t,n]of l)Va(e,t,ja,r),ro(e,n,r,i)}function ro(e,t,n,r){let i=Ir(t),a=n.typeEncoders&&n.typeEncoders[i];if(a){let o=a(t,i,n,r);if(o!=null){Va(e,o,ja,n);return}}switch(i){case`null`:e.pushByte(Xa);return;case`undefined`:e.pushByte(Za);return;case`boolean`:e.pushByte(t?Ya:Ja);return;case`number`:!Number.isInteger(t)||!Number.isSafeInteger(t)?pa(e,new R(L.float,t),n):t>=0?eo(e,Ha,t):eo(e,Ua,t*-1-1);return;case`bigint`:t>=BigInt(0)?eo(e,Ha,t):eo(e,Ua,t*Qa-$a);return;case`string`:{let n=Wr(t);eo(e,Ga,n.length),e.push(n);return}case`Uint8Array`:eo(e,Wa,t.length),e.push(t);return;case`Array`:if(!t.length){e.pushByte(Ka);return}r=Na.createCheck(r,t),eo(e,Ka,t.length);for(let i of t)ro(e,i,n,r);return;case`Object`:case`Map`:n.mapSorter===Ra?no(e,t,i,n,r):Va(e,Fa.Object(t,i,n,r),ja,n);return;default:{let a=Fa[i];if(!a)throw Error(`${ei} unsupported type: ${i}`);Va(e,a(t,i,n,r),ja,n)}}}function io(e,t,n,r){let i=r instanceof Uint8Array,a=i?new $r(r):Ma,o=Ia(e,n);if(!Array.isArray(o)&&n.quickEncodeToken){let e=n.quickEncodeToken(o);if(e)return i?(a.push(e),a.toBytes()):e;let r=t[o.type.major];if(r.encodedSize){let e=r.encodedSize(o,n);if(i||(a=new Qr(e)),r(a,o,n),a.chunks.length!==1)throw Error(`Unexpected error: pre-calculated length for ${o} was wrong`);return i?a.toBytes():Vr(a.chunks[0])}}return a.reset(),Va(a,o,t,n),a.toBytes(!0)}function ao(e,t){return t=Object.assign({},Oa,t),to(t)?(Ma.reset(),ro(Ma,e,t,void 0),Ma.toBytes(!0)):io(e,ja,t)}var oo={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0},so=class{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){let e=this.data[this._pos],t=Ea[e];if(t===void 0){let n=V[e];if(!n)throw Error(`${z} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,`0`)})`);let r=e&31;t=n(this.data,this._pos,r,this.options)}return this._pos+=t.encodedLength,t}},co=Symbol.for(`DONE`),lo=Symbol.for(`BREAK`);function uo(e,t,n){let r=[];for(let i=0;i<e.value;i++){let a=ho(t,n);if(a===lo){if(e.value===1/0)break;throw Error(`${z} got unexpected break to lengthed array`)}if(a===co)throw Error(`${z} found array but not enough entries (got ${i}, expected ${e.value})`);r[i]=a}return r}function fo(e,t,n){let r=n.useMaps===!0,i=n.rejectDuplicateMapKeys===!0,a=r?void 0:{},o=r?new Map:void 0;for(let s=0;s<e.value;s++){let c=ho(t,n);if(c===lo){if(e.value===1/0)break;throw Error(`${z} got unexpected break to lengthed map`)}if(c===co)throw Error(`${z} found map but not enough entries (got ${s} [no key], expected ${e.value})`);if(!r&&typeof c!=`string`)throw Error(`${z} non-string keys not supported (got ${typeof c})`);if(i&&(r&&o.has(c)||!r&&Object.hasOwn(a,c)))throw Error(`${z} found repeat map key "${c}"`);let l=ho(t,n);if(l===co)throw Error(`${z} found map but not enough entries (got ${s} [no value], expected ${e.value})`);r?o.set(c,l):c===`__proto__`?Object.defineProperty(a,c,{value:l,configurable:!0,enumerable:!0,writable:!0}):a[c]=l}return r?o:a}function*po(e,t,n){for(let r=0;r<e.value;r++){let i=ho(t,n);if(i===lo){if(e.value===1/0)break;throw Error(`${z} got unexpected break to lengthed map`)}if(i===co)throw Error(`${z} found map but not enough entries (got ${r} [no key], expected ${e.value})`);let a=ho(t,n);if(a===co)throw Error(`${z} found map but not enough entries (got ${r} [no value], expected ${e.value})`);yield[i,a]}}function mo(e,t){let n=function(){if(n._called)throw Error(`${z} tag decode() may only be called once`);n._called=!0;let r=ho(e,t);if(r===co)throw Error(`${z} tag content missing`);if(r===lo)throw Error(`${z} got unexpected break in tag content`);return r};return n.entries=function(){if(n._called)throw Error(`${z} tag decode() may only be called once`);n._called=!0;let r=e.next();if(!L.equals(r.type,L.map))throw Error(`${z} entries() requires map content, got ${r.type.name}`);let i=[];for(let n of po(r,e,t))i.push(n);return i},n._called=!1,n}function ho(e,t){if(e.done())return co;let n=e.next();if(L.equals(n.type,L.break))return lo;if(n.type.terminal)return n.value;if(L.equals(n.type,L.array))return uo(n,e,t);if(L.equals(n.type,L.map))return fo(n,e,t);if(L.equals(n.type,L.tag)){if(t.tags&&typeof t.tags[n.value]==`function`){let r=mo(e,t),i=t.tags[n.value](r);if(!r._called)throw Error(`${z} tag decoder must call decode() or entries()`);return i}throw Error(`${z} tag not supported (${n.value})`)}throw Error(`unsupported`)}function go(e,t){if(!(e instanceof Uint8Array))throw Error(`${z} data to decode must be a Uint8Array`);t=Object.assign({},oo,t);let n=Vr(e),r=t.tokenizer||new so(n,t),i=ho(r,t);if(i===co)throw Error(`${z} did not find any content to decode`);if(i===lo)throw Error(`${z} got unexpected break`);return[i,e.subarray(r.pos())]}function _o(e,t){let[n,r]=go(e,t);if(r.length>0)throw Error(`${z} too many terminals, data makes no sense`);return n}Object.defineProperty(class e{constructor(e,t){if(typeof e!=`number`||!Number.isInteger(e)||e<0)throw TypeError(`Tagged: tag must be a non-negative integer`);this.tag=e,this.value=t}static decoder(t){return n=>new e(t,n())}static preserve(...t){let n={};for(let r of t)n[r]=e.decoder(r);return n}}.prototype,Symbol.toStringTag,{value:`Tagged`});function vo(e,t,n=()=>{}){if(!Array.isArray(e))throw TypeError(`"${t}" expected array, got type=${typeof e}`);for(let r=0;r<e.length;r++)n(e[r],`${t}[${r}]`);return e}var H=(e,t,n)=>$n(e,t,n),yo=Qn;function bo(e,t=``){if(typeof e!=`string`){let n=t&&`"${t}" `;throw TypeError(n+`expected string, got type=`+typeof e)}return e}function xo(e,t=`object`){if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(t===`object`?`expected valid options object`:`"${t}" expected object, got type=${typeof e}`);return e}function So(e,t){if(typeof e!=`function`)throw TypeError(`"${t}" is invalid: expected function, got ${typeof e}`);return e}var Co=lr,wo=(...e)=>pr(...e),To=e=>dr(e),Eo=Xn,Do=e=>gr(e),Oo=BigInt(0),ko=BigInt(1),Ao=e=>e?`"${e}" `:``;function jo(e,t=``){if(typeof e!=`boolean`)throw TypeError(Ao(t)+`expected boolean, got type=`+typeof e);return e}function Mo(e){if(typeof e==`bigint`){if(!Vo(e))throw RangeError(`positive bigint expected, got `+e)}else yo(e);return e}function No(e,t=``){if(typeof e!=`number`){let n=t&&`"${t}" `;throw TypeError(n+`expected number, got type=`+typeof e)}if(!Number.isSafeInteger(e)){let n=t&&`"${t}" `;throw RangeError(n+`expected safe integer, got `+e)}}function Po(e){let t=Mo(e).toString(16);return t.length&1?`0`+t:t}function Fo(e){if(typeof e!=`string`)throw TypeError(`hex string expected, got `+typeof e);return e===``?Oo:BigInt(`0x`+e)}function Io(e){return Fo(lr(e))}function Lo(e){return Fo(lr(Bo($n(e)).reverse()))}function Ro(e,t){if(Qn(t),t===0)throw Error(`zero output length is invalid`);e=Mo(e);let n=t*2,r=e.toString(16);if(r.length>n)throw RangeError(`number is too large`);return dr(r.padStart(n,`0`))}function zo(e,t){return Ro(e,t).reverse()}function Bo(e){return Uint8Array.from(H(e))}function Vo(e){return typeof e==`bigint`&&Oo<=e}function Ho(e,t,n){return Vo(e)&&Vo(t)&&Vo(n)&&t<=e&&e<n}function Uo(e,t,n,r){if(!Ho(t,n,r))throw RangeError(`expected valid `+e+`: `+n+` <= n < `+r+`, got `+t)}function Wo(e){if(e<Oo)throw Error(`expected non-negative bigint, got `+e);return e===Oo?0:e.toString(2).length}var Go=e=>(No(e,`n`),(ko<<BigInt(e))-ko);function Ko(e,t,n){if(Qn(e,`hashLen`),Qn(t,`qByteLen`),typeof n!=`function`)throw TypeError(`hmacFn must be a function`);let r=e=>new Uint8Array(e),i=Uint8Array.of(),a=Uint8Array.of(0),o=Uint8Array.of(1),s=r(e),c=r(e),l=0,u=()=>{s.fill(1),c.fill(0),l=0},d=(...e)=>n(c,wo(s,...e)),f=(e=i)=>{c=d(a,e),s=d(),e.length!==0&&(c=d(o,e),s=d())},p=()=>{if(l++>=1e3)throw Error(`drbg: tried max amount of iterations`);let e=0,n=[];for(;e<t;){s=d();let t=s.slice();n.push(t),e+=s.length}return wo(...n)};return(e,t)=>{u(),f(e);let n;for(;(n=t(p()))===void 0;)f();return u(),n}}function qo(e,t={},n={},r=`object`){xo(e,r),xo(t,`fields`),xo(n,`optFields`);function i(t,n,i){let a=r===`object`?`param "${String(t)}"`:`"${r}.${String(t)}"`,o=e[t];if(!Object.hasOwn(e,t)&&(i?o!==void 0:n!==`function`))throw TypeError(`${a} is invalid: expected own property`);if(i&&o===void 0)return;let s=typeof o;if(s!==n||o===null)throw TypeError(`${a} is invalid: expected ${n}, got ${s}`)}let a=(e,t)=>Object.entries(e).forEach(([e,n])=>i(e,n,t));a(t,!1),a(n,!0)}var Jo=BigInt(0),U=BigInt(1),Yo=BigInt(2),Xo=BigInt(3),Zo=BigInt(4),Qo=BigInt(5),$o=BigInt(7),es=BigInt(8),ts=BigInt(9),ns=BigInt(15),rs=BigInt(16),is=BigInt(`0x10000000000000000`);function W(e,t){if(t<=Jo)throw Error(`mod: expected positive modulus, got `+t);let n=e%t;return n>=Jo?n:t+n}function as(e,t,n){if(n<=U)throw Error(`pow: expected modulus > 1, got `+n);if(typeof t!=`bigint`)throw TypeError(`invalid exponent: expected bigint, got `+typeof t);if(t<Jo)throw Error(`invalid exponent, negatives unsupported`);if(t===Jo)return U;if(t===U)return e;let r=e%n;if(r<Jo&&(r+=n),t<is){let e=U;for(;t>Jo;)t&U&&(e=e*r%n),r=r*r%n,t>>=U;return e}let i=[];for(;t>Jo;)i.push(Number(t&ns)),t>>=Zo;let a=Array(16);a[0]=U,a[1]=r;for(let e=2;e<16;e++)a[e]=a[e-1]*r%n;let o=a[i[i.length-1]];for(let e=i.length-2;e>=0;e--){o=o*o%n,o=o*o%n,o=o*o%n,o=o*o%n;let t=i[e];t!==0&&(o=o*a[t]%n)}return o}function os(e,t,n){if(n<=U)throw Error(`pow2: expected modulus > 1, got `+n);if(t<Jo)throw Error(`pow2: expected non-negative exponent, got `+t);let r=e;for(;t-->Jo;)r*=r,r%=n;return r}function ss(e,t){if(e===Jo)throw Error(`invert: expected non-zero number`);if(t<=U)throw Error(`invert: expected modulus > 1, got `+t);let n=W(e,t),r=t,i=Jo,a=U;for(;n!==Jo;){let e=r/n,t=r-n*e,o=i-a*e;r=n,n=t,i=a,a=o}if(r!==U)throw Error(`invert: does not exist`);return W(i,t)}function cs(e,t){if(t<=U)throw Error(`invertCt: expected prime modulus > 1, got `+t);let n=W(e,t);if(n===Jo)throw Error(`invertCt: expected non-zero number`);let r=as(n,t-Yo,t);if(W(n*r,t)!==U)throw Error(`invertCt: does not exist`);return r}function ls(e,t,n){let r=e;if(!r.eql(r.sqr(t),n))throw Error(`Cannot find square root`)}function us(e,t){if((e&U)===Jo)throw Error(t+`: expected odd modulus, got `+e)}function ds(e,t){let n=e,r=(n.ORDER+U)/Zo,i=n.pow(t,r);return ls(n,i,t),i}function fs(e,t){let n=e,r=(n.ORDER-Qo)/es,i=n.mul(t,Yo),a=n.pow(i,r),o=n.mul(t,a),s=n.mul(n.mul(o,Yo),a),c=n.mul(o,n.sub(s,n.ONE));return ls(n,c,t),c}function ps(e){let t=ws(e),n=ms(e),r=n(t,t.neg(t.ONE)),i=n(t,r),a=n(t,t.neg(r)),o=(e+$o)/rs;return((e,t)=>{let n=e,s=n.pow(t,o),c=n.mul(s,r),l=n.mul(s,i),u=n.mul(s,a),d=n.eql(n.sqr(c),t),f=n.eql(n.sqr(l),t);s=n.cmov(s,c,d),c=n.cmov(u,l,f);let p=n.eql(n.sqr(c),t),m=n.cmov(s,c,p);return ls(n,m,t),m})}function ms(e){if(e<Xo)throw Error(`sqrt is not defined for small field`);us(e,`tonelliShanks`);let t=e-U,n=0;for(;t%Yo===Jo;)t/=Yo,n++;let r=Yo,i=ws(e);for(;bs(i,r)===1;)if(r++>1e3)throw Error(`Cannot find square root: probably non-prime P`);if(n===1)return ds;let a=i.pow(r,t),o=(t+U)/Yo;return function(e,r){let i=e;if(i.is0(r))return r;if(bs(i,r)!==1)throw Error(`Cannot find square root`);let s=n,c=i.mul(i.ONE,a),l=i.pow(r,t),u=i.pow(r,o);for(;!i.eql(l,i.ONE);){if(i.is0(l))throw Error(`Cannot find square root: probably non-prime P`);let e=1,t=i.sqr(l);for(;!i.eql(t,i.ONE);)if(e++,t=i.sqr(t),e===s)throw Error(`Cannot find square root`);let n=U<<BigInt(s-e-1),r=i.pow(c,n);s=e,c=i.sqr(r),l=i.mul(l,c),u=i.mul(u,r)}return u}}function hs(e){return us(e,`Fp.sqrt`),e%Zo===Xo?ds:e%es===Qo?fs:e%rs===ts?ps(e):ms(e)}var gs=(e,t)=>(W(e,t)&U)===U,_s=[`create`,`isValid`,`is0`,`neg`,`inv`,`sqrt`,`sqr`,`eql`,`add`,`sub`,`mul`,`pow`,`div`,`addN`,`subN`,`mulN`,`sqrN`];function vs(e){if(xo(e,`field`),typeof e.ORDER!=`bigint`)throw TypeError(`param "ORDER" is invalid: expected bigint, got `+typeof e.ORDER);No(e.BYTES,`BYTES`),No(e.BITS,`BITS`);for(let t of _s)So(e[t],`field.`+t);if(e.BYTES<1||e.BITS<1)throw Error(`invalid field: expected BYTES/BITS > 0`);if(e.ORDER<=U)throw Error(`invalid field: expected ORDER > 1, got `+e.ORDER);return e}function ys(e,t,n=!1){vs(e),vo(t,`nums`),jo(n,`passZero`);let r=e,i=Array(t.length).fill(n?r.ZERO:void 0),a=t.reduce((e,t,n)=>r.is0(t)?e:(i[n]=e,r.mul(e,t)),r.ONE),o=r.inv(a);return t.reduceRight((e,t,n)=>r.is0(t)?e:(i[n]=r.mul(e,i[n]),r.mul(e,t)),o),i}function bs(e,t){vs(e);let n=e;us(n.ORDER,`FpLegendre`);let r=(n.ORDER-U)/Yo,i=n.pow(t,r),a=n.eql(i,n.ONE),o=n.eql(i,n.ZERO),s=n.eql(i,n.neg(n.ONE));if(!a&&!o&&!s)throw Error(`invalid Legendre symbol result`);return a?1:o?0:-1}function xs(e,t){if(t!==void 0&&yo(t),e<=Jo)throw Error(`invalid n length: expected positive n, got `+e);if(t!==void 0&&t<1)throw Error(`invalid n length: expected positive bit length, got `+t);let n=Wo(e);if(t!==void 0&&t<n)throw Error(`invalid n length: expected nBitLength (${t}) >= bitLen(n) (${n})`);let r=t===void 0?n:t;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}var Ss=new WeakMap,Cs=class{ORDER;BITS;BYTES;isLE;ZERO=Jo;ONE=U;_lengths;_mod;constructor(e,t={}){if(e<=U)throw Error(`invalid field: expected ORDER > 1, got `+e);let n;this.isLE=!1,typeof t==`object`&&t&&(typeof t.BITS==`number`&&(n=t.BITS),typeof t.sqrt==`function`&&Object.defineProperty(this,"sqrt",{value:t.sqrt,enumerable:!0}),typeof t.isLE==`boolean`&&(this.isLE=t.isLE),t.allowedLengths&&(this._lengths=Object.freeze(t.allowedLengths.slice())),typeof t.modFromBytes==`boolean`&&(this._mod=t.modFromBytes));let{nBitLength:r,nByteLength:i}=xs(e,n);if(i>2048)throw Error(`invalid field: expected ORDER of <= 2048 bytes`);this.ORDER=e,this.BITS=r,this.BYTES=i,Object.freeze(this)}create(e){return W(e,this.ORDER)}isValid(e){if(typeof e!=`bigint`)throw TypeError(`invalid field element: expected bigint, got `+typeof e);return Jo<=e&&e<this.ORDER}is0(e){return e===Jo}isValidNot0(e){return!this.is0(e)&&this.isValid(e)}isOdd(e){return(e&U)===U}neg(e){return W(-e,this.ORDER)}eql(e,t){return e===t}sqr(e){return W(e*e,this.ORDER)}add(e,t){return W(e+t,this.ORDER)}sub(e,t){return W(e-t,this.ORDER)}mul(e,t){return W(e*t,this.ORDER)}pow(e,t){return as(e,t,this.ORDER)}div(e,t){return W(e*ss(t,this.ORDER),this.ORDER)}sqrN(e){return e*e}addN(e,t){return e+t}subN(e,t){return e-t}mulN(e,t){return e*t}inv(e){return ss(e,this.ORDER)}sqrt(e){let t=Ss.get(this);return t||Ss.set(this,t=hs(this.ORDER)),t(this,e)}toBytes(e){return this.isLE?zo(e,this.BYTES):Ro(e,this.BYTES)}fromBytes(e,t=!1){H(e);let{_lengths:n,BYTES:r,isLE:i,ORDER:a,_mod:o}=this;if(n){if(e.length<1||!n.includes(e.length)||e.length>r)throw Error(`Field.fromBytes: expected `+n+` bytes, got `+e.length);let t=new Uint8Array(r);t.set(e,i?0:t.length-e.length),e=t}if(e.length!==r)throw Error(`Field.fromBytes: expected `+r+` bytes, got `+e.length);let s=i?Lo(e):Io(e);if(o&&(s=W(s,a)),!t&&!this.isValid(s))throw Error(`invalid field element: outside of range 0..ORDER`);return s}invertBatch(e){return ys(this,e,!0)}cmov(e,t,n){return jo(n,`condition`),n?t:e}};function ws(e,t={}){return Object.freeze(Cs.prototype),new Cs(e,t)}function Ts(e){if(typeof e!=`bigint`)throw Error(`field order must be bigint`);if(e<=U)throw Error(`field order must be greater than 1`);let t=Wo(e-U);return Math.ceil(t/8)}function Es(e){let t=Ts(e);return t+Math.ceil(t/2)}function Ds(e,t,n=!1){H(e);let r=e.length,i=Ts(t),a=Math.max(Es(t),16);if(r<a||r>1024)throw Error(`expected `+a+`-1024 bytes of input, got `+r);let o=W(n?Lo(e):Io(e),t-U)+U;return n?zo(o,i):Ro(o,i)}var Os=BigInt(0),ks=BigInt(1),As=BigInt(4),js=16,Ms=128,Ns=5,Ps=2**31;function Fs(e){let t=e;if(typeof t!=`function`)throw TypeError(`"Point" expected constructor, got type=`+typeof e);So(t.fromAffine,`Point.fromAffine`),So(t.fromBytes,`Point.fromBytes`),So(t.fromHex,`Point.fromHex`),xo(t.BASE,`Point.BASE`),xo(t.ZERO,`Point.ZERO`),vs(t.Fp),vs(t.Fn)}function Is(e,t){Fs(e),Bs(t,e);let n=ys(e.Fp,t.map(e=>e.Z));return t.map((t,r)=>e.fromAffine(t.toAffine(n[r])))}function Ls(e,t,n=1){if(!Number.isSafeInteger(e)||e<n||e>t)throw Error(`invalid window size, expected [`+n+`..`+t+`], got W=`+e)}function Rs(e,t){let n=e*(4*t+128);if(n>Ps)throw Error(`invalid window size: table would need ~`+Math.ceil(n/2**20)+` MiB, max `+Ps/2**20+` MiB`)}function zs(e,t){if(e!==void 0){So(e,`randomBytes`);try{let n=e(t);if(!Eo(n)||n.length!==t)return}catch{return}return e}}function Bs(e,t){vo(e,`points`),e.forEach((e,n)=>{if(!(e instanceof t))throw Error(`invalid point at index `+n)})}function Vs(e,t,n){if(!Array.isArray(e))throw Error(`array of scalars expected`);e.forEach((e,r)=>{if(!(n===void 0?t.isValid(e):Vo(e)&&e<n))throw Error(`invalid scalar at index `+r)})}var Hs=new WeakMap;function Us(e){return Hs.get(e)||1}function Ws(e,t){let n=e.double(),r=[e];for(let e=1;e<t;e++)r.push(r[e-1].add(n));return r}function Gs(e,t){let n=2**t,r=n/2,i=BigInt(n-1),a=[];for(;e>Os;){let t=0;e&ks&&(t=Number(e&i),t>=r&&(t-=n),e-=BigInt(t)),a.push(t),e>>=ks}return a}function Ks(e,t,n){let r=2**t,i=r/2,a=BigInt(r-1),o=BigInt(t),s=[];for(let t=0;t<n;t++){let t=Number(e&a);e>>=o,t>i&&(t-=r,e+=ks),s.push(t)}if(e!==Os)throw Error(`invalid wnaf`);return s}function qs(e,t,n){let r=0;for(let e of n)r=Math.max(r,e.length);let i=e;for(let e=r-1;e>=0;e--){e!==r-1&&(i=i.double());for(let r=0;r<n.length;r++){let a=n[r][e];if(a){let e=t[r][Math.abs(a)-1>>1];i=i.add(a<0?e.negate():e)}}}return i}var Js=class{Point;BASE;ZERO;randomBytes;wnafPrecomputes=new WeakMap;baseCanBeBlinded;bits;constructor(e,t){Fs(e),this.randomBytes=zs(t,js),this.Point=e,this.BASE=e.BASE,this.ZERO=e.ZERO,this.bits=e.Fn.BITS}buildWnafTable(e,t,n){let r=Math.ceil(n/t)+1,i=2**(t-1),a=[],o=e;for(let e=0;e<r;e++){let e=o;for(let t=0;t<i;t++)a.push(e),e=e.add(o);o=a[a.length-1].double()}return{W:t,bits:n,windows:r,comp:a}}wnafCachedCT(e,t){let{W:n,windows:r,comp:i}=e,a=2**(n-1),o=Ks(t,n,r),s=this.ZERO,c=this.BASE;for(let e=0;e<r;e++){let t=o[e],n=e*a,r=Math.abs(t)-1,l=i[n];for(let e=1;e<a;e++)l=e===r?i[n+e]:l;let u=l.negate();t===0?c=c.add(i[n]):s=s.add(t<0?u:l)}return{p:s,f:c}}getWnafPrecomputes(e,t,n,r){let i=this.wnafPrecomputes.get(t),a=i?.find(t=>t.W===e&&t.bits===n);return a||(a=this.buildWnafTable(t,e,n),typeof r==`function`&&(a={...a,comp:r(a.comp)}),i||(i=[],this.wnafPrecomputes.set(t,i)),i.push(a)),a}assertPoint(e){if(!(e instanceof this.Point))throw TypeError(`"point" expected Point instance, got type=`+typeof e)}validateMulInput(e,t){if(this.assertPoint(e),!Ho(t,ks,this.Point.Fn.ORDER))throw Error(`invalid scalar`)}runCT(e,t,n,r){let i=Us(e);return i===1?this.fixedWindowCT(e,t,n):this.wnafCachedCT(this.getWnafPrecomputes(i,e,n,r),t)}mulCT(e,t,n){return this.validateMulInput(e,t),this.runCT(e,t,this.bits,n)}mulCTBlinded(e,t,n){if(this.validateMulInput(e,t),this.randomBytes===void 0)throw Error(`randomBytes is required for scalar blinding`);let r=this.Point.Fn.BITS+Ms,i=this.randomBytes(js);if(!Eo(i)||i.length!==js)throw Error(`randomBytes returned invalid byte array`);i[0]=i[0]&63|128;let a=t+Io(i)*this.Point.Fn.ORDER;return this.runCT(e,a,r,n)}fixedWindowCT(e,t,n){let r=Ns,i=Go(r),a=Array(32);a[0]=this.ZERO;for(let t=1;t<32;t++)a[t]=a[t-1].add(e);let o=Math.ceil(n/r),s=this.ZERO;for(let e=o-1;e>=0;e--){if(e!==o-1)for(let e=0;e<r;e++)s=s.double();let n=Number(t>>BigInt(e*r)&i),c=a[0];for(let e=1;e<32;e++)c=e===n?a[e]:c;s=s.add(c)}return{p:s,f:s}}shouldBlind(e,t){return this.randomBytes===void 0?!1:t===ks||e===this.BASE&&(this.baseCanBeBlinded===void 0&&(this.baseCanBeBlinded=this.mulUnsafe(this.BASE,this.Point.Fn.ORDER).is0()),this.baseCanBeBlinded)}mulSecret(e,t,n,r){return this.shouldBlind(e,n)?this.mulCTBlinded(e,t,r):this.mulCT(e,t,r)}mulUnsafe(e,t,n){if(this.assertPoint(e),!Vo(t))throw Error(`invalid scalar`);let r=Us(e);if(r===1||t>=this.Point.Fn.ORDER)return Ys(this.Point,[e],[t],!0);let i=this.getWnafPrecomputes(r,e,this.bits,n);return this.wnafCachedCT(i,t).p}setWindowSize(e,t){this.assertPoint(e),Ls(t,this.bits),Rs((Math.ceil((this.bits+Ms)/t)+1)*2**(t-1),this.Point.Fp.BYTES),Hs.set(e,t),this.wnafPrecomputes.delete(e)}hasWindowSize(e){return Us(e)!==1}};function Ys(e,t,n,r=!1){if(Fs(e),Bs(t,e),jo(r,`allowOversized`),Vs(n,e.Fn,r?e.Fn.ORDER**As:void 0),t.length!==n.length)throw Error(`arrays of points and scalars must have equal length`);let i=t.map(e=>Ws(e,4)),a=n.map(e=>Gs(e,4));return qs(e.ZERO,i,a)}function Xs(e,t,n){if(t){if(t.ORDER!==e)throw Error(`Field.ORDER must match order: Fp == p, Fn == n`);return vs(t),t}return ws(e,{isLE:n})}function Zs(e,t,n={},r){if(e!==`weierstrass`&&e!==`edwards`)throw Error(`expected curve type "weierstrass" or "edwards"`);if(r===void 0&&(r=e===`edwards`),!t||typeof t!=`object`)throw Error(`expected valid ${e} CURVE object`);qo(n);for(let e of[`p`,`n`,`h`]){let n=t[e];if(!(Vo(n)&&n!==Os))throw Error(`CURVE.${e} must be positive bigint`)}let i=Xs(t.p,n.Fp,r),a=Xs(t.n,n.Fn,r),o=[`Gx`,`Gy`,`a`,e===`weierstrass`?`b`:`d`];for(let e of o)if(!i.isValid(t[e]))throw Error(`CURVE.${e} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:i,Fn:a}}function Qs(e,t){return function(n){let r=e(n);return{secretKey:r,publicKey:t(r)}}}var $s=BigInt(0),ec=BigInt(1),tc=BigInt(2),nc=BigInt(4),rc=BigInt(8);function ic(e,t,n,r){let i=e.sqr(n),a=e.sqr(r),o=e.add(e.mul(t.a,i),a),s=e.add(e.ONE,e.mul(t.d,e.mul(i,a)));return e.eql(o,s)}function ac(e,t={}){qo(t,{},{},`extraOpts`);let n=t,r=Zs(`edwards`,e,n,n.FpFnLE),{Fp:i,Fn:a}=r,o=r.CURVE,{h:s}=o;if(bs(i,o.a)!==1)throw Error(`edwards: CURVE.a must be a square in Fp for complete addition formulas`);if(bs(i,o.d)!==-1)throw Error(`edwards: CURVE.d must be a non-square in Fp for complete addition formulas`);qo(n,{},{uvRatio:`function`,randomBytes:`function`});let c=n.randomBytes===void 0?Do:n.randomBytes,l=tc<<BigInt(i.BYTES*8)-ec;function u(e){if(!i.isOdd)throw Error(`Field does not have .isOdd()`);return i.isOdd(e)}let d=n.uvRatio===void 0?(e,t)=>{try{return{isValid:!0,value:i.sqrt(i.div(e,t))}}catch{return{isValid:!1,value:$s}}}:n.uvRatio;if(!ic(i,o,o.Gx,o.Gy))throw Error(`bad curve params: generator point`);let f=i.eql(o.a,i.neg(i.ONE))?e=>i.neg(e):i.eql(o.a,i.ONE)?e=>e:e=>i.mul(o.a,e);function p(e,t,n=!1){let r=n?ec:$s;return Uo(`coordinate `+e,t,r,l),t}function m(e){if(!(e instanceof h))throw Error(`EdwardsPoint expected`)}class h{static BASE=new h(o.Gx,o.Gy,i.ONE,i.mul(o.Gx,o.Gy));static ZERO=new h(i.ZERO,i.ONE,i.ONE,i.ZERO);static Fp=i;static Fn=a;X;Y;Z;T;constructor(e,t,n,r){this.X=p(`x`,e),this.Y=p(`y`,t),this.Z=p(`z`,n,!0),this.T=p(`t`,r),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){if(e instanceof h)throw Error(`extended point not allowed`);let{x:t,y:n}=e||{};return p(`x`,t),p(`y`,n),new h(t,n,i.ONE,i.mul(t,n))}static fromBytes(e,t=!1){let n=i.BYTES,{a:r,d:a}=o;e=Bo(H(e,n,`point`)),jo(t,`zip215`);let s=Bo(e),c=e[n-1];s[n-1]=c&-129;let f=Lo(s);Uo(`point.y`,f,$s,t?l:i.ORDER);let p=i.sqr(f),m=i.sub(p,i.ONE),g=i.sub(i.mulN(a,p),r),{isValid:_,value:v}=d(m,g);if(!_)throw Error(`bad point: invalid y coordinate`);let y=u(v),b=!!(c&128);if(!t&&i.is0(v)&&b)throw Error(`bad point: x=0 and x_0=1`);return b!==y&&(v=i.neg(v)),h.fromAffine({x:v,y:f})}static fromHex(e,t=!1){return h.fromBytes(To(e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=6,t=!0){return _.setWindowSize(this,e),t||this.multiply(tc),this}assertValidity(){let e=this,{a:t,d:n}=o;if(e.is0())throw Error(`bad point: ZERO`);let{X:r,Y:a,Z:s,T:c}=e,l=i.sqr(r),u=i.sqr(a),d=i.sqr(s),f=i.sqr(d),p=i.mul(l,t),m=i.mul(i.add(p,u),d),h=i.add(f,i.mul(n,i.mul(l,u)));if(!i.eql(m,h))throw Error(`bad point: equation left != right (1)`);let g=i.mul(r,a),_=i.mul(s,c);if(!i.eql(g,_))throw Error(`bad point: equation left != right (2)`)}equals(e){m(e);let{X:t,Y:n,Z:r}=this,{X:a,Y:o,Z:s}=e,c=i.mul(t,s),l=i.mul(a,r),u=i.mul(n,s),d=i.mul(o,r);return i.eql(c,l)&&i.eql(u,d)}is0(){return this.equals(h.ZERO)}negate(){return new h(i.neg(this.X),this.Y,this.Z,i.neg(this.T))}double(){let{X:e,Y:t,Z:n}=this,r=i.sqr(e),a=i.sqr(t),o=i.mul(i.sqr(n),tc),s=f(r),c=i.addN(e,t),l=i.sub(i.subN(i.sqr(c),r),a),u=i.addN(s,a),d=i.subN(u,o),p=i.subN(s,a),m=i.mul(l,d),g=i.mul(u,p),_=i.mul(l,p),v=i.mul(d,u);return new h(m,g,v,_)}add(e){m(e);let{d:t}=o,{X:n,Y:r,Z:a,T:s}=this,{X:c,Y:l,Z:u,T:d}=e,p=i.mul(n,c),g=i.mul(r,l),_=i.mul(i.mulN(s,t),d),v=i.mul(a,u),y=i.sub(i.subN(i.mulN(i.addN(n,r),i.addN(c,l)),p),g),b=i.subN(v,_),ee=i.addN(v,_),x=i.sub(g,f(p)),S=i.mul(y,b),C=i.mul(ee,x),w=i.mul(y,x),T=i.mul(b,ee);return new h(S,C,T,w)}subtract(e){return m(e),this.add(e.negate())}multiply(e){if(!a.isValidNot0(e))throw RangeError(`invalid scalar: expected 1 <= sc < curve.n`);let{p:t,f:n}=_.mulSecret(this,e,s,g);return g([t,n])[0]}multiplyUnsafe(e){if(!a.isValid(e))throw RangeError(`invalid scalar: expected 0 <= sc < curve.n`);return e===$s?h.ZERO:this.is0()||e===ec?this:_.mulUnsafe(this,e,g)}isSmallOrder(){return this.clearCofactor().is0()}isTorsionFree(){return _.mulUnsafe(this,o.n).is0()}toAffine(e){let t=this,n=e;if(n!=null&&typeof n!=`bigint`)throw TypeError(`"invertedZ" expected bigint, got type=`+typeof n);let{X:r,Y:a,Z:o}=t,s=t.is0();n??=s?i.create(rc):i.inv(o);let c=i.mul(r,n),l=i.mul(a,n),u=i.mul(o,n);if(s)return{x:i.ZERO,y:i.ONE};if(!i.eql(u,i.ONE))throw Error(`invZ was invalid`);return{x:c,y:l}}clearCofactor(){return s===ec?this:s===tc?this.double():s===nc?this.double().double():s===rc?this.double().double().double():this.multiplyUnsafe(s)}toBytes(){let{x:e,y:t}=this.toAffine(),n=i.toBytes(t);return n[n.length-1]|=u(e)?128:0,n}toHex(){return Co(this.toBytes())}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}}let g=e=>Is(h,e),_=new Js(h,c);return _.bits>=6&&h.BASE.precompute(6),Object.freeze(h.prototype),Object.freeze(h),h}function oc(e,t,n={}){if(Fs(e),typeof t!=`function`)throw Error(`"hash" function param is required`);let r=t,i=n;qo(i,{},{adjustScalarBytes:`function`,randomBytes:`function`,domain:`function`,prehash:`function`,zip215:`boolean`,mapToCurve:`function`,toMontgomery:`function`,toMontgomerySecret:`function`});let{prehash:a}=i,{BASE:o,Fp:s,Fn:c}=e,l=r.outputLen,u=2*s.BYTES;if(l!==void 0&&(No(l,`hash.outputLen`),l!==u))throw Error(`hash.outputLen must be ${u}, got ${l}`);let d=i.randomBytes===void 0?Do:i.randomBytes,f=i.toMontgomery,p=i.toMontgomerySecret,m=i.adjustScalarBytes===void 0?e=>e:i.adjustScalarBytes,h=i.domain===void 0?(e,t,n)=>{if(jo(n,`phflag`),t.length||n)throw Error(`Contexts/pre-hash are not supported`);return e}:i.domain;function g(e){return c.create(Lo(e))}function _(e){let t=w.secretKey;H(e,w.secretKey,`secretKey`);let n=H(r(e),2*t,`hashedSecretKey`),i=m(n.slice(0,t));return{head:i,prefix:n.slice(t,2*t),scalar:g(i)}}function v(e){let{head:t,prefix:n,scalar:r}=_(e),i=o.multiply(r);return{head:t,prefix:n,scalar:r,point:i,pointBytes:i.toBytes()}}function y(e){return v(e).pointBytes}function b(e=Uint8Array.of(),...t){let n=wo(...t);return g(r(h(n,H(e,void 0,`context`),!!a)))}function ee(e,t,n={}){qo(n,{},{},`options`),e=H(e,void 0,`message`),a&&(e=a(e));let{prefix:r,scalar:i,pointBytes:s}=v(t),l=b(n.context,r,e),u=o.multiply(l).toBytes(),d=b(n.context,u,s,e),f=c.create(l+d*i);if(!c.isValid(f))throw Error(`sign failed: invalid s`);return H(wo(u,c.toBytes(f)),w.signature,`result`)}let x={zip215:i.zip215};function S(t,n,r,i=x){qo(i);let{context:s}=i,c=i.zip215===void 0?!!x.zip215:i.zip215,l=w.signature;t=H(t,l,`signature`),n=H(n,void 0,`message`),r=H(r,w.publicKey,`publicKey`),c!==void 0&&jo(c,`zip215`),a&&(n=a(n));let u=l/2,d=t.subarray(0,u),f=Lo(t.subarray(u,l)),p,m,h;try{p=e.fromBytes(r,c),m=e.fromBytes(d,c),h=o.multiplyUnsafe(f)}catch{return!1}if(!c&&p.isSmallOrder())return!1;let g=b(s,d,r,n);return m.add(p.multiplyUnsafe(g)).subtract(h).clearCofactor().is0()}let C=s.BYTES,w={secretKey:C,publicKey:C,signature:2*C,seed:C};function T(e){return e=e===void 0?d(w.seed):e,H(e,w.seed,`seed`)}function E(e){return Eo(e)&&e.length===w.secretKey}function D(t,n){try{return!!e.fromBytes(t,n===void 0?x.zip215:n)}catch{return!1}}let O={getExtendedPublicKey:v,randomSecretKey:T,isValidSecretKey:E,isValidPublicKey:D,toMontgomery(t){if(f===void 0)throw Error(`Montgomery conversion is not supported for this curve`);return f(e.fromBytes(t))},toMontgomerySecret(e){if(p===void 0)throw Error(`Montgomery conversion is not supported for this curve`);return p(e)}};return Object.freeze(w),Object.freeze(O),Object.freeze({keygen:Qs(T,y),getPublicKey:y,sign:ee,verify:S,utils:O,Point:e,lengths:w})}var sc=BigInt(0),cc=BigInt(1),lc=BigInt(2);function uc(e,t){return e+t-(t>>cc<<cc)}function dc(e){let t=BigInt(6)*e;return(n,r,i)=>{let a=r+i,o=((t+i-r)*n+r)%e;return{x_2:o,x_3:a-o}}}function fc(e){return qo(e,{P:`bigint`,type:`string`,adjustScalarBytes:`function`,powPminus2:`function`},{randomBytes:`function`,scalarMultBase:`function`}),Object.freeze({...e})}function pc(e){let t=fc(e),{P:n,type:r,adjustScalarBytes:i,powPminus2:a,randomBytes:o}=t,s=t.scalarMultBase,c=r===`x25519`;if(!c&&r!==`x448`)throw Error(`invalid type`);let l=o===void 0?Do:o,u=c?255:448,d=dc(n),f=c?32:56,p=BigInt(c?9:5),m=BigInt(c?121665:39081),h=c?lc**BigInt(254):lc**BigInt(447),g=h+(c?BigInt(8)*(lc**BigInt(251)-cc):BigInt(4)*(lc**BigInt(445)-cc))+cc,_=e=>W(e,n),v=y(p);function y(e){return zo(_(e),f)}function b(e){let t=Bo(H(e,f,`uCoordinate`));return c&&(t[31]&=127),_(Lo(t))}function ee(e){return Lo(i(Bo(H(e,f,`scalar`))))}let x=new Set(c?[sc,cc,n-cc,BigInt(`325606250916557431795983626356110631294008115727848805560023387167927233504`),BigInt(`39382357235489614581723060781553021112529911719440698176882885853963445705823`)]:[sc,cc,n-cc]);function S(e,t){let n=b(t);if(x.has(n))throw Error(`invalid private or public key received`);let r=E(n,ee(e));if(r===sc)throw Error(`invalid private or public key received`);return y(r)}function C(e){if(s===void 0)return S(e,v);let t=ee(e);Uo(`scalar`,t,h,g);let n=_(s(t));if(n===sc)throw Error(`invalid private or public key received`);return y(n)}let w=C,T=S;function E(e,t){Uo(`u`,e,sc,n),Uo(`scalar`,t,h,g);let r=t,i=e,o=cc,s=sc,c=e,l=cc,f=r^r>>cc;for(let e=BigInt(u-1);e>=sc;e--){let t=uc(n,f>>e);({x_2:o,x_3:c}=d(t,o,c)),{x_2:s,x_3:l}=d(t,s,l);let r=o+s,a=_(r*r),u=o-s,p=_(u*u),h=a-p,g=c+l,v=c-l,y=_(v*r),b=_(g*u),ee=y+b,x=y-b;c=_(ee*ee),l=_(i*_(x*x)),o=_(a*p),s=_(h*(a+_(m*h)))}let p=uc(n,r);({x_2:o,x_3:c}=d(p,o,c)),{x_2:s,x_3:l}=d(p,s,l);let v=a(s);return _(o*v)}let D={secretKey:f,publicKey:f,seed:f},O=e=>(e=e===void 0?l(f):e,H(e,D.seed,`seed`),e),k={randomSecretKey:O};return Object.freeze(D),Object.freeze(k),Object.freeze({keygen:Qs(O,w),getSharedSecret:T,getPublicKey:w,scalarMult:S,scalarMultBase:C,utils:k,GuBytes:v.slice(),lengths:D})}var mc=BigInt(0),hc=BigInt(1),gc=BigInt(2),_c=BigInt(3),vc=BigInt(5),yc=BigInt(8),bc=BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed`),xc={p:bc,n:BigInt(`0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed`),h:yc,a:BigInt(`0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec`),d:BigInt(`0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3`),Gx:BigInt(`0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a`),Gy:BigInt(`0x6666666666666666666666666666666666666666666666666666666666666658`)};function Sc(e){let t=BigInt(10),n=BigInt(20),r=BigInt(40),i=BigInt(80),a=bc,o=e*e%a*e%a,s=os(os(o,gc,a)*o%a,hc,a)*e%a,c=os(s,vc,a)*s%a,l=os(c,t,a)*c%a,u=os(l,n,a)*l%a,d=os(u,r,a)*u%a;return{pow_p_5_8:os(os(os(os(d,i,a)*d%a,i,a)*d%a,t,a)*c%a,gc,a)*e%a,b2:o}}function Cc(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}var wc=BigInt(`19681161376707505956807079304988542015446066515923890162744021073123829784752`);function Tc(e,t){let n=bc,r=W(t*t*t,n),i=Sc(e*W(r*r*t,n)).pow_p_5_8,a=W(e*r*i,n),o=W(t*a*a,n),s=a,c=W(a*wc,n),l=o===e,u=o===W(-e,n),d=o===W(-e*wc,n);return l&&(a=s),(u||d)&&(a=c),gs(a,n)&&(a=W(-a,n)),{isValid:l||u,value:a}}var Ec=ac(xc,{uvRatio:Tc}),Dc=Ec.Fp;function Oc(e){let{y:t}=e;return Dc.toBytes(Dc.div(hc+t,hc-t))}function kc(e){let t=Ec.Fp.BYTES;return $n(e,t),Cc(Pr(e.subarray(0,t))).subarray(0,t)}function Ac(e){return oc(Ec,Pr,Object.assign({adjustScalarBytes:Cc,toMontgomery:Oc,toMontgomerySecret:kc,zip215:!0},e))}var jc=Ac({}),Mc=(()=>{let e=bc,t=t=>{let{pow_p_5_8:n,b2:r}=Sc(t);return W(os(n,_c,e)*r,e)};return pc({P:e,type:`x25519`,powPminus2:t,adjustScalarBytes:Cc,scalarMultBase:n=>{let r=W(n,Ec.Fn.ORDER);if(r===mc)return mc;let i=Ec.BASE.multiply(r);return W((i.Z+i.Y)*t(W(i.Z-i.Y,e)),e)}})})(),Nc=class{oHash;iHash;blockLen;outputLen;canXOF=!1;finished=!1;destroyed=!1;constructor(e,t){if(er(e),$n(t,void 0,`key`),this.iHash=e.create(),typeof this.iHash.update!=`function`)throw Error(`expected Hash instance`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,r=new Uint8Array(n);r.set(t.length>n?e.create().update(t).digest():t);for(let e=0;e<r.length;e++)r[e]^=54;this.iHash.update(r),this.oHash=e.create();for(let e=0;e<r.length;e++)r[e]^=106;this.oHash.update(r),ir(r)}update(e){return nr(this),this.iHash.update(e),this}digestInto(e){nr(this),rr(e,this),this.finished=!0;let t=e.subarray(0,this.outputLen);this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),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,canXOF:s}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.canXOF=s,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Pc=(()=>{let e=((e,t,n)=>new Nc(e,t).update(n).digest());return e.create=(e,t)=>new Nc(e,t),e})(),Fc=BigInt(0),Ic={Err:class extends Error{constructor(e=``){super(e)}},_tlv:{encode:(e,t)=>{let{Err:n}=Ic;if(No(e,`tag`),e<0||e>255)throw new n(`tlv.encode: wrong tag`);if(bo(t,`data`),t.length&1)throw new n(`tlv.encode: unpadded data`);let r=t.length/2,i=Po(r);if(i.length/2&128)throw new n(`tlv.encode: long form length too big`);let a=r>127?Po(i.length/2|128):``;return Po(e)+a+i+t},decode(e,t){let{Err:n}=Ic;t=H(t,void 0,`DER data`);let r=0;if(e<0||e>255)throw new n(`tlv.decode: wrong tag`);if(t.length<2||t[r++]!==e)throw new n(`tlv.decode: wrong tlv`);let i=t[r++],a=!!(i&128),o=0;if(!a)o=i;else{let e=i&127;if(!e)throw new n(`tlv.decode(long): indefinite length not supported`);if(e>4)throw new n(`tlv.decode(long): byte length is too big`);let a=t.subarray(r,r+e);if(a.length!==e)throw new n(`tlv.decode: length bytes not complete`);if(a[0]===0)throw new n(`tlv.decode(long): zero leftmost byte`);for(let e of a)o=o<<8|e;if(r+=e,o<128)throw new n(`tlv.decode(long): not minimal encoding`)}let s=t.subarray(r,r+o);if(s.length!==o)throw new n(`tlv.decode: wrong value length`);return{v:s,l:t.subarray(r+o)}}},_int:{encode(e){let{Err:t}=Ic;if(Mo(e),e<Fc)throw new t(`integer: negative integers are not allowed`);let n=Po(e);if(Number.parseInt(n[0],16)&8&&(n=`00`+n),n.length&1)throw new t(`unexpected DER parsing assertion: unpadded hex`);return n},decode(e){let{Err:t}=Ic;if(e.length<1)throw new t(`invalid signature integer: empty`);if(e[0]&128)throw new t(`invalid signature integer: negative`);if(e.length>1&&e[0]===0&&!(e[1]&128))throw new t(`invalid signature integer: unnecessary leading zero`);return Io(e)}},toSig(e){let{Err:t,_int:n,_tlv:r}=Ic,i=H(e,void 0,`signature`),{v:a,l:o}=r.decode(48,i);if(o.length)throw new t(`invalid signature: left bytes after parsing`);let{v:s,l:c}=r.decode(2,a),{v:l,l:u}=r.decode(2,c);if(u.length)throw new t(`invalid signature: left bytes after parsing`);return{r:n.decode(s),s:n.decode(l)}},hexFromSig(e){let{_tlv:t,_int:n}=Ic;qo(e,{r:`bigint`,s:`bigint`},{},`sig`);let r=t.encode(2,n.encode(e.r))+t.encode(2,n.encode(e.s));return t.encode(48,r)}},Lc=(Object.freeze(Ic._tlv),Object.freeze(Ic._int),Object.freeze(Ic)),Rc=(e,t)=>(e+(e>=0?t:-t)/Wc)/t;function zc(e,t,n){Uo(`scalar`,e,Hc,n);let[[r,i],[a,o]]=t,s=Rc(o*e,n),c=Rc(-i*e,n),l=e-s*r-c*a,u=-s*i-c*o,d=l<Hc,f=u<Hc;d&&(l=-l),f&&(u=-u);let p=Go(Math.ceil(Wo(n)/2))+Uc;if(l<Hc||l>=p||u<Hc||u>=p)throw Error(`splitScalar (endomorphism): failed for k`);return{k1neg:d,k1:l,k2neg:f,k2:u}}function Bc(e){if(![`compact`,`recovered`,`der`].includes(e))throw Error(`Signature format must be "compact", "recovered", or "der"`);return e}function Vc(e,t){qo(e);let n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return jo(n.lowS,`lowS`),jo(n.prehash,`prehash`),n.format!==void 0&&Bc(n.format),n}var Hc=BigInt(0),Uc=BigInt(1),Wc=BigInt(2),Gc=BigInt(3),Kc=BigInt(4);function qc(e,t={}){let n=Zs(`weierstrass`,e,t),r=n.Fp,i=n.Fn,a=n.CURVE,{h:o,n:s}=a;qo(t,{},{allowInfinityPoint:`boolean`,clearCofactor:`function`,isTorsionFree:`function`,fromBytes:`function`,toBytes:`function`,endo:`object`,randomBytes:`function`});let{endo:c,allowInfinityPoint:l}=t,u=t.randomBytes===void 0?Do:t.randomBytes;if(c&&(!r.is0(a.a)||typeof c.beta!=`bigint`||!Array.isArray(c.basises)))throw Error(`invalid endo: expected "beta": bigint and "basises": array`);let d=Yc(r,i);function f(){if(!r.isOdd)throw Error(`compression is not supported: Field does not have .isOdd()`)}function p(e,t,n){if(l&&t.is0())return Uint8Array.of(0);let{x:i,y:a}=t.toAffine(),o=r.toBytes(i);return jo(n,`isCompressed`),n?(f(),wo(Jc(!r.isOdd(a)),o)):wo(Uint8Array.of(4),o,r.toBytes(a))}function m(e){H(e,void 0,`Point`);let{publicKey:t,publicKeyUncompressed:n}=d,i=e.length,a=e[0],o=e.subarray(1);if(l&&i===1&&a===0)return{x:r.ZERO,y:r.ZERO};if(i===t&&(a===2||a===3)){let e=r.fromBytes(o);if(!r.isValid(e))throw Error(`bad point: is not on curve, wrong x`);let t=y(e),n;try{n=r.sqrt(t)}catch(e){let t=e instanceof Error?`: `+e.message:``;throw Error(`bad point: is not on curve, sqrt error`+t)}f();let i=r.isOdd(n);return(a&1)==1!==i&&(n=r.neg(n)),{x:e,y:n}}if(i===n&&a===4){let e=r.BYTES,t=r.fromBytes(o.subarray(0,e)),n=r.fromBytes(o.subarray(e,e*2));if(!b(t,n))throw Error(`bad point: is not on curve`);return{x:t,y:n}}throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${n}`)}let h=t.toBytes===void 0?p:t.toBytes,g=t.fromBytes===void 0?m:t.fromBytes,_=r.mul(a.b,Gc),v=r.is0(a.a)?e=>r.ZERO:e=>r.mul(a.a,e);function y(e){let t=r.sqr(e),n=r.mul(t,e);return r.add(r.add(n,r.mul(e,a.a)),a.b)}function b(e,t){let n=r.sqr(t),i=y(e);return r.eql(n,i)}if(!b(a.Gx,a.Gy))throw Error(`bad curve params: generator point`);let ee=r.mul(r.pow(a.a,Gc),Kc),x=r.mul(r.sqr(a.b),BigInt(27));if(r.is0(r.add(ee,x)))throw Error(`bad curve params: a or b`);function S(e,t,n=!1){if(!r.isValid(t)||n&&r.is0(t))throw Error(`bad point coordinate ${e}`);return t}function C(e){if(!(e instanceof D))throw Error(`Weierstrass Point expected`)}function w(e){if(!c||!c.basises)throw Error(`no endo`);return zc(e,c.basises,i.ORDER)}function T(e,t,n,a){if(!i.isValid(a))throw RangeError(`invalid scalar: out of range`);if(c){let{k1neg:i,k1:o,k2neg:s,k2:l}=w(a),u=new D(r.mul(n.X,c.beta),n.Y,n.Z);e.push(i?n.negate():n,s?u.negate():u),t.push(o,l)}else e.push(n),t.push(a)}let E=new WeakSet;class D{static BASE=new D(a.Gx,a.Gy,r.ONE);static ZERO=new D(r.ZERO,r.ONE,r.ZERO);static Fp=r;static Fn=i;X;Y;Z;constructor(e,t,n){this.X=S(`x`,e),this.Y=S(`y`,t,!0),this.Z=S(`z`,n),Object.freeze(this)}static CURVE(){return a}static fromAffine(e){let{x:t,y:n}=e||{};if(!e||!r.isValid(t)||!r.isValid(n))throw Error(`invalid affine point`);if(e instanceof D)throw Error(`projective point not allowed`);return r.is0(t)&&r.is0(n)?D.ZERO:new D(t,n,r.ONE)}static fromBytes(e){let t=D.fromAffine(g(H(e,void 0,`point`)));return t.assertValidity(),t}static fromHex(e){return D.fromBytes(To(e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=6,t=!0){return k.setWindowSize(this,e),t||this.multiply(Gc),this}assertValidity(){let e=this;if(e.is0()){if(t.allowInfinityPoint&&r.is0(e.X)&&r.eql(e.Y,r.ONE)&&r.is0(e.Z))return;throw Error(`bad point: ZERO`)}if(E.has(e))return;let{x:n,y:i}=e.toAffine();if(!r.isValid(n)||!r.isValid(i))throw Error(`bad point: x or y not field elements`);if(!b(n,i))throw Error(`bad point: equation left != right`);if(!e.isTorsionFree())throw Error(`bad point: not in prime-order subgroup`);E.add(e)}hasEvenY(){let{y:e}=this.toAffine();if(!r.isOdd)throw Error(`Field doesn't support isOdd`);return!r.isOdd(e)}equals(e){C(e);let{X:t,Y:n,Z:i}=this,{X:a,Y:o,Z:s}=e,c=r.eql(r.mul(t,s),r.mul(a,i)),l=r.eql(r.mul(n,s),r.mul(o,i));return c&&l}negate(){return new D(this.X,r.neg(this.Y),this.Z)}double(){let{X:e,Y:t,Z:n}=this,i=r.ZERO,a=r.ZERO,o=r.ZERO,s=r.mul(e,e),c=r.mul(t,t),l=r.mul(n,n),u=r.mul(e,t);return u=r.add(u,u),o=r.mul(e,n),o=r.add(o,o),i=v(o),a=r.mul(_,l),a=r.add(i,a),i=r.sub(c,a),a=r.add(c,a),a=r.mul(i,a),i=r.mul(u,i),o=r.mul(_,o),l=v(l),u=r.sub(s,l),u=v(u),u=r.add(u,o),o=r.add(s,s),s=r.add(o,s),s=r.add(s,l),s=r.mul(s,u),a=r.add(a,s),l=r.mul(t,n),l=r.add(l,l),s=r.mul(l,u),i=r.sub(i,s),o=r.mul(l,c),o=r.add(o,o),o=r.add(o,o),new D(i,a,o)}add(e){C(e);let{X:t,Y:n,Z:i}=this,{X:a,Y:o,Z:s}=e,c=r.ZERO,l=r.ZERO,u=r.ZERO,d=r.mul(t,a),f=r.mul(n,o),p=r.mul(i,s),m=r.add(t,n),h=r.add(a,o);m=r.mul(m,h),h=r.add(d,f),m=r.sub(m,h),h=r.add(t,i);let g=r.add(a,s);return h=r.mul(h,g),g=r.add(d,p),h=r.sub(h,g),g=r.add(n,i),c=r.add(o,s),g=r.mul(g,c),c=r.add(f,p),g=r.sub(g,c),u=v(h),c=r.mul(_,p),u=r.add(c,u),c=r.sub(f,u),u=r.add(f,u),l=r.mul(c,u),f=r.add(d,d),f=r.add(f,d),p=v(p),h=r.mul(_,h),f=r.add(f,p),p=r.sub(d,p),p=v(p),h=r.add(h,p),d=r.mul(f,h),l=r.add(l,d),d=r.mul(g,h),c=r.mul(m,c),c=r.sub(c,d),d=r.mul(m,f),u=r.mul(g,u),u=r.add(u,d),new D(c,l,u)}subtract(e){return C(e),this.add(e.negate())}is0(){return this.equals(D.ZERO)}multiply(e){if(!i.isValidNot0(e))throw RangeError(`invalid scalar: out of range`);let{p:t,f:n}=k.mulSecret(this,e,o,O);return O([t,n])[0]}multiplyUnsafe(e){let t=this,n=e;if(!i.isValid(n))throw RangeError(`invalid scalar: out of range`);if(n===Hc||t.is0())return D.ZERO;if(n===Uc)return t;if(k.hasWindowSize(this))return k.mulUnsafe(t,n,O);let r=[],a=[];return T(r,a,t,n),Ys(D,r,a)}mulAddUnsafe(e,t,n){C(t);let r=[],i=[];return T(r,i,this,e),T(r,i,t,n),Ys(D,r,i)}toAffine(e){let t=this,n=e;if(n!=null&&!r.isValid(n))throw RangeError(`"invertedZ" expected valid field element`);let{X:i,Y:a,Z:o}=t;if(r.eql(o,r.ONE))return{x:i,y:a};let s=t.is0();n??=s?r.ONE:r.inv(o);let c=r.mul(i,n),l=r.mul(a,n),u=r.mul(o,n);if(s)return{x:r.ZERO,y:r.ZERO};if(!r.eql(u,r.ONE))throw Error(`invZ was invalid`);return{x:c,y:l}}isTorsionFree(){let{isTorsionFree:e}=t;return o===Uc?!0:e?e(D,this):k.mulUnsafe(this,s).is0()}clearCofactor(){let{clearCofactor:e}=t;return o===Uc?this:e?e(D,this):this.multiplyUnsafe(o)}isSmallOrder(){return o===Uc?this.is0():this.clearCofactor().is0()}toBytes(e=!0){return jo(e,`isCompressed`),this.assertValidity(),h(D,this,e)}toHex(e=!0){return Co(this.toBytes(e))}toString(){return`<Point ${this.is0()?`ZERO`:this.toHex()}>`}}let O=e=>Is(D,e),k=new Js(D,u);return k.bits>=6&&D.BASE.precompute(6),Object.freeze(D.prototype),Object.freeze(D),D}function Jc(e){return Uint8Array.of(e?2:3)}function Yc(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Xc(e,t={}){Fs(e);let{Fn:n}=e,r=t.randomBytes===void 0?Do:t.randomBytes,i=Object.assign(Yc(e.Fp,n),{seed:Math.max(Es(n.ORDER),16)});function a(e){try{let t=n.fromBytes(e);return n.isValidNot0(t)}catch{return!1}}function o(t,n){let{publicKey:r,publicKeyUncompressed:a}=i;try{let i=t.length;return n===!0&&i!==r||n===!1&&i!==a?!1:!!e.fromBytes(t)}catch{return!1}}function s(e){return e=e===void 0?r(i.seed):e,Ds(H(e,i.seed,`seed`),n.ORDER)}function c(t,r=!0){return e.BASE.multiply(n.fromBytes(t)).toBytes(r)}function l(e){let{secretKey:t,publicKey:r,publicKeyUncompressed:a}=i,o=n._lengths;if(!Eo(e))return;let s=H(e,void 0,`key`).length,c=s===r||s===a,l=s===t||!!o?.includes(s);if(!(c&&l))return c}function u(t,r,i=!0){if(l(t)===!0)throw Error(`first arg must be private key`);if(l(r)===!1)throw Error(`second arg must be public key`);let a=n.fromBytes(t);return e.fromBytes(r).multiply(a).toBytes(i)}let d={isValidSecretKey:a,isValidPublicKey:o,randomSecretKey:s},f=Qs(s,c);return Object.freeze(d),Object.freeze(i),Object.freeze({getPublicKey:c,getSharedSecret:u,keygen:f,Point:e,utils:d,lengths:i})}function Zc(e,t,n={}){Fs(e);let r=t;er(r),qo(n,{},{hmac:`function`,lowS:`boolean`,randomBytes:`function`,bits2int:`function`,bits2int_modN:`function`});let i=Object.assign({},n),a=i.randomBytes===void 0?Do:i.randomBytes,o=i.hmac===void 0?(e,t)=>Pc(r,e,t):i.hmac,{Fp:s,Fn:c}=e,{ORDER:l,BITS:u}=c,d=Es(l),f=zs(a,d),{keygen:p,getPublicKey:m,getSharedSecret:h,utils:g,lengths:_}=Xc(e,i),v={prehash:!0,lowS:typeof i.lowS!=`boolean`||i.lowS,format:`compact`,extraEntropy:!1},y=l*Wc+Uc<s.ORDER;function b(e){return e>l>>Uc}function ee(e,t){if(!c.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}function x(){if(!s.isOdd)throw Error(`Field doesn't support isOdd`)}function S(e,t,n){return x(),(e===n?0:2)|Number(s.isOdd(t))}function C(){if(y)throw Error(`"recovered" sig type is not supported for cofactor >2 curves`)}function w(e,t){Bc(t);let n=_.signature;return H(e,t===`compact`?n:t===`recovered`?n+1:void 0)}class T{r;s;recovery;constructor(e,t,n){if(this.r=ee(`r`,e),this.s=ee(`s`,t),n!=null){if(C(),![0,1,2,3].includes(n))throw Error(`invalid recovery id`);this.recovery=n}Object.freeze(this)}static fromBytes(e,t=v.format){w(e,t);let n;if(t===`der`){let{r:t,s:n}=Lc.toSig(H(e));return new T(t,n)}t===`recovered`&&(n=e[0],t=`compact`,e=e.subarray(1));let r=_.signature/2,i=e.subarray(0,r),a=e.subarray(r,r*2);return new T(c.fromBytes(i),c.fromBytes(a),n)}static fromHex(e,t){return this.fromBytes(To(e),t)}assertRecovery(){let{recovery:e}=this;if(e==null)throw Error(`invalid recovery id: must be present`);return e}addRecoveryBit(e){return new T(this.r,this.s,e)}recoverPublicKey(t){let{r:n,s:r}=this,i=this.assertRecovery(),a=i===2||i===3?n+l:n;if(!s.isValid(a))throw Error(`invalid recovery id: sig.r+curve.n != R.x`);let o=s.toBytes(a),u=e.fromBytes(wo(Jc(!(i&1)),o)),d=c.inv(a),f=D(H(t,void 0,`msgHash`)),p=c.create(-f*d),m=c.create(r*d),h=e.BASE.mulAddUnsafe(p,u,m);if(h.is0())throw Error(`invalid recovery: point at infinify`);return h.assertValidity(),h}hasHighS(){return b(this.s)}toBytes(e=v.format){if(Bc(e),e===`der`)return To(Lc.hexFromSig(this));let{r:t,s:n}=this,r=c.toBytes(t),i=c.toBytes(n);return e===`recovered`?(C(),wo(Uint8Array.of(this.assertRecovery()),r,i)):wo(r,i)}toHex(e){return Co(this.toBytes(e))}}Object.freeze(T.prototype),Object.freeze(T);let E=i.bits2int===void 0?function(e){if(e.length>8192)throw Error(`input is too large`);let t=Io(e),n=e.length*8-u;return n>0?t>>BigInt(n):t}:i.bits2int,D=i.bits2int_modN===void 0?function(e){return c.create(E(e))}:i.bits2int_modN,O=Go(u);function k(e){return Uo(`num < 2^`+u,e,Hc,O),c.toBytes(e)}function A(e,t){return H(e,void 0,`message`),t?H(r(e),void 0,`prehashed message`):e}function j(t,n,r){let{lowS:i,prehash:o,extraEntropy:s}=Vc(r,v);t=A(t,o);let u=D(t),p=c.fromBytes(n);if(!c.isValidNot0(p))throw Error(`invalid private key`);let m=[k(p),k(u)];if(s!=null&&s!==!1){let e=s===!0?a(_.secretKey):s;m.push(H(e,void 0,`extraEntropy`))}let h=wo(...m),g=u;function ee(t){let n=E(t);if(!c.isValidNot0(n))return;let r=e.BASE.multiply(n).toAffine(),a=c.create(r.x);if(a===Hc)return;let o;if(f!==void 0){let e=Io(Ds(f(d),l)),t=c.inv(c.mul(e,n)),r=c.mul(e,g),i=c.mul(e,p);o=c.create(t*c.create(r+i*a))}else{let e=cs(n,l);o=c.create(e*c.create(g+a*p))}if(o===Hc)return;let s=S(r.x,r.y,a),u=o;return i&&b(o)&&(u=c.neg(o),s^=1),new T(a,u,y?void 0:s)}return{seed:h,k2sig:ee}}function M(e,t,n={}){let{seed:i,k2sig:a}=j(e,t,n);return Ko(r.outputLen,c.BYTES,o)(i,a).toBytes(n.format)}function N(t,n,r,i={}){let{lowS:a,prehash:o,format:s}=Vc(i,v);if(r=H(r,void 0,`publicKey`),n=A(n,o),!Eo(t)){let e=t instanceof T?`, use sig.toBytes()`:``;throw Error(`verify expects Uint8Array signature`+e)}w(t,s);try{let i=T.fromBytes(t,s),o=e.fromBytes(r);if(a&&i.hasHighS())return!1;let{r:l,s:u}=i,d=D(n),f=c.inv(u),p=c.create(d*f),m=c.create(l*f),h=e.BASE.mulAddUnsafe(p,o,m);if(h.is0())return!1;let g=h.toAffine();return!(c.create(g.x)!==l||s===`recovered`&&i.recovery!==S(g.x,g.y,l))}catch{return!1}}function P(e,t,n={}){let{prehash:r}=Vc(n,v);return t=A(t,r),T.fromBytes(e,`recovered`).recoverPublicKey(t).toBytes()}return Object.freeze({keygen:p,getPublicKey:m,getSharedSecret:h,utils:g,lengths:_,Point:e,sign:M,verify:N,recoverPublicKey:P,Signature:T,hash:r})}var Qc=Zc(qc({p:BigInt(`0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff`),n:BigInt(`0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551`),h:BigInt(1),a:BigInt(`0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc`),b:BigInt(`0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b`),Gx:BigInt(`0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296`),Gy:BigInt(`0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5`)}),I),$c=class extends Error{code=`invalid_relay_e2ee_input`;constructor(){super(`Relay E2EE input is invalid.`),this.name=`RelayE2eeValidationError`}};function G(){throw new $c}function el(e){return I(e)}var tl=`ryco.node-key.v1`,nl=`ryco.client-key.v1`,rl=`ryco.e2ee-agreement-key.v1`,il=`ed25519`,al=`p256`,ol=`x25519`,sl={"node-identity":tl,"client-identity":nl,agreement:rl},cl={"node-identity":il,"client-identity":al,agreement:ol};function ll(e,t){return(!(e instanceof Uint8Array)||e.byteLength!==t)&&G(),Uint8Array.from(e)}function ul(e){let t=0n;for(let n=0;n<e.byteLength;n+=1)t=t<<8n|BigInt(e[n]);return t}function dl(e){let t=ll(e,32);return jc.utils.isValidPublicKey(t,!1)||G(),t}function fl(e){let t=ll(e,65);t[0]!==4&&G();let n=Qc.Point.Fp.ORDER,r=ul(t.subarray(1,33)),i=ul(t.subarray(33));(r>=n||i>=n)&&G();try{Qc.Point.fromBytes(t).is0()&&G()}catch{return G()}return t}function pl(e){return ll(e,32)}function ml(e,t){switch(e){case`node-identity`:return dl(t);case`client-identity`:return fl(t);case`agreement`:return pl(t);default:return G()}}function hl(e){return ll(e,64)}function gl(e){let t=ll(e,64),n=Qc.Point.Fn.ORDER,r=ul(t.subarray(0,32)),i=ul(t.subarray(32));return(r<1n||r>=n||i<1n||i>=n)&&G(),t}function _l(e,t){let n=ml(e,t);return I(ao([sl[e],cl[e],n],ka))}function vl(e,t){if(!(e instanceof Uint8Array)||!(t instanceof Uint8Array)||e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n+=1)if(e[n]!==t[n])return!1;return!0}function yl(e){try{if(e.algorithm===`ed25519`){let t=dl(e.publicKey),n=hl(e.signature);return jc.verify(n,e.message,t,{zip215:!1})}if(e.algorithm===`p256`){let t=fl(e.publicKey),n=gl(e.signature);return Qc.verify(n,I(e.message),t,{prehash:!1,lowS:!1,format:`compact`})}return!1}catch{return!1}}function bl(e){return e===1||e===2}function xl(e){return e===`c2n`||e===`n2c`}function Sl(e){return e===1||e===2||e===3||e===4}function Cl(e){return e===1||e===2||e===3}function wl(e){switch(e){case 1:return{maxBytes:mn,exact:!1};case 2:return{maxBytes:hn,exact:!1};case 3:return{maxBytes:64,exact:!0}}}var Tl=123,El=91,Dl=Object.freeze({kind:`envelope`}),Ol=Object.freeze({kind:`negotiation`}),kl=Object.freeze({kind:`legacy-json`}),Al=Object.freeze({kind:`other`,reason:`empty`}),jl=Object.freeze({kind:`other`,reason:`unknown_discriminator`});function Ml(e){if(e.byteLength===0)return Al;let t=e[0];return t===1?Dl:t===2?Ol:t===Tl||t===El?kl:jl}var Nl=1,Pl=2,Fl=3,Il=7,Ll=17;function Rl(e,t){if(typeof e!=`bigint`||e<0n||e>4294967295n)throw TypeError(`E2EE envelope epoch must be a bigint within the uint32 field range.`);if(typeof t!=`bigint`||t<0n||t>18446744073709551615n)throw TypeError(`E2EE envelope counter must be a bigint within the uint64 field range.`)}function zl(e,t,n,r){let i=r;for(let r=n-1;r>=0;--r)e[t+r]=Number(i&255n),i>>=8n}function Bl(e,t,n){let r=0n;for(let i=0;i<n;i+=1)r=r<<8n|BigInt(e[t+i]);return r}function Vl(e,t){if(!bl(t.suite))throw TypeError(`E2EE envelope suite must be a registered suite id.`);Rl(t.epoch,t.counter),e[0]=1,e[Nl]=1,e[Pl]=t.suite,zl(e,Fl,4,t.epoch),zl(e,Il,8,t.counter)}function Hl(e){let t=new Uint8Array(15);return Vl(t,e),t}function Ul(e){if(e.ciphertext.byteLength<Ll)throw TypeError(`E2EE envelope ciphertext must cover the inner type byte and the tag.`);let t=new Uint8Array(15+e.ciphertext.byteLength);return Vl(t,e),t.set(e.ciphertext,15),t}function Wl(e){if(e.byteLength===0||e[0]!==1)return{kind:`error`,reason:`bad_discriminator`};if(e.byteLength<32)return{kind:`error`,reason:`truncated`};if(e[Nl]!==1)return{kind:`error`,reason:`unsupported_version`};let t=e[Pl];return bl(t)?{kind:`ok`,value:{version:1,suite:t,epoch:Bl(e,Fl,4),counter:Bl(e,Il,8),header:e.subarray(0,15),ciphertext:e.subarray(15)}}:{kind:`error`,reason:`unsupported_suite`}}function Gl(e,t){Rl(e,t);let n=new Uint8Array(12);return zl(n,0,4,e),zl(n,4,8,t),n}function Kl(e){if(e.byteLength!==15)throw TypeError(`E2EE AEAD nonce requires the exact envelope header.`);return e.subarray(Fl,15)}function ql(e){if(e.header.byteLength!==15)throw TypeError(`E2EE AAD requires the exact envelope header.`);if(e.sessionBindingHash.byteLength!==32)throw TypeError(`E2EE AAD requires a full-length session binding hash.`);let t=new Uint8Array(50);return t.set(e.header),t.set(e.sessionBindingHash,15),t.set(Jl(e.direction),47),t}function Jl(e){if(!xl(e))throw TypeError(`E2EE direction must be a registered direction label.`);let t=new Uint8Array(3);for(let n=0;n<3;n+=1)t[n]=e.charCodeAt(n);return t}function Yl(e,t){if(!Sl(e))throw TypeError(`E2EE inner record type must be a registered type.`);let n=new Uint8Array(1+t.byteLength);return n[0]=e,n.set(t,1),n}function Xl(e){if(e.byteLength<1)return{kind:`error`,reason:`truncated`};let t=e[0];return Sl(t)?{kind:`ok`,value:{innerType:t,body:e.subarray(1)}}:{kind:`error`,reason:`reserved_inner_type`}}var Zl=2,Ql=ao(new Uint8Array(60),ka);function $l(e,t){if(e.byteLength!==t.byteLength)return!1;for(let n=0;n<e.byteLength;n+=1)if(e[n]!==t[n])return!1;return!0}function eu(e,t){if(!Cl(e))throw TypeError(`E2EE negotiation record type must be a registered type.`);let n=Zl+t.byteLength,r=wl(e);if(r.exact?n!==r.maxBytes:n>r.maxBytes)throw RangeError(`E2EE negotiation record exceeds the bound its type fixes.`);if(e===3&&!$l(t,Ql))throw TypeError(`E2EE handshake reject records are byte-identical; this body is not.`);let i=new Uint8Array(n);return i[0]=2,i[1]=e,i.set(t,Zl),i}function tu(e){if(e.byteLength===0||e[0]!==2)return{kind:`error`,reason:`bad_discriminator`};if(e.byteLength<Zl)return{kind:`error`,reason:`truncated`};let t=e[1];if(!Cl(t))return{kind:`error`,reason:`reserved_record_type`};let n=wl(t);if(e.byteLength>n.maxBytes)return{kind:`error`,reason:`too_large`};if(n.exact&&e.byteLength!==n.maxBytes)return{kind:`error`,reason:`length_mismatch`};let r=e.subarray(Zl);return t===3&&!$l(r,Ql)?{kind:`error`,reason:`non_canonical_reject`}:{kind:`ok`,value:{recordType:t,body:r}}}var nu=[`_tag`,`statement`],ru=new TextDecoder,iu=new TextEncoder;function au(e){if(e.byteLength===0||e[0]!==Tl)return{kind:`error`,reason:`not_carrier`};let t;try{t=JSON.parse(ru.decode(e))}catch{return{kind:`error`,reason:`not_carrier`}}if(typeof t!=`object`||!t||Array.isArray(t))return{kind:`error`,reason:`not_carrier`};let n=t;if(n._tag!==`ryco.e2ee.capability.v1`)return{kind:`error`,reason:`not_carrier`};if(e.byteLength>6969)return{kind:`error`,reason:`malformed`};let r=Object.keys(n);if(r.length!==nu.length||nu.some((e,t)=>r[t]!==e))return{kind:`error`,reason:`malformed`};let i=n.statement;if(typeof i!=`string`||i.length===0||!$l(iu.encode(JSON.stringify({_tag:`ryco.e2ee.capability.v1`,statement:i})),e))return{kind:`error`,reason:`malformed`};let a=su(i);return a===void 0?{kind:`error`,reason:`malformed`}:{kind:`ok`,value:a}}var ou=new Map([...`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`].map((e,t)=>[e,t]));function su(e){if(e.length%4==1)return;let t=new Uint8Array(Math.floor(e.length*3/4)),n=0,r=0,i=0;for(let a of e){let e=ou.get(a);if(e===void 0)return;n=n<<6|e,r+=6,r>=8&&(r-=8,t[i]=n>>r&255,n&=(1<<r)-1,i+=1)}if(!(r>0&&n&(1<<r)-1))return t}var cu=`ryco.node-e2ee-prekey.v1`,lu=`ryco.client-e2ee-prekey.v1`,uu=`ryco.node-e2ee-capability-digest.v1`,du=`ryco.relay-e2ee.context.v1`,fu=`ryco.relay-e2ee.account-context.v1`,pu=`ryco.relay-e2ee.prologue.v1`,mu=`25519`,hu=`SHA256`;function gu(e){return e===`native`?`IK`:`NX`}function _u(e){return e?[`IK`]:[`IK`,`NX`]}var vu={allowIndefinite:!1,allowUndefined:!1,allowInfinity:!1,allowNaN:!1,allowBigInt:!1,strict:!0,useMaps:!0,rejectDuplicateMapKeys:!0,tags:{}};function yu(e){let t=new so(e,vu);for(;!t.done();)if(L.equals(t.next().type,L.float))return!0;return!1}function bu(e){if(!(e instanceof Uint8Array)||e.byteLength===0)return{kind:`error`,reason:`malformed`};let t;try{t=_o(e,vu)}catch{try{if(!vl(ao(_o(e,{...vu,strict:!1}),ka),e))return{kind:`error`,reason:`non_canonical`}}catch{}return{kind:`error`,reason:`malformed`}}if(yu(e))return{kind:`error`,reason:`float_forbidden`};let n;try{n=ao(t,ka)}catch{return{kind:`error`,reason:`non_canonical`}}return vl(n,e)?{kind:`ok`,value:t}:{kind:`error`,reason:`non_canonical`}}function xu(e){return Uint8Array.from(ao(e,ka))}var Su=`[A-Za-z0-9_-]{22}`,Cu=RegExp(`^node_${Su}$`),wu=RegExp(`^nkey_${Su}$`),Tu=RegExp(`^epk_${Su}$`),Eu=RegExp(`^nct_${Su}$`),Du=new Set([`localhost`,`127.0.0.1`,`[::1]`]),Ou=new TextEncoder,ku=We(Oe),Au=We(j),ju=We(ee),Mu=We(Ut);function Nu(e,t){return(typeof e!=`string`||!t.test(e))&&G(),e}function Pu(e){return(!Number.isSafeInteger(e)||e<0)&&G(),e}function Fu(e){return(!Number.isSafeInteger(e)||e<0||e>65535)&&G(),e}function Iu(e){(typeof e!=`string`||e.length===0||e.length>512)&&G();let t;try{t=new URL(e)}catch{return G()}let n=t.protocol===`http:`&&Du.has(t.hostname);return(t.protocol!==`https:`&&!n||t.username!==``||t.password!==``||t.pathname!==`/`||t.search!==``||t.hash!==``||e!==t.origin)&&G(),Ou.encode(t.origin).byteLength>128&&G(),t.origin}function Lu(e){(typeof e!=`string`||e.length===0)&&G();let t=Ou.encode(e).byteLength;return(t===0||t>256)&&G(),e}function Ru(e){return Rt(ku(e))&&G(),e}function zu(e){return Rt(Au(e))&&G(),e}function Bu(e){return Rt(ju(e))&&G(),e}function Vu(e){return bl(e)||G(),e}function Hu(e){return(!(e instanceof Uint8Array)||e.byteLength!==32)&&G(),Uint8Array.from(e)}function Uu(e){return e.byteLength>1024&&G(),e}function Wu(e,t){let n=Iu(e.hubOrigin),r=Nu(e.nodeId,Cu),i=Nu(e.identityKeyId,wu),a=Nu(e.prekeyId,Tu),o=dl(e.identityPublicKey);return Uu(xu([cu,n,r,il,i,a,o,t===void 0?_l(`node-identity`,o):Hu(t),pl(e.agreementPublicKey),mu,hu,Pu(e.createdAt),Pu(e.expiresAt)]))}function Gu(e){let t=Iu(e.hubOrigin),n=Lu(e.accountId),r=fl(e.identityPublicKey);return Uu(xu([lu,t,n,al,r,_l(`client-identity`,r),pl(e.agreementPublicKey),mu,hu,Pu(e.createdAt),Pu(e.expiresAt)]))}var Ku=13;function qu(e){return typeof e==`string`}function Ju(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function Yu(e,t){return e instanceof Uint8Array&&e.byteLength===t}function Xu(e){let t=bu(e);if(t.kind===`error`)return t;let n=t.value;if(!Array.isArray(n)||n.length!==Ku)return{kind:`error`,reason:`malformed`};let[r,i,a,o,s,c,l,u,d,f,p,m,h]=n;if(r!==`ryco.node-identity-continuity.v1`||s!==`ed25519`||d!==`ed25519`||!qu(i)||!qu(a)||!Ju(o)||!qu(c)||!qu(f)||!Yu(l,32)||!Yu(u,32)||!Yu(p,32)||!Yu(m,32)||!Ju(h)||!wu.test(c)||!wu.test(f)||!Eu.test(a)||o<1)return{kind:`error`,reason:`malformed`};let g,_;try{g=_l(`node-identity`,l),_=_l(`node-identity`,p)}catch{return{kind:`error`,reason:`malformed`}}return!vl(g,u)||!vl(_,m)?{kind:`error`,reason:`malformed`}:{kind:`ok`,value:{hubOrigin:i,continuityId:a,generation:o,oldKeyId:c,oldPublicKey:l,oldFingerprint:u,newKeyId:f,newPublicKey:p,newFingerprint:m,createdAt:h}}}function Zu(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.transcript instanceof Uint8Array&&t.signature instanceof Uint8Array&&t.signature.byteLength===64}function Qu(e){if(!Array.isArray(e.chain))return{kind:`error`,failure:`malformed_entry`};if(e.chain.length>8)return{kind:`error`,failure:`chain_too_long`};let t,n;try{t=dl(e.identityPublicKey),n=_l(`node-identity`,t)}catch{return{kind:`error`,failure:`invalid_identity_key`}}let r=[],i;for(let t of e.chain){if(!Zu(t))return{kind:`error`,failure:`malformed_entry`};let n=Xu(t.transcript);if(n.kind===`error`)return{kind:`error`,failure:`malformed_entry`};let a=n.value;if(a.hubOrigin!==e.hubOrigin)return{kind:`error`,failure:`hub_origin_mismatch`};if(a.continuityId!==e.continuityId)return{kind:`error`,failure:`continuity_id_mismatch`};if(i!==void 0){if(a.generation!==i.generation+1)return{kind:`error`,failure:`generation_not_consecutive`};if(!vl(a.oldPublicKey,i.newPublicKey)||!vl(a.oldFingerprint,i.newFingerprint))return{kind:`error`,failure:`link_mismatch`}}if(!yl({algorithm:`ed25519`,publicKey:a.oldPublicKey,message:t.transcript,signature:t.signature}))return{kind:`error`,failure:`invalid_signature`};r.push(a),i=a}if(i!==void 0&&!vl(i.newPublicKey,t))return{kind:`error`,failure:`identity_key_mismatch`};let a=e.pinnedIdentityFingerprint;return a===void 0?{kind:`ok`,certificates:r}:vl(a,n)?{kind:`ok`,certificates:r,pinnedFingerprintUnchanged:!0}:r.some(e=>vl(e.oldFingerprint,a))?{kind:`ok`,certificates:r,pinnedFingerprintUnchanged:!1}:{kind:`error`,failure:`pin_not_reached`}}var $u=2,ed=19,td=6,nd=2,rd=255;function id(e){return e===`non_canonical`?`statement_non_canonical`:e===`float_forbidden`?`statement_float_forbidden`:`statement_malformed`}function ad(e){return e===`non_canonical`?`transcript_non_canonical`:e===`float_forbidden`?`transcript_float_forbidden`:`transcript_malformed`}function od(e){return{kind:`error`,failure:e}}function sd(e){return Ju(e)&&e<=65535}function cd(e){if(!Array.isArray(e)||e.length!==td)return;let[t,n,r,i,a,o]=e;if(qu(t)&&Tu.test(t)&&Yu(n,32)&&Yu(r,64)&&Yu(i,32)&&Ju(a)&&Ju(o))return{prekeyId:t,agreementPublicKey:n,crossSignature:r,agreementFingerprint:i,createdAt:a,expiresAt:o}}function ld(e){if(!Array.isArray(e)||e.length!==nd)return;let[t,n]=e;if(!(!(t instanceof Uint8Array)||t.byteLength===0||t.byteLength>1024||!Yu(n,64)))return{transcript:t,signature:n}}function ud(e){if(!(e instanceof Uint8Array))return od(`statement_malformed`);if(e.byteLength>5190)return od(`statement_too_large`);let t=bu(e);if(t.kind===`error`)return od(id(t.reason));if(!Array.isArray(t.value)||t.value.length!==$u)return od(`statement_malformed`);let[n,r]=t.value;if(!(n instanceof Uint8Array)||n.byteLength===0)return od(`statement_malformed`);if(n.byteLength>5120)return od(`transcript_too_large`);if(!Yu(r,64))return od(`statement_malformed`);let i=bu(n);if(i.kind===`error`)return od(ad(i.reason));if(!Array.isArray(i.value)||i.value.length!==ed)return od(`transcript_malformed`);let[a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,ee,x,S]=i.value;if(a!==`ryco.node-e2ee-capability.v1`||c!==`ed25519`||!qu(o)||!qu(s)||!Cu.test(s)||!qu(l)||!wu.test(l)||!Yu(u,32)||!Yu(d,32)||!sd(f)||!sd(p)||typeof _!=`boolean`||typeof v!=`boolean`||!Ju(b)||!Ju(ee)||!Ju(x)||!qu(S)||!Eu.test(S))return od(`transcript_malformed`);if(Ou.encode(o).byteLength>128)return od(`hub_origin_too_long`);try{Iu(o)}catch{return od(`transcript_malformed`)}if(!Array.isArray(m)||m.length===0)return od(`transcript_malformed`);if(m.length>8)return od(`suite_registry_too_large`);if(!m.every(e=>Ju(e)&&e<=rd)||!Array.isArray(g))return od(`transcript_malformed`);if(g.length>8)return od(`continuity_chain_too_long`);let C=[];for(let e of g){let t=ld(e);if(t===void 0)return od(`transcript_malformed`);C.push(t)}let w=cd(h);if(w===void 0)return od(`transcript_malformed`);let T=_u(v);return!Array.isArray(y)||y.length!==T.length||!T.every((e,t)=>y[t]===e)?od(`transcript_malformed`):{kind:`ok`,value:{transcript:n,signature:r,hubOrigin:o,nodeId:s,identityKeyId:l,identityPublicKey:u,identityFingerprint:d,e2eeVersionMin:f,e2eeVersionMax:p,suiteRegistry:m,prekeyCertificate:w,continuityChain:C,requireE2EE:_,requireApprovedClientE2EE:v,admittedPatterns:T,policyGeneration:b,issuedAt:ee,expiresAt:x,continuityId:S}}}function dd(e){(!(e instanceof Uint8Array)||e.byteLength===0||e.byteLength>5120)&&G();let t=I(e);t.byteLength!==32&&G();let n=xu([uu,t]);return n.byteLength!==72&&G(),n}function fd(e,t){let n=Iu(e.hubOrigin),r=Bu(e.channelId),i=Fu(e.relayProtocolMajor),a=Fu(e.relayProtocolMinor);e.e2eeVersion!==1&&G();let o=Vu(e.suiteId),s=Nu(e.nodeId,Cu),c=Hu(e.nodeIdentityFingerprint),l=Ru(e.clientIntendedCapability),u=zu(e.clientIntendedRole),d=Ru(e.channelOpenCapability),f=zu(e.channelOpenEffectiveRole),p=Nu(e.nodeContinuityId,Eu);(!Array.isArray(e.nodeContinuityChainTranscripts)||e.nodeContinuityChainTranscripts.length>8)&&G();let m=[Hu(e.nodeAgreementFingerprint)];for(let t of e.nodeContinuityChainTranscripts)(!(t instanceof Uint8Array)||t.byteLength===0)&&G(),m.push(I(t));return[t,n,r,i,a,1,o,s,il,c,e.client.tier===`native`?Lu(e.client.accountId):``,l,u,d,f,m,e.client.tier===`native`?[Hu(e.client.identityFingerprint),Hu(e.client.agreementFingerprint)]:[],p]}function pd(e){return e.suiteId!==1&&G(),xu(fd(e,du))}function md(e){(e.suiteId!==2||e.relayProtocolMajor!==1||e.relayProtocolMinor<3)&&G();let t=Mu(e.grant);Rt(t)&&G();let n=t.value,r=Hu(e.nodeAgreementFingerprint),i=Hu(e.deviceGrantDigest);return(n.suiteId!==e.suiteId||n.issuerHubOrigin!==e.hubOrigin||n.nodeId!==e.nodeId||n.accountId!==e.client.accountId||n.nodeContinuityId!==e.nodeContinuityId||!vl(n.nodeIdentityFingerprint,e.nodeIdentityFingerprint)||!vl(n.nodeAgreementFingerprint,r)||!vl(n.deviceIdentityFingerprint,e.client.identityFingerprint)||!vl(n.deviceAgreementFingerprint,e.client.agreementFingerprint))&&G(),xu([...fd(e,fu),i,n.relayTicketId,n.nodeCapabilityStatementDigest,n.clientPrekeyCertificateDigest,n.enrollmentId,n.enrollmentRevision,n.accountAuthEpoch,n.deviceAuthEpoch,n.maximumRole,[...n.capabilities],n.nonce])}function hd(e,t){return(!(e instanceof Uint8Array)||e.byteLength===0||e.byteLength>1024)&&G(),xu([Uint8Array.from(e),gl(t)])}function gd(e){(!(e instanceof Uint8Array)||e.byteLength===0)&&G();let t=I(e);return t.byteLength!==32&&G(),t}function _d(e){let t=Iu(e.hubOrigin),n=Bu(e.channelId),r=Fu(e.relayProtocolMajor),i=Fu(e.relayProtocolMinor);e.e2eeVersion!==1&&G();let a=Vu(e.suiteId),o=Nu(e.nodeId,Cu);return(!(e.contextCommitment instanceof Uint8Array)||e.contextCommitment.byteLength!==32)&&G(),xu([pu,t,n,r,i,1,a,o,Uint8Array.from(e.contextCommitment)])}function vd(e){let t;try{if(t=Wu({hubOrigin:e.hubOrigin,nodeId:e.nodeId,identityKeyId:e.identityKeyId,prekeyId:e.prekeyCertificate.prekeyId,identityPublicKey:e.identityPublicKey,agreementPublicKey:e.prekeyCertificate.agreementPublicKey,createdAt:e.prekeyCertificate.createdAt,expiresAt:e.prekeyCertificate.expiresAt},e.identityFingerprint),!vl(_l(`node-identity`,e.identityPublicKey),e.identityFingerprint)||!vl(_l(`agreement`,e.prekeyCertificate.agreementPublicKey),e.prekeyCertificate.agreementFingerprint))return!1}catch{return!1}return yl({algorithm:il,publicKey:e.identityPublicKey,message:t,signature:e.prekeyCertificate.crossSignature})}function yd(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`&&`BYTES_PER_ELEMENT`in e&&e.BYTES_PER_ELEMENT===1}var bd=e=>e?`"${e}" `:``;function xd(e,t=``){if(typeof e!=`boolean`)throw TypeError(bd(t)+`expected boolean, got type=`+typeof e);return e}function Sd(e,t=``){if(typeof e!=`number`)throw TypeError(bd(t)+`expected number, got `+typeof e);if(!Number.isSafeInteger(e)||e<0)throw RangeError(bd(t)+`expected integer >= 0, got `+e);return e}function Cd(e,t,n=``){if(yd(e)&&(t===void 0||e.length===t))return e;t!==void 0&&Sd(t,`length`);let r=yd(e),i=t===void 0?``:` of length ${t}`,a=r?`length=${e.length}`:`type=${typeof e}`,o=bd(n)+`expected Uint8Array`+i+`, got `+a;throw r?RangeError(o):TypeError(o)}var wd=(e,t)=>{if(typeof e!=`object`||!e||Array.isArray(e))throw TypeError(t===`object`?`expected valid options object`:`"${t}" expected object, got type=${typeof e}`)};function Td(e,t=!0){if(e.destroyed)throw Error(`hash was destroyed`);if(t&&e.finished)throw Error(`digest() was already called`)}function Ed(e,t){Cd(e,void 0,`output`);let n=t.outputLen;if(!(e.length>=n))throw RangeError(`"output" expected length >= `+n)}function Dd(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Od(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function kd(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}var Ad=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function jd(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Md(e){for(let t=0;t<e.length;t++)e[t]=jd(e[t]);return e}var Nd=Ad?e=>e:Md;function Pd(e,t){return wd(e,`defaults`),wd(t,`opts`),Object.assign(e,t)}function Fd(e,t){if(e=Cd(e),t=Cd(t),e.length!==t.length)return!1;let n=0;for(let r=0;r<e.length;r++)n|=e[r]^t[r];return n===0}function Id(e,t,n){let r=t,i=n||(()=>[]),a=(e,t)=>r(t,...i(e)).update(e).digest(),o=r(new Uint8Array(e),...i(new Uint8Array));return a.outputLen=o.outputLen,a.blockLen=o.blockLen,a.create=(e,...t)=>r(e,...t),a}var Ld=(e,t)=>{function n(n,...r){if(Cd(n,void 0,`key`),e.nonceLength!==void 0){let t=r[0];Cd(t,e.varSizeNonce?void 0:e.nonceLength,`nonce`)}let i=e.tagLength,a=e.nonceLength===void 0?0:1;if(!e.withAAD){for(let e=a;e<r.length;e++)if(yd(r[e]))throw Error(`AAD not supported`)}e.withAAD&&r[a]!==void 0&&Cd(r[a],void 0,`AAD`);let o=t(n,...r),s=(e,t)=>{if(t!==void 0){if(e!==2)throw Error(`cipher output not supported`);Cd(t,void 0,`output`)}},c=!1;return{encrypt(e,t){if(c)throw Error(`cannot encrypt() twice with same key + nonce`);return c=!0,Cd(e,void 0,`data`),s(o.encrypt.length,t),o.encrypt(e,t)},decrypt(e,t){if(Cd(e,void 0,`data`),i&&e.length<i)throw Error(`"ciphertext" expected length >= tagLength=`+i);return s(o.decrypt.length,t),o.decrypt(e,t)}}}return Object.assign(n,e),n};function Rd(e,t,n=!0){if(t===void 0)return new Uint8Array(e);if(Cd(t,e,`output`),n&&!Bd(t))throw Error(`invalid output, must be aligned`);return t}function zd(e,t,n){Sd(e),Sd(t),xd(n);let r=new Uint8Array(16),i=kd(r);return i.setBigUint64(0,BigInt(t),n),i.setBigUint64(8,BigInt(e),n),r}function Bd(e){return e.byteOffset%4==0}function Vd(e){return Uint8Array.from(Cd(e))}var Hd=e=>Uint8Array.from(e.split(``),e=>e.charCodeAt(0)),Ud=Nd(Dd(Hd(`expand 16-byte k`))),Wd=Nd(Dd(Hd(`expand 32-byte k`)));function K(e,t){return e<<t|e>>>32-t}var Gd=64,Kd=16,qd=2**32-1,Jd=Uint32Array.of();function Yd(e,t,n,r,i,a,o,s){let c=i.length,l=new Uint8Array(Gd),u=Dd(l),d=Ad&&Bd(i)&&Bd(a),f=d?Dd(i):Jd,p=d?Dd(a):Jd;if(!Ad){for(let d=0;d<c;o++){if(e(t,n,r,u,o,s),Nd(u),o>=qd)throw Error(`arx: counter overflow`);let f=Math.min(Gd,c-d);for(let e=0,t;e<f;e++)t=d+e,a[t]=i[t]^l[e];d+=f}return}for(let m=0;m<c;o++){if(e(t,n,r,u,o,s),o>=qd)throw Error(`arx: counter overflow`);let h=Math.min(Gd,c-m);if(d&&h===Gd){let e=m/4;if(m%4!=0)throw Error(`arx: invalid block position`);for(let t=0,n;t<Kd;t++)n=e+t,p[n]=f[n]^u[t];m+=Gd;continue}for(let e=0,t;e<h;e++)t=m+e,a[t]=i[t]^l[e];m+=h}}function Xd(e,t){let{allowShortKeys:n,extendNonceFn:r,counterLength:i,counterRight:a,rounds:o}=Pd({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!=`function`)throw Error(`core must be a function`);return Sd(i),Sd(o),xd(a),xd(n),(t,s,c,l,u=0)=>{Cd(t,void 0,`key`),Cd(s,void 0,`nonce`),Cd(c,void 0,`data`);let d=c.length;if(l=Rd(d,l,!1),Sd(u),u<0||u>=qd)throw Error(`arx: counter overflow`);let f=[],p=t.length,m,h;if(p===32)f.push(m=Vd(t)),h=Wd;else if(p===16&&n)m=new Uint8Array(32),m.set(t),m.set(t,16),h=Ud,f.push(m);else throw Cd(t,32,`arx key`),Error(`invalid key size`);(!Ad||!Bd(s))&&f.push(s=Vd(s));let g=Dd(m);if(r){if(s.length!==24)throw Error(`arx: extended nonce must be 24 bytes`);let e=s.subarray(0,16);if(Ad)r(h,g,Dd(e),g);else{let t=Nd(Uint32Array.from(h));r(t,g,Dd(e),g),Od(t),Nd(g)}s=s.subarray(16)}else Ad||Nd(g);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=Nd(Dd(s));try{return Yd(e,h,g,v,c,l,u,o),l}finally{Od(...f)}}}function Zd(e,t){return e[t++]&255|(e[t++]&255)<<8}var Qd=class{blockLen=16;outputLen=16;buffer=new Uint8Array(16);r=new Uint16Array(10);h=new Uint16Array(10);pad=new Uint16Array(8);pos=0;finished=!1;destroyed=!1;constructor(e){e=Vd(Cd(e,32,`key`));let t=Zd(e,0),n=Zd(e,2),r=Zd(e,4),i=Zd(e,6),a=Zd(e,8),o=Zd(e,10),s=Zd(e,12),c=Zd(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]=Zd(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=Zd(e,t+0),_=Zd(e,t+2),v=Zd(e,t+4),y=Zd(e,t+6),b=Zd(e,t+8),ee=Zd(e,t+10),x=Zd(e,t+12),S=Zd(e,t+14),C=i[0]+(g&8191),w=i[1]+((g>>>13|_<<3)&8191),T=i[2]+((_>>>10|v<<6)&8191),E=i[3]+((v>>>7|y<<9)&8191),D=i[4]+((y>>>4|b<<12)&8191),O=i[5]+(b>>>1&8191),k=i[6]+((b>>>14|ee<<2)&8191),A=i[7]+((ee>>>11|x<<5)&8191),j=i[8]+((x>>>8|S<<8)&8191),M=i[9]+(S>>>5|r),N=0,P=N+C*o+5*h*w+5*m*T+5*p*E+5*f*D;N=P>>>13,P&=8191,P+=5*d*O+5*u*k+5*l*A+5*c*j+5*s*M,N+=P>>>13,P&=8191;let te=N+C*s+w*o+5*h*T+5*m*E+5*p*D;N=te>>>13,te&=8191,te+=5*f*O+5*d*k+5*u*A+5*l*j+5*c*M,N+=te>>>13,te&=8191;let ne=N+C*c+w*s+T*o+5*h*E+5*m*D;N=ne>>>13,ne&=8191,ne+=5*p*O+5*f*k+5*d*A+5*u*j+5*l*M,N+=ne>>>13,ne&=8191;let re=N+C*l+w*c+T*s+E*o+5*h*D;N=re>>>13,re&=8191,re+=5*m*O+5*p*k+5*f*A+5*d*j+5*u*M,N+=re>>>13,re&=8191;let ie=N+C*u+w*l+T*c+E*s+D*o;N=ie>>>13,ie&=8191,ie+=5*h*O+5*m*k+5*p*A+5*f*j+5*d*M,N+=ie>>>13,ie&=8191;let ae=N+C*d+w*u+T*l+E*c+D*s;N=ae>>>13,ae&=8191,ae+=O*o+5*h*k+5*m*A+5*p*j+5*f*M,N+=ae>>>13,ae&=8191;let oe=N+C*f+w*d+T*u+E*l+D*c;N=oe>>>13,oe&=8191,oe+=O*s+k*o+5*h*A+5*m*j+5*p*M,N+=oe>>>13,oe&=8191;let se=N+C*p+w*f+T*d+E*u+D*l;N=se>>>13,se&=8191,se+=O*c+k*s+A*o+5*h*j+5*m*M,N+=se>>>13,se&=8191;let ce=N+C*m+w*p+T*f+E*d+D*u;N=ce>>>13,ce&=8191,ce+=O*l+k*c+A*s+j*o+5*h*M,N+=ce>>>13,ce&=8191;let le=N+C*h+w*m+T*p+E*f+D*d;N=le>>>13,le&=8191,le+=O*u+k*l+A*c+j*s+M*o,N+=le>>>13,le&=8191,N=(N<<2)+N|0,N=N+P|0,P=N&8191,N>>>=13,te+=N,i[0]=P,i[1]=te,i[2]=ne,i[3]=re,i[4]=ie,i[5]=ae,i[6]=oe,i[7]=se,i[8]=ce,i[9]=le}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;Od(n)}update(e){Td(this),Cd(e),e=Vd(e);let{buffer:t,blockLen:n}=this,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(){this.destroyed=!0,Od(this.h,this.r,this.buffer,this.pad)}digestInto(e){Td(this),Ed(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}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}},$d=Id(32,e=>new Qd(e));function ef(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],ee=n[2],x=o,S=s,C=c,w=l,T=u,E=d,D=f,O=p,k=m,A=h,j=g,M=_,N=v,P=y,te=b,ne=ee;for(let e=0;e<a;e+=2)x=x+T|0,N=K(N^x,16),k=k+N|0,T=K(T^k,12),x=x+T|0,N=K(N^x,8),k=k+N|0,T=K(T^k,7),S=S+E|0,P=K(P^S,16),A=A+P|0,E=K(E^A,12),S=S+E|0,P=K(P^S,8),A=A+P|0,E=K(E^A,7),C=C+D|0,te=K(te^C,16),j=j+te|0,D=K(D^j,12),C=C+D|0,te=K(te^C,8),j=j+te|0,D=K(D^j,7),w=w+O|0,ne=K(ne^w,16),M=M+ne|0,O=K(O^M,12),w=w+O|0,ne=K(ne^w,8),M=M+ne|0,O=K(O^M,7),x=x+E|0,ne=K(ne^x,16),j=j+ne|0,E=K(E^j,12),x=x+E|0,ne=K(ne^x,8),j=j+ne|0,E=K(E^j,7),S=S+D|0,N=K(N^S,16),M=M+N|0,D=K(D^M,12),S=S+D|0,N=K(N^S,8),M=M+N|0,D=K(D^M,7),C=C+O|0,P=K(P^C,16),k=k+P|0,O=K(O^k,12),C=C+O|0,P=K(P^C,8),k=k+P|0,O=K(O^k,7),w=w+T|0,te=K(te^w,16),A=A+te|0,T=K(T^A,12),w=w+T|0,te=K(te^w,8),A=A+te|0,T=K(T^A,7);let re=0;r[re++]=o+x|0,r[re++]=s+S|0,r[re++]=c+C|0,r[re++]=l+w|0,r[re++]=u+T|0,r[re++]=d+E|0,r[re++]=f+D|0,r[re++]=p+O|0,r[re++]=m+k|0,r[re++]=h+A|0,r[re++]=g+j|0,r[re++]=_+M|0,r[re++]=v+N|0,r[re++]=y+P|0,r[re++]=b+te|0,r[re++]=ee+ne|0}var tf=Xd(ef,{counterRight:!1,counterLength:4,allowShortKeys:!1}),nf=new Uint8Array(16),rf=(e,t)=>{e.update(t);let n=t.length%16;n&&e.update(nf.subarray(n))},af=new Uint8Array(32);function of(e,t,n,r,i){i!==void 0&&Cd(i,void 0,`AAD`);let a=e(t,n,af),o=zd(r.length,i?i.length:0,!0),s=$d.create(a);i&&rf(s,i),rf(s,r),s.update(o);let c=s.digest();return Od(a,o),c}var sf=Ld({blockSize:64,nonceLength:12,tagLength:16,withAAD:!0},(e=>(t,n,r)=>({encrypt(i,a){let o=i.length;a=Rd(o+16,a,!1),a.set(i);let s=a.subarray(0,-16);e(t,n,s,s,1);let c=of(e,t,n,s,r);return a.set(c,o),Od(c),a},decrypt(i,a){a=Rd(i.length-16,a,!1);let o=i.subarray(0,-16),s=i.subarray(-16),c=of(e,t,n,o,r);if(!Fd(s,c))throw Od(c),Error(`invalid tag`);return a.set(i.subarray(0,-16)),e(t,n,a,a,1),Od(c),a}}))(tf));function cf(e,t,n){return er(e),n===void 0&&(n=new Uint8Array(e.outputLen)),Pc(e,n,t)}var lf=Uint8Array.of(0),uf=Uint8Array.of();function df(e,t,n,r=32,i){er(e),Qn(r,`length`),$n(t,void 0,`prk`);let a=e.outputLen;if(t.length<a)throw Error(`"prk" must be at least HashLen octets`);if(r>255*a)throw Error(`Length must be <= 255*HashLen`);let o=Math.ceil(r/a);if(n===void 0?n=uf:$n(n,void 0,`info`),!o)return i&&ir(t),new Uint8Array;let s=i&&o===1?t:new Uint8Array(o*a),{iHash:c,oHash:l}=Pc.create(e,t),u=i?t:new Uint8Array(a),d=o>1?i?.iHash||e.create():void 0;for(let e=0;e<o-1;e++){lf[0]=e+1;let t=c._cloneInto(d);e&&t.update(u),t.update(n).update(lf).digestInto(u),l._cloneInto(d).update(u).digestInto(u),s.set(u,a*e)}if(lf[0]=o,o>1&&c.update(u),c.update(n).update(lf).digestInto(u),l.update(u).digestInto(u),s.set(u,a*(o-1)),c.destroy(),l.destroy(),d?.destroy(),u!==s&&ir(u),ir(lf),r===s.length)return s;let f=s.slice(0,r);return ir(s),f}var ff=`ryco.relay-e2ee.confirmation-key.v1`,pf=`ryco.relay-e2ee.aead-key.v1`,mf=`ryco.relay-e2ee.ratchet.v1`,hf=fr(ff),gf=fr(pf),_f=fr(mf);function vf(e,t){if(!(e instanceof Uint8Array)||e.byteLength!==32)throw TypeError(`Relay E2EE ${t} must be exactly E2EE_SECRET_BYTES long.`);return e}function yf(e){if(!xl(e))throw TypeError(`Relay E2EE direction must be a registered direction label.`);return e}function bf(e,t){return pr(e,Jl(yf(t)))}function xf(...e){for(let t of e)if(t instanceof Uint8Array)try{ir(t)}catch{}}function Sf(e,t){try{return t()}catch(t){throw xf(...e),t}}function Cf(e){return df(I,vf(e,`exporter secret`),hf,32)}function wf(e,t){return df(I,vf(e,`epoch secret`),bf(gf,t),32)}function Tf(e,t){return df(I,vf(e,`epoch secret`),bf(_f,t),32)}function Ef(e){return Sf([e.epochSecretC2N,e.epochSecretN2C,e.exporterSecret],()=>({epochSecretC2N:vf(e.epochSecretC2N,`epoch secret`),epochSecretN2C:vf(e.epochSecretN2C,`epoch secret`),exporterSecret:vf(e.exporterSecret,`exporter secret`),serverConfirmationKey:Cf(e.exporterSecret)}))}function Df(e){return Ef(e.split())}function Of(e){typeof e==`object`&&e&&xf(e.epochSecretC2N,e.epochSecretN2C,e.exporterSecret,e.serverConfirmationKey)}var kf=1+ao([new Uint8Array(4),new Uint8Array(8),new Uint8Array(4),new Uint8Array(8),new Uint8Array(32)],ka).byteLength,Af=17,jf=Object.freeze([...Array.from({length:2},()=>kf),...Array.from({length:1},()=>Af)]),Mf=({version:e,suite:t,key:n})=>{if(e!==1||!bl(t))throw TypeError(`Relay E2EE record AEAD selected for an unregistered version or suite.`);return vf(n,`AEAD key`),{seal:(e,t,r)=>sf(n,e,r).encrypt(t),open:(e,t,r)=>sf(n,e,r).decrypt(t)}},Nf=class e{#e;#t;#n;#r;#i;#a;#o;#s=!1;constructor(t,n,r){let i=yf(t);vf(n,`epoch secret`);let a=e.#c(r);this.#e=i,this.#r=a.epoch,this.#i=a.counter,this.#a=a.epochRecords,this.#o=a.epochBytes,this.#n=wf(n,i),this.#t=n}static#c(e){let t=e?.epoch??0n,n=e?.counter??0n,r=e?.epochRecords??0,i=e?.epochBytes??0;if(typeof t!=`bigint`||t<0n||t>4294967295n)throw RangeError(`Synthetic relay E2EE epoch must be a bigint in the uint32 range.`);if(typeof n!=`bigint`||n<0n||n>18446744073709551615n)throw RangeError(`Synthetic relay E2EE counter must be a bigint in the uint64 range.`);if(!Number.isInteger(r)||r<0||r>=65536)throw RangeError(`Synthetic relay E2EE epoch record count must leave the epoch live.`);if(!Number.isInteger(i)||i<0||i>=268435456)throw RangeError(`Synthetic relay E2EE epoch byte count must leave the epoch live.`);return{epoch:t,counter:n,epochRecords:r,epochBytes:i}}get direction(){return this.#e}get exhausted(){return this.#s}get epoch(){return this.#r}get counter(){return this.#i}get state(){return{epoch:this.#s?void 0:this.#r,counter:this.#s?void 0:this.#i,epochRecords:this.#a,epochBytes:this.#o,exhausted:this.#s}}get aeadKey(){let e=this.#n;if(e===void 0)throw TypeError(`Relay E2EE directional AEAD key is unavailable.`);return e}static#l(e,t){return e>=65536||t>=268435456}capacityFor(t){if(this.#s)return!1;let n=this.#r,r=this.#a,i=this.#o;for(let a of t){if(e.#l(r,i)){if(n>=4294967295n)return!1;n+=1n,r=0,i=0}r+=1,i+=a}return!0}advance(t){if(this.#s)throw TypeError(`Relay E2EE direction is exhausted; no record may advance it.`);if(this.#a+=1,this.#o+=t,!e.#l(this.#a,this.#o))return this.#i>=18446744073709551615n?(this.#u(),{epochCompleted:!1}):(this.#i+=1n,{epochCompleted:!1});if(this.#r>=4294967295n)return this.#u(),{epochCompleted:!0};let n=this.#t,r=this.#n;if(n===void 0)throw TypeError(`Relay E2EE epoch secret is unavailable.`);let i=Tf(n,this.#e),a=Sf([i],()=>wf(i,this.#e));return xf(n,r),this.#t=i,this.#n=a,this.#r+=1n,this.#i=0n,this.#a=0,this.#o=0,{epochCompleted:!0}}#u(){this.#s=!0,this.erase()}erase(){xf(this.#t,this.#n),this.#t=void 0,this.#n=void 0}};function Pf(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.kind===`sent`||t.kind===`failed`&&(t.delivery===`none`||t.delivery===`ambiguous`)}function Ff(e){let t,n;try{if(!bl(e.suite))throw TypeError(`Relay E2EE session suite must be a registered suite id.`);if(!(e.sessionBindingHash instanceof Uint8Array)||e.sessionBindingHash.byteLength!==32)throw TypeError(`Relay E2EE session requires a full-length session binding hash.`);if(!Number.isInteger(e.plaintextCeiling)||e.plaintextCeiling<=0)throw RangeError(`Relay E2EE session requires a positive plaintext ceiling.`);let r=yf(e.sendDirection),i=r===`c2n`?`n2c`:`c2n`,a=r===`c2n`?e.secrets.epochSecretC2N:e.secrets.epochSecretN2C,o=r===`c2n`?e.secrets.epochSecretN2C:e.secrets.epochSecretC2N;return t=new Nf(r,a,e.testOnlySyntheticSendState),n=new Nf(i,o,e.testOnlySyntheticReceiveState),{suite:e.suite,sessionBindingHash:Uint8Array.from(e.sessionBindingHash),plaintextCeiling:e.plaintextCeiling,aeadFactory:e.testOnlyAeadFactory??Mf,secrets:e.secrets,send:t,receive:n}}catch(r){throw t?.erase(),n?.erase(),Of(e.secrets),r}}var If=class{#e=1;#t;#n;#r;#i;#a;#o;#s;#c=`open`;#l=!1;#u=!1;#d=Promise.resolve();constructor(e){let t=Ff(e);this.#t=t.suite,this.#n=t.sessionBindingHash,this.#r=t.plaintextCeiling,this.#i=t.aeadFactory,this.#a=t.secrets,this.#o=t.send,this.#s=t.receive}get suite(){return this.#t}get version(){return this.#e}get sendDirection(){return this.#o.direction}get receiveDirection(){return this.#s.direction}get sendState(){return this.#o.state}get receiveState(){return this.#s.state}get postApplicationReserveHeld(){return this.#o.capacityFor(jf)}get sendPathUsable(){return!this.#u&&this.#c!==`unusable`&&this.#c!==`spent`}#f(e,t,n){if(e!==this.#e||t!==this.#t)throw TypeError(`Relay E2EE AEAD selection requires the established version and suite.`);return this.#i({version:e,suite:t,key:n})}async protect(e){if(this.#y(),!Sl(e.innerType))throw TypeError(`Relay E2EE inner record type must be a registered type.`);if(!(e.body instanceof Uint8Array))throw TypeError(`Relay E2EE inner record body must be a Uint8Array.`);if(typeof e.admit!=`function`||typeof e.transmit!=`function`)throw TypeError(`Relay E2EE sends require an admission and a transmit callback.`);let t=this.#d.then(()=>this.#p(e),()=>this.#p(e));return this.#d=t.then(()=>void 0,()=>void 0),t}async#p(e){if(this.#u)return{kind:`unavailable`,reason:`session_erased`};let t=this.#h(e.innerType);if(t!==void 0)return{kind:`unavailable`,reason:t};if(e.body.byteLength>this.#r)return{kind:`refused`,reason:`e2ee_message_too_large`};let n=1+e.body.byteLength;if(e.innerType===1){if(!this.#o.capacityFor([n,...jf]))return{kind:`close_required`}}else if(!this.#o.capacityFor([n]))return{kind:`exhausted`};let r=32+e.body.byteLength;if(!await e.admit(r))return{kind:`refused`,reason:`e2ee_send_unavailable`};if(this.#u)return{kind:`unavailable`,reason:`session_erased`};let i=this.#o.epoch,a=this.#o.counter,o=Hl({suite:this.#t,epoch:i,counter:a}),s=o[1],c=o[2];if(s!==this.#e||!bl(c)||c!==this.#t)throw TypeError(`Relay E2EE envelope header disagrees with the established session.`);let l=this.#f(s,c,this.#o.aeadKey);try{return await this.#m(e,{epoch:i,counter:a,plaintextBytes:n,aead:l,header:o})}catch{return this.#c=`unusable`,{kind:`send_failed`,epoch:i,counter:a,delivery:`ambiguous`,sendPathUsable:!1,mayEmitError:!1}}}async#m(e,t){let{epoch:n,counter:r,plaintextBytes:i,aead:a,header:o}=t,s=Kl(o),c=ql({header:o,sessionBindingHash:this.#n,direction:this.#o.direction}),l=Yl(e.innerType,e.body),u;try{let e=a.seal(s,l,c);u=Ul({suite:this.#t,epoch:n,counter:r,ciphertext:e})}catch{u=void 0}finally{xf(l)}let{epochCompleted:d}=this.#o.advance(i);if(u===void 0)return this.#c=`unusable`,{kind:`send_failed`,epoch:n,counter:r,delivery:`none`,sendPathUsable:!1,mayEmitError:!1};this.#g(e.innerType);let f;try{let t=await e.transmit(u);f=Pf(t)?t:{kind:`failed`,delivery:`ambiguous`}}catch{f={kind:`failed`,delivery:`ambiguous`}}return f.kind===`sent`?{kind:`protected`,epoch:n,counter:r,plaintextBytes:i,envelopeBytes:u.byteLength,epochCompleted:d}:f.delivery===`none`?(this.#c=`unusable`,{kind:`send_failed`,epoch:n,counter:r,delivery:`none`,sendPathUsable:!1,mayEmitError:!1}):{kind:`send_failed`,epoch:n,counter:r,delivery:`ambiguous`,sendPathUsable:this.sendPathUsable,mayEmitError:this.sendPathUsable}}#h(e){switch(this.#c){case`unusable`:return`send_path_unusable`;case`spent`:return`terminal_record_protected`;case`closing`:return e===1?`application_phase_closed`:void 0;case`open`:return}}#g(e){if(e===3){this.#c=`spent`;return}(e===2||e===4)&&this.#c===`open`&&(this.#c=`closing`)}unprotect(e){if(this.#y(),!(e instanceof Uint8Array))throw TypeError(`Relay E2EE payloads must be a Uint8Array.`);if(this.#l)return this.#v(`receive_terminated`);try{return this.#_(e)}catch(e){throw this.#l=!0,e}}#_(e){let t=Wl(e);if(t.kind===`error`)switch(t.reason){case`unsupported_version`:return this.#v(`version_mismatch`);case`unsupported_suite`:return this.#v(`suite_mismatch`);default:return this.#v(`malformed_envelope`)}let n=t.value;if(n.version!==this.#e)return this.#v(`version_mismatch`);if(n.suite!==this.#t)return this.#v(`suite_mismatch`);if(this.#s.exhausted||n.epoch!==this.#s.epoch||n.counter!==this.#s.counter)return this.#v(`sequence_mismatch`);let r=this.#f(n.version,n.suite,this.#s.aeadKey),i=Kl(n.header),a=ql({header:n.header,sessionBindingHash:this.#n,direction:this.#s.direction}),o;try{o=r.open(i,n.ciphertext,a)}catch{return this.#v(`authentication_failed`)}let s;try{s=Xl(o)}catch(e){throw xf(o),e}if(s.kind===`error`)return xf(o),this.#v(s.reason===`truncated`?`malformed_record`:`reserved_inner_type`);let c=n.epoch,l=n.counter,{epochCompleted:u}=Sf([o],()=>this.#s.advance(o.byteLength));return{kind:`authenticated`,innerType:s.value.innerType,body:s.value.body,epoch:c,counter:l,plaintextBytes:o.byteLength,epochCompleted:u}}#v(e){return this.#l=!0,{kind:`fatal`,reason:e}}erase(){this.#u||(this.#u=!0,this.#o.erase(),this.#s.erase(),Of(this.#a))}get erased(){return this.#u}#y(){if(this.#u)throw TypeError(`Relay E2EE session has been erased; it is never resumed.`)}},Lf=`Noise_IK_25519_ChaChaPoly_SHA256`,Rf=`Noise_NX_25519_ChaChaPoly_SHA256`,zf=`ryco.relay-e2ee.exporter.v1`;function Bf(e){return e===`IK`?Lf:Rf}var Vf=I.outputLen,Hf=32,Uf=32,Wf=16,Gf=65535,Kf=18446744073709551615n,qf=fr(zf),Jf=new Uint8Array,Yf=class extends Error{code=`relay_e2ee_noise_handshake_failed`;reason;constructor(e){super(`Relay E2EE Noise handshake failed.`),this.name=`E2eeNoiseHandshakeError`,this.reason=e}};function Xf(e){throw new Yf(e)}function Zf(e,t){(!(e instanceof Uint8Array)||e.byteLength!==t)&&Xf(`invalid_key_material`)}function Qf(e,t){return Zf(e,t),Uint8Array.from(e)}function $f(...e){for(let t of e)if(t instanceof Uint8Array)try{ir(t)}catch{}}function ep(e,t){let n=cf(I,t,e),r,i;try{r=df(I,n,void 0,2*Vf),i=r.slice(0,Vf);let e=r.slice(Vf);return[i,e]}catch(e){throw $f(i),e}finally{$f(n,r)}}function tp(e){(typeof e!=`bigint`||e<0n)&&Xf(`invalid_options`),e>=Kf&&Xf(`nonce_exhausted`);let t=new Uint8Array(12),n=e;for(let e=4;e<12;e+=1)t[e]=Number(n&255n),n>>=8n;return t}function np(e){return(!(e instanceof Uint8Array)||e.byteLength!==Vf)&&Xf(`invalid_key_material`),df(I,e,qf,32)}var rp=class{#e=void 0;#t=0n;initializeKey(e){e.byteLength!==Uf&&Xf(`invalid_key_material`),$f(this.#e),this.#e=e,this.#t=0n}get hasKey(){return this.#e!==void 0}encryptWithAd(e,t){let n=this.#e;if(n===void 0)return t;let r=tp(this.#t),i=sf(n,r,e).encrypt(t);return ir(r),this.#t+=1n,i}decryptWithAd(e,t){let n=this.#e;if(n===void 0)return t;let r=tp(this.#t),i=sf(n,r,e).decrypt(t);return ir(r),this.#t+=1n,i}erase(){$f(this.#e),this.#e=void 0,this.#t=0n}},ip=class{#e;#t;#n=new rp;constructor(e){let t=fr(e),n=new Uint8Array(Vf);t.byteLength<=Vf?n.set(t):n.set(I(t)),this.#t=n,this.#e=Uint8Array.from(n)}get hasKey(){return this.#n.hasKey}get handshakeHash(){return Uint8Array.from(this.#t)}mixKey(e){let[t,n]=ep(this.#e,e);try{$f(this.#e),this.#e=t,this.#n.initializeKey(n)}catch(e){throw $f(n),e}}mixHash(e){let t=I(pr(this.#t,e));$f(this.#t),this.#t=t}encryptAndHash(e){let t=this.#n.encryptWithAd(this.#t,e);return this.mixHash(t),t}decryptAndHash(e){let t=this.#n.decryptWithAd(this.#t,e);return this.mixHash(e),t}splitAndExport(){let[e,t]=ep(this.#e,Jf),n;try{return n=np(this.#e),this.erase(),{epochSecretC2N:e,epochSecretN2C:t,exporterSecret:n}}catch(r){throw $f(e,t,n),r}}erase(){$f(this.#e,this.#t),this.#n.erase()}},ap={IK:[[`e`,`es`,`s`,`ss`],[`e`,`ee`,`se`]],NX:[[`e`],[`e`,`ee`,`s`,`es`]]},op=class{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=0;#u;constructor(e){let t=e.pattern;t!==`IK`&&t!==`NX`&&Xf(`invalid_options`);let n=e.role;n!==`initiator`&&n!==`responder`&&Xf(`invalid_options`),e.prologue instanceof Uint8Array||Xf(`invalid_options`);let r=t===`IK`||n===`responder`,i=t===`IK`&&n===`initiator`;r!==(e.staticSecretKey!==void 0)&&Xf(`invalid_options`),i!==(e.remoteStaticPublicKey!==void 0)&&Xf(`invalid_options`);let a=e.staticSecretKey;a!==void 0&&Zf(a,Hf);let o=e.testOnlyEphemeralSecretKey;o!==void 0&&Zf(o,Hf);let s=e.remoteStaticPublicKey===void 0?void 0:Qf(e.remoteStaticPublicKey,Hf);this.#e=n,this.#t=ap[t],this.#a=s;let c=new ip(Bf(t));c.mixHash(e.prologue);let l=a===void 0?void 0:Mc.getPublicKey(a);t===`IK`&&c.mixHash(n===`initiator`?s:l),this.#n=c,a!==void 0&&(this.#r={secretKey:Uint8Array.from(a),publicKey:l}),this.#c=o,this.#u=n===`initiator`?`awaiting_write`:`awaiting_read`}get status(){return this.#u}get remoteStaticPublicKey(){return this.#a===void 0?void 0:Uint8Array.from(this.#a)}get remoteEphemeralPublicKey(){return this.#o===void 0?void 0:Uint8Array.from(this.#o)}get localEphemeralPublicKey(){return this.#s===void 0?void 0:Uint8Array.from(this.#s)}get testOnlyHandshakeHash(){let e=this.#n.handshakeHash;if(!e.every(e=>e===0))return e}writeMessage(e){this.#d(`awaiting_write`),e instanceof Uint8Array||Xf(`invalid_options`);try{let t=[];for(let e of this.#t[this.#l])switch(e){case`e`:{let e=this.#p();this.#i=e,this.#e===`initiator`&&(this.#s=Uint8Array.from(e.publicKey)),t.push(e.publicKey),this.#n.mixHash(e.publicKey);break}case`s`:this.#r===void 0&&Xf(`out_of_sequence`),t.push(this.#n.encryptAndHash(this.#r.publicKey));break;default:this.#m(e)}t.push(this.#n.encryptAndHash(e));let n=pr(...t);return n.byteLength>Gf&&Xf(`message_too_large`),this.#f(),n}catch(e){throw this.destroy(),e}}readMessage(e){this.#d(`awaiting_read`),e instanceof Uint8Array||Xf(`invalid_options`);try{e.byteLength>Gf&&Xf(`message_too_large`);let t=0,n=n=>{t+n>e.byteLength&&Xf(`malformed_message`);let r=e.subarray(t,t+n);return t+=n,r};for(let e of this.#t[this.#l])switch(e){case`e`:{let e=Uint8Array.from(n(Hf));this.#o=e,this.#n.mixHash(e);break}case`s`:{let e=n(this.#n.hasKey?Hf+Wf:Hf),t=this.#n.decryptAndHash(e);t.byteLength!==Hf&&Xf(`malformed_message`),this.#a=t;break}default:this.#m(e)}let r=this.#n.decryptAndHash(e.subarray(t));return this.#f(),r}catch(e){throw this.destroy(),e}}split(){this.#d(`awaiting_split`);let e;try{return e=this.#n.splitAndExport(),this.#h(),this.#u=`complete`,e}catch(t){throw e!==void 0&&$f(e.epochSecretC2N,e.epochSecretN2C,e.exporterSecret),this.destroy(),t}}destroy(){this.#u!==`complete`&&this.#u!==`destroyed`&&(this.#n.erase(),this.#h(),this.#u=`destroyed`)}#d(e){(this.#u===`complete`||this.#u===`destroyed`)&&Xf(`handshake_consumed`),this.#u!==e&&Xf(`out_of_sequence`)}#f(){if(this.#l+=1,this.#l>=this.#t.length){this.#u=`awaiting_split`;return}this.#u=this.#u===`awaiting_write`?`awaiting_read`:`awaiting_write`}#p(){let e=this.#c;if(e!==void 0){let t=Mc.getPublicKey(e);return this.#c=void 0,{secretKey:e,publicKey:t}}let t=Mc.keygen();return{secretKey:t.secretKey,publicKey:t.publicKey}}#m(e){let t=this.#e===`initiator`,n,r;switch(e){case`ee`:n=this.#i,r=this.#o;break;case`es`:n=t?this.#i:this.#r,r=t?this.#a:this.#o;break;case`se`:n=t?this.#r:this.#i,r=t?this.#o:this.#a;break;case`ss`:n=this.#r,r=this.#a}(n===void 0||r===void 0)&&Xf(`out_of_sequence`);let i=Mc.getSharedSecret(n.secretKey,r);try{this.#n.mixKey(i)}finally{$f(i)}}#h(){$f(this.#i?.secretKey,this.#r?.secretKey,this.#c),this.#i=void 0,this.#r=void 0,this.#c=void 0}},sp=We(Ut);We(ae);function cp(e){return{version:e[1],suiteId:e[2],issuerHubOrigin:e[3],keyId:e[4],grantId:e[5],accountId:e[6],accountAuthEpoch:e[7],enrollmentId:e[8],enrollmentRevision:e[9],deviceAuthEpoch:e[10],deviceIdentityAlgorithm:e[11],deviceIdentityPublicKey:e[12],deviceIdentityFingerprint:e[13],deviceAgreementAlgorithm:e[14],deviceAgreementPublicKey:e[15],deviceAgreementFingerprint:e[16],clientPrekeyCertificateDigest:e[17],nodeId:e[18],nodeIdentityAlgorithm:e[19],nodeIdentityPublicKey:e[20],nodeIdentityFingerprint:e[21],nodeAgreementAlgorithm:e[22],nodeAgreementPublicKey:e[23],nodeAgreementFingerprint:e[24],nodeContinuityId:e[25],nodePolicyGeneration:e[26],nodeCapabilityStatementDigest:e[27],relayTicketId:e[28],maximumRole:e[29],capabilities:e[30],issuedAt:e[31],notBefore:e[32],expiresAt:e[33],nonce:e[34]}}function lp(e){try{return fl(e.deviceIdentityPublicKey),pl(e.deviceAgreementPublicKey),dl(e.nodeIdentityPublicKey),pl(e.nodeAgreementPublicKey),vl(e.deviceIdentityFingerprint,_l(`client-identity`,e.deviceIdentityPublicKey))&&vl(e.deviceAgreementFingerprint,_l(`agreement`,e.deviceAgreementPublicKey))&&vl(e.nodeIdentityFingerprint,_l(`node-identity`,e.nodeIdentityPublicKey))&&vl(e.nodeAgreementFingerprint,_l(`agreement`,e.nodeAgreementPublicKey))}catch{return!1}}function up(e){return e===`non_canonical`?`grant_non_canonical`:`grant_malformed`}function dp(e){if(!(e instanceof Uint8Array))return{kind:`error`,reason:`grant_malformed`};if(e.byteLength>gn)return{kind:`error`,reason:`grant_oversize`};let t=bu(e);if(t.kind===`error`)return{kind:`error`,reason:up(t.reason)};if(!Array.isArray(t.value)||t.value.length!==2||!(t.value[0]instanceof Uint8Array)||!(t.value[1]instanceof Uint8Array)||t.value[1].byteLength!==64)return{kind:`error`,reason:`grant_malformed`};let n=t.value[0],r=t.value[1],i=bu(n);if(i.kind===`error`)return{kind:`error`,reason:up(i.reason)};if(!Array.isArray(i.value)||i.value.length!==35)return{kind:`error`,reason:`grant_malformed`};if(i.value[0]!==`ryco.hub-device-grant-claims.v1`||i.value[1]!==1||i.value[2]!==2)return{kind:`error`,reason:`grant_version`};let a=sp(cp(i.value));if(Rt(a))return{kind:`error`,reason:`grant_malformed`};try{if(Iu(a.value.issuerHubOrigin)!==a.value.issuerHubOrigin)return{kind:`error`,reason:`grant_malformed`}}catch{return{kind:`error`,reason:`grant_malformed`}}return lp(a.value)?{kind:`ok`,claims:a.value,envelope:Uint8Array.from(e),claimsBytes:Uint8Array.from(n),signature:Uint8Array.from(r),grantDigest:I(e)}:{kind:`error`,reason:`grant_binding`}}var fp=`ryco.relay-e2ee.confirmation.v1`,pp=`ryco.relay-e2ee.session.v1`;function q(e,t){return!(e instanceof Uint8Array)||!(t instanceof Uint8Array)?!1:Fd(e,t)}function mp(e){return Uint8Array.from(ao(e,ka))}function hp(e){return typeof e==`string`}function gp(e){return typeof e==`number`&&Number.isSafeInteger(e)&&e>=0}function _p(e,t){return e instanceof Uint8Array?t===void 0||e.byteLength===t:!1}function vp(e){return Uint8Array.from(e)}var yp={viewer:0,operator:1,owner:2};function bp(e){let t=yp[zu(e)];return t===void 0&&G(),t}function xp(e,t){return bp(e)<=bp(t)}function Sp(e){return e.trustSource??(e.tier===`native`?`locally-verified`:`web-unsigned`)}function Cp(e,t,n){return e===2?t===`native`&&n===`account-enrolled`:t===`web`?n===`web-unsigned`:n===`locally-verified`}function wp(e){if((!Array.isArray(e.advertisedSuiteRegistry)||e.advertisedSuiteRegistry.length===0||e.advertisedSuiteRegistry.length>8||!Array.isArray(e.localSuitePreference)||e.localSuitePreference.length===0)&&G(),!Number.isSafeInteger(e.advertisedVersionMin)||!Number.isSafeInteger(e.advertisedVersionMax)||e.advertisedVersionMin>e.advertisedVersionMax||e.advertisedVersionMin>1||1>e.advertisedVersionMax)return{kind:`unusable`,reason:`protocol_version_out_of_range`};let t=gu(e.tier);if(!e.advertisedAdmittedPatterns.includes(t))return{kind:`unusable`,reason:`pattern_not_admitted`};let n=Sp(e),r=e.localSuitePreference.find(t=>bl(t)&&Cp(t,e.tier,n)&&e.advertisedSuiteRegistry.includes(t));return r===void 0||!bl(r)?{kind:`unusable`,reason:`empty_suite_intersection`}:{kind:`usable`,selectedSuite:r}}function Tp(e){return bl(e)||G(),{dh:mu,hash:hu}}var Ep=5,Dp=3;function Op(e){return e===`native`||e===`web`}function kp(e){return Op(e.tier)||G(),bl(e.selectedSuite)||G(),(!Array.isArray(e.offeredSuites)||e.offeredSuites.length===0||e.offeredSuites.length>8||!e.offeredSuites.every(gp)||!e.offeredSuites.includes(e.selectedSuite))&&G(),_p(e.clientNonce,32)||G(),_p(e.contextCommitment,32)||G(),(!_p(e.noiseMessage1)||e.noiseMessage1.byteLength===0)&&G(),eu(1,mp([1,e.tier,e.selectedSuite,[...e.offeredSuites],vp(e.clientNonce),vp(e.contextCommitment),vp(e.noiseMessage1)]))}function Ap(e){(!_p(e.clientPrekeyTranscript)||e.clientPrekeyTranscript.length===0)&&G();let t=gl(e.clientPrekeySignature);return mp([vp(e.clientPrekeyTranscript),t,Lu(e.accountId),Ru(e.intendedCapability),zu(e.intendedRole)])}function jp(e){(!_p(e.hubDeviceGrant)||e.hubDeviceGrant.byteLength===0||e.hubDeviceGrant.byteLength>gn)&&G();let t=bu(Ap(e));return(t.kind!==`ok`||!Array.isArray(t.value))&&G(),mp([...t.value,vp(e.hubDeviceGrant)])}var Mp=new Uint8Array;function Np(e){bl(e.acceptedSuite)||G(),(!hp(e.nodePrekeyId)||e.nodePrekeyId.length===0)&&G(),_p(e.contextCommitment,32)||G(),(!_p(e.noiseMessage2)||e.noiseMessage2.byteLength===0)&&G()}function Pp(e){return Np(e),eu(2,mp([e.acceptedSuite,e.nodePrekeyId,vp(e.contextCommitment),vp(e.noiseMessage2)]))}function Fp(e){let t=tu(e);if(t.kind===`error`||t.value.recordType!==2)return{kind:`error`,reason:`bad_record`};let n=bu(t.value.body);if(n.kind===`error`)return{kind:`error`,reason:`malformed_body`};let r=n.value;if(!Array.isArray(r)||r.length!==Ep)return{kind:`error`,reason:`malformed_body`};let[i,a,o,s,c]=r;return!gp(i)||!hp(a)||a.length===0||!_p(o,32)||!_p(s)||s.byteLength===0||!_p(c,32)?{kind:`error`,reason:`malformed_body`}:{kind:`ok`,value:{acceptedSuite:i,nodePrekeyId:a,contextCommitment:o,noiseMessage2:s,serverConfirmation:c}}}function Ip(e){let t=bu(e);if(t.kind===`error`)return{kind:`error`,reason:`malformed_body`};let n=t.value;if(!Array.isArray(n)||n.length!==Dp)return{kind:`error`,reason:`malformed_body`};let[r,i,a]=n;return!hp(r)||!hp(i)||!_p(a,32)?{kind:`error`,reason:`malformed_body`}:{kind:`ok`,value:{channelOpenCapability:r,channelOpenEffectiveRole:i,nodeAgreementKeyFingerprint:a}}}function Lp(e){let t=bu(e);return(t.kind===`error`||!Array.isArray(t.value))&&G(),t.value}function Rp(e){return(!_p(e.clientHelloWireBytes)||e.clientHelloWireBytes.byteLength===0||!_p(e.serverAcceptTbsWireBytes)||e.serverAcceptTbsWireBytes.byteLength===0)&&G(),I(mp([fp,vp(e.clientHelloWireBytes),vp(e.serverAcceptTbsWireBytes),Lp(e.contextBlock)]))}function zp(e,t){return(!_p(e)||!_p(t,32))&&G(),Pc(I,e,t)}function Bp(e){(!_p(e.clientHelloWireBytes)||e.clientHelloWireBytes.byteLength===0||!_p(e.serverAcceptWireBytes)||e.serverAcceptWireBytes.byteLength===0)&&G();let t=I(mp([pp,vp(e.clientHelloWireBytes),vp(e.serverAcceptWireBytes),Lp(e.contextBlock)]));return t.byteLength!==32&&G(),t}var Vp=11;function Hp(e){let t=bu(e.transcript);if(t.kind===`error`)return{kind:`error`,failure:`malformed`};let n=t.value;if(!Array.isArray(n)||n.length!==Vp)return{kind:`error`,failure:`malformed`};let[,r,i,a,o,s,c,l,u,d,f]=n;if(!hp(r)||!hp(i)||a!==`p256`||!_p(o,65)||!_p(s,32)||!_p(c,32)||!hp(l)||!hp(u)||!gp(d)||!gp(f))return{kind:`error`,failure:`malformed`};let p,m;try{fl(o),pl(c),gl(e.signature),p=Gu({hubOrigin:r,accountId:i,identityPublicKey:o,agreementPublicKey:c,createdAt:d,expiresAt:f}),m=_l(`agreement`,c)}catch{return{kind:`error`,failure:`malformed`}}if(!q(p,e.transcript))return{kind:`error`,failure:`malformed`};if(r!==e.hubOrigin)return{kind:`error`,failure:`hub_origin_mismatch`};let h=Tp(e.suite);return l!==h.dh||u!==h.hash?{kind:`error`,failure:`usage_mismatch`}:yl({algorithm:`p256`,publicKey:o,message:e.transcript,signature:e.signature})?f<=d||f-d>2592e6||e.now+3e5<d||e.now-3e5>f?{kind:`error`,failure:`expired`}:{kind:`ok`,certificate:{hubOrigin:r,accountId:i,identityPublicKey:o,identityFingerprint:s,agreementPublicKey:c,agreementFingerprint:m,createdAt:d,expiresAt:f}}:{kind:`error`,failure:`invalid_signature`}}function Up(e,t){return{kind:`fatal`,row:e,reason:t}}function Wp(e){return e.tier===`native`&&e.trustSource===`account-enrolled`}function Gp(e,t){return e===`web`?`web-unsigned`:t===2?`account-enrolled`:`locally-verified`}function Kp(e){let t=pd({hubOrigin:e.channel.hubOrigin,channelId:e.channel.channelId,relayProtocolMajor:e.channel.relayProtocolMajor,relayProtocolMinor:e.channel.relayProtocolMinor,e2eeVersion:1,suiteId:e.suite,nodeId:e.advertised.nodeId,nodeIdentityFingerprint:e.advertised.nodeIdentityFingerprint,clientIntendedCapability:e.intendedCapability,clientIntendedRole:e.intendedRole,channelOpenCapability:e.channel.channelOpenCapability,channelOpenEffectiveRole:e.channel.channelOpenEffectiveRole,nodeAgreementFingerprint:_l(`agreement`,e.advertised.agreementPublicKey),nodeContinuityChainTranscripts:e.advertised.continuityChainTranscripts,nodeContinuityId:e.advertised.continuityId,client:e.client});return{block:t,commitment:gd(t)}}function qp(e){let{channel:t,advertised:n,grant:r,certificate:i}=e,a=r.claims,o=t.accountGrantContext,s=n.capabilityStatementDigest,c=n.policyGeneration;return t.relayProtocolMajor===1&&t.relayProtocolMinor>=3&&o!==void 0&&s instanceof Uint8Array&&Number.isSafeInteger(c)&&c!==void 0&&a.suiteId===2&&a.issuerHubOrigin===t.hubOrigin&&a.accountId===i.accountId&&a.nodeId===n.nodeId&&a.nodeContinuityId===n.continuityId&&a.nodePolicyGeneration===c&&a.relayTicketId===o.relayTicketId&&a.capabilities.some(t=>t===e.intendedCapability)&&xp(e.intendedRole,a.maximumRole)&&q(r.grantDigest,I(r.envelope))&&q(r.grantDigest,o.deviceGrantDigest)&&q(a.nodeCapabilityStatementDigest,o.nodeCapabilityStatementDigest)&&q(a.nodeCapabilityStatementDigest,s)&&q(a.clientPrekeyCertificateDigest,e.certificateDigest)&&q(a.deviceIdentityPublicKey,i.identityPublicKey)&&q(a.deviceIdentityFingerprint,i.identityFingerprint)&&q(a.deviceAgreementPublicKey,i.agreementPublicKey)&&q(a.deviceAgreementFingerprint,i.agreementFingerprint)&&q(a.nodeIdentityFingerprint,n.nodeIdentityFingerprint)&&q(a.nodeAgreementPublicKey,n.agreementPublicKey)&&q(a.nodeAgreementFingerprint,_l(`agreement`,n.agreementPublicKey))}function Jp(e){qp(e)||G();let t=md({hubOrigin:e.channel.hubOrigin,channelId:e.channel.channelId,relayProtocolMajor:e.channel.relayProtocolMajor,relayProtocolMinor:e.channel.relayProtocolMinor,e2eeVersion:1,suiteId:2,nodeId:e.advertised.nodeId,nodeIdentityFingerprint:e.advertised.nodeIdentityFingerprint,clientIntendedCapability:e.intendedCapability,clientIntendedRole:e.intendedRole,channelOpenCapability:e.channel.channelOpenCapability,channelOpenEffectiveRole:e.channel.channelOpenEffectiveRole,nodeAgreementFingerprint:_l(`agreement`,e.advertised.agreementPublicKey),nodeContinuityChainTranscripts:e.advertised.continuityChainTranscripts,nodeContinuityId:e.advertised.continuityId,client:{tier:`native`,accountId:e.certificate.accountId,identityFingerprint:e.certificate.identityFingerprint,agreementFingerprint:e.certificate.agreementFingerprint},grant:e.grant.claims,deviceGrantDigest:e.grant.grantDigest});return{block:t,commitment:gd(t)}}function Yp(e,t,n){return t===e.channelOpenCapability&&n===e.channelOpenEffectiveRole}function Xp(e){return e+xn}var Zp=class{#e;#t;#n=`created`;#r;#i;#a;#o;#s;constructor(e){if(!bl(e.selectedSuite))throw TypeError(`Relay E2EE client handshake requires a registered suite selection.`);let t=e.selectedSuite===2;if(t!==Wp(e.credentials)||t&&(e.credentials.tier!==`native`||e.channel.relayProtocolMajor!==1||e.channel.relayProtocolMinor<3||e.channel.accountGrantContext===void 0)||!t&&e.channel.accountGrantContext!==void 0)throw TypeError(`Relay E2EE suite, trust source, and channel context do not agree.`);this.#e=e,this.#t=e.credentials.tier}get tier(){return this.#t}get state(){return this.#n}get deadlineAt(){return this.#s}deadlineExpired(e){return this.#s!==void 0&&e>this.#s}createHello(e){if(this.#n!==`created`)return this.#u(Up(`P4`,`handshake_spent`));let t;try{return this.#c(e,e=>{t=e})}catch(e){throw t?.destroy(),this.destroy(),e}}#c(e,t){let n=this.#e,r=n.credentials;if(!Yp(n.channel,n.intendedCapability,n.intendedRole))return this.#u(Up(`P13`,`context_mismatch`));let i;if(Wp(r)){let t=hd(r.prekeyTranscript,r.prekeySignature),a=Hp({transcript:r.prekeyTranscript,signature:r.prekeySignature,hubOrigin:n.channel.hubOrigin,suite:n.selectedSuite,now:e}),o=dp(r.deviceGrant.envelope);if(a.kind===`error`||o.kind===`error`||!q(o.claimsBytes,r.deviceGrant.claimsBytes)||!q(o.signature,r.deviceGrant.signature)||!q(o.grantDigest,r.deviceGrant.grantDigest)||a.certificate.accountId!==r.accountId||!q(a.certificate.identityPublicKey,r.identityPublicKey)||!q(a.certificate.agreementPublicKey,r.agreementPublicKey))throw TypeError(`Relay E2EE account grant does not match the client certificate.`);i={certificate:a.certificate,digest:I(t),grant:o}}let a=Wp(r)&&i!==void 0?Jp({channel:n.channel,advertised:n.advertised,grant:i.grant,certificate:i.certificate,certificateDigest:i.digest,intendedCapability:n.intendedCapability,intendedRole:n.intendedRole}):r.tier===`native`?Kp({channel:n.channel,advertised:n.advertised,suite:n.selectedSuite,intendedCapability:n.intendedCapability,intendedRole:n.intendedRole,client:{tier:`native`,accountId:r.accountId,identityFingerprint:_l(`client-identity`,r.identityPublicKey),agreementFingerprint:_l(`agreement`,r.agreementPublicKey)}}):Kp({channel:n.channel,advertised:n.advertised,suite:n.selectedSuite,intendedCapability:n.intendedCapability,intendedRole:n.intendedRole,client:{tier:`web`}}),o=_d({hubOrigin:n.channel.hubOrigin,channelId:n.channel.channelId,relayProtocolMajor:n.channel.relayProtocolMajor,relayProtocolMinor:n.channel.relayProtocolMinor,e2eeVersion:1,suiteId:n.selectedSuite,nodeId:n.advertised.nodeId,contextCommitment:a.commitment}),s;if(r.tier===`native`){if(!q(Mc.getPublicKey(r.agreementSecretKey),r.agreementPublicKey))throw TypeError(`Relay E2EE client agreement secret key does not match its certificate key.`);let e={clientPrekeyTranscript:r.prekeyTranscript,clientPrekeySignature:r.prekeySignature,accountId:r.accountId,intendedCapability:n.intendedCapability,intendedRole:n.intendedRole};s=Wp(r)?jp({...e,hubDeviceGrant:i.grant.envelope}):Ap(e)}else s=Mp;let c=new op({pattern:gu(this.#t),role:`initiator`,prologue:o,staticSecretKey:r.tier===`native`?r.agreementSecretKey:void 0,remoteStaticPublicKey:r.tier===`native`?n.advertised.agreementPublicKey:void 0,testOnlyEphemeralSecretKey:n.testOnlyEphemeralSecretKey});t(c);let l;try{l=c.writeMessage(s)}catch{return c.destroy(),this.#u(Up(`P10`,`noise`))}let u=kp({tier:this.#t,selectedSuite:n.selectedSuite,offeredSuites:n.offeredSuites,clientNonce:n.testOnlyClientNonce??gr(32),contextCommitment:a.commitment,noiseMessage1:l});return this.#r=c,this.#i=u,this.#a=a.block,this.#o=a.commitment,this.#s=Xp(e),this.#n=`hello_sent`,{kind:`hello`,record:u,contextBlock:a.block,contextCommitment:a.commitment,prologue:o,deadlineAt:this.#s}}receiveServerAccept(e,t){if(this.#n!==`hello_sent`)return this.#u(Up(`P16`,`handshake_spent`));let n=this.#r,r=this.#i,i=this.#a,a=this.#o;if(n===void 0||r===void 0||i===void 0||a===void 0)return this.#u(Up(`P16`,`handshake_spent`));if(this.deadlineExpired(t))return this.#u(Up(`P20`,`handshake_deadline`));let o;try{return this.#l({payload:e,noise:n,helloRecord:r,contextBlock:i,contextCommitment:a,holdSecrets:e=>{o=e}})}catch(e){throw o!==void 0&&Of(o),this.destroy(),e}}#l(e){let{payload:t,noise:n,helloRecord:r,contextBlock:i,contextCommitment:a}=e,o=Fp(t);if(o.kind===`error`)return this.#u(o.reason===`bad_record`?Up(`P3`,`record_bounds`):Up(`P16`,`accept_mismatch`));let s=o.value;if(s.acceptedSuite!==this.#e.selectedSuite||s.nodePrekeyId!==this.#e.advertised.prekeyId)return this.#u(Up(`P16`,`accept_mismatch`));if(!q(s.contextCommitment,a))return this.#u(Up(`P13`,`context_mismatch`));let c;try{c=n.readMessage(s.noiseMessage2)}catch{return this.#u(Up(`P10`,`noise`))}let l=n.remoteStaticPublicKey;if(l===void 0||!q(l,this.#e.advertised.agreementPublicKey))return this.#u(Up(`P16`,`accept_mismatch`));let u=Ip(c);if(u.kind===`error`)return this.#u(Up(`P16`,`accept_mismatch`));let d=u.value;if(d.channelOpenCapability!==this.#e.channel.channelOpenCapability||d.channelOpenEffectiveRole!==this.#e.channel.channelOpenEffectiveRole||!q(d.nodeAgreementKeyFingerprint,_l(`agreement`,this.#e.advertised.agreementPublicKey)))return this.#u(Up(`P13`,`context_mismatch`));let f;try{f=Df(n)}catch{return this.#u(Up(`P10`,`noise`))}e.holdSecrets(f);let p=Pp({acceptedSuite:this.#e.selectedSuite,nodePrekeyId:s.nodePrekeyId,contextCommitment:s.contextCommitment,noiseMessage2:s.noiseMessage2}),m=Rp({clientHelloWireBytes:r,serverAcceptTbsWireBytes:p,contextBlock:i});if(!q(zp(f.serverConfirmationKey,m),s.serverConfirmation))return Of(f),this.#u(Up(`P16`,`confirmation_mismatch`));let h=Bp({clientHelloWireBytes:r,serverAcceptWireBytes:t,contextBlock:i}),g;if(this.#e.credentials.tier===`web`&&(g=n.localEphemeralPublicKey,g===void 0))throw TypeError(`Relay E2EE client handshake has no local ephemeral.`);return this.#n=`established`,this.#r=void 0,{kind:`established`,sessionBindingHash:h,secrets:f,suite:this.#e.selectedSuite,trustSource:Gp(this.#t,this.#e.selectedSuite),contextBlock:i,serverAcceptTbs:p,confirmationTranscript:m,...g===void 0?{}:{webEphemeralPublicKey:g}}}destroy(){this.#r?.destroy(),this.#r=void 0,this.#n!==`established`&&(this.#n=`failed`)}#u(e){return this.destroy(),e}};function Qp(e){return{kind:`invalid`,reason:e}}var $p=new TextEncoder;function em(e){let t;try{t=Iu(e.connectedHubOrigin)}catch{return Qp(`connected_hub_origin_invalid`)}if(e.accountId!==void 0){let t=$p.encode(e.accountId).byteLength;if(t===0||t>256)return Qp(`account_scope_invalid`)}let n=ud(e.statement);if(n.kind===`error`)return Qp(n.failure);let r=n.value,i;try{i=dd(r.transcript)}catch{return Qp(`identity_signature_invalid`)}if(!yl({algorithm:`ed25519`,publicKey:r.identityPublicKey,message:i,signature:r.signature}))return Qp(`identity_signature_invalid`);if(!vl(_l(`node-identity`,r.identityPublicKey),r.identityFingerprint))return Qp(`identity_fingerprint_mismatch`);if(!vl(_l(`agreement`,r.prekeyCertificate.agreementPublicKey),r.prekeyCertificate.agreementFingerprint))return Qp(`agreement_fingerprint_mismatch`);if(r.expiresAt<r.issuedAt)return Qp(`validity_interval_inverted`);if(r.expiresAt-r.issuedAt>6e5)return Qp(`validity_interval_too_long`);if(r.issuedAt>e.now+3e5)return Qp(`issued_at_in_future`);if(r.expiresAt<e.now-3e5)return Qp(`statement_expired`);if(r.hubOrigin!==t)return Qp(`hub_origin_mismatch`);let a=r.prekeyCertificate;if(a.expiresAt<=a.createdAt)return Qp(`prekey_lifetime_inverted`);if(a.expiresAt-a.createdAt>2592e6)return Qp(`prekey_lifetime_too_long`);if(e.now+3e5<a.createdAt)return Qp(`prekey_not_yet_valid`);if(a.expiresAt<e.now-3e5)return Qp(`prekey_expired`);if(!vd({hubOrigin:r.hubOrigin,nodeId:r.nodeId,identityKeyId:r.identityKeyId,identityPublicKey:r.identityPublicKey,identityFingerprint:r.identityFingerprint,prekeyCertificate:a}))return Qp(`prekey_cross_signature_invalid`);if(e.pin!==void 0&&r.continuityId!==e.pin.continuityId)return{kind:`identity-event`,event:{reason:`pinned_continuity_id`},statement:r};let o=Qu({chain:r.continuityChain,hubOrigin:r.hubOrigin,continuityId:r.continuityId,identityPublicKey:r.identityPublicKey,...e.pin===void 0?{}:{pinnedIdentityFingerprint:e.pin.identityFingerprint}});if(o.kind===`error`)return e.pin===void 0||o.failure===`malformed_entry`?{kind:`invalid`,reason:`continuity_chain_invalid`,chainFailure:o.failure}:{kind:`identity-event`,event:{reason:`continuity_chain`,failure:o.failure},statement:r};if(e.acceptedPolicyGeneration!==void 0&&r.policyGeneration<e.acceptedPolicyGeneration)return Qp(`policy_generation_regressed`);let s=wp({tier:e.tier,...e.trustSource===void 0?{}:{trustSource:e.trustSource},localSuitePreference:e.localSuitePreference,advertisedSuiteRegistry:r.suiteRegistry,advertisedVersionMin:r.e2eeVersionMin,advertisedVersionMax:r.e2eeVersionMax,advertisedAdmittedPatterns:r.admittedPatterns});return s.kind===`unusable`?{kind:`unusable`,reason:s.reason,statement:r}:{kind:`verified`,statement:r,selectedSuite:s.selectedSuite,anchor:o.pinnedFingerprintUnchanged===void 0?`none`:o.pinnedFingerprintUnchanged?`pin-unchanged`:`pin-updated`}}var tm={[Qe.read]:`viewer`,[Qe.subscribeEvents]:`viewer`,[Qe.lifecycle]:`owner`,[Qe.input]:`owner`,[Qe.app]:`owner`,[Qe.recording]:`owner`,[It.acceptProposal]:`owner`,[It.getProposal]:`owner`,[It.listProposals]:`owner`,[It.rejectProposal]:`owner`,[It.subscribeProposals]:`owner`,[It.listIntegrations]:`owner`,[It.createIntegration]:`owner`,[It.updateIntegration]:`owner`,[It.resumeIntegrationPairing]:`owner`,[It.revokeIntegration]:`owner`,[It.deleteIntegration]:`owner`,[It.listMcpInstallations]:`owner`,[It.connectMcpInstallation]:`owner`,[It.repairMcpInstallation]:`owner`,[It.disconnectMcpInstallation]:`owner`,[F.atlassianDisconnect]:`owner`,[F.atlassianGetProjectLink]:`owner`,[F.atlassianListConnections]:`owner`,[F.atlassianListResources]:`owner`,[F.atlassianRefresh]:`owner`,[F.atlassianSaveManualBitbucketToken]:`owner`,[F.atlassianSaveManualJiraToken]:`owner`,[F.atlassianSaveProjectLink]:`owner`,[F.atlassianStartOAuth]:`owner`,[F.chatAttachmentsCreateFileUpload]:`operator`,[F.chatAttachmentsReadChunk]:`operator`,[F.filesystemBrowse]:`operator`,[F.gitArchiveWorktree]:`operator`,[F.gitCreateWorktreeForProject]:`operator`,[F.gitDeleteWorktree]:`operator`,[F.gitFindWorktreeForOrigin]:`operator`,[F.gitPreparePullRequestThread]:`operator`,[F.gitResolvePullRequest]:`operator`,[F.gitRestoreWorktree]:`operator`,[F.gitRunStackedAction]:`operator`,[F.keybindingsReplaceCustom]:`owner`,[F.mcpListServers]:`owner`,[F.mcpListWorkspaces]:`owner`,[F.mcpReloadServers]:`owner`,[F.mcpRemoveServer]:`owner`,[F.mcpSetServerEnabled]:`owner`,[F.mcpStartOauthLogin]:`owner`,[F.mcpUpsertServer]:`owner`,[a.dispatchCommand]:`operator`,[a.getFullThreadDiff]:`viewer`,[a.getTurnDiff]:`viewer`,[a.getTaskOutput]:`operator`,[a.getThreadHistoryPage]:`viewer`,[a.getThreadWindow]:`viewer`,[a.getWorkflowScript]:`operator`,[a.stopBackgroundTask]:`operator`,[a.replayEvents]:`viewer`,[a.replayEventsPage]:`viewer`,[a.searchThreadMessages]:`viewer`,[a.subscribeShell]:`viewer`,[a.subscribeThread]:`viewer`,[a.subscribeThreadWindow]:`viewer`,[_.getInspectionSummary]:`viewer`,[_.listInspectionEntries]:`viewer`,[_.readRawPayloadChunk]:`viewer`,[_.readExportChunk]:`viewer`,[F.projectsAdd]:`operator`,[F.projectsInitializeGit]:`operator`,[F.projectsList]:`viewer`,[F.projectsListEntries]:`operator`,[F.projectsReadFile]:`operator`,[F.projectsReadFileBinary]:`operator`,[F.projectsRemove]:`operator`,[F.projectsSearchEntries]:`operator`,[F.projectsStageFileReference]:`operator`,[F.projectsWriteFile]:`operator`,[F.serverCheckOpinionatedPlugins]:`owner`,[F.serverDiscoverSourceControl]:`owner`,[F.serverGetAdvertisedEndpoints]:`viewer`,[F.serverGetConfig]:`viewer`,[F.serverGetDiagnosticsMetrics]:`owner`,[F.serverGetDiagnosticsSnapshot]:`owner`,[F.serverSignalDiagnosticProcess]:`owner`,[F.serverGetResourceTelemetryHistory]:`owner`,[F.serverRetryResourceTelemetry]:`owner`,[F.serverGetSettings]:`viewer`,[F.serverGetStatistics]:`owner`,[F.serverGetUsageSummary]:`owner`,[F.serverInstallOpinionatedPlugin]:`owner`,[F.serverListOpinionatedPlugins]:`owner`,[F.serverRefreshProviders]:`owner`,[F.serverUpdateProvider]:`owner`,[F.serverUpdateSettings]:`owner`,[F.serverUpsertKeybinding]:`owner`,[F.shellOpenInEditor]:`operator`,[F.sourceControlAddChangeRequestComment]:`operator`,[F.sourceControlAddChangeRequestCommentReaction]:`operator`,[F.sourceControlAddIssueComment]:`operator`,[F.sourceControlAddIssueCommentReaction]:`operator`,[F.sourceControlCloneRepository]:`operator`,[F.sourceControlCreateIssue]:`operator`,[F.sourceControlGetChangeRequestDetail]:`operator`,[F.sourceControlGetChangeRequestDiff]:`operator`,[F.sourceControlGetIssue]:`operator`,[F.sourceControlGetWorkflowJobLog]:`operator`,[F.sourceControlGetWorkflowRunJobs]:`operator`,[F.sourceControlListChangeRequests]:`operator`,[F.sourceControlListIssueAssignees]:`operator`,[F.sourceControlListIssueLabels]:`operator`,[F.sourceControlListIssues]:`operator`,[F.sourceControlListWorkflowRuns]:`operator`,[F.sourceControlLookupRepository]:`operator`,[F.sourceControlMergeChangeRequest]:`operator`,[F.sourceControlPublishRepository]:`operator`,[F.sourceControlRerunWorkflow]:`operator`,[F.sourceControlSearchChangeRequests]:`operator`,[F.sourceControlSearchIssues]:`operator`,[F.sourceControlSearchRepositories]:`operator`,[F.subscribeAuthAccess]:`direct_owner`,[F.subscribeServerConfig]:`viewer`,[F.subscribeServerLifecycle]:`viewer`,[F.subscribeTerminalEvents]:`operator`,[F.subscribeVcsStatus]:`operator`,[F.terminalClear]:`operator`,[F.terminalClose]:`operator`,[F.terminalOpen]:`operator`,[F.terminalResize]:`operator`,[F.terminalRestart]:`operator`,[F.terminalWrite]:`operator`,[F.textGenerationGenerateBranchName]:`operator`,[F.textGenerationGenerateIssueContent]:`operator`,[F.threadPriorityEnsureCurrent]:`operator`,[F.searchThreadMessages]:`owner`,[F.threadsSetManualBucket]:`operator`,[F.threadsSetManualPosition]:`operator`,[F.vcsCreateRef]:`operator`,[F.vcsCreateWorktree]:`operator`,[F.vcsInit]:`operator`,[F.vcsListRefs]:`operator`,[F.vcsPull]:`operator`,[F.vcsRefreshStatus]:`operator`,[F.vcsRemoveWorktree]:`operator`,[F.vcsSwitchRef]:`operator`,[F.workItemsAddComment]:`operator`,[F.workItemsEditComment]:`operator`,[F.workItemsGet]:`viewer`,[F.workItemsList]:`viewer`,[F.workItemsListProjects]:`viewer`,[F.workItemsListTransitions]:`viewer`,[F.workItemsSearch]:`viewer`,[F.workItemsTransition]:`operator`,[F.workItemsUpdate]:`operator`,[F.worktreesSetManualPosition]:`operator`};function nm(e){if(!Object.hasOwn(tm,e))throw Error(`RPC method has no explicit access classification.`);return tm[e]}var rm={viewer:1,operator:2,owner:3};function im(e,t,n=!0){if(!e||!n)return!1;let r=nm(t);return r===`authenticated`||r===`direct_owner`?!1:rm[e]>=rm[r]}var am=new Set([`ble`,`cable`,`hybrid`,`internal`,`nfc`,`smart-card`,`usb`]);function om(){throw Error(`Invalid passkey options.`)}function sm(e){return(typeof e!=`object`||!e||Array.isArray(e))&&om(),e}function cm(e){return(typeof e!=`string`||e.length===0)&&om(),e}function lm(e){if(e!==void 0)return(typeof e!=`number`||!Number.isSafeInteger(e)||e<0)&&om(),e}function um(e){try{return tn(cm(e))}catch{return om()}}function dm(e){if(e!==void 0)return Array.isArray(e)||om(),e.map(e=>{let t=sm(e);t.type!==`public-key`&&om();let n=t.transports;return n!==void 0&&!Array.isArray(n)&&om(),Array.isArray(n)&&n.some(e=>typeof e!=`string`||!am.has(e))&&om(),{id:um(t.id),type:`public-key`,...Array.isArray(n)?{transports:n}:{}}})}function fm(e){if(e!==void 0)return e===`discouraged`||e===`preferred`||e===`required`?e:om()}function pm(e){if(e!==void 0)return sm(e)}function mm(e){let t=sm(e),n={challenge:um(t.challenge)},r=lm(t.timeout),i=t.rpId===void 0?void 0:cm(t.rpId),a=dm(t.allowCredentials),o=fm(t.userVerification),s=pm(t.extensions);return r!==void 0&&(n.timeout=r),i!==void 0&&(n.rpId=i),a!==void 0&&(n.allowCredentials=a),o!==void 0&&(n.userVerification=o),s!==void 0&&(n.extensions=s),n}function hm(e){let t=sm(e),n=sm(t.rp),r=sm(t.user);(!Array.isArray(t.pubKeyCredParams)||t.pubKeyCredParams.length===0)&&om();let i=t.pubKeyCredParams.map(e=>{let t=sm(e);return(t.type!==`public-key`||typeof t.alg!=`number`||!Number.isSafeInteger(t.alg))&&om(),{type:`public-key`,alg:t.alg}}),a={challenge:um(t.challenge),rp:{name:cm(n.name),...n.id===void 0?{}:{id:cm(n.id)}},user:{id:um(r.id),name:cm(r.name),displayName:cm(r.displayName)},pubKeyCredParams:i},o=lm(t.timeout),s=dm(t.excludeCredentials),c=vm(t.authenticatorSelection),l=ym(t.attestation),u=pm(t.extensions);return o!==void 0&&(a.timeout=o),s!==void 0&&(a.excludeCredentials=s),c!==void 0&&(a.authenticatorSelection=c),l!==void 0&&(a.attestation=l),u!==void 0&&(a.extensions=u),a}function gm(e){return mm(e)}function _m(e){return hm(e)}function vm(e){if(e===void 0)return;let t=sm(e),n=t.authenticatorAttachment,r=t.residentKey,i=t.requireResidentKey,a=fm(t.userVerification);return n!==void 0&&n!==`platform`&&n!==`cross-platform`&&om(),r!==void 0&&r!==`discouraged`&&r!==`preferred`&&r!==`required`&&om(),i!==void 0&&typeof i!=`boolean`&&om(),{...n===void 0?{}:{authenticatorAttachment:n},...r===void 0?{}:{residentKey:r},...i===void 0?{}:{requireResidentKey:i},...a===void 0?{}:{userVerification:a}}}function ym(e){if(e!==void 0)return e===`none`||e===`indirect`||e===`direct`||e===`enterprise`?e:om()}var bm={authorization_rejected:`The Hub authorization request could not be verified.`,callback_rejected:`The browser response could not be verified.`,cancelled:`Authorization was cancelled.`,expired:`The authorization request expired. Try again.`,platform_invalid:`Secure browser authorization is unavailable on this device.`,superseded:`A newer authorization request replaced this one.`},xm=6e4,Sm=class extends Error{code;constructor(e){super(bm[e]),this.name=e===`cancelled`||e===`superseded`?`AbortError`:`NativeHandoffError`,this.code=e}},Cm=new Map;function wm(e,t){return Lt(e)(t,{onExcessProperty:`error`})}function Tm(e){let t=new Uint8Array(e.length);for(let n=0;n<e.length;n+=1)t[n]=e.charCodeAt(n);return t}async function Em(e){let t=await e.randomBytes(32);if(!(t instanceof Uint8Array)||t.byteLength!==32)throw new Sm(`platform_invalid`);return Uint8Array.from(t)}function Dm(e,t){let n=Math.max(e.length,t.length),r=e.length^t.length;for(let i=0;i<n;i+=1)r|=(e.charCodeAt(i)||0)^(t.charCodeAt(i)||0);return r===0}function Om(e,t){let n=Cm.get(e);n&&(n.superseded=!0),n?.controller.abort();let r={generation:(n?.generation??0)+1,controller:new AbortController,superseded:!1};Cm.set(e,r);let i=()=>r.controller.abort();return t?.aborted?i():t?.addEventListener(`abort`,i,{once:!0}),{active:r,isCurrent:()=>Cm.get(e)===r&&!r.controller.signal.aborted,cleanup:()=>{t?.removeEventListener(`abort`,i),Cm.get(e)===r&&Cm.delete(e)}}}function km(e,t){if(!t())throw new Sm(e.superseded?`superseded`:`cancelled`)}function Am(e,t){let n=e-t;if(n<-6e4)throw new Sm(`expired`);if(n>3e5+xm)throw new Sm(`authorization_rejected`)}function jm(e,t){if(t-e>xm)throw new Sm(`expired`)}function Mm(e,t){let n;try{n=new URL(e)}catch{throw new Sm(`callback_rejected`)}if(n.searchParams.has(`error`)){try{wm(E,{redirectUri:e})}catch{throw new Sm(`callback_rejected`)}let r=n.searchParams.get(`state`)??``,i=n.searchParams.get(`handoff_id`)??``;throw!Dm(r,t.state)||!Dm(i,t.handoffId)?new Sm(`callback_rejected`):new Sm(`cancelled`)}try{wm(de,{redirectUri:e})}catch{throw new Sm(`callback_rejected`)}let r=`${n.protocol}//${n.host}${n.pathname}`,i=n.searchParams.get(`state`)??``,a=n.searchParams.get(`handoff_id`)??``;if(r!==t.callbackUri||!Dm(i,t.state)||!Dm(a,t.handoffId))throw new Sm(`callback_rejected`);return{code:n.searchParams.get(`code`)}}async function Nm(e){let t;try{t=wm(y,e.callbackUri())}catch{throw new Sm(`callback_rejected`)}let n=e.deviceLabel().trim();if(n.length===0||Array.from(n).length>64)throw new Sm(`platform_invalid`);let r=nn(await Em(e)),i=nn(await Em(e)),a=await e.sha256(Tm(i));if(!(a instanceof Uint8Array)||a.byteLength!==32)throw new Sm(`platform_invalid`);let o={callbackUri:t,codeChallenge:nn(a),codeVerifier:i,deviceLabel:n,state:r};try{wm(we,{redirectUri:o.callbackUri,codeChallenge:o.codeChallenge,codeChallengeMethod:`S256`,state:o.state,deviceLabel:o.deviceLabel})}catch{throw new Sm(`platform_invalid`)}return o}async function Pm(e){let{active:t,isCurrent:n,cleanup:r}=Om(e.coordinatorKey??e.origin,e.signal),i=e.now??Date.now;try{km(t,n);let r=await Nm(e.platform);km(t,n);let a=wm(we,{redirectUri:r.callbackUri,codeChallenge:r.codeChallenge,codeChallengeMethod:`S256`,state:r.state,deviceLabel:r.deviceLabel,...e.purpose?{purpose:e.purpose}:{}}),o;try{o=wm(ke,await e.start(a,t.controller.signal))}catch(e){throw n()||km(t,n),e instanceof Sm?e:new Sm(`authorization_rejected`)}let s=i(),c;try{c=new URL(o.authorizationUrl)}catch{throw new Sm(`authorization_rejected`)}if(c.origin!==new URL(e.origin).origin)throw new Sm(`authorization_rejected`);Am(o.expiresAt,s);let l=await e.platform.openSystemBrowser(o.authorizationUrl,r.callbackUri,t.controller.signal);if(km(t,n),l.type!==`success`)throw new Sm(l.type===`locked`?`authorization_rejected`:`cancelled`);jm(o.expiresAt,i());let{code:u}=Mm(l.url,{callbackUri:r.callbackUri,state:r.state,handoffId:o.handoffId});km(t,n);let d;try{d=wm(e.redeemResponseSchema,await e.redeem(wm(e.redeemRequestSchema,e.buildRedeemRequest(wm(Ee,{handoffId:o.handoffId,code:u,codeVerifier:r.codeVerifier}))),t.controller.signal))}catch(e){throw n()||km(t,n),e}return km(t,n),d}finally{r()}}async function Fm(e){return Pm({...e,redeemRequestSchema:Ee,redeemResponseSchema:w,buildRedeemRequest:e=>e})}var Im={accept:`application/json`,"content-type":`application/json`},Lm=4096,Rm=256,zm=256,Bm=100,Vm=/^node_[A-Za-z0-9_-]{22,43}$/,Hm=/^[a-z0-9._-]{1,64}$/,Um=256,Wm=512,Gm=/^[A-Za-z0-9_-]{1,512}$/,Km=/^pkey_[A-Za-z0-9_-]{22}$/,qm=256,Jm=256,Ym=2048,Xm=254,Zm=256,Qm=16,$m=128,eh=/^[A-Za-z0-9_-]{43}$/,th=`otpauth://`,nh=3e4,rh=[`/api/auth/native/bootstrap/registration/`,`/api/auth/native/invitations/registration/`];function ih(e){let t=e.toLowerCase();return rh.some(e=>t.startsWith(e))}var ah=new Set([`set-password`,`remove-password`,`revoke-totp`,`request-email-verification`,`add-passkey`,`regenerate-recovery-codes`,`connect-external-identity`,`disconnect-external-identity`]),oh=new Set([`begin-totp-enrollment`,`confirm-totp-enrollment`]),sh=`step_up_required`,ch=`passkey_session_required`;function lh(e,t,n){let r={code:e,wire:e,inferred:!1};return!n||e!==`forbidden`||t===void 0?r:ah.has(t)?{code:sh,wire:e,inferred:!0}:oh.has(t)?{code:ch,wire:e,inferred:!0}:r}var J=class extends Error{code;status;retryAfterMs;intent;wireCode;inferred;reason;constructor(e,t,n,r,i,a){super(a?dh(a).message:ph(e,r)),this.name=`HostedHubApiError`,this.code=e,this.status=t,this.retryAfterMs=n,this.intent=r,this.wireCode=i??e,this.inferred=i!==void 0&&i!==e,this.reason=a??null}},uh={"missing-signer":{reason:`missing-signer`,title:`Secure session unavailable`,message:`Secure session signing is unavailable on this device. Restart the app, then try again.`,recovery:`restart-app`},"missing-token":{reason:`missing-token`,title:`Sign in again`,message:`This device no longer has its secure Hub session. Sign in again to continue.`,recovery:`sign-in`},"proof-signing-failed":{reason:`proof-signing-failed`,title:`Secure session could not be verified`,message:`This device could not verify its secure Hub session. Unlock the device and try again; if it continues, sign in again.`,recovery:`retry`},"token-invalidated":{reason:`token-invalidated`,title:`Session no longer valid`,message:`Your secure Hub session is no longer valid. Sign in again to continue.`,recovery:`sign-in`},"request-timeout":{reason:`request-timeout`,title:`Hub did not respond`,message:`The Hub did not respond in time. Check your connection and try again.`,recovery:`retry`},"transport-unavailable":{reason:`transport-unavailable`,title:`Hub could not be reached`,message:`Ryco could not reach the Hub. Check your connection and try again.`,recovery:`retry`}};function dh(e){return uh[e]}function fh(e,t){if(e===`conflict`)switch(t){case`set-password`:return`That password has appeared in a known breach. Choose a different one.`;case`revoke-passkey`:return`That is the only passkey left on this account. Add another before removing it.`;case`begin-totp-enrollment`:return`Two-factor authentication is already set up on this account.`;case`confirm-totp-enrollment`:return`This setup is no longer in progress. Start again.`;case`request-email-verification`:return`That email address is already in use.`;case`disconnect-external-identity`:return`GitHub is the only sign-in method on this account. Add another before disconnecting it.`;default:return null}return e===`authentication_failed`&&t===`confirm-totp-enrollment`||e===`authentication_failed`&&(t===`connect-external-identity`||t===`disconnect-external-identity`)?`That code is not correct. Check your authenticator app and try again.`:e===`not_found`&&t===`revoke-passkey`?`That passkey is no longer on this account.`:null}function ph(e,t){let n=t===void 0?null:fh(e,t);if(n!==null)return n;switch(e){case sh:return`Enter a current code from your authenticator app to confirm this change.`;case ch:return`Sign in with a passkey on this device to change two-factor settings.`;case`invalid_credential_id`:return`That passkey could not be identified.`;case`external_provider_unavailable`:return`GitHub sign-in is temporarily unavailable.`;case`external_authorization_cancelled`:return`GitHub authorization was cancelled.`;case`external_authorization_expired`:return`GitHub authorization expired. Try again.`;case`external_authorization_rejected`:return`GitHub could not authorize this request.`;case`external_identity_already_linked`:return`That GitHub account is already connected.`;case`external_identity_email_conflict`:return`Sign in another way, then connect GitHub from account settings.`;case`external_identity_verified_email_required`:return`GitHub must have a verified primary email to create an account.`;case`signup_disabled`:return`New account signup is currently closed.`;case`username_unavailable`:return`That username is unavailable.`;case`last_primary_credential`:return`Add another sign-in method before disconnecting GitHub.`;case`native_authorization_unavailable`:return`Secure browser authorization is unavailable on this device.`;case`timeout`:return`The request took too long. Check your connection and try again.`;case`authentication_failed`:return`The passkey could not be verified.`;case`registration_unavailable`:return`The invitation or registration challenge is unavailable or expired.`;case`session_invalid`:case`unauthorized`:return`Your Hub session has expired.`;case`csrf_rejected`:return`The request could not be verified. Refresh and try again.`;case`forbidden`:case`authorization_failed`:return`You are not authorized to perform this action.`;case`not_found`:return`The requested item is no longer available.`;case`conflict`:case`ticket_consumed`:return`The request has already been used.`;case`rate_limited`:case`node_rate_limited`:return`Too many attempts. Wait briefly and try again.`;case`enrollment_unavailable`:return`The node enrollment is unavailable or expired.`;case`node_offline`:return`The selected node is offline.`;case`server_draining`:return`Hub is temporarily draining relay connections.`;case`unsupported_version`:return`The selected node or Hub uses an incompatible relay version.`;case`invalid_request`:return`The response was malformed or expired.`;case`browser_only_transport`:return`This action is only available in a browser.`;case`native_only_transport`:return`This action is only available in the native app.`;default:return`Hub is temporarily unavailable.`}}function mh(e){if(typeof e!=`object`||!e||Array.isArray(e))throw new J(`invalid_response`,502);return e}function Y(e,t,n){try{return Lt(e)(t,{onExcessProperty:`error`})}catch{throw new J(n,n===`invalid_request`?400:502)}}function hh(e){if(typeof e!=`string`)throw new J(`invalid_response`,502);try{return Lu(e)}catch{throw new J(`invalid_response`,502)}}function gh(e){return e===null||typeof e==`number`&&Number.isSafeInteger(e)}function _h(e){return e===`viewer`||e===`operator`||e===`owner`}function vh(e){return e===`darwin`||e===`linux`||e===`windows`||e===`unknown`}function yh(e){return e===`arm64`||e===`x64`||e===`other`}function bh(e){return typeof e==`string`&&e.length>0&&e.length<=Lm?e:null}function xh(e){return!Array.isArray(e)||e.some(e=>typeof e!=`string`)?null:e}function Sh(e){let t=xh(e);return!t||t.length===0||t.length>Um||t.some(e=>e.length===0||e.length>Wm)?null:t}function Ch(e){if(typeof e!=`object`||!e||Array.isArray(e))return null;let t=e;return typeof t.id!=`string`||!Gm.test(t.id)?null:{id:t.id,label:typeof t.label==`string`&&t.label.length<=Rm?t.label:null,createdAt:gh(t.createdAt)?t.createdAt:null,lastUsedAt:gh(t.lastUsedAt)?t.lastUsedAt:null,backupEligible:typeof t.backupEligible==`boolean`?t.backupEligible:null,backupState:typeof t.backupState==`boolean`?t.backupState:null,revokedAt:gh(t.revokedAt)?t.revokedAt:null,revocationReasonCode:typeof t.revocationReasonCode==`string`&&t.revocationReasonCode.length>0&&t.revocationReasonCode.length<=qm?t.revocationReasonCode:null}}function wh(e){try{return Lt(qe)(e,{onExcessProperty:`error`})}catch{return null}}function Th(e){let t=e?.totpCode;return typeof t==`string`&&t.trim().length>0?{totpCode:t}:{}}function Eh(e,t){if(typeof e!=`string`||e.length===0||e.length>t)throw new J(`invalid_request`,400);return e}function Dh(e){return e==null||e===``?{}:{totpCode:Eh(e,Qm)}}function Oh(e){let t=Eh(e,64);if(!eh.test(t))throw new J(`invalid_request`,400);return t}function kh(e){return typeof e==`string`&&e.length>0&&e.length<=Jm?e:null}function Ah(e){return typeof e==`string`&&e.length<=Ym&&e.toLowerCase().startsWith(th)?e:null}var jh=/^[a-z][a-z0-9_]{0,63}$/;function Mh(e){return typeof e==`string`&&jh.test(e)?e:`unavailable`}async function Nh(e,t,n){let r;try{r=await e.json()}catch{throw new J(`invalid_response`,e.status,void 0,t)}let i=mh(r);if(!e.ok){let r=typeof i.retryAfterMs==`number`&&Number.isSafeInteger(i.retryAfterMs)&&i.retryAfterMs>=0&&i.retryAfterMs<=3e5?i.retryAfterMs:void 0,a=lh(Mh(i.error),t,n);throw new J(a.code,e.status,r,t,a.wire)}return i}var Ph=class{#e;#t;#n;#r;#i;#a;#o=null;constructor(e){if(this.#e=e.endpoint,this.#t=e.httpClient,this.#n=e.passkeyCeremony,this.#r=e.sessionCredentials,this.#i=e.dpopSigner,this.#a=e.nativeAuthorization,this.#r.mode===`bearer`){if(!this.#i)throw new J(`native_session_unavailable`,0,void 0,void 0,void 0,`missing-signer`);if(!this.#r.readBearerToken||!this.#r.writeBearerToken)throw new J(`native_session_unavailable`,0,void 0,void 0,void 0,`missing-token`)}}get#s(){return this.#r.mode===`bearer`}#c(){return this.#r.readBearerToken?.()??null}#l(e){this.#r.writeBearerToken?.(e)}get hasSessionMaterial(){return this.#s?this.#c()!==null:this.#r.readCsrfToken()!==null}clearSessionMaterial(){this.#o=null,this.#s?this.#l(null):this.#r.writeCsrfToken(null)}async getBootstrapAvailability(e){let t=await this.#E(`/api/auth/bootstrap-status`,{dpop:`mint`,...e?{signal:e}:{}});if(Object.keys(t).length!==1||typeof t.available!=`boolean`)throw new J(`invalid_response`,502);return t.available}async getPublicSignupConfiguration(e){return this.#m(),Y(l,await this.#E(Ke,e?{signal:e}:{}),`invalid_response`)}async getExternalIdentityConfiguration(e){return Y(xt,await this.#E(je,{...this.#s?{dpop:`mint`}:{},...e?{signal:e}:{}}),`invalid_response`)}async startExternalIdentityAuthorization(e,n){this.#m();let r=Y(Xe,e,`invalid_request`);return Y(Pt,await this.#E(t,{method:`POST`,body:r,...r.intent===`link`?{csrf:!0,intent:`connect-external-identity`}:{},...n?{signal:n}:{}}),`invalid_response`)}async getPendingExternalIdentity(e){return this.#m(),Y(ze,await this.#E(Fe,e?{signal:e}:{}),`invalid_response`)}async finishExternalIdentitySignup(e,t){this.#m();let n=Y(Mt,e,`invalid_request`),r=Y(Ge,await this.#E(me,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`);return this.#r.writeCsrfToken(r.identity.csrfToken),r}async restoreSession(e){let t=await this.#E(`/api/auth/session`,e?{signal:e}:{});if(this.#s)return this.#b(t);let n=this.#w(t);return this.#r.writeCsrfToken(n.csrfToken),n}async signIn(e){if(this.#s&&this.#a){let t=await Fm({origin:this.#e.origin(),platform:this.#a,...e?{signal:e}:{},start:(e,t)=>this.#u(e,t),redeem:(e,t)=>this.#d(e,t)}),n=this.#C(t);return this.#l(t.token),n}let t=this.#s?`/api/auth/native/passkey`:`/api/auth/passkey`,n=await this.#E(`${t}/options`,{method:`POST`,body:{},dpop:`mint`,...e?{signal:e}:{}}),r=await this.#n.authenticate(gm(n.options),e);return this.#y(await this.#E(`${t}/verify`,{method:`POST`,body:{response:r},dpop:`mint`,...e?{signal:e}:{}}))}async signInWithExternalProvider(e,t){this.#h();let n=Y(Ct,e,`invalid_request`),r=this.#a;if(!r)throw new J(`native_authorization_unavailable`,400);let i=await Pm({origin:this.#e.origin(),platform:r,purpose:{kind:`sign_in`,providerHint:n},redeemRequestSchema:Ee,redeemResponseSchema:w,buildRedeemRequest:e=>e,...t?{signal:t}:{},start:(e,t)=>this.#u(e,t),redeem:(e,t)=>this.#d(e,t)}),a=this.#C(i);return this.#l(i.token),a}async connectExternalIdentity(e,t,n){this.#h();let r=Y(Ct,e,`invalid_request`),i=this.#a;if(!i)throw new J(`native_authorization_unavailable`,400);let a=this.#o;if(a&&a.expiresAt<Date.now())this.#o=null;else if(a?.provider===r){let e=Y(P,{...a.request,...Th(t)},`invalid_request`);try{let t=await this.#f(e,n);return this.#o=null,t.externalIdentity}catch(e){throw this.#p(e)||(this.#o=null),e}}let o=null;try{return(await Pm({origin:this.#e.origin(),coordinatorKey:`${this.#e.origin()}:connect:${r}`,platform:i,purpose:{kind:`connect_external_identity`,provider:r},redeemRequestSchema:P,redeemResponseSchema:ge,buildRedeemRequest:e=>({...e,purpose:{kind:`connect_external_identity`,provider:r},...Th(t)}),...n?{signal:n}:{},start:(e,t)=>this.#u(e,t),redeem:(e,t)=>(o=e,this.#f(e,t))})).externalIdentity}catch(e){throw o&&this.#p(e)&&(this.#o={provider:r,request:o,expiresAt:Date.now()+ht}),e}}cancelExternalIdentityConnection(e){let t=Y(Ct,e,`invalid_request`);this.#o?.provider===t&&(this.#o=null)}async signInWithNativePasskey(e){this.#h();let t=`/api/auth/native/passkey`,n=await this.#E(`${t}/options`,{method:`POST`,body:{},dpop:`mint`,...e?{signal:e}:{}}),r=await this.#n.authenticate(gm(n.options),e),i=await this.#E(`${t}/verify`,{method:`POST`,body:{response:r},dpop:`mint`,...e?{signal:e}:{}}),a=this.#T(i);return{session:a.response,token:a.token}}async startPublicSignup(e,t){this.#m();let n=Y(mt,e,`invalid_request`);return Y(r,await this.#E(et,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async verifyPublicSignup(e,t){this.#m();let n=Y(dt,e,`invalid_request`);return Y(ne,await this.#E(Et,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async finishPublicSignupWithPasskey(e,t){this.#m();let n=Y(xe,{...e,response:{}},`invalid_request`),r=Y(h,{attemptId:n.attemptId,activationSecret:n.activationSecret},`invalid_request`),i=Y(f,await this.#E(Bt,{method:`POST`,body:r,...t?{signal:t}:{}}),`invalid_response`),a=await this.#n.register(_m(i.options),t),o=Y(xe,{...n,response:a},`invalid_request`),s=Y(Gt,await this.#E(_t,{method:`POST`,body:o,...t?{signal:t}:{}}),`invalid_response`);return this.#r.writeCsrfToken(s.identity.csrfToken),s}async finishPublicSignupWithPassword(e,t){this.#m();let n=Y(se,e,`invalid_request`),r=Y(Gt,await this.#E(Je,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`);return this.#r.writeCsrfToken(r.identity.csrfToken),r}async startPasswordLogin(e,t){this.#m();let n=Y(ot,e,`invalid_request`);return Y(rt,await this.#E(lt,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async finishPasswordLogin(e,t){this.#m();let n=Y(yt,e,`invalid_request`),r=Y($e,await this.#E(jt,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`);return this.#r.writeCsrfToken(r.csrfToken),r}async requestPasswordReset(e,t){this.#m();let n=Y(Zt,e,`invalid_request`);return Y(He,await this.#E(wt,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async verifyPasswordReset(e,t){this.#m();let n=Y(Jt,e,`invalid_request`);return Y(ve,await this.#E(Nt,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async finishPasswordReset(e,t){this.#m();let n=Y(Le,e,`invalid_request`),r=Y(Ht,await this.#E(Be,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`);return this.clearSessionMaterial(),r}async startNativeIdentityEmail(e,t){return this.#g(vt,n,ut,e,t)}async verifyNativeIdentityEmail(e,t){return this.#g(at,te,ie,e,t)}async claimNativeIdentityUsername(e,t){return this.#g(be,Pe,fe,e,t)}async finishNativeIdentitySignupWithPasskey(e,t){this.#h();let n=Y(Ot,{...e,response:{}},`invalid_request`),r=Y(D,{attemptId:n.attemptId,activationSecret:n.activationSecret},`invalid_request`),i=await this.#g(c,D,Me,r,t),a=await this.#n.register(_m(i.options),t);return this.#g(_e,Ot,A,{...n,response:a},t)}async finishNativeIdentitySignupWithPassword(e,t){return this.#g(Wt,Ae,A,e,t)}async startNativeIdentityPasswordLogin(e,t){return this.#g(Ve,Te,S,e,t)}async finishNativeIdentityPasswordLogin(e,t){return this.#g(nt,le,b,e,t)}async signInNativeIdentityWithRecoveryCode(e,t){return this.#g(qt,Ce,De,e,t)}async requestNativeIdentityPasswordReset(e,t){return this.#g(Vt,N,he,e,t)}async verifyNativeIdentityPasswordReset(e,t){return this.#g(Xt,$t,o,e,t)}async finishNativeIdentityPasswordReset(e,t){return this.#g(Ie,v,T,e,t)}async cancelNativeIdentityAttempt(e,t){return this.#g(Tt,oe,pt,e,t)}async switchActiveSpace(e,t){let n=Y(M,e,`invalid_request`);return Y(kt,await this.#E(x,{method:`POST`,body:n,csrf:!0,dpop:`session`,...t?{signal:t}:{}}),`invalid_response`)}async startNativeNodeClaim(e,t){this.#h();let n=Y(Ft,e,`invalid_request`);return Y(St,await this.#E(d,{method:`POST`,body:n,dpop:`session`,...t?{signal:t}:{}}),`invalid_response`)}async finishNativeNodeClaim(t,n){this.#h();let r=Y(e,t,`invalid_request`);return Y(Ze,await this.#E(m,{method:`POST`,body:r,dpop:`session`,...n?{signal:n}:{}}),`invalid_response`)}async signInWithPassword(e,t){return this.#m(),this.#y(await this.#E(`/api/auth/password`,{method:`POST`,body:{email:Eh(e.email,Xm),password:Eh(e.password,Zm),...Dh(e.totpCode)},...t?{signal:t}:{}}))}async signInWithRecoveryCode(e,t){return this.#m(),this.#y(await this.#E(`/api/auth/recovery`,{method:`POST`,body:{code:Eh(e,$m)},...t?{signal:t}:{}}))}async requestEmailRecovery(e,t){this.#m();let n=await this.#E(`/api/auth/recovery/email/request`,{method:`POST`,body:{email:Eh(e,Xm)},...t?{signal:t}:{}});if(Object.keys(n).length!==1||n.ok!==!0)throw new J(`invalid_response`,502)}async confirmEmailRecovery(e,t){return this.#m(),this.#y(await this.#E(`/api/auth/recovery/email/confirm`,{method:`POST`,body:{token:Oh(e.token),...Dh(e.totpCode)},...t?{signal:t}:{}}))}async confirmEmailVerification(e,t){this.#m();let n=await this.#E(`/api/auth/email/verify`,{method:`POST`,body:{token:Oh(e)},...t?{signal:t}:{}});if(Object.keys(n).length!==1||n.ok!==!0)throw new J(`invalid_response`,502)}async startNativeHandoff(e,t){return this.#u(e,t)}async#u(e,t){if(!this.#s)throw new J(`browser_only_transport`,400);let n=Y(we,e,`invalid_request`),r=n.purpose?.kind===`connect_external_identity`;return Y(ke,await this.#E(re,{method:`POST`,body:n,dpop:r?`session`:`mint`,...r?{intent:`connect-external-identity`}:{},...t?{signal:t}:{}}),`invalid_response`)}async redeemNativeHandoff(e,t){let n=await this.#d(e,t),r=this.#C(n);return this.#l(n.token),r}async#d(e,t){if(!this.#s)throw new J(`browser_only_transport`,400);let n=Y(Ee,e,`invalid_request`);return Y(w,await this.#E(ft,{method:`POST`,body:n,dpop:`mint`,...t?{signal:t}:{}}),`invalid_response`)}async#f(e,t){this.#h();let n=Y(P,e,`invalid_request`);return Y(ge,await this.#E(ft,{method:`POST`,body:n,dpop:`session`,intent:`connect-external-identity`,...t?{signal:t}:{}}),`invalid_response`)}#p(e){return e instanceof J&&(e.code===`step_up_required`||e.code===`authentication_failed`||e.code===`forbidden`)}async getNativeHandoffPresentation(e,t){this.#m();let n=Y(en,e,`invalid_request`);return Y(s,await this.#E(`${i}${n}`,t?{signal:t}:{}),`invalid_response`)}async approveNativeHandoff(e,t){this.#m();let n=Y(en,e,`invalid_request`);return Y(de,await this.#E(`${i}${n}${p}`,{method:`POST`,body:{},csrf:!0,...t?{signal:t}:{}}),`invalid_response`)}async cancelNativeHandoff(e,t){this.#m();let n=Y(en,e,`invalid_request`);return Y(E,await this.#E(`${i}${n}${ce}`,{method:`POST`,body:{},csrf:!0,...t?{signal:t}:{}}),`invalid_response`)}#m(){if(this.#s)throw new J(`browser_only_transport`,400)}#h(){if(!this.#s)throw new J(`native_only_transport`,400)}async#g(e,t,n,r,i){this.#h();let a=Y(t,r,`invalid_request`);return Y(n,await this.#E(e,{method:`POST`,body:a,dpop:`mint`,...i?{signal:i}:{}}),`invalid_response`)}async redeemInvitation(e,t){let n=this.#s?`/api/auth/native/invitations/registration`:`/api/auth/invitations/registration`;return this.#v(`${n}/options`,`${n}/verify`,e,{authenticated:!1,...t?{signal:t}:{},finish:e=>this.#y(e)})}async bootstrapOwner(e,t){let n=this.#s?`/api/auth/native/bootstrap/registration`:`/api/auth/bootstrap/registration`;return this.#v(`${n}/options`,`${n}/verify`,e,{authenticated:!1,...t?{signal:t}:{},finish:e=>this.#y(e)})}async listPasskeys(e){let t=await this.#E(`/api/account/passkeys`,e?{signal:e}:{});if(!Array.isArray(t.passkeys)||t.passkeys.length>zm)throw new J(`invalid_response`,502);return t.passkeys.map(e=>{let t=Ch(e);if(!t)throw new J(`invalid_response`,502);return t})}async getAccountSecurity(e){let t=wh(await this.#E(`/api/account/security`,e?{signal:e}:{}));if(!t)throw new J(`invalid_response`,502);return t}async finishBrowserExternalIdentityConnection(e,t,n){this.#m(),Y(Ct,e,`invalid_request`);let r=Y(k,Th(t),`invalid_request`);return Y(Ne,await this.#E(gt,{method:`POST`,body:r,csrf:!0,intent:`connect-external-identity`,...n?{signal:n}:{}}),`invalid_response`)}async disconnectExternalIdentity(e,t,n){Y(Ct,e,`invalid_request`);let r=Y(At,Th(t),`invalid_request`),i=Y(ct,await this.#E(zt,{method:`POST`,body:r,csrf:!0,intent:`disconnect-external-identity`,...n?{signal:n}:{}}),`invalid_response`);return i.signedOut&&this.clearSessionMaterial(),i}async addPasskey(e,t){let n=typeof e.passkeyLabel==`string`?e.passkeyLabel.trim():null;return this.#v(`/api/account/passkeys/registration/options`,`/api/account/passkeys/registration/verify`,{label:n===null||n.length===0?null:n},{authenticated:!0,intent:`add-passkey`,verifyExtra:Th(e),...t?{signal:t}:{},finish:e=>this.#S(e)})}async regenerateRecoveryCodes(e,t){let n=await this.#E(`/api/account/recovery-codes`,{method:`POST`,body:Th(e),csrf:!0,intent:`regenerate-recovery-codes`,...t?{signal:t}:{}}),r=Sh(n.recoveryCodes);if(!r)throw new J(`invalid_response`,502);return this.#x(n),r}async setPassword(e,t){await this.#_(`/api/account/password`,{password:e.password,...Th(e)},t,`set-password`)}async removePassword(e,t){await this.#_(`/api/account/password/remove`,Th(e),t,`remove-password`)}async beginTotpEnrollment(e){let t=await this.#E(`/api/account/totp/enrollment/options`,{method:`POST`,body:{},csrf:!0,intent:`begin-totp-enrollment`,...e?{signal:e}:{}}),n=kh(t.secretBase32),r=Ah(t.provisioningUri);if(!n||!r)throw new J(`invalid_response`,502);return{secretBase32:n,provisioningUri:r}}async confirmTotpEnrollment(e,t){await this.#_(`/api/account/totp/enrollment/verify`,{code:e.code},t,`confirm-totp-enrollment`)}async revokeTotp(e,t){await this.#_(`/api/account/totp/revoke`,Th(e),t,`revoke-totp`)}async requestEmailVerification(e,t){await this.#_(`/api/account/email/verification`,{email:e.email,...Th(e)},t,`request-email-verification`)}async revokePasskey(e,t){if(!Km.test(e))throw new J(`invalid_credential_id`,400);await this.#_(`/api/account/passkeys/${e}/revoke`,{},t,`revoke-passkey`)}async#_(e,t,n,r){let i=await this.#E(e,{method:`POST`,body:t,csrf:!0,intent:r,...n?{signal:n}:{}});if(Object.keys(i).length!==1||i.ok!==!0)throw new J(`invalid_response`,502,void 0,r)}async#v(e,t,n,r){let i={csrf:r.authenticated,...r.authenticated?{}:{dpop:`mint`},...r.intent?{intent:r.intent}:{},...r.signal?{signal:r.signal}:{}},a=await this.#E(e,{method:`POST`,body:n,...i,narrowForbidden:!1}),o=await this.#n.register(_m(a.options),r.signal);return r.finish(await this.#E(t,{method:`POST`,body:{response:o,...r.verifyExtra},...i}))}#y(e){if(this.#s){let{response:t,token:n}=this.#T(e);return this.#l(n),t}let t=this.#w(e);return this.#r.writeCsrfToken(t.csrfToken),t}#b(e){let t=this.#C(e),n=bh(e.token);return n&&this.#l(n),t}#x(e){if(this.#s){let{token:t}=this.#T(e);this.#l(t);return}this.#r.writeCsrfToken(this.#w(e).csrfToken)}#S(e){this.#x(e);let t=Ch(e.passkey);return{passkey:t,confirmed:t!==null}}async signOut(e){await this.#E(`/api/auth/logout`,{method:`POST`,body:{},csrf:!0,...e?{signal:e}:{}}),this.clearSessionMaterial()}async listNodes(e){let t=await this.#E(`/api/nodes`,e?{signal:e}:{});if(!Array.isArray(t.nodes))throw new J(`invalid_response`,502);return t.nodes.map(e=>{let t=mh(e),n=mh(t.grant),r=mh(t.presence),i=t.capabilities===void 0?null:mh(t.capabilities),a=Y(O,t.id,`invalid_response`);if(typeof t.environmentId!=`string`||typeof t.label!=`string`||!vh(t.platformOs)||!yh(t.platformArch)||typeof t.clientVersion!=`string`||!gh(t.createdAt)||t.createdAt===null||!gh(t.updatedAt)||t.updatedAt===null||!gh(t.lastAuthenticatedAt)||!gh(t.revokedAt)||t.revocationReasonCode!==null&&typeof t.revocationReasonCode!=`string`||typeof n.id!=`string`||!_h(n.role)||!_h(t.effectiveRole)||typeof r.online!=`boolean`||!gh(r.lastHeartbeatAt)||i!==null&&(typeof i.repositoryIdentity!=`boolean`||typeof i.nativeClientRequired!=`boolean`||i.threadSettlement!==void 0&&typeof i.threadSettlement!=`boolean`))throw new J(`invalid_response`,502);let o={id:a,environmentId:pe.make(t.environmentId),label:t.label,platformOs:t.platformOs,platformArch:t.platformArch,clientVersion:t.clientVersion,createdAt:t.createdAt,updatedAt:t.updatedAt,lastAuthenticatedAt:t.lastAuthenticatedAt,revokedAt:t.revokedAt,revocationReasonCode:t.revocationReasonCode,grant:{id:n.id,role:n.role},effectiveRole:t.effectiveRole,presence:{online:r.online,lastHeartbeatAt:r.lastHeartbeatAt}};return i?Object.assign(o,{capabilities:{repositoryIdentity:i.repositoryIdentity,nativeClientRequired:i.nativeClientRequired,...typeof i.threadSettlement==`boolean`?{threadSettlement:i.threadSettlement}:{}}}):o})}async renameNode(e,t,n){let r=t.trim();if(!Vm.test(e)||r.length===0||r.length>Bm)throw new J(`invalid_request`,400);let i=await this.#E(`/api/admin/nodes/${encodeURIComponent(e)}/rename`,{method:`POST`,body:{label:r},csrf:!0,...n?{signal:n}:{}});if(Object.keys(i).length!==1||i.ok!==!0)throw new J(`invalid_response`,502)}async revokeNode(e,t,n){if(!Vm.test(e)||!Hm.test(t))throw new J(`invalid_request`,400);let r=await this.#E(`/api/admin/nodes/${encodeURIComponent(e)}/revoke`,{method:`POST`,body:{reasonCode:t},csrf:!0,...n?{signal:n}:{}});if(Object.keys(r).length!==1||r.ok!==!0)throw new J(`invalid_response`,502)}async lookupNodeEnrollment(e,t){let n=mh((await this.#E(`/api/admin/node-enrollments/lookup`,{method:`POST`,body:{deviceCode:e},csrf:!0,...t?{signal:t}:{}})).enrollment);if(typeof n.id!=`string`||!/^enr_[A-Za-z0-9_-]{22}$/.test(n.id)||typeof n.label!=`string`||n.label.length<1||n.label.length>100||!vh(n.platformOs)||!yh(n.platformArch)||typeof n.clientVersion!=`string`||n.clientVersion.length<1||n.clientVersion.length>64||n.algorithm!==`ed25519`||typeof n.fingerprint!=`string`||!/^SHA256:[A-Za-z0-9_-]{43}$/.test(n.fingerprint)||!Number.isSafeInteger(n.createdAt)||!Number.isSafeInteger(n.expiresAt)||Number(n.expiresAt)<=Number(n.createdAt))throw new J(`invalid_response`,502);return{id:n.id,label:n.label,platformOs:n.platformOs,platformArch:n.platformArch,clientVersion:n.clientVersion,algorithm:n.algorithm,fingerprint:n.fingerprint,createdAt:n.createdAt,expiresAt:n.expiresAt}}async approveNodeEnrollment(e,t){let n=await this.#E(`/api/admin/node-enrollments/approve`,{method:`POST`,body:{deviceCode:e},csrf:!0,...t?{signal:t}:{}}),r=mh(n.node),i=mh(n.grant);if(typeof r.id!=`string`||!Vm.test(r.id)||typeof r.environmentId!=`string`||!/^env_[A-Za-z0-9_-]{22}$/.test(r.environmentId)||typeof i.id!=`string`||!/^grant_[A-Za-z0-9_-]{22}$/.test(i.id)||i.role!==`owner`)throw new J(`invalid_response`,502)}async denyNodeEnrollment(e,t){let n=await this.#E(`/api/admin/node-enrollments/deny`,{method:`POST`,body:{deviceCode:e},csrf:!0,...t?{signal:t}:{}});if(Object.keys(n).length!==1||n.ok!==!0)throw new J(`invalid_response`,502)}async issueRelayTicket(e,t){let n=Y(O,e,`invalid_request`),r=await this.#E(`/api/relay/tickets`,{method:`POST`,body:{nodeId:n,capability:`ryco.rpc`,protocolMajor:1,protocolMinor:2},csrf:!0,...t?{signal:t}:{}});if(Object.keys(r).length!==4||typeof r.ticket!=`string`||!Number.isSafeInteger(r.expiresAt)||r.protocolMajor!==1||r.protocolMinor!==2)throw new J(`invalid_response`,502);return{ticket:r.ticket,expiresAt:r.expiresAt,protocolMajor:1,protocolMinor:2}}async upsertE2eeDeviceEnrollment(e,t){this.#h();let n=Y(Se,e,`invalid_request`);if(n.hubOrigin!==this.#e.origin())throw new J(`invalid_request`,400);return Y(g,await this.#E(Yt,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`).enrollment}async getE2eeGrantVerificationKeys(e){return this.#h(),Y(Qt,await this.#E(ye,e?{signal:e}:{}),`invalid_response`)}async issueAccountGrantRelayTicket(e,t){this.#h();let n=Y(u,e,`invalid_request`);return Y(Kt,await this.#E(Ue,{method:`POST`,body:n,...t?{signal:t}:{}}),`invalid_response`)}async listE2eeDevices(e){return Y(Dt,await this.#E(Ye,e?{signal:e}:{}),`invalid_response`).devices}async renameE2eeDevice(e,t,n){let r=Y(ue,e,`invalid_request`),i=Y(st,t,`invalid_request`);return Y(bt,await this.#E(`${tt}/${encodeURIComponent(r)}/rename`,{method:`POST`,body:i,csrf:!0,...n?{signal:n}:{}}),`invalid_response`).enrollment}async revokeE2eeDevice(e,t,n){let r=Y(ue,e,`invalid_request`),i=Y(it,t,`invalid_request`);return Y(bt,await this.#E(`${tt}/${encodeURIComponent(r)}/revoke`,{method:`POST`,body:i,csrf:!0,...n?{signal:n}:{}}),`invalid_response`).enrollment}#C(e){let t=mh(e.account),n=mh(e.session),r=hh(t.id),i=hh(n.accountId),a=e.recoveryCodes===void 0?void 0:xh(e.recoveryCodes);if(typeof t.displayName!=`string`||!_h(t.role)||!Number.isSafeInteger(t.createdAt)||!gh(t.disabledAt)||typeof n.id!=`string`||!Number.isSafeInteger(n.createdAt)||!Number.isSafeInteger(n.expiresAt)||!Number.isSafeInteger(n.lastSeenAt)||!gh(n.revokedAt)||n.revocationReasonCode!==null&&typeof n.revocationReasonCode!=`string`||a===null)throw new J(`invalid_response`,502);if(t.disabledAt!==null||n.revokedAt!==null||i!==r)throw new J(`session_invalid`,401);return{account:{id:r,displayName:t.displayName,role:t.role,createdAt:t.createdAt,disabledAt:t.disabledAt},session:{id:n.id,accountId:i,createdAt:n.createdAt,expiresAt:n.expiresAt,lastSeenAt:n.lastSeenAt,revokedAt:n.revokedAt,revocationReasonCode:n.revocationReasonCode},...a===void 0?{}:{recoveryCodes:a}}}#w(e){if(typeof e.csrfToken!=`string`||e.csrfToken.length===0)throw new J(`invalid_response`,502);return{...this.#C(e),csrfToken:e.csrfToken}}#T(e){let t=bh(e.token);if(!t)throw new J(`invalid_response`,502);return{response:this.#C(e),token:t}}async#E(e,t){let n=new URL(e,this.#e.origin());if(n.origin!==this.#e.origin()||n.search||n.hash||n.pathname.includes(`%`))throw new J(`invalid_request`,400,void 0,t.intent);if(this.#s&&ih(n.pathname))throw new J(`browser_only_transport`,400,void 0,t.intent);let r=t.method??`GET`,i={...Im},a,o;if(this.#s){let e=this.#i;if(!e)throw new J(`native_session_unavailable`,0,void 0,t.intent,void 0,`missing-signer`);let s=n.toString(),c;if(t.dpop!==`mint`&&(c=this.#c()??void 0,!c))throw new J(`session_invalid`,401,void 0,t.intent,void 0,`missing-token`);try{i.DPoP=await e.sign({method:r,url:s,...c?{token:c}:{}})}catch{throw new J(`native_session_unavailable`,0,void 0,t.intent,void 0,`proof-signing-failed`)}c&&(i.Authorization=`DPoP ${c}`),a=s,o=`omit`}else{if(t.csrf){let e=this.#r.readCsrfToken();if(!e)throw new J(`session_invalid`,401,void 0,t.intent);i[`X-Ryco-CSRF`]=e}a=n.pathname,o=`same-origin`}let s=new AbortController,c=!1,l=setTimeout(()=>{c=!0,s.abort()},nh),u=t.signal,d=()=>s.abort();u?.aborted?s.abort():u?.addEventListener(`abort`,d);let f;try{f=await this.#t.fetch(a,{method:r,credentials:o,cache:`no-store`,headers:i,...t.body===void 0?{}:{body:JSON.stringify(t.body)},signal:s.signal})}catch(e){throw c?new J(`timeout`,0,void 0,t.intent,void 0,`request-timeout`):typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`?e:new J(`unavailable`,0,void 0,t.intent,void 0,`transport-unavailable`)}finally{clearTimeout(l),u?.removeEventListener(`abort`,d)}try{return await Nh(f,t.intent,t.narrowForbidden!==!1)}catch(e){throw this.#s&&t.dpop!==`mint`&&e instanceof J&&e.code===`session_invalid`?new J(e.code,e.status,e.retryAfterMs,e.intent,e.wireCode,`token-invalidated`):e}}},Fh=null,Ih=null,Lh=null;function Rh(e){Lh=e}function zh(){if(Fh||!Lh)return;let e=Lh;Lh=null,e()}function Bh(e,t){Lh=null,Fh=e,Ih=t??new Ph(e)}function Vh(){if(zh(),!Fh)throw Error(`Hosted runtime has not been configured.`);return Fh}function X(){if(zh(),!Ih)throw Error(`Hosted runtime has not been configured.`);return Ih}function Hh(e){return{environmentId:e.environmentId,label:e.label,platform:{os:e.platformOs,arch:e.platformArch},serverVersion:e.clientVersion,capabilities:{repositoryIdentity:!1,threadSettlement:!1,threadPriorityRanking:!1}}}function Uh(e){Vh().nodeLifecycle.clearNodeScopedState(e)}var Wh=null,Gh=!1,Kh=Promise.resolve();function qh(e){let t=Kh.catch(()=>void 0).then(e);return Kh=t.catch(()=>void 0),t}async function Jh(e){let t=Vh().nodeLifecycle;Vh().resetRelayAttemptFactory(),await t.disconnectPrimaryEnvironment(),Uh(e),t.writePrimaryEnvironmentDescriptor(null),Wh===e&&(Wh=null),Gh=!1}async function Yh(e){await qh(async()=>{await Jh(Wh??e)})}async function Xh(e){await qh(async()=>{(Wh??e)!==e||Gh||(Gh=!0,Vh().resetRelayAttemptFactory(),await Vh().nodeLifecycle.disconnectPrimaryEnvironment())})}async function Zh(e,t,n){await qh(async()=>{if(n?.aborted)return;let r=Wh??t;if(r===e.environmentId){if(Gh||(Vh().resetRelayAttemptFactory(),await Vh().nodeLifecycle.disconnectPrimaryEnvironment()),n?.aborted)return}else if(r&&(await Jh(r),n?.aborted))return;let i=Vh().nodeLifecycle;i.writePrimaryEnvironmentDescriptor(Hh(e)),i.setActiveEnvironmentId(e.environmentId),Wh=e.environmentId,Gh=!1,i.connectPrimaryEnvironment()})}var Qh={bootstrapAvailable:!1,accountStatus:`signed-out`,account:null,session:null,directoryStatus:`idle`,nodes:[],selectedNode:null,selectionStatus:`none`,effectiveRole:null,transportStatus:`idle`,sessionStatus:`closed`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,browserStatus:`current`,recoveryCodes:[],totpEnrollment:null,errorMessage:null,errorReason:null,generation:0},$h={externalIdentityConfiguration:null,externalIdentityConfigurationStatus:`idle`,passkeys:[],passkeysStatus:`idle`,e2eeDevices:[],e2eeDevicesStatus:`idle`,security:null,securityStatus:`idle`,actionStatus:`idle`,errorMessage:null,errorCode:null,errorCodeInferred:!1};function eg(e){let t=e,n=new Set,r=()=>n.forEach(e=>e());return{getState:()=>t,getInitialState:()=>e,setState:(e,n=!1)=>{t=n?e:{...t,...e},r()},subscribe:e=>(n.add(e),()=>n.delete(e))}}var Z=eg(Qh),tg=eg($h),ng=eg({leased:!1});function Q(e){let t=Object.prototype.hasOwnProperty.call(e,`errorMessage`)&&!Object.prototype.hasOwnProperty.call(e,`errorReason`);Z.setState(t?{...e,errorReason:null}:e)}function $(e){tg.setState(e)}function rg(e){return e instanceof J?e.message:e instanceof Sm?e.code===`cancelled`||e.code===`superseded`?``:e.message:typeof e==`object`&&e&&`name`in e&&e.name===`NotAllowedError`?`The passkey request was cancelled or denied.`:typeof e==`object`&&e&&`name`in e&&e.name===`AbortError`?``:`Hub is temporarily unavailable.`}function ig(e){return{errorMessage:rg(e)||null,errorReason:e instanceof J?e.reason:null}}function ag(e){let t=rg(e)||null;return e instanceof J?{errorMessage:t,errorCode:e.code,errorCodeInferred:e.inferred}:{errorMessage:t,errorCode:null,errorCodeInferred:!1}}function og(e){return{errorMessage:e,errorCode:null,errorCodeInferred:!1}}var sg={errorMessage:null,errorCode:null,errorCodeInferred:!1};function cg(e,t){return t instanceof J?{status:`refused`,reason:e,errorCode:t.code,wireErrorCode:t.wireCode,inferredErrorCode:t.inferred,errorMessage:t.message||null}:{status:`refused`,reason:e,errorCode:null,wireErrorCode:null,inferredErrorCode:!1,errorMessage:t===void 0?null:rg(t)||null}}function lg(e,t){return{status:`refused`,reason:e,errorCode:null,wireErrorCode:null,inferredErrorCode:!1,errorMessage:t}}function ug(e){return e instanceof J&&(e.status===401||e.code===`session_invalid`)}function dg(){let e=0;return{bump:()=>{e+=1},issue:()=>{let t=e;return()=>t===e}}}var fg=2e4,pg=6e4,mg=3e4,hg=`Ryco state could not be synchronized.`,gg=`Another account change is still in progress.`,_g=`Sign in to change your account settings.`,vg=`The passkey could not be confirmed. Check your passkeys before relying on it.`,yg=`Your recovery codes were replaced but could not be shown. Your previous codes no longer work — generate a new set and save them.`,bg=`Two-factor setup started but its key could not be shown. Remove two-factor authentication and set it up again.`,xg=class{#e=null;#t=null;#n=0;#r=null;#i=null;#a=null;#o=null;#s=null;#c=null;#l=null;#u=null;#d=null;#f=0;#p=dg();#m=dg();#h=new Set;#g=!1;#_=null;#v=null;#y=null;#b=null;#x=null;#S=null;#C=null;#w=null;#T=0;#E=null;bootstrap(){if(this.#a)return this.#a;let e=this.#G(),t=X().restoreSession(e.signal).then(async e=>{Q({accountStatus:`authenticated`,account:e.account,session:e.session,errorMessage:null}),await this.refreshDirectory()}).catch(t=>{if(!e.signal.aborted){if(X().clearSessionMaterial(),ug(t))return X().getBootstrapAvailability(e.signal).catch(()=>!1).then(t=>{e.signal.aborted||Q({...Qh,bootstrapAvailable:t})});Q({...Qh,accountStatus:`unavailable`,...ig(t)})}}).finally(()=>{this.#e===e&&(this.#e=null),this.#a===t&&(this.#a=null)});return this.#a=t,t}async signIn(){let e=this.#G();Q({accountStatus:`authenticating`,errorMessage:null,recoveryCodes:[],totpEnrollment:null});try{let t=await X().signIn(e.signal);Q({accountStatus:`authenticated`,account:t.account,session:t.session}),await this.refreshDirectory()}catch(t){if(e.signal.aborted)return;Q({accountStatus:`signed-out`,...ig(t)})}finally{this.#e===e&&(this.#e=null)}}async signInWithExternalProvider(e){let t=this.#G();Q({accountStatus:`authenticating`,errorMessage:null,recoveryCodes:[],totpEnrollment:null});try{let n=await X().signInWithExternalProvider(e,t.signal);Q({accountStatus:`authenticated`,account:n.account,session:n.session}),await this.refreshDirectory()}catch(e){if(t.signal.aborted)return;Q({accountStatus:`signed-out`,...ig(e)})}finally{this.#e===t&&(this.#e=null)}}async redeemInvitation(e){return this.#D(t=>X().redeemInvitation(e,t))}async bootstrapOwner(e){return this.#D(t=>X().bootstrapOwner(e,t))}async adoptPublicBrowserIdentity(e,t=[]){this.#e?.abort(),this.#e=null,this.#p.bump(),this.#m.bump(),Q({accountStatus:`authenticated`,account:{id:e.account.id,displayName:e.account.displayName,role:e.activeSpace.role,createdAt:e.account.createdAt,disabledAt:e.account.disabledAt},session:{id:e.session.id,accountId:e.session.accountId,createdAt:e.session.createdAt,expiresAt:e.session.expiresAt,lastSeenAt:e.session.lastSeenAt,revokedAt:e.session.revokedAt,revocationReasonCode:e.session.revocationReasonCode},recoveryCodes:[...t],totpEnrollment:null,bootstrapAvailable:!1,errorMessage:null}),await this.refreshDirectory()}async#D(e){let t=this.#G();Q({accountStatus:`authenticating`,errorMessage:null,recoveryCodes:[],totpEnrollment:null});try{let n=await e(t.signal);Q({accountStatus:`authenticated`,account:n.account,session:n.session,recoveryCodes:n.recoveryCodes??[],bootstrapAvailable:!1}),await this.refreshDirectory()}catch(e){if(t.signal.aborted)return;Q({accountStatus:`signed-out`,...ig(e)})}finally{this.#e===t&&(this.#e=null)}}cancelAuthentication(){this.#e?.abort(),this.#e=null,this.#p.bump(),this.#m.bump(),Q({accountStatus:`signed-out`,errorMessage:null,recoveryCodes:[],totpEnrollment:null})}leaseRecoveryCodeDisplay(){let e=Symbol(`hosted-recovery-code-display-lease`);return this.#h.add(e),this.#O(),()=>{this.#h.delete(e)&&this.#k()}}#O(){let e=this.#h.size>0;ng.getState().leased!==e&&ng.setState({leased:e})}#k(){this.#g||(this.#g=!0,Promise.resolve().then(()=>{this.#g=!1,this.#O()}))}dismissRecoveryCodes(){Q({recoveryCodes:[]})}dismissTotpEnrollment(){this.#p.bump(),Q({totpEnrollment:null})}invalidateNativeE2eeAuthorization(){let e=Z.getState();e.accountStatus===`authenticated`&&(Vh().resetRelayAttemptFactory(),Q({generation:e.generation+1,effectiveRole:null,transportStatus:`reconnecting`,sessionStatus:`closed`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1}))}refreshPasskeys(e){let t=e?.force===!0;if(this.#v&&!t)return this.#v;let n=Z.getState();if(n.accountStatus!==`authenticated`)return Promise.resolve();t&&(this.#_?.abort(),this.#v=null);let r=new AbortController;this.#_=r;let i=this.#A(r,n.session?.id??null).finally(()=>{this.#_===r&&(this.#_=null),this.#v===i&&(this.#v=null)});return this.#v=i,tg.getState().passkeys.length===0&&$({passkeysStatus:`loading`}),i}async#A(e,t){try{let n=await X().listPasskeys(e.signal);if(e.signal.aborted)return;if(!this.#z(e.signal,t)){this.#M();return}$({passkeys:n,passkeysStatus:`ready`,...sg})}catch(n){if(e.signal.aborted)return;if(ug(n)){await this.#j(n);return}if(!this.#z(e.signal,t)){this.#M();return}$({passkeysStatus:`stale`,...ag(n)})}}async#j(e){await this.expireSession(e).catch(()=>void 0)}#M(){$({passkeys:[],passkeysStatus:`idle`})}refreshE2eeDevices(e){let t=e?.force===!0;if(this.#b&&!t)return this.#b;let n=Z.getState();if(n.accountStatus!==`authenticated`)return Promise.resolve();t&&(this.#y?.abort(),this.#b=null);let r=new AbortController;this.#y=r;let i=this.#N(r,n.session?.id??null).finally(()=>{this.#y===r&&(this.#y=null),this.#b===i&&(this.#b=null)});return this.#b=i,(tg.getState().e2eeDevices?.length??0)===0&&$({e2eeDevicesStatus:`loading`}),i}async#N(e,t){try{let n=await X().listE2eeDevices(e.signal);if(e.signal.aborted)return;if(!this.#z(e.signal,t)){this.#P();return}$({e2eeDevices:n,e2eeDevicesStatus:`ready`,...sg})}catch(n){if(e.signal.aborted)return;if(ug(n)){await this.#j(n);return}if(!this.#z(e.signal,t)){this.#P();return}$({e2eeDevicesStatus:`stale`,...ag(n)})}}#P(){$({e2eeDevices:[],e2eeDevicesStatus:`idle`})}refreshExternalIdentityConfiguration(e){let t=e?.force===!0;if(this.#w&&!t)return this.#w;t&&(this.#C?.abort(),this.#w=null);let n=this.#T,r=new AbortController;this.#C=r,tg.getState().externalIdentityConfiguration===null&&$({externalIdentityConfigurationStatus:`loading`});let i=X().getExternalIdentityConfiguration(r.signal).then(e=>{r.signal.aborted||n!==this.#T||$({externalIdentityConfiguration:e,externalIdentityConfigurationStatus:`ready`})}).catch(()=>{r.signal.aborted||n!==this.#T||$({externalIdentityConfigurationStatus:`stale`})}).finally(()=>{this.#C===r&&(this.#C=null),this.#w===i&&(this.#w=null)});return this.#w=i,i}refreshAccountSecurity(e){let t=e?.force===!0;if(this.#S&&!t)return this.#S;let n=Z.getState();if(n.accountStatus!==`authenticated`)return Promise.resolve();t&&(this.#x?.abort(),this.#S=null);let r=new AbortController;this.#x=r;let i=this.#F(r,n.session?.id??null).finally(()=>{this.#x===r&&(this.#x=null),this.#S===i&&(this.#S=null)});return this.#S=i,tg.getState().security===null&&$({securityStatus:`loading`}),i}async#F(e,t){try{let n=await X().getAccountSecurity(e.signal);if(e.signal.aborted)return;if(!this.#z(e.signal,t)){this.#I();return}$({security:n,securityStatus:`ready`})}catch(n){if(e.signal.aborted)return;if(ug(n)){await this.#j(n);return}if(!this.#z(e.signal,t)){this.#I();return}$({securityStatus:`stale`})}}#I(){$({security:null,securityStatus:`idle`})}async addPasskey(e){let t={result:null},n=tg.getState().passkeys.length,r=await this.#R(`adding-passkey`,async n=>{let r=await X().addPasskey(e,n);return()=>{t.result=r}});if(r.status!==`committed`)return r;let i=t.result?.passkey??null;await this.refreshPasskeys({force:!0});let a=tg.getState();return a.passkeysStatus===`ready`?(i?a.passkeys.some(e=>e.id===i.id):a.passkeys.length>n)?{status:`committed`,confirmation:`confirmed`,passkey:i}:($(og(vg)),{status:`committed`,confirmation:`missing`,passkey:i}):{status:`committed`,confirmation:`unverified`,passkey:i}}async regenerateRecoveryCodes(e){let t=this.#m.issue(),n=this.#h.size>0,r=!1,i=!1,a=await this.#R(`regenerating-recovery-codes`,async a=>{let o=await X().regenerateRecoveryCodes(e,a);return r=!0,()=>{n&&t()&&(i=!0,Q({recoveryCodes:o}))}},`account`);return r&&!i&&this.#L(yg),a.status===`committed`?{status:`committed`,displayed:i}:a}#L(e){Z.getState().accountStatus===`authenticated`&&$(og(e))}async revokePasskey(e){let t=await this.#R(`revoking-passkey`,async t=>(await X().revokePasskey(e,t),()=>void 0));return t.status===`committed`&&await this.refreshPasskeys({force:!0}),t}async renameE2eeDevice(e,t){let n=await this.#R(`renaming-e2ee-device`,async n=>(await X().renameE2eeDevice(e,t,n),()=>void 0));return n.status===`committed`&&await this.refreshE2eeDevices({force:!0}),n}async revokeE2eeDevice(e,t){let n=await this.#R(`revoking-e2ee-device`,async n=>(await X().revokeE2eeDevice(e,t,n),()=>void 0));return n.status===`committed`&&await this.refreshE2eeDevices({force:!0}),n}async setPassword(e){let t=await this.#R(`setting-password`,async t=>(await X().setPassword(e,t),()=>void 0));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async removePassword(e){let t=await this.#R(`removing-password`,async t=>(await X().removePassword(e,t),()=>void 0));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async beginTotpEnrollment(){let e=this.#p.issue(),t=!1,n=!1,r=await this.#R(`enrolling-totp`,async r=>{let i=await X().beginTotpEnrollment(r);return t=!0,()=>{e()&&(n=!0,Q({totpEnrollment:i}))}},`account`);return t&&!n&&this.#L(bg),r.status===`committed`?{status:`committed`,displayed:n}:r}async confirmTotpEnrollment(e){let t=await this.#R(`confirming-totp`,async t=>(await X().confirmTotpEnrollment(e,t),()=>{this.#p.bump(),Q({totpEnrollment:null})}));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async revokeTotp(e){let t=await this.#R(`revoking-totp`,async t=>(await X().revokeTotp(e,t),()=>{this.#p.bump(),Q({totpEnrollment:null})}));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async requestEmailVerification(e){let t=await this.#R(`requesting-email-verification`,async t=>(await X().requestEmailVerification(e,t),()=>void 0));return t.status===`committed`&&await this.refreshAccountSecurity({force:!0}),t}async connectExternalIdentity(e,t){let n=await this.#R(`connecting-external-identity`,async n=>(await X().connectExternalIdentity(e,t,n),()=>void 0));return n.status===`committed`&&await this.refreshAccountSecurity({force:!0}),n}cancelExternalIdentityConnection(e){this.cancelAccountAction(),X().cancelExternalIdentityConnection(e)}async finishBrowserExternalIdentityConnection(e,t){let n=await this.#R(`connecting-external-identity`,async n=>(await X().finishBrowserExternalIdentityConnection(e,t,n),()=>void 0));return n.status===`committed`&&await this.refreshAccountSecurity({force:!0}),n}async disconnectExternalIdentity(e,t){let n=!1,r=await this.#R(`disconnecting-external-identity`,async r=>{let i=await X().disconnectExternalIdentity(e,t,r);return()=>{n=i.signedOut}});return r.status===`committed`&&(n?await this.clearAccount(`signed-out`):await this.refreshAccountSecurity({force:!0})),r}cancelAccountAction(){this.#E&&(this.#E.abort(),this.#E=null,$({actionStatus:`idle`,...sg}))}async#R(e,t,n=`session`){if(tg.getState().actionStatus!==`idle`)return $(og(gg)),lg(`busy`,gg);let r=Z.getState();if(r.accountStatus!==`authenticated`)return $(og(_g)),lg(`signed-out`,_g);let i=r.session?.id??null,a=r.account?.id??null,o=new AbortController;this.#E=o,$({actionStatus:e,...sg});try{let e=await t(o.signal);return(n===`account`?this.#B(o.signal,a):this.#z(o.signal,i))?(e(),$(sg),{status:`committed`}):lg(o.signal.aborted?`cancelled`:`superseded`,null)}catch(e){return o.signal.aborted?lg(`cancelled`,null):ug(e)?(await this.#j(e),cg(`session-expired`,e)):this.#z(o.signal,i)?($(ag(e)),cg(`request-failed`,e)):cg(`superseded`,e)}finally{this.#E===o&&(this.#E=null,tg.getState().actionStatus===e&&$({actionStatus:`idle`}))}}#z(e,t){let n=Z.getState();return!e.aborted&&n.accountStatus===`authenticated`&&(n.session?.id??null)===t}#B(e,t){let n=Z.getState();return!e.aborted&&n.accountStatus===`authenticated`&&(n.account?.id??null)===t}#V(){this.#T+=1,this.#C?.abort(),this.#C=null,this.#w=null,this.#p.bump(),this.#m.bump(),this.#_?.abort(),this.#_=null,this.#v=null,this.#y?.abort(),this.#y=null,this.#b=null,this.#x?.abort(),this.#x=null,this.#S=null,this.#E?.abort(),this.#E=null,tg.setState($h,!0)}resetForTests(){this.#e?.abort(),this.#e=null,this.#q(),this.#n=0,this.#r?.abort(),this.#r=null,this.#i=null,this.#a=null,this.#Y(),this.#s?.abort(),this.#s=null,this.#c=null,this.#l?.abort(),this.#l=null,this.#u=null,this.#d=null,this.#f+=1,this.#V(),this.#h.clear(),this.#O(),X().clearSessionMaterial(),Z.setState(Qh,!0)}async signOut(){let e=this.#G();Q({accountStatus:`signing-out`,errorMessage:null});try{await X().signOut(e.signal)}catch{if(e.signal.aborted)return;X().clearSessionMaterial()}finally{this.#e===e&&(this.#e=null)}await this.clearAccount(`signed-out`)}async expireSession(e){X().clearSessionMaterial(),await this.clearAccount(`session-expired`),e instanceof J&&e.reason!==null&&Q(ig(e))}suspendBrowser(e){let t=Z.getState();if(t.accountStatus===`authenticated`&&(this.#f+=1,this.#l?.abort(),this.#l=null,this.#u=null,this.#s?.abort(),this.#Y(),this.#q(),this.#r?.abort(),this.#r=null,this.#i=null,Q({browserStatus:e===`offline`?`offline`:`suspended`,sessionStatus:t.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,sessionRecoveredAfterUnknown:!1,generation:t.generation+1}),t.selectedNode&&!this.#d)){let e=t.selectedNode.environmentId,n=Xh(e).catch(()=>void 0).finally(()=>{this.#d===n&&(this.#d=null)});this.#d=n}}resumeBrowser(){if(this.#u)return this.#u;let e=new AbortController;this.#l=e;let t=this.#H(e).finally(()=>{this.#u===t&&(this.#u=null),this.#l===e&&(this.#l=null)});return this.#u=t,t}async#H(e){let t=Z.getState();if(t.accountStatus!==`authenticated`)return;let n=this.#f+1;this.#f=n;let r=t.account?.id??null;Q({browserStatus:`checking-access`,errorMessage:null});try{let t=await X().restoreSession(e.signal);if(e.signal.aborted||this.#f!==n)return;if(Z.getState().accountStatus!==`authenticated`||t.account.id!==r){await this.expireSession();return}if(Q({account:t.account,session:t.session}),await this.refreshDirectory(),this.#f!==n)return;let i=Z.getState();if(i.accountStatus!==`authenticated`)return;if(i.directoryStatus!==`ready`){Q({browserStatus:`stale`});return}if(!i.selectedNode){Q({browserStatus:`current`});return}Q({browserStatus:`synchronizing`}),await this.#W(e.signal)}catch(t){if(e.signal.aborted||this.#f!==n)return;if(ug(t)){await this.expireSession(t);return}Q({browserStatus:`stale`,...ig(t)})}}async clearAccount(e){this.#f+=1,this.#l?.abort(),this.#l=null,this.#u=null,this.#s?.abort(),this.#s=null,this.#c=null,this.#q(),this.#Y(),this.#r?.abort(),this.#r=null,this.#i=null,this.#e?.abort(),this.#e=null,this.#V();let t=Z.getState().selectedNode?.environmentId??null;Q({...Qh,accountStatus:e,generation:Z.getState().generation+1}),t&&await Yh(t)}refreshDirectory(){if(this.#i)return this.#i;let e=new AbortController;this.#r=e;let t=this.#U(e).finally(()=>{this.#r===e&&(this.#r=null),this.#i===t&&(this.#i=null)});return this.#i=t,t}async#U(e){let t=Z.getState();if(t.accountStatus!==`authenticated`)return;let n=t.session?.id??null;this.#q(),Q({directoryStatus:t.nodes.length===0?`loading`:t.directoryStatus});try{let t=await X().listNodes(e.signal),r=Z.getState();if(e.signal.aborted||r.accountStatus!==`authenticated`||r.session?.id!==n)return;this.#n=0;let i=Z.getState(),a=i.browserStatus===`stale`,o=i.selectedNode,s=o?t.find(e=>e.id===o.id&&e.environmentId===o.environmentId)??null:null;if(o&&(!s||s.revokedAt!==null)){let e=i.generation+1;Q({nodes:t,directoryStatus:`ready`,selectionStatus:s&&s.revokedAt!==null?`revoked`:`authorization-removed`,effectiveRole:null,generation:e}),await this.#Z(o.environmentId,e)}else Q({nodes:t,directoryStatus:`ready`,...s?{selectedNode:s,selectionStatus:s.presence.online?`online`:`offline`,effectiveRole:s.effectiveRole}:{}});this.#K(fg),a&&Vh().timers.queueMicrotask(()=>{let e=Z.getState();e.accountStatus===`authenticated`&&e.directoryStatus===`ready`&&e.browserStatus===`stale`&&this.resumeBrowser()})}catch(t){if(e.signal.aborted)return;if(ug(t)){await this.expireSession(t);return}this.#n+=1,Q({directoryStatus:`stale`,effectiveRole:null,...ig(t)});let n=Math.min(pg,1e3*2**Math.min(this.#n,6));this.#K(n)}}async selectNode(e){let t=Z.getState();if(t.directoryStatus!==`ready`||t.browserStatus!==`current`)return;let n=t.nodes.find(t=>t.id===e);if(!n||n.revokedAt||t.selectedNode?.id===n.id&&t.selectedNode.environmentId===n.environmentId)return;let r=t.generation+1;Q({selectedNode:n,selectionStatus:n.presence.online?`online`:`offline`,effectiveRole:n.effectiveRole,transportStatus:`idle`,sessionStatus:`synchronizing`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,errorMessage:null,generation:r}),this.#J(r);try{await Zh(n,t.selectedNode?.environmentId??null)}catch{this.#X(r)}}async returnToDirectory(e){let t=Z.getState(),n=t.selectedNode;if(!n)return;let r=e?.preserveTerminalSelection===!0;this.#f+=1,this.#l?.abort(),this.#l=null,this.#u=null,this.#s?.abort(),this.#s=null,this.#c=null,this.#Y(),Q({selectedNode:null,selectionStatus:r?t.selectionStatus:`none`,effectiveRole:null,transportStatus:`idle`,sessionStatus:`closed`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,browserStatus:t.browserStatus===`synchronizing`||t.browserStatus===`checking-access`?`current`:t.browserStatus,errorMessage:r?t.errorMessage:null,errorReason:r?t.errorReason??null:null,generation:t.generation+1}),await Yh(n.environmentId)}retrySelectedNode(){if(this.#c)return this.#c;let e=new AbortController;this.#s=e;let t=this.#W(e.signal).finally(()=>{this.#s===e&&(this.#s=null),this.#c===t&&(this.#c=null)});return this.#c=t,t}async#W(e){if(e.aborted||(await this.#d,e.aborted))return;let t=Z.getState(),n=t.selectedNode;if(!n||n.revokedAt!==null||t.accountStatus!==`authenticated`||t.directoryStatus!==`ready`||(t=Z.getState(),e.aborted||t.selectedNode?.id!==n.id||t.selectedNode.environmentId!==n.environmentId||t.selectedNode.revokedAt!==null||t.accountStatus!==`authenticated`||t.directoryStatus!==`ready`))return;let r=t.sessionStatus===`delivery-unknown`||Vh().hasPendingRelayRequests(),i=t.generation+1;this.#Y(),Q({selectionStatus:n.presence.online?`online`:`offline`,effectiveRole:n.effectiveRole,transportStatus:`idle`,sessionStatus:r?`delivery-unknown`:`synchronizing`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,errorMessage:null,generation:i}),this.#J(i);try{await Zh(n,n.environmentId,e)}catch{if(e.aborted)return;this.#X(i)}}transportStatus(e,t){Z.getState().generation===e&&Q({transportStatus:t})}sessionStatus(e,t){let n=Z.getState();if(n.generation===e){if(n.sessionStatus===`delivery-unknown`&&t!==`closed`){Q({sessionRecoveredAfterUnknown:!1});return}Q({sessionStatus:t,sessionRecoveredAfterUnknown:!1})}}role(e,t){let n=Z.getState();n.generation===e&&Q({effectiveRole:n.directoryStatus===`ready`?t:null})}failure(e,t){let n=Z.getState();if(n.generation!==e)return;let r=t.kind===`revoked`?`revoked`:t.kind===`authorization-removed`?`authorization-removed`:t.kind===`incompatible`?`incompatible`:n.selectedNode?.presence.online?n.selectionStatus:`offline`;t.retryable||this.#Y(),Q({selectionStatus:r,effectiveRole:t.retryable?n.effectiveRole:null,transportStatus:t.retryable?`reconnecting`:`terminal-failure`,sessionStatus:n.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,browserStatus:!t.retryable&&n.browserStatus===`synchronizing`?`current`:n.browserStatus,errorMessage:Sg(t)})}markDeliveryUnknown(e){Z.getState().generation===e&&Q({sessionStatus:`delivery-unknown`,sessionRecoveredAfterUnknown:!1})}connectionClosed(e){let t=Z.getState();t.generation===e&&t.transportStatus!==`terminal-failure`&&Q({transportStatus:`reconnecting`,sessionStatus:t.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,sessionRecoveredAfterUnknown:!1})}markSessionReady(e){let t=Z.getState();if(t.selectedNode?.environmentId===e){if(this.#Y(),t.sessionStatus===`delivery-unknown`){Q({sessionEstablished:!0,sessionRecoveredAfterUnknown:!0,browserStatus:t.browserStatus===`synchronizing`?`current`:t.browserStatus});return}Q({sessionStatus:`ready`,sessionEstablished:!0,sessionRecoveredAfterUnknown:!1,browserStatus:t.browserStatus===`synchronizing`?`current`:t.browserStatus})}}markSessionReplaying(e){let t=Z.getState();if(t.selectedNode?.environmentId===e){if(t.sessionStatus===`delivery-unknown`){Q({sessionRecoveredAfterUnknown:!1});return}Q({sessionStatus:`replaying`,browserStatus:t.browserStatus===`current`||t.browserStatus===`synchronizing`?`synchronizing`:t.browserStatus})}}reportShellSnapshotFailure(e){let t=Z.getState();if(t.selectedNode?.environmentId===e){if(t.sessionEstablished){console.warn(`hosted_snapshot_reconciliation_failed`);return}this.#X(t.generation)}}acknowledgeDeliveryUnknown(){let e=Z.getState();e.sessionStatus===`delivery-unknown`&&e.sessionRecoveredAfterUnknown&&Q({sessionStatus:`ready`,sessionRecoveredAfterUnknown:!1})}#G(){this.#e?.abort();let e=new AbortController;return this.#e=e,e}#K(e){this.#q();let t=Vh();if(!t.isForeground()){t.subscribeForeground(()=>{t.isForeground()&&(this.#q(),this.refreshDirectory())});return}this.#t=t.timers.setTimeout(()=>void this.refreshDirectory(),e)}#q(){this.#t&&Vh().timers.clearTimeout(this.#t),this.#t=null}#J(e){this.#Y();let t=Z.getState();t.generation!==e||t.sessionEstablished||(this.#o=Vh().timers.setTimeout(()=>this.#X(e),mg))}#Y(){this.#o&&Vh().timers.clearTimeout(this.#o),this.#o=null}#X(e){let t=Z.getState();t.generation!==e||t.sessionEstablished||(this.#Y(),Q({transportStatus:`terminal-failure`,sessionStatus:t.sessionStatus===`delivery-unknown`?`delivery-unknown`:`stale`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1,browserStatus:t.browserStatus===`synchronizing`?`current`:t.browserStatus,errorMessage:hg}))}async#Z(e,t){this.#Y(),await Yh(e),Z.getState().generation===t&&Q({selectedNode:null,transportStatus:`idle`,sessionStatus:`closed`,sessionEstablished:!1,sessionRecoveredAfterUnknown:!1})}};function Sg(e){switch(e.kind){case`offline`:return`The selected node is offline. Ryco will reconnect when it becomes available.`;case`revoked`:return`Access to the selected node was revoked.`;case`authorization-removed`:return`Your authorization for the selected node was removed.`;case`incompatible`:return`The selected node uses an incompatible relay protocol version.`;case`draining`:return`Hub is draining connections. Ryco will retry shortly.`;case`slow-consumer`:return`The relay closed a slow connection. Ryco will reconnect.`;case`authentication`:return`The relay authentication attempt expired or was rejected.`;case`rate-limited`:return`Relay attempts are temporarily rate limited.`;default:return e.retryable?`The relay connection was interrupted. Ryco is reconnecting.`:`The relay connection could not be established.`}}var Cg=new xg;function wg(e,t){Z.getState().generation===t&&Cg.markSessionReady(e)}function Tg(e,t){Z.getState().generation===t&&Cg.markSessionReplaying(e)}function Eg(e,t){Z.getState().generation===t&&Cg.reportShellSnapshotFailure(e)}var Dg={idle:`idle`,"requesting-ticket":`requesting ticket`,connecting:`connecting`,authenticating:`authenticating`,"opening-channel":`opening channel`,online:`online`,reconnecting:`Reconnecting`,draining:`draining`,"terminal-failure":`terminal failure`},Og={unavailable:`Online`,negotiating:`Securing`,verified:`Encrypted · Verified locally`,"account-trusted":`Encrypted · Account trusted`,unverified:`Not verified`,"web-unsigned":`Encrypted web`,legacy:`Legacy connection`};function kg(e){let{browserStatus:t,sessionStatus:n,selectionStatus:r,transportStatus:i}=e,a=e.e2eeStatus??`unavailable`;return t===`offline`?`Offline`:t===`checking-access`?`Checking access`:t===`synchronizing`?`Synchronizing`:t===`suspended`||t===`stale`?`Stale`:n===`delivery-unknown`?`Delivery unknown`:r===`authorization-removed`?`Authorization removed`:r===`revoked`?`Revoked`:r===`incompatible`?`Incompatible`:e.nativeDeviceSecurityStatus===`revoked`?`Revoked`:e.nativeDeviceSecurityStatus===`securing`?`Securing this device`:e.nativeDeviceSecurityStatus===`unavailable`?`Device encryption unavailable`:i===`online`&&n===`ready`?Og[a]:i===`reconnecting`?`Reconnecting`:r===`offline`?`Offline`:Dg[i]}var Ag={Offline:{shortLabel:`Offline`,connected:!1,guarantee:`none`},"Checking access":{shortLabel:`Checking`,connected:!1,guarantee:`none`},Synchronizing:{shortLabel:`Syncing`,connected:!1,guarantee:`none`},Stale:{shortLabel:`Stale`,connected:!1,guarantee:`none`},"Delivery unknown":{shortLabel:`Unconfirmed`,connected:!1,guarantee:`none`},"Authorization removed":{shortLabel:`No access`,connected:!1,guarantee:`none`},Revoked:{shortLabel:`Revoked`,connected:!1,guarantee:`none`},Incompatible:{shortLabel:`Incompatible`,connected:!1,guarantee:`none`},Online:{shortLabel:`Online`,connected:!0,guarantee:`none`},"Encrypted · Verified locally":{shortLabel:`Verified`,connected:!0,guarantee:`e2ee`},"Encrypted · Account trusted":{shortLabel:`Acct trusted`,connected:!0,guarantee:`account`},"Encrypted web":{shortLabel:`Web E2EE`,connected:!0,guarantee:`web`},"Legacy connection":{shortLabel:`Legacy`,connected:!0,guarantee:`legacy`},"Not verified":{shortLabel:`Not verified`,connected:!1,guarantee:`none`},Securing:{shortLabel:`Securing`,connected:!1,guarantee:`none`},"Securing this device":{shortLabel:`Device setup`,connected:!1,guarantee:`none`},"Device encryption unavailable":{shortLabel:`No E2EE key`,connected:!1,guarantee:`none`},Reconnecting:{shortLabel:`Reconnecting`,connected:!1,guarantee:`none`},idle:{shortLabel:`Idle`,connected:!1,guarantee:`none`},"requesting ticket":{shortLabel:`Preparing`,connected:!1,guarantee:`none`},connecting:{shortLabel:`Connecting`,connected:!1,guarantee:`none`},authenticating:{shortLabel:`Verifying`,connected:!1,guarantee:`none`},"opening channel":{shortLabel:`Opening`,connected:!1,guarantee:`none`},online:{shortLabel:`Not ready`,connected:!1,guarantee:`none`},draining:{shortLabel:`Closing`,connected:!1,guarantee:`none`},"terminal failure":{shortLabel:`Failed`,connected:!1,guarantee:`none`}};Object.keys(Ag);function jg(e){return Ag[kg(e)]}function Mg(e){return e.hosted?!e.fresh||e.browserCurrent===!1||e.sessionReady===!1?{hosted:!0,allowed:!1,reason:`This action is unavailable while Hub authorization or the relay is stale.`}:im(e.role,e.method,!0)?{hosted:!0,allowed:!0,reason:null}:{hosted:!0,allowed:!1,reason:`This action is unavailable for your role on the selected node.`}:{hosted:!1,allowed:!0,reason:null}}Lt(Se),Lt(u);export{wn as $,cf as A,vl as B,_m as C,If as D,Zp as E,Gl as F,_o as G,G as H,xl as I,I as J,ao as K,Sl as L,Ml as M,au as N,Of as O,tu as P,On as Q,ol as R,gm as S,em as T,pl as U,el as V,dl as W,mn as X,fr as Y,Tn as Z,J as _,tg as a,Cn as at,dh as b,ng as c,vn as ct,Eg as d,pn as dt,En as et,Bh as f,dn as ft,Ph as g,Rh as h,nn as ht,hg as i,Sn as it,bu as j,df as k,wg as l,_n as lt,Vh as m,tn as mt,jg as n,kn as nt,Cg as o,xn as ot,X as p,fn as pt,ka as q,kg as r,yn as rt,Z as s,bn as st,Mg as t,Dn as tt,Tg as u,rn as ut,ch as v,im as w,am as x,sh as y,il as z};
|