@vellumai/web 0.12.2-staging.3 → 0.12.2-staging.5
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/{a2a-invite-C-d__v0P.js → a2a-invite-D7Z1FvN-.js} +1 -1
- package/dist/assets/{about-page-BMTVVfA2.js → about-page-JRNWZ7kb.js} +1 -1
- package/dist/assets/{account-page-Bu04CQvW.js → account-page-Fw9S3qL2.js} +1 -1
- package/dist/assets/{account-shell-0TviHaBf.js → account-shell-BZp2-g1N.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-w4reCx6D.js → acp-run-detail-panel-2Nc7KPDZ.js} +1 -1
- package/dist/assets/{activation-list-route-CSuVtIeq.js → activation-list-route-L2lNhfTD.js} +1 -1
- package/dist/assets/{activity-redirect-page-Cgmmb8Rc.js → activity-redirect-page-ClzSvQoo.js} +1 -1
- package/dist/assets/{activity-steps-panel-C26DS_qd.js → activity-steps-panel-DSJiB6_Z.js} +1 -1
- package/dist/assets/{add-credits-modal-IIKnKS9l.js → add-credits-modal-CAUxaNjZ.js} +1 -1
- package/dist/assets/add-credits-modal-CXZ_HMMM.js +1 -0
- package/dist/assets/{ai-page-_iWq21vC.js → ai-page-yAJ8z8PM.js} +1 -1
- package/dist/assets/{android-billing-handoff-BVx_2Qs0.js → android-billing-handoff-BxVpZpp4.js} +1 -1
- package/dist/assets/{api-key-screen-xui6n8NR.js → api-key-screen-Ccta6gO2.js} +1 -1
- package/dist/assets/{app-info-4gR8gnBC.js → app-info-Csu7V_TE.js} +1 -1
- package/dist/assets/app-p4YU9h0P.js +392 -0
- package/dist/assets/{archive-redirect-page-D1zUz-Kn.js → archive-redirect-page-CzxO3IP6.js} +1 -1
- package/dist/assets/{assistant-status-panel-B-woG0mJ.js → assistant-status-panel-WAUlzwkS.js} +1 -1
- package/dist/assets/auth-store-Ck1z7eSl.js +1 -0
- package/dist/assets/{auth-welcome-screen-BsYIoTpq.js → auth-welcome-screen-pfPKjv5w.js} +1 -1
- package/dist/assets/avatar-bundled-components-D1XVsaGL.js +1 -0
- package/dist/assets/{avatar-random-DTCQMspt.js → avatar-random-Cki-Ly_C.js} +2 -2
- package/dist/assets/{await-org-header-settled-euao9G4w.js → await-org-header-settled-6bT0rbUs.js} +1 -1
- package/dist/assets/{background-task-detail-panel-Bm7wkZ5w.js → background-task-detail-panel-BYCUOtG5.js} +1 -1
- package/dist/assets/{billing-page-BkUfkbYS.js → billing-page-DUNd0r_e.js} +3 -3
- package/dist/assets/{billing-redirect-page-A8_L7A4l.js → billing-redirect-page-Dl__amIR.js} +1 -1
- package/dist/assets/{bookmarks-page-Db3QFcDm.js → bookmarks-page-5HR6Klms.js} +1 -1
- package/dist/assets/{bundle-confirm-page-Cnb49ExR.js → bundle-confirm-page-BxHGHYtw.js} +1 -1
- package/dist/assets/{channel-transcript-panel-DFDoSX5e.js → channel-transcript-panel-O29G6BfM.js} +1 -1
- package/dist/assets/{channels-page-route-9NljMyj4.js → channels-page-route-BsAycszP.js} +1 -1
- package/dist/assets/{chat-info-panel-BENFQ0tW.js → chat-info-panel-C3GOJkgC.js} +1 -1
- package/dist/assets/{checkout-continuation-C38t4ayV.js → checkout-continuation-CI0HG33e.js} +1 -1
- package/dist/assets/{checkout-page-B6HAgaEv.js → checkout-page-KqQmNMqQ.js} +1 -1
- package/dist/assets/checkout-return-target-B4WZzAGx.js +1 -0
- package/dist/assets/command-palette-BPcXUSG_.js +1 -0
- package/dist/assets/{command-palette-BIYpDozl.js → command-palette-DxolRnp8.js} +1 -1
- package/dist/assets/{command-palette-window-page-BMC7dzK0.js → command-palette-window-page-B4sEAiOF.js} +1 -1
- package/dist/assets/{community-page-BxDoLG0_.js → community-page-OsB5Ahr9.js} +1 -1
- package/dist/assets/{companion-accent-pu5Xu8Z6.js → companion-accent-BhdiAsTr.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-BEfMdIVO.js → companion-dock-zones-page-xJmPXMgY.js} +1 -1
- package/dist/assets/{companion-layout-Ye64fIzN.js → companion-layout-BPhlz6Wp.js} +1 -1
- package/dist/assets/{companion-popover-Bs6A6445.js → companion-popover-BsbCOPDj.js} +1 -1
- package/dist/assets/{companion-popover-page-7jpYeiIN.js → companion-popover-page-4ULIStvW.js} +1 -1
- package/dist/assets/{companion-surface-page-BrMY3X-F.js → companion-surface-page-BU0SxRLT.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-Bk0N7E-g.js → companion-watch-frame-page-BwKy3_MW.js} +1 -1
- package/dist/assets/{connect-page-Bf8bYBAk.js → connect-page-BDVFjuF6.js} +1 -1
- package/dist/assets/{consent-controls-N6cnmytV.js → consent-controls-BXRj0Z62.js} +1 -1
- package/dist/assets/{contacts-gateway-C_BunUUf.js → contacts-gateway-jgC2hJQu.js} +1 -1
- package/dist/assets/{contacts-page-route-DIxMGBde.js → contacts-page-route-C8DyP00R.js} +1 -1
- package/dist/assets/{credential-entry-page-2ek7NaCu.js → credential-entry-page-DZm1DSNe.js} +1 -1
- package/dist/assets/{credentials-page-D3PvFMgc.js → credentials-page-BFptIyXc.js} +1 -1
- package/dist/assets/{csv-preview-BB-EmIxC.js → csv-preview-DYuTN03x.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-BVmYzrKj.js → danger-zone-redirect-page-BgNNmPcD.js} +1 -1
- package/dist/assets/{debug-page-CJOt0BAt.js → debug-page-CsudFgfJ.js} +1 -1
- package/dist/assets/{deploy-dialogs-BSCor8jx.js → deploy-dialogs-BXow2FID.js} +1 -1
- package/dist/assets/deploy-dialogs-Bh91S82o.js +1 -0
- package/dist/assets/{desktop-preview-content-BIp4Vpgt.js → desktop-preview-content-DZb6VLVc.js} +2 -2
- package/dist/assets/{desktop-status-CHoj8auj.js → desktop-status-Dg1h8ABX.js} +1 -1
- package/dist/assets/{desktop-viewer-86gYrlm2.js → desktop-viewer-38EXOmZ4.js} +1 -1
- package/dist/assets/{detail-card-CGafPdBQ.js → detail-card-BpqiAUnN.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-BqhRaB6y.js → detail-panel-stop-button-BFDJ5Gir.js} +1 -1
- package/dist/assets/{detail-primitives-DIBzx3XJ.js → detail-primitives-CYiljnNr.js} +1 -1
- package/dist/assets/{developer-page-p4Ylxemb.js → developer-page-BIPONPKj.js} +1 -1
- package/dist/assets/{devices-redirect-page-BcyaUgzH.js → devices-redirect-page-DwI95Deo.js} +1 -1
- package/dist/assets/{dictation-overlay-page-C9yEcxKh.js → dictation-overlay-page-Du7FXduO.js} +1 -1
- package/dist/assets/{document-load-CZeb0od7.js → document-load-B4r-kmWD.js} +1 -1
- package/dist/assets/document-load-Bcy7cK7m.js +1 -0
- package/dist/assets/{document-viewer-page-L_O7lYHa.js → document-viewer-page-BzftukxE.js} +1 -1
- package/dist/assets/{emails-page-fgZebuJ7.js → emails-page-Cp6XS4Jh.js} +1 -1
- package/dist/assets/{environment-store-7mW8BRRm.js → environment-store-DXa_IPIU.js} +1 -1
- package/dist/assets/{file-diff-view-B9dRfPbB.js → file-diff-view-DIBSfwHd.js} +1 -1
- package/dist/assets/{file-editor-DtbuATs6.js → file-editor-gXTdPzcn.js} +1 -1
- package/dist/assets/{general-page-iMRa5Ucp.js → general-page-Du-jPHaf.js} +1 -1
- package/dist/assets/{hatching-screen-C9GXGQ2P.js → hatching-screen-BZup1IEp.js} +1 -1
- package/dist/assets/{hosting-screen-D8bCW4Uz.js → hosting-screen-B1uKDCEA.js} +1 -1
- package/dist/assets/{identity-page-route-D0fpi7db.js → identity-page-route-Cm6K_bBR.js} +1 -1
- package/dist/assets/{inspect-page-C2T5Wpgw.js → inspect-page-iBkyiBTD.js} +3 -3
- package/dist/assets/{integrations-page-3cwkXYyq.js → integrations-page-CVmr89JP.js} +1 -1
- package/dist/assets/{intelligence-layout-jyahyAWu.js → intelligence-layout-CzYFqgC5.js} +1 -1
- package/dist/assets/intelligence-layout-slots-store-C5ni0SPd.js +1 -0
- package/dist/assets/{keyboard-shortcuts-redirect-page-Bcl-FjyB.js → keyboard-shortcuts-redirect-page-VOpK_vkw.js} +1 -1
- package/dist/assets/{latest-assistant-text-HB3-JTrf.js → latest-assistant-text-CRS_nZkk.js} +1 -1
- package/dist/assets/{library-detail-page-DTptYQAF.js → library-detail-page-CYDXCYR7.js} +1 -1
- package/dist/assets/{library-page-D0OfVER_.js → library-page-DU9_fODf.js} +1 -1
- package/dist/assets/local-mode-BwMCd1ly.js +1 -0
- package/dist/assets/{login-page-BA3GjFvS.js → login-page-OqpqflhY.js} +1 -1
- package/dist/assets/{logout-page-Dp--IQJm.js → logout-page-B75MMPkh.js} +1 -1
- package/dist/assets/{logs-layout-C4SjgNAl.js → logs-layout-Dj1ybnfw.js} +1 -1
- package/dist/assets/{markdown-preview-CBu26q1U.js → markdown-preview-r7bRpgS4.js} +1 -1
- package/dist/assets/{media-preview-CrddXQMc.js → media-preview-ozDVMMcK.js} +1 -1
- package/dist/assets/{memory-page-route-BzLfpam9.js → memory-page-route-DSoeQ_G0.js} +1 -1
- package/dist/assets/{memory-router-playground-page-CP0Eurny.js → memory-router-playground-page-Cica9Nbb.js} +1 -1
- package/dist/assets/{message-files-panel-CDzpeEx4.js → message-files-panel-DwXYI7Vj.js} +1 -1
- package/dist/assets/{metric-card-Dkx47Ug0.js → metric-card-CRZNAmE4.js} +1 -1
- package/dist/assets/native-attachment-pickers-DH76HUOD.js +1 -0
- package/dist/assets/native-file-AwxfXJFy.js +1 -0
- package/dist/assets/{notifications-page-1r0ehmHL.js → notifications-page-8XrbAs9c.js} +1 -1
- package/dist/assets/{oauth-complete-page-D8yKCOVn.js → oauth-complete-page-B-oiboUF.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-DzPqlG80.js → oauth-popup-complete-page-DbkS3Ktn.js} +1 -1
- package/dist/assets/paired-platform-identity-BN-Q3FiP.js +1 -0
- package/dist/assets/{pairing-page-DhmG1Tkg.js → pairing-page-CL3aDKN8.js} +1 -1
- package/dist/assets/password-reset-page-9EUcZrPc.js +1 -0
- package/dist/assets/{pdf-file-preview-ElX646lL.js → pdf-file-preview-DWb95OOo.js} +1 -1
- package/dist/assets/{personality-page-DXW5MuRz.js → personality-page-Cd4rs_nw.js} +1 -1
- package/dist/assets/{personality-page-BqW5uuDF.js → personality-page-DRi1SkGz.js} +1 -1
- package/dist/assets/{personality-sliders-BuInNb35.js → personality-sliders-r9DH0oqr.js} +1 -1
- package/dist/assets/{plans-page-B87o5Bm-.js → plans-page-3TPIVG-V.js} +1 -1
- package/dist/assets/{platform-loopback-page--ynU4rVO.js → platform-loopback-page-6AkvXRD1.js} +1 -1
- package/dist/assets/{plugin-detail-page-lbmmlIpx.js → plugin-detail-page-C2PIC2NZ.js} +1 -1
- package/dist/assets/{plugins-page-BM44sOv4.js → plugins-page-Y18LhhDz.js} +1 -1
- package/dist/assets/plugins-surface-rSnCf7eu.js +1 -0
- package/dist/assets/{preview-error-B6mdXJ98.js → preview-error-BWXX5254.js} +1 -1
- package/dist/assets/{privacy-page-BqqU59zB.js → privacy-page-zDZFH9JY.js} +1 -1
- package/dist/assets/{privacy-screen-CW2gbeYL.js → privacy-screen-BdvoQ-DB.js} +1 -1
- package/dist/assets/{provider-callback-page-PVHvQXqC.js → provider-callback-page-CFS4DEY_.js} +1 -1
- package/dist/assets/{provider-key-fvCko3IH.js → provider-key-CYTAv7Kh.js} +1 -1
- package/dist/assets/{provider-signup-page-D6kN0d9F.js → provider-signup-page-C89a_7j5.js} +1 -1
- package/dist/assets/{quick-input-page-DMs0592w.js → quick-input-page-5f0AEU1o.js} +1 -1
- package/dist/assets/referral-modal-BciUQDfu.js +1 -0
- package/dist/assets/{referral-modal-C5ePy9XT.js → referral-modal-Dk1Vo23P.js} +1 -1
- package/dist/assets/{research-mock-page-D3X9Fw83.js → research-mock-page-DWfJd3UP.js} +1 -1
- package/dist/assets/{research-onboarding-route-Bk2Zl9y9.js → research-onboarding-route-Bd2vn3i5.js} +1 -1
- package/dist/assets/{review-terms-screen-CU9h0Gz5.js → review-terms-screen-M8IjrJH-.js} +1 -1
- package/dist/assets/routes-D_UALtH1.js +1 -0
- package/dist/assets/{schedules-Cslj2E_n.js → schedules-C83Ua4R6.js} +1 -1
- package/dist/assets/{schedules-page-7QBCwWLg.js → schedules-page-lT5NcWNK.js} +1 -1
- package/dist/assets/{security-redirect-page-D6C5fIZt.js → security-redirect-page-BcTO6hEV.js} +1 -1
- package/dist/assets/{select-assistant-screen-BO9WTRBj.js → select-assistant-screen-DAwfV-mz.js} +1 -1
- package/dist/assets/{self-hosted-servers-sqp6RgAQ.js → self-hosted-servers-BmfZpV_S.js} +1 -1
- package/dist/assets/{service-form-controls-C5nQsTzh.js → service-form-controls-B3_1_Epi.js} +1 -1
- package/dist/assets/{setting-row-Dqextrfj.js → setting-row-Dz9SXznO.js} +1 -1
- package/dist/assets/{settings-divider-D-IFmB_l.js → settings-divider-C1j4hJMG.js} +1 -1
- package/dist/assets/{settings-layout-Bh7MaZ4H.js → settings-layout-CQfyqDUr.js} +1 -1
- package/dist/assets/{share-feedback-modal-DsaGXNnY.js → share-feedback-modal-Ka1FQwFE.js} +1 -1
- package/dist/assets/share-feedback-modal-sGkJieen.js +1 -0
- package/dist/assets/{sidebar-tree-BgVhUiEU.js → sidebar-tree-BSRyDJ-e.js} +1 -1
- package/dist/assets/{signup-page-CzQJSqzn.js → signup-page-CcJHavhm.js} +1 -1
- package/dist/assets/{signup-shell-C1cGo11n.js → signup-shell-D9ohM8Rf.js} +1 -1
- package/dist/assets/{skill-detail-page-BN8Rwzuu.js → skill-detail-page-CGtKgK0P.js} +1 -1
- package/dist/assets/{skill-detail-panel-DVrh3t_h.js → skill-detail-panel-Bpl_9hRY.js} +1 -1
- package/dist/assets/{skill-removal-dialog-CkduZswH.js → skill-removal-dialog-C91c4ZfS.js} +1 -1
- package/dist/assets/{skills-page-DS76T-t4.js → skills-page-DpwPDybh.js} +1 -1
- package/dist/assets/{sounds-page-Bqrv7A7h.js → sounds-page-CzL0Egaq.js} +1 -1
- package/dist/assets/{start-screen-Cz9LflKA.js → start-screen-Cph32ejI.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-Ckz32Oh1.js → stt-language-picker-modal-3iCIcD10.js} +1 -1
- package/dist/assets/{subagent-detail-panel-C2AI9zu4.js → subagent-detail-panel-DF4ZXV2K.js} +1 -1
- package/dist/assets/{superpowers-page-CMOvPhlc.js → superpowers-page-DmqxKZ6y.js} +1 -1
- package/dist/assets/{system-events-page-D0fUUNzD.js → system-events-page-BP_Rw924.js} +1 -1
- package/dist/assets/{system-events-redirect-page-Dr4-w7Y1.js → system-events-redirect-page-sLsausvS.js} +1 -1
- package/dist/assets/{text-preview-DozGQuv6.js → text-preview-CKO4jBfL.js} +1 -1
- package/dist/assets/{theme-stage-page-CcBBPfjV.js → theme-stage-page-BIBA5J8a.js} +1 -1
- package/dist/assets/{tiptap-document-editor-Db4_RKhj.js → tiptap-document-editor-C3jfHfr_.js} +1 -1
- package/dist/assets/{tool-detail-panel-CNNnmtM6.js → tool-detail-panel-BkWuCCm0.js} +1 -1
- package/dist/assets/tool-detail-panel-msAhgoxJ.js +1 -0
- package/dist/assets/{trait-cycle-row-C1uqLkCi.js → trait-cycle-row-leO22btH.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-CKZWRtvT.js → upgrade-cancel-page-B0iduvhi.js} +1 -1
- package/dist/assets/{upgrade-success-page-CkXzT8Ty.js → upgrade-success-page-BClAIdZm.js} +1 -1
- package/dist/assets/{usage-redirect-page-CRrl2BDL.js → usage-redirect-page-BxTlrAZu.js} +1 -1
- package/dist/assets/{use-app-delete-CFfw_T0x.js → use-app-delete-Cj0xy5H5.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-CGJTkSlu.js → use-assistant-identity-details-Bj-VqGPz.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-DB9VdW8-.js → use-checkout-dismiss-refresh-Clbra-UV.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-DYPOVsUT.js → use-edge-swipe-back-D1eHj9sf.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-Cj-vFxW2.js → use-hotkey-recorder-KK0SXCtP.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-B4f3yyUN.js → use-invite-link-dialog-BYTs8NpU.js} +1 -1
- package/dist/assets/{use-platform-assistant-id-D8KGJAMf.js → use-platform-assistant-id-B1MuVrYX.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-Db6fiXSQ.js → use-return-to-short-circuit-CkdO0Q2j.js} +1 -1
- package/dist/assets/{use-side-list-room-CSNBqjJu.js → use-side-list-room-BSP_B7R_.js} +1 -1
- package/dist/assets/{use-skill-actions-BNpUjvgz.js → use-skill-actions-Dk64pbQd.js} +1 -1
- package/dist/assets/{use-skill-detail-files-C5BA-Phb.js → use-skill-detail-files-DmOW_S89.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-BSQpJ09k.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-ZVUnXf5k.js → use-transcript-message-by-id-diLlPoiw.js} +1 -1
- package/dist/assets/{voice-page-DDLtbhsC.js → voice-page-0iijkFuD.js} +1 -1
- package/dist/assets/{wake-detail-panel-C5K2zAvp.js → wake-detail-panel-DaKaOAfd.js} +1 -1
- package/dist/assets/{weather-forecast-display-CWGsPOa9.js → weather-forecast-display-ChYkwma2.js} +1 -1
- package/dist/assets/{welcome-screen-DuUuJIJ2.js → welcome-screen-Dwra_l1I.js} +1 -1
- package/dist/assets/{workflow-detail-panel-D6ip8R9Y.js → workflow-detail-panel-CgyFYiiF.js} +1 -1
- package/dist/assets/{workspace-page-D_4QLZh3.js → workspace-page-D-ZvFFGb.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-Byhxttdb.js +0 -1
- package/dist/assets/app-DFXcEvsi.js +0 -392
- package/dist/assets/auth-store-BFk7tSVA.js +0 -1
- package/dist/assets/avatar-bundled-components-B-TO2nC_.js +0 -1
- package/dist/assets/checkout-return-target-CrM-Nhda.js +0 -1
- package/dist/assets/command-palette-Dj-GW7dm.js +0 -1
- package/dist/assets/deploy-dialogs-DY0pTVu1.js +0 -1
- package/dist/assets/document-load-B9O1A5E9.js +0 -1
- package/dist/assets/intelligence-layout-slots-store-CI7IhmZv.js +0 -1
- package/dist/assets/local-mode-Dve-u3Zf.js +0 -1
- package/dist/assets/native-attachment-pickers-DVsB4Q0l.js +0 -1
- package/dist/assets/native-file-BKR4KkJt.js +0 -1
- package/dist/assets/paired-platform-identity-C4IGgtxq.js +0 -1
- package/dist/assets/password-reset-page-7yc-z_Pf.js +0 -1
- package/dist/assets/plugins-surface-2i_lZYet.js +0 -1
- package/dist/assets/referral-modal-VQ2vsPTh.js +0 -1
- package/dist/assets/routes-NC2Xyogy.js +0 -1
- package/dist/assets/share-feedback-modal-D44y3KhU.js +0 -1
- package/dist/assets/tool-detail-panel-PjXqpW5b.js +0 -1
- package/dist/assets/use-supports-credentials-settings-DIKVOLU1.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cx as t,Kp as n,Ng as r,Or as i,Sx as a,vd as o}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cx as t,Kp as n,Ng as r,Or as i,Sx as a,vd as o}from"./app-p4YU9h0P.js";import{I as s,er as c,j as l}from"./vendor-DYOeoIwg.js";import{t as u,x as d}from"./react-B9IgSVeK.js";var f=u();function p({app:e,isDeleting:t,onConfirm:n,onCancel:r}){let{t:i}=l();return(0,f.jsx)(a,{open:e!==null,title:i(`deleteAppDialog.title`),message:e?i(`deleteAppDialog.message`,{name:e.name}):``,confirmLabel:i(t?`deleteAppDialog.deleting`:`deleteAppDialog.delete`),destructive:!0,onConfirm:n,onCancel:r})}var m=e(d(),1);function h(e,t,{exported:n,failed:r}){let{id:a,name:o}=t,s=(0,m.useRef)(!1);return(0,m.useCallback)(async()=>{if(!s.current){s.current=!0;try{await i(e,{id:a,name:o},{exported:n,failed:r})}finally{s.current=!1}}},[e,a,o,n,r])}function g(e){let i=c(),[a,l]=(0,m.useState)(null),[u,d]=(0,m.useState)(!1);return{pendingDelete:a,isDeleting:u,requestDelete:l,confirmDelete:(0,m.useCallback)(async()=>{if(!(!a||u)){d(!0);try{await r({path:{assistant_id:e,id:a.id},throwOnError:!0}),n(e,a.id),i.invalidateQueries({queryKey:o({path:{assistant_id:e}})}),l(null)}catch(e){t.error(e instanceof Error?e.message:s(`useAppDelete.deleteFailed`))}finally{d(!1)}}},[a,u,e,i]),cancelDelete:(0,m.useCallback)(()=>{u||l(null)},[u])}}export{h as n,p as r,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Bg as e,Hh as t,Pb as n,Wg as r,m_ as i,ms as a,p_ as o,wg as s}from"./app-
|
|
1
|
+
import{Bg as e,Hh as t,Pb as n,Wg as r,m_ as i,ms as a,p_ as o,wg as s}from"./app-p4YU9h0P.js";import{Zn as c}from"./vendor-DYOeoIwg.js";import{i as l,n as u,t as d}from"./latest-assistant-text-CRS_nZkk.js";var f=[{id:s.companionCoworker,leftKey:`personalityAxes.companionCoworker.left`,rightKey:`personalityAxes.companionCoworker.right`},{id:s.genzBoomer,leftKey:`personalityAxes.genzBoomer.left`,rightKey:`personalityAxes.genzBoomer.right`},{id:s.executeCollaborate,leftKey:`personalityAxes.executeCollaborate.left`,rightKey:`personalityAxes.executeCollaborate.right`},{id:s.playfulSerious,leftKey:`personalityAxes.playfulSerious.left`,rightKey:`personalityAxes.playfulSerious.right`},{id:s.politeUnfiltered,leftKey:`personalityAxes.politeUnfiltered.left`,rightKey:`personalityAxes.politeUnfiltered.right`}],p=50,m=1500,h=12e4,g=e=>new Promise(t=>setTimeout(t,e));async function _({assistantId:t,content:a,title:s,context:c}){let f,p=!1;try{let e=await r({path:{assistant_id:t},body:{conversationType:`background`,title:s},throwOnError:!1});if(f=e.data?.id,!e.response?.ok||!f)return!1;let n=u({conversationId:f,content:a,transport:`vellum`});if(!(await i({path:{assistant_id:t},body:n,throwOnError:!1})).response?.ok)return!1;let c=Date.now()+h,_=``,v=0,y=!1;for(;Date.now()<c;){await g(m);let e=await o({path:{assistant_id:t},query:{conversationId:f},throwOnError:!1}),n=d(e.data?.messages??[]);if(n&&(v=n===_?v+1:0,_=n),e.data?.processing===!0&&(y=!0),l({processing:e.data?.processing,sawProcessing:y,hasReply:n.length>0,stableReads:v})){p=!0;break}}}catch(e){n(e,{context:c})}finally{if(f)try{await e({path:{assistant_id:t,id:f},throwOnError:!1})}catch(e){n(e,{context:`${c}_archive`})}}return p}function v(e){return[`assistant-identity-details`,e]}function y(e){return c({queryKey:v(e),queryFn:async()=>{let[n,r]=await Promise.all([a(e),t(e).catch(()=>({ok:!1,status:0,error:{}}))]);return{identity:n,createdAt:r.ok?r.data.created:null}}})}export{p as a,f as i,y as n,_ as r,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Bl as t,Bx as n,Ch as r,Cx as i,Eh as a,Gc as o,Gl as s,Gr as c,Ha as l,Hl as u,Hx as d,Jl as f,Ll as p,Rl as m,Ro as h,Sx as g,Tb as _,Tx as v,Ul as y,Ux as b,Vl as x,Wc as S,Wl as C,Wn as w,X_ as T,Z_ as E,am as D,au as O,ci as k,dm as A,fl as j,fm as ee,hm as M,hv as te,im as ne,om as N,ou as re,pv as ie,px as ae,rl as oe,sl as se,sm as P,sy as ce,ym as F,zc as le,zl as ue,zo as de}from"./app-DFXcEvsi.js";import{I as fe,Jn as pe,Zn as I,er as L,ir as me,j as R,or as he}from"./vendor-DYOeoIwg.js";import{f as ge,t as _e,x as z}from"./react-B9IgSVeK.js";import{E as ve,Hi as ye,Ja as be,La as xe,Ri as Se,fi as B,qi as Ce,qn as V,si as H,ur as we,yr as U,zn as Te}from"./icons-QG1KAFmx.js";import{t as W}from"./environment-store-7mW8BRRm.js";import{c as Ee,i as G,l as K,n as De,r as Oe,t as ke}from"./machine-sizes-Cyr9sICv.js";import{a as Ae,i as je,n as Me,r as Ne,t as Pe}from"./provisioning-targets-B5flnyHy.js";var Fe=be(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),q=e(z(),1),J=_e();function Ie({icon:e}){return(0,J.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,J.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Le={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Re({title:e,subtitle:t}){return(0,J.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,J.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Le,children:e}),t&&(0,J.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var ze=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1},{bodyShape:`stack`,eyeStyle:`gentle`,color:`purple`,size:110,position:`-left-[39px] top-[74%]`,rotate:0},{bodyShape:`urchin`,eyeStyle:`goofy`,color:`pink`,size:137,position:`-right-[42px] -bottom-[40px]`,rotate:180},{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`,size:72,position:`left-[37%] -bottom-[22px] -translate-x-1/2`,rotate:0}],Y=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1}];function X({variant:e=`full`}){let t=c();return t?(0,J.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Y:ze).map((e,n)=>(0,J.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,J.jsx)(w,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var Be={waitingStatus:`Upgrading your assistant…`,snagStatus:`We hit a snag upgrading your assistant`,snagCaption:`Retry in the background and we'll keep working on your upgrade.`,confirmingStatus:`Confirming your upgrade…`,confirmTimeoutStatus:`Still confirming your upgrade`,confirmTimeoutCaption:`Your payment went through safely. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still upgrading. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your upgrade continues in the background.`,backgroundRetryToast:`We'll retry your upgrade in the background.`,completeSubtitle:`Enjoy the new found power.`,fetchErrorBody:`We hit a problem checking your subscription. Your upgrade may still be processing. Return to billing to refresh.`},Ve={waitingStatus:`Updating your assistant…`,snagStatus:`We hit a snag updating your assistant`,snagCaption:`Retry in the background and we'll keep working on your plan change.`,confirmingStatus:`Confirming your plan change…`,confirmTimeoutStatus:`Still confirming your plan change`,confirmTimeoutCaption:`Your plan change was submitted. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still updating. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your plan change continues in the background.`,backgroundRetryToast:`We'll retry your plan change in the background.`,completeSubtitle:`Your plan changes are live.`,fetchErrorBody:`We hit a problem checking your subscription. Your plan change may still be processing. Return to billing to refresh.`},He={upgrade:Be,downgrade:Ve,change:Ve};function Z(e=`upgrade`){return He[e]}function Q(e,t=!0){let{data:n}=I({...le(),enabled:t&&e==null}),{data:r}=I({...j({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function $({assistantId:e,direction:t}){let n=ge(),{t:i}=R(`settings`),a=Q(e,F())?.name||i(`completeState.assistantFallbackName`);return(0,J.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,J.jsx)(X,{variant:`full`}),(0,J.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,J.jsx)(Re,{title:i(`completeState.title`),subtitle:Z(t).completeSubtitle}),(0,J.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&r(e),n(_.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function Ue(e=!0,t){let n=Q(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=I({...S({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var We=1e3,Ge=1e4,Ke=2500,qe=2e3,Je=1e4,Ye=[`machine_size`,`subdomain`,`non_field_errors`],Xe={subdomain_taken:`That subdomain is already taken. Try another.`,assistant_already_has_domain:`Your assistant already has a custom domain.`,no_assistant_to_attach_domain:`We couldn't find an assistant to attach this domain to.`,exceeds_machine_tier:`That machine size isn't available on your plan.`,provisioning_submission_failed:`We couldn't queue your upgrade just now. Try again in a moment.`,no_active_pro:`We couldn't confirm your Pro plan yet. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to upgrade yet. Try again in a moment.`},Ze={provisioning_submission_failed:`We couldn't queue your plan change just now. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to update yet. Try again in a moment.`};function Qe(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:Ze[t.error])??Xe[t.error];if(e)return e}for(let e of Ye){let n=t[e];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(typeof t.detail==`string`)return t.detail}return t}var $e=`h-8 rounded-lg border border-[var(--border-element)] bg-[var(--field-bg)] px-2.5 text-[14px] text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-[border-color] duration-150 focus:border-[var(--border-active)] disabled:cursor-not-allowed disabled:opacity-60`,et=`text-[11px] font-medium text-[var(--content-secondary)]`;function tt({onExit:e,machineBusy:r=!1,assistantId:i}){let{t:a}=R(`settings`),s=L(),c=W.use.emailRootDomain(),{assistant:l,assistantId:u,domains:d}=Ue(!0,i),f=d?.results[0],[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(`hi`),[_,x]=(0,q.useState)(!1);(0,q.useEffect)(()=>{if(!_){if(f){m(f.subdomain),x(!0);return}!l?.handle||p||(m(l.handle),x(!0))}},[l?.handle,f,_,p]);let[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=pe(t()),D=!!f||w,O=E.isPending||w;return(0,q.useEffect)(()=>{if(!w)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[w,e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(v.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,J.jsx)(X,{variant:`top`}),(0,J.jsx)(Re,{title:a(`domainStep.title`),subtitle:a(`domainStep.subtitle`)}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:et,children:a(`domainStep.prefixLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-prefix`,value:h,onChange:e=>g(e.target.value.toLowerCase().trim()),disabled:O||D,readOnly:D,placeholder:a(`domainStep.emailUsernamePlaceholder`),className:`${$e} w-24`})]}),(0,J.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:et,children:a(`domainStep.handleLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-handle`,value:p,onChange:e=>{m(e.target.value.toLowerCase().trim()),S&&C(null)},disabled:O||D,readOnly:D,autoFocus:!0,placeholder:a(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!S,className:`${$e} w-full min-w-0`})]}),(0,J.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,c]})]}),S&&(0,J.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:S}),D&&(0,J.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:a(`domainStep.domainLockedMessage`)})]}),r&&!D&&(0,J.jsx)(n,{tone:`neutral`,children:a(`domainStep.machineBusyNotice`)}),!D&&(0,J.jsx)(n,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,J.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:a(`domainStep.handleImmutableNotice`)})}),w?(0,J.jsx)(n,{tone:`success`,children:a(`domainStep.domainSetRedirecting`)}):null]}),(0,J.jsx)(v.Footer,{className:`items-center pt-6`,children:D?(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:a(`domainStep.continue`)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(b,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:O,onClick:()=>{O||E.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:a(`domainStep.skip`)}),(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!p||O||r,onClick:()=>{O||r||!p||E.mutate({body:{subdomain:p,...h?{email_username:h}:{}}},{onSuccess:()=>{C(null),T(!0),s.invalidateQueries({queryKey:oe()}),s.invalidateQueries({queryKey:o({path:{assistant_id:u??``}})}),s.invalidateQueries({queryKey:y()})},onError:e=>{C(Qe(e,a(`domainStep.registerSubdomainFailed`)))}})},children:a(`domainStep.next`)})]})})]})}function nt({onGoToBilling:e,direction:t}){let{t:n}=R(`settings`);return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,J.jsx)(Ie,{icon:ye}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(d,{variant:`title-small`,as:`h1`,children:n(`errorStates.fetchErrorTitle`)}),(0,J.jsx)(d,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Z(t).fetchErrorBody})]}),(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:n(`errorStates.goToBilling`)})]})}function rt(e){let{targets:t,fromSnapshot:n,machineFloor:r,credits:i}=e,a=[];return t.machineSize==null?r!=null&&n.machineSize!=null&&n.machineSize!==r&&a.push({key:`machine`,label:`Machine`,from:G[n.machineSize],to:G[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:G[n.machineSize],to:G[t.machineSize]}),t.storageGib!=null&&(n.storageGib==null||t.storageGib>n.storageGib)&&a.push({key:`storage`,label:`Storage`,from:n.storageGib==null?void 0:`${n.storageGib} GB`,to:`${t.storageGib} GB`}),i!=null&&a.push({key:`credits`,label:i.label??`Credits`,from:i.from,to:i.to}),a}var it=60,at=it*2;function ot({imageUrl:e,animateIn:t=!0}){return(0,J.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,J.jsx)(`img`,{src:e,alt:``,decoding:`async`,draggable:!1,className:`absolute left-1/2 top-1/2 max-w-none -translate-x-1/2 -translate-y-1/2 object-cover object-center`,style:{filter:`blur(${it}px)`,width:`calc(100% + ${at*2}px)`,height:`calc(100% + ${at*2}px)`}}),(0,J.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function st(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function ct(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function lt(e){let t=F(),{data:n}=I({...p(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function ut(e,t){return t==null?0:st(e,t)?.credits_usd??ct(t)}function dt(e,t){return t==null?null:st(e,t)?.label}function ft(e){let t=lt(e!=null);if(e==null||t==null)return null;let n,r;if(e.kind===`package`){let i=t.packages.find(t=>t.key===e.packageKey),a=st(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=st(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function pt(e){let t=lt(e!=null);return e==null||ut(t,e.fromTier)==null||ut(t,e.toTier)==null?null:{fromLabel:dt(t,e.fromTier),toLabel:dt(t,e.toTier)}}function mt(e){let t=ce.use.activeAssistantId(),n=e===void 0?t:e,{components:r,traits:i,customImageUrl:a,state:o,isLoading:s}=A(n),c=(0,q.useMemo)(()=>N(),[P()]),l=c!=null&&D(c)?c:null,u=n!=null&&!s,d=l!=null&&(n==null||n===l.assistantId),f=d&&!(u&&(r!=null||i!=null||a!=null))?l:null,p=f?f.components:r,m=f?f.traits:i,g=f?null:a,_=u||d,v=ee({state:f?null:o,components:p,traits:m,customImageUrl:g})??(g?null:M[0]?.hex??null);return{tintHex:_&&v?de(v):h,backdropImageUrl:_?g:null,ready:_,avatar:{components:p,traits:m,customImageUrl:g}}}function ht(e,t){let[n,r]=(0,q.useState)(e),i=(0,q.useRef)(0);return(0,q.useEffect)(()=>{i.current=performance.now()},[]),(0,q.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var gt=`--takeover-surface`,_t=`var(${gt},${h})`,vt=`color-mix(in srgb, var(--content-emphasised) 10%, transparent)`,yt=240,bt=1.414,xt=[{minHeight:680,size:yt},{minHeight:600,size:184}],St=132;function Ct(e){for(let t of xt)if(e>=t.minHeight)return t.size;return St}function wt(){let[e,t]=(0,q.useState)(()=>Ct(typeof window>`u`?1/0:window.innerHeight));return(0,q.useEffect)(()=>{let e=()=>t(Ct(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Tt={machine:H,storage:U,credits:B},Et={idle:``,working:` is-working`,settling:` is-settling`,stalled:` is-stalled`,grown:` is-evolved`};function Dt(e,t){return e===`DONE`||e===`NOT_APPLICABLE`?`grown`:e===`STALLED`?`stalled`:e===`WAITING`||e===`RESIZING`?t?`settling`:`working`:`idle`}function Ot({assistantId:e,mode:t,downsizing:n=!1}){let{avatar:r,ready:i}=mt(e),a=c(),o=wt(),s=t===`working`||t===`settling`;return(0,J.jsxs)(`div`,{"aria-hidden":!0,className:`provision-avatar-evolve relative z-10 flex flex-col items-center${Et[i?t:`idle`]}${n?` is-downsizing`:``}`,style:{"--provision-avatar-size":`${o}px`,"--provision-avatar-growth":bt},children:[(0,J.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,J.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,J.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,J.jsx)(`div`,{className:`provision-avatar-current`,children:(0,J.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,J.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,J.jsx)(k,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,J.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function kt({status:e,caption:t}){return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,J.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Le,children:e}),t&&(0,J.jsx)(d,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function At({icon:e,label:t,from:n,to:r,done:i=!1,pending:a=!1,testId:o}){let{t:s}=R(`settings`),c=null;return i?c=s(`provisioningState.statusComplete`):a&&(c=s(`provisioningState.statusPending`)),(0,J.jsxs)(`div`,{"data-testid":o,className:`flex min-w-0 flex-auto items-center gap-2 rounded-lg px-2 py-1.5${a?` opacity-70`:``}`,style:{backgroundColor:vt},children:[(0,J.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,J.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,J.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsx)(`span`,{className:`sr-only`,children:s(`provisioningState.srOnlyTo`)}),(0,J.jsx)(xe,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{children:r}),i?(0,J.jsx)(Ce,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,J.jsx)(V,{"data-testid":`chip-spinner`,className:`h-3.5 w-3.5 shrink-0 animate-spin text-[var(--content-tertiary)] motion-reduce:animate-none`,"aria-hidden":`true`})]}),c&&(0,J.jsx)(`span`,{className:`sr-only`,children:c})]})]})]})}function jt({label:e}){return(0,J.jsx)(`span`,{className:`rounded-lg px-3 py-2 text-[14px] text-[var(--content-emphasised)]`,style:{backgroundColor:vt},children:e})}function Mt({children:e,wide:t=!1,testId:n}){return(0,J.jsx)(`div`,{"data-testid":n,className:`flex w-full ${t?`max-w-2xl`:`max-w-sm`} items-stretch justify-center gap-2`,children:e})}function Nt(e,t){return e===`credits`?!0:t?.[e]===!0}function Pt(e,t){if(e==null)return null;let n=t(`provisioningState.noExtraUsage`),r=e.toLabel===null?n:e.toLabel;return r==null?null:{label:t(`provisioningState.usageLabel`),from:e.fromLabel===null?n:e.fromLabel,to:r}}function Ft({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=R(`settings`),l=ft(e),u=pt(t),d=rt({targets:n,fromSnapshot:r,machineFloor:i,credits:Pt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||Nt(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,q.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Mt,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||Nt(e.key,a);return(0,J.jsx)(At,{testId:`chip-${e.key}`,icon:Tt[e.key],label:e.label,from:e.from,to:e.to,done:t,pending:!t},e.key)})}),(0,J.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function It({intent:e}){let{t}=R(`settings`),n=ft(e.kind===`custom`?e:null);if(e.kind===`package`)return(0,J.jsx)(Mt,{children:(0,J.jsx)(jt,{label:t(`provisioningState.packageChip`,{name:e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1)})})});let r=[e.machineTier,e.storageTier,e.creditTier].filter(e=>e!=null).length;return(0,J.jsxs)(Mt,{wide:r>=3,children:[e.machineTier!=null&&(0,J.jsx)(At,{icon:H,label:t(`provisioningState.machineLabel`),to:De[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,J.jsx)(At,{icon:U,label:t(`provisioningState.storageLabel`),to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&(0,J.jsx)(jt,{label:n.toLabel})]})}function Lt({state:e,direction:t,softWaiting:n,intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,celebrating:l,onCelebrationEnd:u,assistantId:d,escapeAvailable:f,onEscape:p,onPhaseChange:m,kickError:h,confirm:g,dwellMs:_=Ke,phaseMinMs:v=900}){let{t:y}=R(`settings`),x=Z(t),S=(0,q.useRef)(u);(0,q.useEffect)(()=>{S.current=u},[u]);let C=ht(e,v),w=C===`DONE`||C===`NOT_APPLICABLE`,T=C===`RESIZING`?`WAITING`:C,E=(0,q.useRef)(m);(0,q.useEffect)(()=>{E.current=m},[m]),(0,q.useEffect)(()=>{E.current?.(C)},[C]);let{tintHex:D,backdropImageUrl:O}=mt(d),k=l&&w;return(0,q.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>S.current(),_);return()=>clearTimeout(e)},[k,_]),(0,J.jsxs)(`div`,{"data-theme":`dark`,className:`provision-surface-settle relative flex h-full min-h-[420px] w-full flex-col items-center [justify-content:safe_center] gap-10 px-6 py-10 text-center`,style:{[gt]:D,backgroundColor:_t},children:[O&&(0,J.jsx)(ot,{imageUrl:O}),(0,J.jsx)(Ot,{assistantId:d,mode:Dt(C,n),downsizing:t===`downgrade`}),(0,J.jsx)(`div`,{className:`relative z-10 flex min-h-[144px] w-full flex-col items-center gap-8 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:ee()},T)]});function A(e=y(`provisioningState.continueInBackground`)){return f?(0,J.jsx)(b,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:p,children:e}):null}function j({allDone:e=!1,creditsOnly:t=!1}={}){return(0,J.jsx)(Ft,{intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,allDone:e,creditsOnly:t})}function ee(){if(C===`CONFIRMING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:x.confirmingStatus,caption:y(`provisioningState.confirmingCaption`)}),r&&(0,J.jsx)(It,{intent:r}),A()]});if(C===`WAITING`||C===`RESIZING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:x.waitingStatus,caption:y(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),j(),A()]});if(C===`DONE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:y(`provisioningState.allDoneStatus`)}),j({allDone:!0})]});if(C===`NOT_APPLICABLE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:y(`provisioningState.planReadyStatus`)}),j({allDone:!0,creditsOnly:!0})]});if(C===`STALLED`){let e=h!=null;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:e?x.snagStatus:y(`provisioningState.takingLongerStatus`),caption:e?Qe(h,x.snagCaption,t):y(`provisioningState.stalledCaption`)}),j(),e?A(y(`provisioningState.retryInBackground`)):A()]})}return C===`CONFIRM_TIMEOUT`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:x.confirmTimeoutStatus,caption:x.confirmTimeoutCaption}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,J.jsx)(b,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:g.onGoToBilling,children:y(`provisioningState.goToBilling`)}),(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:g.onRetry,children:y(`provisioningState.tryAgain`)})]})]}):null}}function Rt(e){let{planId:t,targets:n,actuals:r,initialActuals:i,resizeOperationInFlight:a,sawOperation:o,msSinceWatchStart:s,confirmExpired:c,serverVerdict:l=null,statusObservedSinceTargetsMet:u=!0,targetsProveNoop:d=!0}=e;if(t!==`pro`)return{state:c?`CONFIRM_TIMEOUT`:`CONFIRMING`,softWaiting:!1};let f=o||a,p=l===`started`||l===`in_progress`,m=o||d&&u;if(!a){let e=p?m:f||l===`already_done`||i!=null&&!Ae(n,i);if(Ae(n,r)){if(e)return{state:`DONE`,softWaiting:!1};if(!p&&(d||l===`not_applicable`))return{state:`NOT_APPLICABLE`,softWaiting:!1}}else{if(l===`already_done`)return{state:`DONE`,softWaiting:!1};if(l===`not_applicable`)return{state:`NOT_APPLICABLE`,softWaiting:!1}}}return s!=null&&s>=9e4?{state:`STALLED`,softWaiting:!1}:f||l===`started`||l===`in_progress`?{state:`RESIZING`,softWaiting:!1}:{state:`WAITING`,softWaiting:s!=null&&s>=3e4}}var zt=2e3,Bt=1e3,Vt=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Ht={assistantId:null,machine:null,storage:null};function Ut({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Je}){let r=L(),i=F(),[o,c]=(0,q.useState)(!1),[l,d]=(0,q.useState)(0),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(null),[v,b]=(0,q.useState)(null),[S,w]=(0,q.useState)(null),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(Ht),[k,A]=(0,q.useState)(null),[ee,M]=(0,q.useState)(!1),te=(0,q.useRef)(!1),ne=(0,q.useRef)(!1),N=(0,q.useRef)(0),[re,ie]=(0,q.useState)(!1),[ae,oe]=(0,q.useState)(null),[P,ce]=(0,q.useState)(null),[ue,de]=(0,q.useState)(null),[fe,R]=(0,q.useState)(()=>Date.now()),[ge,_e]=(0,q.useState)(!0);(0,q.useEffect)(()=>{e||(c(!1),d(0),p(null),h(null),_(null),ie(!1),oe(null),ce(null),de(null),_e(!0),b(null),w(null),E(null),O(Ht),A(null),M(!1),te.current=!1,ne.current=!1,N.current+=1)},[e]),(0,q.useEffect)(()=>{e&&(p(Date.now()),r.invalidateQueries({queryKey:s()}),r.invalidateQueries({queryKey:y()}))},[e,r]);let z=m!=null,ve=I({...C(),refetchInterval:e=>e.state.data?.plan_id===`pro`||o?!1:We,refetchIntervalInBackground:!1,enabled:e&&i&&!z}),ye=(f!=null&&ve.dataUpdatedAt>=f?ve.data?.plan_id:null)??null;(0,q.useEffect)(()=>{if(!e||z||ye!==`pro`)return;let t=Date.now();h(t),R(t)},[e,z,ye]),(0,q.useEffect)(()=>{if(!e||z)return;let t=setTimeout(()=>c(!0),Ge);return()=>clearTimeout(t)},[e,z,l]);let be=(0,q.useCallback)(()=>{c(!1),d(e=>e+1),a.getState().fetchOrganizations(),r.invalidateQueries({queryKey:s()})},[r]),xe=(0,q.useCallback)(()=>{let e=Date.now();_(e),R(e)},[]),{mutate:Se}=pe(x()),B=(0,q.useCallback)(e=>{let t=N.current;Se({},{onSuccess:n=>{t===N.current&&(A(null),Me(n)?ne.current?A({error:n.reason??`no_active_pro`}):(ne.current=!0,M(!0),e===`escape`&&xe()):(b(n.state),e===`escape`&&xe()))},onError:e=>{t===N.current&&A(e)}})},[Se,xe]);(0,q.useEffect)(()=>{!e||!i||!z||te.current||(te.current=!0,B(`auto`))},[e,i,z,B]),(0,q.useEffect)(()=>{if(!ee)return;let e=N.current,t=setTimeout(()=>{M(!1),e===N.current&&B(`auto`)},qe);return()=>clearTimeout(t)},[ee,B]);let Ce=(0,q.useCallback)(()=>B(`escape`),[B]),V=I({...u(),enabled:e&&i&&z}),H=ge?zt:!1,we=I({...le(),enabled:e&&i&&z,refetchInterval:e=>e.state.data?.id==null?H:!1,retry:!1}),U=z&&f!=null&&V.dataUpdatedAt>=f,Te=U&&!V.isPending&&!V.isFetching,W=(U?V.data?.primary_assistant_id:null)??(V.isPending?null:we.data?.id??null),G=I({...j({path:{id:W??`unresolved`}}),enabled:e&&i&&z&&W!=null,refetchInterval:H,retry:!1}),De=se({path:{id:W??`unresolved`}}),Oe=I({...De,enabled:e&&i&&z&&W!=null,refetchInterval:H,retry:!1}),Fe=(0,q.useRef)(0),[J,Ie]=(0,q.useState)(0),Le=he(De.queryKey);(0,q.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==Le)){if(t.action.type===`fetch`)Fe.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=Fe.current,r=e&&Ne(t.action.data);me.schedule(()=>{Ie(n),r&&(ie(!0),oe(W))})}}}),[r,Le,e,W]);let Re=Ne(Oe.data),ze=ae===W,Y=V.data,X=(0,q.useMemo)(()=>Y?{machineSize:Ee(Y.max_machine_tier),storageGib:Y.selected_storage_gib??null}:null,[Y]),Be=Y!=null&&Y.max_machine_tier==null?ke:null,Ve=Y?Y.domain_setup_available&&Y.primary_assistant_id!=null:void 0,He=G.data,Z=(0,q.useMemo)(()=>He?{machineSize:He.machine_size??null,storageGib:He.provisioned_storage_gib??null}:null,[He]),Q=ue===W,$=(0,q.useMemo)(()=>{let e=Pe(X,Z),t=X?.machineSize??Be;if(t==null)return e;let n=Z?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Q?P?.machineSize:null)??n,i=K(t)<K(r);return{...e,machine:i?K(n)<=K(t):K(n)>=K(t)}},[X,Z,P,Q,Be]),Ue=Ae(X,Z),Ke=T===W;(0,q.useEffect)(()=>{e&&(Ue?(w(e=>e!=null&&Ke?e:Date.now()),E(W)):(w(null),E(null)))},[e,Ue,W,Ke]);let Ye=D.assistantId===W;(0,q.useEffect)(()=>{if(!e)return;let t=Fe.current;O(e=>{let n=e.assistantId===W?e:Ht,r=$.machine?n.machine??t:null,i=$.storage?n.storage??t:null;return e.assistantId===W&&e.machine===r&&e.storage===i?e:{assistantId:W,machine:r,storage:i}})},[e,$,W]);let Xe=(0,q.useMemo)(()=>{let e=je(Oe.data),t=e=>e!=null&&Ye&&J>e;return{machine:$.machine&&!e.machine&&t(D.machine),storage:$.storage&&!e.storage&&t(D.storage)}},[$,D,Ye,J,Oe.data]);(0,q.useEffect)(()=>{!e||!Z||P!=null&&Q||(ce(Z),de(W))},[e,Z,W,P,Q]);let Ze=g??m,Qe=Ze==null?null:Math.max(0,fe-Ze),$e=!t,{state:et,softWaiting:tt}=Rt({planId:z?`pro`:ye,targets:X,actuals:Z,initialActuals:Q?P:null,resizeOperationInFlight:Re,sawOperation:re&&ze,msSinceWatchStart:Qe,confirmExpired:o,serverVerdict:v,statusObservedSinceTargetsMet:S!=null&&Ke&&Oe.dataUpdatedAt>S,targetsProveNoop:$e}),nt=Vt.includes(et),rt=e&&z&&!nt;(0,q.useEffect)(()=>{_e(rt)},[rt]),(0,q.useEffect)(()=>{if(!e||!z||nt)return;let t=setInterval(()=>R(Date.now()),Bt);return()=>clearInterval(t)},[e,z,nt]);let it=!$e&&(v===`started`||v===`in_progress`)&&!(re&&ze);return(0,q.useEffect)(()=>{if(!e||!z||nt||!it)return;let t=setInterval(()=>B(`auto`),n);return()=>clearInterval(t)},[e,z,nt,it,n,B]),{state:et,softWaiting:tt,targets:X,actualsSnapshot:P,machineFloor:Be,landed:Xe,assistantId:W,domainStepAvailable:Ve,onboardingSettled:Te,confirmError:!z&&ve.isError,targetsError:z&&V.isError&&(!Y||!U),escapeEligible:Qe!=null&&Qe>=6e4,retryConfirm:be,kickProvisioning:Ce,kickError:k}}var Wt=200,Gt=380;function Kt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var qt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Jt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Yt={machineSize:null,storageGib:null};function Xt({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:a=`checkout`,resizeContext:s}){let{t:c}=R(`settings`),l=a===`resize`,u=L(),[d,f]=(0,q.useState)(`provisioning`),[p,m]=(0,q.useState)(`idle`),h=(0,q.useRef)([]),[_,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=l?s?.direction:void 0,D=Z(E),O=Ut({open:e,canLowerResources:l?s?.canLowerResources===!0:!1}),k=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(e){k.current=!0,y(l?null:te()),C(e=>e??Date.now());return}h.current.forEach(clearTimeout),h.current=[],f(`provisioning`),m(`idle`),x(null),C(null),T(!1),k.current&&(k.current=!1,ne())},[e,l]),(0,q.useEffect)(()=>()=>{h.current.forEach(clearTimeout)},[]),(0,q.useEffect)(()=>{d===`complete`&&ie()},[d]);let A=qt(O.state),j=Jt(b??O.state),{targets:ee,assistantId:M,domainStepAvailable:N,onboardingSettled:re}=O,ae=l?s?.fromSnapshot:void 0,oe=O.actualsSnapshot,se={machineSize:ae?.machineSize??oe?.machineSize??null,storageGib:ae?.storageGib??oe?.storageGib??null},{tintHex:P,backdropImageUrl:ce}=mt(M),F=l&&N===!0,{domains:le,domainsError:ue,domainsFetching:de,domainsUpdatedAt:fe,domainsErrorUpdatedAt:pe}=Ue(e&&F,M),I=(le?.results.length??0)>0,me=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!e){me.current=null;return}!F||M==null||me.current!==M&&(me.current=M,u.invalidateQueries({queryKey:o({path:{assistant_id:M}})}))},[e,F,M,u]);let he=!de&&(S!=null&&fe>=S||S!=null&&!!ue&&pe>=S),[ge,_e]=(0,q.useState)(!1),z=re&&(!F||he);(0,q.useEffect)(()=>{if(!e){_e(!1);return}z&&_e(!0)},[e,z]);let ve=(0,q.useCallback)(()=>{let e=l?N===!0&&!I?`domain`:`complete`:N===!1?`complete`:`domain`;if(Kt()){f(e);return}m(`covering`),h.current.push(setTimeout(()=>{f(e),m(`revealing`),h.current.push(setTimeout(()=>m(`idle`),Gt))},Wt))},[N,l,I]),ye=(0,q.useCallback)(()=>{T(!0)},[]),be=(0,q.useCallback)(()=>{O.kickProvisioning(),i.info(O.kickError==null?D.backgroundExitToast:D.backgroundRetryToast),T(!1),t()},[O,t,D]),xe=(0,q.useCallback)(()=>{T(!1)},[]),Se=d===`provisioning`&&(O.confirmError||O.targetsError),B=d===`provisioning`&&!Se,Ce=B&&!j,V=`transition-[background-color] duration-300 ease-out${B?` bg-black p-0`:``}`,H=B?`[animation:fadeIn_0.45s_ease-out_both]`:p===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,J.jsxs)(v.Content,{size:`md`,hideCloseButton:d!==`complete`,dismissOnOverlayClick:!Ce,onEscapeKeyDown:Ce?e=>e.preventDefault():void 0,onInteractOutside:Ce?e=>e.preventDefault():void 0,"data-theme":B?`dark`:void 0,overlayClassName:V,className:B?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,style:{[gt]:P},children:[(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${H}`,children:we()},d),p!==`idle`&&(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${p===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:_t},children:ce&&(0,J.jsx)(ot,{imageUrl:ce,animateIn:!1})})]})}),(0,J.jsx)(g,{open:w&&A,title:c(`billingOnboardingModal.backgroundConfirmTitle`),message:D.backgroundConfirmMessage,confirmLabel:c(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:c(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:be,onCancel:xe})]});function we(){return d===`provisioning`?O.confirmError||O.targetsError?(0,J.jsx)(nt,{onGoToBilling:t,direction:E}):(0,J.jsx)(Lt,{state:O.state,direction:E,softWaiting:O.softWaiting,intent:_,creditsChange:l?s?.credits:void 0,targets:ee??Yt,fromSnapshot:se,machineFloor:O.machineFloor,landed:O.landed,celebrating:ge,onCelebrationEnd:ve,assistantId:M,escapeAvailable:A&&O.escapeEligible,onEscape:ye,onPhaseChange:x,kickError:O.kickError,confirm:{onRetry:O.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):d===`domain`?(0,J.jsx)(tt,{machineBusy:A,assistantId:M,onExit:()=>f(`complete`)}):(0,J.jsx)($,{assistantId:M,direction:E})}}function Zt(e){return e!=null&&!e.customized}function Qt(e){return Zt(e)?e.name:`Custom`}var $t=[`mighty`,`super`,`ultra`],en=[`free`,...$t];function tn(e){return en.indexOf(e)}function nn(e,t){if(e===null)return`upgrade`;let n=tn(e),r=tn(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function rn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>$t.indexOf(e.key)-$t.indexOf(t.key));if(!t)return n[0];let r=n.findIndex(e=>e.key===t);return r===-1?n[0]:r>=n.length-1?null:n[r+1]}var an={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function on({tier:e,size:t=40}){let n=an[e]??an.free,r=c();return(0,J.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,J.jsx)(w,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,J.jsx)(`div`,{style:{width:t,height:t}})})}var sn={free:{tagline:`Get to know your assistant.`,cta:`Start Free`,priceCaption:`Forever`},mighty:{tagline:`More capacity for consistent use.`,cta:`Power Up`,priceCaption:`Billed monthly`,recommended:!0},super:{tagline:`Do more, think less about the how.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Your second brain, running full speed.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function cn(e){return sn[e]}function ln(e){return`Downgrade to ${e}`}function un(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function dn(e){return`${un(e)}/mo`}function fn(e){return`${un(e)}/month`}function pn(e){return`${e>0?`+`:`−`}${un(Math.abs(e))}/mo`}function mn(e){return`${e} GB storage`}function hn(e){return`${un(e*100)} of bundled credits`}var gn=`Small`;function _n(e){return e?.machine_size?G[e.machine_size]??e.machine_size:gn}function vn(e,t){let n=cn(e.key)?.extraFeatures??[];return[{icon:Fe,label:`${_n(e)} Machine`},{icon:U,label:`${e.storage_gib} GB Storage`},{icon:B,label:t,ownRow:!0},...n.map(e=>({icon:Te,label:e,ownRow:!0}))]}function yn(){return[{icon:Fe,label:`${gn} Machine`},{icon:U,label:`4 GB Storage`},{icon:B,label:`Pay as you go credits`,ownRow:!0}]}function bn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Oe[e?.machine_size??`small`];return[`${_n(e)} machine${i?` (${i})`:``}`,mn(r),e?.usage_label??hn(n),...t]}var xn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Sn(e,t){let n=[`${e.machineTier?De[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:gn} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=st(t,e.creditTier)?.label,i=ct(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function Cn(e,t){let n=new Set([xn.machine]);return e.storageGib!=null&&n.add(xn.storage),e.creditTier!=null&&n.add(xn.credits),[...Sn(e,t),...t.included_features.filter(e=>!n.has(e))]}function wn(e){return e.disabled===!0}function Tn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:o,currentStoragePriceCents:s}){let{t:c}=R(`settings`),l=(0,q.useMemo)(()=>e.map(e=>{let t=De[e.tier]??e.label,n=o==null?c(`tierPicker.priceAddon`,{price:dn(e.price_cents)}):e.price_cents===o?c(`tierPicker.priceCurrent`,{price:dn(e.price_cents)}):pn(e.price_cents-o);return{value:e.tier,label:c(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:wn(e)}}),[e,o,c]),u=(0,q.useMemo)(()=>t.map(e=>{let t=s==null?c(`tierPicker.priceAddon`,{price:dn(e.price_cents)}):e.price_cents===s?c(`tierPicker.priceCurrent`,{price:dn(e.price_cents)}):pn(e.price_cents-s);return{value:e.tier,label:c(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:wn(e)}}),[t,s,c]);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(d,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.machineLabel`)}),(0,J.jsx)(`span`,{title:c(`tierPicker.machineTooltip`),children:(0,J.jsx)(we,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(ae,{"aria-label":c(`tierPicker.machineAriaLabel`),placeholder:c(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:l})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(d,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.storageLabel`)}),(0,J.jsx)(`span`,{title:c(`tierPicker.storageTooltip`),children:(0,J.jsx)(we,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(ae,{"aria-label":c(`tierPicker.storageAriaLabel`),placeholder:c(`tierPicker.storagePlaceholder`),value:r??``,onChange:a,options:u})]})]})}var En=new Set([`active`,`trialing`,`past_due`]);function Dn(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&En.has(e.status)}function On(e){return e?.status!=null&&En.has(e.status)}var kn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function An(e,t){if(e&&typeof e==`object`){for(let t of kn)if(t in e){let n=e[t];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(`detail`in e&&typeof e.detail==`string`)return e.detail}return t}function jn(e,t){let n=e.filter(e=>!wn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Mn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Nn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Pn(){let e=L();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:s()}),t.onSuccess(n),n}catch(e){return i.error(An(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Fn=`billing-portal-return-snapshot`;function In(e){try{sessionStorage.removeItem(Fn),sessionStorage.setItem(Fn,JSON.stringify(e))}catch{}}function Ln(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Fn);if(!e)return null;let t=JSON.parse(e);return typeof t.cancel_at_period_end!=`boolean`||typeof t.plan_id!=`string`?null:{cancel_at_period_end:t.cancel_at_period_end,cancel_at:t.cancel_at??null,plan_id:t.plan_id}}catch{return null}}function Rn(){try{sessionStorage.removeItem(Fn)}catch{}}function zn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function Bn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Vn(e){return e?e.cancel_at??e.current_period_end??null:null}function Hn(e){let t=L();return(0,q.useEffect)(()=>E(()=>{t.invalidateQueries(C())}),[t]),O({onSuccess:t=>{e&&In(e),T(t.portal_url)},onError:()=>{i.error(fe(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function Un(){let e=re(),t=Pn();return{cancelSubscription:()=>t({mutateAsync:()=>e.mutateAsync({}),onSuccess:e=>{let t=e.cancel_at?Bn(e.cancel_at):fe(`settings:useCancelSubscription.endOfBillingPeriod`);i.info(fe(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>fe(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function Wn(e){return Promise.all([e.invalidateQueries({queryKey:s()}),e.invalidateQueries({queryKey:m()}),e.invalidateQueries({queryKey:y()}),e.invalidateQueries({queryKey:f()})])}function Gn({enabled:e=!0}={}){let t=L(),{t:n}=R(`settings`),[r,a]=(0,q.useState)(null),o=(0,q.useRef)(!1),[s,c]=(0,q.useState)(!1),l=F(),d=e&&l,f=I({...C(),enabled:d}),m=f.data,h=m!=null&&m.plan_id!==`base`,g=I({...u(),enabled:d&&h}),_=I({...p(),enabled:d&&h}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],v=e=>_.find(t=>t.tier===e)?.price_cents??null,y=pe(ue()),b={machineTier:g.data?.max_machine_tier??null,storageTier:g.data?.selected_storage_tier??null,storageGib:g.data?.selected_storage_gib??null,creditTier:m?.selected_credit_tier??null,hasPlatformFee:m?.has_platform_fee??!0},x=m!=null&&m.plan_id!==`base`&&m.status!=null&&En.has(m.status)&&m.cancel_at_period_end!==!0&&!m.cancel_at,S=!h||!g.isPending,w=!h||g.isSuccess&&g.data!=null&&!g.isFetching&&g.dataUpdatedAt>=f.dataUpdatedAt,T=s||y.isPending,E=async(e,t=b)=>{if(o.current)return null;o.current=!0,c(!0);try{return await D(e,t)}finally{o.current=!1,c(!1)}},D=async(e,r)=>{a(null);let o=e=>(a(e),i.error(e),null),[s,c]=await Promise.all([f.refetch(),g.refetch()]),l=s.data,u=c.data;if(s.isError||c.isError||l==null||u==null)return o(n(`customPlanModal.changeFailed`));let d={machineTier:u.max_machine_tier??null,storageTier:u.selected_storage_tier??null,storageGib:u.selected_storage_gib??null,creditTier:l.selected_credit_tier??null,hasPlatformFee:l.has_platform_fee??!0},p={machineTier:e.machineTier===r.machineTier?d.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&d.storageTier!=null?d.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?d.creditTier:e.creditTier},m=p.machineTier!==d.machineTier,h=p.storageTier!==d.storageTier,_=p.creditTier!==d.creditTier,b=!d.hasPlatformFee,x=v(p.machineTier),S=v(d.machineTier),C=m&&x!=null&&S!=null&&x<S;if(!m&&!h&&!_&&!b)return{needsResize:!1,creditChanged:!1};let w;try{w=(await y.mutateAsync({body:{machine_tier:p.machineTier,storage_tier:p.storageTier,credit_tier:p.creditTier}})).status}catch(e){return o(An(e,n(`customPlanModal.changeFailed`)))}return await Wn(t),w===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||m&&!C,creditChanged:_}};return{changeTiers:E,isPending:T,error:r,current:b,eligible:x,currentReady:S,currentKnown:w,primaryAssistantId:w?g.data?.primary_assistant_id??null:null}}function Kn(){let e=L(),{t}=R(`settings`),n=pe(ue());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await Wn(e),t}catch(e){return i.error(An(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function qn({className:e,"data-testid":t,children:n}){return(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:l(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Jn=32;function Yn(){let{ready:e,avatar:t}=mt();return(0,J.jsx)(qn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,J.jsx)(k,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:Jn}):null})}var Xn=`Billed monthly · prorated difference charged today`,Zn=`Billed monthly · prorated difference charged today or credited next invoice`,Qn=`Billed monthly · prorated credit on your next invoice`,$n=`Your machine downsizes now and your storage stays. No refund.`,er=`Continue`,tr=`The plan includes`,nr=`Your plan will include`;function rr(e,t,n){let r=n?cn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:ln(t),subtitle:``,priceCaption:Qn,checklistHeading:nr,note:$n,confirmLabel:ln(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:Zn,checklistHeading:tr,note:``,confirmLabel:er,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Xn,checklistHeading:tr,note:``,confirmLabel:er,destructive:!1}}}function ir({open:e,relation:t,packageName:n,targetPackage:r,pending:i,onCancel:a,onConfirm:o}){let{t:s}=R(`settings`),c=(0,q.useRef)(null),l=(0,q.useId)(),u=rr(t,n,r?.key??null),f=r?{price:dn(r.total_price_cents),highlights:bn(r,cn(r.key)?.extraFeatures??[])}:null,p=u.subtitle,m=u.note?{"aria-describedby":l}:p?{}:{"aria-describedby":void 0};return(0,J.jsx)(v.Root,{open:e,onOpenChange:e=>{!e&&!i&&a()},children:(0,J.jsxs)(v.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),c.current?.focus()},...m,children:[(0,J.jsxs)(v.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[u.destructive?(0,J.jsx)(qn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,J.jsx)(ve,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,J.jsx)(Yn,{}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(v.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:u.title}),p?(0,J.jsx)(v.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:p}):null]})]}),f?(0,J.jsxs)(v.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(d,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:f.price}),(0,J.jsx)(d,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:u.priceCaption})]}),(0,J.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,J.jsx)(d,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:u.checklistHeading}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.highlights.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(Se,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,J.jsx)(d,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,u.note?(0,J.jsx)(d,{id:l,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:u.note}):null,(0,J.jsxs)(v.Footer,{className:`flex-col gap-4 p-0`,children:[(0,J.jsx)(b,{fullWidth:!0,variant:u.destructive?`danger`:`primary`,onClick:o,disabled:i,"data-testid":`confirm-package-switch-button`,children:u.confirmLabel}),(0,J.jsx)(b,{ref:c,fullWidth:!0,variant:`ghost`,onClick:a,disabled:i,children:s(`packageSwitchConfirmModal.cancel`)})]})]})})}function ar(){let e=L();(0,q.useEffect)(()=>E(()=>{Wn(e)}),[e])}export{dn as A,Xt as B,Cn as C,vn as D,_n as E,$t as F,Q as H,Zt as I,rn as L,mn as M,cn as N,pn as O,on as P,Qt as R,wn as S,yn as T,Fe as U,Ue as V,Dn as _,Wn as a,jn as b,Rn as c,Ln as d,Hn as f,On as g,An as h,Gn as i,fn as j,un as k,Bn as l,En as m,ir as n,Un as o,Pn as p,Kn as r,zn as s,ar as t,Vn as u,Nn as v,Sn as w,Tn as x,Mn as y,nn as z};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Bl as t,Bx as n,Ch as r,Cx as i,Eh as a,Gc as o,Gl as s,Gr as c,Ha as l,Hl as u,Hx as d,Jl as f,Ll as p,Rl as m,Ro as h,Sx as g,Tb as _,Tx as v,Ul as y,Ux as b,Vl as x,Wc as S,Wl as C,Wn as w,X_ as T,Z_ as E,am as D,au as O,ci as k,dm as A,fl as j,fm as ee,hm as M,hv as te,im as ne,om as N,ou as re,pv as ie,px as ae,rl as oe,sl as se,sm as P,sy as ce,ym as F,zc as le,zl as ue,zo as de}from"./app-p4YU9h0P.js";import{I as fe,Jn as pe,Zn as I,er as L,ir as me,j as R,or as he}from"./vendor-DYOeoIwg.js";import{f as ge,t as _e,x as z}from"./react-B9IgSVeK.js";import{E as ve,Hi as ye,Ja as be,La as xe,Ri as Se,fi as B,qi as Ce,qn as V,si as H,ur as we,yr as U,zn as Te}from"./icons-QG1KAFmx.js";import{t as W}from"./environment-store-DXa_IPIU.js";import{c as Ee,i as G,l as K,n as De,r as Oe,t as ke}from"./machine-sizes-Cyr9sICv.js";import{a as Ae,i as je,n as Me,r as Ne,t as Pe}from"./provisioning-targets-B5flnyHy.js";var Fe=be(`computer`,[[`rect`,{width:`14`,height:`8`,x:`5`,y:`2`,rx:`2`,key:`wc9tft`}],[`rect`,{width:`20`,height:`8`,x:`2`,y:`14`,rx:`2`,key:`w68u3i`}],[`path`,{d:`M6 18h2`,key:`rwmk9e`}],[`path`,{d:`M12 18h6`,key:`aqd8w3`}]]),q=e(z(),1),J=_e();function Ie({icon:e}){return(0,J.jsx)(`span`,{className:`flex h-11 w-11 items-center justify-center rounded-full`,style:{backgroundColor:`color-mix(in oklab, var(--system-negative-strong) 12%, transparent)`},children:(0,J.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var Le={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Re({title:e,subtitle:t}){return(0,J.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,J.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:Le,children:e}),t&&(0,J.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var ze=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1},{bodyShape:`stack`,eyeStyle:`gentle`,color:`purple`,size:110,position:`-left-[39px] top-[74%]`,rotate:0},{bodyShape:`urchin`,eyeStyle:`goofy`,color:`pink`,size:137,position:`-right-[42px] -bottom-[40px]`,rotate:180},{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`,size:72,position:`left-[37%] -bottom-[22px] -translate-x-1/2`,rotate:0}],Y=[{bodyShape:`star`,eyeStyle:`curious`,color:`yellow`,size:103,position:`-left-[28px] -top-[33px]`,rotate:180},{bodyShape:`star`,eyeStyle:`curious`,color:`orange`,size:109,position:`left-[63%] -top-[62px] -translate-x-1/2`,rotate:-8},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`,size:76,position:`-right-[25px] top-[60px]`,rotate:1}];function X({variant:e=`full`}){let t=c();return t?(0,J.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?Y:ze).map((e,n)=>(0,J.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,J.jsx)(w,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var Be={waitingStatus:`Upgrading your assistant…`,snagStatus:`We hit a snag upgrading your assistant`,snagCaption:`Retry in the background and we'll keep working on your upgrade.`,confirmingStatus:`Confirming your upgrade…`,confirmTimeoutStatus:`Still confirming your upgrade`,confirmTimeoutCaption:`Your payment went through safely. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still upgrading. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your upgrade continues in the background.`,backgroundRetryToast:`We'll retry your upgrade in the background.`,completeSubtitle:`Enjoy the new found power.`,fetchErrorBody:`We hit a problem checking your subscription. Your upgrade may still be processing. Return to billing to refresh.`},Ve={waitingStatus:`Updating your assistant…`,snagStatus:`We hit a snag updating your assistant`,snagCaption:`Retry in the background and we'll keep working on your plan change.`,confirmingStatus:`Confirming your plan change…`,confirmTimeoutStatus:`Still confirming your plan change`,confirmTimeoutCaption:`Your plan change was submitted. This can take a minute.`,backgroundConfirmMessage:`Your assistant is still updating. Chatting won't be available until it finishes. You can keep waiting here, or continue and we'll let you know when it's ready.`,backgroundExitToast:`Your plan change continues in the background.`,backgroundRetryToast:`We'll retry your plan change in the background.`,completeSubtitle:`Your plan changes are live.`,fetchErrorBody:`We hit a problem checking your subscription. Your plan change may still be processing. Return to billing to refresh.`},He={upgrade:Be,downgrade:Ve,change:Ve};function Z(e=`upgrade`){return He[e]}function Q(e,t=!0){let{data:n}=I({...le(),enabled:t&&e==null}),{data:r}=I({...j({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function $({assistantId:e,direction:t}){let n=ge(),{t:i}=R(`settings`),a=Q(e,F())?.name||i(`completeState.assistantFallbackName`);return(0,J.jsxs)(`div`,{className:`relative flex min-h-[320px] flex-col items-center justify-center overflow-hidden px-8 pb-16 [animation:onboarding-step-in_350ms_ease-out] motion-reduce:[animation:none]`,children:[(0,J.jsx)(X,{variant:`full`}),(0,J.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,J.jsx)(Re,{title:i(`completeState.title`),subtitle:Z(t).completeSubtitle}),(0,J.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&r(e),n(_.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function Ue(e=!0,t){let n=Q(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=I({...S({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var We=1e3,Ge=1e4,Ke=2500,qe=2e3,Je=1e4,Ye=[`machine_size`,`subdomain`,`non_field_errors`],Xe={subdomain_taken:`That subdomain is already taken. Try another.`,assistant_already_has_domain:`Your assistant already has a custom domain.`,no_assistant_to_attach_domain:`We couldn't find an assistant to attach this domain to.`,exceeds_machine_tier:`That machine size isn't available on your plan.`,provisioning_submission_failed:`We couldn't queue your upgrade just now. Try again in a moment.`,no_active_pro:`We couldn't confirm your Pro plan yet. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to upgrade yet. Try again in a moment.`},Ze={provisioning_submission_failed:`We couldn't queue your plan change just now. Try again in a moment.`,no_provisionable_assistants:`We couldn't find an assistant to update yet. Try again in a moment.`};function Qe(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:Ze[t.error])??Xe[t.error];if(e)return e}for(let e of Ye){let n=t[e];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(typeof t.detail==`string`)return t.detail}return t}var $e=`h-8 rounded-lg border border-[var(--border-element)] bg-[var(--field-bg)] px-2.5 text-[14px] text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-[border-color] duration-150 focus:border-[var(--border-active)] disabled:cursor-not-allowed disabled:opacity-60`,et=`text-[11px] font-medium text-[var(--content-secondary)]`;function tt({onExit:e,machineBusy:r=!1,assistantId:i}){let{t:a}=R(`settings`),s=L(),c=W.use.emailRootDomain(),{assistant:l,assistantId:u,domains:d}=Ue(!0,i),f=d?.results[0],[p,m]=(0,q.useState)(``),[h,g]=(0,q.useState)(`hi`),[_,x]=(0,q.useState)(!1);(0,q.useEffect)(()=>{if(!_){if(f){m(f.subdomain),x(!0);return}!l?.handle||p||(m(l.handle),x(!0))}},[l?.handle,f,_,p]);let[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=pe(t()),D=!!f||w,O=E.isPending||w;return(0,q.useEffect)(()=>{if(!w)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[w,e]),(0,J.jsxs)(J.Fragment,{children:[(0,J.jsxs)(v.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,J.jsx)(X,{variant:`top`}),(0,J.jsx)(Re,{title:a(`domainStep.title`),subtitle:a(`domainStep.subtitle`)}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:et,children:a(`domainStep.prefixLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-prefix`,value:h,onChange:e=>g(e.target.value.toLowerCase().trim()),disabled:O||D,readOnly:D,placeholder:a(`domainStep.emailUsernamePlaceholder`),className:`${$e} w-24`})]}),(0,J.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:et,children:a(`domainStep.handleLabel`)}),(0,J.jsx)(`input`,{id:`onboarding-email-handle`,value:p,onChange:e=>{m(e.target.value.toLowerCase().trim()),S&&C(null)},disabled:O||D,readOnly:D,autoFocus:!0,placeholder:a(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!S,className:`${$e} w-full min-w-0`})]}),(0,J.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,c]})]}),S&&(0,J.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:S}),D&&(0,J.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:a(`domainStep.domainLockedMessage`)})]}),r&&!D&&(0,J.jsx)(n,{tone:`neutral`,children:a(`domainStep.machineBusyNotice`)}),!D&&(0,J.jsx)(n,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,J.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:a(`domainStep.handleImmutableNotice`)})}),w?(0,J.jsx)(n,{tone:`success`,children:a(`domainStep.domainSetRedirecting`)}):null]}),(0,J.jsx)(v.Footer,{className:`items-center pt-6`,children:D?(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:a(`domainStep.continue`)}):(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(b,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:O,onClick:()=>{O||E.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:a(`domainStep.skip`)}),(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!p||O||r,onClick:()=>{O||r||!p||E.mutate({body:{subdomain:p,...h?{email_username:h}:{}}},{onSuccess:()=>{C(null),T(!0),s.invalidateQueries({queryKey:oe()}),s.invalidateQueries({queryKey:o({path:{assistant_id:u??``}})}),s.invalidateQueries({queryKey:y()})},onError:e=>{C(Qe(e,a(`domainStep.registerSubdomainFailed`)))}})},children:a(`domainStep.next`)})]})})]})}function nt({onGoToBilling:e,direction:t}){let{t:n}=R(`settings`);return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,J.jsx)(Ie,{icon:ye}),(0,J.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,J.jsx)(d,{variant:`title-small`,as:`h1`,children:n(`errorStates.fetchErrorTitle`)}),(0,J.jsx)(d,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:Z(t).fetchErrorBody})]}),(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:n(`errorStates.goToBilling`)})]})}function rt(e){let{targets:t,fromSnapshot:n,machineFloor:r,credits:i}=e,a=[];return t.machineSize==null?r!=null&&n.machineSize!=null&&n.machineSize!==r&&a.push({key:`machine`,label:`Machine`,from:G[n.machineSize],to:G[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:G[n.machineSize],to:G[t.machineSize]}),t.storageGib!=null&&(n.storageGib==null||t.storageGib>n.storageGib)&&a.push({key:`storage`,label:`Storage`,from:n.storageGib==null?void 0:`${n.storageGib} GB`,to:`${t.storageGib} GB`}),i!=null&&a.push({key:`credits`,label:i.label??`Credits`,from:i.from,to:i.to}),a}var it=60,at=it*2;function ot({imageUrl:e,animateIn:t=!0}){return(0,J.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,J.jsx)(`img`,{src:e,alt:``,decoding:`async`,draggable:!1,className:`absolute left-1/2 top-1/2 max-w-none -translate-x-1/2 -translate-y-1/2 object-cover object-center`,style:{filter:`blur(${it}px)`,width:`calc(100% + ${at*2}px)`,height:`calc(100% + ${at*2}px)`}}),(0,J.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function st(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function ct(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function lt(e){let t=F(),{data:n}=I({...p(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function ut(e,t){return t==null?0:st(e,t)?.credits_usd??ct(t)}function dt(e,t){return t==null?null:st(e,t)?.label}function ft(e){let t=lt(e!=null);if(e==null||t==null)return null;let n,r;if(e.kind===`package`){let i=t.packages.find(t=>t.key===e.packageKey),a=st(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=st(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function pt(e){let t=lt(e!=null);return e==null||ut(t,e.fromTier)==null||ut(t,e.toTier)==null?null:{fromLabel:dt(t,e.fromTier),toLabel:dt(t,e.toTier)}}function mt(e){let t=ce.use.activeAssistantId(),n=e===void 0?t:e,{components:r,traits:i,customImageUrl:a,state:o,isLoading:s}=A(n),c=(0,q.useMemo)(()=>N(),[P()]),l=c!=null&&D(c)?c:null,u=n!=null&&!s,d=l!=null&&(n==null||n===l.assistantId),f=d&&!(u&&(r!=null||i!=null||a!=null))?l:null,p=f?f.components:r,m=f?f.traits:i,g=f?null:a,_=u||d,v=ee({state:f?null:o,components:p,traits:m,customImageUrl:g})??(g?null:M[0]?.hex??null);return{tintHex:_&&v?de(v):h,backdropImageUrl:_?g:null,ready:_,avatar:{components:p,traits:m,customImageUrl:g}}}function ht(e,t){let[n,r]=(0,q.useState)(e),i=(0,q.useRef)(0);return(0,q.useEffect)(()=>{i.current=performance.now()},[]),(0,q.useEffect)(()=>{if(t<=0||e===n)return;let a=t-(performance.now()-i.current);if(a<=0){i.current=performance.now(),r(e);return}let o=setTimeout(()=>{i.current=performance.now(),r(e)},a);return()=>clearTimeout(o)},[e,n,t]),t<=0?e:n}var gt=`--takeover-surface`,_t=`var(${gt},${h})`,vt=`color-mix(in srgb, var(--content-emphasised) 10%, transparent)`,yt=240,bt=1.414,xt=[{minHeight:680,size:yt},{minHeight:600,size:184}],St=132;function Ct(e){for(let t of xt)if(e>=t.minHeight)return t.size;return St}function wt(){let[e,t]=(0,q.useState)(()=>Ct(typeof window>`u`?1/0:window.innerHeight));return(0,q.useEffect)(()=>{let e=()=>t(Ct(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Tt={machine:H,storage:U,credits:B},Et={idle:``,working:` is-working`,settling:` is-settling`,stalled:` is-stalled`,grown:` is-evolved`};function Dt(e,t){return e===`DONE`||e===`NOT_APPLICABLE`?`grown`:e===`STALLED`?`stalled`:e===`WAITING`||e===`RESIZING`?t?`settling`:`working`:`idle`}function Ot({assistantId:e,mode:t,downsizing:n=!1}){let{avatar:r,ready:i}=mt(e),a=c(),o=wt(),s=t===`working`||t===`settling`;return(0,J.jsxs)(`div`,{"aria-hidden":!0,className:`provision-avatar-evolve relative z-10 flex flex-col items-center${Et[i?t:`idle`]}${n?` is-downsizing`:``}`,style:{"--provision-avatar-size":`${o}px`,"--provision-avatar-growth":bt},children:[(0,J.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,J.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,J.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,J.jsx)(`div`,{className:`provision-avatar-current`,children:(0,J.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,J.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,J.jsx)(k,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,J.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function kt({status:e,caption:t}){return(0,J.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,J.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:Le,children:e}),t&&(0,J.jsx)(d,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function At({icon:e,label:t,from:n,to:r,done:i=!1,pending:a=!1,testId:o}){let{t:s}=R(`settings`),c=null;return i?c=s(`provisioningState.statusComplete`):a&&(c=s(`provisioningState.statusPending`)),(0,J.jsxs)(`div`,{"data-testid":o,className:`flex min-w-0 flex-auto items-center gap-2 rounded-lg px-2 py-1.5${a?` opacity-70`:``}`,style:{backgroundColor:vt},children:[(0,J.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,J.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,J.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,J.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(`span`,{children:n}),(0,J.jsx)(`span`,{className:`sr-only`,children:s(`provisioningState.srOnlyTo`)}),(0,J.jsx)(xe,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,J.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,J.jsx)(`span`,{children:r}),i?(0,J.jsx)(Ce,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,J.jsx)(V,{"data-testid":`chip-spinner`,className:`h-3.5 w-3.5 shrink-0 animate-spin text-[var(--content-tertiary)] motion-reduce:animate-none`,"aria-hidden":`true`})]}),c&&(0,J.jsx)(`span`,{className:`sr-only`,children:c})]})]})]})}function jt({label:e}){return(0,J.jsx)(`span`,{className:`rounded-lg px-3 py-2 text-[14px] text-[var(--content-emphasised)]`,style:{backgroundColor:vt},children:e})}function Mt({children:e,wide:t=!1,testId:n}){return(0,J.jsx)(`div`,{"data-testid":n,className:`flex w-full ${t?`max-w-2xl`:`max-w-sm`} items-stretch justify-center gap-2`,children:e})}function Nt(e,t){return e===`credits`?!0:t?.[e]===!0}function Pt(e,t){if(e==null)return null;let n=t(`provisioningState.noExtraUsage`),r=e.toLabel===null?n:e.toLabel;return r==null?null:{label:t(`provisioningState.usageLabel`),from:e.fromLabel===null?n:e.fromLabel,to:r}}function Ft({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=R(`settings`),l=ft(e),u=pt(t),d=rt({targets:n,fromSnapshot:r,machineFloor:i,credits:Pt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||Nt(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,q.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(Mt,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||Nt(e.key,a);return(0,J.jsx)(At,{testId:`chip-${e.key}`,icon:Tt[e.key],label:e.label,from:e.from,to:e.to,done:t,pending:!t},e.key)})}),(0,J.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function It({intent:e}){let{t}=R(`settings`),n=ft(e.kind===`custom`?e:null);if(e.kind===`package`)return(0,J.jsx)(Mt,{children:(0,J.jsx)(jt,{label:t(`provisioningState.packageChip`,{name:e.packageKey.charAt(0).toUpperCase()+e.packageKey.slice(1)})})});let r=[e.machineTier,e.storageTier,e.creditTier].filter(e=>e!=null).length;return(0,J.jsxs)(Mt,{wide:r>=3,children:[e.machineTier!=null&&(0,J.jsx)(At,{icon:H,label:t(`provisioningState.machineLabel`),to:De[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,J.jsx)(At,{icon:U,label:t(`provisioningState.storageLabel`),to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&(0,J.jsx)(jt,{label:n.toLabel})]})}function Lt({state:e,direction:t,softWaiting:n,intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,celebrating:l,onCelebrationEnd:u,assistantId:d,escapeAvailable:f,onEscape:p,onPhaseChange:m,kickError:h,confirm:g,dwellMs:_=Ke,phaseMinMs:v=900}){let{t:y}=R(`settings`),x=Z(t),S=(0,q.useRef)(u);(0,q.useEffect)(()=>{S.current=u},[u]);let C=ht(e,v),w=C===`DONE`||C===`NOT_APPLICABLE`,T=C===`RESIZING`?`WAITING`:C,E=(0,q.useRef)(m);(0,q.useEffect)(()=>{E.current=m},[m]),(0,q.useEffect)(()=>{E.current?.(C)},[C]);let{tintHex:D,backdropImageUrl:O}=mt(d),k=l&&w;return(0,q.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>S.current(),_);return()=>clearTimeout(e)},[k,_]),(0,J.jsxs)(`div`,{"data-theme":`dark`,className:`provision-surface-settle relative flex h-full min-h-[420px] w-full flex-col items-center [justify-content:safe_center] gap-10 px-6 py-10 text-center`,style:{[gt]:D,backgroundColor:_t},children:[O&&(0,J.jsx)(ot,{imageUrl:O}),(0,J.jsx)(Ot,{assistantId:d,mode:Dt(C,n),downsizing:t===`downgrade`}),(0,J.jsx)(`div`,{className:`relative z-10 flex min-h-[144px] w-full flex-col items-center gap-8 [animation:onboarding-step-in_420ms_ease-out] motion-reduce:[animation:none]`,children:ee()},T)]});function A(e=y(`provisioningState.continueInBackground`)){return f?(0,J.jsx)(b,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:p,children:e}):null}function j({allDone:e=!1,creditsOnly:t=!1}={}){return(0,J.jsx)(Ft,{intent:r,creditsChange:i,targets:a,fromSnapshot:o,machineFloor:s,landed:c,allDone:e,creditsOnly:t})}function ee(){if(C===`CONFIRMING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:x.confirmingStatus,caption:y(`provisioningState.confirmingCaption`)}),r&&(0,J.jsx)(It,{intent:r}),A()]});if(C===`WAITING`||C===`RESIZING`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:x.waitingStatus,caption:y(n?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),j(),A()]});if(C===`DONE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:y(`provisioningState.allDoneStatus`)}),j({allDone:!0})]});if(C===`NOT_APPLICABLE`)return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:y(`provisioningState.planReadyStatus`)}),j({allDone:!0,creditsOnly:!0})]});if(C===`STALLED`){let e=h!=null;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:e?x.snagStatus:y(`provisioningState.takingLongerStatus`),caption:e?Qe(h,x.snagCaption,t):y(`provisioningState.stalledCaption`)}),j(),e?A(y(`provisioningState.retryInBackground`)):A()]})}return C===`CONFIRM_TIMEOUT`?(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(kt,{status:x.confirmTimeoutStatus,caption:x.confirmTimeoutCaption}),(0,J.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,J.jsx)(b,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:g.onGoToBilling,children:y(`provisioningState.goToBilling`)}),(0,J.jsx)(b,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:g.onRetry,children:y(`provisioningState.tryAgain`)})]})]}):null}}function Rt(e){let{planId:t,targets:n,actuals:r,initialActuals:i,resizeOperationInFlight:a,sawOperation:o,msSinceWatchStart:s,confirmExpired:c,serverVerdict:l=null,statusObservedSinceTargetsMet:u=!0,targetsProveNoop:d=!0}=e;if(t!==`pro`)return{state:c?`CONFIRM_TIMEOUT`:`CONFIRMING`,softWaiting:!1};let f=o||a,p=l===`started`||l===`in_progress`,m=o||d&&u;if(!a){let e=p?m:f||l===`already_done`||i!=null&&!Ae(n,i);if(Ae(n,r)){if(e)return{state:`DONE`,softWaiting:!1};if(!p&&(d||l===`not_applicable`))return{state:`NOT_APPLICABLE`,softWaiting:!1}}else{if(l===`already_done`)return{state:`DONE`,softWaiting:!1};if(l===`not_applicable`)return{state:`NOT_APPLICABLE`,softWaiting:!1}}}return s!=null&&s>=9e4?{state:`STALLED`,softWaiting:!1}:f||l===`started`||l===`in_progress`?{state:`RESIZING`,softWaiting:!1}:{state:`WAITING`,softWaiting:s!=null&&s>=3e4}}var zt=2e3,Bt=1e3,Vt=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Ht={assistantId:null,machine:null,storage:null};function Ut({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Je}){let r=L(),i=F(),[o,c]=(0,q.useState)(!1),[l,d]=(0,q.useState)(0),[f,p]=(0,q.useState)(null),[m,h]=(0,q.useState)(null),[g,_]=(0,q.useState)(null),[v,b]=(0,q.useState)(null),[S,w]=(0,q.useState)(null),[T,E]=(0,q.useState)(null),[D,O]=(0,q.useState)(Ht),[k,A]=(0,q.useState)(null),[ee,M]=(0,q.useState)(!1),te=(0,q.useRef)(!1),ne=(0,q.useRef)(!1),N=(0,q.useRef)(0),[re,ie]=(0,q.useState)(!1),[ae,oe]=(0,q.useState)(null),[P,ce]=(0,q.useState)(null),[ue,de]=(0,q.useState)(null),[fe,R]=(0,q.useState)(()=>Date.now()),[ge,_e]=(0,q.useState)(!0);(0,q.useEffect)(()=>{e||(c(!1),d(0),p(null),h(null),_(null),ie(!1),oe(null),ce(null),de(null),_e(!0),b(null),w(null),E(null),O(Ht),A(null),M(!1),te.current=!1,ne.current=!1,N.current+=1)},[e]),(0,q.useEffect)(()=>{e&&(p(Date.now()),r.invalidateQueries({queryKey:s()}),r.invalidateQueries({queryKey:y()}))},[e,r]);let z=m!=null,ve=I({...C(),refetchInterval:e=>e.state.data?.plan_id===`pro`||o?!1:We,refetchIntervalInBackground:!1,enabled:e&&i&&!z}),ye=(f!=null&&ve.dataUpdatedAt>=f?ve.data?.plan_id:null)??null;(0,q.useEffect)(()=>{if(!e||z||ye!==`pro`)return;let t=Date.now();h(t),R(t)},[e,z,ye]),(0,q.useEffect)(()=>{if(!e||z)return;let t=setTimeout(()=>c(!0),Ge);return()=>clearTimeout(t)},[e,z,l]);let be=(0,q.useCallback)(()=>{c(!1),d(e=>e+1),a.getState().fetchOrganizations(),r.invalidateQueries({queryKey:s()})},[r]),xe=(0,q.useCallback)(()=>{let e=Date.now();_(e),R(e)},[]),{mutate:Se}=pe(x()),B=(0,q.useCallback)(e=>{let t=N.current;Se({},{onSuccess:n=>{t===N.current&&(A(null),Me(n)?ne.current?A({error:n.reason??`no_active_pro`}):(ne.current=!0,M(!0),e===`escape`&&xe()):(b(n.state),e===`escape`&&xe()))},onError:e=>{t===N.current&&A(e)}})},[Se,xe]);(0,q.useEffect)(()=>{!e||!i||!z||te.current||(te.current=!0,B(`auto`))},[e,i,z,B]),(0,q.useEffect)(()=>{if(!ee)return;let e=N.current,t=setTimeout(()=>{M(!1),e===N.current&&B(`auto`)},qe);return()=>clearTimeout(t)},[ee,B]);let Ce=(0,q.useCallback)(()=>B(`escape`),[B]),V=I({...u(),enabled:e&&i&&z}),H=ge?zt:!1,we=I({...le(),enabled:e&&i&&z,refetchInterval:e=>e.state.data?.id==null?H:!1,retry:!1}),U=z&&f!=null&&V.dataUpdatedAt>=f,Te=U&&!V.isPending&&!V.isFetching,W=(U?V.data?.primary_assistant_id:null)??(V.isPending?null:we.data?.id??null),G=I({...j({path:{id:W??`unresolved`}}),enabled:e&&i&&z&&W!=null,refetchInterval:H,retry:!1}),De=se({path:{id:W??`unresolved`}}),Oe=I({...De,enabled:e&&i&&z&&W!=null,refetchInterval:H,retry:!1}),Fe=(0,q.useRef)(0),[J,Ie]=(0,q.useState)(0),Le=he(De.queryKey);(0,q.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==Le)){if(t.action.type===`fetch`)Fe.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=Fe.current,r=e&&Ne(t.action.data);me.schedule(()=>{Ie(n),r&&(ie(!0),oe(W))})}}}),[r,Le,e,W]);let Re=Ne(Oe.data),ze=ae===W,Y=V.data,X=(0,q.useMemo)(()=>Y?{machineSize:Ee(Y.max_machine_tier),storageGib:Y.selected_storage_gib??null}:null,[Y]),Be=Y!=null&&Y.max_machine_tier==null?ke:null,Ve=Y?Y.domain_setup_available&&Y.primary_assistant_id!=null:void 0,He=G.data,Z=(0,q.useMemo)(()=>He?{machineSize:He.machine_size??null,storageGib:He.provisioned_storage_gib??null}:null,[He]),Q=ue===W,$=(0,q.useMemo)(()=>{let e=Pe(X,Z),t=X?.machineSize??Be;if(t==null)return e;let n=Z?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Q?P?.machineSize:null)??n,i=K(t)<K(r);return{...e,machine:i?K(n)<=K(t):K(n)>=K(t)}},[X,Z,P,Q,Be]),Ue=Ae(X,Z),Ke=T===W;(0,q.useEffect)(()=>{e&&(Ue?(w(e=>e!=null&&Ke?e:Date.now()),E(W)):(w(null),E(null)))},[e,Ue,W,Ke]);let Ye=D.assistantId===W;(0,q.useEffect)(()=>{if(!e)return;let t=Fe.current;O(e=>{let n=e.assistantId===W?e:Ht,r=$.machine?n.machine??t:null,i=$.storage?n.storage??t:null;return e.assistantId===W&&e.machine===r&&e.storage===i?e:{assistantId:W,machine:r,storage:i}})},[e,$,W]);let Xe=(0,q.useMemo)(()=>{let e=je(Oe.data),t=e=>e!=null&&Ye&&J>e;return{machine:$.machine&&!e.machine&&t(D.machine),storage:$.storage&&!e.storage&&t(D.storage)}},[$,D,Ye,J,Oe.data]);(0,q.useEffect)(()=>{!e||!Z||P!=null&&Q||(ce(Z),de(W))},[e,Z,W,P,Q]);let Ze=g??m,Qe=Ze==null?null:Math.max(0,fe-Ze),$e=!t,{state:et,softWaiting:tt}=Rt({planId:z?`pro`:ye,targets:X,actuals:Z,initialActuals:Q?P:null,resizeOperationInFlight:Re,sawOperation:re&&ze,msSinceWatchStart:Qe,confirmExpired:o,serverVerdict:v,statusObservedSinceTargetsMet:S!=null&&Ke&&Oe.dataUpdatedAt>S,targetsProveNoop:$e}),nt=Vt.includes(et),rt=e&&z&&!nt;(0,q.useEffect)(()=>{_e(rt)},[rt]),(0,q.useEffect)(()=>{if(!e||!z||nt)return;let t=setInterval(()=>R(Date.now()),Bt);return()=>clearInterval(t)},[e,z,nt]);let it=!$e&&(v===`started`||v===`in_progress`)&&!(re&&ze);return(0,q.useEffect)(()=>{if(!e||!z||nt||!it)return;let t=setInterval(()=>B(`auto`),n);return()=>clearInterval(t)},[e,z,nt,it,n,B]),{state:et,softWaiting:tt,targets:X,actualsSnapshot:P,machineFloor:Be,landed:Xe,assistantId:W,domainStepAvailable:Ve,onboardingSettled:Te,confirmError:!z&&ve.isError,targetsError:z&&V.isError&&(!Y||!U),escapeEligible:Qe!=null&&Qe>=6e4,retryConfirm:be,kickProvisioning:Ce,kickError:k}}var Wt=200,Gt=380;function Kt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var qt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Jt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Yt={machineSize:null,storageGib:null};function Xt({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:a=`checkout`,resizeContext:s}){let{t:c}=R(`settings`),l=a===`resize`,u=L(),[d,f]=(0,q.useState)(`provisioning`),[p,m]=(0,q.useState)(`idle`),h=(0,q.useRef)([]),[_,y]=(0,q.useState)(null),[b,x]=(0,q.useState)(null),[S,C]=(0,q.useState)(null),[w,T]=(0,q.useState)(!1),E=l?s?.direction:void 0,D=Z(E),O=Ut({open:e,canLowerResources:l?s?.canLowerResources===!0:!1}),k=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(e){k.current=!0,y(l?null:te()),C(e=>e??Date.now());return}h.current.forEach(clearTimeout),h.current=[],f(`provisioning`),m(`idle`),x(null),C(null),T(!1),k.current&&(k.current=!1,ne())},[e,l]),(0,q.useEffect)(()=>()=>{h.current.forEach(clearTimeout)},[]),(0,q.useEffect)(()=>{d===`complete`&&ie()},[d]);let A=qt(O.state),j=Jt(b??O.state),{targets:ee,assistantId:M,domainStepAvailable:N,onboardingSettled:re}=O,ae=l?s?.fromSnapshot:void 0,oe=O.actualsSnapshot,se={machineSize:ae?.machineSize??oe?.machineSize??null,storageGib:ae?.storageGib??oe?.storageGib??null},{tintHex:P,backdropImageUrl:ce}=mt(M),F=l&&N===!0,{domains:le,domainsError:ue,domainsFetching:de,domainsUpdatedAt:fe,domainsErrorUpdatedAt:pe}=Ue(e&&F,M),I=(le?.results.length??0)>0,me=(0,q.useRef)(null);(0,q.useEffect)(()=>{if(!e){me.current=null;return}!F||M==null||me.current!==M&&(me.current=M,u.invalidateQueries({queryKey:o({path:{assistant_id:M}})}))},[e,F,M,u]);let he=!de&&(S!=null&&fe>=S||S!=null&&!!ue&&pe>=S),[ge,_e]=(0,q.useState)(!1),z=re&&(!F||he);(0,q.useEffect)(()=>{if(!e){_e(!1);return}z&&_e(!0)},[e,z]);let ve=(0,q.useCallback)(()=>{let e=l?N===!0&&!I?`domain`:`complete`:N===!1?`complete`:`domain`;if(Kt()){f(e);return}m(`covering`),h.current.push(setTimeout(()=>{f(e),m(`revealing`),h.current.push(setTimeout(()=>m(`idle`),Gt))},Wt))},[N,l,I]),ye=(0,q.useCallback)(()=>{T(!0)},[]),be=(0,q.useCallback)(()=>{O.kickProvisioning(),i.info(O.kickError==null?D.backgroundExitToast:D.backgroundRetryToast),T(!1),t()},[O,t,D]),xe=(0,q.useCallback)(()=>{T(!1)},[]),Se=d===`provisioning`&&(O.confirmError||O.targetsError),B=d===`provisioning`&&!Se,Ce=B&&!j,V=`transition-[background-color] duration-300 ease-out${B?` bg-black p-0`:``}`,H=B?`[animation:fadeIn_0.45s_ease-out_both]`:p===`revealing`?`[animation:fadeInUp_0.42s_ease-out_0.12s_both]`:`[animation:fadeIn_0.25s_ease-out_both]`;return(0,J.jsxs)(J.Fragment,{children:[(0,J.jsx)(v.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,J.jsxs)(v.Content,{size:`md`,hideCloseButton:d!==`complete`,dismissOnOverlayClick:!Ce,onEscapeKeyDown:Ce?e=>e.preventDefault():void 0,onInteractOutside:Ce?e=>e.preventDefault():void 0,"data-theme":B?`dark`:void 0,overlayClassName:V,className:B?`overflow-y-auto inset-0 max-w-none w-screen h-screen max-h-none rounded-none border-0`:`overflow-hidden`,style:{[gt]:P},children:[(0,J.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${H}`,children:we()},d),p!==`idle`&&(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":`takeover-exit-sheet`,className:`pointer-events-none fixed inset-0 z-50 ${p===`covering`?`[animation:fadeIn_200ms_ease-in_both]`:`[animation:fadeIn_380ms_ease-out_both_reverse]`}`,style:{backgroundColor:_t},children:ce&&(0,J.jsx)(ot,{imageUrl:ce,animateIn:!1})})]})}),(0,J.jsx)(g,{open:w&&A,title:c(`billingOnboardingModal.backgroundConfirmTitle`),message:D.backgroundConfirmMessage,confirmLabel:c(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:c(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:be,onCancel:xe})]});function we(){return d===`provisioning`?O.confirmError||O.targetsError?(0,J.jsx)(nt,{onGoToBilling:t,direction:E}):(0,J.jsx)(Lt,{state:O.state,direction:E,softWaiting:O.softWaiting,intent:_,creditsChange:l?s?.credits:void 0,targets:ee??Yt,fromSnapshot:se,machineFloor:O.machineFloor,landed:O.landed,celebrating:ge,onCelebrationEnd:ve,assistantId:M,escapeAvailable:A&&O.escapeEligible,onEscape:ye,onPhaseChange:x,kickError:O.kickError,confirm:{onRetry:O.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):d===`domain`?(0,J.jsx)(tt,{machineBusy:A,assistantId:M,onExit:()=>f(`complete`)}):(0,J.jsx)($,{assistantId:M,direction:E})}}function Zt(e){return e!=null&&!e.customized}function Qt(e){return Zt(e)?e.name:`Custom`}var $t=[`mighty`,`super`,`ultra`],en=[`free`,...$t];function tn(e){return en.indexOf(e)}function nn(e,t){if(e===null)return`upgrade`;let n=tn(e),r=tn(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function rn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>$t.indexOf(e.key)-$t.indexOf(t.key));if(!t)return n[0];let r=n.findIndex(e=>e.key===t);return r===-1?n[0]:r>=n.length-1?null:n[r+1]}var an={free:{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},mighty:{bodyShape:`blob`,eyeStyle:`grumpy`,color:`green`},super:{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},ultra:{bodyShape:`sprout`,eyeStyle:`curious`,color:`orange`}};function on({tier:e,size:t=40}){let n=an[e]??an.free,r=c();return(0,J.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,J.jsx)(w,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,J.jsx)(`div`,{style:{width:t,height:t}})})}var sn={free:{tagline:`Get to know your assistant.`,cta:`Start Free`,priceCaption:`Forever`},mighty:{tagline:`More capacity for consistent use.`,cta:`Power Up`,priceCaption:`Billed monthly`,recommended:!0},super:{tagline:`Do more, think less about the how.`,cta:`Go Super`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]},ultra:{tagline:`Your second brain, running full speed.`,cta:`Unleash Ultra`,priceCaption:`Billed monthly`,extraFeatures:[`Assistant email and subdomain`]}};function cn(e){return sn[e]}function ln(e){return`Downgrade to ${e}`}function un(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function dn(e){return`${un(e)}/mo`}function fn(e){return`${un(e)}/month`}function pn(e){return`${e>0?`+`:`−`}${un(Math.abs(e))}/mo`}function mn(e){return`${e} GB storage`}function hn(e){return`${un(e*100)} of bundled credits`}var gn=`Small`;function _n(e){return e?.machine_size?G[e.machine_size]??e.machine_size:gn}function vn(e,t){let n=cn(e.key)?.extraFeatures??[];return[{icon:Fe,label:`${_n(e)} Machine`},{icon:U,label:`${e.storage_gib} GB Storage`},{icon:B,label:t,ownRow:!0},...n.map(e=>({icon:Te,label:e,ownRow:!0}))]}function yn(){return[{icon:Fe,label:`${gn} Machine`},{icon:U,label:`4 GB Storage`},{icon:B,label:`Pay as you go credits`,ownRow:!0}]}function bn(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Oe[e?.machine_size??`small`];return[`${_n(e)} machine${i?` (${i})`:``}`,mn(r),e?.usage_label??hn(n),...t]}var xn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Sn(e,t){let n=[`${e.machineTier?De[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:gn} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=st(t,e.creditTier)?.label,i=ct(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function Cn(e,t){let n=new Set([xn.machine]);return e.storageGib!=null&&n.add(xn.storage),e.creditTier!=null&&n.add(xn.credits),[...Sn(e,t),...t.included_features.filter(e=>!n.has(e))]}function wn(e){return e.disabled===!0}function Tn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:a,currentMachinePriceCents:o,currentStoragePriceCents:s}){let{t:c}=R(`settings`),l=(0,q.useMemo)(()=>e.map(e=>{let t=De[e.tier]??e.label,n=o==null?c(`tierPicker.priceAddon`,{price:dn(e.price_cents)}):e.price_cents===o?c(`tierPicker.priceCurrent`,{price:dn(e.price_cents)}):pn(e.price_cents-o);return{value:e.tier,label:c(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:wn(e)}}),[e,o,c]),u=(0,q.useMemo)(()=>t.map(e=>{let t=s==null?c(`tierPicker.priceAddon`,{price:dn(e.price_cents)}):e.price_cents===s?c(`tierPicker.priceCurrent`,{price:dn(e.price_cents)}):pn(e.price_cents-s);return{value:e.tier,label:c(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:wn(e)}}),[t,s,c]);return(0,J.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(d,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.machineLabel`)}),(0,J.jsx)(`span`,{title:c(`tierPicker.machineTooltip`),children:(0,J.jsx)(we,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(ae,{"aria-label":c(`tierPicker.machineAriaLabel`),placeholder:c(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:l})]}),(0,J.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,J.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(d,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:c(`tierPicker.storageLabel`)}),(0,J.jsx)(`span`,{title:c(`tierPicker.storageTooltip`),children:(0,J.jsx)(we,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,J.jsx)(ae,{"aria-label":c(`tierPicker.storageAriaLabel`),placeholder:c(`tierPicker.storagePlaceholder`),value:r??``,onChange:a,options:u})]})]})}var En=new Set([`active`,`trialing`,`past_due`]);function Dn(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&En.has(e.status)}function On(e){return e?.status!=null&&En.has(e.status)}var kn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function An(e,t){if(e&&typeof e==`object`){for(let t of kn)if(t in e){let n=e[t];if(Array.isArray(n)&&typeof n[0]==`string`)return n[0]}if(`detail`in e&&typeof e.detail==`string`)return e.detail}return t}function jn(e,t){let n=e.filter(e=>!wn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Mn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Nn(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Pn(){let e=L();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:s()}),t.onSuccess(n),n}catch(e){return i.error(An(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Fn=`billing-portal-return-snapshot`;function In(e){try{sessionStorage.removeItem(Fn),sessionStorage.setItem(Fn,JSON.stringify(e))}catch{}}function Ln(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Fn);if(!e)return null;let t=JSON.parse(e);return typeof t.cancel_at_period_end!=`boolean`||typeof t.plan_id!=`string`?null:{cancel_at_period_end:t.cancel_at_period_end,cancel_at:t.cancel_at??null,plan_id:t.plan_id}}catch{return null}}function Rn(){try{sessionStorage.removeItem(Fn)}catch{}}function zn(e){return e?{cancel_at_period_end:e.cancel_at_period_end,cancel_at:e.cancel_at??null,plan_id:e.plan_id}:null}function Bn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Vn(e){return e?e.cancel_at??e.current_period_end??null:null}function Hn(e){let t=L();return(0,q.useEffect)(()=>E(()=>{t.invalidateQueries(C())}),[t]),O({onSuccess:t=>{e&&In(e),T(t.portal_url)},onError:()=>{i.error(fe(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function Un(){let e=re(),t=Pn();return{cancelSubscription:()=>t({mutateAsync:()=>e.mutateAsync({}),onSuccess:e=>{let t=e.cancel_at?Bn(e.cancel_at):fe(`settings:useCancelSubscription.endOfBillingPeriod`);i.info(fe(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>fe(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function Wn(e){return Promise.all([e.invalidateQueries({queryKey:s()}),e.invalidateQueries({queryKey:m()}),e.invalidateQueries({queryKey:y()}),e.invalidateQueries({queryKey:f()})])}function Gn({enabled:e=!0}={}){let t=L(),{t:n}=R(`settings`),[r,a]=(0,q.useState)(null),o=(0,q.useRef)(!1),[s,c]=(0,q.useState)(!1),l=F(),d=e&&l,f=I({...C(),enabled:d}),m=f.data,h=m!=null&&m.plan_id!==`base`,g=I({...u(),enabled:d&&h}),_=I({...p(),enabled:d&&h}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],v=e=>_.find(t=>t.tier===e)?.price_cents??null,y=pe(ue()),b={machineTier:g.data?.max_machine_tier??null,storageTier:g.data?.selected_storage_tier??null,storageGib:g.data?.selected_storage_gib??null,creditTier:m?.selected_credit_tier??null,hasPlatformFee:m?.has_platform_fee??!0},x=m!=null&&m.plan_id!==`base`&&m.status!=null&&En.has(m.status)&&m.cancel_at_period_end!==!0&&!m.cancel_at,S=!h||!g.isPending,w=!h||g.isSuccess&&g.data!=null&&!g.isFetching&&g.dataUpdatedAt>=f.dataUpdatedAt,T=s||y.isPending,E=async(e,t=b)=>{if(o.current)return null;o.current=!0,c(!0);try{return await D(e,t)}finally{o.current=!1,c(!1)}},D=async(e,r)=>{a(null);let o=e=>(a(e),i.error(e),null),[s,c]=await Promise.all([f.refetch(),g.refetch()]),l=s.data,u=c.data;if(s.isError||c.isError||l==null||u==null)return o(n(`customPlanModal.changeFailed`));let d={machineTier:u.max_machine_tier??null,storageTier:u.selected_storage_tier??null,storageGib:u.selected_storage_gib??null,creditTier:l.selected_credit_tier??null,hasPlatformFee:l.has_platform_fee??!0},p={machineTier:e.machineTier===r.machineTier?d.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&d.storageTier!=null?d.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?d.creditTier:e.creditTier},m=p.machineTier!==d.machineTier,h=p.storageTier!==d.storageTier,_=p.creditTier!==d.creditTier,b=!d.hasPlatformFee,x=v(p.machineTier),S=v(d.machineTier),C=m&&x!=null&&S!=null&&x<S;if(!m&&!h&&!_&&!b)return{needsResize:!1,creditChanged:!1};let w;try{w=(await y.mutateAsync({body:{machine_tier:p.machineTier,storage_tier:p.storageTier,credit_tier:p.creditTier}})).status}catch(e){return o(An(e,n(`customPlanModal.changeFailed`)))}return await Wn(t),w===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:h||m&&!C,creditChanged:_}};return{changeTiers:E,isPending:T,error:r,current:b,eligible:x,currentReady:S,currentKnown:w,primaryAssistantId:w?g.data?.primary_assistant_id??null:null}}function Kn(){let e=L(),{t}=R(`settings`),n=pe(ue());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await Wn(e),t}catch(e){return i.error(An(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function qn({className:e,"data-testid":t,children:n}){return(0,J.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:l(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var Jn=32;function Yn(){let{ready:e,avatar:t}=mt();return(0,J.jsx)(qn,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,J.jsx)(k,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:Jn}):null})}var Xn=`Billed monthly · prorated difference charged today`,Zn=`Billed monthly · prorated difference charged today or credited next invoice`,Qn=`Billed monthly · prorated credit on your next invoice`,$n=`Your machine downsizes now and your storage stays. No refund.`,er=`Continue`,tr=`The plan includes`,nr=`Your plan will include`;function rr(e,t,n){let r=n?cn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:ln(t),subtitle:``,priceCaption:Qn,checklistHeading:nr,note:$n,confirmLabel:ln(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:Zn,checklistHeading:tr,note:``,confirmLabel:er,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:Xn,checklistHeading:tr,note:``,confirmLabel:er,destructive:!1}}}function ir({open:e,relation:t,packageName:n,targetPackage:r,pending:i,onCancel:a,onConfirm:o}){let{t:s}=R(`settings`),c=(0,q.useRef)(null),l=(0,q.useId)(),u=rr(t,n,r?.key??null),f=r?{price:dn(r.total_price_cents),highlights:bn(r,cn(r.key)?.extraFeatures??[])}:null,p=u.subtitle,m=u.note?{"aria-describedby":l}:p?{}:{"aria-describedby":void 0};return(0,J.jsx)(v.Root,{open:e,onOpenChange:e=>{!e&&!i&&a()},children:(0,J.jsxs)(v.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),c.current?.focus()},...m,children:[(0,J.jsxs)(v.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[u.destructive?(0,J.jsx)(qn,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,J.jsx)(ve,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,J.jsx)(Yn,{}),(0,J.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,J.jsx)(v.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:u.title}),p?(0,J.jsx)(v.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:p}):null]})]}),f?(0,J.jsxs)(v.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,J.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,J.jsx)(d,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:f.price}),(0,J.jsx)(d,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:u.priceCaption})]}),(0,J.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,J.jsx)(d,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:u.checklistHeading}),(0,J.jsx)(`ul`,{className:`flex flex-col gap-2`,children:f.highlights.map(e=>(0,J.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,J.jsx)(Se,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,J.jsx)(d,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,u.note?(0,J.jsx)(d,{id:l,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:u.note}):null,(0,J.jsxs)(v.Footer,{className:`flex-col gap-4 p-0`,children:[(0,J.jsx)(b,{fullWidth:!0,variant:u.destructive?`danger`:`primary`,onClick:o,disabled:i,"data-testid":`confirm-package-switch-button`,children:u.confirmLabel}),(0,J.jsx)(b,{ref:c,fullWidth:!0,variant:`ghost`,onClick:a,disabled:i,children:s(`packageSwitchConfirmModal.cancel`)})]})]})})}function ar(){let e=L();(0,q.useEffect)(()=>E(()=>{Wn(e)}),[e])}export{dn as A,Xt as B,Cn as C,vn as D,_n as E,$t as F,Q as H,Zt as I,rn as L,mn as M,cn as N,pn as O,on as P,Qt as R,wn as S,yn as T,Fe as U,Ue as V,Dn as _,Wn as a,jn as b,Rn as c,Ln as d,Hn as f,On as g,An as h,Gn as i,fn as j,un as k,Bn as l,En as m,ir as n,Un as o,Pn as p,Kn as r,zn as s,ar as t,Vn as u,Nn as v,Sn as w,Tn as x,Mn as y,nn as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Bi as t,Li as n,Ui as r,Zr as i,zi as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Bi as t,Li as n,Ui as r,Zr as i,zi as a}from"./app-p4YU9h0P.js";import{x as o}from"./react-B9IgSVeK.js";var s=e(o(),1),c=.25;function l(e){e.style.transition=``,e.style.transform=``,e.style.willChange=``,e.style.opacity=``}function u({containerRef:e,onBack:o,enabled:u,navKey:d,prefetchHref:f}){let p=(0,s.useRef)(o);(0,s.useLayoutEffect)(()=>{p.current=o},[o]);let m=(0,s.useRef)(f);(0,s.useLayoutEffect)(()=>{m.current=f},[f]);let h=(0,s.useRef)(!1),g=(0,s.useRef)(new Set),_=(0,s.useRef)(!1),v=n.use.registerBackOwner(),y=n.use.unregisterBackOwner();(0,s.useEffect)(()=>{if(u)return v(),y},[u,v,y]),(0,s.useEffect)(()=>{_.current=!1;let t=g.current;return()=>{_.current=!0;for(let e of t)clearTimeout(e);t.clear();let n=e.current;n&&l(n)}},[e]);let b=(e,t)=>{let n=setTimeout(()=>{g.current.delete(n),_.current||e()},t);g.current.add(n)},x=(e,t)=>{e.style.transform=t===0?``:`translateX(${t}px)`},S=e=>{e.style.transition=`transform 200ms ${r}`,x(e,0);let t=()=>{e.removeEventListener(`transitionend`,t),l(e)};e.addEventListener(`transitionend`,t,{once:!0}),b(()=>l(e),250)},C=e=>{e.style.transition=`transform 150ms ${r}`,x(e,window.innerWidth);let t=!1,n=()=>{if(t||_.current)return;t=!0,e.removeEventListener(`transitionend`,n);let r=-(window.innerWidth*c);e.style.transition=`none`,e.style.transform=`translateX(${r}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,p.current(),b(()=>{h.current&&(h.current=!1,l(e))},400)};e.addEventListener(`transitionend`,n,{once:!0}),b(n,200)};t({enabled:u,onConfirm:()=>{i(m.current);let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(t,n)=>{let r=e.current;r&&x(r,a(t,n))},onCommit:()=>{let t=e.current;if(!t){p.current();return}C(t)},onCancel:t=>{let n=e.current;n&&(t?S(n):l(n))}}),(0,s.useLayoutEffect)(()=>{if(!h.current)return;h.current=!1;let t=e.current;if(!t)return;let n=!1,i=()=>{n||(n=!0,t.removeEventListener(`transitionend`,i),l(t))};t.style.transition=`transform 200ms ${r}, opacity 200ms ${r}`,t.style.transform=``,t.style.opacity=``,t.addEventListener(`transitionend`,i,{once:!0});let a=setTimeout(i,250);return()=>{clearTimeout(a),t.removeEventListener(`transitionend`,i),l(t)}},[d,e])}export{u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Vm as t,_i as n,vi as r,yi as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Vm as t,_i as n,vi as r,yi as i}from"./app-p4YU9h0P.js";import{x as a}from"./react-B9IgSVeK.js";var o=e(a(),1),s={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:`/`},c=new Set([`MetaLeft`,`MetaRight`,`ControlLeft`,`ControlRight`,`AltLeft`,`AltRight`,`ShiftLeft`,`ShiftRight`]),l=e=>{let t=e.code;return c.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:s[t]??null},u=(e,t=`macos`)=>{let n=l(e);if(n===null)return null;let r=[];return t===`windows`||t===`linux`?(e.ctrlKey&&r.push(`CmdOrCtrl`),e.metaKey&&r.push(`Super`)):(e.metaKey&&r.push(`CmdOrCtrl`),e.ctrlKey&&r.push(`Control`)),e.altKey&&r.push(`Alt`),e.shiftKey&&r.push(`Shift`),[...r,n].join(`+`)},d={macos:new Set([`Command`,`Cmd`,`CommandOrControl`]),windows:new Set([`Control`,`Ctrl`,`CommandOrControl`]),linux:new Set([`Control`,`Ctrl`,`CommandOrControl`])},f=(e,t=`macos`)=>{let n=d[t],r=e.split(`+`).map(e=>n.has(e)?`CmdOrCtrl`:e),i=r.pop()??``;return[...new Set(r)].sort().concat(i).join(`+`)},p=(e,t,n,r=`macos`)=>{if(n===``)return null;let i=f(n,r);return e.find(e=>e.key!==t&&e.accelerator!==``&&f(e.accelerator,r)===i)??null};function m(e){let a=e?.onBound,[s,c]=(0,o.useState)([]),[l,d]=(0,o.useState)(null),[f,m]=(0,o.useState)(null),h=(0,o.useCallback)(()=>{n().then(c)},[]);(0,o.useEffect)(()=>(h(),r(c)),[h]);let g=(0,o.useCallback)(()=>{d(null),m(null)},[]);return(0,o.useEffect)(()=>{if(l===null)return;let e=e=>{if(e.preventDefault(),e.stopPropagation(),e.code===`Escape`){g();return}let n=t()??`macos`,r=u(e,n);if(r===null)return;let o=p(s,l,r,n);if(o!==null){m({key:l,label:o.label});return}i(l,r).then(()=>{a?.(l),h()}).catch(()=>{h()}),g()};return window.addEventListener(`keydown`,e,!0),()=>window.removeEventListener(`keydown`,e,!0)},[l,s,a,h,g]),{catalog:s,recordingKey:l,conflict:f,startRecording:(0,o.useCallback)(e=>{m(null),d(e)},[]),stopRecording:g,resetHotkey:(0,o.useCallback)(e=>{let n=p(s,e,s.find(t=>t.key===e)?.defaultAccelerator??``,t()??`macos`);if(n!==null){d(null),m({key:e,label:n.label});return}g(),i(e,null).then(h)},[s,h,g]),removeHotkey:(0,o.useCallback)(e=>{g(),i(e,``).then(h)},[h,g])}}export{m as t};
|
package/dist/assets/{use-invite-link-dialog-B4f3yyUN.js → use-invite-link-dialog-BYTs8NpU.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cx as t,G_ as n,Go as r,Hx as i,Id as a,Ko as o,Nx as s,Qd as c,Qp as l,Rb as u,Tx as d,Ux as f,Vb as p,Xp as m,Yp as h,Zd as g,_,b as v,bd as y,e_ as b,ef as x,id as S,ih as C,n_ as w,nf as ee,r_ as T,t_ as E,tf as te,v as ne,x as D,xd as re,y as ie,zb as O}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cx as t,G_ as n,Go as r,Hx as i,Id as a,Ko as o,Nx as s,Qd as c,Qp as l,Rb as u,Tx as d,Ux as f,Vb as p,Xp as m,Yp as h,Zd as g,_,b as v,bd as y,e_ as b,ef as x,id as S,ih as C,n_ as w,nf as ee,r_ as T,t_ as E,tf as te,v as ne,x as D,xd as re,y as ie,zb as O}from"./app-p4YU9h0P.js";import{Jn as k,Zn as A,er as j,j as M}from"./vendor-DYOeoIwg.js";import{t as N,x as P}from"./react-B9IgSVeK.js";import{$n as F,ci as I,qi as L,qn as R}from"./icons-QG1KAFmx.js";import{t as z}from"./a2a-invite-D7Z1FvN-.js";var B=e(P(),1),V=N(),H=[`no_one`,`guardian_only`,`trusted_contacts`,`any_contact`,`strangers`],U=`trusted_contacts`,W=new Set([`platform`,`a2a`]),G=new Set([`vellum`,`whatsapp`]);function K(e){return G.has(e)}function q(e){return n=>{t.error(n instanceof Error?n.message:e)}}function J(e){return typeof e==`string`&&H.includes(e)}function Y(e){return W.has(e)}function X(e){return(e?.policies??[]).filter(e=>!Y(e.channelType)&&!K(e.channelType)).map(e=>({...e,policy:J(e.policy)?e.policy:`trusted_contacts`}))}async function Z(e,t,n,r){if(Y(t))throw new u(403,`Channel "${t}" is internal and is not user-configurable.`);let{data:i,error:a,response:o}=await S({path:{assistant_id:e,channel_type:t},body:{policy:n,note:r??null},throwOnError:!1});if(O(o,a,`Failed to save channel policy.`),!o.ok)throw new u(o.status,p(a,o,`Failed to save channel policy.`));if(!i?.policy)throw new u(500,`Gateway returned no policy in response.`);return i.policy}var ae=`0.10.0`;function Q(){return C(ae)}function oe(e){let t=e-Date.now();if(t<=0)return`Expired`;let n=Math.ceil(t/(1e3*60*60*24));return n===1?`Expires in 1 day`:`Expires in ${n} days`}function se({open:e,assistantId:t,onClose:r}){let{t:a}=M(),[o,c]=(0,B.useState)(!1),l=(0,B.useRef)(null),u=(0,B.useRef)(!1),p=k({...g({path:{assistant_id:t}})}),m=(0,B.useRef)(p.mutate);(0,B.useLayoutEffect)(()=>{m.current=p.mutate});let h=(0,B.useRef)(p.reset);(0,B.useLayoutEffect)(()=>{h.current=p.reset}),(0,B.useEffect)(()=>{e&&!u.current&&m.current({path:{assistant_id:t}}),u.current=e},[e,t]),(0,B.useEffect)(()=>()=>{l.current&&clearTimeout(l.current)},[]);let _=(0,B.useCallback)(()=>{h.current(),c(!1),l.current&&=(clearTimeout(l.current),null),r()},[r]),v=(0,B.useCallback)(e=>{n(e,{errorMessage:`Couldn't copy the invite link.`,onCopied:()=>{c(!0),l.current&&clearTimeout(l.current),l.current=setTimeout(()=>c(!1),2e3)}})},[]),y=p.isSuccess&&p.data.token?z({senderAssistantId:t,token:p.data.token}):``;return(0,V.jsx)(d.Root,{open:e,onOpenChange:e=>{e||_()},children:(0,V.jsxs)(d.Content,{size:`sm`,children:[(0,V.jsx)(d.Header,{children:(0,V.jsx)(d.Title,{children:a(`generateInviteLinkDialog.title`)})}),(0,V.jsx)(d.Body,{children:p.isPending?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,V.jsx)(R,{className:`h-4 w-4 animate-spin`}),a(`generateInviteLinkDialog.creating`)]}):p.isError?(0,V.jsxs)(`div`,{className:`space-y-3`,children:[(0,V.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:a(`generateInviteLinkDialog.createFailed`)}),(0,V.jsx)(f,{variant:`outlined`,onClick:()=>p.mutate({path:{assistant_id:t}}),children:a(`generateInviteLinkDialog.tryAgain`)})]}):p.isSuccess?(0,V.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,V.jsx)(i,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:a(`generateInviteLinkDialog.shareHint`)}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(s,{type:`text`,readOnly:!0,value:y,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>v(y),"aria-label":a(`generateInviteLinkDialog.copyAriaLabel`),className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-md border border-[var(--border-base)] hover:bg-[var(--surface-hover)]`,children:o?(0,V.jsx)(L,{className:`h-4 w-4`}):(0,V.jsx)(I,{className:`h-4 w-4`})})]}),p.data.expiresAt!=null&&(0,V.jsx)(i,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:oe(p.data.expiresAt)})]}):null}),(0,V.jsx)(d.Footer,{children:(0,V.jsx)(f,{variant:`outlined`,onClick:_,children:a(`generateInviteLinkDialog.done`)})})]})})}function ce({onClick:e}){let{t}=M();return(0,V.jsx)(f,{variant:`outlined`,size:`compact`,leftIcon:(0,V.jsx)(F,{className:`h-3.5 w-3.5`}),onClick:e,children:t(`shareConnectionLinkButton.label`)})}function le(e){let t=j(),n=Q(),i=(0,B.useMemo)(()=>({path:{assistant_id:e}}),[e]),a=(0,B.useMemo)(()=>o(i),[i]),s=A({...r(i),enabled:n,select:X}),c=(0,B.useMemo)(()=>{let e={};for(let t of s.data??[])m(t.channelType)&&(e[t.channelType]=t.policy);return e},[s.data]),l=k({mutationFn:({channelKey:t,policy:n})=>Z(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:a}),onError:q(`Failed to save channel policy`)}),u=(0,B.useCallback)((e,t)=>{l.mutate({channelKey:e,policy:t})},[l]);return n?{policies:c,savingKey:l.isPending?l.variables?.channelKey??null:null,isLoading:s.isPending,isError:s.isError,onChange:u}:{policies:void 0,savingKey:null,isLoading:!1,isError:!1,onChange:void 0}}var ue=`0.11.5-dev.202608242314.38e0513`;function de(){return C(ue)}var fe=`0.11.5-dev.202608252008.65007aa`;function pe(){return C(fe)}var $={slack:E,telegram:w,discord:b,email:void 0,phone:T},me={slack:`useAssistantChannels.setupPrompt.slack`,telegram:`useAssistantChannels.setupPrompt.telegram`,discord:`useAssistantChannels.setupPrompt.discord`,email:`useAssistantChannels.setupPrompt.email`,phone:`useAssistantChannels.setupPrompt.phone`},he={slack:`useAssistantChannels.finishPrompt.slack`,telegram:`useAssistantChannels.finishPrompt.telegram`,discord:`useAssistantChannels.finishPrompt.discord`,email:`useAssistantChannels.finishPrompt.email`,phone:`useAssistantChannels.finishPrompt.phone`},ge=15e3;function _e({assistantId:e,onStartSetupConversation:t}){let{t:n}=M(`common`),r=j(),i=(0,B.useMemo)(()=>({path:{assistant_id:e}}),[e]),a=(0,B.useMemo)(()=>re(i),[i]),o=de(),s=pe(),l=(0,B.useMemo)(()=>ve(o),[o]),u=A({...y(i),enabled:!!e,refetchInterval:ge,select:e=>e.snapshots}),d=(0,B.useMemo)(()=>ye(u.data??[],l,s),[u.data,l,s]),f=d.some(e=>e.key===`slack`&&e.configured),p=A({...x(i),enabled:f,select:e=>e.threadMode}),m=le(e),h=(0,B.useCallback)(()=>r.invalidateQueries({queryKey:a}),[r,a]),g=k({mutationFn:async t=>{let n=$[t];if(!n)throw Error(`No route clears ${t} credentials.`);await n({path:{assistant_id:e},throwOnError:!0})},onSettled:(t,n,i)=>{h(),i===`slack`&&D(r,e)}}),b=ne({assistantId:e}),S=ie({assistantId:e}),C=A({...c(i),enabled:!!e&&s}),w=v({assistantId:e}),T=_({assistantId:e}),E=k({...ee(),onSuccess:()=>{r.invalidateQueries({queryKey:te(i)})}}),O=S.mutate,N=(0,B.useCallback)(e=>{O(e)},[O]),P=b.mutate,F=(0,B.useCallback)(e=>{P(e)},[P]),I=w.mutate,L=(0,B.useCallback)((e,t)=>{I({botToken:e,appToken:t})},[I]),R=E.mutate,z=(0,B.useCallback)(t=>{R({path:{assistant_id:e},body:{threadMode:t}})},[R,e]),V=T.mutateAsync,H=(0,B.useCallback)(async(e,t)=>{await V({accountSid:e,authToken:t})},[V]),U=(0,B.useCallback)((e,r=!1)=>{t&&t(n(r?he[e]:me[e]))},[t,n]),W=g.mutate,G=(0,B.useCallback)(e=>{W(e)},[W]);return{channels:d,pendingChannelKey:g.isPending?g.variables??null:null,slackThreadMode:p.data,slackThreadModePending:E.isPending,channelPolicies:m.policies,policySavingKey:m.savingKey,policiesLoading:m.isLoading,policiesError:m.isError,onChannelPolicyChange:m.onChange,onSetup:t?U:void 0,onDisconnect:G,onSaveTelegramToken:F,telegramSaveStatus:b.status,telegramSaveError:b.error?.message??null,onSaveDiscordToken:N,discordSaveStatus:S.status,discordSaveError:S.error?.message??null,discordInviteUrl:S.data?.data?.inviteUrl??C.data?.inviteUrl,onSaveSlackConfig:L,slackSaveStatus:w.status,slackSaveError:w.error?.message??null,onSlackThreadModeChange:z,onSaveTwilioCredentials:H}}function ve(e){return e?h:h.filter(e=>e!==`discord`)}function ye(e,t,n){let r=new Map;for(let t of e)r.set(t.channel,t);return t.map(e=>{let t=r.get(e);return{key:e,status:be(t),configured:t?.setupStatus===`ready`,canDisconnect:$[e]!==void 0&&(e!==`discord`||n),canManualEntry:l[e].credentialForm!==void 0&&(e!==`discord`||n),health:t?.health,address:t?.channelHandle??void 0}})}function be(e){return e?e.ready?`ready`:e.setupStatus===`not_configured`?`not_configured`:`incomplete`:`not_configured`}function xe(e){let t=j(),[n,r]=(0,B.useState)(!1);return{isOpen:n,open:(0,B.useCallback)(()=>{r(!0)},[]),close:(0,B.useCallback)(()=>{r(!1),t.invalidateQueries({queryKey:a({path:{assistant_id:e}})})},[t,e])}}export{Q as a,q as c,se as i,U as l,_e as n,Z as o,ce as r,X as s,xe as t,H as u};
|
package/dist/assets/{use-platform-assistant-id-D8KGJAMf.js → use-platform-assistant-id-B1MuVrYX.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{zm as t}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{zm as t}from"./app-p4YU9h0P.js";import{x as n}from"./react-B9IgSVeK.js";var r=e(n(),1);function i(e,n){let[i,a]=(0,r.useState)({platformAssistantId:null,isLoading:!1,error:null});return(0,r.useEffect)(()=>{if(!n||!e){a({platformAssistantId:null,isLoading:!1,error:null});return}let r=!0;return a({platformAssistantId:null,isLoading:!0,error:null}),t(e).then(e=>{r&&a({platformAssistantId:e,isLoading:!1,error:null})}).catch(e=>{r&&a({platformAssistantId:null,isLoading:!1,error:e instanceof Error?e:Error(String(e))})}),()=>{r=!1}},[e,n]),i}export{i as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{As as t,Av as n,Dp as r,Es as i,Sp as a,Tb as o,Ts as s,kp as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{As as t,Av as n,Dp as r,Es as i,Sp as a,Tb as o,Ts as s,kp as c}from"./app-p4YU9h0P.js";import{j as l}from"./vendor-DYOeoIwg.js";import{_ as u,r as d,t as f,x as p}from"./react-B9IgSVeK.js";import{qn as m}from"./icons-QG1KAFmx.js";var h=f();function g(){let{t:e}=l(`account`);return(0,h.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`authWaitSpinner.loading`)})}var _=e(p(),1);function v({to:e}){let n=s(e);return(0,_.useEffect)(()=>{n&&t(e)},[n,e]),n?null:(0,h.jsx)(d,{to:e,replace:!0})}function y(){let[e]=u(),t=r(),s=c(),l=a(),d=e.get(`returnTo`),f=n(d,o.assistant);if(!d)return{kind:`proceed`,returnTo:null};if(s)return{kind:`wait`};if(!t)return{kind:`proceed`,returnTo:f};if(i(f)){if(l===`pending`)return{kind:`wait`};if(l===`disabled`)return{kind:`proceed`,returnTo:f}}return{kind:`redirect`,node:(0,h.jsx)(v,{to:f})}}export{g as n,y as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Di as t,Ei as n,Ri as r,Ux as i,Vi as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Di as t,Ei as n,Ri as r,Ux as i,Vi as a}from"./app-p4YU9h0P.js";import{j as o}from"./vendor-DYOeoIwg.js";import{t as s,x as c}from"./react-B9IgSVeK.js";import{Nn as l,i as u}from"./icons-QG1KAFmx.js";var d=e(c(),1),f=s(),p=[`a[href]`,`button:not([disabled])`,`input:not([disabled])`,`select:not([disabled])`,`textarea:not([disabled])`,`[tabindex]:not([tabindex="-1"])`].join(`,`);function m({open:e,onClose:t,children:n,title:s}){let{t:c}=o(),l=(0,d.useRef)(null),m=(0,d.useRef)(null),h=(0,d.useRef)(t);(0,d.useEffect)(()=>{h.current=t});let{dragOffset:g,isDragging:_,onTouchStart:v,onTouchMove:y,onTouchEnd:b,onTouchCancel:x}=r({enabled:e,onSwipeLeft:t});return a(e),(0,d.useEffect)(()=>{if(!e)return;m.current?.focus();let t=e=>{if(e.key===`Escape`&&!e.defaultPrevented){e.preventDefault(),h.current();return}if(e.key!==`Tab`||!l.current)return;let t=l.current.querySelectorAll(p),n=t[0],r=t[t.length-1];if(!n||!r){e.preventDefault();return}let i=document.activeElement,a=l.current.contains(i);e.shiftKey?(!a||i===n)&&(e.preventDefault(),r.focus()):(!a||i===r)&&(e.preventDefault(),n.focus())};return document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`keydown`,t)}},[e]),e?(0,f.jsxs)(`div`,{ref:l,className:`fixed inset-0`,style:{zIndex:40},role:`dialog`,"aria-modal":`true`,"aria-label":s,children:[(0,f.jsx)(`button`,{type:`button`,"aria-label":c(`sideListDrawer.closeSidebarAria`),className:`absolute inset-0 h-full w-full cursor-default`,style:{background:`rgba(0, 0, 0, 0.4)`,zIndex:40},onClick:t}),(0,f.jsxs)(`aside`,{className:`relative flex h-full w-[80vw] max-w-xs flex-col shadow-xl`,style:{background:`var(--surface-lift)`,borderRight:`1px solid var(--border-base)`,zIndex:50,paddingTop:`var(--safe-area-inset-top, env(safe-area-inset-top, 0px))`,paddingBottom:`var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px))`,paddingLeft:`var(--safe-area-inset-left, env(safe-area-inset-left, 0px))`,transform:`translateX(${g}px)`,transition:_?`none`:`transform 200ms ease-out`,touchAction:`pan-y`},onTouchStart:v,onTouchMove:y,onTouchEnd:b,onTouchCancel:x,children:[(0,f.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between border-b px-4 py-3`,style:{borderColor:`var(--border-base)`},children:[(0,f.jsx)(`span`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:s}),(0,f.jsx)(i,{ref:m,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,f.jsx)(u,{"aria-hidden":!0}),onClick:t,"aria-label":c(`sideListDrawer.closeAria`),tintColor:`var(--content-tertiary)`})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:n})]})]}):null}function h({onClick:e}){let{t}=o();return(0,f.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,f.jsx)(l,{"aria-hidden":!0}),onClick:e,"aria-label":t(`sideListDrawer.openSidebarAria`),tintColor:`var(--content-secondary)`})}var g=640;function _(){let{ref:e,size:r}=n(),i=r.w<=0,a=t(i),o=(i?a.w:r.w)>=g,[s,c]=(0,d.useState)(!1);return(0,d.useEffect)(()=>{o&&c(!1)},[o]),{paneRef:e,hasRoomForList:o,drawerOpen:s,openDrawer:(0,d.useCallback)(()=>c(!0),[]),closeDrawer:(0,d.useCallback)(()=>c(!1),[])}}export{m as n,h as r,_ as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ix as t,N_ as n,Rb as r,Vb as i,Vx as a,ap as o,p as s,zb as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ix as t,N_ as n,Rb as r,Vb as i,Vx as a,ap as o,p as s,zb as c}from"./app-p4YU9h0P.js";import{I as l,Jn as u,er as d,j as f}from"./vendor-DYOeoIwg.js";import{t as p,x as m}from"./react-B9IgSVeK.js";import{Ja as h,N as g,Nt as _,Sr as v,ma as y,y as b}from"./icons-QG1KAFmx.js";var x=h(`box`,[[`path`,{d:`M21 8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16Z`,key:`hh9hay`}],[`path`,{d:`m3.3 7 8.7 5 8.7-5`,key:`g66t2b`}],[`path`,{d:`M12 22V12`,key:`d0xqtd`}]]),S=e(m(),1),C=p(),w={vellum:x,clawhub:v,skillssh:g,custom:b,"assistant-memory":y};function T(e,t){switch(e){case`vellum`:return`Vellum`;case`clawhub`:return`Clawhub`;case`skillssh`:return`skills.sh`;case`custom`:return t(`skillOriginBadge.custom`);case`assistant-memory`:return t(`skillOriginBadge.assistantMemory`)}}function E({origin:e}){let{t:n}=f(`intelligence`),r=e in w?{label:T(e,n),icon:w[e]}:{label:e.replace(/-/g,` `),icon:_};return(0,C.jsx)(t,{tone:`neutral`,leftIcon:(0,S.createElement)(r.icon),className:`capitalize`,children:r.label})}function D(e){return e.kind===`installed`||e.kind===`bundled`}function O(e){return e.kind===`catalog`}function k({icon:e,iconColor:t=`var(--content-tertiary)`,title:n,subtitle:r,children:i}){return(0,C.jsx)(a.Root,{children:(0,C.jsxs)(a.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,C.jsx)(e,{className:`mb-3 h-8 w-8`,style:{color:t},"aria-hidden":!0}),(0,C.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,C.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r}),i]})})}async function A(e,t,a){let{data:o,error:s,response:u}=await n({path:{assistant_id:e},body:a?{slug:t,version:a}:{slug:t},throwOnError:!1}),d=l(`installSkill.failureMessage`,{ns:`intelligence`});if(c(u,s,d),!u.ok)throw new r(u.status,i(s,u,d));return o??{ok:!0}}function j(e,{onRemoved:t}={}){let n=d(),[r,i]=(0,S.useState)(null),[a,c]=(0,S.useState)(null),[l,f]=(0,S.useState)(null),p=(0,S.useCallback)(()=>{s(n,e)},[e,n]),m=u({mutationFn:t=>A(e,t),onMutate:e=>i(e),onSettled:()=>{i(null),p()}}),h=o({onMutate:e=>c(e.path.id),onSuccess:()=>{t?.()},onSettled:()=>{c(null),p()}}),g=(0,S.useCallback)(e=>{m.mutate(e.slug??e.id)},[m]),_=(0,S.useCallback)(e=>{f(e)},[]),v=(0,S.useCallback)(()=>{l&&(h.mutate({path:{assistant_id:e,id:l.id}}),f(null))},[e,l,h]),y=(0,S.useCallback)(()=>{f(null)},[]);return{handleInstall:g,handleRemove:_,isInstallingSkill:(0,S.useCallback)(e=>r===(e.slug??e.id),[r]),isRemovingSkill:(0,S.useCallback)(e=>a===e.id,[a]),skillPendingRemoval:l,confirmRemove:v,cancelRemove:y}}export{E as a,D as i,k as n,x as o,O as r,j as t};
|
package/dist/assets/{use-skill-detail-files-C5BA-Phb.js → use-skill-detail-files-DmOW_S89.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ef as t,Ha as n,Tb as r,Tf as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ef as t,Ha as n,Tb as r,Tf as i}from"./app-p4YU9h0P.js";import{Zn as a,j as o}from"./vendor-DYOeoIwg.js";import{n as s,t as c,x as l}from"./react-B9IgSVeK.js";import{La as u}from"./icons-QG1KAFmx.js";var d=c();function f({skill:e,className:t,onNavigate:i}){let{t:a}=o();return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,d.jsxs)(s,{to:r.conversation(e.sourceConversationId),onClick:i,className:n(`inline-flex w-fit items-center gap-1 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:text-[var(--content-secondary)] hover:underline`,t),children:[a(`skillLineageLink.label`),(0,d.jsx)(u,{className:`h-3.5 w-3.5 shrink-0`,"aria-hidden":!0})]})}var p=e(l(),1);function m(e,t){return t??e.find(e=>e.name===`SKILL.md`)?.path??null}function h(e,n){let[r,o]=(0,p.useState)(null),s=a({...t({path:{assistant_id:e??``,id:n}}),select:e=>e??null,enabled:!!e}),c=(0,p.useMemo)(()=>s.data?.files??[],[s.data]),l=(0,p.useMemo)(()=>c.find(e=>e.name===`SKILL.md`),[c]),u=m(c,r),d=a({...i({path:{assistant_id:e??``,id:n},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:c,skillMd:l,selectedPath:r,setSelectedPath:o,activePath:u,activeFile:c.find(e=>e.path===u),isFilesLoading:s.isLoading,isFilesPending:s.isPending,fileContent:d.data?.content??null,isBinary:!!d.data?.isBinary,isContentLoading:d.isLoading,isContentPending:d.isPending}}export{f as n,h as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{rh as e}from"./app-p4YU9h0P.js";var t=`0.10.8`;function n(n){return e(t,n)}export{n as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fp as t,br as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Fp as t,br as n}from"./app-p4YU9h0P.js";import{x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(e){let r=n();return(0,i.useMemo)(()=>{if(e)return r.find(n=>t(n).includes(e))},[r,e])}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cd as t,Cx as n,Dx as r,Eb as i,Ex as a,Fc as o,Ff as s,Ga as c,Ja as l,Ka as u,Kt as d,Ms as f,Mx as p,Ns as m,Pc as h,Ps as g,Rs as _,Tb as v,Tx as y,Ut as b,Ux as x,Wa as S,Wt as C,Ya as w,_a as T,_u as E,ao as D,co as O,cx as k,et as A,hu as j,io as M,it as ee,js as N,lb as te,lo as P,nt as ne,oo as re,px as ie,qa as ae,ro as oe,so as F,tt as se,uo as I,wd as ce,ym as le,yx as ue,zg as de}from"./app-DFXcEvsi.js";import{Zn as L,er as fe,j as R}from"./vendor-DYOeoIwg.js";import{_ as pe,n as me,r as z,t as he,x as ge}from"./react-B9IgSVeK.js";import{Ia as _e,ur as B}from"./icons-QG1KAFmx.js";import{t as V}from"./detail-card-CGafPdBQ.js";import{t as ve}from"./stt-language-picker-modal-Ckz32Oh1.js";import{t as ye}from"./use-hotkey-recorder-Cj-vFxW2.js";var H=e(ge(),1),U=he();function W({label:e,selected:t,recording:n=!1,onClick:r}){return(0,U.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,U.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,U.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function be(){let{t:e}=R(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a}=ne(A()),[o,s]=(0,H.useState)(!1);return t?(0,U.jsxs)(V,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:ee(n,r)}),(0,U.jsx)(x,{variant:`outlined`,onClick:()=>s(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,U.jsx)(ve,{open:o,onOpenChange:s,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a})]}):null}var G=`flux`;function xe(e){return e===`vellum`}function Se(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function Ce(){let{t:e}=R(`settings`),r=fe(),i=le(),a=A(),[o,c]=(0,H.useState)(!1),{data:l}=L({...t({path:{assistant_id:a}}),enabled:i,staleTime:3e4}),u=l?.services?.stt,{data:d}=L({...s({path:{assistant_id:a}}),enabled:i,staleTime:5*6e4}),f=u?.roles?.liveVoice?.provider??u?.provider,m=d?.providers?.find(e=>e.id===f),h=m?.modelFamilies?.includes(G)??!1;if(!f||!h)return null;let g=Se(u?.language,m?.turnDetectionLanguages),_=u?.roles?.liveVoice,v=_?_.model:u?.providers?.[f]?.model,y=v===void 0?xe(f)&&g:v===G,b=async t=>{c(!0);try{let{response:e}=await de({path:{assistant_id:a},body:{services:{stt:{roles:{liveVoice:{provider:f,model:t?G:m?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await r.invalidateQueries({queryKey:ce({path:{assistant_id:a}})})}catch{n.error(e(`voicePage.turnDetectionFailed`))}finally{c(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,U.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(g?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,U.jsx)(p,{checked:y,disabled:o||!g&&!y,onChange:e=>void b(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,q=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,we=2;function J(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),I(t)}function Te(){let{t:e}=R(`settings`),t=D(),n=S(e=>e.registered)===!1,[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)([]),[l,u]=(0,H.useState)(!1),d=(0,H.useRef)(null),f=(0,H.useCallback)(async()=>{i((await j())?.inputMonitoring.status??null)},[]);(0,H.useEffect)(()=>{f();let e=setInterval(()=>{f()},2e3);return()=>{clearInterval(e)}},[f]);let p=(0,H.useCallback)(()=>{E(`inputMonitoring`).then(f)},[f]),m=(0,H.useCallback)(e=>{re(e),o(!1),c([]),u(!1),e.kind!==`off`&&p()},[p]),h=(0,H.useCallback)(()=>{o(!0),c([]),u(!1),requestAnimationFrame(()=>{d.current?.focus()})},[]),g=(0,H.useCallback)(()=>{o(!1),c([]),u(!1)},[]),_=(0,H.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){g();return}c(J(e))},[g]),v=(0,H.useCallback)(e=>{if(a&&!(J(e).length>0)){if(s.length>=we){m({kind:`modifierOnly`,modifiers:s});return}c([]),u(!0)}},[m,s,a]);(0,H.useEffect)(()=>{if(!a)return;let e=e=>{d.current&&!d.current.contains(e.target)&&g()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[g,a]);let y=M(t),b=t.kind===`modifierOnly`&&!y,C=t.kind!==`off`,w=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),T=r===`granted`;return(0,U.jsx)(V,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{ref:d,tabIndex:a?0:-1,onKeyDown:a?_:void 0,onKeyUp:a?v:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,U.jsx)(W,{label:e(`voiceKeyCard.fnLabel`),selected:y,onClick:()=>m(oe)}),a?(0,U.jsx)(W,{label:s.length>0?P(s):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:g}):(0,U.jsx)(W,{label:t.kind===`modifierOnly`&&!y?P(t.modifiers):e(`voiceKeyCard.customLabel`),selected:b,onClick:h}),(0,U.jsx)(W,{label:e(`voiceKeyCard.offLabel`),selected:!C,onClick:()=>m({kind:`off`})})]}),l&&(0,U.jsxs)(`div`,{className:K,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),C&&r!==null&&!T&&(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,U.jsxs)(`div`,{className:q,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,U.jsx)(x,{variant:`outlined`,onClick:p,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),C&&T&&n&&(0,U.jsxs)(`div`,{className:q,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),y&&(0,U.jsxs)(`div`,{className:K,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),w&&(0,U.jsxs)(`div`,{className:K,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function Ee({assistantId:e,open:t,onOpenChange:n}){return(0,U.jsx)(y.Root,{open:t,onOpenChange:n,children:(0,U.jsx)(y.Content,{size:`md`,children:(0,U.jsx)(De,{assistantId:e,onDone:()=>n(!1)})})})}function De({assistantId:e,onDone:t}){let{t:n}=R(),{available:r,currentModel:i,selectModel:a,selecting:o}=T(e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(y.Header,{children:[(0,U.jsx)(y.Title,{children:n(`voicePickerModal.title`)}),r&&(0,U.jsx)(y.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,U.jsx)(y.Body,{children:(0,U.jsx)(C,{assistantId:e,filterBySource:!0,value:i,onChange:a,autoScrollToSelected:!0})}),(0,U.jsxs)(y.Footer,{className:`items-center justify-between gap-3`,children:[(0,U.jsx)(se,{}),(0,U.jsx)(x,{variant:`primary`,onClick:t,disabled:o,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function Oe(){let{t:e}=R(`settings`),t=A(),{available:n,settled:r,voices:i,currentModel:a}=T(t),o=i.find(e=>e.model===a)??i[0],[s,c]=(0,H.useState)(!1),l=te.use.name(),u=l?e(`voicePickerCard.titleWithName`,{name:l}):e(`voicePickerCard.title`);return r?n&&o?(0,U.jsxs)(V,{title:u,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(b,{description:o.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,U.jsx)(x,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,U.jsx)(Ee,{assistantId:t,open:s,onOpenChange:c})]}):(0,U.jsx)(V,{title:u,children:(0,U.jsx)(d,{})}):(0,U.jsx)(V,{title:u,children:(0,U.jsx)(k,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var ke=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],Ae=`We recommend keeping both off to start. It feels more like a real conversation.`;function je(){let{t:e}=R();return(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:e(`voiceTranscriptToggles.recommendedOff`)})}function Me({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,U.jsx)(je,{}):null]}),t?(0,U.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,U.jsx)(p,{checked:r,onChange:i,"aria-label":e})]})}function Ne({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=R(),r=o.use.showUserTranscript(),i=o.use.showAssistantTranscript(),a=o.use.setShowUserTranscript(),s=o.use.setShowAssistantTranscript(),c={showUserTranscript:{checked:r,onChange:a},showAssistantTranscript:{checked:i,onChange:s}},l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),u=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,U.jsx)(U.Fragment,{children:ke.map(n=>{let r=c[n.prefKey];return(0,U.jsx)(Me,{label:l(n.prefKey,n.label),description:e?u(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var Y=`text-body-small-default text-[var(--content-tertiary)]`;function Pe(){let[e]=pe(),t=e.get(`tab`);return t===`sounds`?(0,U.jsx)(z,{replace:!0,to:v.settings.sounds}):t===`services`?(0,U.jsx)(z,{replace:!0,to:v.settings.ai}):(0,U.jsx)(Fe,{})}function Fe(){let{t:e}=R(`settings`);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,U.jsxs)(X,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,U.jsx)(Oe,{}),(0,U.jsx)(Ie,{})]}),(0,U.jsxs)(X,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,U.jsx)(Re,{}),(0,U.jsx)(be,{}),_()?(0,U.jsx)(Te,{}):(0,U.jsx)(Ve,{}),(0,U.jsx)(He,{})]}),(0,U.jsx)(X,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,U.jsx)(Le,{})})]})}function Ie(){let{t:e}=R(`settings`),{available:t}=T(A());return t?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,U.jsx)(B,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,U.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,U.jsxs)(me,{to:`${v.settings.ai}#text-to-speech`,className:`inline-flex items-center gap-1 text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 hover:text-[var(--content-default)]`,children:[e(`voicePage.speechServicesBannerLink`),(0,U.jsx)(_e,{className:`h-3 w-3`})]})]}):null}function X({heading:e,description:t,children:n}){return(0,U.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,U.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function Le(){let{t:e}=R(`settings`);return(0,U.jsx)(V,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(Ne,{showDescription:!0}),(0,U.jsx)(`p`,{className:`${Y} pt-1`,children:e(`voicePage.captionsRecommendation`,Ae)})]})})}var Z=``;function Re(){let{t:e}=R(`settings`),[t,n]=(0,H.useState)([]),[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(()=>N()),l=(0,H.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await f();i(e.needsPermission),n(e.devices),o(e.known)},[]),u=(0,H.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}l()},[l]);(0,H.useEffect)(()=>{l();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void l();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[l]);let d=(0,H.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=s!==Z&&!n.some(e=>e.value===s);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:s,label:e(a?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,s,a,e]),p=(0,H.useCallback)(e=>{c(e),m(e)},[]);(0,H.useEffect)(()=>g(()=>{c(N())}),[]);let h=s===Z?null:s;return(0,U.jsx)(V,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(`div`,{className:`max-w-xs`,children:(0,U.jsx)(ie,{options:d,value:h,onChange:p,onSelectNone:()=>p(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(x,{variant:`outlined`,onClick:u,children:e(`voicePage.allowMicrophoneAccess`)}),(0,U.jsx)(`span`,{className:Y,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var ze=new Set([`Control`,`Alt`,`Shift`,`Meta`]),Q=`toggleVoice`,Be=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ve(){let{t:e}=R(`settings`),t=i(),[n,r]=(0,H.useState)(()=>ae()),[a,o]=(0,H.useState)(!1),[s,d]=(0,H.useState)([]),[f,m]=(0,H.useState)(!1),h=(0,H.useRef)(null),g=(0,H.useMemo)(()=>{let e=u();return[{label:F(e),activator:e}]},[]),_=n.kind!==`off`,v=(0,H.useCallback)(e=>{r(e),w(e),o(!1),d([]),m(!1)},[]),y=ye({onBound:()=>v({kind:`off`})}),b=y.catalog.find(e=>e.key===Q)?.accelerator??``,x=y.recordingKey===Q,S=l()?Be:[],C=(0,H.useCallback)(e=>{v(e),y.removeHotkey(Q)},[y,v]),T=(0,H.useCallback)(()=>{v({kind:`off`}),y.removeHotkey(Q)},[y,v]),E=(0,H.useCallback)(()=>{o(!0),d([]),m(!1),requestAnimationFrame(()=>{h.current?.focus()})},[]),D=(0,H.useCallback)(()=>{o(!1),d([]),m(!1)},[]),k=(0,H.useCallback)(e=>{let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),t},[]),A=(0,H.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){D();return}let t=k(e);if(ze.has(e.key)){m(!1),d(I(t));return}if(t.length===0){m(!0);return}v({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:I(t)})},[D,k,v]),j=(0,H.useCallback)(e=>{a&&k(e).length===0&&s.length>0&&(d([]),m(!0))},[k,a,s]);(0,H.useEffect)(()=>{if(!a)return;let e=e=>{h.current&&!h.current.contains(e.target)&&D()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[D,a]);let M=_&&!g.some(e=>O(e.activator,n));return t?(0,U.jsx)(V,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[S.map(e=>(0,U.jsx)(W,{label:e.label,selected:O(e.activator,n),onClick:()=>C(e.activator)},e.label)),(0,U.jsx)(W,{label:x?e(`voicePage.recordingPrompt`):b?(0,U.jsx)(ue,{accelerator:b}):e(`voicePage.customKey`),selected:b!==``,recording:x,onClick:x?y.stopRecording:()=>y.startRecording(Q)}),(0,U.jsx)(W,{label:e(`voicePage.offKeyLabel`),selected:n.kind===`off`&&!b&&!x,onClick:T})]}),y.conflict?.key===Q&&(0,U.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:y.conflict.label})})]})]})}):(0,U.jsx)(V,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsx)(p,{checked:_,onChange:e=>{v(e?c():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),_&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`span`,{className:Y,children:e(`voicePage.activationKeyLabel`)}),(0,U.jsxs)(`div`,{ref:h,tabIndex:a?0:-1,onKeyDown:a?A:void 0,onKeyUp:a?j:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[g.map(e=>(0,U.jsx)(W,{label:e.label,selected:O(e.activator,n),onClick:()=>v(e.activator)},e.label)),a?(0,U.jsx)(W,{label:s.length>0?P(s):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:D}):(0,U.jsx)(W,{label:M?F(n):e(`voicePage.customKey`),selected:M,onClick:E})]}),f&&(0,U.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),_&&(0,U.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function He(){let{t:e}=R(`settings`),t=o.use.pauseBeforeReplyMs(),n=o.use.setPauseBeforeReplyMs(),i=o.use.interruptSensitivity(),s=o.use.setInterruptSensitivity(),c=(0,H.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),l=t!==null||i!==null;return(0,U.jsx)(V,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(Ce,{}),(0,U.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,U.jsx)(`div`,{className:`max-w-xs`,children:(0,U.jsx)(a,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:h/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,U.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:i===null,children:(0,U.jsx)(`div`,{className:`max-w-xs`,children:(0,U.jsx)(r,{items:c,value:i??`medium`,onChange:s,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),l&&(0,U.jsx)(`div`,{children:(0,U.jsx)(x,{variant:`outlined`,onClick:()=>{n(null),s(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=R(`settings`);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:i(`voicePage.defaultBadge`)})]}),(0,U.jsx)(`p`,{className:Y,children:t}),r]})}export{Pe as VoicePage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cd as t,Cx as n,Dx as r,Eb as i,Ex as a,Fc as o,Ff as s,Ga as c,Ja as l,Ka as u,Kt as d,Ms as f,Mx as p,Ns as m,Pc as h,Ps as g,Rs as _,Tb as v,Tx as y,Ut as b,Ux as x,Wa as S,Wt as C,Ya as w,_a as T,_u as E,ao as D,co as O,cx as k,et as A,hu as j,io as M,it as ee,js as N,lb as te,lo as P,nt as ne,oo as re,px as ie,qa as ae,ro as oe,so as F,tt as se,uo as I,wd as ce,ym as le,yx as ue,zg as de}from"./app-p4YU9h0P.js";import{Zn as L,er as fe,j as R}from"./vendor-DYOeoIwg.js";import{_ as pe,n as me,r as z,t as he,x as ge}from"./react-B9IgSVeK.js";import{Ia as _e,ur as B}from"./icons-QG1KAFmx.js";import{t as V}from"./detail-card-BpqiAUnN.js";import{t as ve}from"./stt-language-picker-modal-3iCIcD10.js";import{t as ye}from"./use-hotkey-recorder-KK0SXCtP.js";var H=e(ge(),1),U=he();function W({label:e,selected:t,recording:n=!1,onClick:r}){return(0,U.jsxs)(`button`,{type:`button`,onClick:r,className:[`inline-flex items-center gap-2 rounded-lg border px-3 py-1.5 text-body-medium-lighter transition-colors`,`border-[var(--border-subtle)]`,t?`bg-[var(--surface-active)]`:`bg-[var(--surface-lift)] hover:bg-[var(--surface-hover)]`,n?`animate-pulse`:``].filter(Boolean).join(` `),children:[(0,U.jsx)(`span`,{className:[`inline-block h-2.5 w-2.5 rounded-full border`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)]`].join(` `)}),(0,U.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function be(){let{t:e}=R(`settings`),{available:t,currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a}=ne(A()),[o,s]=(0,H.useState)(!1);return t?(0,U.jsxs)(V,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:ee(n,r)}),(0,U.jsx)(x,{variant:`outlined`,onClick:()=>s(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,U.jsx)(ve,{open:o,onOpenChange:s,title:e(`listeningLanguageCard.title`),currentCode:n,configuredProviderId:r,selectLanguage:i,selecting:a})]}):null}var G=`flux`;function xe(e){return e===`vellum`}function Se(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function Ce(){let{t:e}=R(`settings`),r=fe(),i=le(),a=A(),[o,c]=(0,H.useState)(!1),{data:l}=L({...t({path:{assistant_id:a}}),enabled:i,staleTime:3e4}),u=l?.services?.stt,{data:d}=L({...s({path:{assistant_id:a}}),enabled:i,staleTime:5*6e4}),f=u?.roles?.liveVoice?.provider??u?.provider,m=d?.providers?.find(e=>e.id===f),h=m?.modelFamilies?.includes(G)??!1;if(!f||!h)return null;let g=Se(u?.language,m?.turnDetectionLanguages),_=u?.roles?.liveVoice,v=_?_.model:u?.providers?.[f]?.model,y=v===void 0?xe(f)&&g:v===G,b=async t=>{c(!0);try{let{response:e}=await de({path:{assistant_id:a},body:{services:{stt:{roles:{liveVoice:{provider:f,model:t?G:m?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await r.invalidateQueries({queryKey:ce({path:{assistant_id:a}})})}catch{n.error(e(`voicePage.turnDetectionFailed`))}finally{c(!1)}};return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,U.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(g?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,U.jsx)(p,{checked:y,disabled:o||!g&&!y,onChange:e=>void b(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,q=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,we=2;function J(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),I(t)}function Te(){let{t:e}=R(`settings`),t=D(),n=S(e=>e.registered)===!1,[r,i]=(0,H.useState)(null),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)([]),[l,u]=(0,H.useState)(!1),d=(0,H.useRef)(null),f=(0,H.useCallback)(async()=>{i((await j())?.inputMonitoring.status??null)},[]);(0,H.useEffect)(()=>{f();let e=setInterval(()=>{f()},2e3);return()=>{clearInterval(e)}},[f]);let p=(0,H.useCallback)(()=>{E(`inputMonitoring`).then(f)},[f]),m=(0,H.useCallback)(e=>{re(e),o(!1),c([]),u(!1),e.kind!==`off`&&p()},[p]),h=(0,H.useCallback)(()=>{o(!0),c([]),u(!1),requestAnimationFrame(()=>{d.current?.focus()})},[]),g=(0,H.useCallback)(()=>{o(!1),c([]),u(!1)},[]),_=(0,H.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){g();return}c(J(e))},[g]),v=(0,H.useCallback)(e=>{if(a&&!(J(e).length>0)){if(s.length>=we){m({kind:`modifierOnly`,modifiers:s});return}c([]),u(!0)}},[m,s,a]);(0,H.useEffect)(()=>{if(!a)return;let e=e=>{d.current&&!d.current.contains(e.target)&&g()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[g,a]);let y=M(t),b=t.kind===`modifierOnly`&&!y,C=t.kind!==`off`,w=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),T=r===`granted`;return(0,U.jsx)(V,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{ref:d,tabIndex:a?0:-1,onKeyDown:a?_:void 0,onKeyUp:a?v:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,U.jsx)(W,{label:e(`voiceKeyCard.fnLabel`),selected:y,onClick:()=>m(oe)}),a?(0,U.jsx)(W,{label:s.length>0?P(s):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:g}):(0,U.jsx)(W,{label:t.kind===`modifierOnly`&&!y?P(t.modifiers):e(`voiceKeyCard.customLabel`),selected:b,onClick:h}),(0,U.jsx)(W,{label:e(`voiceKeyCard.offLabel`),selected:!C,onClick:()=>m({kind:`off`})})]}),l&&(0,U.jsxs)(`div`,{className:K,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),C&&r!==null&&!T&&(0,U.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,U.jsxs)(`div`,{className:q,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,U.jsx)(x,{variant:`outlined`,onClick:p,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),C&&T&&n&&(0,U.jsxs)(`div`,{className:q,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),y&&(0,U.jsxs)(`div`,{className:K,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),w&&(0,U.jsxs)(`div`,{className:K,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function Ee({assistantId:e,open:t,onOpenChange:n}){return(0,U.jsx)(y.Root,{open:t,onOpenChange:n,children:(0,U.jsx)(y.Content,{size:`md`,children:(0,U.jsx)(De,{assistantId:e,onDone:()=>n(!1)})})})}function De({assistantId:e,onDone:t}){let{t:n}=R(),{available:r,currentModel:i,selectModel:a,selecting:o}=T(e);return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(y.Header,{children:[(0,U.jsx)(y.Title,{children:n(`voicePickerModal.title`)}),r&&(0,U.jsx)(y.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,U.jsx)(y.Body,{children:(0,U.jsx)(C,{assistantId:e,filterBySource:!0,value:i,onChange:a,autoScrollToSelected:!0})}),(0,U.jsxs)(y.Footer,{className:`items-center justify-between gap-3`,children:[(0,U.jsx)(se,{}),(0,U.jsx)(x,{variant:`primary`,onClick:t,disabled:o,className:`shrink-0`,children:n(`voicePickerModal.done`)})]})]})}function Oe(){let{t:e}=R(`settings`),t=A(),{available:n,settled:r,voices:i,currentModel:a}=T(t),o=i.find(e=>e.model===a)??i[0],[s,c]=(0,H.useState)(!1),l=te.use.name(),u=l?e(`voicePickerCard.titleWithName`,{name:l}):e(`voicePickerCard.title`);return r?n&&o?(0,U.jsxs)(V,{title:u,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(b,{description:o.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,U.jsx)(x,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,U.jsx)(Ee,{assistantId:t,open:s,onOpenChange:c})]}):(0,U.jsx)(V,{title:u,children:(0,U.jsx)(d,{})}):(0,U.jsx)(V,{title:u,children:(0,U.jsx)(k,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var ke=[{prefKey:`showUserTranscript`,label:`Show the words you say`,description:`Live transcription while you speak.`},{prefKey:`showAssistantTranscript`,label:`Show the words the assistant says`,description:`Text alongside the spoken response.`}],Ae=`We recommend keeping both off to start. It feels more like a real conversation.`;function je(){let{t:e}=R();return(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:e(`voiceTranscriptToggles.recommendedOff`)})}function Me({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,U.jsx)(je,{}):null]}),t?(0,U.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,U.jsx)(p,{checked:r,onChange:i,"aria-label":e})]})}function Ne({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=R(),r=o.use.showUserTranscript(),i=o.use.showAssistantTranscript(),a=o.use.setShowUserTranscript(),s=o.use.setShowAssistantTranscript(),c={showUserTranscript:{checked:r,onChange:a},showAssistantTranscript:{checked:i,onChange:s}},l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),u=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,U.jsx)(U.Fragment,{children:ke.map(n=>{let r=c[n.prefKey];return(0,U.jsx)(Me,{label:l(n.prefKey,n.label),description:e?u(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var Y=`text-body-small-default text-[var(--content-tertiary)]`;function Pe(){let[e]=pe(),t=e.get(`tab`);return t===`sounds`?(0,U.jsx)(z,{replace:!0,to:v.settings.sounds}):t===`services`?(0,U.jsx)(z,{replace:!0,to:v.settings.ai}):(0,U.jsx)(Fe,{})}function Fe(){let{t:e}=R(`settings`);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,U.jsxs)(X,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,U.jsx)(Oe,{}),(0,U.jsx)(Ie,{})]}),(0,U.jsxs)(X,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,U.jsx)(Re,{}),(0,U.jsx)(be,{}),_()?(0,U.jsx)(Te,{}):(0,U.jsx)(Ve,{}),(0,U.jsx)(He,{})]}),(0,U.jsx)(X,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,U.jsx)(Le,{})})]})}function Ie(){let{t:e}=R(`settings`),{available:t}=T(A());return t?(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,U.jsx)(B,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,U.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,U.jsxs)(me,{to:`${v.settings.ai}#text-to-speech`,className:`inline-flex items-center gap-1 text-[var(--content-secondary)] underline decoration-[var(--border-element)] underline-offset-2 hover:text-[var(--content-default)]`,children:[e(`voicePage.speechServicesBannerLink`),(0,U.jsx)(_e,{className:`h-3 w-3`})]})]}):null}function X({heading:e,description:t,children:n}){return(0,U.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,U.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,U.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function Le(){let{t:e}=R(`settings`);return(0,U.jsx)(V,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(Ne,{showDescription:!0}),(0,U.jsx)(`p`,{className:`${Y} pt-1`,children:e(`voicePage.captionsRecommendation`,Ae)})]})})}var Z=``;function Re(){let{t:e}=R(`settings`),[t,n]=(0,H.useState)([]),[r,i]=(0,H.useState)(!1),[a,o]=(0,H.useState)(!1),[s,c]=(0,H.useState)(()=>N()),l=(0,H.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await f();i(e.needsPermission),n(e.devices),o(e.known)},[]),u=(0,H.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}l()},[l]);(0,H.useEffect)(()=>{l();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void l();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[l]);let d=(0,H.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=s!==Z&&!n.some(e=>e.value===s);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:s,label:e(a?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,s,a,e]),p=(0,H.useCallback)(e=>{c(e),m(e)},[]);(0,H.useEffect)(()=>g(()=>{c(N())}),[]);let h=s===Z?null:s;return(0,U.jsx)(V,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsx)(`div`,{className:`max-w-xs`,children:(0,U.jsx)(ie,{options:d,value:h,onChange:p,onSelectNone:()=>p(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),r&&(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,U.jsx)(x,{variant:`outlined`,onClick:u,children:e(`voicePage.allowMicrophoneAccess`)}),(0,U.jsx)(`span`,{className:Y,children:e(`voicePage.grantMicrophoneAccessHint`)})]})]})})}var ze=new Set([`Control`,`Alt`,`Shift`,`Meta`]),Q=`toggleVoice`,Be=[{label:`Ctrl+Shift`,activator:{kind:`modifierOnly`,modifiers:[`control`,`shift`]}},{label:`Alt`,activator:{kind:`modifierOnly`,modifiers:[`option`]}}];function Ve(){let{t:e}=R(`settings`),t=i(),[n,r]=(0,H.useState)(()=>ae()),[a,o]=(0,H.useState)(!1),[s,d]=(0,H.useState)([]),[f,m]=(0,H.useState)(!1),h=(0,H.useRef)(null),g=(0,H.useMemo)(()=>{let e=u();return[{label:F(e),activator:e}]},[]),_=n.kind!==`off`,v=(0,H.useCallback)(e=>{r(e),w(e),o(!1),d([]),m(!1)},[]),y=ye({onBound:()=>v({kind:`off`})}),b=y.catalog.find(e=>e.key===Q)?.accelerator??``,x=y.recordingKey===Q,S=l()?Be:[],C=(0,H.useCallback)(e=>{v(e),y.removeHotkey(Q)},[y,v]),T=(0,H.useCallback)(()=>{v({kind:`off`}),y.removeHotkey(Q)},[y,v]),E=(0,H.useCallback)(()=>{o(!0),d([]),m(!1),requestAnimationFrame(()=>{h.current?.focus()})},[]),D=(0,H.useCallback)(()=>{o(!1),d([]),m(!1)},[]),k=(0,H.useCallback)(e=>{let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),t},[]),A=(0,H.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){D();return}let t=k(e);if(ze.has(e.key)){m(!1),d(I(t));return}if(t.length===0){m(!0);return}v({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:I(t)})},[D,k,v]),j=(0,H.useCallback)(e=>{a&&k(e).length===0&&s.length>0&&(d([]),m(!0))},[k,a,s]);(0,H.useEffect)(()=>{if(!a)return;let e=e=>{h.current&&!h.current.contains(e.target)&&D()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[D,a]);let M=_&&!g.some(e=>O(e.activator,n));return t?(0,U.jsx)(V,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[S.map(e=>(0,U.jsx)(W,{label:e.label,selected:O(e.activator,n),onClick:()=>C(e.activator)},e.label)),(0,U.jsx)(W,{label:x?e(`voicePage.recordingPrompt`):b?(0,U.jsx)(ue,{accelerator:b}):e(`voicePage.customKey`),selected:b!==``,recording:x,onClick:x?y.stopRecording:()=>y.startRecording(Q)}),(0,U.jsx)(W,{label:e(`voicePage.offKeyLabel`),selected:n.kind===`off`&&!b&&!x,onClick:T})]}),y.conflict?.key===Q&&(0,U.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:y.conflict.label})})]})]})}):(0,U.jsx)(V,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,U.jsx)(p,{checked:_,onChange:e=>{v(e?c():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),_&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`span`,{className:Y,children:e(`voicePage.activationKeyLabel`)}),(0,U.jsxs)(`div`,{ref:h,tabIndex:a?0:-1,onKeyDown:a?A:void 0,onKeyUp:a?j:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[g.map(e=>(0,U.jsx)(W,{label:e.label,selected:O(e.activator,n),onClick:()=>v(e.activator)},e.label)),a?(0,U.jsx)(W,{label:s.length>0?P(s):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:D}):(0,U.jsx)(W,{label:M?F(n):e(`voicePage.customKey`),selected:M,onClick:E})]}),f&&(0,U.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),_&&(0,U.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,U.jsx)(B,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,U.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function He(){let{t:e}=R(`settings`),t=o.use.pauseBeforeReplyMs(),n=o.use.setPauseBeforeReplyMs(),i=o.use.interruptSensitivity(),s=o.use.setInterruptSensitivity(),c=(0,H.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),l=t!==null||i!==null;return(0,U.jsx)(V,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,U.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,U.jsx)(Ce,{}),(0,U.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,U.jsx)(`div`,{className:`max-w-xs`,children:(0,U.jsx)(a,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&n(Math.round(e*1e3))},min:500/1e3,max:h/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,U.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:i===null,children:(0,U.jsx)(`div`,{className:`max-w-xs`,children:(0,U.jsx)(r,{items:c,value:i??`medium`,onChange:s,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),l&&(0,U.jsx)(`div`,{children:(0,U.jsx)(x,{variant:`outlined`,onClick:()=>{n(null),s(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=R(`settings`);return(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,U.jsx)(`span`,{className:`shrink-0 rounded-full bg-[var(--surface-active)] px-2 py-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:i(`voicePage.defaultBadge`)})]}),(0,U.jsx)(`p`,{className:Y,children:t}),r]})}export{Pe as VoicePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Jn as e,vn as t,yn as n}from"./app-
|
|
1
|
+
import{Jn as e,vn as t,yn as n}from"./app-p4YU9h0P.js";import{j as r}from"./vendor-DYOeoIwg.js";import{t as i}from"./react-B9IgSVeK.js";import{Q as a}from"./icons-QG1KAFmx.js";var o=i();function s({payload:t,onClose:i}){let{t:s}=r(`chat`),u=n(t.body);return(0,o.jsx)(e,{Glyph:a,title:t.title||s(`wakeDetailPanel.title`),closeLabel:s(`wakeDetailPanel.close`),closeTooltip:s(`wakeDetailPanel.close`),closeVariant:`outlined`,onClose:i,children:(0,o.jsxs)(`dl`,{className:`flex flex-col gap-6`,children:[u.workflow&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.workflow`),children:u.workflow}),u.runStatus&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.runStatus`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.runStatus})}),u.result&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.result`),children:(0,o.jsx)(c,{result:u.result})}),u.rest&&(0,o.jsx)(l,{label:s(`wakeDetailPanel.details`),children:(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:u.rest})}),t.metadata.length>0&&(0,o.jsx)(`div`,{className:`flex flex-col gap-6`,children:t.metadata.map(e=>(0,o.jsx)(l,{label:e.label,children:e.value},e.label))})]})})}function c({result:e}){let n=t(e);return n?(0,o.jsx)(`div`,{className:`flex flex-col gap-4`,children:n.map((e,t)=>(0,o.jsx)(`div`,{className:t>0?`flex flex-col gap-2 border-t border-[var(--border-hover)] pt-4`:`flex flex-col gap-2`,children:e.map(e=>(0,o.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,o.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e.key}),(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e.value})]},e.key))},t))}):(0,o.jsx)(`span`,{className:`whitespace-pre-wrap break-words`,children:e})}function l({label:e,children:t}){return(0,o.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,o.jsx)(`dt`,{className:`text-label-medium-default text-[var(--content-tertiary)]`,children:e}),(0,o.jsx)(`dd`,{className:`text-body-medium-default text-[var(--content-default)]`,children:t})]})}export{s as WakeDetailPanel};
|
package/dist/assets/{weather-forecast-display-CWGsPOa9.js → weather-forecast-display-ChYkwma2.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ha as t,Jt as n,Xt as r,Yt as i,Zt as a}from"./app-DFXcEvsi.js";import{j as o}from"./vendor-DYOeoIwg.js";import{t as s,x as c}from"./react-B9IgSVeK.js";import{B as l,Si as u,_i as d,bi as f,c as p,et as m,gi as h,gn as g,ti as _,xi as v,yi as y}from"./icons-QG1KAFmx.js";var b=e(c(),1),x={"sun.max.fill":{icon:l,className:`text-orange-500`},"cloud.sun.fill":{icon:d,className:`text-amber-400`},"moon.fill":{icon:g,className:`text-blue-400`},"cloud.moon.fill":{icon:f,className:`text-blue-400`},"cloud.fill":{icon:h,className:`text-stone-400`},"cloud.rain.fill":{icon:y,className:`text-blue-400`},snowflake:{icon:m,className:`text-blue-300`},"cloud.bolt.fill":{icon:v,className:`text-orange-500`},"cloud.fog.fill":{icon:u,className:`text-stone-400`}},S={sunny:{icon:l,className:`text-orange-500`},clear:{icon:l,className:`text-orange-500`},"partly cloudy":{icon:d,className:`text-amber-400`},"mostly sunny":{icon:d,className:`text-amber-400`},cloudy:{icon:h,className:`text-stone-400`},overcast:{icon:h,className:`text-stone-400`},rainy:{icon:y,className:`text-blue-400`},rain:{icon:y,className:`text-blue-400`},drizzle:{icon:y,className:`text-blue-400`},snow:{icon:m,className:`text-blue-300`},snowy:{icon:m,className:`text-blue-300`},thunderstorm:{icon:v,className:`text-orange-500`},thunder:{icon:v,className:`text-orange-500`},foggy:{icon:u,className:`text-stone-400`},fog:{icon:u,className:`text-stone-400`},mist:{icon:u,className:`text-stone-400`},hazy:{icon:u,className:`text-stone-400`},night:{icon:g,className:`text-blue-400`},"mainly clear":{icon:l,className:`text-orange-500`},"mostly cloudy":{icon:h,className:`text-stone-400`},breezy:{icon:p,className:`text-stone-400`},windy:{icon:p,className:`text-stone-400`},cool:{icon:h,className:`text-stone-400`},warm:{icon:l,className:`text-orange-500`},hot:{icon:l,className:`text-orange-500`},cold:{icon:m,className:`text-blue-300`},"cold snap":{icon:m,className:`text-blue-300`},"warm, mostly sunny":{icon:d,className:`text-amber-400`},"cooler, breezy":{icon:p,className:`text-stone-400`}},C={icon:h,className:`text-stone-400`};function w(e){let t=x[e];if(t)return t;let n=e.toLowerCase(),r=S[n];if(r)return r;for(let[e,t]of Object.entries(S))if(n.includes(e))return t;return C}function T(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function E(e){let t;if(typeof e.location==`string`)t=e.location;else{let n=r(e.location);n&&typeof n.name==`string`&&(t=n.name)}if(!t)return null;let o=r(e.current),s=i(o?.temp)??i(e.currentTemp)??i(e.temperature)??i(e.temp),c=i(o?.feelsLike)??i(o?.feels_like)??i(o?.apparentTemperature)??i(e.feelsLike)??i(e.feels_like)??i(e.apparentTemperature),l=a(o?.condition)??a(e.condition),u=i(o?.humidity)??i(e.humidity),d=T(o?.wind??e.wind),f=i(o?.windSpeed)??i(o?.wind_speed)??i(e.windSpeed)??i(e.wind_speed)??d.speed,p=a(o?.windDirection)??a(o?.wind_direction)??a(e.windDirection)??a(e.wind_direction)??d.direction,m=r(e.units),h=a(m?.temperature)??a(o?.unit)??a(e.unit)??`F`,g=a(m?.speed)??a(e.windUnit)??a(e.wind_unit),_=n(e.hourly).map((e,t)=>({id:a(e.id)??String(t),time:a(e.time)??``,icon:a(e.icon)??a(e.condition)??`cloud.fill`,temp:i(e.tempC)??i(e.temp)??i(e.temperature),tempC:i(e.tempC)})),v=n([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:a(e.id)??String(t),day:a(e.day)??a(e.date),dayLabel:a(e.dayLabel)??a(e.date),icon:a(e.icon)??a(e.condition)??`cloud.fill`,low:i(e.low),high:i(e.high),lowC:i(e.lowC),highC:i(e.highC),precip:i(e.precip)??i(e.precipitation)??i(e.precipitationProbability),condition:a(e.condition)}));return{location:t,currentTemp:s,feelsLike:c,condition:l,humidity:u,windSpeed:f,windDirection:p,windUnit:g,unit:h,hourly:_.length>0?_:void 0,forecast:v.length>0?v:void 0}}function D(e){return e*9/5+32}function O(e){return(e-32)*5/9}function k(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=O(e)),!t&&n&&(r=D(e)),`${Math.round(r)}`}function A(e,t,n){return e.tempC===void 0?e.temp===void 0?null:k(e.temp,t,n):k(e.tempC,!1,n)}function j(e,t,n){return e.lowC===void 0?k(e.low,t,n):k(e.lowC,!1,n)}function M(e,t,n){return e.highC===void 0?k(e.high,t,n):k(e.highC,!1,n)}var N=s();function P({icon:e,size:t=20}){let{icon:n,className:r}=w(e);return(0,N.jsx)(n,{width:t,height:t,className:r})}function F({useFahrenheit:e,onToggle:n}){let{t:r}=o(`chat`);return(0,N.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(!0),className:t(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:r(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(!1),className:t(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:r(`weatherForecastDisplay.celsius`)})]})}function I({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let{t:i}=o(`chat`),a=e.location,s=k(e.currentTemp,t,n),c=k(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?M(u,t,n):null,f=u?j(u,t,n):null,m=null;return e.windSpeed!==void 0&&(m=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(m=`${e.windDirection} ${m}`)),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:a}),s!==null&&(0,N.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[s,`°`,l]}),e.condition&&(0,N.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,N.jsx)(F,{useFahrenheit:n,onToggle:r})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[c!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.feelsLike`,{temp:c})}),d!==null&&f!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.highLow`,{high:d,low:f})}),m&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(p,{width:12,height:12}),m]}),e.humidity!==void 0&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(_,{width:12,height:12}),e.humidity,`%`]})]})]})}function L({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){let{t:r}=o(`chat`);return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,i)=>{let a=e.time.toLowerCase()===`now`,o=A(e,t,n);return(0,N.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,N.jsx)(`span`,{className:a?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:a?r(`weatherForecastDisplay.now`):e.time}),(0,N.jsx)(P,{icon:e.icon,size:18}),o!==null&&(0,N.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[o,`°`]})]},e.id??i)})})})}function R({forecast:e,currentTemp:n,sourceIsFahrenheit:r,useFahrenheit:i}){let{globalMin:a,globalMax:o}=(0,b.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=j(e,r,i),f=M(e,r,i),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&n!==void 0){let t=(e.lowC!==void 0||e.highC!==void 0)&&r?(n-32)*5/9:n;y=h===m?50:(Math.max(m,Math.min(h,t))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:t(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,N.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,N.jsx)(P,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,N.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,N.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,N.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function z({templateData:e,fallback:t}){let n=(0,b.useMemo)(()=>E(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,b.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,N.jsxs)(`div`,{className:`mt-3`,children:[(0,N.jsx)(I,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,N.jsx)(L,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,N.jsx)(R,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{z as WeatherForecastDisplay};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ha as t,Jt as n,Xt as r,Yt as i,Zt as a}from"./app-p4YU9h0P.js";import{j as o}from"./vendor-DYOeoIwg.js";import{t as s,x as c}from"./react-B9IgSVeK.js";import{B as l,Si as u,_i as d,bi as f,c as p,et as m,gi as h,gn as g,ti as _,xi as v,yi as y}from"./icons-QG1KAFmx.js";var b=e(c(),1),x={"sun.max.fill":{icon:l,className:`text-orange-500`},"cloud.sun.fill":{icon:d,className:`text-amber-400`},"moon.fill":{icon:g,className:`text-blue-400`},"cloud.moon.fill":{icon:f,className:`text-blue-400`},"cloud.fill":{icon:h,className:`text-stone-400`},"cloud.rain.fill":{icon:y,className:`text-blue-400`},snowflake:{icon:m,className:`text-blue-300`},"cloud.bolt.fill":{icon:v,className:`text-orange-500`},"cloud.fog.fill":{icon:u,className:`text-stone-400`}},S={sunny:{icon:l,className:`text-orange-500`},clear:{icon:l,className:`text-orange-500`},"partly cloudy":{icon:d,className:`text-amber-400`},"mostly sunny":{icon:d,className:`text-amber-400`},cloudy:{icon:h,className:`text-stone-400`},overcast:{icon:h,className:`text-stone-400`},rainy:{icon:y,className:`text-blue-400`},rain:{icon:y,className:`text-blue-400`},drizzle:{icon:y,className:`text-blue-400`},snow:{icon:m,className:`text-blue-300`},snowy:{icon:m,className:`text-blue-300`},thunderstorm:{icon:v,className:`text-orange-500`},thunder:{icon:v,className:`text-orange-500`},foggy:{icon:u,className:`text-stone-400`},fog:{icon:u,className:`text-stone-400`},mist:{icon:u,className:`text-stone-400`},hazy:{icon:u,className:`text-stone-400`},night:{icon:g,className:`text-blue-400`},"mainly clear":{icon:l,className:`text-orange-500`},"mostly cloudy":{icon:h,className:`text-stone-400`},breezy:{icon:p,className:`text-stone-400`},windy:{icon:p,className:`text-stone-400`},cool:{icon:h,className:`text-stone-400`},warm:{icon:l,className:`text-orange-500`},hot:{icon:l,className:`text-orange-500`},cold:{icon:m,className:`text-blue-300`},"cold snap":{icon:m,className:`text-blue-300`},"warm, mostly sunny":{icon:d,className:`text-amber-400`},"cooler, breezy":{icon:p,className:`text-stone-400`}},C={icon:h,className:`text-stone-400`};function w(e){let t=x[e];if(t)return t;let n=e.toLowerCase(),r=S[n];if(r)return r;for(let[e,t]of Object.entries(S))if(n.includes(e))return t;return C}function T(e){if(typeof e==`string`){let t=e.match(/^(\d+)\s*mph\s*(.*)/i);if(t)return{speed:Number(t[1]),direction:t[2]?.trim()||void 0}}return{}}function E(e){let t;if(typeof e.location==`string`)t=e.location;else{let n=r(e.location);n&&typeof n.name==`string`&&(t=n.name)}if(!t)return null;let o=r(e.current),s=i(o?.temp)??i(e.currentTemp)??i(e.temperature)??i(e.temp),c=i(o?.feelsLike)??i(o?.feels_like)??i(o?.apparentTemperature)??i(e.feelsLike)??i(e.feels_like)??i(e.apparentTemperature),l=a(o?.condition)??a(e.condition),u=i(o?.humidity)??i(e.humidity),d=T(o?.wind??e.wind),f=i(o?.windSpeed)??i(o?.wind_speed)??i(e.windSpeed)??i(e.wind_speed)??d.speed,p=a(o?.windDirection)??a(o?.wind_direction)??a(e.windDirection)??a(e.wind_direction)??d.direction,m=r(e.units),h=a(m?.temperature)??a(o?.unit)??a(e.unit)??`F`,g=a(m?.speed)??a(e.windUnit)??a(e.wind_unit),_=n(e.hourly).map((e,t)=>({id:a(e.id)??String(t),time:a(e.time)??``,icon:a(e.icon)??a(e.condition)??`cloud.fill`,temp:i(e.tempC)??i(e.temp)??i(e.temperature),tempC:i(e.tempC)})),v=n([e.forecast,e.daily,e.days].find(Array.isArray)).map((e,t)=>({id:a(e.id)??String(t),day:a(e.day)??a(e.date),dayLabel:a(e.dayLabel)??a(e.date),icon:a(e.icon)??a(e.condition)??`cloud.fill`,low:i(e.low),high:i(e.high),lowC:i(e.lowC),highC:i(e.highC),precip:i(e.precip)??i(e.precipitation)??i(e.precipitationProbability),condition:a(e.condition)}));return{location:t,currentTemp:s,feelsLike:c,condition:l,humidity:u,windSpeed:f,windDirection:p,windUnit:g,unit:h,hourly:_.length>0?_:void 0,forecast:v.length>0?v:void 0}}function D(e){return e*9/5+32}function O(e){return(e-32)*5/9}function k(e,t,n){if(e===void 0)return null;let r=e;return t&&!n&&(r=O(e)),!t&&n&&(r=D(e)),`${Math.round(r)}`}function A(e,t,n){return e.tempC===void 0?e.temp===void 0?null:k(e.temp,t,n):k(e.tempC,!1,n)}function j(e,t,n){return e.lowC===void 0?k(e.low,t,n):k(e.lowC,!1,n)}function M(e,t,n){return e.highC===void 0?k(e.high,t,n):k(e.highC,!1,n)}var N=s();function P({icon:e,size:t=20}){let{icon:n,className:r}=w(e);return(0,N.jsx)(n,{width:t,height:t,className:r})}function F({useFahrenheit:e,onToggle:n}){let{t:r}=o(`chat`);return(0,N.jsxs)(`div`,{className:`flex overflow-hidden rounded-md border border-[var(--border-element)]`,children:[(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(!0),className:t(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-[var(--primary-base)] text-[var(--content-inset)]`:`bg-transparent text-[var(--content-quiet)]`),children:r(`weatherForecastDisplay.fahrenheit`)}),(0,N.jsx)(`button`,{type:`button`,onClick:()=>n(!1),className:t(`px-2 py-0.5 text-body-small-default transition-colors`,e?`bg-transparent text-[var(--content-quiet)]`:`bg-[var(--primary-base)] text-[var(--content-inset)]`),children:r(`weatherForecastDisplay.celsius`)})]})}function I({data:e,sourceIsFahrenheit:t,useFahrenheit:n,onToggle:r}){let{t:i}=o(`chat`),a=e.location,s=k(e.currentTemp,t,n),c=k(e.feelsLike,t,n),l=n?`F`:`C`,u=e.forecast?.[0],d=u?M(u,t,n):null,f=u?j(u,t,n):null,m=null;return e.windSpeed!==void 0&&(m=`${Math.round(e.windSpeed)} ${e.windUnit??`mph`}`,e.windDirection&&(m=`${e.windDirection} ${m}`)),(0,N.jsxs)(`div`,{children:[(0,N.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,N.jsxs)(`div`,{children:[(0,N.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:a}),s!==null&&(0,N.jsxs)(`div`,{className:`mt-1 text-4xl font-light text-[var(--content-default)]`,children:[s,`°`,l]}),e.condition&&(0,N.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-quiet)]`,children:e.condition})]}),(0,N.jsx)(F,{useFahrenheit:n,onToggle:r})]}),(0,N.jsxs)(`div`,{className:`mt-2 flex flex-wrap items-center gap-3`,children:[c!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.feelsLike`,{temp:c})}),d!==null&&f!==null&&(0,N.jsx)(`span`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:i(`weatherForecastDisplay.highLow`,{high:d,low:f})}),m&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(p,{width:12,height:12}),m]}),e.humidity!==void 0&&(0,N.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--tag-bg-neutral)] px-2 py-0.5 text-label-medium-default text-[var(--content-tertiary)]`,children:[(0,N.jsx)(_,{width:12,height:12}),e.humidity,`%`]})]})]})}function L({hourly:e,sourceIsFahrenheit:t,useFahrenheit:n}){let{t:r}=o(`chat`);return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex gap-3 overflow-x-auto`,children:e.map((e,i)=>{let a=e.time.toLowerCase()===`now`,o=A(e,t,n);return(0,N.jsxs)(`div`,{className:`flex min-w-[3rem] shrink-0 flex-col items-center gap-1`,children:[(0,N.jsx)(`span`,{className:a?`text-body-small-emphasised text-[var(--content-default)]`:`text-label-medium-default text-[var(--content-quiet)]`,children:a?r(`weatherForecastDisplay.now`):e.time}),(0,N.jsx)(P,{icon:e.icon,size:18}),o!==null&&(0,N.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-default)]`,children:[o,`°`]})]},e.id??i)})})})}function R({forecast:e,currentTemp:n,sourceIsFahrenheit:r,useFahrenheit:i}){let{globalMin:a,globalMax:o}=(0,b.useMemo)(()=>{let t=1/0,n=-1/0;for(let r of e){let e=r.lowC??r.low,i=r.highC??r.high;e!==void 0&&e<t&&(t=e),i!==void 0&&i>n&&(n=i)}return{globalMin:t===1/0?0:t,globalMax:n===-1/0?100:n}},[e]),s=o-a||1;return(0,N.jsx)(`div`,{className:`mt-3 border-t border-[var(--border-element)] pt-3`,children:(0,N.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map((e,c)=>{let l=e.dayLabel??e.day??`Day ${c+1}`,u=l.toLowerCase()===`today`,d=j(e,r,i),f=M(e,r,i),p=e.precip,m=e.lowC??e.low??a,h=e.highC??e.high??o,g=(m-a)/s*100,_=(h-a)/s*100,v=Math.max(_-g,2),y=null;if(u&&n!==void 0){let t=(e.lowC!==void 0||e.highC!==void 0)&&r?(n-32)*5/9:n;y=h===m?50:(Math.max(m,Math.min(h,t))-m)/(h-m)*100}return(0,N.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,N.jsx)(`span`,{className:t(`w-12 shrink-0 truncate text-body-small-default`,u?`text-[var(--content-default)]`:`text-[var(--content-quiet)]`),children:l}),(0,N.jsxs)(`div`,{className:`flex w-10 shrink-0 items-center justify-center gap-0.5`,children:[(0,N.jsx)(P,{icon:e.icon,size:16}),p!==void 0&&p>0&&(0,N.jsxs)(`span`,{className:`text-label-small-default text-blue-400`,children:[Math.round(p),`%`]})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-faint)]`,children:d===null?`--`:`${d}°`}),(0,N.jsxs)(`div`,{className:`relative h-1.5 flex-1 overflow-hidden rounded-full bg-[var(--border-subtle)]`,children:[(0,N.jsx)(`div`,{className:`absolute top-0 h-full rounded-full bg-[var(--primary-base)]`,style:{left:`${g}%`,width:`${v}%`}}),y!==null&&(0,N.jsx)(`div`,{className:`absolute top-1/2 h-2.5 w-2.5 -translate-x-1/2 -translate-y-1/2 rounded-full border-2 border-[var(--aux-white)] bg-[var(--aux-white)] shadow-sm`,style:{left:`${g+y/100*v}%`}})]}),(0,N.jsx)(`span`,{className:`w-7 shrink-0 text-right text-body-small-default text-[var(--content-default)]`,children:f===null?`--`:`${f}°`})]},e.id??c)})})})}function z({templateData:e,fallback:t}){let n=(0,b.useMemo)(()=>E(e),[e]),r=n?.unit?.toUpperCase()===`F`||n?.unit?.toLowerCase()===`fahrenheit`,[i,a]=(0,b.useState)(null),o=i??r;return!n||n.currentTemp===void 0&&!n.forecast?.length?t??null:(0,N.jsxs)(`div`,{className:`mt-3`,children:[(0,N.jsx)(I,{data:n,sourceIsFahrenheit:r,useFahrenheit:o,onToggle:a}),n.hourly&&n.hourly.length>0&&(0,N.jsx)(L,{hourly:n.hourly,sourceIsFahrenheit:r,useFahrenheit:o}),n.forecast&&n.forecast.length>0&&(0,N.jsx)(R,{forecast:n.forecast,currentTemp:n.currentTemp,sourceIsFahrenheit:r,useFahrenheit:o})]})}export{z as WeatherForecastDisplay};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Kr as e,Tb as t,Ty as n}from"./app-
|
|
1
|
+
import{Kr as e,Tb as t,Ty as n}from"./app-p4YU9h0P.js";import{j as r}from"./vendor-DYOeoIwg.js";import{f as i,t as a}from"./react-B9IgSVeK.js";import{t as o}from"./auth-welcome-screen-pfPKjv5w.js";var s=a();function c(){let{t:a}=r(`onboarding`),c=i();return(0,s.jsx)(o,{secondary:{label:a(`welcome.continueWithoutAccount`),onSelect:()=>{n()?c(t.selectAssistant,e):c(t.onboarding.hosting,e)}}})}export{c as WelcomeScreen};
|