@vellumai/web 0.12.2-dev.202609170044.9cbb729 → 0.12.2-dev.202609170127.2eef54c
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-CPOepgSQ.js → a2a-invite-CGyWwrVb.js} +1 -1
- package/dist/assets/{about-page-mvJO6yza.js → about-page-CpXKAK5Z.js} +1 -1
- package/dist/assets/{account-page-yyir0M2y.js → account-page-cpDusq21.js} +1 -1
- package/dist/assets/{account-shell-B5314FtI.js → account-shell-D1_mSHj9.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-BYr2gH9F.js → acp-run-detail-panel-D_bA-uwm.js} +1 -1
- package/dist/assets/{activation-list-route-dhx_UhFW.js → activation-list-route-_x10pg_q.js} +1 -1
- package/dist/assets/{activity-redirect-page-Cyo877Rg.js → activity-redirect-page-CLc8hSfC.js} +1 -1
- package/dist/assets/{activity-steps-panel-DKg15Oc4.js → activity-steps-panel-YPKDTvLp.js} +1 -1
- package/dist/assets/{add-credits-modal-CzpgEkT9.js → add-credits-modal-CXIeeHpM.js} +1 -1
- package/dist/assets/add-credits-modal-Lw_orElQ.js +1 -0
- package/dist/assets/{ai-page-CBX1v1tS.js → ai-page-532485Rg.js} +1 -1
- package/dist/assets/{android-billing-handoff-CWqhP_0I.js → android-billing-handoff-BjLOXHzL.js} +1 -1
- package/dist/assets/{api-key-screen-DKzLIFst.js → api-key-screen-DBRohhxk.js} +1 -1
- package/dist/assets/{app-BffxeWB8.js → app-Bevxq2OH.js} +13 -13
- package/dist/assets/{app-info-DsEx-jq_.js → app-info-CLe39i6W.js} +1 -1
- package/dist/assets/{archive-redirect-page-BK_dY4v-.js → archive-redirect-page-CrqrZE0I.js} +1 -1
- package/dist/assets/{assistant-status-panel-BSioaCpK.js → assistant-status-panel-D0GMw4-F.js} +1 -1
- package/dist/assets/auth-store-CpWb7YyB.js +1 -0
- package/dist/assets/{auth-welcome-screen-LyL7WDL8.js → auth-welcome-screen-DqyGTmht.js} +1 -1
- package/dist/assets/avatar-bundled-components-Dg1tq-xF.js +1 -0
- package/dist/assets/{avatar-random-DIn9GmRk.js → avatar-random-Bg-JtW3h.js} +2 -2
- package/dist/assets/{await-org-header-settled-DNIo8_Tf.js → await-org-header-settled-CPTObvNn.js} +1 -1
- package/dist/assets/{background-task-detail-panel-HleNtRAe.js → background-task-detail-panel-BVlprJsr.js} +1 -1
- package/dist/assets/{billing-page-DbEVS2q_.js → billing-page-7AqrZkVw.js} +3 -3
- package/dist/assets/{billing-redirect-page-CdcCmEUc.js → billing-redirect-page-CBdGeWQH.js} +1 -1
- package/dist/assets/{bookmarks-page-CUi4LhrR.js → bookmarks-page-BlaJ96ej.js} +1 -1
- package/dist/assets/{bundle-confirm-page-Tz6RPE2c.js → bundle-confirm-page-C-nGTAWg.js} +1 -1
- package/dist/assets/{channel-transcript-panel-gPgCvcoI.js → channel-transcript-panel-C8sNJBUg.js} +1 -1
- package/dist/assets/{channels-page-route-D8adodpU.js → channels-page-route-Ccf07m7d.js} +1 -1
- package/dist/assets/{chat-info-panel-jeK_s1xx.js → chat-info-panel-Dc7yOSba.js} +1 -1
- package/dist/assets/{checkout-continuation-BJuTfVL4.js → checkout-continuation-DndPlOQH.js} +1 -1
- package/dist/assets/{checkout-page-BEB-CumM.js → checkout-page-BubQ6HKx.js} +1 -1
- package/dist/assets/checkout-return-target-UI7zqK_V.js +1 -0
- package/dist/assets/command-palette-C1EnF4gm.js +1 -0
- package/dist/assets/{command-palette-CWDqjKuB.js → command-palette-CMP9k9JI.js} +1 -1
- package/dist/assets/{command-palette-window-page-C0OorhM_.js → command-palette-window-page-BiTxCLMC.js} +1 -1
- package/dist/assets/{community-page-Dp56nq4K.js → community-page-BnK8lv_7.js} +1 -1
- package/dist/assets/{companion-accent-BkhXA9n8.js → companion-accent-Cw1QrON6.js} +1 -1
- package/dist/assets/{companion-dock-zones-page-BiaNWu9U.js → companion-dock-zones-page-BDH8JnN-.js} +1 -1
- package/dist/assets/{companion-layout-CPz7l-4W.js → companion-layout-DY7WNHKB.js} +1 -1
- package/dist/assets/{companion-popover-Wr9gfDIe.js → companion-popover-CrjiSDbu.js} +1 -1
- package/dist/assets/{companion-popover-page-PVlrSn4w.js → companion-popover-page-CySPinox.js} +1 -1
- package/dist/assets/{companion-surface-page-Dp_CShHP.js → companion-surface-page-BOo03Cql.js} +1 -1
- package/dist/assets/{companion-watch-frame-page-CVY57Wpn.js → companion-watch-frame-page-D0gmPDdg.js} +1 -1
- package/dist/assets/{connect-page-BSje-9ym.js → connect-page-ASh20AlX.js} +1 -1
- package/dist/assets/{consent-controls-Bz_IOnmZ.js → consent-controls-CEkwbqJw.js} +1 -1
- package/dist/assets/{contacts-gateway-CY5vUfM2.js → contacts-gateway-BFbyNbl_.js} +1 -1
- package/dist/assets/{contacts-page-route-JRYP87zz.js → contacts-page-route-Dq0E2ER7.js} +1 -1
- package/dist/assets/{copy-button-BuISIxU2.js → copy-button-CpRMm23v.js} +1 -1
- package/dist/assets/{credential-entry-page-D2GsP2g5.js → credential-entry-page-7W319fSF.js} +1 -1
- package/dist/assets/{credentials-page-B2B50A98.js → credentials-page-CZjpoj-1.js} +1 -1
- package/dist/assets/{csv-preview--DFbpKhn.js → csv-preview-BntRaLY3.js} +1 -1
- package/dist/assets/{danger-zone-redirect-page-BizWd5Ru.js → danger-zone-redirect-page-BIJ7iH3z.js} +1 -1
- package/dist/assets/{debug-page-C5iUTBcy.js → debug-page-5TIa2DWf.js} +1 -1
- package/dist/assets/{deploy-dialogs-Cb2DGIT-.js → deploy-dialogs-6ed2FkO5.js} +1 -1
- package/dist/assets/deploy-dialogs-Gj5nNCwe.js +1 -0
- package/dist/assets/{desktop-preview-content-C-2TO84E.js → desktop-preview-content-C8-eBvWs.js} +2 -2
- package/dist/assets/{desktop-status-Cq9tSoVe.js → desktop-status-Bb9_j80h.js} +1 -1
- package/dist/assets/{desktop-viewer-BFoFR7Sg.js → desktop-viewer-B1LngIwF.js} +1 -1
- package/dist/assets/{detail-card-B3_bSihf.js → detail-card-BwHvhGMs.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-DOTn90Cm.js → detail-panel-stop-button-CeSH5ncG.js} +1 -1
- package/dist/assets/{detail-primitives-Bc5PDjkl.js → detail-primitives-DscaN9rD.js} +1 -1
- package/dist/assets/{developer-page-CWg9QzIf.js → developer-page-BAPxl51t.js} +1 -1
- package/dist/assets/{devices-redirect-page-c67PRqw0.js → devices-redirect-page-CL5kygqy.js} +1 -1
- package/dist/assets/{dictation-overlay-page-UYCz2T3V.js → dictation-overlay-page-CqBYNqCX.js} +1 -1
- package/dist/assets/{document-load-DHCCLogD.js → document-load-D6zwCeMh.js} +1 -1
- package/dist/assets/document-load-DwJmiaST.js +1 -0
- package/dist/assets/{document-viewer-page-ClJvwnU-.js → document-viewer-page-CgUpLtrR.js} +1 -1
- package/dist/assets/{emails-page-2ou2eAkW.js → emails-page-B3KXvdQh.js} +1 -1
- package/dist/assets/{environment-store-Dka2FZhs.js → environment-store-gXJzyQ9n.js} +1 -1
- package/dist/assets/{file-diff-view-BmdOQaeZ.js → file-diff-view-gj5qz7ac.js} +1 -1
- package/dist/assets/{file-editor--nn3ZR0r.js → file-editor-yxcARNDB.js} +1 -1
- package/dist/assets/{general-page-uvMmHHyl.js → general-page-Be2OEMQv.js} +1 -1
- package/dist/assets/{hatching-screen-C5Hdkxta.js → hatching-screen-Os08fIB7.js} +1 -1
- package/dist/assets/{hosting-screen-D3yRf7Vz.js → hosting-screen-KGS2hNnI.js} +1 -1
- package/dist/assets/{identity-page-route-CBystW_n.js → identity-page-route-CcWEsb73.js} +1 -1
- package/dist/assets/{inspect-page-VMZxgoOP.js → inspect-page-BqwGgtCg.js} +3 -3
- package/dist/assets/{integrations-page-_YxXV8LC.js → integrations-page-DxXjeCOU.js} +1 -1
- package/dist/assets/{intelligence-layout-COHWei3O.js → intelligence-layout-0GHP1abK.js} +1 -1
- package/dist/assets/intelligence-layout-slots-store-DO8r8MbX.js +1 -0
- package/dist/assets/{keyboard-shortcuts-redirect-page-CkO8sqRv.js → keyboard-shortcuts-redirect-page-D8Sd0awe.js} +1 -1
- package/dist/assets/{latest-assistant-text-px--r87U.js → latest-assistant-text-CFfTfLEE.js} +1 -1
- package/dist/assets/{library-detail-page-BROUcqvW.js → library-detail-page-hchQ6i_Z.js} +1 -1
- package/dist/assets/{library-page-D8lvqAnn.js → library-page-DCcuCaVz.js} +1 -1
- package/dist/assets/local-mode-BF0BHVrs.js +1 -0
- package/dist/assets/{login-page-KwB7QV63.js → login-page-CFu2kSt0.js} +1 -1
- package/dist/assets/{logout-page-BS_b3wIp.js → logout-page-TdBoJnoW.js} +1 -1
- package/dist/assets/{logs-layout-3574H70Q.js → logs-layout-CB0oUcCN.js} +1 -1
- package/dist/assets/{markdown-preview-BQBD4nZl.js → markdown-preview-DFx6LTIB.js} +1 -1
- package/dist/assets/{media-preview-B8dzo6SD.js → media-preview-s9zPdEVg.js} +1 -1
- package/dist/assets/{memory-page-route-lL9WqSlP.js → memory-page-route-BfiwTjz6.js} +1 -1
- package/dist/assets/{memory-router-playground-page-Xn90HoK0.js → memory-router-playground-page-BMqYc2PM.js} +1 -1
- package/dist/assets/{message-files-panel-BLVYF2bR.js → message-files-panel-DFgNQOkk.js} +1 -1
- package/dist/assets/{metric-card-qtWiXfjv.js → metric-card-Cp9VXC7R.js} +1 -1
- package/dist/assets/native-attachment-pickers-Da2NEx1r.js +1 -0
- package/dist/assets/native-file-BE23yEsJ.js +1 -0
- package/dist/assets/{notifications-page-Butll45i.js → notifications-page-B9YszO_J.js} +1 -1
- package/dist/assets/{oauth-complete-page-CEcHbwIV.js → oauth-complete-page-BNh9-xUX.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-D3zQC3el.js → oauth-popup-complete-page-IDBMA6bj.js} +1 -1
- package/dist/assets/paired-platform-identity-CV09bF6L.js +1 -0
- package/dist/assets/{pairing-page-BfAzRCkh.js → pairing-page-BiagkAmV.js} +1 -1
- package/dist/assets/password-reset-page-BnC4ZtAH.js +1 -0
- package/dist/assets/{pdf-file-preview-BNNzH1Lj.js → pdf-file-preview-DyZKuW6K.js} +1 -1
- package/dist/assets/{personality-page-pYkfDoiT.js → personality-page-CaVp-IFA.js} +1 -1
- package/dist/assets/{personality-page-C9g8m-ZV.js → personality-page-D9S6ceuR.js} +1 -1
- package/dist/assets/{personality-sliders-vC7qRQZ4.js → personality-sliders-B8XJXHql.js} +1 -1
- package/dist/assets/{plans-page-Cqz11rXC.js → plans-page-COqIWjjU.js} +1 -1
- package/dist/assets/{platform-loopback-page-zI5kt-1B.js → platform-loopback-page-Be6zZTjk.js} +1 -1
- package/dist/assets/{plugin-detail-page-BVUJF_Z0.js → plugin-detail-page-B7rDYqFA.js} +1 -1
- package/dist/assets/{plugins-page-grMYw6ca.js → plugins-page-CLR2LTmD.js} +1 -1
- package/dist/assets/plugins-surface-DV2Ze-pt.js +1 -0
- package/dist/assets/{preview-error-DAI-w4oR.js → preview-error-BJZmVu5_.js} +1 -1
- package/dist/assets/{privacy-page-CkYCyPUl.js → privacy-page-DoWHQiAM.js} +1 -1
- package/dist/assets/{privacy-screen-C8KSanLw.js → privacy-screen-CqHYvdcC.js} +1 -1
- package/dist/assets/{provider-callback-page-CaXQeoGc.js → provider-callback-page-CoDo_LGa.js} +1 -1
- package/dist/assets/{provider-key-CMRKdOp6.js → provider-key-CdT-QLy6.js} +1 -1
- package/dist/assets/{provider-signup-page-pmWAHHvg.js → provider-signup-page-BqLSsqmz.js} +1 -1
- package/dist/assets/{quick-input-page-D2Ps4Nn9.js → quick-input-page-DNQrrRym.js} +1 -1
- package/dist/assets/referral-modal-Cb9yHvB_.js +1 -0
- package/dist/assets/{referral-modal-T0tz9cKz.js → referral-modal-Cxu42QEQ.js} +1 -1
- package/dist/assets/{research-mock-page-C2hO1AJp.js → research-mock-page-BGxSDObT.js} +1 -1
- package/dist/assets/{research-onboarding-route-YUY_VAoR.js → research-onboarding-route-DIsnSqMQ.js} +1 -1
- package/dist/assets/{review-terms-screen-ClCuevTT.js → review-terms-screen-DO7ygsE4.js} +1 -1
- package/dist/assets/routes-CBqv5JWO.js +1 -0
- package/dist/assets/{schedules-C4v6G4Yl.js → schedules-BVvKpKi_.js} +1 -1
- package/dist/assets/{schedules-page-BEE6gG-0.js → schedules-page-DMg82o_w.js} +1 -1
- package/dist/assets/{security-redirect-page-CfHdAiGm.js → security-redirect-page-Dt9NUQpQ.js} +1 -1
- package/dist/assets/{select-assistant-screen-uEMd-mms.js → select-assistant-screen-C_lmPTkj.js} +1 -1
- package/dist/assets/{self-hosted-servers-qDFPnEcM.js → self-hosted-servers-rVknxhh5.js} +1 -1
- package/dist/assets/{service-form-controls-DTOMkj0Y.js → service-form-controls-Dtw6VZjE.js} +1 -1
- package/dist/assets/{setting-row-snAhMVc8.js → setting-row-Dl37RqUe.js} +1 -1
- package/dist/assets/{settings-divider-DAr-iUO3.js → settings-divider-CqLEhf9T.js} +1 -1
- package/dist/assets/{settings-layout-iM3mkXFz.js → settings-layout-g2w2BcMj.js} +1 -1
- package/dist/assets/share-feedback-modal-Cw4b0uTf.js +1 -0
- package/dist/assets/{share-feedback-modal-BkIQkrgI.js → share-feedback-modal-DQOqrbac.js} +1 -1
- package/dist/assets/{sidebar-tree-Ar6vYFqW.js → sidebar-tree-AAmgDds0.js} +1 -1
- package/dist/assets/{signup-page-DP1R2EYG.js → signup-page-Bo3kV3uI.js} +1 -1
- package/dist/assets/{signup-shell-DDOwFm8f.js → signup-shell-BFlnJZeT.js} +1 -1
- package/dist/assets/{skill-detail-page-tlOn1SgY.js → skill-detail-page-D3aEzdPR.js} +1 -1
- package/dist/assets/{skill-detail-panel-BT-gwhZC.js → skill-detail-panel-p4BBQO99.js} +1 -1
- package/dist/assets/{skill-removal-dialog-BKxKHM93.js → skill-removal-dialog-DDrOdXOm.js} +1 -1
- package/dist/assets/{skills-page-CNDvB7S4.js → skills-page-C6d2b4U2.js} +1 -1
- package/dist/assets/{sounds-page-CB-BYrIs.js → sounds-page-DcDVb904.js} +1 -1
- package/dist/assets/{start-screen-TdesbZb_.js → start-screen-xNv_UqZY.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-DPCuG3ZL.js → stt-language-picker-modal-ClWhCUb4.js} +1 -1
- package/dist/assets/{subagent-detail-panel-CZ80KyIm.js → subagent-detail-panel-Br1VLPKI.js} +1 -1
- package/dist/assets/{superpowers-page-CWF29nBb.js → superpowers-page-4mJC8gCY.js} +1 -1
- package/dist/assets/{system-events-page-1v0djQRa.js → system-events-page-BxTLnX53.js} +1 -1
- package/dist/assets/{system-events-redirect-page-H4jpP5pT.js → system-events-redirect-page-sTK7jdID.js} +1 -1
- package/dist/assets/{text-preview-DSjmL18D.js → text-preview-ByPfVkyx.js} +1 -1
- package/dist/assets/{theme-stage-page-DW2rC9j9.js → theme-stage-page-BUDy_3aW.js} +1 -1
- package/dist/assets/{tiptap-document-editor-nrxutBtH.js → tiptap-document-editor-D0xp5ZOs.js} +1 -1
- package/dist/assets/tool-detail-panel-DkIHPygu.js +1 -0
- package/dist/assets/tool-detail-panel-aNvOK4DH.js +15 -0
- package/dist/assets/{trait-cycle-row-BSA19j9_.js → trait-cycle-row-DxnV3-Yt.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-DTHemN5k.js → upgrade-cancel-page-C30oAeVw.js} +1 -1
- package/dist/assets/{upgrade-success-page-CIFrIxM0.js → upgrade-success-page-oW6vbrAs.js} +1 -1
- package/dist/assets/{usage-redirect-page-Cq63trs2.js → usage-redirect-page-CgUD4SND.js} +1 -1
- package/dist/assets/{use-app-delete-BE_RhdkC.js → use-app-delete-CKSNRj2W.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-CrtLW4Dl.js → use-assistant-identity-details-V-aHH_Fd.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-Ch1dFcBe.js → use-checkout-dismiss-refresh-3vETASUz.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-DCbPXF6z.js → use-edge-swipe-back-iYvf5Z3Y.js} +1 -1
- package/dist/assets/{use-hotkey-recorder-v5Akb2eM.js → use-hotkey-recorder-D_xoveSa.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-BWou3cIT.js → use-invite-link-dialog-BmO2UW56.js} +1 -1
- package/dist/assets/{use-platform-assistant-id-eSCNuEeV.js → use-platform-assistant-id-B2zxeseH.js} +1 -1
- package/dist/assets/{use-plugins-list-BeN4VoGr.js → use-plugins-list-B2RZk-mQ.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-sIhAEoPs.js → use-return-to-short-circuit-DmEpr1I6.js} +1 -1
- package/dist/assets/{use-side-list-room-DKS_urYu.js → use-side-list-room-Bzn8D2aH.js} +1 -1
- package/dist/assets/{use-skill-actions-VsDYLi1F.js → use-skill-actions-D8xWO_74.js} +1 -1
- package/dist/assets/{use-skill-detail-files-4oFtcDS1.js → use-skill-detail-files-tb5cSgGr.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-D7VgTBHl.js +1 -0
- package/dist/assets/{use-transcript-message-by-id-DAnqm2sU.js → use-transcript-message-by-id-CUhOzUVt.js} +1 -1
- package/dist/assets/{voice-page-ZM6m4a6g.js → voice-page-V5DTtBCx.js} +1 -1
- package/dist/assets/{wake-detail-panel-DDiMpVwh.js → wake-detail-panel-CwGS3ebR.js} +1 -1
- package/dist/assets/{weather-forecast-display-BidX04za.js → weather-forecast-display-Cy7gAmUS.js} +1 -1
- package/dist/assets/{welcome-screen-BLO3HSl6.js → welcome-screen-CsDlUcyv.js} +1 -1
- package/dist/assets/{workflow-detail-panel-DoYNc1Sc.js → workflow-detail-panel-BoCJgSNC.js} +1 -1
- package/dist/assets/{workspace-page-CBkUkz3A.js → workspace-page-ch8vZBtm.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +1 -1
- package/dist/assets/add-credits-modal-3J4yC3LM.js +0 -1
- package/dist/assets/auth-store-BPEP8tVJ.js +0 -1
- package/dist/assets/avatar-bundled-components-B9pE82_X.js +0 -1
- package/dist/assets/checkout-return-target-Be4ZEj1n.js +0 -1
- package/dist/assets/command-palette-Qu5B2KQE.js +0 -1
- package/dist/assets/deploy-dialogs-X-N6_uqc.js +0 -1
- package/dist/assets/document-load-Cr8Ud-va.js +0 -1
- package/dist/assets/intelligence-layout-slots-store-BmRlMDFx.js +0 -1
- package/dist/assets/local-mode-CBsNlz7d.js +0 -1
- package/dist/assets/native-attachment-pickers-CtYddiW_.js +0 -1
- package/dist/assets/native-file-D3F1srNM.js +0 -1
- package/dist/assets/paired-platform-identity-B0dB5CoX.js +0 -1
- package/dist/assets/password-reset-page-Dr4-0_xs.js +0 -1
- package/dist/assets/plugins-surface-BSzMy9bT.js +0 -1
- package/dist/assets/referral-modal-CeOVD766.js +0 -1
- package/dist/assets/routes-DxNQ44wo.js +0 -1
- package/dist/assets/share-feedback-modal-BPKLrcqs.js +0 -1
- package/dist/assets/tool-detail-panel-CFC6gU9K.js +0 -15
- package/dist/assets/tool-detail-panel-CVYxc8vR.js +0 -1
- package/dist/assets/use-supports-credentials-settings-DqJKqLDf.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Cp as n,Fb as r,Jl as i,Qx as a,Sp as o,Xx as s,Yl as c,Zx as l,mn as u,wp as d}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Cp as n,Fb as r,Jl as i,Qx as a,Sp as o,Xx as s,Yl as c,Zx as l,mn as u,wp as d}from"./app-Bevxq2OH.js";import{Zn as f,er as p,j as m}from"./vendor-CtuA73w5.js";import{f as h,r as g,t as _,x as v}from"./react-B9IgSVeK.js";import{Hi as y,Jn as b,Ri as x}from"./icons-DxrLl-Dj.js";var S=e(v(),1),C=_(),w=1e3,T=1e4,E=2500;function D(){let{t:e}=m(`settings`),a=d({platformHostedOnly:!0}),_=o(),v=n(),y=a===`full`&&_,b=h(),x=p(),[D,M]=(0,S.useState)(!1);(0,S.useEffect)(()=>{x.invalidateQueries({queryKey:c()})},[x]);let{data:N,isError:P}=f({...i(),enabled:y,refetchInterval:e=>e.state.data?.plan_id===`pro`||D?!1:w,refetchIntervalInBackground:!1}),F=y?N:void 0,I=y?P:!1;(0,S.useEffect)(()=>{if(!y)return;let e=setTimeout(()=>M(!0),T);return()=>clearTimeout(e)},[y]);let L=F?.plan_id===`pro`;(0,S.useEffect)(()=>{if(!L)return;let e=setTimeout(()=>{b(r.settings.usageBilling,{replace:!0})},E);return()=>clearTimeout(e)},[L,b]);let R=()=>b(r.settings.usageBilling,{replace:!0});return a===`gated`?(0,C.jsx)(g,{replace:!0,to:r.settings.general}):a===`disabled`?(0,C.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,C.jsx)(u,{children:e(`upgradeSuccessPage.platformLoginNotice`)})}):!y&&!v?(0,C.jsxs)(`div`,{className:`max-w-4xl space-y-6`,children:[(0,C.jsx)(s,{tone:`warning`,children:e(`upgradeSuccessPage.cantConfirmUpgrade`)}),(0,C.jsx)(`div`,{className:`flex justify-end`,children:(0,C.jsx)(t,{variant:`primary`,"data-testid":`upgrade-success-go-to-billing`,onClick:R,children:e(`upgradeSuccessPage.goToBilling`)})})]}):(0,C.jsx)(`div`,{className:`max-w-4xl space-y-6`,children:(0,C.jsxs)(l,{padding:`lg`,children:[L?(0,C.jsx)(k,{}):I?(0,C.jsx)(j,{}):D?(0,C.jsx)(A,{}):(0,C.jsx)(O,{}),(L||I||D)&&(0,C.jsx)(`div`,{className:`mt-4 flex justify-end`,children:(0,C.jsx)(t,{variant:L||I?`primary`:`outlined`,"data-testid":`upgrade-success-go-to-billing`,onClick:R,children:e(`upgradeSuccessPage.goToBilling`)})})]})})}function O(){let{t:e}=m(`settings`);return(0,C.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,C.jsx)(b,{className:`h-6 w-6 animate-spin text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,C.jsx)(a,{variant:`title-small`,as:`h1`,children:e(`upgradeSuccessPage.finalizingTitle`)}),(0,C.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:e(`upgradeSuccessPage.finalizingBody`)})]})}function k(){let{t:e}=m(`settings`);return(0,C.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,C.jsx)(x,{className:`h-8 w-8 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}),(0,C.jsx)(a,{variant:`title-small`,as:`h1`,children:e(`upgradeSuccessPage.welcomeTitle`)}),(0,C.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:e(`upgradeSuccessPage.successBody`)})]})}function A(){let{t:e}=m(`settings`);return(0,C.jsx)(s,{tone:`warning`,children:e(`upgradeSuccessPage.processingFallback`)})}function j(){let{t:e}=m(`settings`);return(0,C.jsxs)(`div`,{className:`flex flex-col items-center gap-3 py-6 text-center`,children:[(0,C.jsx)(y,{className:`h-8 w-8 text-[var(--system-negative-strong)]`,"aria-hidden":`true`}),(0,C.jsx)(a,{variant:`title-small`,as:`h1`,children:e(`upgradeSuccessPage.fetchErrorTitle`)}),(0,C.jsx)(a,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:e(`upgradeSuccessPage.fetchErrorBody`)})]})}export{D as UpgradeSuccessPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Fb as e}from"./app-
|
|
1
|
+
import{Fb as e}from"./app-Bevxq2OH.js";import{_ as t,r as n,t as r}from"./react-B9IgSVeK.js";var i=r();function a(){let[r]=t(),a=new URLSearchParams(r);return a.set(`tab`,`usage`),(0,i.jsx)(n,{replace:!0,to:`${e.settings.usage}?${a.toString()}`})}export{a as UsageRedirectPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cd as t,Hg as n,Mx as r,Nx as i,Qp as a,jr as o}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cd as t,Hg as n,Mx as r,Nx as i,Qp as a,jr as o}from"./app-Bevxq2OH.js";import{I as s,er as c,j as l}from"./vendor-CtuA73w5.js";import{t as u,x as d}from"./react-B9IgSVeK.js";var f=u();function p({app:e,isDeleting:t,onConfirm:n,onCancel:i}){let{t:a}=l();return(0,f.jsx)(r,{open:e!==null,title:a(`deleteAppDialog.title`),message:e?a(`deleteAppDialog.message`,{name:e.name}):``,confirmLabel:a(t?`deleteAppDialog.deleting`:`deleteAppDialog.delete`),destructive:!0,onConfirm:n,onCancel:i})}var m=e(d(),1);function h(e,t,{exported:n,failed:r}){let{id:i,name:a}=t,s=(0,m.useRef)(!1);return(0,m.useCallback)(async()=>{if(!s.current){s.current=!0;try{await o(e,{id:i,name:a},{exported:n,failed:r})}finally{s.current=!1}}},[e,i,a,n,r])}function g(e){let r=c(),[o,l]=(0,m.useState)(null),[u,d]=(0,m.useState)(!1);return{pendingDelete:o,isDeleting:u,requestDelete:l,confirmDelete:(0,m.useCallback)(async()=>{if(!(!o||u)){d(!0);try{await n({path:{assistant_id:e,id:o.id},throwOnError:!0}),a(e,o.id),r.invalidateQueries({queryKey:t({path:{assistant_id:e}})}),l(null)}catch(e){i.error(e instanceof Error?e.message:s(`useAppDelete.deleteFailed`))}finally{d(!1)}}},[o,u,e,r]),cancelDelete:(0,m.useCallback)(()=>{u||l(null)},[u])}}export{h as n,p as r,g as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$g as e,Mg as t,S_ as n,Wb as r,Xh as i,Yg as a,vs as o,x_ as s}from"./app-
|
|
1
|
+
import{$g as e,Mg as t,S_ as n,Wb as r,Xh as i,Yg as a,vs as o,x_ as s}from"./app-Bevxq2OH.js";import{Zn as c}from"./vendor-CtuA73w5.js";import{i as l,n as u,t as d}from"./latest-assistant-text-CFfTfLEE.js";var f=[{id:t.companionCoworker,leftKey:`personalityAxes.companionCoworker.left`,rightKey:`personalityAxes.companionCoworker.right`},{id:t.genzBoomer,leftKey:`personalityAxes.genzBoomer.left`,rightKey:`personalityAxes.genzBoomer.right`},{id:t.executeCollaborate,leftKey:`personalityAxes.executeCollaborate.left`,rightKey:`personalityAxes.executeCollaborate.right`},{id:t.playfulSerious,leftKey:`personalityAxes.playfulSerious.left`,rightKey:`personalityAxes.playfulSerious.right`},{id:t.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:i,title:o,context:c}){let f,p=!1;try{let r=await e({path:{assistant_id:t},body:{conversationType:`background`,title:o},throwOnError:!1});if(f=r.data?.id,!r.response?.ok||!f)return!1;let a=u({conversationId:f,content:i,transport:`vellum`});if(!(await n({path:{assistant_id:t},body:a,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 s({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){r(e,{context:c})}finally{if(f)try{await a({path:{assistant_id:t,id:f},throwOnError:!1})}catch(e){r(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[t,n]=await Promise.all([o(e),i(e).catch(()=>({ok:!1,status:0,error:{}}))]);return{identity:t,createdAt:n.ok?n.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{$x as t,Bx as n,Cm as r,Cv as i,Cx as a,Dm as o,Fb as s,Fx as c,Gl as l,Hl as u,Jc as d,Jl as f,Kl as p,Mx as m,Nx as h,Ph as g,Ql as _,Qx as v,Uc as y,Ul as b,Uo as x,Vl as S,Wl as C,Wo as w,Wx as T,Xx as E,Yc as D,Yl as O,Yr as k,_y as A,av as j,bm as ee,dl as te,fi as M,fm as ne,gl as N,hm as re,iv as P,jh as ie,lu as ae,mm as oe,pm as se,qa as F,ql as ce,qn as le,sl as ue,uu as de,xv as fe,ym as pe,zx as me}from"./app-BffxeWB8.js";import{I,Jn as he,Zn as L,er as R,ir as ge,j as z,or as _e}from"./vendor-CtuA73w5.js";import{f as ve,t as ye,x as be}from"./react-B9IgSVeK.js";import{Bn as xe,E as Se,Hi as B,Ja as Ce,Jn as V,La as we,Ri as Te,br as H,dr as Ee,fi as U,qi as De,si as Oe}from"./icons-DxrLl-Dj.js";import{t as ke}from"./environment-store-Dka2FZhs.js";import{c as Ae,i as W,l as G,n as je,r as Me,t as Ne}from"./machine-sizes--PLzvcMG.js";import{a as Pe,i as Fe,n as Ie,r as Le,t as Re}from"./provisioning-targets-DdPIF4Aj.js";var ze=Ce(`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`}]]),K=e(be(),1),q=ye();function Be({icon:e}){return(0,q.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,q.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var J={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Y({title:e,subtitle:t}){return(0,q.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,q.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Ve=[{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}],He=[{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 Ue({variant:e=`full`}){let t=k();return t?(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?He:Ve).map((e,n)=>(0,q.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,q.jsx)(le,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var X={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.`},Z={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.`},Q={upgrade:X,downgrade:Z,change:Z};function We(e=`upgrade`){return Q[e]}function Ge(e,t=!0){let{data:n}=L({...y(),enabled:t&&e==null}),{data:r}=L({...N({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function Ke({assistantId:e,direction:n}){let r=ve(),{t:i}=z(`settings`),a=Ge(e,o())?.name||i(`completeState.assistantFallbackName`);return(0,q.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,q.jsx)(Ue,{variant:`full`}),(0,q.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,q.jsx)(Y,{title:i(`completeState.title`),subtitle:We(n).completeSubtitle}),(0,q.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&ie(e),r(s.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function qe(e=!0,t){let n=Ge(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=L({...d({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var Je=1e3,Ye=1e4,Xe=2500,Ze=2e3,Qe=1e4,$e=[`machine_size`,`subdomain`,`non_field_errors`],et={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.`},tt={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 nt(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:tt[t.error])??et[t.error];if(e)return e}for(let e of $e){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 $=`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`,rt=`text-[11px] font-medium text-[var(--content-secondary)]`;function it({onExit:e,machineBusy:n=!1,assistantId:r}){let{t:i}=z(`settings`),a=R(),o=ke.use.emailRootDomain(),{assistant:s,assistantId:l,domains:u}=qe(!0,r),d=u?.results[0],[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(`hi`),[g,_]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(!g){if(d){p(d.subdomain),_(!0);return}!s?.handle||f||(p(s.handle),_(!0))}},[s?.handle,d,g,f]);let[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(!1),S=he(C()),w=!!d||b,T=S.isPending||b;return(0,K.useEffect)(()=>{if(!b)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[b,e]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(c.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,q.jsx)(Ue,{variant:`top`}),(0,q.jsx)(Y,{title:i(`domainStep.title`),subtitle:i(`domainStep.subtitle`)}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:rt,children:i(`domainStep.prefixLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-prefix`,value:m,onChange:e=>h(e.target.value.toLowerCase().trim()),disabled:T||w,readOnly:w,placeholder:i(`domainStep.emailUsernamePlaceholder`),className:`${$} w-24`})]}),(0,q.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:rt,children:i(`domainStep.handleLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-handle`,value:f,onChange:e=>{p(e.target.value.toLowerCase().trim()),v&&y(null)},disabled:T||w,readOnly:w,autoFocus:!0,placeholder:i(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!v,className:`${$} w-full min-w-0`})]}),(0,q.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,o]})]}),v&&(0,q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:v}),w&&(0,q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`domainStep.domainLockedMessage`)})]}),n&&!w&&(0,q.jsx)(E,{tone:`neutral`,children:i(`domainStep.machineBusyNotice`)}),!w&&(0,q.jsx)(E,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,q.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:i(`domainStep.handleImmutableNotice`)})}),b?(0,q.jsx)(E,{tone:`success`,children:i(`domainStep.domainSetRedirecting`)}):null]}),(0,q.jsx)(c.Footer,{className:`items-center pt-6`,children:w?(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:i(`domainStep.continue`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(t,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:T,onClick:()=>{T||S.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:i(`domainStep.skip`)}),(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!f||T||n,onClick:()=>{T||n||!f||S.mutate({body:{subdomain:f,...m?{email_username:m}:{}}},{onSuccess:()=>{y(null),x(!0),a.invalidateQueries({queryKey:ue()}),a.invalidateQueries({queryKey:D({path:{assistant_id:l??``}})}),a.invalidateQueries({queryKey:ce()})},onError:e=>{y(nt(e,i(`domainStep.registerSubdomainFailed`)))}})},children:i(`domainStep.next`)})]})})]})}function at({onGoToBilling:e,direction:n}){let{t:r}=z(`settings`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,q.jsx)(Be,{icon:B}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(v,{variant:`title-small`,as:`h1`,children:r(`errorStates.fetchErrorTitle`)}),(0,q.jsx)(v,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:We(n).fetchErrorBody})]}),(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:r(`errorStates.goToBilling`)})]})}function ot(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:W[n.machineSize],to:W[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:W[n.machineSize],to:W[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 st=60,ct=st*2;function lt({imageUrl:e,animateIn:t=!0}){return(0,q.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,q.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(${st}px)`,width:`calc(100% + ${ct*2}px)`,height:`calc(100% + ${ct*2}px)`}}),(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function ut(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function dt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function ft(e){let t=o(),{data:n}=L({...S(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function pt(e,t){return t==null?0:ut(e,t)?.credits_usd??dt(t)}function mt(e,t){return t==null?null:ut(e,t)?.label}function ht(e){let t=ft(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=ut(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=ut(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function gt(e){let t=ft(e!=null);return e==null||pt(t,e.fromTier)==null||pt(t,e.toTier)==null?null:{fromLabel:mt(t,e.fromTier),toLabel:mt(t,e.toTier)}}function _t(e){let t=A.use.activeAssistantId(),n=e===void 0?t:e,{components:i,traits:a,customImageUrl:o,state:s,isLoading:c}=pe(n),l=(0,K.useMemo)(()=>oe(),[re()]),u=l!=null&&se(l)?l:null,d=n!=null&&!c,f=u!=null&&(n==null||n===u.assistantId),p=f&&!(d&&(i!=null||a!=null||o!=null))?u:null,m=p?p.components:i,h=p?p.traits:a,g=p?null:o,_=d||f,v=ee({state:p?null:s,components:m,traits:h,customImageUrl:g})??(g?null:r[0]?.hex??null);return{tintHex:_&&v?w(v):x,backdropImageUrl:_?g:null,ready:_,avatar:{components:m,traits:h,customImageUrl:g}}}function vt(e,t){let[n,r]=(0,K.useState)(e),i=(0,K.useRef)(0);return(0,K.useEffect)(()=>{i.current=performance.now()},[]),(0,K.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 yt=`--takeover-surface`,bt=`var(${yt},${x})`,xt=`color-mix(in srgb, var(--content-emphasised) 10%, transparent)`,St=240,Ct=1.414,wt=[{minHeight:680,size:St},{minHeight:600,size:184}],Tt=132;function Et(e){for(let t of wt)if(e>=t.minHeight)return t.size;return Tt}function Dt(){let[e,t]=(0,K.useState)(()=>Et(typeof window>`u`?1/0:window.innerHeight));return(0,K.useEffect)(()=>{let e=()=>t(Et(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Ot={machine:Oe,storage:H,credits:U},kt={idle:``,working:` is-working`,settling:` is-settling`,stalled:` is-stalled`,grown:` is-evolved`};function At(e,t){return e===`DONE`||e===`NOT_APPLICABLE`?`grown`:e===`STALLED`?`stalled`:e===`WAITING`||e===`RESIZING`?t?`settling`:`working`:`idle`}function jt({assistantId:e,mode:t,downsizing:n=!1}){let{avatar:r,ready:i}=_t(e),a=k(),o=Dt(),s=t===`working`||t===`settling`;return(0,q.jsxs)(`div`,{"aria-hidden":!0,className:`provision-avatar-evolve relative z-10 flex flex-col items-center${kt[i?t:`idle`]}${n?` is-downsizing`:``}`,style:{"--provision-avatar-size":`${o}px`,"--provision-avatar-growth":Ct},children:[(0,q.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,q.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,q.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,q.jsx)(`div`,{className:`provision-avatar-current`,children:(0,q.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,q.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,q.jsx)(M,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,q.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function Mt({status:e,caption:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,q.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(v,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function Nt({icon:e,label:t,from:n,to:r,done:i=!1,pending:a=!1,testId:o}){let{t:s}=z(`settings`),c=null;return i?c=s(`provisioningState.statusComplete`):a&&(c=s(`provisioningState.statusPending`)),(0,q.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:xt},children:[(0,q.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,q.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,q.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`span`,{className:`sr-only`,children:s(`provisioningState.srOnlyTo`)}),(0,q.jsx)(we,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{children:r}),i?(0,q.jsx)(De,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,q.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,q.jsx)(`span`,{className:`sr-only`,children:c})]})]})]})}function Pt({label:e}){return(0,q.jsx)(`span`,{className:`rounded-lg px-3 py-2 text-[14px] text-[var(--content-emphasised)]`,style:{backgroundColor:xt},children:e})}function Ft({children:e,wide:t=!1,testId:n}){return(0,q.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 It(e,t){return e===`credits`?!0:t?.[e]===!0}function Lt(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 Rt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=z(`settings`),l=ht(e),u=gt(t),d=ot({targets:n,fromSnapshot:r,machineFloor:i,credits:Lt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||It(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,K.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ft,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||It(e.key,a);return(0,q.jsx)(Nt,{testId:`chip-${e.key}`,icon:Ot[e.key],label:e.label,from:e.from,to:e.to,done:t,pending:!t},e.key)})}),(0,q.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function zt({intent:e}){let{t}=z(`settings`),n=ht(e.kind===`custom`?e:null);if(e.kind===`package`)return(0,q.jsx)(Ft,{children:(0,q.jsx)(Pt,{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,q.jsxs)(Ft,{wide:r>=3,children:[e.machineTier!=null&&(0,q.jsx)(Nt,{icon:Oe,label:t(`provisioningState.machineLabel`),to:je[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,q.jsx)(Nt,{icon:H,label:t(`provisioningState.storageLabel`),to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&(0,q.jsx)(Pt,{label:n.toLabel})]})}function Bt({state:e,direction:n,softWaiting:r,intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,assistantId:f,escapeAvailable:p,onEscape:m,onPhaseChange:h,kickError:g,confirm:_,dwellMs:v=Xe,phaseMinMs:y=900}){let{t:b}=z(`settings`),x=We(n),S=(0,K.useRef)(d);(0,K.useEffect)(()=>{S.current=d},[d]);let C=vt(e,y),w=C===`DONE`||C===`NOT_APPLICABLE`,T=C===`RESIZING`?`WAITING`:C,E=(0,K.useRef)(h);(0,K.useEffect)(()=>{E.current=h},[h]),(0,K.useEffect)(()=>{E.current?.(C)},[C]);let{tintHex:D,backdropImageUrl:O}=_t(f),k=u&&w;return(0,K.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>S.current(),v);return()=>clearTimeout(e)},[k,v]),(0,q.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:{[yt]:D,backgroundColor:bt},children:[O&&(0,q.jsx)(lt,{imageUrl:O}),(0,q.jsx)(jt,{assistantId:f,mode:At(C,r),downsizing:n===`downgrade`}),(0,q.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=b(`provisioningState.continueInBackground`)){return p?(0,q.jsx)(t,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:m,children:e}):null}function j({allDone:e=!1,creditsOnly:t=!1}={}){return(0,q.jsx)(Rt,{intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function ee(){if(C===`CONFIRMING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmingStatus,caption:b(`provisioningState.confirmingCaption`)}),i&&(0,q.jsx)(zt,{intent:i}),A()]});if(C===`WAITING`||C===`RESIZING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.waitingStatus,caption:b(r?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),j(),A()]});if(C===`DONE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.allDoneStatus`)}),j({allDone:!0})]});if(C===`NOT_APPLICABLE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.planReadyStatus`)}),j({allDone:!0,creditsOnly:!0})]});if(C===`STALLED`){let e=g!=null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:e?x.snagStatus:b(`provisioningState.takingLongerStatus`),caption:e?nt(g,x.snagCaption,n):b(`provisioningState.stalledCaption`)}),j(),e?A(b(`provisioningState.retryInBackground`)):A()]})}return C===`CONFIRM_TIMEOUT`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmTimeoutStatus,caption:x.confirmTimeoutCaption}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,q.jsx)(t,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:_.onGoToBilling,children:b(`provisioningState.goToBilling`)}),(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:_.onRetry,children:b(`provisioningState.tryAgain`)})]})]}):null}}function Vt(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&&!Pe(n,i);if(Pe(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 Ht=2e3,Ut=1e3,Wt=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Gt={assistantId:null,machine:null,storage:null};function Kt({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Qe}){let r=R(),i=o(),[a,s]=(0,K.useState)(!1),[c,u]=(0,K.useState)(0),[d,m]=(0,K.useState)(null),[h,_]=(0,K.useState)(null),[v,b]=(0,K.useState)(null),[x,S]=(0,K.useState)(null),[C,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(null),[D,k]=(0,K.useState)(Gt),[A,j]=(0,K.useState)(null),[ee,M]=(0,K.useState)(!1),ne=(0,K.useRef)(!1),re=(0,K.useRef)(!1),P=(0,K.useRef)(0),[ie,ae]=(0,K.useState)(!1),[oe,se]=(0,K.useState)(null),[F,le]=(0,K.useState)(null),[ue,de]=(0,K.useState)(null),[fe,pe]=(0,K.useState)(()=>Date.now()),[me,I]=(0,K.useState)(!0);(0,K.useEffect)(()=>{e||(s(!1),u(0),m(null),_(null),b(null),ae(!1),se(null),le(null),de(null),I(!0),S(null),w(null),E(null),k(Gt),j(null),M(!1),ne.current=!1,re.current=!1,P.current+=1)},[e]),(0,K.useEffect)(()=>{e&&(m(Date.now()),r.invalidateQueries({queryKey:O()}),r.invalidateQueries({queryKey:ce()}))},[e,r]);let z=h!=null,ve=L({...f(),refetchInterval:e=>e.state.data?.plan_id===`pro`||a?!1:Je,refetchIntervalInBackground:!1,enabled:e&&i&&!z}),ye=(d!=null&&ve.dataUpdatedAt>=d?ve.data?.plan_id:null)??null;(0,K.useEffect)(()=>{if(!e||z||ye!==`pro`)return;let t=Date.now();_(t),pe(t)},[e,z,ye]),(0,K.useEffect)(()=>{if(!e||z)return;let t=setTimeout(()=>s(!0),Ye);return()=>clearTimeout(t)},[e,z,c]);let be=(0,K.useCallback)(()=>{s(!1),u(e=>e+1),g.getState().fetchOrganizations(),r.invalidateQueries({queryKey:O()})},[r]),xe=(0,K.useCallback)(()=>{let e=Date.now();b(e),pe(e)},[]),{mutate:Se}=he(l()),B=(0,K.useCallback)(e=>{let t=P.current;Se({},{onSuccess:n=>{t===P.current&&(j(null),Ie(n)?re.current?j({error:n.reason??`no_active_pro`}):(re.current=!0,M(!0),e===`escape`&&xe()):(S(n.state),e===`escape`&&xe()))},onError:e=>{t===P.current&&j(e)}})},[Se,xe]);(0,K.useEffect)(()=>{!e||!i||!z||ne.current||(ne.current=!0,B(`auto`))},[e,i,z,B]),(0,K.useEffect)(()=>{if(!ee)return;let e=P.current,t=setTimeout(()=>{M(!1),e===P.current&&B(`auto`)},Ze);return()=>clearTimeout(t)},[ee,B]);let Ce=(0,K.useCallback)(()=>B(`escape`),[B]),V=L({...p(),enabled:e&&i&&z}),we=me?Ht:!1,Te=L({...y(),enabled:e&&i&&z,refetchInterval:e=>e.state.data?.id==null?we:!1,retry:!1}),H=z&&d!=null&&V.dataUpdatedAt>=d,Ee=H&&!V.isPending&&!V.isFetching,U=(H?V.data?.primary_assistant_id:null)??(V.isPending?null:Te.data?.id??null),De=L({...N({path:{id:U??`unresolved`}}),enabled:e&&i&&z&&U!=null,refetchInterval:we,retry:!1}),Oe=te({path:{id:U??`unresolved`}}),ke=L({...Oe,enabled:e&&i&&z&&U!=null,refetchInterval:we,retry:!1}),W=(0,K.useRef)(0),[je,Me]=(0,K.useState)(0),ze=_e(Oe.queryKey);(0,K.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==ze)){if(t.action.type===`fetch`)W.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=W.current,r=e&&Le(t.action.data);ge.schedule(()=>{Me(n),r&&(ae(!0),se(U))})}}}),[r,ze,e,U]);let q=Le(ke.data),Be=oe===U,J=V.data,Y=(0,K.useMemo)(()=>J?{machineSize:Ae(J.max_machine_tier),storageGib:J.selected_storage_gib??null}:null,[J]),Ve=J!=null&&J.max_machine_tier==null?Ne:null,He=J?J.domain_setup_available&&J.primary_assistant_id!=null:void 0,Ue=De.data,X=(0,K.useMemo)(()=>Ue?{machineSize:Ue.machine_size??null,storageGib:Ue.provisioned_storage_gib??null}:null,[Ue]),Z=ue===U,Q=(0,K.useMemo)(()=>{let e=Re(Y,X),t=Y?.machineSize??Ve;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Z?F?.machineSize:null)??n,i=G(t)<G(r);return{...e,machine:i?G(n)<=G(t):G(n)>=G(t)}},[Y,X,F,Z,Ve]),We=Pe(Y,X),Ge=T===U;(0,K.useEffect)(()=>{e&&(We?(w(e=>e!=null&&Ge?e:Date.now()),E(U)):(w(null),E(null)))},[e,We,U,Ge]);let Ke=D.assistantId===U;(0,K.useEffect)(()=>{if(!e)return;let t=W.current;k(e=>{let n=e.assistantId===U?e:Gt,r=Q.machine?n.machine??t:null,i=Q.storage?n.storage??t:null;return e.assistantId===U&&e.machine===r&&e.storage===i?e:{assistantId:U,machine:r,storage:i}})},[e,Q,U]);let qe=(0,K.useMemo)(()=>{let e=Fe(ke.data),t=e=>e!=null&&Ke&&je>e;return{machine:Q.machine&&!e.machine&&t(D.machine),storage:Q.storage&&!e.storage&&t(D.storage)}},[Q,D,Ke,je,ke.data]);(0,K.useEffect)(()=>{!e||!X||F!=null&&Z||(le(X),de(U))},[e,X,U,F,Z]);let Xe=v??h,$e=Xe==null?null:Math.max(0,fe-Xe),et=!t,{state:tt,softWaiting:nt}=Vt({planId:z?`pro`:ye,targets:Y,actuals:X,initialActuals:Z?F:null,resizeOperationInFlight:q,sawOperation:ie&&Be,msSinceWatchStart:$e,confirmExpired:a,serverVerdict:x,statusObservedSinceTargetsMet:C!=null&&Ge&&ke.dataUpdatedAt>C,targetsProveNoop:et}),$=Wt.includes(tt),rt=e&&z&&!$;(0,K.useEffect)(()=>{I(rt)},[rt]),(0,K.useEffect)(()=>{if(!e||!z||$)return;let t=setInterval(()=>pe(Date.now()),Ut);return()=>clearInterval(t)},[e,z,$]);let it=!et&&(x===`started`||x===`in_progress`)&&!(ie&&Be);return(0,K.useEffect)(()=>{if(!e||!z||$||!it)return;let t=setInterval(()=>B(`auto`),n);return()=>clearInterval(t)},[e,z,$,it,n,B]),{state:tt,softWaiting:nt,targets:Y,actualsSnapshot:F,machineFloor:Ve,landed:qe,assistantId:U,domainStepAvailable:He,onboardingSettled:Ee,confirmError:!z&&ve.isError,targetsError:z&&V.isError&&(!J||!H),escapeEligible:$e!=null&&$e>=6e4,retryConfirm:be,kickProvisioning:Ce,kickError:A}}var qt=200,Jt=380;function Yt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Xt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Zt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Qt={machineSize:null,storageGib:null};function $t({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:a=`checkout`,resizeContext:o}){let{t:s}=z(`settings`),l=a===`resize`,u=R(),[d,f]=(0,K.useState)(`provisioning`),[p,g]=(0,K.useState)(`idle`),_=(0,K.useRef)([]),[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(null),[S,C]=(0,K.useState)(null),[w,T]=(0,K.useState)(!1),E=l?o?.direction:void 0,O=We(E),k=Kt({open:e,canLowerResources:l?o?.canLowerResources===!0:!1}),A=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(e){A.current=!0,y(l?null:i()),C(e=>e??Date.now());return}_.current.forEach(clearTimeout),_.current=[],f(`provisioning`),g(`idle`),x(null),C(null),T(!1),A.current&&(A.current=!1,ne())},[e,l]),(0,K.useEffect)(()=>()=>{_.current.forEach(clearTimeout)},[]),(0,K.useEffect)(()=>{d===`complete`&&fe()},[d]);let j=Xt(k.state),ee=Zt(b??k.state),{targets:te,assistantId:M,domainStepAvailable:N,onboardingSettled:re}=k,P=l?o?.fromSnapshot:void 0,ie=k.actualsSnapshot,ae={machineSize:P?.machineSize??ie?.machineSize??null,storageGib:P?.storageGib??ie?.storageGib??null},{tintHex:oe,backdropImageUrl:se}=_t(M),F=l&&N===!0,{domains:ce,domainsError:le,domainsFetching:ue,domainsUpdatedAt:de,domainsErrorUpdatedAt:pe}=qe(e&&F,M),me=(ce?.results.length??0)>0,I=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!e){I.current=null;return}!F||M==null||I.current!==M&&(I.current=M,u.invalidateQueries({queryKey:D({path:{assistant_id:M}})}))},[e,F,M,u]);let he=!ue&&(S!=null&&de>=S||S!=null&&!!le&&pe>=S),[L,ge]=(0,K.useState)(!1),_e=re&&(!F||he);(0,K.useEffect)(()=>{if(!e){ge(!1);return}_e&&ge(!0)},[e,_e]);let ve=(0,K.useCallback)(()=>{let e=l?N===!0&&!me?`domain`:`complete`:N===!1?`complete`:`domain`;if(Yt()){f(e);return}g(`covering`),_.current.push(setTimeout(()=>{f(e),g(`revealing`),_.current.push(setTimeout(()=>g(`idle`),Jt))},qt))},[N,l,me]),ye=(0,K.useCallback)(()=>{T(!0)},[]),be=(0,K.useCallback)(()=>{k.kickProvisioning(),h.info(k.kickError==null?O.backgroundExitToast:O.backgroundRetryToast),T(!1),t()},[k,t,O]),xe=(0,K.useCallback)(()=>{T(!1)},[]),Se=d===`provisioning`&&(k.confirmError||k.targetsError),B=d===`provisioning`&&!Se,Ce=B&&!ee,V=`transition-[background-color] duration-300 ease-out${B?` bg-black p-0`:``}`,we=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,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(c.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:{[yt]:oe},children:[(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${we}`,children:Te()},d),p!==`idle`&&(0,q.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:bt},children:se&&(0,q.jsx)(lt,{imageUrl:se,animateIn:!1})})]})}),(0,q.jsx)(m,{open:w&&j,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:O.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:be,onCancel:xe})]});function Te(){return d===`provisioning`?k.confirmError||k.targetsError?(0,q.jsx)(at,{onGoToBilling:t,direction:E}):(0,q.jsx)(Bt,{state:k.state,direction:E,softWaiting:k.softWaiting,intent:v,creditsChange:l?o?.credits:void 0,targets:te??Qt,fromSnapshot:ae,machineFloor:k.machineFloor,landed:k.landed,celebrating:L,onCelebrationEnd:ve,assistantId:M,escapeAvailable:j&&k.escapeEligible,onEscape:ye,onPhaseChange:x,kickError:k.kickError,confirm:{onRetry:k.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):d===`domain`?(0,q.jsx)(it,{machineBusy:j,assistantId:M,onExit:()=>f(`complete`)}):(0,q.jsx)(Ke,{assistantId:M,direction:E})}}function en(e){return e!=null&&!e.customized}function tn(e){return en(e)?e.name:`Custom`}var nn=[`mighty`,`super`,`ultra`],rn=[`free`,...nn];function an(e){return rn.indexOf(e)}function on(e,t){if(e===null)return`upgrade`;let n=an(e),r=an(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function sn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>nn.indexOf(e.key)-nn.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 cn=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],ln={too_expensive:`cancelReasonSurvey.optionTooExpensive`,missing_features:`cancelReasonSurvey.optionMissingFeatures`,switched_service:`cancelReasonSurvey.optionSwitchedService`,unused:`cancelReasonSurvey.optionUnused`,too_complex:`cancelReasonSurvey.optionTooComplex`,low_quality:`cancelReasonSurvey.optionLowQuality`,customer_service:`cancelReasonSurvey.optionCustomerService`,other:`cancelReasonSurvey.optionOther`},un=1e3,dn={feedback:null,comment:``};function fn(e){return e.feedback!=null}function pn(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function mn({value:e,onChange:t,disabled:r}){let{t:i}=z(`settings`);return(0,q.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,q.jsx)(v,{as:`p`,variant:`body-medium-default`,children:i(`cancelReasonSurvey.title`)}),(0,q.jsx)(n,{value:e.feedback??``,onValueChange:n=>t({...e,feedback:n===``?null:n}),name:`cancel-reason`,disabled:r,"aria-label":i(`cancelReasonSurvey.title`),children:cn.map(e=>(0,q.jsx)(me,{value:e,label:i(ln[e])},e))}),e.feedback===`other`?(0,q.jsx)(T,{label:i(`cancelReasonSurvey.otherLabel`),placeholder:i(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:n=>t({...e,comment:n.target.value}),maxLength:un,rows:3,disabled:r,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}var hn={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 gn({tier:e,size:t=40}){let n=hn[e]??hn.free,r=k();return(0,q.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,q.jsx)(le,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,q.jsx)(`div`,{style:{width:t,height:t}})})}var _n={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 vn(e){return _n[e]}function yn(e){return`Downgrade to ${e}`}function bn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function xn(e){return`${bn(e)}/mo`}function Sn(e){return`${bn(e)}/month`}function Cn(e){return`${e>0?`+`:`−`}${bn(Math.abs(e))}/mo`}function wn(e){return`${e} GB storage`}function Tn(e){return`${bn(e*100)} of bundled credits`}var En=`Small`;function Dn(e){return e?.machine_size?W[e.machine_size]??e.machine_size:En}function On(e,t){let n=vn(e.key)?.extraFeatures??[];return[{icon:ze,label:`${Dn(e)} Machine`},{icon:H,label:`${e.storage_gib} GB Storage`},{icon:U,label:t},...n.map(e=>({icon:xe,label:e}))]}function kn(){return[{icon:ze,label:`${En} Machine`},{icon:H,label:`4 GB Storage`},{icon:U,label:`Pay as you go credits`}]}function An(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Me[e?.machine_size??`small`];return[`${Dn(e)} machine${i?` (${i})`:``}`,wn(r),e?.usage_label??Tn(n),...t]}var jn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Mn(e,t){let n=[`${e.machineTier?je[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:En} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=ut(t,e.creditTier)?.label,i=dt(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function Nn(e,t){let n=new Set([jn.machine]);return e.storageGib!=null&&n.add(jn.storage),e.creditTier!=null&&n.add(jn.credits),[...Mn(e,t),...t.included_features.filter(e=>!n.has(e))]}function Pn(e){return e.disabled===!0}function Fn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:o,currentMachinePriceCents:s,currentStoragePriceCents:c}){let{t:l}=z(`settings`),u=(0,K.useMemo)(()=>e.map(e=>{let t=je[e.tier]??e.label,n=s==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===s?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-s);return{value:e.tier,label:l(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:Pn(e)}}),[e,s,l]),d=(0,K.useMemo)(()=>t.map(e=>{let t=c==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===c?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-c);return{value:e.tier,label:l(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:Pn(e)}}),[t,c,l]);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(v,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.machineLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.machineTooltip`),children:(0,q.jsx)(Ee,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(a,{"aria-label":l(`tierPicker.machineAriaLabel`),placeholder:l(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:u})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(v,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.storageLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.storageTooltip`),children:(0,q.jsx)(Ee,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(a,{"aria-label":l(`tierPicker.storageAriaLabel`),placeholder:l(`tierPicker.storagePlaceholder`),value:r??``,onChange:o,options:d})]})]})}var In=new Set([`active`,`trialing`,`past_due`]);function Ln(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&In.has(e.status)}function Rn(e){return e?.status!=null&&In.has(e.status)}var zn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function Bn(e,t){if(e&&typeof e==`object`){for(let t of zn)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 Vn(e,t){let n=e.filter(e=>!Pn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Hn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Un(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Wn(){let e=R();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:O()}),t.onSuccess(n),n}catch(e){return h.error(Bn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Gn=`billing-portal-return-snapshot`;function Kn(e){try{sessionStorage.removeItem(Gn),sessionStorage.setItem(Gn,JSON.stringify(e))}catch{}}function qn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Gn);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 Jn(){try{sessionStorage.removeItem(Gn)}catch{}}function Yn(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 Xn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Zn(e){return e?e.cancel_at??e.current_period_end??null:null}function Qn(e){let t=R();return(0,K.useEffect)(()=>j(()=>{t.invalidateQueries(f())}),[t]),ae({onSuccess:t=>{e&&Kn(e),P(t.portal_url)},onError:()=>{h.error(I(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function $n(){let e=de(),t=Wn();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Xn(e.cancel_at):I(`settings:useCancelSubscription.endOfBillingPeriod`);h.info(I(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>I(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function er(e){return Promise.all([e.invalidateQueries({queryKey:O()}),e.invalidateQueries({queryKey:u()}),e.invalidateQueries({queryKey:ce()}),e.invalidateQueries({queryKey:_()})])}function tr({enabled:e=!0}={}){let t=R(),{t:n}=z(`settings`),[r,i]=(0,K.useState)(null),a=(0,K.useRef)(!1),[s,c]=(0,K.useState)(!1),l=o(),u=e&&l,d=L({...f(),enabled:u}),m=d.data,g=m!=null&&m.plan_id!==`base`,_=L({...p(),enabled:u&&g}),v=L({...S(),enabled:u&&g}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],y=e=>v.find(t=>t.tier===e)?.price_cents??null,x=he(b()),C={machineTier:_.data?.max_machine_tier??null,storageTier:_.data?.selected_storage_tier??null,storageGib:_.data?.selected_storage_gib??null,creditTier:m?.selected_credit_tier??null,hasPlatformFee:m?.has_platform_fee??!0},w=m!=null&&m.plan_id!==`base`&&m.status!=null&&In.has(m.status)&&m.cancel_at_period_end!==!0&&!m.cancel_at,T=!g||!_.isPending,E=!g||_.isSuccess&&_.data!=null&&!_.isFetching&&_.dataUpdatedAt>=d.dataUpdatedAt,D=s||x.isPending,O=async(e,t=C)=>{if(a.current)return null;a.current=!0,c(!0);try{return await k(e,t)}finally{a.current=!1,c(!1)}},k=async(e,r)=>{i(null);let a=e=>(i(e),h.error(e),null),[o,s]=await Promise.all([d.refetch(),_.refetch()]),c=o.data,l=s.data;if(o.isError||s.isError||c==null||l==null)return a(n(`customPlanModal.changeFailed`));let u={machineTier:l.max_machine_tier??null,storageTier:l.selected_storage_tier??null,storageGib:l.selected_storage_gib??null,creditTier:c.selected_credit_tier??null,hasPlatformFee:c.has_platform_fee??!0},f={machineTier:e.machineTier===r.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?u.creditTier:e.creditTier},p=f.machineTier!==u.machineTier,m=f.storageTier!==u.storageTier,g=f.creditTier!==u.creditTier,v=!u.hasPlatformFee,b=y(f.machineTier),S=y(u.machineTier),C=p&&b!=null&&S!=null&&b<S;if(!p&&!m&&!g&&!v)return{needsResize:!1,creditChanged:!1};let w;try{w=(await x.mutateAsync({body:{machine_tier:f.machineTier,storage_tier:f.storageTier,credit_tier:f.creditTier}})).status}catch(e){return a(Bn(e,n(`customPlanModal.changeFailed`)))}return await er(t),w===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:m||p&&!C,creditChanged:g}};return{changeTiers:O,isPending:D,error:r,current:C,eligible:w,currentReady:T,currentKnown:E,primaryAssistantId:E?_.data?.primary_assistant_id??null:null}}function nr(){let e=R(),{t}=z(`settings`),n=he(b());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await er(e),t}catch(e){return h.error(Bn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function rr({className:e,"data-testid":t,children:n}){return(0,q.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:F(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var ir=32;function ar(){let{ready:e,avatar:t}=_t();return(0,q.jsx)(rr,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,q.jsx)(M,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:ir}):null})}var or=`Billed monthly · prorated difference charged today`,sr=`Billed monthly · prorated difference charged today or credited next invoice`,cr=`Billed monthly · prorated credit on your next invoice`,lr=`Your machine downsizes now and your storage stays. No refund.`,ur=`Continue`,dr=`The plan includes`,fr=`Your plan will include`;function pr(e,t,n){let r=n?vn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:yn(t),subtitle:``,priceCaption:cr,checklistHeading:fr,note:lr,confirmLabel:yn(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:sr,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:or,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1}}}function mr({open:e,relation:n,packageName:r,targetPackage:i,pending:a,onCancel:o,onConfirm:s}){let{t:l}=z(`settings`),u=(0,K.useRef)(null),d=(0,K.useId)(),f=pr(n,r,i?.key??null),p=i?{price:xn(i.total_price_cents),highlights:An(i,vn(i.key)?.extraFeatures??[])}:null,m=f.subtitle,h=f.note?{"aria-describedby":d}:m?{}:{"aria-describedby":void 0};return(0,q.jsx)(c.Root,{open:e,onOpenChange:e=>{!e&&!a&&o()},children:(0,q.jsxs)(c.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},...h,children:[(0,q.jsxs)(c.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[f.destructive?(0,q.jsx)(rr,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,q.jsx)(Se,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,q.jsx)(ar,{}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(c.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:f.title}),m?(0,q.jsx)(c.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),p?(0,q.jsxs)(c.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(v,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:p.price}),(0,q.jsx)(v,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:f.priceCaption})]}),(0,q.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,q.jsx)(v,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:f.checklistHeading}),(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.highlights.map(e=>(0,q.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Te,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,q.jsx)(v,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,f.note?(0,q.jsx)(v,{id:d,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:f.note}):null,(0,q.jsxs)(c.Footer,{className:`flex-col gap-4 p-0`,children:[(0,q.jsx)(t,{fullWidth:!0,variant:f.destructive?`danger`:`primary`,onClick:s,disabled:a,"data-testid":`confirm-package-switch-button`,children:f.confirmLabel}),(0,q.jsx)(t,{ref:u,fullWidth:!0,variant:`ghost`,onClick:o,disabled:a,children:l(`packageSwitchConfirmModal.cancel`)})]})]})})}function hr(){let e=R();(0,K.useEffect)(()=>j(()=>{er(e)}),[e])}export{xn as A,en as B,Nn as C,On as D,Dn as E,mn as F,qe as G,tn as H,dn as I,Ge as K,fn as L,wn as M,vn as N,Cn as O,gn as P,pn as R,Pn as S,kn as T,on as U,sn as V,$t as W,Ln as _,er as a,Vn as b,Jn as c,qn as d,Qn as f,Rn as g,Bn as h,tr as i,Sn as j,bn as k,Xn as l,In as m,mr as n,$n as o,Wn as p,ze as q,nr as r,Yn as s,hr as t,Zn as u,Un as v,Mn as w,Fn as x,Hn as y,nn as z};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Bx as n,Cm as r,Cv as i,Cx as a,Dm as o,Fb as s,Fx as c,Gl as l,Hl as u,Jc as d,Jl as f,Kl as p,Mx as m,Nx as h,Ph as g,Ql as _,Qx as v,Uc as y,Ul as b,Uo as x,Vl as S,Wl as C,Wo as w,Wx as T,Xx as E,Yc as D,Yl as O,Yr as k,_y as A,av as j,bm as ee,dl as te,fi as M,fm as ne,gl as N,hm as re,iv as P,jh as ie,lu as ae,mm as oe,pm as se,qa as F,ql as ce,qn as le,sl as ue,uu as de,xv as fe,ym as pe,zx as me}from"./app-Bevxq2OH.js";import{I,Jn as he,Zn as L,er as R,ir as ge,j as z,or as _e}from"./vendor-CtuA73w5.js";import{f as ve,t as ye,x as be}from"./react-B9IgSVeK.js";import{Bn as xe,E as Se,Hi as B,Ja as Ce,Jn as V,La as we,Ri as Te,br as H,dr as Ee,fi as U,qi as De,si as Oe}from"./icons-DxrLl-Dj.js";import{t as ke}from"./environment-store-gXJzyQ9n.js";import{c as Ae,i as W,l as G,n as je,r as Me,t as Ne}from"./machine-sizes--PLzvcMG.js";import{a as Pe,i as Fe,n as Ie,r as Le,t as Re}from"./provisioning-targets-DdPIF4Aj.js";var ze=Ce(`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`}]]),K=e(be(),1),q=ye();function Be({icon:e}){return(0,q.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,q.jsx)(e,{className:`h-5 w-5`,style:{color:`var(--system-negative-strong)`},"aria-hidden":`true`})})}var J={fontFamily:`var(--font-serif)`,fontSize:`32px`,fontWeight:400,lineHeight:1.2,letterSpacing:`0.64px`};function Y({title:e,subtitle:t}){return(0,q.jsxs)(`header`,{className:`flex flex-col items-center gap-2 pt-12 text-center`,children:[(0,q.jsx)(`h2`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(`p`,{className:`text-[14px] font-normal text-[var(--content-secondary)]`,children:t})]})}var Ve=[{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}],He=[{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 Ue({variant:e=`full`}){let t=k();return t?(0,q.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`creature-corners`,className:`pointer-events-none absolute inset-0 select-none`,children:(e===`top`?He:Ve).map((e,n)=>(0,q.jsx)(`span`,{className:`absolute ${e.position}`,style:{rotate:`${e.rotate}deg`},children:(0,q.jsx)(le,{components:t,bodyShapeId:e.bodyShape,eyeStyleId:e.eyeStyle,colorId:e.color,size:e.size})},n))}):null}var X={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.`},Z={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.`},Q={upgrade:X,downgrade:Z,change:Z};function We(e=`upgrade`){return Q[e]}function Ge(e,t=!0){let{data:n}=L({...y(),enabled:t&&e==null}),{data:r}=L({...N({path:{id:e??``}}),enabled:t&&e!=null});return e==null?n:r}function Ke({assistantId:e,direction:n}){let r=ve(),{t:i}=z(`settings`),a=Ge(e,o())?.name||i(`completeState.assistantFallbackName`);return(0,q.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,q.jsx)(Ue,{variant:`full`}),(0,q.jsxs)(`div`,{className:`relative flex w-full flex-col items-center`,children:[(0,q.jsx)(Y,{title:i(`completeState.title`),subtitle:We(n).completeSubtitle}),(0,q.jsx)(`div`,{className:`mt-10 flex w-full flex-col items-center gap-10`,children:(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-complete-return`,onClick:()=>{e!=null&&ie(e),r(s.assistant,{replace:!0})},children:i(`completeState.returnTo`,{assistantName:a})})})]})]})}function qe(e=!0,t){let n=Ge(t,e),r=t??n?.id,{data:i,isError:a,isFetching:o,dataUpdatedAt:s,errorUpdatedAt:c}=L({...d({path:{assistant_id:r??``}}),enabled:e&&!!r});return{assistant:n,assistantId:r,domains:i,domainsError:a,domainsFetching:o,domainsUpdatedAt:s,domainsErrorUpdatedAt:c}}var Je=1e3,Ye=1e4,Xe=2500,Ze=2e3,Qe=1e4,$e=[`machine_size`,`subdomain`,`non_field_errors`],et={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.`},tt={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 nt(e,t,n=`upgrade`){if(e&&typeof e==`object`){let t=e;if(typeof t.error==`string`){let e=(n===`upgrade`?void 0:tt[t.error])??et[t.error];if(e)return e}for(let e of $e){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 $=`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`,rt=`text-[11px] font-medium text-[var(--content-secondary)]`;function it({onExit:e,machineBusy:n=!1,assistantId:r}){let{t:i}=z(`settings`),a=R(),o=ke.use.emailRootDomain(),{assistant:s,assistantId:l,domains:u}=qe(!0,r),d=u?.results[0],[f,p]=(0,K.useState)(``),[m,h]=(0,K.useState)(`hi`),[g,_]=(0,K.useState)(!1);(0,K.useEffect)(()=>{if(!g){if(d){p(d.subdomain),_(!0);return}!s?.handle||f||(p(s.handle),_(!0))}},[s?.handle,d,g,f]);let[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(!1),S=he(C()),w=!!d||b,T=S.isPending||b;return(0,K.useEffect)(()=>{if(!b)return;let t=setTimeout(e,800);return()=>clearTimeout(t)},[b,e]),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(c.Body,{className:`animate-[onboarding-step-in_350ms_ease-out] space-y-6 pb-0 motion-reduce:animate-none`,children:[(0,q.jsx)(Ue,{variant:`top`}),(0,q.jsx)(Y,{title:i(`domainStep.title`),subtitle:i(`domainStep.subtitle`)}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-prefix`,className:rt,children:i(`domainStep.prefixLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-prefix`,value:m,onChange:e=>h(e.target.value.toLowerCase().trim()),disabled:T||w,readOnly:w,placeholder:i(`domainStep.emailUsernamePlaceholder`),className:`${$} w-24`})]}),(0,q.jsx)(`span`,{className:`flex h-8 items-center text-[var(--content-secondary)]`,children:`@`}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(`label`,{htmlFor:`onboarding-email-handle`,className:rt,children:i(`domainStep.handleLabel`)}),(0,q.jsx)(`input`,{id:`onboarding-email-handle`,value:f,onChange:e=>{p(e.target.value.toLowerCase().trim()),v&&y(null)},disabled:T||w,readOnly:w,autoFocus:!0,placeholder:i(`domainStep.subdomainExamplePlaceholder`),"aria-invalid":!!v,className:`${$} w-full min-w-0`})]}),(0,q.jsxs)(`span`,{className:`flex h-8 shrink-0 items-center text-[14px] text-[var(--content-tertiary)]`,children:[`.`,o]})]}),v&&(0,q.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:v}),w&&(0,q.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:i(`domainStep.domainLockedMessage`)})]}),n&&!w&&(0,q.jsx)(E,{tone:`neutral`,children:i(`domainStep.machineBusyNotice`)}),!w&&(0,q.jsx)(E,{tone:`info`,className:`border-transparent bg-[var(--surface-active)]`,children:(0,q.jsx)(`span`,{className:`font-medium text-[var(--content-tertiary)]`,children:i(`domainStep.handleImmutableNotice`)})}),b?(0,q.jsx)(E,{tone:`success`,children:i(`domainStep.domainSetRedirecting`)}):null]}),(0,q.jsx)(c.Footer,{className:`items-center pt-6`,children:w?(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-domain-continue`,onClick:e,children:i(`domainStep.continue`)}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(t,{variant:`outlined`,"data-testid":`onboarding-domain-skip`,disabled:T,onClick:()=>{T||S.mutate({body:{skipped:!0}},{onSuccess:e,onError:()=>e()})},children:i(`domainStep.skip`)}),(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-domain-set`,disabled:!f||T||n,onClick:()=>{T||n||!f||S.mutate({body:{subdomain:f,...m?{email_username:m}:{}}},{onSuccess:()=>{y(null),x(!0),a.invalidateQueries({queryKey:ue()}),a.invalidateQueries({queryKey:D({path:{assistant_id:l??``}})}),a.invalidateQueries({queryKey:ce()})},onError:e=>{y(nt(e,i(`domainStep.registerSubdomainFailed`)))}})},children:i(`domainStep.next`)})]})})]})}function at({onGoToBilling:e,direction:n}){let{t:r}=z(`settings`);return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-4 px-6 py-10 text-center`,children:[(0,q.jsx)(Be,{icon:B}),(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(v,{variant:`title-small`,as:`h1`,children:r(`errorStates.fetchErrorTitle`)}),(0,q.jsx)(v,{variant:`body-medium-lighter`,as:`p`,className:`text-[var(--content-secondary)]`,children:We(n).fetchErrorBody})]}),(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-go-to-billing`,onClick:e,children:r(`errorStates.goToBilling`)})]})}function ot(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:W[n.machineSize],to:W[r]}):n.machineSize!==t.machineSize&&a.push({key:`machine`,label:`Machine`,from:n.machineSize==null?void 0:W[n.machineSize],to:W[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 st=60,ct=st*2;function lt({imageUrl:e,animateIn:t=!0}){return(0,q.jsxs)(`div`,{"aria-hidden":!0,"data-testid":`takeover-backdrop`,className:`pointer-events-none absolute inset-0 overflow-hidden${t?` provision-avatar-reveal`:``}`,children:[(0,q.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(${st}px)`,width:`calc(100% + ${ct*2}px)`,height:`calc(100% + ${ct*2}px)`}}),(0,q.jsx)(`div`,{className:`absolute inset-0 bg-black/55`})]})}function ut(e,t){if(t!=null)return e?.credit_tiers?.find(e=>e.tier===t)}function dt(e){let t=e?.match(/^credits_(\d+)$/)?.[1];return t==null?null:Number(t)}function ft(e){let t=o(),{data:n}=L({...S(),enabled:t&&e});return n?.plans.find(e=>e.id===`pro`)}function pt(e,t){return t==null?0:ut(e,t)?.credits_usd??dt(t)}function mt(e,t){return t==null?null:ut(e,t)?.label}function ht(e){let t=ft(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=ut(t,i?.credit_tier);n=i?.credits_usd??a?.credits_usd,r=i?.usage_label??a?.label??void 0}else{let i=ut(t,e.creditTier);n=i?.credits_usd,r=i?.label}return n==null?null:{fromLabel:null,toLabel:r}}function gt(e){let t=ft(e!=null);return e==null||pt(t,e.fromTier)==null||pt(t,e.toTier)==null?null:{fromLabel:mt(t,e.fromTier),toLabel:mt(t,e.toTier)}}function _t(e){let t=A.use.activeAssistantId(),n=e===void 0?t:e,{components:i,traits:a,customImageUrl:o,state:s,isLoading:c}=pe(n),l=(0,K.useMemo)(()=>oe(),[re()]),u=l!=null&&se(l)?l:null,d=n!=null&&!c,f=u!=null&&(n==null||n===u.assistantId),p=f&&!(d&&(i!=null||a!=null||o!=null))?u:null,m=p?p.components:i,h=p?p.traits:a,g=p?null:o,_=d||f,v=ee({state:p?null:s,components:m,traits:h,customImageUrl:g})??(g?null:r[0]?.hex??null);return{tintHex:_&&v?w(v):x,backdropImageUrl:_?g:null,ready:_,avatar:{components:m,traits:h,customImageUrl:g}}}function vt(e,t){let[n,r]=(0,K.useState)(e),i=(0,K.useRef)(0);return(0,K.useEffect)(()=>{i.current=performance.now()},[]),(0,K.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 yt=`--takeover-surface`,bt=`var(${yt},${x})`,xt=`color-mix(in srgb, var(--content-emphasised) 10%, transparent)`,St=240,Ct=1.414,wt=[{minHeight:680,size:St},{minHeight:600,size:184}],Tt=132;function Et(e){for(let t of wt)if(e>=t.minHeight)return t.size;return Tt}function Dt(){let[e,t]=(0,K.useState)(()=>Et(typeof window>`u`?1/0:window.innerHeight));return(0,K.useEffect)(()=>{let e=()=>t(Et(window.innerHeight));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}var Ot={machine:Oe,storage:H,credits:U},kt={idle:``,working:` is-working`,settling:` is-settling`,stalled:` is-stalled`,grown:` is-evolved`};function At(e,t){return e===`DONE`||e===`NOT_APPLICABLE`?`grown`:e===`STALLED`?`stalled`:e===`WAITING`||e===`RESIZING`?t?`settling`:`working`:`idle`}function jt({assistantId:e,mode:t,downsizing:n=!1}){let{avatar:r,ready:i}=_t(e),a=k(),o=Dt(),s=t===`working`||t===`settling`;return(0,q.jsxs)(`div`,{"aria-hidden":!0,className:`provision-avatar-evolve relative z-10 flex flex-col items-center${kt[i?t:`idle`]}${n?` is-downsizing`:``}`,style:{"--provision-avatar-size":`${o}px`,"--provision-avatar-growth":Ct},children:[(0,q.jsxs)(`div`,{className:`provision-avatar-stage`,children:[(0,q.jsx)(`div`,{"data-testid":`provision-avatar-placeholder`,className:`provision-avatar-placeholder${i?` is-resolved`:``}`}),(0,q.jsx)(`div`,{className:`provision-avatar-layer`,children:(0,q.jsx)(`div`,{className:`provision-avatar-current`,children:(0,q.jsx)(`div`,{className:`provision-avatar-strain`,children:i&&(0,q.jsx)(`div`,{className:`provision-avatar-reveal`,children:(0,q.jsx)(M,{components:r.components??a,traits:r.traits,customImageUrl:r.customImageUrl,size:o,isAssistantBusy:s})})})})})]}),(0,q.jsx)(`div`,{className:`provision-avatar-shadow`})]})}function Mt({status:e,caption:t}){return(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,q.jsx)(`h1`,{className:`text-[var(--content-emphasised)]`,style:J,children:e}),t&&(0,q.jsx)(v,{variant:`body-medium-lighter`,as:`p`,className:`max-w-sm text-[var(--content-secondary)]`,children:t})]})}function Nt({icon:e,label:t,from:n,to:r,done:i=!1,pending:a=!1,testId:o}){let{t:s}=z(`settings`),c=null;return i?c=s(`provisioningState.statusComplete`):a&&(c=s(`provisioningState.statusPending`)),(0,q.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:xt},children:[(0,q.jsx)(`span`,{className:`hidden h-6 w-6 shrink-0 items-center justify-center min-[420px]:flex`,children:(0,q.jsx)(e,{className:`h-3.5 w-3.5 text-[var(--content-tertiary)]`,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1 text-left wrap-anywhere`,children:[(0,q.jsx)(`span`,{className:`text-[12px] font-medium leading-tight text-[var(--content-tertiary)]`,children:t}),(0,q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-1.5 text-[14px] font-medium leading-[18px] text-[var(--content-emphasised)]`,children:[n&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{children:n}),(0,q.jsx)(`span`,{className:`sr-only`,children:s(`provisioningState.srOnlyTo`)}),(0,q.jsx)(we,{className:`h-3 w-3 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":`true`})]}),(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,q.jsx)(`span`,{children:r}),i?(0,q.jsx)(De,{"data-testid":`chip-check`,className:`h-3.5 w-3.5 shrink-0 text-[var(--system-positive-strong)]`,"aria-hidden":`true`}):a&&(0,q.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,q.jsx)(`span`,{className:`sr-only`,children:c})]})]})]})}function Pt({label:e}){return(0,q.jsx)(`span`,{className:`rounded-lg px-3 py-2 text-[14px] text-[var(--content-emphasised)]`,style:{backgroundColor:xt},children:e})}function Ft({children:e,wide:t=!1,testId:n}){return(0,q.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 It(e,t){return e===`credits`?!0:t?.[e]===!0}function Lt(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 Rt({intent:e,creditsChange:t,targets:n,fromSnapshot:r,machineFloor:i,landed:a,allDone:o=!1,creditsOnly:s=!1}){let{t:c}=z(`settings`),l=ht(e),u=gt(t),d=ot({targets:n,fromSnapshot:r,machineFloor:i,credits:Lt(l??u,c)}),f=s?d.filter(e=>e.key===`credits`):d,p=f.filter(e=>o||It(e.key,a)).map(e=>e.label).join(`, `),[m]=(0,K.useState)(p),h=p===m?``:c(`provisioningState.dimensionsComplete`,{dimensions:p});return f.length===0?null:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Ft,{testId:`resource-chips`,wide:f.length>=3,children:f.map(e=>{let t=o||It(e.key,a);return(0,q.jsx)(Nt,{testId:`chip-${e.key}`,icon:Ot[e.key],label:e.label,from:e.from,to:e.to,done:t,pending:!t},e.key)})}),(0,q.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,"data-testid":`chip-announcement`,children:h})]})}function zt({intent:e}){let{t}=z(`settings`),n=ht(e.kind===`custom`?e:null);if(e.kind===`package`)return(0,q.jsx)(Ft,{children:(0,q.jsx)(Pt,{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,q.jsxs)(Ft,{wide:r>=3,children:[e.machineTier!=null&&(0,q.jsx)(Nt,{icon:Oe,label:t(`provisioningState.machineLabel`),to:je[e.machineTier]??e.machineTier}),e.storageTier!=null&&(0,q.jsx)(Nt,{icon:H,label:t(`provisioningState.storageLabel`),to:e.storageTier.toUpperCase()}),e.creditTier!=null&&n?.toLabel!=null&&(0,q.jsx)(Pt,{label:n.toLabel})]})}function Bt({state:e,direction:n,softWaiting:r,intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,celebrating:u,onCelebrationEnd:d,assistantId:f,escapeAvailable:p,onEscape:m,onPhaseChange:h,kickError:g,confirm:_,dwellMs:v=Xe,phaseMinMs:y=900}){let{t:b}=z(`settings`),x=We(n),S=(0,K.useRef)(d);(0,K.useEffect)(()=>{S.current=d},[d]);let C=vt(e,y),w=C===`DONE`||C===`NOT_APPLICABLE`,T=C===`RESIZING`?`WAITING`:C,E=(0,K.useRef)(h);(0,K.useEffect)(()=>{E.current=h},[h]),(0,K.useEffect)(()=>{E.current?.(C)},[C]);let{tintHex:D,backdropImageUrl:O}=_t(f),k=u&&w;return(0,K.useEffect)(()=>{if(!k)return;let e=setTimeout(()=>S.current(),v);return()=>clearTimeout(e)},[k,v]),(0,q.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:{[yt]:D,backgroundColor:bt},children:[O&&(0,q.jsx)(lt,{imageUrl:O}),(0,q.jsx)(jt,{assistantId:f,mode:At(C,r),downsizing:n===`downgrade`}),(0,q.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=b(`provisioningState.continueInBackground`)){return p?(0,q.jsx)(t,{variant:`ghost`,"data-testid":`provisioning-escape`,onClick:m,children:e}):null}function j({allDone:e=!1,creditsOnly:t=!1}={}){return(0,q.jsx)(Rt,{intent:i,creditsChange:a,targets:o,fromSnapshot:s,machineFloor:c,landed:l,allDone:e,creditsOnly:t})}function ee(){if(C===`CONFIRMING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmingStatus,caption:b(`provisioningState.confirmingCaption`)}),i&&(0,q.jsx)(zt,{intent:i}),A()]});if(C===`WAITING`||C===`RESIZING`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.waitingStatus,caption:b(r?`provisioningState.waitingCaptionLong`:`provisioningState.waitingCaptionShort`)}),j(),A()]});if(C===`DONE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.allDoneStatus`)}),j({allDone:!0})]});if(C===`NOT_APPLICABLE`)return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:b(`provisioningState.planReadyStatus`)}),j({allDone:!0,creditsOnly:!0})]});if(C===`STALLED`){let e=g!=null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:e?x.snagStatus:b(`provisioningState.takingLongerStatus`),caption:e?nt(g,x.snagCaption,n):b(`provisioningState.stalledCaption`)}),j(),e?A(b(`provisioningState.retryInBackground`)):A()]})}return C===`CONFIRM_TIMEOUT`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Mt,{status:x.confirmTimeoutStatus,caption:x.confirmTimeoutCaption}),(0,q.jsxs)(`div`,{className:`flex items-center gap-2 pt-1`,children:[(0,q.jsx)(t,{variant:`outlined`,"data-testid":`onboarding-go-to-billing`,onClick:_.onGoToBilling,children:b(`provisioningState.goToBilling`)}),(0,q.jsx)(t,{variant:`primary`,"data-testid":`onboarding-retry`,onClick:_.onRetry,children:b(`provisioningState.tryAgain`)})]})]}):null}}function Vt(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&&!Pe(n,i);if(Pe(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 Ht=2e3,Ut=1e3,Wt=[`DONE`,`NOT_APPLICABLE`,`CONFIRM_TIMEOUT`],Gt={assistantId:null,machine:null,storage:null};function Kt({open:e,canLowerResources:t=!1,verdictRecheckMs:n=Qe}){let r=R(),i=o(),[a,s]=(0,K.useState)(!1),[c,u]=(0,K.useState)(0),[d,m]=(0,K.useState)(null),[h,_]=(0,K.useState)(null),[v,b]=(0,K.useState)(null),[x,S]=(0,K.useState)(null),[C,w]=(0,K.useState)(null),[T,E]=(0,K.useState)(null),[D,k]=(0,K.useState)(Gt),[A,j]=(0,K.useState)(null),[ee,M]=(0,K.useState)(!1),ne=(0,K.useRef)(!1),re=(0,K.useRef)(!1),P=(0,K.useRef)(0),[ie,ae]=(0,K.useState)(!1),[oe,se]=(0,K.useState)(null),[F,le]=(0,K.useState)(null),[ue,de]=(0,K.useState)(null),[fe,pe]=(0,K.useState)(()=>Date.now()),[me,I]=(0,K.useState)(!0);(0,K.useEffect)(()=>{e||(s(!1),u(0),m(null),_(null),b(null),ae(!1),se(null),le(null),de(null),I(!0),S(null),w(null),E(null),k(Gt),j(null),M(!1),ne.current=!1,re.current=!1,P.current+=1)},[e]),(0,K.useEffect)(()=>{e&&(m(Date.now()),r.invalidateQueries({queryKey:O()}),r.invalidateQueries({queryKey:ce()}))},[e,r]);let z=h!=null,ve=L({...f(),refetchInterval:e=>e.state.data?.plan_id===`pro`||a?!1:Je,refetchIntervalInBackground:!1,enabled:e&&i&&!z}),ye=(d!=null&&ve.dataUpdatedAt>=d?ve.data?.plan_id:null)??null;(0,K.useEffect)(()=>{if(!e||z||ye!==`pro`)return;let t=Date.now();_(t),pe(t)},[e,z,ye]),(0,K.useEffect)(()=>{if(!e||z)return;let t=setTimeout(()=>s(!0),Ye);return()=>clearTimeout(t)},[e,z,c]);let be=(0,K.useCallback)(()=>{s(!1),u(e=>e+1),g.getState().fetchOrganizations(),r.invalidateQueries({queryKey:O()})},[r]),xe=(0,K.useCallback)(()=>{let e=Date.now();b(e),pe(e)},[]),{mutate:Se}=he(l()),B=(0,K.useCallback)(e=>{let t=P.current;Se({},{onSuccess:n=>{t===P.current&&(j(null),Ie(n)?re.current?j({error:n.reason??`no_active_pro`}):(re.current=!0,M(!0),e===`escape`&&xe()):(S(n.state),e===`escape`&&xe()))},onError:e=>{t===P.current&&j(e)}})},[Se,xe]);(0,K.useEffect)(()=>{!e||!i||!z||ne.current||(ne.current=!0,B(`auto`))},[e,i,z,B]),(0,K.useEffect)(()=>{if(!ee)return;let e=P.current,t=setTimeout(()=>{M(!1),e===P.current&&B(`auto`)},Ze);return()=>clearTimeout(t)},[ee,B]);let Ce=(0,K.useCallback)(()=>B(`escape`),[B]),V=L({...p(),enabled:e&&i&&z}),we=me?Ht:!1,Te=L({...y(),enabled:e&&i&&z,refetchInterval:e=>e.state.data?.id==null?we:!1,retry:!1}),H=z&&d!=null&&V.dataUpdatedAt>=d,Ee=H&&!V.isPending&&!V.isFetching,U=(H?V.data?.primary_assistant_id:null)??(V.isPending?null:Te.data?.id??null),De=L({...N({path:{id:U??`unresolved`}}),enabled:e&&i&&z&&U!=null,refetchInterval:we,retry:!1}),Oe=te({path:{id:U??`unresolved`}}),ke=L({...Oe,enabled:e&&i&&z&&U!=null,refetchInterval:we,retry:!1}),W=(0,K.useRef)(0),[je,Me]=(0,K.useState)(0),ze=_e(Oe.queryKey);(0,K.useEffect)(()=>r.getQueryCache().subscribe(t=>{if(!(t.type!==`updated`||t.query.queryHash!==ze)){if(t.action.type===`fetch`)W.current+=1;else if(t.action.type===`success`&&!t.action.manual){let n=W.current,r=e&&Le(t.action.data);ge.schedule(()=>{Me(n),r&&(ae(!0),se(U))})}}}),[r,ze,e,U]);let q=Le(ke.data),Be=oe===U,J=V.data,Y=(0,K.useMemo)(()=>J?{machineSize:Ae(J.max_machine_tier),storageGib:J.selected_storage_gib??null}:null,[J]),Ve=J!=null&&J.max_machine_tier==null?Ne:null,He=J?J.domain_setup_available&&J.primary_assistant_id!=null:void 0,Ue=De.data,X=(0,K.useMemo)(()=>Ue?{machineSize:Ue.machine_size??null,storageGib:Ue.provisioned_storage_gib??null}:null,[Ue]),Z=ue===U,Q=(0,K.useMemo)(()=>{let e=Re(Y,X),t=Y?.machineSize??Ve;if(t==null)return e;let n=X?.machineSize??null;if(n==null)return{...e,machine:!1};let r=(Z?F?.machineSize:null)??n,i=G(t)<G(r);return{...e,machine:i?G(n)<=G(t):G(n)>=G(t)}},[Y,X,F,Z,Ve]),We=Pe(Y,X),Ge=T===U;(0,K.useEffect)(()=>{e&&(We?(w(e=>e!=null&&Ge?e:Date.now()),E(U)):(w(null),E(null)))},[e,We,U,Ge]);let Ke=D.assistantId===U;(0,K.useEffect)(()=>{if(!e)return;let t=W.current;k(e=>{let n=e.assistantId===U?e:Gt,r=Q.machine?n.machine??t:null,i=Q.storage?n.storage??t:null;return e.assistantId===U&&e.machine===r&&e.storage===i?e:{assistantId:U,machine:r,storage:i}})},[e,Q,U]);let qe=(0,K.useMemo)(()=>{let e=Fe(ke.data),t=e=>e!=null&&Ke&&je>e;return{machine:Q.machine&&!e.machine&&t(D.machine),storage:Q.storage&&!e.storage&&t(D.storage)}},[Q,D,Ke,je,ke.data]);(0,K.useEffect)(()=>{!e||!X||F!=null&&Z||(le(X),de(U))},[e,X,U,F,Z]);let Xe=v??h,$e=Xe==null?null:Math.max(0,fe-Xe),et=!t,{state:tt,softWaiting:nt}=Vt({planId:z?`pro`:ye,targets:Y,actuals:X,initialActuals:Z?F:null,resizeOperationInFlight:q,sawOperation:ie&&Be,msSinceWatchStart:$e,confirmExpired:a,serverVerdict:x,statusObservedSinceTargetsMet:C!=null&&Ge&&ke.dataUpdatedAt>C,targetsProveNoop:et}),$=Wt.includes(tt),rt=e&&z&&!$;(0,K.useEffect)(()=>{I(rt)},[rt]),(0,K.useEffect)(()=>{if(!e||!z||$)return;let t=setInterval(()=>pe(Date.now()),Ut);return()=>clearInterval(t)},[e,z,$]);let it=!et&&(x===`started`||x===`in_progress`)&&!(ie&&Be);return(0,K.useEffect)(()=>{if(!e||!z||$||!it)return;let t=setInterval(()=>B(`auto`),n);return()=>clearInterval(t)},[e,z,$,it,n,B]),{state:tt,softWaiting:nt,targets:Y,actualsSnapshot:F,machineFloor:Ve,landed:qe,assistantId:U,domainStepAvailable:He,onboardingSettled:Ee,confirmError:!z&&ve.isError,targetsError:z&&V.isError&&(!J||!H),escapeEligible:$e!=null&&$e>=6e4,retryConfirm:be,kickProvisioning:Ce,kickError:A}}var qt=200,Jt=380;function Yt(){return typeof window<`u`&&window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches===!0}var Xt=e=>e===`WAITING`||e===`RESIZING`||e===`STALLED`,Zt=e=>e===`DONE`||e===`NOT_APPLICABLE`,Qt={machineSize:null,storageGib:null};function $t({open:e,onClose:t,dwellMs:n,phaseMinMs:r,mode:a=`checkout`,resizeContext:o}){let{t:s}=z(`settings`),l=a===`resize`,u=R(),[d,f]=(0,K.useState)(`provisioning`),[p,g]=(0,K.useState)(`idle`),_=(0,K.useRef)([]),[v,y]=(0,K.useState)(null),[b,x]=(0,K.useState)(null),[S,C]=(0,K.useState)(null),[w,T]=(0,K.useState)(!1),E=l?o?.direction:void 0,O=We(E),k=Kt({open:e,canLowerResources:l?o?.canLowerResources===!0:!1}),A=(0,K.useRef)(!1);(0,K.useEffect)(()=>{if(e){A.current=!0,y(l?null:i()),C(e=>e??Date.now());return}_.current.forEach(clearTimeout),_.current=[],f(`provisioning`),g(`idle`),x(null),C(null),T(!1),A.current&&(A.current=!1,ne())},[e,l]),(0,K.useEffect)(()=>()=>{_.current.forEach(clearTimeout)},[]),(0,K.useEffect)(()=>{d===`complete`&&fe()},[d]);let j=Xt(k.state),ee=Zt(b??k.state),{targets:te,assistantId:M,domainStepAvailable:N,onboardingSettled:re}=k,P=l?o?.fromSnapshot:void 0,ie=k.actualsSnapshot,ae={machineSize:P?.machineSize??ie?.machineSize??null,storageGib:P?.storageGib??ie?.storageGib??null},{tintHex:oe,backdropImageUrl:se}=_t(M),F=l&&N===!0,{domains:ce,domainsError:le,domainsFetching:ue,domainsUpdatedAt:de,domainsErrorUpdatedAt:pe}=qe(e&&F,M),me=(ce?.results.length??0)>0,I=(0,K.useRef)(null);(0,K.useEffect)(()=>{if(!e){I.current=null;return}!F||M==null||I.current!==M&&(I.current=M,u.invalidateQueries({queryKey:D({path:{assistant_id:M}})}))},[e,F,M,u]);let he=!ue&&(S!=null&&de>=S||S!=null&&!!le&&pe>=S),[L,ge]=(0,K.useState)(!1),_e=re&&(!F||he);(0,K.useEffect)(()=>{if(!e){ge(!1);return}_e&&ge(!0)},[e,_e]);let ve=(0,K.useCallback)(()=>{let e=l?N===!0&&!me?`domain`:`complete`:N===!1?`complete`:`domain`;if(Yt()){f(e);return}g(`covering`),_.current.push(setTimeout(()=>{f(e),g(`revealing`),_.current.push(setTimeout(()=>g(`idle`),Jt))},qt))},[N,l,me]),ye=(0,K.useCallback)(()=>{T(!0)},[]),be=(0,K.useCallback)(()=>{k.kickProvisioning(),h.info(k.kickError==null?O.backgroundExitToast:O.backgroundRetryToast),T(!1),t()},[k,t,O]),xe=(0,K.useCallback)(()=>{T(!1)},[]),Se=d===`provisioning`&&(k.confirmError||k.targetsError),B=d===`provisioning`&&!Se,Ce=B&&!ee,V=`transition-[background-color] duration-300 ease-out${B?` bg-black p-0`:``}`,we=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,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(c.Root,{open:e,onOpenChange:e=>{e||t()},children:(0,q.jsxs)(c.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:{[yt]:oe},children:[(0,q.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col motion-reduce:[animation:none] ${we}`,children:Te()},d),p!==`idle`&&(0,q.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:bt},children:se&&(0,q.jsx)(lt,{imageUrl:se,animateIn:!1})})]})}),(0,q.jsx)(m,{open:w&&j,title:s(`billingOnboardingModal.backgroundConfirmTitle`),message:O.backgroundConfirmMessage,confirmLabel:s(`billingOnboardingModal.backgroundConfirmContinue`),cancelLabel:s(`billingOnboardingModal.backgroundConfirmKeepWaiting`),onConfirm:be,onCancel:xe})]});function Te(){return d===`provisioning`?k.confirmError||k.targetsError?(0,q.jsx)(at,{onGoToBilling:t,direction:E}):(0,q.jsx)(Bt,{state:k.state,direction:E,softWaiting:k.softWaiting,intent:v,creditsChange:l?o?.credits:void 0,targets:te??Qt,fromSnapshot:ae,machineFloor:k.machineFloor,landed:k.landed,celebrating:L,onCelebrationEnd:ve,assistantId:M,escapeAvailable:j&&k.escapeEligible,onEscape:ye,onPhaseChange:x,kickError:k.kickError,confirm:{onRetry:k.retryConfirm,onGoToBilling:t},dwellMs:n,phaseMinMs:r}):d===`domain`?(0,q.jsx)(it,{machineBusy:j,assistantId:M,onExit:()=>f(`complete`)}):(0,q.jsx)(Ke,{assistantId:M,direction:E})}}function en(e){return e!=null&&!e.customized}function tn(e){return en(e)?e.name:`Custom`}var nn=[`mighty`,`super`,`ultra`],rn=[`free`,...nn];function an(e){return rn.indexOf(e)}function on(e,t){if(e===null)return`upgrade`;let n=an(e),r=an(t);return n===-1||r===-1?`upgrade`:r===n?`current`:r<n?`downgrade`:`upgrade`}function sn(e,t){if(e.length===0)return null;let n=[...e].sort((e,t)=>nn.indexOf(e.key)-nn.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 cn=[`too_expensive`,`missing_features`,`switched_service`,`unused`,`too_complex`,`low_quality`,`customer_service`,`other`],ln={too_expensive:`cancelReasonSurvey.optionTooExpensive`,missing_features:`cancelReasonSurvey.optionMissingFeatures`,switched_service:`cancelReasonSurvey.optionSwitchedService`,unused:`cancelReasonSurvey.optionUnused`,too_complex:`cancelReasonSurvey.optionTooComplex`,low_quality:`cancelReasonSurvey.optionLowQuality`,customer_service:`cancelReasonSurvey.optionCustomerService`,other:`cancelReasonSurvey.optionOther`},un=1e3,dn={feedback:null,comment:``};function fn(e){return e.feedback!=null}function pn(e){let t=e.feedback===`other`?e.comment.trim():``;return{feedback:e.feedback,comment:t||null}}function mn({value:e,onChange:t,disabled:r}){let{t:i}=z(`settings`);return(0,q.jsxs)(`div`,{className:`mt-5 space-y-3`,"data-testid":`cancel-reason-survey`,children:[(0,q.jsx)(v,{as:`p`,variant:`body-medium-default`,children:i(`cancelReasonSurvey.title`)}),(0,q.jsx)(n,{value:e.feedback??``,onValueChange:n=>t({...e,feedback:n===``?null:n}),name:`cancel-reason`,disabled:r,"aria-label":i(`cancelReasonSurvey.title`),children:cn.map(e=>(0,q.jsx)(me,{value:e,label:i(ln[e])},e))}),e.feedback===`other`?(0,q.jsx)(T,{label:i(`cancelReasonSurvey.otherLabel`),placeholder:i(`cancelReasonSurvey.otherPlaceholder`),value:e.comment,onChange:n=>t({...e,comment:n.target.value}),maxLength:un,rows:3,disabled:r,fullWidth:!0,"data-testid":`cancel-reason-comment`}):null]})}var hn={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 gn({tier:e,size:t=40}){let n=hn[e]??hn.free,r=k();return(0,q.jsx)(`div`,{"aria-hidden":!0,className:`inline-flex shrink-0`,children:r?(0,q.jsx)(le,{components:r,bodyShapeId:n.bodyShape,colorId:n.color,size:t}):(0,q.jsx)(`div`,{style:{width:t,height:t}})})}var _n={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 vn(e){return _n[e]}function yn(e){return`Downgrade to ${e}`}function bn(e){let t=e/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}function xn(e){return`${bn(e)}/mo`}function Sn(e){return`${bn(e)}/month`}function Cn(e){return`${e>0?`+`:`−`}${bn(Math.abs(e))}/mo`}function wn(e){return`${e} GB storage`}function Tn(e){return`${bn(e*100)} of bundled credits`}var En=`Small`;function Dn(e){return e?.machine_size?W[e.machine_size]??e.machine_size:En}function On(e,t){let n=vn(e.key)?.extraFeatures??[];return[{icon:ze,label:`${Dn(e)} Machine`},{icon:H,label:`${e.storage_gib} GB Storage`},{icon:U,label:t},...n.map(e=>({icon:xe,label:e}))]}function kn(){return[{icon:ze,label:`${En} Machine`},{icon:H,label:`4 GB Storage`},{icon:U,label:`Pay as you go credits`}]}function An(e,t=[]){let n=e?.credits_usd??0,r=e?.storage_gib??4,i=Me[e?.machine_size??`small`];return[`${Dn(e)} machine${i?` (${i})`:``}`,wn(r),e?.usage_label??Tn(n),...t]}var jn={machine:`Configurable machine size`,storage:`Configurable storage`,credits:`Pay-as-you-go and bundled credits`};function Mn(e,t){let n=[`${e.machineTier?je[e.machineTier]??t.machine_tiers.find(t=>t.tier===e.machineTier)?.label??e.machineTier:En} Machine`];if(e.storageGib!=null&&n.push(`${e.storageGib} GB`),e.creditTier!=null){let r=ut(t,e.creditTier)?.label,i=dt(e.creditTier);n.push(r??(i==null?`Credit bundle`:`${i} credits/mo`))}return n}function Nn(e,t){let n=new Set([jn.machine]);return e.storageGib!=null&&n.add(jn.storage),e.creditTier!=null&&n.add(jn.credits),[...Mn(e,t),...t.included_features.filter(e=>!n.has(e))]}function Pn(e){return e.disabled===!0}function Fn({machineTiers:e,storageTiers:t,selectedMachineTier:n,selectedStorageTier:r,onMachineTierChange:i,onStorageTierChange:o,currentMachinePriceCents:s,currentStoragePriceCents:c}){let{t:l}=z(`settings`),u=(0,K.useMemo)(()=>e.map(e=>{let t=je[e.tier]??e.label,n=s==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===s?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-s);return{value:e.tier,label:l(`tierPicker.machineOption`,{label:t,priceLabel:n}),disabled:Pn(e)}}),[e,s,l]),d=(0,K.useMemo)(()=>t.map(e=>{let t=c==null?l(`tierPicker.priceAddon`,{price:xn(e.price_cents)}):e.price_cents===c?l(`tierPicker.priceCurrent`,{price:xn(e.price_cents)}):Cn(e.price_cents-c);return{value:e.tier,label:l(`tierPicker.storageOption`,{gib:e.storage_gib,priceLabel:t}),disabled:Pn(e)}}),[t,c,l]);return(0,q.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(v,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.machineLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.machineTooltip`),children:(0,q.jsx)(Ee,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(a,{"aria-label":l(`tierPicker.machineAriaLabel`),placeholder:l(`tierPicker.machinePlaceholder`),value:n??``,onChange:i,options:u})]}),(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(v,{as:`p`,variant:`label-small-default`,className:`text-[var(--content-secondary)]`,children:l(`tierPicker.storageLabel`)}),(0,q.jsx)(`span`,{title:l(`tierPicker.storageTooltip`),children:(0,q.jsx)(Ee,{className:`h-3 w-3 text-[var(--content-tertiary)]`})})]}),(0,q.jsx)(a,{"aria-label":l(`tierPicker.storageAriaLabel`),placeholder:l(`tierPicker.storagePlaceholder`),value:r??``,onChange:o,options:d})]})]})}var In=new Set([`active`,`trialing`,`past_due`]);function Ln(e){return e.plan_id!==`base`&&e.cancel_at_period_end!==!0&&!e.cancel_at&&e.status!=null&&In.has(e.status)}function Rn(e){return e?.status!=null&&In.has(e.status)}var zn=[`target_plan_id`,`confirm`,`machine_tier`,`storage_tier`,`credit_tier`,`package`,`non_field_errors`];function Bn(e,t){if(e&&typeof e==`object`){for(let t of zn)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 Vn(e,t){let n=e.filter(e=>!Pn(e));return t!==null&&n.some(e=>e.tier===t)?t:n[0]?.tier??null}function Hn(e,t,n){return t===void 0?n:t!==null&&(t===n||e.some(e=>e.tier===t))?t:null}function Un(e){return e.length?Math.min(...e.map(e=>e.price_cents)):0}function Wn(){let e=R();return async t=>{try{let n=await t.mutateAsync();return await e.invalidateQueries({queryKey:O()}),t.onSuccess(n),n}catch(e){return h.error(Bn(e,t.errorFallback()),{id:t.errorToastId}),null}}}var Gn=`billing-portal-return-snapshot`;function Kn(e){try{sessionStorage.removeItem(Gn),sessionStorage.setItem(Gn,JSON.stringify(e))}catch{}}function qn(){if(typeof sessionStorage>`u`)return null;try{let e=sessionStorage.getItem(Gn);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 Jn(){try{sessionStorage.removeItem(Gn)}catch{}}function Yn(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 Xn(e){let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{year:`numeric`,month:`long`,day:`numeric`})}function Zn(e){return e?e.cancel_at??e.current_period_end??null:null}function Qn(e){let t=R();return(0,K.useEffect)(()=>j(()=>{t.invalidateQueries(f())}),[t]),ae({onSuccess:t=>{e&&Kn(e),P(t.portal_url)},onError:()=>{h.error(I(`settings:useBillingPortalSession.openError`),{id:`billing-portal-session-error`})}})}function $n(){let e=de(),t=Wn();return{cancelSubscription:n=>t({mutateAsync:()=>e.mutateAsync({body:n}),onSuccess:e=>{let t=e.cancel_at?Xn(e.cancel_at):I(`settings:useCancelSubscription.endOfBillingPeriod`);h.info(I(`settings:useCancelSubscription.canceledToast`,{date:t}),{id:`subscription-cancel`})},errorToastId:`subscription-cancel-error`,errorFallback:()=>I(`settings:useCancelSubscription.cancelFailedToast`)}),isPending:e.isPending}}function er(e){return Promise.all([e.invalidateQueries({queryKey:O()}),e.invalidateQueries({queryKey:u()}),e.invalidateQueries({queryKey:ce()}),e.invalidateQueries({queryKey:_()})])}function tr({enabled:e=!0}={}){let t=R(),{t:n}=z(`settings`),[r,i]=(0,K.useState)(null),a=(0,K.useRef)(!1),[s,c]=(0,K.useState)(!1),l=o(),u=e&&l,d=L({...f(),enabled:u}),m=d.data,g=m!=null&&m.plan_id!==`base`,_=L({...p(),enabled:u&&g}),v=L({...S(),enabled:u&&g}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],y=e=>v.find(t=>t.tier===e)?.price_cents??null,x=he(b()),C={machineTier:_.data?.max_machine_tier??null,storageTier:_.data?.selected_storage_tier??null,storageGib:_.data?.selected_storage_gib??null,creditTier:m?.selected_credit_tier??null,hasPlatformFee:m?.has_platform_fee??!0},w=m!=null&&m.plan_id!==`base`&&m.status!=null&&In.has(m.status)&&m.cancel_at_period_end!==!0&&!m.cancel_at,T=!g||!_.isPending,E=!g||_.isSuccess&&_.data!=null&&!_.isFetching&&_.dataUpdatedAt>=d.dataUpdatedAt,D=s||x.isPending,O=async(e,t=C)=>{if(a.current)return null;a.current=!0,c(!0);try{return await k(e,t)}finally{a.current=!1,c(!1)}},k=async(e,r)=>{i(null);let a=e=>(i(e),h.error(e),null),[o,s]=await Promise.all([d.refetch(),_.refetch()]),c=o.data,l=s.data;if(o.isError||s.isError||c==null||l==null)return a(n(`customPlanModal.changeFailed`));let u={machineTier:l.max_machine_tier??null,storageTier:l.selected_storage_tier??null,storageGib:l.selected_storage_gib??null,creditTier:c.selected_credit_tier??null,hasPlatformFee:c.has_platform_fee??!0},f={machineTier:e.machineTier===r.machineTier?u.machineTier:e.machineTier,storageTier:e.storageTier===r.storageTier&&u.storageTier!=null?u.storageTier:e.storageTier,creditTier:e.creditTier===r.creditTier?u.creditTier:e.creditTier},p=f.machineTier!==u.machineTier,m=f.storageTier!==u.storageTier,g=f.creditTier!==u.creditTier,v=!u.hasPlatformFee,b=y(f.machineTier),S=y(u.machineTier),C=p&&b!=null&&S!=null&&b<S;if(!p&&!m&&!g&&!v)return{needsResize:!1,creditChanged:!1};let w;try{w=(await x.mutateAsync({body:{machine_tier:f.machineTier,storage_tier:f.storageTier,credit_tier:f.creditTier}})).status}catch(e){return a(Bn(e,n(`customPlanModal.changeFailed`)))}return await er(t),w===`no_op`?{needsResize:!1,creditChanged:!1}:{needsResize:m||p&&!C,creditChanged:g}};return{changeTiers:O,isPending:D,error:r,current:C,eligible:w,currentReady:T,currentKnown:E,primaryAssistantId:E?_.data?.primary_assistant_id??null:null}}function nr(){let e=R(),{t}=z(`settings`),n=he(b());return{changePackage:async r=>{try{let t=await n.mutateAsync({body:{package:r}});return await er(e),t}catch(e){return h.error(Bn(e,t(`customPlanModal.changeFailed`))),null}},isPending:n.isPending}}function rr({className:e,"data-testid":t,children:n}){return(0,q.jsx)(`div`,{"aria-hidden":!0,"data-testid":t,className:F(`flex size-[52px] shrink-0 items-center justify-center rounded-xl`,e),children:n})}var ir=32;function ar(){let{ready:e,avatar:t}=_t();return(0,q.jsx)(rr,{"data-testid":`assistant-avatar-tile`,className:`bg-[var(--surface-active)]`,children:e?(0,q.jsx)(M,{components:t.components,traits:t.traits,customImageUrl:t.customImageUrl,size:ir}):null})}var or=`Billed monthly · prorated difference charged today`,sr=`Billed monthly · prorated difference charged today or credited next invoice`,cr=`Billed monthly · prorated credit on your next invoice`,lr=`Your machine downsizes now and your storage stays. No refund.`,ur=`Continue`,dr=`The plan includes`,fr=`Your plan will include`;function pr(e,t,n){let r=n?vn(n)?.tagline??``:``;switch(e){case`downgrade`:return{title:yn(t),subtitle:``,priceCaption:cr,checklistHeading:fr,note:lr,confirmLabel:yn(t),destructive:!0};case`switch`:return{title:`Switch to ${t}`,subtitle:r,priceCaption:sr,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1};default:return{title:`Upgrade to ${t}`,subtitle:r,priceCaption:or,checklistHeading:dr,note:``,confirmLabel:ur,destructive:!1}}}function mr({open:e,relation:n,packageName:r,targetPackage:i,pending:a,onCancel:o,onConfirm:s}){let{t:l}=z(`settings`),u=(0,K.useRef)(null),d=(0,K.useId)(),f=pr(n,r,i?.key??null),p=i?{price:xn(i.total_price_cents),highlights:An(i,vn(i.key)?.extraFeatures??[])}:null,m=f.subtitle,h=f.note?{"aria-describedby":d}:m?{}:{"aria-describedby":void 0};return(0,q.jsx)(c.Root,{open:e,onOpenChange:e=>{!e&&!a&&o()},children:(0,q.jsxs)(c.Content,{size:`sm`,hideCloseButton:!0,className:`gap-4 p-4 max-w-[421px]`,onOpenAutoFocus:e=>{e.preventDefault(),u.current?.focus()},...h,children:[(0,q.jsxs)(c.Header,{className:`flex-row items-center gap-3 p-0 pb-2`,children:[f.destructive?(0,q.jsx)(rr,{"data-testid":`package-switch-warning-tile`,className:`bg-[var(--system-negative-weak)]`,children:(0,q.jsx)(Se,{className:`size-6 text-[var(--system-negative-strong)]`})}):(0,q.jsx)(ar,{}),(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,q.jsx)(c.Title,{className:`text-title-small text-[var(--content-emphasised)] [&>span]:whitespace-normal`,children:f.title}),m?(0,q.jsx)(c.Description,{className:`mt-0 text-body-medium-default text-[var(--content-tertiary)]`,children:m}):null]})]}),p?(0,q.jsxs)(c.Body,{className:`flex flex-col gap-4 p-0`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-0.5`,children:[(0,q.jsx)(v,{as:`p`,variant:`title-large`,className:`text-[var(--content-default)]`,children:p.price}),(0,q.jsx)(v,{as:`p`,variant:`label-medium-default`,className:`leading-[15px] text-[var(--content-tertiary)]`,children:f.priceCaption})]}),(0,q.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,q.jsx)(v,{as:`p`,variant:`body-small-default`,className:`text-[var(--content-tertiary)]`,children:f.checklistHeading}),(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:p.highlights.map(e=>(0,q.jsxs)(`li`,{className:`flex items-center gap-1`,children:[(0,q.jsx)(Te,{className:`size-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,q.jsx)(v,{as:`span`,variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]},e))})]}):null,f.note?(0,q.jsx)(v,{id:d,as:`p`,variant:`body-medium-default`,className:`text-[var(--content-secondary)]`,children:f.note}):null,(0,q.jsxs)(c.Footer,{className:`flex-col gap-4 p-0`,children:[(0,q.jsx)(t,{fullWidth:!0,variant:f.destructive?`danger`:`primary`,onClick:s,disabled:a,"data-testid":`confirm-package-switch-button`,children:f.confirmLabel}),(0,q.jsx)(t,{ref:u,fullWidth:!0,variant:`ghost`,onClick:o,disabled:a,children:l(`packageSwitchConfirmModal.cancel`)})]})]})})}function hr(){let e=R();(0,K.useEffect)(()=>j(()=>{er(e)}),[e])}export{xn as A,en as B,Nn as C,On as D,Dn as E,mn as F,qe as G,tn as H,dn as I,Ge as K,fn as L,wn as M,vn as N,Cn as O,gn as P,pn as R,Pn as S,kn as T,on as U,sn as V,$t as W,Ln as _,er as a,Vn as b,Jn as c,qn as d,Qn as f,Rn as g,Bn as h,tr as i,Sn as j,bn as k,Xn as l,In as m,mr as n,$n as o,Wn as p,ze as q,nr as r,Yn as s,hr as t,Zn as u,Un as v,Mn as w,Fn as x,Hn as y,nn as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ji as t,Ui as n,Vi as r,Wi as i,ti as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ji as t,Ui as n,Vi as r,Wi as i,ti as a}from"./app-Bevxq2OH.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=r.use.registerBackOwner(),y=r.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 ${t}`,x(e,0);let n=()=>{e.removeEventListener(`transitionend`,n),l(e)};e.addEventListener(`transitionend`,n,{once:!0}),b(()=>l(e),250)},C=e=>{e.style.transition=`transform 150ms ${t}`,x(e,window.innerWidth);let n=!1,r=()=>{if(n||_.current)return;n=!0,e.removeEventListener(`transitionend`,r);let t=-(window.innerWidth*c);e.style.transition=`none`,e.style.transform=`translateX(${t}px)`,e.style.opacity=`0`,e.offsetWidth,h.current=!0,p.current(),b(()=>{h.current&&(h.current=!1,l(e))},400)};e.addEventListener(`transitionend`,r,{once:!0}),b(r,200)};i({enabled:u,onConfirm:()=>{a(m.current);let t=e.current;t&&(t.style.transition=`none`,t.style.willChange=`transform`)},onMove:(t,r)=>{let i=e.current;i&&x(i,n(t,r))},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 n=e.current;if(!n)return;let r=!1,i=()=>{r||(r=!0,n.removeEventListener(`transitionend`,i),l(n))};n.style.transition=`transform 200ms ${t}, opacity 200ms ${t}`,n.style.transform=``,n.style.opacity=``,n.addEventListener(`transitionend`,i,{once:!0});let a=setTimeout(i,250);return()=>{clearTimeout(a),n.removeEventListener(`transitionend`,i),l(n)}},[d,e])}export{u as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ci as t,Si as n,Ym as r,xi as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ci as t,Si as n,Ym as r,xi as i}from"./app-Bevxq2OH.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)(()=>{i().then(c)},[]);(0,o.useEffect)(()=>(h(),n(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=r()??`macos`,i=u(e,n);if(i===null)return;let o=p(s,l,i,n);if(o!==null){m({key:l,label:o.label});return}t(l,i).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??``,r()??`macos`);if(n!==null){d(null),m({key:e,label:n.label});return}g(),t(e,null).then(h)},[s,h,g]),removeHotkey:(0,o.useCallback)(e=>{g(),t(e,``).then(h)},[h,g])}}export{m as t};
|
package/dist/assets/{use-invite-link-dialog-BWou3cIT.js → use-invite-link-dialog-BmO2UW56.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Ed as n,Fx as r,Jb as i,Nx as a,Q_ as o,Qx as s,Td as c,Ux as l,Vd as u,Xo as d,Yb as f,Zb as p,Zo as m,_ as h,af as g,b as _,c_ as v,d_ as y,fh as b,if as x,im as S,l_ as C,ld as w,nf as ee,nm as T,of as E,tf as D,tm as O,u_ as k,v as te,x as ne,y as re}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Ed as n,Fx as r,Jb as i,Nx as a,Q_ as o,Qx as s,Td as c,Ux as l,Vd as u,Xo as d,Yb as f,Zb as p,Zo as m,_ as h,af as g,b as _,c_ as v,d_ as y,fh as b,if as x,im as S,l_ as C,ld as w,nf as ee,nm as T,of as E,tf as D,tm as O,u_ as k,v as te,x as ne,y as re}from"./app-Bevxq2OH.js";import{Jn as A,Zn as j,er as M,j as N}from"./vendor-CtuA73w5.js";import{t as P,x as F}from"./react-B9IgSVeK.js";import{Jn as I,ci as L,er as R,qi as z}from"./icons-DxrLl-Dj.js";import{t as B}from"./a2a-invite-CGyWwrVb.js";var V=e(F(),1),H=P(),U=[`no_one`,`guardian_only`,`trusted_contacts`,`any_contact`,`strangers`],W=`trusted_contacts`,G=new Set([`platform`,`a2a`]),K=new Set([`vellum`,`whatsapp`]);function ie(e){return K.has(e)}function q(e){return t=>{a.error(t instanceof Error?t.message:e)}}function J(e){return typeof e==`string`&&U.includes(e)}function Y(e){return G.has(e)}function X(e){return(e?.policies??[]).filter(e=>!Y(e.channelType)&&!ie(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 i(403,`Channel "${t}" is internal and is not user-configurable.`);let{data:a,error:o,response:s}=await w({path:{assistant_id:e,channel_type:t},body:{policy:n,note:r??null},throwOnError:!1});if(f(s,o,`Failed to save channel policy.`),!s.ok)throw new i(s.status,p(o,s,`Failed to save channel policy.`));if(!a?.policy)throw new i(500,`Gateway returned no policy in response.`);return a.policy}var ae=`0.10.0`;function Q(){return b(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:n,onClose:i}){let{t:a}=N(),{copy:c,copied:u,reset:d}=o({errorMessage:`Couldn't copy the invite link.`}),f=(0,V.useRef)(!1),p=A({...D({path:{assistant_id:n}})}),m=(0,V.useRef)(p.mutate);(0,V.useLayoutEffect)(()=>{m.current=p.mutate});let h=(0,V.useRef)(p.reset);(0,V.useLayoutEffect)(()=>{h.current=p.reset}),(0,V.useEffect)(()=>{e&&!f.current&&m.current({path:{assistant_id:n}}),f.current=e},[e,n]);let g=(0,V.useCallback)(()=>{h.current(),d(),i()},[i,d]),_=p.isSuccess&&p.data.token?B({senderAssistantId:n,token:p.data.token}):``;return(0,H.jsx)(r.Root,{open:e,onOpenChange:e=>{e||g()},children:(0,H.jsxs)(r.Content,{size:`sm`,children:[(0,H.jsx)(r.Header,{children:(0,H.jsx)(r.Title,{children:a(`generateInviteLinkDialog.title`)})}),(0,H.jsx)(r.Body,{children:p.isPending?(0,H.jsxs)(`div`,{className:`flex items-center gap-2 py-2 text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[(0,H.jsx)(I,{className:`h-4 w-4 animate-spin`}),a(`generateInviteLinkDialog.creating`)]}):p.isError?(0,H.jsxs)(`div`,{className:`space-y-3`,children:[(0,H.jsx)(`p`,{role:`alert`,className:`!m-0 text-body-medium-lighter`,style:{color:`var(--system-negative-strong)`},children:a(`generateInviteLinkDialog.createFailed`)}),(0,H.jsx)(t,{variant:`outlined`,onClick:()=>p.mutate({path:{assistant_id:n}}),children:a(`generateInviteLinkDialog.tryAgain`)})]}):p.isSuccess?(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(s,{variant:`body-medium-lighter`,style:{color:`var(--content-secondary)`},children:a(`generateInviteLinkDialog.shareHint`)}),(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(l,{type:`text`,readOnly:!0,value:_,fullWidth:!0,wrapperClassName:`flex-1`,className:`font-mono`,onFocus:e=>e.currentTarget.select()}),(0,H.jsx)(`button`,{type:`button`,onClick:()=>c(_),"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:u?(0,H.jsx)(z,{className:`h-4 w-4`}):(0,H.jsx)(L,{className:`h-4 w-4`})})]}),p.data.expiresAt!=null&&(0,H.jsx)(s,{variant:`body-small-default`,style:{color:`var(--content-tertiary)`},children:oe(p.data.expiresAt)})]}):null}),(0,H.jsx)(r.Footer,{children:(0,H.jsx)(t,{variant:`outlined`,onClick:g,children:a(`generateInviteLinkDialog.done`)})})]})})}function ce({onClick:e}){let{t:n}=N();return(0,H.jsx)(t,{variant:`outlined`,size:`compact`,leftIcon:(0,H.jsx)(R,{className:`h-3.5 w-3.5`}),onClick:e,children:n(`shareConnectionLinkButton.label`)})}function le(e){let t=M(),n=Q(),r=(0,V.useMemo)(()=>({path:{assistant_id:e}}),[e]),i=(0,V.useMemo)(()=>m(r),[r]),a=j({...d(r),enabled:n,select:X}),o=(0,V.useMemo)(()=>{let e={};for(let t of a.data??[])T(t.channelType)&&(e[t.channelType]=t.policy);return e},[a.data]),s=A({mutationFn:({channelKey:t,policy:n})=>Z(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:i}),onError:q(`Failed to save channel policy`)}),c=(0,V.useCallback)((e,t)=>{s.mutate({channelKey:e,policy:t})},[s]);return n?{policies:o,savingKey:s.isPending?s.variables?.channelKey??null:null,isLoading:a.isPending,isError:a.isError,onChange:c}:{policies:void 0,savingKey:null,isLoading:!1,isError:!1,onChange:void 0}}var ue=`0.11.5-dev.202608242314.38e0513`;function de(){return b(ue)}var fe=`0.11.5-dev.202608252008.65007aa`;function pe(){return b(fe)}var $={slack:C,telegram:k,discord:v,email:void 0,phone:y},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:r}=N(`common`),i=M(),a=(0,V.useMemo)(()=>({path:{assistant_id:e}}),[e]),o=(0,V.useMemo)(()=>n(a),[a]),s=de(),l=pe(),u=(0,V.useMemo)(()=>ve(s),[s]),d=j({...c(a),enabled:!!e,refetchInterval:ge,select:e=>e.snapshots}),f=(0,V.useMemo)(()=>ye(d.data??[],u,l),[d.data,u,l]),p=f.some(e=>e.key===`slack`&&e.configured),m=j({...x(a),enabled:p,select:e=>e.threadMode}),v=le(e),y=(0,V.useCallback)(()=>i.invalidateQueries({queryKey:o}),[i,o]),b=A({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,r)=>{y(),r===`slack`&&ne(i,e)}}),S=te({assistantId:e}),C=re({assistantId:e}),w=j({...ee(a),enabled:!!e&&l}),T=_({assistantId:e}),D=h({assistantId:e}),O=A({...E(),onSuccess:()=>{i.invalidateQueries({queryKey:g(a)})}}),k=C.mutate,P=(0,V.useCallback)(e=>{k(e)},[k]),F=S.mutate,I=(0,V.useCallback)(e=>{F(e)},[F]),L=T.mutate,R=(0,V.useCallback)((e,t)=>{L({botToken:e,appToken:t})},[L]),z=O.mutate,B=(0,V.useCallback)(t=>{z({path:{assistant_id:e},body:{threadMode:t}})},[z,e]),H=D.mutateAsync,U=(0,V.useCallback)(async(e,t)=>{await H({accountSid:e,authToken:t})},[H]),W=(0,V.useCallback)((e,n=!1)=>{t&&t(r(n?he[e]:me[e]))},[t,r]),G=b.mutate,K=(0,V.useCallback)(e=>{G(e)},[G]);return{channels:f,pendingChannelKey:b.isPending?b.variables??null:null,slackThreadMode:m.data,slackThreadModePending:O.isPending,channelPolicies:v.policies,policySavingKey:v.savingKey,policiesLoading:v.isLoading,policiesError:v.isError,onChannelPolicyChange:v.onChange,onSetup:t?W:void 0,onDisconnect:K,onSaveTelegramToken:I,telegramSaveStatus:S.status,telegramSaveError:S.error?.message??null,onSaveDiscordToken:P,discordSaveStatus:C.status,discordSaveError:C.error?.message??null,discordInviteUrl:C.data?.data?.inviteUrl??w.data?.inviteUrl,onSaveSlackConfig:R,slackSaveStatus:T.status,slackSaveError:T.error?.message??null,onSlackThreadModeChange:B,onSaveTwilioCredentials:U}}function ve(e){return e?O:O.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:S[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=M(),[n,r]=(0,V.useState)(!1);return{isOpen:n,open:(0,V.useCallback)(()=>{r(!0)},[]),close:(0,V.useCallback)(()=>{r(!1),t.invalidateQueries({queryKey:u({path:{assistant_id:e}})})},[t,e])}}export{Q as a,q as c,se as i,W as l,_e as n,Z as o,ce as r,X as s,xe as t,U as u};
|
package/dist/assets/{use-platform-assistant-id-eSCNuEeV.js → use-platform-assistant-id-B2zxeseH.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{qm as t}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{qm as t}from"./app-Bevxq2OH.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{D_ as t,E_ as n,Nx as r,ap as i,bf as a,fh as o,nr as s,ps as c,qa as l,sp as u,yf as d}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{D_ as t,E_ as n,Nx as r,ap as i,bf as a,fh as o,nr as s,ps as c,qa as l,sp as u,yf as d}from"./app-Bevxq2OH.js";import{I as f,Zn as p,er as m,j as h}from"./vendor-CtuA73w5.js";import{t as g,x as _}from"./react-B9IgSVeK.js";var v=e(_(),1),y=g(),b={sm:`h-7 w-7`,md:`h-8 w-8 text-3xl`};function x({external:e=!1,icon:t,iconUrl:n,iconSrc:r,size:i=`sm`,className:a}){let[o,s]=(0,v.useState)(!1),c=r??n;(0,v.useEffect)(()=>{s(!1)},[c]);let u=t||(e?`📦`:`🧩`),d=!!c&&!o;return(0,y.jsx)(`span`,{className:l(`flex shrink-0 items-center justify-center`,b[i],a),children:d?(0,y.jsx)(`img`,{src:c,alt:``,"aria-hidden":!0,loading:`lazy`,className:`h-full w-full object-contain`,onError:()=>s(!0)}):u})}function S(e){return e!==void 0&&e.startsWith(`https://`)}function C(e,t){let n=e.map(e=>({name:e.name,description:e.description??void 0,status:`installed`,external:void 0,version:e.version??void 0,path:e.path,issues:e.issues,enabled:e.enabled,icon:e.icon,hasIcon:e.hasIcon,iconVersion:e.iconVersion})),r=new Set(n.map(e=>e.name)),i=t.filter(e=>!r.has(e.name)).map(e=>({name:e.name,description:e.description,status:`available`,external:!0,path:e.path,...S(e.icon)?{iconUrl:e.icon}:{icon:e.icon}}));return[...n,...i]}function w(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description].some(e=>e?.toLowerCase().includes(n)):!0}function T(e){return[...e].sort((e,t)=>{let n=e.status===`installed`;return n===(t.status===`installed`)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})}function E(e,t){switch(t){case`all`:return e;case`available`:return e.filter(e=>e.status===`available`);case`installed`:return e.filter(e=>e.status===`installed`);case`active`:return e.filter(e=>e.status===`installed`&&e.enabled!==!1);case`off`:return e.filter(e=>e.status===`installed`&&e.enabled===!1)}}function D(e){return e?e.slice(0,7):`unknown`}var O=`plugin.uninstall.mcp_oauth_credentials_unchecked`;function k(e,t){for(let n of e??[])r.warning(t(n===O?`pluginToast.mcpOAuthCredentialsUnchecked`:`pluginToast.cleanupWarning`))}function A(e,t,n){let{t:a}=h(`intelligence`),o=m(),s=u({onSuccess:()=>{c(o,e,t),n?.onInstalled?.(),n?.announceInstall!==!1&&r.success(a(`pluginToast.installed`,{name:t||a(`pluginToast.pluginFallback`)}))}}),l=i({onSuccess:r=>{c(o,e,t),n?.onRemoved?.(),k(r?.warnings,a)}});return{install:()=>{s.mutate({path:{assistant_id:e},body:{name:t}})},installAsync:()=>s.mutateAsync({path:{assistant_id:e},body:{name:t}}),remove:()=>{l.mutate({path:{assistant_id:e,name:t}})},isInstalling:s.isPending,isRemoving:l.isPending,isInstallError:s.isError,isRemoveError:l.isError}}var j=`0.10.5`;function M(){return o(j)}function N(e,t,r,i){let a=M(),{data:o}=p({queryKey:[`pluginIcon`,e,t,i],queryFn:async()=>{let{data:r,error:i}=await n({path:{assistant_id:e,name:t},parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))throw Error(`Failed to load plugin icon`);return r},enabled:!!(a&&r&&i),staleTime:1/0,retry:!1}),[s,c]=(0,v.useState)(void 0);return(0,v.useEffect)(()=>{if(!o){c(void 0);return}let e=URL.createObjectURL(o);return c(e),()=>{URL.revokeObjectURL(e)}},[o]),s}var P=300*1e3,F=[],I=[],L=`system`;async function R(e,n,r){let i=await t({path:{assistant_id:e},query:{q:void 0,category:n},signal:r,throwOnError:!1});if(i.response?.status===404)return{plugins:[]};if(!i.response?.ok)throw Error(f(`usePluginsList.failureMessage`,{ns:`intelligence`}));return i.data??{plugins:[]}}function z(e,t){let[n,r]=(0,v.useState)({assistantId:e,latched:!1}),i=n.assistantId===e?n.latched:!1;return n.assistantId!==e&&r({assistantId:e,latched:!1}),(0,v.useEffect)(()=>{t&&r(t=>t.assistantId===e&&t.latched?t:{assistantId:e,latched:!0})},[e,t]),i||t}function B(e,t=null,n=!0){let r=t??void 0,i=p({queryKey:d({path:{assistant_id:e},query:{q:void 0,category:r}}),queryFn:({signal:t})=>R(e,r,t),enabled:!!e&&n,staleTime:P}),o=p({...s(e),enabled:!!e&&n&&t!==null}),c=p({...a({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e&&n,staleTime:P}),l=(0,v.useMemo)(()=>{let e=t===null?i.data?.plugins:o.data?.plugins??i.data?.plugins;return new Set((e??F).map(e=>e.name))},[t,o.data?.plugins,i.data?.plugins]),u=(0,v.useMemo)(()=>{let e=i.data?.plugins??F,n=c.data?.matches??I;return T(C(e,(t===null?n:n.filter(e=>(e.category??`system`)===t)).filter(e=>!l.has(e.name))))},[i.data?.plugins,c.data?.matches,t,l]),f=t===null?i.data:o.data,h=z(e,f?.categoryCounts!==void 0),g=z(e,(f?.plugins??F).some(e=>e.enabled!==void 0)),_=m(),y=(0,v.useRef)(null);return(0,v.useEffect)(()=>{if(y.current===e||!c.isSuccess)return;let t=f?.plugins;if(!t?.length)return;let n=new Map((c.data?.matches??I).map(e=>[e.name,e.category]));t.some(e=>{let t=n.get(e.name);return t!=null&&t!==`system`&&(e.category??`system`)===`system`})&&(y.current=e,_.invalidateQueries({queryKey:d({path:{assistant_id:e},query:{q:void 0}})}))},[e,c.isSuccess,c.data?.matches,f?.plugins,_]),{items:u,isLoading:i.isLoading,catalogLoading:c.isLoading,isError:i.isError,installedLoaded:i.data!==void 0,isFetching:i.isFetching||c.isFetching,catalogError:c.isError,categorySupported:h,pluginToggleSupported:g,installedCategoryCounts:f?.categoryCounts,installedPlugins:f?.plugins??F,installedTotal:f?.totalCount,catalogMatches:c.data?.matches??I,unfilteredInstalledNames:l}}export{k as a,D as c,A as i,x as l,B as n,E as o,N as r,w as s,L as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ap as t,As as n,Fb as r,Mp as i,Ps as a,Rv as o,Tp as s,ks as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Ap as t,As as n,Fb as r,Mp as i,Ps as a,Rv as o,Tp as s,ks as c}from"./app-Bevxq2OH.js";import{j as l}from"./vendor-CtuA73w5.js";import{_ as u,r as d,t as f,x as p}from"./react-B9IgSVeK.js";import{Jn as m}from"./icons-DxrLl-Dj.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 t=c(e);return(0,_.useEffect)(()=>{t&&a(e)},[t,e]),t?null:(0,h.jsx)(d,{to:e,replace:!0})}function y(){let[e]=u(),a=t(),c=i(),l=s(),d=e.get(`returnTo`),f=o(d,r.assistant);if(!d)return{kind:`proceed`,returnTo:null};if(c)return{kind:`wait`};if(!a)return{kind:`proceed`,returnTo:f};if(n(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{$x as t,Ai as n,Gi as r,Hi as i,ji as a}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$x as t,Ai as n,Gi as r,Hi as i,ji as a}from"./app-Bevxq2OH.js";import{j as o}from"./vendor-CtuA73w5.js";import{t as s,x as c}from"./react-B9IgSVeK.js";import{Pn as l,i as u}from"./icons-DxrLl-Dj.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:n,children:a,title:s}){let{t:c}=o(),l=(0,d.useRef)(null),m=(0,d.useRef)(null),h=(0,d.useRef)(n);(0,d.useEffect)(()=>{h.current=n});let{dragOffset:g,isDragging:_,onTouchStart:v,onTouchMove:y,onTouchEnd:b,onTouchCancel:x}=i({enabled:e,onSwipeLeft:n});return r(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:n}),(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)(t,{ref:m,type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,f.jsx)(u,{"aria-hidden":!0}),onClick:n,"aria-label":c(`sideListDrawer.closeAria`),tintColor:`var(--content-tertiary)`})]}),(0,f.jsx)(`div`,{className:`flex-1 overflow-y-auto p-4`,children:a})]})]}):null}function h({onClick:e}){let{t:n}=o();return(0,f.jsx)(t,{type:`button`,variant:`ghost`,iconOnly:(0,f.jsx)(l,{"aria-hidden":!0}),onClick:e,"aria-label":n(`sideListDrawer.openSidebarAria`),tintColor:`var(--content-secondary)`})}var g=640;function _(){let{ref:e,size:t}=n(),r=t.w<=0,i=a(r),o=(r?i.w:t.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{Jb as t,Kx as n,V_ as r,Yb as i,Zb as a,Zx as o,cp as s,p as c}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Jb as t,Kx as n,V_ as r,Yb as i,Zb as a,Zx as o,cp as s,p as c}from"./app-Bevxq2OH.js";import{I as l,Jn as u,er as d,j as f}from"./vendor-CtuA73w5.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-DxrLl-Dj.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}=f(`intelligence`),r=e in w?{label:T(e,t),icon:w[e]}:{label:e.replace(/-/g,` `),icon:_};return(0,C.jsx)(n,{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)(o.Root,{children:(0,C.jsxs)(o.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,n,o){let{data:s,error:c,response:u}=await r({path:{assistant_id:e},body:o?{slug:n,version:o}:{slug:n},throwOnError:!1}),d=l(`installSkill.failureMessage`,{ns:`intelligence`});if(i(u,c,d),!u.ok)throw new t(u.status,a(c,u,d));return s??{ok:!0}}function j(e,{onRemoved:t}={}){let n=d(),[r,i]=(0,S.useState)(null),[a,o]=(0,S.useState)(null),[l,f]=(0,S.useState)(null),p=(0,S.useCallback)(()=>{c(n,e)},[e,n]),m=u({mutationFn:t=>A(e,t),onMutate:e=>i(e),onSettled:()=>{i(null),p()}}),h=s({onMutate:e=>o(e.path.id),onSuccess:()=>{t?.()},onSettled:()=>{o(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-4oFtcDS1.js → use-skill-detail-files-tb5cSgGr.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Af as t,Fb as n,kf as r,qa as i}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Af as t,Fb as n,kf as r,qa as i}from"./app-Bevxq2OH.js";import{Zn as a,j as o}from"./vendor-CtuA73w5.js";import{n as s,t as c,x as l}from"./react-B9IgSVeK.js";import{La as u}from"./icons-DxrLl-Dj.js";var d=c();function f({skill:e,className:t,onNavigate:r}){let{t:a}=o();return e.origin!==`assistant-memory`||!e.sourceConversationId?null:(0,d.jsxs)(s,{to:n.conversation(e.sourceConversationId),onClick:r,className:i(`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[i,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,i),d=a({...r({path:{assistant_id:e??``,id:n},query:{path:u??``}}),select:e=>e??null,enabled:!!(e&&u)});return{fileEntries:c,skillMd:l,selectedPath:i,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{dh as e}from"./app-Bevxq2OH.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{Cr as t,zp as n}from"./app-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Cr as t,zp as n}from"./app-Bevxq2OH.js";import{x as r}from"./react-B9IgSVeK.js";var i=e(r(),1);function a(e){let r=t();return(0,i.useMemo)(()=>{if(e)return r.find(t=>n(t).includes(e))},[r,e])}export{a as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$a as t,$x as n,Cx as r,Dm as i,Fb as a,Fs as o,Fx as s,Hs as c,Hx as l,Ib as u,Is as d,Ix as f,Jg as p,Jt as m,Ls as h,Lx as g,Nx as _,Od as v,Qa as y,Rc as b,Rs as x,Sa as S,Xa as C,Xt as w,Ya as T,Za as ee,co as E,do as D,eo as te,et as O,fo as k,ho as A,it as j,kd as M,kx as ne,lo as re,mo as N,nt as ie,po as P,qt as ae,tt as oe,uo as se,vx as ce,xu as le,yb as ue,yu as de,zc as F,zf as fe}from"./app-BffxeWB8.js";import{Zn as I,er as pe,j as L}from"./vendor-CtuA73w5.js";import{_ as me,n as he,r as R,t as ge,x as _e}from"./react-B9IgSVeK.js";import{Ia as ve,dr as z}from"./icons-DxrLl-Dj.js";import{t as B}from"./detail-card-B3_bSihf.js";import{t as ye}from"./stt-language-picker-modal-DPCuG3ZL.js";import{t as be}from"./use-hotkey-recorder-v5Akb2eM.js";var V=e(_e(),1),H=ge();function U({label:e,selected:t,recording:n=!1,onClick:r}){return(0,H.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,H.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,H.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function xe(){let{t:e}=L(`settings`),{available:t,currentCode:r,configuredProviderId:i,selectLanguage:a,selecting:o}=ie(O()),[s,c]=(0,V.useState)(!1);return t?(0,H.jsxs)(B,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:j(r,i)}),(0,H.jsx)(n,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,H.jsx)(ye,{open:s,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:r,configuredProviderId:i,selectLanguage:a,selecting:o})]}):null}var W=`flux`;function Se(e){return e===`vellum`}function Ce(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function we(){let{t:e}=L(`settings`),t=pe(),n=i(),r=O(),[a,o]=(0,V.useState)(!1),{data:s}=I({...v({path:{assistant_id:r}}),enabled:n,staleTime:3e4}),c=s?.services?.stt,{data:u}=I({...fe({path:{assistant_id:r}}),enabled:n,staleTime:5*6e4}),d=c?.roles?.liveVoice?.provider??c?.provider,f=u?.providers?.find(e=>e.id===d),m=f?.modelFamilies?.includes(W)??!1;if(!d||!m)return null;let h=Ce(c?.language,f?.turnDetectionLanguages),g=c?.roles?.liveVoice,y=g?g.model:c?.providers?.[d]?.model,b=y===void 0?Se(d)&&h:y===W,x=async n=>{o(!0);try{let{response:e}=await p({path:{assistant_id:r},body:{services:{stt:{roles:{liveVoice:{provider:d,model:n?W:f?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await t.invalidateQueries({queryKey:M({path:{assistant_id:r}})})}catch{_.error(e(`voicePage.turnDetectionFailed`))}finally{o(!1)}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,H.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(h?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,H.jsx)(l,{checked:b,disabled:a||!h&&!b,onChange:e=>void x(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var G=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Te=2;function q(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),A(t)}function Ee(){let{t:e}=L(`settings`),t=se(),r=T(e=>e.registered)===!1,[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)([]),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useCallback)(async()=>{a((await de())?.inputMonitoring.status??null)},[]);(0,V.useEffect)(()=>{p();let e=setInterval(()=>{p()},2e3);return()=>{clearInterval(e)}},[p]);let m=(0,V.useCallback)(()=>{le(`inputMonitoring`).then(p)},[p]),h=(0,V.useCallback)(e=>{D(e),s(!1),l([]),d(!1),e.kind!==`off`&&m()},[m]),g=(0,V.useCallback)(()=>{s(!0),l([]),d(!1),requestAnimationFrame(()=>{f.current?.focus()})},[]),_=(0,V.useCallback)(()=>{s(!1),l([]),d(!1)},[]),v=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){_();return}l(q(e))},[_]),y=(0,V.useCallback)(e=>{if(o&&!(q(e).length>0)){if(c.length>=Te){h({kind:`modifierOnly`,modifiers:c});return}l([]),d(!0)}},[h,c,o]);(0,V.useEffect)(()=>{if(!o)return;let e=e=>{f.current&&!f.current.contains(e.target)&&_()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[_,o]);let b=re(t),x=t.kind===`modifierOnly`&&!b,S=t.kind!==`off`,C=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),w=i===`granted`;return(0,H.jsx)(B,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{ref:f,tabIndex:o?0:-1,onKeyDown:o?v:void 0,onKeyUp:o?y:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,H.jsx)(U,{label:e(`voiceKeyCard.fnLabel`),selected:b,onClick:()=>h(E)}),o?(0,H.jsx)(U,{label:c.length>0?N(c):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:_}):(0,H.jsx)(U,{label:t.kind===`modifierOnly`&&!b?N(t.modifiers):e(`voiceKeyCard.customLabel`),selected:x,onClick:g}),(0,H.jsx)(U,{label:e(`voiceKeyCard.offLabel`),selected:!S,onClick:()=>h({kind:`off`})})]}),u&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),S&&i!==null&&!w&&(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,H.jsx)(n,{variant:`outlined`,onClick:m,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),S&&w&&r&&(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),b&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),C&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function De({assistantId:e,open:t,onOpenChange:n}){return(0,H.jsx)(s.Root,{open:t,onOpenChange:n,children:(0,H.jsx)(s.Content,{size:`md`,children:(0,H.jsx)(Oe,{assistantId:e,onDone:()=>n(!1)})})})}function Oe({assistantId:e,onDone:t}){let{t:r}=L(),{available:i,currentModel:a,selectModel:o,selecting:c}=S(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(s.Header,{children:[(0,H.jsx)(s.Title,{children:r(`voicePickerModal.title`)}),i&&(0,H.jsx)(s.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,H.jsx)(s.Body,{children:(0,H.jsx)(m,{assistantId:e,filterBySource:!0,value:a,onChange:o,autoScrollToSelected:!0})}),(0,H.jsxs)(s.Footer,{className:`items-center justify-between gap-3`,children:[(0,H.jsx)(oe,{}),(0,H.jsx)(n,{variant:`primary`,onClick:t,disabled:c,className:`shrink-0`,children:r(`voicePickerModal.done`)})]})]})}function ke(){let{t:e}=L(`settings`),t=O(),{available:r,settled:i,voices:a,currentModel:o}=S(t),s=a.find(e=>e.model===o)??a[0],[c,l]=(0,V.useState)(!1),u=ue.use.name(),d=u?e(`voicePickerCard.titleWithName`,{name:u}):e(`voicePickerCard.title`);return i?r&&s?(0,H.jsxs)(B,{title:d,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(ae,{description:s.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,H.jsx)(n,{variant:`outlined`,onClick:()=>l(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,H.jsx)(De,{assistantId:t,open:c,onOpenChange:l})]}):(0,H.jsx)(B,{title:d,children:(0,H.jsx)(w,{})}):(0,H.jsx)(B,{title:d,children:(0,H.jsx)(ce,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var Ae=[{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.`}],je=`We recommend keeping both off to start. It feels more like a real conversation.`;function Me(){let{t:e}=L();return(0,H.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 Ne({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,H.jsx)(Me,{}):null]}),t?(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,H.jsx)(l,{checked:r,onChange:i,"aria-label":e})]})}function Pe({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=L(),r=F.use.showUserTranscript(),i=F.use.showAssistantTranscript(),a=F.use.setShowUserTranscript(),o=F.use.setShowAssistantTranscript(),s={showUserTranscript:{checked:r,onChange:a},showAssistantTranscript:{checked:i,onChange:o}},c=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,H.jsx)(H.Fragment,{children:Ae.map(n=>{let r=s[n.prefKey];return(0,H.jsx)(Ne,{label:c(n.prefKey,n.label),description:e?l(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var J=`text-body-small-default text-[var(--content-tertiary)]`;function Fe(){let[e]=me(),t=e.get(`tab`);return t===`sounds`?(0,H.jsx)(R,{replace:!0,to:a.settings.sounds}):t===`services`?(0,H.jsx)(R,{replace:!0,to:a.settings.ai}):(0,H.jsx)(Ie,{})}function Ie(){let{t:e}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsxs)(Y,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,H.jsx)(ke,{}),(0,H.jsx)(Le,{})]}),(0,H.jsxs)(Y,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,H.jsx)(Re,{}),(0,H.jsx)(xe,{}),c()?(0,H.jsx)(Ee,{}):(0,H.jsx)(Ve,{}),(0,H.jsx)(He,{})]}),(0,H.jsx)(Y,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,H.jsx)(X,{})})]})}function Le(){let{t:e}=L(`settings`),{available:t}=S(O());return t?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,H.jsx)(z,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,H.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,H.jsxs)(he,{to:`${a.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,H.jsx)(ve,{className:`h-3 w-3`})]})]}):null}function Y({heading:e,description:t,children:n}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function X(){let{t:e}=L(`settings`);return(0,H.jsx)(B,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Pe,{showDescription:!0}),(0,H.jsx)(`p`,{className:`${J} pt-1`,children:e(`voicePage.captionsRecommendation`,je)})]})})}var Z=``;function Re(){let{t:e}=L(`settings`),[t,i]=(0,V.useState)([]),[a,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),[u,f]=(0,V.useState)(()=>o()),p=(0,V.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await d();s(e.needsPermission),i(e.devices),l(e.known)},[]),m=(0,V.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}p()},[p]);(0,V.useEffect)(()=>{p();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void p();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[p]);let g=(0,V.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=u!==Z&&!n.some(e=>e.value===u);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:u,label:e(c?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,u,c,e]),_=(0,V.useCallback)(e=>{f(e),h(e)},[]);(0,V.useEffect)(()=>x(()=>{f(o())}),[]);let v=u===Z?null:u;return(0,H.jsx)(B,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(r,{options:g,value:v,onChange:_,onSelectNone:()=>_(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),a&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(n,{variant:`outlined`,onClick:m,children:e(`voicePage.allowMicrophoneAccess`)}),(0,H.jsx)(`span`,{className:J,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}=L(`settings`),n=u(),[r,i]=(0,V.useState)(()=>y()),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)([]),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)(null),m=(0,V.useMemo)(()=>{let e=ee();return[{label:k(e),activator:e}]},[]),h=r.kind!==`off`,g=(0,V.useCallback)(e=>{i(e),te(e),o(!1),c([]),f(!1)},[]),_=be({onBound:()=>g({kind:`off`})}),v=_.catalog.find(e=>e.key===Q)?.accelerator??``,b=_.recordingKey===Q,x=t()?Be:[],S=(0,V.useCallback)(e=>{g(e),_.removeHotkey(Q)},[_,g]),w=(0,V.useCallback)(()=>{g({kind:`off`}),_.removeHotkey(Q)},[_,g]),T=(0,V.useCallback)(()=>{o(!0),c([]),f(!1),requestAnimationFrame(()=>{p.current?.focus()})},[]),E=(0,V.useCallback)(()=>{o(!1),c([]),f(!1)},[]),D=(0,V.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},[]),O=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){E();return}let t=D(e);if(ze.has(e.key)){f(!1),c(A(t));return}if(t.length===0){f(!0);return}g({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:A(t)})},[E,D,g]),j=(0,V.useCallback)(e=>{a&&D(e).length===0&&s.length>0&&(c([]),f(!0))},[D,a,s]);(0,V.useEffect)(()=>{if(!a)return;let e=e=>{p.current&&!p.current.contains(e.target)&&E()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[E,a]);let M=h&&!m.some(e=>P(e.activator,r));return n?(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[x.map(e=>(0,H.jsx)(U,{label:e.label,selected:P(e.activator,r),onClick:()=>S(e.activator)},e.label)),(0,H.jsx)(U,{label:b?e(`voicePage.recordingPrompt`):v?(0,H.jsx)(ne,{accelerator:v}):e(`voicePage.customKey`),selected:v!==``,recording:b,onClick:b?_.stopRecording:()=>_.startRecording(Q)}),(0,H.jsx)(U,{label:e(`voicePage.offKeyLabel`),selected:r.kind===`off`&&!v&&!b,onClick:w})]}),_.conflict?.key===Q&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:_.conflict.label})})]})]})}):(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(l,{checked:h,onChange:e=>{g(e?C():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),h&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:J,children:e(`voicePage.activationKeyLabel`)}),(0,H.jsxs)(`div`,{ref:p,tabIndex:a?0:-1,onKeyDown:a?O:void 0,onKeyUp:a?j:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[m.map(e=>(0,H.jsx)(U,{label:e.label,selected:P(e.activator,r),onClick:()=>g(e.activator)},e.label)),a?(0,H.jsx)(U,{label:s.length>0?N(s):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:E}):(0,H.jsx)(U,{label:M?k(r):e(`voicePage.customKey`),selected:M,onClick:T})]}),d&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),h&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function He(){let{t:e}=L(`settings`),t=F.use.pauseBeforeReplyMs(),r=F.use.setPauseBeforeReplyMs(),i=F.use.interruptSensitivity(),a=F.use.setInterruptSensitivity(),o=(0,V.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),s=t!==null||i!==null;return(0,H.jsx)(B,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsx)(we,{}),(0,H.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(f,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&r(Math.round(e*1e3))},min:500/1e3,max:b/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,H.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:i===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(g,{items:o,value:i??`medium`,onChange:a,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),s&&(0,H.jsx)(`div`,{children:(0,H.jsx)(n,{variant:`outlined`,onClick:()=>{r(null),a(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,H.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,H.jsx)(`p`,{className:J,children:t}),r]})}export{Fe as VoicePage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{$a as t,$x as n,Cx as r,Dm as i,Fb as a,Fs as o,Fx as s,Hs as c,Hx as l,Ib as u,Is as d,Ix as f,Jg as p,Jt as m,Ls as h,Lx as g,Nx as _,Od as v,Qa as y,Rc as b,Rs as x,Sa as S,Xa as C,Xt as w,Ya as T,Za as ee,co as E,do as D,eo as te,et as O,fo as k,ho as A,it as j,kd as M,kx as ne,lo as re,mo as N,nt as ie,po as P,qt as ae,tt as oe,uo as se,vx as ce,xu as le,yb as ue,yu as de,zc as F,zf as fe}from"./app-Bevxq2OH.js";import{Zn as I,er as pe,j as L}from"./vendor-CtuA73w5.js";import{_ as me,n as he,r as R,t as ge,x as _e}from"./react-B9IgSVeK.js";import{Ia as ve,dr as z}from"./icons-DxrLl-Dj.js";import{t as B}from"./detail-card-BwHvhGMs.js";import{t as ye}from"./stt-language-picker-modal-ClWhCUb4.js";import{t as be}from"./use-hotkey-recorder-D_xoveSa.js";var V=e(_e(),1),H=ge();function U({label:e,selected:t,recording:n=!1,onClick:r}){return(0,H.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,H.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,H.jsx)(`span`,{className:`text-[var(--content-default)]`,children:e})]})}function xe(){let{t:e}=L(`settings`),{available:t,currentCode:r,configuredProviderId:i,selectLanguage:a,selecting:o}=ie(O()),[s,c]=(0,V.useState)(!1);return t?(0,H.jsxs)(B,{title:e(`listeningLanguageCard.title`),subtitle:e(`listeningLanguageCard.subtitle`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(`span`,{className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`,children:j(r,i)}),(0,H.jsx)(n,{variant:`outlined`,onClick:()=>c(!0),className:`shrink-0`,children:e(`listeningLanguageCard.change`)})]}),(0,H.jsx)(ye,{open:s,onOpenChange:c,title:e(`listeningLanguageCard.title`),currentCode:r,configuredProviderId:i,selectLanguage:a,selecting:o})]}):null}var W=`flux`;function Se(e){return e===`vellum`}function Ce(e,t){let n=e?.trim().toLowerCase();return!n||n===`multi`||t===void 0?!0:t.includes(n.split(`-`)[0]??n)}function we(){let{t:e}=L(`settings`),t=pe(),n=i(),r=O(),[a,o]=(0,V.useState)(!1),{data:s}=I({...v({path:{assistant_id:r}}),enabled:n,staleTime:3e4}),c=s?.services?.stt,{data:u}=I({...fe({path:{assistant_id:r}}),enabled:n,staleTime:5*6e4}),d=c?.roles?.liveVoice?.provider??c?.provider,f=u?.providers?.find(e=>e.id===d),m=f?.modelFamilies?.includes(W)??!1;if(!d||!m)return null;let h=Ce(c?.language,f?.turnDetectionLanguages),g=c?.roles?.liveVoice,y=g?g.model:c?.providers?.[d]?.model,b=y===void 0?Se(d)&&h:y===W,x=async n=>{o(!0);try{let{response:e}=await p({path:{assistant_id:r},body:{services:{stt:{roles:{liveVoice:{provider:d,model:n?W:f?.baseModelFamily}}}}},throwOnError:!1});if(!e?.ok)throw Error(String(e?.status??``));await t.invalidateQueries({queryKey:M({path:{assistant_id:r}})})}catch{_.error(e(`voicePage.turnDetectionFailed`))}finally{o(!1)}};return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`voicePage.turnDetectionLabel`)}),(0,H.jsx)(`p`,{className:`text-body-small-lighter text-[var(--content-tertiary)]`,children:e(h?`voicePage.turnDetectionDescription`:`voicePage.turnDetectionLanguageUnsupported`)}),(0,H.jsx)(l,{checked:b,disabled:a||!h&&!b,onChange:e=>void x(e),"aria-label":e(`voicePage.turnDetectionLabel`)})]})}var G=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,K=`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,Te=2;function q(e){let t=[];return e.ctrlKey&&t.push(`control`),e.altKey&&t.push(`option`),e.shiftKey&&t.push(`shift`),e.metaKey&&t.push(`command`),A(t)}function Ee(){let{t:e}=L(`settings`),t=se(),r=T(e=>e.registered)===!1,[i,a]=(0,V.useState)(null),[o,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)([]),[u,d]=(0,V.useState)(!1),f=(0,V.useRef)(null),p=(0,V.useCallback)(async()=>{a((await de())?.inputMonitoring.status??null)},[]);(0,V.useEffect)(()=>{p();let e=setInterval(()=>{p()},2e3);return()=>{clearInterval(e)}},[p]);let m=(0,V.useCallback)(()=>{le(`inputMonitoring`).then(p)},[p]),h=(0,V.useCallback)(e=>{D(e),s(!1),l([]),d(!1),e.kind!==`off`&&m()},[m]),g=(0,V.useCallback)(()=>{s(!0),l([]),d(!1),requestAnimationFrame(()=>{f.current?.focus()})},[]),_=(0,V.useCallback)(()=>{s(!1),l([]),d(!1)},[]),v=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){_();return}l(q(e))},[_]),y=(0,V.useCallback)(e=>{if(o&&!(q(e).length>0)){if(c.length>=Te){h({kind:`modifierOnly`,modifiers:c});return}l([]),d(!0)}},[h,c,o]);(0,V.useEffect)(()=>{if(!o)return;let e=e=>{f.current&&!f.current.contains(e.target)&&_()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[_,o]);let b=re(t),x=t.kind===`modifierOnly`&&!b,S=t.kind!==`off`,C=t.kind===`modifierOnly`&&t.modifiers.includes(`control`)&&t.modifiers.includes(`option`),w=i===`granted`;return(0,H.jsx)(B,{title:e(`voiceKeyCard.title`),subtitle:e(`voiceKeyCard.subtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{ref:f,tabIndex:o?0:-1,onKeyDown:o?v:void 0,onKeyUp:o?y:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[(0,H.jsx)(U,{label:e(`voiceKeyCard.fnLabel`),selected:b,onClick:()=>h(E)}),o?(0,H.jsx)(U,{label:c.length>0?N(c):e(`voiceKeyCard.recordingPrompt`),selected:!0,recording:!0,onClick:_}):(0,H.jsx)(U,{label:t.kind===`modifierOnly`&&!b?N(t.modifiers):e(`voiceKeyCard.customLabel`),selected:x,onClick:g}),(0,H.jsx)(U,{label:e(`voiceKeyCard.offLabel`),selected:!S,onClick:()=>h({kind:`off`})})]}),u&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.customHint`)})]}),S&&i!==null&&!w&&(0,H.jsxs)(`div`,{className:`flex flex-col items-start gap-2 pt-1`,children:[(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.needsInputMonitoring`)})]}),(0,H.jsx)(n,{variant:`outlined`,onClick:m,children:e(`voiceKeyCard.allowInputMonitoring`)})]}),S&&w&&r&&(0,H.jsxs)(`div`,{className:K,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.refusedNote`)})]}),b&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.fnDictationNote`)})]}),C&&(0,H.jsxs)(`div`,{className:G,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voiceKeyCard.voiceOverNote`)})]})]})})}function De({assistantId:e,open:t,onOpenChange:n}){return(0,H.jsx)(s.Root,{open:t,onOpenChange:n,children:(0,H.jsx)(s.Content,{size:`md`,children:(0,H.jsx)(Oe,{assistantId:e,onDone:()=>n(!1)})})})}function Oe({assistantId:e,onDone:t}){let{t:r}=L(),{available:i,currentModel:a,selectModel:o,selecting:c}=S(e);return(0,H.jsxs)(H.Fragment,{children:[(0,H.jsxs)(s.Header,{children:[(0,H.jsx)(s.Title,{children:r(`voicePickerModal.title`)}),i&&(0,H.jsx)(s.Description,{children:`Uses Vellum credits, through providers like ElevenLabs and Deepgram.`})]}),(0,H.jsx)(s.Body,{children:(0,H.jsx)(m,{assistantId:e,filterBySource:!0,value:a,onChange:o,autoScrollToSelected:!0})}),(0,H.jsxs)(s.Footer,{className:`items-center justify-between gap-3`,children:[(0,H.jsx)(oe,{}),(0,H.jsx)(n,{variant:`primary`,onClick:t,disabled:c,className:`shrink-0`,children:r(`voicePickerModal.done`)})]})]})}function ke(){let{t:e}=L(`settings`),t=O(),{available:r,settled:i,voices:a,currentModel:o}=S(t),s=a.find(e=>e.model===o)??a[0],[c,l]=(0,V.useState)(!1),u=ue.use.name(),d=u?e(`voicePickerCard.titleWithName`,{name:u}):e(`voicePickerCard.title`);return i?r&&s?(0,H.jsxs)(B,{title:d,subtitle:e(`voicePickerCard.creditsNote`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,H.jsx)(ae,{description:s.description,className:`min-w-0 text-body-medium-lighter text-[var(--content-default)]`}),(0,H.jsx)(n,{variant:`outlined`,onClick:()=>l(!0),className:`shrink-0`,children:e(`voicePickerCard.changeButton`)})]}),(0,H.jsx)(De,{assistantId:t,open:c,onOpenChange:l})]}):(0,H.jsx)(B,{title:d,children:(0,H.jsx)(w,{})}):(0,H.jsx)(B,{title:d,children:(0,H.jsx)(ce,{as:`span`,role:`status`,"aria-label":e(`voicePickerCard.loadingAria`),className:`block h-9 w-48`})})}var Ae=[{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.`}],je=`We recommend keeping both off to start. It feels more like a real conversation.`;function Me(){let{t:e}=L();return(0,H.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 Ne({label:e,description:t,showBadge:n,checked:r,onChange:i}){return(0,H.jsxs)(`div`,{className:`flex items-center justify-between gap-3 py-1`,children:[(0,H.jsxs)(`div`,{className:`min-w-0`,children:[(0,H.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`truncate text-body-medium-lighter text-[var(--content-default)]`,children:e}),n?(0,H.jsx)(Me,{}):null]}),t?(0,H.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:t}):null]}),(0,H.jsx)(l,{checked:r,onChange:i,"aria-label":e})]})}function Pe({showDescription:e=!1,showRecommendedBadge:t=!1}){let{t:n}=L(),r=F.use.showUserTranscript(),i=F.use.showAssistantTranscript(),a=F.use.setShowUserTranscript(),o=F.use.setShowAssistantTranscript(),s={showUserTranscript:{checked:r,onChange:a},showAssistantTranscript:{checked:i,onChange:o}},c=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptLabel`:`voiceTranscriptToggles.assistantTranscriptLabel`,t),l=(e,t)=>n(e===`showUserTranscript`?`voiceTranscriptToggles.userTranscriptDescription`:`voiceTranscriptToggles.assistantTranscriptDescription`,t);return(0,H.jsx)(H.Fragment,{children:Ae.map(n=>{let r=s[n.prefKey];return(0,H.jsx)(Ne,{label:c(n.prefKey,n.label),description:e?l(n.prefKey,n.description):void 0,showBadge:t,checked:r.checked,onChange:r.onChange},n.prefKey)})})}var J=`text-body-small-default text-[var(--content-tertiary)]`;function Fe(){let[e]=me(),t=e.get(`tab`);return t===`sounds`?(0,H.jsx)(R,{replace:!0,to:a.settings.sounds}):t===`services`?(0,H.jsx)(R,{replace:!0,to:a.settings.ai}):(0,H.jsx)(Ie,{})}function Ie(){let{t:e}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-8`,children:[(0,H.jsxs)(Y,{heading:e(`voicePage.sectionOutputHeading`),description:e(`voicePage.sectionOutputDescription`),children:[(0,H.jsx)(ke,{}),(0,H.jsx)(Le,{})]}),(0,H.jsxs)(Y,{heading:e(`voicePage.sectionInputHeading`),description:e(`voicePage.sectionInputDescription`),children:[(0,H.jsx)(Re,{}),(0,H.jsx)(xe,{}),c()?(0,H.jsx)(Ee,{}):(0,H.jsx)(Ve,{}),(0,H.jsx)(He,{})]}),(0,H.jsx)(Y,{heading:e(`voicePage.sectionCaptionsHeading`),children:(0,H.jsx)(X,{})})]})}function Le(){let{t:e}=L(`settings`),{available:t}=S(O());return t?(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 px-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:[(0,H.jsx)(z,{className:`h-3.5 w-3.5 shrink-0 text-[var(--content-quiet)]`}),(0,H.jsx)(`span`,{children:e(`voicePage.speechServicesBannerPrompt`)}),(0,H.jsxs)(he,{to:`${a.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,H.jsx)(ve,{className:`h-3 w-3`})]})]}):null}function Y({heading:e,description:t,children:n}){return(0,H.jsxs)(`section`,{className:`flex flex-col gap-4`,children:[(0,H.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,H.jsx)(`h2`,{className:`text-label-medium-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e}),t&&(0,H.jsx)(`p`,{className:`text-body-small-default text-[var(--content-quiet)]`,children:t})]}),n]})}function X(){let{t:e}=L(`settings`);return(0,H.jsx)(B,{title:e(`voicePage.captionsTitle`),subtitle:e(`voicePage.captionsSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(Pe,{showDescription:!0}),(0,H.jsx)(`p`,{className:`${J} pt-1`,children:e(`voicePage.captionsRecommendation`,je)})]})})}var Z=``;function Re(){let{t:e}=L(`settings`),[t,i]=(0,V.useState)([]),[a,s]=(0,V.useState)(!1),[c,l]=(0,V.useState)(!1),[u,f]=(0,V.useState)(()=>o()),p=(0,V.useCallback)(async()=>{if(!navigator.mediaDevices?.enumerateDevices)return;let e=await d();s(e.needsPermission),i(e.devices),l(e.known)},[]),m=(0,V.useCallback)(async()=>{try{let e=await navigator.mediaDevices.getUserMedia({audio:!0});for(let t of e.getTracks())t.stop()}catch{}p()},[p]);(0,V.useEffect)(()=>{p();let e=navigator.mediaDevices;if(!e?.addEventListener)return;let t=()=>void p();return e.addEventListener(`devicechange`,t),()=>e.removeEventListener(`devicechange`,t)},[p]);let g=(0,V.useMemo)(()=>{let n=t.map((t,n)=>({value:t.deviceId,label:t.label||e(`voicePage.microphoneFallbackLabel`,{index:n+1})})),r=u!==Z&&!n.some(e=>e.value===u);return[{value:null,label:e(`voicePage.systemDefault`)},...n,...r?[{value:u,label:e(c?`voicePage.savedMicrophoneNotConnected`:`voicePage.savedMicrophone`)}]:[]]},[t,u,c,e]),_=(0,V.useCallback)(e=>{f(e),h(e)},[]);(0,V.useEffect)(()=>x(()=>{f(o())}),[]);let v=u===Z?null:u;return(0,H.jsx)(B,{title:e(`voicePage.microphoneTitle`),subtitle:e(`voicePage.microphoneSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(r,{options:g,value:v,onChange:_,onSelectNone:()=>_(Z),"aria-label":e(`voicePage.microphoneAriaLabel`)})}),a&&(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,H.jsx)(n,{variant:`outlined`,onClick:m,children:e(`voicePage.allowMicrophoneAccess`)}),(0,H.jsx)(`span`,{className:J,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}=L(`settings`),n=u(),[r,i]=(0,V.useState)(()=>y()),[a,o]=(0,V.useState)(!1),[s,c]=(0,V.useState)([]),[d,f]=(0,V.useState)(!1),p=(0,V.useRef)(null),m=(0,V.useMemo)(()=>{let e=ee();return[{label:k(e),activator:e}]},[]),h=r.kind!==`off`,g=(0,V.useCallback)(e=>{i(e),te(e),o(!1),c([]),f(!1)},[]),_=be({onBound:()=>g({kind:`off`})}),v=_.catalog.find(e=>e.key===Q)?.accelerator??``,b=_.recordingKey===Q,x=t()?Be:[],S=(0,V.useCallback)(e=>{g(e),_.removeHotkey(Q)},[_,g]),w=(0,V.useCallback)(()=>{g({kind:`off`}),_.removeHotkey(Q)},[_,g]),T=(0,V.useCallback)(()=>{o(!0),c([]),f(!1),requestAnimationFrame(()=>{p.current?.focus()})},[]),E=(0,V.useCallback)(()=>{o(!1),c([]),f(!1)},[]),D=(0,V.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},[]),O=(0,V.useCallback)(e=>{if(e.preventDefault(),e.stopPropagation(),e.key===`Escape`){E();return}let t=D(e);if(ze.has(e.key)){f(!1),c(A(t));return}if(t.length===0){f(!0);return}g({kind:`key`,label:e.key.length===1?e.key.toUpperCase():e.key,modifiers:A(t)})},[E,D,g]),j=(0,V.useCallback)(e=>{a&&D(e).length===0&&s.length>0&&(c([]),f(!0))},[D,a,s]);(0,V.useEffect)(()=>{if(!a)return;let e=e=>{p.current&&!p.current.contains(e.target)&&E()};return window.addEventListener(`mousedown`,e),()=>window.removeEventListener(`mousedown`,e)},[E,a]);let M=h&&!m.some(e=>P(e.activator,r));return n?(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitleDesktop`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[x.map(e=>(0,H.jsx)(U,{label:e.label,selected:P(e.activator,r),onClick:()=>S(e.activator)},e.label)),(0,H.jsx)(U,{label:b?e(`voicePage.recordingPrompt`):v?(0,H.jsx)(ne,{accelerator:v}):e(`voicePage.customKey`),selected:v!==``,recording:b,onClick:b?_.stopRecording:()=>_.startRecording(Q)}),(0,H.jsx)(U,{label:e(`voicePage.offKeyLabel`),selected:r.kind===`off`&&!v&&!b,onClick:w})]}),_.conflict?.key===Q&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutConflict`,{command:_.conflict.label})})]})]})}):(0,H.jsx)(B,{title:e(`voicePage.voiceShortcutTitle`),subtitle:e(`voicePage.voiceShortcutSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,H.jsx)(l,{checked:h,onChange:e=>{g(e?C():{kind:`off`})},label:e(`voicePage.enableVoiceShortcut`)}),h&&(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsx)(`span`,{className:J,children:e(`voicePage.activationKeyLabel`)}),(0,H.jsxs)(`div`,{ref:p,tabIndex:a?0:-1,onKeyDown:a?O:void 0,onKeyUp:a?j:void 0,className:`flex flex-wrap items-center gap-2 focus:outline-none`,children:[m.map(e=>(0,H.jsx)(U,{label:e.label,selected:P(e.activator,r),onClick:()=>g(e.activator)},e.label)),a?(0,H.jsx)(U,{label:s.length>0?N(s):e(`voicePage.pressShortcut`),selected:!0,recording:!0,onClick:E}):(0,H.jsx)(U,{label:M?k(r):e(`voicePage.customKey`),selected:M,onClick:T})]}),d&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.shortcutChordHint`)})]}),h&&(0,H.jsxs)(`div`,{className:`flex items-start gap-1 pt-1 text-body-small-lighter text-[var(--content-quiet)]`,children:[(0,H.jsx)(z,{className:`mt-0.5 h-3 w-3 shrink-0`}),(0,H.jsx)(`span`,{children:e(`voicePage.focusedTabNote`)})]})]})]})})}function He(){let{t:e}=L(`settings`),t=F.use.pauseBeforeReplyMs(),r=F.use.setPauseBeforeReplyMs(),i=F.use.interruptSensitivity(),a=F.use.setInterruptSensitivity(),o=(0,V.useMemo)(()=>[{value:`low`,label:e(`voicePage.interruptSensitivityLow`)},{value:`medium`,label:e(`voicePage.interruptSensitivityMedium`)},{value:`high`,label:e(`voicePage.interruptSensitivityHigh`)}],[e]),s=t!==null||i!==null;return(0,H.jsx)(B,{title:e(`voicePage.turnTakingTitle`),subtitle:e(`voicePage.turnTakingSubtitle`),children:(0,H.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,H.jsx)(we,{}),(0,H.jsx)($,{label:e(`voicePage.pauseBeforeReplyLabel`),description:e(`voicePage.pauseBeforeReplyDescription`),isDefault:t===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(f,{value:(t??1200)/1e3,onValueChange:e=>{typeof e==`number`&&r(Math.round(e*1e3))},min:500/1e3,max:b/1e3,step:.1,showValue:!0,formatValue:e=>`${(typeof e==`number`?e:e[0]).toFixed(1)}s`,"aria-label":e(`voicePage.pauseBeforeReplyAriaLabel`)})})}),(0,H.jsx)($,{label:e(`voicePage.interruptSensitivityLabel`),description:e(`voicePage.interruptSensitivityDescription`),isDefault:i===null,children:(0,H.jsx)(`div`,{className:`max-w-xs`,children:(0,H.jsx)(g,{items:o,value:i??`medium`,onChange:a,ariaLabel:e(`voicePage.interruptSensitivityAriaLabel`)})})}),s&&(0,H.jsx)(`div`,{children:(0,H.jsx)(n,{variant:`outlined`,onClick:()=>{r(null),a(null)},children:e(`voicePage.resetToDefaults`)})})]})})}function $({label:e,description:t,isDefault:n,children:r}){let{t:i}=L(`settings`);return(0,H.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e}),n&&(0,H.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,H.jsx)(`p`,{className:J,children:t}),r]})}export{Fe as VoicePage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Cn as e,Sn as t,Zn as n}from"./app-
|
|
1
|
+
import{Cn as e,Sn as t,Zn as n}from"./app-Bevxq2OH.js";import{j as r}from"./vendor-CtuA73w5.js";import{t as i}from"./react-B9IgSVeK.js";import{Q as a}from"./icons-DxrLl-Dj.js";var o=i();function s({payload:t,onClose:i}){let{t:s}=r(`chat`),u=e(t.body);return(0,o.jsx)(n,{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};
|