@vellumai/web 0.11.1-staging.2 → 0.11.1

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 (113) hide show
  1. package/dist/assets/{access-C97H-xHb.js → access-BJiXpwUJ.js} +1 -1
  2. package/dist/assets/{account-page-Cflmw8J6.js → account-page-DP2HVinz.js} +1 -1
  3. package/dist/assets/{acp-run-detail-panel-BZ36-1N5.js → acp-run-detail-panel-C_M19m8P.js} +1 -1
  4. package/dist/assets/{activity-steps-panel-KMiSlUt3.js → activity-steps-panel-BsmwWzP1.js} +1 -1
  5. package/dist/assets/{add-credits-modal-Daz6j8gm.js → add-credits-modal-3Rsd1ZeS.js} +1 -1
  6. package/dist/assets/{ai-page-DPVi-dhB.js → ai-page-B9mJkV_p.js} +1 -1
  7. package/dist/assets/{app-card-JHbWefmm.js → app-card-DgDV-yMd.js} +1 -1
  8. package/dist/assets/{assistant-status-panel-CLMAEQ-v.js → assistant-status-panel-Bt_19-BI.js} +1 -1
  9. package/dist/assets/{auth-store-w_EmIQP7.js → auth-store-BwKMFgpK.js} +1 -1
  10. package/dist/assets/{background-task-actions-yrapeY1n.js → background-task-actions-DX0pUvY9.js} +1 -1
  11. package/dist/assets/{background-task-detail-panel-BV9Y227f.js → background-task-detail-panel-DqXuwo9q.js} +1 -1
  12. package/dist/assets/{billing-page-CmkTn62f.js → billing-page-CED96NEp.js} +1 -1
  13. package/dist/assets/{bookmarks-page-B2JvSaKf.js → bookmarks-page-Bk04EUIg.js} +1 -1
  14. package/dist/assets/{browser-CpgSNbEp.js → browser-Bses4IN3.js} +1 -1
  15. package/dist/assets/{build-state-DDUJ0MId.js → build-state-DPMhQpLB.js} +1 -1
  16. package/dist/assets/{channels-page-route-DAp7F6ed.js → channels-page-route-BooWFQMp.js} +1 -1
  17. package/dist/assets/{chat-markdown-message-B3Qo04ug.js → chat-markdown-message-f4cLJfax.js} +1 -1
  18. package/dist/assets/{checkout-continuation-DRPQwh5V.js → checkout-continuation-CcuqWhhp.js} +1 -1
  19. package/dist/assets/{checkout-page-B8CJoCWQ.js → checkout-page-BateK-Nf.js} +1 -1
  20. package/dist/assets/{client-identity-BSG341dO.js → client-identity-bdtPpHZK.js} +1 -1
  21. package/dist/assets/{command-palette-DH_ybPTY.js → command-palette-B3TVIQUH.js} +1 -1
  22. package/dist/assets/{command-palette-window-page-KoC7mrpM.js → command-palette-window-page-Bp9WplfA.js} +1 -1
  23. package/dist/assets/{contacts-page-route-BJBOnSQK.js → contacts-page-route--hTzWT8X.js} +1 -1
  24. package/dist/assets/{conversation-navigation-tj2ntPAn.js → conversation-navigation-D63NJmBl.js} +1 -1
  25. package/dist/assets/{conversation-queries-str0jfqv.js → conversation-queries-3taor2DZ.js} +1 -1
  26. package/dist/assets/{credentials-page-DFm5A_Dj.js → credentials-page-CYBmOQhl.js} +1 -1
  27. package/dist/assets/{debug-page-6DjAgWtl.js → debug-page-CHuby9yt.js} +1 -1
  28. package/dist/assets/{developer-page-dHmIDclp.js → developer-page-CUJqTs2_.js} +1 -1
  29. package/dist/assets/{diagnostics-BE1IgjfV.js → diagnostics-CLHyv7Xw.js} +1 -1
  30. package/dist/assets/{doctor-handoff-store-ClS6J-b-.js → doctor-handoff-store-DWNbuW3P.js} +1 -1
  31. package/dist/assets/{document-viewer-page-DJFR9XhM.js → document-viewer-page-_jndOS7P.js} +1 -1
  32. package/dist/assets/{emails-page-Ro1_IIiv.js → emails-page-Bqr8Buvt.js} +1 -1
  33. package/dist/assets/{first-run-scope-CZm4WhC7.js → first-run-scope-7wWjJ4Tn.js} +1 -1
  34. package/dist/assets/{funnel-events-BAmjKdwH.js → funnel-events-RT_kdQHK.js} +1 -1
  35. package/dist/assets/{general-page-BH3Zl4tV.js → general-page-DoAKoumC.js} +1 -1
  36. package/dist/assets/{handle-logout-C_CDLqjS.js → handle-logout-BTgnSSUm.js} +1 -1
  37. package/dist/assets/{haptics-agodX1nl.js → haptics-rJpeBta-.js} +1 -1
  38. package/dist/assets/{hatching-screen-CziT_eEj.js → hatching-screen-Q59qvj8_.js} +1 -1
  39. package/dist/assets/{home-page-route-BSHvc0DH.js → home-page-route-TPR5p3LW.js} +1 -1
  40. package/dist/assets/{hosting-screen-D6gwvyR3.js → hosting-screen-DRrmkmoO.js} +1 -1
  41. package/dist/assets/{index-D-NVGcvg.js → index-Ch9eoFem.js} +2 -2
  42. package/dist/assets/{ingest-DiiwFQfV.js → ingest-BbV11WbG.js} +1 -1
  43. package/dist/assets/{inspect-page-D0xZPslr.js → inspect-page-D_9E5ham.js} +1 -1
  44. package/dist/assets/{integrations-page-DuKFioaA.js → integrations-page-CnjTLjpf.js} +1 -1
  45. package/dist/assets/{library-detail-page-BmD8ODsN.js → library-detail-page-CKWN2cc7.js} +1 -1
  46. package/dist/assets/{library-page-B1_J428q.js → library-page-CuNX2WgS.js} +1 -1
  47. package/dist/assets/{local-runtime-upgrade-1CLFIVes.js → local-runtime-upgrade-JwVgn034.js} +1 -1
  48. package/dist/assets/{login-flow-BnCQjNXm.js → login-flow-llpmkEjN.js} +1 -1
  49. package/dist/assets/login-page-SG4TPVDu.js +1 -0
  50. package/dist/assets/{logout-page-BguUo424.js → logout-page-CBGk_cSN.js} +1 -1
  51. package/dist/assets/{logs-layout-BiZ4JakR.js → logs-layout-B4EPBuaC.js} +1 -1
  52. package/dist/assets/{memory-page-route-DwmCqWRb.js → memory-page-route-C8nIc6Mb.js} +1 -1
  53. package/dist/assets/{memory-router-playground-page-Bl-5j5de.js → memory-router-playground-page-ftfbkFhf.js} +1 -1
  54. package/dist/assets/{messages-BsXTJIIe.js → messages-BzNSqJQx.js} +1 -1
  55. package/dist/assets/{mobile-sidebar-drawer-Cp72bTDC.js → mobile-sidebar-drawer-BnxfQaDB.js} +1 -1
  56. package/dist/assets/native-anchor-BiuEQHcy.js +1 -0
  57. package/dist/assets/{native-biometric-CTR2Zi2w.js → native-biometric-B96mgKGP.js} +1 -1
  58. package/dist/assets/{navigation-resolver-CIICT6n9.js → navigation-resolver-Lxhf-tbn.js} +1 -1
  59. package/dist/assets/{notifications-page-CD8OVGKw.js → notifications-page-BAYd0t-0.js} +1 -1
  60. package/dist/assets/{open-workspace-file-DYklNHQ0.js → open-workspace-file-DucrTmt3.js} +2 -2
  61. package/dist/assets/{pairing-page-_kskNw0h.js → pairing-page-BRPUYbzJ.js} +1 -1
  62. package/dist/assets/{plans-page-D924rN93.js → plans-page-BxebYucs.js} +1 -1
  63. package/dist/assets/{platform-detection-BY5uzLL8.js → platform-detection-a_IB3-0w.js} +1 -1
  64. package/dist/assets/{platform-login-notice-DIS8PWXu.js → platform-login-notice-D-yQLWUo.js} +1 -1
  65. package/dist/assets/{platform-loopback-page-BTr35x9U.js → platform-loopback-page-DESnWJYO.js} +1 -1
  66. package/dist/assets/{privacy-page-BGXaPgBR.js → privacy-page-sZhcJ3uB.js} +1 -1
  67. package/dist/assets/{privacy-screen-znr9P7PH.js → privacy-screen-D2EBZTX8.js} +1 -1
  68. package/dist/assets/{provider-callback-page-Bn1Tp_ej.js → provider-callback-page-BZlfsT4J.js} +1 -1
  69. package/dist/assets/{provider-signup-page-C5z8x-YS.js → provider-signup-page-D5mOXHww.js} +1 -1
  70. package/dist/assets/{research-onboarding-route-DpC0dKBR.js → research-onboarding-route-ZOwRvfGs.js} +1 -1
  71. package/dist/assets/{retire-confirm-dialog-BFbPH66U.js → retire-confirm-dialog-m6ORm5Pq.js} +1 -1
  72. package/dist/assets/{review-terms-screen-W08isuCB.js → review-terms-screen-zzdu4AQi.js} +1 -1
  73. package/dist/assets/{risk-FjW-m05l.js → risk-uPLh5W5z.js} +1 -1
  74. package/dist/assets/{routes-DOTByxnJ.js → routes-BP00Ewbf.js} +5 -5
  75. package/dist/assets/{runtime-upgrade-banner-4PNA3XVR.js → runtime-upgrade-banner-yZYtWxoJ.js} +1 -1
  76. package/dist/assets/{schedules-page-BSr0-mjB.js → schedules-page-BQSGUmn5.js} +1 -1
  77. package/dist/assets/{select-assistant-screen-DAkhS0wl.js → select-assistant-screen-B5N_TUcG.js} +1 -1
  78. package/dist/assets/{session-corner-action-CqofVz_i.js → session-corner-action-vhb51vd3.js} +1 -1
  79. package/dist/assets/{settings-layout-DcuaK8qu.js → settings-layout-BtT0532M.js} +1 -1
  80. package/dist/assets/{share-feedback-modal-Dy0GRvA9.js → share-feedback-modal-DO6_oaZg.js} +1 -1
  81. package/dist/assets/{sidebar-tree-DrZXY5Iz.js → sidebar-tree-D6fHs4GK.js} +1 -1
  82. package/dist/assets/signup-page-DqfStkXZ.js +1 -0
  83. package/dist/assets/{site-favicon-CA7jaNnH.js → site-favicon-Dh1OTgFr.js} +1 -1
  84. package/dist/assets/{skill-detail-page-BCPN6NmR.js → skill-detail-page-SvM2JKKY.js} +1 -1
  85. package/dist/assets/{subagent-detail-panel-jOUXcDnl.js → subagent-detail-panel-jp0r0ZFk.js} +1 -1
  86. package/dist/assets/{subagent-store-C8qemfgn.js → subagent-store-DyKwOIj_.js} +1 -1
  87. package/dist/assets/{system-events-page-DEQyyquu.js → system-events-page-Cg0uMSMs.js} +1 -1
  88. package/dist/assets/{tool-detail-panel-86ruMQAQ.js → tool-detail-panel-CXcjfDGo.js} +1 -1
  89. package/dist/assets/{transcript-message-body-shared-CT5pk4wz.js → transcript-message-body-shared-woOFNF_q.js} +1 -1
  90. package/dist/assets/{upgrade-cancel-page-DmStvNCn.js → upgrade-cancel-page-D8is9-gw.js} +1 -1
  91. package/dist/assets/{upgrade-success-page-jOEtujYa.js → upgrade-success-page-3W1VuHqB.js} +1 -1
  92. package/dist/assets/{use-checkout-dismiss-refresh-BZXXQef1.js → use-checkout-dismiss-refresh-BkIzNk6B.js} +1 -1
  93. package/dist/assets/{use-command-palette-sections-DWCppiPf.js → use-command-palette-sections-CAmbyguu.js} +1 -1
  94. package/dist/assets/{use-edge-swipe-sMxDzAcb.js → use-edge-swipe-Gst62FjL.js} +1 -1
  95. package/dist/assets/{use-edge-swipe-back-Dbz1hC9g.js → use-edge-swipe-back-D12vbvly.js} +1 -1
  96. package/dist/assets/{use-ios-app-nudge-DiqQWH5O.js → use-ios-app-nudge-CrBEIZ8w.js} +1 -1
  97. package/dist/assets/{use-is-org-ready-BbqlQFXw.js → use-is-org-ready-zouQ5CN4.js} +1 -1
  98. package/dist/assets/{use-onboarding-login-xZhWGmky.js → use-onboarding-login-X8pB53cV.js} +1 -1
  99. package/dist/assets/{use-platform-assistant-id-BnFEQQeS.js → use-platform-assistant-id-CIoqMsyh.js} +1 -1
  100. package/dist/assets/{use-platform-gate-D9hR3R0n.js → use-platform-gate-CqEOGZtI.js} +1 -1
  101. package/dist/assets/use-return-to-short-circuit-B295pgoV.js +1 -0
  102. package/dist/assets/{use-sticky-profiles-GTUzoFP4.js → use-sticky-profiles-bdq2XW7H.js} +1 -1
  103. package/dist/assets/{use-subagent-card-data-Cu_-lx6d.js → use-subagent-card-data-B8JTa5rQ.js} +1 -1
  104. package/dist/assets/{voice-list-BMMz4e4M.js → voice-list-CCLkiF-c.js} +1 -1
  105. package/dist/assets/{voice-page-4AS-Fm6W.js → voice-page-Bvgm-7L8.js} +1 -1
  106. package/dist/assets/{welcome-screen-B-88csxO.js → welcome-screen-Cga6YuF9.js} +1 -1
  107. package/dist/assets/{workspace-page-b8SfI_28.js → workspace-page-BFJO59Ch.js} +1 -1
  108. package/dist/index.html +43 -43
  109. package/package.json +1 -1
  110. package/dist/assets/login-page-BnF7_s7c.js +0 -1
  111. package/dist/assets/native-anchor-BpfRwc60.js +0 -1
  112. package/dist/assets/signup-page-B6mmAQJU.js +0 -1
  113. package/dist/assets/use-return-to-short-circuit-B1mhvgIq.js +0 -1
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{f as o}from"./local-mode-9zpgPNoq.js";import{t as s}from"./is-electron-7N7iyz1y.js";import{_ as c,i as l,n as u}from"./auth-store-w_EmIQP7.js";import{S as d,h as f,x as p,y as m}from"./native-biometric-CTR2Zi2w.js";import{d as h,t as g}from"./routes-GmNvdtLW.js";import{d as _,m as v,p as y}from"./prefs-B6fvTCOn.js";import{o as b,r as x}from"./navigation-resolver-CIICT6n9.js";import{l as S,n as C,o as w}from"./funnel-events-BAmjKdwH.js";import{t as T}from"./onboarding-layout-K7X9fV8B.js";import{t as E}from"./plugin-attribution-Hjqz10My.js";import{n as D,t as O}from"./consent-controls-CiKmEzBn.js";import{r as k,t as A}from"./checkout-continuation-DRPQwh5V.js";var j=e(t(),1),M=a();function N({current:e,total:t,color:n}){return(0,M.jsx)(`div`,{className:`flex items-center gap-1.5`,role:`group`,"aria-label":`Step ${e+1} of ${t}`,children:Array.from({length:t},(t,r)=>(0,M.jsx)(`div`,{"aria-hidden":`true`,className:`h-[3px] w-8 rounded-full transition-colors`,style:n?{backgroundColor:n,opacity:r<=e?1:.3}:void 0,children:n?null:(0,M.jsx)(`div`,{className:`h-full w-full rounded-full bg-[var(--content-default)] ${r<=e?``:`opacity-20`}`})},r))})}function P(){let e=i(),[t]=r(),a=u.use.user()?.id??null,m=s(),g=f(),[P,I]=y(),L=P??!0,[R,z]=v(),[B,V]=_(),H=l(),U=k();(0,j.useEffect)(()=>{S()},[]);let W=t.get(`preview`)===`true`,G=(0,j.useCallback)(e=>{},[]),K=W?G:I,q=W?G:z,J=W?G:V,Y=(0,j.useCallback)(()=>{if(W)return;c({userId:a,tos:R,privacy:B,shareAnalytics:null,shareDiagnostics:L,hasPlatformSession:H}),w(C.privacyTos,{userId:a});let n=x(t.get(`returnTo`));if(n){e(n);return}let r=t.get(`hosting`),i=new URLSearchParams;r&&i.set(`hosting`,r);let s=t.get(E);s&&i.set(E,s);let l=i.toString(),u=`${b({isLocalHatch:o()&&r!==null&&r!==`vellum-cloud`})}${l?`?${l}`:``}`,f=d();if(f?.resumeAfterOnboarding===!0)if(U===`disabled`)p();else{let t=F(f);if(t){t.set(A,u),e(`${h.checkout}?${t.toString()}`);return}}e(u)},[B,H,W,e,t,L,U,R,a]);return(0,M.jsx)(T,{children:(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${m?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[g&&(0,M.jsx)(`div`,{className:`mb-8 flex w-full justify-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:(0,M.jsx)(N,{current:2,total:3})}),(0,M.jsx)(`h1`,{className:m?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Before You Start`}),(0,M.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${m?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Choose your privacy preferences. You can update these anytime in the Settings.`}),(0,M.jsx)(D,{electron:m,showAnalytics:!1,shareAnalytics:!1,shareDiagnostics:L,onShareAnalyticsChange:G,onShareDiagnosticsChange:K,className:`mt-8 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`}}),(0,M.jsx)(O,{electron:m,privacyConsent:B,tosAccepted:R,onPrivacyChange:J,onTosChange:q,className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`}}),(0,M.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${m?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.55s both`},children:[(0,M.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!R||!B,onClick:Y,className:m?void 0:`h-11 text-base`,children:`Start`}),(0,M.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>e(o()?h.onboarding.hosting:h.onboarding.start),className:m?void 0:`h-11 text-base`,children:`Back`})]})]})})}function F(e){return e.kind===`package`?new URLSearchParams({[g]:e.packageKey}):e.storageTier===null?null:m({machineTier:e.machineTier,storageTier:e.storageTier,creditTier:e.creditTier})}export{P as PrivacyScreen};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{f as o}from"./local-mode-9zpgPNoq.js";import{t as s}from"./is-electron-7N7iyz1y.js";import{_ as c,i as l,n as u}from"./auth-store-BwKMFgpK.js";import{S as d,h as f,x as p,y as m}from"./native-biometric-B96mgKGP.js";import{d as h,t as g}from"./routes-GmNvdtLW.js";import{d as _,m as v,p as y}from"./prefs-B6fvTCOn.js";import{o as b,r as x}from"./navigation-resolver-Lxhf-tbn.js";import{l as S,n as C,o as w}from"./funnel-events-RT_kdQHK.js";import{t as T}from"./onboarding-layout-K7X9fV8B.js";import{t as E}from"./plugin-attribution-Hjqz10My.js";import{n as D,t as O}from"./consent-controls-CiKmEzBn.js";import{r as k,t as A}from"./checkout-continuation-CcuqWhhp.js";var j=e(t(),1),M=a();function N({current:e,total:t,color:n}){return(0,M.jsx)(`div`,{className:`flex items-center gap-1.5`,role:`group`,"aria-label":`Step ${e+1} of ${t}`,children:Array.from({length:t},(t,r)=>(0,M.jsx)(`div`,{"aria-hidden":`true`,className:`h-[3px] w-8 rounded-full transition-colors`,style:n?{backgroundColor:n,opacity:r<=e?1:.3}:void 0,children:n?null:(0,M.jsx)(`div`,{className:`h-full w-full rounded-full bg-[var(--content-default)] ${r<=e?``:`opacity-20`}`})},r))})}function P(){let e=i(),[t]=r(),a=u.use.user()?.id??null,m=s(),g=f(),[P,I]=y(),L=P??!0,[R,z]=v(),[B,V]=_(),H=l(),U=k();(0,j.useEffect)(()=>{S()},[]);let W=t.get(`preview`)===`true`,G=(0,j.useCallback)(e=>{},[]),K=W?G:I,q=W?G:z,J=W?G:V,Y=(0,j.useCallback)(()=>{if(W)return;c({userId:a,tos:R,privacy:B,shareAnalytics:null,shareDiagnostics:L,hasPlatformSession:H}),w(C.privacyTos,{userId:a});let n=x(t.get(`returnTo`));if(n){e(n);return}let r=t.get(`hosting`),i=new URLSearchParams;r&&i.set(`hosting`,r);let s=t.get(E);s&&i.set(E,s);let l=i.toString(),u=`${b({isLocalHatch:o()&&r!==null&&r!==`vellum-cloud`})}${l?`?${l}`:``}`,f=d();if(f?.resumeAfterOnboarding===!0)if(U===`disabled`)p();else{let t=F(f);if(t){t.set(A,u),e(`${h.checkout}?${t.toString()}`);return}}e(u)},[B,H,W,e,t,L,U,R,a]);return(0,M.jsx)(T,{children:(0,M.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${m?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`px-6 py-16`} text-[var(--content-default)]`,children:[g&&(0,M.jsx)(`div`,{className:`mb-8 flex w-full justify-center`,style:{animation:`fadeInUp 0.3s ease-out 0.1s both`},children:(0,M.jsx)(N,{current:2,total:3})}),(0,M.jsx)(`h1`,{className:m?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Before You Start`}),(0,M.jsx)(`p`,{className:`text-center text-body-medium-lighter text-[var(--content-tertiary)] ${m?`mt-3.5`:`mt-4`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Choose your privacy preferences. You can update these anytime in the Settings.`}),(0,M.jsx)(D,{electron:m,showAnalytics:!1,shareAnalytics:!1,shareDiagnostics:L,onShareAnalyticsChange:G,onShareDiagnosticsChange:K,className:`mt-8 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`}}),(0,M.jsx)(O,{electron:m,privacyConsent:B,tosAccepted:R,onPrivacyChange:J,onTosChange:q,className:`mt-6 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`}}),(0,M.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${m?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.55s both`},children:[(0,M.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,disabled:!R||!B,onClick:Y,className:m?void 0:`h-11 text-base`,children:`Start`}),(0,M.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:()=>e(o()?h.onboarding.hosting:h.onboarding.start),className:m?void 0:`h-11 text-base`,children:`Back`})]})]})})}function F(e){return e.kind===`package`?new URLSearchParams({[g]:e.packageKey}):e.storageTier===null?null:m({machineTier:e.machineTier,storageTier:e.storageTier,creditTier:e.creditTier})}export{P as PrivacyScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-FWzaVb8P.js";import{t as n}from"./react-BFJW0bSv.js";import{m as r,t as i,u as a}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as o}from"./jsx-runtime-D3ZM-ToX.js";import{E as s,f as c}from"./local-mode-9zpgPNoq.js";import{Z as l,n as u}from"./auth-store-w_EmIQP7.js";import{c as d}from"./api-C8TlQNEU.js";import{E as f,j as p}from"./native-biometric-CTR2Zi2w.js";import{d as m}from"./routes-GmNvdtLW.js";import{i as h,s as g}from"./login-flow-BnCQjNXm.js";import{t as _}from"./external-urls-97O9n0lb.js";import{r as v,t as y}from"./account-shell-BxZ339N3.js";var b=e(n(),1),x=o();function S(){let[e]=r(),n=a(),o=u.use.refreshSession(),S=e.get(`error`),[C,w]=(0,b.useState)(null),T=(0,b.useRef)(!1),E=e.get(`returnTo`),D=h(e);return(0,b.useEffect)(()=>{T.current||S||(T.current=!0,(async()=>{try{let t=await p(),r=f(t.ok&&!!t.data.user,t.ok?[]:t.flows??[]);switch(r.kind){case`authenticated`:{if(await o(),c())try{let e=await d();if(e.ok&&e.data.length>0&&(await s(e.data,l.getState().currentOrganizationId??void 0),!E)){n(m.assistant,{replace:!0});break}}catch{}let e=m.assistant,{destination:t,requiresFullPageNavigation:r}=g({returnTo:E,fallback:e,authIntent:D});r?window.location.href=t:n(t,{replace:!0});break}case`provider_signup`:{let t=e.get(`returnTo`);n(t?`${m.account.providerSignup}?returnTo=${encodeURIComponent(t)}`:m.account.providerSignup,{replace:!0});break}case`error`:w(r.message);break}}catch(e){t(e,{context:`provider_callback`}),w(`Something went wrong. Please try signing in again.`)}})())},[D,S,o,E,n,e]),S===`signup_closed`?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Signups are currently closed`,subtitle:`Join the community to request access or learn when signups reopen.`}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Join the community`}),(0,x.jsx)(i,{to:m.account.login,className:`text-sm font-medium text-[var(--content-emphasised)] hover:underline`,children:`Back to sign in`})]})]}):S||C?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Authentication failed`,subtitle:C??`Something went wrong during social sign-in. Please try again or use a different method.`}),(0,x.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,x.jsx)(i,{to:m.account.login,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Back to sign in`})})]}):(0,x.jsx)(y,{children:(0,x.jsx)(v,{title:`Completing sign-in...`,subtitle:`Please wait while we finish authenticating you.`})})}export{S as ProviderCallbackPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-FWzaVb8P.js";import{t as n}from"./react-BFJW0bSv.js";import{m as r,t as i,u as a}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as o}from"./jsx-runtime-D3ZM-ToX.js";import{E as s,f as c}from"./local-mode-9zpgPNoq.js";import{Z as l,n as u}from"./auth-store-BwKMFgpK.js";import{c as d}from"./api-C8TlQNEU.js";import{E as f,M as p}from"./native-biometric-B96mgKGP.js";import{d as m}from"./routes-GmNvdtLW.js";import{i as h,s as g}from"./login-flow-llpmkEjN.js";import{t as _}from"./external-urls-97O9n0lb.js";import{r as v,t as y}from"./account-shell-BxZ339N3.js";var b=e(n(),1),x=o();function S(){let[e]=r(),n=a(),o=u.use.refreshSession(),S=e.get(`error`),[C,w]=(0,b.useState)(null),T=(0,b.useRef)(!1),E=e.get(`returnTo`),D=h(e);return(0,b.useEffect)(()=>{T.current||S||(T.current=!0,(async()=>{try{let t=await p(),r=f(t.ok&&!!t.data.user,t.ok?[]:t.flows??[]);switch(r.kind){case`authenticated`:{if(await o(),c())try{let e=await d();if(e.ok&&e.data.length>0&&(await s(e.data,l.getState().currentOrganizationId??void 0),!E)){n(m.assistant,{replace:!0});break}}catch{}let e=m.assistant,{destination:t,requiresFullPageNavigation:r}=g({returnTo:E,fallback:e,authIntent:D});r?window.location.href=t:n(t,{replace:!0});break}case`provider_signup`:{let t=e.get(`returnTo`);n(t?`${m.account.providerSignup}?returnTo=${encodeURIComponent(t)}`:m.account.providerSignup,{replace:!0});break}case`error`:w(r.message);break}}catch(e){t(e,{context:`provider_callback`}),w(`Something went wrong. Please try signing in again.`)}})())},[D,S,o,E,n,e]),S===`signup_closed`?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Signups are currently closed`,subtitle:`Join the community to request access or learn when signups reopen.`}),(0,x.jsxs)(`div`,{className:`flex flex-col items-center gap-4`,children:[(0,x.jsx)(`a`,{href:_,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Join the community`}),(0,x.jsx)(i,{to:m.account.login,className:`text-sm font-medium text-[var(--content-emphasised)] hover:underline`,children:`Back to sign in`})]})]}):S||C?(0,x.jsxs)(y,{children:[(0,x.jsx)(v,{title:`Authentication failed`,subtitle:C??`Something went wrong during social sign-in. Please try again or use a different method.`}),(0,x.jsx)(`div`,{className:`flex flex-col items-center gap-4`,children:(0,x.jsx)(i,{to:m.account.login,className:`inline-flex items-center justify-center gap-2 rounded-lg bg-[var(--primary-base)] px-6 py-3 text-sm font-medium text-[var(--content-inset)] no-underline transition-colors hover:bg-[var(--primary-hover)]`,children:`Back to sign in`})})]}):(0,x.jsx)(y,{children:(0,x.jsx)(v,{title:`Completing sign-in...`,subtitle:`Please wait while we finish authenticating you.`})})}export{S as ProviderCallbackPage};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{m as n,t as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{n as o}from"./auth-store-w_EmIQP7.js";import{A as s,M as c,P as l}from"./native-biometric-CTR2Zi2w.js";import{d as u}from"./routes-GmNvdtLW.js";import{c as d,s as f}from"./login-flow-BnCQjNXm.js";import{i as p,n as m,r as h,t as g}from"./account-shell-BxZ339N3.js";import{t as _}from"./signup-shell-CMXUBUal.js";var v=e(t(),1),y=a();function b(){let e=i(),[t]=n(),a=o.use.refreshSession(),b=t.get(`returnTo`),[x,S]=(0,v.useState)(``),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(null),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(!0),L=(0,v.useRef)(!1);(0,v.useEffect)(()=>{L.current||(L.current=!0,(async()=>{try{let t=await s();if(!t.ok){e(u.account.login,{replace:!0});return}S(t.data.user.email??``),w(t.data.user.username??``),E(t.data.user.first_name??``),O(t.data.user.last_name??``),I(!1)}catch{e(u.account.login,{replace:!0})}})())},[e]);let R=async()=>{let t=await l({email:x,username:C});if(!t.ok){if(c(t)){await a();let t=d(b,u.account.root);t.requiresFullPageNavigation?window.location.href=t.destination:e(t.destination);return}M(t.errors[0]?.message??`Failed to complete signup.`);return}await a();let n=f({returnTo:b,fallback:u.account.root,authIntent:`signup`});n.requiresFullPageNavigation?window.location.href=n.destination:e(n.destination)},z=async e=>{e.preventDefault(),M(null),P(!0);try{await R()}catch{M(`Something went wrong. Please try again.`)}finally{P(!1)}},B=async e=>{if(e.preventDefault(),k.trim()){M(null),P(!0);try{await R()}catch{M(`Something went wrong. Please try again.`)}finally{P(!1)}}};if(F)return(0,y.jsx)(g,{children:(0,y.jsx)(h,{title:`Completing signup...`,subtitle:`Please wait while we load your information.`})});if(x&&C){let e=k.trim().length>0&&!N;return(0,y.jsx)(_,{children:(0,y.jsxs)(`form`,{onSubmit:B,className:`signup-details__thread`,children:[(0,y.jsxs)(`h2`,{className:`signup-details__heading`,children:[`Almost there,`,(0,y.jsx)(`br`,{}),`one more detail`]}),j&&(0,y.jsx)(`p`,{className:`signup-details__error`,children:j}),(0,y.jsxs)(`div`,{className:`signup-details__step`,children:[(0,y.jsxs)(`span`,{className:`signup-details__label`,children:[`What should I call you?`,` `,(0,y.jsx)(`span`,{className:`signup-details__req`,children:`*`})]}),(0,y.jsx)(`input`,{className:`signup-details__input`,type:`text`,placeholder:`First name`,value:T,readOnly:!0,disabled:!0})]}),(0,y.jsxs)(`div`,{className:`signup-details__step`,children:[(0,y.jsxs)(`span`,{className:`signup-details__label`,children:[`And your last name? `,(0,y.jsx)(`span`,{className:`signup-details__req`,children:`*`})]}),(0,y.jsx)(`input`,{className:`signup-details__input`,type:`text`,placeholder:`Last name`,value:D,readOnly:!0,disabled:!0})]}),(0,y.jsxs)(`div`,{className:`signup-details__step`,children:[(0,y.jsxs)(`span`,{className:`signup-details__label`,children:[`Your role `,(0,y.jsx)(`span`,{className:`signup-details__req`,children:`*`})]}),(0,y.jsx)(`input`,{className:`signup-details__input`,type:`text`,autoComplete:`organization-title`,placeholder:`e.g. Software Engineer`,value:k,onChange:e=>A(e.target.value),autoFocus:!0})]}),(0,y.jsx)(`div`,{className:`signup-details__step`,children:(0,y.jsx)(`button`,{type:`submit`,className:`signup-details__continue`,disabled:!e,children:N?`Setting up…`:`Continue →`})})]})})}return(0,y.jsxs)(g,{children:[(0,y.jsx)(h,{title:`Complete your account`,subtitle:`We need a few more details to finish setting up your account.`}),(0,y.jsxs)(m,{onSubmit:z,error:j,submitLabel:`Complete signup`,submittingLabel:`Completing...`,isSubmitting:N,footer:(0,y.jsx)(r,{to:u.account.login,className:`text-sm text-[var(--content-secondary)] hover:text-[var(--content-default)]`,children:`← Back to sign in`}),children:[(0,y.jsx)(p,{id:`email`,type:`email`,autoComplete:`email`,placeholder:`Email`,value:x,onChange:e=>S(e.target.value),required:!0}),(0,y.jsx)(p,{id:`username`,type:`text`,autoComplete:`username`,placeholder:`Username`,value:C,onChange:e=>w(e.target.value),required:!0})]})]})}export{b as ProviderSignupPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{m as n,t as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{n as o}from"./auth-store-BwKMFgpK.js";import{F as s,N as c,j as l}from"./native-biometric-B96mgKGP.js";import{d as u}from"./routes-GmNvdtLW.js";import{c as d,s as f}from"./login-flow-llpmkEjN.js";import{i as p,n as m,r as h,t as g}from"./account-shell-BxZ339N3.js";import{t as _}from"./signup-shell-CMXUBUal.js";var v=e(t(),1),y=a();function b(){let e=i(),[t]=n(),a=o.use.refreshSession(),b=t.get(`returnTo`),[x,S]=(0,v.useState)(``),[C,w]=(0,v.useState)(``),[T,E]=(0,v.useState)(``),[D,O]=(0,v.useState)(``),[k,A]=(0,v.useState)(``),[j,M]=(0,v.useState)(null),[N,P]=(0,v.useState)(!1),[F,I]=(0,v.useState)(!0),L=(0,v.useRef)(!1);(0,v.useEffect)(()=>{L.current||(L.current=!0,(async()=>{try{let t=await l();if(!t.ok){e(u.account.login,{replace:!0});return}S(t.data.user.email??``),w(t.data.user.username??``),E(t.data.user.first_name??``),O(t.data.user.last_name??``),I(!1)}catch{e(u.account.login,{replace:!0})}})())},[e]);let R=async()=>{let t=await s({email:x,username:C});if(!t.ok){if(c(t)){await a();let t=d(b,u.account.root);t.requiresFullPageNavigation?window.location.href=t.destination:e(t.destination);return}M(t.errors[0]?.message??`Failed to complete signup.`);return}await a();let n=f({returnTo:b,fallback:u.account.root,authIntent:`signup`});n.requiresFullPageNavigation?window.location.href=n.destination:e(n.destination)},z=async e=>{e.preventDefault(),M(null),P(!0);try{await R()}catch{M(`Something went wrong. Please try again.`)}finally{P(!1)}},B=async e=>{if(e.preventDefault(),k.trim()){M(null),P(!0);try{await R()}catch{M(`Something went wrong. Please try again.`)}finally{P(!1)}}};if(F)return(0,y.jsx)(g,{children:(0,y.jsx)(h,{title:`Completing signup...`,subtitle:`Please wait while we load your information.`})});if(x&&C){let e=k.trim().length>0&&!N;return(0,y.jsx)(_,{children:(0,y.jsxs)(`form`,{onSubmit:B,className:`signup-details__thread`,children:[(0,y.jsxs)(`h2`,{className:`signup-details__heading`,children:[`Almost there,`,(0,y.jsx)(`br`,{}),`one more detail`]}),j&&(0,y.jsx)(`p`,{className:`signup-details__error`,children:j}),(0,y.jsxs)(`div`,{className:`signup-details__step`,children:[(0,y.jsxs)(`span`,{className:`signup-details__label`,children:[`What should I call you?`,` `,(0,y.jsx)(`span`,{className:`signup-details__req`,children:`*`})]}),(0,y.jsx)(`input`,{className:`signup-details__input`,type:`text`,placeholder:`First name`,value:T,readOnly:!0,disabled:!0})]}),(0,y.jsxs)(`div`,{className:`signup-details__step`,children:[(0,y.jsxs)(`span`,{className:`signup-details__label`,children:[`And your last name? `,(0,y.jsx)(`span`,{className:`signup-details__req`,children:`*`})]}),(0,y.jsx)(`input`,{className:`signup-details__input`,type:`text`,placeholder:`Last name`,value:D,readOnly:!0,disabled:!0})]}),(0,y.jsxs)(`div`,{className:`signup-details__step`,children:[(0,y.jsxs)(`span`,{className:`signup-details__label`,children:[`Your role `,(0,y.jsx)(`span`,{className:`signup-details__req`,children:`*`})]}),(0,y.jsx)(`input`,{className:`signup-details__input`,type:`text`,autoComplete:`organization-title`,placeholder:`e.g. Software Engineer`,value:k,onChange:e=>A(e.target.value),autoFocus:!0})]}),(0,y.jsx)(`div`,{className:`signup-details__step`,children:(0,y.jsx)(`button`,{type:`submit`,className:`signup-details__continue`,disabled:!e,children:N?`Setting up…`:`Continue →`})})]})})}return(0,y.jsxs)(g,{children:[(0,y.jsx)(h,{title:`Complete your account`,subtitle:`We need a few more details to finish setting up your account.`}),(0,y.jsxs)(m,{onSubmit:z,error:j,submitLabel:`Complete signup`,submittingLabel:`Completing...`,isSubmitting:N,footer:(0,y.jsx)(r,{to:u.account.login,className:`text-sm text-[var(--content-secondary)] hover:text-[var(--content-default)]`,children:`← Back to sign in`}),children:[(0,y.jsx)(p,{id:`email`,type:`email`,autoComplete:`email`,placeholder:`Email`,value:x,onChange:e=>S(e.target.value),required:!0}),(0,y.jsx)(p,{id:`username`,type:`text`,autoComplete:`username`,placeholder:`Username`,value:C,onChange:e=>w(e.target.value),required:!0})]})]})}export{b as ProviderSignupPage};
@@ -1,4 +1,4 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{o as t,t as n}from"./capture-error-FWzaVb8P.js";import{t as r}from"./react-BFJW0bSv.js";import{F as i,t as a}from"./button-Dy5001j6.js";import{m as o,u as s}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as c}from"./QueryClientProvider-CMu7CkQU.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./cn-CJf7MmLX.js";import{t as d}from"./arrow-left-C2ylPLHq.js";import{t as f}from"./arrow-right-B-jRJNWP.js";import{t as p}from"./dices-DcuIF52A.js";import{t as m}from"./loader-circle-BzJ2kz3F.js";import{t as h}from"./pencil-CLJIvYKH.js";import{t as g}from"./plus-JG7kWjHA.js";import{t as _}from"./search-DA3TmTuR.js";import{t as v}from"./x-DuBvjmAE.js";import{t as y}from"./notice-DCp7WO3L.js";import{t as b}from"./tag-D8NAGb0r.js";import{t as x}from"./input-C-GkeWCw.js";import{i as S,r as C,t as w}from"./dist-CQN0ZAOZ.js";import{n as T,t as E}from"./create-selectors-B-P03-8K.js";import{b as D,dt as ee,f as O,it as k,o as A,ot as j,w as M}from"./local-mode-9zpgPNoq.js";import{r as N}from"./api-errors-SZKDzMLE.js";import{Y as te,Z as ne,dt as re,ft as ie,lt as ae,n as oe,tt as se,ut as P}from"./auth-store-w_EmIQP7.js";import{Gn as ce,Kn as le,Or as ue,Sn as de,V as fe,tt as pe,xn as F}from"./sdk.gen-BySz4QYj.js";import{a as me,o as I,r as he}from"./api-C8TlQNEU.js";import{d as ge}from"./routes-GmNvdtLW.js";import{n as _e}from"./use-is-org-ready-BbqlQFXw.js";import{n as ve}from"./platform-detection-BY5uzLL8.js";import{t as ye}from"./navigation-resolver-CIICT6n9.js";import{o as be,s as xe}from"./prechat-EVefdGcO.js";import{t as Se}from"./browser-timezone-DGz-HvxU.js";import{t as Ce}from"./identity-Cb4xS1Kk.js";import{c as we}from"./conversation-list-fetchers-BZnx9EMN.js";import{i as Te}from"./conversation-cache-BzPdBPXN.js";import{t as Ee}from"./avatar-bundled-components-CTd294ra.js";import{i as De,n as Oe,r as ke,t as Ae}from"./research-onboarding-persistence-BN6g1lF7.js";import{a as je,c as Me,i as Ne,l as Pe,o as Fe,s as L,t as R,u as Ie}from"./first-run-scope-CZm4WhC7.js";import{c as Le,i as Re}from"./funnel-events-BAmjKdwH.js";import{t as z}from"./proxy-CNtrhN4q.js";import{t as B}from"./AnimatePresence-D23js3-M.js";import{t as V}from"./use-reduced-motion-bjjt6x6d.js";import{i as ze}from"./avatar-tone-4L7foPzW.js";import{n as Be,t as Ve}from"./eye-bbox-DE8r0Vt3.js";import{a as He,i as Ue}from"./research-facts-BcW4fghT.js";import{t as H}from"./onboarding-layout-K7X9fV8B.js";import{t as U}from"./animated-avatar-CDeJNhwm.js";import{n as W,t as We}from"./use-bundled-avatar-components-IQw2k8-g.js";import{c as Ge,i as Ke,l as qe,n as Je,r as Ye,s as Xe,t as Ze}from"./latest-assistant-text-DPm0HIWu.js";import{n as G,t as Qe}from"./onboarding-step-layout-DGtbhZJb.js";import{a as $e,i as et,n as tt,r as nt,t as rt}from"./avatar-random-IysJ0Bdt.js";import{n as it}from"./plugin-attribution-Hjqz10My.js";var K=e(r(),1),at=`grounded`,ot=12;function st(e,t){let n=e.slice(0,ot).map(e=>`- ${e.name} — ${e.description}`).join(`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{o as t,t as n}from"./capture-error-FWzaVb8P.js";import{t as r}from"./react-BFJW0bSv.js";import{F as i,t as a}from"./button-Dy5001j6.js";import{m as o,u as s}from"./chunk-5KNZJZUH-Bsoom5--.js";import{n as c}from"./QueryClientProvider-CMu7CkQU.js";import{t as l}from"./jsx-runtime-D3ZM-ToX.js";import{t as u}from"./cn-CJf7MmLX.js";import{t as d}from"./arrow-left-C2ylPLHq.js";import{t as f}from"./arrow-right-B-jRJNWP.js";import{t as p}from"./dices-DcuIF52A.js";import{t as m}from"./loader-circle-BzJ2kz3F.js";import{t as h}from"./pencil-CLJIvYKH.js";import{t as g}from"./plus-JG7kWjHA.js";import{t as _}from"./search-DA3TmTuR.js";import{t as v}from"./x-DuBvjmAE.js";import{t as y}from"./notice-DCp7WO3L.js";import{t as b}from"./tag-D8NAGb0r.js";import{t as x}from"./input-C-GkeWCw.js";import{i as S,r as C,t as w}from"./dist-CQN0ZAOZ.js";import{n as T,t as E}from"./create-selectors-B-P03-8K.js";import{b as D,dt as ee,f as O,it as k,o as A,ot as j,w as M}from"./local-mode-9zpgPNoq.js";import{r as N}from"./api-errors-SZKDzMLE.js";import{Y as te,Z as ne,dt as re,ft as ie,lt as ae,n as oe,tt as se,ut as P}from"./auth-store-BwKMFgpK.js";import{Gn as ce,Kn as le,Or as ue,Sn as de,V as fe,tt as pe,xn as F}from"./sdk.gen-BySz4QYj.js";import{a as me,o as I,r as he}from"./api-C8TlQNEU.js";import{d as ge}from"./routes-GmNvdtLW.js";import{n as _e}from"./use-is-org-ready-zouQ5CN4.js";import{n as ve}from"./platform-detection-a_IB3-0w.js";import{t as ye}from"./navigation-resolver-Lxhf-tbn.js";import{o as be,s as xe}from"./prechat-EVefdGcO.js";import{t as Se}from"./browser-timezone-DGz-HvxU.js";import{t as Ce}from"./identity-Cb4xS1Kk.js";import{c as we}from"./conversation-list-fetchers-BZnx9EMN.js";import{i as Te}from"./conversation-cache-BzPdBPXN.js";import{t as Ee}from"./avatar-bundled-components-CTd294ra.js";import{i as De,n as Oe,r as ke,t as Ae}from"./research-onboarding-persistence-BN6g1lF7.js";import{a as je,c as Me,i as Ne,l as Pe,o as Fe,s as L,t as R,u as Ie}from"./first-run-scope-7wWjJ4Tn.js";import{c as Le,i as Re}from"./funnel-events-RT_kdQHK.js";import{t as z}from"./proxy-CNtrhN4q.js";import{t as B}from"./AnimatePresence-D23js3-M.js";import{t as V}from"./use-reduced-motion-bjjt6x6d.js";import{i as ze}from"./avatar-tone-4L7foPzW.js";import{n as Be,t as Ve}from"./eye-bbox-DE8r0Vt3.js";import{a as He,i as Ue}from"./research-facts-BcW4fghT.js";import{t as H}from"./onboarding-layout-K7X9fV8B.js";import{t as U}from"./animated-avatar-CDeJNhwm.js";import{n as W,t as We}from"./use-bundled-avatar-components-IQw2k8-g.js";import{c as Ge,i as Ke,l as qe,n as Je,r as Ye,s as Xe,t as Ze}from"./latest-assistant-text-DPm0HIWu.js";import{n as G,t as Qe}from"./onboarding-step-layout-DGtbhZJb.js";import{a as $e,i as et,n as tt,r as nt,t as rt}from"./avatar-random-IysJ0Bdt.js";import{n as it}from"./plugin-attribution-Hjqz10My.js";var K=e(r(),1),at=`grounded`,ot=12;function st(e,t){let n=e.slice(0,ot).map(e=>`- ${e.name} — ${e.description}`).join(`
2
2
  `);return n?`
3
3
  Capabilities you can offer me — specialized skillsets you can invoke on my behalf, not generic chat:
4
4
  ${n}
@@ -1 +1 @@
1
- import{a as e}from"./local-settings-C-dW2vkq.js";import{t}from"./jsx-runtime-D3ZM-ToX.js";import{t as n}from"./confirm-dialog-DZX6LhLy.js";import{E as r,S as i,a,d as o,f as s}from"./local-mode-9zpgPNoq.js";import{n as c}from"./resolved-assistants-store-8HQDfxZh.js";import{Z as l,n as u}from"./auth-store-w_EmIQP7.js";import{c as d,d as f}from"./api-C8TlQNEU.js";import{d as p}from"./routes-GmNvdtLW.js";import{a as m}from"./navigation-resolver-CIICT6n9.js";import{t as h}from"./build-state-DDUJ0MId.js";import{t as g}from"./research-onboarding-persistence-BN6g1lF7.js";var _=`vellum_assistant_name`;function v(){let e=m(h(),{kind:`post-retire`});return e.action===`redirect`?e.to:p.welcome}async function y(t){try{let n=a().assistants.find(e=>e.assistantId===t);if(s()&&n&&o(n)){let e=await i(t);if(!e.ok)return{ok:!1,error:e.error||`Failed to retire assistant.`}}else{let e=await f(t);if(!(e.ok||e.status===404))return{ok:!1,error:typeof e.error?.detail==`string`?e.error.detail:`Failed to retire assistant.`};if(s())try{let e=await d();e.ok&&await r(e.data,l.getState().currentOrganizationId??void 0)}catch{}}return c.getState().remove(t),g(u.getState().user?.id??null),e(_),{ok:!0,nextRoute:v()}}catch{return{ok:!1,error:`Failed to retire assistant.`}}}var b=t();function x({open:e,isPending:t,extraMessage:r,onConfirm:i,onCancel:a}){return(0,b.jsx)(n,{open:e,title:`Retire Assistant`,message:(0,b.jsxs)(b.Fragment,{children:[`This will permanently retire this assistant and all of its data. You will need to go through the onboarding flow again to create a new one. This action cannot be undone.`,r]}),confirmLabel:`Retire`,destructive:!0,isPending:t,onConfirm:i,onCancel:a})}export{y as n,x as t};
1
+ import{a as e}from"./local-settings-C-dW2vkq.js";import{t}from"./jsx-runtime-D3ZM-ToX.js";import{t as n}from"./confirm-dialog-DZX6LhLy.js";import{E as r,S as i,a,d as o,f as s}from"./local-mode-9zpgPNoq.js";import{n as c}from"./resolved-assistants-store-8HQDfxZh.js";import{Z as l,n as u}from"./auth-store-BwKMFgpK.js";import{c as d,d as f}from"./api-C8TlQNEU.js";import{d as p}from"./routes-GmNvdtLW.js";import{a as m}from"./navigation-resolver-Lxhf-tbn.js";import{t as h}from"./build-state-DPMhQpLB.js";import{t as g}from"./research-onboarding-persistence-BN6g1lF7.js";var _=`vellum_assistant_name`;function v(){let e=m(h(),{kind:`post-retire`});return e.action===`redirect`?e.to:p.welcome}async function y(t){try{let n=a().assistants.find(e=>e.assistantId===t);if(s()&&n&&o(n)){let e=await i(t);if(!e.ok)return{ok:!1,error:e.error||`Failed to retire assistant.`}}else{let e=await f(t);if(!(e.ok||e.status===404))return{ok:!1,error:typeof e.error?.detail==`string`?e.error.detail:`Failed to retire assistant.`};if(s())try{let e=await d();e.ok&&await r(e.data,l.getState().currentOrganizationId??void 0)}catch{}}return c.getState().remove(t),g(u.getState().user?.id??null),e(_),{ok:!0,nextRoute:v()}}catch{return{ok:!1,error:`Failed to retire assistant.`}}}var b=t();function x({open:e,isPending:t,extraMessage:r,onConfirm:i,onCancel:a}){return(0,b.jsx)(n,{open:e,title:`Retire Assistant`,message:(0,b.jsxs)(b.Fragment,{children:[`This will permanently retire this assistant and all of its data. You will need to go through the onboarding flow again to create a new one. This action cannot be undone.`,r]}),confirmLabel:`Retire`,destructive:!0,isPending:t,onConfirm:i,onCancel:a})}export{y as n,x as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{t as o}from"./shield-check-z7CU-gBq.js";import{t as ee}from"./is-electron-7N7iyz1y.js";import{_ as s,i as c,n as l}from"./auth-store-w_EmIQP7.js";import{T as u}from"./native-biometric-CTR2Zi2w.js";import{d}from"./routes-GmNvdtLW.js";import{c as f,d as p,f as m,l as h,m as g,p as _,u as v}from"./prefs-B6fvTCOn.js";import{t as y}from"./hard-navigate-V2EFapkk.js";import{t as b}from"./onboarding-layout-K7X9fV8B.js";import{n as x,t as S}from"./consent-controls-CiKmEzBn.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=l.use.user()?.id??null,w=l.use.logout(),T=ee(),k=c(),[A,j]=g(),[M,N]=p(),[P,F]=m(),[I,L]=_(),[R]=f(),[z]=h(),B=v(),V=P??!0,H=I??!0,[U]=(0,C.useState)(()=>!A),[W]=(0,C.useState)(()=>!M),[G]=(0,C.useState)(()=>!R),[K]=(0,C.useState)(()=>!z),q=!U&&!W&&!G&&!K,[J]=(0,C.useState)(()=>!B),Y=U||q,X=W||q,Z=G||q,Q=K||q||J,$=!q&&!U&&!W,te=q?`Terms & privacy`:$?`Review your privacy preferences`:J?`Before You Start`:`Updated terms`,ne=q?`Review your terms and privacy preferences anytime.`:$?`Confirm your privacy preferences to continue.`:J?`Review and accept the terms to start using your assistant. You can update your preferences anytime in Settings.`:`We've updated our terms. Please review and accept to continue.`,re=(0,C.useCallback)(()=>{s({userId:a,tos:A,privacy:M,shareAnalytics:Z?V:null,shareDiagnostics:Q?H:null,hasPlatformSession:k}),e(u(t.get(`returnTo`),d.assistant),{replace:!0})},[M,k,e,t,V,H,Z,Q,A,a]),ie=(0,C.useCallback)(async()=>{await w(),y(d.account.login)},[w]),ae=Y&&!A||X&&!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:te}),(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:ne}),(Z||Q)&&(0,O.jsx)(x,{electron:T,showAnalytics:Z,showDiagnostics:Q,shareAnalytics:V,shareDiagnostics:H,onShareAnalyticsChange:F,onShareDiagnosticsChange:L,className:`mt-9 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.28s both`}}),(X||Y)&&(0,O.jsx)(S,{electron:T,showPrivacy:X,showTos:Y,privacyConsent:M,tosAccepted:A,onPrivacyChange:N,onTosChange:j,privacyNotes:X&&!J?D(`2026-06-22`):[],tosNotes:Y&&!J?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:ae,onClick:re,className:T?void 0:`h-11 text-base`,children:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:ie,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-BFJW0bSv.js";import{t as n}from"./button-Dy5001j6.js";import{m as r,u as i}from"./chunk-5KNZJZUH-Bsoom5--.js";import{t as a}from"./jsx-runtime-D3ZM-ToX.js";import{t as o}from"./shield-check-z7CU-gBq.js";import{t as ee}from"./is-electron-7N7iyz1y.js";import{_ as s,i as c,n as l}from"./auth-store-BwKMFgpK.js";import{T as u}from"./native-biometric-B96mgKGP.js";import{d}from"./routes-GmNvdtLW.js";import{c as f,d as p,f as m,l as h,m as g,p as _,u as v}from"./prefs-B6fvTCOn.js";import{t as y}from"./hard-navigate-V2EFapkk.js";import{t as b}from"./onboarding-layout-K7X9fV8B.js";import{n as x,t as S}from"./consent-controls-CiKmEzBn.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=l.use.user()?.id??null,w=l.use.logout(),T=ee(),k=c(),[A,j]=g(),[M,N]=p(),[P,F]=m(),[I,L]=_(),[R]=f(),[z]=h(),B=v(),V=P??!0,H=I??!0,[U]=(0,C.useState)(()=>!A),[W]=(0,C.useState)(()=>!M),[G]=(0,C.useState)(()=>!R),[K]=(0,C.useState)(()=>!z),q=!U&&!W&&!G&&!K,[J]=(0,C.useState)(()=>!B),Y=U||q,X=W||q,Z=G||q,Q=K||q||J,$=!q&&!U&&!W,te=q?`Terms & privacy`:$?`Review your privacy preferences`:J?`Before You Start`:`Updated terms`,ne=q?`Review your terms and privacy preferences anytime.`:$?`Confirm your privacy preferences to continue.`:J?`Review and accept the terms to start using your assistant. You can update your preferences anytime in Settings.`:`We've updated our terms. Please review and accept to continue.`,re=(0,C.useCallback)(()=>{s({userId:a,tos:A,privacy:M,shareAnalytics:Z?V:null,shareDiagnostics:Q?H:null,hasPlatformSession:k}),e(u(t.get(`returnTo`),d.assistant),{replace:!0})},[M,k,e,t,V,H,Z,Q,A,a]),ie=(0,C.useCallback)(async()=>{await w(),y(d.account.login)},[w]),ae=Y&&!A||X&&!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:te}),(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:ne}),(Z||Q)&&(0,O.jsx)(x,{electron:T,showAnalytics:Z,showDiagnostics:Q,shareAnalytics:V,shareDiagnostics:H,onShareAnalyticsChange:F,onShareDiagnosticsChange:L,className:`mt-9 w-full`,style:{animation:`fadeInUp 0.5s ease-out 0.28s both`}}),(X||Y)&&(0,O.jsx)(S,{electron:T,showPrivacy:X,showTos:Y,privacyConsent:M,tosAccepted:A,onPrivacyChange:N,onTosChange:j,privacyNotes:X&&!J?D(`2026-06-22`):[],tosNotes:Y&&!J?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:ae,onClick:re,className:T?void 0:`h-11 text-base`,children:`Continue`}),(0,O.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,onClick:ie,className:T?void 0:`h-11 text-base`,children:`Log out`})]})]})})}export{k as ReviewTermsScreen};
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{c as t,i as n}from"./local-settings-C-dW2vkq.js";import{t as r}from"./react-BFJW0bSv.js";import{t as i}from"./createLucideIcon-CAM1RhH8.js";import{n as a,t as o}from"./create-selectors-B-P03-8K.js";import{n as s}from"./typed-storage-C-R1po3l.js";import{a as c}from"./diagnostics-BE1IgjfV.js";import{l}from"./chat-markdown-message-B3Qo04ug.js";import{t as u}from"./conversation-store-C0tvFESx.js";import{s as ee,u as d}from"./messages-BsXTJIIe.js";import{C as f,D as p,n as te,t as ne,w as re,x as ie}from"./chat-BIJEFb5u.js";var ae=i(`bolt`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),oe=i(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),se=i(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),ce=i(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),le=e(r(),1),m=1e3,ue=15,de=0,h=new Map,g=[];function fe(e){let t=`sse-${++de}`,n={id:t,abortSignal:e,initiatedAt:Date.now(),establishedAt:null,lastTrafficAt:null,lastDataAt:null,dataFrames:0,keepalives:0,endedAt:null,endReason:null};h.set(t,n),Se();let r=()=>{xe(t,`aborted`)};return e.aborted?r():e.addEventListener(`abort`,r,{once:!0}),t}function pe(e){let t=h.get(e);t&&t.establishedAt===null&&(t.establishedAt=Date.now())}function me(e,t){let n=h.get(e);if(!n)return;let r=Date.now();n.lastTrafficAt=r,t?(n.lastDataAt=r,n.dataFrames++):n.keepalives++}function he(e,t){g.push({clientId:e,receivedAt:new Date().toISOString(),...t}),g.length>m&&g.shift()}var ge=`events-tail`;function _e(e){if(e.length===0)return;let t=new Set;for(let e of g)typeof e.seq==`number`&&t.add(e.seq);for(let n of e)typeof n.seq==`number`&&t.has(n.seq)||g.push({clientId:ge,receivedAt:new Date().toISOString(),...n});for(;g.length>m;)g.shift()}function ve(){return Array.from(h.values())}function ye(e=m){let t=Math.max(0,g.length-e);return g.slice(t)}function be(e,t){if(t===null)return null;let n=1/0;for(let e of g)typeof e.seq==`number`&&(n=Math.min(n,e.seq));return n!==1/0&&n>t+1?null:g.filter(n=>n.conversationId===e&&typeof n.seq==`number`&&n.seq>t).sort((e,t)=>e.seq-t.seq)}function xe(e,t){let n=h.get(e);n&&(n.endedAt===null?(n.endedAt=Date.now(),n.endReason=t):n.endReason===`aborted`&&t!==`aborted`&&(n.endReason=t),Se())}function Se(){let e=0;for(let t of h.values())t.endedAt!==null&&e++;if(!(e<=ue))for(let[t,n]of h){if(e<=ue)break;n.endedAt!==null&&(h.delete(t),e--)}}var _={phase:`idle`,pendingQueuedCount:0,activeToolCallCount:0,activeTurnId:null,lastTerminalReason:null,statusText:null,liveWebActivity:{}};function v(e){return e===`queued`||e===`thinking`||e===`streaming`||e===`awaiting_user_input`}function Ce(e){return e===`thinking`}function y(e){return(e.phase===`idle`||e.phase===`errored`)&&!e.activeTurnId}var we=o(a()((e,t)=>({..._,requestSend:t=>e(e=>({phase:`thinking`,activeTurnId:t??e.activeTurnId,lastTerminalReason:null,activeToolCallCount:0,statusText:null})),acceptSend:t=>e(e=>({activeTurnId:t,...e.phase===`idle`||e.phase===`errored`?{phase:`thinking`,lastTerminalReason:null}:null})),onTextDelta:()=>{let n=t();if(n.phase===`idle`||n.phase===`errored`){if(!n.activeTurnId)return;e({phase:`streaming`});return}(n.phase===`thinking`||n.phase===`queued`)&&e({phase:`streaming`})},onToolUseStart:()=>{let n=t();y(n)||e({phase:n.phase===`idle`||n.phase===`errored`||n.phase===`queued`?`thinking`:n.phase,activeToolCallCount:n.activeToolCallCount+1})},onToolResult:()=>e(e=>({activeToolCallCount:Math.max(0,e.activeToolCallCount-1)})),onToolActivityMetadata:(n,r)=>{let i=t();y(i)||e({liveWebActivity:{...i.liveWebActivity,[n]:r}})},onActivityThinking:(n,r)=>{let i=t();if(y(i)){if(!r?.canStartFromIdle)return;e({phase:`thinking`,statusText:n??null,lastTerminalReason:null});return}i.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},recoverFromAwaitingUserInput:()=>{t().phase===`awaiting_user_input`&&e({phase:`thinking`})},showSurface:n=>{y(t())||n&&e({phase:`awaiting_user_input`})},updateSurface:()=>{},dismissSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},completeSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},onSecretRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onConfirmationRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onQuestionRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onContactRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},completeTurn:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},handoffGeneration:()=>{y(t())||e({phase:`thinking`,activeToolCallCount:0,statusText:null})},cancelGeneration:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`cancelled`,statusText:null,liveWebActivity:{}})},onStreamError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`error`,statusText:null,liveWebActivity:{}}),onSessionError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`session_error`,statusText:null,liveWebActivity:{}}),onTurnTimeout:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`timeout`,statusText:null,liveWebActivity:{}}),onPollReconciled:n=>{let r=t();n&&n!==r.activeTurnId||v(r.phase)&&e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},resetTurn:()=>e({..._}),clearStaleTurn:()=>{let n=t();n.activeTurnId&&v(n.phase)||e({..._})},enqueueMessage:()=>e(e=>({pendingQueuedCount:e.pendingQueuedCount+1})),dequeueMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(y(n)){e({pendingQueuedCount:r});return}e({phase:`thinking`,pendingQueuedCount:r})},deleteQueuedMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(r===0&&n.phase===`queued`){e({phase:`idle`,pendingQueuedCount:0,activeTurnId:null,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}});return}e({pendingQueuedCount:r})}}))),Te=3670016,Ee=[.85,.75,.65,.5],De=2e7,Oe=new Set([`image/jpeg`,`image/jpg`,`image/png`,`image/webp`,`image/heic`,`image/heif`,`image/bmp`,`image/tiff`]),ke=new Set([`jpg`,`jpeg`,`png`,`webp`,`heic`,`heif`,`bmp`,`tif`,`tiff`]);function b(e){let t=e.type.trim().toLowerCase();if(Oe.has(t))return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n?ke.has(n):!1}function Ae(e){return b(e)&&e.size>3670016}function je(e){let t=e.type.trim().toLowerCase();if(t===`image/heic`||t===`image/heif`)return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n===`heic`||n===`heif`}function Me(e){return Ae(e)||je(e)}function Ne(e){if(/^image\/jpe?g$/i.test(e))return`jpg`;let t=e.slice(6).toLowerCase();return/^[a-z0-9]+$/.test(t)?t:`jpg`}function Pe(e,t=`image/jpeg`){let n=`attachment`,r=e.trim()||n,i=Ne(t),a=r.match(/\.([^./\\]+)$/)?.[1]?.toLowerCase();return a===i||i===`jpg`&&a===`jpeg`?r:`${r.replace(/\.[^./\\]+$/,``)||n}.${i}`}async function Fe(e){if(!Me(e)||await Le(e))return{status:`unchanged`,file:e};if(e.size>104857600)return{status:`failed`,error:`This image is too large to process safely. Please choose a smaller image.`};let t;try{t=await Ie(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await ze(t,e.size)}catch{n=null}if(!n||!je(e)&&n.size>=e.size)return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`};let r=n.type.startsWith(`image/`)?n.type:`image/jpeg`;return{status:`resized`,file:new File([n],Pe(e.name,r),{type:r,lastModified:e.lastModified})}}finally{t.close()}}async function Ie(e){if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e,{imageOrientation:`from-image`});return{source:t,width:t.width,height:t.height,close:()=>t.close()}}catch{}if(typeof Image>`u`)throw Error(`No browser image decoder is available.`);let t=URL.createObjectURL(e);return await new Promise((e,n)=>{let r=new Image;r.onload=()=>{e({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,close:()=>URL.revokeObjectURL(t)})},r.onerror=()=>{URL.revokeObjectURL(t),n(Error(`Image decode failed.`))},r.src=t})}async function Le(e){if(!Re(e))return!1;let t;try{t=new Uint8Array(await e.slice(0,Math.min(e.size,1024*1024)).arrayBuffer())}catch{return!0}if(!S(t,0,`RIFF`)||!S(t,8,`WEBP`))return!1;let n=x(t,`VP8X`);return n>=0&&(t[n+8]??0)&2?!0:x(t,`ANIM`)>=0||x(t,`ANMF`)>=0}function Re(e){return e.type.trim().toLowerCase()===`image/webp`||/\.webp$/i.test(e.name)}function x(e,t){for(let n=0;n<=e.length-t.length;n+=1)if(S(e,n,t))return n;return-1}function S(e,t,n){if(t+n.length>e.length)return!1;for(let r=0;r<n.length;r+=1)if(e[t+r]!==n.charCodeAt(r))return!1;return!0}async function ze(e,t){let n=e.width*e.height,r=null;if(n<=De)for(let t of Ee){let n=await w(e.source,e.width,e.height,t);if(r=C(r,n),n&&n.size<=3670016)return n}let i=r?.size??t,a=Math.min(Math.sqrt(Te/i*.9),.95);for(let t=0;t<4;t+=1){let t=Math.max(Math.floor(e.width*a),1),n=Math.max(Math.floor(e.height*a),1),o=null;for(let i of Ee){let a=await w(e.source,t,n,i);if(r=C(r,a),o=C(o,a),a&&a.size<=3670016)return a}i=o?.size??i,a*=Math.min(Math.sqrt(Te/i*.9),.9)}return null}function C(e,t){return t&&(!e||t.size<e.size)?t:e}async function w(e,t,n,r){if(typeof document>`u`)return null;let i=document.createElement(`canvas`);i.width=t,i.height=n;let a=i.getContext(`2d`);if(!a||typeof i.toBlob!=`function`)return null;a.fillStyle=`#fff`,a.fillRect(0,0,t,n),a.drawImage(e,0,0,t,n);try{return await new Promise(e=>{i.toBlob(t=>e(t),`image/jpeg`,r)})}finally{i.width=0,i.height=0}}var Be=`vellum:chatDrafts:`;function Ve(e){return`${Be}${e}`}function He(e){let t=n(Ve(e),``);if(!t)return new Map;try{let e=JSON.parse(t);return typeof e!=`object`||!e||Array.isArray(e)?new Map:new Map(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return new Map}}function T(e,n){t(Ve(e),JSON.stringify(Object.fromEntries(n)))}function Ue(){return`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function We(e){return b(e)?`100 MB`:`50 MB`}function Ge(e){return e.size<=52428800?!0:b(e)&&e.size<=104857600}function Ke(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var E=new Map,D=null,O=new Map,k=new Set,qe=a()((e,t)=>({input:``,restoredDraftConversationId:null,attachments:[],attachmentLastError:null,setInput:t=>{e(e=>({input:typeof t==`function`?t(e.input):t}))},saveDraft:(e,t)=>{t.trim()?E.set(e,t):E.delete(e),D&&T(D,E)},clearDraft:e=>{E.delete(e),D&&T(D,E)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?E.set(n,i):E.delete(n);let a=(r&&E.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),D&&T(D,E)},loadAssistantDrafts:(n,r)=>{if(D&&D!==n){let n=t().input;r&&(n.trim()?E.set(r,n):E.delete(r)),T(D,E),e({input:``,restoredDraftConversationId:null})}E=He(n),D=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=E.get(n);r&&r.trim()&&!t().input.trim()&&e({input:r,restoredDraftConversationId:n})},addFiles:(t,n)=>{let r=Array.from(t);if(r.length===0)return;if(!n){e({attachmentLastError:`No active assistant. Please try again.`});return}let i=[],a=[];for(let e of r)Ge(e)?a.push(e):i.push(e);let o=i[0];if(e(o?{attachmentLastError:i.length===1?`${o.name} is larger than ${We(o)} and can't be attached.`:`${i.length} files are too large and can't be attached.`}:{attachmentLastError:null}),a.length===0)return;let s=a.map(e=>({pending:{kind:`uploading`,localId:Ue(),filename:e.name||`attachment`,mimeType:e.type||`application/octet-stream`,sizeBytes:e.size},file:e}));e(e=>({attachments:[...e.attachments,...s.map(e=>e.pending)]}));for(let{pending:t,file:r}of s)(async()=>{try{let i=await Fe(r);if(k.has(t.localId)){k.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){A(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){A(e,t.localId,`This attachment is still larger than 50 MB after resizing. Try a smaller image.`);return}i.status===`resized`&&e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId&&e.kind===`uploading`?{...e,filename:a.name||`attachment`,mimeType:a.type||`application/octet-stream`,sizeBytes:a.size}:e)}));let o=await ee(n,a);if(k.has(t.localId)){k.delete(t.localId);return}if(!o.ok){A(e,t.localId,o.error.detail??`Upload failed`);return}let s=a.type||`application/octet-stream`,c=o.filename??(a.name||`attachment`),u=o.mimeType??s,d=o.sizeBytes??a.size,f=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(k.has(t.localId)){k.delete(t.localId);return}e&&(f=e)}let p=null;try{p=URL.createObjectURL(f),O.set(t.localId,p)}catch{p=null}e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId?{kind:`uploaded`,localId:t.localId,id:o.id,filename:c,mimeType:u,sizeBytes:d,previewUrl:p,thumbnailUrl:null}:e)}))}catch{if(k.has(t.localId)){k.delete(t.localId);return}A(e,t.localId,`Upload failed`)}})()},addPathReferences:t=>{let n=[];for(let e of t){let t=e.trim();t&&n.push({kind:`path-reference`,localId:Ue(),path:t,filename:Ke(t)||t})}n.length!==0&&e(e=>({attachments:[...e.attachments,...n],attachmentLastError:null}))},removeAttachment:t=>{e(e=>{let n=e.attachments.find(e=>e.localId===t);return n&&n.kind===`uploading`&&k.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),Je(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}}),O.forEach(e=>URL.revokeObjectURL(e)),O.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function A(e,t,n){e(e=>({attachments:e.attachments.map(e=>e.localId!==t||e.kind!==`uploading`?e:{kind:`failed`,localId:t,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,error:n})}))}function Je(e){let t=O.get(e);t&&(URL.revokeObjectURL(t),O.delete(e))}function Ye(e){return e.reduce((e,t)=>t.kind===`uploading`?e+1:e,0)}function Xe(e){return e.filter(e=>e.kind===`uploaded`).map(e=>e.id)}function Ze(e){return e.filter(e=>e.kind===`path-reference`).map(e=>e.path)}var j=o(qe);function Qe(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function $e(e){let t=JSON.parse(e);return Qe(t)?t:null}function M(e,t){let n=[...e??[]],r=n.findIndex(e=>e.type===`surface`&&e.surface.surfaceId===t.surfaceId);return r===-1?n.push({type:`surface`,surface:t}):n[r]={type:`surface`,surface:t},n}function et(e,t){return e?.filter(e=>!(e.type===`surface`&&e.surface.surfaceId===t))}function tt(e,t){if(!e.surfaces?.length)return e;let n=!1,r=e.contentBlocks,i=e.surfaces.map(e=>{let i=t(e);return i!==e&&(n=!0,r=M(r,i)),i});return n?{...e,surfaces:i,contentBlocks:r}:e}function nt(e,t){if(!e.surfaces?.length)return e;let n=e.surfaces.filter(t);if(n.length===e.surfaces.length)return e;let r=new Set(e.surfaces.filter(e=>!t(e)).map(e=>e.surfaceId));return{...e,surfaces:n,contentOrder:e.contentOrder?.filter(e=>!(e.type===`surface`&&r.has(e.id))),contentBlocks:e.contentBlocks?.filter(e=>!(e.type===`surface`&&r.has(e.surface.surfaceId)))}}var rt=500,it=s({keyFn:e=>`vellum:dismissed-surfaces:${e}`,scope:`user`,parseValue:e=>Qe(e)?e:null,fallback:{},maxEntries:200});function at(e,t){let n=it.get(e,t);return n?new Set(n):new Set}function ot(e,t,n){let r=Array.from(n);r.length>rt&&(r=r.slice(r.length-rt)),it.set(e,t,r)}var st=[];function ct(e,t){if(!e)return st;if(t.size===0)return e;let n=!1,r=e.map(e=>{let r=nt(e,e=>!t.has(e.surfaceId));return r!==e&&(n=!0),r});return n?r:e}function lt(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.tokens!=`number`||!Number.isFinite(t.tokens)||t.maxTokens!==null&&(typeof t.maxTokens!=`number`||!Number.isFinite(t.maxTokens))||t.fillRatio!==null&&(typeof t.fillRatio!=`number`||!Number.isFinite(t.fillRatio)))}var ut=s({keyFn:e=>`vellum:ctxwindow:${e}`,scope:`user`,parseValue:e=>lt(e)?e:null,fallback:{},maxEntries:200});function dt(e){return new Map(Object.entries(ut.load(e)))}function ft(e,t,n){ut.set(e,t,n)}var pt=`PROVIDER_BILLING`,mt=`PROVIDER_NOT_CONFIGURED`,ht=`MANAGED_KEY_INVALID`,gt=`credits_exhausted`,_t=`provider_billing`,vt=`daily_limit_reached`;function yt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):e?.code===pt}function bt(e){return e?.errorCategory?e.errorCategory.endsWith(_t):!1}function xt(e){return e?.errorCategory?e.errorCategory.endsWith(vt):!1}function St(e){return xt(e)?`daily_limit`:yt(e)?`managed_credits`:bt(e)?`provider_billing`:null}function N(e){return St(e)!==null||e?.code===mt||e?.displayAs===`modal`}function Ct(e){return!!e&&!N(e)}function wt(e){return e?.code===ht}var Tt={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,pendingAcpConnect:null,dismissedAcpConnectToolUseIds:new Set,pendingAcpContinue:!1,unknownNudgeToolCallIds:new Set},P=o(a()((e,t)=>({...Tt,showSecret:n=>{let{pendingSecret:r}=t();if(r&&r.requestId===n.requestId){let t={};for(let e of Object.keys(n))n[e]!==void 0&&(t[e]=n[e]);e({pendingSecret:{...r,...t}});return}e({pendingSecret:n,isSubmittingSecret:!1,secretSaved:!1})},submitSecretStart:()=>e({isSubmittingSecret:!0}),submitSecretEnd:t=>e({isSubmittingSecret:!1,secretSaved:t??!1}),dismissSecret:()=>e({pendingSecret:null,isSubmittingSecret:!1}),updateSecret:(n,r)=>{let{pendingSecret:i}=t();!i||i.requestId!==n||e({pendingSecret:{...i,...r}})},showConfirmation:t=>e({pendingConfirmation:t,isSubmittingConfirmation:!1}),submitConfirmationStart:()=>e({isSubmittingConfirmation:!0}),submitConfirmationEnd:()=>e({isSubmittingConfirmation:!1}),dismissConfirmation:()=>e({pendingConfirmation:null,isSubmittingConfirmation:!1}),dismissConfirmationIfMatches:n=>{let{pendingConfirmation:r}=t();!r||r.requestId!==n||e({pendingConfirmation:null,isSubmittingConfirmation:!1})},updateConfirmation:(n,r)=>{let{pendingConfirmation:i}=t();!i||i.requestId!==n||e({pendingConfirmation:{...i,...r}})},setInlineConfirmationToolCallId:t=>e({inlineConfirmationToolCallId:t}),showContactRequest:t=>e({pendingContactRequest:t,isSubmittingContactRequest:!1,contactRequestAccepted:!1}),submitContactRequestStart:()=>e({isSubmittingContactRequest:!0}),submitContactRequestEnd:()=>e({isSubmittingContactRequest:!1}),dismissContactRequest:()=>e({pendingContactRequest:null,isSubmittingContactRequest:!1}),acceptContactRequest:()=>e({contactRequestAccepted:!0}),showQuestion:t=>e({pendingQuestion:t,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),submitQuestionStart:()=>e({isSubmittingQuestion:!0}),submitQuestionEnd:()=>e({isSubmittingQuestion:!1}),dismissQuestion:()=>e({pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),dismissQuestionCard:()=>e({isQuestionCardDismissed:!0}),resetSecretAndConfirmation:()=>e({pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,inlineConfirmationToolCallId:null}),showAcpConnect:t=>e(e=>e.dismissedAcpConnectToolUseIds.has(t.toolUseId)?{}:{pendingAcpConnect:t}),dismissAcpConnect:()=>e(e=>({pendingAcpConnect:null,dismissedAcpConnectToolUseIds:e.pendingAcpConnect?new Set(e.dismissedAcpConnectToolUseIds).add(e.pendingAcpConnect.toolUseId):e.dismissedAcpConnectToolUseIds})),requestAcpContinue:()=>e({pendingAcpContinue:!0}),clearAcpContinue:()=>e({pendingAcpContinue:!1}),addUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;r.has(n)||e({unknownNudgeToolCallIds:new Set([...r,n])})},removeUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;if(!r.has(n))return;let i=new Set(r);i.delete(n),e({unknownNudgeToolCallIds:i})},resetAll:()=>e(Tt)})));function Et(e){if(e.length===0)return``;let t=e[0]??``;for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n][0];r&&i&&r!==` `&&r!==`
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{c as t,i as n}from"./local-settings-C-dW2vkq.js";import{t as r}from"./react-BFJW0bSv.js";import{t as i}from"./createLucideIcon-CAM1RhH8.js";import{n as a,t as o}from"./create-selectors-B-P03-8K.js";import{n as s}from"./typed-storage-C-R1po3l.js";import{a as c}from"./diagnostics-CLHyv7Xw.js";import{l}from"./chat-markdown-message-f4cLJfax.js";import{t as u}from"./conversation-store-C0tvFESx.js";import{s as ee,u as d}from"./messages-BzNSqJQx.js";import{C as f,D as p,n as te,t as ne,w as re,x as ie}from"./chat-BIJEFb5u.js";var ae=i(`bolt`,[[`path`,{d:`M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z`,key:`yt0hxn`}],[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}]]),oe=i(`pen`,[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),se=i(`plug`,[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]),ce=i(`square-terminal`,[[`path`,{d:`m7 11 2-2-2-2`,key:`1lz0vl`}],[`path`,{d:`M11 13h4`,key:`1p7l4v`}],[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,ry:`2`,key:`1m3agn`}]]),le=e(r(),1),m=1e3,ue=15,de=0,h=new Map,g=[];function fe(e){let t=`sse-${++de}`,n={id:t,abortSignal:e,initiatedAt:Date.now(),establishedAt:null,lastTrafficAt:null,lastDataAt:null,dataFrames:0,keepalives:0,endedAt:null,endReason:null};h.set(t,n),Se();let r=()=>{xe(t,`aborted`)};return e.aborted?r():e.addEventListener(`abort`,r,{once:!0}),t}function pe(e){let t=h.get(e);t&&t.establishedAt===null&&(t.establishedAt=Date.now())}function me(e,t){let n=h.get(e);if(!n)return;let r=Date.now();n.lastTrafficAt=r,t?(n.lastDataAt=r,n.dataFrames++):n.keepalives++}function he(e,t){g.push({clientId:e,receivedAt:new Date().toISOString(),...t}),g.length>m&&g.shift()}var ge=`events-tail`;function _e(e){if(e.length===0)return;let t=new Set;for(let e of g)typeof e.seq==`number`&&t.add(e.seq);for(let n of e)typeof n.seq==`number`&&t.has(n.seq)||g.push({clientId:ge,receivedAt:new Date().toISOString(),...n});for(;g.length>m;)g.shift()}function ve(){return Array.from(h.values())}function ye(e=m){let t=Math.max(0,g.length-e);return g.slice(t)}function be(e,t){if(t===null)return null;let n=1/0;for(let e of g)typeof e.seq==`number`&&(n=Math.min(n,e.seq));return n!==1/0&&n>t+1?null:g.filter(n=>n.conversationId===e&&typeof n.seq==`number`&&n.seq>t).sort((e,t)=>e.seq-t.seq)}function xe(e,t){let n=h.get(e);n&&(n.endedAt===null?(n.endedAt=Date.now(),n.endReason=t):n.endReason===`aborted`&&t!==`aborted`&&(n.endReason=t),Se())}function Se(){let e=0;for(let t of h.values())t.endedAt!==null&&e++;if(!(e<=ue))for(let[t,n]of h){if(e<=ue)break;n.endedAt!==null&&(h.delete(t),e--)}}var _={phase:`idle`,pendingQueuedCount:0,activeToolCallCount:0,activeTurnId:null,lastTerminalReason:null,statusText:null,liveWebActivity:{}};function v(e){return e===`queued`||e===`thinking`||e===`streaming`||e===`awaiting_user_input`}function Ce(e){return e===`thinking`}function y(e){return(e.phase===`idle`||e.phase===`errored`)&&!e.activeTurnId}var we=o(a()((e,t)=>({..._,requestSend:t=>e(e=>({phase:`thinking`,activeTurnId:t??e.activeTurnId,lastTerminalReason:null,activeToolCallCount:0,statusText:null})),acceptSend:t=>e(e=>({activeTurnId:t,...e.phase===`idle`||e.phase===`errored`?{phase:`thinking`,lastTerminalReason:null}:null})),onTextDelta:()=>{let n=t();if(n.phase===`idle`||n.phase===`errored`){if(!n.activeTurnId)return;e({phase:`streaming`});return}(n.phase===`thinking`||n.phase===`queued`)&&e({phase:`streaming`})},onToolUseStart:()=>{let n=t();y(n)||e({phase:n.phase===`idle`||n.phase===`errored`||n.phase===`queued`?`thinking`:n.phase,activeToolCallCount:n.activeToolCallCount+1})},onToolResult:()=>e(e=>({activeToolCallCount:Math.max(0,e.activeToolCallCount-1)})),onToolActivityMetadata:(n,r)=>{let i=t();y(i)||e({liveWebActivity:{...i.liveWebActivity,[n]:r}})},onActivityThinking:(n,r)=>{let i=t();if(y(i)){if(!r?.canStartFromIdle)return;e({phase:`thinking`,statusText:n??null,lastTerminalReason:null});return}i.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},recoverFromAwaitingUserInput:()=>{t().phase===`awaiting_user_input`&&e({phase:`thinking`})},showSurface:n=>{y(t())||n&&e({phase:`awaiting_user_input`})},updateSurface:()=>{},dismissSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},completeSurface:()=>{let n=t();n.phase===`awaiting_user_input`&&n.activeToolCallCount===0&&e({phase:`thinking`})},onSecretRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onConfirmationRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onQuestionRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},onContactRequest:()=>{y(t())||e({phase:`awaiting_user_input`})},completeTurn:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},handoffGeneration:()=>{y(t())||e({phase:`thinking`,activeToolCallCount:0,statusText:null})},cancelGeneration:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`cancelled`,statusText:null,liveWebActivity:{}})},onStreamError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`error`,statusText:null,liveWebActivity:{}}),onSessionError:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`session_error`,statusText:null,liveWebActivity:{}}),onTurnTimeout:()=>e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,pendingQueuedCount:0,lastTerminalReason:`timeout`,statusText:null,liveWebActivity:{}}),onPollReconciled:n=>{let r=t();n&&n!==r.activeTurnId||v(r.phase)&&e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},resetTurn:()=>e({..._}),clearStaleTurn:()=>{let n=t();n.activeTurnId&&v(n.phase)||e({..._})},enqueueMessage:()=>e(e=>({pendingQueuedCount:e.pendingQueuedCount+1})),dequeueMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(y(n)){e({pendingQueuedCount:r});return}e({phase:`thinking`,pendingQueuedCount:r})},deleteQueuedMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(r===0&&n.phase===`queued`){e({phase:`idle`,pendingQueuedCount:0,activeTurnId:null,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}});return}e({pendingQueuedCount:r})}}))),Te=3670016,Ee=[.85,.75,.65,.5],De=2e7,Oe=new Set([`image/jpeg`,`image/jpg`,`image/png`,`image/webp`,`image/heic`,`image/heif`,`image/bmp`,`image/tiff`]),ke=new Set([`jpg`,`jpeg`,`png`,`webp`,`heic`,`heif`,`bmp`,`tif`,`tiff`]);function b(e){let t=e.type.trim().toLowerCase();if(Oe.has(t))return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n?ke.has(n):!1}function Ae(e){return b(e)&&e.size>3670016}function je(e){let t=e.type.trim().toLowerCase();if(t===`image/heic`||t===`image/heif`)return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n===`heic`||n===`heif`}function Me(e){return Ae(e)||je(e)}function Ne(e){if(/^image\/jpe?g$/i.test(e))return`jpg`;let t=e.slice(6).toLowerCase();return/^[a-z0-9]+$/.test(t)?t:`jpg`}function Pe(e,t=`image/jpeg`){let n=`attachment`,r=e.trim()||n,i=Ne(t),a=r.match(/\.([^./\\]+)$/)?.[1]?.toLowerCase();return a===i||i===`jpg`&&a===`jpeg`?r:`${r.replace(/\.[^./\\]+$/,``)||n}.${i}`}async function Fe(e){if(!Me(e)||await Le(e))return{status:`unchanged`,file:e};if(e.size>104857600)return{status:`failed`,error:`This image is too large to process safely. Please choose a smaller image.`};let t;try{t=await Ie(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await ze(t,e.size)}catch{n=null}if(!n||!je(e)&&n.size>=e.size)return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`};let r=n.type.startsWith(`image/`)?n.type:`image/jpeg`;return{status:`resized`,file:new File([n],Pe(e.name,r),{type:r,lastModified:e.lastModified})}}finally{t.close()}}async function Ie(e){if(typeof createImageBitmap==`function`)try{let t=await createImageBitmap(e,{imageOrientation:`from-image`});return{source:t,width:t.width,height:t.height,close:()=>t.close()}}catch{}if(typeof Image>`u`)throw Error(`No browser image decoder is available.`);let t=URL.createObjectURL(e);return await new Promise((e,n)=>{let r=new Image;r.onload=()=>{e({source:r,width:r.naturalWidth||r.width,height:r.naturalHeight||r.height,close:()=>URL.revokeObjectURL(t)})},r.onerror=()=>{URL.revokeObjectURL(t),n(Error(`Image decode failed.`))},r.src=t})}async function Le(e){if(!Re(e))return!1;let t;try{t=new Uint8Array(await e.slice(0,Math.min(e.size,1024*1024)).arrayBuffer())}catch{return!0}if(!S(t,0,`RIFF`)||!S(t,8,`WEBP`))return!1;let n=x(t,`VP8X`);return n>=0&&(t[n+8]??0)&2?!0:x(t,`ANIM`)>=0||x(t,`ANMF`)>=0}function Re(e){return e.type.trim().toLowerCase()===`image/webp`||/\.webp$/i.test(e.name)}function x(e,t){for(let n=0;n<=e.length-t.length;n+=1)if(S(e,n,t))return n;return-1}function S(e,t,n){if(t+n.length>e.length)return!1;for(let r=0;r<n.length;r+=1)if(e[t+r]!==n.charCodeAt(r))return!1;return!0}async function ze(e,t){let n=e.width*e.height,r=null;if(n<=De)for(let t of Ee){let n=await w(e.source,e.width,e.height,t);if(r=C(r,n),n&&n.size<=3670016)return n}let i=r?.size??t,a=Math.min(Math.sqrt(Te/i*.9),.95);for(let t=0;t<4;t+=1){let t=Math.max(Math.floor(e.width*a),1),n=Math.max(Math.floor(e.height*a),1),o=null;for(let i of Ee){let a=await w(e.source,t,n,i);if(r=C(r,a),o=C(o,a),a&&a.size<=3670016)return a}i=o?.size??i,a*=Math.min(Math.sqrt(Te/i*.9),.9)}return null}function C(e,t){return t&&(!e||t.size<e.size)?t:e}async function w(e,t,n,r){if(typeof document>`u`)return null;let i=document.createElement(`canvas`);i.width=t,i.height=n;let a=i.getContext(`2d`);if(!a||typeof i.toBlob!=`function`)return null;a.fillStyle=`#fff`,a.fillRect(0,0,t,n),a.drawImage(e,0,0,t,n);try{return await new Promise(e=>{i.toBlob(t=>e(t),`image/jpeg`,r)})}finally{i.width=0,i.height=0}}var Be=`vellum:chatDrafts:`;function Ve(e){return`${Be}${e}`}function He(e){let t=n(Ve(e),``);if(!t)return new Map;try{let e=JSON.parse(t);return typeof e!=`object`||!e||Array.isArray(e)?new Map:new Map(Object.entries(e).filter(e=>typeof e[1]==`string`))}catch{return new Map}}function T(e,n){t(Ve(e),JSON.stringify(Object.fromEntries(n)))}function Ue(){return`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function We(e){return b(e)?`100 MB`:`50 MB`}function Ge(e){return e.size<=52428800?!0:b(e)&&e.size<=104857600}function Ke(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var E=new Map,D=null,O=new Map,k=new Set,qe=a()((e,t)=>({input:``,restoredDraftConversationId:null,attachments:[],attachmentLastError:null,setInput:t=>{e(e=>({input:typeof t==`function`?t(e.input):t}))},saveDraft:(e,t)=>{t.trim()?E.set(e,t):E.delete(e),D&&T(D,E)},clearDraft:e=>{E.delete(e),D&&T(D,E)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?E.set(n,i):E.delete(n);let a=(r&&E.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),D&&T(D,E)},loadAssistantDrafts:(n,r)=>{if(D&&D!==n){let n=t().input;r&&(n.trim()?E.set(r,n):E.delete(r)),T(D,E),e({input:``,restoredDraftConversationId:null})}E=He(n),D=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=E.get(n);r&&r.trim()&&!t().input.trim()&&e({input:r,restoredDraftConversationId:n})},addFiles:(t,n)=>{let r=Array.from(t);if(r.length===0)return;if(!n){e({attachmentLastError:`No active assistant. Please try again.`});return}let i=[],a=[];for(let e of r)Ge(e)?a.push(e):i.push(e);let o=i[0];if(e(o?{attachmentLastError:i.length===1?`${o.name} is larger than ${We(o)} and can't be attached.`:`${i.length} files are too large and can't be attached.`}:{attachmentLastError:null}),a.length===0)return;let s=a.map(e=>({pending:{kind:`uploading`,localId:Ue(),filename:e.name||`attachment`,mimeType:e.type||`application/octet-stream`,sizeBytes:e.size},file:e}));e(e=>({attachments:[...e.attachments,...s.map(e=>e.pending)]}));for(let{pending:t,file:r}of s)(async()=>{try{let i=await Fe(r);if(k.has(t.localId)){k.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){A(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){A(e,t.localId,`This attachment is still larger than 50 MB after resizing. Try a smaller image.`);return}i.status===`resized`&&e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId&&e.kind===`uploading`?{...e,filename:a.name||`attachment`,mimeType:a.type||`application/octet-stream`,sizeBytes:a.size}:e)}));let o=await ee(n,a);if(k.has(t.localId)){k.delete(t.localId);return}if(!o.ok){A(e,t.localId,o.error.detail??`Upload failed`);return}let s=a.type||`application/octet-stream`,c=o.filename??(a.name||`attachment`),u=o.mimeType??s,d=o.sizeBytes??a.size,f=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(k.has(t.localId)){k.delete(t.localId);return}e&&(f=e)}let p=null;try{p=URL.createObjectURL(f),O.set(t.localId,p)}catch{p=null}e(e=>({attachments:e.attachments.map(e=>e.localId===t.localId?{kind:`uploaded`,localId:t.localId,id:o.id,filename:c,mimeType:u,sizeBytes:d,previewUrl:p,thumbnailUrl:null}:e)}))}catch{if(k.has(t.localId)){k.delete(t.localId);return}A(e,t.localId,`Upload failed`)}})()},addPathReferences:t=>{let n=[];for(let e of t){let t=e.trim();t&&n.push({kind:`path-reference`,localId:Ue(),path:t,filename:Ke(t)||t})}n.length!==0&&e(e=>({attachments:[...e.attachments,...n],attachmentLastError:null}))},removeAttachment:t=>{e(e=>{let n=e.attachments.find(e=>e.localId===t);return n&&n.kind===`uploading`&&k.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),Je(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&k.add(t.localId);return{attachments:[],attachmentLastError:null}}),O.forEach(e=>URL.revokeObjectURL(e)),O.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function A(e,t,n){e(e=>({attachments:e.attachments.map(e=>e.localId!==t||e.kind!==`uploading`?e:{kind:`failed`,localId:t,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes,error:n})}))}function Je(e){let t=O.get(e);t&&(URL.revokeObjectURL(t),O.delete(e))}function Ye(e){return e.reduce((e,t)=>t.kind===`uploading`?e+1:e,0)}function Xe(e){return e.filter(e=>e.kind===`uploaded`).map(e=>e.id)}function Ze(e){return e.filter(e=>e.kind===`path-reference`).map(e=>e.path)}var j=o(qe);function Qe(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function $e(e){let t=JSON.parse(e);return Qe(t)?t:null}function M(e,t){let n=[...e??[]],r=n.findIndex(e=>e.type===`surface`&&e.surface.surfaceId===t.surfaceId);return r===-1?n.push({type:`surface`,surface:t}):n[r]={type:`surface`,surface:t},n}function et(e,t){return e?.filter(e=>!(e.type===`surface`&&e.surface.surfaceId===t))}function tt(e,t){if(!e.surfaces?.length)return e;let n=!1,r=e.contentBlocks,i=e.surfaces.map(e=>{let i=t(e);return i!==e&&(n=!0,r=M(r,i)),i});return n?{...e,surfaces:i,contentBlocks:r}:e}function nt(e,t){if(!e.surfaces?.length)return e;let n=e.surfaces.filter(t);if(n.length===e.surfaces.length)return e;let r=new Set(e.surfaces.filter(e=>!t(e)).map(e=>e.surfaceId));return{...e,surfaces:n,contentOrder:e.contentOrder?.filter(e=>!(e.type===`surface`&&r.has(e.id))),contentBlocks:e.contentBlocks?.filter(e=>!(e.type===`surface`&&r.has(e.surface.surfaceId)))}}var rt=500,it=s({keyFn:e=>`vellum:dismissed-surfaces:${e}`,scope:`user`,parseValue:e=>Qe(e)?e:null,fallback:{},maxEntries:200});function at(e,t){let n=it.get(e,t);return n?new Set(n):new Set}function ot(e,t,n){let r=Array.from(n);r.length>rt&&(r=r.slice(r.length-rt)),it.set(e,t,r)}var st=[];function ct(e,t){if(!e)return st;if(t.size===0)return e;let n=!1,r=e.map(e=>{let r=nt(e,e=>!t.has(e.surfaceId));return r!==e&&(n=!0),r});return n?r:e}function lt(e){if(!e||typeof e!=`object`)return!1;let t=e;return!(typeof t.tokens!=`number`||!Number.isFinite(t.tokens)||t.maxTokens!==null&&(typeof t.maxTokens!=`number`||!Number.isFinite(t.maxTokens))||t.fillRatio!==null&&(typeof t.fillRatio!=`number`||!Number.isFinite(t.fillRatio)))}var ut=s({keyFn:e=>`vellum:ctxwindow:${e}`,scope:`user`,parseValue:e=>lt(e)?e:null,fallback:{},maxEntries:200});function dt(e){return new Map(Object.entries(ut.load(e)))}function ft(e,t,n){ut.set(e,t,n)}var pt=`PROVIDER_BILLING`,mt=`PROVIDER_NOT_CONFIGURED`,ht=`MANAGED_KEY_INVALID`,gt=`credits_exhausted`,_t=`provider_billing`,vt=`daily_limit_reached`;function yt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):e?.code===pt}function bt(e){return e?.errorCategory?e.errorCategory.endsWith(_t):!1}function xt(e){return e?.errorCategory?e.errorCategory.endsWith(vt):!1}function St(e){return xt(e)?`daily_limit`:yt(e)?`managed_credits`:bt(e)?`provider_billing`:null}function N(e){return St(e)!==null||e?.code===mt||e?.displayAs===`modal`}function Ct(e){return!!e&&!N(e)}function wt(e){return e?.code===ht}var Tt={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,pendingAcpConnect:null,dismissedAcpConnectToolUseIds:new Set,pendingAcpContinue:!1,unknownNudgeToolCallIds:new Set},P=o(a()((e,t)=>({...Tt,showSecret:n=>{let{pendingSecret:r}=t();if(r&&r.requestId===n.requestId){let t={};for(let e of Object.keys(n))n[e]!==void 0&&(t[e]=n[e]);e({pendingSecret:{...r,...t}});return}e({pendingSecret:n,isSubmittingSecret:!1,secretSaved:!1})},submitSecretStart:()=>e({isSubmittingSecret:!0}),submitSecretEnd:t=>e({isSubmittingSecret:!1,secretSaved:t??!1}),dismissSecret:()=>e({pendingSecret:null,isSubmittingSecret:!1}),updateSecret:(n,r)=>{let{pendingSecret:i}=t();!i||i.requestId!==n||e({pendingSecret:{...i,...r}})},showConfirmation:t=>e({pendingConfirmation:t,isSubmittingConfirmation:!1}),submitConfirmationStart:()=>e({isSubmittingConfirmation:!0}),submitConfirmationEnd:()=>e({isSubmittingConfirmation:!1}),dismissConfirmation:()=>e({pendingConfirmation:null,isSubmittingConfirmation:!1}),dismissConfirmationIfMatches:n=>{let{pendingConfirmation:r}=t();!r||r.requestId!==n||e({pendingConfirmation:null,isSubmittingConfirmation:!1})},updateConfirmation:(n,r)=>{let{pendingConfirmation:i}=t();!i||i.requestId!==n||e({pendingConfirmation:{...i,...r}})},setInlineConfirmationToolCallId:t=>e({inlineConfirmationToolCallId:t}),showContactRequest:t=>e({pendingContactRequest:t,isSubmittingContactRequest:!1,contactRequestAccepted:!1}),submitContactRequestStart:()=>e({isSubmittingContactRequest:!0}),submitContactRequestEnd:()=>e({isSubmittingContactRequest:!1}),dismissContactRequest:()=>e({pendingContactRequest:null,isSubmittingContactRequest:!1}),acceptContactRequest:()=>e({contactRequestAccepted:!0}),showQuestion:t=>e({pendingQuestion:t,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),submitQuestionStart:()=>e({isSubmittingQuestion:!0}),submitQuestionEnd:()=>e({isSubmittingQuestion:!1}),dismissQuestion:()=>e({pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1}),dismissQuestionCard:()=>e({isQuestionCardDismissed:!0}),resetSecretAndConfirmation:()=>e({pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,inlineConfirmationToolCallId:null}),showAcpConnect:t=>e(e=>e.dismissedAcpConnectToolUseIds.has(t.toolUseId)?{}:{pendingAcpConnect:t}),dismissAcpConnect:()=>e(e=>({pendingAcpConnect:null,dismissedAcpConnectToolUseIds:e.pendingAcpConnect?new Set(e.dismissedAcpConnectToolUseIds).add(e.pendingAcpConnect.toolUseId):e.dismissedAcpConnectToolUseIds})),requestAcpContinue:()=>e({pendingAcpContinue:!0}),clearAcpContinue:()=>e({pendingAcpContinue:!1}),addUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;r.has(n)||e({unknownNudgeToolCallIds:new Set([...r,n])})},removeUnknownNudgeToolCallId:n=>{let r=t().unknownNudgeToolCallIds;if(!r.has(n))return;let i=new Set(r);i.delete(n),e({unknownNudgeToolCallIds:i})},resetAll:()=>e(Tt)})));function Et(e){if(e.length===0)return``;let t=e[0]??``;for(let n=1;n<e.length;n++){let r=t[t.length-1],i=e[n][0];r&&i&&r!==` `&&r!==`
2
2
  `&&r!==` `&&i!==` `&&i!==`
3
3
  `&&i!==` `&&(t+=` `),t+=e[n]}return t}function Dt(e){let t=[];for(let n of e?.contentBlocks??[])n.type===`text`&&t.push(n.text);return Et(t)}function Ot(e){if(!(!e||e.length===0))return e.map(e=>{let{previewUrl:t,thumbnailUrl:n}=d(e.mimeType,e.data,e.thumbnailData,e.id!=null);return{id:e.id??e.filename,filename:e.filename,mimeType:e.mimeType,sizeBytes:e.sizeBytes??(e.data?Math.floor(e.data.length*3/4):0),previewUrl:t,thumbnailUrl:n}})}function kt(e){return[...new Set([e.id,...e.mergedMessageIds??[]].filter(e=>typeof e==`string`&&e.length>0))]}function F(e){let t=kt(e);return e.clientMessageId&&!t.includes(e.clientMessageId)?[...t,e.clientMessageId]:t}function I(e,t){return e.id===t||e.clientMessageId===t||(e.mergedMessageIds?.includes(t)??!1)}function L(e){let t=e[e.length-1];return!!t&&t.role===`assistant`}function At(e,t){if(!t)return null;let n=e.length-1;for(;n>=0&&e[n].role===`user`&&e[n].queueStatus===`queued`;)n--;let r=e[n];return!r||r.role!==`assistant`?null:r.id}function R(e,t){return e.findIndex(e=>e.role===`assistant`&&(e.id===t||!!e.mergedMessageIds?.includes(t)))}function z(e,t){if(!t||e.id===t)return e;let n=e.mergedMessageIds??[];return n.includes(t)?e:{...e,mergedMessageIds:[...n,t]}}function B(e,t=Date.now()){if(!e.toolCalls?.some(e=>p(e)))return null;let n=t;return{toolCalls:e.toolCalls.map(e=>p(e)?{...e,completedAt:n}:e),contentBlocks:e.contentBlocks?.map(e=>e.type===`tool_use`&&p(e.toolCall)?{type:`tool_use`,toolCall:{...e.toolCall,completedAt:n}}:e)}}function jt(e,t,n){return e.map(e=>e.id===t?{...e,queuePosition:n}:e)}function Mt(e,t){return e.map(e=>I(e,t)?{...e,queueStatus:void 0,queuePosition:void 0}:e)}function Nt(e,t){return e.map(e=>I(e,t)?{...e,...e.clientMessageId?{}:{isOptimistic:!0},queueStatus:void 0,queuePosition:void 0}:e)}function Pt(e,t,n){return e.map(e=>I(e,t)?{...e,queueStatus:`queued`,queuePosition:n}:e)}function Ft(e,t){return e.filter(e=>!I(e,t))}function It(e,t,n,r=Date.now()){return[...e,{id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,textSegments:[t],contentOrder:[{type:`text`,id:`0`}],contentBlocks:[{type:`text`,text:t}],timestamp:r}]}function Lt(e,t,n){n&&e[e.length-1]?.type===t.type?e[e.length-1]=t:e.push(t)}function V(e,t,n,r){let i=z(e[t],r),a=[...i.textSegments??[]],o=[...i.contentOrder??[]],s=[...i.contentBlocks??[]],c=o[o.length-1]?.type===`text`&&a.length>0;c?a[a.length-1]=a[a.length-1]+n:(o.push({type:`text`,id:String(a.length)}),a.push(n)),Lt(s,{type:`text`,text:a[a.length-1]},c);let l=[...e];return l[t]={...i,textSegments:a,contentOrder:o,contentBlocks:s},l}function H(e,t,n,r){let i=z(e[t],r),a=[...i.thinkingSegments??[]],o=[...i.contentOrder??[]],s=[...i.contentBlocks??[]],c=o[o.length-1]?.type===`thinking`&&a.length>0;c?a[a.length-1]=a[a.length-1]+n:(o.push({type:`thinking`,id:String(a.length)}),a.push(n)),Lt(s,{type:`thinking`,thinking:a[a.length-1]},c);let l=[...e];return l[t]={...i,thinkingSegments:a,contentOrder:o,contentBlocks:s},l}function Rt(e,t,n,r,i=Date.now()){if(n){let a=R(e,n);if(a>=0)return V(e,a,t,n);if(L(e))return V(e,e.length-1,t,n);let o=r?.();return o?V([...e,o],e.length,t,n):It(e,t,n,i)}return L(e)?V(e,e.length-1,t,void 0):It(e,t,n,i)}function zt(e,t,n,r=Date.now()){return[...e,{id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,thinkingSegments:[t],contentOrder:[{type:`thinking`,id:`0`}],contentBlocks:[{type:`thinking`,thinking:t}],timestamp:r}]}function Bt(e,t,n,r,i=Date.now()){if(n){let a=R(e,n);if(a>=0)return H(e,a,t,n);if(L(e))return H(e,e.length-1,t,n);let o=r?.();return o?H([...e,o],e.length,t,n):zt(e,t,n,i)}return L(e)?H(e,e.length-1,t,void 0):zt(e,t,n,i)}function Vt(e,t=Date.now()){let n=!1,r=e.map(e=>{if(e.role!==`assistant`)return e;let r=B(e,t);return r?(n=!0,{...e,...r}):e});return n?r:e}function Ht(e,t,n=Date.now()){let r=e[e.length-1],i=Ot(t.attachments);if(r?.role!==`assistant`)return i?[...e,{id:t.messageId??crypto.randomUUID(),...t.messageId?{}:{isOptimistic:!0},role:`assistant`,timestamp:n,attachments:i}]:e;let a=B(r,n),o=r.isOptimistic===!0&&!!t.messageId;return[...e.slice(0,-1),{...r,...o?{id:t.messageId,isOptimistic:!1}:{},...i?{attachments:i}:{},...a??{}}]}function Ut(e,t){if(t!==void 0)return e.findIndex(e=>e.role===`user`&&e.clientMessageId===t);let n=-1;for(let t=e.length-1;t>=0;t--){let r=e[t];if(r&&r.role===`user`&&r.isOptimistic===!0){if(!r.clientMessageId)return t;n===-1&&(n=t)}}return n}function Wt(e,t,n=Date.now()){let r=t.messageId;if(r!==void 0&&e.some(e=>e.role===`user`&&(e.id===r||e.mergedMessageIds?.includes(r))))return e;let i=Ut(e,t.clientMessageId);if(i!==-1){if(r===void 0)return e;let t=[...e];return t[i]={...t[i],id:r,isOptimistic:!1,queueStatus:void 0,queuePosition:void 0},t}return[...e,{id:r??crypto.randomUUID(),...r===void 0?{isOptimistic:!0}:{},...t.clientMessageId?{clientMessageId:t.clientMessageId}:{},role:`user`,textSegments:[t.text],contentOrder:[{type:`text`,id:`0`}],contentBlocks:[{type:`text`,text:t.text}],timestamp:n}]}function Gt(e,t=Date.now()){let n=e.length-1,r=e[n];if(!r||r.role!==`assistant`)return e;let i=B(r,t);if(!(Dt(r).trim().length>0||r.thinkingSegments!=null&&r.thinkingSegments.length>0||r.toolCalls!=null&&r.toolCalls.length>0||r.surfaces!=null&&r.surfaces.length>0))return e.slice(0,-1);let a=[...e];return a[n]={...r,...i??{}},a}function U(e,t){let n=[...e??[]],r=n.findIndex(e=>e.type===`tool_use`&&e.toolCall.id===t.id);return r===-1?n.push({type:`tool_use`,toolCall:t}):n[r]={type:`tool_use`,toolCall:t},n}function W(e,t,n,r){let i=z(e[t],r),a=i.toolCalls?.findIndex(e=>e.id===n.id)??-1,o=[...e];if(a!==-1){let e=[...i.toolCalls??[]],r={...e[a],...n};return e[a]=r,o[t]={...i,toolCalls:e,contentBlocks:U(i.contentBlocks,r)},o}return o[t]={...i,toolCalls:[...i.toolCalls??[],n],contentOrder:[...i.contentOrder??[],{type:`toolCall`,id:n.id}],contentBlocks:U(i.contentBlocks,n)},o}function Kt(e,t,n,r=Date.now()){if(n){let r=R(e,n);if(r>=0)return W(e,r,t,n);if(L(e))return W(e,e.length-1,t,n)}else if(L(e))return W(e,e.length-1,t);return[...e,{id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,toolCalls:[t],contentOrder:[{type:`toolCall`,id:t.id}],contentBlocks:[{type:`tool_use`,toolCall:t}],timestamp:r}]}function qt(e,t){let n=-1,r=-1;if(t.toolUseId)for(let i=e.length-1;i>=0;i--){let a=e[i];if(a?.role!==`assistant`||!a.toolCalls?.length)continue;let o=a.toolCalls.findIndex(e=>e.id===t.toolUseId);if(o!==-1){n=i,r=o;break}}if(n===-1){if(n=e.findLastIndex(e=>e.role===`assistant`&&e.toolCalls&&e.toolCalls.length>0),n===-1)return e;let t=e[n];if(!t?.toolCalls)return e;r=t.toolCalls.findLastIndex(e=>p(e))}if(r===-1)return e;let i=e[n],a=i.toolCalls[r];if(!a)return e;let o=t.imageDataList===void 0?t.imageData===void 0?void 0:[t.imageData]:t.imageDataList,s=t.imageData===void 0?o?.[0]:t.imageData,c=[...i.toolCalls],l={...a,result:t.result,isError:t.isError,riskLevel:t.riskLevel,riskReason:t.riskReason,matchedTrustRuleId:t.matchedTrustRuleId,approvalMode:t.approvalMode,approvalReason:t.approvalReason,riskThreshold:t.riskThreshold,riskAllowlistOptions:t.riskAllowlistOptions,riskScopeOptions:t.riskScopeOptions,riskDirectoryScopeOptions:t.riskDirectoryScopeOptions,...s===void 0?{}:{imageData:s},...o===void 0?{}:{imageDataList:o},...t.activityMetadata===void 0?{}:{activityMetadata:t.activityMetadata},...t.errorCode===void 0?{}:{errorCode:t.errorCode},completedAt:t.completedAt??Date.now(),streamedOutput:void 0};c[r]=l;let u=[...e];return u[n]={...i,toolCalls:c,contentBlocks:U(i.contentBlocks,l)},u}var Jt=16384;function Yt(e){return e.length<=16384?e:e.slice(e.length-Jt)}function Xt(e,t){if(!t.chunk)return e;let n=-1,r=-1;if(t.toolUseId){if(t.messageId){let i=R(e,t.messageId);if(i>=0){let a=e[i].toolCalls?.findIndex(e=>e.id===t.toolUseId)??-1;a!==-1&&(n=i,r=a)}}if(n===-1)for(let i=e.length-1;i>=0;i--){let a=e[i];if(a?.role!==`assistant`||!a.toolCalls?.length)continue;let o=a.toolCalls.findIndex(e=>e.id===t.toolUseId);if(o!==-1){n=i,r=o;break}}}else{if(n=e.findLastIndex(e=>e.role===`assistant`&&e.toolCalls&&e.toolCalls.length>0),n===-1)return e;let t=e[n];if(!t?.toolCalls)return e;r=t.toolCalls.findLastIndex(e=>p(e))}if(n===-1||r===-1)return e;let i=e[n],a=i.toolCalls[r];if(!a)return e;let o={...a,streamedOutput:Yt((a.streamedOutput??``)+t.chunk)},s=[...i.toolCalls];s[r]=o;let c=[...e];return c[n]={...i,toolCalls:s,contentBlocks:U(i.contentBlocks,o)},c}function Zt(e,t,n,r=Date.now()){let i=-1;if(n&&(i=R(e,n)),i===-1){for(let t=e.length-1;t>=0;t--)if(e[t]?.role===`assistant`){i=t;break}}let a=[...e];if(i===-1)a.push({id:n??crypto.randomUUID(),...n?{}:{isOptimistic:!0},role:`assistant`,surfaces:[t],contentOrder:[{type:`surface`,id:t.surfaceId}],contentBlocks:[{type:`surface`,surface:t}],timestamp:r});else{let r=z(e[i],n);if(r.contentOrder?.some(e=>e.type===`surface`&&e.id===t.surfaceId)||r.surfaces?.some(e=>e.surfaceId===t.surfaceId))return e;a[i]={...r,surfaces:[...r.surfaces??[],t],contentOrder:[...r.contentOrder??[],{type:`surface`,id:t.surfaceId}],contentBlocks:M(r.contentBlocks,t)}}return a}function Qt(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r],a=i.surfaces?.findIndex(e=>e.surfaceId===t)??-1;if(a===-1)continue;let o=i.surfaces[a],s={...o.data,...n};o.data.templateData&&n.templateData&&typeof o.data.templateData==`object`&&typeof n.templateData==`object`&&(s.templateData={...o.data.templateData,...n.templateData});let c={...o,data:s},l=[...e],u=[...i.surfaces];return u[a]=c,l[r]={...i,surfaces:u,contentBlocks:M(i.contentBlocks,c)},l}return e}function $t(e,t){for(let n=e.length-1;n>=0;n--){if(!e[n].surfaces?.some(e=>e.surfaceId===t))continue;let r=[...e];return r[n]={...e[n],surfaces:e[n].surfaces?.filter(e=>e.surfaceId!==t),contentOrder:e[n].contentOrder?.filter(e=>!(e.type===`surface`&&e.id===t)),contentBlocks:et(e[n].contentBlocks,t)},r}return e}function en(e,t,n){for(let r=e.length-1;r>=0;r--){let i=e[r].surfaces?.find(e=>e.surfaceId===t);if(!i)continue;let a={...i,completed:!0,completionSummary:n},o=[...e];return o[r]={...e[r],surfaces:e[r].surfaces?.map(e=>e.surfaceId===t?a:e),contentBlocks:M(e[r].contentBlocks,a)},o}return e}var tn=[`choice`,`oauth_connect`,`form`,`confirmation`,`file_upload`,`card`,`list`,`table`,`browser_view`,`task_preferences`];function nn(e){return e==null||e.hasPendingConfirmation||e.hasUncompletedVisibleSurface}function rn(e,t){let n=!1,r=e.map(e=>{let r=ie(e,e=>e.pendingConfirmation?.requestId===t?{...e,pendingConfirmation:void 0}:e);return r!==e&&(n=!0),r});return n?r:e}function an(e){let t=!1,n=e.map(e=>{let n=ie(e,e=>e.pendingConfirmation?{...e,pendingConfirmation:void 0}:e);return n!==e&&(t=!0),n});return t?n:e}function on(e,t){let n=new Set;for(let e of t)if(e.surfaces)for(let t of e.surfaces)re(t)&&n.add(t.surfaceId);return n.size===0?{updatedMessages:e,dismissedIds:n}:{updatedMessages:e.map(e=>nt(e,e=>!n.has(e.surfaceId))),dismissedIds:n}}function sn(e,t,n,r,i){for(let a=e.length-1;a>=0;a--){let o=e[a].surfaces?.find(e=>e.surfaceId===t);if(!o)continue;if(!tn.includes(o.surfaceType)||o.completed)return e;let s=o.actions?.find(e=>e.id===n),c=n===`cancel`||n===`dismiss`,l=[...e];return l[a]=tt(e[a],e=>e.surfaceId===t?{...e,completed:!0,completionSummary:c?`Cancelled`:r??s?.label??void 0,...i?.tone?{completionTone:i.tone}:{}}:e),l}return e}function cn(e,t,n){return e&&ne[e]||t||n}function G(e){return typeof e==`string`?e:void 0}function ln(e){return typeof e==`boolean`?e:void 0}function un(e){return Array.isArray(e)?e:void 0}function dn(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function K(e){return Array.isArray(e)?e:void 0}function fn(e){return{requestId:typeof e.requestId==`string`?e.requestId:``,label:G(e.label),service:G(e.service),field:G(e.field),description:G(e.description),placeholder:G(e.placeholder),allowOneTimeSend:ln(e.allowOneTimeSend),allowedTools:un(e.allowedTools),allowedDomains:un(e.allowedDomains),purpose:G(e.purpose)}}function pn(e){let t={requestId:typeof e.requestId==`string`?e.requestId:``,title:G(e.title),description:G(e.description),toolName:G(e.toolName),riskLevel:G(e.riskLevel),riskReason:G(e.riskReason),allowlistOptions:K(e.allowlistOptions),scopeOptions:K(e.scopeOptions),directoryScopeOptions:K(e.directoryScopeOptions),persistentDecisionsAllowed:ln(e.persistentDecisionsAllowed),input:dn(e.input),toolUseId:G(e.toolUseId)};return{confData:t,state:{...t,confirmLabel:G(e.confirmLabel),denyLabel:G(e.denyLabel)}}}function mn(){return`turn-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function hn(e,t){let n=Date.parse(e);return Number.isFinite(n)?n:typeof t==`number`?t:0}function gn(e,t,n){switch(t.type){case`assistant_text_delta`:return Rt(e,t.text,t.messageId,void 0,n);case`assistant_thinking_delta`:return Bt(e,t.thinking,t.messageId,void 0,n);case`message_complete`:return Ht(e,t,n);case`user_message_echo`:return Wt(e,{text:t.text,messageId:t.messageId,clientMessageId:t.clientMessageId},n);case`message_dequeued`:return Nt(e,t.requestId);case`message_requeued`:return Pt(e,t.requestId,t.position);case`message_queued_deleted`:return Ft(e,t.requestId);case`assistant_activity_state`:return t.phase===`idle`?Vt(e,n):e;case`conversation_error`:return Gt(e,n);case`tool_use_preview_start`:return Kt(e,{id:t.toolUseId,name:t.toolName,input:{},previewStartedAt:typeof t.previewStartedAt==`number`?t.previewStartedAt:n},t.messageId,n);case`tool_use_start`:return Kt(e,{id:t.toolUseId??`tool-${n}`,name:t.toolName,input:t.input,startedAt:`startedAt`in t&&typeof t.startedAt==`number`?t.startedAt:n,...`previewStartedAt`in t&&typeof t.previewStartedAt==`number`?{previewStartedAt:t.previewStartedAt}:{}},t.messageId,n);case`tool_result`:return qt(e,{toolUseId:t.toolUseId,result:t.result,isError:t.isError,riskLevel:t.riskLevel,riskReason:t.riskReason,matchedTrustRuleId:t.matchedTrustRuleId,approvalMode:t.approvalMode,approvalReason:t.approvalReason,riskThreshold:t.riskThreshold,riskAllowlistOptions:t.riskAllowlistOptions,riskScopeOptions:t.riskScopeOptions,riskDirectoryScopeOptions:t.riskDirectoryScopeOptions,imageData:t.imageData,imageDataList:t.imageDataList,activityMetadata:t.activityMetadata,errorCode:t.errorCode,completedAt:`completedAt`in t&&typeof t.completedAt==`number`?t.completedAt:n});case`tool_output_chunk`:return t.chunk?Xt(e,{chunk:t.chunk,toolUseId:t.toolUseId,messageId:t.messageId}):e;case`ui_surface_show`:{let r={surfaceId:t.surfaceId,surfaceType:t.surfaceType,title:t.title,data:t.data,actions:t.actions,display:t.display};return r.display=f(r),Zt(e,r,t.messageId,n)}case`ui_surface_update`:return Qt(e,t.surfaceId,t.data);case`ui_surface_dismiss`:return $t(e,t.surfaceId);case`ui_surface_complete`:return en(e,t.surfaceId,t.summary);case`confirmation_request`:return te(e,{requestId:t.requestId,toolName:t.toolName,riskLevel:t.riskLevel,riskReason:t.riskReason,allowlistOptions:t.allowlistOptions,scopeOptions:t.scopeOptions,directoryScopeOptions:t.directoryScopeOptions,persistentDecisionsAllowed:t.persistentDecisionsAllowed,input:t.input,toolUseId:t.toolUseId}).updatedMessages;case`interaction_resolved`:return t.kind===`confirmation`||t.kind===`acp_confirmation`?rn(e,t.requestId):e;default:return e}}function _n(e,t,n){if(e!==void 0){if(typeof n!=`number`)return e;switch(t.type){case`assistant_turn_start`:case`assistant_text_delta`:case`assistant_thinking_delta`:return!0;case`assistant_activity_state`:return t.phase!==`idle`;case`message_complete`:return!1;default:return e}}}function vn(e,t){let{seq:n}=t;if(typeof n==`number`&&typeof e.seq==`number`&&n<=e.seq)return e;let r=hn(t.emittedAt,n),i=gn(e.messages,t.message,r),a=typeof n==`number`?Math.max(e.seq??-1,n):e.seq??null,o=_n(e.processing,t.message,n);return{...e,messages:i,seq:a,processing:o}}function yn(e,t){return t.reduce(vn,e)}function bn(e,t){return t===null?e:yn(e,t)}var xn={hasMore:!1,oldestTimestamp:null,isLoadingOlder:!1};function Sn(){return{snapshot:null,optimisticSends:[],error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...xn},contextWindowUsage:null,ephemeralMetaResults:[],compactionCircuitOpenUntil:null,dismissedSurfaceIds:new Set,streamingMessageIds:new Set,pendingQueuedMessageIds:[],requestIdToMessageId:new Map,pendingLocalDeletions:new Set,confirmationToolCallMap:new Map,expandedToolCallIds:new Set,expandedCardIds:new Map,contextWindowUsageByConversation:new Map,previousConversationId:null,previousAssistantId:null,draftConversationIdResolution:!1}}function q(e,t){return typeof t==`function`?t(e):t}function Cn(e,t){if(e.length===0)return e;let n=new Map;for(let e of t)for(let t of F(e))n.has(t)||n.set(t,e);let r=e.filter(e=>{let t;for(let r of F(e))if(t=n.get(r),t)break;return t?!!e.attachments?.length&&!t.attachments?.length:!0});return r.length===e.length?e:r}var J=o(a()((e,t)=>({...Sn(),seedSnapshot:(n,r)=>{let i=t().snapshot;if(r.seq==null&&i!==null&&typeof i.seq==`number`){c(`history_seed_skipped_anchorless`,{conversationId:n,liveSeq:i.seq});return}let a=be(n,r.seq??null);if(a===null&&i!==null&&typeof i.seq==`number`&&typeof r.seq==`number`&&r.seq<i.seq){c(`history_seed_skipped_stale_anchor`,{conversationId:n,liveSeq:i.seq,fetchedSeq:r.seq});return}let o=bn(r,a);e(e=>({snapshot:o,optimisticSends:Cn(e.optimisticSends,o.messages)}))},applyEnvelopeToSnapshot:t=>e(e=>e.snapshot?{snapshot:vn(e.snapshot,t)}:{}),addOptimisticSend:t=>e(e=>({optimisticSends:[...e.optimisticSends,t]})),setOptimisticSends:t=>e(e=>({optimisticSends:q(e.optimisticSends,t)})),patchSnapshotMessages:t=>e(e=>e.snapshot?{snapshot:{...e.snapshot,messages:t(e.snapshot.messages)}}:{}),setError:t=>e(e=>({error:q(e.error,t)})),setNotice:t=>e(e=>({notice:q(e.notice,t)})),setIsLoadingHistory:t=>e({isLoadingHistory:t}),setTranscriptPagination:t=>e(e=>({transcriptPagination:q(e.transcriptPagination,t)})),setContextWindowUsage:t=>e(e=>({contextWindowUsage:q(e.contextWindowUsage,t)})),setCompactionCircuitOpenUntil:t=>e(e=>({compactionCircuitOpenUntil:q(e.compactionCircuitOpenUntil,t)})),switchToConversation:({assistantId:n,activeConversationId:r})=>{let i=t();if(i.draftConversationIdResolution){e({draftConversationIdResolution:!1});return}let a=i.previousConversationId;if(a&&a!==r&&a){let e=P.getState();(e.pendingSecret||e.pendingConfirmation)&&u.getState().addAttentionConversationId(a)}let o=i.previousAssistantId!==null&&i.previousAssistantId!==n,s=o||i.previousAssistantId===null;c(`conversation_switch_reset`,{assistantId:n,conversationId:r,outgoingConversationId:a??null}),j.getState().handleConversationSwitch({previousKey:a??null,nextKey:r}),we.getState().resetTurn(),P.getState().resetAll(),o?j.getState().fullReset():j.getState().resetAttachments();let l=s?dt(n):i.contextWindowUsageByConversation;e({snapshot:null,optimisticSends:[],ephemeralMetaResults:[],error:N(i.error)?i.error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...xn},contextWindowUsage:l.get(r)??null,compactionCircuitOpenUntil:null,dismissedSurfaceIds:at(n,r),streamingMessageIds:new Set,pendingQueuedMessageIds:[],requestIdToMessageId:new Map,pendingLocalDeletions:new Set,confirmationToolCallMap:new Map,expandedToolCallIds:new Set,expandedCardIds:new Map,contextWindowUsageByConversation:l,previousConversationId:r,previousAssistantId:n,draftConversationIdResolution:!1})},markDraftResolution:()=>e({draftConversationIdResolution:!0}),setConfirmationToolCall:(t,n)=>e(e=>{let r=new Map(e.confirmationToolCallMap);return r.set(t,n),{confirmationToolCallMap:r}}),deleteConfirmationToolCall:t=>e(e=>{let n=new Map(e.confirmationToolCallMap);return n.delete(t),{confirmationToolCallMap:n}}),clearConfirmationToolCallMap:()=>e({confirmationToolCallMap:new Map}),addDismissedSurfaceId:t=>e(e=>{let n=new Set(e.dismissedSurfaceIds);return n.add(t),{dismissedSurfaceIds:n}}),addDismissedSurfaceIds:t=>e(e=>{let n=new Set(e.dismissedSurfaceIds);for(let e of t)n.add(e);return{dismissedSurfaceIds:n}}),batchUpdateStreamingMessageIds:(t,n)=>e(e=>{let r=new Set(e.streamingMessageIds);for(let e of t)r.add(e);for(let e of n)r.delete(e);return{streamingMessageIds:r}}),pushPendingQueuedMessageId:t=>e(e=>({pendingQueuedMessageIds:[...e.pendingQueuedMessageIds,t]})),shiftPendingQueuedMessageId:()=>{let n=t().pendingQueuedMessageIds;if(n.length===0)return;let[r,...i]=n;return e({pendingQueuedMessageIds:i}),r},takePendingQueuedMessageId:n=>{let r=t().pendingQueuedMessageIds;if(r.includes(n))return e({pendingQueuedMessageIds:r.filter(e=>e!==n)}),n},setRequestIdMapping:(t,n)=>e(e=>{let r=new Map(e.requestIdToMessageId);return r.set(t,n),{requestIdToMessageId:r}}),popRequestIdMapping:n=>{let r=t().requestIdToMessageId,i=r.get(n);if(i!==void 0){let t=new Map(r);t.delete(n),e({requestIdToMessageId:t})}return i},addPendingLocalDeletion:t=>e(e=>{let n=new Set(e.pendingLocalDeletions);return n.add(t),{pendingLocalDeletions:n}}),consumePendingLocalDeletion:n=>{let r=t().pendingLocalDeletions;if(!r.has(n))return!1;let i=new Set(r);return i.delete(n),e({pendingLocalDeletions:i}),!0},setExpandedToolCallId:(t,n)=>e(e=>{let r=new Set(e.expandedToolCallIds);return n?r.add(t):r.delete(t),{expandedToolCallIds:r}}),setExpandedCardId:(t,n)=>e(e=>{let r=new Map(e.expandedCardIds);return r.set(t,n),{expandedCardIds:r}}),setContextWindowUsageForConversation:(t,n)=>e(e=>{let r=new Map(e.contextWindowUsageByConversation);return r.set(t,n),{contextWindowUsageByConversation:r}}),addEphemeralMetaResult:t=>e(e=>({ephemeralMetaResults:[...e.ephemeralMetaResults,t]})),clearEphemeralMetaResults:()=>e(e=>e.ephemeralMetaResults.length===0?e:{ephemeralMetaResults:[]})})));function wn(e,t){if(t.length===0)return e;let n=new Map;for(let e of t)for(let t of F(e))n.has(t)||n.set(t,e);let r=[],i=new Set;for(let t of e){let e;for(let r of F(t)){let t=n.get(r);if(t){e=t;break}}if(e){i.has(e)||(r.push(e),i.add(e));continue}r.push(t)}for(let e of t)i.has(e)||r.push(e);return r}function Tn(){let e=J.use.snapshot()?.messages,t=J.use.optimisticSends(),n=J.use.dismissedSurfaceIds();return(0,le.useMemo)(()=>wn(ct(e,n),t),[e,t,n])}function Y(e,t,n=`…`){return e.length<=t?e:e.slice(0,t-n.length)+n}function En(e){if(!e)return null;let t=e.split(`/`),n=t[t.length-1];return!n||n===`.`?null:n}function X(e,t){return Y(e,t,`...`)}function Dn(e){if(!e)return null;let t=e.replace(/\s+/g,` `).trim().match(/(?:^|&&\s*|\|\|\s*|;\s*)(?:\S*\/)?assistant\s+browser\s+([^\s;&|]+)/i);if(!t)return null;let n=t[1].toLowerCase();return new Set([`navigate`,`click`,`type`,`screenshot`,`snapshot`,`scroll`,`hover`,`select`,`drag`,`wait`,`back`,`forward`,`refresh`,`close`,`tab`,`press_key`,`wait_for`,`extract`,`fill_credential`]).has(n)?n:`unknown`}function Z(e,t){let n=e.toLowerCase();return n!==`bash`&&n!==`host_bash`?null:Dn(t)}function On(e){switch(e){case`navigate`:return`Opened a page`;case`click`:return`Clicked on the page`;case`type`:return`Typed on the page`;case`screenshot`:return`Took a screenshot`;case`snapshot`:return`Captured page snapshot`;case`scroll`:return`Scrolled the page`;case`hover`:return`Hovered on the page`;case`select`:return`Selected on the page`;case`drag`:return`Dragged on the page`;case`wait`:return`Waited for the page`;case`back`:return`Went back`;case`forward`:return`Went forward`;case`refresh`:return`Refreshed the page`;case`close`:return`Closed the tab`;case`tab`:return`Switched tabs`;case`press_key`:return`Pressed a key`;case`wait_for`:return`Waited for a condition`;case`extract`:return`Extracted page content`;case`fill_credential`:return`Filled a credential`;case`unknown`:return`Used the browser`}}function kn(e){switch(e){case`navigate`:return`Opening a page`;case`click`:return`Clicking on the page`;case`type`:return`Typing on the page`;case`screenshot`:return`Taking a screenshot`;case`snapshot`:return`Capturing page snapshot`;case`scroll`:return`Scrolling the page`;case`hover`:return`Hovering on the page`;case`select`:return`Selecting on the page`;case`drag`:return`Dragging on the page`;case`wait`:return`Waiting for the page`;case`back`:return`Going back`;case`forward`:return`Going forward`;case`refresh`:return`Refreshing the page`;case`close`:return`Closing the tab`;case`tab`:return`Switching tabs`;case`press_key`:return`Pressing a key`;case`wait_for`:return`Waiting for a condition`;case`extract`:return`Extracting page content`;case`fill_credential`:return`Filling a credential`;case`unknown`:return`Using the browser`}}function An(e){switch(e){case`navigate`:case`back`:case`forward`:case`tab`:return`compass`;case`click`:case`hover`:case`select`:case`drag`:case`scroll`:return`compass`;case`screenshot`:case`snapshot`:return`camera`;case`type`:case`press_key`:case`fill_credential`:return`compass`;case`wait`:case`wait_for`:case`refresh`:case`close`:return`compass`;case`extract`:return`compass`;case`unknown`:return`compass`}}function jn(e,t){let n=e.toLowerCase();if(n===`bash`||n===`host_bash`){let e=t.command??t.cmd;if(typeof e==`string`)return e.replace(/\s+/g,` `).trim()}if(n===`file_read`||n===`host_file_read`||n===`file_write`||n===`host_file_write`||n===`file_edit`||n===`host_file_edit`){let e=t.file_path??t.path??t.filePath;if(typeof e==`string`)return e}if(n===`grep`||n===`glob`){let e=t.pattern??t.query;if(typeof e==`string`)return e}if(n===`web_search`){let e=t.query??t.search;if(typeof e==`string`)return e}return``}function Mn(e,t=``){let n=e.toLowerCase(),r=t.replace(/\s+/g,` `).trim(),i=En(r),a=Z(e,r);if(a)return On(a);switch(n){case`bash`:case`host_bash`:return r?`Ran \`${X(r,30)}\``:`Ran a command`;case`file_read`:case`host_file_read`:return i?`Read ${i}`:`Read a file`;case`file_write`:case`host_file_write`:return i?`Wrote ${i}`:`Wrote a file`;case`file_edit`:case`host_file_edit`:return i?`Edited ${i}`:`Edited a file`;case`grep`:return r?`Searched for '${X(r,25)}'`:`Searched files`;case`glob`:return r?`Searched for ${X(r,25)}`:`Found files`;case`web_search`:return r?`Searched '${X(r,25)}'`:`Searched the web`;case`web_fetch`:return`Fetched a webpage`;default:return`Used ${e.replace(/_/g,` `)}`}}function Nn(e,t=``,n){let r=Z(e,t);if(r)return kn(r);if(n){let t=e.toLowerCase();if(t===`app_create`||t===`app_refresh`||t===`app_update`)return n}switch(e.toLowerCase()){case`bash`:case`host_bash`:return`Running a command`;case`file_read`:case`host_file_read`:return`Reading a file`;case`file_write`:case`host_file_write`:return`Writing a file`;case`file_edit`:case`host_file_edit`:return`Editing a file`;case`grep`:return`Searching files`;case`glob`:return`Finding files`;case`web_search`:return`Searching the web`;case`web_fetch`:return`Fetching a webpage`;case`app_create`:return`Building your app`;case`app_refresh`:case`app_update`:return`Refreshing your app`;default:return`Running ${e.replace(/_/g,` `)}`}}function Pn(e){return e.split(/[_-]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function Fn(e,t=``){let n=Z(e,t);if(n)return An(n);switch(e.toLowerCase()){case`bash`:case`host_bash`:return`terminal`;case`file_read`:case`host_file_read`:return`file-text`;case`file_write`:case`host_file_write`:return`file-plus`;case`file_edit`:case`host_file_edit`:return`pencil`;case`grep`:case`glob`:case`web_search`:return`search`;case`web_fetch`:return`globe`;default:return`wrench`}}var In=80;function Q(e,...t){for(let n of t){let t=e[n];if(typeof t==`string`&&t.trim().length>0)return t}return``}function Ln(e){if(!e)return``;let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}function Rn(e){if(!e.startsWith(`mcp__`))return null;let t=e.slice(5),n=t.indexOf(`__`);if(n===-1)return null;let r=t.slice(0,n),i=t.slice(n+2);return!r||!i?null:{serverName:r,toolMethod:i}}function $(e,t){let n=t&&typeof t==`object`?t:{},r=e.toLowerCase(),i=Q(n,`activity`,`reason`),a=Rn(e);if(a)return{title:`Using ${a.serverName}`,info:a.toolMethod,activity:i,iconName:`plug`};switch(r){case`bash`:case`host_bash`:return{title:`Working`,info:Y(Q(n,`command`,`cmd`).replace(/\s+/g,` `).trim(),In),activity:i,iconName:`terminal`};case`str_replace_editor`:case`text_editor`:{let e=Q(n,`command`).toLowerCase(),t=Ln(Q(n,`path`,`file_path`,`filePath`));return e===`view`?{title:`Reading`,info:t,activity:i,iconName:`file`}:{title:`Editing`,info:t,activity:i,iconName:`pen`}}case`computer`:return{title:`Using computer`,info:Q(n,`action`),activity:i,iconName:`monitor`};case`skill_execute`:{let e=Q(n,`tool`);if(e){let t=n.input,r=$(e,t);return{...r,activity:i||r.activity}}return{title:`Using a skill`,info:Q(n,`skill`,`name`,`skillName`),activity:i,iconName:`sparkle`}}case`skill`:case`skill_invoke`:case`skill_load`:return{title:`Using a skill`,info:Q(n,`skill`,`name`,`skillName`),activity:i,iconName:`sparkle`};case`subagent_spawn`:return{title:`Spawning subagent`,info:Q(n,`label`,`objective`,`task`),activity:i,iconName:`user-plus`};default:return{title:e?`Running ${Pn(e)}`:`Running tool`,info:``,activity:i,iconName:`bolt`}}}function zn(e){return $(e.name,e.input)}var Bn=[{open:`<thinking>`,close:`</thinking>`},{open:`<think>`,close:`</think>`}];function Vn(e){return Bn.some(t=>e.includes(t.open))}function Hn(e){if(!Vn(e))return null;let t=[],n=e=>{e.trim()&&t.push({type:`text`,text:e})},r=e=>{let n=e.trim();n&&t.push({type:`thinking`,thinking:n})},i=0;for(;;){let a=-1,o;for(let t of Bn){let n=e.indexOf(t.open,i);n!==-1&&(a===-1||n<a)&&(a=n,o=t)}if(!o)break;n(e.slice(i,a));let s=a+o.open.length,c=e.indexOf(o.close,s);if(c===-1)return r(e.slice(s)),t;r(e.slice(s,c)),i=c+o.close.length}return n(e.slice(i)),t}function Un(e){return typeof e.id==`string`&&e.id.length>0}function Wn(e){return e.some(e=>e.type===`text`&&Vn(e.text))?e.flatMap(e=>{let t=e.type===`text`?Hn(e.text):null;return t?t.map(e=>e.type===`thinking`?{type:`thinking`,thinking:e.thinking}:{type:`text`,text:e.text}):[e]}):e}function Gn(e,t){let n=t?.splitInlineThinking?Wn(e):e,r=[],i=null,a=()=>(i||(i={type:`activity`,items:[]},r.push(i)),i);for(let e of n)if(e.type===`thinking`){let t=a(),n=t.items[t.items.length-1];n?.type===`thinking`?(n.thinking=n.thinking?`${n.thinking}\n${e.thinking}`:e.thinking,e.startedAt!=null&&(n.startedAt=n.startedAt==null?e.startedAt:Math.min(n.startedAt,e.startedAt)),e.completedAt!=null&&(n.completedAt=n.completedAt==null?e.completedAt:Math.max(n.completedAt,e.completedAt))):t.items.push({type:`thinking`,thinking:e.thinking,startedAt:e.startedAt,completedAt:e.completedAt})}else if(e.type===`tool_use`){if(!Un(e.toolCall))continue;a().items.push({type:`tool_use`,toolCall:e.toolCall})}else (e.type===`text`||e.type===`surface`)&&(i=null,r.push(e));return r}function Kn(e){let t=[],n=[];for(let r of e){if(r.type===`thinking`){r.thinking&&t.push({kind:`thinking`,text:r.thinking,startedAt:r.startedAt,completedAt:r.completedAt});continue}let e=r.toolCall;qn(e)||(n.push(e),t.push({kind:`toolCall`,toolCall:e}))}return{cardItems:t,toolCalls:n}}function qn(e){return!e.pendingConfirmation&&(e.name===`ui_show`||e.name===`ui_update`||e.name===`ui_dismiss`)}function Jn(e){if(e.name===`subagent_spawn`)return!0;if(e.name!==`skill_execute`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.tool===`subagent_spawn`}function Yn(e){if(e.name===`run_workflow`)return!0;if(e.name!==`skill_execute`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.tool===`run_workflow`}function Xn(e){if(e.name===`acp_spawn`)return!0;if(e.name!==`skill_execute`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.tool===`acp_spawn`}function Zn(e){if(e.name!==`bash`&&e.name!==`host_bash`)return!1;let t=e.input;return typeof t!=`object`||!t?!1:t.background===!0}var Qn=new Set([`low`,`medium`,`high`]);function $n(e){let t=e?.toLowerCase();return t&&Qn.has(t)?t:`medium`}function er(e){switch(e?.toLowerCase()){case`low`:return{bg:`bg-[var(--system-positive-strong)]`,text:`text-white`,label:`Low`};case`medium`:return{bg:`bg-[var(--system-mid-strong)]`,text:`text-black`,label:`Medium`};case`high`:return{bg:`bg-[var(--system-negative-strong)]`,text:`text-white`,label:`High`};case`workspace`:return{bg:`bg-[var(--surface-lift)]`,text:`text-[var(--content-secondary)]`,border:`border border-[var(--border-element)]`,label:`Workspace`};default:return{bg:`bg-[var(--content-secondary)]`,text:`text-white`,label:e??`Unknown`}}}function tr(e){switch(e?.toLowerCase()){case`low`:return`Auto-approved at Conservative tolerance or higher`;case`medium`:return`Auto-approved at Relaxed tolerance or higher`;case`high`:return`Auto-approved only at Full Access tolerance`;default:return}}function nr(e){switch(e?.toLowerCase()){case`low`:return{bg:`bg-[var(--system-positive-weak)]`,text:`text-[var(--system-positive-strong)]`,label:`Low`};case`medium`:return{bg:`bg-[var(--system-mid-weak)]`,text:`text-[var(--system-mid-strong)]`,label:`Medium`};case`high`:return{bg:`bg-[var(--system-negative-weak)]`,text:`text-[var(--system-negative-strong)]`,label:`High`};case`workspace`:return{bg:`bg-[var(--surface-lift)]`,text:`text-[var(--content-secondary)]`,label:`Workspace`};default:return{bg:`bg-[var(--surface-lift)]`,text:`text-[var(--content-secondary)]`,label:e?e.charAt(0).toUpperCase()+e.slice(1):`Unknown`}}}var rr={unknown:2,low:0,medium:1,high:2},ir={none:-1,low:0,medium:1,high:2};function ar(e,t,n){return e?.toLowerCase()!==`auto`||!n?!0:(rr[(t??``).toLowerCase()]??-1)<=(ir[n.toLowerCase()]??-1)}function or(e){switch(e){case`trust_rule_allowed`:return`· Auto-approved · Trust rule matched`;case`sandbox_auto_approve`:return null;case`platform_auto_approve`:return`· Auto-approved · Platform session`;default:return null}}function sr(e,t){return e===`sandbox_auto_approve`?{displayLevel:`workspace`,inherentRisk:t}:{displayLevel:t??`unknown`}}export{$e as $,pn as A,L as B,wn as C,sn as D,an as E,Mt as F,P as G,F as H,At as I,Ct as J,St as K,Pt as L,cn as M,nn as N,on as O,Nt as P,tt as Q,Ft as R,Tn as S,rn as T,I as U,kt as V,Dt as W,ft as X,N as Y,ot as Z,Nn as _,oe as _t,tr as a,Ce as at,Pn as b,Kn as c,ve as ct,Zn as d,pe as dt,Ze as et,Yn as f,he as ft,jn as g,se as gt,$ as h,ce as ht,nr as i,v as it,fn as j,mn as k,Gn as l,ye as lt,zn as m,fe as mt,or as n,Ye as nt,$n as o,we as ot,Jn as p,me as pt,wt as q,er as r,j as rt,ar as s,xe as st,sr as t,Xe as tt,Xn as u,_e as ut,Fn as v,ae as vt,J as w,Y as x,Mn as y,jt as z};