@vellumai/web 0.10.5-staging.2 → 0.10.5-staging.3
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/{account-page-D7N_WAt8.js → account-page-B4_qrJXM.js} +1 -1
- package/dist/assets/{acp-run-detail-panel-DGXWy1zV.js → acp-run-detail-panel-ZJb9mPFf.js} +1 -1
- package/dist/assets/{advanced-page-CA-Fynld.js → advanced-page-BsF8JW-4.js} +1 -1
- package/dist/assets/{ai-page-zZGFrEzO.js → ai-page-BNaD9M7D.js} +1 -1
- package/dist/assets/{api-key-screen-CUEhMjCI.js → api-key-screen-DiW5rDSM.js} +1 -1
- package/dist/assets/{archive-page-hU8w9ytm.js → archive-page-DZ_8uaQt.js} +1 -1
- package/dist/assets/{background-task-detail-panel-BbCZGqHm.js → background-task-detail-panel-DRBcuGts.js} +1 -1
- package/dist/assets/{billing-page-DvW9-kBw.js → billing-page-Rw3ECU55.js} +1 -1
- package/dist/assets/{bookmarks-page-DnqyJXnk.js → bookmarks-page-DmPcHyC_.js} +1 -1
- package/dist/assets/{command-palette-B0pI8wFe.js → command-palette-DkJaPl6x.js} +1 -1
- package/dist/assets/{command-palette-window-page-BgQhfKX5.js → command-palette-window-page-v-j032zP.js} +1 -1
- package/dist/assets/{community-page-D85Cmkcv.js → community-page-BZ9IruGQ.js} +1 -1
- package/dist/assets/{contacts-page-route-BZz1O1XL.js → contacts-page-route-iggE95MQ.js} +1 -1
- package/dist/assets/{debug-page-BA2gOVPd.js → debug-page-DhYoaQMd.js} +1 -1
- package/dist/assets/{deploy-dialogs-wNJRqYiu.js → deploy-dialogs-Cbti_xsn.js} +1 -1
- package/dist/assets/{detail-panel-stop-button-Dc3MB_3r.js → detail-panel-stop-button-BHEQd627.js} +1 -1
- package/dist/assets/detail-shell-CPp3KhI8.js +4 -0
- package/dist/assets/{developer-page-B9c_NOq0.js → developer-page-D0Ttwt5o.js} +1 -1
- package/dist/assets/{devices-page-C_MPiuEN.js → devices-page-CkA_1aNA.js} +1 -1
- package/dist/assets/{dictation-overlay-page-dlmrZeaQ.js → dictation-overlay-page-BHrUGwJK.js} +1 -1
- package/dist/assets/{document-viewer-page-CVJKsLcz.js → document-viewer-page-CnFgbOqH.js} +1 -1
- package/dist/assets/{earn-credits-modal-gdB0QAos.js → earn-credits-modal-DOIDaArW.js} +1 -1
- package/dist/assets/{emails-page-wOQsKKch.js → emails-page-B0bc-Gj2.js} +1 -1
- package/dist/assets/{file-editor-sKfnpW-D.js → file-editor-Bm5LJXwA.js} +1 -1
- package/dist/assets/{general-page-C0EgypjR.js → general-page-Df1AoP_V.js} +1 -1
- package/dist/assets/{hatching-screen-B4dscGGq.js → hatching-screen-CENPVFoZ.js} +1 -1
- package/dist/assets/{home-page-route-BYUiByXT.js → home-page-route-mQBcsrfW.js} +1 -1
- package/dist/assets/{hosting-screen-oFxveMgT.js → hosting-screen-I6v4dE5d.js} +1 -1
- package/dist/assets/{identity-page-route-jU_Rzwhx.js → identity-page-route-DlM3U1hC.js} +1 -1
- package/dist/assets/index-B-S-gNKm.js +131 -0
- package/dist/assets/{inspect-page-BKOxlmBF.js → inspect-page-BIEfENnw.js} +1 -1
- package/dist/assets/{install-C22EWSPL.js → install-lYdVLxh2.js} +1 -1
- package/dist/assets/{integrations-page-BBcBVFLT.js → integrations-page-BBZ2VFVI.js} +1 -1
- package/dist/assets/{intelligence-layout-BqECxena.js → intelligence-layout-zqIx7Q-I.js} +1 -1
- package/dist/assets/{keyboard-shortcuts-page-BZTs62Wj.js → keyboard-shortcuts-page-H4mn2-og.js} +1 -1
- package/dist/assets/{library-detail-page-Ck65_rdB.js → library-detail-page-DTbtqnJW.js} +1 -1
- package/dist/assets/{library-page-BPrjQGL6.js → library-page-CtniKYuA.js} +1 -1
- package/dist/assets/{logout-page-8AH_ZU_7.js → logout-page-BbQCJKwL.js} +1 -1
- package/dist/assets/{logs-layout-DD-9gYta.js → logs-layout-xXeY2t6B.js} +1 -1
- package/dist/assets/{memory-router-playground-page-BRe1h0Mv.js → memory-router-playground-page-BhFJ0lwa.js} +1 -1
- package/dist/assets/{mobile-sidebar-drawer-CzcwUqpn.js → mobile-sidebar-drawer-BA9ERuJ7.js} +1 -1
- package/dist/assets/{notifications-page-CNz_ce_3.js → notifications-page-BSwHh8Mx.js} +1 -1
- package/dist/assets/{oauth-complete-page-BY4IUzM3.js → oauth-complete-page-KFGDIl3q.js} +1 -1
- package/dist/assets/{oauth-popup-complete-page-DFSwc7gE.js → oauth-popup-complete-page-C9FKG9VY.js} +1 -1
- package/dist/assets/{pairing-page-rN8Xn7wW.js → pairing-page-CT45DoH8.js} +1 -1
- package/dist/assets/{plugins-page-BQcsJgVb.js → plugins-page-H6DAm3HM.js} +1 -1
- package/dist/assets/{prechat-route-6ome-g7N.js → prechat-route-BfQPMYu8.js} +1 -1
- package/dist/assets/{privacy-page-DtQMDaEM.js → privacy-page-CLJnEPBh.js} +1 -1
- package/dist/assets/{privacy-screen-DdeTm5d2.js → privacy-screen-DWLF6KuW.js} +1 -1
- package/dist/assets/{provider-callback-page-CwplW9PX.js → provider-callback-page-UAlBgfqn.js} +1 -1
- package/dist/assets/{research-mock-page-DMXNiiqw.js → research-mock-page-5ewHxOuJ.js} +1 -1
- package/dist/assets/{research-onboarding-route-BYbFY_h9.js → research-onboarding-route-RxDDgsKx.js} +1 -1
- package/dist/assets/{review-terms-screen-73sQOI_T.js → review-terms-screen-BqGwop2y.js} +1 -1
- package/dist/assets/{select-assistant-screen-Y_lcjNSt.js → select-assistant-screen-BfhDJw-S.js} +1 -1
- package/dist/assets/{settings-layout-B99yx7iZ.js → settings-layout-D_5HXQhT.js} +1 -1
- package/dist/assets/{share-feedback-modal-BqFpqbwt.js → share-feedback-modal-B3axmWXR.js} +1 -1
- package/dist/assets/{sidebar-tree-nlZD0iQq.js → sidebar-tree-DM30_BN8.js} +1 -1
- package/dist/assets/{signup-page-BBz6b3Nv.js → signup-page-DlqG9kP3.js} +1 -1
- package/dist/assets/{skills-page-CyNFwtMm.js → skills-page-C303uEzv.js} +1 -1
- package/dist/assets/{sounds-page-DTwqrvjQ.js → sounds-page-DC_yF186.js} +1 -1
- package/dist/assets/{subagent-detail-panel-B7-EOosT.js → subagent-detail-panel-B69kOmY_.js} +2 -2
- package/dist/assets/{system-events-page-kz2QZXlf.js → system-events-page-CMXtS3Lt.js} +1 -1
- package/dist/assets/{tiptap-document-editor-BkhvVzHq.js → tiptap-document-editor-BILtD2S2.js} +1 -1
- package/dist/assets/{tool-detail-panel-Djpgj3--.js → tool-detail-panel-CG9Wp2NK.js} +2 -2
- package/dist/assets/{trace-page-BEyQxpBX.js → trace-page-k0cYj2Bt.js} +1 -1
- package/dist/assets/{upgrade-cancel-page-BMj8YpAx.js → upgrade-cancel-page-KGY9H9Mg.js} +1 -1
- package/dist/assets/{upgrade-success-page-BZjQzQQB.js → upgrade-success-page-9MHgGZFb.js} +1 -1
- package/dist/assets/{usage-page-YnMiaGbU.js → usage-page-CVI5PvbA.js} +1 -1
- package/dist/assets/{use-skill-categories-6bE1o8xC.js → use-skill-categories-nKUbiuQn.js} +1 -1
- package/dist/assets/{voice-page-CjOnnW4C.js → voice-page-ChYDqNwz.js} +1 -1
- package/dist/assets/{weather-forecast-display-Aqhg0YWH.js → weather-forecast-display-DaU-H5wf.js} +1 -1
- package/dist/assets/{welcome-screen-BYiDdI6u.js → welcome-screen-1tj61zH7.js} +1 -1
- package/dist/assets/{workflow-detail-panel-CEiMuzvs.js → workflow-detail-panel-Di63Av9t.js} +1 -1
- package/dist/assets/{workspace-page-CeCbEfiQ.js → workspace-page-C5nupXN6.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/detail-shell-CyXDiAEa.js +0 -4
- package/dist/assets/index-CZ2UBc_U.js +0 -130
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{n as s,t as c}from"./panel-item-Q1g7DFJw.js";import{t as l}from"./menu-BLJEjTFD.js";import{t as u}from"./notice-CqRgVmeL.js";import{t as d}from"./popover-BUj2v1xo.js";import{t as f}from"./input-D4W4p0pZ.js";import{n as p}from"./toast-sdJJ6aTV.js";import{t as m}from"./createLucideIcon-BlMXrA59.js";import{t as h}from"./bell-DB1SrBre.js";import{t as g}from"./check-D6WkI0gF.js";import{t as _}from"./loader-circle-BFRVtR3K.js";import{t as v}from"./moon-CKINz50a.js";import{t as y}from"./triangle-alert-C3aHZq1F.js";import{a as b}from"./routes-C6gxiCrz.js";import{n as x}from"./use-is-mobile-jACt_z2d.js";import{ct as S,dt as C,ft as w,lt as T,mt as E,pt as D,ut as O}from"./react-query.gen-gQ1_8EHv.js";import{Fr as k,Nr as A,Pr as j,x as M}from"./index-CZ2UBc_U.js";import{t as N}from"./mutation-error-Iab5I7oz.js";import{r as P}from"./format-date-D4tzd1DT.js";var F=m(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),I=m(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),L=e(t(),1);function R(e){e.invalidateQueries({queryKey:O()}),e.invalidateQueries({queryKey:E()})}function z(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var B=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],V=o();function H({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(D()),u=x(),[d,f]=(0,L.useState)(!1),p=()=>R(i),m=t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();o.mutate({path:{id:e},body:{snoozed_until:n}},{onSuccess:p,onError:N(`Failed to snooze notification`)})},h=()=>{o.mutate({path:{id:e},body:{snoozed_until:null}},{onSuccess:p,onError:N(`Failed to clear snooze`)})};return u?(0,V.jsxs)(s.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:n}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Snooze until…`})}),(0,V.jsxs)(s.Body,{children:[B.map(({label:e,hours:t})=>(0,V.jsx)(c,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,V.jsx)(c,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,V.jsxs)(l.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(l.Trigger,{children:n}),(0,V.jsxs)(l.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,V.jsx)(l.Label,{children:`Snooze until…`}),B.map(({label:e,hours:t})=>(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>m(t),children:e},e)),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l.Separator,{}),(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>h(),children:`Clear snooze`})]})]})]})}function U({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(C()),l=a(w()),[u,d]=(0,L.useState)(``),p=()=>R(s),m=()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();c.mutate({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}},{onSuccess:e=>{n(e),p(),t()},onError:N(`Failed to pause alerts`)})},h=e=>{l.mutate({path:{rule_id:e}},{onSuccess:()=>{i(e),p(),t()},onError:N(`Failed to resume alerts`)})},g=c.isPending||l.isPending;return(0,V.jsxs)(`div`,{children:[!o&&(0,V.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,V.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,P(e.expires_at)]})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h(e.id),disabled:g,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,V.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(),disabled:g,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,V.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function W({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=z(e),a=!e.is_read;return(0,V.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,V.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,V.jsx)(y,{className:`h-3 w-3`}),`Alert`]}),i&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,V.jsx)(g,{className:`h-3 w-3`}),`Resolved`]})]}),(0,V.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,V.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsxs)(`span`,{children:[`Last seen `,P(e.last_seen_at)]}),e.occurrence_count>1&&(0,V.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(g,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,V.jsx)(H,{notificationId:e.id,currentlySnoozed:i,children:(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function G(){let e=k({platformHostedOnly:!0}),t=A(),o=j(),c=r(),l=x(),[f,m]=(0,L.useState)(`open`),[g,v]=(0,L.useState)(!1),[y,C]=(0,L.useState)([]),{data:w,isLoading:E,isError:D,refetch:O}=i({...T({query:{status:f}}),enabled:e===`full`&&t}),N=e===`full`&&o||(t?E:!1);(0,L.useEffect)(()=>{!t&&g&&v(!1)},[t,g]);let P=t?D:!1,z=t?w?.results??[]:[],B=z.filter(e=>!e.is_read&&!e.is_resolved),H=a(S()),[G,K]=(0,L.useState)(new Set),[q,J]=(0,L.useState)(!1),Y=(0,L.useCallback)(()=>R(c),[c]),X=async(e,t)=>{K(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),Y()}catch(e){p.error(e instanceof Error?e.message:`Failed to update notification`)}finally{K(t=>{let n=new Set(t);return n.delete(e),n})}},Z=async()=>{if(!(B.length===0||q)){J(!0);try{await Promise.allSettled(B.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{Y(),J(!1)}}},Q=(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,V.jsx)(F,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),$=(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,V.jsx)(n,{replace:!0,to:b.settings.general}):e===`disabled`?(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,V.jsx)(M,{children:`Log in to the Vellum platform to view notifications.`})]}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(l?(0,V.jsxs)(s.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:Q}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Pause alerts`})}),(0,V.jsx)(s.Body,{children:(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,V.jsxs)(d.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(d.Trigger,{asChild:!0,children:Q}),(0,V.jsx)(d.Content,{align:`end`,className:`w-72`,children:$})]}))]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=f===e;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),f===`open`&&B.length>1&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>void Z(),disabled:q,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[q?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(I,{className:`h-3 w-3`}),`Mark all as read (`,B.length,`)`]})]}),N?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,V.jsx)(_,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):P?(0,V.jsxs)(u,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,V.jsx)(`button`,{type:`button`,onClick:()=>void O(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):z.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,V.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,V.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,V.jsx)(`div`,{className:`space-y-3`,children:z.map(e=>(0,V.jsx)(W,{notification:e,onAck:(e,t)=>void X(e,t),isAcking:G.has(e.id)},e.id))})]})}export{G as NotificationsPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{r as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as r}from"./QueryClientProvider-DKhXIxGb.js";import{t as i}from"./useQuery-B45lW1Kk.js";import{t as a}from"./useMutation-Lj4VunQV.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{n as s,t as c}from"./panel-item-Q1g7DFJw.js";import{t as l}from"./menu-BLJEjTFD.js";import{t as u}from"./notice-CqRgVmeL.js";import{t as d}from"./popover-BUj2v1xo.js";import{t as f}from"./input-D4W4p0pZ.js";import{n as p}from"./toast-sdJJ6aTV.js";import{t as m}from"./createLucideIcon-BlMXrA59.js";import{t as h}from"./bell-DB1SrBre.js";import{t as g}from"./check-D6WkI0gF.js";import{t as _}from"./loader-circle-BFRVtR3K.js";import{t as v}from"./moon-CKINz50a.js";import{t as y}from"./triangle-alert-C3aHZq1F.js";import{a as b}from"./routes-C6gxiCrz.js";import{n as x}from"./use-is-mobile-jACt_z2d.js";import{ct as S,dt as C,ft as w,lt as T,mt as E,pt as D,ut as O}from"./react-query.gen-gQ1_8EHv.js";import{Fr as k,Nr as A,Pr as j,x as M}from"./index-B-S-gNKm.js";import{t as N}from"./mutation-error-Iab5I7oz.js";import{r as P}from"./format-date-D4tzd1DT.js";var F=m(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),I=m(`check-check`,[[`path`,{d:`M18 6 7 17l-5-5`,key:`116fxf`}],[`path`,{d:`m22 10-7.5 7.5L13 16`,key:`ke71qq`}]]),L=e(t(),1);function R(e){e.invalidateQueries({queryKey:O()}),e.invalidateQueries({queryKey:E()})}function z(e){return e.snoozed_until?new Date(e.snoozed_until)>new Date:!1}var B=[{label:`1 hour`,hours:1},{label:`4 hours`,hours:4},{label:`24 hours`,hours:24},{label:`1 week`,hours:168}],V=o();function H({notificationId:e,currentlySnoozed:t,children:n}){let i=r(),o=a(D()),u=x(),[d,f]=(0,L.useState)(!1),p=()=>R(i),m=t=>{let n=new Date(new Date().getTime()+t*60*60*1e3).toISOString();o.mutate({path:{id:e},body:{snoozed_until:n}},{onSuccess:p,onError:N(`Failed to snooze notification`)})},h=()=>{o.mutate({path:{id:e},body:{snoozed_until:null}},{onSuccess:p,onError:N(`Failed to clear snooze`)})};return u?(0,V.jsxs)(s.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:n}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Snooze until…`})}),(0,V.jsxs)(s.Body,{children:[B.map(({label:e,hours:t})=>(0,V.jsx)(c,{label:e,onSelect:()=>{o.isPending||(f(!1),m(t))}},e)),t&&(0,V.jsx)(c,{label:`Clear snooze`,onSelect:()=>{o.isPending||(f(!1),h())}})]})]})]}):(0,V.jsxs)(l.Root,{open:d,onOpenChange:f,children:[(0,V.jsx)(l.Trigger,{children:n}),(0,V.jsxs)(l.Content,{align:`start`,className:`min-w-[12rem]`,children:[(0,V.jsx)(l.Label,{children:`Snooze until…`}),B.map(({label:e,hours:t})=>(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>m(t),children:e},e)),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(l.Separator,{}),(0,V.jsx)(l.Item,{disabled:o.isPending,onSelect:()=>h(),children:`Clear snooze`})]})]})]})}function U({existingRules:e,onClose:t,onPauseCreated:n,onPauseDeleted:i,hideTitle:o=!1}){let s=r(),c=a(C()),l=a(w()),[u,d]=(0,L.useState)(``),p=()=>R(s),m=()=>{let e=new Date(new Date().getTime()+365*24*60*60*1e3).toISOString();c.mutate({body:{notification_type:`alert`,dedupe_key_prefix:``,reason:u.trim()||`User requested pause`,expires_at:e}},{onSuccess:e=>{n(e),p(),t()},onError:N(`Failed to pause alerts`)})},h=e=>{l.mutate({path:{rule_id:e}},{onSuccess:()=>{i(e),p(),t()},onError:N(`Failed to resume alerts`)})},g=c.isPending||l.isPending;return(0,V.jsxs)(`div`,{children:[!o&&(0,V.jsx)(`p`,{className:`mb-2 text-body-medium-default text-[var(--content-default)]`,children:`Pause alerts`}),e.length>0?(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Active pause rules:`}),e.map(e=>(0,V.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-2 py-2`,children:[(0,V.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,V.jsx)(`p`,{className:`truncate text-body-small-default text-[var(--content-default)]`,children:e.reason||`All alerts paused`}),e.expires_at&&(0,V.jsxs)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Expires `,P(e.expires_at)]})]}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>h(e.id),disabled:g,className:`ml-2 shrink-0 cursor-pointer rounded px-2 py-1 text-body-small-default text-[var(--system-negative-strong)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:`Resume`})]},e.id))]}):(0,V.jsxs)(`div`,{className:`space-y-2`,children:[(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Temporarily mute all alert notifications.`}),(0,V.jsx)(f,{type:`text`,value:u,onChange:e=>d(e.target.value),placeholder:`Reason (optional)`}),(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(),disabled:g,className:`w-full cursor-pointer rounded-md bg-[var(--primary-base)] px-3 py-1.5 text-body-medium-default text-[var(--content-inset)] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-50`,children:c.isPending?(0,V.jsxs)(`span`,{className:`flex items-center justify-center gap-2`,children:[(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}),`Pausing…`]}):`Pause all alerts`})]})]})}function W({notification:e,onAck:t,isAcking:n}){let r=e.notification_type===`alert`,i=z(e),a=!e.is_read;return(0,V.jsxs)(`div`,{className:`relative rounded-lg border border-[var(--border-base)] p-4`,style:{background:e.is_resolved?`var(--surface-base)`:`var(--surface-lift)`,opacity:e.is_resolved?.75:1},children:[(0,V.jsx)(`div`,{className:`flex items-start gap-3`,children:(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col items-start gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[a&&!e.is_resolved&&(0,V.jsx)(`span`,{"aria-hidden":!0,className:`h-2 w-2 shrink-0 rounded-full bg-[var(--primary-base)]`}),r&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-negative-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[(0,V.jsx)(y,{className:`h-3 w-3`}),`Alert`]}),i&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[var(--surface-base)] px-2 py-0.5 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),`Snoozed`]}),e.is_resolved&&(0,V.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full bg-[color-mix(in_oklab,var(--system-positive-strong)_14%,transparent)] px-2 py-0.5 text-body-small-default text-[var(--system-positive-strong)]`,children:[(0,V.jsx)(g,{className:`h-3 w-3`}),`Resolved`]})]}),(0,V.jsx)(`h3`,{className:`text-body-medium-default leading-tight`,style:{color:e.is_resolved?`var(--content-secondary)`:`var(--content-default)`},children:e.title}),e.body&&(0,V.jsx)(`p`,{className:`text-body-small-default leading-relaxed text-[var(--content-secondary)]`,children:e.body})]})}),(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-3 text-body-small-default text-[var(--content-secondary)]`,children:[(0,V.jsxs)(`span`,{children:[`Last seen `,P(e.last_seen_at)]}),e.occurrence_count>1&&(0,V.jsxs)(`span`,{children:[`· `,e.occurrence_count,`× occurrences`]})]}),!e.is_resolved&&(0,V.jsxs)(`div`,{className:`mt-3 flex items-center gap-2 border-t border-[var(--border-base)] pt-3`,children:[(0,V.jsxs)(`button`,{type:`button`,onClick:()=>t(e.id,a),disabled:n,className:`flex cursor-pointer items-center gap-1.5 rounded-md px-3 py-1.5 text-body-small-default transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,style:{background:a?`var(--primary-base)`:`var(--surface-base)`,color:a?`var(--content-inset)`:`var(--content-secondary)`},children:[n?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(g,{className:`h-3 w-3`}),a?`Mark as read`:`Mark as unread`]}),(0,V.jsx)(H,{notificationId:e.id,currentlySnoozed:i,children:(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,children:[(0,V.jsx)(v,{className:`h-3 w-3`}),i?`Change snooze`:`Snooze`]})})]})]})}function G(){let e=k({platformHostedOnly:!0}),t=A(),o=j(),c=r(),l=x(),[f,m]=(0,L.useState)(`open`),[g,v]=(0,L.useState)(!1),[y,C]=(0,L.useState)([]),{data:w,isLoading:E,isError:D,refetch:O}=i({...T({query:{status:f}}),enabled:e===`full`&&t}),N=e===`full`&&o||(t?E:!1);(0,L.useEffect)(()=>{!t&&g&&v(!1)},[t,g]);let P=t?D:!1,z=t?w?.results??[]:[],B=z.filter(e=>!e.is_read&&!e.is_resolved),H=a(S()),[G,K]=(0,L.useState)(new Set),[q,J]=(0,L.useState)(!1),Y=(0,L.useCallback)(()=>R(c),[c]),X=async(e,t)=>{K(t=>new Set(t).add(e));try{await H.mutateAsync({path:{id:e},body:{acknowledged:t}}),Y()}catch(e){p.error(e instanceof Error?e.message:`Failed to update notification`)}finally{K(t=>{let n=new Set(t);return n.delete(e),n})}},Z=async()=>{if(!(B.length===0||q)){J(!0);try{await Promise.allSettled(B.map(e=>H.mutateAsync({path:{id:e.id},body:{acknowledged:!0}})))}finally{Y(),J(!1)}}},Q=(0,V.jsxs)(`button`,{type:`button`,className:`flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80`,title:`Pause alerts`,children:[(0,V.jsx)(F,{className:`h-3.5 w-3.5`}),`Pause alerts`]}),$=(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e))});return e===`gated`?(0,V.jsx)(n,{replace:!0,to:b.settings.general}):e===`disabled`?(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]})]}),(0,V.jsx)(M,{children:`Log in to the Vellum platform to view notifications.`})]}):(0,V.jsxs)(`div`,{className:`space-y-4`,children:[(0,V.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,V.jsxs)(`div`,{className:`flex-1`,children:[(0,V.jsx)(`h2`,{className:`text-title-medium text-[var(--content-default)]`,children:`Notifications`}),(0,V.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:`Platform alerts and status notifications`})]}),t&&(l?(0,V.jsxs)(s.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(s.Trigger,{asChild:!0,children:Q}),(0,V.jsxs)(s.Content,{children:[(0,V.jsx)(s.Header,{children:(0,V.jsx)(s.Title,{children:`Pause alerts`})}),(0,V.jsx)(s.Body,{children:(0,V.jsx)(U,{existingRules:y,onClose:()=>v(!1),onPauseCreated:e=>C(t=>[...t,e]),onPauseDeleted:e=>C(t=>t.filter(t=>t.id!==e)),hideTitle:!0})})]})]}):(0,V.jsxs)(d.Root,{open:g,onOpenChange:v,children:[(0,V.jsx)(d.Trigger,{asChild:!0,children:Q}),(0,V.jsx)(d.Content,{align:`end`,className:`w-72`,children:$})]}))]}),(0,V.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,V.jsx)(`div`,{className:`flex gap-1 rounded-md border border-[var(--border-base)] bg-[var(--surface-base)] p-1`,children:[`open`,`resolved`].map(e=>{let t=f===e;return(0,V.jsx)(`button`,{type:`button`,onClick:()=>m(e),className:`cursor-pointer rounded px-3 py-1 text-body-small-default capitalize transition-colors`,style:{background:t?`var(--surface-lift)`:`transparent`,color:t?`var(--content-default)`:`var(--content-secondary)`,boxShadow:t?`0 1px 2px rgba(0,0,0,0.08)`:void 0},children:e},e)})}),f===`open`&&B.length>1&&(0,V.jsxs)(`button`,{type:`button`,onClick:()=>void Z(),disabled:q,className:`ml-auto flex cursor-pointer items-center gap-1.5 rounded-md border border-[var(--border-base)] bg-transparent px-3 py-1.5 text-body-small-default text-[var(--content-secondary)] transition-opacity hover:opacity-80 disabled:cursor-not-allowed disabled:opacity-50`,children:[q?(0,V.jsx)(_,{className:`h-3 w-3 animate-spin`}):(0,V.jsx)(I,{className:`h-3 w-3`}),`Mark all as read (`,B.length,`)`]})]}),N?(0,V.jsxs)(`div`,{className:`flex items-center gap-2 py-6 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,V.jsx)(_,{className:`h-4 w-4 animate-spin`}),`Loading notifications…`]}):P?(0,V.jsxs)(u,{tone:`error`,children:[`Failed to load notifications.`,` `,(0,V.jsx)(`button`,{type:`button`,onClick:()=>void O(),className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):z.length===0?(0,V.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,children:[(0,V.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--surface-base)]`,children:(0,V.jsx)(h,{className:`h-5 w-5 text-[var(--content-secondary)]`})}),(0,V.jsxs)(`p`,{className:`text-body-medium-default text-[var(--content-default)]`,children:[`No `,f,` notifications`]}),(0,V.jsx)(`p`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:f===`open`?`You're all caught up!`:`Nothing to show here.`})]}):(0,V.jsx)(`div`,{className:`space-y-3`,children:z.map(e=>(0,V.jsx)(W,{notification:e,onAck:(e,t)=>void X(e,t),isAcking:G.has(e.id)},e.id))})]})}export{G as NotificationsPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{en as i}from"./index-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{en as i}from"./index-B-S-gNKm.js";var a=e(t(),1),o=r();function s(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,o.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function c(){return(0,o.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,o.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,o.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var l=`
|
|
2
2
|
:root {
|
|
3
3
|
--oauth-surface: #F5F3EB;
|
|
4
4
|
--oauth-surface-card: #FFFFFF;
|
package/dist/assets/{oauth-popup-complete-page-DFSwc7gE.js → oauth-popup-complete-page-C9FKG9VY.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{n as i,r as a}from"./native-deep-link-C2-dXaz_.js";import{en as o}from"./index-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{h as n}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{n as i,r as a}from"./native-deep-link-C2-dXaz_.js";import{en as o}from"./index-B-S-gNKm.js";var s=e(t(),1),c=r();function l(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-positive-bg)`}),(0,c.jsx)(`path`,{className:`oauth-check`,d:`M17 28.5L24.5 36L39 21`,stroke:`var(--oauth-positive-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeLinejoin:`round`,fill:`none`})]})}function u(){return(0,c.jsxs)(`svg`,{className:`oauth-icon`,viewBox:`0 0 56 56`,fill:`none`,xmlns:`http://www.w3.org/2000/svg`,children:[(0,c.jsx)(`circle`,{cx:`28`,cy:`28`,r:`28`,fill:`var(--oauth-negative-bg)`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-1`,d:`M20 20L36 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`}),(0,c.jsx)(`path`,{className:`oauth-cross oauth-cross-2`,d:`M36 20L20 36`,stroke:`var(--oauth-negative-fg)`,strokeWidth:`3.5`,strokeLinecap:`round`,fill:`none`})]})}var d=`
|
|
2
2
|
:root {
|
|
3
3
|
--oauth-surface: #F5F3EB;
|
|
4
4
|
--oauth-surface-card: #FFFFFF;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,u as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{h as a}from"./local-mode-CgrENuVf.js";import{t as o}from"./circle-alert-DvNg50UK.js";import{t as s}from"./circle-check-DzlJxj_M.js";import{t as c}from"./loader-circle-BFRVtR3K.js";import{a as l,i as u,n as d,r as f,t as p}from"./remote-gateway-session-BigLiDPm.js";import{t as m}from"./return-to-yMLvlnXN.js";import{a as h}from"./routes-C6gxiCrz.js";import{t as g}from"./index-
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,u as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{h as a}from"./local-mode-CgrENuVf.js";import{t as o}from"./circle-alert-DvNg50UK.js";import{t as s}from"./circle-check-DzlJxj_M.js";import{t as c}from"./loader-circle-BFRVtR3K.js";import{a as l,i as u,n as d,r as f,t as p}from"./remote-gateway-session-BigLiDPm.js";import{t as m}from"./return-to-yMLvlnXN.js";import{a as h}from"./routes-C6gxiCrz.js";import{t as g}from"./index-B-S-gNKm.js";var _=e(t(),1),v=i();function y(e){switch(e.kind){case`starting`:return{title:`Starting pairing`,body:`Creating a code for this browser.`};case`approved`:return{title:`Connected`,body:`Opening your assistant.`};case`expired`:return{title:`Pairing expired`,body:`Start a new web pairing from the local assistant.`};case`error`:return{title:`Pairing failed`,body:e.message};case`polling`:return{title:`Waiting for approval`,body:`Confirm this code on the machine running your assistant.`}}}function b({state:e}){return e.kind===`approved`?(0,v.jsx)(s,{className:`h-5 w-5 text-green-600`,"aria-hidden":!0}):e.kind===`starting`||e.kind===`polling`?(0,v.jsx)(c,{className:`h-5 w-5 animate-spin text-blue-600`,"aria-hidden":!0}):(0,v.jsx)(o,{className:`h-5 w-5 text-red-600`,"aria-hidden":!0})}function x(){let e=r(),t=n(),i=a(),o=(0,_.useMemo)(()=>m(new URLSearchParams(e.search).get(`returnTo`),h.assistant),[e.search]),s=(0,_.useMemo)(()=>l(`${e.pathname}${e.search}${e.hash}`),[e.pathname,e.search,e.hash]),[c,x]=(0,_.useState)(()=>s.deviceCode?{deviceCode:s.deviceCode,userCode:s.userCode}:null),[S,C]=(0,_.useState)(c?{kind:`polling`,expiresAt:null}:{kind:`starting`});if((0,_.useEffect)(()=>{if(!i||c)return;let e=new AbortController;return(async()=>{try{let t=await f(e.signal);x({deviceCode:t.deviceCode,userCode:t.userCode}),C({kind:`polling`,expiresAt:t.expiresAt})}catch{if(e.signal.aborted)return;C({kind:`error`,message:`The assistant could not start pairing. Refresh the page to try again.`})}})(),()=>{e.abort()}},[i,c]),(0,_.useEffect)(()=>{if(!i||!c?.deviceCode)return;let e=new AbortController,n=null,r=async()=>{try{let i=await u(c.deviceCode,e.signal);if(i.status===`pending`){C({kind:`polling`,expiresAt:i.expiresAt||null}),n=setTimeout(()=>void r(),Math.max(1,i.intervalSeconds)*1e3);return}d(i),C({kind:`approved`}),n=setTimeout(()=>t(o,{replace:!0}),250)}catch(t){if(e.signal.aborted)return;if(t instanceof p&&t.status===401){C({kind:`expired`});return}C({kind:`error`,message:`The assistant could not complete pairing. Try starting a new pairing.`})}};return r(),()=>{e.abort(),n&&clearTimeout(n)}},[i,c?.deviceCode,t,o]),!i)return(0,v.jsx)(g,{});let w=y(S);return(0,v.jsx)(`main`,{className:`flex min-h-svh items-center justify-center bg-[var(--background-default)] px-6 py-10 text-[var(--content-primary)]`,children:(0,v.jsxs)(`section`,{className:`w-full max-w-md rounded-lg border border-[var(--border-default)] bg-[var(--background-surface)] p-8 shadow-sm`,children:[(0,v.jsxs)(`div`,{className:`mb-5 flex items-center gap-3`,children:[(0,v.jsx)(b,{state:S}),(0,v.jsx)(`h1`,{className:`text-xl font-semibold`,children:w.title})]}),c?.userCode?(0,v.jsxs)(`div`,{className:`mb-5 rounded-md border border-[var(--border-subtle)] bg-[var(--background-muted)] p-4 text-center`,children:[(0,v.jsx)(`div`,{className:`text-xs font-medium uppercase text-[var(--content-secondary)]`,children:`Pairing code`}),(0,v.jsx)(`div`,{className:`mt-2 font-mono text-3xl font-semibold tracking-[0.18em]`,children:c.userCode})]}):null,(0,v.jsx)(`p`,{className:`text-sm leading-6 text-[var(--content-secondary)]`,children:w.body}),S.kind===`polling`&&S.expiresAt?(0,v.jsxs)(`p`,{className:`mt-4 text-xs text-[var(--content-tertiary)]`,children:[`Expires `,new Date(S.expiresAt).toLocaleTimeString(),`.`]}):null]})})}export{x as RemoteWebPairingPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,t as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./react-DJZBPgpf.js";import{O as i,t as a}from"./button-D-AX8Voo.js";import{h as o,r as s}from"./chunk-5KNZJZUH-DdS6bb-3.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"./card-BibIM9x3.js";import{n as p,t as m}from"./panel-item-Q1g7DFJw.js";import"./src-SCpl1O1B.js";import{t as h}from"./confirm-dialog-bfBx6UYv.js";import{t as g}from"./tag-CW6WC4fE.js";import{t as _}from"./popover-BUj2v1xo.js";import{t as v}from"./input-D4W4p0pZ.js";import{t as y}from"./toggle-X_kQW5my.js";import{n as b}from"./toast-sdJJ6aTV.js";import{t as x}from"./createLucideIcon-BlMXrA59.js";import{t as S}from"./arrow-left-CP-EhDNF.js";import{t as C}from"./check-D6WkI0gF.js";import{t as w}from"./cloud-off-rAv4OHmv.js";import{t as T}from"./external-link-RJkZLlff.js";import{i as E,n as ee,r as D,t as O}from"./use-skill-categories-6bE1o8xC.js";import{t as k}from"./globe-D3P5sSKJ.js";import{t as te}from"./hard-drive-CZEg1Cqc.js";import{t as A}from"./loader-circle-BFRVtR3K.js";import{t as ne}from"./sparkles-Bla177ar.js";import{t as j}from"./triangle-alert-C3aHZq1F.js";import{t as M}from"./x-DxL-bCuT.js";import{Tn as N,kn as P,wn as re}from"./sdk.gen-zA5ns5LT.js";import{Jt as ie,Kt as ae,at as oe,et as se,it as F,nt as ce,qt as le}from"./react-query.gen-BwkZCSTW.js";import{a as I}from"./routes-C6gxiCrz.js";import{n as ue}from"./use-is-mobile-jACt_z2d.js";import{t as de}from"./assistant-identity-store-cODRsfVo.js";import{t as L}from"./misc-CFzLzLPH.js";import{Da as R,Di as z,Ea as B,Et as V,Ji as H,L as U,Oi as fe,Pa as W,Si as pe,sr as me,ua as he,ui as G}from"./index-CZ2UBc_U.js";import{t as ge}from"./use-active-assistant-id-BVzVN4_g.js";import{t as _e}from"./plugins-surface-gCrqfOas.js";var ve=x(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=e(r(),1),q=d(),ye={sm:`h-7 w-7`,md:`h-8 w-8 text-3xl`};function J({external:e=!1,size:t=`sm`,className:n}){let r=e?`📦`:`🧩`;return(0,q.jsx)(`span`,{className:L(`flex shrink-0 items-center justify-center`,ye[t],n),children:r})}var be=e=>`Remove "${e}" from this assistant?`,xe=e=>`"${e}" has local edits that will be overwritten by the upgrade. Continue?`,Se=`Upgrade anyway`,Ce=`Failed to install plugin. Please try again.`,we=`Failed to remove plugin. Please try again.`,Te=`Failed to upgrade plugin. Please try again.`,Ee=`Failed to update plugin. Please try again.`;function De(e,t){let n=e.map(e=>({name:e.name,description:e.description??void 0,status:`installed`,external:void 0,version:e.version??void 0,path:e.path,issues:e.issues,enabled:e.enabled})),r=new Set(n.map(e=>e.name)),i=t.filter(e=>!r.has(e.name)).map(e=>({name:e.name,description:e.description,status:`available`,external:!0,path:e.path}));return[...n,...i]}function Oe(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description].some(e=>e?.toLowerCase().includes(n)):!0}function ke(e){return[...e].sort((e,t)=>{let n=e.status===`installed`;return n===(t.status===`installed`)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})}function Ae(e,t){switch(t){case`all`:return e;case`available`:return e.filter(e=>e.status===`available`);case`installed`:return e.filter(e=>e.status===`installed`);case`active`:return e.filter(e=>e.status===`installed`&&e.enabled!==!1);case`off`:return e.filter(e=>e.status===`installed`&&e.enabled===!1)}}function Y(e){return e?e.slice(0,7):`unknown`}function X({plugin:e,surfaces:t=null,className:n}){let r=[{label:`Source`,value:e.source?.kind===`github`?e.source.repo:`Local`,href:(e.source?.kind===`github`?`https://github.com/${e.source.repo}`:null)??void 0}];return e.homepage&&r.push({label:`Homepage`,value:e.homepage,href:e.homepage}),e.license&&r.push({label:`License`,value:e.license}),t&&(t.skills.length>0&&r.push({label:`Skills`,value:String(t.skills.length)}),t.hooks.length>0&&r.push({label:`Hooks`,value:String(t.hooks.length)}),t.tools.length>0&&r.push({label:`Tools`,value:String(t.tools.length)})),(0,q.jsx)(`dl`,{className:L(`mb-5 grid gap-x-6 gap-y-2 border-b pb-5 sm:grid-cols-[max-content_1fr]`,n),style:{borderColor:`var(--border-base)`},children:r.map(e=>(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,q.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 underline`,style:{color:`var(--primary-base, #60a5fa)`},children:[e.value,(0,q.jsx)(T,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function je({plugin:e,drift:t,onInstall:n,onRemove:r,onUpgrade:i,isInstalling:o,isRemoving:s,isUpgrading:c,hasLocalEdits:l,enabled:u,onToggle:d,isToggling:f}){let[p,m]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),v=e.installed??!1,b=e.artifact??null,x=t?.status===`update-available`,S=x?`Upgrade ${Y(t?.local?.commit??null)} → ${Y(t?.remote?.commit??null)}`:void 0;return(0,q.jsxs)(q.Fragment,{children:[v?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:flex-nowrap md:shrink-0`,children:[u!==void 0&&d?(0,q.jsx)(y,{label:`Auto-include in chat`,checked:u,onChange:()=>d(),disabled:f}):null,b?(0,q.jsx)(a,{asChild:!0,leftIcon:(0,q.jsx)(he,{"aria-hidden":!0}),children:(0,q.jsx)(`a`,{href:b.url,download:!0,children:b.label??`Download`})}):null,x?(0,q.jsx)(a,{type:`button`,onClick:()=>{if(l){_(!0);return}i()},disabled:c,title:S,leftIcon:c?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(R,{"aria-hidden":!0}),children:`Upgrade`}):null,(0,q.jsx)(a,{type:`button`,variant:`dangerOutline`,onClick:()=>m(!0),disabled:s,leftIcon:s?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(G,{"aria-hidden":!0}),children:`Remove`})]}):(0,q.jsx)(a,{type:`button`,onClick:n,disabled:o,leftIcon:o?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(W,{"aria-hidden":!0}),children:`Install`}),(0,q.jsx)(h,{open:p,title:`Remove plugin`,message:be(e.name),confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{m(!1),r()},onCancel:()=>m(!1)}),(0,q.jsx)(h,{open:g,title:`Upgrade plugin`,message:xe(e.name),confirmLabel:Se,destructive:!0,onConfirm:()=>{_(!1),i()},onCancel:()=>_(!1)})]})}function Z(){return(0,q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,q.jsx)(A,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function Q(){return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,q.jsx)(j,{className:`h-6 w-6`,"aria-hidden":!0}),(0,q.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,q.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function Me({isInstallError:e,isRemoveError:t,isUpgradeError:n}){let r=e?Ce:t?we:n?Te:null;return r?(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded px-3 py-2 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-warning, var(--content-tertiary))`},role:`alert`,children:[(0,q.jsx)(j,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),r]}):null}function Ne({external:e,className:t}){let n=e?{label:`External`,icon:k}:{label:`Local`,icon:te};return(0,q.jsx)(g,{tone:`neutral`,leftIcon:(0,K.createElement)(n.icon),className:t,children:n.label})}function Pe({onClick:e,isUpgrading:t=!1}={}){let n=(0,q.jsx)(g,{tone:`warning`,leftIcon:(0,K.createElement)(t?A:R,{className:t?`animate-spin`:void 0}),className:`shrink-0`,children:`Update available`});return e?(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e()},disabled:t,"aria-label":`Upgrade plugin`,className:`shrink-0 rounded-[6px] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:cursor-not-allowed`,children:n}):n}var Fe=300*1e3;function Ie({assistantId:e,name:t,enabled:n=!0}){return l({...ce({path:{assistant_id:e,name:t}}),enabled:!!e&&!!t&&n,staleTime:Fe,retry:!1})}function Le(e){let t=e?.local?.localChanges;return!!t&&t?.clean===!1}function Re(e,t,n){let r=c(),i=n?.onRemoved,a=l({...se({path:{assistant_id:e,name:t}}),enabled:!!e&&!!t}),o=Ie({assistantId:e,name:t,enabled:a.data?.installed??!1}).data,s=(0,K.useCallback)(()=>me(r,e,t),[e,t,r]),u=ie({onSuccess:()=>{s(),b.success(`Installed ${t||`plugin`}`)}}),d=ae({onSuccess:()=>{s(),i?.()}}),f=le({onSuccess:e=>{s(),b.success(e.outcome===`already-up-to-date`?`${t||`Plugin`} is already up to date`:`Upgraded ${t||`plugin`} to ${Y(e.toCommit)}`)}});return{plugin:a.data??null,drift:o,isLoading:a.isLoading,isError:a.isError,install:()=>{u.mutate({path:{assistant_id:e},body:{name:t}})},remove:()=>{d.mutate({path:{assistant_id:e,name:t}})},upgrade:()=>{f.mutate({path:{assistant_id:e,name:t},body:{}})},isInstalling:u.isPending,isRemoving:d.isPending,isUpgrading:f.isPending,isInstallError:u.isError,isRemoveError:d.isError,isUpgradeError:f.isError,hasLocalEdits:Le(o)}}function ze(e){let t=c(),n={queryKey:F({path:{assistant_id:e}})},r=(e,r)=>{t.setQueriesData(n,t=>t&&{...t,plugins:t.plugins.map(t=>t.name===e?{...t,enabled:r}:t)})},i=u({mutationFn:async({name:t,nextEnabled:n})=>{let r=await(n?N({path:{assistant_id:e,name:t},throwOnError:!1}):re({path:{assistant_id:e,name:t},throwOnError:!1})),i=r.response?.status;if(r.response?.ok||i===409)return r;throw Error(`Plugin toggle failed (${i??`network error`})`)},onMutate:async({name:e,nextEnabled:i})=>{await t.cancelQueries(n),r(e,i)},onError:(e,{name:t,nextEnabled:n})=>{r(t,!n),b.error(Ee)},onSettled:(n,r,i)=>{me(t,e,i.name)}});return{toggle:(e,t)=>{i.mutate({name:e,nextEnabled:t})},togglingName:i.isPending?i.variables?.name??null:null}}function Be({assistantId:e,name:t,onBack:n,externalHint:r,enabled:i}){let{plugin:o,drift:s,isLoading:c,isError:l,install:u,remove:d,upgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,isInstallError:_,isRemoveError:v,isUpgradeError:y,hasLocalEdits:b}=Re(e,t,{onRemoved:n}),{toggle:x,togglingName:C}=ze(e);return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,q.jsx)(a,{type:`button`,variant:`ghost`,iconOnly:(0,q.jsx)(S,{"aria-hidden":!0}),"aria-label":`Back to plugins`,onClick:n}),(0,q.jsx)(Ve,{name:t,plugin:o,externalHint:r,drift:s,onInstall:u,onRemove:d,onUpgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,hasLocalEdits:b,enabled:i,onToggle:()=>x(t,!i),isToggling:C===t})]}),(_||v||y)&&(0,q.jsx)(Me,{isInstallError:_,isRemoveError:v,isUpgradeError:y}),(0,q.jsx)(f.Root,{asChild:!0,children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:c?(0,q.jsx)(Z,{}):l||!o?(0,q.jsx)(Q,{}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(X,{plugin:o,surfaces:s?.surfaces??null}),o.readme?(0,q.jsx)(U,{content:o.readme}):(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})})]})}function Ve({name:e,plugin:t,externalHint:n,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l,hasLocalEdits:u,enabled:d,onToggle:f,isToggling:p}){let m=t?.source?.kind===`github`,h=t?m:n,g=r?.status===`update-available`;return(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[h===void 0?(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-8 w-8 shrink-0`}):(0,q.jsx)(J,{external:h,size:`md`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,q.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,t?(0,q.jsx)(Ne,{external:m}):null,g?(0,q.jsx)(Pe,{}):null]}),t?.description?(0,q.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?(0,q.jsx)(je,{plugin:t,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l,hasLocalEdits:u,enabled:d,onToggle:f,isToggling:p}):null]})}var He=e(i(),1);function Ue({assistantId:e,name:t,onBack:n,externalHint:r,enabled:i}){let{plugin:o,drift:s,isLoading:c,isError:l,install:u,remove:d,upgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,isInstallError:_,isRemoveError:v,isUpgradeError:y,hasLocalEdits:b}=Re(e,t,{onRemoved:n}),{toggle:x,togglingName:C}=ze(e),[w,T]=(0,K.useState)(null);(0,K.useEffect)(()=>{T(document.getElementById(`viewport-overlays`))},[]);let E=o?.source?.kind===`github`,ee=o?E:r,D=s?.status===`update-available`,O=o?.name??t,k=(0,q.jsxs)(`div`,{className:`fixed inset-0 z-40 flex flex-col overflow-hidden bg-[var(--surface-overlay)]`,style:{paddingTop:`calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))`,paddingBottom:`calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))`,paddingLeft:`calc(12px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)))`,paddingRight:`calc(12px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))`},children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(a,{variant:`ghost`,iconOnly:(0,q.jsx)(S,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to plugins`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-2 text-center text-body-medium-default`,style:{color:`var(--content-secondary)`},children:O}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-8 w-8 shrink-0 touch-mobile:h-10 touch-mobile:w-10`})]}),(0,q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ee===void 0?(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-8 w-8 shrink-0`}):(0,q.jsx)(J,{external:ee,size:`md`}),(0,q.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:O})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[D?(0,q.jsx)(Pe,{}):null,o?(0,q.jsx)(Ne,{external:E}):null]})]}),o?.description?(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:o.description}):null]}),o?(0,q.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:(0,q.jsx)(je,{plugin:o,drift:s,enabled:i,onToggle:()=>x(t,!i),isToggling:C===t,onInstall:u,onRemove:d,onUpgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,hasLocalEdits:b})}):null,(_||v||y)&&(0,q.jsx)(`div`,{className:`mt-3`,children:(0,q.jsx)(Me,{isInstallError:_,isRemoveError:v,isUpgradeError:y})}),(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsx)(`div`,{className:`mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border bg-[var(--surface-lift)]`,style:{borderColor:`var(--border-hover)`},children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:c?(0,q.jsx)(Z,{}):l||!o?(0,q.jsx)(Q,{}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(X,{plugin:o,surfaces:s?.surfaces??null}),o.readme?(0,q.jsx)(U,{content:o.readme}):(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})})})]});return w?(0,He.createPortal)(k,w):k}var We={value:`all`,label:`All`,icon:H},Ge={value:`available`,label:`Available`,icon:W};function Ke(e){return e?[We,{value:`active`,label:`Active`,icon:fe},{value:`off`,label:`Off`,icon:ve},Ge]:[We,{value:`installed`,label:`Installed`,icon:B},Ge]}function qe({search:e,onSearchChange:t,filter:n,onFilterChange:r,isSearching:i=!1,categories:a,category:o,onCategoryChange:s,counts:c,totalCount:l,showCounts:u,pluginToggleSupported:d}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(v,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search plugins`,"aria-label":`Search plugins`,leftIcon:(0,q.jsx)(pe,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:i?(0,q.jsx)(A,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`}),(0,q.jsx)(Je,{filter:n,onFilterChange:r,categories:a,category:o,onCategoryChange:s,counts:c,totalCount:l,showCounts:u,pluginToggleSupported:d})]})}function Je(e){let t=ue(),[n,r]=(0,K.useState)(!1),i=(0,q.jsx)(a,{type:`button`,variant:`outlined`,iconOnly:(0,q.jsx)(E,{"aria-hidden":!0}),"aria-label":`Filter plugins`,"aria-haspopup":t?`dialog`:`listbox`,"aria-expanded":n,tintColor:`var(--primary-base)`});return t?(0,q.jsx)(Ye,{...e,open:n,onOpenChange:r,trigger:i}):(0,q.jsxs)(_.Root,{open:n,onOpenChange:r,children:[(0,q.jsx)(_.Trigger,{asChild:!0,children:i}),(0,q.jsx)(_.Content,{align:`end`,sideOffset:4,className:`w-44 overflow-hidden p-0`,children:(0,q.jsx)(`ul`,{role:`listbox`,children:(0,q.jsx)(Qe,{label:`Status`,options:Ke(e.pluginToggleSupported),selected:e.filter,onSelect:t=>{e.onFilterChange(t),r(!1)}})})})]})}function Ye({filter:e,onFilterChange:t,categories:n,category:r,onCategoryChange:i,counts:o,totalCount:s,showCounts:c,pluginToggleSupported:l,open:u,onOpenChange:d,trigger:f}){let m=[...n].sort((e,t)=>e.label.localeCompare(t.label));return(0,q.jsxs)(p.Root,{open:u,onOpenChange:d,children:[(0,q.jsx)(p.Trigger,{asChild:!0,children:f}),(0,q.jsxs)(p.Content,{className:`max-h-[85dvh]`,"aria-describedby":void 0,children:[(0,q.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mb-3 h-1 w-9 shrink-0 rounded-full bg-[var(--border-element)]`}),(0,q.jsx)(p.Header,{children:(0,q.jsx)(p.Title,{children:`Filters`})}),(0,q.jsxs)(p.Body,{className:`flex flex-col gap-3 pt-2`,children:[(0,q.jsx)(Xe,{label:`Status`,children:Ke(l).map(n=>(0,q.jsx)(Ze,{icon:n.icon,label:n.label,active:e===n.value,onSelect:()=>t(n.value)},n.value))}),n.length>0&&(0,q.jsxs)(Xe,{label:`Categories`,children:[(0,q.jsx)(Ze,{icon:H,label:`All`,active:r===null,badge:c?s:void 0,onSelect:()=>i(null)}),m.map(e=>(0,q.jsx)(Ze,{icon:D(e.icon)??H,label:e.label,active:r===e.slug,badge:c?o[e.slug]??0:void 0,onSelect:()=>i(e.slug)},e.slug))]})]}),(0,q.jsx)(p.Footer,{children:(0,q.jsx)(a,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>d(!1),children:`Done`})})]})]})}function Xe({label:e,children:t}){return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`px-2 pb-1 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e}),t]})}function Ze({icon:e,label:t,active:n,badge:r,onSelect:i}){return(0,q.jsx)(m,{icon:e,label:t,active:n,activeVariant:`branded`,badge:r,trailingAction:n&&r==null?(0,q.jsx)(C,{className:`h-4 w-4 text-[var(--primary-base)]`,"aria-hidden":!0}):void 0,onSelect:i})}function Qe({label:e,options:t,selected:n,onSelect:r}){return(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e}),(0,q.jsx)(`ul`,{children:t.map(e=>{let t=e.icon,i=n===e.value;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),role:`option`,"aria-selected":i,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:i?`var(--primary-base)`:`var(--content-default)`},children:[(0,q.jsx)(t,{className:`h-4 w-4`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`flex-1`,children:e.label}),i&&(0,q.jsx)(B,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]})},e.value)})})]})}function $e({item:e,drift:t,onSelect:n,onInstall:r,onRemove:i,onUpgrade:o,isInstalling:s=!1,isRemoving:c=!1,isUpgrading:l=!1}){let u=e.status===`available`,d=t?.status===`update-available`,p=e.enabled!==void 0,m=e.enabled===!1;return(0,q.jsx)(f.Root,{asChild:!0,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:n,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`flex cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,q.jsx)(J,{size:`sm`,external:e.external,className:m?`opacity-50`:void 0}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:m?`var(--content-tertiary)`:`var(--content-emphasised)`},children:e.name}),e.version?(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null,d?(0,q.jsx)(Pe,{onClick:o,isUpgrading:l}):null]}),(0,q.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e.description??`No description provided.`}),e.issues&&e.issues.length>0?(0,q.jsxs)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-warning, var(--content-tertiary))`},title:e.issues.join(`; `),children:[e.issues[0],e.issues.length>1?` (+${e.issues.length-1} more)`:``]}):null]}),u?s?(0,q.jsx)(a,{type:`button`,iconOnly:(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}),disabled:!0,"aria-label":`Installing`,expandOnMobile:!1}):(0,q.jsx)(a,{type:`button`,iconOnly:(0,q.jsx)(W,{"aria-hidden":!0}),onClick:e=>{e.stopPropagation(),r?.()},disabled:!r,"aria-label":`Install plugin`,expandOnMobile:!1}):(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[p?(0,q.jsx)(g,{tone:e.enabled?`positive`:`neutral`,children:e.enabled?`Enabled`:`Disabled`}):null,(0,q.jsx)(a,{type:`button`,variant:`dangerOutline`,iconOnly:c?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(G,{"aria-hidden":!0}),onClick:e=>{e.stopPropagation(),i?.()},disabled:c||l||!i,"aria-label":`Remove plugin`,expandOnMobile:!1})]})]})})}var et=300*1e3,$=[],tt=[];async function nt(e,t,n){let r=await P({path:{assistant_id:e},query:{q:void 0,category:t},signal:n,throwOnError:!1});if(r.response?.status===404)return{plugins:[]};if(!r.response?.ok)throw Error(`Failed to load plugins`);return r.data??{plugins:[]}}function rt(e,t){let[n,r]=(0,K.useState)({assistantId:e,latched:!1}),i=n.assistantId===e?n.latched:!1;return n.assistantId!==e&&r({assistantId:e,latched:!1}),(0,K.useEffect)(()=>{t&&r(t=>t.assistantId===e&&t.latched?t:{assistantId:e,latched:!0})},[e,t]),i||t}function it(e,t=null){let n=t??void 0,r=l({queryKey:F({path:{assistant_id:e},query:{q:void 0,category:n}}),queryFn:({signal:t})=>nt(e,n,t),enabled:!!e,staleTime:et}),i=l({...V(e),enabled:!!e&&t!==null}),a=l({...oe({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:et}),o=(0,K.useMemo)(()=>{let e=t===null?r.data?.plugins:i.data?.plugins??r.data?.plugins;return new Set((e??$).map(e=>e.name))},[t,i.data?.plugins,r.data?.plugins]),s=(0,K.useMemo)(()=>{let e=r.data?.plugins??$,n=a.data?.matches??tt;return ke(De(e,(t===null?n:n.filter(e=>(e.category??`system`)===t)).filter(e=>!o.has(e.name))))},[r.data?.plugins,a.data?.matches,t,o]),u=t===null?r.data:i.data,d=rt(e,u?.categoryCounts!==void 0),f=rt(e,(u?.plugins??$).some(e=>e.enabled!==void 0)),p=c(),m=(0,K.useRef)(null);return(0,K.useEffect)(()=>{if(m.current===e||!a.isSuccess)return;let t=u?.plugins;if(!t?.length)return;let n=new Map((a.data?.matches??tt).map(e=>[e.name,e.category]));t.some(e=>{let t=n.get(e.name);return t!=null&&t!==`system`&&(e.category??`system`)===`system`})&&(m.current=e,p.invalidateQueries({queryKey:F({path:{assistant_id:e},query:{q:void 0}})}))},[e,a.isSuccess,a.data?.matches,u?.plugins,p]),{items:s,isLoading:r.isLoading,catalogLoading:a.isLoading,isError:r.isError,isFetching:r.isFetching||a.isFetching,catalogError:a.isError,categorySupported:d,pluginToggleSupported:f,installedCategoryCounts:u?.categoryCounts,installedPlugins:u?.plugins??$,installedTotal:u?.totalCount,catalogMatches:a.data?.matches??tt,unfilteredInstalledNames:o}}var at=`vellum:plugins:tipDismissed`;function ot({assistantId:e}){let r=c(),i=ue(),[a,s]=o(),l=a.get(`plugin`),[u,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(`all`),[m,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(null),[y,x]=(0,K.useState)(null),[S,C]=(0,K.useState)(null),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(null),[k,te]=(0,K.useState)(()=>n(at,!1)),[A,ne]=(0,K.useState)(e);e!==A&&(ne(e),g(null));let j=e===A?m:null,{data:M=[]}=O(e),{items:N,isLoading:P,catalogLoading:re,isError:oe,isFetching:se,catalogError:F,categorySupported:ce,pluginToggleSupported:I,installedCategoryCounts:de,installedPlugins:L,installedTotal:R,catalogMatches:z,unfilteredInstalledNames:B}=it(e,j),V=(I?[`all`,`active`,`off`,`available`]:[`all`,`installed`,`available`]).includes(f)?f:`all`,{counts:H,totalCount:U}=st(de,L,R,z,B,V),fe=ce&&M.length>0,W=(0,K.useCallback)(t=>me(r,e,t),[e,r]),pe=ie({onMutate:e=>v(e.body.name),onSuccess:(e,t)=>b.success(`Installed ${t.body.name}`),onError:()=>b.error(Ce),onSettled:(e,t,n)=>{v(null),W(n.body.name)}}),he=ae({onMutate:e=>x(e.path.name),onSuccess:(e,t)=>b.success(`Removed ${t.path.name}`),onError:()=>b.error(we),onSettled:(e,t,n)=>{x(null),W(n.path.name)}}),G=le({onMutate:e=>C(e.path.name),onSuccess:(e,t)=>b.success(e.outcome===`already-up-to-date`?`${t.path.name} is already up to date`:`Upgraded ${t.path.name} to ${Y(e.toCommit)}`),onError:()=>b.error(Te),onSettled:(e,t,n)=>{C(null),W(n.path.name)}}),ge=(0,K.useCallback)(e=>s(t=>{let n=new URLSearchParams(t);return n.set(`plugin`,e.name),n}),[s]),_e=(0,K.useCallback)(()=>s(e=>{let t=new URLSearchParams(e);return t.delete(`plugin`),t},{replace:!0}),[s]),ve=(0,K.useCallback)(t=>{pe.mutate({path:{assistant_id:e},body:{name:t.name}})},[e,pe]),ye=(0,K.useCallback)(()=>{w&&(he.mutate({path:{assistant_id:e,name:w.name}}),T(null))},[e,w,he]),J=(0,K.useCallback)(t=>{G.mutate({path:{assistant_id:e,name:t},body:{}})},[e,G]),Ee=(0,K.useCallback)(()=>{E&&(J(E.name),D(null))},[E,J]),De=(0,K.useCallback)((e,t)=>{if(Le(t)){D(e);return}J(e.name)},[J]),ke=(0,K.useCallback)(()=>{te(!0),t(at,!0)},[]),X=(0,K.useMemo)(()=>Ae(N,V).filter(e=>Oe(e,u)),[N,V,u]),je=se&&!P,Z=u.trim().length>0;if(l){let t=N.find(e=>e.name===l),n={assistantId:e,name:l,externalHint:t?.external,enabled:t?.enabled,onBack:_e};return i?(0,q.jsx)(Ue,{...n}):(0,q.jsx)(Be,{...n})}let Q=(0,q.jsx)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:P?(0,q.jsx)(dt,{}):oe?(0,q.jsx)(ft,{}):X.length===0?re&&(V===`all`||V===`available`)?(0,q.jsx)(dt,{}):(0,q.jsx)(pt,{filter:V,category:j}):(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:X.map(t=>(0,q.jsx)(`li`,{children:t.status===`installed`?(0,q.jsx)(ct,{assistantId:e,item:t,onSelect:()=>ge(t),onRemove:()=>T(t),onUpgrade:e=>De(t,e),isRemoving:y===t.name,isUpgrading:S===t.name}):(0,q.jsx)($e,{item:t,onSelect:()=>ge(t),onInstall:()=>ve(t),isInstalling:_===t.name})},t.name))})});return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[!k&&(0,q.jsx)(lt,{onDismiss:ke}),(0,q.jsx)(qe,{search:u,onSearchChange:d,filter:V,onFilterChange:p,isSearching:je,categories:fe?M:[],category:j,onCategoryChange:g,counts:H,totalCount:U,showCounts:!Z,pluginToggleSupported:I}),F&&!P&&!oe?(0,q.jsx)(ut,{}):null,fe?(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-6`,children:[(0,q.jsx)(`aside`,{className:`hidden w-56 shrink-0 overflow-y-auto md:block`,children:(0,q.jsx)(ee,{ariaLabel:`Plugin categories`,selected:j,onSelect:g,counts:H,totalCount:U,showCounts:!Z,categories:M})}),Q]}):Q,(0,q.jsx)(h,{open:w!==null,title:`Remove plugin`,message:w?be(w.name):``,confirmLabel:`Remove`,destructive:!0,onConfirm:ye,onCancel:()=>T(null)}),(0,q.jsx)(h,{open:E!==null,title:`Upgrade plugin`,message:E?xe(E.name):``,confirmLabel:Se,destructive:!0,onConfirm:Ee,onCancel:()=>D(null)})]})}function st(e,t,n,r,i,a){return(0,K.useMemo)(()=>{let o={},s=a!==`available`,c=a===`all`||a===`available`,l=a===`active`||a===`off`,u=l?t.filter(e=>a===`off`?e.enabled===!1:e.enabled!==!1):t;if(s)if(!l&&e&&Object.keys(e).length>0)Object.assign(o,e);else for(let e of u){let t=e.category??`system`;o[t]=(o[t]??0)+1}let d=0;if(c)for(let e of r){if(i.has(e.name))continue;let t=e.category??`system`;o[t]=(o[t]??0)+1,d+=1}let f=l?u.length:n??t.length;return{counts:o,totalCount:(s?f:0)+d}},[e,t,n,r,i,a])}function ct({assistantId:e,item:t,onSelect:n,onRemove:r,onUpgrade:i,isRemoving:a,isUpgrading:o}){let s=Ie({assistantId:e,name:t.name}).data;return(0,q.jsx)($e,{item:t,drift:s,onSelect:n,onRemove:r,onUpgrade:()=>i(s),isRemoving:a,isUpgrading:o})}function lt({onDismiss:e}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-4 py-2.5 text-body-small-default`,style:{backgroundColor:`var(--surface-base)`,color:`var(--content-secondary)`},children:[(0,q.jsx)(ne,{className:`h-4 w-4 shrink-0`,style:{color:`var(--primary-base)`}}),(0,q.jsx)(`p`,{className:`flex-1`,children:`Browse the catalog below to install plugins that extend your assistant.`}),(0,q.jsx)(a,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,q.jsx)(M,{"aria-hidden":!0}),onClick:e,"aria-label":`Dismiss tip`,tintColor:`var(--content-tertiary)`,expandOnMobile:!1})]})}function ut(){return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-4 py-2.5 text-body-small-default`,style:{backgroundColor:`var(--surface-base)`,color:`var(--content-secondary)`},children:[(0,q.jsx)(w,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,q.jsx)(`p`,{className:`flex-1`,children:`Catalog browsing is temporarily unavailable. Installed plugins are still listed below.`})]})}function dt(){return(0,q.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,q.jsx)(A,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function ft(){return(0,q.jsx)(f.Root,{children:(0,q.jsxs)(f.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,q.jsx)(j,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,q.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function pt({filter:e,category:t}){let{title:n,subtitle:r,Icon:i}=mt(e,t);return(0,q.jsx)(f.Root,{children:(0,q.jsxs)(f.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,q.jsx)(i,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,q.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,q.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r})]})})}function mt(e,t){if(t)return{title:`No plugins in this category`,subtitle:`Try selecting a different category or clearing the filter.`,Icon:H};switch(e){case`installed`:return{title:`No Plugins Installed`,subtitle:`Browse the catalog to install plugins that extend your assistant.`,Icon:z};case`active`:return{title:`No Active Plugins`,subtitle:`Install a plugin from the catalog, or turn on an installed one.`,Icon:z};case`off`:return{title:`No Plugins Turned Off`,subtitle:`Installed plugins you turn off will appear here.`,Icon:z};case`available`:return{title:`No Plugins Available`,subtitle:`Every catalog plugin is already installed.`,Icon:B};default:return{title:`No Plugins Found`,subtitle:`Browse the catalog to install plugins that extend your assistant.`,Icon:z}}}function ht(){let e=de.use.version(),t=_e(),n=ge();return e===null?null:t?(0,q.jsx)(ot,{assistantId:n}):(0,q.jsx)(s,{to:I.identity,replace:!0})}export{ht as PluginsPage};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{a as t,t as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./react-DJZBPgpf.js";import{O as i,t as a}from"./button-D-AX8Voo.js";import{h as o,r as s}from"./chunk-5KNZJZUH-DdS6bb-3.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"./card-BibIM9x3.js";import{n as p,t as m}from"./panel-item-Q1g7DFJw.js";import"./src-SCpl1O1B.js";import{t as h}from"./confirm-dialog-bfBx6UYv.js";import{t as g}from"./tag-CW6WC4fE.js";import{t as _}from"./popover-BUj2v1xo.js";import{t as v}from"./input-D4W4p0pZ.js";import{t as y}from"./toggle-X_kQW5my.js";import{n as b}from"./toast-sdJJ6aTV.js";import{t as x}from"./createLucideIcon-BlMXrA59.js";import{t as S}from"./arrow-left-CP-EhDNF.js";import{t as C}from"./check-D6WkI0gF.js";import{t as w}from"./cloud-off-rAv4OHmv.js";import{t as T}from"./external-link-RJkZLlff.js";import{i as E,n as ee,r as D,t as O}from"./use-skill-categories-nKUbiuQn.js";import{t as k}from"./globe-D3P5sSKJ.js";import{t as te}from"./hard-drive-CZEg1Cqc.js";import{t as A}from"./loader-circle-BFRVtR3K.js";import{t as ne}from"./sparkles-Bla177ar.js";import{t as j}from"./triangle-alert-C3aHZq1F.js";import{t as M}from"./x-DxL-bCuT.js";import{Tn as N,kn as P,wn as re}from"./sdk.gen-zA5ns5LT.js";import{Jt as ie,Kt as ae,at as oe,et as se,it as F,nt as ce,qt as le}from"./react-query.gen-BwkZCSTW.js";import{a as I}from"./routes-C6gxiCrz.js";import{n as ue}from"./use-is-mobile-jACt_z2d.js";import{t as de}from"./assistant-identity-store-cODRsfVo.js";import{t as L}from"./misc-CFzLzLPH.js";import{Da as R,Di as z,Ea as B,Et as V,Ji as H,L as U,Oi as fe,Pa as W,Si as pe,sr as me,ua as he,ui as G}from"./index-B-S-gNKm.js";import{t as ge}from"./use-active-assistant-id-BVzVN4_g.js";import{t as _e}from"./plugins-surface-gCrqfOas.js";var ve=x(`power-off`,[[`path`,{d:`M18.36 6.64A9 9 0 0 1 20.77 15`,key:`dxknvb`}],[`path`,{d:`M6.16 6.16a9 9 0 1 0 12.68 12.68`,key:`1x7qb5`}],[`path`,{d:`M12 2v4`,key:`3427ic`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]),K=e(r(),1),q=d(),ye={sm:`h-7 w-7`,md:`h-8 w-8 text-3xl`};function J({external:e=!1,size:t=`sm`,className:n}){let r=e?`📦`:`🧩`;return(0,q.jsx)(`span`,{className:L(`flex shrink-0 items-center justify-center`,ye[t],n),children:r})}var be=e=>`Remove "${e}" from this assistant?`,xe=e=>`"${e}" has local edits that will be overwritten by the upgrade. Continue?`,Se=`Upgrade anyway`,Ce=`Failed to install plugin. Please try again.`,we=`Failed to remove plugin. Please try again.`,Te=`Failed to upgrade plugin. Please try again.`,Ee=`Failed to update plugin. Please try again.`;function De(e,t){let n=e.map(e=>({name:e.name,description:e.description??void 0,status:`installed`,external:void 0,version:e.version??void 0,path:e.path,issues:e.issues,enabled:e.enabled})),r=new Set(n.map(e=>e.name)),i=t.filter(e=>!r.has(e.name)).map(e=>({name:e.name,description:e.description,status:`available`,external:!0,path:e.path}));return[...n,...i]}function Oe(e,t){let n=t.trim().toLowerCase();return n?[e.name,e.description].some(e=>e?.toLowerCase().includes(n)):!0}function ke(e){return[...e].sort((e,t)=>{let n=e.status===`installed`;return n===(t.status===`installed`)?e.name.localeCompare(t.name,void 0,{sensitivity:`base`}):n?-1:1})}function Ae(e,t){switch(t){case`all`:return e;case`available`:return e.filter(e=>e.status===`available`);case`installed`:return e.filter(e=>e.status===`installed`);case`active`:return e.filter(e=>e.status===`installed`&&e.enabled!==!1);case`off`:return e.filter(e=>e.status===`installed`&&e.enabled===!1)}}function Y(e){return e?e.slice(0,7):`unknown`}function X({plugin:e,surfaces:t=null,className:n}){let r=[{label:`Source`,value:e.source?.kind===`github`?e.source.repo:`Local`,href:(e.source?.kind===`github`?`https://github.com/${e.source.repo}`:null)??void 0}];return e.homepage&&r.push({label:`Homepage`,value:e.homepage,href:e.homepage}),e.license&&r.push({label:`License`,value:e.license}),t&&(t.skills.length>0&&r.push({label:`Skills`,value:String(t.skills.length)}),t.hooks.length>0&&r.push({label:`Hooks`,value:String(t.hooks.length)}),t.tools.length>0&&r.push({label:`Tools`,value:String(t.tools.length)})),(0,q.jsx)(`dl`,{className:L(`mb-5 grid gap-x-6 gap-y-2 border-b pb-5 sm:grid-cols-[max-content_1fr]`,n),style:{borderColor:`var(--border-base)`},children:r.map(e=>(0,q.jsxs)(`div`,{className:`contents`,children:[(0,q.jsx)(`dt`,{className:`text-body-small-default`,style:{color:`var(--content-tertiary)`},children:e.label}),(0,q.jsx)(`dd`,{className:`min-w-0 truncate text-body-small-default`,style:{color:`var(--content-secondary)`},children:e.href?(0,q.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1 underline`,style:{color:`var(--primary-base, #60a5fa)`},children:[e.value,(0,q.jsx)(T,{className:`h-3 w-3`,"aria-hidden":!0})]}):e.value})]},e.label))})}function je({plugin:e,drift:t,onInstall:n,onRemove:r,onUpgrade:i,isInstalling:o,isRemoving:s,isUpgrading:c,hasLocalEdits:l,enabled:u,onToggle:d,isToggling:f}){let[p,m]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!1),v=e.installed??!1,b=e.artifact??null,x=t?.status===`update-available`,S=x?`Upgrade ${Y(t?.local?.commit??null)} → ${Y(t?.remote?.commit??null)}`:void 0;return(0,q.jsxs)(q.Fragment,{children:[v?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 md:flex-nowrap md:shrink-0`,children:[u!==void 0&&d?(0,q.jsx)(y,{label:`Auto-include in chat`,checked:u,onChange:()=>d(),disabled:f}):null,b?(0,q.jsx)(a,{asChild:!0,leftIcon:(0,q.jsx)(he,{"aria-hidden":!0}),children:(0,q.jsx)(`a`,{href:b.url,download:!0,children:b.label??`Download`})}):null,x?(0,q.jsx)(a,{type:`button`,onClick:()=>{if(l){_(!0);return}i()},disabled:c,title:S,leftIcon:c?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(R,{"aria-hidden":!0}),children:`Upgrade`}):null,(0,q.jsx)(a,{type:`button`,variant:`dangerOutline`,onClick:()=>m(!0),disabled:s,leftIcon:s?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(G,{"aria-hidden":!0}),children:`Remove`})]}):(0,q.jsx)(a,{type:`button`,onClick:n,disabled:o,leftIcon:o?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(W,{"aria-hidden":!0}),children:`Install`}),(0,q.jsx)(h,{open:p,title:`Remove plugin`,message:be(e.name),confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{m(!1),r()},onCancel:()=>m(!1)}),(0,q.jsx)(h,{open:g,title:`Upgrade plugin`,message:xe(e.name),confirmLabel:Se,destructive:!0,onConfirm:()=>{_(!1),i()},onCancel:()=>_(!1)})]})}function Z(){return(0,q.jsx)(`div`,{className:`flex items-center justify-center py-12`,children:(0,q.jsx)(A,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function Q(){return(0,q.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-12 text-center`,style:{color:`var(--content-tertiary)`},children:[(0,q.jsx)(j,{className:`h-6 w-6`,"aria-hidden":!0}),(0,q.jsx)(`p`,{className:`text-body-medium-default`,children:`We couldn't load this plugin.`}),(0,q.jsx)(`p`,{className:`text-body-small-default`,children:`It may not exist, or your assistant may be on an older build.`})]})}function Me({isInstallError:e,isRemoveError:t,isUpgradeError:n}){let r=e?Ce:t?we:n?Te:null;return r?(0,q.jsxs)(`div`,{className:`mb-3 flex items-center gap-2 rounded px-3 py-2 text-body-small-default`,style:{backgroundColor:`var(--surface-secondary)`,color:`var(--content-warning, var(--content-tertiary))`},role:`alert`,children:[(0,q.jsx)(j,{className:`h-4 w-4 shrink-0`,"aria-hidden":!0}),r]}):null}function Ne({external:e,className:t}){let n=e?{label:`External`,icon:k}:{label:`Local`,icon:te};return(0,q.jsx)(g,{tone:`neutral`,leftIcon:(0,K.createElement)(n.icon),className:t,children:n.label})}function Pe({onClick:e,isUpgrading:t=!1}={}){let n=(0,q.jsx)(g,{tone:`warning`,leftIcon:(0,K.createElement)(t?A:R,{className:t?`animate-spin`:void 0}),className:`shrink-0`,children:`Update available`});return e?(0,q.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),e()},disabled:t,"aria-label":`Upgrade plugin`,className:`shrink-0 rounded-[6px] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)] disabled:cursor-not-allowed`,children:n}):n}var Fe=300*1e3;function Ie({assistantId:e,name:t,enabled:n=!0}){return l({...ce({path:{assistant_id:e,name:t}}),enabled:!!e&&!!t&&n,staleTime:Fe,retry:!1})}function Le(e){let t=e?.local?.localChanges;return!!t&&t?.clean===!1}function Re(e,t,n){let r=c(),i=n?.onRemoved,a=l({...se({path:{assistant_id:e,name:t}}),enabled:!!e&&!!t}),o=Ie({assistantId:e,name:t,enabled:a.data?.installed??!1}).data,s=(0,K.useCallback)(()=>me(r,e,t),[e,t,r]),u=ie({onSuccess:()=>{s(),b.success(`Installed ${t||`plugin`}`)}}),d=ae({onSuccess:()=>{s(),i?.()}}),f=le({onSuccess:e=>{s(),b.success(e.outcome===`already-up-to-date`?`${t||`Plugin`} is already up to date`:`Upgraded ${t||`plugin`} to ${Y(e.toCommit)}`)}});return{plugin:a.data??null,drift:o,isLoading:a.isLoading,isError:a.isError,install:()=>{u.mutate({path:{assistant_id:e},body:{name:t}})},remove:()=>{d.mutate({path:{assistant_id:e,name:t}})},upgrade:()=>{f.mutate({path:{assistant_id:e,name:t},body:{}})},isInstalling:u.isPending,isRemoving:d.isPending,isUpgrading:f.isPending,isInstallError:u.isError,isRemoveError:d.isError,isUpgradeError:f.isError,hasLocalEdits:Le(o)}}function ze(e){let t=c(),n={queryKey:F({path:{assistant_id:e}})},r=(e,r)=>{t.setQueriesData(n,t=>t&&{...t,plugins:t.plugins.map(t=>t.name===e?{...t,enabled:r}:t)})},i=u({mutationFn:async({name:t,nextEnabled:n})=>{let r=await(n?N({path:{assistant_id:e,name:t},throwOnError:!1}):re({path:{assistant_id:e,name:t},throwOnError:!1})),i=r.response?.status;if(r.response?.ok||i===409)return r;throw Error(`Plugin toggle failed (${i??`network error`})`)},onMutate:async({name:e,nextEnabled:i})=>{await t.cancelQueries(n),r(e,i)},onError:(e,{name:t,nextEnabled:n})=>{r(t,!n),b.error(Ee)},onSettled:(n,r,i)=>{me(t,e,i.name)}});return{toggle:(e,t)=>{i.mutate({name:e,nextEnabled:t})},togglingName:i.isPending?i.variables?.name??null:null}}function Be({assistantId:e,name:t,onBack:n,externalHint:r,enabled:i}){let{plugin:o,drift:s,isLoading:c,isError:l,install:u,remove:d,upgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,isInstallError:_,isRemoveError:v,isUpgradeError:y,hasLocalEdits:b}=Re(e,t,{onRemoved:n}),{toggle:x,togglingName:C}=ze(e);return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col`,children:[(0,q.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,q.jsx)(a,{type:`button`,variant:`ghost`,iconOnly:(0,q.jsx)(S,{"aria-hidden":!0}),"aria-label":`Back to plugins`,onClick:n}),(0,q.jsx)(Ve,{name:t,plugin:o,externalHint:r,drift:s,onInstall:u,onRemove:d,onUpgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,hasLocalEdits:b,enabled:i,onToggle:()=>x(t,!i),isToggling:C===t})]}),(_||v||y)&&(0,q.jsx)(Me,{isInstallError:_,isRemoveError:v,isUpgradeError:y}),(0,q.jsx)(f.Root,{asChild:!0,children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-6 py-5`,children:c?(0,q.jsx)(Z,{}):l||!o?(0,q.jsx)(Q,{}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(X,{plugin:o,surfaces:s?.surfaces??null}),o.readme?(0,q.jsx)(U,{content:o.readme}):(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})})]})}function Ve({name:e,plugin:t,externalHint:n,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l,hasLocalEdits:u,enabled:d,onToggle:f,isToggling:p}){let m=t?.source?.kind===`github`,h=t?m:n,g=r?.status===`update-available`;return(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-start gap-3`,children:[h===void 0?(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-8 w-8 shrink-0`}):(0,q.jsx)(J,{external:h,size:`md`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,q.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t?.name??e}),t?.version?(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,t.version]}):null,t?(0,q.jsx)(Ne,{external:m}):null,g?(0,q.jsx)(Pe,{}):null]}),t?.description?(0,q.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}):null]})]}),t?(0,q.jsx)(je,{plugin:t,drift:r,onInstall:i,onRemove:a,onUpgrade:o,isInstalling:s,isRemoving:c,isUpgrading:l,hasLocalEdits:u,enabled:d,onToggle:f,isToggling:p}):null]})}var He=e(i(),1);function Ue({assistantId:e,name:t,onBack:n,externalHint:r,enabled:i}){let{plugin:o,drift:s,isLoading:c,isError:l,install:u,remove:d,upgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,isInstallError:_,isRemoveError:v,isUpgradeError:y,hasLocalEdits:b}=Re(e,t,{onRemoved:n}),{toggle:x,togglingName:C}=ze(e),[w,T]=(0,K.useState)(null);(0,K.useEffect)(()=>{T(document.getElementById(`viewport-overlays`))},[]);let E=o?.source?.kind===`github`,ee=o?E:r,D=s?.status===`update-available`,O=o?.name??t,k=(0,q.jsxs)(`div`,{className:`fixed inset-0 z-40 flex flex-col overflow-hidden bg-[var(--surface-overlay)]`,style:{paddingTop:`calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))`,paddingBottom:`calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))`,paddingLeft:`calc(12px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)))`,paddingRight:`calc(12px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))`},children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,q.jsx)(a,{variant:`ghost`,iconOnly:(0,q.jsx)(S,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to plugins`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-2 text-center text-body-medium-default`,style:{color:`var(--content-secondary)`},children:O}),(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-8 w-8 shrink-0 touch-mobile:h-10 touch-mobile:w-10`})]}),(0,q.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,q.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[ee===void 0?(0,q.jsx)(`span`,{"aria-hidden":!0,className:`h-8 w-8 shrink-0`}):(0,q.jsx)(J,{external:ee,size:`md`}),(0,q.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:O})]}),(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[D?(0,q.jsx)(Pe,{}):null,o?(0,q.jsx)(Ne,{external:E}):null]})]}),o?.description?(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:o.description}):null]}),o?(0,q.jsx)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:(0,q.jsx)(je,{plugin:o,drift:s,enabled:i,onToggle:()=>x(t,!i),isToggling:C===t,onInstall:u,onRemove:d,onUpgrade:p,isInstalling:m,isRemoving:h,isUpgrading:g,hasLocalEdits:b})}):null,(_||v||y)&&(0,q.jsx)(`div`,{className:`mt-3`,children:(0,q.jsx)(Me,{isInstallError:_,isRemoveError:v,isUpgradeError:y})}),(0,q.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,q.jsx)(`div`,{className:`mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border bg-[var(--surface-lift)]`,style:{borderColor:`var(--border-hover)`},children:(0,q.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-4 py-4`,children:c?(0,q.jsx)(Z,{}):l||!o?(0,q.jsx)(Q,{}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(X,{plugin:o,surfaces:s?.surfaces??null}),o.readme?(0,q.jsx)(U,{content:o.readme}):(0,q.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`This plugin doesn't ship a README.`})]})})})})]});return w?(0,He.createPortal)(k,w):k}var We={value:`all`,label:`All`,icon:H},Ge={value:`available`,label:`Available`,icon:W};function Ke(e){return e?[We,{value:`active`,label:`Active`,icon:fe},{value:`off`,label:`Off`,icon:ve},Ge]:[We,{value:`installed`,label:`Installed`,icon:B},Ge]}function qe({search:e,onSearchChange:t,filter:n,onFilterChange:r,isSearching:i=!1,categories:a,category:o,onCategoryChange:s,counts:c,totalCount:l,showCounts:u,pluginToggleSupported:d}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(v,{type:`search`,value:e,onChange:e=>{t(e.target.value)},placeholder:`Search plugins`,"aria-label":`Search plugins`,leftIcon:(0,q.jsx)(pe,{className:`h-4 w-4`,"aria-hidden":!0}),rightIcon:i?(0,q.jsx)(A,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}):void 0,fullWidth:!0,wrapperClassName:`flex-1`}),(0,q.jsx)(Je,{filter:n,onFilterChange:r,categories:a,category:o,onCategoryChange:s,counts:c,totalCount:l,showCounts:u,pluginToggleSupported:d})]})}function Je(e){let t=ue(),[n,r]=(0,K.useState)(!1),i=(0,q.jsx)(a,{type:`button`,variant:`outlined`,iconOnly:(0,q.jsx)(E,{"aria-hidden":!0}),"aria-label":`Filter plugins`,"aria-haspopup":t?`dialog`:`listbox`,"aria-expanded":n,tintColor:`var(--primary-base)`});return t?(0,q.jsx)(Ye,{...e,open:n,onOpenChange:r,trigger:i}):(0,q.jsxs)(_.Root,{open:n,onOpenChange:r,children:[(0,q.jsx)(_.Trigger,{asChild:!0,children:i}),(0,q.jsx)(_.Content,{align:`end`,sideOffset:4,className:`w-44 overflow-hidden p-0`,children:(0,q.jsx)(`ul`,{role:`listbox`,children:(0,q.jsx)(Qe,{label:`Status`,options:Ke(e.pluginToggleSupported),selected:e.filter,onSelect:t=>{e.onFilterChange(t),r(!1)}})})})]})}function Ye({filter:e,onFilterChange:t,categories:n,category:r,onCategoryChange:i,counts:o,totalCount:s,showCounts:c,pluginToggleSupported:l,open:u,onOpenChange:d,trigger:f}){let m=[...n].sort((e,t)=>e.label.localeCompare(t.label));return(0,q.jsxs)(p.Root,{open:u,onOpenChange:d,children:[(0,q.jsx)(p.Trigger,{asChild:!0,children:f}),(0,q.jsxs)(p.Content,{className:`max-h-[85dvh]`,"aria-describedby":void 0,children:[(0,q.jsx)(`div`,{"aria-hidden":!0,className:`mx-auto mb-3 h-1 w-9 shrink-0 rounded-full bg-[var(--border-element)]`}),(0,q.jsx)(p.Header,{children:(0,q.jsx)(p.Title,{children:`Filters`})}),(0,q.jsxs)(p.Body,{className:`flex flex-col gap-3 pt-2`,children:[(0,q.jsx)(Xe,{label:`Status`,children:Ke(l).map(n=>(0,q.jsx)(Ze,{icon:n.icon,label:n.label,active:e===n.value,onSelect:()=>t(n.value)},n.value))}),n.length>0&&(0,q.jsxs)(Xe,{label:`Categories`,children:[(0,q.jsx)(Ze,{icon:H,label:`All`,active:r===null,badge:c?s:void 0,onSelect:()=>i(null)}),m.map(e=>(0,q.jsx)(Ze,{icon:D(e.icon)??H,label:e.label,active:r===e.slug,badge:c?o[e.slug]??0:void 0,onSelect:()=>i(e.slug)},e.slug))]})]}),(0,q.jsx)(p.Footer,{children:(0,q.jsx)(a,{type:`button`,variant:`primary`,fullWidth:!0,onClick:()=>d(!1),children:`Done`})})]})]})}function Xe({label:e,children:t}){return(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`div`,{className:`px-2 pb-1 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e}),t]})}function Ze({icon:e,label:t,active:n,badge:r,onSelect:i}){return(0,q.jsx)(m,{icon:e,label:t,active:n,activeVariant:`branded`,badge:r,trailingAction:n&&r==null?(0,q.jsx)(C,{className:`h-4 w-4 text-[var(--primary-base)]`,"aria-hidden":!0}):void 0,onSelect:i})}function Qe({label:e,options:t,selected:n,onSelect:r}){return(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`div`,{className:`px-3 pb-1 pt-2 text-body-small-default uppercase tracking-wide`,style:{color:`var(--content-tertiary)`},children:e}),(0,q.jsx)(`ul`,{children:t.map(e=>{let t=e.icon,i=n===e.value;return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`button`,{type:`button`,onClick:()=>r(e.value),role:`option`,"aria-selected":i,className:`flex w-full items-center gap-2 px-3 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:i?`var(--primary-base)`:`var(--content-default)`},children:[(0,q.jsx)(t,{className:`h-4 w-4`,"aria-hidden":!0}),(0,q.jsx)(`span`,{className:`flex-1`,children:e.label}),i&&(0,q.jsx)(B,{className:`h-3.5 w-3.5`,"aria-hidden":!0})]})},e.value)})})]})}function $e({item:e,drift:t,onSelect:n,onInstall:r,onRemove:i,onUpgrade:o,isInstalling:s=!1,isRemoving:c=!1,isUpgrading:l=!1}){let u=e.status===`available`,d=t?.status===`update-available`,p=e.enabled!==void 0,m=e.enabled===!1;return(0,q.jsx)(f.Root,{asChild:!0,children:(0,q.jsxs)(`div`,{role:`button`,tabIndex:0,onClick:n,onKeyDown:e=>{e.target===e.currentTarget&&(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n())},className:`flex cursor-pointer items-center gap-3 px-3 py-2 text-left transition-colors hover:bg-[var(--surface-hover)] focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,q.jsx)(J,{size:`sm`,external:e.external,className:m?`opacity-50`:void 0}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(`span`,{className:`truncate text-body-medium-default`,style:{color:m?`var(--content-tertiary)`:`var(--content-emphasised)`},children:e.name}),e.version?(0,q.jsxs)(`span`,{className:`shrink-0 text-body-small-default`,style:{color:`var(--content-tertiary)`},children:[`v`,e.version]}):null,d?(0,q.jsx)(Pe,{onClick:o,isUpgrading:l}):null]}),(0,q.jsx)(`p`,{className:`mt-1 truncate text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:e.description??`No description provided.`}),e.issues&&e.issues.length>0?(0,q.jsxs)(`p`,{className:`mt-1 truncate text-body-small-default`,style:{color:`var(--content-warning, var(--content-tertiary))`},title:e.issues.join(`; `),children:[e.issues[0],e.issues.length>1?` (+${e.issues.length-1} more)`:``]}):null]}),u?s?(0,q.jsx)(a,{type:`button`,iconOnly:(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}),disabled:!0,"aria-label":`Installing`,expandOnMobile:!1}):(0,q.jsx)(a,{type:`button`,iconOnly:(0,q.jsx)(W,{"aria-hidden":!0}),onClick:e=>{e.stopPropagation(),r?.()},disabled:!r,"aria-label":`Install plugin`,expandOnMobile:!1}):(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[p?(0,q.jsx)(g,{tone:e.enabled?`positive`:`neutral`,children:e.enabled?`Enabled`:`Disabled`}):null,(0,q.jsx)(a,{type:`button`,variant:`dangerOutline`,iconOnly:c?(0,q.jsx)(A,{className:`animate-spin`,"aria-hidden":!0}):(0,q.jsx)(G,{"aria-hidden":!0}),onClick:e=>{e.stopPropagation(),i?.()},disabled:c||l||!i,"aria-label":`Remove plugin`,expandOnMobile:!1})]})]})})}var et=300*1e3,$=[],tt=[];async function nt(e,t,n){let r=await P({path:{assistant_id:e},query:{q:void 0,category:t},signal:n,throwOnError:!1});if(r.response?.status===404)return{plugins:[]};if(!r.response?.ok)throw Error(`Failed to load plugins`);return r.data??{plugins:[]}}function rt(e,t){let[n,r]=(0,K.useState)({assistantId:e,latched:!1}),i=n.assistantId===e?n.latched:!1;return n.assistantId!==e&&r({assistantId:e,latched:!1}),(0,K.useEffect)(()=>{t&&r(t=>t.assistantId===e&&t.latched?t:{assistantId:e,latched:!0})},[e,t]),i||t}function it(e,t=null){let n=t??void 0,r=l({queryKey:F({path:{assistant_id:e},query:{q:void 0,category:n}}),queryFn:({signal:t})=>nt(e,n,t),enabled:!!e,staleTime:et}),i=l({...V(e),enabled:!!e&&t!==null}),a=l({...oe({path:{assistant_id:e},query:{q:void 0}}),enabled:!!e,staleTime:et}),o=(0,K.useMemo)(()=>{let e=t===null?r.data?.plugins:i.data?.plugins??r.data?.plugins;return new Set((e??$).map(e=>e.name))},[t,i.data?.plugins,r.data?.plugins]),s=(0,K.useMemo)(()=>{let e=r.data?.plugins??$,n=a.data?.matches??tt;return ke(De(e,(t===null?n:n.filter(e=>(e.category??`system`)===t)).filter(e=>!o.has(e.name))))},[r.data?.plugins,a.data?.matches,t,o]),u=t===null?r.data:i.data,d=rt(e,u?.categoryCounts!==void 0),f=rt(e,(u?.plugins??$).some(e=>e.enabled!==void 0)),p=c(),m=(0,K.useRef)(null);return(0,K.useEffect)(()=>{if(m.current===e||!a.isSuccess)return;let t=u?.plugins;if(!t?.length)return;let n=new Map((a.data?.matches??tt).map(e=>[e.name,e.category]));t.some(e=>{let t=n.get(e.name);return t!=null&&t!==`system`&&(e.category??`system`)===`system`})&&(m.current=e,p.invalidateQueries({queryKey:F({path:{assistant_id:e},query:{q:void 0}})}))},[e,a.isSuccess,a.data?.matches,u?.plugins,p]),{items:s,isLoading:r.isLoading,catalogLoading:a.isLoading,isError:r.isError,isFetching:r.isFetching||a.isFetching,catalogError:a.isError,categorySupported:d,pluginToggleSupported:f,installedCategoryCounts:u?.categoryCounts,installedPlugins:u?.plugins??$,installedTotal:u?.totalCount,catalogMatches:a.data?.matches??tt,unfilteredInstalledNames:o}}var at=`vellum:plugins:tipDismissed`;function ot({assistantId:e}){let r=c(),i=ue(),[a,s]=o(),l=a.get(`plugin`),[u,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(`all`),[m,g]=(0,K.useState)(null),[_,v]=(0,K.useState)(null),[y,x]=(0,K.useState)(null),[S,C]=(0,K.useState)(null),[w,T]=(0,K.useState)(null),[E,D]=(0,K.useState)(null),[k,te]=(0,K.useState)(()=>n(at,!1)),[A,ne]=(0,K.useState)(e);e!==A&&(ne(e),g(null));let j=e===A?m:null,{data:M=[]}=O(e),{items:N,isLoading:P,catalogLoading:re,isError:oe,isFetching:se,catalogError:F,categorySupported:ce,pluginToggleSupported:I,installedCategoryCounts:de,installedPlugins:L,installedTotal:R,catalogMatches:z,unfilteredInstalledNames:B}=it(e,j),V=(I?[`all`,`active`,`off`,`available`]:[`all`,`installed`,`available`]).includes(f)?f:`all`,{counts:H,totalCount:U}=st(de,L,R,z,B,V),fe=ce&&M.length>0,W=(0,K.useCallback)(t=>me(r,e,t),[e,r]),pe=ie({onMutate:e=>v(e.body.name),onSuccess:(e,t)=>b.success(`Installed ${t.body.name}`),onError:()=>b.error(Ce),onSettled:(e,t,n)=>{v(null),W(n.body.name)}}),he=ae({onMutate:e=>x(e.path.name),onSuccess:(e,t)=>b.success(`Removed ${t.path.name}`),onError:()=>b.error(we),onSettled:(e,t,n)=>{x(null),W(n.path.name)}}),G=le({onMutate:e=>C(e.path.name),onSuccess:(e,t)=>b.success(e.outcome===`already-up-to-date`?`${t.path.name} is already up to date`:`Upgraded ${t.path.name} to ${Y(e.toCommit)}`),onError:()=>b.error(Te),onSettled:(e,t,n)=>{C(null),W(n.path.name)}}),ge=(0,K.useCallback)(e=>s(t=>{let n=new URLSearchParams(t);return n.set(`plugin`,e.name),n}),[s]),_e=(0,K.useCallback)(()=>s(e=>{let t=new URLSearchParams(e);return t.delete(`plugin`),t},{replace:!0}),[s]),ve=(0,K.useCallback)(t=>{pe.mutate({path:{assistant_id:e},body:{name:t.name}})},[e,pe]),ye=(0,K.useCallback)(()=>{w&&(he.mutate({path:{assistant_id:e,name:w.name}}),T(null))},[e,w,he]),J=(0,K.useCallback)(t=>{G.mutate({path:{assistant_id:e,name:t},body:{}})},[e,G]),Ee=(0,K.useCallback)(()=>{E&&(J(E.name),D(null))},[E,J]),De=(0,K.useCallback)((e,t)=>{if(Le(t)){D(e);return}J(e.name)},[J]),ke=(0,K.useCallback)(()=>{te(!0),t(at,!0)},[]),X=(0,K.useMemo)(()=>Ae(N,V).filter(e=>Oe(e,u)),[N,V,u]),je=se&&!P,Z=u.trim().length>0;if(l){let t=N.find(e=>e.name===l),n={assistantId:e,name:l,externalHint:t?.external,enabled:t?.enabled,onBack:_e};return i?(0,q.jsx)(Ue,{...n}):(0,q.jsx)(Be,{...n})}let Q=(0,q.jsx)(`div`,{className:`min-w-0 flex-1 overflow-y-auto`,children:P?(0,q.jsx)(dt,{}):oe?(0,q.jsx)(ft,{}):X.length===0?re&&(V===`all`||V===`available`)?(0,q.jsx)(dt,{}):(0,q.jsx)(pt,{filter:V,category:j}):(0,q.jsx)(`ul`,{className:`flex flex-col gap-2`,children:X.map(t=>(0,q.jsx)(`li`,{children:t.status===`installed`?(0,q.jsx)(ct,{assistantId:e,item:t,onSelect:()=>ge(t),onRemove:()=>T(t),onUpgrade:e=>De(t,e),isRemoving:y===t.name,isUpgrading:S===t.name}):(0,q.jsx)($e,{item:t,onSelect:()=>ge(t),onInstall:()=>ve(t),isInstalling:_===t.name})},t.name))})});return(0,q.jsxs)(`div`,{className:`flex h-full min-h-0 flex-1 flex-col gap-4`,children:[!k&&(0,q.jsx)(lt,{onDismiss:ke}),(0,q.jsx)(qe,{search:u,onSearchChange:d,filter:V,onFilterChange:p,isSearching:je,categories:fe?M:[],category:j,onCategoryChange:g,counts:H,totalCount:U,showCounts:!Z,pluginToggleSupported:I}),F&&!P&&!oe?(0,q.jsx)(ut,{}):null,fe?(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-6`,children:[(0,q.jsx)(`aside`,{className:`hidden w-56 shrink-0 overflow-y-auto md:block`,children:(0,q.jsx)(ee,{ariaLabel:`Plugin categories`,selected:j,onSelect:g,counts:H,totalCount:U,showCounts:!Z,categories:M})}),Q]}):Q,(0,q.jsx)(h,{open:w!==null,title:`Remove plugin`,message:w?be(w.name):``,confirmLabel:`Remove`,destructive:!0,onConfirm:ye,onCancel:()=>T(null)}),(0,q.jsx)(h,{open:E!==null,title:`Upgrade plugin`,message:E?xe(E.name):``,confirmLabel:Se,destructive:!0,onConfirm:Ee,onCancel:()=>D(null)})]})}function st(e,t,n,r,i,a){return(0,K.useMemo)(()=>{let o={},s=a!==`available`,c=a===`all`||a===`available`,l=a===`active`||a===`off`,u=l?t.filter(e=>a===`off`?e.enabled===!1:e.enabled!==!1):t;if(s)if(!l&&e&&Object.keys(e).length>0)Object.assign(o,e);else for(let e of u){let t=e.category??`system`;o[t]=(o[t]??0)+1}let d=0;if(c)for(let e of r){if(i.has(e.name))continue;let t=e.category??`system`;o[t]=(o[t]??0)+1,d+=1}let f=l?u.length:n??t.length;return{counts:o,totalCount:(s?f:0)+d}},[e,t,n,r,i,a])}function ct({assistantId:e,item:t,onSelect:n,onRemove:r,onUpgrade:i,isRemoving:a,isUpgrading:o}){let s=Ie({assistantId:e,name:t.name}).data;return(0,q.jsx)($e,{item:t,drift:s,onSelect:n,onRemove:r,onUpgrade:()=>i(s),isRemoving:a,isUpgrading:o})}function lt({onDismiss:e}){return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-4 py-2.5 text-body-small-default`,style:{backgroundColor:`var(--surface-base)`,color:`var(--content-secondary)`},children:[(0,q.jsx)(ne,{className:`h-4 w-4 shrink-0`,style:{color:`var(--primary-base)`}}),(0,q.jsx)(`p`,{className:`flex-1`,children:`Browse the catalog below to install plugins that extend your assistant.`}),(0,q.jsx)(a,{type:`button`,variant:`ghost`,size:`compact`,iconOnly:(0,q.jsx)(M,{"aria-hidden":!0}),onClick:e,"aria-label":`Dismiss tip`,tintColor:`var(--content-tertiary)`,expandOnMobile:!1})]})}function ut(){return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg px-4 py-2.5 text-body-small-default`,style:{backgroundColor:`var(--surface-base)`,color:`var(--content-secondary)`},children:[(0,q.jsx)(w,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,q.jsx)(`p`,{className:`flex-1`,children:`Catalog browsing is temporarily unavailable. Installed plugins are still listed below.`})]})}function dt(){return(0,q.jsx)(`div`,{className:`flex items-center justify-center py-16`,children:(0,q.jsx)(A,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})})}function ft(){return(0,q.jsx)(f.Root,{children:(0,q.jsxs)(f.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,q.jsx)(j,{className:`mb-3 h-8 w-8`,style:{color:`var(--system-danger)`},"aria-hidden":!0}),(0,q.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:`Failed to load plugins`}),(0,q.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Something went wrong. Try refreshing the page.`})]})})}function pt({filter:e,category:t}){let{title:n,subtitle:r,Icon:i}=mt(e,t);return(0,q.jsx)(f.Root,{children:(0,q.jsxs)(f.Body,{className:`flex flex-col items-center justify-center py-16 text-center`,children:[(0,q.jsx)(i,{className:`mb-3 h-8 w-8`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0}),(0,q.jsx)(`h3`,{className:`text-title-small`,style:{color:`var(--content-default)`},children:n}),(0,q.jsx)(`p`,{className:`mt-1 max-w-sm text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:r})]})})}function mt(e,t){if(t)return{title:`No plugins in this category`,subtitle:`Try selecting a different category or clearing the filter.`,Icon:H};switch(e){case`installed`:return{title:`No Plugins Installed`,subtitle:`Browse the catalog to install plugins that extend your assistant.`,Icon:z};case`active`:return{title:`No Active Plugins`,subtitle:`Install a plugin from the catalog, or turn on an installed one.`,Icon:z};case`off`:return{title:`No Plugins Turned Off`,subtitle:`Installed plugins you turn off will appear here.`,Icon:z};case`available`:return{title:`No Plugins Available`,subtitle:`Every catalog plugin is already installed.`,Icon:B};default:return{title:`No Plugins Found`,subtitle:`Browse the catalog to install plugins that extend your assistant.`,Icon:z}}}function ht(){let e=de.use.version(),t=_e(),n=ge();return e===null?null:t?(0,q.jsx)(ot,{assistantId:n}):(0,q.jsx)(s,{to:I.identity,replace:!0})}export{ht as PluginsPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D-AX8Voo.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./card-BibIM9x3.js";import{t as l}from"./input-D4W4p0pZ.js";import{c as u,f as d,o as f}from"./local-mode-CgrENuVf.js";import{t as p}from"./is-electron-C_ZTVhv8.js";import{n as m}from"./resolved-assistants-store-Dqf0LJrA.js";import{t as h}from"./check-D6WkI0gF.js";import{t as g}from"./chevron-left-DghyKSEE.js";import{t as _}from"./loader-circle-BFRVtR3K.js";import{t as v}from"./pencil-B90pDI55.js";import{t as y}from"./x-DxL-bCuT.js";import{A as b,C as ee,a as x,j as S,n as C,o as w}from"./auth-store-B1y6dgYQ.js";import{t as T}from"./client.gen-BHupOCJH.js";import{m as te}from"./native-biometric-BK6_QtW5.js";import{a as E}from"./routes-C6gxiCrz.js";import{r as D}from"./platform-detection-Ceodt3Hu.js";import{o as O,r as k}from"./prefs-Ds__U7Hi.js";import{t as A}from"./client-feature-flag-store-CHA6YxVq.js";import{c as j,l as ne,n as M,t as re}from"./prechat-RG0Q0UrS.js";import{b as ie,r as ae,yt as N}from"./react-query.gen-gQ1_8EHv.js";import{n as oe,t as se}from"./browser-DM38C5zq.js";import{t as P}from"./public-asset-C2P77n3W.js";import{$t as F,Ct as ce,J as le,Qt as ue,Tt as de,Zt as fe,_t as I,bt as pe,ca as L,d as R,en as z,l as B,nn as me,q as V,rn as H,u as he,vt as ge,wt as _e}from"./index-CZ2UBc_U.js";import{n as U,r as ve}from"./prechat-names-NPlBAwCy.js";import{t as ye}from"./step-indicator-dots-Bc6X141I.js";var W=e(t(),1);async function be(){try{let{data:e,response:t}=await T.get({url:`/v1/onboarding/recipe/`,throwOnError:!1});if(!t?.ok||!e)return null;let n=e;return typeof n.cohort!=`string`||!Array.isArray(n.tasks)||typeof n.tone!=`string`||typeof n.bootstrap_template!=`string`||typeof n.initial_message!=`string`||!Array.isArray(n.skills)||typeof n.skip_prechat!=`boolean`?null:{cohort:n.cohort,tasks:n.tasks,tone:n.tone,bootstrapTemplate:n.bootstrap_template,initialMessage:n.initial_message,skills:n.skills,skipPrechat:n.skip_prechat}}catch{return null}}var G=s(),xe=[{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 Se({onComplete:e}){function t(){R(),B(),e()}return(0,G.jsx)(H,{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:xe.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)(h,{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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var K=`google`,Ce=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)}];function we({assistantId:e,assistantName:t,onConnect:r,onSkip:i,onBack:o}){let s=p(),c=a(),l=te(),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(null),m=(0,W.useRef)(null),h=(0,W.useRef)(null),v=(0,W.useRef)(null),y=(0,W.useRef)(null),[b,x]=(0,W.useState)(!1),S=(0,W.useCallback)(()=>{d.current=null,x(!1)},[]),C=(0,W.useCallback)(()=>{h.current&&=(window.removeEventListener(`message`,h.current),null),v.current&&=(window.removeEventListener(`storage`,v.current),null)},[]),w=(0,W.useCallback)(()=>{u.current&&!u.current.closed&&u.current.close(),u.current=null,f.current&&=(clearInterval(f.current),null),m.current&&=(clearTimeout(m.current),null)},[]),T=N();(0,W.useEffect)(()=>()=>{f.current&&clearInterval(f.current),m.current&&clearTimeout(m.current),u.current&&!u.current.closed&&u.current.close(),h.current&&window.removeEventListener(`message`,h.current),v.current&&window.removeEventListener(`storage`,v.current),y.current&&=(y.current(),null)},[]);let D=(0,W.useCallback)(async e=>{try{return(await c.fetchQuery({...ie({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===K&&e.connected)??null}catch{return null}},[c]),O=(0,W.useCallback)(async()=>{let e=d.current?.platformAssistantId;w(),S(),r((e?await D(e):null)?.scopes_granted??[])},[S,w,D,r]),k=(0,W.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!d.current||e.requestId!==d.current.requestId||(e.oauthStatus===`connected`?O():(w(),S())))},[S,w,O]),A=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=fe(e,window.location.origin,t.requestId);n&&k(n)},[k]),j=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=ue(e,t.requestId);n&&(k(n),window.localStorage.removeItem(z(t.requestId)))},[k]);me((0,W.useCallback)(e=>{let t=d.current;t&&e.requestId===t.requestId&&k({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[k]));let ne=(0,W.useCallback)(()=>{let t=crypto.randomUUID();if(C(),h.current=A,v.current=j,l){x(!0),(async()=>{let n;try{n=await ee(e)}catch{S();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){se(e.connect_url)},onError(){S()}})})(),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),y.current&&y.current();let n=oe(()=>{let e=d.current;if(!e){n(),y.current=null;return}(async()=>{let t=await D(e.platformAssistantId);d.current&&(t?await O():S(),C(),n(),y.current=null)})()});y.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){C();return}u.current=n,x(!0),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),f.current=setInterval(()=>{u.current&&u.current.closed&&d.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=d.current;if(!e)return;let t=window.localStorage.getItem(z(e.requestId));if(t)try{let n=JSON.parse(t);if(F(n,e.requestId)){k(n),window.localStorage.removeItem(z(e.requestId)),C();return}}catch{}let n=await D(e.platformAssistantId);d.current&&(n?await O():(w(),S()),C())},1e3))},100),(async()=>{let n;try{n=await ee(e)}catch{w(),S(),C();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){u.current&&!u.current.closed?u.current.location.href=e.connect_url:d.current&&(w(),S(),C())},onError(){w(),S(),C()}})})()},[e,S,w,D,k,A,j,O,l,C,T]),M=t||`your assistant`,re=t||`Your assistant`;return(0,G.jsx)(H,{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:o,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,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, ${M} 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:Ce.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:`${re} 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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:ne,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:b||T.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)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}function Te({userName:e,assistantName:t,selectedGroupId:r,displayedAssistantNames:i,onUserNameChange:a,onAssistantNameChange:o,onGroupChange:s,onBack:c,onComplete:u,onSkip:d}){let f=p();return(0,G.jsx)(H,{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 ${c?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[c?(0,G.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,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.`}),c?(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)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>o(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:i.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]}),(0,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:U.map(e=>(0,G.jsx)(Ee,{group:e,isActive:r===e.id,onToggle:()=>s(r===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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:u,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:d,className:`${f?`h-9`:`h-11 text-base`}`,children:`Skip`})]})]})})}function Ee({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 De({userName:e,assistantName:t,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onBack:o,onContinue:s,onSkip:c,currentStep:u,totalSteps:d}){return(0,G.jsx)(H,{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:[o?(0,G.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:o,"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)(ye,{current:u,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)(l,{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)(l,{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 w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:c,className:`h-11 text-base`,children:`Skip`})]})]})})}var Oe=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:P(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:P(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:P(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:P(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:P(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:P(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:P(`/images/prior-assistants/copilot.svg`)}];function ke({selectedAssistants:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>q(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(J(e));(0,W.useEffect)(()=>{let t=J(e);if(t===m.current)return;let n=q(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}Ae(n,e)||(m.current=J(n),t(n))},[s]);let h=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 s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(H,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,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:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`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:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you've built anything with another assistant, I can help you bring it over.`}),(0,G.jsxs)(`div`,{className:`${o?`mt-4`:`mt-8`} grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Oe.map(t=>(0,G.jsx)(je,{assistant:t,selected:e.has(t.id),onToggle:()=>h(t.id)},t.id)),d?null:(0,G.jsx)(Me,{onClick:()=>f(!0)})]}),d?(0,G.jsx)(c,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,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),u(``)},"aria-label":`Dismiss custom assistants`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),_.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:`${o?`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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I haven't used any`})]})]})})}function Ae(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function q(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function J(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function je({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)(Ne,{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)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Me({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)(L,{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 Ne({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 Pe({selectedTasks:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),s=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,G.jsx)(H,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,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:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`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:`${o?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`Pick the one or two you do most — you can select more if it really is all of it.`}),(0,G.jsx)(`div`,{className:`${o?`mt-6`:`mt-8`} flex w-full flex-col ${o?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:V.map(t=>{let n=le[t.iconKey],r=e.has(t.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>s(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${o?`gap-2 p-3`:`gap-3 px-4 py-3`} rounded-lg border text-left transition-colors ${r?`border-[var(--primary-base)] bg-[var(--primary-base)]/10`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,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)(h,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}var Fe=new Set([`gmail`,`google-calendar`,`google-drive`]),Ie=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:P(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:P(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:P(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:P(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:P(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:P(`/images/integrations/github.svg`),logoSrcDark:P(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:P(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:P(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:P(`/images/integrations/apple-notes.svg`)}];function Le(e){let t=e.map(e=>e.startsWith(`other:`)?e.slice(6):e);return Array.from(new Set(t)).sort()}function Re({selectedTools:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>Y(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(X(e));(0,W.useEffect)(()=>{let t=X(e);if(t===m.current)return;let n=Y(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(m.current=X(n),t(n))},[s]);let h=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 s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(H,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${r?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),r?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`This helps me tailor how I assist you. No connections needed — you can set those up later.`}),(0,G.jsxs)(`div`,{className:`grid w-full gap-2 ${o?`mt-4 grid-cols-4`:`mt-8 grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Ie.map(t=>(0,G.jsx)(Z,{tool:t,selected:e.has(t.id),onToggle:()=>h(t.id),electron:o},t.id)),d?null:(0,G.jsx)(Q,{onClick:()=>f(!0),electron:o})]}),d?(0,G.jsx)(c,{padding:o?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col ${o?`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),u(``)},"aria-label":`Dismiss custom tools`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),_.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:`${o?`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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}function ze(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function X(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Z({tool:e,selected:t,onToggle:n,electron:r}){return(0,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)($,{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)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Q({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)(L,{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 $({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 Be({selectedGroupId:e,onGroupChange:t,onBack:r,onContinue:i,onSkip:a,currentStep:o,totalSteps:s}){return(0,G.jsx)(H,{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)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:r,"aria-label":`Back`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(ye,{current:o,total:s})}),(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:U.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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ve(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 He=[`gmail`,`google-calendar`,`google-drive`],Ue=`experiment-activation-flow-2026-06-03`,We=`BOOTSTRAP-ACTIVATION-RAIL.md`;function Ge(e,t,n){return t?.initialMessage?t.initialMessage:n?M(e):re}function Ke(e){let{mode:t,recipe:n}=e,r=e.connectedScopes!==void 0,i;i=t===`native`?{tools:[],tasks:[],tone:e.tone,googleConnected:!1}:t===`paredDown`?{tools:r?[...He]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:Le([...e.selectedTools]),tasks:[...e.selectedTasks].sort(),tone:e.tone},n&&(i.cohort=n.cohort,i.bootstrapTemplate=n.bootstrapTemplate,i.skills=n.skills),e.activationFlowEnabled&&(i.cohort=Ue,i.bootstrapTemplate=We);let a=e.userName.trim();a&&(i.userName=a);let o=e.occupation?.trim();o&&(i.occupation=o);let s=e.assistantName.trim();return s&&(i.assistantName=s),t===`paredDown`?r&&(i.googleScopes=e.connectedScopes):t===`control`&&(r?(i.googleConnected=!0,i.googleScopes=e.connectedScopes):e.googleConnected?(i.googleConnected=!0,i.googleScopes=e.googleScopes):i.googleConnected=!1),t===`control`&&e.selectedPriorAssistants.size>0&&(i.priorAssistants=Le([...e.selectedPriorAssistants])),i.initialMessage=Ge(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function qe(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Je(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:I.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:I.controlWorkType,enabled:!t},{id:`tools`,funnelStep:I.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:I.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?I.gmailConnect:I.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:I.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ye(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Xe=`1`;function Ze(e){return e===`nativeVibe`||e===Xe?`nativeVibe`:null}function Qe(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function $e(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function et(){let e=r(),t=te(),n=O()&&k();return(0,W.useEffect)(()=>{!n&&!t&&e(E.onboarding.privacy,{replace:!0})},[n,t,e]),t||n}function tt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,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=Ze(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 nt=3;function rt(){let e=u();return e?.cloud===`vellum`?e.assistantId:f()[0]?.assistantId??null}function it(){let e=r(),[t]=i(),n=t.get(`preview`)===`true`,a=C.use.user(),s=x(),c=w(),l=a?.id??null,u=a?.firstName??``,f=a?.lastName??``,p=te(),h=m.use.activeAssistantId(),g=d(),_=D()&&!he(),v=A.use.stringFlags().preChatOnboardingExperiment20260606??`control`,y=(A.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,ee=A.use.selfIntroGreeting(),T=ce(v),O=_e()??T,k=O===ge.paredDown,M=g?rt():null,re=et(),{currentStep:ie,setCurrentStep:N,clearPersistedStep:oe}=tt(l,p),se=C.use.platformSession(),P=S(se),[F,le]=(0,W.useState)(()=>new Set),[ue,fe]=(0,W.useState)(()=>new Set),[I,L]=(0,W.useState)(()=>new Set),{value:R,onChange:z}=Ve(g&&!P?``:u||f),[B,me]=(0,W.useState)(null),[V]=(0,W.useState)(()=>ve()),[H,U]=(0,W.useState)(``),[ye,xe]=(0,W.useState)(!1),[K,Ce]=(0,W.useState)([]),{data:Ee}=o({...ae(),enabled:!c&&s&&(!g||P)}),{data:Oe,isLoading:Ae}=o({queryKey:[`onboarding-recipe`,l],queryFn:be,enabled:!c&&s&&!p&&!g,staleTime:1/0}),q=Oe??null,J=Ee?.id??h??M,je=qe({localMode:g,platformSession:se,hasCachedPlatformAssistant:M!==null}),Me=je,Ne=je,Ie=async()=>{await b.checkAssistant(),e(`${E.assistant}?onboarding=1`,{replace:!0})};function Le(e,t=O){n||pe(e,{userId:l,variant:de(t)})}let ze=[...F].some(e=>Fe.has(e)),Y=p?Ye():Je({paredDown:k,canOfferPriorAssistants:Ne,canOfferGoogleStep:n?!1:Me,hasGoogleTool:ze,showIOSAppStep:_});function X(t){if(n){e(-1);return}ne(Ke({mode:p?`native`:k?`paredDown`:`control`,recipe:p?null:q,selectedTools:F,selectedTasks:ue,selectedPriorAssistants:t?.selectedPriorAssistants??I,tone:B??q?.tone??`grounded`,userName:R,assistantName:H,selfIntroGreetingEnabled:ee,activationFlowEnabled:p?void 0:y,googleConnected:ye,googleScopes:K,connectedScopes:t?.connectedScopes}));let r=H.trim();r&&j(r),p?(oe(),e(E.onboarding.privacy)):(b.markExpectingFirstMessage(),Ie())}let Z=(e,t)=>{e.funnelStep&&Le(e.funnelStep);let n=Qe(Y,e.id);n?N(n):X(t)},Q=e=>{let t=$e(Y,e.id);t&&N(t)};if(!re||Ae)return null;let $=Y.find(e=>e.id===ie)??Y[0];return $?$.id===`nativeName`?(0,G.jsx)(De,{userName:R,assistantName:H,displayedAssistantNames:V,onUserNameChange:z,onAssistantNameChange:U,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:nt}):$.id===`nativeVibe`?(0,G.jsx)(Be,{selectedGroupId:B,onGroupChange:me,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:nt}):$.id===`name`?(0,G.jsx)(Te,{userName:R,assistantName:H,selectedGroupId:B,displayedAssistantNames:V,onUserNameChange:z,onAssistantNameChange:U,onGroupChange:me,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,G.jsx)(Pe,{selectedTasks:ue,onChange:fe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,G.jsx)(Re,{selectedTools:F,onChange:le,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,G.jsx)(ke,{selectedAssistants:I,onChange:L,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;L(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?J?(0,G.jsx)(we,{assistantId:J,assistantName:H,onConnect:e=>{xe(!0),Ce(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,G.jsx)(Se,{onComplete:()=>Z($)}):null:null}function at(){return(0,G.jsx)(it,{})}export{at as PreChatRoute};
|
|
1
|
+
import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-D-AX8Voo.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as a}from"./QueryClientProvider-DKhXIxGb.js";import{t as o}from"./useQuery-B45lW1Kk.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./card-BibIM9x3.js";import{t as l}from"./input-D4W4p0pZ.js";import{c as u,f as d,o as f}from"./local-mode-CgrENuVf.js";import{t as p}from"./is-electron-C_ZTVhv8.js";import{n as m}from"./resolved-assistants-store-Dqf0LJrA.js";import{t as h}from"./check-D6WkI0gF.js";import{t as g}from"./chevron-left-DghyKSEE.js";import{t as _}from"./loader-circle-BFRVtR3K.js";import{t as v}from"./pencil-B90pDI55.js";import{t as y}from"./x-DxL-bCuT.js";import{A as b,C as ee,a as x,j as S,n as C,o as w}from"./auth-store-B1y6dgYQ.js";import{t as T}from"./client.gen-BHupOCJH.js";import{m as te}from"./native-biometric-BK6_QtW5.js";import{a as E}from"./routes-C6gxiCrz.js";import{r as D}from"./platform-detection-Ceodt3Hu.js";import{o as O,r as k}from"./prefs-Ds__U7Hi.js";import{t as A}from"./client-feature-flag-store-CHA6YxVq.js";import{c as j,l as ne,n as M,t as re}from"./prechat-RG0Q0UrS.js";import{b as ie,r as ae,yt as N}from"./react-query.gen-gQ1_8EHv.js";import{n as oe,t as se}from"./browser-DM38C5zq.js";import{t as P}from"./public-asset-C2P77n3W.js";import{$t as F,Ct as ce,J as le,Qt as ue,Tt as de,Zt as fe,_t as I,bt as pe,ca as L,d as R,en as z,l as B,nn as me,q as V,rn as H,u as he,vt as ge,wt as _e}from"./index-B-S-gNKm.js";import{n as U,r as ve}from"./prechat-names-NPlBAwCy.js";import{t as ye}from"./step-indicator-dots-Bc6X141I.js";var W=e(t(),1);async function be(){try{let{data:e,response:t}=await T.get({url:`/v1/onboarding/recipe/`,throwOnError:!1});if(!t?.ok||!e)return null;let n=e;return typeof n.cohort!=`string`||!Array.isArray(n.tasks)||typeof n.tone!=`string`||typeof n.bootstrap_template!=`string`||typeof n.initial_message!=`string`||!Array.isArray(n.skills)||typeof n.skip_prechat!=`boolean`?null:{cohort:n.cohort,tasks:n.tasks,tone:n.tone,bootstrapTemplate:n.bootstrap_template,initialMessage:n.initial_message,skills:n.skills,skipPrechat:n.skip_prechat}}catch{return null}}var G=s(),xe=[{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 Se({onComplete:e}){function t(){R(),B(),e()}return(0,G.jsx)(H,{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:xe.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)(h,{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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:`Download on the App Store`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:e,className:`h-11 text-base`,children:`Continue in browser`})]})]})})}var K=`google`,Ce=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)}];function we({assistantId:e,assistantName:t,onConnect:r,onSkip:i,onBack:o}){let s=p(),c=a(),l=te(),u=(0,W.useRef)(null),d=(0,W.useRef)(null),f=(0,W.useRef)(null),m=(0,W.useRef)(null),h=(0,W.useRef)(null),v=(0,W.useRef)(null),y=(0,W.useRef)(null),[b,x]=(0,W.useState)(!1),S=(0,W.useCallback)(()=>{d.current=null,x(!1)},[]),C=(0,W.useCallback)(()=>{h.current&&=(window.removeEventListener(`message`,h.current),null),v.current&&=(window.removeEventListener(`storage`,v.current),null)},[]),w=(0,W.useCallback)(()=>{u.current&&!u.current.closed&&u.current.close(),u.current=null,f.current&&=(clearInterval(f.current),null),m.current&&=(clearTimeout(m.current),null)},[]),T=N();(0,W.useEffect)(()=>()=>{f.current&&clearInterval(f.current),m.current&&clearTimeout(m.current),u.current&&!u.current.closed&&u.current.close(),h.current&&window.removeEventListener(`message`,h.current),v.current&&window.removeEventListener(`storage`,v.current),y.current&&=(y.current(),null)},[]);let D=(0,W.useCallback)(async e=>{try{return(await c.fetchQuery({...ie({path:{assistant_id:e}}),staleTime:0})).find(e=>e.provider===K&&e.connected)??null}catch{return null}},[c]),O=(0,W.useCallback)(async()=>{let e=d.current?.platformAssistantId;w(),S(),r((e?await D(e):null)?.scopes_granted??[])},[S,w,D,r]),k=(0,W.useCallback)(e=>{e.type===`vellum:oauth-complete`&&(!d.current||e.requestId!==d.current.requestId||(e.oauthStatus===`connected`?O():(w(),S())))},[S,w,O]),A=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=fe(e,window.location.origin,t.requestId);n&&k(n)},[k]),j=(0,W.useCallback)(e=>{let t=d.current;if(!t)return;let n=ue(e,t.requestId);n&&(k(n),window.localStorage.removeItem(z(t.requestId)))},[k]);me((0,W.useCallback)(e=>{let t=d.current;t&&e.requestId===t.requestId&&k({type:`vellum:oauth-complete`,requestId:e.requestId,oauthStatus:e.oauthStatus,oauthProvider:e.oauthProvider,oauthCode:e.oauthCode})},[k]));let ne=(0,W.useCallback)(()=>{let t=crypto.randomUUID();if(C(),h.current=A,v.current=j,l){x(!0),(async()=>{let n;try{n=await ee(e)}catch{S();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}&native=1`}},{onSuccess(e){se(e.connect_url)},onError(){S()}})})(),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),y.current&&y.current();let n=oe(()=>{let e=d.current;if(!e){n(),y.current=null;return}(async()=>{let t=await D(e.platformAssistantId);d.current&&(t?await O():S(),C(),n(),y.current=null)})()});y.current=n;return}let n=window.open(``,`_blank`,`width=500,height=600`);if(n===null){C();return}u.current=n,x(!0),window.addEventListener(`message`,A),window.addEventListener(`storage`,j),f.current=setInterval(()=>{u.current&&u.current.closed&&d.current&&!m.current&&(m.current=setTimeout(async()=>{m.current=null;let e=d.current;if(!e)return;let t=window.localStorage.getItem(z(e.requestId));if(t)try{let n=JSON.parse(t);if(F(n,e.requestId)){k(n),window.localStorage.removeItem(z(e.requestId)),C();return}}catch{}let n=await D(e.platformAssistantId);d.current&&(n?await O():(w(),S()),C())},1e3))},100),(async()=>{let n;try{n=await ee(e)}catch{w(),S(),C();return}d.current={requestId:t,platformAssistantId:n},T.mutate({path:{assistant_id:n,provider:K},body:{requested_scopes:[],redirect_after_connect:`${E.account.oauth.popupComplete}?requestId=${t}`}},{onSuccess(e){u.current&&!u.current.closed?u.current.location.href=e.connect_url:d.current&&(w(),S(),C())},onError(){w(),S(),C()}})})()},[e,S,w,D,k,A,j,O,l,C,T]),M=t||`your assistant`,re=t||`Your assistant`;return(0,G.jsx)(H,{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:o,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,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, ${M} 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:Ce.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:`${re} 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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:ne,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:b||T.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)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:i,disabled:b||T.isPending,className:`${s?`h-9`:`h-11 text-base`}`,children:`Skip for now`})]})]})})}function Te({userName:e,assistantName:t,selectedGroupId:r,displayedAssistantNames:i,onUserNameChange:a,onAssistantNameChange:o,onGroupChange:s,onBack:c,onComplete:u,onSkip:d}){let f=p();return(0,G.jsx)(H,{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 ${c?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[c?(0,G.jsx)(`button`,{type:`button`,onClick:c,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,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.`}),c?(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)(l,{label:`Your name`,placeholder:`Your name`,value:e,onChange:e=>a(e.target.value),fullWidth:!0}),(0,G.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,G.jsx)(l,{label:`What should I go by?`,placeholder:`Assistant name`,value:t,onChange:e=>o(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:i.map(e=>{let n=e===t;return(0,G.jsx)(`button`,{type:`button`,onClick:()=>o(e),"aria-pressed":n,className:`cursor-pointer rounded-full border px-3 py-1 text-label-small-default transition-colors ${n?`border-[var(--primary-base)] bg-[var(--primary-base)] text-[var(--content-inset)]`:`border-[var(--border-element)] bg-[var(--surface-lift)] text-[var(--content-secondary)] hover:bg-[var(--surface-base)]`}`,children:e},e)})})]}),(0,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:U.map(e=>(0,G.jsx)(Ee,{group:e,isActive:r===e.id,onToggle:()=>s(r===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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:u,className:`${f?`h-9`:`h-11 text-base`}`,children:`Let's go`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:d,className:`${f?`h-9`:`h-11 text-base`}`,children:`Skip`})]})]})})}function Ee({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 De({userName:e,assistantName:t,displayedAssistantNames:r,onUserNameChange:i,onAssistantNameChange:a,onBack:o,onContinue:s,onSkip:c,currentStep:u,totalSteps:d}){return(0,G.jsx)(H,{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:[o?(0,G.jsx)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:o,"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)(ye,{current:u,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)(l,{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)(l,{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 w-full flex-col gap-2 pb-4`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:s,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:c,className:`h-11 text-base`,children:`Skip`})]})]})})}var Oe=[{id:`chatgpt`,label:`ChatGPT`,logoSrc:P(`/images/prior-assistants/chatgpt.svg`)},{id:`claude`,label:`Claude`,logoSrc:P(`/images/prior-assistants/claude.svg`)},{id:`openclaw`,label:`OpenClaw`,logoSrc:P(`/images/prior-assistants/openclaw.png`)},{id:`hermes`,label:`Hermes`,logoSrc:P(`/images/prior-assistants/hermes.png`)},{id:`manus`,label:`Manus`,logoSrc:P(`/images/prior-assistants/manus.svg`)},{id:`gemini`,label:`Gemini`,logoSrc:P(`/images/prior-assistants/gemini.svg`)},{id:`copilot`,label:`Copilot`,logoSrc:P(`/images/prior-assistants/copilot.svg`)}];function ke({selectedAssistants:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>q(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(J(e));(0,W.useEffect)(()=>{let t=J(e);if(t===m.current)return;let n=q(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}Ae(n,e)||(m.current=J(n),t(n))},[s]);let h=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 s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(H,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,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:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`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:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`If you've built anything with another assistant, I can help you bring it over.`}),(0,G.jsxs)(`div`,{className:`${o?`mt-4`:`mt-8`} grid w-full grid-cols-2 gap-2 sm:grid-cols-3 md:grid-cols-4`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Oe.map(t=>(0,G.jsx)(je,{assistant:t,selected:e.has(t.id),onToggle:()=>h(t.id)},t.id)),d?null:(0,G.jsx)(Me,{onClick:()=>f(!0)})]}),d?(0,G.jsx)(c,{padding:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,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),u(``)},"aria-label":`Dismiss custom assistants`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other assistants`,placeholder:`e.g. Perplexity, Poe, Character.AI...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple assistants with commas`,fullWidth:!0}),_.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:`${o?`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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I haven't used any`})]})]})})}function Ae(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function q(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function J(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function je({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)(Ne,{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)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Me({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)(L,{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 Ne({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 Pe({selectedTasks:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),s=n=>{let r=new Set(e);r.has(n)?r.delete(n):r.add(n),t(r)};return(0,G.jsx)(H,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,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:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}),(0,G.jsx)(`h1`,{className:`text-center ${o?`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:`${o?`mt-2`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`Pick the one or two you do most — you can select more if it really is all of it.`}),(0,G.jsx)(`div`,{className:`${o?`mt-6`:`mt-8`} flex w-full flex-col ${o?`gap-1`:`gap-2`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:V.map(t=>{let n=le[t.iconKey],r=e.has(t.id);return(0,G.jsxs)(`button`,{type:`button`,onClick:()=>s(t.id),"aria-pressed":r,className:`group flex w-full cursor-pointer items-center ${o?`gap-2 p-3`:`gap-3 px-4 py-3`} rounded-lg border text-left transition-colors ${r?`border-[var(--primary-base)] bg-[var(--primary-base)]/10`:`border-[var(--border-element)] bg-[var(--surface-lift)] hover:bg-[var(--surface-base)]`}`,children:[(0,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)(h,{className:`h-3 w-3 text-[var(--content-inset)]`}):null})]},t.id)})}),(0,G.jsxs)(`div`,{className:`${o?`mt-auto`:`mt-8`} flex w-full flex-col gap-2`,style:{animation:`fadeInUp 0.3s ease-out 0.3s both`},children:[(0,G.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}var Fe=new Set([`gmail`,`google-calendar`,`google-drive`]),Ie=[{id:`gmail`,label:`Gmail`,logoSrc:P(`/images/integrations/gmail.svg`)},{id:`outlook`,label:`Outlook`,logoSrc:P(`/images/integrations/outlook.png`)},{id:`google-calendar`,label:`Google Calendar`,logoSrc:P(`/images/integrations/google-calendar.svg`)},{id:`slack`,label:`Slack`,logoSrc:P(`/images/integrations/slack.svg`)},{id:`notion`,label:`Notion`,logoSrc:P(`/images/integrations/notion.svg`)},{id:`linear`,label:`Linear`,logoSrc:P(`/images/integrations/linear-light-logo.svg`)},{id:`jira`,label:`Jira`,logoSrc:P(`/images/integrations/jira.svg`)},{id:`github`,label:`GitHub`,logoSrc:P(`/images/integrations/github.svg`),logoSrcDark:P(`/images/integrations/github-dark.svg`)},{id:`figma`,label:`Figma`,logoSrc:P(`/images/integrations/figma.svg`)},{id:`google-drive`,label:`Google Drive`,logoSrc:P(`/images/integrations/google-drive.svg`)},{id:`excel`,label:`Excel`,logoSrc:P(`/images/integrations/excel.svg`)},{id:`apple-notes`,label:`Apple Notes`,logoSrc:P(`/images/integrations/apple-notes.svg`)}];function Le(e){let t=e.map(e=>e.startsWith(`other:`)?e.slice(6):e);return Array.from(new Set(t)).sort()}function Re({selectedTools:e,onChange:t,onBack:r,onContinue:i,onSkip:a}){let o=p(),[s,u]=(0,W.useState)(()=>Y(e)),[d,f]=(0,W.useState)(()=>s.length>0),m=(0,W.useRef)(X(e));(0,W.useEffect)(()=>{let t=X(e);if(t===m.current)return;let n=Y(e);u(n),f(e=>e||n.length>0),m.current=t},[e]),(0,W.useEffect)(()=>{let n=new Set([...e].filter(e=>!e.startsWith(`other:`))),r=new Set;for(let e of s.split(`,`)){let t=e.trim();t&&(r.has(t)||(r.add(t),n.add(`other:${t}`)))}ze(n,e)||(m.current=X(n),t(n))},[s]);let h=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 s.split(`,`).map(e=>e.trim()).filter(t=>!t||e.has(t)?!1:(e.add(t),!0))},[s]),b=e.size===0?`Continue`:`Continue · ${e.size} selected`;return(0,G.jsx)(H,{showCreatureFooter:!1,children:(0,G.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col items-center ${o?`min-h-full px-8 pt-11 pb-8 electron-prechat-type`:`px-6 pt-12 pb-40`} text-[var(--content-default)]`,children:[(0,G.jsxs)(`div`,{className:`grid w-full items-center ${r?`grid-cols-[auto_1fr_auto]`:``}`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:[r?(0,G.jsx)(`button`,{type:`button`,onClick:r,"aria-label":`Back`,className:`flex h-8 w-8 cursor-pointer items-center justify-center rounded-md text-[var(--content-secondary)] transition-colors hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(g,{className:`h-4 w-4`})}):null,(0,G.jsx)(`h1`,{className:`text-center ${o?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,children:`What do you use?`}),r?(0,G.jsx)(`div`,{"aria-hidden":`true`,className:`h-8 w-8`}):null]}),(0,G.jsx)(`p`,{className:`${o?`mt-3`:`mt-4`} text-center text-body-medium-lighter text-[var(--content-${o?`secondary`:`tertiary`})]`,style:{animation:`fadeInUp 0.3s ease-out 0.15s both`},children:`This helps me tailor how I assist you. No connections needed — you can set those up later.`}),(0,G.jsxs)(`div`,{className:`grid w-full gap-2 ${o?`mt-4 grid-cols-4`:`mt-8 grid-cols-2 sm:grid-cols-3 md:grid-cols-4`}`,style:{animation:`fadeInUp 0.3s ease-out 0.2s both`},children:[Ie.map(t=>(0,G.jsx)(Z,{tool:t,selected:e.has(t.id),onToggle:()=>h(t.id),electron:o},t.id)),d?null:(0,G.jsx)(Q,{onClick:()=>f(!0),electron:o})]}),d?(0,G.jsx)(c,{padding:o?`sm`:`md`,className:`mt-3 w-full border-[var(--primary-base)] bg-[color-mix(in_srgb,var(--primary-base)_8%,transparent)]`,children:(0,G.jsxs)(`div`,{className:`flex flex-col ${o?`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),u(``)},"aria-label":`Dismiss custom tools`,className:`ml-auto inline-flex h-6 w-6 cursor-pointer items-center justify-center rounded-md text-[var(--content-tertiary)] hover:bg-[var(--surface-base)]`,children:(0,G.jsx)(y,{className:`h-3 w-3`,"aria-hidden":`true`})})]}),(0,G.jsx)(l,{"aria-label":`Other tools`,placeholder:`e.g. Trello, Basecamp, Asana...`,value:s,onChange:e=>u(e.target.value),helperText:`Separate multiple tools with commas`,fullWidth:!0}),_.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:`${o?`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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:e.size===0,onClick:i,className:`${o?`h-9`:`h-11 text-base`}`,children:b}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`${o?`h-9`:`h-11 text-base`}`,children:`I'll set this up later`})]})]})})}function ze(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Y(e){return[...e].filter(e=>e.startsWith(`other:`)).map(e=>e.slice(6)).sort().join(`, `)}function X(e){return[...e].filter(e=>e.startsWith(`other:`)).sort().join(`|`)}function Z({tool:e,selected:t,onToggle:n,electron:r}){return(0,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)($,{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)(h,{className:`h-2.5 w-2.5 text-[var(--content-inset)]`,"aria-hidden":`true`})}):null]})}function Q({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)(L,{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 $({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 Be({selectedGroupId:e,onGroupChange:t,onBack:r,onContinue:i,onSkip:a,currentStep:o,totalSteps:s}){return(0,G.jsx)(H,{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)(n,{variant:`ghost`,size:`compact`,iconOnly:(0,G.jsx)(g,{}),onClick:r,"aria-label":`Back`}),(0,G.jsx)(`div`,{className:`flex justify-center`,children:(0,G.jsx)(ye,{current:o,total:s})}),(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:U.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)(n,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:i,className:`h-11 text-base`,children:`Continue`}),(0,G.jsx)(n,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:a,className:`h-11 text-base`,children:`Skip`})]})]})})}function Ve(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 He=[`gmail`,`google-calendar`,`google-drive`],Ue=`experiment-activation-flow-2026-06-03`,We=`BOOTSTRAP-ACTIVATION-RAIL.md`;function Ge(e,t,n){return t?.initialMessage?t.initialMessage:n?M(e):re}function Ke(e){let{mode:t,recipe:n}=e,r=e.connectedScopes!==void 0,i;i=t===`native`?{tools:[],tasks:[],tone:e.tone,googleConnected:!1}:t===`paredDown`?{tools:r?[...He]:[],tasks:n?.tasks??[],tone:e.tone,googleConnected:r}:{tools:Le([...e.selectedTools]),tasks:[...e.selectedTasks].sort(),tone:e.tone},n&&(i.cohort=n.cohort,i.bootstrapTemplate=n.bootstrapTemplate,i.skills=n.skills),e.activationFlowEnabled&&(i.cohort=Ue,i.bootstrapTemplate=We);let a=e.userName.trim();a&&(i.userName=a);let o=e.occupation?.trim();o&&(i.occupation=o);let s=e.assistantName.trim();return s&&(i.assistantName=s),t===`paredDown`?r&&(i.googleScopes=e.connectedScopes):t===`control`&&(r?(i.googleConnected=!0,i.googleScopes=e.connectedScopes):e.googleConnected?(i.googleConnected=!0,i.googleScopes=e.googleScopes):i.googleConnected=!1),t===`control`&&e.selectedPriorAssistants.size>0&&(i.priorAssistants=Le([...e.selectedPriorAssistants])),i.initialMessage=Ge(i,e.activationFlowEnabled?null:n,e.selfIntroGreetingEnabled),i}function qe(e){return!e.localMode||e.platformSession===`present`?!0:e.platformSession===`unknown`&&e.hasCachedPlatformAssistant}function Je(e){let{paredDown:t}=e;return[{id:`name`,funnelStep:I.nameVibe,enabled:!0},{id:`taskTone`,funnelStep:I.controlWorkType,enabled:!t},{id:`tools`,funnelStep:I.controlTools,enabled:!t},{id:`priorAssistants`,funnelStep:I.controlPriorAssistants,enabled:!t&&e.canOfferPriorAssistants},{id:`google`,funnelStep:t?I.gmailConnect:I.controlGmailConnect,enabled:e.canOfferGoogleStep&&(t||e.hasGoogleTool)},{id:`iosApp`,funnelStep:I.controlGetApp,enabled:!t&&e.showIOSAppStep}].filter(e=>e.enabled).map(({enabled:e,...t})=>t)}function Ye(){return[{id:`nativeName`,funnelStep:null},{id:`nativeVibe`,funnelStep:null}]}var Xe=`1`;function Ze(e){return e===`nativeVibe`||e===Xe?`nativeVibe`:null}function Qe(e,t){let n=e.findIndex(e=>e.id===t);return n<0?null:e[n+1]?.id??null}function $e(e,t){let n=e.findIndex(e=>e.id===t);return n<=0?null:e[n-1]?.id??null}function et(){let e=r(),t=te(),n=O()&&k();return(0,W.useEffect)(()=>{!n&&!t&&e(E.onboarding.privacy,{replace:!0})},[n,t,e]),t||n}function tt(e,t){let n=e?`prechat_native_screen:${e}`:null,[r,i]=(0,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=Ze(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 nt=3;function rt(){let e=u();return e?.cloud===`vellum`?e.assistantId:f()[0]?.assistantId??null}function it(){let e=r(),[t]=i(),n=t.get(`preview`)===`true`,a=C.use.user(),s=x(),c=w(),l=a?.id??null,u=a?.firstName??``,f=a?.lastName??``,p=te(),h=m.use.activeAssistantId(),g=d(),_=D()&&!he(),v=A.use.stringFlags().preChatOnboardingExperiment20260606??`control`,y=(A.use.stringFlags().experimentActivationFlow20260603??`control`)===`variant-a`,ee=A.use.selfIntroGreeting(),T=ce(v),O=_e()??T,k=O===ge.paredDown,M=g?rt():null,re=et(),{currentStep:ie,setCurrentStep:N,clearPersistedStep:oe}=tt(l,p),se=C.use.platformSession(),P=S(se),[F,le]=(0,W.useState)(()=>new Set),[ue,fe]=(0,W.useState)(()=>new Set),[I,L]=(0,W.useState)(()=>new Set),{value:R,onChange:z}=Ve(g&&!P?``:u||f),[B,me]=(0,W.useState)(null),[V]=(0,W.useState)(()=>ve()),[H,U]=(0,W.useState)(``),[ye,xe]=(0,W.useState)(!1),[K,Ce]=(0,W.useState)([]),{data:Ee}=o({...ae(),enabled:!c&&s&&(!g||P)}),{data:Oe,isLoading:Ae}=o({queryKey:[`onboarding-recipe`,l],queryFn:be,enabled:!c&&s&&!p&&!g,staleTime:1/0}),q=Oe??null,J=Ee?.id??h??M,je=qe({localMode:g,platformSession:se,hasCachedPlatformAssistant:M!==null}),Me=je,Ne=je,Ie=async()=>{await b.checkAssistant(),e(`${E.assistant}?onboarding=1`,{replace:!0})};function Le(e,t=O){n||pe(e,{userId:l,variant:de(t)})}let ze=[...F].some(e=>Fe.has(e)),Y=p?Ye():Je({paredDown:k,canOfferPriorAssistants:Ne,canOfferGoogleStep:n?!1:Me,hasGoogleTool:ze,showIOSAppStep:_});function X(t){if(n){e(-1);return}ne(Ke({mode:p?`native`:k?`paredDown`:`control`,recipe:p?null:q,selectedTools:F,selectedTasks:ue,selectedPriorAssistants:t?.selectedPriorAssistants??I,tone:B??q?.tone??`grounded`,userName:R,assistantName:H,selfIntroGreetingEnabled:ee,activationFlowEnabled:p?void 0:y,googleConnected:ye,googleScopes:K,connectedScopes:t?.connectedScopes}));let r=H.trim();r&&j(r),p?(oe(),e(E.onboarding.privacy)):(b.markExpectingFirstMessage(),Ie())}let Z=(e,t)=>{e.funnelStep&&Le(e.funnelStep);let n=Qe(Y,e.id);n?N(n):X(t)},Q=e=>{let t=$e(Y,e.id);t&&N(t)};if(!re||Ae)return null;let $=Y.find(e=>e.id===ie)??Y[0];return $?$.id===`nativeName`?(0,G.jsx)(De,{userName:R,assistantName:H,displayedAssistantNames:V,onUserNameChange:z,onAssistantNameChange:U,onContinue:()=>Z($),onSkip:()=>Z($),currentStep:0,totalSteps:nt}):$.id===`nativeVibe`?(0,G.jsx)(Be,{selectedGroupId:B,onGroupChange:me,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($),currentStep:1,totalSteps:nt}):$.id===`name`?(0,G.jsx)(Te,{userName:R,assistantName:H,selectedGroupId:B,displayedAssistantNames:V,onUserNameChange:z,onAssistantNameChange:U,onGroupChange:me,onComplete:()=>Z($),onSkip:()=>Z($)}):$.id===`taskTone`?(0,G.jsx)(Pe,{selectedTasks:ue,onChange:fe,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`tools`?(0,G.jsx)(Re,{selectedTools:F,onChange:le,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>Z($)}):$.id===`priorAssistants`?(0,G.jsx)(ke,{selectedAssistants:I,onChange:L,onBack:()=>Q($),onContinue:()=>Z($),onSkip:()=>{let e=new Set;L(e),Z($,{selectedPriorAssistants:e})}}):$.id===`google`?J?(0,G.jsx)(we,{assistantId:J,assistantName:H,onConnect:e=>{xe(!0),Ce(e),Z($,{connectedScopes:e})},onSkip:()=>Z($),onBack:()=>Q($)}):null:$.id===`iosApp`?(0,G.jsx)(Se,{onComplete:()=>Z($)}):null:null}function at(){return(0,G.jsx)(it,{})}export{at as PreChatRoute};
|