@vellumai/web 0.11.9-staging.1 → 0.11.9-staging.2
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-B9jqmgbB.js → a2a-invite-BmopEUuc.js} +1 -1
- package/dist/assets/{about-page-B9eULV1f.js → about-page-jeGmoRA9.js} +1 -1
- package/dist/assets/{account-page-CZSO-AlP.js → account-page-JdskrJ78.js} +1 -1
- package/dist/assets/{account-shell-DgHv1A1w.js → account-shell-pvaSOGcE.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-CNvbVyVw.js → acp-run-detail-panel-By-l4zoq.js} +1 -1
- package/dist/assets/{activity-redirect-page-CwgTPGTG.js → activity-redirect-page-BFBKktry.js} +1 -1
- package/dist/assets/{activity-steps-panel-zky0cnuk.js → activity-steps-panel-cif0uZ12.js} +1 -1
- package/dist/assets/{add-credits-modal-Dx0fdWm5.js → add-credits-modal-NBoCa1j3.js} +1 -1
- package/dist/assets/{ai-page-Czt1hbgM.js → ai-page-CS3Z6MrX.js} +1 -1
- package/dist/assets/{android-billing-handoff-BJxquTxv.js → android-billing-handoff-B8rC7eeV.js} +1 -1
- package/dist/assets/{api-key-screen-BIiNVLmB.js → api-key-screen-C2s4sMm1.js} +1 -1
- package/dist/assets/{app-info-DdWNjeN2.js → app-info-WxnSkFp1.js} +1 -1
- package/dist/assets/archive-redirect-page-B5G-WDp0.js +1 -0
- package/dist/assets/{assistant-status-panel-eeZDx5Ef.js → assistant-status-panel-qlWNpUbQ.js} +1 -1
- package/dist/assets/{auth-welcome-screen-B5i9VCDX.js → auth-welcome-screen-D20mVl5R.js} +1 -1
- package/dist/assets/{avatar-bundled-components-X6uhm3sR.js → avatar-bundled-components-Bdw589VI.js} +1 -1
- package/dist/assets/{avatar-random-mKQpdYRU.js → avatar-random-B3jE15Y7.js} +2 -2
- package/dist/assets/{await-org-header-settled-3RjHs2p_.js → await-org-header-settled-DcAqEzY1.js} +1 -1
- package/dist/assets/{background-task-detail-panel-D-5wO1mD.js → background-task-detail-panel-CXD0nKQP.js} +1 -1
- package/dist/assets/{billing-page-BEx67_Vu.js → billing-page-DjpHOzD6.js} +3 -3
- package/dist/assets/{billing-redirect-page-DGi9rWvB.js → billing-redirect-page-Ca7pWbvL.js} +1 -1
- package/dist/assets/{bookmarks-page-vDGPyme6.js → bookmarks-page-B4Bj_NZ1.js} +1 -1
- package/dist/assets/{bundle-confirm-page-CLqCqvDN.js → bundle-confirm-page-CjvXenWx.js} +1 -1
- package/dist/assets/{channel-transcript-panel-C4lFREze.js → channel-transcript-panel-Bupj5L4O.js} +1 -1
- package/dist/assets/{channels-page-route-Cb0pntjc.js → channels-page-route-CSFzQtEJ.js} +1 -1
- package/dist/assets/{checkout-continuation-B6h2u8bW.js → checkout-continuation-BBasTGr1.js} +1 -1
- package/dist/assets/{checkout-page-BOd355tP.js → checkout-page-QfqxmVX3.js} +1 -1
- package/dist/assets/checkout-return-target-DRW4Fb93.js +1 -0
- package/dist/assets/{command-palette-B64x_N5e.js → command-palette-CsWImGc1.js} +1 -1
- package/dist/assets/{command-palette-window-page-BnnVhvV6.js → command-palette-window-page-Dm2bWRPF.js} +1 -1
- package/dist/assets/{community-page-BqfWeHrB.js → community-page-DG_go-bx.js} +1 -1
- package/dist/assets/companion-accent-Dhs0VHm8.js +1 -0
- package/dist/assets/{companion-layout-BWgLSvze.js → companion-layout-CU_fQwBX.js} +1 -1
- package/dist/assets/companion-surface-page-CUmDLt1d.js +1 -0
- package/dist/assets/{companion-watch-glow-page-CQT0SvDE.js → companion-watch-glow-page-DPah9dl8.js} +1 -1
- package/dist/assets/{connect-page-BEb1oXUc.js → connect-page-BAugVlOG.js} +1 -1
- package/dist/assets/{consent-controls-B1AnYj9V.js → consent-controls-BBOL1pVX.js} +1 -1
- package/dist/assets/{contacts-gateway-Cqy42w-P.js → contacts-gateway-_5gWCO5M.js} +1 -1
- package/dist/assets/{contacts-page-route-1biY-ppa.js → contacts-page-route-cNZg-y2G.js} +1 -1
- package/dist/assets/{credential-entry-page-Dp8ZvJCL.js → credential-entry-page-CG0pMgbA.js} +1 -1
- package/dist/assets/{credentials-page-DWCvFFiI.js → credentials-page-D8hdCncX.js} +1 -1
- package/dist/assets/{csv-preview-DfcTYrC2.js → csv-preview-BZResk4J.js} +1 -1
- package/dist/assets/danger-zone-redirect-page-CwAiH6Ly.js +1 -0
- package/dist/assets/{debug-page-KIzcZW4r.js → debug-page-DuHowSZO.js} +1 -1
- package/dist/assets/{deploy-dialogs-CC6DQ0vu.js → deploy-dialogs-CXykRB7L.js} +1 -1
- package/dist/assets/{detail-card-BXhwux_c.js → detail-card-sxGt13nZ.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-3gCSXBXB.js → detail-panel-stop-button-BhBUIYrN.js} +1 -1
- package/dist/assets/{developer-page-DWZTB0CS.js → developer-page-Xok7vdls.js} +1 -1
- package/dist/assets/devices-redirect-page-Bn8l0NbB.js +1 -0
- package/dist/assets/{dictation-overlay-page-C_LaA2sN.js → dictation-overlay-page-faR6ZD05.js} +1 -1
- package/dist/assets/{document-viewer-page-UQ_WQgfz.js → document-viewer-page-CICQK2iT.js} +1 -1
- package/dist/assets/{emails-page-DbvNvgv2.js → emails-page-ChkgqqfV.js} +1 -1
- package/dist/assets/{environment-store-Dkn0BKG2.js → environment-store-DbxWXxoY.js} +1 -1
- package/dist/assets/{file-editor-C7Um2GrG.js → file-editor-BcG_sR-r.js} +1 -1
- package/dist/assets/{general-page-CavuxYdx.js → general-page-BbkJBzvT.js} +1 -1
- package/dist/assets/{hatching-screen-ChUtQw8W.js → hatching-screen-jX7krI2v.js} +1 -1
- package/dist/assets/{hosting-screen-9TLoyimY.js → hosting-screen-BsNV_ReB.js} +1 -1
- package/dist/assets/{identity-page-route-D7W7YrE3.js → identity-page-route-aHYnV_jN.js} +1 -1
- package/dist/assets/index-BUt2OH6r.css +2 -0
- package/dist/assets/{index-BVVp210p.js → index-b_IQShc9.js} +9 -9
- package/dist/assets/{inspect-page-DbB0qA0t.js → inspect-page-HI841yUu.js} +3 -3
- package/dist/assets/{integrations-page-DfLlnJon.js → integrations-page-BmMDMgFU.js} +1 -1
- package/dist/assets/{intelligence-layout-CNhNn2l4.js → intelligence-layout-CLPUS0ap.js} +1 -1
- package/dist/assets/keyboard-shortcuts-redirect-page-DDGnWlyz.js +1 -0
- package/dist/assets/{latest-assistant-text-QBDnPUy-.js → latest-assistant-text-DAXhdhSY.js} +1 -1
- package/dist/assets/{library-detail-page-BzJfzbC3.js → library-detail-page-43KAFuJi.js} +1 -1
- package/dist/assets/{library-page-v3XsOgxI.js → library-page-CDLs7xOE.js} +1 -1
- package/dist/assets/{login-page-1BkkzrgT.js → login-page-GVnmapVt.js} +1 -1
- package/dist/assets/{logout-page-CnlDy9lt.js → logout-page-Bz-a8xjH.js} +1 -1
- package/dist/assets/{logs-layout-DDdSW282.js → logs-layout-_NfJqBwz.js} +1 -1
- package/dist/assets/{markdown-preview-DNH9WsbV.js → markdown-preview-c_WsdpT0.js} +1 -1
- package/dist/assets/{media-preview-BePTwtIU.js → media-preview-D7AavJf-.js} +1 -1
- package/dist/assets/{memory-page-route-BTPvwnHF.js → memory-page-route-Csfkb0fE.js} +1 -1
- package/dist/assets/{memory-router-playground-page-DQzcoSy8.js → memory-router-playground-page-B_TvYode.js} +1 -1
- package/dist/assets/{message-files-panel-BXc-fblZ.js → message-files-panel-Q_w3u4r6.js} +1 -1
- package/dist/assets/{metric-card-DxpIyY0z.js → metric-card-XbeSP_dF.js} +1 -1
- package/dist/assets/{notifications-page-BNgPGEQb.js → notifications-page-BCo_g_9g.js} +1 -1
- package/dist/assets/{oauth-complete-page-DqZtiKH-.js → oauth-complete-page-D0_ddx3s.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-BDfhFWci.js → oauth-popup-complete-page-DR-OaEn7.js} +1 -1
- package/dist/assets/{page-shell-Dlsn8wyt.js → page-shell-D1-wKbPX.js} +1 -1
- package/dist/assets/{pairing-page-CWoinj-Z.js → pairing-page-CFi0G2Xh.js} +1 -1
- package/dist/assets/password-reset-page-DdG-gDUR.js +1 -0
- package/dist/assets/{pdf-file-preview-CJ6geQeY.js → pdf-file-preview-QWR5YVZp.js} +1 -1
- package/dist/assets/{personality-page-C9p1PiOn.js → personality-page-D4oROOvq.js} +1 -1
- package/dist/assets/{plans-page-BNi_MgUe.js → plans-page-BAgmH1pe.js} +1 -1
- package/dist/assets/{platform-loopback-page-_NLrjsOR.js → platform-loopback-page-hfwG6N6r.js} +1 -1
- package/dist/assets/{plugin-detail-page-DIOu3ao3.js → plugin-detail-page-JFE-PjTL.js} +1 -1
- package/dist/assets/{plugins-page-LBod4Ue5.js → plugins-page-PjMDyM4p.js} +1 -1
- package/dist/assets/{preview-error-kO-J66Zv.js → preview-error-BLcNtS5K.js} +1 -1
- package/dist/assets/{privacy-page-CEt-Gr-k.js → privacy-page-BBlgcXb0.js} +1 -1
- package/dist/assets/{privacy-screen-Dr2tpwgO.js → privacy-screen-DMC-z5IT.js} +1 -1
- package/dist/assets/{provider-callback-page-aJ_6i4xK.js → provider-callback-page-CuAY1_4R.js} +1 -1
- package/dist/assets/{provider-key-PAmg3XjL.js → provider-key-CNHs7dwm.js} +1 -1
- package/dist/assets/{provider-signup-page-BCUoHgWf.js → provider-signup-page-DjNpFmgq.js} +1 -1
- package/dist/assets/{quick-input-page-C8AjTd-X.js → quick-input-page-CMM22KVb.js} +1 -1
- package/dist/assets/{research-mock-page-CGOcSvcT.js → research-mock-page-ClUeMeQm.js} +1 -1
- package/dist/assets/{research-onboarding-route-DBZhQhpw.js → research-onboarding-route-BCNagFK9.js} +1 -1
- package/dist/assets/{review-terms-screen-DsxPDq8C.js → review-terms-screen-LYu2oH8u.js} +1 -1
- package/dist/assets/{schedules-CiQRct_v.js → schedules-jQA-lEXD.js} +1 -1
- package/dist/assets/{schedules-page-DY4qoW1Q.js → schedules-page-y5DMdtSF.js} +1 -1
- package/dist/assets/security-redirect-page-Cso7bCn1.js +1 -0
- package/dist/assets/{select-assistant-screen-DY2bsToS.js → select-assistant-screen-DTrNJM_L.js} +1 -1
- package/dist/assets/{self-hosted-servers-Ck45Ce7U.js → self-hosted-servers-CE0-6fMf.js} +1 -1
- package/dist/assets/{service-form-controls-BrAek3O9.js → service-form-controls-CmKM2qps.js} +1 -1
- package/dist/assets/{setting-row-D7b4t29_.js → setting-row-JfvUWIUE.js} +1 -1
- package/dist/assets/{settings-divider-DOmdsd_b.js → settings-divider-BDaGinDZ.js} +1 -1
- package/dist/assets/{settings-layout-DyxqBBfM.js → settings-layout-BSPQuLG_.js} +1 -1
- package/dist/assets/{share-feedback-modal-DQkZsb9S.js → share-feedback-modal-C-9w9Qun.js} +1 -1
- package/dist/assets/{sidebar-tree-cUpG2j7M.js → sidebar-tree-B_7TxIfc.js} +1 -1
- package/dist/assets/{signup-page-BS3key1b.js → signup-page-Up3lhxjE.js} +1 -1
- package/dist/assets/{signup-shell-CJkXiLFK.js → signup-shell-Cz7nHsiG.js} +1 -1
- package/dist/assets/{skill-detail-page-Ctdu9URX.js → skill-detail-page-CcD41B-N.js} +1 -1
- package/dist/assets/{skill-detail-panel-pSGqD5fk.js → skill-detail-panel-COgbn-zN.js} +1 -1
- package/dist/assets/{skill-removal-dialog-BAZKh1bp.js → skill-removal-dialog-IZ80QFym.js} +1 -1
- package/dist/assets/{skills-page-C3fYc9yk.js → skills-page-9DYmyfOw.js} +1 -1
- package/dist/assets/{sounds-page-DzAbysBF.js → sounds-page-DzCV0GMu.js} +1 -1
- package/dist/assets/{start-screen-BZJCt4uO.js → start-screen-De2GtK4A.js} +1 -1
- package/dist/assets/{stt-language-picker-modal-3JHZ7KRr.js → stt-language-picker-modal-CLsnI2Yz.js} +1 -1
- package/dist/assets/{subagent-detail-panel-C-id-gz6.js → subagent-detail-panel-Bx-nrZRA.js} +1 -1
- package/dist/assets/{superpowers-page-ByqWgwxm.js → superpowers-page-BZXp-HPn.js} +1 -1
- package/dist/assets/{system-events-page-Drm8odGD.js → system-events-page-CdnLtW07.js} +1 -1
- package/dist/assets/system-events-redirect-page-8K7jp-vf.js +1 -0
- package/dist/assets/{text-preview-DQo_wIE1.js → text-preview-CzBwTE6l.js} +1 -1
- package/dist/assets/{theme-stage-page-BW7WXz7Y.js → theme-stage-page-DFM8cSRo.js} +1 -1
- package/dist/assets/{tiptap-document-editor-B5NBtP2i.js → tiptap-document-editor-DiMEXCfY.js} +1 -1
- package/dist/assets/{tool-detail-panel-s9N8-rpr.js → tool-detail-panel-C-r8dnRp.js} +1 -1
- package/dist/assets/{trait-cycle-row-DIN6r7YK.js → trait-cycle-row-C2Icx-67.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-Dc8GuuuI.js → upgrade-cancel-page-Bi8uWXPd.js} +1 -1
- package/dist/assets/{upgrade-success-page-Ba2I2Zur.js → upgrade-success-page-BkEgh_vv.js} +1 -1
- package/dist/assets/{usage-redirect-page-zIF77c7V.js → usage-redirect-page-kNuqbUkh.js} +1 -1
- package/dist/assets/{use-assistant-identity-details-D9qdC7Cd.js → use-assistant-identity-details-BHiN3OAl.js} +1 -1
- package/dist/assets/{use-checkout-dismiss-refresh-BwscoYFU.js → use-checkout-dismiss-refresh-DOJD5kF-.js} +1 -1
- package/dist/assets/{use-edge-swipe-back-CJNLwmcm.js → use-edge-swipe-back-BO9Eg7fg.js} +2 -2
- package/dist/assets/{use-hotkey-recorder-BpZ2ce5P.js → use-hotkey-recorder-CSRkbNLq.js} +1 -1
- package/dist/assets/{use-invite-link-dialog-Ho7FM83m.js → use-invite-link-dialog-D8k7P63J.js} +1 -1
- package/dist/assets/{use-platform-assistant-id-CupaRcFg.js → use-platform-assistant-id-C6Npjvje.js} +1 -1
- package/dist/assets/{use-return-to-short-circuit-DrqtvQUp.js → use-return-to-short-circuit-qAmnQhhd.js} +1 -1
- package/dist/assets/{use-side-list-room-DT90pjIs.js → use-side-list-room-wi1Z0sax.js} +1 -1
- package/dist/assets/{use-skill-actions-tfxzxIKS.js → use-skill-actions-Cenw6B7x.js} +1 -1
- package/dist/assets/{use-skill-detail-files-CaKc2HWM.js → use-skill-detail-files-BMTlfXyu.js} +1 -1
- package/dist/assets/use-supports-credentials-settings-BbVrMmw2.js +1 -0
- package/dist/assets/use-transcript-message-by-id-BAc4xz_C.js +1 -0
- package/dist/assets/{voice-page-B9hAlvd7.js → voice-page-Cno795eb.js} +1 -1
- package/dist/assets/{weather-forecast-display-BJes18_s.js → weather-forecast-display-Bq7Ktxyw.js} +1 -1
- package/dist/assets/{welcome-screen-CrXclfuA.js → welcome-screen-CipRXBbr.js} +1 -1
- package/dist/assets/{workflow-detail-panel-FJt7O7DN.js → workflow-detail-panel-B4pwzq2k.js} +1 -1
- package/dist/assets/{workspace-page-maAwyAnK.js → workspace-page-B_ntO4pT.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/archive-redirect-page-Bahth1ou.js +0 -1
- package/dist/assets/checkout-return-target-DEiJUksg.js +0 -1
- package/dist/assets/companion-accent-D98A6fdt.js +0 -1
- package/dist/assets/companion-surface-page-BYlBiFag.js +0 -1
- package/dist/assets/danger-zone-redirect-page-BbvorzSo.js +0 -1
- package/dist/assets/devices-redirect-page-MeFP2iGe.js +0 -1
- package/dist/assets/index-ChmqERCm.css +0 -2
- package/dist/assets/keyboard-shortcuts-redirect-page-CX6auuC3.js +0 -1
- package/dist/assets/password-reset-page-Cv3_LjgI.js +0 -1
- package/dist/assets/security-redirect-page-Be_N1V2t.js +0 -1
- package/dist/assets/system-events-redirect-page-D4uO9zjA.js +0 -1
- package/dist/assets/use-supports-credentials-settings-BsoxGpqB.js +0 -1
- package/dist/assets/use-transcript-message-by-id-2x4qzE7s.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{I as t,Jn as n,N as r,Zn as i,j as a}from"./vendor-CYfJo8gP.js";import{b as o,t as s}from"./react-DPM_L_aA.js";import{Ai as c,Ty as l,Wu as u,Y as d,hd as f,md as p,yh as m,zf as h,zm as g}from"./index-BVVp210p.js";var _=e(o(),1),v=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function y(e,t,n){let{data:r,response:i}=await m({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new v(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new v(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:b(a)}}function b(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function x(e){return n({mutationFn:async t=>{if(!e)throw new v(0,`Missing assistantId`);return y(e,t)}})}function S(e){return i({...u({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4})}function C(e){return i({...f({path:{assistant_id:e}}),enabled:!!e,staleTime:1440*60*1e3})}function ee(e){return i({...p({path:{assistant_id:e}}),enabled:!!e,staleTime:1/0})}var w=s();function T(){let{t:e}=a(`chat`),t=c(),n=h(),r=g.use.memoryRouterPlayground();return n?(0,w.jsx)($,{children:e(`memoryRouterPlaygroundPage.loading`)}):!t||!r?(0,w.jsx)($,{children:e(`memoryRouterPlaygroundPage.notAvailable`)}):(0,w.jsx)(D,{})}var E={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function D(){let{t:e}=a(`chat`),t=d(),n=x(t),r=x(t),i=S(t),o=C(t),s=ee(t),[c,l]=(0,_.useState)(``),[u,f]=(0,_.useState)([{assistantMessage:``,userMessage:``}]),[p,m]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(p)return;let e=s.data?.nowText;typeof e==`string`&&c===``&&l(e)},[s.data?.nowText,c,p]);let[h,g]=(0,_.useState)(E),[v,y]=(0,_.useState)(E),[b,T]=(0,_.useState)(null),[D,k]=(0,_.useState)(null),M=u[u.length-1].userMessage,P=t=>{let i=t===`A`?h:v,a=t===`A`?T:k,o=t===`A`?n:r;a(null);let s;try{s=O(i)}catch(t){a(t instanceof Error?t.message:e(`memoryRouterPlaygroundPage.invalidOverrideInput`));return}let l=i.profile.trim().length>0?i.profile:void 0,d=i.customPrompt.trim().length>0?i.customPrompt:void 0,f=u.map((e,t)=>t===u.length-1?{...e,userMessage:e.userMessage.trim()}:e);o.mutate({recentTurnPairs:f,nowText:c,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...d===void 0?{}:{routerPromptOverride:d}})},F=()=>{P(`A`),P(`B`)},I=M.trim().length>0,L=I&&!n.isPending,z=I&&!r.isPending;return(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,w.jsx)(A,{}),(0,w.jsx)(j,{nowText:c,onNowTextChange:e=>{m(!0),l(e)},onReloadNowText:()=>{let e=s.data?.nowText;typeof e==`string`&&(l(e),m(!1))},nowTextLoading:s.isLoading,pairs:u,onPairsChange:f}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:h,onChange:g,onRun:()=>P(`A`),canRun:L,isRunning:n.isPending,profiles:i.data?.profiles??[],activeProfile:i.data?.activeProfile??null,defaultPromptTemplate:o.data?.template??``}),(0,w.jsx)(N,{paneId:`B`,overrides:v,onChange:y,onRun:()=>P(`B`),canRun:z,isRunning:r.isPending,profiles:i.data?.profiles??[],activeProfile:i.data?.activeProfile??null,defaultPromptTemplate:o.data?.template??``})]}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(te,{onClick:F,disabled:!I||n.isPending||r.isPending,isRunning:n.isPending||r.isPending})}),(0,w.jsx)(ne,{visible:n.data!==void 0&&r.data!==void 0}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(R,{paneId:`A`,userMessage:M,mutation:n,otherResult:r.data?.response,validation:b}),(0,w.jsx)(R,{paneId:`B`,userMessage:M,mutation:r,otherResult:n.data?.response,validation:D})]})]})})}function O(e){let t={...k(`tier1_size`,e.tier1),...k(`tier2_size`,e.tier2),...k(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function k(e,n){let r=n.trim();if(r===``)return{};if(r===`null`)return{[e]:null};let i=Number(r);if(!Number.isInteger(i)||i<1)throw Error(t(`chat:memoryRouterPlaygroundPage.overrideMustBePositiveInteger`,{fieldName:e,value:r}));return{[e]:i}}function A(){let{t:e}=a(`chat`);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:e(`memoryRouterPlaygroundPage.title`)}),(0,w.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:(0,w.jsx)(r,{ns:`chat`,i18nKey:`memoryRouterPlaygroundPage.description`,components:{code:(0,w.jsx)(`code`,{})}})})]})}function j({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let{t:s}=a(`chat`),c=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},u=()=>{o([{assistantMessage:``,userMessage:``},...i])},d=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:s(`memoryRouterPlaygroundPage.conversationalContextTitle`)}),(0,w.jsx)(M,{id:`memory-router-playground-now`,label:s(`memoryRouterPlaygroundPage.nowBlockLabel`),value:e,onChange:t,rows:6,monospace:!0,placeholder:s(r?`memoryRouterPlaygroundPage.nowLoadingPlaceholder`:`memoryRouterPlaygroundPage.nowDefaultPlaceholder`),trailing:(0,w.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:s(`memoryRouterPlaygroundPage.reloadNowButton`)})}),(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:s(`memoryRouterPlaygroundPage.recentPairsLabel`)}),(0,w.jsx)(`button`,{type:`button`,onClick:u,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:s(`memoryRouterPlaygroundPage.addOlderPairButton`)})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:[s(`memoryRouterPlaygroundPage.pairLabel`,{index:t+1,total:i.length}),n?s(`memoryRouterPlaygroundPage.pairMostRecentSuffix`):``]}),!n&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>d(t),className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:s(`memoryRouterPlaygroundPage.removeButton`)})]}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-assistant`,label:s(`memoryRouterPlaygroundPage.assistantReplyLabel`),value:e.assistantMessage,onChange:e=>c(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?s(`memoryRouterPlaygroundPage.firstTurnAssistantPlaceholder`):s(`memoryRouterPlaygroundPage.assistantReplyPlaceholder`)}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-user`,label:s(n?`memoryRouterPlaygroundPage.justArrivedUserLabel`:`memoryRouterPlaygroundPage.userMessageLabel`),value:e.userMessage,onChange:e=>c(t,{userMessage:e}),rows:3,placeholder:s(n?`memoryRouterPlaygroundPage.lastUserPlaceholder`:`memoryRouterPlaygroundPage.userMessagePlaceholder`),required:n})]},t)})]})})}function M({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`label`,{htmlFor:e,className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,w.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function N({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:u}){let{t:d}=a(`chat`);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:d(`memoryRouterPlaygroundPage.configTitle`,{paneId:e})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsx)(I,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,w.jsx)(I,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,w.jsx)(I,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,w.jsx)(F,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,w.jsx)(P,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:u}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?d(`memoryRouterPlaygroundPage.running`):d(`memoryRouterPlaygroundPage.runPane`,{paneId:e})})})]})})}function P({paneId:e,value:t,onChange:n,defaultTemplate:r}){let{t:i}=a(`chat`),[o,s]=(0,_.useState)(!1),c=`memory-router-playground-${e}-prompt`,l=t.trim().length>0;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-label-medium-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[o?`▾`:`▸`,` `,i(`memoryRouterPlaygroundPage.systemPrompt`),` `,(0,w.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,i(l?`memoryRouterPlaygroundPage.promptModeCustom`:`memoryRouterPlaygroundPage.promptModeBundled`),`)`]})]}),o&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:i(`memoryRouterPlaygroundPage.loadDefault`)}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!l,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:l?`pointer`:`not-allowed`},children:i(`memoryRouterPlaygroundPage.reset`)})]})]}),o&&(0,w.jsx)(`textarea`,{id:c,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:i(`memoryRouterPlaygroundPage.customPromptPlaceholder`),className:`rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,resize:`vertical`,minHeight:`120px`}})]})}function F({paneId:e,value:t,onChange:n,profiles:r,activeProfile:i}){let{t:o}=a(`chat`),s=`memory-router-playground-${e}-profile`,c=i!==null&&i.length>0?o(`memoryRouterPlaygroundPage.inheritActiveWithProfile`,{profile:i}):o(`memoryRouterPlaygroundPage.inheritActive`);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:s,className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:o(`memoryRouterPlaygroundPage.llmProfilesOverride`)}),(0,w.jsxs)(`select`,{id:s,value:t,onChange:e=>n(e.target.value),className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`},children:[(0,w.jsx)(`option`,{value:``,children:c}),r.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))]})]})}function I({paneId:e,label:t,value:n,onChange:r}){let{t:i}=a(`chat`),o=`memory-router-playground-${e}-${t}`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:o,className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:t}),(0,w.jsx)(`input`,{id:o,value:n,onChange:e=>r(e.target.value),placeholder:i(`memoryRouterPlaygroundPage.inheritPlaceholder`),className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`}})]})}function te({onClick:e,disabled:t,isRunning:n}){let{t:r}=a(`chat`);return(0,w.jsx)(`button`,{type:`button`,onClick:e,disabled:t,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:t?`var(--surface-overlay)`:`var(--primary-base)`,color:t?`var(--content-disabled)`:`var(--content-on-primary)`,border:`none`,cursor:t?`not-allowed`:`pointer`},children:r(n?`memoryRouterPlaygroundPage.running`:`memoryRouterPlaygroundPage.runBoth`)})}function ne({visible:e}){let{t}=a(`chat`);return e?(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-md px-4 py-2 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`},children:[(0,w.jsx)(L,{marker:`●`,markerColor:`var(--content-default)`,label:t(`memoryRouterPlaygroundPage.legendInBoth`)}),(0,w.jsx)(L,{marker:`◆`,markerColor:X(`A`),label:t(`memoryRouterPlaygroundPage.legendAOnly`)}),(0,w.jsx)(L,{marker:`◇`,markerColor:X(`B`),label:t(`memoryRouterPlaygroundPage.legendBOnly`)})]}):null}function L({marker:e,markerColor:t,label:n}){return(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{style:{color:t},children:e}),(0,w.jsx)(`span`,{children:n})]})}function R({paneId:e,userMessage:t,mutation:n,otherResult:r,validation:i}){let{t:o}=a(`chat`),s=n.data;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(V,{paneId:e}),i!==null&&(0,w.jsx)(Q,{message:i}),n.isError&&(0,w.jsx)(Q,{message:n.error instanceof Error?n.error.message:o(`memoryRouterPlaygroundPage.failedToRunSimulation`)}),s!==void 0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(H,{paneId:e,userMessage:t,result:s.response,otherResult:r}),(0,w.jsx)(z,{paneId:e,rawRequest:s.rawRequest,rawResponse:s.rawResponse})]})]})}function z({paneId:e,rawRequest:t,rawResponse:n}){let{t:r}=a(`chat`),[i,o]=(0,_.useState)(!1);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`text-label-medium-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` `,r(`memoryRouterPlaygroundPage.rawApiExchange`)]}),i&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(B,{label:r(`memoryRouterPlaygroundPage.requestLabel`,{paneId:e}),body:t}),(0,w.jsx)(B,{label:r(`memoryRouterPlaygroundPage.responseLabel`,{paneId:e}),body:n})]})]})})}function B({label:e,body:t}){let{t:n}=a(`chat`);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`pre`,{className:`overflow-auto rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,maxHeight:`320px`,whiteSpace:`pre`},children:t.length===0?n(`memoryRouterPlaygroundPage.empty`):t})]})}function V({paneId:e}){let{t}=a(`chat`);return(0,w.jsx)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:t(`memoryRouterPlaygroundPage.paneTitle`,{paneId:e})})}function H({paneId:e,userMessage:t,result:n,otherResult:r}){let{t:i}=a(`chat`),o=(0,_.useMemo)(()=>U(n,r),[n,r]),s=(0,_.useMemo)(()=>q(n),[n]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsx)(G,{result:n,userMessage:t,otherResult:r,counts:(0,_.useMemo)(()=>W(o),[o])}),(0,w.jsx)(K,{result:n}),n.failureReason!==null&&(0,w.jsx)(Q,{message:i(`memoryRouterPlaygroundPage.routerFailure`,{reason:n.failureReason})}),s.length===0?(0,w.jsx)(ae,{}):s.map(t=>(0,w.jsx)(ie,{paneId:e,source:t.source,slugs:t.slugs,scores:n.scores,diff:o},t.source))]})}function U(e,t){let n=new Map;if(t===void 0){for(let t of e.selectedSlugs)n.set(t,`both`);return n}let r=new Set(t.selectedSlugs);for(let t of e.selectedSlugs)n.set(t,r.has(t)?`both`:`only-here`);return n}function W(e){let t=0,n=0;for(let r of e.values())r===`both`?t++:n++;return{total:e.size,shared:t,unique:n}}function G({result:e,userMessage:t,otherResult:n,counts:r}){let{t:i}=a(`chat`),o=[{label:i(`memoryRouterPlaygroundPage.summaryUserMessageLabel`),value:t},{label:i(`memoryRouterPlaygroundPage.totalCandidatePagesLabel`),value:e.totalCandidatePages.toLocaleString()},{label:i(`memoryRouterPlaygroundPage.selectedLabel`),value:i(`memoryRouterPlaygroundPage.selectedValue`,{count:e.selectedSlugs.length,maxPageIds:e.effectiveConfig.max_page_ids})}];return n!==void 0&&o.push({label:i(`memoryRouterPlaygroundPage.diffLabel`),value:i(`memoryRouterPlaygroundPage.diffValue`,{shared:r.shared,unique:r.unique})}),(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:i(`memoryRouterPlaygroundPage.summary`)}),(0,w.jsx)(Z,{rows:o})]})})}function K({result:e}){let{t}=a(`chat`),n=[`tier1_size`,`tier2_size`,`batch_size`,`max_page_ids`].map(n=>{let r=e.effectiveConfig[n],i=e.overrides[n];return{label:n,value:`${r===null?t(`memoryRouterPlaygroundPage.nullValue`):String(r)}${i===void 0?``:t(`memoryRouterPlaygroundPage.overrideSuffix`)}`}});return n.push({label:t(`memoryRouterPlaygroundPage.llmProfilesOverride`),value:e.profileOverride===null?t(`memoryRouterPlaygroundPage.inheritActive`):`${e.profileOverride}${t(`memoryRouterPlaygroundPage.overrideSuffix`)}`}),n.push({label:t(`memoryRouterPlaygroundPage.systemPromptConfigLabel`),value:e.routerPromptOverridden?t(`memoryRouterPlaygroundPage.promptModeCustom`):t(`memoryRouterPlaygroundPage.promptModeBundled`)}),(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:t(`memoryRouterPlaygroundPage.effectiveConfig`)}),(0,w.jsx)(Z,{rows:n})]})})}function q(e){let t=new Map;for(let n of e.selectedSlugs){let r=e.sourceBySlug[n];if(r===void 0)continue;let i=t.get(r)??[];i.push(n),t.set(r,i)}return[...t.keys()].sort((e,t)=>J(e)-J(t)).map(e=>({source:e,slugs:t.get(e)}))}function J(e){return e===`tier1`?0:e===`tier2`?1:e.startsWith(`tier3:`)?2+Number(e.slice(6)):2**53-1}function Y(e,t){return e===`tier1`?t(`memoryRouterPlaygroundPage.tier1Label`):e===`tier2`?t(`memoryRouterPlaygroundPage.tier2Label`):e.startsWith(`tier3:`)?t(`memoryRouterPlaygroundPage.tier3Label`,{batch:e.slice(6)}):e}function X(e){return e===`A`?`var(--system-mid-strong)`:`var(--primary-base)`}function re(e,t){return t===`both`?{color:`var(--content-default)`,marker:`●`}:{color:X(e),marker:e===`A`?`◆`:`◇`}}function ie({paneId:e,source:t,slugs:n,scores:r,diff:i}){let{t:o}=a(`chat`);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:Y(t,o)}),(0,w.jsx)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:o(`memoryRouterPlaygroundPage.pageCount`,{count:n.length})})]}),(0,w.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(n=>{let{color:a,marker:s}=re(e,i.get(n)??`only-here`);return(0,w.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,w.jsx)(`span`,{style:{color:a},children:s}),(0,w.jsx)(`code`,{className:`text-body-medium-default`,style:{color:a},children:n})]}),t===`tier2`&&(0,w.jsx)(`span`,{className:`tabular-nums text-label-medium-default`,style:{color:`var(--content-secondary)`},children:o(`memoryRouterPlaygroundPage.emaScore`,{score:(r[n]??0).toFixed(3)})})]},n)})})]})})}function ae(){let{t:e}=a(`chat`);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e(`memoryRouterPlaygroundPage.noPagesSelected`)}),(0,w.jsx)(`span`,{className:`text-body-small-lighter`,style:{color:`var(--content-secondary)`},children:e(`memoryRouterPlaygroundPage.emptySelectionHint`)})]})})}function Z({rows:e}){return(0,w.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(({label:e,value:t})=>(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsx)(`span`,{className:`shrink-0 text-label-medium-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`span`,{className:`text-right text-body-medium-lighter`,style:{color:`var(--content-default)`},children:t})]},e))})}function Q({message:e}){return(0,w.jsx)(`div`,{className:`rounded-md px-4 py-3 text-body-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--system-negative-strong)`},children:e})}function $({children:e}){return(0,w.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-8 text-label-medium-default`,style:{color:`var(--content-tertiary)`},children:e})}export{T as MemoryRouterPlaygroundPage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{I as t,Jn as n,N as r,Zn as i,j as a}from"./vendor-CYfJo8gP.js";import{b as o,t as s}from"./react-DPM_L_aA.js";import{Ai as c,Ty as l,Wu as u,Y as d,hd as f,md as p,yh as m,zf as h,zm as g}from"./index-b_IQShc9.js";var _=e(o(),1),v=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function y(e,t,n){let{data:r,response:i}=await m({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new v(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new v(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:b(a)}}function b(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function x(e){return n({mutationFn:async t=>{if(!e)throw new v(0,`Missing assistantId`);return y(e,t)}})}function S(e){return i({...u({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4})}function C(e){return i({...f({path:{assistant_id:e}}),enabled:!!e,staleTime:1440*60*1e3})}function ee(e){return i({...p({path:{assistant_id:e}}),enabled:!!e,staleTime:1/0})}var w=s();function T(){let{t:e}=a(`chat`),t=c(),n=h(),r=g.use.memoryRouterPlayground();return n?(0,w.jsx)($,{children:e(`memoryRouterPlaygroundPage.loading`)}):!t||!r?(0,w.jsx)($,{children:e(`memoryRouterPlaygroundPage.notAvailable`)}):(0,w.jsx)(D,{})}var E={tier1:``,tier2:``,batch:``,profile:``,customPrompt:``};function D(){let{t:e}=a(`chat`),t=d(),n=x(t),r=x(t),i=S(t),o=C(t),s=ee(t),[c,l]=(0,_.useState)(``),[u,f]=(0,_.useState)([{assistantMessage:``,userMessage:``}]),[p,m]=(0,_.useState)(!1);(0,_.useEffect)(()=>{if(p)return;let e=s.data?.nowText;typeof e==`string`&&c===``&&l(e)},[s.data?.nowText,c,p]);let[h,g]=(0,_.useState)(E),[v,y]=(0,_.useState)(E),[b,T]=(0,_.useState)(null),[D,k]=(0,_.useState)(null),M=u[u.length-1].userMessage,P=t=>{let i=t===`A`?h:v,a=t===`A`?T:k,o=t===`A`?n:r;a(null);let s;try{s=O(i)}catch(t){a(t instanceof Error?t.message:e(`memoryRouterPlaygroundPage.invalidOverrideInput`));return}let l=i.profile.trim().length>0?i.profile:void 0,d=i.customPrompt.trim().length>0?i.customPrompt:void 0,f=u.map((e,t)=>t===u.length-1?{...e,userMessage:e.userMessage.trim()}:e);o.mutate({recentTurnPairs:f,nowText:c,...s?{configOverrides:s}:{},...l===void 0?{}:{profileOverride:l},...d===void 0?{}:{routerPromptOverride:d}})},F=()=>{P(`A`),P(`B`)},I=M.trim().length>0,L=I&&!n.isPending,z=I&&!r.isPending;return(0,w.jsx)(`div`,{className:`flex h-full min-h-0 flex-col overflow-y-auto`,children:(0,w.jsxs)(`div`,{className:`mx-auto flex w-full max-w-[1280px] flex-col gap-6 p-6`,children:[(0,w.jsx)(A,{}),(0,w.jsx)(j,{nowText:c,onNowTextChange:e=>{m(!0),l(e)},onReloadNowText:()=>{let e=s.data?.nowText;typeof e==`string`&&(l(e),m(!1))},nowTextLoading:s.isLoading,pairs:u,onPairsChange:f}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:h,onChange:g,onRun:()=>P(`A`),canRun:L,isRunning:n.isPending,profiles:i.data?.profiles??[],activeProfile:i.data?.activeProfile??null,defaultPromptTemplate:o.data?.template??``}),(0,w.jsx)(N,{paneId:`B`,overrides:v,onChange:y,onRun:()=>P(`B`),canRun:z,isRunning:r.isPending,profiles:i.data?.profiles??[],activeProfile:i.data?.activeProfile??null,defaultPromptTemplate:o.data?.template??``})]}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(te,{onClick:F,disabled:!I||n.isPending||r.isPending,isRunning:n.isPending||r.isPending})}),(0,w.jsx)(ne,{visible:n.data!==void 0&&r.data!==void 0}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(R,{paneId:`A`,userMessage:M,mutation:n,otherResult:r.data?.response,validation:b}),(0,w.jsx)(R,{paneId:`B`,userMessage:M,mutation:r,otherResult:n.data?.response,validation:D})]})]})})}function O(e){let t={...k(`tier1_size`,e.tier1),...k(`tier2_size`,e.tier2),...k(`batch_size`,e.batch)};return Object.keys(t).length===0?void 0:t}function k(e,n){let r=n.trim();if(r===``)return{};if(r===`null`)return{[e]:null};let i=Number(r);if(!Number.isInteger(i)||i<1)throw Error(t(`chat:memoryRouterPlaygroundPage.overrideMustBePositiveInteger`,{fieldName:e,value:r}));return{[e]:i}}function A(){let{t:e}=a(`chat`);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`h1`,{className:`text-body-large-default`,style:{color:`var(--content-default)`},children:e(`memoryRouterPlaygroundPage.title`)}),(0,w.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:(0,w.jsx)(r,{ns:`chat`,i18nKey:`memoryRouterPlaygroundPage.description`,components:{code:(0,w.jsx)(`code`,{})}})})]})}function j({nowText:e,onNowTextChange:t,onReloadNowText:n,nowTextLoading:r,pairs:i,onPairsChange:o}){let{t:s}=a(`chat`),c=(e,t)=>{o(i.map((n,r)=>r===e?{...n,...t}:n))},u=()=>{o([{assistantMessage:``,userMessage:``},...i])},d=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:s(`memoryRouterPlaygroundPage.conversationalContextTitle`)}),(0,w.jsx)(M,{id:`memory-router-playground-now`,label:s(`memoryRouterPlaygroundPage.nowBlockLabel`),value:e,onChange:t,rows:6,monospace:!0,placeholder:s(r?`memoryRouterPlaygroundPage.nowLoadingPlaceholder`:`memoryRouterPlaygroundPage.nowDefaultPlaceholder`),trailing:(0,w.jsx)(`button`,{type:`button`,onClick:n,disabled:r,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r?`not-allowed`:`pointer`},children:s(`memoryRouterPlaygroundPage.reloadNowButton`)})}),(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:s(`memoryRouterPlaygroundPage.recentPairsLabel`)}),(0,w.jsx)(`button`,{type:`button`,onClick:u,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:`pointer`},children:s(`memoryRouterPlaygroundPage.addOlderPairButton`)})]}),i.map((e,t)=>{let n=t===i.length-1;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-md border p-3`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`},children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsxs)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:[s(`memoryRouterPlaygroundPage.pairLabel`,{index:t+1,total:i.length}),n?s(`memoryRouterPlaygroundPage.pairMostRecentSuffix`):``]}),!n&&(0,w.jsx)(`button`,{type:`button`,onClick:()=>d(t),className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`transparent`,color:`var(--system-negative-strong)`,border:`none`,cursor:`pointer`},children:s(`memoryRouterPlaygroundPage.removeButton`)})]}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-assistant`,label:s(`memoryRouterPlaygroundPage.assistantReplyLabel`),value:e.assistantMessage,onChange:e=>c(t,{assistantMessage:e}),rows:3,placeholder:t===0&&i.length===1?s(`memoryRouterPlaygroundPage.firstTurnAssistantPlaceholder`):s(`memoryRouterPlaygroundPage.assistantReplyPlaceholder`)}),(0,w.jsx)(M,{id:`memory-router-playground-pair-${t}-user`,label:s(n?`memoryRouterPlaygroundPage.justArrivedUserLabel`:`memoryRouterPlaygroundPage.userMessageLabel`),value:e.userMessage,onChange:e=>c(t,{userMessage:e}),rows:3,placeholder:s(n?`memoryRouterPlaygroundPage.lastUserPlaceholder`:`memoryRouterPlaygroundPage.userMessagePlaceholder`),required:n})]},t)})]})})}function M({id:e,label:t,value:n,onChange:r,rows:i,placeholder:a,monospace:o,trailing:s,required:c}){return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`label`,{htmlFor:e,className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:[t,c?` *`:``]}),s]}),(0,w.jsx)(`textarea`,{id:e,value:n,onChange:e=>r(e.target.value),rows:i,placeholder:a,className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,resize:`vertical`,...o?{fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`}:{}}})]})}function N({paneId:e,overrides:t,onChange:n,onRun:r,canRun:i,isRunning:o,profiles:s,activeProfile:c,defaultPromptTemplate:u}){let{t:d}=a(`chat`);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-4 p-4`,children:[(0,w.jsx)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:d(`memoryRouterPlaygroundPage.configTitle`,{paneId:e})}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,w.jsx)(I,{paneId:e,label:`tier1_size`,value:t.tier1,onChange:e=>n({...t,tier1:e})}),(0,w.jsx)(I,{paneId:e,label:`tier2_size`,value:t.tier2,onChange:e=>n({...t,tier2:e})}),(0,w.jsx)(I,{paneId:e,label:`batch_size`,value:t.batch,onChange:e=>n({...t,batch:e})})]}),(0,w.jsx)(F,{paneId:e,value:t.profile,onChange:e=>n({...t,profile:e}),profiles:s,activeProfile:c}),(0,w.jsx)(P,{paneId:e,value:t.customPrompt,onChange:e=>n({...t,customPrompt:e}),defaultTemplate:u}),(0,w.jsx)(`div`,{className:`flex justify-end`,children:(0,w.jsx)(`button`,{type:`button`,onClick:r,disabled:!i,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:i?`var(--system-positive-strong)`:`var(--surface-overlay)`,color:i?`var(--content-on-positive)`:`var(--content-disabled)`,border:`none`,cursor:i?`pointer`:`not-allowed`},children:o?d(`memoryRouterPlaygroundPage.running`):d(`memoryRouterPlaygroundPage.runPane`,{paneId:e})})})]})})}function P({paneId:e,value:t,onChange:n,defaultTemplate:r}){let{t:i}=a(`chat`),[o,s]=(0,_.useState)(!1),c=`memory-router-playground-${e}-prompt`,l=t.trim().length>0;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>s(e=>!e),className:`text-label-medium-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[o?`▾`:`▸`,` `,i(`memoryRouterPlaygroundPage.systemPrompt`),` `,(0,w.jsxs)(`span`,{style:{color:`var(--content-tertiary)`},children:[`(`,i(l?`memoryRouterPlaygroundPage.promptModeCustom`:`memoryRouterPlaygroundPage.promptModeBundled`),`)`]})]}),o&&(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(r),disabled:r.length===0,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:r.length===0?`not-allowed`:`pointer`},children:i(`memoryRouterPlaygroundPage.loadDefault`)}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>n(``),disabled:!l,className:`rounded px-2 py-1 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`,border:`none`,cursor:l?`pointer`:`not-allowed`},children:i(`memoryRouterPlaygroundPage.reset`)})]})]}),o&&(0,w.jsx)(`textarea`,{id:c,value:t,onChange:e=>n(e.target.value),rows:12,placeholder:i(`memoryRouterPlaygroundPage.customPromptPlaceholder`),className:`rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,resize:`vertical`,minHeight:`120px`}})]})}function F({paneId:e,value:t,onChange:n,profiles:r,activeProfile:i}){let{t:o}=a(`chat`),s=`memory-router-playground-${e}-profile`,c=i!==null&&i.length>0?o(`memoryRouterPlaygroundPage.inheritActiveWithProfile`,{profile:i}):o(`memoryRouterPlaygroundPage.inheritActive`);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:s,className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:o(`memoryRouterPlaygroundPage.llmProfilesOverride`)}),(0,w.jsxs)(`select`,{id:s,value:t,onChange:e=>n(e.target.value),className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`},children:[(0,w.jsx)(`option`,{value:``,children:c}),r.map(e=>(0,w.jsx)(`option`,{value:e,children:e},e))]})]})}function I({paneId:e,label:t,value:n,onChange:r}){let{t:i}=a(`chat`),o=`memory-router-playground-${e}-${t}`;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`label`,{htmlFor:o,className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:t}),(0,w.jsx)(`input`,{id:o,value:n,onChange:e=>r(e.target.value),placeholder:i(`memoryRouterPlaygroundPage.inheritPlaceholder`),className:`rounded-md border px-3 py-2 text-body-medium-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`}})]})}function te({onClick:e,disabled:t,isRunning:n}){let{t:r}=a(`chat`);return(0,w.jsx)(`button`,{type:`button`,onClick:e,disabled:t,className:`rounded-md px-4 py-2 text-body-medium-default transition-colors`,style:{background:t?`var(--surface-overlay)`:`var(--primary-base)`,color:t?`var(--content-disabled)`:`var(--content-on-primary)`,border:`none`,cursor:t?`not-allowed`:`pointer`},children:r(n?`memoryRouterPlaygroundPage.running`:`memoryRouterPlaygroundPage.runBoth`)})}function ne({visible:e}){let{t}=a(`chat`);return e?(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4 rounded-md px-4 py-2 text-label-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--content-secondary)`},children:[(0,w.jsx)(L,{marker:`●`,markerColor:`var(--content-default)`,label:t(`memoryRouterPlaygroundPage.legendInBoth`)}),(0,w.jsx)(L,{marker:`◆`,markerColor:X(`A`),label:t(`memoryRouterPlaygroundPage.legendAOnly`)}),(0,w.jsx)(L,{marker:`◇`,markerColor:X(`B`),label:t(`memoryRouterPlaygroundPage.legendBOnly`)})]}):null}function L({marker:e,markerColor:t,label:n}){return(0,w.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(`span`,{style:{color:t},children:e}),(0,w.jsx)(`span`,{children:n})]})}function R({paneId:e,userMessage:t,mutation:n,otherResult:r,validation:i}){let{t:o}=a(`chat`),s=n.data;return(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(V,{paneId:e}),i!==null&&(0,w.jsx)(Q,{message:i}),n.isError&&(0,w.jsx)(Q,{message:n.error instanceof Error?n.error.message:o(`memoryRouterPlaygroundPage.failedToRunSimulation`)}),s!==void 0&&(0,w.jsxs)(w.Fragment,{children:[(0,w.jsx)(H,{paneId:e,userMessage:t,result:s.response,otherResult:r}),(0,w.jsx)(z,{paneId:e,rawRequest:s.rawRequest,rawResponse:s.rawResponse})]})]})}function z({paneId:e,rawRequest:t,rawResponse:n}){let{t:r}=a(`chat`),[i,o]=(0,_.useState)(!1);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>o(e=>!e),className:`text-label-medium-default`,style:{color:`var(--content-secondary)`,background:`transparent`,border:`none`,padding:0,cursor:`pointer`,textAlign:`left`},children:[i?`▾`:`▸`,` `,r(`memoryRouterPlaygroundPage.rawApiExchange`)]}),i&&(0,w.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,w.jsx)(B,{label:r(`memoryRouterPlaygroundPage.requestLabel`,{paneId:e}),body:t}),(0,w.jsx)(B,{label:r(`memoryRouterPlaygroundPage.responseLabel`,{paneId:e}),body:n})]})]})})}function B({label:e,body:t}){let{t:n}=a(`chat`);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,w.jsx)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`pre`,{className:`overflow-auto rounded-md border px-3 py-2 text-body-small-default`,style:{borderColor:`var(--border-base)`,background:`var(--surface-base)`,color:`var(--content-default)`,fontFamily:`ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace`,maxHeight:`320px`,whiteSpace:`pre`},children:t.length===0?n(`memoryRouterPlaygroundPage.empty`):t})]})}function V({paneId:e}){let{t}=a(`chat`);return(0,w.jsx)(`div`,{className:`text-body-medium-default`,style:{color:X(e)},children:t(`memoryRouterPlaygroundPage.paneTitle`,{paneId:e})})}function H({paneId:e,userMessage:t,result:n,otherResult:r}){let{t:i}=a(`chat`),o=(0,_.useMemo)(()=>U(n,r),[n,r]),s=(0,_.useMemo)(()=>q(n),[n]);return(0,w.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,w.jsx)(G,{result:n,userMessage:t,otherResult:r,counts:(0,_.useMemo)(()=>W(o),[o])}),(0,w.jsx)(K,{result:n}),n.failureReason!==null&&(0,w.jsx)(Q,{message:i(`memoryRouterPlaygroundPage.routerFailure`,{reason:n.failureReason})}),s.length===0?(0,w.jsx)(ae,{}):s.map(t=>(0,w.jsx)(ie,{paneId:e,source:t.source,slugs:t.slugs,scores:n.scores,diff:o},t.source))]})}function U(e,t){let n=new Map;if(t===void 0){for(let t of e.selectedSlugs)n.set(t,`both`);return n}let r=new Set(t.selectedSlugs);for(let t of e.selectedSlugs)n.set(t,r.has(t)?`both`:`only-here`);return n}function W(e){let t=0,n=0;for(let r of e.values())r===`both`?t++:n++;return{total:e.size,shared:t,unique:n}}function G({result:e,userMessage:t,otherResult:n,counts:r}){let{t:i}=a(`chat`),o=[{label:i(`memoryRouterPlaygroundPage.summaryUserMessageLabel`),value:t},{label:i(`memoryRouterPlaygroundPage.totalCandidatePagesLabel`),value:e.totalCandidatePages.toLocaleString()},{label:i(`memoryRouterPlaygroundPage.selectedLabel`),value:i(`memoryRouterPlaygroundPage.selectedValue`,{count:e.selectedSlugs.length,maxPageIds:e.effectiveConfig.max_page_ids})}];return n!==void 0&&o.push({label:i(`memoryRouterPlaygroundPage.diffLabel`),value:i(`memoryRouterPlaygroundPage.diffValue`,{shared:r.shared,unique:r.unique})}),(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:i(`memoryRouterPlaygroundPage.summary`)}),(0,w.jsx)(Z,{rows:o})]})})}function K({result:e}){let{t}=a(`chat`),n=[`tier1_size`,`tier2_size`,`batch_size`,`max_page_ids`].map(n=>{let r=e.effectiveConfig[n],i=e.overrides[n];return{label:n,value:`${r===null?t(`memoryRouterPlaygroundPage.nullValue`):String(r)}${i===void 0?``:t(`memoryRouterPlaygroundPage.overrideSuffix`)}`}});return n.push({label:t(`memoryRouterPlaygroundPage.llmProfilesOverride`),value:e.profileOverride===null?t(`memoryRouterPlaygroundPage.inheritActive`):`${e.profileOverride}${t(`memoryRouterPlaygroundPage.overrideSuffix`)}`}),n.push({label:t(`memoryRouterPlaygroundPage.systemPromptConfigLabel`),value:e.routerPromptOverridden?t(`memoryRouterPlaygroundPage.promptModeCustom`):t(`memoryRouterPlaygroundPage.promptModeBundled`)}),(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:t(`memoryRouterPlaygroundPage.effectiveConfig`)}),(0,w.jsx)(Z,{rows:n})]})})}function q(e){let t=new Map;for(let n of e.selectedSlugs){let r=e.sourceBySlug[n];if(r===void 0)continue;let i=t.get(r)??[];i.push(n),t.set(r,i)}return[...t.keys()].sort((e,t)=>J(e)-J(t)).map(e=>({source:e,slugs:t.get(e)}))}function J(e){return e===`tier1`?0:e===`tier2`?1:e.startsWith(`tier3:`)?2+Number(e.slice(6)):2**53-1}function Y(e,t){return e===`tier1`?t(`memoryRouterPlaygroundPage.tier1Label`):e===`tier2`?t(`memoryRouterPlaygroundPage.tier2Label`):e.startsWith(`tier3:`)?t(`memoryRouterPlaygroundPage.tier3Label`,{batch:e.slice(6)}):e}function X(e){return e===`A`?`var(--system-mid-strong)`:`var(--primary-base)`}function re(e,t){return t===`both`?{color:`var(--content-default)`,marker:`●`}:{color:X(e),marker:e===`A`?`◆`:`◇`}}function ie({paneId:e,source:t,slugs:n,scores:r,diff:i}){let{t:o}=a(`chat`);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-3 p-4`,children:[(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:Y(t,o)}),(0,w.jsx)(`span`,{className:`text-label-medium-default`,style:{color:`var(--content-secondary)`},children:o(`memoryRouterPlaygroundPage.pageCount`,{count:n.length})})]}),(0,w.jsx)(`ul`,{className:`flex flex-col gap-1`,children:n.map(n=>{let{color:a,marker:s}=re(e,i.get(n)??`only-here`);return(0,w.jsxs)(`li`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,w.jsx)(`span`,{style:{color:a},children:s}),(0,w.jsx)(`code`,{className:`text-body-medium-default`,style:{color:a},children:n})]}),t===`tier2`&&(0,w.jsx)(`span`,{className:`tabular-nums text-label-medium-default`,style:{color:`var(--content-secondary)`},children:o(`memoryRouterPlaygroundPage.emaScore`,{score:(r[n]??0).toFixed(3)})})]},n)})})]})})}function ae(){let{t:e}=a(`chat`);return(0,w.jsx)(l,{children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-2 p-4`,children:[(0,w.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e(`memoryRouterPlaygroundPage.noPagesSelected`)}),(0,w.jsx)(`span`,{className:`text-body-small-lighter`,style:{color:`var(--content-secondary)`},children:e(`memoryRouterPlaygroundPage.emptySelectionHint`)})]})})}function Z({rows:e}){return(0,w.jsx)(`div`,{className:`flex flex-col gap-2`,children:e.map(({label:e,value:t})=>(0,w.jsxs)(`div`,{className:`flex items-baseline justify-between gap-3`,children:[(0,w.jsx)(`span`,{className:`shrink-0 text-label-medium-default`,style:{color:`var(--content-secondary)`},children:e}),(0,w.jsx)(`span`,{className:`text-right text-body-medium-lighter`,style:{color:`var(--content-default)`},children:t})]},e))})}function Q({message:e}){return(0,w.jsx)(`div`,{className:`rounded-md px-4 py-3 text-body-medium-default`,style:{background:`var(--surface-overlay)`,color:`var(--system-negative-strong)`},children:e})}function $({children:e}){return(0,w.jsx)(`div`,{className:`flex h-full w-full items-center justify-center p-8 text-label-medium-default`,style:{color:`var(--content-tertiary)`},children:e})}export{T as MemoryRouterPlaygroundPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-CYfJo8gP.js";import{t}from"./react-DPM_L_aA.js";import{bt as n}from"./icons-CSdHOix6.js";import{Ey as r,_ as i,yt as a}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-CYfJo8gP.js";import{t}from"./react-DPM_L_aA.js";import{bt as n}from"./icons-CSdHOix6.js";import{Ey as r,_ as i,yt as a}from"./index-b_IQShc9.js";import{t as o}from"./use-transcript-message-by-id-BAc4xz_C.js";var s=[];function c(e){let t=o(e);return t?t.attachments??s:null}var l=t();function u({payload:t,onClose:o}){let{t:s}=e(`chat`),{displayAttachments:u,renderSquare:d,previewModal:f}=a({attachments:c(t.messageId)??t.attachments,assistantId:t.assistantId});return(0,l.jsxs)(i,{Glyph:n,titleNode:(0,l.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5 py-0.5`,children:[(0,l.jsx)(r,{variant:`title-medium`,className:`min-w-0 shrink truncate leading-snug text-[var(--content-default)]`,children:s(`messageFilesPanel.title`)}),(0,l.jsx)(`span`,{"aria-hidden":!0,className:`size-[3px] shrink-0 rounded-full bg-[var(--content-tertiary)]`}),(0,l.jsx)(r,{variant:`title-medium`,className:`shrink-0 whitespace-nowrap leading-snug text-[var(--content-secondary)]`,children:u.length})]}),closeLabel:s(`messageFilesPanel.closeAria`),onClose:o,children:[u.length===0?(0,l.jsx)(r,{variant:`body-small-default`,className:`py-4 text-center text-[var(--content-tertiary)]`,children:s(`messageFilesPanel.empty`)}):(0,l.jsx)(`div`,{className:`flex flex-wrap items-start gap-3`,children:u.map((e,t)=>d(e,t))}),f]})}export{u as MessageFilesPanel};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{f as t}from"./vendor-CYfJo8gP.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{xi as i}from"./icons-CSdHOix6.js";import{Ey as a}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{f as t}from"./vendor-CYfJo8gP.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{xi as i}from"./icons-CSdHOix6.js";import{Ey as a}from"./index-b_IQShc9.js";var o=i(`arrow-up-from-line`,[[`path`,{d:`m18 9-6-6-6 6`,key:`kcunyi`}],[`path`,{d:`M12 3v14`,key:`7cf3v8`}],[`path`,{d:`M5 21h14`,key:`11awu3`}]]),s=e(n(),1),c=r();function l(e){if(e>=1e6){let t=e/1e6;return`${t%1==0?t.toFixed(0):t.toFixed(1)}M`}if(e>=1e3){let t=e/1e3;return`${t%1==0?t.toFixed(0):t.toFixed(1)}K`}return e.toLocaleString()}function u(e){let n=t(),[r,i]=(0,s.useState)(e),a=(0,s.useRef)(e),o=(0,s.useRef)(e),c=(0,s.useRef)(0);return(0,s.useEffect)(()=>{if(o.current=e,n){cancelAnimationFrame(c.current),c.current=0,a.current=e,i(e);return}if(a.current===e||c.current)return;let t=performance.now(),r=a.current,s=e=>{let n=o.current,l=Math.min((e-t)/300,1),u=1-(1-l)**3;a.current=l>=1?n:r+(n-r)*u,i(a.current),l<1?c.current=requestAnimationFrame(s):c.current=0};c.current=requestAnimationFrame(s)},[e,n]),(0,s.useEffect)(()=>()=>cancelAnimationFrame(c.current),[]),r}function d({icon:e,value:t,label:n}){return(0,c.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] px-3 py-3`,children:[(0,c.jsx)(`div`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:e}),(0,c.jsxs)(`div`,{className:`min-w-0`,children:[(0,c.jsx)(a,{variant:`title-small`,className:`block text-[var(--content-default)]`,children:t}),(0,c.jsx)(a,{variant:`body-small-default`,className:`block text-[var(--content-secondary)]`,children:n})]})]})}function f({icon:e,label:t,target:n,format:r}){return(0,c.jsx)(d,{icon:e,label:t,value:r(u(n))})}export{l as n,o as r,f as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{E as t,j as n,k as r}from"./vendor-CYfJo8gP.js";import{b as i,r as a,t as o}from"./react-DPM_L_aA.js";import{qn as s,xi as c}from"./icons-CSdHOix6.js";import{Dy as l,Ep as u,Ty as d,Vl as f,dv as p,vo as m,xy as h,yo as g,yp as _,yv as v}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{E as t,j as n,k as r}from"./vendor-CYfJo8gP.js";import{b as i,r as a,t as o}from"./react-DPM_L_aA.js";import{qn as s,xi as c}from"./icons-CSdHOix6.js";import{Dy as l,Ep as u,Ty as d,Vl as f,dv as p,vo as m,xy as h,yo as g,yp as _,yv as v}from"./index-b_IQShc9.js";var y=c(`bell-ring`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M22 8c0-2.3-.8-4.3-2-6`,key:`5bb3ad`}],[`path`,{d:`M3.262 15.326A1 1 0 0 0 4 17h16a1 1 0 0 0 .74-1.673C19.41 13.956 18 12.499 18 8A6 6 0 0 0 6 8c0 4.499-1.411 5.956-2.738 7.326`,key:`11g9vi`}],[`path`,{d:`M4 2C2.8 3.7 2 5.7 2 8`,key:`tap9e0`}]]),b=e(i(),1),x=r(`AndroidNotificationSettings`);function S(){return _()&&t.isPluginAvailable(`AndroidNotificationSettings`)}async function C(){if(S())try{await x.open()}catch(e){v(e,{context:`android_notification_settings_open`,level:`warning`})}}var w=o();function T(){let{t:e}=n(`settings`),t=S(),[r,i]=(0,b.useState)(null);(0,b.useEffect)(()=>{m().then(i)},[]),f(`app.resume`,({signal:e})=>{e!==`online`&&g().then(i)});let a;switch(r){case`granted`:a={description:e(`androidNotificationSettingsCard.grantedDescription`),label:e(`androidNotificationSettingsCard.grantedLabel`),tone:`positive`};break;case`denied`:a={description:e(`androidNotificationSettingsCard.deniedDescription`),label:e(`androidNotificationSettingsCard.deniedLabel`),tone:`negative`};break;case`prompt`:a={description:e(`androidNotificationSettingsCard.promptDescription`),label:e(`androidNotificationSettingsCard.promptLabel`),tone:`warning`};break;case`unsupported`:a={description:e(`androidNotificationSettingsCard.unsupportedDescription`),label:e(`androidNotificationSettingsCard.unsupportedLabel`),tone:`neutral`};break;default:a={description:e(`androidNotificationSettingsCard.checkingDescription`),label:e(`androidNotificationSettingsCard.checkingLabel`),tone:`neutral`};break}return(0,w.jsx)(d,{padding:`lg`,children:(0,w.jsxs)(`div`,{className:`flex flex-col gap-5 sm:flex-row sm:items-center sm:justify-between`,children:[(0,w.jsxs)(`div`,{className:`flex min-w-0 items-start gap-4`,children:[(0,w.jsx)(`span`,{className:`flex size-11 shrink-0 items-center justify-center rounded-xl bg-[var(--surface-base)] text-[var(--content-secondary)]`,children:(0,w.jsx)(y,{className:`size-5`,"aria-hidden":!0})}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,w.jsx)(`h2`,{className:`text-title-small text-[var(--content-default)]`,children:e(`androidNotificationSettingsCard.title`)}),(0,w.jsx)(h,{tone:a.tone,children:a.label})]}),(0,w.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-secondary)]`,children:a.description})]})]}),t&&(0,w.jsx)(l,{variant:`outlined`,onClick:()=>void C(),disabled:r===null,rightIcon:(0,w.jsx)(s,{"aria-hidden":!0}),className:`self-start sm:self-auto`,children:e(`androidNotificationSettingsCard.openSettings`)})]})})}function E(){let{t:e}=n(`settings`);return u()?(0,w.jsxs)(`div`,{className:`mx-auto w-full max-w-2xl space-y-6`,children:[(0,w.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,w.jsx)(`span`,{className:`flex size-10 shrink-0 items-center justify-center rounded-xl bg-[var(--surface-lift)] text-[var(--content-secondary)]`,children:(0,w.jsx)(y,{className:`size-5`,"aria-hidden":!0})}),(0,w.jsxs)(`div`,{className:`min-w-0`,children:[(0,w.jsx)(`h1`,{className:`text-title-medium text-[var(--content-emphasised)]`,children:e(`notificationsPage.title`)}),(0,w.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-secondary)]`,children:e(`notificationsPage.description`)})]})]}),(0,w.jsx)(T,{})]}):(0,w.jsx)(a,{replace:!0,to:p.settings.general})}export{E as NotificationsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Dr as a}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Dr as a}from"./index-b_IQShc9.js";var o=e(n(),1),s=i();function c(){return(0,s.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,s.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,s.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function l(){return(0,s.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,s.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,s.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,s.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var u=`
|
|
2
2
|
:root {
|
|
3
3
|
--oauth-surface: #F5F3EB;
|
|
4
4
|
--oauth-surface-card: #FFFFFF;
|
package/dist/assets/{oauth-popup-complete-page-BDfhFWci.js → oauth-popup-complete-page-DR-OaEn7.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Dr as a,_g as o,vg as s}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Dr as a,_g as o,vg as s}from"./index-b_IQShc9.js";var c=e(n(),1),l=i();function u(){return(0,l.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,l.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function d(){return(0,l.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,l.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,l.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,l.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var f=`
|
|
2
2
|
:root {
|
|
3
3
|
--oauth-surface: #F5F3EB;
|
|
4
4
|
--oauth-surface-card: #FFFFFF;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{b as t,t as n}from"./react-DPM_L_aA.js";import{Ay as r,Za as i}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{b as t,t as n}from"./react-DPM_L_aA.js";import{Ay as r,Za as i}from"./index-b_IQShc9.js";var a=e(t(),1),o=n(),s=`var(--surface-overlay)`;function c({children:e,className:t,style:n,bleed:c=!0}){let l=i.use.setSurface(),u=n?.backgroundColor??s;return(0,a.useLayoutEffect)(()=>{if(c)return l(typeof u==`string`?u:s),()=>{l(null)}},[c,u,l]),(0,o.jsx)(`div`,{className:r(`flex min-h-0 flex-1 flex-col rounded-lg border border-[var(--border-base)] bg-[var(--surface-overlay)] px-6 py-5`,c&&`native-mobile:rounded-none native-mobile:border-0`,t),style:n,children:e})}export{c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,d as r,f as i,t as a}from"./react-DPM_L_aA.js";import{Fr as o,L as s,jr as c,tn as l}from"./icons-CSdHOix6.js";import{C_ as u,Dy as d,Gp as f,Jp as p,Kp as m,Lv as h,S_ as g,Xp as _,_p as v,cg as y,dv as b,gp as x,k_ as S,qp as C,t as w,zg as T}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,d as r,f as i,t as a}from"./react-DPM_L_aA.js";import{Fr as o,L as s,jr as c,tn as l}from"./icons-CSdHOix6.js";import{C_ as u,Dy as d,Gp as f,Jp as p,Kp as m,Lv as h,S_ as g,Xp as _,_p as v,cg as y,dv as b,gp as x,k_ as S,qp as C,t as w,zg as T}from"./index-b_IQShc9.js";import{r as E}from"./self-hosted-servers-CE0-6fMf.js";var D=e(n(),1),O=a();function k(e){switch(e.kind){case`starting`:return{title:`Starting pairing`,body:`Creating a code for this browser.`};case`handoff_choice`:return{title:`Open in the Vellum app`,body:`Scanning from a phone with the Vellum app installed? Hand this pairing to the app.`};case`verifying`:return{title:`Pairing`,body:`Connecting this device to your assistant.`};case`approved`:return{title:`Connected`,body:`Opening your assistant.`};case`expired`:return{title:`Pairing expired`,body:`This pairing code is invalid or expired. Run vellum pair on the machine running your assistant to get a new one.`};case`error`:return{title:`Pairing failed`,body:e.message};case`polling`:return{title:`Waiting for approval`,body:`Confirm this code on the machine running your assistant.`}}}function A({state:e}){return e.kind===`approved`?(0,O.jsx)(c,{className:`h-5 w-5 text-[var(--system-positive-strong)]`,"aria-hidden":!0}):e.kind===`handoff_choice`?(0,O.jsx)(s,{className:`h-5 w-5 text-[var(--system-info-strong)]`,"aria-hidden":!0}):e.kind===`starting`||e.kind===`verifying`||e.kind===`polling`?(0,O.jsx)(l,{className:`h-5 w-5 animate-spin text-[var(--system-info-strong)]`,"aria-hidden":!0}):(0,O.jsx)(o,{className:`h-5 w-5 text-[var(--system-negative-strong)]`,"aria-hidden":!0})}function j(){try{let e=new URL(window.location.href);for(let t of[`deviceCode`,`device_code`,`userCode`,`user_code`])e.searchParams.delete(t);e.hash=``,window.history.replaceState(null,``,`${e.pathname}${e.search}`)}catch{}}var M=`vellum-assistant`,N=`ai.vellum.assistant`;function P(e,t){let n=new URLSearchParams({url:_(),code:e}),r=g();r&&n.set(`name`,r);let i=n.toString().replace(/\+/g,`%20`);return t===`ios`?`${M}://connect?${i}`:`intent://connect?${i}#Intent;scheme=${M};package=${N};S.browser_fallback_url=${encodeURIComponent(window.location.href)};end`}function F(){let e=u();if(!e)return null;try{return`${new URL(e).origin}${b.selectAssistant}?noAutoSkip=1`}catch{return null}}function I({deviceCode:e,platform:n,onContinueInBrowser:r}){let{t:i}=t(`remote-web`);return(0,O.jsxs)(`div`,{className:`mt-6 flex flex-col gap-3`,children:[(0,O.jsx)(d,{variant:`primary`,fullWidth:!0,asChild:!0,children:(0,O.jsx)(`a`,{href:(0,D.useMemo)(()=>P(e,n),[e,n]),children:i(`pairingPage.openInApp`)})}),(0,O.jsx)(d,{variant:`outlined`,fullWidth:!0,onClick:r,children:i(`pairingPage.continueInBrowser`)})]})}function L(){let{t:e}=t(`remote-web`),n=r(),a=i(),o=S(),s=(0,D.useMemo)(()=>T(new URLSearchParams(n.search).get(`returnTo`),b.assistant),[n.search]),c=(0,D.useMemo)(()=>h(`${n.pathname}${n.search}${n.hash}`),[n.pathname,n.search,n.hash]),l=(0,D.useMemo)(()=>!c.deviceCode||y()?null:x()?`android`:v()?`ios`:null,[c.deviceCode]),[u,g]=(0,D.useState)(()=>c.deviceCode?{deviceCode:c.deviceCode,userCode:c.userCode}:null),[_,M]=(0,D.useState)(()=>!l),[N,P]=(0,D.useState)(()=>l?{kind:`handoff_choice`}:c.deviceCode?{kind:`verifying`}:{kind:`starting`});(0,D.useEffect)(()=>{if(!o||u)return;let e=new AbortController;return(async()=>{try{let t=await C(e.signal);g({deviceCode:t.deviceCode,userCode:t.userCode}),P({kind:`polling`,expiresAt:t.expiresAt})}catch{if(e.signal.aborted)return;P({kind:`error`,message:`The assistant could not start pairing. Refresh the page to try again.`})}})(),()=>{e.abort()}},[o,u]),(0,D.useEffect)(()=>{if(!o||!u?.deviceCode||!_)return;let e=new AbortController,t=null,n=async()=>{try{let r=await p(u.deviceCode,e.signal);if(r.status===`pending`){P({kind:`polling`,expiresAt:r.expiresAt||null}),t=setTimeout(()=>void n(),Math.max(1,r.intervalSeconds)*1e3);return}m(r),j(),P({kind:`approved`}),t=setTimeout(()=>a(s,{replace:!0}),250)}catch(t){if(e.signal.aborted)return;if(t instanceof f&&t.status===401){P({kind:`expired`});return}if(t instanceof f&&t.code===`GUARDIAN_REPAIR_REQUIRED`){P({kind:`error`,message:`The assistant's trust database needs repair. Run guardian repair on the machine hosting the assistant, then retry this same pairing link — the code stays valid.`});return}P({kind:`error`,message:`The assistant could not complete pairing. Try starting a new pairing.`})}};return n(),()=>{e.abort(),t&&clearTimeout(t)}},[o,u?.deviceCode,_,a,s]);let L=(0,D.useCallback)(()=>{M(!0),P({kind:`verifying`})},[]),R=(0,D.useMemo)(()=>F(),[]),z=(0,D.useCallback)(()=>{E(null,`select-assistant?noAutoSkip=1`).then(e=>{!e&&R&&window.location.assign(R)})},[R]);if(!o)return(0,O.jsx)(w,{});let B=k(N);return(0,O.jsx)(`main`,{className:`flex min-h-svh items-center justify-center bg-[var(--surface-base)] px-6 py-10 text-[var(--content-default)]`,children:(0,O.jsxs)(`section`,{className:`w-full max-w-md rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] p-8 shadow-[var(--shadow-sm)]`,children:[(0,O.jsxs)(`div`,{className:`mb-5 flex items-center gap-3`,children:[(0,O.jsx)(A,{state:N}),(0,O.jsx)(`h1`,{className:`text-title-medium text-[var(--content-emphasised)]`,children:B.title})]}),N.kind===`polling`&&u?.userCode?(0,O.jsxs)(`div`,{className:`mb-5 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-4 text-center`,children:[(0,O.jsx)(`div`,{className:`text-label-small-default uppercase tracking-wide text-[var(--content-tertiary)]`,children:e(`pairingPage.pairingCode`)}),(0,O.jsx)(`div`,{className:`mt-2 font-mono text-3xl font-semibold tracking-[0.18em] text-[var(--content-emphasised)]`,children:u.userCode})]}):null,(0,O.jsx)(`p`,{className:`text-body-medium-lighter leading-6 text-[var(--content-secondary)]`,children:B.body}),N.kind===`handoff_choice`&&u&&l?(0,O.jsx)(I,{deviceCode:u.deviceCode,platform:l,onContinueInBrowser:L}):null,N.kind===`polling`&&N.expiresAt?(0,O.jsx)(`p`,{className:`text-body-small-lighter mt-4 text-[var(--content-tertiary)]`,children:e(`pairingPage.expiresAt`,{time:new Date(N.expiresAt).toLocaleTimeString()})}):null,N.kind===`polling`&&R?(0,O.jsx)(d,{variant:`outlined`,fullWidth:!0,className:`mt-6`,onClick:z,children:e(`pairingPage.cancel`)}):null]})})}export{L as RemoteWebPairingPage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,t}from"./react-DPM_L_aA.js";import{dv as n}from"./index-b_IQShc9.js";var r=t();function i(){return(0,r.jsx)(e,{to:n.account.login,replace:!0})}export{i as PasswordResetPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-DPM_L_aA.js";import{t}from"./preview-error-
|
|
1
|
+
import{t as e}from"./react-DPM_L_aA.js";import{t}from"./preview-error-BLcNtS5K.js";import{In as n,Rn as r,on as i}from"./index-b_IQShc9.js";var a=e();function o({blob:e,filename:o}){let s=n(e,`application/pdf`);return s===null?(0,a.jsx)(r,{}):(0,a.jsx)(`span`,{className:`block w-full [&_[data-slot=skeleton]]:w-full! [&_canvas]:w-full!`,children:(0,a.jsx)(i,{url:s,errorFallback:(0,a.jsx)(t,{filename:o})})})}export{o as PdfFilePreview};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{I as t,Zn as n,dn as r,er as i,fn as a,j as o,ln as s}from"./vendor-CYfJo8gP.js";import{b as c,f as l,t as u}from"./react-DPM_L_aA.js";import{P as d,pi as f}from"./icons-CSdHOix6.js";import{Kf as p,Y as m,cy as h,dv as g}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{I as t,Zn as n,dn as r,er as i,fn as a,j as o,ln as s}from"./vendor-CYfJo8gP.js";import{b as c,f as l,t as u}from"./react-DPM_L_aA.js";import{P as d,pi as f}from"./icons-CSdHOix6.js";import{Kf as p,Y as m,cy as h,dv as g}from"./index-b_IQShc9.js";import{a as _,c as v,l as y,o as b,s as x}from"./latest-assistant-text-DAXhdhSY.js";import{a as S,c as C,i as w,n as T,o as E,r as D,t as O}from"./use-assistant-identity-details-BHiN3OAl.js";var k=e(c(),1),A=u(),j=`rgba(36, 41, 46, 0.25)`,M=`#FDFDFC`;function N({axis:e,value:t,onValueChange:n,tone:i,disabled:c}){let{t:l}=o(`intelligence`),u=l(e.leftKey),d=l(e.rightKey);return(0,A.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-x-5 gap-y-1.5 sm:flex-nowrap`,style:{opacity:c?.7:1},children:[(0,A.jsx)(`span`,{className:`order-1 flex-1 text-left text-sm sm:w-32 sm:flex-none sm:text-right sm:text-[17px]`,style:{color:i.fg},children:u}),(0,A.jsx)(`span`,{className:`order-2 flex-1 text-right text-sm sm:order-3 sm:w-32 sm:flex-none sm:text-left sm:text-[17px]`,style:{color:i.fg},children:d}),(0,A.jsxs)(s,{"data-owns-horizontal-drag":``,className:`relative order-3 flex h-6 w-full touch-none items-center select-none sm:order-2 sm:w-auto sm:flex-1`,value:[t],onValueChange:e=>n(e[0]??S),disabled:c,min:0,max:100,step:1,"aria-label":l(`personalitySliderRow.rangeAriaLabel`,{left:u,right:d}),children:[(0,A.jsx)(a,{className:`relative h-2 w-full grow rounded-full sm:h-3`,style:{backgroundColor:j}}),(0,A.jsx)(r,{className:`block h-5 w-5 cursor-grab rounded-full shadow-sm transition-transform active:scale-95 active:cursor-grabbing keyboard-focus:outline-none keyboard-focus:ring-2 keyboard-focus:ring-white/70 data-[disabled]:cursor-not-allowed data-[disabled]:active:scale-100 sm:h-6 sm:w-6`,style:{backgroundColor:M}})]})]})}async function P({assistantId:e,values:n,assistantName:r}){return D({assistantId:e,content:y(n,void 0,r),title:t(`applyPersonalityUpdate.conversationTitle`,{ns:`intelligence`}),context:`identity_personality_update`})}function F(){let{t:e}=o(`intelligence`),t=m(),r=l(),a=i(),{components:s,traits:c,customImageUrl:u}=p(t),d=T(t),f=n({queryKey:x(t),queryFn:()=>b(t)}),[y,S]=(0,k.useState)(null),[C,w]=(0,k.useState)(!1),D=y??f.data??{},j=d.data?.identity?.name||e(`identityOverview.defaultAssistantName`);return(0,A.jsx)(E,{components:s,traits:c,customImageUrl:u,entrance:!0,children:(0,A.jsx)(I,{assistantName:j,values:D,onValueChange:(e,t)=>S({...D,[e]:t}),applying:C,onUpdate:()=>{w(!0);let n=_(D);P({assistantId:t,values:n,assistantName:d.data?.identity?.name}).then(async i=>{w(!1),i?(await v(t,n),a.invalidateQueries({queryKey:x(t)}),a.invalidateQueries({queryKey:O(t)}),h.success(e(`personalityPage.updateSuccessToast`)),r(g.identity)):h.error(e(`personalityPage.updateErrorToast`))})},onBack:()=>void r(g.identity)})})}function I({assistantName:e,values:t,onValueChange:n,applying:r,onUpdate:i,onBack:a}){let{t:s}=o(`intelligence`),{tone:c,bottomReserve:l}=C();return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsxs)(`button`,{type:`button`,onClick:a,className:`absolute top-4 left-4 z-20 flex cursor-pointer items-center gap-1.5 rounded-full py-2 pr-4 pl-3 text-body-medium-default backdrop-blur-sm transition-all duration-150 active:scale-[0.97] ${c.isLight?`bg-black/10 hover:bg-black/20`:`bg-white/10 hover:bg-white/20`}`,style:{color:c.fg},children:[(0,A.jsx)(f,{className:`h-4 w-4`,"aria-hidden":!0}),s(`personalityPage.back`)]}),(0,A.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6`,style:{paddingBottom:l},children:[(0,A.jsx)(`div`,{className:`w-full min-h-14 shrink-[4]`,style:{flexBasis:`12%`}}),(0,A.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 text-center`,children:[(0,A.jsx)(`h1`,{className:`text-[2.6rem] leading-none max-sm:text-[2rem]`,style:{fontFamily:`var(--font-serif)`},children:s(`personalityPage.title`)}),(0,A.jsx)(`p`,{className:`max-w-md text-[15px]`,style:{color:c.fgMuted},children:s(`personalityPage.subtitle`)})]}),(0,A.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-10`}),(0,A.jsx)(`div`,{className:`flex w-full max-w-2xl shrink-0 flex-col`,children:w.map((e,i)=>(0,A.jsxs)(k.Fragment,{children:[i>0&&(0,A.jsx)(`div`,{className:`w-full min-h-2.5 shrink basis-8 sm:basis-11`}),(0,A.jsx)(N,{axis:e,value:t[e.id]??S,onValueChange:t=>n(e.id,t),tone:c,disabled:r})]},e.id))}),(0,A.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-12`}),(0,A.jsx)(`button`,{type:`button`,onClick:i,disabled:r,className:`flex min-h-11 min-w-[240px] max-w-full shrink-0 cursor-pointer items-center justify-center gap-2 rounded-[10px] px-6 py-2 text-body-medium-default transition-transform duration-150 active:scale-[0.97] disabled:cursor-default disabled:opacity-80 disabled:active:scale-100`,style:{backgroundColor:c.isLight?`#1A1A1A`:`#FFFFFF`,color:c.isLight?`#FFFFFF`:`#1A1A1A`},children:r?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(`div`,{className:`h-4 w-4 shrink-0 animate-spin rounded-full border-2 border-transparent`,style:{borderTopColor:c.isLight?`#FFFFFF`:`#1A1A1A`,borderRightColor:c.isLight?`#FFFFFF`:`#1A1A1A`}}),(0,A.jsx)(`span`,{className:`min-w-0 text-center`,children:s(`personalityPage.updatingPersonality`,{name:e})})]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0}),s(`personalityPage.updatePersonality`)]})})]})]})}export{F as PersonalityPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Jn as t,N as n,Zn as r,er as i,j as a}from"./vendor-CYfJo8gP.js";import{b as o,f as s,g as c,t as l}from"./react-DPM_L_aA.js";import{R as u,ar as d,jr as f,pi as p,tn as m,v as h,xn as g}from"./icons-CSdHOix6.js";import{A as _,C as v,D as y,F as b,H as x,M as S,N as C,O as w,P as T,R as E,T as ee,V as te,a as ne,d as re,g as ie,h as ae,i as oe,j as D,k as O,m as k,n as se,o as ce,p as le,r as ue,t as de,x as A,z as fe}from"./use-checkout-dismiss-refresh-BwscoYFU.js";import{Af as pe,Bf as me,Dy as j,Ep as he,Ey as M,Mf as N,Mr as P,Qc as ge,Qv as F,Tg as _e,Xc as ve,Yc as ye,Yf as be,Zc as xe,ag as Se,al as Ce,cy as I,dv as L,el as we,fv as Te,jf as Ee,ol as De,ov as Oe,rg as ke,rl as Ae,sl as je,uy as R,xy as z}from"./index-BVVp210p.js";import{t as Me}from"./android-billing-handoff-BJxquTxv.js";import{t as Ne}from"./checkout-return-target-DEiJUksg.js";import{i as Pe,r as Fe,s as Ie,t as B}from"./machine-sizes-CcBnk4Jk.js";var V=e(o(),1),Le=`__none__`,H=`__baseline__`,U=`${Pe[B]} machine (${Fe[B]})`;function Re(e){let{proPlan:t,seed:n,machineTier:r,storageTier:i,creditChoice:a,noBundleLabel:o}=e,s=t.machine_tiers,c=t.storage_tiers,l=t.credit_tiers??[],u=r===H,d=u?null:s.find(e=>e.tier===r)??null,f=u?U:d?.description??null,p=c.find(e=>e.tier===i)??null,m=a&&a!==`__none__`?l.find(e=>e.tier===a)??null:null,h=n!=null&&n.machineTier!=null?s.find(e=>e.tier===n.machineTier)??null:null,g=n==null?null:n.machineTier??`__baseline__`,_=n==null?void 0:n.machineTier==null?U:h?.description,v=n==null?null:c.find(e=>e.tier===n.storageTier)??null,y=n!=null&&n.creditTier!=null?l.find(e=>e.tier===n.creditTier)??null:null,b=n!=null&&n.machineTier!=null&&h==null,x=n!=null&&v==null,S=[{key:`base`,label:`Platform fee: ${O(t.base_price_cents)}`,changed:!1}];if(f!=null){let e=n!=null&&!b&&g!==r;S.push({key:`machine`,label:f,previousLabel:e?_:void 0,changed:e})}if(p!=null){let e=n!=null&&!x&&v?.tier!==p.tier;S.push({key:`storage`,label:D(p.storage_gib),previousLabel:e&&v!=null?D(v.storage_gib):void 0,changed:e})}let C=a===`__none__`?o:m==null?null:m.label;if(C!=null){let e=n!=null&&(n.creditTier??`__none__`)!==a,t=n?.creditTier==null?o:y?.label;S.push({key:`credit`,label:C,previousLabel:e?t:void 0,changed:e})}let w=t.base_price_cents+(d?.price_cents??0)+(p?.price_cents??0)+(m?.price_cents??0),T=b||x||n!=null&&n.creditTier!=null&&y==null;if(n==null||T)return{totalCents:w,previousTotalCents:null,deltaCents:null,rows:S};let E=t.base_price_cents+(h?.price_cents??0)+(v?.price_cents??0)+(y?.price_cents??0);return{totalCents:w,previousTotalCents:E,deltaCents:w-E,rows:S}}var ze=`https://www.vellum.ai/docs/pricing`,Be=`${ze}#machine-sizes`,Ve=`${ze}#storage`,He=`${ze}#credit-bundles`,W=l();function G(e){return(0,W.jsxs)(`span`,{className:`text-[12px] font-medium text-[var(--content-disabled)]`,children:[`+`,O(e)]})}function K({label:e,docsUrl:t,docsLabel:n,learnMore:r}){return(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:e}),(0,W.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"aria-label":n,onClick:e=>ke(e,t),className:`text-[11px] font-medium text-[var(--content-tertiary)] underline hover:text-[var(--content-default)]`,children:r})]})}function Ue({open:e,proPlan:t,pending:n,currentStorageGib:r,initialSelection:i,onClose:o,onContinue:s}){let{t:c}=a(`settings`),l=c(`customPlanModal.noExtraUsage`),p=e?i??null:null,[m,h]=(0,V.useState)(()=>p?p.machineTier??`__baseline__`:``),[_,v]=(0,V.useState)(()=>p?.storageTier??``),[b,S]=(0,V.useState)(()=>p?p.creditTier??`__none__`:``),[C,T]=(0,V.useState)({open:e,initialSelection:i});(C.open!==e||C.initialSelection!==i)&&(T({open:e,initialSelection:i}),h(p?p.machineTier??`__baseline__`:``),v(p?.storageTier??``),S(p?p.creditTier??`__none__`:``));let E=t.machine_tiers,ee=(0,V.useMemo)(()=>t.storage_tiers.filter(e=>!e.legacy||e.tier===i?.storageTier),[t.storage_tiers,i?.storageTier]),te=t.credit_tiers??[],ne=(0,V.useMemo)(()=>(t.credit_tiers??[]).filter(e=>!e.legacy),[t.credit_tiers]),re=e=>A(e)||e.legacy&&e.tier!==i?.storageTier||r!=null&&e.storage_gib<r,ie=i!=null&&i.machineTier==null,ae=[...ie?[{value:H,label:U,icon:(0,W.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),disabled:!0}]:[],...E.map(e=>({value:e.tier,label:e.description,icon:(0,W.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(e.price_cents),disabled:A(e)}))],oe=ee.map(e=>({value:e.tier,label:e.label,icon:(0,W.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(e.price_cents),disabled:re(e)})),D=b&&b!==`__none__`?te.find(e=>e.tier===b)??null:null,k=D?.legacy?D:null,se=[{value:Le,label:l,icon:(0,W.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0})},...ne.map(e=>({value:e.tier,label:e.label,icon:(0,W.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(e.price_cents)})),...k?[{value:k.tier,label:k.label,icon:(0,W.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(k.price_cents),disabled:!0}]:[]],ce=m===H,le=ce?null:E.find(e=>e.tier===m)??null,ue=ce?ie?{tier:null}:null:le==null?null:{tier:le.tier},de=_!==``&&_===i?.storageTier,fe=ee.find(e=>e.tier===_&&(de||!re(e)))??null,pe=b===`__none__`||b===i?.creditTier||ne.some(e=>e.tier===b),me=b!==``&&pe?b:null,he=ue!=null&&fe!=null&&me!=null,M=i!=null&&m===(i.machineTier??`__baseline__`)&&_===i.storageTier&&b===(i.creditTier??`__none__`),N=(0,V.useMemo)(()=>Re({proPlan:t,seed:i??null,machineTier:m,storageTier:_,creditChoice:b,noBundleLabel:l}),[t,i,m,_,b,l]);return(0,W.jsx)(R.Root,{open:e,onOpenChange:e=>{e||o()},children:(0,W.jsx)(R.Content,{size:`lg`,"data-theme":`light`,hideCloseButton:!0,overlayClassName:`backdrop-blur-[2px]`,className:`max-w-[820px] md:min-h-[min(608px,calc(100vh-4rem))]`,children:(0,W.jsx)(R.Body,{className:`p-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-8 md:flex-row md:gap-12`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6 md:flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--surface-active)] p-[14px]`,children:(0,W.jsx)(u,{className:`h-6 w-6 text-[var(--content-emphasised)]`,"aria-hidden":!0})}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsx)(R.Title,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.title`)}),(0,W.jsx)(R.Description,{className:`mt-0 text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:c(`customPlanModal.subtitle`)})]})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(K,{label:c(`customPlanModal.machineSizeLabel`),docsUrl:Be,docsLabel:c(`customPlanModal.machineSizeDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,W.jsx)(F,{"aria-label":c(`customPlanModal.machineSizeAriaLabel`),placeholder:c(`customPlanModal.machineSizePlaceholder`),value:m,onChange:h,options:ae})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(K,{label:c(`customPlanModal.storageLabel`),docsUrl:Ve,docsLabel:c(`customPlanModal.storageDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,W.jsx)(F,{"aria-label":c(`customPlanModal.storageAriaLabel`),placeholder:c(`customPlanModal.storagePlaceholder`),value:_,onChange:v,options:oe})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(K,{label:c(`customPlanModal.usageBundleLabel`),docsUrl:He,docsLabel:c(`customPlanModal.usageBundleDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,W.jsx)(F,{"aria-label":c(`customPlanModal.usageBundleAriaLabel`),placeholder:c(`customPlanModal.usageBundlePlaceholder`),value:b,onChange:S,options:se})]})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-16 md:pt-[5px]`,children:[(0,W.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.recap`)}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:O(N.totalCents)}),N.deltaCents!=null&&N.deltaCents!==0&&N.previousTotalCents!=null&&(0,W.jsx)(`span`,{className:`text-[12px] font-medium ${N.deltaCents>0?`text-[var(--system-positive-strong)]`:`text-[var(--system-negative-strong)]`}`,children:c(`customPlanModal.comparedToPrevious`,{delta:y(N.deltaCents),previous:w(N.previousTotalCents)})}),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.totalBilledMonthly`)})]}),(0,W.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.yourSelection`)}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,children:N.rows.map(e=>(0,W.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[e.previousLabel!=null&&(0,W.jsxs)(`div`,{className:`relative flex w-fit items-start gap-2`,children:[(0,W.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`,"aria-hidden":!0}),(0,W.jsx)(`s`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-disabled)] no-underline`,children:e.previousLabel}),(0,W.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute -left-1 right-0 top-[9px] h-px bg-[var(--content-disabled)]`})]}),(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 ${e.changed?`text-[var(--system-positive-strong)]`:`text-[var(--content-secondary)]`}`,"aria-hidden":!0}),(0,W.jsx)(`span`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-secondary)]`,children:e.label})]})]},e.key))}),(0,W.jsx)(j,{variant:`primary`,fullWidth:!0,disabled:!he||M||n,onClick:()=>{!he||M||n||s({machineTier:ue.tier,storageTier:fe.tier,creditTier:me===`__none__`?null:me})},children:c(`customPlanModal.continue`)}),(0,W.jsx)(j,{variant:`ghost`,fullWidth:!0,disabled:n,onClick:o,children:c(`customPlanModal.cancel`)})]})]})]})})})})}function We({className:e,onConfigure:t,configureDisabled:n,isCurrent:r=!1,currentSummary:i}){let{t:o}=a(`settings`);return(0,W.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-8 ${e??``}`,children:[(0,W.jsx)(`p`,{className:`text-center text-[20px] font-medium text-[var(--content-tertiary)]`,children:o(`customPlanRow.prompt`)}),(0,W.jsxs)(`div`,{className:`flex w-[840px] max-w-full flex-col items-start gap-4 rounded-2xl bg-[var(--surface-lift)] p-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--content-disabled)] p-[14px]`,children:(0,W.jsx)(u,{className:`h-6 w-6 text-[var(--aux-white)]`,"aria-hidden":!0})}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:o(`customPlanRow.title`)}),r?(0,W.jsx)(z,{className:`bg-[var(--feed-digest-weak)] text-[var(--content-default)]`,children:o(`customPlanRow.currentPlanTag`)}):null]}),(0,W.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-tertiary)]`,children:i??o(`customPlanRow.genericDescriptor`)})]})]}),(0,W.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:(0,W.jsx)(j,{variant:`outlined`,onClick:t,disabled:n,children:o(`customPlanRow.configure`)})})]})]})}function Ge({open:e,lostFeatures:t,viaPortal:n,pending:r,onCancel:i,onConfirm:o}){let{t:s}=a(`settings`),c=t.length>0;return(0,W.jsx)(R.Root,{open:e,onOpenChange:e=>{!e&&!r&&i()},children:(0,W.jsxs)(R.Content,{size:`md`,hideCloseButton:!0,children:[(0,W.jsx)(R.Header,{icon:h,children:(0,W.jsx)(R.Title,{children:s(`freeDowngradeConfirmModal.title`)})}),(0,W.jsxs)(R.Body,{children:[(0,W.jsx)(M,{as:`p`,variant:`body-medium-default`,className:`text-(--content-secondary)`,children:s(n?c?`freeDowngradeConfirmModal.bodyWithFeaturesPortal`:`freeDowngradeConfirmModal.bodyCancelOnlyPortal`:c?`freeDowngradeConfirmModal.bodyWithFeatures`:`freeDowngradeConfirmModal.bodyCancelOnly`)}),c?(0,W.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5`,children:t.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsx)(M,{as:`span`,variant:`body-medium-default`,children:e})},e))}):null]}),(0,W.jsxs)(R.Footer,{children:[(0,W.jsx)(j,{variant:`outlined`,onClick:i,disabled:r,children:s(`freeDowngradeConfirmModal.cancel`)}),(0,W.jsx)(j,{variant:`danger`,onClick:o,disabled:r,"data-testid":`confirm-free-downgrade-button`,children:s(`freeDowngradeConfirmModal.confirm`)})]})]})})}function Ke({tierKey:e,name:t,tagline:n,priceLabel:r,priceCaption:i,ctaLabel:o,features:s,recommended:c=!1,tone:l=`dark`,isCurrent:u,intent:d=`upgrade`,pending:p,onCta:m}){let{t:h}=a(`settings`),g=d===`downgrade`&&!u;return(0,W.jsxs)(`div`,{"data-theme":l,className:`flex w-full flex-col gap-3 rounded-2xl bg-[var(--surface-lift)] p-3 sm:gap-4 sm:p-4`,children:[(0,W.jsx)(C,{tier:e,size:50}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{className:`flex h-8 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[20px] font-medium text-[var(--content-emphasised)]`,children:t}),c&&!g&&!u?(0,W.jsx)(z,{className:`bg-[var(--feed-digest-weak)] text-[12px] font-semibold uppercase text-[var(--credits-accent)]`,children:h(`planColumnCard.recommended`)}):null]}),(0,W.jsx)(`p`,{className:`overflow-hidden text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)] sm:h-9`,children:n})]}),(0,W.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:r}),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:i})]}),(0,W.jsx)(j,{variant:g?`outlined`:`primary`,fullWidth:!0,disabled:u||p,onClick:m,children:u?h(`planColumnCard.currentPlan`):o}),(0,W.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 sm:gap-4`,children:[(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:h(`planColumnCard.includes`)}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,children:s.map(e=>(0,W.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,W.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-secondary)]`,children:e})]},e))})]})]})}function qe({enabled:e=!0}={}){let n=i(),a=be(),o=e&&a,s=r({...Ce(),enabled:o}),c=s.data,l=c!=null&&c.plan_id!==`base`,u=r({...Ae(),enabled:o&&l}),d=r({...ye(),enabled:o&&l}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],f=e=>d.find(t=>t.tier===e)?.price_cents??null,p=t(ge()),m=t(we()),h=t(xe()),g={machineTier:u.data?.max_machine_tier??null,storageTier:u.data?.selected_storage_tier??null,storageGib:u.data?.selected_storage_gib??null,creditTier:c?.selected_credit_tier??null},_=c!=null&&c.plan_id!==`base`&&c.status!=null&&le.has(c.status)&&c.cancel_at_period_end!==!0&&!c.cancel_at,v=!l||!u.isPending,y=!l||u.isSuccess&&u.data!=null&&!u.isFetching&&u.dataUpdatedAt>=s.dataUpdatedAt;return{changeTiers:async e=>{let t=e.machineTier!==g.machineTier,r=e.storageTier!==g.storageTier,i=e.creditTier!==g.creditTier,a=f(e.machineTier),o=f(g.machineTier),s=t&&a!=null&&o!=null&&a<o,c=[];if(t&&c.push(new Promise(t=>{p.mutate({body:{machine_tier:e.machineTier}},{onSuccess:()=>t({dimension:`machine`,ok:!0}),onError:e=>t({dimension:`machine`,ok:!1,error:e})})})),r&&c.push(new Promise(t=>{m.mutate({body:{storage_tier:e.storageTier}},{onSuccess:()=>t({dimension:`storage`,ok:!0}),onError:e=>t({dimension:`storage`,ok:!1,error:e})})})),i&&c.push(new Promise(t=>{h.mutate({body:{credit_tier:e.creditTier}},{onSuccess:()=>t({dimension:`credit`,ok:!0}),onError:e=>t({dimension:`credit`,ok:!1,error:e})})})),c.length===0)return{needsResize:!1,creditChanged:!1};let l=await Promise.all(c);await oe(n);let u=l.some(e=>e.ok&&e.dimension===`machine`)&&!s,d=l.some(e=>e.ok&&e.dimension===`storage`),_=u||d,v=l.some(e=>e.ok&&e.dimension===`credit`),y=l.filter(e=>!e.ok);if(y.length>0){let e=y.map(e=>k(e.error,`Failed to update ${e.dimension} tier.`)).join(` `);return I.error(e),_||v?{needsResize:_,creditChanged:v}:null}return{needsResize:_,creditChanged:v}},isPending:p.isPending||m.isPending||h.isPending,current:g,eligible:_,currentReady:v,currentKnown:y,primaryAssistantId:y?u.data?.primary_assistant_id??null:null}}var Je=`#0A0A0B`,Ye=8e3,Xe={upgrade:`upgrade`,downgrade:`downgrade`,switch:`change`};P();function q(e,t){return t(`plansPage.featureComputer`,{machine:ee(e)})}function Ze(e,t,n){return[q(e,n),n(`plansPage.featureStorage`,{gib:e.storage_gib}),n(`plansPage.featureUsage`,{name:e.name}),...t]}function Qe(e,t){return v(e,t).join(` · `)}function $e(){let{t:e}=a(`settings`),o=s(),[l,u]=c(),d=i(),f=Te(),h=N({platformHostedOnly:!0}),g=pe(),v=Ee(),y=h===`full`&&g,x=h===`full`&&v,C=r({...Ce(),enabled:y}),w=r({...ye(),enabled:y}),ee=t(je()),{changePackage:oe,isPending:D}=ue(),{changeTiers:O,isPending:le,current:A,currentReady:M,currentKnown:P,primaryAssistantId:ge}=qe({enabled:y});de();let[F,xe]=(0,V.useState)(!1),[we,ke]=(0,V.useState)(!1),[Ae,R]=(0,V.useState)(!1),[z,Pe]=(0,V.useState)(null),[Fe,B]=(0,V.useState)(!1),[Le,H]=(0,V.useState)(void 0),U=(0,V.useRef)(!1),[Re,Be]=(0,V.useState)(!1),Ve=(0,V.useRef)(!1),[He,G]=(0,V.useState)(null),K=C.data,q=w.data?.plans.find(e=>e.id===`pro`),$e=q?.packages??[],et=$e.length>0,J=K?.plan_id===`pro`,tt=be(),nt=te(ge,y&&tt&&J&&P),rt=P?nt:void 0,Y=K?K.plan_id===`base`?`free`:b(K.package)?K.package.key:null:null,{cancelSubscription:it,isPending:at}=ne(),ot=ae(K),st=re(ce(K)),ct=he(),lt=new Set(w.data?.plans.find(e=>e.id===`base`)?.included_features??[]),ut=(q?.included_features??[]).filter(e=>!lt.has(e)),X=F||D||at||st.isPending,dt=(0,V.useMemo)(()=>!J||A.storageTier==null?null:{machineTier:A.machineTier,storageTier:A.storageTier,creditTier:A.creditTier},[J,A.machineTier,A.storageTier,A.creditTier]),Z=l.get(Oe),ft=!y&&!x,pt=y&&!w.isLoading&&!et,Q=ft||!(Z!=null&&!Re)&&(C.isError||pt);(0,V.useEffect)(()=>{Q&&o(ft?L.settings.usageBilling:`${L.settings.usageBilling}&adjust_plan`,{replace:!0})},[Q,ft,o]);let mt=()=>{(window.history.state?.idx??0)>0?o(-1):o(L.settings.usageBilling)},ht=async t=>{xe(!0);try{let e=await ee.mutateAsync({body:{...t,return_target:Ne()}});e.status===`redirect`&&e.checkout_url?(_e(t.package?{kind:`package`,packageKey:t.package}:{kind:`custom`,machineTier:t.machine_tier??null,storageTier:t.storage_tier??null,creditTier:t.credit_tier??null}),me(d),Se(e.checkout_url)):(await d.invalidateQueries({queryKey:De()}),await d.invalidateQueries({queryKey:ve()}))}catch(t){I.error(k(t,e(`plansPage.checkoutFailedToast`)))}finally{xe(!1)}},$=(e,t)=>{if(K&&!X){if(ct){Me(L.plans);return}if(J){if(e===`free`){R(!0);return}let n=$e.find(t=>t.key===e);if(!n||E(Y,n.key)===`current`)return;if(!ie(K)){o(`${L.settings.usageBilling}&adjust_plan`,{replace:t?.replaceOnBail===!0});return}Pe(n);return}e!==`free`&&ht({target_plan_id:`pro`,package:e,confirm:!0})}},gt=(0,V.useRef)($);(0,V.useEffect)(()=>{gt.current=$}),(0,V.useEffect)(()=>{if(Z==null||U.current||Q||!y||Ve.current)return;Ve.current=!0;let e=setTimeout(()=>{Be(!0)},Ye),t=()=>{clearTimeout(e),Be(!0)};Promise.all([d.refetchQueries({queryKey:De()}),d.refetchQueries({queryKey:ve()})]).then(t,t)},[Q,Z,y,d]),(0,V.useEffect)(()=>{Z==null||U.current||Q||!y||!Re||(U.current=!0,J&&Z!==`free`&&G(Z),u(e=>{let t=new URLSearchParams(e);return t.delete(Oe),t},{replace:!0}))},[Re,Q,Z,y,J,u]),(0,V.useEffect)(()=>{He==null||Z!=null||(G(null),gt.current(He,{replaceOnBail:!0}))},[Z,He]);let _t;if(K&&q&&et){let t=J&&Y===null&&M&&A.storageGib!=null,r=t?Qe(A,q):void 0,i=async()=>{if(!ot){R(!1),st.mutate({});return}await it()&&R(!1)},a=()=>({creditTier:A.creditTier,fromSnapshot:{machineSize:rt?.machine_size??null,storageGib:rt?.provisioned_storage_gib??null}}),o=z?Y===null?`switch`:E(Y,z.key)===`downgrade`?`downgrade`:`upgrade`:`upgrade`,s=async()=>{if(!z)return;let t=z,n=a(),r=Y===null||!M||!P||Ie(A.machineTier,t.machine_tier),i=await oe(t.key);if(!i)return;if(Pe(null),i.status===`no_op`){I.success(e(`plansPage.alreadyOnPlanToast`));return}let s=t.credit_tier??null;H({fromSnapshot:n.fromSnapshot,credits:s===n.creditTier?null:{fromTier:n.creditTier,toTier:s},direction:Xe[o],canLowerResources:r}),B(!0)},c=e=>ht({target_plan_id:`pro`,confirm:!0,machine_tier:e.machineTier,storage_tier:e.storageTier,credit_tier:e.creditTier}),l=async t=>{let n=a(),r=!P||Ie(A.machineTier,t.machineTier),i=await O(t);i&&(ke(!1),i.needsResize||i.creditChanged?(H({fromSnapshot:n.fromSnapshot,credits:i.creditChanged?{fromTier:n.creditTier,toTier:t.creditTier}:null,direction:`change`,canLowerResources:r}),B(!0)):I.success(e(`plansPage.planUpdatedToast`)))},u=()=>{if(!X){if(ct){Me(L.plans);return}J&&!M||ke(!0)}},d=[...$e].sort((e,t)=>T.indexOf(e.key)-T.indexOf(t.key)),f=S(`free`),p=J?`downgrade`:E(Y,`free`),m=[e(`plansPage.freeFeatureSmallComputer`),e(`plansPage.freeFeatureStorage`,{gib:4}),e(`plansPage.freeFeaturePayAsYouGo`)];_t=(0,W.jsxs)(`div`,{className:`my-auto flex w-full flex-col items-center`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,W.jsx)(`h1`,{className:`text-[40px] text-[var(--content-emphasised)] sm:text-[60px]`,style:{fontFamily:`var(--font-serif)`,fontWeight:400,lineHeight:1.2,letterSpacing:`1.2px`},children:e(`plansPage.heading`)}),(0,W.jsx)(`p`,{className:`text-[20px] font-medium text-[var(--content-tertiary)]`,children:e(`plansPage.subheading`)})]}),(0,W.jsxs)(`div`,{className:`mt-6 grid w-full max-w-[1312px] grid-cols-1 items-start gap-4 sm:mt-10 sm:grid-cols-2 sm:gap-6 lg:grid-cols-4`,children:[(0,W.jsx)(Ke,{tierKey:`free`,name:`Base`,tagline:f?.tagline??``,priceLabel:e(`plansPage.freePriceLabel`),priceCaption:f?.priceCaption??e(`plansPage.foreverCaption`),ctaLabel:p===`downgrade`?e(`plansPage.downgradeTo`,{name:`Base`}):f?.cta??e(`plansPage.startFreeCta`),features:m,tone:`dark`,isCurrent:Y===`free`,intent:p,pending:X,onCta:()=>$(`free`)}),d.map(t=>{let n=S(t.key),r=E(Y,t.key);return(0,W.jsx)(Ke,{tierKey:t.key,name:t.name,tagline:n?.tagline??``,priceLabel:_(t.total_price_cents),priceCaption:n?.priceCaption??e(`plansPage.billedMonthlyCaption`),ctaLabel:r===`downgrade`?e(`plansPage.downgradeTo`,{name:t.name}):n?.cta??t.name,features:Ze(t,n?.extraFeatures??[],e),recommended:n?.recommended,tone:n?.recommended?`light`:`dark`,isCurrent:Y===t.key,intent:r,pending:X,onCta:()=>$(t.key)},t.key)})]}),(0,W.jsx)(We,{className:`mt-6 sm:mt-10`,onConfigure:u,configureDisabled:J&&!M||X,isCurrent:t,currentSummary:r}),(0,W.jsx)(Ue,{open:we,proPlan:q,pending:F||le,currentStorageGib:J?A.storageGib:null,initialSelection:dt,onClose:()=>ke(!1),onContinue:e=>{J?l(e):c(e)}}),(0,W.jsx)(se,{open:z!==null,relation:o,packageName:z?.name??``,targetPackage:z,pending:D,onCancel:()=>Pe(null),onConfirm:()=>void s()}),(0,W.jsx)(Ge,{open:Ae,lostFeatures:ut,viaPortal:!ot,pending:at||st.isPending,onCancel:()=>R(!1),onConfirm:()=>void i()}),(0,W.jsx)(fe,{mode:`resize`,open:Fe,onClose:()=>{B(!1),H(void 0)},resizeContext:Le}),(0,W.jsx)(`p`,{className:`mt-6 text-center text-[12px] font-medium text-[var(--content-tertiary)] sm:mt-10`,children:(0,W.jsx)(n,{ns:`settings`,i18nKey:`plansPage.cancelAnytimeFooter`,components:{docsLink:(0,W.jsx)(`a`,{href:ze,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--content-default)] underline`})}})})]})}else _t=(0,W.jsx)(`div`,{className:`my-auto flex items-center justify-center`,children:(0,W.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`plansPage.loadingPlansAriaLabel`)})});return(0,W.jsxs)(`div`,{"data-theme":`dark`,className:`plans-takeover-canvas-enter relative h-full w-full overflow-y-auto`,style:{backgroundColor:Je},children:[(0,W.jsx)(`div`,{className:`absolute left-8 z-10 [-webkit-app-region:no-drag]`,style:{top:f?`3rem`:`2rem`},children:(0,W.jsx)(j,{variant:`outlined`,leftIcon:(0,W.jsx)(p,{className:`h-4 w-4`,"aria-hidden":!0}),onClick:mt,className:`[-webkit-app-region:no-drag]`,children:e(`plansPage.back`)})}),(0,W.jsx)(`div`,{className:`plans-takeover-content-enter flex min-h-full flex-col items-center px-4 pb-8 sm:px-6`,style:{paddingTop:f?`5rem`:`4rem`},children:_t})]})}function et(){return(0,W.jsx)($e,{})}export{et as PlansPage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Jn as t,N as n,Zn as r,er as i,j as a}from"./vendor-CYfJo8gP.js";import{b as o,f as s,g as c,t as l}from"./react-DPM_L_aA.js";import{R as u,ar as d,jr as f,pi as p,tn as m,v as h,xn as g}from"./icons-CSdHOix6.js";import{A as _,C as v,D as y,F as b,H as x,M as S,N as C,O as w,P as T,R as E,T as ee,V as te,a as ne,d as re,g as ie,h as ae,i as oe,j as D,k as O,m as k,n as se,o as ce,p as le,r as ue,t as de,x as A,z as fe}from"./use-checkout-dismiss-refresh-DOJD5kF-.js";import{Af as pe,Bf as me,Dy as j,Ep as he,Ey as M,Mf as N,Mr as P,Qc as ge,Qv as F,Tg as _e,Xc as ve,Yc as ye,Yf as be,Zc as xe,ag as Se,al as Ce,cy as I,dv as L,el as we,fv as Te,jf as Ee,ol as De,ov as Oe,rg as ke,rl as Ae,sl as je,uy as R,xy as z}from"./index-b_IQShc9.js";import{t as Me}from"./android-billing-handoff-B8rC7eeV.js";import{t as Ne}from"./checkout-return-target-DRW4Fb93.js";import{i as Pe,r as Fe,s as Ie,t as B}from"./machine-sizes-CcBnk4Jk.js";var V=e(o(),1),Le=`__none__`,H=`__baseline__`,U=`${Pe[B]} machine (${Fe[B]})`;function Re(e){let{proPlan:t,seed:n,machineTier:r,storageTier:i,creditChoice:a,noBundleLabel:o}=e,s=t.machine_tiers,c=t.storage_tiers,l=t.credit_tiers??[],u=r===H,d=u?null:s.find(e=>e.tier===r)??null,f=u?U:d?.description??null,p=c.find(e=>e.tier===i)??null,m=a&&a!==`__none__`?l.find(e=>e.tier===a)??null:null,h=n!=null&&n.machineTier!=null?s.find(e=>e.tier===n.machineTier)??null:null,g=n==null?null:n.machineTier??`__baseline__`,_=n==null?void 0:n.machineTier==null?U:h?.description,v=n==null?null:c.find(e=>e.tier===n.storageTier)??null,y=n!=null&&n.creditTier!=null?l.find(e=>e.tier===n.creditTier)??null:null,b=n!=null&&n.machineTier!=null&&h==null,x=n!=null&&v==null,S=[{key:`base`,label:`Platform fee: ${O(t.base_price_cents)}`,changed:!1}];if(f!=null){let e=n!=null&&!b&&g!==r;S.push({key:`machine`,label:f,previousLabel:e?_:void 0,changed:e})}if(p!=null){let e=n!=null&&!x&&v?.tier!==p.tier;S.push({key:`storage`,label:D(p.storage_gib),previousLabel:e&&v!=null?D(v.storage_gib):void 0,changed:e})}let C=a===`__none__`?o:m==null?null:m.label;if(C!=null){let e=n!=null&&(n.creditTier??`__none__`)!==a,t=n?.creditTier==null?o:y?.label;S.push({key:`credit`,label:C,previousLabel:e?t:void 0,changed:e})}let w=t.base_price_cents+(d?.price_cents??0)+(p?.price_cents??0)+(m?.price_cents??0),T=b||x||n!=null&&n.creditTier!=null&&y==null;if(n==null||T)return{totalCents:w,previousTotalCents:null,deltaCents:null,rows:S};let E=t.base_price_cents+(h?.price_cents??0)+(v?.price_cents??0)+(y?.price_cents??0);return{totalCents:w,previousTotalCents:E,deltaCents:w-E,rows:S}}var ze=`https://www.vellum.ai/docs/pricing`,Be=`${ze}#machine-sizes`,Ve=`${ze}#storage`,He=`${ze}#credit-bundles`,W=l();function G(e){return(0,W.jsxs)(`span`,{className:`text-[12px] font-medium text-[var(--content-disabled)]`,children:[`+`,O(e)]})}function K({label:e,docsUrl:t,docsLabel:n,learnMore:r}){return(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:e}),(0,W.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"aria-label":n,onClick:e=>ke(e,t),className:`text-[11px] font-medium text-[var(--content-tertiary)] underline hover:text-[var(--content-default)]`,children:r})]})}function Ue({open:e,proPlan:t,pending:n,currentStorageGib:r,initialSelection:i,onClose:o,onContinue:s}){let{t:c}=a(`settings`),l=c(`customPlanModal.noExtraUsage`),p=e?i??null:null,[m,h]=(0,V.useState)(()=>p?p.machineTier??`__baseline__`:``),[_,v]=(0,V.useState)(()=>p?.storageTier??``),[b,S]=(0,V.useState)(()=>p?p.creditTier??`__none__`:``),[C,T]=(0,V.useState)({open:e,initialSelection:i});(C.open!==e||C.initialSelection!==i)&&(T({open:e,initialSelection:i}),h(p?p.machineTier??`__baseline__`:``),v(p?.storageTier??``),S(p?p.creditTier??`__none__`:``));let E=t.machine_tiers,ee=(0,V.useMemo)(()=>t.storage_tiers.filter(e=>!e.legacy||e.tier===i?.storageTier),[t.storage_tiers,i?.storageTier]),te=t.credit_tiers??[],ne=(0,V.useMemo)(()=>(t.credit_tiers??[]).filter(e=>!e.legacy),[t.credit_tiers]),re=e=>A(e)||e.legacy&&e.tier!==i?.storageTier||r!=null&&e.storage_gib<r,ie=i!=null&&i.machineTier==null,ae=[...ie?[{value:H,label:U,icon:(0,W.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),disabled:!0}]:[],...E.map(e=>({value:e.tier,label:e.description,icon:(0,W.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(e.price_cents),disabled:A(e)}))],oe=ee.map(e=>({value:e.tier,label:e.label,icon:(0,W.jsx)(g,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(e.price_cents),disabled:re(e)})),D=b&&b!==`__none__`?te.find(e=>e.tier===b)??null:null,k=D?.legacy?D:null,se=[{value:Le,label:l,icon:(0,W.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0})},...ne.map(e=>({value:e.tier,label:e.label,icon:(0,W.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(e.price_cents)})),...k?[{value:k.tier,label:k.label,icon:(0,W.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:G(k.price_cents),disabled:!0}]:[]],ce=m===H,le=ce?null:E.find(e=>e.tier===m)??null,ue=ce?ie?{tier:null}:null:le==null?null:{tier:le.tier},de=_!==``&&_===i?.storageTier,fe=ee.find(e=>e.tier===_&&(de||!re(e)))??null,pe=b===`__none__`||b===i?.creditTier||ne.some(e=>e.tier===b),me=b!==``&&pe?b:null,he=ue!=null&&fe!=null&&me!=null,M=i!=null&&m===(i.machineTier??`__baseline__`)&&_===i.storageTier&&b===(i.creditTier??`__none__`),N=(0,V.useMemo)(()=>Re({proPlan:t,seed:i??null,machineTier:m,storageTier:_,creditChoice:b,noBundleLabel:l}),[t,i,m,_,b,l]);return(0,W.jsx)(R.Root,{open:e,onOpenChange:e=>{e||o()},children:(0,W.jsx)(R.Content,{size:`lg`,"data-theme":`light`,hideCloseButton:!0,overlayClassName:`backdrop-blur-[2px]`,className:`max-w-[820px] md:min-h-[min(608px,calc(100vh-4rem))]`,children:(0,W.jsx)(R.Body,{className:`p-4`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-8 md:flex-row md:gap-12`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6 md:flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--surface-active)] p-[14px]`,children:(0,W.jsx)(u,{className:`h-6 w-6 text-[var(--content-emphasised)]`,"aria-hidden":!0})}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsx)(R.Title,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.title`)}),(0,W.jsx)(R.Description,{className:`mt-0 text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:c(`customPlanModal.subtitle`)})]})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(K,{label:c(`customPlanModal.machineSizeLabel`),docsUrl:Be,docsLabel:c(`customPlanModal.machineSizeDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,W.jsx)(F,{"aria-label":c(`customPlanModal.machineSizeAriaLabel`),placeholder:c(`customPlanModal.machineSizePlaceholder`),value:m,onChange:h,options:ae})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(K,{label:c(`customPlanModal.storageLabel`),docsUrl:Ve,docsLabel:c(`customPlanModal.storageDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,W.jsx)(F,{"aria-label":c(`customPlanModal.storageAriaLabel`),placeholder:c(`customPlanModal.storagePlaceholder`),value:_,onChange:v,options:oe})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(K,{label:c(`customPlanModal.usageBundleLabel`),docsUrl:He,docsLabel:c(`customPlanModal.usageBundleDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,W.jsx)(F,{"aria-label":c(`customPlanModal.usageBundleAriaLabel`),placeholder:c(`customPlanModal.usageBundlePlaceholder`),value:b,onChange:S,options:se})]})]}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-16 md:pt-[5px]`,children:[(0,W.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.recap`)}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:O(N.totalCents)}),N.deltaCents!=null&&N.deltaCents!==0&&N.previousTotalCents!=null&&(0,W.jsx)(`span`,{className:`text-[12px] font-medium ${N.deltaCents>0?`text-[var(--system-positive-strong)]`:`text-[var(--system-negative-strong)]`}`,children:c(`customPlanModal.comparedToPrevious`,{delta:y(N.deltaCents),previous:w(N.previousTotalCents)})}),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.totalBilledMonthly`)})]}),(0,W.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.yourSelection`)}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,children:N.rows.map(e=>(0,W.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[e.previousLabel!=null&&(0,W.jsxs)(`div`,{className:`relative flex w-fit items-start gap-2`,children:[(0,W.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`,"aria-hidden":!0}),(0,W.jsx)(`s`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-disabled)] no-underline`,children:e.previousLabel}),(0,W.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute -left-1 right-0 top-[9px] h-px bg-[var(--content-disabled)]`})]}),(0,W.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 ${e.changed?`text-[var(--system-positive-strong)]`:`text-[var(--content-secondary)]`}`,"aria-hidden":!0}),(0,W.jsx)(`span`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-secondary)]`,children:e.label})]})]},e.key))}),(0,W.jsx)(j,{variant:`primary`,fullWidth:!0,disabled:!he||M||n,onClick:()=>{!he||M||n||s({machineTier:ue.tier,storageTier:fe.tier,creditTier:me===`__none__`?null:me})},children:c(`customPlanModal.continue`)}),(0,W.jsx)(j,{variant:`ghost`,fullWidth:!0,disabled:n,onClick:o,children:c(`customPlanModal.cancel`)})]})]})]})})})})}function We({className:e,onConfigure:t,configureDisabled:n,isCurrent:r=!1,currentSummary:i}){let{t:o}=a(`settings`);return(0,W.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-8 ${e??``}`,children:[(0,W.jsx)(`p`,{className:`text-center text-[20px] font-medium text-[var(--content-tertiary)]`,children:o(`customPlanRow.prompt`)}),(0,W.jsxs)(`div`,{className:`flex w-[840px] max-w-full flex-col items-start gap-4 rounded-2xl bg-[var(--surface-lift)] p-4 sm:flex-row sm:items-center sm:justify-between sm:gap-6`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,W.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--content-disabled)] p-[14px]`,children:(0,W.jsx)(u,{className:`h-6 w-6 text-[var(--aux-white)]`,"aria-hidden":!0})}),(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:o(`customPlanRow.title`)}),r?(0,W.jsx)(z,{className:`bg-[var(--feed-digest-weak)] text-[var(--content-default)]`,children:o(`customPlanRow.currentPlanTag`)}):null]}),(0,W.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-tertiary)]`,children:i??o(`customPlanRow.genericDescriptor`)})]})]}),(0,W.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:(0,W.jsx)(j,{variant:`outlined`,onClick:t,disabled:n,children:o(`customPlanRow.configure`)})})]})]})}function Ge({open:e,lostFeatures:t,viaPortal:n,pending:r,onCancel:i,onConfirm:o}){let{t:s}=a(`settings`),c=t.length>0;return(0,W.jsx)(R.Root,{open:e,onOpenChange:e=>{!e&&!r&&i()},children:(0,W.jsxs)(R.Content,{size:`md`,hideCloseButton:!0,children:[(0,W.jsx)(R.Header,{icon:h,children:(0,W.jsx)(R.Title,{children:s(`freeDowngradeConfirmModal.title`)})}),(0,W.jsxs)(R.Body,{children:[(0,W.jsx)(M,{as:`p`,variant:`body-medium-default`,className:`text-(--content-secondary)`,children:s(n?c?`freeDowngradeConfirmModal.bodyWithFeaturesPortal`:`freeDowngradeConfirmModal.bodyCancelOnlyPortal`:c?`freeDowngradeConfirmModal.bodyWithFeatures`:`freeDowngradeConfirmModal.bodyCancelOnly`)}),c?(0,W.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5`,children:t.map(e=>(0,W.jsx)(`li`,{children:(0,W.jsx)(M,{as:`span`,variant:`body-medium-default`,children:e})},e))}):null]}),(0,W.jsxs)(R.Footer,{children:[(0,W.jsx)(j,{variant:`outlined`,onClick:i,disabled:r,children:s(`freeDowngradeConfirmModal.cancel`)}),(0,W.jsx)(j,{variant:`danger`,onClick:o,disabled:r,"data-testid":`confirm-free-downgrade-button`,children:s(`freeDowngradeConfirmModal.confirm`)})]})]})})}function Ke({tierKey:e,name:t,tagline:n,priceLabel:r,priceCaption:i,ctaLabel:o,features:s,recommended:c=!1,tone:l=`dark`,isCurrent:u,intent:d=`upgrade`,pending:p,onCta:m}){let{t:h}=a(`settings`),g=d===`downgrade`&&!u;return(0,W.jsxs)(`div`,{"data-theme":l,className:`flex w-full flex-col gap-3 rounded-2xl bg-[var(--surface-lift)] p-3 sm:gap-4 sm:p-4`,children:[(0,W.jsx)(C,{tier:e,size:50}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsxs)(`div`,{className:`flex h-8 items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-[20px] font-medium text-[var(--content-emphasised)]`,children:t}),c&&!g&&!u?(0,W.jsx)(z,{className:`bg-[var(--feed-digest-weak)] text-[12px] font-semibold uppercase text-[var(--credits-accent)]`,children:h(`planColumnCard.recommended`)}):null]}),(0,W.jsx)(`p`,{className:`overflow-hidden text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)] sm:h-9`,children:n})]}),(0,W.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:r}),(0,W.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:i})]}),(0,W.jsx)(j,{variant:g?`outlined`:`primary`,fullWidth:!0,disabled:u||p,onClick:m,children:u?h(`planColumnCard.currentPlan`):o}),(0,W.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2 sm:gap-4`,children:[(0,W.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:h(`planColumnCard.includes`)}),(0,W.jsx)(`ul`,{className:`flex flex-col gap-2`,children:s.map(e=>(0,W.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,W.jsx)(f,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,W.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-secondary)]`,children:e})]},e))})]})]})}function qe({enabled:e=!0}={}){let n=i(),a=be(),o=e&&a,s=r({...Ce(),enabled:o}),c=s.data,l=c!=null&&c.plan_id!==`base`,u=r({...Ae(),enabled:o&&l}),d=r({...ye(),enabled:o&&l}).data?.plans.find(e=>e.id===`pro`)?.machine_tiers??[],f=e=>d.find(t=>t.tier===e)?.price_cents??null,p=t(ge()),m=t(we()),h=t(xe()),g={machineTier:u.data?.max_machine_tier??null,storageTier:u.data?.selected_storage_tier??null,storageGib:u.data?.selected_storage_gib??null,creditTier:c?.selected_credit_tier??null},_=c!=null&&c.plan_id!==`base`&&c.status!=null&&le.has(c.status)&&c.cancel_at_period_end!==!0&&!c.cancel_at,v=!l||!u.isPending,y=!l||u.isSuccess&&u.data!=null&&!u.isFetching&&u.dataUpdatedAt>=s.dataUpdatedAt;return{changeTiers:async e=>{let t=e.machineTier!==g.machineTier,r=e.storageTier!==g.storageTier,i=e.creditTier!==g.creditTier,a=f(e.machineTier),o=f(g.machineTier),s=t&&a!=null&&o!=null&&a<o,c=[];if(t&&c.push(new Promise(t=>{p.mutate({body:{machine_tier:e.machineTier}},{onSuccess:()=>t({dimension:`machine`,ok:!0}),onError:e=>t({dimension:`machine`,ok:!1,error:e})})})),r&&c.push(new Promise(t=>{m.mutate({body:{storage_tier:e.storageTier}},{onSuccess:()=>t({dimension:`storage`,ok:!0}),onError:e=>t({dimension:`storage`,ok:!1,error:e})})})),i&&c.push(new Promise(t=>{h.mutate({body:{credit_tier:e.creditTier}},{onSuccess:()=>t({dimension:`credit`,ok:!0}),onError:e=>t({dimension:`credit`,ok:!1,error:e})})})),c.length===0)return{needsResize:!1,creditChanged:!1};let l=await Promise.all(c);await oe(n);let u=l.some(e=>e.ok&&e.dimension===`machine`)&&!s,d=l.some(e=>e.ok&&e.dimension===`storage`),_=u||d,v=l.some(e=>e.ok&&e.dimension===`credit`),y=l.filter(e=>!e.ok);if(y.length>0){let e=y.map(e=>k(e.error,`Failed to update ${e.dimension} tier.`)).join(` `);return I.error(e),_||v?{needsResize:_,creditChanged:v}:null}return{needsResize:_,creditChanged:v}},isPending:p.isPending||m.isPending||h.isPending,current:g,eligible:_,currentReady:v,currentKnown:y,primaryAssistantId:y?u.data?.primary_assistant_id??null:null}}var Je=`#0A0A0B`,Ye=8e3,Xe={upgrade:`upgrade`,downgrade:`downgrade`,switch:`change`};P();function q(e,t){return t(`plansPage.featureComputer`,{machine:ee(e)})}function Ze(e,t,n){return[q(e,n),n(`plansPage.featureStorage`,{gib:e.storage_gib}),n(`plansPage.featureUsage`,{name:e.name}),...t]}function Qe(e,t){return v(e,t).join(` · `)}function $e(){let{t:e}=a(`settings`),o=s(),[l,u]=c(),d=i(),f=Te(),h=N({platformHostedOnly:!0}),g=pe(),v=Ee(),y=h===`full`&&g,x=h===`full`&&v,C=r({...Ce(),enabled:y}),w=r({...ye(),enabled:y}),ee=t(je()),{changePackage:oe,isPending:D}=ue(),{changeTiers:O,isPending:le,current:A,currentReady:M,currentKnown:P,primaryAssistantId:ge}=qe({enabled:y});de();let[F,xe]=(0,V.useState)(!1),[we,ke]=(0,V.useState)(!1),[Ae,R]=(0,V.useState)(!1),[z,Pe]=(0,V.useState)(null),[Fe,B]=(0,V.useState)(!1),[Le,H]=(0,V.useState)(void 0),U=(0,V.useRef)(!1),[Re,Be]=(0,V.useState)(!1),Ve=(0,V.useRef)(!1),[He,G]=(0,V.useState)(null),K=C.data,q=w.data?.plans.find(e=>e.id===`pro`),$e=q?.packages??[],et=$e.length>0,J=K?.plan_id===`pro`,tt=be(),nt=te(ge,y&&tt&&J&&P),rt=P?nt:void 0,Y=K?K.plan_id===`base`?`free`:b(K.package)?K.package.key:null:null,{cancelSubscription:it,isPending:at}=ne(),ot=ae(K),st=re(ce(K)),ct=he(),lt=new Set(w.data?.plans.find(e=>e.id===`base`)?.included_features??[]),ut=(q?.included_features??[]).filter(e=>!lt.has(e)),X=F||D||at||st.isPending,dt=(0,V.useMemo)(()=>!J||A.storageTier==null?null:{machineTier:A.machineTier,storageTier:A.storageTier,creditTier:A.creditTier},[J,A.machineTier,A.storageTier,A.creditTier]),Z=l.get(Oe),ft=!y&&!x,pt=y&&!w.isLoading&&!et,Q=ft||!(Z!=null&&!Re)&&(C.isError||pt);(0,V.useEffect)(()=>{Q&&o(ft?L.settings.usageBilling:`${L.settings.usageBilling}&adjust_plan`,{replace:!0})},[Q,ft,o]);let mt=()=>{(window.history.state?.idx??0)>0?o(-1):o(L.settings.usageBilling)},ht=async t=>{xe(!0);try{let e=await ee.mutateAsync({body:{...t,return_target:Ne()}});e.status===`redirect`&&e.checkout_url?(_e(t.package?{kind:`package`,packageKey:t.package}:{kind:`custom`,machineTier:t.machine_tier??null,storageTier:t.storage_tier??null,creditTier:t.credit_tier??null}),me(d),Se(e.checkout_url)):(await d.invalidateQueries({queryKey:De()}),await d.invalidateQueries({queryKey:ve()}))}catch(t){I.error(k(t,e(`plansPage.checkoutFailedToast`)))}finally{xe(!1)}},$=(e,t)=>{if(K&&!X){if(ct){Me(L.plans);return}if(J){if(e===`free`){R(!0);return}let n=$e.find(t=>t.key===e);if(!n||E(Y,n.key)===`current`)return;if(!ie(K)){o(`${L.settings.usageBilling}&adjust_plan`,{replace:t?.replaceOnBail===!0});return}Pe(n);return}e!==`free`&&ht({target_plan_id:`pro`,package:e,confirm:!0})}},gt=(0,V.useRef)($);(0,V.useEffect)(()=>{gt.current=$}),(0,V.useEffect)(()=>{if(Z==null||U.current||Q||!y||Ve.current)return;Ve.current=!0;let e=setTimeout(()=>{Be(!0)},Ye),t=()=>{clearTimeout(e),Be(!0)};Promise.all([d.refetchQueries({queryKey:De()}),d.refetchQueries({queryKey:ve()})]).then(t,t)},[Q,Z,y,d]),(0,V.useEffect)(()=>{Z==null||U.current||Q||!y||!Re||(U.current=!0,J&&Z!==`free`&&G(Z),u(e=>{let t=new URLSearchParams(e);return t.delete(Oe),t},{replace:!0}))},[Re,Q,Z,y,J,u]),(0,V.useEffect)(()=>{He==null||Z!=null||(G(null),gt.current(He,{replaceOnBail:!0}))},[Z,He]);let _t;if(K&&q&&et){let t=J&&Y===null&&M&&A.storageGib!=null,r=t?Qe(A,q):void 0,i=async()=>{if(!ot){R(!1),st.mutate({});return}await it()&&R(!1)},a=()=>({creditTier:A.creditTier,fromSnapshot:{machineSize:rt?.machine_size??null,storageGib:rt?.provisioned_storage_gib??null}}),o=z?Y===null?`switch`:E(Y,z.key)===`downgrade`?`downgrade`:`upgrade`:`upgrade`,s=async()=>{if(!z)return;let t=z,n=a(),r=Y===null||!M||!P||Ie(A.machineTier,t.machine_tier),i=await oe(t.key);if(!i)return;if(Pe(null),i.status===`no_op`){I.success(e(`plansPage.alreadyOnPlanToast`));return}let s=t.credit_tier??null;H({fromSnapshot:n.fromSnapshot,credits:s===n.creditTier?null:{fromTier:n.creditTier,toTier:s},direction:Xe[o],canLowerResources:r}),B(!0)},c=e=>ht({target_plan_id:`pro`,confirm:!0,machine_tier:e.machineTier,storage_tier:e.storageTier,credit_tier:e.creditTier}),l=async t=>{let n=a(),r=!P||Ie(A.machineTier,t.machineTier),i=await O(t);i&&(ke(!1),i.needsResize||i.creditChanged?(H({fromSnapshot:n.fromSnapshot,credits:i.creditChanged?{fromTier:n.creditTier,toTier:t.creditTier}:null,direction:`change`,canLowerResources:r}),B(!0)):I.success(e(`plansPage.planUpdatedToast`)))},u=()=>{if(!X){if(ct){Me(L.plans);return}J&&!M||ke(!0)}},d=[...$e].sort((e,t)=>T.indexOf(e.key)-T.indexOf(t.key)),f=S(`free`),p=J?`downgrade`:E(Y,`free`),m=[e(`plansPage.freeFeatureSmallComputer`),e(`plansPage.freeFeatureStorage`,{gib:4}),e(`plansPage.freeFeaturePayAsYouGo`)];_t=(0,W.jsxs)(`div`,{className:`my-auto flex w-full flex-col items-center`,children:[(0,W.jsxs)(`header`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,W.jsx)(`h1`,{className:`text-[40px] text-[var(--content-emphasised)] sm:text-[60px]`,style:{fontFamily:`var(--font-serif)`,fontWeight:400,lineHeight:1.2,letterSpacing:`1.2px`},children:e(`plansPage.heading`)}),(0,W.jsx)(`p`,{className:`text-[20px] font-medium text-[var(--content-tertiary)]`,children:e(`plansPage.subheading`)})]}),(0,W.jsxs)(`div`,{className:`mt-6 grid w-full max-w-[1312px] grid-cols-1 items-start gap-4 sm:mt-10 sm:grid-cols-2 sm:gap-6 lg:grid-cols-4`,children:[(0,W.jsx)(Ke,{tierKey:`free`,name:`Base`,tagline:f?.tagline??``,priceLabel:e(`plansPage.freePriceLabel`),priceCaption:f?.priceCaption??e(`plansPage.foreverCaption`),ctaLabel:p===`downgrade`?e(`plansPage.downgradeTo`,{name:`Base`}):f?.cta??e(`plansPage.startFreeCta`),features:m,tone:`dark`,isCurrent:Y===`free`,intent:p,pending:X,onCta:()=>$(`free`)}),d.map(t=>{let n=S(t.key),r=E(Y,t.key);return(0,W.jsx)(Ke,{tierKey:t.key,name:t.name,tagline:n?.tagline??``,priceLabel:_(t.total_price_cents),priceCaption:n?.priceCaption??e(`plansPage.billedMonthlyCaption`),ctaLabel:r===`downgrade`?e(`plansPage.downgradeTo`,{name:t.name}):n?.cta??t.name,features:Ze(t,n?.extraFeatures??[],e),recommended:n?.recommended,tone:n?.recommended?`light`:`dark`,isCurrent:Y===t.key,intent:r,pending:X,onCta:()=>$(t.key)},t.key)})]}),(0,W.jsx)(We,{className:`mt-6 sm:mt-10`,onConfigure:u,configureDisabled:J&&!M||X,isCurrent:t,currentSummary:r}),(0,W.jsx)(Ue,{open:we,proPlan:q,pending:F||le,currentStorageGib:J?A.storageGib:null,initialSelection:dt,onClose:()=>ke(!1),onContinue:e=>{J?l(e):c(e)}}),(0,W.jsx)(se,{open:z!==null,relation:o,packageName:z?.name??``,targetPackage:z,pending:D,onCancel:()=>Pe(null),onConfirm:()=>void s()}),(0,W.jsx)(Ge,{open:Ae,lostFeatures:ut,viaPortal:!ot,pending:at||st.isPending,onCancel:()=>R(!1),onConfirm:()=>void i()}),(0,W.jsx)(fe,{mode:`resize`,open:Fe,onClose:()=>{B(!1),H(void 0)},resizeContext:Le}),(0,W.jsx)(`p`,{className:`mt-6 text-center text-[12px] font-medium text-[var(--content-tertiary)] sm:mt-10`,children:(0,W.jsx)(n,{ns:`settings`,i18nKey:`plansPage.cancelAnytimeFooter`,components:{docsLink:(0,W.jsx)(`a`,{href:ze,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--content-default)] underline`})}})})]})}else _t=(0,W.jsx)(`div`,{className:`my-auto flex items-center justify-center`,children:(0,W.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`plansPage.loadingPlansAriaLabel`)})});return(0,W.jsxs)(`div`,{"data-theme":`dark`,className:`plans-takeover-canvas-enter relative h-full w-full overflow-y-auto`,style:{backgroundColor:Je},children:[(0,W.jsx)(`div`,{className:`absolute left-8 z-10 [-webkit-app-region:no-drag]`,style:{top:f?`3rem`:`2rem`},children:(0,W.jsx)(j,{variant:`outlined`,leftIcon:(0,W.jsx)(p,{className:`h-4 w-4`,"aria-hidden":!0}),onClick:mt,className:`[-webkit-app-region:no-drag]`,children:e(`plansPage.back`)})}),(0,W.jsx)(`div`,{className:`plans-takeover-content-enter flex min-h-full flex-col items-center px-4 pb-8 sm:px-6`,style:{paddingTop:f?`5rem`:`4rem`},children:_t})]})}function et(){return(0,W.jsx)($e,{})}export{et as PlansPage};
|
package/dist/assets/{platform-loopback-page-_NLrjsOR.js → platform-loopback-page-hfwG6N6r.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{B_ as o,G_ as s,Pf as c,Vp as l,dv as u,om as d,yg as f}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{B_ as o,G_ as s,Pf as c,Vp as l,dv as u,om as d,yg as f}from"./index-b_IQShc9.js";var p=e(n(),1),m=a(),h=`vellum:loopback:state`,g=`vellum:loopback:returnTo`;function _(){let{t:e}=t(`account`),[n]=i(),a=r(),[_,v]=(0,p.useState)(null);return(0,p.useEffect)(()=>{let t=n.get(`state`),r=n.get(`session_token`),i=sessionStorage.getItem(h),p=sessionStorage.getItem(g)||u.assistant;if(sessionStorage.removeItem(h),sessionStorage.removeItem(g),!t||t!==i){v(e(`authErrors.loopbackStateMismatch`));return}if(!r){v(e(`authErrors.loopbackNoToken`));return}if(!/^[a-zA-Z0-9]+$/.test(r)){v(e(`authErrors.loopbackInvalidToken`));return}(async()=>{if(!await s(r)){v(`Login failed: couldn't reach the local Vellum server to store the session. Please try again.`);return}await c.getState().initSession(),await f(!0);try{let e=await d();if(e.ok&&e.data.length>0){await o(e.data,l.getState().currentOrganizationId??void 0),a(u.assistant,{replace:!0});return}}catch{}a(p,{replace:!0})})()},[n,a,e]),_?(0,m.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,m.jsxs)(`div`,{className:`max-w-md text-center`,children:[(0,m.jsx)(`p`,{className:`text-body-medium-default`,children:_}),(0,m.jsx)(`button`,{type:`button`,className:`mt-4 rounded-lg border border-[var(--border-disabled)] px-4 py-2 text-sm hover:bg-[var(--surface-lift)]`,onClick:()=>void a(u.welcome),children:e(`platformLoopbackPage.backToWelcome`)})]})}):(0,m.jsx)(`div`,{className:`flex min-h-screen items-center justify-center bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,m.jsx)(`p`,{className:`text-body-medium-default`,children:e(`platformLoopbackPage.completing`)})})}export{_ as PlatformLoopbackPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as e,r as t,t as n}from"./react-DPM_L_aA.js";import{X_ as r,dv as i,xi as a}from"./index-
|
|
1
|
+
import{m as e,r as t,t as n}from"./react-DPM_L_aA.js";import{X_ as r,dv as i,xi as a}from"./index-b_IQShc9.js";var o=n();function s(){let n=r.use.version(),s=a(),{name:c}=e();return n===null?null:!s||!c?(0,o.jsx)(t,{to:i.superpowers,replace:!0}):(0,o.jsx)(t,{to:`${i.superpowers}?plugin=${encodeURIComponent(c)}`,replace:!0})}export{s as PluginDetailPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{g as e,r as t,t as n}from"./react-DPM_L_aA.js";import{dv as r}from"./index-
|
|
1
|
+
import{g as e,r as t,t as n}from"./react-DPM_L_aA.js";import{dv as r}from"./index-b_IQShc9.js";var i=n();function a(){let[n]=e(),a=n.toString();return(0,i.jsx)(t,{to:`${r.superpowers}${a?`?${a}`:``}`,replace:!0})}export{a as PluginsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"./vendor-CYfJo8gP.js";import{t}from"./react-DPM_L_aA.js";import{xi as n}from"./icons-CSdHOix6.js";import{Ey as r}from"./index-
|
|
1
|
+
import{j as e}from"./vendor-CYfJo8gP.js";import{t}from"./react-DPM_L_aA.js";import{xi as n}from"./icons-CSdHOix6.js";import{Ey as r}from"./index-b_IQShc9.js";var i=n(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),a=t();function o({filename:t}){let{t:n}=e(`chat`);return(0,a.jsxs)(`div`,{role:`status`,className:`flex items-center gap-2.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-3`,children:[(0,a.jsx)(i,{"aria-hidden":`true`,className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)]`}),(0,a.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,a.jsx)(r,{as:`span`,variant:`body-small-default`,className:`text-[var(--content-default)]`,children:n(`previewError.cannotPreview`)}),(0,a.jsx)(r,{as:`span`,variant:`label-small-default`,className:`truncate text-[var(--content-tertiary)]`,children:t})]})]})}export{o as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Jn as t,N as n,Zn as r,er as i,j as a}from"./vendor-CYfJo8gP.js";import{b as o,t as s,y as c}from"./react-DPM_L_aA.js";import{Lr as l,U as u,_t as d,i as f,tn as p,x as m,zr as h}from"./icons-CSdHOix6.js";import{$l as g,$t as _,Af as v,Ay as y,Bi as b,Dp as x,Dy as S,F as C,Ff as w,Hi as T,I as E,L as ee,Mf as D,Ml as te,Nl as O,Pf as k,Qs as A,Qv as j,R as ne,Ty as M,Vi as N,Y as P,Zs as F,_v as I,_y as L,cy as R,dg as re,dv as ie,eu as ae,fg as oe,fr as se,gg as ce,gv as z,hg as B,hp as le,hv as V,jf as ue,jl as de,lm as fe,mg as pe,mr as me,mv as H,op as he,pg as ge,pr as U,sg as _e,sy as ve,uv as ye,vv as be,vy as W,wy as G,xy as K}from"./index-BVVp210p.js";import{t as q}from"./detail-card-BXhwux_c.js";import{t as J}from"./setting-row-D7b4t29_.js";import{t as xe}from"./settings-divider-DOmdsd_b.js";var Y=e(o(),1),X=s(),Se=[{id:`accessibility`,type:`system`,sourceKind:`accessibility`},{id:`screen`,type:`system`,sourceKind:`screen`,availableOnWindows:!0},{id:`microphone`,type:`system`,sourceKind:`microphone`,availableOnWindows:!0},{id:`speechRecognition`,type:`system`,sourceKind:`speechRecognition`,availableOnWindows:!0},{id:`notifications`,type:`system`,sourceKind:`notifications`,availableOnWindows:!0}],Ce=[{id:`notificationBadges`,type:`local`}];function we(e,t,n){switch(e){case`accessibility`:return{label:t(`systemPermissionsCard.accessibilityLabel`),description:t(`systemPermissionsCard.accessibilityDescription`)};case`screen`:return{label:t(`systemPermissionsCard.screenLabel`),description:t(`systemPermissionsCard.screenDescription`)};case`microphone`:return{label:t(`systemPermissionsCard.microphoneLabel`),description:t(`systemPermissionsCard.microphoneDescription`)};case`speechRecognition`:return{label:t(`systemPermissionsCard.speechRecognitionLabel`),description:t(n?`systemPermissionsCard.speechRecognitionWindowsDescription`:`systemPermissionsCard.speechRecognitionDescription`)};case`notifications`:return{label:t(`systemPermissionsCard.notificationsLabel`),description:t(n?`systemPermissionsCard.notificationsWindowsDescription`:`systemPermissionsCard.notificationsDescription`)};default:throw Error(`Unsupported system permission row: ${e}`)}}function Te(){let[e,t]=(0,Y.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function Ee(){let[e,t]=(0,Y.useState)(()=>H(`dockBadgesEnabled`,!0));return(0,Y.useEffect)(()=>be(`dockBadgesEnabled`,()=>{t(H(`dockBadgesEnabled`,!0))}),[]),[e,e=>{t(e),z(`dockBadgesEnabled`,e),e||N(0)}]}function De({row:e,onToggle:t}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(L,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:y(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,X.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,X.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,X.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function Oe(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--content-tertiary)]`})}function ke({compact:e=!1}){let{t}=a(),{state:n,loading:r,error:i,supported:o,refresh:s}=O(),{pendingKind:c,run:l}=Te(),[u,d]=Ee(),f=le()===`windows`,p=(0,Y.useMemo)(()=>Se.filter(e=>!f||e.availableOnWindows),[f]),m=(0,Y.useMemo)(()=>{let e=new Map;if(!n)return e;for(let t of p){let r=n[t.sourceKind];r&&r.status!==`not-applicable`&&e.set(t.id,{meta:t,item:r})}return e},[n,p]),h=(0,Y.useMemo)(()=>{let e=p.map(e=>{let n=m.get(e.id)?.item;if(!n)return null;let r=we(e.id,t,f);return{id:e.id,label:r.label,description:r.description,checked:n.status===`granted`,disabled:c===e.id||n.status===`restricted`,...n.error?{error:n.error}:{}}}).filter(Boolean),n=b()===`taskbar icon`?t(`systemPermissionsCard.taskbarIcon`):t(`systemPermissionsCard.dockIcon`),r=T()?Ce.map(e=>({id:e.id,label:t(`systemPermissionsCard.notificationBadgesLabel`),description:t(`systemPermissionsCard.notificationBadgesDescription`,{surface:n}),checked:u,disabled:c===e.id})):[];return[...e,...r]},[f,u,c,m,t,p]);if(!o&&h.length===0)return null;let g=async(e,t)=>{t.status===`granted`||t.status===`denied`||!t.canRequest?await de(e.sourceKind):await te(e.sourceKind),await s()},_=e=>{let t=m.get(e);if(t){l(e,()=>g(t.meta,t.item));return}e===`notificationBadges`&&l(e,async()=>{d(!u)})};return(0,X.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,X.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:t(`systemPermissionsCard.title`)}),r&&h.length===0?(0,X.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(Oe,{}),t(`systemPermissionsCard.checking`)]}):(0,X.jsx)(`div`,{className:`mt-3 space-y-2`,children:h.map(e=>(0,X.jsx)(De,{row:e,onToggle:_},e.id))}),i&&(0,X.jsx)(`div`,{role:`alert`,className:`mt-6 rounded-md border border-[color-mix(in_srgb,var(--system-negative-strong)_25%,transparent)] bg-[var(--system-negative-weak)] p-3 text-body-medium-lighter text-[var(--content-secondary)]`,children:i})]})}function Ae(){let{t:e}=a(`settings`),n=D({platformHostedOnly:!0}),o=v(),s=ue(),c=i(),{data:l,isLoading:u,isError:d}=r({...F(),enabled:n===`full`&&o}),f=t({mutationFn:async e=>{let{data:t}=await fe({body:{access_consented:e},throwOnError:!0});return t},onSuccess:t=>{A(c,void 0,t),R.success(t?.access_consented?e(`accessConsentSetting.toastEnabled`):e(`accessConsentSetting.toastDisabled`))},onError:()=>{R.error(e(`accessConsentSetting.toastUpdateFailed`))}});if(n===`gated`)return null;let m=n===`full`&&s,h=l?.access_consented??!1,g=n!==`full`||!o||u||d||f.isPending;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`accessConsentSetting.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`accessConsentSetting.description`)}),n===`full`&&d&&(0,X.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`accessConsentSetting.loadError`)})]}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:n===`disabled`?null:(0,X.jsxs)(X.Fragment,{children:[(f.isPending||m)&&(0,X.jsx)(p,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,X.jsx)(L,{checked:h,disabled:g,onChange:()=>f.mutate(!h)})]})})]}),n===`disabled`&&(0,X.jsx)(_,{className:`mt-3`,children:e(`accessConsentSetting.loginNotice`)})]})}function je(){let{t:e}=a(`settings`),t=re(),n=x(),[r,i]=(0,Y.useState)(()=>pe()),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1);if((0,Y.useEffect)(()=>{if(!t)return;let e=!0;return ge().then(t=>{e&&s(t)}),()=>{e=!1}},[t]),!t||!o?.available)return null;let u=async()=>{l(!0);try{if(r)B(!1),await oe(),i(!1);else{let e=_e();if(!e||!await ce(e)){B(!1),i(!1);return}B(!0),i(!0)}}finally{l(!1)}};return(0,X.jsx)(q,{title:e(`biometricSettingsCard.title`),children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`biometricSettingsCard.useForSignIn`,{label:o.label})}),(0,X.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(n?`biometricSettingsCard.descriptionWithPasscode`:`biometricSettingsCard.description`,{label:o.label})})]}),(0,X.jsx)(L,{checked:r,onChange:()=>void u(),disabled:c})]})})}var Z=[`youtube.com`,`youtu.be`,`vimeo.com`,`loom.com`];function Me(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return[...Z]}function Ne(){return H(`mediaEmbedsEnabled`,!0)}function Pe(){let e=V(`mediaEmbedDomains`,``);return e?Me(e):[...Z]}function Fe(){let{t:e}=a(`settings`),[t,n]=(0,Y.useState)(()=>Ne()),[r,i]=(0,Y.useState)(()=>Pe()),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(``),d=(0,Y.useMemo)(()=>c.trim().toLowerCase(),[c]),f=e=>{n(e),z(`mediaEmbedsEnabled`,e)},p=e=>{i(e),I(`mediaEmbedDomains`,JSON.stringify(e))},g=()=>{if(d){if(r.includes(d)){u(``);return}p([...r,d]),u(``)}},_=e=>{p(r.filter(t=>t!==e))},v=()=>{p([...Z])},y=r.length===Z.length&&r.every((e,t)=>e===Z[t]);return(0,X.jsxs)(q,{title:e(`mediaEmbedsCard.title`),subtitle:e(`mediaEmbedsCard.subtitle`),children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`mediaEmbedsCard.autoToggle`)}),(0,X.jsx)(L,{checked:t,onChange:f})]}),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(xe,{})}),(0,X.jsxs)(S,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),className:`mt-4 w-full justify-between px-3`,"aria-expanded":o,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o?(0,X.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}):(0,X.jsx)(l,{className:`h-4 w-4`,"aria-hidden":!0}),e(`mediaEmbedsCard.allowlist`)]}),(0,X.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`mediaEmbedsCard.domainCount`,{count:r.length})})]}),o&&(0,X.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,X.jsx)(W,{label:e(`mediaEmbedsCard.addDomainLabel`),type:`text`,value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},placeholder:e(`mediaEmbedsCard.addDomainPlaceholder`),fullWidth:!0,wrapperClassName:`flex-1`}),(0,X.jsx)(S,{variant:`primary`,size:`compact`,onClick:g,disabled:!d,children:e(`mediaEmbedsCard.add`)})]}),r.length>0&&(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(S,{type:`button`,variant:`ghost`,size:`compact`,onClick:v,disabled:y,tintColor:`var(--content-tertiary)`,children:e(`mediaEmbedsCard.resetDefaults`)})}),r.length>0&&(0,X.jsx)(`ul`,{className:`space-y-2`,children:r.map(t=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] px-3 py-2 text-body-medium-lighter`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[var(--content-default)]`,children:t}),(0,X.jsx)(S,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,X.jsx)(m,{}),onClick:()=>_(t),"aria-label":e(`mediaEmbedsCard.removeDomainAria`,{domain:t})})]},t))})]})]})]})}function Q(){return(0,X.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Ie(){let{t:e}=a(`settings`),t=P(),n=(0,Y.useMemo)(()=>C.map(t=>({value:t.id,label:e(t.labelKey,t.label),icon:(0,X.jsx)(t.icon,{className:`h-3.5 w-3.5`})})),[e]),o=i(),{data:s,isError:c}=r({queryKey:[`thresholds`,t],queryFn:()=>ee(t),staleTime:3e4}),[u,d]=(0,Y.useState)(`relaxed`),[f,p]=(0,Y.useState)(`conservative`),[m,g]=(0,Y.useState)(`strict`),[_,v]=(0,Y.useState)(!1),y=(0,Y.useRef)(!1),[b,x]=(0,Y.useState)(!1),S=(0,Y.useRef)(null),w=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{!s||y.current||(d(E(s.interactive).id),p(E(s.autonomous).id),g(E(s.headless).id),x(!0))},[s]),(0,Y.useEffect)(()=>()=>{S.current!==null&&(clearTimeout(S.current),S.current=null,w.current?.(),w.current=null)},[]);let T=(0,Y.useCallback)((e,n,r)=>{if(!t||!b)return;let i=C.find(t=>t.id===e)?.riskThreshold,a=C.find(e=>e.id===n)?.riskThreshold,s=C.find(e=>e.id===r)?.riskThreshold;!i||!a||!s||ne(t,{interactive:i,autonomous:a,headless:s}).then(()=>{o.invalidateQueries({queryKey:[`thresholds`,t]})}).catch(()=>{})},[t,b,o]),D=(0,Y.useCallback)((e,t,n)=>{S.current!==null&&clearTimeout(S.current),w.current=()=>T(e,t,n),S.current=setTimeout(()=>{w.current?.(),S.current=null,w.current=null},500)},[T]),te=(0,Y.useCallback)(e=>{y.current=!0,d(e),D(e,f,m)},[f,m,D]),O=(0,Y.useCallback)(e=>{y.current=!0,p(e),D(u,e,m)},[u,m,D]),k=(0,Y.useCallback)(e=>{y.current=!0,g(e),D(u,f,e)},[u,f,D]),A=C.find(e=>e.id===u),N=C.find(e=>e.id===f),F=C.find(e=>e.id===m),I=!t||!b;return(0,X.jsxs)(M,{children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`riskToleranceSettings.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.description`)}),c&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`riskToleranceSettings.loadError`)}),(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.conversationsTitle`)}),(0,X.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.conversationsDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:u,onChange:te,options:n,disabled:I})}),A&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(A.descriptionKey,A.description)})]}),(0,X.jsx)(Q,{}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>v(e=>!e),className:`flex items-center gap-1 text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,"aria-expanded":_,children:[_?(0,X.jsx)(h,{className:`h-4 w-4`}):(0,X.jsx)(l,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`text-body-medium-default`,children:e(`riskToleranceSettings.advanced`)})]}),(0,X.jsxs)(`div`,{className:_?`mt-4 space-y-4`:`hidden`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.backgroundTitle`)}),(0,X.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.backgroundDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:f,onChange:O,options:n,disabled:I})}),N&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(N.descriptionKey,N.description)})]}),(0,X.jsx)(Q,{}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.headlessTitle`)}),(0,X.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.headlessDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:m,onChange:k,options:n,disabled:I})}),F&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(F.descriptionKey,F.description)})]})]})]})]})]})}var Le=e(c(),1),Re=[`bash`,`file_read`,`file_write`,`file_edit`,`web_fetch`,`skill_load`];function ze({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let{t:i}=a(`settings`),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)(t.tool),[l,u]=(0,Y.useState)(t.pattern),[d,p]=(0,Y.useState)(t.risk),[m,h]=(0,Y.useState)(t.description??``),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),b=[{value:`low`,label:i(`trustRuleFormModal.riskLow`),description:i(`trustRuleFormModal.riskLowDescription`)},{value:`medium`,label:i(`trustRuleFormModal.riskMedium`),description:i(`trustRuleFormModal.riskMediumDescription`)},{value:`high`,label:i(`trustRuleFormModal.riskHigh`),description:i(`trustRuleFormModal.riskHighDescription`)}],x=l.trim(),S=x.length>0&&!g,C=i(`trustRuleFormModal.defaultDescription`,{tool:s,pattern:x||i(`trustRuleFormModal.patternFallback`)}),w=(0,Y.useCallback)(async n=>{if(n.preventDefault(),!S)return;let a=m.trim()||C;_(!0),y(null);try{await me(e,t.id,{risk:d,description:a}),r()}catch(e){y(e instanceof Error?e.message:i(`trustRuleFormModal.saveFailed`))}finally{_(!1)}},[e,S,C,m,t,r,d,i]);return(0,Le.createPortal)((0,X.jsx)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rule-form-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,Y.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),n())},[n]),onClick:(0,Y.useCallback)(e=>{e.target===o.current&&n()},[n]),children:(0,X.jsxs)(`div`,{className:`mx-4 flex max-h-[calc(100vh-2rem)] w-full max-w-md flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,X.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:i(`trustRuleFormModal.title`)}),(0,X.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(`trustRuleFormModal.closeAriaLabel`),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,X.jsx)(f,{className:`h-4 w-4`})})]}),(0,X.jsxs)(`form`,{onSubmit:e=>void w(e),className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4`,children:[v&&(0,X.jsx)(G,{tone:`error`,children:v}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.toolLabel`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(j,{value:s,onChange:c,disabled:!0,options:Re.map(e=>({value:e,label:e}))})})]}),(0,X.jsx)(W,{label:i(`trustRuleFormModal.patternLabel`),type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:i(`trustRuleFormModal.patternPlaceholder`),disabled:!0}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.riskLevelLabel`)}),(0,X.jsx)(`div`,{className:`mt-2 flex gap-2`,children:b.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>p(e.value),className:`flex-1 rounded-lg border px-3 py-2 text-left text-body-small-default transition-colors ${d===e.value?e.value===`low`?`border-[var(--system-positive-strong)] bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`:e.value===`medium`?`border-[var(--system-warning-strong)] bg-[var(--system-warning-weak)] text-[var(--system-warning-strong)]`:`border-[var(--system-negative-strong)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] text-[var(--content-default)] hover:bg-[var(--surface-base)]`}`,children:[(0,X.jsx)(`div`,{children:e.label}),(0,X.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,X.jsx)(W,{label:i(`trustRuleFormModal.descriptionLabel`),type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:C}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-[var(--border-element)] bg-white px-4 py-2 text-body-medium-default text-[var(--content-default)] transition-colors hover:bg-[var(--surface-base)] dark:border-[var(--border-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:i(`trustRuleFormModal.cancel`)}),(0,X.jsx)(`button`,{type:`submit`,disabled:!S,className:`rounded-lg bg-[var(--system-positive-strong)] px-4 py-2 text-body-medium-default text-white transition-colors hover:bg-[var(--system-positive-strong)] disabled:cursor-not-allowed disabled:opacity-50`,children:i(g?`trustRuleFormModal.saving`:`trustRuleFormModal.save`)})]})]})]})}),document.body)}function Be(e){return e.origin===`default`&&!e.userModified}function Ve(e,t){let n=new Set,r=[];for(let t of e)n.has(t.id)||(n.add(t.id),r.push(t));for(let e of t)n.has(e.id)||(n.add(e.id),r.push(e));return r.sort((e,t)=>e.tool===t.tool?e.description.localeCompare(t.description):e.tool.localeCompare(t.tool))}function He(e){switch(e){case`low`:return`positive`;case`medium`:return`warning`;case`high`:return`negative`}}function Ue({assistantId:e,onClose:t}){let{t:n}=a(`settings`),r=(0,Y.useRef)(null),[i,o]=(0,Y.useState)([]),[s,c]=(0,Y.useState)(!0),[l,f]=(0,Y.useState)(null),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),b=(0,Y.useCallback)(e=>{switch(e){case`low`:return n(`trustRulesModal.riskLow`);case`medium`:return n(`trustRulesModal.riskMedium`);case`high`:return n(`trustRulesModal.riskHigh`)}},[n]),x=(0,Y.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([U(e),U(e,{origin:`default`})]);return Ve(t,n)}return U(e)},[e]),C=(0,Y.useCallback)(async()=>{c(!0);try{o(await x(v)),f(null)}catch(e){f(e instanceof Error?e.message:n(`trustRulesModal.loadErrorFallback`))}finally{c(!1)}},[x,v,n]);(0,Y.useEffect)(()=>{let e=!1;return(async()=>{c(!0);try{let t=await x(v);e||(o(t),f(null))}catch(t){e||f(t instanceof Error?t.message:n(`trustRulesModal.loadErrorFallback`))}finally{e||c(!1)}})(),()=>{e=!0}},[x,v,n]);let w=(0,Y.useCallback)(async()=>{if(g)try{await se(e,g.id),C()}catch(e){f(e instanceof Error?e.message:n(`trustRulesModal.deleteErrorFallback`))}finally{_(null)}},[e,g,C,n]);return(0,Le.createPortal)((0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{ref:r,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rules-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,Y.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),t())},[t]),onClick:(0,Y.useCallback)(e=>{e.target===r.current&&t()},[t]),children:(0,X.jsxs)(`div`,{className:`mx-4 flex max-h-[80vh] w-full max-w-2xl flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,X.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:n(`trustRulesModal.title`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(L,{checked:v,onChange:y,label:n(`trustRulesModal.showAllDefaults`)}),(0,X.jsx)(S,{variant:`outlined`,onClick:t,children:n(`trustRulesModal.done`)})]})]}),(0,X.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[l&&(0,X.jsx)(`div`,{className:`mb-3`,children:(0,X.jsx)(G,{tone:`error`,children:l})}),s?(0,X.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`trustRulesModal.loading`)}):i.length===0?(0,X.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,X.jsx)(u,{className:`h-8 w-8`}),(0,X.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:n(`trustRulesModal.empty`)})]}):(0,X.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:i.map(e=>{let t=Be(e);return(0,X.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,X.jsx)(K,{tone:He(e.risk),children:b(e.risk)}),e.origin===`default`&&(0,X.jsx)(K,{tone:`neutral`,children:n(`trustRulesModal.defaultTag`)}),e.userModified&&(0,X.jsx)(K,{tone:`warning`,children:n(`trustRulesModal.modifiedTag`)})]}),(0,X.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,X.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":n(`trustRulesModal.editRuleAria`,{tool:e.tool}),onClick:()=>h(e),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,X.jsx)(d,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,X.jsx)(S,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,X.jsx)(m,{className:`h-4 w-4`}),"aria-label":n(`trustRulesModal.deleteRuleAria`,{tool:e.tool}),onClick:()=>_(e)})]})]},e.id)})})]})]})}),p&&(0,X.jsx)(ze,{assistantId:e,existingRule:p,onClose:()=>h(null),onSaved:()=>{h(null),C()}}),(0,X.jsx)(ve,{open:g!==null,title:n(`trustRulesModal.deleteTitle`),message:g?n(`trustRulesModal.deleteMessage`,{risk:b(g.risk).toLowerCase(),tool:g.tool,pattern:g.pattern}):``,confirmLabel:n(`trustRulesModal.delete`),cancelLabel:n(`trustRulesModal.cancel`),destructive:!0,onConfirm:()=>void w(),onCancel:()=>_(null)})]}),document.body)}function We(){let{t:e}=a(`settings`),t=P(),[n,r]=(0,Y.useState)(!1);return(0,X.jsxs)(M,{children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(u,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`trustRules.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`trustRules.description`)})]}),(0,X.jsx)(S,{variant:`outlined`,onClick:()=>r(!0),children:e(`trustRules.manage`)})]}),n&&(0,X.jsx)(Ue,{assistantId:t,onClose:()=>r(!1)})]})}var Ge=[{value:`dontRetain`,labelKey:`privacyPage.retentionDontRetain`},{value:`oneHour`,labelKey:`privacyPage.retentionOneHour`},{value:`oneDay`,labelKey:`privacyPage.retentionOneDay`},{value:`sevenDays`,labelKey:`privacyPage.retentionSevenDays`},{value:`thirtyDays`,labelKey:`privacyPage.retentionThirtyDays`},{value:`ninetyDays`,labelKey:`privacyPage.retentionNinetyDays`},{value:`keepForever`,labelKey:`privacyPage.retentionKeepForever`}],Ke=`thirtyDays`;function $(){return(0,X.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function qe(){let{t:e}=a(`settings`),t=D({platformHostedOnly:!0}),r=w(),i=r,o=k.use.user()?.id??null,[s]=g(),[c]=ae(),l=s??!0,u=c??!0,[d,f]=(0,Y.useState)(()=>V(`llmLogRetention`,Ke)),p=(0,Y.useMemo)(()=>Ge.map(t=>({value:t.value,label:e(t.labelKey)})),[e]);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(je,{}),(0,X.jsx)(ke,{}),(0,X.jsx)(We,{}),(0,X.jsx)(Ie,{}),(0,X.jsx)(Fe,{}),(0,X.jsx)(q,{title:e(`privacyPage.title`),subtitle:r?(0,X.jsx)(n,{ns:`settings`,i18nKey:`privacyPage.subtitleWithPolicy`,components:{policyLink:(0,X.jsx)(`a`,{href:ye(ie.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`})}}):void 0,children:(0,X.jsxs)(`div`,{className:`space-y-4`,children:[i&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(J,{label:e(`privacyPage.shareAnalyticsLabel`),helperText:e(`privacyPage.shareAnalyticsHelper`),checked:l,onChange:()=>{he(`share_analytics`,!l,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,X.jsx)($,{}),(0,X.jsx)(J,{label:e(`privacyPage.shareDiagnosticsLabel`),helperText:e(`privacyPage.shareDiagnosticsHelper`),checked:u,onChange:()=>{he(`share_diagnostics`,!u,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,X.jsx)($,{})]}),(0,X.jsx)(Ae,{}),t!==`gated`&&(0,X.jsx)($,{}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:e(`privacyPage.llmLogRetentionLabel`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:d,onChange:e=>{f(e),I(`llmLogRetention`,e)},options:p})}),(0,X.jsx)(`p`,{className:`mt-2 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`privacyPage.llmLogRetentionDescription`)})]})]})})]})}export{qe as PrivacyPage};
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{Jn as t,N as n,Zn as r,er as i,j as a}from"./vendor-CYfJo8gP.js";import{b as o,t as s,y as c}from"./react-DPM_L_aA.js";import{Lr as l,U as u,_t as d,i as f,tn as p,x as m,zr as h}from"./icons-CSdHOix6.js";import{$l as g,$t as _,Af as v,Ay as y,Bi as b,Dp as x,Dy as S,F as C,Ff as w,Hi as T,I as E,L as ee,Mf as D,Ml as te,Nl as O,Pf as k,Qs as A,Qv as j,R as ne,Ty as M,Vi as N,Y as P,Zs as F,_v as I,_y as L,cy as R,dg as re,dv as ie,eu as ae,fg as oe,fr as se,gg as ce,gv as z,hg as B,hp as le,hv as V,jf as ue,jl as de,lm as fe,mg as pe,mr as me,mv as H,op as he,pg as ge,pr as U,sg as _e,sy as ve,uv as ye,vv as be,vy as W,wy as G,xy as K}from"./index-b_IQShc9.js";import{t as q}from"./detail-card-sxGt13nZ.js";import{t as J}from"./setting-row-JfvUWIUE.js";import{t as xe}from"./settings-divider-BDaGinDZ.js";var Y=e(o(),1),X=s(),Se=[{id:`accessibility`,type:`system`,sourceKind:`accessibility`},{id:`screen`,type:`system`,sourceKind:`screen`,availableOnWindows:!0},{id:`microphone`,type:`system`,sourceKind:`microphone`,availableOnWindows:!0},{id:`speechRecognition`,type:`system`,sourceKind:`speechRecognition`,availableOnWindows:!0},{id:`notifications`,type:`system`,sourceKind:`notifications`,availableOnWindows:!0}],Ce=[{id:`notificationBadges`,type:`local`}];function we(e,t,n){switch(e){case`accessibility`:return{label:t(`systemPermissionsCard.accessibilityLabel`),description:t(`systemPermissionsCard.accessibilityDescription`)};case`screen`:return{label:t(`systemPermissionsCard.screenLabel`),description:t(`systemPermissionsCard.screenDescription`)};case`microphone`:return{label:t(`systemPermissionsCard.microphoneLabel`),description:t(`systemPermissionsCard.microphoneDescription`)};case`speechRecognition`:return{label:t(`systemPermissionsCard.speechRecognitionLabel`),description:t(n?`systemPermissionsCard.speechRecognitionWindowsDescription`:`systemPermissionsCard.speechRecognitionDescription`)};case`notifications`:return{label:t(`systemPermissionsCard.notificationsLabel`),description:t(n?`systemPermissionsCard.notificationsWindowsDescription`:`systemPermissionsCard.notificationsDescription`)};default:throw Error(`Unsupported system permission row: ${e}`)}}function Te(){let[e,t]=(0,Y.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function Ee(){let[e,t]=(0,Y.useState)(()=>H(`dockBadgesEnabled`,!0));return(0,Y.useEffect)(()=>be(`dockBadgesEnabled`,()=>{t(H(`dockBadgesEnabled`,!0))}),[]),[e,e=>{t(e),z(`dockBadgesEnabled`,e),e||N(0)}]}function De({row:e,onToggle:t}){return(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(L,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:y(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,X.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,X.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,X.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function Oe(){return(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`h-4 w-4 animate-spin rounded-full border-2 border-[var(--border-base)] border-t-[var(--content-tertiary)]`})}function ke({compact:e=!1}){let{t}=a(),{state:n,loading:r,error:i,supported:o,refresh:s}=O(),{pendingKind:c,run:l}=Te(),[u,d]=Ee(),f=le()===`windows`,p=(0,Y.useMemo)(()=>Se.filter(e=>!f||e.availableOnWindows),[f]),m=(0,Y.useMemo)(()=>{let e=new Map;if(!n)return e;for(let t of p){let r=n[t.sourceKind];r&&r.status!==`not-applicable`&&e.set(t.id,{meta:t,item:r})}return e},[n,p]),h=(0,Y.useMemo)(()=>{let e=p.map(e=>{let n=m.get(e.id)?.item;if(!n)return null;let r=we(e.id,t,f);return{id:e.id,label:r.label,description:r.description,checked:n.status===`granted`,disabled:c===e.id||n.status===`restricted`,...n.error?{error:n.error}:{}}}).filter(Boolean),n=b()===`taskbar icon`?t(`systemPermissionsCard.taskbarIcon`):t(`systemPermissionsCard.dockIcon`),r=T()?Ce.map(e=>({id:e.id,label:t(`systemPermissionsCard.notificationBadgesLabel`),description:t(`systemPermissionsCard.notificationBadgesDescription`,{surface:n}),checked:u,disabled:c===e.id})):[];return[...e,...r]},[f,u,c,m,t,p]);if(!o&&h.length===0)return null;let g=async(e,t)=>{t.status===`granted`||t.status===`denied`||!t.canRequest?await de(e.sourceKind):await te(e.sourceKind),await s()},_=e=>{let t=m.get(e);if(t){l(e,()=>g(t.meta,t.item));return}e===`notificationBadges`&&l(e,async()=>{d(!u)})};return(0,X.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,X.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:t(`systemPermissionsCard.title`)}),r&&h.length===0?(0,X.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,X.jsx)(Oe,{}),t(`systemPermissionsCard.checking`)]}):(0,X.jsx)(`div`,{className:`mt-3 space-y-2`,children:h.map(e=>(0,X.jsx)(De,{row:e,onToggle:_},e.id))}),i&&(0,X.jsx)(`div`,{role:`alert`,className:`mt-6 rounded-md border border-[color-mix(in_srgb,var(--system-negative-strong)_25%,transparent)] bg-[var(--system-negative-weak)] p-3 text-body-medium-lighter text-[var(--content-secondary)]`,children:i})]})}function Ae(){let{t:e}=a(`settings`),n=D({platformHostedOnly:!0}),o=v(),s=ue(),c=i(),{data:l,isLoading:u,isError:d}=r({...F(),enabled:n===`full`&&o}),f=t({mutationFn:async e=>{let{data:t}=await fe({body:{access_consented:e},throwOnError:!0});return t},onSuccess:t=>{A(c,void 0,t),R.success(t?.access_consented?e(`accessConsentSetting.toastEnabled`):e(`accessConsentSetting.toastDisabled`))},onError:()=>{R.error(e(`accessConsentSetting.toastUpdateFailed`))}});if(n===`gated`)return null;let m=n===`full`&&s,h=l?.access_consented??!1,g=n!==`full`||!o||u||d||f.isPending;return(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`accessConsentSetting.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`accessConsentSetting.description`)}),n===`full`&&d&&(0,X.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`accessConsentSetting.loadError`)})]}),(0,X.jsx)(`div`,{className:`flex items-center gap-2`,children:n===`disabled`?null:(0,X.jsxs)(X.Fragment,{children:[(f.isPending||m)&&(0,X.jsx)(p,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,X.jsx)(L,{checked:h,disabled:g,onChange:()=>f.mutate(!h)})]})})]}),n===`disabled`&&(0,X.jsx)(_,{className:`mt-3`,children:e(`accessConsentSetting.loginNotice`)})]})}function je(){let{t:e}=a(`settings`),t=re(),n=x(),[r,i]=(0,Y.useState)(()=>pe()),[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(!1);if((0,Y.useEffect)(()=>{if(!t)return;let e=!0;return ge().then(t=>{e&&s(t)}),()=>{e=!1}},[t]),!t||!o?.available)return null;let u=async()=>{l(!0);try{if(r)B(!1),await oe(),i(!1);else{let e=_e();if(!e||!await ce(e)){B(!1),i(!1);return}B(!0),i(!0)}}finally{l(!1)}};return(0,X.jsx)(q,{title:e(`biometricSettingsCard.title`),children:(0,X.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`biometricSettingsCard.useForSignIn`,{label:o.label})}),(0,X.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(n?`biometricSettingsCard.descriptionWithPasscode`:`biometricSettingsCard.description`,{label:o.label})})]}),(0,X.jsx)(L,{checked:r,onChange:()=>void u(),disabled:c})]})})}var Z=[`youtube.com`,`youtu.be`,`vimeo.com`,`loom.com`];function Me(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return[...Z]}function Ne(){return H(`mediaEmbedsEnabled`,!0)}function Pe(){let e=V(`mediaEmbedDomains`,``);return e?Me(e):[...Z]}function Fe(){let{t:e}=a(`settings`),[t,n]=(0,Y.useState)(()=>Ne()),[r,i]=(0,Y.useState)(()=>Pe()),[o,s]=(0,Y.useState)(!1),[c,u]=(0,Y.useState)(``),d=(0,Y.useMemo)(()=>c.trim().toLowerCase(),[c]),f=e=>{n(e),z(`mediaEmbedsEnabled`,e)},p=e=>{i(e),I(`mediaEmbedDomains`,JSON.stringify(e))},g=()=>{if(d){if(r.includes(d)){u(``);return}p([...r,d]),u(``)}},_=e=>{p(r.filter(t=>t!==e))},v=()=>{p([...Z])},y=r.length===Z.length&&r.every((e,t)=>e===Z[t]);return(0,X.jsxs)(q,{title:e(`mediaEmbedsCard.title`),subtitle:e(`mediaEmbedsCard.subtitle`),children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`mediaEmbedsCard.autoToggle`)}),(0,X.jsx)(L,{checked:t,onChange:f})]}),t&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{className:`mt-4`,children:(0,X.jsx)(xe,{})}),(0,X.jsxs)(S,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),className:`mt-4 w-full justify-between px-3`,"aria-expanded":o,children:[(0,X.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o?(0,X.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}):(0,X.jsx)(l,{className:`h-4 w-4`,"aria-hidden":!0}),e(`mediaEmbedsCard.allowlist`)]}),(0,X.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`mediaEmbedsCard.domainCount`,{count:r.length})})]}),o&&(0,X.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,X.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,X.jsx)(W,{label:e(`mediaEmbedsCard.addDomainLabel`),type:`text`,value:c,onChange:e=>u(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},placeholder:e(`mediaEmbedsCard.addDomainPlaceholder`),fullWidth:!0,wrapperClassName:`flex-1`}),(0,X.jsx)(S,{variant:`primary`,size:`compact`,onClick:g,disabled:!d,children:e(`mediaEmbedsCard.add`)})]}),r.length>0&&(0,X.jsx)(`div`,{className:`flex justify-end`,children:(0,X.jsx)(S,{type:`button`,variant:`ghost`,size:`compact`,onClick:v,disabled:y,tintColor:`var(--content-tertiary)`,children:e(`mediaEmbedsCard.resetDefaults`)})}),r.length>0&&(0,X.jsx)(`ul`,{className:`space-y-2`,children:r.map(t=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] px-3 py-2 text-body-medium-lighter`,children:[(0,X.jsx)(`span`,{className:`font-mono text-[var(--content-default)]`,children:t}),(0,X.jsx)(S,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,X.jsx)(m,{}),onClick:()=>_(t),"aria-label":e(`mediaEmbedsCard.removeDomainAria`,{domain:t})})]},t))})]})]})]})}function Q(){return(0,X.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Ie(){let{t:e}=a(`settings`),t=P(),n=(0,Y.useMemo)(()=>C.map(t=>({value:t.id,label:e(t.labelKey,t.label),icon:(0,X.jsx)(t.icon,{className:`h-3.5 w-3.5`})})),[e]),o=i(),{data:s,isError:c}=r({queryKey:[`thresholds`,t],queryFn:()=>ee(t),staleTime:3e4}),[u,d]=(0,Y.useState)(`relaxed`),[f,p]=(0,Y.useState)(`conservative`),[m,g]=(0,Y.useState)(`strict`),[_,v]=(0,Y.useState)(!1),y=(0,Y.useRef)(!1),[b,x]=(0,Y.useState)(!1),S=(0,Y.useRef)(null),w=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{!s||y.current||(d(E(s.interactive).id),p(E(s.autonomous).id),g(E(s.headless).id),x(!0))},[s]),(0,Y.useEffect)(()=>()=>{S.current!==null&&(clearTimeout(S.current),S.current=null,w.current?.(),w.current=null)},[]);let T=(0,Y.useCallback)((e,n,r)=>{if(!t||!b)return;let i=C.find(t=>t.id===e)?.riskThreshold,a=C.find(e=>e.id===n)?.riskThreshold,s=C.find(e=>e.id===r)?.riskThreshold;!i||!a||!s||ne(t,{interactive:i,autonomous:a,headless:s}).then(()=>{o.invalidateQueries({queryKey:[`thresholds`,t]})}).catch(()=>{})},[t,b,o]),D=(0,Y.useCallback)((e,t,n)=>{S.current!==null&&clearTimeout(S.current),w.current=()=>T(e,t,n),S.current=setTimeout(()=>{w.current?.(),S.current=null,w.current=null},500)},[T]),te=(0,Y.useCallback)(e=>{y.current=!0,d(e),D(e,f,m)},[f,m,D]),O=(0,Y.useCallback)(e=>{y.current=!0,p(e),D(u,e,m)},[u,m,D]),k=(0,Y.useCallback)(e=>{y.current=!0,g(e),D(u,f,e)},[u,f,D]),A=C.find(e=>e.id===u),N=C.find(e=>e.id===f),F=C.find(e=>e.id===m),I=!t||!b;return(0,X.jsxs)(M,{children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`riskToleranceSettings.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.description`)}),c&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`riskToleranceSettings.loadError`)}),(0,X.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.conversationsTitle`)}),(0,X.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.conversationsDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:u,onChange:te,options:n,disabled:I})}),A&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(A.descriptionKey,A.description)})]}),(0,X.jsx)(Q,{}),(0,X.jsxs)(`div`,{children:[(0,X.jsxs)(`button`,{type:`button`,onClick:()=>v(e=>!e),className:`flex items-center gap-1 text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,"aria-expanded":_,children:[_?(0,X.jsx)(h,{className:`h-4 w-4`}):(0,X.jsx)(l,{className:`h-4 w-4`}),(0,X.jsx)(`span`,{className:`text-body-medium-default`,children:e(`riskToleranceSettings.advanced`)})]}),(0,X.jsxs)(`div`,{className:_?`mt-4 space-y-4`:`hidden`,children:[(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.backgroundTitle`)}),(0,X.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.backgroundDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:f,onChange:O,options:n,disabled:I})}),N&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(N.descriptionKey,N.description)})]}),(0,X.jsx)(Q,{}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.headlessTitle`)}),(0,X.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.headlessDescription`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:m,onChange:k,options:n,disabled:I})}),F&&(0,X.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(F.descriptionKey,F.description)})]})]})]})]})]})}var Le=e(c(),1),Re=[`bash`,`file_read`,`file_write`,`file_edit`,`web_fetch`,`skill_load`];function ze({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let{t:i}=a(`settings`),o=(0,Y.useRef)(null),[s,c]=(0,Y.useState)(t.tool),[l,u]=(0,Y.useState)(t.pattern),[d,p]=(0,Y.useState)(t.risk),[m,h]=(0,Y.useState)(t.description??``),[g,_]=(0,Y.useState)(!1),[v,y]=(0,Y.useState)(null),b=[{value:`low`,label:i(`trustRuleFormModal.riskLow`),description:i(`trustRuleFormModal.riskLowDescription`)},{value:`medium`,label:i(`trustRuleFormModal.riskMedium`),description:i(`trustRuleFormModal.riskMediumDescription`)},{value:`high`,label:i(`trustRuleFormModal.riskHigh`),description:i(`trustRuleFormModal.riskHighDescription`)}],x=l.trim(),S=x.length>0&&!g,C=i(`trustRuleFormModal.defaultDescription`,{tool:s,pattern:x||i(`trustRuleFormModal.patternFallback`)}),w=(0,Y.useCallback)(async n=>{if(n.preventDefault(),!S)return;let a=m.trim()||C;_(!0),y(null);try{await me(e,t.id,{risk:d,description:a}),r()}catch(e){y(e instanceof Error?e.message:i(`trustRuleFormModal.saveFailed`))}finally{_(!1)}},[e,S,C,m,t,r,d,i]);return(0,Le.createPortal)((0,X.jsx)(`div`,{ref:o,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rule-form-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,Y.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),n())},[n]),onClick:(0,Y.useCallback)(e=>{e.target===o.current&&n()},[n]),children:(0,X.jsxs)(`div`,{className:`mx-4 flex max-h-[calc(100vh-2rem)] w-full max-w-md flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,X.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:i(`trustRuleFormModal.title`)}),(0,X.jsx)(`button`,{type:`button`,onClick:n,"aria-label":i(`trustRuleFormModal.closeAriaLabel`),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,X.jsx)(f,{className:`h-4 w-4`})})]}),(0,X.jsxs)(`form`,{onSubmit:e=>void w(e),className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4`,children:[v&&(0,X.jsx)(G,{tone:`error`,children:v}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.toolLabel`)}),(0,X.jsx)(`div`,{className:`mt-1`,children:(0,X.jsx)(j,{value:s,onChange:c,disabled:!0,options:Re.map(e=>({value:e,label:e}))})})]}),(0,X.jsx)(W,{label:i(`trustRuleFormModal.patternLabel`),type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:i(`trustRuleFormModal.patternPlaceholder`),disabled:!0}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.riskLevelLabel`)}),(0,X.jsx)(`div`,{className:`mt-2 flex gap-2`,children:b.map(e=>(0,X.jsxs)(`button`,{type:`button`,onClick:()=>p(e.value),className:`flex-1 rounded-lg border px-3 py-2 text-left text-body-small-default transition-colors ${d===e.value?e.value===`low`?`border-[var(--system-positive-strong)] bg-[var(--system-positive-weak)] text-[var(--system-positive-strong)]`:e.value===`medium`?`border-[var(--system-warning-strong)] bg-[var(--system-warning-weak)] text-[var(--system-warning-strong)]`:`border-[var(--system-negative-strong)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] text-[var(--content-default)] hover:bg-[var(--surface-base)]`}`,children:[(0,X.jsx)(`div`,{children:e.label}),(0,X.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,X.jsx)(W,{label:i(`trustRuleFormModal.descriptionLabel`),type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:C}),(0,X.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n,className:`rounded-lg border border-[var(--border-element)] bg-white px-4 py-2 text-body-medium-default text-[var(--content-default)] transition-colors hover:bg-[var(--surface-base)] dark:border-[var(--border-base)] dark:bg-[var(--surface-lift)] dark:hover:bg-[var(--ghost-hover)]`,children:i(`trustRuleFormModal.cancel`)}),(0,X.jsx)(`button`,{type:`submit`,disabled:!S,className:`rounded-lg bg-[var(--system-positive-strong)] px-4 py-2 text-body-medium-default text-white transition-colors hover:bg-[var(--system-positive-strong)] disabled:cursor-not-allowed disabled:opacity-50`,children:i(g?`trustRuleFormModal.saving`:`trustRuleFormModal.save`)})]})]})]})}),document.body)}function Be(e){return e.origin===`default`&&!e.userModified}function Ve(e,t){let n=new Set,r=[];for(let t of e)n.has(t.id)||(n.add(t.id),r.push(t));for(let e of t)n.has(e.id)||(n.add(e.id),r.push(e));return r.sort((e,t)=>e.tool===t.tool?e.description.localeCompare(t.description):e.tool.localeCompare(t.tool))}function He(e){switch(e){case`low`:return`positive`;case`medium`:return`warning`;case`high`:return`negative`}}function Ue({assistantId:e,onClose:t}){let{t:n}=a(`settings`),r=(0,Y.useRef)(null),[i,o]=(0,Y.useState)([]),[s,c]=(0,Y.useState)(!0),[l,f]=(0,Y.useState)(null),[p,h]=(0,Y.useState)(null),[g,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),b=(0,Y.useCallback)(e=>{switch(e){case`low`:return n(`trustRulesModal.riskLow`);case`medium`:return n(`trustRulesModal.riskMedium`);case`high`:return n(`trustRulesModal.riskHigh`)}},[n]),x=(0,Y.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([U(e),U(e,{origin:`default`})]);return Ve(t,n)}return U(e)},[e]),C=(0,Y.useCallback)(async()=>{c(!0);try{o(await x(v)),f(null)}catch(e){f(e instanceof Error?e.message:n(`trustRulesModal.loadErrorFallback`))}finally{c(!1)}},[x,v,n]);(0,Y.useEffect)(()=>{let e=!1;return(async()=>{c(!0);try{let t=await x(v);e||(o(t),f(null))}catch(t){e||f(t instanceof Error?t.message:n(`trustRulesModal.loadErrorFallback`))}finally{e||c(!1)}})(),()=>{e=!0}},[x,v,n]);let w=(0,Y.useCallback)(async()=>{if(g)try{await se(e,g.id),C()}catch(e){f(e instanceof Error?e.message:n(`trustRulesModal.deleteErrorFallback`))}finally{_(null)}},[e,g,C,n]);return(0,Le.createPortal)((0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{ref:r,role:`dialog`,"aria-modal":`true`,"aria-labelledby":`trust-rules-title`,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:(0,Y.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),t())},[t]),onClick:(0,Y.useCallback)(e=>{e.target===r.current&&t()},[t]),children:(0,X.jsxs)(`div`,{className:`mx-4 flex max-h-[80vh] w-full max-w-2xl flex-col rounded-xl border border-[var(--border-base)] bg-[var(--surface-lift)] shadow-xl`,children:[(0,X.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,X.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:n(`trustRulesModal.title`)}),(0,X.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,X.jsx)(L,{checked:v,onChange:y,label:n(`trustRulesModal.showAllDefaults`)}),(0,X.jsx)(S,{variant:`outlined`,onClick:t,children:n(`trustRulesModal.done`)})]})]}),(0,X.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[l&&(0,X.jsx)(`div`,{className:`mb-3`,children:(0,X.jsx)(G,{tone:`error`,children:l})}),s?(0,X.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:n(`trustRulesModal.loading`)}):i.length===0?(0,X.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,X.jsx)(u,{className:`h-8 w-8`}),(0,X.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:n(`trustRulesModal.empty`)})]}):(0,X.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:i.map(e=>{let t=Be(e);return(0,X.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,X.jsx)(K,{tone:He(e.risk),children:b(e.risk)}),e.origin===`default`&&(0,X.jsx)(K,{tone:`neutral`,children:n(`trustRulesModal.defaultTag`)}),e.userModified&&(0,X.jsx)(K,{tone:`warning`,children:n(`trustRulesModal.modifiedTag`)})]}),(0,X.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,X.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,X.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,X.jsx)(`button`,{type:`button`,"aria-label":n(`trustRulesModal.editRuleAria`,{tool:e.tool}),onClick:()=>h(e),className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,X.jsx)(d,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,X.jsx)(S,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,X.jsx)(m,{className:`h-4 w-4`}),"aria-label":n(`trustRulesModal.deleteRuleAria`,{tool:e.tool}),onClick:()=>_(e)})]})]},e.id)})})]})]})}),p&&(0,X.jsx)(ze,{assistantId:e,existingRule:p,onClose:()=>h(null),onSaved:()=>{h(null),C()}}),(0,X.jsx)(ve,{open:g!==null,title:n(`trustRulesModal.deleteTitle`),message:g?n(`trustRulesModal.deleteMessage`,{risk:b(g.risk).toLowerCase(),tool:g.tool,pattern:g.pattern}):``,confirmLabel:n(`trustRulesModal.delete`),cancelLabel:n(`trustRulesModal.cancel`),destructive:!0,onConfirm:()=>void w(),onCancel:()=>_(null)})]}),document.body)}function We(){let{t:e}=a(`settings`),t=P(),[n,r]=(0,Y.useState)(!1);return(0,X.jsxs)(M,{children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,X.jsx)(u,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,X.jsxs)(`div`,{className:`flex-1`,children:[(0,X.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`trustRules.title`)}),(0,X.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`trustRules.description`)})]}),(0,X.jsx)(S,{variant:`outlined`,onClick:()=>r(!0),children:e(`trustRules.manage`)})]}),n&&(0,X.jsx)(Ue,{assistantId:t,onClose:()=>r(!1)})]})}var Ge=[{value:`dontRetain`,labelKey:`privacyPage.retentionDontRetain`},{value:`oneHour`,labelKey:`privacyPage.retentionOneHour`},{value:`oneDay`,labelKey:`privacyPage.retentionOneDay`},{value:`sevenDays`,labelKey:`privacyPage.retentionSevenDays`},{value:`thirtyDays`,labelKey:`privacyPage.retentionThirtyDays`},{value:`ninetyDays`,labelKey:`privacyPage.retentionNinetyDays`},{value:`keepForever`,labelKey:`privacyPage.retentionKeepForever`}],Ke=`thirtyDays`;function $(){return(0,X.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function qe(){let{t:e}=a(`settings`),t=D({platformHostedOnly:!0}),r=w(),i=r,o=k.use.user()?.id??null,[s]=g(),[c]=ae(),l=s??!0,u=c??!0,[d,f]=(0,Y.useState)(()=>V(`llmLogRetention`,Ke)),p=(0,Y.useMemo)(()=>Ge.map(t=>({value:t.value,label:e(t.labelKey)})),[e]);return(0,X.jsxs)(`div`,{className:`space-y-4`,children:[(0,X.jsx)(je,{}),(0,X.jsx)(ke,{}),(0,X.jsx)(We,{}),(0,X.jsx)(Ie,{}),(0,X.jsx)(Fe,{}),(0,X.jsx)(q,{title:e(`privacyPage.title`),subtitle:r?(0,X.jsx)(n,{ns:`settings`,i18nKey:`privacyPage.subtitleWithPolicy`,components:{policyLink:(0,X.jsx)(`a`,{href:ye(ie.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`})}}):void 0,children:(0,X.jsxs)(`div`,{className:`space-y-4`,children:[i&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(J,{label:e(`privacyPage.shareAnalyticsLabel`),helperText:e(`privacyPage.shareAnalyticsHelper`),checked:l,onChange:()=>{he(`share_analytics`,!l,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,X.jsx)($,{}),(0,X.jsx)(J,{label:e(`privacyPage.shareDiagnosticsLabel`),helperText:e(`privacyPage.shareDiagnosticsHelper`),checked:u,onChange:()=>{he(`share_diagnostics`,!u,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,X.jsx)($,{})]}),(0,X.jsx)(Ae,{}),t!==`gated`&&(0,X.jsx)($,{}),(0,X.jsxs)(`div`,{children:[(0,X.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:e(`privacyPage.llmLogRetentionLabel`)}),(0,X.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,X.jsx)(j,{value:d,onChange:e=>{f(e),I(`llmLogRetention`,e)},options:p})}),(0,X.jsx)(`p`,{className:`mt-2 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`privacyPage.llmLogRetentionDescription`)})]})]})})]})}export{qe as PrivacyPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Ar as o,Cg as s,Dg as c,Dy as l,Gl as u,If as d,Mg as f,O_ as p,Og as m,Pf as h,Pr as g,Ql as _,Sg as v,ap as y,bg as b,dg as x,dv as S,eu as C,fv as w,gi as T,h_ as E,jg as D,kg as ee,mi as te,ov as O,rv as k,tu as A,vi as j}from"./index-
|
|
1
|
+
import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CYfJo8gP.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Ar as o,Cg as s,Dg as c,Dy as l,Gl as u,If as d,Mg as f,O_ as p,Og as m,Pf as h,Pr as g,Ql as _,Sg as v,ap as y,bg as b,dg as x,dv as S,eu as C,fv as w,gi as T,h_ as E,jg as D,kg as ee,mi as te,ov as O,rv as k,tu as A,vi as j}from"./index-b_IQShc9.js";import{t as M}from"./plugin-attribution-BKqeSMc9.js";import{n as N,t as P}from"./consent-controls-BBOL1pVX.js";import{r as F,t as I}from"./checkout-continuation-BBasTGr1.js";var L=e(n(),1),R=a();function z({current:e,total:n,color:r}){let{t:i}=t(`onboarding`);return(0,R.jsx)(`div`,{className:`flex items-center gap-1.5`,role:`group`,"aria-label":i(`stepIndicator.ariaLabel`,{current:e+1,total:n}),children:Array.from({length:n},(t,n)=>(0,R.jsx)(`div`,{"aria-hidden":`true`,className:`h-[3px] w-8 rounded-full transition-colors`,style:r?{backgroundColor:r,opacity:n<=e?1:.3}:void 0,children:r?null:(0,R.jsx)(`div`,{className:`h-full w-full rounded-full bg-[var(--content-default)] ${n<=e?``:`opacity-20`}`})},n))})}function B(){let{t:e}=t(`onboarding`),n=r(),[a]=i(),b=h.use.user()?.id??null,O=w(),B=x(),[H,U]=C(),W=H??!0,[G,K]=A(),[q,J]=_(),Y=d(),X=F();(0,L.useEffect)(()=>{j()},[]);let Z=a.get(`preview`)===`true`,Q=(0,L.useCallback)(e=>{},[]),ne=Z?Q:U,re=Z?Q:K,ie=Z?Q:J,ae=c(),$=(0,L.useCallback)(e=>{if(Z)return;y({userId:b,tos:G,privacy:q,shareAnalytics:null,shareDiagnostics:W,hasPlatformSession:Y}),T(te.privacyTos,{userId:b});let t=u(a.get(`returnTo`));if(t){n(e?D(t):t,g);return}let r=a.get(`hosting`),i=new URLSearchParams;r&&i.set(`hosting`,r);let o=a.get(M);o&&i.set(M,o);let c=i.toString(),l=ee({isLocalHatch:p()&&r!==null&&r!==`vellum-cloud`,skipResearch:e,selectedAssistantOnboarded:f(E.getState().assistants,k()),newAssistant:m(a)}),d=e?D(`${l}${c?`?${c}`:``}`):`${l}${c?`?${c}`:``}`,h=s();if(h?.resumeAfterOnboarding===!0)if(X===`disabled`)v();else{let e=V(h);if(e){e.set(I,d),n(`${S.checkout}?${e.toString()}`,g);return}}n(d,g)},[q,Y,Z,n,a,W,X,G,b]);return(0,R.jsx)(o,{avatarWave:`beside`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${O?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[B&&(0,R.jsx)(`div`,{className:`mb-8 flex w-full justify-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:(0,R.jsx)(z,{current:2,total:3})}),(0,R.jsx)(`h1`,{className:O?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:e(`privacyScreen.title`)}),(0,R.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${O?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:e(`privacyScreen.body`)}),(0,R.jsx)(N,{electron:O,showAnalytics:!1,shareAnalytics:!1,shareDiagnostics:W,onShareAnalyticsChange:Q,onShareDiagnosticsChange:ne,className:`mt-8 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`}}),(0,R.jsx)(P,{electron:O,privacyConsent:q,tosAccepted:G,onPrivacyChange:ie,onTosChange:re,className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`}}),(0,R.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${O?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.55s both`},children:[(0,R.jsx)(l,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!G||!q,onClick:()=>$(!1),className:O?void 0:`h-11 text-base`,children:e(`privacyScreen.start`)}),ae&&(0,R.jsx)(l,{variant:`outlined`,size:`regular`,fullWidth:!0,disabled:!G||!q,onClick:()=>$(!0),className:O?void 0:`h-11 text-base`,children:e(`privacyScreen.skipToChat`)}),(0,R.jsx)(l,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:()=>n(p()?S.onboarding.hosting:S.onboarding.start,g),className:O?void 0:`h-11 text-base`,children:e(`actions.back`)})]})]})})}function V(e){return e.kind===`package`?new URLSearchParams({[O]:e.packageKey}):e.storageTier===null?null:b({machineTier:e.machineTier,storageTier:e.storageTier,creditTier:e.creditTier})}export{B as PrivacyScreen};
|