@vellumai/web 0.9.0-dev.202606181130.57d4082 → 0.9.0-dev.202606181513.fd39213

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 (78) hide show
  1. package/dist/assets/{account-page-Bbb79s0G.js → account-page-B-Xh0yHW.js} +1 -1
  2. package/dist/assets/{add-credits-modal-BaWM3Uor.js → add-credits-modal-D2fbC-hb.js} +1 -1
  3. package/dist/assets/{advanced-page-BONWQQ6T.js → advanced-page-CIwq3e6-.js} +1 -1
  4. package/dist/assets/{ai-page-CAn0DAUE.js → ai-page-D3LQK1Pn.js} +1 -1
  5. package/dist/assets/{api-key-screen-DnetDYnT.js → api-key-screen-lZx78u-G.js} +1 -1
  6. package/dist/assets/{archive-page-CdPeVsa4.js → archive-page-DB38OBq5.js} +1 -1
  7. package/dist/assets/{billing-page-shIKDu4C.js → billing-page-BLlTI5DV.js} +1 -1
  8. package/dist/assets/{bookmarks-page-JRCBQITb.js → bookmarks-page-B_x2DyVd.js} +1 -1
  9. package/dist/assets/{command-palette-CG3quDg_.js → command-palette-tAd_QyVU.js} +1 -1
  10. package/dist/assets/{command-palette-window-page-DVRua2x8.js → command-palette-window-page-B2Q6Av94.js} +1 -1
  11. package/dist/assets/{community-page-C84RKKgm.js → community-page-hY_1zJaq.js} +1 -1
  12. package/dist/assets/{contacts-page-route-BQKU9Pfr.js → contacts-page-route-C4HdPsRv.js} +1 -1
  13. package/dist/assets/{debug-page-GUDgGxKI.js → debug-page-Cxp-F1sg.js} +1 -1
  14. package/dist/assets/{deploy-dialogs-lShVLBMs.js → deploy-dialogs-BgmF2IE1.js} +1 -1
  15. package/dist/assets/{developer-page-hbCNqrtT.js → developer-page-SguvKc5s.js} +1 -1
  16. package/dist/assets/{devices-page-CeBe5m2_.js → devices-page-0Nfka3RN.js} +1 -1
  17. package/dist/assets/{dictation-overlay-page-PGei1U8E.js → dictation-overlay-page-BFP5ztSw.js} +1 -1
  18. package/dist/assets/{document-viewer-page-D2VaBRie.js → document-viewer-page-wCnrO-vE.js} +1 -1
  19. package/dist/assets/{earn-credits-modal-COuV9utF.js → earn-credits-modal-CCAfA4RZ.js} +1 -1
  20. package/dist/assets/{emails-page-DOzHH7Zl.js → emails-page-DHprVGpc.js} +1 -1
  21. package/dist/assets/{file-editor-D-PIkdij.js → file-editor-DO2qhWhV.js} +1 -1
  22. package/dist/assets/{general-page-B8jxr_2r.js → general-page-DrI0RTSK.js} +1 -1
  23. package/dist/assets/{hatching-screen-YsAGe-Nb.js → hatching-screen-D02s0hOq.js} +1 -1
  24. package/dist/assets/home-page-route-D7x-XDX_.js +1 -0
  25. package/dist/assets/{hosting-screen-CnfScJK-.js → hosting-screen-H5k7HquU.js} +1 -1
  26. package/dist/assets/{identity-page-route-U1RyGP9o.js → identity-page-route-Bj8tSRbj.js} +1 -1
  27. package/dist/assets/{index-BsySSmys.js → index-CEhiJItI.js} +7 -7
  28. package/dist/assets/index-rogxjn1t.css +2 -0
  29. package/dist/assets/{inspect-page-BUw_CHH2.js → inspect-page-D--MCqRR.js} +1 -1
  30. package/dist/assets/{install-Dld2F_Pr.js → install-DLdFKlq2.js} +1 -1
  31. package/dist/assets/{integrations-page-CGMdCmwP.js → integrations-page-Cg73W9AG.js} +1 -1
  32. package/dist/assets/{intelligence-layout-oBv4INVt.js → intelligence-layout-DdXkH7Iv.js} +1 -1
  33. package/dist/assets/{keyboard-shortcuts-page-DFGtk0Hg.js → keyboard-shortcuts-page-CEnvxois.js} +1 -1
  34. package/dist/assets/{library-detail-page-BT1dsT_7.js → library-detail-page-B59XQ74V.js} +1 -1
  35. package/dist/assets/{library-page-3g6qrFjy.js → library-page-d9BBS_yy.js} +1 -1
  36. package/dist/assets/{login-page-CT0Rz08X.js → login-page-BgaMibVf.js} +1 -1
  37. package/dist/assets/{logout-page-BDtcKclA.js → logout-page-DTb3dRyn.js} +1 -1
  38. package/dist/assets/{logs-layout-BfuiDGvD.js → logs-layout-Do18p3et.js} +1 -1
  39. package/dist/assets/{memory-router-playground-page-BUGncLHR.js → memory-router-playground-page-CByaz0LW.js} +1 -1
  40. package/dist/assets/{mobile-sidebar-drawer-C1nRfHxW.js → mobile-sidebar-drawer-CmFGv0ak.js} +1 -1
  41. package/dist/assets/{notifications-page-ConnGVYd.js → notifications-page-BEbDgCqx.js} +1 -1
  42. package/dist/assets/{oauth-complete-page-YoilCDPK.js → oauth-complete-page-pF-RJI_N.js} +1 -1
  43. package/dist/assets/{oauth-popup-complete-page-CbBRbY-B.js → oauth-popup-complete-page-Bi1lVe9S.js} +1 -1
  44. package/dist/assets/{pairing-page-Bb1CPv68.js → pairing-page-DaeVzuAb.js} +1 -1
  45. package/dist/assets/{plugin-detail-page-DCZoyZdW.js → plugin-detail-page-W0_go-aU.js} +1 -1
  46. package/dist/assets/{plugins-page-DRh5aTu_.js → plugins-page-AyGvIJv-.js} +1 -1
  47. package/dist/assets/{prechat-route-DNilB68s.js → prechat-route-BT8KM5Ip.js} +1 -1
  48. package/dist/assets/privacy-page-x6BqysMe.js +1 -0
  49. package/dist/assets/{privacy-screen-CNN2D2QH.js → privacy-screen-DDBIvMgs.js} +1 -1
  50. package/dist/assets/{provider-callback-page-DZoT6awN.js → provider-callback-page-Bli_HQOZ.js} +1 -1
  51. package/dist/assets/{research-mock-page-DeD-o0DI.js → research-mock-page-CbPekJOQ.js} +1 -1
  52. package/dist/assets/{research-onboarding-route-DCWZ7a7u.js → research-onboarding-route-BsLonRxv.js} +1 -1
  53. package/dist/assets/{review-terms-screen-CK7smCvU.js → review-terms-screen-BLwcHjKm.js} +1 -1
  54. package/dist/assets/{select-assistant-screen-Bop1LBRy.js → select-assistant-screen-HfIL_pw_.js} +1 -1
  55. package/dist/assets/{settings-layout-BgWJLlh0.js → settings-layout-BwhS98yJ.js} +1 -1
  56. package/dist/assets/{share-feedback-modal-CrxygF57.js → share-feedback-modal-BBl-kxSg.js} +1 -1
  57. package/dist/assets/{sidebar-tree-CH2YCJs-.js → sidebar-tree-BSHyIykQ.js} +1 -1
  58. package/dist/assets/{signup-page-CNte3xd9.js → signup-page-D7V5QIPk.js} +1 -1
  59. package/dist/assets/{skills-page-CN1EiQm3.js → skills-page-Dy1GrYRy.js} +1 -1
  60. package/dist/assets/{sounds-page-pkgRU_6Z.js → sounds-page-Dv6uyyUR.js} +1 -1
  61. package/dist/assets/{step-indicator-dots-DBUcB0lL.js → step-indicator-dots-BlU3rKYn.js} +1 -1
  62. package/dist/assets/{subagent-detail-panel--JvYFuCK.js → subagent-detail-panel-CBwuGHAq.js} +1 -1
  63. package/dist/assets/{system-events-page-yPw6YXAb.js → system-events-page-C5J2TzoF.js} +1 -1
  64. package/dist/assets/{tiptap-document-editor-CuurezmQ.js → tiptap-document-editor-BXg8fWbZ.js} +1 -1
  65. package/dist/assets/{tool-detail-panel-B-mKASxZ.js → tool-detail-panel-Cf0UkplU.js} +1 -1
  66. package/dist/assets/{trace-page-Cd-Teamy.js → trace-page-iFVckc_v.js} +1 -1
  67. package/dist/assets/{upgrade-cancel-page-DwXpXRVL.js → upgrade-cancel-page-BOCQnAfm.js} +1 -1
  68. package/dist/assets/{upgrade-success-page-C1tSJbYw.js → upgrade-success-page-DfCt8s-A.js} +1 -1
  69. package/dist/assets/{usage-page-DrWXyJWB.js → usage-page-ydMmNowy.js} +1 -1
  70. package/dist/assets/{voice-page-C6rAd7Qr.js → voice-page-DlCINjLf.js} +1 -1
  71. package/dist/assets/{weather-forecast-display-CVIC9Ndk.js → weather-forecast-display-DF9cT36-.js} +1 -1
  72. package/dist/assets/{welcome-screen-BQ3ALdUP.js → welcome-screen-scmFZ3US.js} +1 -1
  73. package/dist/assets/{workspace-page-CqoUycHx.js → workspace-page-BLLS0czw.js} +1 -1
  74. package/dist/index.html +2 -2
  75. package/package.json +1 -1
  76. package/dist/assets/home-page-route-Dceh3Dw2.js +0 -1
  77. package/dist/assets/index-DZSt77KN.css +0 -2
  78. package/dist/assets/privacy-page-pvvFP77R.js +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{p as r,r as i,t as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as o}from"./QueryClientProvider-DKhXIxGb.js";import{t as s}from"./useQuery-B45lW1Kk.js";import{t as c}from"./jsx-runtime-CVSDxk6A.js";import{t as l}from"./card-BibIM9x3.js";import"./src-C4Sj609L.js";import{t as u}from"./confirm-dialog-DbNUkFt6.js";import{n as d}from"./toast-DLWkiWW6.js";import{t as f}from"./external-link-BK_NhMUL.js";import{t as p}from"./loader-circle-CdxxVJvk.js";import{t as m}from"./triangle-alert-B-ye6tYl.js";import{$ as h,Bt as g,Q as _,Vt as v,X as y,Y as b,tt as x,zt as S}from"./react-query.gen-Dc9bPcAq.js";import{a as C}from"./routes-BnbYm-Mr.js";import{t as w}from"./assistant-feature-flag-store-ClCVaYet.js";import{Ki as T,Xa as E,bo as D,fo as O,xo as k}from"./index-BsySSmys.js";import{t as A}from"./use-active-assistant-id-BFElIHKJ.js";import{t as j}from"./file-markdown-CCyGVLOO.js";import{n as M,r as N,t as P}from"./use-plugin-drift-B1mUU7pv.js";var F=e(t(),1),I=c();function L(e){return e?e.slice(0,7):`unknown`}function R(){let e=w.use.hasHydrated(),t=w.use.externalPlugins(),c=A(),{name:f}=r(),p=o(),[m,T]=(0,F.useState)(!1),[E,O]=(0,F.useState)(!1),k=s({...b({path:{assistant_id:c,name:f??``}}),enabled:!!c&&!!f}),N=k.data?.installed??!1,R=M({assistantId:c,name:f??``,enabled:N}).data,W=(0,F.useCallback)(()=>{p.invalidateQueries({queryKey:h({path:{assistant_id:c}})}),p.invalidateQueries({queryKey:x({path:{assistant_id:c}})}),f&&(p.invalidateQueries({queryKey:y({path:{assistant_id:c,name:f}})}),p.invalidateQueries({queryKey:_({path:{assistant_id:c,name:f}})}))},[c,f,p]),G=v({onSuccess:()=>{W(),d.success(`Installed ${f??`plugin`}`)}}),K=S({onSuccess:W}),q=g({onSuccess:e=>{W(),d.success(e.outcome===`already-up-to-date`?`${f??`Plugin`} is already up to date`:`Upgraded ${f??`plugin`} to ${L(e.toCommit)}`)}});if(!e)return null;if(!t)return(0,I.jsx)(i,{to:C.identity,replace:!0});if(!f)return(0,I.jsx)(i,{to:C.plugins,replace:!0});let J=()=>{G.mutate({path:{assistant_id:c},body:{name:f}})},Y=()=>{T(!1),K.mutate({path:{assistant_id:c,name:f}})},X=()=>{q.mutate({path:{assistant_id:c,name:f},body:{}})},Z=()=>{if(P(R)){O(!0);return}X()},Q=()=>{O(!1),X()},$=k.data??null;return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,I.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,I.jsx)(n,{asChild:!0,variant:`ghost`,children:(0,I.jsx)(a,{to:C.plugins,"aria-label":`Back to plugins`,children:(0,I.jsx)(D,{"aria-hidden":!0})})}),(0,I.jsx)(z,{name:f,plugin:$,drift:R,onInstall:J,onRemove:()=>T(!0),onUpgrade:Z,isInstalling:G.isPending,isRemoving:K.isPending,isUpgrading:q.isPending})]}),(G.isError||K.isError||q.isError)&&(0,I.jsx)(U,{message:G.isError?`Failed to install plugin. Please try again.`:K.isError?`Failed to remove plugin. Please try again.`:`Failed to upgrade plugin. Please try again.`}),(0,I.jsx)(l.Root,{asChild:!0,children:(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:k.isLoading?(0,I.jsx)(V,{}):k.isError||!$?(0,I.jsx)(H,{}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(B,{plugin:$}),$.readme?(0,I.jsx)(j,{content:$.readme}):(0,I.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})}),(0,I.jsx)(u,{open:m,title:`Remove plugin`,message:`Remove "${$?.name??f}" from this assistant?`,confirmLabel:`Remove`,destructive:!0,onConfirm:Y,onCancel:()=>T(!1)}),(0,I.jsx)(u,{open:E,title:`Upgrade plugin`,message:`"${$?.name??f}" has local edits that will be overwritten by the upgrade. Continue?`,confirmLabel:`Upgrade anyway`,destructive:!0,onConfirm:Q,onCancel:()=>O(!1)})]})}function z({name:e,plugin:t,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l}){let u=t?.installed??!1,d=t?.source?.kind===`github`,f=t?.artifact??null,m=r?.status===`update-available`,h=m?`Upgrade ${L(r?.local?.commit??null)} \u2192 ${L(r?.remote?.commit??null)}`:void 0;return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:d?`📦`:`🧩`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,I.jsx)(`h2`,{className:`truncate text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,I.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,d?(0,I.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-tertiary)`},children:`external`}):null,m?(0,I.jsx)(N,{}):null]}),t?.description?(0,I.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?u?(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[f?(0,I.jsx)(n,{asChild:!0,leftIcon:(0,I.jsx)(E,{"aria-hidden":!0}),children:(0,I.jsx)(`a`,{href:f.url,download:!0,children:f.label??`Download`})}):null,m?(0,I.jsx)(n,{type:`button`,onClick:o,disabled:l,title:h,leftIcon:l?(0,I.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,I.jsx)(O,{"aria-hidden":!0}),children:`Upgrade`}):null,(0,I.jsx)(n,{type:`button`,variant:`dangerOutline`,onClick:a,disabled:c,leftIcon:c?(0,I.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,I.jsx)(T,{"aria-hidden":!0}),children:`Remove`})]}):(0,I.jsx)(n,{type:`button`,onClick:i,disabled:s,leftIcon:s?(0,I.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,I.jsx)(k,{"aria-hidden":!0}),children:`Install`}):null]})}function B({plugin:e}){let t=[{label:`Source`,value:e.source?.kind===`github`?e.source.repo:`Local`,href:(e.source?.kind===`github`?`https://github.com/${e.source.repo}`:null)??void 0}];return e.homepage&&t.push({label:`Homepage`,value:e.homepage,href:e.homepage}),e.license&&t.push({label:`License`,value:e.license}),(0,I.jsx)(`dl`,{className:`mb-5 grid gap-x-6 gap-y-2 border-b pb-5 sm:grid-cols-[max-content_1fr]`,style:{borderColor:`var(--border-base)`},children:t.map(e=>(0,I.jsxs)(`div`,{className:`contents`,children:[(0,I.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,I.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,I.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 underline`,style:{color:`var(--primary-base, #60a5fa)`},children:[e.value,(0,I.jsx)(f,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function V(){return(0,I.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,I.jsx)(p,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function H(){return(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,I.jsx)(m,{className:`h-6 w-6`,"aria-hidden":!0}),(0,I.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,I.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function U({message:e}){return(0,I.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded px-3 py-2 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-warning, var(--content-tertiary))`},role:`alert`,children:[(0,I.jsx)(m,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),e]})}export{R as PluginDetailPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{p as r,r as i,t as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as o}from"./QueryClientProvider-DKhXIxGb.js";import{t as s}from"./useQuery-B45lW1Kk.js";import{t as c}from"./jsx-runtime-CVSDxk6A.js";import{t as l}from"./card-BibIM9x3.js";import"./src-C4Sj609L.js";import{t as u}from"./confirm-dialog-DbNUkFt6.js";import{n as d}from"./toast-DLWkiWW6.js";import{t as f}from"./external-link-BK_NhMUL.js";import{t as p}from"./loader-circle-CdxxVJvk.js";import{t as m}from"./triangle-alert-B-ye6tYl.js";import{$ as h,Bt as g,Q as _,Vt as v,X as y,Y as b,tt as x,zt as S}from"./react-query.gen-Dc9bPcAq.js";import{a as C}from"./routes-BnbYm-Mr.js";import{t as w}from"./assistant-feature-flag-store-ClCVaYet.js";import{Ki as T,Xa as E,bo as D,fo as O,xo as k}from"./index-CEhiJItI.js";import{t as A}from"./use-active-assistant-id-BFElIHKJ.js";import{t as j}from"./file-markdown-CCyGVLOO.js";import{n as M,r as N,t as P}from"./use-plugin-drift-B1mUU7pv.js";var F=e(t(),1),I=c();function L(e){return e?e.slice(0,7):`unknown`}function R(){let e=w.use.hasHydrated(),t=w.use.externalPlugins(),c=A(),{name:f}=r(),p=o(),[m,T]=(0,F.useState)(!1),[E,O]=(0,F.useState)(!1),k=s({...b({path:{assistant_id:c,name:f??``}}),enabled:!!c&&!!f}),N=k.data?.installed??!1,R=M({assistantId:c,name:f??``,enabled:N}).data,W=(0,F.useCallback)(()=>{p.invalidateQueries({queryKey:h({path:{assistant_id:c}})}),p.invalidateQueries({queryKey:x({path:{assistant_id:c}})}),f&&(p.invalidateQueries({queryKey:y({path:{assistant_id:c,name:f}})}),p.invalidateQueries({queryKey:_({path:{assistant_id:c,name:f}})}))},[c,f,p]),G=v({onSuccess:()=>{W(),d.success(`Installed ${f??`plugin`}`)}}),K=S({onSuccess:W}),q=g({onSuccess:e=>{W(),d.success(e.outcome===`already-up-to-date`?`${f??`Plugin`} is already up to date`:`Upgraded ${f??`plugin`} to ${L(e.toCommit)}`)}});if(!e)return null;if(!t)return(0,I.jsx)(i,{to:C.identity,replace:!0});if(!f)return(0,I.jsx)(i,{to:C.plugins,replace:!0});let J=()=>{G.mutate({path:{assistant_id:c},body:{name:f}})},Y=()=>{T(!1),K.mutate({path:{assistant_id:c,name:f}})},X=()=>{q.mutate({path:{assistant_id:c,name:f},body:{}})},Z=()=>{if(P(R)){O(!0);return}X()},Q=()=>{O(!1),X()},$=k.data??null;return(0,I.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,I.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,I.jsx)(n,{asChild:!0,variant:`ghost`,children:(0,I.jsx)(a,{to:C.plugins,"aria-label":`Back to plugins`,children:(0,I.jsx)(D,{"aria-hidden":!0})})}),(0,I.jsx)(z,{name:f,plugin:$,drift:R,onInstall:J,onRemove:()=>T(!0),onUpgrade:Z,isInstalling:G.isPending,isRemoving:K.isPending,isUpgrading:q.isPending})]}),(G.isError||K.isError||q.isError)&&(0,I.jsx)(U,{message:G.isError?`Failed to install plugin. Please try again.`:K.isError?`Failed to remove plugin. Please try again.`:`Failed to upgrade plugin. Please try again.`}),(0,I.jsx)(l.Root,{asChild:!0,children:(0,I.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:k.isLoading?(0,I.jsx)(V,{}):k.isError||!$?(0,I.jsx)(H,{}):(0,I.jsxs)(I.Fragment,{children:[(0,I.jsx)(B,{plugin:$}),$.readme?(0,I.jsx)(j,{content:$.readme}):(0,I.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})}),(0,I.jsx)(u,{open:m,title:`Remove plugin`,message:`Remove "${$?.name??f}" from this assistant?`,confirmLabel:`Remove`,destructive:!0,onConfirm:Y,onCancel:()=>T(!1)}),(0,I.jsx)(u,{open:E,title:`Upgrade plugin`,message:`"${$?.name??f}" has local edits that will be overwritten by the upgrade. Continue?`,confirmLabel:`Upgrade anyway`,destructive:!0,onConfirm:Q,onCancel:()=>O(!1)})]})}function z({name:e,plugin:t,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l}){let u=t?.installed??!1,d=t?.source?.kind===`github`,f=t?.artifact??null,m=r?.status===`update-available`,h=m?`Upgrade ${L(r?.local?.commit??null)} \u2192 ${L(r?.remote?.commit??null)}`:void 0;return(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,I.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,I.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:d?`📦`:`🧩`}),(0,I.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,I.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,I.jsx)(`h2`,{className:`truncate text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,I.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,d?(0,I.jsx)(`span`,{className:`shrink-0 rounded px-1.5 py-0.5 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-tertiary)`},children:`external`}):null,m?(0,I.jsx)(N,{}):null]}),t?.description?(0,I.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?u?(0,I.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[f?(0,I.jsx)(n,{asChild:!0,leftIcon:(0,I.jsx)(E,{"aria-hidden":!0}),children:(0,I.jsx)(`a`,{href:f.url,download:!0,children:f.label??`Download`})}):null,m?(0,I.jsx)(n,{type:`button`,onClick:o,disabled:l,title:h,leftIcon:l?(0,I.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,I.jsx)(O,{"aria-hidden":!0}),children:`Upgrade`}):null,(0,I.jsx)(n,{type:`button`,variant:`dangerOutline`,onClick:a,disabled:c,leftIcon:c?(0,I.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,I.jsx)(T,{"aria-hidden":!0}),children:`Remove`})]}):(0,I.jsx)(n,{type:`button`,onClick:i,disabled:s,leftIcon:s?(0,I.jsx)(p,{className:`animate-spin`,"aria-hidden":!0}):(0,I.jsx)(k,{"aria-hidden":!0}),children:`Install`}):null]})}function B({plugin:e}){let t=[{label:`Source`,value:e.source?.kind===`github`?e.source.repo:`Local`,href:(e.source?.kind===`github`?`https://github.com/${e.source.repo}`:null)??void 0}];return e.homepage&&t.push({label:`Homepage`,value:e.homepage,href:e.homepage}),e.license&&t.push({label:`License`,value:e.license}),(0,I.jsx)(`dl`,{className:`mb-5 grid gap-x-6 gap-y-2 border-b pb-5 sm:grid-cols-[max-content_1fr]`,style:{borderColor:`var(--border-base)`},children:t.map(e=>(0,I.jsxs)(`div`,{className:`contents`,children:[(0,I.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,I.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,I.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 underline`,style:{color:`var(--primary-base, #60a5fa)`},children:[e.value,(0,I.jsx)(f,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function V(){return(0,I.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,I.jsx)(p,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function H(){return(0,I.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,I.jsx)(m,{className:`h-6 w-6`,"aria-hidden":!0}),(0,I.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,I.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function U({message:e}){return(0,I.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded px-3 py-2 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-warning, var(--content-tertiary))`},role:`alert`,children:[(0,I.jsx)(m,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),e]})}export{R as PluginDetailPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-BibIM9x3.js";import"./src-C4Sj609L.js";import{t as s}from"./input-CwdmSRlD.js";import{t as c}from"./chevron-right-Cu9YGUrb.js";import{t as l}from"./loader-circle-CdxxVJvk.js";import{t as u}from"./triangle-alert-B-ye6tYl.js";import{_n as d}from"./sdk.gen-ZXouuy0U.js";import{$ as f,et as p}from"./react-query.gen-Dc9bPcAq.js";import{a as m}from"./routes-BnbYm-Mr.js";import{t as h}from"./assistant-feature-flag-store-ClCVaYet.js";import{fa as g,oa as _}from"./index-BsySSmys.js";import{t as v}from"./use-active-assistant-id-BFElIHKJ.js";import{n as y,r as b}from"./use-plugin-drift-B1mUU7pv.js";var x=e(t(),1),S=a();function C({match:e}){return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`📦`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name})}),e.description&&(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.description}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},title:e.path,children:e.path})]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}function w({plugin:e,assistantId:t}){let n=y({assistantId:t,name:e.name}).data?.status===`update-available`;return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`🧩`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name}),e.version?(0,S.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null,n?(0,S.jsx)(b,{}):null]}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:e.description??`No description provided.`}),e.issues&&e.issues.length>0?(0,S.jsxs)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-warning, var(--content-tertiary))`},title:e.issues.join(`; `),children:[e.issues[0],e.issues.length>1?` (+${e.issues.length-1} more)`:``]}):null]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}var T=300*1e3;function E(e,...t){return e?t.some(t=>t?.toLowerCase().includes(e)):!0}function D({assistantId:e}){let[t,n]=(0,x.useState)(``),r=t.trim().toLowerCase(),a=i({queryKey:f({path:{assistant_id:e},query:{q:void 0}}),queryFn:async({signal:t})=>{let n=await d({path:{assistant_id:e},query:{q:void 0},signal:t,throwOnError:!1});if(n.response?.status===404)return{plugins:[]};if(!n.response?.ok)throw Error(`Failed to load plugins`);return n.data??{plugins:[]}},enabled:!!e,staleTime:T}),o=i({...p({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:T}),s=(0,x.useMemo)(()=>O(a.data?.plugins??[]),[a.data?.plugins]),c=(0,x.useMemo)(()=>new Set(s.map(e=>e.name)),[s]),l=(0,x.useMemo)(()=>s.filter(e=>E(r,e.name,e.description)),[s,r]),u=(0,x.useMemo)(()=>(o.data?.matches??[]).filter(e=>!c.has(e.name)&&E(r,e.name,e.description)),[o.data?.matches,c,r]),m=a.isFetching&&!a.isLoading||o.isFetching&&!o.isLoading,h=a.isLoading,g=o.isLoading,_=!h&&!a.isError&&l.length===0,v=!g&&u.length===0;return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[(0,S.jsx)(k,{search:t,onSearchChange:n,isSearching:m}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:[(0,S.jsx)(A,{title:`Installed`}),h?(0,S.jsx)(j,{}):a.isError?(0,S.jsx)(P,{}):_?(0,S.jsx)(M,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map(t=>(0,S.jsx)(`li`,{children:(0,S.jsx)(w,{plugin:t,assistantId:e})},t.id))}),(0,S.jsx)(`div`,{className:`mt-6`}),(0,S.jsx)(A,{title:`Available to install`}),g?(0,S.jsx)(j,{}):o.isError?(0,S.jsx)(F,{}):v?(0,S.jsx)(N,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(C,{match:e})},e.path))})]})]})}function O(e){return[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}))}function k({search:e,onSearchChange:t,isSearching:n}){return(0,S.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,S.jsx)(s,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search Plugins`,"aria-label":`Search Plugins`,leftIcon:(0,S.jsx)(_,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:n?(0,S.jsx)(l,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`})})}function A({title:e}){return(0,S.jsx)(`h3`,{className:`mb-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e})}function j(){return(0,S.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,S.jsx)(l,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function M({hasQuery:e}){let t=e?`No installed plugins match`:`No Plugins Installed`,n=e?`Try a different search term, or browse the catalog below.`:`Install a plugin with the CLI, or browse the catalog below.`,r=e?_:g;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(r,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function N({hasQuery:e}){let t=e?`No catalog entries match`:`Catalog is empty`,n=e?`Try a different search term, or remove the filter to browse everything.`:`No plugins are currently published in the catalog.`;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(_,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function P(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(u,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function F(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(g,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Couldn't load catalog`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Catalog browsing is temporarily unavailable. Installed plugins are still listed above.`})]})})}function I(){let e=h.use.hasHydrated(),t=h.use.externalPlugins(),r=v();return e?t?(0,S.jsx)(D,{assistantId:r}):(0,S.jsx)(n,{to:m.identity,replace:!0}):null}export{I as PluginsPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n,t as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-BibIM9x3.js";import"./src-C4Sj609L.js";import{t as s}from"./input-CwdmSRlD.js";import{t as c}from"./chevron-right-Cu9YGUrb.js";import{t as l}from"./loader-circle-CdxxVJvk.js";import{t as u}from"./triangle-alert-B-ye6tYl.js";import{_n as d}from"./sdk.gen-ZXouuy0U.js";import{$ as f,et as p}from"./react-query.gen-Dc9bPcAq.js";import{a as m}from"./routes-BnbYm-Mr.js";import{t as h}from"./assistant-feature-flag-store-ClCVaYet.js";import{fa as g,oa as _}from"./index-CEhiJItI.js";import{t as v}from"./use-active-assistant-id-BFElIHKJ.js";import{n as y,r as b}from"./use-plugin-drift-B1mUU7pv.js";var x=e(t(),1),S=a();function C({match:e}){return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`📦`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name})}),e.description&&(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.description}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-tertiary)`},title:e.path,children:e.path})]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}function w({plugin:e,assistantId:t}){let n=y({assistantId:t,name:e.name}).data?.status===`update-available`;return(0,S.jsx)(o.Root,{asChild:!0,children:(0,S.jsxs)(r,{to:m.plugin(e.name),className:`group flex cursor-pointer items-center gap-4 px-5 py-4 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,S.jsx)(`div`,{className:`flex h-10 w-10 shrink-0 items-center justify-center text-2xl`,children:`🧩`}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,S.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,S.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:`var(--content-default)`},children:e.name}),e.version?(0,S.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null,n?(0,S.jsx)(b,{}):null]}),(0,S.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:e.description??`No description provided.`}),e.issues&&e.issues.length>0?(0,S.jsxs)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-warning, var(--content-tertiary))`},title:e.issues.join(`; `),children:[e.issues[0],e.issues.length>1?` (+${e.issues.length-1} more)`:``]}):null]}),(0,S.jsx)(c,{className:`h-5 w-5 shrink-0 opacity-0 transition-opacity group-hover:opacity-100`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})})}var T=300*1e3;function E(e,...t){return e?t.some(t=>t?.toLowerCase().includes(e)):!0}function D({assistantId:e}){let[t,n]=(0,x.useState)(``),r=t.trim().toLowerCase(),a=i({queryKey:f({path:{assistant_id:e},query:{q:void 0}}),queryFn:async({signal:t})=>{let n=await d({path:{assistant_id:e},query:{q:void 0},signal:t,throwOnError:!1});if(n.response?.status===404)return{plugins:[]};if(!n.response?.ok)throw Error(`Failed to load plugins`);return n.data??{plugins:[]}},enabled:!!e,staleTime:T}),o=i({...p({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:T}),s=(0,x.useMemo)(()=>O(a.data?.plugins??[]),[a.data?.plugins]),c=(0,x.useMemo)(()=>new Set(s.map(e=>e.name)),[s]),l=(0,x.useMemo)(()=>s.filter(e=>E(r,e.name,e.description)),[s,r]),u=(0,x.useMemo)(()=>(o.data?.matches??[]).filter(e=>!c.has(e.name)&&E(r,e.name,e.description)),[o.data?.matches,c,r]),m=a.isFetching&&!a.isLoading||o.isFetching&&!o.isLoading,h=a.isLoading,g=o.isLoading,_=!h&&!a.isError&&l.length===0,v=!g&&u.length===0;return(0,S.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[(0,S.jsx)(k,{search:t,onSearchChange:n,isSearching:m}),(0,S.jsxs)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:[(0,S.jsx)(A,{title:`Installed`}),h?(0,S.jsx)(j,{}):a.isError?(0,S.jsx)(P,{}):_?(0,S.jsx)(M,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:l.map(t=>(0,S.jsx)(`li`,{children:(0,S.jsx)(w,{plugin:t,assistantId:e})},t.id))}),(0,S.jsx)(`div`,{className:`mt-6`}),(0,S.jsx)(A,{title:`Available to install`}),g?(0,S.jsx)(j,{}):o.isError?(0,S.jsx)(F,{}):v?(0,S.jsx)(N,{hasQuery:!!r}):(0,S.jsx)(`ul`,{className:`flex flex-col gap-2`,children:u.map(e=>(0,S.jsx)(`li`,{children:(0,S.jsx)(C,{match:e})},e.path))})]})]})}function O(e){return[...e].sort((e,t)=>e.name.localeCompare(t.name,void 0,{sensitivity:`base`}))}function k({search:e,onSearchChange:t,isSearching:n}){return(0,S.jsx)(`div`,{className:`flex items-center gap-3`,children:(0,S.jsx)(s,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search Plugins`,"aria-label":`Search Plugins`,leftIcon:(0,S.jsx)(_,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:n?(0,S.jsx)(l,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`})})}function A({title:e}){return(0,S.jsx)(`h3`,{className:`mb-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e})}function j(){return(0,S.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,S.jsx)(l,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function M({hasQuery:e}){let t=e?`No installed plugins match`:`No Plugins Installed`,n=e?`Try a different search term, or browse the catalog below.`:`Install a plugin with the CLI, or browse the catalog below.`,r=e?_:g;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(r,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function N({hasQuery:e}){let t=e?`No catalog entries match`:`Catalog is empty`,n=e?`Try a different search term, or remove the filter to browse everything.`:`No plugins are currently published in the catalog.`;return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(_,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:t}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:n})]})})}function P(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(u,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function F(){return(0,S.jsx)(o.Root,{children:(0,S.jsxs)(o.Body,{className:`flex flex-col items-center justify-center py-10 text-center`,children:[(0,S.jsx)(g,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,S.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Couldn't load catalog`}),(0,S.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Catalog browsing is temporarily unavailable. Installed plugins are still listed above.`})]})})}function I(){let e=h.use.hasHydrated(),t=h.use.externalPlugins(),r=v();return e?t?(0,S.jsx)(D,{assistantId:r}):(0,S.jsx)(n,{to:m.identity,replace:!0}):null}export{I as PluginsPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./card-BibIM9x3.js";import{t as l}from"./input-CwdmSRlD.js";import{a as u,d,s as f}from"./local-mode-Bvz5B1q8.js";import{t as p}from"./is-electron-BuSDabCt.js";import{n as m}from"./resolved-assistants-store-Cumv2SiX.js";import{t as h}from"./chevron-left-H9xBKELt.js";import{t as g}from"./loader-circle-CdxxVJvk.js";import{t as _}from"./pencil-BqT-WChe.js";import{t as v}from"./x-Bmx5Uey2.js";import{G as y,W as b,a as x,i as S,k as C,n as w}from"./auth-store-CdoTCJgP.js";import{t as T}from"./client.gen-ZHFX_7TH.js";import{a as E}from"./routes-BnbYm-Mr.js";import{i as D,t as O}from"./prefs-BXOW-ziM.js";import{t as k}from"./client-feature-flag-store-DZMwD6Gv.js";import{t as A}from"./public-asset-y2pjkMTl.js";import{An as j,Dr as M,F as N,I as ee,Ja as P,P as te,an as ne,at as re,c as ie,ct as F,d as ae,dt as I,gt as oe,ht as se,in as ce,l as le,mo as L,nn as ue,ot as R,pn as de,rn as fe,s as z,st as pe,ut as me}from"./index-BsySSmys.js";import{c as he,i as ge,n as B,o as _e,r as ve,s as ye,t as V}from"./step-indicator-dots-DBUcB0lL.js";import{n as H,r as be}from"./prechat-names-Ba-YnefK.js";var U=e(t(),1);async function xe(){try{let{data:e,response:t}=await T.get({url:`/v1/onboarding/recipe/`,throwOnError:!1});if(!t?.ok||!e)return null;let n=e;return typeof n.cohort!=`string`||!Array.isArray(n.tasks)||typeof n.tone!=`string`||typeof n.bootstrap_template!=`string`||typeof n.initial_message!=`string`||!Array.isArray(n.skills)||typeof n.skip_prechat!=`boolean`?null:{cohort:n.cohort,tasks:n.tasks,tone:n.tone,bootstrapTemplate:n.bootstrap_template,initialMessage:n.initial_message,skills:n.skills,skipPrechat:n.skip_prechat}}catch{return null}}var W=s(),Se=[{label:`Push notifications`,detail:`stay in the loop even when the browser is closed`},{label:`Biometric login`,detail:`Face ID & Touch ID for instant, secure access`},{label:`Native haptics`,detail:`tactile feedback that feels part of the device`},{label:`Home screen access`,detail:`launch your assistant with a single tap`}];function Ce({onComplete:e}){function t(){le(),z(),e()}return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col items-center justify-center px-6 pb-40 text-center`,children:[(0,W.jsx)(`div`,{className:`mb-8 flex size-16 items-center justify-center rounded-2xl border`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,boxShadow:`0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04)`,animation:`fadeInUp 0.3s ease-out both`},children:(0,W.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--content-default)`},"aria-hidden":!0,children:[(0,W.jsx)(`rect`,{x:`5`,y:`2`,width:`14`,height:`20`,rx:`3`}),(0,W.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`18.01`})]})}),(0,W.jsx)(`p`,{className:`text-label-small-default mb-3 uppercase tracking-[0.2em]`,style:{color:`var(--content-tertiary)`,animation:`fadeInUp 0.3s ease-out 0.05s both`},children:`One more thing`}),(0,W.jsx)(`h1`,{className:`mb-3 text-3xl font-semibold tracking-tight`,style:{color:`var(--content-default)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Your assistant, in your pocket.`}),(0,W.jsx)(`p`,{className:`text-body-medium-lighter mb-10 max-w-sm`,style:{color:`var(--content-secondary)`,animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`The iOS app keeps your assistant a tap away — with push notifications, biometric login, and native haptics.`}),(0,W.jsx)(`div`,{className:`mb-10 w-full rounded-xl border px-5 py-4`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,animation:`fadeInUp 0.3s ease-out 0.2s both`},children:(0,W.jsx)(`ul`,{className:`space-y-4`,children:Se.map((e,t)=>(0,W.jsxs)(`li`,{className:`flex items-start gap-3`,style:{animation:`fadeInUp 0.3s ease-out ${.25+t*.05}s both`},children:[(0,W.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full`,style:{background:`var(--system-positive-weak)`},children:(0,W.jsx)(L,{size:12,style:{color:`var(--system-positive-strong)`}})}),(0,W.jsxs)(`span`,{className:`text-left`,children:[(0,W.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),(0,W.jsxs)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[` — `,e.detail]})]})]},e.label))})}),(0,W.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.45s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var G=`google`,we=[{id:`gmail`,label:`Gmail`,logoSrc:A(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:A(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:A(`/images/integrations/google-drive.svg`)}];function Te({assistantId:e,assistantName:t,onConnect:r,onSkip:i,onBack:o}){let s=p(),c=a(),l=C(),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(null),m=(0,U.useRef)(null),_=(0,U.useRef)(null),v=(0,U.useRef)(null),y=(0,U.useRef)(null),[b,x]=(0,U.useState)(!1),S=(0,U.useCallback)(()=>{d.current=null,x(!1)},[]),w=(0,U.useCallback)(()=>{_.current&&=(window.removeEventListener(`message`,_.current),null),v.current&&=(window.removeEventListener(`storage`,v.current),null)},[]),T=(0,U.useCallback)(()=>{u.current&&!u.current.closed&&u.current.close(),u.current=null,f.current&&=(clearInterval(f.current),null),m.current&&=(clearTimeout(m.current),null)},[]),D=M();(0,U.useEffect)(()=>()=>{f.current&&clearInterval(f.current),m.current&&clearTimeout(m.current),u.current&&!u.current.closed&&u.current.close(),_.current&&window.removeEventListener(`message`,_.current),v.current&&window.removeEventListener(`storage`,v.current),y.current&&=(y.current(),null)},[]);let O=(0,U.useCallback)(async e=>{try{return(await c.fetchQuery({...j({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===G&&e.connected)??null}catch{return null}},[c]),k=(0,U.useCallback)(async()=>{let e=d.current?.platformAssistantId;T(),S(),r((e?await O(e):null)?.scopes_granted??[])},[S,T,O,r]),A=(0,U.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!d.current||e.requestId!==d.current.requestId||(e.oauthStatus===`connected`?k():(T(),S())))},[S,T,k]),N=(0,U.useCallback)(e=>{let t=d.current;if(!t)return;let n=re(e,window.location.origin,t.requestId);n&&A(n)},[A]),P=(0,U.useCallback)(e=>{let t=d.current;if(!t)return;let n=R(e,t.requestId);n&&(A(n),window.localStorage.removeItem(F(t.requestId)))},[A]);me((0,U.useCallback)(e=>{let t=d.current;t&&e.requestId===t.requestId&&A({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[A]));let te=(0,U.useCallback)(()=>{let t=crypto.randomUUID();if(w(),_.current=N,v.current=P,l){x(!0),(async()=>{let n;try{n=await ee(e)}catch{S();return}d.current={requestId:t,platformAssistantId:n},D.mutate({path:{assistant_id:n,provider:G},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){se(e.connect_url)},onError(){S()}})})(),window.addEventListener(`message`,N),window.addEventListener(`storage`,P),y.current&&y.current();let n=oe(()=>{let e=d.current;if(!e){n(),y.current=null;return}(async()=>{let t=await O(e.platformAssistantId);d.current&&(t?await k():S(),w(),n(),y.current=null)})()});y.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){w();return}u.current=n,x(!0),window.addEventListener(`message`,N),window.addEventListener(`storage`,P),f.current=setInterval(()=>{u.current&&u.current.closed&&d.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=d.current;if(!e)return;let t=window.localStorage.getItem(F(e.requestId));if(t)try{let n=JSON.parse(t);if(pe(n,e.requestId)){A(n),window.localStorage.removeItem(F(e.requestId)),w();return}}catch{}let n=await O(e.platformAssistantId);d.current&&(n?await k():(T(),S()),w())},1e3))},100),(async()=>{let n;try{n=await ee(e)}catch{T(),S(),w();return}d.current={requestId:t,platformAssistantId:n},D.mutate({path:{assistant_id:n,provider:G},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){u.current&&!u.current.closed?u.current.location.href=e.connect_url:d.current&&(T(),S(),w())},onError(){T(),S(),w()}})})()},[e,S,T,O,A,N,P,k,l,w,D]),ne=t||`your assistant`,ie=t||`Your assistant`;return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${s?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}),(0,W.jsx)(`h1`,{className:`text-center ${s?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Connect Google`}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsx)(`p`,{className:`mt-4 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you use Google, ${ne} can use Gmail, Calendar, and Drive with your permission.`}),(0,W.jsx)(`div`,{className:`mt-6 flex items-stretch justify-center gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:we.map(e=>(0,W.jsxs)(`div`,{className:`flex w-24 flex-col items-center gap-2.5 rounded-2xl bg-[var(--surface-lift)] px-3 pb-3 pt-4`,children:[(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:28,height:28,className:`h-7 w-7 object-contain`,loading:`eager`}),(0,W.jsx)(`span`,{className:`text-center text-xs leading-tight text-[var(--content-tertiary)]`,children:e.label})]},e.id))}),(0,W.jsx)(`p`,{className:`mt-8 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.25s both`},children:`${ie} will never send email, change calendar events, or edit files without your permission. You can disconnect at any time.`}),(0,W.jsxs)(`div`,{className:`${s?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.35s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:te,disabled:b||D.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:b||D.isPending?(0,W.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,W.jsx)(g,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization...`]}):`Connect Google`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,disabled:b||D.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}function Ee({userName:e,assistantName:t,selectedGroupId:r,displayedAssistantNames:i,onUserNameChange:a,onAssistantNameChange:o,onGroupChange:s,onBack:c,onComplete:u,onSkip:d}){let f=p();return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${f?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full items-center ${c?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[c?(0,W.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}):null,(0,W.jsx)(`h1`,{className:`text-center ${f?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Let's get to know each other.`}),c?(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,W.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,W.jsxs)(`div`,{className:`${f?`mt-6`:`mt-8`} flex w-full flex-col ${f?`gap-4`:`gap-6`}`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>a(e.target.value),fullWidth:!0}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>o(e.target.value),fullWidth:!0}),(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>{let n=e===t;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>o(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Pick a vibe`}),(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:H.map(e=>(0,W.jsx)(De,{group:e,isActive:r===e.id,onToggle:()=>s(r===e.id?null:e.id)},e.id))})]})]}),(0,W.jsxs)(`div`,{className:`${f?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:u,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:d,className:`${f?`h-9`:`h-11 text-base`}`,children:`Skip`})]})]})})}function De({group:e,isActive:t,onToggle:n}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":`${e.label}, ${e.descriptor}`,className:`flex cursor-pointer flex-col items-start gap-0.5 rounded-lg border p-3 text-left transition-colors ${t?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(`span`,{className:`text-body-medium-default ${t?`text-[var(--content-inset)]`:`text-[var(--content-default)]`}`,children:e.descriptor}),(0,W.jsx)(`span`,{className:`text-body-small-default ${t?`text-[var(--content-inset)] opacity-60`:`text-[var(--content-tertiary)]`}`,children:e.tagline})]})}function Oe({userName:e,assistantName:t,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onBack:o,onContinue:s,onSkip:c,currentStep:u,totalSteps:d}){return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[o?(0,W.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,W.jsx)(h,{}),onClick:o,"aria-label":`Back`}):(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}),(0,W.jsx)(`div`,{className:`flex justify-center`,children:(0,W.jsx)(V,{current:u,total:d})}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,W.jsx)(`h1`,{className:`text-center text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Let's get to know each other.`}),(0,W.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,W.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>i(e.target.value),fullWidth:!0}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>a(e.target.value),fullWidth:!0}),(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let n=e===t;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>a(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]})]})]}),(0,W.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Continue`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:c,className:`h-11 text-base`,children:`Skip`})]})]})})}var ke=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:A(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:A(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:A(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:A(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:A(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:A(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:A(`/images/prior-assistants/copilot.svg`)}];function Ae({selectedAssistants:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,U.useState)(()=>K(e)),[d,f]=(0,U.useState)(()=>s.length>0),m=(0,U.useRef)(q(e));(0,U.useEffect)(()=>{let t=q(e);if(t===m.current)return;let n=K(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,U.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}je(n,e)||(m.current=q(n),t(n))},[s]);let g=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},y=(0,U.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full items-center grid-cols-[auto_1fr_auto]`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}),(0,W.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Have you used any of these?`}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you've built anything with another assistant, I can help you bring it over.`}),(0,W.jsxs)(`div`,{className:`${o?`mt-4`:`mt-8`} grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[ke.map(t=>(0,W.jsx)(Me,{assistant:t,selected:e.has(t.id),onToggle:()=>g(t.id)},t.id)),d?null:(0,W.jsx)(Ne,{onClick:()=>f(!0)})]}),d?(0,W.jsx)(c,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(_,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom assistants`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(v,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,W.jsx)(l,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),y.length>0?(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:y.map(e=>(0,W.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,W.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I haven't used any`})]})]})})}function je(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function K(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function q(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Me({assistant:e,selected:t,onToggle:n}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(Pe,{assistant:e,size:32}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,W.jsx)(L,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Ne({onClick:e}){return(0,W.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,W.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,W.jsx)(P,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function Pe({assistant:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,W.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,W.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,W.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Fe({selectedTasks:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),s=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}),(0,W.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What are you working on?`}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsx)(`p`,{className:`${o?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`Pick the one or two you do most — you can select more if it really is all of it.`}),(0,W.jsx)(`div`,{className:`${o?`mt-6`:`mt-8`} flex w-full flex-col ${o?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:te.map(t=>{let n=N[t.iconKey],r=e.has(t.id);return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>s(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${o?`gap-2 p-3`:`gap-3 px-4 py-3`} rounded-lg border text-left transition-colors ${r?`border-[var(--primary-base)] bg-[var(--primary-base)]/10`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(`div`,{className:`flex w-6 shrink-0 items-center justify-center text-[var(--content-secondary)]`,children:n?(0,W.jsx)(n,{className:`h-4 w-4`}):null}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:t.label}),(0,W.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t.sublabel})]}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-md ${r?`bg-[var(--primary-base)]`:`border-[1.5px] border-[var(--border-element)]`}`,children:r?(0,W.jsx)(L,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,W.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}var Ie=new Set([`gmail`,`google-calendar`,`google-drive`]),Le=[{id:`gmail`,label:`Gmail`,logoSrc:A(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:A(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:A(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:A(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:A(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:A(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:A(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:A(`/images/integrations/github.svg`),logoSrcDark:A(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:A(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:A(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:A(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:A(`/images/integrations/apple-notes.svg`)}];function J(e){let t=e.map(e=>e.startsWith(`other:`)?e.slice(6):e);return Array.from(new Set(t)).sort()}function Re({selectedTools:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,U.useState)(()=>Y(e)),[d,f]=(0,U.useState)(()=>s.length>0),m=(0,U.useRef)(X(e));(0,U.useEffect)(()=>{let t=X(e);if(t===m.current)return;let n=Y(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,U.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(m.current=X(n),t(n))},[s]);let g=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},y=(0,U.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full items-center ${r?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[r?(0,W.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}):null,(0,W.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),r?(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,W.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`This helps me tailor how I assist you. No connections needed — you can set those up later.`}),(0,W.jsxs)(`div`,{className:`grid w-full gap-2 ${o?`mt-4 grid-cols-4`:`mt-8 grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Le.map(t=>(0,W.jsx)(Z,{tool:t,selected:e.has(t.id),onToggle:()=>g(t.id),electron:o},t.id)),d?null:(0,W.jsx)(Q,{onClick:()=>f(!0),electron:o})]}),d?(0,W.jsx)(c,{padding:o?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,W.jsxs)(`div`,{className:`flex flex-col ${o?`gap-2`:`gap-3`}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(_,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom tools`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(v,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,W.jsx)(l,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),y.length>0?(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:y.map(e=>(0,W.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,W.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}function ze(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function X(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Z({tool:e,selected:t,onToggle:n,electron:r}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex ${r?`h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)($,{tool:e,size:32}),(0,W.jsx)(`span`,{className:`${r?`w-full truncate`:`line-clamp-2`} text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,W.jsx)(L,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Q({onClick:e,electron:t}){return(0,W.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex ${t?`min-h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,W.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,W.jsx)(P,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function $({tool:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,W.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,W.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,W.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Be({selectedGroupId:e,onGroupChange:t,onBack:r,onContinue:i,onSkip:a,currentStep:o,totalSteps:s}){return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,W.jsx)(h,{}),onClick:r,"aria-label":`Back`}),(0,W.jsx)(`div`,{className:`flex justify-center`,children:(0,W.jsx)(V,{current:o,total:s})}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,W.jsx)(`h1`,{className:`w-full text-left text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`What's my vibe?`}),(0,W.jsx)(`p`,{className:`mt-2 w-full text-left text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change this any time.`}),(0,W.jsx)(`div`,{className:`mt-8 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:H.map(n=>{let r=e===n.id;return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(r?null:n.id),"aria-pressed":r,className:`flex cursor-pointer items-center justify-between rounded-xl border px-4 py-4 text-left transition-colors ${r?`border-[var(--content-default)] bg-[var(--surface-lift)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:n.descriptor}),(0,W.jsx)(`span`,{className:`flex h-5 w-5 items-center justify-center rounded-full border-2 transition-colors ${r?`border-[var(--content-default)]`:`border-[var(--content-disabled)]`}`,children:r&&(0,W.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--content-default)]`})})]},n.id)})})]}),(0,W.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Continue`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ve(e){let[t,n]=(0,U.useState)(()=>(e??``).trim()),r=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{if(r.current)return;let t=(e??``).trim();t&&n(e=>e||t)},[e]),{value:t,onChange:(0,U.useCallback)(e=>{r.current=!0,n(e)},[])}}var He=[`gmail`,`google-calendar`,`google-drive`],Ue=`experiment-activation-flow-2026-06-03`,We=`BOOTSTRAP-ACTIVATION-RAIL.md`;function Ge(e,t,n){return t?.initialMessage?t.initialMessage:n?fe(e):ue}function Ke(e){let{mode:t,recipe:n}=e,r=e.connectedScopes!==void 0,i;i=t===`native`?{tools:[],tasks:[],tone:e.tone,googleConnected:!1}:t===`paredDown`?{tools:r?[...He]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:J([...e.selectedTools]),tasks:[...e.selectedTasks].sort(),tone:e.tone},n&&(i.cohort=n.cohort,i.bootstrapTemplate=n.bootstrapTemplate,i.skills=n.skills),e.activationFlowEnabled&&(i.cohort=Ue,i.bootstrapTemplate=We);let a=e.userName.trim();a&&(i.userName=a);let o=e.occupation?.trim();o&&(i.occupation=o);let s=e.assistantName.trim();return s&&(i.assistantName=s),t===`paredDown`?r&&(i.googleScopes=e.connectedScopes):t===`control`&&(r?(i.googleConnected=!0,i.googleScopes=e.connectedScopes):e.googleConnected?(i.googleConnected=!0,i.googleScopes=e.googleScopes):i.googleConnected=!1),t===`control`&&e.selectedPriorAssistants.size>0&&(i.priorAssistants=J([...e.selectedPriorAssistants])),i.initialMessage=Ge(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function qe(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Je(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:B.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:B.controlWorkType,enabled:!t},{id:`tools`,funnelStep:B.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:B.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?B.gmailConnect:B.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:B.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ye(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Xe=`1`;function Ze(e){return e===`nativeVibe`||e===Xe?`nativeVibe`:null}function Qe(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function $e(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function et(){let e=r(),t=C(),n=D()&&O();return(0,U.useEffect)(()=>{!n&&!t&&e(E.onboarding.privacy,{replace:!0})},[n,t,e]),t||n}function tt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,U.useState)(()=>t?`nativeName`:`name`),a=(0,U.useCallback)(e=>{if(n)try{e===null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},[n]);return(0,U.useLayoutEffect)(()=>{if(n)try{let e=Ze(sessionStorage.getItem(n));e&&i(e)}catch{}},[n]),(0,U.useEffect)(()=>{t&&a(r===`nativeVibe`?`nativeVibe`:null)},[t,r,a]),{currentStep:r,setCurrentStep:i,clearPersistedStep:(0,U.useCallback)(()=>{a(null)},[a])}}var nt=3;function rt(){let e=f();return e?.cloud===`vellum`?e.assistantId:u()[0]?.assistantId??null}function it(){let e=r(),[t]=i(),n=t.get(`preview`)===`true`,a=w.use.user(),s=S(),c=x(),l=a?.id??null,u=a?.firstName??``,f=a?.lastName??``,p=C(),h=m.use.activeAssistantId(),g=d(),_=ae()&&!ie(),v=k.use.stringFlags().preChatOnboardingExperiment20260606??`control`,T=(k.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,D=k.use.selfIntroGreeting(),O=_e(v),A=ye()??O,j=A===ve.paredDown,M=g?rt():null,N=et(),{currentStep:ee,setCurrentStep:P,clearPersistedStep:te}=tt(l,p),re=w.use.platformSession(),F=y(re),[I,oe]=(0,U.useState)(()=>new Set),[se,le]=(0,U.useState)(()=>new Set),[L,ue]=(0,U.useState)(()=>new Set),{value:R,onChange:fe}=Ve(g&&!F?``:u||f),[z,pe]=(0,U.useState)(null),[me]=(0,U.useState)(()=>be()),[B,V]=(0,U.useState)(``),[H,Se]=(0,U.useState)(!1),[G,we]=(0,U.useState)([]),{data:De}=o({...de(),enabled:!c&&s&&(!g||F)}),{data:ke,isLoading:je}=o({queryKey:[`onboarding-recipe`,l],queryFn:xe,enabled:!c&&s&&!p&&!g,staleTime:1/0}),K=ke??null,q=De?.id??h??M,Me=qe({localMode:g,platformSession:re,hasCachedPlatformAssistant:M!==null}),Ne=Me,Pe=Me,Le=async()=>{await b.checkAssistant(),e(`${E.assistant}?onboarding=1`,{replace:!0})};function J(e,t=A){n||ge(e,{userId:l,variant:he(t)})}let ze=[...I].some(e=>Ie.has(e)),Y=p?Ye():Je({paredDown:j,canOfferPriorAssistants:Pe,canOfferGoogleStep:n?!1:Ne,hasGoogleTool:ze,showIOSAppStep:_});function X(t){if(n){e(-1);return}ne(Ke({mode:p?`native`:j?`paredDown`:`control`,recipe:p?null:K,selectedTools:I,selectedTasks:se,selectedPriorAssistants:t?.selectedPriorAssistants??L,tone:z??K?.tone??`grounded`,userName:R,assistantName:B,selfIntroGreetingEnabled:D,activationFlowEnabled:p?void 0:T,googleConnected:H,googleScopes:G,connectedScopes:t?.connectedScopes}));let r=B.trim();r&&ce(r),p?(te(),e(E.onboarding.privacy)):(b.markExpectingFirstMessage(),Le())}let Z=(e,t)=>{e.funnelStep&&J(e.funnelStep);let n=Qe(Y,e.id);n?P(n):X(t)},Q=e=>{let t=$e(Y,e.id);t&&P(t)};if(!N||je)return null;let $=Y.find(e=>e.id===ee)??Y[0];return $?$.id===`nativeName`?(0,W.jsx)(Oe,{userName:R,assistantName:B,displayedAssistantNames:me,onUserNameChange:fe,onAssistantNameChange:V,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:nt}):$.id===`nativeVibe`?(0,W.jsx)(Be,{selectedGroupId:z,onGroupChange:pe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:nt}):$.id===`name`?(0,W.jsx)(Ee,{userName:R,assistantName:B,selectedGroupId:z,displayedAssistantNames:me,onUserNameChange:fe,onAssistantNameChange:V,onGroupChange:pe,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,W.jsx)(Fe,{selectedTasks:se,onChange:le,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,W.jsx)(Re,{selectedTools:I,onChange:oe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,W.jsx)(Ae,{selectedAssistants:L,onChange:ue,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;ue(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?q?(0,W.jsx)(Te,{assistantId:q,assistantName:B,onConnect:e=>{Se(!0),we(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,W.jsx)(Ce,{onComplete:()=>Z($)}):null:null}function at(){return(0,W.jsx)(it,{})}export{at as PreChatRoute};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./card-BibIM9x3.js";import{t as l}from"./input-CwdmSRlD.js";import{a as u,d,s as f}from"./local-mode-Bvz5B1q8.js";import{t as p}from"./is-electron-BuSDabCt.js";import{n as m}from"./resolved-assistants-store-Cumv2SiX.js";import{t as h}from"./chevron-left-H9xBKELt.js";import{t as g}from"./loader-circle-CdxxVJvk.js";import{t as _}from"./pencil-BqT-WChe.js";import{t as v}from"./x-Bmx5Uey2.js";import{G as y,W as b,a as x,i as S,k as C,n as w}from"./auth-store-CdoTCJgP.js";import{t as T}from"./client.gen-ZHFX_7TH.js";import{a as E}from"./routes-BnbYm-Mr.js";import{i as D,t as O}from"./prefs-BXOW-ziM.js";import{t as k}from"./client-feature-flag-store-DZMwD6Gv.js";import{t as A}from"./public-asset-y2pjkMTl.js";import{An as j,Dr as M,F as N,I as ee,Ja as P,P as te,an as ne,at as re,c as ie,ct as F,d as ae,dt as I,gt as oe,ht as se,in as ce,l as le,mo as L,nn as ue,ot as R,pn as de,rn as fe,s as z,st as pe,ut as me}from"./index-CEhiJItI.js";import{c as he,i as ge,n as B,o as _e,r as ve,s as ye,t as V}from"./step-indicator-dots-BlU3rKYn.js";import{n as H,r as be}from"./prechat-names-Ba-YnefK.js";var U=e(t(),1);async function xe(){try{let{data:e,response:t}=await T.get({url:`/v1/onboarding/recipe/`,throwOnError:!1});if(!t?.ok||!e)return null;let n=e;return typeof n.cohort!=`string`||!Array.isArray(n.tasks)||typeof n.tone!=`string`||typeof n.bootstrap_template!=`string`||typeof n.initial_message!=`string`||!Array.isArray(n.skills)||typeof n.skip_prechat!=`boolean`?null:{cohort:n.cohort,tasks:n.tasks,tone:n.tone,bootstrapTemplate:n.bootstrap_template,initialMessage:n.initial_message,skills:n.skills,skipPrechat:n.skip_prechat}}catch{return null}}var W=s(),Se=[{label:`Push notifications`,detail:`stay in the loop even when the browser is closed`},{label:`Biometric login`,detail:`Face ID & Touch ID for instant, secure access`},{label:`Native haptics`,detail:`tactile feedback that feels part of the device`},{label:`Home screen access`,detail:`launch your assistant with a single tap`}];function Ce({onComplete:e}){function t(){le(),z(),e()}return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col items-center justify-center px-6 pb-40 text-center`,children:[(0,W.jsx)(`div`,{className:`mb-8 flex size-16 items-center justify-center rounded-2xl border`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,boxShadow:`0 1px 3px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.04)`,animation:`fadeInUp 0.3s ease-out both`},children:(0,W.jsxs)(`svg`,{width:`28`,height:`28`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.5`,strokeLinecap:`round`,strokeLinejoin:`round`,style:{color:`var(--content-default)`},"aria-hidden":!0,children:[(0,W.jsx)(`rect`,{x:`5`,y:`2`,width:`14`,height:`20`,rx:`3`}),(0,W.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`18.01`})]})}),(0,W.jsx)(`p`,{className:`text-label-small-default mb-3 uppercase tracking-[0.2em]`,style:{color:`var(--content-tertiary)`,animation:`fadeInUp 0.3s ease-out 0.05s both`},children:`One more thing`}),(0,W.jsx)(`h1`,{className:`mb-3 text-3xl font-semibold tracking-tight`,style:{color:`var(--content-default)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Your assistant, in your pocket.`}),(0,W.jsx)(`p`,{className:`text-body-medium-lighter mb-10 max-w-sm`,style:{color:`var(--content-secondary)`,animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`The iOS app keeps your assistant a tap away — with push notifications, biometric login, and native haptics.`}),(0,W.jsx)(`div`,{className:`mb-10 w-full rounded-xl border px-5 py-4`,style:{background:`var(--surface-overlay)`,borderColor:`var(--border-element)`,animation:`fadeInUp 0.3s ease-out 0.2s both`},children:(0,W.jsx)(`ul`,{className:`space-y-4`,children:Se.map((e,t)=>(0,W.jsxs)(`li`,{className:`flex items-start gap-3`,style:{animation:`fadeInUp 0.3s ease-out ${.25+t*.05}s both`},children:[(0,W.jsx)(`span`,{className:`mt-0.5 flex size-5 shrink-0 items-center justify-center rounded-full`,style:{background:`var(--system-positive-weak)`},children:(0,W.jsx)(L,{size:12,style:{color:`var(--system-positive-strong)`}})}),(0,W.jsxs)(`span`,{className:`text-left`,children:[(0,W.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),(0,W.jsxs)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[` — `,e.detail]})]})]},e.label))})}),(0,W.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.45s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var G=`google`,we=[{id:`gmail`,label:`Gmail`,logoSrc:A(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:A(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:A(`/images/integrations/google-drive.svg`)}];function Te({assistantId:e,assistantName:t,onConnect:r,onSkip:i,onBack:o}){let s=p(),c=a(),l=C(),u=(0,U.useRef)(null),d=(0,U.useRef)(null),f=(0,U.useRef)(null),m=(0,U.useRef)(null),_=(0,U.useRef)(null),v=(0,U.useRef)(null),y=(0,U.useRef)(null),[b,x]=(0,U.useState)(!1),S=(0,U.useCallback)(()=>{d.current=null,x(!1)},[]),w=(0,U.useCallback)(()=>{_.current&&=(window.removeEventListener(`message`,_.current),null),v.current&&=(window.removeEventListener(`storage`,v.current),null)},[]),T=(0,U.useCallback)(()=>{u.current&&!u.current.closed&&u.current.close(),u.current=null,f.current&&=(clearInterval(f.current),null),m.current&&=(clearTimeout(m.current),null)},[]),D=M();(0,U.useEffect)(()=>()=>{f.current&&clearInterval(f.current),m.current&&clearTimeout(m.current),u.current&&!u.current.closed&&u.current.close(),_.current&&window.removeEventListener(`message`,_.current),v.current&&window.removeEventListener(`storage`,v.current),y.current&&=(y.current(),null)},[]);let O=(0,U.useCallback)(async e=>{try{return(await c.fetchQuery({...j({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===G&&e.connected)??null}catch{return null}},[c]),k=(0,U.useCallback)(async()=>{let e=d.current?.platformAssistantId;T(),S(),r((e?await O(e):null)?.scopes_granted??[])},[S,T,O,r]),A=(0,U.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!d.current||e.requestId!==d.current.requestId||(e.oauthStatus===`connected`?k():(T(),S())))},[S,T,k]),N=(0,U.useCallback)(e=>{let t=d.current;if(!t)return;let n=re(e,window.location.origin,t.requestId);n&&A(n)},[A]),P=(0,U.useCallback)(e=>{let t=d.current;if(!t)return;let n=R(e,t.requestId);n&&(A(n),window.localStorage.removeItem(F(t.requestId)))},[A]);me((0,U.useCallback)(e=>{let t=d.current;t&&e.requestId===t.requestId&&A({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[A]));let te=(0,U.useCallback)(()=>{let t=crypto.randomUUID();if(w(),_.current=N,v.current=P,l){x(!0),(async()=>{let n;try{n=await ee(e)}catch{S();return}d.current={requestId:t,platformAssistantId:n},D.mutate({path:{assistant_id:n,provider:G},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){se(e.connect_url)},onError(){S()}})})(),window.addEventListener(`message`,N),window.addEventListener(`storage`,P),y.current&&y.current();let n=oe(()=>{let e=d.current;if(!e){n(),y.current=null;return}(async()=>{let t=await O(e.platformAssistantId);d.current&&(t?await k():S(),w(),n(),y.current=null)})()});y.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){w();return}u.current=n,x(!0),window.addEventListener(`message`,N),window.addEventListener(`storage`,P),f.current=setInterval(()=>{u.current&&u.current.closed&&d.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=d.current;if(!e)return;let t=window.localStorage.getItem(F(e.requestId));if(t)try{let n=JSON.parse(t);if(pe(n,e.requestId)){A(n),window.localStorage.removeItem(F(e.requestId)),w();return}}catch{}let n=await O(e.platformAssistantId);d.current&&(n?await k():(T(),S()),w())},1e3))},100),(async()=>{let n;try{n=await ee(e)}catch{T(),S(),w();return}d.current={requestId:t,platformAssistantId:n},D.mutate({path:{assistant_id:n,provider:G},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){u.current&&!u.current.closed?u.current.location.href=e.connect_url:d.current&&(T(),S(),w())},onError(){T(),S(),w()}})})()},[e,S,T,O,A,N,P,k,l,w,D]),ne=t||`your assistant`,ie=t||`Your assistant`;return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${s?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(`button`,{type:`button`,onClick:o,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}),(0,W.jsx)(`h1`,{className:`text-center ${s?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Connect Google`}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsx)(`p`,{className:`mt-4 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you use Google, ${ne} can use Gmail, Calendar, and Drive with your permission.`}),(0,W.jsx)(`div`,{className:`mt-6 flex items-stretch justify-center gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:we.map(e=>(0,W.jsxs)(`div`,{className:`flex w-24 flex-col items-center gap-2.5 rounded-2xl bg-[var(--surface-lift)] px-3 pb-3 pt-4`,children:[(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:28,height:28,className:`h-7 w-7 object-contain`,loading:`eager`}),(0,W.jsx)(`span`,{className:`text-center text-xs leading-tight text-[var(--content-tertiary)]`,children:e.label})]},e.id))}),(0,W.jsx)(`p`,{className:`mt-8 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.25s both`},children:`${ie} will never send email, change calendar events, or edit files without your permission. You can disconnect at any time.`}),(0,W.jsxs)(`div`,{className:`${s?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.35s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:te,disabled:b||D.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:b||D.isPending?(0,W.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,W.jsx)(g,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization...`]}):`Connect Google`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,disabled:b||D.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}function Ee({userName:e,assistantName:t,selectedGroupId:r,displayedAssistantNames:i,onUserNameChange:a,onAssistantNameChange:o,onGroupChange:s,onBack:c,onComplete:u,onSkip:d}){let f=p();return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-md flex-col items-center ${f?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full items-center ${c?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[c?(0,W.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}):null,(0,W.jsx)(`h1`,{className:`text-center ${f?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Let's get to know each other.`}),c?(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,W.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,W.jsxs)(`div`,{className:`${f?`mt-6`:`mt-8`} flex w-full flex-col ${f?`gap-4`:`gap-6`}`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>a(e.target.value),fullWidth:!0}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>o(e.target.value),fullWidth:!0}),(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:i.map(e=>{let n=e===t;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>o(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Pick a vibe`}),(0,W.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:H.map(e=>(0,W.jsx)(De,{group:e,isActive:r===e.id,onToggle:()=>s(r===e.id?null:e.id)},e.id))})]})]}),(0,W.jsxs)(`div`,{className:`${f?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:u,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:d,className:`${f?`h-9`:`h-11 text-base`}`,children:`Skip`})]})]})})}function De({group:e,isActive:t,onToggle:n}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":`${e.label}, ${e.descriptor}`,className:`flex cursor-pointer flex-col items-start gap-0.5 rounded-lg border p-3 text-left transition-colors ${t?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(`span`,{className:`text-body-medium-default ${t?`text-[var(--content-inset)]`:`text-[var(--content-default)]`}`,children:e.descriptor}),(0,W.jsx)(`span`,{className:`text-body-small-default ${t?`text-[var(--content-inset)] opacity-60`:`text-[var(--content-tertiary)]`}`,children:e.tagline})]})}function Oe({userName:e,assistantName:t,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onBack:o,onContinue:s,onSkip:c,currentStep:u,totalSteps:d}){return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[o?(0,W.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,W.jsx)(h,{}),onClick:o,"aria-label":`Back`}):(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}),(0,W.jsx)(`div`,{className:`flex justify-center`,children:(0,W.jsx)(V,{current:u,total:d})}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,W.jsx)(`h1`,{className:`text-center text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Let's get to know each other.`}),(0,W.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change these any time.`}),(0,W.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>i(e.target.value),fullWidth:!0}),(0,W.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,W.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>a(e.target.value),fullWidth:!0}),(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,W.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let n=e===t;return(0,W.jsx)(`button`,{type:`button`,onClick:()=>a(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]})]})]}),(0,W.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Continue`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:c,className:`h-11 text-base`,children:`Skip`})]})]})})}var ke=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:A(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:A(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:A(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:A(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:A(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:A(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:A(`/images/prior-assistants/copilot.svg`)}];function Ae({selectedAssistants:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,U.useState)(()=>K(e)),[d,f]=(0,U.useState)(()=>s.length>0),m=(0,U.useRef)(q(e));(0,U.useEffect)(()=>{let t=q(e);if(t===m.current)return;let n=K(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,U.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}je(n,e)||(m.current=q(n),t(n))},[s]);let g=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},y=(0,U.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full items-center grid-cols-[auto_1fr_auto]`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}),(0,W.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Have you used any of these?`}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you've built anything with another assistant, I can help you bring it over.`}),(0,W.jsxs)(`div`,{className:`${o?`mt-4`:`mt-8`} grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[ke.map(t=>(0,W.jsx)(Me,{assistant:t,selected:e.has(t.id),onToggle:()=>g(t.id)},t.id)),d?null:(0,W.jsx)(Ne,{onClick:()=>f(!0)})]}),d?(0,W.jsx)(c,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,W.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(_,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom assistants`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(v,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,W.jsx)(l,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),y.length>0?(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:y.map(e=>(0,W.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,W.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I haven't used any`})]})]})})}function je(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function K(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function q(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Me({assistant:e,selected:t,onToggle:n}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(Pe,{assistant:e,size:32}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,W.jsx)(L,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Ne({onClick:e}){return(0,W.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex h-[88px] w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,W.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,W.jsx)(P,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function Pe({assistant:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,W.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,W.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,W.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Fe({selectedTasks:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),s=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}),(0,W.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What are you working on?`}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsx)(`p`,{className:`${o?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`Pick the one or two you do most — you can select more if it really is all of it.`}),(0,W.jsx)(`div`,{className:`${o?`mt-6`:`mt-8`} flex w-full flex-col ${o?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:te.map(t=>{let n=N[t.iconKey],r=e.has(t.id);return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>s(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${o?`gap-2 p-3`:`gap-3 px-4 py-3`} rounded-lg border text-left transition-colors ${r?`border-[var(--primary-base)] bg-[var(--primary-base)]/10`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(`div`,{className:`flex w-6 shrink-0 items-center justify-center text-[var(--content-secondary)]`,children:n?(0,W.jsx)(n,{className:`h-4 w-4`}):null}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`div`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:t.label}),(0,W.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t.sublabel})]}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-5 w-5 shrink-0 items-center justify-center rounded-md ${r?`bg-[var(--primary-base)]`:`border-[1.5px] border-[var(--border-element)]`}`,children:r?(0,W.jsx)(L,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,W.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}var Ie=new Set([`gmail`,`google-calendar`,`google-drive`]),Le=[{id:`gmail`,label:`Gmail`,logoSrc:A(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:A(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:A(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:A(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:A(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:A(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:A(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:A(`/images/integrations/github.svg`),logoSrcDark:A(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:A(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:A(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:A(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:A(`/images/integrations/apple-notes.svg`)}];function J(e){let t=e.map(e=>e.startsWith(`other:`)?e.slice(6):e);return Array.from(new Set(t)).sort()}function Re({selectedTools:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,U.useState)(()=>Y(e)),[d,f]=(0,U.useState)(()=>s.length>0),m=(0,U.useRef)(X(e));(0,U.useEffect)(()=>{let t=X(e);if(t===m.current)return;let n=Y(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,U.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(m.current=X(n),t(n))},[s]);let g=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},y=(0,U.useMemo)(()=>{let e=new Set;return s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full items-center ${r?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[r?(0,W.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(h,{className:`h-4 w-4`})}):null,(0,W.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),r?(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,W.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`This helps me tailor how I assist you. No connections needed — you can set those up later.`}),(0,W.jsxs)(`div`,{className:`grid w-full gap-2 ${o?`mt-4 grid-cols-4`:`mt-8 grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Le.map(t=>(0,W.jsx)(Z,{tool:t,selected:e.has(t.id),onToggle:()=>g(t.id),electron:o},t.id)),d?null:(0,W.jsx)(Q,{onClick:()=>f(!0),electron:o})]}),d?(0,W.jsx)(c,{padding:o?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,W.jsxs)(`div`,{className:`flex flex-col ${o?`gap-2`:`gap-3`}`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(_,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),u(``)},"aria-label":`Dismiss custom tools`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,W.jsx)(v,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,W.jsx)(l,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),y.length>0?(0,W.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:y.map(e=>(0,W.jsx)(`span`,{className:`rounded-full bg-[var(--primary-base)] px-3 py-1 text-label-small-default text-[var(--content-inset)]`,children:e},e))}):null]})}):null,(0,W.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}function ze(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function X(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Z({tool:e,selected:t,onToggle:n,electron:r}){return(0,W.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,"aria-label":e.label,className:`relative flex ${r?`h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border p-2 transition-colors ${t?`border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_10%,transparent)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)($,{tool:e,size:32}),(0,W.jsx)(`span`,{className:`${r?`w-full truncate`:`line-clamp-2`} text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`absolute right-2 top-2 flex h-4 w-4 items-center justify-center rounded-full bg-[var(--primary-base)]`,children:(0,W.jsx)(L,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Q({onClick:e,electron:t}){return(0,W.jsxs)(`button`,{type:`button`,onClick:e,"aria-label":`Something else`,className:`flex ${t?`min-h-[72px]`:`h-[88px]`} w-full cursor-pointer flex-col items-center justify-center gap-1.5 rounded-lg border border-[var(--border-element)] bg-[var(--surface-lift)] p-2 transition-colors hover:bg-[var(--surface-base)]`,children:[(0,W.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,W.jsx)(P,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,W.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function $({tool:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,W.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,W.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,W.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,W.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})});let n=e.label.slice(0,2).toUpperCase();return(0,W.jsx)(`span`,{className:`flex items-center justify-center rounded-full bg-[var(--surface-base)] text-label-small-default text-[var(--content-default)]`,style:{width:t,height:t},"aria-hidden":`true`,children:n})}function Be({selectedGroupId:e,onGroupChange:t,onBack:r,onContinue:i,onSkip:a,currentStep:o,totalSteps:s}){return(0,W.jsx)(I,{showCreatureFooter:!1,children:(0,W.jsxs)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,children:[(0,W.jsxs)(`div`,{className:`grid w-full grid-cols-[auto_1fr_auto] items-center pb-4`,style:{paddingTop:`calc(var(--safe-area-inset-top, env(safe-area-inset-top, 0px)) + 1rem)`,animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[(0,W.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,W.jsx)(h,{}),onClick:r,"aria-label":`Back`}),(0,W.jsx)(`div`,{className:`flex justify-center`,children:(0,W.jsx)(V,{current:o,total:s})}),(0,W.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,W.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,W.jsx)(`h1`,{className:`w-full text-left text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`What's my vibe?`}),(0,W.jsx)(`p`,{className:`mt-2 w-full text-left text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`You can change this any time.`}),(0,W.jsx)(`div`,{className:`mt-8 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:H.map(n=>{let r=e===n.id;return(0,W.jsxs)(`button`,{type:`button`,onClick:()=>t(r?null:n.id),"aria-pressed":r,className:`flex cursor-pointer items-center justify-between rounded-xl border px-4 py-4 text-left transition-colors ${r?`border-[var(--content-default)] bg-[var(--surface-lift)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,W.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:n.descriptor}),(0,W.jsx)(`span`,{className:`flex h-5 w-5 items-center justify-center rounded-full border-2 transition-colors ${r?`border-[var(--content-default)]`:`border-[var(--content-disabled)]`}`,children:r&&(0,W.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--content-default)]`})})]},n.id)})})]}),(0,W.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,W.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Continue`}),(0,W.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ve(e){let[t,n]=(0,U.useState)(()=>(e??``).trim()),r=(0,U.useRef)(!1);return(0,U.useEffect)(()=>{if(r.current)return;let t=(e??``).trim();t&&n(e=>e||t)},[e]),{value:t,onChange:(0,U.useCallback)(e=>{r.current=!0,n(e)},[])}}var He=[`gmail`,`google-calendar`,`google-drive`],Ue=`experiment-activation-flow-2026-06-03`,We=`BOOTSTRAP-ACTIVATION-RAIL.md`;function Ge(e,t,n){return t?.initialMessage?t.initialMessage:n?fe(e):ue}function Ke(e){let{mode:t,recipe:n}=e,r=e.connectedScopes!==void 0,i;i=t===`native`?{tools:[],tasks:[],tone:e.tone,googleConnected:!1}:t===`paredDown`?{tools:r?[...He]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:J([...e.selectedTools]),tasks:[...e.selectedTasks].sort(),tone:e.tone},n&&(i.cohort=n.cohort,i.bootstrapTemplate=n.bootstrapTemplate,i.skills=n.skills),e.activationFlowEnabled&&(i.cohort=Ue,i.bootstrapTemplate=We);let a=e.userName.trim();a&&(i.userName=a);let o=e.occupation?.trim();o&&(i.occupation=o);let s=e.assistantName.trim();return s&&(i.assistantName=s),t===`paredDown`?r&&(i.googleScopes=e.connectedScopes):t===`control`&&(r?(i.googleConnected=!0,i.googleScopes=e.connectedScopes):e.googleConnected?(i.googleConnected=!0,i.googleScopes=e.googleScopes):i.googleConnected=!1),t===`control`&&e.selectedPriorAssistants.size>0&&(i.priorAssistants=J([...e.selectedPriorAssistants])),i.initialMessage=Ge(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function qe(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Je(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:B.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:B.controlWorkType,enabled:!t},{id:`tools`,funnelStep:B.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:B.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?B.gmailConnect:B.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:B.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ye(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Xe=`1`;function Ze(e){return e===`nativeVibe`||e===Xe?`nativeVibe`:null}function Qe(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function $e(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function et(){let e=r(),t=C(),n=D()&&O();return(0,U.useEffect)(()=>{!n&&!t&&e(E.onboarding.privacy,{replace:!0})},[n,t,e]),t||n}function tt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,U.useState)(()=>t?`nativeName`:`name`),a=(0,U.useCallback)(e=>{if(n)try{e===null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},[n]);return(0,U.useLayoutEffect)(()=>{if(n)try{let e=Ze(sessionStorage.getItem(n));e&&i(e)}catch{}},[n]),(0,U.useEffect)(()=>{t&&a(r===`nativeVibe`?`nativeVibe`:null)},[t,r,a]),{currentStep:r,setCurrentStep:i,clearPersistedStep:(0,U.useCallback)(()=>{a(null)},[a])}}var nt=3;function rt(){let e=f();return e?.cloud===`vellum`?e.assistantId:u()[0]?.assistantId??null}function it(){let e=r(),[t]=i(),n=t.get(`preview`)===`true`,a=w.use.user(),s=S(),c=x(),l=a?.id??null,u=a?.firstName??``,f=a?.lastName??``,p=C(),h=m.use.activeAssistantId(),g=d(),_=ae()&&!ie(),v=k.use.stringFlags().preChatOnboardingExperiment20260606??`control`,T=(k.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,D=k.use.selfIntroGreeting(),O=_e(v),A=ye()??O,j=A===ve.paredDown,M=g?rt():null,N=et(),{currentStep:ee,setCurrentStep:P,clearPersistedStep:te}=tt(l,p),re=w.use.platformSession(),F=y(re),[I,oe]=(0,U.useState)(()=>new Set),[se,le]=(0,U.useState)(()=>new Set),[L,ue]=(0,U.useState)(()=>new Set),{value:R,onChange:fe}=Ve(g&&!F?``:u||f),[z,pe]=(0,U.useState)(null),[me]=(0,U.useState)(()=>be()),[B,V]=(0,U.useState)(``),[H,Se]=(0,U.useState)(!1),[G,we]=(0,U.useState)([]),{data:De}=o({...de(),enabled:!c&&s&&(!g||F)}),{data:ke,isLoading:je}=o({queryKey:[`onboarding-recipe`,l],queryFn:xe,enabled:!c&&s&&!p&&!g,staleTime:1/0}),K=ke??null,q=De?.id??h??M,Me=qe({localMode:g,platformSession:re,hasCachedPlatformAssistant:M!==null}),Ne=Me,Pe=Me,Le=async()=>{await b.checkAssistant(),e(`${E.assistant}?onboarding=1`,{replace:!0})};function J(e,t=A){n||ge(e,{userId:l,variant:he(t)})}let ze=[...I].some(e=>Ie.has(e)),Y=p?Ye():Je({paredDown:j,canOfferPriorAssistants:Pe,canOfferGoogleStep:n?!1:Ne,hasGoogleTool:ze,showIOSAppStep:_});function X(t){if(n){e(-1);return}ne(Ke({mode:p?`native`:j?`paredDown`:`control`,recipe:p?null:K,selectedTools:I,selectedTasks:se,selectedPriorAssistants:t?.selectedPriorAssistants??L,tone:z??K?.tone??`grounded`,userName:R,assistantName:B,selfIntroGreetingEnabled:D,activationFlowEnabled:p?void 0:T,googleConnected:H,googleScopes:G,connectedScopes:t?.connectedScopes}));let r=B.trim();r&&ce(r),p?(te(),e(E.onboarding.privacy)):(b.markExpectingFirstMessage(),Le())}let Z=(e,t)=>{e.funnelStep&&J(e.funnelStep);let n=Qe(Y,e.id);n?P(n):X(t)},Q=e=>{let t=$e(Y,e.id);t&&P(t)};if(!N||je)return null;let $=Y.find(e=>e.id===ee)??Y[0];return $?$.id===`nativeName`?(0,W.jsx)(Oe,{userName:R,assistantName:B,displayedAssistantNames:me,onUserNameChange:fe,onAssistantNameChange:V,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:nt}):$.id===`nativeVibe`?(0,W.jsx)(Be,{selectedGroupId:z,onGroupChange:pe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:nt}):$.id===`name`?(0,W.jsx)(Ee,{userName:R,assistantName:B,selectedGroupId:z,displayedAssistantNames:me,onUserNameChange:fe,onAssistantNameChange:V,onGroupChange:pe,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,W.jsx)(Fe,{selectedTasks:se,onChange:le,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,W.jsx)(Re,{selectedTools:I,onChange:oe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,W.jsx)(Ae,{selectedAssistants:L,onChange:ue,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;ue(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?q?(0,W.jsx)(Te,{assistantId:q,assistantName:B,onConnect:e=>{Se(!0),we(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,W.jsx)(Ce,{onComplete:()=>Z($)}):null:null}function at(){return(0,W.jsx)(it,{})}export{at as PreChatRoute};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,n,o as r,r as i,s as a}from"./device-settings-zXRxGDTH.js";import{t as o}from"./react-DJZBPgpf.js";import{O as s,t as c}from"./button-D7s2Q_uG.js";import{n as l}from"./QueryClientProvider-DKhXIxGb.js";import{t as u}from"./useQuery-B45lW1Kk.js";import{t as d}from"./useMutation-Lj4VunQV.js";import{t as f}from"./jsx-runtime-CVSDxk6A.js";import{t as p}from"./cn-DvW5mxZR.js";import{t as m}from"./card-BibIM9x3.js";import{t as h}from"./dropdown-SfZ7NXPp.js";import"./src-C4Sj609L.js";import{t as g}from"./confirm-dialog-DbNUkFt6.js";import{t as _}from"./notice-G5Imd5pC.js";import{t as v}from"./tag-BadGF3FB.js";import{t as y}from"./input-CwdmSRlD.js";import{t as b}from"./toggle-_vZlLDBV.js";import{n as x}from"./toast-DLWkiWW6.js";import{t as S}from"./chevron-right-Cu9YGUrb.js";import{t as C}from"./loader-circle-CdxxVJvk.js";import{t as w}from"./pencil-BqT-WChe.js";import{t as T}from"./x-Bmx5Uey2.js";import{n as E,r as D,t as O}from"./api-errors-DbHkbHFH.js";import{C as k,S as A,T as ee,b as te,d as j,k as ne,r as re,w as ie,x as ae,y as oe}from"./auth-store-CdoTCJgP.js";import{t as M}from"./client.gen-ZHFX_7TH.js";import{t as se}from"./sdk.gen-DlgJKwWW.js";import{t as ce}from"./assistant-feature-flag-store-ClCVaYet.js";import{Bt as le,D as ue,Ft as de,It as N,Ki as fe,O as P,Ot as pe,Pt as me,Rt as he,dn as ge,fn as _e,g as ve,h as F,k as ye,m as I,na as L,p as R,po as be,ra as xe,v as Se,zt as Ce}from"./index-CEhiJItI.js";import{t as z}from"./use-active-assistant-id-BFElIHKJ.js";import{t as B}from"./detail-card-B1B2dCt-.js";var V=e(o(),1),H=[`no_one`,`guardian_only`,`trusted_contacts`,`any_contact`,`strangers`],we=new Set([`platform`,`a2a`]),Te=new Set([`vellum`,`whatsapp`]);function Ee(e){return Te.has(e)}var De={no_one:`No one (kill switch)`,guardian_only:`Guardian only`,trusted_contacts:`Trusted contacts`,any_contact:`Any contact`,strangers:`Strangers`},Oe={no_one:`Hard-deny every inbound message on this channel.`,guardian_only:`Only messages from the guardian are admitted.`,trusted_contacts:`Admit verified contacts and the guardian; deny everyone else.`,any_contact:`Admit any matched contact (verified or pending) and the guardian.`,strangers:`Admit everyone, including unrecognised senders.`};function ke(e){return typeof e==`string`&&H.includes(e)}function U(e){return we.has(e)}async function Ae(e){let{data:t,error:n,response:r}=await M.get({url:`/v1/assistants/{assistant_id}/channel-admission-policy/`,path:{assistant_id:e},throwOnError:!1});if(E(r,n,`Failed to load channel policies.`),!r.ok)throw new O(r.status,D(n,r,`Failed to load channel policies.`));return(t?.policies??[]).filter(e=>!U(e.channelType)&&!Ee(e.channelType)).map(e=>({...e,policy:ke(e.policy)?e.policy:`trusted_contacts`}))}async function je(e,t,n,r){if(U(t))throw new O(403,`Channel "${t}" is internal and is not user-configurable.`);let{data:i,error:a,response:o}=await M.put({url:`/v1/assistants/{assistant_id}/channel-admission-policy/{channel_type}`,path:{assistant_id:e,channel_type:t},body:{policy:n,note:r??null},headers:{"Content-Type":`application/json`},throwOnError:!1});if(E(o,a,`Failed to save channel policy.`),!o.ok)throw new O(o.status,D(a,o,`Failed to save channel policy.`));if(!i?.policy)throw new O(500,`Gateway returned no policy in response.`);return i.policy}var W=f(),Me=H.map(e=>({value:e,label:De[e]}));function G(e){return{telegram:`Telegram`,phone:`Phone / SMS`,whatsapp:`WhatsApp`,slack:`Slack`,email:`Email`}[e]??e.charAt(0).toUpperCase()+e.slice(1)}function Ne(){let e=z(),[t,n]=(0,V.useState)(null),[r,i]=(0,V.useState)(!0),[a,o]=(0,V.useState)(null),[s,c]=(0,V.useState)(null),[l,u]=(0,V.useState)(null),d=(0,V.useCallback)(async()=>{i(!0),o(null);try{n(await Ae(e))}catch(e){o(e instanceof O?e.message:`Failed to load channel policies.`)}finally{i(!1)}},[e]);(0,V.useEffect)(()=>{d()},[d]);let f=(0,V.useCallback)(async(t,r)=>{c(t),o(null),n(e=>e&&e.map(e=>e.channelType===t?{...e,policy:r}:e));try{let i=await je(e,t,r);n(e=>e&&e.map(e=>e.channelType===t?i:e))}catch(e){o(e instanceof O?e.message:`Failed to save channel policy.`),await d()}finally{c(null)}},[e,d]),p=(0,V.useCallback)((e,t)=>{if(t===`no_one`){u({channelType:e,label:G(e)});return}f(e,t)},[f]),_=(0,V.useCallback)(()=>{if(!l)return;let{channelType:e}=l;u(null),f(e,`no_one`)},[l,f]),v=(0,V.useCallback)(()=>{u(null)},[]),y=(0,V.useMemo)(()=>t??[],[t]);return(0,W.jsxs)(m,{children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,W.jsx)(xe,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Channel Trust Floors`}),(0,W.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Choose who can reach the assistant on each channel. Internal channels are managed automatically and not shown here.`})]})]}),a&&(0,W.jsx)(`div`,{role:`alert`,className:`mt-4 rounded-md border border-[var(--border-negative)] bg-[var(--surface-negative-subtle)] px-3 py-2 text-body-small-default text-[var(--content-negative)]`,children:a}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-3`,"data-testid":`channel-policy-list`,children:[r&&!t&&(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Loading…`}),!r&&y.length===0&&(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`No client-controllable channels found.`}),y.map(e=>(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,"data-testid":`channel-policy-row-${e.channelType}`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:G(e.channelType)}),(0,W.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:Oe[e.policy]})]}),(0,W.jsx)(`div`,{style:{minWidth:220},children:(0,W.jsx)(h,{value:e.policy,onChange:t=>p(e.channelType,t),options:Me,disabled:s===e.channelType,"aria-label":`Floor for ${G(e.channelType)}`,"data-testid":`channel-policy-dropdown-${e.channelType}`})})]},e.channelType))]}),(0,W.jsx)(g,{open:l!==null,title:`Block all inbound messages?`,message:l?`Setting ${l.label} to "No one" will hard-deny every inbound message on this channel. You can reverse this at any time.`:``,confirmLabel:`Block all`,destructive:!0,onConfirm:_,onCancel:v})]})}var K=[{id:`accessibility`,type:`system`,sourceKind:`accessibility`,label:`Accessibility`,description:`Allows your assistant to click, type, and control apps on your behalf.`},{id:`screen`,type:`system`,sourceKind:`screen`,label:`Screen Recording`,description:`Allows your assistant to capture screen context during computer-use tasks.`},{id:`microphone`,type:`system`,sourceKind:`microphone`,label:`Microphone`,description:`Allows your assistant to capture audio for voice input and recordings.`},{id:`speechRecognition`,type:`system`,sourceKind:`speechRecognition`,label:`Speech Recognition`,description:`Allows your assistant to transcribe your speech into text on-device.`},{id:`notifications`,type:`system`,sourceKind:`notifications`,label:`Notifications`,description:`Allows your assistant to send macOS alerts for approvals, messages, and task updates.`}],Pe=[{id:`notificationBadges`,type:`local`,label:`Notification Badges`,description:`Allows your assistant to show unseen conversation counts on the Dock icon.`}];function Fe(){let[e,t]=(0,V.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function Ie(){let[e,r]=(0,V.useState)(()=>n(`dockBadgesEnabled`,!0));return(0,V.useEffect)(()=>a(`dockBadgesEnabled`,()=>{r(n(`dockBadgesEnabled`,!0))}),[]),[e,e=>{r(e),t(`dockBadgesEnabled`,e),e||pe(0)}]}function Le({row:e,onToggle:t}){return(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,W.jsx)(b,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:p(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,W.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,W.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,W.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function Re(){return(0,W.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 ze({compact:e=!1}){let{state:t,loading:n,error:r,supported:i,refresh:a}=le(),{pendingKind:o,run:s}=Fe(),[c,l]=Ie(),u=(0,V.useMemo)(()=>{let e=new Map;if(!t)return e;for(let n of K){let r=t[n.sourceKind];r&&e.set(n.id,{meta:n,item:r})}return e},[t]),d=(0,V.useMemo)(()=>{let e=K.map(e=>{let t=u.get(e.id)?.item;return t?{id:e.id,label:e.label,description:e.description,checked:t.status===`granted`,disabled:o===e.id||t.status===`restricted`,...t.error?{error:t.error}:{}}:null}).filter(Boolean),t=Pe.map(e=>({id:e.id,label:e.label,description:e.description,checked:c,disabled:o===e.id}));return[...e,...t]},[c,o,u]);if(!i)return null;let f=async(e,t)=>{t.status===`granted`||t.status===`denied`||!t.canRequest?await he(e.sourceKind):await Ce(e.sourceKind),await a()},p=e=>{let t=u.get(e);if(t){s(e,()=>f(t.meta,t.item));return}e===`notificationBadges`&&s(e,async()=>{l(!c)})};return(0,W.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,W.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:`System Permissions`}),n&&d.length===0?(0,W.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,W.jsx)(Re,{}),`Checking permissions...`]}):(0,W.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,W.jsx)(Le,{row:e,onToggle:p},e.id))}),r&&(0,W.jsx)(`div`,{role:`alert`,className:`mt-6 rounded-lg 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:r})]})}function Be(){let e=N({platformHostedOnly:!0}),t=me(),n=de(),r=l(),{data:i,isLoading:a,isError:o}=u({...ge(),enabled:e===`full`&&t}),s=d({mutationFn:async e=>{let{data:t}=await se({body:{access_consented:e},throwOnError:!0});return t},onSuccess:e=>{_e(r,void 0,e),x.success(e?.access_consented?`Admin data access enabled.`:`Admin data access disabled.`)},onError:()=>{x.error(`Failed to update log access consent.`)}});if(e===`gated`)return null;let c=e===`full`&&n,f=i?.access_consented??!1,p=e!==`full`||!t||a||o||s.isPending;return(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Allow admin access to assistant data`}),(0,W.jsxs)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:[`Lets Vellum administrators reach privileged data on your assistant pod for debugging — today this means tailing the daily assistant log at`,` `,(0,W.jsx)(`code`,{className:`rounded bg-[var(--surface-base)] px-1.5 font-mono text-[var(--content-secondary)] dark:bg-[var(--surface-lift)] dark:text-[var(--content-default)]`,children:`/workspace/data/logs/assistant-YYYY-MM-DD.log`}),`. Off by default. Turn on temporarily when asking support to investigate an issue, then turn off when you're done.`]}),e===`full`&&o&&(0,W.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:`Failed to load consent setting.`})]}),(0,W.jsx)(`div`,{className:`flex items-center gap-2`,children:e===`disabled`?null:(0,W.jsxs)(W.Fragment,{children:[(s.isPending||c)&&(0,W.jsx)(C,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,W.jsx)(b,{checked:f,disabled:p,onChange:()=>s.mutate(!f)})]})})]}),e===`disabled`&&(0,W.jsx)(Se,{className:`mt-3`,children:`Log in to the Vellum platform to manage admin data access.`})]})}function Ve(){let e=ne(),[t,n]=(0,V.useState)(()=>A()),[r,i]=(0,V.useState)(!1),[a,o]=(0,V.useState)(`Face ID`),[s,c]=(0,V.useState)(!1);if((0,V.useEffect)(()=>{e&&(ae().then(i),te().then(o))},[e]),!e||!r)return null;let l=async()=>{c(!0);try{if(t)k(!1),await oe(),n(!1);else{let e=ee();e&&await ie(e),k(!0),n(!0)}}finally{c(!1)}};return(0,W.jsx)(B,{title:`Security`,children:(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsxs)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Use `,a,` for sign-in`]}),(0,W.jsxs)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:[`When your session expires, verify with `,a,` or your device passcode instead of signing in again.`]})]}),(0,W.jsx)(b,{checked:t,onChange:()=>void l(),disabled:s})]})})}function q(){return(0,W.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}var J=R.map(e=>({value:e.id,label:e.label,icon:(0,W.jsx)(e.icon,{className:`h-3.5 w-3.5`})}));function He(){let e=z(),t=l(),{data:n,isError:r}=u({queryKey:[`thresholds`,e],queryFn:()=>F(e),staleTime:3e4}),[i,a]=(0,V.useState)(`relaxed`),[o,s]=(0,V.useState)(`conservative`),[c,d]=(0,V.useState)(`strict`),[f,p]=(0,V.useState)(!1),g=(0,V.useRef)(!1),[_,v]=(0,V.useState)(!1),y=(0,V.useRef)(null),b=(0,V.useRef)(null);(0,V.useEffect)(()=>{!n||g.current||(a(I(n.interactive).id),s(I(n.autonomous).id),d(I(n.headless).id),v(!0))},[n]),(0,V.useEffect)(()=>()=>{y.current!==null&&(clearTimeout(y.current),y.current=null,b.current?.(),b.current=null)},[]);let x=(0,V.useCallback)((n,r,i)=>{if(!e||!_)return;let a=R.find(e=>e.id===n)?.riskThreshold,o=R.find(e=>e.id===r)?.riskThreshold,s=R.find(e=>e.id===i)?.riskThreshold;!a||!o||!s||ve(e,{interactive:a,autonomous:o,headless:s}).then(()=>{t.invalidateQueries({queryKey:[`thresholds`,e]})}).catch(()=>{})},[e,_,t]),C=(0,V.useCallback)((e,t,n)=>{y.current!==null&&clearTimeout(y.current),b.current=()=>x(e,t,n),y.current=setTimeout(()=>{b.current?.(),y.current=null,b.current=null},500)},[x]),w=(0,V.useCallback)(e=>{g.current=!0,a(e),C(e,o,c)},[o,c,C]),T=(0,V.useCallback)(e=>{g.current=!0,s(e),C(i,e,c)},[i,c,C]),E=(0,V.useCallback)(e=>{g.current=!0,d(e),C(i,o,e)},[i,o,C]),D=R.find(e=>e.id===i),O=R.find(e=>e.id===o),k=R.find(e=>e.id===c),A=!e||!_;return(0,W.jsxs)(m,{children:[(0,W.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Risk Tolerance`}),(0,W.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Control which actions your assistant can take without asking first. Each action is classified by risk level — your tolerance determines which levels auto-approve.`}),r&&(0,W.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--system-negative-strong)]`,children:`Could not load threshold settings. Check your connection and reload.`}),(0,W.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Conversations`}),(0,W.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When you're chatting with your assistant directly.`}),(0,W.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,W.jsx)(h,{value:i,onChange:w,options:J,disabled:A})}),D&&(0,W.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:D.description})]}),(0,W.jsx)(q,{}),(0,W.jsxs)(`div`,{children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>p(e=>!e),className:`flex items-center gap-1 text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,"aria-expanded":f,children:[f?(0,W.jsx)(be,{className:`h-4 w-4`}):(0,W.jsx)(S,{className:`h-4 w-4`}),(0,W.jsx)(`span`,{className:`text-body-medium-default`,children:`Advanced`})]}),(0,W.jsxs)(`div`,{className:f?`mt-4 space-y-4`:`hidden`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Background`}),(0,W.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When your assistant acts without you — scheduled tasks, background jobs, and external triggers.`}),(0,W.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,W.jsx)(h,{value:o,onChange:T,options:J,disabled:A})}),O&&(0,W.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:O.description})]}),(0,W.jsx)(q,{}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Headless`}),(0,W.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When triggered externally with no interactive client.`}),(0,W.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,W.jsx)(h,{value:c,onChange:E,options:J,disabled:A})}),k&&(0,W.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:k.description})]})]})]})]})]})}var Y=e(s(),1),Ue=[`bash`,`file_read`,`file_write`,`file_edit`,`web_fetch`,`skill_load`],We=[{value:`low`,label:`Low`,description:`Auto-approve without prompting`},{value:`medium`,label:`Medium`,description:`Prompt before executing`},{value:`high`,label:`High`,description:`Always require explicit approval`}];function X({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let i=(0,V.useRef)(null),[a,o]=(0,V.useState)(t.tool),[s,c]=(0,V.useState)(t.pattern),[l,u]=(0,V.useState)(t.risk),[d,f]=(0,V.useState)(t.description??``),[p,m]=(0,V.useState)(!1),[g,v]=(0,V.useState)(null),b=s.trim(),x=b.length>0&&!p,S=(0,V.useCallback)(async n=>{if(n.preventDefault(),!x)return;let i=d.trim()||`${a} — ${b}`;m(!0),v(null);try{await ye(e,t.id,{risk:l,description:i}),r()}catch(e){v(e instanceof Error?e.message:`Failed to save trust rule.`)}finally{m(!1)}},[e,x,d,t,r,l,a,b]);return(0,Y.createPortal)((0,W.jsx)(`div`,{ref:i,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,V.useCallback)(e=>{e.key===`Escape`&&n()},[n]),onClick:(0,V.useCallback)(e=>{e.target===i.current&&n()},[n]),children:(0,W.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,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,W.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Edit Trust Rule`}),(0,W.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Close`,className:`rounded-lg p-1.5 text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-base)] hover:text-[var(--content-default)]`,children:(0,W.jsx)(T,{className:`h-4 w-4`})})]}),(0,W.jsxs)(`form`,{onSubmit:e=>void S(e),className:`min-h-0 flex-1 space-y-4 overflow-y-auto px-6 py-4`,children:[g&&(0,W.jsx)(_,{tone:`error`,children:g}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`Tool`}),(0,W.jsx)(`div`,{className:`mt-1`,children:(0,W.jsx)(h,{value:a,onChange:o,disabled:!0,options:Ue.map(e=>({value:e,label:e}))})})]}),(0,W.jsx)(y,{label:`Pattern`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g., git *`,disabled:!0}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Risk Level`}),(0,W.jsx)(`div`,{className:`mt-2 flex gap-2`,children:We.map(e=>(0,W.jsxs)(`button`,{type:`button`,onClick:()=>u(e.value),className:`flex-1 rounded-lg border px-3 py-2 text-left text-body-small-default transition-colors ${l===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,W.jsx)(`div`,{children:e.label}),(0,W.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,W.jsx)(y,{label:`Description (optional)`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`${a} — ${b||`pattern`}`}),(0,W.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,W.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:`Cancel`}),(0,W.jsx)(`button`,{type:`submit`,disabled:!x,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:p?`Saving…`:`Save`})]})]})]})}),document.body)}function Ge(e){return e.origin===`default`&&!e.userModified}function Ke(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 qe(e){switch(e){case`low`:return`positive`;case`medium`:return`warning`;case`high`:return`negative`}}function Z(e){return e.charAt(0).toUpperCase()+e.slice(1)}function Je({assistantId:e,onClose:t}){let n=(0,V.useRef)(null),[r,i]=(0,V.useState)([]),[a,o]=(0,V.useState)(!0),[s,l]=(0,V.useState)(null),[u,d]=(0,V.useState)(null),[f,p]=(0,V.useState)(null),[m,h]=(0,V.useState)(!1),y=(0,V.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([P(e),P(e,{origin:`default`})]);return Ke(t,n)}return P(e)},[e]),x=(0,V.useCallback)(async()=>{o(!0);try{i(await y(m)),l(null)}catch(e){l(e instanceof Error?e.message:`Failed to load trust rules.`)}finally{o(!1)}},[y,m]);(0,V.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let t=await y(m);e||(i(t),l(null))}catch(t){e||l(t instanceof Error?t.message:`Failed to load trust rules.`)}finally{e||o(!1)}})(),()=>{e=!0}},[y,m]);let S=(0,V.useCallback)(async()=>{if(f)try{await ue(e,f.id),x()}catch(e){l(e instanceof Error?e.message:`Failed to delete trust rule.`)}finally{p(null)}},[e,f,x]);return(0,Y.createPortal)((0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`div`,{ref:n,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,V.useCallback)(e=>{e.key===`Escape`&&t()},[t]),onClick:(0,V.useCallback)(e=>{e.target===n.current&&t()},[t]),children:(0,W.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,W.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,W.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,W.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,W.jsx)(b,{checked:m,onChange:h,label:`Show all defaults`}),(0,W.jsx)(c,{variant:`outlined`,onClick:t,children:`Done`})]})]}),(0,W.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[s&&(0,W.jsx)(`div`,{className:`mb-3`,children:(0,W.jsx)(_,{tone:`error`,children:s})}),a?(0,W.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`}):r.length===0?(0,W.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,W.jsx)(L,{className:`h-8 w-8`}),(0,W.jsx)(`p`,{className:`max-w-xs text-center text-body-medium-lighter`,children:`No trust rules yet. Rules are created when you classify actions from permission prompts.`})]}):(0,W.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(e=>{let t=Ge(e);return(0,W.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,W.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,W.jsx)(v,{tone:qe(e.risk),children:Z(e.risk)}),e.origin===`default`&&(0,W.jsx)(v,{tone:`neutral`,children:`Default`}),e.userModified&&(0,W.jsx)(v,{tone:`warning`,children:`Modified`})]}),(0,W.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,W.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.tool} rule`,onClick:()=>d(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,W.jsx)(w,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,W.jsx)(`button`,{type:`button`,"aria-label":`Delete ${e.tool} rule`,onClick:()=>p(e),className:`rounded-lg p-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:(0,W.jsx)(fe,{className:`h-4 w-4`})})]})]},e.id)})})]})]})}),u&&(0,W.jsx)(X,{assistantId:e,existingRule:u,onClose:()=>d(null),onSaved:()=>{d(null),x()}}),(0,W.jsx)(g,{open:f!==null,title:`Delete Trust Rule?`,message:f?`Remove the ${Z(f.risk).toLowerCase()}-risk rule for ${f.tool} matching "${f.pattern}"?`:``,confirmLabel:`Delete`,cancelLabel:`Cancel`,destructive:!0,onConfirm:()=>void S(),onCancel:()=>p(null)})]}),document.body)}function Ye(){let e=z(),[t,n]=(0,V.useState)(!1);return(0,W.jsxs)(m,{children:[(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,W.jsx)(L,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,W.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Manage per-tool rules that control which actions auto-approve and which require your explicit permission.`})]}),(0,W.jsx)(c,{variant:`outlined`,onClick:()=>n(!0),children:`Manage`})]}),t&&(0,W.jsx)(Je,{assistantId:e,onClose:()=>n(!1)})]})}var Xe=[{value:`dontRetain`,label:`Don't retain`},{value:`oneHour`,label:`1 hour`},{value:`oneDay`,label:`1 day`},{value:`sevenDays`,label:`7 days`},{value:`thirtyDays`,label:`30 days`},{value:`ninetyDays`,label:`90 days`},{value:`keepForever`,label:`Keep forever`}],Ze=`thirtyDays`;function Q({label:e,helperText:t,checked:n,onChange:r}){return(0,W.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,W.jsxs)(`div`,{className:`flex-1`,children:[(0,W.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e}),(0,W.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,W.jsx)(b,{checked:n,onChange:r,label:e})]})}function $(){return(0,W.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Qe(){let e=N({platformHostedOnly:!0}),t=ce.use.channelTrustFloors(),a=re(),[o,s]=(0,V.useState)(()=>n(`shareAnalytics`,!0)),[c,l]=(0,V.useState)(()=>n(`shareDiagnostics`,!0)),[u,d]=(0,V.useState)(()=>i(`llmLogRetention`,Ze));return(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(Ve,{}),(0,W.jsx)(ze,{}),(0,W.jsx)(Ye,{}),t&&(0,W.jsx)(Ne,{}),(0,W.jsx)(He,{}),(0,W.jsx)(B,{title:`Privacy`,children:(0,W.jsxs)(`div`,{className:`space-y-4`,children:[(0,W.jsx)(Q,{label:`Share Analytics`,helperText:`Send anonymous product usage data. Your conversations and personal data are never included.`,checked:o,onChange:()=>{let e=!o;s(e),j(`share_analytics`,e,a)}}),(0,W.jsx)($,{}),(0,W.jsx)(Q,{label:`Share Diagnostics`,helperText:`Send crash reports and performance metrics. Your conversations and personal data are never included.`,checked:c,onChange:()=>{let e=!c;l(e),j(`share_diagnostics`,e,a)}}),(0,W.jsx)($,{}),(0,W.jsx)(Be,{}),e!==`gated`&&(0,W.jsx)($,{}),(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`LLM Request Log Retention`}),(0,W.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,W.jsx)(h,{value:u,onChange:e=>{d(e),r(`llmLogRetention`,e)},options:Xe})}),(0,W.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:`How long to keep LLM request and response logs on this device. These logs record the prompts and completions sent to model providers and are used for debugging. Shorter retention improves privacy; longer retention helps troubleshoot issues.`})]})]})})]})}export{Qe as PrivacyPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-BibIM9x3.js";import{t as s}from"./checkbox-Dc9gjmAy.js";import{t as c}from"./toggle-_vZlLDBV.js";import{t as l}from"./is-electron-BuSDabCt.js";import{k as u,n as d,r as f,u as p}from"./auth-store-CdoTCJgP.js";import{a as m,i as h}from"./routes-BnbYm-Mr.js";import{a as g,c as _,o as v,s as y}from"./prefs-BXOW-ziM.js";import{t as b}from"./client-feature-flag-store-DZMwD6Gv.js";import{dt as x,qa as S}from"./index-BsySSmys.js";import{a as C,c as w,i as T,n as E,o as D,t as O}from"./step-indicator-dots-DBUcB0lL.js";var k=e(t(),1),A=a();function j({label:e,helperText:t,checked:n,onChange:r}){let i=(0,k.useId)();return(0,A.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,A.jsx)(c,{checked:n,onChange:r,id:i}),(0,A.jsxs)(`label`,{htmlFor:i,className:`min-w-0 flex-1 cursor-pointer`,children:[(0,A.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:e}),(0,A.jsx)(`span`,{className:`mt-1 block text-body-small-default text-[var(--content-tertiary)]`,children:t})]})]})}var M=`[&_button[data-state=checked]]:bg-[var(--primary-base)] [&_svg]:text-[var(--content-inset)]`;function N(){let e=r(),[t]=i(),a=d.use.user()?.id??null,c=l(),N=u(),P=D(b.use.stringFlags().preChatOnboardingExperiment20260606??`control`),[F,I]=v(),[L,R]=y(),[z,B]=_(),[V,H]=g(),U=f();(0,k.useEffect)(()=>{N||C()},[N]);let W=t.get(`preview`)===`true`,G=(0,k.useCallback)(e=>{},[]),K=W?G:I,q=W?G:R,J=W?G:B,Y=W?G:H,X=(0,k.useCallback)(()=>{if(W){e(`${m.onboarding.prechat}?preview=true`);return}if(p({userId:a,tos:z,ai:V,shareAnalytics:F,shareDiagnostics:L,hasPlatformSession:U}),!N){let e=w(P);T(E.privacyTos,{userId:a,variant:e})}let n=t.get(`hosting`),r=new URLSearchParams;n&&r.set(`hosting`,n);let i=r.toString();e(`${m.onboarding.hatching}${i?`?${i}`:``}`)},[V,U,N,W,e,P,t,F,L,z,a]),Z=(0,A.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,A.jsx)(`a`,{href:h(m.docs.legal.termsOfUse),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Terms of Service`}),` `,`and`,` `,(0,A.jsx)(`a`,{href:h(m.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Privacy Policy`})]}),Q=(0,A.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,A.jsx)(`a`,{href:h(m.docs.legal.dataSharing),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`AI Data Sharing Policy`})]});return(0,A.jsx)(x,{children:(0,A.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:[N&&(0,A.jsx)(`div`,{className:`mb-8 flex w-full justify-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:(0,A.jsx)(O,{current:2,total:3})}),(0,A.jsx)(`h1`,{className:c?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Before You Start`}),(0,A.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:`Choose your privacy preferences. You can update these anytime in the Settings.`}),(0,A.jsx)(o,{padding:c?`sm`:`md`,className:`mt-8 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:(0,A.jsxs)(`div`,{className:`flex flex-col ${c?`gap-3`:`gap-4`}`,children:[(0,A.jsx)(j,{label:`Share Analytics`,helperText:`Send anonymous product usage data.`,checked:F,onChange:K}),(0,A.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`}),(0,A.jsx)(j,{label:`Share Diagnostics`,helperText:`Send crash reports and performance metrics.`,checked:L,onChange:q}),(0,A.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,A.jsx)(S,{className:`h-4 w-4 shrink-0`}),(0,A.jsx)(`span`,{children:`Your conversations and personal data are never included.`})]})]})}),(0,A.jsx)(`div`,{className:`flex w-full items-start ${c?`mt-4`:`mt-6`}`,style:{animation:`fadeInUp 0.5s ease-out 0.45s both`},children:(0,A.jsx)(s,{checked:V,onCheckedChange:e=>Y(e===!0),label:Q,"aria-label":`I agree to the AI Data Sharing Policy`,className:M})}),(0,A.jsx)(`div`,{className:`flex w-full items-start ${c?`mt-2`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:(0,A.jsx)(s,{checked:z,onCheckedChange:e=>J(e===!0),label:Z,"aria-label":`I agree to the Terms of Service and Privacy Policy`,className:M})}),(0,A.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,A.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!z||!V,onClick:X,className:c?void 0:`h-11 text-base`,children:`Start`}),(0,A.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>e(-1),className:c?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{N as PrivacyScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./card-BibIM9x3.js";import{t as s}from"./checkbox-Dc9gjmAy.js";import{t as c}from"./toggle-_vZlLDBV.js";import{t as l}from"./is-electron-BuSDabCt.js";import{k as u,n as d,r as f,u as p}from"./auth-store-CdoTCJgP.js";import{a as m,i as h}from"./routes-BnbYm-Mr.js";import{a as g,c as _,o as v,s as y}from"./prefs-BXOW-ziM.js";import{t as b}from"./client-feature-flag-store-DZMwD6Gv.js";import{dt as x,qa as S}from"./index-CEhiJItI.js";import{a as C,c as w,i as T,n as E,o as D,t as O}from"./step-indicator-dots-BlU3rKYn.js";var k=e(t(),1),A=a();function j({label:e,helperText:t,checked:n,onChange:r}){let i=(0,k.useId)();return(0,A.jsxs)(`div`,{className:`flex items-start gap-4`,children:[(0,A.jsx)(c,{checked:n,onChange:r,id:i}),(0,A.jsxs)(`label`,{htmlFor:i,className:`min-w-0 flex-1 cursor-pointer`,children:[(0,A.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:e}),(0,A.jsx)(`span`,{className:`mt-1 block text-body-small-default text-[var(--content-tertiary)]`,children:t})]})]})}var M=`[&_button[data-state=checked]]:bg-[var(--primary-base)] [&_svg]:text-[var(--content-inset)]`;function N(){let e=r(),[t]=i(),a=d.use.user()?.id??null,c=l(),N=u(),P=D(b.use.stringFlags().preChatOnboardingExperiment20260606??`control`),[F,I]=v(),[L,R]=y(),[z,B]=_(),[V,H]=g(),U=f();(0,k.useEffect)(()=>{N||C()},[N]);let W=t.get(`preview`)===`true`,G=(0,k.useCallback)(e=>{},[]),K=W?G:I,q=W?G:R,J=W?G:B,Y=W?G:H,X=(0,k.useCallback)(()=>{if(W){e(`${m.onboarding.prechat}?preview=true`);return}if(p({userId:a,tos:z,ai:V,shareAnalytics:F,shareDiagnostics:L,hasPlatformSession:U}),!N){let e=w(P);T(E.privacyTos,{userId:a,variant:e})}let n=t.get(`hosting`),r=new URLSearchParams;n&&r.set(`hosting`,n);let i=r.toString();e(`${m.onboarding.hatching}${i?`?${i}`:``}`)},[V,U,N,W,e,P,t,F,L,z,a]),Z=(0,A.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,A.jsx)(`a`,{href:h(m.docs.legal.termsOfUse),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Terms of Service`}),` `,`and`,` `,(0,A.jsx)(`a`,{href:h(m.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Privacy Policy`})]}),Q=(0,A.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,A.jsx)(`a`,{href:h(m.docs.legal.dataSharing),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`AI Data Sharing Policy`})]});return(0,A.jsx)(x,{children:(0,A.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:[N&&(0,A.jsx)(`div`,{className:`mb-8 flex w-full justify-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:(0,A.jsx)(O,{current:2,total:3})}),(0,A.jsx)(`h1`,{className:c?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Before You Start`}),(0,A.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:`Choose your privacy preferences. You can update these anytime in the Settings.`}),(0,A.jsx)(o,{padding:c?`sm`:`md`,className:`mt-8 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:(0,A.jsxs)(`div`,{className:`flex flex-col ${c?`gap-3`:`gap-4`}`,children:[(0,A.jsx)(j,{label:`Share Analytics`,helperText:`Send anonymous product usage data.`,checked:F,onChange:K}),(0,A.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`}),(0,A.jsx)(j,{label:`Share Diagnostics`,helperText:`Send crash reports and performance metrics.`,checked:L,onChange:q}),(0,A.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`}),(0,A.jsxs)(`div`,{className:`flex items-center gap-2 text-body-small-default text-[var(--content-tertiary)]`,children:[(0,A.jsx)(S,{className:`h-4 w-4 shrink-0`}),(0,A.jsx)(`span`,{children:`Your conversations and personal data are never included.`})]})]})}),(0,A.jsx)(`div`,{className:`flex w-full items-start ${c?`mt-4`:`mt-6`}`,style:{animation:`fadeInUp 0.5s ease-out 0.45s both`},children:(0,A.jsx)(s,{checked:V,onCheckedChange:e=>Y(e===!0),label:Q,"aria-label":`I agree to the AI Data Sharing Policy`,className:M})}),(0,A.jsx)(`div`,{className:`flex w-full items-start ${c?`mt-2`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:(0,A.jsx)(s,{checked:z,onCheckedChange:e=>J(e===!0),label:Z,"aria-label":`I agree to the Terms of Service and Privacy Policy`,className:M})}),(0,A.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,A.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!z||!V,onClick:X,className:c?void 0:`h-11 text-base`,children:`Start`}),(0,A.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>e(-1),className:c?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{N as PrivacyScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-B7QmSjOI.js";import{t as n}from"./react-DJZBPgpf.js";import{d as r,h as i,t as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{d as s,x as c}from"./local-mode-Bvz5B1q8.js";import{N as l,R as u,c as d,n as f}from"./auth-store-CdoTCJgP.js";import{c as p}from"./api-DFmFVk24.js";import{a as m}from"./routes-BnbYm-Mr.js";import{a as h,i as g}from"./login-flow-Bwe9IeSu.js";import{n as _}from"./index-BsySSmys.js";import{r as v,t as y}from"./account-shell-DblhUTJ5.js";var b=e(n(),1),x=o();function S(){let[e]=i(),n=r(),o=f.use.refreshSession(),S=e.get(`error`),[C,w]=(0,b.useState)(null),T=(0,b.useRef)(!1),E=e.get(`returnTo`),D=g(e);return(0,b.useEffect)(()=>{T.current||S||(T.current=!0,(async()=>{try{let t=await u(),r=l(t.ok&&!!t.data.user,t.ok?[]:t.flows??[]);switch(r.kind){case`authenticated`:{if(await o(),s())try{let e=await p();if(e.ok&&e.data.length>0&&(await c(e.data,d.getState().currentOrganizationId??void 0),!E)){n(m.assistant,{replace:!0});break}}catch{}let e=m.assistant,{destination:t,requiresFullPageNavigation:r}=h({returnTo:E,fallback:e,authIntent:D});r?window.location.href=t:n(t,{replace:!0});break}case`provider_signup`:{let t=e.get(`returnTo`);n(t?`${m.account.providerSignup}?returnTo=${encodeURIComponent(t)}`:m.account.providerSignup,{replace:!0});break}case`error`:w(r.message);break}}catch(e){t(e,{context:`provider_callback`}),w(`Something went wrong. Please try signing in again.`)}})())},[D,S,o,E,n,e]),S===`signup_closed`?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Signups are currently closed`,subtitle:`Join the community to request access or learn when signups reopen.`}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Join the community`}),(0,x.jsx)(a,{to:m.account.login,className:`text-sm font-medium text-[var(--content-emphasised)] hover:underline`,children:`Back to sign in`})]})]}):S||C?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Authentication failed`,subtitle:C??`Something went wrong during social sign-in. Please try again or use a different method.`}),(0,x.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,x.jsx)(a,{to:m.account.login,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Back to sign in`})})]}):(0,x.jsx)(y,{children:(0,x.jsx)(v,{title:`Completing sign-in...`,subtitle:`Please wait while we finish authenticating you.`})})}export{S as ProviderCallbackPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-B7QmSjOI.js";import{t as n}from"./react-DJZBPgpf.js";import{d as r,h as i,t as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{d as s,x as c}from"./local-mode-Bvz5B1q8.js";import{N as l,R as u,c as d,n as f}from"./auth-store-CdoTCJgP.js";import{c as p}from"./api-DFmFVk24.js";import{a as m}from"./routes-BnbYm-Mr.js";import{a as h,i as g}from"./login-flow-Bwe9IeSu.js";import{n as _}from"./index-CEhiJItI.js";import{r as v,t as y}from"./account-shell-DblhUTJ5.js";var b=e(n(),1),x=o();function S(){let[e]=i(),n=r(),o=f.use.refreshSession(),S=e.get(`error`),[C,w]=(0,b.useState)(null),T=(0,b.useRef)(!1),E=e.get(`returnTo`),D=g(e);return(0,b.useEffect)(()=>{T.current||S||(T.current=!0,(async()=>{try{let t=await u(),r=l(t.ok&&!!t.data.user,t.ok?[]:t.flows??[]);switch(r.kind){case`authenticated`:{if(await o(),s())try{let e=await p();if(e.ok&&e.data.length>0&&(await c(e.data,d.getState().currentOrganizationId??void 0),!E)){n(m.assistant,{replace:!0});break}}catch{}let e=m.assistant,{destination:t,requiresFullPageNavigation:r}=h({returnTo:E,fallback:e,authIntent:D});r?window.location.href=t:n(t,{replace:!0});break}case`provider_signup`:{let t=e.get(`returnTo`);n(t?`${m.account.providerSignup}?returnTo=${encodeURIComponent(t)}`:m.account.providerSignup,{replace:!0});break}case`error`:w(r.message);break}}catch(e){t(e,{context:`provider_callback`}),w(`Something went wrong. Please try signing in again.`)}})())},[D,S,o,E,n,e]),S===`signup_closed`?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Signups are currently closed`,subtitle:`Join the community to request access or learn when signups reopen.`}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Join the community`}),(0,x.jsx)(a,{to:m.account.login,className:`text-sm font-medium text-[var(--content-emphasised)] hover:underline`,children:`Back to sign in`})]})]}):S||C?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Authentication failed`,subtitle:C??`Something went wrong during social sign-in. Please try again or use a different method.`}),(0,x.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,x.jsx)(a,{to:m.account.login,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Back to sign in`})})]}):(0,x.jsx)(y,{children:(0,x.jsx)(v,{title:`Completing sign-in...`,subtitle:`Please wait while we finish authenticating you.`})})}export{S as ProviderCallbackPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,r as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{a as o}from"./routes-BnbYm-Mr.js";import{t as s}from"./client-feature-flag-store-DZMwD6Gv.js";import{t as c}from"./conversation-store-C-169WSa.js";import{ft as l,ln as u}from"./index-BsySSmys.js";var d=e(t(),1),f=a(),p=[{claim:`Software engineer based in Austin, TX`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Product engineer at an early-stage AI startup`,confidence:`confident`,sources:[`https://example.com/team`]},{claim:`Maintains an open-source CLI tool for local LLM evaluation and tooling`,confidence:`confident`,sources:[`https://github.com/example-dev`,`https://example.com/project`]},{claim:`Primarily writes TypeScript and Go`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Came up through a coding bootcamp rather than a CS degree`,confidence:`maybe`,sources:[]}],m=[`Summarize this week's AI model releases for me`,`Draft a technical blog post from your latest notes`,`Build a tracker for competitor product launches`,`Analyze a CSV of metrics and surface the trends`];function h(e){return`https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64`}function g(){let e=r(),t=s.use.researchOnboarding(),[a,g]=(0,d.useState)(`results`),[_,v]=(0,d.useState)(()=>new Map),[y,b]=(0,d.useState)(!1),x=p.map((e,t)=>({fact:e,index:t}));return t?(0,f.jsxs)(`div`,{className:`relative h-screen w-screen`,children:[(0,f.jsx)(`div`,{className:`absolute left-1/2 top-3 z-50 flex -translate-x-1/2 gap-1 rounded-full border border-[var(--border-base)] bg-[var(--surface-lift)] p-1`,children:[`loading`,`results`,`empty`].map(e=>(0,f.jsx)(n,{variant:a===e?`primary`:`ghost`,size:`compact`,onClick:()=>g(e),children:e},e))}),(0,f.jsx)(l,{mode:a,loadingContent:(0,f.jsxs)(`div`,{className:`text-[var(--content-secondary)]`,children:[(0,f.jsx)(`p`,{className:`text-lg`,children:`Getting to know you…`}),(0,f.jsx)(`p`,{className:`text-body-medium-lighter`,children:`(mock — the live flow shows the search activity feed here)`})]}),items:x,removals:_,suggestions:m,resultsTitle:`Here's what I know about you. You can remove any that aren't true:`,showDeeperDiveCard:!y,showSuggestions:y,canContinue:!0,resolveFavicon:h,onRemove:e=>v(t=>t.has(e)?t:new Map(t).set(e,null)),onSetReason:(e,t)=>v(n=>new Map(n).set(e,t)),onRestore:e=>v(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n}),onDeeperDive:()=>b(!0),onGoodForNow:()=>b(!0),onSuggestionClick:t=>{let n=u();c.getState().setActiveConversationId(n),e(`${o.conversation(n)}?prompt=${encodeURIComponent(t)}`)},onContinue:()=>e(o.assistant)})]}):(0,f.jsx)(i,{to:o.assistant,replace:!0})}export{g as ResearchMockPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,r as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{a as o}from"./routes-BnbYm-Mr.js";import{t as s}from"./client-feature-flag-store-DZMwD6Gv.js";import{t as c}from"./conversation-store-C-169WSa.js";import{ft as l,ln as u}from"./index-CEhiJItI.js";var d=e(t(),1),f=a(),p=[{claim:`Software engineer based in Austin, TX`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Product engineer at an early-stage AI startup`,confidence:`confident`,sources:[`https://example.com/team`]},{claim:`Maintains an open-source CLI tool for local LLM evaluation and tooling`,confidence:`confident`,sources:[`https://github.com/example-dev`,`https://example.com/project`]},{claim:`Primarily writes TypeScript and Go`,confidence:`confident`,sources:[`https://github.com/example-dev`]},{claim:`Came up through a coding bootcamp rather than a CS degree`,confidence:`maybe`,sources:[]}],m=[`Summarize this week's AI model releases for me`,`Draft a technical blog post from your latest notes`,`Build a tracker for competitor product launches`,`Analyze a CSV of metrics and surface the trends`];function h(e){return`https://www.google.com/s2/favicons?domain=${encodeURIComponent(e)}&sz=64`}function g(){let e=r(),t=s.use.researchOnboarding(),[a,g]=(0,d.useState)(`results`),[_,v]=(0,d.useState)(()=>new Map),[y,b]=(0,d.useState)(!1),x=p.map((e,t)=>({fact:e,index:t}));return t?(0,f.jsxs)(`div`,{className:`relative h-screen w-screen`,children:[(0,f.jsx)(`div`,{className:`absolute left-1/2 top-3 z-50 flex -translate-x-1/2 gap-1 rounded-full border border-[var(--border-base)] bg-[var(--surface-lift)] p-1`,children:[`loading`,`results`,`empty`].map(e=>(0,f.jsx)(n,{variant:a===e?`primary`:`ghost`,size:`compact`,onClick:()=>g(e),children:e},e))}),(0,f.jsx)(l,{mode:a,loadingContent:(0,f.jsxs)(`div`,{className:`text-[var(--content-secondary)]`,children:[(0,f.jsx)(`p`,{className:`text-lg`,children:`Getting to know you…`}),(0,f.jsx)(`p`,{className:`text-body-medium-lighter`,children:`(mock — the live flow shows the search activity feed here)`})]}),items:x,removals:_,suggestions:m,resultsTitle:`Here's what I know about you. You can remove any that aren't true:`,showDeeperDiveCard:!y,showSuggestions:y,canContinue:!0,resolveFavicon:h,onRemove:e=>v(t=>t.has(e)?t:new Map(t).set(e,null)),onSetReason:(e,t)=>v(n=>new Map(n).set(e,t)),onRestore:e=>v(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n}),onDeeperDive:()=>b(!0),onGoodForNow:()=>b(!0),onSuggestionClick:t=>{let n=u();c.getState().setActiveConversationId(n),e(`${o.conversation(n)}?prompt=${encodeURIComponent(t)}`)},onContinue:()=>e(o.assistant)})]}):(0,f.jsx)(i,{to:o.assistant,replace:!0})}export{g as ResearchMockPage};
@@ -1,2 +1,2 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,r as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./input-CwdmSRlD.js";import{W as s,n as c}from"./auth-store-CdoTCJgP.js";import{a as l}from"./routes-BnbYm-Mr.js";import{t as u}from"./client-feature-flag-store-DZMwD6Gv.js";import{an as d,dt as f,vt as p}from"./index-BsySSmys.js";import{t as m}from"./prechat-names-Ba-YnefK.js";var h=e(t(),1);function g({firstName:e,lastName:t,occupation:n}){let r=[e.trim(),t.trim()].filter(Boolean).join(` `),i=n.trim();return[[r?`My name is ${r}.`:``,i?`I work as ${i}.`:``].filter(Boolean).join(` `)||`I'd like you to get to know me before we start working together.`,``,`Before we dive in, get to know me. Search the web for what's publicly`,`known about the person matching my name and role, and infer a handful of`,`things about who I am — what I do, my role, where I'm based, what I'm into,`,`anything that would help you assist me better. Lean on public sources`,`(LinkedIn, company pages, social profiles, articles). It's fine to make`,`reasonable inferences and label them honestly.`,``,`CRITICAL — your final reply must be ONLY a JSON object. No preamble, no`,`explanation, no prose, nothing before or after it. Do your thinking and`,`searching, then respond with exactly this shape and nothing else:`,``,`{`,` "claims": [`,` { "claim": "Software engineer in Columbus, OH", "confidence": "confident", "sources": ["https://github.com/you"] },`,` { "claim": "You climb outdoors", "confidence": "maybe", "sources": [] },`,` { "claim": "Head of growth at Vellum", "confidence": "guessing", "sources": ["https://example.com/about"] }`,` ],`,` "suggestions": [`,` "Draft your weekly GTM update",`,` "Summarize competitor launches each Monday",`,` "Turn your notes into polished posts",`,` "Track your team's OKRs"`,` ]`,`}`,``,`Rules for "claims":`,`- AT MOST 5 claims — the strongest, most useful ones only.`,`- Each claim must be SHORT: a few words to one brief line. No multi-clause`,` sentences, no em-dash asides, no explanations. Think headline, not bio.`,` Good: "Contributed to Chirps (vector-DB security)". Bad: "You've done`,` real work in vector database security — you contributed to Chirps, a`,` tool for scanning vector DBs for sensitive data".`,`- Each claim independently true-or-false so I can remove ones that are wrong.`,`- Phrase them directly ("You're…", "You climb outdoors", "Head of growth`,` at Vellum").`,`- "confidence" is one of: "confident" (well supported by what you found),`,` "maybe" (plausible but unverified), "guessing" (a hunch from limited`,` signal).`,`- "sources": 0–3 URLs you actually used as evidence for that specific`,` claim (the pages you read). Use [] for pure inferences.`,``,`Rules for "suggestions":`,`- EXACTLY 4 suggestions. These TEACH a brand-new user what you can do —`,` each should showcase a DIFFERENT capability of yours (e.g. research &`,` summarize, draft & write, automate a recurring task, analyze data,`,` build something), made relevant to my work and role.`,`- Phrase each as a short, inviting action I can click to try right now,`,` starting with a verb (e.g. "Summarize this week's LLM releases for me",`,` "Draft a launch post from your notes"). No explanations.`,`- Make them feel concrete and immediately runnable, not generic.`,``,`Don't include anything sensitive or private. If you found very little,`,`lean on "guessing" claims and broadly useful suggestions for my role.`,`Output ONLY the JSON object — no code fence, no extra text.`].join(`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,r as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./input-CwdmSRlD.js";import{W as s,n as c}from"./auth-store-CdoTCJgP.js";import{a as l}from"./routes-BnbYm-Mr.js";import{t as u}from"./client-feature-flag-store-DZMwD6Gv.js";import{an as d,dt as f,vt as p}from"./index-CEhiJItI.js";import{t as m}from"./prechat-names-Ba-YnefK.js";var h=e(t(),1);function g({firstName:e,lastName:t,occupation:n}){let r=[e.trim(),t.trim()].filter(Boolean).join(` `),i=n.trim();return[[r?`My name is ${r}.`:``,i?`I work as ${i}.`:``].filter(Boolean).join(` `)||`I'd like you to get to know me before we start working together.`,``,`Before we dive in, get to know me. Search the web for what's publicly`,`known about the person matching my name and role, and infer a handful of`,`things about who I am — what I do, my role, where I'm based, what I'm into,`,`anything that would help you assist me better. Lean on public sources`,`(LinkedIn, company pages, social profiles, articles). It's fine to make`,`reasonable inferences and label them honestly.`,``,`CRITICAL — your final reply must be ONLY a JSON object. No preamble, no`,`explanation, no prose, nothing before or after it. Do your thinking and`,`searching, then respond with exactly this shape and nothing else:`,``,`{`,` "claims": [`,` { "claim": "Software engineer in Columbus, OH", "confidence": "confident", "sources": ["https://github.com/you"] },`,` { "claim": "You climb outdoors", "confidence": "maybe", "sources": [] },`,` { "claim": "Head of growth at Vellum", "confidence": "guessing", "sources": ["https://example.com/about"] }`,` ],`,` "suggestions": [`,` "Draft your weekly GTM update",`,` "Summarize competitor launches each Monday",`,` "Turn your notes into polished posts",`,` "Track your team's OKRs"`,` ]`,`}`,``,`Rules for "claims":`,`- AT MOST 5 claims — the strongest, most useful ones only.`,`- Each claim must be SHORT: a few words to one brief line. No multi-clause`,` sentences, no em-dash asides, no explanations. Think headline, not bio.`,` Good: "Contributed to Chirps (vector-DB security)". Bad: "You've done`,` real work in vector database security — you contributed to Chirps, a`,` tool for scanning vector DBs for sensitive data".`,`- Each claim independently true-or-false so I can remove ones that are wrong.`,`- Phrase them directly ("You're…", "You climb outdoors", "Head of growth`,` at Vellum").`,`- "confidence" is one of: "confident" (well supported by what you found),`,` "maybe" (plausible but unverified), "guessing" (a hunch from limited`,` signal).`,`- "sources": 0–3 URLs you actually used as evidence for that specific`,` claim (the pages you read). Use [] for pure inferences.`,``,`Rules for "suggestions":`,`- EXACTLY 4 suggestions. These TEACH a brand-new user what you can do —`,` each should showcase a DIFFERENT capability of yours (e.g. research &`,` summarize, draft & write, automate a recurring task, analyze data,`,` build something), made relevant to my work and role.`,`- Phrase each as a short, inviting action I can click to try right now,`,` starting with a verb (e.g. "Summarize this week's LLM releases for me",`,` "Draft a launch post from your notes"). No explanations.`,`- Make them feel concrete and immediately runnable, not generic.`,``,`Don't include anything sensitive or private. If you found very little,`,`lean on "guessing" claims and broadly useful suggestions for my role.`,`Output ONLY the JSON object — no code fence, no extra text.`].join(`
2
2
  `)}var _=a();function v({initialFirstName:e=``,initialLastName:t=``,onSubmit:r}){let[i,a]=(0,h.useState)(e),[s,c]=(0,h.useState)(t),[l,u]=(0,h.useState)(``),d=i.trim().length>0&&l.trim().length>0;function p(){d&&r({firstName:i,lastName:s,occupation:l})}return(0,_.jsx)(f,{showCreatureFooter:!1,children:(0,_.jsxs)(`form`,{className:`mx-auto flex min-h-screen w-full max-w-md flex-col px-6 pb-40 text-[var(--content-default)]`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,_.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-16`,children:[(0,_.jsx)(`h1`,{className:`text-center text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:`Let's start with you.`}),(0,_.jsx)(`p`,{className:`mt-2 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`A few details so I can get to know you before we dive in.`}),(0,_.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,_.jsx)(o,{label:`First name`,placeholder:`First name`,value:i,onChange:e=>a(e.target.value),autoFocus:!0,fullWidth:!0}),(0,_.jsx)(o,{label:`Last name`,placeholder:`Last name`,value:s,onChange:e=>c(e.target.value),fullWidth:!0}),(0,_.jsx)(o,{label:`What do you do?`,placeholder:`e.g. Product designer at a fintech startup`,value:l,onChange:e=>u(e.target.value),fullWidth:!0})]})]}),(0,_.jsx)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:(0,_.jsx)(n,{type:`submit`,variant:`primary`,size:`regular`,fullWidth:!0,disabled:!d,className:`h-11 text-base`,children:`Continue`})})]})})}function y(){let e=r(),t=c.use.user(),n=p.use.enterFocus(),a=p.use.exitFocus(),o=p.use.beginCheckin(),f=u.use.researchOnboarding(),y=u.use.hydrated();(0,h.useEffect)(()=>{a()},[a]);function b({firstName:t,lastName:r,occupation:i}){let a=[t.trim(),r.trim()].filter(Boolean).join(` `);d({tools:[],tasks:[],tone:m,...a?{userName:a}:{},...i.trim()?{occupation:i.trim()}:{},initialMessage:g({firstName:t,lastName:r,occupation:i})}),o(a||void 0),n(),s.markExpectingFirstMessage(),s.checkAssistant().finally(()=>{e(`${l.assistant}?onboarding=1`,{replace:!0})})}return f?(0,_.jsx)(v,{initialFirstName:t?.firstName??``,initialLastName:t?.lastName??``,onSubmit:b}):y?(0,_.jsx)(i,{to:l.assistant,replace:!0}):null}export{y as ResearchOnboardingRoute};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./checkbox-Dc9gjmAy.js";import{t as s}from"./is-electron-BuSDabCt.js";import{M as c,n as l,r as u,u as d}from"./auth-store-CdoTCJgP.js";import{a as f,i as p}from"./routes-BnbYm-Mr.js";import{a as m,c as h,o as g,s as _}from"./prefs-BXOW-ziM.js";import{dt as v,qr as y}from"./index-BsySSmys.js";var b=e(t(),1),x=a(),S=`[&_button[data-state=checked]]:bg-[var(--primary-base)] [&_svg]:text-[var(--content-inset)]`;function C(){let e=r(),[t]=i(),a=l.use.user()?.id??null,C=l.use.logout(),w=s(),T=u(),[E,D]=h(),[O,k]=m(),[A]=g(),[j]=_(),M=(0,b.useCallback)(()=>{d({userId:a,tos:E,ai:O,shareAnalytics:A,shareDiagnostics:j,hasPlatformSession:T}),e(c(t.get(`returnTo`),f.assistant),{replace:!0})},[O,T,e,t,A,j,E,a]),N=(0,b.useCallback)(async()=>{await C(),y(f.account.login)},[C]),P=(0,x.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,x.jsx)(`a`,{href:p(f.docs.legal.termsOfUse),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Terms of Service`}),` `,`and`,` `,(0,x.jsx)(`a`,{href:p(f.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Privacy Policy`})]}),F=(0,x.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,x.jsx)(`a`,{href:p(f.docs.legal.dataSharing),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`AI Data Sharing Policy`})]});return(0,x.jsx)(v,{showCreatureFooter:!1,children:(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${w?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,x.jsx)(`h1`,{className:w?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Updated Terms`}),(0,x.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${w?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`We've updated our terms. Please review and re-accept to continue.`}),(0,x.jsx)(`div`,{className:`mt-8 flex w-full items-start`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:(0,x.jsx)(o,{checked:O,onCheckedChange:e=>k(e===!0),label:F,"aria-label":`I agree to the AI Data Sharing Policy`,className:S})}),(0,x.jsx)(`div`,{className:`flex w-full items-start ${w?`mt-2`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.45s both`},children:(0,x.jsx)(o,{checked:E,onCheckedChange:e=>D(e===!0),label:P,"aria-label":`I agree to the Terms of Service and Privacy Policy`,className:S})}),(0,x.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${w?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,x.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!E||!O,onClick:M,className:w?void 0:`h-11 text-base`,children:`Continue`}),(0,x.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:N,className:w?void 0:`h-11 text-base`,children:`Log out`})]})]})})}export{C as ReviewTermsScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./checkbox-Dc9gjmAy.js";import{t as s}from"./is-electron-BuSDabCt.js";import{M as c,n as l,r as u,u as d}from"./auth-store-CdoTCJgP.js";import{a as f,i as p}from"./routes-BnbYm-Mr.js";import{a as m,c as h,o as g,s as _}from"./prefs-BXOW-ziM.js";import{dt as v,qr as y}from"./index-CEhiJItI.js";var b=e(t(),1),x=a(),S=`[&_button[data-state=checked]]:bg-[var(--primary-base)] [&_svg]:text-[var(--content-inset)]`;function C(){let e=r(),[t]=i(),a=l.use.user()?.id??null,C=l.use.logout(),w=s(),T=u(),[E,D]=h(),[O,k]=m(),[A]=g(),[j]=_(),M=(0,b.useCallback)(()=>{d({userId:a,tos:E,ai:O,shareAnalytics:A,shareDiagnostics:j,hasPlatformSession:T}),e(c(t.get(`returnTo`),f.assistant),{replace:!0})},[O,T,e,t,A,j,E,a]),N=(0,b.useCallback)(async()=>{await C(),y(f.account.login)},[C]),P=(0,x.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,x.jsx)(`a`,{href:p(f.docs.legal.termsOfUse),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Terms of Service`}),` `,`and`,` `,(0,x.jsx)(`a`,{href:p(f.docs.legal.privacyPolicy),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`Privacy Policy`})]}),F=(0,x.jsxs)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:[`I agree to the`,` `,(0,x.jsx)(`a`,{href:p(f.docs.legal.dataSharing),target:`_blank`,rel:`noreferrer`,className:`underline`,children:`AI Data Sharing Policy`})]});return(0,x.jsx)(v,{showCreatureFooter:!1,children:(0,x.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${w?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,x.jsx)(`h1`,{className:w?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Updated Terms`}),(0,x.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${w?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`We've updated our terms. Please review and re-accept to continue.`}),(0,x.jsx)(`div`,{className:`mt-8 flex w-full items-start`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:(0,x.jsx)(o,{checked:O,onCheckedChange:e=>k(e===!0),label:F,"aria-label":`I agree to the AI Data Sharing Policy`,className:S})}),(0,x.jsx)(`div`,{className:`flex w-full items-start ${w?`mt-2`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.45s both`},children:(0,x.jsx)(o,{checked:E,onCheckedChange:e=>D(e===!0),label:P,"aria-label":`I agree to the Terms of Service and Privacy Policy`,className:S})}),(0,x.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${w?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[(0,x.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!E||!O,onClick:M,className:w?void 0:`h-11 text-base`,children:`Continue`}),(0,x.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:N,className:w?void 0:`h-11 text-base`,children:`Log out`})]})]})})}export{C as ReviewTermsScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./confirm-dialog-DbNUkFt6.js";import{t as s}from"./modal-DX6UN7b0.js";import{E as c,L as l,j as u,l as d,w as f}from"./local-mode-Bvz5B1q8.js";import{t as p}from"./is-electron-BuSDabCt.js";import{n as m}from"./resolved-assistants-store-Cumv2SiX.js";import{H as h,c as g,n as _,r as v}from"./auth-store-CdoTCJgP.js";import{a as y}from"./routes-BnbYm-Mr.js";import{t as ee}from"./use-onboarding-login-D_NSkHfv.js";import{Fa as b,Mt as x,dt as S,eo as C,jt as w,mo as T}from"./index-BsySSmys.js";import{r as E}from"./format-date-Oi80uFkI.js";var D=e(t(),1),O=a();function k({open:e,assistantName:t,isPending:r,errorMessage:i,onCancel:a,onRepair:c,onRetire:l}){let[u,d]=(0,D.useState)(`menu`);(0,D.useEffect)(()=>{e&&d(`menu`)},[e]);let f=i?(0,O.jsx)(`span`,{className:`mt-3 block text-body-small-default text-[var(--system-negative-strong)]`,children:i}):null;return u===`confirm-repair`?(0,O.jsx)(o,{open:e,title:`Repair Assistant?`,message:(0,O.jsxs)(O.Fragment,{children:[`Repairing re-provisions this assistant’s authentication token. Any other devices or browser sessions connected to it will be signed out and need to reconnect.`,f]}),confirmLabel:`Repair`,isPending:r,onConfirm:c,onCancel:()=>d(`menu`)}):u===`confirm-retire`?(0,O.jsx)(w,{open:e,isPending:r,extraMessage:f,onConfirm:l,onCancel:()=>d(`menu`)}):(0,O.jsx)(s.Root,{open:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,O.jsxs)(s.Content,{size:`sm`,hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),r||a()},children:[(0,O.jsx)(s.Header,{children:(0,O.jsx)(s.Title,{children:`Can’t Authenticate Assistant`})}),(0,O.jsxs)(s.Body,{children:[(0,O.jsxs)(s.Description,{children:[`The authentication token for `,t,` is missing or can no longer be refreshed, so this assistant can’t be connected. You can repair it, retire it, or pick a different assistant.`]}),f,(0,O.jsxs)(`div`,{className:`mt-5 flex w-full flex-col gap-2`,children:[(0,O.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-repair`),children:`Wake & Repair`}),(0,O.jsx)(n,{variant:`dangerOutline`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-retire`),children:`Retire Assistant`}),(0,O.jsx)(n,{variant:`outlined`,fullWidth:!0,disabled:r,onClick:a,children:`Cancel`})]})]})]})})}function A(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function j(e){if(e.hatchedAt)return`Created ${E(e.hatchedAt)}`}function M(){let e=r(),[t]=i(),a=t.get(`fromLogin`)===`1`,o=t.get(`fromSettings`)===`1`,s=p(),b=v(),C=m.use.assistants(),w=g.use.currentOrganizationId(),{loading:T,error:E,login:j,cancel:M}=ee(),P=e=>e.isLocal||b,F=C.filter(P),I=C.some(e=>e.isPlatformHosted)&&!b,[L,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(null),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(!1),[Y,X]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(L!=null||F.length===0)return;let e=h(w);R(F.find(t=>t.id===e)?.id??F[0].id)},[L,F,w]);let Z=async t=>{B(!0),W(null);try{t.isLocal?await _.getState().connectLocalAssistant(t.id):await _.getState().connectPlatformAssistant(t.id),e(y.assistant,{replace:!0})}catch(e){console.error(`selectAssistant.handleConnect failed`,e),t.isLocal&&(f(e)||l(e))&&d(t.id)?K(t):W(`Failed to connect. Please try again.`),B(!1)}},Q=()=>{K(null),J(!1),X(null),H(!1)},te=async()=>{if(!(!G||q)){J(!0),X(null);try{let e=await c(G.id,{repairGuardian:!0});if(e.ok){u(),Q(),Z(G);return}X(e.error||`Repair failed. Please try again.`)}catch(e){console.error(`selectAssistant.recoveryRepair failed`,e),X(`Repair failed. Please try again.`)}J(!1)}},ne=async()=>{if(!(!G||q)){J(!0),X(null);try{let t=await x(G.id);if(t.ok){Q(),e(t.nextRoute,{replace:!0});return}X(t.error)}catch(e){console.error(`selectAssistant.recoveryRetire failed`,e),X(`Failed to retire assistant. Please try again.`)}J(!1)}};(0,D.useEffect)(()=>{a||o||z||V||C.length!==0&&C.length===1&&F.length===1&&(H(!0),Z(F[0]))},[C.length,F.length]);let re=()=>{let e=C.find(e=>e.id===L);e&&Z(e)},ie=()=>{e(y.welcome)},$=E??U;return V&&!$&&!G?(0,O.jsx)(S,{children:(0,O.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,O.jsxs)(S,{children:[(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${s?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`min-h-screen px-6 pb-40 pt-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`h1`,{className:s?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${s?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),$&&(0,O.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:$}),(0,O.jsx)(`div`,{className:`flex w-full flex-col ${s?`mt-8 gap-2`:`mt-10 gap-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:C.map(e=>{let t=P(e);return(0,O.jsx)(N,{assistant:e,selected:L===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&R(e.id)}},e.id)})}),(0,O.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${s?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[F.length>0&&(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:re,disabled:!L||z,children:z?`Connecting…`:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:()=>void e(`${y.onboarding.hosting}?from=select-assistant`),disabled:z||T,children:`Create New Assistant`}),I&&(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:T?M:()=>void j(),disabled:z,children:T?`Cancel`:`Log In`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:ie,disabled:z||T,children:`Back`})]})]}),(0,O.jsx)(k,{open:G!=null,assistantName:G?A(G):``,isPending:q,errorMessage:Y??void 0,onCancel:Q,onRepair:()=>void te(),onRetire:()=>void ne()})]})}function N({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=j(e),o=p();return(0,O.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center border text-left`,o?`gap-3 rounded-lg p-3`:`gap-4 rounded-2xl px-5 py-4`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,O.jsx)(`div`,{className:[`flex shrink-0 items-center justify-center transition-colors duration-200`,o?`h-8 w-8 rounded-lg`:`h-10 w-10 rounded-xl`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,O.jsx)(b,{className:`h-5 w-5`}):(0,O.jsx)(C,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:A(e)}),r&&(0,O.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-[var(--content-tertiary)] ${o?`text-label-medium-default`:`text-body-small-default`}`,children:r})]}),a&&(0,O.jsx)(`span`,{className:`mt-0.5 block text-[var(--content-tertiary)] ${o?`text-label-medium-default`:`text-body-small-default`}`,children:a})]}),!n&&(0,O.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,O.jsx)(T,{className:`h-3 w-3 text-[var(--surface-base)]`,strokeWidth:3})})]})}export{M as SelectAssistantScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D7s2Q_uG.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./confirm-dialog-DbNUkFt6.js";import{t as s}from"./modal-DX6UN7b0.js";import{E as c,L as l,j as u,l as d,w as f}from"./local-mode-Bvz5B1q8.js";import{t as p}from"./is-electron-BuSDabCt.js";import{n as m}from"./resolved-assistants-store-Cumv2SiX.js";import{H as h,c as g,n as _,r as v}from"./auth-store-CdoTCJgP.js";import{a as y}from"./routes-BnbYm-Mr.js";import{t as ee}from"./use-onboarding-login-D_NSkHfv.js";import{Fa as b,Mt as x,dt as S,eo as C,jt as w,mo as T}from"./index-CEhiJItI.js";import{r as E}from"./format-date-Oi80uFkI.js";var D=e(t(),1),O=a();function k({open:e,assistantName:t,isPending:r,errorMessage:i,onCancel:a,onRepair:c,onRetire:l}){let[u,d]=(0,D.useState)(`menu`);(0,D.useEffect)(()=>{e&&d(`menu`)},[e]);let f=i?(0,O.jsx)(`span`,{className:`mt-3 block text-body-small-default text-[var(--system-negative-strong)]`,children:i}):null;return u===`confirm-repair`?(0,O.jsx)(o,{open:e,title:`Repair Assistant?`,message:(0,O.jsxs)(O.Fragment,{children:[`Repairing re-provisions this assistant’s authentication token. Any other devices or browser sessions connected to it will be signed out and need to reconnect.`,f]}),confirmLabel:`Repair`,isPending:r,onConfirm:c,onCancel:()=>d(`menu`)}):u===`confirm-retire`?(0,O.jsx)(w,{open:e,isPending:r,extraMessage:f,onConfirm:l,onCancel:()=>d(`menu`)}):(0,O.jsx)(s.Root,{open:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,O.jsxs)(s.Content,{size:`sm`,hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),r||a()},children:[(0,O.jsx)(s.Header,{children:(0,O.jsx)(s.Title,{children:`Can’t Authenticate Assistant`})}),(0,O.jsxs)(s.Body,{children:[(0,O.jsxs)(s.Description,{children:[`The authentication token for `,t,` is missing or can no longer be refreshed, so this assistant can’t be connected. You can repair it, retire it, or pick a different assistant.`]}),f,(0,O.jsxs)(`div`,{className:`mt-5 flex w-full flex-col gap-2`,children:[(0,O.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-repair`),children:`Wake & Repair`}),(0,O.jsx)(n,{variant:`dangerOutline`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-retire`),children:`Retire Assistant`}),(0,O.jsx)(n,{variant:`outlined`,fullWidth:!0,disabled:r,onClick:a,children:`Cancel`})]})]})]})})}function A(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function j(e){if(e.hatchedAt)return`Created ${E(e.hatchedAt)}`}function M(){let e=r(),[t]=i(),a=t.get(`fromLogin`)===`1`,o=t.get(`fromSettings`)===`1`,s=p(),b=v(),C=m.use.assistants(),w=g.use.currentOrganizationId(),{loading:T,error:E,login:j,cancel:M}=ee(),P=e=>e.isLocal||b,F=C.filter(P),I=C.some(e=>e.isPlatformHosted)&&!b,[L,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(null),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(!1),[Y,X]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(L!=null||F.length===0)return;let e=h(w);R(F.find(t=>t.id===e)?.id??F[0].id)},[L,F,w]);let Z=async t=>{B(!0),W(null);try{t.isLocal?await _.getState().connectLocalAssistant(t.id):await _.getState().connectPlatformAssistant(t.id),e(y.assistant,{replace:!0})}catch(e){console.error(`selectAssistant.handleConnect failed`,e),t.isLocal&&(f(e)||l(e))&&d(t.id)?K(t):W(`Failed to connect. Please try again.`),B(!1)}},Q=()=>{K(null),J(!1),X(null),H(!1)},te=async()=>{if(!(!G||q)){J(!0),X(null);try{let e=await c(G.id,{repairGuardian:!0});if(e.ok){u(),Q(),Z(G);return}X(e.error||`Repair failed. Please try again.`)}catch(e){console.error(`selectAssistant.recoveryRepair failed`,e),X(`Repair failed. Please try again.`)}J(!1)}},ne=async()=>{if(!(!G||q)){J(!0),X(null);try{let t=await x(G.id);if(t.ok){Q(),e(t.nextRoute,{replace:!0});return}X(t.error)}catch(e){console.error(`selectAssistant.recoveryRetire failed`,e),X(`Failed to retire assistant. Please try again.`)}J(!1)}};(0,D.useEffect)(()=>{a||o||z||V||C.length!==0&&C.length===1&&F.length===1&&(H(!0),Z(F[0]))},[C.length,F.length]);let re=()=>{let e=C.find(e=>e.id===L);e&&Z(e)},ie=()=>{e(y.welcome)},$=E??U;return V&&!$&&!G?(0,O.jsx)(S,{children:(0,O.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,O.jsxs)(S,{children:[(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${s?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`min-h-screen px-6 pb-40 pt-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`h1`,{className:s?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${s?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),$&&(0,O.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:$}),(0,O.jsx)(`div`,{className:`flex w-full flex-col ${s?`mt-8 gap-2`:`mt-10 gap-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:C.map(e=>{let t=P(e);return(0,O.jsx)(N,{assistant:e,selected:L===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&R(e.id)}},e.id)})}),(0,O.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${s?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[F.length>0&&(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:re,disabled:!L||z,children:z?`Connecting…`:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:()=>void e(`${y.onboarding.hosting}?from=select-assistant`),disabled:z||T,children:`Create New Assistant`}),I&&(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:T?M:()=>void j(),disabled:z,children:T?`Cancel`:`Log In`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:ie,disabled:z||T,children:`Back`})]})]}),(0,O.jsx)(k,{open:G!=null,assistantName:G?A(G):``,isPending:q,errorMessage:Y??void 0,onCancel:Q,onRepair:()=>void te(),onRetire:()=>void ne()})]})}function N({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=j(e),o=p();return(0,O.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center border text-left`,o?`gap-3 rounded-lg p-3`:`gap-4 rounded-2xl px-5 py-4`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,O.jsx)(`div`,{className:[`flex shrink-0 items-center justify-center transition-colors duration-200`,o?`h-8 w-8 rounded-lg`:`h-10 w-10 rounded-xl`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,O.jsx)(b,{className:`h-5 w-5`}):(0,O.jsx)(C,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:A(e)}),r&&(0,O.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-[var(--content-tertiary)] ${o?`text-label-medium-default`:`text-body-small-default`}`,children:r})]}),a&&(0,O.jsx)(`span`,{className:`mt-0.5 block text-[var(--content-tertiary)] ${o?`text-label-medium-default`:`text-body-small-default`}`,children:a})]}),!n&&(0,O.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,O.jsx)(T,{className:`h-3 w-3 text-[var(--surface-base)]`,strokeWidth:3})})]})}export{M as SelectAssistantScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,i as r,u as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./is-electron-BuSDabCt.js";import{t as s}from"./log-in-DmeCGRNC.js";import{r as c}from"./auth-store-CdoTCJgP.js";import{a as l}from"./routes-BnbYm-Mr.js";import{t as u}from"./client-feature-flag-store-DZMwD6Gv.js";import{t as d}from"./use-onboarding-login-D_NSkHfv.js";import{t as f}from"./assistant-feature-flag-store-ClCVaYet.js";import{It as p,Kr as m,X as h,ka as g}from"./index-BsySSmys.js";import{n as _,t as v}from"./sidebar-tree-CH2YCJs-.js";var y=e(t(),1),b=a();function x(){let e=f.use.settingsDeveloperNav(),t=u.use.platformNotifications(),a=u.use.bookmarks(),x=p({platformHostedOnly:!0}),S=p(),{pathname:C}=i(),w=n(),T=c(),{login:E}=d(),D=(0,y.useMemo)(()=>h.filter(e=>!(e.id===`notifications`&&(!t||x===`gated`)||e.id===`billing`&&S!==`full`||e.id===`bookmarks`&&!a||e.id===`devices`&&x===`gated`||e.id===`keyboard-shortcuts`&&!o()||e.id===`developer`)),[t,x,S,a]),O=(0,y.useMemo)(()=>{let t=[];return e&&t.push(...h.filter(e=>e.id===`developer`)),t.push(T?{id:`logout`,label:`Log Out`,icon:g,onSelect:()=>void m(w)}:{id:`login`,label:`Log In`,icon:s,onSelect:()=>void E()}),t},[e,T,w,E]),k=(0,y.useMemo)(()=>{if(C===l.settings.root)return`Settings`;let e=h.find(e=>C===e.href||C.startsWith(e.href+`/`));return e?e.label:`Settings`},[C]);return(0,b.jsx)(_,{backHref:l.assistant,sidebar:(0,b.jsx)(v,{items:D,bottomItems:O,indexPath:l.settings.root}),title:k,children:(0,b.jsx)(r,{})})}export{x as SettingsLayout};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,i as r,u as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./is-electron-BuSDabCt.js";import{t as s}from"./log-in-DmeCGRNC.js";import{r as c}from"./auth-store-CdoTCJgP.js";import{a as l}from"./routes-BnbYm-Mr.js";import{t as u}from"./client-feature-flag-store-DZMwD6Gv.js";import{t as d}from"./use-onboarding-login-D_NSkHfv.js";import{t as f}from"./assistant-feature-flag-store-ClCVaYet.js";import{It as p,Kr as m,X as h,ka as g}from"./index-CEhiJItI.js";import{n as _,t as v}from"./sidebar-tree-BSHyIykQ.js";var y=e(t(),1),b=a();function x(){let e=f.use.settingsDeveloperNav(),t=u.use.platformNotifications(),a=u.use.bookmarks(),x=p({platformHostedOnly:!0}),S=p(),{pathname:C}=i(),w=n(),T=c(),{login:E}=d(),D=(0,y.useMemo)(()=>h.filter(e=>!(e.id===`notifications`&&(!t||x===`gated`)||e.id===`billing`&&S!==`full`||e.id===`bookmarks`&&!a||e.id===`devices`&&x===`gated`||e.id===`keyboard-shortcuts`&&!o()||e.id===`developer`)),[t,x,S,a]),O=(0,y.useMemo)(()=>{let t=[];return e&&t.push(...h.filter(e=>e.id===`developer`)),t.push(T?{id:`logout`,label:`Log Out`,icon:g,onSelect:()=>void m(w)}:{id:`login`,label:`Log In`,icon:s,onSelect:()=>void E()}),t},[e,T,w,E]),k=(0,y.useMemo)(()=>{if(C===l.settings.root)return`Settings`;let e=h.find(e=>C===e.href||C.startsWith(e.href+`/`));return e?e.label:`Settings`},[C]);return(0,b.jsx)(_,{backHref:l.assistant,sidebar:(0,b.jsx)(v,{items:D,bottomItems:O,indexPath:l.settings.root}),title:k,children:(0,b.jsx)(r,{})})}export{x as SettingsLayout};