@vellumai/web 0.8.12-staging.1 → 0.8.12-staging.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{BundleConfirmPage-jkqaLCJa.js → BundleConfirmPage-YJRCo0Hn.js} +1 -1
- package/dist/assets/{account-page-CnPPGmfm.js → account-page-Dj92GjiR.js} +1 -1
- package/dist/assets/{add-credits-modal-BxO-aOIt.js → add-credits-modal-CsP4udDc.js} +1 -1
- package/dist/assets/{advanced-page-B-9YunGO.js → advanced-page-BCnHb6oY.js} +1 -1
- package/dist/assets/{ai-page-Ccq4dwgh.js → ai-page-DcBsmsTv.js} +1 -1
- package/dist/assets/ai-utils-NK8I8SN2.js +1 -0
- package/dist/assets/{api-OKSSIP8W.js → api-DiLLlhgt.js} +1 -1
- package/dist/assets/{api-key-screen-BdonZw0y.js → api-key-screen-Nxq7EclW.js} +1 -1
- package/dist/assets/{app-html-cache-D7jkI5-i.js → app-html-cache-DuUq2_RD.js} +1 -1
- package/dist/assets/{archive-page-D-lt2ew2.js → archive-page-DGVZ9qUU.js} +1 -1
- package/dist/assets/{assistant-status-panel-DXNBZech.js → assistant-status-panel-B-yM7DE5.js} +1 -1
- package/dist/assets/{auth-store-BDBEYGBC.js → auth-store-C4gcHOWH.js} +1 -1
- package/dist/assets/{avatar-api-DbhDkml8.js → avatar-api-CLSAZR4o.js} +1 -1
- package/dist/assets/billing-page-C_pAWHkv.js +3 -0
- package/dist/assets/{command-palette-oEhmGGJ_.js → command-palette-CmihDJi0.js} +1 -1
- package/dist/assets/{command-palette-window-page-CDLfRYDZ.js → command-palette-window-page-CHxcr6A6.js} +1 -1
- package/dist/assets/{community-page-BwBAzLWc.js → community-page-BgwEi2WM.js} +1 -1
- package/dist/assets/{connect-page-BmHjyuVm.js → connect-page-DKR1ECD0.js} +1 -1
- package/dist/assets/contacts-page-route-ALOLGdXW.js +1 -0
- package/dist/assets/{debug-page-DIjs01B3.js → debug-page-DwWy2v03.js} +1 -1
- package/dist/assets/{deploy-dialogs-K3jkgI2T.js → deploy-dialogs-DrOvG0Ma.js} +1 -1
- package/dist/assets/{developer-page-DFhuZ_hl.js → developer-page-CNY0EBWx.js} +1 -1
- package/dist/assets/{devices-page-DdDILkUC.js → devices-page-DyJCd4s2.js} +1 -1
- package/dist/assets/{dictation-overlay-page-CxBuw-hP.js → dictation-overlay-page-bAy1yMeW.js} +1 -1
- package/dist/assets/{document-viewer-page-Y69T82fT.js → document-viewer-page-B1YXPDXM.js} +1 -1
- package/dist/assets/{earn-credits-modal-CYjyqSQ0.js → earn-credits-modal-BVhrVwKQ.js} +1 -1
- package/dist/assets/{emails-page-DBN4Tl5W.js → emails-page-xMdxei56.js} +1 -1
- package/dist/assets/{general-page-Bp5ucjKX.js → general-page-CzxX_ytO.js} +1 -1
- package/dist/assets/{hatching-screen-CzrL6chE.js → hatching-screen-BvaGi8x7.js} +1 -1
- package/dist/assets/{home-page-route-CaqhLSrL.js → home-page-route-Bxgs4dcd.js} +1 -1
- package/dist/assets/{hosting-screen-WK7sHIGI.js → hosting-screen-Jp346VHw.js} +1 -1
- package/dist/assets/{identity-page-route-B3RBccXw.js → identity-page-route-DHz3LOu0.js} +1 -1
- package/dist/assets/{index-Ue-r3LET.js → index-87hTkD_v.js} +20 -20
- package/dist/assets/inspect-page-B9wa3RHM.js +3 -0
- package/dist/assets/{install-DKeB-cXi.js → install-BlwjvAKk.js} +1 -1
- package/dist/assets/integrations-page-2soaHaLH.js +1 -0
- package/dist/assets/{intelligence-layout-CmazwWMA.js → intelligence-layout-DRGbJocy.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-page-jZLFffHe.js → keyboard-shortcuts-page-DqPqhIaF.js} +1 -1
- package/dist/assets/{library-detail-page-arp0ms3i.js → library-detail-page-DLekVuPD.js} +1 -1
- package/dist/assets/{library-page-B_Um_0PB.js → library-page-DFBGqpq4.js} +1 -1
- package/dist/assets/{login-flow-BbNFfr7k.js → login-flow-DmfVD3r_.js} +1 -1
- package/dist/assets/{login-page-C1onXPvg.js → login-page-CaI9s3W4.js} +1 -1
- package/dist/assets/{logout-page-CZh6Uq_T.js → logout-page-DMO7Ro8q.js} +1 -1
- package/dist/assets/{logs-layout-DH3tK8BL.js → logs-layout-XvmAJO6n.js} +1 -1
- package/dist/assets/{memory-router-playground-page-BWcZZNFJ.js → memory-router-playground-page-DbSrBXJN.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-BRnz4Jvz.js → mobile-sidebar-drawer-CBYUCY4b.js} +1 -1
- package/dist/assets/{notifications-page-BdpIL_Je.js → notifications-page-BWn1NfeD.js} +1 -1
- package/dist/assets/{oauth-complete-page-CYJsWX1G.js → oauth-complete-page-qd6rU5o-.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-B4P5UDKV.js → oauth-popup-complete-page-EU9BzQqV.js} +1 -1
- package/dist/assets/{platform-loopback-page-C1Kd436W.js → platform-loopback-page-ZNZz8YUX.js} +1 -1
- package/dist/assets/plugin-detail-page-D7tzIKVl.js +1 -0
- package/dist/assets/plugins-page-D-kijwJP.js +1 -0
- package/dist/assets/{pre-chat-flow-CpevOsrA.js → pre-chat-flow-BSXfD6S0.js} +1 -1
- package/dist/assets/{privacy-page-DbFKqGg4.js → privacy-page-BiyTmDHN.js} +1 -1
- package/dist/assets/{privacy-screen-CpDWfUis.js → privacy-screen-mhJ5CnV4.js} +1 -1
- package/dist/assets/{provider-callback-page-CQuLD5No.js → provider-callback-page-BuPFhW7i.js} +1 -1
- package/dist/assets/{provider-key-BYLNbH9o.js → provider-key-Clqsm-h7.js} +1 -1
- package/dist/assets/{provider-signup-page-C6xTOqI6.js → provider-signup-page-DhOuxnxY.js} +1 -1
- package/dist/assets/{query-tags-D58uls0S.js → query-tags-DPKpdc1_.js} +1 -1
- package/dist/assets/react-query.gen-B_oGDSP8.js +1 -0
- package/dist/assets/{review-terms-screen-itzeD0QH.js → review-terms-screen-BgLGEzR9.js} +1 -1
- package/dist/assets/{schedules-CULDXQU7.js → schedules-Cxb9otxN.js} +1 -1
- package/dist/assets/schedules-page-SwCpd9Y6.js +1 -0
- package/dist/assets/{sdk.gen-18Tp6Ee_.js → sdk.gen-DgqwY_WN.js} +1 -1
- package/dist/assets/{select-assistant-screen-DXbNAlGe.js → select-assistant-screen-CIVt4gg2.js} +1 -1
- package/dist/assets/{settings-layout-N_A_6E3u.js → settings-layout-L6c6Zaje.js} +1 -1
- package/dist/assets/{share-feedback-modal-B9w8RmIj.js → share-feedback-modal-BlMDGejV.js} +1 -1
- package/dist/assets/{sidebar-tree-CivI4sXe.js → sidebar-tree-KVdXcht-.js} +1 -1
- package/dist/assets/{signup-page-COvQK9fm.js → signup-page-FdYQKUli.js} +1 -1
- package/dist/assets/{skills-page-BoipXRsU.js → skills-page-Cs1mTTpA.js} +1 -1
- package/dist/assets/{sounds-page-2GDbwQsL.js → sounds-page-BtPyTbtD.js} +1 -1
- package/dist/assets/{step-indicator-dots-BusA89ya.js → step-indicator-dots-C_x0ZHGS.js} +1 -1
- package/dist/assets/{subagent-detail-panel-CN_sN89F.js → subagent-detail-panel-C6FfdUDE.js} +1 -1
- package/dist/assets/{system-events-page-DJIYOd5W.js → system-events-page-D9gAK-2s.js} +1 -1
- package/dist/assets/{tiptap-document-editor-B5IBRg7q.js → tiptap-document-editor-Cl8KJbb0.js} +1 -1
- package/dist/assets/{tool-detail-panel-CAZdGcvz.js → tool-detail-panel-DP9ZUGgW.js} +1 -1
- package/dist/assets/{trace-page-Db3S2Hsr.js → trace-page-ClDbcKcm.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-mjlsJGp8.js → upgrade-cancel-page-BXZOicV3.js} +1 -1
- package/dist/assets/{upgrade-success-page-BHISIP3f.js → upgrade-success-page-CeM_gFIj.js} +1 -1
- package/dist/assets/{usage-page-BlvccKgv.js → usage-page-DHofU58j.js} +1 -1
- package/dist/assets/{use-daemon-config-DBKbFpqu.js → use-daemon-config-BLCgqB8a.js} +1 -1
- package/dist/assets/use-is-org-ready-BgB6QXom.js +1 -0
- package/dist/assets/{use-oauth-complete-deep-link-listener-Bteh0USx.js → use-oauth-complete-deep-link-listener-DnDBZsXG.js} +1 -1
- package/dist/assets/{use-onboarding-login-ByZGkreO.js → use-onboarding-login-CYb9P9G7.js} +1 -1
- package/dist/assets/use-plugin-drift-uJRE3xTx.js +1 -0
- package/dist/assets/{viewer-store-cX7oqdcL.js → viewer-store-o5byTOZU.js} +1 -1
- package/dist/assets/{voice-page-DOpV3VSS.js → voice-page-sB7S0uAp.js} +1 -1
- package/dist/assets/{weather-forecast-display-ByPBvVhv.js → weather-forecast-display-C5PORkTk.js} +1 -1
- package/dist/assets/{welcome-screen-3d2lXMb8.js → welcome-screen-Rm6Zm5dD.js} +1 -1
- package/dist/assets/{workspace-page-JSb7VYXM.js → workspace-page-zV0pbQfl.js} +1 -1
- package/dist/index.html +11 -11
- package/package.json +1 -1
- package/dist/assets/ai-utils-C-JayVoL.js +0 -1
- package/dist/assets/billing-page-BJ__Ep9o.js +0 -3
- package/dist/assets/contacts-page-route-CcDLyEf6.js +0 -1
- package/dist/assets/inspect-page-B3_pcn__.js +0 -3
- package/dist/assets/integrations-page-BaDzdFWK.js +0 -1
- package/dist/assets/plugin-detail-page-BEjyf-Ux.js +0 -1
- package/dist/assets/plugins-page-B6qln-fF.js +0 -1
- package/dist/assets/react-query.gen-Bp_whSkG.js +0 -1
- package/dist/assets/schedules-page-LaB58sYQ.js +0 -1
- package/dist/assets/use-is-org-ready-7bL7PowO.js +0 -1
- /package/dist/assets/{avatar-bundled-components-CL39cwfR.js → avatar-bundled-components-D1Q_IPFc.js} +0 -0
- /package/dist/assets/{danger-zone-redirect-page-KLttOmNm.js → danger-zone-redirect-page-B7We5zLz.js} +0 -0
- /package/dist/assets/{environment-store-BFK2MIjF.js → environment-store-D3R6E-cP.js} +0 -0
- /package/dist/assets/{format-CCVadvyp.js → format-Bx7lme44.js} +0 -0
- /package/dist/assets/{format-date-Pw0m-fQ8.js → format-date-6MJxjyy6.js} +0 -0
- /package/dist/assets/{format-file-size-DRikIrHj.js → format-file-size-DkWrZmJq.js} +0 -0
- /package/dist/assets/{llm-dimension-CN3sxcTZ.js → llm-dimension-v8X-KTEz.js} +0 -0
- /package/dist/assets/{onboarding-layout-40CHAFT0.js → onboarding-layout-BAx3atHc.js} +0 -0
- /package/dist/assets/{system-events-redirect-page-BAb2LAAA.js → system-events-redirect-page-De2HLo0x.js} +0 -0
- /package/dist/assets/{usage-window-BZdZL5mo.js → usage-window-DIaL-FoL.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./button-C68o-wep.js";import{t as l}from"./card-CL5iEMJO.js";import{t as u}from"./input-Cu3PPVCq.js";import{f as d,l as f,n as p,s as m}from"./resolved-assistants-store-B5ATyCT9.js";import{t as h}from"./is-electron-CavSPgmY.js";import{t as g}from"./chevron-left-IaM5LZKa.js";import{t as _}from"./loader-circle-C563RcPZ.js";import{t as v}from"./pencil-72cxzUyZ.js";import{t as y}from"./x-D1JFrRas.js";import{O as b,U as x,W as S,a as C,i as w,n as T}from"./auth-store-BDBEYGBC.js";import{t as E}from"./client.gen-BchW2Z6T.js";import{i as D}from"./routes-VcLWbBmh.js";import{t as O}from"./public-asset-BX5-xa7f.js";import{$a as k,D as A,Dt as ee,F as te,I as ne,L as re,Lr as j,Mr as M,O as N,Pr as P,R as F,c as I,dr as ie,fr as ae,it as L,ka as R,l as oe,lr as se,o as ce,rt as z,s as le,st as ue,ur as de,wt as B}from"./index-Ue-r3LET.js";import{t as V}from"./onboarding-layout-40CHAFT0.js";import{c as fe,i as pe,n as H,o as me,r as he,s as ge,t as U}from"./step-indicator-dots-BusA89ya.js";import{t as _e}from"./use-oauth-complete-deep-link-listener-Bteh0USx.js";var W=e(t(),1);async function ve(){try{let{data:e,response:t}=await E.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 G=s(),ye=[{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 be({onComplete:e}){function t(){I(),ce(),e()}return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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,G.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,G.jsx)(`rect`,{x:`5`,y:`2`,width:`14`,height:`20`,rx:`3`}),(0,G.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`18.01`})]})}),(0,G.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,G.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,G.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,G.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,G.jsx)(`ul`,{className:`space-y-4`,children:ye.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-3`,style:{animation:`fadeInUp 0.3s ease-out ${.25+t*.05}s both`},children:[(0,G.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,G.jsx)(k,{size:12,style:{color:`var(--system-positive-strong)`}})}),(0,G.jsxs)(`span`,{className:`text-left`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),(0,G.jsxs)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[` — `,e.detail]})]})]},e.label))})}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.45s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var K=`google`,xe=[{id:`gmail`,label:`Gmail`,logoSrc:O(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:O(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:O(`/images/integrations/google-drive.svg`)}];function Se({assistantId:e,assistantName:t,onConnect:n,onSkip:r,onBack:a}){let s=h(),l=i(),u=b(),d=(0,W.useRef)(null),f=(0,W.useRef)(null),p=(0,W.useRef)(null),m=(0,W.useRef)(null),v=(0,W.useRef)(null),y=(0,W.useRef)(null),x=(0,W.useRef)(null),[S,C]=(0,W.useState)(!1),w=(0,W.useCallback)(()=>{f.current=null,C(!1)},[]),T=(0,W.useCallback)(()=>{v.current&&=(window.removeEventListener(`message`,v.current),null),y.current&&=(window.removeEventListener(`storage`,y.current),null)},[]),E=(0,W.useCallback)(()=>{d.current&&!d.current.closed&&d.current.close(),d.current=null,p.current&&=(clearInterval(p.current),null),m.current&&=(clearTimeout(m.current),null)},[]),O=o({...ee()});(0,W.useEffect)(()=>()=>{p.current&&clearInterval(p.current),m.current&&clearTimeout(m.current),d.current&&!d.current.closed&&d.current.close(),v.current&&window.removeEventListener(`message`,v.current),y.current&&window.removeEventListener(`storage`,y.current),x.current&&=(x.current(),null)},[]);let k=(0,W.useCallback)(async()=>{try{return(await l.fetchQuery({...B({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===K&&e.connected)??null}catch{return null}},[e,l]),A=(0,W.useCallback)(async()=>{E(),w(),n((await k())?.scopes_granted??[])},[w,E,k,n]),j=(0,W.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!f.current||e.requestId!==f.current.requestId||(e.oauthStatus===`connected`?A():(E(),w())))},[w,E,A]),M=(0,W.useCallback)(e=>{let t=f.current;if(!t)return;let n=te(e,window.location.origin,t.requestId);n&&j(n)},[j]),N=(0,W.useCallback)(e=>{let t=f.current;if(!t)return;let n=ne(e,t.requestId);n&&(j(n),window.localStorage.removeItem(F(t.requestId)))},[j]);_e((0,W.useCallback)(e=>{let t=f.current;t&&e.requestId===t.requestId&&j({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[j]));let P=(0,W.useCallback)(()=>{let t=crypto.randomUUID();if(T(),v.current=M,y.current=N,u){C(!0),f.current={requestId:t},O.mutate({path:{assistant_id:e,provider:K},body:{requested_scopes:[],redirect_after_connect:`${D.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){z(e.connect_url)},onError(){w()}}),window.addEventListener(`message`,M),window.addEventListener(`storage`,N),x.current&&x.current();let n=L(()=>{if(!f.current){n(),x.current=null;return}(async()=>{let e=await k();f.current&&(e?await A():w(),T(),n(),x.current=null)})()});x.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){T();return}d.current=n,C(!0),f.current={requestId:t},window.addEventListener(`message`,M),window.addEventListener(`storage`,N),p.current=setInterval(()=>{d.current&&d.current.closed&&f.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=f.current;if(!e)return;let t=window.localStorage.getItem(F(e.requestId));if(t)try{let n=JSON.parse(t);if(re(n,e.requestId)){j(n),window.localStorage.removeItem(F(e.requestId)),T();return}}catch{}let n=await k();f.current&&(n?await A():(E(),w()),T())},1e3))},100),O.mutate({path:{assistant_id:e,provider:K},body:{requested_scopes:[],redirect_after_connect:`${D.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){d.current&&!d.current.closed?d.current.location.href=e.connect_url:f.current&&(E(),w(),T())},onError(){E(),w(),T()}})},[e,w,E,k,j,M,N,A,u,T,O]),I=t||`your assistant`,ie=t||`Your assistant`;return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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,G.jsx)(`button`,{type:`button`,onClick:a,"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,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${s?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Connect Google`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.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, ${I} can use Gmail, Calendar, and Drive with your permission.`}),(0,G.jsx)(`div`,{className:`mt-6 flex items-stretch justify-center gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:xe.map(e=>(0,G.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,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:28,height:28,className:`h-7 w-7 object-contain`,loading:`eager`}),(0,G.jsx)(`span`,{className:`text-center text-xs leading-tight text-[var(--content-tertiary)]`,children:e.label})]},e.id))}),(0,G.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,G.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,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:P,disabled:S||O.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:S||O.isPending?(0,G.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,G.jsx)(_,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization...`]}):`Connect Google`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:r,disabled:S||O.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}var q=[{id:`grounded`,label:`Grounded`,descriptor:`Calm and precise`,tagline:`Measured. No filler.`,names:[`Penn`,`Sage`,`Atlas`,`Orion`,`Reed`,`Quill`]},{id:`warm`,label:`Warm`,descriptor:`Warm and easy`,tagline:`Friendly and casual.`,names:[`Kit`,`Remy`,`Wren`,`Milo`,`Fenn`,`Cleo`]},{id:`energetic`,label:`Energetic`,descriptor:`Fast and direct`,tagline:`Brief. To the point.`,names:[`Nova`,`Ember`,`Cade`,`Lark`,`Vela`,`Ziggy`]},{id:`poetic`,label:`Poetic`,descriptor:`Quiet and observant`,tagline:`Listens, then replies.`,names:[`Luna`,`Iris`,`Vesper`,`Lyra`,`Juno`,`Ada`]}],Ce=6;function we(){return q.flatMap(e=>e.names)}function Te(){let e=we(),t=Math.min(Ce,e.length);for(let n=0;n<t;n+=1){let t=n+Math.floor(Math.random()*(e.length-n)),r=e[n];e[n]=e[t],e[t]=r}return e.slice(0,t)}function Ee({userName:e,assistantName:t,selectedGroupId:n,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onGroupChange:o,onBack:s,onComplete:l,onSkip:d}){let f=h();return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.jsxs)(`div`,{className:`grid w-full items-center ${s?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[s?(0,G.jsx)(`button`,{type:`button`,onClick:s,"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,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${f?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Let's get to know each other.`}),s?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.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,G.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,G.jsx)(u,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>i(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(u,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let n=e===t;return(0,G.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,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Pick a vibe`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:q.map(e=>(0,G.jsx)(De,{group:e,isActive:n===e.id,onToggle:()=>o(n===e.id?null:e.id)},e.id))})]})]}),(0,G.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,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:l,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,G.jsx)(c,{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,G.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,G.jsx)(`span`,{className:`text-body-medium-default ${t?`text-[var(--content-inset)]`:`text-[var(--content-default)]`}`,children:e.descriptor}),(0,G.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:n,onUserNameChange:r,onAssistantNameChange:i,onBack:a,onContinue:o,onSkip:s,currentStep:l,totalSteps:d}){return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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:[a?(0,G.jsx)(c,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:a,"aria-label":`Back`}):(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(U,{current:l,total:d})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.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,G.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,G.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(u,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>r(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(u,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>i(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(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,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:o,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Skip`})]})]})})}var ke=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:O(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:O(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:O(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:O(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:O(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:O(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:O(`/images/prior-assistants/copilot.svg`)}];function Ae({selectedAssistants:e,onChange:t,onBack:n,onContinue:r,onSkip:i}){let a=h(),[o,s]=(0,W.useState)(()=>J(e)),[d,f]=(0,W.useState)(()=>o.length>0),p=(0,W.useRef)(Y(e));(0,W.useEffect)(()=>{let t=Y(e);if(t===p.current)return;let n=J(e);s(n),f(e=>e||n.length>0),p.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of o.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}je(n,e)||(p.current=Y(n),t(n))},[o]);let m=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return o.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[o]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${a?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.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,G.jsx)(`button`,{type:`button`,onClick:n,"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,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Have you used any of these?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${a?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`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,G.jsxs)(`div`,{className:`${a?`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,G.jsx)(Me,{assistant:t,selected:e.has(t.id),onToggle:()=>m(t.id)},t.id)),d?null:(0,G.jsx)(Ne,{onClick:()=>f(!0)})]}),d?(0,G.jsx)(l,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),s(``)},"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,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(u,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:o,onChange:e=>s(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.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,G.jsxs)(`div`,{className:`${a?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`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 J(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Me({assistant:e,selected:t,onToggle:n}){return(0,G.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,G.jsx)(Pe,{assistant:e,size:32}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,G.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,G.jsx)(k,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Ne({onClick:e}){return(0,G.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,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(R,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.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,G.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:n,onContinue:r,onSkip:i}){let a=h(),o=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${a?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.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,G.jsx)(`button`,{type:`button`,onClick:n,"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,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What are you working on?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${a?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`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,G.jsx)(`div`,{className:`${a?`mt-6`:`mt-8`} flex w-full flex-col ${a?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:A.map(t=>{let n=N[t.iconKey],r=e.has(t.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>o(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${a?`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,G.jsx)(`div`,{className:`flex w-6 shrink-0 items-center justify-center text-[var(--content-secondary)]`,children:n?(0,G.jsx)(n,{className:`h-4 w-4`}):null}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:t.label}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t.sublabel})]}),(0,G.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,G.jsx)(k,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,G.jsxs)(`div`,{className:`${a?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`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:O(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:O(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:O(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:O(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:O(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:O(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:O(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:O(`/images/integrations/github.svg`),logoSrcDark:O(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:O(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:O(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:O(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:O(`/images/integrations/apple-notes.svg`)}];function X(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:n,onContinue:r,onSkip:i}){let a=h(),[o,s]=(0,W.useState)(()=>Z(e)),[d,f]=(0,W.useState)(()=>o.length>0),p=(0,W.useRef)(Q(e));(0,W.useEffect)(()=>{let t=Q(e);if(t===p.current)return;let n=Z(e);s(n),f(e=>e||n.length>0),p.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of o.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(p.current=Q(n),t(n))},[o]);let m=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return o.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[o]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${a?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${n?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[n?(0,G.jsx)(`button`,{type:`button`,onClick:n,"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,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),n?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`${a?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`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,G.jsxs)(`div`,{className:`grid w-full gap-2 ${a?`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,G.jsx)($,{tool:t,selected:e.has(t.id),onToggle:()=>m(t.id),electron:a},t.id)),d?null:(0,G.jsx)(Be,{onClick:()=>f(!0),electron:a})]}),d?(0,G.jsx)(l,{padding:a?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col ${a?`gap-2`:`gap-3`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),s(``)},"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,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(u,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:o,onChange:e=>s(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.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,G.jsxs)(`div`,{className:`${a?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`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 Z(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 $({tool:e,selected:t,onToggle:n,electron:r}){return(0,G.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,G.jsx)(Ve,{tool:e,size:32}),(0,G.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,G.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,G.jsx)(k,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Be({onClick:e,electron:t}){return(0,G.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,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(R,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function Ve({tool:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.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,G.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 He({selectedGroupId:e,onGroupChange:t,onBack:n,onContinue:r,onSkip:i,currentStep:a,totalSteps:o}){return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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,G.jsx)(c,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:n,"aria-label":`Back`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(U,{current:a,total:o})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.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,G.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,G.jsx)(`div`,{className:`mt-8 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:q.map(n=>{let r=e===n.id;return(0,G.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,G.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:n.descriptor}),(0,G.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,G.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--content-default)]`})})]},n.id)})})]}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:r,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ue(e){let[t,n]=(0,W.useState)(()=>(e??``).trim()),r=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(r.current)return;let t=(e??``).trim();t&&n(e=>e||t)},[e]),{value:t,onChange:(0,W.useCallback)(e=>{r.current=!0,n(e)},[])}}var We=[`gmail`,`google-calendar`,`google-drive`],Ge=`experiment-activation-flow-2026-06-03`,Ke=`BOOTSTRAP-ACTIVATION-RAIL.md`;function qe(e,t,n){return t?.initialMessage?t.initialMessage:n?de(e):se}function Je(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?[...We]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:X([...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=Ge,i.bootstrapTemplate=Ke);let a=e.userName.trim();a&&(i.userName=a);let o=e.assistantName.trim();return o&&(i.assistantName=o),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=X([...e.selectedPriorAssistants])),i.initialMessage=qe(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function Ye(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Xe(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:H.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:H.controlWorkType,enabled:!t},{id:`tools`,funnelStep:H.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:H.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?H.gmailConnect:H.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:H.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ze(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Qe=`1`;function $e(e){return e===`nativeVibe`||e===Qe?`nativeVibe`:null}function et(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function tt(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function nt(){let e=n(),t=b(),r=j()&&P();return(0,W.useEffect)(()=>{!r&&!t&&e(D.onboarding.privacy,{replace:!0})},[r,t,e]),t||r}function rt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,W.useState)(()=>t?`nativeName`:`name`),a=(0,W.useCallback)(e=>{if(n)try{e===null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},[n]);return(0,W.useLayoutEffect)(()=>{if(n)try{let e=$e(sessionStorage.getItem(n));e&&i(e)}catch{}},[n]),(0,W.useEffect)(()=>{t&&a(r===`nativeVibe`?`nativeVibe`:null)},[t,r,a]),{currentStep:r,setCurrentStep:i,clearPersistedStep:(0,W.useCallback)(()=>{a(null)},[a])}}var it=3;function at(){let e=f();return e?.cloud===`vellum`?e.assistantId:m()[0]?.assistantId??null}function ot(){let e=n(),[t]=r(),i=t.get(`preview`)===`true`,o=T.use.user(),s=w(),c=C(),l=o?.id??null,u=o?.firstName??``,f=o?.lastName??``,m=b(),h=p.use.activeAssistantId(),g=d(),_=oe()&&!le(),v=M.use.stringFlags().preChatOnboardingExperiment20260606??`control`,y=(M.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,E=M.use.selfIntroGreeting(),O=me(v),k=ge()??O,A=k===he.paredDown,ee=g?at():null,te=nt(),{currentStep:ne,setCurrentStep:re,clearPersistedStep:j}=rt(l,m),N=T.use.platformSession(),P=S(N),[F,I]=(0,W.useState)(()=>new Set),[L,R]=(0,W.useState)(()=>new Set),[se,ce]=(0,W.useState)(()=>new Set),{value:z,onChange:de}=Ue(g&&!P?``:u||f),[B,V]=(0,W.useState)(null),[H]=(0,W.useState)(()=>Te()),[U,_e]=(0,W.useState)(``),[ye,K]=(0,W.useState)(!1),[xe,q]=(0,W.useState)([]),{data:Ce}=a({...ue(),enabled:!c&&s&&(!g||P)}),{data:we,isLoading:De}=a({queryKey:[`onboarding-recipe`,l],queryFn:ve,enabled:!c&&s&&!m&&!g,staleTime:1/0}),ke=we??null,je=Ce?.id??h??ee,J=Ye({localMode:g,platformSession:N,hasCachedPlatformAssistant:ee!==null}),Y=J,Me=J,Ne=async()=>{await x.checkAssistant(),e(`${D.assistant}?onboarding=1`,{replace:!0})};function Pe(e,t=k){i||pe(e,{userId:l,variant:fe(t)})}let Le=[...F].some(e=>Ie.has(e)),X=m?Ze():Xe({paredDown:A,canOfferPriorAssistants:Me,canOfferGoogleStep:i?!1:Y,hasGoogleTool:Le,showIOSAppStep:_});function ze(t){if(i){e(-1);return}ae(Je({mode:m?`native`:A?`paredDown`:`control`,recipe:m?null:ke,selectedTools:F,selectedTasks:L,selectedPriorAssistants:t?.selectedPriorAssistants??se,tone:B??ke?.tone??`grounded`,userName:z,assistantName:U,selfIntroGreetingEnabled:E,activationFlowEnabled:m?void 0:y,googleConnected:ye,googleScopes:xe,connectedScopes:t?.connectedScopes}));let n=U.trim();n&&ie(n),m?(j(),e(D.onboarding.privacy)):(x.markExpectingFirstMessage(),Ne())}let Z=(e,t)=>{e.funnelStep&&Pe(e.funnelStep);let n=et(X,e.id);n?re(n):ze(t)},Q=e=>{let t=tt(X,e.id);t&&re(t)};if(!te||De)return null;let $=X.find(e=>e.id===ne)??X[0];return $?$.id===`nativeName`?(0,G.jsx)(Oe,{userName:z,assistantName:U,displayedAssistantNames:H,onUserNameChange:de,onAssistantNameChange:_e,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:it}):$.id===`nativeVibe`?(0,G.jsx)(He,{selectedGroupId:B,onGroupChange:V,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:it}):$.id===`name`?(0,G.jsx)(Ee,{userName:z,assistantName:U,selectedGroupId:B,displayedAssistantNames:H,onUserNameChange:de,onAssistantNameChange:_e,onGroupChange:V,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,G.jsx)(Fe,{selectedTasks:L,onChange:R,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,G.jsx)(Re,{selectedTools:F,onChange:I,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,G.jsx)(Ae,{selectedAssistants:se,onChange:ce,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;ce(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?je?(0,G.jsx)(Se,{assistantId:je,assistantName:U,onConnect:e=>{K(!0),q(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,G.jsx)(be,{onComplete:()=>Z($)}):null:null}export{ot as PreChatFlow};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./button-C68o-wep.js";import{t as l}from"./card-CL5iEMJO.js";import{t as u}from"./input-Cu3PPVCq.js";import{f as d,l as f,n as p,s as m}from"./resolved-assistants-store-B5ATyCT9.js";import{t as h}from"./is-electron-CavSPgmY.js";import{t as g}from"./chevron-left-IaM5LZKa.js";import{t as _}from"./loader-circle-C563RcPZ.js";import{t as v}from"./pencil-72cxzUyZ.js";import{t as y}from"./x-D1JFrRas.js";import{O as b,U as x,W as S,a as C,i as w,n as T}from"./auth-store-C4gcHOWH.js";import{t as E}from"./client.gen-BchW2Z6T.js";import{i as D}from"./routes-VcLWbBmh.js";import{t as O}from"./public-asset-BX5-xa7f.js";import{D as k,Dt as ee,F as te,I as ne,L as re,Lr as A,Mr as j,O as M,Pr as N,R as P,c as F,dr as ie,eo as I,fr as ae,it as L,ka as R,l as oe,lr as se,o as ce,rt as z,s as le,st as ue,ur as de,wt as B}from"./index-87hTkD_v.js";import{t as V}from"./onboarding-layout-BAx3atHc.js";import{c as fe,i as pe,n as H,o as me,r as he,s as ge,t as U}from"./step-indicator-dots-C_x0ZHGS.js";import{t as _e}from"./use-oauth-complete-deep-link-listener-DnDBZsXG.js";var W=e(t(),1);async function ve(){try{let{data:e,response:t}=await E.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 G=s(),ye=[{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 be({onComplete:e}){function t(){F(),ce(),e()}return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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,G.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,G.jsx)(`rect`,{x:`5`,y:`2`,width:`14`,height:`20`,rx:`3`}),(0,G.jsx)(`line`,{x1:`12`,y1:`18`,x2:`12`,y2:`18.01`})]})}),(0,G.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,G.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,G.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,G.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,G.jsx)(`ul`,{className:`space-y-4`,children:ye.map((e,t)=>(0,G.jsxs)(`li`,{className:`flex items-start gap-3`,style:{animation:`fadeInUp 0.3s ease-out ${.25+t*.05}s both`},children:[(0,G.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,G.jsx)(I,{size:12,style:{color:`var(--system-positive-strong)`}})}),(0,G.jsxs)(`span`,{className:`text-left`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default`,style:{color:`var(--content-default)`},children:e.label}),(0,G.jsxs)(`span`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[` — `,e.detail]})]})]},e.label))})}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.45s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var K=`google`,xe=[{id:`gmail`,label:`Gmail`,logoSrc:O(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:O(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:O(`/images/integrations/google-drive.svg`)}];function Se({assistantId:e,assistantName:t,onConnect:n,onSkip:r,onBack:a}){let s=h(),l=i(),u=b(),d=(0,W.useRef)(null),f=(0,W.useRef)(null),p=(0,W.useRef)(null),m=(0,W.useRef)(null),v=(0,W.useRef)(null),y=(0,W.useRef)(null),x=(0,W.useRef)(null),[S,C]=(0,W.useState)(!1),w=(0,W.useCallback)(()=>{f.current=null,C(!1)},[]),T=(0,W.useCallback)(()=>{v.current&&=(window.removeEventListener(`message`,v.current),null),y.current&&=(window.removeEventListener(`storage`,y.current),null)},[]),E=(0,W.useCallback)(()=>{d.current&&!d.current.closed&&d.current.close(),d.current=null,p.current&&=(clearInterval(p.current),null),m.current&&=(clearTimeout(m.current),null)},[]),O=o({...ee()});(0,W.useEffect)(()=>()=>{p.current&&clearInterval(p.current),m.current&&clearTimeout(m.current),d.current&&!d.current.closed&&d.current.close(),v.current&&window.removeEventListener(`message`,v.current),y.current&&window.removeEventListener(`storage`,y.current),x.current&&=(x.current(),null)},[]);let k=(0,W.useCallback)(async()=>{try{return(await l.fetchQuery({...B({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===K&&e.connected)??null}catch{return null}},[e,l]),A=(0,W.useCallback)(async()=>{E(),w(),n((await k())?.scopes_granted??[])},[w,E,k,n]),j=(0,W.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!f.current||e.requestId!==f.current.requestId||(e.oauthStatus===`connected`?A():(E(),w())))},[w,E,A]),M=(0,W.useCallback)(e=>{let t=f.current;if(!t)return;let n=te(e,window.location.origin,t.requestId);n&&j(n)},[j]),N=(0,W.useCallback)(e=>{let t=f.current;if(!t)return;let n=ne(e,t.requestId);n&&(j(n),window.localStorage.removeItem(P(t.requestId)))},[j]);_e((0,W.useCallback)(e=>{let t=f.current;t&&e.requestId===t.requestId&&j({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[j]));let F=(0,W.useCallback)(()=>{let t=crypto.randomUUID();if(T(),v.current=M,y.current=N,u){C(!0),f.current={requestId:t},O.mutate({path:{assistant_id:e,provider:K},body:{requested_scopes:[],redirect_after_connect:`${D.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){z(e.connect_url)},onError(){w()}}),window.addEventListener(`message`,M),window.addEventListener(`storage`,N),x.current&&x.current();let n=L(()=>{if(!f.current){n(),x.current=null;return}(async()=>{let e=await k();f.current&&(e?await A():w(),T(),n(),x.current=null)})()});x.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){T();return}d.current=n,C(!0),f.current={requestId:t},window.addEventListener(`message`,M),window.addEventListener(`storage`,N),p.current=setInterval(()=>{d.current&&d.current.closed&&f.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=f.current;if(!e)return;let t=window.localStorage.getItem(P(e.requestId));if(t)try{let n=JSON.parse(t);if(re(n,e.requestId)){j(n),window.localStorage.removeItem(P(e.requestId)),T();return}}catch{}let n=await k();f.current&&(n?await A():(E(),w()),T())},1e3))},100),O.mutate({path:{assistant_id:e,provider:K},body:{requested_scopes:[],redirect_after_connect:`${D.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){d.current&&!d.current.closed?d.current.location.href=e.connect_url:f.current&&(E(),w(),T())},onError(){E(),w(),T()}})},[e,w,E,k,j,M,N,A,u,T,O]),ie=t||`your assistant`,I=t||`Your assistant`;return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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,G.jsx)(`button`,{type:`button`,onClick:a,"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,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${s?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Connect Google`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.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, ${ie} can use Gmail, Calendar, and Drive with your permission.`}),(0,G.jsx)(`div`,{className:`mt-6 flex items-stretch justify-center gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:xe.map(e=>(0,G.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,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:28,height:28,className:`h-7 w-7 object-contain`,loading:`eager`}),(0,G.jsx)(`span`,{className:`text-center text-xs leading-tight text-[var(--content-tertiary)]`,children:e.label})]},e.id))}),(0,G.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:`${I} will never send email, change calendar events, or edit files without your permission. You can disconnect at any time.`}),(0,G.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,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:F,disabled:S||O.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:S||O.isPending?(0,G.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,G.jsx)(_,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization...`]}):`Connect Google`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:r,disabled:S||O.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}var q=[{id:`grounded`,label:`Grounded`,descriptor:`Calm and precise`,tagline:`Measured. No filler.`,names:[`Penn`,`Sage`,`Atlas`,`Orion`,`Reed`,`Quill`]},{id:`warm`,label:`Warm`,descriptor:`Warm and easy`,tagline:`Friendly and casual.`,names:[`Kit`,`Remy`,`Wren`,`Milo`,`Fenn`,`Cleo`]},{id:`energetic`,label:`Energetic`,descriptor:`Fast and direct`,tagline:`Brief. To the point.`,names:[`Nova`,`Ember`,`Cade`,`Lark`,`Vela`,`Ziggy`]},{id:`poetic`,label:`Poetic`,descriptor:`Quiet and observant`,tagline:`Listens, then replies.`,names:[`Luna`,`Iris`,`Vesper`,`Lyra`,`Juno`,`Ada`]}],Ce=6;function we(){return q.flatMap(e=>e.names)}function Te(){let e=we(),t=Math.min(Ce,e.length);for(let n=0;n<t;n+=1){let t=n+Math.floor(Math.random()*(e.length-n)),r=e[n];e[n]=e[t],e[t]=r}return e.slice(0,t)}function Ee({userName:e,assistantName:t,selectedGroupId:n,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onGroupChange:o,onBack:s,onComplete:l,onSkip:d}){let f=h();return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.jsxs)(`div`,{className:`grid w-full items-center ${s?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[s?(0,G.jsx)(`button`,{type:`button`,onClick:s,"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,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${f?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Let's get to know each other.`}),s?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.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,G.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,G.jsx)(u,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>i(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(u,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:r.map(e=>{let n=e===t;return(0,G.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,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Pick a vibe`}),(0,G.jsx)(`div`,{className:`grid grid-cols-2 gap-2`,children:q.map(e=>(0,G.jsx)(De,{group:e,isActive:n===e.id,onToggle:()=>o(n===e.id?null:e.id)},e.id))})]})]}),(0,G.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,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:l,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,G.jsx)(c,{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,G.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,G.jsx)(`span`,{className:`text-body-medium-default ${t?`text-[var(--content-inset)]`:`text-[var(--content-default)]`}`,children:e.descriptor}),(0,G.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:n,onUserNameChange:r,onAssistantNameChange:i,onBack:a,onContinue:o,onSkip:s,currentStep:l,totalSteps:d}){return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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:[a?(0,G.jsx)(c,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:a,"aria-label":`Back`}):(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(U,{current:l,total:d})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.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,G.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,G.jsxs)(`div`,{className:`mt-8 flex w-full flex-col gap-6`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(u,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>r(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(u,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>i(e.target.value),fullWidth:!0}),(0,G.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`A few to try`}),(0,G.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:n.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>i(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,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:o,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Skip`})]})]})})}var ke=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:O(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:O(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:O(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:O(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:O(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:O(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:O(`/images/prior-assistants/copilot.svg`)}];function Ae({selectedAssistants:e,onChange:t,onBack:n,onContinue:r,onSkip:i}){let a=h(),[o,s]=(0,W.useState)(()=>J(e)),[d,f]=(0,W.useState)(()=>o.length>0),p=(0,W.useRef)(Y(e));(0,W.useEffect)(()=>{let t=Y(e);if(t===p.current)return;let n=J(e);s(n),f(e=>e||n.length>0),p.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of o.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}je(n,e)||(p.current=Y(n),t(n))},[o]);let m=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return o.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[o]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${a?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.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,G.jsx)(`button`,{type:`button`,onClick:n,"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,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`Have you used any of these?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${a?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`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,G.jsxs)(`div`,{className:`${a?`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,G.jsx)(Me,{assistant:t,selected:e.has(t.id),onToggle:()=>m(t.id)},t.id)),d?null:(0,G.jsx)(Ne,{onClick:()=>f(!0)})]}),d?(0,G.jsx)(l,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),s(``)},"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,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(u,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:o,onChange:e=>s(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.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,G.jsxs)(`div`,{className:`${a?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`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 J(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Me({assistant:e,selected:t,onToggle:n}){return(0,G.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,G.jsx)(Pe,{assistant:e,size:32}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:e.label}),t?(0,G.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,G.jsx)(I,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Ne({onClick:e}){return(0,G.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,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(R,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.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,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.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,G.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:n,onContinue:r,onSkip:i}){let a=h(),o=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${a?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.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,G.jsx)(`button`,{type:`button`,onClick:n,"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,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What are you working on?`}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsx)(`p`,{className:`${a?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`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,G.jsx)(`div`,{className:`${a?`mt-6`:`mt-8`} flex w-full flex-col ${a?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:k.map(t=>{let n=M[t.iconKey],r=e.has(t.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>o(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${a?`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,G.jsx)(`div`,{className:`flex w-6 shrink-0 items-center justify-center text-[var(--content-secondary)]`,children:n?(0,G.jsx)(n,{className:`h-4 w-4`}):null}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:t.label}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t.sublabel})]}),(0,G.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,G.jsx)(I,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,G.jsxs)(`div`,{className:`${a?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`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:O(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:O(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:O(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:O(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:O(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:O(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:O(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:O(`/images/integrations/github.svg`),logoSrcDark:O(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:O(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:O(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:O(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:O(`/images/integrations/apple-notes.svg`)}];function X(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:n,onContinue:r,onSkip:i}){let a=h(),[o,s]=(0,W.useState)(()=>Z(e)),[d,f]=(0,W.useState)(()=>o.length>0),p=(0,W.useRef)(Q(e));(0,W.useEffect)(()=>{let t=Q(e);if(t===p.current)return;let n=Z(e);s(n),f(e=>e||n.length>0),p.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of o.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(p.current=Q(n),t(n))},[o]);let m=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)},_=(0,W.useMemo)(()=>{let e=new Set;return o.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[o]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${a?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${n?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[n?(0,G.jsx)(`button`,{type:`button`,onClick:n,"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,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${a?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),n?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`${a?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${a?`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,G.jsxs)(`div`,{className:`grid w-full gap-2 ${a?`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,G.jsx)($,{tool:t,selected:e.has(t.id),onToggle:()=>m(t.id),electron:a},t.id)),d?null:(0,G.jsx)(Be,{onClick:()=>f(!0),electron:a})]}),d?(0,G.jsx)(l,{padding:a?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col ${a?`gap-2`:`gap-3`}`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(v,{className:`h-3.5 w-3.5 text-[var(--content-secondary)]`,"aria-hidden":`true`}),(0,G.jsx)(`span`,{className:`text-body-medium-default prechat-md-regular text-[var(--content-default)]`,children:`Something else`}),(0,G.jsx)(`button`,{type:`button`,onClick:()=>{f(!1),s(``)},"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,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(u,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:o,onChange:e=>s(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),_.length>0?(0,G.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:_.map(e=>(0,G.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,G.jsxs)(`div`,{className:`${a?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:r,className:`${a?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`${a?`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 Z(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 $({tool:e,selected:t,onToggle:n,electron:r}){return(0,G.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,G.jsx)(Ve,{tool:e,size:32}),(0,G.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,G.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,G.jsx)(I,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Be({onClick:e,electron:t}){return(0,G.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,G.jsx)(`span`,{className:`flex h-8 w-8 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,G.jsx)(R,{className:`h-4 w-4 text-[var(--content-secondary)]`,"aria-hidden":`true`})}),(0,G.jsx)(`span`,{className:`line-clamp-2 text-center text-label-medium-default text-[var(--content-default)]`,children:`Something else`})]})}function Ve({tool:e,size:t}){if(e.logoSrc)return e.logoSrcDark?(0,G.jsxs)(G.Fragment,{children:[(0,G.jsx)(`span`,{className:`flex items-center justify-center dark:hidden`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrc,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})}),(0,G.jsx)(`span`,{className:`hidden items-center justify-center dark:flex`,style:{width:t,height:t},"aria-hidden":`true`,children:(0,G.jsx)(`img`,{src:e.logoSrcDark,alt:``,width:t,height:t,className:`max-h-full max-w-full object-contain`,loading:`eager`})})]}):(0,G.jsx)(`span`,{className:`flex items-center justify-center`,style:{width:t,height:t},children:(0,G.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,G.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 He({selectedGroupId:e,onGroupChange:t,onBack:n,onContinue:r,onSkip:i,currentStep:a,totalSteps:o}){return(0,G.jsx)(V,{showCreatureFooter:!1,children:(0,G.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,G.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,G.jsx)(c,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:n,"aria-label":`Back`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(U,{current:a,total:o})}),(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`})]}),(0,G.jsxs)(`div`,{className:`flex flex-1 flex-col items-center pt-4`,children:[(0,G.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,G.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,G.jsx)(`div`,{className:`mt-8 flex w-full flex-col gap-3`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:q.map(n=>{let r=e===n.id;return(0,G.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,G.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:n.descriptor}),(0,G.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,G.jsx)(`span`,{className:`h-2.5 w-2.5 rounded-full bg-[var(--content-default)]`})})]},n.id)})})]}),(0,G.jsxs)(`div`,{className:`flex w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(c,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:r,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(c,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ue(e){let[t,n]=(0,W.useState)(()=>(e??``).trim()),r=(0,W.useRef)(!1);return(0,W.useEffect)(()=>{if(r.current)return;let t=(e??``).trim();t&&n(e=>e||t)},[e]),{value:t,onChange:(0,W.useCallback)(e=>{r.current=!0,n(e)},[])}}var We=[`gmail`,`google-calendar`,`google-drive`],Ge=`experiment-activation-flow-2026-06-03`,Ke=`BOOTSTRAP-ACTIVATION-RAIL.md`;function qe(e,t,n){return t?.initialMessage?t.initialMessage:n?de(e):se}function Je(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?[...We]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:X([...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=Ge,i.bootstrapTemplate=Ke);let a=e.userName.trim();a&&(i.userName=a);let o=e.assistantName.trim();return o&&(i.assistantName=o),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=X([...e.selectedPriorAssistants])),i.initialMessage=qe(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function Ye(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Xe(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:H.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:H.controlWorkType,enabled:!t},{id:`tools`,funnelStep:H.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:H.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?H.gmailConnect:H.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:H.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ze(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Qe=`1`;function $e(e){return e===`nativeVibe`||e===Qe?`nativeVibe`:null}function et(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function tt(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function nt(){let e=n(),t=b(),r=A()&&N();return(0,W.useEffect)(()=>{!r&&!t&&e(D.onboarding.privacy,{replace:!0})},[r,t,e]),t||r}function rt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,W.useState)(()=>t?`nativeName`:`name`),a=(0,W.useCallback)(e=>{if(n)try{e===null?sessionStorage.removeItem(n):sessionStorage.setItem(n,e)}catch{}},[n]);return(0,W.useLayoutEffect)(()=>{if(n)try{let e=$e(sessionStorage.getItem(n));e&&i(e)}catch{}},[n]),(0,W.useEffect)(()=>{t&&a(r===`nativeVibe`?`nativeVibe`:null)},[t,r,a]),{currentStep:r,setCurrentStep:i,clearPersistedStep:(0,W.useCallback)(()=>{a(null)},[a])}}var it=3;function at(){let e=f();return e?.cloud===`vellum`?e.assistantId:m()[0]?.assistantId??null}function ot(){let e=n(),[t]=r(),i=t.get(`preview`)===`true`,o=T.use.user(),s=w(),c=C(),l=o?.id??null,u=o?.firstName??``,f=o?.lastName??``,m=b(),h=p.use.activeAssistantId(),g=d(),_=oe()&&!le(),v=j.use.stringFlags().preChatOnboardingExperiment20260606??`control`,y=(j.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,E=j.use.selfIntroGreeting(),O=me(v),k=ge()??O,ee=k===he.paredDown,te=g?at():null,ne=nt(),{currentStep:re,setCurrentStep:A,clearPersistedStep:M}=rt(l,m),N=T.use.platformSession(),P=S(N),[F,I]=(0,W.useState)(()=>new Set),[L,R]=(0,W.useState)(()=>new Set),[se,ce]=(0,W.useState)(()=>new Set),{value:z,onChange:de}=Ue(g&&!P?``:u||f),[B,V]=(0,W.useState)(null),[H]=(0,W.useState)(()=>Te()),[U,_e]=(0,W.useState)(``),[ye,K]=(0,W.useState)(!1),[xe,q]=(0,W.useState)([]),{data:Ce}=a({...ue(),enabled:!c&&s&&(!g||P)}),{data:we,isLoading:De}=a({queryKey:[`onboarding-recipe`,l],queryFn:ve,enabled:!c&&s&&!m&&!g,staleTime:1/0}),ke=we??null,je=Ce?.id??h??te,J=Ye({localMode:g,platformSession:N,hasCachedPlatformAssistant:te!==null}),Y=J,Me=J,Ne=async()=>{await x.checkAssistant(),e(`${D.assistant}?onboarding=1`,{replace:!0})};function Pe(e,t=k){i||pe(e,{userId:l,variant:fe(t)})}let Le=[...F].some(e=>Ie.has(e)),X=m?Ze():Xe({paredDown:ee,canOfferPriorAssistants:Me,canOfferGoogleStep:i?!1:Y,hasGoogleTool:Le,showIOSAppStep:_});function ze(t){if(i){e(-1);return}ae(Je({mode:m?`native`:ee?`paredDown`:`control`,recipe:m?null:ke,selectedTools:F,selectedTasks:L,selectedPriorAssistants:t?.selectedPriorAssistants??se,tone:B??ke?.tone??`grounded`,userName:z,assistantName:U,selfIntroGreetingEnabled:E,activationFlowEnabled:m?void 0:y,googleConnected:ye,googleScopes:xe,connectedScopes:t?.connectedScopes}));let n=U.trim();n&&ie(n),m?(M(),e(D.onboarding.privacy)):(x.markExpectingFirstMessage(),Ne())}let Z=(e,t)=>{e.funnelStep&&Pe(e.funnelStep);let n=et(X,e.id);n?A(n):ze(t)},Q=e=>{let t=tt(X,e.id);t&&A(t)};if(!ne||De)return null;let $=X.find(e=>e.id===re)??X[0];return $?$.id===`nativeName`?(0,G.jsx)(Oe,{userName:z,assistantName:U,displayedAssistantNames:H,onUserNameChange:de,onAssistantNameChange:_e,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:it}):$.id===`nativeVibe`?(0,G.jsx)(He,{selectedGroupId:B,onGroupChange:V,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:it}):$.id===`name`?(0,G.jsx)(Ee,{userName:z,assistantName:U,selectedGroupId:B,displayedAssistantNames:H,onUserNameChange:de,onAssistantNameChange:_e,onGroupChange:V,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,G.jsx)(Fe,{selectedTasks:L,onChange:R,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,G.jsx)(Re,{selectedTools:F,onChange:I,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,G.jsx)(Ae,{selectedAssistants:se,onChange:ce,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;ce(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?je?(0,G.jsx)(Se,{assistantId:je,assistantName:U,onConnect:e=>{K(!0),q(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,G.jsx)(be,{onComplete:()=>Z($)}):null:null}export{ot as PreChatFlow};
|
|
@@ -1 +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{T as s}from"./portal-container-DIXEBWUe.js";import{n as c}from"./QueryClientProvider-DKhXIxGb.js";import{t as l}from"./useQuery-B45lW1Kk.js";import{t as u}from"./useMutation-Lj4VunQV.js";import{t as d}from"./jsx-runtime-CVSDxk6A.js";import{t as f}from"./cn-DFqQkJlk.js";import{t as p}from"./button-C68o-wep.js";import{t as m}from"./card-CL5iEMJO.js";import{t as h}from"./dropdown-CocFV5yi.js";import{t as g}from"./confirm-dialog-94QFOD8a.js";import{t as _}from"./notice-CF2pptne.js";import{t as v}from"./tag-Ccr7Quy6.js";import{t as y}from"./input-Cu3PPVCq.js";import{t as b}from"./toggle-CEm3M86o.js";import{n as x}from"./toast-BL8OPiip.js";import{t as S}from"./chevron-right-C1TiR5qP.js";import{t as C}from"./loader-circle-C563RcPZ.js";import{t as w}from"./pencil-72cxzUyZ.js";import{t as T}from"./x-D1JFrRas.js";import{C as E,O as D,S as O,b as k,d as A,r as ee,v as te,w as ne,x as j,y as M}from"./auth-store-BDBEYGBC.js";import{t as re}from"./sdk.gen-ClmX029Q.js";import{Bn as ie,Dn as N,En as ae,Gn as oe,Kn as se,Ni as P,Qa as ce,S as le,Tn as ue,at as de,b as fe,d as F,f as I,ot as L,p as R,qn as z,u as B,x as V,xi as pe}from"./index-Ue-r3LET.js";import{t as H}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as U}from"./detail-card-BOk0V4_4.js";var W=e(o(),1),G=d(),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.`}],me=[{id:`notificationBadges`,type:`local`,label:`Notification Badges`,description:`Allows your assistant to show unseen conversation counts on the Dock icon.`}];function he(){let[e,t]=(0,W.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function ge(){let[e,r]=(0,W.useState)(()=>n(`dockBadgesEnabled`,!0));return(0,W.useEffect)(()=>a(`dockBadgesEnabled`,()=>{r(n(`dockBadgesEnabled`,!0))}),[]),[e,e=>{r(e),t(`dockBadgesEnabled`,e),e||ie(0)}]}function _e({row:e,onToggle:t}){return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(b,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:f(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,G.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,G.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,G.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function ve(){return(0,G.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 ye({compact:e=!1}){let{state:t,loading:n,error:r,supported:i,refresh:a}=z(),{pendingKind:o,run:s}=he(),[c,l]=ge(),u=(0,W.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,W.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=me.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 oe(e.sourceKind):await se(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,G.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,G.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:`System Permissions`}),n&&d.length===0?(0,G.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,G.jsx)(ve,{}),`Checking permissions...`]}):(0,G.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,G.jsx)(_e,{row:e,onToggle:p},e.id))}),r&&(0,G.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=ue(),n=ae(),r=c(),{data:i,isLoading:a,isError:o}=l({...de(),enabled:e===`full`&&t}),s=u({mutationFn:async e=>{let{data:t}=await re({body:{access_consented:e},throwOnError:!0});return t},onSuccess:e=>{r.setQueryData(L(),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 d=e===`full`&&n,f=i?.access_consented??!1,p=e!==`full`||!t||a||o||s.isPending;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Allow admin access to assistant data`}),(0,G.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,G.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,G.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:`Failed to load consent setting.`})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:e===`disabled`?null:(0,G.jsxs)(G.Fragment,{children:[(s.isPending||d)&&(0,G.jsx)(C,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,G.jsx)(b,{checked:f,disabled:p,onChange:()=>s.mutate(!f)})]})})]}),e===`disabled`&&(0,G.jsx)(_,{tone:`info`,className:`mt-3`,children:`Log in to the Vellum platform to manage admin data access.`})]})}function xe(){let e=D(),[t,n]=(0,W.useState)(()=>j()),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`Face ID`),[s,c]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{e&&(k().then(i),M().then(o))},[e]),!e||!r)return null;let l=async()=>{c(!0);try{if(t)O(!1),await te(),n(!1);else{let e=ne();e&&await E(e),O(!0),n(!0)}}finally{c(!1)}};return(0,G.jsx)(U,{title:`Security`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Use `,a,` for sign-in`]}),(0,G.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,G.jsx)(b,{checked:t,onChange:()=>void l(),disabled:s})]})})}function q(){return(0,G.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}var J=B.map(e=>({value:e.id,label:e.label,icon:(0,G.jsx)(e.icon,{className:`h-3.5 w-3.5`})}));function Se(){let e=H(),t=c(),{data:n,isError:r}=l({queryKey:[`thresholds`,e],queryFn:()=>I(e),staleTime:3e4}),[i,a]=(0,W.useState)(`relaxed`),[o,s]=(0,W.useState)(`conservative`),[u,d]=(0,W.useState)(`strict`),[f,p]=(0,W.useState)(!1),g=(0,W.useRef)(!1),[_,v]=(0,W.useState)(!1),y=(0,W.useRef)(null),b=(0,W.useRef)(null);(0,W.useEffect)(()=>{!n||g.current||(a(F(n.interactive).id),s(F(n.autonomous).id),d(F(n.headless).id),v(!0))},[n]),(0,W.useEffect)(()=>()=>{y.current!==null&&(clearTimeout(y.current),y.current=null,b.current?.(),b.current=null)},[]);let x=(0,W.useCallback)((n,r,i)=>{if(!e||!_)return;let a=B.find(e=>e.id===n)?.riskThreshold,o=B.find(e=>e.id===r)?.riskThreshold,s=B.find(e=>e.id===i)?.riskThreshold;!a||!o||!s||R(e,{interactive:a,autonomous:o,headless:s}).then(()=>{t.invalidateQueries({queryKey:[`thresholds`,e]})}).catch(()=>{})},[e,_,t]),C=(0,W.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,W.useCallback)(e=>{g.current=!0,a(e),C(e,o,u)},[o,u,C]),T=(0,W.useCallback)(e=>{g.current=!0,s(e),C(i,e,u)},[i,u,C]),E=(0,W.useCallback)(e=>{g.current=!0,d(e),C(i,o,e)},[i,o,C]),D=B.find(e=>e.id===i),O=B.find(e=>e.id===o),k=B.find(e=>e.id===u),A=!e||!_;return(0,G.jsxs)(m,{children:[(0,G.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Risk Tolerance`}),(0,G.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,G.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,G.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Conversations`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When you're chatting with your assistant directly.`}),(0,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:i,onChange:w,options:J,disabled:A})}),D&&(0,G.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:D.description})]}),(0,G.jsx)(q,{}),(0,G.jsxs)(`div`,{children:[(0,G.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,G.jsx)(ce,{className:`h-4 w-4`}):(0,G.jsx)(S,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`text-body-medium-default`,children:`Advanced`})]}),(0,G.jsxs)(`div`,{className:f?`mt-4 space-y-4`:`hidden`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Background`}),(0,G.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,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:o,onChange:T,options:J,disabled:A})}),O&&(0,G.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:O.description})]}),(0,G.jsx)(q,{}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Headless`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When triggered externally with no interactive client.`}),(0,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:u,onChange:E,options:J,disabled:A})}),k&&(0,G.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:k.description})]})]})]})]})]})}var Y=e(s(),1),Ce=[`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 Te({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let i=(0,W.useRef)(null),[a,o]=(0,W.useState)(t.tool),[s,c]=(0,W.useState)(t.pattern),[l,u]=(0,W.useState)(t.risk),[d,f]=(0,W.useState)(t.description??``),[p,m]=(0,W.useState)(!1),[g,v]=(0,W.useState)(null),b=s.trim(),x=b.length>0&&!p,S=(0,W.useCallback)(async n=>{if(n.preventDefault(),!x)return;let i=d.trim()||`${a} — ${b}`;m(!0),v(null);try{await le(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,G.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,W.useCallback)(e=>{e.key===`Escape`&&n()},[n]),onClick:(0,W.useCallback)(e=>{e.target===i.current&&n()},[n]),children:(0,G.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,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,G.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Edit Trust Rule`}),(0,G.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,G.jsx)(T,{className:`h-4 w-4`})})]}),(0,G.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,G.jsx)(_,{tone:`error`,children:g}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`Tool`}),(0,G.jsx)(`div`,{className:`mt-1`,children:(0,G.jsx)(h,{value:a,onChange:o,disabled:!0,options:Ce.map(e=>({value:e,label:e}))})})]}),(0,G.jsx)(y,{label:`Pattern`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g., git *`,disabled:!0}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Risk Level`}),(0,G.jsx)(`div`,{className:`mt-2 flex gap-2`,children:we.map(e=>(0,G.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,G.jsx)(`div`,{children:e.label}),(0,G.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,G.jsx)(y,{label:`Description (optional)`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`${a} — ${b||`pattern`}`}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.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,G.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 Ee(e){return e.origin===`default`&&!e.userModified}function X(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 De(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 Oe({assistantId:e,onClose:t}){let n=(0,W.useRef)(null),[r,i]=(0,W.useState)([]),[a,o]=(0,W.useState)(!0),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null),[m,h]=(0,W.useState)(!1),y=(0,W.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([V(e),V(e,{origin:`default`})]);return X(t,n)}return V(e)},[e]),x=(0,W.useCallback)(async()=>{o(!0);try{i(await y(m)),c(null)}catch(e){c(e instanceof Error?e.message:`Failed to load trust rules.`)}finally{o(!1)}},[y,m]);(0,W.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let t=await y(m);e||(i(t),c(null))}catch(t){e||c(t instanceof Error?t.message:`Failed to load trust rules.`)}finally{e||o(!1)}})(),()=>{e=!0}},[y,m]);let S=(0,W.useCallback)(async()=>{if(d)try{await fe(e,d.id),x()}catch(e){c(e instanceof Error?e.message:`Failed to delete trust rule.`)}finally{f(null)}},[e,d,x]);return(0,Y.createPortal)((0,G.jsxs)(G.Fragment,{children:[(0,G.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,W.useCallback)(e=>{e.key===`Escape`&&t()},[t]),onClick:(0,W.useCallback)(e=>{e.target===n.current&&t()},[t]),children:(0,G.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,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,G.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(b,{checked:m,onChange:h,label:`Show all defaults`}),(0,G.jsx)(p,{variant:`outlined`,onClick:t,children:`Done`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[s&&(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(_,{tone:`error`,children:s})}),a?(0,G.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`}):r.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,G.jsx)(P,{className:`h-8 w-8`}),(0,G.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,G.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(e=>{let t=Ee(e);return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,G.jsx)(v,{tone:De(e.risk),children:Z(e.risk)}),e.origin===`default`&&(0,G.jsx)(v,{tone:`neutral`,children:`Default`}),e.userModified&&(0,G.jsx)(v,{tone:`warning`,children:`Modified`})]}),(0,G.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.tool} rule`,onClick:()=>u(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,G.jsx)(w,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Delete ${e.tool} rule`,onClick:()=>f(e),className:`rounded-lg p-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:(0,G.jsx)(pe,{className:`h-4 w-4`})})]})]},e.id)})})]})]})}),l&&(0,G.jsx)(Te,{assistantId:e,existingRule:l,onClose:()=>u(null),onSaved:()=>{u(null),x()}}),(0,G.jsx)(g,{open:d!==null,title:`Delete Trust Rule?`,message:d?`Remove the ${Z(d.risk).toLowerCase()}-risk rule for ${d.tool} matching "${d.pattern}"?`:``,confirmLabel:`Delete`,cancelLabel:`Cancel`,destructive:!0,onConfirm:()=>void S(),onCancel:()=>f(null)})]}),document.body)}function ke(){let e=H(),[t,n]=(0,W.useState)(!1);return(0,G.jsxs)(m,{children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(P,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,G.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,G.jsx)(p,{variant:`outlined`,onClick:()=>n(!0),children:`Manage`})]}),t&&(0,G.jsx)(Oe,{assistantId:e,onClose:()=>n(!1)})]})}var Ae=[{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`}],je=`thirtyDays`;function Q({label:e,helperText:t,checked:n,onChange:r}){return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e}),(0,G.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,G.jsx)(b,{checked:n,onChange:r,label:e})]})}function $(){return(0,G.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Me(){let e=N({platformHostedOnly:!0}),t=ee(),[a,o]=(0,W.useState)(()=>n(`shareAnalytics`,!0)),[s,c]=(0,W.useState)(()=>n(`shareDiagnostics`,!0)),[l,u]=(0,W.useState)(()=>i(`llmLogRetention`,je));return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(xe,{}),(0,G.jsx)(ye,{}),(0,G.jsx)(ke,{}),(0,G.jsx)(Se,{}),(0,G.jsx)(U,{title:`Privacy`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Q,{label:`Share Analytics`,helperText:`Send anonymous product usage data. Your conversations and personal data are never included.`,checked:a,onChange:()=>{let e=!a;o(e),A(`share_analytics`,e,t)}}),(0,G.jsx)($,{}),(0,G.jsx)(Q,{label:`Share Diagnostics`,helperText:`Send crash reports and performance metrics. Your conversations and personal data are never included.`,checked:s,onChange:()=>{let e=!s;c(e),A(`share_diagnostics`,e,t)}}),(0,G.jsx)($,{}),(0,G.jsx)(be,{}),e!==`gated`&&(0,G.jsx)($,{}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`LLM Request Log Retention`}),(0,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:l,onChange:e=>{u(e),r(`llmLogRetention`,e)},options:Ae})}),(0,G.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{Me as PrivacyPage};
|
|
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{T as s}from"./portal-container-DIXEBWUe.js";import{n as c}from"./QueryClientProvider-DKhXIxGb.js";import{t as l}from"./useQuery-B45lW1Kk.js";import{t as u}from"./useMutation-Lj4VunQV.js";import{t as d}from"./jsx-runtime-CVSDxk6A.js";import{t as f}from"./cn-DFqQkJlk.js";import{t as p}from"./button-C68o-wep.js";import{t as m}from"./card-CL5iEMJO.js";import{t as h}from"./dropdown-CocFV5yi.js";import{t as g}from"./confirm-dialog-94QFOD8a.js";import{t as _}from"./notice-CF2pptne.js";import{t as v}from"./tag-Ccr7Quy6.js";import{t as y}from"./input-Cu3PPVCq.js";import{t as b}from"./toggle-CEm3M86o.js";import{n as x}from"./toast-BL8OPiip.js";import{t as S}from"./chevron-right-C1TiR5qP.js";import{t as C}from"./loader-circle-C563RcPZ.js";import{t as w}from"./pencil-72cxzUyZ.js";import{t as T}from"./x-D1JFrRas.js";import{C as E,O as D,S as O,b as k,d as A,r as ee,v as te,w as ne,x as j,y as M}from"./auth-store-C4gcHOWH.js";import{t as re}from"./sdk.gen-ClmX029Q.js";import{$a as ie,Bn as ae,Dn as N,En as oe,Gn as se,Kn as ce,Ni as P,S as le,Tn as ue,at as de,b as fe,d as F,f as I,ot as L,p as R,qn as z,u as B,x as V,xi as pe}from"./index-87hTkD_v.js";import{t as H}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as U}from"./detail-card-BOk0V4_4.js";var W=e(o(),1),G=d(),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.`}],me=[{id:`notificationBadges`,type:`local`,label:`Notification Badges`,description:`Allows your assistant to show unseen conversation counts on the Dock icon.`}];function he(){let[e,t]=(0,W.useState)(null);return{pendingKind:e,run:async(e,n)=>{t(e);try{await n()}catch{}finally{t(t=>t===e?null:t)}}}}function ge(){let[e,r]=(0,W.useState)(()=>n(`dockBadgesEnabled`,!0));return(0,W.useEffect)(()=>a(`dockBadgesEnabled`,()=>{r(n(`dockBadgesEnabled`,!0))}),[]),[e,e=>{r(e),t(`dockBadgesEnabled`,e),e||ae(0)}]}function _e({row:e,onToggle:t}){return(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(b,{checked:e.checked,disabled:e.disabled,"aria-label":e.label,onChange:()=>t(e.id)}),(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:()=>t(e.id),className:f(`block w-full text-left`,e.disabled?`cursor-not-allowed`:`cursor-pointer`),children:[(0,G.jsx)(`span`,{className:`block text-[14px] font-semibold leading-[18px] text-[var(--content-emphasised)]`,children:e.label}),(0,G.jsx)(`span`,{className:`mt-1 block text-[13px] font-medium leading-[18px] text-[var(--content-tertiary)]`,children:e.description})]}),e.error&&(0,G.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:e.error})]})]})}function ve(){return(0,G.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 ye({compact:e=!1}){let{state:t,loading:n,error:r,supported:i,refresh:a}=z(),{pendingKind:o,run:s}=he(),[c,l]=ge(),u=(0,W.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,W.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=me.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 se(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,G.jsxs)(`section`,{className:`w-full rounded-[20px] border border-[var(--border-hover)] bg-[var(--surface-lift)] px-4 pb-3 pt-5`,children:[(0,G.jsx)(`h2`,{className:`text-[18px] font-semibold leading-[22px] text-[var(--content-emphasised)]`,children:`System Permissions`}),n&&d.length===0?(0,G.jsxs)(`div`,{className:`mt-6 flex items-center gap-2 text-body-medium-lighter text-[var(--content-tertiary)]`,children:[(0,G.jsx)(ve,{}),`Checking permissions...`]}):(0,G.jsx)(`div`,{className:`mt-3 space-y-2`,children:d.map(e=>(0,G.jsx)(_e,{row:e,onToggle:p},e.id))}),r&&(0,G.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=ue(),n=oe(),r=c(),{data:i,isLoading:a,isError:o}=l({...de(),enabled:e===`full`&&t}),s=u({mutationFn:async e=>{let{data:t}=await re({body:{access_consented:e},throwOnError:!0});return t},onSuccess:e=>{r.setQueryData(L(),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 d=e===`full`&&n,f=i?.access_consented??!1,p=e!==`full`||!t||a||o||s.isPending;return(0,G.jsxs)(`div`,{children:[(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Allow admin access to assistant data`}),(0,G.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,G.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,G.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--system-negative-strong)]`,children:`Failed to load consent setting.`})]}),(0,G.jsx)(`div`,{className:`flex items-center gap-2`,children:e===`disabled`?null:(0,G.jsxs)(G.Fragment,{children:[(s.isPending||d)&&(0,G.jsx)(C,{className:`h-4 w-4 animate-spin text-[var(--content-tertiary)]`}),(0,G.jsx)(b,{checked:f,disabled:p,onChange:()=>s.mutate(!f)})]})})]}),e===`disabled`&&(0,G.jsx)(_,{tone:`info`,className:`mt-3`,children:`Log in to the Vellum platform to manage admin data access.`})]})}function xe(){let e=D(),[t,n]=(0,W.useState)(()=>j()),[r,i]=(0,W.useState)(!1),[a,o]=(0,W.useState)(`Face ID`),[s,c]=(0,W.useState)(!1);if((0,W.useEffect)(()=>{e&&(k().then(i),M().then(o))},[e]),!e||!r)return null;let l=async()=>{c(!0);try{if(t)O(!1),await te(),n(!1);else{let e=ne();e&&await E(e),O(!0),n(!0)}}finally{c(!1)}};return(0,G.jsx)(U,{title:`Security`,children:(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsxs)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`Use `,a,` for sign-in`]}),(0,G.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,G.jsx)(b,{checked:t,onChange:()=>void l(),disabled:s})]})})}function q(){return(0,G.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}var J=B.map(e=>({value:e.id,label:e.label,icon:(0,G.jsx)(e.icon,{className:`h-3.5 w-3.5`})}));function Se(){let e=H(),t=c(),{data:n,isError:r}=l({queryKey:[`thresholds`,e],queryFn:()=>I(e),staleTime:3e4}),[i,a]=(0,W.useState)(`relaxed`),[o,s]=(0,W.useState)(`conservative`),[u,d]=(0,W.useState)(`strict`),[f,p]=(0,W.useState)(!1),g=(0,W.useRef)(!1),[_,v]=(0,W.useState)(!1),y=(0,W.useRef)(null),b=(0,W.useRef)(null);(0,W.useEffect)(()=>{!n||g.current||(a(F(n.interactive).id),s(F(n.autonomous).id),d(F(n.headless).id),v(!0))},[n]),(0,W.useEffect)(()=>()=>{y.current!==null&&(clearTimeout(y.current),y.current=null,b.current?.(),b.current=null)},[]);let x=(0,W.useCallback)((n,r,i)=>{if(!e||!_)return;let a=B.find(e=>e.id===n)?.riskThreshold,o=B.find(e=>e.id===r)?.riskThreshold,s=B.find(e=>e.id===i)?.riskThreshold;!a||!o||!s||R(e,{interactive:a,autonomous:o,headless:s}).then(()=>{t.invalidateQueries({queryKey:[`thresholds`,e]})}).catch(()=>{})},[e,_,t]),C=(0,W.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,W.useCallback)(e=>{g.current=!0,a(e),C(e,o,u)},[o,u,C]),T=(0,W.useCallback)(e=>{g.current=!0,s(e),C(i,e,u)},[i,u,C]),E=(0,W.useCallback)(e=>{g.current=!0,d(e),C(i,o,e)},[i,o,C]),D=B.find(e=>e.id===i),O=B.find(e=>e.id===o),k=B.find(e=>e.id===u),A=!e||!_;return(0,G.jsxs)(m,{children:[(0,G.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Risk Tolerance`}),(0,G.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,G.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,G.jsxs)(`div`,{className:`mt-4 space-y-4`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Conversations`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When you're chatting with your assistant directly.`}),(0,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:i,onChange:w,options:J,disabled:A})}),D&&(0,G.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:D.description})]}),(0,G.jsx)(q,{}),(0,G.jsxs)(`div`,{children:[(0,G.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,G.jsx)(ie,{className:`h-4 w-4`}):(0,G.jsx)(S,{className:`h-4 w-4`}),(0,G.jsx)(`span`,{className:`text-body-medium-default`,children:`Advanced`})]}),(0,G.jsxs)(`div`,{className:f?`mt-4 space-y-4`:`hidden`,children:[(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Background`}),(0,G.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,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:o,onChange:T,options:J,disabled:A})}),O&&(0,G.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:O.description})]}),(0,G.jsx)(q,{}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Headless`}),(0,G.jsx)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:`When triggered externally with no interactive client.`}),(0,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:u,onChange:E,options:J,disabled:A})}),k&&(0,G.jsx)(`p`,{className:`mt-2 text-body-small-default text-[var(--content-tertiary)]`,children:k.description})]})]})]})]})]})}var Y=e(s(),1),Ce=[`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 Te({assistantId:e,existingRule:t,onClose:n,onSaved:r}){let i=(0,W.useRef)(null),[a,o]=(0,W.useState)(t.tool),[s,c]=(0,W.useState)(t.pattern),[l,u]=(0,W.useState)(t.risk),[d,f]=(0,W.useState)(t.description??``),[p,m]=(0,W.useState)(!1),[g,v]=(0,W.useState)(null),b=s.trim(),x=b.length>0&&!p,S=(0,W.useCallback)(async n=>{if(n.preventDefault(),!x)return;let i=d.trim()||`${a} — ${b}`;m(!0),v(null);try{await le(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,G.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,W.useCallback)(e=>{e.key===`Escape`&&n()},[n]),onClick:(0,W.useCallback)(e=>{e.target===i.current&&n()},[n]),children:(0,G.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,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,G.jsx)(`h2`,{id:`trust-rule-form-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Edit Trust Rule`}),(0,G.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,G.jsx)(T,{className:`h-4 w-4`})})]}),(0,G.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,G.jsx)(_,{tone:`error`,children:g}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`trust-rule-tool`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`Tool`}),(0,G.jsx)(`div`,{className:`mt-1`,children:(0,G.jsx)(h,{value:a,onChange:o,disabled:!0,options:Ce.map(e=>({value:e,label:e}))})})]}),(0,G.jsx)(y,{label:`Pattern`,type:`text`,value:s,onChange:e=>c(e.target.value),placeholder:`e.g., git *`,disabled:!0}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`span`,{className:`block text-body-medium-default text-[var(--content-default)]`,children:`Risk Level`}),(0,G.jsx)(`div`,{className:`mt-2 flex gap-2`,children:we.map(e=>(0,G.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,G.jsx)(`div`,{children:e.label}),(0,G.jsx)(`div`,{className:`mt-0.5 text-label-medium-default leading-tight opacity-70`,children:e.description})]},e.value))})]}),(0,G.jsx)(y,{label:`Description (optional)`,type:`text`,value:d,onChange:e=>f(e.target.value),placeholder:`${a} — ${b||`pattern`}`}),(0,G.jsxs)(`div`,{className:`flex justify-end gap-2 pt-2`,children:[(0,G.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,G.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 Ee(e){return e.origin===`default`&&!e.userModified}function X(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 De(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 Oe({assistantId:e,onClose:t}){let n=(0,W.useRef)(null),[r,i]=(0,W.useState)([]),[a,o]=(0,W.useState)(!0),[s,c]=(0,W.useState)(null),[l,u]=(0,W.useState)(null),[d,f]=(0,W.useState)(null),[m,h]=(0,W.useState)(!1),y=(0,W.useCallback)(async t=>{if(t){let[t,n]=await Promise.all([V(e),V(e,{origin:`default`})]);return X(t,n)}return V(e)},[e]),x=(0,W.useCallback)(async()=>{o(!0);try{i(await y(m)),c(null)}catch(e){c(e instanceof Error?e.message:`Failed to load trust rules.`)}finally{o(!1)}},[y,m]);(0,W.useEffect)(()=>{let e=!1;return(async()=>{o(!0);try{let t=await y(m);e||(i(t),c(null))}catch(t){e||c(t instanceof Error?t.message:`Failed to load trust rules.`)}finally{e||o(!1)}})(),()=>{e=!0}},[y,m]);let S=(0,W.useCallback)(async()=>{if(d)try{await fe(e,d.id),x()}catch(e){c(e instanceof Error?e.message:`Failed to delete trust rule.`)}finally{f(null)}},[e,d,x]);return(0,Y.createPortal)((0,G.jsxs)(G.Fragment,{children:[(0,G.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,W.useCallback)(e=>{e.key===`Escape`&&t()},[t]),onClick:(0,W.useCallback)(e=>{e.target===n.current&&t()},[t]),children:(0,G.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,G.jsxs)(`div`,{className:`flex items-center justify-between gap-3 border-b border-[var(--border-base)] px-6 py-4`,children:[(0,G.jsx)(`h2`,{id:`trust-rules-title`,className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,G.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,G.jsx)(b,{checked:m,onChange:h,label:`Show all defaults`}),(0,G.jsx)(p,{variant:`outlined`,onClick:t,children:`Done`})]})]}),(0,G.jsxs)(`div`,{className:`flex-1 overflow-y-auto px-6 py-4`,children:[s&&(0,G.jsx)(`div`,{className:`mb-3`,children:(0,G.jsx)(_,{tone:`error`,children:s})}),a?(0,G.jsx)(`div`,{className:`flex h-48 items-center justify-center text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Loading…`}):r.length===0?(0,G.jsxs)(`div`,{className:`flex h-48 flex-col items-center justify-center gap-2 px-6 text-[var(--content-tertiary)]`,children:[(0,G.jsx)(P,{className:`h-8 w-8`}),(0,G.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,G.jsx)(`ul`,{className:`divide-y divide-[var(--border-base)]`,children:r.map(e=>{let t=Ee(e);return(0,G.jsxs)(`li`,{className:`flex items-start gap-3 py-3`,children:[(0,G.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,G.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,G.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e.tool}),(0,G.jsx)(v,{tone:De(e.risk),children:Z(e.risk)}),e.origin===`default`&&(0,G.jsx)(v,{tone:`neutral`,children:`Default`}),e.userModified&&(0,G.jsx)(v,{tone:`warning`,children:`Modified`})]}),(0,G.jsx)(`div`,{className:`mt-1 truncate font-mono text-body-small-default text-[var(--content-secondary)]`,children:e.pattern}),e.description&&(0,G.jsx)(`div`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:e.description})]}),(0,G.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,G.jsx)(`button`,{type:`button`,"aria-label":`Edit ${e.tool} rule`,onClick:()=>u(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,G.jsx)(w,{className:`h-4 w-4`})}),(!t||e.userModified)&&(0,G.jsx)(`button`,{type:`button`,"aria-label":`Delete ${e.tool} rule`,onClick:()=>f(e),className:`rounded-lg p-1.5 text-[var(--system-negative-strong)] transition-colors hover:bg-[var(--system-negative-weak)]`,children:(0,G.jsx)(pe,{className:`h-4 w-4`})})]})]},e.id)})})]})]})}),l&&(0,G.jsx)(Te,{assistantId:e,existingRule:l,onClose:()=>u(null),onSaved:()=>{u(null),x()}}),(0,G.jsx)(g,{open:d!==null,title:`Delete Trust Rule?`,message:d?`Remove the ${Z(d.risk).toLowerCase()}-risk rule for ${d.tool} matching "${d.pattern}"?`:``,confirmLabel:`Delete`,cancelLabel:`Cancel`,destructive:!0,onConfirm:()=>void S(),onCancel:()=>f(null)})]}),document.body)}function ke(){let e=H(),[t,n]=(0,W.useState)(!1);return(0,G.jsxs)(m,{children:[(0,G.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,G.jsx)(P,{className:`mt-0.5 h-5 w-5 shrink-0 text-[var(--content-secondary)]`}),(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Trust Rules`}),(0,G.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,G.jsx)(p,{variant:`outlined`,onClick:()=>n(!0),children:`Manage`})]}),t&&(0,G.jsx)(Oe,{assistantId:e,onClose:()=>n(!1)})]})}var Ae=[{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`}],je=`thirtyDays`;function Q({label:e,helperText:t,checked:n,onChange:r}){return(0,G.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,G.jsxs)(`div`,{className:`flex-1`,children:[(0,G.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:e}),(0,G.jsx)(`p`,{className:`mt-1 text-body-small-default text-[var(--content-tertiary)]`,children:t})]}),(0,G.jsx)(b,{checked:n,onChange:r,label:e})]})}function $(){return(0,G.jsx)(`div`,{className:`h-px bg-[var(--surface-active)] dark:bg-[var(--surface-lift)]`})}function Me(){let e=N({platformHostedOnly:!0}),t=ee(),[a,o]=(0,W.useState)(()=>n(`shareAnalytics`,!0)),[s,c]=(0,W.useState)(()=>n(`shareDiagnostics`,!0)),[l,u]=(0,W.useState)(()=>i(`llmLogRetention`,je));return(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(xe,{}),(0,G.jsx)(ye,{}),(0,G.jsx)(ke,{}),(0,G.jsx)(Se,{}),(0,G.jsx)(U,{title:`Privacy`,children:(0,G.jsxs)(`div`,{className:`space-y-4`,children:[(0,G.jsx)(Q,{label:`Share Analytics`,helperText:`Send anonymous product usage data. Your conversations and personal data are never included.`,checked:a,onChange:()=>{let e=!a;o(e),A(`share_analytics`,e,t)}}),(0,G.jsx)($,{}),(0,G.jsx)(Q,{label:`Share Diagnostics`,helperText:`Send crash reports and performance metrics. Your conversations and personal data are never included.`,checked:s,onChange:()=>{let e=!s;c(e),A(`share_diagnostics`,e,t)}}),(0,G.jsx)($,{}),(0,G.jsx)(be,{}),e!==`gated`&&(0,G.jsx)($,{}),(0,G.jsxs)(`div`,{children:[(0,G.jsx)(`label`,{htmlFor:`llm-log-retention`,className:`block text-body-medium-default text-[var(--content-default)]`,children:`LLM Request Log Retention`}),(0,G.jsx)(`div`,{className:`mt-2`,style:{maxWidth:280},children:(0,G.jsx)(h,{value:l,onChange:e=>{u(e),r(`llmLogRetention`,e)},options:Ae})}),(0,G.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{Me as PrivacyPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./button-C68o-wep.js";import{t as o}from"./card-CL5iEMJO.js";import{t as s}from"./checkbox-qlcBvCFW.js";import{t as c}from"./toggle-CEm3M86o.js";import{t as l}from"./is-electron-CavSPgmY.js";import{O as u,n as d,r as f,u as p}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./button-C68o-wep.js";import{t as o}from"./card-CL5iEMJO.js";import{t as s}from"./checkbox-qlcBvCFW.js";import{t as c}from"./toggle-CEm3M86o.js";import{t as l}from"./is-electron-CavSPgmY.js";import{O as u,n as d,r as f,u as p}from"./auth-store-C4gcHOWH.js";import{i as m,r as h}from"./routes-VcLWbBmh.js";import{Br as g,Mr as _,Oa as v,Rr as y,Vr as b,zr as x}from"./index-87hTkD_v.js";import{t as S}from"./onboarding-layout-BAx3atHc.js";import{a as C,c as w,i as T,n as E,o as D,t as O}from"./step-indicator-dots-C_x0ZHGS.js";var k=e(t(),1),A=i();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=n(),[t]=r(),i=d.use.user()?.id??null,c=l(),N=u(),P=D(_.use.stringFlags().preChatOnboardingExperiment20260606??`control`),[F,I]=x(),[L,R]=g(),[z,B]=b(),[V,H]=y(),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:i,tos:z,ai:V,shareAnalytics:F,shareDiagnostics:L,hasPlatformSession:U}),!N){let e=w(P);T(E.privacyTos,{userId:i,variant:e})}let n=t.get(`hosting`),r=new URLSearchParams;n&&r.set(`hosting`,n);let a=r.toString();e(`${m.onboarding.hatching}${a?`?${a}`:``}`)},[V,U,N,W,e,P,t,F,L,z,i]),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)(S,{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)(v,{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)(a,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!z||!V,onClick:X,className:c?void 0:`h-11 text-base`,children:`Start`}),(0,A.jsx)(a,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>e(-1),className:c?void 0:`h-11 text-base`,children:`Back`})]})]})})}export{N as PrivacyScreen};
|
package/dist/assets/{provider-callback-page-CQuLD5No.js → provider-callback-page-BuPFhW7i.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Dze4ISSQ.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{b as s,f as c}from"./resolved-assistants-store-B5ATyCT9.js";import{L as l,N as u,c as d,n as f}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Dze4ISSQ.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{b as s,f as c}from"./resolved-assistants-store-B5ATyCT9.js";import{L as l,N as u,c as d,n as f}from"./auth-store-C4gcHOWH.js";import{c as p}from"./api-DiLLlhgt.js";import{i as m}from"./routes-VcLWbBmh.js";import{t as h}from"./index-87hTkD_v.js";import{r as g,t as _}from"./account-shell-C6-wTQZB.js";import{a as v,i as y}from"./login-flow-DmfVD3r_.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=y(e);return(0,b.useEffect)(()=>{T.current||S||(T.current=!0,(async()=>{try{let t=await l(),r=u(t.ok&&!!t.data.user,t.ok?[]:t.flows??[]);switch(r.kind){case`authenticated`:{if(await o(),c())try{let e=await p();if(e.ok&&e.data.length>0&&(await s(e.data,d.getState().currentOrganizationId??void 0),!E)){n(m.assistant,{replace:!0});break}}catch{}let e=m.assistant,{destination:t,requiresFullPageNavigation:r}=v({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)(_,{children:[(0,x.jsx)(g,{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:h,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)(_,{children:[(0,x.jsx)(g,{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)(_,{children:(0,x.jsx)(g,{title:`Completing sign-in...`,subtitle:`Please wait while we finish authenticating you.`})})}export{S as ProviderCallbackPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{At as e,
|
|
1
|
+
import{At as e,Dn as t}from"./sdk.gen-DgqwY_WN.js";var n=`onboarding.providerKey`;function r(e){try{if(e===null){sessionStorage.removeItem(n);return}sessionStorage.setItem(n,JSON.stringify(e))}catch{}}function i(e){return typeof e==`object`&&!!e&&`provider`in e&&typeof e.provider==`string`&&`key`in e&&typeof e.key==`string`}function a(){try{let e=sessionStorage.getItem(n);if(!e)return null;let t=JSON.parse(e);return i(t)?t:null}catch{return null}}function o(){let e=a();try{sessionStorage.removeItem(n)}catch{}return e}async function s(e,n,r){let{response:i}=await t({path:{assistant_id:e},body:{type:`api_key`,name:n,value:r},throwOnError:!1});if(!i?.ok)throw Object.assign(Error(`Failed to write provider secret`),{status:i?.status})}async function c(t,n,r){let i=r?{type:`api_key`,credential:`credential/${n}/api_key`}:{type:`none`},{response:a}=await e({path:{assistant_id:t},body:{name:n,provider:n,auth:i},throwOnError:!1});if(!a?.ok)throw Object.assign(Error(`Failed to create provider connection`),{status:a?.status})}async function l(e){let t=o();if(!t)return;let n=t.key.trim(),r=n.length>0;r&&await s(e,t.provider,n),await c(e,t.provider,r)}export{a as n,r,l as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r,t as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{I as o,R as s,n as c,z as l}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r,t as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{I as o,R as s,n as c,z as l}from"./auth-store-C4gcHOWH.js";import{i as u}from"./routes-VcLWbBmh.js";import{i as d,n as f,r as p,t as m}from"./account-shell-C6-wTQZB.js";import{a as h,o as g}from"./login-flow-DmfVD3r_.js";var _=e(t(),1),v=a();function y(){let e=n(),[t]=r(),a=c.use.refreshSession(),y=t.get(`returnTo`),[b,x]=(0,_.useState)(``),[S,C]=(0,_.useState)(``),[w,T]=(0,_.useState)(null),[E,D]=(0,_.useState)(!1),[O,k]=(0,_.useState)(!0),A=(0,_.useRef)(!1);return(0,_.useEffect)(()=>{A.current||(A.current=!0,(async()=>{try{let t=await o();if(!t.ok){e(u.account.login,{replace:!0});return}x(t.data.user.email??``),C(t.data.user.username??``),k(!1)}catch{e(u.account.login,{replace:!0})}})())},[e]),O?(0,v.jsx)(m,{children:(0,v.jsx)(p,{title:`Completing signup...`,subtitle:`Please wait while we load your information.`})}):(0,v.jsxs)(m,{children:[(0,v.jsx)(p,{title:`Complete your account`,subtitle:`We need a few more details to finish setting up your account.`}),(0,v.jsxs)(f,{onSubmit:async t=>{t.preventDefault(),T(null),D(!0);try{let t=await l({email:b,username:S});if(!t.ok){if(s(t)){await a();let t=g(y,u.account.root);t.requiresFullPageNavigation?window.location.href=t.destination:e(t.destination);return}T(t.errors[0]?.message??`Failed to complete signup.`);return}await a();let n=h({returnTo:y,fallback:u.account.root,authIntent:`signup`});n.requiresFullPageNavigation?window.location.href=n.destination:e(n.destination)}catch{T(`Something went wrong. Please try again.`)}finally{D(!1)}},error:w,submitLabel:`Complete signup`,submittingLabel:`Completing...`,isSubmitting:E,footer:(0,v.jsx)(i,{to:u.account.login,className:`text-sm text-stone-400 hover:text-stone-300`,children:`← Back to sign in`}),children:[(0,v.jsx)(d,{id:`email`,type:`email`,autoComplete:`email`,placeholder:`Email`,value:b,onChange:e=>x(e.target.value),required:!0}),(0,v.jsx)(d,{id:`username`,type:`text`,autoComplete:`username`,placeholder:`Username`,value:S,onChange:e=>C(e.target.value),required:!0})]})]})}export{y as ProviderSignupPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{_ as e,o as t}from"./react-query.gen-
|
|
1
|
+
import{_ as e,o as t}from"./react-query.gen-B_oGDSP8.js";var n=`assistantAvatar`;function r(e){return[n,e]}var i=`conversations`;function a(e){return[i,e??``]}var o=`archived-conversations`;function s(e){return[o,e??``]}var c=`background-conversations`;function l(e){return[c,e??``]}var u=`scheduled-conversations`;function d(e){return[u,e??``]}function f(t){return e({path:{assistant_id:t??``}})}function p(e){return t({path:{assistant_id:e??``}})}function m(e){return[`soundsConfig`,e]}function h(e){return[`soundsAvailable`,e]}function g(e){return[`schedules`,e]}function _(e,t){return t?[`schedule-runs`,e,t]:[`schedule-runs`,e]}function v(e,t){return t?[`schedule-usage-summary`,e,t]:[`schedule-usage-summary`,e]}var y=[`client-feature-flag-values`],b=`assistant-feature-flag-values`;function x(e){return[b,e]}var S=`assistant-identity`;function C(e){return[S,e??``]}var w=`identity-intro`;function T(e){return[w,e??``]}export{T as a,v as c,m as d,r as f,d as g,a as h,x as i,g as l,f as m,s as n,C as o,l as p,p as r,_ as s,y as t,h as u};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{t as e}from"./queryOptions-BtNi-_9H.js";import{$n as t,$t as n,A as r,An as i,Hn as a,Mn as o,Nn as s,O as c,St as l,an as u,cn as d,ct as ee,dn as te,dt as ne,en as re,ft as ie,in as ae,jn as oe,jt as se,k as ce,kn as le,kt as f,ln as p,mn as m,nn as h,o as g,on as _,pn as v,pt as y,rn as b,tn as x,un as S,ut as C,v as w,x as T,y as E}from"./sdk.gen-DgqwY_WN.js";var D=(e,n,r,i)=>{let a={_id:e,baseUrl:n?.baseUrl||(n?.client??t).getConfig().baseUrl};return r&&(a._infinite=r),i&&(a.tags=i),n?.body&&(a.body=n.body),n?.headers&&(a.headers=n.headers),n?.path&&(a.path=n.path),n?.query&&(a.query=n.query),[a]},O=e=>D(`appsGet`,e),k=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await g({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:O(t)}),A=e=>D(`channelsAvailableGet`,e),j=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await w({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:A(t)}),M=e=>D(`channelsReadinessGet`,e),N=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await E({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:M(t)}),P=e=>D(`configGet`,e),F=e=>D(`configLlmCallsitesGet`,e),I=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await T({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:F(t)}),L=e=>({mutationFn:async t=>{let{data:n}=await c({...e,...t,throwOnError:!0});return n}}),R=e=>D(`contactsGet`,e),z=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await ce({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:R(t)}),B=e=>({mutationFn:async t=>{let{data:n}=await r({...e,...t,throwOnError:!0});return n}}),V=e=>D(`documentsGet`,e),H=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await ee({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:V(t)}),U=e=>D(`groupsGet`,e),W=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await ie({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:U(t)}),ue=e=>({mutationFn:async t=>{let{data:n}=await y({...e,...t,throwOnError:!0});return n}}),de=e=>({mutationFn:async t=>{let{data:n}=await C({...e,...t,throwOnError:!0});return n}}),fe=e=>({mutationFn:async t=>{let{data:n}=await ne({...e,...t,throwOnError:!0});return n}}),pe=e=>D(`homeFeedGet`,e),G=e=>D(`homeStateGet`,e),me=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await l({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:G(t)}),K=e=>D(`inferenceProviderconnectionsGet`,e),he=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await f({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:K(t)}),ge=e=>({mutationFn:async t=>{let{data:n}=await se({...e,...t,throwOnError:!0});return n}}),q=e=>D(`oauthAppsGet`,e),_e=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await h({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:q(t)}),ve=e=>({mutationFn:async t=>{let{data:n}=await b({...e,...t,throwOnError:!0});return n}}),ye=e=>({mutationFn:async t=>{let{data:r}=await n({...e,...t,throwOnError:!0});return r}}),J=e=>D(`oauthAppsByAppIdConnectionsGet`,e),be=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await re({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:J(t)}),xe=e=>({mutationFn:async t=>{let{data:n}=await x({...e,...t,throwOnError:!0});return n}}),Se=e=>({mutationFn:async t=>{let{data:n}=await ae({...e,...t,throwOnError:!0});return n}}),Ce=e=>D(`oauthProvidersGet`,e),we=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await _({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:Ce(t)}),Te=e=>D(`oauthProvidersByProviderKeyGet`,e),Ee=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await u({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:Te(t)}),De=e=>D(`pluginsGet`,e),Oe=e=>({mutationFn:async t=>{let{data:n}=await d({...e,...t,throwOnError:!0});return n}}),Y=e=>D(`pluginsByNameGet`,e),ke=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await p({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:Y(t)}),X=e=>D(`pluginsByNameInspectGet`,e),Ae=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await S({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:X(t)}),je=e=>({mutationFn:async t=>{let{data:n}=await te({...e,...t,throwOnError:!0});return n}}),Me=e=>({mutationFn:async t=>{let{data:n}=await v({...e,...t,throwOnError:!0});return n}}),Z=e=>D(`pluginsSearchGet`,e),Ne=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await m({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:Z(t)}),Q=e=>D(`skillsGet`,e),Pe=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await s({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:Q(t)}),Fe=e=>({mutationFn:async t=>{let{data:n}=await le({...e,...t,throwOnError:!0});return n}}),Ie=e=>D(`skillsByIdFilesGet`,e),Le=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await oe({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:Ie(t)}),$=e=>D(`skillsByIdFilesContentGet`,e),Re=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await i({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:$(t)}),ze=e=>D(`skillsCategoriesGet`,e),Be=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await o({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:ze(t)}),Ve=e=>D(`ttsProvidersGet`,e),He=t=>e({queryFn:async({queryKey:e,signal:n})=>{let{data:r}=await a({...t,...e[0],signal:n,throwOnError:!0});return r},queryKey:Ve(t)});export{q as A,je as B,K as C,J as D,be as E,Oe as F,Fe as G,Me as H,ke as I,Be as J,Re as K,Y as L,Se as M,Ee as N,xe as O,we as P,Ae as R,he as S,ye as T,Ne as U,De as V,Z as W,Q as X,Pe as Y,He as Z,U as _,M as a,me as b,L as c,B as d,H as f,W as g,fe as h,N as i,ve as j,_e as k,z as l,de as m,O as n,P as o,V as p,Le as q,j as r,I as s,k as t,R as u,ue as v,ge as w,G as x,pe as y,X as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./button-C68o-wep.js";import{t as o}from"./checkbox-qlcBvCFW.js";import{t as s}from"./is-electron-CavSPgmY.js";import{M as c,n as l,r as u,u as d}from"./auth-store-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{t as a}from"./button-C68o-wep.js";import{t as o}from"./checkbox-qlcBvCFW.js";import{t as s}from"./is-electron-CavSPgmY.js";import{M as c,n as l,r as u,u as d}from"./auth-store-C4gcHOWH.js";import{i as f,r as p}from"./routes-VcLWbBmh.js";import{Br as m,Rr as h,Vr as g,xr as _,zr as v}from"./index-87hTkD_v.js";import{t as y}from"./onboarding-layout-BAx3atHc.js";var b=e(t(),1),x=i(),S=`[&_button[data-state=checked]]:bg-[var(--primary-base)] [&_svg]:text-[var(--content-inset)]`;function C(){let e=n(),[t]=r(),i=l.use.user()?.id??null,C=l.use.logout(),w=s(),T=u(),[E,D]=g(),[O,k]=h(),[A]=v(),[j]=m(),M=(0,b.useCallback)(()=>{d({userId:i,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,i]),N=(0,b.useCallback)(async()=>{await C(),_(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)(y,{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)(a,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!E||!O,onClick:M,className:w?void 0:`h-11 text-base`,children:`Continue`}),(0,x.jsx)(a,{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{
|
|
1
|
+
import{xn as e}from"./sdk.gen-DgqwY_WN.js";import{n as t,r as n,t as r}from"./api-errors-CsfCFJ8r.js";function i(e){let t=e,n=t.description??``;return{...e,description:n,cadenceDescription:t.cadenceDescription??n}}async function a(a){let{data:o,error:s,response:c}=await e({path:{assistant_id:a},throwOnError:!1});if(t(c,s,`Failed to load schedules.`),!c.ok)throw new r(c.status,n(s,c,`Failed to load schedules.`));return(o?.schedules??[]).map(i)}export{a as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Dze4ISSQ.js";import{t as n}from"./react-DJZBPgpf.js";import{d as r,p 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"./cn-DFqQkJlk.js";import{t as l}from"./button-C68o-wep.js";import{t as u}from"./dropdown-CocFV5yi.js";import{n as d}from"./src-Bnn6algv.js";import{t as f}from"./notice-CF2pptne.js";import{t as p}from"./tag-Ccr7Quy6.js";import{t as m}from"./panel-item-FzMfzMJA.js";import{n as h,t as g}from"./input-Cu3PPVCq.js";import{t as _}from"./toggle-CEm3M86o.js";import{n as v}from"./stat-square-BENJGRZr.js";import{t as y}from"./modal-BYMhDpQo.js";import{n as b}from"./toast-BL8OPiip.js";import{t as x}from"./calendar-CP_Q3Aw6.js";import{t as S}from"./chevron-right-C1TiR5qP.js";import{t as C}from"./loader-circle-C563RcPZ.js";import{Cn as w,D as T,E,Sn as D,T as O,_n as k,_t as A,bn as j,gn as M,gt as N,ht as P,vn as F,vt as I,yn as L}from"./sdk.gen-DgqwY_WN.js";import{n as R,r as z,t as B}from"./api-errors-CsfCFJ8r.js";import{a as ee}from"./api-DiLLlhgt.js";import{i as V}from"./routes-VcLWbBmh.js";import{c as te,l as ne,s as re}from"./query-tags-DPKpdc1_.js";import{t as ie}from"./effective-timezone-CIYaAgHc.js";import{$a as ae,Fi as oe,Ga as se,Ki as ce,Wi as le,Wn as H,na as ue,oo as U,to as de,xi as fe}from"./index-87hTkD_v.js";import{t as pe}from"./use-active-assistant-id-B2Zd0B4I.js";import{t as W}from"./detail-card-BOk0V4_4.js";import{n as me}from"./usage-window-DIaL-FoL.js";import{t as he}from"./schedules-Cxb9otxN.js";var G=e(n(),1);async function ge(e,t){let{error:n,response:r}=await D({path:{assistant_id:e},body:t,throwOnError:!1});if(R(r,n,`Failed to create schedule.`),!r.ok)throw new B(r.status,z(n,r,`Failed to create schedule.`))}async function _e(e,t,n){let{error:r,response:i}=await k({path:{assistant_id:e,id:t},body:n,throwOnError:!1});if(R(i,r,`Failed to update schedule.`),!i.ok)throw new B(i.status,z(r,i,`Failed to update schedule.`))}async function ve(e){return he(e)}async function ye(e,t,n=10){let{data:r,error:i,response:a}=await L({path:{assistant_id:e,id:t},query:{limit:n},throwOnError:!1});if(R(a,i,`Failed to load schedule runs.`),!a.ok)throw new B(a.status,z(i,a,`Failed to load schedule runs.`));return r?.runs??[]}async function be(e,t){let{data:n,error:r,response:i}=await w({path:{assistant_id:e},query:{from:t.from,to:t.to},throwOnError:!1});if(R(i,r,`Failed to load schedule usage.`),!i.ok)throw new B(i.status,z(r,i,`Failed to load schedule usage.`));return n?.summaries??[]}async function xe(e,t,n){let{error:r,response:i}=await j({path:{assistant_id:e,id:t},body:{enabled:n},throwOnError:!1});if(R(i,r,`Failed to toggle schedule.`),!i.ok)throw new B(i.status,z(r,i,`Failed to toggle schedule.`))}async function Se(e,t){let{error:n,response:r}=await M({path:{assistant_id:e,id:t},throwOnError:!1});if(R(r,n,`Failed to delete schedule.`),!r.ok&&r.status!==204)throw new B(r.status,z(n,r,`Failed to delete schedule.`))}async function Ce(e,t){let{error:n,response:r}=await F({path:{assistant_id:e,id:t},throwOnError:!1});if(R(r,n,`Failed to run schedule.`),!r.ok)throw new B(r.status,z(n,r,`Failed to run schedule.`))}async function K(e,t=10){let{data:n,error:r,response:i}=await I({path:{assistant_id:e},query:{limit:t},throwOnError:!1});if(R(i,r,`Failed to load heartbeat runs.`),!i.ok)throw new B(i.status,z(r,i,`Failed to load heartbeat runs.`));return(n?.runs??[]).map(e=>({id:e.id,jobId:`heartbeat`,status:e.status,startedAt:e.startedAt??e.scheduledFor,finishedAt:e.finishedAt,durationMs:e.durationMs,output:e.skipReason?`Skipped: ${e.skipReason}`:null,error:e.error,conversationId:e.conversationId,conversationExists:e.conversationExists,conversationArchivedAt:e.conversationArchivedAt,estimatedCostUsd:e.estimatedCostUsd,createdAt:e.createdAt}))}async function we(e,t=10){let{data:n,error:r,response:i}=await T({path:{assistant_id:e},query:{limit:t},throwOnError:!1});if(R(i,r,`Failed to load consolidation runs.`),!i.ok)throw new B(i.status,z(r,i,`Failed to load consolidation runs.`));return(n?.runs??[]).map(e=>({id:e.id,jobId:`consolidation`,status:e.status,startedAt:e.startedAt??e.scheduledFor,finishedAt:e.finishedAt,durationMs:e.durationMs,output:null,error:e.error,conversationId:e.conversationId,conversationExists:e.conversationExists,conversationArchivedAt:e.conversationArchivedAt,estimatedCostUsd:e.estimatedCostUsd,createdAt:e.createdAt}))}async function Te(e){let{data:t,error:n,response:r}=await P({path:{assistant_id:e},throwOnError:!1});if(R(r,n,`Failed to load heartbeat config.`),!r.ok||!t)throw new B(r.status,z(n,r,`Failed to load heartbeat config.`));return t}async function Ee(e,t){let{data:n,error:r,response:i}=await e();if(R(i,r,t),!i.ok||!n)throw new B(i.status,z(r,i,t));return n}async function De(e,t){return Ee(()=>N({path:{assistant_id:e},body:t,throwOnError:!1}),`Failed to update heartbeat config.`)}async function Oe(e){let{data:t,error:n,response:r}=await A({path:{assistant_id:e},throwOnError:!1});if(R(r,n,`Failed to run heartbeat.`),!r.ok||!t)throw new B(r.status,z(n,r,`Failed to run heartbeat.`));return t}async function ke(e){let{data:t,error:n,response:r}=await O({path:{assistant_id:e},throwOnError:!1});if(R(r,n,`Failed to load consolidation config.`),!r.ok||!t)throw new B(r.status,z(n,r,`Failed to load consolidation config.`));return t}async function Ae(e){let{data:t,error:n,response:r}=await E({path:{assistant_id:e},throwOnError:!1});if(R(r,n,`Failed to run consolidation.`),!r.ok||!t)throw new B(r.status,z(n,r,`Failed to run consolidation.`));return t}var je={frequency:`daily`,minute:0,hour24:9,weekdays:[1],dayOfMonth:1},q=[{value:0,letter:`S`,short:`Sun`,full:`Sunday`},{value:1,letter:`M`,short:`Mon`,full:`Monday`},{value:2,letter:`T`,short:`Tue`,full:`Tuesday`},{value:3,letter:`W`,short:`Wed`,full:`Wednesday`},{value:4,letter:`T`,short:`Thu`,full:`Thursday`},{value:5,letter:`F`,short:`Fri`,full:`Friday`},{value:6,letter:`S`,short:`Sat`,full:`Saturday`}],Me=[1,2,3,4,5];function J(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.round(e))):t}function Ne(e){let t=Array.from(new Set(e.map(e=>J(e,0,6)).filter(e=>Number.isInteger(e)))).sort((e,t)=>e-t);return t.length>0?t:[1]}function Pe(e){let t=J(e.minute,0,59),n=J(e.hour24,0,23);switch(e.frequency){case`hourly`:return`${t} * * * *`;case`daily`:return`${t} ${n} * * *`;case`weekly`:return`${t} ${n} * * ${Ne(e.weekdays).join(`,`)}`;case`monthly`:return e.dayOfMonth===`last`?`${t} ${n} L * *`:`${t} ${n} ${J(e.dayOfMonth,1,28)} * *`}}function Fe(e,t){let n=J(e,0,23),r=J(t,0,59),i=n<12?`AM`:`PM`;return`${n%12==0?12:n%12}:${String(r).padStart(2,`0`)} ${i}`}function Ie(e){let t=[`th`,`st`,`nd`,`rd`],n=e%100;return`${e}${t[(n-20)%10]??t[n]??t[0]}`}function Le(e){let t=Ne(e),n=new Set(t);if(t.length===7)return`every day`;if(t.length===5&&Me.every(e=>n.has(e)))return`every weekday`;if(t.length===2&&n.has(0)&&n.has(6))return`every weekend`;if(t.length===1)return`every ${q[t[0]]?.full??`day`}`;let r=t.map(e=>q[e]?.short??``),i=r.pop();return`every ${r.join(`, `)} & ${i}`}function Re(e){let t=Fe(e.hour24,e.minute);switch(e.frequency){case`hourly`:{let t=J(e.minute,0,59);return`Runs every hour at :${String(t).padStart(2,`0`)}`}case`daily`:return`Runs every day at ${t}`;case`weekly`:return`Runs ${Le(e.weekdays)} at ${t}`;case`monthly`:return e.dayOfMonth===`last`?`Runs on the last day of every month at ${t}`:`Runs on the ${Ie(J(e.dayOfMonth,1,28))} of every month at ${t}`}}var Y=s(),ze=[{value:`hourly`,label:`Hourly`},{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}],Be=Array.from({length:12},(e,t)=>{let n=t+1;return{value:String(n),label:String(n)}}),Ve=Array.from({length:12},(e,t)=>{let n=t*5,r=String(n).padStart(2,`0`);return{value:r,label:r}}),He=[...Array.from({length:28},(e,t)=>{let n=t+1;return{value:String(n),label:Ie(n)}}),{value:`last`,label:`Last day`}],Ue=[{value:`AM`,label:`AM`},{value:`PM`,label:`PM`}];function We(e,t){let n=e%12;return t===`PM`?n+12:n}function Ge(e){try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;return t&&t!==e?`${e} · ${t}`:e}catch{return e}}function Ke({isOpen:e,assistantId:t,onClose:n,onCreated:r}){return(0,Y.jsx)(y.Root,{open:e,onOpenChange:e=>{e||n()},children:e?(0,Y.jsx)(qe,{assistantId:t,onClose:n,onCreated:r}):null})}function qe({assistantId:e,onClose:t,onCreated:n}){let r=H(),[i,a]=(0,G.useState)(``),[o,s]=(0,G.useState)(``),[c,u]=(0,G.useState)(``),[d,f]=(0,G.useState)(`simple`),[p,m]=(0,G.useState)(je),[_,v]=(0,G.useState)(``),[b,x]=(0,G.useState)(!1),[S,C]=(0,G.useState)(null),w=i.trim(),T=o.trim(),E=c.trim(),D=_.trim(),O=(0,G.useMemo)(()=>d===`simple`?Pe(p):D,[d,p,D]),k=(0,G.useMemo)(()=>d===`simple`?Re(p):D||`Enter a cron expression to continue.`,[d,p,D]),A=(0,G.useMemo)(()=>Ge(r),[r]),j=w.length>0&&T.length>0&&E.length>0&&O.length>0&&!b;return(0,Y.jsxs)(y.Content,{size:`md`,children:[(0,Y.jsxs)(y.Header,{children:[(0,Y.jsx)(y.Title,{children:`Create schedule`}),(0,Y.jsx)(y.Description,{children:`Schedule a recurring instruction for your assistant. Runs in execute mode — the message is delivered to the assistant on each fire.`})]}),(0,Y.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),j){x(!0),C(null);try{await ge(e,{name:w,description:T,expression:O,message:E,timezone:r}),x(!1),n()}catch(e){C(e instanceof Error?e.message:`Failed to create schedule.`),x(!1)}}},children:[(0,Y.jsx)(y.Body,{children:(0,Y.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,Y.jsx)(g,{label:`Name`,placeholder:`Morning briefing`,value:i,onChange:e=>a(e.target.value),required:!0,autoFocus:!0,fullWidth:!0}),(0,Y.jsx)(h,{label:`Description`,placeholder:`What is this schedule for?`,value:o,onChange:e=>s(e.target.value),required:!0,fullWidth:!0,rows:2}),(0,Y.jsx)(Qe,{label:`Repeat`,children:d===`simple`?(0,Y.jsx)(Je,{cadence:p,onChange:m}):(0,Y.jsx)(Ze,{value:_,onChange:v,onUseSimple:()=>f(`simple`)})}),(0,Y.jsx)($e,{summary:k,mono:d===`advanced`&&D.length>0,timezoneLabel:A}),d===`simple`?(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{v(e=>e||Pe(p)),f(`advanced`)},className:`self-start text-body-small-default text-[var(--content-tertiary)] underline-offset-2 transition-colors hover:text-[var(--content-default)] hover:underline`,children:`Advanced — write a cron expression`}):null,(0,Y.jsx)(h,{label:`Message`,placeholder:`What should the assistant do on each fire?`,value:c,onChange:e=>u(e.target.value),required:!0,fullWidth:!0,rows:4}),S?(0,Y.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:S}):null]})}),(0,Y.jsxs)(y.Footer,{children:[(0,Y.jsx)(l,{variant:`outlined`,onClick:t,type:`button`,children:`Cancel`}),(0,Y.jsx)(l,{variant:`primary`,type:`submit`,disabled:!j,children:b?`Creating…`:`Create schedule`})]})]})]})}function Je({cadence:e,onChange:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Y.jsx)(v,{items:ze,value:e.frequency,onChange:n=>t({...e,frequency:n}),ariaLabel:`How often the schedule runs`}),e.frequency===`hourly`?(0,Y.jsx)(X,{label:`At minute`,children:(0,Y.jsx)(u,{options:Ve,value:String(e.minute).padStart(2,`0`),onChange:n=>t({...e,minute:Number(n)}),"aria-label":`Minute`,className:`w-24`})}):null,e.frequency===`weekly`?(0,Y.jsx)(X,{label:`On these days`,children:(0,Y.jsx)(Xe,{value:e.weekdays,onChange:n=>t({...e,weekdays:n})})}):null,e.frequency===`monthly`?(0,Y.jsx)(X,{label:`On day`,children:(0,Y.jsx)(u,{options:He,value:e.dayOfMonth===`last`?`last`:String(e.dayOfMonth),onChange:n=>t({...e,dayOfMonth:n===`last`?`last`:Number(n)}),"aria-label":`Day of month`,className:`w-32`})}):null,e.frequency===`hourly`?null:(0,Y.jsx)(X,{label:`At time`,children:(0,Y.jsx)(Ye,{hour24:e.hour24,minute:e.minute,onChange:(n,r)=>t({...e,hour24:n,minute:r})})})]})}function Ye({hour24:e,minute:t,onChange:n}){let r=e<12?`AM`:`PM`,i=e%12==0?12:e%12;return(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(u,{options:Be,value:String(i),onChange:e=>n(We(Number(e),r),t),"aria-label":`Hour`,className:`w-[72px]`}),(0,Y.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`:`}),(0,Y.jsx)(u,{options:Ve,value:String(t).padStart(2,`0`),onChange:t=>n(e,Number(t)),"aria-label":`Minute`,className:`w-[72px]`}),(0,Y.jsx)(`div`,{className:`w-[112px]`,children:(0,Y.jsx)(v,{items:Ue,value:r,onChange:e=>n(We(i,e),t),ariaLabel:`AM or PM`})})]})}function Xe({value:e,onChange:t}){let n=new Set(e),r=e=>{let r=new Set(n);r.has(e)?r.size>1&&r.delete(e):r.add(e),t([...r].sort((e,t)=>e-t))};return(0,Y.jsx)(`div`,{className:`flex gap-1.5`,children:q.map(e=>{let t=n.has(e.value);return(0,Y.jsx)(`button`,{type:`button`,onClick:()=>r(e.value),"aria-pressed":t,"aria-label":e.full,title:e.full,className:c(`flex h-9 w-9 items-center justify-center rounded-md border text-body-medium-default transition-colors`,t?`border-[var(--border-active)] bg-[var(--surface-active)] text-[var(--content-emphasised)]`:`border-[var(--field-border)] text-[var(--content-tertiary)] hover:border-[var(--border-active)] hover:text-[var(--content-default)]`),children:e.letter},e.value)})})}function Ze({value:e,onChange:t,onUseSimple:n}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,Y.jsx)(g,{placeholder:`0 9 * * *`,value:e,onChange:e=>t(e.target.value),fullWidth:!0,className:`font-mono`,"aria-label":`Cron expression`,helperText:`Standard 5-field cron (minute hour day month weekday). RRULE expressions are also accepted.`}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,className:`self-start text-body-small-default text-[var(--content-tertiary)] underline-offset-2 transition-colors hover:text-[var(--content-default)] hover:underline`,children:`← Back to the simple builder`})]})}function Qe({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,Y.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:e}),t]})}function X({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,Y.jsx)(`span`,{className:`min-w-[88px] text-body-small-default text-[var(--content-tertiary)]`,children:e}),t]})}function $e({summary:e,mono:t,timezoneLabel:n}){return(0,Y.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] px-3.5 py-3`,children:[(0,Y.jsx)(se,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,Y.jsxs)(`div`,{className:`min-w-0`,children:[(0,Y.jsx)(`p`,{className:c(`text-body-medium-default text-[var(--content-default)]`,t&&`break-all font-mono`),children:e}),(0,Y.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[`Times use your timezone — `,n,`.`]})]})]})}function et(e=ie(),t=Date.now()){return me(`7d`,e,t)}function Z(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0}):`—`}function tt(e){return e==null?`—`:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}var nt=new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2});function Q(e){return e==null||!Number.isFinite(e)?`—`:nt.format(e)}function rt(e){return`${e.toLocaleString()} ${e===1?`run`:`runs`}`}function it(e){let t=Math.round(e/6e4);return t>=60&&t%60==0?`Every ${t/60} hr`:`Every ${t} min`}function at(e){return!!e.createdFromConversationId&&e.createdFromConversationExists===!0&&e.createdFromConversationArchivedAt==null}function ot(e){return!!e.conversationId&&e.conversationExists===!0&&e.conversationArchivedAt==null}function st(e){return at(e)?e.createdFromConversationId??null:null}function ct(e){return ot(e)?e.conversationId??null:null}function lt(e){return typeof e==`string`&&e.length>0}var $={heartbeat:`system-heartbeat`,consolidation:`system-consolidation`};function ut(e){switch(e){case $.heartbeat:return`heartbeat`;case $.consolidation:return`consolidation`;default:return null}}function dt(e){if(e.cronExpression)return e.timezone?`Cron: ${e.cronExpression} (${e.timezone})`:`Cron: ${e.cronExpression}`;let t=it(e.intervalMs);return e.activeHoursStart!=null&&e.activeHoursEnd!=null&&(t+=` (${e.activeHoursStart}:00–${e.activeHoursEnd}:00)`),t}function ft(e){return it(e.intervalMs)}var pt={execute:`positive`,notify:`warning`,script:`neutral`},mt=1800;function ht(e,t){return e.status===`fired`||e.status===`cancelled`?!0:e.status===`firing`?!1:e.nextRunAt==null||!e.enabled&&e.nextRunAt<=t}function gt(e,t){let n=[],r=[],i=[];for(let a of e)a.isOneShot?ht(a,t)?i.push(a):r.push(a):n.push(a);return n.sort((e,t)=>e.enabled===t.enabled?(e.nextRunAt??1/0)-(t.nextRunAt??1/0):e.enabled?-1:1),r.sort((e,t)=>(e.nextRunAt??1/0)-(t.nextRunAt??1/0)),i.sort((e,t)=>{let n=e.lastRunAt??e.nextRunAt??0;return(t.lastRunAt??t.nextRunAt??0)-n}),{recurring:n,upcomingOneTime:r,pastOneTime:i}}function _t(e){return e.lastStatus===`error`||e.lastStatus===`failed`?{label:`Failed`,tone:`negative`}:e.status===`cancelled`?{label:`Cancelled`,tone:`neutral`}:e.lastRunAt==null?{label:`Expired`,tone:`neutral`}:{label:`Completed`,tone:`positive`}}function vt(e,t,n=!0){return{queryKey:te(e,t),queryFn:()=>e?be(e,et(t)):Promise.resolve([]),enabled:n,staleTime:1e4}}function yt(e){return{scheduleId:e,runCount:0,totalEstimatedCostUsd:0,eventCount:0}}function bt(e,t,n){let r=(t??[]).filter(e=>{let t=e.startedAt??e.createdAt;return t>=n.from&&t<=n.to});return{scheduleId:e,runCount:r.length,totalEstimatedCostUsd:r.reduce((e,t)=>{let n=t.estimatedCostUsd;return typeof n==`number`&&Number.isFinite(n)?e+n:e},0),eventCount:0}}function xt({status:e}){return(0,Y.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:e===`ok`||e===`completed`?`var(--system-positive-strong)`:e===`error`||e===`failed`?`var(--system-negative-strong)`:`var(--content-tertiary)`},"aria-label":e??`unknown`})}function St({scheduleName:e,usage:t,onOpenUsage:n}){if(t.status===`loading`)return(0,Y.jsxs)(`div`,{"aria-label":`Loading schedule usage`,className:`flex w-[156px] shrink-0 items-center justify-end gap-3`,children:[(0,Y.jsx)(`span`,{className:`h-5 w-16 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,Y.jsx)(`span`,{className:`h-5 w-16 animate-pulse rounded bg-[var(--surface-muted)]`})]});let r=t.status===`error`,i=r?`--`:Q(t.summary.totalEstimatedCostUsd),a=r?`--`:rt(t.summary.runCount),o=t.status===`ready`&&!(t.summary.totalEstimatedCostUsd>0),s=t.status===`ready`&&t.summary.runCount===0,c=o?`text-[var(--content-tertiary)]`:`text-[var(--content-default)]`,l=s?`text-[var(--content-tertiary)]`:`text-[var(--content-default)]`;return(0,Y.jsxs)(`div`,{className:`flex w-[156px] shrink-0 items-center justify-end gap-3 text-right text-body-small-default`,children:[n?(0,Y.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`View usage for ${e}`,className:`min-w-[64px] cursor-pointer rounded px-1 py-0.5 text-right transition-colors hover:bg-[var(--surface-hover)] ${c}`,children:i}):(0,Y.jsx)(`span`,{"aria-label":`Cost for ${e} in the last 7 days: ${i}`,className:`block min-w-[64px] px-1 py-0.5 ${c}`,children:i}),(0,Y.jsx)(`span`,{"aria-label":`Runs for ${e} in the last 7 days: ${a}`,className:`block min-w-[64px] px-1 py-0.5 ${l}`,children:a})]})}function Ct(){return(0,Y.jsxs)(`div`,{"aria-hidden":`true`,className:`flex items-center gap-3 px-2 pb-1`,children:[(0,Y.jsx)(`div`,{className:`min-w-0 flex-1`}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,Y.jsxs)(`div`,{className:`flex w-[156px] items-center justify-end gap-3 text-right text-label-small-default text-[var(--content-tertiary)]`,children:[(0,Y.jsx)(`span`,{className:`block min-w-[64px] px-1`,children:`Cost (7d)`}),(0,Y.jsx)(`span`,{className:`block min-w-[64px] px-1`,children:`Runs (7d)`})]}),(0,Y.jsx)(`span`,{className:`block w-9`}),(0,Y.jsx)(`span`,{className:`block w-7`})]})]})}function wt({runs:e,isLoading:t,emptyMessage:n=`No runs yet.`}){let i=r(),[a,o]=(0,G.useState)(null);return(0,Y.jsx)(W,{title:`Recent runs`,children:t?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Y.jsx)(C,{className:`h-5 w-5 animate-spin text-stone-400`})}):!e||e.length===0?(0,Y.jsx)(`p`,{className:`py-4 text-center text-body-medium-lighter text-[var(--content-tertiary)] italic`,children:n}):(0,Y.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.map((e,t)=>{let n=ct(e),r=lt(e.output),s=lt(e.error),c=!n&&(r||s),l=a===e.id,u=`schedule-run-details-${t}`;return(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(m,{label:(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,Y.jsx)(xt,{status:e.status}),(0,Y.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`span`,{className:`block text-body-medium-lighter text-[var(--content-default)]`,children:Z(e.startedAt)}),(0,Y.jsxs)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[tt(e.durationMs),` ·`,` `,Q(e.estimatedCostUsd),e.status===`error`&&e.error&&(0,Y.jsxs)(`span`,{className:`ml-2 text-[var(--system-negative-strong)]`,children:[e.error.slice(0,80),e.error.length>80?`…`:``]})]})]}),n||c?(0,Y.jsx)(S,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform ${l?`rotate-90`:``}`}):null]}),onSelect:n?()=>i(V.conversation(n)):c?()=>o(l?null:e.id):void 0,"aria-label":`Run at ${Z(e.startedAt)}`,"aria-expanded":c?l:void 0,"aria-controls":c?u:void 0,className:`h-auto py-2.5 gap-3 -mx-2 px-2`}),c&&l?(0,Y.jsx)(`div`,{id:u,className:`px-2 pb-3`,children:(0,Y.jsxs)(`div`,{className:`space-y-3 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3`,children:[r?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Output`}),(0,Y.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--content-default)]`,children:e.output})]}):null,s?(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Error`}),(0,Y.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--system-negative-strong)]`,children:e.error})]}):null]})}):null]},e.id)})})})}function Tt({schedule:e,assistantId:n,onUpdated:r}){let i=Math.round((e.timeoutMs??6e4)/1e3),[a,o]=(0,G.useState)(!1),[s,c]=(0,G.useState)(String(i)),[u,d]=(0,G.useState)(!1),f=()=>{c(String(i)),o(!0)},p=async i=>{d(!0);try{await _e(n,e.id,{timeoutMs:i}),o(!1),r()}catch(e){t(e,{context:`schedule_update_timeout`}),b.error(`Failed to update timeout.`)}finally{d(!1)}};return a?(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Timeout`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(g,{type:`number`,min:1,max:mt,value:s,onChange:e=>c(e.target.value),className:`w-24`,"aria-label":`Timeout in seconds`}),(0,Y.jsx)(`span`,{className:`text-[var(--content-tertiary)]`,children:`sec`}),(0,Y.jsx)(l,{size:`compact`,onClick:()=>{let e=Number(s);if(!Number.isInteger(e)||e<1||e>1800){b.error(`Timeout must be a whole number between 1 and ${mt} seconds.`);return}p(e*1e3)},disabled:u,children:u?`Saving…`:`Save`}),(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,onClick:()=>o(!1),disabled:u,children:`Cancel`})]})]}):(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Timeout`}),(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsxs)(`span`,{children:[i,`s`,e.timeoutMs==null?` (default)`:``]}),(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,onClick:f,children:`Edit`}),e.timeoutMs!=null&&(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,onClick:()=>void p(null),disabled:u,children:`Reset`})]})]})}function Et({schedule:e,assistantId:n,onBack:i,onDeleted:a,onUpdated:s}){let c=r(),{data:u,isLoading:d,refetch:f}=o({queryKey:re(n,e.id),queryFn:()=>ye(n,e.id),staleTime:1e4}),[m,h]=(0,G.useState)(!1),[g,_]=(0,G.useState)(!1),[v,y]=(0,G.useState)(!1),x=async()=>{h(!0);try{await Ce(n,e.id),f()}catch(e){t(e,{context:`schedule_run_now`}),b.error(`Failed to run schedule.`)}finally{h(!1)}},S=async()=>{y(!0);try{await Se(n,e.id),a()}catch(e){t(e,{context:`schedule_delete`}),b.error(`Failed to delete schedule.`),y(!1),_(!1)}},w=st(e);return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:i,className:`flex items-center gap-1.5 text-body-medium-lighter text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,children:[(0,Y.jsx)(U,{className:`h-4 w-4`}),`Back to schedules`]}),(0,Y.jsx)(W,{title:e.name,subtitle:e.description,accessory:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(p,{tone:pt[e.mode]??`neutral`,children:e.mode}),(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,leftIcon:(0,Y.jsx)(de,{className:`h-3.5 w-3.5`}),onClick:()=>c(V.logs.usageForSchedule(e.id)),children:`View usage`}),w?(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,leftIcon:(0,Y.jsx)(ue,{className:`h-3.5 w-3.5`}),onClick:()=>c(V.conversation(w)),children:`Source`}):null,e.mode===`script`&&(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,leftIcon:m?(0,Y.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}):(0,Y.jsx)(ce,{className:`h-3.5 w-3.5`}),onClick:x,disabled:m,children:m?`Running…`:`Run now`})]}),children:(0,Y.jsxs)(`div`,{className:`space-y-2 text-body-medium-lighter`,children:[e.mode===`script`&&e.script&&(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)] text-body-small-default`,children:`Command`}),(0,Y.jsx)(`pre`,{className:`mt-1 rounded-md bg-[var(--surface-sunken)] p-2 text-body-small-default font-mono text-[var(--content-default)] whitespace-pre-wrap break-all`,children:e.script})]}),e.mode===`script`&&(0,Y.jsx)(Tt,{schedule:e,assistantId:n,onUpdated:s}),e.cadenceDescription?(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Cadence`}),(0,Y.jsx)(`span`,{className:`min-w-0 text-right`,children:e.cadenceDescription})]}):null,(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Status`}),(0,Y.jsx)(`span`,{children:e.enabled?`Enabled`:`Disabled`})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Next run`}),(0,Y.jsx)(`span`,{children:Z(e.nextRunAt)})]}),e.lastRunAt&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Last run`}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(xt,{status:e.lastStatus}),Z(e.lastRunAt)]})]})]})}),(0,Y.jsx)(wt,{runs:u,isLoading:d}),(0,Y.jsx)(W,{title:`Danger zone`,children:(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Delete this schedule`}),(0,Y.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Permanently removes the schedule and all its run history. This cannot be undone.`})]}),g?(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[(0,Y.jsx)(l,{variant:`ghost`,size:`compact`,onClick:()=>_(!1),disabled:v,children:`Cancel`}),(0,Y.jsx)(l,{variant:`danger`,size:`compact`,onClick:()=>void S(),disabled:v,children:v?`Deleting…`:`Yes, delete`})]}):(0,Y.jsx)(l,{variant:`dangerOutline`,size:`compact`,leftIcon:(0,Y.jsx)(fe,{className:`h-3.5 w-3.5`}),onClick:()=>_(!0),children:`Delete`})]})})]})}function Dt(e){let t=e.cadenceDescription.trim();return!t||e.isOneShot||t===e.description.trim()?null:t}function Ot(e){let t=e.description.trim();return!t||t.toLowerCase()===e.name.trim().toLowerCase()?null:t}function kt(e,t){return e.lastRunAt==null?e.nextRunAt==null?null:t?`Scheduled ${Z(e.nextRunAt)}`:`Next ${Z(e.nextRunAt)}`:`Last ${Z(e.lastRunAt)}`}function At({schedule:e,usage:t,onClick:n,onToggle:r,onOpenUsage:i,pastStatus:a}){let o=Dt(e),s=Ot(e),c=kt(e,a!=null);return(0,Y.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-md px-2 py-3 transition-colors hover:bg-[var(--surface-hover)] [&+&]:border-t [&+&]:border-[var(--border-base)]`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:n,className:`min-w-0 flex-1 cursor-pointer text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e.name})}),s?(0,Y.jsx)(`p`,{className:`mt-0.5 truncate text-body-small-default text-[var(--content-tertiary)]`,children:s}):null]}),(o||c)&&(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 text-body-small-default text-[var(--content-tertiary)]`,children:[o?(0,Y.jsx)(`span`,{className:`shrink-0 text-[var(--content-secondary)]`,children:o}):null,c?(0,Y.jsx)(`span`,{className:`shrink-0`,children:c}):null]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3`,children:[(0,Y.jsx)(St,{scheduleName:e.name,usage:t,onOpenUsage:i}),a?(0,Y.jsx)(p,{tone:a.tone,children:a.label}):(0,Y.jsx)(_,{checked:e.enabled,onChange:e=>r?.(e),"aria-label":`Toggle ${e.name}`}),(0,Y.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`Open ${e.name}`,className:`flex h-7 w-7 cursor-pointer items-center justify-center rounded text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-hover)]`,children:(0,Y.jsx)(S,{className:`h-4 w-4`})})]})]})}function jt({kind:e,assistantId:t,name:n,subtitle:r,enabled:i,nextRunAt:a,lastRunAt:s,isRunning:c,onBack:u,onRunNow:d,onToggleEnabled:m,onOpenMemorySettings:h}){let g=e===`consolidation`,v=g&&!i,y=c||v,b=g?i?`On · Managed by Memory`:`Paused`:i?`Enabled`:`Disabled`,{data:x,isLoading:S}=o({queryKey:[`system-task-runs`,t,e],queryFn:()=>e===`heartbeat`?K(t):we(t),staleTime:1e4});return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:u,className:`flex items-center gap-1.5 text-body-medium-lighter text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,children:[(0,Y.jsx)(U,{className:`h-4 w-4`}),`Back to schedules`]}),(0,Y.jsxs)(W,{title:n,subtitle:r,accessory:(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(p,{tone:`neutral`,children:`system`}),g&&i&&h?(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,leftIcon:(0,Y.jsx)(oe,{className:`h-3.5 w-3.5`}),onClick:h,children:`Memory settings`}):null,(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,leftIcon:c?(0,Y.jsx)(C,{className:`h-3.5 w-3.5 animate-spin`}):(0,Y.jsx)(ce,{className:`h-3.5 w-3.5`}),onClick:d,disabled:y,children:c?`Running…`:`Run now`})]}),children:[(0,Y.jsxs)(`div`,{className:`space-y-2 text-body-medium-lighter`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Status`}),(0,Y.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(`span`,{children:b}),!g&&m?(0,Y.jsx)(_,{checked:i,onChange:m,"aria-label":`Toggle ${n}`}):null]})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Next run`}),(0,Y.jsx)(`span`,{children:Z(a)})]}),(0,Y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Y.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Last run`}),(0,Y.jsx)(`span`,{children:Z(s)})]})]}),v?(0,Y.jsx)(f,{tone:`warning`,className:`mt-4`,actions:h?(0,Y.jsx)(l,{variant:`outlined`,size:`compact`,onClick:h,children:`Turn on Memory`}):void 0,children:`Memory is off, so consolidation is paused. Turn Memory back on to resume consolidation.`}):null]}),(0,Y.jsx)(wt,{runs:x,isLoading:S})]})}function Mt({name:e,subtitle:t,enabled:n,nextRunAt:r,lastRunAt:i,usage:a,helperText:o,statusLabel:s,statusTone:c=`neutral`,onClick:l}){return(0,Y.jsx)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-md px-2 py-3 transition-colors hover:bg-[var(--surface-hover)] [&+&]:border-t [&+&]:border-[var(--border-base)]`,children:(0,Y.jsxs)(`button`,{type:`button`,onClick:l,"aria-label":`Open ${e}`,className:`flex min-w-0 flex-1 cursor-pointer flex-wrap items-center gap-3 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,Y.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Y.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,Y.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e})}),(0,Y.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t}),o?(0,Y.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-secondary)]`,children:o}):null,(0,Y.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-body-small-default text-[var(--content-tertiary)]`,children:[r?(0,Y.jsxs)(`span`,{children:[`Next: `,Z(r)]}):null,i?(0,Y.jsxs)(`span`,{children:[`Last: `,Z(i)]}):null]})]}),(0,Y.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-3`,children:[(0,Y.jsx)(St,{scheduleName:e,usage:a}),s?(0,Y.jsx)(p,{tone:c,children:s}):(0,Y.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:n?`var(--system-positive-strong)`:`var(--content-disabled)`},"aria-label":n?`enabled`:`disabled`}),(0,Y.jsx)(S,{className:`h-4 w-4 text-[var(--content-tertiary)]`})]})]})})}function Nt({heartbeatConfig:e,consolidationConfig:t,heartbeatUsage:n,consolidationUsage:r,isLoading:i,hasError:a,onRetry:o,onSelectHeartbeat:s,onSelectConsolidation:c}){let l=e!=null,u=t?.available===!0;if(!i&&!a&&!l&&!u)return null;let p=[...l?[n]:[],...u?[r]:[]].filter(e=>e.status===`ready`),m=p.reduce((e,t)=>e+(t.summary.totalEstimatedCostUsd??0),0),h=i?(0,Y.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Y.jsx)(C,{className:`h-5 w-5 animate-spin text-stone-400`})}):a&&!l&&!u?(0,Y.jsxs)(f,{tone:`error`,children:[`Failed to load system jobs.`,` `,(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):(0,Y.jsxs)(`div`,{children:[l?(0,Y.jsx)(Mt,{name:`Heartbeat`,subtitle:dt(e),enabled:e.enabled,nextRunAt:e.nextRunAt,lastRunAt:e.lastRunAt,usage:n,onClick:s}):null,u?(0,Y.jsx)(Mt,{name:`Consolidation`,subtitle:ft(t),enabled:t.enabled,helperText:t.enabled?void 0:`Memory is off, so consolidation is paused.`,nextRunAt:t.nextRunAt,lastRunAt:t.lastRunAt,usage:r,statusLabel:t.enabled?void 0:`Paused`,statusTone:`warning`,onClick:c}):null,a?(0,Y.jsx)(`div`,{className:`pt-3 first:pt-0`,children:(0,Y.jsxs)(f,{tone:`error`,children:[`Some system jobs failed to load.`,` `,(0,Y.jsx)(`button`,{type:`button`,onClick:o,className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]})}):null]});return(0,Y.jsx)(W,{children:(0,Y.jsx)(d.Root,{type:`multiple`,children:(0,Y.jsxs)(d.Item,{value:`system-jobs`,children:[(0,Y.jsxs)(d.Trigger,{className:`group justify-between gap-3`,children:[(0,Y.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1 text-left`,children:[(0,Y.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`System`}),(0,Y.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Built-in jobs managed by the assistant runtime`})]}),(0,Y.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[p.length>0?(0,Y.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[Q(m),` (7d)`]}):null,(0,Y.jsx)(ae,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]})]}),(0,Y.jsx)(d.Content,{children:(0,Y.jsx)(`div`,{className:`mt-3`,children:h})})]})})})}function Pt(e,n){let r=a(),{data:i,isLoading:s,isError:c,refetch:l}=o({queryKey:[`heartbeat-config`,e],queryFn:()=>Te(e),enabled:!!e,staleTime:1e4}),{data:u,isLoading:d,isError:f,refetch:p}=o({queryKey:[`consolidation-config`,e],queryFn:()=>ke(e),enabled:!!e,staleTime:1e4}),{data:m,isLoading:h,isError:g,refetch:_}=o({queryKey:[`system-task-runs-summary`,e,`heartbeat`,100],queryFn:()=>K(e,100),enabled:!!e&&i!=null,staleTime:1e4}),{data:v,isLoading:y,isError:x,refetch:S}=o({queryKey:[`system-task-runs-summary`,e,`consolidation`,100],queryFn:()=>we(e,100),enabled:!!e&&u?.available===!0,staleTime:1e4}),C=(0,G.useMemo)(()=>et(n),[n]),w=(0,G.useMemo)(()=>h?{status:`loading`}:g?{status:`error`}:{status:`ready`,summary:bt($.heartbeat,m,C)},[m,g,h,C]),T=(0,G.useMemo)(()=>y?{status:`loading`}:x?{status:`error`}:{status:`ready`,summary:bt($.consolidation,v,C)},[v,x,y,C]),[E,D]=(0,G.useState)(!1),[O,k]=(0,G.useState)(!1),A=(0,G.useRef)([]),j=(0,G.useCallback)(t=>{if(!e)return;let n=()=>{r.invalidateQueries({queryKey:[`system-task-runs`,e,t]})};n();let i=setTimeout(n,1e3),a=setTimeout(n,5e3);A.current.push(i,a)},[e,r]),M=(0,G.useCallback)(async n=>{if(!e)return;let r=n===`heartbeat`?D:k,i=n===`heartbeat`?Oe:Ae,a=n===`heartbeat`?l:p,o=n===`heartbeat`?_:S,s=n===`heartbeat`?`Heartbeat started.`:`Consolidation queued.`,c=n===`heartbeat`?`Heartbeat skipped.`:`Consolidation already queued or running.`;r(!0);try{let t=await i(e);a(),j(n),o(),t.ran?b.success(s):b.info(c)}catch(e){t(e,{context:`${n}_run_now`}),b.error(`Failed to run ${n}.`)}finally{r(!1)}},[e,p,S,l,_,j]),N=(0,G.useCallback)(async(n,i)=>{if(!e||n!==`heartbeat`)return;let a=[`${n}-config`,e],o=`Heartbeat`;try{let t=await De(e,{enabled:i});r.setQueryData(a,t),b.success(i?`${o} enabled.`:`${o} disabled.`)}catch(e){t(e,{context:`${n}_toggle`}),b.error(`Failed to toggle heartbeat.`)}},[e,r]),P=(0,G.useCallback)(()=>{l(),p(),_(),S()},[p,S,l,_]);return(0,G.useEffect)(()=>{let e=A;return()=>{for(let t of e.current)clearTimeout(t);e.current=[]}},[]),{heartbeatConfig:i,consolidationConfig:u,heartbeatUsage:w,consolidationUsage:T,isLoading:s||d,hasError:c||f,isHeartbeatRunning:E,isConsolidationRunning:O,isHeartbeatLoading:s,isHeartbeatError:c,isConsolidationLoading:d,isConsolidationError:f,refetchHeartbeat:l,refetchConsolidation:p,handleRunNow:M,handleToggle:N,refetchAll:P}}function Ft({onCreate:e}){return(0,Y.jsxs)(`div`,{className:`flex min-h-[400px] flex-col items-center justify-center rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] px-6 py-16 text-center`,children:[(0,Y.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--tag-bg-neutral)]`,children:(0,Y.jsx)(x,{className:`h-6 w-6 text-[var(--content-faint)]`})}),(0,Y.jsx)(`h2`,{className:`mt-4 text-title-small text-[var(--content-default)]`,children:`No schedules`}),(0,Y.jsx)(`p`,{className:`mt-1 text-body-medium-lighter text-[var(--content-quiet)]`,children:`Scheduled automations will appear here once created. You can create one yourself or ask your assistant to set it up.`}),(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsxs)(l,{variant:`primary`,onClick:e,children:[(0,Y.jsx)(le,{className:`h-4 w-4`}),`Create schedule`]})})]})}function It({label:e,children:t}){return(0,Y.jsxs)(`div`,{className:`[&+&]:mt-4`,children:[(0,Y.jsx)(`div`,{className:`px-2 pb-1 text-label-medium-default uppercase tracking-wider text-[var(--content-tertiary)]`,children:e}),(0,Y.jsx)(`div`,{children:t})]})}function Lt({onBack:e}){return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[(0,Y.jsxs)(`button`,{type:`button`,onClick:e,className:`flex items-center gap-1.5 text-body-medium-lighter text-[var(--content-secondary)] hover:text-[var(--content-default)] transition-colors`,children:[(0,Y.jsx)(U,{className:`h-4 w-4`}),`Back to schedules`]}),(0,Y.jsx)(f,{tone:`error`,children:`Schedule not found. It may have been deleted or the link may be out of date.`})]})}function Rt(){let e=r(),{scheduleId:n}=i(),a=H(),s=pe(),{data:c,isLoading:u,isError:p,refetch:m}=o({queryKey:ne(s),queryFn:()=>ve(s),staleTime:1e4}),{data:h,isLoading:g,isError:_}=o(vt(s,a,n==null)),v=Pt(s,a),{data:y=!1}=o({queryKey:[`assistant-memory-opt-out-capability`,s],queryFn:async()=>{let e=await ee(s);return e.ok&&e.data.capabilities?.memoryOptOut===!0},retry:!1,staleTime:1e4}),x=ut(n),[S,w]=(0,G.useState)(!1),[T]=(0,G.useState)(()=>Date.now()),E=(0,G.useMemo)(()=>n&&!x?c?.find(e=>e.id===n)??null:null,[c,n,x]),D=(0,G.useMemo)(()=>new Map((h??[]).map(e=>[e.scheduleId,e])),[h]),O=(0,G.useCallback)(e=>g?{status:`loading`}:_?{status:`error`}:{status:`ready`,summary:D.get(e)??yt(e)},[_,g,D]),k=()=>e(V.settings.schedules),A=t=>e(V.settings.schedule(t)),j=()=>e(V.settings.advanced),M=(0,G.useCallback)(()=>{w(!1),m(),b.success(`Schedule created.`)},[m]),N=(0,G.useCallback)(async(e,n)=>{try{await xe(s,e,n),m()}catch(e){t(e,{context:`schedule_toggle`}),b.error(`Failed to toggle schedule.`)}},[s,m]);if(x===`heartbeat`&&v.heartbeatConfig)return(0,Y.jsx)(jt,{kind:`heartbeat`,assistantId:s,name:`Heartbeat`,subtitle:dt(v.heartbeatConfig),enabled:v.heartbeatConfig.enabled,nextRunAt:v.heartbeatConfig.nextRunAt,lastRunAt:v.heartbeatConfig.lastRunAt,isRunning:v.isHeartbeatRunning,onBack:k,onRunNow:()=>void v.handleRunNow(`heartbeat`),onToggleEnabled:e=>void v.handleToggle(`heartbeat`,e)},`heartbeat`);if(x===`consolidation`&&v.consolidationConfig?.available===!0)return(0,Y.jsx)(jt,{kind:`consolidation`,assistantId:s,name:`Consolidation`,subtitle:ft(v.consolidationConfig),enabled:v.consolidationConfig.enabled,nextRunAt:v.consolidationConfig.nextRunAt,lastRunAt:v.consolidationConfig.lastRunAt,isRunning:v.isConsolidationRunning,onBack:k,onRunNow:()=>void v.handleRunNow(`consolidation`),onOpenMemorySettings:y?j:void 0},`consolidation`);if(E)return(0,Y.jsx)(Et,{schedule:E,assistantId:s,onBack:k,onDeleted:()=>{k(),m()},onUpdated:()=>void m()},E.id);if(u||x&&v.isLoading)return(0,Y.jsx)(`div`,{className:`w-full`,children:(0,Y.jsx)(`div`,{className:`flex min-h-[400px] items-center justify-center`,children:(0,Y.jsx)(C,{className:`h-6 w-6 animate-spin text-stone-400`})})});if(p&&!c)return(0,Y.jsx)(`div`,{className:`w-full`,children:(0,Y.jsxs)(f,{tone:`error`,children:[`Failed to load schedules.`,` `,(0,Y.jsx)(`button`,{type:`button`,onClick:()=>void m(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]})});if(x&&v.hasError)return(0,Y.jsxs)(`div`,{className:`mx-auto max-w-[940px] space-y-3`,children:[(0,Y.jsxs)(f,{tone:`error`,children:[`Failed to load`,` `,x===`heartbeat`?`heartbeat`:`consolidation`,` `,`schedule.`,` `,(0,Y.jsx)(`button`,{type:`button`,onClick:()=>{x===`heartbeat`?v.refetchHeartbeat():v.refetchConsolidation()},className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}),(0,Y.jsxs)(l,{variant:`outlined`,onClick:k,children:[(0,Y.jsx)(U,{className:`h-4 w-4`}),`Back to schedules`]})]});if(n!=null)return(0,Y.jsx)(Lt,{onBack:k});let P=c??[],{recurring:F,upcomingOneTime:I,pastOneTime:L}=gt(P,T),R=F.length>0||I.length>0,z=(t,n=!1)=>(0,Y.jsx)(At,{schedule:t,usage:O(t.id),onClick:()=>A(t.id),onToggle:e=>void N(t.id,e),onOpenUsage:()=>e(V.logs.usageForSchedule(t.id)),pastStatus:n?_t(t):void 0},t.id);return(0,Y.jsxs)(`div`,{className:`space-y-4`,children:[P.length>0?(0,Y.jsx)(`div`,{className:`flex items-center justify-end`,children:(0,Y.jsxs)(l,{variant:`primary`,onClick:()=>w(!0),children:[(0,Y.jsx)(le,{className:`h-4 w-4`}),`New schedule`]})}):null,_?(0,Y.jsx)(f,{tone:`warning`,className:`py-2 text-body-small-default`,children:`Schedule usage stats are unavailable right now.`}):null,P.length===0?(0,Y.jsx)(Ft,{onCreate:()=>w(!0)}):(0,Y.jsx)(W,{title:`Schedules`,children:(0,Y.jsxs)(`div`,{children:[(0,Y.jsx)(Ct,{}),F.length>0&&(0,Y.jsx)(It,{label:`Recurring`,children:F.map(e=>z(e))}),I.length>0&&(0,Y.jsx)(It,{label:`One-time`,children:I.map(e=>z(e))}),!R&&(0,Y.jsx)(`p`,{className:`px-2 py-3 text-body-small-default text-[var(--content-tertiary)]`,children:`No upcoming schedules.`}),L.length>0&&(0,Y.jsx)(d.Root,{type:`multiple`,className:`mt-3 border-t border-[var(--border-base)] pt-1`,children:(0,Y.jsxs)(d.Item,{value:`past-one-time`,children:[(0,Y.jsxs)(d.Trigger,{className:`group gap-2 rounded-md px-2 py-2 text-body-small-default text-[var(--content-tertiary)] transition-colors hover:bg-[var(--surface-hover)]`,children:[(0,Y.jsx)(ae,{className:`h-4 w-4 shrink-0 transition-transform group-data-[state=open]:rotate-180`}),`Past one-time (`,L.length,`)`]}),(0,Y.jsx)(d.Content,{children:(0,Y.jsx)(`div`,{children:L.map(e=>z(e,!0))})})]})})]})}),(0,Y.jsx)(Nt,{heartbeatConfig:v.heartbeatConfig,consolidationConfig:v.consolidationConfig,heartbeatUsage:v.heartbeatUsage,consolidationUsage:v.consolidationUsage,isLoading:v.isLoading,hasError:v.hasError,onRetry:v.refetchAll,onSelectHeartbeat:()=>A($.heartbeat),onSelectConsolidation:()=>A($.consolidation)}),s?(0,Y.jsx)(Ke,{isOpen:S,assistantId:s,onClose:()=>w(!1),onCreated:M}):null]})}export{Rt as SchedulesPage};
|