@vellumai/web 0.10.10-staging.1 → 0.10.10-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.
Files changed (99) hide show
  1. package/dist/assets/{account-page-B8Z6QZKe.js → account-page-B27dNQ3d.js} +1 -1
  2. package/dist/assets/{acp-run-detail-panel-DvbBzgps.js → acp-run-detail-panel-B0k2rYpM.js} +4 -4
  3. package/dist/assets/{activity-steps-panel-Cc6sOJ7O.js → activity-steps-panel-LDydO3OK.js} +1 -1
  4. package/dist/assets/ai-page-UMlli-yL.js +1 -0
  5. package/dist/assets/{api-key-screen-D7u7SPiq.js → api-key-screen-BYdMayOl.js} +1 -1
  6. package/dist/assets/{background-task-detail-panel-BNb7N4q2.js → background-task-detail-panel-wG11sk-D.js} +1 -1
  7. package/dist/assets/{billing-page-QcfuHjR9.js → billing-page-BHg4_D8p.js} +2 -2
  8. package/dist/assets/{bookmarks-page-CRZqWo3d.js → bookmarks-page-Dj_WhT38.js} +1 -1
  9. package/dist/assets/{channels-page-route-C_YBqGsE.js → channels-page-route-BLMC84yp.js} +2 -2
  10. package/dist/assets/{command-palette-y6-mfSgF.js → command-palette-nEbCvF9B.js} +1 -1
  11. package/dist/assets/{command-palette-window-page-DUPyaVxH.js → command-palette-window-page-Um5WOMD9.js} +1 -1
  12. package/dist/assets/community-page-BpLDD6Gw.js +1 -0
  13. package/dist/assets/contacts-page-route-Na5xsrCM.js +1 -0
  14. package/dist/assets/{credentials-page-CvW82Tlz.js → credentials-page-DiPIjJOv.js} +1 -1
  15. package/dist/assets/{debug-page-CmPi5tnZ.js → debug-page-Op9gPo8_.js} +2 -2
  16. package/dist/assets/{deploy-dialogs-DaPjl9bW.js → deploy-dialogs-BNZpdpkW.js} +1 -1
  17. package/dist/assets/{detail-panel-stop-button-DpEnEgJn.js → detail-panel-stop-button-QQ20Gb80.js} +1 -1
  18. package/dist/assets/{developer-page-CV-CsA3N.js → developer-page-CEm6gJ5c.js} +1 -1
  19. package/dist/assets/{dictation-overlay-page-g9BvDir_.js → dictation-overlay-page-DFy73eLq.js} +1 -1
  20. package/dist/assets/{document-viewer-page-C5v8akIG.js → document-viewer-page-BB8CFKzx.js} +1 -1
  21. package/dist/assets/{emails-page-CtFCYDq9.js → emails-page-DfS8M0KH.js} +1 -1
  22. package/dist/assets/general-page-DRyIIgkk.js +1 -0
  23. package/dist/assets/{hatching-screen-HNiZriOH.js → hatching-screen-D0zBF6G3.js} +1 -1
  24. package/dist/assets/home-page-route-BMbIyFRk.js +1 -0
  25. package/dist/assets/{hosting-screen-CkRQ1ibr.js → hosting-screen-Zb6-T1r9.js} +1 -1
  26. package/dist/assets/identity-page-route-BmQtmPF0.js +7 -0
  27. package/dist/assets/{index-CZVGv7Cn.js → index-CgcZXB4g.js} +28 -28
  28. package/dist/assets/index-yF00bLYk.css +2 -0
  29. package/dist/assets/{inspect-page-JQwJQ_Sl.js → inspect-page-Iemfgo7r.js} +2 -2
  30. package/dist/assets/{integrations-page-FCrRTt2X.js → integrations-page-8U6yrpy_.js} +1 -1
  31. package/dist/assets/{intelligence-layout-AsbvHVqu.js → intelligence-layout-Bk61phvn.js} +1 -1
  32. package/dist/assets/latest-assistant-text-cGlQO-ow.js +24 -0
  33. package/dist/assets/{library-detail-page-Bcnsh9CI.js → library-detail-page-BCRw2pXt.js} +1 -1
  34. package/dist/assets/{library-page-DZduD_bA.js → library-page-BCFKyR7R.js} +1 -1
  35. package/dist/assets/{logout-page-Buv0U8Wq.js → logout-page-C27fK6LX.js} +1 -1
  36. package/dist/assets/{logs-layout-CaZNYn0T.js → logs-layout-DrBxBaoW.js} +1 -1
  37. package/dist/assets/memory-page-route-BdF70Wmp.js +1 -0
  38. package/dist/assets/{memory-router-playground-page-CGIGEOgT.js → memory-router-playground-page-BlT9oFs0.js} +1 -1
  39. package/dist/assets/{mobile-sidebar-drawer-kwgBD2Oe.js → mobile-sidebar-drawer-BmS9adnj.js} +1 -1
  40. package/dist/assets/{notifications-page-BhLbSbpe.js → notifications-page-DsQJaAsR.js} +1 -1
  41. package/dist/assets/{oauth-complete-page-Y9TaL3bP.js → oauth-complete-page-BMqOW3MA.js} +1 -1
  42. package/dist/assets/{oauth-popup-complete-page-D9YtNVV9.js → oauth-popup-complete-page-D-r0oM8y.js} +1 -1
  43. package/dist/assets/{pairing-page-CYBL5nXH.js → pairing-page-CELMlJeG.js} +1 -1
  44. package/dist/assets/personality-page-BdkuO-Fy.js +1 -0
  45. package/dist/assets/{plugins-page-DtB-KvF9.js → plugins-page-DblHkb06.js} +1 -1
  46. package/dist/assets/prechat-route-DcgCgSV8.js +1 -0
  47. package/dist/assets/privacy-page-Ccn6St6F.js +1 -0
  48. package/dist/assets/{privacy-screen-C4Y8Fzqr.js → privacy-screen-IqygR70e.js} +1 -1
  49. package/dist/assets/{provider-callback-page-DkUH2bax.js → provider-callback-page-fjZoTIWk.js} +1 -1
  50. package/dist/assets/{quick-input-page--AKggGR2.js → quick-input-page-BmPU9B6u.js} +1 -1
  51. package/dist/assets/{research-mock-page-DNVvgUNF.js → research-mock-page-CssYNgG7.js} +1 -1
  52. package/dist/assets/research-onboarding-route-sFu5EQW9.js +42 -0
  53. package/dist/assets/{review-terms-screen-3Mt29KCp.js → review-terms-screen-Cv_jkYHP.js} +1 -1
  54. package/dist/assets/schedules-page-DCFEdNCs.js +1 -0
  55. package/dist/assets/{select-assistant-screen-DKEkfrzB.js → select-assistant-screen-B0qoVKd5.js} +1 -1
  56. package/dist/assets/{settings-layout-D5GIvMSd.js → settings-layout-B_NU6GFk.js} +1 -1
  57. package/dist/assets/{share-feedback-modal-Bns-AdW9.js → share-feedback-modal-c0vGJBMA.js} +1 -1
  58. package/dist/assets/{sidebar-tree-DRAO8jjA.js → sidebar-tree-Cq8ACYzP.js} +1 -1
  59. package/dist/assets/{signup-page-_JnnV0FO.js → signup-page-CQLi5G7p.js} +1 -1
  60. package/dist/assets/{skill-detail-page-DiV9u6T7.js → skill-detail-page-C_-DI2tN.js} +1 -1
  61. package/dist/assets/{skill-detail-panel-Bevi3Lss.js → skill-detail-panel-J7W0DU8J.js} +1 -1
  62. package/dist/assets/skills-page-BhMnBhiu.js +1 -0
  63. package/dist/assets/{start-screen-DfMdkCZZ.js → start-screen-Cbh01xPj.js} +1 -1
  64. package/dist/assets/{subagent-detail-panel-B8XiU0Z-.js → subagent-detail-panel-D9BXd8vR.js} +2 -2
  65. package/dist/assets/{system-events-page-Bd7g4y5T.js → system-events-page-BWbjCZVh.js} +1 -1
  66. package/dist/assets/{theme-stage-page-B72tB13w.js → theme-stage-page-DUeQZVJ3.js} +1 -1
  67. package/dist/assets/{tiptap-document-editor-jTc6PPwp.js → tiptap-document-editor-yCVhNTRu.js} +1 -1
  68. package/dist/assets/{tool-detail-panel-DyCqe5Yq.js → tool-detail-panel-Dtl2QLOW.js} +1 -1
  69. package/dist/assets/{upgrade-cancel-page-CUl1Cass.js → upgrade-cancel-page-DmdDdCjG.js} +1 -1
  70. package/dist/assets/{upgrade-success-page-DKvgbJHK.js → upgrade-success-page-DQoC2Y_H.js} +1 -1
  71. package/dist/assets/use-assistant-identity-details-D-gTqmOL.js +1 -0
  72. package/dist/assets/{use-edge-swipe-back-CaTk2Wz5.js → use-edge-swipe-back-Dpo-0Weh.js} +1 -1
  73. package/dist/assets/{use-invite-link-dialog-B6r6wWD7.js → use-invite-link-dialog-DhVTs4OS.js} +1 -1
  74. package/dist/assets/{use-skill-actions-B443tGAI.js → use-skill-actions-fDejA0nc.js} +1 -1
  75. package/dist/assets/{use-skill-categories-DsLNc-NO.js → use-skill-categories-DCOdxAre.js} +1 -1
  76. package/dist/assets/{use-skill-detail-files-BjQHazRM.js → use-skill-detail-files-DS6fk9Xz.js} +1 -1
  77. package/dist/assets/{voice-page-BiO7sMlu.js → voice-page-BRscGXct.js} +1 -1
  78. package/dist/assets/{weather-forecast-display-CZLINMqN.js → weather-forecast-display-Dcw7Ta6D.js} +1 -1
  79. package/dist/assets/{welcome-screen-CkOAvi7q.js → welcome-screen-C35jMBVC.js} +1 -1
  80. package/dist/assets/{workflow-detail-panel-PevRtp_O.js → workflow-detail-panel-CYjQlhPc.js} +1 -1
  81. package/dist/assets/{workspace-page-D_ZIEJYY.js → workspace-page-Dh-OnRd7.js} +1 -1
  82. package/dist/index.html +3 -3
  83. package/package.json +1 -1
  84. package/dist/assets/ai-page-TYCxSdRA.js +0 -1
  85. package/dist/assets/community-page-JggT8MFi.js +0 -1
  86. package/dist/assets/contacts-page-route-q6JfNlkd.js +0 -1
  87. package/dist/assets/general-page-CBJ13Yzs.js +0 -1
  88. package/dist/assets/home-page-route-B5t1I9Kc.js +0 -1
  89. package/dist/assets/identity-page-route-BvdzgZ7m.js +0 -7
  90. package/dist/assets/index-BoLhUIgw.css +0 -2
  91. package/dist/assets/latest-assistant-text-BCjy0Q0O.js +0 -24
  92. package/dist/assets/memory-page-route-VwqOIgOs.js +0 -1
  93. package/dist/assets/personality-page-BuIF9LmP.js +0 -1
  94. package/dist/assets/prechat-route-Cn9TbGYd.js +0 -1
  95. package/dist/assets/privacy-page-wr_tX0w2.js +0 -1
  96. package/dist/assets/research-onboarding-route-CsLjEqSj.js +0 -42
  97. package/dist/assets/schedules-page-DWZ-lJ7j.js +0 -1
  98. package/dist/assets/skills-page-ano_t4YY.js +0 -1
  99. package/dist/assets/use-assistant-identity-details-CmAZ1Y2o.js +0 -1
@@ -0,0 +1,42 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{i as t}from"./local-settings-C-dW2vkq.js";import{t as n}from"./capture-error-BGD3-GQf.js";import{t as r}from"./react-DJZBPgpf.js";import{P as i,t as a}from"./button-BQVYX8n_.js";import{m as o,u as s}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as c}from"./QueryClientProvider-DKhXIxGb.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./arrow-left-C2re-gYj.js";import{t as d}from"./chevron-left-B_RAz34t.js";import{t as f}from"./chevron-right-jRymmL7S.js";import{n as p,t as m}from"./animated-avatar-CyIeKE-s.js";import{t as h}from"./loader-circle-D57RZgLH.js";import{t as g}from"./pencil-DEevs4oD.js";import{t as _}from"./plus-CQiIB1qS.js";import{t as v}from"./x-CswtfvgS.js";import{t as y}from"./tag-B6WeUtBW.js";import{t as b}from"./input-ZpyYt_a0.js";import{i as x,r as S,t as C}from"./dist-Cul7ysiV.js";import{n as w,t as T}from"./create-selectors-tFGOU7xo.js";import{b as E,ct as D,o as O,p as k}from"./local-mode-hyYI6_OH.js";import{Bn as A,V as j,Vn as M,_n as N,et as ee,gn as te,xr as ne}from"./sdk.gen-D_Qurj4O.js";import{r as re}from"./api-errors-CDe82ZvY.js";import{I as P,L as F,R as ie,k as ae,n as oe,z as se}from"./auth-store-B6EXnaee.js";import{a as ce,o as le,r as ue}from"./api-BBMl4mW3.js";import{c as de}from"./routes-XPLb07Av.js";import{n as I}from"./platform-detection-1awANa55.js";import{c as fe,l as pe}from"./prechat-P1y7ZM6C.js";import{t as me}from"./browser-timezone-2SnmKDjM.js";import{c as L}from"./conversation-list-fetchers-BOrVAREL.js";import{i as he,n as ge,r as _e,t as ve}from"./research-onboarding-persistence-BLNrBZSe.js";import{A as ye,B as be,C as xe,D as Se,E as Ce,F as we,I as Te,L as Ee,M as De,N as Oe,O as R,P as ke,R as z,S as B,T as Ae,V,a as je,d as Me,f as Ne,g as Pe,i as Fe,j as Ie,k as Le,m as Re,o as ze,p as Be,r as Ve,s as He,t as H,v as Ue,w as We,x as Ge,y as Ke}from"./proxy-BzlH_XAe.js";import{t as qe}from"./AnimatePresence-C8APSgIu.js";import{t as U}from"./use-reduced-motion-CcGT6CHV.js";import{An as Je,Dn as Ye,Er as Xe,Et as Ze,Fr as Qe,Ka as W,On as $e,Ot as et,Rn as tt,bn as nt,cn as rt,ea as it,ht as G,jn as at,mt as ot,vn as st,xn as ct,yn as lt}from"./index-CgcZXB4g.js";import{c as ut,i as dt,l as ft,n as pt,r as mt,s as ht,t as gt}from"./latest-assistant-text-cGlQO-ow.js";import{n as _t,t as vt}from"./onboarding-step-layout-2XcmxqFN.js";import{t as yt}from"./prechat-names-clVy5Mee.js";var bt=(e,t,n)=>{let r=t-e;return((n-e)%r+r)%r+e};function xt(e,t){return De(e)?e[bt(0,e.length,t)]:e}var St=class{constructor(e){this.stop=()=>this.runAll(`stop`),this.animations=e.filter(Boolean)}get finished(){return Promise.all(this.animations.map(e=>e.finished))}getAll(e){return this.animations[0][e]}setAll(e,t){for(let n=0;n<this.animations.length;n++)this.animations[n][e]=t}attachTimeline(e){let t=this.animations.map(t=>t.attachTimeline(e));return()=>{t.forEach((e,t)=>{e&&e(),this.animations[t].stop()})}}get time(){return this.getAll(`time`)}set time(e){this.setAll(`time`,e)}get speed(){return this.getAll(`speed`)}set speed(e){this.setAll(`speed`,e)}get state(){return this.getAll(`state`)}get startTime(){return this.getAll(`startTime`)}get duration(){return Ct(this.animations,`duration`)}get iterationDuration(){return Ct(this.animations,`iterationDuration`)}runAll(e){this.animations.forEach(t=>t[e]())}play(){this.runAll(`play`)}pause(){this.runAll(`pause`)}cancel(){this.runAll(`cancel`)}complete(){this.runAll(`complete`)}};function Ct(e,t){let n=0;for(let r=0;r<e.length;r++){let i=e[r][t];i!==null&&i>n&&(n=i)}return n}var wt=class extends St{then(e,t){return this.finished.finally(e).then(()=>{})}};function Tt(...e){let t=!Array.isArray(e[0]),n=t?0:-1,r=e[0+n],i=e[1+n],a=e[2+n],o=e[3+n],s=Ce(i,a,o);return t?s(r):s}function Et(e,t){return e in t}var Dt=class extends He{constructor(){super(...arguments),this.type=`object`}readValueFromInstance(e,t){if(Et(t,e)){let n=e[t];if(typeof n==`string`||typeof n==`number`)return n}}getBaseTargetFromProps(){}removeValueFromRenderState(e,t){delete t.output[e]}measureInstanceViewportBox(){return Ne()}build(e,t){Object.assign(e.output,t)}renderInstance(e,{output:t}){Object.assign(e,t)}sortInstanceNodePosition(){return 0}},K=e(r(),1);function Ot(e){let t=V(()=>B(e)),{isStatic:n}=(0,K.useContext)(Ve);if(n){let[,n]=(0,K.useState)(e);(0,K.useEffect)(()=>t.on(`change`,n),[])}return t}function kt(e,t){let n=Ot(t()),r=()=>n.set(t());return r(),be(()=>{let t=()=>Ie.preRender(r,!1,!0),n=e.map(e=>e.on(`change`,t));return()=>{n.forEach(e=>e()),ye(r)}}),n}function At(e){Ge.current=[],e();let t=kt(Ge.current,e);return Ge.current=void 0,t}function jt(e,t,n,r){if(typeof e==`function`)return At(e);if(n!==void 0&&!Array.isArray(n)&&typeof t!=`function`)return Nt(e,t,n,r);let i=typeof t==`function`?t:Tt(t,n,r),a=Array.isArray(e)?Mt(e,i):Mt([e],([e])=>i(e)),o=Array.isArray(e)?void 0:e.accelerate;return o&&!o.isTransformed&&typeof t!=`function`&&Array.isArray(n)&&r?.clamp!==!1&&(a.accelerate={...o,times:t,keyframes:n,isTransformed:!0,...r?.ease?{ease:r.ease}:{}}),a}function Mt(e,t){let n=V(()=>[]);return kt(e,()=>{n.length=0;let r=e.length;for(let t=0;t<r;t++)n[t]=e[t].get();return t(n)})}function Nt(e,t,n,r){let i=V(()=>Object.keys(n)),a=V(()=>({}));for(let o of i)a[o]=jt(e,t,n[o],r);return a}function Pt(e){return typeof e==`object`&&!Array.isArray(e)}function Ft(e,t,n,r){return e==null?[]:typeof e==`string`&&Pt(t)?Pe(e,n,r):e instanceof NodeList?Array.from(e):Array.isArray(e)?e.filter(e=>e!=null):[e]}function It(e,t,n){return e*(t+1)+n*t}function Lt(e,t,n,r){return typeof t==`number`?t:t.startsWith(`-`)||t.startsWith(`+`)?Math.max(0,e+parseFloat(t)):t===`<`?n:t.startsWith(`<`)?Math.max(0,n+parseFloat(t.slice(1))):r.get(t)??e}function Rt(e,t,n){for(let r=0;r<e.length;r++){let i=e[r];i.at>t&&i.at<n&&(z(e,i),r--)}}function zt(e,t,n,r,i,a){Rt(e,i,a);for(let o=0;o<t.length;o++)e.push({value:t[o],at:Le(i,a,r[o]),easing:xt(n,o)})}function Bt(e,t,n=0){let r=t+1+t*n;for(let t=0;t<e.length;t++)e[t]=e[t]/r}function Vt(e,t){return e.at===t.at?e.value===null?1:t.value===null?-1:0:e.at-t.at}var Ht=`easeInOut`,Ut=20;function Wt(e,{defaultTransition:t={},...n}={},r,i){let a=t.duration||.3,o=new Map,s=new Map,c={},l=new Map,u=0,d=0,f=0;for(let n=0;n<e.length;n++){let o=e[n];if(typeof o==`string`){l.set(o,d);continue}else if(!Array.isArray(o)){l.set(o.name,Lt(d,o.at,u,l));continue}let[p,m,h={}]=o;h.at!==void 0&&(d=Lt(d,h.at,u,l));let g=0,_=(e,n,r,o=0,s=0)=>{let c=qt(e),{delay:l=0,times:u=We(c),type:p=t.type||`keyframes`,repeat:m,repeatType:h,repeatDelay:_=0,...v}=n,{ease:y=t.ease||`easeOut`,duration:b}=n,x=typeof l==`function`?l(o,s):l,S=c.length,C=xe(p)?p:i?.[p||`keyframes`];if(S<=2&&C){let e=100;if(S===2&&Xt(c)){let t=c[1]-c[0];e=Math.abs(t)}let n={...t,...v};b!==void 0&&(n.duration=ke(b));let r=R(n,e,C);y=r.ease,b=r.duration}b??=a;let w=d+x;u.length===1&&u[0]===0&&(u[1]=1);let T=u.length-c.length;if(T>0&&Ae(u,T),c.length===1&&c.unshift(null),m&&Ee(m<Ut,`Sequence segments can't repeat ${m} times — ignoring repeat option. Use a value below ${Ut} or apply repeat at the sequence level instead.`),m&&m<Ut){let e=b>0?_/b:0;b=It(b,m,_);let t=[...c],n=[...u];y=Array.isArray(y)?[...y]:[y];let r=[...y],i=h===`reverse`||h===`mirror`,a=t,o=r;i&&(a=[...t].reverse(),h===`reverse`&&(o=[...r].reverse().map(e=>typeof e==`function`?Oe(e):e)));for(let s=0;s<m;s++){let l=i&&s%2==0,d=l?a:t,f=l?o:r,p=(s+1)*(1+e);e>0&&(c.push(c[c.length-1]),u.push(p),y.push(`linear`)),c.push(...d);for(let e=0;e<d.length;e++)u.push(n[e]+p),y.push(e===0?`linear`:xt(f,e-1))}Bt(u,m,e)}let E=w+b;zt(r,c,y,u,w,E),g=Math.max(x+b,g),f=Math.max(E,f)};if(Ke(p)){let e=Gt(p,s);_(m,h,Kt(`default`,e))}else{let e=Ft(p,m,r,c),t=e.length;for(let n=0;n<t;n++){m=m,h=h;let r=e[n],i=Gt(r,s);for(let e in m)_(m[e],Jt(h,e),Kt(e,i),n,t)}}u=d,d+=g}return s.forEach((e,r)=>{for(let i in e){let a=e[i];a.sort(Vt);let s=[],c=[],l=[];for(let e=0;e<a.length;e++){let{at:t,value:n,easing:r}=a[e];s.push(n),c.push(we(0,f,t)),l.push(r||`easeOut`)}c[0]!==0&&(c.unshift(0),s.unshift(s[0]),l.unshift(Ht)),c[c.length-1]!==1&&(c.push(1),s.push(null)),o.has(r)||o.set(r,{keyframes:{},transition:{}});let u=o.get(r);u.keyframes[i]=s;let{type:d,...p}=t;u.transition[i]={...p,duration:f,ease:l,times:c,...n}}}),o}function Gt(e,t){return!t.has(e)&&t.set(e,{}),t.get(e)}function Kt(e,t){return t[e]||(t[e]=[]),t[e]}function qt(e){return Array.isArray(e)?e:[e]}function Jt(e,t){return e&&e[t]?{...e,...e[t]}:{...e}}var Yt=e=>typeof e==`number`,Xt=e=>e.every(Yt);function Zt(e){let t={presenceContext:null,props:{},visualState:{renderState:{transform:{},transformOrigin:{},style:{},vars:{},attrs:{}},latestValues:{}}},n=Re(e)&&!Be(e)?new je(t):new ze(t);n.mount(e),Me.set(e,n)}function Qt(e){let t=new Dt({presenceContext:null,props:{},visualState:{renderState:{output:{}},latestValues:{}}});t.mount(e),Me.set(e,t)}function $t(e,t){return Ke(e)||typeof e==`number`||typeof e==`string`&&!Pt(t)}function en(e,t,n,r){let i=[];if($t(e,t))i.push(Fe(e,Pt(t)&&t.default||t,n&&(n.default||n)));else{if(e==null)return i;let a=Ft(e,t,r),o=a.length;Te(!!o,`No valid elements provided.`,`no-valid-elements`);for(let e=0;e<o;e++){let r=a[e],s=r instanceof Element?Zt:Qt;Me.has(r)||s(r);let c=Me.get(r),l={...n};`delay`in l&&typeof l.delay==`function`&&(l.delay=l.delay(e,o)),i.push(...Ue(c,{...t,transition:l},{}))}}return i}function tn(e,t,n){let r=[];return Wt(e.map(e=>{if(Array.isArray(e)&&typeof e[0]==`function`){let t=e[0],n=B(0);return n.on(`change`,t),e.length===1?[n,[0,1]]:e.length===2?[n,[0,1],e[1]]:[n,e[1],e[2]]}return e}),t,n,{spring:Se}).forEach(({keyframes:e,transition:t},n)=>{r.push(...en(n,e,t))}),r}function nn(e){return Array.isArray(e)&&e.some(Array.isArray)}function rn(e={}){let{scope:t,reduceMotion:n,skipAnimations:r}=e;function i(e,i,a){let o=[],s,c={};if(n!==void 0&&(c.reduceMotion=n),r!==void 0&&(c.skipAnimations=r),nn(e)){let{onComplete:n,...r}=i||{};typeof n==`function`&&(s=n),o=tn(e,{...c,...r},t)}else{let{onComplete:n,...r}=a||{};typeof n==`function`&&(s=n),o=en(e,i,{...c,...r},t)}let l=new wt(o);return s&&l.finished.then(s),t&&(t.animations.push(l),l.finished.then(()=>{z(t.animations,l)})),l}return i}var an=rn(),on=12;function sn(e,t){let n=e.slice(0,on).map(e=>`- ${e.name} — ${e.description}`).join(`
2
+ `);return n?`
3
+ Capabilities you can offer me — specialized skillsets you can invoke on my behalf, not generic chat:
4
+ ${n}
5
+
6
+ Add a "plugins" array as the FIRST key in your JSON object, ${t?`before "claims" and "suggestions"`:`before "claims"`}: the 1-2 capabilities from the list above (exact names) that best fit who I am — judged by what you researched about my real role, stack, and day-to-day work. (Emit it first so setup can start while you finish the rest.) These get set up for me automatically as part of getting started, so pick by overall fit to ME, not to any single suggestion. Prefer fewer over forcing a match; use [] if nothing clearly fits. Example: "plugins": ["<exact name from the list above>"]. ${t?`Don't reference the setup in the claims or suggestions text.`:`Don't reference the setup in the claims text.`}
7
+ `:``}function cn({firstName:e,lastName:t,occupation:n,hobbies:r,timezone:i},a=[],{includeSuggestions:o=!0}={}){let s=[e.trim(),t.trim()].filter(Boolean).join(` `),c=n.trim(),l=(r??[]).map(e=>e.trim()).filter(Boolean).join(`, `),u=i?.trim()??``,d=sn(a,o),f=d?`"plugins": ["<exact name from the list above>"], `:``,p=[s?`My name is ${s}.`:``,c?`I work as ${c}.`:``,l?`My hobby is ${l}.`:``].filter(Boolean).join(` `),m=p?[p,u?`My timezone is ${u}.`:``].filter(Boolean).join(` `):`I'd like you to get to know me before we start working together.`,h=o?` "suggestions": [ { "suggestion": "I'll find the 3 newest arXiv eval papers worth your time", "prompt": "Find me the 3 newest arXiv eval papers worth reading." }, { "suggestion": "I'll draft a crisp summary of the latest model-serving trade-offs", "prompt": "Draft me a short summary of the latest model-serving trade-offs." }, { "suggestion": "Connect GitHub and I'll triage your stalest issues", "prompt": "Connect to GitHub and triage my oldest open issues." }, { "suggestion": "I'll plan a weekend climbing trip near Boulder", "prompt": "Plan me a weekend climbing trip near Boulder." } ]`:``,g=`{ ${f}"claims": [ { "claim": "Senior engineer at an AI infra startup", "confidence": "confident", "sources": ["https://linkedin.com/in/example-user", "https://example-infra.com/about"] }, { "claim": "Based in Boulder, CO", "confidence": "maybe", "sources": ["https://linkedin.com/in/example-user"] }, { "claim": "Into climbing and the outdoors", "confidence": "guessing", "sources": [] } ]${h?`,${h}`:``} }`;return`${m}
8
+
9
+ Get to know me. Search the web for what's publicly known about me, and infer a handful of things about who I am: what I do, my role, where I'm based, what I'm into, anything that would help you assist me better. Prefer sources people author about themselves — LinkedIn, a personal site, GitHub, an employer's team page, published work, public social profiles. Never fetch or cite people-search or background-check aggregators (Instant Checkmate, Spokeo, BeenVerified, TruePeopleSearch, Whitepages, and similar); data-broker directories (ZoomInfo, RocketReach, Apollo) may corroborate another source but must never be a claim's only basis.
10
+
11
+ IDENTITY GATE — decide who a page is about before you use it: a name match alone is NEVER enough to attribute a page to me. Attribute it to me only when it also corroborates something I stated — my role, my hobby, or a location consistent with my timezone if I gave one. If several people share my name and none clears that bar, or you find no verifiable match at all, then I have no public profile you can use: return ONLY inferences from what I stated above, each labeled "guessing" with "sources": []. An honest near-empty card beats a stranger's biography. If my details above read as placeholder or joke input rather than a real identity, skip the web search and return an empty claims array.
12
+
13
+ Treat the name, role, and hobby I provided above as first-party context from me. Use public sources to enrich that context, not to override or correct it. If public sources use a different title or omit part of my stated role, do not frame my stated role as wrong; mention the public title only as supporting nuance when it is useful, and keep ${o?`claims and suggestions`:`claims`} aligned with my stated role.
14
+
15
+ CRITICAL: your final reply must be ONLY a JSON object. No preamble, no explanation, no prose, nothing before or after it. Do your thinking and searching, then respond with exactly this shape and nothing else:
16
+
17
+ ${g}
18
+
19
+ Rules for "claims":
20
+
21
+ AT MOST 5 claims, typically 3 to 4. Never pad the list or inflate a confidence tier to seem thorough.
22
+ Phrase each claim in third person as a short headline ("Senior engineer at an AI infra startup", "Based in Boulder, CO", "Active climber on Mountain Project"). No multi-clause sentences, no em-dash asides, no explanations. Good: "Contributed to Chirps (vector-DB security)". Bad: "You've done real work in vector database security. You contributed to Chirps, a tool for scanning vector DBs for sensitive data".
23
+ Each claim must be independently true-or-false so I can remove the ones that are wrong.
24
+ Every specific in a claim (employer, title, publication, city) must appear in a source you actually fetched this turn — never synthesize or embellish specifics a source doesn't state.
25
+ "confidence" is earned per the identity gate: "confident" needs 2+ independent gate-passing sources, "maybe" needs exactly one, and a claim with no sources is an inference from my stated details and must be "guessing".
26
+ "sources": 0 to 3 URLs you actually used as evidence for that specific claim. Use [] for pure inferences.
27
+ ${o?`Rules for "suggestions":
28
+
29
+ Each suggestion is an object with two fields:
30
+ "suggestion": the offer in YOUR voice (the assistant), exactly as it appears on the clickable card — first-person "I" refers to you (whatever your name). Pattern: "I'll [verb] [specific artifact]" or "Connect me to [integration] and I'll [verb] [artifact]." Lead with the offer; no intake question in front of it — you gather the details in the follow-up conversation after the click.
31
+ "prompt": the same offer re-voiced as the message sent on the user's behalf when they click, in the USER's first person ("I"/"my" = the user) — what they'd say to take you up on it (suggestion "I'll find you 3 papers" → prompt "Find me 3 papers worth reading"). State the request; don't echo the assistant-voiced wording and don't ask a question back.
32
+
33
+ Generate EXACTLY 4 suggestions covering four DIFFERENT capabilities, each making me think "wait, you can do that?" Draw on your range — a quick researched answer, a recurring brief or monitor, a doc drafted in a live editor, an integration (GitHub, Gmail, Calendar, Slack, Linear) connected with a first action, or a hobby hook if research surfaced one — but pick what genuinely fits; don't force a fixed set.
34
+ Ground every suggestion in what you actually learned about me — my real role, stack, industry, and (if given) hobby. Specific to me, not generic assistant stuff; skip bare "summarize" or "draft a post."
35
+ CRITICAL: every suggestion must be a fast win you can deliver in the first reply, never a long-running build. NEVER suggest building an app, dashboard, tool, site, or tracker, or any multi-step "build me a ___" project — those kill the first impression. The ambitious build can come later in the conversation, never on the first card.
36
+ Keep each SHORT and skimmable: under 10 words, ONE clause, ONE artifact, no lists of three ("X, Y, and Z"). The reader scans four cards in seconds — a long line loses them.
37
+ `:``}${d}
38
+ ${o?`Don't include anything sensitive or private. If the identity gate leaves you with very little, return only the honest "guessing" claims my stated details support, and lean on broadly useful suggestions for my role.`:`Don't include anything sensitive or private. If the identity gate leaves you with very little, return only the honest "guessing" claims my stated details support.`}
39
+ Keep every string value simple so the JSON always parses: one line, no line breaks inside a value, and NO double-quote characters inside a value — use single quotes (or none) for emphasis, quoted names, or tool names. Output ONLY the JSON object. No code fence, no extra text.`}function ln({hostingParam:e,localMode:t,gatewayAuthSession:n}){return t?e===null?n:e!==`vellum-cloud`:!1}var un=3e3,dn=3e5,fn=`Failed to start your assistant. Please try again.`,pn=`Your assistant is taking longer than expected. Please try again.`,mn=e=>new Promise(t=>setTimeout(t,e));function hn({adoptExisting:e=!1,adoptAssistantId:t}={}){let[r,i]=(0,K.useState)(!1),[a,o]=(0,K.useState)(null),[s,c]=(0,K.useState)(null),l=(0,K.useRef)(!1),u=(0,K.useRef)([]),d=(0,K.useRef)(null),f=(0,K.useCallback)(e=>{if(!d.current){d.current={kind:`ready`,id:e},i(!0);for(let t of u.current)t.resolve(e);u.current=[]}},[]),p=(0,K.useCallback)(e=>{if(d.current)return;d.current={kind:`error`,message:e},c(e);let t=Error(e);for(let e of u.current)e.reject(t);u.current=[]},[]);return{start:(0,K.useCallback)(()=>{if(l.current)return;l.current=!0;let r=Date.now(),i=()=>Date.now()-r>=dn;(async()=>{if(e&&t){let e=O(t);if(e){o(e.assistantId),f(e.assistantId);return}}let r=e?t:void 0;if(!e)try{let e=await le();if(e.ok)r=e.data.id,o(e.data.id);else{if(F(e.status,e.error)){p(P);return}if(!se(e.status)){p(re(e.error,void 0,fn));return}}}catch(e){n(e,{context:`research_background_hatch`})}let a;for(;!a;){if(i()){p(pn);return}try{let e=await ue(r);r&&!e.ok&&e.status===404&&(r=void 0,e=await ue());let t=ie(e);if(t.kind===`active`&&e.ok){a=e.data.id,o(a);break}if(t.kind===`error`){p(t.message);return}}catch(e){n(e,{context:`research_background_hatch_poll`})}await mn(un)}if(e)for(;!await E();){if(i()){p(pn);return}await mn(un)}else for(;;){try{if((await ce(a)).ok)break}catch{}if(i()){p(pn);return}await mn(un)}f(a)})()},[p,f,e,t]),ready:r,assistantId:a,error:s,awaitReady:(0,K.useCallback)(()=>{let e=d.current;return e?.kind===`ready`?Promise.resolve(e.id):e?.kind===`error`?Promise.reject(Error(e.message)):new Promise((e,t)=>{u.current.push({resolve:e,reject:t})})},[])}}async function gn(e,t){try{await j({path:{assistant_id:e,id:t},throwOnError:!1})}catch(e){n(e,{context:`research_onboarding_archive`})}}var _n=`vellum_pending_plugin_install`;function vn(){let e=t(_n,``);if(!e)return null;try{let t=JSON.parse(e);return typeof t?.pluginId!=`string`||!t.pluginId||typeof t.ts!=`number`||Date.now()-t.ts>36e5?null:t.pluginId}catch{return null}}function yn(){let e=vn();return e?[e]:[]}var bn=[`admin-copilot`],xn=[{plugin:`marketing-expert`,keywords:[`founder`,`cofounder`,`co founder`,`ceo`,`cmo`,`chief executive`,`chief marketing`,`entrepreneur`,`marketing`,`marketer`,`growth`,`brand`,`content`,`copywriter`,`copywriting`,`seo`,`demand gen`,`demand generation`,`sales`,`account executive`,`business development`,`creator`,`social media`,`community manager`]},{plugin:`git-workflow`,keywords:`developer.swe.programmer.coder.devops.dev ops.sre.site reliability.software engineer.software architect.backend engineer.back end engineer.frontend engineer.front end engineer.full stack engineer.fullstack engineer.platform engineer.infrastructure engineer.data engineer.machine learning engineer.ml engineer.qa engineer.embedded engineer.security engineer.staff engineer.principal engineer.solutions architect.tech lead.technical lead.engineering manager.engineering lead.head of engineering.director of engineering.vp of engineering.vp engineering.cto`.split(`.`)}];function Sn(e){return` ${e.toLowerCase().replace(/[^a-z0-9]+/g,` `).trim()} `}function Cn(e,t){return e.includes(` ${t} `)}function wn(e){let t=Sn(e),n=[];for(let{plugin:e,keywords:r}of xn)r.some(e=>Cn(t,e))&&n.push(e);return n}function Tn(e,t){let n=[...bn,...yn(),...wn(e)],r=new Set,i=[];for(let e of n)!t.has(e)||r.has(e)||(r.add(e),i.push(e));return i}var En=1500,Dn=12e4,On=2;function kn({complete:e,stableReads:t}){return e&&t>=On}function An({sawCompletePayload:e}){return e?`done`:`error`}function jn({sawCompletePayload:e}){return e}var Mn=`vellum-ai`,Nn=new Set([`simple-memory`,`level-up`]);function Pn(e){let t=e.trim().split(/(?<=\.)\s/)[0]?.trim()??e.trim();return t.length>100?`${t.slice(0,97).trimEnd()}…`:t}function Fn(e){return e?.split(`/`)[0]?.trim()??``}function In(e){let t=[],n=new Set;for(let r of e){let e=r.name?.trim(),i=r.description?.trim();!e||!i||Fn(r.source?.repo)===Mn&&(Nn.has(e)||(n.add(e),t.push({name:e,description:Pn(i)})))}return{capabilities:t,validNames:n}}async function Ln(e){try{return In((await M({path:{assistant_id:e},throwOnError:!1})).data?.matches??[])}catch(e){return n(e,{context:`research_onboarding_catalog`}),{capabilities:[],validNames:new Set}}}async function Rn(e,t){try{await A({path:{assistant_id:e},body:{name:t},throwOnError:!1})}catch(e){n(e,{context:`research_onboarding_install`})}}var zn=32;async function Bn({assistantId:e,conversationId:t,status:r,subject:i,claims:a,suggestions:o,plugins:s,installedPlugins:c}){try{await ne({path:{assistant_id:e},body:{conversation_id:t,status:r,self_reported_occupation:i.occupation,self_reported_hobbies:(i.hobbies??[]).slice(0,zn),self_reported_timezone:i.timezone,claims:a,suggestions:o,plugins:s,installed_plugins:c},throwOnError:!1})}catch(e){n(e,{context:`research_onboarding_telemetry`})}}var Vn=e=>new Promise(t=>setTimeout(t,e));function Hn({role:e,validNames:t,modelPlugins:n}){return[...new Set([...Tn(e,t),...n.filter(e=>t.has(e))])]}function Un(){let[e,t]=(0,K.useState)({status:`idle`,claims:[],suggestions:[],installedPlugins:[],pluginCatalog:{}}),r=(0,K.useRef)(0),i=(0,K.useRef)(null),a=(0,K.useRef)(new Map),o=(0,K.useRef)(Promise.resolve()),s=c(),l=(0,K.useCallback)(({awaitAssistantId:e,subject:c,conversationTitle:l,resumeConversationId:u,onConversationCreated:d,includeSuggestions:f=!0})=>{let p=JSON.stringify(c);if(i.current===p)return;i.current=p;let m=r.current+1;r.current=m;let h=()=>r.current!==m,g=()=>{};o.current=new Promise(e=>{g=e}),a.current.clear(),t({status:`running`,claims:[],suggestions:[],installedPlugins:[],pluginCatalog:{}}),(async()=>{let r,i,o=!1;try{let n=await e();if(r=n,h())return;let{capabilities:s,validNames:p}=await Ln(n);if(h())return;let m=Object.fromEntries(s.map(e=>[e.name,e.description]));t(e=>({...e,pluginCatalog:m})),p.size===0&&g();let _=a.current,v=Tn(c.occupation,p);for(let e of v)_.has(e)||_.set(e,Rn(n,e));v.length>0&&t(e=>({...e,installedPlugins:v}));let y=async e=>{let t={conversationId:e,content:cn(c,s,{includeSuggestions:f}),sourceChannel:`vellum`,interface:`web`,clientOs:I(),clientMessageId:crypto.randomUUID()};try{let e=Intl.DateTimeFormat().resolvedOptions().timeZone;e&&(t.clientTimezone=e)}catch{}return!!(await N({path:{assistant_id:n},body:t,throwOnError:!1})).response?.ok},b=async()=>{let e=await ee({path:{assistant_id:n},body:{conversationType:`standard`,...l?{title:l}:{}},throwOnError:!1});i=e.data?.id;let t=e.data?.id;if(!(!e.response?.ok||!t))return d?.(t),t},x;if(u){let e=await te({path:{assistant_id:n},query:{conversationId:u},throwOnError:!1});if(h())return;if(e.response?.ok&&(x=u,i=u,!(e.data?.messages??[]).some(e=>e.role===`user`))){if(!await y(x)){t(e=>({...e,status:`error`}));return}if(h())return}}if(!x){if(x=await b(),h())return;if(!x){t(e=>({...e,status:`error`}));return}if(!await y(x)){t(e=>({...e,status:`error`}));return}if(h())return}let S=Date.now()+Dn,C=``,w=0,T=!1,E=[],D=[],O=[],k=v;for(;Date.now()<S;){if(await Vn(En),h())return;let e=await te({path:{assistant_id:n},query:{conversationId:x},throwOnError:!1});if(h())return;let r=gt(e.data?.messages??[]);if(r){let{claims:e,suggestions:i,plugins:a,pluginsResolved:s,complete:l}=nt(r),u=a.filter(e=>p.has(e));for(let e of u)_.has(e)||_.set(e,Rn(n,e));s&&g();let d=Hn({role:c.occupation,validNames:p,modelPlugins:u});if(t({status:`running`,claims:e,suggestions:i,installedPlugins:d,pluginCatalog:m}),E=e,D=i,O=a,k=d,l&&(o=!0),l&&!T&&(T=!0,Bn({assistantId:n,conversationId:x,status:`done`,subject:c,claims:e,suggestions:i,plugins:a,installedPlugins:d})),w=r===C?w+1:0,C=r,kn({complete:l,stableReads:w}))break}}if(h())return;T||(T=!0,Bn({assistantId:n,conversationId:x,status:`error`,subject:c,claims:E,suggestions:D,plugins:O,installedPlugins:k})),t(e=>({...e,status:An({sawCompletePayload:o})}))}catch(e){if(h())return;n(e,{context:`research_onboarding_runner`}),t(e=>({...e,status:`error`}))}finally{g(),jn({sawCompletePayload:o})&&r&&i&&(await gn(r,i),Xe(s,r))}})()},[s]),u=(0,K.useCallback)(async()=>{await o.current,await Promise.all([...a.current.values()])},[]),d=(0,K.useCallback)((e,n)=>{if(r.current+=1,t(e),n&&e.installedPlugins.length>0){let t=a.current;t.clear();for(let r of e.installedPlugins)t.set(r,(async()=>{try{await Rn(await n(),r)}catch{}})())}},[]);return{...e,start:l,awaitPluginInstalls:u,hydrate:d}}function Wn({removedClaims:e,rejectedAll:t}){if(t)return[`Correction: none of what you found in that web search is actually me —`,`it looks like you matched someone else with a similar name. Please`,`disregard everything from that search and don't remember any of it as`,`true about me. We'll build up what you actually know about me from here,`,`as we talk.`].join(` `);let n=e.map(e=>e.trim()).filter(Boolean);return n.length===0?null:[`Quick correction on what you found about me — these aren't true, so please`,`disregard them and don't remember them as facts about me:`,``,...n.map(e=>`- ${e}`)].join(`
40
+ `)}async function Gn({assistantId:e,conversationId:t,removedClaims:r,rejectedAll:i}){let a=Wn({removedClaims:r,rejectedAll:i});if(a){try{let n={conversationId:t,content:a,sourceChannel:`vellum`,interface:`web`,clientOs:I(),clientMessageId:crypto.randomUUID()};await N({path:{assistant_id:e},body:n,throwOnError:!1})}catch(e){n(e,{context:`research_onboarding_correction`})}await gn(e,t)}}var Kn=1500,qn=12e4,Jn=e=>new Promise(t=>setTimeout(t,e));async function Yn({awaitAssistantId:e,values:t,userName:r,assistantName:i}){let a,o;try{a=await e();let n=await ee({path:{assistant_id:a},body:{conversationType:`standard`,title:`Updating personality`},throwOnError:!1});if(o=n.data?.id,!n.response?.ok||!o)return;let s={conversationId:o,content:ut(t,r,i),sourceChannel:`vellum`,interface:`vellum`,clientMessageId:crypto.randomUUID()};if(!(await N({path:{assistant_id:a},body:s,throwOnError:!1})).response?.ok)return;await ht(a,dt(t));let c=Date.now()+qn,l=``,u=0,d=!1;for(;Date.now()<c;){await Jn(Kn);let e=await te({path:{assistant_id:a},query:{conversationId:o},throwOnError:!1}),t=gt(e.data?.messages??[]);if(t&&(u=t===l?u+1:0,l=t),e.data?.processing===!0&&(d=!0),ft({processing:e.data?.processing,sawProcessing:d,hasReply:t.length>0,stableReads:u}))break}}catch(e){n(e,{context:`research_onboarding_personality`})}finally{if(a&&o)try{await j({path:{assistant_id:a,id:o},throwOnError:!1})}catch(e){n(e,{context:`research_onboarding_personality_archive`})}}}function Xn(e){let t=e?.trim();return`You're about to begin your first conversation.${t?`\nYour name is ${t} — introduce yourself as ${t}.`:``}
41
+ Respond with a warm and engaging greeting. Be interesting, be real. This is your chance to get to know and impress the user.
42
+ Keep it short! For this opening greeting only, don't use \`recall\` or read any files — just say hello. (This applies to the greeting alone; use your tools normally for everything the user asks afterward.)`}function Zn(e,t){if(!e)return null;let n=new Date(e);if(Number.isNaN(n.getTime()))return null;try{return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`,...t?{timeZone:t}:{}}).format(n)}catch{return new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n)}}var q=l(),Qn=(0,K.createContext)(null);function $n({size:e,children:t}){return(0,q.jsx)(Qn.Provider,{value:e,children:t})}function er(){let e=(0,K.useContext)(Qn),[t,n]=(0,K.useState)(()=>mt());return(0,K.useEffect)(()=>{if(e)return;let t=()=>n(mt());return window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)},[e]),e??t}var tr={x:.5,y:.4},nr=[-8,6,9,0,7,-6,5,0,-7,4,-5,6];function rr(e){return nr[e%nr.length]??0}var ir=[1,0,1,0,1,0,1,0,1,0,0],ar=[.72,1],or=[.4,1],sr=[10,20],cr=50;function lr(e){return ar[ir[e]??1]??1}function ur(e){return or[ir[e]??1]??1}function dr(e){return sr[ir[e]??1]??20}function fr(e,t){return Math.round(Math.max(130,Math.min(Math.min(e,t)*.4,420)))}function pr(e,t){return Math.round(Math.max(110,Math.min(Math.min(e,t)*.21,205)))}function mr(e,t,n){let r=n*.4,i=n*.48;return[{x:i,y:i},{x:e*.3,y:r},{x:e*.72,y:r},{x:e-i,y:i},{x:e-r,y:t*.72},{x:e-i,y:t-i},{x:i,y:t-i},{x:r,y:t*.5},{x:e-r,y:t*.3},{x:e*.38,y:t-r},{x:e*.62,y:t-r}]}function hr(e,t,n,r,i){let a=e.x-t,o=e.y-n,s=Math.hypot(a,o)||1,c=Math.max(r,i);return{x:e.x+a/s*c,y:e.y+o/s*c}}function gr({components:e,characters:t,centerChar:n,edgeOrder:r,entering:i,exiting:a,onEnterComplete:o,onSelectChar:s}){let{w:c,h:l}=er(),u=U(),d=c<640,f=new Set([4,7,8,9,10]),p=e=>d&&f.has(e),h=fr(c,l),g=h/2,_=h/2,v=pr(c,l)/h,y=pr(c,l),b=(0,K.useMemo)(()=>{let e=new Map;return r.forEach((t,n)=>e.set(t,n)),e},[r]),x=tr.x*c,S=tr.y*l,C=x-g,w=S-g,T=(0,K.useMemo)(()=>mr(c,l,_),[c,l,_]);return(0,q.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-0 overflow-hidden`,children:[(0,q.jsx)(`div`,{className:`absolute rounded-[50%] bg-[var(--aux-black,#000)] opacity-20 blur-md`,style:{width:y*.62,height:16,left:x-y*.31,top:S+y*.4}}),t.map((t,r)=>{let d=r===n,f=!u&&i?.char===r,_=!u&&a?.char===r;if(f){let n=T[i.fromSlot],a=hr(n,x,S,c,l),s=lr(i.fromSlot),u=ur(i.fromSlot);return(0,q.jsx)(H.div,{className:`absolute left-0 top-0`,style:{width:h,height:h,zIndex:cr},initial:!1,animate:{x:[n.x-g,a.x-g,a.x-g,C,C,C],y:[n.y-g,a.y-g,a.y-g,w,w,w],scale:[s,s,s,v*.7,v*1.08,v],opacity:[u,u,0,0,1,1]},transition:{duration:.85,times:[0,.28,.34,.42,.72,1],ease:[`easeIn`,`linear`,`linear`,`easeOut`,`easeOut`]},onAnimationComplete:()=>o(r),children:(0,q.jsx)(m,{components:e,traits:t,size:h})},r)}if(_){if(p(a.toSlot))return null;let n=T[a.toSlot],i=hr(n,x,S,c,l),o=lr(a.toSlot),s=ur(a.toSlot);return(0,q.jsx)(H.div,{className:`absolute left-0 top-0`,style:{width:h,height:h,zIndex:dr(a.toSlot)},initial:!1,animate:{x:[C,C,i.x-g,i.x-g,n.x-g,n.x-g],y:[w,w,i.y-g,i.y-g,n.y-g,n.y-g],scale:[v,v*.6,o,o,o*1.1,o],opacity:[1,0,0,s,s,s]},transition:{duration:.85,times:[0,.28,.34,.45,.78,1],ease:[`easeIn`,`linear`,`linear`,`easeOut`,`easeOut`]},children:(0,q.jsx)(`div`,{style:{transform:`rotate(${rr(a.toSlot)}deg)`},children:(0,q.jsx)(m,{components:e,traits:t,size:h,breathe:!1})})},r)}let y=b.get(r)??0;if(!d&&p(y))return null;let E=d?{x,y:S}:T[y];return(0,q.jsx)(H.div,{className:`absolute left-0 top-0 ${d?``:`pointer-events-auto cursor-pointer`}`,style:{width:h,height:h,zIndex:d?cr:dr(y)},initial:!1,animate:{x:E.x-g,y:E.y-g,scale:d?v:lr(y),opacity:d?1:ur(y)},transition:u?{duration:0}:{type:`spring`,stiffness:230,damping:26},onClick:d?void 0:()=>s(r),children:(0,q.jsx)(`div`,{style:{transform:d?void 0:`rotate(${rr(b.get(r)??0)}deg)`},children:(0,q.jsx)(m,{components:e,traits:t,size:h,breathe:d})})},r)})]})}var _r=[{bodyShape:`urchin`,eyeStyle:`goofy`,color:`teal`},{bodyShape:`blob`,eyeStyle:`grumpy`,color:`purple`},{bodyShape:`star`,eyeStyle:`surprised`,color:`orange`},{bodyShape:`blob`,eyeStyle:`gentle`,color:`pink`},{bodyShape:`ninja`,eyeStyle:`angry`,color:`yellow`},{bodyShape:`urchin`,eyeStyle:`curious`,color:`pink`},{bodyShape:`burst`,eyeStyle:`quirky`,color:`orange`},{bodyShape:`ghost`,eyeStyle:`bashful`,color:`green`},{bodyShape:`sprout`,eyeStyle:`dazed`,color:`orange`},{bodyShape:`star`,eyeStyle:`goofy`,color:`teal`},{bodyShape:`flower`,eyeStyle:`angry`,color:`pink`},{bodyShape:`cloud`,eyeStyle:`curious`,color:`yellow`}],J=T(w((e,t)=>({characters:[],selectedIndex:0,ensureGenerated:()=>{t().characters.length>0||e({characters:_r,selectedIndex:0})},setSelectedIndex:t=>e({selectedIndex:t}),selectNext:()=>e(e=>({selectedIndex:e.characters.length===0?0:(e.selectedIndex+1)%e.characters.length})),selectPrev:()=>e(e=>({selectedIndex:e.characters.length===0?0:(e.selectedIndex-1+e.characters.length)%e.characters.length}))})));function vr(){let[e,t]=(0,K.useState)(()=>({w:typeof window>`u`?1280:window.innerWidth,h:typeof window>`u`?800:window.innerHeight}));return(0,K.useEffect)(()=>{let e=()=>t({w:window.innerWidth,h:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function yr(){let e=G(),t=J.use.characters(),n=J.use.ensureGenerated(),r=U(),{w:i,h:a}=vr();(0,K.useEffect)(()=>{e&&n(e)},[e,n]);let o=fr(i,a),s=(0,K.useMemo)(()=>mr(i,a,o/2),[i,a,o]),c=i<640,l=new Set([4,7,8,9,10]);return!e||t.length===0?null:(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none fixed inset-0 z-0 overflow-hidden`,children:t.map((t,n)=>{if(n===0)return null;let i=n-1;if(c&&l.has(i))return null;let a=s[i];if(!a)return null;let u=nr[i%nr.length]??0,d=o*lr(i),f=ur(i),p=dr(i);return(0,q.jsx)(`div`,{className:`absolute`,style:{left:a.x-d/2,top:a.y-d/2,width:d,height:d,zIndex:p,animation:r?void 0:`character-pop-in 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) ${.1+n*.05}s both`},children:(0,q.jsx)(`div`,{style:{opacity:f,transform:`rotate(${u}deg)`},children:(0,q.jsx)(m,{components:e,traits:t,size:d,breathe:!1})})},n)})})}var br=i(`flex w-full items-center gap-1.5 rounded-md border bg-[var(--field-bg)] px-3`,`border-[var(--field-border)] transition-[border-color,background-color] duration-150 ease-out`,`focus-within:border-[var(--border-active)]`),xr=i(`min-w-0 flex-1 bg-transparent text-body-medium-lighter text-[var(--content-default)]`,`placeholder:text-[var(--content-tertiary)] outline-none`,vt);function Y(e){return e.trim().toLowerCase()}function Sr(e,t,n=[],r=8){let i=Y(t),a=new Set(n.map(Y)),o=[];for(let t of e)if(!a.has(Y(t))&&((i.length===0||Y(t).includes(i))&&o.push(t),o.length>=r))break;return o}function Cr({id:e,options:t,highlighted:n,showAddHint:r,onPick:a,onHover:o}){return(0,q.jsxs)(`ul`,{id:e,role:`listbox`,className:i(`absolute left-0 right-0 top-full z-50 mt-1.5 max-h-60 overflow-auto`,`rounded-lg bg-[var(--surface-lift)] p-1 shadow-[var(--shadow-popover)]`,`animate-[fadeInUp_0.12s_ease-out]`),children:[t.map((t,r)=>(0,q.jsx)(`li`,{id:`${e}-opt-${r}`,role:`option`,"aria-selected":r===n,onMouseDown:e=>{e.preventDefault(),a(t.value)},onMouseEnter:()=>o(r),className:i(`flex cursor-pointer items-center gap-2 rounded-md px-2.5 py-1.5`,`text-body-medium-lighter text-[var(--content-default)]`,r===n?`bg-[var(--surface-base)]`:`bg-transparent`),children:t.isAdd?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(_,{size:15,className:`shrink-0 text-[var(--content-tertiary)]`}),(0,q.jsxs)(`span`,{className:`min-w-0 truncate`,children:[`Add “`,t.value,`”`]}),(0,q.jsx)(`span`,{className:`ml-auto shrink-0 text-body-small-default text-[var(--content-tertiary)]`,children:`↵ Enter`})]}):t.value},t.isAdd?`__add__${t.value}`:t.value)),r&&(0,q.jsx)(`li`,{role:`presentation`,className:`mt-0.5 border-t border-[var(--border-base)] px-2.5 pb-0.5 pt-1.5 text-body-small-default text-[var(--content-tertiary)]`,children:`Type anything and press ↵ to add your own`})]})}function wr({htmlFor:e,required:t,children:n}){return(0,q.jsxs)(`label`,{htmlFor:e,className:`text-body-small-default text-[var(--content-secondary)]`,children:[n,t?(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-[var(--system-negative-strong)]`,children:` *`}):null]})}function Tr(e,t){(0,K.useEffect)(()=>{function n(n){e.current&&!e.current.contains(n.target)&&t()}return document.addEventListener(`mousedown`,n),()=>document.removeEventListener(`mousedown`,n)},[e,t])}function Er({label:e,placeholder:t,values:n,onChange:r,suggestions:a}){let o=(0,K.useId)(),s=`tac-${o}`,c=`tac-list-${o}`,l=(0,K.useRef)(null),[u,d]=(0,K.useState)(``),[f,p]=(0,K.useState)(!1),[m,h]=(0,K.useState)(-1),g=(0,K.useMemo)(()=>Sr(a,u,n),[a,u,n]),_=u.trim(),v=(0,K.useMemo)(()=>{if(!_)return!1;let e=Y(_);return!(n.some(t=>Y(t)===e)||g.some(t=>Y(t)===e))},[_,n,g]),b=(0,K.useMemo)(()=>{let e=g.map(e=>({value:e,isAdd:!1}));return v?[...e,{value:_,isAdd:!0}]:e},[g,v,_]);Tr(l,()=>p(!1)),(0,K.useEffect)(()=>{h(e=>e>=b.length?b.length-1:e)},[b.length]);let x=f&&b.length>0,S=!v;function C(e){let t=e.trim();t&&(n.some(e=>Y(e)===Y(t))||r([...n,t]),d(``),h(-1))}function w(e){r(n.filter(t=>t!==e))}function T(e){e.key===`ArrowDown`?(e.preventDefault(),p(!0),h(e=>Math.min(e+1,b.length-1))):e.key===`ArrowUp`?(e.preventDefault(),h(e=>Math.max(e-1,0))):e.key===`Enter`?x&&m>=0?(e.preventDefault(),C(b[m].value)):u.trim()&&(e.preventDefault(),C(u)):e.key===`,`?(e.preventDefault(),C(u)):e.key===`Backspace`&&u.length===0&&n.length>0?w(n[n.length-1]):e.key===`Escape`&&p(!1)}return(0,q.jsxs)(`div`,{ref:l,className:`relative flex flex-col gap-1.5`,children:[(0,q.jsx)(wr,{htmlFor:s,children:e}),(0,q.jsxs)(`div`,{className:i(br,`min-h-9 flex-wrap py-1.5`),children:[(0,q.jsx)(it,{size:16,"aria-hidden":!0,className:`shrink-0 self-center text-[var(--content-tertiary)]`}),n.map(e=>(0,q.jsx)(y,{onRemove:()=>w(e),removeLabel:`Remove ${e}`,className:`border border-[var(--border-base)] bg-[var(--surface-base)]`,children:e},e)),(0,q.jsx)(`input`,{id:s,role:`combobox`,"aria-expanded":x,"aria-controls":c,"aria-autocomplete":`list`,"aria-activedescendant":m>=0?`${c}-opt-${m}`:void 0,autoComplete:`off`,className:i(xr,`h-6 w-24`),placeholder:n.length===0?t:``,value:u,onChange:e=>{d(e.target.value),p(!0)},onFocus:()=>p(!0),onKeyDown:T})]}),x&&(0,q.jsx)(Cr,{id:c,options:b,highlighted:m,showAddHint:S,onPick:C,onHover:h})]})}var Dr=`Reading.Writing.Cooking.Baking.Gardening.Photography.Painting.Drawing.Hiking.Running.Cycling.Swimming.Yoga.Climbing.Weightlifting.Gaming.Board games.Chess.Traveling.Cars.Woodworking.Knitting.Playing guitar.Playing piano.Singing.Dancing.Fishing.Camping.Surfing.Skiing.Snowboarding.Coffee.Wine.Birdwatching.Pottery.Investing.Podcasts.Movies.Soccer.Basketball.Tennis.Golf.Meditation.Volunteering.Astronomy.3D printing`.split(`.`);function X(e,t){return{animation:`fadeInUp 0.4s ease-out ${e}s both`,...t==null?{}:{position:`relative`,zIndex:t}}}function Or({initialFirstName:e=``,initialLastName:t=``,onSubmit:n}){let[r,i]=(0,K.useState)(e),[o,s]=(0,K.useState)(t),[c,l]=(0,K.useState)(``),[u,d]=(0,K.useState)([]),f=r.trim().length>0&&c.trim().length>0;function p(){f&&n({firstName:r,lastName:o,role:c,hobbies:u})}return(0,q.jsx)(`div`,{"data-theme":`dark`,className:`h-full`,children:(0,q.jsxs)(st,{showCreatureFooter:!1,children:[(0,q.jsx)(yr,{}),(0,q.jsxs)(`form`,{className:`relative z-10 mx-auto flex min-h-screen w-full max-w-sm flex-col items-center justify-center px-6 py-16 text-[var(--content-default)]`,onSubmit:e=>{e.preventDefault(),p()},children:[(0,q.jsx)(`h1`,{className:`text-center font-serif text-[2.75rem] leading-[1.05] tracking-tight`,style:X(.05),children:`Let's start with you.`}),(0,q.jsx)(`p`,{className:`mt-3 text-center text-body-medium-lighter text-[var(--content-secondary)]`,style:X(.12),children:`A few details so I can get to know you.`}),(0,q.jsxs)(`div`,{className:`mt-10 flex w-full flex-col gap-5`,children:[(0,q.jsx)(`div`,{style:X(.2,40),children:(0,q.jsx)(b,{label:(0,q.jsxs)(q.Fragment,{children:[`What should I call you?`,(0,q.jsx)(`span`,{"aria-hidden":!0,className:`text-[var(--system-negative-strong)]`,children:` *`})]}),placeholder:`Your name`,value:r,onChange:e=>i(e.target.value),className:vt,autoFocus:!0,required:!0,fullWidth:!0})}),(0,q.jsx)(`div`,{style:X(.27,30),children:(0,q.jsx)(b,{label:`And your last name?`,placeholder:`Your last name (optional)`,value:o,onChange:e=>s(e.target.value),className:vt,fullWidth:!0})}),(0,q.jsx)(`div`,{style:X(.34,20),children:(0,q.jsx)(b,{label:`Your role`,placeholder:`What do you do for work?`,value:c,onChange:e=>l(e.target.value),className:vt,required:!0,fullWidth:!0})}),(0,q.jsx)(`div`,{style:X(.41,10),children:(0,q.jsx)(Er,{label:`Any hobbies?`,placeholder:`Cars, books, growing tomatoes?`,values:u,onChange:d,suggestions:Dr})})]}),(0,q.jsx)(`div`,{className:`mt-10 w-full`,style:X(.5),children:(0,q.jsx)(a,{type:`submit`,variant:`primary`,size:`regular`,rightIcon:(0,q.jsx)(W,{size:16}),fullWidth:!0,disabled:!f,className:`h-11 text-base`,children:`Continue`})})]})]})})}function kr(){let e=G(),t=J.use.characters(),n=J.use.selectedIndex();return(0,K.useMemo)(()=>{let r=t[n],i=e?.colors.find(e=>e.id===r?.color)?.hex;return Je(i??`var(--surface-base)`)},[e,t,n])}function Z({onBack:e,onNext:t,tone:n}){let r=kr(),i=n?n===`dark`?`#1A1A1A`:`#FFFFFF`:r.fg,a=n?n===`dark`?`rgba(0,0,0,0.08)`:`rgba(255,255,255,0.12)`:r.wash;return(0,q.jsxs)(`div`,{className:`absolute left-4 top-6 z-10 flex items-center gap-3`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:e,"aria-label":`Back`,className:`flex cursor-pointer h-8 w-8 items-center justify-center rounded-md transition-colors duration-150`,style:{color:i},onMouseEnter:e=>e.currentTarget.style.backgroundColor=a,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,children:(0,q.jsx)(d,{className:`h-5 w-5`})}),t?(0,q.jsx)(`button`,{type:`button`,onClick:t,"aria-label":`Forward`,className:`flex cursor-pointer h-8 w-8 items-center justify-center rounded-md transition-colors duration-150`,style:{color:i},onMouseEnter:e=>e.currentTarget.style.backgroundColor=a,onMouseLeave:e=>e.currentTarget.style.backgroundColor=`transparent`,children:(0,q.jsx)(f,{className:`h-5 w-5`})}):null]})}var Ar=[`Ziggy`,`Quill`,`Luna`,`Remy`,`Cleo`,`Cade`];function jr(e,t){let n=[];for(let r=0;r<e;r++)r!==t&&n.push(r);return{centerChar:t,edgeOrder:n}}function Mr({onContinue:e,onBack:t,onForward:n}){let r=G(),i=J.use.characters(),o=J.use.ensureGenerated(),s=J.use.selectedIndex(),c=J.use.setSelectedIndex();(0,K.useEffect)(()=>{r&&o(r)},[r,o]);let l=i.length,[d,f]=(0,K.useState)(null),[m,h]=(0,K.useState)(``),[_,v]=(0,K.useState)(!1),y=(0,K.useRef)(!1),b=(0,K.useRef)(null),{ref:x,size:S}=pt(),[C,w]=(0,K.useState)(null);(0,K.useEffect)(()=>{l>0&&d===null&&f(jr(l,s))},[l,s,d]),(0,K.useEffect)(()=>{d&&c(d.centerChar)},[d,c]);let T=d?.centerChar;(0,K.useEffect)(()=>{T!=null&&!y.current&&h(Ar[T%Ar.length])},[T]),(0,K.useEffect)(()=>{_&&(b.current?.focus(),b.current?.select())},[_]);function E(e){if(!d||e===d.centerChar)return;let t=d.edgeOrder.indexOf(e);if(t<0)return;let n=[...d.edgeOrder];n[t]=d.centerChar,w({entering:{char:e,fromSlot:t},exiting:{char:d.centerChar,toSlot:t}}),f({centerChar:e,edgeOrder:n})}let D=()=>d&&E((d.centerChar+1)%l),O=()=>d&&E((d.centerChar-1+l)%l),k=(0,K.useMemo)(()=>d?i[d.centerChar]:void 0,[d,i]),A=!!r&&!!d&&!!k;function j(){k&&e({traits:k,name:m.trim()})}function M(){y.current=!0,h(e=>{let t=Ar.filter(t=>t!==e),n=t.length>0?t:Ar;return n[Math.floor(Math.random()*n.length)]})}let N=`pointer-events-auto z-10 flex cursor-pointer h-10 w-10 items-center justify-center rounded-full bg-[color-mix(in_srgb,var(--content-default)_10%,transparent)] text-[var(--content-default)] transition-colors duration-150 hover:bg-[color-mix(in_srgb,var(--content-default)_18%,transparent)]`;return(0,q.jsx)(`div`,{ref:x,"data-theme":`dark`,className:`relative h-full overflow-hidden bg-[var(--surface-base)] text-[var(--content-default)]`,children:(0,q.jsxs)($n,{size:S,children:[A&&(0,q.jsx)(gr,{components:r,characters:i,centerChar:d.centerChar,edgeOrder:d.edgeOrder,entering:C?.entering??null,exiting:C?.exiting??null,onEnterComplete:e=>w(t=>t?.entering.char===e?null:t),onSelectChar:E}),(0,q.jsx)(Z,{tone:`light`,onBack:t,onNext:n?j:void 0}),(0,q.jsx)(`h1`,{className:`absolute left-1/2 top-[19%] z-10 -translate-x-1/2 whitespace-nowrap text-center text-[2.6rem] leading-none`,style:{fontFamily:`var(--font-serif)`,animation:`fadeInUp 0.4s ease-out both`},children:`Give me a face and a name`}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Previous character`,onClick:O,className:`absolute left-[calc(50%-170px)] top-[40%] -translate-y-1/2 ${N}`,children:(0,q.jsx)(u,{className:`h-4 w-4`})}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Next character`,onClick:D,className:`absolute right-[calc(50%-170px)] top-[40%] -translate-y-1/2 ${N}`,children:(0,q.jsx)(W,{className:`h-4 w-4`})}),(0,q.jsxs)(`div`,{className:`absolute left-1/2 top-[51%] z-10 flex -translate-x-1/2 flex-col items-center gap-12`,children:[_?(0,q.jsx)(`input`,{ref:b,value:m,onChange:e=>{y.current=!0,h(e.target.value)},onBlur:()=>v(!1),onKeyDown:e=>{e.key===`Enter`&&(e.preventDefault(),v(!1))},placeholder:`Name your assistant`,"aria-label":`Assistant name`,className:`w-[234px] rounded-2xl border border-[var(--border-element)] bg-transparent px-4 py-2.5 text-center text-lg text-[var(--content-default)] placeholder:text-[var(--content-tertiary)] outline-none transition-colors duration-150 focus:border-[var(--border-active)]`}):(0,q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,q.jsxs)(`button`,{type:`button`,onClick:()=>v(!0),"aria-label":`Edit name`,className:`flex cursor-pointer items-center gap-2.5`,children:[(0,q.jsx)(`span`,{className:`text-3xl font-medium ${m?`text-[var(--content-default)]`:`text-[var(--content-tertiary)]`}`,children:m||`Name your assistant`}),(0,q.jsx)(g,{className:`h-5 w-5 text-[var(--content-tertiary)]`})]}),(0,q.jsx)(`button`,{type:`button`,onClick:M,"aria-label":`Shuffle name`,title:`Shuffle name`,className:`cursor-pointer text-[var(--content-tertiary)] transition-[transform,color] duration-300 hover:rotate-180 hover:text-[var(--content-default)]`,children:(0,q.jsx)(p,{className:`h-5 w-5`})})]}),(0,q.jsx)(a,{type:`button`,variant:`primary`,size:`regular`,rightIcon:(0,q.jsx)(W,{size:16}),disabled:!A,onClick:j,className:`h-11 w-[234px] text-base`,children:`Continue`})]})]})})}var Nr=.25,Pr=.46,Fr=.3,Ir=.85,Lr=40,Rr=14,zr=8;function Br({entrance:e=!1,entranceDelay:t=0,bumpNonce:n=0,settleBlink:r=!0}){let i=G(),a=J.use.characters(),o=J.use.selectedIndex(),s=U(),{w:c,h:l}=er(),[u,d]=(0,K.useState)({x:0,y:0});(0,K.useEffect)(()=>{if(s)return;let e=e=>{d({x:(e.clientX/window.innerWidth-.5)*2,y:(e.clientY/window.innerHeight-.5)*2})};return window.addEventListener(`mousemove`,e),()=>window.removeEventListener(`mousemove`,e)},[s]);let f=e&&!s,p=at();(0,K.useEffect)(()=>{n>0&&!s&&p.start({y:[0,-34,8,0],transition:{duration:.45,ease:`easeOut`}})},[n,s,p]);let[m,h]=(0,K.useState)(!1),[g,_]=(0,K.useState)(!e);(0,K.useEffect)(()=>{if(s||!g)return;let e=!1,t,n=n=>{e||(h(!0),t=setTimeout(()=>{e||(h(!1),t=setTimeout(n,140))},140))},i=()=>{t=setTimeout(()=>n(i),2500+Math.random()*4e3)};return r?n(()=>n(i)):i(),()=>{e=!0,clearTimeout(t)}},[s,g,r]);let v=a.length>0?a[o]:void 0,y=(0,K.useMemo)(()=>{if(!i||!v)return null;let e=i.eyeStyles.find(e=>e.id===v.eyeStyle);return e?{paths:e.paths,bbox:$e(e.paths.map(e=>Ye(e.svgPath)))}:null},[i,v]);if(!y)return null;let b=c*Ir,x=Math.min(Math.min(c,l)*Fr,b*y.bbox.h/y.bbox.w),S=x*y.bbox.w/y.bbox.h,C=(c-S)/2,w=l-(1-Nr)*x,T=Lr/100*l-(w+x/2),E=(Pr-Nr)*x,D=y.bbox.x+y.bbox.w/2,O=y.bbox.y+y.bbox.h/2;return(0,q.jsx)(H.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[2]`,style:{left:C,top:w,width:S,height:x,transformOrigin:`center`},initial:f?{y:T,scale:.35}:!1,animate:f?{y:[T,E,0],scale:[.35,1,1]}:{y:0,scale:1},transition:f?{duration:1,delay:t,times:[0,.7,1],ease:`easeInOut`}:{duration:0},onAnimationComplete:()=>_(!0),children:(0,q.jsx)(H.div,{animate:p,children:(0,q.jsx)(`div`,{style:{transform:`translate(${u.x*Rr}px, ${u.y*zr}px)`,transition:`transform 0.5s cubic-bezier(0.22, 1, 0.36, 1)`},children:(0,q.jsx)(`svg`,{viewBox:`${y.bbox.x} ${y.bbox.y} ${y.bbox.w} ${y.bbox.h}`,width:S,height:x,style:{overflow:`visible`,display:`block`},children:(0,q.jsx)(`g`,{style:{transform:m?`scaleY(0.1)`:`scaleY(1)`,transformOrigin:`${D}px ${O}px`,transition:`transform 0.14s ease-in-out`},children:y.paths.map((e,t)=>(0,q.jsx)(`path`,{d:e.svgPath,fill:e.color},t))})})})})})}var Vr=200,Hr=40;function Ur({firstName:e,assistantName:t,onContinue:n,onBack:r,onForward:i}){let o=G(),s=J.use.characters(),c=J.use.selectedIndex(),l=U(),{ref:u,size:{w:d,h:f}}=pt(),p=kr(),m=s.length>0?s[c]:void 0,h=(0,K.useMemo)(()=>{if(!o||!m)return null;let e=o.bodyShapes.find(e=>e.id===m.bodyShape),t=o.colors.find(e=>e.id===m.color);return!e||!t?null:{body:e,color:t.hex}},[o,m]),g=e.trim()?`Hey, ${e.trim()}!`:`Hey!`,_=t?.trim()?`I’m ${t.trim()}, your new AI assistant`:`I’m your new AI assistant`;if(!h)return(0,q.jsx)(`div`,{"data-theme":`dark`,className:`h-full`,style:{backgroundColor:`var(--surface-base)`}});let v=1.25*Math.max(d,f),y=v*h.body.viewBox.height/h.body.viewBox.width,b=(d-v)/2,x=(f-y)/2,S=Vr/v,C=(Hr/100-.5)*f;return(0,q.jsx)(`div`,{ref:u,"data-theme":`dark`,className:`relative h-full overflow-hidden`,style:{backgroundColor:`var(--surface-base)`},children:(0,q.jsxs)($n,{size:{w:d,h:f},children:[(0,q.jsx)(H.div,{className:`absolute inset-0 z-0`,style:{backgroundColor:h.color},initial:l?!1:{opacity:0},animate:{opacity:1},transition:l?{duration:0}:{duration:.6,delay:.35}}),(0,q.jsx)(H.svg,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[1]`,viewBox:`0 0 ${h.body.viewBox.width} ${h.body.viewBox.height}`,width:v,height:y,style:{left:b,top:x,transformOrigin:`center`},initial:l?!1:{scale:S,y:C},animate:{scale:1,y:0},transition:l?{duration:0}:{type:`spring`,stiffness:78,damping:18,mass:1},children:(0,q.jsx)(`path`,{d:h.body.svgPath,fill:h.color})}),(0,q.jsx)(Br,{entrance:!0}),(0,q.jsx)(H.div,{initial:l?!1:{opacity:0},animate:{opacity:1},transition:l?{duration:0}:{duration:.4,delay:1},children:(0,q.jsx)(Z,{onBack:r,onNext:i})}),(0,q.jsxs)(`div`,{className:_t,children:[(0,q.jsxs)(H.h1,{className:`text-center leading-[1.05]`,style:{fontFamily:`var(--font-serif)`},initial:l?!1:{scale:.9,opacity:0},animate:{scale:1,opacity:1},transition:l?{duration:0}:{type:`spring`,stiffness:260,damping:11,delay:1},children:[(0,q.jsx)(`span`,{className:`block text-[clamp(2.5rem,6vw,5rem)]`,style:{color:p.fgDeep},children:g}),(0,q.jsx)(`span`,{className:`block text-[clamp(2.5rem,6vw,5rem)]`,style:{color:p.fg},children:_})]}),(0,q.jsx)(H.div,{initial:l?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:l?{duration:0}:{duration:.4,delay:1.15},children:(0,q.jsx)(a,{type:`button`,variant:`primary`,size:`regular`,rightIcon:(0,q.jsx)(W,{size:16}),onClick:n,className:`h-11 w-[234px] text-base`,children:`Continue`})})]})]})})}var Wr=.3,Gr=.85,Kr=.25;function qr(){let e=G(),t=J.use.characters(),n=J.use.selectedIndex(),r=t.length>0?t[n]:void 0,{w:i,h:a}=er(),o=(0,K.useMemo)(()=>{if(!e||!r)return null;let t=e.eyeStyles.find(e=>e.id===r.eyeStyle);return t?{paths:t.paths,bbox:$e(t.paths.map(e=>Ye(e.svgPath)))}:null},[e,r]),s=o?Math.min(Math.min(i,a)*Wr,i*Gr*o.bbox.h/o.bbox.w):0;return{art:o,eyesW:o?s*o.bbox.w/o.bbox.h:0,eyesH:s,restCy:a-Kr*s,centerX:i/2,w:i,h:a}}function Jr({art:e,eyesW:t,eyesH:n,centerX:r,eyeCy:i,eyeScale:a,eyeX:o,blinking:s,className:c=`pointer-events-none absolute top-0 z-0`}){let l=jt(i,e=>e-n/2),u=e.bbox.x+e.bbox.w/2,d=e.bbox.y+e.bbox.h/2;return(0,q.jsx)(H.div,{"aria-hidden":`true`,className:c,style:{left:r-t/2,top:0,x:o,y:l,width:t,height:n,scale:a,transformOrigin:`center`},children:(0,q.jsx)(`svg`,{viewBox:`${e.bbox.x} ${e.bbox.y} ${e.bbox.w} ${e.bbox.h}`,width:t,height:n,style:{overflow:`visible`,display:`block`},children:(0,q.jsx)(`g`,{style:{transform:s?`scaleY(0.1)`:`scaleY(1)`,transformOrigin:`${u}px ${d}px`,transition:`transform 0.13s ease-in-out`},children:e.paths.map((e,t)=>(0,q.jsx)(`path`,{d:e.svgPath,fill:e.color},t))})})})}var Yr={green:[`pink`,`purple`,`orange`,`yellow`],orange:[`teal`,`purple`,`green`,`yellow`],pink:[`teal`,`green`,`yellow`,`purple`],purple:[`yellow`,`teal`,`green`,`orange`],teal:[`pink`,`orange`,`yellow`,`purple`],yellow:[`purple`,`teal`,`pink`,`green`]};function Xr(e,t){let n=Yr[e];return n&&n.length>0?n:t.filter(t=>t!==e)}var Zr=new Set([`orange`,`pink`,`red`]);function Qr(e,t){return Zr.has(e)&&Zr.has(t)}function $r(e,t,n){let r=Xr(e,t),i=[];for(let e of r){if(i.length>=n)break;i.some(t=>Qr(t,e))||i.push(e)}for(let e of r){if(i.length>=n)break;i.includes(e)||i.push(e)}return i}var ei=`You’ve used AI that just answers questions`,ti=`The more I help`,ni=`I’m different`,ri=`The better I get`,ii=`and the less you have to do`,ai=[{bodyShape:`blob`,eyeStyle:`gentle`},{bodyShape:`urchin`,eyeStyle:`curious`},{bodyShape:`star`,eyeStyle:`goofy`}],oi=290;function si({firstH:e,secondH:t,color:n,firstText:r,secondText:i,revealed:a,carouseled:o,revealFrom:s,revealDuration:c,reduce:l}){let u=s===`bottom`?`inset(100% 0 0 0)`:`inset(0 0 100% 0)`;return!e||!t?null:(0,q.jsx)(H.div,{className:`relative w-full overflow-hidden`,initial:!1,animate:{height:o?t:e},transition:l?{duration:0}:{duration:.5,ease:`easeInOut`},children:(0,q.jsxs)(H.div,{className:`flex flex-col`,style:{color:n},initial:!1,animate:{y:o?-e:0},transition:l?{duration:0}:{duration:.5,ease:`easeInOut`},children:[(0,q.jsx)(`div`,{className:`flex items-center justify-center`,style:{height:e},children:(0,q.jsx)(H.span,{className:`block`,initial:!1,animate:{clipPath:a?`inset(0% 0 0% 0)`:u},transition:l?{duration:0}:{duration:c,ease:`easeOut`},children:r})}),(0,q.jsx)(`div`,{className:`flex items-center justify-center`,style:{height:t},children:(0,q.jsx)(`span`,{className:`block`,children:i})})]})})}function ci({onContinue:e,onBack:t,onForward:n}){let r=kr(),i=U(),{art:o,eyesW:s,eyesH:c,restCy:l,centerX:u,w:d,h:f}=qr(),p=G(),h=J.use.characters(),g=J.use.selectedIndex(),_=h.length>0?h[g]:void 0,v=f>0&&f<=800,y=v?.17:.22,b=v?`top-[17%]`:`top-[22%]`,x=Ot(0),S=Ot(1),C=(0,K.useMemo)(()=>!p||!_?`orange`:$r(_.color,p.colors.map(e=>e.id),1)[0]??`orange`,[p,_]),w=Math.min(220,Math.max(150,d*.16)),T=-w,E=-w*.4,D=Ot(-220),O=(0,K.useMemo)(()=>!p||!_?[]:$r(_.color,p.colors.map(e=>e.id),3),[p,_]),k=Math.max(.42,Math.min(d/1100,1)),A=Math.round(oi*k),j=-A*1.1,M=-A*.42,N=Ot(-320),[ee,te]=(0,K.useState)(!!i),[ne,re]=(0,K.useState)(!!i),[P,F]=(0,K.useState)(!1),[ie,ae]=(0,K.useState)(!1),[oe,se]=(0,K.useState)(!1),[ce,le]=(0,K.useState)(!1),[ue,de]=(0,K.useState)(!!i),I=Math.min(d,768)-48,fe=(0,K.useRef)(null),pe=(0,K.useRef)(null),me=(0,K.useRef)(null),L=(0,K.useRef)(null),he=(0,K.useRef)(null),[ge,_e]=(0,K.useState)(0),[ve,ye]=(0,K.useState)(0),[be,xe]=(0,K.useState)(0),[Se,Ce]=(0,K.useState)(0),[we,Te]=(0,K.useState)(0);return(0,K.useLayoutEffect)(()=>{fe.current?.offsetHeight&&_e(fe.current.offsetHeight),pe.current?.offsetHeight&&ye(pe.current.offsetHeight),me.current?.offsetHeight&&xe(me.current.offsetHeight),L.current?.offsetHeight&&Ce(L.current.offsetHeight),he.current?.offsetHeight&&Te(he.current.offsetHeight)},[I]),(0,K.useEffect)(()=>{x.set(l),le(!0)},[l,x]),(0,K.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>{F(!0),ae(!0),se(!0)},1400);return()=>clearTimeout(e)},[i]),(0,K.useEffect)(()=>{if(i||!o)return;x.set(l),S.set(1),D.set(T),N.set(j),te(!1),re(!1),F(!1),ae(!1);let e=Math.max(c*.5,f*y-36),t=[],n=[],r=!1,a=e=>(t.push(e),e),s=e=>new Promise(t=>{n.push(setTimeout(t,e))});return(async()=>{if(await s(200),r||(te(!0),await Promise.all([a(an(x,e,{duration:.55,ease:`easeOut`})),a(an(S,.55,{duration:.55,ease:`easeOut`}))]),r)||(re(!0),await Promise.all([a(an(x,l,{type:`spring`,stiffness:210,damping:15})),a(an(S,1,{duration:.45,ease:`easeOut`}))]),r)||(await s(900),r)||(F(!0),ae(!0),await a(an(D,[T,E,E,T],{duration:1.5,times:[0,.28,.62,1],ease:`easeInOut`})),r)||(await s(150),r))return;se(!0);let t=a(an(N,[j,M,M,j],{duration:1.5,times:[0,.28,.62,1],ease:`easeInOut`}));await s(700),!r&&(de(!0),await t)})(),()=>{r=!0,t.forEach(e=>e.stop()),n.forEach(clearTimeout)}},[i,o,f,y,c,l,x,S,D,T,E,N,j,M]),(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10 overflow-hidden`,style:{color:r.fg},children:[(0,q.jsx)(Z,{onBack:t,onNext:n}),(0,q.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none invisible absolute -left-[9999px] top-0 text-[clamp(2.25rem,5.5vw,4.5rem)] leading-[1.15]`,style:{width:I,fontFamily:`var(--font-serif)`},children:[(0,q.jsx)(`span`,{ref:fe,className:`block`,children:ei}),(0,q.jsx)(`span`,{ref:pe,className:`block`,children:ti}),(0,q.jsx)(`span`,{ref:me,className:`block`,children:ni}),(0,q.jsx)(`span`,{ref:L,className:`block`,children:ri}),(0,q.jsx)(`span`,{ref:he,className:`block`,children:ii})]}),ce&&o&&(0,q.jsx)(Jr,{art:o,eyesW:s,eyesH:c,centerX:u,eyeCy:x,eyeScale:S,blinking:!1}),!i&&p&&(0,q.jsx)(H.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[1]`,style:{left:Math.max(16,d*.05),top:0,y:D,width:w,height:w},children:(0,q.jsx)(m,{components:p,traits:{bodyShape:`blob`,eyeStyle:`goofy`,color:C},size:w,breathe:!1})}),!i&&p&&(0,q.jsx)(H.div,{"aria-hidden":`true`,className:`pointer-events-none absolute right-0 top-0 z-[1] flex items-start`,style:{right:-Math.round(A*.12),y:N},children:ai.map((e,t)=>(0,q.jsx)(`div`,{style:{width:A,height:A,marginLeft:t===0?0:-A*.34,zIndex:ai.length-t},children:(0,q.jsx)(m,{components:p,traits:{bodyShape:e.bodyShape,eyeStyle:e.eyeStyle,color:O[t]??`teal`},size:A,breathe:!1})},e.bodyShape))}),(0,q.jsxs)(`div`,{className:`${_t.replace(`top-[30%]`,b)} max-w-3xl`,children:[(0,q.jsxs)(`div`,{className:`flex w-full flex-col gap-3 text-[clamp(2.25rem,5.5vw,4.5rem)] leading-[1.15]`,style:{fontFamily:`var(--font-serif)`},children:[(0,q.jsx)(si,{firstH:ge,secondH:ve,color:r.fgDeep,firstText:ei,secondText:ti,revealed:ee,carouseled:P,revealFrom:`bottom`,revealDuration:.55,reduce:!!i}),(0,q.jsx)(si,{firstH:be,secondH:Se,color:r.fg,firstText:ni,secondText:ri,revealed:ne,carouseled:ie,revealFrom:`top`,revealDuration:.45,reduce:!!i}),(0,q.jsx)(H.div,{className:`relative w-full overflow-hidden`,style:{color:r.fg},initial:!1,animate:{height:oe?we:0},transition:i?{duration:0}:{duration:.5,ease:`easeInOut`},children:we>0&&(0,q.jsx)(`div`,{className:`flex items-center justify-center`,style:{height:we},children:(0,q.jsx)(H.span,{className:`block`,initial:!1,animate:{clipPath:oe?`inset(0% 0 0% 0)`:`inset(100% 0 0 0)`},transition:i?{duration:0}:{duration:.5,ease:`easeOut`},children:ii})})})]}),ue&&(0,q.jsx)(H.div,{initial:i?!1:{opacity:0,y:8},animate:{opacity:1,y:0},transition:i?{duration:0}:{duration:.4},children:(0,q.jsx)(a,{type:`button`,variant:`primary`,size:`regular`,rightIcon:(0,q.jsx)(W,{size:16}),onClick:e,className:`h-11 w-[234px] text-base`,children:`Continue`})})]})]})}function li({idSuffix:e}){let t=`cf-${e}`,n=`cr-${e}`,r=`cg-${e}`,i=`cs-${e}`;return(0,q.jsxs)(`svg`,{viewBox:`0 0 100 100`,width:`100%`,height:`100%`,style:{display:`block`,position:`absolute`,inset:0},children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsxs)(`linearGradient`,{id:n,x1:`0.12`,y1:`0.05`,x2:`0.85`,y2:`0.95`,children:[(0,q.jsx)(`stop`,{offset:`0%`,stopColor:`#FFF0AE`}),(0,q.jsx)(`stop`,{offset:`50%`,stopColor:`#F4C231`}),(0,q.jsx)(`stop`,{offset:`100%`,stopColor:`#D29B1A`})]}),(0,q.jsxs)(`radialGradient`,{id:t,cx:`42%`,cy:`36%`,r:`82%`,children:[(0,q.jsx)(`stop`,{offset:`0%`,stopColor:`#FFF6CE`}),(0,q.jsx)(`stop`,{offset:`55%`,stopColor:`#F8CB3E`}),(0,q.jsx)(`stop`,{offset:`100%`,stopColor:`#EEB52C`})]}),(0,q.jsxs)(`radialGradient`,{id:r,cx:`36%`,cy:`24%`,r:`44%`,children:[(0,q.jsx)(`stop`,{offset:`0%`,stopColor:`#FFFFFF`,stopOpacity:`0.85`}),(0,q.jsx)(`stop`,{offset:`100%`,stopColor:`#FFFFFF`,stopOpacity:`0`})]}),(0,q.jsxs)(`radialGradient`,{id:i,cx:`50%`,cy:`50%`,r:`50%`,children:[(0,q.jsx)(`stop`,{offset:`0%`,stopColor:`#FFFFFF`,stopOpacity:`1`}),(0,q.jsx)(`stop`,{offset:`100%`,stopColor:`#FFFFFF`,stopOpacity:`0`})]})]}),(0,q.jsx)(`circle`,{cx:`50`,cy:`50`,r:`49`,fill:`url(#${n})`}),(0,q.jsx)(`circle`,{cx:`50`,cy:`50`,r:`45.5`,fill:`none`,stroke:`#FFF6CF`,strokeOpacity:`0.6`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeDasharray:`70 210`,transform:`rotate(-128 50 50)`}),(0,q.jsx)(`circle`,{cx:`50`,cy:`50`,r:`40`,fill:`url(#${t})`}),(0,q.jsx)(`circle`,{cx:`50`,cy:`50`,r:`40`,fill:`none`,stroke:`#C28F18`,strokeOpacity:`0.35`,strokeWidth:`1.4`}),(0,q.jsxs)(`g`,{fontFamily:`var(--font-sans), system-ui, sans-serif`,fontWeight:900,fontSize:`58`,textAnchor:`middle`,children:[(0,q.jsx)(`text`,{x:`50`,y:`50`,dy:`0.355em`,fill:`#C88E16`,transform:`translate(1.3 1.6)`,children:`$`}),(0,q.jsx)(`text`,{x:`50`,y:`50`,dy:`0.355em`,fill:`#FFF6CF`,opacity:`0.7`,transform:`translate(-1.3 -1.5)`,children:`$`}),(0,q.jsx)(`text`,{x:`50`,y:`50`,dy:`0.355em`,fill:`#F4C12A`,children:`$`})]}),(0,q.jsx)(`ellipse`,{cx:`38`,cy:`28`,rx:`22`,ry:`14`,fill:`url(#${r})`}),(0,q.jsx)(`ellipse`,{cx:`34`,cy:`24`,rx:`7`,ry:`4.5`,fill:`url(#${i})`})]})}function ui({size:e,tiltX:t=0,tiltY:n=0,shadow:r=!0,spinning:i=!1,className:a}){return(0,q.jsxs)(`div`,{style:{position:`relative`,width:e,height:e},children:[r&&(0,q.jsx)(`div`,{"aria-hidden":`true`,style:{position:`absolute`,left:`50%`,bottom:-e*.14,width:e*.74,height:e*.16,transform:`translateX(-50%)`,background:`radial-gradient(ellipse at center, rgba(0,0,0,0.22), rgba(0,0,0,0) 70%)`,filter:`blur(2px)`}}),(0,q.jsx)(`div`,{style:{width:e,height:e,perspective:e*10},children:(0,q.jsxs)(H.div,{className:a,style:{width:e,height:e,position:`relative`,transformStyle:`preserve-3d`},initial:!1,animate:{rotateX:t,rotateY:i?[n,n+360,n+760,n+1180]:n},transition:i?{duration:.95,times:[0,.32,.62,1],ease:`easeInOut`}:{duration:0},children:[(0,q.jsx)(`div`,{style:{position:`absolute`,inset:0,backfaceVisibility:`hidden`,transform:`translateZ(0.5px)`},children:(0,q.jsx)(li,{idSuffix:`front`})}),(0,q.jsx)(`div`,{style:{position:`absolute`,inset:0,backfaceVisibility:`hidden`,transform:`translateZ(-0.5px) rotateY(180deg)`},children:(0,q.jsx)(li,{idSuffix:`back`})})]})})]})}var di=.3,fi=.95;function pi({onClaim:e,onBumpEyes:t,onBack:n,onForward:r}){let i=U(),a=kr(),{h:o}=er(),[s,c]=(0,K.useState)(!1);function l(){if(!s){if(c(!0),i){e();return}window.setTimeout(t,di*1e3)}}let u=o*.42,d=-o*.08,f=o*.9;return(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:a.fg},children:[(0,q.jsx)(Z,{onBack:n,onNext:r}),(0,q.jsxs)(`div`,{className:`absolute left-1/2 top-[26%] flex w-full max-w-xl -translate-x-1/2 flex-col items-center gap-3 px-6 text-center`,children:[(0,q.jsx)(`h1`,{className:`text-[2.6rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:`Here are some free credits to get started`}),(0,q.jsx)(`div`,{className:`mt-8 flex flex-col items-center gap-4`,children:(0,q.jsx)(H.div,{animate:s&&!i?{y:[0,u,d,f],scale:[1,1,1,.2],opacity:[1,1,1,0]}:{},transition:{duration:fi,times:[0,di/fi,.62,1],ease:[`easeIn`,`easeOut`,`easeIn`]},onAnimationComplete:()=>{s&&e()},children:(0,q.jsx)(ui,{size:88,spinning:s&&!i})})}),!s&&(0,q.jsxs)(`button`,{type:`button`,onClick:l,className:`mt-6 flex cursor-pointer h-11 w-[234px] items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition-transform duration-150 active:scale-[0.97]`,style:{backgroundColor:a.isLight?`#1A1A1A`:`#FFFFFF`,color:a.isLight?`#FFFFFF`:`#1A1A1A`},children:[`Claim`,(0,q.jsx)(W,{className:`h-4 w-4`})]})]})]})}ot();var mi=640,hi=[{id:`companion-coworker`,left:`Companion`,right:`Coworker`,leftAvatar:{bodyShape:`blob`,eyeStyle:`gentle`,color:`pink`},rightAvatar:{bodyShape:`ninja`,eyeStyle:`curious`,color:`purple`}},{id:`genz-boomer`,left:`Gen Z`,right:`Baby Boomer`,leftAvatar:{bodyShape:`burst`,eyeStyle:`quirky`,color:`yellow`},rightAvatar:{bodyShape:`cloud`,eyeStyle:`dazed`,color:`green`}},{id:`execute-collaborate`,left:`Independent`,right:`Collaborative`,leftAvatar:{bodyShape:`star`,eyeStyle:`angry`,color:`orange`},rightAvatar:{bodyShape:`flower`,eyeStyle:`goofy`,color:`teal`}},{id:`playful-serious`,left:`Playful`,right:`Serious`,leftAvatar:{bodyShape:`star`,eyeStyle:`goofy`,color:`yellow`},rightAvatar:{bodyShape:`blob`,eyeStyle:`grumpy`,color:`purple`}},{id:`polite-unfiltered`,left:`Polite`,right:`Unfiltered`,leftAvatar:{bodyShape:`sprout`,eyeStyle:`bashful`,color:`green`},rightAvatar:{bodyShape:`urchin`,eyeStyle:`surprised`,color:`orange`}}],gi=[`9%`,`27%`,`45%`,`62%`,`79%`],Q=50,_i=.3*.75,vi=`rgba(36, 41, 46, 0.2)`,yi=`#FDFDFC`,bi=.16;function xi(e,t,n){let r=[];for(let i=0;i<e.length;i++){let a=r[i-1],o=e[i+1],s=e[i]??``,c=e=>e===t||e===a;if(!c(s)){r.push(s);continue}let l=n.find(e=>!c(e)&&e!==o)??n.find(e=>!c(e))??s;r.push(l)}return r}function Si(){let[e,t]=(0,K.useState)(()=>typeof window>`u`?1280:window.innerWidth);return(0,K.useEffect)(()=>{let e=()=>t(window.innerWidth);return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Ci({components:e,traits:t,side:n,top:r,size:i,progress:a}){let o=Math.max(0,Math.min(1,a)),s=100+bi*100,c=n===`left`?-100+s*o:100-s*o;return(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute`,style:{[n]:`calc(50% - 50vw)`,top:r,width:i,height:i,opacity:Math.min(1,o*1.6),transform:`translate(${c}%, -50%) scale(${.8+.2*o})`,transformOrigin:`${n} center`,transition:`transform 0.18s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.18s ease`,willChange:`transform, opacity`},children:(0,q.jsx)(m,{components:e,traits:t,size:i,breathe:!1})})}function wi({axis:e,value:t,onValueChange:n,fg:r,disabled:i}){return(0,q.jsxs)(`div`,{className:`flex w-full shrink-0 flex-wrap items-center gap-x-5 gap-y-1.5 sm:flex-nowrap`,style:{opacity:i?.7:1},children:[(0,q.jsx)(`span`,{className:`order-1 flex-1 text-left text-sm sm:w-32 sm:flex-none sm:text-right sm:text-[17px]`,style:{color:r},children:e.left}),(0,q.jsx)(`span`,{className:`order-2 flex-1 text-right text-sm sm:order-3 sm:w-32 sm:flex-none sm:text-left sm:text-[17px]`,style:{color:r},children:e.right}),(0,q.jsxs)(C,{className:`relative order-3 flex h-6 w-full touch-none items-center select-none sm:order-2 sm:w-auto sm:flex-1`,value:[t],onValueChange:e=>n(e[0]??Q),disabled:i,min:0,max:100,step:1,"aria-label":`${e.left} to ${e.right}`,children:[(0,q.jsx)(x,{className:`relative h-2 w-full grow rounded-full sm:h-3`,style:{backgroundColor:vi}}),(0,q.jsx)(S,{className:`block h-5 w-5 cursor-grab rounded-full shadow-sm transition-transform active:scale-95 active:cursor-grabbing keyboard-focus:outline-none keyboard-focus:ring-2 keyboard-focus:ring-white/70 data-[disabled]:cursor-not-allowed data-[disabled]:active:scale-100 sm:h-6 sm:w-6`,style:{backgroundColor:yi}})]})]})}function Ti({components:e,values:t,sideAvatars:n,size:r}){return(0,q.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 -z-10`,children:hi.map((i,a)=>{let o=t[i.id]??Q,s=Math.max(0,(Q-o)/Q),c=Math.max(0,(o-Q)/Q),l=gi[a]??`50%`,u=n[a];return u?(0,q.jsxs)(`div`,{children:[(0,q.jsx)(Ci,{components:e,traits:u.left,side:`left`,top:l,size:r,progress:s}),(0,q.jsx)(Ci,{components:e,traits:u.right,side:`right`,top:l,size:r,progress:c})]},i.id):null})})}function Ei({values:e,onValueChange:t,locked:n,onContinue:r,onBack:i,onForward:a}){let o=kr(),s=G(),c=Si(),{w:l,h:u}=er(),d=Math.round(_i*Math.min(l,u))+12,f=c>=mi,p=J.use.characters()[J.use.selectedIndex()]?.color,m=Math.round(Math.min(300,Math.max(160,c*.16))),h=(0,K.useMemo)(()=>{let e=s?.colors.map(e=>e.id)??[],t=xi(hi.map(e=>e.leftAvatar.color),p,e),n=xi(hi.map(e=>e.rightAvatar.color),p,e);return hi.map((e,r)=>({left:{...e.leftAvatar,color:t[r]??e.leftAvatar.color},right:{...e.rightAvatar,color:n[r]??e.rightAvatar.color}}))},[s,p]);return(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10 overflow-hidden`,style:{color:o.fg},children:[(0,q.jsx)(Z,{onBack:i,onNext:a}),f&&s&&(0,q.jsx)(Ti,{components:s,values:e,sideAvatars:h,size:m}),(0,q.jsxs)(`div`,{className:`absolute inset-x-0 top-0 bottom-0 mx-auto flex w-full max-w-2xl flex-col items-center overflow-y-auto px-6`,style:{paddingBottom:d},children:[(0,q.jsx)(`div`,{className:`w-full min-h-14 shrink-[4]`,style:{flexBasis:Math.round(u*.14)}}),(0,q.jsxs)(`div`,{className:`flex shrink-0 flex-col items-center gap-2`,children:[(0,q.jsx)(`h1`,{className:`text-center text-[2.6rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:`Create my personality`}),n?(0,q.jsx)(`p`,{className:`text-center text-[15px]`,style:{color:o.fgMuted},children:`Personality locked — chat with your assistant to make any more updates`}):(0,q.jsx)(`p`,{className:`hidden max-w-md text-center text-[15px] sm:block`,style:{color:o.fgMuted},children:`How do you want me to talk to you? You can always ask me to change my personality later.`})]}),(0,q.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-10`}),hi.map((r,i)=>(0,q.jsxs)(K.Fragment,{children:[i>0&&(0,q.jsx)(`div`,{className:`w-full min-h-2.5 shrink basis-8 sm:basis-11`}),(0,q.jsx)(wi,{axis:r,value:e[r.id]??Q,onValueChange:e=>t(r.id,e),fg:o.fg,disabled:n})]},r.id)),(0,q.jsx)(`div`,{className:`w-full min-h-3 shrink-[2] basis-14`}),(0,q.jsxs)(`button`,{type:`button`,onClick:r,className:`flex h-11 w-[234px] shrink-0 cursor-pointer items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition-transform duration-150 active:scale-[0.97]`,style:{backgroundColor:o.isLight?`#1A1A1A`:`#FFFFFF`,color:o.isLight?`#FFFFFF`:`#1A1A1A`},children:[`Continue`,(0,q.jsx)(W,{className:`h-4 w-4`})]})]})]})}function Di({assistantId:e,assistantReady:t,onConnected:n,onSkip:r,onBack:i,onForward:a,missingCalendarScope:o=!1,onRetry:s,hatchError:c=null}){let l=kr(),{handleConnect:u,oauthInProgress:d}=rt({assistantId:e??``,onConnect:n}),f=()=>{s?.(),u()},p=!e||!t,m=p||d;return(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:l.fg},children:[(0,q.jsx)(Z,{onBack:i,onNext:a}),(0,q.jsxs)(`div`,{className:`absolute left-1/2 top-[26%] flex w-[360px] -translate-x-1/2 flex-col items-center gap-5 text-center`,children:[(0,q.jsx)(`h1`,{className:`text-[2.6rem] leading-tight`,style:{fontFamily:`var(--font-serif)`},children:p?`Waking up`:o?`Access not enabled`:`Let me make this easy`}),(0,q.jsx)(`p`,{className:`text-[16px]`,style:{color:l.fgMuted},children:p?`Your assistant is getting ready`:o?`Check the box next to the Google Calendar permission so I can book the check-in.`:`Connect your Google Calendar so I can find time to check in and start helping.`}),(0,q.jsxs)(`div`,{className:`mt-6 flex w-[234px] flex-col items-center gap-4`,children:[(0,q.jsx)(`button`,{type:`button`,onClick:f,disabled:m,className:`flex cursor-pointer h-11 w-full items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition-transform duration-150 enabled:active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-60`,style:{backgroundColor:l.isLight?`#1A1A1A`:`#FFFFFF`,color:l.isLight?`#FFFFFF`:`#1A1A1A`},children:p?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Starting assistant…`]}):d?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(h,{className:`h-4 w-4 animate-spin`,"aria-hidden":!0}),`Waiting for authorization…`]}):o?`Try again`:`Connect Calendar →`}),(!p||c)&&(0,q.jsx)(`button`,{type:`button`,onClick:r,disabled:d,className:`cursor-pointer text-body-small-default transition-opacity hover:opacity-100 disabled:opacity-60`,style:{color:l.fgMuted},children:`Skip for now`})]})]})]})}var Oi=Je(`#17191C`);function ki(){let[e,t]=(0,K.useState)(()=>({w:typeof window>`u`?1280:window.innerWidth,h:typeof window>`u`?800:window.innerHeight}));return(0,K.useEffect)(()=>{let e=()=>t({w:window.innerWidth,h:window.innerHeight});return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e}function Ai(){let e=G(),t=J.use.characters(),n=J.use.selectedIndex();return{components:e,chosen:t.length>0?t[n]:void 0}}function ji({size:e=64,isAssistantBusy:t=!1}){let{components:n,chosen:r}=Ai();return!n||!r?(0,q.jsx)(`div`,{style:{width:e,height:e}}):(0,q.jsx)(`div`,{className:`shrink-0`,style:{width:e,height:e},children:(0,q.jsx)(m,{components:n,traits:r,size:e,isAssistantBusy:t})})}var Mi=`pt-[0.7rem] text-[2.6rem] leading-none`,Ni=64,Pi=4500,Fi=7e3;function Ii({onDone:e,onBack:t,onForward:n,scheduledTime:r,awaitingTime:i}){let{components:a,chosen:o}=Ai(),s=U(),{w:c,h:l}=ki(),u=r?`Check-in scheduled for tomorrow at ${r}!`:`Check-in scheduled!`;(0,K.useEffect)(()=>{let t=setTimeout(e,i&&!r?Fi:Pi);return()=>clearTimeout(t)},[e,i,r]);let d=(0,K.useRef)(null),[f,p]=(0,K.useState)(null);(0,K.useLayoutEffect)(()=>{let e=()=>{let e=d.current?.getBoundingClientRect();e&&p({cx:e.left+e.width/2,cy:e.top+e.height/2})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[u]);let h=1.3*Math.max(c,l)/Ni,g=f?c/2-f.cx:0,_=f?l*.88-f.cy:0,v=l*.05;return(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10 overflow-hidden text-white`,children:[(0,q.jsx)(Z,{onBack:t,onNext:n,tone:`light`}),(0,q.jsxs)(`div`,{className:`absolute left-1/2 top-[14%] sm:top-[26%] flex w-full max-w-xl -translate-x-1/2 items-start gap-3 px-6`,children:[(0,q.jsx)(`div`,{ref:d,className:`relative shrink-0`,style:{width:Ni,height:Ni},children:a&&o&&f&&(0,q.jsx)(H.div,{className:`absolute inset-0`,style:{transformOrigin:`center`},initial:s?!1:{scale:h,x:g,y:_},animate:{x:[g,g,0,0],y:[_,_+v,0,0],scale:[h,h,1.07,1]},transition:s?{duration:0}:{duration:1.1,times:[0,.18,.82,1],ease:[`easeOut`,`easeIn`,`easeOut`]},children:(0,q.jsx)(m,{components:a,traits:o,size:Ni})})}),(0,q.jsx)(H.span,{className:Mi,style:{fontFamily:`var(--font-serif)`},initial:s?!1:{opacity:0,x:-8},animate:{opacity:1,x:0},transition:s?{duration:0}:{duration:.4,delay:.9},children:u})]})]})}var Li=[`Searching the web to get to know you…`,`Reading public profiles…`,`Skimming the highlights…`,`Connecting the dots…`,`Piecing it together…`],Ri=[`Updating my personality…`,`Finding my voice…`,`Getting into character…`],zi=`Almost there…`,Bi=[...Li,zi],Vi=[...Ri,zi],Hi=2800;function Ui({onDone:e,onBack:t,onAdvance:n,onForward:r,ready:i}){let a=Oi,[o,s]=(0,K.useState)(0);return(0,K.useEffect)(()=>{n?.(o);let t=o>=Bi.length-1;if(i&&t){let t=setTimeout(e,Hi);return()=>clearTimeout(t)}let r=setTimeout(()=>s(e=>(e+1)%Bi.length),Hi);return()=>clearTimeout(r)},[o,i,e,n]),(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:a.fg},children:[(0,q.jsx)(Z,{onBack:t,onNext:r}),(0,q.jsxs)(`div`,{className:`absolute left-1/2 top-[14%] sm:top-[26%] flex w-full max-w-xl -translate-x-1/2 items-start gap-3 px-6`,children:[(0,q.jsx)(ji,{isAssistantBusy:!0}),(0,q.jsx)(qe,{mode:`wait`,children:(0,q.jsx)(H.p,{className:Mi,style:{fontFamily:`var(--font-serif)`},initial:{y:12,opacity:0},animate:{y:0,opacity:1},exit:{y:-12,opacity:0},transition:{duration:.35},children:Bi[o]},o)})]})]})}function Wi({onDone:e,ready:t}){let n=Oi,[r,i]=(0,K.useState)(0);return(0,K.useEffect)(()=>{let n=Vi.length-1;if(t){if(r!==n){i(n);return}let t=setTimeout(e,Hi);return()=>clearTimeout(t)}let a=setTimeout(()=>i(e=>(e+1)%Vi.length),Hi);return()=>clearTimeout(a)},[r,t,e]),(0,q.jsx)(`div`,{className:`absolute inset-0 z-10`,style:{color:n.fg},children:(0,q.jsxs)(`div`,{className:`absolute left-1/2 top-[14%] sm:top-[26%] flex w-full max-w-xl -translate-x-1/2 items-start gap-3 px-6`,children:[(0,q.jsx)(ji,{isAssistantBusy:!0}),(0,q.jsx)(qe,{mode:`wait`,children:(0,q.jsx)(H.p,{className:Mi,style:{fontFamily:`var(--font-serif)`},initial:{y:12,opacity:0},animate:{y:0,opacity:1},exit:{y:-12,opacity:0},transition:{duration:.35},children:Vi[r]},r)})]})})}function Gi({claims:e,loading:t,onContinue:n,onRejectAll:r,onBack:i,onForward:a}){let o=Oi,s=U(),[c,l]=(0,K.useState)(()=>new Set),u=e.filter(e=>!c.has(e.claim)),d=u.length>0,f=!t;return(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:o.fg},children:[(0,q.jsx)(Z,{onBack:i,onNext:a}),(0,q.jsxs)(`div`,{className:`absolute bottom-0 left-1/2 top-[14%] sm:top-[26%] z-10 flex w-full max-w-xl -translate-x-1/2 flex-col px-6 pb-8`,children:[(0,q.jsxs)(`div`,{className:`flex min-h-0 flex-col overflow-y-auto`,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(ji,{}),(0,q.jsx)(`h1`,{className:`text-[2.2rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:`This is what I found about you`})]}),(0,q.jsx)(`p`,{className:`mb-7 mt-2 text-[15px]`,style:{color:o.fgMuted},children:d?t?`Still checking the rest. You can review these as they come in.`:`I searched the web. Feel free to remove anything that isn’t true`:t?`Still putting this together…`:`I didn’t turn up much — we can fill it in as we chat.`}),(0,q.jsx)(`div`,{className:`flex flex-col gap-3`,children:(0,q.jsx)(qe,{children:u.map(e=>(0,q.jsxs)(H.div,{layout:!0,initial:s?!1:{opacity:0,y:10},animate:{opacity:1,y:0},exit:s?void 0:{opacity:0,scale:.95},className:`flex items-center justify-between gap-3 rounded-2xl px-5 py-4 text-[15px]`,style:{backgroundColor:o.isLight?`rgba(0,0,0,0.06)`:`rgba(255,255,255,0.1)`},children:[(0,q.jsx)(`span`,{children:e.claim}),(0,q.jsx)(`button`,{type:`button`,"aria-label":`Remove "${e.claim}"`,onClick:()=>l(t=>new Set(t).add(e.claim)),className:`flex cursor-pointer h-6 w-6 shrink-0 items-center justify-center rounded-full transition-opacity hover:opacity-100`,style:{color:o.fgMuted},children:(0,q.jsx)(v,{className:`h-4 w-4`})})]},e.claim))})}),d&&f&&(0,q.jsx)(`button`,{type:`button`,onClick:r,className:`mt-5 self-start shrink-0 cursor-pointer text-[14px] underline underline-offset-2 transition-opacity hover:opacity-80`,style:{color:o.fgMuted},children:`This is not me`})]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>n([...c]),disabled:!f,className:`mt-8 flex cursor-pointer h-11 w-[200px] shrink-0 items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition duration-150 enabled:active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-60`,style:{backgroundColor:o.isLight?`#1A1A1A`:`#FFFFFF`,color:o.isLight?`#FFFFFF`:`#1A1A1A`},children:[f?`Continue`:`Still searching…`,f&&(0,q.jsx)(W,{className:`h-4 w-4`})]})]})]})}var $=64,Ki=$;function qi({head:e,note:t,flyToNote:n,reduce:r,onLanded:i}){let{components:a,chosen:o}=Ai();if(!a||!o)return null;let s=$/2,c=n&&t?t:e,l={x:c.x-s,y:c.y-s};return(0,q.jsx)(H.div,{className:`pointer-events-none absolute left-0 top-0`,style:{width:$,height:$,transformOrigin:`center`},initial:!1,animate:l,transition:r?{duration:0}:n&&t?{type:`spring`,duration:.9,bounce:.45}:{duration:.4},onAnimationComplete:()=>{n&&t&&i()},children:(0,q.jsx)(m,{components:a,traits:o,size:$})})}function Ji({installedPlugins:e=[],pluginCatalog:t={},onStart:n,onBack:r,onForward:i}){let a=Oi,o=U(),[s,c]=(0,K.useState)(!1),l=e.map(e=>({name:e,displayName:ct(e),description:t[e]?.trim()??``})).filter(e=>e.displayName.length>0),u=l.length>0,d=(0,K.useRef)(null),f=(0,K.useRef)(null),p=(0,K.useRef)(null),[m,h]=(0,K.useState)(null),[g,_]=(0,K.useState)(!1),[v,y]=(0,K.useState)(!1);(0,K.useLayoutEffect)(()=>{let e=()=>{let e=d.current,t=f.current;if(!e||!t)return;let n=e.getBoundingClientRect(),r=e=>({x:e.left-n.left+e.width/2,y:e.top-n.top+e.height/2}),i=p.current;h({head:r(t.getBoundingClientRect()),note:i?r(i.getBoundingClientRect()):void 0})};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[l.length]);let b=m?.note?.y;return(0,K.useEffect)(()=>{b===void 0||g||_(!0)},[b,g]),(0,q.jsxs)(`div`,{className:`absolute inset-0 z-10`,style:{color:a.fg},children:[(0,q.jsx)(Z,{onBack:r,onNext:i}),(0,q.jsxs)(`div`,{ref:d,className:`absolute left-1/2 top-1/2 z-10 flex w-full max-w-xl -translate-x-1/2 -translate-y-1/2 flex-col px-6`,children:[(0,q.jsxs)(`div`,{className:`flex items-center`,children:[(0,q.jsx)(H.div,{ref:f,className:`shrink-0`,style:{height:$},initial:!1,animate:g?{width:0,marginRight:0}:{width:$,marginRight:12},transition:o?{duration:0}:{duration:.5,ease:`easeInOut`}}),(0,q.jsx)(`h1`,{className:`text-[2.2rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:`You’re all set`})]}),u&&(0,q.jsx)(`div`,{className:`mt-4 flex flex-col gap-3`,children:l.map((e,t)=>(0,q.jsxs)(H.div,{initial:o?!1:{opacity:0,y:10},animate:{opacity:1,y:0},transition:o?{duration:0}:{duration:.3,delay:t*.06},className:`rounded-2xl px-5 py-4`,style:{backgroundColor:a.isLight?`rgba(0,0,0,0.06)`:`rgba(255,255,255,0.1)`},children:[(0,q.jsx)(`div`,{className:`text-[15px] font-medium`,children:e.displayName}),e.description&&(0,q.jsx)(`div`,{className:`mt-1 text-[13px] leading-snug`,style:{color:a.fgMuted},children:e.description})]},e.name))}),(0,q.jsxs)(`div`,{className:`mt-16 flex items-center gap-3`,children:[(0,q.jsx)(`div`,{ref:p,className:`shrink-0`,style:{width:Ki}}),(0,q.jsx)(H.p,{className:`text-[15px]`,style:{color:a.fg},initial:!1,animate:{opacity:+!!v,x:v?0:-6},transition:o?{duration:0}:{duration:.35},children:`I’ve set myself up with plugins around who you are.`})]}),(0,q.jsxs)(`button`,{type:`button`,onClick:()=>{s||(c(!0),Promise.resolve().then(n).catch(()=>c(!1)))},disabled:s,className:`mt-16 flex cursor-pointer h-11 w-[200px] items-center justify-center gap-2 rounded-[10px] text-body-medium-default transition duration-150 enabled:active:scale-[0.97] disabled:cursor-not-allowed disabled:opacity-60`,style:{backgroundColor:a.isLight?`#1A1A1A`:`#FFFFFF`,color:a.isLight?`#FFFFFF`:`#1A1A1A`},children:[s?`Starting…`:`Let's chat`,!s&&(0,q.jsx)(W,{className:`h-4 w-4`})]}),m&&(0,q.jsx)(qi,{head:m.head,note:m.note,flyToNote:g&&m.note!==void 0,reduce:o,onLanded:()=>y(!0)})]})]})}var Yi=[{bodyShape:`sprout`,eyeStyle:`curious`,colorIdx:0,base:230,pos:e=>({left:-e*.32,top:`40%`})},{bodyShape:`flower`,eyeStyle:`goofy`,colorIdx:1,base:230,pos:e=>({right:-e*.32,top:`40%`})},{bodyShape:`star`,eyeStyle:`dazed`,colorIdx:2,base:240,mobile:!0,pos:e=>({left:`16%`,bottom:-e*.42}),mobilePos:e=>({left:-e*.3,bottom:-e*.3})},{bodyShape:`burst`,eyeStyle:`angry`,colorIdx:0,base:240,mobile:!0,pos:e=>({right:`16%`,bottom:-e*.42}),mobilePos:e=>({right:-e*.3,bottom:-e*.3})},{bodyShape:`blob`,eyeStyle:`gentle`,colorIdx:1,base:220,pos:e=>({left:`42%`,bottom:-e*.5})},{bodyShape:`urchin`,eyeStyle:`curious`,colorIdx:2,base:220,mobile:!0,pos:e=>({left:-e*.28,bottom:`16%`}),mobilePos:e=>({left:-e*.3,top:-e*.3})},{bodyShape:`burst`,eyeStyle:`quirky`,colorIdx:0,base:220,mobile:!0,pos:e=>({right:-e*.28,bottom:`16%`}),mobilePos:e=>({right:-e*.3,top:-e*.3})},{bodyShape:`flower`,eyeStyle:`quirky`,colorIdx:1,base:230,pos:e=>({left:`30%`,bottom:-e*.4})}],Xi=`#17191C`,Zi=[{bodyShape:`blob`,eyeStyle:`gentle`},{bodyShape:`urchin`,eyeStyle:`curious`},{bodyShape:`star`,eyeStyle:`goofy`}],Qi=290;function $i({peekLevel:e=0,eyesBumpNonce:t=0,darkBg:n=!1,showBottomEyes:r=!0,showTopTeam:i=!1}){let a=G(),o=J.use.characters(),s=J.use.selectedIndex(),c=U(),{w:l}=er(),u=Math.max(.42,Math.min(l/1100,1)),d=l<640,f=o.length>0?o[s]:void 0,{bg:p,peekColors:h}=(0,K.useMemo)(()=>!a||!f?{bg:`var(--surface-base)`,peekColors:[]}:{bg:a.colors.find(e=>e.id===f.color)?.hex??`var(--surface-base)`,peekColors:$r(f.color,a.colors.map(e=>e.id),3)},[a,f]);return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(H.div,{className:`absolute inset-0 z-0`,initial:!1,animate:{backgroundColor:n?Xi:p},transition:c?{duration:0}:{duration:1,ease:`easeInOut`}}),r&&(0,q.jsx)(Br,{bumpNonce:t,settleBlink:!1}),i&&a&&(0,q.jsx)(`div`,{className:`pointer-events-none absolute right-0 z-[1] flex items-start`,style:{top:-Math.round(Qi*u)*.42,right:-Math.round(Qi*u)*.12},children:Zi.map((e,t)=>{let n=Math.round(Qi*u);return(0,q.jsx)(H.div,{style:{width:n,height:n,marginLeft:t===0?0:-n*.34,zIndex:Zi.length-t},initial:c?!1:{y:-140,opacity:0},animate:{y:0,opacity:1},transition:c?{duration:0}:{type:`spring`,stiffness:200,damping:18,delay:t*.1},children:(0,q.jsx)(m,{components:a,traits:{bodyShape:e.bodyShape,eyeStyle:e.eyeStyle,color:h[t]??`teal`},size:n,breathe:!1})},e.bodyShape)})}),a&&(0,q.jsx)(qe,{children:(d?Yi.filter(e=>e.mobile):Yi).slice(0,Math.max(0,e)).map((e,t)=>{let n=Math.round(e.base*u),r=d&&e.mobilePos?e.mobilePos(n):e.pos(n);return(0,q.jsx)(H.div,{"aria-hidden":`true`,className:`pointer-events-none absolute z-[1]`,style:{...r,width:n,height:n},initial:c?!1:{scale:0,opacity:0},animate:{scale:1,opacity:1},exit:c?void 0:{scale:0,opacity:0},transition:c?{duration:0}:{type:`spring`,stiffness:220,damping:16,delay:.1},children:(0,q.jsx)(m,{components:a,traits:{bodyShape:e.bodyShape,eyeStyle:e.eyeStyle,color:h[e.colorIdx]??`teal`},size:n,breathe:!1})},`peek-${t}`)})})]})}var ea={established:!1,assistantName:null};async function ta(e,t={hasAnyActiveConversation:L,fetchAssistantIdentity:Qe}){try{if(!await t.hasAnyActiveConversation(e))return ea}catch(e){return n(e,{context:`research_onboarding_established_check`}),ea}let r=await t.fetchAssistantIdentity(e).catch(()=>null);return{established:!0,assistantName:(typeof r?.name==`string`?r.name.trim():``)||null}}function na({assistantName:e,onKeep:t,onRedo:n,onBack:r}){let i=e?.trim()||``,o=i||`your assistant`,s=i?`${i}'s`:`its`;return(0,q.jsxs)(`div`,{"data-theme":`dark`,className:`relative h-full overflow-hidden`,style:{backgroundColor:`var(--surface-base)`,color:`var(--content-primary)`},children:[(0,q.jsx)(Z,{onBack:r,tone:`light`}),(0,q.jsxs)(`div`,{className:`${_t} max-w-xl`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col items-center gap-3`,children:[(0,q.jsx)(`h1`,{className:`text-[2.2rem] leading-none`,style:{fontFamily:`var(--font-serif)`},children:i?`${i} is already up and running`:`Your assistant is already up and running`}),(0,q.jsxs)(`p`,{className:`text-[15px]`,style:{color:`var(--content-secondary)`},children:[`You two have history — a personality, memories, and past conversations. Running setup again would overwrite who `,o,` is now.`]})]}),(0,q.jsxs)(`div`,{className:`flex w-full max-w-sm flex-col items-center gap-3`,children:[(0,q.jsxs)(a,{variant:`primary`,size:`regular`,fullWidth:!0,onClick:t,className:`h-11 text-base`,children:[`Keep `,o,` and start chatting`,(0,q.jsx)(W,{className:`h-4 w-4`})]}),(0,q.jsxs)(a,{variant:`ghost`,size:`regular`,fullWidth:!0,onClick:n,className:`h-11 text-base`,children:[`Start over and rebuild `,s,` personality`]})]})]})]})}var ra=4e3;function ia(e){return{firstName:e.firstName,lastName:e.lastName,occupation:e.role,hobbies:e.hobbies,timezone:me()}}function aa(e){let t=e.firstName.trim();return t?`Getting to know ${t}`:`Getting to know you`}ot();function oa(){let e=s(),t=oe.use.user(),n=t?.id??null,r=tt.use.enterFocus(),i=tt.use.exitFocus(),a=tt.use.setPendingAvatarTraits(),c=tt.use.requestSidebarCollapse(),[l,u]=(0,K.useState)(`form`),{ref:d,size:f}=pt(),[p,m]=(0,K.useState)([]),[h,g]=(0,K.useState)(!1);function _(e){u(e)}function v(e,t=`completed`){et(Ze[l],{userId:n,outcome:t}),m([]),_(e)}function y(e){m(e=>[...e,l]),_(e)}function b(){let e=p[p.length-1];e&&(m(e=>e.slice(0,-1)),_(e))}let x=p.length>0?b:void 0,[S,C]=(0,K.useState)(null),w=(0,K.useRef)(null),[T,E]=(0,K.useState)(null),[O,A]=(0,K.useState)(null),j=(0,K.useRef)(!1),[M,N]=(0,K.useState)(null),[ee,te]=(0,K.useState)({}),[ne,re]=(0,K.useState)(!1),[P,F]=(0,K.useState)(null),[ie,se]=(0,K.useState)(null),[ce,le]=(0,K.useState)(!1),[ue,I]=(0,K.useState)(!1),[me,L]=(0,K.useState)(!1),[ye,be]=(0,K.useState)(0),[xe,Se]=(0,K.useState)(0),[Ce]=o(),we=ln({hostingParam:Ce.get(`hosting`),localMode:k(),gatewayAuthSession:D()}),Te=Ce.get(`assistant`)??void 0,Ee=we,{start:De,ready:Oe,assistantId:R,error:ke,awaitReady:z}=hn({adoptExisting:we,adoptAssistantId:Te}),B=Un(),{start:Ae,hydrate:V}=B,je=(0,K.useRef)(Promise.resolve()),Me=(0,K.useRef)(Promise.resolve()),[Ne,Pe]=(0,K.useState)(!1),Fe=B.status===`idle`||B.status===`running`,Ie=!Fe&&B.claims.length===0;(0,K.useEffect)(()=>{i(),a(null),De()},[i,a,De]),(0,K.useEffect)(()=>{if(w.current)return;let e=z().then(e=>ta(e)).catch(()=>ea);w.current=e,e.then(E)},[z]),(0,K.useLayoutEffect)(()=>{if(h||!n)return;let e=ge(n);if(e?.formValues){C(e.formValues),N(e.faceValues),se(e.checkinTime),I(e.checkinBooked),F(e.researchConversationId??null),e.research&&V({...e.research,pluginCatalog:e.research.pluginCatalog??{}},z);let t=_e(e);u(Ee&&(t===`letschat`||t===`meeting`)?`looking`:t),m([])}g(!0)},[h,n,V,z,Ee]),(0,K.useEffect)(()=>{!h||!S||he(n,{step:l,formValues:S,faceValues:M,checkinTime:ie,checkinBooked:ue,research:B.status===`done`?{status:`done`,claims:B.claims,suggestions:B.suggestions,installedPlugins:B.installedPlugins,pluginCatalog:B.pluginCatalog}:null,...P?{researchConversationId:P}:{}})},[h,n,l,S,M,ie,ue,P,B.status,B.claims,B.suggestions,B.installedPlugins,B.pluginCatalog]),(0,K.useEffect)(()=>{h&&(!S||B.status!==`idle`||Ae({awaitAssistantId:z,subject:ia(S),conversationTitle:aa(S),...P?{resumeConversationId:P}:{},onConversationCreated:F,includeSuggestions:!1}))},[h,S,P,B.status,Ae,z,!0]),(0,K.useEffect)(()=>{l===`results`&&Ie&&(m([]),u(`suggestions`))},[l,Ie]);function Le(t,i,o,{skip:s=!1,hidden:l=!1}={}){ve(n);let{firstName:u,lastName:d,role:f,hobbies:p}=t,m=[u.trim(),d.trim()].filter(Boolean).join(` `),h=u.trim(),g=!s&&o===void 0;pe({tools:[],tasks:[],tone:yt,...m?{userName:m}:{},...f.trim()?{occupation:f.trim()}:{},...s?{}:{initialMessage:o??cn({firstName:u,lastName:d,occupation:f,hobbies:p}),...l?{initialMessageHidden:!0}:{}},...g?{title:h?`Getting to know ${h}`:`Getting to know you`}:{},...i?.name?.trim()?{assistantName:i.name.trim()}:{}});let _=i?.name?.trim();_&&fe(_),a(i?.traits??null),g&&r(),s||ae.markExpectingFirstMessage(),c(),ae.checkAssistant(R??void 0).finally(()=>{e(`${de.assistant}?onboarding=1`,{replace:!0})})}async function Re(){S&&(await Promise.all([B.awaitPluginInstalls(),je.current,Me.current]),Le(S,M,Xn(M?.name),{hidden:!0}))}function ze(e){B.start({awaitAssistantId:z,subject:ia(e),conversationTitle:aa(e),onConversationCreated:F,includeSuggestions:!1})}async function Be(e){if(!j.current&&(T??await Promise.race([w.current??Promise.resolve(null),new Promise(e=>{setTimeout(()=>e(null),ra)})]))?.established){A(e),v(`existing`);return}C(e),ze(e),v(`face`)}function Ve(e){if(e.length>0&&!e.includes(`https://www.googleapis.com/auth/calendar.events`)){L(!0);return}if(L(!1),R&&S){let e=[S.firstName.trim(),S.lastName.trim()].filter(Boolean).join(` `);se(null),I(!1),le(!0),lt({assistantId:R,userName:e||void 0,assistantName:M?.name?.trim()||void 0}).then(e=>{e.scheduled&&(I(!0),se(Zn(e.start,e.timeZone)))}).finally(()=>le(!1))}v(`meeting`)}if([`different`,`personality`,`integration`,`letschat`,`meeting`,`looking`,`results`,`suggestions`,`finishing`].includes(l)&&S){let e=[`meeting`,`looking`,`results`,`suggestions`,`finishing`].includes(l);return(0,q.jsx)(`div`,{ref:d,"data-theme":`dark`,className:`relative h-full overflow-hidden`,children:(0,q.jsxs)($n,{size:f,children:[(0,q.jsx)($i,{eyesBumpNonce:ye,peekLevel:[`looking`,`results`,`suggestions`,`finishing`].includes(l)?xe:0,darkBg:e,showBottomEyes:!e&&l!==`different`}),l===`different`&&(0,q.jsx)(ci,{onContinue:()=>v(`personality`),onBack:()=>y(`intro`),onForward:x}),l===`personality`&&(0,q.jsx)(Ei,{values:ee,onValueChange:(e,t)=>te(n=>({...n,[e]:t})),locked:ne,onContinue:()=>{ne||(Pe(!0),Me.current=Yn({awaitAssistantId:z,values:ee,userName:S?.firstName?.trim()||void 0,assistantName:M?.name?.trim()||void 0}).finally(()=>Pe(!1)),re(!0)),v(`integration`)},onBack:()=>y(`different`),onForward:x}),l===`integration`&&(0,q.jsx)(pi,{onClaim:()=>v(Ee?`looking`:`letschat`),onBumpEyes:()=>be(e=>e+1),onBack:()=>y(`personality`),onForward:x}),l===`letschat`&&(0,q.jsx)(Di,{assistantId:R,assistantReady:Oe,hatchError:ke,onConnected:Ve,missingCalendarScope:me,onRetry:()=>L(!1),onSkip:()=>{L(!1),v(`looking`,`skipped`)},onBack:()=>y(`integration`),onForward:x}),l===`meeting`&&(0,q.jsx)(Ii,{scheduledTime:ie??void 0,awaitingTime:ce,onDone:()=>v(`looking`),onBack:()=>y(`letschat`),onForward:x}),l===`looking`&&(0,q.jsx)(Ui,{onDone:()=>v(Ie?`suggestions`:`results`),onBack:()=>y(Ee?`integration`:`letschat`),onAdvance:e=>Se(Math.min(e+1,4)),onForward:x,ready:!Fe}),l===`results`&&(0,q.jsx)(Gi,{claims:B.claims,loading:Fe,onContinue:e=>{P&&R&&e.length>0&&(je.current=Gn({assistantId:R,conversationId:P,removedClaims:e,rejectedAll:!1})),v(`suggestions`)},onRejectAll:()=>{P&&R&&(je.current=Gn({assistantId:R,conversationId:P,removedClaims:B.claims.map(e=>e.claim),rejectedAll:!0})),v(`suggestions`,`skipped`)},onBack:()=>y(`looking`),onForward:x}),l===`suggestions`&&(0,q.jsx)(Ji,{installedPlugins:B.installedPlugins,pluginCatalog:B.pluginCatalog,onStart:async()=>{if(et(Ze.suggestions,{userId:n,outcome:`completed`}),Ne){m([]),u(`finishing`);return}await Re()},onBack:()=>y(Ie?`looking`:`results`),onForward:x}),l===`suggestions`&&!1,l===`finishing`&&(0,q.jsx)(Wi,{ready:!Ne,onDone:()=>void Re()})]})})}return l===`existing`?(0,q.jsx)(na,{assistantName:T?.assistantName??null,onKeep:()=>{et(Ze.existing,{userId:n,outcome:`completed`}),ve(n),ae.checkAssistant(R??void 0).finally(()=>{e(de.assistant,{replace:!0})})},onRedo:()=>{let e=O;e&&(j.current=!0,et(Ze.existing,{userId:n,outcome:`skipped`}),C(e),ze(e),m([]),_(`face`))},onBack:()=>{A(null),y(`form`)}}):l===`intro`&&S?(0,q.jsx)(Ur,{firstName:S.firstName,assistantName:M?.name,onContinue:()=>v(`different`),onBack:()=>y(`face`),onForward:x}):l===`face`&&S?(0,q.jsx)(Mr,{onContinue:e=>{N(e),v(`intro`)},onBack:()=>y(`form`),onForward:x}):(0,q.jsx)(Or,{initialFirstName:t?.firstName??``,initialLastName:t?.lastName??``,onSubmit:Be})}export{oa as ResearchOnboardingRoute};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./shield-check-BOKWBJve.js";import{t as s}from"./is-electron-DBOtwp5h.js";import{d as c,i as l,n as u}from"./auth-store-B6EXnaee.js";import{t as d}from"./return-to-BVIOUdUp.js";import{c as f}from"./routes-XPLb07Av.js";import{c as p,d as m,f as h,l as g,p as _,u as v}from"./prefs-wApndUEh.js";import{Ir as y,vn as b}from"./index-CZVGv7Cn.js";import{n as x,t as S}from"./consent-controls-CiU4EkLm.js";var C=e(t(),1),w={},T={"2026-06-22":[`Introduces Together AI as a new managed model provider`]};function E(e){return w[e]??[]}function D(e){return T[e]??[]}var O=a();function k(){let e=i(),[t]=r(),a=u.use.user()?.id??null,w=u.use.logout(),T=s(),k=l(),[A,j]=_(),[M,N]=v(),[P,F]=m(),[I,L]=h(),[R]=p(),[z]=g(),B=P??!0,V=I??!0,[H]=(0,C.useState)(()=>!A),[U]=(0,C.useState)(()=>!M),[W]=(0,C.useState)(()=>!R),[G]=(0,C.useState)(()=>!z),K=!H&&!U&&!W&&!G,q=H||K,J=U||K,Y=W||K,X=G||K,Z=!K&&!H&&!U,Q=K?`Terms & privacy`:Z?`Review your privacy preferences`:`Updated terms`,$=K?`Review your terms and privacy preferences anytime.`:Z?`Confirm your privacy preferences to continue.`:`We've updated our terms. Please review and accept to continue.`,ee=(0,C.useCallback)(()=>{c({userId:a,tos:A,privacy:M,shareAnalytics:Y?B:null,shareDiagnostics:X?V:null,hasPlatformSession:k}),e(d(t.get(`returnTo`),f.assistant),{replace:!0})},[M,k,e,t,B,V,Y,X,A,a]),te=(0,C.useCallback)(async()=>{await w(),y(f.account.login)},[w]),ne=q&&!A||J&&!M;return(0,O.jsx)(b,{showCreatureFooter:!1,children:(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${T?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full border border-[var(--border-subtle)] bg-[var(--surface-lift)]`,style:{animation:`fadeInUp 0.5s ease-out 0.05s both`},children:(0,O.jsx)(o,{className:`h-6 w-6 text-[var(--content-secondary)]`,strokeWidth:1.75})}),(0,O.jsx)(`h1`,{className:`mt-5 ${T?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,style:{animation:`fadeInUp 0.5s ease-out 0.12s both`},children:Q}),(0,O.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${T?`mt-3`:`mt-3.5`}`,style:{animation:`fadeInUp 0.5s ease-out 0.2s both`},children:$}),(Y||X)&&(0,O.jsx)(x,{electron:T,showAnalytics:Y,showDiagnostics:X,shareAnalytics:B,shareDiagnostics:V,onShareAnalyticsChange:F,onShareDiagnosticsChange:L,className:`mt-9 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.28s both`}}),(J||q)&&(0,O.jsx)(S,{electron:T,showPrivacy:J,showTos:q,privacyConsent:M,tosAccepted:A,onPrivacyChange:N,onTosChange:j,privacyNotes:J?D(`2026-06-22`):[],tosNotes:q?E(`2026-06-08`):[],className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.36s both`}}),(0,O.jsxs)(`div`,{className:`mt-9 flex w-full flex-col ${T?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.44s both`},children:[(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:ne,onClick:ee,className:T?void 0:`h-11 text-base`,children:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:te,className:T?void 0:`h-11 text-base`,children:`Log out`})]})]})})}export{k as ReviewTermsScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./shield-check-BOKWBJve.js";import{t as s}from"./is-electron-DBOtwp5h.js";import{d as c,i as l,n as u}from"./auth-store-B6EXnaee.js";import{t as d}from"./return-to-BVIOUdUp.js";import{c as f}from"./routes-XPLb07Av.js";import{c as p,d as m,f as h,l as g,p as _,u as v}from"./prefs-wApndUEh.js";import{Lr as y,vn as b}from"./index-CgcZXB4g.js";import{n as x,t as S}from"./consent-controls-CiU4EkLm.js";var C=e(t(),1),w={},T={"2026-06-22":[`Introduces Together AI as a new managed model provider`]};function E(e){return w[e]??[]}function D(e){return T[e]??[]}var O=a();function k(){let e=i(),[t]=r(),a=u.use.user()?.id??null,w=u.use.logout(),T=s(),k=l(),[A,j]=_(),[M,N]=v(),[P,F]=m(),[I,L]=h(),[R]=p(),[z]=g(),B=P??!0,V=I??!0,[H]=(0,C.useState)(()=>!A),[U]=(0,C.useState)(()=>!M),[W]=(0,C.useState)(()=>!R),[G]=(0,C.useState)(()=>!z),K=!H&&!U&&!W&&!G,q=H||K,J=U||K,Y=W||K,X=G||K,Z=!K&&!H&&!U,Q=K?`Terms & privacy`:Z?`Review your privacy preferences`:`Updated terms`,$=K?`Review your terms and privacy preferences anytime.`:Z?`Confirm your privacy preferences to continue.`:`We've updated our terms. Please review and accept to continue.`,ee=(0,C.useCallback)(()=>{c({userId:a,tos:A,privacy:M,shareAnalytics:Y?B:null,shareDiagnostics:X?V:null,hasPlatformSession:k}),e(d(t.get(`returnTo`),f.assistant),{replace:!0})},[M,k,e,t,B,V,Y,X,A,a]),te=(0,C.useCallback)(async()=>{await w(),y(f.account.login)},[w]),ne=q&&!A||J&&!M;return(0,O.jsx)(b,{showCreatureFooter:!1,children:(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${T?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`div`,{className:`flex h-12 w-12 items-center justify-center rounded-full border border-[var(--border-subtle)] bg-[var(--surface-lift)]`,style:{animation:`fadeInUp 0.5s ease-out 0.05s both`},children:(0,O.jsx)(o,{className:`h-6 w-6 text-[var(--content-secondary)]`,strokeWidth:1.75})}),(0,O.jsx)(`h1`,{className:`mt-5 ${T?`text-title-large`:`text-3xl font-semibold tracking-tight`}`,style:{animation:`fadeInUp 0.5s ease-out 0.12s both`},children:Q}),(0,O.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${T?`mt-3`:`mt-3.5`}`,style:{animation:`fadeInUp 0.5s ease-out 0.2s both`},children:$}),(Y||X)&&(0,O.jsx)(x,{electron:T,showAnalytics:Y,showDiagnostics:X,shareAnalytics:B,shareDiagnostics:V,onShareAnalyticsChange:F,onShareDiagnosticsChange:L,className:`mt-9 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.28s both`}}),(J||q)&&(0,O.jsx)(S,{electron:T,showPrivacy:J,showTos:q,privacyConsent:M,tosAccepted:A,onPrivacyChange:N,onTosChange:j,privacyNotes:J?D(`2026-06-22`):[],tosNotes:q?E(`2026-06-08`):[],className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.36s both`}}),(0,O.jsxs)(`div`,{className:`mt-9 flex w-full flex-col ${T?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.44s both`},children:[(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:ne,onClick:ee,className:T?void 0:`h-11 text-base`,children:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:te,className:T?void 0:`h-11 text-base`,children:`Log out`})]})]})})}export{k as ReviewTermsScreen};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-BGD3-GQf.js";import{t as n}from"./react-DJZBPgpf.js";import{P as r,t as i}from"./button-BQVYX8n_.js";import{f as a,u as o}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{n as s}from"./QueryClientProvider-DKhXIxGb.js";import{t as c}from"./useQuery-B45lW1Kk.js";import{t as l}from"./jsx-runtime-CVSDxk6A.js";import{t as u}from"./typography-Cqi8q9o7.js";import{t as d}from"./createLucideIcon-Bjb-Kuq7.js";import{t as f}from"./calendar-D0labpMU.js";import{t as p}from"./chevron-down-DpYf9Gwq.js";import{t as m}from"./chevron-right-jRymmL7S.js";import{t as h}from"./clock-LiCGqvyn.js";import{t as g}from"./loader-circle-D57RZgLH.js";import{t as _}from"./repeat-CS_kgMdk.js";import{t as v}from"./x-CswtfvgS.js";import{t as y}from"./notice-BylgS5W_.js";import{i as b,j as x}from"./src-CDdn26Yb.js";import{t as S}from"./tag-B6WeUtBW.js";import{n as C,t as w}from"./input-ZpyYt_a0.js";import{t as T}from"./toggle-QSEiPr3k.js";import{t as E}from"./modal-BtcwNEBj.js";import{t as D}from"./panel-item-Bvqsr5n9.js";import{n as O}from"./toast-ZoZVyeDI.js";import{t as k}from"./dropdown-BMNSccmo.js";import{Bt as A,F as j,Jt as M,M as N,N as P,P as ee,Yt as te,_ as F,c as I,d as L,dt as ne,ft as re,g as R,j as ie,mt as ae,pt as oe,ut as se,v as ce,y as le}from"./react-query.gen-BQH0QRfT.js";import{a as ue}from"./api-BBMl4mW3.js";import{c as z}from"./routes-XPLb07Av.js";import{t as B}from"./effective-timezone-Ct3PoWNH.js";import{t as V}from"./assistant-feature-flag-store-BpbbAIKZ.js";import{$n as H,Br as de,Ma as fe,Qi as pe,Ui as me,Xa as he,ia as ge,zr as _e}from"./index-CgcZXB4g.js";import{t as ve}from"./use-active-assistant-id-9rGx8kT9.js";import{t as ye}from"./detail-card-CA8lPa5K.js";import{a as be,c as xe,i as Se,l as Ce,n as we,o as Te,r as Ee,s as De,t as Oe,u as ke}from"./page-empty-state-DbCk3v6f.js";import{r as Ae,t as je}from"./profile-metadata-DZwV-VFB.js";var Me=d(`chart-column`,[[`path`,{d:`M3 3v16a2 2 0 0 0 2 2h16`,key:`c24i48`}],[`path`,{d:`M18 17V9`,key:`2bz60n`}],[`path`,{d:`M13 17V5`,key:`1frdt8`}],[`path`,{d:`M8 17v-3`,key:`17ska0`}]]),U=e(n(),1),Ne={frequency:`daily`,minute:0,hour24:9,weekdays:[1],dayOfMonth:1},W=[{value:0,letter:`S`,short:`Sun`,full:`Sunday`},{value:1,letter:`M`,short:`Mon`,full:`Monday`},{value:2,letter:`T`,short:`Tue`,full:`Tuesday`},{value:3,letter:`W`,short:`Wed`,full:`Wednesday`},{value:4,letter:`T`,short:`Thu`,full:`Thursday`},{value:5,letter:`F`,short:`Fri`,full:`Friday`},{value:6,letter:`S`,short:`Sat`,full:`Saturday`}],Pe=[1,2,3,4,5];function G(e,t,n){return Number.isFinite(e)?Math.min(n,Math.max(t,Math.round(e))):t}function Fe(e){let t=Array.from(new Set(e.map(e=>G(e,0,6)).filter(e=>Number.isInteger(e)))).sort((e,t)=>e-t);return t.length>0?t:[1]}function Ie(e){let t=G(e.minute,0,59),n=G(e.hour24,0,23);switch(e.frequency){case`hourly`:return`${t} * * * *`;case`daily`:return`${t} ${n} * * *`;case`weekly`:return`${t} ${n} * * ${Fe(e.weekdays).join(`,`)}`;case`monthly`:return e.dayOfMonth===`last`?`${t} ${n} L * *`:`${t} ${n} ${G(e.dayOfMonth,1,28)} * *`}}function Le(e,t){let n=G(e,0,23),r=G(t,0,59),i=n<12?`AM`:`PM`;return`${n%12==0?12:n%12}:${String(r).padStart(2,`0`)} ${i}`}function Re(e){let t=[`th`,`st`,`nd`,`rd`],n=e%100;return`${e}${t[(n-20)%10]??t[n]??t[0]}`}function ze(e){let t=Fe(e),n=new Set(t);if(t.length===7)return`every day`;if(t.length===5&&Pe.every(e=>n.has(e)))return`every weekday`;if(t.length===2&&n.has(0)&&n.has(6))return`every weekend`;if(t.length===1)return`every ${W[t[0]]?.full??`day`}`;let r=t.map(e=>W[e]?.short??``),i=r.pop();return`every ${r.join(`, `)} & ${i}`}function Be(e){let t=Le(e.hour24,e.minute);switch(e.frequency){case`hourly`:{let t=G(e.minute,0,59);return`Runs every hour at :${String(t).padStart(2,`0`)}`}case`daily`:return`Runs every day at ${t}`;case`weekly`:return`Runs ${ze(e.weekdays)} at ${t}`;case`monthly`:return e.dayOfMonth===`last`?`Runs on the last day of every month at ${t}`:`Runs on the ${Re(G(e.dayOfMonth,1,28))} of every month at ${t}`}}var K=l(),Ve=[{value:`hourly`,label:`Hourly`},{value:`daily`,label:`Daily`},{value:`weekly`,label:`Weekly`},{value:`monthly`,label:`Monthly`}],He=Array.from({length:12},(e,t)=>{let n=t+1;return{value:String(n),label:String(n)}}),Ue=Array.from({length:12},(e,t)=>{let n=t*5,r=String(n).padStart(2,`0`);return{value:r,label:r}}),We=[...Array.from({length:28},(e,t)=>{let n=t+1;return{value:String(n),label:Re(n)}}),{value:`last`,label:`Last day`}],Ge=[{value:`AM`,label:`AM`},{value:`PM`,label:`PM`}];function Ke(e,t){let n=e%12;return t===`PM`?n+12:n}function qe(e){try{let t=new Intl.DateTimeFormat(`en-US`,{timeZone:e,timeZoneName:`short`}).formatToParts(new Date).find(e=>e.type===`timeZoneName`)?.value;return t&&t!==e?`${e} · ${t}`:e}catch{return e}}function Je({isOpen:e,assistantId:t,onClose:n,onCreated:r}){return(0,K.jsx)(E.Root,{open:e,onOpenChange:e=>{e||n()},children:e?(0,K.jsx)(Ye,{assistantId:t,onClose:n,onCreated:r}):null})}function Ye({assistantId:e,onClose:t,onCreated:n}){let r=H(),[a,o]=(0,U.useState)(``),[s,c]=(0,U.useState)(``),[l,u]=(0,U.useState)(``),[d,f]=(0,U.useState)(`simple`),[p,m]=(0,U.useState)(Ne),[h,g]=(0,U.useState)(``),[_,v]=(0,U.useState)(!1),[y,b]=(0,U.useState)(null),x=a.trim(),S=s.trim(),T=l.trim(),D=h.trim(),O=(0,U.useMemo)(()=>d===`simple`?Ie(p):D,[d,p,D]),k=(0,U.useMemo)(()=>d===`simple`?Be(p):D||`Enter a cron expression to continue.`,[d,p,D]),A=(0,U.useMemo)(()=>qe(r),[r]),j=x.length>0&&S.length>0&&T.length>0&&O.length>0&&!_;return(0,K.jsxs)(E.Content,{size:`md`,children:[(0,K.jsxs)(E.Header,{children:[(0,K.jsx)(E.Title,{children:`Create schedule`}),(0,K.jsx)(E.Description,{children:`Schedule a recurring instruction for your assistant. Runs in execute mode — the message is delivered to the assistant on each fire.`})]}),(0,K.jsxs)(`form`,{onSubmit:async t=>{if(t.preventDefault(),j){v(!0),b(null);try{await we(e,{name:x,description:S,expression:O,message:T,timezone:r}),v(!1),n()}catch(e){b(e instanceof Error?e.message:`Failed to create schedule.`),v(!1)}}},children:[(0,K.jsx)(E.Body,{children:(0,K.jsxs)(`div`,{className:`flex flex-col gap-5`,children:[(0,K.jsx)(w,{label:`Name`,placeholder:`Morning briefing`,value:a,onChange:e=>o(e.target.value),required:!0,autoFocus:!0,fullWidth:!0}),(0,K.jsx)(C,{label:`Description`,placeholder:`What is this schedule for?`,value:s,onChange:e=>c(e.target.value),required:!0,fullWidth:!0,rows:2}),(0,K.jsx)(et,{label:`Repeat`,children:d===`simple`?(0,K.jsx)(Xe,{cadence:p,onChange:m}):(0,K.jsx)($e,{value:h,onChange:g,onUseSimple:()=>f(`simple`)})}),(0,K.jsx)(tt,{summary:k,mono:d===`advanced`&&D.length>0,timezoneLabel:A}),d===`simple`?(0,K.jsx)(`button`,{type:`button`,onClick:()=>{g(e=>e||Ie(p)),f(`advanced`)},className:`self-start text-body-small-default text-[var(--content-tertiary)] underline-offset-2 transition-colors hover:text-[var(--content-default)] hover:underline`,children:`Advanced — write a cron expression`}):null,(0,K.jsx)(C,{label:`Message`,placeholder:`What should the assistant do on each fire?`,value:l,onChange:e=>u(e.target.value),required:!0,fullWidth:!0,rows:4}),y?(0,K.jsx)(`p`,{className:`text-body-small-default text-[var(--system-negative-strong)]`,children:y}):null]})}),(0,K.jsxs)(E.Footer,{children:[(0,K.jsx)(i,{variant:`outlined`,onClick:t,type:`button`,children:`Cancel`}),(0,K.jsx)(i,{variant:`primary`,type:`submit`,disabled:!j,children:_?`Creating…`:`Create schedule`})]})]})]})}function Xe({cadence:e,onChange:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,K.jsx)(x,{items:Ve,value:e.frequency,onChange:n=>t({...e,frequency:n}),ariaLabel:`How often the schedule runs`}),e.frequency===`hourly`?(0,K.jsx)(q,{label:`At minute`,children:(0,K.jsx)(k,{options:Ue,value:String(e.minute).padStart(2,`0`),onChange:n=>t({...e,minute:Number(n)}),"aria-label":`Minute`,className:`w-24`})}):null,e.frequency===`weekly`?(0,K.jsx)(q,{label:`On these days`,children:(0,K.jsx)(Qe,{value:e.weekdays,onChange:n=>t({...e,weekdays:n})})}):null,e.frequency===`monthly`?(0,K.jsx)(q,{label:`On day`,children:(0,K.jsx)(k,{options:We,value:e.dayOfMonth===`last`?`last`:String(e.dayOfMonth),onChange:n=>t({...e,dayOfMonth:n===`last`?`last`:Number(n)}),"aria-label":`Day of month`,className:`w-32`})}):null,e.frequency===`hourly`?null:(0,K.jsx)(q,{label:`At time`,children:(0,K.jsx)(Ze,{hour24:e.hour24,minute:e.minute,onChange:(n,r)=>t({...e,hour24:n,minute:r})})})]})}function Ze({hour24:e,minute:t,onChange:n}){let r=e<12?`AM`:`PM`,i=e%12==0?12:e%12;return(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(k,{options:He,value:String(i),onChange:e=>n(Ke(Number(e),r),t),"aria-label":`Hour`,className:`w-[72px]`}),(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`:`}),(0,K.jsx)(k,{options:Ue,value:String(t).padStart(2,`0`),onChange:t=>n(e,Number(t)),"aria-label":`Minute`,className:`w-[72px]`}),(0,K.jsx)(`div`,{className:`w-[112px]`,children:(0,K.jsx)(x,{items:Ge,value:r,onChange:e=>n(Ke(i,e),t),ariaLabel:`AM or PM`})})]})}function Qe({value:e,onChange:t}){let n=new Set(e),i=e=>{let r=new Set(n);r.has(e)?r.size>1&&r.delete(e):r.add(e),t([...r].sort((e,t)=>e-t))};return(0,K.jsx)(`div`,{className:`flex gap-1.5`,children:W.map(e=>{let t=n.has(e.value);return(0,K.jsx)(`button`,{type:`button`,onClick:()=>i(e.value),"aria-pressed":t,"aria-label":e.full,title:e.full,className:r(`flex h-9 w-9 items-center justify-center rounded-md border text-body-medium-default transition-colors`,t?`border-[var(--border-active)] bg-[var(--surface-active)] text-[var(--content-emphasised)]`:`border-[var(--field-border)] text-[var(--content-tertiary)] hover:border-[var(--border-active)] hover:text-[var(--content-default)]`),children:e.letter},e.value)})})}function $e({value:e,onChange:t,onUseSimple:n}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,K.jsx)(w,{placeholder:`0 9 * * *`,value:e,onChange:e=>t(e.target.value),fullWidth:!0,className:`font-mono`,"aria-label":`Cron expression`,helperText:`Standard 5-field cron (minute hour day month weekday). RRULE expressions are also accepted.`}),(0,K.jsx)(`button`,{type:`button`,onClick:n,className:`self-start text-body-small-default text-[var(--content-tertiary)] underline-offset-2 transition-colors hover:text-[var(--content-default)] hover:underline`,children:`← Back to the simple builder`})]})}function et({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:e}),t]})}function q({label:e,children:t}){return(0,K.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5`,children:[(0,K.jsx)(`span`,{className:`min-w-[88px] text-body-small-default text-[var(--content-tertiary)]`,children:e}),t]})}function tt({summary:e,mono:t,timezoneLabel:n}){return(0,K.jsxs)(`div`,{className:`flex items-start gap-3 rounded-lg border border-[var(--border-subtle)] bg-[var(--surface-lift)] px-3.5 py-3`,children:[(0,K.jsx)(h,{className:`mt-0.5 h-4 w-4 shrink-0 text-[var(--content-tertiary)]`,"aria-hidden":!0}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`p`,{className:r(`text-body-medium-default text-[var(--content-default)]`,t&&`break-all font-mono`),children:e}),(0,K.jsxs)(`p`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:[`Times use your timezone — `,n,`.`]})]})]})}function nt(e=B(),t=Date.now()){return Ae(`7d`,e,t)}function J(e){return e?new Date(e).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`,hour12:!0}):`—`}function rt(e){return e==null?`—`:e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`}var it=new Intl.NumberFormat(void 0,{style:`currency`,currency:`USD`,minimumFractionDigits:2,maximumFractionDigits:2});function Y(e){return e==null||!Number.isFinite(e)?`—`:it.format(e)}function at(e){return`${e.toLocaleString()} ${e===1?`run`:`runs`}`}function ot(e){let t=Math.round(e/6e4);return t>=60&&t%60==0?`Every ${t/60} hr`:`Every ${t} min`}function st(e){if(!e)return;let t=new Set,n=[];for(let r of e)for(let e of r.runs)t.has(e.id)||(t.add(e.id),n.push(e));return n}function ct(e){return!!e.conversationId&&e.conversationExists===!0&&e.conversationArchivedAt==null}function lt(e){return ct(e)?e.conversationId??null:null}function X(e){return typeof e==`string`&&e.length>0}var ut={heartbeat:`system-heartbeat`,consolidation:`system-consolidation`,retrospective:`system-memory-retrospective`};function dt(e){if(e.cronExpression)return e.timezone?`Cron: ${e.cronExpression} (${e.timezone})`:`Cron: ${e.cronExpression}`;let t=ot(e.intervalMs);return e.activeHoursStart!=null&&e.activeHoursEnd!=null&&(t+=` (${e.activeHoursStart}:00–${e.activeHoursEnd}:00)`),t}function ft(e){return ot(e.intervalMs)}var pt=`After conversation activity`;function mt(e,t){return e.status===`fired`||e.status===`cancelled`?!0:e.status===`firing`?!1:e.nextRunAt==null||!e.enabled&&e.nextRunAt<=t}function ht(e,t){let n=[],r=[],i=[];for(let a of e)a.isOneShot?mt(a,t)?i.push(a):r.push(a):n.push(a);return n.sort((e,t)=>e.enabled===t.enabled?(e.nextRunAt??1/0)-(t.nextRunAt??1/0):e.enabled?-1:1),r.sort((e,t)=>(e.nextRunAt??1/0)-(t.nextRunAt??1/0)),i.sort((e,t)=>{let n=e.lastRunAt??e.nextRunAt??0;return(t.lastRunAt??t.nextRunAt??0)-n}),{recurring:n,upcomingOneTime:r,pastOneTime:i}}function gt(e,t,n=!0){return{queryKey:[{_id:`schedulesUsagesummaryGet`,path:{assistant_id:e??``},_tz:t}],queryFn:()=>e?be(e,nt(t)):Promise.resolve([]),enabled:n,staleTime:1e4}}function _t(e){return{scheduleId:e,runCount:0,totalEstimatedCostUsd:0,eventCount:0}}function vt(e,t,n){let r=(t??[]).filter(e=>{let t=e.startedAt??e.createdAt;return t>=n.from&&t<=n.to});return{scheduleId:e,runCount:r.length,totalEstimatedCostUsd:r.reduce((e,t)=>{let n=t.estimatedCostUsd;return typeof n==`number`&&Number.isFinite(n)?e+n:e},0),eventCount:0}}function yt({status:e}){return(0,K.jsx)(`span`,{className:`inline-block h-2 w-2 rounded-full`,style:{backgroundColor:e===`ok`||e===`completed`?`var(--system-positive-strong)`:e===`error`||e===`failed`?`var(--system-negative-strong)`:`var(--content-tertiary)`},"aria-label":e??`unknown`})}function bt({scheduleName:e,usage:t,onOpenUsage:n}){if(t.status===`loading`)return(0,K.jsxs)(`div`,{"aria-label":`Loading schedule usage`,className:`flex w-[156px] shrink-0 items-center justify-end gap-3`,children:[(0,K.jsx)(`span`,{className:`h-5 w-16 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,K.jsx)(`span`,{className:`h-5 w-16 animate-pulse rounded bg-[var(--surface-muted)]`})]});let r=t.status===`error`,i=r?`--`:Y(t.summary.totalEstimatedCostUsd),a=r?`--`:at(t.summary.runCount),o=t.status===`ready`&&!(t.summary.totalEstimatedCostUsd>0),s=t.status===`ready`&&t.summary.runCount===0,c=o?`text-[var(--content-tertiary)]`:`text-[var(--content-default)]`,l=s?`text-[var(--content-tertiary)]`:`text-[var(--content-default)]`;return(0,K.jsxs)(`div`,{className:`flex w-[156px] shrink-0 items-center justify-end gap-3 text-right text-body-small-default`,children:[n?(0,K.jsx)(`button`,{type:`button`,onClick:n,"aria-label":`View usage for ${e}`,className:`min-w-[64px] cursor-pointer rounded px-1 py-0.5 text-right transition-colors hover:bg-[var(--surface-hover)] ${c}`,children:i}):(0,K.jsx)(`span`,{"aria-label":`Cost for ${e} in the last 7 days: ${i}`,className:`block min-w-[64px] px-1 py-0.5 ${c}`,children:i}),(0,K.jsx)(`span`,{"aria-label":`Runs for ${e} in the last 7 days: ${a}`,className:`block min-w-[64px] px-1 py-0.5 ${l}`,children:a})]})}function xt({name:e,subtitle:t,enabled:n,nextRunAt:r,lastRunAt:i,usage:a,helperText:o,statusLabel:s,statusTone:c=`neutral`,onClick:l}){return(0,K.jsx)(`div`,{className:`flex flex-wrap items-center gap-3 rounded-md px-2 py-3 transition-colors hover:bg-[var(--surface-hover)] [&+&]:border-t [&+&]:border-[var(--border-base)]`,children:(0,K.jsxs)(`button`,{type:`button`,onClick:l,"aria-label":`Open ${e}`,className:`flex min-w-0 flex-1 cursor-pointer flex-wrap items-center gap-3 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,K.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e})}),(0,K.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-tertiary)]`,children:t}),o?(0,K.jsx)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--content-secondary)]`,children:o}):null,(0,K.jsxs)(`div`,{className:`mt-0.5 flex flex-wrap items-center gap-x-3 gap-y-1 text-body-small-default text-[var(--content-tertiary)]`,children:[r?(0,K.jsxs)(`span`,{children:[`Next: `,J(r)]}):null,i?(0,K.jsxs)(`span`,{children:[`Last: `,J(i)]}):null]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 flex-wrap items-center justify-end gap-3`,children:[(0,K.jsx)(bt,{scheduleName:e,usage:a}),s?(0,K.jsx)(S,{tone:c,children:s}):(0,K.jsx)(`span`,{className:`h-2 w-2 rounded-full`,style:{backgroundColor:n?`var(--system-positive-strong)`:`var(--content-disabled)`},"aria-label":n?`enabled`:`disabled`}),(0,K.jsx)(m,{className:`h-4 w-4 text-[var(--content-tertiary)]`})]})]})})}function St({heartbeatConfig:e,consolidationConfig:t,retrospectiveConfig:n,heartbeatUsage:r,consolidationUsage:i,retrospectiveUsage:a,isLoading:o,hasError:s,onRetry:c,onSelectHeartbeat:l,onSelectConsolidation:u,onSelectRetrospective:d}){let f=e!=null,m=t?.available===!0,h=n?.available===!0,_=f||m||h;if(!o&&!s&&!_)return null;let v=[...f?[r]:[],...m?[i]:[],...h?[a]:[]].filter(e=>e.status===`ready`),x=v.reduce((e,t)=>e+(t.summary.totalEstimatedCostUsd??0),0),S=o?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,K.jsx)(g,{className:`h-5 w-5 animate-spin text-stone-400`})}):s&&!_?(0,K.jsxs)(y,{tone:`error`,children:[`Failed to load system jobs.`,` `,(0,K.jsx)(`button`,{type:`button`,onClick:c,className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]}):(0,K.jsxs)(`div`,{children:[f?(0,K.jsx)(xt,{name:`Heartbeat`,subtitle:dt(e),enabled:e.enabled,nextRunAt:e.nextRunAt,lastRunAt:e.lastRunAt,usage:r,onClick:l}):null,m?(0,K.jsx)(xt,{name:`Consolidation`,subtitle:ft(t),enabled:t.enabled,helperText:t.enabled?void 0:`Memory is off, so consolidation is paused.`,nextRunAt:t.nextRunAt,lastRunAt:t.lastRunAt,usage:i,statusLabel:t.enabled?void 0:`Paused`,statusTone:`warning`,onClick:u}):null,h?(0,K.jsx)(xt,{name:`Memory retrospective`,subtitle:pt,enabled:n.enabled,helperText:n.enabled?void 0:`Memory is off, so retrospectives are paused.`,nextRunAt:n.nextRunAt,lastRunAt:n.lastRunAt,usage:a,statusLabel:n.enabled?void 0:`Paused`,statusTone:`warning`,onClick:d}):null,s?(0,K.jsx)(`div`,{className:`pt-3 first:pt-0`,children:(0,K.jsxs)(y,{tone:`error`,children:[`Some system jobs failed to load.`,` `,(0,K.jsx)(`button`,{type:`button`,onClick:c,className:`cursor-pointer underline hover:no-underline`,children:`Retry`})]})}):null]});return(0,K.jsx)(ye,{children:(0,K.jsx)(b.Root,{type:`multiple`,children:(0,K.jsxs)(b.Item,{value:`system-jobs`,children:[(0,K.jsxs)(b.Trigger,{className:`group justify-between gap-3`,children:[(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-2 gap-y-1 text-left`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-secondary)]`,children:`System`}),(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Built-in jobs managed by the assistant runtime`})]}),(0,K.jsxs)(`span`,{className:`flex shrink-0 items-center gap-3`,children:[v.length>0?(0,K.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[Y(x),` (7d)`]}):null,(0,K.jsx)(p,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform group-data-[state=open]:rotate-180`})]})]}),(0,K.jsx)(b.Content,{children:(0,K.jsx)(`div`,{className:`mt-3`,children:S})})]})})})}function Z(e,t){return{id:e.id,jobId:t,status:e.status,startedAt:e.startedAt??e.scheduledFor,finishedAt:e.finishedAt,durationMs:e.durationMs,output:`skipReason`in e&&e.skipReason?`Skipped: ${e.skipReason}`:null,error:e.error,conversationId:e.conversationId,conversationExists:e.conversationExists,conversationArchivedAt:e.conversationArchivedAt,estimatedCostUsd:e.estimatedCostUsd,createdAt:e.createdAt,...`title`in e?{title:e.title}:{}}}function Ct(e){return e.runs.map(e=>Z(e,`heartbeat`))}function wt(e){return e.runs.map(e=>Z(e,`consolidation`))}function Tt(e){return e.runs.map(e=>Z(e,`retrospective`))}var Q=1e4;function Et(e,t,n,r,i){return e?{status:`loading`}:t?{status:`error`}:{status:`ready`,summary:vt(n,r,i)}}function Dt(e,n){let r=s(),i={path:{assistant_id:e??``}},{data:a,isLoading:o,isError:l,refetch:u}=c({...ie(i),enabled:!!e,staleTime:Q}),{data:d,isLoading:f,isError:p,refetch:m}=c({...R(i),enabled:!!e,staleTime:Q}),{data:h,isLoading:g,isError:_,refetch:v}=c({...se(i),enabled:!!e,staleTime:Q}),y={path:{assistant_id:e??``},query:{limit:100}},{data:b,isLoading:x,isError:S,refetch:C}=c({...j(y),select:Ct,enabled:!!e&&a!=null,staleTime:Q}),{data:w,isLoading:T,isError:E,refetch:D}=c({...le(y),select:wt,enabled:!!e&&d?.available===!0,staleTime:Q}),{data:k,isLoading:P,isError:F,refetch:I}=c({...oe(y),select:Tt,enabled:!!e&&h?.available===!0,staleTime:Q}),L=(0,U.useMemo)(()=>nt(n),[n]),ne=(0,U.useMemo)(()=>Et(x,S,ut.heartbeat,b,L),[b,S,x,L]),ae=(0,U.useMemo)(()=>Et(T,E,ut.consolidation,w,L),[w,E,T,L]),ue=(0,U.useMemo)(()=>Et(P,F,ut.retrospective,k,L),[k,F,P,L]),z=t=>{if(!e)return;let n={heartbeat:{config:ie(i).queryKey,runs:j(y).queryKey,infinite:ee(i)},consolidation:{config:R(i).queryKey,runs:le(y).queryKey,infinite:ce(i)},retrospective:{config:se(i).queryKey,runs:oe(y).queryKey,infinite:re(i)}}[t];r.invalidateQueries({queryKey:n.config}),r.invalidateQueries({queryKey:n.runs}),r.invalidateQueries({queryKey:n.infinite})},B=te({onSuccess:e=>{e.ran?O.success(`Heartbeat started.`):O.info(`Heartbeat skipped.`)},onError:e=>{t(e,{context:`heartbeat_run_now`}),O.error(`Failed to run heartbeat.`)},onSettled:()=>z(`heartbeat`)}),V=A({onSuccess:e=>{e.ran?O.success(`Consolidation queued.`):O.info(`Consolidation already queued or running.`)},onError:e=>{t(e,{context:`consolidation_run_now`}),O.error(`Failed to run consolidation.`)},onSettled:()=>z(`consolidation`)}),H=M({onSuccess:e=>{N(r,i,e),O.success(e.enabled?`Heartbeat enabled.`:`Heartbeat disabled.`)},onError:e=>{t(e,{context:`heartbeat_toggle`}),O.error(`Failed to toggle heartbeat.`)}});return{heartbeatConfig:a,consolidationConfig:d,retrospectiveConfig:h,heartbeatUsage:ne,consolidationUsage:ae,retrospectiveUsage:ue,isLoading:o||f||g,hasError:l||p||_,isHeartbeatRunning:B.isPending,isConsolidationRunning:V.isPending,isHeartbeatLoading:o,isHeartbeatError:l,isConsolidationLoading:f,isConsolidationError:p,isRetrospectiveLoading:g,isRetrospectiveError:_,refetchHeartbeat:u,refetchConsolidation:m,refetchRetrospective:v,runHeartbeatNow:()=>{e&&B.mutate({path:{assistant_id:e}})},runConsolidationNow:()=>{e&&V.mutate({path:{assistant_id:e}})},toggleHeartbeat:t=>{e&&H.mutate({body:{enabled:t},path:{assistant_id:e}})},refetchAll:()=>{u(),m(),v(),C(),D(),I()}}}function Ot({children:e}){return(0,K.jsx)(u,{variant:`label-small-default`,as:`div`,className:`mb-2 uppercase tracking-wider text-[var(--content-tertiary)]`,children:e})}function $({label:e,value:t}){return(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4 py-1`,children:[(0,K.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:e}),(0,K.jsx)(`span`,{className:`min-w-0 text-right text-body-medium-lighter text-[var(--content-default)]`,children:t})]})}function kt({icon:e,value:t,label:n}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-lg border border-[var(--border-base)] bg-[var(--surface-lift)] p-3`,children:[(0,K.jsx)(`span`,{className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md bg-[var(--surface-sunken)] text-[var(--content-secondary)]`,children:e}),(0,K.jsxs)(`div`,{className:`min-w-0`,children:[(0,K.jsx)(`div`,{className:`truncate text-body-large-default text-[var(--content-default)]`,children:t}),(0,K.jsx)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:n})]})]})}function At({usage:e}){return e.status===`loading`?(0,K.jsx)(`div`,{className:`grid grid-cols-2 gap-3 pt-2`,children:Array.from({length:2},(e,t)=>(0,K.jsx)(`div`,{className:`h-[60px] animate-pulse rounded-lg bg-[var(--surface-muted)]`},t))}):e.status===`error`?null:(0,K.jsxs)(`div`,{className:`grid grid-cols-2 gap-3 pt-2`,children:[(0,K.jsx)(kt,{icon:(0,K.jsx)(fe,{className:`h-4 w-4`}),value:Y(e.summary.totalEstimatedCostUsd),label:`7 Day Cost`}),(0,K.jsx)(kt,{icon:(0,K.jsx)(_,{className:`h-4 w-4`}),value:at(e.summary.runCount),label:`7 Day Runs`})]})}function jt(e){return e.exists&&e.archivedAt==null}function Mt({run:e,index:t,isExpanded:n,disableDirectOpen:i,onOpenConversation:a,onToggleDetails:o}){let s=lt(e),c=e.conversations??(s?[{id:s,title:null,exists:!0,archivedAt:null}]:[]),l=X(e.output),u=X(e.error),d=!i&&c.length===1&&jt(c[0])?c[0].id:null,f=!d&&(c.length>0||l||u),p=`schedule-run-details-${t}`,h=!!d||f,g=(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(yt,{status:e.status}),(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`div`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:J(e.startedAt)}),(0,K.jsxs)(`div`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:[rt(e.durationMs),` ·`,` `,Y(e.estimatedCostUsd)]}),e.status===`error`&&e.error?(0,K.jsxs)(`div`,{className:`mt-0.5 text-body-small-default text-[var(--system-negative-strong)]`,children:[e.error.slice(0,120),e.error.length>120?`…`:``]}):null]}),h?(0,K.jsx)(m,{className:r(`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform`,f&&n?`rotate-90`:``)}):null]}),_=f&&n?(0,K.jsx)(`div`,{id:p,className:`px-2 pb-3`,children:(0,K.jsxs)(`div`,{className:`space-y-3 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3`,children:[c.length>0?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Conversations`}),(0,K.jsx)(`div`,{className:`space-y-1`,children:c.map(e=>jt(e)?(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(e.id),className:`block w-full truncate text-left text-body-small-default text-[var(--content-default)] hover:underline`,children:X(e.title)?e.title:`Conversation`},e.id):(0,K.jsxs)(`span`,{className:`block truncate text-body-small-default text-[var(--content-tertiary)] italic`,children:[X(e.title)?e.title:`Conversation`,` `,e.exists?`(archived)`:`(unavailable)`]},e.id))})]}):null,l?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Output`}),(0,K.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--content-default)]`,children:e.output})]}):null,u?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Error`}),(0,K.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--system-negative-strong)]`,children:e.error})]}):null]})}):null;return d?(0,K.jsx)(`div`,{children:(0,K.jsx)(`button`,{type:`button`,onClick:()=>a(d),"aria-label":`Open conversation for run at ${J(e.startedAt)}`,className:`flex w-full cursor-pointer items-center gap-3 px-2 py-3 text-left shadow-none transition-colors hover:bg-[var(--surface-hover)] focus:outline-none`,children:g})}):f?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`button`,{type:`button`,onClick:()=>o(e.id),"aria-label":`Toggle details for run at ${J(e.startedAt)}`,"aria-expanded":n,"aria-controls":p,className:`flex w-full cursor-pointer items-center gap-3 px-2 py-3 text-left shadow-none transition-colors hover:bg-[var(--surface-hover)] focus:outline-none`,children:g}),_]}):(0,K.jsx)(`div`,{className:`flex items-center gap-3 px-2 py-3`,children:g})}function Nt({runs:e,isLoading:t,disableDirectOpen:n,onOpenConversation:r}){let[i,a]=(0,U.useState)(null);return t?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-6`,children:(0,K.jsx)(g,{className:`h-5 w-5 animate-spin text-stone-400`})}):!e||e.length===0?(0,K.jsx)(`p`,{className:`py-2 text-body-medium-lighter text-[var(--content-tertiary)] italic`,children:`No runs yet.`}):(0,K.jsx)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:e.map((e,t)=>(0,K.jsx)(Mt,{run:e,index:t,isExpanded:i===e.id,disableDirectOpen:n,onOpenConversation:r,onToggleDetails:e=>a(t=>t===e?null:e)},e.id))})}function Pt({schedule:e,assistantId:n,usage:a,isMobile:s,onClose:l,onDeleted:d}){let f=o(),{data:p,isLoading:m}=c({queryKey:ae({path:{assistant_id:n,id:e.id}}),queryFn:()=>Se(n,e.id),staleTime:1e4}),[h,_]=(0,U.useState)(!1),[y,b]=(0,U.useState)(!1),[x,S]=(0,U.useState)(!1),C=async()=>{_(!0);try{await Te(n,e.id)}catch(e){t(e,{context:`schedule_run_now`}),O.error(`Failed to run schedule.`)}finally{_(!1)}},w=async()=>{S(!0);try{await Ee(n,e.id),d()}catch(e){t(e,{context:`schedule_delete`}),O.error(`Failed to delete schedule.`),S(!1),b(!1)}};return(0,K.jsxs)(`div`,{className:r(`flex h-full flex-col bg-[var(--surface-overlay)]`,!s&&`rounded-[var(--radius-xl)] border border-[var(--border-base)]`),children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-[var(--border-base)] p-[var(--app-spacing-lg)]`,children:[(0,K.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,K.jsx)(u,{variant:`title-small`,className:`truncate text-[var(--content-default)]`,children:e.name})}),(0,K.jsx)(i,{variant:`ghost`,iconOnly:(0,K.jsx)(v,{}),onClick:l,"aria-label":`Close schedule details`,tooltip:`Close`,className:`shrink-0`})]}),(0,K.jsxs)(`div`,{className:`flex-1 space-y-6 overflow-y-auto px-[var(--app-spacing-lg)] py-[var(--app-spacing-lg)]`,children:[e.description?(0,K.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-secondary)]`,children:e.description}):null,(0,K.jsxs)(`section`,{children:[(0,K.jsx)(Ot,{children:`Details`}),(0,K.jsxs)(`div`,{className:`rounded-lg border border-[var(--border-base)] bg-[var(--surface-lift)] px-4 py-2`,children:[e.cadenceDescription?(0,K.jsx)($,{label:`Cadence`,value:e.cadenceDescription}):null,(0,K.jsx)($,{label:`Mode`,value:e.mode}),(0,K.jsx)($,{label:`Status`,value:e.enabled?`Enabled`:`Disabled`}),(0,K.jsx)($,{label:`Next run`,value:J(e.nextRunAt)}),e.lastRunAt?(0,K.jsx)($,{label:`Last run`,value:(0,K.jsxs)(`span`,{className:`flex items-center justify-end gap-2`,children:[(0,K.jsx)(yt,{status:e.lastStatus}),J(e.lastRunAt)]})}):null]})]}),(0,K.jsx)(At,{usage:a}),(0,K.jsxs)(`section`,{children:[(0,K.jsx)(Ot,{children:`Recent runs`}),(0,K.jsx)(Nt,{runs:p?.runs,isLoading:m,disableDirectOpen:e.mode===`script`,onOpenConversation:e=>f(z.conversation(e))})]})]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-between gap-2 border-t border-[var(--border-base)] p-[var(--app-spacing-lg)]`,children:[y?(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(i,{variant:`ghost`,onClick:()=>b(!1),disabled:x,children:`Cancel`}),(0,K.jsx)(i,{variant:`danger`,onClick:()=>void w(),disabled:x,children:x?`Deleting…`:`Yes, delete`})]}):(0,K.jsx)(i,{variant:`dangerOutline`,leftIcon:(0,K.jsx)(me,{className:`h-3.5 w-3.5`}),onClick:()=>b(!0),children:`Delete`}),(0,K.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,K.jsx)(i,{variant:`outlined`,leftIcon:(0,K.jsx)(Me,{className:`h-3.5 w-3.5`}),onClick:()=>f(z.settings.usageForSchedule(e.id)),children:`View usage`}),e.mode===`script`?(0,K.jsx)(i,{variant:`primary`,leftIcon:h?(0,K.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):void 0,onClick:()=>void C(),disabled:h,children:h?`Running…`:`Run now`}):null]})]})]})}function Ft(e){if(e.status===`loading`)return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`h-4 w-12 animate-pulse rounded bg-[var(--surface-muted)]`}),(0,K.jsx)(`span`,{className:`h-4 w-10 animate-pulse rounded bg-[var(--surface-muted)]`})]});if(e.status===`error`)return(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`—`});let{summary:t}=e;return(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:Y(t.totalEstimatedCostUsd)}),(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:at(t.runCount)})]})}function It({name:e,metaParts:t,usage:n,enabled:r,selected:i,onClick:a,onToggle:o,toggleAriaLabel:s}){return(0,K.jsxs)(`div`,{className:`flex items-center gap-3 rounded-md px-2 py-3 transition-colors [&+&]:border-t [&+&]:border-[var(--border-base)] ${i?`bg-[var(--surface-active)]`:`hover:bg-[var(--surface-hover)]`}`,children:[o?(0,K.jsx)(T,{checked:r,onChange:o,"aria-label":s}):null,(0,K.jsxs)(`button`,{type:`button`,onClick:a,className:`flex min-w-0 flex-1 cursor-pointer items-center gap-4 text-left focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:[(0,K.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,K.jsx)(`span`,{className:`truncate text-body-medium-default text-[var(--content-default)]`,children:e}),t.length>0?(0,K.jsx)(`span`,{className:`flex min-w-0 items-center gap-2 text-label-small-default text-[var(--content-tertiary)]`,children:t.map((e,t)=>(0,K.jsxs)(U.Fragment,{children:[t>0?(0,K.jsx)(`span`,{className:`h-[3px] w-[3px] shrink-0 rounded-full bg-[var(--content-tertiary)]`}):null,(0,K.jsx)(`span`,{className:`truncate`,children:e})]},t))}):null]}),(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-4`,children:[Ft(n),(0,K.jsx)(m,{className:`h-4 w-4 text-[var(--content-tertiary)]`})]})]})]})}function Lt({schedule:e,usage:t,selected:n,onClick:r,onToggle:i}){let a=e.isOneShot?``:e.cadenceDescription.trim(),o=e.lastRunAt??e.nextRunAt,s=[a,o?J(o):``].filter(Boolean);return(0,K.jsx)(It,{name:e.name,metaParts:s,usage:t,enabled:e.enabled,selected:n,onClick:r,onToggle:i,toggleAriaLabel:i?`Toggle ${e.name}`:void 0})}function Rt({recurring:e,oneTime:t,pastOneTime:n,usageForSchedule:r,isLoading:a,isError:o,refetch:s,onToggle:c,onSelectSchedule:l,selectedScheduleId:u,onStartNewChat:d,onCreateSchedule:p,pastOpen:h,onPastOpenChange:g,systemTasksSlot:_}){let v=e=>(0,K.jsx)(Lt,{schedule:e,usage:r(e.id),selected:e.id===u,onClick:()=>l(e.id),onToggle:t=>c(e.id,t)},e.id),x=e=>(0,K.jsx)(Lt,{schedule:e,usage:r(e.id),selected:e.id===u,onClick:()=>l(e.id)},e.id),S=n.length>0?(0,K.jsx)(b.Root,{type:`single`,collapsible:!0,className:`mt-3`,value:h?`past`:``,onValueChange:e=>g(e===`past`),children:(0,K.jsxs)(b.Item,{value:`past`,children:[(0,K.jsxs)(b.Trigger,{className:`group gap-[var(--app-spacing-xs)] px-2 text-label-small-default text-[var(--content-tertiary)]`,children:[(0,K.jsx)(m,{size:14,"aria-hidden":!0,className:`shrink-0 transition-transform group-data-[state=open]:rotate-90`}),(0,K.jsxs)(`span`,{children:[`Past (`,n.length,`)`]})]}),(0,K.jsx)(b.Content,{children:(0,K.jsx)(`div`,{className:`pt-1`,children:n.map(x)})})]})}):null;return(0,K.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:[a?(0,K.jsx)(`div`,{className:`space-y-3`,children:Array.from({length:2},(e,t)=>(0,K.jsx)(`div`,{className:`h-12 animate-pulse rounded-md bg-[var(--surface-muted)]`},t))}):o&&e.length===0?(0,K.jsx)(y,{tone:`error`,actions:(0,K.jsx)(`button`,{type:`button`,onClick:s,className:`cursor-pointer underline hover:no-underline`,children:`Retry`}),children:`Failed to load schedules.`}):e.length===0&&t.length===0&&n.length===0?(0,K.jsx)(Oe,{icon:f,title:`No schedules yet`,description:`Ask your assistant to set one up, or create one yourself.`,actions:(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(i,{variant:`primary`,size:`regular`,onClick:d,children:`New Conversation`}),(0,K.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`or`}),(0,K.jsx)(i,{variant:`outlined`,size:`regular`,onClick:p,children:`Create schedule`})]})}):(0,K.jsxs)(`div`,{children:[e.map(v),t.length>0?(0,K.jsxs)(K.Fragment,{children:[(0,K.jsx)(`p`,{className:`mt-3 px-2 text-label-small-default text-[var(--content-tertiary)]`,children:`One-time`}),t.map(x)]}):null,S]}),_?(0,K.jsx)(`div`,{className:`mt-[var(--app-spacing-lg)]`,children:_}):null]})}var zt=`Default (assistant's main model)`,Bt=`Custom call-site model`;function Vt(e,t){return t?.[e]?.displayName??e}function Ht(e,t){if(e==null)return;if(e.provider!=null||e.model!=null)return Bt;let n=e.profile?.trim();return n?`Override (${Vt(n,t)})`:void 0}function Ut({assistantId:e,pinnedProfile:t,defaultCallSite:n=`mainAgent`,fallbackLabel:r=zt,respectCallSiteOverride:i=!1}){let a=t==null,{data:o}=c({...I({path:{assistant_id:e}}),enabled:!!e,staleTime:6e4}),s=(0,U.useMemo)(()=>o?je(o):{},[o]),{data:l}=c({...L({path:{assistant_id:e}}),enabled:!!e&&a,staleTime:6e4}),u=a&&i?Ht(o?.llm?.callSites?.[n],s):void 0,d=a?l?.callSites.find(e=>e.id===n)?.defaultProfile:void 0,f=t==null?u??(d==null?r:`Default (${Vt(d,s)})`):Vt(t,s);return(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Model profile`}),(0,K.jsx)(`span`,{className:`min-w-0 text-right`,children:f})]})}function Wt({runs:e,isLoading:t,emptyMessage:n=`No runs yet.`,hasMore:r=!1,isLoadingMore:a=!1,onLoadMore:s}){let c=o(),[l,u]=(0,U.useState)(null);return(0,K.jsx)(ye,{title:`Recent runs`,children:t?(0,K.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,K.jsx)(g,{className:`h-5 w-5 animate-spin text-stone-400`})}):!e||e.length===0?(0,K.jsx)(`p`,{className:`py-4 text-center text-body-medium-lighter text-[var(--content-tertiary)] italic`,children:n}):(0,K.jsxs)(`div`,{className:`divide-y divide-[var(--border-base)]`,children:[e.map((e,t)=>{let n=lt(e),r=X(e.output),i=X(e.error),a=!n&&(r||i),o=l===e.id,s=`schedule-run-details-${t}`;return(0,K.jsxs)(`div`,{children:[(0,K.jsx)(D,{label:(0,K.jsxs)(`span`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,K.jsx)(yt,{status:e.status}),(0,K.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(`span`,{className:`block truncate text-body-medium-lighter text-[var(--content-default)]`,children:X(e.title)?e.title:J(e.startedAt)}),(0,K.jsxs)(`span`,{className:`block text-body-small-default text-[var(--content-tertiary)]`,children:[X(e.title)?`${J(e.startedAt)} · `:``,rt(e.durationMs),` ·`,` `,Y(e.estimatedCostUsd),e.status===`error`&&e.error&&(0,K.jsxs)(`span`,{className:`ml-2 text-[var(--system-negative-strong)]`,children:[e.error.slice(0,80),e.error.length>80?`…`:``]})]})]}),n||a?(0,K.jsx)(m,{className:`h-4 w-4 shrink-0 text-[var(--content-tertiary)] transition-transform ${o?`rotate-90`:``}`}):null]}),onSelect:n?()=>c(z.conversation(n)):a?()=>u(o?null:e.id):void 0,"aria-label":`Run at ${J(e.startedAt)}`,"aria-expanded":a?o:void 0,"aria-controls":a?s:void 0,className:`h-auto py-2.5 gap-3 -mx-2 px-2`}),a&&o?(0,K.jsx)(`div`,{id:s,className:`px-2 pb-3`,children:(0,K.jsxs)(`div`,{className:`space-y-3 rounded-md border border-[var(--border-subtle)] bg-[var(--surface-sunken)] p-3`,children:[r?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Output`}),(0,K.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--content-default)]`,children:e.output})]}):null,i?(0,K.jsxs)(`div`,{children:[(0,K.jsx)(`div`,{className:`mb-1 text-body-small-default text-[var(--content-secondary)]`,children:`Error`}),(0,K.jsx)(`pre`,{className:`max-h-64 overflow-auto whitespace-pre-wrap break-words text-body-small-default font-mono text-[var(--system-negative-strong)]`,children:e.error})]}):null]})}):null]},e.id)}),r&&s?(0,K.jsx)(`div`,{className:`flex justify-center pt-3`,children:(0,K.jsx)(i,{variant:`outlined`,size:`compact`,onClick:s,disabled:a,leftIcon:a?(0,K.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):void 0,children:a?`Loading…`:`Load more`})}):null]})})}var Gt={heartbeat:`heartbeatAgent`,consolidation:`memoryV2Consolidation`,retrospective:`memoryRetrospective`};function Kt({children:e}){return(0,K.jsx)(u,{variant:`label-small-default`,as:`div`,className:`mb-2 uppercase tracking-wider text-[var(--content-tertiary)]`,children:e})}function qt({kind:e,assistantId:t,systemTasks:n,canOpenMemorySettings:a,isMobile:s,onClose:c}){let l=o(),{heartbeatConfig:d,consolidationConfig:f,retrospectiveConfig:p}=n,m,h,_,b,x,S,C;e===`heartbeat`?(m=`Heartbeat`,h=d?dt(d):``,_=d?.enabled??!1,b=d?.nextRunAt??null,x=d?.lastRunAt??null,S=n.isHeartbeatRunning,C=n.runHeartbeatNow):e===`consolidation`?(m=`Consolidation`,h=f?ft(f):``,_=f?.enabled??!1,b=f?.nextRunAt??null,x=f?.lastRunAt??null,S=n.isConsolidationRunning,C=n.runConsolidationNow):(m=`Memory retrospective`,h=pt,_=p?.enabled??!1,b=p?.nextRunAt??null,x=p?.lastRunAt??null,S=!1,C=void 0);let w=e!==`heartbeat`,E=e===`retrospective`,D=w&&!_,O=S||D,k=w?_?`On · Managed by Memory`:`Paused`:_?`Enabled`:`Disabled`,A=E?`Memory is off, so retrospectives are paused. Turn Memory back on to resume them.`:`Memory is off, so consolidation is paused. Turn Memory back on to resume consolidation.`,j=w&&_&&a,M={path:{assistant_id:t},query:{limit:25}},N=e===`heartbeat`?P(M):e===`consolidation`?F(M):ne(M),{data:ee,isLoading:te,fetchNextPage:I,hasNextPage:L,isFetchingNextPage:re}=he({queryKey:N.queryKey,queryFn:N.queryFn,initialPageParam:{path:M.path,query:{}},getNextPageParam:e=>e.nextCursor??void 0,staleTime:1e4}),R=st(ee?.pages.map(t=>({runs:t.runs.map(t=>Z(t,e))})));return(0,K.jsxs)(`div`,{className:r(`flex h-full flex-col bg-[var(--surface-overlay)]`,!s&&`rounded-[var(--radius-xl)] border border-[var(--border-base)]`),children:[(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 border-b border-[var(--border-base)] p-[var(--app-spacing-lg)]`,children:[(0,K.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,K.jsx)(u,{variant:`title-small`,className:`truncate text-[var(--content-default)]`,children:m}),h?(0,K.jsx)(u,{variant:`body-small-default`,as:`p`,className:`truncate text-[var(--content-tertiary)]`,children:h}):null]}),(0,K.jsx)(i,{variant:`ghost`,iconOnly:(0,K.jsx)(v,{}),onClick:c,"aria-label":`Close schedule details`,tooltip:`Close`,className:`shrink-0`})]}),(0,K.jsxs)(`div`,{className:`flex-1 space-y-6 overflow-y-auto px-[var(--app-spacing-lg)] py-[var(--app-spacing-lg)]`,children:[(0,K.jsxs)(`section`,{children:[(0,K.jsx)(Kt,{children:`Details`}),(0,K.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-[var(--border-base)] bg-[var(--surface-lift)] px-4 py-3 text-body-medium-lighter`,children:[(0,K.jsx)(Ut,{assistantId:t,defaultCallSite:Gt[e],fallbackLabel:`Default (system task model)`,respectCallSiteOverride:!0}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Status`}),(0,K.jsxs)(`span`,{className:`flex items-center gap-2 text-[var(--content-default)]`,children:[(0,K.jsx)(`span`,{children:k}),w?null:(0,K.jsx)(T,{checked:_,onChange:n.toggleHeartbeat,"aria-label":`Toggle ${m}`})]})]}),E?null:(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Next run`}),(0,K.jsx)(`span`,{className:`text-[var(--content-default)]`,children:J(b)})]}),(0,K.jsxs)(`div`,{className:`flex items-center justify-between gap-4`,children:[(0,K.jsx)(`span`,{className:`text-[var(--content-secondary)]`,children:`Last run`}),(0,K.jsx)(`span`,{className:`text-[var(--content-default)]`,children:J(x)})]})]}),D?(0,K.jsx)(y,{tone:`warning`,className:`mt-4`,actions:a?(0,K.jsx)(i,{variant:`outlined`,size:`compact`,onClick:()=>l(`${z.settings.developer}?tab=memory`),children:`Turn on Memory`}):void 0,children:A}):null]}),(0,K.jsx)(Wt,{runs:R,isLoading:te,hasMore:L,isLoadingMore:re,onLoadMore:()=>void I()})]}),j||C?(0,K.jsxs)(`div`,{className:`flex shrink-0 items-center justify-end gap-2 border-t border-[var(--border-base)] p-[var(--app-spacing-lg)]`,children:[j?(0,K.jsx)(i,{variant:`outlined`,leftIcon:(0,K.jsx)(pe,{className:`h-3.5 w-3.5`}),onClick:()=>l(`${z.settings.developer}?tab=memory`),children:`Memory settings`}):null,C?(0,K.jsx)(i,{variant:`primary`,leftIcon:S?(0,K.jsx)(g,{className:`h-3.5 w-3.5 animate-spin`}):(0,K.jsx)(ge,{className:`h-3.5 w-3.5`}),onClick:C,disabled:O,children:S?`Running…`:`Run now`}):null]}):null]})}function Jt(e){let n=H(),[r]=(0,U.useState)(()=>Date.now()),{data:i,isLoading:a,isError:o,refetch:s}=c(De(e)),{data:l,isLoading:u,isError:d}=c(gt(e,n,!0)),{recurring:f,oneTime:p,pastOneTime:m}=(0,U.useMemo)(()=>{let e=ht(i??[],r);return{recurring:e.recurring,oneTime:e.upcomingOneTime,pastOneTime:e.pastOneTime}},[r,i]),h=(0,U.useMemo)(()=>new Map((l??[]).map(e=>[e.scheduleId,e])),[l]);return{recurring:f,oneTime:p,pastOneTime:m,usageForSchedule:(0,U.useCallback)(e=>u?{status:`loading`}:d?{status:`error`}:{status:`ready`,summary:h.get(e)??_t(e)},[d,u,h]),handleToggle:(0,U.useCallback)(async(n,r)=>{if(e)try{await xe(e,n,r),s()}catch(e){t(e,{context:`schedule_toggle`}),O.error(`Failed to toggle schedule.`)}},[e,s]),isLoading:a,isError:o,refetch:(0,U.useCallback)(()=>{s()},[s])}}function Yt(){let e=o(),{scheduleId:t}=a(),n=ve(),r=_e(),i=H(),s=Jt(n),l=Dt(n,i),{data:u=!1}=c({queryKey:[`assistant-memory-opt-out-capability`,n],queryFn:async()=>{let e=await ue(n);return e.ok&&e.data.capabilities?.memoryOptOut===!0},retry:!1,staleTime:1e4}),d=V.use.settingsDeveloperNav(),f=u&&d===!0,[p,m]=(0,U.useState)(!1),h=t??null,[g,_]=(0,U.useState)(null),[v,y]=(0,U.useState)(!1),b=(0,U.useCallback)(t=>{e(t?z.schedules.detail(t):z.schedules.root)},[e]),x=h?s.recurring.find(e=>e.id===h)??s.oneTime.find(e=>e.id===h)??s.pastOneTime.find(e=>e.id===h)??null:null;(0,U.useEffect)(()=>{h&&!s.isLoading&&!s.isError&&!x&&b(null)},[h,x,s.isLoading,s.isError,b]);let S=g===`heartbeat`?l.heartbeatConfig!=null:g===`consolidation`?l.consolidationConfig?.available===!0:g===`retrospective`?l.retrospectiveConfig?.available===!0:!1;(0,U.useEffect)(()=>{g&&!l.isLoading&&!S&&_(null)},[g,S,l.isLoading]);let C=(0,U.useCallback)(e=>{_(null),b(e)},[b]),w=(0,U.useCallback)(e=>{h&&b(null),_(e)},[b,h]),T=(0,U.useCallback)(()=>{de(e)},[e]),E=(x?(0,K.jsx)(Pt,{schedule:x,assistantId:n,usage:s.usageForSchedule(x.id),isMobile:r,onClose:()=>b(null),onDeleted:()=>{b(null),s.refetch()}}):null)??(g&&S?(0,K.jsx)(qt,{kind:g,assistantId:n,systemTasks:l,canOpenMemorySettings:f,isMobile:r,onClose:()=>_(null)}):null),D=(0,K.jsx)(Rt,{recurring:s.recurring,oneTime:s.oneTime,pastOneTime:s.pastOneTime,usageForSchedule:s.usageForSchedule,isLoading:s.isLoading,isError:s.isError,refetch:s.refetch,onToggle:s.handleToggle,onSelectSchedule:C,selectedScheduleId:h,onStartNewChat:T,onCreateSchedule:()=>m(!0),pastOpen:v,onPastOpenChange:y,systemTasksSlot:(0,K.jsx)(St,{heartbeatConfig:l.heartbeatConfig,consolidationConfig:l.consolidationConfig,retrospectiveConfig:l.retrospectiveConfig,heartbeatUsage:l.heartbeatUsage,consolidationUsage:l.consolidationUsage,retrospectiveUsage:l.retrospectiveUsage,isLoading:l.isLoading,hasError:l.hasError,onRetry:l.refetchAll,onSelectHeartbeat:()=>w(`heartbeat`),onSelectConsolidation:()=>w(`consolidation`),onSelectRetrospective:()=>w(`retrospective`)})});return E&&r?(0,K.jsx)(ke,{children:E}):(0,K.jsxs)(K.Fragment,{children:[E&&!r?(0,K.jsx)(Ce,{storageKey:`schedulesDetailDrawerWidth`,detailKey:h??g??void 0,section:D,detail:E}):D,(0,K.jsx)(Je,{isOpen:p,assistantId:n,onClose:()=>m(!1),onCreated:()=>{m(!1),s.refetch()}})]})}export{Yt as SchedulesPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./check-wF3S-AV4.js";import{t as s}from"./modal-BtcwNEBj.js";import{t as c}from"./confirm-dialog-CCrDkChx.js";import{A as l,F as u,M as d,d as f,lt as p,rt as ee,t as te}from"./local-mode-hyYI6_OH.js";import{t as m}from"./is-electron-DBOtwp5h.js";import{n as h}from"./resolved-assistants-store-DdnJoLGS.js";import{D as g,E as _,i as v,n as y}from"./auth-store-B6EXnaee.js";import{c as b}from"./routes-XPLb07Av.js";import{t as x}from"./use-onboarding-login-D6BGXpJ1.js";import{Ma as S,Xn as ne,Yn as C,g as w,vn as T,xa as E}from"./index-CZVGv7Cn.js";var D=e(t(),1),O=a();function k({open:e,assistantName:t,isPending:r,errorMessage:i,onCancel:a,onRepair:o,onRetire:l}){let[u,d]=(0,D.useState)(`menu`);(0,D.useEffect)(()=>{e&&d(`menu`)},[e]);let f=i?(0,O.jsx)(`span`,{className:`mt-3 block text-body-small-default text-[var(--system-negative-strong)]`,children:i}):null;return u===`confirm-repair`?(0,O.jsx)(c,{open:e,title:`Repair Assistant?`,message:(0,O.jsxs)(O.Fragment,{children:[`Repairing re-provisions this assistant’s authentication token. Any other devices or browser sessions connected to it will be signed out and need to reconnect.`,f]}),confirmLabel:`Repair`,isPending:r,onConfirm:o,onCancel:()=>d(`menu`)}):u===`confirm-retire`?(0,O.jsx)(C,{open:e,isPending:r,extraMessage:f,onConfirm:l,onCancel:()=>d(`menu`)}):(0,O.jsx)(s.Root,{open:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,O.jsxs)(s.Content,{size:`sm`,hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),r||a()},children:[(0,O.jsx)(s.Header,{children:(0,O.jsx)(s.Title,{children:`Can’t Authenticate Assistant`})}),(0,O.jsxs)(s.Body,{children:[(0,O.jsxs)(s.Description,{children:[`The authentication token for `,t,` is missing or can no longer be refreshed, so this assistant can’t be connected. You can repair it, retire it, or pick a different assistant.`]}),f,(0,O.jsxs)(`div`,{className:`mt-5 flex w-full flex-col gap-2`,children:[(0,O.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-repair`),children:`Wake & Repair`}),(0,O.jsx)(n,{variant:`dangerOutline`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-retire`),children:`Retire Assistant`}),(0,O.jsx)(n,{variant:`outlined`,fullWidth:!0,disabled:r,onClick:a,children:`Cancel`})]})]})]})})}function A(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function j(e){if(e.hatchedAt)return`Created ${w(e.hatchedAt)}`}function M(){let e=i(),[t]=r(),a=t.get(`fromLogin`)===`1`,o=t.get(`noAutoSkip`)===`1`,s=m(),c=v(),S=h.use.assistants(),C=_.use.currentOrganizationId(),{loading:w,error:E,login:j,cancel:M}=x(),P=e=>e.isLocal||c,F=S.filter(P),I=S.some(e=>e.isPlatformHosted)&&!c,[L,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(null),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(!1),[Y,X]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(L!=null||F.length===0)return;let e=g(C);R(F.find(t=>t.id===e)?.id??F[0].id)},[L,F,C]);let Z=async t=>{B(!0),W(null);try{t.isLocal?await y.getState().connectLocalAssistant(t.id):await y.getState().connectPlatformAssistant(t.id),e(b.assistant,{replace:!0})}catch(e){console.error(`selectAssistant.handleConnect failed`,e),t.isLocal&&l()&&(d(e)||p(e)||e instanceof te)&&f(t.id)?K(t):W(`Failed to connect. Please try again.`),B(!1)}},Q=()=>{K(null),J(!1),X(null),H(!1)},re=async()=>{if(!(!G||q)){J(!0),X(null);try{let e=await u(G.id,{repairGuardian:!0});if(e.ok){ee(),Q(),Z(G);return}X(e.error||`Repair failed. Please try again.`)}catch(e){console.error(`selectAssistant.recoveryRepair failed`,e),X(`Repair failed. Please try again.`)}J(!1)}},ie=async()=>{if(!(!G||q)){J(!0),X(null);try{let t=await ne(G.id);if(t.ok){Q(),e(t.nextRoute,{replace:!0});return}X(t.error)}catch(e){console.error(`selectAssistant.recoveryRetire failed`,e),X(`Failed to retire assistant. Please try again.`)}J(!1)}};(0,D.useEffect)(()=>{a||o||z||V||S.length!==0&&S.length===1&&F.length===1&&(H(!0),Z(F[0]))},[S.length,F.length]);let ae=()=>{let e=S.find(e=>e.id===L);e&&Z(e)},oe=()=>{e(b.welcome)},$=E??U;return V&&!$&&!G?(0,O.jsx)(T,{children:(0,O.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,O.jsxs)(T,{children:[(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${s?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`min-h-screen px-6 pb-40 pt-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`h1`,{className:s?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${s?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),$&&(0,O.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:$}),(0,O.jsx)(`div`,{className:`flex w-full flex-col ${s?`mt-8 gap-2`:`mt-10 gap-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:S.map(e=>{let t=P(e);return(0,O.jsx)(N,{assistant:e,selected:L===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&R(e.id)}},e.id)})}),(0,O.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${s?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[F.length>0&&(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:ae,disabled:!L||z,children:z?`Connecting…`:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:()=>void e(`${b.onboarding.hosting}?from=select-assistant`),disabled:z||w,children:`Create New Assistant`}),I&&(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:w?M:()=>void j(),disabled:z,children:w?`Cancel`:`Log In`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:oe,disabled:z||w,children:`Back`})]})]}),(0,O.jsx)(k,{open:G!=null,assistantName:G?A(G):``,isPending:q,errorMessage:Y??void 0,onCancel:Q,onRepair:()=>void re(),onRetire:()=>void ie()})]})}function N({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=j(e),s=m();return(0,O.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center border text-left`,s?`gap-3 rounded-lg p-3`:`gap-4 rounded-2xl px-5 py-4`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,O.jsx)(`div`,{className:[`flex shrink-0 items-center justify-center transition-colors duration-200`,s?`h-8 w-8 rounded-lg`:`h-10 w-10 rounded-xl`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,O.jsx)(E,{className:`h-5 w-5`}):(0,O.jsx)(S,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:A(e)}),r&&(0,O.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:r})]}),a&&(0,O.jsx)(`span`,{className:`mt-0.5 block text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:a})]}),!n&&(0,O.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,O.jsx)(o,{className:`h-3 w-3 text-[var(--surface-base)]`,strokeWidth:3})})]})}export{M as SelectAssistantScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{m as r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./check-wF3S-AV4.js";import{t as s}from"./modal-BtcwNEBj.js";import{t as c}from"./confirm-dialog-CCrDkChx.js";import{A as l,F as u,M as d,d as f,lt as p,rt as ee,t as te}from"./local-mode-hyYI6_OH.js";import{t as m}from"./is-electron-DBOtwp5h.js";import{n as h}from"./resolved-assistants-store-DdnJoLGS.js";import{D as g,E as _,i as v,n as y}from"./auth-store-B6EXnaee.js";import{c as b}from"./routes-XPLb07Av.js";import{t as x}from"./use-onboarding-login-D6BGXpJ1.js";import{Na as S,Sa as C,Xn as w,Zn as ne,g as T,vn as E}from"./index-CgcZXB4g.js";var D=e(t(),1),O=a();function k({open:e,assistantName:t,isPending:r,errorMessage:i,onCancel:a,onRepair:o,onRetire:l}){let[u,d]=(0,D.useState)(`menu`);(0,D.useEffect)(()=>{e&&d(`menu`)},[e]);let f=i?(0,O.jsx)(`span`,{className:`mt-3 block text-body-small-default text-[var(--system-negative-strong)]`,children:i}):null;return u===`confirm-repair`?(0,O.jsx)(c,{open:e,title:`Repair Assistant?`,message:(0,O.jsxs)(O.Fragment,{children:[`Repairing re-provisions this assistant’s authentication token. Any other devices or browser sessions connected to it will be signed out and need to reconnect.`,f]}),confirmLabel:`Repair`,isPending:r,onConfirm:o,onCancel:()=>d(`menu`)}):u===`confirm-retire`?(0,O.jsx)(w,{open:e,isPending:r,extraMessage:f,onConfirm:l,onCancel:()=>d(`menu`)}):(0,O.jsx)(s.Root,{open:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,O.jsxs)(s.Content,{size:`sm`,hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),r||a()},children:[(0,O.jsx)(s.Header,{children:(0,O.jsx)(s.Title,{children:`Can’t Authenticate Assistant`})}),(0,O.jsxs)(s.Body,{children:[(0,O.jsxs)(s.Description,{children:[`The authentication token for `,t,` is missing or can no longer be refreshed, so this assistant can’t be connected. You can repair it, retire it, or pick a different assistant.`]}),f,(0,O.jsxs)(`div`,{className:`mt-5 flex w-full flex-col gap-2`,children:[(0,O.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-repair`),children:`Wake & Repair`}),(0,O.jsx)(n,{variant:`dangerOutline`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-retire`),children:`Retire Assistant`}),(0,O.jsx)(n,{variant:`outlined`,fullWidth:!0,disabled:r,onClick:a,children:`Cancel`})]})]})]})})}function A(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function j(e){if(e.hatchedAt)return`Created ${T(e.hatchedAt)}`}function M(){let e=i(),[t]=r(),a=t.get(`fromLogin`)===`1`,o=t.get(`noAutoSkip`)===`1`,s=m(),c=v(),S=h.use.assistants(),C=_.use.currentOrganizationId(),{loading:w,error:T,login:j,cancel:M}=x(),P=e=>e.isLocal||c,F=S.filter(P),I=S.some(e=>e.isPlatformHosted)&&!c,[L,R]=(0,D.useState)(null),[z,B]=(0,D.useState)(!1),[V,H]=(0,D.useState)(!1),[U,W]=(0,D.useState)(null),[G,K]=(0,D.useState)(null),[q,J]=(0,D.useState)(!1),[Y,X]=(0,D.useState)(null);(0,D.useEffect)(()=>{if(L!=null||F.length===0)return;let e=g(C);R(F.find(t=>t.id===e)?.id??F[0].id)},[L,F,C]);let Z=async t=>{B(!0),W(null);try{t.isLocal?await y.getState().connectLocalAssistant(t.id):await y.getState().connectPlatformAssistant(t.id),e(b.assistant,{replace:!0})}catch(e){console.error(`selectAssistant.handleConnect failed`,e),t.isLocal&&l()&&(d(e)||p(e)||e instanceof te)&&f(t.id)?K(t):W(`Failed to connect. Please try again.`),B(!1)}},Q=()=>{K(null),J(!1),X(null),H(!1)},re=async()=>{if(!(!G||q)){J(!0),X(null);try{let e=await u(G.id,{repairGuardian:!0});if(e.ok){ee(),Q(),Z(G);return}X(e.error||`Repair failed. Please try again.`)}catch(e){console.error(`selectAssistant.recoveryRepair failed`,e),X(`Repair failed. Please try again.`)}J(!1)}},ie=async()=>{if(!(!G||q)){J(!0),X(null);try{let t=await ne(G.id);if(t.ok){Q(),e(t.nextRoute,{replace:!0});return}X(t.error)}catch(e){console.error(`selectAssistant.recoveryRetire failed`,e),X(`Failed to retire assistant. Please try again.`)}J(!1)}};(0,D.useEffect)(()=>{a||o||z||V||S.length!==0&&S.length===1&&F.length===1&&(H(!0),Z(F[0]))},[S.length,F.length]);let ae=()=>{let e=S.find(e=>e.id===L);e&&Z(e)},oe=()=>{e(b.welcome)},$=T??U;return V&&!$&&!G?(0,O.jsx)(E,{children:(0,O.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,O.jsxs)(E,{children:[(0,O.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${s?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`min-h-screen px-6 pb-40 pt-16`} text-[var(--content-default)]`,children:[(0,O.jsx)(`h1`,{className:s?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,O.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${s?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),$&&(0,O.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:$}),(0,O.jsx)(`div`,{className:`flex w-full flex-col ${s?`mt-8 gap-2`:`mt-10 gap-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:S.map(e=>{let t=P(e);return(0,O.jsx)(N,{assistant:e,selected:L===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&R(e.id)}},e.id)})}),(0,O.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${s?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[F.length>0&&(0,O.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:ae,disabled:!L||z,children:z?`Connecting…`:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:()=>void e(`${b.onboarding.hosting}?from=select-assistant`),disabled:z||w,children:`Create New Assistant`}),I&&(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:w?M:()=>void j(),disabled:z,children:w?`Cancel`:`Log In`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:oe,disabled:z||w,children:`Back`})]})]}),(0,O.jsx)(k,{open:G!=null,assistantName:G?A(G):``,isPending:q,errorMessage:Y??void 0,onCancel:Q,onRepair:()=>void re(),onRetire:()=>void ie()})]})}function N({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=j(e),s=m();return(0,O.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center border text-left`,s?`gap-3 rounded-lg p-3`:`gap-4 rounded-2xl px-5 py-4`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,O.jsx)(`div`,{className:[`flex shrink-0 items-center justify-center transition-colors duration-200`,s?`h-8 w-8 rounded-lg`:`h-10 w-10 rounded-xl`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,O.jsx)(C,{className:`h-5 w-5`}):(0,O.jsx)(S,{className:`h-5 w-5`})}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:A(e)}),r&&(0,O.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:r})]}),a&&(0,O.jsx)(`span`,{className:`mt-0.5 block text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:a})]}),!n&&(0,O.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,O.jsx)(o,{className:`h-3 w-3 text-[var(--surface-base)]`,strokeWidth:3})})]})}export{M as SelectAssistantScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{l as n,r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./log-in-DWnaKiOt.js";import{i as s}from"./auth-store-B6EXnaee.js";import{c}from"./routes-XPLb07Av.js";import{t as l}from"./client-feature-flag-store-DeUwlUsr.js";import{t as u}from"./use-onboarding-login-D6BGXpJ1.js";import{t as d}from"./assistant-feature-flag-store-BpbbAIKZ.js";import{Fr as f,Wt as p,ha as m,pi as h}from"./index-CZVGv7Cn.js";import{n as g,t as _}from"./sidebar-tree-DRAO8jjA.js";var v=e(t(),1),y=a();function b(){let e=d.use.settingsDeveloperNav(),t=d.use.credentialsSettings(),a=l.use.platformNotifications(),b=l.use.bookmarks(),x=h({platformHostedOnly:!0}),{pathname:S}=n(),C=i(),w=s(),{login:T}=u(),E=(0,v.useMemo)(()=>p.filter(e=>!(e.id===`notifications`&&(!a||x===`gated`)||e.id===`bookmarks`&&!b||e.id===`credentials`&&!t||e.id===`developer`)),[a,x,b,t]),D=(0,v.useMemo)(()=>{let t=[];return e&&t.push(...p.filter(e=>e.id===`developer`)),t.push(w?{id:`logout`,label:`Log Out`,icon:m,onSelect:()=>void f(C)}:{id:`login`,label:`Log In`,icon:o,onSelect:()=>void T()}),t},[e,w,C,T]),O=(0,v.useMemo)(()=>{if(S===c.settings.root)return`Settings`;let e=p.find(e=>S===e.href||S.startsWith(e.href+`/`));return e?e.label:`Settings`},[S]);return(0,y.jsx)(g,{backHref:c.assistant,sidebar:(0,y.jsx)(_,{items:E,bottomItems:D,indexPath:c.settings.root}),title:O,children:(0,y.jsx)(r,{})})}export{b as SettingsLayout};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{l as n,r,u as i}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./log-in-DWnaKiOt.js";import{i as s}from"./auth-store-B6EXnaee.js";import{c}from"./routes-XPLb07Av.js";import{t as l}from"./client-feature-flag-store-DeUwlUsr.js";import{t as u}from"./use-onboarding-login-D6BGXpJ1.js";import{t as d}from"./assistant-feature-flag-store-BpbbAIKZ.js";import{Ir as f,Wt as p,ga as m,mi as h}from"./index-CgcZXB4g.js";import{n as g,t as _}from"./sidebar-tree-Cq8ACYzP.js";var v=e(t(),1),y=a();function b(){let e=d.use.settingsDeveloperNav(),t=d.use.credentialsSettings(),a=l.use.platformNotifications(),b=l.use.bookmarks(),x=h({platformHostedOnly:!0}),{pathname:S}=n(),C=i(),w=s(),{login:T}=u(),E=(0,v.useMemo)(()=>p.filter(e=>!(e.id===`notifications`&&(!a||x===`gated`)||e.id===`bookmarks`&&!b||e.id===`credentials`&&!t||e.id===`developer`)),[a,x,b,t]),D=(0,v.useMemo)(()=>{let t=[];return e&&t.push(...p.filter(e=>e.id===`developer`)),t.push(w?{id:`logout`,label:`Log Out`,icon:m,onSelect:()=>void f(C)}:{id:`login`,label:`Log In`,icon:o,onSelect:()=>void T()}),t},[e,w,C,T]),O=(0,v.useMemo)(()=>{if(S===c.settings.root)return`Settings`;let e=p.find(e=>S===e.href||S.startsWith(e.href+`/`));return e?e.label:`Settings`},[S]);return(0,y.jsx)(g,{backHref:c.assistant,sidebar:(0,y.jsx)(_,{items:E,bottomItems:D,indexPath:c.settings.root}),title:O,children:(0,y.jsx)(r,{})})}export{b as SettingsLayout};
@@ -1 +1 @@
1
- import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{n as r,t as i,z as a}from"./button-BQVYX8n_.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./bug-YmXTm_XW.js";import{t as l}from"./download-CXYjvgB3.js";import{t as u}from"./info-DPHR_AMJ.js";import{t as ee}from"./loader-circle-D57RZgLH.js";import{t as d}from"./x-CswtfvgS.js";import{t as f}from"./notice-BylgS5W_.js";import{n as p,t as m}from"./input-ZpyYt_a0.js";import{t as h}from"./toggle-QSEiPr3k.js";import{t as g}from"./dropdown-BMNSccmo.js";import{t as _}from"./is-electron-DBOtwp5h.js";import{an as v}from"./sdk.gen-D_Qurj4O.js";import{t as y}from"./impersonate-version-flag-CjFVQtQC.js";import{n as te}from"./auth-store-B6EXnaee.js";import{t as b}from"./dist-CGPrc2vu2.js";import{n as x}from"./diagnostics-CNSs2GQW.js";import{L as S}from"./react-query.gen-BXPoln4i.js";import{Qi as C,da as w,pa as ne,sa as re,ya as T}from"./index-CZVGv7Cn.js";var E=e(n(),1),ie=e(a(),1),D=`vellum:debug:`;function ae(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(D))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function O(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:y()},overrides:ae()}}var k=t({ShareFeedbackModal:()=>z}),A=s(),j=[{value:`bug_report`,label:`Bug Report`,icon:c,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:T,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:w,includesLogsByDefault:!1}],M=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],oe=M.map(e=>({value:e.value,label:e.label})),N=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),P=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),F=10,I=50*1024*1024,se={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function ce(){return _()?`electron`:b.getPlatform()===`ios`?`ios`:`web`}function le(e){if(e.size>I)return!1;if(e.type&&N.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?P.has(t):!1}return!1}function L(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function R(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await v({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function ue(e,t,n,r={}){if(typeof CompressionStream>`u`)return null;let{diagnosticsProvider:i,doctorSessionId:a,extraLogFiles:o=[]}=r,s=new Date,c=M.find(t=>t.value===e),l=s.getTime(),u=c?.cutoffMs==null?null:l-c.cutoffMs,ee=u==null?null:new Date(u).toISOString(),d=null;try{d=i?.()??null}catch{d=null}let f=x(d),p={collected_at:s.toISOString(),time_range:e,cutoff:ee,log_window:{start_time_ms:u,end_time_ms:l},assistant_id:t,active_conversation_id:n,doctor_session_id:a??null,user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},m=new TextEncoder,h=m.encode(JSON.stringify(p,null,2)),g=m.encode(JSON.stringify(f,null,2)),v=[L(`web-client-context.json`,h),L(`web-chat-diagnostics.json`,g)],y=new TextEncoder().encode(JSON.stringify(O(),null,2));v.push(L(`web-debug-flags.json`,y));for(let e of o){let t=e.contents.trim();t&&v.push(L(e.filename,m.encode(t)))}try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t={clientMessages:e.getClientMessages?.()??null,transcriptItems:e.getTranscriptItems?.()??null,pendingInteractions:e.listPendingInteractions?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null,reconciliationDiagnostics:e.getReconciliationDiagnostics?.()??null},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(L(`web-chat-debug-api-triage.json`,n))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(L(`web-sse-liveness-triage.json`,n))}}catch{}if(_()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));v.push(L(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);v.push(L(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await R(t,{window:{startTime:u,endTime:l},activeConversationId:n});e&&v.push(L(`platform-logs.tar.gz`,e))}v.push(new Uint8Array(1024));let te=v.reduce((e,t)=>e+t.length,0),b=new Uint8Array(te),S=0;for(let e of v)b.set(e,S),S+=e.length;let C=new Blob([b.buffer]),w=await new Response(C.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([w],`web-client-logs-${s.getTime()}.tar.gz`,{type:`application/gzip`})}function z({open:e,onClose:t,initialReason:n,initialMessage:a,onSubmitted:s,assistantId:c,assistantVersion:v,activeConversationId:y,doctorSessionId:b,doctorSessionLog:x,getDiagnosticsSnapshot:w}){let T=te.use.user(),D=T?.email,ae=T?.isStaff??!1,O=(0,E.useId)(),k=(0,E.useRef)(null),M=(0,E.useRef)(null),N=(0,E.useRef)(null),P=(0,E.useRef)(null),[I,L]=(0,E.useState)(n??`bug_report`),[R,z]=(0,E.useState)(``),[B,pe]=(0,E.useState)(``),[V,H]=(0,E.useState)(j.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[me,he]=(0,E.useState)(!1),[U,W]=(0,E.useState)(`past_hour`),[G,K]=(0,E.useState)([]),[ge,q]=(0,E.useState)(null),[_e,J]=(0,E.useState)(!1),[Y,ve]=(0,E.useState)(!1),[X,ye]=(0,E.useState)(!1),Z=o(S()),[be,Q]=(0,E.useState)(!1),$=Z.isPending||be,xe=!D,Se=(0,E.useMemo)(()=>R.trim().length>0&&B.trim().length>0,[R,B]);(0,E.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;L(t),z(a??``),pe(D??``),H(j.find(e=>e.value===t)?.includesLogsByDefault??!0),he(!1),W(`past_hour`),K([]),ve(!1),ye(!1),q(null),Q(!1),Z.reset();let r=setTimeout(()=>{D?N.current?.focus():P.current?.focus()},50);return()=>clearTimeout(r)},[e]),(0,E.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let Ce=e=>{L(e),me||H(j.find(t=>t.value===e)?.includesLogsByDefault??!1)},we=()=>{H(e=>!e),he(!0)},Te=x?.trim()?[{filename:`doctor-session.txt`,contents:x}]:[],Ee=(0,E.useCallback)(e=>{e.key===`Escape`&&!$&&t()},[t,$]),De=(0,E.useCallback)(e=>{e.target===k.current&&!$&&t()},[t,$]),Oe=(0,E.useCallback)(e=>{K(t=>{let n=F-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!le(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),ke=e=>{e.target.files&&Oe(Array.from(e.target.files)),e.target.value=``},Ae=e=>{e.preventDefault(),J(!1),e.dataTransfer.files?.length&&Oe(Array.from(e.dataTransfer.files))},je=e=>{e.preventDefault(),J(!0)},Me=e=>{e.preventDefault(),e.currentTarget===e.target&&J(!1)},Ne=e=>{K(t=>t.filter((t,n)=>n!==e))};return e?(0,ie.createPortal)((0,A.jsx)(`div`,{ref:k,role:`dialog`,"aria-modal":`true`,"aria-labelledby":O,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:Ee,onClick:De,onDrop:Ae,onDragOver:je,onDragLeave:Me,children:(0,A.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,A.jsx)(`h2`,{id:O,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,A.jsx)(i,{variant:`ghost`,iconOnly:(0,A.jsx)(d,{}),onClick:t,disabled:$,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${$?`pointer-events-none opacity-60`:``}`,children:[ae&&(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3`,children:[(0,A.jsx)(h,{checked:X,onChange:()=>ye(e=>!e),"aria-label":`Download diagnostics directly`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Download diagnostics directly`})]}),(0,A.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Admin only — builds the diagnostics archive locally and downloads it instead of submitting feedback or notifying Slack.`})]}),X?(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Time range`}),(0,A.jsx)(g,{options:oe,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}):(0,A.jsxs)(A.Fragment,{children:[xe&&(0,A.jsx)(m,{id:`${O}-email`,ref:P,label:`Email`,type:`email`,placeholder:`you@example.com`,value:B,onChange:e=>pe(e.target.value),leftIcon:(0,A.jsx)(ne,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,A.jsx)(`div`,{className:`flex gap-2`,children:j.map(e=>(0,A.jsx)(de,{option:e,isSelected:I===e.value,onSelect:()=>Ce(e.value)},e.value))})]}),(0,A.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),I===`bug_report`&&(0,A.jsxs)(f,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),I===`feature_request`&&(0,A.jsxs)(f,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,A.jsx)(p,{id:`${O}-message`,ref:N,label:I===`bug_report`?`What went wrong?`:I===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:I===`bug_report`?`What did you expect to happen, and what happened instead?`:I===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:R,onChange:e=>z(e.target.value),fullWidth:!0}),I!==`feature_request`&&(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(h,{checked:V,onChange:we,"aria-label":`Include browser diagnostics`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,A.jsx)(r,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,A.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,A.jsx)(u,{className:`h-3.5 w-3.5`})})})]}),V&&(0,A.jsx)(g,{options:oe,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}),_()&&y&&I!==`feature_request`&&(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(h,{checked:Y,onChange:()=>ve(e=>!e),"aria-label":`Include the most recent conversation`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,G.length>0&&(0,A.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,G.length,`/`,F]})]}),(0,A.jsx)(i,{variant:`outlined`,size:`compact`,leftIcon:(0,A.jsx)(re,{}),onClick:()=>M.current?.click(),disabled:G.length>=F,children:`Add files`}),(0,A.jsx)(`input`,{ref:M,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:ke,className:`hidden`})]}),G.length>0&&(0,A.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:G.map((e,t)=>(0,A.jsx)(fe,{file:e,onRemove:()=>Ne(t)},`${e.name}-${t}`))}),_e&&(0,A.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]})]}),ge&&(0,A.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:ge})]}),(0,A.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:$?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,A.jsx)(ee,{className:`h-4 w-4 animate-spin`}),X?`Preparing diagnostics…`:`Sending feedback…`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(i,{variant:`ghost`,onClick:t,children:`Cancel`}),X?(0,A.jsx)(i,{variant:`primary`,leftIcon:(0,A.jsx)(l,{}),onClick:async()=>{if(!$){q(null),Q(!0);try{let e=await ue(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:w,doctorSessionId:b,extraLogFiles:Te});if(!e){q(`Diagnostics export isn't supported in this browser.`);return}let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0),t()}catch(e){q(e instanceof Error?e.message:`Failed to build diagnostics. Please try again.`)}finally{Q(!1)}}},children:`Download diagnostics`}):(0,A.jsx)(i,{variant:`primary`,leftIcon:(0,A.jsx)(C,{}),onClick:async()=>{if(!(!Se||$)){q(null),Q(!0);try{let e=V&&I!==`feature_request`?await ue(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:w,doctorSessionId:b,extraLogFiles:Te}):null;await Z.mutateAsync({headers:{"Content-Type":null},body:{message:R.trim(),classification:se[I],email:B.trim(),client:ce(),client_version:void 0,...c?{assistant_id:c}:{},...v?{assistant_version:v}:{},...b?{doctor_session_id:b}:{},...e?{logs_file:e}:{},...G.length?{attachments:G}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}}),s?.(),t()}catch(e){q(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Q(!1)}}},disabled:!Se,children:`Submit`})]})})]})}),document.body):null}function de({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,A.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,A.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,A.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function fe({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,E.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,E.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,A.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,A.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,A.jsx)(re,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,A.jsx)(i,{variant:`ghost`,size:`compact`,iconOnly:(0,A.jsx)(d,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{k as n,z as t};
1
+ import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{n as r,t as i,z as a}from"./button-BQVYX8n_.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./bug-YmXTm_XW.js";import{t as l}from"./download-CXYjvgB3.js";import{t as u}from"./info-DPHR_AMJ.js";import{t as ee}from"./loader-circle-D57RZgLH.js";import{t as d}from"./x-CswtfvgS.js";import{t as f}from"./notice-BylgS5W_.js";import{n as p,t as m}from"./input-ZpyYt_a0.js";import{t as h}from"./toggle-QSEiPr3k.js";import{t as g}from"./dropdown-BMNSccmo.js";import{t as _}from"./is-electron-DBOtwp5h.js";import{an as v}from"./sdk.gen-D_Qurj4O.js";import{t as y}from"./impersonate-version-flag-CjFVQtQC.js";import{n as te}from"./auth-store-B6EXnaee.js";import{t as b}from"./dist-CGPrc2vu2.js";import{n as x}from"./diagnostics-CNSs2GQW.js";import{L as S}from"./react-query.gen-BXPoln4i.js";import{$i as C,ba as w,ca as ne,fa as T,ma as re}from"./index-CgcZXB4g.js";var E=e(n(),1),ie=e(a(),1),D=`vellum:debug:`;function ae(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(D))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function O(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:y()},overrides:ae()}}var k=t({ShareFeedbackModal:()=>z}),A=s(),j=[{value:`bug_report`,label:`Bug Report`,icon:c,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:w,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:T,includesLogsByDefault:!1}],M=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],oe=M.map(e=>({value:e.value,label:e.label})),N=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),P=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),F=10,I=50*1024*1024,se={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function ce(){return _()?`electron`:b.getPlatform()===`ios`?`ios`:`web`}function le(e){if(e.size>I)return!1;if(e.type&&N.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?P.has(t):!1}return!1}function L(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function R(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await v({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function ue(e,t,n,r={}){if(typeof CompressionStream>`u`)return null;let{diagnosticsProvider:i,doctorSessionId:a,extraLogFiles:o=[]}=r,s=new Date,c=M.find(t=>t.value===e),l=s.getTime(),u=c?.cutoffMs==null?null:l-c.cutoffMs,ee=u==null?null:new Date(u).toISOString(),d=null;try{d=i?.()??null}catch{d=null}let f=x(d),p={collected_at:s.toISOString(),time_range:e,cutoff:ee,log_window:{start_time_ms:u,end_time_ms:l},assistant_id:t,active_conversation_id:n,doctor_session_id:a??null,user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},m=new TextEncoder,h=m.encode(JSON.stringify(p,null,2)),g=m.encode(JSON.stringify(f,null,2)),v=[L(`web-client-context.json`,h),L(`web-chat-diagnostics.json`,g)],y=new TextEncoder().encode(JSON.stringify(O(),null,2));v.push(L(`web-debug-flags.json`,y));for(let e of o){let t=e.contents.trim();t&&v.push(L(e.filename,m.encode(t)))}try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t={clientMessages:e.getClientMessages?.()??null,transcriptItems:e.getTranscriptItems?.()??null,pendingInteractions:e.listPendingInteractions?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null,reconciliationDiagnostics:e.getReconciliationDiagnostics?.()??null},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(L(`web-chat-debug-api-triage.json`,n))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(t,null,2));v.push(L(`web-sse-liveness-triage.json`,n))}}catch{}if(_()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));v.push(L(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);v.push(L(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await R(t,{window:{startTime:u,endTime:l},activeConversationId:n});e&&v.push(L(`platform-logs.tar.gz`,e))}v.push(new Uint8Array(1024));let te=v.reduce((e,t)=>e+t.length,0),b=new Uint8Array(te),S=0;for(let e of v)b.set(e,S),S+=e.length;let C=new Blob([b.buffer]),w=await new Response(C.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([w],`web-client-logs-${s.getTime()}.tar.gz`,{type:`application/gzip`})}function z({open:e,onClose:t,initialReason:n,initialMessage:a,onSubmitted:s,assistantId:c,assistantVersion:v,activeConversationId:y,doctorSessionId:b,doctorSessionLog:x,getDiagnosticsSnapshot:w}){let T=te.use.user(),D=T?.email,ae=T?.isStaff??!1,O=(0,E.useId)(),k=(0,E.useRef)(null),M=(0,E.useRef)(null),N=(0,E.useRef)(null),P=(0,E.useRef)(null),[I,L]=(0,E.useState)(n??`bug_report`),[R,z]=(0,E.useState)(``),[B,pe]=(0,E.useState)(``),[V,H]=(0,E.useState)(j.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[me,he]=(0,E.useState)(!1),[U,W]=(0,E.useState)(`past_hour`),[G,K]=(0,E.useState)([]),[ge,q]=(0,E.useState)(null),[_e,J]=(0,E.useState)(!1),[Y,ve]=(0,E.useState)(!1),[X,ye]=(0,E.useState)(!1),Z=o(S()),[be,Q]=(0,E.useState)(!1),$=Z.isPending||be,xe=!D,Se=(0,E.useMemo)(()=>R.trim().length>0&&B.trim().length>0,[R,B]);(0,E.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;L(t),z(a??``),pe(D??``),H(j.find(e=>e.value===t)?.includesLogsByDefault??!0),he(!1),W(`past_hour`),K([]),ve(!1),ye(!1),q(null),Q(!1),Z.reset();let r=setTimeout(()=>{D?N.current?.focus():P.current?.focus()},50);return()=>clearTimeout(r)},[e]),(0,E.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let Ce=e=>{L(e),me||H(j.find(t=>t.value===e)?.includesLogsByDefault??!1)},we=()=>{H(e=>!e),he(!0)},Te=x?.trim()?[{filename:`doctor-session.txt`,contents:x}]:[],Ee=(0,E.useCallback)(e=>{e.key===`Escape`&&!$&&t()},[t,$]),De=(0,E.useCallback)(e=>{e.target===k.current&&!$&&t()},[t,$]),Oe=(0,E.useCallback)(e=>{K(t=>{let n=F-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!le(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),ke=e=>{e.target.files&&Oe(Array.from(e.target.files)),e.target.value=``},Ae=e=>{e.preventDefault(),J(!1),e.dataTransfer.files?.length&&Oe(Array.from(e.dataTransfer.files))},je=e=>{e.preventDefault(),J(!0)},Me=e=>{e.preventDefault(),e.currentTarget===e.target&&J(!1)},Ne=e=>{K(t=>t.filter((t,n)=>n!==e))};return e?(0,ie.createPortal)((0,A.jsx)(`div`,{ref:k,role:`dialog`,"aria-modal":`true`,"aria-labelledby":O,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:Ee,onClick:De,onDrop:Ae,onDragOver:je,onDragLeave:Me,children:(0,A.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,A.jsx)(`h2`,{id:O,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,A.jsx)(i,{variant:`ghost`,iconOnly:(0,A.jsx)(d,{}),onClick:t,disabled:$,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${$?`pointer-events-none opacity-60`:``}`,children:[ae&&(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3`,children:[(0,A.jsx)(h,{checked:X,onChange:()=>ye(e=>!e),"aria-label":`Download diagnostics directly`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Download diagnostics directly`})]}),(0,A.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Admin only — builds the diagnostics archive locally and downloads it instead of submitting feedback or notifying Slack.`})]}),X?(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Time range`}),(0,A.jsx)(g,{options:oe,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}):(0,A.jsxs)(A.Fragment,{children:[xe&&(0,A.jsx)(m,{id:`${O}-email`,ref:P,label:`Email`,type:`email`,placeholder:`you@example.com`,value:B,onChange:e=>pe(e.target.value),leftIcon:(0,A.jsx)(re,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,A.jsx)(`div`,{className:`flex gap-2`,children:j.map(e=>(0,A.jsx)(de,{option:e,isSelected:I===e.value,onSelect:()=>Ce(e.value)},e.value))})]}),(0,A.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),I===`bug_report`&&(0,A.jsxs)(f,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),I===`feature_request`&&(0,A.jsxs)(f,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,A.jsx)(p,{id:`${O}-message`,ref:N,label:I===`bug_report`?`What went wrong?`:I===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:I===`bug_report`?`What did you expect to happen, and what happened instead?`:I===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:R,onChange:e=>z(e.target.value),fullWidth:!0}),I!==`feature_request`&&(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(h,{checked:V,onChange:we,"aria-label":`Include browser diagnostics`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,A.jsx)(r,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,A.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,A.jsx)(u,{className:`h-3.5 w-3.5`})})})]}),V&&(0,A.jsx)(g,{options:oe,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}),_()&&y&&I!==`feature_request`&&(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(h,{checked:Y,onChange:()=>ve(e=>!e),"aria-label":`Include the most recent conversation`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,G.length>0&&(0,A.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,G.length,`/`,F]})]}),(0,A.jsx)(i,{variant:`outlined`,size:`compact`,leftIcon:(0,A.jsx)(ne,{}),onClick:()=>M.current?.click(),disabled:G.length>=F,children:`Add files`}),(0,A.jsx)(`input`,{ref:M,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:ke,className:`hidden`})]}),G.length>0&&(0,A.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:G.map((e,t)=>(0,A.jsx)(fe,{file:e,onRemove:()=>Ne(t)},`${e.name}-${t}`))}),_e&&(0,A.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]})]}),ge&&(0,A.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:ge})]}),(0,A.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:$?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,A.jsx)(ee,{className:`h-4 w-4 animate-spin`}),X?`Preparing diagnostics…`:`Sending feedback…`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(i,{variant:`ghost`,onClick:t,children:`Cancel`}),X?(0,A.jsx)(i,{variant:`primary`,leftIcon:(0,A.jsx)(l,{}),onClick:async()=>{if(!$){q(null),Q(!0);try{let e=await ue(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:w,doctorSessionId:b,extraLogFiles:Te});if(!e){q(`Diagnostics export isn't supported in this browser.`);return}let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0),t()}catch(e){q(e instanceof Error?e.message:`Failed to build diagnostics. Please try again.`)}finally{Q(!1)}}},children:`Download diagnostics`}):(0,A.jsx)(i,{variant:`primary`,leftIcon:(0,A.jsx)(C,{}),onClick:async()=>{if(!(!Se||$)){q(null),Q(!0);try{let e=V&&I!==`feature_request`?await ue(U,c??null,_()?Y?y??null:null:y??null,{diagnosticsProvider:w,doctorSessionId:b,extraLogFiles:Te}):null;await Z.mutateAsync({headers:{"Content-Type":null},body:{message:R.trim(),classification:se[I],email:B.trim(),client:ce(),client_version:void 0,...c?{assistant_id:c}:{},...v?{assistant_version:v}:{},...b?{doctor_session_id:b}:{},...e?{logs_file:e}:{},...G.length?{attachments:G}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}}),s?.(),t()}catch(e){q(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Q(!1)}}},disabled:!Se,children:`Submit`})]})})]})}),document.body):null}function de({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,A.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,A.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,A.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function fe({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,E.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,E.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,A.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,A.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,A.jsx)(ne,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,A.jsx)(i,{variant:`ghost`,size:`compact`,iconOnly:(0,A.jsx)(d,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{k as n,z as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{l as r,t as i,u as a}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-Cqi8q9o7.js";import{t as c}from"./arrow-left-C2re-gYj.js";import{t as l}from"./chevron-right-jRymmL7S.js";import{o as u}from"./src-CDdn26Yb.js";import{t as d}from"./is-electron-DBOtwp5h.js";import{c as f}from"./routes-XPLb07Av.js";import{Mn as p,Rr as m,Zn as h}from"./index-CZVGv7Cn.js";import{t as g}from"./use-edge-swipe-back-CaTk2Wz5.js";var _=e(t(),1),v=o();function y({sidebar:e,children:t,actions:o,backHref:l,title:u=`Settings`,menuRoute:y=f.settings.root}){let{pathname:b}=r(),x=a(),S=b===y,C=m(),w=(0,_.useRef)(null),T=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{T.current?.scrollTo(0,0)},[b]);let E=S?l:y;g({containerRef:w,onBack:(0,_.useCallback)(()=>{x(E)},[x,E]),enabled:C,navKey:b});let D=d(),O=S?`Back from ${u}`:`Back to ${u} menu`,k=(0,v.jsx)(n,{variant:`ghost`,iconOnly:(0,v.jsx)(c,{}),"aria-label":O,tintColor:`var(--content-secondary)`,onClick:()=>x(E)}),A=(0,v.jsx)(n,{asChild:!0,variant:`outlined`,"aria-label":`Back from ${u}`,className:`h-8 w-8 px-0`,tintColor:`var(--content-secondary)`,children:(0,v.jsx)(i,{to:l,className:`flex items-center justify-center no-underline`,children:(0,v.jsx)(c,{size:16,"aria-hidden":`true`})})});return(0,v.jsxs)(`div`,{ref:w,className:`flex h-full min-h-0 w-full flex-1 flex-col gap-4 p-4 sm:p-6 md:gap-0`,style:{paddingTop:D?`3.75rem`:`1rem`},children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 md:hidden`,children:[k,(0,v.jsx)(s,{as:`h1`,variant:`body-large-default`,className:`flex-1 truncate text-center`,style:{color:`var(--content-tertiary)`,lineHeight:1.4},children:u}),(0,v.jsx)(`div`,{className:`h-10 w-10 shrink-0`,"aria-hidden":`true`})]}),D?(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 pb-4 empty:hidden`,children:[(0,v.jsx)(h,{placement:`electron`,className:`px-0 pt-0`}),(0,v.jsx)(p,{placement:`electron`,className:`px-0 pt-0`})]}):null,(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden md:rounded-[12px] md:border md:border-[var(--border-base)] md:bg-[var(--surface-overlay)]`,children:[(0,v.jsxs)(`div`,{className:`hidden shrink-0 items-center justify-between gap-4 px-6 py-5 md:flex`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[A,(0,v.jsx)(`h1`,{className:`text-title-large truncate`,style:{color:`var(--content-emphasised)`,lineHeight:1.2},children:u})]}),(0,v.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,v.jsx)(`aside`,{className:`hidden w-64 shrink-0 overflow-y-auto md:block`,"aria-label":`${u} navigation`,children:e}),S?(0,v.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 md:hidden`,children:e}):null,(0,v.jsx)(`main`,{ref:T,className:`min-w-0 min-h-0 flex-1 flex-col gap-4 overflow-y-auto overflow-x-hidden pb-6 md:flex md:px-6 md:pt-0 ${S?`hidden`:`flex`}`,children:t})]})]})]})}function b({items:e,bottomItems:t,indexPath:n}){let{pathname:i}=r(),o=a(),s=m(),c=(e,t,r)=>{let{href:a,onSelect:c}=e,d=a!=null&&(i===a||i.startsWith(a+`/`)||!s&&r&&n!=null&&i===n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(u.Item,{icon:e.icon,label:e.label,active:d,trailingIcon:a==null?void 0:l,trailingIconClassName:a==null?void 0:`md:hidden`,href:a,onSelect:c,onClick:a==null?void 0:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),o(a))}}),!t&&(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`my-2 h-px w-full bg-[var(--border-base)] md:hidden`})]},e.id)};return(0,v.jsxs)(`nav`,{"aria-label":`Sidebar navigation`,className:`flex min-h-full flex-col md:gap-2 md:px-6 md:pb-4`,children:[e.map((n,r)=>c(n,r===e.length-1&&!t?.length,r===0)),t&&t.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`mx-0 my-2 h-px w-full bg-[var(--border-base)] md:mx-0`}),t.map((e,n)=>c(e,n===t.length-1,!1))]})]})}export{y as n,b as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-BQVYX8n_.js";import{l as r,t as i,u as a}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-Cqi8q9o7.js";import{t as c}from"./arrow-left-C2re-gYj.js";import{t as l}from"./chevron-right-jRymmL7S.js";import{o as u}from"./src-CDdn26Yb.js";import{t as d}from"./is-electron-DBOtwp5h.js";import{c as f}from"./routes-XPLb07Av.js";import{Nn as p,Qn as m,zr as h}from"./index-CgcZXB4g.js";import{t as g}from"./use-edge-swipe-back-Dpo-0Weh.js";var _=e(t(),1),v=o();function y({sidebar:e,children:t,actions:o,backHref:l,title:u=`Settings`,menuRoute:y=f.settings.root}){let{pathname:b}=r(),x=a(),S=b===y,C=h(),w=(0,_.useRef)(null),T=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{T.current?.scrollTo(0,0)},[b]);let E=S?l:y;g({containerRef:w,onBack:(0,_.useCallback)(()=>{x(E)},[x,E]),enabled:C,navKey:b});let D=d(),O=S?`Back from ${u}`:`Back to ${u} menu`,k=(0,v.jsx)(n,{variant:`ghost`,iconOnly:(0,v.jsx)(c,{}),"aria-label":O,tintColor:`var(--content-secondary)`,onClick:()=>x(E)}),A=(0,v.jsx)(n,{asChild:!0,variant:`outlined`,"aria-label":`Back from ${u}`,className:`h-8 w-8 px-0`,tintColor:`var(--content-secondary)`,children:(0,v.jsx)(i,{to:l,className:`flex items-center justify-center no-underline`,children:(0,v.jsx)(c,{size:16,"aria-hidden":`true`})})});return(0,v.jsxs)(`div`,{ref:w,className:`flex h-full min-h-0 w-full flex-1 flex-col gap-4 p-4 sm:p-6 md:gap-0`,style:{paddingTop:D?`3.75rem`:`1rem`},children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 md:hidden`,children:[k,(0,v.jsx)(s,{as:`h1`,variant:`body-large-default`,className:`flex-1 truncate text-center`,style:{color:`var(--content-tertiary)`,lineHeight:1.4},children:u}),(0,v.jsx)(`div`,{className:`h-10 w-10 shrink-0`,"aria-hidden":`true`})]}),D?(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 pb-4 empty:hidden`,children:[(0,v.jsx)(m,{placement:`electron`,className:`px-0 pt-0`}),(0,v.jsx)(p,{placement:`electron`,className:`px-0 pt-0`})]}):null,(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden md:rounded-[12px] md:border md:border-[var(--border-base)] md:bg-[var(--surface-overlay)]`,children:[(0,v.jsxs)(`div`,{className:`hidden shrink-0 items-center justify-between gap-4 px-6 py-5 md:flex`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[A,(0,v.jsx)(`h1`,{className:`text-title-large truncate`,style:{color:`var(--content-emphasised)`,lineHeight:1.2},children:u})]}),(0,v.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,v.jsx)(`aside`,{className:`hidden w-64 shrink-0 overflow-y-auto md:block`,"aria-label":`${u} navigation`,children:e}),S?(0,v.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 md:hidden`,children:e}):null,(0,v.jsx)(`main`,{ref:T,className:`min-w-0 min-h-0 flex-1 flex-col gap-4 overflow-y-auto overflow-x-hidden pb-6 md:flex md:px-6 md:pt-0 ${S?`hidden`:`flex`}`,children:t})]})]})]})}function b({items:e,bottomItems:t,indexPath:n}){let{pathname:i}=r(),o=a(),s=h(),c=(e,t,r)=>{let{href:a,onSelect:c}=e,d=a!=null&&(i===a||i.startsWith(a+`/`)||!s&&r&&n!=null&&i===n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(u.Item,{icon:e.icon,label:e.label,active:d,trailingIcon:a==null?void 0:l,trailingIconClassName:a==null?void 0:`md:hidden`,href:a,onSelect:c,onClick:a==null?void 0:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),o(a))}}),!t&&(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`my-2 h-px w-full bg-[var(--border-base)] md:hidden`})]},e.id)};return(0,v.jsxs)(`nav`,{"aria-label":`Sidebar navigation`,className:`flex min-h-full flex-col md:gap-2 md:px-6 md:pb-4`,children:[e.map((n,r)=>c(n,r===e.length-1&&!t?.length,r===0)),t&&t.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`mx-0 my-2 h-px w-full bg-[var(--border-base)] md:mx-0`}),t.map((e,n)=>c(e,n===t.length-1,!1))]})]})}export{y as n,b as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{m as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{f as i}from"./native-biometric-gWkPFBiw.js";import{n as a,r as o}from"./login-flow-CsH-88pb.js";import{t as s}from"./proxy-BzlH_XAe.js";import{t as c}from"./AnimatePresence-C8APSgIu.js";import{St as l}from"./index-CZVGv7Cn.js";import{t as u}from"./signup-shell-B1qn4Jpy.js";var d=e(t(),1),f=r();function p({words:e}){let[t,n]=(0,d.useState)(0),r=(0,d.useMemo)(()=>e.reduce((e,t)=>e.length>=t.length?e:t),[e]);return(0,d.useEffect)(()=>{let t=setInterval(()=>{n(t=>(t+1)%e.length)},2400);return()=>clearInterval(t)},[e.length]),(0,f.jsxs)(`span`,{className:`signup__rotating`,children:[(0,f.jsxs)(`span`,{className:`signup__rotating-sizer`,"aria-hidden":!0,children:[r,`.`]}),(0,f.jsx)(c,{mode:`wait`,children:(0,f.jsxs)(s.em,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.3,ease:`easeInOut`},children:[e[t],`.`]},e[t])})]})}var m=[`Personal Intelligence`,`Software Engineer`,`Finance Ops`,`Household Manager`,`GTM Engineer`,`Product Lead`];function h({returnTo:e}){let[t,n]=(0,d.useState)(null),r=o(e,{authIntent:`signup`});return(0,f.jsxs)(u,{children:[(0,f.jsxs)(`h1`,{className:`signup__title`,children:[`Meet your new`,(0,f.jsx)(`br`,{}),(0,f.jsx)(p,{words:m})]}),(0,f.jsx)(`p`,{className:`signup__subtitle`,children:`The most powerful assistant that can handle your work and life admin tasks.`}),(0,f.jsx)(`div`,{className:`signup__buttons`,children:(0,f.jsx)(`button`,{type:`button`,className:`signup__btn`,onClick:()=>{n(null),i(a,r,{returnTo:e,intent:`signup`}).catch(e=>{console.error(`[signup] auth flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Continue`})}),t&&(0,f.jsx)(`p`,{className:`signup__error`,children:t}),(0,f.jsxs)(`p`,{className:`signup__footer`,children:[`Already have an account?`,` `,(0,f.jsx)(`button`,{type:`button`,className:`signup__link`,onClick:()=>{n(null),i(a,o(e),{returnTo:e}).catch(e=>{console.error(`[signup] sign-in flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Sign in`})]}),(0,f.jsxs)(`a`,{className:`signup__download`,href:`/downloads`,children:[(0,f.jsx)(l,{size:16}),`Download for macOS`]})]})}function g(){let[e]=n();return(0,f.jsx)(h,{returnTo:e.get(`returnTo`)})}export{g as SignupPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{m as n}from"./chunk-5KNZJZUH-SU6Q_tDT.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{f as i}from"./native-biometric-gWkPFBiw.js";import{n as a,r as o}from"./login-flow-CsH-88pb.js";import{t as s}from"./proxy-BzlH_XAe.js";import{t as c}from"./AnimatePresence-C8APSgIu.js";import{St as l}from"./index-CgcZXB4g.js";import{t as u}from"./signup-shell-B1qn4Jpy.js";var d=e(t(),1),f=r();function p({words:e}){let[t,n]=(0,d.useState)(0),r=(0,d.useMemo)(()=>e.reduce((e,t)=>e.length>=t.length?e:t),[e]);return(0,d.useEffect)(()=>{let t=setInterval(()=>{n(t=>(t+1)%e.length)},2400);return()=>clearInterval(t)},[e.length]),(0,f.jsxs)(`span`,{className:`signup__rotating`,children:[(0,f.jsxs)(`span`,{className:`signup__rotating-sizer`,"aria-hidden":!0,children:[r,`.`]}),(0,f.jsx)(c,{mode:`wait`,children:(0,f.jsxs)(s.em,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.3,ease:`easeInOut`},children:[e[t],`.`]},e[t])})]})}var m=[`Personal Intelligence`,`Software Engineer`,`Finance Ops`,`Household Manager`,`GTM Engineer`,`Product Lead`];function h({returnTo:e}){let[t,n]=(0,d.useState)(null),r=o(e,{authIntent:`signup`});return(0,f.jsxs)(u,{children:[(0,f.jsxs)(`h1`,{className:`signup__title`,children:[`Meet your new`,(0,f.jsx)(`br`,{}),(0,f.jsx)(p,{words:m})]}),(0,f.jsx)(`p`,{className:`signup__subtitle`,children:`The most powerful assistant that can handle your work and life admin tasks.`}),(0,f.jsx)(`div`,{className:`signup__buttons`,children:(0,f.jsx)(`button`,{type:`button`,className:`signup__btn`,onClick:()=>{n(null),i(a,r,{returnTo:e,intent:`signup`}).catch(e=>{console.error(`[signup] auth flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Continue`})}),t&&(0,f.jsx)(`p`,{className:`signup__error`,children:t}),(0,f.jsxs)(`p`,{className:`signup__footer`,children:[`Already have an account?`,` `,(0,f.jsx)(`button`,{type:`button`,className:`signup__link`,onClick:()=>{n(null),i(a,o(e),{returnTo:e}).catch(e=>{console.error(`[signup] sign-in flow failed:`,e),n(`Something went wrong. Please try again.`)})},children:`Sign in`})]}),(0,f.jsxs)(`a`,{className:`signup__download`,href:`/downloads`,children:[(0,f.jsx)(l,{size:16}),`Download for macOS`]})]})}function g(){let[e]=n();return(0,f.jsx)(h,{returnTo:e.get(`returnTo`)})}export{g as SignupPage};