@vellumai/web 0.11.9-dev.202609080319.eb4f1b0 → 0.11.9-dev.202609080717.cb7bdcf

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.
Files changed (158) hide show
  1. package/dist/assets/{a2a-invite-DE8JU6XL.js → a2a-invite-gOF6uo48.js} +1 -1
  2. package/dist/assets/{about-page-BB5aie0B.js → about-page-D22IDkUs.js} +1 -1
  3. package/dist/assets/{account-page-CyPfD_c7.js → account-page-Bdf08Iot.js} +1 -1
  4. package/dist/assets/{account-shell-D3-18STq.js → account-shell-CTNLBoFh.js} +1 -1
  5. package/dist/assets/{acp-run-detail-panel-RhFdSqlG.js → acp-run-detail-panel-BOh6Ca2Z.js} +1 -1
  6. package/dist/assets/{activity-redirect-page-RNQtKd3M.js → activity-redirect-page-UhhgLFPf.js} +1 -1
  7. package/dist/assets/{activity-steps-panel-BC9iC1Iy.js → activity-steps-panel-C3M-pql8.js} +1 -1
  8. package/dist/assets/{add-credits-modal-BGvxgrHG.js → add-credits-modal-Bnk9CbfG.js} +1 -1
  9. package/dist/assets/{ai-page-BNGMJNri.js → ai-page-kw_d97Uh.js} +1 -1
  10. package/dist/assets/{android-billing-handoff-teTPHA-K.js → android-billing-handoff-CuMiggT0.js} +1 -1
  11. package/dist/assets/{api-key-screen-B62k43Ah.js → api-key-screen-8vz3lO2H.js} +1 -1
  12. package/dist/assets/{app-info-DA_Wh5nL.js → app-info-DhczQTDf.js} +1 -1
  13. package/dist/assets/archive-redirect-page-6inXL8sZ.js +1 -0
  14. package/dist/assets/{assistant-status-panel-CDPsO6jR.js → assistant-status-panel-BAJAwsWu.js} +1 -1
  15. package/dist/assets/{auth-welcome-screen-DJPUKTHW.js → auth-welcome-screen-D6OBU2eK.js} +1 -1
  16. package/dist/assets/{avatar-random-DZi-UhYM.js → avatar-random-JjKf8SEI.js} +2 -2
  17. package/dist/assets/{await-org-header-settled-CeBhYhJb.js → await-org-header-settled-Xd4DiJuH.js} +1 -1
  18. package/dist/assets/{background-task-detail-panel-xqxCD5w5.js → background-task-detail-panel-rF03sBep.js} +1 -1
  19. package/dist/assets/{billing-page-CaGvLzc2.js → billing-page-CnPIbGze.js} +3 -3
  20. package/dist/assets/{billing-redirect-page-BR6j7z1H.js → billing-redirect-page-Dibts_aj.js} +1 -1
  21. package/dist/assets/{bookmarks-page-Cp3ghU4L.js → bookmarks-page-D1UNFAtD.js} +1 -1
  22. package/dist/assets/{bundle-confirm-page-CPApOWbX.js → bundle-confirm-page-BjjKCzz6.js} +1 -1
  23. package/dist/assets/{channel-transcript-panel-vckULAFc.js → channel-transcript-panel-CYNCqSPR.js} +1 -1
  24. package/dist/assets/{channels-page-route-CyTYNlA5.js → channels-page-route-DDYYmyG5.js} +1 -1
  25. package/dist/assets/{checkout-continuation-BU0cwoiu.js → checkout-continuation-DSfoHLU4.js} +1 -1
  26. package/dist/assets/{checkout-page-BLWmG1q_.js → checkout-page-DZfRnrhX.js} +1 -1
  27. package/dist/assets/checkout-return-target-DHK6vMrZ.js +1 -0
  28. package/dist/assets/{command-palette-DEsyxWql.js → command-palette-BLDqOMH2.js} +1 -1
  29. package/dist/assets/{command-palette-window-page-Dt20OjUC.js → command-palette-window-page-Bj6yx_0o.js} +1 -1
  30. package/dist/assets/{community-page-LR58_vjN.js → community-page-B3rjhwyp.js} +1 -1
  31. package/dist/assets/{companion-accent-DeyTEA_3.js → companion-accent-B4rxtIfU.js} +1 -1
  32. package/dist/assets/{companion-layout-ByYXBbsW.js → companion-layout-Cr7PGj6N.js} +1 -1
  33. package/dist/assets/{companion-surface-page-B7uW9rx8.js → companion-surface-page-BoQfsVcM.js} +1 -1
  34. package/dist/assets/{companion-watch-frame-page-Cu7mHEM1.js → companion-watch-frame-page-DCOzF8bN.js} +1 -1
  35. package/dist/assets/{connect-page-CcvtWwZm.js → connect-page-WltJpriQ.js} +1 -1
  36. package/dist/assets/{consent-controls-YdgrMbrE.js → consent-controls-CUtRwDSO.js} +1 -1
  37. package/dist/assets/{contacts-gateway-BlaM43H8.js → contacts-gateway-2Cba8-pT.js} +1 -1
  38. package/dist/assets/{contacts-page-route-vIQx5oy0.js → contacts-page-route-D_GN_Dxc.js} +1 -1
  39. package/dist/assets/{credential-entry-page-BnvXMP-n.js → credential-entry-page-Bwv9P76z.js} +1 -1
  40. package/dist/assets/{credentials-page-Dv8WcAVs.js → credentials-page-BWyNfYu3.js} +1 -1
  41. package/dist/assets/{csv-preview-__dTS5eM.js → csv-preview-_Kvoy7HA.js} +1 -1
  42. package/dist/assets/danger-zone-redirect-page-DRpBVYkQ.js +1 -0
  43. package/dist/assets/{debug-page-gnWo-2Da.js → debug-page-Bk4Jel9c.js} +1 -1
  44. package/dist/assets/{deploy-dialogs-DpY6KtD0.js → deploy-dialogs-BvlA--1W.js} +1 -1
  45. package/dist/assets/{detail-card-DzyHCwKl.js → detail-card-B7ANaKg6.js} +1 -1
  46. package/dist/assets/{detail-panel-stop-button-BaiKdnhR.js → detail-panel-stop-button-Cp542_bq.js} +1 -1
  47. package/dist/assets/{detail-primitives-Ddp6vgx2.js → detail-primitives-CMvLd-AF.js} +1 -1
  48. package/dist/assets/{developer-page-Ddfx39RM.js → developer-page-DonJecyR.js} +1 -1
  49. package/dist/assets/devices-redirect-page-roZwuNZk.js +1 -0
  50. package/dist/assets/{dictation-overlay-page-CHV2Lzho.js → dictation-overlay-page-hYOMeRXY.js} +1 -1
  51. package/dist/assets/{document-viewer-page-0lAF3zHO.js → document-viewer-page-CpjYw73c.js} +1 -1
  52. package/dist/assets/{emails-page-BTuiS8xe.js → emails-page-7fGpZKNn.js} +1 -1
  53. package/dist/assets/{environment-store-0Uj9pySQ.js → environment-store-DohSGQSX.js} +1 -1
  54. package/dist/assets/{file-editor-byV3AKr_.js → file-editor-Bcde3HN6.js} +1 -1
  55. package/dist/assets/{general-page-DV0CjFDC.js → general-page-B0CiZrEv.js} +1 -1
  56. package/dist/assets/{hatching-screen-BlWA3qiQ.js → hatching-screen-w5uYYHOt.js} +1 -1
  57. package/dist/assets/{hosting-screen-Bt_zQENb.js → hosting-screen-CMHZ5LlZ.js} +1 -1
  58. package/dist/assets/{identity-page-route-BGfmhvxa.js → identity-page-route-DD5dJVcP.js} +1 -1
  59. package/dist/assets/{index-CFjEz2JL.js → index-DZRUYtkw.js} +8 -8
  60. package/dist/assets/{inspect-page-D6DMFtWD.js → inspect-page--4LTyAJN.js} +3 -3
  61. package/dist/assets/{integrations-page-D88WpBwh.js → integrations-page-CNfcF9Hf.js} +1 -1
  62. package/dist/assets/{intelligence-layout-B7Lv8kEF.js → intelligence-layout-KxBVk0SN.js} +1 -1
  63. package/dist/assets/keyboard-shortcuts-redirect-page-COxJW1-N.js +1 -0
  64. package/dist/assets/{latest-assistant-text-BaJhAnmO.js → latest-assistant-text-EZT9qYPE.js} +1 -1
  65. package/dist/assets/{library-detail-page-Buskge_n.js → library-detail-page-j2FziytI.js} +1 -1
  66. package/dist/assets/{library-page-CUv4kVOQ.js → library-page-vuk6eH3h.js} +1 -1
  67. package/dist/assets/{login-page-CsxWa2XF.js → login-page-Bh-6EI5l.js} +1 -1
  68. package/dist/assets/{logout-page-SsIaWcSN.js → logout-page-dXD8CrF1.js} +1 -1
  69. package/dist/assets/{logs-layout-CwS0lWqx.js → logs-layout-DZNKBq-E.js} +1 -1
  70. package/dist/assets/{markdown-preview-DD26LE5L.js → markdown-preview-DUbA0-aU.js} +1 -1
  71. package/dist/assets/{media-preview-BTgzrnP6.js → media-preview-2h10-_3A.js} +1 -1
  72. package/dist/assets/{memory-page-route-BjsU3Vhh.js → memory-page-route-kiv43jD5.js} +1 -1
  73. package/dist/assets/{memory-router-playground-page-DBOPidd5.js → memory-router-playground-page-MTx1zpAT.js} +1 -1
  74. package/dist/assets/{message-files-panel-B27JlHxM.js → message-files-panel-DnlmciZs.js} +1 -1
  75. package/dist/assets/{metric-card-RgNQTg0j.js → metric-card-DTI0LkXH.js} +1 -1
  76. package/dist/assets/{notifications-page-CxLRGiOS.js → notifications-page-BeQyz9Sg.js} +1 -1
  77. package/dist/assets/{oauth-complete-page-D9ZmCrxw.js → oauth-complete-page--_Ev7vuq.js} +1 -1
  78. package/dist/assets/{oauth-popup-complete-page-B4Dl9jkK.js → oauth-popup-complete-page-JLux-ppb.js} +1 -1
  79. package/dist/assets/{page-shell-Bd_DuOKf.js → page-shell-Bajlehrb.js} +1 -1
  80. package/dist/assets/{pairing-page-C4DXceGb.js → pairing-page-DmqVcyjU.js} +1 -1
  81. package/dist/assets/password-reset-page-snAoWJ5R.js +1 -0
  82. package/dist/assets/{pdf-file-preview-CjPjPb5A.js → pdf-file-preview-D4v-RRF9.js} +1 -1
  83. package/dist/assets/{personality-page-ZgRzt9rF.js → personality-page-Byp3qx4g.js} +1 -1
  84. package/dist/assets/{plans-page-DDJypmEi.js → plans-page-Dwu1Hwa_.js} +1 -1
  85. package/dist/assets/{platform-loopback-page-CXKndRD2.js → platform-loopback-page-Cp93w1k5.js} +1 -1
  86. package/dist/assets/{plugin-detail-page-D68uJaAZ.js → plugin-detail-page-BwrbiecX.js} +1 -1
  87. package/dist/assets/{plugins-page-muxaVt91.js → plugins-page-CxQ_Ney6.js} +1 -1
  88. package/dist/assets/{preview-error-BTf5-ZyK.js → preview-error-kkNhhFuJ.js} +1 -1
  89. package/dist/assets/{privacy-page-Bq1eZl5q.js → privacy-page-CGQPFp83.js} +1 -1
  90. package/dist/assets/{privacy-screen-CBy_Ra68.js → privacy-screen-TNvfebqV.js} +1 -1
  91. package/dist/assets/{provider-callback-page-BzIGGJ18.js → provider-callback-page-BiXU9fMp.js} +1 -1
  92. package/dist/assets/{provider-key-BScSd6Cn.js → provider-key-DTPcOoYs.js} +1 -1
  93. package/dist/assets/{provider-signup-page-By7ymnkq.js → provider-signup-page-CQ-8PW8M.js} +1 -1
  94. package/dist/assets/{quick-input-page-DECzaqyq.js → quick-input-page-rf7rHlq4.js} +1 -1
  95. package/dist/assets/{research-mock-page-DN_4T6WQ.js → research-mock-page-B2_6jgC1.js} +1 -1
  96. package/dist/assets/{research-onboarding-route-K4foggWA.js → research-onboarding-route-RCIHR2Kc.js} +1 -1
  97. package/dist/assets/{review-terms-screen-DT0pT7Fv.js → review-terms-screen-DIaxKdls.js} +1 -1
  98. package/dist/assets/{schedules-CDoyasQt.js → schedules-CQ6sMhkx.js} +1 -1
  99. package/dist/assets/{schedules-page-DlrYj5hn.js → schedules-page-DebuN0pO.js} +1 -1
  100. package/dist/assets/security-redirect-page-DRA3Tcp4.js +1 -0
  101. package/dist/assets/{select-assistant-screen-Dh1jA44m.js → select-assistant-screen-CWp5uQ1o.js} +1 -1
  102. package/dist/assets/{self-hosted-servers-BW-q21vS.js → self-hosted-servers-Bp-22TP_.js} +1 -1
  103. package/dist/assets/{service-form-controls-DpqI7bAe.js → service-form-controls-BgMWl-xi.js} +1 -1
  104. package/dist/assets/{setting-row-Cg73b2Bs.js → setting-row-mB11-1yT.js} +1 -1
  105. package/dist/assets/{settings-divider-DB4cGpny.js → settings-divider-DhYFC0nY.js} +1 -1
  106. package/dist/assets/{settings-layout-PBTgAMHw.js → settings-layout-vlbOgESl.js} +1 -1
  107. package/dist/assets/{share-feedback-modal-Dr75ft_O.js → share-feedback-modal-CDin_n6l.js} +1 -1
  108. package/dist/assets/{sidebar-tree-cUSooqQa.js → sidebar-tree-rWA41YeP.js} +1 -1
  109. package/dist/assets/{signup-page-B5o8kIAq.js → signup-page-BGTvnTdA.js} +1 -1
  110. package/dist/assets/{signup-shell-DS9PBAIX.js → signup-shell-B3QVdlXF.js} +1 -1
  111. package/dist/assets/{skill-detail-page-BePAmP26.js → skill-detail-page-Cb9A3p9f.js} +1 -1
  112. package/dist/assets/{skill-detail-panel-B4uhVf6v.js → skill-detail-panel-CWpS-WA-.js} +1 -1
  113. package/dist/assets/{skill-removal-dialog-pz-CDn7F.js → skill-removal-dialog-C_seTSru.js} +1 -1
  114. package/dist/assets/{skills-page-B-2hI0IS.js → skills-page-Q2WPqzEn.js} +1 -1
  115. package/dist/assets/{sounds-page-ZT00M4ki.js → sounds-page-Cqu9_MgO.js} +1 -1
  116. package/dist/assets/{start-screen-B6xt_RXf.js → start-screen-D05mhp3u.js} +1 -1
  117. package/dist/assets/{stt-language-picker-modal-HmoCprOK.js → stt-language-picker-modal-D5i0l3OV.js} +1 -1
  118. package/dist/assets/{subagent-detail-panel-YBUxS7KT.js → subagent-detail-panel-Kr1ldoDS.js} +1 -1
  119. package/dist/assets/{superpowers-page-DiO8mieQ.js → superpowers-page-B8KZv4iu.js} +1 -1
  120. package/dist/assets/{system-events-page-DPGMWPR3.js → system-events-page-ClX2WUdm.js} +1 -1
  121. package/dist/assets/system-events-redirect-page-DxRYffwM.js +1 -0
  122. package/dist/assets/{text-preview-4kCKBTyg.js → text-preview-B53krqWC.js} +1 -1
  123. package/dist/assets/{theme-stage-page-BqtRgAS9.js → theme-stage-page-DQumDLjP.js} +1 -1
  124. package/dist/assets/{tiptap-document-editor-cWUmLLLi.js → tiptap-document-editor-cgZSNBD1.js} +1 -1
  125. package/dist/assets/{tool-detail-panel-CS-rDWzK.js → tool-detail-panel-ZTdt6Ske.js} +1 -1
  126. package/dist/assets/{trait-cycle-row-Bqq8xlaK.js → trait-cycle-row-o0OShh82.js} +1 -1
  127. package/dist/assets/{upgrade-cancel-page-DlpUGNNp.js → upgrade-cancel-page-CWGf8325.js} +1 -1
  128. package/dist/assets/{upgrade-success-page-DcngpSW7.js → upgrade-success-page-7B_k-9cH.js} +1 -1
  129. package/dist/assets/{usage-redirect-page-CQ2WyoAD.js → usage-redirect-page-h1T_tkvm.js} +1 -1
  130. package/dist/assets/{use-assistant-identity-details-oUIlixzS.js → use-assistant-identity-details-eox-1MyT.js} +1 -1
  131. package/dist/assets/{use-checkout-dismiss-refresh-BAuyCV44.js → use-checkout-dismiss-refresh-CDVPyEES.js} +1 -1
  132. package/dist/assets/{use-edge-swipe-back-DfDNkcyS.js → use-edge-swipe-back-D4_WmVil.js} +2 -2
  133. package/dist/assets/{use-hotkey-recorder-BHK7_Hpo.js → use-hotkey-recorder-CJDfwQo0.js} +1 -1
  134. package/dist/assets/{use-invite-link-dialog-Biwzg5dp.js → use-invite-link-dialog-DL1zHFkG.js} +1 -1
  135. package/dist/assets/{use-platform-assistant-id-DxtDOZXt.js → use-platform-assistant-id-DTgdzLFr.js} +1 -1
  136. package/dist/assets/{use-return-to-short-circuit-CyJgqi1I.js → use-return-to-short-circuit-BLQ5oNfP.js} +1 -1
  137. package/dist/assets/{use-side-list-room-DvohOpDg.js → use-side-list-room-1oyEkMgA.js} +1 -1
  138. package/dist/assets/{use-skill-actions-BNVWLLUB.js → use-skill-actions-Crx_g8O7.js} +1 -1
  139. package/dist/assets/{use-skill-detail-files-BZQxhAb8.js → use-skill-detail-files-DZaJ-xeX.js} +1 -1
  140. package/dist/assets/use-supports-credentials-settings-7pFA7F0s.js +1 -0
  141. package/dist/assets/use-transcript-message-by-id-hZhd72KW.js +1 -0
  142. package/dist/assets/{voice-page-BEPQyP6W.js → voice-page-DB-SL2sj.js} +1 -1
  143. package/dist/assets/{weather-forecast-display-BKvJCx3b.js → weather-forecast-display-Dlic4qUP.js} +1 -1
  144. package/dist/assets/{welcome-screen-DhywN33s.js → welcome-screen-9DcVW2fF.js} +1 -1
  145. package/dist/assets/{workflow-detail-panel-BKP8JoTr.js → workflow-detail-panel-By2VPQSL.js} +1 -1
  146. package/dist/assets/{workspace-page--5Fa1TXO.js → workspace-page-Bzn3KKNY.js} +1 -1
  147. package/dist/index.html +1 -1
  148. package/package.json +1 -1
  149. package/dist/assets/archive-redirect-page-biI1N3-N.js +0 -1
  150. package/dist/assets/checkout-return-target-Cq7IUNKZ.js +0 -1
  151. package/dist/assets/danger-zone-redirect-page-B5fhEDTX.js +0 -1
  152. package/dist/assets/devices-redirect-page-B9d3Jo-l.js +0 -1
  153. package/dist/assets/keyboard-shortcuts-redirect-page-Ba1Ypya6.js +0 -1
  154. package/dist/assets/password-reset-page-DpsRFsSs.js +0 -1
  155. package/dist/assets/security-redirect-page-ChTP22E8.js +0 -1
  156. package/dist/assets/system-events-redirect-page-CYzlRPB5.js +0 -1
  157. package/dist/assets/use-supports-credentials-settings-szo0aDJw.js +0 -1
  158. package/dist/assets/use-transcript-message-by-id-Cg2fJrh4.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-CCI2T82b.js";import{b as o,t as s}from"./react-DPM_L_aA.js";import{Ah as c,Di as l,Ly as u,Wf as d,Xm as f,Y as ee,Yu as p,bd as m,yd as h}from"./index-CFjEz2JL.js";var g=e(o(),1),_=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function v(e,t,n){let{data:r,response:i}=await c({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new _(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new _(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:y(a)}}function y(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function b(e){return n({mutationFn:async t=>{if(!e)throw new _(0,`Missing assistantId`);return v(e,t)}})}function x(e){return i({...p({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4})}function S(e){return i({...m({path:{assistant_id:e}}),enabled:!!e,staleTime:1440*60*1e3})}function C(e){return i({...h({path:{assistant_id:e}}),enabled:!!e,staleTime:1/0})}var w=s();function T(){let{t:e}=a(`chat`),t=l(),n=d(),r=f.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=ee(),n=b(t),r=b(t),i=x(t),o=S(t),s=C(t),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)([{assistantMessage:``,userMessage:``}]),[f,p]=(0,g.useState)(!1);(0,g.useEffect)(()=>{if(f)return;let e=s.data?.nowText;typeof e==`string`&&c===``&&l(e)},[s.data?.nowText,c,f]);let[m,h]=(0,g.useState)(E),[_,v]=(0,g.useState)(E),[y,T]=(0,g.useState)(null),[D,k]=(0,g.useState)(null),M=u[u.length-1].userMessage,P=t=>{let i=t===`A`?m:_,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=>{p(!0),l(e)},onReloadNowText:()=>{let e=s.data?.nowText;typeof e==`string`&&(l(e),p(!1))},nowTextLoading:s.isLoading,pairs:u,onPairsChange:d}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:m,onChange:h,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:_,onChange:v,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:y}),(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))},l=()=>{o([{assistantMessage:``,userMessage:``},...i])},d=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(u,{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:l,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:l}){let{t:d}=a(`chat`);return(0,w.jsx)(u,{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:l}),(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,g.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,g.useState)(!1);return(0,w.jsx)(u,{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,g.useMemo)(()=>U(n,r),[n,r]),s=(0,g.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,g.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)(u,{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)(u,{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)(u,{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)(u,{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-CCI2T82b.js";import{b as o,t as s}from"./react-DPM_L_aA.js";import{Ah as c,Di as l,Ly as u,Wf as d,Xm as f,Y as ee,Yu as p,bd as m,yd as h}from"./index-DZRUYtkw.js";var g=e(o(),1),_=class extends Error{status;constructor(e,t){super(t),this.name=`SimulateMemoryRouterError`,this.status=e}};async function v(e,t,n){let{data:r,response:i}=await c({path:{assistant_id:e},body:t,signal:n,throwOnError:!1}),a=i?await i.clone().text().catch(()=>``):``;if(!i||!i.ok)throw new _(i?.status??0,a||i?.statusText||`Failed to simulate memory router`);if(!r)throw new _(i.status,`Empty response from memory router simulator endpoint`);return{response:r,rawRequest:JSON.stringify(t,null,2),rawResponse:y(a)}}function y(e){if(e.length===0)return e;try{return JSON.stringify(JSON.parse(e),null,2)}catch{return e}}function b(e){return n({mutationFn:async t=>{if(!e)throw new _(0,`Missing assistantId`);return v(e,t)}})}function x(e){return i({...p({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4})}function S(e){return i({...m({path:{assistant_id:e}}),enabled:!!e,staleTime:1440*60*1e3})}function C(e){return i({...h({path:{assistant_id:e}}),enabled:!!e,staleTime:1/0})}var w=s();function T(){let{t:e}=a(`chat`),t=l(),n=d(),r=f.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=ee(),n=b(t),r=b(t),i=x(t),o=S(t),s=C(t),[c,l]=(0,g.useState)(``),[u,d]=(0,g.useState)([{assistantMessage:``,userMessage:``}]),[f,p]=(0,g.useState)(!1);(0,g.useEffect)(()=>{if(f)return;let e=s.data?.nowText;typeof e==`string`&&c===``&&l(e)},[s.data?.nowText,c,f]);let[m,h]=(0,g.useState)(E),[_,v]=(0,g.useState)(E),[y,T]=(0,g.useState)(null),[D,k]=(0,g.useState)(null),M=u[u.length-1].userMessage,P=t=>{let i=t===`A`?m:_,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=>{p(!0),l(e)},onReloadNowText:()=>{let e=s.data?.nowText;typeof e==`string`&&(l(e),p(!1))},nowTextLoading:s.isLoading,pairs:u,onPairsChange:d}),(0,w.jsxs)(`div`,{className:`grid grid-cols-1 gap-4 lg:grid-cols-2`,children:[(0,w.jsx)(N,{paneId:`A`,overrides:m,onChange:h,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:_,onChange:v,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:y}),(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))},l=()=>{o([{assistantMessage:``,userMessage:``},...i])},d=e=>{e!==i.length-1&&o(i.filter((t,n)=>n!==e))};return(0,w.jsx)(u,{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:l,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:l}){let{t:d}=a(`chat`);return(0,w.jsx)(u,{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:l}),(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,g.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,g.useState)(!1);return(0,w.jsx)(u,{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,g.useMemo)(()=>U(n,r),[n,r]),s=(0,g.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,g.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)(u,{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)(u,{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)(u,{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)(u,{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-CCI2T82b.js";import{t}from"./react-DPM_L_aA.js";import{bt as n}from"./icons-B-6TfGtd.js";import{Ry as r,_ as i,yt as a}from"./index-CFjEz2JL.js";import{t as o}from"./use-transcript-message-by-id-Cg2fJrh4.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
+ import{j as e}from"./vendor-CCI2T82b.js";import{t}from"./react-DPM_L_aA.js";import{bt as n}from"./icons-B-6TfGtd.js";import{Ry as r,_ as i,yt as a}from"./index-DZRUYtkw.js";import{t as o}from"./use-transcript-message-by-id-hZhd72KW.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-CCI2T82b.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{Si as i}from"./icons-B-6TfGtd.js";import{Ry as a}from"./index-CFjEz2JL.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
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{f as t}from"./vendor-CCI2T82b.js";import{b as n,t as r}from"./react-DPM_L_aA.js";import{Si as i}from"./icons-B-6TfGtd.js";import{Ry as a}from"./index-DZRUYtkw.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-CCI2T82b.js";import{b as i,r as a,t as o}from"./react-DPM_L_aA.js";import{Jn as s,Si as c}from"./icons-B-6TfGtd.js";import{Ap as l,Av as u,Kl as d,Lp as f,Ly as p,My as m,Sv as h,go as g,ho as _,zy as v}from"./index-CFjEz2JL.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 l()&&t.isPluginAvailable(`AndroidNotificationSettings`)}async function C(){if(S())try{await x.open()}catch(e){u(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)(()=>{_().then(i)},[]),d(`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)(p,{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)(m,{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)(v,{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 f()?(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:h.settings.general})}export{E as NotificationsPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{E as t,j as n,k as r}from"./vendor-CCI2T82b.js";import{b as i,r as a,t as o}from"./react-DPM_L_aA.js";import{Jn as s,Si as c}from"./icons-B-6TfGtd.js";import{Ap as l,Av as u,Kl as d,Lp as f,Ly as p,My as m,Sv as h,go as g,ho as _,zy as v}from"./index-DZRUYtkw.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 l()&&t.isPluginAvailable(`AndroidNotificationSettings`)}async function C(){if(S())try{await x.open()}catch(e){u(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)(()=>{_().then(i)},[]),d(`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)(p,{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)(m,{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)(v,{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 f()?(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:h.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-CCI2T82b.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Tr as a}from"./index-CFjEz2JL.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=`
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CCI2T82b.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Tr as a}from"./index-DZRUYtkw.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;
@@ -1,4 +1,4 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CCI2T82b.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Og as a,Tr as o,kg as s}from"./index-CFjEz2JL.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=`
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CCI2T82b.js";import{b as n,g as r,t as i}from"./react-DPM_L_aA.js";import{Og as a,Tr as o,kg as s}from"./index-DZRUYtkw.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{Hy as r,Ja as i}from"./index-CFjEz2JL.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
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{b as t,t as n}from"./react-DPM_L_aA.js";import{Hy as r,Ja as i}from"./index-DZRUYtkw.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-CCI2T82b.js";import{b as n,d as r,f as i,t as a}from"./react-DPM_L_aA.js";import{Ir as o,L as s,Mr as c,nn as l}from"./icons-B-6TfGtd.js";import{B_ as u,Dp as d,Jv as f,N_ as p,Op as m,P_ as h,Sv as g,Xg as _,am as v,im as y,nm as b,rm as x,sm as S,t as C,yg as w,zy as T}from"./index-CFjEz2JL.js";import{r as E}from"./self-hosted-servers-BW-q21vS.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:S(),code:e}),r=p();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=h();if(!e)return null;try{return`${new URL(e).origin}${g.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)(T,{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)(T,{variant:`outlined`,fullWidth:!0,onClick:r,children:i(`pairingPage.continueInBrowser`)})]})}function L(){let{t:e}=t(`remote-web`),n=r(),a=i(),o=u(),s=(0,D.useMemo)(()=>_(new URLSearchParams(n.search).get(`returnTo`),g.assistant),[n.search]),c=(0,D.useMemo)(()=>f(`${n.pathname}${n.search}${n.hash}`),[n.pathname,n.search,n.hash]),l=(0,D.useMemo)(()=>!c.deviceCode||w()?null:d()?`android`:m()?`ios`:null,[c.deviceCode]),[p,h]=(0,D.useState)(()=>c.deviceCode?{deviceCode:c.deviceCode,userCode:c.userCode}:null),[S,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||p)return;let e=new AbortController;return(async()=>{try{let t=await y(e.signal);h({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,p]),(0,D.useEffect)(()=>{if(!o||!p?.deviceCode||!S)return;let e=new AbortController,t=null,n=async()=>{try{let r=await v(p.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}x(r),j(),P({kind:`approved`}),t=setTimeout(()=>a(s,{replace:!0}),250)}catch(t){if(e.signal.aborted)return;if(t instanceof b&&t.status===401){P({kind:`expired`});return}if(t instanceof b&&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,p?.deviceCode,S,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)(C,{});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`&&p?.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:p.userCode})]}):null,(0,O.jsx)(`p`,{className:`text-body-medium-lighter leading-6 text-[var(--content-secondary)]`,children:B.body}),N.kind===`handoff_choice`&&p&&l?(0,O.jsx)(I,{deviceCode:p.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)(T,{variant:`outlined`,fullWidth:!0,className:`mt-6`,onClick:z,children:e(`pairingPage.cancel`)}):null]})})}export{L as RemoteWebPairingPage};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CCI2T82b.js";import{b as n,d as r,f as i,t as a}from"./react-DPM_L_aA.js";import{Ir as o,L as s,Mr as c,nn as l}from"./icons-B-6TfGtd.js";import{B_ as u,Dp as d,Jv as f,N_ as p,Op as m,P_ as h,Sv as g,Xg as _,am as v,im as y,nm as b,rm as x,sm as S,t as C,yg as w,zy as T}from"./index-DZRUYtkw.js";import{r as E}from"./self-hosted-servers-Bp-22TP_.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:S(),code:e}),r=p();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=h();if(!e)return null;try{return`${new URL(e).origin}${g.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)(T,{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)(T,{variant:`outlined`,fullWidth:!0,onClick:r,children:i(`pairingPage.continueInBrowser`)})]})}function L(){let{t:e}=t(`remote-web`),n=r(),a=i(),o=u(),s=(0,D.useMemo)(()=>_(new URLSearchParams(n.search).get(`returnTo`),g.assistant),[n.search]),c=(0,D.useMemo)(()=>f(`${n.pathname}${n.search}${n.hash}`),[n.pathname,n.search,n.hash]),l=(0,D.useMemo)(()=>!c.deviceCode||w()?null:d()?`android`:m()?`ios`:null,[c.deviceCode]),[p,h]=(0,D.useState)(()=>c.deviceCode?{deviceCode:c.deviceCode,userCode:c.userCode}:null),[S,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||p)return;let e=new AbortController;return(async()=>{try{let t=await y(e.signal);h({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,p]),(0,D.useEffect)(()=>{if(!o||!p?.deviceCode||!S)return;let e=new AbortController,t=null,n=async()=>{try{let r=await v(p.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}x(r),j(),P({kind:`approved`}),t=setTimeout(()=>a(s,{replace:!0}),250)}catch(t){if(e.signal.aborted)return;if(t instanceof b&&t.status===401){P({kind:`expired`});return}if(t instanceof b&&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,p?.deviceCode,S,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)(C,{});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`&&p?.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:p.userCode})]}):null,(0,O.jsx)(`p`,{className:`text-body-medium-lighter leading-6 text-[var(--content-secondary)]`,children:B.body}),N.kind===`handoff_choice`&&p&&l?(0,O.jsx)(I,{deviceCode:p.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)(T,{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{Sv as n}from"./index-DZRUYtkw.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-BTf5-ZyK.js";import{In as n,Rn as r,on as i}from"./index-CFjEz2JL.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
+ import{t as e}from"./react-DPM_L_aA.js";import{t}from"./preview-error-kkNhhFuJ.js";import{In as n,Rn as r,on as i}from"./index-DZRUYtkw.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-CCI2T82b.js";import{b as c,f as l,t as u}from"./react-DPM_L_aA.js";import{P as d,mi as f}from"./icons-B-6TfGtd.js";import{Hy as p,Ja as m,Sv as h,Y as g,Zf as _,gi as v,no as y,vi as b,yi as x,yy as S}from"./index-CFjEz2JL.js";import{a as C,i as w,o as T,r as E,s as D}from"./latest-assistant-text-BaJhAnmO.js";import{n as O,t as k}from"./peeking-eyes-CR9he4vp.js";import{a as A,i as j,n as M,r as N,t as P}from"./use-assistant-identity-details-oUIlixzS.js";var F=e(c(),1),I=u();function L({components:e,traits:t,stage:n,entrance:r=!1,entranceDelay:i=0}){let a=(0,F.useMemo)(()=>{let n=e.eyeStyles.find(e=>e.id===t.eyeStyle);return n?{paths:n.paths,bbox:b(n.paths.map(e=>v(e.svgPath)))}:null},[e,t.eyeStyle]);return a?(0,I.jsx)(O,{art:a,stage:n,entrance:r,entranceDelay:i}):null}var R=`#17191C`,z=24,B=.2,V=96,H=160,U=(0,F.createContext)(null);function W(){let e=(0,F.useContext)(U);if(!e)throw Error(`useAssistantStage must be used inside <AssistantStage>`);return e}function G({components:e,traits:t,customImageUrl:n,accentHex:r,entrance:i=!1,children:a,className:o}){let{ref:s,size:c}=x(),l=r??R,u=y(l),d=m.use.setSurface();(0,F.useLayoutEffect)(()=>(d(l),()=>{d(null)}),[l,d]);let f=!!(e&&t),h=!f&&!!n,g=Math.round(Math.min(H,Math.max(V,Math.min(c.w,c.h)*B))),_=c.h-g-z,v=f?Math.round(k*Math.min(c.w,c.h))+16:h?g+z+16:24;return(0,I.jsxs)(`div`,{ref:s,className:p(`relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-[var(--border-base)]`,`native-mobile:rounded-none native-mobile:border-0`,o),style:{backgroundColor:l,color:u.fg},children:[f&&e&&t&&(0,I.jsx)(L,{components:e,traits:t,stage:c,entrance:i}),h&&n&&(0,I.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2] overflow-hidden rounded-full ring-4 ring-white/25`,style:{left:(c.w-g)/2,top:_,width:g,height:g},children:(0,I.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`,draggable:!1})}),(0,I.jsx)(U.Provider,{value:{stage:c,tone:u,bottomReserve:v},children:(0,I.jsx)(`div`,{className:`relative z-10 flex min-h-0 flex-1 flex-col`,children:a})})]})}var K=`rgba(36, 41, 46, 0.25)`,q=`#FDFDFC`;function J({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,I.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,I.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,I.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,I.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]??A),disabled:c,min:0,max:100,step:1,"aria-label":l(`personalitySliderRow.rangeAriaLabel`,{left:u,right:d}),children:[(0,I.jsx)(a,{className:`relative h-2 w-full grow rounded-full sm:h-3`,style:{backgroundColor:K}}),(0,I.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:q}})]})]})}async function Y({assistantId:e,values:n,assistantName:r}){return N({assistantId:e,content:D(n,void 0,r),title:t(`applyPersonalityUpdate.conversationTitle`,{ns:`intelligence`}),context:`identity_personality_update`})}function X(){let{t:e}=o(`intelligence`),t=g(),r=l(),a=i(),{components:s,traits:c,customImageUrl:u,accentHex:d}=_(t),f=M(t),p=n({queryKey:C(t),queryFn:()=>w(t)}),[m,v]=(0,F.useState)(null),[y,b]=(0,F.useState)(!1),x=m??p.data??{},D=f.data?.identity?.name||e(`identityOverview.defaultAssistantName`);return(0,I.jsx)(G,{components:s,traits:c,customImageUrl:u,accentHex:d,entrance:!0,children:(0,I.jsx)(Z,{assistantName:D,values:x,onValueChange:(e,t)=>v({...x,[e]:t}),applying:y,onUpdate:()=>{b(!0);let n=E(x);Y({assistantId:t,values:n,assistantName:f.data?.identity?.name}).then(async i=>{b(!1),i?(await T(t,n),a.invalidateQueries({queryKey:C(t)}),a.invalidateQueries({queryKey:P(t)}),S.success(e(`personalityPage.updateSuccessToast`)),r(h.identity)):S.error(e(`personalityPage.updateErrorToast`))})},onBack:()=>void r(h.identity)})})}function Z({assistantName:e,values:t,onValueChange:n,applying:r,onUpdate:i,onBack:a}){let{t:s}=o(`intelligence`),{tone:c,bottomReserve:l}=W();return(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)(f,{className:`h-4 w-4`,"aria-hidden":!0}),s(`personalityPage.back`)]}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6`,style:{paddingBottom:l},children:[(0,I.jsx)(`div`,{className:`w-full min-h-14 shrink-[4]`,style:{flexBasis:`12%`}}),(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 text-center`,children:[(0,I.jsx)(`h1`,{className:`text-[2.6rem] leading-none max-sm:text-[2rem]`,style:{fontFamily:`var(--font-serif)`},children:s(`personalityPage.title`)}),(0,I.jsx)(`p`,{className:`max-w-md text-[15px]`,style:{color:c.fgMuted},children:s(`personalityPage.subtitle`)})]}),(0,I.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-10`}),(0,I.jsx)(`div`,{className:`flex w-full max-w-2xl shrink-0 flex-col`,children:j.map((e,i)=>(0,I.jsxs)(F.Fragment,{children:[i>0&&(0,I.jsx)(`div`,{className:`w-full min-h-2.5 shrink basis-8 sm:basis-11`}),(0,I.jsx)(J,{axis:e,value:t[e.id]??A,onValueChange:t=>n(e.id,t),tone:c,disabled:r})]},e.id))}),(0,I.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-12`}),(0,I.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,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)(`span`,{className:`min-w-0 text-center`,children:s(`personalityPage.updatingPersonality`,{name:e})})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0}),s(`personalityPage.updatePersonality`)]})})]})]})}export{X as PersonalityPage};
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-CCI2T82b.js";import{b as c,f as l,t as u}from"./react-DPM_L_aA.js";import{P as d,mi as f}from"./icons-B-6TfGtd.js";import{Hy as p,Ja as m,Sv as h,Y as g,Zf as _,gi as v,no as y,vi as b,yi as x,yy as S}from"./index-DZRUYtkw.js";import{a as C,i as w,o as T,r as E,s as D}from"./latest-assistant-text-EZT9qYPE.js";import{n as O,t as k}from"./peeking-eyes-CR9he4vp.js";import{a as A,i as j,n as M,r as N,t as P}from"./use-assistant-identity-details-eox-1MyT.js";var F=e(c(),1),I=u();function L({components:e,traits:t,stage:n,entrance:r=!1,entranceDelay:i=0}){let a=(0,F.useMemo)(()=>{let n=e.eyeStyles.find(e=>e.id===t.eyeStyle);return n?{paths:n.paths,bbox:b(n.paths.map(e=>v(e.svgPath)))}:null},[e,t.eyeStyle]);return a?(0,I.jsx)(O,{art:a,stage:n,entrance:r,entranceDelay:i}):null}var R=`#17191C`,z=24,B=.2,V=96,H=160,U=(0,F.createContext)(null);function W(){let e=(0,F.useContext)(U);if(!e)throw Error(`useAssistantStage must be used inside <AssistantStage>`);return e}function G({components:e,traits:t,customImageUrl:n,accentHex:r,entrance:i=!1,children:a,className:o}){let{ref:s,size:c}=x(),l=r??R,u=y(l),d=m.use.setSurface();(0,F.useLayoutEffect)(()=>(d(l),()=>{d(null)}),[l,d]);let f=!!(e&&t),h=!f&&!!n,g=Math.round(Math.min(H,Math.max(V,Math.min(c.w,c.h)*B))),_=c.h-g-z,v=f?Math.round(k*Math.min(c.w,c.h))+16:h?g+z+16:24;return(0,I.jsxs)(`div`,{ref:s,className:p(`relative flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border border-[var(--border-base)]`,`native-mobile:rounded-none native-mobile:border-0`,o),style:{backgroundColor:l,color:u.fg},children:[f&&e&&t&&(0,I.jsx)(L,{components:e,traits:t,stage:c,entrance:i}),h&&n&&(0,I.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2] overflow-hidden rounded-full ring-4 ring-white/25`,style:{left:(c.w-g)/2,top:_,width:g,height:g},children:(0,I.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`,draggable:!1})}),(0,I.jsx)(U.Provider,{value:{stage:c,tone:u,bottomReserve:v},children:(0,I.jsx)(`div`,{className:`relative z-10 flex min-h-0 flex-1 flex-col`,children:a})})]})}var K=`rgba(36, 41, 46, 0.25)`,q=`#FDFDFC`;function J({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,I.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,I.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,I.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,I.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]??A),disabled:c,min:0,max:100,step:1,"aria-label":l(`personalitySliderRow.rangeAriaLabel`,{left:u,right:d}),children:[(0,I.jsx)(a,{className:`relative h-2 w-full grow rounded-full sm:h-3`,style:{backgroundColor:K}}),(0,I.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:q}})]})]})}async function Y({assistantId:e,values:n,assistantName:r}){return N({assistantId:e,content:D(n,void 0,r),title:t(`applyPersonalityUpdate.conversationTitle`,{ns:`intelligence`}),context:`identity_personality_update`})}function X(){let{t:e}=o(`intelligence`),t=g(),r=l(),a=i(),{components:s,traits:c,customImageUrl:u,accentHex:d}=_(t),f=M(t),p=n({queryKey:C(t),queryFn:()=>w(t)}),[m,v]=(0,F.useState)(null),[y,b]=(0,F.useState)(!1),x=m??p.data??{},D=f.data?.identity?.name||e(`identityOverview.defaultAssistantName`);return(0,I.jsx)(G,{components:s,traits:c,customImageUrl:u,accentHex:d,entrance:!0,children:(0,I.jsx)(Z,{assistantName:D,values:x,onValueChange:(e,t)=>v({...x,[e]:t}),applying:y,onUpdate:()=>{b(!0);let n=E(x);Y({assistantId:t,values:n,assistantName:f.data?.identity?.name}).then(async i=>{b(!1),i?(await T(t,n),a.invalidateQueries({queryKey:C(t)}),a.invalidateQueries({queryKey:P(t)}),S.success(e(`personalityPage.updateSuccessToast`)),r(h.identity)):S.error(e(`personalityPage.updateErrorToast`))})},onBack:()=>void r(h.identity)})})}function Z({assistantName:e,values:t,onValueChange:n,applying:r,onUpdate:i,onBack:a}){let{t:s}=o(`intelligence`),{tone:c,bottomReserve:l}=W();return(0,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)(f,{className:`h-4 w-4`,"aria-hidden":!0}),s(`personalityPage.back`)]}),(0,I.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center overflow-y-auto px-6`,style:{paddingBottom:l},children:[(0,I.jsx)(`div`,{className:`w-full min-h-14 shrink-[4]`,style:{flexBasis:`12%`}}),(0,I.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2 text-center`,children:[(0,I.jsx)(`h1`,{className:`text-[2.6rem] leading-none max-sm:text-[2rem]`,style:{fontFamily:`var(--font-serif)`},children:s(`personalityPage.title`)}),(0,I.jsx)(`p`,{className:`max-w-md text-[15px]`,style:{color:c.fgMuted},children:s(`personalityPage.subtitle`)})]}),(0,I.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-10`}),(0,I.jsx)(`div`,{className:`flex w-full max-w-2xl shrink-0 flex-col`,children:j.map((e,i)=>(0,I.jsxs)(F.Fragment,{children:[i>0&&(0,I.jsx)(`div`,{className:`w-full min-h-2.5 shrink basis-8 sm:basis-11`}),(0,I.jsx)(J,{axis:e,value:t[e.id]??A,onValueChange:t=>n(e.id,t),tone:c,disabled:r})]},e.id))}),(0,I.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-12`}),(0,I.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,I.jsxs)(I.Fragment,{children:[(0,I.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,I.jsx)(`span`,{className:`min-w-0 text-center`,children:s(`personalityPage.updatingPersonality`,{name:e})})]}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(d,{className:`h-4 w-4`,"aria-hidden":!0}),s(`personalityPage.updatePersonality`)]})})]})]})}export{X 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-CCI2T82b.js";import{b as o,f as s,g as c,t as l}from"./react-DPM_L_aA.js";import{Mr as u,R as d,Sn as f,mi as p,nn as m,or as h,v as g}from"./icons-B-6TfGtd.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 se,m as O,n as ce,o as le,p as ue,r as de,t as fe,x as k,z as pe}from"./use-checkout-dismiss-refresh-BAuyCV44.js";import{Ar as A,Cv as me,Ff as he,Gf as ge,If as j,Ig as _e,Jc as M,Kc as ve,Lf as ye,Lp as be,My as xe,Ry as N,Sv as P,Yc as Se,Zc as Ce,_v as we,ap as Te,el as F,gg as Ee,il as De,ly as I,mg as L,nl as Oe,qc as ke,rl as Ae,xy as R,yy as z,zy as B}from"./index-CFjEz2JL.js";import{t as je}from"./android-billing-handoff-teTPHA-K.js";import{t as Me}from"./checkout-return-target-Cq7IUNKZ.js";import{i as Ne,r as Pe,s as Fe,t as V}from"./machine-sizes-Dnm82Ei9.js";var H=e(o(),1),Ie=`__none__`,U=`__baseline__`,W=`${Ne[V]} machine (${Pe[V]})`;function Le(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===U,d=u?null:s.find(e=>e.tier===r)??null,f=u?W: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?W: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: ${se(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 Re=`https://www.vellum.ai/docs/pricing`,ze=`${Re}#machine-sizes`,Be=`${Re}#storage`,Ve=`${Re}#credit-bundles`,G=l();function K(e){return(0,G.jsxs)(`span`,{className:`text-[12px] font-medium text-[var(--content-disabled)]`,children:[`+`,se(e)]})}function q({label:e,docsUrl:t,docsLabel:n,learnMore:r}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:e}),(0,G.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"aria-label":n,onClick:e=>L(e,t),className:`text-[11px] font-medium text-[var(--content-tertiary)] underline hover:text-[var(--content-default)]`,children:r})]})}function He({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,g]=(0,H.useState)(()=>p?p.machineTier??`__baseline__`:``),[_,v]=(0,H.useState)(()=>p?.storageTier??``),[b,S]=(0,H.useState)(()=>p?p.creditTier??`__none__`:``),[C,T]=(0,H.useState)({open:e,initialSelection:i});(C.open!==e||C.initialSelection!==i)&&(T({open:e,initialSelection:i}),g(p?p.machineTier??`__baseline__`:``),v(p?.storageTier??``),S(p?p.creditTier??`__none__`:``));let E=t.machine_tiers,ee=(0,H.useMemo)(()=>t.storage_tiers.filter(e=>!e.legacy||e.tier===i?.storageTier),[t.storage_tiers,i?.storageTier]),te=t.credit_tiers??[],ne=(0,H.useMemo)(()=>(t.credit_tiers??[]).filter(e=>!e.legacy),[t.credit_tiers]),re=e=>k(e)||e.legacy&&e.tier!==i?.storageTier||r!=null&&e.storage_gib<r,ie=i!=null&&i.machineTier==null,ae=[...ie?[{value:U,label:W,icon:(0,G.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),disabled:!0}]:[],...E.map(e=>({value:e.tier,label:e.description,icon:(0,G.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(e.price_cents),disabled:k(e)}))],oe=ee.map(e=>({value:e.tier,label:e.label,icon:(0,G.jsx)(f,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(e.price_cents),disabled:re(e)})),D=b&&b!==`__none__`?te.find(e=>e.tier===b)??null:null,O=D?.legacy?D:null,ce=[{value:Ie,label:l,icon:(0,G.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0})},...ne.map(e=>({value:e.tier,label:e.label,icon:(0,G.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(e.price_cents)})),...O?[{value:O.tier,label:O.label,icon:(0,G.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(O.price_cents),disabled:!0}]:[]],le=m===U,ue=le?null:E.find(e=>e.tier===m)??null,de=le?ie?{tier:null}:null:ue==null?null:{tier:ue.tier},fe=_!==``&&_===i?.storageTier,pe=ee.find(e=>e.tier===_&&(fe||!re(e)))??null,A=b===`__none__`||b===i?.creditTier||ne.some(e=>e.tier===b),me=b!==``&&A?b:null,he=de!=null&&pe!=null&&me!=null,ge=i!=null&&m===(i.machineTier??`__baseline__`)&&_===i.storageTier&&b===(i.creditTier??`__none__`),j=(0,H.useMemo)(()=>Le({proPlan:t,seed:i??null,machineTier:m,storageTier:_,creditChoice:b,noBundleLabel:l}),[t,i,m,_,b,l]);return(0,G.jsx)(R.Root,{open:e,onOpenChange:e=>{e||o()},children:(0,G.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,G.jsx)(R.Body,{className:`p-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-8 md:flex-row md:gap-12`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6 md:flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--surface-active)] p-[14px]`,children:(0,G.jsx)(d,{className:`h-6 w-6 text-[var(--content-emphasised)]`,"aria-hidden":!0})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,G.jsx)(R.Title,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.title`)}),(0,G.jsx)(R.Description,{className:`mt-0 text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:c(`customPlanModal.subtitle`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(q,{label:c(`customPlanModal.machineSizeLabel`),docsUrl:ze,docsLabel:c(`customPlanModal.machineSizeDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,G.jsx)(I,{"aria-label":c(`customPlanModal.machineSizeAriaLabel`),placeholder:c(`customPlanModal.machineSizePlaceholder`),value:m,onChange:g,options:ae})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(q,{label:c(`customPlanModal.storageLabel`),docsUrl:Be,docsLabel:c(`customPlanModal.storageDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,G.jsx)(I,{"aria-label":c(`customPlanModal.storageAriaLabel`),placeholder:c(`customPlanModal.storagePlaceholder`),value:_,onChange:v,options:oe})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(q,{label:c(`customPlanModal.usageBundleLabel`),docsUrl:Ve,docsLabel:c(`customPlanModal.usageBundleDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,G.jsx)(I,{"aria-label":c(`customPlanModal.usageBundleAriaLabel`),placeholder:c(`customPlanModal.usageBundlePlaceholder`),value:b,onChange:S,options:ce})]})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-16 md:pt-[5px]`,children:[(0,G.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.recap`)}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:se(j.totalCents)}),j.deltaCents!=null&&j.deltaCents!==0&&j.previousTotalCents!=null&&(0,G.jsx)(`span`,{className:`text-[12px] font-medium ${j.deltaCents>0?`text-[var(--system-positive-strong)]`:`text-[var(--system-negative-strong)]`}`,children:c(`customPlanModal.comparedToPrevious`,{delta:y(j.deltaCents),previous:w(j.previousTotalCents)})}),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.totalBilledMonthly`)})]}),(0,G.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.yourSelection`)}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:j.rows.map(e=>(0,G.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[e.previousLabel!=null&&(0,G.jsxs)(`div`,{className:`relative flex w-fit items-start gap-2`,children:[(0,G.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`,"aria-hidden":!0}),(0,G.jsx)(`s`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-disabled)] no-underline`,children:e.previousLabel}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute -left-1 right-0 top-[9px] h-px bg-[var(--content-disabled)]`})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(u,{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,G.jsx)(`span`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-secondary)]`,children:e.label})]})]},e.key))}),(0,G.jsx)(B,{variant:`primary`,fullWidth:!0,disabled:!he||ge||n,onClick:()=>{!he||ge||n||s({machineTier:de.tier,storageTier:pe.tier,creditTier:me===`__none__`?null:me})},children:c(`customPlanModal.continue`)}),(0,G.jsx)(B,{variant:`ghost`,fullWidth:!0,disabled:n,onClick:o,children:c(`customPlanModal.cancel`)})]})]})]})})})})}function Ue({className:e,onConfigure:t,configureDisabled:n,isCurrent:r=!1,currentSummary:i}){let{t:o}=a(`settings`);return(0,G.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-8 ${e??``}`,children:[(0,G.jsx)(`p`,{className:`text-center text-[20px] font-medium text-[var(--content-tertiary)]`,children:o(`customPlanRow.prompt`)}),(0,G.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,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--content-disabled)] p-[14px]`,children:(0,G.jsx)(d,{className:`h-6 w-6 text-[var(--aux-white)]`,"aria-hidden":!0})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:o(`customPlanRow.title`)}),r?(0,G.jsx)(xe,{className:`bg-[var(--feed-digest-weak)] text-[var(--content-default)]`,children:o(`customPlanRow.currentPlanTag`)}):null]}),(0,G.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-tertiary)]`,children:i??o(`customPlanRow.genericDescriptor`)})]})]}),(0,G.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:(0,G.jsx)(B,{variant:`outlined`,onClick:t,disabled:n,children:o(`customPlanRow.configure`)})})]})]})}function We({open:e,lostFeatures:t,viaPortal:n,pending:r,onCancel:i,onConfirm:o}){let{t:s}=a(`settings`),c=t.length>0;return(0,G.jsx)(R.Root,{open:e,onOpenChange:e=>{!e&&!r&&i()},children:(0,G.jsxs)(R.Content,{size:`md`,hideCloseButton:!0,children:[(0,G.jsx)(R.Header,{icon:g,children:(0,G.jsx)(R.Title,{children:s(`freeDowngradeConfirmModal.title`)})}),(0,G.jsxs)(R.Body,{children:[(0,G.jsx)(N,{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,G.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5`,children:t.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(N,{as:`span`,variant:`body-medium-default`,children:e})},e))}):null]}),(0,G.jsxs)(R.Footer,{children:[(0,G.jsx)(B,{variant:`outlined`,onClick:i,disabled:r,children:s(`freeDowngradeConfirmModal.cancel`)}),(0,G.jsx)(B,{variant:`danger`,onClick:o,disabled:r,"data-testid":`confirm-free-downgrade-button`,children:s(`freeDowngradeConfirmModal.confirm`)})]})]})})}function Ge({tierKey:e,name:t,tagline:n,priceLabel:r,priceCaption:i,ctaLabel:o,features:s,recommended:c=!1,tone:l=`dark`,isCurrent:d,intent:f=`upgrade`,pending:p,onCta:m}){let{t:h}=a(`settings`),g=f===`downgrade`&&!d;return(0,G.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,G.jsx)(C,{tier:e,size:50}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex h-8 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[20px] font-medium text-[var(--content-emphasised)]`,children:t}),c&&!g&&!d?(0,G.jsx)(xe,{className:`bg-[var(--feed-digest-weak)] text-[12px] font-semibold uppercase text-[var(--credits-accent)]`,children:h(`planColumnCard.recommended`)}):null]}),(0,G.jsx)(`p`,{className:`overflow-hidden text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)] sm:h-9`,children:n})]}),(0,G.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:r}),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:i})]}),(0,G.jsx)(B,{variant:g?`outlined`:`primary`,fullWidth:!0,disabled:d||p,onClick:m,children:d?h(`planColumnCard.currentPlan`):o}),(0,G.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:gap-4`,children:[(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:h(`planColumnCard.includes`)}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:s.map(e=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-secondary)]`,children:e})]},e))})]})]})}function Ke({enabled:e=!0}={}){let n=i(),a=Te(),o=e&&a,s=r({...Oe(),enabled:o}),c=s.data,l=c!=null&&c.plan_id!==`base`,u=r({...F(),enabled:o&&l}),d=r({...ve(),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(Se()),m=t(Ce()),h=t(M()),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&&ue.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=>O(e.error,`Failed to update ${e.dimension} tier.`)).join(` `);return z.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 qe=`#0A0A0B`,Je=8e3,Ye={upgrade:`upgrade`,downgrade:`downgrade`,switch:`change`};A();function J(e,t){return t(`plansPage.featureComputer`,{machine:ee(e)})}function Xe(e,t,n){return[J(e,n),n(`plansPage.featureStorage`,{gib:e.storage_gib}),n(`plansPage.featureUsage`,{name:e.name}),...t]}function Ze(e,t){return v(e,t).join(` · `)}function Qe(){let{t:e}=a(`settings`),o=s(),[l,u]=c(),d=i(),f=me(),h=ye({platformHostedOnly:!0}),g=he(),v=j(),y=h===`full`&&g,x=h===`full`&&v,C=r({...Oe(),enabled:y}),w=r({...ve(),enabled:y}),ee=t(De()),{changePackage:oe,isPending:D}=de(),{changeTiers:se,isPending:ue,current:k,currentReady:A,currentKnown:M,primaryAssistantId:xe}=Ke({enabled:y});fe();let[N,Se]=(0,H.useState)(!1),[Ce,F]=(0,H.useState)(!1),[I,L]=(0,H.useState)(!1),[R,Ne]=(0,H.useState)(null),[Pe,V]=(0,H.useState)(!1),[Ie,U]=(0,H.useState)(void 0),W=(0,H.useRef)(!1),[Le,ze]=(0,H.useState)(!1),Be=(0,H.useRef)(!1),[Ve,K]=(0,H.useState)(null),q=C.data,J=w.data?.plans.find(e=>e.id===`pro`),Qe=J?.packages??[],$e=Qe.length>0,Y=q?.plan_id===`pro`,et=Te(),tt=te(xe,y&&et&&Y&&M),nt=M?tt:void 0,X=q?q.plan_id===`base`?`free`:b(q.package)?q.package.key:null:null,{cancelSubscription:rt,isPending:it}=ne(),at=ae(q),ot=re(le(q)),st=be(),ct=new Set(w.data?.plans.find(e=>e.id===`base`)?.included_features??[]),lt=(J?.included_features??[]).filter(e=>!ct.has(e)),Z=N||D||it||ot.isPending,ut=(0,H.useMemo)(()=>!Y||k.storageTier==null?null:{machineTier:k.machineTier,storageTier:k.storageTier,creditTier:k.creditTier},[Y,k.machineTier,k.storageTier,k.creditTier]),Q=l.get(we),dt=!y&&!x,ft=y&&!w.isLoading&&!$e,$=dt||!(Q!=null&&!Le)&&(C.isError||ft);(0,H.useEffect)(()=>{$&&o(dt?P.settings.usageBilling:`${P.settings.usageBilling}&adjust_plan`,{replace:!0})},[$,dt,o]);let pt=()=>{(window.history.state?.idx??0)>0?o(-1):o(P.settings.usageBilling)},mt=async t=>{Se(!0);try{let e=await ee.mutateAsync({body:{...t,return_target:Me()}});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}),ge(d),Ee(e.checkout_url)):(await d.invalidateQueries({queryKey:Ae()}),await d.invalidateQueries({queryKey:ke()}))}catch(t){z.error(O(t,e(`plansPage.checkoutFailedToast`)))}finally{Se(!1)}},ht=(e,t)=>{if(q&&!Z){if(st){je(P.plans);return}if(Y){if(e===`free`){L(!0);return}let n=Qe.find(t=>t.key===e);if(!n||E(X,n.key)===`current`)return;if(!ie(q)){o(`${P.settings.usageBilling}&adjust_plan`,{replace:t?.replaceOnBail===!0});return}Ne(n);return}e!==`free`&&mt({target_plan_id:`pro`,package:e,confirm:!0})}},gt=(0,H.useRef)(ht);(0,H.useEffect)(()=>{gt.current=ht}),(0,H.useEffect)(()=>{if(Q==null||W.current||$||!y||Be.current)return;Be.current=!0;let e=setTimeout(()=>{ze(!0)},Je),t=()=>{clearTimeout(e),ze(!0)};Promise.all([d.refetchQueries({queryKey:Ae()}),d.refetchQueries({queryKey:ke()})]).then(t,t)},[$,Q,y,d]),(0,H.useEffect)(()=>{Q==null||W.current||$||!y||!Le||(W.current=!0,Y&&Q!==`free`&&K(Q),u(e=>{let t=new URLSearchParams(e);return t.delete(we),t},{replace:!0}))},[Le,$,Q,y,Y,u]),(0,H.useEffect)(()=>{Ve==null||Q!=null||(K(null),gt.current(Ve,{replaceOnBail:!0}))},[Q,Ve]);let _t;if(q&&J&&$e){let t=Y&&X===null&&A&&k.storageGib!=null,r=t?Ze(k,J):void 0,i=async()=>{if(!at){L(!1),ot.mutate({});return}await rt()&&L(!1)},a=()=>({creditTier:k.creditTier,fromSnapshot:{machineSize:nt?.machine_size??null,storageGib:nt?.provisioned_storage_gib??null}}),o=R?X===null?`switch`:E(X,R.key)===`downgrade`?`downgrade`:`upgrade`:`upgrade`,s=async()=>{if(!R)return;let t=R,n=a(),r=X===null||!A||!M||Fe(k.machineTier,t.machine_tier),i=await oe(t.key);if(!i)return;if(Ne(null),i.status===`no_op`){z.success(e(`plansPage.alreadyOnPlanToast`));return}let s=t.credit_tier??null;U({fromSnapshot:n.fromSnapshot,credits:s===n.creditTier?null:{fromTier:n.creditTier,toTier:s},direction:Ye[o],canLowerResources:r}),V(!0)},c=e=>mt({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=!M||Fe(k.machineTier,t.machineTier),i=await se(t);i&&(F(!1),i.needsResize||i.creditChanged?(U({fromSnapshot:n.fromSnapshot,credits:i.creditChanged?{fromTier:n.creditTier,toTier:t.creditTier}:null,direction:`change`,canLowerResources:r}),V(!0)):z.success(e(`plansPage.planUpdatedToast`)))},u=()=>{if(!Z){if(st){je(P.plans);return}Y&&!A||F(!0)}},d=[...Qe].sort((e,t)=>T.indexOf(e.key)-T.indexOf(t.key)),f=S(`free`),p=Y?`downgrade`:E(X,`free`),m=[e(`plansPage.freeFeatureSmallComputer`),e(`plansPage.freeFeatureStorage`,{gib:4}),e(`plansPage.freeFeaturePayAsYouGo`)];_t=(0,G.jsxs)(`div`,{className:`my-auto flex w-full flex-col items-center`,children:[(0,G.jsxs)(`header`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,G.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,G.jsx)(`p`,{className:`text-[20px] font-medium text-[var(--content-tertiary)]`,children:e(`plansPage.subheading`)})]}),(0,G.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,G.jsx)(Ge,{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:X===`free`,intent:p,pending:Z,onCta:()=>ht(`free`)}),d.map(t=>{let n=S(t.key),r=E(X,t.key);return(0,G.jsx)(Ge,{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:Xe(t,n?.extraFeatures??[],e),recommended:n?.recommended,tone:n?.recommended?`light`:`dark`,isCurrent:X===t.key,intent:r,pending:Z,onCta:()=>ht(t.key)},t.key)})]}),(0,G.jsx)(Ue,{className:`mt-6 sm:mt-10`,onConfigure:u,configureDisabled:Y&&!A||Z,isCurrent:t,currentSummary:r}),(0,G.jsx)(He,{open:Ce,proPlan:J,pending:N||ue,currentStorageGib:Y?k.storageGib:null,initialSelection:ut,onClose:()=>F(!1),onContinue:e=>{Y?l(e):c(e)}}),(0,G.jsx)(ce,{open:R!==null,relation:o,packageName:R?.name??``,targetPackage:R,pending:D,onCancel:()=>Ne(null),onConfirm:()=>void s()}),(0,G.jsx)(We,{open:I,lostFeatures:lt,viaPortal:!at,pending:it||ot.isPending,onCancel:()=>L(!1),onConfirm:()=>void i()}),(0,G.jsx)(pe,{mode:`resize`,open:Pe,onClose:()=>{V(!1),U(void 0)},resizeContext:Ie}),(0,G.jsx)(`p`,{className:`mt-6 text-center text-[12px] font-medium text-[var(--content-tertiary)] sm:mt-10`,children:(0,G.jsx)(n,{ns:`settings`,i18nKey:`plansPage.cancelAnytimeFooter`,components:{docsLink:(0,G.jsx)(`a`,{href:Re,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--content-default)] underline`})}})})]})}else _t=(0,G.jsx)(`div`,{className:`my-auto flex items-center justify-center`,children:(0,G.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`plansPage.loadingPlansAriaLabel`)})});return(0,G.jsxs)(`div`,{"data-theme":`dark`,className:`plans-takeover-canvas-enter relative h-full w-full overflow-y-auto`,style:{backgroundColor:qe},children:[(0,G.jsx)(`div`,{className:`absolute left-8 z-10 [-webkit-app-region:no-drag]`,style:{top:f?`3rem`:`2rem`},children:(0,G.jsx)(B,{variant:`outlined`,leftIcon:(0,G.jsx)(p,{className:`h-4 w-4`,"aria-hidden":!0}),onClick:pt,className:`[-webkit-app-region:no-drag]`,children:e(`plansPage.back`)})}),(0,G.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 $e(){return(0,G.jsx)(Qe,{})}export{$e 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-CCI2T82b.js";import{b as o,f as s,g as c,t as l}from"./react-DPM_L_aA.js";import{Mr as u,R as d,Sn as f,mi as p,nn as m,or as h,v as g}from"./icons-B-6TfGtd.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 se,m as O,n as ce,o as le,p as ue,r as de,t as fe,x as k,z as pe}from"./use-checkout-dismiss-refresh-CDVPyEES.js";import{Ar as A,Cv as me,Ff as he,Gf as ge,If as j,Ig as _e,Jc as M,Kc as ve,Lf as ye,Lp as be,My as xe,Ry as N,Sv as P,Yc as Se,Zc as Ce,_v as we,ap as Te,el as F,gg as Ee,il as De,ly as I,mg as L,nl as Oe,qc as ke,rl as Ae,xy as R,yy as z,zy as B}from"./index-DZRUYtkw.js";import{t as je}from"./android-billing-handoff-CuMiggT0.js";import{t as Me}from"./checkout-return-target-DHK6vMrZ.js";import{i as Ne,r as Pe,s as Fe,t as V}from"./machine-sizes-Dnm82Ei9.js";var H=e(o(),1),Ie=`__none__`,U=`__baseline__`,W=`${Ne[V]} machine (${Pe[V]})`;function Le(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===U,d=u?null:s.find(e=>e.tier===r)??null,f=u?W: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?W: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: ${se(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 Re=`https://www.vellum.ai/docs/pricing`,ze=`${Re}#machine-sizes`,Be=`${Re}#storage`,Ve=`${Re}#credit-bundles`,G=l();function K(e){return(0,G.jsxs)(`span`,{className:`text-[12px] font-medium text-[var(--content-disabled)]`,children:[`+`,se(e)]})}function q({label:e,docsUrl:t,docsLabel:n,learnMore:r}){return(0,G.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-secondary)]`,children:e}),(0,G.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"aria-label":n,onClick:e=>L(e,t),className:`text-[11px] font-medium text-[var(--content-tertiary)] underline hover:text-[var(--content-default)]`,children:r})]})}function He({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,g]=(0,H.useState)(()=>p?p.machineTier??`__baseline__`:``),[_,v]=(0,H.useState)(()=>p?.storageTier??``),[b,S]=(0,H.useState)(()=>p?p.creditTier??`__none__`:``),[C,T]=(0,H.useState)({open:e,initialSelection:i});(C.open!==e||C.initialSelection!==i)&&(T({open:e,initialSelection:i}),g(p?p.machineTier??`__baseline__`:``),v(p?.storageTier??``),S(p?p.creditTier??`__none__`:``));let E=t.machine_tiers,ee=(0,H.useMemo)(()=>t.storage_tiers.filter(e=>!e.legacy||e.tier===i?.storageTier),[t.storage_tiers,i?.storageTier]),te=t.credit_tiers??[],ne=(0,H.useMemo)(()=>(t.credit_tiers??[]).filter(e=>!e.legacy),[t.credit_tiers]),re=e=>k(e)||e.legacy&&e.tier!==i?.storageTier||r!=null&&e.storage_gib<r,ie=i!=null&&i.machineTier==null,ae=[...ie?[{value:U,label:W,icon:(0,G.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),disabled:!0}]:[],...E.map(e=>({value:e.tier,label:e.description,icon:(0,G.jsx)(x,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(e.price_cents),disabled:k(e)}))],oe=ee.map(e=>({value:e.tier,label:e.label,icon:(0,G.jsx)(f,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(e.price_cents),disabled:re(e)})),D=b&&b!==`__none__`?te.find(e=>e.tier===b)??null:null,O=D?.legacy?D:null,ce=[{value:Ie,label:l,icon:(0,G.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0})},...ne.map(e=>({value:e.tier,label:e.label,icon:(0,G.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(e.price_cents)})),...O?[{value:O.tier,label:O.label,icon:(0,G.jsx)(h,{className:`h-4 w-4`,"aria-hidden":!0}),suffix:K(O.price_cents),disabled:!0}]:[]],le=m===U,ue=le?null:E.find(e=>e.tier===m)??null,de=le?ie?{tier:null}:null:ue==null?null:{tier:ue.tier},fe=_!==``&&_===i?.storageTier,pe=ee.find(e=>e.tier===_&&(fe||!re(e)))??null,A=b===`__none__`||b===i?.creditTier||ne.some(e=>e.tier===b),me=b!==``&&A?b:null,he=de!=null&&pe!=null&&me!=null,ge=i!=null&&m===(i.machineTier??`__baseline__`)&&_===i.storageTier&&b===(i.creditTier??`__none__`),j=(0,H.useMemo)(()=>Le({proPlan:t,seed:i??null,machineTier:m,storageTier:_,creditChoice:b,noBundleLabel:l}),[t,i,m,_,b,l]);return(0,G.jsx)(R.Root,{open:e,onOpenChange:e=>{e||o()},children:(0,G.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,G.jsx)(R.Body,{className:`p-4`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-8 md:flex-row md:gap-12`,children:[(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6 md:flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--surface-active)] p-[14px]`,children:(0,G.jsx)(d,{className:`h-6 w-6 text-[var(--content-emphasised)]`,"aria-hidden":!0})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,G.jsx)(R.Title,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.title`)}),(0,G.jsx)(R.Description,{className:`mt-0 text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:c(`customPlanModal.subtitle`)})]})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(q,{label:c(`customPlanModal.machineSizeLabel`),docsUrl:ze,docsLabel:c(`customPlanModal.machineSizeDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,G.jsx)(I,{"aria-label":c(`customPlanModal.machineSizeAriaLabel`),placeholder:c(`customPlanModal.machineSizePlaceholder`),value:m,onChange:g,options:ae})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(q,{label:c(`customPlanModal.storageLabel`),docsUrl:Be,docsLabel:c(`customPlanModal.storageDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,G.jsx)(I,{"aria-label":c(`customPlanModal.storageAriaLabel`),placeholder:c(`customPlanModal.storagePlaceholder`),value:_,onChange:v,options:oe})]}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(q,{label:c(`customPlanModal.usageBundleLabel`),docsUrl:Ve,docsLabel:c(`customPlanModal.usageBundleDocsAriaLabel`),learnMore:c(`customPlanModal.learnMore`)}),(0,G.jsx)(I,{"aria-label":c(`customPlanModal.usageBundleAriaLabel`),placeholder:c(`customPlanModal.usageBundlePlaceholder`),value:b,onChange:S,options:ce})]})]}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-16 md:pt-[5px]`,children:[(0,G.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:c(`customPlanModal.recap`)}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:se(j.totalCents)}),j.deltaCents!=null&&j.deltaCents!==0&&j.previousTotalCents!=null&&(0,G.jsx)(`span`,{className:`text-[12px] font-medium ${j.deltaCents>0?`text-[var(--system-positive-strong)]`:`text-[var(--system-negative-strong)]`}`,children:c(`customPlanModal.comparedToPrevious`,{delta:y(j.deltaCents),previous:w(j.previousTotalCents)})}),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.totalBilledMonthly`)})]}),(0,G.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:c(`customPlanModal.yourSelection`)}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:j.rows.map(e=>(0,G.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[e.previousLabel!=null&&(0,G.jsxs)(`div`,{className:`relative flex w-fit items-start gap-2`,children:[(0,G.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-disabled)]`,"aria-hidden":!0}),(0,G.jsx)(`s`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-disabled)] no-underline`,children:e.previousLabel}),(0,G.jsx)(`span`,{"aria-hidden":!0,className:`pointer-events-none absolute -left-1 right-0 top-[9px] h-px bg-[var(--content-disabled)]`})]}),(0,G.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(u,{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,G.jsx)(`span`,{className:`text-[14px] font-medium leading-[18px] text-[var(--content-secondary)]`,children:e.label})]})]},e.key))}),(0,G.jsx)(B,{variant:`primary`,fullWidth:!0,disabled:!he||ge||n,onClick:()=>{!he||ge||n||s({machineTier:de.tier,storageTier:pe.tier,creditTier:me===`__none__`?null:me})},children:c(`customPlanModal.continue`)}),(0,G.jsx)(B,{variant:`ghost`,fullWidth:!0,disabled:n,onClick:o,children:c(`customPlanModal.cancel`)})]})]})]})})})})}function Ue({className:e,onConfigure:t,configureDisabled:n,isCurrent:r=!1,currentSummary:i}){let{t:o}=a(`settings`);return(0,G.jsxs)(`div`,{className:`flex w-full flex-col items-center gap-8 ${e??``}`,children:[(0,G.jsx)(`p`,{className:`text-center text-[20px] font-medium text-[var(--content-tertiary)]`,children:o(`customPlanRow.prompt`)}),(0,G.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,G.jsxs)(`div`,{className:`flex min-w-0 items-center gap-4`,children:[(0,G.jsx)(`div`,{className:`flex shrink-0 items-center justify-center rounded-xl bg-[var(--content-disabled)] p-[14px]`,children:(0,G.jsx)(d,{className:`h-6 w-6 text-[var(--aux-white)]`,"aria-hidden":!0})}),(0,G.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,G.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[16px] font-medium text-[var(--content-emphasised)]`,children:o(`customPlanRow.title`)}),r?(0,G.jsx)(xe,{className:`bg-[var(--feed-digest-weak)] text-[var(--content-default)]`,children:o(`customPlanRow.currentPlanTag`)}):null]}),(0,G.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-tertiary)]`,children:i??o(`customPlanRow.genericDescriptor`)})]})]}),(0,G.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:(0,G.jsx)(B,{variant:`outlined`,onClick:t,disabled:n,children:o(`customPlanRow.configure`)})})]})]})}function We({open:e,lostFeatures:t,viaPortal:n,pending:r,onCancel:i,onConfirm:o}){let{t:s}=a(`settings`),c=t.length>0;return(0,G.jsx)(R.Root,{open:e,onOpenChange:e=>{!e&&!r&&i()},children:(0,G.jsxs)(R.Content,{size:`md`,hideCloseButton:!0,children:[(0,G.jsx)(R.Header,{icon:g,children:(0,G.jsx)(R.Title,{children:s(`freeDowngradeConfirmModal.title`)})}),(0,G.jsxs)(R.Body,{children:[(0,G.jsx)(N,{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,G.jsx)(`ul`,{className:`mt-4 list-disc space-y-2 pl-5`,children:t.map(e=>(0,G.jsx)(`li`,{children:(0,G.jsx)(N,{as:`span`,variant:`body-medium-default`,children:e})},e))}):null]}),(0,G.jsxs)(R.Footer,{children:[(0,G.jsx)(B,{variant:`outlined`,onClick:i,disabled:r,children:s(`freeDowngradeConfirmModal.cancel`)}),(0,G.jsx)(B,{variant:`danger`,onClick:o,disabled:r,"data-testid":`confirm-free-downgrade-button`,children:s(`freeDowngradeConfirmModal.confirm`)})]})]})})}function Ge({tierKey:e,name:t,tagline:n,priceLabel:r,priceCaption:i,ctaLabel:o,features:s,recommended:c=!1,tone:l=`dark`,isCurrent:d,intent:f=`upgrade`,pending:p,onCta:m}){let{t:h}=a(`settings`),g=f===`downgrade`&&!d;return(0,G.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,G.jsx)(C,{tier:e,size:50}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsxs)(`div`,{className:`flex h-8 items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-[20px] font-medium text-[var(--content-emphasised)]`,children:t}),c&&!g&&!d?(0,G.jsx)(xe,{className:`bg-[var(--feed-digest-weak)] text-[12px] font-semibold uppercase text-[var(--credits-accent)]`,children:h(`planColumnCard.recommended`)}):null]}),(0,G.jsx)(`p`,{className:`overflow-hidden text-[14px] font-medium leading-[18px] text-[var(--content-tertiary)] sm:h-9`,children:n})]}),(0,G.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,G.jsx)(`span`,{className:`text-[24px] font-medium text-[var(--content-default)]`,children:r}),(0,G.jsx)(`span`,{className:`text-[11px] font-medium text-[var(--content-tertiary)]`,children:i})]}),(0,G.jsx)(B,{variant:g?`outlined`:`primary`,fullWidth:!0,disabled:d||p,onClick:m,children:d?h(`planColumnCard.currentPlan`):o}),(0,G.jsx)(`div`,{className:`h-px w-full bg-[var(--border-hover)]`}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2 sm:gap-4`,children:[(0,G.jsx)(`span`,{className:`text-[12px] font-medium text-[var(--content-tertiary)]`,children:h(`planColumnCard.includes`)}),(0,G.jsx)(`ul`,{className:`flex flex-col gap-2`,children:s.map(e=>(0,G.jsxs)(`li`,{className:`flex items-start gap-2`,children:[(0,G.jsx)(u,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-secondary)]`,"aria-hidden":!0}),(0,G.jsx)(`span`,{className:`text-[14px] font-medium text-[var(--content-secondary)]`,children:e})]},e))})]})]})}function Ke({enabled:e=!0}={}){let n=i(),a=Te(),o=e&&a,s=r({...Oe(),enabled:o}),c=s.data,l=c!=null&&c.plan_id!==`base`,u=r({...F(),enabled:o&&l}),d=r({...ve(),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(Se()),m=t(Ce()),h=t(M()),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&&ue.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=>O(e.error,`Failed to update ${e.dimension} tier.`)).join(` `);return z.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 qe=`#0A0A0B`,Je=8e3,Ye={upgrade:`upgrade`,downgrade:`downgrade`,switch:`change`};A();function J(e,t){return t(`plansPage.featureComputer`,{machine:ee(e)})}function Xe(e,t,n){return[J(e,n),n(`plansPage.featureStorage`,{gib:e.storage_gib}),n(`plansPage.featureUsage`,{name:e.name}),...t]}function Ze(e,t){return v(e,t).join(` · `)}function Qe(){let{t:e}=a(`settings`),o=s(),[l,u]=c(),d=i(),f=me(),h=ye({platformHostedOnly:!0}),g=he(),v=j(),y=h===`full`&&g,x=h===`full`&&v,C=r({...Oe(),enabled:y}),w=r({...ve(),enabled:y}),ee=t(De()),{changePackage:oe,isPending:D}=de(),{changeTiers:se,isPending:ue,current:k,currentReady:A,currentKnown:M,primaryAssistantId:xe}=Ke({enabled:y});fe();let[N,Se]=(0,H.useState)(!1),[Ce,F]=(0,H.useState)(!1),[I,L]=(0,H.useState)(!1),[R,Ne]=(0,H.useState)(null),[Pe,V]=(0,H.useState)(!1),[Ie,U]=(0,H.useState)(void 0),W=(0,H.useRef)(!1),[Le,ze]=(0,H.useState)(!1),Be=(0,H.useRef)(!1),[Ve,K]=(0,H.useState)(null),q=C.data,J=w.data?.plans.find(e=>e.id===`pro`),Qe=J?.packages??[],$e=Qe.length>0,Y=q?.plan_id===`pro`,et=Te(),tt=te(xe,y&&et&&Y&&M),nt=M?tt:void 0,X=q?q.plan_id===`base`?`free`:b(q.package)?q.package.key:null:null,{cancelSubscription:rt,isPending:it}=ne(),at=ae(q),ot=re(le(q)),st=be(),ct=new Set(w.data?.plans.find(e=>e.id===`base`)?.included_features??[]),lt=(J?.included_features??[]).filter(e=>!ct.has(e)),Z=N||D||it||ot.isPending,ut=(0,H.useMemo)(()=>!Y||k.storageTier==null?null:{machineTier:k.machineTier,storageTier:k.storageTier,creditTier:k.creditTier},[Y,k.machineTier,k.storageTier,k.creditTier]),Q=l.get(we),dt=!y&&!x,ft=y&&!w.isLoading&&!$e,$=dt||!(Q!=null&&!Le)&&(C.isError||ft);(0,H.useEffect)(()=>{$&&o(dt?P.settings.usageBilling:`${P.settings.usageBilling}&adjust_plan`,{replace:!0})},[$,dt,o]);let pt=()=>{(window.history.state?.idx??0)>0?o(-1):o(P.settings.usageBilling)},mt=async t=>{Se(!0);try{let e=await ee.mutateAsync({body:{...t,return_target:Me()}});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}),ge(d),Ee(e.checkout_url)):(await d.invalidateQueries({queryKey:Ae()}),await d.invalidateQueries({queryKey:ke()}))}catch(t){z.error(O(t,e(`plansPage.checkoutFailedToast`)))}finally{Se(!1)}},ht=(e,t)=>{if(q&&!Z){if(st){je(P.plans);return}if(Y){if(e===`free`){L(!0);return}let n=Qe.find(t=>t.key===e);if(!n||E(X,n.key)===`current`)return;if(!ie(q)){o(`${P.settings.usageBilling}&adjust_plan`,{replace:t?.replaceOnBail===!0});return}Ne(n);return}e!==`free`&&mt({target_plan_id:`pro`,package:e,confirm:!0})}},gt=(0,H.useRef)(ht);(0,H.useEffect)(()=>{gt.current=ht}),(0,H.useEffect)(()=>{if(Q==null||W.current||$||!y||Be.current)return;Be.current=!0;let e=setTimeout(()=>{ze(!0)},Je),t=()=>{clearTimeout(e),ze(!0)};Promise.all([d.refetchQueries({queryKey:Ae()}),d.refetchQueries({queryKey:ke()})]).then(t,t)},[$,Q,y,d]),(0,H.useEffect)(()=>{Q==null||W.current||$||!y||!Le||(W.current=!0,Y&&Q!==`free`&&K(Q),u(e=>{let t=new URLSearchParams(e);return t.delete(we),t},{replace:!0}))},[Le,$,Q,y,Y,u]),(0,H.useEffect)(()=>{Ve==null||Q!=null||(K(null),gt.current(Ve,{replaceOnBail:!0}))},[Q,Ve]);let _t;if(q&&J&&$e){let t=Y&&X===null&&A&&k.storageGib!=null,r=t?Ze(k,J):void 0,i=async()=>{if(!at){L(!1),ot.mutate({});return}await rt()&&L(!1)},a=()=>({creditTier:k.creditTier,fromSnapshot:{machineSize:nt?.machine_size??null,storageGib:nt?.provisioned_storage_gib??null}}),o=R?X===null?`switch`:E(X,R.key)===`downgrade`?`downgrade`:`upgrade`:`upgrade`,s=async()=>{if(!R)return;let t=R,n=a(),r=X===null||!A||!M||Fe(k.machineTier,t.machine_tier),i=await oe(t.key);if(!i)return;if(Ne(null),i.status===`no_op`){z.success(e(`plansPage.alreadyOnPlanToast`));return}let s=t.credit_tier??null;U({fromSnapshot:n.fromSnapshot,credits:s===n.creditTier?null:{fromTier:n.creditTier,toTier:s},direction:Ye[o],canLowerResources:r}),V(!0)},c=e=>mt({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=!M||Fe(k.machineTier,t.machineTier),i=await se(t);i&&(F(!1),i.needsResize||i.creditChanged?(U({fromSnapshot:n.fromSnapshot,credits:i.creditChanged?{fromTier:n.creditTier,toTier:t.creditTier}:null,direction:`change`,canLowerResources:r}),V(!0)):z.success(e(`plansPage.planUpdatedToast`)))},u=()=>{if(!Z){if(st){je(P.plans);return}Y&&!A||F(!0)}},d=[...Qe].sort((e,t)=>T.indexOf(e.key)-T.indexOf(t.key)),f=S(`free`),p=Y?`downgrade`:E(X,`free`),m=[e(`plansPage.freeFeatureSmallComputer`),e(`plansPage.freeFeatureStorage`,{gib:4}),e(`plansPage.freeFeaturePayAsYouGo`)];_t=(0,G.jsxs)(`div`,{className:`my-auto flex w-full flex-col items-center`,children:[(0,G.jsxs)(`header`,{className:`flex flex-col items-center gap-2 text-center`,children:[(0,G.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,G.jsx)(`p`,{className:`text-[20px] font-medium text-[var(--content-tertiary)]`,children:e(`plansPage.subheading`)})]}),(0,G.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,G.jsx)(Ge,{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:X===`free`,intent:p,pending:Z,onCta:()=>ht(`free`)}),d.map(t=>{let n=S(t.key),r=E(X,t.key);return(0,G.jsx)(Ge,{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:Xe(t,n?.extraFeatures??[],e),recommended:n?.recommended,tone:n?.recommended?`light`:`dark`,isCurrent:X===t.key,intent:r,pending:Z,onCta:()=>ht(t.key)},t.key)})]}),(0,G.jsx)(Ue,{className:`mt-6 sm:mt-10`,onConfigure:u,configureDisabled:Y&&!A||Z,isCurrent:t,currentSummary:r}),(0,G.jsx)(He,{open:Ce,proPlan:J,pending:N||ue,currentStorageGib:Y?k.storageGib:null,initialSelection:ut,onClose:()=>F(!1),onContinue:e=>{Y?l(e):c(e)}}),(0,G.jsx)(ce,{open:R!==null,relation:o,packageName:R?.name??``,targetPackage:R,pending:D,onCancel:()=>Ne(null),onConfirm:()=>void s()}),(0,G.jsx)(We,{open:I,lostFeatures:lt,viaPortal:!at,pending:it||ot.isPending,onCancel:()=>L(!1),onConfirm:()=>void i()}),(0,G.jsx)(pe,{mode:`resize`,open:Pe,onClose:()=>{V(!1),U(void 0)},resizeContext:Ie}),(0,G.jsx)(`p`,{className:`mt-6 text-center text-[12px] font-medium text-[var(--content-tertiary)] sm:mt-10`,children:(0,G.jsx)(n,{ns:`settings`,i18nKey:`plansPage.cancelAnytimeFooter`,components:{docsLink:(0,G.jsx)(`a`,{href:Re,target:`_blank`,rel:`noopener noreferrer`,className:`text-[var(--content-default)] underline`})}})})]})}else _t=(0,G.jsx)(`div`,{className:`my-auto flex items-center justify-center`,children:(0,G.jsx)(m,{className:`h-6 w-6 animate-spin text-[var(--content-tertiary)]`,"aria-label":e(`plansPage.loadingPlansAriaLabel`)})});return(0,G.jsxs)(`div`,{"data-theme":`dark`,className:`plans-takeover-canvas-enter relative h-full w-full overflow-y-auto`,style:{backgroundColor:qe},children:[(0,G.jsx)(`div`,{className:`absolute left-8 z-10 [-webkit-app-region:no-drag]`,style:{top:f?`3rem`:`2rem`},children:(0,G.jsx)(B,{variant:`outlined`,leftIcon:(0,G.jsx)(p,{className:`h-4 w-4`,"aria-hidden":!0}),onClick:pt,className:`[-webkit-app-region:no-drag]`,children:e(`plansPage.back`)})}),(0,G.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 $e(){return(0,G.jsx)(Qe,{})}export{$e as PlansPage};
@@ -1 +1 @@
1
- import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CCI2T82b.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Ag as o,Qp as s,Sv as c,Z_ as l,_m as u,nv as d,zf as f}from"./index-CFjEz2JL.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)||c.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 d(r)){v(`Login failed: couldn't reach the local Vellum server to store the session. Please try again.`);return}await f.getState().initSession(),await o(!0);try{let e=await u();if(e.ok&&e.data.length>0){await l(e.data,s.getState().currentOrganizationId??void 0),a(c.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(c.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
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CCI2T82b.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Ag as o,Qp as s,Sv as c,Z_ as l,_m as u,nv as d,zf as f}from"./index-DZRUYtkw.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)||c.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 d(r)){v(`Login failed: couldn't reach the local Vellum server to store the session. Please try again.`);return}await f.getState().initSession(),await o(!0);try{let e=await u();if(e.ok&&e.data.length>0){await l(e.data,s.getState().currentOrganizationId??void 0),a(c.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(c.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{Sv as r,fi as i,sv as a}from"./index-CFjEz2JL.js";var o=n();function s(){let n=a.use.version(),s=i(),{name:c}=e();return n===null?null:!s||!c?(0,o.jsx)(t,{to:r.superpowers,replace:!0}):(0,o.jsx)(t,{to:`${r.superpowers}?plugin=${encodeURIComponent(c)}`,replace:!0})}export{s as PluginDetailPage};
1
+ import{m as e,r as t,t as n}from"./react-DPM_L_aA.js";import{Sv as r,fi as i,sv as a}from"./index-DZRUYtkw.js";var o=n();function s(){let n=a.use.version(),s=i(),{name:c}=e();return n===null?null:!s||!c?(0,o.jsx)(t,{to:r.superpowers,replace:!0}):(0,o.jsx)(t,{to:`${r.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{Sv as r}from"./index-CFjEz2JL.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
+ import{g as e,r as t,t as n}from"./react-DPM_L_aA.js";import{Sv as r}from"./index-DZRUYtkw.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-CCI2T82b.js";import{t}from"./react-DPM_L_aA.js";import{Si as n}from"./icons-B-6TfGtd.js";import{Ry as r}from"./index-CFjEz2JL.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
+ import{j as e}from"./vendor-CCI2T82b.js";import{t}from"./react-DPM_L_aA.js";import{Si as n}from"./icons-B-6TfGtd.js";import{Ry as r}from"./index-DZRUYtkw.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-CCI2T82b.js";import{b as o,t as s,y as c}from"./react-DPM_L_aA.js";import{Br as l,Rr as u,U as d,_t as f,i as p,nn as m,x as h}from"./icons-B-6TfGtd.js";import{$t as g,Al as _,Bf as v,Cg as y,Dg as b,Dv as x,Eg as S,Ep as C,Ev as w,F as T,Ff as E,Hy as D,I as O,If as k,Iy as A,Js as j,L as ee,Lf as M,Li as N,Ly as P,My as F,Ol as te,Ov as I,Oy as L,R as ne,Ri as re,Rp as ie,Sg as ae,Sv as oe,Tg as se,Tv as R,Y as z,Ys as ce,_p as B,au as le,bm as ue,fr as de,iu as fe,kl as pe,kv as me,ky as V,ly as H,mr as he,pr as U,vg as ge,vy as _e,wg as ve,xv as ye,yy as W,zf as be,zi as xe,zy as G}from"./index-CFjEz2JL.js";import{t as K}from"./detail-card-DzyHCwKl.js";import{t as q}from"./setting-row-Cg73b2Bs.js";import{t as Se}from"./settings-divider-DB4cGpny.js";var J=e(o(),1),Y=s(),Ce=[{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}],we=[{id:`notificationBadges`,type:`local`}];function Te(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 Ee(){let[e,t]=(0,J.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function De(){let[e,t]=(0,J.useState)(()=>R(`dockBadgesEnabled`,!0));return(0,J.useEffect)(()=>me(`dockBadgesEnabled`,()=>{t(R(`dockBadgesEnabled`,!0))}),[]),[e,e=>{t(e),x(`dockBadgesEnabled`,e),e||re(0)}]}function Oe({row:e,onToggle:t}){return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(L,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:D(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Y.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,Y.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function ke(){return(0,Y.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 Ae({compact:e=!1}){let{t}=a(),{state:n,loading:r,error:i,supported:o,refresh:s}=_(),{pendingKind:c,run:l}=Ee(),[u,d]=De(),f=C()===`windows`,p=(0,J.useMemo)(()=>Ce.filter(e=>!f||e.availableOnWindows),[f]),m=(0,J.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,J.useMemo)(()=>{let e=p.map(e=>{let n=m.get(e.id)?.item;if(!n)return null;let r=Te(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=N()===`taskbar icon`?t(`systemPermissionsCard.taskbarIcon`):t(`systemPermissionsCard.dockIcon`),r=xe()?we.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 te(e.sourceKind):await pe(e.sourceKind),await s()},v=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,Y.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,Y.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:t(`systemPermissionsCard.title`)}),r&&h.length===0?(0,Y.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Y.jsx)(ke,{}),t(`systemPermissionsCard.checking`)]}):(0,Y.jsx)(`div`,{className:`mt-3 space-y-2`,children:h.map(e=>(0,Y.jsx)(Oe,{row:e,onToggle:v},e.id))}),i&&(0,Y.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 je(){let{t:e}=a(`settings`),n=M({platformHostedOnly:!0}),o=E(),s=k(),c=i(),{data:l,isLoading:u,isError:d}=r({...j(),enabled:n===`full`&&o}),f=t({mutationFn:async e=>{let{data:t}=await ue({body:{access_consented:e},throwOnError:!0});return t},onSuccess:t=>{ce(c,void 0,t),W.success(t?.access_consented?e(`accessConsentSetting.toastEnabled`):e(`accessConsentSetting.toastDisabled`))},onError:()=>{W.error(e(`accessConsentSetting.toastUpdateFailed`))}});if(n===`gated`)return null;let p=n===`full`&&s,h=l?.access_consented??!1,_=n!==`full`||!o||u||d||f.isPending;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`accessConsentSetting.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`accessConsentSetting.description`)}),n===`full`&&d&&(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`accessConsentSetting.loadError`)})]}),(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:n===`disabled`?null:(0,Y.jsxs)(Y.Fragment,{children:[(f.isPending||p)&&(0,Y.jsx)(m,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Y.jsx)(L,{checked:h,disabled:_,onChange:()=>f.mutate(!h)})]})})]}),n===`disabled`&&(0,Y.jsx)(g,{className:`mt-3`,children:e(`accessConsentSetting.loginNotice`)})]})}function Me(){let{t:e}=a(`settings`),t=ae(),n=ie(),[r,i]=(0,J.useState)(()=>se()),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1);if((0,J.useEffect)(()=>{if(!t)return;let e=!0;return ve().then(t=>{e&&s(t)}),()=>{e=!1}},[t]),!t||!o?.available)return null;let u=async()=>{l(!0);try{if(r)S(!1),await y(),i(!1);else{let e=ge();if(!e||!await b(e)){S(!1),i(!1);return}S(!0),i(!0)}}finally{l(!1)}};return(0,Y.jsx)(K,{title:e(`biometricSettingsCard.title`),children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`biometricSettingsCard.useForSignIn`,{label:o.label})}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(n?`biometricSettingsCard.descriptionWithPasscode`:`biometricSettingsCard.description`,{label:o.label})})]}),(0,Y.jsx)(L,{checked:r,onChange:()=>void u(),disabled:c})]})})}var X=[`youtube.com`,`youtu.be`,`vimeo.com`,`loom.com`];function Ne(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return[...X]}function Pe(){return R(`mediaEmbedsEnabled`,!0)}function Fe(){let e=w(`mediaEmbedDomains`,``);return e?Ne(e):[...X]}function Ie(){let{t:e}=a(`settings`),[t,n]=(0,J.useState)(()=>Pe()),[r,i]=(0,J.useState)(()=>Fe()),[o,s]=(0,J.useState)(!1),[c,d]=(0,J.useState)(``),f=(0,J.useMemo)(()=>c.trim().toLowerCase(),[c]),p=e=>{n(e),x(`mediaEmbedsEnabled`,e)},m=e=>{i(e),I(`mediaEmbedDomains`,JSON.stringify(e))},g=()=>{if(f){if(r.includes(f)){d(``);return}m([...r,f]),d(``)}},_=e=>{m(r.filter(t=>t!==e))},v=()=>{m([...X])},y=r.length===X.length&&r.every((e,t)=>e===X[t]);return(0,Y.jsxs)(K,{title:e(`mediaEmbedsCard.title`),subtitle:e(`mediaEmbedsCard.subtitle`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`mediaEmbedsCard.autoToggle`)}),(0,Y.jsx)(L,{checked:t,onChange:p})]}),t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(Se,{})}),(0,Y.jsxs)(G,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),className:`mt-4 w-full justify-between px-3`,"aria-expanded":o,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o?(0,Y.jsx)(l,{className:`h-4 w-4`,"aria-hidden":!0}):(0,Y.jsx)(u,{className:`h-4 w-4`,"aria-hidden":!0}),e(`mediaEmbedsCard.allowlist`)]}),(0,Y.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`mediaEmbedsCard.domainCount`,{count:r.length})})]}),o&&(0,Y.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Y.jsx)(V,{label:e(`mediaEmbedsCard.addDomainLabel`),type:`text`,value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},placeholder:e(`mediaEmbedsCard.addDomainPlaceholder`),fullWidth:!0,wrapperClassName:`flex-1`}),(0,Y.jsx)(G,{variant:`primary`,size:`compact`,onClick:g,disabled:!f,children:e(`mediaEmbedsCard.add`)})]}),r.length>0&&(0,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(G,{type:`button`,variant:`ghost`,size:`compact`,onClick:v,disabled:y,tintColor:`var(--content-tertiary)`,children:e(`mediaEmbedsCard.resetDefaults`)})}),r.length>0&&(0,Y.jsx)(`ul`,{className:`space-y-2`,children:r.map(t=>(0,Y.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,Y.jsx)(`span`,{className:`font-mono text-[var(--content-default)]`,children:t}),(0,Y.jsx)(G,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Y.jsx)(h,{}),onClick:()=>_(t),"aria-label":e(`mediaEmbedsCard.removeDomainAria`,{domain:t})})]},t))})]})]})]})}function Z(){return(0,Y.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Le(){let{t:e}=a(`settings`),t=z(),n=(0,J.useMemo)(()=>T.map(t=>({value:t.id,label:e(t.labelKey,t.label),icon:(0,Y.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}),[d,f]=(0,J.useState)(`relaxed`),[p,m]=(0,J.useState)(`conservative`),[h,g]=(0,J.useState)(`strict`),[_,v]=(0,J.useState)(!1),y=(0,J.useRef)(!1),[b,x]=(0,J.useState)(!1),S=(0,J.useRef)(null),C=(0,J.useRef)(null);(0,J.useEffect)(()=>{!s||y.current||(f(O(s.interactive).id),m(O(s.autonomous).id),g(O(s.headless).id),x(!0))},[s]),(0,J.useEffect)(()=>()=>{S.current!==null&&(clearTimeout(S.current),S.current=null,C.current?.(),C.current=null)},[]);let w=(0,J.useCallback)((e,n,r)=>{if(!t||!b)return;let i=T.find(t=>t.id===e)?.riskThreshold,a=T.find(e=>e.id===n)?.riskThreshold,s=T.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]),E=(0,J.useCallback)((e,t,n)=>{S.current!==null&&clearTimeout(S.current),C.current=()=>w(e,t,n),S.current=setTimeout(()=>{C.current?.(),S.current=null,C.current=null},500)},[w]),D=(0,J.useCallback)(e=>{y.current=!0,f(e),E(e,p,h)},[p,h,E]),k=(0,J.useCallback)(e=>{y.current=!0,m(e),E(d,e,h)},[d,h,E]),A=(0,J.useCallback)(e=>{y.current=!0,g(e),E(d,p,e)},[d,p,E]),j=T.find(e=>e.id===d),M=T.find(e=>e.id===p),N=T.find(e=>e.id===h),F=!t||!b;return(0,Y.jsxs)(P,{children:[(0,Y.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`riskToleranceSettings.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.description`)}),c&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`riskToleranceSettings.loadError`)}),(0,Y.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.conversationsTitle`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.conversationsDescription`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:d,onChange:D,options:n,disabled:F})}),j&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(j.descriptionKey,j.description)})]}),(0,Y.jsx)(Z,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.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,Y.jsx)(l,{className:`h-4 w-4`}):(0,Y.jsx)(u,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`text-body-medium-default`,children:e(`riskToleranceSettings.advanced`)})]}),(0,Y.jsxs)(`div`,{className:_?`mt-4 space-y-4`:`hidden`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.backgroundTitle`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.backgroundDescription`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:p,onChange:k,options:n,disabled:F})}),M&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(M.descriptionKey,M.description)})]}),(0,Y.jsx)(Z,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.headlessTitle`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.headlessDescription`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:h,onChange:A,options:n,disabled:F})}),N&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(N.descriptionKey,N.description)})]})]})]})]})]})}var Q=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,J.useRef)(null),[s,c]=(0,J.useState)(t.tool),[l,u]=(0,J.useState)(t.pattern),[d,f]=(0,J.useState)(t.risk),[m,h]=(0,J.useState)(t.description??``),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.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,J.useCallback)(async n=>{if(n.preventDefault(),!S)return;let a=m.trim()||C;_(!0),y(null);try{await he(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,Q.createPortal)((0,Y.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,J.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),n())},[n]),onClick:(0,J.useCallback)(e=>{e.target===o.current&&n()},[n]),children:(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,Y.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:i(`trustRuleFormModal.title`)}),(0,Y.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,Y.jsx)(p,{className:`h-4 w-4`})})]}),(0,Y.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,Y.jsx)(A,{tone:`error`,children:v}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.toolLabel`)}),(0,Y.jsx)(`div`,{className:`mt-1`,children:(0,Y.jsx)(H,{value:s,onChange:c,disabled:!0,options:Re.map(e=>({value:e,label:e}))})})]}),(0,Y.jsx)(V,{label:i(`trustRuleFormModal.patternLabel`),type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:i(`trustRuleFormModal.patternPlaceholder`),disabled:!0}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.riskLevelLabel`)}),(0,Y.jsx)(`div`,{className:`mt-2 flex gap-2`,children:b.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>f(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,Y.jsx)(`div`,{children:e.label}),(0,Y.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,Y.jsx)(V,{label:i(`trustRuleFormModal.descriptionLabel`),type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:C}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,Y.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,Y.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,J.useRef)(null),[i,o]=(0,J.useState)([]),[s,c]=(0,J.useState)(!0),[l,u]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),b=(0,J.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,J.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]),S=(0,J.useCallback)(async()=>{c(!0);try{o(await x(v)),u(null)}catch(e){u(e instanceof Error?e.message:n(`trustRulesModal.loadErrorFallback`))}finally{c(!1)}},[x,v,n]);(0,J.useEffect)(()=>{let e=!1;return(async()=>{c(!0);try{let t=await x(v);e||(o(t),u(null))}catch(t){e||u(t instanceof Error?t.message:n(`trustRulesModal.loadErrorFallback`))}finally{e||c(!1)}})(),()=>{e=!0}},[x,v,n]);let C=(0,J.useCallback)(async()=>{if(g)try{await de(e,g.id),S()}catch(e){u(e instanceof Error?e.message:n(`trustRulesModal.deleteErrorFallback`))}finally{_(null)}},[e,g,S,n]);return(0,Q.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,J.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),t())},[t]),onClick:(0,J.useCallback)(e=>{e.target===r.current&&t()},[t]),children:(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,Y.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:n(`trustRulesModal.title`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(L,{checked:v,onChange:y,label:n(`trustRulesModal.showAllDefaults`)}),(0,Y.jsx)(G,{variant:`outlined`,onClick:t,children:n(`trustRulesModal.done`)})]})]}),(0,Y.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[l&&(0,Y.jsx)(`div`,{className:`mb-3`,children:(0,Y.jsx)(A,{tone:`error`,children:l})}),s?(0,Y.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,Y.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,Y.jsx)(d,{className:`h-8 w-8`}),(0,Y.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:n(`trustRulesModal.empty`)})]}):(0,Y.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:i.map(e=>{let t=Be(e);return(0,Y.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,Y.jsx)(F,{tone:He(e.risk),children:b(e.risk)}),e.origin===`default`&&(0,Y.jsx)(F,{tone:`neutral`,children:n(`trustRulesModal.defaultTag`)}),e.userModified&&(0,Y.jsx)(F,{tone:`warning`,children:n(`trustRulesModal.modifiedTag`)})]}),(0,Y.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,"aria-label":n(`trustRulesModal.editRuleAria`,{tool:e.tool}),onClick:()=>m(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,Y.jsx)(f,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,Y.jsx)(G,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Y.jsx)(h,{className:`h-4 w-4`}),"aria-label":n(`trustRulesModal.deleteRuleAria`,{tool:e.tool}),onClick:()=>_(e)})]})]},e.id)})})]})]})}),p&&(0,Y.jsx)(ze,{assistantId:e,existingRule:p,onClose:()=>m(null),onSaved:()=>{m(null),S()}}),(0,Y.jsx)(_e,{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 C(),onCancel:()=>_(null)})]}),document.body)}function We(){let{t:e}=a(`settings`),t=z(),[n,r]=(0,J.useState)(!1);return(0,Y.jsxs)(P,{children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(d,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`trustRules.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`trustRules.description`)})]}),(0,Y.jsx)(G,{variant:`outlined`,onClick:()=>r(!0),children:e(`trustRules.manage`)})]}),n&&(0,Y.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,Y.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function qe(){let{t:e}=a(`settings`),t=M({platformHostedOnly:!0}),r=v(),i=r,o=be.use.user()?.id??null,[s]=fe(),[c]=le(),l=s??!0,u=c??!0,[d,f]=(0,J.useState)(()=>w(`llmLogRetention`,Ke)),p=(0,J.useMemo)(()=>Ge.map(t=>({value:t.value,label:e(t.labelKey)})),[e]);return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(Me,{}),(0,Y.jsx)(Ae,{}),(0,Y.jsx)(We,{}),(0,Y.jsx)(Le,{}),(0,Y.jsx)(Ie,{}),(0,Y.jsx)(K,{title:e(`privacyPage.title`),subtitle:r?(0,Y.jsx)(n,{ns:`settings`,i18nKey:`privacyPage.subtitleWithPolicy`,components:{policyLink:(0,Y.jsx)(`a`,{href:ye(oe.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`})}}):void 0,children:(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[i&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{label:e(`privacyPage.shareAnalyticsLabel`),helperText:e(`privacyPage.shareAnalyticsHelper`),checked:l,onChange:()=>{B(`share_analytics`,!l,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,Y.jsx)($,{}),(0,Y.jsx)(q,{label:e(`privacyPage.shareDiagnosticsLabel`),helperText:e(`privacyPage.shareDiagnosticsHelper`),checked:u,onChange:()=>{B(`share_diagnostics`,!u,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,Y.jsx)($,{})]}),(0,Y.jsx)(je,{}),t!==`gated`&&(0,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:e(`privacyPage.llmLogRetentionLabel`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:d,onChange:e=>{f(e),I(`llmLogRetention`,e)},options:p})}),(0,Y.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-CCI2T82b.js";import{b as o,t as s,y as c}from"./react-DPM_L_aA.js";import{Br as l,Rr as u,U as d,_t as f,i as p,nn as m,x as h}from"./icons-B-6TfGtd.js";import{$t as g,Al as _,Bf as v,Cg as y,Dg as b,Dv as x,Eg as S,Ep as C,Ev as w,F as T,Ff as E,Hy as D,I as O,If as k,Iy as A,Js as j,L as ee,Lf as M,Li as N,Ly as P,My as F,Ol as te,Ov as I,Oy as L,R as ne,Ri as re,Rp as ie,Sg as ae,Sv as oe,Tg as se,Tv as R,Y as z,Ys as ce,_p as B,au as le,bm as ue,fr as de,iu as fe,kl as pe,kv as me,ky as V,ly as H,mr as he,pr as U,vg as ge,vy as _e,wg as ve,xv as ye,yy as W,zf as be,zi as xe,zy as G}from"./index-DZRUYtkw.js";import{t as K}from"./detail-card-B7ANaKg6.js";import{t as q}from"./setting-row-mB11-1yT.js";import{t as Se}from"./settings-divider-DhYFC0nY.js";var J=e(o(),1),Y=s(),Ce=[{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}],we=[{id:`notificationBadges`,type:`local`}];function Te(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 Ee(){let[e,t]=(0,J.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function De(){let[e,t]=(0,J.useState)(()=>R(`dockBadgesEnabled`,!0));return(0,J.useEffect)(()=>me(`dockBadgesEnabled`,()=>{t(R(`dockBadgesEnabled`,!0))}),[]),[e,e=>{t(e),x(`dockBadgesEnabled`,e),e||re(0)}]}function Oe({row:e,onToggle:t}){return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(L,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:D(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,Y.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,Y.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function ke(){return(0,Y.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 Ae({compact:e=!1}){let{t}=a(),{state:n,loading:r,error:i,supported:o,refresh:s}=_(),{pendingKind:c,run:l}=Ee(),[u,d]=De(),f=C()===`windows`,p=(0,J.useMemo)(()=>Ce.filter(e=>!f||e.availableOnWindows),[f]),m=(0,J.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,J.useMemo)(()=>{let e=p.map(e=>{let n=m.get(e.id)?.item;if(!n)return null;let r=Te(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=N()===`taskbar icon`?t(`systemPermissionsCard.taskbarIcon`):t(`systemPermissionsCard.dockIcon`),r=xe()?we.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 te(e.sourceKind):await pe(e.sourceKind),await s()},v=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,Y.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,Y.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:t(`systemPermissionsCard.title`)}),r&&h.length===0?(0,Y.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,Y.jsx)(ke,{}),t(`systemPermissionsCard.checking`)]}):(0,Y.jsx)(`div`,{className:`mt-3 space-y-2`,children:h.map(e=>(0,Y.jsx)(Oe,{row:e,onToggle:v},e.id))}),i&&(0,Y.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 je(){let{t:e}=a(`settings`),n=M({platformHostedOnly:!0}),o=E(),s=k(),c=i(),{data:l,isLoading:u,isError:d}=r({...j(),enabled:n===`full`&&o}),f=t({mutationFn:async e=>{let{data:t}=await ue({body:{access_consented:e},throwOnError:!0});return t},onSuccess:t=>{ce(c,void 0,t),W.success(t?.access_consented?e(`accessConsentSetting.toastEnabled`):e(`accessConsentSetting.toastDisabled`))},onError:()=>{W.error(e(`accessConsentSetting.toastUpdateFailed`))}});if(n===`gated`)return null;let p=n===`full`&&s,h=l?.access_consented??!1,_=n!==`full`||!o||u||d||f.isPending;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`accessConsentSetting.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`accessConsentSetting.description`)}),n===`full`&&d&&(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`accessConsentSetting.loadError`)})]}),(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:n===`disabled`?null:(0,Y.jsxs)(Y.Fragment,{children:[(f.isPending||p)&&(0,Y.jsx)(m,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,Y.jsx)(L,{checked:h,disabled:_,onChange:()=>f.mutate(!h)})]})})]}),n===`disabled`&&(0,Y.jsx)(g,{className:`mt-3`,children:e(`accessConsentSetting.loginNotice`)})]})}function Me(){let{t:e}=a(`settings`),t=ae(),n=ie(),[r,i]=(0,J.useState)(()=>se()),[o,s]=(0,J.useState)(null),[c,l]=(0,J.useState)(!1);if((0,J.useEffect)(()=>{if(!t)return;let e=!0;return ve().then(t=>{e&&s(t)}),()=>{e=!1}},[t]),!t||!o?.available)return null;let u=async()=>{l(!0);try{if(r)S(!1),await y(),i(!1);else{let e=ge();if(!e||!await b(e)){S(!1),i(!1);return}S(!0),i(!0)}}finally{l(!1)}};return(0,Y.jsx)(K,{title:e(`biometricSettingsCard.title`),children:(0,Y.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`biometricSettingsCard.useForSignIn`,{label:o.label})}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(n?`biometricSettingsCard.descriptionWithPasscode`:`biometricSettingsCard.description`,{label:o.label})})]}),(0,Y.jsx)(L,{checked:r,onChange:()=>void u(),disabled:c})]})})}var X=[`youtube.com`,`youtu.be`,`vimeo.com`,`loom.com`];function Ne(e){try{let t=JSON.parse(e);if(Array.isArray(t))return t.filter(e=>typeof e==`string`)}catch{}return[...X]}function Pe(){return R(`mediaEmbedsEnabled`,!0)}function Fe(){let e=w(`mediaEmbedDomains`,``);return e?Ne(e):[...X]}function Ie(){let{t:e}=a(`settings`),[t,n]=(0,J.useState)(()=>Pe()),[r,i]=(0,J.useState)(()=>Fe()),[o,s]=(0,J.useState)(!1),[c,d]=(0,J.useState)(``),f=(0,J.useMemo)(()=>c.trim().toLowerCase(),[c]),p=e=>{n(e),x(`mediaEmbedsEnabled`,e)},m=e=>{i(e),I(`mediaEmbedDomains`,JSON.stringify(e))},g=()=>{if(f){if(r.includes(f)){d(``);return}m([...r,f]),d(``)}},_=e=>{m(r.filter(t=>t!==e))},v=()=>{m([...X])},y=r.length===X.length&&r.every((e,t)=>e===X[t]);return(0,Y.jsxs)(K,{title:e(`mediaEmbedsCard.title`),subtitle:e(`mediaEmbedsCard.subtitle`),children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:e(`mediaEmbedsCard.autoToggle`)}),(0,Y.jsx)(L,{checked:t,onChange:p})]}),t&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(Se,{})}),(0,Y.jsxs)(G,{type:`button`,variant:`ghost`,onClick:()=>s(e=>!e),className:`mt-4 w-full justify-between px-3`,"aria-expanded":o,children:[(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[o?(0,Y.jsx)(l,{className:`h-4 w-4`,"aria-hidden":!0}):(0,Y.jsx)(u,{className:`h-4 w-4`,"aria-hidden":!0}),e(`mediaEmbedsCard.allowlist`)]}),(0,Y.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:e(`mediaEmbedsCard.domainCount`,{count:r.length})})]}),o&&(0,Y.jsxs)(`div`,{className:`mt-3 space-y-3`,children:[(0,Y.jsxs)(`div`,{className:`flex items-end gap-2`,children:[(0,Y.jsx)(V,{label:e(`mediaEmbedsCard.addDomainLabel`),type:`text`,value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),g())},placeholder:e(`mediaEmbedsCard.addDomainPlaceholder`),fullWidth:!0,wrapperClassName:`flex-1`}),(0,Y.jsx)(G,{variant:`primary`,size:`compact`,onClick:g,disabled:!f,children:e(`mediaEmbedsCard.add`)})]}),r.length>0&&(0,Y.jsx)(`div`,{className:`flex justify-end`,children:(0,Y.jsx)(G,{type:`button`,variant:`ghost`,size:`compact`,onClick:v,disabled:y,tintColor:`var(--content-tertiary)`,children:e(`mediaEmbedsCard.resetDefaults`)})}),r.length>0&&(0,Y.jsx)(`ul`,{className:`space-y-2`,children:r.map(t=>(0,Y.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,Y.jsx)(`span`,{className:`font-mono text-[var(--content-default)]`,children:t}),(0,Y.jsx)(G,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Y.jsx)(h,{}),onClick:()=>_(t),"aria-label":e(`mediaEmbedsCard.removeDomainAria`,{domain:t})})]},t))})]})]})]})}function Z(){return(0,Y.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Le(){let{t:e}=a(`settings`),t=z(),n=(0,J.useMemo)(()=>T.map(t=>({value:t.id,label:e(t.labelKey,t.label),icon:(0,Y.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}),[d,f]=(0,J.useState)(`relaxed`),[p,m]=(0,J.useState)(`conservative`),[h,g]=(0,J.useState)(`strict`),[_,v]=(0,J.useState)(!1),y=(0,J.useRef)(!1),[b,x]=(0,J.useState)(!1),S=(0,J.useRef)(null),C=(0,J.useRef)(null);(0,J.useEffect)(()=>{!s||y.current||(f(O(s.interactive).id),m(O(s.autonomous).id),g(O(s.headless).id),x(!0))},[s]),(0,J.useEffect)(()=>()=>{S.current!==null&&(clearTimeout(S.current),S.current=null,C.current?.(),C.current=null)},[]);let w=(0,J.useCallback)((e,n,r)=>{if(!t||!b)return;let i=T.find(t=>t.id===e)?.riskThreshold,a=T.find(e=>e.id===n)?.riskThreshold,s=T.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]),E=(0,J.useCallback)((e,t,n)=>{S.current!==null&&clearTimeout(S.current),C.current=()=>w(e,t,n),S.current=setTimeout(()=>{C.current?.(),S.current=null,C.current=null},500)},[w]),D=(0,J.useCallback)(e=>{y.current=!0,f(e),E(e,p,h)},[p,h,E]),k=(0,J.useCallback)(e=>{y.current=!0,m(e),E(d,e,h)},[d,h,E]),A=(0,J.useCallback)(e=>{y.current=!0,g(e),E(d,p,e)},[d,p,E]),j=T.find(e=>e.id===d),M=T.find(e=>e.id===p),N=T.find(e=>e.id===h),F=!t||!b;return(0,Y.jsxs)(P,{children:[(0,Y.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`riskToleranceSettings.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.description`)}),c&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-lighter text-[var(--system-negative-strong)]`,children:e(`riskToleranceSettings.loadError`)}),(0,Y.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.conversationsTitle`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.conversationsDescription`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:d,onChange:D,options:n,disabled:F})}),j&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(j.descriptionKey,j.description)})]}),(0,Y.jsx)(Z,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.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,Y.jsx)(l,{className:`h-4 w-4`}):(0,Y.jsx)(u,{className:`h-4 w-4`}),(0,Y.jsx)(`span`,{className:`text-body-medium-default`,children:e(`riskToleranceSettings.advanced`)})]}),(0,Y.jsxs)(`div`,{className:_?`mt-4 space-y-4`:`hidden`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.backgroundTitle`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.backgroundDescription`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:p,onChange:k,options:n,disabled:F})}),M&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(M.descriptionKey,M.description)})]}),(0,Y.jsx)(Z,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e(`riskToleranceSettings.headlessTitle`)}),(0,Y.jsx)(`p`,{className:`mt-0.5 text-body-small-lighter text-[var(--content-tertiary)]`,children:e(`riskToleranceSettings.headlessDescription`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:h,onChange:A,options:n,disabled:F})}),N&&(0,Y.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:e(N.descriptionKey,N.description)})]})]})]})]})]})}var Q=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,J.useRef)(null),[s,c]=(0,J.useState)(t.tool),[l,u]=(0,J.useState)(t.pattern),[d,f]=(0,J.useState)(t.risk),[m,h]=(0,J.useState)(t.description??``),[g,_]=(0,J.useState)(!1),[v,y]=(0,J.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,J.useCallback)(async n=>{if(n.preventDefault(),!S)return;let a=m.trim()||C;_(!0),y(null);try{await he(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,Q.createPortal)((0,Y.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,J.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),n())},[n]),onClick:(0,J.useCallback)(e=>{e.target===o.current&&n()},[n]),children:(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,Y.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:i(`trustRuleFormModal.title`)}),(0,Y.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,Y.jsx)(p,{className:`h-4 w-4`})})]}),(0,Y.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,Y.jsx)(A,{tone:`error`,children:v}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.toolLabel`)}),(0,Y.jsx)(`div`,{className:`mt-1`,children:(0,Y.jsx)(H,{value:s,onChange:c,disabled:!0,options:Re.map(e=>({value:e,label:e}))})})]}),(0,Y.jsx)(V,{label:i(`trustRuleFormModal.patternLabel`),type:`text`,value:l,onChange:e=>u(e.target.value),placeholder:i(`trustRuleFormModal.patternPlaceholder`),disabled:!0}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:i(`trustRuleFormModal.riskLevelLabel`)}),(0,Y.jsx)(`div`,{className:`mt-2 flex gap-2`,children:b.map(e=>(0,Y.jsxs)(`button`,{type:`button`,onClick:()=>f(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,Y.jsx)(`div`,{children:e.label}),(0,Y.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,Y.jsx)(V,{label:i(`trustRuleFormModal.descriptionLabel`),type:`text`,value:m,onChange:e=>h(e.target.value),placeholder:C}),(0,Y.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,Y.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,Y.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,J.useRef)(null),[i,o]=(0,J.useState)([]),[s,c]=(0,J.useState)(!0),[l,u]=(0,J.useState)(null),[p,m]=(0,J.useState)(null),[g,_]=(0,J.useState)(null),[v,y]=(0,J.useState)(!1),b=(0,J.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,J.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]),S=(0,J.useCallback)(async()=>{c(!0);try{o(await x(v)),u(null)}catch(e){u(e instanceof Error?e.message:n(`trustRulesModal.loadErrorFallback`))}finally{c(!1)}},[x,v,n]);(0,J.useEffect)(()=>{let e=!1;return(async()=>{c(!0);try{let t=await x(v);e||(o(t),u(null))}catch(t){e||u(t instanceof Error?t.message:n(`trustRulesModal.loadErrorFallback`))}finally{e||c(!1)}})(),()=>{e=!0}},[x,v,n]);let C=(0,J.useCallback)(async()=>{if(g)try{await de(e,g.id),S()}catch(e){u(e instanceof Error?e.message:n(`trustRulesModal.deleteErrorFallback`))}finally{_(null)}},[e,g,S,n]);return(0,Q.createPortal)((0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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,J.useCallback)(e=>{e.key===`Escape`&&!e.defaultPrevented&&(e.preventDefault(),t())},[t]),onClick:(0,J.useCallback)(e=>{e.target===r.current&&t()},[t]),children:(0,Y.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,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,Y.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:n(`trustRulesModal.title`)}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Y.jsx)(L,{checked:v,onChange:y,label:n(`trustRulesModal.showAllDefaults`)}),(0,Y.jsx)(G,{variant:`outlined`,onClick:t,children:n(`trustRulesModal.done`)})]})]}),(0,Y.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[l&&(0,Y.jsx)(`div`,{className:`mb-3`,children:(0,Y.jsx)(A,{tone:`error`,children:l})}),s?(0,Y.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,Y.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,Y.jsx)(d,{className:`h-8 w-8`}),(0,Y.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:n(`trustRulesModal.empty`)})]}):(0,Y.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:i.map(e=>{let t=Be(e);return(0,Y.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,Y.jsx)(F,{tone:He(e.risk),children:b(e.risk)}),e.origin===`default`&&(0,Y.jsx)(F,{tone:`neutral`,children:n(`trustRulesModal.defaultTag`)}),e.userModified&&(0,Y.jsx)(F,{tone:`warning`,children:n(`trustRulesModal.modifiedTag`)})]}),(0,Y.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,Y.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,Y.jsx)(`button`,{type:`button`,"aria-label":n(`trustRulesModal.editRuleAria`,{tool:e.tool}),onClick:()=>m(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,Y.jsx)(f,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,Y.jsx)(G,{variant:`dangerGhost`,size:`compact`,iconOnly:(0,Y.jsx)(h,{className:`h-4 w-4`}),"aria-label":n(`trustRulesModal.deleteRuleAria`,{tool:e.tool}),onClick:()=>_(e)})]})]},e.id)})})]})]})}),p&&(0,Y.jsx)(ze,{assistantId:e,existingRule:p,onClose:()=>m(null),onSaved:()=>{m(null),S()}}),(0,Y.jsx)(_e,{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 C(),onCancel:()=>_(null)})]}),document.body)}function We(){let{t:e}=a(`settings`),t=z(),[n,r]=(0,J.useState)(!1);return(0,Y.jsxs)(P,{children:[(0,Y.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Y.jsx)(d,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,Y.jsxs)(`div`,{className:`flex-1`,children:[(0,Y.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:e(`trustRules.title`)}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:e(`trustRules.description`)})]}),(0,Y.jsx)(G,{variant:`outlined`,onClick:()=>r(!0),children:e(`trustRules.manage`)})]}),n&&(0,Y.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,Y.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function qe(){let{t:e}=a(`settings`),t=M({platformHostedOnly:!0}),r=v(),i=r,o=be.use.user()?.id??null,[s]=fe(),[c]=le(),l=s??!0,u=c??!0,[d,f]=(0,J.useState)(()=>w(`llmLogRetention`,Ke)),p=(0,J.useMemo)(()=>Ge.map(t=>({value:t.value,label:e(t.labelKey)})),[e]);return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsx)(Me,{}),(0,Y.jsx)(Ae,{}),(0,Y.jsx)(We,{}),(0,Y.jsx)(Le,{}),(0,Y.jsx)(Ie,{}),(0,Y.jsx)(K,{title:e(`privacyPage.title`),subtitle:r?(0,Y.jsx)(n,{ns:`settings`,i18nKey:`privacyPage.subtitleWithPolicy`,components:{policyLink:(0,Y.jsx)(`a`,{href:ye(oe.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`})}}):void 0,children:(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[i&&(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(q,{label:e(`privacyPage.shareAnalyticsLabel`),helperText:e(`privacyPage.shareAnalyticsHelper`),checked:l,onChange:()=>{B(`share_analytics`,!l,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,Y.jsx)($,{}),(0,Y.jsx)(q,{label:e(`privacyPage.shareDiagnosticsLabel`),helperText:e(`privacyPage.shareDiagnosticsHelper`),checked:u,onChange:()=>{B(`share_diagnostics`,!u,{userId:o,hasPlatformSession:r})},variant:`toggle-trailing`}),(0,Y.jsx)($,{})]}),(0,Y.jsx)(je,{}),t!==`gated`&&(0,Y.jsx)($,{}),(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:e(`privacyPage.llmLogRetentionLabel`)}),(0,Y.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,Y.jsx)(H,{value:d,onChange:e=>{f(e),I(`llmLogRetention`,e)},options:p})}),(0,Y.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-CCI2T82b.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Bg as o,Cv as s,E_ as c,Hg as l,Mr as u,Ng as ee,Or as d,Pg as f,Rg as p,Sg as m,Sv as h,Ug as g,Vf as _,Xl as v,_v as y,ai as b,au as x,gp as S,jg as C,li as w,mv as T,ou as E,ru as D,si as O,z_ as k,zf as te,zg as A,zy as j}from"./index-CFjEz2JL.js";import{t as M}from"./plugin-attribution-COvprnE5.js";import{n as N,t as P}from"./consent-controls-YdgrMbrE.js";import{r as F,t as I}from"./checkout-continuation-BU0cwoiu.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(),y=te.use.user()?.id??null,C=s(),B=m(),[H,U]=x(),W=H??!0,[G,K]=E(),[q,J]=D(),Y=_(),X=F();(0,L.useEffect)(()=>{w()},[]);let Z=a.get(`preview`)===`true`,Q=(0,L.useCallback)(e=>{},[]),ne=Z?Q:U,re=Z?Q:K,ie=Z?Q:J,ae=p(),$=(0,L.useCallback)(e=>{if(Z)return;S({userId:y,tos:G,privacy:q,shareAnalytics:null,shareDiagnostics:W,hasPlatformSession:Y}),O(b.privacyTos,{userId:y});let t=v(a.get(`returnTo`));if(t){n(e?l(t):t,u);return}let r=a.get(`hosting`),i=new URLSearchParams;r&&i.set(`hosting`,r);let s=a.get(M);s&&i.set(M,s);let d=i.toString(),p=o({isLocalHatch:k()&&r!==null&&r!==`vellum-cloud`,skipResearch:e,selectedAssistantOnboarded:g(c.getState().assistants,T()),newAssistant:A(a)}),m=e?l(`${p}${d?`?${d}`:``}`):`${p}${d?`?${d}`:``}`,_=f();if(_?.resumeAfterOnboarding===!0)if(X===`disabled`)ee();else{let e=V(_);if(e){e.set(I,m),n(`${h.checkout}?${e.toString()}`,u);return}}n(m,u)},[q,Y,Z,n,a,W,X,G,y]);return(0,R.jsx)(d,{avatarWave:`beside`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${C?`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:C?`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)] ${C?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:e(`privacyScreen.body`)}),(0,R.jsx)(N,{electron:C,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:C,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 ${C?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.55s both`},children:[(0,R.jsx)(j,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!G||!q,onClick:()=>$(!1),className:C?void 0:`h-11 text-base`,children:e(`privacyScreen.start`)}),ae&&(0,R.jsx)(j,{variant:`outlined`,size:`regular`,fullWidth:!0,disabled:!G||!q,onClick:()=>$(!0),className:C?void 0:`h-11 text-base`,children:e(`privacyScreen.skipToChat`)}),(0,R.jsx)(j,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:()=>n(k()?h.onboarding.hosting:h.onboarding.start,u),className:C?void 0:`h-11 text-base`,children:e(`actions.back`)})]})]})})}function V(e){return e.kind===`package`?new URLSearchParams({[y]:e.packageKey}):e.storageTier===null?null:C({machineTier:e.machineTier,storageTier:e.storageTier,creditTier:e.creditTier})}export{B as PrivacyScreen};
1
+ import{o as e}from"./rolldown-runtime-BM3Ffeng.js";import{j as t}from"./vendor-CCI2T82b.js";import{b as n,f as r,g as i,t as a}from"./react-DPM_L_aA.js";import{Bg as o,Cv as s,E_ as c,Hg as l,Mr as u,Ng as ee,Or as d,Pg as f,Rg as p,Sg as m,Sv as h,Ug as g,Vf as _,Xl as v,_v as y,ai as b,au as x,gp as S,jg as C,li as w,mv as T,ou as E,ru as D,si as O,z_ as k,zf as te,zg as A,zy as j}from"./index-DZRUYtkw.js";import{t as M}from"./plugin-attribution-COvprnE5.js";import{n as N,t as P}from"./consent-controls-CUtRwDSO.js";import{r as F,t as I}from"./checkout-continuation-DSfoHLU4.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(),y=te.use.user()?.id??null,C=s(),B=m(),[H,U]=x(),W=H??!0,[G,K]=E(),[q,J]=D(),Y=_(),X=F();(0,L.useEffect)(()=>{w()},[]);let Z=a.get(`preview`)===`true`,Q=(0,L.useCallback)(e=>{},[]),ne=Z?Q:U,re=Z?Q:K,ie=Z?Q:J,ae=p(),$=(0,L.useCallback)(e=>{if(Z)return;S({userId:y,tos:G,privacy:q,shareAnalytics:null,shareDiagnostics:W,hasPlatformSession:Y}),O(b.privacyTos,{userId:y});let t=v(a.get(`returnTo`));if(t){n(e?l(t):t,u);return}let r=a.get(`hosting`),i=new URLSearchParams;r&&i.set(`hosting`,r);let s=a.get(M);s&&i.set(M,s);let d=i.toString(),p=o({isLocalHatch:k()&&r!==null&&r!==`vellum-cloud`,skipResearch:e,selectedAssistantOnboarded:g(c.getState().assistants,T()),newAssistant:A(a)}),m=e?l(`${p}${d?`?${d}`:``}`):`${p}${d?`?${d}`:``}`,_=f();if(_?.resumeAfterOnboarding===!0)if(X===`disabled`)ee();else{let e=V(_);if(e){e.set(I,m),n(`${h.checkout}?${e.toString()}`,u);return}}n(m,u)},[q,Y,Z,n,a,W,X,G,y]);return(0,R.jsx)(d,{avatarWave:`beside`,children:(0,R.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${C?`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:C?`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)] ${C?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:e(`privacyScreen.body`)}),(0,R.jsx)(N,{electron:C,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:C,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 ${C?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.55s both`},children:[(0,R.jsx)(j,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!G||!q,onClick:()=>$(!1),className:C?void 0:`h-11 text-base`,children:e(`privacyScreen.start`)}),ae&&(0,R.jsx)(j,{variant:`outlined`,size:`regular`,fullWidth:!0,disabled:!G||!q,onClick:()=>$(!0),className:C?void 0:`h-11 text-base`,children:e(`privacyScreen.skipToChat`)}),(0,R.jsx)(j,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:()=>n(k()?h.onboarding.hosting:h.onboarding.start,u),className:C?void 0:`h-11 text-base`,children:e(`actions.back`)})]})]})})}function V(e){return e.kind===`package`?new URLSearchParams({[y]:e.packageKey}):e.storageTier===null?null:C({machineTier:e.machineTier,storageTier:e.storageTier,creditTier:e.creditTier})}export{B as PrivacyScreen};