@vellumai/web 0.10.8-staging.1 → 0.10.8-staging.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/dist/assets/{AnimatePresence-C8APSgIu.js → AnimatePresence-s1Z1HHWx.js} +1 -1
  2. package/dist/assets/{BundleConfirmPage-M2tkzwiz.js → BundleConfirmPage-C6bP7QB3.js} +1 -1
  3. package/dist/assets/{about-page-C-kIVb7a.js → about-page-XGv9RAQu.js} +1 -1
  4. package/dist/assets/{account-page-DOSnPXjP.js → account-page-Dno1SeJN.js} +1 -1
  5. package/dist/assets/{account-shell-74OchOxg.js → account-shell-CdhP9l8T.js} +1 -1
  6. package/dist/assets/{acp-run-detail-panel-DFoD_DVJ.js → acp-run-detail-panel-B1-zyOUe.js} +4 -4
  7. package/dist/assets/{activity-steps-panel-jztC4BRv.js → activity-steps-panel-BGyfMCXK.js} +1 -1
  8. package/dist/assets/{add-credits-modal-daNASKHJ.js → add-credits-modal-PP1PX8Qv.js} +1 -1
  9. package/dist/assets/{advanced-page-B8h5sAe5.js → advanced-page-vCbMVJsK.js} +1 -1
  10. package/dist/assets/{ai-page-BInYrZV7.js → ai-page-BIYybKux.js} +1 -1
  11. package/dist/assets/{animated-avatar-CrlodWQr.js → animated-avatar-Cqpzb8O4.js} +1 -1
  12. package/dist/assets/{api-key-screen-Cynx0r0g.js → api-key-screen-DTSP_-Da.js} +1 -1
  13. package/dist/assets/{archive-page-DqXRVFoF.js → archive-page-RZ2VP63A.js} +1 -1
  14. package/dist/assets/{assistant-feature-flag-store-CKUjJHuh.js → assistant-feature-flag-store-DA8Oj9Mf.js} +1 -1
  15. package/dist/assets/{assistant-status-panel-eNWJodpn.js → assistant-status-panel-BC0RTDls.js} +1 -1
  16. package/dist/assets/{auth-store-CD7PGb3q.js → auth-store-C09YAZEu.js} +2 -2
  17. package/dist/assets/{background-task-detail-panel-Bsi8IoaY.js → background-task-detail-panel-BfnsD-3B.js} +1 -1
  18. package/dist/assets/{billing-page-dpKYjJH3.js → billing-page-1z_L2m6q.js} +3 -3
  19. package/dist/assets/{bookmarks-page-BI92Y3eM.js → bookmarks-page-CjcavZv8.js} +1 -1
  20. package/dist/assets/{browser-BPZAXjRE.js → browser-C6a_nhhZ.js} +2 -2
  21. package/dist/assets/{build-state-DGsKGdpj.js → build-state-PUXrUU4W.js} +1 -1
  22. package/dist/assets/channels-page-route-WjNmd0sS.js +9 -0
  23. package/dist/assets/chat-markdown-message-BnX6bhgs.js +2 -0
  24. package/dist/assets/{client-feature-flag-store-C0g8zi1W.js → client-feature-flag-store-DkJl-g9A.js} +1 -1
  25. package/dist/assets/{command-palette-Dk6UsSlv.js → command-palette-6o4m7BM9.js} +1 -1
  26. package/dist/assets/{command-palette-window-page-zDow8o4K.js → command-palette-window-page-BsJlr5bh.js} +1 -1
  27. package/dist/assets/community-page-CJA4JfuC.js +1 -0
  28. package/dist/assets/{connect-page-BXTqYbdY.js → connect-page-DZgU3jCf.js} +1 -1
  29. package/dist/assets/{consent-controls-BZMxm0n3.js → consent-controls-Cnr1DzCr.js} +1 -1
  30. package/dist/assets/contacts-page-route-P0neH-PV.js +1 -0
  31. package/dist/assets/{credentials-page-0S5ifTFC.js → credentials-page-MkKE_19-.js} +1 -1
  32. package/dist/assets/debug-page-B88f4aDU.js +4 -0
  33. package/dist/assets/{deploy-dialogs-BBHNKgDi.js → deploy-dialogs-paL_zcvG.js} +1 -1
  34. package/dist/assets/{detail-card-RGTjHkZ8.js → detail-card-xKZlkbz5.js} +1 -1
  35. package/dist/assets/{detail-panel-stop-button-oIDUq-kJ.js → detail-panel-stop-button-y7O3HqJj.js} +1 -1
  36. package/dist/assets/{developer-page-Djolz4Fg.js → developer-page-BFMS6pwU.js} +1 -1
  37. package/dist/assets/{devices-page-XJJSA97y.js → devices-page-B3D5iLhD.js} +1 -1
  38. package/dist/assets/{dictation-overlay-page-cqsEjyx_.js → dictation-overlay-page-BkEBWrWm.js} +1 -1
  39. package/dist/assets/{document-viewer-page-jInmb33M.js → document-viewer-page-B631L6-3.js} +1 -1
  40. package/dist/assets/{earn-credits-modal-C_jhLLw5.js → earn-credits-modal-CFla-iKl.js} +1 -1
  41. package/dist/assets/edge-swipe-arbiter-store-BeOhrE7M.js +1 -0
  42. package/dist/assets/{emails-page-fov7ihfj.js → emails-page-7c9kVi_k.js} +1 -1
  43. package/dist/assets/{esm-Ddmch1KU.js → esm-Bzs_witt.js} +2 -2
  44. package/dist/assets/{esm-CYMQv-VS.js → esm-C5J59K0j.js} +2 -2
  45. package/dist/assets/{esm-CTXnt94k.js → esm-CT8NUp3h.js} +2 -2
  46. package/dist/assets/esm-DEu9JbAE.js +2 -0
  47. package/dist/assets/{esm-BciT3LGF.js → esm-DZkj1VLJ.js} +2 -2
  48. package/dist/assets/{esm-CvWQdH3L.js → esm-DtJz1M8R.js} +2 -2
  49. package/dist/assets/{feature-flag-catalog-CHuc71P8.js → feature-flag-catalog-GgSNKkqP.js} +1 -1
  50. package/dist/assets/{file-markdown-BXUvAQ24.js → file-markdown-Bq97tNxs.js} +1 -1
  51. package/dist/assets/{general-page-gojItIOd.js → general-page-D-Gr2lkW.js} +1 -1
  52. package/dist/assets/{haptics-DKVhthJo.js → haptics-lMERs7us.js} +2 -2
  53. package/dist/assets/hatching-screen-BlwicgIz.js +1 -0
  54. package/dist/assets/home-page-route-D24x4A0S.js +1 -0
  55. package/dist/assets/{hosting-screen-BTLHWS2M.js → hosting-screen-BZLZular.js} +1 -1
  56. package/dist/assets/identity-page-route-BwOJeenx.js +1 -0
  57. package/dist/assets/{index-BjtwYdrT.css → index-C9GrLGul.css} +1 -1
  58. package/dist/assets/{index-CSefSVJO.js → index-yu6nDHvG.js} +21 -21
  59. package/dist/assets/{inspect-page-CT8NspqC.js → inspect-page-1RejwSP_.js} +4 -4
  60. package/dist/assets/{integrations-page-DtClqS91.js → integrations-page-BV5BiHPD.js} +1 -1
  61. package/dist/assets/{intelligence-layout-D9ReVcK0.js → intelligence-layout-iQFO8in_.js} +1 -1
  62. package/dist/assets/{keyboard-shortcuts-page-CovdLPhh.js → keyboard-shortcuts-page-jt13JtxS.js} +1 -1
  63. package/dist/assets/{library-detail-page-MAsxHH08.js → library-detail-page-BAGWt1Lw.js} +1 -1
  64. package/dist/assets/{library-page-CYuSc92M.js → library-page-CqeoBhDY.js} +1 -1
  65. package/dist/assets/{login-flow-CHNlba5i.js → login-flow-B6q00uIW.js} +1 -1
  66. package/dist/assets/{login-page-CK1TxruP.js → login-page-BQVTWuQc.js} +1 -1
  67. package/dist/assets/{logout-page-W3gl_1Ax.js → logout-page-BV0URcAd.js} +1 -1
  68. package/dist/assets/{logs-layout-CR7u05YO.js → logs-layout-DO3yfZqD.js} +1 -1
  69. package/dist/assets/{memory-router-playground-page-eDjKwsbG.js → memory-router-playground-page-CQxX6mCn.js} +1 -1
  70. package/dist/assets/{metric-card-BN23geOu.js → metric-card-DvXjHVCV.js} +1 -1
  71. package/dist/assets/{mobile-sidebar-drawer-3LqMCZgK.js → mobile-sidebar-drawer-Epbt6p-k.js} +1 -1
  72. package/dist/assets/{native-file-Cn3RbQbT.js → native-file-DI99Emal.js} +2 -2
  73. package/dist/assets/{notifications-page-CtyUuC15.js → notifications-page-CXaZpD3s.js} +1 -1
  74. package/dist/assets/{oauth-complete-page-3DcY6Or3.js → oauth-complete-page-BlJm9tRJ.js} +1 -1
  75. package/dist/assets/{oauth-popup-complete-page-Cn-1bOwa.js → oauth-popup-complete-page-BqUopTat.js} +1 -1
  76. package/dist/assets/{page-shell-C2TBO8M8.js → page-shell-BUGBKCmv.js} +1 -1
  77. package/dist/assets/{pairing-page-Bb-_q_zP.js → pairing-page-B5GrCx4C.js} +1 -1
  78. package/dist/assets/{platform-loopback-page-Dfl_gjZm.js → platform-loopback-page-MZdCPXRI.js} +1 -1
  79. package/dist/assets/{plugin-detail-page-C_vv0F7O.js → plugin-detail-page-Byuqbr1N.js} +1 -1
  80. package/dist/assets/plugins-page-Ci0CoSAN.js +1 -0
  81. package/dist/assets/{prechat-route-CgCradwf.js → prechat-route-9JFn-w_1.js} +1 -1
  82. package/dist/assets/{prefs-DYaOj-dg.js → prefs-B1Y3q3c8.js} +1 -1
  83. package/dist/assets/{privacy-page-BqYdFos7.js → privacy-page-BTpvj9ZP.js} +1 -1
  84. package/dist/assets/{privacy-screen-DBMkRqiF.js → privacy-screen-CUbVcDf_.js} +1 -1
  85. package/dist/assets/{provider-callback-page-B-aDgII8.js → provider-callback-page-fB2tIyqL.js} +1 -1
  86. package/dist/assets/{provider-signup-page-CYK4VNf0.js → provider-signup-page-C4Dn-wtJ.js} +1 -1
  87. package/dist/assets/{quick-input-page-oif3WEFT.js → quick-input-page-Cv_CzapK.js} +1 -1
  88. package/dist/assets/{research-mock-page-CooZPqtv.js → research-mock-page-1T92rXz3.js} +1 -1
  89. package/dist/assets/{research-onboarding-route-BJqAsTdE.js → research-onboarding-route-CmWgwOFk.js} +3 -3
  90. package/dist/assets/{review-terms-screen-CVRYEl6e.js → review-terms-screen-DrD4vywk.js} +1 -1
  91. package/dist/assets/{risk-Dsj4oM8c.js → risk-Dopd25rc.js} +1 -1
  92. package/dist/assets/{security-page-DN5BI6Ag.js → security-page-BYI7twYM.js} +1 -1
  93. package/dist/assets/select-assistant-screen-Br-PNDO1.js +1 -0
  94. package/dist/assets/{settings-layout-BNwCqvBi.js → settings-layout-lddMUg7A.js} +1 -1
  95. package/dist/assets/share-feedback-modal-DSwfhMsV.js +1 -0
  96. package/dist/assets/{sidebar-tree-Bh-tcSsp.js → sidebar-tree-C1_LiBB9.js} +1 -1
  97. package/dist/assets/{signup-page-D6cMhBxv.js → signup-page-D6hAK-Us.js} +1 -1
  98. package/dist/assets/{signup-shell-D4Afeijm.js → signup-shell-DufHA5do.js} +1 -1
  99. package/dist/assets/{site-favicon-DSzk4cg0.js → site-favicon-fQHLTT6F.js} +1 -1
  100. package/dist/assets/{skill-detail-page-Jisds_Gs.js → skill-detail-page-BlfgTyFC.js} +1 -1
  101. package/dist/assets/{skill-detail-panel-BEJqfJig.js → skill-detail-panel-BGoRUWNU.js} +1 -1
  102. package/dist/assets/{skills-CSlvOB79.js → skills-AtSQBwXr.js} +1 -1
  103. package/dist/assets/{skills-page-Cs1EG4X5.js → skills-page-DeIiyhVc.js} +1 -1
  104. package/dist/assets/{sounds-page-ChFJ0OPm.js → sounds-page-BgLLJ-o9.js} +1 -1
  105. package/dist/assets/{src-B2IjVySQ.js → src-zsLiFPw3.js} +1 -1
  106. package/dist/assets/{subagent-detail-panel-ACj_B6Id.js → subagent-detail-panel-BGuVa8-m.js} +1 -1
  107. package/dist/assets/{system-events-page-JhzC5xhW.js → system-events-page-C1hXOYmg.js} +1 -1
  108. package/dist/assets/{tiptap-document-editor-DSny-IjF.js → tiptap-document-editor-C-eOEBR_.js} +1 -1
  109. package/dist/assets/tool-detail-panel-wAuQ7gi8.js +2 -0
  110. package/dist/assets/{upgrade-cancel-page-D_YziHQs.js → upgrade-cancel-page-BGgPmDmT.js} +1 -1
  111. package/dist/assets/{upgrade-success-page-Cg7IIDei.js → upgrade-success-page-TJBopZ0Z.js} +1 -1
  112. package/dist/assets/{usage-page-DB3LFuYw.js → usage-page-DLWFk2P0.js} +1 -1
  113. package/dist/assets/use-edge-swipe-back-B4XlZ1Iu.js +1 -0
  114. package/dist/assets/use-invite-link-dialog-BdnW1BHj.js +1 -0
  115. package/dist/assets/use-is-org-ready-jhEM-4rY.js +1 -0
  116. package/dist/assets/{use-onboarding-login-Bo_t51AV.js → use-onboarding-login-B-1jrjFL.js} +1 -1
  117. package/dist/assets/{use-reduced-motion-CcGT6CHV.js → use-reduced-motion-Cj0Z8KSf.js} +1 -1
  118. package/dist/assets/{use-skill-actions-e6TfdF23.js → use-skill-actions-BpVxiQZY.js} +1 -1
  119. package/dist/assets/{use-skill-categories-i_9x26zg.js → use-skill-categories-CCxtjMC_.js} +1 -1
  120. package/dist/assets/{use-skill-detail-files-Cu4nrHPA.js → use-skill-detail-files-Dpp521cY.js} +1 -1
  121. package/dist/assets/{voice-page-wTcwV9j9.js → voice-page-BoCTB8Jx.js} +1 -1
  122. package/dist/assets/{weather-forecast-display-C_3DSHxa.js → weather-forecast-display-Bix8rpji.js} +1 -1
  123. package/dist/assets/{web-DlbBHOna.js → web-C1L-cpPj.js} +1 -1
  124. package/dist/assets/{web-BpBQ3Cf2.js → web-RhBklijR.js} +1 -1
  125. package/dist/assets/{welcome-screen-BF3r_rfT.js → welcome-screen-CVI4Hjnt.js} +1 -1
  126. package/dist/assets/{workflow-detail-panel-DzvDXyoD.js → workflow-detail-panel-CwZH3tDl.js} +1 -1
  127. package/dist/assets/workspace-page-CwIsXk1j.js +1 -0
  128. package/dist/index.html +28 -27
  129. package/package.json +1 -1
  130. package/dist/assets/channels-page-route-6cT6U3pZ.js +0 -9
  131. package/dist/assets/chat-markdown-message-CItp7csw.js +0 -2
  132. package/dist/assets/community-page-BVJxxP10.js +0 -1
  133. package/dist/assets/contacts-page-route-WXG6_xo2.js +0 -1
  134. package/dist/assets/debug-page-C-HWHD-3.js +0 -4
  135. package/dist/assets/esm-DsIXwGm7.js +0 -2
  136. package/dist/assets/hatching-screen-C0MNyetb.js +0 -1
  137. package/dist/assets/home-page-route-X4KYSdMI.js +0 -1
  138. package/dist/assets/identity-page-route-D5xzlpim.js +0 -1
  139. package/dist/assets/plugins-page-Cv0FXn1j.js +0 -1
  140. package/dist/assets/select-assistant-screen-B63mlflD.js +0 -1
  141. package/dist/assets/share-feedback-modal-BloP-1QE.js +0 -1
  142. package/dist/assets/tool-detail-panel-z5iYNIYq.js +0 -2
  143. package/dist/assets/use-edge-swipe-back-AcKDuMrX.js +0 -1
  144. package/dist/assets/use-invite-link-dialog-CExxDwnZ.js +0 -1
  145. package/dist/assets/use-is-org-ready-BtwH2--_.js +0 -1
  146. package/dist/assets/workspace-page-DCcsRyQz.js +0 -1
  147. /package/dist/assets/{a2a-invite-BriFFHnO.js → a2a-invite-B9cylfIO.js} +0 -0
  148. /package/dist/assets/{app-info-LSjlWG3w.js → app-info-Clwt3pCt.js} +0 -0
  149. /package/dist/assets/{build.umd-wlq6sZjw.js → build.umd-CxdKgGWo.js} +0 -0
  150. /package/dist/assets/{contacts-gateway-CNqVHBQ3.js → contacts-gateway-CW5CipBv.js} +0 -0
  151. /package/dist/assets/{credential-entry-page-jJzKVnQk.js → credential-entry-page-9H2HOu88.js} +0 -0
  152. /package/dist/assets/{danger-zone-redirect-page-DL5S8CAN.js → danger-zone-redirect-page-BWg7rn8D.js} +0 -0
  153. /package/dist/assets/{definitions-alqf_FBK.js → definitions-CaYcW4Yq.js} +0 -0
  154. /package/dist/assets/{definitions-B1DK4OsQ.js → definitions-DScTW2c-.js} +0 -0
  155. /package/dist/assets/{emoji-catalog-data-D_xqkMQV.js → emoji-catalog-data-D8lRMt3A.js} +0 -0
  156. /package/dist/assets/{environment-store-fb1I8_0E.js → environment-store-C0f32873.js} +0 -0
  157. /package/dist/assets/{esm-DwTCNETa.js → esm-B54gzHCZ.js} +0 -0
  158. /package/dist/assets/{file-editor-BbrbkQCm.js → file-editor-sT7eHxsw.js} +0 -0
  159. /package/dist/assets/{format-date-BczUbfC1.js → format-date-CghpPTDc.js} +0 -0
  160. /package/dist/assets/{format-file-size-D7iZejgy.js → format-file-size-DzVEncaw.js} +0 -0
  161. /package/dist/assets/{llm-dimension-Bu_nHMF_.js → llm-dimension-DyYwG3mU.js} +0 -0
  162. /package/dist/assets/{mutation-error-CrhKyTkx.js → mutation-error-DYv0eJ_i.js} +0 -0
  163. /package/dist/assets/{onboarding-step-layout-zvLUIT7j.js → onboarding-step-layout-2XcmxqFN.js} +0 -0
  164. /package/dist/assets/{optimistic-lifecycle-DTggtDfs.js → optimistic-lifecycle-BvfDBY8o.js} +0 -0
  165. /package/dist/assets/{password-reset-page-DVIt7mWy.js → password-reset-page-BCk9Si73.js} +0 -0
  166. /package/dist/assets/{pdf-CuY9CA7Q.js → pdf-C3Qukw-J.js} +0 -0
  167. /package/dist/assets/{plugins-surface-C7NU-_rg.js → plugins-surface-z3RTZS4H.js} +0 -0
  168. /package/dist/assets/{prechat-names-b5RkG_F-.js → prechat-names-clVy5Mee.js} +0 -0
  169. /package/dist/assets/{provider-key-DBiHV_K5.js → provider-key-3AHnKoz9.js} +0 -0
  170. /package/dist/assets/{proxy-BzlH_XAe.js → proxy-o6cPThl2.js} +0 -0
  171. /package/dist/assets/{public-asset-Di3QykUd.js → public-asset-GKv5zCfZ.js} +0 -0
  172. /package/dist/assets/{schedules-Dj3YQqG5.js → schedules-BfKi12EZ.js} +0 -0
  173. /package/dist/assets/{setting-row-QKgqbQ4U.js → setting-row-CUka7_L9.js} +0 -0
  174. /package/dist/assets/{skill-icon-CEEEqpSq.js → skill-icon-cNkD2w1X.js} +0 -0
  175. /package/dist/assets/{status-badge-pill-BopXdkRS.js → status-badge-pill-0N6rTEBg.js} +0 -0
  176. /package/dist/assets/{step-indicator-dots-Cou0-IgA.js → step-indicator-dots-D03TmFKG.js} +0 -0
  177. /package/dist/assets/{system-events-redirect-page-D5EfWOEK.js → system-events-redirect-page-DbaFKRXH.js} +0 -0
  178. /package/dist/assets/{three-dot-indicator-BVtP8eei.js → three-dot-indicator-DNuHHwtA.js} +0 -0
  179. /package/dist/assets/{usage-window-Btqj3Jpn.js → usage-window-C6gWu5Qu.js} +0 -0
  180. /package/dist/assets/{use-active-assistant-id-BNRMo_Mi.js → use-active-assistant-id-BWXi63qg.js} +0 -0
  181. /package/dist/assets/{use-copy-to-clipboard-tXJpCn2M.js → use-copy-to-clipboard-BCTXSMa-.js} +0 -0
  182. /package/dist/assets/{web-CsaTwTXy.js → web-BD2N6zhd.js} +0 -0
  183. /package/dist/assets/{web-Xex3K4gk.js → web-BaubW4Pp.js} +0 -0
  184. /package/dist/assets/{web-U-rR-rZR.js → web-CJiP8Lg6.js} +0 -0
  185. /package/dist/assets/{web-D5_lKOWn.js → web-D8PpvYf_.js} +0 -0
  186. /package/dist/assets/{web-B9ZvD-Tt.js → web-Duw5A2aP.js} +0 -0
  187. /package/dist/assets/{web-Bi2V5gD3.js → web-O1LOb-o9.js} +0 -0
  188. /package/dist/assets/{xterm-D9pOJCAq.js → xterm-CBmd_y-b.js} +0 -0
  189. /package/dist/assets/{xterm-addon-fit-BTV6oL76.js → xterm-addon-fit-THPW0uy0.js} +0 -0
@@ -1,3 +1,3 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{r as t,s as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./createLucideIcon-IRfcSUxS.js";import{n as a,t as o}from"./create-selectors-8NePGNlX.js";import{n as s}from"./typed-storage-5IU6qVWg.js";import{a as c}from"./diagnostics-COsnZMe5.js";import{l}from"./chat-markdown-message-CItp7csw.js";import{t as u}from"./conversation-store-BljZWolF.js";import{c as ee,d as te}from"./messages-Bl6a3LUN.js";import{b as d,n as f,t as ne,v as re,w as p,x as ie}from"./chat-B8mgARYR.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 Ce={phase:`idle`,pendingQueuedCount:0,activeToolCallCount:0,activeTurnId:null,lastTerminalReason:null,statusText:null,liveWebActivity:{}};function we(e){return e===`queued`||e===`thinking`||e===`streaming`||e===`awaiting_user_input`}function Te(e){return e===`thinking`}function _(e){return(e.phase===`idle`||e.phase===`errored`)&&!e.activeTurnId}var Ee=o(a()((e,t)=>({...Ce,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();_(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();_(i)||e({liveWebActivity:{...i.liveWebActivity,[n]:r}})},onActivityThinking:n=>{let r=t();_(r)||r.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},showSurface:n=>{_(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:()=>{_(t())||e({phase:`awaiting_user_input`})},onConfirmationRequest:()=>{_(t())||e({phase:`awaiting_user_input`})},onQuestionRequest:()=>{_(t())||e({phase:`awaiting_user_input`})},onContactRequest:()=>{_(t())||e({phase:`awaiting_user_input`})},completeTurn:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},handoffGeneration:()=>{_(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||we(r.phase)&&e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},resetTurn:()=>e({...Ce}),enqueueMessage:()=>e(e=>({pendingQueuedCount:e.pendingQueuedCount+1})),dequeueMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(_(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})}}))),De=3670016,Oe=[.85,.75,.65,.5],ke=2e7,Ae=new Set([`image/jpeg`,`image/jpg`,`image/png`,`image/webp`,`image/heic`,`image/heif`,`image/bmp`,`image/tiff`]),je=new Set([`jpg`,`jpeg`,`png`,`webp`,`heic`,`heif`,`bmp`,`tif`,`tiff`]);function v(e){let t=e.type.trim().toLowerCase();if(Ae.has(t))return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n?je.has(n):!1}function Me(e){return v(e)&&e.size>3670016}function Ne(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 Pe(e){return Me(e)||Ne(e)}function Fe(e){let t=`attachment`,n=e.trim()||t;return/\.(?:jpe?g)$/i.test(n)?n:`${n.replace(/\.[^./\\]+$/,``)||t}.jpg`}async function Ie(e){if(!Pe(e)||await Re(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 Le(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await Be(t,e.size)}catch{n=null}return!n||!Ne(e)&&n.size>=e.size?{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}:{status:`resized`,file:new File([n],Fe(e.name),{type:`image/jpeg`,lastModified:e.lastModified})}}finally{t.close()}}async function Le(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 Re(e){if(!ze(e))return!1;let t;try{t=new Uint8Array(await e.slice(0,Math.min(e.size,1024*1024)).arrayBuffer())}catch{return!0}if(!b(t,0,`RIFF`)||!b(t,8,`WEBP`))return!1;let n=y(t,`VP8X`);return n>=0&&(t[n+8]??0)&2?!0:y(t,`ANIM`)>=0||y(t,`ANMF`)>=0}function ze(e){return e.type.trim().toLowerCase()===`image/webp`||/\.webp$/i.test(e.name)}function y(e,t){for(let n=0;n<=e.length-t.length;n+=1)if(b(e,n,t))return n;return-1}function b(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 Be(e,t){let n=e.width*e.height,r=null;if(n<=ke)for(let t of Oe){let n=await S(e.source,e.width,e.height,t);if(r=x(r,n),n&&n.size<=3670016)return n}let i=r?.size??t,a=Math.min(Math.sqrt(De/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 Oe){let a=await S(e.source,t,n,i);if(r=x(r,a),o=x(o,a),a&&a.size<=3670016)return a}i=o?.size??i,a*=Math.min(Math.sqrt(De/i*.9),.9)}return null}function x(e,t){return t&&(!e||t.size<e.size)?t:e}async function S(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 Ve=`vellum:chatDrafts:`;function He(e){return`${Ve}${e}`}function Ue(e){let n=t(He(e),``);if(!n)return new Map;try{let e=JSON.parse(n);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 C(e,t){n(He(e),JSON.stringify(Object.fromEntries(t)))}function We(){return`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ge(e){return v(e)?`100 MB`:`50 MB`}function Ke(e){return e.size<=52428800?!0:v(e)&&e.size<=104857600}function qe(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var w=new Map,T=null,E=new Map,D=new Set,Je=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()?w.set(e,t):w.delete(e),T&&C(T,w)},clearDraft:e=>{w.delete(e),T&&C(T,w)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?w.set(n,i):w.delete(n);let a=(r&&w.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),T&&C(T,w)},loadAssistantDrafts:(n,r)=>{if(T&&T!==n){let n=t().input;r&&(n.trim()?w.set(r,n):w.delete(r)),C(T,w),e({input:``,restoredDraftConversationId:null})}w=Ue(n),T=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=w.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)Ke(e)?a.push(e):i.push(e);let o=i[0];if(e(o?{attachmentLastError:i.length===1?`${o.name} is larger than ${Ge(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:We(),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 Ie(r);if(D.has(t.localId)){D.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){O(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){O(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(D.has(t.localId)){D.delete(t.localId);return}if(!o.ok){O(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,te=o.sizeBytes??a.size,d=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(D.has(t.localId)){D.delete(t.localId);return}e&&(d=e)}let f=null;try{f=URL.createObjectURL(d),E.set(t.localId,f)}catch{f=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:te,previewUrl:f,thumbnailUrl:null}:e)}))}catch{if(D.has(t.localId)){D.delete(t.localId);return}O(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:We(),path:t,filename:qe(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`&&D.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),Ye(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&D.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&D.add(t.localId);return{attachments:[],attachmentLastError:null}}),E.forEach(e=>URL.revokeObjectURL(e)),E.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function O(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 Ye(e){let t=E.get(e);t&&(URL.revokeObjectURL(t),E.delete(e))}function Xe(e){return e.reduce((e,t)=>t.kind===`uploading`?e+1:e,0)}function Ze(e){return e.filter(e=>e.kind===`uploaded`).map(e=>e.id)}function Qe(e){return e.filter(e=>e.kind===`path-reference`).map(e=>e.path)}var k=o(Je);function $e(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function et(e){let t=JSON.parse(e);return $e(t)?t:null}function A(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 tt(e,t){return e?.filter(e=>!(e.type===`surface`&&e.surface.surfaceId===t))}function nt(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=A(r,i)),i});return n?{...e,surfaces:i,contentBlocks:r}:e}function j(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=>$e(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=j(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`;function vt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):e?.code===pt}function yt(e){return e?.errorCategory?e.errorCategory.endsWith(_t):!1}function bt(e){return vt(e)?`managed_credits`:yt(e)?`provider_billing`:null}function M(e){return bt(e)!==null||e?.code===mt||e?.displayAs===`modal`}function xt(e){return!!e&&!M(e)}function St(e){return e?.code===ht}var Ct={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,unknownNudgeToolCallIds:new Set},N=o(a()((e,t)=>({...Ct,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}),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(Ct)})));function wt(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{r as t,s as n}from"./local-settings-lVNyIOJ_.js";import{t as r}from"./react-DJZBPgpf.js";import{t as i}from"./createLucideIcon-IRfcSUxS.js";import{n as a,t as o}from"./create-selectors-8NePGNlX.js";import{n as s}from"./typed-storage-5IU6qVWg.js";import{a as c}from"./diagnostics-COsnZMe5.js";import{l}from"./chat-markdown-message-BnX6bhgs.js";import{t as u}from"./conversation-store-BljZWolF.js";import{c as ee,d as te}from"./messages-Bl6a3LUN.js";import{b as d,n as f,t as ne,v as re,w as p,x as ie}from"./chat-B8mgARYR.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 Ce={phase:`idle`,pendingQueuedCount:0,activeToolCallCount:0,activeTurnId:null,lastTerminalReason:null,statusText:null,liveWebActivity:{}};function we(e){return e===`queued`||e===`thinking`||e===`streaming`||e===`awaiting_user_input`}function Te(e){return e===`thinking`}function _(e){return(e.phase===`idle`||e.phase===`errored`)&&!e.activeTurnId}var Ee=o(a()((e,t)=>({...Ce,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();_(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();_(i)||e({liveWebActivity:{...i.liveWebActivity,[n]:r}})},onActivityThinking:n=>{let r=t();_(r)||r.phase!==`awaiting_user_input`&&e({phase:`thinking`,statusText:n??null})},showSurface:n=>{_(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:()=>{_(t())||e({phase:`awaiting_user_input`})},onConfirmationRequest:()=>{_(t())||e({phase:`awaiting_user_input`})},onQuestionRequest:()=>{_(t())||e({phase:`awaiting_user_input`})},onContactRequest:()=>{_(t())||e({phase:`awaiting_user_input`})},completeTurn:()=>{e({phase:t().pendingQueuedCount>0?`queued`:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},handoffGeneration:()=>{_(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||we(r.phase)&&e({phase:`idle`,activeTurnId:null,activeToolCallCount:0,lastTerminalReason:`complete`,statusText:null,liveWebActivity:{}})},resetTurn:()=>e({...Ce}),enqueueMessage:()=>e(e=>({pendingQueuedCount:e.pendingQueuedCount+1})),dequeueMessage:()=>{let n=t(),r=Math.max(0,n.pendingQueuedCount-1);if(_(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})}}))),De=3670016,Oe=[.85,.75,.65,.5],ke=2e7,Ae=new Set([`image/jpeg`,`image/jpg`,`image/png`,`image/webp`,`image/heic`,`image/heif`,`image/bmp`,`image/tiff`]),je=new Set([`jpg`,`jpeg`,`png`,`webp`,`heic`,`heif`,`bmp`,`tif`,`tiff`]);function v(e){let t=e.type.trim().toLowerCase();if(Ae.has(t))return!0;let n=e.name.split(`.`).pop()?.trim().toLowerCase();return n?je.has(n):!1}function Me(e){return v(e)&&e.size>3670016}function Ne(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 Pe(e){return Me(e)||Ne(e)}function Fe(e){let t=`attachment`,n=e.trim()||t;return/\.(?:jpe?g)$/i.test(n)?n:`${n.replace(/\.[^./\\]+$/,``)||t}.jpg`}async function Ie(e){if(!Pe(e)||await Re(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 Le(e)}catch{return{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}}try{let n;try{n=await Be(t,e.size)}catch{n=null}return!n||!Ne(e)&&n.size>=e.size?{status:`failed`,error:`Couldn't resize this image for upload. Try a smaller image.`}:{status:`resized`,file:new File([n],Fe(e.name),{type:`image/jpeg`,lastModified:e.lastModified})}}finally{t.close()}}async function Le(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 Re(e){if(!ze(e))return!1;let t;try{t=new Uint8Array(await e.slice(0,Math.min(e.size,1024*1024)).arrayBuffer())}catch{return!0}if(!b(t,0,`RIFF`)||!b(t,8,`WEBP`))return!1;let n=y(t,`VP8X`);return n>=0&&(t[n+8]??0)&2?!0:y(t,`ANIM`)>=0||y(t,`ANMF`)>=0}function ze(e){return e.type.trim().toLowerCase()===`image/webp`||/\.webp$/i.test(e.name)}function y(e,t){for(let n=0;n<=e.length-t.length;n+=1)if(b(e,n,t))return n;return-1}function b(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 Be(e,t){let n=e.width*e.height,r=null;if(n<=ke)for(let t of Oe){let n=await S(e.source,e.width,e.height,t);if(r=x(r,n),n&&n.size<=3670016)return n}let i=r?.size??t,a=Math.min(Math.sqrt(De/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 Oe){let a=await S(e.source,t,n,i);if(r=x(r,a),o=x(o,a),a&&a.size<=3670016)return a}i=o?.size??i,a*=Math.min(Math.sqrt(De/i*.9),.9)}return null}function x(e,t){return t&&(!e||t.size<e.size)?t:e}async function S(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 Ve=`vellum:chatDrafts:`;function He(e){return`${Ve}${e}`}function Ue(e){let n=t(He(e),``);if(!n)return new Map;try{let e=JSON.parse(n);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 C(e,t){n(He(e),JSON.stringify(Object.fromEntries(t)))}function We(){return`att-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,8)}`}function Ge(e){return v(e)?`100 MB`:`50 MB`}function Ke(e){return e.size<=52428800?!0:v(e)&&e.size<=104857600}function qe(e){let t=e.replace(/[/\\]+$/,``),n=Math.max(t.lastIndexOf(`/`),t.lastIndexOf(`\\`));return n===-1?t:t.slice(n+1)}var w=new Map,T=null,E=new Map,D=new Set,Je=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()?w.set(e,t):w.delete(e),T&&C(T,w)},clearDraft:e=>{w.delete(e),T&&C(T,w)},handleConversationSwitch:({previousKey:n,nextKey:r})=>{if(!(n!==null&&n!==r)||!n)return;let i=t().input;i.trim()?w.set(n,i):w.delete(n);let a=(r&&w.get(r))??``;e({input:a,restoredDraftConversationId:a.length>0&&r?r:null}),T&&C(T,w)},loadAssistantDrafts:(n,r)=>{if(T&&T!==n){let n=t().input;r&&(n.trim()?w.set(r,n):w.delete(r)),C(T,w),e({input:``,restoredDraftConversationId:null})}w=Ue(n),T=n},clearRestoredDraftNotice:()=>{e({restoredDraftConversationId:null})},restoreDraftIfEmpty:n=>{let r=w.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)Ke(e)?a.push(e):i.push(e);let o=i[0];if(e(o?{attachmentLastError:i.length===1?`${o.name} is larger than ${Ge(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:We(),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 Ie(r);if(D.has(t.localId)){D.delete(t.localId);return}if(i.status===`failed`&&r.size>52428800){O(e,t.localId,i.error);return}let a=i.status===`failed`?r:i.file;if(a.size>52428800){O(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(D.has(t.localId)){D.delete(t.localId);return}if(!o.ok){O(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,te=o.sizeBytes??a.size,d=a;if(u.startsWith(`image/`)&&u!==s){let e=await l(n,o.id);if(D.has(t.localId)){D.delete(t.localId);return}e&&(d=e)}let f=null;try{f=URL.createObjectURL(d),E.set(t.localId,f)}catch{f=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:te,previewUrl:f,thumbnailUrl:null}:e)}))}catch{if(D.has(t.localId)){D.delete(t.localId);return}O(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:We(),path:t,filename:qe(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`&&D.add(t),{attachments:e.attachments.filter(e=>e.localId!==t)}}),Ye(t)},resetAttachments:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&D.add(t.localId);return{attachments:[],attachmentLastError:null}})},fullReset:()=>{e(e=>{for(let t of e.attachments)t.kind===`uploading`&&D.add(t.localId);return{attachments:[],attachmentLastError:null}}),E.forEach(e=>URL.revokeObjectURL(e)),E.clear()},dismissAttachmentError:()=>{e({attachmentLastError:null})}}));function O(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 Ye(e){let t=E.get(e);t&&(URL.revokeObjectURL(t),E.delete(e))}function Xe(e){return e.reduce((e,t)=>t.kind===`uploading`?e+1:e,0)}function Ze(e){return e.filter(e=>e.kind===`uploaded`).map(e=>e.id)}function Qe(e){return e.filter(e=>e.kind===`path-reference`).map(e=>e.path)}var k=o(Je);function $e(e){return Array.isArray(e)&&e.every(e=>typeof e==`string`)}function et(e){let t=JSON.parse(e);return $e(t)?t:null}function A(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 tt(e,t){return e?.filter(e=>!(e.type===`surface`&&e.surface.surfaceId===t))}function nt(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=A(r,i)),i});return n?{...e,surfaces:i,contentBlocks:r}:e}function j(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=>$e(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=j(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`;function vt(e){return e?.errorCategory?e.errorCategory.endsWith(gt):e?.code===pt}function yt(e){return e?.errorCategory?e.errorCategory.endsWith(_t):!1}function bt(e){return vt(e)?`managed_credits`:yt(e)?`provider_billing`:null}function M(e){return bt(e)!==null||e?.code===mt||e?.displayAs===`modal`}function xt(e){return!!e&&!M(e)}function St(e){return e?.code===ht}var Ct={pendingSecret:null,isSubmittingSecret:!1,secretSaved:!1,pendingConfirmation:null,isSubmittingConfirmation:!1,pendingContactRequest:null,isSubmittingContactRequest:!1,contactRequestAccepted:!1,pendingQuestion:null,isSubmittingQuestion:!1,isQuestionCardDismissed:!1,inlineConfirmationToolCallId:null,unknownNudgeToolCallIds:new Set},N=o(a()((e,t)=>({...Ct,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}),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(Ct)})));function wt(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 P(e){let t=[];for(let n of e?.contentBlocks??[])n.type===`text`&&t.push(n.text);return wt(t)}function Tt(e){if(!(!e||e.length===0))return e.map(e=>{let{previewUrl:t,thumbnailUrl:n}=te(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 F(e){let t=e[e.length-1];return!!t&&t.role===`assistant`}function Et(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 I(e,t){return e.findIndex(e=>e.role===`assistant`&&(e.id===t||!!e.mergedMessageIds?.includes(t)))}function L(e,t){if(!t||e.id===t)return e;let n=e.mergedMessageIds??[];return n.includes(t)?e:{...e,mergedMessageIds:[...n,t]}}function R(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 Dt(e,t,n){return e.map(e=>e.id===t?{...e,queuePosition:n}:e)}function Ot(e,t){return e.map(e=>e.id===t?{...e,queueStatus:void 0,queuePosition:void 0}:e)}function kt(e,t){return e.filter(e=>e.id!==t)}function At(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 jt(e,t,n){n&&e[e.length-1]?.type===t.type?e[e.length-1]=t:e.push(t)}function z(e,t,n,r){let i=L(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)),jt(s,{type:`text`,text:a[a.length-1]},c);let l=[...e];return l[t]={...i,textSegments:a,contentOrder:o,contentBlocks:s},l}function B(e,t,n,r){let i=L(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)),jt(s,{type:`thinking`,thinking:a[a.length-1]},c);let l=[...e];return l[t]={...i,thinkingSegments:a,contentOrder:o,contentBlocks:s},l}function Mt(e,t,n,r,i=Date.now()){if(n){let a=I(e,n);if(a>=0)return z(e,a,t,n);if(F(e))return z(e,e.length-1,t,n);let o=r?.();return o?z([...e,o],e.length,t,n):At(e,t,n,i)}return F(e)?z(e,e.length-1,t,void 0):At(e,t,n,i)}function Nt(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 Pt(e,t,n,r,i=Date.now()){if(n){let a=I(e,n);if(a>=0)return B(e,a,t,n);if(F(e))return B(e,e.length-1,t,n);let o=r?.();return o?B([...e,o],e.length,t,n):Nt(e,t,n,i)}return F(e)?B(e,e.length-1,t,void 0):Nt(e,t,n,i)}function Ft(e,t=Date.now()){let n=!1,r=e.map(e=>{if(e.role!==`assistant`)return e;let r=R(e,t);return r?(n=!0,{...e,...r}):e});return n?r:e}function It(e,t,n=Date.now()){let r=e[e.length-1],i=Tt(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=R(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 Lt(e,t){if(t!==void 0)return e.findIndex(e=>e.role===`user`&&e.clientMessageId===t);for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.role===`user`&&n.isOptimistic===!0)return t}return-1}function Rt(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=Lt(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 zt(e,t=Date.now()){let n=e.length-1,r=e[n];if(!r||r.role!==`assistant`)return e;let i=R(r,t);if(!(P(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 V(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 H(e,t,n,r){let i=L(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:V(i.contentBlocks,r)},o}return o[t]={...i,toolCalls:[...i.toolCalls??[],n],contentOrder:[...i.contentOrder??[],{type:`toolCall`,id:n.id}],contentBlocks:V(i.contentBlocks,n)},o}function Bt(e,t,n,r=Date.now()){if(n){let r=I(e,n);if(r>=0)return H(e,r,t,n);if(F(e))return H(e,e.length-1,t,n)}else if(F(e))return H(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 Vt(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},completedAt:t.completedAt??Date.now(),streamedOutput:void 0};c[r]=l;let u=[...e];return u[n]={...i,toolCalls:c,contentBlocks:V(i.contentBlocks,l)},u}var Ht=16384;function Ut(e){return e.length<=16384?e:e.slice(e.length-Ht)}function Wt(e,t){if(!t.chunk)return e;let n=-1,r=-1;if(t.toolUseId){if(t.messageId){let i=I(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:Ut((a.streamedOutput??``)+t.chunk)},s=[...i.toolCalls];s[r]=o;let c=[...e];return c[n]={...i,toolCalls:s,contentBlocks:V(i.contentBlocks,o)},c}function Gt(e,t,n,r=Date.now()){let i=-1;if(n&&(i=I(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=L(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:A(r.contentBlocks,t)}}return a}function Kt(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:A(i.contentBlocks,c)},l}return e}function qt(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:tt(e[n].contentBlocks,t)},r}return e}function Jt(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:A(e[r].contentBlocks,a)},o}return e}var Yt=[`choice`,`oauth_connect`,`form`,`confirmation`,`file_upload`,`card`,`list`,`table`,`browser_view`,`task_preferences`];function Xt(e){return e==null||e.hasPendingConfirmation||e.hasUncompletedVisibleSurface}function Zt(e,t){let n=!1,r=e.map(e=>{let r=re(e,e=>e.pendingConfirmation?.requestId===t?{...e,pendingConfirmation:void 0}:e);return r!==e&&(n=!0),r});return n?r:e}function Qt(e){let t=!1,n=e.map(e=>{let n=re(e,e=>e.pendingConfirmation?{...e,pendingConfirmation:void 0}:e);return n!==e&&(t=!0),n});return t?n:e}function $t(e,t){let n=new Set;for(let e of t)if(e.surfaces)for(let t of e.surfaces)ie(t)&&n.add(t.surfaceId);return n.size===0?{updatedMessages:e,dismissedIds:n}:{updatedMessages:e.map(e=>j(e,e=>!n.has(e.surfaceId))),dismissedIds:n}}function en(e,t,n,r){for(let i=e.length-1;i>=0;i--){let a=e[i].surfaces?.find(e=>e.surfaceId===t);if(!a)continue;if(!Yt.includes(a.surfaceType))return e;let o=a.actions?.find(e=>e.id===n),s=n===`cancel`||n===`dismiss`||o?.style===`secondary`,c=[...e];return c[i]=nt(e[i],e=>e.surfaceId===t?{...e,completed:!0,completionSummary:s?`Cancelled`:r??o?.label??void 0}:e),c}return e}function tn(e,t,n){return e&&ne[e]||t||n}function U(e){return typeof e==`string`?e:void 0}function nn(e){return typeof e==`boolean`?e:void 0}function rn(e){return Array.isArray(e)?e:void 0}function an(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:void 0}function W(e){return Array.isArray(e)?e:void 0}function on(e){return{requestId:typeof e.requestId==`string`?e.requestId:``,label:U(e.label),service:U(e.service),field:U(e.field),description:U(e.description),placeholder:U(e.placeholder),allowOneTimeSend:nn(e.allowOneTimeSend),allowedTools:rn(e.allowedTools),allowedDomains:rn(e.allowedDomains),purpose:U(e.purpose)}}function sn(e){let t={requestId:typeof e.requestId==`string`?e.requestId:``,title:U(e.title),description:U(e.description),toolName:U(e.toolName),riskLevel:U(e.riskLevel),riskReason:U(e.riskReason),allowlistOptions:W(e.allowlistOptions),scopeOptions:W(e.scopeOptions),directoryScopeOptions:W(e.directoryScopeOptions),persistentDecisionsAllowed:nn(e.persistentDecisionsAllowed),input:an(e.input),toolUseId:U(e.toolUseId)};return{confData:t,state:{...t,confirmLabel:U(e.confirmLabel),denyLabel:U(e.denyLabel)}}}function cn(){return`turn-${Date.now()}-${Math.random().toString(36).slice(2,8)}`}function ln(e,t){let n=Date.parse(e);return Number.isFinite(n)?n:typeof t==`number`?t:0}function un(e,t,n){switch(t.type){case`assistant_text_delta`:return Mt(e,t.text,t.messageId,void 0,n);case`assistant_thinking_delta`:return Pt(e,t.thinking,t.messageId,void 0,n);case`message_complete`:return It(e,t,n);case`user_message_echo`:return Rt(e,{text:t.text,messageId:t.messageId,clientMessageId:t.clientMessageId},n);case`assistant_activity_state`:return t.phase===`idle`?Ft(e,n):e;case`conversation_error`:return zt(e,n);case`tool_use_preview_start`:return Bt(e,{id:t.toolUseId,name:t.toolName,input:{},previewStartedAt:typeof t.previewStartedAt==`number`?t.previewStartedAt:n},t.messageId,n);case`tool_use_start`:return Bt(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 Vt(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,completedAt:`completedAt`in t&&typeof t.completedAt==`number`?t.completedAt:n});case`tool_output_chunk`:return t.chunk?Wt(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=d(r),Gt(e,r,t.messageId,n)}case`ui_surface_update`:return Kt(e,t.surfaceId,t.data);case`ui_surface_dismiss`:return qt(e,t.surfaceId);case`ui_surface_complete`:return Jt(e,t.surfaceId,t.summary);case`confirmation_request`:return f(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`?Zt(e,t.requestId):e;default:return e}}function dn(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 fn(e,t){let{seq:n}=t;if(typeof n==`number`&&typeof e.seq==`number`&&n<=e.seq)return e;let r=ln(t.emittedAt,n),i=un(e.messages,t.message,r),a=typeof n==`number`?Math.max(e.seq??-1,n):e.seq??null,o=dn(e.processing,t.message,n);return{...e,messages:i,seq:a,processing:o}}function pn(e,t){return t.reduce(fn,e)}function mn(e,t){return t===null?e:pn(e,t)}function hn(e){return[...new Set([e.id,...e.mergedMessageIds??[]].filter(e=>typeof e==`string`&&e.length>0))]}function G(e){let t=hn(e);return e.clientMessageId&&!t.includes(e.clientMessageId)?[...t,e.clientMessageId]:t}var gn={hasMore:!1,oldestTimestamp:null,isLoadingOlder:!1};function _n(){return{snapshot:null,optimisticSends:[],error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...gn},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 K(e,t){return typeof t==`function`?t(e):t}function vn(e,t){if(e.length===0)return e;let n=new Map;for(let e of t)for(let t of G(e))n.has(t)||n.set(t,e);let r=e.filter(e=>{let t;for(let r of G(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 q=o(a()((e,t)=>({..._n(),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=mn(r,a);e(e=>({snapshot:o,optimisticSends:vn(e.optimisticSends,o.messages)}))},applyEnvelopeToSnapshot:t=>e(e=>e.snapshot?{snapshot:fn(e.snapshot,t)}:{}),addOptimisticSend:t=>e(e=>({optimisticSends:[...e.optimisticSends,t]})),setOptimisticSends:t=>e(e=>({optimisticSends:K(e.optimisticSends,t)})),patchSnapshotMessages:t=>e(e=>e.snapshot?{snapshot:{...e.snapshot,messages:t(e.snapshot.messages)}}:{}),setError:t=>e(e=>({error:K(e.error,t)})),setNotice:t=>e(e=>({notice:K(e.notice,t)})),setIsLoadingHistory:t=>e({isLoadingHistory:t}),setTranscriptPagination:t=>e(e=>({transcriptPagination:K(e.transcriptPagination,t)})),setContextWindowUsage:t=>e(e=>({contextWindowUsage:K(e.contextWindowUsage,t)})),setCompactionCircuitOpenUntil:t=>e(e=>({compactionCircuitOpenUntil:K(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=N.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}),k.getState().handleConversationSwitch({previousKey:a??null,nextKey:r}),Ee.getState().resetTurn(),N.getState().resetAll(),o?k.getState().fullReset():k.getState().resetAttachments();let l=s?dt(n):i.contextWindowUsageByConversation;e({snapshot:null,optimisticSends:[],ephemeralMetaResults:[],error:M(i.error)?i.error:null,notice:null,isLoadingHistory:!0,transcriptPagination:{...gn},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},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 J(e,t){if(t.length===0)return e;let n=new Map;for(let e of t)for(let t of G(e))n.has(t)||n.set(t,e);let r=[],i=new Set;for(let t of e){let e;for(let r of G(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 yn(){let e=q.use.snapshot(),t=q.use.optimisticSends(),n=q.use.dismissedSurfaceIds();return(0,le.useMemo)(()=>J(ct(e?.messages,n),t),[e,t,n])}function Y(e,t,n=`…`){return e.length<=t?e:e.slice(0,t-n.length)+n}function bn(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 xn(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:xn(t)}function Sn(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 Cn(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 wn(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 Tn(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 En(e,t=``){let n=e.toLowerCase(),r=t.replace(/\s+/g,` `).trim(),i=bn(r),a=Z(e,r);if(a)return Sn(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 Dn(e,t=``,n){let r=Z(e,t);if(r)return Cn(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 On(e){return e.split(/[_-]+/).filter(e=>e.length>0).map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `)}function kn(e,t=``){let n=Z(e,t);if(n)return wn(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 An=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 jn(e){if(!e)return``;let t=e.replace(/\/+$/,``),n=t.lastIndexOf(`/`);return n===-1?t:t.slice(n+1)}function Mn(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=Mn(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(),An),activity:i,iconName:`terminal`};case`str_replace_editor`:case`text_editor`:{let e=Q(n,`command`).toLowerCase(),t=jn(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 ${On(e)}`:`Running tool`,info:``,activity:i,iconName:`bolt`}}}function Nn(e){return $(e.name,e.input)}var Pn=[{open:`<thinking>`,close:`</thinking>`},{open:`<think>`,close:`</think>`}];function Fn(e){return Pn.some(t=>e.includes(t.open))}function In(e){if(!Fn(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 Pn){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 Ln(e){return typeof e.id==`string`&&e.id.length>0}function Rn(e){return e.some(e=>e.type===`text`&&Fn(e.text))?e.flatMap(e=>{let t=e.type===`text`?In(e.text):null;return t?t.map(e=>e.type===`thinking`?{type:`thinking`,thinking:e.thinking}:{type:`text`,text:e.text}):[e]}):e}function zn(e,t){let n=t?.splitInlineThinking?Rn(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(!Ln(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 Bn(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;Vn(e)||(n.push(e),t.push({kind:`toolCall`,toolCall:e}))}return{cardItems:t,toolCalls:n}}function Vn(e){return!e.pendingConfirmation&&(e.name===`ui_show`||e.name===`ui_update`||e.name===`ui_dismiss`)}function Hn(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 Un(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 Wn(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 Gn(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 Kn=new Set([`low`,`medium`,`high`]);function qn(e){let t=e?.toLowerCase();return t&&Kn.has(t)?t:`medium`}function Jn(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 Yn(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 Xn(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 Zn={unknown:2,low:0,medium:1,high:2},Qn={none:-1,low:0,medium:1,high:2};function $n(e,t,n){return e?.toLowerCase()!==`auto`||!n?!0:(Zn[(t??``).toLowerCase()]??-1)<=(Qn[n.toLowerCase()]??-1)}function er(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 tr(e,t){return e===`sandbox_auto_approve`?{displayLevel:`workspace`,inherentRisk:t}:{displayLevel:t??`unknown`}}export{Ze as $,$t as A,F as B,J as C,Zt as D,G as E,Xt as F,xt as G,N as H,Ot as I,ot as J,M as K,Et as L,sn as M,on as N,Qt as O,tn as P,Qe as Q,kt as R,yn as S,hn as T,bt as U,P as V,St as W,nt as X,j as Y,et as Z,Dn as _,Yn as a,xe as at,On as b,Bn as c,_e as ct,Gn as d,me as dt,Xe as et,Un as f,fe as ft,Tn as g,ae as gt,$ as h,oe as ht,Xn as i,Ee as it,cn as j,en as k,zn as l,pe as lt,Nn as m,se as mt,er as n,we as nt,qn as o,ve as ot,Hn as p,ce as pt,ft as q,Jn as r,Te as rt,$n as s,ye as st,tr as t,k as tt,Wn as u,he as ut,kn as v,q as w,Y as x,En as y,Dt as z};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./copy-Cn1FKrEp.js";import{t as c}from"./loader-circle-Cz7opInR.js";import{t as l}from"./notice-DkcNAP8O.js";import{t as u}from"./input-CoUmPnRU.js";import{t as d}from"./modal-D5nLWNN9.js";import{n as f}from"./toast-xTp-xwYL.js";import{t as p}from"./confirm-dialog-CSkhRFRk.js";import{Pt as m}from"./sdk.gen-CmKfVpgB.js";import{c as h}from"./routes-BbeIx_F9.js";import{t as g}from"./client-feature-flag-store-C0g8zi1W.js";import{At as _,Mt as v,Nt as y,jt as b,kt as x}from"./react-query.gen-DPzPS206.js";import{D as S,Ti as C,Wr as w}from"./index-CSefSVJO.js";import{t as T}from"./detail-card-RGTjHkZ8.js";var E=e(t(),1);function D(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}var O=o();function k({open:e,onOpenChange:t}){let r=i(),[a,o]=(0,E.useState)(null),[l,p]=(0,E.useState)(``),[h,g]=(0,E.useState)(null),_=(0,E.useRef)(!1),v=(0,E.useRef)(e),S=()=>r.invalidateQueries({queryKey:y()}),C=e=>{m({path:{id:e}}).catch(()=>void 0).finally(()=>void S())},w=x({onSuccess:e=>{if(!v.current){C(e.factor_id);return}o(e)},onError:e=>{let n=D(e);n===`no_workos_account`?f.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?f.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?f.error(`An authenticator app is already set up. Remove it before adding another.`):f.error(`Failed to start setup. Please try again.`),t(!1)}}),T=b({onSuccess:e=>{e.valid?(_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1)):g(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=D(e);if(n===`challenge_already_verified`){_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){a&&C(a.factor_id),o(null),p(``),g(`This setup session expired. Scan the new QR code and try again.`),w.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){g(`Too many attempts. Wait a minute and try again.`);return}g(`Couldn't verify the code. Wait a moment and try again.`)}});(0,E.useEffect)(()=>{v.current=e,e&&(_.current=!1,o(null),p(``),g(null),w.mutate({}))},[e]);let k=e=>{!e&&T.isPending||(!e&&a&&!_.current&&C(a.factor_id),t(e))},A=()=>{a&&navigator.clipboard.writeText(a.secret).then(()=>f.success(`Setup key copied.`)).catch(()=>f.error(`Couldn't copy the setup key.`))},j=()=>{!a||l.length!==6||T.isPending||(g(null),T.mutate({body:{challenge_id:a.challenge_id,code:l}}))};return(0,O.jsx)(d.Root,{open:e,onOpenChange:k,children:(0,O.jsxs)(d.Content,{size:`sm`,children:[(0,O.jsxs)(d.Header,{children:[(0,O.jsx)(d.Title,{children:`Set up authenticator app`}),(0,O.jsx)(d.Description,{children:`Scan the QR code with an authenticator app such as Google Authenticator or 1Password, then enter the 6-digit code it shows.`})]}),(0,O.jsx)(d.Body,{children:a===null?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,O.jsx)(c,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,O.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,O.jsx)(`img`,{src:a.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,O.jsxs)(`button`,{type:`button`,onClick:A,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,O.jsx)(`span`,{className:`break-all text-left`,children:a.secret}),(0,O.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,O.jsx)(u,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:l,onChange:e=>p(e.target.value.replace(/\D/g,``).slice(0,6))}),h&&(0,O.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:h})]})]})}),(0,O.jsxs)(d.Footer,{children:[(0,O.jsx)(n,{variant:`outlined`,onClick:()=>k(!1),disabled:T.isPending,children:`Cancel`}),(0,O.jsx)(n,{onClick:j,disabled:a===null||l.length!==6||T.isPending,children:T.isPending?`Verifying…`:`Verify`})]})]})})}function A(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function j(){let e=i(),[t,r]=(0,E.useState)(!1),[o,s]=(0,E.useState)(null),u=a({...v()}),d=u.data??[],m=()=>e.invalidateQueries({queryKey:y()}),h=_({onSuccess:()=>{f.success(`Authenticator app removed.`),m()},onError:e=>{if(D(e)===`factor_not_found`){m();return}f.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,O.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.isPending?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,O.jsx)(c,{className:`h-4 w-4 animate-spin`}),(0,O.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):u.isError?(0,O.jsxs)(l,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,O.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void u.refetch(),children:`Try again`})]}):d.length===0?(0,O.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`No authenticator app is set up. Add one to require a one-time code at sign-in.`}):(0,O.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:d.map(e=>(0,O.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,O.jsx)(C,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,O.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${A(e.created_at)}`:``]})]})]}),(0,O.jsx)(n,{variant:`dangerOutline`,onClick:()=>s(e),disabled:h.isPending,children:`Remove`})]},e.id))}),!u.isPending&&!u.isError&&d.length===0&&(0,O.jsx)(n,{onClick:()=>r(!0),className:`self-start`,children:`Add authenticator app`}),(0,O.jsx)(k,{open:t,onOpenChange:r}),(0,O.jsx)(p,{open:o!==null,title:`Remove authenticator app`,message:`Signing in will no longer ask for a code from this app. You can set up a new authenticator app at any time.`,confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{o&&h.mutate({path:{id:o.id}}),s(null)},onCancel:()=>s(null)})]})}function M(){let e=g.use.accountMfa(),t=g.use.hydrated(),n=w();return t&&!e?(0,O.jsx)(r,{replace:!0,to:h.settings.general}):!e||n===`gated`?null:(0,O.jsx)(`div`,{className:`space-y-4`,children:(0,O.jsx)(T,{title:`Two-Factor Authentication`,subtitle:`Require a code from an authenticator app when you sign in.`,children:n===`disabled`?(0,O.jsx)(S,{children:`Log in to the Vellum platform to manage two-factor authentication.`}):(0,O.jsx)(j,{})})})}export{M as SecurityPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as i}from"./QueryClientProvider-DKhXIxGb.js";import{t as a}from"./useQuery-B45lW1Kk.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./copy-Cn1FKrEp.js";import{t as c}from"./loader-circle-Cz7opInR.js";import{t as l}from"./notice-DkcNAP8O.js";import{t as u}from"./input-CoUmPnRU.js";import{t as d}from"./modal-D5nLWNN9.js";import{n as f}from"./toast-xTp-xwYL.js";import{t as p}from"./confirm-dialog-CSkhRFRk.js";import{Pt as m}from"./sdk.gen-CmKfVpgB.js";import{c as h}from"./routes-BbeIx_F9.js";import{t as g}from"./client-feature-flag-store-DkJl-g9A.js";import{At as _,Mt as v,Nt as y,jt as b,kt as x}from"./react-query.gen-DPzPS206.js";import{D as S,Ur as C,wi as w}from"./index-yu6nDHvG.js";import{t as T}from"./detail-card-xKZlkbz5.js";var E=e(t(),1);function D(e){if(typeof e==`object`&&e&&`code`in e){let t=e.code;if(typeof t==`string`)return t}}var O=o();function k({open:e,onOpenChange:t}){let r=i(),[a,o]=(0,E.useState)(null),[l,p]=(0,E.useState)(``),[h,g]=(0,E.useState)(null),_=(0,E.useRef)(!1),v=(0,E.useRef)(e),S=()=>r.invalidateQueries({queryKey:y()}),C=e=>{m({path:{id:e}}).catch(()=>void 0).finally(()=>void S())},w=x({onSuccess:e=>{if(!v.current){C(e.factor_id);return}o(e)},onError:e=>{let n=D(e);n===`no_workos_account`?f.error(`Two-factor authentication is only available for Vellum platform accounts.`):n===`throttled`||n===`workos_rate_limited`?f.error(`Too many attempts. Try again in a minute.`):n===`factor_limit_reached`?f.error(`An authenticator app is already set up. Remove it before adding another.`):f.error(`Failed to start setup. Please try again.`),t(!1)}}),T=b({onSuccess:e=>{e.valid?(_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1)):g(`That code didn't match. Check your authenticator app and try again.`)},onError:e=>{let n=D(e);if(n===`challenge_already_verified`){_.current=!0,f.success(`Two-factor authentication is on.`),S(),t(!1);return}if(n===`challenge_expired`||n===`challenge_not_found`){a&&C(a.factor_id),o(null),p(``),g(`This setup session expired. Scan the new QR code and try again.`),w.mutate({});return}if(n===`throttled`||n===`workos_rate_limited`){g(`Too many attempts. Wait a minute and try again.`);return}g(`Couldn't verify the code. Wait a moment and try again.`)}});(0,E.useEffect)(()=>{v.current=e,e&&(_.current=!1,o(null),p(``),g(null),w.mutate({}))},[e]);let k=e=>{!e&&T.isPending||(!e&&a&&!_.current&&C(a.factor_id),t(e))},A=()=>{a&&navigator.clipboard.writeText(a.secret).then(()=>f.success(`Setup key copied.`)).catch(()=>f.error(`Couldn't copy the setup key.`))},j=()=>{!a||l.length!==6||T.isPending||(g(null),T.mutate({body:{challenge_id:a.challenge_id,code:l}}))};return(0,O.jsx)(d.Root,{open:e,onOpenChange:k,children:(0,O.jsxs)(d.Content,{size:`sm`,children:[(0,O.jsxs)(d.Header,{children:[(0,O.jsx)(d.Title,{children:`Set up authenticator app`}),(0,O.jsx)(d.Description,{children:`Scan the QR code with an authenticator app such as Google Authenticator or 1Password, then enter the 6-digit code it shows.`})]}),(0,O.jsx)(d.Body,{children:a===null?(0,O.jsx)(`div`,{className:`flex items-center justify-center py-10`,children:(0,O.jsx)(c,{className:`h-5 w-5 animate-spin text-[var(--content-tertiary)]`})}):(0,O.jsxs)(`form`,{className:`flex flex-col items-center gap-4`,onSubmit:e=>{e.preventDefault(),j()},children:[(0,O.jsx)(`img`,{src:a.qr_code,alt:`QR code for your authenticator app`,className:`h-44 w-44 rounded-lg bg-white p-2`}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`span`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Can't scan it? Enter this setup key manually:`}),(0,O.jsxs)(`button`,{type:`button`,onClick:A,className:`flex cursor-pointer items-center gap-2 self-start font-mono text-body-small-default text-[var(--content-default)] hover:text-[var(--content-emphasised)]`,children:[(0,O.jsx)(`span`,{className:`break-all text-left`,children:a.secret}),(0,O.jsx)(s,{className:`h-3.5 w-3.5 shrink-0`})]})]}),(0,O.jsxs)(`div`,{className:`flex w-full flex-col gap-1`,children:[(0,O.jsx)(`label`,{htmlFor:`totp-code`,className:`text-body-small-default text-[var(--content-tertiary)]`,children:`6-digit code`}),(0,O.jsx)(u,{id:`totp-code`,inputMode:`numeric`,autoComplete:`one-time-code`,maxLength:6,placeholder:`123456`,value:l,onChange:e=>p(e.target.value.replace(/\D/g,``).slice(0,6))}),h&&(0,O.jsx)(`p`,{role:`alert`,className:`text-body-small-default text-[var(--system-negative-strong)]`,children:h})]})]})}),(0,O.jsxs)(d.Footer,{children:[(0,O.jsx)(n,{variant:`outlined`,onClick:()=>k(!1),disabled:T.isPending,children:`Cancel`}),(0,O.jsx)(n,{onClick:j,disabled:a===null||l.length!==6||T.isPending,children:T.isPending?`Verifying…`:`Verify`})]})]})})}function A(e){let t=new Date(e);return Number.isNaN(t.getTime())?``:t.toLocaleDateString(void 0,{month:`short`,day:`numeric`,year:`numeric`})}function j(){let e=i(),[t,r]=(0,E.useState)(!1),[o,s]=(0,E.useState)(null),u=a({...v()}),d=u.data??[],m=()=>e.invalidateQueries({queryKey:y()}),h=_({onSuccess:()=>{f.success(`Authenticator app removed.`),m()},onError:e=>{if(D(e)===`factor_not_found`){m();return}f.error(`Failed to remove the authenticator app. Please try again.`)}});return(0,O.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[u.isPending?(0,O.jsxs)(`div`,{className:`flex items-center gap-2 text-[var(--content-tertiary)]`,children:[(0,O.jsx)(c,{className:`h-4 w-4 animate-spin`}),(0,O.jsx)(`span`,{className:`text-body-medium-default`,children:`Loading authenticator apps…`})]}):u.isError?(0,O.jsxs)(l,{tone:`error`,children:[`Couldn't load your authenticator apps.`,` `,(0,O.jsx)(`button`,{type:`button`,className:`cursor-pointer underline`,onClick:()=>void u.refetch(),children:`Try again`})]}):d.length===0?(0,O.jsx)(`p`,{className:`text-body-medium-default text-[var(--content-tertiary)]`,children:`No authenticator app is set up. Add one to require a one-time code at sign-in.`}):(0,O.jsx)(`ul`,{className:`flex flex-col divide-y divide-[var(--border-base)]`,children:d.map(e=>(0,O.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-3`,children:[(0,O.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[(0,O.jsx)(w,{className:`h-5 w-5 shrink-0 text-[var(--content-tertiary)]`}),(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsx)(`div`,{className:`text-body-medium-default text-[var(--content-default)]`,children:`Authenticator app`}),(0,O.jsxs)(`div`,{className:`truncate text-body-small-default text-[var(--content-tertiary)]`,children:[e.user,e.created_at?` · Added ${A(e.created_at)}`:``]})]})]}),(0,O.jsx)(n,{variant:`dangerOutline`,onClick:()=>s(e),disabled:h.isPending,children:`Remove`})]},e.id))}),!u.isPending&&!u.isError&&d.length===0&&(0,O.jsx)(n,{onClick:()=>r(!0),className:`self-start`,children:`Add authenticator app`}),(0,O.jsx)(k,{open:t,onOpenChange:r}),(0,O.jsx)(p,{open:o!==null,title:`Remove authenticator app`,message:`Signing in will no longer ask for a code from this app. You can set up a new authenticator app at any time.`,confirmLabel:`Remove`,destructive:!0,onConfirm:()=>{o&&h.mutate({path:{id:o.id}}),s(null)},onCancel:()=>s(null)})]})}function M(){let e=g.use.accountMfa(),t=g.use.hydrated(),n=C();return t&&!e?(0,O.jsx)(r,{replace:!0,to:h.settings.general}):!e||n===`gated`?null:(0,O.jsx)(`div`,{className:`space-y-4`,children:(0,O.jsx)(T,{title:`Two-Factor Authentication`,subtitle:`Require a code from an authenticator app when you sign in.`,children:n===`disabled`?(0,O.jsx)(S,{children:`Log in to the Vellum platform to manage two-factor authentication.`}):(0,O.jsx)(j,{})})})}export{M as SecurityPage};
@@ -0,0 +1 @@
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{d as r,h as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./check-DFNrQERi.js";import{t as s}from"./modal-D5nLWNN9.js";import{t as c}from"./confirm-dialog-CSkhRFRk.js";import{A as l,F as u,M as d,d as f,lt as p,rt as ee,t as m}from"./local-mode-grqHUoNh.js";import{t as h}from"./is-electron-y5bNUVyG.js";import{n as g}from"./resolved-assistants-store-BSZbT8Ju.js";import{D as _,O as v,i as te,n as y}from"./auth-store-C09YAZEu.js";import{c as b}from"./routes-BbeIx_F9.js";import{t as x}from"./use-onboarding-login-B-1jrjFL.js";import{An as S,ha as C,jn as w,rn as T,ta as E}from"./index-yu6nDHvG.js";import{r as D}from"./format-date-CghpPTDc.js";var O=e(t(),1),k=a();function A({open:e,assistantName:t,isPending:r,errorMessage:i,onCancel:a,onRepair:o,onRetire:l}){let[u,d]=(0,O.useState)(`menu`);(0,O.useEffect)(()=>{e&&d(`menu`)},[e]);let f=i?(0,k.jsx)(`span`,{className:`mt-3 block text-body-small-default text-[var(--system-negative-strong)]`,children:i}):null;return u===`confirm-repair`?(0,k.jsx)(c,{open:e,title:`Repair Assistant?`,message:(0,k.jsxs)(k.Fragment,{children:[`Repairing re-provisions this assistant’s authentication token. Any other devices or browser sessions connected to it will be signed out and need to reconnect.`,f]}),confirmLabel:`Repair`,isPending:r,onConfirm:o,onCancel:()=>d(`menu`)}):u===`confirm-retire`?(0,k.jsx)(S,{open:e,isPending:r,extraMessage:f,onConfirm:l,onCancel:()=>d(`menu`)}):(0,k.jsx)(s.Root,{open:e,onOpenChange:e=>{!e&&!r&&a()},children:(0,k.jsxs)(s.Content,{size:`sm`,hideCloseButton:!0,onEscapeKeyDown:e=>{e.preventDefault(),e.stopPropagation(),r||a()},children:[(0,k.jsx)(s.Header,{children:(0,k.jsx)(s.Title,{children:`Can’t Authenticate Assistant`})}),(0,k.jsxs)(s.Body,{children:[(0,k.jsxs)(s.Description,{children:[`The authentication token for `,t,` is missing or can no longer be refreshed, so this assistant can’t be connected. You can repair it, retire it, or pick a different assistant.`]}),f,(0,k.jsxs)(`div`,{className:`mt-5 flex w-full flex-col gap-2`,children:[(0,k.jsx)(n,{variant:`primary`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-repair`),children:`Wake & Repair`}),(0,k.jsx)(n,{variant:`dangerOutline`,fullWidth:!0,disabled:r,onClick:()=>d(`confirm-retire`),children:`Retire Assistant`}),(0,k.jsx)(n,{variant:`outlined`,fullWidth:!0,disabled:r,onClick:a,children:`Cancel`})]})]})]})})}function j(e){return e.name?e.name:e.isLocal?`Local Assistant`:`Cloud Assistant`}function M(e){if(e.hatchedAt)return`Created ${D(e.hatchedAt)}`}function N(){let e=r(),[t]=i(),a=t.get(`fromLogin`)===`1`,o=t.get(`noAutoSkip`)===`1`,s=h(),c=te(),S=g.use.assistants(),C=_.use.currentOrganizationId(),{loading:E,error:D,login:M,cancel:N}=x(),F=e=>e.isLocal||c,I=S.filter(F),L=S.some(e=>e.isPlatformHosted)&&!c,[R,z]=(0,O.useState)(null),[B,V]=(0,O.useState)(!1),[H,U]=(0,O.useState)(!1),[W,G]=(0,O.useState)(null),[K,q]=(0,O.useState)(null),[J,Y]=(0,O.useState)(!1),[ne,X]=(0,O.useState)(null);(0,O.useEffect)(()=>{if(R!=null||I.length===0)return;let e=v(C);z(I.find(t=>t.id===e)?.id??I[0].id)},[R,I,C]);let Z=async t=>{V(!0),G(null);try{t.isLocal?await y.getState().connectLocalAssistant(t.id):await y.getState().connectPlatformAssistant(t.id),e(b.assistant,{replace:!0})}catch(e){console.error(`selectAssistant.handleConnect failed`,e),t.isLocal&&l()&&(d(e)||p(e)||e instanceof m)&&f(t.id)?q(t):G(`Failed to connect. Please try again.`),V(!1)}},Q=()=>{q(null),Y(!1),X(null),U(!1)},re=async()=>{if(!(!K||J)){Y(!0),X(null);try{let e=await u(K.id,{repairGuardian:!0});if(e.ok){ee(),Q(),Z(K);return}X(e.error||`Repair failed. Please try again.`)}catch(e){console.error(`selectAssistant.recoveryRepair failed`,e),X(`Repair failed. Please try again.`)}Y(!1)}},ie=async()=>{if(!(!K||J)){Y(!0),X(null);try{let t=await w(K.id);if(t.ok){Q(),e(t.nextRoute,{replace:!0});return}X(t.error)}catch(e){console.error(`selectAssistant.recoveryRetire failed`,e),X(`Failed to retire assistant. Please try again.`)}Y(!1)}};(0,O.useEffect)(()=>{a||o||B||H||S.length!==0&&S.length===1&&I.length===1&&(U(!0),Z(I[0]))},[S.length,I.length]);let ae=()=>{let e=S.find(e=>e.id===R);e&&Z(e)},oe=()=>{e(b.welcome)},$=D??W;return H&&!$&&!K?(0,k.jsx)(T,{children:(0,k.jsx)(`div`,{className:`mx-auto flex min-h-screen w-full max-w-xl flex-col items-center justify-center px-6 text-[var(--content-default)]`,children:(0,k.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)]`,children:`Connecting to your assistant…`})})}):(0,k.jsxs)(T,{children:[(0,k.jsxs)(`div`,{className:`mx-auto flex w-full max-w-xl flex-col items-center ${s?`min-h-full px-8 pt-21 pb-4 electron-prechat-type`:`min-h-screen px-6 pb-40 pt-16`} text-[var(--content-default)]`,children:[(0,k.jsx)(`h1`,{className:s?`text-title-large`:`text-3xl font-semibold tracking-tight`,style:{animation:`fadeInUp 0.5s ease-out 0.1s both`},children:`Choose an Assistant`}),(0,k.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--content-tertiary)] ${s?`mt-3.5`:`mt-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.3s both`},children:`Select which assistant you’d like to use.`}),$&&(0,k.jsx)(`p`,{className:`mt-4 text-body-small-default text-[var(--system-negative-strong)]`,children:$}),(0,k.jsx)(`div`,{className:`flex w-full flex-col ${s?`mt-8 gap-2`:`mt-10 gap-3`}`,style:{animation:`fadeInUp 0.5s ease-out 0.4s both`},children:S.map(e=>{let t=F(e);return(0,k.jsx)(P,{assistant:e,selected:R===e.id,disabled:!t,badge:!t&&e.isPlatformHosted?`Requires Account`:void 0,onSelect:()=>{t&&z(e.id)}},e.id)})}),(0,k.jsxs)(`div`,{className:`mt-8 flex w-full flex-col ${s?`gap-2.5`:`gap-2`}`,style:{animation:`fadeInUp 0.5s ease-out 0.5s both`},children:[I.length>0&&(0,k.jsx)(n,{variant:`primary`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:ae,disabled:!R||B,children:B?`Connecting…`:`Continue`}),(0,k.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:()=>void e(`${b.onboarding.hosting}?from=select-assistant`),disabled:B||E,children:`Create New Assistant`}),L&&(0,k.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:E?N:()=>void M(),disabled:B,children:E?`Cancel`:`Log In`}),(0,k.jsx)(n,{variant:`outlined`,size:`regular`,fullWidth:!0,className:s?void 0:`h-11 text-base`,onClick:oe,disabled:B||E,children:`Back`})]})]}),(0,k.jsx)(A,{open:K!=null,assistantName:K?j(K):``,isPending:J,errorMessage:ne??void 0,onCancel:Q,onRepair:()=>void re(),onRetire:()=>void ie()})]})}function P({assistant:e,selected:t,disabled:n,badge:r,onSelect:i}){let a=M(e),s=h();return(0,k.jsxs)(`button`,{type:`button`,onClick:i,disabled:n,className:[`group flex w-full items-center border text-left`,s?`gap-3 rounded-lg p-3`:`gap-4 rounded-2xl px-5 py-4`,`transition-all duration-200 ease-out`,n?`cursor-not-allowed opacity-50`:`cursor-pointer hover:bg-[var(--surface-secondary)]`,t&&!n?`border-[var(--primary-base)] bg-[var(--primary-base)]/[0.08] shadow-[inset_0_0_0_1px_var(--primary-base)]`:`border-[var(--border-element)] bg-transparent`].join(` `),children:[(0,k.jsx)(`div`,{className:[`flex shrink-0 items-center justify-center transition-colors duration-200`,s?`h-8 w-8 rounded-lg`:`h-10 w-10 rounded-xl`,t&&!n?`bg-[var(--primary-base)]/15 text-[var(--primary-base)]`:`bg-[var(--surface-tertiary)] text-[var(--content-secondary)]`].join(` `),children:e.isLocal?(0,k.jsx)(E,{className:`h-5 w-5`}):(0,k.jsx)(C,{className:`h-5 w-5`})}),(0,k.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,k.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,k.jsx)(`span`,{className:`text-body-medium-default text-[var(--content-default)]`,children:j(e)}),r&&(0,k.jsx)(`span`,{className:`rounded-full bg-[var(--surface-tertiary)] px-2 py-0.5 text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:r})]}),a&&(0,k.jsx)(`span`,{className:`mt-0.5 block text-[var(--content-tertiary)] ${s?`text-label-medium-default`:`text-body-small-default`}`,children:a})]}),!n&&(0,k.jsx)(`div`,{className:[`flex h-5 w-5 shrink-0 items-center justify-center rounded-full border-2 transition-all duration-200`,t?`border-[var(--primary-base)] bg-[var(--primary-base)]`:`border-[var(--border-element)] group-hover:border-[var(--content-tertiary)]`].join(` `),children:t&&(0,k.jsx)(o,{className:`h-3 w-3 text-[var(--surface-base)]`,strokeWidth:3})})]})}export{N as SelectAssistantScreen};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,i as r,u as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./log-in--aqELu3z.js";import{t as s}from"./is-electron-y5bNUVyG.js";import{i as c}from"./auth-store-CD7PGb3q.js";import{c as l}from"./routes-BbeIx_F9.js";import{t as u}from"./client-feature-flag-store-C0g8zi1W.js";import{t as d}from"./use-onboarding-login-Bo_t51AV.js";import{t as f}from"./assistant-feature-flag-store-CKUjJHuh.js";import{Pt as p,Wr as m,Yi as h,hr as g}from"./index-CSefSVJO.js";import{n as _,t as v}from"./sidebar-tree-Bh-tcSsp.js";var y=e(t(),1),b=a();function x(){let e=f.use.settingsDeveloperNav(),t=f.use.credentialsSettings(),a=u.use.platformNotifications(),x=u.use.bookmarks(),S=u.use.accountMfa(),C=m({platformHostedOnly:!0}),w=m(),{pathname:T}=i(),E=n(),D=c(),{login:O}=d(),k=(0,y.useMemo)(()=>p.filter(e=>!(e.id===`notifications`&&(!a||C===`gated`)||e.id===`billing`&&w!==`full`||e.id===`security`&&(!S||w===`gated`)||e.id===`bookmarks`&&!x||e.id===`credentials`&&!t||e.id===`devices`&&C===`gated`||e.id===`keyboard-shortcuts`&&!s()||e.id===`developer`)),[a,C,w,x,S,t]),A=(0,y.useMemo)(()=>{let t=[];return e&&t.push(...p.filter(e=>e.id===`developer`)),t.push(D?{id:`logout`,label:`Log Out`,icon:h,onSelect:()=>void g(E)}:{id:`login`,label:`Log In`,icon:o,onSelect:()=>void O()}),t},[e,D,E,O]),j=(0,y.useMemo)(()=>{if(T===l.settings.root)return`Settings`;let e=p.find(e=>T===e.href||T.startsWith(e.href+`/`));return e?e.label:`Settings`},[T]);return(0,b.jsx)(_,{backHref:l.assistant,sidebar:(0,b.jsx)(v,{items:k,bottomItems:A,indexPath:l.settings.root}),title:j,children:(0,b.jsx)(r,{})})}export{x as SettingsLayout};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{d as n,i as r,u as i}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as a}from"./jsx-runtime-CVSDxk6A.js";import{t as o}from"./log-in--aqELu3z.js";import{t as s}from"./is-electron-y5bNUVyG.js";import{i as c}from"./auth-store-C09YAZEu.js";import{c as l}from"./routes-BbeIx_F9.js";import{t as u}from"./client-feature-flag-store-DkJl-g9A.js";import{t as d}from"./use-onboarding-login-B-1jrjFL.js";import{t as f}from"./assistant-feature-flag-store-DA8Oj9Mf.js";import{Ji as p,Pt as m,Ur as h,mr as g}from"./index-yu6nDHvG.js";import{n as _,t as v}from"./sidebar-tree-C1_LiBB9.js";var y=e(t(),1),b=a();function x(){let e=f.use.settingsDeveloperNav(),t=f.use.credentialsSettings(),a=u.use.platformNotifications(),x=u.use.bookmarks(),S=u.use.accountMfa(),C=h({platformHostedOnly:!0}),w=h(),{pathname:T}=i(),E=n(),D=c(),{login:O}=d(),k=(0,y.useMemo)(()=>m.filter(e=>!(e.id===`notifications`&&(!a||C===`gated`)||e.id===`billing`&&w!==`full`||e.id===`security`&&(!S||w===`gated`)||e.id===`bookmarks`&&!x||e.id===`credentials`&&!t||e.id===`devices`&&C===`gated`||e.id===`keyboard-shortcuts`&&!s()||e.id===`developer`)),[a,C,w,x,S,t]),A=(0,y.useMemo)(()=>{let t=[];return e&&t.push(...m.filter(e=>e.id===`developer`)),t.push(D?{id:`logout`,label:`Log Out`,icon:p,onSelect:()=>void g(E)}:{id:`login`,label:`Log In`,icon:o,onSelect:()=>void O()}),t},[e,D,E,O]),j=(0,y.useMemo)(()=>{if(T===l.settings.root)return`Settings`;let e=m.find(e=>T===e.href||T.startsWith(e.href+`/`));return e?e.label:`Settings`},[T]);return(0,b.jsx)(_,{backHref:l.assistant,sidebar:(0,b.jsx)(v,{items:k,bottomItems:A,indexPath:l.settings.root}),title:j,children:(0,b.jsx)(r,{})})}export{x as SettingsLayout};
@@ -0,0 +1 @@
1
+ import{o as e,r as t}from"./chunk-jRWAZmH_.js";import{t as n}from"./react-DJZBPgpf.js";import{F as r,n as i,t as a}from"./button-amTXFI-2.js";import{t as o}from"./useMutation-Lj4VunQV.js";import{t as s}from"./jsx-runtime-CVSDxk6A.js";import{t as c}from"./bug-BsuQ5ciQ.js";import{t as l}from"./download-CAuK-nZ6.js";import{t as u}from"./info-DsOyuMO9.js";import{t as ee}from"./loader-circle-Cz7opInR.js";import{t as d}from"./x-CkSVp1Ok.js";import{t as f}from"./notice-DkcNAP8O.js";import{n as te,t as p}from"./input-CoUmPnRU.js";import{t as m}from"./toggle-CDfguvUz.js";import{t as h}from"./dropdown-ByHOpeOU.js";import{t as g}from"./is-electron-y5bNUVyG.js";import{in as _}from"./sdk.gen-BwnFjFcp.js";import{t as v}from"./impersonate-version-flag-BhxfH6iZ.js";import{n as y}from"./auth-store-C09YAZEu.js";import{t as b}from"./dist-DS5iJwBJ2.js";import{n as x}from"./diagnostics-COsnZMe5.js";import{L as S}from"./react-query.gen-DPzPS206.js";import{$i as C,Bi as w,Gi as T,ki as ne,qi as re}from"./index-yu6nDHvG.js";var E=e(n(),1),ie=e(r(),1),D=`vellum:debug:`;function ae(){let e={};if(typeof window>`u`)return e;try{for(let t=0;t<window.localStorage.length;t++){let n=window.localStorage.key(t);if(n===null||!n.startsWith(D))continue;let r=window.localStorage.getItem(n);r!==null&&(e[n]=r)}}catch{}return e}function O(){return{collectedAt:new Date().toISOString(),resolved:{impersonateAssistantVersion:v()},overrides:ae()}}var k=t({ShareFeedbackModal:()=>z}),A=s(),j=[{value:`bug_report`,label:`Bug Report`,icon:c,includesLogsByDefault:!0},{value:`feature_request`,label:`Feature Request`,icon:C,includesLogsByDefault:!1},{value:`other`,label:`Other`,icon:T,includesLogsByDefault:!1}],M=[{value:`past_hour`,label:`Past hour`,cutoffMs:3600*1e3},{value:`past_24_hours`,label:`Past 24 hours`,cutoffMs:1440*60*1e3},{value:`all_time`,label:`All time`,cutoffMs:null}],oe=M.map(e=>({value:e.value,label:e.label})),N=new Set([`image/png`,`image/jpeg`,`image/gif`,`image/webp`,`video/mp4`,`video/quicktime`,`video/webm`]),P=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`mp4`,`mov`,`webm`]),F=10,I=50*1024*1024,se={bug_report:`bug_report`,feature_request:`feature_request`,other:`other`};function ce(){return g()?`electron`:b.getPlatform()===`ios`?`ios`:`web`}function le(e){if(e.size>I)return!1;if(e.type&&N.has(e.type))return!0;if(!e.type){let t=e.name.split(`.`).pop()?.toLowerCase();return t?P.has(t):!1}return!1}function L(e,t){let n=Math.ceil(t.length/512),r=new Uint8Array(512+n*512),i=new TextEncoder,a=(e,t,n)=>{let a=i.encode(e);r.set(a.slice(0,n),t)},o=(e,t,n)=>{a(e.toString(8).padStart(n-1,`0`)+`\0`,t,n)};a(e,0,100),o(420,100,8),o(0,108,8),o(0,116,8),o(t.length,124,12),o(Math.floor(Date.now()/1e3),136,12);for(let e=148;e<156;e++)r[e]=32;r[156]=48,a(`ustar\0`,257,6),a(`00`,263,2);let s=0;for(let e=0;e<512;e++)s+=r[e];return o(s,148,7),r[155]=32,r.set(t,512),r}async function R(e,t){try{let n={};t.window.startTime!=null&&(n.startTime=t.window.startTime,n.endTime=t.window.endTime),t.activeConversationId&&(n.conversationId=t.activeConversationId);let{data:r,error:i}=await _({path:{assistant_id:e},body:n,parseAs:`blob`,throwOnError:!1});if(i||!(r instanceof Blob))return null;let a=await r.arrayBuffer();return new Uint8Array(a)}catch{return null}}async function ue(e,t,n,r={}){if(typeof CompressionStream>`u`)return null;let{diagnosticsProvider:i,doctorSessionId:a,extraLogFiles:o=[]}=r,s=new Date,c=M.find(t=>t.value===e),l=s.getTime(),u=c?.cutoffMs==null?null:l-c.cutoffMs,ee=u==null?null:new Date(u).toISOString(),d=null;try{d=i?.()??null}catch{d=null}let f=x(d),te={collected_at:s.toISOString(),time_range:e,cutoff:ee,log_window:{start_time_ms:u,end_time_ms:l},assistant_id:t,active_conversation_id:n,doctor_session_id:a??null,user_agent:typeof navigator<`u`?navigator.userAgent:``,language:typeof navigator<`u`?navigator.language:``,platform:typeof navigator<`u`?navigator.platform:``,url:typeof window<`u`?window.location.href:``,viewport:typeof window<`u`?{width:window.innerWidth,height:window.innerHeight}:null,screen:typeof screen<`u`?{width:screen.width,height:screen.height}:null,connection:typeof navigator<`u`&&`connection`in navigator?{effectiveType:navigator.connection.effectiveType,downlink:navigator.connection.downlink,rtt:navigator.connection.rtt}:null,deviceMemory:typeof navigator<`u`&&`deviceMemory`in navigator?navigator.deviceMemory:null,hardwareConcurrency:typeof navigator<`u`?navigator.hardwareConcurrency:null},p=new TextEncoder,m=p.encode(JSON.stringify(te,null,2)),h=p.encode(JSON.stringify(f,null,2)),_=[L(`web-client-context.json`,m),L(`web-chat-diagnostics.json`,h)],v=new TextEncoder().encode(JSON.stringify(O(),null,2));_.push(L(`web-debug-flags.json`,v));for(let e of o){let t=e.contents.trim();t&&_.push(L(e.filename,p.encode(t)))}try{let e=typeof window<`u`?window._vellumDebug?.chat:null;if(e){let t={clientMessages:e.getClientMessages?.()??null,transcriptItems:e.getTranscriptItems?.()??null,pendingInteractions:e.listPendingInteractions?.()??null,thinkingIndicator:e.thinkingIndicator?.()??null,streamingRing:e.streamingRing?.()??null,reconciliationDiagnostics:e.getReconciliationDiagnostics?.()??null},n=new TextEncoder().encode(JSON.stringify(t,null,2));_.push(L(`web-chat-debug-api-triage.json`,n))}}catch{}try{let e=typeof window<`u`?window._vellumDebug?.events:null;if(e){let t={focus:typeof document<`u`?{hasFocus:typeof document.hasFocus==`function`?document.hasFocus():null,visibilityState:document.visibilityState}:null,clients:e.getClients().map(({abortSignal:e,...t})=>({...t,aborted:e.aborted})),events:e.getEvents()},n=new TextEncoder().encode(JSON.stringify(t,null,2));_.push(L(`web-sse-liveness-triage.json`,n))}}catch{}if(g()&&window.vellum?.feedback){try{let e=await window.vellum.feedback.diagnostics(),t=new TextEncoder().encode(JSON.stringify(e,null,2));_.push(L(`electron-diagnostics.json`,t))}catch{}try{let e=await window.vellum.feedback.logs();if(e){let t=new TextEncoder().encode(e);_.push(L(`electron-main-logs.txt`,t))}}catch{}}if(t){let e=await R(t,{window:{startTime:u,endTime:l},activeConversationId:n});e&&_.push(L(`platform-logs.tar.gz`,e))}_.push(new Uint8Array(1024));let y=_.reduce((e,t)=>e+t.length,0),b=new Uint8Array(y),S=0;for(let e of _)b.set(e,S),S+=e.length;let C=new Blob([b.buffer]),w=await new Response(C.stream().pipeThrough(new CompressionStream(`gzip`))).blob();return new File([w],`web-client-logs-${s.getTime()}.tar.gz`,{type:`application/gzip`})}function z({open:e,onClose:t,initialReason:n,initialMessage:r,onSubmitted:s,assistantId:c,assistantVersion:_,activeConversationId:v,doctorSessionId:b,doctorSessionLog:x,getDiagnosticsSnapshot:C}){let T=y.use.user(),D=T?.email,ae=T?.isStaff??!1,O=(0,E.useId)(),k=(0,E.useRef)(null),M=(0,E.useRef)(null),N=(0,E.useRef)(null),P=(0,E.useRef)(null),[I,L]=(0,E.useState)(n??`bug_report`),[R,z]=(0,E.useState)(``),[B,pe]=(0,E.useState)(``),[V,H]=(0,E.useState)(j.find(e=>e.value===(n??`bug_report`))?.includesLogsByDefault??!0),[me,he]=(0,E.useState)(!1),[U,W]=(0,E.useState)(`past_hour`),[G,K]=(0,E.useState)([]),[ge,q]=(0,E.useState)(null),[_e,J]=(0,E.useState)(!1),[Y,ve]=(0,E.useState)(!1),[X,ye]=(0,E.useState)(!1),Z=o(S()),[be,Q]=(0,E.useState)(!1),$=Z.isPending||be,xe=!D,Se=(0,E.useMemo)(()=>R.trim().length>0&&B.trim().length>0,[R,B]);(0,E.useEffect)(()=>{if(!e)return;let t=n??`bug_report`;L(t),z(r??``),pe(D??``),H(j.find(e=>e.value===t)?.includesLogsByDefault??!0),he(!1),W(`past_hour`),K([]),ve(!1),ye(!1),q(null),Q(!1),Z.reset();let i=setTimeout(()=>{D?N.current?.focus():P.current?.focus()},50);return()=>clearTimeout(i)},[e]),(0,E.useEffect)(()=>{if(!e)return;let t=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=t}},[e]);let Ce=e=>{L(e),me||H(j.find(t=>t.value===e)?.includesLogsByDefault??!1)},we=()=>{H(e=>!e),he(!0)},Te=x?.trim()?[{filename:`doctor-session.txt`,contents:x}]:[],Ee=(0,E.useCallback)(e=>{e.key===`Escape`&&!$&&t()},[t,$]),De=(0,E.useCallback)(e=>{e.target===k.current&&!$&&t()},[t,$]),Oe=(0,E.useCallback)(e=>{K(t=>{let n=F-t.length;if(n<=0)return t;let r=new Set(t.map(e=>`${e.name}:${e.size}`)),i=[];for(let t of e){if(i.length>=n)break;if(!le(t))continue;let e=`${t.name}:${t.size}`;r.has(e)||(r.add(e),i.push(t))}return i.length>0?[...t,...i]:t})},[]),ke=e=>{e.target.files&&Oe(Array.from(e.target.files)),e.target.value=``},Ae=e=>{e.preventDefault(),J(!1),e.dataTransfer.files?.length&&Oe(Array.from(e.dataTransfer.files))},je=e=>{e.preventDefault(),J(!0)},Me=e=>{e.preventDefault(),e.currentTarget===e.target&&J(!1)},Ne=e=>{K(t=>t.filter((t,n)=>n!==e))};return e?(0,ie.createPortal)((0,A.jsx)(`div`,{ref:k,role:`dialog`,"aria-modal":`true`,"aria-labelledby":O,className:`fixed inset-0 z-50 flex items-center justify-center bg-black/50`,onKeyDown:Ee,onClick:De,onDrop:Ae,onDragOver:je,onDragLeave:Me,children:(0,A.jsxs)(`div`,{className:`mx-4 flex w-full max-w-lg flex-col rounded-xl border p-6 shadow-xl`,style:{backgroundColor:`var(--surface-lift)`,borderColor:`var(--border-base)`,maxHeight:`calc(100vh - 2rem)`},children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between border-b pb-4`,style:{borderColor:`var(--border-subtle)`},children:[(0,A.jsx)(`h2`,{id:O,className:`!m-0 text-title-small text-[var(--content-default)]`,children:`Share Feedback`}),(0,A.jsx)(a,{variant:`ghost`,iconOnly:(0,A.jsx)(d,{}),onClick:t,disabled:$,"aria-label":`Close`,tintColor:`var(--content-secondary)`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-3.5 overflow-y-auto pt-4 ${$?`pointer-events-none opacity-60`:``}`,children:[ae&&(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5 rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)] px-3 py-2.5`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3`,children:[(0,A.jsx)(m,{checked:X,onChange:()=>ye(e=>!e),"aria-label":`Download diagnostics directly`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Download diagnostics directly`})]}),(0,A.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Admin only — builds the diagnostics archive locally and downloads it instead of submitting feedback or notifying Slack.`})]}),X?(0,A.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,A.jsx)(`span`,{className:`text-body-medium-lighter text-[var(--content-default)]`,children:`Time range`}),(0,A.jsx)(h,{options:oe,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}):(0,A.jsxs)(A.Fragment,{children:[xe&&(0,A.jsx)(p,{id:`${O}-email`,ref:P,label:`Email`,type:`email`,placeholder:`you@example.com`,value:B,onChange:e=>pe(e.target.value),leftIcon:(0,A.jsx)(re,{className:`h-4 w-4`,"aria-hidden":!0}),fullWidth:!0}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,A.jsx)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:`Category`}),(0,A.jsx)(`div`,{className:`flex gap-2`,children:j.map(e=>(0,A.jsx)(de,{option:e,isSelected:I===e.value,onSelect:()=>Ce(e.value)},e.value))})]}),(0,A.jsx)(`hr`,{className:`border-[var(--border-subtle)]`}),I===`bug_report`&&(0,A.jsxs)(f,{tone:`info`,children:[`Tip: Get faster support by posting in our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/community`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`Discord community`})]}),I===`feature_request`&&(0,A.jsxs)(f,{tone:`info`,children:[`Tip: Vote on features on our`,` `,(0,A.jsx)(`a`,{href:`https://vellum.ai/roadmap`,target:`_blank`,rel:`noopener noreferrer`,className:`underline text-[var(--content-default)]`,children:`public roadmap`})]}),(0,A.jsx)(te,{id:`${O}-message`,ref:N,label:I===`bug_report`?`What went wrong?`:I===`feature_request`?`Describe your idea`:`What's on your mind?`,rows:3,placeholder:I===`bug_report`?`What did you expect to happen, and what happened instead?`:I===`feature_request`?`What problem would this solve for you?`:`Share your thoughts...`,value:R,onChange:e=>z(e.target.value),fullWidth:!0}),I!==`feature_request`&&(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(m,{checked:V,onChange:we,"aria-label":`Include browser diagnostics`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include diagnostics`})]}),(0,A.jsx)(i,{content:`Diagnostics include browser context, assistant logs, and timestamps — never passwords or credentials.`,children:(0,A.jsx)(`button`,{type:`button`,"aria-label":`About diagnostics`,className:`inline-flex items-center justify-center text-[var(--content-tertiary)]`,children:(0,A.jsx)(u,{className:`h-3.5 w-3.5`})})})]}),V&&(0,A.jsx)(h,{options:oe,value:U,onChange:W,"aria-label":`Diagnostics time range`})]}),g()&&v&&I!==`feature_request`&&(0,A.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5`,children:[(0,A.jsx)(m,{checked:Y,onChange:()=>ve(e=>!e),"aria-label":`Include the most recent conversation`}),(0,A.jsx)(`span`,{className:`text-body-medium-lighter leading-6 text-[var(--content-default)]`,children:`Include the most recent conversation`})]}),(0,A.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,A.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,A.jsxs)(`span`,{className:`text-body-small-default text-[var(--content-secondary)]`,children:[`Attachments`,G.length>0&&(0,A.jsxs)(`span`,{className:`text-[var(--content-tertiary)]`,children:[` · `,G.length,`/`,F]})]}),(0,A.jsx)(a,{variant:`outlined`,size:`compact`,leftIcon:(0,A.jsx)(w,{}),onClick:()=>M.current?.click(),disabled:G.length>=F,children:`Add files`}),(0,A.jsx)(`input`,{ref:M,type:`file`,multiple:!0,accept:`image/png,image/jpeg,image/gif,image/webp,video/mp4,video/quicktime,video/webm`,onChange:ke,className:`hidden`})]}),G.length>0&&(0,A.jsx)(`div`,{className:`flex gap-2 overflow-x-auto`,children:G.map((e,t)=>(0,A.jsx)(fe,{file:e,onRemove:()=>Ne(t)},`${e.name}-${t}`))}),_e&&(0,A.jsx)(`p`,{className:`text-body-small-default text-[var(--content-tertiary)]`,children:`Drop files to attach…`})]})]}),ge&&(0,A.jsx)(`p`,{className:`text-body-medium-lighter text-[var(--system-negative-strong)]`,children:ge})]}),(0,A.jsx)(`div`,{className:`mt-4 flex items-center justify-end gap-2 border-t pt-4`,style:{borderColor:`var(--border-subtle)`},children:$?(0,A.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-body-medium-lighter text-[var(--content-secondary)]`,children:[(0,A.jsx)(ee,{className:`h-4 w-4 animate-spin`}),X?`Preparing diagnostics…`:`Sending feedback…`]}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{variant:`ghost`,onClick:t,children:`Cancel`}),X?(0,A.jsx)(a,{variant:`primary`,leftIcon:(0,A.jsx)(l,{}),onClick:async()=>{if(!$){q(null),Q(!0);try{let e=await ue(U,c??null,g()?Y?v??null:null:v??null,{diagnosticsProvider:C,doctorSessionId:b,extraLogFiles:Te});if(!e){q(`Diagnostics export isn't supported in this browser.`);return}let n=URL.createObjectURL(e),r=document.createElement(`a`);r.href=n,r.download=e.name,document.body.appendChild(r),r.click(),r.remove(),setTimeout(()=>URL.revokeObjectURL(n),0),t()}catch(e){q(e instanceof Error?e.message:`Failed to build diagnostics. Please try again.`)}finally{Q(!1)}}},children:`Download diagnostics`}):(0,A.jsx)(a,{variant:`primary`,leftIcon:(0,A.jsx)(ne,{}),onClick:async()=>{if(!(!Se||$)){q(null),Q(!0);try{let e=V&&I!==`feature_request`?await ue(U,c??null,g()?Y?v??null:null:v??null,{diagnosticsProvider:C,doctorSessionId:b,extraLogFiles:Te}):null;await Z.mutateAsync({headers:{"Content-Type":null},body:{message:R.trim(),classification:se[I],email:B.trim(),client:ce(),client_version:void 0,...c?{assistant_id:c}:{},..._?{assistant_version:_}:{},...b?{doctor_session_id:b}:{},...e?{logs_file:e}:{},...G.length?{attachments:G}:{}},bodySerializer:e=>{let t=new FormData;for(let[n,r]of Object.entries(e))if(r!=null){if(n===`attachments`&&Array.isArray(r)){for(let e of r)t.append(`attachments`,e);continue}r instanceof Blob?t.append(n,r):t.append(n,String(r))}return t}}),s?.(),t()}catch(e){q(e instanceof Error?e.message:`Failed to submit feedback. Please try again.`)}finally{Q(!1)}}},disabled:!Se,children:`Submit`})]})})]})}),document.body):null}function de({option:e,isSelected:t,onSelect:n}){let r=e.icon;return(0,A.jsxs)(`button`,{type:`button`,onClick:n,"aria-pressed":t,className:`flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-left transition-colors`,style:{borderColor:t?`var(--primary-base)`:`var(--border-base)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:`transparent`},children:[(0,A.jsx)(r,{className:`h-3.5 w-3.5 shrink-0`,style:{color:t?`var(--primary-base)`:`var(--content-secondary)`}}),(0,A.jsx)(`span`,{className:`text-body-small-default`,style:{color:t?`var(--primary-base)`:`var(--content-default)`},children:e.label})]})}function fe({file:e,onRemove:t}){let n=e.type.startsWith(`image/`),r=(0,E.useMemo)(()=>n?URL.createObjectURL(e):null,[e,n]);return(0,E.useEffect)(()=>{if(r)return()=>URL.revokeObjectURL(r)},[r]),(0,A.jsxs)(`div`,{className:`relative flex h-16 w-16 shrink-0 items-center justify-center overflow-hidden rounded-lg border border-[var(--border-base)] bg-[var(--surface-base)]`,title:e.name,children:[n&&r?(0,A.jsx)(`img`,{src:r,alt:e.name,className:`h-full w-full object-cover`}):(0,A.jsx)(w,{className:`h-5 w-5 text-[var(--content-secondary)]`}),(0,A.jsx)(a,{variant:`ghost`,size:`compact`,iconOnly:(0,A.jsx)(d,{}),onClick:t,"aria-label":`Remove ${e.name}`,className:`absolute top-0.5 right-0.5 h-4 w-4 rounded-full bg-black/60 text-white hover:bg-black/70`,tintColor:`#fff`})]})}export{k as n,z as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{d as r,t as i,u as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-D5f7kt80.js";import{t as c}from"./arrow-left-DI9551VI.js";import{t as l}from"./chevron-right-DqqmezXC.js";import{i as u}from"./src-B2IjVySQ.js";import{t as d}from"./is-electron-y5bNUVyG.js";import{c as f}from"./routes-BbeIx_F9.js";import{Nn as p,fn as m,vr as h}from"./index-CSefSVJO.js";import{t as g}from"./use-edge-swipe-back-AcKDuMrX.js";var _=e(t(),1),v=o();function y({sidebar:e,children:t,actions:o,backHref:l,title:u=`Settings`,menuRoute:y=f.settings.root}){let{pathname:b}=a(),x=r(),S=b===y,C=h(),w=(0,_.useRef)(null),T=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{T.current?.scrollTo(0,0)},[b]);let E=S?l:y;g({containerRef:w,onBack:(0,_.useCallback)(()=>{x(E)},[x,E]),enabled:C,navKey:b});let D=d(),O=S?`Back from ${u}`:`Back to ${u} menu`,k=(0,v.jsx)(n,{variant:`ghost`,iconOnly:(0,v.jsx)(c,{}),"aria-label":O,tintColor:`var(--content-secondary)`,onClick:()=>x(E)}),A=(0,v.jsx)(n,{asChild:!0,variant:`outlined`,"aria-label":`Back from ${u}`,className:`h-8 w-8 px-0`,tintColor:`var(--content-secondary)`,children:(0,v.jsx)(i,{to:l,className:`flex items-center justify-center no-underline`,children:(0,v.jsx)(c,{size:16,"aria-hidden":`true`})})});return(0,v.jsxs)(`div`,{ref:w,className:`flex h-full min-h-0 w-full flex-1 flex-col gap-4 p-4 sm:p-6 md:gap-0`,style:{paddingTop:D?`3.75rem`:`1rem`},children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 md:hidden`,children:[k,(0,v.jsx)(s,{as:`h1`,variant:`body-large-default`,className:`flex-1 truncate text-center`,style:{color:`var(--content-tertiary)`,lineHeight:1.4},children:u}),(0,v.jsx)(`div`,{className:`h-10 w-10 shrink-0`,"aria-hidden":`true`})]}),D?(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 pb-4 empty:hidden`,children:[(0,v.jsx)(p,{placement:`electron`,className:`px-0 pt-0`}),(0,v.jsx)(m,{placement:`electron`,className:`px-0 pt-0`})]}):null,(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden md:rounded-[12px] md:border md:border-[var(--border-base)] md:bg-[var(--surface-overlay)]`,children:[(0,v.jsxs)(`div`,{className:`hidden shrink-0 items-center justify-between gap-4 px-6 py-5 md:flex`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[A,(0,v.jsx)(`h1`,{className:`text-title-large truncate`,style:{color:`var(--content-emphasised)`,lineHeight:1.2},children:u})]}),(0,v.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,v.jsx)(`aside`,{className:`hidden w-64 shrink-0 overflow-y-auto md:block`,"aria-label":`${u} navigation`,children:e}),S?(0,v.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 md:hidden`,children:e}):null,(0,v.jsx)(`main`,{ref:T,className:`min-w-0 min-h-0 flex-1 flex-col gap-4 overflow-y-auto overflow-x-hidden pb-6 md:flex md:px-6 md:pt-0 ${S?`hidden`:`flex`}`,children:t})]})]})]})}function b({items:e,bottomItems:t,indexPath:n}){let{pathname:i}=a(),o=r(),s=h(),c=(e,t,r)=>{let{href:a,onSelect:c}=e,d=a!=null&&(i===a||i.startsWith(a+`/`)||!s&&r&&n!=null&&i===n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(u.Item,{icon:e.icon,label:e.label,active:d,trailingIcon:a==null?void 0:l,trailingIconClassName:a==null?void 0:`md:hidden`,href:a,onSelect:c,onClick:a==null?void 0:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),o(a))}}),!t&&(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`my-2 h-px w-full bg-[var(--border-base)] md:hidden`})]},e.id)};return(0,v.jsxs)(`nav`,{"aria-label":`Sidebar navigation`,className:`flex min-h-full flex-col md:gap-2 md:px-6 md:pb-4`,children:[e.map((n,r)=>c(n,r===e.length-1&&!t?.length,r===0)),t&&t.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`mx-0 my-2 h-px w-full bg-[var(--border-base)] md:mx-0`}),t.map((e,n)=>c(e,n===t.length-1,!1))]})]})}export{y as n,b as t};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{t as n}from"./button-amTXFI-2.js";import{d as r,t as i,u as a}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as o}from"./jsx-runtime-CVSDxk6A.js";import{t as s}from"./typography-D5f7kt80.js";import{t as c}from"./arrow-left-DI9551VI.js";import{t as l}from"./chevron-right-DqqmezXC.js";import{i as u}from"./src-zsLiFPw3.js";import{t as d}from"./is-electron-y5bNUVyG.js";import{c as f}from"./routes-BbeIx_F9.js";import{Mn as p,_r as m,fn as h}from"./index-yu6nDHvG.js";import{t as g}from"./use-edge-swipe-back-B4XlZ1Iu.js";var _=e(t(),1),v=o();function y({sidebar:e,children:t,actions:o,backHref:l,title:u=`Settings`,menuRoute:y=f.settings.root}){let{pathname:b}=a(),x=r(),S=b===y,C=m(),w=(0,_.useRef)(null),T=(0,_.useRef)(null);(0,_.useLayoutEffect)(()=>{T.current?.scrollTo(0,0)},[b]);let E=S?l:y;g({containerRef:w,onBack:(0,_.useCallback)(()=>{x(E)},[x,E]),enabled:C,navKey:b});let D=d(),O=S?`Back from ${u}`:`Back to ${u} menu`,k=(0,v.jsx)(n,{variant:`ghost`,iconOnly:(0,v.jsx)(c,{}),"aria-label":O,tintColor:`var(--content-secondary)`,onClick:()=>x(E)}),A=(0,v.jsx)(n,{asChild:!0,variant:`outlined`,"aria-label":`Back from ${u}`,className:`h-8 w-8 px-0`,tintColor:`var(--content-secondary)`,children:(0,v.jsx)(i,{to:l,className:`flex items-center justify-center no-underline`,children:(0,v.jsx)(c,{size:16,"aria-hidden":`true`})})});return(0,v.jsxs)(`div`,{ref:w,className:`flex h-full min-h-0 w-full flex-1 flex-col gap-4 p-4 sm:p-6 md:gap-0`,style:{paddingTop:D?`3.75rem`:`1rem`},children:[(0,v.jsxs)(`div`,{className:`flex shrink-0 items-center gap-3 md:hidden`,children:[k,(0,v.jsx)(s,{as:`h1`,variant:`body-large-default`,className:`flex-1 truncate text-center`,style:{color:`var(--content-tertiary)`,lineHeight:1.4},children:u}),(0,v.jsx)(`div`,{className:`h-10 w-10 shrink-0`,"aria-hidden":`true`})]}),D?(0,v.jsxs)(`div`,{className:`flex shrink-0 flex-col gap-2 pb-4 empty:hidden`,children:[(0,v.jsx)(p,{placement:`electron`,className:`px-0 pt-0`}),(0,v.jsx)(h,{placement:`electron`,className:`px-0 pt-0`})]}):null,(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden md:rounded-[12px] md:border md:border-[var(--border-base)] md:bg-[var(--surface-overlay)]`,children:[(0,v.jsxs)(`div`,{className:`hidden shrink-0 items-center justify-between gap-4 px-6 py-5 md:flex`,children:[(0,v.jsxs)(`div`,{className:`flex min-w-0 items-center gap-3`,children:[A,(0,v.jsx)(`h1`,{className:`text-title-large truncate`,style:{color:`var(--content-emphasised)`,lineHeight:1.2},children:u})]}),(0,v.jsx)(`div`,{className:`flex shrink-0 items-center gap-2`,children:o})]}),(0,v.jsxs)(`div`,{className:`flex min-h-0 flex-1 overflow-hidden`,children:[(0,v.jsx)(`aside`,{className:`hidden w-64 shrink-0 overflow-y-auto md:block`,"aria-label":`${u} navigation`,children:e}),S?(0,v.jsx)(`div`,{className:`flex min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overflow-x-hidden pb-6 md:hidden`,children:e}):null,(0,v.jsx)(`main`,{ref:T,className:`min-w-0 min-h-0 flex-1 flex-col gap-4 overflow-y-auto overflow-x-hidden pb-6 md:flex md:px-6 md:pt-0 ${S?`hidden`:`flex`}`,children:t})]})]})]})}function b({items:e,bottomItems:t,indexPath:n}){let{pathname:i}=a(),o=r(),s=m(),c=(e,t,r)=>{let{href:a,onSelect:c}=e,d=a!=null&&(i===a||i.startsWith(a+`/`)||!s&&r&&n!=null&&i===n);return(0,v.jsxs)(_.Fragment,{children:[(0,v.jsx)(u.Item,{icon:e.icon,label:e.label,active:d,trailingIcon:a==null?void 0:l,trailingIconClassName:a==null?void 0:`md:hidden`,href:a,onSelect:c,onClick:a==null?void 0:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.button!==0||(e.preventDefault(),o(a))}}),!t&&(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`my-2 h-px w-full bg-[var(--border-base)] md:hidden`})]},e.id)};return(0,v.jsxs)(`nav`,{"aria-label":`Sidebar navigation`,className:`flex min-h-full flex-col md:gap-2 md:px-6 md:pb-4`,children:[e.map((n,r)=>c(n,r===e.length-1&&!t?.length,r===0)),t&&t.length>0&&(0,v.jsxs)(v.Fragment,{children:[(0,v.jsx)(`div`,{className:`flex-1`}),(0,v.jsx)(`div`,{role:`presentation`,"aria-hidden":!0,className:`mx-0 my-2 h-px w-full bg-[var(--border-base)] md:mx-0`}),t.map((e,n)=>c(e,n===t.length-1,!1))]})]})}export{y as n,b as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{f as t}from"./native-biometric-Czaf9IqI.js";import{t as n}from"./react-DJZBPgpf.js";import{h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{n as a,r as o}from"./login-flow-CHNlba5i.js";import{t as s}from"./proxy-BzlH_XAe.js";import{t as c}from"./AnimatePresence-C8APSgIu.js";import{lt as l}from"./index-CSefSVJO.js";import{t as u}from"./signup-shell-D4Afeijm.js";var d=e(n(),1),f=i();function p({words:e}){let[t,n]=(0,d.useState)(0),r=(0,d.useMemo)(()=>e.reduce((e,t)=>e.length>=t.length?e:t),[e]);return(0,d.useEffect)(()=>{let t=setInterval(()=>{n(t=>(t+1)%e.length)},2400);return()=>clearInterval(t)},[e.length]),(0,f.jsxs)(`span`,{className:`signup__rotating`,children:[(0,f.jsxs)(`span`,{className:`signup__rotating-sizer`,"aria-hidden":!0,children:[r,`.`]}),(0,f.jsx)(c,{mode:`wait`,children:(0,f.jsxs)(s.em,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.3,ease:`easeInOut`},children:[e[t],`.`]},e[t])})]})}var m=[`Personal Intelligence`,`Software Engineer`,`Finance Ops`,`Household Manager`,`GTM Engineer`,`Product Lead`];function h({returnTo:e}){let[n,r]=(0,d.useState)(null),i=o(e,{authIntent:`signup`});return(0,f.jsxs)(u,{children:[(0,f.jsxs)(`h1`,{className:`signup__title`,children:[`Meet your new`,(0,f.jsx)(`br`,{}),(0,f.jsx)(p,{words:m})]}),(0,f.jsx)(`p`,{className:`signup__subtitle`,children:`The most powerful assistant that can handle your work and life admin tasks.`}),(0,f.jsx)(`div`,{className:`signup__buttons`,children:(0,f.jsx)(`button`,{type:`button`,className:`signup__btn`,onClick:()=>{r(null),t(a,i,{returnTo:e,intent:`signup`}).catch(e=>{console.error(`[signup] auth flow failed:`,e),r(`Something went wrong. Please try again.`)})},children:`Continue`})}),n&&(0,f.jsx)(`p`,{className:`signup__error`,children:n}),(0,f.jsxs)(`p`,{className:`signup__footer`,children:[`Already have an account?`,` `,(0,f.jsx)(`button`,{type:`button`,className:`signup__link`,onClick:()=>{r(null),t(a,o(e),{returnTo:e}).catch(e=>{console.error(`[signup] sign-in flow failed:`,e),r(`Something went wrong. Please try again.`)})},children:`Sign in`})]}),(0,f.jsxs)(`a`,{className:`signup__download`,href:`/downloads`,children:[(0,f.jsx)(l,{size:16}),`Download for macOS`]})]})}function g(){let[e]=r();return(0,f.jsx)(h,{returnTo:e.get(`returnTo`)})}export{g as SignupPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{f as t}from"./native-biometric-Czaf9IqI.js";import{t as n}from"./react-DJZBPgpf.js";import{h as r}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{t as i}from"./jsx-runtime-CVSDxk6A.js";import{n as a,r as o}from"./login-flow-B6q00uIW.js";import{t as s}from"./proxy-o6cPThl2.js";import{t as c}from"./AnimatePresence-s1Z1HHWx.js";import{lt as l}from"./index-yu6nDHvG.js";import{t as u}from"./signup-shell-DufHA5do.js";var d=e(n(),1),f=i();function p({words:e}){let[t,n]=(0,d.useState)(0),r=(0,d.useMemo)(()=>e.reduce((e,t)=>e.length>=t.length?e:t),[e]);return(0,d.useEffect)(()=>{let t=setInterval(()=>{n(t=>(t+1)%e.length)},2400);return()=>clearInterval(t)},[e.length]),(0,f.jsxs)(`span`,{className:`signup__rotating`,children:[(0,f.jsxs)(`span`,{className:`signup__rotating-sizer`,"aria-hidden":!0,children:[r,`.`]}),(0,f.jsx)(c,{mode:`wait`,children:(0,f.jsxs)(s.em,{initial:{opacity:0,y:16},animate:{opacity:1,y:0},exit:{opacity:0,y:-16},transition:{duration:.3,ease:`easeInOut`},children:[e[t],`.`]},e[t])})]})}var m=[`Personal Intelligence`,`Software Engineer`,`Finance Ops`,`Household Manager`,`GTM Engineer`,`Product Lead`];function h({returnTo:e}){let[n,r]=(0,d.useState)(null),i=o(e,{authIntent:`signup`});return(0,f.jsxs)(u,{children:[(0,f.jsxs)(`h1`,{className:`signup__title`,children:[`Meet your new`,(0,f.jsx)(`br`,{}),(0,f.jsx)(p,{words:m})]}),(0,f.jsx)(`p`,{className:`signup__subtitle`,children:`The most powerful assistant that can handle your work and life admin tasks.`}),(0,f.jsx)(`div`,{className:`signup__buttons`,children:(0,f.jsx)(`button`,{type:`button`,className:`signup__btn`,onClick:()=>{r(null),t(a,i,{returnTo:e,intent:`signup`}).catch(e=>{console.error(`[signup] auth flow failed:`,e),r(`Something went wrong. Please try again.`)})},children:`Continue`})}),n&&(0,f.jsx)(`p`,{className:`signup__error`,children:n}),(0,f.jsxs)(`p`,{className:`signup__footer`,children:[`Already have an account?`,` `,(0,f.jsx)(`button`,{type:`button`,className:`signup__link`,onClick:()=>{r(null),t(a,o(e),{returnTo:e}).catch(e=>{console.error(`[signup] sign-in flow failed:`,e),r(`Something went wrong. Please try again.`)})},children:`Sign in`})]}),(0,f.jsxs)(`a`,{className:`signup__download`,href:`/downloads`,children:[(0,f.jsx)(l,{size:16}),`Download for macOS`]})]})}function g(){let[e]=r();return(0,f.jsx)(h,{returnTo:e.get(`returnTo`)})}export{g as SignupPage};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-CVSDxk6A.js";import{t}from"./public-asset-Di3QykUd.js";import{t as n}from"./proxy-BzlH_XAe.js";var r=e();function i({children:e}){return(0,r.jsxs)(n.div,{"data-theme":`dark`,className:`signup`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},children:[(0,r.jsxs)(`div`,{className:`signup__left`,children:[(0,r.jsx)(`div`,{className:`signup__logo`,children:(0,r.jsx)(`img`,{src:t(`/vellum-logo-white.svg`),alt:`Vellum`,width:82,height:25})}),(0,r.jsx)(`div`,{className:`signup__form`,children:e})]}),(0,r.jsx)(n.div,{className:`signup__right`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.6,delay:.15},"aria-hidden":!0,children:(0,r.jsx)(`video`,{className:`signup__video`,src:t(`/vellum-scene-cut.mp4`),autoPlay:!0,loop:!0,muted:!0,playsInline:!0})})]})}export{i as t};
1
+ import{t as e}from"./jsx-runtime-CVSDxk6A.js";import{t}from"./public-asset-GKv5zCfZ.js";import{t as n}from"./proxy-o6cPThl2.js";var r=e();function i({children:e}){return(0,r.jsxs)(n.div,{"data-theme":`dark`,className:`signup`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.5},children:[(0,r.jsxs)(`div`,{className:`signup__left`,children:[(0,r.jsx)(`div`,{className:`signup__logo`,children:(0,r.jsx)(`img`,{src:t(`/vellum-logo-white.svg`),alt:`Vellum`,width:82,height:25})}),(0,r.jsx)(`div`,{className:`signup__form`,children:e})]}),(0,r.jsx)(n.div,{className:`signup__right`,initial:{opacity:0},animate:{opacity:1},transition:{duration:.6,delay:.15},"aria-hidden":!0,children:(0,r.jsx)(`video`,{className:`signup__video`,src:t(`/vellum-scene-cut.mp4`),autoPlay:!0,loop:!0,muted:!0,playsInline:!0})})]})}export{i as t};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{n}from"./button-amTXFI-2.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-D5f7kt80.js";import{gt as a,ht as o,m as s,mt as c,p as l,pt as u}from"./risk-Dsj4oM8c.js";import{t as d}from"./brain-BLDXGaUy.js";import{t as f}from"./check-DFNrQERi.js";import{t as p}from"./circle-alert-zOqdmf25.js";import{t as m}from"./circle-check-VSiny8yl.js";import{t as h}from"./code-Czx7d7SK.js";import{t as g}from"./file-text-CYJz-GvF.js";import{t as _}from"./globe-4qSOWE2N.js";import{t as v}from"./monitor-DfbL8_59.js";import{t as y}from"./sparkles-PGiR5v1g.js";import{t as ee}from"./triangle-alert-Z0Gq0IuB.js";import{t as b}from"./user-plus-DMh4_UTz.js";import"./src-B2IjVySQ.js";import{t as x}from"./popover-CFL4WZTr.js";import{T as te,w as S}from"./chat-B8mgARYR.js";import{t as C}from"./misc-BYQPh7vS.js";import{t as ne}from"./proxy-BzlH_XAe.js";import{t as re}from"./AnimatePresence-C8APSgIu.js";import{t as ie}from"./use-reduced-motion-CcGT6CHV.js";import{t as ae}from"./three-dot-indicator-BVtP8eei.js";var w=e(t(),1),oe=.44;function se(e,t){let n=[...e].sort((e,t)=>e.position-t.position),r=n[0]?.color??`white`,i=n[n.length-1]?.color??`white`,a=n.map(e=>{let t=(e.position-.5)*2*oe;return`${e.color} calc(50% + var(--gs-spread-mid) * ${t.toFixed(4)})`}).join(`, `);return[`linear-gradient(${t}deg`,`var(--gs-base) calc(50% - var(--gs-spread))`,`color-mix(in oklab, var(--gs-base) 42%, ${r}) calc(50% - var(--gs-spread-mid))`,a,`color-mix(in oklab, var(--gs-base) 42%, ${i}) calc(50% + var(--gs-spread-mid))`,`var(--gs-base) calc(50% + var(--gs-spread)))`].join(`, `)}var T={sunrise:[{color:`#B6D3EF`,position:0},{color:`#CAD1D7`,position:.153},{color:`#D7CFC8`,position:.252},{color:`#E1CDB9`,position:.341},{color:`#EAC6A5`,position:.424},{color:`#EDB185`,position:.505},{color:`#EF9B62`,position:.586},{color:`#F18F60`,position:.669},{color:`#F48D7A`,position:.758},{color:`#F78A94`,position:.857},{color:`#F888A0`,position:1}],bubble:[{color:`#F5EBD9`,position:0},{color:`#F2D4DB`,position:.31},{color:`#EBBDDE`,position:.5},{color:`#CCBAE3`,position:.65},{color:`#8CBFF0`,position:.82},{color:`#78B0FF`,position:1}],peach:[{color:`#D9F5FA`,position:0},{color:`#FCD9D6`,position:.31},{color:`#FCBAC9`,position:.61},{color:`#F0B3F5`,position:1}],tonic:[{color:`#E3EDF0`,position:0},{color:`#E8EBB8`,position:.27},{color:`#F0DEA3`,position:.43},{color:`#E8B078`,position:.75},{color:`#F29682`,position:1}],mint:[{color:`#DECEE8`,position:0},{color:`#CBBAEE`,position:.21},{color:`#7DC0FB`,position:.46},{color:`#00C7A6`,position:1}],spring:[{color:`#F7D5C5`,position:.07},{color:`#46A8C0`,position:.58},{color:`#43AE7D`,position:1}],twilight:[{color:`#E3CCE6`,position:0},{color:`#4E8CD5`,position:.35},{color:`#6068C2`,position:.64},{color:`#38364E`,position:1}],bay:[{color:`#DBE3D0`,position:0},{color:`#8DB8A7`,position:.23},{color:`#2D8E9A`,position:.42},{color:`#076492`,position:.59},{color:`#154288`,position:.79},{color:`#262C81`,position:1}]},ce={smooth:`cubic-bezier(0.45, 0, 0.55, 1)`,gentle:`cubic-bezier(0.76, 0, 0.24, 1)`,snappy:`cubic-bezier(0.3, 0, 0.2, 1)`};function le(){return typeof window>`u`?!0:typeof window.CSS?.supports==`function`?window.CSS.supports(`background-clip`,`text`)||window.CSS.supports(`-webkit-background-clip`,`text`):!1}function ue(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var de=`160px`,fe=120;function pe(e,{pauseOnScroll:t,pauseWhenOffscreen:n},r){if(typeof window>`u`)return()=>{};let i=!n||typeof IntersectionObserver>`u`,a=typeof document>`u`?!0:!document.hidden,o=!0,s=()=>r(i&&a&&o),c;n&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(e=>{let t=e[e.length-1];t&&(i=t.isIntersecting,s())},{rootMargin:de}),c.observe(e));let l=()=>{a=!document.hidden,s()};document.addEventListener(`visibilitychange`,l);let u,d=()=>{o=!1,s(),clearTimeout(u),u=setTimeout(()=>{o=!0,s()},fe)};return t&&window.addEventListener(`scroll`,d,{passive:!0,capture:!0}),s(),()=>{c?.disconnect(),document.removeEventListener(`visibilitychange`,l),t&&window.removeEventListener(`scroll`,d,{capture:!0}),clearTimeout(u)}}var me=96,E=48,D=.72,O=14,he=1.45,ge=3,k=105;function _e(e){return e?typeof e==`string`?T[e]??T.sunrise:e:T.sunrise}function A(e,t){return Number.isFinite(e)?e:t}function ve(e){e.style.removeProperty(`background-image`),e.style.removeProperty(`-webkit-text-fill-color`)}function ye({children:e,gradient:t,easing:n=`smooth`,duration:r=he,spread:i=ge,angle:a=k,pauseBetween:o=1e3,baseColor:s=`currentColor`,pauseOnScroll:c=!0,pauseWhenOffscreen:l=!0,respectReducedMotion:u=!0,as:d=`span`,className:f,style:p,...m}){let h=(0,w.useRef)(null),g=Math.max(.001,A(r,he)),_=Math.max(0,A(i,ge)),v=A(a,k),y=(0,w.useMemo)(()=>_e(t),[t]),ee=(0,w.useMemo)(()=>se(y,v),[y,v]),b=ce[n]??ce.smooth,x=Math.min(e.length*_,E);(0,w.useEffect)(()=>{let t=h.current;if(!t)return;let n=()=>{let n=t.getBoundingClientRect().width||me,r=(Number.parseFloat(getComputedStyle(t).fontSize)||O)/O,i=Math.min(e.length*_*r,E*r),a=Math.max(1,n+i*2),o=-i-a/2,s=n+i-a/2,c=g*1e3;return t.style.setProperty(`--gs-spread`,`${i}px`),t.style.setProperty(`--gs-spread-mid`,`${i*D}px`),t.style.backgroundSize=`${a}px 100%`,{start:o,end:s,durationMs:c}};if(!le()){ve(t);return}if(n(),u&&ue()||typeof t.animate!=`function`)return;let r=null,i,a=!0,s=!1,d=()=>{if(s)return;let{start:e,end:c,durationMs:l}=n(),u=t.animate([{backgroundPosition:`${e}px center`},{backgroundPosition:`${c}px center`}],{duration:l,easing:b,fill:`forwards`});a||u.pause(),r?.cancel(),r=u,u.onfinish=()=>{i=setTimeout(d,Math.max(0,o))}},f=pe(t,{pauseOnScroll:c,pauseWhenOffscreen:l},e=>{a=e,r&&(a?r.play():r.pause())});return d(),()=>{s=!0,r?.cancel(),clearTimeout(i),f()}},[e,_,g,b,o,c,l,u]);let te={position:`relative`,display:`inline-block`,backgroundImage:ee,backgroundRepeat:`no-repeat`,backgroundSize:`100% 100%`,backgroundColor:`var(--gs-base)`,WebkitBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,"--gs-base":s,"--gs-spread":`${x}px`,"--gs-spread-mid":`${x*D}px`,...p};return(0,w.createElement)(d,{...m,ref:h,className:f,style:te},e)}var j=r();function be(e){let t=`color-mix(in srgb, ${e} 40%, white)`;return[{position:0,color:t},{position:.5,color:e},{position:1,color:t}]}var xe=`var(--avatar-accent, var(--content-emphasised))`;function M({children:e,colorHex:t,className:n,"data-testid":r}){let i=t??xe;return(0,j.jsx)(ye,{gradient:(0,w.useMemo)(()=>be(i),[i]),easing:`gentle`,duration:1.5,spread:6,angle:106,pauseBetween:0,pauseOnScroll:!1,baseColor:`color-mix(in srgb, currentColor 45%, transparent)`,className:n,"data-testid":r,children:e})}var Se=400;function Ce(e,t,n){let[r,i]=(0,w.useState)(e),a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(Object.is(r,e)){o.current=null;return}if(n){s.current&&=(clearTimeout(s.current),null),o.current=null,i(e),a.current=Date.now();return}o.current=e;let c=Date.now();a.current===null&&(a.current=c);let l=c-a.current,u=Math.max(0,t-l);return s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current!==null&&(i(o.current),a.current=Date.now(),o.current=null),s.current=null},u),()=>{s.current&&=(clearTimeout(s.current),null)}},[e,r,t,n]),r}function we({currentStepTitle:e,currentStepInfo:t,bypassDwell:n=!1,animationKey:r,shimmer:a=!1,inline:o=!1}){let s=ie(),c=Ce((0,w.useMemo)(()=>({title:e,info:t}),[e,t]),Se,n),l=s?{duration:0}:{duration:.25,ease:[.16,1,.3,1]},u=s?{opacity:0}:{y:-16,opacity:0},d=s?{opacity:1}:{y:0,opacity:1},f=s?{opacity:0}:{y:16,opacity:0},p=typeof c.info==`string`||typeof c.info==`number`,m=p?String(c.info):c.info==null?``:`node`,h=r??`${c.title}::${m}`,g=p?c.info!==``:c.info!=null,_=c.title.trim()!==``;return(0,j.jsx)(re,{initial:!1,mode:`popLayout`,children:(0,j.jsxs)(ne.span,{initial:u,animate:d,exit:f,transition:l,className:`flex min-w-0 flex-1 items-center gap-1`,children:[_?o?(0,j.jsx)(`span`,{className:g?`shrink-0 whitespace-nowrap text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a?(0,j.jsx)(M,{children:c.title}):c.title}):(0,j.jsx)(i,{variant:`body-medium-default`,className:g?`ml-1 shrink-0 whitespace-nowrap text-[var(--content-emphasised)]`:`ml-1 block min-w-0 flex-1 truncate text-left text-[var(--content-emphasised)]`,children:a?(0,j.jsx)(M,{children:c.title}):c.title}):null,g?(0,j.jsxs)(j.Fragment,{children:[_?(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 h-3.5 w-px shrink-0 bg-[var(--border-element)]`}):null,p?o&&!_?(0,j.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a&&typeof c.info==`string`?(0,j.jsx)(M,{children:c.info}):c.info}):(0,j.jsx)(i,{variant:_?`body-small-default`:`body-medium-default`,className:`ml-1 block min-w-0 flex-1 truncate text-left leading-[16px] ${_?`text-[var(--content-tertiary)]`:`text-[var(--content-emphasised)]`}`,children:a&&!_&&typeof c.info==`string`?(0,j.jsx)(M,{children:c.info}):c.info}):(0,j.jsx)(`span`,{className:`ml-1 block min-w-0 flex-1`,children:c.info})]}):null]},h)})}var Te=/^https?:\/\/\S+/,Ee=/^URL:\s*(https?:\/\/\S+)/i,De=/^\[\d+\]\s*(https?:\/\/\S+)/;function N(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function Oe(e){let t=e.trim();return Ee.exec(t)?.[1]??De.exec(t)?.[1]??t}function ke(e){return e.trim().replace(/^\d+\.\s+/,``)}function Ae(e){let t=e.split(/\r?\n/),n=[],r=new Set,i=``;for(let e of t){let t=e.trim();if(!t){i=``;continue}let a=Oe(t);if(Te.test(a)){r.has(a)||(r.add(a),n.push({title:i,url:a})),i=``;continue}/^Web search results for /i.test(t)||/^Sources:?$/i.test(t)||(i=ke(t))}return n}function P(e){return!e||!e.trim()?[]:Ae(e).map((e,t)=>{let n=N(e.url);return{rank:t+1,title:e.title,url:e.url,domain:n}})}var F=5,je=new Set([`web_search`,`web_fetch`]);function I(e){if(!Number.isFinite(e)||e<1e3)return`<1s`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function L(e){return je.has(e.name)}function R(e){return e?`Searched the web`:`Searching the web`}function z(e){return{visible:e.slice(0,F),overflowResults:e.slice(F)}}function Me(e,t){let{visible:n,overflowResults:r}=z(e.results);return{kind:`web_search`,title:R(t),durationLabel:I(e.durationMs),linkCount:e.resultCount,results:n,overflowResults:r}}function Ne(e){let t=e.title??e.domain;return{kind:`thinking`,durationLabel:I(e.durationMs),text:`Reading ${t}`}}function Pe(){return{kind:`web_search`,title:`Searching the web`,durationLabel:``,linkCount:0,results:[]}}function Fe(){return{kind:`thinking`,durationLabel:``,text:`Reading…`}}function Ie(e){let t=P(e);if(t.length===0)return null;let{visible:n,overflowResults:r}=z(t);return{kind:`web_search`,title:R(!0),durationLabel:``,linkCount:t.length,results:n,overflowResults:r}}function Le(e){return{kind:`web_search_error`,title:`Web search failed`,durationLabel:I(e.durationMs),errorMessage:e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`}}function B(){return{kind:`web_search`,title:R(!0),durationLabel:``,linkCount:0,results:[]}}function V(e,t){return t[e.id]??e.activityMetadata}function H(e){return!S(e)}function U(e,t){return e.results.length>0?!1:!!e.errorMessage||!!t.isError}function W(e){return e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:e.isError?`error`:S(e)?`running`:`completed`}function G(e,t){return e==null||t==null?null:Math.max(0,t-e)}function K(e,t){let n=G(e,t);return n==null?``:I(n)}function q(e){return K(e.startedAt??void 0,e.completedAt??void 0)}function Re(e){return!l(e)&&S(e)}function ze(e,t){if(e.kind===`thinking`)return e.text?e.completedAt==null?e.startedAt!=null&&t!=null?Math.max(0,t-e.startedAt):null:G(e.startedAt,e.completedAt):null;let n=e.toolCall;if(l(n))return null;let r=te(n);return n.completedAt==null?S(n)&&r!=null&&t!=null?Math.max(0,t-r):null:G(r,n.completedAt)}function Be(e){return e.some(e=>e.kind===`thinking`?!!e.text&&e.startedAt!=null&&e.completedAt==null:Re(e.toolCall))}function Ve(e,t){let n=0,r=!1;for(let i of e){let e=ze(i,t);e!=null&&(r=!0,n+=e)}return r?I(n):``}function He(e){let{title:t,activity:n}=s(e);return{toolCallId:e.id,toolName:e.name,title:t,activity:n,input:e.input??{},result:e.result,streamedOutput:e.streamedOutput,status:W(e),riskLevel:e.riskLevel,riskReason:e.riskReason,durationLabel:q(e)}}function Ue(e){let{title:t,info:n,activity:r,iconName:i}=s(e);return{kind:`tool`,durationLabel:q(e),startedAt:e.startedAt??void 0,title:t,info:n,activity:r,riskLevel:e.riskLevel,iconName:i,toolCallId:e.id,status:W(e)}}function We(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(L(r)){let e=V(r,t),n=H(r);if(e?.webSearch&&U(e.webSearch,r))return`Web search failed`;if(r.name===`web_search`)return R(n);if(r.name===`web_fetch`)return`Thinking`}else return s(r).title}return``}function Ge(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!L(r)){let{info:e,activity:t}=s(r);return t||e}let i=V(r,t),a=H(r);if(i?.webSearch){let e=i.webSearch;if(U(e,r))return e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`;if(e.results.length>0)return e.results[e.results.length-1].title;if(!a&&e.query)return`Searching ${e.query}`}if(i?.webFetch){let e=i.webFetch;return a?e.title??e.domain:`Reading ${e.domain}`}if(r.name===`web_search`){if(!a){let e=typeof r.input?.query==`string`?r.input.query.trim():``;return e?`Searching ${e}`:``}if(typeof r.result==`string`){let e=P(r.result);if(e.length>0){let t=e[e.length-1].title;if(t)return t}}}if(r.name===`web_fetch`){let e=typeof r.input?.url==`string`?r.input.url:``,t=e?N(e):``;if(t)return a?t:`Reading ${t}`}}return``}function Ke(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.name!==`web_search`)continue;let i=V(r,t)?.webSearch?.results;if(i&&i.length>0)return i}return[]}function qe(e){return e.includes(`denied`)?`denied`:e.includes(`loading`)?`loading`:e.includes(`error`)?`error`:`complete`}function Je(e){return qe(e.map(e=>e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:S(e)?`loading`:e.isError?`error`:`complete`))}function Ye(e,t){if(l(e))return null;if(!L(e))return Ue(e);let n=V(e,t),r=H(e);if(n?.webSearch){let t=n.webSearch;return U(t,e)?Le(t):Me(t,r)}return n?.webFetch?Ne(n.webFetch):r?e.name===`web_search`&&typeof e.result==`string`?Ie(e.result)??B():B():e.name===`web_search`?Pe():Fe()}function Xe(e,t,n){let r=e.filter(e=>e.kind===`toolCall`).map(e=>e.toolCall).filter(e=>!l(e)),i=[],a=null,o=0;for(let n of e){if(n.kind===`thinking`){n.text&&(i.push({kind:`thinking`,durationLabel:K(n.startedAt,n.completedAt),text:n.text,startedAt:n.startedAt,completedAt:n.completedAt,thinkingItemIndex:o++}),a=n.text);continue}let e=Ye(n.toolCall,t);e&&(i.push(e),a=null)}let s=Je(r),c,u,d;a===null?(c=We(r,t),u=Ge(r,t),d=`tool`):(c=`Thinking`,u=a,d=`thinking`);let f=Ke(r,t),p=`${i.length} step${i.length===1?``:`s`}`,m=Ve(e,n);return{currentStepTitle:c,currentStepInfo:u,currentStepKind:d,stepCount:p,totalDurationLabel:m,steps:i,state:s,carouselItems:f}}var J={code:h,terminal:u,file:g,globe:_,pen:o,monitor:v,plug:c,sparkle:y,"user-plus":b,bolt:a,brain:d};function Ze(e){if(e.kind===`thinking`)return`Thinking`;if(e.kind===`web_search`||e.kind===`web_search_error`)return`Searching the web`;if(e.kind===`tool_error`)return`Error`;let t=e.title;return t.startsWith(`Working`)?t:t===`Reading`||t===`Editing`||t.startsWith(`Running`)?`Working`:t===`Using a skill`?`Using a skill`:(t.startsWith(`Using `),t)}function Qe(e){if(!e||e===`<1s`)return 0;let t=/^(\d+)(s|m|h)$/.exec(e);if(!t)return 0;let n=Number(t[1]);switch(t[2]){case`h`:return n*36e5;case`m`:return n*6e4;default:return n*1e3}}function $e(e){let t=null;for(let n of e)(n.kind===`tool`||n.kind===`thinking`)&&n.startedAt!=null&&(t=t==null?n.startedAt:Math.min(t,n.startedAt));return t}function et(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function tt({durationLabel:e,startedAt:t}){let r=(0,j.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:e});return t==null?r:(0,j.jsx)(n,{content:`Started at ${et(t)}`,side:`top`,align:`end`,children:(0,j.jsx)(`span`,{className:`cursor-default`,children:r})})}function Y(e){let t=0,n=!1;for(let r of e)r&&(n=!0,t+=Qe(r));return n?I(t):``}function X(e){if(e.length===0)return`running`;let t=!1;for(let n of e){if(n.kind===`tool`){if(n.status===`running`)return`running`;(n.status===`error`||n.status===`denied`)&&(t=!0);continue}if(n.kind===`web_search`){if(n.title===`Searching the web`)return`running`;continue}(n.kind===`tool_error`||n.kind===`web_search_error`)&&(t=!0)}return t?`failed`:`completed`}function nt(e){let t=[];for(let n of e){let e=Ze(n),r=t[t.length-1];r&&r.label===e?r.steps.push(n):t.push({label:e,steps:[n]})}return t}function rt({steps:e,renderStep:t,timeline:n=!1}){if(e.length===0)return null;let r=nt(e),i=[],a=0;for(let e of r)i.push(a),a+=e.steps.length;let o=(e,n)=>e.steps.map((e,r)=>{let i=ct(e,n+r);return(0,j.jsx)(w.Fragment,{children:t?t(e):(0,j.jsx)(dt,{step:e})},i)});return n?(0,j.jsx)(`div`,{className:`flex w-full flex-col`,children:r.map((e,t)=>(0,j.jsx)(it,{section:e,baseIndex:i[t],isLast:t===r.length-1,renderSectionSteps:o},`${e.label}-${t}`))}):(0,j.jsx)(`div`,{className:`flex w-full flex-col gap-3`,children:r.map((e,t)=>{let n=Y(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),r=X(e.steps),a=i[t];return(0,j.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`flex flex-col gap-1`,children:[(0,j.jsx)(lt,{label:e.label,durationLabel:n,status:r}),(0,j.jsx)(`div`,{className:`flex min-w-0 flex-col items-start gap-1 pl-[24px]`,children:o(e,a)})]},`${e.label}-${t}`)})})}function it({section:e,baseIndex:t,isLast:n,renderSectionSteps:r}){let a=Y(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),o=X(e.steps),s=e.steps[0]?.kind===`thinking`;return(0,j.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`relative flex flex-col gap-2`,children:[!n&&(0,j.jsx)(at,{}),(0,j.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between gap-2 py-[2px]`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(ot,{status:o,isThinking:s}),(0,j.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e.label})]}),a?(0,j.jsx)(tt,{durationLabel:a,startedAt:$e(e.steps)}):null]}),(0,j.jsx)(`div`,{className:C(`flex min-w-0 flex-col items-start gap-1 pl-[22px]`,!n&&`pb-3`),children:r(e,t)})]})}function at({className:e}){return(0,j.jsx)(`div`,{"aria-hidden":!0,className:C(`absolute bottom-0 left-[6.5px] top-6 w-px bg-[var(--border-element)]`,e)})}function ot({status:e,isThinking:t}){return t?(0,j.jsx)(d,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`thinking`,className:`h-[14px] w-[14px] shrink-0 text-[var(--content-secondary)]`}):(0,j.jsx)(st,{status:e,testId:`phase-header-status-icon`})}function st({status:e,testId:t}){return e===`completed`?(0,j.jsx)(m,{"aria-hidden":`true`,"data-testid":t,"data-status":`completed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-positive-strong)]`}):e===`failed`?(0,j.jsx)(p,{"aria-hidden":`true`,"data-testid":t,"data-status":`failed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-negative-strong)]`}):(0,j.jsx)(ae,{"data-testid":t,className:`shrink-0`})}function ct(e,t){return e.kind===`tool`&&e.toolCallId?e.toolCallId:`${e.kind}-${t}`}function lt({label:e,durationLabel:t,status:n}){return(0,j.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between py-[2px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n===`completed`?(0,j.jsx)(f,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`completed`,className:`h-[14px] w-[14px] text-[var(--system-positive-strong)]`}):n===`failed`?(0,j.jsx)(ee,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`failed`,className:`h-[14px] w-[14px] text-[var(--system-negative-strong)]`}):(0,j.jsx)(ae,{"data-testid":`phase-header-status-icon`,className:`shrink-0`}),(0,j.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]}),t?(0,j.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:t}):null]})}function ut(e){switch(e.kind){case`thinking`:return!0;case`tool`:return e.info.length>0;case`tool_error`:case`web_search_error`:case`web_search`:return!0}}function dt({step:e}){if(e.kind===`thinking`)return(0,j.jsx)(Q,{children:(0,j.jsx)(Z,{children:e.text})});if(e.kind===`tool`){let t=J[e.iconName]??a;return ut(e)?(0,j.jsxs)(Q,{children:[(0,j.jsx)(t,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-secondary)]`}),(0,j.jsx)(Z,{children:e.info})]}):null}return e.kind===`tool_error`?(0,j.jsx)(Q,{tone:`error`,children:(0,j.jsx)(Z,{children:e.message})}):e.kind===`web_search_error`?(0,j.jsx)(Q,{tone:`error`,children:(0,j.jsx)(Z,{children:e.errorMessage})}):(0,j.jsx)(Q,{children:(0,j.jsx)(Z,{children:e.title})})}function Z({children:e}){return(0,j.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit`,children:e})}function Q({tone:e=`default`,children:t}){return(0,j.jsx)(`div`,{"data-testid":`phase-step-pill`,className:`inline-flex min-w-0 max-w-full items-center gap-1 self-start rounded-full border px-2 py-1 ${e===`error`?`border-[var(--system-negative-weak)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] bg-transparent text-[var(--content-default)]`}`,children:t})}var $=`inline-flex min-w-0 items-center gap-1 self-start rounded-full px-2 py-1 text-left leading-normal`,ft=`transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`;function pt(e){return e===`error`?`bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`bg-[var(--surface-overlay)] text-[var(--content-default)]`}function mt({faviconUrl:e,domain:t,label:n}){let[r,i]=(0,w.useState)(!1),a=!!e&&!r,o=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,children:a?(0,j.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>i(!0)}):(0,j.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:o})})}function ht({label:e,url:t,faviconUrl:n,domain:r,tone:a=`default`,ariaLabel:o}){return(0,j.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`tool-step-pill`,"data-variant":`web`,"aria-label":o??`Open ${e}`,className:`${$} ${ft} max-w-[240px] no-underline hover:bg-[var(--surface-active)] ${pt(a)}`,children:[(0,j.jsx)(mt,{faviconUrl:n,domain:r,label:e}),(0,j.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:e})]})}function gt(e){if(e.variant===`web`)return(0,j.jsx)(ht,{...e});let{iconName:t,label:n,onClick:r,tone:o=`default`,active:s=!1,ariaLabel:c}=e,l=s?o===`error`?`bg-[var(--surface-active)] text-[var(--system-negative-strong)]`:`bg-[var(--surface-active)] text-[var(--content-default)]`:o===`error`?`bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`bg-[var(--surface-overlay)] text-[var(--content-default)]`,u=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(J[t]??a,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 ${o===`error`?`text-[var(--system-negative-strong)]`:`text-[var(--content-tertiary)]`}`}),(0,j.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:n})]});return r?(0,j.jsx)(`button`,{type:`button`,"data-testid":`tool-step-pill`,"data-active":s?``:void 0,"aria-pressed":s,"aria-label":c??`View details: ${n}`,onClick:r,className:`${$} ${ft} max-w-full hover:bg-[var(--surface-active)] ${l}`,children:u}):(0,j.jsx)(`span`,{"data-testid":`tool-step-pill`,className:`${$} max-w-full ${l}`,children:u})}function _t(e){let t=(e.domain&&e.domain.length>0?e.domain:e.title).charAt(0);return t?t.toUpperCase():``}function vt({item:e}){let[t,n]=(0,w.useState)(!1),r=!!e.faviconUrl&&!t;return(0,j.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 hover:bg-[var(--surface-hover)]`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-[14px] w-[14px] shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)] bg-[var(--surface-overlay)]`,children:r?(0,j.jsx)(`img`,{src:e.faviconUrl,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>n(!0)}):(0,j.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-default)]`,children:_t(e)})}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,j.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-default)]`,children:e.title}),(0,j.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-secondary)]`,children:e.domain})]})]})}function yt({results:e}){return(0,j.jsxs)(x.Root,{children:[(0,j.jsx)(x.Trigger,{asChild:!0,children:(0,j.jsx)(`button`,{type:`button`,"data-testid":`web-search-overflow-chip`,className:`inline-flex min-h-[26px] cursor-pointer items-center rounded-[var(--radius-pill)] bg-[var(--surface-base)] px-[10px] py-[6px] outline-none hover:bg-[var(--surface-hover)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:(0,j.jsxs)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:[`+`,e.length,` more`]})})}),(0,j.jsx)(x.Content,{align:`start`,side:`bottom`,className:`flex max-h-[260px] w-[280px] flex-col gap-0.5 overflow-y-auto`,children:e.map(e=>(0,j.jsx)(vt,{item:e},e.rank))})]})}function bt({message:e}){return(0,j.jsxs)(`div`,{"data-testid":`web-search-error-chip`,className:`inline-flex items-center gap-1 rounded-[var(--radius-pill)] border border-[var(--system-negative-weak)] bg-[var(--system-negative-weak)] px-[10px] py-[6px]`,children:[(0,j.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center`,children:(0,j.jsx)(p,{className:`h-[14px] w-[14px] text-[var(--system-negative-strong)]`})}),(0,j.jsx)(i,{variant:`body-small-default`,className:`text-[var(--system-negative-strong)]`,children:e})]})}function xt({step:e}){let t=e.overflowResults??[];return(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(e.results??[]).map(e=>(0,j.jsx)(gt,{variant:`web`,url:e.url,faviconUrl:e.faviconUrl,domain:e.domain,label:e.title},e.rank)),t.length>0?(0,j.jsx)(yt,{results:t}):null]})}function St({step:e}){return(0,j.jsx)(bt,{message:e.errorMessage})}function Ct({faviconUrl:e,domain:t,title:n,className:r}){let[i,a]=(0,w.useState)(!1);(0,w.useEffect)(()=>{a(!1)},[e]);let o=!!e&&!i,s=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,j.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`site-favicon`,className:C(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,r),children:o?(0,j.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>a(!0)}):(0,j.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:s})})}export{M as C,we as S,I as _,dt as a,N as b,at as c,X as d,ct as f,Xe as g,je as h,gt as i,ot as l,Y as m,St as n,J as o,ut as p,xt as r,rt as s,Ct as t,nt as u,Be as v,P as x,He as y};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./react-DJZBPgpf.js";import{n}from"./button-amTXFI-2.js";import{t as r}from"./jsx-runtime-CVSDxk6A.js";import{t as i}from"./typography-D5f7kt80.js";import{gt as a,ht as o,m as s,mt as c,p as l,pt as u}from"./risk-Dopd25rc.js";import{t as d}from"./brain-BLDXGaUy.js";import{t as f}from"./check-DFNrQERi.js";import{t as p}from"./circle-alert-zOqdmf25.js";import{t as m}from"./circle-check-VSiny8yl.js";import{t as h}from"./code-Czx7d7SK.js";import{t as g}from"./file-text-CYJz-GvF.js";import{t as _}from"./globe-4qSOWE2N.js";import{t as v}from"./monitor-DfbL8_59.js";import{t as y}from"./sparkles-PGiR5v1g.js";import{t as ee}from"./triangle-alert-Z0Gq0IuB.js";import{t as b}from"./user-plus-DMh4_UTz.js";import"./src-zsLiFPw3.js";import{t as x}from"./popover-CFL4WZTr.js";import{T as te,w as S}from"./chat-B8mgARYR.js";import{t as C}from"./misc-BYQPh7vS.js";import{t as ne}from"./proxy-o6cPThl2.js";import{t as re}from"./AnimatePresence-s1Z1HHWx.js";import{t as ie}from"./use-reduced-motion-Cj0Z8KSf.js";import{t as ae}from"./three-dot-indicator-DNuHHwtA.js";var w=e(t(),1),oe=.44;function se(e,t){let n=[...e].sort((e,t)=>e.position-t.position),r=n[0]?.color??`white`,i=n[n.length-1]?.color??`white`,a=n.map(e=>{let t=(e.position-.5)*2*oe;return`${e.color} calc(50% + var(--gs-spread-mid) * ${t.toFixed(4)})`}).join(`, `);return[`linear-gradient(${t}deg`,`var(--gs-base) calc(50% - var(--gs-spread))`,`color-mix(in oklab, var(--gs-base) 42%, ${r}) calc(50% - var(--gs-spread-mid))`,a,`color-mix(in oklab, var(--gs-base) 42%, ${i}) calc(50% + var(--gs-spread-mid))`,`var(--gs-base) calc(50% + var(--gs-spread)))`].join(`, `)}var T={sunrise:[{color:`#B6D3EF`,position:0},{color:`#CAD1D7`,position:.153},{color:`#D7CFC8`,position:.252},{color:`#E1CDB9`,position:.341},{color:`#EAC6A5`,position:.424},{color:`#EDB185`,position:.505},{color:`#EF9B62`,position:.586},{color:`#F18F60`,position:.669},{color:`#F48D7A`,position:.758},{color:`#F78A94`,position:.857},{color:`#F888A0`,position:1}],bubble:[{color:`#F5EBD9`,position:0},{color:`#F2D4DB`,position:.31},{color:`#EBBDDE`,position:.5},{color:`#CCBAE3`,position:.65},{color:`#8CBFF0`,position:.82},{color:`#78B0FF`,position:1}],peach:[{color:`#D9F5FA`,position:0},{color:`#FCD9D6`,position:.31},{color:`#FCBAC9`,position:.61},{color:`#F0B3F5`,position:1}],tonic:[{color:`#E3EDF0`,position:0},{color:`#E8EBB8`,position:.27},{color:`#F0DEA3`,position:.43},{color:`#E8B078`,position:.75},{color:`#F29682`,position:1}],mint:[{color:`#DECEE8`,position:0},{color:`#CBBAEE`,position:.21},{color:`#7DC0FB`,position:.46},{color:`#00C7A6`,position:1}],spring:[{color:`#F7D5C5`,position:.07},{color:`#46A8C0`,position:.58},{color:`#43AE7D`,position:1}],twilight:[{color:`#E3CCE6`,position:0},{color:`#4E8CD5`,position:.35},{color:`#6068C2`,position:.64},{color:`#38364E`,position:1}],bay:[{color:`#DBE3D0`,position:0},{color:`#8DB8A7`,position:.23},{color:`#2D8E9A`,position:.42},{color:`#076492`,position:.59},{color:`#154288`,position:.79},{color:`#262C81`,position:1}]},ce={smooth:`cubic-bezier(0.45, 0, 0.55, 1)`,gentle:`cubic-bezier(0.76, 0, 0.24, 1)`,snappy:`cubic-bezier(0.3, 0, 0.2, 1)`};function le(){return typeof window>`u`?!0:typeof window.CSS?.supports==`function`?window.CSS.supports(`background-clip`,`text`)||window.CSS.supports(`-webkit-background-clip`,`text`):!1}function ue(){return typeof window<`u`&&typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}var de=`160px`,fe=120;function pe(e,{pauseOnScroll:t,pauseWhenOffscreen:n},r){if(typeof window>`u`)return()=>{};let i=!n||typeof IntersectionObserver>`u`,a=typeof document>`u`?!0:!document.hidden,o=!0,s=()=>r(i&&a&&o),c;n&&typeof IntersectionObserver<`u`&&(c=new IntersectionObserver(e=>{let t=e[e.length-1];t&&(i=t.isIntersecting,s())},{rootMargin:de}),c.observe(e));let l=()=>{a=!document.hidden,s()};document.addEventListener(`visibilitychange`,l);let u,d=()=>{o=!1,s(),clearTimeout(u),u=setTimeout(()=>{o=!0,s()},fe)};return t&&window.addEventListener(`scroll`,d,{passive:!0,capture:!0}),s(),()=>{c?.disconnect(),document.removeEventListener(`visibilitychange`,l),t&&window.removeEventListener(`scroll`,d,{capture:!0}),clearTimeout(u)}}var me=96,E=48,D=.72,O=14,he=1.45,ge=3,k=105;function _e(e){return e?typeof e==`string`?T[e]??T.sunrise:e:T.sunrise}function A(e,t){return Number.isFinite(e)?e:t}function ve(e){e.style.removeProperty(`background-image`),e.style.removeProperty(`-webkit-text-fill-color`)}function ye({children:e,gradient:t,easing:n=`smooth`,duration:r=he,spread:i=ge,angle:a=k,pauseBetween:o=1e3,baseColor:s=`currentColor`,pauseOnScroll:c=!0,pauseWhenOffscreen:l=!0,respectReducedMotion:u=!0,as:d=`span`,className:f,style:p,...m}){let h=(0,w.useRef)(null),g=Math.max(.001,A(r,he)),_=Math.max(0,A(i,ge)),v=A(a,k),y=(0,w.useMemo)(()=>_e(t),[t]),ee=(0,w.useMemo)(()=>se(y,v),[y,v]),b=ce[n]??ce.smooth,x=Math.min(e.length*_,E);(0,w.useEffect)(()=>{let t=h.current;if(!t)return;let n=()=>{let n=t.getBoundingClientRect().width||me,r=(Number.parseFloat(getComputedStyle(t).fontSize)||O)/O,i=Math.min(e.length*_*r,E*r),a=Math.max(1,n+i*2),o=-i-a/2,s=n+i-a/2,c=g*1e3;return t.style.setProperty(`--gs-spread`,`${i}px`),t.style.setProperty(`--gs-spread-mid`,`${i*D}px`),t.style.backgroundSize=`${a}px 100%`,{start:o,end:s,durationMs:c}};if(!le()){ve(t);return}if(n(),u&&ue()||typeof t.animate!=`function`)return;let r=null,i,a=!0,s=!1,d=()=>{if(s)return;let{start:e,end:c,durationMs:l}=n(),u=t.animate([{backgroundPosition:`${e}px center`},{backgroundPosition:`${c}px center`}],{duration:l,easing:b,fill:`forwards`});a||u.pause(),r?.cancel(),r=u,u.onfinish=()=>{i=setTimeout(d,Math.max(0,o))}},f=pe(t,{pauseOnScroll:c,pauseWhenOffscreen:l},e=>{a=e,r&&(a?r.play():r.pause())});return d(),()=>{s=!0,r?.cancel(),clearTimeout(i),f()}},[e,_,g,b,o,c,l,u]);let te={position:`relative`,display:`inline-block`,backgroundImage:ee,backgroundRepeat:`no-repeat`,backgroundSize:`100% 100%`,backgroundColor:`var(--gs-base)`,WebkitBackgroundClip:`text`,backgroundClip:`text`,WebkitTextFillColor:`transparent`,"--gs-base":s,"--gs-spread":`${x}px`,"--gs-spread-mid":`${x*D}px`,...p};return(0,w.createElement)(d,{...m,ref:h,className:f,style:te},e)}var j=r();function be(e){let t=`color-mix(in srgb, ${e} 40%, white)`;return[{position:0,color:t},{position:.5,color:e},{position:1,color:t}]}var xe=`var(--avatar-accent, var(--content-emphasised))`;function M({children:e,colorHex:t,className:n,"data-testid":r}){let i=t??xe;return(0,j.jsx)(ye,{gradient:(0,w.useMemo)(()=>be(i),[i]),easing:`gentle`,duration:1.5,spread:6,angle:106,pauseBetween:0,pauseOnScroll:!1,baseColor:`color-mix(in srgb, currentColor 45%, transparent)`,className:n,"data-testid":r,children:e})}var Se=400;function Ce(e,t,n){let[r,i]=(0,w.useState)(e),a=(0,w.useRef)(null),o=(0,w.useRef)(null),s=(0,w.useRef)(null);return(0,w.useEffect)(()=>{if(Object.is(r,e)){o.current=null;return}if(n){s.current&&=(clearTimeout(s.current),null),o.current=null,i(e),a.current=Date.now();return}o.current=e;let c=Date.now();a.current===null&&(a.current=c);let l=c-a.current,u=Math.max(0,t-l);return s.current&&clearTimeout(s.current),s.current=setTimeout(()=>{o.current!==null&&(i(o.current),a.current=Date.now(),o.current=null),s.current=null},u),()=>{s.current&&=(clearTimeout(s.current),null)}},[e,r,t,n]),r}function we({currentStepTitle:e,currentStepInfo:t,bypassDwell:n=!1,animationKey:r,shimmer:a=!1,inline:o=!1}){let s=ie(),c=Ce((0,w.useMemo)(()=>({title:e,info:t}),[e,t]),Se,n),l=s?{duration:0}:{duration:.25,ease:[.16,1,.3,1]},u=s?{opacity:0}:{y:-16,opacity:0},d=s?{opacity:1}:{y:0,opacity:1},f=s?{opacity:0}:{y:16,opacity:0},p=typeof c.info==`string`||typeof c.info==`number`,m=p?String(c.info):c.info==null?``:`node`,h=r??`${c.title}::${m}`,g=p?c.info!==``:c.info!=null,_=c.title.trim()!==``;return(0,j.jsx)(re,{initial:!1,mode:`popLayout`,children:(0,j.jsxs)(ne.span,{initial:u,animate:d,exit:f,transition:l,className:`flex min-w-0 flex-1 items-center gap-1`,children:[_?o?(0,j.jsx)(`span`,{className:g?`shrink-0 whitespace-nowrap text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a?(0,j.jsx)(M,{children:c.title}):c.title}):(0,j.jsx)(i,{variant:`body-medium-default`,className:g?`ml-1 shrink-0 whitespace-nowrap text-[var(--content-emphasised)]`:`ml-1 block min-w-0 flex-1 truncate text-left text-[var(--content-emphasised)]`,children:a?(0,j.jsx)(M,{children:c.title}):c.title}):null,g?(0,j.jsxs)(j.Fragment,{children:[_?(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`ml-1 h-3.5 w-px shrink-0 bg-[var(--border-element)]`}):null,p?o&&!_?(0,j.jsx)(`span`,{className:`block min-w-0 flex-1 truncate text-left text-[13px] font-medium leading-[16px] text-[var(--content-secondary)]`,children:a&&typeof c.info==`string`?(0,j.jsx)(M,{children:c.info}):c.info}):(0,j.jsx)(i,{variant:_?`body-small-default`:`body-medium-default`,className:`ml-1 block min-w-0 flex-1 truncate text-left leading-[16px] ${_?`text-[var(--content-tertiary)]`:`text-[var(--content-emphasised)]`}`,children:a&&!_&&typeof c.info==`string`?(0,j.jsx)(M,{children:c.info}):c.info}):(0,j.jsx)(`span`,{className:`ml-1 block min-w-0 flex-1`,children:c.info})]}):null]},h)})}var Te=/^https?:\/\/\S+/,Ee=/^URL:\s*(https?:\/\/\S+)/i,De=/^\[\d+\]\s*(https?:\/\/\S+)/;function N(e){try{return new URL(e).hostname.replace(/^www\./,``)}catch{return``}}function Oe(e){let t=e.trim();return Ee.exec(t)?.[1]??De.exec(t)?.[1]??t}function ke(e){return e.trim().replace(/^\d+\.\s+/,``)}function Ae(e){let t=e.split(/\r?\n/),n=[],r=new Set,i=``;for(let e of t){let t=e.trim();if(!t){i=``;continue}let a=Oe(t);if(Te.test(a)){r.has(a)||(r.add(a),n.push({title:i,url:a})),i=``;continue}/^Web search results for /i.test(t)||/^Sources:?$/i.test(t)||(i=ke(t))}return n}function P(e){return!e||!e.trim()?[]:Ae(e).map((e,t)=>{let n=N(e.url);return{rank:t+1,title:e.title,url:e.url,domain:n}})}var F=5,je=new Set([`web_search`,`web_fetch`]);function I(e){if(!Number.isFinite(e)||e<1e3)return`<1s`;let t=Math.round(e/1e3);if(t<60)return`${t}s`;let n=Math.round(t/60);return n<60?`${n}m`:`${Math.round(n/60)}h`}function L(e){return je.has(e.name)}function R(e){return e?`Searched the web`:`Searching the web`}function z(e){return{visible:e.slice(0,F),overflowResults:e.slice(F)}}function Me(e,t){let{visible:n,overflowResults:r}=z(e.results);return{kind:`web_search`,title:R(t),durationLabel:I(e.durationMs),linkCount:e.resultCount,results:n,overflowResults:r}}function Ne(e){let t=e.title??e.domain;return{kind:`thinking`,durationLabel:I(e.durationMs),text:`Reading ${t}`}}function Pe(){return{kind:`web_search`,title:`Searching the web`,durationLabel:``,linkCount:0,results:[]}}function Fe(){return{kind:`thinking`,durationLabel:``,text:`Reading…`}}function Ie(e){let t=P(e);if(t.length===0)return null;let{visible:n,overflowResults:r}=z(t);return{kind:`web_search`,title:R(!0),durationLabel:``,linkCount:t.length,results:n,overflowResults:r}}function Le(e){return{kind:`web_search_error`,title:`Web search failed`,durationLabel:I(e.durationMs),errorMessage:e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`}}function B(){return{kind:`web_search`,title:R(!0),durationLabel:``,linkCount:0,results:[]}}function V(e,t){return t[e.id]??e.activityMetadata}function H(e){return!S(e)}function U(e,t){return e.results.length>0?!1:!!e.errorMessage||!!t.isError}function W(e){return e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:e.isError?`error`:S(e)?`running`:`completed`}function G(e,t){return e==null||t==null?null:Math.max(0,t-e)}function K(e,t){let n=G(e,t);return n==null?``:I(n)}function q(e){return K(e.startedAt??void 0,e.completedAt??void 0)}function Re(e){return!l(e)&&S(e)}function ze(e,t){if(e.kind===`thinking`)return e.text?e.completedAt==null?e.startedAt!=null&&t!=null?Math.max(0,t-e.startedAt):null:G(e.startedAt,e.completedAt):null;let n=e.toolCall;if(l(n))return null;let r=te(n);return n.completedAt==null?S(n)&&r!=null&&t!=null?Math.max(0,t-r):null:G(r,n.completedAt)}function Be(e){return e.some(e=>e.kind===`thinking`?!!e.text&&e.startedAt!=null&&e.completedAt==null:Re(e.toolCall))}function Ve(e,t){let n=0,r=!1;for(let i of e){let e=ze(i,t);e!=null&&(r=!0,n+=e)}return r?I(n):``}function He(e){let{title:t,activity:n}=s(e);return{toolCallId:e.id,toolName:e.name,title:t,activity:n,input:e.input??{},result:e.result,streamedOutput:e.streamedOutput,status:W(e),riskLevel:e.riskLevel,riskReason:e.riskReason,durationLabel:q(e)}}function Ue(e){let{title:t,info:n,activity:r,iconName:i}=s(e);return{kind:`tool`,durationLabel:q(e),startedAt:e.startedAt??void 0,title:t,info:n,activity:r,riskLevel:e.riskLevel,iconName:i,toolCallId:e.id,status:W(e)}}function We(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(L(r)){let e=V(r,t),n=H(r);if(e?.webSearch&&U(e.webSearch,r))return`Web search failed`;if(r.name===`web_search`)return R(n);if(r.name===`web_fetch`)return`Thinking`}else return s(r).title}return``}function Ge(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(!L(r)){let{info:e,activity:t}=s(r);return t||e}let i=V(r,t),a=H(r);if(i?.webSearch){let e=i.webSearch;if(U(e,r))return e.errorMessage??`Search is having trouble right now. You can try again in a moment, continue without web search, or paste the relevant details here and I'll use those.`;if(e.results.length>0)return e.results[e.results.length-1].title;if(!a&&e.query)return`Searching ${e.query}`}if(i?.webFetch){let e=i.webFetch;return a?e.title??e.domain:`Reading ${e.domain}`}if(r.name===`web_search`){if(!a){let e=typeof r.input?.query==`string`?r.input.query.trim():``;return e?`Searching ${e}`:``}if(typeof r.result==`string`){let e=P(r.result);if(e.length>0){let t=e[e.length-1].title;if(t)return t}}}if(r.name===`web_fetch`){let e=typeof r.input?.url==`string`?r.input.url:``,t=e?N(e):``;if(t)return a?t:`Reading ${t}`}}return``}function Ke(e,t){for(let n=e.length-1;n>=0;n--){let r=e[n];if(r.name!==`web_search`)continue;let i=V(r,t)?.webSearch?.results;if(i&&i.length>0)return i}return[]}function qe(e){return e.includes(`denied`)?`denied`:e.includes(`loading`)?`loading`:e.includes(`error`)?`error`:`complete`}function Je(e){return qe(e.map(e=>e.confirmationDecision===`denied`||e.confirmationDecision===`timed_out`?`denied`:S(e)?`loading`:e.isError?`error`:`complete`))}function Ye(e,t){if(l(e))return null;if(!L(e))return Ue(e);let n=V(e,t),r=H(e);if(n?.webSearch){let t=n.webSearch;return U(t,e)?Le(t):Me(t,r)}return n?.webFetch?Ne(n.webFetch):r?e.name===`web_search`&&typeof e.result==`string`?Ie(e.result)??B():B():e.name===`web_search`?Pe():Fe()}function Xe(e,t,n){let r=e.filter(e=>e.kind===`toolCall`).map(e=>e.toolCall).filter(e=>!l(e)),i=[],a=null,o=0;for(let n of e){if(n.kind===`thinking`){n.text&&(i.push({kind:`thinking`,durationLabel:K(n.startedAt,n.completedAt),text:n.text,startedAt:n.startedAt,completedAt:n.completedAt,thinkingItemIndex:o++}),a=n.text);continue}let e=Ye(n.toolCall,t);e&&(i.push(e),a=null)}let s=Je(r),c,u,d;a===null?(c=We(r,t),u=Ge(r,t),d=`tool`):(c=`Thinking`,u=a,d=`thinking`);let f=Ke(r,t),p=`${i.length} step${i.length===1?``:`s`}`,m=Ve(e,n);return{currentStepTitle:c,currentStepInfo:u,currentStepKind:d,stepCount:p,totalDurationLabel:m,steps:i,state:s,carouselItems:f}}var J={code:h,terminal:u,file:g,globe:_,pen:o,monitor:v,plug:c,sparkle:y,"user-plus":b,bolt:a,brain:d};function Ze(e){if(e.kind===`thinking`)return`Thinking`;if(e.kind===`web_search`||e.kind===`web_search_error`)return`Searching the web`;if(e.kind===`tool_error`)return`Error`;let t=e.title;return t.startsWith(`Working`)?t:t===`Reading`||t===`Editing`||t.startsWith(`Running`)?`Working`:t===`Using a skill`?`Using a skill`:(t.startsWith(`Using `),t)}function Qe(e){if(!e||e===`<1s`)return 0;let t=/^(\d+)(s|m|h)$/.exec(e);if(!t)return 0;let n=Number(t[1]);switch(t[2]){case`h`:return n*36e5;case`m`:return n*6e4;default:return n*1e3}}function $e(e){let t=null;for(let n of e)(n.kind===`tool`||n.kind===`thinking`)&&n.startedAt!=null&&(t=t==null?n.startedAt:Math.min(t,n.startedAt));return t}function et(e){return new Date(e).toLocaleTimeString([],{hour:`numeric`,minute:`2-digit`,second:`2-digit`})}function tt({durationLabel:e,startedAt:t}){let r=(0,j.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:e});return t==null?r:(0,j.jsx)(n,{content:`Started at ${et(t)}`,side:`top`,align:`end`,children:(0,j.jsx)(`span`,{className:`cursor-default`,children:r})})}function Y(e){let t=0,n=!1;for(let r of e)r&&(n=!0,t+=Qe(r));return n?I(t):``}function X(e){if(e.length===0)return`running`;let t=!1;for(let n of e){if(n.kind===`tool`){if(n.status===`running`)return`running`;(n.status===`error`||n.status===`denied`)&&(t=!0);continue}if(n.kind===`web_search`){if(n.title===`Searching the web`)return`running`;continue}(n.kind===`tool_error`||n.kind===`web_search_error`)&&(t=!0)}return t?`failed`:`completed`}function nt(e){let t=[];for(let n of e){let e=Ze(n),r=t[t.length-1];r&&r.label===e?r.steps.push(n):t.push({label:e,steps:[n]})}return t}function rt({steps:e,renderStep:t,timeline:n=!1}){if(e.length===0)return null;let r=nt(e),i=[],a=0;for(let e of r)i.push(a),a+=e.steps.length;let o=(e,n)=>e.steps.map((e,r)=>{let i=ct(e,n+r);return(0,j.jsx)(w.Fragment,{children:t?t(e):(0,j.jsx)(dt,{step:e})},i)});return n?(0,j.jsx)(`div`,{className:`flex w-full flex-col`,children:r.map((e,t)=>(0,j.jsx)(it,{section:e,baseIndex:i[t],isLast:t===r.length-1,renderSectionSteps:o},`${e.label}-${t}`))}):(0,j.jsx)(`div`,{className:`flex w-full flex-col gap-3`,children:r.map((e,t)=>{let n=Y(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),r=X(e.steps),a=i[t];return(0,j.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`flex flex-col gap-1`,children:[(0,j.jsx)(lt,{label:e.label,durationLabel:n,status:r}),(0,j.jsx)(`div`,{className:`flex min-w-0 flex-col items-start gap-1 pl-[24px]`,children:o(e,a)})]},`${e.label}-${t}`)})})}function it({section:e,baseIndex:t,isLast:n,renderSectionSteps:r}){let a=Y(e.steps.map(e=>`durationLabel`in e?e.durationLabel:``)),o=X(e.steps),s=e.steps[0]?.kind===`thinking`;return(0,j.jsxs)(`div`,{"data-testid":`phase-section`,"data-phase-label":e.label,className:`relative flex flex-col gap-2`,children:[!n&&(0,j.jsx)(at,{}),(0,j.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between gap-2 py-[2px]`,children:[(0,j.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,j.jsx)(ot,{status:o,isThinking:s}),(0,j.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e.label})]}),a?(0,j.jsx)(tt,{durationLabel:a,startedAt:$e(e.steps)}):null]}),(0,j.jsx)(`div`,{className:C(`flex min-w-0 flex-col items-start gap-1 pl-[22px]`,!n&&`pb-3`),children:r(e,t)})]})}function at({className:e}){return(0,j.jsx)(`div`,{"aria-hidden":!0,className:C(`absolute bottom-0 left-[6.5px] top-6 w-px bg-[var(--border-element)]`,e)})}function ot({status:e,isThinking:t}){return t?(0,j.jsx)(d,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`thinking`,className:`h-[14px] w-[14px] shrink-0 text-[var(--content-secondary)]`}):(0,j.jsx)(st,{status:e,testId:`phase-header-status-icon`})}function st({status:e,testId:t}){return e===`completed`?(0,j.jsx)(m,{"aria-hidden":`true`,"data-testid":t,"data-status":`completed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-positive-strong)]`}):e===`failed`?(0,j.jsx)(p,{"aria-hidden":`true`,"data-testid":t,"data-status":`failed`,className:`h-[14px] w-[14px] shrink-0 text-[var(--system-negative-strong)]`}):(0,j.jsx)(ae,{"data-testid":t,className:`shrink-0`})}function ct(e,t){return e.kind===`tool`&&e.toolCallId?e.toolCallId:`${e.kind}-${t}`}function lt({label:e,durationLabel:t,status:n}){return(0,j.jsxs)(`div`,{"data-testid":`phase-header`,className:`flex items-center justify-between py-[2px]`,children:[(0,j.jsxs)(`div`,{className:`flex items-center gap-1`,children:[n===`completed`?(0,j.jsx)(f,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`completed`,className:`h-[14px] w-[14px] text-[var(--system-positive-strong)]`}):n===`failed`?(0,j.jsx)(ee,{"aria-hidden":`true`,"data-testid":`phase-header-status-icon`,"data-status":`failed`,className:`h-[14px] w-[14px] text-[var(--system-negative-strong)]`}):(0,j.jsx)(ae,{"data-testid":`phase-header-status-icon`,className:`shrink-0`}),(0,j.jsx)(i,{variant:`body-medium-default`,className:`text-[var(--content-default)]`,children:e})]}),t?(0,j.jsx)(i,{variant:`label-medium-default`,className:`text-[var(--content-tertiary)]`,children:t}):null]})}function ut(e){switch(e.kind){case`thinking`:return!0;case`tool`:return e.info.length>0;case`tool_error`:case`web_search_error`:case`web_search`:return!0}}function dt({step:e}){if(e.kind===`thinking`)return(0,j.jsx)(Q,{children:(0,j.jsx)(Z,{children:e.text})});if(e.kind===`tool`){let t=J[e.iconName]??a;return ut(e)?(0,j.jsxs)(Q,{children:[(0,j.jsx)(t,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 text-[var(--content-secondary)]`}),(0,j.jsx)(Z,{children:e.info})]}):null}return e.kind===`tool_error`?(0,j.jsx)(Q,{tone:`error`,children:(0,j.jsx)(Z,{children:e.message})}):e.kind===`web_search_error`?(0,j.jsx)(Q,{tone:`error`,children:(0,j.jsx)(Z,{children:e.errorMessage})}):(0,j.jsx)(Q,{children:(0,j.jsx)(Z,{children:e.title})})}function Z({children:e}){return(0,j.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit`,children:e})}function Q({tone:e=`default`,children:t}){return(0,j.jsx)(`div`,{"data-testid":`phase-step-pill`,className:`inline-flex min-w-0 max-w-full items-center gap-1 self-start rounded-full border px-2 py-1 ${e===`error`?`border-[var(--system-negative-weak)] bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`border-[var(--border-element)] bg-transparent text-[var(--content-default)]`}`,children:t})}var $=`inline-flex min-w-0 items-center gap-1 self-start rounded-full px-2 py-1 text-left leading-normal`,ft=`transition-colors cursor-pointer focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--border-focus)]`;function pt(e){return e===`error`?`bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`bg-[var(--surface-overlay)] text-[var(--content-default)]`}function mt({faviconUrl:e,domain:t,label:n}){let[r,i]=(0,w.useState)(!1),a=!!e&&!r,o=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,children:a?(0,j.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>i(!0)}):(0,j.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:o})})}function ht({label:e,url:t,faviconUrl:n,domain:r,tone:a=`default`,ariaLabel:o}){return(0,j.jsxs)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,"data-testid":`tool-step-pill`,"data-variant":`web`,"aria-label":o??`Open ${e}`,className:`${$} ${ft} max-w-[240px] no-underline hover:bg-[var(--surface-active)] ${pt(a)}`,children:[(0,j.jsx)(mt,{faviconUrl:n,domain:r,label:e}),(0,j.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:e})]})}function gt(e){if(e.variant===`web`)return(0,j.jsx)(ht,{...e});let{iconName:t,label:n,onClick:r,tone:o=`default`,active:s=!1,ariaLabel:c}=e,l=s?o===`error`?`bg-[var(--surface-active)] text-[var(--system-negative-strong)]`:`bg-[var(--surface-active)] text-[var(--content-default)]`:o===`error`?`bg-[var(--system-negative-weak)] text-[var(--system-negative-strong)]`:`bg-[var(--surface-overlay)] text-[var(--content-default)]`,u=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(J[t]??a,{"aria-hidden":`true`,className:`h-3.5 w-3.5 shrink-0 ${o===`error`?`text-[var(--system-negative-strong)]`:`text-[var(--content-tertiary)]`}`}),(0,j.jsx)(i,{variant:`body-small-default`,className:`min-w-0 truncate text-inherit leading-normal`,children:n})]});return r?(0,j.jsx)(`button`,{type:`button`,"data-testid":`tool-step-pill`,"data-active":s?``:void 0,"aria-pressed":s,"aria-label":c??`View details: ${n}`,onClick:r,className:`${$} ${ft} max-w-full hover:bg-[var(--surface-active)] ${l}`,children:u}):(0,j.jsx)(`span`,{"data-testid":`tool-step-pill`,className:`${$} max-w-full ${l}`,children:u})}function _t(e){let t=(e.domain&&e.domain.length>0?e.domain:e.title).charAt(0);return t?t.toUpperCase():``}function vt({item:e}){let[t,n]=(0,w.useState)(!1),r=!!e.faviconUrl&&!t;return(0,j.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`flex items-center gap-2 rounded-[var(--radius-md)] px-2 py-1.5 hover:bg-[var(--surface-hover)]`,children:[(0,j.jsx)(`span`,{"aria-hidden":`true`,className:`inline-flex h-[14px] w-[14px] shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)] bg-[var(--surface-overlay)]`,children:r?(0,j.jsx)(`img`,{src:e.faviconUrl,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>n(!0)}):(0,j.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-default)]`,children:_t(e)})}),(0,j.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,j.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-default)]`,children:e.title}),(0,j.jsx)(i,{variant:`body-small-default`,className:`truncate text-[var(--content-secondary)]`,children:e.domain})]})]})}function yt({results:e}){return(0,j.jsxs)(x.Root,{children:[(0,j.jsx)(x.Trigger,{asChild:!0,children:(0,j.jsx)(`button`,{type:`button`,"data-testid":`web-search-overflow-chip`,className:`inline-flex min-h-[26px] cursor-pointer items-center rounded-[var(--radius-pill)] bg-[var(--surface-base)] px-[10px] py-[6px] outline-none hover:bg-[var(--surface-hover)] focus-visible:ring-2 focus-visible:ring-[var(--ring)]`,children:(0,j.jsxs)(i,{variant:`body-small-default`,className:`text-[var(--content-default)]`,children:[`+`,e.length,` more`]})})}),(0,j.jsx)(x.Content,{align:`start`,side:`bottom`,className:`flex max-h-[260px] w-[280px] flex-col gap-0.5 overflow-y-auto`,children:e.map(e=>(0,j.jsx)(vt,{item:e},e.rank))})]})}function bt({message:e}){return(0,j.jsxs)(`div`,{"data-testid":`web-search-error-chip`,className:`inline-flex items-center gap-1 rounded-[var(--radius-pill)] border border-[var(--system-negative-weak)] bg-[var(--system-negative-weak)] px-[10px] py-[6px]`,children:[(0,j.jsx)(`span`,{className:`inline-flex h-5 w-5 shrink-0 items-center justify-center`,children:(0,j.jsx)(p,{className:`h-[14px] w-[14px] text-[var(--system-negative-strong)]`})}),(0,j.jsx)(i,{variant:`body-small-default`,className:`text-[var(--system-negative-strong)]`,children:e})]})}function xt({step:e}){let t=e.overflowResults??[];return(0,j.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1`,children:[(e.results??[]).map(e=>(0,j.jsx)(gt,{variant:`web`,url:e.url,faviconUrl:e.faviconUrl,domain:e.domain,label:e.title},e.rank)),t.length>0?(0,j.jsx)(yt,{results:t}):null]})}function St({step:e}){return(0,j.jsx)(bt,{message:e.errorMessage})}function Ct({faviconUrl:e,domain:t,title:n,className:r}){let[i,a]=(0,w.useState)(!1);(0,w.useEffect)(()=>{a(!1)},[e]);let o=!!e&&!i,s=(t&&t.length>0?t:n).charAt(0).toUpperCase();return(0,j.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`site-favicon`,className:C(`inline-flex h-3.5 w-3.5 shrink-0 items-center justify-center overflow-hidden rounded-[var(--radius-sm)]`,r),children:o?(0,j.jsx)(`img`,{src:e,alt:``,loading:`lazy`,referrerPolicy:`no-referrer`,className:`h-full w-full object-contain`,onError:()=>a(!0)}):(0,j.jsx)(`span`,{className:`text-[10px] font-medium leading-none text-[var(--content-tertiary)]`,children:s})})}export{M as C,we as S,I as _,dt as a,N as b,at as c,X as d,ct as f,Xe as g,je as h,gt as i,ot as l,Y as m,St as n,J as o,ut as p,xt as r,rt as s,Ct as t,nt as u,Be as v,P as x,He as y};
@@ -1 +1 @@
1
- import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Dhiismgm.js";import{t as n}from"./react-DJZBPgpf.js";import{F as r,t as i}from"./button-amTXFI-2.js";import{d as a,p as o,r as s,u as c}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as l}from"./QueryClientProvider-DKhXIxGb.js";import{t as u}from"./useQuery-B45lW1Kk.js";import{t as d}from"./jsx-runtime-CVSDxk6A.js";import{t as f}from"./card-Bv5O5juh.js";import{t as p}from"./createLucideIcon-IRfcSUxS.js";import{t as m}from"./arrow-left-DI9551VI.js";import{a as h,i as g,n as _,r as v,s as y,t as b}from"./use-skill-actions-e6TfdF23.js";import{t as x}from"./chevron-down-qD-re7AW.js";import{t as S}from"./menu-Dy5QbnTj.js";import{t as C}from"./code-Czx7d7SK.js";import{t as w}from"./external-link-Dqpx9nRm.js";import{t as T}from"./file-text-CYJz-GvF.js";import{t as E}from"./loader-circle-Cz7opInR.js";import"./src-B2IjVySQ.js";import{n as D}from"./stat-square-CTHnQ1jc.js";import{n as O,t as k}from"./file-markdown-BXUvAQ24.js";import{St as A,bt as j,on as M}from"./react-query.gen-C6wVk6Rw.js";import{c as N}from"./routes-BbeIx_F9.js";import{Na as P,ca as F,da as I,vr as L,yi as R}from"./index-CSefSVJO.js";import{t as z}from"./use-active-assistant-id-BNRMo_Mi.js";import{n as B,t as V}from"./use-skill-detail-files-Cu4nrHPA.js";import{n as H,r as U,t as ee}from"./skills-CSlvOB79.js";import{t as te}from"./use-edge-swipe-back-AcKDuMrX.js";import{i as W,n as G,r as K,t as q}from"./file-editor-BbrbkQCm.js";import{t as J}from"./skill-icon-CEEEqpSq.js";var Y=p(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),X=e(n(),1),Z=d();function ne({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,sourceConversationId:c}){let l=h(t),u=H(t),{fileEntries:d,setSelectedPath:p,activePath:g,activeFile:_,isFilesLoading:v,fileContent:b,isBinary:x,isContentLoading:S}=V(e,t.id);return(0,Z.jsxs)(`div`,{className:`flex h-[calc(100vh-14rem)] flex-col`,children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,Z.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,Z.jsx)(m,{"aria-hidden":!0}),"aria-label":`Back to skills`,onClick:n}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,Z.jsx)(J,{skill:t,className:`h-8 w-8 text-3xl`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t.name}),(0,Z.jsx)(y,{origin:t.origin})]}),(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}),(0,Z.jsx)(B,{skill:{origin:t.origin,sourceConversationId:c},className:`mt-1`})]})]}),l?o?(0,Z.jsx)(`div`,{className:`flex h-9 items-center px-3`,children:(0,Z.jsx)(E,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):(0,Z.jsx)(i,{type:`button`,onClick:r,disabled:!r,leftIcon:(0,Z.jsx)(P,{"aria-hidden":!0}),children:`Install`}):(0,Z.jsx)(i,{type:`button`,variant:u?`dangerOutline`:`outlined`,onClick:a,disabled:!u||s||!a,leftIcon:s?(0,Z.jsx)(E,{className:`animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),children:`Remove`})]})]}),(0,Z.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden sm:grid`,style:{gridTemplateColumns:`240px 1fr`},children:[(0,Z.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto border-b p-2 sm:max-h-none sm:border-b-0 sm:border-r`,style:{borderColor:`var(--border-base)`},children:v?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Z.jsx)(E,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):d.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files available.`}):d.map(e=>{let t=g===e.path,n=(e.mimeType??``).endsWith(`/directory`);return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(e.path),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:t?`var(--primary-base)`:`var(--content-default)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:void 0},children:[n?(0,Z.jsx)(F,{className:`h-4 w-4 shrink-0`,style:{color:`var(--system-mid-strong)`}}):(0,Z.jsx)(T,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:S?(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(E,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):_?(0,Z.jsx)(re,{assistantId:e,skillId:t.id,fileName:_.name,filePath:_.path,content:b,isBinary:x,editable:t.kind===`installed`},`${t.id}/${_.path}`):(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]})}function re({assistantId:e,skillId:n,fileName:r,filePath:o,content:s,isBinary:c,editable:u}){let d=a(),f=l(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),_=`skills/${n}/${o}`,v=M({onSuccess:()=>{m(!1),g(``),f.invalidateQueries({queryKey:[{_id:`skillsByIdFilesContentGet`}]}),f.invalidateQueries({queryKey:[{_id:`skillsByIdFilesGet`}]}),o===`SKILL.md`&&ee(f,e)},onError:e=>{t(e,{context:`skill-file-save`,bestEffort:!0})}}),y=p&&h!==(s??``),b=(0,X.useCallback)(()=>{!y||v.isPending||v.mutate({path:{assistant_id:e},body:{path:_,content:h,encoding:`utf8`}})},[y,v,e,_,h]),x=(0,X.useCallback)(()=>{m(!0),g(s??``),v.reset()},[s,v]),S=(0,X.useCallback)(()=>{m(!1),g(``),v.reset()},[v]);if(c)return(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`});if(s===null)return(0,Z.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,r,`.`]});let C=u?(0,Z.jsx)(i,{variant:`ghost`,size:`regular`,iconOnly:(0,Z.jsx)(w,{"aria-hidden":!0}),onClick:()=>d(`${N.workspace}?file=${encodeURIComponent(_)}`),"aria-label":`Open in Workspace`,className:`hover:bg-[var(--surface-base)]`}):void 0;return O(r,void 0)&&!p?(0,Z.jsx)(`div`,{className:`relative flex h-full flex-col`,children:(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:[(0,Z.jsx)(q,{content:s,fileName:r,showEdit:u,isEditing:!1,onToggleEdit:x,extraActions:C}),(0,Z.jsx)(k,{content:s})]})}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:p?h:s,fileName:r,showEdit:u,isEditing:p,onToggleEdit:()=>p?S():x(),extraActions:C}),p?(0,Z.jsx)(K,{value:h,onChange:g,onSave:b}):(0,Z.jsx)(W,{content:s,readOnly:!u,onStartEdit:x})]}),p&&(0,Z.jsx)(G,{isDirty:y,isSaving:v.isPending,error:v.isError?`Save failed`:null,onSave:b,onDiscard:S})]})}var ie=e(r(),1);function ae({fileName:e,content:t,isBinary:n,viewMode:r=`preview`}){return n?(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`}):t===null?(0,Z.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,e,`.`]}):O(e,void 0)&&r===`preview`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,Z.jsx)(k,{content:t})}):(0,Z.jsx)(`pre`,{className:`h-full overflow-y-auto whitespace-pre-wrap break-words p-4 font-mono text-body-small-default`,style:{color:`var(--content-default)`},children:t})}function oe({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,swipeContainerRef:c,sourceConversationId:l}){let u=h(t),d=H(t),{fileEntries:p,setSelectedPath:g,activePath:_,activeFile:v,isFilesLoading:b,fileContent:x,isBinary:S,isContentLoading:w}=V(e,t.id),[T,k]=(0,X.useState)(`preview`);(0,X.useEffect)(()=>{k(`preview`)},[_]);let[A,j]=(0,X.useState)(null);(0,X.useEffect)(()=>{j(document.getElementById(`viewport-overlays`))},[]);let M=v?O(v.name,void 0):!1,N=M?T:`raw`,P=(0,Z.jsxs)(`div`,{ref:c,className:`fixed inset-0 z-40 flex flex-col overflow-hidden bg-[var(--surface-overlay)]`,style:{paddingTop:`calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))`,paddingBottom:`calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))`,paddingLeft:`calc(12px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)))`,paddingRight:`calc(12px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))`},children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(i,{variant:`ghost`,iconOnly:(0,Z.jsx)(m,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to skills`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-2 text-center text-body-medium-default`,style:{color:`var(--content-secondary)`},children:t.name}),(0,Z.jsx)(se,{available:u,removable:d,isInstalling:o,isRemoving:s,onInstall:r,onRemove:a})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(J,{skill:t,className:`h-6 w-6 shrink-0 text-[22px] leading-none`}),(0,Z.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:t.name})]}),(0,Z.jsx)(y,{origin:t.origin})]}),(0,Z.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.description}),(0,Z.jsx)(B,{skill:{origin:t.origin,sourceConversationId:l}})]}),(0,Z.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,Z.jsxs)(`div`,{className:`mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border bg-[var(--surface-lift)]`,style:{borderColor:`var(--border-hover)`},children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,style:{borderColor:`var(--border-hover)`},children:[(0,Z.jsx)(ce,{fileEntries:p,activePath:_,activeName:v?.name??null,onSelect:g}),(0,Z.jsx)(D,{iconOnly:!0,ariaLabel:`File view mode`,value:N,onChange:k,items:[{value:`preview`,label:`Preview`,icon:(0,Z.jsx)(I,{"aria-hidden":!0}),disabled:!M},{value:`raw`,label:`Source`,icon:(0,Z.jsx)(C,{"aria-hidden":!0})}]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:b||w?(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(E,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):v?(0,Z.jsx)(ae,{fileName:v.name,content:x,isBinary:S,viewMode:N}):(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]});return A?(0,ie.createPortal)(P,A):P}function se({available:e,removable:t,isInstalling:n,isRemoving:r,onInstall:a,onRemove:o}){return n||r?(0,Z.jsx)(i,{variant:`ghost`,iconOnly:(0,Z.jsx)(E,{className:`animate-spin`,"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,"aria-label":`Pending`,className:`max-md:bg-[var(--surface-active)]`}):e?(0,Z.jsx)(i,{variant:`ghost`,iconOnly:(0,Z.jsx)(P,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Install skill`,onClick:a,disabled:!a,className:`max-md:bg-[var(--surface-active)]`}):t?(0,Z.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,Z.jsx)(R,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Remove skill`,onClick:o,disabled:!o,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`}):(0,Z.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,Z.jsx)(R,{"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,title:`Bundled skills cannot be removed`,"aria-label":`Bundled skill cannot be removed`,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`})}function Q(e){return(e??``).endsWith(`/directory`)}function ce({fileEntries:e,activePath:t,activeName:n,onSelect:r}){let i=n??`Select a file`;return e.length===0?(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{className:`truncate`,children:i})]}):(0,Z.jsxs)(S.Root,{children:[(0,Z.jsx)(S.Trigger,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 rounded-md text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{className:`truncate`,children:i}),(0,Z.jsx)(x,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})}),(0,Z.jsx)(S.Content,{align:`start`,children:e.map(e=>{let n=Q(e.mimeType);return(0,Z.jsx)(S.Item,{onSelect:()=>r(e.path),leftIcon:n?(0,Z.jsx)(F,{}):(0,Z.jsx)(T,{}),"aria-current":e.path===t?`true`:void 0,children:e.name},e.path)})})]})}function $(){return(0,Z.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)]`,"aria-hidden":!0,children:(0,Z.jsx)(T,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})}function le(){let e=z(),{skillId:t}=o(),n=a(),r=c(),{pathname:l}=r,d=L(),f=(0,X.useRef)(null),p=r.state,h=typeof p?.listSearch==`string`?p.listSearch:``,y=u({...A({path:{assistant_id:e},query:{include:`catalog`}}),select:e=>e.skills,refetchOnMount:`always`}),x=(0,X.useCallback)(()=>{n(`${N.skills.root}${h}`,{replace:!0})},[n,h]);te({containerRef:f,onBack:x,enabled:d,navKey:l});let{handleInstall:S,handleRemove:C,isInstallingSkill:w,isRemovingSkill:T,skillPendingRemoval:E,confirmRemove:D,cancelRemove:O}=b(e,{onRemoved:x}),k=y.data,M=(0,X.useMemo)(()=>k?.find(e=>e.id===t)??null,[k,t]),P=u({...j({path:{assistant_id:e,id:t??``}}),enabled:!!t&&M?.origin===`assistant-memory`,select:e=>e.skill.origin===`assistant-memory`?e.skill.sourceConversationId??null:null});if(!t)return(0,Z.jsx)(s,{to:N.skills.root,replace:!0});if(y.isLoading)return(0,Z.jsx)(_,{});if(y.isError&&!M)return(0,Z.jsx)(v,{});if(!M&&y.isFetching)return(0,Z.jsx)(_,{});if(!M)return(0,Z.jsx)(g,{icon:Y,title:`Skill not found`,subtitle:`This skill may have been removed, or the link is out of date.`,children:(0,Z.jsx)(i,{type:`button`,variant:`outlined`,className:`mt-4`,leftIcon:(0,Z.jsx)(m,{"aria-hidden":!0}),onClick:x,children:`Back to skills`})});let F={assistantId:e,skill:M,onBack:x,onInstall:()=>S(M),onRemove:()=>C(M),isInstalling:w(M),isRemoving:T(M),sourceConversationId:P.data??void 0};return(0,Z.jsxs)(Z.Fragment,{children:[d?(0,Z.jsx)(oe,{...F,swipeContainerRef:f}):(0,Z.jsx)(ne,{...F}),(0,Z.jsx)(U,{skillName:E?.name??null,onConfirm:D,onCancel:O})]})}export{le as SkillDetailPage};
1
+ import{o as e}from"./chunk-jRWAZmH_.js";import{t}from"./capture-error-Dhiismgm.js";import{t as n}from"./react-DJZBPgpf.js";import{F as r,t as i}from"./button-amTXFI-2.js";import{d as a,p as o,r as s,u as c}from"./chunk-5KNZJZUH-DdS6bb-3.js";import{n as l}from"./QueryClientProvider-DKhXIxGb.js";import{t as u}from"./useQuery-B45lW1Kk.js";import{t as d}from"./jsx-runtime-CVSDxk6A.js";import{t as f}from"./card-Bv5O5juh.js";import{t as p}from"./createLucideIcon-IRfcSUxS.js";import{t as m}from"./arrow-left-DI9551VI.js";import{a as h,i as g,n as _,r as v,s as y,t as b}from"./use-skill-actions-BpVxiQZY.js";import{t as x}from"./chevron-down-qD-re7AW.js";import{t as S}from"./menu-Dy5QbnTj.js";import{t as C}from"./code-Czx7d7SK.js";import{t as w}from"./external-link-Dqpx9nRm.js";import{t as T}from"./file-text-CYJz-GvF.js";import{t as E}from"./loader-circle-Cz7opInR.js";import"./src-zsLiFPw3.js";import{n as D}from"./stat-square-CTHnQ1jc.js";import{n as O,t as k}from"./file-markdown-Bq97tNxs.js";import{St as A,bt as j,on as M}from"./react-query.gen-C6wVk6Rw.js";import{c as N}from"./routes-BbeIx_F9.js";import{Ma as P,_r as F,sa as I,ua as L,vi as R}from"./index-yu6nDHvG.js";import{t as z}from"./use-active-assistant-id-BWXi63qg.js";import{n as B,t as V}from"./use-skill-detail-files-Dpp521cY.js";import{n as H,r as U,t as ee}from"./skills-AtSQBwXr.js";import{t as te}from"./use-edge-swipe-back-B4XlZ1Iu.js";import{i as W,n as G,r as K,t as q}from"./file-editor-sT7eHxsw.js";import{t as J}from"./skill-icon-cNkD2w1X.js";var Y=p(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),X=e(n(),1),Z=d();function ne({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,sourceConversationId:c}){let l=h(t),u=H(t),{fileEntries:d,setSelectedPath:p,activePath:g,activeFile:_,isFilesLoading:v,fileContent:b,isBinary:x,isContentLoading:S}=V(e,t.id);return(0,Z.jsxs)(`div`,{className:`flex h-[calc(100vh-14rem)] flex-col`,children:[(0,Z.jsxs)(`div`,{className:`mb-4 flex items-start gap-3`,children:[(0,Z.jsx)(i,{type:`button`,variant:`ghost`,iconOnly:(0,Z.jsx)(m,{"aria-hidden":!0}),"aria-label":`Back to skills`,onClick:n}),(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-3 sm:flex-row sm:items-center`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-3`,children:[(0,Z.jsx)(J,{skill:t,className:`h-8 w-8 text-3xl`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,Z.jsx)(`h2`,{className:`text-title-medium`,style:{color:`var(--content-default)`},children:t.name}),(0,Z.jsx)(y,{origin:t.origin})]}),(0,Z.jsx)(`p`,{className:`mt-0.5 line-clamp-2 text-body-medium-lighter`,style:{color:`var(--content-secondary)`},children:t.description}),(0,Z.jsx)(B,{skill:{origin:t.origin,sourceConversationId:c},className:`mt-1`})]})]}),l?o?(0,Z.jsx)(`div`,{className:`flex h-9 items-center px-3`,children:(0,Z.jsx)(E,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):(0,Z.jsx)(i,{type:`button`,onClick:r,disabled:!r,leftIcon:(0,Z.jsx)(P,{"aria-hidden":!0}),children:`Install`}):(0,Z.jsx)(i,{type:`button`,variant:u?`dangerOutline`:`outlined`,onClick:a,disabled:!u||s||!a,leftIcon:s?(0,Z.jsx)(E,{className:`animate-spin`,"aria-hidden":!0}):(0,Z.jsx)(R,{"aria-hidden":!0}),children:`Remove`})]})]}),(0,Z.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,Z.jsxs)(`div`,{className:`flex flex-1 flex-col overflow-hidden sm:grid`,style:{gridTemplateColumns:`240px 1fr`},children:[(0,Z.jsx)(`div`,{className:`max-h-40 shrink-0 overflow-y-auto border-b p-2 sm:max-h-none sm:border-b-0 sm:border-r`,style:{borderColor:`var(--border-base)`},children:v?(0,Z.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Z.jsx)(E,{className:`h-4 w-4 animate-spin`,style:{color:`var(--content-tertiary)`}})}):d.length===0?(0,Z.jsx)(`p`,{className:`px-3 py-4 text-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`No files available.`}):d.map(e=>{let t=g===e.path,n=(e.mimeType??``).endsWith(`/directory`);return(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>p(e.path),className:`flex w-full items-center gap-2 rounded px-2 py-1.5 text-left text-body-medium-lighter transition-colors hover:bg-[var(--surface-hover)]`,style:{color:t?`var(--primary-base)`:`var(--content-default)`,backgroundColor:t?`color-mix(in oklab, var(--primary-base) 10%, transparent)`:void 0},children:[n?(0,Z.jsx)(I,{className:`h-4 w-4 shrink-0`,style:{color:`var(--system-mid-strong)`}}):(0,Z.jsx)(T,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-secondary)`}}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]},e.path)})}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:S?(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(E,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):_?(0,Z.jsx)(re,{assistantId:e,skillId:t.id,fileName:_.name,filePath:_.path,content:b,isBinary:x,editable:t.kind===`installed`},`${t.id}/${_.path}`):(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]})}function re({assistantId:e,skillId:n,fileName:r,filePath:o,content:s,isBinary:c,editable:u}){let d=a(),f=l(),[p,m]=(0,X.useState)(!1),[h,g]=(0,X.useState)(``),_=`skills/${n}/${o}`,v=M({onSuccess:()=>{m(!1),g(``),f.invalidateQueries({queryKey:[{_id:`skillsByIdFilesContentGet`}]}),f.invalidateQueries({queryKey:[{_id:`skillsByIdFilesGet`}]}),o===`SKILL.md`&&ee(f,e)},onError:e=>{t(e,{context:`skill-file-save`,bestEffort:!0})}}),y=p&&h!==(s??``),b=(0,X.useCallback)(()=>{!y||v.isPending||v.mutate({path:{assistant_id:e},body:{path:_,content:h,encoding:`utf8`}})},[y,v,e,_,h]),x=(0,X.useCallback)(()=>{m(!0),g(s??``),v.reset()},[s,v]),S=(0,X.useCallback)(()=>{m(!1),g(``),v.reset()},[v]);if(c)return(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`});if(s===null)return(0,Z.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,r,`.`]});let C=u?(0,Z.jsx)(i,{variant:`ghost`,size:`regular`,iconOnly:(0,Z.jsx)(w,{"aria-hidden":!0}),onClick:()=>d(`${N.workspace}?file=${encodeURIComponent(_)}`),"aria-label":`Open in Workspace`,className:`hover:bg-[var(--surface-base)]`}):void 0;return O(r,void 0)&&!p?(0,Z.jsx)(`div`,{className:`relative flex h-full flex-col`,children:(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:[(0,Z.jsx)(q,{content:s,fileName:r,showEdit:u,isEditing:!1,onToggleEdit:x,extraActions:C}),(0,Z.jsx)(k,{content:s})]})}):(0,Z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Z.jsxs)(`div`,{className:`relative flex-1 overflow-hidden`,children:[(0,Z.jsx)(q,{content:p?h:s,fileName:r,showEdit:u,isEditing:p,onToggleEdit:()=>p?S():x(),extraActions:C}),p?(0,Z.jsx)(K,{value:h,onChange:g,onSave:b}):(0,Z.jsx)(W,{content:s,readOnly:!u,onStartEdit:x})]}),p&&(0,Z.jsx)(G,{isDirty:y,isSaving:v.isPending,error:v.isError?`Save failed`:null,onSave:b,onDiscard:S})]})}var ie=e(r(),1);function ae({fileName:e,content:t,isBinary:n,viewMode:r=`preview`}){return n?(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Binary file — no preview available.`}):t===null?(0,Z.jsxs)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:[`No preview available for `,e,`.`]}):O(e,void 0)&&r===`preview`?(0,Z.jsx)(`div`,{className:`h-full overflow-auto px-6 py-4`,style:{color:`var(--content-default)`},children:(0,Z.jsx)(k,{content:t})}):(0,Z.jsx)(`pre`,{className:`h-full overflow-y-auto whitespace-pre-wrap break-words p-4 font-mono text-body-small-default`,style:{color:`var(--content-default)`},children:t})}function Q({assistantId:e,skill:t,onBack:n,onInstall:r,onRemove:a,isInstalling:o=!1,isRemoving:s=!1,swipeContainerRef:c,sourceConversationId:l}){let u=h(t),d=H(t),{fileEntries:p,setSelectedPath:g,activePath:_,activeFile:v,isFilesLoading:b,fileContent:x,isBinary:S,isContentLoading:w}=V(e,t.id),[T,k]=(0,X.useState)(`preview`);(0,X.useEffect)(()=>{k(`preview`)},[_]);let[A,j]=(0,X.useState)(null);(0,X.useEffect)(()=>{j(document.getElementById(`viewport-overlays`))},[]);let M=v?O(v.name,void 0):!1,N=M?T:`raw`,P=(0,Z.jsxs)(`div`,{ref:c,className:`fixed inset-0 z-40 flex flex-col overflow-hidden bg-[var(--surface-overlay)]`,style:{paddingTop:`calc(8px + var(--safe-area-inset-top, env(safe-area-inset-top, 0px)))`,paddingBottom:`calc(8px + var(--safe-area-inset-bottom, env(safe-area-inset-bottom, 0px)))`,paddingLeft:`calc(12px + var(--safe-area-inset-left, env(safe-area-inset-left, 0px)))`,paddingRight:`calc(12px + var(--safe-area-inset-right, env(safe-area-inset-right, 0px)))`},children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,Z.jsx)(i,{variant:`ghost`,iconOnly:(0,Z.jsx)(m,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Back to skills`,onClick:n,className:`max-md:bg-[var(--surface-active)]`}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate px-2 text-center text-body-medium-default`,style:{color:`var(--content-secondary)`},children:t.name}),(0,Z.jsx)(oe,{available:u,removable:d,isInstalling:o,isRemoving:s,onInstall:r,onRemove:a})]}),(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(J,{skill:t,className:`h-6 w-6 shrink-0 text-[22px] leading-none`}),(0,Z.jsx)(`h2`,{className:`min-w-0 truncate text-title-medium`,style:{color:`var(--content-emphasised)`},children:t.name})]}),(0,Z.jsx)(y,{origin:t.origin})]}),(0,Z.jsx)(`p`,{className:`text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:t.description}),(0,Z.jsx)(B,{skill:{origin:t.origin,sourceConversationId:l}})]}),(0,Z.jsx)(f.Root,{asChild:!0,noPadding:!0,children:(0,Z.jsxs)(`div`,{className:`mt-6 flex min-h-0 flex-1 flex-col overflow-hidden rounded-2xl border bg-[var(--surface-lift)]`,style:{borderColor:`var(--border-hover)`},children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b px-3 py-2`,style:{borderColor:`var(--border-hover)`},children:[(0,Z.jsx)(ce,{fileEntries:p,activePath:_,activeName:v?.name??null,onSelect:g}),(0,Z.jsx)(D,{iconOnly:!0,ariaLabel:`File view mode`,value:N,onChange:k,items:[{value:`preview`,label:`Preview`,icon:(0,Z.jsx)(L,{"aria-hidden":!0}),disabled:!M},{value:`raw`,label:`Source`,icon:(0,Z.jsx)(C,{"aria-hidden":!0})}]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-hidden`,children:b||w?(0,Z.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Z.jsx)(E,{className:`h-6 w-6 animate-spin`,style:{color:`var(--content-tertiary)`}})}):v?(0,Z.jsx)(ae,{fileName:v.name,content:x,isBinary:S,viewMode:N}):(0,Z.jsx)(`p`,{className:`flex h-full items-center justify-center text-body-medium-lighter`,style:{color:`var(--content-tertiary)`},children:`Select a file to view its contents.`})})]})})]});return A?(0,ie.createPortal)(P,A):P}function oe({available:e,removable:t,isInstalling:n,isRemoving:r,onInstall:a,onRemove:o}){return n||r?(0,Z.jsx)(i,{variant:`ghost`,iconOnly:(0,Z.jsx)(E,{className:`animate-spin`,"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,"aria-label":`Pending`,className:`max-md:bg-[var(--surface-active)]`}):e?(0,Z.jsx)(i,{variant:`ghost`,iconOnly:(0,Z.jsx)(P,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Install skill`,onClick:a,disabled:!a,className:`max-md:bg-[var(--surface-active)]`}):t?(0,Z.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,Z.jsx)(R,{"aria-hidden":!0}),expandOnMobile:!0,"aria-label":`Remove skill`,onClick:o,disabled:!o,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`}):(0,Z.jsx)(i,{variant:`dangerGhost`,iconOnly:(0,Z.jsx)(R,{"aria-hidden":!0}),expandOnMobile:!0,disabled:!0,title:`Bundled skills cannot be removed`,"aria-label":`Bundled skill cannot be removed`,className:`max-md:rounded-full max-md:bg-[var(--system-negative-weak)]`})}function se(e){return(e??``).endsWith(`/directory`)}function ce({fileEntries:e,activePath:t,activeName:n,onSelect:r}){let i=n??`Select a file`;return e.length===0?(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2 text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{className:`truncate`,children:i})]}):(0,Z.jsxs)(S.Root,{children:[(0,Z.jsx)(S.Trigger,{children:(0,Z.jsxs)(`button`,{type:`button`,className:`flex min-w-0 items-center gap-2 rounded-md text-body-medium-default`,style:{color:`var(--content-emphasised)`},children:[(0,Z.jsx)($,{}),(0,Z.jsx)(`span`,{className:`truncate`,children:i}),(0,Z.jsx)(x,{className:`h-4 w-4 shrink-0`,style:{color:`var(--content-tertiary)`},"aria-hidden":!0})]})}),(0,Z.jsx)(S.Content,{align:`start`,children:e.map(e=>{let n=se(e.mimeType);return(0,Z.jsx)(S.Item,{onSelect:()=>r(e.path),leftIcon:n?(0,Z.jsx)(I,{}):(0,Z.jsx)(T,{}),"aria-current":e.path===t?`true`:void 0,children:e.name},e.path)})})]})}function $(){return(0,Z.jsx)(`span`,{className:`flex h-6 w-6 shrink-0 items-center justify-center rounded-md bg-[var(--surface-base)]`,"aria-hidden":!0,children:(0,Z.jsx)(T,{className:`h-4 w-4`,style:{color:`var(--content-secondary)`}})})}function le(){let e=z(),{skillId:t}=o(),n=a(),r=c(),{pathname:l}=r,d=F(),f=(0,X.useRef)(null),p=r.state,h=typeof p?.listSearch==`string`?p.listSearch:``,y=u({...A({path:{assistant_id:e},query:{include:`catalog`}}),select:e=>e.skills,refetchOnMount:`always`}),x=(0,X.useCallback)(()=>{n(`${N.skills.root}${h}`,{replace:!0})},[n,h]);te({containerRef:f,onBack:x,enabled:d,navKey:l});let{handleInstall:S,handleRemove:C,isInstallingSkill:w,isRemovingSkill:T,skillPendingRemoval:E,confirmRemove:D,cancelRemove:O}=b(e,{onRemoved:x}),k=y.data,M=(0,X.useMemo)(()=>k?.find(e=>e.id===t)??null,[k,t]),P=u({...j({path:{assistant_id:e,id:t??``}}),enabled:!!t&&M?.origin===`assistant-memory`,select:e=>e.skill.origin===`assistant-memory`?e.skill.sourceConversationId??null:null});if(!t)return(0,Z.jsx)(s,{to:N.skills.root,replace:!0});if(y.isLoading)return(0,Z.jsx)(_,{});if(y.isError&&!M)return(0,Z.jsx)(v,{});if(!M&&y.isFetching)return(0,Z.jsx)(_,{});if(!M)return(0,Z.jsx)(g,{icon:Y,title:`Skill not found`,subtitle:`This skill may have been removed, or the link is out of date.`,children:(0,Z.jsx)(i,{type:`button`,variant:`outlined`,className:`mt-4`,leftIcon:(0,Z.jsx)(m,{"aria-hidden":!0}),onClick:x,children:`Back to skills`})});let I={assistantId:e,skill:M,onBack:x,onInstall:()=>S(M),onRemove:()=>C(M),isInstalling:w(M),isRemoving:T(M),sourceConversationId:P.data??void 0};return(0,Z.jsxs)(Z.Fragment,{children:[d?(0,Z.jsx)(Q,{...I,swipeContainerRef:f}):(0,Z.jsx)(ne,{...I}),(0,Z.jsx)(U,{skillName:E?.name??null,onConfirm:D,onCancel:O})]})}export{le as SkillDetailPage};