@vellumai/web 0.11.3-dev.202608181709.1f85a67 → 0.11.3-dev.202608182007.738dd45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{Trans-Cjflukh4.js → Trans-BUZ5rYs3.js} +1 -1
- package/dist/assets/{access-BMLS-Fnk.js → access-D7GW3vBM.js} +1 -1
- package/dist/assets/account-DEWe1CJv.js +1 -0
- package/dist/assets/{account-page-DKZfEhpc.js → account-page-BDsLuHfs.js} +1 -1
- package/dist/assets/{account-shell-DdH2Ze4T.js → account-shell-Dk4m-iaE.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-CHQcp6at.js → acp-run-detail-panel-Cgma9FzH.js} +1 -1
- package/dist/assets/{activity-steps-panel-Y-khrUIh.js → activity-steps-panel-B5BlidVh.js} +1 -1
- package/dist/assets/{add-credits-modal-ByR0kDly.js → add-credits-modal-RIAYgbOT.js} +1 -1
- package/dist/assets/{ai-page-DU_kjH_s.js → ai-page-Xd6UnSY4.js} +1 -1
- package/dist/assets/api-BjYAXdCk.js +1 -0
- package/dist/assets/{api-CQ3nejmH.js → api-Cx3i50oG.js} +1 -1
- package/dist/assets/{api-key-screen-BvKdp-t9.js → api-key-screen-DhQDCQlh.js} +1 -1
- package/dist/assets/{app-card--MsNli_3.js → app-card-CjRGDYCX.js} +1 -1
- package/dist/assets/{assistant-status-panel-YLnGIq50.js → assistant-status-panel-Hchz3DMb.js} +1 -1
- package/dist/assets/{auth-store-DdlZ1ww5.js → auth-store-C9wDgFON.js} +2 -2
- package/dist/assets/auth-welcome-screen-CwUceIcb.js +1 -0
- package/dist/assets/{avatar-random-D1LU-C7V.js → avatar-random-B5F8Cp2E.js} +1 -1
- package/dist/assets/{background-task-detail-panel-CH6PZWc-.js → background-task-detail-panel-NuyARCwT.js} +1 -1
- package/dist/assets/{billing-page-C9KE8hcY.js → billing-page-BZZm_pDJ.js} +3 -3
- package/dist/assets/{bookmarks-page-Dfe8bDcH.js → bookmarks-page-CJhDDPD-.js} +1 -1
- package/dist/assets/{browser-Nd92UvKg.js → browser-Ca2R8csw.js} +2 -2
- package/dist/assets/{build-state-Bjmhv0mc.js → build-state-CiYHZsss.js} +1 -1
- package/dist/assets/channels-page-route-BiQfGSPY.js +9 -0
- package/dist/assets/{chat-BWQujip4.js → chat-CHVUM3s0.js} +1 -1
- package/dist/assets/{chat-markdown-message-BXJf0_QR.js → chat-markdown-message-z1QS9SKA.js} +1 -1
- package/dist/assets/{checkout-continuation-CbOBM29m.js → checkout-continuation-CT3B1WxY.js} +1 -1
- package/dist/assets/{checkout-page-D-hRf00C.js → checkout-page-Dv1ZX5ZY.js} +1 -1
- package/dist/assets/checkout-return-target-_Y86sfo0.js +1 -0
- package/dist/assets/{client-perf-DHnnpVkx.js → client-perf-BZu5XQCP.js} +1 -1
- package/dist/assets/{command-palette-C6fyPEFS.js → command-palette-B6PZe9A0.js} +1 -1
- package/dist/assets/command-palette-window-page-Ch7vQ5S8.js +1 -0
- package/dist/assets/{community-page-CEGpM417.js → community-page-CQfRKDHU.js} +1 -1
- package/dist/assets/companion-surface-CZHv2avR.js +1 -0
- package/dist/assets/companion-surface-page-b9KKpZFW.js +1 -0
- package/dist/assets/{composer-settings-CacCpRW8.js → composer-settings-C61mCg49.js} +1 -1
- package/dist/assets/{connect-page-BN5oRdA4.js → connect-page-DXnY3bmc.js} +1 -1
- package/dist/assets/{consent-controls-DtPeeFwa.js → consent-controls-B06-8JYV.js} +1 -1
- package/dist/assets/{contacts-page-route-DjEvifaN.js → contacts-page-route-su21Ke7t.js} +1 -1
- package/dist/assets/conversation-cache-CoTFebBJ.js +1 -0
- package/dist/assets/{conversation-navigation-QdQDJsWW.js → conversation-navigation-o5qX8VXh.js} +1 -1
- package/dist/assets/conversation-queries-BHArqfKQ.js +1 -0
- package/dist/assets/{conversation-selection-BFTHfyYb.js → conversation-selection-CPc_Urk2.js} +1 -1
- package/dist/assets/{credential-entry-page-CPamuLmq.js → credential-entry-page-5GPiB19B.js} +1 -1
- package/dist/assets/{credentials-page-CFW32WuW.js → credentials-page-BednnAP4.js} +1 -1
- package/dist/assets/{csv-preview-FnIpBtF1.js → csv-preview-T_KT_vef.js} +1 -1
- package/dist/assets/{debug-page-BjuFJknb.js → debug-page-BaJ09rGa.js} +2 -2
- package/dist/assets/{deploy-dialogs-I_QAK81w.js → deploy-dialogs-CgicOESj.js} +1 -1
- package/dist/assets/{deploy-store-C-WH19q9.js → deploy-store-dyN183E8.js} +1 -1
- package/dist/assets/{desktop-voice-activity-CPOU-25i.js → desktop-voice-activity-D1BSf0I-.js} +1 -1
- package/dist/assets/{detail-card-BzCuPjtL.js → detail-card-Bqnvs6YE.js} +1 -1
- package/dist/assets/{detail-drawer-CYUmZIyK.js → detail-drawer-j2jaITAL.js} +1 -1
- package/dist/assets/{detail-shell-B1BZYIqh.js → detail-shell-D1UEZCzz.js} +1 -1
- package/dist/assets/{developer-page-BKeIlAhr.js → developer-page-PJ7q8b5s.js} +1 -1
- package/dist/assets/{diagnostics-BrWbafo7.js → diagnostics-CwFqcLv_.js} +1 -1
- package/dist/assets/{doctor-handoff-store-CX39mMuw.js → doctor-handoff-store-Cy96Na-O.js} +1 -1
- package/dist/assets/{document-viewer-container-Bb7omFZS.js → document-viewer-container-BMmSidmj.js} +2 -2
- package/dist/assets/{document-viewer-page-CshWr2tW.js → document-viewer-page-CgwLG8gF.js} +1 -1
- package/dist/assets/{emails-page-CDo5Hm8w.js → emails-page-CdpCeoEL.js} +1 -1
- package/dist/assets/{esm-DYyr0ITx.js → esm-BD6nxr-q.js} +2 -2
- package/dist/assets/{esm-DjphWBuP.js → esm-BaEdQNCe.js} +2 -2
- package/dist/assets/esm-CtKndoc9.js +2 -0
- package/dist/assets/{esm-CfdMbmKl.js → esm-DTIJZw37.js} +2 -2
- package/dist/assets/{esm-tSqvpvZa.js → esm-FpGTFn5W.js} +2 -2
- package/dist/assets/{esm-L7cqLUll.js → esm-kYXyJ2zw.js} +2 -2
- package/dist/assets/{esm-DbEwZ3Za.js → esm-nl105Ya0.js} +2 -2
- package/dist/assets/{external-anchor-DQhNmTOb.js → external-anchor-CLy6d_za.js} +1 -1
- package/dist/assets/file-markdown-C1rEGVrN.js +2 -0
- package/dist/assets/{first-run-scope-C-EiuVmf.js → first-run-scope-DnJZfdvV.js} +1 -1
- package/dist/assets/{format-usd-D6RSKlCb.js → format-usd-H0tehwu9.js} +1 -1
- package/dist/assets/{funnel-events-BfR30ND5.js → funnel-events-BP3XPaB5.js} +1 -1
- package/dist/assets/{general-page-7GvIVegL.js → general-page-BPYAHcY3.js} +1 -1
- package/dist/assets/{haptics-Sti0ZroX.js → haptics-D3hzTCtH.js} +2 -2
- package/dist/assets/{hatching-screen-BK2AP-yW.js → hatching-screen-z-PWb9jY.js} +1 -1
- package/dist/assets/{home-page-route-BICKF-V_.js → home-page-route-BegXl1Cw.js} +1 -1
- package/dist/assets/home-tool-permission-card-VExDGFm0.js +1 -0
- package/dist/assets/{hosting-screen-B9f0pTOU.js → hosting-screen-CKnGNDJ9.js} +1 -1
- package/dist/assets/{i18n-WHkGP0v4.js → i18n-TtBbwrTI.js} +2 -2
- package/dist/assets/{identity-page-route-wXgjTfIf.js → identity-page-route-CyN9MMSX.js} +1 -1
- package/dist/assets/index-CX-LM5wF.css +2 -0
- package/dist/assets/{index-DWHV0D_I.js → index-Dge6Azed.js} +3 -3
- package/dist/assets/{ingest-C3QOaKA5.js → ingest-DXklElaR.js} +1 -1
- package/dist/assets/{inspect-page-B42WpFV6.js → inspect-page-CtTiYmYL.js} +3 -3
- package/dist/assets/integrations-page-DODeJwfi.js +1 -0
- package/dist/assets/{intelligence-layout-DPwf5I5_.js → intelligence-layout-bwbkzjYT.js} +1 -1
- package/dist/assets/{invalidate-memory-queries-CIErtFeT.js → invalidate-memory-queries-B4VT2fpA.js} +1 -1
- package/dist/assets/{latest-assistant-text-hKWwKxXi.js → latest-assistant-text-JCjtByys.js} +1 -1
- package/dist/assets/{library-detail-page-BfoeeBIn.js → library-detail-page-CJhFHU0n.js} +1 -1
- package/dist/assets/{library-page-Bp4va37D.js → library-page-DY2AWpna.js} +1 -1
- package/dist/assets/{local-runtime-upgrade-CFsjLDQO.js → local-runtime-upgrade-DDXGJgta.js} +1 -1
- package/dist/assets/{login-flow-BIBYcOoQ.js → login-flow-CDcY-I-U.js} +1 -1
- package/dist/assets/login-page-CwMrP7Ad.js +1 -0
- package/dist/assets/{logout-page-ReEHLfsa.js → logout-page-B88TmVjw.js} +1 -1
- package/dist/assets/{logs-layout-TZutPXCD.js → logs-layout-BMB_GXwM.js} +1 -1
- package/dist/assets/{markdown-preview-CYSaj1MV.js → markdown-preview-Dx8E021p.js} +1 -1
- package/dist/assets/{memory-page-route-tBinK8qR.js → memory-page-route-DEjaLXu0.js} +1 -1
- package/dist/assets/{memory-router-playground-page-CMICcZta.js → memory-router-playground-page-CRWV3t_R.js} +1 -1
- package/dist/assets/{message-files-panel-25T5M1Ct.js → message-files-panel-ZPa7eZHc.js} +1 -1
- package/dist/assets/{messages-DJ6wO978.js → messages-CPTfRZA4.js} +1 -1
- package/dist/assets/{metric-card-Bg72JUq3.js → metric-card-bXd-f58c.js} +1 -1
- package/dist/assets/multi-activity-group-BbCnUOlH.js +1 -0
- package/dist/assets/native-anchor-Bn22ZLay.js +1 -0
- package/dist/assets/{native-biometric-BxYhgb-X.js → native-biometric-D9IxNvJM.js} +1 -1
- package/dist/assets/{native-deep-link-C-s7GeV-.js → native-deep-link-IwasVyFQ.js} +2 -2
- package/dist/assets/{native-file-B3U837ed.js → native-file-BpFW1c_c.js} +2 -2
- package/dist/assets/{navigation-resolver-D4kCxpGf.js → navigation-resolver-jIQ5B6JB.js} +1 -1
- package/dist/assets/{not-found-DtC_EDFf.js → not-found-BIAqP01y.js} +1 -1
- package/dist/assets/{notifications-CZJragaI.js → notifications-DK6b8YVI.js} +1 -1
- package/dist/assets/{notifications-page-D2jRRoLP.js → notifications-page-BlEylLV5.js} +1 -1
- package/dist/assets/{oauth-complete-page-DQJuVVtX.js → oauth-complete-page-Cx1sQ0q9.js} +1 -1
- package/dist/assets/{oauth-connection-utils-DmZFWfiy.js → oauth-connection-utils-19Tfw-lp.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-eyeUww88.js → oauth-popup-complete-page-Npy9VexD.js} +1 -1
- package/dist/assets/{onboarding-step-layout-BfHbyjc0.js → onboarding-step-layout-2G2ptxpI.js} +1 -1
- package/dist/assets/open-workspace-file-C1BgizdS.js +2 -0
- package/dist/assets/{operational-status-CQiaZbwn.js → operational-status-DMrC3Cwu.js} +1 -1
- package/dist/assets/page-shell-C3ZmdIop.js +1 -0
- package/dist/assets/page-surface-store-DJLLsNFC.js +1 -0
- package/dist/assets/{pairing-page-C4L9xIsk.js → pairing-page-5lKY2jLV.js} +1 -1
- package/dist/assets/{pdf-file-preview-6vptz6t6.js → pdf-file-preview-udA0Apx_.js} +1 -1
- package/dist/assets/{pdf-preview-sG04pSiE.js → pdf-preview-6Xfl1tO1.js} +2 -2
- package/dist/assets/{personality-page-ifV2Ly9v.js → personality-page-FQ6SJon-.js} +1 -1
- package/dist/assets/{plans-page-C5LGpzw5.js → plans-page-XKbY3NZv.js} +1 -1
- package/dist/assets/{platform-detection-Dt0-jSAU.js → platform-detection-zth6eCY8.js} +1 -1
- package/dist/assets/{platform-login-notice-C6p4PqvT.js → platform-login-notice-CuGLNP0e.js} +1 -1
- package/dist/assets/{platform-loopback-page-DGXBiba8.js → platform-loopback-page-DGrkcpY5.js} +1 -1
- package/dist/assets/{preview-error-BkNW-Vj0.js → preview-error-gCViZZRw.js} +1 -1
- package/dist/assets/{privacy-page-CjzNCeWl.js → privacy-page-Cb4rmfAm.js} +1 -1
- package/dist/assets/{privacy-screen-BqElyCBC.js → privacy-screen-DL1_oG-n.js} +1 -1
- package/dist/assets/{provider-callback-page-BtXjs3Nf.js → provider-callback-page-DGdHbtqG.js} +1 -1
- package/dist/assets/{provider-signup-page-DEc2h5NX.js → provider-signup-page-DsoyRgUv.js} +1 -1
- package/dist/assets/{provisioning-targets-QWEnNCue.js → provisioning-targets-DDUZDQ_a.js} +1 -1
- package/dist/assets/{push-registration-BMwgTQHf.js → push-registration-CH_t0mI8.js} +2 -2
- package/dist/assets/{remove-from-device-dialog-CRb-Y2da.js → remove-from-device-dialog-CMOwKRrC.js} +1 -1
- package/dist/assets/{research-facts-_ZlA6tzF.js → research-facts-C2cY_gU2.js} +1 -1
- package/dist/assets/{research-mock-page-PPKtT6UI.js → research-mock-page-1gKLMbto.js} +1 -1
- package/dist/assets/research-onboarding-route-NHPlfj0z.js +50 -0
- package/dist/assets/{research-results-view-BFBI--6l.js → research-results-view-BcQs2Zh9.js} +1 -1
- package/dist/assets/{retire-confirm-dialog-BjtXvcXF.js → retire-confirm-dialog-Dq2Q98Yl.js} +1 -1
- package/dist/assets/{review-terms-screen-D-qvb1wH.js → review-terms-screen-CAtBpvUx.js} +1 -1
- package/dist/assets/routes-DCjnP2aH.js +24 -0
- package/dist/assets/{runtime-upgrade-banner-BxbiSjfM.js → runtime-upgrade-banner-BL1j3JGc.js} +2 -2
- package/dist/assets/{sandbox-bridge-CXqBkVsW.js → sandbox-bridge-Dj1pIOXJ.js} +1 -1
- package/dist/assets/{schedules-page-CjFWw3_W.js → schedules-page-BJCuP9fD.js} +1 -1
- package/dist/assets/section-membership-DeK1JIPs.js +1 -0
- package/dist/assets/{select-assistant-screen-BsuwJYzY.js → select-assistant-screen-BSkH_rZn.js} +1 -1
- package/dist/assets/{self-hosted-servers-DYKQjALI.js → self-hosted-servers-BviPyNnl.js} +1 -1
- package/dist/assets/settings-CPPQyE7I.js +1 -0
- package/dist/assets/{settings-divider-DGdHGRSV.js → settings-divider-C0NZsB-L.js} +1 -1
- package/dist/assets/{settings-layout-Dd5EZjfb.js → settings-layout-BK2_PKQd.js} +1 -1
- package/dist/assets/settings-navigation-XQmor_bk.js +1 -0
- package/dist/assets/{share-feedback-modal-CXXHZ0pE.js → share-feedback-modal-CAPa5NKi.js} +2 -2
- package/dist/assets/{sidebar-tree-BFNHw8U0.js → sidebar-tree-B2x-_PWE.js} +1 -1
- package/dist/assets/{signup-page-Cb4hwsdS.js → signup-page-Dt7psxLK.js} +1 -1
- package/dist/assets/{site-favicon-D5oxJG4i.js → site-favicon-Cu07pwc9.js} +1 -1
- package/dist/assets/{skill-detail-page-DbtCLCjS.js → skill-detail-page-Co6tAKwZ.js} +1 -1
- package/dist/assets/{skill-detail-panel-DpWCbORC.js → skill-detail-panel-o84lYZCw.js} +1 -1
- package/dist/assets/{skills-CAAcLlNJ.js → skills-5MnTu98B.js} +1 -1
- package/dist/assets/{sounds-page-DS3dfn0E.js → sounds-page-hSEfvG9x.js} +1 -1
- package/dist/assets/{src-qDZBwoEm.js → src-CImIAPTd.js} +1 -1
- package/dist/assets/{start-screen-DAAGQBRG.js → start-screen-STWsoVV3.js} +1 -1
- package/dist/assets/{status-badge-pill-CCaDOkgw.js → status-badge-pill-CycOl7MT.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-BCceehoL.js → stt-language-picker-modal-BjfWD1PV.js} +1 -1
- package/dist/assets/{subagent-detail-panel-Bdx8mP2q.js → subagent-detail-panel-C5hfCpIO.js} +1 -1
- package/dist/assets/{subagent-store-D79M-K__.js → subagent-store-DqKEBlAM.js} +1 -1
- package/dist/assets/{superpowers-page-Bf2gVqt_.js → superpowers-page-CcZEbOzY.js} +1 -1
- package/dist/assets/{swipe-action-reveal-BA2youcQ.js → swipe-action-reveal-Ai9lRgUU.js} +1 -1
- package/dist/assets/{system-events-page-BzHXfybi.js → system-events-page-BGJhB42W.js} +1 -1
- package/dist/assets/{telegram-setup-wizard-DhIkHgMe.js → telegram-setup-wizard-BENKNAuh.js} +1 -1
- package/dist/assets/{text-preview-DFo5f2uH.js → text-preview-DUlKYC4u.js} +1 -1
- package/dist/assets/{theme-stage-page-CF7Y2Nao.js → theme-stage-page-C9sFg66o.js} +1 -1
- package/dist/assets/{tiptap-document-editor-DDfxW_SE.js → tiptap-document-editor-0vqw7hch.js} +1 -1
- package/dist/assets/{tool-detail-panel-DbeXuW6-.js → tool-detail-panel-R2Ps4SFd.js} +1 -1
- package/dist/assets/{trust-rules-api-BtUxkSk-.js → trust-rules-api-DRJ1qP-y.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-LBtCDPbE.js → upgrade-cancel-page-BpWlhb2S.js} +1 -1
- package/dist/assets/{upgrade-success-page-DLXxfvLv.js → upgrade-success-page-DMfLGMb7.js} +1 -1
- package/dist/assets/{use-assistant-capability-CmwC8eoT.js → use-assistant-capability-C-yHcMH4.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-DqD-wXki.js → use-assistant-identity-details-u9sG9ip2.js} +1 -1
- package/dist/assets/{use-attachment-preview-BfZe160h.js → use-attachment-preview-Cq_IWTdT.js} +2 -2
- package/dist/assets/{use-attachment-squares-jfCXyibr.js → use-attachment-squares-BKi30wmg.js} +1 -1
- package/dist/assets/{use-bookmarks-Dg-dtmf5.js → use-bookmarks-Bl4tx8xK.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-CrQDcwu4.js → use-checkout-dismiss-refresh-i_YGChIi.js} +1 -1
- package/dist/assets/use-command-palette-sections-x9GwOqBH.js +1 -0
- package/dist/assets/{use-edge-swipe-CJ8niuZL.js → use-edge-swipe-C4IrskOL.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-BRaFRc9L.js → use-edge-swipe-back-Bho1EB_6.js} +2 -2
- package/dist/assets/{use-edit-app-CAyA09nW.js → use-edit-app-ByAfCYIL.js} +1 -1
- package/dist/assets/{use-is-org-ready-B-rv0-nk.js → use-is-org-ready-B6PEUh3C.js} +1 -1
- package/dist/assets/use-onboarding-login-CUF0gvzm.js +1 -0
- package/dist/assets/{use-platform-assistant-id-COWBauzz.js → use-platform-assistant-id-BsBD77_E.js} +1 -1
- package/dist/assets/{use-platform-gate-8R99CXWd.js → use-platform-gate-D-6OU7px.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-TyskDXwF.js → use-return-to-short-circuit-vR213TlL.js} +1 -1
- package/dist/assets/{use-side-list-room-DtmLatRX.js → use-side-list-room-CUXPQyjw.js} +1 -1
- package/dist/assets/{use-skill-actions-DzEYf_yj.js → use-skill-actions-AL5K22mq.js} +1 -1
- package/dist/assets/use-sticky-profiles-DCwdDJxr.js +1 -0
- package/dist/assets/{use-stt-language-selection-DBG-8936.js → use-stt-language-selection-ByQqnnvA.js} +1 -1
- package/dist/assets/{use-subagent-card-data-CTkK6bHj.js → use-subagent-card-data-DlVOBxXw.js} +1 -1
- package/dist/assets/use-transcript-message-by-id-FmIIrRsf.js +1 -0
- package/dist/assets/{use-transcript-messages-BvoNGyuA.js → use-transcript-messages-Q1PBxvSF.js} +1 -1
- package/dist/assets/{use-voice-sample-preview-DkWIdjMi.js → use-voice-sample-preview-pUE3mp-N.js} +1 -1
- package/dist/assets/{useTranslation-G7Ay-pzy.js → useTranslation-qxtkEXxq.js} +1 -1
- package/dist/assets/{voice-page-BiAEmFcW.js → voice-page-J1jrZ5Gp.js} +1 -1
- package/dist/assets/{voice-providers-note-DmCKsoh8.js → voice-providers-note-TDQxSwUj.js} +1 -1
- package/dist/assets/{web-C6ruWL7-.js → web-CxX3pST-.js} +1 -1
- package/dist/assets/{web-ByBZa2-p.js → web-D1mJSG8v.js} +1 -1
- package/dist/assets/welcome-screen-B0pdRH8I.js +1 -0
- package/dist/assets/{workflow-detail-panel-Dwmkf-6A.js → workflow-detail-panel-CglT9-wi.js} +1 -1
- package/dist/assets/{workflow-store-DMcem5b6.js → workflow-store-BXqyb8CL.js} +1 -1
- package/dist/assets/{workspace-page-CqkWCj10.js → workspace-page-sDh1boBK.js} +1 -1
- package/dist/assets/{workspace-tree-query-BmugmuTC.js → workspace-tree-query-Dyls8wmV.js} +1 -1
- package/dist/index.html +93 -93
- package/package.json +1 -1
- package/dist/assets/account-C-_tLpl9.js +0 -1
- package/dist/assets/api-Cet3wU2m.js +0 -1
- package/dist/assets/channels-page-route-CV1KYFZP.js +0 -9
- package/dist/assets/checkout-return-target-Bj6qL3Z7.js +0 -1
- package/dist/assets/command-palette-window-page-BpJh54nn.js +0 -1
- package/dist/assets/companion-surface-page-CPVIM_YY.js +0 -1
- package/dist/assets/conversation-cache-C3KMXxZQ.js +0 -1
- package/dist/assets/conversation-queries-BkhCpgfG.js +0 -1
- package/dist/assets/esm-B8RIzuiy.js +0 -2
- package/dist/assets/file-markdown-Br-X9E8g.js +0 -2
- package/dist/assets/home-tool-permission-card-BjKBLMiw.js +0 -1
- package/dist/assets/index-DxfWJEkZ.css +0 -2
- package/dist/assets/integrations-page-DuVkrLeG.js +0 -1
- package/dist/assets/login-page-B4F-3yLv.js +0 -1
- package/dist/assets/multi-activity-group-mJeyn_8v.js +0 -1
- package/dist/assets/native-anchor-WUfwamgX.js +0 -1
- package/dist/assets/native-auth-error-B4gY5JEl.js +0 -1
- package/dist/assets/open-workspace-file-BxWvTr0R.js +0 -2
- package/dist/assets/page-shell-3Yi5Ezsv.js +0 -1
- package/dist/assets/page-surface-store-d61YqYCV.js +0 -1
- package/dist/assets/research-onboarding-route-Chr89yg5.js +0 -50
- package/dist/assets/routes-BLMWzYB3.js +0 -24
- package/dist/assets/section-membership-B23vBXXp.js +0 -1
- package/dist/assets/settings-aUfLdBRz.js +0 -1
- package/dist/assets/settings-navigation-DaSxG0Zb.js +0 -1
- package/dist/assets/use-command-palette-sections-CoqpqLv8.js +0 -1
- package/dist/assets/use-onboarding-login-B9TNB1cb.js +0 -1
- package/dist/assets/use-sticky-profiles-0khxS8vF.js +0 -1
- package/dist/assets/use-transcript-message-by-id-DTaTEqgT.js +0 -1
- package/dist/assets/welcome-screen-6T3FMS9l.js +0 -1
- /package/dist/assets/{app-types-DhugcUAb.js → app-types-DET4dder.js} +0 -0
- /package/dist/assets/{archive-redirect-page-DddErONf.js → archive-redirect-page-LFqfq3Zx.js} +0 -0
- /package/dist/assets/{billing-redirect-page-CaXtswvd.js → billing-redirect-page-B6zuKMxb.js} +0 -0
- /package/dist/assets/{build.umd-Bnx74y6d.js → build.umd-CwkQd6wk.js} +0 -0
- /package/dist/assets/{channels-BdtsaKuZ.js → channels-CXuBInAc.js} +0 -0
- /package/dist/assets/{chat-BDM2Rt2I.js → chat-1xy90pMn.js} +0 -0
- /package/dist/assets/{common-CYa3Lx5T.js → common-EmSgsWNa.js} +0 -0
- /package/dist/assets/{contacts-Adtv7fIG.js → contacts-BRU7ohw2.js} +0 -0
- /package/dist/assets/{credential-requests-BjLAoauv.js → credential-requests-BbBZKJHx.js} +0 -0
- /package/dist/assets/{danger-zone-redirect-page-C45lMfXW.js → danger-zone-redirect-page-BuIG9f9S.js} +0 -0
- /package/dist/assets/{definitions-BvE4YCqW.js → definitions-Co0yLSy_.js} +0 -0
- /package/dist/assets/{definitions-BOuhvvgh.js → definitions-Yz8Uao4u.js} +0 -0
- /package/dist/assets/{devices-redirect-page-CTLNcuXg.js → devices-redirect-page-BoKYF1E9.js} +0 -0
- /package/dist/assets/{diff-rows-CMQi83GC.js → diff-rows-BrFK496i.js} +0 -0
- /package/dist/assets/{emoji-catalog-data-zwouAP3d.js → emoji-catalog-data-BIIBfSqk.js} +0 -0
- /package/dist/assets/{environment-store-CgcCuCfv.js → environment-store-C4So_j-o.js} +0 -0
- /package/dist/assets/{esm-B3RQnhQB.js → esm-BJhqsukI.js} +0 -0
- /package/dist/assets/{esm-U4mAZE_5.js → esm-CPFvOH-c.js} +0 -0
- /package/dist/assets/{external-urls-B0QJBkzP.js → external-urls-Bg18AU4S.js} +0 -0
- /package/dist/assets/{file-editor-C2Qy2Ujg.js → file-editor-BwdObVSu.js} +0 -0
- /package/dist/assets/{home-DaG8KIqs.js → home-BwSxL4rM.js} +0 -0
- /package/dist/assets/{intelligence-B920vsi4.js → intelligence-DXpXyKbw.js} +0 -0
- /package/dist/assets/{keyboard-shortcuts-redirect-page-DSUfuOqd.js → keyboard-shortcuts-redirect-page-DSnux9sJ.js} +0 -0
- /package/dist/assets/{library-DqQriY4U.js → library-CuKVNDEp.js} +0 -0
- /package/dist/assets/{link-click-3KBltS8g.js → link-click-BsxbQxDe.js} +0 -0
- /package/dist/assets/{logs-s74ABgur.js → logs-Blq4k473.js} +0 -0
- /package/dist/assets/{machine-sizes-BEgYDPIN.js → machine-sizes-DzJ0TVYS.js} +0 -0
- /package/dist/assets/{media-preview-C0jyQw5_.js → media-preview-HgLvcAQ9.js} +0 -0
- /package/dist/assets/{onboarding-orcvuvpJ.js → onboarding-DK0I_g8T.js} +0 -0
- /package/dist/assets/{page-empty-state-BG1VeXc8.js → page-empty-state-CzHxZkBR.js} +0 -0
- /package/dist/assets/{password-reset-page-D4zTOGaM.js → password-reset-page-D8ONrPU-.js} +0 -0
- /package/dist/assets/{pdf-CjG-njep.js → pdf-UON6A_nT.js} +0 -0
- /package/dist/assets/{plugin-attribution-CcHpmela.js → plugin-attribution-C0u-eDRH.js} +0 -0
- /package/dist/assets/{plugin-detail-page-DWr7S8VR.js → plugin-detail-page--CvX0OXv.js} +0 -0
- /package/dist/assets/{plugins-page-BZLdfa7d.js → plugins-page-CZ16U_6n.js} +0 -0
- /package/dist/assets/{profile-metadata-CsakJtzD.js → profile-metadata-D9zzZn4_.js} +0 -0
- /package/dist/assets/{provider-key-CsMdPcM5.js → provider-key-DpdSx5gG.js} +0 -0
- /package/dist/assets/{radio-card-nav-D_-kt3tm.js → radio-card-nav-CrM7VJUk.js} +0 -0
- /package/dist/assets/{remote-web-DxCgPeJc.js → remote-web-DBCYTF2P.js} +0 -0
- /package/dist/assets/{schedules-D3oXqJMY.js → schedules-C3wE8OML.js} +0 -0
- /package/dist/assets/{schedules-rtwsTU7E.js → schedules-Co4-ymK5.js} +0 -0
- /package/dist/assets/{security-redirect-page-DbXxE5Ym.js → security-redirect-page-D6x3MANY.js} +0 -0
- /package/dist/assets/{setting-row-C0mDhzZy.js → setting-row-BvQpFvtr.js} +0 -0
- /package/dist/assets/{signup-shell-DnLhiMGV.js → signup-shell-DW976E_0.js} +0 -0
- /package/dist/assets/{skill-icon-sj-wJGzd.js → skill-icon-yVnZg-J1.js} +0 -0
- /package/dist/assets/{skills-page-yj4WNgG3.js → skills-page-B_VTCiN2.js} +0 -0
- /package/dist/assets/{system-events-redirect-page-Dbxsscgn.js → system-events-redirect-page-DbyqOqe_.js} +0 -0
- /package/dist/assets/{terminal-og9TTXfZ.js → terminal-_tzbWcM4.js} +0 -0
- /package/dist/assets/{usage-redirect-page-NZfMbBv6.js → usage-redirect-page-DyTnwv4x.js} +0 -0
- /package/dist/assets/{use-skill-detail-files-DNaNHaP0.js → use-skill-detail-files-Bg4G44J3.js} +0 -0
- /package/dist/assets/{use-supports-credentials-settings-BCD9S39r.js → use-supports-credentials-settings-Cj-Py42f.js} +0 -0
- /package/dist/assets/{use-truncated-blob-text-CHF4X4vL.js → use-truncated-blob-text-BYAPiP8I.js} +0 -0
- /package/dist/assets/{weather-forecast-display-8i3-jfUZ.js → weather-forecast-display-D3IBgGHv.js} +0 -0
- /package/dist/assets/{web-DXzSQlx4.js → web-B60tNeyj.js} +0 -0
- /package/dist/assets/{web-Crg_ekZH.js → web-BSizndvP.js} +0 -0
- /package/dist/assets/{web-to2ecOqW.js → web-CXad-fWd.js} +0 -0
- /package/dist/assets/{web-xhYMQG7j.js → web-Cpz2h_dP.js} +0 -0
- /package/dist/assets/{web-eg_n1fSm.js → web-Cr238HhI.js} +0 -0
- /package/dist/assets/{web-B5o07_c8.js → web-Nd-L7NoL.js} +0 -0
- /package/dist/assets/{web-Ctf28EEk.js → web-W2HEHjFb.js} +0 -0
- /package/dist/assets/{workspace-BBqltPoi.js → workspace-BFa6JWKe.js} +0 -0
- /package/dist/assets/{xterm-DJn4nvHR.js → xterm-DFQikp5h.js} +0 -0
- /package/dist/assets/{xterm-addon-fit-DEYHenuA.js → xterm-addon-fit-B04vX_IV.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{i as t,l as n}from"./local-settings-Bx7FsNo5.js";import{o as r,r as i}from"./device-settings-DZvv4pnY.js";import{t as a}from"./capture-error-DiNp24s6.js";import{t as o}from"./react-BFJW0bSv.js";import{t as s}from"./button-VkxVX0DM.js";import{d as c,h as l,t as u}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as d}from"./QueryClientProvider-EuRl-wrW.js";import{t as f}from"./useQuery-CTSuec5b.js";import{t as p}from"./useMutation-D2YPyfEH.js";import{t as m}from"./jsx-runtime-BJ8jcmzB.js";import{t as h}from"./cn-Cf8SmgbR.js";import{t as g}from"./card-DUsAeHUS.js";import{d as _,o as v}from"./list-row-CDwzGT9g.js";import{t as y}from"./createLucideIcon-B-ZPaMbU.js";import{t as b}from"./bell-CHRdx4mp.js";import{t as x}from"./check-pgeLaeXx.js";import{t as S}from"./chevron-down-CmQCCo_x.js";import{t as C}from"./circle-alert-DvkPmyIg.js";import{t as w}from"./circle-check-BlOeCme9.js";import{t as T}from"./hard-drive-BV9-fN_J.js";import{t as E}from"./heart-Bd-pnn1X.js";import{t as D}from"./loader-circle-DYe85z3g.js";import{t as O}from"./monitor-BHYV5XBf.js";import{t as k}from"./moon-CZZGDGLY.js";import{C as A,S as j,T as M,b as N,d as ee,h as P,i as te,l as F,m as ne,n as I,o as L,t as re,u as ie}from"./composer-settings-CacCpRW8.js";import{t as ae}from"./refresh-cw-p138DTtp.js";import{t as oe}from"./rotate-ccw-Cs7aCSL9.js";import{t as se}from"./smartphone-AcA2Q0mQ.js";import{t as ce}from"./sparkles-Bhr0JiLM.js";import{t as le}from"./sun-BzqYfTxT.js";import{t as ue}from"./triangle-alert-43gIbLca.js";import{t as de}from"./x-zfSDUG5z.js";import{t as R}from"./notice-BlYF-xU3.js";import{t as fe}from"./progress-bar-C4e3e4vV.js";import{B as pe,a as me,o as he,r as ge,z as _e}from"./src-qDZBwoEm.js";import{t as ve}from"./tag-Ddzwz3ij.js";import{t as z}from"./input-DkgpMeG9.js";import{t as ye}from"./toggle-0qt1e_3r.js";import{t as B}from"./modal-UYNawsIu.js";import{n as V}from"./toast-DqqWkjsh.js";import{t as be}from"./confirm-dialog-Drw1adml.js";import{t as xe}from"./select-BKyejRky.js";import{t as H}from"./skeleton-D8_lkywC.js";import{C as Se,M as Ce,P as we,S as Te,V as Ee,Y as De,_ as Oe,a as ke,f as Ae,i as je,p as Me,u as Ne,v as Pe,z as Fe}from"./local-mode-BNr2MrWI.js";import{t as U}from"./is-electron-wgAC5Mzb.js";import{r as Ie}from"./resolved-assistants-store-BNadgXqb.js";import"./i18n-WHkGP0v4.js";import{t as Le}from"./useTranslation-G7Ay-pzy.js";import{i as W,n as Re,t as ze}from"./api-errors-CASENJGT.js";import{r as Be,t as Ve}from"./semver-C2-EZfiR.js";import{i as He}from"./utils-BEkyAhbA.js";import{$ as Ue,E as We,S as Ge,T as Ke,Z as qe,a as Je,g as Ye,n as Xe,q as Ze,tt as Qe,w as $e,x as et}from"./auth-store-DdlZ1ww5.js";import{t as G}from"./client.gen-CxTOBLiH.js";import{$ as tt,C as nt,N as rt,P as it,Q as at,T as ot,W as st,Wt as ct}from"./sdk.gen-DWvuzSBW.js";import{a as lt,o as ut}from"./api-CQ3nejmH.js";import{c as dt}from"./remote-gateway-session-CzPLaXuT.js";import{t as K}from"./client-feature-flag-store-D5JmN6Ek.js";import{d as q}from"./routes-B7wRw3UT.js";import{d as ft,h as pt,o as mt,p as ht,u as gt}from"./platform-detection-Dt0-jSAU.js";import{i as _t,r as vt,t as yt}from"./use-platform-gate-8R99CXWd.js";import{A as bt,D as xt,E as St,Ft as Ct,It as wt,Lt as Tt,Mt as Et,N as Dt,Nt as Ot,O as kt,Ot as At,P as jt,Pt as Mt,T as Nt,c as Pt,ft as Ft,j as It,k as Lt,kt as Rt,mt as zt,v as Bt,w as Vt,wt as Ht}from"./react-query.gen-CwRPAiHT.js";import{t as Ut}from"./hard-navigate-CNxvVrtC.js";import{t as Wt}from"./assistant-feature-flag-store-DrLJ0Qcv.js";import{t as Gt}from"./pointer-BMK9brNn.js";import{n as Kt,t as qt}from"./retire-confirm-dialog-BjtXvcXF.js";import{a as Jt,i as Yt,r as Xt,s as Zt}from"./local-runtime-upgrade-CFsjLDQO.js";import{t as Qt}from"./copy-to-clipboard-D76_3Coc.js";import{t as $t}from"./proxy-CT_qJI1K.js";import{t as en}from"./AnimatePresence-CxaKvfs9.js";import{t as tn}from"./use-reduced-motion-CU3dPXKf.js";import{t as J}from"./platform-login-notice-C6p4PqvT.js";import{t as nn}from"./use-active-assistant-id-BADYKVyx.js";import{t as rn}from"./use-copy-to-clipboard-B7Yrgm0s.js";import{t as Y}from"./detail-card-BzCuPjtL.js";import{t as an}from"./app-info-CvBesesf.js";import{a as on,i as sn,l as cn,o as ln}from"./machine-sizes-BEgYDPIN.js";import{t as un}from"./environment-store-CgcCuCfv.js";import{a as dn,i as fn,n as pn,r as mn,t as hn}from"./assistant-status-panel-YLnGIq50.js";import{t as gn}from"./settings-divider-DGdHGRSV.js";var _n=y(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),vn=y(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),yn=y(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),X=e(o(),1),Z=m();function bn(){let e=K.use.velvet(),{theme:t,setThemePreference:n}=ne(),r=[{value:`system`,label:`System`,icon:(0,Z.jsx)(O,{className:`h-4 w-4`})},{value:`light`,label:`Light`,icon:(0,Z.jsx)(le,{className:`h-4 w-4`})},{value:`dark`,label:`Dark`,icon:(0,Z.jsx)(k,{className:`h-4 w-4`})},...e?[{value:`velvet`,label:`Velvet`,icon:(0,Z.jsx)(E,{className:`h-4 w-4`})}]:[]];return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Theme`}),(0,Z.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,Z.jsx)(v,{ariaLabel:`Theme`,value:t,onChange:n,items:r})})]})}var xn=et,Sn=`Please choose a different handle.`;async function Cn(e,t){let{data:n,error:r,response:i}=await it({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:W(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=We(r,`handle`,xn.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=We(r,`handle`,Sn);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:W(r,i,`Failed to save handle.`)}}async function wn(e,t,n){let{data:r,error:i,response:a}=await nt({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(Re(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new ze(a.status,a.status===429?`Too many checks — try again in a moment.`:W(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function Tn(e){return/\d{2,}$/.test(e)}var En=300,Dn=1400;function On({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:c,fieldId:l}){let[u,d]=(0,X.useState)(e),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(`idle`),[v,y]=(0,X.useState)(null),b=tn(),S=(0,X.useRef)(null),w=(0,X.useMemo)(()=>u.trim().toLowerCase(),[u]),T=w===e.toLowerCase();(0,X.useEffect)(()=>{if(T||w.length===0){h(!1),S.current?.abort();return}let e=new AbortController;S.current?.abort(),S.current=e,h(!0);let t=window.setTimeout(async()=>{try{let t=await i(w,e.signal);e.signal.aborted||p(t)}catch(t){e.signal.aborted||y(t instanceof Error?t.message:`Couldn't check availability.`)}finally{e.signal.aborted||h(!1)}},En);return()=>{window.clearTimeout(t),e.abort()}},[w,T,i]);let E=(()=>{if(v)return v;if(f&&!f.available){let e=f.code;return f.message??(e?xn[e]:`Please choose a different handle.`)}return null})(),O=E?n:T?r??null:m?`Checking availability…`:f?.available?`Available.`:null,k=!T&&!m&&f?.available!==!1&&g!==`saving`,A=(0,X.useCallback)(async()=>{if(!k)return;_(`saving`),y(null);let e=await a(w);if(e.kind===`ok`){_(`saved`),o(e.data),V.success(c),window.setTimeout(()=>_(`idle`),Dn);return}if(e.kind===`taken`){_(`idle`),p({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){_(`idle`),p({available:!1,code:e.code,message:e.message});return}_(`error`),y(e.message),V.error(e.message)},[k,w,o,a,c]),j=(()=>{if(T&&u.length>0||u.length===0)return null;let e=m?`checking`:f?.available?`available`:f?.available===!1?`invalid`:null;return e?(0,Z.jsx)(en,{mode:`wait`,initial:!1,children:(0,Z.jsxs)($t.span,{initial:b?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:b?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Z.jsx)(x,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":`Available`}),e===`invalid`&&(0,Z.jsx)(C,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":`Not available`})]},e)}):null})(),M=(()=>{switch(g){case`saving`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(D,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Saving…`]});case`saved`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(x,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Saved`]});default:return`Save`}})();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(z,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),p(null),y(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:j,errorText:E??void 0,helperText:O??void 0,"aria-invalid":!!E,fullWidth:!0,"data-testid":`${l}-input`}),(!T||g!==`idle`)&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(s,{variant:`primary`,size:`compact`,onClick:A,disabled:!k,"aria-live":`polite`,"data-testid":`${l}-save`,children:M})})]})}function kn({initial:e,onSaved:t}){let n=Xe.use.refreshSession(),r=Tn(e.username)?`Your handle was auto-generated at signup — pick one you like.`:void 0,i=(0,X.useCallback)(async e=>await Ke({username:e}),[]),a=(0,X.useCallback)((e,t)=>Ge(e,t),[]),o=(0,X.useCallback)(e=>{t(e),n()},[t,n]);return(0,Z.jsx)(On,{initialHandle:e.username,inputLabel:`User handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:r,checkAvailable:a,save:i,onSaved:o,saveSuccessToast:`Profile updated.`,fieldId:`user-handle`})}function An({assistant:e,onSaved:t}){let n=e.handle??``,r=f({...Pt({path:{assistant_id:e.id}})}).data?.results?.[0],i=!!r&&r.subdomain.toLowerCase()===n.toLowerCase(),a=n.length===0?`Your assistant doesn't have a handle yet — claim one to make it mentionable.`:void 0,o=(0,X.useCallback)(async t=>await Cn(e.id,t),[e.id]),s=(0,X.useCallback)((t,n)=>wn(e.id,t,n),[e.id]);return i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(z,{label:`Assistant handle`,value:n,readOnly:!0,disabled:!0,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Your assistant's handle is locked because it's used as its email subdomain. To change it,`,` `,(0,Z.jsx)(u,{to:`${q.settings.ai}?release=1#email`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`release the subdomain`}),` `,`first.`]})]}):(0,Z.jsx)(On,{initialHandle:n,inputLabel:`Assistant handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:a,checkAvailable:s,save:o,onSaved:t,saveSuccessToast:`Assistant handle updated.`,fieldId:`assistant-handle`})}function jn(){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(H,{className:`h-3 w-16`}),(0,Z.jsx)(H,{className:`h-9 w-full rounded-md`}),(0,Z.jsx)(H,{className:`h-3 w-72`})]}),(0,Z.jsx)(H,{className:`h-9 w-full rounded-md`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(H,{className:`h-3 w-60`}),(0,Z.jsx)(H,{className:`h-7 w-16 rounded-md`})]}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Loading your profile…`})]})}function Mn(){return(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`})}function Nn({assistant:e,showHandles:t=!0,children:n}={}){let r=Xe.use.user?.()?.email??null;return(0,Z.jsx)(Y,{title:`Profile`,subtitle:`Manage your account details and preferences.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[r&&(0,Z.jsx)(`div`,{className:`max-w-[420px]`,children:(0,Z.jsx)(z,{label:`Email`,value:r,disabled:!0,readOnly:!0})}),t&&(0,Z.jsxs)(Z.Fragment,{children:[r&&(0,Z.jsx)(Mn,{}),(0,Z.jsx)(Pn,{assistant:e})]}),n!=null&&(0,Z.jsxs)(Z.Fragment,{children:[(r||t)&&(0,Z.jsx)(Mn,{}),n]})]})})}function Pn({assistant:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),a=tn(),[o,s]=(0,X.useState)(e??null);return(0,X.useEffect)(()=>{s(e??null)},[e]),(0,X.useEffect)(()=>{let e=!1;return $e().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),r?(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Z.jsxs)($t.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Z.jsx)(kn,{initial:t,onSaved:n}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(An,{assistant:o,onSaved:s})]})]}):(0,Z.jsx)(jn,{})}var Fn=Bt({query:{hosting:`platform`}});function In(){let e=nn(),t=f(Fn),n=t.data?.results??[];return t.isPending||n.length<2?null:(0,Z.jsx)(Y,{title:`Switch Assistant`,subtitle:`Choose which assistant is active for this account.`,children:(0,Z.jsx)(`div`,{className:`space-y-2`,children:n.map(t=>{let n=t.id===e;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(O,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:t.name||`Unnamed`}),t.status!==`active`&&(0,Z.jsx)(ve,{tone:`warning`,children:t.status})]})})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:n?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Z.jsx)(x,{className:`h-4 w-4`}),`Active`]}):(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,disabled:t.status!==`active`,onClick:()=>{qe(t.id),V.success(`Switched active assistant.`)},children:`Switch`})})]},t.id)})})})}var Ln=[{label:`Never`,seconds:0},{label:`5 min`,seconds:300,devOnly:!0},{label:`10 min`,seconds:600,devOnly:!0},{label:`1 hour`,seconds:3600},{label:`3 hours`,seconds:10800},{label:`1 day`,seconds:86400},{label:`3 days`,seconds:259200},{label:`7 days`,seconds:604800},{label:`14 days`,seconds:1209600},{label:`30 days`,seconds:2592e3}];function Rn(e){if(e===0)return`Never (sleep disabled)`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600);if(t>0&&n>0)return`${t}d ${n}h`;if(t>0)return`${t} day${t===1?``:`s`}`;if(n>0)return`${n} hour${n===1?``:`s`}`;let r=Math.floor(e/60);return r>0?`${r} minute${r===1?``:`s`}`:`${e}s`}function zn({assistantId:e}){let t=d(),n=un.use.isNonProduction(),r=(0,X.useMemo)(()=>Ln.filter(e=>!e.devOnly||n),[n]),{data:i,isLoading:a,isError:o}=f(bt({path:{id:e}})),c=(0,X.useMemo)(()=>i?.idle_timeout_seconds??259200,[i]),[l,u]=(0,X.useState)(null),p=l??c,m=l!==null,h=Rt({onSuccess:()=>{V.success(`Sleep policy saved.`),u(null),t.invalidateQueries({queryKey:It({path:{id:e}})})},onError:()=>{V.error(`Failed to save sleep policy. Please try again.`)}});return a?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading sleep settings...`]}):o?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load sleep policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Idle timeout`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`How long the assistant can be idle before it is put to sleep. "Never" disables idle sleep entirely.`}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:r.map(e=>(0,Z.jsx)(s,{variant:`outlined`,active:p===e.seconds,onClick:()=>u(e.seconds),children:e.label},e.seconds))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:[`Current: `,Rn(p)]})]}),m&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(s,{variant:`primary`,leftIcon:h.isPending?(0,Z.jsx)(D,{className:`animate-spin`}):void 0,onClick:()=>h.mutate({path:{id:e},body:{idle_timeout_seconds:p}}),disabled:h.isPending,children:`Save`}),(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>u(null),disabled:h.isPending,children:`Cancel`})]})]})}function Bn(e,t,n){let r=[e.version];return e.version===n&&r.push(`(latest)`),t&&e.version===t&&r.push(`(current)`),r.join(` `)}var Vn=3e3;function Hn({version:e,assistantId:t}){let{onTap:n,message:r}=fn(t);return(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,Z.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:r})]})}function Un({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let i=Wt.use.rollbackEnabled(),a=K.use.previewChannel(),o=d(),c=Yt(n,a),l=c===`preview`,[u,m]=(0,X.useState)(!1),h=(0,X.useRef)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),w=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{C(b?`Successfully rolled back to version ${h.current}.`:`Successfully updated to version ${h.current}.`),m(!1),h.current=null,_(null),V.success(b?`Rollback complete. Your assistant is healthy.`:`Update complete. Your assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):Vn;f({...kt({path:{id:e}}),refetchInterval:u?e=>w(e.state.data?.current_release_version):!1});let{data:T,isLoading:E}=f(Ht({query:{channel:c}})),O=T?.find(e=>e.is_stable!==!1)??T?.[0],k=g??O?.version??null,A=(0,X.useMemo)(()=>{if(!i||!k||!t)return!1;let e=Be(k),n=Be(t);return!e||!n?!1:Ve(e,n)<0},[i,k,t]),j=(0,X.useMemo)(()=>{if(!k)return!1;if(!t)return!0;let e=Be(k),n=Be(t);if(!e||!n)return k!==t;let r=Ve(e,n);return i?r!==0:r>0},[i,k,t]),M=p({mutationFn:async t=>{let{data:n}=await at({path:{id:e},body:t,throwOnError:!0});return n}}),N=p({mutationFn:async t=>{let{data:n}=await st({path:{id:e},body:t,throwOnError:!0});return n}});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(Hn,{version:t,assistantId:e})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:l?`Preview release`:j?A?`Rollback to`:`Update to`:`Selected`}),(0,Z.jsx)(`span`,{className:`block min-w-0`,children:E?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`}),`Loading...`]}):T&&T.length>0?i?(0,Z.jsx)(xe,{value:k??``,onChange:e=>_(e===O?.version?null:e),disabled:u||M.isPending||N.isPending,options:T.map(e=>({value:e.version,label:Bn(e,t,O?.version)}))}):(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:O?Bn(O,t,O.version):`—`}):`No releases available`})]})]}),(0,Z.jsx)(s,{variant:A?`outlined`:`primary`,className:`min-w-[160px]`,leftIcon:M.isPending||N.isPending||u?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),onClick:()=>y(!0),disabled:!j||M.isPending||N.isPending||u||E||!T?.length,children:u?b?`Rolling back...`:`Updating...`:A?`Rollback`:l?`Update preview`:`Update`}),l&&(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Using Preview releases.`,` `,(0,Z.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`,children:`Switch back to Stable`})]}),!j&&t&&k&&!E&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:S??`You are already on this version.`}),(0,Z.jsx)(be,{open:v,title:A?`Rollback assistant`:l?`Update preview release`:`Update assistant`,message:A?`Rollback to version ${k??`unknown`}? The assistant will be briefly unavailable.`:l?`Update to preview version ${k??`latest`}? The assistant will be briefly unavailable during the update.`:`Update to version ${k??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:A?`Rollback`:l?`Update preview`:`Update`,onConfirm:async()=>{y(!1),C(null);let t=i?k??void 0:void 0;try{if(A){let e=await N.mutateAsync({version:t});h.current=e.version??t??null,V.success(e.detail||`Rollback to ${t} initiated.`)}else{let e=await M.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){V.warning(e.detail);return}h.current=e.version??t??null,V.success(e.detail||`Update to ${e.version??t??`latest`} initiated.`)}x(A),m(!0),o.invalidateQueries({queryKey:Lt({path:{id:e}})})}catch{V.error(A?`Failed to trigger rollback. Please try again.`:`Failed to trigger update. Please try again.`)}},onCancel:()=>y(!1)})]})}function Wn({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),{data:c,isLoading:l}=f(Ht({query:{stable:!0,limit:100}})),u=(0,X.useMemo)(()=>Xt(c),[c]),d=u?.version,p=t?Jt(t,d):!!d,m=Zt({assistantId:e,targetVersion:d});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(Hn,{version:t,assistantId:e})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Update to`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?`Loading...`:d&&u?Bn(u,t,d):`No releases available`})]})]}),(0,Z.jsx)(s,{variant:`primary`,className:`min-w-[160px]`,leftIcon:m.isPending?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),onClick:()=>i(!0),disabled:m.isPending||l||!d||!p,children:m.isPending?`Updating...`:d?`Update to ${d}`:`Update`}),a&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:a}),!a&&!p&&d&&!l&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:`You are already on this version.`}),(0,Z.jsx)(be,{open:r,title:`Update assistant`,message:`Update to version ${d??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:`Update`,onConfirm:async()=>{i(!1),o(null);try{let e=await m.upgrade();o(e.version?`Successfully updated to version ${e.version}.`:`Successfully updated to version ${d??`latest`}.`),V.success(`Update complete. Your assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){V.error(e instanceof Error?e.message:`Failed to trigger update. Please try again.`)}},onCancel:()=>i(!1)})]})}function Gn(){let e=_t({platformHostedOnly:!0}),t=vt(),n=Xe.use.user()?.id??null,r=Xe.use.logout(),[i,a]=(0,X.useState)(!1),o=Et({onSuccess:async()=>{V.success(`Account deletion requested. You will be logged out shortly.`),Ye(n),await r(),Ut(q.account.login)},onError:()=>{V.error(`Failed to request account deletion. Please try again.`)}}),c=e===`full`&&t;return(0,X.useEffect)(()=>{c&&i&&a(!1)},[c,i]),e===`gated`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Delete Account`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Permanently delete your account and all associated data.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:e===`disabled`?(0,Z.jsx)(J,{children:`Log in to the Vellum platform to delete your account.`}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>a(!0),disabled:o.isPending||c,className:`self-start`,children:`Delete My Account`}),c&&(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,Z.jsx)(be,{open:i,title:`Delete Account`,message:`This will permanently delete your account and all associated data. This action cannot be undone.`,confirmLabel:`Delete Account`,destructive:!0,onConfirm:()=>{if(c){a(!1);return}a(!1),o.mutate({})},onCancel:()=>a(!1)})]})}function Kn({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Z.jsx)(Y,{title:e,subtitle:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Z.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Z.jsx)(s,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function qn(){let e=ft(),t=gt(),n=e?`ios`:t?`android`:null,r=n?te(n):null;return r?(0,Z.jsx)(Kn,{title:`Get the ${r.appName} App`,subtitle:`The Vellum ${r.appName} app gives you a native experience.`,benefits:[{icon:b,text:`Push notifications`},{icon:_n,text:`Biometric login`},{icon:yn,text:`Native haptics`},{icon:se,text:`Home screen access`}],ctaLabel:`Download`,ctaLeftIcon:(0,Z.jsx)(se,{size:16}),onAction:()=>{F(r.platform),L(r.platform)}}):null}var Jn=`0.10.0`;function Yn(){return He(Jn)}var Xn=[`login.tailscale.com`,`tailscale.com`,`www.tailscale.com`,`ngrok.com`,`dashboard.ngrok.com`,`dash.cloudflare.com`,`cloudflare.com`,`www.cloudflare.com`];function Zn(e){let t;try{t=new URL(e).hostname}catch{return!1}return Xn.includes(t)}function Qn(e){let t;try{t=new URL(e).hostname}catch{return null}return Xn.includes(t)?t.includes(`tailscale`)?`Tailscale`:t.includes(`ngrok`)?`ngrok`:t.includes(`cloudflare`)?`Cloudflare`:null:null}function $n(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`[::1]`||/^127(?:\.\d{1,3}){3}$/.test(t)}catch{return!1}}function er(e){let t=new URL(e);t.search=``,t.hash=``;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`assistant`);return r>=0&&n.splice(r),t.pathname=n.length?`/${n.join(`/`)}`:`/`,t.toString().replace(/\/+$/,``)}function tr(e){let t;try{t=er(e)}catch{return{ok:!1,reason:`unparseable`}}return $n(t)?{ok:!1,reason:`loopback`}:Zn(t)?{ok:!1,reason:`service-website`}:new URL(t).protocol===`https:`?{ok:!0,url:t}:{ok:!1,reason:`non-https`}}function nr(e){let t=new URL(e.verificationUri);return t.hash=new URLSearchParams({device_code:e.deviceCode}).toString(),t.toString()}function rr(e,t){switch(e){case`unparseable`:return`Enter a valid URL, e.g. https://your-assistant.ts.net.`;case`loopback`:return`This is a loopback address other devices can't reach. Enter the assistant's public https URL.`;case`non-https`:return`The URL must use https so your devices can connect securely.`;case`service-website`:return`This is ${t&&Qn(t)||`the tunnel provider`}'s website, not your assistant's address. Run \`vellum tunnel\` on the host to get one.`}}var ir=`/v1/remote-web/pairing-challenge`,ar=`/v1/remote-web/pairing-verification`,or="If a scan can't connect, make sure a tunnel is running on the host (`vellum tunnel`) and the public URL points at it, then generate a new code.",sr=class extends Error{hint;constructor(e,t){super(e),this.name=`PairDeviceError`,this.hint=t}};function cr(){if(typeof window>`u`)return null;let e=Me(),t=ke(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function lr(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}async function ur(e,t,n){let r;try{r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?e:new sr(`Couldn't reach the assistant. Make sure it's running and try again.`)}let i=await r.json().catch(()=>null);if(!r.ok)throw new sr(lr(i)??`Pairing failed (HTTP ${r.status}).`,or);if(typeof i!=`object`||!i)throw new sr(`The assistant returned an unexpected response.`);return i}async function dr(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await ur(`${t}${ir}`,{publicBaseUrl:n},r);return await ur(`${t}${ar}`,{userCode:i.userCode},r),{pairUrl:nr(i),expiresAt:i.expiresAt}}var fr=Object.defineProperty,pr=Object.getOwnPropertySymbols,mr=Object.prototype.hasOwnProperty,hr=Object.prototype.propertyIsEnumerable,gr=(e,t,n)=>t in e?fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_r=(e,t)=>{for(var n in t||={})mr.call(t,n)&&gr(e,n,t[n]);if(pr)for(var n of pr(t))hr.call(t,n)&&gr(e,n,t[n]);return e},vr=(e,t)=>{var n={};for(var r in e)mr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pr)for(var r of pr(e))t.indexOf(r)<0&&hr.call(e,r)&&(n[r]=e[r]);return n},yr;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(yr||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(yr||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(yr||={});var br=yr,xr={L:br.QrCode.Ecc.LOW,M:br.QrCode.Ecc.MEDIUM,Q:br.QrCode.Ecc.QUARTILE,H:br.QrCode.Ecc.HIGH},Sr=128,Cr=`L`,wr=`#FFFFFF`,Tr=`#000000`,Er=!1,Dr=1,Or=4,kr=0,Ar=.1;function jr(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function Mr(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function Nr(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*Ar),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function Pr(e,t){return t==null?e?Or:kr:Math.max(Math.floor(t),0)}function Fr({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=X.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...br.QrSegment.makeSegments(t)),e),[]);return br.QrCode.encodeSegments(r,xr[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=X.useMemo(()=>{let e=c.getModules(),t=Pr(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Nr(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Ir=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Lr=X.forwardRef(function(e,t){let n=e,{value:r,size:i=Sr,level:a=Cr,bgColor:o=wr,fgColor:s=Tr,includeMargin:c=Er,minVersion:l=Dr,boostLevel:u,marginSize:d,imageSettings:f}=n,p=vr(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=vr(p,[`style`]),g=f?.src,_=X.useRef(null),v=X.useRef(null),y=X.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=X.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=Fr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});X.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=Mr(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Ir?t.fill(new Path2D(jr(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),X.useEffect(()=>{x(!1)},[g]);let E=_r({height:i,width:i},m),D=null;return g!=null&&(D=X.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),X.createElement(X.Fragment,null,X.createElement(`canvas`,_r({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Lr.displayName=`QRCodeCanvas`;var Rr=X.forwardRef(function(e,t){let n=e,{value:r,size:i=Sr,level:a=Cr,bgColor:o=wr,fgColor:s=Tr,includeMargin:c=Er,minVersion:l=Dr,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=vr(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=Fr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=Mr(g,v.excavation)),b=X.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=jr(y,h);return X.createElement(`svg`,_r({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&X.createElement(`title`,null,d),X.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),X.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});Rr.displayName=`QRCodeSVG`;function zr(e){if(!Number.isFinite(e)||e<=0)return`Single-use.`;let t=Math.ceil(e/1e3);return`Expires in ${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)} · single-use.`}function Br({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){return n?(0,Z.jsx)(R,{tone:`warning`,title:`This pairing code expired.`,children:`Generate a new code to pair a device.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,Z.jsx)(Rr,{value:e,size:192,level:`M`,title:`Device pairing QR code`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,leftIcon:r?(0,Z.jsx)(x,{}):(0,Z.jsx)(_,{}),onClick:()=>i(e),children:r?`Copied`:`Copy`})]}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:zr(t)})]})}var Vr=`vellum:pair-device:public-base-url`;function Hr(e){let n=e?.trim();if(n)return{url:n,source:`tunnel`};let r=t(Vr,``).trim();return r?{url:r,source:`stored`}:{url:``,source:`none`}}function Ur(e,t){let[r]=(0,X.useState)(()=>Hr(t)),[i,o]=(0,X.useState)(r.url),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)({kind:`idle`}),[d,f]=(0,X.useState)(()=>Date.now()),p=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>p.current?.abort(),[]),(0,X.useEffect)(()=>{if(l.kind!==`ready`)return;f(Date.now());let e=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(e)},[l]);let m=(0,X.useCallback)(e=>{o(e),c(null)},[]),h=(0,X.useCallback)(()=>{if(!e)return;let t=i.trim(),r=tr(t);if(!r.ok){c(rr(r.reason,t));return}c(null),p.current?.abort();let o=new AbortController;p.current=o,u({kind:`minting`}),(async()=>{try{let t=await dr({base:e,publicBaseUrl:r.url,signal:o.signal});if(o.signal.aborted)return;n(Vr,r.url),u({kind:`ready`,pairUrl:t.pairUrl,expiresAtMs:Date.parse(t.expiresAt)})}catch(e){if(o.signal.aborted)return;if(e instanceof sr){u({kind:`error`,message:e.message,hint:e.hint});return}a(e,{context:`pair-device-mint`}),u({kind:`error`,message:`Something went wrong while generating the code.`})}})()},[e,i]),g=l.kind===`ready`?Math.max(0,l.expiresAtMs-d):0,_=l.kind===`ready`&&g<=0;return{publicBaseUrl:i,setPublicBaseUrl:m,prefillSource:r.source,inputError:s,phase:l,remainingMs:g,expired:_,generate:h}}function Wr(){let e=cr(),t=Yn(),n=K.use.webRemoteIngress(),r=Ur(e?.base??null,e?.ingressUrl??null),{copy:i,copied:a}=rn({errorMessage:`Could not copy the pairing address.`});if(!e||!t||!n)return null;let{phase:o}=r,c=o.kind===`minting`,l=o.kind===`ready`,u=r.prefillSource===`tunnel`,d=r.prefillSource===`none`&&r.publicBaseUrl.trim()===``,f=c?`Generating…`:l?`Generate new code`:`Generate pairing QR`;return(0,Z.jsx)(Y,{title:`Pair a device`,subtitle:`Scan with another device's camera — or open the link on it — to use ${e.assistantName??`this assistant`} there.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d&&(0,Z.jsx)(R,{tone:`info`,title:`No tunnel detected`,children:"On this computer, run `vellum tunnel --provider tailscale` (or another provider) — its address appears here."}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(z,{label:`Public URL`,fullWidth:!0,placeholder:`https://your-assistant.ts.net`,helperText:u?"This address comes from `vellum tunnel` on this computer. Edit it if your devices reach this assistant at a different URL.":`The https address your devices can reach this assistant at (your Tailscale URL, or another tunnel's).`,value:r.publicBaseUrl,errorText:r.inputError??void 0,disabled:c,onChange:e=>r.setPublicBaseUrl(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),r.generate())}}),(0,Z.jsx)(s,{variant:`primary`,className:`self-start`,disabled:c||r.publicBaseUrl.trim()===``,onClick:r.generate,children:f})]}),o.kind===`error`&&(0,Z.jsx)(R,{tone:`error`,title:o.message,children:o.hint}),l&&(0,Z.jsx)(Br,{pairUrl:o.pairUrl,remainingMs:r.remainingMs,expired:r.expired,copied:a,onCopy:i})]})})}async function Gr(){if(!U())return[];let e=window.vellum;return e?.hotkeys?e.hotkeys.get():[]}async function Kr(e,t){if(!U())return;let n=window.vellum;n?.hotkeys&&await n.hotkeys.set(e,t)}function qr(e){if(!U())return()=>{};let t=window.vellum;return t?.hotkeys?t.hotkeys.onChange(e):()=>{}}var Jr={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},Yr=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),Xr=e=>{let t=e.code;return Yr.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:Jr[t]??null},Zr=e=>{let t=Xr(e);if(t===null)return null;let n=[];return e.metaKey&&n.push(`CmdOrCtrl`),e.ctrlKey&&n.push(`Control`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),[...n,t].join(`+`)},Qr=(e,t,n)=>n===``?null:e.find(e=>e.key!==t&&e.accelerator===n)??null,$r=[{scope:`global`,title:`Global shortcuts`,description:`Work anywhere, even when Vellum is in the background.`},{scope:`menu`,title:`App shortcuts`,description:`Work while a Vellum window is focused.`}];function ei({hotkey:e,recording:t,conflictLabel:n,onStartRecording:r,onCancelRecording:i,onReset:a,onRemove:o}){let c=e.accelerator===``,l=e.override!==null;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,Z.jsxs)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:[`Already used by `,n]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t?(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Recording… press a shortcut, or Esc to cancel`}):c?(0,Z.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`Disabled`}):(0,Z.jsx)(ge,{accelerator:e.accelerator}),t?(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,onClick:i,children:`Cancel`}):(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,onClick:r,"aria-label":`Record shortcut for ${e.label}`,children:`Record`}),(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:!l,leftIcon:(0,Z.jsx)(oe,{className:`h-3.5 w-3.5`}),onClick:a,"aria-label":`Reset ${e.label} to default`}),(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:c,leftIcon:(0,Z.jsx)(de,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":`Remove ${e.label} binding`})]})]})}function ti(){let[e,t]=(0,X.useState)([]),[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(null),o=(0,X.useCallback)(()=>{Gr().then(t)},[]);(0,X.useEffect)(()=>(o(),qr(t)),[o]);let s=(0,X.useCallback)(()=>{r(null),a(null)},[]);(0,X.useEffect)(()=>{if(n===null)return;let t=t=>{if(t.preventDefault(),t.stopPropagation(),t.code===`Escape`){s();return}let r=Zr(t);if(r===null)return;let i=Qr(e,n,r);if(i!==null){a({key:n,label:i.label});return}Kr(n,r).then(o),s()};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[n,e,o,s]);let c=(0,X.useCallback)(e=>{a(null),r(e)},[]),l=(0,X.useCallback)(t=>{let n=Qr(e,t,e.find(e=>e.key===t)?.defaultAccelerator??``);if(n!==null){r(null),a({key:t,label:n.label});return}s(),Kr(t,null).then(o)},[e,o,s]),u=(0,X.useCallback)(e=>{s(),Kr(e,``).then(o)},[o,s]),d=(0,X.useMemo)(()=>$r.map(t=>({...t,commands:e.filter(e=>e.rebindable&&e.scope===t.scope)})).filter(e=>e.commands.length>0),[e]);return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[i!==null&&(0,Z.jsxs)(R,{tone:`warning`,children:[`That shortcut is already used by `,i.label,`.`,` `,n===null?`Remove or change that binding before resetting.`:`Pick a different combination, or press Esc to cancel.`]}),d.map(e=>(0,Z.jsxs)(g,{bordered:!0,children:[(0,Z.jsxs)(`div`,{className:`mb-2`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-emphasised text-[var(--content-default)]`,children:e.title}),(0,Z.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Z.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,Z.jsx)(ei,{hotkey:e,recording:n===e.key,conflictLabel:i!==null&&i.key===e.key?i.label:null,onStartRecording:()=>c(e.key),onCancelRecording:s,onReset:()=>l(e.key),onRemove:()=>u(e.key)},e.key))})]},e.scope))]})}async function ni(){if(!U())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function ri(e){if(!U())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function ii(){let e=re.useValue(),t=I.useValue(),n=!Gt(),r=mt()?`Cmd`:`Ctrl`;return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Composer`}),(0,Z.jsxs)(`div`,{className:`mt-2 space-y-4`,children:[n&&(0,Z.jsx)(ye,{checked:e,onChange:re.save,label:`Send with ${r}+Enter`,helperText:`When enabled, Enter inserts a new line and ${r}+Enter sends.`}),(0,Z.jsx)(ye,{checked:t,onChange:I.save,label:`Show context window usage`,helperText:`Adds a ring to the composer tracking how full the context window is. Your assistant compacts its context automatically either way.`})]})]})}function ai(){let[e,t]=(0,X.useState)(!1);(0,X.useEffect)(()=>{ni().then(t)},[]);let n=async e=>{t(e);try{await ri(e)}catch{t(!e)}};return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Launch at Login`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Automatically start Vellum when you log in to your Mac.`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(ye,{checked:e,onChange:e=>void n(e),"aria-label":`Launch at Login`})})]})}function oi({open:e,onClose:t}){return(0,Z.jsx)(B.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Z.jsxs)(B.Content,{size:`lg`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Preferences`}),(0,Z.jsx)(B.Description,{children:`Customize shortcuts and how Vellum behaves on this device.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[U()&&(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Keyboard Shortcuts`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Customize the shortcuts for Vellum's commands.`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(ti,{})})]}),(0,Z.jsx)(ii,{}),U()&&(0,Z.jsx)(ai,{})]})})]})})}function si(e){return e===`preview`?`preview`:`stable`}function ci(e){if(!e)return`Unknown`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function li(e){return e.source_release_version?`Stable ${e.source_release_version}`:e.snapshot_name}function ui(e){return e.filter(e=>e.ready_to_use)}function di(e){return e?.feature_enabled===!1}function fi({assistantId:e,onComplete:t}){let n=K.use.previewChannel(),r=d(),[i,a]=(0,X.useState)(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,m]=(0,X.useState)(`restore_backup`),[h,g]=(0,X.useState)(``),_=St({path:{assistant_id:e}}),v=xt({path:{assistant_id:e}}),y=Lt({path:{id:e}}),{data:b,isLoading:x,isError:C}=f({..._,enabled:n,retry:!1}),w=b?.preview_backups??[],T=(0,X.useMemo)(()=>ui(w),[w]),E=T[0],O=T.find(e=>e.snapshot_name===h)??E,k=()=>{r.invalidateQueries({queryKey:v}),r.invalidateQueries({queryKey:y}),t?.()},A=p(Vt()),j=p(Nt()),M=si(b?.current_channel),N=A.isPending||j.isPending,ee=N||di(b)||!b?.latest_preview_release,P=u===`restore_backup`&&!O;if((0,X.useEffect)(()=>{a(M===`preview`?`release-channel`:void 0)},[M]),!n)return null;let te=b?.standard_upgrade_available??!1;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(he.Root,{type:`single`,collapsible:!0,value:i,onValueChange:e=>a(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Z.jsxs)(he.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Z.jsxs)(he.Trigger,{className:`group justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Release Channel`}),b&&(0,Z.jsx)(ve,{tone:M===`preview`?`warning`:`neutral`,children:M===`preview`?`Preview`:`Stable`})]}),(0,Z.jsx)(S,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Z.jsx)(he.Content,{children:(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[x&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading release channel...`]}),C&&(0,Z.jsx)(R,{tone:`error`,title:`Could not load release channel status`,children:`Refresh this page before changing release channels.`}),b&&(0,Z.jsxs)(Z.Fragment,{children:[di(b)&&(0,Z.jsx)(R,{tone:`neutral`,title:`Preview channel is unavailable`,children:`The Preview channel is not enabled for this assistant.`}),M===`stable`?(0,Z.jsx)(pi,{status:b,isChangingChannel:N,optInDisabled:ee,onOptIn:()=>s(!0)}):(0,Z.jsx)(mi,{status:b,isChangingChannel:N,onOptOut:()=>{let e=E;g(e?.snapshot_name??``),m(e?`restore_backup`:te?`standard_upgrade`:`restore_backup`),l(!0)}})]})]})})]})}),(0,Z.jsx)(gi,{open:o,isPending:A.isPending,previewVersion:b?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await A.mutateAsync({path:{assistant_id:e}});V.success(t.detail||`Preview channel enabled.`),s(!1),k()}catch(e){V.error(W(e,void 0,`Could not enable Preview channel.`))}},onCancel:()=>s(!1)}),(0,Z.jsx)(_i,{open:c,backups:T,mode:u,selectedSnapshotName:O?.snapshot_name??``,isPending:j.isPending,restoreModeDisabled:P,standardUpgradeAvailable:te,onModeChange:m,onSnapshotChange:g,onConfirm:async()=>{if(!P)try{let t=await j.mutateAsync({path:{assistant_id:e},body:u===`restore_backup`?{mode:`restore_backup`,snapshot_name:O?.snapshot_name}:{mode:`standard_upgrade`}});V.success(t.detail||`Stable channel enabled.`),l(!1),k()}catch(e){V.error(W(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>l(!1)})]})}function pi({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(hi,{status:e}),!e.latest_preview_release&&(0,Z.jsx)(R,{tone:`neutral`,title:`No Preview release is available`,children:`Stable remains the only available release channel.`}),(0,Z.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(M,{}),disabled:n,onClick:r,children:`Opt in to Preview`})]})}function mi({status:e,isChangingChannel:t,onOptOut:n}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(hi,{status:e}),(0,Z.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(oe,{}),disabled:t,onClick:n,children:`Switch back to Stable`})]})}function hi({status:e}){return(0,Z.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Stable`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??`None`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Preview`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??`None`})]})]})}function gi({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){return(0,Z.jsx)(B.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Z.jsxs)(B.Content,{size:`md`,hideCloseButton:t,children:[(0,Z.jsxs)(B.Header,{icon:ue,children:[(0,Z.jsx)(B.Title,{children:`Opt in to Preview`}),(0,Z.jsx)(B.Description,{children:`Preview releases may be unstable. A 90-day safety backup is taken before the image changes.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(R,{tone:`warning`,title:`Data loss may occur when returning to Stable`,children:`Preview data may not be compatible with the Stable channel. The safety backup lets you restore the Stable-channel data that existed before opt-in.`}),(0,Z.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Z.jsx)(`li`,{children:`Create and verify a Preview safety backup.`}),(0,Z.jsxs)(`li`,{children:[`Switch to Preview image `,n??`latest`,`.`]}),(0,Z.jsx)(`li`,{children:`Run the normal upgrade path and wait for health.`})]})]})}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,disabled:t,onClick:i,children:`Cancel`}),(0,Z.jsx)(s,{variant:`primary`,disabled:t,leftIcon:t?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(M,{}),onClick:r,children:t?`Switching...`:`Take Backup and Switch`})]})]})})}function _i({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:c,onSnapshotChange:l,onConfirm:u,onCancel:d}){return(0,Z.jsx)(B.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,Z.jsxs)(B.Content,{size:`md`,hideCloseButton:i,children:[(0,Z.jsxs)(B.Header,{icon:ue,children:[(0,Z.jsx)(B.Title,{children:`Switch back to Stable`}),(0,Z.jsx)(B.Description,{children:`Choose how this assistant should leave the Preview channel.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(pe,{value:n,onValueChange:c,disabled:i,"aria-label":`Stable channel return method`,children:[(0,Z.jsx)(_e,{value:`restore_backup`,disabled:t.length===0,label:`Restore safety backup`,helperText:`Return to the Stable-channel data captured before Preview opt-in.`}),(0,Z.jsx)(_e,{value:`standard_upgrade`,disabled:!o,label:`Switch to Stable without restoring backup`,helperText:o?`Keep the current data and directly switch to the Stable image.`:`Unavailable because the latest Stable release is older than this assistant's Preview release.`})]}),n===`restore_backup`&&t.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[`Safety backup`,(0,Z.jsx)(xe,{value:r,onChange:l,disabled:i,options:t.map(e=>({value:e.snapshot_name,label:`${li(e)} - ${ci(e.created_at)}`}))})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Z.jsx)(R,{tone:`error`,title:`Stable requires a safety backup`,children:`This Preview release is newer than the latest Stable release, so switching directly is blocked. Wait for a newer Stable release, or run Vellum Doctor if the safety backup is missing.`}),n===`standard_upgrade`&&(0,Z.jsx)(R,{tone:`error`,title:`Preview data may not survive this`,children:`Switching directly to the Stable image without restoring the safety backup may cause data loss or leave the assistant unusable if Preview data is incompatible with Stable.`})]})}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,disabled:i,onClick:d,children:`Cancel`}),(0,Z.jsx)(s,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),onClick:u,children:i?`Switching...`:`Switch to Stable`})]})]})})}var vi=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function yi(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&vi.has(e.error)?`That size isn't available on your plan.`:W(e,void 0,t)}function bi({assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}){let o=c(),l=ht(),d=f(zt()),p=d.data,m=!e.is_local,h=p?.plan_id===`pro`,g=f({...Ft(),enabled:h}),_=e.machine_size||`small`,v=on(g.data?.max_machine_tier??null),y=(0,X.useMemo)(()=>ln(v,_,(0,Z.jsx)(ve,{tone:`positive`,children:`Current`})),[v,_]),b=g.data?.selected_storage_gib??null,[x,S]=(0,X.useState)(!1),C=v.length>0?v[v.length-1]:null,[w,E]=(0,X.useState)(null),O=w??C??_,[k,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(null),N=At({onSuccess:(e,n)=>{V.success(`Resize started. Changes will apply shortly.`,{id:`assistant-resize`}),M(null),E(null),S(!1),n.body?.machine_size==null?i():a(t)},onError:e=>{M(yi(e,`Failed to resize assistant. Please try again.`))}});if(d.isError&&p==null)return(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(R,{tone:`error`,children:`Could not load your subscription. Please try again.`})});let ee=h&&v.includes(O)&&O!==_?O:null,P=h&&b!=null&&!0,te=h&&v.length>0&&cn(_)<cn(v[v.length-1]),F=N.isPending||r,ne=b==null?t?.disk?.totalMb??null:b*1024,I=t?.disk&&ne!=null?{value:t.disk.usedMb,max:ne,caption:`${hn(t.disk.usedMb)} of ${hn(ne)}`}:null,L=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,re=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:`${hn(t.memory.currentMb)} of ${hn(t.memory.maxMb)}`}:null,ie=l?null:(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,onClick:()=>A(!0),children:`Resize`}),oe=m?h?P?(0,Z.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(ce,{className:`h-3.5 w-3.5`}),`Increase Storage`]}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:`Resize`}):ie:null,se=m?h?te?(0,Z.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(ce,{className:`h-3.5 w-3.5`}),`Increase Size`]}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:`Resize`}):ie:null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,compactAccessory:!0,accessory:(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:n||r?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),tooltip:r?`Applying resize…`:`Refresh resource metrics`,"aria-label":`Refresh resource metrics`,disabled:n||r,onClick:()=>void i()}),children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(T,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Disk`})]}),oe]}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Storage`}),I?(0,Z.jsx)(dn,{value:I.value,max:I.max,caption:I.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Unavailable`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(vn,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Machine`}),(0,Z.jsx)(ve,{tone:`neutral`,children:sn[_]})]}),se]}),(0,Z.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`CPU`}),L?(0,Z.jsx)(dn,{value:L.value,max:L.max,caption:L.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Memory`}),re?(0,Z.jsx)(dn,{value:re.value,max:re.max,caption:re.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Z.jsx)(B.Root,{open:k,onOpenChange:e=>{e||A(!1)},children:(0,Z.jsxs)(B.Content,{size:`sm`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Upgrade your plan`}),(0,Z.jsx)(B.Description,{children:`Move to a higher plan for more power, more storage, and a larger credit bundle.`})]}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`ghost`,onClick:()=>A(!1),children:`Cancel`}),(0,Z.jsx)(s,{onClick:()=>{A(!1),o(q.plans)},children:`Upgrade`})]})]})}),(0,Z.jsx)(B.Root,{open:x,onOpenChange:e=>{e||(S(!1),E(null),M(null))},children:(0,Z.jsxs)(B.Content,{size:`sm`,children:[(0,Z.jsxs)(B.Header,{icon:vn,children:[(0,Z.jsx)(B.Title,{children:`Resize Assistant`}),(0,Z.jsx)(B.Description,{children:`Resize your assistant's compute and storage. Your assistant will briefly restart.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v.length===0?(0,Z.jsx)(R,{tone:`warning`,children:`No machine tier configured. Visit the community for help.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:`Machine Size`}),(0,Z.jsx)(xe,{options:y,value:O,onChange:E,"aria-label":`Compute machine size`,"data-testid":`resize-machine-size`})]}),P?(0,Z.jsx)(R,{tone:`info`,children:`Storage will be expanded to ${b} GB.`}):(0,Z.jsx)(R,{tone:`neutral`,children:`Storage will not change.`}),j&&(0,Z.jsx)(R,{tone:`error`,children:j})]})}),(0,Z.jsxs)(B.Footer,{className:l?`justify-end`:`items-center justify-between`,children:[l?null:(0,Z.jsxs)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:[`Need more?`,` `,(0,Z.jsx)(u,{to:q.plans,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>S(!1),children:`Upgrade plan`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(s,{variant:`ghost`,onClick:()=>{S(!1),E(null),M(null)},children:`Cancel`}),(0,Z.jsx)(s,{disabled:ee==null&&!P||F,leftIcon:F?(0,Z.jsx)(D,{className:`animate-spin`}):void 0,onClick:()=>{M(null);let t={};ee!=null&&(t.machine_size=ee),P&&b!=null&&(t.storage_gib=b),N.mutate({path:{id:e.id},body:t})},children:j?`Retry`:`Apply`})]})]})]})})]})}function xi({assistantId:e}){let t=c(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>r(!0),className:`shrink-0`,children:`Retire Assistant`}),(0,Z.jsx)(qt,{open:n,isPending:i,onConfirm:async()=>{a(!0);let n=await Kt(e);if(n.ok){r(!1),t(n.nextRoute,{replace:!0});return}V.error(n.error),a(!1),r(!1)},onCancel:()=>r(!1)})]})}function Si(){let e=A(),t=N.useValue();return j(e)?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Show tips`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Occasional tips in the sidebar that highlight features you haven't tried yet.`})]}),(0,Z.jsx)(ye,{checked:t,onChange:t=>{N.save(t),t||P(`settings`,`dont_show_again`,e)},"aria-label":`Show tips`})]}):null}var Ci=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function wi(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...Ci].sort()}function Ti(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);if(n){let e=n[1]===`-`?-1:1,t=parseInt(n[2]??`0`,10),r=parseInt(n[3]??`0`,10);i=e*(t*60+r)}}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function Ei(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function Di(e){if(!e)return`Not set`;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}var Oi=200;function ki({value:e,onChange:t}){let[n,r]=(0,X.useState)(``),i=(0,X.useMemo)(()=>wi().map(e=>Ti(e)).filter(e=>e!==null),[]),a=n.trim().toLowerCase(),o=(0,X.useMemo)(()=>(a?i.filter(e=>e.city.toLowerCase().includes(a)||e.region.toLowerCase().includes(a)||e.offsetLabel.toLowerCase().includes(a)||e.identifier.toLowerCase().includes(a)):i).slice(0,Oi),[i,a]),s=(0,X.useMemo)(()=>o.map(e=>e.identifier),[o]),c=(0,X.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]);return(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Closest city`}),(0,Z.jsxs)(me.Root,{className:`w-full md:max-w-[280px]`,options:s,value:e,onSelect:t,onOpenChange:e=>{e||r(``)},autoActivateFirst:a.length>0,children:[(0,Z.jsx)(me.Input,{type:`text`,"aria-label":`Closest city`,value:n,placeholder:c||`Search city or country...`,onChange:e=>r(e.target.value),fullWidth:!0}),(0,Z.jsx)(me.List,{"aria-label":`Cities`,className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,emptyState:(0,Z.jsx)(`p`,{className:`px-3 py-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No matching cities`}),children:o.map(e=>(0,Z.jsxs)(me.Option,{value:e.identifier,className:h(`flex w-full items-center justify-between gap-3 px-3 py-2`,`text-body-medium-lighter text-[var(--content-default)] transition-colors`,`hover:bg-[var(--surface-active)]`,`data-[active]:bg-[var(--surface-active)] aria-selected:bg-[var(--surface-active)]`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-default`,children:e.city}),e.region&&(0,Z.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.region})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(`span`,{children:Ei(e.identifier)}),(0,Z.jsx)(`span`,{children:e.offsetLabel})]})]},e.identifier))})]})]}),(0,Z.jsx)(gn,{}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Time zone`}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:Di(e)})]})]})}function Ai(){let e=Ie.use.activeAssistantId(),[t,n]=(0,X.useState)(()=>i(`timezone`,``)),o=(0,X.useRef)(e);(0,X.useEffect)(()=>{o.current=e},[e]);let s=(0,X.useRef)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(()=>{}),u=e=>{if(s.current){c.current=e;return}let t=o.current;if(!t){c.current=null;return}s.current=!0,c.current=null,G.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{a(e,{context:`settings-timezone-override`})}).finally(()=>{s.current=!1;let e=c.current;c.current=null,e!==null&&l.current(e)})};return(0,X.useEffect)(()=>{l.current=u}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Timezone`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Used when displaying times and scheduling reminders.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:(0,Z.jsx)(ki,{value:t,onChange:e=>{n(e),r(`timezone`,e),u(e)}})})]})}var ji=[[`Mon`,0],[`Tue`,1],[`Wed`,2],[`Thu`,3],[`Fri`,4],[`Sat`,5],[`Sun`,6]];function Mi(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function Ni(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function Pi(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function Fi(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:Mi(t),windowEnd:Mi(n)}}function Ii({assistantId:e}){let t=d(),{data:n,isLoading:r,isError:i}=f(Dt({path:{id:e}})),a=(0,X.useMemo)(()=>Fi(n),[n]),[o,c]=(0,X.useState)(null),l=o??a,u=o!==null,m=(0,X.useMemo)(()=>Pi(),[]),[h,g]=(0,X.useState)(null),_=h??l.daysOfMonth.join(`, `),y=p({mutationFn:async t=>{let{data:n}=await tt({path:{id:e},body:t,throwOnError:!0});return n}}),b=e=>{c(t=>({...t??a,...e}))},x=e=>{b({daysOfWeek:l.daysOfWeek.includes(e)?l.daysOfWeek.filter(t=>t!==e):[...l.daysOfWeek,e].sort((e,t)=>e-t)})},S=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return r?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading update window settings...`]}):i?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load update window policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(ye,{checked:l.enabled,onChange:e=>b({enabled:e}),label:`Automatic updates`,helperText:`Update automatically during a configured time window`}),l.enabled&&(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Frequency`}),(0,Z.jsx)(`div`,{className:`max-w-[400px]`,children:(0,Z.jsx)(v,{ariaLabel:`Frequency`,value:l.frequency,onChange:e=>{e!==`monthly`&&g(null),b({frequency:e})},items:[{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}]})})]}),l.frequency===`weekly`&&(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Day(s) of week`}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:ji.map(([e,t])=>(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,active:l.daysOfWeek.includes(t),onClick:()=>x(t),children:e},t))})]}),l.frequency===`monthly`&&(0,Z.jsx)(z,{label:`Day(s) of month`,type:`text`,value:_,onChange:e=>g(e.target.value),onBlur:e=>{let t=S(e.target.value);b({daysOfMonth:t}),g(t.join(`, `))},placeholder:`e.g. 1, 15`,helperText:`Comma-separated day numbers (1–31)`,className:`w-48`}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:[`Update window`,m?` (${m})`:``]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(z,{type:`time`,value:l.windowStart,onChange:e=>b({windowStart:e.target.value})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`to`}),(0,Z.jsx)(z,{type:`time`,value:l.windowEnd,onChange:e=>b({windowEnd:e.target.value})})]})]})]}),(0,Z.jsx)(s,{variant:`primary`,leftIcon:y.isPending?(0,Z.jsx)(D,{className:`animate-spin`}):void 0,onClick:async()=>{let n=l.frequency===`monthly`&&h!==null?S(h):l.daysOfMonth;try{await y.mutateAsync({enabled:l.enabled,timezone:`UTC`,schedule:{frequency:l.frequency,days_of_week:l.frequency===`weekly`?l.daysOfWeek:[],days_of_month:l.frequency===`monthly`?n:[],window:{start:Ni(l.windowStart),end:Ni(l.windowEnd)}}}),V.success(`Auto-update policy saved.`),c(null),g(null),t.invalidateQueries({queryKey:jt({path:{id:e}})})}catch{V.error(`Failed to save policy. Please try again.`)}},disabled:y.isPending||!u,children:`Save policy`})]})}function Li({assistantId:e,open:t,onClose:n}){return(0,Z.jsx)(B.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(B.Content,{size:`md`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Update Window`}),(0,Z.jsx)(B.Description,{children:`Configure when automatic updates are applied.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsx)(Ii,{assistantId:e})})]})})}function Ri(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function zi({open:e,onOpenChange:t}){let n=d(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(!1),f=(0,X.useRef)(e),p=()=>n.invalidateQueries({queryKey:Tt()}),m=e=>{ct({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},h=Ot({onSuccess:e=>{if(!f.current){m(e.factor_id);return}i(e)},onError:e=>{let n=Ri(e);n===`no_workos_account`?V.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?V.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?V.error(`An authenticator app is already set up. Remove it before adding another.`):V.error(`Failed to start setup. Please try again.`),t(!1)}}),g=Ct({onSuccess:e=>{e.valid?(u.current=!0,V.success(`Two-factor authentication is on.`),p(),t(!1)):l(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=Ri(e);if(n===`challenge_already_verified`){u.current=!0,V.success(`Two-factor authentication is on.`),p(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){r&&m(r.factor_id),i(null),o(``),l(`This setup session expired. Scan the new QR code and try again.`),h.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){l(`Too many attempts. Wait a minute and try again.`);return}l(`Couldn't verify the code. Wait a moment and try again.`)}});(0,X.useEffect)(()=>{f.current=e,e&&(u.current=!1,i(null),o(``),l(null),h.mutate({}))},[e]);let v=e=>{!e&&g.isPending||(!e&&r&&!u.current&&m(r.factor_id),t(e))},y=()=>{r&&Qt(r.secret,{successMessage:`Setup key copied.`,errorMessage:`Couldn't copy the setup key.`})},b=()=>{!r||a.length!==6||g.isPending||(l(null),g.mutate({body:{challenge_id:r.challenge_id,code:a}}))};return(0,Z.jsx)(B.Root,{open:e,onOpenChange:v,children:(0,Z.jsxs)(B.Content,{size:`sm`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Set up authenticator app`}),(0,Z.jsx)(B.Description,{children:`Scan the QR code with an authenticator app such as Google Authenticator or 1Password, then enter the 6-digit code it shows.`})]}),(0,Z.jsx)(B.Body,{children:r===null?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Z.jsx)(D,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,Z.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,Z.jsx)(`img`,{src:r.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:y,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,Z.jsx)(`span`,{className:`break-all text-left`,children:r.secret}),(0,Z.jsx)(_,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,Z.jsx)(z,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:a,onChange:e=>o(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>v(!1),disabled:g.isPending,children:`Cancel`}),(0,Z.jsx)(s,{onClick:b,disabled:r===null||a.length!==6||g.isPending,children:g.isPending?`Verifying…`:`Verify`})]})]})})}function Bi(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Vi(){let e=d(),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null),a=f({...wt()}),o=a.data??[],c=()=>e.invalidateQueries({queryKey:Tt()}),l=Mt({onSuccess:()=>{V.success(`Authenticator app removed.`),c()},onError:e=>{if(Ri(e)===`factor_not_found`){c();return}V.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a.isPending?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):a.isError?(0,Z.jsxs)(R,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,Z.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void a.refetch(),children:`Try again`})]}):o.length===0?(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`No authenticator app is set up. Add one to require a one-time code at sign-in.`}):(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:o.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(se,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,Z.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${Bi(e.created_at)}`:``]})]})]}),(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>i(e),disabled:l.isPending,children:`Remove`})]},e.id))}),!a.isPending&&!a.isError&&o.length===0&&(0,Z.jsx)(s,{onClick:()=>n(!0),className:`self-start`,children:`Add authenticator app`}),(0,Z.jsx)(zi,{open:t,onOpenChange:n}),(0,Z.jsx)(be,{open:r!==null,title:`Remove authenticator app`,message:`Signing in will no longer ask for a code from this app. You can set up a new authenticator app at any time.`,confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{r&&l.mutate({path:{id:r.id}}),i(null)},onCancel:()=>i(null)})]})}var Q=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Hi=`local`,Ui=`docker`,Wi=`vellum`;function Gi(e){switch((e??``).toLowerCase()){case Hi:return`local`;case Ui:return`docker`;case Wi:return`managed`;default:return`other`}}function Ki(e){let t=Gi(e);return t===`managed`?`local`:t===`local`?`platform`:null}function qi(e){switch(e){case`docker`:return`Move to Docker`;case`platform`:return`Move to Cloud (Platform)`;case`local`:return`Move to Local`}}function Ji(e){switch(e){case`docker`:return`Run your assistant in a Docker container on this Mac.`;case`platform`:return`Run your assistant in the cloud, managed by the Vellum platform.`;case`local`:return`Run your assistant locally on this Mac.`}}function Yi(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}async function Xi(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function Zi(e){let t=ke(e);if(!t)throw new Q(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function Qi(e,t){let n=await Fe(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function $i(e,t){let n=Zi(e),r=await Qi(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new Q(`export_failed`,`Export failed (HTTP ${i.status}).`);return Xi(i,t)}async function ea(e,t){let n=Zi(e),r=await Qi(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new Q(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await ra(i);if(a&&a.success===!1)throw new Q(`import_failed`,a.error??`Import reported failure`)}async function ta(e,t){let{data:n,response:r}=await G.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new Q(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new Q(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function na(e,t){let{data:n,response:r}=await G.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new Q(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new Q(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function ra(e){try{return await e.json()}catch{return null}}var ia=new Set([500,502,503,504]),$=3,aa=e=>new Promise(t=>setTimeout(t,e));async function oa(e,t=new Set){for(let n=0;n<=$;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<$&&ia.has(o)&&!t.has(o)){await aa(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new Q(`unknown`,`Unexpected retry loop exit`)}async function sa(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await oa(()=>G.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new Q(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new Q(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function ca(e,t){let{status:n,data:r,error:i}=await oa(()=>G.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=Yi(i);if(e)throw new Q(`version_mismatch`,e)}if(n!==200&&n!==201)throw new Q(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function la(e,t,n){for(let r=0;r<=$;r++){let i=await ua(e,t,n);if(r<$&&ia.has(i)){await aa(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new Q(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function ua(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new Q(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new Q(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function da(e,t){for(let n=0;n<=$;n++){let r=await fetch(e,{method:`GET`});if(n<$&&ia.has(r.status)){await aa(2**n*1e3),t?.(0);continue}if(!r.ok)throw new Q(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return Xi(r,t)}throw new Q(`import_failed`,`Unexpected retry loop exit`)}async function fa(e){let{status:t,data:n,error:r}=await oa(()=>G.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function pa(e){let{status:t,data:n}=await oa(()=>G.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new Q(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var ma=5e3,ha=36e5,ga=5*6e4,_a=30,va=e=>new Promise(t=>setTimeout(t,e));function ya(){let e=c(),t=Me(),n=Ki(t?.cloud),[r,i]=(0,X.useState)({kind:`idle`}),[o,s]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=(0,X.useCallback)(e=>{i({kind:`transferring`,step:e,progress:null})},[]),f=(0,X.useCallback)(e=>{i(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,X.useCallback)(async()=>{if(!(!t||!n)){u.current={id:t.assistantId,kind:Gi(t.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(n===`platform`)await ba(t,d,f,l);else if(n===`local`)await xa(t,d,f,l);else throw new Q(`unknown`,`Unsupported teleport destination.`);i({kind:`verifying`})}catch(e){i({kind:`failed`,error:`Teleport failed: ${e instanceof Q||e instanceof Error?e.message:`Teleport failed.`}`}),a(e,{context:`teleport-execute`}),await Ca(l.current,u.current,`teleport-execute-cleanup`),l.current=null}}},[t,n,d,f]),m=(0,X.useCallback)(()=>s(!0),[]),h=(0,X.useCallback)(()=>s(!1),[]),g=(0,X.useCallback)(()=>{s(!1),p()},[p]),_=(0,X.useCallback)(()=>{l.current=null,u.current=null,i({kind:`idle`})},[]);return{destination:n,phase:r,confirmOpen:o,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,X.useCallback)(()=>{let t=l.current,n=u.current;t&&(async()=>{try{let e=Xe.getState();t.kind===`managed`?await e.connectPlatformAssistant(t.id):(await e.connectLocalAssistant(t.id),Ze(t.id,{onError:e=>a(e,{context:`teleport-inject-platform-identity`})}))}catch(e){i({kind:`failed`,error:`Switch failed: ${e instanceof Error?e.message:`Failed to switch assistant.`}`}),a(e,{context:`teleport-confirm-switch`});return}n&&Kt(n.id).then(e=>{e.ok||a(Error(e.error),{context:`teleport-retire-source`})}),_(),e(q.assistant,{replace:!0})})()},[e,_]),cancelTeleport:(0,X.useCallback)(()=>{let e=l.current,t=u.current;l.current=null,u.current=null,i({kind:`idle`}),Ca(e,t,`teleport-cancel-retire-target`)},[]),reset:_}}async function ba(e,t,n,r){t(`Exporting assistant data...`);let i=await $i(e,n);t(`Resolving organization...`);let a=await Ta();t(`Checking for existing assistant...`);let o=(await ot({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${o.id}'. Retire it first, then retry the teleport.`);t(`Uploading data to cloud...`);let s=await sa(e.resources?.runtimeVersion);await la(s.url,i,n),t(`Setting up cloud assistant...`);let c=await ut(void 0,`create`);if(!c.ok)throw new Q(`import_failed`,`Failed to set up the cloud assistant.`);if(c.status===200)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${c.data.id}'. Retire it first, then retry the teleport.`);let l=c.data.id;await Ce({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:De(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await we(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(`Finalizing cloud assistant...`),await Ea(l),t(`Importing data to cloud...`);let u=await fa(s.bundleKey);if(u.status<200||u.status>=300){let e=u.body;throw new Q(`import_failed`,e?.error??`Import failed (HTTP ${u.status}).`)}if(u.status===202){let e=u.body?.job_id;if(!e)throw new Q(`import_failed`,`Import accepted but no job ID returned.`);await Da(e)}else{let e=u.body;if(e&&e.success===!1)throw new Q(`import_failed`,e.error??`Import reported failure.`)}}async function xa(e,t,n,r){t(`Preparing export...`);let i=await sa(await wa(e.assistantId),`runtime`);t(`Exporting cloud data...`);let a=await ta(e.assistantId,i.url);await Oa(e.assistantId,a),t(`Preparing local assistant...`);let{assistant:o,createdFresh:s}=await ka();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Sa(o,s);if(!c)throw new Q(`local_assistant_not_found`,`Could not determine the local assistant's runtime version. Restart or upgrade the local assistant, then retry the teleport.`);t(`Preparing import...`);let l=await ca(i.bundleKey,c);t(`Downloading data...`);let u=await da(l,n);t(`Importing data...`),await ja(o,u),await we(e.assistantId)}async function Sa(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await an())?.version??void 0}async function Ca(e,t,n){if(e?.createdFresh){let t=await Kt(e.id);t.ok||a(Error(t.error),{context:n})}t&&await we(t.id)}async function wa(e){let t=await lt(e);return t.ok?t.data.version??void 0:void 0}async function Ta(){let e=Qe.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=Qe.getState().organizations,n=Ue();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new Q(`no_organizations`,`No organizations found for this account.`);if(t.length>1)throw new Q(`multiple_organizations`,`Multiple organizations found — please select one in account settings first.`);let r=t[0].id;return Qe.getState().setCurrentOrganizationId(r),r}async function Ea(e){let t=Date.now();for(;Date.now()-t<ga;){let{data:t,response:n}=await rt({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await va(ma)}}async function Da(e){let t=Date.now();for(;Date.now()-t<ha;){await va(ma);let t=await pa(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new Q(`import_failed`,t.error??`Import job failed`)}throw new Q(`import_failed`,`Import timed out after 60 minutes.`)}async function Oa(e,t){let n=Date.now();for(;Date.now()-n<ha;)if(await va(ma),await na(e,t)===`complete`)return;throw new Q(`export_timed_out`,`Export timed out.`)}async function ka(){let e=await Ee(void 0,void 0);if(!e.ok)throw new Q(`local_assistant_not_found`,e.error??`Could not create a local assistant.`);await Se();let t=e.assistantId?je().find(t=>t.assistantId===e.assistantId):Aa();if(!t)throw new Q(`local_assistant_not_found`,`Could not find or create a local assistant.`);return{assistant:t,createdFresh:!0}}function Aa(){return je().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function ja(e,t){let n;for(let r=0;r<_a;r++)try{await ea(e,t);return}catch(e){n=e,await va(1e3)}throw n instanceof Error?n:new Q(`import_failed`,`Import failed.`)}function Ma(){let e=ya(),{destination:t,phase:n}=e;return t?(0,Z.jsxs)(Y,{title:`Teleport`,subtitle:`Move your assistant to a different hosting environment.`,children:[n.kind===`idle`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Ji(t)}),(0,Z.jsx)(s,{variant:`outlined`,className:`self-start`,onClick:e.requestTeleport,children:qi(t)})]}),n.kind===`transferring`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.progress==null&&(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n.step})]}),n.progress!=null&&(0,Z.jsx)(fe,{value:n.progress,"aria-label":`Teleport progress`,className:`max-w-[240px]`})]}),n.kind===`verifying`&&(0,Z.jsx)(R,{tone:`success`,icon:(0,Z.jsx)(w,{className:`h-4 w-4`}),title:`Transfer complete — verify your new assistant is working.`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(s,{variant:`primary`,onClick:e.confirmAndSwitch,children:`Confirm & Switch`}),(0,Z.jsx)(s,{variant:`outlined`,onClick:e.cancelTeleport,children:`Cancel`})]})}),n.kind===`failed`&&(0,Z.jsx)(R,{tone:`error`,title:n.error,actions:(0,Z.jsx)(s,{variant:`outlined`,onClick:e.reset,children:`Try Again`})}),(0,Z.jsx)(be,{open:e.confirmOpen,title:qi(t),message:`Your data will be copied to the new environment. The current assistant will remain available until you confirm the new one works.`,confirmLabel:`Teleport`,onConfirm:e.confirm,onCancel:e.cancelConfirm})]}):null}function Na(){let{t:e}=Le(`settings`),{assistant:t,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}=pn(),u=K.use.multiPlatformAssistant(),d=K.use.assistantSwitcher(),f=K.use.teleport(),p=K.use.accountMfa(),m=Wt.use.settingsSleepPolicy(),h=Je(),g=pt(),_=d&&(Pe()||h||Te()||g),v=c(),y=_t(),b=_t({platformHostedOnly:!0}),x=yt(),S=ht(),C=ee({assistantId:t?.id??null,enabled:b===`full`&&x}),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),[O,k]=l();(0,X.useEffect)(()=>{if(O.get(`preferences`)!==`open`)return;let e=new URLSearchParams(O);e.delete(`preferences`),k(e,{replace:!0}),D(!0)},[O,k]);let A=t?.is_local&&!Pe()?null:t,j=Me(),M=Pe()&&!!t&&!!j&&Oe(j),N=M,P=M&&!Te(),te=b===`full`&&!!A||P&&!!t;(0,X.useEffect)(()=>{!t||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[t]);let F=n?.version??t?.current_release_version??null,ne=()=>{let e=Ae();if(Te()&&!g&&e){let t=new URLSearchParams({register:dt()}),n=Ne();n&&t.set(`name`,n);let r=new URL(e).origin;window.location.assign(`${r}${q.selectAssistant}?${t.toString()}`);return}v(`${q.selectAssistant}?noAutoSkip=1`)},I=(y===`full`||N)&&!!A||y===`disabled`&&!N,L=b!==`gated`;return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[C.status&&C.mode!==`inactive`&&(0,Z.jsx)(ie,{status:C.status,mode:C.mode,isAcknowledging:C.isAcknowledging,acknowledgeError:C.acknowledgeError?.message??null,onAcknowledge:()=>void C.acknowledge(),onReviewWorkspaceData:()=>void v(`${q.workspace}?sort=size`),onUpgradeStorage:b===`full`&&!S?()=>void v(q.plans):null}),(0,Z.jsxs)(Nn,{assistant:x?A:null,showHandles:h&&y===`full`,children:[(0,Z.jsx)(Ai,{}),p&&y!==`gated`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.twoFactorTitle`)}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.twoFactorDescription`)}),(0,Z.jsx)(`div`,{className:`mt-1`,children:y===`disabled`?(0,Z.jsx)(J,{children:e(`generalPage.twoFactorLoginNotice`)}):(0,Z.jsx)(Vi,{})})]})]})]}),(0,Z.jsx)(Y,{title:e(`generalPage.versionTitle`),subtitle:e(`generalPage.versionSubtitle`),accessory:b===`full`&&A?(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>T(!0),children:e(`generalPage.updateWindow`)}):void 0,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[b===`full`&&A&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Un,{assistantId:A.id,currentVersion:F,releaseChannel:A.release_channel,onUpgradeComplete:()=>{a()}}),(0,Z.jsx)(fi,{assistantId:A.id,onComplete:()=>{a()}})]}),P&&t&&(0,Z.jsx)(Wn,{assistantId:t.id,currentVersion:F,onUpgradeComplete:()=>{a()}}),!te&&t&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.current`)}),(0,Z.jsx)(mn,{version:F,loading:r&&!t.current_release_version,assistantId:t.id??null})]}),b===`disabled`&&!P&&(0,Z.jsx)(J,{children:e(`generalPage.updatesLoginNotice`)})]})}),b===`full`&&A&&(0,Z.jsx)(Li,{assistantId:A.id,open:w,onClose:()=>T(!1)}),b===`full`&&t&&(0,Z.jsx)(bi,{assistant:t,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}),b===`disabled`&&(0,Z.jsx)(Y,{id:`storage-resources`,title:e(`generalPage.computeResourcesTitle`),subtitle:e(`generalPage.computeResourcesSubtitle`),children:(0,Z.jsx)(J,{children:e(`generalPage.computeResourcesLoginNotice`)})}),(0,Z.jsx)(Y,{title:e(`generalPage.preferencesTitle`),subtitle:e(`generalPage.preferencesSubtitle`),accessory:(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>D(!0),children:e(`generalPage.customize`)}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsx)(bn,{}),(0,Z.jsx)(Si,{})]})}),(0,Z.jsx)(oi,{open:E,onClose:()=>D(!1)}),f&&U()&&(0,Z.jsx)(Ma,{}),(0,Z.jsx)(qn,{}),(0,Z.jsx)(Wr,{}),b===`full`&&A&&m&&(0,Z.jsx)(Y,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Z.jsx)(zn,{assistantId:A.id})}),b===`disabled`&&m&&(0,Z.jsx)(Y,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Z.jsx)(J,{children:e(`generalPage.sleepPolicyLoginNotice`)})}),u&&!_&&(0,Z.jsx)(In,{}),_&&(0,Z.jsx)(Y,{title:e(`generalPage.switchAssistantTitle`),subtitle:e(`generalPage.switchAssistantSubtitle`),accessory:(0,Z.jsx)(s,{variant:`outlined`,onClick:ne,children:e(`generalPage.chooseAssistant`)})}),(I||L)&&(0,Z.jsx)(Y,{variant:`danger`,title:e(`generalPage.dangerZoneTitle`),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[I&&(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.retireAssistantTitle`)}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.retireAssistantDescription`)}),(0,Z.jsx)(`div`,{className:`mt-1`,children:(y===`full`||N)&&A?(0,Z.jsx)(xi,{assistantId:A.id}):(0,Z.jsx)(J,{children:e(`generalPage.retireAssistantLoginNotice`)})})]}),I&&L&&(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(Gn,{})]})})]})}export{Na as GeneralPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{i as t,l as n}from"./local-settings-Bx7FsNo5.js";import{o as r,r as i}from"./device-settings-DZvv4pnY.js";import{t as a}from"./capture-error-DiNp24s6.js";import{t as o}from"./react-BFJW0bSv.js";import{t as s}from"./button-VkxVX0DM.js";import{d as c,h as l,t as u}from"./chunk-5KNZJZUH-BUqIilZr.js";import{n as d}from"./QueryClientProvider-EuRl-wrW.js";import{t as f}from"./useQuery-CTSuec5b.js";import{t as p}from"./useMutation-D2YPyfEH.js";import{t as m}from"./jsx-runtime-BJ8jcmzB.js";import{t as h}from"./cn-Cf8SmgbR.js";import{t as g}from"./card-DUsAeHUS.js";import{d as _,o as v}from"./list-row-CDwzGT9g.js";import{t as y}from"./createLucideIcon-B-ZPaMbU.js";import{t as b}from"./bell-CHRdx4mp.js";import{t as x}from"./check-pgeLaeXx.js";import{t as S}from"./chevron-down-CmQCCo_x.js";import{t as C}from"./circle-alert-DvkPmyIg.js";import{t as w}from"./circle-check-BlOeCme9.js";import{t as T}from"./hard-drive-BV9-fN_J.js";import{t as E}from"./heart-Bd-pnn1X.js";import{t as D}from"./loader-circle-DYe85z3g.js";import{t as O}from"./monitor-BHYV5XBf.js";import{t as k}from"./moon-CZZGDGLY.js";import{C as A,S as j,T as M,b as N,d as ee,h as P,i as te,l as F,m as ne,n as I,o as L,t as re,u as ie}from"./composer-settings-C61mCg49.js";import{t as ae}from"./refresh-cw-p138DTtp.js";import{t as oe}from"./rotate-ccw-Cs7aCSL9.js";import{t as se}from"./smartphone-AcA2Q0mQ.js";import{t as ce}from"./sparkles-Bhr0JiLM.js";import{t as le}from"./sun-BzqYfTxT.js";import{t as ue}from"./triangle-alert-43gIbLca.js";import{t as de}from"./x-zfSDUG5z.js";import{t as R}from"./notice-BlYF-xU3.js";import{t as fe}from"./progress-bar-C4e3e4vV.js";import{B as pe,V as me,o as he,r as ge,s as _e}from"./src-CImIAPTd.js";import{t as ve}from"./tag-Ddzwz3ij.js";import{t as z}from"./input-DkgpMeG9.js";import{t as ye}from"./toggle-0qt1e_3r.js";import{t as B}from"./modal-UYNawsIu.js";import{n as V}from"./toast-DqqWkjsh.js";import{t as be}from"./confirm-dialog-Drw1adml.js";import{t as xe}from"./select-BKyejRky.js";import{t as H}from"./skeleton-D8_lkywC.js";import{C as Se,M as Ce,P as we,S as Te,V as Ee,Y as De,_ as Oe,a as ke,f as Ae,i as je,p as Me,u as Ne,v as Pe,z as Fe}from"./local-mode-BNr2MrWI.js";import{t as U}from"./is-electron-wgAC5Mzb.js";import{r as Ie}from"./resolved-assistants-store-BNadgXqb.js";import"./i18n-TtBbwrTI.js";import{t as Le}from"./useTranslation-qxtkEXxq.js";import{i as W,n as Re,t as ze}from"./api-errors-CASENJGT.js";import{r as Be,t as Ve}from"./semver-C2-EZfiR.js";import{i as He}from"./utils-BEkyAhbA.js";import{$ as Ue,E as We,S as Ge,T as Ke,Z as qe,a as Je,g as Ye,n as Xe,q as Ze,tt as Qe,w as $e,x as et}from"./auth-store-C9wDgFON.js";import{t as G}from"./client.gen-CxTOBLiH.js";import{$ as tt,C as nt,N as rt,P as it,Q as at,T as ot,W as st,Wt as ct}from"./sdk.gen-DWvuzSBW.js";import{a as lt,o as ut}from"./api-Cx3i50oG.js";import{c as dt}from"./remote-gateway-session-CzPLaXuT.js";import{t as K}from"./client-feature-flag-store-D5JmN6Ek.js";import{d as q}from"./routes-B7wRw3UT.js";import{d as ft,h as pt,o as mt,p as ht,u as gt}from"./platform-detection-zth6eCY8.js";import{i as _t,r as vt,t as yt}from"./use-platform-gate-D-6OU7px.js";import{A as bt,D as xt,E as St,Ft as Ct,It as wt,Lt as Tt,Mt as Et,N as Dt,Nt as Ot,O as kt,Ot as At,P as jt,Pt as Mt,T as Nt,c as Pt,ft as Ft,j as It,k as Lt,kt as Rt,mt as zt,v as Bt,w as Vt,wt as Ht}from"./react-query.gen-CwRPAiHT.js";import{t as Ut}from"./hard-navigate-CNxvVrtC.js";import{t as Wt}from"./assistant-feature-flag-store-DrLJ0Qcv.js";import{t as Gt}from"./pointer-BMK9brNn.js";import{n as Kt,t as qt}from"./retire-confirm-dialog-Dq2Q98Yl.js";import{a as Jt,i as Yt,r as Xt,s as Zt}from"./local-runtime-upgrade-DDXGJgta.js";import{t as Qt}from"./copy-to-clipboard-D76_3Coc.js";import{t as $t}from"./proxy-CT_qJI1K.js";import{t as en}from"./AnimatePresence-CxaKvfs9.js";import{t as tn}from"./use-reduced-motion-CU3dPXKf.js";import{t as J}from"./platform-login-notice-CuGLNP0e.js";import{t as nn}from"./use-active-assistant-id-BADYKVyx.js";import{t as rn}from"./use-copy-to-clipboard-B7Yrgm0s.js";import{t as Y}from"./detail-card-Bqnvs6YE.js";import{t as an}from"./app-info-CvBesesf.js";import{a as on,i as sn,l as cn,o as ln}from"./machine-sizes-DzJ0TVYS.js";import{t as un}from"./environment-store-C4So_j-o.js";import{a as dn,i as fn,n as pn,r as mn,t as hn}from"./assistant-status-panel-Hchz3DMb.js";import{t as gn}from"./settings-divider-C0NZsB-L.js";var _n=y(`fingerprint-pattern`,[[`path`,{d:`M12 10a2 2 0 0 0-2 2c0 1.02-.1 2.51-.26 4`,key:`1nerag`}],[`path`,{d:`M14 13.12c0 2.38 0 6.38-1 8.88`,key:`o46ks0`}],[`path`,{d:`M17.29 21.02c.12-.6.43-2.3.5-3.02`,key:`ptglia`}],[`path`,{d:`M2 12a10 10 0 0 1 18-6`,key:`ydlgp0`}],[`path`,{d:`M2 16h.01`,key:`1gqxmh`}],[`path`,{d:`M21.8 16c.2-2 .131-5.354 0-6`,key:`drycrb`}],[`path`,{d:`M5 19.5C5.5 18 6 15 6 12a6 6 0 0 1 .34-2`,key:`1tidbn`}],[`path`,{d:`M8.65 22c.21-.66.45-1.32.57-2`,key:`13wd9y`}],[`path`,{d:`M9 6.8a6 6 0 0 1 9 5.2v2`,key:`1fr1j5`}]]),vn=y(`server`,[[`rect`,{width:`20`,height:`8`,x:`2`,y:`2`,rx:`2`,ry:`2`,key:`ngkwjq`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,ry:`2`,key:`iecqi9`}],[`line`,{x1:`6`,x2:`6.01`,y1:`6`,y2:`6`,key:`16zg32`}],[`line`,{x1:`6`,x2:`6.01`,y1:`18`,y2:`18`,key:`nzw8ys`}]]),yn=y(`vibrate`,[[`path`,{d:`m2 8 2 2-2 2 2 2-2 2`,key:`sv1b1`}],[`path`,{d:`m22 8-2 2 2 2-2 2 2 2`,key:`101i4y`}],[`rect`,{width:`8`,height:`14`,x:`8`,y:`5`,rx:`1`,key:`1oyrl4`}]]),X=e(o(),1),Z=m();function bn(){let e=K.use.velvet(),{theme:t,setThemePreference:n}=ne(),r=[{value:`system`,label:`System`,icon:(0,Z.jsx)(O,{className:`h-4 w-4`})},{value:`light`,label:`Light`,icon:(0,Z.jsx)(le,{className:`h-4 w-4`})},{value:`dark`,label:`Dark`,icon:(0,Z.jsx)(k,{className:`h-4 w-4`})},...e?[{value:`velvet`,label:`Velvet`,icon:(0,Z.jsx)(E,{className:`h-4 w-4`})}]:[]];return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Theme`}),(0,Z.jsx)(`div`,{className:`mt-2 max-w-[360px]`,children:(0,Z.jsx)(v,{ariaLabel:`Theme`,value:t,onChange:n,items:r})})]})}var xn=et,Sn=`Please choose a different handle.`;async function Cn(e,t){let{data:n,error:r,response:i}=await it({path:{id:e},body:{handle:t},throwOnError:!1});if(!i)return{kind:`error`,message:W(r,void 0,`Failed to save handle.`)??`Failed to save handle.`};if(i.ok&&n)return{kind:`ok`,data:n};if(i.status===409){let{message:e}=We(r,`handle`,xn.taken);return{kind:`taken`,message:e}}if(i.status===400){let{code:e,message:t}=We(r,`handle`,Sn);return{kind:`invalid`,code:e,message:t}}return{kind:`error`,message:W(r,i,`Failed to save handle.`)}}async function wn(e,t,n){let{data:r,error:i,response:a}=await nt({path:{assistant_id:e},query:{handle:t},signal:n,throwOnError:!1});if(Re(a,i,`Failed to check handle availability.`),!a.ok||!r)throw new ze(a.status,a.status===429?`Too many checks — try again in a moment.`:W(i,a,`Failed to check handle availability.`));return{available:r.available,code:r.code??null,message:r.message??null}}function Tn(e){return/\d{2,}$/.test(e)}var En=300,Dn=1400;function On({initialHandle:e,inputLabel:t,helperText:n,idleHelperText:r,checkAvailable:i,save:a,onSaved:o,saveSuccessToast:c,fieldId:l}){let[u,d]=(0,X.useState)(e),[f,p]=(0,X.useState)(null),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(`idle`),[v,y]=(0,X.useState)(null),b=tn(),S=(0,X.useRef)(null),w=(0,X.useMemo)(()=>u.trim().toLowerCase(),[u]),T=w===e.toLowerCase();(0,X.useEffect)(()=>{if(T||w.length===0){h(!1),S.current?.abort();return}let e=new AbortController;S.current?.abort(),S.current=e,h(!0);let t=window.setTimeout(async()=>{try{let t=await i(w,e.signal);e.signal.aborted||p(t)}catch(t){e.signal.aborted||y(t instanceof Error?t.message:`Couldn't check availability.`)}finally{e.signal.aborted||h(!1)}},En);return()=>{window.clearTimeout(t),e.abort()}},[w,T,i]);let E=(()=>{if(v)return v;if(f&&!f.available){let e=f.code;return f.message??(e?xn[e]:`Please choose a different handle.`)}return null})(),O=E?n:T?r??null:m?`Checking availability…`:f?.available?`Available.`:null,k=!T&&!m&&f?.available!==!1&&g!==`saving`,A=(0,X.useCallback)(async()=>{if(!k)return;_(`saving`),y(null);let e=await a(w);if(e.kind===`ok`){_(`saved`),o(e.data),V.success(c),window.setTimeout(()=>_(`idle`),Dn);return}if(e.kind===`taken`){_(`idle`),p({available:!1,code:`taken`,message:e.message});return}if(e.kind===`invalid`){_(`idle`),p({available:!1,code:e.code,message:e.message});return}_(`error`),y(e.message),V.error(e.message)},[k,w,o,a,c]),j=(()=>{if(T&&u.length>0||u.length===0)return null;let e=m?`checking`:f?.available?`available`:f?.available===!1?`invalid`:null;return e?(0,Z.jsx)(en,{mode:`wait`,initial:!1,children:(0,Z.jsxs)($t.span,{initial:b?!1:{opacity:0,scale:.85},animate:{opacity:1,scale:1},exit:b?void 0:{opacity:0,scale:.85},transition:{duration:.14,ease:`easeOut`},className:`flex items-center`,"aria-hidden":e!==`available`&&e!==`invalid`,children:[e===`checking`&&(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),e===`available`&&(0,Z.jsx)(x,{className:`h-4 w-4 text-[var(--system-positive-strong)]`,"aria-label":`Available`}),e===`invalid`&&(0,Z.jsx)(C,{className:`h-4 w-4 text-[var(--system-negative-strong)]`,"aria-label":`Not available`})]},e)}):null})(),M=(()=>{switch(g){case`saving`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(D,{className:`h-3.5 w-3.5 animate-spin`,"aria-hidden":!0}),`Saving…`]});case`saved`:return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,Z.jsx)(x,{className:`h-3.5 w-3.5`,"aria-hidden":!0}),`Saved`]});default:return`Save`}})();return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(z,{label:t,value:u,onChange:e=>{d(e.target.value.replace(/\s+/g,``)),p(null),y(null)},autoCorrect:`off`,autoCapitalize:`none`,spellCheck:!1,maxLength:30,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),rightIcon:j,errorText:E??void 0,helperText:O??void 0,"aria-invalid":!!E,fullWidth:!0,"data-testid":`${l}-input`}),(!T||g!==`idle`)&&(0,Z.jsx)(`div`,{className:`flex justify-end`,children:(0,Z.jsx)(s,{variant:`primary`,size:`compact`,onClick:A,disabled:!k,"aria-live":`polite`,"data-testid":`${l}-save`,children:M})})]})}function kn({initial:e,onSaved:t}){let n=Xe.use.refreshSession(),r=Tn(e.username)?`Your handle was auto-generated at signup — pick one you like.`:void 0,i=(0,X.useCallback)(async e=>await Ke({username:e}),[]),a=(0,X.useCallback)((e,t)=>Ge(e,t),[]),o=(0,X.useCallback)(e=>{t(e),n()},[t,n]);return(0,Z.jsx)(On,{initialHandle:e.username,inputLabel:`User handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:r,checkAvailable:a,save:i,onSaved:o,saveSuccessToast:`Profile updated.`,fieldId:`user-handle`})}function An({assistant:e,onSaved:t}){let n=e.handle??``,r=f({...Pt({path:{assistant_id:e.id}})}).data?.results?.[0],i=!!r&&r.subdomain.toLowerCase()===n.toLowerCase(),a=n.length===0?`Your assistant doesn't have a handle yet — claim one to make it mentionable.`:void 0,o=(0,X.useCallback)(async t=>await Cn(e.id,t),[e.id]),s=(0,X.useCallback)((t,n)=>wn(e.id,t,n),[e.id]);return i?(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(z,{label:`Assistant handle`,value:n,readOnly:!0,disabled:!0,leftIcon:(0,Z.jsx)(`span`,{className:`select-none font-mono text-[var(--content-tertiary)]`,"aria-hidden":!0,children:`@`}),fullWidth:!0,"data-testid":`assistant-handle-input`}),(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Your assistant's handle is locked because it's used as its email subdomain. To change it,`,` `,(0,Z.jsx)(u,{to:`${q.settings.ai}?release=1#email`,className:`text-[var(--content-link)] underline hover:text-[var(--content-link-hover)]`,children:`release the subdomain`}),` `,`first.`]})]}):(0,Z.jsx)(On,{initialHandle:n,inputLabel:`Assistant handle`,helperText:`Lowercase letters, digits, hyphens, and underscores. 3–30 characters.`,idleHelperText:a,checkAvailable:s,save:o,onSaved:t,saveSuccessToast:`Assistant handle updated.`,fieldId:`assistant-handle`})}function jn(){return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,"aria-busy":!0,"aria-live":`polite`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(H,{className:`h-3 w-16`}),(0,Z.jsx)(H,{className:`h-9 w-full rounded-md`}),(0,Z.jsx)(H,{className:`h-3 w-72`})]}),(0,Z.jsx)(H,{className:`h-9 w-full rounded-md`}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsx)(H,{className:`h-3 w-60`}),(0,Z.jsx)(H,{className:`h-7 w-16 rounded-md`})]}),(0,Z.jsx)(`span`,{className:`sr-only`,children:`Loading your profile…`})]})}function Mn(){return(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`})}function Nn({assistant:e,showHandles:t=!0,children:n}={}){let r=Xe.use.user?.()?.email??null;return(0,Z.jsx)(Y,{title:`Profile`,subtitle:`Manage your account details and preferences.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[r&&(0,Z.jsx)(`div`,{className:`max-w-[420px]`,children:(0,Z.jsx)(z,{label:`Email`,value:r,disabled:!0,readOnly:!0})}),t&&(0,Z.jsxs)(Z.Fragment,{children:[r&&(0,Z.jsx)(Mn,{}),(0,Z.jsx)(Pn,{assistant:e})]}),n!=null&&(0,Z.jsxs)(Z.Fragment,{children:[(r||t)&&(0,Z.jsx)(Mn,{}),n]})]})})}function Pn({assistant:e}){let[t,n]=(0,X.useState)(null),[r,i]=(0,X.useState)(null),a=tn(),[o,s]=(0,X.useState)(e??null);return(0,X.useEffect)(()=>{s(e??null)},[e]),(0,X.useEffect)(()=>{let e=!1;return $e().then(t=>{e||n(t)}).catch(t=>{e||i(t instanceof Error?t.message:`Failed to load profile.`)}),()=>{e=!0}},[]),r?(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:r}):t?(0,Z.jsxs)($t.div,{initial:a?!1:{opacity:0,y:4},animate:{opacity:1,y:0},transition:{duration:.22,ease:`easeOut`},className:`flex flex-col gap-6`,children:[(0,Z.jsx)(kn,{initial:t,onSaved:n}),o&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(An,{assistant:o,onSaved:s})]})]}):(0,Z.jsx)(jn,{})}var Fn=Bt({query:{hosting:`platform`}});function In(){let e=nn(),t=f(Fn),n=t.data?.results??[];return t.isPending||n.length<2?null:(0,Z.jsx)(Y,{title:`Switch Assistant`,subtitle:`Choose which assistant is active for this account.`,children:(0,Z.jsx)(`div`,{className:`space-y-2`,children:n.map(t=>{let n=t.id===e;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4 rounded-lg border px-4 py-3 ${n?`border-[var(--border-focus)] bg-[var(--surface-lift)]`:`border-[var(--border-base)] bg-[var(--surface-default)]`}`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(O,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsx)(`div`,{className:`min-w-0`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:t.name||`Unnamed`}),t.status!==`active`&&(0,Z.jsx)(ve,{tone:`warning`,children:t.status})]})})]}),(0,Z.jsx)(`div`,{className:`shrink-0`,children:n?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1.5 text-body-small-default text-[var(--system-positive-default)]`,children:[(0,Z.jsx)(x,{className:`h-4 w-4`}),`Active`]}):(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,disabled:t.status!==`active`,onClick:()=>{qe(t.id),V.success(`Switched active assistant.`)},children:`Switch`})})]},t.id)})})})}var Ln=[{label:`Never`,seconds:0},{label:`5 min`,seconds:300,devOnly:!0},{label:`10 min`,seconds:600,devOnly:!0},{label:`1 hour`,seconds:3600},{label:`3 hours`,seconds:10800},{label:`1 day`,seconds:86400},{label:`3 days`,seconds:259200},{label:`7 days`,seconds:604800},{label:`14 days`,seconds:1209600},{label:`30 days`,seconds:2592e3}];function Rn(e){if(e===0)return`Never (sleep disabled)`;let t=Math.floor(e/86400),n=Math.floor(e%86400/3600);if(t>0&&n>0)return`${t}d ${n}h`;if(t>0)return`${t} day${t===1?``:`s`}`;if(n>0)return`${n} hour${n===1?``:`s`}`;let r=Math.floor(e/60);return r>0?`${r} minute${r===1?``:`s`}`:`${e}s`}function zn({assistantId:e}){let t=d(),n=un.use.isNonProduction(),r=(0,X.useMemo)(()=>Ln.filter(e=>!e.devOnly||n),[n]),{data:i,isLoading:a,isError:o}=f(bt({path:{id:e}})),c=(0,X.useMemo)(()=>i?.idle_timeout_seconds??259200,[i]),[l,u]=(0,X.useState)(null),p=l??c,m=l!==null,h=Rt({onSuccess:()=>{V.success(`Sleep policy saved.`),u(null),t.invalidateQueries({queryKey:It({path:{id:e}})})},onError:()=>{V.error(`Failed to save sleep policy. Please try again.`)}});return a?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading sleep settings...`]}):o?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load sleep policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`label`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Idle timeout`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`How long the assistant can be idle before it is put to sleep. "Never" disables idle sleep entirely.`}),(0,Z.jsx)(`div`,{className:`mt-2 flex flex-wrap gap-2`,children:r.map(e=>(0,Z.jsx)(s,{variant:`outlined`,active:p===e.seconds,onClick:()=>u(e.seconds),children:e.label},e.seconds))}),(0,Z.jsxs)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:[`Current: `,Rn(p)]})]}),m&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(s,{variant:`primary`,leftIcon:h.isPending?(0,Z.jsx)(D,{className:`animate-spin`}):void 0,onClick:()=>h.mutate({path:{id:e},body:{idle_timeout_seconds:p}}),disabled:h.isPending,children:`Save`}),(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>u(null),disabled:h.isPending,children:`Cancel`})]})]})}function Bn(e,t,n){let r=[e.version];return e.version===n&&r.push(`(latest)`),t&&e.version===t&&r.push(`(current)`),r.join(` `)}var Vn=3e3;function Hn({version:e,assistantId:t}){let{onTap:n,message:r}=fn(t);return(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`button`,{type:`button`,className:`block min-w-0 break-all text-left text-body-medium-lighter text-[var(--content-default)]`,onClick:n,children:e??`—`}),r&&(0,Z.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-accent)]`,children:r})]})}function Un({assistantId:e,currentVersion:t,releaseChannel:n,onUpgradeComplete:r}){let i=Wt.use.rollbackEnabled(),a=K.use.previewChannel(),o=d(),c=Yt(n,a),l=c===`preview`,[u,m]=(0,X.useState)(!1),h=(0,X.useRef)(null),[g,_]=(0,X.useState)(null),[v,y]=(0,X.useState)(!1),[b,x]=(0,X.useState)(!1),[S,C]=(0,X.useState)(null),w=e=>e&&h.current&&e===h.current?(queueMicrotask(()=>{C(b?`Successfully rolled back to version ${h.current}.`:`Successfully updated to version ${h.current}.`),m(!1),h.current=null,_(null),V.success(b?`Rollback complete. Your assistant is healthy.`:`Update complete. Your assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),r?.()}),!1):Vn;f({...kt({path:{id:e}}),refetchInterval:u?e=>w(e.state.data?.current_release_version):!1});let{data:T,isLoading:E}=f(Ht({query:{channel:c}})),O=T?.find(e=>e.is_stable!==!1)??T?.[0],k=g??O?.version??null,A=(0,X.useMemo)(()=>{if(!i||!k||!t)return!1;let e=Be(k),n=Be(t);return!e||!n?!1:Ve(e,n)<0},[i,k,t]),j=(0,X.useMemo)(()=>{if(!k)return!1;if(!t)return!0;let e=Be(k),n=Be(t);if(!e||!n)return k!==t;let r=Ve(e,n);return i?r!==0:r>0},[i,k,t]),M=p({mutationFn:async t=>{let{data:n}=await at({path:{id:e},body:t,throwOnError:!0});return n}}),N=p({mutationFn:async t=>{let{data:n}=await st({path:{id:e},body:t,throwOnError:!0});return n}});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(Hn,{version:t,assistantId:e})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:l?`Preview release`:j?A?`Rollback to`:`Update to`:`Selected`}),(0,Z.jsx)(`span`,{className:`block min-w-0`,children:E?(0,Z.jsxs)(`span`,{className:`flex items-center gap-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`}),`Loading...`]}):T&&T.length>0?i?(0,Z.jsx)(xe,{value:k??``,onChange:e=>_(e===O?.version?null:e),disabled:u||M.isPending||N.isPending,options:T.map(e=>({value:e.version,label:Bn(e,t,O?.version)}))}):(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:O?Bn(O,t,O.version):`—`}):`No releases available`})]})]}),(0,Z.jsx)(s,{variant:A?`outlined`:`primary`,className:`min-w-[160px]`,leftIcon:M.isPending||N.isPending||u?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),onClick:()=>y(!0),disabled:!j||M.isPending||N.isPending||u||E||!T?.length,children:u?b?`Rolling back...`:`Updating...`:A?`Rollback`:l?`Update preview`:`Update`}),l&&(0,Z.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[`Using Preview releases.`,` `,(0,Z.jsx)(`a`,{href:`#preview-release-channel`,className:`text-[var(--primary-base)] underline-offset-2 hover:underline`,children:`Switch back to Stable`})]}),!j&&t&&k&&!E&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:S??`You are already on this version.`}),(0,Z.jsx)(be,{open:v,title:A?`Rollback assistant`:l?`Update preview release`:`Update assistant`,message:A?`Rollback to version ${k??`unknown`}? The assistant will be briefly unavailable.`:l?`Update to preview version ${k??`latest`}? The assistant will be briefly unavailable during the update.`:`Update to version ${k??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:A?`Rollback`:l?`Update preview`:`Update`,onConfirm:async()=>{y(!1),C(null);let t=i?k??void 0:void 0;try{if(A){let e=await N.mutateAsync({version:t});h.current=e.version??t??null,V.success(e.detail||`Rollback to ${t} initiated.`)}else{let e=await M.mutateAsync({version:t});if(e.detail?.includes(`Already on the latest`)){V.warning(e.detail);return}h.current=e.version??t??null,V.success(e.detail||`Update to ${e.version??t??`latest`} initiated.`)}x(A),m(!0),o.invalidateQueries({queryKey:Lt({path:{id:e}})})}catch{V.error(A?`Failed to trigger rollback. Please try again.`:`Failed to trigger update. Please try again.`)}},onCancel:()=>y(!1)})]})}function Wn({assistantId:e,currentVersion:t,onUpgradeComplete:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(null),{data:c,isLoading:l}=f(Ht({query:{stable:!0,limit:100}})),u=(0,X.useMemo)(()=>Xt(c),[c]),d=u?.version,p=t?Jt(t,d):!!d,m=Zt({assistantId:e,targetVersion:d});return(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 md:grid md:grid-cols-[auto_minmax(0,1fr)] md:items-center md:gap-x-8 md:gap-y-4`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Current`}),(0,Z.jsx)(Hn,{version:t,assistantId:e})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1 md:contents`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Update to`}),(0,Z.jsx)(`span`,{className:`block min-w-0 break-all text-body-medium-lighter text-[var(--content-default)]`,children:l?`Loading...`:d&&u?Bn(u,t,d):`No releases available`})]})]}),(0,Z.jsx)(s,{variant:`primary`,className:`min-w-[160px]`,leftIcon:m.isPending?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),onClick:()=>i(!0),disabled:m.isPending||l||!d||!p,children:m.isPending?`Updating...`:d?`Update to ${d}`:`Update`}),a&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:a}),!a&&!p&&d&&!l&&(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-positive-strong)]`,children:`You are already on this version.`}),(0,Z.jsx)(be,{open:r,title:`Update assistant`,message:`Update to version ${d??`latest`}? The assistant will be briefly unavailable during the update.`,confirmLabel:`Update`,onConfirm:async()=>{i(!1),o(null);try{let e=await m.upgrade();o(e.version?`Successfully updated to version ${e.version}.`:`Successfully updated to version ${d??`latest`}.`),V.success(`Update complete. Your assistant is healthy.`,{id:`runtime-upgrade-complete`,tone:`strong`}),n?.()}catch(e){V.error(e instanceof Error?e.message:`Failed to trigger update. Please try again.`)}},onCancel:()=>i(!1)})]})}function Gn(){let e=_t({platformHostedOnly:!0}),t=vt(),n=Xe.use.user()?.id??null,r=Xe.use.logout(),[i,a]=(0,X.useState)(!1),o=Et({onSuccess:async()=>{V.success(`Account deletion requested. You will be logged out shortly.`),Ye(n),await r(),Ut(q.account.login)},onError:()=>{V.error(`Failed to request account deletion. Please try again.`)}}),c=e===`full`&&t;return(0,X.useEffect)(()=>{c&&i&&a(!1)},[c,i]),e===`gated`?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Delete Account`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Permanently delete your account and all associated data.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:e===`disabled`?(0,Z.jsx)(J,{children:`Log in to the Vellum platform to delete your account.`}):(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>a(!0),disabled:o.isPending||c,className:`self-start`,children:`Delete My Account`}),c&&(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`})]})})]}),(0,Z.jsx)(be,{open:i,title:`Delete Account`,message:`This will permanently delete your account and all associated data. This action cannot be undone.`,confirmLabel:`Delete Account`,destructive:!0,onConfirm:()=>{if(c){a(!1);return}a(!1),o.mutate({})},onCancel:()=>a(!1)})]})}function Kn({title:e,subtitle:t,benefits:n,ctaLabel:r,ctaLeftIcon:i,onAction:a}){return(0,Z.jsx)(Y,{title:e,subtitle:t,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`ul`,{className:`space-y-3`,children:n.map(({icon:e,text:t})=>(0,Z.jsxs)(`li`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(`span`,{className:`flex size-7 shrink-0 items-center justify-center rounded-md`,style:{background:`var(--surface-base)`},children:(0,Z.jsx)(e,{size:14,style:{color:`var(--content-secondary)`},"aria-hidden":!0})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[color:var(--content-secondary)]`,children:t})]},t))}),(0,Z.jsx)(s,{variant:`primary`,size:`regular`,leftIcon:i,onClick:a,className:`self-start`,children:r})]})})}function qn(){let e=ft(),t=gt(),n=e?`ios`:t?`android`:null,r=n?te(n):null;return r?(0,Z.jsx)(Kn,{title:`Get the ${r.appName} App`,subtitle:`The Vellum ${r.appName} app gives you a native experience.`,benefits:[{icon:b,text:`Push notifications`},{icon:_n,text:`Biometric login`},{icon:yn,text:`Native haptics`},{icon:se,text:`Home screen access`}],ctaLabel:`Download`,ctaLeftIcon:(0,Z.jsx)(se,{size:16}),onAction:()=>{F(r.platform),L(r.platform)}}):null}var Jn=`0.10.0`;function Yn(){return He(Jn)}var Xn=[`login.tailscale.com`,`tailscale.com`,`www.tailscale.com`,`ngrok.com`,`dashboard.ngrok.com`,`dash.cloudflare.com`,`cloudflare.com`,`www.cloudflare.com`];function Zn(e){let t;try{t=new URL(e).hostname}catch{return!1}return Xn.includes(t)}function Qn(e){let t;try{t=new URL(e).hostname}catch{return null}return Xn.includes(t)?t.includes(`tailscale`)?`Tailscale`:t.includes(`ngrok`)?`ngrok`:t.includes(`cloudflare`)?`Cloudflare`:null:null}function $n(e){try{let t=new URL(e).hostname;return t===`localhost`||t===`[::1]`||/^127(?:\.\d{1,3}){3}$/.test(t)}catch{return!1}}function er(e){let t=new URL(e);t.search=``,t.hash=``;let n=t.pathname.split(`/`).filter(Boolean),r=n.indexOf(`assistant`);return r>=0&&n.splice(r),t.pathname=n.length?`/${n.join(`/`)}`:`/`,t.toString().replace(/\/+$/,``)}function tr(e){let t;try{t=er(e)}catch{return{ok:!1,reason:`unparseable`}}return $n(t)?{ok:!1,reason:`loopback`}:Zn(t)?{ok:!1,reason:`service-website`}:new URL(t).protocol===`https:`?{ok:!0,url:t}:{ok:!1,reason:`non-https`}}function nr(e){let t=new URL(e.verificationUri);return t.hash=new URLSearchParams({device_code:e.deviceCode}).toString(),t.toString()}function rr(e,t){switch(e){case`unparseable`:return`Enter a valid URL, e.g. https://your-assistant.ts.net.`;case`loopback`:return`This is a loopback address other devices can't reach. Enter the assistant's public https URL.`;case`non-https`:return`The URL must use https so your devices can connect securely.`;case`service-website`:return`This is ${t&&Qn(t)||`the tunnel provider`}'s website, not your assistant's address. Run \`vellum tunnel\` on the host to get one.`}}var ir=`/v1/remote-web/pairing-challenge`,ar=`/v1/remote-web/pairing-verification`,or="If a scan can't connect, make sure a tunnel is running on the host (`vellum tunnel`) and the public URL points at it, then generate a new code.",sr=class extends Error{hint;constructor(e,t){super(e),this.name=`PairDeviceError`,this.hint=t}};function cr(){if(typeof window>`u`)return null;let e=Me(),t=ke(e);return t?{base:`${window.location.origin}${t}`,assistantName:e?.name?.trim()||null,ingressUrl:e?.ingressUrl?.trim()||null}:null}function lr(e){let t=e?.error?.message;return typeof t==`string`&&t.trim()?t:null}async function ur(e,t,n){let r;try{r=await fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t),signal:n})}catch(e){throw e instanceof DOMException&&e.name===`AbortError`?e:new sr(`Couldn't reach the assistant. Make sure it's running and try again.`)}let i=await r.json().catch(()=>null);if(!r.ok)throw new sr(lr(i)??`Pairing failed (HTTP ${r.status}).`,or);if(typeof i!=`object`||!i)throw new sr(`The assistant returned an unexpected response.`);return i}async function dr(e){let{base:t,publicBaseUrl:n,signal:r}=e,i=await ur(`${t}${ir}`,{publicBaseUrl:n},r);return await ur(`${t}${ar}`,{userCode:i.userCode},r),{pairUrl:nr(i),expiresAt:i.expiresAt}}var fr=Object.defineProperty,pr=Object.getOwnPropertySymbols,mr=Object.prototype.hasOwnProperty,hr=Object.prototype.propertyIsEnumerable,gr=(e,t,n)=>t in e?fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_r=(e,t)=>{for(var n in t||={})mr.call(t,n)&&gr(e,n,t[n]);if(pr)for(var n of pr(t))hr.call(t,n)&&gr(e,n,t[n]);return e},vr=(e,t)=>{var n={};for(var r in e)mr.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&pr)for(var r of pr(e))t.indexOf(r)<0&&hr.call(e,r)&&(n[r]=e[r]);return n},yr;(e=>{let t=class t{constructor(e,n,r,a){if(this.version=e,this.errorCorrectionLevel=n,this.modules=[],this.isFunction=[],e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version value out of range`);if(a<-1||a>7)throw RangeError(`Mask value out of range`);this.size=e*4+17;let o=[];for(let e=0;e<this.size;e++)o.push(!1);for(let e=0;e<this.size;e++)this.modules.push(o.slice()),this.isFunction.push(o.slice());this.drawFunctionPatterns();let s=this.addEccAndInterleave(r);if(this.drawCodewords(s),a==-1){let e=1e9;for(let t=0;t<8;t++){this.applyMask(t),this.drawFormatBits(t);let n=this.getPenaltyScore();n<e&&(a=t,e=n),this.applyMask(t)}}i(0<=a&&a<=7),this.mask=a,this.applyMask(a),this.drawFormatBits(a),this.isFunction=[]}static encodeText(n,r){let i=e.QrSegment.makeSegments(n);return t.encodeSegments(i,r)}static encodeBinary(n,r){let i=e.QrSegment.makeBytes(n);return t.encodeSegments([i],r)}static encodeSegments(e,r,a=1,s=40,c=-1,l=!0){if(!(t.MIN_VERSION<=a&&a<=s&&s<=t.MAX_VERSION)||c<-1||c>7)throw RangeError(`Invalid value`);let u,d;for(u=a;;u++){let n=t.getNumDataCodewords(u,r)*8,i=o.getTotalBits(e,u);if(i<=n){d=i;break}if(u>=s)throw RangeError(`Data too long`)}for(let e of[t.Ecc.MEDIUM,t.Ecc.QUARTILE,t.Ecc.HIGH])l&&d<=t.getNumDataCodewords(u,e)*8&&(r=e);let f=[];for(let t of e){n(t.mode.modeBits,4,f),n(t.numChars,t.mode.numCharCountBits(u),f);for(let e of t.getData())f.push(e)}i(f.length==d);let p=t.getNumDataCodewords(u,r)*8;i(f.length<=p),n(0,Math.min(4,p-f.length),f),n(0,(8-f.length%8)%8,f),i(f.length%8==0);for(let e=236;f.length<p;e^=253)n(e,8,f);let m=[];for(;m.length*8<f.length;)m.push(0);return f.forEach((e,t)=>m[t>>>3]|=e<<7-(t&7)),new t(u,r,m,c)}getModule(e,t){return 0<=e&&e<this.size&&0<=t&&t<this.size&&this.modules[t][e]}getModules(){return this.modules}drawFunctionPatterns(){for(let e=0;e<this.size;e++)this.setFunctionModule(6,e,e%2==0),this.setFunctionModule(e,6,e%2==0);this.drawFinderPattern(3,3),this.drawFinderPattern(this.size-4,3),this.drawFinderPattern(3,this.size-4);let e=this.getAlignmentPatternPositions(),t=e.length;for(let n=0;n<t;n++)for(let r=0;r<t;r++)n==0&&r==0||n==0&&r==t-1||n==t-1&&r==0||this.drawAlignmentPattern(e[n],e[r]);this.drawFormatBits(0),this.drawVersion()}drawFormatBits(e){let t=this.errorCorrectionLevel.formatBits<<3|e,n=t;for(let e=0;e<10;e++)n=n<<1^(n>>>9)*1335;let a=(t<<10|n)^21522;i(a>>>15==0);for(let e=0;e<=5;e++)this.setFunctionModule(8,e,r(a,e));this.setFunctionModule(8,7,r(a,6)),this.setFunctionModule(8,8,r(a,7)),this.setFunctionModule(7,8,r(a,8));for(let e=9;e<15;e++)this.setFunctionModule(14-e,8,r(a,e));for(let e=0;e<8;e++)this.setFunctionModule(this.size-1-e,8,r(a,e));for(let e=8;e<15;e++)this.setFunctionModule(8,this.size-15+e,r(a,e));this.setFunctionModule(8,this.size-8,!0)}drawVersion(){if(this.version<7)return;let e=this.version;for(let t=0;t<12;t++)e=e<<1^(e>>>11)*7973;let t=this.version<<12|e;i(t>>>18==0);for(let e=0;e<18;e++){let n=r(t,e),i=this.size-11+e%3,a=Math.floor(e/3);this.setFunctionModule(i,a,n),this.setFunctionModule(a,i,n)}}drawFinderPattern(e,t){for(let n=-4;n<=4;n++)for(let r=-4;r<=4;r++){let i=Math.max(Math.abs(r),Math.abs(n)),a=e+r,o=t+n;0<=a&&a<this.size&&0<=o&&o<this.size&&this.setFunctionModule(a,o,i!=2&&i!=4)}}drawAlignmentPattern(e,t){for(let n=-2;n<=2;n++)for(let r=-2;r<=2;r++)this.setFunctionModule(e+r,t+n,Math.max(Math.abs(r),Math.abs(n))!=1)}setFunctionModule(e,t,n){this.modules[t][e]=n,this.isFunction[t][e]=!0}addEccAndInterleave(e){let n=this.version,r=this.errorCorrectionLevel;if(e.length!=t.getNumDataCodewords(n,r))throw RangeError(`Invalid argument`);let a=t.NUM_ERROR_CORRECTION_BLOCKS[r.ordinal][n],o=t.ECC_CODEWORDS_PER_BLOCK[r.ordinal][n],s=Math.floor(t.getNumRawDataModules(n)/8),c=a-s%a,l=Math.floor(s/a),u=[],d=t.reedSolomonComputeDivisor(o);for(let n=0,r=0;n<a;n++){let i=e.slice(r,r+l-o+(n<c?0:1));r+=i.length;let a=t.reedSolomonComputeRemainder(i,d);n<c&&i.push(0),u.push(i.concat(a))}let f=[];for(let e=0;e<u[0].length;e++)u.forEach((t,n)=>{(e!=l-o||n>=c)&&f.push(t[e])});return i(f.length==s),f}drawCodewords(e){if(e.length!=Math.floor(t.getNumRawDataModules(this.version)/8))throw RangeError(`Invalid argument`);let n=0;for(let t=this.size-1;t>=1;t-=2){t==6&&(t=5);for(let i=0;i<this.size;i++)for(let a=0;a<2;a++){let o=t-a,s=t+1&2?i:this.size-1-i;!this.isFunction[s][o]&&n<e.length*8&&(this.modules[s][o]=r(e[n>>>3],7-(n&7)),n++)}}i(n==e.length*8)}applyMask(e){if(e<0||e>7)throw RangeError(`Mask value out of range`);for(let t=0;t<this.size;t++)for(let n=0;n<this.size;n++){let r;switch(e){case 0:r=(n+t)%2==0;break;case 1:r=t%2==0;break;case 2:r=n%3==0;break;case 3:r=(n+t)%3==0;break;case 4:r=(Math.floor(n/3)+Math.floor(t/2))%2==0;break;case 5:r=n*t%2+n*t%3==0;break;case 6:r=(n*t%2+n*t%3)%2==0;break;case 7:r=((n+t)%2+n*t%3)%2==0;break;default:throw Error(`Unreachable`)}!this.isFunction[t][n]&&r&&(this.modules[t][n]=!this.modules[t][n])}}getPenaltyScore(){let e=0;for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[n][o]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[n][o],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size;n++){let r=!1,i=0,a=[0,0,0,0,0,0,0];for(let o=0;o<this.size;o++)this.modules[o][n]==r?(i++,i==5?e+=t.PENALTY_N1:i>5&&e++):(this.finderPenaltyAddHistory(i,a),r||(e+=this.finderPenaltyCountPatterns(a)*t.PENALTY_N3),r=this.modules[o][n],i=1);e+=this.finderPenaltyTerminateAndCount(r,i,a)*t.PENALTY_N3}for(let n=0;n<this.size-1;n++)for(let r=0;r<this.size-1;r++){let i=this.modules[n][r];i==this.modules[n][r+1]&&i==this.modules[n+1][r]&&i==this.modules[n+1][r+1]&&(e+=t.PENALTY_N2)}let n=0;for(let e of this.modules)n=e.reduce((e,t)=>e+ +!!t,n);let r=this.size*this.size,a=Math.ceil(Math.abs(n*20-r*10)/r)-1;return i(0<=a&&a<=9),e+=a*t.PENALTY_N4,i(0<=e&&e<=2568888),e}getAlignmentPatternPositions(){if(this.version==1)return[];{let e=Math.floor(this.version/7)+2,t=this.version==32?26:Math.ceil((this.version*4+4)/(e*2-2))*2,n=[6];for(let r=this.size-7;n.length<e;r-=t)n.splice(1,0,r);return n}}static getNumRawDataModules(e){if(e<t.MIN_VERSION||e>t.MAX_VERSION)throw RangeError(`Version number out of range`);let n=(16*e+128)*e+64;if(e>=2){let t=Math.floor(e/7)+2;n-=(25*t-10)*t-55,e>=7&&(n-=36)}return i(208<=n&&n<=29648),n}static getNumDataCodewords(e,n){return Math.floor(t.getNumRawDataModules(e)/8)-t.ECC_CODEWORDS_PER_BLOCK[n.ordinal][e]*t.NUM_ERROR_CORRECTION_BLOCKS[n.ordinal][e]}static reedSolomonComputeDivisor(e){if(e<1||e>255)throw RangeError(`Degree out of range`);let n=[];for(let t=0;t<e-1;t++)n.push(0);n.push(1);let r=1;for(let i=0;i<e;i++){for(let e=0;e<n.length;e++)n[e]=t.reedSolomonMultiply(n[e],r),e+1<n.length&&(n[e]^=n[e+1]);r=t.reedSolomonMultiply(r,2)}return n}static reedSolomonComputeRemainder(e,n){let r=n.map(e=>0);for(let i of e){let e=i^r.shift();r.push(0),n.forEach((n,i)=>r[i]^=t.reedSolomonMultiply(n,e))}return r}static reedSolomonMultiply(e,t){if(e>>>8||t>>>8)throw RangeError(`Byte out of range`);let n=0;for(let r=7;r>=0;r--)n=n<<1^(n>>>7)*285,n^=(t>>>r&1)*e;return i(n>>>8==0),n}finderPenaltyCountPatterns(e){let t=e[1];i(t<=this.size*3);let n=t>0&&e[2]==t&&e[3]==t*3&&e[4]==t&&e[5]==t;return(n&&e[0]>=t*4&&e[6]>=t?1:0)+(n&&e[6]>=t*4&&e[0]>=t?1:0)}finderPenaltyTerminateAndCount(e,t,n){return e&&(this.finderPenaltyAddHistory(t,n),t=0),t+=this.size,this.finderPenaltyAddHistory(t,n),this.finderPenaltyCountPatterns(n)}finderPenaltyAddHistory(e,t){t[0]==0&&(e+=this.size),t.pop(),t.unshift(e)}};t.MIN_VERSION=1,t.MAX_VERSION=40,t.PENALTY_N1=3,t.PENALTY_N2=3,t.PENALTY_N3=40,t.PENALTY_N4=10,t.ECC_CODEWORDS_PER_BLOCK=[[-1,7,10,15,20,26,18,20,24,30,18,20,24,26,30,22,24,28,30,28,28,28,28,30,30,26,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,10,16,26,18,24,16,18,22,22,26,30,22,22,24,24,28,28,26,26,26,26,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28,28],[-1,13,22,18,26,18,24,18,22,20,24,28,26,24,20,30,24,28,28,26,30,28,30,30,30,30,28,30,30,30,30,30,30,30,30,30,30,30,30,30,30],[-1,17,28,22,16,22,28,26,26,24,28,24,28,22,24,24,30,28,28,26,28,30,24,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30,30]],t.NUM_ERROR_CORRECTION_BLOCKS=[[-1,1,1,1,1,1,2,2,2,2,4,4,4,4,4,6,6,6,6,7,8,8,9,9,10,12,12,12,13,14,15,16,17,18,19,19,20,21,22,24,25],[-1,1,1,1,2,2,4,4,4,5,5,5,8,9,9,10,10,11,13,14,16,17,17,18,20,21,23,25,26,28,29,31,33,35,37,38,40,43,45,47,49],[-1,1,1,2,2,4,4,6,6,8,8,8,10,12,16,12,17,16,18,21,20,23,23,25,27,29,34,34,35,38,40,43,45,48,51,53,56,59,62,65,68],[-1,1,1,2,4,4,4,5,6,8,8,11,11,16,16,18,16,19,21,25,25,25,34,30,32,35,37,40,42,45,48,51,54,57,60,63,66,70,74,77,81]],e.QrCode=t;function n(e,t,n){if(t<0||t>31||e>>>t)throw RangeError(`Value out of range`);for(let r=t-1;r>=0;r--)n.push(e>>>r&1)}function r(e,t){return(e>>>t&1)!=0}function i(e){if(!e)throw Error(`Assertion error`)}let a=class e{constructor(e,t,n){if(this.mode=e,this.numChars=t,this.bitData=n,t<0)throw RangeError(`Invalid argument`);this.bitData=n.slice()}static makeBytes(t){let r=[];for(let e of t)n(e,8,r);return new e(e.Mode.BYTE,t.length,r)}static makeNumeric(t){if(!e.isNumeric(t))throw RangeError(`String contains non-numeric characters`);let r=[];for(let e=0;e<t.length;){let i=Math.min(t.length-e,3);n(parseInt(t.substring(e,e+i),10),i*3+1,r),e+=i}return new e(e.Mode.NUMERIC,t.length,r)}static makeAlphanumeric(t){if(!e.isAlphanumeric(t))throw RangeError(`String contains unencodable characters in alphanumeric mode`);let r=[],i;for(i=0;i+2<=t.length;i+=2){let a=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i))*45;a+=e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i+1)),n(a,11,r)}return i<t.length&&n(e.ALPHANUMERIC_CHARSET.indexOf(t.charAt(i)),6,r),new e(e.Mode.ALPHANUMERIC,t.length,r)}static makeSegments(t){return t==``?[]:e.isNumeric(t)?[e.makeNumeric(t)]:e.isAlphanumeric(t)?[e.makeAlphanumeric(t)]:[e.makeBytes(e.toUtf8ByteArray(t))]}static makeEci(t){let r=[];if(t<0)throw RangeError(`ECI assignment value out of range`);if(t<128)n(t,8,r);else if(t<16384)n(2,2,r),n(t,14,r);else if(t<1e6)n(6,3,r),n(t,21,r);else throw RangeError(`ECI assignment value out of range`);return new e(e.Mode.ECI,0,r)}static isNumeric(t){return e.NUMERIC_REGEX.test(t)}static isAlphanumeric(t){return e.ALPHANUMERIC_REGEX.test(t)}getData(){return this.bitData.slice()}static getTotalBits(e,t){let n=0;for(let r of e){let e=r.mode.numCharCountBits(t);if(r.numChars>=1<<e)return 1/0;n+=4+e+r.bitData.length}return n}static toUtf8ByteArray(e){e=encodeURI(e);let t=[];for(let n=0;n<e.length;n++)e.charAt(n)==`%`?(t.push(parseInt(e.substring(n+1,n+3),16)),n+=2):t.push(e.charCodeAt(n));return t}};a.NUMERIC_REGEX=/^[0-9]*$/,a.ALPHANUMERIC_REGEX=/^[A-Z0-9 $%*+.\/:-]*$/,a.ALPHANUMERIC_CHARSET=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`;let o=a;e.QrSegment=a})(yr||={}),(e=>{(e=>{let t=class{constructor(e,t){this.ordinal=e,this.formatBits=t}};t.LOW=new t(0,1),t.MEDIUM=new t(1,0),t.QUARTILE=new t(2,3),t.HIGH=new t(3,2),e.Ecc=t})(e.QrCode||={})})(yr||={}),(e=>{(e=>{let t=class{constructor(e,t){this.modeBits=e,this.numBitsCharCount=t}numCharCountBits(e){return this.numBitsCharCount[Math.floor((e+7)/17)]}};t.NUMERIC=new t(1,[10,12,14]),t.ALPHANUMERIC=new t(2,[9,11,13]),t.BYTE=new t(4,[8,16,16]),t.KANJI=new t(8,[8,10,12]),t.ECI=new t(7,[0,0,0]),e.Mode=t})(e.QrSegment||={})})(yr||={});var br=yr,xr={L:br.QrCode.Ecc.LOW,M:br.QrCode.Ecc.MEDIUM,Q:br.QrCode.Ecc.QUARTILE,H:br.QrCode.Ecc.HIGH},Sr=128,Cr=`L`,wr=`#FFFFFF`,Tr=`#000000`,Er=!1,Dr=1,Or=4,kr=0,Ar=.1;function jr(e,t=0){let n=[];return e.forEach(function(e,r){let i=null;e.forEach(function(a,o){if(!a&&i!==null){n.push(`M${i+t} ${r+t}h${o-i}v1H${i+t}z`),i=null;return}if(o===e.length-1){if(!a)return;i===null?n.push(`M${o+t},${r+t} h1v1H${o+t}z`):n.push(`M${i+t},${r+t} h${o+1-i}v1H${i+t}z`);return}a&&i===null&&(i=o)})}),n.join(``)}function Mr(e,t){return e.slice().map((e,n)=>n<t.y||n>=t.y+t.h?e:e.map((e,n)=>n<t.x||n>=t.x+t.w?e:!1))}function Nr(e,t,n,r){if(r==null)return null;let i=e.length+n*2,a=Math.floor(t*Ar),o=i/t,s=(r.width||a)*o,c=(r.height||a)*o,l=r.x==null?e.length/2-s/2:r.x*o,u=r.y==null?e.length/2-c/2:r.y*o,d=r.opacity==null?1:r.opacity,f=null;if(r.excavate){let e=Math.floor(l),t=Math.floor(u);f={x:e,y:t,w:Math.ceil(s+l-e),h:Math.ceil(c+u-t)}}let p=r.crossOrigin;return{x:l,y:u,h:c,w:s,excavation:f,opacity:d,crossOrigin:p}}function Pr(e,t){return t==null?e?Or:kr:Math.max(Math.floor(t),0)}function Fr({value:e,level:t,minVersion:n,includeMargin:r,marginSize:i,imageSettings:a,size:o,boostLevel:s}){let c=X.useMemo(()=>{let r=(Array.isArray(e)?e:[e]).reduce((e,t)=>(e.push(...br.QrSegment.makeSegments(t)),e),[]);return br.QrCode.encodeSegments(r,xr[t],n,void 0,void 0,s)},[e,t,n,s]),{cells:l,margin:u,numCells:d,calculatedImageSettings:f}=X.useMemo(()=>{let e=c.getModules(),t=Pr(r,i);return{cells:e,margin:t,numCells:e.length+t*2,calculatedImageSettings:Nr(e,o,t,a)}},[c,o,a,r,i]);return{qrcode:c,margin:u,cells:l,numCells:d,calculatedImageSettings:f}}var Ir=function(){try{new Path2D().addPath(new Path2D)}catch{return!1}return!0}(),Lr=X.forwardRef(function(e,t){let n=e,{value:r,size:i=Sr,level:a=Cr,bgColor:o=wr,fgColor:s=Tr,includeMargin:c=Er,minVersion:l=Dr,boostLevel:u,marginSize:d,imageSettings:f}=n,p=vr(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`marginSize`,`imageSettings`]),{style:m}=p,h=vr(p,[`style`]),g=f?.src,_=X.useRef(null),v=X.useRef(null),y=X.useCallback(e=>{_.current=e,typeof t==`function`?t(e):t&&(t.current=e)},[t]),[b,x]=X.useState(!1),{margin:S,cells:C,numCells:w,calculatedImageSettings:T}=Fr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:d,imageSettings:f,size:i});X.useEffect(()=>{if(_.current!=null){let e=_.current,t=e.getContext(`2d`);if(!t)return;let n=C,r=v.current,a=T!=null&&r!==null&&r.complete&&r.naturalHeight!==0&&r.naturalWidth!==0;a&&T.excavation!=null&&(n=Mr(C,T.excavation));let c=window.devicePixelRatio||1;e.height=e.width=i*c;let l=i/w*c;t.scale(l,l),t.fillStyle=o,t.fillRect(0,0,w,w),t.fillStyle=s,Ir?t.fill(new Path2D(jr(n,S))):C.forEach(function(e,n){e.forEach(function(e,r){e&&t.fillRect(r+S,n+S,1,1)})}),T&&(t.globalAlpha=T.opacity),a&&t.drawImage(r,T.x+S,T.y+S,T.w,T.h)}}),X.useEffect(()=>{x(!1)},[g]);let E=_r({height:i,width:i},m),D=null;return g!=null&&(D=X.createElement(`img`,{src:g,key:g,style:{display:`none`},onLoad:()=>{x(!0)},ref:v,crossOrigin:T?.crossOrigin})),X.createElement(X.Fragment,null,X.createElement(`canvas`,_r({style:E,height:i,width:i,ref:y,role:`img`},h)),D)});Lr.displayName=`QRCodeCanvas`;var Rr=X.forwardRef(function(e,t){let n=e,{value:r,size:i=Sr,level:a=Cr,bgColor:o=wr,fgColor:s=Tr,includeMargin:c=Er,minVersion:l=Dr,boostLevel:u,title:d,marginSize:f,imageSettings:p}=n,m=vr(n,[`value`,`size`,`level`,`bgColor`,`fgColor`,`includeMargin`,`minVersion`,`boostLevel`,`title`,`marginSize`,`imageSettings`]),{margin:h,cells:g,numCells:_,calculatedImageSettings:v}=Fr({value:r,level:a,minVersion:l,boostLevel:u,includeMargin:c,marginSize:f,imageSettings:p,size:i}),y=g,b=null;p!=null&&v!=null&&(v.excavation!=null&&(y=Mr(g,v.excavation)),b=X.createElement(`image`,{href:p.src,height:v.h,width:v.w,x:v.x+h,y:v.y+h,preserveAspectRatio:`none`,opacity:v.opacity,crossOrigin:v.crossOrigin}));let x=jr(y,h);return X.createElement(`svg`,_r({height:i,width:i,viewBox:`0 0 ${_} ${_}`,ref:t,role:`img`},m),!!d&&X.createElement(`title`,null,d),X.createElement(`path`,{fill:o,d:`M0,0 h${_}v${_}H0z`,shapeRendering:`crispEdges`}),X.createElement(`path`,{fill:s,d:x,shapeRendering:`crispEdges`}),b)});Rr.displayName=`QRCodeSVG`;function zr(e){if(!Number.isFinite(e)||e<=0)return`Single-use.`;let t=Math.ceil(e/1e3);return`Expires in ${Math.floor(t/60)}:${(t%60).toString().padStart(2,`0`)} · single-use.`}function Br({pairUrl:e,remainingMs:t,expired:n,copied:r,onCopy:i}){return n?(0,Z.jsx)(R,{tone:`warning`,title:`This pairing code expired.`,children:`Generate a new code to pair a device.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(`div`,{className:`w-fit rounded-lg bg-white p-3`,children:(0,Z.jsx)(Rr,{value:e,size:192,level:`M`,title:`Device pairing QR code`})}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`code`,{"data-testid":`pair-device-url`,className:`min-w-0 flex-1 truncate rounded-md bg-[var(--surface-active)] px-2.5 py-1.5 text-body-small-default text-[var(--content-secondary)]`,children:e}),(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,leftIcon:r?(0,Z.jsx)(x,{}):(0,Z.jsx)(_,{}),onClick:()=>i(e),children:r?`Copied`:`Copy`})]}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:zr(t)})]})}var Vr=`vellum:pair-device:public-base-url`;function Hr(e){let n=e?.trim();if(n)return{url:n,source:`tunnel`};let r=t(Vr,``).trim();return r?{url:r,source:`stored`}:{url:``,source:`none`}}function Ur(e,t){let[r]=(0,X.useState)(()=>Hr(t)),[i,o]=(0,X.useState)(r.url),[s,c]=(0,X.useState)(null),[l,u]=(0,X.useState)({kind:`idle`}),[d,f]=(0,X.useState)(()=>Date.now()),p=(0,X.useRef)(null);(0,X.useEffect)(()=>()=>p.current?.abort(),[]),(0,X.useEffect)(()=>{if(l.kind!==`ready`)return;f(Date.now());let e=setInterval(()=>f(Date.now()),1e3);return()=>clearInterval(e)},[l]);let m=(0,X.useCallback)(e=>{o(e),c(null)},[]),h=(0,X.useCallback)(()=>{if(!e)return;let t=i.trim(),r=tr(t);if(!r.ok){c(rr(r.reason,t));return}c(null),p.current?.abort();let o=new AbortController;p.current=o,u({kind:`minting`}),(async()=>{try{let t=await dr({base:e,publicBaseUrl:r.url,signal:o.signal});if(o.signal.aborted)return;n(Vr,r.url),u({kind:`ready`,pairUrl:t.pairUrl,expiresAtMs:Date.parse(t.expiresAt)})}catch(e){if(o.signal.aborted)return;if(e instanceof sr){u({kind:`error`,message:e.message,hint:e.hint});return}a(e,{context:`pair-device-mint`}),u({kind:`error`,message:`Something went wrong while generating the code.`})}})()},[e,i]),g=l.kind===`ready`?Math.max(0,l.expiresAtMs-d):0,_=l.kind===`ready`&&g<=0;return{publicBaseUrl:i,setPublicBaseUrl:m,prefillSource:r.source,inputError:s,phase:l,remainingMs:g,expired:_,generate:h}}function Wr(){let e=cr(),t=Yn(),n=K.use.webRemoteIngress(),r=Ur(e?.base??null,e?.ingressUrl??null),{copy:i,copied:a}=rn({errorMessage:`Could not copy the pairing address.`});if(!e||!t||!n)return null;let{phase:o}=r,c=o.kind===`minting`,l=o.kind===`ready`,u=r.prefillSource===`tunnel`,d=r.prefillSource===`none`&&r.publicBaseUrl.trim()===``,f=c?`Generating…`:l?`Generate new code`:`Generate pairing QR`;return(0,Z.jsx)(Y,{title:`Pair a device`,subtitle:`Scan with another device's camera — or open the link on it — to use ${e.assistantName??`this assistant`} there.`,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[d&&(0,Z.jsx)(R,{tone:`info`,title:`No tunnel detected`,children:"On this computer, run `vellum tunnel --provider tailscale` (or another provider) — its address appears here."}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(z,{label:`Public URL`,fullWidth:!0,placeholder:`https://your-assistant.ts.net`,helperText:u?"This address comes from `vellum tunnel` on this computer. Edit it if your devices reach this assistant at a different URL.":`The https address your devices can reach this assistant at (your Tailscale URL, or another tunnel's).`,value:r.publicBaseUrl,errorText:r.inputError??void 0,disabled:c,onChange:e=>r.setPublicBaseUrl(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),r.generate())}}),(0,Z.jsx)(s,{variant:`primary`,className:`self-start`,disabled:c||r.publicBaseUrl.trim()===``,onClick:r.generate,children:f})]}),o.kind===`error`&&(0,Z.jsx)(R,{tone:`error`,title:o.message,children:o.hint}),l&&(0,Z.jsx)(Br,{pairUrl:o.pairUrl,remainingMs:r.remainingMs,expired:r.expired,copied:a,onCopy:i})]})})}async function Gr(){if(!U())return[];let e=window.vellum;return e?.hotkeys?e.hotkeys.get():[]}async function Kr(e,t){if(!U())return;let n=window.vellum;n?.hotkeys&&await n.hotkeys.set(e,t)}function qr(e){if(!U())return()=>{};let t=window.vellum;return t?.hotkeys?t.hotkeys.onChange(e):()=>{}}var Jr={ArrowUp:`Up`,ArrowDown:`Down`,ArrowLeft:`Left`,ArrowRight:`Right`,Enter:`Return`,NumpadEnter:`Return`,Space:`Space`,Tab:`Tab`,Escape:`Escape`,Backspace:`Backspace`,Delete:`Delete`,Insert:`Insert`,Home:`Home`,End:`End`,PageUp:`PageUp`,PageDown:`PageDown`,Minus:`-`,Equal:`=`,BracketLeft:`[`,BracketRight:`]`,Backslash:`\\`,Semicolon:`;`,Quote:`'`,Backquote:"`",Comma:`,`,Period:`.`,Slash:`/`},Yr=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),Xr=e=>{let t=e.code;return Yr.has(t)?null:/^Key[A-Z]$/.test(t)?t.slice(3):/^Digit[0-9]$/.test(t)?t.slice(5):/^Numpad[0-9]$/.test(t)?`num${t.slice(6)}`:/^F[0-9]{1,2}$/.test(t)?t:Jr[t]??null},Zr=e=>{let t=Xr(e);if(t===null)return null;let n=[];return e.metaKey&&n.push(`CmdOrCtrl`),e.ctrlKey&&n.push(`Control`),e.altKey&&n.push(`Alt`),e.shiftKey&&n.push(`Shift`),[...n,t].join(`+`)},Qr=(e,t,n)=>n===``?null:e.find(e=>e.key!==t&&e.accelerator===n)??null,$r=[{scope:`global`,title:`Global shortcuts`,description:`Work anywhere, even when Vellum is in the background.`},{scope:`menu`,title:`App shortcuts`,description:`Work while a Vellum window is focused.`}];function ei({hotkey:e,recording:t,conflictLabel:n,onStartRecording:r,onCancelRecording:i,onReset:a,onRemove:o}){let c=e.accelerator===``,l=e.override!==null;return(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e.label}),n!==null&&(0,Z.jsxs)(`div`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:[`Already used by `,n]})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[t?(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Recording… press a shortcut, or Esc to cancel`}):c?(0,Z.jsx)(`span`,{className:`text-body-small-default italic text-[var(--content-disabled)]`,children:`Disabled`}):(0,Z.jsx)(ge,{accelerator:e.accelerator}),t?(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,onClick:i,children:`Cancel`}):(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,onClick:r,"aria-label":`Record shortcut for ${e.label}`,children:`Record`}),(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:!l,leftIcon:(0,Z.jsx)(oe,{className:`h-3.5 w-3.5`}),onClick:a,"aria-label":`Reset ${e.label} to default`}),(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:c,leftIcon:(0,Z.jsx)(de,{className:`h-3.5 w-3.5`}),onClick:o,"aria-label":`Remove ${e.label} binding`})]})]})}function ti(){let[e,t]=(0,X.useState)([]),[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(null),o=(0,X.useCallback)(()=>{Gr().then(t)},[]);(0,X.useEffect)(()=>(o(),qr(t)),[o]);let s=(0,X.useCallback)(()=>{r(null),a(null)},[]);(0,X.useEffect)(()=>{if(n===null)return;let t=t=>{if(t.preventDefault(),t.stopPropagation(),t.code===`Escape`){s();return}let r=Zr(t);if(r===null)return;let i=Qr(e,n,r);if(i!==null){a({key:n,label:i.label});return}Kr(n,r).then(o),s()};return window.addEventListener(`keydown`,t,!0),()=>window.removeEventListener(`keydown`,t,!0)},[n,e,o,s]);let c=(0,X.useCallback)(e=>{a(null),r(e)},[]),l=(0,X.useCallback)(t=>{let n=Qr(e,t,e.find(e=>e.key===t)?.defaultAccelerator??``);if(n!==null){r(null),a({key:t,label:n.label});return}s(),Kr(t,null).then(o)},[e,o,s]),u=(0,X.useCallback)(e=>{s(),Kr(e,``).then(o)},[o,s]),d=(0,X.useMemo)(()=>$r.map(t=>({...t,commands:e.filter(e=>e.rebindable&&e.scope===t.scope)})).filter(e=>e.commands.length>0),[e]);return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[i!==null&&(0,Z.jsxs)(R,{tone:`warning`,children:[`That shortcut is already used by `,i.label,`.`,` `,n===null?`Remove or change that binding before resetting.`:`Pick a different combination, or press Esc to cancel.`]}),d.map(e=>(0,Z.jsxs)(g,{bordered:!0,children:[(0,Z.jsxs)(`div`,{className:`mb-2`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-emphasised text-[var(--content-default)]`,children:e.title}),(0,Z.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Z.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.commands.map(e=>(0,Z.jsx)(ei,{hotkey:e,recording:n===e.key,conflictLabel:i!==null&&i.key===e.key?i.label:null,onStartRecording:()=>c(e.key),onCancelRecording:s,onReset:()=>l(e.key),onRemove:()=>u(e.key)},e.key))})]},e.scope))]})}async function ni(){if(!U())return!1;let e=window.vellum;return e?.launchAtLogin?e.launchAtLogin.get():!1}async function ri(e){if(!U())return;let t=window.vellum;t?.launchAtLogin&&await t.launchAtLogin.set(e)}function ii(){let e=re.useValue(),t=I.useValue(),n=!Gt(),r=mt()?`Cmd`:`Ctrl`;return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Composer`}),(0,Z.jsxs)(`div`,{className:`mt-2 space-y-4`,children:[n&&(0,Z.jsx)(ye,{checked:e,onChange:re.save,label:`Send with ${r}+Enter`,helperText:`When enabled, Enter inserts a new line and ${r}+Enter sends.`}),(0,Z.jsx)(ye,{checked:t,onChange:I.save,label:`Show context window usage`,helperText:`Adds a ring to the composer tracking how full the context window is. Your assistant compacts its context automatically either way.`})]})]})}function ai(){let[e,t]=(0,X.useState)(!1);(0,X.useEffect)(()=>{ni().then(t)},[]);let n=async e=>{t(e);try{await ri(e)}catch{t(!e)}};return(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Launch at Login`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Automatically start Vellum when you log in to your Mac.`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(ye,{checked:e,onChange:e=>void n(e),"aria-label":`Launch at Login`})})]})}function oi({open:e,onClose:t}){return(0,Z.jsx)(B.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,Z.jsxs)(B.Content,{size:`lg`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Preferences`}),(0,Z.jsx)(B.Description,{children:`Customize shortcuts and how Vellum behaves on this device.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[U()&&(0,Z.jsxs)(`section`,{children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Keyboard Shortcuts`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Customize the shortcuts for Vellum's commands.`}),(0,Z.jsx)(`div`,{className:`mt-2`,children:(0,Z.jsx)(ti,{})})]}),(0,Z.jsx)(ii,{}),U()&&(0,Z.jsx)(ai,{})]})})]})})}function si(e){return e===`preview`?`preview`:`stable`}function ci(e){if(!e)return`Unknown`;let t=new Date(e);return Number.isNaN(t.getTime())?`Unknown`:t.toLocaleString(void 0,{year:`numeric`,month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`})}function li(e){return e.source_release_version?`Stable ${e.source_release_version}`:e.snapshot_name}function ui(e){return e.filter(e=>e.ready_to_use)}function di(e){return e?.feature_enabled===!1}function fi({assistantId:e,onComplete:t}){let n=K.use.previewChannel(),r=d(),[i,a]=(0,X.useState)(),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,m]=(0,X.useState)(`restore_backup`),[h,g]=(0,X.useState)(``),_=St({path:{assistant_id:e}}),v=xt({path:{assistant_id:e}}),y=Lt({path:{id:e}}),{data:b,isLoading:x,isError:C}=f({..._,enabled:n,retry:!1}),w=b?.preview_backups??[],T=(0,X.useMemo)(()=>ui(w),[w]),E=T[0],O=T.find(e=>e.snapshot_name===h)??E,k=()=>{r.invalidateQueries({queryKey:v}),r.invalidateQueries({queryKey:y}),t?.()},A=p(Vt()),j=p(Nt()),M=si(b?.current_channel),N=A.isPending||j.isPending,ee=N||di(b)||!b?.latest_preview_release,P=u===`restore_backup`&&!O;if((0,X.useEffect)(()=>{a(M===`preview`?`release-channel`:void 0)},[M]),!n)return null;let te=b?.standard_upgrade_available??!1;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(_e.Root,{type:`single`,collapsible:!0,value:i,onValueChange:e=>a(e||void 0),className:`mt-5 border-t border-[var(--border-base)] pt-5`,children:(0,Z.jsxs)(_e.Item,{value:`release-channel`,id:`preview-release-channel`,children:[(0,Z.jsxs)(_e.Trigger,{className:`group justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`Release Channel`}),b&&(0,Z.jsx)(ve,{tone:M===`preview`?`warning`:`neutral`,children:M===`preview`?`Preview`:`Stable`})]}),(0,Z.jsx)(S,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]}),(0,Z.jsx)(_e.Content,{children:(0,Z.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[x&&(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading release channel...`]}),C&&(0,Z.jsx)(R,{tone:`error`,title:`Could not load release channel status`,children:`Refresh this page before changing release channels.`}),b&&(0,Z.jsxs)(Z.Fragment,{children:[di(b)&&(0,Z.jsx)(R,{tone:`neutral`,title:`Preview channel is unavailable`,children:`The Preview channel is not enabled for this assistant.`}),M===`stable`?(0,Z.jsx)(pi,{status:b,isChangingChannel:N,optInDisabled:ee,onOptIn:()=>s(!0)}):(0,Z.jsx)(mi,{status:b,isChangingChannel:N,onOptOut:()=>{let e=E;g(e?.snapshot_name??``),m(e?`restore_backup`:te?`standard_upgrade`:`restore_backup`),l(!0)}})]})]})})]})}),(0,Z.jsx)(gi,{open:o,isPending:A.isPending,previewVersion:b?.latest_preview_release?.version,onConfirm:async()=>{try{let t=await A.mutateAsync({path:{assistant_id:e}});V.success(t.detail||`Preview channel enabled.`),s(!1),k()}catch(e){V.error(W(e,void 0,`Could not enable Preview channel.`))}},onCancel:()=>s(!1)}),(0,Z.jsx)(_i,{open:c,backups:T,mode:u,selectedSnapshotName:O?.snapshot_name??``,isPending:j.isPending,restoreModeDisabled:P,standardUpgradeAvailable:te,onModeChange:m,onSnapshotChange:g,onConfirm:async()=>{if(!P)try{let t=await j.mutateAsync({path:{assistant_id:e},body:u===`restore_backup`?{mode:`restore_backup`,snapshot_name:O?.snapshot_name}:{mode:`standard_upgrade`}});V.success(t.detail||`Stable channel enabled.`),l(!1),k()}catch(e){V.error(W(e,void 0,`Could not switch to Stable.`))}},onCancel:()=>l(!1)})]})}function pi({status:e,isChangingChannel:t,optInDisabled:n,onOptIn:r}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(hi,{status:e}),!e.latest_preview_release&&(0,Z.jsx)(R,{tone:`neutral`,title:`No Preview release is available`,children:`Stable remains the only available release channel.`}),(0,Z.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(M,{}),disabled:n,onClick:r,children:`Opt in to Preview`})]})}function mi({status:e,isChangingChannel:t,onOptOut:n}){return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsx)(hi,{status:e}),(0,Z.jsx)(s,{variant:`outlined`,leftIcon:t?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(oe,{}),disabled:t,onClick:n,children:`Switch back to Stable`})]})}function hi({status:e}){return(0,Z.jsxs)(`dl`,{className:`grid gap-3 text-body-medium-lighter sm:grid-cols-2`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Stable`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_stable_release?.version??`None`})]}),(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`dt`,{className:`text-[var(--content-tertiary)]`,children:`Latest Preview`}),(0,Z.jsx)(`dd`,{className:`break-all text-[var(--content-default)]`,children:e.latest_preview_release?.version??`None`})]})]})}function gi({open:e,isPending:t,previewVersion:n,onConfirm:r,onCancel:i}){return(0,Z.jsx)(B.Root,{open:e,onOpenChange:e=>!e&&i(),children:(0,Z.jsxs)(B.Content,{size:`md`,hideCloseButton:t,children:[(0,Z.jsxs)(B.Header,{icon:ue,children:[(0,Z.jsx)(B.Title,{children:`Opt in to Preview`}),(0,Z.jsx)(B.Description,{children:`Preview releases may be unstable. A 90-day safety backup is taken before the image changes.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsx)(R,{tone:`warning`,title:`Data loss may occur when returning to Stable`,children:`Preview data may not be compatible with the Stable channel. The safety backup lets you restore the Stable-channel data that existed before opt-in.`}),(0,Z.jsxs)(`ol`,{className:`list-decimal space-y-2 pl-5 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,Z.jsx)(`li`,{children:`Create and verify a Preview safety backup.`}),(0,Z.jsxs)(`li`,{children:[`Switch to Preview image `,n??`latest`,`.`]}),(0,Z.jsx)(`li`,{children:`Run the normal upgrade path and wait for health.`})]})]})}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,disabled:t,onClick:i,children:`Cancel`}),(0,Z.jsx)(s,{variant:`primary`,disabled:t,leftIcon:t?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(M,{}),onClick:r,children:t?`Switching...`:`Take Backup and Switch`})]})]})})}function _i({open:e,backups:t,mode:n,selectedSnapshotName:r,isPending:i,restoreModeDisabled:a,standardUpgradeAvailable:o,onModeChange:c,onSnapshotChange:l,onConfirm:u,onCancel:d}){return(0,Z.jsx)(B.Root,{open:e,onOpenChange:e=>!e&&d(),children:(0,Z.jsxs)(B.Content,{size:`md`,hideCloseButton:i,children:[(0,Z.jsxs)(B.Header,{icon:ue,children:[(0,Z.jsx)(B.Title,{children:`Switch back to Stable`}),(0,Z.jsx)(B.Description,{children:`Choose how this assistant should leave the Preview channel.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[(0,Z.jsxs)(me,{value:n,onValueChange:c,disabled:i,"aria-label":`Stable channel return method`,children:[(0,Z.jsx)(pe,{value:`restore_backup`,disabled:t.length===0,label:`Restore safety backup`,helperText:`Return to the Stable-channel data captured before Preview opt-in.`}),(0,Z.jsx)(pe,{value:`standard_upgrade`,disabled:!o,label:`Switch to Stable without restoring backup`,helperText:o?`Keep the current data and directly switch to the Stable image.`:`Unavailable because the latest Stable release is older than this assistant's Preview release.`})]}),n===`restore_backup`&&t.length>0&&(0,Z.jsxs)(`label`,{className:`flex flex-col gap-1 text-body-medium-default text-[var(--content-secondary)]`,children:[`Safety backup`,(0,Z.jsx)(xe,{value:r,onChange:l,disabled:i,options:t.map(e=>({value:e.snapshot_name,label:`${li(e)} - ${ci(e.created_at)}`}))})]}),n===`restore_backup`&&t.length===0&&!o&&(0,Z.jsx)(R,{tone:`error`,title:`Stable requires a safety backup`,children:`This Preview release is newer than the latest Stable release, so switching directly is blocked. Wait for a newer Stable release, or run Vellum Doctor if the safety backup is missing.`}),n===`standard_upgrade`&&(0,Z.jsx)(R,{tone:`error`,title:`Preview data may not survive this`,children:`Switching directly to the Stable image without restoring the safety backup may cause data loss or leave the assistant unusable if Preview data is incompatible with Stable.`})]})}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,disabled:i,onClick:d,children:`Cancel`}),(0,Z.jsx)(s,{variant:n===`standard_upgrade`?`danger`:`primary`,disabled:i||a||n===`standard_upgrade`&&!o,leftIcon:i?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),onClick:u,children:i?`Switching...`:`Switch to Stable`})]})]})})}var vi=new Set([`exceeds_machine_tier`,`exceeds_storage_tier`]);function yi(e,t){return e&&typeof e==`object`&&!Array.isArray(e)&&`error`in e&&typeof e.error==`string`&&vi.has(e.error)?`That size isn't available on your plan.`:W(e,void 0,t)}function bi({assistant:e,healthz:t,healthzLoading:n,healthzPolling:r,refetch:i,refetchUntilResized:a}){let o=c(),l=ht(),d=f(zt()),p=d.data,m=!e.is_local,h=p?.plan_id===`pro`,g=f({...Ft(),enabled:h}),_=e.machine_size||`small`,v=on(g.data?.max_machine_tier??null),y=(0,X.useMemo)(()=>ln(v,_,(0,Z.jsx)(ve,{tone:`positive`,children:`Current`})),[v,_]),b=g.data?.selected_storage_gib??null,[x,S]=(0,X.useState)(!1),C=v.length>0?v[v.length-1]:null,[w,E]=(0,X.useState)(null),O=w??C??_,[k,A]=(0,X.useState)(!1),[j,M]=(0,X.useState)(null),N=At({onSuccess:(e,n)=>{V.success(`Resize started. Changes will apply shortly.`,{id:`assistant-resize`}),M(null),E(null),S(!1),n.body?.machine_size==null?i():a(t)},onError:e=>{M(yi(e,`Failed to resize assistant. Please try again.`))}});if(d.isError&&p==null)return(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,children:(0,Z.jsx)(R,{tone:`error`,children:`Could not load your subscription. Please try again.`})});let ee=h&&v.includes(O)&&O!==_?O:null,P=h&&b!=null&&!0,te=h&&v.length>0&&cn(_)<cn(v[v.length-1]),F=N.isPending||r,ne=b==null?t?.disk?.totalMb??null:b*1024,I=t?.disk&&ne!=null?{value:t.disk.usedMb,max:ne,caption:`${hn(t.disk.usedMb)} of ${hn(ne)}`}:null,L=t?.cpu?{value:t.cpu.currentPercent,max:100,caption:`${t.cpu.currentPercent.toFixed(1)}%`}:null,re=t?.memory?{value:t.memory.currentMb,max:t.memory.maxMb,caption:`${hn(t.memory.currentMb)} of ${hn(t.memory.maxMb)}`}:null,ie=l?null:(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,onClick:()=>A(!0),children:`Resize`}),oe=m?h?P?(0,Z.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(ce,{className:`h-3.5 w-3.5`}),`Increase Storage`]}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:`Resize`}):ie:null,se=m?h?te?(0,Z.jsxs)(`button`,{type:`button`,disabled:F,onClick:()=>S(!0),className:`flex items-center gap-1.5 rounded-lg border border-amber-500/30 bg-amber-500/15 px-3 py-1.5 text-body-small-default font-medium text-amber-400 transition-colors hover:bg-amber-500/25 disabled:opacity-50`,children:[(0,Z.jsx)(ce,{className:`h-3.5 w-3.5`}),`Increase Size`]}):(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,disabled:F,onClick:()=>S(!0),children:`Resize`}):ie:null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Y,{id:`storage-resources`,title:`Compute & Resources`,subtitle:`Monitor resource usage and manage your assistant's compute profile.`,compactAccessory:!0,accessory:(0,Z.jsx)(s,{variant:`ghost`,size:`compact`,iconOnly:n||r?(0,Z.jsx)(D,{className:`animate-spin`}):(0,Z.jsx)(ae,{}),tooltip:r?`Applying resize…`:`Refresh resource metrics`,"aria-label":`Refresh resource metrics`,disabled:n||r,onClick:()=>void i()}),children:(0,Z.jsxs)(`div`,{className:`grid grid-cols-1 gap-2 sm:grid-cols-[1fr_2fr]`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(T,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Disk`})]}),oe]}),(0,Z.jsxs)(`div`,{className:`mt-auto flex flex-col gap-1 pt-3`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Storage`}),I?(0,Z.jsx)(dn,{value:I.value,max:I.max,caption:I.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Unavailable`})]})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col rounded-lg bg-[var(--surface-base)] p-3`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:(0,Z.jsx)(vn,{className:`h-3.5 w-3.5`})}),(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Machine`}),(0,Z.jsx)(ve,{tone:`neutral`,children:sn[_]})]}),se]}),(0,Z.jsxs)(`div`,{className:`mt-auto grid grid-cols-2 gap-3 pt-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`CPU`}),L?(0,Z.jsx)(dn,{value:L.value,max:L.max,caption:L.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`Memory`}),re?(0,Z.jsx)(dn,{value:re.value,max:re.max,caption:re.caption}):n?(0,Z.jsx)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:(0,Z.jsx)(D,{className:`h-3 w-3 animate-spin`})}):(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:`—`})]})]})]})]})}),(0,Z.jsx)(B.Root,{open:k,onOpenChange:e=>{e||A(!1)},children:(0,Z.jsxs)(B.Content,{size:`sm`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Upgrade your plan`}),(0,Z.jsx)(B.Description,{children:`Move to a higher plan for more power, more storage, and a larger credit bundle.`})]}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`ghost`,onClick:()=>A(!1),children:`Cancel`}),(0,Z.jsx)(s,{onClick:()=>{A(!1),o(q.plans)},children:`Upgrade`})]})]})}),(0,Z.jsx)(B.Root,{open:x,onOpenChange:e=>{e||(S(!1),E(null),M(null))},children:(0,Z.jsxs)(B.Content,{size:`sm`,children:[(0,Z.jsxs)(B.Header,{icon:vn,children:[(0,Z.jsx)(B.Title,{children:`Resize Assistant`}),(0,Z.jsx)(B.Description,{children:`Resize your assistant's compute and storage. Your assistant will briefly restart.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[v.length===0?(0,Z.jsx)(R,{tone:`warning`,children:`No machine tier configured. Visit the community for help.`}):(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`text-label-medium-default text-[var(--content-secondary)]`,children:`Machine Size`}),(0,Z.jsx)(xe,{options:y,value:O,onChange:E,"aria-label":`Compute machine size`,"data-testid":`resize-machine-size`})]}),P?(0,Z.jsx)(R,{tone:`info`,children:`Storage will be expanded to ${b} GB.`}):(0,Z.jsx)(R,{tone:`neutral`,children:`Storage will not change.`}),j&&(0,Z.jsx)(R,{tone:`error`,children:j})]})}),(0,Z.jsxs)(B.Footer,{className:l?`justify-end`:`items-center justify-between`,children:[l?null:(0,Z.jsxs)(`span`,{className:`text-label-small-default text-[var(--content-tertiary)]`,children:[`Need more?`,` `,(0,Z.jsx)(u,{to:q.plans,className:`text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 transition-colors hover:text-[var(--content-default)]`,onClick:()=>S(!1),children:`Upgrade plan`})]}),(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(s,{variant:`ghost`,onClick:()=>{S(!1),E(null),M(null)},children:`Cancel`}),(0,Z.jsx)(s,{disabled:ee==null&&!P||F,leftIcon:F?(0,Z.jsx)(D,{className:`animate-spin`}):void 0,onClick:()=>{M(null);let t={};ee!=null&&(t.machine_size=ee),P&&b!=null&&(t.storage_gib=b),N.mutate({path:{id:e.id},body:t})},children:j?`Retry`:`Apply`})]})]})]})})]})}function xi({assistantId:e}){let t=c(),[n,r]=(0,X.useState)(!1),[i,a]=(0,X.useState)(!1);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>r(!0),className:`shrink-0`,children:`Retire Assistant`}),(0,Z.jsx)(qt,{open:n,isPending:i,onConfirm:async()=>{a(!0);let n=await Kt(e);if(n.ok){r(!1),t(n.nextRoute,{replace:!0});return}V.error(n.error),a(!1),r(!1)},onCancel:()=>r(!1)})]})}function Si(){let e=A(),t=N.useValue();return j(e)?(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Show tips`}),(0,Z.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Occasional tips in the sidebar that highlight features you haven't tried yet.`})]}),(0,Z.jsx)(ye,{checked:t,onChange:t=>{N.save(t),t||P(`settings`,`dont_show_again`,e)},"aria-label":`Show tips`})]}):null}var Ci=`UTC.Africa/Cairo.Africa/Johannesburg.Africa/Lagos.Africa/Nairobi.America/Anchorage.America/Argentina/Buenos_Aires.America/Bogota.America/Chicago.America/Denver.America/Halifax.America/Lima.America/Los_Angeles.America/Mexico_City.America/New_York.America/Phoenix.America/Santiago.America/Sao_Paulo.America/Toronto.America/Vancouver.Asia/Bangkok.Asia/Dubai.Asia/Hong_Kong.Asia/Jakarta.Asia/Jerusalem.Asia/Karachi.Asia/Kolkata.Asia/Kuala_Lumpur.Asia/Manila.Asia/Seoul.Asia/Shanghai.Asia/Singapore.Asia/Taipei.Asia/Tokyo.Australia/Melbourne.Australia/Perth.Australia/Sydney.Europe/Amsterdam.Europe/Athens.Europe/Berlin.Europe/Brussels.Europe/Dublin.Europe/Istanbul.Europe/Lisbon.Europe/London.Europe/Madrid.Europe/Moscow.Europe/Paris.Europe/Rome.Europe/Stockholm.Europe/Vienna.Europe/Warsaw.Europe/Zurich.Pacific/Auckland.Pacific/Honolulu`.split(`.`);function wi(){let e=Intl;if(typeof e.supportedValuesOf==`function`)try{let t=e.supportedValuesOf(`timeZone`);if(t.length>0)return[...t].sort()}catch{}return[...Ci].sort()}function Ti(e){let t=e.split(`/`),n=(t[t.length-1]??e).replace(/_/g,` `),r=t.length>1?(t[0]??``).replace(/_/g,` `):``,i=0,a=``;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`shortOffset`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??`GMT`;a=t.startsWith(`GMT`)||t.startsWith(`UTC`)?t:`GMT ${t}`;let n=t.match(/([+-])(\d{1,2})(?::(\d{2}))?/);if(n){let e=n[1]===`-`?-1:1,t=parseInt(n[2]??`0`,10),r=parseInt(n[3]??`0`,10);i=e*(t*60+r)}}catch{return null}return{identifier:e,city:n,region:r,offsetLabel:a,offsetMinutes:i}}function Ei(e){try{return new Intl.DateTimeFormat(`en-US`,{timeZone:e,hour:`numeric`,minute:`2-digit`,hour12:!0}).format(new Date)}catch{return``}}function Di(e){if(!e)return`Not set`;try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`long`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;if(t)return t}catch{}return e.replace(/_/g,` `)}var Oi=200;function ki({value:e,onChange:t}){let[n,r]=(0,X.useState)(``),i=(0,X.useMemo)(()=>wi().map(e=>Ti(e)).filter(e=>e!==null),[]),a=n.trim().toLowerCase(),o=(0,X.useMemo)(()=>(a?i.filter(e=>e.city.toLowerCase().includes(a)||e.region.toLowerCase().includes(a)||e.offsetLabel.toLowerCase().includes(a)||e.identifier.toLowerCase().includes(a)):i).slice(0,Oi),[i,a]),s=(0,X.useMemo)(()=>o.map(e=>e.identifier),[o]),c=(0,X.useMemo)(()=>{if(!e)return``;let t=e.split(`/`);return(t[t.length-1]??e).replace(/_/g,` `)},[e]);return(0,Z.jsxs)(`div`,{className:`space-y-3`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-col gap-1.5 md:flex-row md:items-center md:justify-between md:gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Closest city`}),(0,Z.jsxs)(he.Root,{className:`w-full md:max-w-[280px]`,options:s,value:e,onSelect:t,onOpenChange:e=>{e||r(``)},autoActivateFirst:a.length>0,children:[(0,Z.jsx)(he.Input,{type:`text`,"aria-label":`Closest city`,value:n,placeholder:c||`Search city or country...`,onChange:e=>r(e.target.value),fullWidth:!0}),(0,Z.jsx)(he.List,{"aria-label":`Cities`,className:`absolute left-0 right-0 top-full z-20 mt-1 max-h-[240px] rounded-md border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-lg`,emptyState:(0,Z.jsx)(`p`,{className:`px-3 py-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`No matching cities`}),children:o.map(e=>(0,Z.jsxs)(he.Option,{value:e.identifier,className:h(`flex w-full items-center justify-between gap-3 px-3 py-2`,`text-body-medium-lighter text-[var(--content-default)] transition-colors`,`hover:bg-[var(--surface-active)]`,`data-[active]:bg-[var(--surface-active)] aria-selected:bg-[var(--surface-active)]`),children:[(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsx)(`div`,{className:`truncate text-body-medium-default`,children:e.city}),e.region&&(0,Z.jsx)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.region})]}),(0,Z.jsxs)(`div`,{className:`flex shrink-0 flex-col items-end gap-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(`span`,{children:Ei(e.identifier)}),(0,Z.jsx)(`span`,{children:e.offsetLabel})]})]},e.identifier))})]})]}),(0,Z.jsx)(gn,{}),(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Time zone`}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:Di(e)})]})]})}function Ai(){let e=Ie.use.activeAssistantId(),[t,n]=(0,X.useState)(()=>i(`timezone`,``)),o=(0,X.useRef)(e);(0,X.useEffect)(()=>{o.current=e},[e]);let s=(0,X.useRef)(!1),c=(0,X.useRef)(null),l=(0,X.useRef)(()=>{}),u=e=>{if(s.current){c.current=e;return}let t=o.current;if(!t){c.current=null;return}s.current=!0,c.current=null,G.patch({url:`/v1/assistants/{assistant_id}/config`,path:{assistant_id:t},body:{ui:{userTimezone:e}},throwOnError:!0}).catch(e=>{a(e,{context:`settings-timezone-override`})}).finally(()=>{s.current=!1;let e=c.current;c.current=null,e!==null&&l.current(e)})};return(0,X.useEffect)(()=>{l.current=u}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:`Timezone`}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`Used when displaying times and scheduling reminders.`}),(0,Z.jsx)(`div`,{className:`mt-1`,children:(0,Z.jsx)(ki,{value:t,onChange:e=>{n(e),r(`timezone`,e),u(e)}})})]})}var ji=[[`Mon`,0],[`Tue`,1],[`Wed`,2],[`Thu`,3],[`Fri`,4],[`Sat`,5],[`Sun`,6]];function Mi(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(Date.UTC(r.getUTCFullYear(),r.getUTCMonth(),r.getUTCDate(),t,n));return`${i.getHours().toString().padStart(2,`0`)}:${i.getMinutes().toString().padStart(2,`0`)}`}function Ni(e){let[t,n]=e.split(`:`).map(Number),r=new Date,i=new Date(r.getFullYear(),r.getMonth(),r.getDate(),t,n);return`${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}`}function Pi(){return Intl.DateTimeFormat(void 0,{timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value??``}function Fi(e){let t=e?.schedule?.window.start??`06:00`,n=e?.schedule?.window.end??`08:00`;return{enabled:e?.enabled??!0,timezone:`UTC`,frequency:e?.schedule?.frequency??`weekly`,daysOfWeek:e?.schedule?.days_of_week??[0],daysOfMonth:e?.schedule?.days_of_month??[],windowStart:Mi(t),windowEnd:Mi(n)}}function Ii({assistantId:e}){let t=d(),{data:n,isLoading:r,isError:i}=f(Dt({path:{id:e}})),a=(0,X.useMemo)(()=>Fi(n),[n]),[o,c]=(0,X.useState)(null),l=o??a,u=o!==null,m=(0,X.useMemo)(()=>Pi(),[]),[h,g]=(0,X.useState)(null),_=h??l.daysOfMonth.join(`, `),y=p({mutationFn:async t=>{let{data:n}=await tt({path:{id:e},body:t,throwOnError:!0});return n}}),b=e=>{c(t=>({...t??a,...e}))},x=e=>{b({daysOfWeek:l.daysOfWeek.includes(e)?l.daysOfWeek.filter(t=>t!==e):[...l.daysOfWeek,e].sort((e,t)=>e-t)})},S=e=>e.split(`,`).map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>=1&&e<=31);return r?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),`Loading update window settings...`]}):i?(0,Z.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:`Failed to load update window policy. Refresh the page to try again.`}):(0,Z.jsxs)(`div`,{className:`space-y-6`,children:[(0,Z.jsx)(ye,{checked:l.enabled,onChange:e=>b({enabled:e}),label:`Automatic updates`,helperText:`Update automatically during a configured time window`}),l.enabled&&(0,Z.jsxs)(`div`,{className:`space-y-5`,children:[(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Frequency`}),(0,Z.jsx)(`div`,{className:`max-w-[400px]`,children:(0,Z.jsx)(v,{ariaLabel:`Frequency`,value:l.frequency,onChange:e=>{e!==`monthly`&&g(null),b({frequency:e})},items:[{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}]})})]}),l.frequency===`weekly`&&(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsx)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:`Day(s) of week`}),(0,Z.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:ji.map(([e,t])=>(0,Z.jsx)(s,{variant:`outlined`,size:`compact`,active:l.daysOfWeek.includes(t),onClick:()=>x(t),children:e},t))})]}),l.frequency===`monthly`&&(0,Z.jsx)(z,{label:`Day(s) of month`,type:`text`,value:_,onChange:e=>g(e.target.value),onBlur:e=>{let t=S(e.target.value);b({daysOfMonth:t}),g(t.join(`, `))},placeholder:`e.g. 1, 15`,helperText:`Comma-separated day numbers (1–31)`,className:`w-48`}),(0,Z.jsxs)(`div`,{className:`space-y-2`,children:[(0,Z.jsxs)(`label`,{className:`block text-body-small-default text-[var(--content-secondary)]`,children:[`Update window`,m?` (${m})`:``]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(z,{type:`time`,value:l.windowStart,onChange:e=>b({windowStart:e.target.value})}),(0,Z.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`to`}),(0,Z.jsx)(z,{type:`time`,value:l.windowEnd,onChange:e=>b({windowEnd:e.target.value})})]})]})]}),(0,Z.jsx)(s,{variant:`primary`,leftIcon:y.isPending?(0,Z.jsx)(D,{className:`animate-spin`}):void 0,onClick:async()=>{let n=l.frequency===`monthly`&&h!==null?S(h):l.daysOfMonth;try{await y.mutateAsync({enabled:l.enabled,timezone:`UTC`,schedule:{frequency:l.frequency,days_of_week:l.frequency===`weekly`?l.daysOfWeek:[],days_of_month:l.frequency===`monthly`?n:[],window:{start:Ni(l.windowStart),end:Ni(l.windowEnd)}}}),V.success(`Auto-update policy saved.`),c(null),g(null),t.invalidateQueries({queryKey:jt({path:{id:e}})})}catch{V.error(`Failed to save policy. Please try again.`)}},disabled:y.isPending||!u,children:`Save policy`})]})}function Li({assistantId:e,open:t,onClose:n}){return(0,Z.jsx)(B.Root,{open:t,onOpenChange:e=>{e||n()},children:(0,Z.jsxs)(B.Content,{size:`md`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Update Window`}),(0,Z.jsx)(B.Description,{children:`Configure when automatic updates are applied.`})]}),(0,Z.jsx)(B.Body,{children:(0,Z.jsx)(Ii,{assistantId:e})})]})})}function Ri(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}function zi({open:e,onOpenChange:t}){let n=d(),[r,i]=(0,X.useState)(null),[a,o]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(!1),f=(0,X.useRef)(e),p=()=>n.invalidateQueries({queryKey:Tt()}),m=e=>{ct({path:{id:e}}).catch(()=>void 0).finally(()=>void p())},h=Ot({onSuccess:e=>{if(!f.current){m(e.factor_id);return}i(e)},onError:e=>{let n=Ri(e);n===`no_workos_account`?V.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?V.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?V.error(`An authenticator app is already set up. Remove it before adding another.`):V.error(`Failed to start setup. Please try again.`),t(!1)}}),g=Ct({onSuccess:e=>{e.valid?(u.current=!0,V.success(`Two-factor authentication is on.`),p(),t(!1)):l(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=Ri(e);if(n===`challenge_already_verified`){u.current=!0,V.success(`Two-factor authentication is on.`),p(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){r&&m(r.factor_id),i(null),o(``),l(`This setup session expired. Scan the new QR code and try again.`),h.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){l(`Too many attempts. Wait a minute and try again.`);return}l(`Couldn't verify the code. Wait a moment and try again.`)}});(0,X.useEffect)(()=>{f.current=e,e&&(u.current=!1,i(null),o(``),l(null),h.mutate({}))},[e]);let v=e=>{!e&&g.isPending||(!e&&r&&!u.current&&m(r.factor_id),t(e))},y=()=>{r&&Qt(r.secret,{successMessage:`Setup key copied.`,errorMessage:`Couldn't copy the setup key.`})},b=()=>{!r||a.length!==6||g.isPending||(l(null),g.mutate({body:{challenge_id:r.challenge_id,code:a}}))};return(0,Z.jsx)(B.Root,{open:e,onOpenChange:v,children:(0,Z.jsxs)(B.Content,{size:`sm`,children:[(0,Z.jsxs)(B.Header,{children:[(0,Z.jsx)(B.Title,{children:`Set up authenticator app`}),(0,Z.jsx)(B.Description,{children:`Scan the QR code with an authenticator app such as Google Authenticator or 1Password, then enter the 6-digit code it shows.`})]}),(0,Z.jsx)(B.Body,{children:r===null?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,Z.jsx)(D,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,Z.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),b()},children:[(0,Z.jsx)(`img`,{src:r.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,Z.jsxs)(`button`,{type:`button`,onClick:y,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,Z.jsx)(`span`,{className:`break-all text-left`,children:r.secret}),(0,Z.jsx)(_,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,Z.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,Z.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,Z.jsx)(z,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:a,onChange:e=>o(e.target.value.replace(/\D/g,``).slice(0,6))}),c&&(0,Z.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:c})]})]})}),(0,Z.jsxs)(B.Footer,{children:[(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>v(!1),disabled:g.isPending,children:`Cancel`}),(0,Z.jsx)(s,{onClick:b,disabled:r===null||a.length!==6||g.isPending,children:g.isPending?`Verifying…`:`Verify`})]})]})})}function Bi(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function Vi(){let e=d(),[t,n]=(0,X.useState)(!1),[r,i]=(0,X.useState)(null),a=f({...wt()}),o=a.data??[],c=()=>e.invalidateQueries({queryKey:Tt()}),l=Mt({onSuccess:()=>{V.success(`Authenticator app removed.`),c()},onError:e=>{if(Ri(e)===`factor_not_found`){c();return}V.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[a.isPending?(0,Z.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):a.isError?(0,Z.jsxs)(R,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,Z.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void a.refetch(),children:`Try again`})]}):o.length===0?(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`No authenticator app is set up. Add one to require a one-time code at sign-in.`}):(0,Z.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:o.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,Z.jsx)(se,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,Z.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${Bi(e.created_at)}`:``]})]})]}),(0,Z.jsx)(s,{variant:`dangerOutline`,onClick:()=>i(e),disabled:l.isPending,children:`Remove`})]},e.id))}),!a.isPending&&!a.isError&&o.length===0&&(0,Z.jsx)(s,{onClick:()=>n(!0),className:`self-start`,children:`Add authenticator app`}),(0,Z.jsx)(zi,{open:t,onOpenChange:n}),(0,Z.jsx)(be,{open:r!==null,title:`Remove authenticator app`,message:`Signing in will no longer ask for a code from this app. You can set up a new authenticator app at any time.`,confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{r&&l.mutate({path:{id:r.id}}),i(null)},onCancel:()=>i(null)})]})}var Q=class extends Error{code;constructor(e,t){super(t),this.name=`TeleportError`,this.code=e}},Hi=`local`,Ui=`docker`,Wi=`vellum`;function Gi(e){switch((e??``).toLowerCase()){case Hi:return`local`;case Ui:return`docker`;case Wi:return`managed`;default:return`other`}}function Ki(e){let t=Gi(e);return t===`managed`?`local`:t===`local`?`platform`:null}function qi(e){switch(e){case`docker`:return`Move to Docker`;case`platform`:return`Move to Cloud (Platform)`;case`local`:return`Move to Local`}}function Ji(e){switch(e){case`docker`:return`Run your assistant in a Docker container on this Mac.`;case`platform`:return`Run your assistant in the cloud, managed by the Vellum platform.`;case`local`:return`Run your assistant locally on this Mac.`}}function Yi(e){if(!e||typeof e!=`object`)return null;let t=e;if(t.reason!==`version_mismatch`)return null;let n=t.bundle_compat,r=t.target_runtime_version;if(!n||typeof n!=`object`||typeof r!=`string`)return null;let i=n,a=i.min_runtime_version;if(typeof a!=`string`)return null;let o=typeof i.max_runtime_version==`string`?i.max_runtime_version:null;return`Cannot import: bundle requires runtime ${o?`${a}–${o}`:`${a}+`}, but this local runtime is ${r}. Update your local runtime before importing.`}async function Xi(e,t){let n=Number(e.headers.get(`Content-Length`)??0);if(!e.body||!t||n<=0){let n=await e.arrayBuffer();return t?.(1),n}let r=e.body.getReader(),i=[],a=0;for(;;){let{done:e,value:o}=await r.read();if(e)break;i.push(o),a+=o.length,t(a/n)}let o=new Uint8Array(a),s=0;for(let e of i)o.set(e,s),s+=e.length;return t(1),o.buffer}function Zi(e){let t=ke(e);if(!t)throw new Q(`local_assistant_not_found`,`Assistant ${e.assistantId} has no resolved local gateway.`);return`${window.location.origin}${t}`}async function Qi(e,t){let n=await Fe(e.assistantId),r=await fetch(`${t}/auth/token`,{method:`POST`,headers:{Authorization:`Bearer ${n}`}});if(!r.ok)throw new Q(`not_signed_in`,`Gateway token request failed (HTTP ${r.status}).`);let{token:i}=await r.json();return i}async function $i(e,t){let n=Zi(e),r=await Qi(e,n),i=await fetch(`${n}/v1/migrations/export`,{method:`POST`,headers:{Authorization:`Bearer ${r}`}});if(!i.ok)throw new Q(`export_failed`,`Export failed (HTTP ${i.status}).`);return Xi(i,t)}async function ea(e,t){let n=Zi(e),r=await Qi(e,n),i=await fetch(`${n}/v1/migrations/import`,{method:`POST`,headers:{Authorization:`Bearer ${r}`},body:new Blob([t],{type:`application/octet-stream`})});if(!i.ok)throw new Q(`import_failed`,`Import failed (HTTP ${i.status}).`);let a=await ra(i);if(a&&a.success===!1)throw new Q(`import_failed`,a.error??`Import reported failure`)}async function ta(e,t){let{data:n,response:r}=await G.post({url:`/v1/assistants/{assistant_id}/migrations/export-to-gcs/`,path:{assistant_id:e},body:{upload_url:t},throwOnError:!1}),i=r?.status??0;if(!(r?.ok??!1)&&i!==202)throw new Q(`export_failed`,`Export failed (HTTP ${i}).`);let a=n?.job_id;if(!a)throw new Q(`export_failed`,`Export accepted but no job ID was returned.`);return a}async function na(e,t){let{data:n,response:r}=await G.get({url:`/v1/assistants/{assistant_id}/migrations/jobs/{job_id}`,path:{assistant_id:e,job_id:t},throwOnError:!1}),i=r?.status??0;if(i>=500)return`processing`;if(!(r?.ok??!1))throw new Q(`export_job_failed`,`Job status check failed (HTTP ${i})`);let a=n;if(a?.status===`failed`)throw new Q(`export_job_failed`,a.error??`Export job failed`);return a?.status??`processing`}async function ra(e){try{return await e.json()}catch{return null}}var ia=new Set([500,502,503,504]),$=3,aa=e=>new Promise(t=>setTimeout(t,e));async function oa(e,t=new Set){for(let n=0;n<=$;n++){let{response:r,data:i,error:a}=await e(),o=r?.status??0;if(n<$&&ia.has(o)&&!t.has(o)){await aa(2**n*1e3);continue}return{status:o,data:i,error:a}}throw new Q(`unknown`,`Unexpected retry loop exit`)}async function sa(e,t){let n={operation:`upload`};e&&(n.min_runtime_version=e,n.max_runtime_version=null),t&&(n.consumer=t);let{status:r,data:i}=await oa(()=>G.post({url:`/v1/migrations/signed-url/`,body:n,throwOnError:!1}),new Set([404,503]));if(r===503||r===404)throw new Q(`export_failed`,`Signed URL uploads are not available — the platform may not support this feature yet.`);if(r!==201)throw new Q(`export_failed`,`Migration request failed (HTTP ${r}).`);let a=i;return{url:a.url,bundleKey:a.bundle_key,expiresAt:a.expires_at}}async function ca(e,t){let{status:n,data:r,error:i}=await oa(()=>G.post({url:`/v1/migrations/signed-url/`,body:{operation:`download`,bundle_key:e,target_runtime_version:t},throwOnError:!1}),new Set([422]));if(n===422){let e=Yi(i);if(e)throw new Q(`version_mismatch`,e)}if(n!==200&&n!==201)throw new Q(`import_failed`,`Migration request failed (HTTP ${n}).`);return r.url}async function la(e,t,n){for(let r=0;r<=$;r++){let i=await ua(e,t,n);if(r<$&&ia.has(i)){await aa(2**r*1e3),n?.(0);continue}if(i<200||i>=300)throw new Q(`export_failed`,`Bundle upload failed (HTTP ${i}).`);return}}function ua(e,t,n){return new Promise((r,i)=>{let a=new XMLHttpRequest;a.open(`PUT`,e),a.setRequestHeader(`Content-Type`,`application/octet-stream`),a.timeout=36e5,n&&(a.upload.onprogress=e=>{e.lengthComputable&&n(e.loaded/e.total)}),a.onload=()=>{n?.(1),r(a.status)},a.onerror=()=>i(new Q(`export_failed`,`Bundle upload failed.`)),a.ontimeout=()=>i(new Q(`export_timed_out`,`Bundle upload timed out.`)),a.send(t)})}async function da(e,t){for(let n=0;n<=$;n++){let r=await fetch(e,{method:`GET`});if(n<$&&ia.has(r.status)){await aa(2**n*1e3),t?.(0);continue}if(!r.ok)throw new Q(`import_failed`,`Bundle download failed (HTTP ${r.status}).`);return Xi(r,t)}throw new Q(`import_failed`,`Unexpected retry loop exit`)}async function fa(e){let{status:t,data:n,error:r}=await oa(()=>G.post({url:`/v1/migrations/import-from-gcs/`,body:{bundle_key:e},throwOnError:!1}));return{status:t,body:n??r??null}}async function pa(e){let{status:t,data:n}=await oa(()=>G.get({url:`/v1/migrations/jobs/{job_id}/`,path:{job_id:e},throwOnError:!1}));if(t!==200)throw new Q(`import_failed`,`Job status check failed (HTTP ${t})`);let r=n??{};return{status:typeof r.status==`string`?r.status:`unknown`,jobId:typeof r.job_id==`string`?r.job_id:null,error:typeof r.error==`string`?r.error:null}}var ma=5e3,ha=36e5,ga=5*6e4,_a=30,va=e=>new Promise(t=>setTimeout(t,e));function ya(){let e=c(),t=Me(),n=Ki(t?.cloud),[r,i]=(0,X.useState)({kind:`idle`}),[o,s]=(0,X.useState)(!1),l=(0,X.useRef)(null),u=(0,X.useRef)(null),d=(0,X.useCallback)(e=>{i({kind:`transferring`,step:e,progress:null})},[]),f=(0,X.useCallback)(e=>{i(t=>t.kind===`transferring`?{...t,progress:e}:t)},[]),p=(0,X.useCallback)(async()=>{if(!(!t||!n)){u.current={id:t.assistantId,kind:Gi(t.cloud)===`managed`?`managed`:`local`,createdFresh:!1};try{if(n===`platform`)await ba(t,d,f,l);else if(n===`local`)await xa(t,d,f,l);else throw new Q(`unknown`,`Unsupported teleport destination.`);i({kind:`verifying`})}catch(e){i({kind:`failed`,error:`Teleport failed: ${e instanceof Q||e instanceof Error?e.message:`Teleport failed.`}`}),a(e,{context:`teleport-execute`}),await Ca(l.current,u.current,`teleport-execute-cleanup`),l.current=null}}},[t,n,d,f]),m=(0,X.useCallback)(()=>s(!0),[]),h=(0,X.useCallback)(()=>s(!1),[]),g=(0,X.useCallback)(()=>{s(!1),p()},[p]),_=(0,X.useCallback)(()=>{l.current=null,u.current=null,i({kind:`idle`})},[]);return{destination:n,phase:r,confirmOpen:o,requestTeleport:m,cancelConfirm:h,confirm:g,confirmAndSwitch:(0,X.useCallback)(()=>{let t=l.current,n=u.current;t&&(async()=>{try{let e=Xe.getState();t.kind===`managed`?await e.connectPlatformAssistant(t.id):(await e.connectLocalAssistant(t.id),Ze(t.id,{onError:e=>a(e,{context:`teleport-inject-platform-identity`})}))}catch(e){i({kind:`failed`,error:`Switch failed: ${e instanceof Error?e.message:`Failed to switch assistant.`}`}),a(e,{context:`teleport-confirm-switch`});return}n&&Kt(n.id).then(e=>{e.ok||a(Error(e.error),{context:`teleport-retire-source`})}),_(),e(q.assistant,{replace:!0})})()},[e,_]),cancelTeleport:(0,X.useCallback)(()=>{let e=l.current,t=u.current;l.current=null,u.current=null,i({kind:`idle`}),Ca(e,t,`teleport-cancel-retire-target`)},[]),reset:_}}async function ba(e,t,n,r){t(`Exporting assistant data...`);let i=await $i(e,n);t(`Resolving organization...`);let a=await Ta();t(`Checking for existing assistant...`);let o=(await ot({query:{hosting:`platform`},throwOnError:!1})).data?.results?.[0];if(o)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${o.id}'. Retire it first, then retry the teleport.`);t(`Uploading data to cloud...`);let s=await sa(e.resources?.runtimeVersion);await la(s.url,i,n),t(`Setting up cloud assistant...`);let c=await ut(void 0,`create`);if(!c.ok)throw new Q(`import_failed`,`Failed to set up the cloud assistant.`);if(c.status===200)throw new Q(`existing_platform_assistant`,`You already have a platform assistant '${c.data.id}'. Retire it first, then retry the teleport.`);let l=c.data.id;await Ce({assistantId:l,name:c.data.name,cloud:`vellum`,runtimeUrl:De(),hatchedAt:c.data.created??new Date().toISOString(),organizationId:a}),await we(e.assistantId),r.current={id:l,kind:`managed`,createdFresh:!0},t(`Finalizing cloud assistant...`),await Ea(l),t(`Importing data to cloud...`);let u=await fa(s.bundleKey);if(u.status<200||u.status>=300){let e=u.body;throw new Q(`import_failed`,e?.error??`Import failed (HTTP ${u.status}).`)}if(u.status===202){let e=u.body?.job_id;if(!e)throw new Q(`import_failed`,`Import accepted but no job ID returned.`);await Da(e)}else{let e=u.body;if(e&&e.success===!1)throw new Q(`import_failed`,e.error??`Import reported failure.`)}}async function xa(e,t,n,r){t(`Preparing export...`);let i=await sa(await wa(e.assistantId),`runtime`);t(`Exporting cloud data...`);let a=await ta(e.assistantId,i.url);await Oa(e.assistantId,a),t(`Preparing local assistant...`);let{assistant:o,createdFresh:s}=await ka();r.current={id:o.assistantId,kind:`local`,createdFresh:s};let c=await Sa(o,s);if(!c)throw new Q(`local_assistant_not_found`,`Could not determine the local assistant's runtime version. Restart or upgrade the local assistant, then retry the teleport.`);t(`Preparing import...`);let l=await ca(i.bundleKey,c);t(`Downloading data...`);let u=await da(l,n);t(`Importing data...`),await ja(o,u),await we(e.assistantId)}async function Sa(e,t){if(e.resources?.runtimeVersion)return e.resources.runtimeVersion;if(t)return(await an())?.version??void 0}async function Ca(e,t,n){if(e?.createdFresh){let t=await Kt(e.id);t.ok||a(Error(t.error),{context:n})}t&&await we(t.id)}async function wa(e){let t=await lt(e);return t.ok?t.data.version??void 0:void 0}async function Ta(){let e=Qe.getState();e.organizations.length===0&&await e.fetchOrganizations();let t=Qe.getState().organizations,n=Ue();if(n&&t.some(e=>e.id===n))return n;if(t.length===0)throw new Q(`no_organizations`,`No organizations found for this account.`);if(t.length>1)throw new Q(`multiple_organizations`,`Multiple organizations found — please select one in account settings first.`);let r=t[0].id;return Qe.getState().setCurrentOrganizationId(r),r}async function Ea(e){let t=Date.now();for(;Date.now()-t<ga;){let{data:t,response:n}=await rt({path:{id:e},throwOnError:!1});if(n?.ok&&t?.state===`active`)return;await va(ma)}}async function Da(e){let t=Date.now();for(;Date.now()-t<ha;){await va(ma);let t=await pa(e);if(t.status===`complete`)return;if(t.status===`failed`)throw new Q(`import_failed`,t.error??`Import job failed`)}throw new Q(`import_failed`,`Import timed out after 60 minutes.`)}async function Oa(e,t){let n=Date.now();for(;Date.now()-n<ha;)if(await va(ma),await na(e,t)===`complete`)return;throw new Q(`export_timed_out`,`Export timed out.`)}async function ka(){let e=await Ee(void 0,void 0);if(!e.ok)throw new Q(`local_assistant_not_found`,e.error??`Could not create a local assistant.`);await Se();let t=e.assistantId?je().find(t=>t.assistantId===e.assistantId):Aa();if(!t)throw new Q(`local_assistant_not_found`,`Could not find or create a local assistant.`);return{assistant:t,createdFresh:!0}}function Aa(){return je().slice().sort((e,t)=>(t.hatchedAt??``).localeCompare(e.hatchedAt??``))[0]}async function ja(e,t){let n;for(let r=0;r<_a;r++)try{await ea(e,t);return}catch(e){n=e,await va(1e3)}throw n instanceof Error?n:new Q(`import_failed`,`Import failed.`)}function Ma(){let e=ya(),{destination:t,phase:n}=e;return t?(0,Z.jsxs)(Y,{title:`Teleport`,subtitle:`Move your assistant to a different hosting environment.`,children:[n.kind===`idle`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:Ji(t)}),(0,Z.jsx)(s,{variant:`outlined`,className:`self-start`,onClick:e.requestTeleport,children:qi(t)})]}),n.kind===`transferring`&&(0,Z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[n.progress==null&&(0,Z.jsx)(D,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:n.step})]}),n.progress!=null&&(0,Z.jsx)(fe,{value:n.progress,"aria-label":`Teleport progress`,className:`max-w-[240px]`})]}),n.kind===`verifying`&&(0,Z.jsx)(R,{tone:`success`,icon:(0,Z.jsx)(w,{className:`h-4 w-4`}),title:`Transfer complete — verify your new assistant is working.`,actions:(0,Z.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Z.jsx)(s,{variant:`primary`,onClick:e.confirmAndSwitch,children:`Confirm & Switch`}),(0,Z.jsx)(s,{variant:`outlined`,onClick:e.cancelTeleport,children:`Cancel`})]})}),n.kind===`failed`&&(0,Z.jsx)(R,{tone:`error`,title:n.error,actions:(0,Z.jsx)(s,{variant:`outlined`,onClick:e.reset,children:`Try Again`})}),(0,Z.jsx)(be,{open:e.confirmOpen,title:qi(t),message:`Your data will be copied to the new environment. The current assistant will remain available until you confirm the new one works.`,confirmLabel:`Teleport`,onConfirm:e.confirm,onCancel:e.cancelConfirm})]}):null}function Na(){let{t:e}=Le(`settings`),{assistant:t,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}=pn(),u=K.use.multiPlatformAssistant(),d=K.use.assistantSwitcher(),f=K.use.teleport(),p=K.use.accountMfa(),m=Wt.use.settingsSleepPolicy(),h=Je(),g=pt(),_=d&&(Pe()||h||Te()||g),v=c(),y=_t(),b=_t({platformHostedOnly:!0}),x=yt(),S=ht(),C=ee({assistantId:t?.id??null,enabled:b===`full`&&x}),[w,T]=(0,X.useState)(!1),[E,D]=(0,X.useState)(!1),[O,k]=l();(0,X.useEffect)(()=>{if(O.get(`preferences`)!==`open`)return;let e=new URLSearchParams(O);e.delete(`preferences`),k(e,{replace:!0}),D(!0)},[O,k]);let A=t?.is_local&&!Pe()?null:t,j=Me(),M=Pe()&&!!t&&!!j&&Oe(j),N=M,P=M&&!Te(),te=b===`full`&&!!A||P&&!!t;(0,X.useEffect)(()=>{!t||window.location.hash!==`#storage-resources`||requestAnimationFrame(()=>{document.getElementById(`storage-resources`)?.scrollIntoView({block:`start`})})},[t]);let F=n?.version??t?.current_release_version??null,ne=()=>{let e=Ae();if(Te()&&!g&&e){let t=new URLSearchParams({register:dt()}),n=Ne();n&&t.set(`name`,n);let r=new URL(e).origin;window.location.assign(`${r}${q.selectAssistant}?${t.toString()}`);return}v(`${q.selectAssistant}?noAutoSkip=1`)},I=(y===`full`||N)&&!!A||y===`disabled`&&!N,L=b!==`gated`;return(0,Z.jsxs)(`div`,{className:`space-y-4`,children:[C.status&&C.mode!==`inactive`&&(0,Z.jsx)(ie,{status:C.status,mode:C.mode,isAcknowledging:C.isAcknowledging,acknowledgeError:C.acknowledgeError?.message??null,onAcknowledge:()=>void C.acknowledge(),onReviewWorkspaceData:()=>void v(`${q.workspace}?sort=size`),onUpgradeStorage:b===`full`&&!S?()=>void v(q.plans):null}),(0,Z.jsxs)(Nn,{assistant:x?A:null,showHandles:h&&y===`full`,children:[(0,Z.jsx)(Ai,{}),p&&y!==`gated`&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.twoFactorTitle`)}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.twoFactorDescription`)}),(0,Z.jsx)(`div`,{className:`mt-1`,children:y===`disabled`?(0,Z.jsx)(J,{children:e(`generalPage.twoFactorLoginNotice`)}):(0,Z.jsx)(Vi,{})})]})]})]}),(0,Z.jsx)(Y,{title:e(`generalPage.versionTitle`),subtitle:e(`generalPage.versionSubtitle`),accessory:b===`full`&&A?(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>T(!0),children:e(`generalPage.updateWindow`)}):void 0,children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[b===`full`&&A&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(Un,{assistantId:A.id,currentVersion:F,releaseChannel:A.release_channel,onUpgradeComplete:()=>{a()}}),(0,Z.jsx)(fi,{assistantId:A.id,onComplete:()=>{a()}})]}),P&&t&&(0,Z.jsx)(Wn,{assistantId:t.id,currentVersion:F,onUpgradeComplete:()=>{a()}}),!te&&t&&(0,Z.jsxs)(`div`,{className:`grid grid-cols-[140px_minmax(0,1fr)] gap-y-3`,children:[(0,Z.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.current`)}),(0,Z.jsx)(mn,{version:F,loading:r&&!t.current_release_version,assistantId:t.id??null})]}),b===`disabled`&&!P&&(0,Z.jsx)(J,{children:e(`generalPage.updatesLoginNotice`)})]})}),b===`full`&&A&&(0,Z.jsx)(Li,{assistantId:A.id,open:w,onClose:()=>T(!1)}),b===`full`&&t&&(0,Z.jsx)(bi,{assistant:t,healthz:n,healthzLoading:r,healthzPolling:i,refetch:a,refetchUntilResized:o}),b===`disabled`&&(0,Z.jsx)(Y,{id:`storage-resources`,title:e(`generalPage.computeResourcesTitle`),subtitle:e(`generalPage.computeResourcesSubtitle`),children:(0,Z.jsx)(J,{children:e(`generalPage.computeResourcesLoginNotice`)})}),(0,Z.jsx)(Y,{title:e(`generalPage.preferencesTitle`),subtitle:e(`generalPage.preferencesSubtitle`),accessory:(0,Z.jsx)(s,{variant:`outlined`,onClick:()=>D(!0),children:e(`generalPage.customize`)}),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Z.jsx)(bn,{}),(0,Z.jsx)(Si,{})]})}),(0,Z.jsx)(oi,{open:E,onClose:()=>D(!1)}),f&&U()&&(0,Z.jsx)(Ma,{}),(0,Z.jsx)(qn,{}),(0,Z.jsx)(Wr,{}),b===`full`&&A&&m&&(0,Z.jsx)(Y,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Z.jsx)(zn,{assistantId:A.id})}),b===`disabled`&&m&&(0,Z.jsx)(Y,{title:e(`generalPage.sleepPolicyTitle`),subtitle:e(`generalPage.sleepPolicySubtitle`),children:(0,Z.jsx)(J,{children:e(`generalPage.sleepPolicyLoginNotice`)})}),u&&!_&&(0,Z.jsx)(In,{}),_&&(0,Z.jsx)(Y,{title:e(`generalPage.switchAssistantTitle`),subtitle:e(`generalPage.switchAssistantSubtitle`),accessory:(0,Z.jsx)(s,{variant:`outlined`,onClick:ne,children:e(`generalPage.chooseAssistant`)})}),(I||L)&&(0,Z.jsx)(Y,{variant:`danger`,title:e(`generalPage.dangerZoneTitle`),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[I&&(0,Z.jsxs)(`section`,{className:`flex flex-col gap-2`,children:[(0,Z.jsx)(`h3`,{className:`text-title-small text-[var(--content-emphasised)]`,children:e(`generalPage.retireAssistantTitle`)}),(0,Z.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:e(`generalPage.retireAssistantDescription`)}),(0,Z.jsx)(`div`,{className:`mt-1`,children:(y===`full`||N)&&A?(0,Z.jsx)(xi,{assistantId:A.id}):(0,Z.jsx)(J,{children:e(`generalPage.retireAssistantLoginNotice`)})})]}),I&&L&&(0,Z.jsx)(`div`,{className:`border-t border-[var(--border-subtle)]`}),(0,Z.jsx)(Gn,{})]})})]})}export{Na as GeneralPage};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-
|
|
2
|
-
import{t as e}from"./preload-helper-Cv2QeVDK.js";import{c as t,l as n}from"./platform-detection-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/esm-CtKndoc9.js","assets/preload-helper-Cv2QeVDK.js","assets/dist-D7UWVopK.js","assets/definitions-Co0yLSy_.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{t as e}from"./preload-helper-Cv2QeVDK.js";import{c as t,l as n}from"./platform-detection-zth6eCY8.js";var r=async(e,t)=>{if(e)try{await t()}catch{}},i=t=>r(t,async()=>{let{Haptics:t,ImpactStyle:n}=await e(async()=>{let{Haptics:e,ImpactStyle:t}=await import(`./esm-CtKndoc9.js`);return{Haptics:e,ImpactStyle:t}},__vite__mapDeps([0,1,2,3]));await t.impact({style:n.Light})}),a={light:()=>i(t()),medium:()=>r(t(),async()=>{let{Haptics:t,ImpactStyle:n}=await e(async()=>{let{Haptics:e,ImpactStyle:t}=await import(`./esm-CtKndoc9.js`);return{Haptics:e,ImpactStyle:t}},__vite__mapDeps([0,1,2,3]));await t.impact({style:n.Medium})}),success:()=>r(t(),async()=>{let{Haptics:t,NotificationType:n}=await e(async()=>{let{Haptics:e,NotificationType:t}=await import(`./esm-CtKndoc9.js`);return{Haptics:e,NotificationType:t}},__vite__mapDeps([0,1,2,3]));await t.notification({type:n.Success})}),error:()=>r(t(),async()=>{let{Haptics:t,NotificationType:n}=await e(async()=>{let{Haptics:e,NotificationType:t}=await import(`./esm-CtKndoc9.js`);return{Haptics:e,NotificationType:t}},__vite__mapDeps([0,1,2,3]));await t.notification({type:n.Error})}),refreshThreshold:()=>i(n())};export{a as t};
|